@adhdev/mesh-shared 1.0.82-rc.26 → 1.0.82-rc.29
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/assistant-protocol.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +38 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -13
- package/dist/index.mjs.map +1 -1
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/mesh-vocabulary.d.ts +6 -4
- package/dist/node-facts.d.ts +1 -1
- package/dist/task-source-phase.d.ts +75 -0
- package/dist/turn-evidence.d.ts +4 -4
- package/dist/turn-ipc-mission.d.ts +4 -0
- package/dist/turn-ipc-queue.d.ts +19 -0
- package/dist/turn-ipc.d.ts +2 -2
- package/package.json +1 -1
- package/src/assistant-protocol.ts +4 -0
- package/src/daemon-normalize.ts +7 -5
- package/src/index.ts +1 -0
- package/src/mesh-tool-names.ts +1 -0
- package/src/mesh-vocabulary.ts +4 -2
- package/src/node-facts.ts +1 -1
- package/src/quota-freshness.ts +8 -5
- package/src/task-source-phase.ts +61 -0
- package/src/turn-evidence.ts +2 -2
- package/src/turn-ipc-mission.ts +8 -2
- package/src/turn-ipc-queue.ts +29 -1
- package/src/turn-ipc-turn.ts +1 -1
- package/src/turn-ipc.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -325,8 +325,10 @@ function backfillCheckAt(quota, now) {
|
|
|
325
325
|
function assessQuotaFreshness(quota, now = Date.now()) {
|
|
326
326
|
const meta = quota.metadata;
|
|
327
327
|
const kind = meta?.failureKind;
|
|
328
|
-
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli"
|
|
328
|
+
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
|
|
329
|
+
const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
|
|
329
330
|
if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
|
|
331
|
+
if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
|
|
330
332
|
if (meta?.lastGoodWindows !== true) {
|
|
331
333
|
const measuredAt = finiteMs(quota.updatedAt);
|
|
332
334
|
if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
|
|
@@ -373,19 +375,21 @@ function isPhantomDaemonEntry(entry) {
|
|
|
373
375
|
function machineCoreFromDaemonId(id2) {
|
|
374
376
|
const trimmed = readString(id2);
|
|
375
377
|
if (!trimmed) return void 0;
|
|
378
|
+
const lower = trimmed.toLowerCase();
|
|
376
379
|
for (const prefix of DAEMON_ID_PREFIXES) {
|
|
377
|
-
if (
|
|
380
|
+
if (lower.startsWith(prefix)) {
|
|
378
381
|
const core = trimmed.slice(prefix.length).trim();
|
|
379
|
-
|
|
382
|
+
if (!core) return void 0;
|
|
383
|
+
return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
|
-
return trimmed;
|
|
386
|
+
return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
|
|
383
387
|
}
|
|
384
388
|
function canonicalDaemonId(id2) {
|
|
385
389
|
const core = machineCoreFromDaemonId(id2);
|
|
386
390
|
if (!core) return void 0;
|
|
387
|
-
if (
|
|
388
|
-
return `
|
|
391
|
+
if (!/^mach_/i.test(core)) return core;
|
|
392
|
+
return `daemon_mach_${core.slice(5)}`;
|
|
389
393
|
}
|
|
390
394
|
function daemonIdsEquivalent(a, b) {
|
|
391
395
|
const coreA = machineCoreFromDaemonId(a);
|
|
@@ -752,6 +756,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
752
756
|
"mesh_view_queue",
|
|
753
757
|
"mesh_queue_cancel",
|
|
754
758
|
"mesh_queue_requeue",
|
|
759
|
+
"mesh_queue_revise",
|
|
755
760
|
"mesh_send_task",
|
|
756
761
|
"mesh_read_chat",
|
|
757
762
|
"mesh_read_debug",
|
|
@@ -1473,8 +1478,8 @@ function isIdleSessionState(state) {
|
|
|
1473
1478
|
}
|
|
1474
1479
|
|
|
1475
1480
|
// src/mesh-vocabulary.ts
|
|
1476
|
-
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
|
|
1477
|
-
var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
|
|
1481
|
+
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
|
|
1482
|
+
var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
|
|
1478
1483
|
var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
1479
1484
|
var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
|
|
1480
1485
|
var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
@@ -1995,7 +2000,7 @@ var HOLD_REASONS = [
|
|
|
1995
2000
|
"await_end",
|
|
1996
2001
|
"report_correction"
|
|
1997
2002
|
];
|
|
1998
|
-
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2003
|
+
var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
|
|
1999
2004
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
2000
2005
|
var TURN_REASONS = [
|
|
2001
2006
|
// commits
|
|
@@ -2040,6 +2045,7 @@ var TURN_REASONS = [
|
|
|
2040
2045
|
];
|
|
2041
2046
|
var NOTIFY_KINDS = [
|
|
2042
2047
|
"completed",
|
|
2048
|
+
"blocked",
|
|
2043
2049
|
"failed",
|
|
2044
2050
|
"cancelled",
|
|
2045
2051
|
"stopped",
|
|
@@ -2533,7 +2539,7 @@ function isTurnAttemptRefValue(value) {
|
|
|
2533
2539
|
function isTurnObserveResponse(value) {
|
|
2534
2540
|
return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
|
|
2535
2541
|
}
|
|
2536
|
-
var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
|
|
2542
|
+
var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
|
|
2537
2543
|
function isTurnOutcomeValue(value) {
|
|
2538
2544
|
return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
|
|
2539
2545
|
}
|
|
@@ -2834,12 +2840,13 @@ function isMeshMissionTaskAggregateWire(value) {
|
|
|
2834
2840
|
return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
|
|
2835
2841
|
}
|
|
2836
2842
|
function isMeshMissionStatsWire(value) {
|
|
2837
|
-
const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2843
|
+
const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2838
2844
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2839
2845
|
if (!isEvidenceIdentifier(value.missionId)) return false;
|
|
2840
2846
|
for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
|
|
2841
2847
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2842
2848
|
}
|
|
2849
|
+
if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
|
|
2843
2850
|
if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
|
|
2844
2851
|
if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
|
|
2845
2852
|
return true;
|
|
@@ -2961,12 +2968,13 @@ function isLedgerQueryEntryWire(value) {
|
|
|
2961
2968
|
return true;
|
|
2962
2969
|
}
|
|
2963
2970
|
function isLedgerQuerySummaryWire(value) {
|
|
2964
|
-
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
2971
|
+
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
2965
2972
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2966
2973
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
2967
2974
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
2968
2975
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2969
2976
|
}
|
|
2977
|
+
if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
|
|
2970
2978
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
2971
2979
|
return true;
|
|
2972
2980
|
}
|
|
@@ -3010,9 +3018,10 @@ function isQueueDependencyHeadWire(value) {
|
|
|
3010
3018
|
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
|
|
3011
3019
|
}
|
|
3012
3020
|
function isQueueQueryResponse(value) {
|
|
3013
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
3021
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
|
|
3014
3022
|
if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
|
|
3015
3023
|
if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
|
|
3024
|
+
if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
|
|
3016
3025
|
if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
|
|
3017
3026
|
if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
|
|
3018
3027
|
return true;
|
|
@@ -3134,6 +3143,17 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
3134
3143
|
function decodeRecoveryContextQueryResponse(value) {
|
|
3135
3144
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
3136
3145
|
}
|
|
3146
|
+
function decodeQueueReviseRequest(value) {
|
|
3147
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskId", "expectedRevision", "patch"]) || value.v !== TURN_IPC_PROTOCOL_VERSION || !isEvidenceIdentifier(value.meshId) || !isEvidenceIdentifier(value.taskId) || !Number.isSafeInteger(value.expectedRevision) || value.expectedRevision < 0 || !isRecord(value.patch) || !Object.keys(value.patch).length || !hasOnlyKeys2(value.patch, ["message", "ownedPaths", "phase", "dependsOn", "routingPreferences", "review"])) return null;
|
|
3148
|
+
const p = value.patch;
|
|
3149
|
+
if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
|
|
3150
|
+
if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
|
|
3151
|
+
for (const key of ["ownedPaths", "dependsOn"]) {
|
|
3152
|
+
if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
|
|
3153
|
+
}
|
|
3154
|
+
return value;
|
|
3155
|
+
}
|
|
3156
|
+
var decodeQueueReviseResponse = decodeQueueRequeueResponse;
|
|
3137
3157
|
|
|
3138
3158
|
// src/turn-ipc-stats.ts
|
|
3139
3159
|
function isTaskStatsQueryRequest(value) {
|
|
@@ -3232,6 +3252,7 @@ var TURN_IPC_COMMANDS = [
|
|
|
3232
3252
|
"queue_enqueue_batch",
|
|
3233
3253
|
"queue_cancel",
|
|
3234
3254
|
"queue_requeue",
|
|
3255
|
+
"queue_revise",
|
|
3235
3256
|
"direct_dispatch_record",
|
|
3236
3257
|
"active_work_query",
|
|
3237
3258
|
"recovery_context_query",
|
|
@@ -3920,6 +3941,8 @@ export {
|
|
|
3920
3941
|
decodeQueueQueryResponse,
|
|
3921
3942
|
decodeQueueRequeueRequest,
|
|
3922
3943
|
decodeQueueRequeueResponse,
|
|
3944
|
+
decodeQueueReviseRequest,
|
|
3945
|
+
decodeQueueReviseResponse,
|
|
3923
3946
|
decodeRecordLocalRequest,
|
|
3924
3947
|
decodeRecordLocalResponse,
|
|
3925
3948
|
decodeRecoveryContextQueryRequest,
|