@jangts/agent-core 0.3.5 → 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 (288) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +33 -31
  3. package/development/docs/README.en.md +2 -2
  4. package/development/docs/acceptance.en.md +2 -2
  5. package/development/docs/agent-development.en.md +1 -1
  6. package/development/docs/api/README.en.md +6 -2
  7. package/development/docs/api/README.md +4 -0
  8. package/development/docs/api/configuration-in-workflow.en.md +403 -0
  9. package/development/docs/api/configuration-in-workflow.md +403 -0
  10. package/development/docs/api/core.en.md +7 -7
  11. package/development/docs/api/core.md +6 -6
  12. package/development/docs/api/decorators.en.md +20 -0
  13. package/development/docs/api/decorators.md +20 -0
  14. package/development/docs/api/examples.en.md +1 -1
  15. package/development/docs/api/examples.md +1 -1
  16. package/development/docs/api/kits.en.md +22 -4
  17. package/development/docs/api/kits.md +22 -4
  18. package/development/docs/api/knowledge-answering.en.md +4 -1
  19. package/development/docs/api/knowledge-answering.md +4 -1
  20. package/development/docs/api/mock.en.md +2 -0
  21. package/development/docs/api/mock.md +2 -0
  22. package/development/docs/api/observability.en.md +37 -11
  23. package/development/docs/api/observability.md +64 -11
  24. package/development/docs/api/reference.en.md +876 -657
  25. package/development/docs/api/reference.md +662 -508
  26. package/development/docs/api/support.en.md +55 -9
  27. package/development/docs/api/support.md +53 -7
  28. package/development/docs/api/types.en.md +36 -1
  29. package/development/docs/api/types.md +44 -0
  30. package/development/docs/api/workflow-views.en.md +64 -0
  31. package/development/docs/api/workflow-views.md +78 -0
  32. package/development/docs/api/workflow.en.md +6 -2
  33. package/development/docs/api/workflow.md +6 -2
  34. package/development/docs/basic-usage.en.md +1 -1
  35. package/development/docs/basic-usage.md +1 -1
  36. package/development/docs/create-app.en.md +1 -1
  37. package/development/docs/examples/registration/associated.mjs +8 -0
  38. package/development/docs/examples/registration/independent.mjs +20 -0
  39. package/development/docs/examples/registration/protocol.mjs +48 -0
  40. package/development/docs/examples/registration/run.mjs +47 -0
  41. package/development/docs/examples/registration/tools.mjs +75 -0
  42. package/development/docs/examples/registration/workflow.mjs +109 -0
  43. package/development/docs/flows/knowledge-maintenance.en.md +1 -1
  44. package/development/docs/materials.en.md +1 -1
  45. package/development/docs/mechanisms.en.md +2 -2
  46. package/development/docs/mechanisms.md +1 -1
  47. package/development/docs/operations.en.md +1 -1
  48. package/development/docs/records.en.md +1 -1
  49. package/development/docs/registration.en.md +4 -4
  50. package/development/docs/registration.md +2 -2
  51. package/development/skills/agent-core-app/SKILL.md +16 -4
  52. package/development/skills/agent-core-app/templates/node-ts/README.md.tpl +1 -1
  53. package/development/skills/agent-core-app/templates/node-ts/src/catalog.ts.tpl +2 -2
  54. package/development/skills/agent-core-app/templates/node-ts/test/app.test.mjs.tpl +1 -1
  55. package/dist/cjs/capabilities/index.js +5 -12
  56. package/dist/cjs/capabilities/invocation.js +21 -1
  57. package/dist/cjs/capabilities/model.js +56 -12
  58. package/dist/cjs/capabilities/tool-conditions.js +65 -0
  59. package/dist/cjs/capabilities/tool-runtime.js +18 -4
  60. package/dist/cjs/capabilities/tools.js +12 -17
  61. package/dist/cjs/context/audit.js +5 -8
  62. package/dist/cjs/context/index.js +3 -4
  63. package/dist/cjs/diagnostics/index.js +51 -3
  64. package/dist/cjs/diagnostics/native-sub-flow.js +106 -0
  65. package/dist/cjs/diagnostics/sub-flow.js +278 -32
  66. package/dist/cjs/execution/engine.js +3 -2
  67. package/dist/cjs/execution/events.js +5 -5
  68. package/dist/cjs/execution/reporting.js +18 -28
  69. package/dist/cjs/execution/workflow-chain.js +211 -0
  70. package/dist/cjs/execution/workflow-graph.js +72 -0
  71. package/dist/cjs/execution/workflow.js +34 -6
  72. package/dist/cjs/index.js +21 -17
  73. package/dist/cjs/kits/aggregation.js +17 -14
  74. package/dist/cjs/kits/answering/checks.js +2 -1
  75. package/dist/cjs/kits/answering/flow.js +24 -21
  76. package/dist/cjs/kits/answering/tasks.js +30 -25
  77. package/dist/cjs/kits/delivery.js +36 -24
  78. package/dist/cjs/kits/domains/catalog.js +113 -0
  79. package/dist/cjs/kits/domains/index.js +20 -0
  80. package/dist/cjs/kits/{intents → domains}/registry.js +77 -31
  81. package/dist/cjs/kits/{intents → domains}/scopes.js +21 -21
  82. package/dist/cjs/kits/index.js +14 -13
  83. package/dist/cjs/kits/knowledge/catalog.js +33 -30
  84. package/dist/cjs/kits/policies.js +3 -2
  85. package/dist/cjs/kits/presentation/formats.js +110 -0
  86. package/dist/cjs/kits/presentation/index.js +10 -5
  87. package/dist/cjs/kits/presentation/outputs.js +2 -1
  88. package/dist/cjs/kits/reflection.js +2 -2
  89. package/dist/cjs/kits/retrieval.js +7 -1
  90. package/dist/cjs/kits/text-blocks.js +101 -0
  91. package/dist/cjs/kits/tools.js +247 -158
  92. package/dist/cjs/model/decision-retry.js +2 -1
  93. package/dist/cjs/model/index.js +2 -6
  94. package/dist/cjs/model/interactions/calls.js +61 -0
  95. package/dist/cjs/model/interactions/json-object.js +11 -11
  96. package/dist/cjs/model/interactions/native-functions.js +17 -23
  97. package/dist/cjs/model/message-diagnostics.js +13 -3
  98. package/dist/cjs/model/options.js +2 -0
  99. package/dist/cjs/model/preparation.js +39 -6
  100. package/dist/cjs/model/runner.js +34 -5
  101. package/dist/cjs/model/selection-transport.js +4 -4
  102. package/dist/cjs/model/token-budget.js +3 -0
  103. package/dist/cjs/model/transports.js +3 -2
  104. package/dist/cjs/structs/index.js +7 -6
  105. package/dist/cjs/structs/kits/domains/scopes.js +2 -0
  106. package/dist/cjs/structs/kits/presentation/formats.js +2 -0
  107. package/dist/cjs/structs/kits/text-blocks.js +11 -0
  108. package/dist/cjs/structs/model/session.js +11 -0
  109. package/dist/cjs/structs/support/associations.js +2 -0
  110. package/dist/cjs/support/associations.js +79 -0
  111. package/dist/cjs/support/context/nodes.js +48 -45
  112. package/dist/cjs/support/context/processing.js +6 -3
  113. package/dist/cjs/support/context/snapshot.js +11 -1
  114. package/dist/cjs/support/decorators/index.js +45 -3
  115. package/dist/cjs/support/index.js +1 -0
  116. package/dist/cjs/support/model/capabilities.js +35 -5
  117. package/dist/cjs/support/model/chat-completions.js +11 -2
  118. package/dist/cjs/support/model/completion/calls.js +10 -56
  119. package/dist/cjs/support/model/preview-rules.js +11 -11
  120. package/dist/cjs/support/model/reply-preview.js +3 -3
  121. package/dist/cjs/support/model/session.js +152 -0
  122. package/dist/cjs/support/model/stage-transport.js +8 -8
  123. package/dist/cjs/support/model/transports.js +5 -2
  124. package/dist/cjs/support/tools.js +42 -17
  125. package/dist/cjs/utils/invocation.js +1 -0
  126. package/dist/esm/capabilities/index.d.ts +5 -10
  127. package/dist/esm/capabilities/index.js +5 -9
  128. package/dist/esm/capabilities/invocation.js +21 -1
  129. package/dist/esm/capabilities/model.d.ts +17 -13
  130. package/dist/esm/capabilities/model.js +54 -10
  131. package/dist/esm/capabilities/tool-conditions.d.ts +9 -0
  132. package/dist/esm/capabilities/tool-conditions.js +59 -0
  133. package/dist/esm/capabilities/tool-runtime.js +18 -4
  134. package/dist/esm/capabilities/tools.d.ts +3 -3
  135. package/dist/esm/capabilities/tools.js +12 -17
  136. package/dist/esm/context/audit.js +5 -8
  137. package/dist/esm/context/index.d.ts +3 -4
  138. package/dist/esm/context/index.js +3 -4
  139. package/dist/esm/diagnostics/index.d.ts +1 -0
  140. package/dist/esm/diagnostics/index.js +48 -2
  141. package/dist/esm/diagnostics/native-sub-flow.d.ts +94 -0
  142. package/dist/esm/diagnostics/native-sub-flow.js +101 -0
  143. package/dist/esm/diagnostics/sub-flow.d.ts +56 -4
  144. package/dist/esm/diagnostics/sub-flow.js +271 -32
  145. package/dist/esm/execution/engine.d.ts +1 -0
  146. package/dist/esm/execution/engine.js +3 -2
  147. package/dist/esm/execution/events.js +5 -5
  148. package/dist/esm/execution/reporting.d.ts +6 -12
  149. package/dist/esm/execution/reporting.js +19 -29
  150. package/dist/esm/execution/workflow-chain.d.ts +3 -0
  151. package/dist/esm/execution/workflow-chain.js +208 -0
  152. package/dist/esm/execution/workflow-graph.d.ts +7 -0
  153. package/dist/esm/execution/workflow-graph.js +68 -0
  154. package/dist/esm/execution/workflow.d.ts +6 -0
  155. package/dist/esm/execution/workflow.js +34 -6
  156. package/dist/esm/index.d.ts +19 -13
  157. package/dist/esm/index.js +18 -15
  158. package/dist/esm/kits/aggregation.d.ts +1 -1
  159. package/dist/esm/kits/aggregation.js +17 -14
  160. package/dist/esm/kits/answering/checks.js +2 -1
  161. package/dist/esm/kits/answering/flow.js +24 -21
  162. package/dist/esm/kits/answering/tasks.d.ts +6 -6
  163. package/dist/esm/kits/answering/tasks.js +30 -25
  164. package/dist/esm/kits/delivery.d.ts +0 -9
  165. package/dist/esm/kits/delivery.js +36 -24
  166. package/dist/esm/kits/domains/catalog.d.ts +42 -0
  167. package/dist/esm/kits/domains/catalog.js +110 -0
  168. package/dist/esm/kits/domains/index.d.ts +4 -0
  169. package/dist/esm/kits/domains/index.js +4 -0
  170. package/dist/esm/kits/domains/registry.d.ts +100 -0
  171. package/dist/esm/kits/{intents → domains}/registry.js +77 -31
  172. package/dist/esm/kits/{intents → domains}/scopes.d.ts +18 -18
  173. package/dist/esm/kits/{intents → domains}/scopes.js +21 -21
  174. package/dist/esm/kits/index.d.ts +6 -5
  175. package/dist/esm/kits/index.js +6 -5
  176. package/dist/esm/kits/knowledge/catalog.js +33 -30
  177. package/dist/esm/kits/policies.d.ts +1 -1
  178. package/dist/esm/kits/policies.js +3 -2
  179. package/dist/esm/kits/presentation/formats.d.ts +42 -0
  180. package/dist/esm/kits/presentation/formats.js +105 -0
  181. package/dist/esm/kits/presentation/index.d.ts +14 -5
  182. package/dist/esm/kits/presentation/index.js +10 -5
  183. package/dist/esm/kits/presentation/outputs.js +2 -1
  184. package/dist/esm/kits/reflection.js +3 -3
  185. package/dist/esm/kits/retrieval.js +7 -1
  186. package/dist/esm/kits/text-blocks.d.ts +24 -0
  187. package/dist/esm/kits/text-blocks.js +97 -0
  188. package/dist/esm/kits/tools.d.ts +69 -52
  189. package/dist/esm/kits/tools.js +247 -158
  190. package/dist/esm/model/decision-retry.d.ts +2 -0
  191. package/dist/esm/model/decision-retry.js +2 -1
  192. package/dist/esm/model/index.d.ts +2 -6
  193. package/dist/esm/model/index.js +2 -6
  194. package/dist/esm/model/interactions/calls.d.ts +40 -0
  195. package/dist/esm/model/interactions/calls.js +58 -0
  196. package/dist/esm/model/interactions/json-object.js +11 -11
  197. package/dist/esm/model/interactions/native-functions.js +17 -23
  198. package/dist/esm/model/message-diagnostics.d.ts +6 -5
  199. package/dist/esm/model/message-diagnostics.js +13 -3
  200. package/dist/esm/model/options.js +2 -0
  201. package/dist/esm/model/preparation.js +39 -6
  202. package/dist/esm/model/runner.d.ts +2 -0
  203. package/dist/esm/model/runner.js +34 -5
  204. package/dist/esm/model/selection-transport.js +4 -4
  205. package/dist/esm/model/token-budget.js +3 -0
  206. package/dist/esm/model/transports.d.ts +2 -1
  207. package/dist/esm/model/transports.js +3 -2
  208. package/dist/esm/structs/capabilities/invocation.d.ts +3 -1
  209. package/dist/esm/structs/capabilities/model.d.ts +42 -11
  210. package/dist/esm/structs/capabilities/tools.d.ts +16 -7
  211. package/dist/esm/structs/common.d.ts +3 -1
  212. package/dist/esm/structs/debug.d.ts +36 -20
  213. package/dist/esm/structs/execution/workflow-views.d.ts +123 -0
  214. package/dist/esm/structs/execution/workflow.d.ts +4 -3
  215. package/dist/esm/structs/index.d.ts +8 -6
  216. package/dist/esm/structs/index.js +7 -6
  217. package/dist/esm/structs/kits/answering/tasks.d.ts +2 -2
  218. package/dist/esm/structs/kits/{intents → domains}/catalog.d.ts +20 -20
  219. package/dist/esm/structs/kits/{intents → domains}/registry.d.ts +24 -21
  220. package/dist/esm/structs/kits/{intents → domains}/scopes.d.ts +9 -9
  221. package/dist/esm/structs/kits/domains/scopes.js +1 -0
  222. package/dist/esm/structs/kits/presentation/formats.d.ts +42 -0
  223. package/dist/esm/structs/kits/presentation/formats.js +1 -0
  224. package/dist/esm/structs/kits/text-blocks.d.ts +25 -0
  225. package/dist/esm/structs/kits/text-blocks.js +10 -0
  226. package/dist/esm/structs/kits/tools.d.ts +82 -83
  227. package/dist/esm/structs/model/interactions.d.ts +18 -11
  228. package/dist/esm/structs/model/messages.d.ts +34 -2
  229. package/dist/esm/structs/model/runtime.d.ts +9 -0
  230. package/dist/esm/structs/model/session.d.ts +29 -0
  231. package/dist/esm/structs/model/session.js +10 -0
  232. package/dist/esm/structs/support/associations.d.ts +22 -0
  233. package/dist/esm/structs/support/associations.js +1 -0
  234. package/dist/esm/structs/support/model/interactions.d.ts +2 -2
  235. package/dist/esm/structs/support/model/messages.d.ts +6 -13
  236. package/dist/esm/structs/support/tools.d.ts +23 -23
  237. package/dist/esm/support/associations.d.ts +26 -0
  238. package/dist/esm/support/associations.js +76 -0
  239. package/dist/esm/support/context/nodes.js +48 -45
  240. package/dist/esm/support/context/processing.js +6 -3
  241. package/dist/esm/support/context/snapshot.js +11 -1
  242. package/dist/esm/support/decorators/index.d.ts +13 -2
  243. package/dist/esm/support/decorators/index.js +40 -3
  244. package/dist/esm/support/decorators/pool.d.ts +6 -5
  245. package/dist/esm/support/decorators/types.d.ts +3 -1
  246. package/dist/esm/support/index.d.ts +1 -0
  247. package/dist/esm/support/index.js +1 -0
  248. package/dist/esm/support/model/capabilities.d.ts +8 -3
  249. package/dist/esm/support/model/capabilities.js +35 -5
  250. package/dist/esm/support/model/chat-completions.js +11 -2
  251. package/dist/esm/support/model/completion/calls.d.ts +6 -34
  252. package/dist/esm/support/model/completion/calls.js +8 -55
  253. package/dist/esm/support/model/index.d.ts +1 -1
  254. package/dist/esm/support/model/preview-rules.d.ts +13 -8
  255. package/dist/esm/support/model/preview-rules.js +11 -11
  256. package/dist/esm/support/model/reply-preview.d.ts +2 -2
  257. package/dist/esm/support/model/reply-preview.js +3 -3
  258. package/dist/esm/support/model/session.d.ts +61 -0
  259. package/dist/esm/support/model/session.js +148 -0
  260. package/dist/esm/support/model/stage-transport.d.ts +1 -1
  261. package/dist/esm/support/model/stage-transport.js +9 -9
  262. package/dist/esm/support/model/transports.d.ts +2 -0
  263. package/dist/esm/support/model/transports.js +2 -1
  264. package/dist/esm/support/tools.d.ts +11 -3
  265. package/dist/esm/support/tools.js +43 -18
  266. package/dist/esm/utils/catalog.d.ts +1 -1
  267. package/dist/esm/utils/invocation.d.ts +1 -0
  268. package/dist/esm/utils/invocation.js +1 -0
  269. package/package.json +20 -6
  270. package/dist/cjs/execution/index.js +0 -30
  271. package/dist/cjs/kits/intents/catalog.js +0 -82
  272. package/dist/cjs/kits/intents/index.js +0 -35
  273. package/dist/cjs/utils/debug.js +0 -30
  274. package/dist/esm/execution/index.d.ts +0 -11
  275. package/dist/esm/execution/index.js +0 -11
  276. package/dist/esm/kits/intents/catalog.d.ts +0 -39
  277. package/dist/esm/kits/intents/catalog.js +0 -79
  278. package/dist/esm/kits/intents/index.d.ts +0 -22
  279. package/dist/esm/kits/intents/index.js +0 -18
  280. package/dist/esm/kits/intents/registry.d.ts +0 -88
  281. package/dist/esm/utils/debug.d.ts +0 -27
  282. package/dist/esm/utils/debug.js +0 -27
  283. /package/dist/cjs/structs/{kits/intents/catalog.js → execution/workflow-views.js} +0 -0
  284. /package/dist/cjs/structs/kits/{intents/registry.js → domains/catalog.js} +0 -0
  285. /package/dist/cjs/structs/kits/{intents/scopes.js → domains/registry.js} +0 -0
  286. /package/dist/esm/structs/{kits/intents/catalog.js → execution/workflow-views.js} +0 -0
  287. /package/dist/esm/structs/kits/{intents/registry.js → domains/catalog.js} +0 -0
  288. /package/dist/esm/structs/kits/{intents/scopes.js → domains/registry.js} +0 -0
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Session transport policy: one response may contain prose and several tool calls.
3
+ *
4
+ * Core owns the raw `ModelSessionResult`; this Support module adds the host-facing
5
+ * resolution fields (`toolId`, parsed `input`, non-fatal `problem`) and the transport
6
+ * that advertises the stage's tools. Keeping the resolution policy here prevents Core
7
+ * from depending on tool catalogs or business error categories.
8
+ *
9
+ * Exports: `ResolvedSessionCall`, `ResolvedSessionResult`, `PreparedSessionTransport`,
10
+ * `SessionFunctionOptions`, `SessionModelTransportRegistration`, `prepareSessionFunctions`
11
+ * and `createSessionModelTransport`.
12
+ */
13
+ import { wireName } from '../../model/interactions/arguments.js';
14
+ import { createToolCallCollector } from '../../model/interactions/calls.js';
15
+ import { snapshotModelOptions } from '../../model/options.js';
16
+ import { modelProtocolError } from '../../utils/model-protocol.js';
17
+ /**
18
+ * Parse one call's raw arguments without failing the whole response.
19
+ *
20
+ * @param raw - Raw JSON text; an empty string means an empty argument object.
21
+ * @returns The parsed object, or undefined when the text is not a JSON object.
22
+ */
23
+ function parseArguments(raw) {
24
+ try {
25
+ const value = JSON.parse(raw === '' ? '{}' : raw);
26
+ return value && typeof value === 'object' && !Array.isArray(value)
27
+ ? value
28
+ : undefined;
29
+ }
30
+ catch {
31
+ return undefined;
32
+ }
33
+ }
34
+ /**
35
+ * Build the session policy for one stage.
36
+ *
37
+ * @param tools - Registered tools available in this stage; must be non-empty.
38
+ * @param options - Sampling and tool-selection settings.
39
+ * @returns A prepared transport whose collector returns text and every completed call.
40
+ * @throws TypeError When the tool list is empty or two ids collide on the wire name.
41
+ */
42
+ export function prepareSessionFunctions(tools, options = {}) {
43
+ if (!tools.length)
44
+ throw new TypeError('Session transport requires registered tools');
45
+ const names = new Map(tools.map((tool) => [wireName(tool.id), tool.id]));
46
+ if (names.size !== tools.length)
47
+ throw new TypeError('Model wire name collision');
48
+ const functions = tools.map((tool) => ({
49
+ name: wireName(tool.id),
50
+ description: tool.description,
51
+ parameters: tool.inputSchema.jsonSchema,
52
+ strict: false,
53
+ }));
54
+ const instruction = 'You may answer directly or call one or more registered tools. Prose and calls may appear together. A call is a proposal, not proof of execution.';
55
+ return {
56
+ options: {
57
+ json: false,
58
+ functions,
59
+ toolChoice: options.toolChoice ?? 'auto',
60
+ ...(options.parallelToolCalls === undefined
61
+ ? {}
62
+ : { parallelToolCalls: options.parallelToolCalls }),
63
+ ...(options.temperature === undefined ? {} : { temperature: options.temperature }),
64
+ },
65
+ schemaChars: JSON.stringify(functions).length + instruction.length,
66
+ instruction,
67
+ createResponse() {
68
+ const collector = createToolCallCollector();
69
+ let text = '';
70
+ return {
71
+ get outputChars() {
72
+ return (text.length +
73
+ collector.calls.reduce((sum, call) => sum + call.id.length + call.name.length + call.arguments.length, 0));
74
+ },
75
+ get calls() {
76
+ try {
77
+ return collector.complete().map((call) => ({
78
+ id: call.id,
79
+ name: call.name,
80
+ argumentChars: call.arguments.length,
81
+ toolId: names.get(call.name),
82
+ }));
83
+ }
84
+ catch {
85
+ return undefined;
86
+ }
87
+ },
88
+ push(part) {
89
+ if (typeof part === 'string') {
90
+ text += part;
91
+ return;
92
+ }
93
+ collector.push(part);
94
+ },
95
+ finish() {
96
+ const completed = collector.complete();
97
+ if (text.trim() === '' && completed.length === 0)
98
+ modelProtocolError('Model response is empty', 'MODEL_INCOMPLETE');
99
+ const calls = completed.map((call) => {
100
+ const toolId = names.get(call.name);
101
+ const input = parseArguments(call.arguments);
102
+ return {
103
+ index: call.index,
104
+ id: call.id,
105
+ name: call.name,
106
+ arguments: call.arguments,
107
+ argumentChars: call.arguments.length,
108
+ ...(toolId === undefined ? {} : { toolId }),
109
+ ...(input === undefined ? {} : { input }),
110
+ ...(toolId === undefined
111
+ ? { problem: 'unknown-tool' }
112
+ : input === undefined
113
+ ? { problem: 'invalid-arguments' }
114
+ : {}),
115
+ };
116
+ });
117
+ return { text, calls };
118
+ },
119
+ };
120
+ },
121
+ };
122
+ }
123
+ /**
124
+ * Create a session transport.
125
+ *
126
+ * @param registration - Transport id, tool source and optional settings.
127
+ * @returns A frozen transport definition whose result contains text and every completed call.
128
+ * @throws TypeError When the id is blank.
129
+ */
130
+ export function createSessionModelTransport(registration) {
131
+ const id = registration.id;
132
+ if (typeof id !== 'string' || !id.trim())
133
+ throw new TypeError('Session transport requires an ID');
134
+ const source = registration.tools;
135
+ const options = snapshotModelOptions(registration.options ?? {});
136
+ return Object.freeze({
137
+ id,
138
+ prepare() {
139
+ return prepareSessionFunctions([...source.values()], {
140
+ ...(options.temperature === undefined ? {} : { temperature: options.temperature }),
141
+ ...(options.toolChoice === undefined ? {} : { toolChoice: options.toolChoice }),
142
+ ...(options.parallelToolCalls === undefined
143
+ ? {}
144
+ : { parallelToolCalls: options.parallelToolCalls }),
145
+ });
146
+ },
147
+ });
148
+ }
@@ -4,7 +4,7 @@ import type { ModelStageTransportRegistration } from '../../structs/support/mode
4
4
  *
