@animalabs/agent-framework 0.26.2 → 0.27.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/README.md +56 -6
- package/dist/src/agent.d.ts +263 -22
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +531 -54
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +1 -2
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/auto-continue.d.ts +33 -0
- package/dist/src/auto-continue.d.ts.map +1 -0
- package/dist/src/auto-continue.js +35 -0
- package/dist/src/auto-continue.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +11 -0
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
- package/dist/src/code-execution/isolate/scripts.js +5 -1
- package/dist/src/code-execution/isolate/scripts.js.map +1 -1
- package/dist/src/framework.d.ts +759 -129
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3482 -928
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +309 -46
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +2117 -395
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/index.d.ts +2 -2
- package/dist/src/gate/index.d.ts.map +1 -1
- package/dist/src/gate/index.js +1 -1
- package/dist/src/gate/index.js.map +1 -1
- package/dist/src/gate/recipe-reconcile.d.ts +103 -0
- package/dist/src/gate/recipe-reconcile.d.ts.map +1 -0
- package/dist/src/gate/recipe-reconcile.js +325 -0
- package/dist/src/gate/recipe-reconcile.js.map +1 -0
- package/dist/src/gate/types.d.ts +68 -8
- package/dist/src/gate/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +433 -113
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +1152 -434
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +16 -8
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +29 -15
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +14 -2
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +7 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +32 -7
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +5 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +4 -0
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +14 -2
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +73 -28
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/prose-grammar.d.ts +4 -0
- package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
- package/dist/src/mcpl/prose-grammar.js +6 -0
- package/dist/src/mcpl/prose-grammar.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +3 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +20 -2
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +33 -11
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +63 -42
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +177 -145
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +380 -46
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +736 -77
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +82 -3
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +132 -7
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts +11 -0
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js +21 -0
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/tool-presence.d.ts +259 -0
- package/dist/src/mcpl/tool-presence.d.ts.map +1 -0
- package/dist/src/mcpl/tool-presence.js +628 -0
- package/dist/src/mcpl/tool-presence.js.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts +9 -3
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.js +14 -6
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
- package/dist/src/mcpl/tool-signature.d.ts +39 -0
- package/dist/src/mcpl/tool-signature.d.ts.map +1 -0
- package/dist/src/mcpl/tool-signature.js +292 -0
- package/dist/src/mcpl/tool-signature.js.map +1 -0
- package/dist/src/mcpl/toolset-host.d.ts +200 -0
- package/dist/src/mcpl/toolset-host.d.ts.map +1 -0
- package/dist/src/mcpl/toolset-host.js +621 -0
- package/dist/src/mcpl/toolset-host.js.map +1 -0
- package/dist/src/mcpl/toolsets-module.d.ts +80 -0
- package/dist/src/mcpl/toolsets-module.d.ts.map +1 -0
- package/dist/src/mcpl/toolsets-module.js +431 -0
- package/dist/src/mcpl/toolsets-module.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +2 -2
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +3 -2
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +21 -1
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +7 -9
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +21 -9
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +23 -8
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +68 -15
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.js +1 -1
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +2 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +51 -17
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +108 -6
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +273 -57
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/workspace/direct-write.d.ts +181 -0
- package/dist/src/modules/workspace/direct-write.d.ts.map +1 -0
- package/dist/src/modules/workspace/direct-write.js +384 -0
- package/dist/src/modules/workspace/direct-write.js.map +1 -0
- package/dist/src/modules/workspace/edit-text.d.ts +26 -12
- package/dist/src/modules/workspace/edit-text.d.ts.map +1 -1
- package/dist/src/modules/workspace/edit-text.js +58 -28
- package/dist/src/modules/workspace/edit-text.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +10 -0
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +1 -1
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +246 -27
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +1216 -236
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/read-page.d.ts +41 -0
- package/dist/src/modules/workspace/read-page.d.ts.map +1 -0
- package/dist/src/modules/workspace/read-page.js +213 -0
- package/dist/src/modules/workspace/read-page.js.map +1 -0
- package/dist/src/modules/workspace/result-text.d.ts +67 -0
- package/dist/src/modules/workspace/result-text.d.ts.map +1 -0
- package/dist/src/modules/workspace/result-text.js +94 -0
- package/dist/src/modules/workspace/result-text.js.map +1 -0
- package/dist/src/modules/workspace/text.d.ts +29 -12
- package/dist/src/modules/workspace/text.d.ts.map +1 -1
- package/dist/src/modules/workspace/text.js +35 -33
- package/dist/src/modules/workspace/text.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +41 -17
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/sent-rows.d.ts +59 -0
- package/dist/src/sent-rows.d.ts.map +1 -0
- package/dist/src/sent-rows.js +145 -0
- package/dist/src/sent-rows.js.map +1 -0
- package/dist/src/silent-heartbeat.d.ts +17 -10
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/stable-hash.d.ts +3 -0
- package/dist/src/stable-hash.d.ts.map +1 -0
- package/dist/src/stable-hash.js +15 -0
- package/dist/src/stable-hash.js.map +1 -0
- package/dist/src/stored-injections.d.ts +99 -0
- package/dist/src/stored-injections.d.ts.map +1 -0
- package/dist/src/stored-injections.js +106 -0
- package/dist/src/stored-injections.js.map +1 -0
- package/dist/src/text-as-stored.d.ts +4 -3
- package/dist/src/text-as-stored.d.ts.map +1 -1
- package/dist/src/text-as-stored.js +4 -3
- package/dist/src/text-as-stored.js.map +1 -1
- package/dist/src/thinking-drops.d.ts +81 -0
- package/dist/src/thinking-drops.d.ts.map +1 -0
- package/dist/src/thinking-drops.js +103 -0
- package/dist/src/thinking-drops.js.map +1 -0
- package/dist/src/tool-image-ledger.d.ts +9 -8
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +9 -8
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +3 -1
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +4 -2
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +21 -6
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +176 -24
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +411 -91
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +17 -9
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +84 -37
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/types/agent.d.ts +186 -7
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +15 -1
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +24 -3
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +90 -7
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +57 -2
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/agent.ts +593 -60
- package/src/api/server.ts +1 -2
- package/src/auto-continue.ts +42 -0
- package/src/code-execution/isolate/scripts.ts +11 -3
- package/src/framework.ts +3601 -967
- package/src/gate/event-gate.ts +2315 -389
- package/src/gate/index.ts +2 -1
- package/src/gate/recipe-reconcile.ts +355 -0
- package/src/gate/types.ts +70 -8
- package/src/index.ts +7 -4
- package/src/mcpl/channel-registry.ts +1220 -467
- package/src/mcpl/conversation-router.ts +34 -16
- package/src/mcpl/convert-block.ts +14 -1
- package/src/mcpl/hook-orchestrator.ts +33 -6
- package/src/mcpl/index.ts +6 -1
- package/src/mcpl/inference-router.ts +79 -34
- package/src/mcpl/prose-grammar.ts +7 -0
- package/src/mcpl/protocol-family.ts +2 -0
- package/src/mcpl/push-coalescer.ts +51 -13
- package/src/mcpl/reference-fetcher.ts +201 -162
- package/src/mcpl/references.ts +851 -77
- package/src/mcpl/server-connection.ts +145 -7
- package/src/mcpl/tool-lifecycle.ts +21 -0
- package/src/mcpl/tool-presence.ts +650 -0
- package/src/mcpl/tool-result-normalize.ts +18 -6
- package/src/mcpl/tool-signature.ts +285 -0
- package/src/mcpl/toolset-host.ts +637 -0
- package/src/mcpl/toolsets-module.ts +451 -0
- package/src/mcpl/transport.ts +3 -2
- package/src/mcpl/types.ts +22 -1
- package/src/mcpl/visible-content.ts +22 -9
- package/src/module-registry.ts +77 -24
- package/src/modules/discord/index.ts +1 -1
- package/src/modules/history/index.ts +48 -18
- package/src/modules/history/semantic.ts +308 -54
- package/src/modules/workspace/direct-write.ts +425 -0
- package/src/modules/workspace/edit-text.ts +82 -35
- package/src/modules/workspace/effects.ts +1 -1
- package/src/modules/workspace/index.ts +1274 -241
- package/src/modules/workspace/read-page.ts +222 -0
- package/src/modules/workspace/result-text.ts +119 -0
- package/src/modules/workspace/text.ts +58 -32
- package/src/modules/workspace/types.ts +41 -17
- package/src/sent-rows.ts +162 -0
- package/src/silent-heartbeat.ts +17 -10
- package/src/stable-hash.ts +14 -0
- package/src/stored-injections.ts +131 -0
- package/src/text-as-stored.ts +4 -3
- package/src/thinking-drops.ts +141 -0
- package/src/tool-image-ledger.ts +9 -8
- package/src/tool-presentation.ts +3 -1
- package/src/tool-result-guard.ts +19 -6
- package/src/tool-result-history.ts +471 -90
- package/src/tune-out/coordinator.ts +80 -37
- package/src/types/agent.ts +189 -7
- package/src/types/events.ts +15 -1
- package/src/types/framework.ts +21 -3
- package/src/types/module.ts +86 -7
- package/src/types/trace.ts +58 -2
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCPL RFC-014, host side: per server, the controller that feeds the
|
|
3
|
+
* server's tool presence (tool-presence.ts) from what its connection reads,
|
|
4
|
+
* sends toolsets/open, close and list, recovers from a lost rev, and renders
|
|
5
|
+
* what changed; and the hub that holds every server's controller for the
|
|
6
|
+
* meta-tools (toolsets-module.ts) and for reminders.
|
|
7
|
+
*
|
|
8
|
+
* Hint changes apply as their message is read (RFC §6.1): the connection's
|
|
9
|
+
* read tap hands the controller every result of a hinted request (awaited or
|
|
10
|
+
* not), every push/event and every tools/hints, of the current transport,
|
|
11
|
+
* synchronously and in arrival order, before anything routes the message.
|
|
12
|
+
* What a message's changes did to the model's view is kept by the object
|
|
13
|
+
* that carried them (`readChanges`), so whoever later handles that object
|
|
14
|
+
* (the tool result, the push, the meta-tool) renders it next to the content.
|
|
15
|
+
*
|
|
16
|
+
* Reminders (RFC §8.3): after each compile built to send, the hub reads
|
|
17
|
+
* which open toolsets' markers (`[server/toolset:instance]`) the request
|
|
18
|
+
* carried. A marker an agent has had in view, gone from a later request
|
|
19
|
+
* (compressed, or out of the window), makes a reminder due for that agent,
|
|
20
|
+
* which the toolsets module gathers at its next start as a stored
|
|
21
|
+
* `afterUser` injection.
|
|
22
|
+
*/
|
|
23
|
+
import type { McplServerConnection } from './server-connection.js';
|
|
24
|
+
import type { McplServerConfig } from './types.js';
|
|
25
|
+
import { ToolPresence, type ChangeSet, type MetaToolNames } from './tool-presence.js';
|
|
26
|
+
/** The meta-tools' module, whose tools are `toolsets--open` and so on. */
|
|
27
|
+
export declare const TOOLSETS_MODULE = "toolsets";
|
|
28
|
+
export declare const META_TOOL_NAMES: MetaToolNames;
|
|
29
|
+
/** How long an open, close or call is waited for. A late result still applies when it's read. */
|
|
30
|
+
export declare const TOOLSET_REQUEST_TIMEOUT_MS = 60000;
|
|
31
|
+
export interface ToolsetHostDeps {
|
|
32
|
+
/** A standalone notice into the conversation: a tools/hints change, a late
|
|
33
|
+
* result's, a reconnect's adoption, a recovery's. `invite`: it suggests an
|
|
34
|
+
* open. The host applies its usual rules for events. */
|
|
35
|
+
notify(serverId: string, text: string, opts: {
|
|
36
|
+
invite: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
/** The operator's log. */
|
|
39
|
+
log(line: string): void;
|
|
40
|
+
/** How a static tool is named in the tool list (`prefix--tool`). */
|
|
41
|
+
listedName(serverId: string, tool: string): string;
|
|
42
|
+
}
|
|
43
|
+
/** One server's RFC-014 state and traffic. Lives as long as the server's
|
|
44
|
+
* configuration, across reconnects and restarts (its `ended` ids and what
|
|
45
|
+
* the model was shown carry over). */
|
|
46
|
+
export declare class ToolsetController {
|
|
47
|
+
readonly serverId: string;
|
|
48
|
+
private config;
|
|
49
|
+
private readonly deps;
|
|
50
|
+
readonly presence: ToolPresence;
|
|
51
|
+
private connection;
|
|
52
|
+
/** The transport epoch the presence's revs belong to. */
|
|
53
|
+
private epoch;
|
|
54
|
+
/** What applying a message's hints changed, by the object that carried them. */
|
|
55
|
+
private readonly readChanges;
|
|
56
|
+
/** Results whose change no one has rendered yet (tellUnlessClaimed). */
|
|
57
|
+
private readonly unclaimed;
|
|
58
|
+
/** eventIds of pushes read on this transport (bounded): a repeat's hints are ignored (RFC §6.1). */
|
|
59
|
+
private seenEvents;
|
|
60
|
+
/** A paged tools/list being read. */
|
|
61
|
+
private listPages;
|
|
62
|
+
/** Lists this controller asked for itself, whose change it delivers. */
|
|
63
|
+
private ownLists;
|
|
64
|
+
/** What lists read while one of its own was out changed, for it to tell. */
|
|
65
|
+
private ownListChange;
|
|
66
|
+
private recoveryTimer;
|
|
67
|
+
private recovering;
|
|
68
|
+
private recoverAgain;
|
|
69
|
+
constructor(serverId: string, config: McplServerConfig, deps: ToolsetHostDeps);
|
|
70
|
+
private log;
|
|
71
|
+
/** A restart can bring a new configuration under the same id. */
|
|
72
|
+
setConfig(config: McplServerConfig): void;
|
|
73
|
+
/** Tap this connection (a connect or a restart's new one). */
|
|
74
|
+
attach(connection: McplServerConnection): void;
|
|
75
|
+
/** The server's connection is gone for good (disconnected, removed). */
|
|
76
|
+
detach(connection: McplServerConnection): void;
|
|
77
|
+
/** Whether the meta-tools speak for this server now. */
|
|
78
|
+
get presents(): boolean;
|
|
79
|
+
/** The live connection, for a request. */
|
|
80
|
+
private live;
|
|
81
|
+
/**
|
|
82
|
+
* A new transport: revs start over (RFC §6.1), and its advertisement says
|
|
83
|
+
* whether hints are in effect. Read from the connection, which holds the
|
|
84
|
+
* advertisement before its transport can deliver anything.
|
|
85
|
+
*/
|
|
86
|
+
private sync;
|
|
87
|
+
private onRead;
|
|
88
|
+
private readResult;
|
|
89
|
+
/**
|
|
90
|
+
* The one apply path (RFC §6.1) for a HintChanges from any carrier, as its
|
|
91
|
+
* message is read. Revs are consecutive: anything but the last + 1 means a
|
|
92
|
+
* message was lost or misordered, and the host recovers.
|
|
93
|
+
*/
|
|
94
|
+
private applyHints;
|
|
95
|
+
/** tools/list, as read: definitions and presence as of its `mcpl/rev`, which takes no rev of its own (RFC §4.1). */
|
|
96
|
+
private readToolList;
|
|
97
|
+
/** toolsets/list, as read: a full statement of dynamic-tool state under its own rev (RFC §5.3, §6.1). */
|
|
98
|
+
private readToolsetList;
|
|
99
|
+
/** A change with nothing else to ride on, told as a notice. */
|
|
100
|
+
private deliver;
|
|
101
|
+
/**
|
|
102
|
+
* A dynamic tool called by its namespaced name, as if it were listed (a
|
|
103
|
+
* model imitating an earlier call, a module): refused, so every call into
|
|
104
|
+
* a toolset goes through act, which knows its instance and gates closed
|
|
105
|
+
* groups (RFC §5.4, §5.5). Null for any other tool.
|
|
106
|
+
*/
|
|
107
|
+
dynamicCallRefusal(tool: string, calledAs: string): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* An awaited result's change is told by whoever renders that result, when
|
|
110
|
+
* the result goes to the agent: the model's own call of a tool (its tool
|
|
111
|
+
* result), a meta-tool. One no one renders by the time the awaiting code has
|
|
112
|
+
* run (the next macrotask), such as the result of a call the framework makes
|
|
113
|
+
* itself (a reaction, a send, an accounted side effect), is told as a notice
|
|
114
|
+
* instead, as a standalone tools/hints is (RFC §6.1: every change reaches the
|
|
115
|
+
* agent once).
|
|
116
|
+
*/
|
|
117
|
+
private tellUnlessClaimed;
|
|
118
|
+
/** What applying `carrier`'s hints changed (a tool result, a push's params),
|
|
119
|
+
* rendered, for its handler to show with it; '' for nothing. Taking it
|
|
120
|
+
* means it's told there, not as a notice. */
|
|
121
|
+
changeText(carrier: unknown): string;
|
|
122
|
+
/** The change a carrier's hints made, or an empty one; taken as changeText's is. */
|
|
123
|
+
changeOf(carrier: unknown): ChangeSet;
|
|
124
|
+
private scheduleRecovery;
|
|
125
|
+
/**
|
|
126
|
+
* Recovering: re-read tools/list (presence, declared definitions), then
|
|
127
|
+
* toolsets/list (dynamic-tool state in full), so every tool the statement
|
|
128
|
+
* names is already known; each applies where it's read. What changed is
|
|
129
|
+
* told. (stdio and WebSocket deliver in order, so no early rev is held.)
|
|
130
|
+
*/
|
|
131
|
+
private recover;
|
|
132
|
+
private ownToolList;
|
|
133
|
+
private ownToolsetList;
|
|
134
|
+
/**
|
|
135
|
+
* After every (re)connect, once its policy has settled (RFC §5.3): tools/list
|
|
136
|
+
* then toolsets/list, the truth. What the server reports open is adopted
|
|
137
|
+
* (a game kept across the reconnect); what the host believed open and it
|
|
138
|
+
* doesn't report is closed, never re-opened here, since opening can start a
|
|
139
|
+
* new game. What ended meanwhile is told, each `ended` id once.
|
|
140
|
+
*/
|
|
141
|
+
connected(connection: McplServerConnection): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Re-read what the server holds open (titles, visibility) without telling
|
|
144
|
+
* it: for look, which restates everything anyway. Returns notes for what
|
|
145
|
+
* the server no longer holds.
|
|
146
|
+
*/
|
|
147
|
+
refreshOpen(): Promise<string[]>;
|
|
148
|
+
/** toolsets/open (RFC §5.2). The server's refusal rejects. */
|
|
149
|
+
open(toolset: string, instance: string | undefined, options: Record<string, unknown> | undefined): Promise<{
|
|
150
|
+
key: string;
|
|
151
|
+
title?: string;
|
|
152
|
+
content: unknown[];
|
|
153
|
+
change: ChangeSet;
|
|
154
|
+
adopted: boolean;
|
|
155
|
+
}>;
|
|
156
|
+
/** toolsets/close (RFC §5.2). */
|
|
157
|
+
close(toolset: string, instance: string | undefined): Promise<{
|
|
158
|
+
content: unknown[];
|
|
159
|
+
change: ChangeSet;
|
|
160
|
+
}>;
|
|
161
|
+
/** Open or close an undeclared group (RFC §5.4): the host's own act; the server isn't told. */
|
|
162
|
+
setGroupOpen(group: string, open: boolean): ChangeSet;
|
|
163
|
+
/**
|
|
164
|
+
* A manifest re-fetch (RFC §5.1): the `toolsets` domain's declarations, as
|
|
165
|
+
* the server sent them. A toolset removed ends its instances; a server
|
|
166
|
+
* that withdraws toolHints is hint-less from then on. What changed is told.
|
|
167
|
+
*/
|
|
168
|
+
manifestChanged(declarations: Record<string, unknown> | null): void;
|
|
169
|
+
/** Apply pending static↔dynamic moves (RFC §4.2) at a tool-list boundary, and say where they went. */
|
|
170
|
+
applyMoves(): string[];
|
|
171
|
+
}
|
|
172
|
+
/** Every server's controller, for the meta-tools and reminders. */
|
|
173
|
+
export declare class ToolsetHub {
|
|
174
|
+
private readonly deps;
|
|
175
|
+
private readonly controllers;
|
|
176
|
+
/** Per agent: the markers it has had in view (seen), and whether a reminder is due. */
|
|
177
|
+
private readonly seen;
|
|
178
|
+
private readonly due;
|
|
179
|
+
constructor(deps: ToolsetHostDeps);
|
|
180
|
+
/** The controller for a server, made at its first connect. */
|
|
181
|
+
controllerFor(config: McplServerConfig): ToolsetController;
|
|
182
|
+
get(serverId: string): ToolsetController | undefined;
|
|
183
|
+
/** A server's configuration went (removed): forget its controller. */
|
|
184
|
+
forget(serverId: string): void;
|
|
185
|
+
all(): ToolsetController[];
|
|
186
|
+
/** The servers the meta-tools speak for now. */
|
|
187
|
+
presenting(): ToolsetController[];
|
|
188
|
+
/** Every open key's marker, across servers. */
|
|
189
|
+
private openMarkers;
|
|
190
|
+
/**
|
|
191
|
+
* A compile built to send for `agentName` (RFC §8.3): which open toolsets'
|
|
192
|
+
* announcements the request carries. One the agent has had in view and the
|
|
193
|
+
* request no longer carries (compressed, or out of the window) makes a
|
|
194
|
+
* reminder due.
|
|
195
|
+
*/
|
|
196
|
+
observeCompile(agentName: string, messages: readonly unknown[]): void;
|
|
197
|
+
/** The reminder due for `agentName`, or null when none is. */
|
|
198
|
+
reminderFor(agentName: string): string | null;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=toolset-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolset-host.d.ts","sourceRoot":"","sources":["../../../src/mcpl/toolset-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAY,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAAE,KAAK,aAAa,EACnC,MAAM,oBAAoB,CAAC;AAG5B,0EAA0E;AAC1E,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,eAAe,EAAE,aAK7B,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAWjD,MAAM,WAAW,eAAe;IAC9B;;6DAEyD;IACzD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,0BAA0B;IAC1B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oEAAoE;IACpE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACpD;AAED;;uCAEuC;AACvC,qBAAa,iBAAiB;IAsB1B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;IAv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