@animalabs/agent-framework 0.7.4 → 0.9.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/src/agent.d.ts +10 -0
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +33 -3
- package/dist/src/agent.js.map +1 -1
- package/dist/src/code-execution/index.d.ts +1 -1
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +23 -1
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +40 -4
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +15 -2
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +156 -7
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +27 -2
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/framework.d.ts +234 -5
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +1818 -188
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +11 -0
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +66 -0
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts +115 -0
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -0
- package/dist/src/mcpl/capability-grant.js +291 -0
- package/dist/src/mcpl/capability-grant.js.map +1 -0
- package/dist/src/mcpl/capability-mask.d.ts +51 -0
- package/dist/src/mcpl/capability-mask.d.ts.map +1 -0
- package/dist/src/mcpl/capability-mask.js +190 -0
- package/dist/src/mcpl/capability-mask.js.map +1 -0
- package/dist/src/mcpl/channel-registry.d.ts +30 -2
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +216 -43
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +8 -3
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js +28 -8
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/errors.d.ts +6 -0
- package/dist/src/mcpl/errors.d.ts.map +1 -1
- package/dist/src/mcpl/errors.js +6 -0
- package/dist/src/mcpl/errors.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts +10 -1
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js +45 -4
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +10 -14
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +58 -67
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +1 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/prose-stream-router.d.ts +9 -0
- package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
- package/dist/src/mcpl/prose-stream-router.js +16 -0
- package/dist/src/mcpl/prose-stream-router.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +20 -2
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +93 -9
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +231 -32
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +4 -3
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/tags.d.ts +24 -0
- package/dist/src/mcpl/tags.d.ts.map +1 -0
- package/dist/src/mcpl/tags.js +52 -0
- package/dist/src/mcpl/tags.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +1 -1
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +35 -7
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +169 -64
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js +16 -2
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +12 -0
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +26 -0
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +20 -0
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +48 -15
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/sync.d.ts +4 -0
- package/dist/src/modules/workspace/sync.d.ts.map +1 -1
- package/dist/src/modules/workspace/sync.js +1 -1
- package/dist/src/modules/workspace/sync.js.map +1 -1
- package/dist/src/refusal-reactions.d.ts +27 -0
- package/dist/src/refusal-reactions.d.ts.map +1 -0
- package/dist/src/refusal-reactions.js +35 -0
- package/dist/src/refusal-reactions.js.map +1 -0
- package/dist/src/tool-result-history.d.ts +10 -0
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +16 -5
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/types/agent.d.ts +35 -0
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +26 -0
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +22 -0
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +24 -0
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/test/busy-agent-scheduler.test.js +1 -0
- package/dist/test/busy-agent-scheduler.test.js.map +1 -1
- package/dist/test/channel-registry-routing.test.js +38 -10
- package/dist/test/channel-registry-routing.test.js.map +1 -1
- package/dist/test/channel-registry-typing.test.js +10 -1
- package/dist/test/channel-registry-typing.test.js.map +1 -1
- package/dist/test/checkpoint-attribution.test.js +168 -8
- package/dist/test/checkpoint-attribution.test.js.map +1 -1
- package/dist/test/code-execution.test.js +327 -1
- package/dist/test/code-execution.test.js.map +1 -1
- package/dist/test/conversation-fork-injection-scoping.test.js +8 -3
- package/dist/test/conversation-fork-injection-scoping.test.js.map +1 -1
- package/dist/test/deferred-wake-integrity.test.d.ts +29 -0
- package/dist/test/deferred-wake-integrity.test.d.ts.map +1 -0
- package/dist/test/deferred-wake-integrity.test.js +320 -0
- package/dist/test/deferred-wake-integrity.test.js.map +1 -0
- package/dist/test/event-gate-selfwake.test.d.ts +15 -0
- package/dist/test/event-gate-selfwake.test.d.ts.map +1 -0
- package/dist/test/event-gate-selfwake.test.js +125 -0
- package/dist/test/event-gate-selfwake.test.js.map +1 -0
- package/dist/test/machine-close-provenance.test.d.ts +2 -0
- package/dist/test/machine-close-provenance.test.d.ts.map +1 -0
- package/dist/test/machine-close-provenance.test.js +116 -0
- package/dist/test/machine-close-provenance.test.js.map +1 -0
- package/dist/test/mcpl-access-provider.test.d.ts +2 -0
- package/dist/test/mcpl-access-provider.test.d.ts.map +1 -0
- package/dist/test/mcpl-access-provider.test.js +20 -0
- package/dist/test/mcpl-access-provider.test.js.map +1 -0
- package/dist/test/mcpl-awareness-barrier.test.js +10 -0
- package/dist/test/mcpl-awareness-barrier.test.js.map +1 -1
- package/dist/test/mcpl-capability-grant.test.d.ts +10 -0
- package/dist/test/mcpl-capability-grant.test.d.ts.map +1 -0
- package/dist/test/mcpl-capability-grant.test.js +109 -0
- package/dist/test/mcpl-capability-grant.test.js.map +1 -0
- package/dist/test/mcpl-capability-scoping.test.d.ts +2 -0
- package/dist/test/mcpl-capability-scoping.test.d.ts.map +1 -0
- package/dist/test/mcpl-capability-scoping.test.js +266 -0
- package/dist/test/mcpl-capability-scoping.test.js.map +1 -0
- package/dist/test/mcpl-gate-roundtrip.test.js +13 -0
- package/dist/test/mcpl-gate-roundtrip.test.js.map +1 -1
- package/dist/test/mcpl-list-status.test.d.ts +2 -0
- package/dist/test/mcpl-list-status.test.d.ts.map +1 -0
- package/dist/test/mcpl-list-status.test.js +78 -0
- package/dist/test/mcpl-list-status.test.js.map +1 -0
- package/dist/test/mcpl-manifest-changed.test.d.ts +2 -0
- package/dist/test/mcpl-manifest-changed.test.d.ts.map +1 -0
- package/dist/test/mcpl-manifest-changed.test.js +177 -0
- package/dist/test/mcpl-manifest-changed.test.js.map +1 -0
- package/dist/test/mcpl-reconnect-events.test.js +27 -2
- package/dist/test/mcpl-reconnect-events.test.js.map +1 -1
- package/dist/test/mcpl-reconnect-reregistration.test.js +53 -17
- package/dist/test/mcpl-reconnect-reregistration.test.js.map +1 -1
- package/dist/test/mcpl-request-timeout.test.js +1 -1
- package/dist/test/mcpl-request-timeout.test.js.map +1 -1
- package/dist/test/module-context-integration.test.d.ts +18 -0
- package/dist/test/module-context-integration.test.d.ts.map +1 -0
- package/dist/test/module-context-integration.test.js +181 -0
- package/dist/test/module-context-integration.test.js.map +1 -0
- package/dist/test/physical-window-restart.test.d.ts +14 -0
- package/dist/test/physical-window-restart.test.d.ts.map +1 -0
- package/dist/test/physical-window-restart.test.js +222 -0
- package/dist/test/physical-window-restart.test.js.map +1 -0
- package/dist/test/present-while-acting.test.js +270 -0
- package/dist/test/present-while-acting.test.js.map +1 -1
- package/dist/test/refusal-reaction-baseline.test.d.ts +2 -0
- package/dist/test/refusal-reaction-baseline.test.d.ts.map +1 -0
- package/dist/test/refusal-reaction-baseline.test.js +74 -0
- package/dist/test/refusal-reaction-baseline.test.js.map +1 -0
- package/dist/test/state-scaling-e2e.test.js +7 -1
- package/dist/test/state-scaling-e2e.test.js.map +1 -1
- package/dist/test/state-scaling.test.js +9 -1
- package/dist/test/state-scaling.test.js.map +1 -1
- package/dist/test/tool-result-spill.test.d.ts +13 -0
- package/dist/test/tool-result-spill.test.d.ts.map +1 -0
- package/dist/test/tool-result-spill.test.js +463 -0
- package/dist/test/tool-result-spill.test.js.map +1 -0
- package/dist/test/trunk-channel-routing.test.js +45 -0
- package/dist/test/trunk-channel-routing.test.js.map +1 -1
- package/dist/test/utils-surface.test.d.ts +2 -0
- package/dist/test/utils-surface.test.d.ts.map +1 -0
- package/dist/test/utils-surface.test.js +145 -0
- package/dist/test/utils-surface.test.js.map +1 -0
- package/dist/test/workspace-read-image.test.js +71 -0
- package/dist/test/workspace-read-image.test.js.map +1 -1
- package/dist/test/workspace-restore-order.test.d.ts +16 -0
- package/dist/test/workspace-restore-order.test.d.ts.map +1 -0
- package/dist/test/workspace-restore-order.test.js +140 -0
- package/dist/test/workspace-restore-order.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/agent.ts +37 -3
- package/src/code-execution/index.ts +1 -0
- package/src/code-execution/py-runner.ts +56 -4
- package/src/code-execution/runtime-py.ts +156 -7
- package/src/code-execution/tool-definition.ts +27 -2
- package/src/framework.ts +2080 -203
- package/src/gate/event-gate.ts +72 -0
- package/src/index.ts +1 -0
- package/src/mcpl/capability-grant.ts +319 -0
- package/src/mcpl/capability-mask.ts +228 -0
- package/src/mcpl/channel-registry.ts +265 -43
- package/src/mcpl/checkpoint-manager.ts +28 -8
- package/src/mcpl/errors.ts +7 -0
- package/src/mcpl/feature-set-manager.ts +50 -5
- package/src/mcpl/hook-orchestrator.ts +64 -86
- package/src/mcpl/index.ts +0 -2
- package/src/mcpl/prose-stream-router.ts +17 -0
- package/src/mcpl/push-handler.ts +18 -2
- package/src/mcpl/server-connection.ts +262 -34
- package/src/mcpl/server-registry.ts +4 -3
- package/src/mcpl/tags.ts +50 -0
- package/src/mcpl/transport.ts +37 -7
- package/src/mcpl/types.ts +187 -78
- package/src/module-registry.ts +34 -0
- package/src/modules/workspace/index.ts +49 -15
- package/src/modules/workspace/sync.ts +1 -1
- package/src/refusal-reactions.ts +37 -0
- package/src/tool-result-history.ts +17 -5
- package/src/types/agent.ts +36 -0
- package/src/types/framework.ts +27 -0
- package/src/types/module.ts +24 -0
- package/src/types/trace.ts +22 -0
package/src/types/framework.ts
CHANGED
|
@@ -58,6 +58,16 @@ export interface CodeExecutionConfig {
|
|
|
58
58
|
* 0 disables reclaim.
|
|
59
59
|
*/
|
|
60
60
|
idleReclaimMs?: number;
|
|
61
|
+
/** Max concurrent background (daemon) scripts per agent (default 3). */
|
|
62
|
+
maxBackgroundScripts?: number;
|
|
63
|
+
/** Background script lifetime ceiling, ms (default 86_400_000 = 24h). */
|
|
64
|
+
backgroundMaxLifetimeMs?: number;
|
|
65
|
+
/** Minimum interval between wake_agent() deliveries, ms (default 60_000).
|
|
66
|
+
* Early wakes are delayed, not dropped (backpressure inside the script). */
|
|
67
|
+
wakeMinIntervalMs?: number;
|
|
68
|
+
/** Max wake_agent() calls per background script (default 100); further
|
|
69
|
+
* calls raise RuntimeError inside the script. */
|
|
70
|
+
maxWakesPerScript?: number;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
export interface FrameworkConfig {
|
|
@@ -128,6 +138,23 @@ export interface FrameworkConfig {
|
|
|
128
138
|
*/
|
|
129
139
|
codeExecution?: CodeExecutionConfig;
|
|
130
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Durable inline cap (chars) for tool results — successes AND errors — and
|
|
143
|
+
* background-script wake payloads. Content over the cap is written to a
|
|
144
|
+
* workspace file under `tool-results/` (deterministic `<date>-<callId>.txt`
|
|
145
|
+
* name, overwritten on collision, retained until the workspace owner
|
|
146
|
+
* deletes it — never auto-GC'd) and replaced inline by a bounded preview
|
|
147
|
+
* plus the file reference; with no writable workspace the fallback is
|
|
148
|
+
* explicit plain truncation. Default 5000 (house-safe; issue #89). Must be
|
|
149
|
+
* >= 1000. A resident's own agent_settings value
|
|
150
|
+
* `tool_result_inline_max_chars` (durable, persisted in framework state)
|
|
151
|
+
* takes precedence over this for that agent; the EFFECTIVE cap for every
|
|
152
|
+
* source is min(desired, strategy bound) — desired values above the
|
|
153
|
+
* strategy-derived bound (maxMessageTokens * 4) are hard-clamped to it,
|
|
154
|
+
* with the clamp reported via agent_settings get.
|
|
155
|
+
*/
|
|
156
|
+
toolResultInlineMaxChars?: number;
|
|
157
|
+
|
|
131
158
|
/** Inference routing policy for server-initiated inference (optional). */
|
|
132
159
|
inferenceRouting?: InferenceRoutingPolicy;
|
|
133
160
|
|
package/src/types/module.ts
CHANGED
|
@@ -63,6 +63,18 @@ export interface Module {
|
|
|
63
63
|
*/
|
|
64
64
|
getTools(): ToolDefinition[];
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Utilities: agent-invocable operations that deliberately do NOT get a
|
|
68
|
+
* first-class tool slot. Every tool schema taxes every inference; a
|
|
69
|
+
* capability used twice a month shouldn't. Utilities are listed, described,
|
|
70
|
+
* and invoked through the framework's single `utils` tool instead — same
|
|
71
|
+
* ToolDefinition shape, same un-prefixed names, and dispatch arrives at the
|
|
72
|
+
* SAME handleToolCall as getTools() output, so a tool migrates between
|
|
73
|
+
* surfaces by moving its definition from one list to the other and nothing
|
|
74
|
+
* else. Optional; omitting it means the module contributes no utilities.
|
|
75
|
+
*/
|
|
76
|
+
getUtilities?(): ToolDefinition[];
|
|
77
|
+
|
|
66
78
|
/**
|
|
67
79
|
* Handle a tool call.
|
|
68
80
|
* Tool name is without module prefix.
|
|
@@ -298,6 +310,18 @@ export interface ModuleContext {
|
|
|
298
310
|
* leaking listeners across teardown/recreate (e.g. session switch).
|
|
299
311
|
*/
|
|
300
312
|
onTrace(listener: TraceEventListener): () => void;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Raise an operator-facing ops alert through the framework's ops channel
|
|
316
|
+
* (failures.log + `ops:alert` trace + the ops webhook, when configured).
|
|
317
|
+
* For module actions that change durable state the operator would otherwise
|
|
318
|
+
* discover by surprise — e.g. subscription GC closing a channel. Keep the
|
|
319
|
+
* message privacy-minimal: identifiers and thresholds, not content.
|
|
320
|
+
*
|
|
321
|
+
* Optional so modules built against this version degrade gracefully on an
|
|
322
|
+
* older framework: call as `ctx.notifyOps?.(...)`.
|
|
323
|
+
*/
|
|
324
|
+
notifyOps?(kind: string, agentName: string, message: string, data?: Record<string, unknown>): void;
|
|
301
325
|
}
|
|
302
326
|
|
|
303
327
|
/**
|
package/src/types/trace.ts
CHANGED
|
@@ -169,6 +169,19 @@ export type TraceEvent =
|
|
|
169
169
|
agentStatus: string;
|
|
170
170
|
result: unknown;
|
|
171
171
|
})
|
|
172
|
+
| (TraceEventBase & {
|
|
173
|
+
/**
|
|
174
|
+
* A writable workspace existed but the oversized-result spill write
|
|
175
|
+
* failed (size cap, storeBlob failure, …) — the over-cap tail was NOT
|
|
176
|
+
* retained. Distinct from the no-workspace fallback, which is silent
|
|
177
|
+
* by design (nothing unexpected happened).
|
|
178
|
+
*/
|
|
179
|
+
type: 'tool:spill_failed';
|
|
180
|
+
label: string;
|
|
181
|
+
path: string;
|
|
182
|
+
contentLength: number;
|
|
183
|
+
error: string;
|
|
184
|
+
})
|
|
172
185
|
|
|
173
186
|
// Module lifecycle
|
|
174
187
|
| (TraceEventBase & { type: 'module:added'; moduleName: string })
|
|
@@ -339,6 +352,15 @@ export type TraceEvent =
|
|
|
339
352
|
/** True when a background reconnect loop will keep retrying. */
|
|
340
353
|
willRetry: boolean;
|
|
341
354
|
})
|
|
355
|
+
| (TraceEventBase & {
|
|
356
|
+
/** §17.6: the ONE normalized receipt per manifest change — closed
|
|
357
|
+
* host-derived impact vocabulary, never a server-authored flag. */
|
|
358
|
+
type: 'mcpl:manifest-change-receipt';
|
|
359
|
+
serverId: string;
|
|
360
|
+
revision: string | null;
|
|
361
|
+
announcedDomains: string[];
|
|
362
|
+
impacts: Array<{ impact: string; subject: string; disposition: string }>;
|
|
363
|
+
})
|
|
342
364
|
| (TraceEventBase & {
|
|
343
365
|
type: 'mcpl:server-reconnected';
|
|
344
366
|
serverId: string;
|