@adhdev/mesh-shared 1.0.82-rc.4 → 1.0.82-rc.40

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.
Files changed (65) hide show
  1. package/dist/assistant-protocol.d.ts +161 -6
  2. package/dist/decision-push-relay.d.ts +20 -0
  3. package/dist/index.d.ts +11 -0
  4. package/dist/index.js +1197 -118
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1107 -118
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/launch-defaults.d.ts +196 -0
  9. package/dist/mesh-tool-names.d.ts +2 -2
  10. package/dist/mesh-vocabulary.d.ts +13 -4
  11. package/dist/mission-git-state.d.ts +83 -0
  12. package/dist/mission-items.d.ts +202 -0
  13. package/dist/node-facts.d.ts +75 -1
  14. package/dist/outbound-message.d.ts +9 -2
  15. package/dist/path-ownership.d.ts +1 -1
  16. package/dist/protocol/daemon-server.d.ts +42 -2
  17. package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
  18. package/dist/protocol/dashboard-server.d.ts +20 -2
  19. package/dist/provider-approval.d.ts +36 -0
  20. package/dist/provider-question.d.ts +19 -0
  21. package/dist/quota-freshness.d.ts +65 -0
  22. package/dist/relay-reprobe.d.ts +52 -0
  23. package/dist/release.d.ts +90 -0
  24. package/dist/role-launch.d.ts +11 -0
  25. package/dist/session-launch.d.ts +10 -22
  26. package/dist/slot-proposal.d.ts +14 -0
  27. package/dist/task-source-phase.d.ts +75 -0
  28. package/dist/turn-evidence.d.ts +29 -13
  29. package/dist/turn-ipc-mission.d.ts +68 -1
  30. package/dist/turn-ipc-queue.d.ts +19 -0
  31. package/dist/turn-ipc.d.ts +2 -2
  32. package/dist/types.d.ts +1 -0
  33. package/dist/worker-protocol.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/assistant-protocol.ts +302 -6
  36. package/src/daemon-normalize.ts +7 -5
  37. package/src/decision-push-relay.ts +23 -0
  38. package/src/index.ts +12 -0
  39. package/src/keyed-doc-delta.ts +9 -1
  40. package/src/launch-defaults.ts +170 -0
  41. package/src/mesh-tool-names.ts +16 -0
  42. package/src/mesh-vocabulary.ts +12 -2
  43. package/src/mission-git-state.ts +112 -0
  44. package/src/mission-items.ts +421 -0
  45. package/src/node-facts.ts +70 -1
  46. package/src/outbound-message.ts +19 -0
  47. package/src/path-ownership.ts +4 -6
  48. package/src/protocol/daemon-server.ts +37 -2
  49. package/src/protocol/dashboard-server.ts +13 -2
  50. package/src/provider-approval.ts +59 -0
  51. package/src/provider-question.ts +31 -0
  52. package/src/quota-freshness.ts +139 -0
  53. package/src/relay-reprobe.ts +117 -0
  54. package/src/release.ts +121 -0
  55. package/src/role-launch.ts +51 -0
  56. package/src/session-launch.ts +17 -1
  57. package/src/slot-proposal.ts +61 -2
  58. package/src/task-source-phase.ts +61 -0
  59. package/src/turn-evidence.ts +27 -20
  60. package/src/turn-ipc-mission.ts +121 -11
  61. package/src/turn-ipc-queue.ts +29 -1
  62. package/src/turn-ipc-turn.ts +1 -1
  63. package/src/turn-ipc.ts +1 -0
  64. package/src/types.ts +1 -0
  65. package/src/worker-protocol.ts +15 -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,
