@dsh-cc/tools 0.5.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.
Files changed (121) hide show
  1. package/LICENSE +201 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +209 -0
  4. package/README.zh.md +200 -0
  5. package/lib/abort-utils.d.ts +80 -0
  6. package/lib/abort-utils.d.ts.map +1 -0
  7. package/lib/abort-utils.js +186 -0
  8. package/lib/abort-utils.js.map +1 -0
  9. package/lib/cc-names.d.ts +100 -0
  10. package/lib/cc-names.d.ts.map +1 -0
  11. package/lib/cc-names.js +197 -0
  12. package/lib/cc-names.js.map +1 -0
  13. package/lib/code-mode.d.ts +46 -0
  14. package/lib/code-mode.d.ts.map +1 -0
  15. package/lib/code-mode.js +380 -0
  16. package/lib/code-mode.js.map +1 -0
  17. package/lib/define-tool.d.ts +103 -0
  18. package/lib/define-tool.d.ts.map +1 -0
  19. package/lib/define-tool.js +354 -0
  20. package/lib/define-tool.js.map +1 -0
  21. package/lib/index.d.ts +348 -0
  22. package/lib/index.d.ts.map +1 -0
  23. package/lib/index.js +289 -0
  24. package/lib/index.js.map +1 -0
  25. package/lib/invariant.d.ts +13 -0
  26. package/lib/invariant.d.ts.map +1 -0
  27. package/lib/invariant.js +123 -0
  28. package/lib/invariant.js.map +1 -0
  29. package/lib/json-render.d.ts +18 -0
  30. package/lib/json-render.d.ts.map +1 -0
  31. package/lib/json-render.js +111 -0
  32. package/lib/json-render.js.map +1 -0
  33. package/lib/json-schema-value.d.ts +18 -0
  34. package/lib/json-schema-value.d.ts.map +1 -0
  35. package/lib/json-schema-value.js +238 -0
  36. package/lib/json-schema-value.js.map +1 -0
  37. package/lib/json-schema.d.ts +101 -0
  38. package/lib/json-schema.d.ts.map +1 -0
  39. package/lib/json-schema.js +351 -0
  40. package/lib/json-schema.js.map +1 -0
  41. package/lib/presentation.d.ts +367 -0
  42. package/lib/presentation.d.ts.map +1 -0
  43. package/lib/presentation.js +8 -0
  44. package/lib/presentation.js.map +1 -0
  45. package/lib/py-names.d.ts +163 -0
  46. package/lib/py-names.d.ts.map +1 -0
  47. package/lib/py-names.js +236 -0
  48. package/lib/py-names.js.map +1 -0
  49. package/lib/py-render.d.ts +23 -0
  50. package/lib/py-render.d.ts.map +1 -0
  51. package/lib/py-render.js +434 -0
  52. package/lib/py-render.js.map +1 -0
  53. package/lib/py-sdk-doc.d.ts +29 -0
  54. package/lib/py-sdk-doc.d.ts.map +1 -0
  55. package/lib/py-sdk-doc.js +114 -0
  56. package/lib/py-sdk-doc.js.map +1 -0
  57. package/lib/py-types.d.ts +34 -0
  58. package/lib/py-types.d.ts.map +1 -0
  59. package/lib/py-types.js +40 -0
  60. package/lib/py-types.js.map +1 -0
  61. package/lib/run-code-defs.d.ts +77 -0
  62. package/lib/run-code-defs.d.ts.map +1 -0
  63. package/lib/run-code-defs.js +98 -0
  64. package/lib/run-code-defs.js.map +1 -0
  65. package/lib/runtime-code.d.ts +65 -0
  66. package/lib/runtime-code.d.ts.map +1 -0
  67. package/lib/runtime-code.js +129 -0
  68. package/lib/runtime-code.js.map +1 -0
  69. package/lib/runtime-core.d.ts +130 -0
  70. package/lib/runtime-core.d.ts.map +1 -0
  71. package/lib/runtime-core.js +33 -0
  72. package/lib/runtime-core.js.map +1 -0
  73. package/lib/runtime-execute.d.ts +82 -0
  74. package/lib/runtime-execute.d.ts.map +1 -0
  75. package/lib/runtime-execute.js +333 -0
  76. package/lib/runtime-execute.js.map +1 -0
  77. package/lib/runtime-registry.d.ts +131 -0
  78. package/lib/runtime-registry.d.ts.map +1 -0
  79. package/lib/runtime-registry.js +269 -0
  80. package/lib/runtime-registry.js.map +1 -0
  81. package/lib/runtime-results.d.ts +32 -0
  82. package/lib/runtime-results.d.ts.map +1 -0
  83. package/lib/runtime-results.js +163 -0
  84. package/lib/runtime-results.js.map +1 -0
  85. package/lib/runtime-schemas.d.ts +112 -0
  86. package/lib/runtime-schemas.d.ts.map +1 -0
  87. package/lib/runtime-schemas.js +222 -0
  88. package/lib/runtime-schemas.js.map +1 -0
  89. package/lib/scheduler.d.ts +22 -0
  90. package/lib/scheduler.d.ts.map +1 -0
  91. package/lib/scheduler.js +21 -0
  92. package/lib/scheduler.js.map +1 -0
  93. package/lib/schema-spec.d.ts +154 -0
  94. package/lib/schema-spec.d.ts.map +1 -0
  95. package/lib/schema-spec.js +9 -0
  96. package/lib/schema-spec.js.map +1 -0
  97. package/lib/schema.d.ts +5 -0
  98. package/lib/schema.d.ts.map +1 -0
  99. package/lib/schema.js +3 -0
  100. package/lib/schema.js.map +1 -0
  101. package/lib/testing.d.ts +25 -0
  102. package/lib/testing.d.ts.map +1 -0
  103. package/lib/testing.js +25 -0
  104. package/lib/testing.js.map +1 -0
  105. package/lib/tool-layer.d.ts +49 -0
  106. package/lib/tool-layer.d.ts.map +1 -0
  107. package/lib/tool-layer.js +57 -0
  108. package/lib/tool-layer.js.map +1 -0
  109. package/lib/tool-types.d.ts +385 -0
  110. package/lib/tool-types.d.ts.map +1 -0
  111. package/lib/tool-types.js +11 -0
  112. package/lib/tool-types.js.map +1 -0
  113. package/lib/ts-types.d.ts +37 -0
  114. package/lib/ts-types.d.ts.map +1 -0
  115. package/lib/ts-types.js +265 -0
  116. package/lib/ts-types.js.map +1 -0
  117. package/lib/types.d.ts +55 -0
  118. package/lib/types.d.ts.map +1 -0
  119. package/lib/types.js +7 -0
  120. package/lib/types.js.map +1 -0
  121. package/package.json +65 -0
