@workerkit/core 0.3.21 → 0.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ and the package adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.22] - 2026-10-29
10
+
11
+ ### Changed
12
+
13
+ - `action_worker_options` without `app` returns the app inventory only, and `action_worker_create` requires an explicit `app` or `actionSpec`: there is no implicit app or hidden starter tool set. Slack prerequisites apply only to selected Slack tools, `app: customApi` returns setup metadata rather than selectable tools, and the README describes the same inventory-first flow.
14
+ - `worker_tools` reports `invocationSource`, `effect`, `idempotencyRequired`, `keyFormat`, `workerCallsSupported` and `invocationManagerScopes` for each tool. `worker_tool_call`, its `idempotencyKey` parameter and `worker_tool_invocation` describe the key and receipt rules per source: native and MCP writes need a unique key and their reads none, while every private API operation, including reads, needs `managePrivateApiApps` with `invokeActions` and a `v1:<Unix timestamp>:<32-hex UUID>` key and leaves a receipt. Reusing a key with identical arguments replays the journal and never resends.
15
+ - The workers, decision and directory instructions and the `kit_authoring_guide` description are shorter and separate advice, simple creation and custom drafting: fetch only the relevant `kit_authoring_guide` sections and per-app `kit_vocabulary` and `kit_app_tools` reads, reuse unchanged help, and treat the Manager tool list as management rather than the worker's business-app inventory. `workerkit_about` serves missing product context rather than a mandatory first read.
16
+ - `kit_app_tools`, `kit_vocabulary` and `kit_validate` say that `purpose: decision` returns three shortcut recipes rather than a source ceiling, that `requires` is one operation-gate contribution rather than full authorization, that `canPublish` checks validity rather than whether grants fit the job, and that `effectivePermissions` and `defaultedApps` need review because defaults may include writes. `decision_worker_create` says that recipes are shortcuts to the general catalog and that `confidenceFloor` is a routing threshold which never replaces labels with `unclear`.
17
+ - The kit `content` description says that an Action kit needs an explicit `actionSpec`, that Language kits may set `apps: []`, that explicit `apps` are preferred because `appCodes` defaults may grant writes, that one kit installs one worker and that `recommendedKit` installs nothing. `worker_permissions_set` says that `apps` is the native app set, that private API bindings stay on the dashboard with MCP tool bindings, and never to send `mcp:<slug>` entries. Kit references and `kit_install.githubSelection` no longer mention legacy numeric ids or a legacy single-account fallback.
18
+
9
19
  ## [0.3.21] - 2026-10-29
10
20
 
11
21
  ### Added
package/README.md CHANGED
@@ -157,27 +157,35 @@ there is no preview mode, and unsupported run controls, including those in
157
157
 
158
158
  An Action worker exposes explicitly selected, typed app tools that a caller
159
159
  invokes directly, without a reasoning model or a hosted deployment.
160
- `action_worker_options` lists the native and reviewed MCP apps, their tool
161
- schemas and the server's defaults. Creating one with `action_worker_create` and
162
- an `app` copies that app's default tools once; an explicit `actionSpec` can
163
- instead select up to 64 tools across apps. Omitting `app` selects Slack, and
164
- tools added to the catalog later must be selected by hand.
160
+ `action_worker_options` without `app` returns the app inventory only; with an
161
+ `app` it returns that app's reviewed tool schemas, defaults and connection
162
+ requirements. There is no implicit app: `action_worker_create` needs either an
163
+ `app`, which copies that app's reviewed defaults once, or an explicit
164
+ `actionSpec` that selects up to 64 tools across apps. Private API operations
165
+ are not selectable through `app` or `actionSpec`; their bindings are managed
166
+ in the dashboard. Tools added to the catalog later must be selected by hand.
165
167
 
166
168
  Read a worker's tool schemas with `worker_tools` before calling one with
167
169
  `worker_tool_call`, which takes `tokenId`, `toolName`, `arguments` and an
168
- optional `contractVersion: 1` and `idempotencyKey`. The key travels in the
169
- `Idempotency-Key` header; only the version and arguments go in the body. Give
170
- each intended write its own key and keep it for transport retries. Poll
170
+ optional `contractVersion: 1` and `idempotencyKey`. Each tool reports
171
+ `invocationSource`, `effect`, `idempotencyRequired` and `keyFormat`; follow
172
+ those rather than inferring from `readOnly`. The key travels in the
173
+ `Idempotency-Key` header; only the version and arguments go in the body.
174
+ Native and MCP writes need a unique key per intended write and their reads
175
+ need none; every private API operation, including reads, needs a
176
+ `v1:<Unix timestamp>:<32-hex UUID>` key. Keep a key for transport retries. Poll
171
177
  `worker_tool_invocation` for pending results, and never automatically resend
172
178
  an `outcome_unknown` call with a new key: the app may already have acted. A
173
179
  refusal marked `retryable` can be tried again later under a new key. A call
174
180
  cannot change the saved tool selection, connection or sender, and a
175
- changed tool contract needs an explicit owner review and save. Generic write
176
- receipts keep the confirmation without storing private app response bodies.
181
+ changed tool contract needs an explicit owner review and save. Native and MCP
182
+ write receipts keep the confirmation without storing private app response
183
+ bodies.
177
184
 
178
185
  A call answers with `status` `succeeded`, `denied`, `failed`, `in_progress` or
179
- `outcome_unknown`, plus `invocationId` on a write (reads leave no receipt).
180
- Repeating a write's key with the same arguments returns the stored receipt
186
+ `outcome_unknown`, plus `invocationId` on a native or MCP write and on every
187
+ private API call; native and MCP reads leave no receipt.
188
+ Repeating a key with the same arguments returns the stored receipt
181
189
  without calling the app again; the same key with different arguments is a 409
182
190
  `idempotency_conflict`.
183
191
 
@@ -1,6 +1,6 @@
1
1
  export declare const backendContractProvenance: {
2
2
  readonly sourceRepository: "workerkit-backend";
3
3
  readonly contractVersion: "1.0.0";
4
- readonly sourceRevision: "e8880853652338ef6f68074913cb0f7c7378a1e4";
5
- readonly contentHash: "1fce929a89a043e3ca0a4be50dada2b4dba9d71f3aa412bdf882821bcf47fbb2";
4
+ readonly sourceRevision: "d02f1a22e7914cd568446798fd9c2bb0dcb72b6f";
5
+ readonly contentHash: "08db2eaeda15ed171a5b96d9eb76304aa2a8c1cdc55b118e1fa6e3a26303d5dc";
6
6
  };
@@ -2,7 +2,7 @@
2
2
  export const backendContractProvenance = {
3
3
  "sourceRepository": "workerkit-backend",
4
4
  "contractVersion": "1.0.0",
5
- "sourceRevision": "e8880853652338ef6f68074913cb0f7c7378a1e4",
6
- "contentHash": "1fce929a89a043e3ca0a4be50dada2b4dba9d71f3aa412bdf882821bcf47fbb2"
5
+ "sourceRevision": "d02f1a22e7914cd568446798fd9c2bb0dcb72b6f",
6
+ "contentHash": "08db2eaeda15ed171a5b96d9eb76304aa2a8c1cdc55b118e1fa6e3a26303d5dc"
7
7
  };
8
8
  //# sourceMappingURL=contract-provenance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-provenance.js","sourceRoot":"","sources":["../src/contract-provenance.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB,EAAE,mBAAmB;IACvC,iBAAiB,EAAE,OAAO;IAC1B,gBAAgB,EAAE,0CAA0C;IAC5D,aAAa,EAAE,kEAAkE;CACzE,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nexport const backendContractProvenance = {\n \"sourceRepository\": \"workerkit-backend\",\n \"contractVersion\": \"1.0.0\",\n \"sourceRevision\": \"e8880853652338ef6f68074913cb0f7c7378a1e4\",\n \"contentHash\": \"1fce929a89a043e3ca0a4be50dada2b4dba9d71f3aa412bdf882821bcf47fbb2\"\n} as const;\n"]}