5
5
  * @param registration Transport declaration: unique ID, stage-to-capability references, interaction
6
6
  * adapter, options and a static or per-stage capability source.
7
- * @returns A Core model transport with `capabilities(stage)`.
7
+ * @returns A Core model transport with `tools(stage)`.
8
8
  * @throws {Error} When a stage ID repeats, has no capability IDs, the declaration has no stages, a
9
9
  * stage or capability is not registered, or a dynamic capability source is asynchronous.
10
10
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Stage-scoped model transport: expose only the capabilities declared for each stage.
2
+ * Stage-scoped model transport: expose only the tools declared for each stage.
3
3
  *
4
4
  * Static capability sources are projected once at construction; dynamic sources are re-projected
5
5
  * at the model boundary. Either way, an undeclared stage or capability is rejected rather than
@@ -8,7 +8,7 @@
8
8
  * Main export: `createStageModelTransport`.
9
9
  */
10
10
  import { synchronous } from '../../utils/synchronous.js';
11
- import { ModelCapabilityRegistry } from '../../capabilities/model.js';
11
+ import { ModelToolRegistry } from '../../capabilities/model.js';
12
12
  import { breakWhile } from '../../utils/rules.js';
13
13
  import { createModelTransport } from './transports.js';
14
14
  /**
@@ -16,14 +16,14 @@ import { createModelTransport } from './transports.js';
16
16
  *
17
17
  * @param registration Transport declaration: unique ID, stage-to-capability references, interaction
18
18
  * adapter, options and a static or per-stage capability source.
19
- * @returns A Core model transport with `capabilities(stage)`.
19
+ * @returns A Core model transport with `tools(stage)`.
20
20
  * @throws {Error} When a stage ID repeats, has no capability IDs, the declaration has no stages, a
21
21
  * stage or capability is not registered, or a dynamic capability source is asynchronous.
22
22
  */
