@workerkit/core 0.3.20 → 0.3.21
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 +23 -0
- package/README.md +7 -1
- package/dist/contract-provenance.d.ts +2 -2
- package/dist/contract-provenance.js +2 -2
- package/dist/contract-provenance.js.map +1 -1
- package/dist/descriptors/actions.js +14 -6
- package/dist/descriptors/actions.js.map +1 -1
- package/dist/descriptors/decision-authoring.js +15 -2
- package/dist/descriptors/decision-authoring.js.map +1 -1
- package/dist/descriptors/directory.js +2 -2
- package/dist/descriptors/directory.js.map +1 -1
- package/dist/descriptors/knowledge.d.ts +2 -0
- package/dist/descriptors/knowledge.js +79 -0
- package/dist/descriptors/knowledge.js.map +1 -0
- package/dist/descriptors/manage.js +27 -17
- package/dist/descriptors/manage.js.map +1 -1
- package/dist/guidance-coverage.js +9 -0
- package/dist/guidance-coverage.js.map +1 -1
- package/dist/guidance.d.ts +3 -1
- package/dist/guidance.js +3 -1
- package/dist/guidance.js.map +1 -1
- package/dist/instructions.d.ts +3 -1
- package/dist/instructions.js +19 -6
- package/dist/instructions.js.map +1 -1
- package/dist/profiles.d.ts +2 -1
- package/dist/profiles.js +9 -1
- package/dist/profiles.js.map +1 -1
- package/dist/scopes.d.ts +1 -1
- package/dist/scopes.js +3 -1
- package/dist/scopes.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@ and the package adheres to [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.21] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Company Knowledge: `knowledge_sources` discovers the workers whose retained reports a key may read, `knowledge_search` runs a deterministic lexical search or browses by filters, `knowledge_get` reads complete versioned report or structured content with offset continuation, and `knowledge_changes` reconciles new, corrected and withdrawn outputs through a durable cursor. All four require the new `readKnowledge` scope. Retrieval returns retained reports only, never app data, transcripts or a worker run.
|
|
14
|
+
- `knowledge_configuration_get` and `knowledge_configuration_set` read and replace activation, enrolled sources, structured-output publication, history start and reader grants. They require the new `manageKnowledge` scope, account administrator authority and an unrestricted credential. Existing keys gain neither scope without explicit re-scoping.
|
|
15
|
+
- The `knowledge` profile serves those six tools for the dedicated Knowledge MCP mount, with its own instructions; the workers and decision profiles do not carry them. The backend contract gains the `KNOWLEDGE-01` coverage rule for evidence, cursor and configuration guidance.
|
|
16
|
+
- `kit_install`, `decision_worker_create` and `action_worker_create` results carry creation guidance: show `workerUrl`, follow `setupActions` (each with a message, the apps involved and a URL or next tool), resolve blocked or unknown readiness before `nextCall`, and treat a saved worker as unproven until it runs. The `decision_worker_create` output schema declares `connectAppsUrl` and `setupActions`.
|
|
17
|
+
- `workerkit_about` joins the decision profile, which now serves 25 tools, so a compact connection can explain WorkerKit and lead a user into a first worker.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- `mcp_server_discover` is titled Refresh MCP Server Tools and says that it changes the saved tool catalog from upstream and is for the creator or an account Admin; `mcp_server_get` is the saved read. `mcp_server_create` explains that initial discovery is included when credentials are available or no authentication is needed, so a successful registration needs no second refresh.
|
|
22
|
+
- `app_connect` reports failed MCP discovery after credential storage as a nonfatal warning and says that only new account MCP apps need `mcp_server_create`. `apps_list` points to `api_apps_list` for API apps and to `mcp_servers_list` for unpublished own servers.
|
|
23
|
+
- The Workers REST instructions describe the Company Knowledge scopes and tools and where their MCP mount lives, describe the product as Decision, Language and Action workers chained into workflows, and say that the spec includes the anonymous discovery reads.
|
|
24
|
+
- Management descriptions open with the key_info preflight: call it before the session's first management call, verify scopes and worker reach, and treat the user's request as never expanding credential authority. The manager and decision instructions lead with the same rule and with first-job help.
|
|
25
|
+
- `workerkit_about` and its `section` parameter lead the user into a first worker and point creation at the authenticated Workers tools; the directory instructions do the same.
|
|
26
|
+
- `action_worker_options`, `action_worker_create` and `kit_install_preview` say that Slack tools need an active fixed bot and that creation must not be submitted without one, while ordinary missing app connections can be resolved after creation. `worker_deploy` says that deployment never requests a manual run and that a failed deployment saves none of its model or ceilings; `account_usage` says that wallet balance alone is not readiness; `worker_get` names the `personal_connection_not_shared` readiness issue; `mcp_server_create` asks to check `apps_list` and `mcp_servers_list` for an app that already covers the job.
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
- Update `undici` to 7.30.1, which fixes a TLS certificate validation bypass when `Agent` drops TLS options, cache poisoning and cross-user disclosure through cross-origin redirects, and several denial-of-service issues in the HTTP client (GHSA-2m5v-pch6-74hx, GHSA-4w7w-5xrc-9h26 and related advisories).
|
|
31
|
+
|
|
9
32
|
## [0.3.20] - 2026-10-21
|
|
10
33
|
|
|
11
34
|
### Added
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
8
|
The [WorkerKit](https://workerkit.ai) API client and tool registry for Node.js.
|
|
9
|
-
It provides
|
|
9
|
+
It provides 121 authenticated management tools, 8 anonymous directory tools,
|
|
10
10
|
and a shared execution engine for their HTTP requests.
|
|
11
11
|
|
|
12
12
|
Descriptors include agent guidance, annotations and Zod input schemas. MCP
|
|
@@ -260,6 +260,12 @@ owner dashboard, which also holds paid comparisons, diagnosis, monitoring and
|
|
|
260
260
|
apply/rollback. Improvements change instruction text only; shadow learning
|
|
261
261
|
does not train model weights. These tools are on the full profile.
|
|
262
262
|
|
|
263
|
+
## Company knowledge
|
|
264
|
+
|
|
265
|
+
The Knowledge descriptors expose source discovery, lexical search/browse, complete versioned content reads and change reconciliation. `toolsForProfile("knowledge")` returns the six of them for the dedicated Knowledge MCP mount; the workers and decision profiles do not carry them. Use `knowledge_sources`, `knowledge_search`, `knowledge_get` and `knowledge_changes` with `readKnowledge`. The service enforces current account, publication, audience and credential limits. `knowledge_configuration_get` and `knowledge_configuration_set` require `manageKnowledge`, account administrator authority and an unrestricted credential.
|
|
266
|
+
|
|
267
|
+
Query planning and synthesis belong to the consuming agent. Empty queries browse; changed or revoked evidence requires citation/cache reconciliation. Retrieval does not invoke a model or grant live source-app access.
|
|
268
|
+
|
|
263
269
|
## Development
|
|
264
270
|
|
|
265
271
|
```bash
|
|
@@ -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: "
|
|
5
|
-
readonly contentHash: "
|
|
4
|
+
readonly sourceRevision: "e8880853652338ef6f68074913cb0f7c7378a1e4";
|
|
5
|
+
readonly contentHash: "1fce929a89a043e3ca0a4be50dada2b4dba9d71f3aa412bdf882821bcf47fbb2";
|
|
6
6
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const backendContractProvenance = {
|
|
3
3
|
"sourceRepository": "workerkit-backend",
|
|
4
4
|
"contractVersion": "1.0.0",
|
|
5
|
-
"sourceRevision": "
|
|
6
|
-
"contentHash": "
|
|
5
|
+
"sourceRevision": "e8880853652338ef6f68074913cb0f7c7378a1e4",
|
|
6
|
+
"contentHash": "1fce929a89a043e3ca0a4be50dada2b4dba9d71f3aa412bdf882821bcf47fbb2"
|
|
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\": \"
|
|
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,6 +1,6 @@
|
|
|
1
1
|
// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.
|
|
2
2
|
import { z } from "../zod.js";
|
|
3
|
-
import { workerCreationTimezoneHint } from "../guidance.js";
|
|
3
|
+
import { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from "../guidance.js";
|
|
4
4
|
import { defineTool, CREATE, READ_ONLY, TRIGGER } from "./types.js";
|
|
5
5
|
export const actionSpecSchema = z.object({
|
|
6
6
|
schemaVersion: z.literal(1).describe("Always 1."),
|
|
@@ -22,7 +22,7 @@ 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: "Get available apps, reviewed tool contracts,
|
|
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.",
|
|
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."),
|
|
@@ -34,7 +34,15 @@ export const actionDescriptors = [
|
|
|
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: "Create a private Action kit and worker
|
|
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.",
|
|
38
|
+
resultDescription: creationResultGuidance,
|
|
39
|
+
footer: data => {
|
|
40
|
+
if (!data || typeof data !== "object" || Array.isArray(data))
|
|
41
|
+
return undefined;
|
|
42
|
+
const result = data;
|
|
43
|
+
return typeof result.workerUrl === "string" && result.workerUrl.trim() && result.error == null
|
|
44
|
+
? creationResultGuidance : undefined;
|
|
45
|
+
},
|
|
38
46
|
schema: {
|
|
39
47
|
requestId: z.string().min(1).max(128)
|
|
40
48
|
.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."),
|
|
@@ -53,13 +61,13 @@ export const actionDescriptors = [
|
|
|
53
61
|
defineTool({
|
|
54
62
|
name: "worker_tools", title: "List Action Worker Tools", auth: "manager", method: "get",
|
|
55
63
|
path: p => `/api/manage/workers/${p.tokenId}/tools`, paramFilter: () => ({}), strictInput: true,
|
|
56
|
-
description: "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 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.",
|
|
57
65
|
schema: worker, annotations: READ_ONLY,
|
|
58
66
|
}),
|
|
59
67
|
defineTool({
|
|
60
68
|
name: "worker_tool_call", title: "Call Action Worker Tool", auth: "manager", method: "post",
|
|
61
69
|
path: p => `/api/manage/workers/${p.tokenId}/tools/${encodeURIComponent(String(p.toolName))}/invoke`, strictInput: true,
|
|
62
|
-
description: "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 + "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,
|
|
63
71
|
schema: {
|
|
64
72
|
...worker,
|
|
65
73
|
toolName: z.string().min(1).max(128)
|
|
@@ -77,7 +85,7 @@ export const actionDescriptors = [
|
|
|
77
85
|
defineTool({
|
|
78
86
|
name: "worker_tool_invocation", title: "Read Action Invocation", auth: "manager", method: "get",
|
|
79
87
|
path: p => `/api/manage/workers/${p.tokenId}/tool-invocations/${p.invocationId}`, paramFilter: () => ({}), strictInput: true,
|
|
80
|
-
description: "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,
|
|
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,
|
|
81
89
|
schema: {
|
|
82
90
|
...worker,
|
|
83
91
|
invocationId: z.string().uuid().describe("The invocationId a worker_tool_call answer carried for a write."),
|
|
@@ -1 +1 @@
|
|
|
1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E,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,iRAAiR,GAAG,iBAAiB;QAClT,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 { 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: \"Get available apps, reviewed tool contracts, the selected app's default tools and any required connections for creating an Action worker: a worker with no model, instruction or deployment, whose selected app tools a caller invokes directly with worker_tool_call (modelType none). 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: \"Create a private Action kit and worker for an app from action_worker_options. No model or deployment. The server copies that app's default tools once; optionally provide an explicit actionSpec of up to 64 tools across apps. Slack tools require a fixed bot connection. Only explicit owner edits change installed tools. {{scope}} A key limited to selected workers 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, and no worker key. The worker is never deployed or run (worker_run and worker_deploy refuse it with 400 action_worker_requires_invoke): call worker_tools next, then worker_tool_call.\",\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: \"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: \"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: \"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,OA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,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,6 +1,6 @@
|
|
|
1
1
|
// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.
|
|
2
2
|
import { z } from "../zod.js";
|
|
3
|
-
import { workerCreationTimezoneHint } from "../guidance.js";
|
|
3
|
+
import { creationResultGuidance, managerAuthorityPreflight, workerCreationTimezoneHint } from "../guidance.js";
|
|
4
4
|
import { defineTool, CREATE } from "./types.js";
|
|
5
5
|
const key = z.string().regex(/^(?=.{1,40}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);
|
|
6
6
|
const base = { key, instructions: z.string().min(1).max(4000) };
|
|
@@ -15,9 +15,17 @@ 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: "Create a reusable classifier to categorize, score, filter or triage
|
|
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.",
|
|
19
19
|
auth: "manager", method: "post", path: "/api/manage/decision-workers",
|
|
20
20
|
strictInput: true,
|
|
21
|
+
resultDescription: creationResultGuidance,
|
|
22
|
+
footer: data => {
|
|
23
|
+
if (!data || typeof data !== "object" || Array.isArray(data))
|
|
24
|
+
return undefined;
|
|
25
|
+
const result = data;
|
|
26
|
+
return typeof result.workerUrl === "string" && result.workerUrl.trim() && result.error == null
|
|
27
|
+
? creationResultGuidance : undefined;
|
|
28
|
+
},
|
|
21
29
|
schema: {
|
|
22
30
|
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."),
|
|
23
31
|
name: z.string().min(1).max(100),
|
|
@@ -38,6 +46,11 @@ export const createDecisionWorker = defineTool({
|
|
|
38
46
|
outputSchema: {
|
|
39
47
|
tokenId: z.number().int().positive().describe("Use with existing worker tools and CLI commands."),
|
|
40
48
|
workerId: z.string().uuid(), kitSlug: z.string(), modelType: z.literal("decision"), workerUrl: z.string(),
|
|
49
|
+
connectAppsUrl: z.string().nullable().optional(),
|
|
50
|
+
setupActions: z.array(z.object({
|
|
51
|
+
code: z.string(), message: z.string(), url: z.string().optional(), apps: z.array(z.string()),
|
|
52
|
+
tool: z.string().optional(), arguments: z.record(z.unknown()),
|
|
53
|
+
})).optional(),
|
|
41
54
|
readiness: z.record(z.unknown()).nullable(), deployment: z.record(z.unknown()).nullable(),
|
|
42
55
|
deploymentError: z.record(z.unknown()).nullable(), warnings: z.array(z.string()),
|
|
43
56
|
nextCall: z.object({ tool: z.string(), arguments: z.record(z.unknown()) }),
|
|
@@ -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,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,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,G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,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACzG,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 { 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: \"Create a reusable classifier to categorize, score, filter or triage connected data. First discover source recipes with kit_app_tools(purpose:'decision'); kit_authoring_guide(section:'decision') has examples. Creates a private kit and worker atomically; optionally deploys, never runs. Questions and source mappings compile deterministically into the ordinary decision specification. Source filters do not narrow the recipe's read permissions. {{scope}} A key limited to selected workers gains the worker it creates. Reuse requestId and the identical body to recover the original receipt after a timeout; changed body returns 409. Returns tokenId for lifecycle commands, stable workerId, kitSlug, readiness, deployment/error and exact nextCall arguments. Follow nextCall, then worker_run/run_get. A deployment error means the worker already exists. Choice adds unclear automatically; setup answers adjust categories/levels later. Creation returns no worker API secret. For arbitrary decision sources or routed actions use kit_validate → kit_publish(private) → kit_install.\",\n auth: \"manager\", method: \"post\", path: \"/api/manage/decision-workers\",\n strictInput: true,\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 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,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E;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"]}
|
|
@@ -244,11 +244,11 @@ 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: "
|
|
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.",
|
|
248
248
|
auth: "anonymous",
|
|
249
249
|
method: "get",
|
|
250
250
|
schema: {
|
|
251
|
-
section: z.enum(ABOUT_SECTIONS).default("index").describe("
|
|
251
|
+
section: z.enum(ABOUT_SECTIONS).default("index").describe("index (default): explain and choose a job. start: create the first worker. Fetch why/operate/access/cost only as needed."),
|
|
252
252
|
},
|
|
253
253
|
path: `${API}/about`,
|
|
254
254
|
annotations: READ_ONLY,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AAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CACvD,uKAAuK,CACxK;KACF;IACD,IAAI,EAAE,GAAG,GAAG,QAAQ;IACpB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,+EAA+E;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,cAAc;IACd,iBAAiB;IACjB,UAAU;IACV,MAAM;IACN,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,WAAW;CACZ,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\n// The public kits-directory tools: anonymous, read-only catalog tools over the\n// public directory API. Eight tools rather than one per REST endpoint — the about read\n// (what WorkerKit is and when an agent should reach for it), one vocabulary\n// call, one search, one dossier, one publisher profile, and the three authoring\n// reads (the guide, the permission vocabulary an author needs, and the explorer\n// of what each app lets a worker do).\n//\n// The upstream surface is already agent-shaped (always-anonymous, no\n// viewer-scoped fields, opt-in skill-resource bodies, composed overview), so\n// these tools stay thin passthroughs. What lives HERE is the pure half of the\n// presentation an MCP server (or CLI) should not each reinvent:\n// - Empty search results append a broaden-this hint; truncated results append\n// the next page number — the two places agents reliably mis-step.\n// - kit_get / publisher_get carry a computed pageUrl: nothing on an anonymous\n// surface can install, so the agent hands over the link — or, when it holds\n// a manager key with the installKits scope, installs via kit_install_preview\n// / kit_install on the authenticated WorkerKit Manager server.\n\nimport { z } from \"../zod.js\";\nimport { READ_ONLY, type ToolDescriptor } from \"./types.js\";\nimport { publicPublisherIdentityPause } from \"../guidance.js\";\n\nconst API = \"/api/directory/mcp\";\nconst SITE = \"https://workerkit.ai\";\n\n// ─── Shared phrasing ────────────────────────────────────────────────────────\n\nconst SLUG_HINT = \"The kit's URL slug, as returned by kits_search (slug).\";\n\n// Appended to every tool: the two facts an agent must never get wrong on a\n// public mount — no auth exists, and installing is out of its reach.\nconst DIRECTORY_NOTE =\n \" Public and anonymous, identical for everyone; reads only. Install: signed-in human at pageUrl, or kit_install_preview/kit_install on Manager /workers (installKits).\";\n\n// The two authoring reads share one framing: they are what an agent reads BEFORE\n// writing a kit for the manager surface, and they are anonymous so it can draft\n// before it holds any credential.\nconst AUTHORING_NOTE =\n \" 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.\";\n\n// ─── Pure data mappers + footers (presentation data, not ToolResult assembly) ─\n\ntype Json = Record<string, unknown>;\n\nconst SEARCH_EMPTY_HINT =\n \"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.\";\n\n// publisher_get accepts no search filters, so the search hint above would tell an\n// agent to broaden filters it never set. Reachable: the profile 404s only when the\n// publisher has no PUBLISHED kits, while the catalog list additionally excludes\n// taken-down ones — so a publisher whose only published kit was moderated out\n// returns 200 with an empty items array.\nconst PUBLISHER_EMPTY_HINT =\n \"This publisher currently lists no kits (publisher.kitCount can still be non-zero — a published kit can be withheld from the catalog). publisher_get takes no search filters, so there is nothing to broaden; report the profile as-is.\";\n\n/**\n * The one footer a {items, totalCount, page, pageSize} list needs: how to\n * broaden when nothing matched, or which page comes next when truncated.\n */\nexport function listFooter(body: Json, emptyHint: string = SEARCH_EMPTY_HINT): string | undefined {\n const items = Array.isArray(body.items) ? body.items : [];\n const totalCount = typeof body.totalCount === \"number\" ? body.totalCount : items.length;\n const page = typeof body.page === \"number\" ? body.page : 1;\n const pageSize = typeof body.pageSize === \"number\" && body.pageSize > 0 ? body.pageSize : Math.max(items.length, 1);\n if (totalCount === 0) {\n return emptyHint;\n }\n if (page * pageSize < totalCount) {\n return `Showing page ${page} of ${Math.ceil(totalCount / pageSize)} (${totalCount} kits total) — call again with page: ${page + 1} for more`;\n }\n return undefined;\n}\n\n/** kits_search data: the validated list body, or undefined = serve verbatim. */\nexport function kitListData(data: unknown): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || !Array.isArray((body as Json).items)) {\n return undefined; // unexpected shape — serve verbatim rather than guess\n }\n return body;\n}\n\n/** kit_get data: the dossier with the computed pageUrl, or undefined = verbatim. */\nexport function kitDetailData(data: unknown, params: Record<string, unknown>): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || Array.isArray(body)) return undefined;\n\n const detail = { ...body };\n const slug = typeof detail.slug === \"string\" && detail.slug.length > 0 ? detail.slug : String(params.slug ?? \"\");\n detail.pageUrl = `${SITE}/kit/${encodeURIComponent(slug)}`;\n return detail;\n}\n\n/**\n * kit_get footer. Bodies exist upstream but were not requested: each such\n * resource reports a contentLength with no content. A protected kit's resources\n * carry neither (identity-only), so this stays silent there — re-calling would\n * not help.\n */\nexport function kitDetailFooter(data: unknown, params: Record<string, unknown>): string | undefined {\n const detail = data as Json;\n if (params.includeResourceBodies !== true && Array.isArray(detail.skillResources)) {\n const omitted = detail.skillResources.filter(\n (r) =>\n r !== null && typeof r === \"object\" && !Array.isArray(r) &&\n typeof (r as Json).contentLength === \"number\" && ((r as Json).contentLength as number) > 0 &&\n typeof (r as Json).content !== \"string\"\n ).length;\n if (omitted > 0) {\n return `${omitted} skillResources ${omitted === 1 ? \"body\" : \"bodies\"} omitted — call again with includeResourceBodies: true to read them`;\n }\n }\n return undefined;\n}\n\n/** publisher_get data: the profile with the computed pageUrl, or undefined = verbatim. */\nexport function publisherPageData(data: unknown, params: Record<string, unknown>): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || Array.isArray(body)) return undefined;\n\n const page = { ...body };\n const publisher = page.publisher as Json | undefined;\n const slug =\n publisher && typeof publisher.slug === \"string\" && publisher.slug.length > 0\n ? publisher.slug\n : String(params.slug ?? \"\");\n page.pageUrl = `${SITE}/publishers/${encodeURIComponent(slug)}`;\n return page;\n}\n\n/** publisher_get footer: pages the embedded kit list with the publisher-shaped empty hint. */\nexport function publisherPageFooter(data: unknown): string | undefined {\n const page = data as Json;\n const kits = page.kits;\n if (kits && typeof kits === \"object\" && !Array.isArray(kits) && Array.isArray((kits as Json).items)) {\n return listFooter(kits as Json, PUBLISHER_EMPTY_HINT);\n }\n return undefined;\n}\n\n// ─── Tools ──────────────────────────────────────────────────────────────────\n\nconst directoryOverview: ToolDescriptor = {\n name: \"directory_overview\",\n title: \"Directory Overview\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {},\n path: `${API}/overview`,\n annotations: READ_ONLY,\n};\n\nconst searchKits: ToolDescriptor = {\n name: \"kits_search\",\n title: \"Search Kits\",\n description:\n publicPublisherIdentityPause +\n \"Search public worker templates: instructions, decision routing or Action tools, with pre-scoped app permissions and often schedules. All optional filters AND; omit to browse. Returns {items,totalCount,page,pageSize}. Cards: slug(kit_get key), name/jobSentence, publisherName/publisherSlug/isOfficialPublisher/verificationTier, apps/categorySlots(installer chooses member), categories/triggerModes, starCount, modelScores(publisher-declared 0-100 fit, best first)/recommendedModel, modelType(language|decision|hybrid|none), isProtected,isFeatured,publishedAt. Protected instruction TEXT is intentionally withheld; kit still works, not a red flag. Empty is not an error; read its footer and directory_overview for valid filters. Human page: https://workerkit.ai/kit/{slug}.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n query: z.string().max(200).optional().describe(\n \"Free-text search: case-insensitive SUBSTRING match over kit name + job sentence — not keyword or semantic search, so one short stem ('invoice') beats a phrase ('help with my invoices'). Omit to browse by filters alone.\"\n ),\n category: z.string().optional().describe(\n \"Job-category slug (any kind — job family, role, or industry). Valid slugs: directory_overview → categories. Unknown slugs match nothing.\"\n ),\n industry: z.string().optional().describe(\n \"Industry-kind category slug ONLY (a role/job-family slug here matches nothing). ANDs with category.\"\n ),\n app: z.string().optional().describe(\n \"Exact app code the kit must use, e.g. 'email', 'slack', 'crm'. Valid codes: directory_overview → apps.\"\n ),\n appCategory: z.string().optional().describe(\n \"Capability category from directory_overview.appCategories: matches an install slot OR a pinned member app, broader than app. Unknown code errors with the fix.\"\n ),\n model: z.string().max(80).optional().describe(\n \"Substring match on a scored model name, e.g. 'sonnet' or 'gpt'. Valid names: directory_overview → models.\"\n ),\n trigger: z.enum([\"onDemand\", \"scheduled\", \"event\"]).optional().describe(\n \"How the kit's worker runs: onDemand (a human or agent triggers it), scheduled (ships recurring schedules), event (webhook-triggered).\"\n ),\n modelType: z.enum([\"none\", \"language\", \"decision\", \"hybrid\"]).optional().describe(\n \"Worker type: none=direct Action tools; language=prose with installer-chosen model; decision=per-item routing without prose/model choice; hybrid=bounded classification then one language agent. Omit for all.\"\n ),\n publisher: z.string().optional().describe(\"Temporarily unavailable: publisher identity is hidden, so every publisher filter returns an empty page. Omit to browse kits.\"),\n sort: z.enum([\"downloads\", \"new\", \"name\", \"stars\"]).default(\"downloads\").describe(\n \"downloads = most installed (the popularity signal), new = latest published, name = A-Z, stars = most starred.\"\n ),\n page: z.number().int().min(1).default(1).describe(\"1-based page number.\"),\n pageSize: z.number().int().min(1).max(200).default(20).describe(\n \"Cards per page (max 200). 20 keeps responses lean; totalCount always reports the full match count.\"\n ),\n },\n path: `${API}/kits`,\n paramFilter: (params) => {\n // The wire param is `q`; `query` is the agent-facing name.\n const { query, ...rest } = params;\n return { ...rest, q: query };\n },\n annotations: READ_ONLY,\n mapData: (data) => kitListData(data),\n footer: (data) => listFooter(data as Json),\n};\n\nconst getKit: ToolDescriptor = {\n name: \"kit_get\",\n title: \"Get Kit\",\n description:\n \"Inspect a kit before installation: description/appDescriptions (author app/tool notes), modelType, exact permissions, content and setup. none exposes actionSpec without a model; hybrid combines prose/classification; language is default. instructionContent is verbatim prose, empty if isProtected while instructionLength remains real; protected startCommand/endCommand/whenToUse are null, indistinguishable from absent. For decision, evaluate decisionNarration (sources/questions/routes/confidence fallback, also served when protected) and decisionSetup. permissionsManifest is EXACT installed access: operations/fields/scopes; numeric values are authoritative, names display-only; its workerSlots name other workers the kit calls, bound explicitly at install. Summarize this for access questions. requiredInputs/memorySetup is the install form. memoryProfile stateless omits recent-run summaries, contextual includes bounded summaries; owner rules/injected facts apply to both. selfFactsEnabled permits unreviewed recall-only saves that later runs must search to use. Also schedules/triggers/usageWindows, modelScores with notes/starCount/pageUrl. skillResources always has key/kind/name; description/contentLength withheld when protected; includeResourceBodies fetches bodies. Surface hasExternalMcpShells when recommending: install creates account gateways to publisher URLs in permissionsManifest.mcpServers.shells. scan.outcome cleared|underReview are BOTH live/installable; underReview is an unsettled raised check, not unsafe. scannedAtUtc:null means pre-scanner publication. checks lists families run; static-only cleared is weaker than all three. Attribute recommendation safe|caution|doNotInstall to SkillSpector; independent of outcome and may disagree. caution means worth reviewing, including incomplete analysis. scan is absent with nothing to report, never includes findings. 404:no published kit for slug.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n slug: z.string().min(1).describe(SLUG_HINT),\n includeResourceBodies: z.boolean().default(false).describe(\n \"true = include each skill resource's full text (can be up to 20k chars each). Default false returns key/kind/name/description/contentLength — enough to describe the kit; fetch bodies only when their content is the question.\"\n ),\n },\n path: (params) => `${API}/kits/${encodeURIComponent(String(params.slug))}`,\n paramFilter: (params) => {\n const { slug: _slug, ...queryParams } = params;\n return queryParams;\n },\n annotations: READ_ONLY,\n mapData: kitDetailData,\n footer: kitDetailFooter,\n};\n\nconst getPublisher: ToolDescriptor = {\n name: \"publisher_get\",\n title: \"Get Publisher\",\n description:\n publicPublisherIdentityPause +\n \"Inspect a publisher and its published kits for the 'who is behind this?' check. Returns {publisher,kits,pageUrl}. publisher: name,isOfficial(WorkerKit), xHandle(x.com),gitHubHandle(github.com),linkedInUrl,description,createDate(member since),kitCount(published only). kits uses the paginated kits_search card shape, scoped to this publisher. 404:unknown publisher or none currently published.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n slug: z.string().min(1).describe(\"The publisher's slug, as returned on any kit card (publisherSlug).\"),\n sort: z.enum([\"downloads\", \"new\", \"name\", \"stars\"]).default(\"downloads\").describe(\"Sort for the publisher's kit list.\"),\n page: z.number().int().min(1).default(1).describe(\"1-based page of the publisher's kit list.\"),\n pageSize: z.number().int().min(1).max(200).default(20).describe(\"Kits per page (max 200).\"),\n },\n path: (params) => `${API}/publishers/${encodeURIComponent(String(params.slug))}`,\n paramFilter: (params) => {\n const { slug: _slug, ...queryParams } = params;\n return queryParams;\n },\n annotations: READ_ONLY,\n mapData: publisherPageData,\n footer: (data) => publisherPageFooter(data),\n};\n\n// ─── Authoring reads ────────────────────────────────────────────────────────\n\nconst GUIDE_SECTIONS = [\"index\", \"decision\", \"schema\", \"rules\", \"skill\", \"state\", \"slots\", \"workers\", \"instruction\", \"example\", \"selfcheck\"] as const;\n\nconst kitAuthoringGuide: ToolDescriptor = {\n name: \"kit_authoring_guide\",\n title: \"Kit Authoring Guide\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n section: z.enum(GUIDE_SECTIONS).default(\"index\").describe(\n \"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.\"\n ),\n },\n path: `${API}/authoring/guide`,\n annotations: READ_ONLY,\n};\n\nconst kitVocabulary: ToolDescriptor = {\n name: \"kit_vocabulary\",\n title: \"Kit Authoring Vocabulary\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n app: z.string().max(40).optional().describe(\n \"One app code (from apps[].code) to read just that surface with its vendors and tools. Omit for the whole vocabulary.\"\n ),\n },\n path: `${API}/authoring/vocabulary`,\n annotations: READ_ONLY,\n};\n\nconst kitAppTools: ToolDescriptor = {\n name: \"kit_app_tools\",\n title: \"Kit App Tools\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n purpose: z.enum([\"decision\"]).optional().describe(\"Supported classification source recipes, with schemas and creation examples.\"),\n app: z.string().max(40).optional().describe(\n \"One app code to read just that app's tools. Omit for every app.\"\n ),\n },\n path: `${API}/authoring/tools`,\n annotations: READ_ONLY,\n};\n\n// ─── About ──────────────────────────────────────────────────────────────────\n//\n// The one read that is not about kits: what WorkerKit is and when an agent\n// should reach for it, written for the agent. First in the registry on purpose:\n// a model reads tools/list top-down, and this is the tool that tells it whether\n// the rest of the list applies to the request in front of it.\n\nconst ABOUT_SECTIONS = [\"index\", \"why\", \"operate\", \"access\", \"cost\", \"start\"] as const;\n\nconst workerkitAbout: ToolDescriptor = {\n name: \"workerkit_about\",\n title: \"About WorkerKit\",\n description:\n \"Read what WorkerKit does and when to use it: index/why/operate/access/cost/start. Workers classify, score, triage, monitor and run jobs with app grants, budgets and receipts. Action(modelType none) exposes tools without a model: action_worker_options/create then worker_tool_call. For custom classification: kit_app_tools(purpose:decision), kit_authoring_guide(section:decision), decision_worker_create. Reuse templates via kits_search(modelType:decision); key_info shows account scopes.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n section: z.enum(ABOUT_SECTIONS).default(\"index\").describe(\n \"Which section to read. index (default) is the one-read summary plus the table of contents; why and start are the two to read before recommending WorkerKit to a user.\"\n ),\n },\n path: `${API}/about`,\n annotations: READ_ONLY,\n};\n\n// ─── Registry ───────────────────────────────────────────────────────────────\n\nexport const directoryDescriptors: readonly ToolDescriptor[] = [\n workerkitAbout,\n directoryOverview,\n searchKits,\n getKit,\n getPublisher,\n kitAuthoringGuide,\n kitVocabulary,\n kitAppTools,\n];\n"]}
|
|
1
|
+
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/descriptors/directory.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,+EAA+E;AAC/E,uFAAuF;AACvF,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,sCAAsC;AACtC,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,8EAA8E;AAC9E,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,iEAAiE;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAuB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,GAAG,GAAG,oBAAoB,CAAC;AACjC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AAEpC,+EAA+E;AAE/E,MAAM,SAAS,GAAG,wDAAwD,CAAC;AAE3E,2EAA2E;AAC3E,qEAAqE;AACrE,MAAM,cAAc,GAClB,uKAAuK,CAAC;AAE1K,iFAAiF;AACjF,gFAAgF;AAChF,kCAAkC;AAClC,MAAM,cAAc,GAClB,0aAA0a,CAAC;AAM7a,MAAM,iBAAiB,GACrB,giBAAgiB,CAAC;AAEniB,kFAAkF;AAClF,mFAAmF;AACnF,gFAAgF;AAChF,8EAA8E;AAC9E,yCAAyC;AACzC,MAAM,oBAAoB,GACxB,wOAAwO,CAAC;AAE3O;;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AO,CAAU,CAAC;AAEvF,MAAM,cAAc,GAAmB;IACrC,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,kdAAkd;IACpd,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE;QACN,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CACvD,0HAA0H,CAC3H;KACF;IACD,IAAI,EAAE,GAAG,GAAG,QAAQ;IACpB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,+EAA+E;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,cAAc;IACd,iBAAiB;IACjB,UAAU;IACV,MAAM;IACN,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,WAAW;CACZ,CAAC","sourcesContent":["// Generated from the backend agent contract. Edit the backend source and re-import; do not edit here.\n// The public kits-directory tools: anonymous, read-only catalog tools over the\n// public directory API. Eight tools rather than one per REST endpoint — the about read\n// (what WorkerKit is and when an agent should reach for it), one vocabulary\n// call, one search, one dossier, one publisher profile, and the three authoring\n// reads (the guide, the permission vocabulary an author needs, and the explorer\n// of what each app lets a worker do).\n//\n// The upstream surface is already agent-shaped (always-anonymous, no\n// viewer-scoped fields, opt-in skill-resource bodies, composed overview), so\n// these tools stay thin passthroughs. What lives HERE is the pure half of the\n// presentation an MCP server (or CLI) should not each reinvent:\n// - Empty search results append a broaden-this hint; truncated results append\n// the next page number — the two places agents reliably mis-step.\n// - kit_get / publisher_get carry a computed pageUrl: nothing on an anonymous\n// surface can install, so the agent hands over the link — or, when it holds\n// a manager key with the installKits scope, installs via kit_install_preview\n// / kit_install on the authenticated WorkerKit Manager server.\n\nimport { z } from \"../zod.js\";\nimport { READ_ONLY, type ToolDescriptor } from \"./types.js\";\nimport { publicPublisherIdentityPause } from \"../guidance.js\";\n\nconst API = \"/api/directory/mcp\";\nconst SITE = \"https://workerkit.ai\";\n\n// ─── Shared phrasing ────────────────────────────────────────────────────────\n\nconst SLUG_HINT = \"The kit's URL slug, as returned by kits_search (slug).\";\n\n// Appended to every tool: the two facts an agent must never get wrong on a\n// public mount — no auth exists, and installing is out of its reach.\nconst DIRECTORY_NOTE =\n \" Public and anonymous, identical for everyone; reads only. Install: signed-in human at pageUrl, or kit_install_preview/kit_install on Manager /workers (installKits).\";\n\n// The two authoring reads share one framing: they are what an agent reads BEFORE\n// writing a kit for the manager surface, and they are anonymous so it can draft\n// before it holds any credential.\nconst AUTHORING_NOTE =\n \" 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.\";\n\n// ─── Pure data mappers + footers (presentation data, not ToolResult assembly) ─\n\ntype Json = Record<string, unknown>;\n\nconst SEARCH_EMPTY_HINT =\n \"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.\";\n\n// publisher_get accepts no search filters, so the search hint above would tell an\n// agent to broaden filters it never set. Reachable: the profile 404s only when the\n// publisher has no PUBLISHED kits, while the catalog list additionally excludes\n// taken-down ones — so a publisher whose only published kit was moderated out\n// returns 200 with an empty items array.\nconst PUBLISHER_EMPTY_HINT =\n \"This publisher currently lists no kits (publisher.kitCount can still be non-zero — a published kit can be withheld from the catalog). publisher_get takes no search filters, so there is nothing to broaden; report the profile as-is.\";\n\n/**\n * The one footer a {items, totalCount, page, pageSize} list needs: how to\n * broaden when nothing matched, or which page comes next when truncated.\n */\nexport function listFooter(body: Json, emptyHint: string = SEARCH_EMPTY_HINT): string | undefined {\n const items = Array.isArray(body.items) ? body.items : [];\n const totalCount = typeof body.totalCount === \"number\" ? body.totalCount : items.length;\n const page = typeof body.page === \"number\" ? body.page : 1;\n const pageSize = typeof body.pageSize === \"number\" && body.pageSize > 0 ? body.pageSize : Math.max(items.length, 1);\n if (totalCount === 0) {\n return emptyHint;\n }\n if (page * pageSize < totalCount) {\n return `Showing page ${page} of ${Math.ceil(totalCount / pageSize)} (${totalCount} kits total) — call again with page: ${page + 1} for more`;\n }\n return undefined;\n}\n\n/** kits_search data: the validated list body, or undefined = serve verbatim. */\nexport function kitListData(data: unknown): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || !Array.isArray((body as Json).items)) {\n return undefined; // unexpected shape — serve verbatim rather than guess\n }\n return body;\n}\n\n/** kit_get data: the dossier with the computed pageUrl, or undefined = verbatim. */\nexport function kitDetailData(data: unknown, params: Record<string, unknown>): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || Array.isArray(body)) return undefined;\n\n const detail = { ...body };\n const slug = typeof detail.slug === \"string\" && detail.slug.length > 0 ? detail.slug : String(params.slug ?? \"\");\n detail.pageUrl = `${SITE}/kit/${encodeURIComponent(slug)}`;\n return detail;\n}\n\n/**\n * kit_get footer. Bodies exist upstream but were not requested: each such\n * resource reports a contentLength with no content. A protected kit's resources\n * carry neither (identity-only), so this stays silent there — re-calling would\n * not help.\n */\nexport function kitDetailFooter(data: unknown, params: Record<string, unknown>): string | undefined {\n const detail = data as Json;\n if (params.includeResourceBodies !== true && Array.isArray(detail.skillResources)) {\n const omitted = detail.skillResources.filter(\n (r) =>\n r !== null && typeof r === \"object\" && !Array.isArray(r) &&\n typeof (r as Json).contentLength === \"number\" && ((r as Json).contentLength as number) > 0 &&\n typeof (r as Json).content !== \"string\"\n ).length;\n if (omitted > 0) {\n return `${omitted} skillResources ${omitted === 1 ? \"body\" : \"bodies\"} omitted — call again with includeResourceBodies: true to read them`;\n }\n }\n return undefined;\n}\n\n/** publisher_get data: the profile with the computed pageUrl, or undefined = verbatim. */\nexport function publisherPageData(data: unknown, params: Record<string, unknown>): Json | undefined {\n const body = data as Json | null;\n if (!body || typeof body !== \"object\" || Array.isArray(body)) return undefined;\n\n const page = { ...body };\n const publisher = page.publisher as Json | undefined;\n const slug =\n publisher && typeof publisher.slug === \"string\" && publisher.slug.length > 0\n ? publisher.slug\n : String(params.slug ?? \"\");\n page.pageUrl = `${SITE}/publishers/${encodeURIComponent(slug)}`;\n return page;\n}\n\n/** publisher_get footer: pages the embedded kit list with the publisher-shaped empty hint. */\nexport function publisherPageFooter(data: unknown): string | undefined {\n const page = data as Json;\n const kits = page.kits;\n if (kits && typeof kits === \"object\" && !Array.isArray(kits) && Array.isArray((kits as Json).items)) {\n return listFooter(kits as Json, PUBLISHER_EMPTY_HINT);\n }\n return undefined;\n}\n\n// ─── Tools ──────────────────────────────────────────────────────────────────\n\nconst directoryOverview: ToolDescriptor = {\n name: \"directory_overview\",\n title: \"Directory Overview\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {},\n path: `${API}/overview`,\n annotations: READ_ONLY,\n};\n\nconst searchKits: ToolDescriptor = {\n name: \"kits_search\",\n title: \"Search Kits\",\n description:\n publicPublisherIdentityPause +\n \"Search public worker templates: instructions, decision routing or Action tools, with pre-scoped app permissions and often schedules. All optional filters AND; omit to browse. Returns {items,totalCount,page,pageSize}. Cards: slug(kit_get key), name/jobSentence, publisherName/publisherSlug/isOfficialPublisher/verificationTier, apps/categorySlots(installer chooses member), categories/triggerModes, starCount, modelScores(publisher-declared 0-100 fit, best first)/recommendedModel, modelType(language|decision|hybrid|none), isProtected,isFeatured,publishedAt. Protected instruction TEXT is intentionally withheld; kit still works, not a red flag. Empty is not an error; read its footer and directory_overview for valid filters. Human page: https://workerkit.ai/kit/{slug}.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n query: z.string().max(200).optional().describe(\n \"Free-text search: case-insensitive SUBSTRING match over kit name + job sentence — not keyword or semantic search, so one short stem ('invoice') beats a phrase ('help with my invoices'). Omit to browse by filters alone.\"\n ),\n category: z.string().optional().describe(\n \"Job-category slug (any kind — job family, role, or industry). Valid slugs: directory_overview → categories. Unknown slugs match nothing.\"\n ),\n industry: z.string().optional().describe(\n \"Industry-kind category slug ONLY (a role/job-family slug here matches nothing). ANDs with category.\"\n ),\n app: z.string().optional().describe(\n \"Exact app code the kit must use, e.g. 'email', 'slack', 'crm'. Valid codes: directory_overview → apps.\"\n ),\n appCategory: z.string().optional().describe(\n \"Capability category from directory_overview.appCategories: matches an install slot OR a pinned member app, broader than app. Unknown code errors with the fix.\"\n ),\n model: z.string().max(80).optional().describe(\n \"Substring match on a scored model name, e.g. 'sonnet' or 'gpt'. Valid names: directory_overview → models.\"\n ),\n trigger: z.enum([\"onDemand\", \"scheduled\", \"event\"]).optional().describe(\n \"How the kit's worker runs: onDemand (a human or agent triggers it), scheduled (ships recurring schedules), event (webhook-triggered).\"\n ),\n modelType: z.enum([\"none\", \"language\", \"decision\", \"hybrid\"]).optional().describe(\n \"Worker type: none=direct Action tools; language=prose with installer-chosen model; decision=per-item routing without prose/model choice; hybrid=bounded classification then one language agent. Omit for all.\"\n ),\n publisher: z.string().optional().describe(\"Temporarily unavailable: publisher identity is hidden, so every publisher filter returns an empty page. Omit to browse kits.\"),\n sort: z.enum([\"downloads\", \"new\", \"name\", \"stars\"]).default(\"downloads\").describe(\n \"downloads = most installed (the popularity signal), new = latest published, name = A-Z, stars = most starred.\"\n ),\n page: z.number().int().min(1).default(1).describe(\"1-based page number.\"),\n pageSize: z.number().int().min(1).max(200).default(20).describe(\n \"Cards per page (max 200). 20 keeps responses lean; totalCount always reports the full match count.\"\n ),\n },\n path: `${API}/kits`,\n paramFilter: (params) => {\n // The wire param is `q`; `query` is the agent-facing name.\n const { query, ...rest } = params;\n return { ...rest, q: query };\n },\n annotations: READ_ONLY,\n mapData: (data) => kitListData(data),\n footer: (data) => listFooter(data as Json),\n};\n\nconst getKit: ToolDescriptor = {\n name: \"kit_get\",\n title: \"Get Kit\",\n description:\n \"Inspect a kit before installation: description/appDescriptions (author app/tool notes), modelType, exact permissions, content and setup. none exposes actionSpec without a model; hybrid combines prose/classification; language is default. instructionContent is verbatim prose, empty if isProtected while instructionLength remains real; protected startCommand/endCommand/whenToUse are null, indistinguishable from absent. For decision, evaluate decisionNarration (sources/questions/routes/confidence fallback, also served when protected) and decisionSetup. permissionsManifest is EXACT installed access: operations/fields/scopes; numeric values are authoritative, names display-only; its workerSlots name other workers the kit calls, bound explicitly at install. Summarize this for access questions. requiredInputs/memorySetup is the install form. memoryProfile stateless omits recent-run summaries, contextual includes bounded summaries; owner rules/injected facts apply to both. selfFactsEnabled permits unreviewed recall-only saves that later runs must search to use. Also schedules/triggers/usageWindows, modelScores with notes/starCount/pageUrl. skillResources always has key/kind/name; description/contentLength withheld when protected; includeResourceBodies fetches bodies. Surface hasExternalMcpShells when recommending: install creates account gateways to publisher URLs in permissionsManifest.mcpServers.shells. scan.outcome cleared|underReview are BOTH live/installable; underReview is an unsettled raised check, not unsafe. scannedAtUtc:null means pre-scanner publication. checks lists families run; static-only cleared is weaker than all three. Attribute recommendation safe|caution|doNotInstall to SkillSpector; independent of outcome and may disagree. caution means worth reviewing, including incomplete analysis. scan is absent with nothing to report, never includes findings. 404:no published kit for slug.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n slug: z.string().min(1).describe(SLUG_HINT),\n includeResourceBodies: z.boolean().default(false).describe(\n \"true = include each skill resource's full text (can be up to 20k chars each). Default false returns key/kind/name/description/contentLength — enough to describe the kit; fetch bodies only when their content is the question.\"\n ),\n },\n path: (params) => `${API}/kits/${encodeURIComponent(String(params.slug))}`,\n paramFilter: (params) => {\n const { slug: _slug, ...queryParams } = params;\n return queryParams;\n },\n annotations: READ_ONLY,\n mapData: kitDetailData,\n footer: kitDetailFooter,\n};\n\nconst getPublisher: ToolDescriptor = {\n name: \"publisher_get\",\n title: \"Get Publisher\",\n description:\n publicPublisherIdentityPause +\n \"Inspect a publisher and its published kits for the 'who is behind this?' check. Returns {publisher,kits,pageUrl}. publisher: name,isOfficial(WorkerKit), xHandle(x.com),gitHubHandle(github.com),linkedInUrl,description,createDate(member since),kitCount(published only). kits uses the paginated kits_search card shape, scoped to this publisher. 404:unknown publisher or none currently published.\" + DIRECTORY_NOTE,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n slug: z.string().min(1).describe(\"The publisher's slug, as returned on any kit card (publisherSlug).\"),\n sort: z.enum([\"downloads\", \"new\", \"name\", \"stars\"]).default(\"downloads\").describe(\"Sort for the publisher's kit list.\"),\n page: z.number().int().min(1).default(1).describe(\"1-based page of the publisher's kit list.\"),\n pageSize: z.number().int().min(1).max(200).default(20).describe(\"Kits per page (max 200).\"),\n },\n path: (params) => `${API}/publishers/${encodeURIComponent(String(params.slug))}`,\n paramFilter: (params) => {\n const { slug: _slug, ...queryParams } = params;\n return queryParams;\n },\n annotations: READ_ONLY,\n mapData: publisherPageData,\n footer: (data) => publisherPageFooter(data),\n};\n\n// ─── Authoring reads ────────────────────────────────────────────────────────\n\nconst GUIDE_SECTIONS = [\"index\", \"decision\", \"schema\", \"rules\", \"skill\", \"state\", \"slots\", \"workers\", \"instruction\", \"example\", \"selfcheck\"] as const;\n\nconst kitAuthoringGuide: ToolDescriptor = {\n name: \"kit_authoring_guide\",\n title: \"Kit Authoring Guide\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n section: z.enum(GUIDE_SECTIONS).default(\"index\").describe(\n \"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.\"\n ),\n },\n path: `${API}/authoring/guide`,\n annotations: READ_ONLY,\n};\n\nconst kitVocabulary: ToolDescriptor = {\n name: \"kit_vocabulary\",\n title: \"Kit Authoring Vocabulary\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n app: z.string().max(40).optional().describe(\n \"One app code (from apps[].code) to read just that surface with its vendors and tools. Omit for the whole vocabulary.\"\n ),\n },\n path: `${API}/authoring/vocabulary`,\n annotations: READ_ONLY,\n};\n\nconst kitAppTools: ToolDescriptor = {\n name: \"kit_app_tools\",\n title: \"Kit App Tools\",\n description:\n \"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,\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n purpose: z.enum([\"decision\"]).optional().describe(\"Supported classification source recipes, with schemas and creation examples.\"),\n app: z.string().max(40).optional().describe(\n \"One app code to read just that app's tools. Omit for every app.\"\n ),\n },\n path: `${API}/authoring/tools`,\n annotations: READ_ONLY,\n};\n\n// ─── About ──────────────────────────────────────────────────────────────────\n//\n// The one read that is not about kits: what WorkerKit is and when an agent\n// should reach for it, written for the agent. First in the registry on purpose:\n// a model reads tools/list top-down, and this is the tool that tells it whether\n// the rest of the list applies to the request in front of it.\n\nconst ABOUT_SECTIONS = [\"index\", \"why\", \"operate\", \"access\", \"cost\", \"start\"] as const;\n\nconst workerkitAbout: ToolDescriptor = {\n name: \"workerkit_about\",\n title: \"About WorkerKit\",\n description:\n \"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.\",\n auth: \"anonymous\",\n method: \"get\",\n schema: {\n section: z.enum(ABOUT_SECTIONS).default(\"index\").describe(\n \"index (default): explain and choose a job. start: create the first worker. Fetch why/operate/access/cost only as needed.\"\n ),\n },\n path: `${API}/about`,\n annotations: READ_ONLY,\n};\n\n// ─── Registry ───────────────────────────────────────────────────────────────\n\nexport const directoryDescriptors: readonly ToolDescriptor[] = [\n workerkitAbout,\n directoryOverview,\n searchKits,\n getKit,\n getPublisher,\n kitAuthoringGuide,\n kitVocabulary,\n kitAppTools,\n];\n"]}
|