@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/index.mjs
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
function readRecord(value) {
|
|
3
3
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
4
4
|
}
|
|
5
|
+
function readOptionalRecord(value) {
|
|
6
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
7
|
+
}
|
|
5
8
|
function readString(...values) {
|
|
6
9
|
for (const value of values) {
|
|
7
10
|
if (typeof value !== "string") continue;
|
|
@@ -10,6 +13,9 @@ function readString(...values) {
|
|
|
10
13
|
}
|
|
11
14
|
return void 0;
|
|
12
15
|
}
|
|
16
|
+
function readText(...values) {
|
|
17
|
+
return readString(...values) ?? "";
|
|
18
|
+
}
|
|
13
19
|
function readNumber(...values) {
|
|
14
20
|
for (const value of values) {
|
|
15
21
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -377,8 +383,29 @@ function summarizeGitShape(status) {
|
|
|
377
383
|
};
|
|
378
384
|
}
|
|
379
385
|
|
|
380
|
-
// src/
|
|
381
|
-
|
|
386
|
+
// src/git-diff.ts
|
|
387
|
+
function truncateDiffText(text, maxLines) {
|
|
388
|
+
const lines = text.split("\n");
|
|
389
|
+
const truncated = lines.length > maxLines;
|
|
390
|
+
return {
|
|
391
|
+
diff: truncated ? lines.slice(0, maxLines).join("\n") + "\n... (truncated)" : text,
|
|
392
|
+
truncated
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function projectFileDiffRow(file, rawResult, maxLines) {
|
|
396
|
+
const raw = readRecord(rawResult);
|
|
397
|
+
const d = readRecord(raw.diff ?? rawResult);
|
|
398
|
+
const text = typeof d.diff === "string" ? d.diff : "";
|
|
399
|
+
const { diff, truncated } = truncateDiffText(text, maxLines);
|
|
400
|
+
return {
|
|
401
|
+
path: file.path,
|
|
402
|
+
old_path: file.oldPath ?? null,
|
|
403
|
+
status: file.status ?? "M",
|
|
404
|
+
diff,
|
|
405
|
+
truncated,
|
|
406
|
+
binary: typeof d.binary === "boolean" ? d.binary : false
|
|
407
|
+
};
|
|
408
|
+
}
|
|
382
409
|
|
|
383
410
|
// src/brain-routing.ts
|
|
384
411
|
var MESH_TASK_DIFFICULTIES = ["easy", "medium", "difficult", "freeform"];
|
|
@@ -619,23 +646,6 @@ function buildSlotProposal(detected, currentSlots = []) {
|
|
|
619
646
|
destructive: droppedSlots.length > 0
|
|
620
647
|
};
|
|
621
648
|
}
|
|
622
|
-
function buildMagiPanelProposal(detected, opts = {}) {
|
|
623
|
-
const providers = dedupeDetected(detected ?? []);
|
|
624
|
-
const tableOrder = Object.keys(CLI_SLOT_RECIPES);
|
|
625
|
-
const rank = (type) => {
|
|
626
|
-
const i = tableOrder.indexOf(type);
|
|
627
|
-
return i === -1 ? Number.MAX_SAFE_INTEGER : i;
|
|
628
|
-
};
|
|
629
|
-
const ordered = [...providers].sort((a, b) => rank(a.type) - rank(b.type));
|
|
630
|
-
const limit = Number.isFinite(opts.maxSlots) && opts.maxSlots > 0 ? Math.floor(opts.maxSlots) : ordered.length;
|
|
631
|
-
return ordered.slice(0, limit).map((p) => ({
|
|
632
|
-
...opts.nodeId ? { nodeId: opts.nodeId } : {},
|
|
633
|
-
provider: p.type
|
|
634
|
-
// A model is intentionally NOT pinned: the panel's job is cross-provider
|
|
635
|
-
// independence, and pinning models here would silently couple the panel
|
|
636
|
-
// to this table's cost assumptions rather than to review quality.
|
|
637
|
-
}));
|
|
638
|
-
}
|
|
639
649
|
|
|
640
650
|
// src/interpolation.ts
|
|
641
651
|
function interpolateString(template, ctx) {
|
|
@@ -650,14 +660,10 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
650
660
|
"mesh_status",
|
|
651
661
|
"mesh_route_preview",
|
|
652
662
|
"mesh_list_nodes",
|
|
653
|
-
//
|
|
663
|
+
// Batch before task, mirroring ALL_MESH_TOOLS.
|
|
654
664
|
"mesh_enqueue_batch",
|
|
655
665
|
"mesh_enqueue_task",
|
|
656
666
|
"mesh_view_queue",
|
|
657
|
-
// GRAPH-ORCHESTRATION Phase E — the coordinator gate + graph view surface.
|
|
658
|
-
"mesh_graph_view",
|
|
659
|
-
"mesh_graph_gate",
|
|
660
|
-
"mesh_graph_node_patch",
|
|
661
667
|
"mesh_queue_cancel",
|
|
662
668
|
"mesh_queue_requeue",
|
|
663
669
|
"mesh_send_task",
|
|
@@ -692,29 +698,14 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
692
698
|
"mesh_mission_upsert",
|
|
693
699
|
"mesh_mission_list",
|
|
694
700
|
"mesh_review_inbox",
|
|
695
|
-
"mesh_magi_review",
|
|
696
|
-
"mesh_magi_collect",
|
|
697
|
-
"mesh_magi_kind_panel",
|
|
698
701
|
"mesh_node_slots",
|
|
699
702
|
"mesh_coordinator_prompt_append"
|
|
700
703
|
];
|
|
701
704
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
702
705
|
var RETIRED_MESH_TOOLS = {
|
|
703
|
-
mesh_graph_gate_claim: {
|
|
704
|
-
tool: "mesh_graph_gate",
|
|
705
|
-
args: { action: "claim" },
|
|
706
|
-
note: 'The extend-only form (claim with extend_seconds) is now action: "extend" with the same extend_seconds.'
|
|
707
|
-
},
|
|
708
|
-
mesh_graph_gate_release: { tool: "mesh_graph_gate", args: { action: "release" } },
|
|
709
|
-
mesh_graph_gate_abandon: { tool: "mesh_graph_gate", args: { action: "abandon" } },
|
|
710
|
-
// Never a published tool (it is the daemon command behind the extend verb),
|
|
711
|
-
// but an older gate-expiry notice told coordinators to call it by this name.
|
|
712
|
-
mesh_graph_gate_extend: { tool: "mesh_graph_gate", args: { action: "extend" } },
|
|
713
706
|
mesh_node_slots_set: { tool: "mesh_node_slots", args: { action: "set" } },
|
|
714
707
|
mesh_node_slots_list: { tool: "mesh_node_slots", args: { action: "list" } },
|
|
715
708
|
mesh_node_slots_propose: { tool: "mesh_node_slots", args: { action: "propose" } },
|
|
716
|
-
mesh_magi_kind_panel_set: { tool: "mesh_magi_kind_panel", args: { action: "set" } },
|
|
717
|
-
mesh_magi_kind_panel_list: { tool: "mesh_magi_kind_panel", args: { action: "list" } },
|
|
718
709
|
mesh_coordinator_prompt_append_get: { tool: "mesh_coordinator_prompt_append", args: { action: "get" } },
|
|
719
710
|
mesh_coordinator_prompt_append_set: { tool: "mesh_coordinator_prompt_append", args: { action: "set" } },
|
|
720
711
|
mesh_record_note: { tool: "mesh_note", args: { action: "record" } },
|
|
@@ -726,7 +717,17 @@ var RETIRED_MESH_TOOLS = {
|
|
|
726
717
|
mesh_plan_onboarding: { tool: "mesh_create", args: { mode: "plan" } },
|
|
727
718
|
mesh_prune_stale_direct: { tool: "mesh_cleanup_sessions", args: { mode: "prune_stale_direct" } }
|
|
728
719
|
};
|
|
720
|
+
var REMOVED_MESH_TOOLS = {
|
|
721
|
+
mesh_magi_review: "For a multi-perspective review, send the same question to 2-3 workers on different providers with mesh_send_task, wait for their report_completion, then synthesize the answers yourself.",
|
|
722
|
+
mesh_magi_collect: "Worker answers arrive as report_completion events; synthesize them yourself.",
|
|
723
|
+
mesh_magi_kind_panel: "There are no review panels any more; pick the workers per review with mesh_send_task.",
|
|
724
|
+
mesh_magi_kind_panel_set: "There are no review panels any more; pick the workers per review with mesh_send_task.",
|
|
725
|
+
mesh_magi_kind_panel_list: "There are no review panels any more; pick the workers per review with mesh_send_task."
|
|
726
|
+
};
|
|
729
727
|
function retiredMeshToolError(name) {
|
|
728
|
+
if (Object.prototype.hasOwnProperty.call(REMOVED_MESH_TOOLS, name)) {
|
|
729
|
+
return `Tool "${name}" was removed. ${REMOVED_MESH_TOOLS[name]}`;
|
|
730
|
+
}
|
|
730
731
|
const entry = Object.prototype.hasOwnProperty.call(RETIRED_MESH_TOOLS, name) ? RETIRED_MESH_TOOLS[name] : void 0;
|
|
731
732
|
if (!entry) return null;
|
|
732
733
|
const discriminator = Object.entries(entry.args).map(([k, v]) => `${k}: "${v}"`).join(", ");
|
|
@@ -1023,7 +1024,6 @@ var DAEMON_TO_SERVER_TYPES = [
|
|
|
1023
1024
|
"command_result",
|
|
1024
1025
|
"error",
|
|
1025
1026
|
"agent_event",
|
|
1026
|
-
"beacon_vectors",
|
|
1027
1027
|
"daemon_mesh_command",
|
|
1028
1028
|
"p2p_offer",
|
|
1029
1029
|
"p2p_ice"
|
|
@@ -1056,7 +1056,6 @@ var SERVER_TO_DAEMON_CONTROL_TYPES = [
|
|
|
1056
1056
|
"command",
|
|
1057
1057
|
"agent_command",
|
|
1058
1058
|
"resolve_action",
|
|
1059
|
-
"beacon_vectors_result",
|
|
1060
1059
|
"daemon_mesh_result",
|
|
1061
1060
|
"p2p_ready",
|
|
1062
1061
|
"p2p_offer",
|
|
@@ -1081,18 +1080,9 @@ function decodeServerToDaemon(raw) {
|
|
|
1081
1080
|
...readEnvelopeFields(raw),
|
|
1082
1081
|
...isNonEmptyString(raw.source) ? { source: raw.source } : {}
|
|
1083
1082
|
};
|
|
1084
|
-
if (raw.type === "
|
|
1083
|
+
if (raw.type === "daemon_mesh_result") {
|
|
1085
1084
|
if (!isNonEmptyString(raw.requestId)) return null;
|
|
1086
1085
|
const base = { requestId: raw.requestId, success: raw.success === true };
|
|
1087
|
-
if (raw.type === "beacon_vectors_result") {
|
|
1088
|
-
return {
|
|
1089
|
-
type: "beacon_vectors_result",
|
|
1090
|
-
...base,
|
|
1091
|
-
...Array.isArray(raw.reports) ? { reports: raw.reports } : {},
|
|
1092
|
-
...typeof raw.truncated === "number" ? { truncated: raw.truncated } : {},
|
|
1093
|
-
...typeof raw.error === "string" ? { error: raw.error } : {}
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
1086
|
return {
|
|
1097
1087
|
type: "daemon_mesh_result",
|
|
1098
1088
|
...base,
|
|
@@ -2069,9 +2059,6 @@ function sanitizeModelIdentifier(value) {
|
|
|
2069
2059
|
const trimmed = value.trim();
|
|
2070
2060
|
return MODEL_IDENTIFIER_PATTERN.test(trimmed) ? trimmed : void 0;
|
|
2071
2061
|
}
|
|
2072
|
-
function readString2(value) {
|
|
2073
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
2074
|
-
}
|
|
2075
2062
|
function readFiniteNumber(value) {
|
|
2076
2063
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
2077
2064
|
}
|
|
@@ -2083,17 +2070,17 @@ function parseModelSelection(raw) {
|
|
|
2083
2070
|
for (const entry of record.history) {
|
|
2084
2071
|
if (!entry || typeof entry !== "object") continue;
|
|
2085
2072
|
const e = entry;
|
|
2086
|
-
const value =
|
|
2073
|
+
const value = readString(e.value);
|
|
2087
2074
|
const at = readFiniteNumber(e.at);
|
|
2088
2075
|
const via = e.via === "launch" || e.via === "change_model" || e.via === "observed" ? e.via : void 0;
|
|
2089
2076
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2090
2077
|
}
|
|
2091
2078
|
}
|
|
2092
|
-
const requested =
|
|
2093
|
-
const launchValue =
|
|
2094
|
-
const resolvedDefault =
|
|
2095
|
-
const current =
|
|
2096
|
-
const observed =
|
|
2079
|
+
const requested = readString(record.requested);
|
|
2080
|
+
const launchValue = readString(record.launchValue);
|
|
2081
|
+
const resolvedDefault = readString(record.resolvedDefault);
|
|
2082
|
+
const current = readString(record.current);
|
|
2083
|
+
const observed = readString(record.observed);
|
|
2097
2084
|
const observedAt = readFiniteNumber(record.observedAt);
|
|
2098
2085
|
return {
|
|
2099
2086
|
source: isModelAxisSource(record.source) ? record.source : "unspecified",
|
|
@@ -2109,15 +2096,15 @@ function parseModelSelection(raw) {
|
|
|
2109
2096
|
function parseSessionLaunchRecord(raw) {
|
|
2110
2097
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2111
2098
|
const record = raw;
|
|
2112
|
-
const sessionId =
|
|
2113
|
-
const providerType =
|
|
2099
|
+
const sessionId = readString(record.sessionId);
|
|
2100
|
+
const providerType = readString(record.providerType);
|
|
2114
2101
|
const launchedAt = readFiniteNumber(record.launchedAt);
|
|
2115
2102
|
const model = parseModelSelection(record.model);
|
|
2116
2103
|
const thinkingLevel = parseModelSelection(record.thinkingLevel);
|
|
2117
2104
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2118
|
-
const providerVersion =
|
|
2119
|
-
const workspace =
|
|
2120
|
-
const autoApproveModeId =
|
|
2105
|
+
const providerVersion = readString(record.providerVersion);
|
|
2106
|
+
const workspace = readString(record.workspace);
|
|
2107
|
+
const autoApproveModeId = readString(record.autoApproveModeId);
|
|
2121
2108
|
return {
|
|
2122
2109
|
sessionId,
|
|
2123
2110
|
providerType,
|
|
@@ -2132,7 +2119,7 @@ function parseSessionLaunchRecord(raw) {
|
|
|
2132
2119
|
};
|
|
2133
2120
|
}
|
|
2134
2121
|
|
|
2135
|
-
// src/turn-ipc.ts
|
|
2122
|
+
// src/turn-ipc-guards.ts
|
|
2136
2123
|
var TURN_IPC_PROTOCOL_VERSION = 1;
|
|
2137
2124
|
function isFiniteNumber3(value) {
|
|
2138
2125
|
return typeof value === "number" && Number.isFinite(value);
|
|
@@ -2149,15 +2136,30 @@ function hasOnlyKeys2(value, allowed) {
|
|
|
2149
2136
|
}
|
|
2150
2137
|
return true;
|
|
2151
2138
|
}
|
|
2152
|
-
var TURN_IPC_ERROR_CODES = ["daemon_required", "turn_ledger_unavailable", "ledger_not_owner"];
|
|
2153
2139
|
function makeGuard3(values) {
|
|
2154
2140
|
const set = new Set(values);
|
|
2155
2141
|
return (value) => typeof value === "string" && set.has(value);
|
|
2156
2142
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
return isRecord(value) && hasOnlyKeys2(value, ["code", "detail"]) && isTurnIpcErrorCode(value.code) && (value.detail === void 0 || typeof value.detail === "string");
|
|
2143
|
+
function isStringArray(value) {
|
|
2144
|
+
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
2160
2145
|
}
|
|
2146
|
+
function isOptionalShortString(value, max = 512) {
|
|
2147
|
+
return value === void 0 || typeof value === "string" && value.trim().length > 0 && value.length <= max;
|
|
2148
|
+
}
|
|
2149
|
+
function isRecordArray(value) {
|
|
2150
|
+
return Array.isArray(value) && value.every(isRecord);
|
|
2151
|
+
}
|
|
2152
|
+
function isOptionalRecord(value) {
|
|
2153
|
+
return value === void 0 || isRecord(value);
|
|
2154
|
+
}
|
|
2155
|
+
function isOptionalBoolean(value) {
|
|
2156
|
+
return value === void 0 || typeof value === "boolean";
|
|
2157
|
+
}
|
|
2158
|
+
function isOptionalString(value) {
|
|
2159
|
+
return value === void 0 || typeof value === "string";
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// src/turn-ipc-turn.ts
|
|
2161
2163
|
var TURN_OBSERVE_VERDICTS = ["applied", "recorded", "rejected"];
|
|
2162
2164
|
var isTurnObserveVerdict = makeGuard3(TURN_OBSERVE_VERDICTS);
|
|
2163
2165
|
function isTurnObserveRequest(value) {
|
|
@@ -2386,13 +2388,10 @@ function isMeshIndexQueryResponse(value) {
|
|
|
2386
2388
|
function decodeMeshIndexQueryResponse(value) {
|
|
2387
2389
|
return isMeshIndexQueryResponse(value) ? value : null;
|
|
2388
2390
|
}
|
|
2391
|
+
|
|
2392
|
+
// src/turn-ipc-mission.ts
|
|
2389
2393
|
var MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
|
|
2390
2394
|
var isMeshMissionStatusValue = makeGuard3(MESH_MISSION_STATUSES);
|
|
2391
|
-
var MESH_MISSION_SOURCES = ["magi", "coordinator"];
|
|
2392
|
-
var isMeshMissionSourceValue = makeGuard3(MESH_MISSION_SOURCES);
|
|
2393
|
-
function isStringArray(value) {
|
|
2394
|
-
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
2395
|
-
}
|
|
2396
2395
|
function isMissionBriefWire(value) {
|
|
2397
2396
|
if (!isRecord(value) || !hasOnlyKeys2(value, ["goal", "constraints", "doneCriteria", "handoffNotes", "ownedPaths"])) return false;
|
|
2398
2397
|
if (typeof value.goal !== "string" || value.goal.trim().length === 0) return false;
|
|
@@ -2402,23 +2401,21 @@ function isMissionBriefWire(value) {
|
|
|
2402
2401
|
return true;
|
|
2403
2402
|
}
|
|
2404
2403
|
function isMeshMissionRecordWire(value) {
|
|
2405
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "
|
|
2404
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
|
|
2406
2405
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2407
2406
|
if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
|
|
2408
2407
|
if (!isMeshMissionStatusValue(value.status)) return false;
|
|
2409
|
-
if (value.source !== void 0 && !isMeshMissionSourceValue(value.source)) return false;
|
|
2410
2408
|
if (value.brief !== void 0 && !isMissionBriefWire(value.brief)) return false;
|
|
2411
2409
|
return true;
|
|
2412
2410
|
}
|
|
2413
2411
|
function isMissionUpsertRequest(value) {
|
|
2414
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "
|
|
2412
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
|
|
2415
2413
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2416
2414
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2417
2415
|
if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
|
|
2418
2416
|
if (typeof value.title !== "string" || value.title.trim().length === 0) return false;
|
|
2419
2417
|
if (value.goal !== void 0 && typeof value.goal !== "string") return false;
|
|
2420
2418
|
if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
|
|
2421
|
-
if (value.source !== void 0 && !isMeshMissionSourceValue(value.source)) return false;
|
|
2422
2419
|
if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
|
|
2423
2420
|
return true;
|
|
2424
2421
|
}
|
|
@@ -2452,7 +2449,7 @@ function decodeMissionQueryResponse(value) {
|
|
|
2452
2449
|
return isMissionQueryResponse(value) ? value : null;
|
|
2453
2450
|
}
|
|
2454
2451
|
function isMissionListQueryRequest(value) {
|
|
2455
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "
|
|
2452
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
|
|
2456
2453
|
if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
|
|
2457
2454
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
2458
2455
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2461,7 +2458,6 @@ function isMissionListQueryRequest(value) {
|
|
|
2461
2458
|
if (!value.statuses.every(isMeshMissionStatusValue)) return false;
|
|
2462
2459
|
}
|
|
2463
2460
|
if (value.verbose !== void 0 && typeof value.verbose !== "boolean") return false;
|
|
2464
|
-
if (value.includeMagi !== void 0 && typeof value.includeMagi !== "boolean") return false;
|
|
2465
2461
|
if (value.withStats !== void 0 && typeof value.withStats !== "boolean") return false;
|
|
2466
2462
|
if (value.limit !== void 0 && !isNonNegativeInt(value.limit)) return false;
|
|
2467
2463
|
if (value.historyIdLimit !== void 0 && !isNonNegativeInt(value.historyIdLimit)) return false;
|
|
@@ -2494,13 +2490,12 @@ function isMissionListSummaryWire(value) {
|
|
|
2494
2490
|
const hasGoal = "goal" in value;
|
|
2495
2491
|
const hasPreview = "goalPreview" in value && "goalTruncated" in value;
|
|
2496
2492
|
if (hasGoal === hasPreview) return false;
|
|
2497
|
-
const baseKeys = ["id", "meshId", "title", "status", "
|
|
2493
|
+
const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
|
|
2498
2494
|
const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
|
|
2499
2495
|
if (!hasOnlyKeys2(value, allowed)) return false;
|
|
2500
2496
|
if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2501
2497
|
if (typeof value.title !== "string") return false;
|
|
2502
2498
|
if (!isMeshMissionStatusValue(value.status)) return false;
|
|
2503
|
-
if (value.source !== void 0 && !isMeshMissionSourceValue(value.source)) return false;
|
|
2504
2499
|
if (!isMeshMissionTaskAggregateWire(value.tasks)) return false;
|
|
2505
2500
|
if (value.stats !== void 0 && !isMeshMissionStatsWire(value.stats)) return false;
|
|
2506
2501
|
if (value.brief !== void 0 && !isMissionBriefWire(value.brief)) return false;
|
|
@@ -2532,9 +2527,6 @@ function decodeMissionListQueryResponse(value) {
|
|
|
2532
2527
|
}
|
|
2533
2528
|
var OPERATING_NOTE_CATEGORIES = ["provider_quirk", "pattern_to_avoid", "recovery_lesson"];
|
|
2534
2529
|
var isOperatingNoteCategory = makeGuard3(OPERATING_NOTE_CATEGORIES);
|
|
2535
|
-
function isOptionalShortString(value, max = 512) {
|
|
2536
|
-
return value === void 0 || typeof value === "string" && value.trim().length > 0 && value.length <= max;
|
|
2537
|
-
}
|
|
2538
2530
|
function isNoteUpsertRequest(value) {
|
|
2539
2531
|
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "text", "category", "pinned", "expiresAt", "supersedes", "subjectKey", "sourceCoordinator"])) return false;
|
|
2540
2532
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
|
|
@@ -2628,18 +2620,8 @@ function isLedgerQueryResponse(value) {
|
|
|
2628
2620
|
function decodeLedgerQueryResponse(value) {
|
|
2629
2621
|
return isLedgerQueryResponse(value) ? value : null;
|
|
2630
2622
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
}
|
|
2634
|
-
function isOptionalRecord(value) {
|
|
2635
|
-
return value === void 0 || isRecord(value);
|
|
2636
|
-
}
|
|
2637
|
-
function isOptionalBoolean(value) {
|
|
2638
|
-
return value === void 0 || typeof value === "boolean";
|
|
2639
|
-
}
|
|
2640
|
-
function isOptionalString(value) {
|
|
2641
|
-
return value === void 0 || typeof value === "string";
|
|
2642
|
-
}
|
|
2623
|
+
|
|
2624
|
+
// src/turn-ipc-queue.ts
|
|
2643
2625
|
function isQueueEntryWire(value) {
|
|
2644
2626
|
return isRecord(value) && isEvidenceIdentifier(value.id) && typeof value.status === "string";
|
|
2645
2627
|
}
|
|
@@ -2666,7 +2648,7 @@ function decodeQueueQueryRequest(value) {
|
|
|
2666
2648
|
return isQueueQueryRequest(value) ? value : null;
|
|
2667
2649
|
}
|
|
2668
2650
|
function isQueueDependencyHeadWire(value) {
|
|
2669
|
-
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "
|
|
2651
|
+
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
|
|
2670
2652
|
}
|
|
2671
2653
|
function isQueueQueryResponse(value) {
|
|
2672
2654
|
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
@@ -2680,7 +2662,7 @@ function decodeQueueQueryResponse(value) {
|
|
|
2680
2662
|
return isQueueQueryResponse(value) ? value : null;
|
|
2681
2663
|
}
|
|
2682
2664
|
function isQueueEnqueueRequest(value) {
|
|
2683
|
-
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "message", "options"
|
|
2665
|
+
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "message", "options"]) && value.v === TURN_IPC_PROTOCOL_VERSION && isEvidenceIdentifier(value.meshId) && typeof value.message === "string" && isOptionalRecord(value.options);
|
|
2684
2666
|
}
|
|
2685
2667
|
function decodeQueueEnqueueRequest(value) {
|
|
2686
2668
|
return isQueueEnqueueRequest(value) ? value : null;
|
|
@@ -2691,28 +2673,24 @@ function isQueueEnqueueResponse(value) {
|
|
|
2691
2673
|
function decodeQueueEnqueueResponse(value) {
|
|
2692
2674
|
return isQueueEnqueueResponse(value) ? value : null;
|
|
2693
2675
|
}
|
|
2694
|
-
function
|
|
2695
|
-
|
|
2696
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2697
|
-
if (value.mode === "compat") return isRecordArray(value.specs) && value.plan === void 0 && isOptionalRecord(value.audit);
|
|
2698
|
-
if (value.mode === "graph") return isRecord(value.plan) && value.specs === void 0 && isOptionalRecord(value.audit);
|
|
2699
|
-
return false;
|
|
2676
|
+
function isQueueEnqueueBatchRequest(value) {
|
|
2677
|
+
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "specs"]) && value.v === TURN_IPC_PROTOCOL_VERSION && isEvidenceIdentifier(value.meshId) && isRecordArray(value.specs);
|
|
2700
2678
|
}
|
|
2701
|
-
function
|
|
2702
|
-
return
|
|
2679
|
+
function decodeQueueEnqueueBatchRequest(value) {
|
|
2680
|
+
return isQueueEnqueueBatchRequest(value) ? value : null;
|
|
2703
2681
|
}
|
|
2704
|
-
function
|
|
2682
|
+
function isQueueEnqueueBatchResponse(value) {
|
|
2705
2683
|
if (!isRecord(value)) return false;
|
|
2706
2684
|
if (value.ok === true) {
|
|
2707
|
-
return hasOnlyKeys2(value, ["ok", "tasks"
|
|
2685
|
+
return hasOnlyKeys2(value, ["ok", "tasks"]) && Array.isArray(value.tasks) && value.tasks.every(isQueueEntryWire);
|
|
2708
2686
|
}
|
|
2709
2687
|
if (value.ok === false) {
|
|
2710
2688
|
return hasOnlyKeys2(value, ["ok", "refusalCode", "message", "extra"]) && typeof value.message === "string" && isOptionalString(value.refusalCode) && isOptionalRecord(value.extra);
|
|
2711
2689
|
}
|
|
2712
2690
|
return false;
|
|
2713
2691
|
}
|
|
2714
|
-
function
|
|
2715
|
-
return
|
|
2692
|
+
function decodeQueueEnqueueBatchResponse(value) {
|
|
2693
|
+
return isQueueEnqueueBatchResponse(value) ? value : null;
|
|
2716
2694
|
}
|
|
2717
2695
|
function isQueueCancelRequest(value) {
|
|
2718
2696
|
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "taskId", "reason"]) && value.v === TURN_IPC_PROTOCOL_VERSION && isEvidenceIdentifier(value.meshId) && isEvidenceIdentifier(value.taskId) && isOptionalString(value.reason);
|
|
@@ -2739,31 +2717,17 @@ function decodeQueueRequeueResponse(value) {
|
|
|
2739
2717
|
return isQueueRequeueResponse(value) ? value : null;
|
|
2740
2718
|
}
|
|
2741
2719
|
function isDirectDispatchRecordRequest(value) {
|
|
2742
|
-
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "taskId", "message", "task"
|
|
2720
|
+
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "taskId", "message", "task"]) && value.v === TURN_IPC_PROTOCOL_VERSION && isEvidenceIdentifier(value.meshId) && isEvidenceIdentifier(value.taskId) && typeof value.message === "string" && isOptionalRecord(value.task);
|
|
2743
2721
|
}
|
|
2744
2722
|
function decodeDirectDispatchRecordRequest(value) {
|
|
2745
2723
|
return isDirectDispatchRecordRequest(value) ? value : null;
|
|
2746
2724
|
}
|
|
2747
2725
|
function isDirectDispatchRecordResponse(value) {
|
|
2748
|
-
return isRecord(value) && hasOnlyKeys2(value, ["taskRecorded"
|
|
2726
|
+
return isRecord(value) && hasOnlyKeys2(value, ["taskRecorded"]) && typeof value.taskRecorded === "boolean";
|
|
2749
2727
|
}
|
|
2750
2728
|
function decodeDirectDispatchRecordResponse(value) {
|
|
2751
2729
|
return isDirectDispatchRecordResponse(value) ? value : null;
|
|
2752
2730
|
}
|
|
2753
|
-
var GRAPH_AUDIT_EVENTS = ["gate_claimed", "gate_released", "gate_abandoned", "node_patched"];
|
|
2754
|
-
var isGraphAuditEvent = makeGuard3(GRAPH_AUDIT_EVENTS);
|
|
2755
|
-
function isGraphAuditRecordRequest(value) {
|
|
2756
|
-
return isRecord(value) && hasOnlyKeys2(value, ["v", "meshId", "event", "fields"]) && value.v === TURN_IPC_PROTOCOL_VERSION && isEvidenceIdentifier(value.meshId) && isGraphAuditEvent(value.event) && isRecord(value.fields);
|
|
2757
|
-
}
|
|
2758
|
-
function decodeGraphAuditRecordRequest(value) {
|
|
2759
|
-
return isGraphAuditRecordRequest(value) ? value : null;
|
|
2760
|
-
}
|
|
2761
|
-
function isGraphAuditRecordResponse(value) {
|
|
2762
|
-
return isRecord(value) && hasOnlyKeys2(value, ["recorded"]) && typeof value.recorded === "boolean";
|
|
2763
|
-
}
|
|
2764
|
-
function decodeGraphAuditRecordResponse(value) {
|
|
2765
|
-
return isGraphAuditRecordResponse(value) ? value : null;
|
|
2766
|
-
}
|
|
2767
2731
|
function isActiveWorkQueryRequest(value) {
|
|
2768
2732
|
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "nodes", "queue", "recordTail", "includeTerminalDirect", "compute", "includeInputs", "includeSummary", "includeSchedulingRuntime", "mesh"])) return false;
|
|
2769
2733
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2811,122 +2775,8 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
2811
2775
|
function decodeRecoveryContextQueryResponse(value) {
|
|
2812
2776
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
2813
2777
|
}
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.gateId) || !isEvidenceIdentifier(value.coordinatorSessionId)) return false;
|
|
2817
|
-
if (value.leaseSeconds !== void 0 && !isFiniteNumber3(value.leaseSeconds)) return false;
|
|
2818
|
-
if (value.extendDeadlineSeconds !== void 0 && !isFiniteNumber3(value.extendDeadlineSeconds)) return false;
|
|
2819
|
-
return isOptionalBoolean(value.probeConvergenceEvidence);
|
|
2820
|
-
}
|
|
2821
|
-
function decodeGraphGateClaimRequest(value) {
|
|
2822
|
-
return isGraphGateClaimRequest(value) ? value : null;
|
|
2823
|
-
}
|
|
2824
|
-
function isGraphGateClaimResponse(value) {
|
|
2825
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["claimed", "reason", "gate", "leaseGeneration", "fencingToken", "leaseExpiresAt", "deadlineAt", "ambiguousExternalOutcome", "previousLeaseOwnerSessionId", "convergenceEvidence"])) return false;
|
|
2826
|
-
if (typeof value.claimed !== "boolean") return false;
|
|
2827
|
-
return isOptionalRecord(value.gate) && isOptionalRecord(value.convergenceEvidence) && isOptionalBoolean(value.ambiguousExternalOutcome);
|
|
2828
|
-
}
|
|
2829
|
-
function decodeGraphGateClaimResponse(value) {
|
|
2830
|
-
return isGraphGateClaimResponse(value) ? value : null;
|
|
2831
|
-
}
|
|
2832
|
-
function isGraphGateReleaseRequest(value) {
|
|
2833
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "gateId", "fencingToken", "leaseGeneration", "idempotencyKey", "outcome", "result", "evidence", "patches"])) return false;
|
|
2834
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.gateId)) return false;
|
|
2835
|
-
if (typeof value.fencingToken !== "string" || !value.fencingToken) return false;
|
|
2836
|
-
if (!isFiniteNumber3(value.leaseGeneration)) return false;
|
|
2837
|
-
if (typeof value.idempotencyKey !== "string" || !value.idempotencyKey) return false;
|
|
2838
|
-
if (typeof value.outcome !== "string" || !value.outcome) return false;
|
|
2839
|
-
if (value.patches !== void 0) {
|
|
2840
|
-
if (!Array.isArray(value.patches)) return false;
|
|
2841
|
-
for (const p of value.patches) {
|
|
2842
|
-
if (!isRecord(p) || typeof p.node !== "string" || !p.node || !isRecord(p.baseSpecPatch)) return false;
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
return true;
|
|
2846
|
-
}
|
|
2847
|
-
function decodeGraphGateReleaseRequest(value) {
|
|
2848
|
-
return isGraphGateReleaseRequest(value) ? value : null;
|
|
2849
|
-
}
|
|
2850
|
-
function isGraphGateReleaseResponse(value) {
|
|
2851
|
-
if (!isRecord(value)) return false;
|
|
2852
|
-
if (value.released === true) {
|
|
2853
|
-
if (!hasOnlyKeys2(value, ["released", "duplicate", "gate", "materializedNodeIds", "downstreamNodeCount", "graphCompleted"])) return false;
|
|
2854
|
-
if (typeof value.duplicate !== "boolean") return false;
|
|
2855
|
-
if (!Array.isArray(value.materializedNodeIds) || !value.materializedNodeIds.every((n) => typeof n === "string")) return false;
|
|
2856
|
-
if (value.downstreamNodeCount !== void 0 && !isNonNegativeInt(value.downstreamNodeCount)) return false;
|
|
2857
|
-
return isOptionalRecord(value.gate) && isOptionalBoolean(value.graphCompleted);
|
|
2858
|
-
}
|
|
2859
|
-
if (value.released === false) {
|
|
2860
|
-
return hasOnlyKeys2(value, ["released", "refusalCode", "message"]) && typeof value.message === "string" && isOptionalString(value.refusalCode);
|
|
2861
|
-
}
|
|
2862
|
-
return false;
|
|
2863
|
-
}
|
|
2864
|
-
function decodeGraphGateReleaseResponse(value) {
|
|
2865
|
-
return isGraphGateReleaseResponse(value) ? value : null;
|
|
2866
|
-
}
|
|
2867
|
-
function isGraphGateAbandonRequest(value) {
|
|
2868
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "gateId", "reason", "coordinatorSessionId", "force"])) return false;
|
|
2869
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.gateId)) return false;
|
|
2870
|
-
if (typeof value.reason !== "string" || !value.reason) return false;
|
|
2871
|
-
if (value.coordinatorSessionId !== void 0 && !isEvidenceIdentifier(value.coordinatorSessionId)) return false;
|
|
2872
|
-
return isOptionalBoolean(value.force);
|
|
2873
|
-
}
|
|
2874
|
-
function decodeGraphGateAbandonRequest(value) {
|
|
2875
|
-
return isGraphGateAbandonRequest(value) ? value : null;
|
|
2876
|
-
}
|
|
2877
|
-
function isGraphGateAbandonResponse(value) {
|
|
2878
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["abandoned", "reason", "gate", "cancelledNodeIds", "cancelledTaskIds", "graphStatus"])) return false;
|
|
2879
|
-
if (typeof value.abandoned !== "boolean") return false;
|
|
2880
|
-
if (!Array.isArray(value.cancelledNodeIds) || !value.cancelledNodeIds.every((n) => typeof n === "string")) return false;
|
|
2881
|
-
if (!Array.isArray(value.cancelledTaskIds) || !value.cancelledTaskIds.every((n) => typeof n === "string")) return false;
|
|
2882
|
-
return isOptionalRecord(value.gate);
|
|
2883
|
-
}
|
|
2884
|
-
function decodeGraphGateAbandonResponse(value) {
|
|
2885
|
-
return isGraphGateAbandonResponse(value) ? value : null;
|
|
2886
|
-
}
|
|
2887
|
-
function isGraphNodePatchRequest(value) {
|
|
2888
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "node", "graphId", "baseSpecPatch"])) return false;
|
|
2889
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2890
|
-
if (typeof value.node !== "string" || !value.node) return false;
|
|
2891
|
-
if (value.graphId !== void 0 && !isEvidenceIdentifier(value.graphId)) return false;
|
|
2892
|
-
return isRecord(value.baseSpecPatch) && Object.keys(value.baseSpecPatch).length > 0;
|
|
2893
|
-
}
|
|
2894
|
-
function decodeGraphNodePatchRequest(value) {
|
|
2895
|
-
return isGraphNodePatchRequest(value) ? value : null;
|
|
2896
|
-
}
|
|
2897
|
-
function isGraphNodePatchResponse(value) {
|
|
2898
|
-
if (!isRecord(value)) return false;
|
|
2899
|
-
if (value.patched === true) {
|
|
2900
|
-
if (!hasOnlyKeys2(value, ["patched", "graphId", "nodeId", "ref", "queueTaskId", "materializationVersion", "state", "outcomeKind", "skippedReason", "blockedReason"])) return false;
|
|
2901
|
-
if (!isEvidenceIdentifier(value.graphId) || !isEvidenceIdentifier(value.nodeId)) return false;
|
|
2902
|
-
if (!isNonNegativeInt(value.materializationVersion)) return false;
|
|
2903
|
-
return typeof value.state === "string" && typeof value.outcomeKind === "string";
|
|
2904
|
-
}
|
|
2905
|
-
if (value.patched === false) {
|
|
2906
|
-
return hasOnlyKeys2(value, ["patched", "refusalCode", "message"]) && typeof value.message === "string" && isOptionalString(value.refusalCode);
|
|
2907
|
-
}
|
|
2908
|
-
return false;
|
|
2909
|
-
}
|
|
2910
|
-
function decodeGraphNodePatchResponse(value) {
|
|
2911
|
-
return isGraphNodePatchResponse(value) ? value : null;
|
|
2912
|
-
}
|
|
2913
|
-
function isGraphViewQueryRequest(value) {
|
|
2914
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "graphId", "batchId", "activeOnly", "limit", "probeGateEvidence"])) return false;
|
|
2915
|
-
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId)) return false;
|
|
2916
|
-
if (value.graphId !== void 0 && !isEvidenceIdentifier(value.graphId)) return false;
|
|
2917
|
-
if (value.batchId !== void 0 && !isEvidenceIdentifier(value.batchId)) return false;
|
|
2918
|
-
if (value.limit !== void 0 && !isNonNegativeInt(value.limit)) return false;
|
|
2919
|
-
return isOptionalBoolean(value.activeOnly) && isOptionalBoolean(value.probeGateEvidence);
|
|
2920
|
-
}
|
|
2921
|
-
function decodeGraphViewQueryRequest(value) {
|
|
2922
|
-
return isGraphViewQueryRequest(value) ? value : null;
|
|
2923
|
-
}
|
|
2924
|
-
function isGraphViewQueryResponse(value) {
|
|
2925
|
-
return isRecord(value) && hasOnlyKeys2(value, ["graphs"]) && isRecordArray(value.graphs);
|
|
2926
|
-
}
|
|
2927
|
-
function decodeGraphViewQueryResponse(value) {
|
|
2928
|
-
return isGraphViewQueryResponse(value) ? value : null;
|
|
2929
|
-
}
|
|
2778
|
+
|
|
2779
|
+
// src/turn-ipc-stats.ts
|
|
2930
2780
|
function isTaskStatsQueryRequest(value) {
|
|
2931
2781
|
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskIds", "missionId", "tail", "rollup", "missionIds"])) return false;
|
|
2932
2782
|
if (value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId)) return false;
|
|
@@ -2994,6 +2844,13 @@ function isOrphanedPinNotifyResponse(value) {
|
|
|
2994
2844
|
function decodeOrphanedPinNotifyResponse(value) {
|
|
2995
2845
|
return isOrphanedPinNotifyResponse(value) ? value : null;
|
|
2996
2846
|
}
|
|
2847
|
+
|
|
2848
|
+
// src/turn-ipc.ts
|
|
2849
|
+
var TURN_IPC_ERROR_CODES = ["daemon_required", "turn_ledger_unavailable", "ledger_not_owner"];
|
|
2850
|
+
var isTurnIpcErrorCode = makeGuard3(TURN_IPC_ERROR_CODES);
|
|
2851
|
+
function isTurnIpcError(value) {
|
|
2852
|
+
return isRecord(value) && hasOnlyKeys2(value, ["code", "detail"]) && isTurnIpcErrorCode(value.code) && (value.detail === void 0 || typeof value.detail === "string");
|
|
2853
|
+
}
|
|
2997
2854
|
var TURN_IPC_COMMANDS = [
|
|
2998
2855
|
"turn_observe",
|
|
2999
2856
|
"mesh_record",
|
|
@@ -3013,21 +2870,15 @@ var TURN_IPC_COMMANDS = [
|
|
|
3013
2870
|
"record_local",
|
|
3014
2871
|
"queue_query",
|
|
3015
2872
|
"queue_enqueue",
|
|
3016
|
-
"
|
|
2873
|
+
"queue_enqueue_batch",
|
|
3017
2874
|
"queue_cancel",
|
|
3018
2875
|
"queue_requeue",
|
|
3019
2876
|
"direct_dispatch_record",
|
|
3020
|
-
"graph_audit_record",
|
|
3021
2877
|
"active_work_query",
|
|
3022
2878
|
"recovery_context_query",
|
|
3023
2879
|
// C-W9c additions (2026-09-24 19:00 stamp — the last mcp-server in-process
|
|
3024
|
-
// daemon-core paths:
|
|
3025
|
-
//
|
|
3026
|
-
"graph_gate_claim",
|
|
3027
|
-
"graph_gate_release",
|
|
3028
|
-
"graph_gate_abandon",
|
|
3029
|
-
"graph_node_patch",
|
|
3030
|
-
"graph_view_query",
|
|
2880
|
+
// daemon-core paths: mission reads, task/mission stats, orphaned-pin
|
|
2881
|
+
// helpers, one prune audit):
|
|
3031
2882
|
"task_stats_query",
|
|
3032
2883
|
"prune_stale_direct",
|
|
3033
2884
|
"orphaned_pin_notify"
|
|
@@ -3476,10 +3327,8 @@ export {
|
|
|
3476
3327
|
DISPATCH_FAILURE_REASONS,
|
|
3477
3328
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3478
3329
|
EVIDENCE_SOURCE_IDS,
|
|
3479
|
-
GRAPH_AUDIT_EVENTS,
|
|
3480
3330
|
HOLD_REASONS,
|
|
3481
3331
|
LIVENESS_RESULTS,
|
|
3482
|
-
MAGI_RAW_ANSWER_CAP,
|
|
3483
3332
|
MAX_MESH_RECORD_STRING,
|
|
3484
3333
|
MAX_OWNED_PATHS,
|
|
3485
3334
|
MESH_CHUNK_KIND,
|
|
@@ -3490,7 +3339,6 @@ export {
|
|
|
3490
3339
|
MESH_MAX_CHUNKS,
|
|
3491
3340
|
MESH_MAX_INLINE_FRAME_BYTES,
|
|
3492
3341
|
MESH_MAX_REASSEMBLED_BYTES,
|
|
3493
|
-
MESH_MISSION_SOURCES,
|
|
3494
3342
|
MESH_MISSION_STATUSES,
|
|
3495
3343
|
MESH_P2P_SIGNAL_TYPES,
|
|
3496
3344
|
MESH_RECORD_PAYLOAD_KEYS,
|
|
@@ -3524,6 +3372,7 @@ export {
|
|
|
3524
3372
|
RECENT_SESSION_BUCKETS,
|
|
3525
3373
|
RECLAIMING_SEND_REFUSALS,
|
|
3526
3374
|
RELEASE_CHANNELS,
|
|
3375
|
+
REMOVED_MESH_TOOLS,
|
|
3527
3376
|
RETIRED_MESH_TOOLS,
|
|
3528
3377
|
SEND_POLICY_MODES,
|
|
3529
3378
|
SEND_REFUSAL_REASONS,
|
|
@@ -3567,7 +3416,6 @@ export {
|
|
|
3567
3416
|
WORKER_TOOLS,
|
|
3568
3417
|
appendWorkerProtocolFooter,
|
|
3569
3418
|
argsCarryStatusProbeMarker,
|
|
3570
|
-
buildMagiPanelProposal,
|
|
3571
3419
|
buildSlotProposal,
|
|
3572
3420
|
canonicalDaemonId,
|
|
3573
3421
|
classifySessionStatus,
|
|
@@ -3583,18 +3431,6 @@ export {
|
|
|
3583
3431
|
decodeDashboardToUserSession,
|
|
3584
3432
|
decodeDirectDispatchRecordRequest,
|
|
3585
3433
|
decodeDirectDispatchRecordResponse,
|
|
3586
|
-
decodeGraphAuditRecordRequest,
|
|
3587
|
-
decodeGraphAuditRecordResponse,
|
|
3588
|
-
decodeGraphGateAbandonRequest,
|
|
3589
|
-
decodeGraphGateAbandonResponse,
|
|
3590
|
-
decodeGraphGateClaimRequest,
|
|
3591
|
-
decodeGraphGateClaimResponse,
|
|
3592
|
-
decodeGraphGateReleaseRequest,
|
|
3593
|
-
decodeGraphGateReleaseResponse,
|
|
3594
|
-
decodeGraphNodePatchRequest,
|
|
3595
|
-
decodeGraphNodePatchResponse,
|
|
3596
|
-
decodeGraphViewQueryRequest,
|
|
3597
|
-
decodeGraphViewQueryResponse,
|
|
3598
3434
|
decodeLedgerQueryRequest,
|
|
3599
3435
|
decodeLedgerQueryResponse,
|
|
3600
3436
|
decodeMeshIndexQueryRequest,
|
|
@@ -3619,8 +3455,8 @@ export {
|
|
|
3619
3455
|
decodePruneStaleDirectResponse,
|
|
3620
3456
|
decodeQueueCancelRequest,
|
|
3621
3457
|
decodeQueueCancelResponse,
|
|
3622
|
-
|
|
3623
|
-
|
|
3458
|
+
decodeQueueEnqueueBatchRequest,
|
|
3459
|
+
decodeQueueEnqueueBatchResponse,
|
|
3624
3460
|
decodeQueueEnqueueRequest,
|
|
3625
3461
|
decodeQueueEnqueueResponse,
|
|
3626
3462
|
decodeQueueQueryRequest,
|
|
@@ -3659,8 +3495,6 @@ export {
|
|
|
3659
3495
|
hasGitStatusEvidence,
|
|
3660
3496
|
hasWorkerProtocolFooter,
|
|
3661
3497
|
interpolateString,
|
|
3662
|
-
isActiveWorkQueryRequest,
|
|
3663
|
-
isActiveWorkQueryResponse,
|
|
3664
3498
|
isBlockedStatus,
|
|
3665
3499
|
isBusyStatus,
|
|
3666
3500
|
isChunkType,
|
|
@@ -3676,38 +3510,16 @@ export {
|
|
|
3676
3510
|
isDashboardToDaemonP2PType,
|
|
3677
3511
|
isDashboardToUserSessionType,
|
|
3678
3512
|
isDeadStatus,
|
|
3679
|
-
isDirectDispatchRecordRequest,
|
|
3680
|
-
isDirectDispatchRecordResponse,
|
|
3681
3513
|
isDowngrade,
|
|
3682
3514
|
isEvidenceIdentifier,
|
|
3683
3515
|
isFiniteNumber,
|
|
3684
|
-
isGraphAuditEvent,
|
|
3685
|
-
isGraphAuditRecordRequest,
|
|
3686
|
-
isGraphAuditRecordResponse,
|
|
3687
|
-
isGraphGateAbandonRequest,
|
|
3688
|
-
isGraphGateAbandonResponse,
|
|
3689
|
-
isGraphGateClaimRequest,
|
|
3690
|
-
isGraphGateClaimResponse,
|
|
3691
|
-
isGraphGateReleaseRequest,
|
|
3692
|
-
isGraphGateReleaseResponse,
|
|
3693
|
-
isGraphNodePatchRequest,
|
|
3694
|
-
isGraphNodePatchResponse,
|
|
3695
|
-
isGraphViewQueryRequest,
|
|
3696
|
-
isGraphViewQueryResponse,
|
|
3697
3516
|
isIdleSessionState,
|
|
3698
3517
|
isInputEnvelopeWire,
|
|
3699
|
-
isLedgerQueryRequest,
|
|
3700
|
-
isLedgerQueryResponse,
|
|
3701
3518
|
isMeshDeliveryMode,
|
|
3702
|
-
isMeshIndexQueryRequest,
|
|
3703
3519
|
isMeshIndexQueryResponse,
|
|
3704
|
-
isMeshIndexQueryWriterScope,
|
|
3705
|
-
isMeshMissionSourceValue,
|
|
3706
3520
|
isMeshMissionStatusValue,
|
|
3707
3521
|
isMeshP2PSignalType,
|
|
3708
3522
|
isMeshRecordPayload,
|
|
3709
|
-
isMeshRecordRequest,
|
|
3710
|
-
isMeshRecordResponse,
|
|
3711
3523
|
isMeshTaskDifficulty,
|
|
3712
3524
|
isMeshTaskMode,
|
|
3713
3525
|
isMeshTaskPriority,
|
|
@@ -3715,49 +3527,17 @@ export {
|
|
|
3715
3527
|
isMeshTerminalTaskStatus,
|
|
3716
3528
|
isMeshTopicEntry,
|
|
3717
3529
|
isMessageId,
|
|
3718
|
-
isMissionListQueryRequest,
|
|
3719
|
-
isMissionListQueryResponse,
|
|
3720
|
-
isMissionQueryRequest,
|
|
3721
|
-
isMissionQueryResponse,
|
|
3722
|
-
isMissionUpsertRequest,
|
|
3723
3530
|
isMissionUpsertResponse,
|
|
3724
3531
|
isModelAxisSource,
|
|
3725
3532
|
isNonEmptyString,
|
|
3726
|
-
isNoteForgetRequest,
|
|
3727
|
-
isNoteForgetResponse,
|
|
3728
|
-
isNoteUpsertRequest,
|
|
3729
|
-
isNoteUpsertResponse,
|
|
3730
3533
|
isNotifyKind,
|
|
3731
|
-
isOperatingNoteCategory,
|
|
3732
|
-
isOperatorStatusReasonValue,
|
|
3733
|
-
isOperatorStatusRequest,
|
|
3734
|
-
isOperatorStatusResponse,
|
|
3735
|
-
isOperatorStatusValue,
|
|
3736
|
-
isOrphanedPinNotifyRequest,
|
|
3737
|
-
isOrphanedPinNotifyResponse,
|
|
3738
3534
|
isOutboundMessage,
|
|
3739
3535
|
isOutboundMessageOrigin,
|
|
3740
3536
|
isP2PSignalType,
|
|
3741
3537
|
isPhantomDaemonEntry,
|
|
3742
|
-
isPruneStaleDirectRequest,
|
|
3743
|
-
isPruneStaleDirectResponse,
|
|
3744
|
-
isQueueCancelRequest,
|
|
3745
|
-
isQueueCancelResponse,
|
|
3746
|
-
isQueueEnqueueGraphRequest,
|
|
3747
|
-
isQueueEnqueueGraphResponse,
|
|
3748
|
-
isQueueEnqueueRequest,
|
|
3749
|
-
isQueueEnqueueResponse,
|
|
3750
|
-
isQueueQueryRequest,
|
|
3751
|
-
isQueueQueryResponse,
|
|
3752
|
-
isQueueRequeueRequest,
|
|
3753
|
-
isQueueRequeueResponse,
|
|
3754
3538
|
isRawDaemonDoId,
|
|
3755
3539
|
isReadyStatus,
|
|
3756
3540
|
isRecord,
|
|
3757
|
-
isRecordLocalRequest,
|
|
3758
|
-
isRecordLocalResponse,
|
|
3759
|
-
isRecoveryContextQueryRequest,
|
|
3760
|
-
isRecoveryContextQueryResponse,
|
|
3761
3541
|
isSendPolicy,
|
|
3762
3542
|
isSendPolicyMode,
|
|
3763
3543
|
isSendRefusal,
|
|
@@ -3768,26 +3548,14 @@ export {
|
|
|
3768
3548
|
isSharedSessionToViewerType,
|
|
3769
3549
|
isSubmitOutcome,
|
|
3770
3550
|
isSummaryRef,
|
|
3771
|
-
isTaskStatsQueryRequest,
|
|
3772
|
-
isTaskStatsQueryResponse,
|
|
3773
3551
|
isTerminalSessionRecordStatus,
|
|
3774
|
-
isToolCallRecordRequest,
|
|
3775
|
-
isToolCallRecordResponse,
|
|
3776
|
-
isToolCallerRole,
|
|
3777
3552
|
isTurnAttemptRef,
|
|
3778
|
-
isTurnCancelRequest,
|
|
3779
|
-
isTurnCancelResponse,
|
|
3780
3553
|
isTurnEvidence,
|
|
3781
3554
|
isTurnEvidenceKind,
|
|
3782
3555
|
isTurnIpcCommand,
|
|
3783
3556
|
isTurnIpcError,
|
|
3784
3557
|
isTurnIpcErrorCode,
|
|
3785
|
-
isTurnObserveRequest,
|
|
3786
|
-
isTurnObserveResponse,
|
|
3787
|
-
isTurnObserveVerdict,
|
|
3788
3558
|
isTurnOutcome,
|
|
3789
|
-
isTurnQueryRequest,
|
|
3790
|
-
isTurnQueryResponse,
|
|
3791
3559
|
isTurnReason,
|
|
3792
3560
|
isUserSessionToDashboardType,
|
|
3793
3561
|
isViewerToSharedSessionType,
|
|
@@ -3823,14 +3591,17 @@ export {
|
|
|
3823
3591
|
parseSessionLaunchRecord,
|
|
3824
3592
|
pathsOverlap,
|
|
3825
3593
|
pickBestTransitGitStatus,
|
|
3594
|
+
projectFileDiffRow,
|
|
3826
3595
|
projectTurnEvidenceEntry,
|
|
3827
3596
|
readBoolean,
|
|
3828
3597
|
readEnvelopeFields,
|
|
3829
3598
|
readGitSubmodules,
|
|
3830
3599
|
readNumber,
|
|
3600
|
+
readOptionalRecord,
|
|
3831
3601
|
readRecord,
|
|
3832
3602
|
readString,
|
|
3833
3603
|
readStringArray,
|
|
3604
|
+
readText,
|
|
3834
3605
|
renderCoordinatorWorkerSection,
|
|
3835
3606
|
renderMissionBriefBlock,
|
|
3836
3607
|
renderWorkerProtocolFooter,
|