@adhdev/mesh-shared 1.0.60-rc.9 → 1.0.60
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 +6 -8
- package/dist/git-diff.d.ts +21 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +2876 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2625 -72
- package/dist/index.mjs.map +1 -1
- package/dist/interpolation.d.ts +0 -9
- package/dist/json.d.ts +4 -0
- package/dist/keyed-doc-delta.d.ts +105 -0
- package/dist/mesh-tool-names.d.ts +31 -2
- package/dist/mesh-vocabulary.d.ts +66 -0
- package/dist/mission-brief.d.ts +62 -0
- package/dist/outbound-message.d.ts +201 -0
- package/dist/path-ownership.d.ts +101 -0
- package/dist/protocol/daemon-server.d.ts +356 -0
- package/dist/protocol/dashboard-daemon-p2p.d.ts +213 -0
- package/dist/protocol/dashboard-server.d.ts +240 -0
- package/dist/protocol/dashboard-wire-version.d.ts +21 -0
- package/dist/protocol/envelope.d.ts +55 -0
- package/dist/protocol/index.d.ts +16 -0
- package/dist/session-launch.d.ts +105 -0
- package/dist/session-status.d.ts +75 -0
- package/dist/slot-proposal.d.ts +2 -28
- package/dist/turn-evidence.d.ts +434 -0
- 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 +90 -0
- package/dist/types.d.ts +11 -0
- package/dist/worker-protocol.d.ts +69 -0
- package/dist/ws-protocol.d.ts +69 -41
- package/package.json +1 -1
- package/src/brain-routing.ts +9 -11
- package/src/git-diff.ts +48 -0
- package/src/index.ts +12 -1
- package/src/interpolation.ts +0 -18
- package/src/json.ts +10 -0
- package/src/keyed-doc-delta.ts +413 -0
- package/src/mesh-tool-names.ts +66 -25
- package/src/mesh-vocabulary.ts +94 -0
- package/src/mission-brief.ts +153 -0
- package/src/outbound-message.ts +319 -0
- package/src/path-ownership.ts +271 -0
- package/src/protocol/daemon-server.ts +510 -0
- package/src/protocol/dashboard-daemon-p2p.ts +273 -0
- package/src/protocol/dashboard-server.ts +340 -0
- package/src/protocol/dashboard-wire-version.ts +27 -0
- package/src/protocol/envelope.ts +75 -0
- package/src/protocol/index.ts +17 -0
- package/src/session-launch.ts +245 -0
- package/src/session-status.ts +164 -0
- package/src/slot-proposal.ts +2 -48
- package/src/turn-evidence.ts +596 -0
- 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 +137 -0
- package/src/types.ts +8 -0
- package/src/worker-protocol.ts +164 -0
- package/src/ws-protocol.ts +98 -93
- package/dist/magi.d.ts +0 -281
- package/src/magi.ts +0 -310
|
@@ -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;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turn-ipc — local records, queue composites and active work (C-W9a):
|
|
3
|
+
* record_local, queue_query, queue_enqueue, queue_enqueue_batch, queue_cancel,
|
|
4
|
+
* queue_requeue, direct_dispatch_record, active_work_query,
|
|
5
|
+
* recovery_context_query. Part of the turn-ipc wire contract (./turn-ipc.ts).
|
|
6
|
+
*/
|
|
7
|
+
import { TURN_IPC_PROTOCOL_VERSION } from './turn-ipc-guards';
|
|
8
|
+
/** A queue row as the daemon's `getQueue` returns it — a JSON passthrough (see the section note). */
|
|
9
|
+
export type QueueEntryWire = Record<string, unknown> & {
|
|
10
|
+
id: string;
|
|
11
|
+
status: string;
|
|
12
|
+
};
|
|
13
|
+
export interface RecordLocalRequest {
|
|
14
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
15
|
+
meshId: string;
|
|
16
|
+
/** A `MeshLedgerKind` (daemon-core); an identifier here (mesh-shared cannot import that union). */
|
|
17
|
+
kind: string;
|
|
18
|
+
nodeId?: string;
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
providerType?: string;
|
|
21
|
+
taskId?: string;
|
|
22
|
+
payload: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface RecordLocalResponse {
|
|
25
|
+
eventId: string;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
storedLocally: boolean;
|
|
28
|
+
published: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function decodeRecordLocalRequest(value: unknown): RecordLocalRequest | null;
|
|
31
|
+
export declare function decodeRecordLocalResponse(value: unknown): RecordLocalResponse | null;
|
|
32
|
+
export interface QueueQueryRequest {
|
|
33
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
34
|
+
meshId: string;
|
|
35
|
+
/** Status filter (queue statuses); omitted = every row. */
|
|
36
|
+
statuses?: readonly string[];
|
|
37
|
+
/** One row by id (returns 0 or 1 entries). */
|
|
38
|
+
taskId?: string;
|
|
39
|
+
/** Project for a VIEW surface: the persisted input envelope → `inputSummary` (summarizeQueueEntryInputForView). */
|
|
40
|
+
view?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Also return the per-status row counts of the WHOLE mesh queue (columns only,
|
|
43
|
+
* no payload parse) — lets a view read only the rows it shows yet report
|
|
44
|
+
* mesh-wide counts. An older daemon rejects the key.
|
|
45
|
+
*/
|
|
46
|
+
withCounts?: boolean;
|
|
47
|
+
/** With `withCounts`: also count terminal rows whose `updated_at` is older than this age. */
|
|
48
|
+
historicalOlderThanMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Also return `dependencyHeads`: id/status/cancelReason of every
|
|
51
|
+
* row the returned entries list in `dependsOn` that is not itself returned —
|
|
52
|
+
* enough to annotate dependency state without reading the whole queue.
|
|
53
|
+
*/
|
|
54
|
+
withDependencyHeads?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/** A dependency row reduced to the fields dependency-state annotation reads. */
|
|
57
|
+
export interface QueueDependencyHeadWire {
|
|
58
|
+
id: string;
|
|
59
|
+
status: string;
|
|
60
|
+
cancelReason?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface QueueQueryResponse {
|
|
63
|
+
entries: readonly QueueEntryWire[];
|
|
64
|
+
/** `withCounts`: row count per status over the whole mesh queue. */
|
|
65
|
+
counts?: Record<string, number>;
|
|
66
|
+
/** `withCounts` + `historicalOlderThanMs`: terminal rows older than that age. */
|
|
67
|
+
oldHistoricalCount?: number;
|
|
68
|
+
/** `withDependencyHeads`. */
|
|
69
|
+
dependencyHeads?: readonly QueueDependencyHeadWire[];
|
|
70
|
+
}
|
|
71
|
+
export declare function decodeQueueQueryRequest(value: unknown): QueueQueryRequest | null;
|
|
72
|
+
export declare function decodeQueueQueryResponse(value: unknown): QueueQueryResponse | null;
|
|
73
|
+
export interface QueueEnqueueRequest {
|
|
74
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
75
|
+
meshId: string;
|
|
76
|
+
/** Free text (the task message — see the section note). */
|
|
77
|
+
message: string;
|
|
78
|
+
options?: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
export interface QueueEnqueueResponse {
|
|
81
|
+
entry: QueueEntryWire;
|
|
82
|
+
}
|
|
83
|
+
export declare function decodeQueueEnqueueRequest(value: unknown): QueueEnqueueRequest | null;
|
|
84
|
+
export declare function decodeQueueEnqueueResponse(value: unknown): QueueEnqueueResponse | null;
|
|
85
|
+
export interface QueueEnqueueBatchRequest {
|
|
86
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
87
|
+
meshId: string;
|
|
88
|
+
/** `MeshTaskBatchEntrySpec[]` (daemon-core, JSON passthrough). */
|
|
89
|
+
specs: readonly Record<string, unknown>[];
|
|
90
|
+
}
|
|
91
|
+
export type QueueEnqueueBatchResponse = {
|
|
92
|
+
ok: true;
|
|
93
|
+
tasks: readonly QueueEntryWire[];
|
|
94
|
+
} | {
|
|
95
|
+
ok: false;
|
|
96
|
+
refusalCode?: string;
|
|
97
|
+
message: string;
|
|
98
|
+
extra?: Record<string, unknown>;
|
|
99
|
+
};
|
|
100
|
+
export declare function decodeQueueEnqueueBatchRequest(value: unknown): QueueEnqueueBatchRequest | null;
|
|
101
|
+
export declare function decodeQueueEnqueueBatchResponse(value: unknown): QueueEnqueueBatchResponse | null;
|
|
102
|
+
export interface QueueCancelRequest {
|
|
103
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
104
|
+
meshId: string;
|
|
105
|
+
taskId: string;
|
|
106
|
+
/** Operator reason (free text, local IPC). */
|
|
107
|
+
reason?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface QueueCancelResponse {
|
|
110
|
+
/** The cancelled row, or null when no such task. */
|
|
111
|
+
task: QueueEntryWire | null;
|
|
112
|
+
/** The row as it was BEFORE the cancel (its assignment is what a caller stops). */
|
|
113
|
+
before: QueueEntryWire | null;
|
|
114
|
+
}
|
|
115
|
+
export declare function decodeQueueCancelRequest(value: unknown): QueueCancelRequest | null;
|
|
116
|
+
export declare function decodeQueueCancelResponse(value: unknown): QueueCancelResponse | null;
|
|
117
|
+
export interface QueueRequeueRequest {
|
|
118
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
119
|
+
meshId: string;
|
|
120
|
+
taskId: string;
|
|
121
|
+
/** `requeueTask` options (reason / targetNodeId / targetSessionId / clear* / force / message / maxRetries / notBefore), JSON passthrough. */
|
|
122
|
+
options?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
export interface QueueRequeueResponse {
|
|
125
|
+
task: QueueEntryWire | null;
|
|
126
|
+
}
|
|
127
|
+
export declare function decodeQueueRequeueRequest(value: unknown): QueueRequeueRequest | null;
|
|
128
|
+
export declare function decodeQueueRequeueResponse(value: unknown): QueueRequeueResponse | null;
|
|
129
|
+
export interface DirectDispatchRecordRequest {
|
|
130
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
131
|
+
meshId: string;
|
|
132
|
+
taskId: string;
|
|
133
|
+
/** Free text (the authored task message — the materialised row keeps it). */
|
|
134
|
+
message: string;
|
|
135
|
+
/** `recordDirectDispatchTask` options minus `id` (JSON passthrough). */
|
|
136
|
+
task?: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
export interface DirectDispatchRecordResponse {
|
|
139
|
+
taskRecorded: boolean;
|
|
140
|
+
}
|
|
141
|
+
export declare function decodeDirectDispatchRecordRequest(value: unknown): DirectDispatchRecordRequest | null;
|
|
142
|
+
export declare function decodeDirectDispatchRecordResponse(value: unknown): DirectDispatchRecordResponse | null;
|
|
143
|
+
export interface ActiveWorkQueryRequest {
|
|
144
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
145
|
+
meshId: string;
|
|
146
|
+
/** Live node probe results (`buildMeshActiveWork`'s `nodes`), JSON passthrough. */
|
|
147
|
+
nodes?: readonly Record<string, unknown>[];
|
|
148
|
+
/** Substitute queue rows (default: the daemon's `getQueue`). */
|
|
149
|
+
queue?: readonly Record<string, unknown>[];
|
|
150
|
+
/** Record tail fed to active work (default 200). */
|
|
151
|
+
recordTail?: number;
|
|
152
|
+
includeTerminalDirect?: boolean;
|
|
153
|
+
/** Default true. */
|
|
154
|
+
compute?: boolean;
|
|
155
|
+
includeInputs?: boolean;
|
|
156
|
+
includeSummary?: boolean;
|
|
157
|
+
includeSchedulingRuntime?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* The caller's mesh snapshot for the scheduling runtime, JSON passthrough.
|
|
160
|
+
* Optional since the daemon resolves its own mesh record when it is absent;
|
|
161
|
+
* an older daemon rejects `includeSchedulingRuntime` without it (the caller's
|
|
162
|
+
* feature-detect signal to resend with the mesh).
|
|
163
|
+
*/
|
|
164
|
+
mesh?: Record<string, unknown>;
|
|
165
|
+
}
|
|
166
|
+
export interface ActiveWorkQueryResponse {
|
|
167
|
+
/** `MeshActiveWorkEvidence` (daemon-core), JSON passthrough; absent when `compute: false`. */
|
|
168
|
+
activeWork?: Record<string, unknown>;
|
|
169
|
+
records?: readonly Record<string, unknown>[];
|
|
170
|
+
directDispatches?: readonly Record<string, unknown>[];
|
|
171
|
+
/** `MeshLedgerSummary`-shaped record summary. */
|
|
172
|
+
summary?: Record<string, unknown>;
|
|
173
|
+
schedulingRuntime?: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
export declare function decodeActiveWorkQueryRequest(value: unknown): ActiveWorkQueryRequest | null;
|
|
176
|
+
export declare function decodeActiveWorkQueryResponse(value: unknown): ActiveWorkQueryResponse | null;
|
|
177
|
+
export interface RecoveryContextQueryRequest {
|
|
178
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
179
|
+
meshId: string;
|
|
180
|
+
nodeId?: string;
|
|
181
|
+
sessionId?: string;
|
|
182
|
+
maxRetries?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Batch: one context per node id, computed over ONE record read (answers
|
|
185
|
+
* `contexts`). Exclusive with `nodeId`/`sessionId`. An older daemon rejects it.
|
|
186
|
+
*/
|
|
187
|
+
nodeIds?: readonly string[];
|
|
188
|
+
}
|
|
189
|
+
export interface RecoveryContextQueryResponse {
|
|
190
|
+
/** Single mode (nodeId/sessionId). */
|
|
191
|
+
context?: Record<string, unknown>;
|
|
192
|
+
/** Batch mode (`nodeIds`): context per node id. */
|
|
193
|
+
contexts?: Record<string, Record<string, unknown>>;
|
|
194
|
+
}
|
|
195
|
+
export declare function decodeRecoveryContextQueryRequest(value: unknown): RecoveryContextQueryRequest | null;
|
|
196
|
+
export declare function decodeRecoveryContextQueryResponse(value: unknown): RecoveryContextQueryResponse | null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turn-ipc — task stats and maintenance commands: task_stats_query,
|
|
3
|
+
* prune_stale_direct, orphaned_pin_notify. Part of the turn-ipc wire contract
|
|
4
|
+
* (./turn-ipc.ts).
|
|
5
|
+
*/
|
|
6
|
+
import { TURN_IPC_PROTOCOL_VERSION } from './turn-ipc-guards';
|
|
7
|
+
export interface TaskStatsQueryRequest {
|
|
8
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
9
|
+
meshId: string;
|
|
10
|
+
taskIds?: readonly string[];
|
|
11
|
+
missionId?: string;
|
|
12
|
+
tail?: number;
|
|
13
|
+
/** Also compute `computeMeshMissionStats` — requires `missionId`. */
|
|
14
|
+
rollup?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Batch rollups: `computeMeshMissionStats` for every id, over ONE queue read and
|
|
17
|
+
* ONE record read (answers `missions`, `tasks` empty). Exclusive with
|
|
18
|
+
* `taskIds`/`missionId`. An older daemon rejects the key.
|
|
19
|
+
*/
|
|
20
|
+
missionIds?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export interface TaskStatsQueryResponse {
|
|
23
|
+
/** `MeshTaskStats[]`, JSON passthrough. */
|
|
24
|
+
tasks: readonly Record<string, unknown>[];
|
|
25
|
+
/** `MeshMissionStats`, JSON passthrough; present only when `rollup: true` was requested and satisfiable. */
|
|
26
|
+
mission?: Record<string, unknown>;
|
|
27
|
+
/** Batch mode: `MeshMissionStats` per requested mission id, JSON passthrough. */
|
|
28
|
+
missions?: Record<string, Record<string, unknown>>;
|
|
29
|
+
}
|
|
30
|
+
export declare function decodeTaskStatsQueryRequest(value: unknown): TaskStatsQueryRequest | null;
|
|
31
|
+
export declare function decodeTaskStatsQueryResponse(value: unknown): TaskStatsQueryResponse | null;
|
|
32
|
+
export interface PruneStaleDirectRequest {
|
|
33
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
34
|
+
meshId: string;
|
|
35
|
+
execute?: boolean;
|
|
36
|
+
includeTerminal?: boolean;
|
|
37
|
+
source?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PruneStaleDirectResponse {
|
|
40
|
+
mode: 'execute' | 'dry_run';
|
|
41
|
+
includeTerminal: boolean;
|
|
42
|
+
candidateCount: number;
|
|
43
|
+
/** `MeshActiveWorkRecord[]`, JSON passthrough. */
|
|
44
|
+
prunable: readonly Record<string, unknown>[];
|
|
45
|
+
prunedCount: number;
|
|
46
|
+
preservedUnacknowledged: readonly Record<string, unknown>[];
|
|
47
|
+
preservedLedgerOnly: readonly Record<string, unknown>[];
|
|
48
|
+
preservedNotOrphan: readonly Record<string, unknown>[];
|
|
49
|
+
}
|
|
50
|
+
export declare function decodePruneStaleDirectRequest(value: unknown): PruneStaleDirectRequest | null;
|
|
51
|
+
export declare function decodePruneStaleDirectResponse(value: unknown): PruneStaleDirectResponse | null;
|
|
52
|
+
export interface OrphanedPinNotifyRequest {
|
|
53
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
54
|
+
meshId: string;
|
|
55
|
+
stoppedSessionId: string;
|
|
56
|
+
excludeTaskId?: string;
|
|
57
|
+
cause?: string;
|
|
58
|
+
nodeId?: string;
|
|
59
|
+
coordinatorSessionId?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface OrphanedPinnedTaskWire {
|
|
62
|
+
taskId: string;
|
|
63
|
+
title: string;
|
|
64
|
+
targetSessionId: string;
|
|
65
|
+
targetNodeId?: string;
|
|
66
|
+
missionId?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface OrphanedPinNotifyResponse {
|
|
69
|
+
orphans: readonly OrphanedPinnedTaskWire[];
|
|
70
|
+
}
|
|
71
|
+
export declare function decodeOrphanedPinNotifyRequest(value: unknown): OrphanedPinNotifyRequest | null;
|
|
72
|
+
export declare function decodeOrphanedPinNotifyResponse(value: unknown): OrphanedPinNotifyResponse | null;
|