@adhdev/mesh-shared 1.0.82-rc.3 → 1.0.82-rc.31
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 +140 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.js +529 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +500 -110
- package/dist/index.mjs.map +1 -1
- package/dist/launch-defaults.d.ts +194 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/mesh-vocabulary.d.ts +13 -4
- package/dist/node-facts.d.ts +41 -1
- package/dist/outbound-message.d.ts +7 -0
- package/dist/path-ownership.d.ts +1 -1
- package/dist/protocol/daemon-server.d.ts +9 -0
- package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
- package/dist/protocol/dashboard-server.d.ts +10 -0
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -0
- package/dist/quota-freshness.d.ts +65 -0
- package/dist/role-launch.d.ts +11 -0
- package/dist/session-launch.d.ts +3 -22
- package/dist/slot-proposal.d.ts +14 -0
- package/dist/task-source-phase.d.ts +75 -0
- package/dist/turn-evidence.d.ts +24 -12
- 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/dist/types.d.ts +1 -0
- package/dist/worker-protocol.d.ts +1 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +247 -6
- package/src/daemon-normalize.ts +7 -5
- package/src/index.ts +7 -0
- package/src/keyed-doc-delta.ts +9 -1
- package/src/launch-defaults.ts +168 -0
- package/src/mesh-tool-names.ts +5 -0
- package/src/mesh-vocabulary.ts +12 -2
- package/src/node-facts.ts +36 -1
- package/src/outbound-message.ts +17 -0
- package/src/path-ownership.ts +4 -6
- package/src/protocol/daemon-server.ts +7 -2
- package/src/protocol/dashboard-server.ts +8 -2
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +139 -0
- package/src/role-launch.ts +51 -0
- package/src/session-launch.ts +8 -1
- package/src/slot-proposal.ts +61 -2
- package/src/task-source-phase.ts +61 -0
- package/src/turn-evidence.ts +22 -19
- 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/src/types.ts +1 -0
- package/src/worker-protocol.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -20,7 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ASSISTANT_ACCOUNT_SLOT: () => ASSISTANT_ACCOUNT_SLOT,
|
|
24
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS: () => ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
23
25
|
ASSISTANT_OWNER_VERBS: () => ASSISTANT_OWNER_VERBS,
|
|
26
|
+
ASSISTANT_REMOTE_FOLLOW_COMMAND: () => ASSISTANT_REMOTE_FOLLOW_COMMAND,
|
|
27
|
+
ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND: () => ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
|
|
28
|
+
ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND: () => ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
|
|
29
|
+
ASSISTANT_REMOTE_PROJECT_COMMAND: () => ASSISTANT_REMOTE_PROJECT_COMMAND,
|
|
24
30
|
ASSISTANT_REVIEW_TURN_VERBS: () => ASSISTANT_REVIEW_TURN_VERBS,
|
|
25
31
|
ASSISTANT_SESSION_ID_ARG: () => ASSISTANT_SESSION_ID_ARG,
|
|
26
32
|
ASSISTANT_SESSION_ID_ENV: () => ASSISTANT_SESSION_ID_ENV,
|
|
@@ -57,6 +63,10 @@ __export(index_exports, {
|
|
|
57
63
|
EVIDENCE_ENVELOPE_FIELD_SPECS: () => EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
58
64
|
EVIDENCE_SOURCE_IDS: () => EVIDENCE_SOURCE_IDS,
|
|
59
65
|
HOLD_REASONS: () => HOLD_REASONS,
|
|
66
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE: () => LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
67
|
+
LAUNCH_DEFAULT_ERROR_CODES: () => LAUNCH_DEFAULT_ERROR_CODES,
|
|
68
|
+
LAUNCH_DEFAULT_ROLES: () => LAUNCH_DEFAULT_ROLES,
|
|
69
|
+
LAUNCH_DEFAULT_SOURCES: () => LAUNCH_DEFAULT_SOURCES,
|
|
60
70
|
LIVENESS_RESULTS: () => LIVENESS_RESULTS,
|
|
61
71
|
MAX_MESH_RECORD_STRING: () => MAX_MESH_RECORD_STRING,
|
|
62
72
|
MAX_OWNED_PATHS: () => MAX_OWNED_PATHS,
|
|
@@ -97,6 +107,8 @@ __export(index_exports, {
|
|
|
97
107
|
OUTBOUND_MESSAGE_ORIGINS: () => OUTBOUND_MESSAGE_ORIGINS,
|
|
98
108
|
P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
|
|
99
109
|
PROVIDER_FAILURES: () => PROVIDER_FAILURES,
|
|
110
|
+
QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
|
|
111
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
100
112
|
QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
|
|
101
113
|
RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
|
|
102
114
|
RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
|
|
@@ -142,9 +154,11 @@ __export(index_exports, {
|
|
|
142
154
|
WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
|
|
143
155
|
WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
|
|
144
156
|
WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
|
|
157
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
145
158
|
WORKER_TOOLS: () => WORKER_TOOLS,
|
|
146
159
|
appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
|
|
147
160
|
argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
|
|
161
|
+
assessQuotaFreshness: () => assessQuotaFreshness,
|
|
148
162
|
buildSlotProposal: () => buildSlotProposal,
|
|
149
163
|
canonicalDaemonId: () => canonicalDaemonId,
|
|
150
164
|
classifySessionStatus: () => classifySessionStatus,
|
|
@@ -192,6 +206,8 @@ __export(index_exports, {
|
|
|
192
206
|
decodeQueueQueryResponse: () => decodeQueueQueryResponse,
|
|
193
207
|
decodeQueueRequeueRequest: () => decodeQueueRequeueRequest,
|
|
194
208
|
decodeQueueRequeueResponse: () => decodeQueueRequeueResponse,
|
|
209
|
+
decodeQueueReviseRequest: () => decodeQueueReviseRequest,
|
|
210
|
+
decodeQueueReviseResponse: () => decodeQueueReviseResponse,
|
|
195
211
|
decodeRecordLocalRequest: () => decodeRecordLocalRequest,
|
|
196
212
|
decodeRecordLocalResponse: () => decodeRecordLocalResponse,
|
|
197
213
|
decodeRecoveryContextQueryRequest: () => decodeRecoveryContextQueryRequest,
|
|
@@ -221,10 +237,13 @@ __export(index_exports, {
|
|
|
221
237
|
expandDaemonIdForms: () => expandDaemonIdForms,
|
|
222
238
|
findOwnershipConflicts: () => findOwnershipConflicts,
|
|
223
239
|
foldKeyedDoc: () => foldKeyedDoc,
|
|
240
|
+
followedRemoteProjectKey: () => followedRemoteProjectKey,
|
|
224
241
|
formatQuotaAccount: () => formatQuotaAccount,
|
|
225
242
|
hasGitStatusEvidence: () => hasGitStatusEvidence,
|
|
226
243
|
hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
|
|
227
244
|
interpolateString: () => interpolateString,
|
|
245
|
+
isActionableProviderApproval: () => isActionableProviderApproval,
|
|
246
|
+
isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
|
|
228
247
|
isAssistantTool: () => isAssistantTool,
|
|
229
248
|
isBlockedStatus: () => isBlockedStatus,
|
|
230
249
|
isBusyStatus: () => isBusyStatus,
|
|
@@ -246,6 +265,8 @@ __export(index_exports, {
|
|
|
246
265
|
isFiniteNumber: () => isFiniteNumber,
|
|
247
266
|
isIdleSessionState: () => isIdleSessionState,
|
|
248
267
|
isInputEnvelopeWire: () => isInputEnvelopeWire,
|
|
268
|
+
isLaunchDefaultRole: () => isLaunchDefaultRole,
|
|
269
|
+
isLaunchDefaultSource: () => isLaunchDefaultSource,
|
|
249
270
|
isMeshDeliveryMode: () => isMeshDeliveryMode,
|
|
250
271
|
isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
|
|
251
272
|
isMeshMissionStatusValue: () => isMeshMissionStatusValue,
|
|
@@ -260,12 +281,14 @@ __export(index_exports, {
|
|
|
260
281
|
isMessageId: () => isMessageId,
|
|
261
282
|
isMissionUpsertResponse: () => isMissionUpsertResponse,
|
|
262
283
|
isModelAxisSource: () => isModelAxisSource,
|
|
284
|
+
isNativeMarkerRef: () => isNativeMarkerRef,
|
|
263
285
|
isNonEmptyString: () => isNonEmptyString,
|
|
264
286
|
isNotifyKind: () => isNotifyKind,
|
|
265
287
|
isOutboundMessage: () => isOutboundMessage,
|
|
266
288
|
isOutboundMessageOrigin: () => isOutboundMessageOrigin,
|
|
267
289
|
isP2PSignalType: () => isP2PSignalType,
|
|
268
290
|
isPhantomDaemonEntry: () => isPhantomDaemonEntry,
|
|
291
|
+
isProviderQuestionBinding: () => isProviderQuestionBinding,
|
|
269
292
|
isRawDaemonDoId: () => isRawDaemonDoId,
|
|
270
293
|
isReadyStatus: () => isReadyStatus,
|
|
271
294
|
isRecord: () => isRecord,
|
|
@@ -303,6 +326,7 @@ __export(index_exports, {
|
|
|
303
326
|
meshUtf8ByteLength: () => meshUtf8ByteLength,
|
|
304
327
|
meshWorkspacesEquivalent: () => meshWorkspacesEquivalent,
|
|
305
328
|
mintMessageId: () => mintMessageId,
|
|
329
|
+
minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
|
|
306
330
|
normalizeAuthOkLimits: () => normalizeAuthOkLimits,
|
|
307
331
|
normalizeBrainSlot: () => normalizeBrainSlot,
|
|
308
332
|
normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
|
|
@@ -319,17 +343,20 @@ __export(index_exports, {
|
|
|
319
343
|
normalizeThinkingLevel: () => normalizeThinkingLevel,
|
|
320
344
|
orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
|
|
321
345
|
parseJsonRecord: () => parseJsonRecord,
|
|
346
|
+
parseRoleLaunchSelection: () => parseRoleLaunchSelection,
|
|
322
347
|
parseSemver: () => parseSemver,
|
|
323
348
|
parseSessionLaunchRecord: () => parseSessionLaunchRecord,
|
|
324
349
|
pathsOverlap: () => pathsOverlap,
|
|
325
350
|
pickBestTransitGitStatus: () => pickBestTransitGitStatus,
|
|
326
351
|
projectFileDiffRow: () => projectFileDiffRow,
|
|
327
352
|
projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
|
|
353
|
+
providerApprovalSnapshot: () => providerApprovalSnapshot,
|
|
328
354
|
readBoolean: () => readBoolean,
|
|
329
355
|
readEnvelopeFields: () => readEnvelopeFields,
|
|
330
356
|
readGitSubmodules: () => readGitSubmodules,
|
|
331
357
|
readNumber: () => readNumber,
|
|
332
358
|
readOptionalRecord: () => readOptionalRecord,
|
|
359
|
+
readProviderDecision: () => readProviderDecision,
|
|
333
360
|
readRecord: () => readRecord,
|
|
334
361
|
readString: () => readString,
|
|
335
362
|
readStringArray: () => readStringArray,
|
|
@@ -340,6 +367,7 @@ __export(index_exports, {
|
|
|
340
367
|
retiredMeshToolError: () => retiredMeshToolError,
|
|
341
368
|
sanitizeModelIdentifier: () => sanitizeModelIdentifier,
|
|
342
369
|
sanitizeRefusalCode: () => sanitizeRefusalCode,
|
|
370
|
+
sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
|
|
343
371
|
scoreGitStatusCandidate: () => scoreGitStatusCandidate,
|
|
344
372
|
scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
|
|
345
373
|
sessionIdsEquivalent: () => sessionIdsEquivalent,
|
|
@@ -350,6 +378,7 @@ __export(index_exports, {
|
|
|
350
378
|
summarizeGitShape: () => summarizeGitShape,
|
|
351
379
|
supportsQuota: () => supportsQuota,
|
|
352
380
|
touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
|
|
381
|
+
unwrapPastedContent: () => unwrapPastedContent,
|
|
353
382
|
withStatusProbeMarker: () => withStatusProbeMarker
|
|
354
383
|
});
|
|
355
384
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -550,15 +579,15 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
550
579
|
}
|
|
551
580
|
|
|
552
581
|
// src/session-normalize.ts
|
|
553
|
-
function deriveSyntheticSessionId(
|
|
582
|
+
function deriveSyntheticSessionId(record2) {
|
|
554
583
|
const parts = [
|
|
555
|
-
readString(
|
|
556
|
-
readString(
|
|
557
|
-
readString(
|
|
558
|
-
readString(
|
|
559
|
-
readString(
|
|
560
|
-
readString(
|
|
561
|
-
readString(
|
|
584
|
+
readString(record2.workspace),
|
|
585
|
+
readString(record2.providerType, record2.provider),
|
|
586
|
+
readString(record2.role),
|
|
587
|
+
readString(record2.state, record2.status),
|
|
588
|
+
readString(record2.title),
|
|
589
|
+
readString(record2.createdAt, record2.created_at),
|
|
590
|
+
readString(record2.startedAt, record2.started_at)
|
|
562
591
|
].filter((part) => Boolean(part));
|
|
563
592
|
if (parts.length === 0) return void 0;
|
|
564
593
|
return `synthetic:${parts.join("|")}`;
|
|
@@ -570,33 +599,33 @@ function sessionIdsEquivalent(a, b) {
|
|
|
570
599
|
return idA === idB;
|
|
571
600
|
}
|
|
572
601
|
function normalizeMeshSessionRecord(entry) {
|
|
573
|
-
const
|
|
574
|
-
const sessionId = readString(
|
|
602
|
+
const record2 = readRecord(entry);
|
|
603
|
+
const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
|
|
575
604
|
if (!sessionId) return null;
|
|
576
605
|
return {
|
|
577
606
|
sessionId,
|
|
578
|
-
...readString(
|
|
579
|
-
...readString(
|
|
580
|
-
...readString(
|
|
581
|
-
...readString(
|
|
582
|
-
...readString(
|
|
583
|
-
...readString(
|
|
584
|
-
...readString(
|
|
585
|
-
...readString(
|
|
586
|
-
...readString(
|
|
587
|
-
...readBoolean(
|
|
588
|
-
...readString(
|
|
589
|
-
...readString(
|
|
590
|
-
...readString(
|
|
591
|
-
...readString(
|
|
592
|
-
...readBoolean(
|
|
607
|
+
...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
|
|
608
|
+
...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
|
|
609
|
+
...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
|
|
610
|
+
...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
|
|
611
|
+
...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
|
|
612
|
+
...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
|
|
613
|
+
...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
|
|
614
|
+
...readString(record2.title) ? { title: readString(record2.title) } : {},
|
|
615
|
+
...readString(record2.role) ? { role: readString(record2.role) } : {},
|
|
616
|
+
...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
|
|
617
|
+
...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
|
|
618
|
+
...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
|
|
619
|
+
...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
|
|
620
|
+
...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
|
|
621
|
+
...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
|
|
593
622
|
};
|
|
594
623
|
}
|
|
595
624
|
|
|
596
625
|
// src/node-normalize.ts
|
|
597
626
|
function normalizeMeshNodeId(node) {
|
|
598
|
-
const
|
|
599
|
-
return readString(
|
|
627
|
+
const record2 = node && typeof node === "object" ? node : {};
|
|
628
|
+
return readString(record2.id, record2.nodeId, record2.node_id);
|
|
600
629
|
}
|
|
601
630
|
function meshNodeIdMatches(node, candidateId) {
|
|
602
631
|
if (!candidateId) return false;
|
|
@@ -608,12 +637,12 @@ function meshNodeIdMatches(node, candidateId) {
|
|
|
608
637
|
// src/node-facts.ts
|
|
609
638
|
function normalizeMeshNodeFacts(raw) {
|
|
610
639
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
611
|
-
const
|
|
612
|
-
const schemaVersion = Number(
|
|
613
|
-
const reportedAt = Number(
|
|
640
|
+
const record2 = raw;
|
|
641
|
+
const schemaVersion = Number(record2.schemaVersion);
|
|
642
|
+
const reportedAt = Number(record2.reportedAt);
|
|
614
643
|
if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
|
|
615
644
|
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
|
|
616
|
-
return { ...
|
|
645
|
+
return { ...record2, schemaVersion, reportedAt };
|
|
617
646
|
}
|
|
618
647
|
var QUOTA_SUPPORTED_PROVIDERS = [
|
|
619
648
|
"antigravity-cli",
|
|
@@ -656,6 +685,52 @@ function defaultProviderPriorityFromNodeFacts(facts) {
|
|
|
656
685
|
return orderProvidersByBuiltinPreference(detected.length ? detected : enabled);
|
|
657
686
|
}
|
|
658
687
|
|
|
688
|
+
// src/quota-freshness.ts
|
|
689
|
+
var QUOTA_RETRY_INFLIGHT_GRACE_MS = 6e4;
|
|
690
|
+
var QUOTA_BACKFILL_HORIZON_MS = 60 * 60 * 1e3;
|
|
691
|
+
function hasUsableWindow(window) {
|
|
692
|
+
return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
|
|
693
|
+
}
|
|
694
|
+
function hasReading(quota) {
|
|
695
|
+
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
|
|
696
|
+
return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
|
|
697
|
+
}
|
|
698
|
+
function finiteMs(value) {
|
|
699
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
700
|
+
}
|
|
701
|
+
function backfillCheckAt(quota, now) {
|
|
702
|
+
const dataDue = finiteMs(quota.updatedAt);
|
|
703
|
+
const attempted = finiteMs(quota.metadata?.fetchedAt);
|
|
704
|
+
const dueAt = Math.max(
|
|
705
|
+
dataDue === void 0 ? Number.NEGATIVE_INFINITY : dataDue + QUOTA_BACKFILL_HORIZON_MS,
|
|
706
|
+
attempted === void 0 ? Number.NEGATIVE_INFINITY : attempted + QUOTA_BACKFILL_HORIZON_MS
|
|
707
|
+
);
|
|
708
|
+
return Number.isFinite(dueAt) && dueAt > now ? dueAt : void 0;
|
|
709
|
+
}
|
|
710
|
+
function assessQuotaFreshness(quota, now = Date.now()) {
|
|
711
|
+
const meta = quota.metadata;
|
|
712
|
+
const kind = meta?.failureKind;
|
|
713
|
+
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
|
|
714
|
+
const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
|
|
715
|
+
if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
|
|
716
|
+
if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
|
|
717
|
+
if (meta?.lastGoodWindows !== true) {
|
|
718
|
+
const measuredAt = finiteMs(quota.updatedAt);
|
|
719
|
+
if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
|
|
720
|
+
return { cue: "stale", userMustAct };
|
|
721
|
+
}
|
|
722
|
+
return { userMustAct };
|
|
723
|
+
}
|
|
724
|
+
const retryAtMs = finiteMs(meta?.retryAtMs);
|
|
725
|
+
const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
|
|
726
|
+
if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
|
|
727
|
+
const nextCheckAt = backfillCheckAt(quota, now);
|
|
728
|
+
return nextCheckAt === void 0 ? { cue: "stale", userMustAct: false } : { cue: "stale", userMustAct: false, nextCheckAt };
|
|
729
|
+
}
|
|
730
|
+
function minutesUntilQuotaCheck(nextCheckAt, now = Date.now()) {
|
|
731
|
+
return Math.max(1, Math.round((nextCheckAt - now) / 6e4));
|
|
732
|
+
}
|
|
733
|
+
|
|
659
734
|
// src/workspace-normalize.ts
|
|
660
735
|
function normalizeMeshWorkspaceForCompare(dir) {
|
|
661
736
|
if (typeof dir !== "string") return "";
|
|
@@ -685,19 +760,21 @@ function isPhantomDaemonEntry(entry) {
|
|
|
685
760
|
function machineCoreFromDaemonId(id2) {
|
|
686
761
|
const trimmed = readString(id2);
|
|
687
762
|
if (!trimmed) return void 0;
|
|
763
|
+
const lower = trimmed.toLowerCase();
|
|
688
764
|
for (const prefix of DAEMON_ID_PREFIXES) {
|
|
689
|
-
if (
|
|
765
|
+
if (lower.startsWith(prefix)) {
|
|
690
766
|
const core = trimmed.slice(prefix.length).trim();
|
|
691
|
-
|
|
767
|
+
if (!core) return void 0;
|
|
768
|
+
return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
|
|
692
769
|
}
|
|
693
770
|
}
|
|
694
|
-
return trimmed;
|
|
771
|
+
return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
|
|
695
772
|
}
|
|
696
773
|
function canonicalDaemonId(id2) {
|
|
697
774
|
const core = machineCoreFromDaemonId(id2);
|
|
698
775
|
if (!core) return void 0;
|
|
699
|
-
if (
|
|
700
|
-
return `
|
|
776
|
+
if (!/^mach_/i.test(core)) return core;
|
|
777
|
+
return `daemon_mach_${core.slice(5)}`;
|
|
701
778
|
}
|
|
702
779
|
function daemonIdsEquivalent(a, b) {
|
|
703
780
|
const coreA = machineCoreFromDaemonId(a);
|
|
@@ -726,9 +803,9 @@ function expandDaemonIdForms(ids) {
|
|
|
726
803
|
|
|
727
804
|
// src/git-summarize.ts
|
|
728
805
|
function summarizeGitShape(status) {
|
|
729
|
-
const
|
|
730
|
-
if (!Object.keys(
|
|
731
|
-
const submodules = Array.isArray(
|
|
806
|
+
const record2 = readRecord(status);
|
|
807
|
+
if (!Object.keys(record2).length) return null;
|
|
808
|
+
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
732
809
|
const sub = readRecord(entry);
|
|
733
810
|
return {
|
|
734
811
|
path: readString(sub.path) ?? null,
|
|
@@ -738,23 +815,23 @@ function summarizeGitShape(status) {
|
|
|
738
815
|
};
|
|
739
816
|
}) : [];
|
|
740
817
|
return {
|
|
741
|
-
isGitRepo: readBoolean(
|
|
742
|
-
workspace: readString(
|
|
743
|
-
repoRoot: readString(
|
|
744
|
-
branch: readString(
|
|
745
|
-
upstream: readString(
|
|
746
|
-
upstreamStatus: readString(
|
|
747
|
-
headCommit: readString(
|
|
748
|
-
ahead: readNumber(
|
|
749
|
-
behind: readNumber(
|
|
818
|
+
isGitRepo: readBoolean(record2.isGitRepo),
|
|
819
|
+
workspace: readString(record2.workspace) ?? null,
|
|
820
|
+
repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
|
|
821
|
+
branch: readString(record2.branch) ?? null,
|
|
822
|
+
upstream: readString(record2.upstream) ?? null,
|
|
823
|
+
upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
824
|
+
headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
825
|
+
ahead: readNumber(record2.ahead) ?? null,
|
|
826
|
+
behind: readNumber(record2.behind) ?? null,
|
|
750
827
|
dirtyCounts: {
|
|
751
|
-
staged: readNumber(
|
|
752
|
-
modified: readNumber(
|
|
753
|
-
untracked: readNumber(
|
|
754
|
-
deleted: readNumber(
|
|
755
|
-
renamed: readNumber(
|
|
828
|
+
staged: readNumber(record2.staged) ?? 0,
|
|
829
|
+
modified: readNumber(record2.modified) ?? 0,
|
|
830
|
+
untracked: readNumber(record2.untracked) ?? 0,
|
|
831
|
+
deleted: readNumber(record2.deleted) ?? 0,
|
|
832
|
+
renamed: readNumber(record2.renamed) ?? 0
|
|
756
833
|
},
|
|
757
|
-
lastCheckedAt: readNumber(
|
|
834
|
+
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
758
835
|
submoduleCount: submodules.length,
|
|
759
836
|
submodules
|
|
760
837
|
};
|
|
@@ -920,10 +997,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
|
|
|
920
997
|
],
|
|
921
998
|
"antigravity-cli": [
|
|
922
999
|
{
|
|
923
|
-
model: "Gemini 3.
|
|
1000
|
+
model: "Gemini 3.8 Flash (High)",
|
|
1001
|
+
modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
924
1002
|
difficulty: ["easy"],
|
|
925
1003
|
maxParallel: 2,
|
|
926
1004
|
rationale: "Cheap capacity for easy tasks."
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
model: "Gemini 4 Argon (Medium)",
|
|
1008
|
+
modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
1009
|
+
difficulty: ["medium"],
|
|
1010
|
+
maxParallel: 2,
|
|
1011
|
+
rationale: "Balanced Argon tier for medium tasks."
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
model: "Gemini 4 Argon (High)",
|
|
1015
|
+
modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
1016
|
+
difficulty: ["difficult"],
|
|
1017
|
+
maxParallel: 1,
|
|
1018
|
+
rationale: "Reserved for hard tasks; capped at 1 to bound cost."
|
|
927
1019
|
}
|
|
928
1020
|
],
|
|
929
1021
|
"cursor-cli": [
|
|
@@ -962,6 +1054,24 @@ function dedupeDetected(detected) {
|
|
|
962
1054
|
}
|
|
963
1055
|
return out;
|
|
964
1056
|
}
|
|
1057
|
+
function resolveRecipeModel(recipe, modelOptions) {
|
|
1058
|
+
if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
|
|
1059
|
+
return recipe.model;
|
|
1060
|
+
}
|
|
1061
|
+
const available = new Set(
|
|
1062
|
+
modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
|
|
1063
|
+
);
|
|
1064
|
+
if (available.size === 0) return recipe.model;
|
|
1065
|
+
const candidates = [
|
|
1066
|
+
...recipe.model ? [recipe.model] : [],
|
|
1067
|
+
...recipe.modelCandidates ?? []
|
|
1068
|
+
];
|
|
1069
|
+
for (const candidate of candidates) {
|
|
1070
|
+
const trimmed = typeof candidate === "string" ? candidate.trim() : "";
|
|
1071
|
+
if (trimmed && available.has(trimmed)) return trimmed;
|
|
1072
|
+
}
|
|
1073
|
+
return recipe.model;
|
|
1074
|
+
}
|
|
965
1075
|
function buildSlotProposal(detected, currentSlots = []) {
|
|
966
1076
|
const providers = dedupeDetected(detected ?? []);
|
|
967
1077
|
const proposedSlots = [];
|
|
@@ -977,7 +1087,7 @@ function buildSlotProposal(detected, currentSlots = []) {
|
|
|
977
1087
|
for (const recipe of recipes) {
|
|
978
1088
|
const slot = normalizeNodeCapabilitySlot({
|
|
979
1089
|
provider: provider.type,
|
|
980
|
-
model: recipe.
|
|
1090
|
+
model: resolveRecipeModel(recipe, provider.modelOptions),
|
|
981
1091
|
thinkingLevel: recipe.thinkingLevel,
|
|
982
1092
|
difficulty: recipe.difficulty,
|
|
983
1093
|
maxParallel: recipe.maxParallel
|
|
@@ -1031,6 +1141,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1031
1141
|
"mesh_view_queue",
|
|
1032
1142
|
"mesh_queue_cancel",
|
|
1033
1143
|
"mesh_queue_requeue",
|
|
1144
|
+
"mesh_queue_revise",
|
|
1034
1145
|
"mesh_send_task",
|
|
1035
1146
|
"mesh_read_chat",
|
|
1036
1147
|
"mesh_read_debug",
|
|
@@ -1047,6 +1158,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1047
1158
|
"mesh_list_pending_approvals",
|
|
1048
1159
|
"mesh_create",
|
|
1049
1160
|
"mesh_add_node",
|
|
1161
|
+
"mesh_attach_remote",
|
|
1050
1162
|
"mesh_clone_node",
|
|
1051
1163
|
"mesh_remove_node",
|
|
1052
1164
|
"mesh_cleanup_worktree_nodes",
|
|
@@ -1066,7 +1178,10 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1066
1178
|
"mesh_mission_upsert",
|
|
1067
1179
|
"mesh_mission_list",
|
|
1068
1180
|
"mesh_review_inbox",
|
|
1069
|
-
"mesh_node_slots"
|
|
1181
|
+
"mesh_node_slots",
|
|
1182
|
+
"driver_list",
|
|
1183
|
+
"driver_describe",
|
|
1184
|
+
"artifact_list"
|
|
1070
1185
|
];
|
|
1071
1186
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
1072
1187
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -1741,21 +1856,22 @@ function isTerminalSessionRecordStatus(raw) {
|
|
|
1741
1856
|
return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
|
|
1742
1857
|
}
|
|
1743
1858
|
function isIdleSessionState(state) {
|
|
1744
|
-
const
|
|
1745
|
-
const status = typeof
|
|
1859
|
+
const record2 = state && typeof state === "object" ? state : {};
|
|
1860
|
+
const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
|
|
1746
1861
|
if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
|
|
1747
|
-
return isReadyStatus(status) ||
|
|
1862
|
+
return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
|
|
1748
1863
|
}
|
|
1749
1864
|
|
|
1750
1865
|
// src/mesh-vocabulary.ts
|
|
1751
|
-
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
|
|
1752
|
-
var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
|
|
1866
|
+
var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
|
|
1867
|
+
var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
|
|
1753
1868
|
var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
1754
1869
|
var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
|
|
1755
1870
|
var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
1756
1871
|
var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
|
|
1757
1872
|
var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
1758
1873
|
var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
|
|
1874
|
+
var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
|
|
1759
1875
|
var WORKER_BRANCH_STATES = [
|
|
1760
1876
|
"merged_to_main",
|
|
1761
1877
|
"pushed_feature_branch_needs_merge",
|
|
@@ -1853,6 +1969,14 @@ function isOutboundMessage(value) {
|
|
|
1853
1969
|
const candidate = value;
|
|
1854
1970
|
return isMessageId(candidate.messageId) && typeof candidate.sessionId === "string" && candidate.sessionId.length > 0 && isInputEnvelopeWire(candidate.input) && isOutboundMessageOrigin(candidate.origin) && isSendPolicy(candidate.policy) && typeof candidate.createdAt === "number";
|
|
1855
1971
|
}
|
|
1972
|
+
var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1973
|
+
var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1974
|
+
function unwrapPastedContent(text) {
|
|
1975
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
1976
|
+
const first = lines.findIndex((line) => line.trim());
|
|
1977
|
+
if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
|
|
1978
|
+
return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
|
|
1979
|
+
}
|
|
1856
1980
|
|
|
1857
1981
|
// src/mission-brief.ts
|
|
1858
1982
|
var GOAL_MAX = 500;
|
|
@@ -1938,7 +2062,11 @@ var WORKER_TOOLS = [
|
|
|
1938
2062
|
"peer_context_pull",
|
|
1939
2063
|
"git_status",
|
|
1940
2064
|
"git_log",
|
|
1941
|
-
"git_diff"
|
|
2065
|
+
"git_diff",
|
|
2066
|
+
"driver_list",
|
|
2067
|
+
"driver_describe",
|
|
2068
|
+
"driver_invoke",
|
|
2069
|
+
"artifact_register"
|
|
1942
2070
|
];
|
|
1943
2071
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
1944
2072
|
function isWorkerTool(value) {
|
|
@@ -2023,15 +2151,23 @@ function renderCoordinatorWorkerSection() {
|
|
|
2023
2151
|
// src/assistant-protocol.ts
|
|
2024
2152
|
var ASSISTANT_TOOLS = [
|
|
2025
2153
|
"projects",
|
|
2154
|
+
"environment",
|
|
2155
|
+
"assistant_action",
|
|
2156
|
+
"project_watch",
|
|
2026
2157
|
"project_status",
|
|
2027
2158
|
"project_send",
|
|
2028
2159
|
"project_read",
|
|
2029
2160
|
"project_add",
|
|
2161
|
+
"project_attach_remote",
|
|
2030
2162
|
"discover_repos",
|
|
2031
2163
|
"memory",
|
|
2032
2164
|
"skill_view",
|
|
2033
2165
|
"skill_manage",
|
|
2034
|
-
"project_note"
|
|
2166
|
+
"project_note",
|
|
2167
|
+
"launch_defaults",
|
|
2168
|
+
"launch_defaults_set",
|
|
2169
|
+
"driver_list",
|
|
2170
|
+
"driver_describe"
|
|
2035
2171
|
];
|
|
2036
2172
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
2037
2173
|
function isAssistantTool(value) {
|
|
@@ -2039,41 +2175,64 @@ function isAssistantTool(value) {
|
|
|
2039
2175
|
}
|
|
2040
2176
|
var ASSISTANT_VERB = {
|
|
2041
2177
|
// tool verbs
|
|
2178
|
+
driverList: "driver_list",
|
|
2179
|
+
driverDescribe: "driver_describe",
|
|
2042
2180
|
projects: "assistant_projects",
|
|
2181
|
+
environment: "assistant_environment",
|
|
2182
|
+
action: "assistant_action",
|
|
2183
|
+
watch: "assistant_project_watch",
|
|
2184
|
+
executionState: "assistant_execution_state",
|
|
2185
|
+
executionSettings: "assistant_execution_settings",
|
|
2043
2186
|
projectStatus: "assistant_project_status",
|
|
2044
2187
|
projectSend: "assistant_project_send",
|
|
2045
2188
|
projectRead: "assistant_project_read",
|
|
2046
2189
|
projectAdd: "assistant_project_add",
|
|
2190
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
2047
2191
|
discoverRepos: "assistant_discover_repos",
|
|
2048
2192
|
memory: "assistant_memory",
|
|
2049
2193
|
skillView: "assistant_skill_view",
|
|
2050
2194
|
skillManage: "assistant_skill_manage",
|
|
2051
2195
|
projectNote: "assistant_project_note",
|
|
2196
|
+
launchDefaults: "assistant_launch_defaults",
|
|
2197
|
+
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
2052
2198
|
// assistant-side daemon verbs without a tool of the same name
|
|
2053
2199
|
launch: "launch_assistant",
|
|
2054
2200
|
pendingRelays: "assistant_pending_relays",
|
|
2055
2201
|
// owner verbs (dashboard only)
|
|
2056
2202
|
stagedResolve: "assistant_staged_resolve",
|
|
2057
2203
|
storeAdmin: "assistant_store_admin",
|
|
2058
|
-
importSkills: "assistant_import_skills"
|
|
2204
|
+
importSkills: "assistant_import_skills",
|
|
2205
|
+
/** Projects the assistant is following (open relay threads) — list / stop following. */
|
|
2206
|
+
threads: "assistant_threads",
|
|
2207
|
+
threadClose: "assistant_thread_close"
|
|
2059
2208
|
};
|
|
2060
2209
|
var ASSISTANT_TOOL_VERBS = {
|
|
2210
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
2211
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
2061
2212
|
projects: ASSISTANT_VERB.projects,
|
|
2213
|
+
environment: ASSISTANT_VERB.environment,
|
|
2214
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
2215
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
2062
2216
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
2063
2217
|
project_send: ASSISTANT_VERB.projectSend,
|
|
2064
2218
|
project_read: ASSISTANT_VERB.projectRead,
|
|
2065
2219
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
2220
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
2066
2221
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
2067
2222
|
memory: ASSISTANT_VERB.memory,
|
|
2068
2223
|
skill_view: ASSISTANT_VERB.skillView,
|
|
2069
2224
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
2070
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
2225
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
2226
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
2227
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
2071
2228
|
};
|
|
2072
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
2229
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
2073
2230
|
var ASSISTANT_OWNER_VERBS = [
|
|
2231
|
+
ASSISTANT_VERB.executionSettings,
|
|
2074
2232
|
ASSISTANT_VERB.stagedResolve,
|
|
2075
2233
|
ASSISTANT_VERB.storeAdmin,
|
|
2076
|
-
ASSISTANT_VERB.importSkills
|
|
2234
|
+
ASSISTANT_VERB.importSkills,
|
|
2235
|
+
ASSISTANT_VERB.threadClose
|
|
2077
2236
|
];
|
|
2078
2237
|
var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
2079
2238
|
ASSISTANT_VERB.memory,
|
|
@@ -2083,6 +2242,63 @@ var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
|
2083
2242
|
];
|
|
2084
2243
|
var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
|
|
2085
2244
|
var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
|
|
2245
|
+
var ASSISTANT_ACCOUNT_SLOT = "personal";
|
|
2246
|
+
var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
2247
|
+
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
2248
|
+
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
2249
|
+
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
2250
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send"];
|
|
2251
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
2252
|
+
function isAssistantFollowerAllowedOp(value) {
|
|
2253
|
+
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
2254
|
+
}
|
|
2255
|
+
function followedRemoteProjectKey(hostDaemonId, meshId) {
|
|
2256
|
+
const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
|
|
2257
|
+
return `${canonHost}::${meshId.trim()}`;
|
|
2258
|
+
}
|
|
2259
|
+
function sanitizeRemoteRepoIdentity(raw) {
|
|
2260
|
+
if (typeof raw !== "string") return null;
|
|
2261
|
+
const trimmed = raw.trim();
|
|
2262
|
+
if (!trimmed) return null;
|
|
2263
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
|
|
2264
|
+
return null;
|
|
2265
|
+
}
|
|
2266
|
+
const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
|
|
2267
|
+
if (!withoutQuery) return null;
|
|
2268
|
+
let host = "";
|
|
2269
|
+
let repoPath = "";
|
|
2270
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
|
|
2271
|
+
try {
|
|
2272
|
+
const url = new URL(withoutQuery);
|
|
2273
|
+
if (url.protocol === "file:") return null;
|
|
2274
|
+
host = url.hostname.toLowerCase();
|
|
2275
|
+
repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2276
|
+
} catch {
|
|
2277
|
+
return null;
|
|
2278
|
+
}
|
|
2279
|
+
} else {
|
|
2280
|
+
const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
|
|
2281
|
+
if (scpMatch) {
|
|
2282
|
+
host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
|
|
2283
|
+
repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2284
|
+
} else {
|
|
2285
|
+
const slash = withoutQuery.indexOf("/");
|
|
2286
|
+
if (slash > 0) {
|
|
2287
|
+
const rawHost = withoutQuery.slice(0, slash);
|
|
2288
|
+
const atIdx = rawHost.lastIndexOf("@");
|
|
2289
|
+
host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
|
|
2290
|
+
repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
if (!host || !repoPath) return null;
|
|
2295
|
+
if (!host.includes(".") && host !== "localhost") return null;
|
|
2296
|
+
if (/[\s@:\\]/.test(host)) return null;
|
|
2297
|
+
const segments = repoPath.split("/").filter(Boolean);
|
|
2298
|
+
if (segments.length === 0) return null;
|
|
2299
|
+
if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
|
|
2300
|
+
return `${host}/${segments.join("/")}`.slice(0, 200);
|
|
2301
|
+
}
|
|
2086
2302
|
|
|
2087
2303
|
// src/turn-evidence.ts
|
|
2088
2304
|
var MESH_TOPIC_PROTOCOL_VERSION = 2;
|
|
@@ -2128,8 +2344,8 @@ function sanitizeRefusalCode(value) {
|
|
|
2128
2344
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
2129
2345
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
2130
2346
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
2131
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
2132
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
2347
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
2348
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
2133
2349
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
2134
2350
|
var TURN_END_BLOCK_REASONS = [
|
|
2135
2351
|
"missing_final_assistant",
|
|
@@ -2137,9 +2353,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
2137
2353
|
"terminal_block_hard_cap",
|
|
2138
2354
|
"decoupled_completion"
|
|
2139
2355
|
];
|
|
2140
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
2356
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
2141
2357
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
2142
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
2358
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
2143
2359
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
2144
2360
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
2145
2361
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -2166,9 +2382,10 @@ var HOLD_REASONS = [
|
|
|
2166
2382
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
2167
2383
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
2168
2384
|
// liveness / hard_ceiling.
|
|
2169
|
-
"await_end"
|
|
2385
|
+
"await_end",
|
|
2386
|
+
"report_correction"
|
|
2170
2387
|
];
|
|
2171
|
-
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2388
|
+
var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
|
|
2172
2389
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
2173
2390
|
var TURN_REASONS = [
|
|
2174
2391
|
// commits
|
|
@@ -2177,9 +2394,15 @@ var TURN_REASONS = [
|
|
|
2177
2394
|
"transcript_final",
|
|
2178
2395
|
"worker_reported",
|
|
2179
2396
|
"finalization_timeout_no_response",
|
|
2397
|
+
"weak_end_liveness_unconfirmed",
|
|
2398
|
+
"weak_end_probe_unobserved",
|
|
2399
|
+
"report_correction_expired",
|
|
2180
2400
|
"session_error",
|
|
2181
2401
|
"provider_auth_failed",
|
|
2182
2402
|
"provider_billing_failed",
|
|
2403
|
+
"provider_usage_limit_exceeded",
|
|
2404
|
+
"provider_server_overloaded",
|
|
2405
|
+
"provider_error",
|
|
2183
2406
|
"operator_cancel",
|
|
2184
2407
|
"intentional_cleanup",
|
|
2185
2408
|
"task_removed",
|
|
@@ -2207,6 +2430,7 @@ var TURN_REASONS = [
|
|
|
2207
2430
|
];
|
|
2208
2431
|
var NOTIFY_KINDS = [
|
|
2209
2432
|
"completed",
|
|
2433
|
+
"blocked",
|
|
2210
2434
|
"failed",
|
|
2211
2435
|
"cancelled",
|
|
2212
2436
|
"stopped",
|
|
@@ -2256,8 +2480,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2256
2480
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
2257
2481
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
2258
2482
|
turn_started: { retro: bool },
|
|
2259
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
2260
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
2483
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
2484
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
2261
2485
|
turn_end: {
|
|
2262
2486
|
strength: en(TURN_END_STRENGTHS),
|
|
2263
2487
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -2267,6 +2491,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2267
2491
|
releasedByHardCap: boolOpt,
|
|
2268
2492
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
2269
2493
|
live: { t: "live", optional: true },
|
|
2494
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
2270
2495
|
reportExpected: boolOpt,
|
|
2271
2496
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
2272
2497
|
},
|
|
@@ -2280,7 +2505,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2280
2505
|
},
|
|
2281
2506
|
transcript_activity: { newestActivityAt: ms },
|
|
2282
2507
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
2283
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2508
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
2284
2509
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
2285
2510
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
2286
2511
|
worker_report: {
|
|
@@ -2290,6 +2515,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2290
2515
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
2291
2516
|
touchedFileCount: intOpt
|
|
2292
2517
|
},
|
|
2518
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
2293
2519
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
2294
2520
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
2295
2521
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2337,7 +2563,7 @@ function isLiveTurnPending(value) {
|
|
|
2337
2563
|
return isRecord2(value) && hasOnlyKeys(value, ["modal", "adapterPending", "trailingTool", "newestActivityAt"]) && typeof value.modal === "boolean" && typeof value.adapterPending === "boolean" && typeof value.trailingTool === "boolean" && (value.newestActivityAt === void 0 || isFiniteNumber2(value.newestActivityAt));
|
|
2338
2564
|
}
|
|
2339
2565
|
function isNativeMarkerRef(value) {
|
|
2340
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2566
|
+
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId", "receivedAt", "startedAt", "errorAt"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId)) && ["receivedAt", "startedAt", "errorAt"].every((key) => value[key] === void 0 || isFiniteNumber2(value[key]));
|
|
2341
2567
|
}
|
|
2342
2568
|
function isCoordinatorIdentity(value) {
|
|
2343
2569
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -2460,17 +2686,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2460
2686
|
};
|
|
2461
2687
|
}
|
|
2462
2688
|
|
|
2689
|
+
// src/launch-defaults.ts
|
|
2690
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
2691
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
2692
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
2693
|
+
function isLaunchDefaultRole(value) {
|
|
2694
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
2695
|
+
}
|
|
2696
|
+
function isLaunchDefaultSource(value) {
|
|
2697
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
2698
|
+
}
|
|
2699
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
2700
|
+
"invalid_args",
|
|
2701
|
+
"launch_default_required",
|
|
2702
|
+
"launch_default_unavailable",
|
|
2703
|
+
"launch_selection_invalid",
|
|
2704
|
+
"launch_default_invalid",
|
|
2705
|
+
"revision_conflict",
|
|
2706
|
+
"store_unavailable",
|
|
2707
|
+
"store_busy",
|
|
2708
|
+
"persistence_failed",
|
|
2709
|
+
"project_not_found",
|
|
2710
|
+
"project_ambiguous",
|
|
2711
|
+
"project_not_hosted",
|
|
2712
|
+
"project_storage_unavailable",
|
|
2713
|
+
"staging_unavailable",
|
|
2714
|
+
"staging_failed",
|
|
2715
|
+
"review_turn_tool_denied"
|
|
2716
|
+
];
|
|
2717
|
+
|
|
2718
|
+
// src/role-launch.ts
|
|
2719
|
+
function record(value) {
|
|
2720
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2721
|
+
}
|
|
2722
|
+
function ref(value) {
|
|
2723
|
+
const r = record(value);
|
|
2724
|
+
if (!r || !isLaunchDefaultRole(r.role) || r.scope !== "global" && r.scope !== "project" || !Number.isSafeInteger(r.revision) || r.revision < 1 || r.scope === "project" && (typeof r.projectId !== "string" || !r.projectId)) return void 0;
|
|
2725
|
+
return {
|
|
2726
|
+
role: r.role,
|
|
2727
|
+
scope: r.scope,
|
|
2728
|
+
revision: r.revision,
|
|
2729
|
+
...r.scope === "project" ? { projectId: r.projectId } : {}
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
function axis(value) {
|
|
2733
|
+
const a = record(value);
|
|
2734
|
+
if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
|
|
2735
|
+
const defaultRef = ref(a.defaultRef);
|
|
2736
|
+
if (a.source === "stored_default" && defaultRef?.scope !== "global" || a.source === "project_default" && defaultRef?.scope !== "project" || (a.source === "user" || a.source === "provider_default") && a.defaultRef !== void 0) return void 0;
|
|
2737
|
+
return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
|
|
2738
|
+
}
|
|
2739
|
+
function parseRoleLaunchSelection(value) {
|
|
2740
|
+
const r = record(value), s = record(r?.selection), a = record(r?.applied);
|
|
2741
|
+
if (!r || !isLaunchDefaultRole(r.role) || !s || typeof s.provider !== "string" || !s.provider || !Number.isSafeInteger(r.documentRevision) || r.documentRevision < 1 || s.model !== void 0 && typeof s.model !== "string" || s.thinkingLevel !== void 0 && typeof s.thinkingLevel !== "string") return void 0;
|
|
2742
|
+
const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
|
|
2743
|
+
if (!provider || !model || !thinkingLevel || [provider, model, thinkingLevel].some((axis2) => axis2.defaultRef && (axis2.defaultRef.role !== r.role || axis2.defaultRef.scope === "global" && axis2.defaultRef.revision > r.documentRevision)) || provider.value !== s.provider || model.value !== (s.model ?? null) || thinkingLevel.value !== (s.thinkingLevel ?? null)) return void 0;
|
|
2744
|
+
const defaultRef = ref(r.defaultRef);
|
|
2745
|
+
return {
|
|
2746
|
+
role: r.role,
|
|
2747
|
+
selection: {
|
|
2748
|
+
provider: s.provider,
|
|
2749
|
+
...typeof s.model === "string" ? { model: s.model } : {},
|
|
2750
|
+
...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
|
|
2751
|
+
},
|
|
2752
|
+
applied: { provider, model, thinkingLevel },
|
|
2753
|
+
...defaultRef ? { defaultRef } : {},
|
|
2754
|
+
documentRevision: r.documentRevision
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2463
2758
|
// src/session-launch.ts
|
|
2464
2759
|
var MODEL_AXIS_SOURCES = [
|
|
2465
2760
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2466
2761
|
"user",
|
|
2467
2762
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2468
2763
|
"remembered",
|
|
2764
|
+
/** The authoritative daemon role default or host project override. */
|
|
2765
|
+
"stored_default",
|
|
2766
|
+
"project_default",
|
|
2469
2767
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2470
2768
|
"mesh_slot",
|
|
2471
2769
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2472
2770
|
"task_override",
|
|
2473
|
-
/** Nothing
|
|
2771
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2474
2772
|
"provider_default",
|
|
2475
2773
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2476
2774
|
"unspecified"
|
|
@@ -2514,10 +2812,10 @@ function readFiniteNumber(value) {
|
|
|
2514
2812
|
}
|
|
2515
2813
|
function parseModelSelection(raw) {
|
|
2516
2814
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2517
|
-
const
|
|
2815
|
+
const record2 = raw;
|
|
2518
2816
|
const history = [];
|
|
2519
|
-
if (Array.isArray(
|
|
2520
|
-
for (const entry of
|
|
2817
|
+
if (Array.isArray(record2.history)) {
|
|
2818
|
+
for (const entry of record2.history) {
|
|
2521
2819
|
if (!entry || typeof entry !== "object") continue;
|
|
2522
2820
|
const e = entry;
|
|
2523
2821
|
const value = readString(e.value);
|
|
@@ -2526,14 +2824,14 @@ function parseModelSelection(raw) {
|
|
|
2526
2824
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2527
2825
|
}
|
|
2528
2826
|
}
|
|
2529
|
-
const requested = readString(
|
|
2530
|
-
const launchValue = readString(
|
|
2531
|
-
const resolvedDefault = readString(
|
|
2532
|
-
const current = readString(
|
|
2533
|
-
const observed = readString(
|
|
2534
|
-
const observedAt = readFiniteNumber(
|
|
2827
|
+
const requested = readString(record2.requested);
|
|
2828
|
+
const launchValue = readString(record2.launchValue);
|
|
2829
|
+
const resolvedDefault = readString(record2.resolvedDefault);
|
|
2830
|
+
const current = readString(record2.current);
|
|
2831
|
+
const observed = readString(record2.observed);
|
|
2832
|
+
const observedAt = readFiniteNumber(record2.observedAt);
|
|
2535
2833
|
return {
|
|
2536
|
-
source: isModelAxisSource(
|
|
2834
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2537
2835
|
...requested ? { requested } : {},
|
|
2538
2836
|
...launchValue ? { launchValue } : {},
|
|
2539
2837
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
@@ -2545,22 +2843,24 @@ function parseModelSelection(raw) {
|
|
|
2545
2843
|
}
|
|
2546
2844
|
function parseSessionLaunchRecord(raw) {
|
|
2547
2845
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2548
|
-
const
|
|
2549
|
-
const sessionId = readString(
|
|
2550
|
-
const providerType = readString(
|
|
2551
|
-
const launchedAt = readFiniteNumber(
|
|
2552
|
-
const model = parseModelSelection(
|
|
2553
|
-
const thinkingLevel = parseModelSelection(
|
|
2846
|
+
const record2 = raw;
|
|
2847
|
+
const sessionId = readString(record2.sessionId);
|
|
2848
|
+
const providerType = readString(record2.providerType);
|
|
2849
|
+
const launchedAt = readFiniteNumber(record2.launchedAt);
|
|
2850
|
+
const model = parseModelSelection(record2.model);
|
|
2851
|
+
const thinkingLevel = parseModelSelection(record2.thinkingLevel);
|
|
2554
2852
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2555
|
-
const providerVersion = readString(
|
|
2556
|
-
const workspace = readString(
|
|
2557
|
-
const autoApproveModeId = readString(
|
|
2853
|
+
const providerVersion = readString(record2.providerVersion);
|
|
2854
|
+
const workspace = readString(record2.workspace);
|
|
2855
|
+
const autoApproveModeId = readString(record2.autoApproveModeId);
|
|
2856
|
+
const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
|
|
2558
2857
|
return {
|
|
2858
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2559
2859
|
sessionId,
|
|
2560
2860
|
providerType,
|
|
2561
2861
|
...providerVersion ? { providerVersion } : {},
|
|
2562
|
-
...
|
|
2563
|
-
launchedBy: isSessionLaunchedBy(
|
|
2862
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2863
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2564
2864
|
launchedAt,
|
|
2565
2865
|
...workspace ? { workspace } : {},
|
|
2566
2866
|
model,
|
|
@@ -2624,7 +2924,7 @@ function isTurnAttemptRefValue(value) {
|
|
|
2624
2924
|
function isTurnObserveResponse(value) {
|
|
2625
2925
|
return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
|
|
2626
2926
|
}
|
|
2627
|
-
var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
|
|
2927
|
+
var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
|
|
2628
2928
|
function isTurnOutcomeValue(value) {
|
|
2629
2929
|
return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
|
|
2630
2930
|
}
|
|
@@ -2925,12 +3225,13 @@ function isMeshMissionTaskAggregateWire(value) {
|
|
|
2925
3225
|
return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
|
|
2926
3226
|
}
|
|
2927
3227
|
function isMeshMissionStatsWire(value) {
|
|
2928
|
-
const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
3228
|
+
const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
|
|
2929
3229
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
2930
3230
|
if (!isEvidenceIdentifier(value.missionId)) return false;
|
|
2931
3231
|
for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
|
|
2932
3232
|
if (!isNonNegativeInt(value[k])) return false;
|
|
2933
3233
|
}
|
|
3234
|
+
if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
|
|
2934
3235
|
if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
|
|
2935
3236
|
if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
|
|
2936
3237
|
return true;
|
|
@@ -3052,12 +3353,13 @@ function isLedgerQueryEntryWire(value) {
|
|
|
3052
3353
|
return true;
|
|
3053
3354
|
}
|
|
3054
3355
|
function isLedgerQuerySummaryWire(value) {
|
|
3055
|
-
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
3356
|
+
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
3056
3357
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
3057
3358
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
3058
3359
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
3059
3360
|
if (!isNonNegativeInt(value[k])) return false;
|
|
3060
3361
|
}
|
|
3362
|
+
if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
|
|
3061
3363
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
3062
3364
|
return true;
|
|
3063
3365
|
}
|
|
@@ -3101,9 +3403,10 @@ function isQueueDependencyHeadWire(value) {
|
|
|
3101
3403
|
return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
|
|
3102
3404
|
}
|
|
3103
3405
|
function isQueueQueryResponse(value) {
|
|
3104
|
-
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
|
|
3406
|
+
if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
|
|
3105
3407
|
if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
|
|
3106
3408
|
if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
|
|
3409
|
+
if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
|
|
3107
3410
|
if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
|
|
3108
3411
|
if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
|
|
3109
3412
|
return true;
|
|
@@ -3225,6 +3528,17 @@ function isRecoveryContextQueryResponse(value) {
|
|
|
3225
3528
|
function decodeRecoveryContextQueryResponse(value) {
|
|
3226
3529
|
return isRecoveryContextQueryResponse(value) ? value : null;
|
|
3227
3530
|
}
|
|
3531
|
+
function decodeQueueReviseRequest(value) {
|
|
3532
|
+
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;
|
|
3533
|
+
const p = value.patch;
|
|
3534
|
+
if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
|
|
3535
|
+
if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
|
|
3536
|
+
for (const key of ["ownedPaths", "dependsOn"]) {
|
|
3537
|
+
if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
|
|
3538
|
+
}
|
|
3539
|
+
return value;
|
|
3540
|
+
}
|
|
3541
|
+
var decodeQueueReviseResponse = decodeQueueRequeueResponse;
|
|
3228
3542
|
|
|
3229
3543
|
// src/turn-ipc-stats.ts
|
|
3230
3544
|
function isTaskStatsQueryRequest(value) {
|
|
@@ -3323,6 +3637,7 @@ var TURN_IPC_COMMANDS = [
|
|
|
3323
3637
|
"queue_enqueue_batch",
|
|
3324
3638
|
"queue_cancel",
|
|
3325
3639
|
"queue_requeue",
|
|
3640
|
+
"queue_revise",
|
|
3326
3641
|
"direct_dispatch_record",
|
|
3327
3642
|
"active_work_query",
|
|
3328
3643
|
"recovery_context_query",
|
|
@@ -3406,14 +3721,11 @@ function normalizeOwnedPaths(input) {
|
|
|
3406
3721
|
}
|
|
3407
3722
|
function entryContains(base, path) {
|
|
3408
3723
|
if (path === base.path) return true;
|
|
3409
|
-
if (base.subtree && (path ===
|
|
3724
|
+
if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
|
|
3410
3725
|
return false;
|
|
3411
3726
|
}
|
|
3412
3727
|
function entriesOverlap(a, b) {
|
|
3413
|
-
|
|
3414
|
-
if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
|
|
3415
|
-
if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
|
|
3416
|
-
return false;
|
|
3728
|
+
return entryContains(a, b.path) || entryContains(b, a.path);
|
|
3417
3729
|
}
|
|
3418
3730
|
function pathsOverlap(a, b) {
|
|
3419
3731
|
if (a.paths.length === 0 || b.paths.length === 0) return false;
|
|
@@ -3685,7 +3997,15 @@ function foldKeyedDoc(held, delta, spec) {
|
|
|
3685
3997
|
const heldList = heldCollections.get(path);
|
|
3686
3998
|
if (change?.absent) {
|
|
3687
3999
|
const [head2, tail2] = splitPath(path);
|
|
3688
|
-
if (!tail2)
|
|
4000
|
+
if (!tail2) {
|
|
4001
|
+
delete next[head2];
|
|
4002
|
+
continue;
|
|
4003
|
+
}
|
|
4004
|
+
const parent2 = next[head2];
|
|
4005
|
+
if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
|
|
4006
|
+
const copy = { ...parent2 };
|
|
4007
|
+
delete copy[tail2];
|
|
4008
|
+
next[head2] = copy;
|
|
3689
4009
|
continue;
|
|
3690
4010
|
}
|
|
3691
4011
|
if (!change && heldList === void 0) continue;
|
|
@@ -3749,9 +4069,85 @@ function stableMeshNodeRow(row) {
|
|
|
3749
4069
|
}
|
|
3750
4070
|
return out;
|
|
3751
4071
|
}
|
|
4072
|
+
|
|
4073
|
+
// src/provider-approval.ts
|
|
4074
|
+
function isActionableProviderApproval(approval) {
|
|
4075
|
+
return !!approval && approval.source === "provider_modal" && approval.type === "tool_permission" && approval.lifecycle === "pending" && approval.evidence === "live" && approval.actionable && !!approval.modalKey && Array.isArray(approval.buttons) && approval.buttons.some((button) => typeof button === "string" && !!button.trim());
|
|
4076
|
+
}
|
|
4077
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
4078
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
4079
|
+
if (!waiting) return null;
|
|
4080
|
+
return {
|
|
4081
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
4082
|
+
type: "unknown",
|
|
4083
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
4084
|
+
evidence: "unavailable",
|
|
4085
|
+
lifecycle: "pending",
|
|
4086
|
+
modalKey: null,
|
|
4087
|
+
createdAt: null,
|
|
4088
|
+
resolvedAt: null,
|
|
4089
|
+
description: "",
|
|
4090
|
+
buttons: [],
|
|
4091
|
+
actionable: false
|
|
4092
|
+
};
|
|
4093
|
+
}
|
|
4094
|
+
function providerApprovalSnapshot(approval) {
|
|
4095
|
+
if (!approval) return null;
|
|
4096
|
+
const {
|
|
4097
|
+
source,
|
|
4098
|
+
type,
|
|
4099
|
+
lifecycle,
|
|
4100
|
+
modalKey,
|
|
4101
|
+
createdAt,
|
|
4102
|
+
resolvedAt,
|
|
4103
|
+
providerType,
|
|
4104
|
+
sessionId,
|
|
4105
|
+
nodeId,
|
|
4106
|
+
meshId,
|
|
4107
|
+
taskId,
|
|
4108
|
+
attemptId,
|
|
4109
|
+
generation
|
|
4110
|
+
} = approval;
|
|
4111
|
+
return {
|
|
4112
|
+
source,
|
|
4113
|
+
type,
|
|
4114
|
+
lifecycle,
|
|
4115
|
+
modalKey,
|
|
4116
|
+
createdAt,
|
|
4117
|
+
resolvedAt,
|
|
4118
|
+
providerType,
|
|
4119
|
+
sessionId,
|
|
4120
|
+
nodeId,
|
|
4121
|
+
meshId,
|
|
4122
|
+
taskId,
|
|
4123
|
+
attemptId,
|
|
4124
|
+
generation,
|
|
4125
|
+
evidence: "cached",
|
|
4126
|
+
actionable: false,
|
|
4127
|
+
description: "",
|
|
4128
|
+
buttons: []
|
|
4129
|
+
};
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
// src/provider-question.ts
|
|
4133
|
+
function isProviderQuestionBinding(value) {
|
|
4134
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4135
|
+
const b = value;
|
|
4136
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
4137
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
4138
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
4139
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
4140
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
4141
|
+
}
|
|
3752
4142
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3753
4143
|
0 && (module.exports = {
|
|
4144
|
+
ASSISTANT_ACCOUNT_SLOT,
|
|
4145
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
3754
4146
|
ASSISTANT_OWNER_VERBS,
|
|
4147
|
+
ASSISTANT_REMOTE_FOLLOW_COMMAND,
|
|
4148
|
+
ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
|
|
4149
|
+
ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
|
|
4150
|
+
ASSISTANT_REMOTE_PROJECT_COMMAND,
|
|
3755
4151
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
3756
4152
|
ASSISTANT_SESSION_ID_ARG,
|
|
3757
4153
|
ASSISTANT_SESSION_ID_ENV,
|
|
@@ -3788,6 +4184,10 @@ function stableMeshNodeRow(row) {
|
|
|
3788
4184
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3789
4185
|
EVIDENCE_SOURCE_IDS,
|
|
3790
4186
|
HOLD_REASONS,
|
|
4187
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
4188
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
4189
|
+
LAUNCH_DEFAULT_ROLES,
|
|
4190
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
3791
4191
|
LIVENESS_RESULTS,
|
|
3792
4192
|
MAX_MESH_RECORD_STRING,
|
|
3793
4193
|
MAX_OWNED_PATHS,
|
|
@@ -3828,6 +4228,8 @@ function stableMeshNodeRow(row) {
|
|
|
3828
4228
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
3829
4229
|
P2P_SIGNAL_TYPES,
|
|
3830
4230
|
PROVIDER_FAILURES,
|
|
4231
|
+
QUOTA_BACKFILL_HORIZON_MS,
|
|
4232
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3831
4233
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3832
4234
|
RECENT_SESSION_BUCKETS,
|
|
3833
4235
|
RECLAIMING_SEND_REFUSALS,
|
|
@@ -3873,9 +4275,11 @@ function stableMeshNodeRow(row) {
|
|
|
3873
4275
|
WORKER_BRANCH_STATES,
|
|
3874
4276
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3875
4277
|
WORKER_REPORT_OUTCOMES,
|
|
4278
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3876
4279
|
WORKER_TOOLS,
|
|
3877
4280
|
appendWorkerProtocolFooter,
|
|
3878
4281
|
argsCarryStatusProbeMarker,
|
|
4282
|
+
assessQuotaFreshness,
|
|
3879
4283
|
buildSlotProposal,
|
|
3880
4284
|
canonicalDaemonId,
|
|
3881
4285
|
classifySessionStatus,
|
|
@@ -3923,6 +4327,8 @@ function stableMeshNodeRow(row) {
|
|
|
3923
4327
|
decodeQueueQueryResponse,
|
|
3924
4328
|
decodeQueueRequeueRequest,
|
|
3925
4329
|
decodeQueueRequeueResponse,
|
|
4330
|
+
decodeQueueReviseRequest,
|
|
4331
|
+
decodeQueueReviseResponse,
|
|
3926
4332
|
decodeRecordLocalRequest,
|
|
3927
4333
|
decodeRecordLocalResponse,
|
|
3928
4334
|
decodeRecoveryContextQueryRequest,
|
|
@@ -3952,10 +4358,13 @@ function stableMeshNodeRow(row) {
|
|
|
3952
4358
|
expandDaemonIdForms,
|
|
3953
4359
|
findOwnershipConflicts,
|
|
3954
4360
|
foldKeyedDoc,
|
|
4361
|
+
followedRemoteProjectKey,
|
|
3955
4362
|
formatQuotaAccount,
|
|
3956
4363
|
hasGitStatusEvidence,
|
|
3957
4364
|
hasWorkerProtocolFooter,
|
|
3958
4365
|
interpolateString,
|
|
4366
|
+
isActionableProviderApproval,
|
|
4367
|
+
isAssistantFollowerAllowedOp,
|
|
3959
4368
|
isAssistantTool,
|
|
3960
4369
|
isBlockedStatus,
|
|
3961
4370
|
isBusyStatus,
|
|
@@ -3977,6 +4386,8 @@ function stableMeshNodeRow(row) {
|
|
|
3977
4386
|
isFiniteNumber,
|
|
3978
4387
|
isIdleSessionState,
|
|
3979
4388
|
isInputEnvelopeWire,
|
|
4389
|
+
isLaunchDefaultRole,
|
|
4390
|
+
isLaunchDefaultSource,
|
|
3980
4391
|
isMeshDeliveryMode,
|
|
3981
4392
|
isMeshIndexQueryResponse,
|
|
3982
4393
|
isMeshMissionStatusValue,
|
|
@@ -3991,12 +4402,14 @@ function stableMeshNodeRow(row) {
|
|
|
3991
4402
|
isMessageId,
|
|
3992
4403
|
isMissionUpsertResponse,
|
|
3993
4404
|
isModelAxisSource,
|
|
4405
|
+
isNativeMarkerRef,
|
|
3994
4406
|
isNonEmptyString,
|
|
3995
4407
|
isNotifyKind,
|
|
3996
4408
|
isOutboundMessage,
|
|
3997
4409
|
isOutboundMessageOrigin,
|
|
3998
4410
|
isP2PSignalType,
|
|
3999
4411
|
isPhantomDaemonEntry,
|
|
4412
|
+
isProviderQuestionBinding,
|
|
4000
4413
|
isRawDaemonDoId,
|
|
4001
4414
|
isReadyStatus,
|
|
4002
4415
|
isRecord,
|
|
@@ -4034,6 +4447,7 @@ function stableMeshNodeRow(row) {
|
|
|
4034
4447
|
meshUtf8ByteLength,
|
|
4035
4448
|
meshWorkspacesEquivalent,
|
|
4036
4449
|
mintMessageId,
|
|
4450
|
+
minutesUntilQuotaCheck,
|
|
4037
4451
|
normalizeAuthOkLimits,
|
|
4038
4452
|
normalizeBrainSlot,
|
|
4039
4453
|
normalizeDifficultyBrainMap,
|
|
@@ -4050,17 +4464,20 @@ function stableMeshNodeRow(row) {
|
|
|
4050
4464
|
normalizeThinkingLevel,
|
|
4051
4465
|
orderProvidersByBuiltinPreference,
|
|
4052
4466
|
parseJsonRecord,
|
|
4467
|
+
parseRoleLaunchSelection,
|
|
4053
4468
|
parseSemver,
|
|
4054
4469
|
parseSessionLaunchRecord,
|
|
4055
4470
|
pathsOverlap,
|
|
4056
4471
|
pickBestTransitGitStatus,
|
|
4057
4472
|
projectFileDiffRow,
|
|
4058
4473
|
projectTurnEvidenceEntry,
|
|
4474
|
+
providerApprovalSnapshot,
|
|
4059
4475
|
readBoolean,
|
|
4060
4476
|
readEnvelopeFields,
|
|
4061
4477
|
readGitSubmodules,
|
|
4062
4478
|
readNumber,
|
|
4063
4479
|
readOptionalRecord,
|
|
4480
|
+
readProviderDecision,
|
|
4064
4481
|
readRecord,
|
|
4065
4482
|
readString,
|
|
4066
4483
|
readStringArray,
|
|
@@ -4071,6 +4488,7 @@ function stableMeshNodeRow(row) {
|
|
|
4071
4488
|
retiredMeshToolError,
|
|
4072
4489
|
sanitizeModelIdentifier,
|
|
4073
4490
|
sanitizeRefusalCode,
|
|
4491
|
+
sanitizeRemoteRepoIdentity,
|
|
4074
4492
|
scoreGitStatusCandidate,
|
|
4075
4493
|
scoreGitUpstreamFreshness,
|
|
4076
4494
|
sessionIdsEquivalent,
|
|
@@ -4081,6 +4499,7 @@ function stableMeshNodeRow(row) {
|
|
|
4081
4499
|
summarizeGitShape,
|
|
4082
4500
|
supportsQuota,
|
|
4083
4501
|
touchedFilesOutsideOwnership,
|
|
4502
|
+
unwrapPastedContent,
|
|
4084
4503
|
withStatusProbeMarker
|
|
4085
4504
|
});
|
|
4086
4505
|
//# sourceMappingURL=index.js.map
|