@memberjunction/ai-agents 6.2.0-edge.5 → 6.2.0-edge.6
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/README.md +60 -0
- package/dist/AgentDataPreloader.d.ts +4 -2
- package/dist/AgentDataPreloader.d.ts.map +1 -1
- package/dist/AgentDataPreloader.js +21 -12
- package/dist/AgentDataPreloader.js.map +1 -1
- package/dist/AgentRunner.d.ts +55 -3
- package/dist/AgentRunner.d.ts.map +1 -1
- package/dist/AgentRunner.js +150 -30
- package/dist/AgentRunner.js.map +1 -1
- package/dist/AgentWakeTriggerService.d.ts +183 -0
- package/dist/AgentWakeTriggerService.d.ts.map +1 -0
- package/dist/AgentWakeTriggerService.js +478 -0
- package/dist/AgentWakeTriggerService.js.map +1 -0
- package/dist/ArtifactToolManager.d.ts +1 -0
- package/dist/ArtifactToolManager.d.ts.map +1 -1
- package/dist/ArtifactToolManager.js +5 -0
- package/dist/ArtifactToolManager.js.map +1 -1
- package/dist/ConversationToolManager.d.ts +1 -1
- package/dist/ConversationToolManager.d.ts.map +1 -1
- package/dist/ConversationToolManager.js +10 -4
- package/dist/ConversationToolManager.js.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.js +20 -0
- package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
- package/dist/agent-context-injector.d.ts +21 -4
- package/dist/agent-context-injector.d.ts.map +1 -1
- package/dist/agent-context-injector.js +49 -13
- package/dist/agent-context-injector.js.map +1 -1
- package/dist/agent-memory-context-builder.js +2 -2
- package/dist/agent-memory-context-builder.js.map +1 -1
- package/dist/agent-pre-execution-rag.js +5 -8
- package/dist/agent-pre-execution-rag.js.map +1 -1
- package/dist/agent-run-watchdog.d.ts +23 -8
- package/dist/agent-run-watchdog.d.ts.map +1 -1
- package/dist/agent-run-watchdog.js +141 -76
- package/dist/agent-run-watchdog.js.map +1 -1
- package/dist/agent-types/flow-agent-type.d.ts +7 -0
- package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
- package/dist/agent-types/flow-agent-type.js +95 -21
- package/dist/agent-types/flow-agent-type.js.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.d.ts +6 -2
- package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts +76 -5
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +230 -50
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/base-agent.d.ts +244 -10
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +1019 -193
- package/dist/base-agent.js.map +1 -1
- package/dist/bound-action-params.d.ts +57 -0
- package/dist/bound-action-params.d.ts.map +1 -0
- package/dist/bound-action-params.js +91 -0
- package/dist/bound-action-params.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/memory-cleanup-agent.d.ts.map +1 -1
- package/dist/memory-cleanup-agent.js +3 -0
- package/dist/memory-cleanup-agent.js.map +1 -1
- package/dist/memory-manager-agent.d.ts.map +1 -1
- package/dist/memory-manager-agent.js +6 -1
- package/dist/memory-manager-agent.js.map +1 -1
- package/dist/native-tools/agent-tools.d.ts +64 -0
- package/dist/native-tools/agent-tools.d.ts.map +1 -0
- package/dist/native-tools/agent-tools.js +23 -0
- package/dist/native-tools/agent-tools.js.map +1 -0
- package/dist/native-tools/control-tools.d.ts +26 -4
- package/dist/native-tools/control-tools.d.ts.map +1 -1
- package/dist/native-tools/control-tools.js +114 -42
- package/dist/native-tools/control-tools.js.map +1 -1
- package/dist/native-tools/framework-tools.d.ts +47 -0
- package/dist/native-tools/framework-tools.d.ts.map +1 -0
- package/dist/native-tools/framework-tools.js +187 -0
- package/dist/native-tools/framework-tools.js.map +1 -0
- package/dist/native-tools/native-control-config.d.ts +93 -0
- package/dist/native-tools/native-control-config.d.ts.map +1 -0
- package/dist/native-tools/native-control-config.js +104 -0
- package/dist/native-tools/native-control-config.js.map +1 -0
- package/dist/native-tools/tool-result-turns.d.ts +41 -8
- package/dist/native-tools/tool-result-turns.d.ts.map +1 -1
- package/dist/native-tools/tool-result-turns.js +76 -2
- package/dist/native-tools/tool-result-turns.js.map +1 -1
- package/dist/native-tools/turn-mode.d.ts +8 -0
- package/dist/native-tools/turn-mode.d.ts.map +1 -0
- package/dist/native-tools/turn-mode.js +14 -0
- package/dist/native-tools/turn-mode.js.map +1 -0
- package/dist/query-builder-agent.d.ts +20 -1
- package/dist/query-builder-agent.d.ts.map +1 -1
- package/dist/query-builder-agent.js +35 -3
- package/dist/query-builder-agent.js.map +1 -1
- package/dist/realtime/bridge-room-transcript-sink.js +1 -0
- package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
- package/dist/realtime/bridge-session-transcript-sink.js +1 -0
- package/dist/realtime/bridge-session-transcript-sink.js.map +1 -1
- package/dist/realtime/realtime-recording-ledger.d.ts +20 -0
- package/dist/realtime/realtime-recording-ledger.d.ts.map +1 -1
- package/dist/realtime/realtime-recording-ledger.js +16 -0
- package/dist/realtime/realtime-recording-ledger.js.map +1 -1
- package/dist/realtime/realtime-recording-store.d.ts +6 -5
- package/dist/realtime/realtime-recording-store.d.ts.map +1 -1
- package/dist/realtime/realtime-recording-store.js +47 -21
- package/dist/realtime/realtime-recording-store.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MAX_TOOL_DESCRIPTION_LENGTH, SanitizeToolName } from './action-tool-builder.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks an agent tool's name and describes it as a {@link ChatTool}.
|
|
4
|
+
*
|
|
5
|
+
* @param definition The tool
|
|
6
|
+
* @param reservedNames Names the tool may not take (the control tools)
|
|
7
|
+
* @param reservedPrefix A prefix it may not start with (the sub-agent tools)
|
|
8
|
+
* @throws When the name is not already a valid tool name, or is reserved
|
|
9
|
+
*/
|
|
10
|
+
export function BuildAgentTool(definition, reservedNames, reservedPrefix) {
|
|
11
|
+
const name = definition.Name;
|
|
12
|
+
if (!name || SanitizeToolName(name) !== name) {
|
|
13
|
+
throw new Error(`Agent tool '${name}' is not a valid tool name; use lowercase letters, digits and underscores (for example '${SanitizeToolName(name)}').`);
|
|
14
|
+
}
|
|
15
|
+
if (reservedNames.includes(name) || name.startsWith(reservedPrefix)) {
|
|
16
|
+
throw new Error(`Agent tool '${name}' uses a name reserved for the control tools. Rename it.`);
|
|
17
|
+
}
|
|
18
|
+
if (definition.Description.length > MAX_TOOL_DESCRIPTION_LENGTH) {
|
|
19
|
+
throw new Error(`Agent tool '${name}' has a description over ${MAX_TOOL_DESCRIPTION_LENGTH} characters.`);
|
|
20
|
+
}
|
|
21
|
+
return { name, description: definition.Description, inputSchema: definition.InputSchema };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=agent-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tools.js","sourceRoot":"","sources":["../../src/native-tools/agent-tools.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA0CtF;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,UAA+B,EAAE,aAAgC,EAAE,cAAsB;IACpH,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7B,IAAI,CAAC,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,2FAA2F,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/J,CAAC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,0DAA0D,CAAC,CAAC;IACnG,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,2BAA2B,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,4BAA4B,2BAA2B,cAAc,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC;AAC9F,CAAC"}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import type { ChatTool } from '@memberjunction/ai';
|
|
12
12
|
import type { MJAIAgentEntityExtended } from '@memberjunction/ai-core-plus';
|
|
13
13
|
import { type ActionToolBinding, type ActionToolSet } from './action-tool-builder.js';
|
|
14
|
+
import { type CompleteTaskPayloadForm, type NativeControlConfig } from './native-control-config.js';
|
|
15
|
+
import { type AgentToolDefinition } from './agent-tools.js';
|
|
14
16
|
export declare const PAYLOAD_CHANGE_TOOL = "payload_change_request";
|
|
15
17
|
export declare const ASK_USER_TOOL = "ask_user";
|
|
16
18
|
export declare const COMPLETE_TASK_TOOL = "complete_task";
|
|
@@ -35,6 +37,13 @@ export type NativeToolBinding = ActionToolBinding | {
|
|
|
35
37
|
kind: 'complete';
|
|
36
38
|
toolName: string;
|
|
37
39
|
tool: ChatTool;
|
|
40
|
+
}
|
|
41
|
+
/** One of the agent's own tools (see `BaseAgent.GetAgentTools`). Dispatchable in every native mode, like an Action. */
|
|
42
|
+
| {
|
|
43
|
+
kind: 'agentTool';
|
|
44
|
+
toolName: string;
|
|
45
|
+
tool: ChatTool;
|
|
46
|
+
definition: AgentToolDefinition;
|
|
38
47
|
};
|
|
39
48
|
export interface NativeToolSet {
|
|
40
49
|
tools: ChatTool[];
|
|
@@ -51,6 +60,13 @@ export declare function buildPayloadChangeTool(): ChatTool;
|
|
|
51
60
|
export declare function BuildAskUserTool(): ChatTool;
|
|
52
61
|
/** @deprecated Use {@link BuildAskUserTool}. */
|
|
53
62
|
export declare function buildAskUserTool(): ChatTool;
|
|
63
|
+
/** How {@link BuildCompleteTaskTool} declares the tool. */
|
|
64
|
+
export interface CompleteTaskToolOptions {
|
|
65
|
+
/** Whether the tool carries a final payload change at all. Default true. */
|
|
66
|
+
IncludePayloadChange?: boolean;
|
|
67
|
+
/** The form of that parameter. Default `'string'`. */
|
|
68
|
+
PayloadForm?: CompleteTaskPayloadForm;
|
|
69
|
+
}
|
|
54
70
|
/**
|
|
55
71
|
* `complete_task` — the terminal tool: apply the final payload write and finish, in ONE turn.
|
|
56
72
|
*
|
|
@@ -61,16 +77,22 @@ export declare function buildAskUserTool(): ChatTool;
|
|
|
61
77
|
* same reason (OpenAI Agents SDK `StopAtTools`, SWE-agent's `submit`). Plain text still ends the
|
|
62
78
|
* turn, for agents whose answer is prose.
|
|
63
79
|
*/
|
|
64
|
-
export declare function BuildCompleteTaskTool(): ChatTool;
|
|
80
|
+
export declare function BuildCompleteTaskTool(options?: CompleteTaskToolOptions): ChatTool;
|
|
65
81
|
/** One tool per sub-agent: `delegate_to_<sanitized name>`, described by the agent's own description. */
|
|
66
82
|
export declare function BuildSubAgentTool(agent: MJAIAgentEntityExtended): ChatTool;
|
|
67
83
|
/** @deprecated Use {@link BuildSubAgentTool}. */
|
|
68
84
|
export declare function buildSubAgentTool(agent: MJAIAgentEntityExtended): ChatTool;
|
|
69
85
|
/**
|
|
70
|
-
* Actions, then sub-agents, then the
|
|
71
|
-
* Collisions and reserved-name clashes are hard
|
|
86
|
+
* Actions, then sub-agents, then the agent's own tools, then the control tools its configuration
|
|
87
|
+
* declares — one reverse map for all of them. Collisions and reserved-name clashes are hard
|
|
88
|
+
* errors, exactly as Action/Action collisions are. A reserved name stays reserved when its tool is
|
|
89
|
+
* turned off, so changing an agent's configuration can never make an Action's name collide.
|
|
90
|
+
*
|
|
91
|
+
* Agent tools are not control tools: like Actions, they are kept for every native model, hybrid
|
|
92
|
+
* included, so they are not listed in `controlToolNames`. Framework tools (native-only mode) ARE
|
|
93
|
+
* control tools: a hybrid model keeps the envelope fields they replace, so the runner strips them.
|
|
72
94
|
*/
|
|
73
|
-
export declare function BuildNativeToolSet(actionSet: ActionToolSet, subAgents: readonly MJAIAgentEntityExtended[]): NativeToolSet;
|
|
95
|
+
export declare function BuildNativeToolSet(actionSet: ActionToolSet, subAgents: readonly MJAIAgentEntityExtended[], control?: NativeControlConfig, agentTools?: readonly AgentToolDefinition[], frameworkTools?: readonly AgentToolDefinition[]): NativeToolSet;
|
|
74
96
|
/** @deprecated Use {@link BuildNativeToolSet}. */
|
|
75
97
|
export declare function buildNativeToolSet(actionSet: ActionToolSet, subAgents: readonly MJAIAgentEntityExtended[]): NativeToolSet;
|
|
76
98
|
//# sourceMappingURL=control-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-tools.d.ts","sourceRoot":"","sources":["../../src/native-tools/control-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAiD,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAElI,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAClD,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AACpD,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAA6D,CAAC;AAIrH,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GACvB,iBAAiB,GACjB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EA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AG,QAAQ,CAc1E;AAED,iDAAiD;AACjD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,GAAG,QAAQ,CAE1E;AA8CD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,SAAS,uBAAuB,EAAE,EAC7C,OAAO,GAAE,mBAAmD,EAC5D,UAAU,GAAE,SAAS,mBAAmB,EAAO,EAC/C,cAAc,GAAE,SAAS,mBAAmB,EAAO,GACpD,aAAa,CAgCf;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,uBAAuB,EAAE,GAAG,aAAa,CAEzH"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SanitizeToolName, MAX_TOOL_DESCRIPTION_LENGTH } from './action-tool-builder.js';
|
|
2
|
+
import { DEFAULT_NATIVE_CONTROL_CONFIG } from './native-control-config.js';
|
|
3
|
+
import { BuildAgentTool } from './agent-tools.js';
|
|
4
|
+
import { FRAMEWORK_TOOL_NAMES } from './framework-tools.js';
|
|
2
5
|
export const PAYLOAD_CHANGE_TOOL = 'payload_change_request';
|
|
3
6
|
export const ASK_USER_TOOL = 'ask_user';
|
|
4
7
|
export const COMPLETE_TASK_TOOL = 'complete_task';
|
|
@@ -69,6 +72,34 @@ export function BuildAskUserTool() {
|
|
|
69
72
|
export function buildAskUserTool() {
|
|
70
73
|
return BuildAskUserTool();
|
|
71
74
|
}
|
|
75
|
+
/** The four payload-change sections, as an object schema, for the object form of `complete_task`. */
|
|
76
|
+
function payloadChangeObjectSchema() {
|
|
77
|
+
const section = (what) => ({ type: 'object', description: what });
|
|
78
|
+
return {
|
|
79
|
+
type: 'object',
|
|
80
|
+
description: 'Optional. Final payload changes, applied before the task completes — same shape as payload_change_request.',
|
|
81
|
+
properties: {
|
|
82
|
+
newElements: section('Keys and values to ADD that are not in the payload yet.'),
|
|
83
|
+
updateElements: section('Existing keys to UPDATE — only the parts that change.'),
|
|
84
|
+
replaceElements: section('Existing objects to REPLACE entirely.'),
|
|
85
|
+
removeElements: section('Keys to REMOVE (value ignored).')
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** The `payloadChangeRequest` parameter of `complete_task`, in the declared form. */
|
|
90
|
+
function completeTaskPayloadParameter(form) {
|
|
91
|
+
if (form === 'object') {
|
|
92
|
+
return payloadChangeObjectSchema();
|
|
93
|
+
}
|
|
94
|
+
// A JSON string, not an object: complete_task is the call the framework forces on the
|
|
95
|
+
// final turn, and a forced call is schema-constrained, so an object whose sections
|
|
96
|
+
// declare no properties can only decode as `{}`. The loop decodes the string.
|
|
97
|
+
return {
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'Optional. Final payload changes as a JSON object string, applied before the task completes: '
|
|
100
|
+
+ '{"newElements"?: {...}, "updateElements"?: {...}, "replaceElements"?: {...}, "removeElements"?: {...}} — same shape as payload_change_request.'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
72
103
|
/**
|
|
73
104
|
* `complete_task` — the terminal tool: apply the final payload write and finish, in ONE turn.
|
|
74
105
|
*
|
|
@@ -79,28 +110,21 @@ export function buildAskUserTool() {
|
|
|
79
110
|
* same reason (OpenAI Agents SDK `StopAtTools`, SWE-agent's `submit`). Plain text still ends the
|
|
80
111
|
* turn, for agents whose answer is prose.
|
|
81
112
|
*/
|
|
82
|
-
export function BuildCompleteTaskTool() {
|
|
113
|
+
export function BuildCompleteTaskTool(options = {}) {
|
|
114
|
+
const includePayload = options.IncludePayloadChange !== false;
|
|
115
|
+
const properties = {
|
|
116
|
+
message: { type: 'string', description: 'Your final answer or a brief summary of what you did.' },
|
|
117
|
+
...(includePayload ? { payloadChangeRequest: completeTaskPayloadParameter(options.PayloadForm ?? 'string') } : {})
|
|
118
|
+
};
|
|
119
|
+
const writes = includePayload
|
|
120
|
+
? 'put any final writes to the shared payload in payloadChangeRequest and your answer for the user or calling agent in message. The change is applied '
|
|
121
|
+
: 'put your answer for the user or calling agent in message. ';
|
|
83
122
|
return {
|
|
84
123
|
name: COMPLETE_TASK_TOOL,
|
|
85
|
-
description: clip(
|
|
86
|
-
'in payloadChangeRequest and your answer for the user or calling agent in message. The change is applied ' +
|
|
124
|
+
description: clip(`Finish the task. Call this when your work is done and verified: ${writes}` +
|
|
87
125
|
'and the run ends — unless the result fails validation, in which case you receive the reason and continue. ' +
|
|
88
126
|
'Must be the only call on its turn.', MAX_TOOL_DESCRIPTION_LENGTH),
|
|
89
|
-
inputSchema: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties: {
|
|
92
|
-
message: { type: 'string', description: 'Your final answer or a brief summary of what you did.' },
|
|
93
|
-
// A JSON string, not an object: complete_task is the call the framework forces on the
|
|
94
|
-
// final turn, and a forced call is schema-constrained, so an object whose sections
|
|
95
|
-
// declare no properties can only decode as `{}`. The loop decodes the string.
|
|
96
|
-
payloadChangeRequest: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
description: 'Optional. Final payload changes as a JSON object string, applied before the task completes: '
|
|
99
|
-
+ '{"newElements"?: {...}, "updateElements"?: {...}, "replaceElements"?: {...}, "removeElements"?: {...}} — same shape as payload_change_request.'
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
required: ['message']
|
|
103
|
-
}
|
|
127
|
+
inputSchema: { type: 'object', properties, required: ['message'] }
|
|
104
128
|
};
|
|
105
129
|
}
|
|
106
130
|
/** One tool per sub-agent: `delegate_to_<sanitized name>`, described by the agent's own description. */
|
|
@@ -124,40 +148,88 @@ export function buildSubAgentTool(agent) {
|
|
|
124
148
|
return BuildSubAgentTool(agent);
|
|
125
149
|
}
|
|
126
150
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
151
|
+
* The fixed control tools this agent declares, with their bindings — `payload_change_request`,
|
|
152
|
+
* `ask_user` and `complete_task`, each unless its configuration turns it off.
|
|
153
|
+
*/
|
|
154
|
+
function buildControlBindings(control) {
|
|
155
|
+
const bindings = [];
|
|
156
|
+
if (control.PayloadChangeTool) {
|
|
157
|
+
const payload = BuildPayloadChangeTool();
|
|
158
|
+
bindings.push({ kind: 'payloadChange', toolName: payload.name, tool: payload });
|
|
159
|
+
}
|
|
160
|
+
if (control.AskUser) {
|
|
161
|
+
const ask = BuildAskUserTool();
|
|
162
|
+
bindings.push({ kind: 'askUser', toolName: ask.name, tool: ask });
|
|
163
|
+
}
|
|
164
|
+
if (control.Terminal === 'tool') {
|
|
165
|
+
const complete = BuildCompleteTaskTool({ IncludePayloadChange: control.PayloadChangeTool, PayloadForm: control.CompleteTaskPayload });
|
|
166
|
+
bindings.push({ kind: 'complete', toolName: complete.name, tool: complete });
|
|
167
|
+
}
|
|
168
|
+
return bindings;
|
|
169
|
+
}
|
|
170
|
+
/** How a binding is named in a collision error. */
|
|
171
|
+
function describeBinding(binding) {
|
|
172
|
+
switch (binding.kind) {
|
|
173
|
+
case 'action': return `Action '${binding.action.Name}'`;
|
|
174
|
+
case 'subAgent': return `sub-agent '${binding.agent.Name}'`;
|
|
175
|
+
case 'agentTool': return `agent tool '${binding.toolName}'`;
|
|
176
|
+
default: return `'${binding.toolName}'`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** Adds one binding, rejecting a name another tool already declared. */
|
|
180
|
+
function addBinding(set, binding, isControl) {
|
|
181
|
+
const existing = set.byToolName.get(binding.toolName);
|
|
182
|
+
if (existing) {
|
|
183
|
+
throw new Error(`Tool name collision: ${describeBinding(binding)} and ${describeBinding(existing)} both declare '${binding.toolName}'. Rename one.`);
|
|
184
|
+
}
|
|
185
|
+
set.byToolName.set(binding.toolName, binding);
|
|
186
|
+
set.tools.push(binding.tool);
|
|
187
|
+
if (isControl) {
|
|
188
|
+
set.controlToolNames.push(binding.toolName);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Actions, then sub-agents, then the agent's own tools, then the control tools its configuration
|
|
193
|
+
* declares — one reverse map for all of them. Collisions and reserved-name clashes are hard
|
|
194
|
+
* errors, exactly as Action/Action collisions are. A reserved name stays reserved when its tool is
|
|
195
|
+
* turned off, so changing an agent's configuration can never make an Action's name collide.
|
|
196
|
+
*
|
|
197
|
+
* Agent tools are not control tools: like Actions, they are kept for every native model, hybrid
|
|
198
|
+
* included, so they are not listed in `controlToolNames`. Framework tools (native-only mode) ARE
|
|
199
|
+
* control tools: a hybrid model keeps the envelope fields they replace, so the runner strips them.
|
|
129
200
|
*/
|
|
130
|
-
export function BuildNativeToolSet(actionSet, subAgents) {
|
|
131
|
-
const byToolName = new Map(actionSet.byToolName);
|
|
132
|
-
const tools = [...actionSet.tools];
|
|
133
|
-
const controlToolNames = [];
|
|
201
|
+
export function BuildNativeToolSet(actionSet, subAgents, control = DEFAULT_NATIVE_CONTROL_CONFIG, agentTools = [], frameworkTools = []) {
|
|
134
202
|
for (const reserved of NATIVE_CONTROL_TOOL_NAMES) {
|
|
135
203
|
const clash = actionSet.byToolName.get(reserved);
|
|
136
204
|
if (clash) {
|
|
137
205
|
throw new Error(`Action '${clash.action.Name}' sanitizes to '${reserved}', which is a reserved control-tool name. Rename the Action.`);
|
|
138
206
|
}
|
|
139
207
|
}
|
|
208
|
+
for (const framework of frameworkTools) {
|
|
209
|
+
const clash = actionSet.byToolName.get(framework.Name);
|
|
210
|
+
if (clash) {
|
|
211
|
+
throw new Error(`Action '${clash.action.Name}' sanitizes to '${framework.Name}', the native-only framework tool of that name. `
|
|
212
|
+
+ 'Rename the Action, or turn NativeControl.NativeOnly off for this agent.');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const set = { tools: [...actionSet.tools], byToolName: new Map(actionSet.byToolName), controlToolNames: [] };
|
|
140
216
|
for (const agent of subAgents) {
|
|
141
217
|
const tool = BuildSubAgentTool(agent);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
218
|
+
addBinding(set, { kind: 'subAgent', toolName: tool.name, agent, tool }, true);
|
|
219
|
+
}
|
|
220
|
+
const reserved = [...NATIVE_CONTROL_TOOL_NAMES, ...FRAMEWORK_TOOL_NAMES];
|
|
221
|
+
for (const definition of agentTools) {
|
|
222
|
+
const tool = BuildAgentTool(definition, reserved, SUB_AGENT_TOOL_PREFIX);
|
|
223
|
+
addBinding(set, { kind: 'agentTool', toolName: tool.name, tool, definition }, false);
|
|
224
|
+
}
|
|
225
|
+
for (const definition of frameworkTools) {
|
|
226
|
+
const tool = { name: definition.Name, description: definition.Description, inputSchema: definition.InputSchema };
|
|
227
|
+
addBinding(set, { kind: 'agentTool', toolName: tool.name, tool, definition }, true);
|
|
228
|
+
}
|
|
229
|
+
for (const binding of buildControlBindings(control)) {
|
|
230
|
+
addBinding(set, binding, true);
|
|
151
231
|
}
|
|
152
|
-
|
|
153
|
-
const ask = BuildAskUserTool();
|
|
154
|
-
const complete = BuildCompleteTaskTool();
|
|
155
|
-
byToolName.set(payload.name, { kind: 'payloadChange', toolName: payload.name, tool: payload });
|
|
156
|
-
byToolName.set(ask.name, { kind: 'askUser', toolName: ask.name, tool: ask });
|
|
157
|
-
byToolName.set(complete.name, { kind: 'complete', toolName: complete.name, tool: complete });
|
|
158
|
-
tools.push(payload, ask, complete);
|
|
159
|
-
controlToolNames.push(payload.name, ask.name, complete.name);
|
|
160
|
-
return { tools, byToolName, controlToolNames };
|
|
232
|
+
return set;
|
|
161
233
|
}
|
|
162
234
|
/** @deprecated Use {@link BuildNativeToolSet}. */
|
|
163
235
|
export function buildNativeToolSet(actionSet, subAgents) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-tools.js","sourceRoot":"","sources":["../../src/native-tools/control-tools.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAA8C,MAAM,uBAAuB,CAAC;AAElI,MAAM,CAAC,MAAM,mBAAmB,GAAG,wB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EAAE,KAAK,CAAC,CAAC;IACzF,CAAC;IACD,KAAK,MAAM,UAAU,IAAI,cAAc,EAAE,CAAC;QACtC,MAAM,IAAI,GAAa,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC;QAC3H,UAAU,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;IACxF,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,kBAAkB,CAAC,SAAwB,EAAE,SAA6C;IACtG,OAAO,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The framework's own capabilities as native tools, for the native-only control
|
|
3
|
+
* plane (`NativeControl.NativeOnly`).
|
|
4
|
+
*
|
|
5
|
+
* Under the hybrid prompt the scratchpad, durable memory, artifact tools, conversation-history
|
|
6
|
+
* tools and decisions are fields of the JSON envelope. A turn that calls a tool skips envelope
|
|
7
|
+
* parsing, so a model that is calling tools cannot use any of them on that turn, and it is taught
|
|
8
|
+
* two protocols at once. Native-only mode declares each enabled capability as a tool instead, and
|
|
9
|
+
* every call is answered by its own tool result on the same turn.
|
|
10
|
+
*
|
|
11
|
+
* The tools are built on the agent-tool contract ({@link AgentToolDefinition}); the agent supplies
|
|
12
|
+
* the capability behind each through {@link FrameworkToolHost}.
|
|
13
|
+
* @module @memberjunction/ai-agents
|
|
14
|
+
*/
|
|
15
|
+
import type { AgentDecisionRequest, AgentScratchpad } from '@memberjunction/ai-core-plus';
|
|
16
|
+
import type { AgentToolDefinition, AgentToolResult } from './agent-tools.js';
|
|
17
|
+
export declare const SCRATCHPAD_TOOL = "scratchpad_write";
|
|
18
|
+
export declare const MEMORY_WRITE_TOOL = "memory_write";
|
|
19
|
+
export declare const ARTIFACT_TOOL = "artifact_tool";
|
|
20
|
+
export declare const CONVERSATION_TOOL = "conversation_tool";
|
|
21
|
+
export declare const DECISION_TOOL = "ask_decisions";
|
|
22
|
+
/** Every framework tool name — reserved, like the control tools. */
|
|
23
|
+
export declare const FRAMEWORK_TOOL_NAMES: readonly string[];
|
|
24
|
+
/** Which framework capabilities this turn offers. */
|
|
25
|
+
export interface FrameworkToolAvailability {
|
|
26
|
+
Scratchpad: boolean;
|
|
27
|
+
MemoryWrites: boolean;
|
|
28
|
+
ArtifactTools: boolean;
|
|
29
|
+
ConversationTools: boolean;
|
|
30
|
+
Decisions: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** The capabilities behind the framework tools, supplied by the running agent. Each returns the text the model reads. */
|
|
33
|
+
export interface FrameworkToolHost {
|
|
34
|
+
ApplyScratchpad(changes: AgentScratchpad): string;
|
|
35
|
+
WriteMemory(note: string, type: 'Preference' | 'Context', scopeHint: 'user' | 'agent' | undefined): Promise<AgentToolResult>;
|
|
36
|
+
RunArtifactTool(artifactId: string, tool: string, input: Record<string, unknown>): Promise<AgentToolResult>;
|
|
37
|
+
RunConversationTool(tool: string, input: Record<string, unknown>): Promise<AgentToolResult>;
|
|
38
|
+
RunDecisions(requests: AgentDecisionRequest[], payload: object): Promise<AgentToolResult>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The framework tools this turn offers, in a fixed order.
|
|
42
|
+
*
|
|
43
|
+
* @param host The capabilities behind the tools
|
|
44
|
+
* @param availability Which capabilities are enabled for this agent and turn
|
|
45
|
+
*/
|
|
46
|
+
export declare function BuildFrameworkTools(host: FrameworkToolHost, availability: FrameworkToolAvailability): AgentToolDefinition[];
|
|
47
|
+
//# sourceMappingURL=framework-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-tools.d.ts","sourceRoot":"","sources":["../../src/native-tools/framework-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAa,MAAM,8BAA8B,CAAC;AACrG,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE1E,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAChD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAA0F,CAAC;AAE7I,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,yHAAyH;AACzH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC;IAClD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7H,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5G,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5F,YAAY,CAAC,QAAQ,EAAE,oBAAoB,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7F;AA0KD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,yBAAyB,GAAG,mBAAmB,EAAE,CAQ3H"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export const SCRATCHPAD_TOOL = 'scratchpad_write';
|
|
2
|
+
export const MEMORY_WRITE_TOOL = 'memory_write';
|
|
3
|
+
export const ARTIFACT_TOOL = 'artifact_tool';
|
|
4
|
+
export const CONVERSATION_TOOL = 'conversation_tool';
|
|
5
|
+
export const DECISION_TOOL = 'ask_decisions';
|
|
6
|
+
/** Every framework tool name — reserved, like the control tools. */
|
|
7
|
+
export const FRAMEWORK_TOOL_NAMES = [SCRATCHPAD_TOOL, MEMORY_WRITE_TOOL, ARTIFACT_TOOL, CONVERSATION_TOOL, DECISION_TOOL];
|
|
8
|
+
const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
9
|
+
const fail = (Content) => ({ Content, IsError: true });
|
|
10
|
+
function scratchpadTool(host) {
|
|
11
|
+
return {
|
|
12
|
+
Name: SCRATCHPAD_TOOL,
|
|
13
|
+
Description: 'Write to your private scratchpad: working notes and a task list that persist across your turns and are never shared. '
|
|
14
|
+
+ 'Call this to record reasoning you will need later or to track work items. Keep it lean: it is shown to you on every turn.',
|
|
15
|
+
InputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
notes: { type: 'string', description: 'Replaces your notes. Omit to leave them as they are.' },
|
|
19
|
+
taskList: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
description: 'Task changes: `upsert` adds or updates tasks by id; `remove` deletes tasks by id.',
|
|
22
|
+
properties: {
|
|
23
|
+
upsert: {
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
id: { type: 'string' },
|
|
29
|
+
title: { type: 'string' },
|
|
30
|
+
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'blocked'] },
|
|
31
|
+
notes: { type: 'string' }
|
|
32
|
+
},
|
|
33
|
+
required: ['id', 'title', 'status']
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
remove: { type: 'array', items: { type: 'string' } }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
Execute: async (args) => {
|
|
42
|
+
const changes = readScratchpadChanges(args);
|
|
43
|
+
return typeof changes === 'string' ? fail(changes) : { Content: host.ApplyScratchpad(changes), IsError: false };
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const TASK_STATUSES = ['pending', 'in_progress', 'completed', 'blocked'];
|
|
48
|
+
/** One task from `taskList.upsert`, or undefined when it lacks an id, a title or a known status. */
|
|
49
|
+
function readTask(raw) {
|
|
50
|
+
if (!isRecord(raw) || typeof raw.id !== 'string' || typeof raw.title !== 'string' || typeof raw.status !== 'string') {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const status = TASK_STATUSES.find((s) => s === raw.status);
|
|
54
|
+
if (!status) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return { id: raw.id, title: raw.title, status, ...(typeof raw.notes === 'string' ? { notes: raw.notes } : {}) };
|
|
58
|
+
}
|
|
59
|
+
/** The scratchpad changes in a call's arguments, or a message saying what is wrong with them. */
|
|
60
|
+
function readScratchpadChanges(args) {
|
|
61
|
+
if (args.notes !== undefined && typeof args.notes !== 'string') {
|
|
62
|
+
return 'scratchpad_write.notes must be a string.';
|
|
63
|
+
}
|
|
64
|
+
const list = isRecord(args.taskList) ? args.taskList : {};
|
|
65
|
+
const upsertRaw = Array.isArray(list.upsert) ? list.upsert : [];
|
|
66
|
+
const upsert = upsertRaw.map(readTask);
|
|
67
|
+
if (upsert.some((t) => t === undefined)) {
|
|
68
|
+
return "Every task in taskList.upsert needs an id, a title and a status of 'pending', 'in_progress', 'completed' or 'blocked'.";
|
|
69
|
+
}
|
|
70
|
+
const remove = Array.isArray(list.remove) ? list.remove.filter((id) => typeof id === 'string') : [];
|
|
71
|
+
return {
|
|
72
|
+
...(typeof args.notes === 'string' ? { notes: args.notes } : {}),
|
|
73
|
+
...(upsert.length || remove.length ? { taskList: { upsert: upsert, remove } } : {})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function memoryTool(host) {
|
|
77
|
+
return {
|
|
78
|
+
Name: MEMORY_WRITE_TOOL,
|
|
79
|
+
Description: 'Record one durable memory that persists across runs: an atomic, third-person fact such as "User prefers bar charts over pie charts." '
|
|
80
|
+
+ 'Call this the moment the user states a lasting preference or fact. Not for task state (use the scratchpad) and not for instructions.',
|
|
81
|
+
InputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
note: { type: 'string', description: 'The fact, as one declarative sentence.' },
|
|
85
|
+
type: { type: 'string', enum: ['Preference', 'Context'], description: 'Preference: likes, dislikes, choices. Context: situational facts.' },
|
|
86
|
+
scopeHint: { type: 'string', enum: ['user', 'agent'], description: "Optional. 'agent' stores it without tying it to the current user." }
|
|
87
|
+
},
|
|
88
|
+
required: ['note', 'type']
|
|
89
|
+
},
|
|
90
|
+
Execute: async (args) => {
|
|
91
|
+
const type = args.type === 'Preference' || args.type === 'Context' ? args.type : undefined;
|
|
92
|
+
if (typeof args.note !== 'string' || !args.note.trim() || !type) {
|
|
93
|
+
return fail("memory_write needs a non-empty note and a type of 'Preference' or 'Context'.");
|
|
94
|
+
}
|
|
95
|
+
const scope = args.scopeHint === 'user' || args.scopeHint === 'agent' ? args.scopeHint : undefined;
|
|
96
|
+
return host.WriteMemory(args.note, type, scope);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function artifactTool(host) {
|
|
101
|
+
return {
|
|
102
|
+
Name: ARTIFACT_TOOL,
|
|
103
|
+
Description: 'Run one artifact tool on an artifact listed in Available Artifacts, to explore or inspect it. '
|
|
104
|
+
+ 'Call this with the artifact id (A, B, …), the tool name and its input; the result is returned to you on this turn.',
|
|
105
|
+
InputSchema: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
artifactId: { type: 'string', description: 'The artifact id from Available Artifacts, such as "A".' },
|
|
109
|
+
tool: { type: 'string', description: 'The artifact tool to run, as listed under Artifact Tools.' },
|
|
110
|
+
input: { type: 'object', description: "The tool's input parameters." }
|
|
111
|
+
},
|
|
112
|
+
required: ['artifactId', 'tool']
|
|
113
|
+
},
|
|
114
|
+
Execute: async (args) => {
|
|
115
|
+
if (typeof args.artifactId !== 'string' || typeof args.tool !== 'string') {
|
|
116
|
+
return fail('artifact_tool needs an artifactId and a tool name.');
|
|
117
|
+
}
|
|
118
|
+
return host.RunArtifactTool(args.artifactId, args.tool, isRecord(args.input) ? args.input : {});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function conversationTool(host) {
|
|
123
|
+
return {
|
|
124
|
+
Name: CONVERSATION_TOOL,
|
|
125
|
+
Description: 'Read stored conversation history: page exact messages back in by sequence number, search the history, or summarize a range. '
|
|
126
|
+
+ 'Call this when you need exact wording, identifiers or numbers that a summary may have lost.',
|
|
127
|
+
InputSchema: {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
tool: { type: 'string', enum: ['getMessageBySequence', 'getMessagesByRange', 'searchConversation', 'summarizeRange'] },
|
|
131
|
+
input: { type: 'object', description: 'The input for that tool, as listed under Conversation History Tools.' }
|
|
132
|
+
},
|
|
133
|
+
required: ['tool', 'input']
|
|
134
|
+
},
|
|
135
|
+
Execute: async (args) => {
|
|
136
|
+
if (typeof args.tool !== 'string') {
|
|
137
|
+
return fail('conversation_tool needs a tool name.');
|
|
138
|
+
}
|
|
139
|
+
return host.RunConversationTool(args.tool, isRecord(args.input) ? args.input : {});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function decisionTool(host) {
|
|
144
|
+
return {
|
|
145
|
+
Name: DECISION_TOOL,
|
|
146
|
+
Description: 'Ask typed decision questions (Likelihood, Choice, Score) answered by a fast decision model; the answers are returned to you on this turn. '
|
|
147
|
+
+ 'Call this for classification, triage, relevance or threshold judgments over a small answer space — not for writing or open-ended reasoning.',
|
|
148
|
+
InputSchema: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
decisions: {
|
|
152
|
+
type: 'array',
|
|
153
|
+
description: 'Decision requests, the same shape as described under Decisions.',
|
|
154
|
+
items: { type: 'object' }
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: ['decisions']
|
|
158
|
+
},
|
|
159
|
+
Execute: async (args, context) => {
|
|
160
|
+
if (!Array.isArray(args.decisions) || args.decisions.length === 0) {
|
|
161
|
+
return fail('ask_decisions needs a non-empty decisions array.');
|
|
162
|
+
}
|
|
163
|
+
return host.RunDecisions(args.decisions, context.CurrentPayload);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The framework tools this turn offers, in a fixed order.
|
|
169
|
+
*
|
|
170
|
+
* @param host The capabilities behind the tools
|
|
171
|
+
* @param availability Which capabilities are enabled for this agent and turn
|
|
172
|
+
*/
|
|
173
|
+
export function BuildFrameworkTools(host, availability) {
|
|
174
|
+
const tools = [];
|
|
175
|
+
if (availability.Scratchpad)
|
|
176
|
+
tools.push(scratchpadTool(host));
|
|
177
|
+
if (availability.MemoryWrites)
|
|
178
|
+
tools.push(memoryTool(host));
|
|
179
|
+
if (availability.ArtifactTools)
|
|
180
|
+
tools.push(artifactTool(host));
|
|
181
|
+
if (availability.ConversationTools)
|
|
182
|
+
tools.push(conversationTool(host));
|
|
183
|
+
if (availability.Decisions)
|
|
184
|
+
tools.push(decisionTool(host));
|
|
185
|
+
return tools;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=framework-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-tools.js","sourceRoot":"","sources":["../../src/native-tools/framework-tools.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,oEAAoE;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAoB7I,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5I,MAAM,IAAI,GAAG,CAAC,OAAe,EAAmB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AAEhF,SAAS,cAAc,CAAC,IAAuB;IAC3C,OAAO;QACH,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,uHAAuH;cAC9H,2HAA2H;QACjI,WAAW,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sDAA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