@databricks/appkit 0.68.0 → 0.69.0
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/dist/appkit/package.js +1 -1
- package/dist/core/agent/skills/types.d.ts +6 -1
- package/dist/core/agent/skills/types.d.ts.map +1 -1
- package/dist/plugins/agents/active-stream-tracker.js +52 -0
- package/dist/plugins/agents/active-stream-tracker.js.map +1 -0
- package/dist/plugins/agents/adapter-extensions.js +50 -0
- package/dist/plugins/agents/adapter-extensions.js.map +1 -0
- package/dist/plugins/agents/agents.d.ts +6 -77
- package/dist/plugins/agents/agents.d.ts.map +1 -1
- package/dist/plugins/agents/agents.js +57 -431
- package/dist/plugins/agents/agents.js.map +1 -1
- package/dist/plugins/agents/approval.js +28 -0
- package/dist/plugins/agents/approval.js.map +1 -0
- package/dist/plugins/agents/builtin-tools.js +39 -0
- package/dist/plugins/agents/builtin-tools.js.map +1 -0
- package/dist/plugins/agents/prompt.js +27 -0
- package/dist/plugins/agents/prompt.js.map +1 -0
- package/dist/plugins/agents/registry.js +56 -0
- package/dist/plugins/agents/registry.js.map +1 -0
- package/dist/plugins/agents/resolve-config.js +40 -0
- package/dist/plugins/agents/resolve-config.js.map +1 -0
- package/dist/plugins/agents/skill-loader.js +139 -0
- package/dist/plugins/agents/skill-loader.js.map +1 -0
- package/dist/plugins/agents/tool-dispatch.js +124 -0
- package/dist/plugins/agents/tool-dispatch.js.map +1 -0
- package/dist/plugins/server/index.js +2 -2
- package/dist/plugins/server/index.js.map +1 -1
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +3 -3
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
- package/dist/plugins/server/static-server.js +3 -3
- package/dist/plugins/server/static-server.js.map +1 -1
- package/dist/plugins/server/utils.js +3 -3
- package/dist/plugins/server/utils.js.map +1 -1
- package/dist/plugins/server/vite-dev-server.js +4 -4
- package/dist/plugins/server/vite-dev-server.js.map +1 -1
- package/dist/shared/src/schemas/manifest.d.ts +33 -33
- package/dist/type-generator/database/generate.js +3 -3
- package/dist/type-generator/database/generate.js.map +1 -1
- package/dist/type-generator/migration.js +2 -2
- package/dist/type-generator/migration.js.map +1 -1
- package/dist/type-generator/serving/server-file-extractor.js +3 -3
- package/dist/type-generator/serving/server-file-extractor.js.map +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
package/dist/appkit/package.js
CHANGED
|
@@ -19,7 +19,12 @@ interface SkillDefinition {
|
|
|
19
19
|
source: SkillSource;
|
|
20
20
|
/** Absolute directory containing `SKILL.md` and any bundled resources. */
|
|
21
21
|
dir: string;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Relative posix paths of bundled resource files (excludes `SKILL.md`).
|
|
24
|
+
* Bundle skills recurse into subdirectories; volume skills list one level
|
|
25
|
+
* only, so nested files under a volume skill are not exposed to
|
|
26
|
+
* `read_skill_file`.
|
|
27
|
+
*/
|
|
23
28
|
files: string[];
|
|
24
29
|
/**
|
|
25
30
|
* Optional advisory tool allowlist from frontmatter `allowed-tools`. Surfaced
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/core/agent/skills/types.ts"],"mappings":";;KACY,WAAA;;;;;AASZ;;;UAAiB,eAAA;EAEf;EAAA,IAAA;EAIA;EAFA,WAAA;EAIQ;EAFR,IAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/core/agent/skills/types.ts"],"mappings":";;KACY,WAAA;;;;;AASZ;;;UAAiB,eAAA;EAEf;EAAA,IAAA;EAIA;EAFA,WAAA;EAIQ;EAFR,IAAA;EAWA;EATA,MAAA,EAAQ,WAAA;EAeI;EAbZ,GAAA;EAiBe;;;;;AAYjB;EAtBE,KAAA;;;;;;EAMA,YAAA;AAAA;;UAIe,iBAAA;EAaQ;EAXvB,IAAA;EACA,WAAA;AAAA;;;;;;;UASe,oBAAA;EACf,SAAA,EAAW,GAAA,SAAY,eAAA;EACvB,SAAA,EAAW,GAAA;EACX,OAAA,EAAS,iBAAA;AAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/plugins/agents/active-stream-tracker.ts
|
|
2
|
+
/**
|
|
3
|
+
* Tracks active SSE streams and a per-user stream count for the agents plugin's
|
|
4
|
+
* concurrency limit. The count is kept in sync with the stream map on every
|
|
5
|
+
* {@link track}/{@link untrack} so the limit check is O(1) instead of O(n) over
|
|
6
|
+
* all active streams on every request. `track` and `untrack` are the only
|
|
7
|
+
* writers, which is what keeps the counter from drifting from the map.
|
|
8
|
+
*
|
|
9
|
+
* Distinct from the SSE-layer `StreamRegistry` in `src/stream/` (which buffers
|
|
10
|
+
* events per connection for reconnection replay) — this only counts streams.
|
|
11
|
+
*/
|
|
12
|
+
var ActiveStreamTracker = class {
|
|
13
|
+
activeStreams = /* @__PURE__ */ new Map();
|
|
14
|
+
userStreamCounts = /* @__PURE__ */ new Map();
|
|
15
|
+
/** Count active streams owned by a given user. O(1). */
|
|
16
|
+
count(userId) {
|
|
17
|
+
return this.userStreamCounts.get(userId) ?? 0;
|
|
18
|
+
}
|
|
19
|
+
/** Total active streams across all users. */
|
|
20
|
+
get size() {
|
|
21
|
+
return this.activeStreams.size;
|
|
22
|
+
}
|
|
23
|
+
/** Look up an active stream by request id. */
|
|
24
|
+
get(requestId) {
|
|
25
|
+
return this.activeStreams.get(requestId);
|
|
26
|
+
}
|
|
27
|
+
/** Register a stream for `userId` and bump the per-user counter. */
|
|
28
|
+
track(requestId, userId, controller) {
|
|
29
|
+
this.activeStreams.set(requestId, {
|
|
30
|
+
controller,
|
|
31
|
+
userId
|
|
32
|
+
});
|
|
33
|
+
this.userStreamCounts.set(userId, (this.userStreamCounts.get(userId) ?? 0) + 1);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Remove a stream and decrement the per-user counter. Idempotent — calling
|
|
37
|
+
* twice for the same `requestId` is a no-op. Drops the counter key entirely
|
|
38
|
+
* when it reaches zero so the map can't grow unbounded across many users.
|
|
39
|
+
*/
|
|
40
|
+
untrack(requestId) {
|
|
41
|
+
const entry = this.activeStreams.get(requestId);
|
|
42
|
+
if (!entry) return;
|
|
43
|
+
this.activeStreams.delete(requestId);
|
|
44
|
+
const next = (this.userStreamCounts.get(entry.userId) ?? 0) - 1;
|
|
45
|
+
if (next <= 0) this.userStreamCounts.delete(entry.userId);
|
|
46
|
+
else this.userStreamCounts.set(entry.userId, next);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { ActiveStreamTracker };
|
|
52
|
+
//# sourceMappingURL=active-stream-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-stream-tracker.js","names":[],"sources":["../../../src/plugins/agents/active-stream-tracker.ts"],"sourcesContent":["/**\n * Tracks active SSE streams and a per-user stream count for the agents plugin's\n * concurrency limit. The count is kept in sync with the stream map on every\n * {@link track}/{@link untrack} so the limit check is O(1) instead of O(n) over\n * all active streams on every request. `track` and `untrack` are the only\n * writers, which is what keeps the counter from drifting from the map.\n *\n * Distinct from the SSE-layer `StreamRegistry` in `src/stream/` (which buffers\n * events per connection for reconnection replay) — this only counts streams.\n */\nexport class ActiveStreamTracker {\n private readonly activeStreams = new Map<\n string,\n { controller: AbortController; userId: string }\n >();\n private readonly userStreamCounts = new Map<string, number>();\n\n /** Count active streams owned by a given user. O(1). */\n count(userId: string): number {\n return this.userStreamCounts.get(userId) ?? 0;\n }\n\n /** Total active streams across all users. */\n get size(): number {\n return this.activeStreams.size;\n }\n\n /** Look up an active stream by request id. */\n get(\n requestId: string,\n ): { controller: AbortController; userId: string } | undefined {\n return this.activeStreams.get(requestId);\n }\n\n /** Register a stream for `userId` and bump the per-user counter. */\n track(requestId: string, userId: string, controller: AbortController): void {\n this.activeStreams.set(requestId, { controller, userId });\n this.userStreamCounts.set(\n userId,\n (this.userStreamCounts.get(userId) ?? 0) + 1,\n );\n }\n\n /**\n * Remove a stream and decrement the per-user counter. Idempotent — calling\n * twice for the same `requestId` is a no-op. Drops the counter key entirely\n * when it reaches zero so the map can't grow unbounded across many users.\n */\n untrack(requestId: string): void {\n const entry = this.activeStreams.get(requestId);\n if (!entry) return;\n this.activeStreams.delete(requestId);\n const next = (this.userStreamCounts.get(entry.userId) ?? 0) - 1;\n if (next <= 0) {\n this.userStreamCounts.delete(entry.userId);\n } else {\n this.userStreamCounts.set(entry.userId, next);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,sBAAb,MAAiC;CAC/B,AAAiB,gCAAgB,IAAI,KAGlC;CACH,AAAiB,mCAAmB,IAAI,KAAqB;;CAG7D,MAAM,QAAwB;AAC5B,SAAO,KAAK,iBAAiB,IAAI,OAAO,IAAI;;;CAI9C,IAAI,OAAe;AACjB,SAAO,KAAK,cAAc;;;CAI5B,IACE,WAC6D;AAC7D,SAAO,KAAK,cAAc,IAAI,UAAU;;;CAI1C,MAAM,WAAmB,QAAgB,YAAmC;AAC1E,OAAK,cAAc,IAAI,WAAW;GAAE;GAAY;GAAQ,CAAC;AACzD,OAAK,iBAAiB,IACpB,SACC,KAAK,iBAAiB,IAAI,OAAO,IAAI,KAAK,EAC5C;;;;;;;CAQH,QAAQ,WAAyB;EAC/B,MAAM,QAAQ,KAAK,cAAc,IAAI,UAAU;AAC/C,MAAI,CAAC,MAAO;AACZ,OAAK,cAAc,OAAO,UAAU;EACpC,MAAM,QAAQ,KAAK,iBAAiB,IAAI,MAAM,OAAO,IAAI,KAAK;AAC9D,MAAI,QAAQ,EACV,MAAK,iBAAiB,OAAO,MAAM,OAAO;MAE1C,MAAK,iBAAiB,IAAI,MAAM,QAAQ,KAAK"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createLogger } from "../../logging/logger.js";
|
|
2
|
+
import { SUPERVISOR_EXTENSION_KEY } from "../../agents/supervisor-api.js";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/agents/adapter-extensions.ts
|
|
5
|
+
const logger = createLogger("agents");
|
|
6
|
+
/**
|
|
7
|
+
* Pulls the LLM-readable description off any {@link SupervisorTool} kind.
|
|
8
|
+
* Used to populate the synthetic placeholder `def.description` on
|
|
9
|
+
* hosted-supervisor tool-index entries.
|
|
10
|
+
*/
|
|
11
|
+
function supervisorToolDescription(spec) {
|
|
12
|
+
switch (spec.type) {
|
|
13
|
+
case "genie_space": return spec.genie_space.description;
|
|
14
|
+
case "uc_function": return spec.uc_function.description;
|
|
15
|
+
case "knowledge_assistant": return spec.knowledge_assistant.description;
|
|
16
|
+
case "app": return spec.app.description;
|
|
17
|
+
case "uc_connection": return spec.uc_connection.description;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds the `AgentInput.extensions` payload from a tool index, aggregating
|
|
22
|
+
* the hosted-supervisor specs under {@link SUPERVISOR_EXTENSION_KEY}. Returns
|
|
23
|
+
* `undefined` when there are no adapter-side hosted tools so the field stays
|
|
24
|
+
* absent on the wire — adapters that don't read extensions never see it.
|
|
25
|
+
*/
|
|
26
|
+
function buildAdapterExtensions(toolIndex) {
|
|
27
|
+
const supervisorSpecs = [];
|
|
28
|
+
for (const entry of toolIndex.values()) if (entry.source === "hosted-supervisor") supervisorSpecs.push(entry.spec);
|
|
29
|
+
if (supervisorSpecs.length === 0) return void 0;
|
|
30
|
+
return { [SUPERVISOR_EXTENSION_KEY]: { hostedTools: supervisorSpecs } };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Compares the adapter's declared capabilities against the tool index and
|
|
34
|
+
* logs a warning when the agent's tool declarations would be silently
|
|
35
|
+
* dropped at runtime. Warn-not-throw: misconfiguration is loud enough to
|
|
36
|
+
* notice without taking the whole app down.
|
|
37
|
+
*/
|
|
38
|
+
function warnOnCapabilityMismatch(agentName, adapter, toolIndex) {
|
|
39
|
+
const accepted = new Set(adapter.acceptsExtensions ?? []);
|
|
40
|
+
const hostedSupervisorKeys = [];
|
|
41
|
+
const inputToolKeys = [];
|
|
42
|
+
for (const [key, entry] of toolIndex) if (entry.source === "hosted-supervisor") hostedSupervisorKeys.push(key);
|
|
43
|
+
else inputToolKeys.push(key);
|
|
44
|
+
if (hostedSupervisorKeys.length > 0 && !accepted.has(SUPERVISOR_EXTENSION_KEY)) logger.warn(`Agent '${agentName}' declares hosted-supervisor tools (${hostedSupervisorKeys.join(", ")}) but its model adapter does not accept the 'databricks.supervisor' extension. These tools will not reach the model. Pair them with \`DatabricksAdapter.fromSupervisorApi(...)\`, or remove them.`);
|
|
45
|
+
if (adapter.consumesInputTools === false && inputToolKeys.length > 0) logger.warn(`Agent '${agentName}' declares function tools / sub-agents / MCP tools (${inputToolKeys.join(", ")}) but its model adapter does not consume input.tools (Supervisor API owns its own tool loop). These tools will not be exposed to the model. See docs/plugins/agents.md.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { buildAdapterExtensions, supervisorToolDescription, warnOnCapabilityMismatch };
|
|
50
|
+
//# sourceMappingURL=adapter-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-extensions.js","names":[],"sources":["../../../src/plugins/agents/adapter-extensions.ts"],"sourcesContent":["import type { AgentAdapter } from \"shared\";\n\nimport {\n SUPERVISOR_EXTENSION_KEY,\n type SupervisorTool,\n} from \"../../agents/supervisor-api\";\nimport type { ResolvedToolEntry } from \"../../core/agent/types\";\nimport { createLogger } from \"../../logging/logger\";\n\nconst logger = createLogger(\"agents\");\n\n/**\n * Pulls the LLM-readable description off any {@link SupervisorTool} kind.\n * Used to populate the synthetic placeholder `def.description` on\n * hosted-supervisor tool-index entries.\n */\nexport function supervisorToolDescription(spec: SupervisorTool): string {\n switch (spec.type) {\n case \"genie_space\":\n return spec.genie_space.description;\n case \"uc_function\":\n return spec.uc_function.description;\n case \"knowledge_assistant\":\n return spec.knowledge_assistant.description;\n case \"app\":\n return spec.app.description;\n case \"uc_connection\":\n return spec.uc_connection.description;\n }\n}\n\n/**\n * Builds the `AgentInput.extensions` payload from a tool index, aggregating\n * the hosted-supervisor specs under {@link SUPERVISOR_EXTENSION_KEY}. Returns\n * `undefined` when there are no adapter-side hosted tools so the field stays\n * absent on the wire — adapters that don't read extensions never see it.\n */\nexport function buildAdapterExtensions(\n toolIndex: Map<string, ResolvedToolEntry>,\n): Readonly<Record<string, unknown>> | undefined {\n const supervisorSpecs: SupervisorTool[] = [];\n for (const entry of toolIndex.values()) {\n if (entry.source === \"hosted-supervisor\") {\n supervisorSpecs.push(entry.spec);\n }\n }\n if (supervisorSpecs.length === 0) return undefined;\n return {\n [SUPERVISOR_EXTENSION_KEY]: { hostedTools: supervisorSpecs },\n };\n}\n\n/**\n * Compares the adapter's declared capabilities against the tool index and\n * logs a warning when the agent's tool declarations would be silently\n * dropped at runtime. Warn-not-throw: misconfiguration is loud enough to\n * notice without taking the whole app down.\n */\nexport function warnOnCapabilityMismatch(\n agentName: string,\n adapter: AgentAdapter,\n toolIndex: Map<string, ResolvedToolEntry>,\n): void {\n const accepted = new Set(adapter.acceptsExtensions ?? []);\n\n const hostedSupervisorKeys: string[] = [];\n const inputToolKeys: string[] = [];\n for (const [key, entry] of toolIndex) {\n if (entry.source === \"hosted-supervisor\") {\n hostedSupervisorKeys.push(key);\n } else {\n inputToolKeys.push(key);\n }\n }\n\n if (\n hostedSupervisorKeys.length > 0 &&\n !accepted.has(SUPERVISOR_EXTENSION_KEY)\n ) {\n logger.warn(\n `Agent '${agentName}' declares hosted-supervisor tools (${hostedSupervisorKeys.join(\", \")}) ` +\n \"but its model adapter does not accept the 'databricks.supervisor' extension. \" +\n \"These tools will not reach the model. Pair them with `DatabricksAdapter.fromSupervisorApi(...)`, or remove them.\",\n );\n }\n\n // `consumesInputTools` defaults to true. Only warn when an adapter\n // explicitly opts out (`false`) and an input tool would be silently\n // ignored.\n if (adapter.consumesInputTools === false && inputToolKeys.length > 0) {\n logger.warn(\n `Agent '${agentName}' declares function tools / sub-agents / MCP tools (${inputToolKeys.join(\", \")}) ` +\n \"but its model adapter does not consume input.tools (Supervisor API owns its own tool loop). \" +\n \"These tools will not be exposed to the model. See docs/plugins/agents.md.\",\n );\n }\n}\n"],"mappings":";;;;AASA,MAAM,SAAS,aAAa,SAAS;;;;;;AAOrC,SAAgB,0BAA0B,MAA8B;AACtE,SAAQ,KAAK,MAAb;EACE,KAAK,cACH,QAAO,KAAK,YAAY;EAC1B,KAAK,cACH,QAAO,KAAK,YAAY;EAC1B,KAAK,sBACH,QAAO,KAAK,oBAAoB;EAClC,KAAK,MACH,QAAO,KAAK,IAAI;EAClB,KAAK,gBACH,QAAO,KAAK,cAAc;;;;;;;;;AAUhC,SAAgB,uBACd,WAC+C;CAC/C,MAAM,kBAAoC,EAAE;AAC5C,MAAK,MAAM,SAAS,UAAU,QAAQ,CACpC,KAAI,MAAM,WAAW,oBACnB,iBAAgB,KAAK,MAAM,KAAK;AAGpC,KAAI,gBAAgB,WAAW,EAAG,QAAO;AACzC,QAAO,GACJ,2BAA2B,EAAE,aAAa,iBAAiB,EAC7D;;;;;;;;AASH,SAAgB,yBACd,WACA,SACA,WACM;CACN,MAAM,WAAW,IAAI,IAAI,QAAQ,qBAAqB,EAAE,CAAC;CAEzD,MAAM,uBAAiC,EAAE;CACzC,MAAM,gBAA0B,EAAE;AAClC,MAAK,MAAM,CAAC,KAAK,UAAU,UACzB,KAAI,MAAM,WAAW,oBACnB,sBAAqB,KAAK,IAAI;KAE9B,eAAc,KAAK,IAAI;AAI3B,KACE,qBAAqB,SAAS,KAC9B,CAAC,SAAS,IAAI,yBAAyB,CAEvC,QAAO,KACL,UAAU,UAAU,sCAAsC,qBAAqB,KAAK,KAAK,CAAC,mMAG3F;AAMH,KAAI,QAAQ,uBAAuB,SAAS,cAAc,SAAS,EACjE,QAAO,KACL,UAAU,UAAU,sDAAsD,cAAc,KAAK,KAAK,CAAC,yKAGpG"}
|
|
@@ -14,14 +14,11 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
14
14
|
protected config: AgentsPluginConfig;
|
|
15
15
|
private agents;
|
|
16
16
|
private defaultAgentName;
|
|
17
|
-
private activeStreams;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* active stream on every request. Mutated only via {@link trackStream}
|
|
22
|
-
* and {@link untrackStream}.
|
|
18
|
+
* Active SSE streams + per-user counts (the O(1) concurrency-limit check).
|
|
19
|
+
* Mutated only via {@link trackStream} / {@link untrackStream}.
|
|
23
20
|
*/
|
|
24
|
-
private
|
|
21
|
+
private streams;
|
|
25
22
|
private mcpClient;
|
|
26
23
|
private threadStore;
|
|
27
24
|
private approvalGate;
|
|
@@ -52,18 +49,7 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
52
49
|
private get resolvedLimits();
|
|
53
50
|
/** Count active streams owned by a given user. O(1). */
|
|
54
51
|
private countUserStreams;
|
|
55
|
-
/**
|
|
56
|
-
* Register a stream for `userId` and bump the per-user counter. Paired
|
|
57
|
-
* with {@link untrackStream}; the two helpers are the only writers to
|
|
58
|
-
* `activeStreams` + `userStreamCounts`, so the counter cannot drift from
|
|
59
|
-
* the map.
|
|
60
|
-
*/
|
|
61
52
|
private trackStream;
|
|
62
|
-
/**
|
|
63
|
-
* Remove a stream from the active map and decrement the per-user
|
|
64
|
-
* counter. Idempotent — calling twice for the same `requestId` is a
|
|
65
|
-
* no-op (the second call sees no entry and returns early).
|
|
66
|
-
*/
|
|
67
53
|
private untrackStream;
|
|
68
54
|
setup(): Promise<void>;
|
|
69
55
|
/**
|
|
@@ -96,15 +82,7 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
96
82
|
*/
|
|
97
83
|
private warnConfigAgentsDeprecated;
|
|
98
84
|
private resolvedAgentsDir;
|
|
99
|
-
/**
|
|
100
|
-
* Discovers code agents (see {@link resolveCodeAgentsDir} and
|
|
101
|
-
* {@link loadCodeAgentsFromDir}). Warns if sources exist but nothing was
|
|
102
|
-
* discovered — usually the build didn't emit the compiled agents — unless
|
|
103
|
-
* the deprecated `agents({ agents })` map is carrying them instead.
|
|
104
|
-
*/
|
|
105
85
|
private loadCodeAgents;
|
|
106
|
-
/** True when `dir` holds at least one `<id>/agent.ts` folder. */
|
|
107
|
-
private hasCodeAgentSources;
|
|
108
86
|
private loadFileDefinitions;
|
|
109
87
|
/**
|
|
110
88
|
* Builds the map of plugin-name → toolkit that the markdown loader consults
|
|
@@ -116,8 +94,6 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
116
94
|
private buildRegisteredAgent;
|
|
117
95
|
/** Loads the shared global skill pool from `<agentsDir>/skills/`. */
|
|
118
96
|
private loadGlobalSkills;
|
|
119
|
-
/** Configured catalog-skills volume path, or null when none is set. */
|
|
120
|
-
private resolveSkillsVolume;
|
|
121
97
|
/**
|
|
122
98
|
* Workspace client used to read catalog skills. v1 reads as the app service
|
|
123
99
|
* principal; `getWorkspaceClient()` resolves to SP outside a user scope
|
|
@@ -125,23 +101,8 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
125
101
|
* switch point for a future OBO mode.
|
|
126
102
|
*/
|
|
127
103
|
private skillWorkspaceClient;
|
|
128
|
-
/**
|
|
129
|
-
* Discovers catalog skills from the configured UC Volume, read as the
|
|
130
|
-
* service principal at boot (and on `reload()`). Each `<volume>/<name>/`
|
|
131
|
-
* folder with a `SKILL.md` becomes a `source: "volume"` skill. Best-effort:
|
|
132
|
-
* a missing volume, unavailable workspace client, or a malformed individual
|
|
133
|
-
* skill is logged and skipped rather than failing the whole registry build.
|
|
134
|
-
*/
|
|
104
|
+
/** Discovers catalog skills from the configured UC Volume (best-effort). */
|
|
135
105
|
private loadVolumeSkills;
|
|
136
|
-
/** Lists a volume skill's resource files (one level, excluding SKILL.md). */
|
|
137
|
-
private listVolumeSkillFiles;
|
|
138
|
-
/**
|
|
139
|
-
* Resolves the per-agent skill catalog: loads this agent's private skills
|
|
140
|
-
* (`<agentsDir>/<id>/skills/`, file-origin only), then applies visibility
|
|
141
|
-
* (opt-in via `def.skills` or `autoInheritSkills`) and collision rules
|
|
142
|
-
* against the shared global pool. Returns `undefined` when nothing is
|
|
143
|
-
* visible so the prompt catalog and dispatch can cheaply skip skills.
|
|
144
|
-
*/
|
|
145
106
|
private resolveAgentSkills;
|
|
146
107
|
private resolveAdapter;
|
|
147
108
|
/**
|
|
@@ -237,25 +198,6 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
237
198
|
* a dropped no-op instead of a runtime crash.
|
|
238
199
|
*/
|
|
239
200
|
private _runAgentNonStreaming;
|
|
240
|
-
/**
|
|
241
|
-
* Dispatch a single tool call from either the top-level adapter or a
|
|
242
|
-
* sub-agent. Centralising this in one method is what makes the budget
|
|
243
|
-
* counter, approval gate, and abort signal observe sub-agent activity:
|
|
244
|
-
* `runSubAgent` reuses the same `runState` and so increments the same
|
|
245
|
-
* counter and emits approval events through the same channel.
|
|
246
|
-
*
|
|
247
|
-
* `depth` is the current sub-agent recursion depth (0 at the top level).
|
|
248
|
-
* It is forwarded to `runSubAgent` when the dispatched entry is itself a
|
|
249
|
-
* sub-agent, so depth limits remain enforced.
|
|
250
|
-
*/
|
|
251
|
-
private dispatchToolCall;
|
|
252
|
-
/**
|
|
253
|
-
* Executes the built-in `load_skill` / `read_skill_file` tools against the
|
|
254
|
-
* agent's resolved skill catalog. `load_skill` returns a skill's body plus a
|
|
255
|
-
* manifest of bundled files; `read_skill_file` returns the contents of one
|
|
256
|
-
* of those files (bundle skills only in v1 — catalog-volume resource reads
|
|
257
|
-
* arrive with the volume source).
|
|
258
|
-
*/
|
|
259
201
|
private dispatchSkillTool;
|
|
260
202
|
/**
|
|
261
203
|
* Renders the prompt addendum for a force-loaded skill (`/skill-name`).
|
|
@@ -264,21 +206,8 @@ declare class AgentsPlugin extends Plugin implements ToolProvider {
|
|
|
264
206
|
* model proceeds with the catalog + `load_skill` still available.
|
|
265
207
|
*/
|
|
266
208
|
private renderForcedSkill;
|
|
267
|
-
/**
|
|
268
|
-
|
|
269
|
-
* concatenated text output to hand back to the parent adapter as the tool
|
|
270
|
-
* result.
|
|
271
|
-
*
|
|
272
|
-
* `depth` starts at 1 for a top-level sub-agent invocation (i.e. the
|
|
273
|
-
* outer `_streamAgent` calls `runSubAgent(..., 1)`) and increments on
|
|
274
|
-
* each nested `runSubAgent` call. Depths exceeding
|
|
275
|
-
* `limits.maxSubAgentDepth` are rejected before any adapter work.
|
|
276
|
-
*
|
|
277
|
-
* Sub-agent tool calls run through `dispatchToolCall` with the same
|
|
278
|
-
* `runState` as the parent — the budget counter and approval gate are
|
|
279
|
-
* therefore enforced for every nested call, not only at the top level.
|
|
280
|
-
*/
|
|
281
|
-
private runSubAgent;
|
|
209
|
+
/** Collaborators the tool-dispatch path needs, bound to this instance. */
|
|
210
|
+
private toolDispatchDeps;
|
|
282
211
|
private _handleCancel;
|
|
283
212
|
private _handleApprove;
|
|
284
213
|
private _handleListThreads;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","names":[],"sources":["../../../src/plugins/agents/agents.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","names":[],"sources":["../../../src/plugins/agents/agents.ts"],"mappings":";;;;;;;;;;cAqGa,YAAA,SAAqB,MAAA,YAAkB,YAAA;EAAA,OAC3C,QAAA,EADiB,cAAA;EAAA,OAEjB,KAAA,EAAO,WAAA;EAAA,UAEI,MAAA,EAAQ,kBAAA;EAAA,QAElB,MAAA;EAAA,QACA,gBAAA;;AAPV;;;UAYU,OAAA;EAAA,QACA,SAAA;EAAA,QACA,WAAA;EAAA,QACA,YAAA;EAqFG;EAAA,QAnFH,0BAAA;EAwvBS;EAAA,QAtvBT,6BAAA;cAEI,MAAA,EAAQ,kBAAA;EAg0BJ;;;;;;;;;;EAr1B8C;;;;;EAAA,QAyDtD,YAAA;EAAA,QAEA,oBAAA;EAAA,YAKI,sBAAA,CAAA;EA5DM;EAAA,YAsEN,cAAA,CAAA;EApEJ;EAAA,QA8EA,gBAAA;EAAA,QAIA,WAAA;EAAA,QAQA,aAAA;EAIF,KAAA,CAAA,GAAK,OAAA;EArFH;;;;;;EAoGF,MAAA,CAAA,GAAU,OAAA;EAxDR;;;;;EAAA,QAkFM,kBAAA;EAzCR;;;;;EAAA,QAsJE,mBAAA;EAiBA;;;;EAAA,QAAA,uBAAA;EAuFA;;;;EAAA,QAxEA,0BAAA;EAAA,QAUA,iBAAA;EAAA,QAIA,cAAA;EAAA,QAOM,mBAAA;EAiTN;;;;;;EAAA,QA9PA,mBAAA;EAAA,QAmBM,oBAAA;EAoaN;EAAA,QA1YA,gBAAA;EAoZa;;;;;;EAAA,QA1Yb,oBAAA;EAwpBM;EAAA,QAnpBN,gBAAA;EAAA,QAIM,kBAAA;EAAA,QAgBA,cAAA;EA0hCN;;;;;EAAA,QA9+BM,cAAA;EA4lCN;;;;;;;;;;;EAAA,QA19BA,eAAA;;;;;;;;;;;;;UA4BA,eAAA;EAAA,QAkBM,gBAAA;EAAA,QA0DA,kBAAA;EAiEd,aAAA,CAAA,GAAiB,mBAAA;EAIX,gBAAA,CAAA,GAAoB,OAAA;EAq4BT;;;;;;EAAA,QAz3BT,iBAAA;EAUR,YAAA,CAAa,MAAA,EAAQ,UAAA;EAkDrB,YAAA,CAAA,GAAgB,MAAA;EAAA,QAeF,WAAA;;;;;;;;;;;;UA2FN,gCAAA;;;;;;;;;;;UAuBM,aAAA;EAAA,QA2FA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;UAsOA,qBAAA;EAAA,QAgKN,iBAAA;;;;;;;UAaA,iBAAA;;UAQA,gBAAA;EAAA,QAYM,aAAA;EAAA,QA2BA,cAAA;EAAA,QAuCA,kBAAA;EAAA,QASA,gBAAA;EAAA,QAUA,mBAAA;EAAA,QAaN,YAAA;EAAA,QASA,aAAA;EAgBF,QAAA,CAAA,GAAY,OAAA;EAQlB,OAAA,CAAA;6BAE2B,GAAA,EAAO,eAAA,KAAe,OAAA;;2BAG3B,eAAA;;;oCAGS,OAAA,CAAA,MAAA;EAAA;EAAA,QAIjB,iBAAA;AAAA;;;;;;;;;;;;;;;;;;cA2CH,MAAA,EAAM,QAAA,QAAA,YAAA,EAAA,kBAAA"}
|