@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.
- package/CHANGELOG.md +41 -0
- package/README.md +33 -31
- package/development/docs/README.en.md +2 -2
- package/development/docs/acceptance.en.md +2 -2
- package/development/docs/agent-development.en.md +1 -1
- package/development/docs/api/README.en.md +6 -2
- package/development/docs/api/README.md +4 -0
- package/development/docs/api/configuration-in-workflow.en.md +403 -0
- package/development/docs/api/configuration-in-workflow.md +403 -0
- package/development/docs/api/core.en.md +7 -7
- package/development/docs/api/core.md +6 -6
- package/development/docs/api/decorators.en.md +20 -0
- package/development/docs/api/decorators.md +20 -0
- package/development/docs/api/examples.en.md +1 -1
- package/development/docs/api/examples.md +1 -1
- package/development/docs/api/kits.en.md +22 -4
- package/development/docs/api/kits.md +22 -4
- package/development/docs/api/knowledge-answering.en.md +4 -1
- package/development/docs/api/knowledge-answering.md +4 -1
- package/development/docs/api/mock.en.md +2 -0
- package/development/docs/api/mock.md +2 -0
- package/development/docs/api/observability.en.md +37 -11
- package/development/docs/api/observability.md +64 -11
- package/development/docs/api/reference.en.md +876 -657
- package/development/docs/api/reference.md +662 -508
- package/development/docs/api/support.en.md +55 -9
- package/development/docs/api/support.md +53 -7
- package/development/docs/api/types.en.md +36 -1
- package/development/docs/api/types.md +44 -0
- package/development/docs/api/workflow-views.en.md +64 -0
- package/development/docs/api/workflow-views.md +78 -0
- package/development/docs/api/workflow.en.md +6 -2
- package/development/docs/api/workflow.md +6 -2
- package/development/docs/basic-usage.en.md +1 -1
- package/development/docs/basic-usage.md +1 -1
- package/development/docs/create-app.en.md +1 -1
- package/development/docs/examples/registration/associated.mjs +8 -0
- package/development/docs/examples/registration/independent.mjs +20 -0
- package/development/docs/examples/registration/protocol.mjs +48 -0
- package/development/docs/examples/registration/run.mjs +47 -0
- package/development/docs/examples/registration/tools.mjs +75 -0
- package/development/docs/examples/registration/workflow.mjs +109 -0
- package/development/docs/flows/knowledge-maintenance.en.md +1 -1
- package/development/docs/materials.en.md +1 -1
- package/development/docs/mechanisms.en.md +2 -2
- package/development/docs/mechanisms.md +1 -1
- package/development/docs/operations.en.md +1 -1
- package/development/docs/records.en.md +1 -1
- package/development/docs/registration.en.md +4 -4
- package/development/docs/registration.md +2 -2
- package/development/skills/agent-core-app/SKILL.md +16 -4
- package/development/skills/agent-core-app/templates/node-ts/README.md.tpl +1 -1
- package/development/skills/agent-core-app/templates/node-ts/src/catalog.ts.tpl +2 -2
- package/development/skills/agent-core-app/templates/node-ts/test/app.test.mjs.tpl +1 -1
- package/dist/cjs/capabilities/index.js +5 -12
- package/dist/cjs/capabilities/invocation.js +21 -1
- package/dist/cjs/capabilities/model.js +56 -12
- package/dist/cjs/capabilities/tool-conditions.js +65 -0
- package/dist/cjs/capabilities/tool-runtime.js +18 -4
- package/dist/cjs/capabilities/tools.js +12 -17
- package/dist/cjs/context/audit.js +5 -8
- package/dist/cjs/context/index.js +3 -4
- package/dist/cjs/diagnostics/index.js +51 -3
- package/dist/cjs/diagnostics/native-sub-flow.js +106 -0
- package/dist/cjs/diagnostics/sub-flow.js +278 -32
- package/dist/cjs/execution/engine.js +3 -2
- package/dist/cjs/execution/events.js +5 -5
- package/dist/cjs/execution/reporting.js +18 -28
- package/dist/cjs/execution/workflow-chain.js +211 -0
- package/dist/cjs/execution/workflow-graph.js +72 -0
- package/dist/cjs/execution/workflow.js +34 -6
- package/dist/cjs/index.js +21 -17
- package/dist/cjs/kits/aggregation.js +17 -14
- package/dist/cjs/kits/answering/checks.js +2 -1
- package/dist/cjs/kits/answering/flow.js +24 -21
- package/dist/cjs/kits/answering/tasks.js +30 -25
- package/dist/cjs/kits/delivery.js +36 -24
- package/dist/cjs/kits/domains/catalog.js +113 -0
- package/dist/cjs/kits/domains/index.js +20 -0
- package/dist/cjs/kits/{intents → domains}/registry.js +77 -31
- package/dist/cjs/kits/{intents → domains}/scopes.js +21 -21
- package/dist/cjs/kits/index.js +14 -13
- package/dist/cjs/kits/knowledge/catalog.js +33 -30
- package/dist/cjs/kits/policies.js +3 -2
- package/dist/cjs/kits/presentation/formats.js +110 -0
- package/dist/cjs/kits/presentation/index.js +10 -5
- package/dist/cjs/kits/presentation/outputs.js +2 -1
- package/dist/cjs/kits/reflection.js +2 -2
- package/dist/cjs/kits/retrieval.js +7 -1
- package/dist/cjs/kits/text-blocks.js +101 -0
- package/dist/cjs/kits/tools.js +247 -158
- package/dist/cjs/model/decision-retry.js +2 -1
- package/dist/cjs/model/index.js +2 -6
- package/dist/cjs/model/interactions/calls.js +61 -0
- package/dist/cjs/model/interactions/json-object.js +11 -11
- package/dist/cjs/model/interactions/native-functions.js +17 -23
- package/dist/cjs/model/message-diagnostics.js +13 -3
- package/dist/cjs/model/options.js +2 -0
- package/dist/cjs/model/preparation.js +39 -6
- package/dist/cjs/model/runner.js +34 -5
- package/dist/cjs/model/selection-transport.js +4 -4
- package/dist/cjs/model/token-budget.js +3 -0
- package/dist/cjs/model/transports.js +3 -2
- package/dist/cjs/structs/index.js +7 -6
- package/dist/cjs/structs/kits/domains/scopes.js +2 -0
- package/dist/cjs/structs/kits/presentation/formats.js +2 -0
- package/dist/cjs/structs/kits/text-blocks.js +11 -0
- package/dist/cjs/structs/model/session.js +11 -0
- package/dist/cjs/structs/support/associations.js +2 -0
- package/dist/cjs/support/associations.js +79 -0
- package/dist/cjs/support/context/nodes.js +48 -45
- package/dist/cjs/support/context/processing.js +6 -3
- package/dist/cjs/support/context/snapshot.js +11 -1
- package/dist/cjs/support/decorators/index.js +45 -3
- package/dist/cjs/support/index.js +1 -0
- package/dist/cjs/support/model/capabilities.js +35 -5
- package/dist/cjs/support/model/chat-completions.js +11 -2
- package/dist/cjs/support/model/completion/calls.js +10 -56
- package/dist/cjs/support/model/preview-rules.js +11 -11
- package/dist/cjs/support/model/reply-preview.js +3 -3
- package/dist/cjs/support/model/session.js +152 -0
- package/dist/cjs/support/model/stage-transport.js +8 -8
- package/dist/cjs/support/model/transports.js +5 -2
- package/dist/cjs/support/tools.js +42 -17
- package/dist/cjs/utils/invocation.js +1 -0
- package/dist/esm/capabilities/index.d.ts +5 -10
- package/dist/esm/capabilities/index.js +5 -9
- package/dist/esm/capabilities/invocation.js +21 -1
- package/dist/esm/capabilities/model.d.ts +17 -13
- package/dist/esm/capabilities/model.js +54 -10
- package/dist/esm/capabilities/tool-conditions.d.ts +9 -0
- package/dist/esm/capabilities/tool-conditions.js +59 -0
- package/dist/esm/capabilities/tool-runtime.js +18 -4
- package/dist/esm/capabilities/tools.d.ts +3 -3
- package/dist/esm/capabilities/tools.js +12 -17
- package/dist/esm/context/audit.js +5 -8
- package/dist/esm/context/index.d.ts +3 -4
- package/dist/esm/context/index.js +3 -4
- package/dist/esm/diagnostics/index.d.ts +1 -0
- package/dist/esm/diagnostics/index.js +48 -2
- package/dist/esm/diagnostics/native-sub-flow.d.ts +94 -0
- package/dist/esm/diagnostics/native-sub-flow.js +101 -0
- package/dist/esm/diagnostics/sub-flow.d.ts +56 -4
- package/dist/esm/diagnostics/sub-flow.js +271 -32
- package/dist/esm/execution/engine.d.ts +1 -0
- package/dist/esm/execution/engine.js +3 -2
- package/dist/esm/execution/events.js +5 -5
- package/dist/esm/execution/reporting.d.ts +6 -12
- package/dist/esm/execution/reporting.js +19 -29
- package/dist/esm/execution/workflow-chain.d.ts +3 -0
- package/dist/esm/execution/workflow-chain.js +208 -0
- package/dist/esm/execution/workflow-graph.d.ts +7 -0
- package/dist/esm/execution/workflow-graph.js +68 -0
- package/dist/esm/execution/workflow.d.ts +6 -0
- package/dist/esm/execution/workflow.js +34 -6
- package/dist/esm/index.d.ts +19 -13
- package/dist/esm/index.js +18 -15
- package/dist/esm/kits/aggregation.d.ts +1 -1
- package/dist/esm/kits/aggregation.js +17 -14
- package/dist/esm/kits/answering/checks.js +2 -1
- package/dist/esm/kits/answering/flow.js +24 -21
- package/dist/esm/kits/answering/tasks.d.ts +6 -6
- package/dist/esm/kits/answering/tasks.js +30 -25
- package/dist/esm/kits/delivery.d.ts +0 -9
- package/dist/esm/kits/delivery.js +36 -24
- package/dist/esm/kits/domains/catalog.d.ts +42 -0
- package/dist/esm/kits/domains/catalog.js +110 -0
- package/dist/esm/kits/domains/index.d.ts +4 -0
- package/dist/esm/kits/domains/index.js +4 -0
- package/dist/esm/kits/domains/registry.d.ts +100 -0
- package/dist/esm/kits/{intents → domains}/registry.js +77 -31
- package/dist/esm/kits/{intents → domains}/scopes.d.ts +18 -18
- package/dist/esm/kits/{intents → domains}/scopes.js +21 -21
- package/dist/esm/kits/index.d.ts +6 -5
- package/dist/esm/kits/index.js +6 -5
- package/dist/esm/kits/knowledge/catalog.js +33 -30
- package/dist/esm/kits/policies.d.ts +1 -1
- package/dist/esm/kits/policies.js +3 -2
- package/dist/esm/kits/presentation/formats.d.ts +42 -0
- package/dist/esm/kits/presentation/formats.js +105 -0
- package/dist/esm/kits/presentation/index.d.ts +14 -5
- package/dist/esm/kits/presentation/index.js +10 -5
- package/dist/esm/kits/presentation/outputs.js +2 -1
- package/dist/esm/kits/reflection.js +3 -3
- package/dist/esm/kits/retrieval.js +7 -1
- package/dist/esm/kits/text-blocks.d.ts +24 -0
- package/dist/esm/kits/text-blocks.js +97 -0
- package/dist/esm/kits/tools.d.ts +69 -52
- package/dist/esm/kits/tools.js +247 -158
- package/dist/esm/model/decision-retry.d.ts +2 -0
- package/dist/esm/model/decision-retry.js +2 -1
- package/dist/esm/model/index.d.ts +2 -6
- package/dist/esm/model/index.js +2 -6
- package/dist/esm/model/interactions/calls.d.ts +40 -0
- package/dist/esm/model/interactions/calls.js +58 -0
- package/dist/esm/model/interactions/json-object.js +11 -11
- package/dist/esm/model/interactions/native-functions.js +17 -23
- package/dist/esm/model/message-diagnostics.d.ts +6 -5
- package/dist/esm/model/message-diagnostics.js +13 -3
- package/dist/esm/model/options.js +2 -0
- package/dist/esm/model/preparation.js +39 -6
- package/dist/esm/model/runner.d.ts +2 -0
- package/dist/esm/model/runner.js +34 -5
- package/dist/esm/model/selection-transport.js +4 -4
- package/dist/esm/model/token-budget.js +3 -0
- package/dist/esm/model/transports.d.ts +2 -1
- package/dist/esm/model/transports.js +3 -2
- package/dist/esm/structs/capabilities/invocation.d.ts +3 -1
- package/dist/esm/structs/capabilities/model.d.ts +42 -11
- package/dist/esm/structs/capabilities/tools.d.ts +16 -7
- package/dist/esm/structs/common.d.ts +3 -1
- package/dist/esm/structs/debug.d.ts +36 -20
- package/dist/esm/structs/execution/workflow-views.d.ts +123 -0
- package/dist/esm/structs/execution/workflow.d.ts +4 -3
- package/dist/esm/structs/index.d.ts +8 -6
- package/dist/esm/structs/index.js +7 -6
- package/dist/esm/structs/kits/answering/tasks.d.ts +2 -2
- package/dist/esm/structs/kits/{intents → domains}/catalog.d.ts +20 -20
- package/dist/esm/structs/kits/{intents → domains}/registry.d.ts +24 -21
- package/dist/esm/structs/kits/{intents → domains}/scopes.d.ts +9 -9
- package/dist/esm/structs/kits/domains/scopes.js +1 -0
- package/dist/esm/structs/kits/presentation/formats.d.ts +42 -0
- package/dist/esm/structs/kits/presentation/formats.js +1 -0
- package/dist/esm/structs/kits/text-blocks.d.ts +25 -0
- package/dist/esm/structs/kits/text-blocks.js +10 -0
- package/dist/esm/structs/kits/tools.d.ts +82 -83
- package/dist/esm/structs/model/interactions.d.ts +18 -11
- package/dist/esm/structs/model/messages.d.ts +34 -2
- package/dist/esm/structs/model/runtime.d.ts +9 -0
- package/dist/esm/structs/model/session.d.ts +29 -0
- package/dist/esm/structs/model/session.js +10 -0
- package/dist/esm/structs/support/associations.d.ts +22 -0
- package/dist/esm/structs/support/associations.js +1 -0
- package/dist/esm/structs/support/model/interactions.d.ts +2 -2
- package/dist/esm/structs/support/model/messages.d.ts +6 -13
- package/dist/esm/structs/support/tools.d.ts +23 -23
- package/dist/esm/support/associations.d.ts +26 -0
- package/dist/esm/support/associations.js +76 -0
- package/dist/esm/support/context/nodes.js +48 -45
- package/dist/esm/support/context/processing.js +6 -3
- package/dist/esm/support/context/snapshot.js +11 -1
- package/dist/esm/support/decorators/index.d.ts +13 -2
- package/dist/esm/support/decorators/index.js +40 -3
- package/dist/esm/support/decorators/pool.d.ts +6 -5
- package/dist/esm/support/decorators/types.d.ts +3 -1
- package/dist/esm/support/index.d.ts +1 -0
- package/dist/esm/support/index.js +1 -0
- package/dist/esm/support/model/capabilities.d.ts +8 -3
- package/dist/esm/support/model/capabilities.js +35 -5
- package/dist/esm/support/model/chat-completions.js +11 -2
- package/dist/esm/support/model/completion/calls.d.ts +6 -34
- package/dist/esm/support/model/completion/calls.js +8 -55
- package/dist/esm/support/model/index.d.ts +1 -1
- package/dist/esm/support/model/preview-rules.d.ts +13 -8
- package/dist/esm/support/model/preview-rules.js +11 -11
- package/dist/esm/support/model/reply-preview.d.ts +2 -2
- package/dist/esm/support/model/reply-preview.js +3 -3
- package/dist/esm/support/model/session.d.ts +61 -0
- package/dist/esm/support/model/session.js +148 -0
- package/dist/esm/support/model/stage-transport.d.ts +1 -1
- package/dist/esm/support/model/stage-transport.js +9 -9
- package/dist/esm/support/model/transports.d.ts +2 -0
- package/dist/esm/support/model/transports.js +2 -1
- package/dist/esm/support/tools.d.ts +11 -3
- package/dist/esm/support/tools.js +43 -18
- package/dist/esm/utils/catalog.d.ts +1 -1
- package/dist/esm/utils/invocation.d.ts +1 -0
- package/dist/esm/utils/invocation.js +1 -0
- package/package.json +20 -6
- package/dist/cjs/execution/index.js +0 -30
- package/dist/cjs/kits/intents/catalog.js +0 -82
- package/dist/cjs/kits/intents/index.js +0 -35
- package/dist/cjs/utils/debug.js +0 -30
- package/dist/esm/execution/index.d.ts +0 -11
- package/dist/esm/execution/index.js +0 -11
- package/dist/esm/kits/intents/catalog.d.ts +0 -39
- package/dist/esm/kits/intents/catalog.js +0 -79
- package/dist/esm/kits/intents/index.d.ts +0 -22
- package/dist/esm/kits/intents/index.js +0 -18
- package/dist/esm/kits/intents/registry.d.ts +0 -88
- package/dist/esm/utils/debug.d.ts +0 -27
- package/dist/esm/utils/debug.js +0 -27
- /package/dist/cjs/structs/{kits/intents/catalog.js → execution/workflow-views.js} +0 -0
- /package/dist/cjs/structs/kits/{intents/registry.js → domains/catalog.js} +0 -0
- /package/dist/cjs/structs/kits/{intents/scopes.js → domains/registry.js} +0 -0
- /package/dist/esm/structs/{kits/intents/catalog.js → execution/workflow-views.js} +0 -0
- /package/dist/esm/structs/kits/{intents/registry.js → domains/catalog.js} +0 -0
- /package/dist/esm/structs/kits/{intents/scopes.js → domains/registry.js} +0 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Exports: `defineAnswerFlow`, and the answer flow/item/result/check types.
|
|
9
9
|
*/
|
|
10
|
+
import { nativeSubFlowAsync } from '../../diagnostics/native-sub-flow.js';
|
|
10
11
|
import { booleanResult, synchronous } from '../../utils/synchronous.js';
|
|
11
12
|
import { awaitWithSignal } from '../../utils/cancellation.js';
|
|
12
13
|
import { AgentCoreEngine } from '../../execution/engine.js';
|
|
@@ -279,27 +280,29 @@ export function defineAnswerFlow(definition) {
|
|
|
279
280
|
* exhausted without a final result.
|
|
280
281
|
*/
|
|
281
282
|
async run(request, context) {
|
|
282
|
-
context
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
283
|
+
return nativeSubFlowAsync(context, 'answer', 'answer-flow', async () => {
|
|
284
|
+
context.signal.throwIfAborted();
|
|
285
|
+
validateAnswerBatch(request.inputIds, request.items, maxItems);
|
|
286
|
+
const cells = request.items.map((item) => ({
|
|
287
|
+
item: Object.freeze({
|
|
288
|
+
id: item.id,
|
|
289
|
+
data: item.data,
|
|
290
|
+
sourceStatus: item.sourceStatus,
|
|
291
|
+
inputIds: Object.freeze([...item.inputIds]),
|
|
292
|
+
}),
|
|
293
|
+
hasValue: false,
|
|
294
|
+
local: { status: 'not-run', issues: [] },
|
|
295
|
+
review: { status: 'not-run', issues: [] },
|
|
296
|
+
knownReviewFailure: false,
|
|
297
|
+
}));
|
|
298
|
+
return new AgentCoreEngine({
|
|
299
|
+
maxRounds: maxRepairs + 1,
|
|
300
|
+
errors: { exhausted: () => new TypeError('Answer flow exhausted') },
|
|
301
|
+
execution: { signal: context.signal, diagnostics: context.diagnostics },
|
|
302
|
+
})
|
|
303
|
+
.bindWorkflow(workflow, context.app)
|
|
304
|
+
.run({ cells, pending: [], repairBudget: new AttemptBudget(maxRepairs) });
|
|
305
|
+
});
|
|
303
306
|
},
|
|
304
307
|
});
|
|
305
308
|
}
|
|
@@ -36,7 +36,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
36
36
|
readerId: string;
|
|
37
37
|
outputId: string;
|
|
38
38
|
scopeId: string | undefined;
|
|
39
|
-
|
|
39
|
+
goalIds: readonly any[];
|
|
40
40
|
checkIds: readonly any[];
|
|
41
41
|
metadata: Data;
|
|
42
42
|
}[];
|
|
@@ -64,7 +64,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
64
64
|
readerId: string;
|
|
65
65
|
outputId: string;
|
|
66
66
|
scopeId: string | undefined;
|
|
67
|
-
|
|
67
|
+
goalIds: readonly any[];
|
|
68
68
|
checkIds: readonly any[];
|
|
69
69
|
inputSchema: import("../../index.js").SchemaAdapter<Input>;
|
|
70
70
|
metadata: Data;
|
|
@@ -76,7 +76,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
76
76
|
readerId: string;
|
|
77
77
|
outputId: string;
|
|
78
78
|
scopeId: string | undefined;
|
|
79
|
-
|
|
79
|
+
goalIds: readonly any[];
|
|
80
80
|
checkIds: readonly any[];
|
|
81
81
|
inputSchema: import("../../index.js").SchemaAdapter<Input>;
|
|
82
82
|
metadata: Data;
|
|
@@ -87,7 +87,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
87
87
|
readerId: string;
|
|
88
88
|
outputId: string;
|
|
89
89
|
scopeId: string | undefined;
|
|
90
|
-
|
|
90
|
+
goalIds: readonly any[];
|
|
91
91
|
checkIds: readonly any[];
|
|
92
92
|
inputSchema: import("../../index.js").SchemaAdapter<Input>;
|
|
93
93
|
metadata: Data;
|
|
@@ -99,7 +99,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
99
99
|
readerId: string;
|
|
100
100
|
outputId: string;
|
|
101
101
|
scopeId: string | undefined;
|
|
102
|
-
|
|
102
|
+
goalIds: readonly any[];
|
|
103
103
|
checkIds: readonly any[];
|
|
104
104
|
inputSchema: import("../../index.js").SchemaAdapter<Input>;
|
|
105
105
|
metadata: Data;
|
|
@@ -110,7 +110,7 @@ export declare function defineAnswerTaskCatalog<Input, Evidence, App, Data = unk
|
|
|
110
110
|
readerId: string;
|
|
111
111
|
outputId: string;
|
|
112
112
|
scopeId: string | undefined;
|
|
113
|
-
|
|
113
|
+
goalIds: readonly any[];
|
|
114
114
|
checkIds: readonly any[];
|
|
115
115
|
inputSchema: import("../../index.js").SchemaAdapter<Input>;
|
|
116
116
|
metadata: Data;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Exports: `defineAnswerReaderCatalog`, `defineAnswerTaskCatalog`, and the task/reader types.
|
|
9
9
|
*/
|
|
10
|
+
import { nativeSubFlowSync, nativeSubFlowAsync } from '../../diagnostics/native-sub-flow.js';
|
|
10
11
|
import { readonlyCatalog } from '../../utils/catalog.js';
|
|
11
12
|
import { assertion, synchronous } from '../../utils/synchronous.js';
|
|
12
13
|
import { freezeSchema } from '../../utils/object.js';
|
|
@@ -50,10 +51,10 @@ export function defineAnswerTaskCatalog(definitions, ports) {
|
|
|
50
51
|
!definition.description?.trim() ||
|
|
51
52
|
!readers.has(definition.readerId) ||
|
|
52
53
|
!outputs.has(definition.outputId) ||
|
|
53
|
-
!Array.isArray(definition.
|
|
54
|
-
!definition.
|
|
55
|
-
definition.
|
|
56
|
-
new Set(definition.
|
|
54
|
+
!Array.isArray(definition.goalIds) ||
|
|
55
|
+
!definition.goalIds.length ||
|
|
56
|
+
definition.goalIds.some((id) => typeof id !== 'string' || !id.trim()) ||
|
|
57
|
+
new Set(definition.goalIds).size !== definition.goalIds.length ||
|
|
57
58
|
!Array.isArray(definition.checkIds) ||
|
|
58
59
|
new Set(definition.checkIds).size !== definition.checkIds.length ||
|
|
59
60
|
definition.checkIds.some((id) => !checkIds.includes(id)))
|
|
@@ -67,7 +68,7 @@ export function defineAnswerTaskCatalog(definitions, ports) {
|
|
|
67
68
|
readerId: definition.readerId,
|
|
68
69
|
outputId: definition.outputId,
|
|
69
70
|
scopeId: definition.scopeId,
|
|
70
|
-
|
|
71
|
+
goalIds: Object.freeze([...definition.goalIds]),
|
|
71
72
|
checkIds: Object.freeze([...definition.checkIds]),
|
|
72
73
|
inputSchema: snapshotSchemaAdapter(definition.inputSchema),
|
|
73
74
|
metadata,
|
|
@@ -96,16 +97,18 @@ export function defineAnswerTaskCatalog(definitions, ports) {
|
|
|
96
97
|
* @throws TypeError For an unknown task, a parse failure, or a reader returning a Promise.
|
|
97
98
|
*/
|
|
98
99
|
read(request, context) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
return nativeSubFlowSync(context, 'task', request.taskId, () => {
|
|
101
|
+
const { input, task, reader } = prepare(request, context);
|
|
102
|
+
const value = synchronous(reader.read(input, {
|
|
103
|
+
...context,
|
|
104
|
+
app: context.app,
|
|
105
|
+
signal: context.signal,
|
|
106
|
+
diagnostics: context.diagnostics,
|
|
107
|
+
task,
|
|
108
|
+
}), 'Synchronous answer readers must not return a Promise');
|
|
109
|
+
context.signal.throwIfAborted();
|
|
110
|
+
return value;
|
|
111
|
+
});
|
|
109
112
|
},
|
|
110
113
|
/**
|
|
111
114
|
* Read evidence through a task's registered reader, awaiting an async reader.
|
|
@@ -113,16 +116,18 @@ export function defineAnswerTaskCatalog(definitions, ports) {
|
|
|
113
116
|
* @throws TypeError For an unknown task or a parse failure; aborts with the caller's signal.
|
|
114
117
|
*/
|
|
115
118
|
async readAsync(request, context) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
return nativeSubFlowAsync(context, 'task', request.taskId, async () => {
|
|
120
|
+
const { input, task, reader } = prepare(request, context);
|
|
121
|
+
const value = await awaitWithSignal(reader.read(input, {
|
|
122
|
+
...context,
|
|
123
|
+
app: context.app,
|
|
124
|
+
signal: context.signal,
|
|
125
|
+
diagnostics: context.diagnostics,
|
|
126
|
+
task,
|
|
127
|
+
}), context.signal);
|
|
128
|
+
context.signal.throwIfAborted();
|
|
129
|
+
return value;
|
|
130
|
+
});
|
|
126
131
|
},
|
|
127
132
|
});
|
|
128
133
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Delivery Kit: run an ordered, synchronous stage pipeline that ends with one result.
|
|
3
|
-
*
|
|
4
|
-
* Place in the package: an optional App-side delivery pipeline (for example formatting and
|
|
5
|
-
* sending one reply). The Kit owns ordering, cancellation checks and outcome validation; the
|
|
6
|
-
* stages, their state and the actual side effects belong to the App.
|
|
7
|
-
*
|
|
8
|
-
* Exports: `defineDelivery`, `Delivery`, and the delivery option/outcome types.
|
|
9
|
-
*/
|
|
10
1
|
import type { DeliveryOptions } from '../structs/kits/delivery.js';
|
|
11
2
|
import type { ExecutionContext } from '../structs/common.js';
|
|
12
3
|
/**
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivery Kit: run an ordered, synchronous stage pipeline that ends with one result.
|
|
3
|
+
*
|
|
4
|
+
* Place in the package: an optional App-side delivery pipeline (for example formatting and
|
|
5
|
+
* sending one reply). The Kit owns ordering, cancellation checks and outcome validation; the
|
|
6
|
+
* stages, their state and the actual side effects belong to the App.
|
|
7
|
+
*
|
|
8
|
+
* Exports: `defineDelivery`, `Delivery`, and the delivery option/outcome types.
|
|
9
|
+
*/
|
|
10
|
+
import { nativeSubFlowSync } from '../diagnostics/native-sub-flow.js';
|
|
1
11
|
import { synchronous } from '../utils/synchronous.js';
|
|
2
12
|
/**
|
|
3
13
|
* Compile a delivery pipeline from its declared stages.
|
|
@@ -38,33 +48,35 @@ export function defineDelivery(options) {
|
|
|
38
48
|
* handler results.
|
|
39
49
|
*/
|
|
40
50
|
deliver(input, execution) {
|
|
41
|
-
execution
|
|
42
|
-
const state = synchronous(createState(input, execution), 'Delivery state creation must be synchronous');
|
|
43
|
-
const context = {
|
|
44
|
-
...execution,
|
|
45
|
-
signal: execution.signal,
|
|
46
|
-
diagnostics: execution.diagnostics,
|
|
47
|
-
app: input,
|
|
48
|
-
};
|
|
49
|
-
for (const stage of stages) {
|
|
51
|
+
return nativeSubFlowSync(execution, 'delivery', 'delivery', () => {
|
|
50
52
|
execution.signal.throwIfAborted();
|
|
51
|
-
synchronous(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
const state = synchronous(createState(input, execution), 'Delivery state creation must be synchronous');
|
|
54
|
+
const context = {
|
|
55
|
+
...execution,
|
|
56
|
+
signal: execution.signal,
|
|
57
|
+
diagnostics: execution.diagnostics,
|
|
58
|
+
app: input,
|
|
59
|
+
};
|
|
60
|
+
for (const stage of stages) {
|
|
61
|
+
execution.signal.throwIfAborted();
|
|
62
|
+
synchronous(beforeStage?.({ stageId: stage.id, state }, context), 'Delivery hooks must be synchronous');
|
|
63
|
+
execution.signal.throwIfAborted();
|
|
64
|
+
if (!stage.handle)
|
|
65
|
+
continue;
|
|
66
|
+
const outcome = synchronous(stage.handle(state, context), 'Delivery handlers must be synchronous');
|
|
63
67
|
execution.signal.throwIfAborted();
|
|
64
|
-
|
|
68
|
+
if (!outcome ||
|
|
69
|
+
!['continue', 'complete'].includes(outcome.type) ||
|
|
70
|
+
(outcome.type === 'complete' && !('value' in outcome)))
|
|
71
|
+
throw new TypeError('Delivery handlers require explicit continue/complete');
|
|
72
|
+
if (outcome.type === 'complete') {
|
|
73
|
+
const value = outcome.value;
|
|
74
|
+
execution.signal.throwIfAborted();
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
65
77
|
}
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
throw synchronous(missingResult(), 'Delivery errors must be synchronous');
|
|
79
|
+
});
|
|
68
80
|
},
|
|
69
81
|
});
|
|
70
82
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ModelTool } from '../../structs/capabilities/model.js';
|
|
2
|
+
import type { AgentCatalogPorts, CatalogGoal, CatalogScope } from '../../structs/kits/domains/catalog.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compile a catalog projection over the App's live registries.
|
|
5
|
+
*
|
|
6
|
+
* The actual registries determine availability and relationships. No parallel capability list
|
|
7
|
+
* exists: `goalIds` filters by tool support, `modelCatalog` narrows to the currently accepted
|
|
8
|
+
* task when `restrictToTask` is enabled, and scope tool ids are filtered to tools that exist.
|
|
9
|
+
*
|
|
10
|
+
* @param ports - Sources for Tool ids, goals, scopes, the current task, the tool registry
|
|
11
|
+
* and the `restrictToTask` switch.
|
|
12
|
+
* @returns A frozen projection with `goalIds`, `goalDelegates`, `goalCatalog`,
|
|
13
|
+
* `scopeCatalog` and `modelCatalog`.
|
|
14
|
+
* @throws TypeError When a supplied predicate does not return a boolean synchronously.
|
|
15
|
+
*/
|
|
16
|
+
export declare function defineAgentCatalog<App, Id extends string, Goal extends CatalogGoal<Id>, Scope extends CatalogScope>(ports: AgentCatalogPorts<App, Id, Goal, Scope>): Readonly<{
|
|
17
|
+
goalIds: (app: App) => Id[];
|
|
18
|
+
goalDelegates: (app?: App) => Map<Id, string[]>;
|
|
19
|
+
goalCatalog: (app: App) => (Omit<Goal & Partial<ModelTool<unknown, unknown, App>>, "resolve" | "inputSchema" | "active" | "asIntent"> & {
|
|
20
|
+
delegates: string[];
|
|
21
|
+
scopeIds: string[];
|
|
22
|
+
toolIds: string[];
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
})[];
|
|
25
|
+
scopeCatalog: (app: App) => (Scope & {
|
|
26
|
+
toolIds: string[];
|
|
27
|
+
})[];
|
|
28
|
+
modelCatalog(app: App): {
|
|
29
|
+
availableGoalIds: (Goal & Partial<ModelTool<unknown, unknown, App>>)["id"][];
|
|
30
|
+
availableGoals: (Omit<Goal & Partial<ModelTool<unknown, unknown, App>>, "resolve" | "inputSchema" | "active" | "asIntent"> & {
|
|
31
|
+
delegates: string[];
|
|
32
|
+
scopeIds: string[];
|
|
33
|
+
toolIds: string[];
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
})[];
|
|
36
|
+
availableScopes: (Scope & {
|
|
37
|
+
toolIds: string[];
|
|
38
|
+
})[];
|
|
39
|
+
availableTools: import("./catalog.js").DescribedTool[];
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
export type * from '../../structs/kits/domains/catalog.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Tools Kit: project registered goals, scopes and tools into one task-facing catalog.
|
|
3
|
+
*
|
|
4
|
+
* Place in the package: part of the domain Tool Kit. It reads the actual registries supplied by
|
|
5
|
+
* the App instead of maintaining a parallel capability list, so an intent is only advertised
|
|
6
|
+
* when its tools, scopes and availability agree.
|
|
7
|
+
*
|
|
8
|
+
* Exports: `defineAgentCatalog`, and the catalog intent/scope/port types.
|
|
9
|
+
*/
|
|
10
|
+
import { booleanResult } from '../../utils/synchronous.js';
|
|
11
|
+
import { toolActive } from '../../capabilities/tool-conditions.js';
|
|
12
|
+
/**
|
|
13
|
+
* Compile a catalog projection over the App's live registries.
|
|
14
|
+
*
|
|
15
|
+
* The actual registries determine availability and relationships. No parallel capability list
|
|
16
|
+
* exists: `goalIds` filters by tool support, `modelCatalog` narrows to the currently accepted
|
|
17
|
+
* task when `restrictToTask` is enabled, and scope tool ids are filtered to tools that exist.
|
|
18
|
+
*
|
|
19
|
+
* @param ports - Sources for Tool ids, goals, scopes, the current task, the tool registry
|
|
20
|
+
* and the `restrictToTask` switch.
|
|
21
|
+
* @returns A frozen projection with `goalIds`, `goalDelegates`, `goalCatalog`,
|
|
22
|
+
* `scopeCatalog` and `modelCatalog`.
|
|
23
|
+
* @throws TypeError When a supplied predicate does not return a boolean synchronously.
|
|
24
|
+
*/
|
|
25
|
+
export function defineAgentCatalog(ports) {
|
|
26
|
+
const ids = ports.goalIds.bind(ports), goals = ports.goals.bind(ports), scopes = ports.scopes.bind(ports), task = ports.currentTask.bind(ports);
|
|
27
|
+
const tools = {
|
|
28
|
+
values: ports.tools.values.bind(ports.tools),
|
|
29
|
+
has: ports.tools.has.bind(ports.tools),
|
|
30
|
+
supports: ports.tools.supportsGoal.bind(ports.tools),
|
|
31
|
+
describe: ports.tools.describe.bind(ports.tools),
|
|
32
|
+
};
|
|
33
|
+
const restrict = ports.restrictToTask !== false;
|
|
34
|
+
const boolean = (value) => booleanResult(value, 'Catalog predicates must be synchronous', 'Catalog predicates must return boolean');
|
|
35
|
+
/** Whether one goal is active and its demand metadata currently participates. */
|
|
36
|
+
const goalAvailable = (goal, app) => {
|
|
37
|
+
const tool = goal;
|
|
38
|
+
if (!toolActive(tool.active, app))
|
|
39
|
+
return false;
|
|
40
|
+
const metadata = tool.asIntent;
|
|
41
|
+
if (metadata === undefined || metadata === true || typeof metadata === 'string')
|
|
42
|
+
return true;
|
|
43
|
+
if (typeof metadata === 'function')
|
|
44
|
+
return toolActive(metadata, app);
|
|
45
|
+
return toolActive(metadata.when, app);
|
|
46
|
+
};
|
|
47
|
+
const goalIds = (app) => ids(app).filter((id) => boolean(tools.supports(id, app)));
|
|
48
|
+
const goalDelegates = (app) => new Map(goals().map((goal) => {
|
|
49
|
+
const metadata = goal.asIntent;
|
|
50
|
+
const explicit = typeof metadata === 'object' ? metadata.delegates : undefined;
|
|
51
|
+
return [
|
|
52
|
+
goal.id,
|
|
53
|
+
explicit
|
|
54
|
+
? [...explicit]
|
|
55
|
+
: [
|
|
56
|
+
...new Set([
|
|
57
|
+
...goal.delegates,
|
|
58
|
+
...[...tools.values()]
|
|
59
|
+
.filter((tool) => tool.lifecycle?.id &&
|
|
60
|
+
(app === undefined || toolActive(tool.active, app)) &&
|
|
61
|
+
(tool.goalIds === 'all' || tool.goalIds.includes(goal.id)))
|
|
62
|
+
.map((tool) => tool.lifecycle.id),
|
|
63
|
+
]),
|
|
64
|
+
],
|
|
65
|
+
];
|
|
66
|
+
}));
|
|
67
|
+
const goalCatalog = (app) => {
|
|
68
|
+
const selected = goalIds(app), described = tools.describe('model', app), delegates = goalDelegates(app);
|
|
69
|
+
return goals(selected)
|
|
70
|
+
.filter((goal) => goalAvailable(goal, app))
|
|
71
|
+
.map((goal) => {
|
|
72
|
+
const { inputSchema: _schema, resolve: _resolve, active: _active, asIntent: _asIntent, ...metadata } = goal;
|
|
73
|
+
const demandDescription = typeof _asIntent === 'string'
|
|
74
|
+
? _asIntent
|
|
75
|
+
: typeof _asIntent === 'object' && _asIntent !== null
|
|
76
|
+
? _asIntent.description
|
|
77
|
+
: undefined;
|
|
78
|
+
return {
|
|
79
|
+
...metadata,
|
|
80
|
+
...(demandDescription ? { description: demandDescription } : {}),
|
|
81
|
+
delegates: delegates.get(goal.id) ?? [...goal.delegates],
|
|
82
|
+
scopeIds: scopes([goal.id]).map((scope) => scope.id),
|
|
83
|
+
toolIds: described
|
|
84
|
+
.filter((tool) => tool.goalIds.includes(goal.id))
|
|
85
|
+
.map((tool) => tool.id),
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const scopeCatalog = (app) => scopes(goalCatalog(app).map((goal) => goal.id)).map((scope) => ({
|
|
90
|
+
...scope,
|
|
91
|
+
toolIds: scope.toolIds.filter(tools.has),
|
|
92
|
+
}));
|
|
93
|
+
return Object.freeze({
|
|
94
|
+
goalIds,
|
|
95
|
+
goalDelegates,
|
|
96
|
+
goalCatalog,
|
|
97
|
+
scopeCatalog,
|
|
98
|
+
modelCatalog(app) {
|
|
99
|
+
const accepted = restrict ? task(app) : undefined, selected = goalIds(app).filter((id) => !accepted || id === accepted.goalId), available = goalCatalog(app).filter((intent) => selected.includes(intent.id));
|
|
100
|
+
return {
|
|
101
|
+
availableGoalIds: available.map((intent) => intent.id),
|
|
102
|
+
availableGoals: available.map((intent) => accepted ? { ...intent, scopeIds: accepted.scopeId ? [accepted.scopeId] : [] } : intent),
|
|
103
|
+
availableScopes: scopeCatalog(app).filter((scope) => !accepted || scope.id === accepted.scopeId),
|
|
104
|
+
availableTools: tools
|
|
105
|
+
.describe('model', app)
|
|
106
|
+
.filter((tool) => !accepted || tool.goalIds.includes(accepted.goalId)),
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Tools Kit: an ordered, sealable registry of domain Tool declarations.
|
|
3
|
+
*
|
|
4
|
+
* Place in the package: part of the domain Tool Kit. Goal semantics and the allowed vocabulary
|
|
5
|
+
* (scope modes, target modes, context tiers, delegates, actions) are App configuration; this class
|
|
6
|
+
* owns the common lifecycle — validation, ordering, duplicate detection and sealing.
|
|
7
|
+
*
|
|
8
|
+
* Exports: `IntentRegistry`, `createIntentRegistry`, and the domain Tool registry types.
|
|
9
|
+
*/
|
|
10
|
+
import type { IntentTool, IntentToolRegistration, IntentDescription, IntentPolicy, IntentId, RegisteredIntent } from '../../structs/kits/domains/registry.js';
|
|
11
|
+
import { ModelToolRegistry } from '../../capabilities/model.js';
|
|
12
|
+
/**
|
|
13
|
+
* Goal semantics and allowed values are configuration; the registry owns their common lifecycle.
|
|
14
|
+
*
|
|
15
|
+
* Registration order is preserved by `ids`, `definitions`, `values` and `entries`; once
|
|
16
|
+
* `seal()` is called the set is final and further registration is rejected.
|
|
17
|
+
*/
|
|
18
|
+
export declare class IntentRegistry<Definition extends IntentToolRegistration = IntentToolRegistration> {
|
|
19
|
+
/** Create and seal a complete catalog in one call. */
|
|
20
|
+
static readonly create: typeof createIntentRegistry;
|
|
21
|
+
private readonly byId;
|
|
22
|
+
private sealed;
|
|
23
|
+
private modelView?;
|
|
24
|
+
private readonly policy;
|
|
25
|
+
/**
|
|
26
|
+
* @param policy - Optional id pattern, vocabulary lists, error wording and assertion hook.
|
|
27
|
+
* Lists and the pattern are copied so later mutation of the input cannot weaken checks.
|
|
28
|
+
*/
|
|
29
|
+
constructor(policy?: IntentPolicy<Definition>);
|
|
30
|
+
/**
|
|
31
|
+
* Validate, freeze and add one domain Tool.
|
|
32
|
+
*
|
|
33
|
+
* Checks run in a fixed order — sealed, identity, context contract, auxiliary actions,
|
|
34
|
+
* handoff, plan, delegates — so the reported violation is stable when several rules fail.
|
|
35
|
+
*
|
|
36
|
+
* @param input - Goal declaration; the App's own assertion receives this original object,
|
|
37
|
+
* not the compiled copy, so helpers and prototype methods keep working.
|
|
38
|
+
* @returns This registry, for chaining.
|
|
39
|
+
* @throws A configured error for a sealed registry, invalid identity or vocabulary values,
|
|
40
|
+
* empty/duplicate delegates, or a duplicate Tool id.
|
|
41
|
+
*/
|
|
42
|
+
register(input: Definition): this;
|
|
43
|
+
/** Register every domain Tool in iteration order. */
|
|
44
|
+
registerAll(definitions: Iterable<Definition>): this;
|
|
45
|
+
/** Registered domain Tool for `id`, or `undefined` when it is absent. */
|
|
46
|
+
get(goal: string): RegisteredIntent<Definition> | undefined;
|
|
47
|
+
/** Whether a Tool id is registered. */
|
|
48
|
+
has(goal: string): boolean;
|
|
49
|
+
/** Registered Tool ids in registration order. */
|
|
50
|
+
ids(): readonly IntentId<Definition>[];
|
|
51
|
+
/** Registered goals in registration order. */
|
|
52
|
+
get definitions(): readonly RegisteredIntent<Definition>[];
|
|
53
|
+
/** Iterate the registered goals. */
|
|
54
|
+
values(): MapIterator<Readonly<Omit<Readonly<IntentTool & import("../../utils/registration.js").RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & import("../../index.js").ModelTool<any, any, any> & { readonly [Key in keyof Pick<Definition, Extract<keyof Definition, "delegates" | "auxiliaryActions">>]: Readonly<Definition[Key]>; } & {
|
|
55
|
+
id: Definition["id"];
|
|
56
|
+
delegates: Readonly<NonNullable<Definition["delegates"]>>;
|
|
57
|
+
}>>;
|
|
58
|
+
/** Demand discovery uses tool metadata; domain fields remain attached to these same IDs. */
|
|
59
|
+
withIntent(context: unknown): ModelToolRegistry;
|
|
60
|
+
/** Resolve a grouped transport's selected Tool through that Tool's own parser and resolver. */
|
|
61
|
+
resolve(selection: import('../../structs/capabilities/model.js').ModelSelection, context: Readonly<{
|
|
62
|
+
stageId: string;
|
|
63
|
+
}>): unknown;
|
|
64
|
+
/** Explicit node selection uses the same immutable model projection. */
|
|
65
|
+
select(ids: readonly string[], ...context: [] | [unknown]): ModelToolRegistry;
|
|
66
|
+
/** Cache only immutable declarations; request activation is evaluated by each projection. */
|
|
67
|
+
private models;
|
|
68
|
+
/** Iterate `[id, tool]` pairs. */
|
|
69
|
+
entries(): MapIterator<[string, Readonly<Omit<Readonly<IntentTool & import("../../utils/registration.js").RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & import("../../index.js").ModelTool<any, any, any> & { readonly [Key in keyof Pick<Definition, Extract<keyof Definition, "delegates" | "auxiliaryActions">>]: Readonly<Definition[Key]>; } & {
|
|
70
|
+
id: Definition["id"];
|
|
71
|
+
delegates: Readonly<NonNullable<Definition["delegates"]>>;
|
|
72
|
+
}>]>;
|
|
73
|
+
/**
|
|
74
|
+
* Registered domain Tool for `id`.
|
|
75
|
+
*
|
|
76
|
+
* @throws TypeError When the id is not registered.
|
|
77
|
+
*/
|
|
78
|
+
require(id: string): RegisteredIntent<Definition>;
|
|
79
|
+
/** Whether the Tool declares this delegate; unknown goals allow nothing. */
|
|
80
|
+
allows(goal: string, delegate: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Copy the selected goals out of the registry.
|
|
83
|
+
*
|
|
84
|
+
* @param goals - Ids to include; the default is every registered id, in registry order.
|
|
85
|
+
* @returns Descriptions whose arrays are copied so callers cannot mutate registry state.
|
|
86
|
+
*/
|
|
87
|
+
describe(goals?: readonly string[]): IntentDescription<Definition>[];
|
|
88
|
+
/** Finalize the registry; no registration is accepted afterwards. */
|
|
89
|
+
seal(): this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create and seal a complete catalog; use the constructor for incremental installation.
|
|
93
|
+
*
|
|
94
|
+
* @param definitions - Goal declarations registered in iteration order.
|
|
95
|
+
* @param policy - Optional registry policy forwarded to the constructor.
|
|
96
|
+
* @returns A sealed registry.
|
|
97
|
+
* @throws A configured error for the first invalid or duplicate declaration.
|
|
98
|
+
*/
|
|
99
|
+
export declare function createIntentRegistry<Definition extends IntentToolRegistration>(definitions: Iterable<Definition>, policy?: IntentPolicy<Definition>): IntentRegistry<Definition>;
|
|
100
|
+
export type { IntentTool, IntentToolRegistration, IntentDescription, IntentPolicy, IntentId, RegisteredIntent, } from '../../structs/kits/domains/registry.js';
|