Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/agent-directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ listing, not five.

This matters because a `*` (or any non-exact) pin would let a later tarball
landing in the registry silently change what an already-deployed specialist
runs, with no record of the change (CL-7389). Resolving a version only
runs, with no record of the change. Resolving a version only
happens when a pin is newly added or a definition is newly created with
named pins:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The HTTP surface for Myra-backed agent-definition drafting
// (CL-6074): tenant-scoped, `requireGrant`-gated, personal to the
//: tenant-scoped, `requireGrant`-gated, personal to the
// requesting principal, request parsing via arktype at the boundary,
// route registration only. Error copy at this boundary is plain
// language for the person who typed the description; the technical
Expand Down Expand Up @@ -38,7 +38,7 @@ const CreateAgentDefinitionDraftBody = type({
export type CreateAgentDefinitionDraftRoutesDeps = {
requireGrant: RequireGrant;
/**
* The agent-definition drafting port (CL-6074) — omitted entirely on
* The agent-definition drafting port — omitted entirely on
* a host that hasn't wired Myra drafting up yet, in which case this
* route 404s rather than pretending to draft and always failing.
* The route never touches `./agent-definition-drafting.ts`'s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describe("createMyraAgentDefinitionDrafting", () => {
expect(sentPrompt).not.toContain("request_capability");
});

// CL-5879: a specialist agent delegated to via @mention deep-dives in
// A specialist agent delegated to via @mention deep-dives in
// a thread; the drafting brief must tell the drafted agent to close
// that thread out with a summary back to whoever delegated it and to
// the main conversation, so a handoff never dead-ends in the thread.
Expand All @@ -358,7 +358,7 @@ describe("createMyraAgentDefinitionDrafting", () => {
expect(sentPrompt).toContain("whoever delegated it and to the main");
});

// CL-6350: every drafted agent's systemPrompt must carry an explicit
// Every drafted agent's systemPrompt must carry an explicit
// output contract and name its own tools, matching the prompt
// discipline Myra's own system prompt already follows.
test("the drafting brief requires an explicit output contract and named tools in the drafted systemPrompt", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/agent-definition-drafting.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Myra-backed agent-definition drafting (CL-6074): turns a name and a
// Myra-backed agent-definition drafting: turns a name and a
// plain-language "what should this agent do?" description into a
// machine-checked draft via one one-shot Myra call — the third consumer
// of the inventory-assembly + strict-reply-schema +
Expand Down Expand Up @@ -32,7 +32,7 @@ const MAX_REPLY_EXCERPT = 400;
const MAX_SYSTEM_PROMPT_LENGTH = 8000;
const MAX_DESCRIPTION_LENGTH = 500;

/** `@corbits/capability-tools`' package name (CL-6084/CL-6086) — the
/** `@corbits/capability-tools`' package name — the
* `request_capability` bundle every drafted agent gets pinned by
* default (see `validateAgentDefinitionDraftReplyAgainstInventory`'s
* default-pin step below), the same way a definition that pins skills
Expand Down
8 changes: 4 additions & 4 deletions packages/agent-directory/src/agent-workflow.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Regression for CL-6334: `SKILLS_TOOL_PACKAGE_PIN` named
// `SKILLS_TOOL_PACKAGE_PIN` named
// `@corbits/tools-skills`, but `tool-registry-publish`'s
// `CORBITS_TOOL_PACKAGE_DIRS` never listed that package's directory, so
// a definition pinning skills carried a pin the corbits-tools registry
Expand Down Expand Up @@ -32,7 +32,7 @@ describe("SKILLS_TOOL_PACKAGE_PIN", () => {
});
});

// CL-7389: a runtime tool-package pin must resolve to a concrete,
// A runtime tool-package pin must resolve to a concrete,
// published version — never the npm "any version" range `*` — so a
// later tarball landing in the registry never silently changes what an
// already-deployed specialist runs.
Expand Down Expand Up @@ -85,7 +85,7 @@ describe("withAgentToolPackagePin", () => {
});
});

// CL-7592: pinned skill names read back out of the definition's own
// Pinned skill names read back out of the definition's own
// serialized `workflow.json` (the `<available_skills>` stanza
// `reindexPinnedSkills` writes) — the asset is the source of truth for
// pins now that the Workbench-owned `definition_skills` store is gone.
Expand Down Expand Up @@ -121,7 +121,7 @@ describe("readPinnedSkillNames", () => {
});
});

// CL-7389: a `create_agent`/`POST /agent-definitions` call pinning several
// A `create_agent`/`POST /agent-definitions` call pinning several
// tool packages by name shares one registry resolver across all of them
// (`createPinnedVersionResolver`), so it costs one ancestor walk and one
// tarball listing, never one per pin.
Expand Down
8 changes: 4 additions & 4 deletions packages/agent-directory/src/agent-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export function readAgentCapabilities(workflowJson: string): AgentDefinitionCapa
* an operator hand-authoring a workflow source file is free to write
* one; but every RUNTIME site this package writes a pin from
* (`create_agent`'s tool-package pins, guided capability-add) must name
* a version the resolver actually offers today (CL-7389) — a `*` pin
* a version the resolver actually offers today — a `*` pin
* means a later tarball landing in the registry silently changes what
* an already-deployed specialist runs, with no record of the change.
* `./tool-package-version.ts`'s `resolvePinnedVersion` is how a caller
Expand All @@ -248,7 +248,7 @@ export const NonWildcardToolPackagePin = type({
semver.valid(pin.version) !== null
? true
: ctx.mustBe(
'a concrete published version, never "*", "latest", or a range/tag like "^1", "~1.2", ">=1.0.0", "1.x" — anything but an exact version would let a later tarball silently change what this pin resolves to (CL-7389)',
'a concrete published version, never "*", "latest", or a range/tag like "^1", "~1.2", ">=1.0.0", "1.x" — anything but an exact version would let a later tarball silently change what this pin resolves to',
),
);
export type NonWildcardToolPackagePin = typeof NonWildcardToolPackagePin.infer;
Expand Down Expand Up @@ -354,7 +354,7 @@ export interface AgentDefinitionWorkflowInput {
* Credential bindings the deployed definition carries at the workflow
* level — the same `CredentialBinding[]` shape and the same
* `defineWorkflow({ credentialBindings, ... })` field
* `workflows/granola-call` pins through (CL-6028's pattern). Additive:
* `workflows/granola-call` pins through (pattern). Additive:
* undeclared or empty behaves exactly like a definition built before
* this field existed. Required for a `toolPackagePins` entry whose
* tool needs a live credential to do anything at runtime — a pin with
Expand Down Expand Up @@ -548,7 +548,7 @@ export async function createAgentDefinitionCore(
// One resolver shared across every named pin: it loads the tenant's
// registry asset and tarball listing at most once, so a five-pin
// create still costs one ancestor walk and one listing, not five
// (CL-7389).
//.
const resolvePin = createPinnedVersionResolver(
{ db: deps.db, assetService: deps.assetService },
input.tenantId,
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-directory/src/asset-write.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Same-asset definition edits are read-modify-write: two concurrent
// routes that snapshot the same workflow.json and then each write their
// own field would last-write-wins clobber the other (CL-7216). This
// own field would last-write-wins clobber the other. This
// module serializes those writers and retries the loser against the
// latest snapshot.
//
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/capability-add.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Capability-add is a read-modify-write of the definition's asset: two
// concurrent POSTs that both snapshot the same workflow.json and then
// each write their own pin would last-write-wins clobber the other
// (CL-7216). This module owns that mutation so both the tenant-session
//. This module owns that mutation so both the tenant-session
// route and the workflow-run route retry the loser against the latest
// snapshot instead of silently dropping an add. The lock itself lives
// in `./asset-write.ts` so sibling RMW routes share it.
Expand Down Expand Up @@ -108,7 +108,7 @@ async function prepareCapabilityAdd(
// a no-op on the version, never a silent bump to whatever the
// registry's newest tarball happens to be today. Only a name with
// no existing pin resolves fresh against the registry. An explicit
// bump is a distinct, explicit input this does not add (CL-7389).
// bump is a distinct, explicit input this does not add.
const packageName = args.body.name;
const existingPin = readAgentCapabilities(workflowJson).toolPackagePins.find(
(pin) => pin.name === packageName,
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-directory/src/capability-inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type CapabilityModelEntry = { readonly canonicalName: string };
* The pins every created specialist carries unless the caller names its
* own: search (via the workbench's MCP connections), firm memory, and
* the ask_user interaction card. A specialist without these is a name
* with a prompt — a "research agent" that cannot search (CL-6206).
* with a prompt — a "research agent" that cannot search.
*/
export const BASELINE_AGENT_TOOL_PINS = [
"@corbits/mcp-tools",
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import {
} from "./display-name";
import { isConversationalWorkflowName } from "@corbits/workflows/catalog";

// `deriveDisplayName`/`humanizeSlug` (CL-6413) live in `@corbits/chat`
// `deriveDisplayName`/`humanizeSlug` live in `@corbits/chat`
// itself, not here: this package already depends on `@corbits/chat` (for
// `isWorkbenchHostDefinitionName` below), so a copy defined here could
// never be imported back by `@corbits/chat`'s own call sites without a
// circular dependency — exactly the gap CL-6471 traces the "Run
// circular dependency — exactly the gap that traces the "Run
// 737a058d…" leak to (the chat participant invite/greeting path never
// migrated onto this derivation because it couldn't). Re-exported here so
// every existing caller of `@corbits/agent-directory/client`'s
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-directory/src/display-name.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("deriveDisplayName", () => {
);
});

test("throws rather than humanizing an internal run id into a fake name (CL-6471)", () => {
test("throws rather than humanizing an internal run id into a fake name", () => {
expect(() => deriveDisplayName({ name: "run_737a058d48006e2bde12559576f422e0" })).toThrow(
/internal identifier/,
);
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/display-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// (or worse, a raw address/run id) reimplemented per call site.
//
// Lives in `@corbits/chat` rather than `@corbits/agent-directory` (which
// originated this logic, CL-6413) because `@corbits/agent-directory`
// originated this logic) because `@corbits/agent-directory`
// itself depends on `@corbits/chat` (`workbench-host-naming`); a reverse
// dependency would be circular. `@corbits/agent-directory/client.ts`
// re-exports `deriveDisplayName`/`humanizeSlug` from here for its existing
Expand Down Expand Up @@ -45,7 +45,7 @@ export function humanizeSlug(slug: string): string {
* `wfd_…`, …, see `./id-leak-guard`) — the product rule is that a person
* never sees an internal identifier, so a caller that reaches this
* function with a run id where a definition's slug belongs gets a loud
* failure instead of a Title-Cased leak like "Run 737a058d…" (CL-6471).
* failure instead of a Title-Cased leak like "Run 737a058d…".
*/
export function deriveDisplayName(definition: {
readonly name: string;
Expand Down
10 changes: 5 additions & 5 deletions packages/agent-directory/src/id-leak-guard.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// The systemic guard CL-6471 calls for: a person never sees an internal
// The systemic guard this module enforces: a person never sees an internal
// identifier — not as a participant's name, not in a join/system line,
// not in a greeting, not in a chat title. This has recurred repeatedly
// (a raw definitionId/runId in insights, a `writing_systems` id in a
// Myra reply, and CL-6471's own "Run 737a058d…" / "I'm run_737a…") each
// Myra reply, and its own "Run 737a058d…" / "I'm run_737a…") each
// time as a one-off display-time patch; this module is the one place
// every id-generating prefix is named, so a new leak is a missed test
// run rather than a missed grep.
//
// Prefix words mirror `@intx/hub-common`'s `generateId` (vendored;
// upstream source: `packages/hub-common/src/ids.ts`'s `PREFIXES`) for
// the six kinds CL-6471 names explicitly — a workflow run, a workflow
// the six kinds this guard names explicitly — a workflow run, a workflow
// definition, a tenant, a principal, an asset, and a git token — each
// normally followed by `_` and 32 lowercase hex characters (`run_737a…`).
//
// Matched with either `_`, a space, or `-` as the separator, not just
// `_`: `humanizeSlug`'s Title Case reading of a leaked id (CL-6471's own
// `_`: `humanizeSlug`'s Title Case reading of a leaked id (its own
// "Run 737a058d48006e2bde12559576f422e0") replaces the underscore with a
// space, so the raw and the humanized-leak forms both need to trip this.
const ID_PREFIX_WORDS = ["run", "wfd", "tnt", "prn", "ast", "gtk"] as const;
Expand All @@ -38,7 +38,7 @@ export function assertNoLeakedInternalId(value: string, context: string): void {
throw new Error(
`${context} carries an internal identifier ("${value}"); a person ` +
"must never see one — resolve the real name at the source instead " +
"of rendering the id (CL-6471)",
"of rendering the id",
);
}
}
2 changes: 1 addition & 1 deletion packages/agent-directory/src/inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type InventoryToolPackage = {
/** The credential a `{create}` definition pinning this tool package
* must be granted for the pin to work at runtime — the same
* `CredentialBinding` shape `workflows/granola-call`'s
* `GRANOLA_CALL_CREDENTIAL_BINDINGS` uses (CL-6028). `null` for a
* `GRANOLA_CALL_CREDENTIAL_BINDINGS` uses. `null` for a
* tool package that needs no per-tenant credential (e.g. the memory
* tool package). */
readonly credentialBinding: CredentialBinding | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Regression for CL-7363: Agent Builder definitions used to self-freeze
// Agent Builder definitions used to self-freeze
// through `@corbits/workflow-freeze`'s `DefinitionFreezer`, a hub-local
// path that bypasses the native sidecar probe. This package now deploys
// every definition write through the injected `WorkflowDeployer` — the
Expand Down
3 changes: 1 addition & 2 deletions packages/agent-directory/src/one-shot-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ export async function runOneShotPrompt(
// A run's session and event collector are ensured lazily now, at
// the hub seams that actually see the run become mail-routable
// (`apps/hub/src/mailbox-persist.ts`, the wrapped
// `eventCollectors` dispatch in `apps/hub/src/index.ts`) —
// CL-7480. Nothing here needs to record it.
// `eventCollectors` dispatch in `apps/hub/src/index.ts`).
} catch (cause) {
// The reply timer may have settled the run mid-wait; a late
// failure is then a phantom for an already-torn-down run.
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export function createAgentDefinitionRoutes({
});

// Every agent this tenant can open a direct chat with — its own agent
// definitions plus every ancestor's (CL-6253): the sidebar's unified
// definitions plus every ancestor's: the sidebar's unified
// recency-sorted stream reads this list, keyed by `tenantId` per row
// so a click can mint the DM in the agent's actual owning tenant, not
// the caller's.
Expand All @@ -317,7 +317,7 @@ export function createAgentDefinitionRoutes({
});

// A definition's kebab `name` is its immutable, URL-facing slug
// (CL-6413), so a slug-addressed detail screen resolves through this
//, so a slug-addressed detail screen resolves through this
// route rather than scanning a page of the definitions listing — an
// agent past the listing's pagination ceiling still answers on its own
// URL. Grant-checked tenant-wide because there is no definition id to
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-directory/src/stale-task-agent-naming.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Recognizes an agent definition minted by the now-deleted tasks
// primitive's planner `{create}` branch (CL-6051), each of which
// primitive's planner `{create}` branch, each of which
// existed for exactly one task. The minting side (what used to be
// `@corbits/task-planner`'s `plannerCreatedDefinitionHandle`) is gone
// along with that primitive — nothing creates a definition with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CL-7389: `resolvePinnedVersion` must resolve to a concrete, reproducible
// `resolvePinnedVersion` must resolve to a concrete, reproducible
// version — semver-sorted (never string-sorted), matched to the exact
// package name (never a prefix/suffix neighbor), and preferring the
// highest STABLE version over a higher-sorting prerelease. These are
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/tool-package-version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CL-7389: a runtime tool-package pin must resolve to a concrete,
// A runtime tool-package pin must resolve to a concrete,
// published version — never the npm "any version" range `*` — so a new
// tarball landing in the tenant's registry never silently changes what
// an already-deployed specialist runs. `withAgentToolPackagePin` (see
Expand Down Expand Up @@ -96,7 +96,7 @@ function resolveFromFilenames(
* one-name convenience wrapper; a caller resolving several names in one
* request (e.g. `create_agent`'s own `toolPackagePins`) should build one
* resolver and call it once per name instead, so a five-pin create still
* costs one ancestor walk and one listing, not five (CL-7389).
* costs one ancestor walk and one listing, not five.
*/
export function createPinnedVersionResolver(
deps: ResolvePinnedVersionDeps,
Expand Down
4 changes: 2 additions & 2 deletions packages/agent-directory/src/visible-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// same way `@intx/db`'s own `resolveProviderByName`/`listAssetsForTenant`
// do and `packages/connections/src/mcp-server-store.ts`'s
// `listMcpServerConnections` already does for MCP server connections
// (CL-6191) — a child tenant can reach anything a parent tenant made
// — a child tenant can reach anything a parent tenant made
// available, and a same-name definition made at the child shadows the
// ancestor's. Reads inherit up the chain; creating/editing a definition
// stays own-tenant only (`./routes.ts`).
Expand All @@ -17,7 +17,7 @@ export type VisibleAgentDefinition = {
readonly id: string;
/** The definition's display name — its own description when one was
* set at creation, otherwise a humanized reading of its immutable slug
* (`deriveDisplayName`, CL-6413). Never the raw slug itself. */
* (`deriveDisplayName`). Never the raw slug itself. */
readonly name: string;
/** The tenant that actually owns this definition — where its DM workbench
* must be minted, not necessarily the caller's own tenant. */
Expand Down
10 changes: 5 additions & 5 deletions packages/agent-directory/src/workflow-capability-routes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The sanctioned path for a workflow-process child to add itself a
// capability (`@corbits/capability-tools`'s `request_capability`,
// CL-6084) — the execution half of `POST /:definitionId/capabilities`
// capability (`@corbits/capability-tools`'s `request_capability`)
// — the execution half of `POST /:definitionId/capabilities`
// / `GET /capabilities/inventory` in `./routes.ts`, mirroring
// `@corbits/skills`' `createWorkflowSkillRoutes` and
// `@corbits/artifacts-hub`'s workflow-artifacts routes: a workflow child
Expand All @@ -13,7 +13,7 @@
// or path beyond the definitionId itself: the tenant and principal
// every write is scoped to come from the authenticated run alone.
//
// Authorization decision (deliberate, see CL-6085 for the durable fix):
// Authorization decision (deliberate):
// the vendored grant-materialization path never seeds a `kind:
// "workflow"` run's own principal a `workflow-definition: <its own
// id>/update` grant — `requireGrant` would 403 every self-update call a
Expand All @@ -34,8 +34,8 @@
// never touch another definition through this surface), and (3) the
// addition must fail closed against the tenant's live capability
// inventory (`assertCapabilityInInventory`, unchanged from the
// tenant-session route). CL-6085 tracks seeding the real self-update
// grant in vendor grant materialization, at which point this route can
// tenant-session route). Once the real self-update grant is seeded in
// vendor grant materialization, this route can
// route through `requireGrant` like every other definition-mutating
// surface instead of carrying this interim rule.
import { type } from "arktype";
Expand Down
Loading
Loading