@@ -0,0 +1,269 @@
1
+ /**
2
+ * ToolRuntime registry collaborators: registration, reservation, admission,
3
+ * restriction, guards, and per-scope view resolution. Every function takes
4
+ * the owning runtime as its `rt: ToolRuntimeCore` first parameter; bodies are
5
+ * verbatim moves from the former `ToolRuntime` methods with `this.` → `rt.`.
6
+ * @module
7
+ */
8
+ import { scopeOf } from '@deepseek-ai/dsh-scope';
9
+ import { assertSupportedJsonSchema } from "./json-schema.js";
10
+ import { RUN_CODE_NAME } from "./code-mode.js";
11
+ /**
12
+ * Register globally or in the calling agent scope. Scoped tools shadow
13
+ * globals; duplicates within one layer and the reserved `run_code` name fail.
14
+ * @param rt - the owning runtime.
15
+ * @param definition - tool schema, execution, and optional finalization/presentation callbacks.
16
+ * @returns the exact disposer that unregisters the tool.
17
+ */
18
+ export function register(rt, definition) {
19
+ const name = definition.name;
20
+ const output = definition.output;
21
+ if (output === undefined || typeof output !== 'object'
22
+ || typeof output.render !== 'function'
23
+ || (output.presentationMeta !== undefined && typeof output.presentationMeta !== 'function')) {
24
+ throw new TypeError(`tool "${name}" must declare output { schema, render, presentationMeta? }`);
25
+ }
26
+ assertSupportedJsonSchema(output.schema);
27
+ const timeoutMs = definition.timeoutMs;
28
+ if (timeoutMs !== undefined
29
+ && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
30
+ throw new TypeError(`tool "${name}" timeoutMs must be a positive finite number`);
31
+ }
32
+ // Reserved unconditionally: any agent may select a code mode for itself,
33
+ // so a name free to take under the deployment default would become a
34
+ // collision the moment a preset mounted.
35
+ if (name === RUN_CODE_NAME) {
36
+ throw new Error(`tool name "${RUN_CODE_NAME}" is reserved for the Code Mode presentation transport and cannot be registered or shadowed`);
37
+ }
38
+ return rt.layers.effect(rt.ctx, layer => layer.tools.insert(name, definition), { label: 'tools.register()' });
39
+ }
40
+ /**
41
+ * Reserve a capability NAME in the calling layer without registering a
42
+ * visible definition. A reserved name joins the known/restrictable universe
43
+ * — a scope may later `restrict()` it away, and `toolOrder` may list it — but
44
+ * it never reaches the model-facing schema until a real `register()` supplies
45
+ * the definition. This is how a deferred-tool registry seeds the names a
46
+ * composition may gate before their heavy definitions load.
47
+ *
48
+ * The name stays out of the runtime's `get` and `schemas` views (only
49
+ * registered definitions are visible). Duplicate reservations within one
50
+ * layer fail, matching the duplicate-name rule for `register`.
51
+ * @param rt - the owning runtime.
52
+ * @param name - the capability name to make known without presenting.
53
+ * @returns the exact disposer that clears the reservation.
54
+ */
55
+ export function reserve(rt, name) {
56
+ if (name === RUN_CODE_NAME) {
57
+ throw new Error(`tool name "${RUN_CODE_NAME}" is reserved for the Code Mode presentation transport and cannot be registered or shadowed`);
58
+ }
59
+ return rt.layers.effect(rt.ctx, layer => layer.reserved.insert(name, undefined), { label: 'tools.reserve()' });
60
+ }
61
+ /**
62
+ * Whether a global tool name passes every scoped restriction on the viewing
63
+ * scope's chain. The answer ignores registration: a reserved or not-yet-loaded
64
+ * name is admitted if no `allow`/`deny` on the chain masks it, so a caller can
65
+ * gate whether a deferred capability may load for one agent. A name masked by
66
+ * an `allow` list it is absent from, or present in a `deny` list, is not
67
+ * admitted. When a name has multiple restrictions, they intersect (all must
68
+ * admit it), matching registration visibility.
69
+ * @param rt - the owning runtime.
70
+ * @param name - the capability name to test.
71
+ * @param scope - the viewing scope (the agent); omitted for the global view, which has no restrictions.
72
+ * @returns whether the name may load for that scope.
73
+ */
74
+ export function isAdmitted(rt, name, scope) {
75
+ return rt.layers.chainLayers(scope).every(layer => layer.admits(name));
76
+ }
77
+ /**
78
+ * Restrict global tools for the calling agent scope. Empty filters, unknown
79
+ * names, scope-local names, and reserved transport names fail. Restrictions
80
+ * intersect; scoped registrations remain visible.
81
+ * @param rt - the owning runtime.
82
+ * @param filter - global-tool mask: `allow` (keep only) and/or `deny` (remove).
83
+ * @returns the exact disposer that lifts this restriction.
84
+ */
85
+ export function restrict(rt, filter) {
86
+ const scope = scopeOf(rt.ctx);
87
+ if (scope === undefined) {
88
+ throw new Error('tools.restrict() requires a scoped context (agent.ctx): a context-global restriction would mask every agent — deny the tool for the intended agent instead');
89
+ }
90
+ const allow = filter.allow;
91
+ const deny = filter.deny;
92
+ if (allow === undefined && deny === undefined) {
93
+ throw new Error('tools.restrict({}) is a no-op: pass `allow` and/or `deny` (an empty filter is almost always a materialized-empty-config bug)');
94
+ }
95
+ const compiled = {
96
+ ...allow !== undefined ? { allow: new Set(allow) } : {},
97
+ ...deny !== undefined ? { deny: new Set(deny) } : {},
98
+ };
99
+ if ([...allow ?? [], ...deny ?? []].includes(RUN_CODE_NAME)) {
100
+ throw new Error(`tools.restrict() cannot name reserved Code Mode presentation transport "${RUN_CODE_NAME}"; restrict end-capability tools instead`);
101
+ }
102
+ const known = rt.view(scope).restrictableNames;
103
+ const unknown = [...allow ?? [], ...deny ?? []].filter(name => !known.has(name));
104
+ if (unknown.length > 0) {
105
+ throw new Error(`tools.restrict() names unknown global tool${unknown.length > 1 ? 's' : ''} ${unknown.map(n => `"${n}"`).join(', ')}; known global tools: ${[...known].sort().join(', ') || '(none)'}`);
106
+ }
107
+ return rt.layers.effect(rt.ctx, layer => layer.restrictions.append(compiled), { label: 'tools.restrict()' });
108
+ }
109
+ /**
110
+ * Register a monotonic guard after the extensible `tools/pre-execute`
111
+ * waterfall. A plain-context guard applies globally; one registered through
112
+ * `agent.ctx` applies only to that agent. Any matching guard may deny by
113
+ * returning a reason, while no guard can force-allow a call another guard
114
+ * denied. The exact effect disposer is returned for ordered ownership and
115
+ * HMR cleanup.
116
+ * @param rt - the owning runtime.
117
+ * @param guard - synchronous check; a returned string denies the execution.
118
+ * @returns the exact disposer that unregisters the guard.
119
+ */
120
+ export function guard(rt, guard) {
121
+ return rt.layers.effect(rt.ctx, layer => layer.guards.append(guard), { label: 'tools.guard()', notify: false });
122
+ }
123
+ /** First monotonic denial from the global then the scope chain's guard layers, farthest first. */
124
+ export function guardReason(rt, exec) {
125
+ const globalReason = rt.layers.global.guardReason(exec);
126
+ if (globalReason !== undefined)
127
+ return globalReason;
128
+ if (exec.agent === undefined)
129
+ return undefined;
130
+ for (const layer of rt.layers.chainLayers(exec.agent)) {
131
+ const reason = layer.guardReason(exec);
132
+ if (reason !== undefined)
133
+ return reason;
134
+ }
135
+ return undefined;
136
+ }
137
+ /**
138
+ * Resolve every registry fact one scope needs in one layer traversal. The
139
+ * visible map applies restrictions to the INHERITED surface, then the
140
+ * scope's own registrations and the reserved presentation transport; the
141
+ * other sets retain the pre-restriction facts needed by restriction and
142
+ * prompt-order validation.
143
+ *
144
+ * A restriction filters what a scope inherits — the global layer and every
145
+ * ancestor layer on its chain — and never what its OWN layer registers.
146
+ * That exemption is what a per-child capability filter has to keep intact:
147
+ * the delegation runtime registers a child's reporting and structured-output
148
+ * tools into the child's own layer, and a filter naming the capabilities the
149
+ * child may use must not strip the machinery it answers through.
150
+ *
151
+ * Reading the exempt set as "the global layer" instead of "not mine" held
152
+ * only while every model-facing tool sat in the host composition. Once
153
+ * presets moved them onto the agent plane they became an ANCESTOR
154
+ * contribution, so a child's filter silently stopped constraining anything
155
+ * it was given.
156
+ * @param rt - the owning runtime.
157
+ * @param scope - the viewing scope (the agent), or undefined for the global view.
158
+ * @returns the complete derived view for that scope.
159
+ */
160
+ export function view(rt, scope) {
161
+ // Scope-chain layers, farthest ancestor first, the exact scope last.
162
+ const layers = rt.layers.chainLayers(scope);
163
+ // Chain-blind on purpose: this is the ONE layer whose registrations the
164
+ // scope owns rather than inherits, and it is absent until the scope
165
+ // contributes something.
166
+ const own = rt.layers.peek(scope);
167
+ // Inherited surface, nearest ancestor last: a nearer scope's same-name
168
+ // entry shadows a farther one, and the global layer is the farthest.
169
+ const inherited = new Map(rt.layers.global.tools.entries());
170
+ for (const layer of layers) {
171
+ if (layer === own)
172
+ continue;
173
+ for (const [name, definition] of layer.tools.entries())
174
+ inherited.set(name, definition);
175
+ }
176
+ const visible = new Map();
177
+ const knownNames = new Set();
178
+ const restrictableNames = new Set();
179
+ for (const [name, definition] of inherited) {
180
+ knownNames.add(name);
181
+ restrictableNames.add(name);
182
+ // Restrictions intersect across the whole chain: any scope on it may
183
+ // mask an inherited name for everything nested inside it.
184
+ if (layers.every(layer => layer.admits(name)))
185
+ visible.set(name, definition);
186
+ }
187
+ // The scope's own registrations last, shadowing an inherited name and
188
+ // outside the filter above.
189
+ if (own !== undefined) {
190
+ for (const [name, definition] of own.tools.entries()) {
191
+ knownNames.add(name);
192
+ visible.set(name, definition);
193
+ }
194
+ }
195
+ // Reserved names are known and restrictable but never visible: they enter
196
+ // the inherited universe (so a scope may gate them before load) without a
197
+ // definition to present. Chain + global, same inheritance shape as tools.
198
+ for (const { reserved } of [rt.layers.global, ...layers]) {
199
+ for (const name of reserved.keys()) {
200
+ knownNames.add(name);
201
+ restrictableNames.add(name);
202
+ }
203
+ }
204
+ // Presentation infrastructure is resolved last and outside capability
205
+ // filtering. Registration rejects this reserved name, so the insertion is
206
+ // an invariant assertion as well as protection against future layer
207
+ // changes. Per scope: a native agent must not find `run_code` in its
208
+ // dispatch table because some other agent in the process presents it.
209
+ if (rt.modeFor(scope) !== 'native') {
210
+ visible.set(RUN_CODE_NAME, rt.requireCodeTransport());
211
+ }
212
+ return { visible, knownNames, restrictableNames };
213
+ }
214
+ /**
215
+ * Look up a tool as one scope sees it (scoped
216
+ * shadows global; a restricted-away global reads as absent). Presenters pass
217
+ * the calling agent so the rendered card matches the definition that
218
+ * actually executed.
219
+ * @param rt - the owning runtime.
220
+ * @param name - the tool name as registered.
221
+ * @param scope - the viewing scope (the agent); omitted = the global view.
222
+ * @returns the definition the scope resolves, or undefined when none is visible.
223
+ */
224
+ export function get(rt, name, scope) {
225
+ return rt.view(scope).visible.get(name);
226
+ }
227
+ /**
228
+ * Resolve the definition that MAY EXECUTE for a call, applying the mode
229
+ * collapse at the operation boundary that owns it. The registry view
230
+ * (`get`) is presentation-agnostic; here a MODEL-DIRECT call under `code`
231
+ * may only name the reserved `run_code` transport, while a nested
232
+ * sub-dispatch (a `parent` token set — the `run_code` SDK calling a tool
233
+ * it bound) may call any visible tool. Denial surfaces as `UNKNOWN_TOOL`
234
+ * through the executor, matching an absent definition.
235
+ * @param rt - the owning runtime.
236
+ * @param name - the tool name as registered.
237
+ * @param scope - the viewing scope (the agent); omitted = the global view.
238
+ * @param nested - whether the call is a transport sub-dispatch, not a model-direct call.
239
+ * @returns the definition that may run, or undefined when the call must be rejected.
240
+ */
241
+ export function resolveExecution(rt, name, scope, nested) {
242
+ const tool = rt.get(name, scope);
243
+ if (tool === undefined)
244
+ return undefined;
245
+ if (rt.collapses(name, scope, nested))
246
+ return undefined;
247
+ return tool;
248
+ }
249
+ /**
250
+ * Classify a pending call through the caller's visible tool definition. Only
251
+ * an exact `true` is parallel; unknown, hidden, undeclared, invalid, or
252
+ * throwing classifiers are exclusive.
253
+ * @param rt - the owning runtime.
254
+ * @param exec - call name, parsed arguments, and optional agent scope.
255
+ * @returns the fail-closed scheduling mode.
256
+ */
257
+ export function executionMode(rt, exec) {
258
+ const tool = rt.resolveExecution(exec.name, exec.agent, exec.parent !== undefined);
259
+ if (!tool?.isConcurrencySafe)
260
+ return { kind: 'exclusive' };
261
+ try {
262
+ const concurrencySafe = tool.isConcurrencySafe(exec.arguments);
263
+ return concurrencySafe === true ? { kind: 'parallel' } : { kind: 'exclusive' };
264
+ }
265
+ catch {
266
+ return { kind: 'exclusive' };
267
+ }
268
+ }
269
+ //# sourceMappingURL=runtime-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAmB,EAAE,UAA0B;IACtE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;IAC5B,MAAM,MAAM,GAAI,UAAsC,CAAC,MAAM,CAAA;IAC7D,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ;WACjD,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU;WACnC,CAAC,MAAM,CAAC,gBAAgB,KAAK,SAAS,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,CAAC,EAAE,CAAC;QAC9F,MAAM,IAAI,SAAS,CAA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IAAI,EAAE,WAAW,EAAE,CAAA;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ToolRuntime result collaborators: post-execute policy, canonical-result
3
+ * marking, success/normalization projection, content finalization, and final
4
+ * notification. Bodies are verbatim moves from the former `ToolRuntime`
5
+ * methods with `this.` → `rt.`.
6
+ * @module
7
+ */
8
+ import type { ToolDefinition, ToolExecution, ToolExecutionResult, ToolExecutionSuccess } from './tool-types.ts';
9
+ import type { ToolRuntimeCore } from './runtime-core.ts';
10
+ /** Notify observers without exposing a mutation or error channel into the outcome. */
11
+ export declare function notifyResult(rt: ToolRuntimeCore, exec: ToolExecution, result: ToolExecutionResult): void;
12
+ /**
13
+ * Run the `tools/post-execute` waterfall over a dispatched `result` and apply
14
+ * its `PostToolDecision`: `accept` keeps the call successful (replacing
15
+ * `content` when given), `block` turns it into an `isError` whose content is
16
+ * the corrective `feedback`. Either decision may attach `additionalContexts`,
17
+ * which are ferried on the returned result for the loop's active-batch FIFO.
18
+ * Context deferred by the tool body survives an accepted result but is
19
+ * discarded when the outer call is blocked; a block exposes only context the
20
+ * blocking decision explicitly supplied.
21
+ * Runs inside `execute`'s outer try/catch (a throwing listener → isError).
22
+ */
23
+ export declare function postExecute(rt: ToolRuntimeCore, exec: ToolExecution, result: ToolExecutionResult): Promise<ToolExecutionResult>;
24
+ /** Mark one registry-normalized result as canonical only for its owning dispatch. */
25
+ export declare function markCanonical<T extends ToolExecutionResult>(rt: ToolRuntimeCore, exec: ToolExecution, result: T): T;
26
+ /** Snapshot, validate, render, and optionally project one successful body value. */
27
+ export declare function createSuccessResult(rt: ToolRuntimeCore, exec: ToolExecution, tool: ToolDefinition, candidate: unknown): ToolExecutionSuccess;
28
+ /** Normalize an around-dispatch wrapper's authored result through the owning output contract. */
29
+ export declare function normalizeDispatchResult(rt: ToolRuntimeCore, exec: ToolExecution, result: ToolExecutionResult): ToolExecutionResult;
30
+ /** Materialize the authoritative commit outcome once, immediately before `tools/result`. */
31
+ export declare function materializeFinalResult(_rt: ToolRuntimeCore, result: ToolExecutionResult): ToolExecutionResult;
32
+ //# sourceMappingURL=runtime-results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-results.d.ts","sourceRoot":"","sources":["../src/runtime-results.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAoB,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACjI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAmBxG;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuCrI;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,CAAC,SAAS,mBAAmB,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAGnH;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,oBAAoB,CA8B5I;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAkBlI;AAED,4FAA4F;AAC5F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAe7G"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * ToolRuntime result collaborators: post-execute policy, canonical-result
3
+ * marking, success/normalization projection, content finalization, and final
4
+ * notification. Bodies are verbatim moves from the former `ToolRuntime`
5
+ * methods with `this.` → `rt.`.
6
+ * @module
7
+ */
8
+ import { scopeTarget } from '@deepseek-ai/dsh-scope';
9
+ import { deepFreeze } from '@deepseek-ai/dsh-llm';
10
+ import { errorMessage, failureMessageFromContent, projectionError, snapshotProjection, snapshotToolValue, ToolNotFoundError, ToolOutputError } from "./abort-utils.js";
11
+ import { validateJsonSchemaValue } from "./json-schema.js";
12
+ import { materializePresentation } from "./tool-types.js";
13
+ /** Notify observers without exposing a mutation or error channel into the outcome. */
14
+ export function notifyResult(rt, exec, result) {
15
+ // Freeze the registry's live object before observers receive its readonly
16
+ // WeakMap-keyable view.
17
+ Object.freeze(exec);
18
+ const { name: toolName, callId } = exec;
19
+ const reportFailure = (error) => {
20
+ rt.ctx.logger.warn(`tool "${toolName}" (${callId}): tools/result observer failed: ${errorMessage(error)}`);
21
+ };
22
+ const callbacks = rt.ctx.events.dispatch('emit', [
23
+ scopeTarget(rt, exec.agent), 'tools/result', exec, result,
24
+ ]);
25
+ for (const callback of callbacks) {
26
+ try {
27
+ const returned = callback(exec, result);
28
+ void Promise.resolve(returned).catch(reportFailure);
29
+ }
30
+ catch (error) {
31
+ reportFailure(error);
32
+ }
33
+ }
34
+ }
35
+ /**
36
+ * Run the `tools/post-execute` waterfall over a dispatched `result` and apply
37
+ * its `PostToolDecision`: `accept` keeps the call successful (replacing
38
+ * `content` when given), `block` turns it into an `isError` whose content is
39
+ * the corrective `feedback`. Either decision may attach `additionalContexts`,
40
+ * which are ferried on the returned result for the loop's active-batch FIFO.
41
+ * Context deferred by the tool body survives an accepted result but is
42
+ * discarded when the outer call is blocked; a block exposes only context the
43
+ * blocking decision explicitly supplied.
44
+ * Runs inside `execute`'s outer try/catch (a throwing listener → isError).
45
+ */
46
+ export async function postExecute(rt, exec, result) {
47
+ const decision = await rt.ctx.waterfall(scopeTarget(rt, exec.agent), 'tools/post-execute', exec, result, () => Promise.resolve({ kind: 'accept' }));
48
+ const decisionContexts = decision.additionalContexts ?? [];
49
+ if (decision.kind === 'block') {
50
+ const message = failureMessageFromContent(decision.feedback);
51
+ return rt.markCanonical(exec, {
52
+ content: decision.feedback,
53
+ isError: true,
54
+ error: { message },
55
+ ...decisionContexts.length > 0 ? { additionalContexts: decisionContexts } : {},
56
+ });
57
+ }
58
+ if (Object.hasOwn(decision, 'content') && Object.hasOwn(decision, 'value')) {
59
+ throw new TypeError('tools/post-execute accept decision cannot replace both value and content');
60
+ }
61
+ const additionalContexts = [
62
+ ...result.additionalContexts ?? [],
63
+ ...decisionContexts,
64
+ ];
65
+ if (Object.hasOwn(decision, 'value')) {
66
+ if (result.isError) {
67
+ throw new TypeError('tools/post-execute cannot replace the value of a failed result');
68
+ }
69
+ const tool = rt.resolveExecution(exec.name, exec.agent, exec.parent !== undefined);
70
+ if (tool === undefined)
71
+ throw new ToolNotFoundError(exec.name);
72
+ const replaced = rt.createSuccessResult(exec, tool, decision.value);
73
+ return rt.markCanonical(exec, {
74
+ ...replaced,
75
+ ...additionalContexts.length > 0 ? { additionalContexts } : {},
76
+ });
77
+ }
78
+ return rt.markCanonical(exec, {
79
+ ...result,
80
+ ...decision.content !== undefined ? { content: decision.content } : {},
81
+ ...additionalContexts.length > 0 ? { additionalContexts } : {},
82
+ });
83
+ }
84
+ /** Mark one registry-normalized result as canonical only for its owning dispatch. */
85
+ export function markCanonical(rt, exec, result) {
86
+ rt.canonicalResults.set(result, exec.token);
87
+ return result;
88
+ }
89
+ /** Snapshot, validate, render, and optionally project one successful body value. */
90
+ export function createSuccessResult(rt, exec, tool, candidate) {
91
+ const detached = snapshotToolValue(tool.name, candidate);
92
+ const violations = validateJsonSchemaValue(tool.output.schema, detached, 'value');
93
+ if (violations.length > 0)
94
+ throw new ToolOutputError(tool.name, violations);
95
+ const value = deepFreeze(detached);
96
+ let rendered;
97
+ try {
98
+ rendered = tool.output.render(exec.arguments, value);
99
+ }
100
+ catch (error) {
101
+ throw projectionError(tool.name, 'render', error);
102
+ }
103
+ const content = snapshotProjection(tool.name, 'render', rendered);
104
+ let meta;
105
+ if (exec.parent === undefined && tool.output.presentationMeta !== undefined) {
106
+ let projected;
107
+ try {
108
+ projected = tool.output.presentationMeta(exec.arguments, value);
109
+ }
110
+ catch (error) {
111
+ throw projectionError(tool.name, 'presentationMeta', error);
112
+ }
113
+ meta = snapshotProjection(tool.name, 'presentationMeta', projected);
114
+ }
115
+ const concludesTurn = rt.concludingExecutions.has(exec);
116
+ return rt.markCanonical(exec, rt.materializeFinalResult({
117
+ isError: false,
118
+ value,
119
+ content,
120
+ ...meta !== undefined ? { meta } : {},
121
+ ...concludesTurn ? { concludesTurn: true } : {},
122
+ }));
123
+ }
124
+ /** Normalize an around-dispatch wrapper's authored result through the owning output contract. */
125
+ export function normalizeDispatchResult(rt, exec, result) {
126
+ if (rt.canonicalResults.get(result) === exec.token)
127
+ return result;
128
+ if (result.isError) {
129
+ return rt.markCanonical(exec, {
130
+ isError: true,
131
+ error: result.error,
132
+ content: result.content,
133
+ ...result.meta !== undefined ? { meta: result.meta } : {},
134
+ ...result.additionalContexts !== undefined ? { additionalContexts: result.additionalContexts } : {},
135
+ });
136
+ }
137
+ const tool = rt.resolveExecution(exec.name, exec.agent, exec.parent !== undefined);
138
+ if (tool === undefined)
139
+ throw new ToolNotFoundError(exec.name);
140
+ const normalized = rt.createSuccessResult(exec, tool, result.value);
141
+ return rt.markCanonical(exec, {
142
+ ...normalized,
143
+ ...result.additionalContexts !== undefined ? { additionalContexts: result.additionalContexts } : {},
144
+ });
145
+ }
146
+ /** Materialize the authoritative commit outcome once, immediately before `tools/result`. */
147
+ export function materializeFinalResult(_rt, result) {
148
+ const presentation = {
149
+ content: result.content,
150
+ ...result.meta !== undefined ? { meta: result.meta } : {},
151
+ ...result.additionalContexts !== undefined ? { additionalContexts: result.additionalContexts } : {},
152
+ };
153
+ if (result.isError) {
154
+ return materializePresentation({ isError: true, error: result.error, ...presentation });
155
+ }
156
+ const detached = materializePresentation({
157
+ isError: false,
158
+ ...presentation,
159
+ ...result.concludesTurn === true ? { concludesTurn: true } : {},
160
+ });
161
+ return deepFreeze({ ...detached, value: result.value });
162
+ }
163
+ //# sourceMappingURL=runtime-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-results.js","sourceRoot":"","sources":["../src/runtime-results.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACtK,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAIzD,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,EAAmB,EAAE,IAAmB,EAAE,MAA2B;IAChG,0EAA0E;IAC1E,wBAAwB;IACxB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACnB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACvC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAQ,EAAE;QAC7C,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,QAAQ,MAAM,MAAM,oCAAoC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC5G,CAAC,CAAA;IACD,MAAM,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;QAC/C,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,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D,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,uBAAuB,CAAC,EAAE,OAAO,EAAE,IAAa,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC,CAAA;IAClG,CAAC;IACD,MAAM,QAAQ,GAAG,uBAAuB,CAAC;QACvC,OAAO,EAAE,KAAc;QACvB,GAAG,YAAY;QACf,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE;KACzE,CAAC,CAAA;IACF,OAAO,UAAU,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;AACzD,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * ToolRuntime presentation collaborators: the presentation-mode resolver, the
3
+ * `code` collapse statement, prompt-section assembly, and the model-facing
4
+ * schema projections. Bodies are verbatim moves from the former `ToolRuntime`
5
+ * methods with `this.` → `rt.`.
6
+ * @module
7
+ */
8
+ import type { ScopeKey } from '@deepseek-ai/dsh-scope';
9
+ import type { ToolSchema } from '@deepseek-ai/dsh-llm';
10
+ import type { ToolProviderResult } from '@deepseek-ai/dsh-system-prompt';
11
+ import type { ToolSdkSchema } from './ts-types.ts';
12
+ import type { ToolDefinition, ToolPresentationMode } from './tool-types.ts';
13
+ import type { ToolRuntimeCore } from './runtime-core.ts';
14
+ /**
15
+ * The prompt statement of the `code` executor collapse, registered wherever
16
+ * `sdkSection` is and rendering empty outside an effective `code`.
17
+ *
18
+ * Every tool contributes its own guidance section naming its tool, none of
19
+ * them qualify how that tool is reached, and they all render before the SDK
20
+ * (orders 100-199 against `SDK_SECTION_ORDER`). Without this the model
21
+ * reads a catalog of tools it is told to use and no statement that only
22
+ * `run_code` may be called, so it emits a native call, receives
23
+ * `UNKNOWN_TOOL` for a tool the prompt just declared, and concludes the
24
+ * deployment is inconsistent. `COLLAPSE_SECTION_ORDER` places the rule
25
+ * before that guidance rather than after it.
26
+ *
27
+ * `both` renders empty: native calls do execute there, so the rule is false.
28
+ * @param rt - the owning runtime.
29
+ * @returns the section registration.
30
+ */
31
+ export declare function collapseSection(rt: ToolRuntimeCore): {
32
+ name: string;
33
+ order: number;
34
+ text: (context: {
35
+ scope?: ScopeKey;
36
+ }) => string;
37
+ };
38
+ /**
39
+ * The generated-SDK prompt section, registered globally by a code-mode
40
+ * deployment and per scope by `presentAs`.
41
+ *
42
+ * The body regenerates from the CALLING scope, and renders empty for an
43
+ * agent presenting natively — an agent that opted out under a code-mode
44
+ * deployment still sees the global registration, and an empty section is
45
+ * dropped from the rendered prompt.
46
+ * @param rt - the owning runtime.
47
+ * @returns the section registration.
48
+ */
49
+ export declare function sdkSection(rt: ToolRuntimeCore): {
50
+ name: string;
51
+ order: number;
52
+ text: (context: {
53
+ scope?: ScopeKey;
54
+ }) => string;
55
+ };
56
+ /**
57
+ * The presentation one scope's agent sees: its own declaration, else the
58
+ * deployment default.
59
+ * @param rt - the owning runtime.
60
+ * @param scope - the calling agent, or undefined for the global view.
61
+ * @returns the resolved presentation mode.
62
+ */
63
+ export declare function modeFor(rt: ToolRuntimeCore, scope?: ScopeKey): ToolPresentationMode;
64
+ /**
65
+ * Present the calling scope's tools in `mode` instead of the deployment
66
+ * default. Nearest scope on the chain wins, so a preset's standing
67
+ * declaration covers every agent joined under it.
68
+ *
69
+ * Scoped only, and one declaration per scope: this is how an agent preset
70
+ * composes Code Mode agents beside native ones in the same process, and a
71
+ * process-global override would be the `mode` config field instead.
72
+ * @param rt - the owning runtime.
73
+ * @param mode - the presentation the covered agents' models see.
74
+ * @returns the exact disposer that restores the deployment default.
75
+ */
76
+ export declare function presentAs(rt: ToolRuntimeCore, mode: ToolPresentationMode): () => void;
77
+ /**
78
+ * Build one scope's wire schemas and names for prompt-order validation.
79
+ * Restrictions do not make known tools invalid, but a mode collapse does.
80
+ */
81
+ export declare function wireSchemas(rt: ToolRuntimeCore, scope?: ScopeKey): ToolProviderResult;
82
+ /**
83
+ * Project visible definitions onto the allowlisted model-facing schema fields,
84
+ * excluding execution and presentation callbacks.
85
+ * @param rt - the owning runtime.
86
+ * @param scope - the viewing scope (the agent); omitted = the global view.
87
+ * @returns one deep-cloned schema per visible tool.
88
+ */
89
+ export declare function schemas(rt: ToolRuntimeCore, scope?: ScopeKey): ToolSchema[];
90
+ /** Project visible callable tools onto the generated Code Mode SDK contract. */
91
+ export declare function sdkSchemas(rt: ToolRuntimeCore, scope?: ScopeKey): ToolSdkSchema[];
92
+ /** Project one definition onto the model-facing schema fields. */
93
+ export declare function schemaOf(_rt: ToolRuntimeCore, definition: ToolDefinition, detachParameters: boolean): ToolSchema;
94
+ /**
95
+ * Whether the `code` mode collapse denies a model-direct call: only the
96
+ * reserved `run_code` transport may be named. Nested sub-dispatches (a
97
+ * `parent` token set) bypass the collapse. One home for the
98
+ * security-relevant predicate, shared by `resolveExecution` and
99
+ * `createExecution` so the two can never drift apart.
100
+ *
101
+ * Resolved through `modeFor`, NOT `defaultMode`: an agent given `code`
102
+ * by an agent preset under a native deployment is the composition
103
+ * `dsh-agent-tool-presentation` exists for, and reading the deployment default would
104
+ * leave exactly that agent uncollapsed — announcing one surface while
105
+ * executing another, which is the bypass this collapse closes.
106
+ * @param rt - the owning runtime.
107
+ * @param name - the tool name as registered.
108
+ * @param scope - the viewing scope whose effective presentation mode applies.
109
+ * @param nested - whether the call is a transport sub-dispatch, not a model-direct call.
110
+ */
111
+ export declare function collapses(rt: ToolRuntimeCore, name: string, scope: ScopeKey | undefined, nested: boolean): boolean;
112
+ //# sourceMappingURL=runtime-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-schemas.d.ts","sourceRoot":"","sources":["../src/runtime-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,K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