23
23
  export function createStageModelTransport(registration) {
24
24
  const stages = new Map();
25
25
  for (const stage of registration.stages) {
26
- const ids = stage.capabilityIds;
26
+ const ids = stage.toolIds;
27
27
  breakWhile(!stage.id?.trim() ||
28
28
  stages.has(stage.id) ||
29
29
  !Array.isArray(ids) ||
@@ -32,15 +32,15 @@ export function createStageModelTransport(registration) {
32
32
  stages.set(stage.id, Object.freeze([...ids]));
33
33
  }
34
34
  breakWhile(!stages.size, 'Model transport requires declared stages');
35
- const { id, adapter, options, requireStrictArguments, capabilities: source } = registration;
36
- const project = (stage, capabilities) => {
35
+ const { id, adapter, options, requireStrictArguments, tools: source } = registration;
36
+ const project = (stage, tools) => {
37
37
  const ids = stages.get(stage);
38
38
  breakWhile(!ids, `Unregistered model stage: ${id} -> ${stage}`);
39
- const catalog = new ModelCapabilityRegistry(capabilities.values());
39
+ const catalog = new ModelToolRegistry(tools.values());
40
40
  for (const id of ids)
41
41
  breakWhile(!catalog.has(id), `Unregistered model capability: ${stage} -> ${id}`);
42
42
  const selected = catalog.select(ids);
43
- const resolve = capabilities.resolve.bind(capabilities);
43
+ const resolve = tools.resolve.bind(tools);
44
44
  return Object.freeze({
45
45
  values: () => selected.values(),
46
46
  resolve(selection, context) {
@@ -58,7 +58,7 @@ export function createStageModelTransport(registration) {
58
58
  adapter,
59
59
  options,
60
60
  requireStrictArguments,
61
- capabilities(stage) {
61
+ tools(stage) {
62
62
  breakWhile(!stages.has(stage), `Unregistered model stage: ${id} -> ${stage}`);
63
63
  return fixed
64
64
  ? fixed.get(stage)
@@ -1,6 +1,7 @@
1
1
  import type { ModelOptions } from '../../structs/model/messages.js';
2
2
  import type { ModelTransportDefinition } from '../../structs/model/runtime.js';
3
3
  export { createModelTransport } from '../../model/selection-transport.js';
4
+ export { createSessionModelTransport, prepareSessionFunctions, type PreparedSessionTransport, type ResolvedSessionCall, type ResolvedSessionResult, type SessionFunctionOptions, type SessionModelTransportRegistration, } from './session.js';
4
5
  /**
5
6
  * Create a plain-text transport that trims the assembled response.
6
7
  *
@@ -10,6 +11,7 @@ export { createModelTransport } from '../../model/selection-transport.js';
10
11
  export declare function createTextTransport<const Id extends string>(definition: {
11
12
  readonly id: Id;
12
13
  readonly options?: Pick<ModelOptions, 'temperature'>;
14
+ readonly trim?: boolean;
13
15
  }): ModelTransportDefinition<string> & {
14
16
  readonly id: Id;
15
17
  };
@@ -12,6 +12,7 @@ import { snapshotModelOptions } from '../../model/options.js';
12
12
  import { modelProtocolError } from '../../utils/model-protocol.js';
13
13
  import { createPlainTextTransport } from '../../model/transports.js';
14
14
  export { createModelTransport } from '../../model/selection-transport.js';
15
+ export { createSessionModelTransport, prepareSessionFunctions, } from './session.js';
15
16
  /**
16
17
  * Create a plain-text transport that trims the assembled response.
17
18
  *
@@ -19,7 +20,7 @@ export { createModelTransport } from '../../model/selection-transport.js';
19
20
  * @returns A frozen Core transport definition typed as string output.
20
21
  */
21
22
  export function createTextTransport(definition) {
22
- return createPlainTextTransport(definition.id, definition.options);
23
+ return createPlainTextTransport(definition.id, definition.options, definition.trim);
23
24
  }
24
25
  /**
25
26
  * Create a typed JSON transport without a capability-selection envelope.
@@ -1,3 +1,5 @@
1
+ import type { OperationContext } from '../structs/common.js';
2
+ import type { ExecutableTool } from '../structs/capabilities/tools.js';
1
3
  import type { ToolDefinition, ToolCatalog, CompiledTool } from '../structs/support/tools.js';
2
4
  /**
3
5
  * Validate one tool declaration and freeze a detached copy of it.
@@ -13,16 +15,22 @@ import type { ToolDefinition, ToolCatalog, CompiledTool } from '../structs/suppo
13
15
  */
14
16
  export declare function defineTool<Input, Output, App, const Id extends string = string>(definition: ToolDefinition<Input, Output, App> & {
15
17
  readonly id: Id;
16
- }): ToolDefinition<Input, Output, App, Id>;
18
+ }): ExecutableTool<Input, Output, App, Id>;
17
19
  /**
18
- * Compile tool declarations into a frozen catalog with model capabilities and runtime binding.
20
+ * Compile tool declarations into a frozen catalog with model tools and runtime binding.
19
21
  *
20
22
  * Each tool becomes a model capability whose resolver returns `{ toolId, input }`; the model only
21
23
  * chooses among registered tools, it never invokes them directly.
22
24
  *
23
25
  * @param definitions Tool declarations in catalog order.
24
- * @returns A frozen catalog with `capabilities`, `select` and `bind`.
26
+ * @returns A frozen catalog with `tools`, `select` and `bind`.
25
27
  * @throws {TypeError} When a tool declaration is invalid or a tool ID is duplicated.
26
28
  */
29
+ type DefinitionApp<Definition> = Definition extends {
30
+ authorize(input: any, context: OperationContext<infer App>): unknown;
31
+ } ? App : unknown;
32
+ /** Infer the host context from existing executable definitions, without widening it to unknown. */
33
+ export declare function defineToolCatalog<const Definitions extends readonly ToolDefinition<any, any, any>[]>(definitions: Definitions): ToolCatalog<DefinitionApp<Definitions[number]>, CompiledTool<DefinitionApp<Definitions[number]>, Definitions[number]>>;
34
+ /** Explicit host typing remains available for contextually typed declaration lists. */
27
35
  export declare function defineToolCatalog<App, const Definitions extends readonly ToolDefinition<any, any, App>[] = readonly ToolDefinition<any, any, App>[]>(definitions: Definitions): ToolCatalog<App, CompiledTool<App, Definitions[number]>>;
28
36
  export type * from '../structs/support/tools.js';
@@ -2,17 +2,18 @@
2
2
  * Tool support: turn typed application tool definitions into a Core-schedulable tool catalog.
3
3
  *
4
4
  * A tool declaration pairs an input schema with authorization, execution and output parsing. The
5
- * catalog projects those tools into model capabilities and binds them to the Core tool registry
5
+ * catalog projects those tools into model tools and binds them to the Core tool registry
6
6
  * when a runtime request supplies the application. Support only assembles the registration; Core
7
7
  * still performs authorization, invocation, budgets and cancellation.
8
8
  *
9
9
  * Main exports: `defineTool` and `defineToolCatalog`.
10
10
  */
11
- import { ModelCapabilityRegistry } from '../capabilities/model.js';
11
+ import { ModelToolRegistry } from '../capabilities/model.js';
12
12
  import { createToolRegistry } from './tool-runtime.js';
13
13
  import { defineSchema } from './schema.js';
14
14
  import { readonlyCatalog } from '../utils/catalog.js';
15
15
  import { maybeAssertion } from '../utils/synchronous.js';
16
+ import { snapshotIntent, toolActive, intentDescription, bindIntent, } from '../capabilities/tool-conditions.js';
16
17
  /**
17
18
  * Validate one tool declaration and freeze a detached copy of it.
18
19
  *
@@ -35,11 +36,24 @@ export function defineTool(definition) {
35
36
  throw new TypeError('Missing tool handler');
36
37
  const inputSchema = defineSchema(definition.inputSchema);
37
38
  const authorize = definition.authorize.bind(definition);
39
+ if (definition.active !== undefined &&
40
+ typeof definition.active !== 'boolean' &&
41
+ typeof definition.active !== 'function')
42
+ throw new TypeError('Invalid tool active condition');
43
+ const active = typeof definition.active === 'function'
44
+ ? definition.active.bind(definition)
45
+ : definition.active;
46
+ const asIntent = bindIntent(snapshotIntent(typeof definition.asIntent === 'function'
47
+ ? definition.asIntent.bind(definition)
48
+ : definition.asIntent), definition);
38
49
  return Object.freeze({
39
50
  id,
40
51
  kind,
41
52
  description,
42
53
  inputSchema,
54
+ active,
55
+ asIntent,
56
+ resolve: definition.resolve?.bind(definition) ?? ((input) => ({ toolId: id, input })),
43
57
  authorize(input, context) {
44
58
  return maybeAssertion(authorize(input, context), 'Authorization must return void; rejection must throw');
45
59
  },
@@ -48,22 +62,14 @@ export function defineTool(definition) {
48
62
  parseOutput: definition.parseOutput.bind(definition),
49
63
  });
50
64
  }
51
- /**
52
- * Compile tool declarations into a frozen catalog with model capabilities and runtime binding.
53
- *
54
- * Each tool becomes a model capability whose resolver returns `{ toolId, input }`; the model only
55
- * chooses among registered tools, it never invokes them directly.
56
- *
57
- * @param definitions Tool declarations in catalog order.
58
- * @returns A frozen catalog with `capabilities`, `select` and `bind`.
59
- * @throws {TypeError} When a tool declaration is invalid or a tool ID is duplicated.
60
- */
61
65
  export function defineToolCatalog(definitions) {
62
66
  const entries = definitions.map((definition) => defineTool(definition));
63
67
  const view = readonlyCatalog(entries, (id) => new TypeError(`Unknown tool: ${id}`));
64
- const capabilities = new ModelCapabilityRegistry(entries.map((tool) => ({
68
+ const tools = new ModelToolRegistry(entries.map((tool) => ({
65
69
  id: tool.id,
66
70
  description: tool.description,
71
+ active: tool.active,
72
+ asIntent: tool.asIntent,
67
73
  inputSchema: defineSchema({
68
74
  jsonSchema: tool.inputSchema.jsonSchema,
69
75
  parse: (input) => input,
@@ -72,7 +78,7 @@ export function defineToolCatalog(definitions) {
72
78
  }))).seal();
73
79
  return Object.freeze({
74
80
  ...view,
75
- capabilities,
81
+ tools,
76
82
  /**
77
83
  * Narrow the catalog to the given tool IDs, preserving their declaration order.
78
84
  *
@@ -80,9 +86,28 @@ export function defineToolCatalog(definitions) {
80
86
  * @returns A new catalog containing only the selected tools.
81
87
  * @throws {TypeError} When an ID is not registered in this catalog.
82
88
  */
83
- select(ids) {
84
- capabilities.select(ids);
85
- return defineToolCatalog(ids.map((id) => view.require(id)));
89
+ select(ids, ...context) {
90
+ const seen = new Set();
91
+ const selected = ids
92
+ .map((id) => {
93
+ if (seen.has(id))
94
+ throw new TypeError(`Duplicate tool selection: ${id}`);
95
+ seen.add(id);
96
+ if (!view.has(id))
97
+ throw new TypeError(`Tool is not registered: ${id}`);
98
+ return view.require(id);
99
+ })
100
+ .filter((tool) => !context.length || toolActive(tool.active, context[0]));
101
+ return defineToolCatalog(selected);
102
+ },
103
+ /** Discover demand-facing executable tools while preserving their execution contracts. */
104
+ withIntent(context) {
105
+ return defineToolCatalog(entries.flatMap((tool) => {
106
+ if (!toolActive(tool.active, context))
107
+ return [];
108
+ const description = intentDescription(tool.asIntent, tool.description, context);
109
+ return description === undefined ? [] : [{ ...tool, description }];
110
+ }));
86
111
  },
87
112
  /**
88
113
  * Bind the catalog to one application runtime request.
@@ -99,7 +124,7 @@ export function defineToolCatalog(definitions) {
99
124
  errors: request.errors,
100
125
  });
101
126
  return Object.freeze({
102
- capabilities,
127
+ tools,
103
128
  get events() {
104
129
  return registry.events;
105
130
  },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Immutable id-keyed catalog snapshot.
3
3
  *
4
- * Modules that own registrable definitions (tools, capabilities, prompts) publish the
4
+ * Modules that own registrable definitions (tools, tools, prompts) publish the
5
5
  * snapshot produced here instead of exposing their mutable `Map`, so later mutations
6
6
  * by the owner cannot be observed and no consumer can mutate the registry.
7
7
  *
@@ -38,6 +38,7 @@ export declare function invocationResult<Value, Metadata extends InvocationMetad
38
38
  * @throws TypeError When the arity or the request shape is invalid.
39
39
  */
40
40
  export declare function toolInvocation(request: import('../structs/capabilities/tools.js').ToolInvocationRequest, arity: number): {
41
+ logger: import("../index.js").SubFlowLogger | undefined;
41
42
  toolId: string;
42
43
  input: unknown;
43
44
  diagnostics: import("../index.js").DiagnosticContext | undefined;
@@ -41,6 +41,7 @@ export function toolInvocation(request, arity) {
41
41
  throw new TypeError('Use one tool request with toolId and input');
42
42
  }
43
43
  return {
44
+ logger: request.logger,
44
45
  toolId: request.toolId,
45
46
  input: request.input,
46
47
  diagnostics: request.diagnostics,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jangts/agent-core",
3
- "version": "0.3.5",
3
+ "version": "0.5.0",
4
4
  "type": "commonjs",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Platform-independent agent runtime and configurable modules for evidence, delivery, policies and interactions",
@@ -162,10 +162,10 @@
162
162
  "import": "./dist/esm/kits/interaction/index.js",
163
163
  "require": "./dist/cjs/kits/interaction/index.js"
164
164
  },
165
- "./kits/intents": {
166
- "types": "./dist/esm/kits/intents/index.d.ts",
167
- "import": "./dist/esm/kits/intents/index.js",
168
- "require": "./dist/cjs/kits/intents/index.js"
165
+ "./kits/domains": {
166
+ "types": "./dist/esm/kits/domains/index.d.ts",
167
+ "import": "./dist/esm/kits/domains/index.js",
168
+ "require": "./dist/cjs/kits/domains/index.js"
169
169
  },
170
170
  "./kits/tools": {
171
171
  "types": "./dist/esm/kits/tools.d.ts",
@@ -197,6 +197,11 @@
197
197
  "import": "./dist/esm/kits/search.js",
198
198
  "require": "./dist/cjs/kits/search.js"
199
199
  },
200
+ "./kits/text-blocks": {
201
+ "types": "./dist/esm/kits/text-blocks.d.ts",
202
+ "import": "./dist/esm/kits/text-blocks.js",
203
+ "require": "./dist/cjs/kits/text-blocks.js"
204
+ },
200
205
  "./kits/inference": {
201
206
  "types": "./dist/esm/kits/inference.d.ts",
202
207
  "import": "./dist/esm/kits/inference.js",
@@ -250,15 +255,24 @@
250
255
  },
251
256
  "scripts": {
252
257
  "build": "node scripts/clean.mjs && tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/finalize.mjs",
258
+ "build:dev": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/finalize.mjs",
253
259
  "test": "node --test test/*.test.mjs",
254
260
  "docs:api": "node scripts/api-reference.mjs"
255
261
  },
256
262
  "dependencies": {
257
263
  "@jangts/streaming": "^0.1.2",
258
- "@jangts/mock-gpt": "0.2.2",
259
264
  "minisearch": "^7.2.0"
260
265
  },
266
+ "peerDependencies": {
267
+ "@jangts/mock-gpt": "0.2.2"
268
+ },
269
+ "peerDependenciesMeta": {
270
+ "@jangts/mock-gpt": {
271
+ "optional": true
272
+ }
273
+ },
261
274
  "devDependencies": {
275
+ "@jangts/mock-gpt": "0.2.2",
262
276
  "typescript": "~6.0.2",
263
277
  "esbuild": "0.28.2"
264
278
  },
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ValidationError = exports.BudgetError = void 0;
18
- /**
19
- * Public surface of the execution layer.
20
- *
21
- * Re-exports the engine, the workflow catalog and its route helpers, the shared budget
22
- * and validation errors, and the policy kit. Applications should import the loop and
23
- * workflow contracts from here rather than from individual files.
24
- */
25
- __exportStar(require("./engine.js"), exports);
26
- __exportStar(require("./workflow.js"), exports);
27
- var errors_js_1 = require("../structs/errors.js");
28
- Object.defineProperty(exports, "BudgetError", { enumerable: true, get: function () { return errors_js_1.BudgetError; } });
29
- Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_js_1.ValidationError; } });
30
- __exportStar(require("../kits/policies.js"), exports);
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineAgentCatalog = defineAgentCatalog;
4
- /**
5
- * Intents Kit: project registered intents, scopes and tools into one task-facing catalog.
6
- *
7
- * Place in the package: part of the `intents` Kit. It reads the actual registries supplied by
8
- * the App instead of maintaining a parallel capability list, so an intent is only advertised
9
- * when its tools, scopes and availability agree.
10
- *
11
- * Exports: `defineAgentCatalog`, and the catalog intent/scope/port types.
12
- */
13
- const synchronous_js_1 = require("../../utils/synchronous.js");
14
- /**
15
- * Compile a catalog projection over the App's live registries.
16
- *
17
- * The actual registries determine availability and relationships. No parallel capability list
18
- * exists: `intentIds` filters by tool support, `modelCatalog` narrows to the currently accepted
19
- * task when `restrictToTask` is enabled, and scope tool ids are filtered to tools that exist.
20
- *
21
- * @param ports - Sources for intent ids, intents, scopes, the current task, the tool registry
22
- * and the `restrictToTask` switch.
23
- * @returns A frozen projection with `intentIds`, `intentSteps`, `intentCatalog`,
24
- * `scopeCatalog` and `modelCatalog`.
25
- * @throws TypeError When a supplied predicate does not return a boolean synchronously.
26
- */
27
- function defineAgentCatalog(ports) {
28
- const ids = ports.intentIds.bind(ports), intents = ports.intents.bind(ports), scopes = ports.scopes.bind(ports), task = ports.currentTask.bind(ports);
29
- const tools = {
30
- values: ports.tools.values.bind(ports.tools),
31
- has: ports.tools.has.bind(ports.tools),
32
- supports: ports.tools.supportsIntent.bind(ports.tools),
33
- describe: ports.tools.describe.bind(ports.tools),
34
- };
35
- const restrict = ports.restrictToTask !== false;
36
- const boolean = (value) => (0, synchronous_js_1.booleanResult)(value, 'Catalog predicates must be synchronous', 'Catalog predicates must return boolean');
37
- const intentIds = (app) => ids().filter((id) => boolean(tools.supports(id, app)));
38
- const intentSteps = (app) => new Map(intents().map((intent) => [
39
- intent.id,
40
- [
41
- ...new Set([
42
- ...intent.steps,
43
- ...[...tools.values()]
44
- .filter((tool) => tool.invocation &&
45
- (!tool.available || app === undefined || boolean(tool.available(app))) &&
46
- (tool.intentIds === 'all' || tool.intentIds.includes(intent.id)))
47
- .map((tool) => tool.invocation.step),
48
- ]),
49
- ],
50
- ]));
51
- const intentCatalog = (app) => {
52
- const selected = intentIds(app), described = tools.describe('model', app), steps = intentSteps(app);
53
- return intents(selected).map((intent) => ({
54
- ...intent,
55
- steps: steps.get(intent.id) ?? [...intent.steps],
56
- scopeIds: scopes([intent.id]).map((scope) => scope.id),
57
- toolIds: described
58
- .filter((tool) => tool.intentIds.includes(intent.id))
59
- .map((tool) => tool.id),
60
- }));
61
- };
62
- const scopeCatalog = (app) => scopes(intentIds(app)).map((scope) => ({ ...scope, toolIds: scope.toolIds.filter(tools.has) }));
63
- return Object.freeze({
64
- intentIds,
65
- intentSteps,
66
- intentCatalog,
67
- scopeCatalog,
68
- modelCatalog(app) {
69
- const accepted = restrict ? task(app) : undefined, selected = intentIds(app).filter((id) => !accepted || id === accepted.intentId);
70
- return {
71
- availableIntentIds: selected,
72
- availableIntents: intentCatalog(app)
73
- .filter((intent) => selected.includes(intent.id))
74
- .map((intent) => accepted ? { ...intent, scopeIds: accepted.scopeId ? [accepted.scopeId] : [] } : intent),
75
- availableScopes: scopeCatalog(app).filter((scope) => !accepted || scope.id === accepted.scopeId),
76
- availableTools: tools
77
- .describe('model', app)
78
- .filter((tool) => !accepted || tool.intentIds.includes(accepted.intentId)),
79
- };
80
- },
81
- });
82
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Intents = void 0;
18
- /**
19
- * Intents Kit entry: intent and scope registries plus the task-facing catalog projection.
20
- *
21
- * Place in the package: an optional App-side library for declaring what the agent may do.
22
- * Applications register their own intents and scopes; this directory owns registration
23
- * checks, aliases, relationship lookups and the model-visible projection. Core never imports it.
24
- *
25
- * Exports: everything from `./registry.js`, `./scopes.js` and `./catalog.js`, plus the
26
- * `Intents` namespace object.
27
- */
28
- __exportStar(require("./registry.js"), exports);
29
- __exportStar(require("./scopes.js"), exports);
30
- __exportStar(require("./catalog.js"), exports);
31
- const registry_js_1 = require("./registry.js");
32
- const scopes_js_1 = require("./scopes.js");
33
- const catalog_js_1 = require("./catalog.js");
34
- /** Namespace object for callers that prefer one import over named helpers. */
35
- exports.Intents = Object.freeze({ IntentRegistry: registry_js_1.IntentRegistry, ScopeRegistry: scopes_js_1.ScopeRegistry, defineAgentCatalog: catalog_js_1.defineAgentCatalog });