1
+ {"version":3,"file":"contract-provenance.js","sourceRoot":"","sources":["../src/contract-provenance.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB,EAAE,mBAAmB;IACvC,iBAAiB,EAAE,OAAO;IAC1B,gBAAgB,EAAE,0CAA0C;IAC5D,aAAa,EAAE,kEAAkE;CACzE,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nexport const backendContractProvenance = {\n \"sourceRepository\": \"workerkit-backend\",\n \"contractVersion\": \"1.0.0\",\n \"sourceRevision\": \"d02f1a22e7914cd568446798fd9c2bb0dcb72b6f\",\n \"contentHash\": \"08db2eaeda15ed171a5b96d9eb76304aa2a8c1cdc55b118e1fa6e3a26303d5dc\"\n} as const;\n"]}
@@ -22,19 +22,19 @@ export const actionDescriptors = [
22
22
  defineTool({
23
23
  name: "action_worker_options", title: "Action Worker Setup", auth: "manager", method: "get",
24
24
  path: "/api/manage/workers/action-options", strictInput: true,
25
- description: managerAuthorityPreflight + "Get available apps, reviewed tool contracts, default tools and required connections for an Action worker: no model, instruction or deployment; invoke selected tools directly with worker_tool_call (modelType none). Slack tools need an active fixed bot: if no usable bot is returned, prompt connection setup and do not submit creation. Connection IDs and sender identities are server-owned. {{scope}} Creates and executes nothing.",
25
+ description: managerAuthorityPreflight + "Discover Action setup; creates/executes nothing. Omit app for the app inventory only, then choose an app for reviewed tools, defaults and connection requirements. Native/enabled reviewed MCP contracts can enter actionSpec; capabilities names source limits. app:customApi returns setup metadata, not selectable refs: API-only jobs use Language workers and dashboard finite-version bindings; no private API worker-slot calls. Action workers need no model/deployment. Actual Slack selections require a fixed active bot before creation; identities are server-owned. {{scope}}",
26
26
  schema: {
27
27
  operatorId: z.string().uuid().optional()
28
28
  .describe("The operator (workspace) to read connections for, as a GUID from apps_list → operators[]. Omit for the account's default operator."),
29
29
  app: z.string().min(1).max(128).optional()
30
- .describe("The app whose tools and defaultTools to return, exactly as apps[].code lists it. Omit for Slack."),
30
+ .describe("Omit for app inventory only. Supply an apps[].code for that app's reviewed tools/defaultTools; customApi returns setup metadata only."),
31
31
  },
32
32
  annotations: READ_ONLY,
33
33
  }),
34
34
  defineTool({
35
35
  name: "action_worker_create", title: "Create Action Worker", auth: "manager", method: "post",
36
36
  path: "/api/manage/workers/actions", strictInput: true,
37
- description: managerAuthorityPreflight + "Create a private Action kit and worker from action_worker_options. No model or deployment. Copies the app's default tools once; optional actionSpec selects up to 64 tools across apps. Slack tools require an active fixed bot: if none is available, prompt connection setup and do not submit creation. Missing ordinary app connections can be resolved after creation. Only explicit owner edits change installed tools. {{scope}} A selected-worker key gains the worker it creates. Reuse requestId with the same body after a timeout; never create a second worker to recover a lost response. Returns tokenId, workerId, kitSlug and modelType none, no worker key. Never deploy or run an Action worker: worker_run/worker_deploy refuse it with 400 action_worker_requires_invoke.",
37
+ description: managerAuthorityPreflight + "Create a private Action kit and worker after options discovery. Explicit app or actionSpec is required; there is no implicit app. app copies its reviewed defaults once; actionSpec selects up to 64 native/reviewed MCP tools across apps without needing app. Review any writes before creation. Private API refs are not selectable; follow source capabilities. Actual Slack tools require a fixed active bot; ordinary missing connections can follow creation. Only owner edits change tools. {{scope}} A selected-worker key gains its created worker. Reuse requestId/identical body after timeout; never recreate for recovery. Returns IDs/kitSlug/modelType none, no worker key. No model/deployment/run: worker_run/worker_deploy refuse with 400 action_worker_requires_invoke.",
38
38
  resultDescription: creationResultGuidance,
39
39
  footer: data => {
40
40
  if (!data || typeof data !== "object" || Array.isArray(data))
@@ -49,7 +49,7 @@ export const actionDescriptors = [
49
49
  name: z.string().min(1).max(100).describe("Name for the new worker and its private kit."),
50
50
  timeZoneId: z.string().trim().min(1).max(64).optional().describe(workerCreationTimezoneHint),
51
51
  app: z.string().min(1).max(128).optional()
52
- .describe("The app whose default tools are copied when actionSpec is omitted, exactly as action_worker_options apps[].code lists it. Omit for Slack."),
52
+ .describe("Required when actionSpec is absent: an explicit app from action_worker_options. Copies that app's reviewed defaults once. Omit when selecting exact actionSpec tools."),
53
53
  slackConnectionId: z.number().int().positive().optional()
54
54
  .describe("Slack tools only: the bot connection to pin, an id from action_worker_options connections[] (app slack). A sole usable connection is selected automatically."),
55
55
  operatorId: z.string().uuid().optional()
@@ -61,13 +61,13 @@ export const actionDescriptors = [
61
61
  defineTool({
62
62
  name: "worker_tools", title: "List Action Worker Tools", auth: "manager", method: "get",
63
63
  path: p => `/api/manage/workers/${p.tokenId}/tools`, paramFilter: () => ({}), strictInput: true,
64
- description: managerAuthorityPreflight + "Discover the saved tools, exact input/output schemas, connection and sender of an Action worker. {{scope}} Select a named tool and supply its declared inputs using worker_tool_call. Discovery does not grant execution permission; current policy is checked on each call. Each tools[] entry carries name (the toolName), inputSchema, outputSchema, readOnly (false = a write, which needs an idempotencyKey) and available (false = not callable now: the tool left the catalog, its contract changed or, for a Slack tool, its bot connection is missing, until the owner reviews and re-saves the selection). availableTools are not callable until the owner selects them.",
64
+ description: managerAuthorityPreflight + "Discover saved Action tools, exact schemas, connections and sender. {{scope}} Copy a returned name and inputs to worker_tool_call. Each tool reports invocationSource, effect, idempotencyRequired, keyFormat, workerCallsSupported and invocationManagerScopes; follow these rather than inferring from readOnly. Private API effect is the declared operation description; readOnly stays false even for reads, which still require a versioned key. available:false blocks calls pending setup/contract review. availableTools are not callable until explicitly selected. Discovery grants no access; policy is checked each call.",
65
65
  schema: worker, annotations: READ_ONLY,
66
66
  }),
67
67
  defineTool({
68
68
  name: "worker_tool_call", title: "Call Action Worker Tool", auth: "manager", method: "post",
69
69
  path: p => `/api/manage/workers/${p.tokenId}/tools/${encodeURIComponent(String(p.toolName))}/invoke`, strictInput: true,
70
- description: managerAuthorityPreflight + "Execute exactly one saved Action worker tool with structured inputs, without a model. Discover worker_tools first. {{scope}} Cannot change tools, connection, sender or permissions. Supply a unique idempotencyKey for each intended write and reuse it for transport retries. A repeated key never resends: it replays the first answer, so a refusal with error.retryable true is retried later under a new key. For in_progress poll worker_tool_invocation. outcome_unknown means the app may have completed the action: do not automatically retry or issue a new key. Generic write receipts retain confirmation but not private app response content. Never resend to recover a lost response body. The answer is {invocationId, tool, status, result, error, replayed, contractVersion} with status succeeded | denied | failed | in_progress | outcome_unknown; invocationId is set on writes only (reads leave no receipt). Refusals before the app is reached use the {error, message, code} envelope: 403 tool_not_exposed, 409 tool_contract_changed (the owner must re-save the selection), 409 idempotency_conflict (same key, different arguments), 400 invalid_request (arguments that do not match inputSchema)." + INVOKE_SCOPE_NOTE,
70
+ description: managerAuthorityPreflight + "Invoke one saved Action tool without a model; discover worker_tools first and follow idempotencyRequired/keyFormat. {{scope}} Cannot change tools, connection, sender or permissions. Native/MCP writes need a unique key; reads need none. Every private API operation, including reads, needs managePrivateApiApps plus invokeActions and v1:<Unix timestamp>:<32-hex UUID>. Reuse a key and identical arguments to recover transport loss; it replays the journal, never resends. A retryable native/MCP refusal needs a new key for a later attempt. Poll in_progress with worker_tool_invocation. outcome_unknown: do not automatically retry or issue a new key. Native/MCP write receipts retain confirmation, not private response content; never resend to recover a body. Returns {invocationId,tool,status,result,error,replayed,contractVersion}; status succeeded|denied|failed|in_progress|outcome_unknown. Native/MCP reads leave no receipt; private API calls do. Pre-dispatch refusals use {error,message,code}: 403 tool_not_exposed, 409 tool_contract_changed (review/re-save), 409 idempotency_conflict (changed arguments), 400 invalid_request (schema mismatch)." + INVOKE_SCOPE_NOTE,
71
71
  schema: {
72
72
  ...worker,
73
73
  toolName: z.string().min(1).max(128)
@@ -76,7 +76,7 @@ export const actionDescriptors = [
76
76
  arguments: z.record(z.unknown())
77
77
  .describe("The tool's inputs, exactly as its inputSchema in worker_tools declares them, with their JSON types. Send {} for a tool that takes none."),
78
78
  idempotencyKey: z.string().min(1).max(128).regex(/^[!-~]+$/).optional()
79
- .describe("Required on a write tool (readOnly false in worker_tools): 1-128 printable characters, one per intended write. The same key with the same arguments returns the stored receipt without calling the app again; with different arguments it is 409 idempotency_conflict. Reads need none."),
79
+ .describe("Follow worker_tools.idempotencyRequired/keyFormat: native/MCP writes use 1-128 printable characters; every private API call, even read, uses v1:<Unix timestamp>:<32-hex UUID>. Reuse only for identical arguments to recover the original journal; changed arguments return 409 idempotency_conflict."),
80
80
  },
81
81
  bodyBuilder: p => ({ contractVersion: p.contractVersion, arguments: p.arguments }),
82
82
  headerBuilder: (p) => p.idempotencyKey ? { "Idempotency-Key": String(p.idempotencyKey) } : {},
@@ -88,7 +88,7 @@ export const actionDescriptors = [
88
88
  description: managerAuthorityPreflight + "Read an Action invocation's status and effect references. {{scope}} Does not execute or retry anything. Unknown outcomes must not be automatically resent. A write still in_progress after two minutes reads as outcome_unknown: check the app itself before deciding anything." + INVOKE_SCOPE_NOTE,
89
89
  schema: {
90
90
  ...worker,
91
- invocationId: z.string().uuid().describe("The invocationId a worker_tool_call answer carried for a write."),
91
+ invocationId: z.string().uuid().describe("The invocationId returned for a native/MCP write or any private API invocation."),
92
92
  },
93
93
  annotations: READ_ONLY,
94
94
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/descriptors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AS,EAAE,CAAC;QAClF,aAAa,EAAE,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACrH,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE;KACnF,CAAC;IACF,UAAU,CAAC;QACT,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK;QAC/F,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,OAAO,qBAAqB,CAAC,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI;QAC5H,WAAW,EAAE,yBAAyB,GAAG,iRAAiR,GAAG,iBAAiB;QAC9U,MAAM,EAAE;YACN,GAAG,MAAM;YACT,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;SAC5G;QACD,WAAW,EAAE,SAAS;KACvB,CAAC;CACH,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nimport { z } from \"../zod.js\";\nimport { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from \"../guidance.js\";\nimport { defineTool, CREATE, READ_ONLY, TRIGGER, type ToolDescriptor } from \"./types.js\";\n\nexport const actionSpecSchema = z.object({\n schemaVersion: z.literal(1).describe(\"Always 1.\"),\n tools: z.array(z.object({\n ref: z.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/)\n .describe(\"A tool name exactly as action_worker_options lists it in tools[].name, from any of its apps.\"),\n version: z.literal(1).default(1).describe(\"Always 1.\"),\n contractHash: z.string().regex(/^[A-Fa-f0-9]{64}$/).optional()\n .describe(\"Optional pin, present when the selection is copied from a kit's actionSpec: creation is refused if that tool's contract changed since.\"),\n }).strict()).min(1).max(64).describe(\"1-64 tools, each listed once.\"),\n}).strict().describe(\"An explicit tool selection instead of the app's defaults: {schemaVersion: 1, tools: [{ref, version: 1}]}.\");\n\n// invokeActions is younger than most keys: the same snapshot rule as every newer scope.\nconst INVOKE_SCOPE_NOTE =\n \" Check key_info for scope snapshots and authority; never automatically retry a 403.\";\n\nconst worker = {\n tokenId: z.number().int().positive()\n .describe(\"Action worker numeric tokenId from workers_list/action_worker_create (modelType none). key_info shows worker reach.\"),\n};\n\nexport const actionDescriptors: readonly ToolDescriptor[] = [\n defineTool({\n name: \"action_worker_options\", title: \"Action Worker Setup\", auth: \"manager\", method: \"get\",\n path: \"/api/manage/workers/action-options\", strictInput: true,\n description: managerAuthorityPreflight + \"Get available apps, reviewed tool contracts, default tools and required connections for an Action worker: no model, instruction or deployment; invoke selected tools directly with worker_tool_call (modelType none). Slack tools need an active fixed bot: if no usable bot is returned, prompt connection setup and do not submit creation. Connection IDs and sender identities are server-owned. {{scope}} Creates and executes nothing.\",\n schema: {\n operatorId: z.string().uuid().optional()\n .describe(\"The operator (workspace) to read connections for, as a GUID from apps_list → operators[]. Omit for the account's default operator.\"),\n app: z.string().min(1).max(128).optional()\n .describe(\"The app whose tools and defaultTools to return, exactly as apps[].code lists it. Omit for Slack.\"),\n },\n annotations: READ_ONLY,\n }),\n defineTool({\n name: \"action_worker_create\", title: \"Create Action Worker\", auth: \"manager\", method: \"post\",\n path: \"/api/manage/workers/actions\", strictInput: true,\n description: managerAuthorityPreflight + \"Create a private Action kit and worker from action_worker_options. No model or deployment. Copies the app's default tools once; optional actionSpec selects up to 64 tools across apps. Slack tools require an active fixed bot: if none is available, prompt connection setup and do not submit creation. Missing ordinary app connections can be resolved after creation. Only explicit owner edits change installed tools. {{scope}} A selected-worker key gains the worker it creates. Reuse requestId with the same body after a timeout; never create a second worker to recover a lost response. Returns tokenId, workerId, kitSlug and modelType none, no worker key. Never deploy or run an Action worker: worker_run/worker_deploy refuse it with 400 action_worker_requires_invoke.\",\n resultDescription: creationResultGuidance,\n footer: data => {\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return undefined;\n const result = data as Record<string, unknown>;\n return typeof result.workerUrl === \"string\" && result.workerUrl.trim() && result.error == null\n ? creationResultGuidance : undefined;\n },\n schema: {\n requestId: z.string().min(1).max(128)\n .describe(\"Your idempotency key for this creation. Repeat it only with the identical body, to recover a timed-out call's result; a different body under the same requestId is 409 request_conflict.\"),\n name: z.string().min(1).max(100).describe(\"Name for the new worker and its private kit.\"),\n timeZoneId: z.string().trim().min(1).max(64).optional().describe(workerCreationTimezoneHint),\n app: z.string().min(1).max(128).optional()\n .describe(\"The app whose default tools are copied when actionSpec is omitted, exactly as action_worker_options apps[].code lists it. Omit for Slack.\"),\n slackConnectionId: z.number().int().positive().optional()\n .describe(\"Slack tools only: the bot connection to pin, an id from action_worker_options connections[] (app slack). A sole usable connection is selected automatically.\"),\n operatorId: z.string().uuid().optional()\n .describe(\"The operator (workspace) to create the worker on, as a GUID from apps_list → operators[]. Omit for the account's default operator.\"),\n actionSpec: actionSpecSchema.optional(),\n },\n annotations: { ...CREATE, idempotentHint: true },\n }),\n defineTool({\n name: \"worker_tools\", title: \"List Action Worker Tools\", auth: \"manager\", method: \"get\",\n path: p => `/api/manage/workers/${p.tokenId}/tools`, paramFilter: () => ({}), strictInput: true,\n description: managerAuthorityPreflight + \"Discover the saved tools, exact input/output schemas, connection and sender of an Action worker. {{scope}} Select a named tool and supply its declared inputs using worker_tool_call. Discovery does not grant execution permission; current policy is checked on each call. Each tools[] entry carries name (the toolName), inputSchema, outputSchema, readOnly (false = a write, which needs an idempotencyKey) and available (false = not callable now: the tool left the catalog, its contract changed or, for a Slack tool, its bot connection is missing, until the owner reviews and re-saves the selection). availableTools are not callable until the owner selects them.\",\n schema: worker, annotations: READ_ONLY,\n }),\n defineTool({\n name: \"worker_tool_call\", title: \"Call Action Worker Tool\", auth: \"manager\", method: \"post\",\n path: p => `/api/manage/workers/${p.tokenId}/tools/${encodeURIComponent(String(p.toolName))}/invoke`, strictInput: true,\n description: managerAuthorityPreflight + \"Execute exactly one saved Action worker tool with structured inputs, without a model. Discover worker_tools first. {{scope}} Cannot change tools, connection, sender or permissions. Supply a unique idempotencyKey for each intended write and reuse it for transport retries. A repeated key never resends: it replays the first answer, so a refusal with error.retryable true is retried later under a new key. For in_progress poll worker_tool_invocation. outcome_unknown means the app may have completed the action: do not automatically retry or issue a new key. Generic write receipts retain confirmation but not private app response content. Never resend to recover a lost response body. The answer is {invocationId, tool, status, result, error, replayed, contractVersion} with status succeeded | denied | failed | in_progress | outcome_unknown; invocationId is set on writes only (reads leave no receipt). Refusals before the app is reached use the {error, message, code} envelope: 403 tool_not_exposed, 409 tool_contract_changed (the owner must re-save the selection), 409 idempotency_conflict (same key, different arguments), 400 invalid_request (arguments that do not match inputSchema).\" + INVOKE_SCOPE_NOTE,\n schema: {\n ...worker,\n toolName: z.string().min(1).max(128)\n .describe(\"A tools[].name from worker_tools for this worker, exactly.\"),\n contractVersion: z.literal(1).default(1).describe(\"Always 1.\"),\n arguments: z.record(z.unknown())\n .describe(\"The tool's inputs, exactly as its inputSchema in worker_tools declares them, with their JSON types. Send {} for a tool that takes none.\"),\n idempotencyKey: z.string().min(1).max(128).regex(/^[!-~]+$/).optional()\n .describe(\"Required on a write tool (readOnly false in worker_tools): 1-128 printable characters, one per intended write. The same key with the same arguments returns the stored receipt without calling the app again; with different arguments it is 409 idempotency_conflict. Reads need none.\"),\n },\n bodyBuilder: p => ({ contractVersion: p.contractVersion, arguments: p.arguments }),\n headerBuilder: (p): Record<string, string> => p.idempotencyKey ? { \"Idempotency-Key\": String(p.idempotencyKey) } : {},\n requestTimeoutMs: () => 90_000, annotations: { ...TRIGGER, idempotentHint: false },\n }),\n defineTool({\n name: \"worker_tool_invocation\", title: \"Read Action Invocation\", auth: \"manager\", method: \"get\",\n path: p => `/api/manage/workers/${p.tokenId}/tool-invocations/${p.invocationId}`, paramFilter: () => ({}), strictInput: true,\n description: managerAuthorityPreflight + \"Read an Action invocation's status and effect references. {{scope}} Does not execute or retry anything. Unknown outcomes must not be automatically resent. A write still in_progress after two minutes reads as outcome_unknown: check the app itself before deciding anything.\" + INVOKE_SCOPE_NOTE,\n schema: {\n ...worker,\n invocationId: z.string().uuid().describe(\"The invocationId a worker_tool_call answer carried for a write.\"),\n },\n annotations: READ_ONLY,\n }),\n];\n"]}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/descriptors/actions.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAuB,MAAM,YAAY,CAAC;AAEzF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACtB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;aACtD,QAAQ,CAAC,8FAA8F,CAAC;QAC3G,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;QACtD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mB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AAE,SAAS;KACvB,CAAC;CACH,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nimport { z } from \"../zod.js\";\nimport { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from \"../guidance.js\";\nimport { defineTool, CREATE, READ_ONLY, TRIGGER, type ToolDescriptor } from \"./types.js\";\n\nexport const actionSpecSchema = z.object({\n schemaVersion: z.literal(1).describe(\"Always 1.\"),\n tools: z.array(z.object({\n ref: z.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/)\n .describe(\"A tool name exactly as action_worker_options lists it in tools[].name, from any of its apps.\"),\n version: z.literal(1).default(1).describe(\"Always 1.\"),\n contractHash: z.string().regex(/^[A-Fa-f0-9]{64}$/).optional()\n .describe(\"Optional pin, present when the selection is copied from a kit's actionSpec: creation is refused if that tool's contract changed since.\"),\n }).strict()).min(1).max(64).describe(\"1-64 tools, each listed once.\"),\n}).strict().describe(\"An explicit tool selection instead of the app's defaults: {schemaVersion: 1, tools: [{ref, version: 1}]}.\");\n\n// invokeActions is younger than most keys: the same snapshot rule as every newer scope.\nconst INVOKE_SCOPE_NOTE =\n \" Check key_info for scope snapshots and authority; never automatically retry a 403.\";\n\nconst worker = {\n tokenId: z.number().int().positive()\n .describe(\"Action worker numeric tokenId from workers_list/action_worker_create (modelType none). key_info shows worker reach.\"),\n};\n\nexport const actionDescriptors: readonly ToolDescriptor[] = [\n defineTool({\n name: \"action_worker_options\", title: \"Action Worker Setup\", auth: \"manager\", method: \"get\",\n path: \"/api/manage/workers/action-options\", strictInput: true,\n description: managerAuthorityPreflight + \"Discover Action setup; creates/executes nothing. Omit app for the app inventory only, then choose an app for reviewed tools, defaults and connection requirements. Native/enabled reviewed MCP contracts can enter actionSpec; capabilities names source limits. app:customApi returns setup metadata, not selectable refs: API-only jobs use Language workers and dashboard finite-version bindings; no private API worker-slot calls. Action workers need no model/deployment. Actual Slack selections require a fixed active bot before creation; identities are server-owned. {{scope}}\",\n schema: {\n operatorId: z.string().uuid().optional()\n .describe(\"The operator (workspace) to read connections for, as a GUID from apps_list → operators[]. Omit for the account's default operator.\"),\n app: z.string().min(1).max(128).optional()\n .describe(\"Omit for app inventory only. Supply an apps[].code for that app's reviewed tools/defaultTools; customApi returns setup metadata only.\"),\n },\n annotations: READ_ONLY,\n }),\n defineTool({\n name: \"action_worker_create\", title: \"Create Action Worker\", auth: \"manager\", method: \"post\",\n path: \"/api/manage/workers/actions\", strictInput: true,\n description: managerAuthorityPreflight + \"Create a private Action kit and worker after options discovery. Explicit app or actionSpec is required; there is no implicit app. app copies its reviewed defaults once; actionSpec selects up to 64 native/reviewed MCP tools across apps without needing app. Review any writes before creation. Private API refs are not selectable; follow source capabilities. Actual Slack tools require a fixed active bot; ordinary missing connections can follow creation. Only owner edits change tools. {{scope}} A selected-worker key gains its created worker. Reuse requestId/identical body after timeout; never recreate for recovery. Returns IDs/kitSlug/modelType none, no worker key. No model/deployment/run: worker_run/worker_deploy refuse with 400 action_worker_requires_invoke.\",\n resultDescription: creationResultGuidance,\n footer: data => {\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return undefined;\n const result = data as Record<string, unknown>;\n return typeof result.workerUrl === \"string\" && result.workerUrl.trim() && result.error == null\n ? creationResultGuidance : undefined;\n },\n schema: {\n requestId: z.string().min(1).max(128)\n .describe(\"Your idempotency key for this creation. Repeat it only with the identical body, to recover a timed-out call's result; a different body under the same requestId is 409 request_conflict.\"),\n name: z.string().min(1).max(100).describe(\"Name for the new worker and its private kit.\"),\n timeZoneId: z.string().trim().min(1).max(64).optional().describe(workerCreationTimezoneHint),\n app: z.string().min(1).max(128).optional()\n .describe(\"Required when actionSpec is absent: an explicit app from action_worker_options. Copies that app's reviewed defaults once. Omit when selecting exact actionSpec tools.\"),\n slackConnectionId: z.number().int().positive().optional()\n .describe(\"Slack tools only: the bot connection to pin, an id from action_worker_options connections[] (app slack). A sole usable connection is selected automatically.\"),\n operatorId: z.string().uuid().optional()\n .describe(\"The operator (workspace) to create the worker on, as a GUID from apps_list → operators[]. Omit for the account's default operator.\"),\n actionSpec: actionSpecSchema.optional(),\n },\n annotations: { ...CREATE, idempotentHint: true },\n }),\n defineTool({\n name: \"worker_tools\", title: \"List Action Worker Tools\", auth: \"manager\", method: \"get\",\n path: p => `/api/manage/workers/${p.tokenId}/tools`, paramFilter: () => ({}), strictInput: true,\n description: managerAuthorityPreflight + \"Discover saved Action tools, exact schemas, connections and sender. {{scope}} Copy a returned name and inputs to worker_tool_call. Each tool reports invocationSource, effect, idempotencyRequired, keyFormat, workerCallsSupported and invocationManagerScopes; follow these rather than inferring from readOnly. Private API effect is the declared operation description; readOnly stays false even for reads, which still require a versioned key. available:false blocks calls pending setup/contract review. availableTools are not callable until explicitly selected. Discovery grants no access; policy is checked each call.\",\n schema: worker, annotations: READ_ONLY,\n }),\n defineTool({\n name: \"worker_tool_call\", title: \"Call Action Worker Tool\", auth: \"manager\", method: \"post\",\n path: p => `/api/manage/workers/${p.tokenId}/tools/${encodeURIComponent(String(p.toolName))}/invoke`, strictInput: true,\n description: managerAuthorityPreflight + \"Invoke one saved Action tool without a model; discover worker_tools first and follow idempotencyRequired/keyFormat. {{scope}} Cannot change tools, connection, sender or permissions. Native/MCP writes need a unique key; reads need none. Every private API operation, including reads, needs managePrivateApiApps plus invokeActions and v1:<Unix timestamp>:<32-hex UUID>. Reuse a key and identical arguments to recover transport loss; it replays the journal, never resends. A retryable native/MCP refusal needs a new key for a later attempt. Poll in_progress with worker_tool_invocation. outcome_unknown: do not automatically retry or issue a new key. Native/MCP write receipts retain confirmation, not private response content; never resend to recover a body. Returns {invocationId,tool,status,result,error,replayed,contractVersion}; status succeeded|denied|failed|in_progress|outcome_unknown. Native/MCP reads leave no receipt; private API calls do. Pre-dispatch refusals use {error,message,code}: 403 tool_not_exposed, 409 tool_contract_changed (review/re-save), 409 idempotency_conflict (changed arguments), 400 invalid_request (schema mismatch).\" + INVOKE_SCOPE_NOTE,\n schema: {\n ...worker,\n toolName: z.string().min(1).max(128)\n .describe(\"A tools[].name from worker_tools for this worker, exactly.\"),\n contractVersion: z.literal(1).default(1).describe(\"Always 1.\"),\n arguments: z.record(z.unknown())\n .describe(\"The tool's inputs, exactly as its inputSchema in worker_tools declares them, with their JSON types. Send {} for a tool that takes none.\"),\n idempotencyKey: z.string().min(1).max(128).regex(/^[!-~]+$/).optional()\n .describe(\"Follow worker_tools.idempotencyRequired/keyFormat: native/MCP writes use 1-128 printable characters; every private API call, even read, uses v1:<Unix timestamp>:<32-hex UUID>. Reuse only for identical arguments to recover the original journal; changed arguments return 409 idempotency_conflict.\"),\n },\n bodyBuilder: p => ({ contractVersion: p.contractVersion, arguments: p.arguments }),\n headerBuilder: (p): Record<string, string> => p.idempotencyKey ? { \"Idempotency-Key\": String(p.idempotencyKey) } : {},\n requestTimeoutMs: () => 90_000, annotations: { ...TRIGGER, idempotentHint: false },\n }),\n defineTool({\n name: \"worker_tool_invocation\", title: \"Read Action Invocation\", auth: \"manager\", method: \"get\",\n path: p => `/api/manage/workers/${p.tokenId}/tool-invocations/${p.invocationId}`, paramFilter: () => ({}), strictInput: true,\n description: managerAuthorityPreflight + \"Read an Action invocation's status and effect references. {{scope}} Does not execute or retry anything. Unknown outcomes must not be automatically resent. A write still in_progress after two minutes reads as outcome_unknown: check the app itself before deciding anything.\" + INVOKE_SCOPE_NOTE,\n schema: {\n ...worker,\n invocationId: z.string().uuid().describe(\"The invocationId returned for a native/MCP write or any private API invocation.\"),\n },\n annotations: READ_ONLY,\n }),\n];\n"]}
@@ -15,7 +15,7 @@ export const decisionQuestion = z.discriminatedUnion("type", [
15
15
  export const createDecisionWorker = defineTool({
16
16
  name: "decision_worker_create",
17
17
  title: "Create Decision Worker",
18
- description: managerAuthorityPreflight + "Create a reusable classifier to categorize, score, filter or triage data. Discover recipes with kit_app_tools(purpose:'decision'); kit_authoring_guide(section:'decision') has examples. Missing ordinary app connections do not prevent creation: create first, then prompt connection setup. Creates a private kit and worker atomically; optionally deploys, never runs. Questions and source mappings compile deterministically; source filters do not narrow read permissions. {{scope}} A selected-worker key gains the worker it creates. Reuse requestId and the identical body after a timeout; changed body returns 409. Returns tokenId, workerId, kitSlug, workerUrl, readiness, deployment/error, setupActions and nextCall. A deployment error leaves the worker saved, without that deployment's model/ceilings; never recreate it. Choice adds unclear; setup answers adjust categories/levels later. Returns no worker API secret. Arbitrary sources/routed actions: kit_validate → kit_publish(private) → kit_install.",
18
+ description: managerAuthorityPreflight + "Create a reusable classifier to categorize, score, filter or triage data. Discover recipes with kit_app_tools(purpose:'decision'); kit_authoring_guide(section:'decision') has examples. Missing ordinary app connections allow creation first, then setup. Creates a private kit and worker atomically; optionally deploys, never runs. Questions/source mappings compile deterministically; source filters do not narrow grants. {{scope}} A selected-worker key gains its created worker. Reuse requestId and identical body after timeout; changed body returns 409. Returns tokenId, workerId, kitSlug, workerUrl, readiness, deployment/error, setupActions and nextCall, no worker secret. A deployment error leaves the worker saved without those model/ceilings; never recreate it. Choice adds unclear; setup answers adjust categories/levels. Recipes are shortcuts: discover other sources/routed actions with kit_app_tools(app, omit purpose), then kit_validate → kit_publish(private) → kit_install → worker_deploy before running.",
19
19
  auth: "manager", method: "post", path: "/api/manage/decision-workers",
20
20
  strictInput: true,
21
21
  resultDescription: creationResultGuidance,
@@ -35,7 +35,7 @@ export const createDecisionWorker = defineTool({
35
35
  args: z.record(z.unknown()).optional().describe("Arguments from the discovered recipe's argsSchema. No placeholders. Sheets requires fileId, range and columns."),
36
36
  }).strict(),
37
37
  questions: z.array(decisionQuestion).min(1).max(8).describe("Independent questions with unique keys. Choice: 1–20 options, excluding reserved unclear; name + description ≤200 chars. Score: ordered levels, lowest first. Noul: probability of a statement."),
38
- confidenceFloor: z.number().min(0).max(1).describe("Required confidence threshold; uncertain choices/scores are flagged, not omitted. Not an accuracy guarantee."),
38
+ confidenceFloor: z.number().min(0).max(1).describe("Routing threshold, not an accuracy guarantee. Below-floor answers are flagged and still returned; this does not replace their labels with unclear."),
39
39
  maxItems: z.number().int().min(1).max(50).default(20),
40
40
  operatorId: z.string().uuid().optional(),
41
41
  deploy: z.boolean().default(false).describe("Create a hosted deployment too. Does not execute a run."),
@@ -1 +1 @@
1
- {"version":3,"file":"decision-authoring.js","sourceRoot":"","sources":["../../src/descriptors/decision-authoring.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,EAAuB,MAAM,YAAY,CAAC;AAErE,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC5E,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;YACjH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE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AAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAChD,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YAC7B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC9D,CAAC,CAAC,CAAC,QAAQ,EAAE;QACd,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;QACzF,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;KAC3E;IACD,WAAW,EAAE,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;CACjD,CAAC,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nimport { z } from \"../zod.js\";\nimport { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from \"../guidance.js\";\nimport { defineTool, CREATE, type ToolDescriptor } from \"./types.js\";\n\nconst key = z.string().regex(/^(?=.{1,40}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);\nconst base = { key, instructions: z.string().min(1).max(4000) };\nexport const decisionQuestion = z.discriminatedUnion(\"type\", [\n z.object({ ...base, type: z.literal(\"choice\"), options: z.record(key, z.string().min(1).max(200)).refine(options => {\n const entries = Object.entries(options);\n return entries.length >= 1 && entries.length <= 20 && entries.every(([name, description]) => name !== \"unclear\" && description.trim().length > 0 && name.length + 3 + description.length <= 200);\n }, \"Provide 1–20 options excluding unclear; each name and description must fit in 200 characters including the separator.\") }).strict(),\n z.object({ ...base, type: z.literal(\"score\"), levels: z.array(z.string().min(1).max(200)).min(2).max(10) }).strict(),\n z.object({ ...base, type: z.literal(\"noul\"), trueMeaning: z.string().max(200).optional(), falseMeaning: z.string().max(200).optional() }).strict(),\n]);\n\nexport const createDecisionWorker: ToolDescriptor = defineTool({\n name: \"decision_worker_create\",\n title: \"Create Decision Worker\",\n description: managerAuthorityPreflight + \"Create a reusable classifier to categorize, score, filter or triage data. Discover recipes with kit_app_tools(purpose:'decision'); kit_authoring_guide(section:'decision') has examples. Missing ordinary app connections do not prevent creation: create first, then prompt connection setup. Creates a private kit and worker atomically; optionally deploys, never runs. Questions and source mappings compile deterministically; source filters do not narrow read permissions. {{scope}} A selected-worker key gains the worker it creates. Reuse requestId and the identical body after a timeout; changed body returns 409. Returns tokenId, workerId, kitSlug, workerUrl, readiness, deployment/error, setupActions and nextCall. A deployment error leaves the worker saved, without that deployment's model/ceilings; never recreate it. Choice adds unclear; setup answers adjust categories/levels later. Returns no worker API secret. Arbitrary sources/routed actions: kit_validate → kit_publish(private) → kit_install.\",\n auth: \"manager\", method: \"post\", path: \"/api/manage/decision-workers\",\n strictInput: true,\n resultDescription: creationResultGuidance,\n footer: data => {\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return undefined;\n const result = data as Record<string, unknown>;\n return typeof result.workerUrl === \"string\" && result.workerUrl.trim() && result.error == null\n ? creationResultGuidance : undefined;\n },\n schema: {\n requestId: z.string().min(1).max(128).regex(/^[!-~]+$/).describe(\"Unique creation id. Reuse with the same body on retries; new id creates a new worker.\"),\n name: z.string().min(1).max(100),\n timeZoneId: z.string().trim().min(1).max(64).optional().describe(workerCreationTimezoneHint),\n source: z.object({\n recipe: z.enum([\"email-previews\", \"calendar-events\", \"sheets-rows\"]),\n args: z.record(z.unknown()).optional().describe(\"Arguments from the discovered recipe's argsSchema. No placeholders. Sheets requires fileId, range and columns.\"),\n }).strict(),\n questions: z.array(decisionQuestion).min(1).max(8).describe(\"Independent questions with unique keys. Choice: 1–20 options, excluding reserved unclear; name + description ≤200 chars. Score: ordered levels, lowest first. Noul: probability of a statement.\"),\n confidenceFloor: z.number().min(0).max(1).describe(\"Required confidence threshold; uncertain choices/scores are flagged, not omitted. Not an accuracy guarantee.\"),\n maxItems: z.number().int().min(1).max(50).default(20),\n operatorId: z.string().uuid().optional(),\n deploy: z.boolean().default(false).describe(\"Create a hosted deployment too. Does not execute a run.\"),\n decisionProfileId: z.string().min(1).max(64).optional().describe(\"Default classifier for the kit and worker: a profileId from models_list.decisionProfiles. Omit for Jev. Independent of deployment and spend settings.\"),\n maxUsdPerRun: z.number().min(0.01).max(1000).optional(),\n maxUsdPerDay: z.number().min(0.01).max(10000).optional(),\n },\n outputSchema: {\n tokenId: z.number().int().positive().describe(\"Use with existing worker tools and CLI commands.\"),\n workerId: z.string().uuid(), kitSlug: z.string(), modelType: z.literal(\"decision\"), workerUrl: z.string(),\n connectAppsUrl: z.string().nullable().optional(),\n setupActions: z.array(z.object({\n code: z.string(), message: z.string(), url: z.string().optional(), apps: z.array(z.string()),\n tool: z.string().optional(), arguments: z.record(z.unknown()),\n })).optional(),\n readiness: z.record(z.unknown()).nullable(), deployment: z.record(z.unknown()).nullable(),\n deploymentError: z.record(z.unknown()).nullable(), warnings: z.array(z.string()),\n nextCall: z.object({ tool: z.string(), arguments: z.record(z.unknown()) }),\n },\n annotations: { ...CREATE, idempotentHint: true },\n});\n"]}
1
+ {"version":3,"file":"decision-authoring.js","sourceRoot":"","sources":["../../src/descriptors/decision-authoring.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,EAAuB,MAAM,YAAY,CAAC;AAErE,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC5E,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;YACjH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,WAAW,CAAC,IAAI,E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EAAE;QAChD,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YAC7B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC9D,CAAC,CAAC,CAAC,QAAQ,EAAE;QACd,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;QACzF,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;KAC3E;IACD,WAAW,EAAE,EAAE,GAAG,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE;CACjD,CAAC,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\nimport { z } from \"../zod.js\";\nimport { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from \"../guidance.js\";\nimport { defineTool, CREATE, type ToolDescriptor } from \"./types.js\";\n\nconst key = z.string().regex(/^(?=.{1,40}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);\nconst base = { key, instructions: z.string().min(1).max(4000) };\nexport const decisionQuestion = z.discriminatedUnion(\"type\", [\n z.object({ ...base, type: z.literal(\"choice\"), options: z.record(key, z.string().min(1).max(200)).refine(options => {\n const entries = Object.entries(options);\n return entries.length >= 1 && entries.length <= 20 && entries.every(([name, description]) => name !== \"unclear\" && description.trim().length > 0 && name.length + 3 + description.length <= 200);\n }, \"Provide 1–20 options excluding unclear; each name and description must fit in 200 characters including the separator.\") }).strict(),\n z.object({ ...base, type: z.literal(\"score\"), levels: z.array(z.string().min(1).max(200)).min(2).max(10) }).strict(),\n z.object({ ...base, type: z.literal(\"noul\"), trueMeaning: z.string().max(200).optional(), falseMeaning: z.string().max(200).optional() }).strict(),\n]);\n\nexport const createDecisionWorker: ToolDescriptor = defineTool({\n name: \"decision_worker_create\",\n title: \"Create Decision Worker\",\n description: managerAuthorityPreflight + \"Create a reusable classifier to categorize, score, filter or triage data. Discover recipes with kit_app_tools(purpose:'decision'); kit_authoring_guide(section:'decision') has examples. Missing ordinary app connections allow creation first, then setup. Creates a private kit and worker atomically; optionally deploys, never runs. Questions/source mappings compile deterministically; source filters do not narrow grants. {{scope}} A selected-worker key gains its created worker. Reuse requestId and identical body after timeout; changed body returns 409. Returns tokenId, workerId, kitSlug, workerUrl, readiness, deployment/error, setupActions and nextCall, no worker secret. A deployment error leaves the worker saved without those model/ceilings; never recreate it. Choice adds unclear; setup answers adjust categories/levels. Recipes are shortcuts: discover other sources/routed actions with kit_app_tools(app, omit purpose), then kit_validate → kit_publish(private) → kit_install → worker_deploy before running.\",\n auth: \"manager\", method: \"post\", path: \"/api/manage/decision-workers\",\n strictInput: true,\n resultDescription: creationResultGuidance,\n footer: data => {\n if (!data || typeof data !== \"object\" || Array.isArray(data)) return undefined;\n const result = data as Record<string, unknown>;\n return typeof result.workerUrl === \"string\" && result.workerUrl.trim() && result.error == null\n ? creationResultGuidance : undefined;\n },\n schema: {\n requestId: z.string().min(1).max(128).regex(/^[!-~]+$/).describe(\"Unique creation id. Reuse with the same body on retries; new id creates a new worker.\"),\n name: z.string().min(1).max(100),\n timeZoneId: z.string().trim().min(1).max(64).optional().describe(workerCreationTimezoneHint),\n source: z.object({\n recipe: z.enum([\"email-previews\", \"calendar-events\", \"sheets-rows\"]),\n args: z.record(z.unknown()).optional().describe(\"Arguments from the discovered recipe's argsSchema. No placeholders. Sheets requires fileId, range and columns.\"),\n }).strict(),\n questions: z.array(decisionQuestion).min(1).max(8).describe(\"Independent questions with unique keys. Choice: 1–20 options, excluding reserved unclear; name + description ≤200 chars. Score: ordered levels, lowest first. Noul: probability of a statement.\"),\n confidenceFloor: z.number().min(0).max(1).describe(\"Routing threshold, not an accuracy guarantee. Below-floor answers are flagged and still returned; this does not replace their labels with unclear.\"),\n maxItems: z.number().int().min(1).max(50).default(20),\n operatorId: z.string().uuid().optional(),\n deploy: z.boolean().default(false).describe(\"Create a hosted deployment too. Does not execute a run.\"),\n decisionProfileId: z.string().min(1).max(64).optional().describe(\"Default classifier for the kit and worker: a profileId from models_list.decisionProfiles. Omit for Jev. Independent of deployment and spend settings.\"),\n maxUsdPerRun: z.number().min(0.01).max(1000).optional(),\n maxUsdPerDay: z.number().min(0.01).max(10000).optional(),\n },\n outputSchema: {\n tokenId: z.number().int().positive().describe(\"Use with existing worker tools and CLI commands.\"),\n workerId: z.string().uuid(), kitSlug: z.string(), modelType: z.literal(\"decision\"), workerUrl: z.string(),\n connectAppsUrl: z.string().nullable().optional(),\n setupActions: z.array(z.object({\n code: z.string(), message: z.string(), url: z.string().optional(), apps: z.array(z.string()),\n tool: z.string().optional(), arguments: z.record(z.unknown()),\n })).optional(),\n readiness: z.record(z.unknown()).nullable(), deployment: z.record(z.unknown()).nullable(),\n deploymentError: z.record(z.unknown()).nullable(), warnings: z.array(z.string()),\n nextCall: z.object({ tool: z.string(), arguments: z.record(z.unknown()) }),\n },\n annotations: { ...CREATE, idempotentHint: true },\n});\n"]}
@@ -29,7 +29,7 @@ const DIRECTORY_NOTE = " Public and anonymous, identical for everyone; reads onl
29
29
  // The two authoring reads share one framing: they are what an agent reads BEFORE
30
30
  // writing a kit for the manager surface, and they are anonymous so it can draft
31
31
  // before it holds any credential.
32
- const AUTHORING_NOTE = " Public and anonymous. On Manager /workers: kit_validate checks all sections, then kit_publish (publishKits). Publish PRIVATE first: only this account can install it via a signed-in human at pageUrl or kit_install, also the create-from-scratch path. Workers need apps connected on their operator (apps_list/app_connect). Add unsupported apps via mcp_server_create (credential), mcp_server_set_tools, then content.mcpServers.";
32
+ const AUTHORING_NOTE = " Public and anonymous. On Manager /workers: kit_validate the exact body, then kit_publish (publishKits) with visibility:'private'. Install: signed-in human at pageUrl or kit_install. Each install creates one worker; workerSlots bind separate workers. Missing ordinary app connections can be set up afterward (apps_list/app_connect). index covers MCP/private API extensions.";
33
33
  const SEARCH_EMPTY_HINT = "No kits matched. Filters AND together — drop some. query is a plain case-insensitive substring over name + job sentence (one short word beats a phrase), and unknown category/app/publisher values match nothing rather than erroring. directory_overview lists every valid filter value. If nothing fits after broadening, author a kit for the exact job rather than installing a near miss: kit_authoring_guide (index, then schema and rules) and kit_app_tools here, then kit_validate and kit_publish (private) on the /workers mount, then kit_install.";
34
34
  // publisher_get accepts no search filters, so the search hint above would tell an
35
35
  // agent to broaden filters it never set. Reachable: the profile 404s only when the
@@ -116,7 +116,7 @@ export function publisherPageFooter(data) {
116
116
  const directoryOverview = {
117
117
  name: "directory_overview",
118
118
  title: "Directory Overview",
119
- description: "Read directory vocabulary before choosing kits_search filters. kitCount counts published kits; categories.jobFamilies/roles/industries supplies slug/name for category/industry. apps code/name/categoryCode/installable supplies app (installable:false can appear in kits but cannot be installed). appCategories code/name/members[{code,name,appCode}] supplies appCategory and installer choices (e.g. Slack/Teams). models model/normalized/kitCount supplies model (normalized or substring). modelTypes code/name/summary supplies none(Action)|language|decision|hybrid. Also sortOptions/triggerModes. No kits here: for popularity use kits_search's default downloads sort. Human pages: https://workerkit.ai/kit/{slug}." + DIRECTORY_NOTE,
119
+ description: "Read directory vocabulary before choosing kits_search filters. kitCount counts published kits; categories.jobFamilies/roles/industries supplies slug/name for category/industry. apps code/name/categoryCode/installable supplies app (installable:false can appear in kits but cannot be installed). appCategories code/name/members[{code,name,appCode}] supplies appCategory and installer choices. models model/normalized/kitCount supplies model (normalized or substring). modelTypes code/name/summary supplies none(Action)|language|decision|hybrid. Also sortOptions/triggerModes. No kits here: for popularity use kits_search's default downloads sort. Human pages: https://workerkit.ai/kit/{slug}." + DIRECTORY_NOTE,
120
120
  auth: "anonymous",
121
121
  method: "get",
122
122
  schema: {},
@@ -200,11 +200,11 @@ const GUIDE_SECTIONS = ["index", "decision", "schema", "rules", "skill", "state"
200
200
  const kitAuthoringGuide = {
201
201
  name: "kit_authoring_guide",
202
202
  title: "Kit Authoring Guide",
203
- description: "Read kit authoring guidance one Markdown section at a time, with table of contents. Classification/scoring/filtering/triage: decision has recipes, typed questions, creation examples/results. Action(modelType none): index/schema; quickest create path is action_worker_options then action_worker_create on Manager. Full kit authoring: index, then schema/rules; state covers Records, memory and context hygiene; workers covers kits that call other workers (workerSlots, bindings, waiting, receipts); fetch other sections as needed. Unknown section:400 with valid names. Live sources:kit_app_tools; exact permission keys:kit_vocabulary. On Manager /workers, kit_validate the exact body then kit_publish (publishKits). Publish private, install and prove a run (Action:tool call) before public promotion with kit_replace." + DIRECTORY_NOTE,
203
+ description: "Read one Markdown section at a time. index chooses Language/Decision/Action/Hybrid and native/MCP/private API paths; schema/rules define the exact payload. decision covers recipe shortcuts and arbitrary catalog sources; workers covers typed calls, routing and bindings between separately installed workers. state covers Records, memory and context hygiene. Fetch other sections only as needed. Unknown section:400 with valid names. Discover business tools with kit_app_tools and permission keys with kit_vocabulary; Manager tools/list is not the worker's app inventory. Validate the exact body, publish private and install; prove a run (Action:tool call) before promotion when public publishing reopens." + DIRECTORY_NOTE,
204
204
  auth: "anonymous",
205
205
  method: "get",
206
206
  schema: {
207
- section: z.enum(GUIDE_SECTIONS).default("index").describe("Which section to read. index (default) is the table of contents plus how to use the guide; schema and rules are the two an author cannot skip; workers is required before declaring workerSlots."),
207
+ section: z.enum(GUIDE_SECTIONS).default("index").describe("index chooses a path; schema defines custom payloads. Fetch only relevant sections and reuse unchanged help. Read workers before declaring workerSlots."),
208
208
  },
209
209
  path: `${API}/authoring/guide`,
210
210
  annotations: READ_ONLY,
@@ -212,7 +212,7 @@ const kitAuthoringGuide = {
212
212
  const kitVocabulary = {
213
213
  name: "kit_vocabulary",
214
214
  title: "Kit Authoring Vocabulary",
215
- description: "Read the exact live keys before writing content.apps/categorySlots/categorySlugs; strict validation, no 'all' shorthand. Without app: apps[] code/name/summary, operations(tool KEYS), fields, supported axes(readOperations,masterAccessLevels,writableFields,providers,channels,objectTypes,scopePolicies,contentTypeScopes,capabilities,supportsAllowAll,supportsWriteEnabled,subApps,installable); concreteApps[] vendor tiles with standalone|provider|slotMember|subApp kind and content mapping; appCategories[] members/labelAlias/genericName; categories.jobFamilies/roles/industries(the valid categorySlugs); models; mcpApps(id=gatewayId,tools[].toolId=toolIds); note. Own MCP servers: mcp_servers_list on Manager. With app: {app,vendors,tools,note}; tools describes installed-worker tools: name(use in prose),description,readOnly,argsSchema,decisionSource result mapping where known,requires(grant one listed operations key). toolsNote replaces an unavailable catalog. Full response is large: read once/task, then per-app; kit_app_tools explores all app capabilities in one call. Unknown app:400 with valid codes." + AUTHORING_NOTE,
215
+ description: "Read the exact live keys before writing content.apps/categorySlots/categorySlugs; strict validation, no 'all' shorthand. Without app: apps[] code/name/summary, operations(tool KEYS), fields, supported axes(readOperations,masterAccessLevels,writableFields,providers,channels,objectTypes,scopePolicies,contentTypeScopes,capabilities,supportsAllowAll,supportsWriteEnabled,subApps,installable); concreteApps[] vendor tiles with standalone|provider|slotMember|subApp kind and content mapping; appCategories[] members/labelAlias/genericName; categories.jobFamilies/roles/industries(the valid categorySlugs); models; mcpApps(id=gatewayId,tools[].toolId=toolIds); note. Own MCP servers:mcp_servers_list. With app: {app,vendors,tools,note}; tools describes installed-worker names, descriptions, readOnly, argsSchema, documented decisionSource and requires (one operation-gate contribution, not full authorization). readOperations, provider/scope and current policy may also apply. toolsNote replaces an unavailable catalog. Prefer per-app reads; omit app for the full vocabulary only when needed. kit_app_tools explores schemas. Unknown app:400 with valid codes." + AUTHORING_NOTE,
216
216
  auth: "anonymous",
217
217
  method: "get",
218
218
  schema: {
@@ -224,11 +224,11 @@ const kitVocabulary = {
224
224
  const kitAppTools = {
225
225
  name: "kit_app_tools",
226
226
  title: "Kit App Tools",
227
- description: "Discover app tool capabilities. purpose:decision returns convenience source recipes, evidence fields, argument schemas, read permissions, limits and editable decision_worker_create examples; app narrows email/calendar/drive recipes. Public capability data only; apps_list checks account connections. Without purpose: apps[] in catalog order with operations and tools[{name,title,description,readOnly,argsSchema,decisionSource,requires,provider,scope,hosted}]. requires grants one listed operations key; absent means the tool comes with the app. provider pins a vendor, scope a Drive content family; hosted:false excludes hosted runs. toolsNote replaces unavailable catalogs. Platform MCP tools:kit_vocabulary.mcpApps; unsupported apps:mcp_server_create. Unknown app:400 with valid codes. Responses are cacheable public capability data; connectionStatus:not_checked is not live authorization. Recipes are not an allowlist: arbitrary sources/routed actions use the general catalog, argsSchema/result mapping, then kit_validate -> kit_publish(private) -> kit_install. Validation checks structure/grants, not live access. Action tool selection: action_worker_options. Detailed permission axes:kit_vocabulary." + DIRECTORY_NOTE,
227
+ description: "Discover worker business-app tools before declaring a capability absent: Manager tools/list exposes management, not these tools. Use app to keep context small. purpose:decision returns three convenience recipes, not a source ceiling; omit purpose for that app's full catalog: operations and tools[{name,title,description,readOnly,argsSchema,decisionSource,requires,provider,scope,hosted}]. requires is one operation-gate contribution, not full authorization; readOperations, provider/scope and current policy may also apply. hosted:false excludes hosted runs. decisionSource documents result paths where known; do not invent missing paths. Arbitrary sources/routed actions use this catalog, then kit_validate -> kit_publish(private) -> kit_install; hosted workers still need deployment. Public capabilities do not prove connections/access: apps_list checks setup; validation checks structure/grants. toolsNote replaces unavailable catalogs. Platform MCP:kit_vocabulary.mcpApps; extension paths:kit_authoring_guide(index). Action selections:action_worker_options. Permission axes:kit_vocabulary. Unknown app:400 with valid codes." + DIRECTORY_NOTE,
228
228
  auth: "anonymous",
229
229
  method: "get",
230
230
  schema: {
231
- purpose: z.enum(["decision"]).optional().describe("Supported classification source recipes, with schemas and creation examples."),
231
+ purpose: z.enum(["decision"]).optional().describe("Three shortcut recipes with creation examples. Omit for arbitrary catalog tools and documented decisionSource mappings."),
232
232
  app: z.string().max(40).optional().describe("One app code to read just that app's tools. Omit for every app."),
233
233
  },
234
234
  path: `${API}/authoring/tools`,
@@ -244,7 +244,7 @@ const ABOUT_SECTIONS = ["index", "why", "operate", "access", "cost", "start"];
244
244
  const workerkitAbout = {
245
245
  name: "workerkit_about",
246
246
  title: "About WorkerKit",
247
- description: "Explain WorkerKit and lead the user into a first worker. index gives examples; start guides creation, missing-app setup and a first result. Covers Decision classification, Language work, permissioned Action calls and workflows of bound workers. Ask only missing choices; create before connecting apps where supported, then prompt setup from readiness/links. Other sections: why/operate/access/cost. Public anonymous read; creation uses authenticated Workers tools.",
247
+ description: "Explain WorkerKit and lead into a first worker when product context is needed. index gives examples; start guides creation, missing-app setup and a first result. Covers Decision, Language, Action and bound-worker workflows. Ask only missing choices; create before connecting apps where supported, then follow readiness/links. Reuse existing context; fetch why/operate/access/cost only as needed. Public anonymous read; creation uses authenticated Workers tools.",
248
248
  auth: "anonymous",
249
249
  method: "get",
250
250
  schema: {