IntentRegistry
KIT · class · Runtime value
Goal semantics and allowed values are configuration; the registry owns their common lifecycle.
Registration order is preserved by ids, definitions, values and entries; once seal() is called the set is final and further registration is rejected.
Import
import { IntentRegistry } from '@jangts/agent-core/kits/domains';import { IntentRegistry } from '@jangts/agent-core/kits/domains';Other public entry points:@jangts/agent-core, @jangts/agent-core/types, @jangts/agent-core/kits/domains, @jangts/agent-core/kits.
Definition
class IntentRegistry<Definition>Type parameters
| Type parameter | Constraint | Default type |
|---|---|---|
Definition | IntentToolRegistration | IntentToolRegistration |
Constructor
new IntentRegistry<Definition extends IntentToolRegistration = IntentToolRegistration>(policy?: IntentPolicy<Definition>): IntentRegistry<Definition>| Parameter | Type | Passing | Description |
|---|---|---|---|
policy | IntentPolicy<Definition> | Optional | — |
Fields of policy
| Field | Type | Required | Description |
|---|---|---|---|
idPattern | RegExp | undefined | Optional | Read-only. Pattern every Tool id must match. |
scopeModes | readonly string[] | undefined | Optional | Read-only. Allowed scopePolicy values; undefined accepts any value. |
targetModes | readonly string[] | undefined | Optional | Read-only. Allowed targetPolicy values; undefined accepts any value. |
contextTiers | readonly string[] | undefined | Optional | Read-only. Allowed contextTier values; undefined accepts any value. |
actions | readonly string[] | undefined | Optional | Read-only. Allowed planIntent values; undefined accepts any value. |
delegates | readonly string[] | undefined | Optional | Read-only. Allowed delegate ids; undefined accepts any non-empty delegate. |
handoffValues | readonly unknown[] | undefined | Optional | Read-only. Allowed preparedHandoff values; undefined accepts any value. |
assertDefinition | ((definition: Definition) => void) | undefined | Optional | Read-only. Extra App assertion, called after the built-in checks; must return void synchronously. |
tags | readonly string[] | undefined | Optional | Read-only. Diagnostic tags attached to registration rejections. |
errors | { readonly sealed?: BreakReason; readonly invalid?: BreakReason; readonly duplicate?: (goal: string) => Error | string; } | undefined | Optional | Read-only. See the type definition and usage context. |
Returns: IntentRegistry<Definition>.
Instance properties
| Field | Type | Required | Description |
|---|---|---|---|
definitions | readonly Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>[] | Required | Read-only. Registered goals in registration order. |
Member index
| Member | Purpose |
|---|---|
create | Static. Create and seal a complete catalog in one call. |
register | Validate, freeze and add one domain Tool. Checks run in a fixed order — sealed, identity, context contract, auxiliary actions, handoff, plan, delegates — so the reported violation is stable when several rules fail. |
registerAll | Register every domain Tool in iteration order. |
get | Registered domain Tool for id, or undefined when it is absent. |
has | Whether a Tool id is registered. |
ids | Registered Tool ids in registration order. |
values | Iterate the registered goals. |
withIntent | Demand discovery uses tool metadata; domain fields remain attached to these same IDs. |
resolve | Resolve a grouped transport's selected Tool through that Tool's own parser and resolver. |
select | Explicit node selection uses the same immutable model projection. |
entries | Iterate [id, tool] pairs. |
require | Registered domain Tool for id. |
allows | Whether the Tool declares this delegate; unknown goals allow nothing. |
describe | Copy the selected goals out of the registry. |
seal | Finalize the registry; no registration is accepted afterwards. |
Member details
create
Static member.
Create and seal a complete catalog in one call.
IntentRegistry.create<Definition extends IntentToolRegistration>(definitions: Iterable<Definition>, policy?: IntentPolicy<Definition>): IntentRegistry<Definition>Create and seal a complete catalog; use the constructor for incremental installation.
| Type parameter | Constraint | Default type |
|---|---|---|
Definition | IntentToolRegistration | — |
| Parameter | Type | Passing | Description |
|---|---|---|---|
definitions | Iterable<Definition> | Required | — |
policy | IntentPolicy<Definition> | Optional | — |
Fields of policy
| Field | Type | Required | Description |
|---|---|---|---|
idPattern | RegExp | undefined | Optional | Read-only. Pattern every Tool id must match. |
scopeModes | readonly string[] | undefined | Optional | Read-only. Allowed scopePolicy values; undefined accepts any value. |
targetModes | readonly string[] | undefined | Optional | Read-only. Allowed targetPolicy values; undefined accepts any value. |
contextTiers | readonly string[] | undefined | Optional | Read-only. Allowed contextTier values; undefined accepts any value. |
actions | readonly string[] | undefined | Optional | Read-only. Allowed planIntent values; undefined accepts any value. |
delegates | readonly string[] | undefined | Optional | Read-only. Allowed delegate ids; undefined accepts any non-empty delegate. |
handoffValues | readonly unknown[] | undefined | Optional | Read-only. Allowed preparedHandoff values; undefined accepts any value. |
assertDefinition | ((definition: Definition) => void) | undefined | Optional | Read-only. Extra App assertion, called after the built-in checks; must return void synchronously. |
tags | readonly string[] | undefined | Optional | Read-only. Diagnostic tags attached to registration rejections. |
errors | { readonly sealed?: BreakReason; readonly invalid?: BreakReason; readonly duplicate?: (goal: string) => Error | string; } | undefined | Optional | Read-only. See the type definition and usage context. |
Returns: IntentRegistry<Definition>.
register
Instance method.
Validate, freeze and add one domain Tool.
Checks run in a fixed order — sealed, identity, context contract, auxiliary actions, handoff, plan, delegates — so the reported violation is stable when several rules fail.
register(input: Definition): IntentRegistry<Definition>Validate, freeze and add one domain Tool.
Checks run in a fixed order — sealed, identity, context contract, auxiliary actions, handoff, plan, delegates — so the reported violation is stable when several rules fail.
| Parameter | Type | Passing | Description |
|---|---|---|---|
input | Definition | Required | — |
Returns: IntentRegistry<Definition>.
registerAll
Instance method.
Register every domain Tool in iteration order.
registerAll(definitions: Iterable<Definition>): IntentRegistry<Definition>Register every domain Tool in iteration order.
| Parameter | Type | Passing | Description |
|---|---|---|---|
definitions | Iterable<Definition> | Required | — |
Returns: IntentRegistry<Definition>.
get
Instance method.
Registered domain Tool for id, or undefined when it is absent.
get(goal: string): RegisteredIntent<Definition> | undefinedRegistered domain Tool for id, or undefined when it is absent.
| Parameter | Type | Passing | Description |
|---|---|---|---|
goal | string | Required | — |
Returns: Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" \| "inputSchema" \| "delegates" \| "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }> \| undefined.
Optional shapes of Return value: choose one shape; required fields for each branch are listed separately.
Branch 1
undefined
Branch 2
| Field | Type | Required | Description |
|---|---|---|---|
id | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["id"] | Required | Unique Tool id, matched against the policy's idPattern when configured. Unique id within its registry; never blank. |
description | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["description"] | Required | Non-blank model-facing description. Model-visible description explaining when the capability applies. |
active | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["active"] | undefined | Optional | Read-only. Omitted means active. Authorization remains a separate execution boundary. |
asIntent | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["asIntent"] | undefined | Optional | Read-only. Omitted means this tool is not advertised by withIntent(). |
scopePolicy | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["scopePolicy"] | undefined | Optional | App-declared scope-mode name; validated against policy.scopeModes when that is set. |
targetPolicy | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["targetPolicy"] | undefined | Optional | App-declared target-mode name; validated against policy.targetModes when that is set. |
contextTier | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["contextTier"] | undefined | Optional | App-declared context tier; validated against policy.contextTiers when that is set. |
planIntent | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["planIntent"] | undefined | Optional | App-declared planning action; validated against policy.actions when that is set. |
preparedHandoff | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["preparedHandoff"] | undefined | Optional | App-declared handoff marker; validated against policy.handoffValues when that is set. |
inputSchema | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["inputSchema"] | Required | Read-only. Schema describing the arguments; must be an object schema. |
resolve | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["resolve"] | Required | Converts validated arguments into the value handed back to the caller. Runs inside the model call, so it must return synchronously; throwing rejects the selection. |
delegates | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["delegates"] | Required | Allowed delegate ids, retained in declaration order without imposing execution order; non-empty and unique. |
auxiliaryActions | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["auxiliaryActions"] | undefined | Optional | Additional actions the intent may use; must be unique. |
has
Instance method.
Whether a Tool id is registered.
has(goal: string): booleanWhether a Tool id is registered.
| Parameter | Type | Passing | Description |
|---|---|---|---|
goal | string | Required | — |
Returns: boolean.
ids
Instance method.
Registered Tool ids in registration order.
ids(): readonly IntentId<Definition>[]Registered Tool ids in registration order.
No call parameters.
Returns: readonly IntentId<Definition>[].
values
Instance method.
Iterate the registered goals.
values(): MapIterator<Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>>Iterate the registered goals.
No call parameters.
Returns: MapIterator<Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" \| "inputSchema" \| "delegates" \| "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>>.
withIntent
Instance method.
Demand discovery uses tool metadata; domain fields remain attached to these same IDs.
withIntent(context: unknown): ModelToolRegistryDemand discovery uses tool metadata; domain fields remain attached to these same IDs.
| Parameter | Type | Passing | Description |
|---|---|---|---|
context | unknown | Required | — |
Returns: ModelToolRegistry.
resolve
Instance method.
Resolve a grouped transport's selected Tool through that Tool's own parser and resolver.
resolve(selection: import("../../structs/capabilities/model.js").ModelSelection, context: Readonly<{ stageId: string; }>): unknownResolve a grouped transport's selected Tool through that Tool's own parser and resolver.
| Parameter | Type | Passing | Description |
|---|---|---|---|
selection | ModelSelection | Required | — |
context | Readonly<{ stageId: string; }> | Required | — |
Fields of selection
| Field | Type | Required | Description |
|---|---|---|---|
input | Record<string, unknown> | Required | Read-only. Arguments exactly as produced by the model, before schema parsing. |
call | { id: string; name: string; argumentChars: number; } | undefined | Optional | Read-only. Native function call that carried the selection, when the provider used one. |
toolId | string | Required | Read-only. Capability the selection resolved to. |
Fields of context
| Field | Type | Required | Description |
|---|---|---|---|
stageId | string | Required | See the type definition and usage context. |
Returns: unknown.
select
Instance method.
Explicit node selection uses the same immutable model projection.
select(ids: readonly string[], ...context: [] | [unknown]): ModelToolRegistryExplicit node selection uses the same immutable model projection.
| Parameter | Type | Passing | Description |
|---|---|---|---|
ids | readonly string[] | Required | — |
context | [] | [unknown] | Rest parameter | — |
Returns: ModelToolRegistry.
entries
Instance method.
Iterate [id, tool] pairs.
entries(): MapIterator<[string, Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>]>Iterate [id, tool] pairs.
No call parameters.
Returns: MapIterator<[string, Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" \| "inputSchema" \| "delegates" \| "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>]>.
require
Instance method.
Registered domain Tool for id.
require(id: string): RegisteredIntent<Definition>Registered domain Tool for id.
| Parameter | Type | Passing | Description |
|---|---|---|---|
id | string | Required | — |
Returns: Readonly<Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" \| "inputSchema" \| "delegates" \| "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; }>.
Return value structure
| Field | Type | Required | Description |
|---|---|---|---|
id | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["id"] | Required | Unique Tool id, matched against the policy's idPattern when configured. Unique id within its registry; never blank. |
description | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["description"] | Required | Non-blank model-facing description. Model-visible description explaining when the capability applies. |
active | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["active"] | undefined | Optional | Read-only. Omitted means active. Authorization remains a separate execution boundary. |
asIntent | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["asIntent"] | undefined | Optional | Read-only. Omitted means this tool is not advertised by withIntent(). |
scopePolicy | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["scopePolicy"] | undefined | Optional | App-declared scope-mode name; validated against policy.scopeModes when that is set. |
targetPolicy | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["targetPolicy"] | undefined | Optional | App-declared target-mode name; validated against policy.targetModes when that is set. |
contextTier | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["contextTier"] | undefined | Optional | App-declared context tier; validated against policy.contextTiers when that is set. |
planIntent | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["planIntent"] | undefined | Optional | App-declared planning action; validated against policy.actions when that is set. |
preparedHandoff | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["preparedHandoff"] | undefined | Optional | App-declared handoff marker; validated against policy.handoffValues when that is set. |
inputSchema | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["inputSchema"] | Required | Read-only. Schema describing the arguments; must be an object schema. |
resolve | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["resolve"] | Required | Converts validated arguments into the value handed back to the caller. Runs inside the model call, so it must return synchronously; throwing rejects the selection. |
delegates | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["delegates"] | Required | Allowed delegate ids, retained in declaration order without imposing execution order; non-empty and unique. |
auxiliaryActions | (Omit<Readonly<IntentTool & RegistrationData<Definition> & Pick<Definition, Extract<keyof Definition, keyof IntentTool>>>, "resolve" | "inputSchema" | "delegates" | "auxiliaryActions"> & ModelTool<any, any, any> & RegisteredIntentLists<Definition> & { id: Definition["id"]; delegates: Readonly<NonNullable<Definition["delegates"]>>; })["auxiliaryActions"] | undefined | Optional | Additional actions the intent may use; must be unique. |
allows
Instance method.
Whether the Tool declares this delegate; unknown goals allow nothing.
allows(goal: string, delegate: string): booleanWhether the Tool declares this delegate; unknown goals allow nothing.
| Parameter | Type | Passing | Description |
|---|---|---|---|
goal | string | Required | — |
delegate | string | Required | — |
Returns: boolean.
describe
Instance method.
Copy the selected goals out of the registry.
describe(goals?: readonly string[]): IntentDescription<Definition>[]Copy the selected goals out of the registry.
| Parameter | Type | Passing | Description |
|---|---|---|---|
goals | readonly string[] | Optional | — |
Returns: IntentDescription<Definition>[].
seal
Instance method.
Finalize the registry; no registration is accepted afterwards.
seal(): IntentRegistry<Definition>Finalize the registry; no registration is accepted afterwards.
No call parameters.
Returns: IntentRegistry<Definition>.
Examples
- Domain Tools: tool declarations and scope relationships: One list provides the available tools, allowed delegates, scope aliases, sources, and tool relationships.
Register one tool that explains an interface
Beginner · Node.js
import { IntentRegistry, ScopeRegistry } from '@jangts/agent-core/kits/domains';
const tools = IntentRegistry.create([
{ id: 'explain', description: '根据资料解释 SDK', delegates: ['read', 'reply'], asIntent: true },
]);
console.log(tools.ids(), tools.allows('explain', 'read'));
const scopes = ScopeRegistry.create([
{ id: 'sdk', description: 'SDK 说明资料', category: 'knowledge' },
]);
console.log(scopes.require('sdk').knowledgeTopicIds);import { IntentRegistry, ScopeRegistry } from '@jangts/agent-core/kits/domains';
const tools = IntentRegistry.create([
{ id: 'explain', description: '根据资料解释 SDK', delegates: ['read', 'reply'], asIntent: true },
]);
console.log(tools.ids(), tools.allows('explain', 'read'));
const scopes = ScopeRegistry.create([
{ id: 'sdk', description: 'SDK 说明资料', category: 'knowledge' },
]);
console.log(scopes.require('sdk').knowledgeTopicIds);Add constraints and scope relationships while keeping the same query entry
Configuration · Node.js
import { IntentRegistry, ScopeRegistry } from '@jangts/agent-core/kits/domains';
const tools = new IntentRegistry({ idPattern: /^[a-z-]+$/, delegates: ['read', 'reply'] })
.registerAll([{ id: 'explain', description: '根据资料解释 SDK', delegates: ['read', 'reply'], asIntent: '用户希望了解 SDK 接口或用法。' }]).seal();
const scopes = ScopeRegistry.create([
{ id: 'sdk', description: 'SDK 说明资料', category: 'knowledge', aliases: ['agent-core'], goalIds: ['explain'], knowledgeTopicIds: ['manual'], toolIds: ['read-source'] },
], { categories: ['knowledge'], requireGoals: true, requireSources: true });
console.log(tools.describe(), scopes.normalize('agent-core'));
console.log(scopes.acceptsTool('agent-core', 'explain'), scopes.topics('sdk'));import { IntentRegistry, ScopeRegistry } from '@jangts/agent-core/kits/domains';
const tools = new IntentRegistry({ idPattern: /^[a-z-]+$/, delegates: ['read', 'reply'] })
.registerAll([{ id: 'explain', description: '根据资料解释 SDK', delegates: ['read', 'reply'], asIntent: '用户希望了解 SDK 接口或用法。' }]).seal();
const scopes = ScopeRegistry.create([
{ id: 'sdk', description: 'SDK 说明资料', category: 'knowledge', aliases: ['agent-core'], goalIds: ['explain'], knowledgeTopicIds: ['manual'], toolIds: ['read-source'] },
], { categories: ['knowledge'], requireGoals: true, requireSources: true });
console.log(tools.describe(), scopes.normalize('agent-core'));
console.log(scopes.acceptsTool('agent-core', 'explain'), scopes.topics('sdk'));