@adhdev/mesh-shared 1.0.60-rc.72 → 1.0.60-rc.74
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/brain-routing.d.ts +4 -6
- package/dist/git-diff.d.ts +21 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +116 -425
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +110 -339
- package/dist/index.mjs.map +1 -1
- package/dist/json.d.ts +4 -0
- package/dist/mesh-tool-names.d.ts +11 -7
- package/dist/mesh-vocabulary.d.ts +1 -2
- package/dist/outbound-message.d.ts +1 -2
- package/dist/protocol/daemon-server.d.ts +8 -31
- package/dist/session-launch.d.ts +0 -8
- package/dist/slot-proposal.d.ts +1 -27
- package/dist/turn-ipc-guards.d.ts +18 -0
- package/dist/turn-ipc-mission.d.ts +250 -0
- package/dist/turn-ipc-queue.d.ts +196 -0
- package/dist/turn-ipc-stats.d.ts +72 -0
- package/dist/turn-ipc-turn.d.ts +176 -0
- package/dist/turn-ipc.d.ts +13 -963
- package/package.json +1 -1
- package/src/brain-routing.ts +6 -8
- package/src/git-diff.ts +48 -0
- package/src/index.ts +1 -1
- package/src/json.ts +10 -0
- package/src/mesh-tool-names.ts +20 -25
- package/src/mesh-vocabulary.ts +1 -2
- package/src/outbound-message.ts +1 -2
- package/src/protocol/daemon-server.ts +3 -34
- package/src/session-launch.ts +2 -4
- package/src/slot-proposal.ts +1 -47
- package/src/turn-ipc-guards.ts +61 -0
- package/src/turn-ipc-mission.ts +647 -0
- package/src/turn-ipc-queue.ts +493 -0
- package/src/turn-ipc-stats.ts +193 -0
- package/src/turn-ipc-turn.ts +453 -0
- package/src/turn-ipc.ts +43 -2236
- package/dist/magi.d.ts +0 -281
- package/src/magi.ts +0 -310
package/dist/json.d.ts
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export type JsonRecord = Record<string, unknown>;
|
|
11
11
|
export declare function readRecord(value: unknown): JsonRecord;
|
|
12
|
+
/** A plain-object record, or undefined — for callers that must tell "absent" from "empty". */
|
|
13
|
+
export declare function readOptionalRecord(value: unknown): JsonRecord | undefined;
|
|
12
14
|
export declare function readString(...values: unknown[]): string | undefined;
|
|
15
|
+
/** The first non-blank trimmed string, or '' — readString for callers that want a plain string. */
|
|
16
|
+
export declare function readText(...values: unknown[]): string;
|
|
13
17
|
export declare function readNumber(...values: unknown[]): number | undefined;
|
|
14
18
|
export declare function readBoolean(...values: unknown[]): boolean | undefined;
|
|
15
19
|
export declare function readStringArray(value: unknown): string[];
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* Order mirrors mcp-server `ALL_MESH_TOOLS` for easy visual diffing, but the consistency
|
|
19
19
|
* checks are set-based (order-insensitive).
|
|
20
20
|
*/
|
|
21
|
-
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "
|
|
21
|
+
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "mesh_queue_cancel", "mesh_queue_requeue", "mesh_send_task", "mesh_read_chat", "mesh_read_debug", "mesh_read_terminal", "mesh_send_keys", "mesh_launch_session", "mesh_git_status", "mesh_read_node_logs", "mesh_fast_forward_node", "mesh_restart_daemon", "mesh_checkpoint", "mesh_approve", "mesh_answer_question", "mesh_list_pending_approvals", "mesh_create", "mesh_add_node", "mesh_clone_node", "mesh_remove_node", "mesh_cleanup_worktree_nodes", "mesh_refine_node", "mesh_refine_batch", "mesh_config", "mesh_init", "mesh_refine_plan", "mesh_cleanup_sessions", "mesh_task_history", "mesh_ledger_query", "mesh_note", "mesh_reconcile_ledger", "mesh_mission_upsert", "mesh_mission_list", "mesh_review_inbox", "mesh_node_slots", "mesh_coordinator_prompt_append"];
|
|
22
22
|
export type CanonicalMeshToolName = typeof CANONICAL_MESH_TOOL_NAMES[number];
|
|
23
23
|
/** The count the `NN tools` barrel doc comments and consistency test assert against. */
|
|
24
|
-
export declare const CANONICAL_MESH_TOOL_COUNT:
|
|
24
|
+
export declare const CANONICAL_MESH_TOOL_COUNT: 42;
|
|
25
25
|
/**
|
|
26
26
|
* Tool names retired by the 2026-09-26 tool-surface consolidation (60 → 48).
|
|
27
27
|
* Every capability behind them is still reachable: each retired name maps to the
|
|
@@ -33,8 +33,7 @@ export declare const CANONICAL_MESH_TOOL_COUNT: 48;
|
|
|
33
33
|
* test asserts none of these names is advertised anywhere in the prompt.
|
|
34
34
|
*
|
|
35
35
|
* `args` is the discriminator to add; every other argument keeps its name.
|
|
36
|
-
* `note`
|
|
37
|
-
* `mesh_graph_gate_claim({ extend_seconds })` extend-only mode).
|
|
36
|
+
* `note` carries any extra guidance when an argument moved in a rename.
|
|
38
37
|
*/
|
|
39
38
|
export declare const RETIRED_MESH_TOOLS: Readonly<Record<string, {
|
|
40
39
|
readonly tool: CanonicalMeshToolName;
|
|
@@ -42,8 +41,13 @@ export declare const RETIRED_MESH_TOOLS: Readonly<Record<string, {
|
|
|
42
41
|
readonly note?: string;
|
|
43
42
|
}>>;
|
|
44
43
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
44
|
+
* Tool names removed outright (no merged replacement), mapped to the guidance a
|
|
45
|
+
* coordinator on an old prompt needs to do the same job with the remaining tools.
|
|
46
|
+
*/
|
|
47
|
+
export declare const REMOVED_MESH_TOOLS: Readonly<Record<string, string>>;
|
|
48
|
+
/**
|
|
49
|
+
* The error text for a call to a retired or removed tool name, or null when
|
|
50
|
+
* `name` is neither. One wording shared by every MCP mode so the redirect reads
|
|
51
|
+
* the same wherever an old prompt calls it.
|
|
48
52
|
*/
|
|
49
53
|
export declare function retiredMeshToolError(name: string): string | null;
|
|
@@ -38,8 +38,7 @@ export type MeshThinkingLevel = typeof MESH_THINKING_LEVELS[number];
|
|
|
38
38
|
export declare const MESH_DELIVERY_MODES: readonly ["when_idle", "interrupt"];
|
|
39
39
|
export type MeshDeliveryMode = typeof MESH_DELIVERY_MODES[number];
|
|
40
40
|
/**
|
|
41
|
-
* What to do with a node's sessions when the node is removed
|
|
42
|
-
* settles. Declared here so daemon-core (`RepoMeshSessionCleanupMode`), the
|
|
41
|
+
* What to do with a node's sessions when the node is removed. Declared here so daemon-core (`RepoMeshSessionCleanupMode`), the
|
|
43
42
|
* web dashboard picker and the MCP schemas all read one list.
|
|
44
43
|
*/
|
|
45
44
|
export declare const MESH_SESSION_CLEANUP_MODES: readonly ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
@@ -132,9 +132,8 @@ export type SendRefusal = 'not_ready' | 'send_in_flight' | 'not_generating' | 'n
|
|
|
132
132
|
* a turn is generating (`send_now`). Written, not yet answered;
|
|
133
133
|
* `interrupt` — the turn in flight was stopped first, then this body was
|
|
134
134
|
* written (or re-parked) as a new turn;
|
|
135
|
-
* `acp` — handed to an ACP agent's `session/prompt`.
|
|
136
135
|
*/
|
|
137
|
-
export type SubmitRoute = 'pty' | 'agent_queue' | 'interrupt'
|
|
136
|
+
export type SubmitRoute = 'pty' | 'agent_queue' | 'interrupt';
|
|
138
137
|
/** The stop key pressed by an `interrupt` submit (logs / operator display). */
|
|
139
138
|
export interface SubmitInterruptDetail {
|
|
140
139
|
keyName: string;
|
|
@@ -157,11 +157,6 @@ export type AuthOkWirePayload = {
|
|
|
157
157
|
machineNickname: string | null;
|
|
158
158
|
seqscribeFleetSecret?: string;
|
|
159
159
|
seqscribeFleetSecretVersion?: number;
|
|
160
|
-
/** Beacon board seed for cold start (advisory, may be absent). */
|
|
161
|
-
beaconSeed?: {
|
|
162
|
-
reports: unknown[];
|
|
163
|
-
truncated: number;
|
|
164
|
-
};
|
|
165
160
|
limits: AuthOkPlanLimits;
|
|
166
161
|
};
|
|
167
162
|
export type AuthErrorWirePayload = {
|
|
@@ -207,14 +202,6 @@ export type DaemonErrorWirePayload = {
|
|
|
207
202
|
message?: string;
|
|
208
203
|
detail?: unknown;
|
|
209
204
|
};
|
|
210
|
-
export type BeaconVectorsWirePayload = {
|
|
211
|
-
op: 'put';
|
|
212
|
-
report: unknown;
|
|
213
|
-
} | {
|
|
214
|
-
op: 'get';
|
|
215
|
-
topics: string[];
|
|
216
|
-
requestId: string;
|
|
217
|
-
};
|
|
218
205
|
export declare const P2P_SIGNAL_TYPES: readonly ["p2p_ready", "p2p_offer", "p2p_answer", "p2p_ice"];
|
|
219
206
|
export type P2PSignalType = typeof P2P_SIGNAL_TYPES[number];
|
|
220
207
|
export declare const isP2PSignalType: (value: unknown) => value is "p2p_ready" | "p2p_offer" | "p2p_answer" | "p2p_ice";
|
|
@@ -258,9 +245,9 @@ export declare const isMeshP2PSignalType: (value: unknown) => value is "mesh_p2p
|
|
|
258
245
|
export type MeshP2PSignalWirePayload = {
|
|
259
246
|
senderDaemonId: string;
|
|
260
247
|
} & Record<string, unknown>;
|
|
261
|
-
export declare const DAEMON_TO_SERVER_TYPES: readonly ["auth", "status_report", "status_heartbeat", "status_event", "command_result", "error", "agent_event", "
|
|
248
|
+
export declare const DAEMON_TO_SERVER_TYPES: readonly ["auth", "status_report", "status_heartbeat", "status_event", "command_result", "error", "agent_event", "daemon_mesh_command", "p2p_offer", "p2p_ice"];
|
|
262
249
|
export type DaemonToServerType = typeof DAEMON_TO_SERVER_TYPES[number];
|
|
263
|
-
export declare const isDaemonToServerType: (value: unknown) => value is "error" | "p2p_offer" | "p2p_ice" | "auth" | "status_report" | "status_heartbeat" | "status_event" | "command_result" | "agent_event" | "
|
|
250
|
+
export declare const isDaemonToServerType: (value: unknown) => value is "error" | "p2p_offer" | "p2p_ice" | "auth" | "status_report" | "status_heartbeat" | "status_event" | "command_result" | "agent_event" | "daemon_mesh_command";
|
|
264
251
|
export type DaemonAuthMsg = Envelope<'auth', DaemonAuthWirePayload>;
|
|
265
252
|
export type StatusReportMsg = Envelope<'status_report', CloudStatusReportWirePayload>;
|
|
266
253
|
export type StatusHeartbeatMsg = Envelope<'status_heartbeat', StatusHeartbeatWirePayload>;
|
|
@@ -269,7 +256,6 @@ export type CommandResultMsg = Envelope<'command_result', CommandResultWirePaylo
|
|
|
269
256
|
export type DaemonErrorMsg = Envelope<'error', DaemonErrorWirePayload>;
|
|
270
257
|
/** Agent-level event forwarded verbatim to the `agent:status` webhook (throttled server-side). Dynamic by design. */
|
|
271
258
|
export type AgentEventMsg = Envelope<'agent_event', CommandPayload>;
|
|
272
|
-
export type BeaconVectorsMsg = Envelope<'beacon_vectors', BeaconVectorsWirePayload>;
|
|
273
259
|
export type DaemonP2POfferMsg = Envelope<'p2p_offer', P2POfferWirePayload>;
|
|
274
260
|
export type DaemonP2PIceMsg = Envelope<'p2p_ice', P2PIceWirePayload>;
|
|
275
261
|
/**
|
|
@@ -285,7 +271,7 @@ export type DaemonMeshCommandMsg = {
|
|
|
285
271
|
args: Record<string, unknown>;
|
|
286
272
|
timestamp: number;
|
|
287
273
|
};
|
|
288
|
-
export type DaemonToServerMsg = DaemonAuthMsg | StatusReportMsg | StatusHeartbeatMsg | DaemonStatusEventMsg | CommandResultMsg | DaemonErrorMsg | AgentEventMsg |
|
|
274
|
+
export type DaemonToServerMsg = DaemonAuthMsg | StatusReportMsg | StatusHeartbeatMsg | DaemonStatusEventMsg | CommandResultMsg | DaemonErrorMsg | AgentEventMsg | DaemonMeshCommandMsg | DaemonP2POfferMsg | DaemonP2PIceMsg;
|
|
289
275
|
/** Members that carry a `payload` object (everything except `daemon_mesh_command`). */
|
|
290
276
|
export type DaemonToServerPayloadType = Exclude<DaemonToServerMsg, DaemonMeshCommandMsg>['type'];
|
|
291
277
|
export type DaemonToServerPayloadOf<T extends DaemonToServerPayloadType> = Extract<DaemonToServerMsg, {
|
|
@@ -297,9 +283,9 @@ export type DaemonToServerPayloadOf<T extends DaemonToServerPayloadType> = Extra
|
|
|
297
283
|
* token string because nothing downstream can proceed without one.
|
|
298
284
|
*/
|
|
299
285
|
export declare function decodeDaemonToServer(raw: unknown): DaemonToServerMsg | null;
|
|
300
|
-
export declare const SERVER_TO_DAEMON_CONTROL_TYPES: readonly ["auth_ok", "auth_error", "machine_evicted", "force_disconnect", "token_revoked", "version_mismatch", "force_update_required", "command", "agent_command", "resolve_action", "
|
|
286
|
+
export declare const SERVER_TO_DAEMON_CONTROL_TYPES: readonly ["auth_ok", "auth_error", "machine_evicted", "force_disconnect", "token_revoked", "version_mismatch", "force_update_required", "command", "agent_command", "resolve_action", "daemon_mesh_result", "p2p_ready", "p2p_offer", "p2p_answer", "p2p_ice", "mesh_p2p_ready", "mesh_p2p_offer", "mesh_p2p_answer", "mesh_p2p_ice"];
|
|
301
287
|
export type ServerToDaemonControlType = typeof SERVER_TO_DAEMON_CONTROL_TYPES[number];
|
|
302
|
-
export declare const isServerToDaemonControlType: (value: unknown) => value is "p2p_ready" | "p2p_offer" | "p2p_answer" | "p2p_ice" | "mesh_p2p_ready" | "mesh_p2p_offer" | "mesh_p2p_answer" | "mesh_p2p_ice" | "command" | "auth_ok" | "auth_error" | "machine_evicted" | "force_disconnect" | "token_revoked" | "version_mismatch" | "force_update_required" | "agent_command" | "resolve_action" | "
|
|
288
|
+
export declare const isServerToDaemonControlType: (value: unknown) => value is "p2p_ready" | "p2p_offer" | "p2p_answer" | "p2p_ice" | "mesh_p2p_ready" | "mesh_p2p_offer" | "mesh_p2p_answer" | "mesh_p2p_ice" | "command" | "auth_ok" | "auth_error" | "machine_evicted" | "force_disconnect" | "token_revoked" | "version_mismatch" | "force_update_required" | "agent_command" | "resolve_action" | "daemon_mesh_result";
|
|
303
289
|
/** Optional routing fields the server stamps on relayed commands. */
|
|
304
290
|
type ServerRelayFields = {
|
|
305
291
|
id?: MessageId;
|
|
@@ -324,15 +310,6 @@ export type ServerAgentCommandMsg = Envelope<'agent_command', {
|
|
|
324
310
|
export type ServerResolveActionMsg = Envelope<'resolve_action', CommandPayload> & ServerRelayFields;
|
|
325
311
|
export type ServerP2PSignalMsg = Envelope<P2PSignalType, RelayedP2PSignalWirePayload> & ServerRelayFields;
|
|
326
312
|
export type ServerMeshP2PSignalMsg = Envelope<MeshP2PSignalType, MeshP2PSignalWirePayload> & ServerRelayFields;
|
|
327
|
-
/** Reply to a `beacon_vectors` GET, correlated by `requestId` (top-level, no payload). A PUT gets no reply. */
|
|
328
|
-
export type BeaconVectorsResultMsg = {
|
|
329
|
-
type: 'beacon_vectors_result';
|
|
330
|
-
requestId: string;
|
|
331
|
-
success: boolean;
|
|
332
|
-
reports?: unknown[];
|
|
333
|
-
truncated?: number;
|
|
334
|
-
error?: string;
|
|
335
|
-
};
|
|
336
313
|
/** Correlated ack/nack of a `daemon_mesh_command` (top-level, no payload). */
|
|
337
314
|
export type DaemonMeshResultMsg = {
|
|
338
315
|
type: 'daemon_mesh_result';
|
|
@@ -341,7 +318,7 @@ export type DaemonMeshResultMsg = {
|
|
|
341
318
|
result?: unknown;
|
|
342
319
|
error?: string;
|
|
343
320
|
};
|
|
344
|
-
export type ServerToDaemonControlMsg = AuthOkMsg | AuthErrorMsg | MachineEvictedMsg | ForceDisconnectMsg | TokenRevokedMsg | VersionMismatchMsg | ForceUpdateRequiredMsg | ServerCommandMsg | ServerAgentCommandMsg | ServerResolveActionMsg |
|
|
321
|
+
export type ServerToDaemonControlMsg = AuthOkMsg | AuthErrorMsg | MachineEvictedMsg | ForceDisconnectMsg | TokenRevokedMsg | VersionMismatchMsg | ForceUpdateRequiredMsg | ServerCommandMsg | ServerAgentCommandMsg | ServerResolveActionMsg | DaemonMeshResultMsg | ServerP2PSignalMsg | ServerMeshP2PSignalMsg;
|
|
345
322
|
declare const directCommandBrand: unique symbol;
|
|
346
323
|
/**
|
|
347
324
|
* A command name relayed as the frame `type` — the OPEN namespace the REST API
|
|
@@ -364,7 +341,7 @@ export type ServerToDaemonMsg = ServerToDaemonControlMsg | ServerDirectCommandMs
|
|
|
364
341
|
export type ServerToDaemonType = ServerToDaemonMsg['type'];
|
|
365
342
|
export declare function isServerDirectCommandMsg(msg: ServerToDaemonMsg): msg is ServerDirectCommandMsg;
|
|
366
343
|
/** Members of the control set that carry a `payload` object. */
|
|
367
|
-
export type ServerToDaemonPayloadType = Exclude<ServerToDaemonControlMsg,
|
|
344
|
+
export type ServerToDaemonPayloadType = Exclude<ServerToDaemonControlMsg, DaemonMeshResultMsg>['type'];
|
|
368
345
|
export type ServerToDaemonPayloadOf<T extends ServerToDaemonPayloadType> = Extract<ServerToDaemonControlMsg, {
|
|
369
346
|
type: T;
|
|
370
347
|
}>['payload'];
|
|
@@ -372,7 +349,7 @@ export declare function isDaemonDirectCommandType(value: unknown): value is Daem
|
|
|
372
349
|
/**
|
|
373
350
|
* Parse boundary for the daemon: is `raw` a frame this link accepts from the server?
|
|
374
351
|
* Control members are checked for their discriminant and envelope shape; the
|
|
375
|
-
*
|
|
352
|
+
* payload-less `daemon_mesh_result` reply needs its `requestId`; any other well-formed
|
|
376
353
|
* command name becomes a `ServerDirectCommandMsg`.
|
|
377
354
|
*/
|
|
378
355
|
export declare function decodeServerToDaemon(raw: unknown): ServerToDaemonMsg | null;
|
package/dist/session-launch.d.ts
CHANGED
|
@@ -19,14 +19,6 @@
|
|
|
19
19
|
* passed through {@link sanitizeModelIdentifier}) and `modelSource` (an enum,
|
|
20
20
|
* passed through {@link isModelAxisSource}). Never widen that to the record.
|
|
21
21
|
*/
|
|
22
|
-
/**
|
|
23
|
-
* Where a model / thinking-level value came from.
|
|
24
|
-
*
|
|
25
|
-
* `restore` is deliberately NOT a member: a hosted session re-attached after a
|
|
26
|
-
* daemon restart keeps the ORIGINAL source (the user still picked that model);
|
|
27
|
-
* only `SessionLaunchRecord.launchedBy` records that the session came back via
|
|
28
|
-
* restore.
|
|
29
|
-
*/
|
|
30
22
|
export declare const MODEL_AXIS_SOURCES: readonly ["user", "remembered", "mesh_slot", "task_override", "provider_default", "unspecified"];
|
|
31
23
|
export type ModelAxisSource = typeof MODEL_AXIS_SOURCES[number];
|
|
32
24
|
export declare function isModelAxisSource(value: unknown): value is ModelAxisSource;
|
package/dist/slot-proposal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CLI auto-detect → capability-slot
|
|
2
|
+
* CLI auto-detect → capability-slot PROPOSAL generator.
|
|
3
3
|
*
|
|
4
4
|
* Detection of installed CLI providers already exists per node (the status
|
|
5
5
|
* snapshot's `availableProviders`), and applying a slot profile already exists
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
* need it, and it is pure data + pure functions on plain objects.
|
|
28
28
|
*/
|
|
29
29
|
import { type MeshTaskDifficulty, type NodeCapabilitySlot } from './brain-routing';
|
|
30
|
-
import type { MagiSlot } from './magi';
|
|
31
30
|
/**
|
|
32
31
|
* One provider's seeded slot recipe. A provider may map to MORE THAN ONE slot
|
|
33
32
|
* (claude-cli does: a wide sonnet slot plus a narrow opus slot for the hard
|
|
@@ -120,28 +119,3 @@ export interface SlotProposal {
|
|
|
120
119
|
* returned proposal can report what a wholesale write would destroy.
|
|
121
120
|
*/
|
|
122
121
|
export declare function buildSlotProposal(detected: readonly DetectedCliProvider[], currentSlots?: readonly NodeCapabilitySlot[]): SlotProposal;
|
|
123
|
-
/**
|
|
124
|
-
* Build a MAGI panel proposal from the same detections.
|
|
125
|
-
*
|
|
126
|
-
* ─── Deliberately narrow ──────────────────────────────────────────────────────
|
|
127
|
-
*
|
|
128
|
-
* MAGI's value is provider INDEPENDENCE: replicas from different providers
|
|
129
|
-
* (ideally different machines) answering the same question, so agreement means
|
|
130
|
-
* something. Detection tells us which providers exist — that is exactly enough
|
|
131
|
-
* to propose one panel of distinct providers, and no more.
|
|
132
|
-
*
|
|
133
|
-
* What detection does NOT tell us is which provider suits which review KIND
|
|
134
|
-
* (rca vs design vs claim_audit). Nothing in any manifest grades a provider for
|
|
135
|
-
* root-cause analysis over design review, and inventing a per-kind assignment
|
|
136
|
-
* would fabricate a rationale that does not exist. So this proposes ONE panel of
|
|
137
|
-
* the detected providers and leaves the kind binding to the operator; the caller
|
|
138
|
-
* decides which `task_kind` to bind it to via the existing dry-run tool.
|
|
139
|
-
*
|
|
140
|
-
* Ordering follows {@link CLI_SLOT_RECIPES} insertion order (recipe-known
|
|
141
|
-
* providers first, in table order), so the panel leads with the providers whose
|
|
142
|
-
* suitability is actually attested.
|
|
143
|
-
*/
|
|
144
|
-
export declare function buildMagiPanelProposal(detected: readonly DetectedCliProvider[], opts?: {
|
|
145
|
-
nodeId?: string;
|
|
146
|
-
maxSlots?: number;
|
|
147
|
-
}): MagiSlot[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turn-ipc shared runtime-guard primitives (the protocol version stamp and the
|
|
3
|
+
* small structural checks every command decoder composes). Part of the turn-ipc
|
|
4
|
+
* wire contract (./turn-ipc.ts).
|
|
5
|
+
*/
|
|
6
|
+
/** Every request in this file is versioned so a responder can reject a shape it predates. */
|
|
7
|
+
export declare const TURN_IPC_PROTOCOL_VERSION: 1;
|
|
8
|
+
export declare function isFiniteNumber(value: unknown): value is number;
|
|
9
|
+
export declare function isNonNegativeInt(value: unknown): value is number;
|
|
10
|
+
export declare function isOptionalId(value: unknown): boolean;
|
|
11
|
+
export declare function hasOnlyKeys(value: Record<string, unknown>, allowed: readonly string[]): boolean;
|
|
12
|
+
export declare function makeGuard<T extends readonly string[]>(values: T): (value: unknown) => value is T[number];
|
|
13
|
+
export declare function isStringArray(value: unknown): value is readonly string[];
|
|
14
|
+
export declare function isOptionalShortString(value: unknown, max?: number): boolean;
|
|
15
|
+
export declare function isRecordArray(value: unknown): value is readonly Record<string, unknown>[];
|
|
16
|
+
export declare function isOptionalRecord(value: unknown): boolean;
|
|
17
|
+
export declare function isOptionalBoolean(value: unknown): boolean;
|
|
18
|
+
export declare function isOptionalString(value: unknown): boolean;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turn-ipc — mission, note, tool-call and ledger commands: mission_upsert,
|
|
3
|
+
* mission_query, mission_list_query, note_upsert, note_forget, tool_call_record,
|
|
4
|
+
* ledger_query. Part of the turn-ipc wire contract (./turn-ipc.ts).
|
|
5
|
+
*/
|
|
6
|
+
import { TURN_IPC_PROTOCOL_VERSION } from './turn-ipc-guards';
|
|
7
|
+
export declare const MESH_MISSION_STATUSES: readonly ["active", "paused", "completed", "abandoned"];
|
|
8
|
+
export type MeshMissionStatusValue = typeof MESH_MISSION_STATUSES[number];
|
|
9
|
+
export declare const isMeshMissionStatusValue: (value: unknown) => value is "active" | "completed" | "paused" | "abandoned";
|
|
10
|
+
export interface MissionBriefWire {
|
|
11
|
+
goal: string;
|
|
12
|
+
constraints?: readonly string[];
|
|
13
|
+
doneCriteria?: readonly string[];
|
|
14
|
+
handoffNotes?: readonly string[];
|
|
15
|
+
ownedPaths?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface MissionUpsertRequest {
|
|
18
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
19
|
+
meshId: string;
|
|
20
|
+
/** Omitted = create a new mission; present = update (must resolve to an existing mission — see mesh-missions.ts MISSION-UPSERT-SILENT-CREATE). */
|
|
21
|
+
id?: string;
|
|
22
|
+
title: string;
|
|
23
|
+
/** Free text — see file-header note on why this is fine over local IPC. */
|
|
24
|
+
goal?: string;
|
|
25
|
+
status?: MeshMissionStatusValue;
|
|
26
|
+
/**
|
|
27
|
+
* H2: `undefined` = do not touch the stored brief. `null` = explicitly clear it.
|
|
28
|
+
* A present object with no usable `goal` is treated by the daemon's own
|
|
29
|
+
* `normalizeMissionBrief` as "no brief" (see mesh-missions.ts upsertMeshMission) —
|
|
30
|
+
* this wire guard only checks SHAPE, not that decision.
|
|
31
|
+
*/
|
|
32
|
+
brief?: MissionBriefWire | null;
|
|
33
|
+
}
|
|
34
|
+
export interface MeshMissionRecordWire {
|
|
35
|
+
id: string;
|
|
36
|
+
meshId: string;
|
|
37
|
+
title: string;
|
|
38
|
+
goal: string;
|
|
39
|
+
status: MeshMissionStatusValue;
|
|
40
|
+
/** H2: absent = no brief attached to this mission. */
|
|
41
|
+
brief?: MissionBriefWire;
|
|
42
|
+
}
|
|
43
|
+
export interface MissionUpsertResponse {
|
|
44
|
+
mission: MeshMissionRecordWire;
|
|
45
|
+
}
|
|
46
|
+
export declare function decodeMissionUpsertRequest(value: unknown): MissionUpsertRequest | null;
|
|
47
|
+
export declare function isMissionUpsertResponse(value: unknown): value is MissionUpsertResponse;
|
|
48
|
+
export declare function decodeMissionUpsertResponse(value: unknown): MissionUpsertResponse | null;
|
|
49
|
+
export interface MissionQueryRequest {
|
|
50
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
51
|
+
meshId: string;
|
|
52
|
+
/** Omitted = every status. */
|
|
53
|
+
statuses?: readonly MeshMissionStatusValue[];
|
|
54
|
+
/** Single-mission lookup (mesh-missions.ts `getMeshMission`'s shape) — mutually exclusive with `statuses`. */
|
|
55
|
+
id?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface MissionQueryResponse {
|
|
58
|
+
missions: readonly MeshMissionRecordWire[];
|
|
59
|
+
}
|
|
60
|
+
export declare function decodeMissionQueryRequest(value: unknown): MissionQueryRequest | null;
|
|
61
|
+
export declare function decodeMissionQueryResponse(value: unknown): MissionQueryResponse | null;
|
|
62
|
+
export interface MissionListQueryRequest {
|
|
63
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
64
|
+
meshId: string;
|
|
65
|
+
statuses?: readonly MeshMissionStatusValue[];
|
|
66
|
+
verbose?: boolean;
|
|
67
|
+
withStats?: boolean;
|
|
68
|
+
limit?: number;
|
|
69
|
+
historyIdLimit?: number;
|
|
70
|
+
/**
|
|
71
|
+
* The mesh_status mission projection, computed in the daemon (the MCP no longer
|
|
72
|
+
* opens the daemon's store for it): 'compact' = `getMeshStatusMissionsCompact`
|
|
73
|
+
* (live missions goal-elided + folded history), 'verbose' =
|
|
74
|
+
* `getMeshStatusMissionSummaries({verbose: true})` (live + capped history, full
|
|
75
|
+
* goal, no stats — stats ride one batched `task_stats_query`). Rows then also
|
|
76
|
+
* carry `createdAt`/`updatedAt`/`closeCandidateEmittedAt`. When set, every other
|
|
77
|
+
* option except `historyIdLimit` is ignored. An older daemon rejects the key.
|
|
78
|
+
*/
|
|
79
|
+
meshStatusView?: 'compact' | 'verbose';
|
|
80
|
+
}
|
|
81
|
+
export interface MeshMissionTaskAggregateWire {
|
|
82
|
+
total: number;
|
|
83
|
+
pending: number;
|
|
84
|
+
assigned: number;
|
|
85
|
+
completed: number;
|
|
86
|
+
failed: number;
|
|
87
|
+
cancelled: number;
|
|
88
|
+
blocked: number;
|
|
89
|
+
lastActivityAt: string | null;
|
|
90
|
+
}
|
|
91
|
+
export interface MeshMissionStatsWire {
|
|
92
|
+
missionId: string;
|
|
93
|
+
taskCount: number;
|
|
94
|
+
completed: number;
|
|
95
|
+
failed: number;
|
|
96
|
+
totalDurationMs: number;
|
|
97
|
+
wallClockMs: number | null;
|
|
98
|
+
retries: number;
|
|
99
|
+
incompleteTaskIds: readonly string[];
|
|
100
|
+
}
|
|
101
|
+
/** Verbose (full-goal) mission row. `goal` present, `goalPreview`/`goalTruncated` absent. */
|
|
102
|
+
export interface MissionListSummaryVerboseWire {
|
|
103
|
+
id: string;
|
|
104
|
+
meshId: string;
|
|
105
|
+
title: string;
|
|
106
|
+
goal: string;
|
|
107
|
+
status: MeshMissionStatusValue;
|
|
108
|
+
tasks: MeshMissionTaskAggregateWire;
|
|
109
|
+
stats?: MeshMissionStatsWire;
|
|
110
|
+
/** H2: absent = no brief attached. */
|
|
111
|
+
brief?: MissionBriefWire;
|
|
112
|
+
/** `meshStatusView` rows only. */
|
|
113
|
+
createdAt?: string;
|
|
114
|
+
updatedAt?: string;
|
|
115
|
+
closeCandidateEmittedAt?: string | null;
|
|
116
|
+
}
|
|
117
|
+
/** Compact (default) mission row. `goalPreview`/`goalTruncated` present, `goal` absent. */
|
|
118
|
+
export interface MissionListSummarySlimWire {
|
|
119
|
+
id: string;
|
|
120
|
+
meshId: string;
|
|
121
|
+
title: string;
|
|
122
|
+
goalPreview: string;
|
|
123
|
+
goalTruncated: boolean;
|
|
124
|
+
status: MeshMissionStatusValue;
|
|
125
|
+
tasks: MeshMissionTaskAggregateWire;
|
|
126
|
+
stats?: MeshMissionStatsWire;
|
|
127
|
+
/** H2: absent = no brief attached. */
|
|
128
|
+
brief?: MissionBriefWire;
|
|
129
|
+
/** `meshStatusView` rows only. */
|
|
130
|
+
createdAt?: string;
|
|
131
|
+
updatedAt?: string;
|
|
132
|
+
closeCandidateEmittedAt?: string | null;
|
|
133
|
+
}
|
|
134
|
+
export type MissionListSummaryWire = MissionListSummaryVerboseWire | MissionListSummarySlimWire;
|
|
135
|
+
export interface MeshMissionHistoryFoldWire {
|
|
136
|
+
count: number;
|
|
137
|
+
byStatus: Record<string, number>;
|
|
138
|
+
missionIds: readonly string[];
|
|
139
|
+
note: string;
|
|
140
|
+
}
|
|
141
|
+
export interface MissionListQueryResponse {
|
|
142
|
+
missions: readonly MissionListSummaryWire[];
|
|
143
|
+
historyFold: MeshMissionHistoryFoldWire | null;
|
|
144
|
+
truncated: boolean;
|
|
145
|
+
matched: number;
|
|
146
|
+
overflowIds?: readonly string[];
|
|
147
|
+
}
|
|
148
|
+
export declare function decodeMissionListQueryRequest(value: unknown): MissionListQueryRequest | null;
|
|
149
|
+
export declare function decodeMissionListQueryResponse(value: unknown): MissionListQueryResponse | null;
|
|
150
|
+
export declare const OPERATING_NOTE_CATEGORIES: readonly ["provider_quirk", "pattern_to_avoid", "recovery_lesson"];
|
|
151
|
+
export type OperatingNoteCategory = typeof OPERATING_NOTE_CATEGORIES[number];
|
|
152
|
+
export interface NoteUpsertRequest {
|
|
153
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
154
|
+
meshId: string;
|
|
155
|
+
/** Free text (local IPC — see the section note). */
|
|
156
|
+
text: string;
|
|
157
|
+
category?: OperatingNoteCategory;
|
|
158
|
+
pinned?: boolean;
|
|
159
|
+
/** Explicit expiry, ISO-8601. */
|
|
160
|
+
expiresAt?: string;
|
|
161
|
+
/** Note id (or subject key) this note supersedes. */
|
|
162
|
+
supersedes?: string;
|
|
163
|
+
subjectKey?: string;
|
|
164
|
+
/** Best-effort identity of the recording coordinator (session id / daemon id / host). */
|
|
165
|
+
sourceCoordinator?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface NoteUpsertResponse {
|
|
168
|
+
noteId: string;
|
|
169
|
+
/** True when the same text was already among the recent live notes (no new note). */
|
|
170
|
+
deduped: boolean;
|
|
171
|
+
createdAt: string;
|
|
172
|
+
}
|
|
173
|
+
export declare function decodeNoteUpsertRequest(value: unknown): NoteUpsertRequest | null;
|
|
174
|
+
export declare function decodeNoteUpsertResponse(value: unknown): NoteUpsertResponse | null;
|
|
175
|
+
export interface NoteForgetRequest {
|
|
176
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
177
|
+
meshId: string;
|
|
178
|
+
/** At least one of `noteId` / `text` (a text forget retracts every note with that exact text, and any recorded later). */
|
|
179
|
+
noteId?: string;
|
|
180
|
+
text?: string;
|
|
181
|
+
reason?: string;
|
|
182
|
+
}
|
|
183
|
+
export interface NoteForgetResponse {
|
|
184
|
+
/** Live notes this forget hid. */
|
|
185
|
+
matched: number;
|
|
186
|
+
tombstoneId: string;
|
|
187
|
+
}
|
|
188
|
+
export declare function decodeNoteForgetRequest(value: unknown): NoteForgetRequest | null;
|
|
189
|
+
export declare function decodeNoteForgetResponse(value: unknown): NoteForgetResponse | null;
|
|
190
|
+
export declare const TOOL_CALLER_ROLES: readonly ["coordinator", "unknown"];
|
|
191
|
+
export type ToolCallerRole = typeof TOOL_CALLER_ROLES[number];
|
|
192
|
+
export interface ToolCallRecordRequest {
|
|
193
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
194
|
+
meshId: string;
|
|
195
|
+
/** The mesh tool name, e.g. `mesh_status` (identifier, not free text — always a fixed tool-name string). */
|
|
196
|
+
tool: string;
|
|
197
|
+
sessionId?: string;
|
|
198
|
+
callerRole: ToolCallerRole;
|
|
199
|
+
}
|
|
200
|
+
export interface ToolCallRecordResponse {
|
|
201
|
+
rateLimitExceeded: boolean;
|
|
202
|
+
callsInWindow: number;
|
|
203
|
+
/** Short machine-oriented advisory string, or null. Never free text describing content. */
|
|
204
|
+
advisory: string | null;
|
|
205
|
+
}
|
|
206
|
+
export declare function decodeToolCallRecordRequest(value: unknown): ToolCallRecordRequest | null;
|
|
207
|
+
export declare function decodeToolCallRecordResponse(value: unknown): ToolCallRecordResponse | null;
|
|
208
|
+
export interface LedgerQueryRequest {
|
|
209
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
210
|
+
meshId: string;
|
|
211
|
+
/** One or more ledger `kind` strings (daemon-core `MeshLedgerKind`; mesh-shared cannot import that union, so these are identifiers here). Omitted = every kind. */
|
|
212
|
+
kind?: readonly string[];
|
|
213
|
+
/** ISO-8601 or epoch-ms-as-string — passed through to `readLedgerEntries`'s `since` (parsed via `new Date()`). */
|
|
214
|
+
since?: string;
|
|
215
|
+
/** Filter to entries whose nodeId is equivalent to this daemon id (matched via `daemonIdsEquivalent` daemon-side, not raw `===`). */
|
|
216
|
+
node?: string;
|
|
217
|
+
tail?: number;
|
|
218
|
+
/** Also return `getLedgerSummary(meshId)` alongside the entries — saves a second round trip for callers that want both (the common case: every existing call site fetches both together). */
|
|
219
|
+
includeSummary?: boolean;
|
|
220
|
+
}
|
|
221
|
+
export interface LedgerQueryEntryWire {
|
|
222
|
+
id: string;
|
|
223
|
+
meshId: string;
|
|
224
|
+
timestamp: string;
|
|
225
|
+
kind: string;
|
|
226
|
+
nodeId?: string;
|
|
227
|
+
sessionId?: string;
|
|
228
|
+
providerType?: string;
|
|
229
|
+
taskId?: string;
|
|
230
|
+
/** Unbounded JSON passthrough — see file section's CONTENT BOUNDARY note. */
|
|
231
|
+
payload: Record<string, unknown>;
|
|
232
|
+
}
|
|
233
|
+
export interface LedgerQuerySummaryWire {
|
|
234
|
+
meshId: string;
|
|
235
|
+
totalEntries: number;
|
|
236
|
+
taskDispatched: number;
|
|
237
|
+
taskCompleted: number;
|
|
238
|
+
taskFailed: number;
|
|
239
|
+
taskStalled: number;
|
|
240
|
+
sessionLaunched: number;
|
|
241
|
+
checkpointCreated: number;
|
|
242
|
+
lastActivityAt: string | null;
|
|
243
|
+
recentFailures: number;
|
|
244
|
+
}
|
|
245
|
+
export interface LedgerQueryResponse {
|
|
246
|
+
entries: readonly LedgerQueryEntryWire[];
|
|
247
|
+
summary?: LedgerQuerySummaryWire;
|
|
248
|
+
}
|
|
249
|
+
export declare function decodeLedgerQueryRequest(value: unknown): LedgerQueryRequest | null;
|
|
250
|
+
export declare function decodeLedgerQueryResponse(value: unknown): LedgerQueryResponse | null;
|