@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
|
@@ -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;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* turn-ipc — the turn-ledger commands: turn_observe, mesh_record, turn_cancel,
|
|
3
|
+
* operator_status, turn_query, mesh_index_query. Part of the turn-ipc wire
|
|
4
|
+
* contract (./turn-ipc.ts).
|
|
5
|
+
*/
|
|
6
|
+
import { TURN_IPC_PROTOCOL_VERSION } from './turn-ipc-guards';
|
|
7
|
+
import { type TurnEvidence, type TurnAttemptRef, type TurnOutcome, type ProjectedScalars, type TurnReason, type TurnEvidenceKind } from './turn-evidence';
|
|
8
|
+
/** Reducer verdict, mirrored from the C1 reducer's `reduce()` return shape. */
|
|
9
|
+
export declare const TURN_OBSERVE_VERDICTS: readonly ["applied", "recorded", "rejected"];
|
|
10
|
+
export type TurnObserveVerdict = typeof TURN_OBSERVE_VERDICTS[number];
|
|
11
|
+
export interface TurnObserveRequest {
|
|
12
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
13
|
+
evidence: TurnEvidence;
|
|
14
|
+
}
|
|
15
|
+
export interface TurnObserveResponse {
|
|
16
|
+
verdict: TurnObserveVerdict;
|
|
17
|
+
attemptRef: TurnAttemptRef;
|
|
18
|
+
/** Present only when the evidence committed the attempt (verdict 'applied' + a terminal-class kind). */
|
|
19
|
+
outcome?: TurnOutcome;
|
|
20
|
+
}
|
|
21
|
+
export declare function decodeTurnObserveRequest(value: unknown): TurnObserveRequest | null;
|
|
22
|
+
export declare function decodeTurnObserveResponse(value: unknown): TurnObserveResponse | null;
|
|
23
|
+
/**
|
|
24
|
+
* Structural pin of `seqscribe/mesh-event-projection.ts` `PROJECTED_PAYLOAD_KEYS`
|
|
25
|
+
* (daemon-core; this leaf cannot import it). A test in this package's test
|
|
26
|
+
* suite AND a daemon-core test each assert their list equals this one — see
|
|
27
|
+
* `mesh-shared/test/turn-ipc.test.ts` and the C-W6 report's break-once table.
|
|
28
|
+
* Adding a key here is the SAME assertion as adding it there: non-content
|
|
29
|
+
* (identifier, enum, boolean, or counter), never free text.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MESH_RECORD_PAYLOAD_KEYS: readonly ["taskId", "deliveryId", "attemptId", "missionId", "checkpointId", "promptId", "providerSessionId", "targetNoteId", "nodeId", "sessionId", "providerType", "transport", "attemptedSessionId", "holderSessionId", "reason", "status", "outcome", "terminalKind", "event", "source", "intentionalStopReason", "retryable", "rebound", "forced", "fallback", "membershipRemoved", "requestedForce", "removedByRemoteDaemon", "completedViaReady", "intentional", "weak", "attempt", "attemptCount", "count"];
|
|
32
|
+
/** Maximum length of any string value in a `mesh_record` payload (mirrors `MAX_PROJECTED_STRING`). */
|
|
33
|
+
export declare const MAX_MESH_RECORD_STRING = 200;
|
|
34
|
+
export interface MeshRecordRequest {
|
|
35
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
36
|
+
meshId: string;
|
|
37
|
+
/** The original ledger `kind` string (daemon-core `MeshLedgerKind`; mesh-shared cannot import that union, so it is an identifier here). */
|
|
38
|
+
ledgerKind: string;
|
|
39
|
+
nodeId?: string;
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
taskId?: string;
|
|
42
|
+
/** Restricted to `MESH_RECORD_PAYLOAD_KEYS` — an unknown key is a decode failure, not a silently dropped field. */
|
|
43
|
+
payload: ProjectedScalars;
|
|
44
|
+
}
|
|
45
|
+
export interface MeshRecordResponse {
|
|
46
|
+
/** `mesh.<id>.events` append coordinates, for callers that need to reference the entry (e.g. a `ref`'d handoff). */
|
|
47
|
+
eventId: string;
|
|
48
|
+
seq: number;
|
|
49
|
+
}
|
|
50
|
+
/** Every payload key must be a member of `MESH_RECORD_PAYLOAD_KEYS` — the allow-list boundary at the wire. */
|
|
51
|
+
export declare function isMeshRecordPayload(value: unknown): value is ProjectedScalars;
|
|
52
|
+
export declare function decodeMeshRecordRequest(value: unknown): MeshRecordRequest | null;
|
|
53
|
+
export declare function decodeMeshRecordResponse(value: unknown): MeshRecordResponse | null;
|
|
54
|
+
export interface TurnCancelRequest {
|
|
55
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
56
|
+
/** Exactly one of the two must be present — the decoder rejects both-or-neither. */
|
|
57
|
+
attemptId?: string;
|
|
58
|
+
taskId?: string;
|
|
59
|
+
reason: TurnReason;
|
|
60
|
+
}
|
|
61
|
+
export interface TurnCancelResponse {
|
|
62
|
+
attemptRef: TurnAttemptRef;
|
|
63
|
+
verdict: TurnObserveVerdict;
|
|
64
|
+
}
|
|
65
|
+
export declare function decodeTurnCancelRequest(value: unknown): TurnCancelRequest | null;
|
|
66
|
+
export declare function decodeTurnCancelResponse(value: unknown): TurnCancelResponse | null;
|
|
67
|
+
/**
|
|
68
|
+
* Fire-and-forget operator/tool-call status record — replaces
|
|
69
|
+
* `recordMeshCoordinatorToolCall` (10 sites, `mesh_tool_call_log`) and doubles
|
|
70
|
+
* as the `operator_status` evidence kind's wire shape.
|
|
71
|
+
*
|
|
72
|
+
* NAMING NOTE (flagged for the C-W6 implementer, see report §"mismatch"):
|
|
73
|
+
* the C-W6 brief's DELIVERABLES describes this request as
|
|
74
|
+
* `{taskId, status: MeshTaskStatus, reason}`, but C1's `operator_status`
|
|
75
|
+
* evidence kind (`turn-evidence.ts` `OPERATOR_STATUSES`) is the closed
|
|
76
|
+
* 2-value set `'completed' | 'failed'` — a verdict on an operator ACTION, not
|
|
77
|
+
* a `MeshTaskStatus` (5-value queue-row status: pending/assigned/completed/
|
|
78
|
+
* failed/cancelled). This contract follows `turn-evidence.ts` because that is
|
|
79
|
+
* what the C1 reducer actually consumes for this evidence kind; using the
|
|
80
|
+
* 5-value `MeshTaskStatus` here would let this request carry `pending` or
|
|
81
|
+
* `assigned`, which the reducer has no transition for.
|
|
82
|
+
*/
|
|
83
|
+
export declare const OPERATOR_STATUS_VALUES: readonly ["completed", "failed"];
|
|
84
|
+
export type OperatorStatusValue = typeof OPERATOR_STATUS_VALUES[number];
|
|
85
|
+
export declare const OPERATOR_STATUS_REASON_VALUES: readonly ["operator_update", "refine_terminal", "validation_terminal"];
|
|
86
|
+
export type OperatorStatusReasonValue = typeof OPERATOR_STATUS_REASON_VALUES[number];
|
|
87
|
+
export interface OperatorStatusRequest {
|
|
88
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
89
|
+
taskId: string;
|
|
90
|
+
status: OperatorStatusValue;
|
|
91
|
+
reason: OperatorStatusReasonValue;
|
|
92
|
+
}
|
|
93
|
+
/** Acknowledgement only — this command is fire-and-forget by design (the daemon owns rate-limiting the underlying log). */
|
|
94
|
+
export interface OperatorStatusResponse {
|
|
95
|
+
accepted: true;
|
|
96
|
+
}
|
|
97
|
+
export declare function decodeOperatorStatusRequest(value: unknown): OperatorStatusRequest | null;
|
|
98
|
+
export declare function decodeOperatorStatusResponse(value: unknown): OperatorStatusResponse | null;
|
|
99
|
+
/** Row shape returned by `turn_query` — scalar projection of a `turn_attempts` row (C3 schema), never `data_json`/`payload_json` content. */
|
|
100
|
+
export interface TurnQueryAttemptRow {
|
|
101
|
+
attemptId: string;
|
|
102
|
+
generation: number;
|
|
103
|
+
meshId?: string;
|
|
104
|
+
taskId?: string;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
nodeId?: string;
|
|
107
|
+
providerType?: string;
|
|
108
|
+
state: string;
|
|
109
|
+
terminalOutcome?: TurnOutcome;
|
|
110
|
+
terminalReason?: TurnReason;
|
|
111
|
+
acceptedAt: number;
|
|
112
|
+
terminalAt?: number;
|
|
113
|
+
}
|
|
114
|
+
/** Row shape returned by `turn_query` for the event stream — scalar projection of a `turn_events` row, `payload_json` NEVER included. */
|
|
115
|
+
export interface TurnQueryEventRow {
|
|
116
|
+
eventId: string;
|
|
117
|
+
attemptId?: string;
|
|
118
|
+
generation?: number;
|
|
119
|
+
sessionId: string;
|
|
120
|
+
kind: TurnEvidenceKind;
|
|
121
|
+
source: string;
|
|
122
|
+
verdict: TurnObserveVerdict | 'forwarded';
|
|
123
|
+
atMs: number;
|
|
124
|
+
}
|
|
125
|
+
export interface TurnQueryRequest {
|
|
126
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
127
|
+
meshId: string;
|
|
128
|
+
taskId?: string;
|
|
129
|
+
attemptId?: string;
|
|
130
|
+
sessionId?: string;
|
|
131
|
+
state?: string;
|
|
132
|
+
since?: number;
|
|
133
|
+
tail?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface TurnQueryResponse {
|
|
136
|
+
attempts: readonly TurnQueryAttemptRow[];
|
|
137
|
+
events: readonly TurnQueryEventRow[];
|
|
138
|
+
/** C7-5: set while `mesh.<id>.events` replication is behind for this mesh — the caller must not treat a fleet-scope answer as complete. */
|
|
139
|
+
replicationPending?: boolean;
|
|
140
|
+
}
|
|
141
|
+
export declare function decodeTurnQueryRequest(value: unknown): TurnQueryRequest | null;
|
|
142
|
+
export declare function decodeTurnQueryResponse(value: unknown): TurnQueryResponse | null;
|
|
143
|
+
export declare const MESH_INDEX_QUERY_WRITER_SCOPES: readonly ["own", "fleet"];
|
|
144
|
+
export type MeshIndexQueryWriterScope = typeof MESH_INDEX_QUERY_WRITER_SCOPES[number];
|
|
145
|
+
export interface MeshIndexQueryRequest {
|
|
146
|
+
v: typeof TURN_IPC_PROTOCOL_VERSION;
|
|
147
|
+
meshId: string;
|
|
148
|
+
ledgerKind?: string;
|
|
149
|
+
sessionId?: string;
|
|
150
|
+
taskId?: string;
|
|
151
|
+
writer?: MeshIndexQueryWriterScope;
|
|
152
|
+
since?: number;
|
|
153
|
+
tail?: number;
|
|
154
|
+
}
|
|
155
|
+
/** Row shape returned by `mesh_index_query` — a `mesh_topic_index` row (C3 schema). */
|
|
156
|
+
export interface MeshTopicIndexRow {
|
|
157
|
+
writer: string;
|
|
158
|
+
seq: number;
|
|
159
|
+
meshId: string;
|
|
160
|
+
eventId: string;
|
|
161
|
+
kind: string;
|
|
162
|
+
ledgerKind?: string;
|
|
163
|
+
taskId?: string;
|
|
164
|
+
sessionId?: string;
|
|
165
|
+
nodeId?: string;
|
|
166
|
+
atMs: number;
|
|
167
|
+
payload: ProjectedScalars;
|
|
168
|
+
}
|
|
169
|
+
export interface MeshIndexQueryResponse {
|
|
170
|
+
rows: readonly MeshTopicIndexRow[];
|
|
171
|
+
/** C7-5: true while `mesh.<id>.events` replication is behind for this mesh. */
|
|
172
|
+
replicationPending?: boolean;
|
|
173
|
+
}
|
|
174
|
+
export declare function decodeMeshIndexQueryRequest(value: unknown): MeshIndexQueryRequest | null;
|
|
175
|
+
export declare function isMeshIndexQueryResponse(value: unknown): value is MeshIndexQueryResponse;
|
|
176
|
+
export declare function decodeMeshIndexQueryResponse(value: unknown): MeshIndexQueryResponse | null;
|