@arnilo/prism-supervisor 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/dist/supervisor.js +25 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/supervisor.js
CHANGED
|
@@ -93,16 +93,32 @@ export function createSupervisor(options) {
|
|
|
93
93
|
redactor: options.redactor ?? childAgent.config.redactor,
|
|
94
94
|
});
|
|
95
95
|
const session = agent.createSession({ id: `${delegationId}-session`, metadata: { supervisorId: id, delegationId, resourceId, threadId } });
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
let result;
|
|
97
|
+
try {
|
|
98
|
+
result = await abortable(session.run(input, {
|
|
99
|
+
signal: controller.signal,
|
|
100
|
+
limits: {
|
|
101
|
+
maxToolRounds: limits.maxSteps,
|
|
102
|
+
maxToolCalls: limits.maxToolCalls,
|
|
103
|
+
maxTotalTokens: limits.maxTokens,
|
|
104
|
+
maxWallTimeMs: limits.timeoutMs,
|
|
105
|
+
},
|
|
106
|
+
ownership: options.ownership,
|
|
107
|
+
redactor: options.redactor,
|
|
108
|
+
metadata: { ...request.metadata, supervisorId: id, delegationId, resourceId, threadId, depth },
|
|
109
|
+
}), controller.signal);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (error instanceof AgentRunError && error.result.limit) {
|
|
113
|
+
const label = error.result.limit.limit === "maxTotalTokens" ? "token"
|
|
114
|
+
: error.result.limit.limit === "maxToolCalls" ? "tool-call"
|
|
115
|
+
: error.result.limit.limit === "maxWallTimeMs" ? "timeout"
|
|
116
|
+
: "run";
|
|
117
|
+
throw new SupervisorLimitError(`Delegation ${label} limit exceeded`);
|
|
118
|
+
}
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
103
121
|
const totalTokens = result.usage?.totalTokens ?? ((result.usage?.inputTokens ?? 0) + (result.usage?.outputTokens ?? 0));
|
|
104
|
-
if (totalTokens > limits.maxTokens)
|
|
105
|
-
throw new SupervisorLimitError("Delegation token limit exceeded");
|
|
106
122
|
events.publish({ type: "delegation_finished", childId: request.childId, delegationId, depth, status: result.status, totalTokens });
|
|
107
123
|
await complete(toCompletion(result, request.childId, delegationId, depth, options));
|
|
108
124
|
completionSent = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism-supervisor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Optional bounded local supervisor delegation and A2A 1.0 interoperability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pack:dry-run": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@arnilo/prism": "0.0.
|
|
28
|
+
"@arnilo/prism": "0.0.7"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@arnilo/prism": "file:../.."
|