@memberjunction/ai-agents 6.1.0-edge.6 → 6.1.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/dist/SkillImportExportService.d.ts +17 -1
- package/dist/SkillImportExportService.d.ts.map +1 -1
- package/dist/SkillImportExportService.js +57 -5
- package/dist/SkillImportExportService.js.map +1 -1
- package/dist/SkillMarkdownConverter.d.ts +17 -1
- package/dist/SkillMarkdownConverter.d.ts.map +1 -1
- package/dist/SkillMarkdownConverter.js +40 -5
- package/dist/SkillMarkdownConverter.js.map +1 -1
- package/dist/agent-types/base-agent-type.d.ts +26 -1
- package/dist/agent-types/base-agent-type.d.ts.map +1 -1
- package/dist/agent-types/base-agent-type.js +17 -0
- package/dist/agent-types/base-agent-type.js.map +1 -1
- package/dist/agent-types/loop-agent-response-type.d.ts +16 -0
- package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-response-type.js +19 -1
- package/dist/agent-types/loop-agent-response-type.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts +32 -1
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +190 -3
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/base-agent.d.ts +186 -3
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +564 -53
- package/dist/base-agent.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/native-tools/action-tool-builder.d.ts +92 -0
- package/dist/native-tools/action-tool-builder.d.ts.map +1 -0
- package/dist/native-tools/action-tool-builder.js +226 -0
- package/dist/native-tools/action-tool-builder.js.map +1 -0
- package/dist/native-tools/control-tools.d.ts +52 -0
- package/dist/native-tools/control-tools.d.ts.map +1 -0
- package/dist/native-tools/control-tools.js +113 -0
- package/dist/native-tools/control-tools.js.map +1 -0
- package/dist/native-tools/dual-channel.d.ts +16 -0
- package/dist/native-tools/dual-channel.d.ts.map +1 -0
- package/dist/native-tools/dual-channel.js +44 -0
- package/dist/native-tools/dual-channel.js.map +1 -0
- package/dist/native-tools/tool-result-turns.d.ts +32 -0
- package/dist/native-tools/tool-result-turns.d.ts.map +1 -0
- package/dist/native-tools/tool-result-turns.js +29 -0
- package/dist/native-tools/tool-result-turns.js.map +1 -0
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.js +22 -2
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
- package/dist/realtime/realtime-client-session-service.d.ts +104 -17
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +325 -28
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-coagent-config.d.ts +61 -1
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
- package/dist/realtime/realtime-coagent-config.js +93 -1
- package/dist/realtime/realtime-coagent-config.js.map +1 -1
- package/dist/realtime/realtime-session-runner.d.ts +10 -8
- package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
- package/dist/realtime/realtime-session-runner.js +11 -9
- package/dist/realtime/realtime-session-runner.js.map +1 -1
- package/dist/realtime/realtime-tool-broker.d.ts +11 -5
- package/dist/realtime/realtime-tool-broker.d.ts.map +1 -1
- package/dist/realtime/realtime-tool-broker.js +19 -7
- package/dist/realtime/realtime-tool-broker.js.map +1 -1
- package/dist/scoped-prompt-config-resolver.d.ts +6 -1
- package/dist/scoped-prompt-config-resolver.d.ts.map +1 -1
- package/dist/scoped-prompt-config-resolver.js.map +1 -1
- package/package.json +18 -18
|
@@ -57,7 +57,23 @@ export declare class SkillImportExportService {
|
|
|
57
57
|
private static ensureEnginesConfigured;
|
|
58
58
|
/** Resolves a list of names against a cached entity array (by ID+Name), collecting a warning for each miss. */
|
|
59
59
|
private static resolveNames;
|
|
60
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Turns the frontmatter's `codeOnlyActions` into a per-ActionID `ExposeToModel` map, or `undefined`
|
|
62
|
+
* when the file has no such key — then the file expresses no opinion and {@link resyncJunction}
|
|
63
|
+
* keeps each surviving row's flag as it was. A name listed as code-only but not bundled under
|
|
64
|
+
* `actions` is a warning, not a row.
|
|
65
|
+
*/
|
|
66
|
+
private static resolveExposeToModel;
|
|
67
|
+
/**
|
|
68
|
+
* Deletes existing junction rows for the skill and recreates them from the resolved ID set — the
|
|
69
|
+
* simplest correct resync for a small bounded set of rows.
|
|
70
|
+
*
|
|
71
|
+
* Delete-and-recreate must not lose `AISkillAction.ExposeToModel` (#4226). When the SKILL.md says
|
|
72
|
+
* (`codeOnlyActions`, → `exposeToModel`), the file is authoritative. When it does not — a file
|
|
73
|
+
* exported before the key existed, or hand-written without it — rows that survive the resync (same
|
|
74
|
+
* action before and after) keep the flag they had, so re-saving a skill's SKILL.md never turns a
|
|
75
|
+
* code-only action model-callable; only a genuinely new row takes the column default.
|
|
76
|
+
*/
|
|
61
77
|
private static resyncJunction;
|
|
62
78
|
}
|
|
63
79
|
//# sourceMappingURL=SkillImportExportService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillImportExportService.d.ts","sourceRoot":"","sources":["../src/SkillImportExportService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAkD,MAAM,+BAA+B,CAAC;AAKhH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB;;yDAEqD;IACrD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,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+GAA+G;IAC/G,OAAO,CAAC,MAAM,CAAC,YAAY;IAkB3B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA0BnC;;;;;;;;;OASG;mBACkB,cAAc;CA6CtC"}
|
|
@@ -39,8 +39,13 @@ export class SkillImportExportService {
|
|
|
39
39
|
ResultType: 'simple'
|
|
40
40
|
}
|
|
41
41
|
], contextUser);
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const actionNameOf = (row) => ActionEngineServer.Instance.Actions.find(a => UUIDsEqual(a.ID, row.ActionID))?.Name;
|
|
43
|
+
const actionRowsTyped = (actionRows.Success ? actionRows.Results : []);
|
|
44
|
+
const actionNames = actionRowsTyped.map(actionNameOf).filter((name) => !!name);
|
|
45
|
+
// ExposeToModel = 0 rows travel as `codeOnlyActions`, so the flag survives a cross-instance import.
|
|
46
|
+
const codeOnlyActionNames = actionRowsTyped
|
|
47
|
+
.filter(row => row.ExposeToModel === false)
|
|
48
|
+
.map(actionNameOf)
|
|
44
49
|
.filter((name) => !!name);
|
|
45
50
|
const subAgentNames = (subAgentRows.Success ? subAgentRows.Results : [])
|
|
46
51
|
.map(row => AIEngine.Instance.Agents.find(a => UUIDsEqual(a.ID, row.SubAgentID))?.Name)
|
|
@@ -50,6 +55,7 @@ export class SkillImportExportService {
|
|
|
50
55
|
description: skill.Description ?? undefined,
|
|
51
56
|
category: skill.Category ?? undefined,
|
|
52
57
|
actionNames,
|
|
58
|
+
codeOnlyActionNames,
|
|
53
59
|
subAgentNames,
|
|
54
60
|
instructions: skill.Instructions
|
|
55
61
|
});
|
|
@@ -70,6 +76,7 @@ export class SkillImportExportService {
|
|
|
70
76
|
await this.ensureEnginesConfigured(contextUser, md);
|
|
71
77
|
const resolvedActionIDs = this.resolveNames(parsed.frontmatter.actions ?? [], ActionEngineServer.Instance.Actions, warnings, 'Action');
|
|
72
78
|
const resolvedSubAgentIDs = this.resolveNames(parsed.frontmatter.subAgents ?? [], AIEngine.Instance.Agents, warnings, 'Sub-agent');
|
|
79
|
+
const exposeToModel = this.resolveExposeToModel(parsed.frontmatter, resolvedActionIDs, warnings);
|
|
73
80
|
const skill = await md.GetEntityObject('MJ: AI Skills', contextUser);
|
|
74
81
|
if (options?.updateSkillId) {
|
|
75
82
|
const loaded = await skill.Load(options.updateSkillId);
|
|
@@ -90,7 +97,7 @@ export class SkillImportExportService {
|
|
|
90
97
|
if (!saved) {
|
|
91
98
|
throw new Error(`Failed to save imported skill: ${skill.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
92
99
|
}
|
|
93
|
-
await this.resyncJunction(skill.ID, 'MJ: AI Skill Actions', resolvedActionIDs, 'ActionID', contextUser, md);
|
|
100
|
+
await this.resyncJunction(skill.ID, 'MJ: AI Skill Actions', resolvedActionIDs, 'ActionID', contextUser, md, exposeToModel);
|
|
94
101
|
await this.resyncJunction(skill.ID, 'MJ: AI Skill Sub Agents', resolvedSubAgentIDs, 'SubAgentID', contextUser, md);
|
|
95
102
|
return { skill, warnings };
|
|
96
103
|
}
|
|
@@ -117,16 +124,57 @@ export class SkillImportExportService {
|
|
|
117
124
|
}
|
|
118
125
|
return resolved;
|
|
119
126
|
}
|
|
120
|
-
/**
|
|
121
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Turns the frontmatter's `codeOnlyActions` into a per-ActionID `ExposeToModel` map, or `undefined`
|
|
129
|
+
* when the file has no such key — then the file expresses no opinion and {@link resyncJunction}
|
|
130
|
+
* keeps each surviving row's flag as it was. A name listed as code-only but not bundled under
|
|
131
|
+
* `actions` is a warning, not a row.
|
|
132
|
+
*/
|
|
133
|
+
static resolveExposeToModel(frontmatter, resolvedActionIDs, warnings) {
|
|
134
|
+
if (frontmatter.codeOnlyActions === undefined) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
const bundled = new Set(resolvedActionIDs.map(id => id.toUpperCase()));
|
|
138
|
+
const codeOnlyIDs = new Set();
|
|
139
|
+
// Resolve one name at a time so a warning can quote the name the author typed — the resolved
|
|
140
|
+
// GUID is not something they can find in their file.
|
|
141
|
+
for (const name of frontmatter.codeOnlyActions) {
|
|
142
|
+
const [id] = this.resolveNames([name], ActionEngineServer.Instance.Actions, warnings, 'Code-only action');
|
|
143
|
+
if (id === undefined) {
|
|
144
|
+
continue; // resolveNames already warned that the name is unknown here
|
|
145
|
+
}
|
|
146
|
+
if (!bundled.has(id.toUpperCase())) {
|
|
147
|
+
warnings.push(`codeOnlyActions names '${name}', which is not listed under actions; ignored`);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
codeOnlyIDs.add(id.toUpperCase());
|
|
151
|
+
}
|
|
152
|
+
return new Map(resolvedActionIDs.map(id => [id.toUpperCase(), !codeOnlyIDs.has(id.toUpperCase())]));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Deletes existing junction rows for the skill and recreates them from the resolved ID set — the
|
|
156
|
+
* simplest correct resync for a small bounded set of rows.
|
|
157
|
+
*
|
|
158
|
+
* Delete-and-recreate must not lose `AISkillAction.ExposeToModel` (#4226). When the SKILL.md says
|
|
159
|
+
* (`codeOnlyActions`, → `exposeToModel`), the file is authoritative. When it does not — a file
|
|
160
|
+
* exported before the key existed, or hand-written without it — rows that survive the resync (same
|
|
161
|
+
* action before and after) keep the flag they had, so re-saving a skill's SKILL.md never turns a
|
|
162
|
+
* code-only action model-callable; only a genuinely new row takes the column default.
|
|
163
|
+
*/
|
|
164
|
+
static async resyncJunction(skillId, entityName, resolvedIDs, idFieldName, contextUser, provider, exposeToModel) {
|
|
122
165
|
const rv = new RunView();
|
|
123
166
|
const existing = await rv.RunView({
|
|
124
167
|
EntityName: entityName,
|
|
125
168
|
ExtraFilter: `SkillID='${skillId}'`,
|
|
126
169
|
ResultType: 'entity_object'
|
|
127
170
|
}, contextUser);
|
|
171
|
+
const carried = new Map();
|
|
128
172
|
if (existing.Success) {
|
|
129
173
|
for (const row of existing.Results) {
|
|
174
|
+
if (entityName === 'MJ: AI Skill Actions') {
|
|
175
|
+
const actionRow = row;
|
|
176
|
+
carried.set(actionRow.ActionID.toUpperCase(), actionRow.ExposeToModel);
|
|
177
|
+
}
|
|
130
178
|
const deleted = await row.Delete();
|
|
131
179
|
if (!deleted) {
|
|
132
180
|
throw new Error(`Failed to remove existing ${entityName} row during skill re-sync: ${row.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
@@ -138,6 +186,10 @@ export class SkillImportExportService {
|
|
|
138
186
|
junctionRow.NewRecord();
|
|
139
187
|
junctionRow.SkillID = skillId;
|
|
140
188
|
junctionRow[idFieldName] = id;
|
|
189
|
+
const flag = exposeToModel?.get(id.toUpperCase()) ?? carried.get(id.toUpperCase());
|
|
190
|
+
if (flag !== undefined) {
|
|
191
|
+
junctionRow.ExposeToModel = flag;
|
|
192
|
+
}
|
|
141
193
|
const saved = await junctionRow.Save();
|
|
142
194
|
if (!saved) {
|
|
143
195
|
throw new Error(`Failed to create ${entityName} row during skill re-sync: ${junctionRow.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillImportExportService.js","sourceRoot":"","sources":["../src/SkillImportExportService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqB,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"SkillImportExportService.js","sourceRoot":"","sources":["../src/SkillImportExportService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqB,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,w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nlyActions:
|
|
16
|
+
* - Generate PDF
|
|
15
17
|
* subAgents:
|
|
16
18
|
* - Report Formatter Agent
|
|
17
19
|
* ---
|
|
@@ -20,9 +22,18 @@
|
|
|
20
22
|
* prompt when the skill is activated.
|
|
21
23
|
* ```
|
|
22
24
|
*
|
|
25
|
+
* `codeOnlyActions` (optional) names the subset of `actions` bundled with `AISkillAction.ExposeToModel = 0`:
|
|
26
|
+
* kept with the skill for export and tooling, but left out of the agent's run — not described to the
|
|
27
|
+
* model, not executable by the agent; application code invokes them. Written on export only when the
|
|
28
|
+
* skill has such rows, so files exported before the key existed are byte-identical. A file without the
|
|
29
|
+
* key expresses no opinion about the flag (the importer keeps surviving rows' flags as they were); a
|
|
30
|
+
* file with the key but no names under it says "nothing is code-only", which is how an author puts the
|
|
31
|
+
* last code-only action back into the run — delete its line, keep the key.
|
|
32
|
+
*
|
|
23
33
|
* Deliberately NOT a general-purpose YAML parser — the frontmatter shape is fixed and small
|
|
24
34
|
* (flat scalar keys + simple string-list keys), so a hand-rolled parser avoids taking on a new
|
|
25
|
-
* dependency for a narrow, fully-controlled need.
|
|
35
|
+
* dependency for a narrow, fully-controlled need. Unknown keys — scalar or list — are skipped, so a
|
|
36
|
+
* file written by a newer MJ still parses here.
|
|
26
37
|
*
|
|
27
38
|
* @module @memberjunction/ai-agents
|
|
28
39
|
*/
|
|
@@ -37,6 +48,8 @@ export interface SkillMarkdownFrontmatter {
|
|
|
37
48
|
category?: string;
|
|
38
49
|
actions?: string[];
|
|
39
50
|
subAgents?: string[];
|
|
51
|
+
/** Names within `actions` whose `AISkillAction.ExposeToModel` is 0. Absent = the file expresses no opinion. */
|
|
52
|
+
codeOnlyActions?: string[];
|
|
40
53
|
}
|
|
41
54
|
/**
|
|
42
55
|
* Result of parsing a SKILL.md file: the frontmatter fields plus the Instructions body.
|
|
@@ -54,6 +67,8 @@ export interface SerializeSkillMarkdownParams {
|
|
|
54
67
|
description?: string;
|
|
55
68
|
category?: string;
|
|
56
69
|
actionNames?: string[];
|
|
70
|
+
/** Subset of `actionNames` bundled with `ExposeToModel = 0`; emitted as `codeOnlyActions` when non-empty. */
|
|
71
|
+
codeOnlyActionNames?: string[];
|
|
57
72
|
subAgentNames?: string[];
|
|
58
73
|
instructions: string;
|
|
59
74
|
}
|
|
@@ -74,6 +89,7 @@ export declare class SkillMarkdownConverter {
|
|
|
74
89
|
* a future field addition doesn't break parsing of older SKILL.md files.
|
|
75
90
|
*/
|
|
76
91
|
private static parseFrontmatterLines;
|
|
92
|
+
private static isListKey;
|
|
77
93
|
/** Quotes a scalar value if it contains a colon or leading/trailing whitespace that would otherwise break the simple parser. */
|
|
78
94
|
private static escapeScalar;
|
|
79
95
|
/** Strips the quoting {@link escapeScalar} applies, if present. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillMarkdownConverter.d.ts","sourceRoot":"","sources":["../src/SkillMarkdownConverter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SkillMarkdownConverter.d.ts","sourceRoot":"","sources":["../src/SkillMarkdownConverter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,+GAA+G;IAC/G,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,WAAW,EAAE,wBAAwB,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,6GAA6G;IAC7G,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACxB;AAQD,qBAAa,sBAAsB;IAC/B;;;OAGG;WACW,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,mBAAmB;IA2B9D;;OAEG;WACW,SAAS,CAAC,MAAM,EAAE,4BAA4B,GAAG,MAAM;IAmCrE;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IA0DpC,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB,gIAAgI;IAChI,OAAO,CAAC,MAAM,CAAC,YAAY;IAO3B,mEAAmE;IACnE,OAAO,CAAC,MAAM,CAAC,cAAc;CAOhC"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* actions:
|
|
13
13
|
* - Run Query
|
|
14
14
|
* - Generate PDF
|
|
15
|
+
* codeOnlyActions:
|
|
16
|
+
* - Generate PDF
|
|
15
17
|
* subAgents:
|
|
16
18
|
* - Report Formatter Agent
|
|
17
19
|
* ---
|
|
@@ -20,13 +22,23 @@
|
|
|
20
22
|
* prompt when the skill is activated.
|
|
21
23
|
* ```
|
|
22
24
|
*
|
|
25
|
+
* `codeOnlyActions` (optional) names the subset of `actions` bundled with `AISkillAction.ExposeToModel = 0`:
|
|
26
|
+
* kept with the skill for export and tooling, but left out of the agent's run — not described to the
|
|
27
|
+
* model, not executable by the agent; application code invokes them. Written on export only when the
|
|
28
|
+
* skill has such rows, so files exported before the key existed are byte-identical. A file without the
|
|
29
|
+
* key expresses no opinion about the flag (the importer keeps surviving rows' flags as they were); a
|
|
30
|
+
* file with the key but no names under it says "nothing is code-only", which is how an author puts the
|
|
31
|
+
* last code-only action back into the run — delete its line, keep the key.
|
|
32
|
+
*
|
|
23
33
|
* Deliberately NOT a general-purpose YAML parser — the frontmatter shape is fixed and small
|
|
24
34
|
* (flat scalar keys + simple string-list keys), so a hand-rolled parser avoids taking on a new
|
|
25
|
-
* dependency for a narrow, fully-controlled need.
|
|
35
|
+
* dependency for a narrow, fully-controlled need. Unknown keys — scalar or list — are skipped, so a
|
|
36
|
+
* file written by a newer MJ still parses here.
|
|
26
37
|
*
|
|
27
38
|
* @module @memberjunction/ai-agents
|
|
28
39
|
*/
|
|
29
40
|
const FRONTMATTER_DELIMITER = '---';
|
|
41
|
+
const LIST_KEYS = new Set(['actions', 'subAgents', 'codeOnlyActions']);
|
|
30
42
|
export class SkillMarkdownConverter {
|
|
31
43
|
/**
|
|
32
44
|
* Parses a SKILL.md document into its frontmatter + instructions body. Throws with a clear
|
|
@@ -71,6 +83,12 @@ export class SkillMarkdownConverter {
|
|
|
71
83
|
lines.push(` - ${this.escapeScalar(name)}`);
|
|
72
84
|
}
|
|
73
85
|
}
|
|
86
|
+
if (params.codeOnlyActionNames && params.codeOnlyActionNames.length > 0) {
|
|
87
|
+
lines.push('codeOnlyActions:');
|
|
88
|
+
for (const name of params.codeOnlyActionNames) {
|
|
89
|
+
lines.push(` - ${this.escapeScalar(name)}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
74
92
|
if (params.subAgentNames && params.subAgentNames.length > 0) {
|
|
75
93
|
lines.push('subAgents:');
|
|
76
94
|
for (const name of params.subAgentNames) {
|
|
@@ -91,6 +109,8 @@ export class SkillMarkdownConverter {
|
|
|
91
109
|
*/
|
|
92
110
|
static parseFrontmatterLines(lines) {
|
|
93
111
|
const result = { name: '' };
|
|
112
|
+
// The list key whose items follow; 'ignore' = an unknown list key, whose items are skipped rather
|
|
113
|
+
// than rejected, so a file written by a newer MJ (a key this parser has never heard of) still parses.
|
|
94
114
|
let currentListKey = null;
|
|
95
115
|
for (const rawLine of lines) {
|
|
96
116
|
if (rawLine.trim().length === 0) {
|
|
@@ -98,8 +118,10 @@ export class SkillMarkdownConverter {
|
|
|
98
118
|
}
|
|
99
119
|
const listItemMatch = rawLine.match(/^\s*-\s+(.*)$/);
|
|
100
120
|
if (listItemMatch && currentListKey) {
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
if (currentListKey !== 'ignore') {
|
|
122
|
+
const value = this.unescapeScalar(listItemMatch[1]);
|
|
123
|
+
(result[currentListKey] ??= []).push(value);
|
|
124
|
+
}
|
|
103
125
|
continue;
|
|
104
126
|
}
|
|
105
127
|
const keyValueMatch = rawLine.match(/^([A-Za-z][A-Za-z0-9_]*)\s*:\s*(.*)$/);
|
|
@@ -108,7 +130,7 @@ export class SkillMarkdownConverter {
|
|
|
108
130
|
}
|
|
109
131
|
const [, key, rawValue] = keyValueMatch;
|
|
110
132
|
const value = rawValue.trim();
|
|
111
|
-
if (key
|
|
133
|
+
if (this.isListKey(key)) {
|
|
112
134
|
currentListKey = key;
|
|
113
135
|
if (value.length > 0) {
|
|
114
136
|
// Inline list form, e.g. "actions: [Run Query, Generate PDF]" — split on commas.
|
|
@@ -116,9 +138,19 @@ export class SkillMarkdownConverter {
|
|
|
116
138
|
result[key] = inline.split(',').map(s => this.unescapeScalar(s.trim())).filter(s => s.length > 0);
|
|
117
139
|
currentListKey = null;
|
|
118
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
// Block form. The key is present, so the list exists from here even if no `- item`
|
|
143
|
+
// follows: "present but empty" is an explicit empty list, distinct from an absent
|
|
144
|
+
// key. That distinction matters for `codeOnlyActions`, where absent means "no
|
|
145
|
+
// opinion, keep each row's flag" and empty means "nothing is code-only" — without
|
|
146
|
+
// it, deleting the last name from the list would silently keep that action
|
|
147
|
+
// code-only on re-import.
|
|
148
|
+
result[key] ??= [];
|
|
149
|
+
}
|
|
119
150
|
continue;
|
|
120
151
|
}
|
|
121
|
-
|
|
152
|
+
// A `key:` with nothing after it opens a list this parser does not know — skip its items.
|
|
153
|
+
currentListKey = value.length === 0 ? 'ignore' : null;
|
|
122
154
|
if (key === 'name' || key === 'description' || key === 'category') {
|
|
123
155
|
result[key] = this.unescapeScalar(value);
|
|
124
156
|
}
|
|
@@ -126,6 +158,9 @@ export class SkillMarkdownConverter {
|
|
|
126
158
|
}
|
|
127
159
|
return result;
|
|
128
160
|
}
|
|
161
|
+
static isListKey(key) {
|
|
162
|
+
return LIST_KEYS.has(key);
|
|
163
|
+
}
|
|
129
164
|
/** Quotes a scalar value if it contains a colon or leading/trailing whitespace that would otherwise break the simple parser. */
|
|
130
165
|
static escapeScalar(value) {
|
|
131
166
|
if (/^\s|\s$|:/.test(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkillMarkdownConverter.js","sourceRoot":"","sources":["../src/SkillMarkdownConverter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SkillMarkdownConverter.js","sourceRoot":"","sources":["../src/SkillMarkdownConverter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAwCH,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAIpC,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAe,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAE1G,MAAM,OAAO,sBAAsB;IAC/B;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,YAAoB;QACpC,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAErC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,qBAAqB,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;QAC1F,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAA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AE,CAAC;YAC1B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,mEAAmE;IAC3D,MAAM,CAAC,cAAc,CAAC,KAAa;QACvC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC1E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @since 2.49.0
|
|
12
12
|
*/
|
|
13
13
|
import { AIPromptParams, AIPromptRunResult, BaseAgentNextStep, AgentPayloadChangeRequest, AgentAction, AgentSubAgentRequest, ExecuteAgentParams, AgentConfiguration } from '@memberjunction/ai-core-plus';
|
|
14
|
+
import type { NativeToolBinding } from '../native-tools/control-tools.js';
|
|
14
15
|
import { MJAIAgentTypeEntity } from '@memberjunction/core-entities';
|
|
15
16
|
import { MJAIPromptEntityExtended } from "@memberjunction/ai-core-plus";
|
|
16
17
|
import { JSONValidator } from '@memberjunction/global';
|
|
@@ -55,6 +56,21 @@ export declare abstract class BaseAgentType {
|
|
|
55
56
|
* @protected
|
|
56
57
|
*/
|
|
57
58
|
protected _jsonValidator: JSONValidator;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this agent type can read a native tool call back as a step (plan §8.1).
|
|
61
|
+
*
|
|
62
|
+
* `BaseAgent` declares an agent's Actions as native tools ONLY when this is true. Declaring them
|
|
63
|
+
* to a type that cannot consume the call is not harmless: the model answers with a tool call and
|
|
64
|
+
* no text, the type's `DetermineNextStep` parses the empty text, and the turn becomes a Retry
|
|
65
|
+
* — a run that would have worked on the envelope path fails because tools were offered. That is
|
|
66
|
+
* exactly the failure a catalog-wide `DefaultToNativeToolCalling` would have produced on every
|
|
67
|
+
* Flow agent with Actions.
|
|
68
|
+
*
|
|
69
|
+
* Defaults to false. A type opts in by overriding this AND by honouring the `nativeToolBindings`
|
|
70
|
+
* argument of {@link DetermineNextStep}; the two go together, and `LoopAgentType` is the only
|
|
71
|
+
* type that does both today.
|
|
72
|
+
*/
|
|
73
|
+
get SupportsNativeToolCalls(): boolean;
|
|
58
74
|
/**
|
|
59
75
|
* Common placeholder for current payload injection
|
|
60
76
|
* @static
|
|
@@ -97,7 +113,16 @@ export declare abstract class BaseAgentType {
|
|
|
97
113
|
* }
|
|
98
114
|
* ```
|
|
99
115
|
*/
|
|
100
|
-
abstract DetermineNextStep<P = any, ATS = any>(promptResult: AIPromptRunResult | null, params: ExecuteAgentParams<any, P>, payload: P, agentTypeState: ATS
|
|
116
|
+
abstract DetermineNextStep<P = any, ATS = any>(promptResult: AIPromptRunResult | null, params: ExecuteAgentParams<any, P>, payload: P, agentTypeState: ATS,
|
|
117
|
+
/**
|
|
118
|
+
* Reverse map from the sanitized tool name a model calls back to the Action it names,
|
|
119
|
+
* supplied by `BaseAgent` only when the turn ran with native tools declared (plan §8.1).
|
|
120
|
+
*
|
|
121
|
+
* A tool call arrives as `run_ad_hoc_query`, not "Run Ad-hoc Query", so without this an
|
|
122
|
+
* agent type cannot dispatch one. Optional and trailing: agent types that never declare
|
|
123
|
+
* tools are unaffected.
|
|
124
|
+
*/
|
|
125
|
+
nativeToolBindings?: ReadonlyMap<string, NativeToolBinding>): Promise<BaseAgentNextStep<P>>;
|
|
101
126
|
/**
|
|
102
127
|
* Determines the initial step when no previous decision exists.
|
|
103
128
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-agent-type.d.ts","sourceRoot":"","sources":["../../src/agent-types/base-agent-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,WAAW,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AACzM,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAY,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,8BAAsB,aAAa;IAC/B;;;OAGG;IACH,SAAS,CAAC,cAAc,EAAE,aAAa,CAAuB;IAE9D;;;OAGG;IACH,gBAAuB,2BAA2B,sBAAsB;IAExE;;;;;;OAMG;aACa,wBAAwB,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAE9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;aACa,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAChD,YAAY,EAAE,iBAAiB,GAAG,IAAI,EACtC,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,EAClC,OAAO,EAAE,CAAC,EACV,cAAc,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"base-agent-type.d.ts","sourceRoot":"","sources":["../../src/agent-types/base-agent-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,WAAW,EAAE,oBAAoB,EAAE,kBAAkB,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EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtC,eAAe,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;SAAE,CAAC;KACpG,GACF;QACC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAe,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;SAAE,CAAC;QACjG,OAAO,CAAC,EAAE,CAAC,CAAC;KACf,GAAG,IAAI;IAIR;;;;;;;;;;OAUG;IACI,kBAAkB,CAAC,CAAC,CAAC,EACxB,eAAe,EAAE;QACb,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;QAC/B,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,cAAc,EAAE,CAAC,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,GAAG,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,GAAG,CAAC;KACpB,GACF,CAAC,GAAG,IAAI;CAGd"}
|
|
@@ -54,6 +54,23 @@ export class BaseAgentType {
|
|
|
54
54
|
*/
|
|
55
55
|
this._jsonValidator = new JSONValidator();
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether this agent type can read a native tool call back as a step (plan §8.1).
|
|
59
|
+
*
|
|
60
|
+
* `BaseAgent` declares an agent's Actions as native tools ONLY when this is true. Declaring them
|
|
61
|
+
* to a type that cannot consume the call is not harmless: the model answers with a tool call and
|
|
62
|
+
* no text, the type's `DetermineNextStep` parses the empty text, and the turn becomes a Retry
|
|
63
|
+
* — a run that would have worked on the envelope path fails because tools were offered. That is
|
|
64
|
+
* exactly the failure a catalog-wide `DefaultToNativeToolCalling` would have produced on every
|
|
65
|
+
* Flow agent with Actions.
|
|
66
|
+
*
|
|
67
|
+
* Defaults to false. A type opts in by overriding this AND by honouring the `nativeToolBindings`
|
|
68
|
+
* argument of {@link DetermineNextStep}; the two go together, and `LoopAgentType` is the only
|
|
69
|
+
* type that does both today.
|
|
70
|
+
*/
|
|
71
|
+
get SupportsNativeToolCalls() {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
57
74
|
/**
|
|
58
75
|
* Common placeholder for current payload injection
|
|
59
76
|
* @static
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-agent-type.js","sourceRoot":"","sources":["../../src/agent-types/base-agent-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"base-agent-type.js","sourceRoot":"","sources":["../../src/agent-types/base-agent-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAgB,aAAa;IAAnC;QACI;;;WAGG;QACO,mBAAc,GAAkB,IAAI,aAAa,EAAE,CAAC;IAgmBlE,CAAC;IA9lBG;;;;;;;;;;;;;OAaG;IACH,IAAW,uBAAuB;QAC9B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;OAGG;aACoB,gCAA2B,GAAG,kBAAkB,AAArB,CAAsB;IA6IxE;;;;;;;;;;;;;;;;;OAiBG;IACI,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,SAA8B;QACnE,IAAI,CAAC;YACD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;YACrE,OAAO,iBAAi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CAAC,uBAAuB,CAChC,cAAmB,EACnB,eAAqC,EACrC,cAAiB,EACjB,cAAmB,EACnB,WAAiC;QAEjC,sCAAsC;QACtC,oDAAoD;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAW,yBAAyB;QAChC,OAAO,IAAI,CAAC,CAAC,4CAA4C;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACI,8BAA8B;QACjC,OAAO,kEAAkE;YAClE,kEAAkE,CAAC;IAC9E,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACI,KAAK,CAAC,kBAAkB,CAC3B,IAA0B,EAC1B,MAA0B,EAC1B,MAA6B,EAC7B,OAAU,EACV,cAAmB;QAEnB,2EAA2E;QAC3E,4DAA4D;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,IAAW,0BAA0B;QACjC,OAAO,IAAI,CAAC,CAAE,4CAA4C;IAC9D,CAAC;IAED;;;;;;;;;;OAUG;IACI,mBAAmB,CACtB,OAQC;QAMD,OAAO,IAAI,CAAC,CAAE,6BAA6B;IAC/C,CAAC;IAED;;;;;;;;;;OAUG;IACI,kBAAkB,CACrB,eAQC;QAED,OAAO,IAAI,CAAC,CAAE,6BAA6B;IAC/C,CAAC"}
|
|
@@ -3,6 +3,22 @@ import { ArtifactToolCall } from "../ArtifactToolManager.js";
|
|
|
3
3
|
import { ConversationToolCall } from "../ConversationToolManager.js";
|
|
4
4
|
import { MemoryWriteRequest } from "../MemoryWriteManager.js";
|
|
5
5
|
export type { ForEachOperation, WhileOperation, ArtifactToolCall, ConversationToolCall, MemoryWriteRequest };
|
|
6
|
+
/**
|
|
7
|
+
* Every value `nextStep.type` may take, in the canonical casing the dispatcher switches on.
|
|
8
|
+
*
|
|
9
|
+
* Exported because three things have to agree and used to agree only by hand: this union, the
|
|
10
|
+
* validator's accept-list, and the exemplars shipped in `metadata/prompts/**` that teach models
|
|
11
|
+
* what to emit. The compile-time checks below make the first two inseparable; the exemplar guard
|
|
12
|
+
* in `__tests__/loop-exemplar-conformance.test.ts` binds the third to this constant, so a new step
|
|
13
|
+
* type cannot be added without the exemplars being re-checked against it.
|
|
14
|
+
*
|
|
15
|
+
* Casing is load-bearing. `LoopAgentType.DetermineNextStep` switches on the raw value, so a
|
|
16
|
+
* lower-cased `'chat'` passes validation (which compares case-insensitively) and then falls
|
|
17
|
+
* through to `default:` — a forced Retry that costs a whole iteration.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LOOP_NEXT_STEP_TYPES: readonly ["Actions", "ClientTools", "Sub-Agent", "Chat", "Retry", "ForEach", "While", "Pipeline", "Skill", "Plan", "Tasks"];
|
|
20
|
+
/** The `nextStep.type` union, derived from the interface rather than restated. */
|
|
21
|
+
export type LoopNextStepType = NonNullable<LoopAgentResponse['nextStep']>['type'];
|
|
6
22
|
/**
|
|
7
23
|
* Response structure for Loop Agent Type
|
|
8
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-agent-response-type.d.ts","sourceRoot":"","sources":["../../src/agent-types/loop-agent-response-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzN,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;AAE7G;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACtC;;OAEG;IACH,YAAY,CAAC,EAAE,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ChB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACjC,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,WAAW,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC,CAAC;QAEH;;WAEG;QACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;QAE3B;;WAEG;QACH,KAAK,CAAC,EAAE,cAAc,CAAC;QAEvB;;;;;WAKG;QACH,MAAM,CAAC,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb;;;;eAIG;YACH,MAAM,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;QAEH;;;;WAIG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;;;;;;;WASG;QACH,KAAK,CAAC,EAAE,aAAa,CAAC;KACzB,CAAC;CACL"}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Every value `nextStep.type` may take, in the canonical casing the dispatcher switches on.
|
|
3
|
+
*
|
|
4
|
+
* Exported because three things have to agree and used to agree only by hand: this union, the
|
|
5
|
+
* validator's accept-list, and the exemplars shipped in `metadata/prompts/**` that teach models
|
|
6
|
+
* what to emit. The compile-time checks below make the first two inseparable; the exemplar guard
|
|
7
|
+
* in `__tests__/loop-exemplar-conformance.test.ts` binds the third to this constant, so a new step
|
|
8
|
+
* type cannot be added without the exemplars being re-checked against it.
|
|
9
|
+
*
|
|
10
|
+
* Casing is load-bearing. `LoopAgentType.DetermineNextStep` switches on the raw value, so a
|
|
11
|
+
* lower-cased `'chat'` passes validation (which compares case-insensitively) and then falls
|
|
12
|
+
* through to `default:` — a forced Retry that costs a whole iteration.
|
|
13
|
+
*/
|
|
14
|
+
export const LOOP_NEXT_STEP_TYPES = [
|
|
15
|
+
'Actions', 'ClientTools', 'Sub-Agent', 'Chat', 'Retry',
|
|
16
|
+
'ForEach', 'While', 'Pipeline', 'Skill', 'Plan', 'Tasks'
|
|
17
|
+
];
|
|
18
|
+
const _noInventedValues = true;
|
|
19
|
+
const _noForgottenValues = true;
|
|
2
20
|
//\n{@include ../../../CorePlus/src/agent-payload-change-request.ts}
|
|
3
21
|
//\n{@include ../../../CorePlus/src/response-forms.ts}
|
|
4
22
|
//# sourceMappingURL=loop-agent-response-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-agent-response-type.js","sourceRoot":"","sources":["../../src/agent-types/loop-agent-response-type.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"loop-agent-response-type.js","sourceRoot":"","sources":["../../src/agent-types/loop-agent-response-type.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO;IACtD,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;CAClD,CAAC;AAUX,MAAM,iBAAiB,GAAyD,IAAI,CAAC;AACrF,MAAM,kBAAkB,GAAyD,IAAI,CAAC;AA8NtF,oEAAoE;AACpE,sDAAsD"}
|
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
* @since 2.49.0
|
|
11
11
|
*/
|
|
12
12
|
import { BaseAgentType } from './base-agent-type.js';
|
|
13
|
+
import type { NativeToolBinding } from '../native-tools/control-tools.js';
|
|
13
14
|
import { AIPromptRunResult, BaseAgentNextStep, AIPromptParams, ExecuteAgentParams, AgentConfiguration, AgentAction } from '@memberjunction/ai-core-plus';
|
|
14
15
|
import { MJAIPromptEntityExtended } from '@memberjunction/ai-core-plus';
|
|
15
16
|
export declare class LoopAgentType extends BaseAgentType {
|
|
17
|
+
/** The Loop type reads tool calls back as Actions steps (§8.1), so its Actions may be declared as tools. */
|
|
18
|
+
get SupportsNativeToolCalls(): boolean;
|
|
16
19
|
private _evaluator;
|
|
17
20
|
/**
|
|
18
21
|
* Consecutive inline-read-tool pre-emptions forced so far. Per-run safe: a fresh
|
|
@@ -75,7 +78,35 @@ export declare class LoopAgentType extends BaseAgentType {
|
|
|
75
78
|
*
|
|
76
79
|
* @throws {Error} Implicitly through failed parsing, but returns failed step instead
|
|
77
80
|
*/
|
|
78
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Turns native tool calls on the turn into an `Actions` step, or returns null when there were
|
|
83
|
+
* none (the envelope path).
|
|
84
|
+
*
|
|
85
|
+
* Resolution is by the reverse map rather than by re-sanitizing names, because sanitization is
|
|
86
|
+
* lossy: two Action names can collapse to one tool name, which {@link buildActionToolSet}
|
|
87
|
+
* rejects at build time precisely so this lookup can be exact.
|
|
88
|
+
*
|
|
89
|
+
* A call naming a tool that was never declared is a Retry, not a silent drop. Cerebras is
|
|
90
|
+
* documented to do this, measured at roughly one forced call in six, so the loop
|
|
91
|
+
* has to be able to say "that tool does not exist" rather than appear to hang.
|
|
92
|
+
*/
|
|
93
|
+
protected nextStepFromNativeToolCalls(promptResult: AIPromptRunResult, bindings?: ReadonlyMap<string, NativeToolBinding>): BaseAgentNextStep | null;
|
|
94
|
+
/** Pairs each call with its binding; a control-tool binding counts only under implicit control flow. */
|
|
95
|
+
private resolveNativeCalls;
|
|
96
|
+
/** The turn-reading table of spec §2.1, one row per branch. */
|
|
97
|
+
private routeResolvedCalls;
|
|
98
|
+
/** `ask_user` ends the run as Chat / AwaitingFeedback; it must travel alone and carry a message. */
|
|
99
|
+
private askUserStep;
|
|
100
|
+
/** One sub-agent tool → `subAgent`; several → the parallel `subAgents[]` form. */
|
|
101
|
+
private subAgentStep;
|
|
102
|
+
/** Action calls → the Actions step, with any same-turn payload change attached. */
|
|
103
|
+
private actionsStep;
|
|
104
|
+
/**
|
|
105
|
+
* `payload_change_request` alone: apply and continue. Retry is the non-terminal "go again" step
|
|
106
|
+
* (Pipeline uses it the same way); the instructions are what the loop shows the model.
|
|
107
|
+
*/
|
|
108
|
+
private payloadOnlyStep;
|
|
109
|
+
DetermineNextStep<P = any, ATS = any>(promptResult: AIPromptRunResult | null, params: ExecuteAgentParams<any, P>, payload: P, agentTypeState: ATS, nativeToolBindings?: ReadonlyMap<string, NativeToolBinding>): Promise<BaseAgentNextStep<P>>;
|
|
79
110
|
/**
|
|
80
111
|
* Validates that the response conforms to the expected LoopAgentResponse structure.
|
|
81
112
|
*
|