@@ -32,12 +38,16 @@ __export(index_exports, {
32
38
  CANCEL_REASONS: () => CANCEL_REASONS,
33
39
  CANONICAL_MESH_TOOL_COUNT: () => CANONICAL_MESH_TOOL_COUNT,
34
40
  CANONICAL_MESH_TOOL_NAMES: () => CANONICAL_MESH_TOOL_NAMES,
41
+ CARRY_OVER_MISSION_GOAL: () => CARRY_OVER_MISSION_GOAL,
42
+ CARRY_OVER_MISSION_TITLE: () => CARRY_OVER_MISSION_TITLE,
43
+ CHANGELOG_SECTIONS: () => CHANGELOG_SECTIONS,
35
44
  CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX: () => CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
36
45
  CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX: () => CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
37
46
  CLI_SLOT_RECIPES: () => CLI_SLOT_RECIPES,
38
47
  COMMIT_STRENGTHS: () => COMMIT_STRENGTHS,
39
48
  CONSUME_PROFILES: () => CONSUME_PROFILES,
40
49
  COORDINATOR_ACK_OUTCOMES: () => COORDINATOR_ACK_OUTCOMES,
50
+ COORDINATOR_SETTABLE_ITEM_STATES: () => COORDINATOR_SETTABLE_ITEM_STATES,
41
51
  DAEMON_METADATA_DOC_SPEC: () => DAEMON_METADATA_DOC_SPEC,
42
52
  DAEMON_P2P_SIGNAL_TYPES: () => DAEMON_P2P_SIGNAL_TYPES,
43
53
  DAEMON_STATUS_EVENT_NAMES: () => DAEMON_STATUS_EVENT_NAMES,
@@ -50,6 +60,11 @@ __export(index_exports, {
50
60
  DASHBOARD_TO_DAEMON_P2P_TYPES: () => DASHBOARD_TO_DAEMON_P2P_TYPES,
51
61
  DASHBOARD_TO_USER_SESSION_TYPES: () => DASHBOARD_TO_USER_SESSION_TYPES,
52
62
  DASHBOARD_WIRE_VERSION: () => DASHBOARD_WIRE_VERSION,
63
+ DECISION_PUSH_OPTIONS_MAX: () => DECISION_PUSH_OPTIONS_MAX,
64
+ DECISION_PUSH_OPTION_LABEL_MAX: () => DECISION_PUSH_OPTION_LABEL_MAX,
65
+ DECISION_PUSH_QUESTION_MAX: () => DECISION_PUSH_QUESTION_MAX,
66
+ DECISION_PUSH_RELAY_COMMAND: () => DECISION_PUSH_RELAY_COMMAND,
67
+ DECISION_PUSH_RELAY_SOURCE: () => DECISION_PUSH_RELAY_SOURCE,
53
68
  DEFAULT_DIFFICULTY_BRAINS: () => DEFAULT_DIFFICULTY_BRAINS,
54
69
  DELIVERY_OUTCOMES: () => DELIVERY_OUTCOMES,
55
70
  DELIVERY_VIAS: () => DELIVERY_VIAS,
@@ -57,6 +72,11 @@ __export(index_exports, {
57
72
  EVIDENCE_ENVELOPE_FIELD_SPECS: () => EVIDENCE_ENVELOPE_FIELD_SPECS,
58
73
  EVIDENCE_SOURCE_IDS: () => EVIDENCE_SOURCE_IDS,
59
74
  HOLD_REASONS: () => HOLD_REASONS,
75
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE: () => LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
76
+ LAUNCH_DEFAULT_ERROR_CODES: () => LAUNCH_DEFAULT_ERROR_CODES,
77
+ LAUNCH_DEFAULT_ROLES: () => LAUNCH_DEFAULT_ROLES,
78
+ LAUNCH_DEFAULT_SOURCES: () => LAUNCH_DEFAULT_SOURCES,
79
+ LEGACY_CARRY_OVER_MISSION_TITLE: () => LEGACY_CARRY_OVER_MISSION_TITLE,
60
80
  LIVENESS_RESULTS: () => LIVENESS_RESULTS,
61
81
  MAX_MESH_RECORD_STRING: () => MAX_MESH_RECORD_STRING,
62
82
  MAX_OWNED_PATHS: () => MAX_OWNED_PATHS,
@@ -71,6 +91,8 @@ __export(index_exports, {
71
91
  MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
72
92
  MESH_P2P_SIGNAL_TYPES: () => MESH_P2P_SIGNAL_TYPES,
73
93
  MESH_RECORD_PAYLOAD_KEYS: () => MESH_RECORD_PAYLOAD_KEYS,
94
+ MESH_RELEASE_CHANNELS: () => MESH_RELEASE_CHANNELS,
95
+ MESH_RELEASE_STATUSES: () => MESH_RELEASE_STATUSES,
74
96
  MESH_SESSION_CLEANUP_MODES: () => MESH_SESSION_CLEANUP_MODES,
75
97
  MESH_STATUS_DOC_SPEC: () => MESH_STATUS_DOC_SPEC,
76
98
  MESH_TASK_DIFFICULTIES: () => MESH_TASK_DIFFICULTIES,
@@ -82,10 +104,23 @@ __export(index_exports, {
82
104
  MESH_TOPIC_ENTRY_KINDS: () => MESH_TOPIC_ENTRY_KINDS,
83
105
  MESH_TOPIC_PROTOCOL_VERSION: () => MESH_TOPIC_PROTOCOL_VERSION,
84
106
  MISSION_BRIEF_RENDER_MAX_CHARS: () => MISSION_BRIEF_RENDER_MAX_CHARS,
107
+ MISSION_DECISION_ON_DUE: () => MISSION_DECISION_ON_DUE,
108
+ MISSION_DECISION_OPTION_IDS: () => MISSION_DECISION_OPTION_IDS,
109
+ MISSION_DECISION_URGENCIES: () => MISSION_DECISION_URGENCIES,
110
+ MISSION_GIT_STATES: () => MISSION_GIT_STATES,
111
+ MISSION_ITEM_KINDS: () => MISSION_ITEM_KINDS,
112
+ MISSION_ITEM_STATES: () => MISSION_ITEM_STATES,
113
+ MISSION_LIMITS: () => MISSION_LIMITS,
114
+ MISSION_OUTCOMES: () => MISSION_OUTCOMES,
115
+ MISSION_REF_GIT_METHODS: () => MISSION_REF_GIT_METHODS,
116
+ MISSION_REF_GIT_STATUSES: () => MISSION_REF_GIT_STATUSES,
117
+ MISSION_REF_KINDS: () => MISSION_REF_KINDS,
118
+ MISSION_RELEASE_EVENT_TYPES: () => MISSION_RELEASE_EVENT_TYPES,
85
119
  MODEL_AXIS_SOURCES: () => MODEL_AXIS_SOURCES,
86
120
  MODEL_SELECTION_HISTORY_LIMIT: () => MODEL_SELECTION_HISTORY_LIMIT,
87
121
  MeshChunkAssembler: () => MeshChunkAssembler,
88
122
  NATIVE_TURN_OUTCOMES: () => NATIVE_TURN_OUTCOMES,
123
+ NEEDS_WORDING_MARKER: () => NEEDS_WORDING_MARKER,
89
124
  NOTIFY_KINDS: () => NOTIFY_KINDS,
90
125
  NO_PROGRESS_OBSERVED_STATUSES: () => NO_PROGRESS_OBSERVED_STATUSES,
91
126
  NPM_UPDATE_TAGS: () => NPM_UPDATE_TAGS,
@@ -95,14 +130,27 @@ __export(index_exports, {
95
130
  OPERATOR_STATUS_REASON_VALUES: () => OPERATOR_STATUS_REASON_VALUES,
96
131
  OPERATOR_STATUS_VALUES: () => OPERATOR_STATUS_VALUES,
97
132
  OUTBOUND_MESSAGE_ORIGINS: () => OUTBOUND_MESSAGE_ORIGINS,
133
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX: () => OWNER_ABANDON_CONFIRM_KEY_PREFIX,
134
+ OWNER_ABANDON_CONFIRM_OPTIONS: () => OWNER_ABANDON_CONFIRM_OPTIONS,
135
+ OWNER_ABANDON_CONFIRM_QUESTION: () => OWNER_ABANDON_CONFIRM_QUESTION,
98
136
  P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
99
137
  PROVIDER_FAILURES: () => PROVIDER_FAILURES,
138
+ QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
139
+ QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
100
140
  QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
101
141
  RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
102
142
  RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
143
+ RELAY_REPROBE_BASE_DELAY_MS: () => RELAY_REPROBE_BASE_DELAY_MS,
144
+ RELAY_REPROBE_JITTER_RATIO: () => RELAY_REPROBE_JITTER_RATIO,
145
+ RELAY_REPROBE_MAX_DELAY_MS: () => RELAY_REPROBE_MAX_DELAY_MS,
146
+ RELEASE_ACTORS: () => RELEASE_ACTORS,
103
147
  RELEASE_CHANNELS: () => RELEASE_CHANNELS,
148
+ RELEASE_EVENT_TYPES: () => RELEASE_EVENT_TYPES,
149
+ RELEASE_LIMITS: () => RELEASE_LIMITS,
150
+ RELEASE_MEMBER_STATES: () => RELEASE_MEMBER_STATES,
104
151
  REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
105
152
  RETIRED_MESH_TOOLS: () => RETIRED_MESH_TOOLS,
153
+ RelayReprobeScheduler: () => RelayReprobeScheduler,
106
154
  SEND_POLICY_MODES: () => SEND_POLICY_MODES,
107
155
  SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
108
156
  SERVER_STATUS_EVENT_NAMES: () => SERVER_STATUS_EVENT_NAMES,
@@ -140,16 +188,25 @@ __export(index_exports, {
140
188
  VERSION_UPDATE_REASONS: () => VERSION_UPDATE_REASONS,
141
189
  VIEWER_TO_SHARED_SESSION_TYPES: () => VIEWER_TO_SHARED_SESSION_TYPES,
142
190
  WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
191
+ WORKER_COMMITS_MAX: () => WORKER_COMMITS_MAX,
192
+ WORKER_DECISIONS_NEEDED_MAX: () => WORKER_DECISIONS_NEEDED_MAX,
143
193
  WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
144
194
  WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
195
+ WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
145
196
  WORKER_TOOLS: () => WORKER_TOOLS,
197
+ aggregateMissionGitState: () => aggregateMissionGitState,
146
198
  appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
147
199
  argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
200
+ assessQuotaFreshness: () => assessQuotaFreshness,
201
+ boundEventPayload: () => boundEventPayload,
148
202
  buildSlotProposal: () => buildSlotProposal,
149
203
  canonicalDaemonId: () => canonicalDaemonId,
204
+ changelogMissionMarker: () => changelogMissionMarker,
205
+ classifyChangelogSection: () => classifyChangelogSection,
150
206
  classifySessionStatus: () => classifySessionStatus,
151
207
  compareDashboardWireVersion: () => compareDashboardWireVersion,
152
208
  compareSemver: () => compareSemver,
209
+ computeRelayReprobeDelay: () => computeRelayReprobeDelay,
153
210
  daemonIdsEquivalent: () => daemonIdsEquivalent,
154
211
  decodeActiveWorkQueryRequest: () => decodeActiveWorkQueryRequest,
155
212
  decodeActiveWorkQueryResponse: () => decodeActiveWorkQueryResponse,
@@ -192,6 +249,8 @@ __export(index_exports, {
192
249
  decodeQueueQueryResponse: () => decodeQueueQueryResponse,
193
250
  decodeQueueRequeueRequest: () => decodeQueueRequeueRequest,
194
251
  decodeQueueRequeueResponse: () => decodeQueueRequeueResponse,
252
+ decodeQueueReviseRequest: () => decodeQueueReviseRequest,
253
+ decodeQueueReviseResponse: () => decodeQueueReviseResponse,
195
254
  decodeRecordLocalRequest: () => decodeRecordLocalRequest,
196
255
  decodeRecordLocalResponse: () => decodeRecordLocalResponse,
197
256
  decodeRecoveryContextQueryRequest: () => decodeRecoveryContextQueryRequest,
@@ -211,6 +270,7 @@ __export(index_exports, {
211
270
  decodeUserSessionToDashboard: () => decodeUserSessionToDashboard,
212
271
  decodeViewerToSharedSession: () => decodeViewerToSharedSession,
213
272
  defaultProviderPriorityFromNodeFacts: () => defaultProviderPriorityFromNodeFacts,
273
+ deriveItemDedupeKey: () => deriveItemDedupeKey,
214
274
  deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
215
275
  deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
216
276
  describeModelSelection: () => describeModelSelection,
@@ -221,13 +281,19 @@ __export(index_exports, {
221
281
  expandDaemonIdForms: () => expandDaemonIdForms,
222
282
  findOwnershipConflicts: () => findOwnershipConflicts,
223
283
  foldKeyedDoc: () => foldKeyedDoc,
284
+ followedRemoteProjectKey: () => followedRemoteProjectKey,
285
+ followerOpPermitted: () => followerOpPermitted,
224
286
  formatQuotaAccount: () => formatQuotaAccount,
225
287
  hasGitStatusEvidence: () => hasGitStatusEvidence,
226
288
  hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
227
289
  interpolateString: () => interpolateString,
290
+ isActionableProviderApproval: () => isActionableProviderApproval,
291
+ isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
228
292
  isAssistantTool: () => isAssistantTool,
229
293
  isBlockedStatus: () => isBlockedStatus,
230
294
  isBusyStatus: () => isBusyStatus,
295
+ isCarryOverMissionRecord: () => isCarryOverMissionRecord,
296
+ isCarryOverMissionTitle: () => isCarryOverMissionTitle,
231
297
  isChunkType: () => isChunkType,
232
298
  isCommitStrength: () => isCommitStrength,
233
299
  isDaemonDirectCommandType: () => isDaemonDirectCommandType,
@@ -246,11 +312,14 @@ __export(index_exports, {
246
312
  isFiniteNumber: () => isFiniteNumber,
247
313
  isIdleSessionState: () => isIdleSessionState,
248
314
  isInputEnvelopeWire: () => isInputEnvelopeWire,
315
+ isLaunchDefaultRole: () => isLaunchDefaultRole,
316
+ isLaunchDefaultSource: () => isLaunchDefaultSource,
249
317
  isMeshDeliveryMode: () => isMeshDeliveryMode,
250
318
  isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
251
319
  isMeshMissionStatusValue: () => isMeshMissionStatusValue,
252
320
  isMeshP2PSignalType: () => isMeshP2PSignalType,
253
321
  isMeshRecordPayload: () => isMeshRecordPayload,
322
+ isMeshReleaseChannel: () => isMeshReleaseChannel,
254
323
  isMeshTaskDifficulty: () => isMeshTaskDifficulty,
255
324
  isMeshTaskMode: () => isMeshTaskMode,
256
325
  isMeshTaskPriority: () => isMeshTaskPriority,
@@ -258,17 +327,22 @@ __export(index_exports, {
258
327
  isMeshTerminalTaskStatus: () => isMeshTerminalTaskStatus,
259
328
  isMeshTopicEntry: () => isMeshTopicEntry,
260
329
  isMessageId: () => isMessageId,
330
+ isMissionOutcome: () => isMissionOutcome,
331
+ isMissionRefContained: () => isMissionRefContained,
261
332
  isMissionUpsertResponse: () => isMissionUpsertResponse,
262
333
  isModelAxisSource: () => isModelAxisSource,
334
+ isNativeMarkerRef: () => isNativeMarkerRef,
263
335
  isNonEmptyString: () => isNonEmptyString,
264
336
  isNotifyKind: () => isNotifyKind,
265
337
  isOutboundMessage: () => isOutboundMessage,
266
338
  isOutboundMessageOrigin: () => isOutboundMessageOrigin,
267
339
  isP2PSignalType: () => isP2PSignalType,
268
340
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
341
+ isProviderQuestionBinding: () => isProviderQuestionBinding,
269
342
  isRawDaemonDoId: () => isRawDaemonDoId,
270
343
  isReadyStatus: () => isReadyStatus,
271
344
  isRecord: () => isRecord,
345
+ isReleaseStatus: () => isReleaseStatus,
272
346
  isSendPolicy: () => isSendPolicy,
273
347
  isSendPolicyMode: () => isSendPolicyMode,
274
348
  isSendRefusal: () => isSendRefusal,
@@ -295,6 +369,7 @@ __export(index_exports, {
295
369
  isWorkingStatus: () => isWorkingStatus,
296
370
  joinRepoPath: () => joinRepoPath,
297
371
  launchModelSelectionValue: () => launchModelSelectionValue,
372
+ lintChangelogText: () => lintChangelogText,
298
373
  machineCoreFromDaemonId: () => machineCoreFromDaemonId,
299
374
  makeTypeGuard: () => makeTypeGuard,
300
375
  measureWorstCaseChunkEnvelopeBytes: () => measureWorstCaseChunkEnvelopeBytes,
@@ -303,33 +378,45 @@ __export(index_exports, {
303
378
  meshUtf8ByteLength: () => meshUtf8ByteLength,
304
379
  meshWorkspacesEquivalent: () => meshWorkspacesEquivalent,
305
380
  mintMessageId: () => mintMessageId,
381
+ minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
306
382
  normalizeAuthOkLimits: () => normalizeAuthOkLimits,
307
383
  normalizeBrainSlot: () => normalizeBrainSlot,
384
+ normalizeDecisionInput: () => normalizeDecisionInput,
308
385
  normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
386
+ normalizeForDedupe: () => normalizeForDedupe,
309
387
  normalizeGitStatus: () => normalizeGitStatus,
310
388
  normalizeMeshNodeFacts: () => normalizeMeshNodeFacts,
311
389
  normalizeMeshNodeId: () => normalizeMeshNodeId,
312
390
  normalizeMeshSessionRecord: () => normalizeMeshSessionRecord,
313
391
  normalizeMeshWorkspaceForCompare: () => normalizeMeshWorkspaceForCompare,
314
392
  normalizeMissionBrief: () => normalizeMissionBrief,
393
+ normalizeMissionItemInput: () => normalizeMissionItemInput,
394
+ normalizeMissionItemUpdate: () => normalizeMissionItemUpdate,
395
+ normalizeMissionRefs: () => normalizeMissionRefs,
396
+ normalizeMissionSummary: () => normalizeMissionSummary,
315
397
  normalizeNodeCapabilitySlot: () => normalizeNodeCapabilitySlot,
316
398
  normalizeNodeCapabilitySlots: () => normalizeNodeCapabilitySlots,
399
+ normalizeOutcomeReason: () => normalizeOutcomeReason,
317
400
  normalizeOwnedPaths: () => normalizeOwnedPaths,
401
+ normalizeReportCommits: () => normalizeReportCommits,
318
402
  normalizeSessionStatus: () => normalizeSessionStatus,
319
403
  normalizeThinkingLevel: () => normalizeThinkingLevel,
320
404
  orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
321
405
  parseJsonRecord: () => parseJsonRecord,
406
+ parseRoleLaunchSelection: () => parseRoleLaunchSelection,
322
407
  parseSemver: () => parseSemver,
323
408
  parseSessionLaunchRecord: () => parseSessionLaunchRecord,
324
409
  pathsOverlap: () => pathsOverlap,
325
410
  pickBestTransitGitStatus: () => pickBestTransitGitStatus,
326
411
  projectFileDiffRow: () => projectFileDiffRow,
327
412
  projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
413
+ providerApprovalSnapshot: () => providerApprovalSnapshot,
328
414
  readBoolean: () => readBoolean,
329
415
  readEnvelopeFields: () => readEnvelopeFields,
330
416
  readGitSubmodules: () => readGitSubmodules,
331
417
  readNumber: () => readNumber,
332
418
  readOptionalRecord: () => readOptionalRecord,
419
+ readProviderDecision: () => readProviderDecision,
333
420
  readRecord: () => readRecord,
334
421
  readString: () => readString,
335
422
  readStringArray: () => readStringArray,
@@ -340,6 +427,7 @@ __export(index_exports, {
340
427
  retiredMeshToolError: () => retiredMeshToolError,
341
428
  sanitizeModelIdentifier: () => sanitizeModelIdentifier,
342
429
  sanitizeRefusalCode: () => sanitizeRefusalCode,
430
+ sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
343
431
  scoreGitStatusCandidate: () => scoreGitStatusCandidate,
344
432
  scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
345
433
  sessionIdsEquivalent: () => sessionIdsEquivalent,
@@ -350,6 +438,8 @@ __export(index_exports, {
350
438
  summarizeGitShape: () => summarizeGitShape,
351
439
  supportsQuota: () => supportsQuota,
352
440
  touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
441
+ truncateMissionText: () => truncateMissionText,
442
+ unwrapPastedContent: () => unwrapPastedContent,
353
443
  withStatusProbeMarker: () => withStatusProbeMarker
354
444
  });
355
445
  module.exports = __toCommonJS(index_exports);
@@ -550,15 +640,15 @@ function pickBestTransitGitStatus(node, options) {
550
640
  }
551
641
 
552
642
  // src/session-normalize.ts
553
- function deriveSyntheticSessionId(record) {
643
+ function deriveSyntheticSessionId(record2) {
554
644
  const parts = [
555
- readString(record.workspace),
556
- readString(record.providerType, record.provider),
557
- readString(record.role),
558
- readString(record.state, record.status),
559
- readString(record.title),
560
- readString(record.createdAt, record.created_at),
561
- readString(record.startedAt, record.started_at)
645
+ readString(record2.workspace),
646
+ readString(record2.providerType, record2.provider),
647
+ readString(record2.role),
648
+ readString(record2.state, record2.status),
649
+ readString(record2.title),
650
+ readString(record2.createdAt, record2.created_at),
651
+ readString(record2.startedAt, record2.started_at)
562
652
  ].filter((part) => Boolean(part));
563
653
  if (parts.length === 0) return void 0;
564
654
  return `synthetic:${parts.join("|")}`;
@@ -570,33 +660,33 @@ function sessionIdsEquivalent(a, b) {
570
660
  return idA === idB;
571
661
  }
572
662
  function normalizeMeshSessionRecord(entry) {
573
- const record = readRecord(entry);
574
- const sessionId = readString(record.sessionId, record.session_id, record.id) ?? deriveSyntheticSessionId(record);
663
+ const record2 = readRecord(entry);
664
+ const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
575
665
  if (!sessionId) return null;
576
666
  return {
577
667
  sessionId,
578
- ...readString(record.providerType, record.provider) ? { providerType: readString(record.providerType, record.provider) } : {},
579
- ...readString(record.state, record.status) ? { state: readString(record.state, record.status) } : {},
580
- ...readString(record.chatStatus, record.chat_status) ? { chatStatus: readString(record.chatStatus, record.chat_status) } : {},
581
- ...readString(record.lifecycle) ? { lifecycle: readString(record.lifecycle) } : {},
582
- ...readString(record.surfaceKind, record.surface_kind) ? { surfaceKind: readString(record.surfaceKind, record.surface_kind) } : {},
583
- ...readString(record.recoveryState, record.recovery_state) ? { recoveryState: readString(record.recoveryState, record.recovery_state) } : {},
584
- ...readString(record.workspace) ? { workspace: readString(record.workspace) } : {},
585
- ...readString(record.title) ? { title: readString(record.title) } : {},
586
- ...readString(record.role) ? { role: readString(record.role) } : {},
587
- ...readBoolean(record.isSelfCoordinator, record.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record.isSelfCoordinator, record.is_self_coordinator) } : {},
588
- ...readString(record.statusNote, record.status_note) ? { statusNote: readString(record.statusNote, record.status_note) } : {},
589
- ...readString(record.createdAt, record.created_at) ? { createdAt: readString(record.createdAt, record.created_at) } : {},
590
- ...readString(record.startedAt, record.started_at) ? { startedAt: readString(record.startedAt, record.started_at) } : {},
591
- ...readString(record.lastActivityAt, record.last_activity_at) ? { lastActivityAt: readString(record.lastActivityAt, record.last_activity_at) } : {},
592
- ...readBoolean(record.isCached, record.is_cached) !== void 0 ? { isCached: readBoolean(record.isCached, record.is_cached) } : {}
668
+ ...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
669
+ ...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
670
+ ...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
671
+ ...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
672
+ ...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
673
+ ...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
674
+ ...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
675
+ ...readString(record2.title) ? { title: readString(record2.title) } : {},
676
+ ...readString(record2.role) ? { role: readString(record2.role) } : {},
677
+ ...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
678
+ ...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
679
+ ...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
680
+ ...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
681
+ ...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
682
+ ...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
593
683
  };
594
684
  }
595
685
 
596
686
  // src/node-normalize.ts
597
687
  function normalizeMeshNodeId(node) {
598
- const record = node && typeof node === "object" ? node : {};
599
- return readString(record.id, record.nodeId, record.node_id);
688
+ const record2 = node && typeof node === "object" ? node : {};
689
+ return readString(record2.id, record2.nodeId, record2.node_id);
600
690
  }
601
691
  function meshNodeIdMatches(node, candidateId) {
602
692
  if (!candidateId) return false;
@@ -608,12 +698,12 @@ function meshNodeIdMatches(node, candidateId) {
608
698
  // src/node-facts.ts
609
699
  function normalizeMeshNodeFacts(raw) {
610
700
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
611
- const record = raw;
612
- const schemaVersion = Number(record.schemaVersion);
613
- const reportedAt = Number(record.reportedAt);
701
+ const record2 = raw;
702
+ const schemaVersion = Number(record2.schemaVersion);
703
+ const reportedAt = Number(record2.reportedAt);
614
704
  if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
615
705
  if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
616
- return { ...record, schemaVersion, reportedAt };
706
+ return { ...record2, schemaVersion, reportedAt };
617
707
  }
618
708
  var QUOTA_SUPPORTED_PROVIDERS = [
619
709
  "antigravity-cli",
@@ -656,6 +746,52 @@ function defaultProviderPriorityFromNodeFacts(facts) {
656
746
  return orderProvidersByBuiltinPreference(detected.length ? detected : enabled);
657
747
  }
658
748
 
749
+ // src/quota-freshness.ts
750
+ var QUOTA_RETRY_INFLIGHT_GRACE_MS = 6e4;
751
+ var QUOTA_BACKFILL_HORIZON_MS = 60 * 60 * 1e3;
752
+ function hasUsableWindow(window) {
753
+ return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
754
+ }
755
+ function hasReading(quota) {
756
+ if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
757
+ return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
758
+ }
759
+ function finiteMs(value) {
760
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
761
+ }
762
+ function backfillCheckAt(quota, now) {
763
+ const dataDue = finiteMs(quota.updatedAt);
764
+ const attempted = finiteMs(quota.metadata?.fetchedAt);
765
+ const dueAt = Math.max(
766
+ dataDue === void 0 ? Number.NEGATIVE_INFINITY : dataDue + QUOTA_BACKFILL_HORIZON_MS,
767
+ attempted === void 0 ? Number.NEGATIVE_INFINITY : attempted + QUOTA_BACKFILL_HORIZON_MS
768
+ );
769
+ return Number.isFinite(dueAt) && dueAt > now ? dueAt : void 0;
770
+ }
771
+ function assessQuotaFreshness(quota, now = Date.now()) {
772
+ const meta = quota.metadata;
773
+ const kind = meta?.failureKind;
774
+ const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
775
+ const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
776
+ if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
777
+ if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
778
+ if (meta?.lastGoodWindows !== true) {
779
+ const measuredAt = finiteMs(quota.updatedAt);
780
+ if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
781
+ return { cue: "stale", userMustAct };
782
+ }
783
+ return { userMustAct };
784
+ }
785
+ const retryAtMs = finiteMs(meta?.retryAtMs);
786
+ const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
787
+ if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
788
+ const nextCheckAt = backfillCheckAt(quota, now);
789
+ return nextCheckAt === void 0 ? { cue: "stale", userMustAct: false } : { cue: "stale", userMustAct: false, nextCheckAt };
790
+ }
791
+ function minutesUntilQuotaCheck(nextCheckAt, now = Date.now()) {
792
+ return Math.max(1, Math.round((nextCheckAt - now) / 6e4));
793
+ }
794
+
659
795
  // src/workspace-normalize.ts
660
796
  function normalizeMeshWorkspaceForCompare(dir) {
661
797
  if (typeof dir !== "string") return "";
@@ -685,19 +821,21 @@ function isPhantomDaemonEntry(entry) {
685
821
  function machineCoreFromDaemonId(id2) {
686
822
  const trimmed = readString(id2);
687
823
  if (!trimmed) return void 0;
824
+ const lower = trimmed.toLowerCase();
688
825
  for (const prefix of DAEMON_ID_PREFIXES) {
689
- if (trimmed.startsWith(prefix)) {
826
+ if (lower.startsWith(prefix)) {
690
827
  const core = trimmed.slice(prefix.length).trim();
691
- return core || void 0;
828
+ if (!core) return void 0;
829
+ return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
692
830
  }
693
831
  }
694
- return trimmed;
832
+ return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
695
833
  }
696
834
  function canonicalDaemonId(id2) {
697
835
  const core = machineCoreFromDaemonId(id2);
698
836
  if (!core) return void 0;
699
- if (!core.startsWith("mach_")) return core;
700
- return `daemon_${core}`;
837
+ if (!/^mach_/i.test(core)) return core;
838
+ return `daemon_mach_${core.slice(5)}`;
701
839
  }
702
840
  function daemonIdsEquivalent(a, b) {
703
841
  const coreA = machineCoreFromDaemonId(a);
@@ -726,9 +864,9 @@ function expandDaemonIdForms(ids) {
726
864
 
727
865
  // src/git-summarize.ts
728
866
  function summarizeGitShape(status) {
729
- const record = readRecord(status);
730
- if (!Object.keys(record).length) return null;
731
- const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => {
867
+ const record2 = readRecord(status);
868
+ if (!Object.keys(record2).length) return null;
869
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
732
870
  const sub = readRecord(entry);
733
871
  return {
734
872
  path: readString(sub.path) ?? null,
@@ -738,23 +876,23 @@ function summarizeGitShape(status) {
738
876
  };
739
877
  }) : [];
740
878
  return {
741
- isGitRepo: readBoolean(record.isGitRepo),
742
- workspace: readString(record.workspace) ?? null,
743
- repoRoot: readString(record.repoRoot, record.repo_root) ?? null,
744
- branch: readString(record.branch) ?? null,
745
- upstream: readString(record.upstream) ?? null,
746
- upstreamStatus: readString(record.upstreamStatus, record.upstream_status) ?? null,
747
- headCommit: readString(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
748
- ahead: readNumber(record.ahead) ?? null,
749
- behind: readNumber(record.behind) ?? null,
879
+ isGitRepo: readBoolean(record2.isGitRepo),
880
+ workspace: readString(record2.workspace) ?? null,
881
+ repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
882
+ branch: readString(record2.branch) ?? null,
883
+ upstream: readString(record2.upstream) ?? null,
884
+ upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
885
+ headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
886
+ ahead: readNumber(record2.ahead) ?? null,
887
+ behind: readNumber(record2.behind) ?? null,
750
888
  dirtyCounts: {
751
- staged: readNumber(record.staged) ?? 0,
752
- modified: readNumber(record.modified) ?? 0,
753
- untracked: readNumber(record.untracked) ?? 0,
754
- deleted: readNumber(record.deleted) ?? 0,
755
- renamed: readNumber(record.renamed) ?? 0
889
+ staged: readNumber(record2.staged) ?? 0,
890
+ modified: readNumber(record2.modified) ?? 0,
891
+ untracked: readNumber(record2.untracked) ?? 0,
892
+ deleted: readNumber(record2.deleted) ?? 0,
893
+ renamed: readNumber(record2.renamed) ?? 0
756
894
  },
757
- lastCheckedAt: readNumber(record.lastCheckedAt, record.last_checked_at) ?? null,
895
+ lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
758
896
  submoduleCount: submodules.length,
759
897
  submodules
760
898
  };
@@ -920,10 +1058,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
920
1058
  ],
921
1059
  "antigravity-cli": [
922
1060
  {
923
- model: "Gemini 3.1 Pro (High)",
1061
+ model: "Gemini 3.8 Flash (High)",
1062
+ modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
924
1063
  difficulty: ["easy"],
925
1064
  maxParallel: 2,
926
1065
  rationale: "Cheap capacity for easy tasks."
1066
+ },
1067
+ {
1068
+ model: "Gemini 4 Argon (Medium)",
1069
+ modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
1070
+ difficulty: ["medium"],
1071
+ maxParallel: 2,
1072
+ rationale: "Balanced Argon tier for medium tasks."
1073
+ },
1074
+ {
1075
+ model: "Gemini 4 Argon (High)",
1076
+ modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
1077
+ difficulty: ["difficult"],
1078
+ maxParallel: 1,
1079
+ rationale: "Reserved for hard tasks; capped at 1 to bound cost."
927
1080
  }
928
1081
  ],
929
1082
  "cursor-cli": [
@@ -962,6 +1115,24 @@ function dedupeDetected(detected) {
962
1115
  }
963
1116
  return out;
964
1117
  }
1118
+ function resolveRecipeModel(recipe, modelOptions) {
1119
+ if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
1120
+ return recipe.model;
1121
+ }
1122
+ const available = new Set(
1123
+ modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
1124
+ );
1125
+ if (available.size === 0) return recipe.model;
1126
+ const candidates = [
1127
+ ...recipe.model ? [recipe.model] : [],
1128
+ ...recipe.modelCandidates ?? []
1129
+ ];
1130
+ for (const candidate of candidates) {
1131
+ const trimmed = typeof candidate === "string" ? candidate.trim() : "";
1132
+ if (trimmed && available.has(trimmed)) return trimmed;
1133
+ }
1134
+ return recipe.model;
1135
+ }
965
1136
  function buildSlotProposal(detected, currentSlots = []) {
966
1137
  const providers = dedupeDetected(detected ?? []);
967
1138
  const proposedSlots = [];
@@ -977,7 +1148,7 @@ function buildSlotProposal(detected, currentSlots = []) {
977
1148
  for (const recipe of recipes) {
978
1149
  const slot = normalizeNodeCapabilitySlot({
979
1150
  provider: provider.type,
980
- model: recipe.model,
1151
+ model: resolveRecipeModel(recipe, provider.modelOptions),
981
1152
  thinkingLevel: recipe.thinkingLevel,
982
1153
  difficulty: recipe.difficulty,
983
1154
  maxParallel: recipe.maxParallel
@@ -1030,7 +1201,9 @@ var CANONICAL_MESH_TOOL_NAMES = [
1030
1201
  "mesh_enqueue_task",
1031
1202
  "mesh_view_queue",
1032
1203
  "mesh_queue_cancel",
1204
+ "mesh_direct_cancel",
1033
1205
  "mesh_queue_requeue",
1206
+ "mesh_queue_revise",
1034
1207
  "mesh_send_task",
1035
1208
  "mesh_read_chat",
1036
1209
  "mesh_read_debug",
@@ -1047,8 +1220,11 @@ var CANONICAL_MESH_TOOL_NAMES = [
1047
1220
  "mesh_list_pending_approvals",
1048
1221
  "mesh_create",
1049
1222
  "mesh_add_node",
1223
+ "mesh_reattach_source_parent",
1224
+ "mesh_attach_remote",
1050
1225
  "mesh_clone_node",
1051
1226
  "mesh_remove_node",
1227
+ "mesh_retry_node_bootstrap",
1052
1228
  "mesh_cleanup_worktree_nodes",
1053
1229
  "mesh_refine_node",
1054
1230
  "mesh_refine_batch",
@@ -1065,8 +1241,19 @@ var CANONICAL_MESH_TOOL_NAMES = [
1065
1241
  "mesh_reconcile_ledger",
1066
1242
  "mesh_mission_upsert",
1067
1243
  "mesh_mission_list",
1244
+ "mesh_mission_git_eval",
1245
+ "mesh_release_upsert",
1246
+ "mesh_release_scope",
1247
+ "mesh_release_list",
1248
+ "mesh_release_record_deploy",
1249
+ "mesh_release_changelog_draft",
1068
1250
  "mesh_review_inbox",
1069
- "mesh_node_slots"
1251
+ "mesh_node_slots",
1252
+ "driver_list",
1253
+ "driver_describe",
1254
+ "artifact_list",
1255
+ "artifact_read",
1256
+ "artifact_register"
1070
1257
  ];
1071
1258
  var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
1072
1259
  var RETIRED_MESH_TOOLS = {
@@ -1376,9 +1563,15 @@ var DAEMON_STATUS_EVENT_NAMES = [
1376
1563
  "agent:waiting_choice",
1377
1564
  "agent:generating_completed",
1378
1565
  "agent:stopped",
1379
- "monitor:no_progress"
1566
+ "monitor:no_progress",
1567
+ // An owner decision (structured missions) needs the owner. Server-bound for the push only;
1568
+ // the dashboard learns about decisions over P2P (`mission_decisions_list`).
1569
+ "agent:decision_needed"
1380
1570
  ];
1381
1571
  var isDaemonStatusEventName = makeTypeGuard(DAEMON_STATUS_EVENT_NAMES);
1572
+ var DECISION_PUSH_QUESTION_MAX = 80;
1573
+ var DECISION_PUSH_OPTION_LABEL_MAX = 24;
1574
+ var DECISION_PUSH_OPTIONS_MAX = 3;
1382
1575
  var RELEASE_CHANNELS = ["stable", "preview"];
1383
1576
  var NPM_UPDATE_TAGS = ["latest", "next"];
1384
1577
  var VERSION_UPDATE_REASONS = ["force_update_below", "major_minor_mismatch", "patch_mismatch", "daemon_ahead"];
@@ -1741,21 +1934,22 @@ function isTerminalSessionRecordStatus(raw) {
1741
1934
  return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
1742
1935
  }
1743
1936
  function isIdleSessionState(state) {
1744
- const record = state && typeof state === "object" ? state : {};
1745
- const status = typeof record.status === "string" ? record.status.trim().toLowerCase() : "";
1937
+ const record2 = state && typeof state === "object" ? state : {};
1938
+ const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
1746
1939
  if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
1747
- return isReadyStatus(status) || record.activeChat?.status === "waiting_input";
1940
+ return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
1748
1941
  }
1749
1942
 
1750
1943
  // src/mesh-vocabulary.ts
1751
- var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
1752
- var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
1944
+ var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
1945
+ var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
1753
1946
  var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
1754
1947
  var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
1755
1948
  var MESH_THINKING_LEVELS = ["low", "medium", "high"];
1756
1949
  var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
1757
1950
  var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
1758
1951
  var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
1952
+ var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
1759
1953
  var WORKER_BRANCH_STATES = [
1760
1954
  "merged_to_main",
1761
1955
  "pushed_feature_branch_needs_merge",
@@ -1822,6 +2016,7 @@ var SEND_REFUSAL_REASONS = [
1822
2016
  "no_target",
1823
2017
  "bootstrap_pending",
1824
2018
  "duplicate_dispatch",
2019
+ "new_work_held",
1825
2020
  "internal_error"
1826
2021
  ];
1827
2022
  function isSendRefusal(value) {
@@ -1853,6 +2048,14 @@ function isOutboundMessage(value) {
1853
2048
  const candidate = value;
1854
2049
  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
2050
  }
2051
+ var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2052
+ var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2053
+ function unwrapPastedContent(text) {
2054
+ const lines = text.replace(/\r\n?/g, "\n").split("\n");
2055
+ const first = lines.findIndex((line) => line.trim());
2056
+ if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
2057
+ return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
2058
+ }
1856
2059
 
1857
2060
  // src/mission-brief.ts
1858
2061
  var GOAL_MAX = 500;
@@ -1938,7 +2141,22 @@ var WORKER_TOOLS = [
1938
2141
  "peer_context_pull",
1939
2142
  "git_status",
1940
2143
  "git_log",
1941
- "git_diff"
2144
+ "git_diff",
2145
+ "driver_list",
2146
+ "driver_describe",
2147
+ "driver_invoke",
2148
+ "driver_scaffold",
2149
+ "driver_validate",
2150
+ "driver_export",
2151
+ "driver_install",
2152
+ "artifact_register",
2153
+ "artifact_list",
2154
+ "artifact_read",
2155
+ // Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
2156
+ // read claim (C1) and the authoritative head/notice pull.
2157
+ "contract_read",
2158
+ "contract_observe",
2159
+ "contract_current"
1942
2160
  ];
1943
2161
  var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
1944
2162
  function isWorkerTool(value) {
@@ -2023,15 +2241,29 @@ function renderCoordinatorWorkerSection() {
2023
2241
  // src/assistant-protocol.ts
2024
2242
  var ASSISTANT_TOOLS = [
2025
2243
  "projects",
2244
+ "environment",
2245
+ "assistant_action",
2246
+ "project_watch",
2026
2247
  "project_status",
2027
2248
  "project_send",
2028
2249
  "project_read",
2029
2250
  "project_add",
2251
+ "project_attach_remote",
2030
2252
  "discover_repos",
2031
2253
  "memory",
2254
+ "memory_search",
2032
2255
  "skill_view",
2033
2256
  "skill_manage",
2034
- "project_note"
2257
+ "project_note",
2258
+ "launch_defaults",
2259
+ "launch_defaults_set",
2260
+ "driver_list",
2261
+ "driver_describe",
2262
+ "artifact_list",
2263
+ "artifact_read",
2264
+ "decision_answer",
2265
+ "decision_request",
2266
+ "session_control"
2035
2267
  ];
2036
2268
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
2037
2269
  function isAssistantTool(value) {
@@ -2039,50 +2271,167 @@ function isAssistantTool(value) {
2039
2271
  }
2040
2272
  var ASSISTANT_VERB = {
2041
2273
  // tool verbs
2274
+ driverList: "driver_list",
2275
+ driverDescribe: "driver_describe",
2042
2276
  projects: "assistant_projects",
2277
+ environment: "assistant_environment",
2278
+ action: "assistant_action",
2279
+ watch: "assistant_project_watch",
2280
+ executionState: "assistant_execution_state",
2281
+ executionSettings: "assistant_execution_settings",
2043
2282
  projectStatus: "assistant_project_status",
2044
2283
  projectSend: "assistant_project_send",
2045
2284
  projectRead: "assistant_project_read",
2046
2285
  projectAdd: "assistant_project_add",
2286
+ projectAttachRemote: "assistant_project_attach_remote",
2047
2287
  discoverRepos: "assistant_discover_repos",
2048
2288
  memory: "assistant_memory",
2289
+ /** Pull-only FTS search over the archive tier (memory design 2026-11-01 §3.4). */
2290
+ memorySearch: "assistant_memory_search",
2049
2291
  skillView: "assistant_skill_view",
2050
2292
  skillManage: "assistant_skill_manage",
2051
2293
  projectNote: "assistant_project_note",
2294
+ launchDefaults: "assistant_launch_defaults",
2295
+ launchDefaultsSet: "assistant_launch_defaults_set",
2296
+ artifactList: "assistant_artifact_list",
2297
+ artifactRead: "assistant_artifact_read",
2298
+ /** Owner-decision inbox (structured-missions design 2026-10-28 §6.3): the owner's words recorded as answers. */
2299
+ decisionAnswer: "assistant_decision_answer",
2300
+ /** Register a plain-text question a coordinator put to the owner as a decision item (§5.2). */
2301
+ decisionRequest: "assistant_decision_request",
2302
+ /** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
2303
+ sessionControl: "assistant_session_control",
2052
2304
  // assistant-side daemon verbs without a tool of the same name
2053
2305
  launch: "launch_assistant",
2054
2306
  pendingRelays: "assistant_pending_relays",
2055
2307
  // owner verbs (dashboard only)
2056
2308
  stagedResolve: "assistant_staged_resolve",
2057
2309
  storeAdmin: "assistant_store_admin",
2058
- importSkills: "assistant_import_skills"
2310
+ importSkills: "assistant_import_skills",
2311
+ /** Owner skill list (attach/view counts, save proposals, recent skill metrics); reads move no counter. */
2312
+ skillsList: "assistant_skills_list",
2313
+ /** Owner: what the assistant remembered recently, with undo handles (memory design §3.2). */
2314
+ memoryDigest: "assistant_memory_digest",
2315
+ /** Owner: reverse one remembered write or one batch (memory design §3.2). Never an assistant tool. */
2316
+ memoryUndo: "assistant_memory_undo",
2317
+ /** Projects the assistant is following (open relay threads) — list / stop following. */
2318
+ threads: "assistant_threads",
2319
+ threadClose: "assistant_thread_close"
2059
2320
  };
2060
2321
  var ASSISTANT_TOOL_VERBS = {
2322
+ driver_list: ASSISTANT_VERB.driverList,
2323
+ driver_describe: ASSISTANT_VERB.driverDescribe,
2061
2324
  projects: ASSISTANT_VERB.projects,
2325
+ environment: ASSISTANT_VERB.environment,
2326
+ assistant_action: ASSISTANT_VERB.action,
2327
+ project_watch: ASSISTANT_VERB.watch,
2062
2328
  project_status: ASSISTANT_VERB.projectStatus,
2063
2329
  project_send: ASSISTANT_VERB.projectSend,
2064
2330
  project_read: ASSISTANT_VERB.projectRead,
2065
2331
  project_add: ASSISTANT_VERB.projectAdd,
2332
+ project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
2066
2333
  discover_repos: ASSISTANT_VERB.discoverRepos,
2067
2334
  memory: ASSISTANT_VERB.memory,
2335
+ memory_search: ASSISTANT_VERB.memorySearch,
2068
2336
  skill_view: ASSISTANT_VERB.skillView,
2069
2337
  skill_manage: ASSISTANT_VERB.skillManage,
2070
- project_note: ASSISTANT_VERB.projectNote
2338
+ project_note: ASSISTANT_VERB.projectNote,
2339
+ launch_defaults: ASSISTANT_VERB.launchDefaults,
2340
+ launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
2341
+ artifact_list: ASSISTANT_VERB.artifactList,
2342
+ artifact_read: ASSISTANT_VERB.artifactRead,
2343
+ decision_answer: ASSISTANT_VERB.decisionAnswer,
2344
+ decision_request: ASSISTANT_VERB.decisionRequest,
2345
+ session_control: ASSISTANT_VERB.sessionControl
2071
2346
  };
2072
- var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
2347
+ var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set", "decision_answer", "decision_request", "session_control"];
2073
2348
  var ASSISTANT_OWNER_VERBS = [
2349
+ ASSISTANT_VERB.executionSettings,
2074
2350
  ASSISTANT_VERB.stagedResolve,
2075
2351
  ASSISTANT_VERB.storeAdmin,
2076
- ASSISTANT_VERB.importSkills
2352
+ ASSISTANT_VERB.importSkills,
2353
+ ASSISTANT_VERB.skillsList,
2354
+ ASSISTANT_VERB.memoryDigest,
2355
+ ASSISTANT_VERB.memoryUndo,
2356
+ ASSISTANT_VERB.threadClose
2077
2357
  ];
2078
2358
  var ASSISTANT_REVIEW_TURN_VERBS = [
2079
2359
  ASSISTANT_VERB.memory,
2360
+ ASSISTANT_VERB.memorySearch,
2080
2361
  ASSISTANT_VERB.skillView,
2081
2362
  ASSISTANT_VERB.skillManage,
2082
2363
  ASSISTANT_VERB.projectNote
2083
2364
  ];
2084
2365
  var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
2085
2366
  var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
2367
+ var ASSISTANT_ACCOUNT_SLOT = "personal";
2368
+ var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
2369
+ var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
2370
+ var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
2371
+ var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
2372
+ var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read", "decision_list", "decision_answer", "decision_request"];
2373
+ var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
2374
+ function isAssistantFollowerAllowedOp(value) {
2375
+ return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
2376
+ }
2377
+ var DECISION_OP_IMPLIED_BY = {
2378
+ decision_list: "status",
2379
+ decision_answer: "send",
2380
+ decision_request: "send"
2381
+ };
2382
+ function followerOpPermitted(op, allowedOps) {
2383
+ if (!isAssistantFollowerAllowedOp(op)) return false;
2384
+ if (allowedOps.includes(op)) return true;
2385
+ const implied = DECISION_OP_IMPLIED_BY[op];
2386
+ return implied !== void 0 && allowedOps.includes(implied);
2387
+ }
2388
+ function followedRemoteProjectKey(hostDaemonId, meshId) {
2389
+ const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
2390
+ return `${canonHost}::${meshId.trim()}`;
2391
+ }
2392
+ function sanitizeRemoteRepoIdentity(raw) {
2393
+ if (typeof raw !== "string") return null;
2394
+ const trimmed = raw.trim();
2395
+ if (!trimmed) return null;
2396
+ if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
2397
+ return null;
2398
+ }
2399
+ const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
2400
+ if (!withoutQuery) return null;
2401
+ let host = "";
2402
+ let repoPath = "";
2403
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
2404
+ try {
2405
+ const url = new URL(withoutQuery);
2406
+ if (url.protocol === "file:") return null;
2407
+ host = url.hostname.toLowerCase();
2408
+ repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2409
+ } catch {
2410
+ return null;
2411
+ }
2412
+ } else {
2413
+ const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
2414
+ if (scpMatch) {
2415
+ host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
2416
+ repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2417
+ } else {
2418
+ const slash = withoutQuery.indexOf("/");
2419
+ if (slash > 0) {
2420
+ const rawHost = withoutQuery.slice(0, slash);
2421
+ const atIdx = rawHost.lastIndexOf("@");
2422
+ host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
2423
+ repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2424
+ }
2425
+ }
2426
+ }
2427
+ if (!host || !repoPath) return null;
2428
+ if (!host.includes(".") && host !== "localhost") return null;
2429
+ if (/[\s@:\\]/.test(host)) return null;
2430
+ const segments = repoPath.split("/").filter(Boolean);
2431
+ if (segments.length === 0) return null;
2432
+ if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
2433
+ return `${host}/${segments.join("/")}`.slice(0, 200);
2434
+ }
2086
2435
 
2087
2436
  // src/turn-evidence.ts
2088
2437
  var MESH_TOPIC_PROTOCOL_VERSION = 2;
@@ -2118,7 +2467,7 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
2118
2467
  var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
2119
2468
  var DELIVERY_OUTCOMES = ["delivered", "queued"];
2120
2469
  var DELIVERY_VIAS = ["local", "p2p"];
2121
- var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
2470
+ var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout", "submit_unconfirmed"];
2122
2471
  function sanitizeRefusalCode(value) {
2123
2472
  if (typeof value !== "string") return void 0;
2124
2473
  const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
@@ -2128,8 +2477,8 @@ function sanitizeRefusalCode(value) {
2128
2477
  var CONSUME_PROFILES = ["default", "native_source"];
2129
2478
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2130
2479
  var SUSPENSION_MODALS = ["approval", "choice"];
2131
- var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
2132
- var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
2480
+ var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
2481
+ var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
2133
2482
  var TURN_END_STRENGTHS = ["genuine", "weak"];
2134
2483
  var TURN_END_BLOCK_REASONS = [
2135
2484
  "missing_final_assistant",
@@ -2137,9 +2486,9 @@ var TURN_END_BLOCK_REASONS = [
2137
2486
  "terminal_block_hard_cap",
2138
2487
  "decoupled_completion"
2139
2488
  ];
2140
- var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
2489
+ var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
2141
2490
  var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
2142
- var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
2491
+ var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
2143
2492
  var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
2144
2493
  var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
2145
2494
  var OPERATOR_STATUSES = ["completed", "failed"];
@@ -2166,9 +2515,10 @@ var HOLD_REASONS = [
2166
2515
  // — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
2167
2516
  // a session whose FSM never shows the idle edge again does not wait for
2168
2517
  // liveness / hard_ceiling.
2169
- "await_end"
2518
+ "await_end",
2519
+ "report_correction"
2170
2520
  ];
2171
- var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2521
+ var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
2172
2522
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
2173
2523
  var TURN_REASONS = [
2174
2524
  // commits
@@ -2177,9 +2527,15 @@ var TURN_REASONS = [
2177
2527
  "transcript_final",
2178
2528
  "worker_reported",
2179
2529
  "finalization_timeout_no_response",
2530
+ "weak_end_liveness_unconfirmed",
2531
+ "weak_end_probe_unobserved",
2532
+ "report_correction_expired",
2180
2533
  "session_error",
2181
2534
  "provider_auth_failed",
2182
2535
  "provider_billing_failed",
2536
+ "provider_usage_limit_exceeded",
2537
+ "provider_server_overloaded",
2538
+ "provider_error",
2183
2539
  "operator_cancel",
2184
2540
  "intentional_cleanup",
2185
2541
  "task_removed",
@@ -2207,6 +2563,7 @@ var TURN_REASONS = [
2207
2563
  ];
2208
2564
  var NOTIFY_KINDS = [
2209
2565
  "completed",
2566
+ "blocked",
2210
2567
  "failed",
2211
2568
  "cancelled",
2212
2569
  "stopped",
@@ -2256,8 +2613,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2256
2613
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
2257
2614
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
2258
2615
  turn_started: { retro: bool },
2259
- suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
2260
- suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
2616
+ suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
2617
+ suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
2261
2618
  turn_end: {
2262
2619
  strength: en(TURN_END_STRENGTHS),
2263
2620
  afterFinalizationTimeout: boolOpt,
@@ -2267,6 +2624,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2267
2624
  releasedByHardCap: boolOpt,
2268
2625
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
2269
2626
  live: { t: "live", optional: true },
2627
+ nativeMarker: { t: "native_marker", optional: true },
2270
2628
  reportExpected: boolOpt,
2271
2629
  providerFailure: enOpt(PROVIDER_FAILURES)
2272
2630
  },
@@ -2280,7 +2638,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2280
2638
  },
2281
2639
  transcript_activity: { newestActivityAt: ms },
2282
2640
  no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
2283
- liveness: { result: en(LIVENESS_RESULTS) },
2641
+ liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
2284
2642
  process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
2285
2643
  session_error: { reason: en(SESSION_ERROR_REASONS) },
2286
2644
  worker_report: {
@@ -2290,6 +2648,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2290
2648
  branchState: enOpt(WORKER_BRANCH_STATES),
2291
2649
  touchedFileCount: intOpt
2292
2650
  },
2651
+ worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
2293
2652
  worker_progress: { note: { t: "summary_ref", optional: true } },
2294
2653
  git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
2295
2654
  cancel: { reason: en(CANCEL_REASONS) },
@@ -2337,7 +2696,7 @@ function isLiveTurnPending(value) {
2337
2696
  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
2697
  }
2339
2698
  function isNativeMarkerRef(value) {
2340
- return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
2699
+ 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
2700
  }
2342
2701
  function isCoordinatorIdentity(value) {
2343
2702
  return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
@@ -2460,17 +2819,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
2460
2819
  };
2461
2820
  }
2462
2821
 
2822
+ // src/launch-defaults.ts
2823
+ var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
2824
+ var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
2825
+ var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
2826
+ function isLaunchDefaultRole(value) {
2827
+ return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
2828
+ }
2829
+ function isLaunchDefaultSource(value) {
2830
+ return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
2831
+ }
2832
+ var LAUNCH_DEFAULT_ERROR_CODES = [
2833
+ "invalid_args",
2834
+ "launch_default_required",
2835
+ "launch_default_unavailable",
2836
+ "launch_selection_invalid",
2837
+ "launch_default_invalid",
2838
+ "revision_conflict",
2839
+ "store_unavailable",
2840
+ "store_busy",
2841
+ "persistence_failed",
2842
+ "project_not_found",
2843
+ "project_ambiguous",
2844
+ "project_not_hosted",
2845
+ "project_storage_unavailable",
2846
+ "staging_unavailable",
2847
+ "staging_failed",
2848
+ "review_turn_tool_denied"
2849
+ ];
2850
+
2851
+ // src/role-launch.ts
2852
+ function record(value) {
2853
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2854
+ }
2855
+ function ref(value) {
2856
+ const r = record(value);
2857
+ 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;
2858
+ return {
2859
+ role: r.role,
2860
+ scope: r.scope,
2861
+ revision: r.revision,
2862
+ ...r.scope === "project" ? { projectId: r.projectId } : {}
2863
+ };
2864
+ }
2865
+ function axis(value) {
2866
+ const a = record(value);
2867
+ if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
2868
+ const defaultRef = ref(a.defaultRef);
2869
+ 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;
2870
+ return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
2871
+ }
2872
+ function parseRoleLaunchSelection(value) {
2873
+ const r = record(value), s = record(r?.selection), a = record(r?.applied);
2874
+ 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;
2875
+ const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
2876
+ 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;
2877
+ const defaultRef = ref(r.defaultRef);
2878
+ return {
2879
+ role: r.role,
2880
+ selection: {
2881
+ provider: s.provider,
2882
+ ...typeof s.model === "string" ? { model: s.model } : {},
2883
+ ...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
2884
+ },
2885
+ applied: { provider, model, thinkingLevel },
2886
+ ...defaultRef ? { defaultRef } : {},
2887
+ documentRevision: r.documentRevision
2888
+ };
2889
+ }
2890
+
2463
2891
  // src/session-launch.ts
2464
2892
  var MODEL_AXIS_SOURCES = [
2465
2893
  /** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
2466
2894
  "user",
2467
2895
  /** The dashboard dialog restored it from the last launch (browser-local memory). */
2468
2896
  "remembered",
2897
+ /** The authoritative daemon role default or host project override. */
2898
+ "stored_default",
2899
+ "project_default",
2469
2900
  /** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
2470
2901
  "mesh_slot",
2471
2902
  /** An explicit per-task model / thinking level on a mesh queue task. */
2472
2903
  "task_override",
2473
- /** Nothing was requested; the provider's default is known (discovery / manifest). */
2904
+ /** Nothing requested: the provider chooses; resolvedDefault records it when known. */
2474
2905
  "provider_default",
2475
2906
  /** A value was requested without saying where it came from, or nothing is known. */
2476
2907
  "unspecified"
@@ -2514,10 +2945,10 @@ function readFiniteNumber(value) {
2514
2945
  }
2515
2946
  function parseModelSelection(raw) {
2516
2947
  if (!raw || typeof raw !== "object") return void 0;
2517
- const record = raw;
2948
+ const record2 = raw;
2518
2949
  const history = [];
2519
- if (Array.isArray(record.history)) {
2520
- for (const entry of record.history) {
2950
+ if (Array.isArray(record2.history)) {
2951
+ for (const entry of record2.history) {
2521
2952
  if (!entry || typeof entry !== "object") continue;
2522
2953
  const e = entry;
2523
2954
  const value = readString(e.value);
@@ -2526,41 +2957,45 @@ function parseModelSelection(raw) {
2526
2957
  if (value && at !== void 0 && via) history.push({ at, value, via });
2527
2958
  }
2528
2959
  }
2529
- const requested = readString(record.requested);
2530
- const launchValue = readString(record.launchValue);
2531
- const resolvedDefault = readString(record.resolvedDefault);
2532
- const current = readString(record.current);
2533
- const observed = readString(record.observed);
2534
- const observedAt = readFiniteNumber(record.observedAt);
2960
+ const requested = readString(record2.requested);
2961
+ const launchValue = readString(record2.launchValue);
2962
+ const resolvedDefault = readString(record2.resolvedDefault);
2963
+ const current = readString(record2.current);
2964
+ const observed = readString(record2.observed);
2965
+ const observedAt = readFiniteNumber(record2.observedAt);
2966
+ const fallback = record2.fallback === true;
2535
2967
  return {
2536
- source: isModelAxisSource(record.source) ? record.source : "unspecified",
2968
+ source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
2537
2969
  ...requested ? { requested } : {},
2538
2970
  ...launchValue ? { launchValue } : {},
2539
2971
  ...resolvedDefault ? { resolvedDefault } : {},
2540
2972
  ...current ? { current } : {},
2541
2973
  ...observed ? { observed } : {},
2542
2974
  ...observedAt !== void 0 ? { observedAt } : {},
2975
+ ...fallback ? { fallback } : {},
2543
2976
  history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
2544
2977
  };
2545
2978
  }
2546
2979
  function parseSessionLaunchRecord(raw) {
2547
2980
  if (!raw || typeof raw !== "object") return void 0;
2548
- const record = raw;
2549
- const sessionId = readString(record.sessionId);
2550
- const providerType = readString(record.providerType);
2551
- const launchedAt = readFiniteNumber(record.launchedAt);
2552
- const model = parseModelSelection(record.model);
2553
- const thinkingLevel = parseModelSelection(record.thinkingLevel);
2981
+ const record2 = raw;
2982
+ const sessionId = readString(record2.sessionId);
2983
+ const providerType = readString(record2.providerType);
2984
+ const launchedAt = readFiniteNumber(record2.launchedAt);
2985
+ const model = parseModelSelection(record2.model);
2986
+ const thinkingLevel = parseModelSelection(record2.thinkingLevel);
2554
2987
  if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
2555
- const providerVersion = readString(record.providerVersion);
2556
- const workspace = readString(record.workspace);
2557
- const autoApproveModeId = readString(record.autoApproveModeId);
2988
+ const providerVersion = readString(record2.providerVersion);
2989
+ const workspace = readString(record2.workspace);
2990
+ const autoApproveModeId = readString(record2.autoApproveModeId);
2991
+ const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
2558
2992
  return {
2993
+ ...roleLaunch ? { roleLaunch } : {},
2559
2994
  sessionId,
2560
2995
  providerType,
2561
2996
  ...providerVersion ? { providerVersion } : {},
2562
- ...record.providerChannel === "stable" || record.providerChannel === "preview" ? { providerChannel: record.providerChannel } : {},
2563
- launchedBy: isSessionLaunchedBy(record.launchedBy) ? record.launchedBy : "api",
2997
+ ...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
2998
+ launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
2564
2999
  launchedAt,
2565
3000
  ...workspace ? { workspace } : {},
2566
3001
  model,
@@ -2624,7 +3059,7 @@ function isTurnAttemptRefValue(value) {
2624
3059
  function isTurnObserveResponse(value) {
2625
3060
  return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
2626
3061
  }
2627
- var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
3062
+ var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
2628
3063
  function isTurnOutcomeValue(value) {
2629
3064
  return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
2630
3065
  }
@@ -2850,8 +3285,23 @@ function isMissionBriefWire(value) {
2850
3285
  }
2851
3286
  return true;
2852
3287
  }
3288
+ var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
3289
+ function isOpenItemCountsWire(value) {
3290
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
3291
+ return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
3292
+ }
3293
+ function isStructuredMissionFields(value) {
3294
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3295
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3296
+ }
3297
+ if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
3298
+ if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
3299
+ if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
3300
+ return true;
3301
+ }
2853
3302
  function isMeshMissionRecordWire(value) {
2854
- if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
3303
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
3304
+ if (!isStructuredMissionFields(value)) return false;
2855
3305
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
2856
3306
  if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
2857
3307
  if (!isMeshMissionStatusValue(value.status)) return false;
@@ -2859,11 +3309,22 @@ function isMeshMissionRecordWire(value) {
2859
3309
  return true;
2860
3310
  }
2861
3311
  function isMissionUpsertRequest(value) {
2862
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
3312
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
2863
3313
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2864
3314
  if (!isEvidenceIdentifier(value.meshId)) return false;
2865
3315
  if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
2866
- if (typeof value.title !== "string" || value.title.trim().length === 0) return false;
3316
+ if (typeof value.title !== "string") return false;
3317
+ if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
3318
+ if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
3319
+ if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
3320
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3321
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3322
+ }
3323
+ if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
3324
+ for (const k of ["itemsAdd", "itemsUpdate"]) {
3325
+ const list = value[k];
3326
+ if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
3327
+ }
2867
3328
  if (value.goal !== void 0 && typeof value.goal !== "string") return false;
2868
3329
  if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
2869
3330
  if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
@@ -2873,7 +3334,7 @@ function decodeMissionUpsertRequest(value) {
2873
3334
  return isMissionUpsertRequest(value) ? value : null;
2874
3335
  }
2875
3336
  function isMissionUpsertResponse(value) {
2876
- return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
3337
+ return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
2877
3338
  }
2878
3339
  function decodeMissionUpsertResponse(value) {
2879
3340
  return isMissionUpsertResponse(value) ? value : null;
@@ -2899,7 +3360,10 @@ function decodeMissionQueryResponse(value) {
2899
3360
  return isMissionQueryResponse(value) ? value : null;
2900
3361
  }
2901
3362
  function isMissionListQueryRequest(value) {
2902
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
3363
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
3364
+ for (const k of ["structured", "items", "history"]) {
3365
+ if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
3366
+ }
2903
3367
  if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
2904
3368
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2905
3369
  if (!isEvidenceIdentifier(value.meshId)) return false;
@@ -2925,12 +3389,13 @@ function isMeshMissionTaskAggregateWire(value) {
2925
3389
  return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
2926
3390
  }
2927
3391
  function isMeshMissionStatsWire(value) {
2928
- const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
3392
+ const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
2929
3393
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
2930
3394
  if (!isEvidenceIdentifier(value.missionId)) return false;
2931
3395
  for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
2932
3396
  if (!isNonNegativeInt(value[k])) return false;
2933
3397
  }
3398
+ if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
2934
3399
  if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
2935
3400
  if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
2936
3401
  return true;
@@ -2940,7 +3405,7 @@ function isMissionListSummaryWire(value) {
2940
3405
  const hasGoal = "goal" in value;
2941
3406
  const hasPreview = "goalPreview" in value && "goalTruncated" in value;
2942
3407
  if (hasGoal === hasPreview) return false;
2943
- const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
3408
+ const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
2944
3409
  const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
2945
3410
  if (!hasOnlyKeys2(value, allowed)) return false;
2946
3411
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
@@ -2954,6 +3419,10 @@ function isMissionListSummaryWire(value) {
2954
3419
  if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
2955
3420
  if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
2956
3421
  if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
3422
+ if (!isStructuredMissionFields(value)) return false;
3423
+ for (const k of ["items", "history"]) {
3424
+ if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
3425
+ }
2957
3426
  return true;
2958
3427
  }
2959
3428
  function isMeshMissionHistoryFoldWire(value) {
@@ -3052,12 +3521,13 @@ function isLedgerQueryEntryWire(value) {
3052
3521
  return true;
3053
3522
  }
3054
3523
  function isLedgerQuerySummaryWire(value) {
3055
- const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
3524
+ const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
3056
3525
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
3057
3526
  if (!isEvidenceIdentifier(value.meshId)) return false;
3058
3527
  for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
3059
3528
  if (!isNonNegativeInt(value[k])) return false;
3060
3529
  }
3530
+ if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
3061
3531
  if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
3062
3532
  return true;
3063
3533
  }
@@ -3101,9 +3571,10 @@ function isQueueDependencyHeadWire(value) {
3101
3571
  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
3572
  }
3103
3573
  function isQueueQueryResponse(value) {
3104
- if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
3574
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
3105
3575
  if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
3106
3576
  if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
3577
+ if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
3107
3578
  if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
3108
3579
  if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
3109
3580
  return true;
@@ -3225,6 +3696,17 @@ function isRecoveryContextQueryResponse(value) {
3225
3696
  function decodeRecoveryContextQueryResponse(value) {
3226
3697
  return isRecoveryContextQueryResponse(value) ? value : null;
3227
3698
  }
3699
+ function decodeQueueReviseRequest(value) {
3700
+ 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;
3701
+ const p = value.patch;
3702
+ if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
3703
+ if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
3704
+ for (const key of ["ownedPaths", "dependsOn"]) {
3705
+ if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
3706
+ }
3707
+ return value;
3708
+ }
3709
+ var decodeQueueReviseResponse = decodeQueueRequeueResponse;
3228
3710
 
3229
3711
  // src/turn-ipc-stats.ts
3230
3712
  function isTaskStatsQueryRequest(value) {
@@ -3323,6 +3805,7 @@ var TURN_IPC_COMMANDS = [
3323
3805
  "queue_enqueue_batch",
3324
3806
  "queue_cancel",
3325
3807
  "queue_requeue",
3808
+ "queue_revise",
3326
3809
  "direct_dispatch_record",
3327
3810
  "active_work_query",
3328
3811
  "recovery_context_query",
@@ -3406,14 +3889,11 @@ function normalizeOwnedPaths(input) {
3406
3889
  }
3407
3890
  function entryContains(base, path) {
3408
3891
  if (path === base.path) return true;
3409
- if (base.subtree && (path === base.path || path.startsWith(`${base.path}/`))) return true;
3892
+ if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
3410
3893
  return false;
3411
3894
  }
3412
3895
  function entriesOverlap(a, b) {
3413
- if (a.path === b.path) return true;
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;
3896
+ return entryContains(a, b.path) || entryContains(b, a.path);
3417
3897
  }
3418
3898
  function pathsOverlap(a, b) {
3419
3899
  if (a.paths.length === 0 || b.paths.length === 0) return false;
@@ -3465,6 +3945,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
3465
3945
  return { undeclaredTouched, unusedDeclarations };
3466
3946
  }
3467
3947
 
3948
+ // src/mission-items.ts
3949
+ var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
3950
+ var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
3951
+ var COORDINATOR_SETTABLE_ITEM_STATES = {
3952
+ remaining: ["open", "done", "dropped"],
3953
+ live_check: ["open", "done", "dropped"],
3954
+ evidence: ["open", "done", "dropped"],
3955
+ decision: ["open", "withdrawn", "superseded"]
3956
+ };
3957
+ var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
3958
+ function isMissionOutcome(value) {
3959
+ return typeof value === "string" && MISSION_OUTCOMES.includes(value);
3960
+ }
3961
+ var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
3962
+ var MISSION_LIMITS = {
3963
+ summary: 300,
3964
+ outcomeReason: 500,
3965
+ itemText: 300,
3966
+ machine: 80,
3967
+ refs: 8,
3968
+ refValue: 300,
3969
+ refRepo: 120,
3970
+ refNote: 200,
3971
+ dedupeKey: 400,
3972
+ question: 300,
3973
+ context: 600,
3974
+ options: 5,
3975
+ optionLabel: 60,
3976
+ optionDetail: 200,
3977
+ /** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
3978
+ openItemsPerMission: 200,
3979
+ /** One event payload (serialized). */
3980
+ eventPayloadBytes: 16 * 1024,
3981
+ /** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
3982
+ itemsPerCall: 50
3983
+ };
3984
+ var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
3985
+ var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
3986
+ var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
3987
+ function truncateMissionText(value, max) {
3988
+ if (value.length <= max) return value;
3989
+ return `${value.slice(0, max - 1).trimEnd()}\u2026`;
3990
+ }
3991
+ function str(value) {
3992
+ return typeof value === "string" ? value.trim() : "";
3993
+ }
3994
+ function collapse(value) {
3995
+ return value.replace(/\s+/g, " ").trim();
3996
+ }
3997
+ function normalizeMissionSummary(value) {
3998
+ if (typeof value !== "string") return null;
3999
+ const text = collapse(value);
4000
+ return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
4001
+ }
4002
+ function normalizeOutcomeReason(value) {
4003
+ if (typeof value !== "string") return null;
4004
+ const text = value.trim();
4005
+ return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
4006
+ }
4007
+ function normalizeMissionRefs(value) {
4008
+ if (!Array.isArray(value)) return { refs: [], truncated: false };
4009
+ const refs = [];
4010
+ let truncated = false;
4011
+ for (const raw of value) {
4012
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4013
+ const r = raw;
4014
+ const kind = str(r.kind);
4015
+ const refValue = str(r.value);
4016
+ if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
4017
+ if (refs.length >= MISSION_LIMITS.refs) {
4018
+ truncated = true;
4019
+ break;
4020
+ }
4021
+ const repo = str(r.repo);
4022
+ const note = str(r.note);
4023
+ refs.push({
4024
+ kind,
4025
+ ...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
4026
+ value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
4027
+ ...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
4028
+ });
4029
+ }
4030
+ return { refs, truncated };
4031
+ }
4032
+ function normalizeOptions(value, truncated) {
4033
+ if (!Array.isArray(value)) return [];
4034
+ const out = [];
4035
+ for (const raw of value) {
4036
+ if (typeof raw === "string" && raw.trim()) {
4037
+ if (out.length >= MISSION_LIMITS.options) {
4038
+ truncated.push("options");
4039
+ break;
4040
+ }
4041
+ out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
4042
+ continue;
4043
+ }
4044
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4045
+ const o = raw;
4046
+ const label = collapse(str(o.label));
4047
+ if (!label) continue;
4048
+ if (out.length >= MISSION_LIMITS.options) {
4049
+ truncated.push("options");
4050
+ break;
4051
+ }
4052
+ const detail = str(o.detail);
4053
+ out.push({
4054
+ id: MISSION_DECISION_OPTION_IDS[out.length],
4055
+ label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
4056
+ ...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
4057
+ });
4058
+ }
4059
+ return out;
4060
+ }
4061
+ function normalizeDueAt(value) {
4062
+ if (typeof value !== "string" || !value.trim()) return void 0;
4063
+ const ms2 = Date.parse(value);
4064
+ return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
4065
+ }
4066
+ function normalizeDecisionInput(raw, truncated) {
4067
+ const questionSource = collapse(str(raw.question) || str(raw.text));
4068
+ if (!questionSource) return null;
4069
+ if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
4070
+ const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
4071
+ const contextSource = str(raw.context);
4072
+ if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
4073
+ const options = normalizeOptions(raw.options, truncated);
4074
+ const recommendedRaw = str(raw.recommended);
4075
+ const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
4076
+ const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
4077
+ const onDueRaw = str(raw.onDue ?? raw.on_due);
4078
+ const urgencyRaw = str(raw.urgency);
4079
+ const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
4080
+ return {
4081
+ question,
4082
+ ...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
4083
+ options,
4084
+ ...recommended ? { recommended } : {},
4085
+ allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
4086
+ ...dueAt ? { dueAt } : {},
4087
+ // apply_recommended without a recommended option has nothing to apply — fall back to remind.
4088
+ onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
4089
+ urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
4090
+ };
4091
+ }
4092
+ function normalizeForDedupe(text) {
4093
+ return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
4094
+ }
4095
+ function deriveItemDedupeKey(kind, parts) {
4096
+ const explicit = str(parts.explicit);
4097
+ if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
4098
+ if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4099
+ if (kind === "evidence") {
4100
+ const ref2 = parts.refs?.[0];
4101
+ if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
4102
+ }
4103
+ const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
4104
+ return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4105
+ }
4106
+ function normalizeMissionItemInput(raw) {
4107
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
4108
+ const r = raw;
4109
+ const kind = str(r.kind) || "remaining";
4110
+ if (!MISSION_ITEM_KINDS.includes(kind)) {
4111
+ return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
4112
+ }
4113
+ const truncated = [];
4114
+ const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
4115
+ if (refsTruncated) truncated.push("refs");
4116
+ const machineRaw = collapse(str(r.machine));
4117
+ const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
4118
+ const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
4119
+ if (kind === "decision") {
4120
+ const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
4121
+ const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
4122
+ if (!decision) return { error: "decision item needs a question" };
4123
+ return {
4124
+ item: {
4125
+ kind,
4126
+ text: decision.question,
4127
+ ...machine ? { machine } : {},
4128
+ refs,
4129
+ decision,
4130
+ dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
4131
+ truncated
4132
+ }
4133
+ };
4134
+ }
4135
+ const textSource = collapse(str(r.text));
4136
+ if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
4137
+ if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
4138
+ const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
4139
+ return {
4140
+ item: {
4141
+ kind,
4142
+ text,
4143
+ ...machine ? { machine } : {},
4144
+ refs,
4145
+ dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
4146
+ truncated
4147
+ }
4148
+ };
4149
+ }
4150
+ function normalizeMissionItemUpdate(raw) {
4151
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
4152
+ const r = raw;
4153
+ const id2 = str(r.id ?? r.item_id ?? r.itemId);
4154
+ if (!id2) return { error: "update needs an item id" };
4155
+ const truncated = [];
4156
+ const update = { id: id2 };
4157
+ if (r.state !== void 0) {
4158
+ const state = str(r.state);
4159
+ if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
4160
+ update.state = state;
4161
+ }
4162
+ if (typeof r.text === "string") {
4163
+ const text = collapse(r.text);
4164
+ if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
4165
+ if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
4166
+ }
4167
+ if (r.machine === null) update.machine = null;
4168
+ else if (typeof r.machine === "string") {
4169
+ const machine = collapse(r.machine);
4170
+ update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
4171
+ }
4172
+ if (r.refs !== void 0) {
4173
+ const { refs, truncated: t } = normalizeMissionRefs(r.refs);
4174
+ if (t) truncated.push("refs");
4175
+ update.refs = refs;
4176
+ }
4177
+ return { update, truncated };
4178
+ }
4179
+ function boundEventPayload(payload) {
4180
+ let json = JSON.stringify(payload);
4181
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4182
+ const shrunk = {};
4183
+ for (const [k, v] of Object.entries(payload)) {
4184
+ shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
4185
+ }
4186
+ shrunk.payloadTruncated = true;
4187
+ json = JSON.stringify(shrunk);
4188
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4189
+ return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
4190
+ }
4191
+ var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
4192
+ var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
4193
+ var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
4194
+ function isCarryOverMissionRecord(m) {
4195
+ return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
4196
+ }
4197
+ function isCarryOverMissionTitle(title) {
4198
+ if (typeof title !== "string") return false;
4199
+ const t = title.trim();
4200
+ return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
4201
+ }
4202
+ var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
4203
+ var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
4204
+ var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
4205
+ var WORKER_DECISIONS_NEEDED_MAX = 3;
4206
+ var WORKER_COMMITS_MAX = 20;
4207
+ var SHA_RE = /^[0-9a-f]{7,64}$/i;
4208
+ function normalizeReportCommits(value) {
4209
+ if (!Array.isArray(value)) return null;
4210
+ const out = [];
4211
+ for (const v of value) {
4212
+ if (typeof v !== "string") return null;
4213
+ const sha = v.trim();
4214
+ if (!SHA_RE.test(sha)) return null;
4215
+ if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
4216
+ }
4217
+ return out;
4218
+ }
4219
+
4220
+ // src/mission-git-state.ts
4221
+ var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
4222
+ var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
4223
+ var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
4224
+ function isMissionRefContained(status) {
4225
+ return status === "contained_ancestor" || status === "contained_patch_equivalent";
4226
+ }
4227
+ function aggregateMissionGitState(statuses) {
4228
+ const total = statuses.length;
4229
+ const contained = statuses.filter(isMissionRefContained).length;
4230
+ const notContained = statuses.filter((s) => s === "not_contained").length;
4231
+ const unknown = statuses.filter((s) => s === "unknown").length;
4232
+ const counts = { total, contained, notContained, unknown };
4233
+ if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
4234
+ if (contained === total) return { state: "landed", partialUnknown: false, counts };
4235
+ if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
4236
+ if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
4237
+ return { state: "unknown", partialUnknown: false, counts };
4238
+ }
4239
+
4240
+ // src/release.ts
4241
+ var MESH_RELEASE_CHANNELS = ["preview", "stable"];
4242
+ function isMeshReleaseChannel(value) {
4243
+ return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
4244
+ }
4245
+ var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
4246
+ function isReleaseStatus(value) {
4247
+ return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
4248
+ }
4249
+ var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
4250
+ var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
4251
+ var RELEASE_EVENT_TYPES = [
4252
+ "created",
4253
+ "status_changed",
4254
+ "scope_added",
4255
+ "scope_moved",
4256
+ "scope_removed",
4257
+ "deploy_recorded",
4258
+ "changelog_drafted",
4259
+ "changelog_applied"
4260
+ ];
4261
+ var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
4262
+ var RELEASE_LIMITS = {
4263
+ name: 80,
4264
+ note: 500,
4265
+ /** `mesh_missions.release_note`: one user/operator-visible sentence. */
4266
+ releaseNote: 400,
4267
+ missionsPerCall: 100,
4268
+ changelogEntries: 300
4269
+ };
4270
+ var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
4271
+ var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
4272
+ function changelogMissionMarker(missionId) {
4273
+ return `<!-- m:${missionId.slice(0, 8)} -->`;
4274
+ }
4275
+ function classifyChangelogSection(text, hint) {
4276
+ const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
4277
+ if (m) {
4278
+ const key = m[1].toLowerCase();
4279
+ return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
4280
+ }
4281
+ const probe = `${hint ?? ""} ${text}`.toLowerCase();
4282
+ if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
4283
+ if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
4284
+ return { section: "Changed", text };
4285
+ }
4286
+ function lintChangelogText(text) {
4287
+ const out = [];
4288
+ if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
4289
+ if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
4290
+ if (/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i.test(text) || /\bmi_[0-9a-f]{12}\b/.test(text) || /\brel_[0-9a-f]{12}\b/.test(text)) out.push("contains an internal id");
4291
+ if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
4292
+ return out;
4293
+ }
4294
+
4295
+ // src/decision-push-relay.ts
4296
+ var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
4297
+ var DECISION_PUSH_RELAY_SOURCE = "push_relay";
4298
+
3468
4299
  // src/keyed-doc-delta.ts
3469
4300
  function sig(value) {
3470
4301
  if (value === void 0) return void 0;
@@ -3685,7 +4516,15 @@ function foldKeyedDoc(held, delta, spec) {
3685
4516
  const heldList = heldCollections.get(path);
3686
4517
  if (change?.absent) {
3687
4518
  const [head2, tail2] = splitPath(path);
3688
- if (!tail2) delete next[head2];
4519
+ if (!tail2) {
4520
+ delete next[head2];
4521
+ continue;
4522
+ }
4523
+ const parent2 = next[head2];
4524
+ if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
4525
+ const copy = { ...parent2 };
4526
+ delete copy[tail2];
4527
+ next[head2] = copy;
3689
4528
  continue;
3690
4529
  }
3691
4530
  if (!change && heldList === void 0) continue;
@@ -3749,9 +4588,165 @@ function stableMeshNodeRow(row) {
3749
4588
  }
3750
4589
  return out;
3751
4590
  }
4591
+
4592
+ // src/provider-approval.ts
4593
+ function isActionableProviderApproval(approval) {
4594
+ 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());
4595
+ }
4596
+ function readProviderDecision(approval, waiting, hasModal = false) {
4597
+ if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
4598
+ if (!waiting) return null;
4599
+ return {
4600
+ source: hasModal ? "legacy_provider" : "status_only",
4601
+ type: "unknown",
4602
+ compatibility: hasModal ? "session_only" : "unknown",
4603
+ evidence: "unavailable",
4604
+ lifecycle: "pending",
4605
+ modalKey: null,
4606
+ createdAt: null,
4607
+ resolvedAt: null,
4608
+ description: "",
4609
+ buttons: [],
4610
+ actionable: false
4611
+ };
4612
+ }
4613
+ function providerApprovalSnapshot(approval) {
4614
+ if (!approval) return null;
4615
+ const {
4616
+ source,
4617
+ type,
4618
+ lifecycle,
4619
+ modalKey,
4620
+ createdAt,
4621
+ resolvedAt,
4622
+ providerType,
4623
+ sessionId,
4624
+ nodeId,
4625
+ meshId,
4626
+ taskId,
4627
+ attemptId,
4628
+ generation
4629
+ } = approval;
4630
+ return {
4631
+ source,
4632
+ type,
4633
+ lifecycle,
4634
+ modalKey,
4635
+ createdAt,
4636
+ resolvedAt,
4637
+ providerType,
4638
+ sessionId,
4639
+ nodeId,
4640
+ meshId,
4641
+ taskId,
4642
+ attemptId,
4643
+ generation,
4644
+ evidence: "cached",
4645
+ actionable: false,
4646
+ description: "",
4647
+ buttons: []
4648
+ };
4649
+ }
4650
+
4651
+ // src/provider-question.ts
4652
+ function isProviderQuestionBinding(value) {
4653
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
4654
+ const b = value;
4655
+ if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
4656
+ const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
4657
+ if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
4658
+ if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
4659
+ return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
4660
+ }
4661
+
4662
+ // src/relay-reprobe.ts
4663
+ var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
4664
+ var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
4665
+ var RELAY_REPROBE_JITTER_RATIO = 0.2;
4666
+ function computeRelayReprobeDelay(failures, random, timing = {}) {
4667
+ const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
4668
+ const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
4669
+ const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
4670
+ const grown = Math.min(max, base * 2 ** Math.max(0, failures));
4671
+ const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
4672
+ return Math.round(grown * factor);
4673
+ }
4674
+ var RelayReprobeScheduler = class {
4675
+ constructor(options) {
4676
+ this.options = options;
4677
+ }
4678
+ handle = null;
4679
+ running = false;
4680
+ inFlight = false;
4681
+ failureCount = 0;
4682
+ generation = 0;
4683
+ get isRunning() {
4684
+ return this.running;
4685
+ }
4686
+ get failures() {
4687
+ return this.failureCount;
4688
+ }
4689
+ get probing() {
4690
+ return this.inFlight;
4691
+ }
4692
+ /** Begin probing (idempotent). Call when a connection is selected as relay. */
4693
+ start() {
4694
+ if (this.running) return;
4695
+ this.running = true;
4696
+ this.failureCount = 0;
4697
+ this.generation++;
4698
+ this.schedule();
4699
+ }
4700
+ /** Stop for good (direct path found, connection closed, auth epoch changed). */
4701
+ stop() {
4702
+ this.running = false;
4703
+ this.generation++;
4704
+ if (this.handle !== null) {
4705
+ this.options.clearTimer(this.handle);
4706
+ this.handle = null;
4707
+ }
4708
+ }
4709
+ schedule() {
4710
+ if (!this.running) return;
4711
+ const generation = this.generation;
4712
+ const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
4713
+ this.handle = this.options.setTimer(() => {
4714
+ this.handle = null;
4715
+ void this.tick(generation);
4716
+ }, delay);
4717
+ }
4718
+ async tick(generation) {
4719
+ if (!this.running || generation !== this.generation) return;
4720
+ if (this.inFlight || !this.options.shouldProbe()) {
4721
+ this.schedule();
4722
+ return;
4723
+ }
4724
+ this.inFlight = true;
4725
+ let outcome;
4726
+ try {
4727
+ outcome = await this.options.probe();
4728
+ } catch {
4729
+ outcome = "failed";
4730
+ }
4731
+ this.inFlight = false;
4732
+ if (!this.running || generation !== this.generation) return;
4733
+ if (outcome === "direct") {
4734
+ this.stop();
4735
+ return;
4736
+ }
4737
+ if (outcome !== "skipped") this.failureCount++;
4738
+ this.schedule();
4739
+ }
4740
+ };
3752
4741
  // Annotate the CommonJS export names for ESM import in node:
3753
4742
  0 && (module.exports = {
4743
+ ASSISTANT_ACCOUNT_SLOT,
4744
+ ASSISTANT_FOLLOWER_ALLOWED_OPS,
3754
4745
  ASSISTANT_OWNER_VERBS,
4746
+ ASSISTANT_REMOTE_FOLLOW_COMMAND,
4747
+ ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
4748
+ ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
4749
+ ASSISTANT_REMOTE_PROJECT_COMMAND,
3755
4750
  ASSISTANT_REVIEW_TURN_VERBS,
3756
4751
  ASSISTANT_SESSION_ID_ARG,
3757
4752
  ASSISTANT_SESSION_ID_ENV,
@@ -3763,12 +4758,16 @@ function stableMeshNodeRow(row) {
3763
4758
  CANCEL_REASONS,
3764
4759
  CANONICAL_MESH_TOOL_COUNT,
3765
4760
  CANONICAL_MESH_TOOL_NAMES,
4761
+ CARRY_OVER_MISSION_GOAL,
4762
+ CARRY_OVER_MISSION_TITLE,
4763
+ CHANGELOG_SECTIONS,
3766
4764
  CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
3767
4765
  CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
3768
4766
  CLI_SLOT_RECIPES,
3769
4767
  COMMIT_STRENGTHS,
3770
4768
  CONSUME_PROFILES,
3771
4769
  COORDINATOR_ACK_OUTCOMES,
4770
+ COORDINATOR_SETTABLE_ITEM_STATES,
3772
4771
  DAEMON_METADATA_DOC_SPEC,
3773
4772
  DAEMON_P2P_SIGNAL_TYPES,
3774
4773
  DAEMON_STATUS_EVENT_NAMES,
@@ -3781,6 +4780,11 @@ function stableMeshNodeRow(row) {
3781
4780
  DASHBOARD_TO_DAEMON_P2P_TYPES,
3782
4781
  DASHBOARD_TO_USER_SESSION_TYPES,
3783
4782
  DASHBOARD_WIRE_VERSION,
4783
+ DECISION_PUSH_OPTIONS_MAX,
4784
+ DECISION_PUSH_OPTION_LABEL_MAX,
4785
+ DECISION_PUSH_QUESTION_MAX,
4786
+ DECISION_PUSH_RELAY_COMMAND,
4787
+ DECISION_PUSH_RELAY_SOURCE,
3784
4788
  DEFAULT_DIFFICULTY_BRAINS,
3785
4789
  DELIVERY_OUTCOMES,
3786
4790
  DELIVERY_VIAS,
@@ -3788,6 +4792,11 @@ function stableMeshNodeRow(row) {
3788
4792
  EVIDENCE_ENVELOPE_FIELD_SPECS,
3789
4793
  EVIDENCE_SOURCE_IDS,
3790
4794
  HOLD_REASONS,
4795
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
4796
+ LAUNCH_DEFAULT_ERROR_CODES,
4797
+ LAUNCH_DEFAULT_ROLES,
4798
+ LAUNCH_DEFAULT_SOURCES,
4799
+ LEGACY_CARRY_OVER_MISSION_TITLE,
3791
4800
  LIVENESS_RESULTS,
3792
4801
  MAX_MESH_RECORD_STRING,
3793
4802
  MAX_OWNED_PATHS,
@@ -3802,6 +4811,8 @@ function stableMeshNodeRow(row) {
3802
4811
  MESH_MISSION_STATUSES,
3803
4812
  MESH_P2P_SIGNAL_TYPES,
3804
4813
  MESH_RECORD_PAYLOAD_KEYS,
4814
+ MESH_RELEASE_CHANNELS,
4815
+ MESH_RELEASE_STATUSES,
3805
4816
  MESH_SESSION_CLEANUP_MODES,
3806
4817
  MESH_STATUS_DOC_SPEC,
3807
4818
  MESH_TASK_DIFFICULTIES,
@@ -3813,10 +4824,23 @@ function stableMeshNodeRow(row) {
3813
4824
  MESH_TOPIC_ENTRY_KINDS,
3814
4825
  MESH_TOPIC_PROTOCOL_VERSION,
3815
4826
  MISSION_BRIEF_RENDER_MAX_CHARS,
4827
+ MISSION_DECISION_ON_DUE,
4828
+ MISSION_DECISION_OPTION_IDS,
4829
+ MISSION_DECISION_URGENCIES,
4830
+ MISSION_GIT_STATES,
4831
+ MISSION_ITEM_KINDS,
4832
+ MISSION_ITEM_STATES,
4833
+ MISSION_LIMITS,
4834
+ MISSION_OUTCOMES,
4835
+ MISSION_REF_GIT_METHODS,
4836
+ MISSION_REF_GIT_STATUSES,
4837
+ MISSION_REF_KINDS,
4838
+ MISSION_RELEASE_EVENT_TYPES,
3816
4839
  MODEL_AXIS_SOURCES,
3817
4840
  MODEL_SELECTION_HISTORY_LIMIT,
3818
4841
  MeshChunkAssembler,
3819
4842
  NATIVE_TURN_OUTCOMES,
4843
+ NEEDS_WORDING_MARKER,
3820
4844
  NOTIFY_KINDS,
3821
4845
  NO_PROGRESS_OBSERVED_STATUSES,
3822
4846
  NPM_UPDATE_TAGS,
@@ -3826,14 +4850,27 @@ function stableMeshNodeRow(row) {
3826
4850
  OPERATOR_STATUS_REASON_VALUES,
3827
4851
  OPERATOR_STATUS_VALUES,
3828
4852
  OUTBOUND_MESSAGE_ORIGINS,
4853
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX,
4854
+ OWNER_ABANDON_CONFIRM_OPTIONS,
4855
+ OWNER_ABANDON_CONFIRM_QUESTION,
3829
4856
  P2P_SIGNAL_TYPES,
3830
4857
  PROVIDER_FAILURES,
4858
+ QUOTA_BACKFILL_HORIZON_MS,
4859
+ QUOTA_RETRY_INFLIGHT_GRACE_MS,
3831
4860
  QUOTA_SUPPORTED_PROVIDERS,
3832
4861
  RECENT_SESSION_BUCKETS,
3833
4862
  RECLAIMING_SEND_REFUSALS,
4863
+ RELAY_REPROBE_BASE_DELAY_MS,
4864
+ RELAY_REPROBE_JITTER_RATIO,
4865
+ RELAY_REPROBE_MAX_DELAY_MS,
4866
+ RELEASE_ACTORS,
3834
4867
  RELEASE_CHANNELS,
4868
+ RELEASE_EVENT_TYPES,
4869
+ RELEASE_LIMITS,
4870
+ RELEASE_MEMBER_STATES,
3835
4871
  REMOVED_MESH_TOOLS,
3836
4872
  RETIRED_MESH_TOOLS,
4873
+ RelayReprobeScheduler,
3837
4874
  SEND_POLICY_MODES,
3838
4875
  SEND_REFUSAL_REASONS,
3839
4876
  SERVER_STATUS_EVENT_NAMES,
@@ -3871,16 +4908,25 @@ function stableMeshNodeRow(row) {
3871
4908
  VERSION_UPDATE_REASONS,
3872
4909
  VIEWER_TO_SHARED_SESSION_TYPES,
3873
4910
  WORKER_BRANCH_STATES,
4911
+ WORKER_COMMITS_MAX,
4912
+ WORKER_DECISIONS_NEEDED_MAX,
3874
4913
  WORKER_PROTOCOL_FOOTER_MARKER,
3875
4914
  WORKER_REPORT_OUTCOMES,
4915
+ WORKER_REPORT_SUMMARY_MAX_CHARS,
3876
4916
  WORKER_TOOLS,
4917
+ aggregateMissionGitState,
3877
4918
  appendWorkerProtocolFooter,
3878
4919
  argsCarryStatusProbeMarker,
4920
+ assessQuotaFreshness,
4921
+ boundEventPayload,
3879
4922
  buildSlotProposal,
3880
4923
  canonicalDaemonId,
4924
+ changelogMissionMarker,
4925
+ classifyChangelogSection,
3881
4926
  classifySessionStatus,
3882
4927
  compareDashboardWireVersion,
3883
4928
  compareSemver,
4929
+ computeRelayReprobeDelay,
3884
4930
  daemonIdsEquivalent,
3885
4931
  decodeActiveWorkQueryRequest,
3886
4932
  decodeActiveWorkQueryResponse,
@@ -3923,6 +4969,8 @@ function stableMeshNodeRow(row) {
3923
4969
  decodeQueueQueryResponse,
3924
4970
  decodeQueueRequeueRequest,
3925
4971
  decodeQueueRequeueResponse,
4972
+ decodeQueueReviseRequest,
4973
+ decodeQueueReviseResponse,
3926
4974
  decodeRecordLocalRequest,
3927
4975
  decodeRecordLocalResponse,
3928
4976
  decodeRecoveryContextQueryRequest,
@@ -3942,6 +4990,7 @@ function stableMeshNodeRow(row) {
3942
4990
  decodeUserSessionToDashboard,
3943
4991
  decodeViewerToSharedSession,
3944
4992
  defaultProviderPriorityFromNodeFacts,
4993
+ deriveItemDedupeKey,
3945
4994
  deriveProviderPriorityFromSlots,
3946
4995
  deriveSlotsFromLegacy,
3947
4996
  describeModelSelection,
@@ -3952,13 +5001,19 @@ function stableMeshNodeRow(row) {
3952
5001
  expandDaemonIdForms,
3953
5002
  findOwnershipConflicts,
3954
5003
  foldKeyedDoc,
5004
+ followedRemoteProjectKey,
5005
+ followerOpPermitted,
3955
5006
  formatQuotaAccount,
3956
5007
  hasGitStatusEvidence,
3957
5008
  hasWorkerProtocolFooter,
3958
5009
  interpolateString,
5010
+ isActionableProviderApproval,
5011
+ isAssistantFollowerAllowedOp,
3959
5012
  isAssistantTool,
3960
5013
  isBlockedStatus,
3961
5014
  isBusyStatus,
5015
+ isCarryOverMissionRecord,
5016
+ isCarryOverMissionTitle,
3962
5017
  isChunkType,
3963
5018
  isCommitStrength,
3964
5019
  isDaemonDirectCommandType,
@@ -3977,11 +5032,14 @@ function stableMeshNodeRow(row) {
3977
5032
  isFiniteNumber,
3978
5033
  isIdleSessionState,
3979
5034
  isInputEnvelopeWire,
5035
+ isLaunchDefaultRole,
5036
+ isLaunchDefaultSource,
3980
5037
  isMeshDeliveryMode,
3981
5038
  isMeshIndexQueryResponse,
3982
5039
  isMeshMissionStatusValue,
3983
5040
  isMeshP2PSignalType,
3984
5041
  isMeshRecordPayload,
5042
+ isMeshReleaseChannel,
3985
5043
  isMeshTaskDifficulty,
3986
5044
  isMeshTaskMode,
3987
5045
  isMeshTaskPriority,
@@ -3989,17 +5047,22 @@ function stableMeshNodeRow(row) {
3989
5047
  isMeshTerminalTaskStatus,
3990
5048
  isMeshTopicEntry,
3991
5049
  isMessageId,
5050
+ isMissionOutcome,
5051
+ isMissionRefContained,
3992
5052
  isMissionUpsertResponse,
3993
5053
  isModelAxisSource,
5054
+ isNativeMarkerRef,
3994
5055
  isNonEmptyString,
3995
5056
  isNotifyKind,
3996
5057
  isOutboundMessage,
3997
5058
  isOutboundMessageOrigin,
3998
5059
  isP2PSignalType,
3999
5060
  isPhantomDaemonEntry,
5061
+ isProviderQuestionBinding,
4000
5062
  isRawDaemonDoId,
4001
5063
  isReadyStatus,
4002
5064
  isRecord,
5065
+ isReleaseStatus,
4003
5066
  isSendPolicy,
4004
5067
  isSendPolicyMode,
4005
5068
  isSendRefusal,
@@ -4026,6 +5089,7 @@ function stableMeshNodeRow(row) {
4026
5089
  isWorkingStatus,
4027
5090
  joinRepoPath,
4028
5091
  launchModelSelectionValue,
5092
+ lintChangelogText,
4029
5093
  machineCoreFromDaemonId,
4030
5094
  makeTypeGuard,
4031
5095
  measureWorstCaseChunkEnvelopeBytes,
@@ -4034,33 +5098,45 @@ function stableMeshNodeRow(row) {
4034
5098
  meshUtf8ByteLength,
4035
5099
  meshWorkspacesEquivalent,
4036
5100
  mintMessageId,
5101
+ minutesUntilQuotaCheck,
4037
5102
  normalizeAuthOkLimits,
4038
5103
  normalizeBrainSlot,
5104
+ normalizeDecisionInput,
4039
5105
  normalizeDifficultyBrainMap,
5106
+ normalizeForDedupe,
4040
5107
  normalizeGitStatus,
4041
5108
  normalizeMeshNodeFacts,
4042
5109
  normalizeMeshNodeId,
4043
5110
  normalizeMeshSessionRecord,
4044
5111
  normalizeMeshWorkspaceForCompare,
4045
5112
  normalizeMissionBrief,
5113
+ normalizeMissionItemInput,
5114
+ normalizeMissionItemUpdate,
5115
+ normalizeMissionRefs,
5116
+ normalizeMissionSummary,
4046
5117
  normalizeNodeCapabilitySlot,
4047
5118
  normalizeNodeCapabilitySlots,
5119
+ normalizeOutcomeReason,
4048
5120
  normalizeOwnedPaths,
5121
+ normalizeReportCommits,
4049
5122
  normalizeSessionStatus,
4050
5123
  normalizeThinkingLevel,
4051
5124
  orderProvidersByBuiltinPreference,
4052
5125
  parseJsonRecord,
5126
+ parseRoleLaunchSelection,
4053
5127
  parseSemver,
4054
5128
  parseSessionLaunchRecord,
4055
5129
  pathsOverlap,
4056
5130
  pickBestTransitGitStatus,
4057
5131
  projectFileDiffRow,
4058
5132
  projectTurnEvidenceEntry,
5133
+ providerApprovalSnapshot,
4059
5134
  readBoolean,
4060
5135
  readEnvelopeFields,
4061
5136
  readGitSubmodules,
4062
5137
  readNumber,
4063
5138
  readOptionalRecord,
5139
+ readProviderDecision,
4064
5140
  readRecord,
4065
5141
  readString,
4066
5142
  readStringArray,
@@ -4071,6 +5147,7 @@ function stableMeshNodeRow(row) {
4071
5147
  retiredMeshToolError,
4072
5148
  sanitizeModelIdentifier,
4073
5149
  sanitizeRefusalCode,
5150
+ sanitizeRemoteRepoIdentity,
4074
5151
  scoreGitStatusCandidate,
4075
5152
  scoreGitUpstreamFreshness,
4076
5153
  sessionIdsEquivalent,
@@ -4081,6 +5158,8 @@ function stableMeshNodeRow(row) {
4081
5158
  summarizeGitShape,
4082
5159
  supportsQuota,
4083
5160
  touchedFilesOutsideOwnership,
5161
+ truncateMissionText,
5162
+ unwrapPastedContent,
4084
5163
  withStatusProbeMarker
4085
5164
  });
4086
5165
  //# sourceMappingURL=index.js.map