@adhdev/mesh-shared 1.0.82-rc.6 → 1.0.82-rc.60

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 (69) hide show
  1. package/dist/assistant-protocol.d.ts +163 -6
  2. package/dist/decision-push-relay.d.ts +20 -0
  3. package/dist/index.d.ts +12 -0
  4. package/dist/index.js +1637 -124
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1499 -124
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/launch-defaults.d.ts +196 -0
  9. package/dist/light-task.d.ts +96 -0
  10. package/dist/mesh-tool-names.d.ts +2 -2
  11. package/dist/mesh-vocabulary.d.ts +13 -4
  12. package/dist/mission-git-state.d.ts +83 -0
  13. package/dist/mission-items.d.ts +202 -0
  14. package/dist/node-facts.d.ts +61 -1
  15. package/dist/outbound-message.d.ts +9 -2
  16. package/dist/path-ownership.d.ts +1 -1
  17. package/dist/protocol/daemon-server.d.ts +42 -2
  18. package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
  19. package/dist/protocol/dashboard-server.d.ts +20 -2
  20. package/dist/provider-approval.d.ts +36 -0
  21. package/dist/provider-question.d.ts +19 -0
  22. package/dist/quota-freshness.d.ts +4 -4
  23. package/dist/relay-reprobe.d.ts +52 -0
  24. package/dist/release.d.ts +90 -0
  25. package/dist/role-launch.d.ts +11 -0
  26. package/dist/session-launch.d.ts +10 -22
  27. package/dist/slot-proposal.d.ts +14 -0
  28. package/dist/task-source-phase.d.ts +83 -0
  29. package/dist/task-stages.d.ts +206 -0
  30. package/dist/turn-evidence.d.ts +43 -13
  31. package/dist/turn-ipc-mission.d.ts +72 -1
  32. package/dist/turn-ipc-queue.d.ts +30 -0
  33. package/dist/turn-ipc.d.ts +2 -2
  34. package/dist/types.d.ts +1 -0
  35. package/dist/worker-protocol.d.ts +33 -1
  36. package/package.json +1 -1
  37. package/src/assistant-protocol.ts +306 -6
  38. package/src/daemon-normalize.ts +7 -5
  39. package/src/decision-push-relay.ts +23 -0
  40. package/src/index.ts +13 -0
  41. package/src/keyed-doc-delta.ts +9 -1
  42. package/src/launch-defaults.ts +170 -0
  43. package/src/light-task.ts +116 -0
  44. package/src/mesh-tool-names.ts +22 -0
  45. package/src/mesh-vocabulary.ts +12 -2
  46. package/src/mission-git-state.ts +112 -0
  47. package/src/mission-items.ts +421 -0
  48. package/src/node-facts.ts +56 -1
  49. package/src/outbound-message.ts +19 -0
  50. package/src/path-ownership.ts +4 -6
  51. package/src/protocol/daemon-server.ts +37 -2
  52. package/src/protocol/dashboard-server.ts +13 -2
  53. package/src/provider-approval.ts +59 -0
  54. package/src/provider-question.ts +31 -0
  55. package/src/quota-freshness.ts +29 -13
  56. package/src/relay-reprobe.ts +117 -0
  57. package/src/release.ts +121 -0
  58. package/src/role-launch.ts +51 -0
  59. package/src/session-launch.ts +17 -1
  60. package/src/slot-proposal.ts +61 -2
  61. package/src/task-source-phase.ts +70 -0
  62. package/src/task-stages.ts +455 -0
  63. package/src/turn-evidence.ts +56 -20
  64. package/src/turn-ipc-mission.ts +127 -11
  65. package/src/turn-ipc-queue.ts +43 -2
  66. package/src/turn-ipc-turn.ts +1 -1
  67. package/src/turn-ipc.ts +1 -0
  68. package/src/types.ts +1 -0
  69. package/src/worker-protocol.ts +79 -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,13 +60,34 @@ __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,
56
71
  DISPATCH_FAILURE_REASONS: () => DISPATCH_FAILURE_REASONS,
72
+ DISPATCH_REFUSAL_DETAIL_MAX: () => DISPATCH_REFUSAL_DETAIL_MAX,
57
73
  EVIDENCE_ENVELOPE_FIELD_SPECS: () => EVIDENCE_ENVELOPE_FIELD_SPECS,
58
74
  EVIDENCE_SOURCE_IDS: () => EVIDENCE_SOURCE_IDS,
75
+ FINDING_CATEGORIES: () => FINDING_CATEGORIES,
76
+ FINDING_RESPONSES_MAX: () => FINDING_RESPONSES_MAX,
77
+ FINDING_RESPONSE_KINDS: () => FINDING_RESPONSE_KINDS,
78
+ FINDING_SEVERITIES: () => FINDING_SEVERITIES,
59
79
  HOLD_REASONS: () => HOLD_REASONS,
80
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE: () => LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
81
+ LAUNCH_DEFAULT_ERROR_CODES: () => LAUNCH_DEFAULT_ERROR_CODES,
82
+ LAUNCH_DEFAULT_ROLES: () => LAUNCH_DEFAULT_ROLES,
83
+ LAUNCH_DEFAULT_SOURCES: () => LAUNCH_DEFAULT_SOURCES,
84
+ LEGACY_CARRY_OVER_MISSION_TITLE: () => LEGACY_CARRY_OVER_MISSION_TITLE,
85
+ LIGHT_BLOCK_REASONS: () => LIGHT_BLOCK_REASONS,
86
+ LIGHT_HOLD: () => LIGHT_HOLD,
87
+ LIGHT_LAND_MODES: () => LIGHT_LAND_MODES,
88
+ LIGHT_REJECT: () => LIGHT_REJECT,
89
+ LIGHT_TESTS_RUN_MAX: () => LIGHT_TESTS_RUN_MAX,
90
+ LIGHT_WARNINGS: () => LIGHT_WARNINGS,
60
91
  LIVENESS_RESULTS: () => LIVENESS_RESULTS,
61
92
  MAX_MESH_RECORD_STRING: () => MAX_MESH_RECORD_STRING,
62
93
  MAX_OWNED_PATHS: () => MAX_OWNED_PATHS,
@@ -71,6 +102,8 @@ __export(index_exports, {
71
102
  MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
72
103
  MESH_P2P_SIGNAL_TYPES: () => MESH_P2P_SIGNAL_TYPES,
73
104
  MESH_RECORD_PAYLOAD_KEYS: () => MESH_RECORD_PAYLOAD_KEYS,
105
+ MESH_RELEASE_CHANNELS: () => MESH_RELEASE_CHANNELS,
106
+ MESH_RELEASE_STATUSES: () => MESH_RELEASE_STATUSES,
74
107
  MESH_SESSION_CLEANUP_MODES: () => MESH_SESSION_CLEANUP_MODES,
75
108
  MESH_STATUS_DOC_SPEC: () => MESH_STATUS_DOC_SPEC,
76
109
  MESH_TASK_DIFFICULTIES: () => MESH_TASK_DIFFICULTIES,
@@ -82,10 +115,23 @@ __export(index_exports, {
82
115
  MESH_TOPIC_ENTRY_KINDS: () => MESH_TOPIC_ENTRY_KINDS,
83
116
  MESH_TOPIC_PROTOCOL_VERSION: () => MESH_TOPIC_PROTOCOL_VERSION,
84
117
  MISSION_BRIEF_RENDER_MAX_CHARS: () => MISSION_BRIEF_RENDER_MAX_CHARS,
118
+ MISSION_DECISION_ON_DUE: () => MISSION_DECISION_ON_DUE,
119
+ MISSION_DECISION_OPTION_IDS: () => MISSION_DECISION_OPTION_IDS,
120
+ MISSION_DECISION_URGENCIES: () => MISSION_DECISION_URGENCIES,
121
+ MISSION_GIT_STATES: () => MISSION_GIT_STATES,
122
+ MISSION_ITEM_KINDS: () => MISSION_ITEM_KINDS,
123
+ MISSION_ITEM_STATES: () => MISSION_ITEM_STATES,
124
+ MISSION_LIMITS: () => MISSION_LIMITS,
125
+ MISSION_OUTCOMES: () => MISSION_OUTCOMES,
126
+ MISSION_REF_GIT_METHODS: () => MISSION_REF_GIT_METHODS,
127
+ MISSION_REF_GIT_STATUSES: () => MISSION_REF_GIT_STATUSES,
128
+ MISSION_REF_KINDS: () => MISSION_REF_KINDS,
129
+ MISSION_RELEASE_EVENT_TYPES: () => MISSION_RELEASE_EVENT_TYPES,
85
130
  MODEL_AXIS_SOURCES: () => MODEL_AXIS_SOURCES,
86
131
  MODEL_SELECTION_HISTORY_LIMIT: () => MODEL_SELECTION_HISTORY_LIMIT,
87
132
  MeshChunkAssembler: () => MeshChunkAssembler,
88
133
  NATIVE_TURN_OUTCOMES: () => NATIVE_TURN_OUTCOMES,
134
+ NEEDS_WORDING_MARKER: () => NEEDS_WORDING_MARKER,
89
135
  NOTIFY_KINDS: () => NOTIFY_KINDS,
90
136
  NO_PROGRESS_OBSERVED_STATUSES: () => NO_PROGRESS_OBSERVED_STATUSES,
91
137
  NPM_UPDATE_TAGS: () => NPM_UPDATE_TAGS,
@@ -95,16 +141,37 @@ __export(index_exports, {
95
141
  OPERATOR_STATUS_REASON_VALUES: () => OPERATOR_STATUS_REASON_VALUES,
96
142
  OPERATOR_STATUS_VALUES: () => OPERATOR_STATUS_VALUES,
97
143
  OUTBOUND_MESSAGE_ORIGINS: () => OUTBOUND_MESSAGE_ORIGINS,
144
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX: () => OWNER_ABANDON_CONFIRM_KEY_PREFIX,
145
+ OWNER_ABANDON_CONFIRM_OPTIONS: () => OWNER_ABANDON_CONFIRM_OPTIONS,
146
+ OWNER_ABANDON_CONFIRM_QUESTION: () => OWNER_ABANDON_CONFIRM_QUESTION,
98
147
  P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
148
+ PRIOR_FINDING_STATUSES: () => PRIOR_FINDING_STATUSES,
99
149
  PROVIDER_FAILURES: () => PROVIDER_FAILURES,
100
150
  QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
101
151
  QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
102
152
  QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
103
153
  RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
104
154
  RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
155
+ RELAY_REPROBE_BASE_DELAY_MS: () => RELAY_REPROBE_BASE_DELAY_MS,
156
+ RELAY_REPROBE_JITTER_RATIO: () => RELAY_REPROBE_JITTER_RATIO,
157
+ RELAY_REPROBE_MAX_DELAY_MS: () => RELAY_REPROBE_MAX_DELAY_MS,
158
+ RELEASE_ACTORS: () => RELEASE_ACTORS,
105
159
  RELEASE_CHANNELS: () => RELEASE_CHANNELS,
160
+ RELEASE_EVENT_TYPES: () => RELEASE_EVENT_TYPES,
161
+ RELEASE_LIMITS: () => RELEASE_LIMITS,
162
+ RELEASE_MEMBER_STATES: () => RELEASE_MEMBER_STATES,
106
163
  REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
107
164
  RETIRED_MESH_TOOLS: () => RETIRED_MESH_TOOLS,
165
+ REVIEW_CHECKED_MAX: () => REVIEW_CHECKED_MAX,
166
+ REVIEW_CLAIM_MAX_CHARS: () => REVIEW_CLAIM_MAX_CHARS,
167
+ REVIEW_EVIDENCE_MAX_CHARS: () => REVIEW_EVIDENCE_MAX_CHARS,
168
+ REVIEW_FINDINGS_MAX: () => REVIEW_FINDINGS_MAX,
169
+ REVIEW_FINDING_ID_MAX_CHARS: () => REVIEW_FINDING_ID_MAX_CHARS,
170
+ REVIEW_FIX_MAX_CHARS: () => REVIEW_FIX_MAX_CHARS,
171
+ REVIEW_NOTE_MAX_CHARS: () => REVIEW_NOTE_MAX_CHARS,
172
+ REVIEW_TESTS_RUN_MAX: () => REVIEW_TESTS_RUN_MAX,
173
+ REVIEW_VERDICTS: () => REVIEW_VERDICTS,
174
+ RelayReprobeScheduler: () => RelayReprobeScheduler,
108
175
  SEND_POLICY_MODES: () => SEND_POLICY_MODES,
109
176
  SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
110
177
  SERVER_STATUS_EVENT_NAMES: () => SERVER_STATUS_EVENT_NAMES,
@@ -117,6 +184,17 @@ __export(index_exports, {
117
184
  SESSION_STATUS_ALIASES: () => SESSION_STATUS_ALIASES,
118
185
  SESSION_STATUS_CLASS: () => SESSION_STATUS_CLASS,
119
186
  SHARED_SESSION_TO_VIEWER_TYPES: () => SHARED_SESSION_TO_VIEWER_TYPES,
187
+ STAGE_BLOCKED_REASONS: () => STAGE_BLOCKED_REASONS,
188
+ STAGE_DECIDE_ACTIONS: () => STAGE_DECIDE_ACTIONS,
189
+ STAGE_DEFAULT_MAX_REVISIONS: () => STAGE_DEFAULT_MAX_REVISIONS,
190
+ STAGE_INDEPENDENCE_FALLBACK_MS: () => STAGE_INDEPENDENCE_FALLBACK_MS,
191
+ STAGE_INDEPENDENCE_MODES: () => STAGE_INDEPENDENCE_MODES,
192
+ STAGE_MAX_REVISIONS_LIMIT: () => STAGE_MAX_REVISIONS_LIMIT,
193
+ STAGE_PARKED_PHASES: () => STAGE_PARKED_PHASES,
194
+ STAGE_PHASES: () => STAGE_PHASES,
195
+ STAGE_PIPELINE_CEILING_DEFAULT_MS: () => STAGE_PIPELINE_CEILING_DEFAULT_MS,
196
+ STAGE_ROLES: () => STAGE_ROLES,
197
+ STAGE_SELF_CHECK_MAX_BOUNCES: () => STAGE_SELF_CHECK_MAX_BOUNCES,
120
198
  STATUS_PROBE_ARG_KEY: () => STATUS_PROBE_ARG_KEY,
121
199
  SUSPENSION_MODALS: () => SUSPENSION_MODALS,
122
200
  SUSPENSION_RESOLUTIONS: () => SUSPENSION_RESOLUTIONS,
@@ -142,17 +220,26 @@ __export(index_exports, {
142
220
  VERSION_UPDATE_REASONS: () => VERSION_UPDATE_REASONS,
143
221
  VIEWER_TO_SHARED_SESSION_TYPES: () => VIEWER_TO_SHARED_SESSION_TYPES,
144
222
  WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
223
+ WORKER_COMMITS_MAX: () => WORKER_COMMITS_MAX,
224
+ WORKER_CURRENT_BRANCH_RULE: () => WORKER_CURRENT_BRANCH_RULE,
225
+ WORKER_DECISIONS_NEEDED_MAX: () => WORKER_DECISIONS_NEEDED_MAX,
145
226
  WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
146
227
  WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
228
+ WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
147
229
  WORKER_TOOLS: () => WORKER_TOOLS,
230
+ aggregateMissionGitState: () => aggregateMissionGitState,
148
231
  appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
149
232
  argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
150
233
  assessQuotaFreshness: () => assessQuotaFreshness,
234
+ boundEventPayload: () => boundEventPayload,
151
235
  buildSlotProposal: () => buildSlotProposal,
152
236
  canonicalDaemonId: () => canonicalDaemonId,
237
+ changelogMissionMarker: () => changelogMissionMarker,
238
+ classifyChangelogSection: () => classifyChangelogSection,
153
239
  classifySessionStatus: () => classifySessionStatus,
154
240
  compareDashboardWireVersion: () => compareDashboardWireVersion,
155
241
  compareSemver: () => compareSemver,
242
+ computeRelayReprobeDelay: () => computeRelayReprobeDelay,
156
243
  daemonIdsEquivalent: () => daemonIdsEquivalent,
157
244
  decodeActiveWorkQueryRequest: () => decodeActiveWorkQueryRequest,
158
245
  decodeActiveWorkQueryResponse: () => decodeActiveWorkQueryResponse,
@@ -195,6 +282,8 @@ __export(index_exports, {
195
282
  decodeQueueQueryResponse: () => decodeQueueQueryResponse,
196
283
  decodeQueueRequeueRequest: () => decodeQueueRequeueRequest,
197
284
  decodeQueueRequeueResponse: () => decodeQueueRequeueResponse,
285
+ decodeQueueReviseRequest: () => decodeQueueReviseRequest,
286
+ decodeQueueReviseResponse: () => decodeQueueReviseResponse,
198
287
  decodeRecordLocalRequest: () => decodeRecordLocalRequest,
199
288
  decodeRecordLocalResponse: () => decodeRecordLocalResponse,
200
289
  decodeRecoveryContextQueryRequest: () => decodeRecoveryContextQueryRequest,
@@ -214,6 +303,8 @@ __export(index_exports, {
214
303
  decodeUserSessionToDashboard: () => decodeUserSessionToDashboard,
215
304
  decodeViewerToSharedSession: () => decodeViewerToSharedSession,
216
305
  defaultProviderPriorityFromNodeFacts: () => defaultProviderPriorityFromNodeFacts,
306
+ defaultStagePlan: () => defaultStagePlan,
307
+ deriveItemDedupeKey: () => deriveItemDedupeKey,
217
308
  deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
218
309
  deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
219
310
  describeModelSelection: () => describeModelSelection,
@@ -224,13 +315,21 @@ __export(index_exports, {
224
315
  expandDaemonIdForms: () => expandDaemonIdForms,
225
316
  findOwnershipConflicts: () => findOwnershipConflicts,
226
317
  foldKeyedDoc: () => foldKeyedDoc,
318
+ followedRemoteProjectKey: () => followedRemoteProjectKey,
319
+ followerOpPermitted: () => followerOpPermitted,
227
320
  formatQuotaAccount: () => formatQuotaAccount,
321
+ formatStageVerdictLine: () => formatStageVerdictLine,
228
322
  hasGitStatusEvidence: () => hasGitStatusEvidence,
229
323
  hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
230
324
  interpolateString: () => interpolateString,
325
+ isActionableProviderApproval: () => isActionableProviderApproval,
326
+ isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
231
327
  isAssistantTool: () => isAssistantTool,
232
328
  isBlockedStatus: () => isBlockedStatus,
329
+ isBlockingSeverity: () => isBlockingSeverity,
233
330
  isBusyStatus: () => isBusyStatus,
331
+ isCarryOverMissionRecord: () => isCarryOverMissionRecord,
332
+ isCarryOverMissionTitle: () => isCarryOverMissionTitle,
234
333
  isChunkType: () => isChunkType,
235
334
  isCommitStrength: () => isCommitStrength,
236
335
  isDaemonDirectCommandType: () => isDaemonDirectCommandType,
@@ -246,14 +345,21 @@ __export(index_exports, {
246
345
  isDeadStatus: () => isDeadStatus,
247
346
  isDowngrade: () => isDowngrade,
248
347
  isEvidenceIdentifier: () => isEvidenceIdentifier,
348
+ isFindingCategory: () => isFindingCategory,
349
+ isFindingResponseKind: () => isFindingResponseKind,
350
+ isFindingSeverity: () => isFindingSeverity,
249
351
  isFiniteNumber: () => isFiniteNumber,
250
352
  isIdleSessionState: () => isIdleSessionState,
251
353
  isInputEnvelopeWire: () => isInputEnvelopeWire,
354
+ isLaunchDefaultRole: () => isLaunchDefaultRole,
355
+ isLaunchDefaultSource: () => isLaunchDefaultSource,
356
+ isLightWorkerSession: () => isLightWorkerSession,
252
357
  isMeshDeliveryMode: () => isMeshDeliveryMode,
253
358
  isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
254
359
  isMeshMissionStatusValue: () => isMeshMissionStatusValue,
255
360
  isMeshP2PSignalType: () => isMeshP2PSignalType,
256
361
  isMeshRecordPayload: () => isMeshRecordPayload,
362
+ isMeshReleaseChannel: () => isMeshReleaseChannel,
257
363
  isMeshTaskDifficulty: () => isMeshTaskDifficulty,
258
364
  isMeshTaskMode: () => isMeshTaskMode,
259
365
  isMeshTaskPriority: () => isMeshTaskPriority,
@@ -261,17 +367,24 @@ __export(index_exports, {
261
367
  isMeshTerminalTaskStatus: () => isMeshTerminalTaskStatus,
262
368
  isMeshTopicEntry: () => isMeshTopicEntry,
263
369
  isMessageId: () => isMessageId,
370
+ isMissionOutcome: () => isMissionOutcome,
371
+ isMissionRefContained: () => isMissionRefContained,
264
372
  isMissionUpsertResponse: () => isMissionUpsertResponse,
265
373
  isModelAxisSource: () => isModelAxisSource,
374
+ isNativeMarkerRef: () => isNativeMarkerRef,
266
375
  isNonEmptyString: () => isNonEmptyString,
267
376
  isNotifyKind: () => isNotifyKind,
268
377
  isOutboundMessage: () => isOutboundMessage,
269
378
  isOutboundMessageOrigin: () => isOutboundMessageOrigin,
270
379
  isP2PSignalType: () => isP2PSignalType,
271
380
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
381
+ isPriorFindingStatus: () => isPriorFindingStatus,
382
+ isProviderQuestionBinding: () => isProviderQuestionBinding,
272
383
  isRawDaemonDoId: () => isRawDaemonDoId,
273
384
  isReadyStatus: () => isReadyStatus,
274
385
  isRecord: () => isRecord,
386
+ isReleaseStatus: () => isReleaseStatus,
387
+ isReviewVerdict: () => isReviewVerdict,
275
388
  isSendPolicy: () => isSendPolicy,
276
389
  isSendPolicyMode: () => isSendPolicyMode,
277
390
  isSendRefusal: () => isSendRefusal,
@@ -280,6 +393,8 @@ __export(index_exports, {
280
393
  isSessionLaunchedBy: () => isSessionLaunchedBy,
281
394
  isSessionStatus: () => isSessionStatus,
282
395
  isSharedSessionToViewerType: () => isSharedSessionToViewerType,
396
+ isStageBlockedReason: () => isStageBlockedReason,
397
+ isStageEligibleTask: () => isStageEligibleTask,
283
398
  isSubmitOutcome: () => isSubmitOutcome,
284
399
  isSummaryRef: () => isSummaryRef,
285
400
  isTerminalSessionRecordStatus: () => isTerminalSessionRecordStatus,
@@ -298,6 +413,7 @@ __export(index_exports, {
298
413
  isWorkingStatus: () => isWorkingStatus,
299
414
  joinRepoPath: () => joinRepoPath,
300
415
  launchModelSelectionValue: () => launchModelSelectionValue,
416
+ lintChangelogText: () => lintChangelogText,
301
417
  machineCoreFromDaemonId: () => machineCoreFromDaemonId,
302
418
  makeTypeGuard: () => makeTypeGuard,
303
419
  measureWorstCaseChunkEnvelopeBytes: () => measureWorstCaseChunkEnvelopeBytes,
@@ -309,41 +425,58 @@ __export(index_exports, {
309
425
  minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
310
426
  normalizeAuthOkLimits: () => normalizeAuthOkLimits,
311
427
  normalizeBrainSlot: () => normalizeBrainSlot,
428
+ normalizeDecisionInput: () => normalizeDecisionInput,
312
429
  normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
430
+ normalizeForDedupe: () => normalizeForDedupe,
313
431
  normalizeGitStatus: () => normalizeGitStatus,
314
432
  normalizeMeshNodeFacts: () => normalizeMeshNodeFacts,
315
433
  normalizeMeshNodeId: () => normalizeMeshNodeId,
316
434
  normalizeMeshSessionRecord: () => normalizeMeshSessionRecord,
317
435
  normalizeMeshWorkspaceForCompare: () => normalizeMeshWorkspaceForCompare,
318
436
  normalizeMissionBrief: () => normalizeMissionBrief,
437
+ normalizeMissionItemInput: () => normalizeMissionItemInput,
438
+ normalizeMissionItemUpdate: () => normalizeMissionItemUpdate,
439
+ normalizeMissionRefs: () => normalizeMissionRefs,
440
+ normalizeMissionSummary: () => normalizeMissionSummary,
319
441
  normalizeNodeCapabilitySlot: () => normalizeNodeCapabilitySlot,
320
442
  normalizeNodeCapabilitySlots: () => normalizeNodeCapabilitySlots,
443
+ normalizeOutcomeReason: () => normalizeOutcomeReason,
321
444
  normalizeOwnedPaths: () => normalizeOwnedPaths,
445
+ normalizeReportCommits: () => normalizeReportCommits,
322
446
  normalizeSessionStatus: () => normalizeSessionStatus,
323
447
  normalizeThinkingLevel: () => normalizeThinkingLevel,
324
448
  orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
325
449
  parseJsonRecord: () => parseJsonRecord,
450
+ parseRoleLaunchSelection: () => parseRoleLaunchSelection,
326
451
  parseSemver: () => parseSemver,
327
452
  parseSessionLaunchRecord: () => parseSessionLaunchRecord,
328
453
  pathsOverlap: () => pathsOverlap,
329
454
  pickBestTransitGitStatus: () => pickBestTransitGitStatus,
330
455
  projectFileDiffRow: () => projectFileDiffRow,
331
456
  projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
457
+ providerApprovalSnapshot: () => providerApprovalSnapshot,
332
458
  readBoolean: () => readBoolean,
333
459
  readEnvelopeFields: () => readEnvelopeFields,
334
460
  readGitSubmodules: () => readGitSubmodules,
335
461
  readNumber: () => readNumber,
336
462
  readOptionalRecord: () => readOptionalRecord,
463
+ readProviderDecision: () => readProviderDecision,
337
464
  readRecord: () => readRecord,
338
465
  readString: () => readString,
339
466
  readStringArray: () => readStringArray,
340
467
  readText: () => readText,
341
468
  renderCoordinatorWorkerSection: () => renderCoordinatorWorkerSection,
469
+ renderLightWorkspaceRules: () => renderLightWorkspaceRules,
342
470
  renderMissionBriefBlock: () => renderMissionBriefBlock,
471
+ renderStageProtocolLines: () => renderStageProtocolLines,
343
472
  renderWorkerProtocolFooter: () => renderWorkerProtocolFooter,
473
+ resolveStagePlan: () => resolveStagePlan,
344
474
  retiredMeshToolError: () => retiredMeshToolError,
475
+ reviewIndependenceOf: () => reviewIndependenceOf,
476
+ sanitizeDispatchRefusalDetail: () => sanitizeDispatchRefusalDetail,
345
477
  sanitizeModelIdentifier: () => sanitizeModelIdentifier,
346
478
  sanitizeRefusalCode: () => sanitizeRefusalCode,
479
+ sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
347
480
  scoreGitStatusCandidate: () => scoreGitStatusCandidate,
348
481
  scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
349
482
  sessionIdsEquivalent: () => sessionIdsEquivalent,
@@ -354,6 +487,11 @@ __export(index_exports, {
354
487
  summarizeGitShape: () => summarizeGitShape,
355
488
  supportsQuota: () => supportsQuota,
356
489
  touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
490
+ truncateMissionText: () => truncateMissionText,
491
+ unwrapPastedContent: () => unwrapPastedContent,
492
+ validateFindingResponses: () => validateFindingResponses,
493
+ validateReviewReport: () => validateReviewReport,
494
+ validateTestsRun: () => validateTestsRun,
357
495
  withStatusProbeMarker: () => withStatusProbeMarker
358
496
  });
359
497
  module.exports = __toCommonJS(index_exports);
@@ -554,15 +692,15 @@ function pickBestTransitGitStatus(node, options) {
554
692
  }
555
693
 
556
694
  // src/session-normalize.ts
557
- function deriveSyntheticSessionId(record) {
695
+ function deriveSyntheticSessionId(record2) {
558
696
  const parts = [
559
- readString(record.workspace),
560
- readString(record.providerType, record.provider),
561
- readString(record.role),
562
- readString(record.state, record.status),
563
- readString(record.title),
564
- readString(record.createdAt, record.created_at),
565
- readString(record.startedAt, record.started_at)
697
+ readString(record2.workspace),
698
+ readString(record2.providerType, record2.provider),
699
+ readString(record2.role),
700
+ readString(record2.state, record2.status),
701
+ readString(record2.title),
702
+ readString(record2.createdAt, record2.created_at),
703
+ readString(record2.startedAt, record2.started_at)
566
704
  ].filter((part) => Boolean(part));
567
705
  if (parts.length === 0) return void 0;
568
706
  return `synthetic:${parts.join("|")}`;
@@ -574,33 +712,33 @@ function sessionIdsEquivalent(a, b) {
574
712
  return idA === idB;
575
713
  }
576
714
  function normalizeMeshSessionRecord(entry) {
577
- const record = readRecord(entry);
578
- const sessionId = readString(record.sessionId, record.session_id, record.id) ?? deriveSyntheticSessionId(record);
715
+ const record2 = readRecord(entry);
716
+ const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
579
717
  if (!sessionId) return null;
580
718
  return {
581
719
  sessionId,
582
- ...readString(record.providerType, record.provider) ? { providerType: readString(record.providerType, record.provider) } : {},
583
- ...readString(record.state, record.status) ? { state: readString(record.state, record.status) } : {},
584
- ...readString(record.chatStatus, record.chat_status) ? { chatStatus: readString(record.chatStatus, record.chat_status) } : {},
585
- ...readString(record.lifecycle) ? { lifecycle: readString(record.lifecycle) } : {},
586
- ...readString(record.surfaceKind, record.surface_kind) ? { surfaceKind: readString(record.surfaceKind, record.surface_kind) } : {},
587
- ...readString(record.recoveryState, record.recovery_state) ? { recoveryState: readString(record.recoveryState, record.recovery_state) } : {},
588
- ...readString(record.workspace) ? { workspace: readString(record.workspace) } : {},
589
- ...readString(record.title) ? { title: readString(record.title) } : {},
590
- ...readString(record.role) ? { role: readString(record.role) } : {},
591
- ...readBoolean(record.isSelfCoordinator, record.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record.isSelfCoordinator, record.is_self_coordinator) } : {},
592
- ...readString(record.statusNote, record.status_note) ? { statusNote: readString(record.statusNote, record.status_note) } : {},
593
- ...readString(record.createdAt, record.created_at) ? { createdAt: readString(record.createdAt, record.created_at) } : {},
594
- ...readString(record.startedAt, record.started_at) ? { startedAt: readString(record.startedAt, record.started_at) } : {},
595
- ...readString(record.lastActivityAt, record.last_activity_at) ? { lastActivityAt: readString(record.lastActivityAt, record.last_activity_at) } : {},
596
- ...readBoolean(record.isCached, record.is_cached) !== void 0 ? { isCached: readBoolean(record.isCached, record.is_cached) } : {}
720
+ ...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
721
+ ...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
722
+ ...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
723
+ ...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
724
+ ...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
725
+ ...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
726
+ ...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
727
+ ...readString(record2.title) ? { title: readString(record2.title) } : {},
728
+ ...readString(record2.role) ? { role: readString(record2.role) } : {},
729
+ ...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
730
+ ...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
731
+ ...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
732
+ ...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
733
+ ...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
734
+ ...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
597
735
  };
598
736
  }
599
737
 
600
738
  // src/node-normalize.ts
601
739
  function normalizeMeshNodeId(node) {
602
- const record = node && typeof node === "object" ? node : {};
603
- return readString(record.id, record.nodeId, record.node_id);
740
+ const record2 = node && typeof node === "object" ? node : {};
741
+ return readString(record2.id, record2.nodeId, record2.node_id);
604
742
  }
605
743
  function meshNodeIdMatches(node, candidateId) {
606
744
  if (!candidateId) return false;
@@ -612,12 +750,12 @@ function meshNodeIdMatches(node, candidateId) {
612
750
  // src/node-facts.ts
613
751
  function normalizeMeshNodeFacts(raw) {
614
752
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
615
- const record = raw;
616
- const schemaVersion = Number(record.schemaVersion);
617
- const reportedAt = Number(record.reportedAt);
753
+ const record2 = raw;
754
+ const schemaVersion = Number(record2.schemaVersion);
755
+ const reportedAt = Number(record2.reportedAt);
618
756
  if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
619
757
  if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
620
- return { ...record, schemaVersion, reportedAt };
758
+ return { ...record2, schemaVersion, reportedAt };
621
759
  }
622
760
  var QUOTA_SUPPORTED_PROVIDERS = [
623
761
  "antigravity-cli",
@@ -667,7 +805,7 @@ function hasUsableWindow(window) {
667
805
  return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
668
806
  }
669
807
  function hasReading(quota) {
670
- if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly)) return true;
808
+ if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
671
809
  return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
672
810
  }
673
811
  function finiteMs(value) {
@@ -685,9 +823,17 @@ function backfillCheckAt(quota, now) {
685
823
  function assessQuotaFreshness(quota, now = Date.now()) {
686
824
  const meta = quota.metadata;
687
825
  const kind = meta?.failureKind;
688
- const userMustAct = kind === "no-data" && quota.provider !== "codex-cli" || kind === "expired-token" && quota.provider === "antigravity-cli";
689
- if (userMustAct && hasReading(quota)) return { cue: "stale", userMustAct: true };
690
- if (meta?.lastGoodWindows !== true) return { userMustAct };
826
+ const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
827
+ const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
828
+ if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
829
+ if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
830
+ if (meta?.lastGoodWindows !== true) {
831
+ const measuredAt = finiteMs(quota.updatedAt);
832
+ if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
833
+ return { cue: "stale", userMustAct };
834
+ }
835
+ return { userMustAct };
836
+ }
691
837
  const retryAtMs = finiteMs(meta?.retryAtMs);
692
838
  const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
693
839
  if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
@@ -727,19 +873,21 @@ function isPhantomDaemonEntry(entry) {
727
873
  function machineCoreFromDaemonId(id2) {
728
874
  const trimmed = readString(id2);
729
875
  if (!trimmed) return void 0;
876
+ const lower = trimmed.toLowerCase();
730
877
  for (const prefix of DAEMON_ID_PREFIXES) {
731
- if (trimmed.startsWith(prefix)) {
878
+ if (lower.startsWith(prefix)) {
732
879
  const core = trimmed.slice(prefix.length).trim();
733
- return core || void 0;
880
+ if (!core) return void 0;
881
+ return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
734
882
  }
735
883
  }
736
- return trimmed;
884
+ return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
737
885
  }
738
886
  function canonicalDaemonId(id2) {
739
887
  const core = machineCoreFromDaemonId(id2);
740
888
  if (!core) return void 0;
741
- if (!core.startsWith("mach_")) return core;
742
- return `daemon_${core}`;
889
+ if (!/^mach_/i.test(core)) return core;
890
+ return `daemon_mach_${core.slice(5)}`;
743
891
  }
744
892
  function daemonIdsEquivalent(a, b) {
745
893
  const coreA = machineCoreFromDaemonId(a);
@@ -768,9 +916,9 @@ function expandDaemonIdForms(ids) {
768
916
 
769
917
  // src/git-summarize.ts
770
918
  function summarizeGitShape(status) {
771
- const record = readRecord(status);
772
- if (!Object.keys(record).length) return null;
773
- const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => {
919
+ const record2 = readRecord(status);
920
+ if (!Object.keys(record2).length) return null;
921
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
774
922
  const sub = readRecord(entry);
775
923
  return {
776
924
  path: readString(sub.path) ?? null,
@@ -780,23 +928,23 @@ function summarizeGitShape(status) {
780
928
  };
781
929
  }) : [];
782
930
  return {
783
- isGitRepo: readBoolean(record.isGitRepo),
784
- workspace: readString(record.workspace) ?? null,
785
- repoRoot: readString(record.repoRoot, record.repo_root) ?? null,
786
- branch: readString(record.branch) ?? null,
787
- upstream: readString(record.upstream) ?? null,
788
- upstreamStatus: readString(record.upstreamStatus, record.upstream_status) ?? null,
789
- headCommit: readString(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
790
- ahead: readNumber(record.ahead) ?? null,
791
- behind: readNumber(record.behind) ?? null,
931
+ isGitRepo: readBoolean(record2.isGitRepo),
932
+ workspace: readString(record2.workspace) ?? null,
933
+ repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
934
+ branch: readString(record2.branch) ?? null,
935
+ upstream: readString(record2.upstream) ?? null,
936
+ upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
937
+ headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
938
+ ahead: readNumber(record2.ahead) ?? null,
939
+ behind: readNumber(record2.behind) ?? null,
792
940
  dirtyCounts: {
793
- staged: readNumber(record.staged) ?? 0,
794
- modified: readNumber(record.modified) ?? 0,
795
- untracked: readNumber(record.untracked) ?? 0,
796
- deleted: readNumber(record.deleted) ?? 0,
797
- renamed: readNumber(record.renamed) ?? 0
941
+ staged: readNumber(record2.staged) ?? 0,
942
+ modified: readNumber(record2.modified) ?? 0,
943
+ untracked: readNumber(record2.untracked) ?? 0,
944
+ deleted: readNumber(record2.deleted) ?? 0,
945
+ renamed: readNumber(record2.renamed) ?? 0
798
946
  },
799
- lastCheckedAt: readNumber(record.lastCheckedAt, record.last_checked_at) ?? null,
947
+ lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
800
948
  submoduleCount: submodules.length,
801
949
  submodules
802
950
  };
@@ -962,10 +1110,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
962
1110
  ],
963
1111
  "antigravity-cli": [
964
1112
  {
965
- model: "Gemini 3.1 Pro (High)",
1113
+ model: "Gemini 3.8 Flash (High)",
1114
+ modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
966
1115
  difficulty: ["easy"],
967
1116
  maxParallel: 2,
968
1117
  rationale: "Cheap capacity for easy tasks."
1118
+ },
1119
+ {
1120
+ model: "Gemini 4 Argon (Medium)",
1121
+ modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
1122
+ difficulty: ["medium"],
1123
+ maxParallel: 2,
1124
+ rationale: "Balanced Argon tier for medium tasks."
1125
+ },
1126
+ {
1127
+ model: "Gemini 4 Argon (High)",
1128
+ modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
1129
+ difficulty: ["difficult"],
1130
+ maxParallel: 1,
1131
+ rationale: "Reserved for hard tasks; capped at 1 to bound cost."
969
1132
  }
970
1133
  ],
971
1134
  "cursor-cli": [
@@ -1004,6 +1167,24 @@ function dedupeDetected(detected) {
1004
1167
  }
1005
1168
  return out;
1006
1169
  }
1170
+ function resolveRecipeModel(recipe, modelOptions) {
1171
+ if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
1172
+ return recipe.model;
1173
+ }
1174
+ const available = new Set(
1175
+ modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
1176
+ );
1177
+ if (available.size === 0) return recipe.model;
1178
+ const candidates = [
1179
+ ...recipe.model ? [recipe.model] : [],
1180
+ ...recipe.modelCandidates ?? []
1181
+ ];
1182
+ for (const candidate of candidates) {
1183
+ const trimmed = typeof candidate === "string" ? candidate.trim() : "";
1184
+ if (trimmed && available.has(trimmed)) return trimmed;
1185
+ }
1186
+ return recipe.model;
1187
+ }
1007
1188
  function buildSlotProposal(detected, currentSlots = []) {
1008
1189
  const providers = dedupeDetected(detected ?? []);
1009
1190
  const proposedSlots = [];
@@ -1019,7 +1200,7 @@ function buildSlotProposal(detected, currentSlots = []) {
1019
1200
  for (const recipe of recipes) {
1020
1201
  const slot = normalizeNodeCapabilitySlot({
1021
1202
  provider: provider.type,
1022
- model: recipe.model,
1203
+ model: resolveRecipeModel(recipe, provider.modelOptions),
1023
1204
  thinkingLevel: recipe.thinkingLevel,
1024
1205
  difficulty: recipe.difficulty,
1025
1206
  maxParallel: recipe.maxParallel
@@ -1072,7 +1253,12 @@ var CANONICAL_MESH_TOOL_NAMES = [
1072
1253
  "mesh_enqueue_task",
1073
1254
  "mesh_view_queue",
1074
1255
  "mesh_queue_cancel",
1256
+ "mesh_task_stage_decide",
1257
+ "mesh_direct_cancel",
1075
1258
  "mesh_queue_requeue",
1259
+ "mesh_queue_revise",
1260
+ "mesh_light_land",
1261
+ "mesh_light_discard",
1076
1262
  "mesh_send_task",
1077
1263
  "mesh_read_chat",
1078
1264
  "mesh_read_debug",
@@ -1089,8 +1275,13 @@ var CANONICAL_MESH_TOOL_NAMES = [
1089
1275
  "mesh_list_pending_approvals",
1090
1276
  "mesh_create",
1091
1277
  "mesh_add_node",
1278
+ "mesh_reattach_source_parent",
1279
+ "mesh_attach_remote",
1280
+ "mesh_host_pairing",
1092
1281
  "mesh_clone_node",
1093
1282
  "mesh_remove_node",
1283
+ "mesh_retry_node_bootstrap",
1284
+ "mesh_recover_node_identity",
1094
1285
  "mesh_cleanup_worktree_nodes",
1095
1286
  "mesh_refine_node",
1096
1287
  "mesh_refine_batch",
@@ -1107,8 +1298,20 @@ var CANONICAL_MESH_TOOL_NAMES = [
1107
1298
  "mesh_reconcile_ledger",
1108
1299
  "mesh_mission_upsert",
1109
1300
  "mesh_mission_list",
1301
+ "mesh_mission_git_eval",
1302
+ "mesh_release_upsert",
1303
+ "mesh_release_scope",
1304
+ "mesh_release_list",
1305
+ "mesh_release_record_deploy",
1306
+ "mesh_release_changelog_draft",
1307
+ "mesh_file_transfer",
1110
1308
  "mesh_review_inbox",
1111
- "mesh_node_slots"
1309
+ "mesh_node_slots",
1310
+ "driver_list",
1311
+ "driver_describe",
1312
+ "artifact_list",
1313
+ "artifact_read",
1314
+ "artifact_register"
1112
1315
  ];
1113
1316
  var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
1114
1317
  var RETIRED_MESH_TOOLS = {
@@ -1418,9 +1621,15 @@ var DAEMON_STATUS_EVENT_NAMES = [
1418
1621
  "agent:waiting_choice",
1419
1622
  "agent:generating_completed",
1420
1623
  "agent:stopped",
1421
- "monitor:no_progress"
1624
+ "monitor:no_progress",
1625
+ // An owner decision (structured missions) needs the owner. Server-bound for the push only;
1626
+ // the dashboard learns about decisions over P2P (`mission_decisions_list`).
1627
+ "agent:decision_needed"
1422
1628
  ];
1423
1629
  var isDaemonStatusEventName = makeTypeGuard(DAEMON_STATUS_EVENT_NAMES);
1630
+ var DECISION_PUSH_QUESTION_MAX = 80;
1631
+ var DECISION_PUSH_OPTION_LABEL_MAX = 24;
1632
+ var DECISION_PUSH_OPTIONS_MAX = 3;
1424
1633
  var RELEASE_CHANNELS = ["stable", "preview"];
1425
1634
  var NPM_UPDATE_TAGS = ["latest", "next"];
1426
1635
  var VERSION_UPDATE_REASONS = ["force_update_below", "major_minor_mismatch", "patch_mismatch", "daemon_ahead"];
@@ -1783,21 +1992,22 @@ function isTerminalSessionRecordStatus(raw) {
1783
1992
  return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
1784
1993
  }
1785
1994
  function isIdleSessionState(state) {
1786
- const record = state && typeof state === "object" ? state : {};
1787
- const status = typeof record.status === "string" ? record.status.trim().toLowerCase() : "";
1995
+ const record2 = state && typeof state === "object" ? state : {};
1996
+ const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
1788
1997
  if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
1789
- return isReadyStatus(status) || record.activeChat?.status === "waiting_input";
1998
+ return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
1790
1999
  }
1791
2000
 
1792
2001
  // src/mesh-vocabulary.ts
1793
- var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
1794
- var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
2002
+ var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
2003
+ var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
1795
2004
  var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
1796
2005
  var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
1797
2006
  var MESH_THINKING_LEVELS = ["low", "medium", "high"];
1798
2007
  var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
1799
2008
  var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
1800
2009
  var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
2010
+ var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
1801
2011
  var WORKER_BRANCH_STATES = [
1802
2012
  "merged_to_main",
1803
2013
  "pushed_feature_branch_needs_merge",
@@ -1864,6 +2074,7 @@ var SEND_REFUSAL_REASONS = [
1864
2074
  "no_target",
1865
2075
  "bootstrap_pending",
1866
2076
  "duplicate_dispatch",
2077
+ "new_work_held",
1867
2078
  "internal_error"
1868
2079
  ];
1869
2080
  function isSendRefusal(value) {
@@ -1895,6 +2106,14 @@ function isOutboundMessage(value) {
1895
2106
  const candidate = value;
1896
2107
  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";
1897
2108
  }
2109
+ var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2110
+ var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2111
+ function unwrapPastedContent(text) {
2112
+ const lines = text.replace(/\r\n?/g, "\n").split("\n");
2113
+ const first = lines.findIndex((line) => line.trim());
2114
+ if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
2115
+ return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
2116
+ }
1898
2117
 
1899
2118
  // src/mission-brief.ts
1900
2119
  var GOAL_MAX = 500;
@@ -1980,13 +2199,38 @@ var WORKER_TOOLS = [
1980
2199
  "peer_context_pull",
1981
2200
  "git_status",
1982
2201
  "git_log",
1983
- "git_diff"
2202
+ "git_diff",
2203
+ "driver_list",
2204
+ "driver_describe",
2205
+ "driver_invoke",
2206
+ "driver_scaffold",
2207
+ "driver_validate",
2208
+ "driver_export",
2209
+ "driver_install",
2210
+ "artifact_register",
2211
+ "artifact_list",
2212
+ "artifact_read",
2213
+ // Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
2214
+ // read claim (C1) and the authoritative head/notice pull.
2215
+ "contract_read",
2216
+ "contract_observe",
2217
+ "contract_current"
1984
2218
  ];
1985
2219
  var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
1986
2220
  function isWorkerTool(value) {
1987
2221
  return typeof value === "string" && WORKER_TOOL_SET.has(value);
1988
2222
  }
1989
2223
  var WORKER_PROTOCOL_FOOTER_MARKER = "--- adhdev worker protocol ---";
2224
+ function renderLightWorkspaceRules(light) {
2225
+ const base = light.ossBaseSha ? `${light.baseSha} (oss ${light.ossBaseSha})` : light.baseSha;
2226
+ return [
2227
+ `You are working in a temporary light workspace at \`${light.workspace}\` based on \`${base}\`. Work only inside it. Commit your change there (the branch is already set up); do not push.`,
2228
+ "Do not run `npm install`/`npm ci`/`npm rebuild`/`node-gyp`, do not change package.json or lockfiles \u2014 if the fix needs a dependency change, stop and report `blocked`.",
2229
+ "Do not start long-running servers on fixed ports. Run the narrowest tests that cover your change and list them in `report_completion.testsRun`.",
2230
+ light.ownedPaths.length ? `Stay inside \`owned_paths\` (${light.ownedPaths.join(", ")}); if you must touch more, say why in the summary.` : "Stay inside the paths the task names; if you must touch more, say why in the summary."
2231
+ ];
2232
+ }
2233
+ var WORKER_CURRENT_BRANCH_RULE = "Commit your change on the branch that is currently checked out in this workspace. Do not create or switch branches (no `git checkout -b` / `git switch`) unless the task explicitly says to; report the branch you committed on.";
1990
2234
  function hasWorkerProtocolFooter(body) {
1991
2235
  return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
1992
2236
  }
@@ -2008,6 +2252,8 @@ function renderWorkerProtocolFooter(input = {}) {
2008
2252
  if (input.readonly) scope.push("read-only");
2009
2253
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
2010
2254
  else lines.push("You are a delegated worker.");
2255
+ if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
2256
+ else if (input.commitOnCurrentBranch && input.stage?.role !== "review") lines.push(WORKER_CURRENT_BRANCH_RULE);
2011
2257
  if (input.workerMcp === false) {
2012
2258
  lines.push(
2013
2259
  "This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, `git_*`) \u2014 do not look for them. When your work is finished, blocked, or has failed, end your turn with a plain final summary: what you did, what you found, which files you changed, and where you left the branch. That final message is what the coordinator receives.",
@@ -2027,15 +2273,30 @@ function renderWorkerProtocolFooter(input = {}) {
2027
2273
  "Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
2028
2274
  "You have no coordinator tools (no `mesh_*`) by design: do not enqueue, dispatch, or restart anything. If you need a decision from the coordinator, finish with `report_completion` and outcome `blocked`, listing what you need in `blockers`.",
2029
2275
  "On a code-changing task, `report_completion` with outcome `completed` requires `touched_files` \u2014 send `[]` if you changed nothing, omitting the field is what gets refused. `blocked`/`failed` never need it, and a read-only task should omit it or send `[]`.",
2030
- "If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly what to fix \u2014 correct that field and call it again; a refusal records nothing."
2276
+ "If `report_completion` is refused, the response carries `validationErrors` (or a `hint`) naming exactly what to fix \u2014 correct that field and call it again; a refusal records nothing.",
2277
+ "Put substantial findings (a diagnosis, evidence, repro steps, review findings) in a workspace file and register it with `artifact_register`, then cite the returned ids in `report_completion` `artifact_ids`. The next task in this mission inherits them as input artifacts instead of re-investigating \u2014 keep each artifact self-contained and factual.",
2278
+ "`driver_invoke` results that carry an image or a large body arrive already registered: take `artifacts[].artifactId` from the result and cite it in `artifact_ids` \u2014 do not paste the body."
2031
2279
  );
2032
2280
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
2033
2281
  lines.push(
2034
2282
  `The ${input.enclosedHandoffNotes} handoff note(s) above were written by agents who touched this code before you; honour their conflict guidance and add your own in \`handoff_notes\` when you report.`
2035
2283
  );
2036
2284
  }
2285
+ if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
2037
2286
  return lines.join("\n");
2038
2287
  }
2288
+ function renderStageProtocolLines(stage) {
2289
+ if (stage.role === "review") {
2290
+ return [
2291
+ `STAGE: you are the independent reviewer (round ${stage.round} of at most ${stage.maxRevisions + 1}). Read the input artifacts first (diff, self-check log, previous verdict).` + (stage.workspace ? ` Your workspace ${stage.workspace} is pinned to the round head \u2014 you may run tests, but nothing you change lands; do not fix, record findings instead.` : " Do not modify the workspace: read it, and record findings instead of fixing."),
2292
+ "Your `report_completion` MUST carry `review`: {verdict: approve | approve_with_nits | changes_requested | reject_approach, findings[{id, severity, category, claim, evidence, suggested_fix?}], checked[], not_checked[], tests_run?[]}. `changes_requested` needs at least one blocking/major finding; `approve` allows none. From round 2 also give `prior_findings[{id, status}]` for every earlier blocking/major finding. `reject_approach` is only for a wrong approach, not for fixable defects."
2293
+ ];
2294
+ }
2295
+ return [
2296
+ `STAGE: your \`report_completion\` is a stage report (${stage.role}, round ${stage.round}). An independent reviewer reads your diff next, so commit your work and leave the workspace clean before you report. You may receive review findings as a follow-up memo in this same session.`,
2297
+ ...stage.role === "revise" ? ["For every open blocking/major finding in the memo, fill `finding_responses[{id, response: fixed | disputed, note}]` \u2014 `disputed` needs your reasoning; the reviewer judges it next round."] : []
2298
+ ];
2299
+ }
2039
2300
  function stripWorkerProtocolFooter(body) {
2040
2301
  if (typeof body !== "string") return body;
2041
2302
  const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
@@ -2065,15 +2326,30 @@ function renderCoordinatorWorkerSection() {
2065
2326
  // src/assistant-protocol.ts
2066
2327
  var ASSISTANT_TOOLS = [
2067
2328
  "projects",
2329
+ "environment",
2330
+ "assistant_action",
2331
+ "project_watch",
2068
2332
  "project_status",
2069
2333
  "project_send",
2070
2334
  "project_read",
2071
2335
  "project_add",
2336
+ "project_attach_remote",
2072
2337
  "discover_repos",
2073
2338
  "memory",
2339
+ "memory_search",
2074
2340
  "skill_view",
2075
2341
  "skill_manage",
2076
- "project_note"
2342
+ "project_note",
2343
+ "launch_defaults",
2344
+ "launch_defaults_set",
2345
+ "driver_list",
2346
+ "driver_describe",
2347
+ "artifact_list",
2348
+ "artifact_read",
2349
+ "decision_answer",
2350
+ "decision_request",
2351
+ "session_control",
2352
+ "file_transfer"
2077
2353
  ];
2078
2354
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
2079
2355
  function isAssistantTool(value) {
@@ -2081,50 +2357,170 @@ function isAssistantTool(value) {
2081
2357
  }
2082
2358
  var ASSISTANT_VERB = {
2083
2359
  // tool verbs
2360
+ driverList: "driver_list",
2361
+ driverDescribe: "driver_describe",
2084
2362
  projects: "assistant_projects",
2363
+ environment: "assistant_environment",
2364
+ action: "assistant_action",
2365
+ watch: "assistant_project_watch",
2366
+ executionState: "assistant_execution_state",
2367
+ executionSettings: "assistant_execution_settings",
2085
2368
  projectStatus: "assistant_project_status",
2086
2369
  projectSend: "assistant_project_send",
2087
2370
  projectRead: "assistant_project_read",
2088
2371
  projectAdd: "assistant_project_add",
2372
+ projectAttachRemote: "assistant_project_attach_remote",
2089
2373
  discoverRepos: "assistant_discover_repos",
2090
2374
  memory: "assistant_memory",
2375
+ /** Pull-only FTS search over the archive tier (memory design 2026-11-01 §3.4). */
2376
+ memorySearch: "assistant_memory_search",
2091
2377
  skillView: "assistant_skill_view",
2092
2378
  skillManage: "assistant_skill_manage",
2093
2379
  projectNote: "assistant_project_note",
2380
+ launchDefaults: "assistant_launch_defaults",
2381
+ launchDefaultsSet: "assistant_launch_defaults_set",
2382
+ artifactList: "assistant_artifact_list",
2383
+ artifactRead: "assistant_artifact_read",
2384
+ /** Owner-decision inbox (structured-missions design 2026-10-28 §6.3): the owner's words recorded as answers. */
2385
+ decisionAnswer: "assistant_decision_answer",
2386
+ /** Register a plain-text question a coordinator put to the owner as a decision item (§5.2). */
2387
+ decisionRequest: "assistant_decision_request",
2388
+ /** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
2389
+ sessionControl: "assistant_session_control",
2390
+ /** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
2391
+ fileTransfer: "assistant_file_transfer",
2094
2392
  // assistant-side daemon verbs without a tool of the same name
2095
2393
  launch: "launch_assistant",
2096
2394
  pendingRelays: "assistant_pending_relays",
2097
2395
  // owner verbs (dashboard only)
2098
2396
  stagedResolve: "assistant_staged_resolve",
2099
2397
  storeAdmin: "assistant_store_admin",
2100
- importSkills: "assistant_import_skills"
2398
+ importSkills: "assistant_import_skills",
2399
+ /** Owner skill list (attach/view counts, save proposals, recent skill metrics); reads move no counter. */
2400
+ skillsList: "assistant_skills_list",
2401
+ /** Owner: what the assistant remembered recently, with undo handles (memory design §3.2). */
2402
+ memoryDigest: "assistant_memory_digest",
2403
+ /** Owner: reverse one remembered write or one batch (memory design §3.2). Never an assistant tool. */
2404
+ memoryUndo: "assistant_memory_undo",
2405
+ /** Projects the assistant is following (open relay threads) — list / stop following. */
2406
+ threads: "assistant_threads",
2407
+ threadClose: "assistant_thread_close"
2101
2408
  };
2102
2409
  var ASSISTANT_TOOL_VERBS = {
2410
+ driver_list: ASSISTANT_VERB.driverList,
2411
+ driver_describe: ASSISTANT_VERB.driverDescribe,
2103
2412
  projects: ASSISTANT_VERB.projects,
2413
+ environment: ASSISTANT_VERB.environment,
2414
+ assistant_action: ASSISTANT_VERB.action,
2415
+ project_watch: ASSISTANT_VERB.watch,
2104
2416
  project_status: ASSISTANT_VERB.projectStatus,
2105
2417
  project_send: ASSISTANT_VERB.projectSend,
2106
2418
  project_read: ASSISTANT_VERB.projectRead,
2107
2419
  project_add: ASSISTANT_VERB.projectAdd,
2420
+ project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
2108
2421
  discover_repos: ASSISTANT_VERB.discoverRepos,
2109
2422
  memory: ASSISTANT_VERB.memory,
2423
+ memory_search: ASSISTANT_VERB.memorySearch,
2110
2424
  skill_view: ASSISTANT_VERB.skillView,
2111
2425
  skill_manage: ASSISTANT_VERB.skillManage,
2112
- project_note: ASSISTANT_VERB.projectNote
2426
+ project_note: ASSISTANT_VERB.projectNote,
2427
+ launch_defaults: ASSISTANT_VERB.launchDefaults,
2428
+ launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
2429
+ artifact_list: ASSISTANT_VERB.artifactList,
2430
+ artifact_read: ASSISTANT_VERB.artifactRead,
2431
+ decision_answer: ASSISTANT_VERB.decisionAnswer,
2432
+ decision_request: ASSISTANT_VERB.decisionRequest,
2433
+ session_control: ASSISTANT_VERB.sessionControl,
2434
+ file_transfer: ASSISTANT_VERB.fileTransfer
2113
2435
  };
2114
- var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
2436
+ 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", "file_transfer"];
2115
2437
  var ASSISTANT_OWNER_VERBS = [
2438
+ ASSISTANT_VERB.executionSettings,
2116
2439
  ASSISTANT_VERB.stagedResolve,
2117
2440
  ASSISTANT_VERB.storeAdmin,
2118
- ASSISTANT_VERB.importSkills
2441
+ ASSISTANT_VERB.importSkills,
2442
+ ASSISTANT_VERB.skillsList,
2443
+ ASSISTANT_VERB.memoryDigest,
2444
+ ASSISTANT_VERB.memoryUndo,
2445
+ ASSISTANT_VERB.threadClose
2119
2446
  ];
2120
2447
  var ASSISTANT_REVIEW_TURN_VERBS = [
2121
2448
  ASSISTANT_VERB.memory,
2449
+ ASSISTANT_VERB.memorySearch,
2122
2450
  ASSISTANT_VERB.skillView,
2123
2451
  ASSISTANT_VERB.skillManage,
2124
2452
  ASSISTANT_VERB.projectNote
2125
2453
  ];
2126
2454
  var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
2127
2455
  var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
2456
+ var ASSISTANT_ACCOUNT_SLOT = "personal";
2457
+ var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
2458
+ var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
2459
+ var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
2460
+ var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
2461
+ var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read", "decision_list", "decision_answer", "decision_request"];
2462
+ var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
2463
+ function isAssistantFollowerAllowedOp(value) {
2464
+ return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
2465
+ }
2466
+ var DECISION_OP_IMPLIED_BY = {
2467
+ decision_list: "status",
2468
+ decision_answer: "send",
2469
+ decision_request: "send"
2470
+ };
2471
+ function followerOpPermitted(op, allowedOps) {
2472
+ if (!isAssistantFollowerAllowedOp(op)) return false;
2473
+ if (allowedOps.includes(op)) return true;
2474
+ const implied = DECISION_OP_IMPLIED_BY[op];
2475
+ return implied !== void 0 && allowedOps.includes(implied);
2476
+ }
2477
+ function followedRemoteProjectKey(hostDaemonId, meshId) {
2478
+ const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
2479
+ return `${canonHost}::${meshId.trim()}`;
2480
+ }
2481
+ function sanitizeRemoteRepoIdentity(raw) {
2482
+ if (typeof raw !== "string") return null;
2483
+ const trimmed = raw.trim();
2484
+ if (!trimmed) return null;
2485
+ if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
2486
+ return null;
2487
+ }
2488
+ const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
2489
+ if (!withoutQuery) return null;
2490
+ let host = "";
2491
+ let repoPath = "";
2492
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
2493
+ try {
2494
+ const url = new URL(withoutQuery);
2495
+ if (url.protocol === "file:") return null;
2496
+ host = url.hostname.toLowerCase();
2497
+ repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2498
+ } catch {
2499
+ return null;
2500
+ }
2501
+ } else {
2502
+ const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
2503
+ if (scpMatch) {
2504
+ host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
2505
+ repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2506
+ } else {
2507
+ const slash = withoutQuery.indexOf("/");
2508
+ if (slash > 0) {
2509
+ const rawHost = withoutQuery.slice(0, slash);
2510
+ const atIdx = rawHost.lastIndexOf("@");
2511
+ host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
2512
+ repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2513
+ }
2514
+ }
2515
+ }
2516
+ if (!host || !repoPath) return null;
2517
+ if (!host.includes(".") && host !== "localhost") return null;
2518
+ if (/[\s@:\\]/.test(host)) return null;
2519
+ const segments = repoPath.split("/").filter(Boolean);
2520
+ if (segments.length === 0) return null;
2521
+ if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
2522
+ return `${host}/${segments.join("/")}`.slice(0, 200);
2523
+ }
2128
2524
 
2129
2525
  // src/turn-evidence.ts
2130
2526
  var MESH_TOPIC_PROTOCOL_VERSION = 2;
@@ -2160,18 +2556,29 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
2160
2556
  var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
2161
2557
  var DELIVERY_OUTCOMES = ["delivered", "queued"];
2162
2558
  var DELIVERY_VIAS = ["local", "p2p"];
2163
- var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
2559
+ var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout", "submit_unconfirmed"];
2164
2560
  function sanitizeRefusalCode(value) {
2165
2561
  if (typeof value !== "string") return void 0;
2166
2562
  const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
2167
2563
  if (!normalized) return void 0;
2168
2564
  return normalized.slice(0, 64);
2169
2565
  }
2566
+ var DISPATCH_REFUSAL_DETAIL_MAX = 200;
2567
+ function sanitizeDispatchRefusalDetail(code, message) {
2568
+ const cleanCode = sanitizeRefusalCode(code);
2569
+ let cleanMessage;
2570
+ if (typeof message === "string") {
2571
+ const line = message.replace(/(?:[A-Za-z]:)?[\\/](?:Users|home)[\\/][^\s\\/]+/g, "~").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
2572
+ if (line) cleanMessage = line.length > DISPATCH_REFUSAL_DETAIL_MAX ? `${line.slice(0, DISPATCH_REFUSAL_DETAIL_MAX - 1)}\u2026` : line;
2573
+ }
2574
+ if (!cleanCode && !cleanMessage) return void 0;
2575
+ return { ...cleanCode ? { code: cleanCode } : {}, ...cleanMessage ? { message: cleanMessage } : {} };
2576
+ }
2170
2577
  var CONSUME_PROFILES = ["default", "native_source"];
2171
2578
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2172
2579
  var SUSPENSION_MODALS = ["approval", "choice"];
2173
- var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
2174
- var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
2580
+ var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
2581
+ var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
2175
2582
  var TURN_END_STRENGTHS = ["genuine", "weak"];
2176
2583
  var TURN_END_BLOCK_REASONS = [
2177
2584
  "missing_final_assistant",
@@ -2179,9 +2586,9 @@ var TURN_END_BLOCK_REASONS = [
2179
2586
  "terminal_block_hard_cap",
2180
2587
  "decoupled_completion"
2181
2588
  ];
2182
- var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
2589
+ var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
2183
2590
  var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
2184
- var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
2591
+ var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
2185
2592
  var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
2186
2593
  var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
2187
2594
  var OPERATOR_STATUSES = ["completed", "failed"];
@@ -2208,9 +2615,10 @@ var HOLD_REASONS = [
2208
2615
  // — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
2209
2616
  // a session whose FSM never shows the idle edge again does not wait for
2210
2617
  // liveness / hard_ceiling.
2211
- "await_end"
2618
+ "await_end",
2619
+ "report_correction"
2212
2620
  ];
2213
- var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2621
+ var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
2214
2622
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
2215
2623
  var TURN_REASONS = [
2216
2624
  // commits
@@ -2219,9 +2627,15 @@ var TURN_REASONS = [
2219
2627
  "transcript_final",
2220
2628
  "worker_reported",
2221
2629
  "finalization_timeout_no_response",
2630
+ "weak_end_liveness_unconfirmed",
2631
+ "weak_end_probe_unobserved",
2632
+ "report_correction_expired",
2222
2633
  "session_error",
2223
2634
  "provider_auth_failed",
2224
2635
  "provider_billing_failed",
2636
+ "provider_usage_limit_exceeded",
2637
+ "provider_server_overloaded",
2638
+ "provider_error",
2225
2639
  "operator_cancel",
2226
2640
  "intentional_cleanup",
2227
2641
  "task_removed",
@@ -2234,6 +2648,8 @@ var TURN_REASONS = [
2234
2648
  "reclaim_budget_exhausted",
2235
2649
  "hollow_max_retries",
2236
2650
  "migration_orphan",
2651
+ // a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
2652
+ "writer_unreachable",
2237
2653
  // reclaims (generation + 1)
2238
2654
  "dispatch_refused_session_exited",
2239
2655
  "dispatch_refused_no_target",
@@ -2249,6 +2665,7 @@ var TURN_REASONS = [
2249
2665
  ];
2250
2666
  var NOTIFY_KINDS = [
2251
2667
  "completed",
2668
+ "blocked",
2252
2669
  "failed",
2253
2670
  "cancelled",
2254
2671
  "stopped",
@@ -2298,8 +2715,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2298
2715
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
2299
2716
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
2300
2717
  turn_started: { retro: bool },
2301
- suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
2302
- suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
2718
+ suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
2719
+ suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
2303
2720
  turn_end: {
2304
2721
  strength: en(TURN_END_STRENGTHS),
2305
2722
  afterFinalizationTimeout: boolOpt,
@@ -2309,6 +2726,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2309
2726
  releasedByHardCap: boolOpt,
2310
2727
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
2311
2728
  live: { t: "live", optional: true },
2729
+ nativeMarker: { t: "native_marker", optional: true },
2312
2730
  reportExpected: boolOpt,
2313
2731
  providerFailure: enOpt(PROVIDER_FAILURES)
2314
2732
  },
@@ -2322,7 +2740,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2322
2740
  },
2323
2741
  transcript_activity: { newestActivityAt: ms },
2324
2742
  no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
2325
- liveness: { result: en(LIVENESS_RESULTS) },
2743
+ liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
2326
2744
  process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
2327
2745
  session_error: { reason: en(SESSION_ERROR_REASONS) },
2328
2746
  worker_report: {
@@ -2332,6 +2750,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2332
2750
  branchState: enOpt(WORKER_BRANCH_STATES),
2333
2751
  touchedFileCount: intOpt
2334
2752
  },
2753
+ worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
2335
2754
  worker_progress: { note: { t: "summary_ref", optional: true } },
2336
2755
  git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
2337
2756
  cancel: { reason: en(CANCEL_REASONS) },
@@ -2379,7 +2798,7 @@ function isLiveTurnPending(value) {
2379
2798
  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));
2380
2799
  }
2381
2800
  function isNativeMarkerRef(value) {
2382
- return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
2801
+ 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]));
2383
2802
  }
2384
2803
  function isCoordinatorIdentity(value) {
2385
2804
  return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
@@ -2502,17 +2921,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
2502
2921
  };
2503
2922
  }
2504
2923
 
2924
+ // src/launch-defaults.ts
2925
+ var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
2926
+ var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
2927
+ var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
2928
+ function isLaunchDefaultRole(value) {
2929
+ return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
2930
+ }
2931
+ function isLaunchDefaultSource(value) {
2932
+ return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
2933
+ }
2934
+ var LAUNCH_DEFAULT_ERROR_CODES = [
2935
+ "invalid_args",
2936
+ "launch_default_required",
2937
+ "launch_default_unavailable",
2938
+ "launch_selection_invalid",
2939
+ "launch_default_invalid",
2940
+ "revision_conflict",
2941
+ "store_unavailable",
2942
+ "store_busy",
2943
+ "persistence_failed",
2944
+ "project_not_found",
2945
+ "project_ambiguous",
2946
+ "project_not_hosted",
2947
+ "project_storage_unavailable",
2948
+ "staging_unavailable",
2949
+ "staging_failed",
2950
+ "review_turn_tool_denied"
2951
+ ];
2952
+
2953
+ // src/role-launch.ts
2954
+ function record(value) {
2955
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2956
+ }
2957
+ function ref(value) {
2958
+ const r = record(value);
2959
+ 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;
2960
+ return {
2961
+ role: r.role,
2962
+ scope: r.scope,
2963
+ revision: r.revision,
2964
+ ...r.scope === "project" ? { projectId: r.projectId } : {}
2965
+ };
2966
+ }
2967
+ function axis(value) {
2968
+ const a = record(value);
2969
+ if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
2970
+ const defaultRef = ref(a.defaultRef);
2971
+ 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;
2972
+ return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
2973
+ }
2974
+ function parseRoleLaunchSelection(value) {
2975
+ const r = record(value), s = record(r?.selection), a = record(r?.applied);
2976
+ 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;
2977
+ const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
2978
+ 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;
2979
+ const defaultRef = ref(r.defaultRef);
2980
+ return {
2981
+ role: r.role,
2982
+ selection: {
2983
+ provider: s.provider,
2984
+ ...typeof s.model === "string" ? { model: s.model } : {},
2985
+ ...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
2986
+ },
2987
+ applied: { provider, model, thinkingLevel },
2988
+ ...defaultRef ? { defaultRef } : {},
2989
+ documentRevision: r.documentRevision
2990
+ };
2991
+ }
2992
+
2505
2993
  // src/session-launch.ts
2506
2994
  var MODEL_AXIS_SOURCES = [
2507
2995
  /** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
2508
2996
  "user",
2509
2997
  /** The dashboard dialog restored it from the last launch (browser-local memory). */
2510
2998
  "remembered",
2999
+ /** The authoritative daemon role default or host project override. */
3000
+ "stored_default",
3001
+ "project_default",
2511
3002
  /** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
2512
3003
  "mesh_slot",
2513
3004
  /** An explicit per-task model / thinking level on a mesh queue task. */
2514
3005
  "task_override",
2515
- /** Nothing was requested; the provider's default is known (discovery / manifest). */
3006
+ /** Nothing requested: the provider chooses; resolvedDefault records it when known. */
2516
3007
  "provider_default",
2517
3008
  /** A value was requested without saying where it came from, or nothing is known. */
2518
3009
  "unspecified"
@@ -2556,10 +3047,10 @@ function readFiniteNumber(value) {
2556
3047
  }
2557
3048
  function parseModelSelection(raw) {
2558
3049
  if (!raw || typeof raw !== "object") return void 0;
2559
- const record = raw;
3050
+ const record2 = raw;
2560
3051
  const history = [];
2561
- if (Array.isArray(record.history)) {
2562
- for (const entry of record.history) {
3052
+ if (Array.isArray(record2.history)) {
3053
+ for (const entry of record2.history) {
2563
3054
  if (!entry || typeof entry !== "object") continue;
2564
3055
  const e = entry;
2565
3056
  const value = readString(e.value);
@@ -2568,41 +3059,45 @@ function parseModelSelection(raw) {
2568
3059
  if (value && at !== void 0 && via) history.push({ at, value, via });
2569
3060
  }
2570
3061
  }
2571
- const requested = readString(record.requested);
2572
- const launchValue = readString(record.launchValue);
2573
- const resolvedDefault = readString(record.resolvedDefault);
2574
- const current = readString(record.current);
2575
- const observed = readString(record.observed);
2576
- const observedAt = readFiniteNumber(record.observedAt);
3062
+ const requested = readString(record2.requested);
3063
+ const launchValue = readString(record2.launchValue);
3064
+ const resolvedDefault = readString(record2.resolvedDefault);
3065
+ const current = readString(record2.current);
3066
+ const observed = readString(record2.observed);
3067
+ const observedAt = readFiniteNumber(record2.observedAt);
3068
+ const fallback = record2.fallback === true;
2577
3069
  return {
2578
- source: isModelAxisSource(record.source) ? record.source : "unspecified",
3070
+ source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
2579
3071
  ...requested ? { requested } : {},
2580
3072
  ...launchValue ? { launchValue } : {},
2581
3073
  ...resolvedDefault ? { resolvedDefault } : {},
2582
3074
  ...current ? { current } : {},
2583
3075
  ...observed ? { observed } : {},
2584
3076
  ...observedAt !== void 0 ? { observedAt } : {},
3077
+ ...fallback ? { fallback } : {},
2585
3078
  history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
2586
3079
  };
2587
3080
  }
2588
3081
  function parseSessionLaunchRecord(raw) {
2589
3082
  if (!raw || typeof raw !== "object") return void 0;
2590
- const record = raw;
2591
- const sessionId = readString(record.sessionId);
2592
- const providerType = readString(record.providerType);
2593
- const launchedAt = readFiniteNumber(record.launchedAt);
2594
- const model = parseModelSelection(record.model);
2595
- const thinkingLevel = parseModelSelection(record.thinkingLevel);
3083
+ const record2 = raw;
3084
+ const sessionId = readString(record2.sessionId);
3085
+ const providerType = readString(record2.providerType);
3086
+ const launchedAt = readFiniteNumber(record2.launchedAt);
3087
+ const model = parseModelSelection(record2.model);
3088
+ const thinkingLevel = parseModelSelection(record2.thinkingLevel);
2596
3089
  if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
2597
- const providerVersion = readString(record.providerVersion);
2598
- const workspace = readString(record.workspace);
2599
- const autoApproveModeId = readString(record.autoApproveModeId);
3090
+ const providerVersion = readString(record2.providerVersion);
3091
+ const workspace = readString(record2.workspace);
3092
+ const autoApproveModeId = readString(record2.autoApproveModeId);
3093
+ const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
2600
3094
  return {
3095
+ ...roleLaunch ? { roleLaunch } : {},
2601
3096
  sessionId,
2602
3097
  providerType,
2603
3098
  ...providerVersion ? { providerVersion } : {},
2604
- ...record.providerChannel === "stable" || record.providerChannel === "preview" ? { providerChannel: record.providerChannel } : {},
2605
- launchedBy: isSessionLaunchedBy(record.launchedBy) ? record.launchedBy : "api",
3099
+ ...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
3100
+ launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
2606
3101
  launchedAt,
2607
3102
  ...workspace ? { workspace } : {},
2608
3103
  model,
@@ -2666,7 +3161,7 @@ function isTurnAttemptRefValue(value) {
2666
3161
  function isTurnObserveResponse(value) {
2667
3162
  return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
2668
3163
  }
2669
- var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
3164
+ var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
2670
3165
  function isTurnOutcomeValue(value) {
2671
3166
  return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
2672
3167
  }
@@ -2892,8 +3387,23 @@ function isMissionBriefWire(value) {
2892
3387
  }
2893
3388
  return true;
2894
3389
  }
3390
+ var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
3391
+ function isOpenItemCountsWire(value) {
3392
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
3393
+ return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
3394
+ }
3395
+ function isStructuredMissionFields(value) {
3396
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3397
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3398
+ }
3399
+ if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
3400
+ if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
3401
+ if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
3402
+ return true;
3403
+ }
2895
3404
  function isMeshMissionRecordWire(value) {
2896
- if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
3405
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
3406
+ if (!isStructuredMissionFields(value)) return false;
2897
3407
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
2898
3408
  if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
2899
3409
  if (!isMeshMissionStatusValue(value.status)) return false;
@@ -2901,11 +3411,22 @@ function isMeshMissionRecordWire(value) {
2901
3411
  return true;
2902
3412
  }
2903
3413
  function isMissionUpsertRequest(value) {
2904
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
3414
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
2905
3415
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2906
3416
  if (!isEvidenceIdentifier(value.meshId)) return false;
2907
3417
  if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
2908
- if (typeof value.title !== "string" || value.title.trim().length === 0) return false;
3418
+ if (typeof value.title !== "string") return false;
3419
+ if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
3420
+ if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
3421
+ if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
3422
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3423
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3424
+ }
3425
+ if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
3426
+ for (const k of ["itemsAdd", "itemsUpdate"]) {
3427
+ const list = value[k];
3428
+ if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
3429
+ }
2909
3430
  if (value.goal !== void 0 && typeof value.goal !== "string") return false;
2910
3431
  if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
2911
3432
  if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
@@ -2915,7 +3436,7 @@ function decodeMissionUpsertRequest(value) {
2915
3436
  return isMissionUpsertRequest(value) ? value : null;
2916
3437
  }
2917
3438
  function isMissionUpsertResponse(value) {
2918
- return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
3439
+ return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
2919
3440
  }
2920
3441
  function decodeMissionUpsertResponse(value) {
2921
3442
  return isMissionUpsertResponse(value) ? value : null;
@@ -2941,7 +3462,10 @@ function decodeMissionQueryResponse(value) {
2941
3462
  return isMissionQueryResponse(value) ? value : null;
2942
3463
  }
2943
3464
  function isMissionListQueryRequest(value) {
2944
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
3465
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
3466
+ for (const k of ["structured", "items", "history"]) {
3467
+ if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
3468
+ }
2945
3469
  if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
2946
3470
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2947
3471
  if (!isEvidenceIdentifier(value.meshId)) return false;
@@ -2967,12 +3491,13 @@ function isMeshMissionTaskAggregateWire(value) {
2967
3491
  return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
2968
3492
  }
2969
3493
  function isMeshMissionStatsWire(value) {
2970
- const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
3494
+ const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
2971
3495
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
2972
3496
  if (!isEvidenceIdentifier(value.missionId)) return false;
2973
3497
  for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
2974
3498
  if (!isNonNegativeInt(value[k])) return false;
2975
3499
  }
3500
+ if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
2976
3501
  if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
2977
3502
  if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
2978
3503
  return true;
@@ -2982,7 +3507,7 @@ function isMissionListSummaryWire(value) {
2982
3507
  const hasGoal = "goal" in value;
2983
3508
  const hasPreview = "goalPreview" in value && "goalTruncated" in value;
2984
3509
  if (hasGoal === hasPreview) return false;
2985
- const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
3510
+ const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
2986
3511
  const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
2987
3512
  if (!hasOnlyKeys2(value, allowed)) return false;
2988
3513
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
@@ -2996,6 +3521,10 @@ function isMissionListSummaryWire(value) {
2996
3521
  if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
2997
3522
  if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
2998
3523
  if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
3524
+ if (!isStructuredMissionFields(value)) return false;
3525
+ for (const k of ["items", "history"]) {
3526
+ if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
3527
+ }
2999
3528
  return true;
3000
3529
  }
3001
3530
  function isMeshMissionHistoryFoldWire(value) {
@@ -3094,12 +3623,15 @@ function isLedgerQueryEntryWire(value) {
3094
3623
  return true;
3095
3624
  }
3096
3625
  function isLedgerQuerySummaryWire(value) {
3097
- const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
3626
+ const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed", "recentRefineFailures"];
3098
3627
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
3099
3628
  if (!isEvidenceIdentifier(value.meshId)) return false;
3100
3629
  for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
3101
3630
  if (!isNonNegativeInt(value[k])) return false;
3102
3631
  }
3632
+ if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
3633
+ if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
3634
+ if (value.recentRefineFailures !== void 0 && !isNonNegativeInt(value.recentRefineFailures)) return false;
3103
3635
  if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
3104
3636
  return true;
3105
3637
  }
@@ -3143,9 +3675,10 @@ function isQueueDependencyHeadWire(value) {
3143
3675
  return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
3144
3676
  }
3145
3677
  function isQueueQueryResponse(value) {
3146
- if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
3678
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
3147
3679
  if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
3148
3680
  if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
3681
+ if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
3149
3682
  if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
3150
3683
  if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
3151
3684
  return true;
@@ -3203,7 +3736,7 @@ function decodeQueueRequeueRequest(value) {
3203
3736
  return isQueueRequeueRequest(value) ? value : null;
3204
3737
  }
3205
3738
  function isQueueRequeueResponse(value) {
3206
- return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
3739
+ return isRecord(value) && hasOnlyKeys2(value, ["task", "quotaOverrideRequested"]) && (value.task === null || isQueueEntryWire(value.task)) && (value.quotaOverrideRequested === void 0 || isRecord(value.quotaOverrideRequested) && typeof value.quotaOverrideRequested.decisionId === "string");
3207
3740
  }
3208
3741
  function decodeQueueRequeueResponse(value) {
3209
3742
  return isQueueRequeueResponse(value) ? value : null;
@@ -3267,6 +3800,24 @@ function isRecoveryContextQueryResponse(value) {
3267
3800
  function decodeRecoveryContextQueryResponse(value) {
3268
3801
  return isRecoveryContextQueryResponse(value) ? value : null;
3269
3802
  }
3803
+ function decodeQueueReviseRequest(value) {
3804
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "taskId", "expectedRevision", "patch", "dryRun", "deferScheduling"]) || 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", "difficulty", "requestQuotaOverride", "attestActiveOwnership"])) return null;
3805
+ if (value.dryRun !== void 0 && typeof value.dryRun !== "boolean") return null;
3806
+ if (value.deferScheduling !== void 0 && typeof value.deferScheduling !== "boolean") return null;
3807
+ const p = value.patch;
3808
+ if (p.requestQuotaOverride && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
3809
+ if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
3810
+ if (p.attestActiveOwnership && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
3811
+ if (p.attestActiveOwnership !== void 0 && (p.attestActiveOwnership !== true || Object.keys(p).length !== 1)) return null;
3812
+ if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
3813
+ if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
3814
+ if (p.difficulty !== void 0 && p.difficulty !== "easy" && p.difficulty !== "medium" && p.difficulty !== "difficult" && p.difficulty !== "freeform") return null;
3815
+ for (const key of ["ownedPaths", "dependsOn"]) {
3816
+ if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
3817
+ }
3818
+ return value;
3819
+ }
3820
+ var decodeQueueReviseResponse = decodeQueueRequeueResponse;
3270
3821
 
3271
3822
  // src/turn-ipc-stats.ts
3272
3823
  function isTaskStatsQueryRequest(value) {
@@ -3365,6 +3916,7 @@ var TURN_IPC_COMMANDS = [
3365
3916
  "queue_enqueue_batch",
3366
3917
  "queue_cancel",
3367
3918
  "queue_requeue",
3919
+ "queue_revise",
3368
3920
  "direct_dispatch_record",
3369
3921
  "active_work_query",
3370
3922
  "recovery_context_query",
@@ -3448,14 +4000,11 @@ function normalizeOwnedPaths(input) {
3448
4000
  }
3449
4001
  function entryContains(base, path) {
3450
4002
  if (path === base.path) return true;
3451
- if (base.subtree && (path === base.path || path.startsWith(`${base.path}/`))) return true;
4003
+ if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
3452
4004
  return false;
3453
4005
  }
3454
4006
  function entriesOverlap(a, b) {
3455
- if (a.path === b.path) return true;
3456
- if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
3457
- if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
3458
- return false;
4007
+ return entryContains(a, b.path) || entryContains(b, a.path);
3459
4008
  }
3460
4009
  function pathsOverlap(a, b) {
3461
4010
  if (a.paths.length === 0 || b.paths.length === 0) return false;
@@ -3507,6 +4056,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
3507
4056
  return { undeclaredTouched, unusedDeclarations };
3508
4057
  }
3509
4058
 
4059
+ // src/mission-items.ts
4060
+ var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
4061
+ var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
4062
+ var COORDINATOR_SETTABLE_ITEM_STATES = {
4063
+ remaining: ["open", "done", "dropped"],
4064
+ live_check: ["open", "done", "dropped"],
4065
+ evidence: ["open", "done", "dropped"],
4066
+ decision: ["open", "withdrawn", "superseded"]
4067
+ };
4068
+ var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
4069
+ function isMissionOutcome(value) {
4070
+ return typeof value === "string" && MISSION_OUTCOMES.includes(value);
4071
+ }
4072
+ var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
4073
+ var MISSION_LIMITS = {
4074
+ summary: 300,
4075
+ outcomeReason: 500,
4076
+ itemText: 300,
4077
+ machine: 80,
4078
+ refs: 8,
4079
+ refValue: 300,
4080
+ refRepo: 120,
4081
+ refNote: 200,
4082
+ dedupeKey: 400,
4083
+ question: 300,
4084
+ context: 600,
4085
+ options: 5,
4086
+ optionLabel: 60,
4087
+ optionDetail: 200,
4088
+ /** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
4089
+ openItemsPerMission: 200,
4090
+ /** One event payload (serialized). */
4091
+ eventPayloadBytes: 16 * 1024,
4092
+ /** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
4093
+ itemsPerCall: 50
4094
+ };
4095
+ var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
4096
+ var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
4097
+ var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
4098
+ function truncateMissionText(value, max) {
4099
+ if (value.length <= max) return value;
4100
+ return `${value.slice(0, max - 1).trimEnd()}\u2026`;
4101
+ }
4102
+ function str(value) {
4103
+ return typeof value === "string" ? value.trim() : "";
4104
+ }
4105
+ function collapse(value) {
4106
+ return value.replace(/\s+/g, " ").trim();
4107
+ }
4108
+ function normalizeMissionSummary(value) {
4109
+ if (typeof value !== "string") return null;
4110
+ const text = collapse(value);
4111
+ return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
4112
+ }
4113
+ function normalizeOutcomeReason(value) {
4114
+ if (typeof value !== "string") return null;
4115
+ const text = value.trim();
4116
+ return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
4117
+ }
4118
+ function normalizeMissionRefs(value) {
4119
+ if (!Array.isArray(value)) return { refs: [], truncated: false };
4120
+ const refs = [];
4121
+ let truncated = false;
4122
+ for (const raw of value) {
4123
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4124
+ const r = raw;
4125
+ const kind = str(r.kind);
4126
+ const refValue = str(r.value);
4127
+ if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
4128
+ if (refs.length >= MISSION_LIMITS.refs) {
4129
+ truncated = true;
4130
+ break;
4131
+ }
4132
+ const repo = str(r.repo);
4133
+ const note = str(r.note);
4134
+ refs.push({
4135
+ kind,
4136
+ ...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
4137
+ value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
4138
+ ...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
4139
+ });
4140
+ }
4141
+ return { refs, truncated };
4142
+ }
4143
+ function normalizeOptions(value, truncated) {
4144
+ if (!Array.isArray(value)) return [];
4145
+ const out = [];
4146
+ for (const raw of value) {
4147
+ if (typeof raw === "string" && raw.trim()) {
4148
+ if (out.length >= MISSION_LIMITS.options) {
4149
+ truncated.push("options");
4150
+ break;
4151
+ }
4152
+ out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
4153
+ continue;
4154
+ }
4155
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4156
+ const o = raw;
4157
+ const label = collapse(str(o.label));
4158
+ if (!label) continue;
4159
+ if (out.length >= MISSION_LIMITS.options) {
4160
+ truncated.push("options");
4161
+ break;
4162
+ }
4163
+ const detail = str(o.detail);
4164
+ out.push({
4165
+ id: MISSION_DECISION_OPTION_IDS[out.length],
4166
+ label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
4167
+ ...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
4168
+ });
4169
+ }
4170
+ return out;
4171
+ }
4172
+ function normalizeDueAt(value) {
4173
+ if (typeof value !== "string" || !value.trim()) return void 0;
4174
+ const ms2 = Date.parse(value);
4175
+ return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
4176
+ }
4177
+ function normalizeDecisionInput(raw, truncated) {
4178
+ const questionSource = collapse(str(raw.question) || str(raw.text));
4179
+ if (!questionSource) return null;
4180
+ if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
4181
+ const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
4182
+ const contextSource = str(raw.context);
4183
+ if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
4184
+ const options = normalizeOptions(raw.options, truncated);
4185
+ const recommendedRaw = str(raw.recommended);
4186
+ const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
4187
+ const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
4188
+ const onDueRaw = str(raw.onDue ?? raw.on_due);
4189
+ const urgencyRaw = str(raw.urgency);
4190
+ const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
4191
+ return {
4192
+ question,
4193
+ ...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
4194
+ options,
4195
+ ...recommended ? { recommended } : {},
4196
+ allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
4197
+ ...dueAt ? { dueAt } : {},
4198
+ // apply_recommended without a recommended option has nothing to apply — fall back to remind.
4199
+ onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
4200
+ urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
4201
+ };
4202
+ }
4203
+ function normalizeForDedupe(text) {
4204
+ return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
4205
+ }
4206
+ function deriveItemDedupeKey(kind, parts) {
4207
+ const explicit = str(parts.explicit);
4208
+ if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
4209
+ if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4210
+ if (kind === "evidence") {
4211
+ const ref2 = parts.refs?.[0];
4212
+ if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
4213
+ }
4214
+ const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
4215
+ return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4216
+ }
4217
+ function normalizeMissionItemInput(raw) {
4218
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
4219
+ const r = raw;
4220
+ const kind = str(r.kind) || "remaining";
4221
+ if (!MISSION_ITEM_KINDS.includes(kind)) {
4222
+ return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
4223
+ }
4224
+ const truncated = [];
4225
+ const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
4226
+ if (refsTruncated) truncated.push("refs");
4227
+ const machineRaw = collapse(str(r.machine));
4228
+ const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
4229
+ const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
4230
+ if (kind === "decision") {
4231
+ const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
4232
+ const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
4233
+ if (!decision) return { error: "decision item needs a question" };
4234
+ return {
4235
+ item: {
4236
+ kind,
4237
+ text: decision.question,
4238
+ ...machine ? { machine } : {},
4239
+ refs,
4240
+ decision,
4241
+ dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
4242
+ truncated
4243
+ }
4244
+ };
4245
+ }
4246
+ const textSource = collapse(str(r.text));
4247
+ if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
4248
+ if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
4249
+ const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
4250
+ return {
4251
+ item: {
4252
+ kind,
4253
+ text,
4254
+ ...machine ? { machine } : {},
4255
+ refs,
4256
+ dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
4257
+ truncated
4258
+ }
4259
+ };
4260
+ }
4261
+ function normalizeMissionItemUpdate(raw) {
4262
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
4263
+ const r = raw;
4264
+ const id2 = str(r.id ?? r.item_id ?? r.itemId);
4265
+ if (!id2) return { error: "update needs an item id" };
4266
+ const truncated = [];
4267
+ const update = { id: id2 };
4268
+ if (r.state !== void 0) {
4269
+ const state = str(r.state);
4270
+ if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
4271
+ update.state = state;
4272
+ }
4273
+ if (typeof r.text === "string") {
4274
+ const text = collapse(r.text);
4275
+ if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
4276
+ if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
4277
+ }
4278
+ if (r.machine === null) update.machine = null;
4279
+ else if (typeof r.machine === "string") {
4280
+ const machine = collapse(r.machine);
4281
+ update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
4282
+ }
4283
+ if (r.refs !== void 0) {
4284
+ const { refs, truncated: t } = normalizeMissionRefs(r.refs);
4285
+ if (t) truncated.push("refs");
4286
+ update.refs = refs;
4287
+ }
4288
+ return { update, truncated };
4289
+ }
4290
+ function boundEventPayload(payload) {
4291
+ let json = JSON.stringify(payload);
4292
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4293
+ const shrunk = {};
4294
+ for (const [k, v] of Object.entries(payload)) {
4295
+ shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
4296
+ }
4297
+ shrunk.payloadTruncated = true;
4298
+ json = JSON.stringify(shrunk);
4299
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4300
+ return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
4301
+ }
4302
+ var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
4303
+ var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
4304
+ var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
4305
+ function isCarryOverMissionRecord(m) {
4306
+ return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
4307
+ }
4308
+ function isCarryOverMissionTitle(title) {
4309
+ if (typeof title !== "string") return false;
4310
+ const t = title.trim();
4311
+ return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
4312
+ }
4313
+ var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
4314
+ var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
4315
+ var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
4316
+ var WORKER_DECISIONS_NEEDED_MAX = 3;
4317
+ var WORKER_COMMITS_MAX = 20;
4318
+ var SHA_RE = /^[0-9a-f]{7,64}$/i;
4319
+ function normalizeReportCommits(value) {
4320
+ if (!Array.isArray(value)) return null;
4321
+ const out = [];
4322
+ for (const v of value) {
4323
+ if (typeof v !== "string") return null;
4324
+ const sha = v.trim();
4325
+ if (!SHA_RE.test(sha)) return null;
4326
+ if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
4327
+ }
4328
+ return out;
4329
+ }
4330
+
4331
+ // src/mission-git-state.ts
4332
+ var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
4333
+ var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
4334
+ var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
4335
+ function isMissionRefContained(status) {
4336
+ return status === "contained_ancestor" || status === "contained_patch_equivalent";
4337
+ }
4338
+ function aggregateMissionGitState(statuses) {
4339
+ const total = statuses.length;
4340
+ const contained = statuses.filter(isMissionRefContained).length;
4341
+ const notContained = statuses.filter((s) => s === "not_contained").length;
4342
+ const unknown = statuses.filter((s) => s === "unknown").length;
4343
+ const counts = { total, contained, notContained, unknown };
4344
+ if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
4345
+ if (contained === total) return { state: "landed", partialUnknown: false, counts };
4346
+ if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
4347
+ if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
4348
+ return { state: "unknown", partialUnknown: false, counts };
4349
+ }
4350
+
4351
+ // src/release.ts
4352
+ var MESH_RELEASE_CHANNELS = ["preview", "stable"];
4353
+ function isMeshReleaseChannel(value) {
4354
+ return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
4355
+ }
4356
+ var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
4357
+ function isReleaseStatus(value) {
4358
+ return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
4359
+ }
4360
+ var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
4361
+ var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
4362
+ var RELEASE_EVENT_TYPES = [
4363
+ "created",
4364
+ "status_changed",
4365
+ "scope_added",
4366
+ "scope_moved",
4367
+ "scope_removed",
4368
+ "deploy_recorded",
4369
+ "changelog_drafted",
4370
+ "changelog_applied"
4371
+ ];
4372
+ var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
4373
+ var RELEASE_LIMITS = {
4374
+ name: 80,
4375
+ note: 500,
4376
+ /** `mesh_missions.release_note`: one user/operator-visible sentence. */
4377
+ releaseNote: 400,
4378
+ missionsPerCall: 100,
4379
+ changelogEntries: 300
4380
+ };
4381
+ var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
4382
+ var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
4383
+ function changelogMissionMarker(missionId) {
4384
+ return `<!-- m:${missionId.slice(0, 8)} -->`;
4385
+ }
4386
+ function classifyChangelogSection(text, hint) {
4387
+ const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
4388
+ if (m) {
4389
+ const key = m[1].toLowerCase();
4390
+ return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
4391
+ }
4392
+ const probe = `${hint ?? ""} ${text}`.toLowerCase();
4393
+ if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
4394
+ if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
4395
+ return { section: "Changed", text };
4396
+ }
4397
+ function lintChangelogText(text) {
4398
+ const out = [];
4399
+ if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
4400
+ if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
4401
+ 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");
4402
+ if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
4403
+ return out;
4404
+ }
4405
+
4406
+ // src/decision-push-relay.ts
4407
+ var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
4408
+ var DECISION_PUSH_RELAY_SOURCE = "push_relay";
4409
+
3510
4410
  // src/keyed-doc-delta.ts
3511
4411
  function sig(value) {
3512
4412
  if (value === void 0) return void 0;
@@ -3727,7 +4627,15 @@ function foldKeyedDoc(held, delta, spec) {
3727
4627
  const heldList = heldCollections.get(path);
3728
4628
  if (change?.absent) {
3729
4629
  const [head2, tail2] = splitPath(path);
3730
- if (!tail2) delete next[head2];
4630
+ if (!tail2) {
4631
+ delete next[head2];
4632
+ continue;
4633
+ }
4634
+ const parent2 = next[head2];
4635
+ if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
4636
+ const copy = { ...parent2 };
4637
+ delete copy[tail2];
4638
+ next[head2] = copy;
3731
4639
  continue;
3732
4640
  }
3733
4641
  if (!change && heldList === void 0) continue;
@@ -3791,9 +4699,482 @@ function stableMeshNodeRow(row) {
3791
4699
  }
3792
4700
  return out;
3793
4701
  }
4702
+
4703
+ // src/provider-approval.ts
4704
+ function isActionableProviderApproval(approval) {
4705
+ 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());
4706
+ }
4707
+ function readProviderDecision(approval, waiting, hasModal = false) {
4708
+ if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
4709
+ if (!waiting) return null;
4710
+ return {
4711
+ source: hasModal ? "legacy_provider" : "status_only",
4712
+ type: "unknown",
4713
+ compatibility: hasModal ? "session_only" : "unknown",
4714
+ evidence: "unavailable",
4715
+ lifecycle: "pending",
4716
+ modalKey: null,
4717
+ createdAt: null,
4718
+ resolvedAt: null,
4719
+ description: "",
4720
+ buttons: [],
4721
+ actionable: false
4722
+ };
4723
+ }
4724
+ function providerApprovalSnapshot(approval) {
4725
+ if (!approval) return null;
4726
+ const {
4727
+ source,
4728
+ type,
4729
+ lifecycle,
4730
+ modalKey,
4731
+ createdAt,
4732
+ resolvedAt,
4733
+ providerType,
4734
+ sessionId,
4735
+ nodeId,
4736
+ meshId,
4737
+ taskId,
4738
+ attemptId,
4739
+ generation
4740
+ } = approval;
4741
+ return {
4742
+ source,
4743
+ type,
4744
+ lifecycle,
4745
+ modalKey,
4746
+ createdAt,
4747
+ resolvedAt,
4748
+ providerType,
4749
+ sessionId,
4750
+ nodeId,
4751
+ meshId,
4752
+ taskId,
4753
+ attemptId,
4754
+ generation,
4755
+ evidence: "cached",
4756
+ actionable: false,
4757
+ description: "",
4758
+ buttons: []
4759
+ };
4760
+ }
4761
+
4762
+ // src/provider-question.ts
4763
+ function isProviderQuestionBinding(value) {
4764
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
4765
+ const b = value;
4766
+ if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
4767
+ const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
4768
+ if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
4769
+ if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
4770
+ return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
4771
+ }
4772
+
4773
+ // src/task-source-phase.ts
4774
+ function reviewIndependenceOf(review) {
4775
+ return review.independence ?? "different_provider";
4776
+ }
4777
+
4778
+ // src/light-task.ts
4779
+ var LIGHT_REJECT = {
4780
+ REQUIRES_LOCAL_BASE: "light_requires_local_base",
4781
+ NOT_CONFIGURED: "light_workspace_not_configured",
4782
+ REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
4783
+ MODE_CONFLICT: "light_mode_conflict"
4784
+ };
4785
+ var LIGHT_HOLD = {
4786
+ PREPARE_FAILED: "light_workspace_prepare_failed",
4787
+ LIMIT: "light_workspace_limit",
4788
+ DISK_LOW: "light_workspace_disk_low",
4789
+ CAP: "max_light_parallel_tasks_reached"
4790
+ };
4791
+ var LIGHT_BLOCK_REASONS = [
4792
+ "light_uncommitted_changes",
4793
+ "light_dependency_change",
4794
+ "light_lineage_unproven",
4795
+ "shared_checkout_mutated"
4796
+ ];
4797
+ var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
4798
+ var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
4799
+ var LIGHT_TESTS_RUN_MAX = 20;
4800
+ function isLightWorkerSession(session) {
4801
+ const s = session;
4802
+ if (!s || typeof s !== "object") return false;
4803
+ const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
4804
+ return has(s.settings) || has(s.launchRecord?.settings) || has(s);
4805
+ }
4806
+
4807
+ // src/relay-reprobe.ts
4808
+ var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
4809
+ var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
4810
+ var RELAY_REPROBE_JITTER_RATIO = 0.2;
4811
+ function computeRelayReprobeDelay(failures, random, timing = {}) {
4812
+ const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
4813
+ const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
4814
+ const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
4815
+ const grown = Math.min(max, base * 2 ** Math.max(0, failures));
4816
+ const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
4817
+ return Math.round(grown * factor);
4818
+ }
4819
+ var RelayReprobeScheduler = class {
4820
+ constructor(options) {
4821
+ this.options = options;
4822
+ }
4823
+ handle = null;
4824
+ running = false;
4825
+ inFlight = false;
4826
+ failureCount = 0;
4827
+ generation = 0;
4828
+ get isRunning() {
4829
+ return this.running;
4830
+ }
4831
+ get failures() {
4832
+ return this.failureCount;
4833
+ }
4834
+ get probing() {
4835
+ return this.inFlight;
4836
+ }
4837
+ /** Begin probing (idempotent). Call when a connection is selected as relay. */
4838
+ start() {
4839
+ if (this.running) return;
4840
+ this.running = true;
4841
+ this.failureCount = 0;
4842
+ this.generation++;
4843
+ this.schedule();
4844
+ }
4845
+ /** Stop for good (direct path found, connection closed, auth epoch changed). */
4846
+ stop() {
4847
+ this.running = false;
4848
+ this.generation++;
4849
+ if (this.handle !== null) {
4850
+ this.options.clearTimer(this.handle);
4851
+ this.handle = null;
4852
+ }
4853
+ }
4854
+ schedule() {
4855
+ if (!this.running) return;
4856
+ const generation = this.generation;
4857
+ const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
4858
+ this.handle = this.options.setTimer(() => {
4859
+ this.handle = null;
4860
+ void this.tick(generation);
4861
+ }, delay);
4862
+ }
4863
+ async tick(generation) {
4864
+ if (!this.running || generation !== this.generation) return;
4865
+ if (this.inFlight || !this.options.shouldProbe()) {
4866
+ this.schedule();
4867
+ return;
4868
+ }
4869
+ this.inFlight = true;
4870
+ let outcome;
4871
+ try {
4872
+ outcome = await this.options.probe();
4873
+ } catch {
4874
+ outcome = "failed";
4875
+ }
4876
+ this.inFlight = false;
4877
+ if (!this.running || generation !== this.generation) return;
4878
+ if (outcome === "direct") {
4879
+ this.stop();
4880
+ return;
4881
+ }
4882
+ if (outcome !== "skipped") this.failureCount++;
4883
+ this.schedule();
4884
+ }
4885
+ };
4886
+
4887
+ // src/task-stages.ts
4888
+ var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
4889
+ var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
4890
+ var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
4891
+ var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
4892
+ var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
4893
+ var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
4894
+ var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
4895
+ var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
4896
+ var STAGE_ROLES = ["implement", "revise", "review"];
4897
+ var STAGE_BLOCKED_REASONS = [
4898
+ "review_unresolved",
4899
+ "review_rejected_approach",
4900
+ "review_unavailable",
4901
+ "self_check_failed",
4902
+ "stage_pipeline_ceiling",
4903
+ "reviewer_mutated_source",
4904
+ // The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
4905
+ "reviewer_integrity_unverifiable"
4906
+ ];
4907
+ var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
4908
+ var STAGE_MAX_REVISIONS_LIMIT = 3;
4909
+ var STAGE_DEFAULT_MAX_REVISIONS = 2;
4910
+ var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
4911
+ var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
4912
+ var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
4913
+ var REVIEW_FINDINGS_MAX = 30;
4914
+ var REVIEW_CLAIM_MAX_CHARS = 500;
4915
+ var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
4916
+ var REVIEW_FIX_MAX_CHARS = 500;
4917
+ var REVIEW_FINDING_ID_MAX_CHARS = 40;
4918
+ var REVIEW_CHECKED_MAX = 20;
4919
+ var REVIEW_NOTE_MAX_CHARS = 500;
4920
+ var REVIEW_TESTS_RUN_MAX = 20;
4921
+ var FINDING_RESPONSES_MAX = 30;
4922
+ function makeGuard4(values) {
4923
+ const set = new Set(values);
4924
+ return (value) => typeof value === "string" && set.has(value);
4925
+ }
4926
+ var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
4927
+ var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
4928
+ var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
4929
+ var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
4930
+ var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
4931
+ var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
4932
+ var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
4933
+ function isBlockingSeverity(severity) {
4934
+ return severity === "blocking" || severity === "major";
4935
+ }
4936
+ function resolveStagePlan(raw, task, opts = {}) {
4937
+ const eligible = isStageEligibleTask(task);
4938
+ if (raw === void 0 || raw === null) return (opts.defaultOn ?? true) && defaultsOnFor(task) ? defaultStagePlan() : null;
4939
+ if (raw === false) return null;
4940
+ if (raw === true) {
4941
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4942
+ return defaultStagePlan();
4943
+ }
4944
+ if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
4945
+ const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
4946
+ for (const key of Object.keys(raw)) {
4947
+ if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
4948
+ }
4949
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4950
+ const rawMax = raw.max_revisions ?? raw.maxRevisions;
4951
+ let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
4952
+ if (rawMax !== void 0) {
4953
+ if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
4954
+ throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
4955
+ }
4956
+ maxRevisions = rawMax;
4957
+ }
4958
+ let independence = "fresh_session_ok";
4959
+ if (raw.independence !== void 0) {
4960
+ if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
4961
+ throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
4962
+ }
4963
+ independence = raw.independence;
4964
+ }
4965
+ return { review: true, maxRevisions, independence };
4966
+ }
4967
+ function defaultStagePlan() {
4968
+ return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
4969
+ }
4970
+ function isStageEligibleTask(task) {
4971
+ if (task.readonly) return false;
4972
+ return (task.taskMode ?? "code_change") === "code_change";
4973
+ }
4974
+ function defaultsOnFor(task) {
4975
+ return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
4976
+ }
4977
+ function str2(value) {
4978
+ return typeof value === "string" ? value.trim() : "";
4979
+ }
4980
+ function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
4981
+ if (!Array.isArray(value)) {
4982
+ errors.push({ field, message: `${field} must be an array of strings` });
4983
+ return [];
4984
+ }
4985
+ if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
4986
+ const out = [];
4987
+ for (const item of value) {
4988
+ const text = str2(item);
4989
+ if (!text) continue;
4990
+ if (text.length > maxChars) {
4991
+ errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
4992
+ continue;
4993
+ }
4994
+ out.push(text);
4995
+ }
4996
+ if (out.length < minItems) errors.push({ field, message: `${field} needs at least ${minItems} entry \u2014 an empty ${field} list is a review with no recorded scope` });
4997
+ return out;
4998
+ }
4999
+ function validateReviewReport(raw, ctx) {
5000
+ const errors = [];
5001
+ if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
5002
+ const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
5003
+ for (const key of Object.keys(raw)) if (!KNOWN.has(key)) errors.push({ field: `review.${key}`, message: `unknown field '${key}' (expected one of: ${[...KNOWN].join(", ")})` });
5004
+ const verdict = raw.verdict;
5005
+ if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
5006
+ const findings = [];
5007
+ if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
5008
+ else {
5009
+ if (raw.findings.length > REVIEW_FINDINGS_MAX) errors.push({ field: "review.findings", message: `findings has ${raw.findings.length} entries, over the ${REVIEW_FINDINGS_MAX} limit \u2014 keep the most important` });
5010
+ const seen = /* @__PURE__ */ new Set();
5011
+ raw.findings.forEach((f, i) => {
5012
+ const at = `review.findings[${i}]`;
5013
+ if (!isRecord4(f)) {
5014
+ errors.push({ field: at, message: "each finding must be an object" });
5015
+ return;
5016
+ }
5017
+ const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
5018
+ for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5019
+ const id2 = str2(f.id);
5020
+ if (!id2 || id2.length > REVIEW_FINDING_ID_MAX_CHARS) errors.push({ field: `${at}.id`, message: `id is required (\u2264 ${REVIEW_FINDING_ID_MAX_CHARS} chars)` });
5021
+ else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
5022
+ else seen.add(id2);
5023
+ if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
5024
+ if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
5025
+ const claim = str2(f.claim);
5026
+ if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
5027
+ else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
5028
+ const evidence = str2(f.evidence);
5029
+ if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
5030
+ else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
5031
+ const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
5032
+ if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
5033
+ if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
5034
+ if (f.line !== void 0 && (typeof f.line !== "number" || !Number.isInteger(f.line) || f.line < 1)) errors.push({ field: `${at}.line`, message: "line must be a positive integer" });
5035
+ if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
5036
+ findings.push({
5037
+ id: id2,
5038
+ severity: f.severity,
5039
+ category: f.category,
5040
+ ...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
5041
+ ...typeof f.line === "number" ? { line: f.line } : {},
5042
+ claim,
5043
+ evidence,
5044
+ ...fix ? { suggestedFix: fix } : {}
5045
+ });
5046
+ }
5047
+ });
5048
+ }
5049
+ const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5050
+ const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5051
+ let priorFindings;
5052
+ if (raw.priorFindings !== void 0) {
5053
+ if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
5054
+ else {
5055
+ priorFindings = [];
5056
+ raw.priorFindings.forEach((p, i) => {
5057
+ const at = `review.priorFindings[${i}]`;
5058
+ if (!isRecord4(p)) {
5059
+ errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
5060
+ return;
5061
+ }
5062
+ for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5063
+ const id2 = str2(p.id);
5064
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5065
+ if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
5066
+ const note = p.note === void 0 ? void 0 : str2(p.note);
5067
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5068
+ if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
5069
+ });
5070
+ }
5071
+ }
5072
+ const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
5073
+ if (isReviewVerdict(verdict)) {
5074
+ const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
5075
+ if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
5076
+ errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
5077
+ }
5078
+ if (verdict === "approve" && blocking.length > 0) {
5079
+ errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
5080
+ }
5081
+ if (verdict === "approve_with_nits" && blocking.length > 0) {
5082
+ errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
5083
+ }
5084
+ }
5085
+ if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
5086
+ const answered = new Set((priorFindings ?? []).map((p) => p.id));
5087
+ const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
5088
+ if (missing.length) errors.push({ field: "review.priorFindings", message: `round ${ctx.round} must give a status for every prior blocking/major finding; missing: ${missing.join(", ")}` });
5089
+ }
5090
+ if (errors.length) return { errors };
5091
+ return {
5092
+ report: {
5093
+ verdict,
5094
+ findings,
5095
+ ...priorFindings?.length ? { priorFindings } : {},
5096
+ checked,
5097
+ notChecked,
5098
+ ...testsRun?.length ? { testsRun } : {}
5099
+ },
5100
+ errors: []
5101
+ };
5102
+ }
5103
+ function validateTestsRun(raw, field, errors) {
5104
+ if (!Array.isArray(raw)) {
5105
+ errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
5106
+ return [];
5107
+ }
5108
+ if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
5109
+ const out = [];
5110
+ raw.forEach((t, i) => {
5111
+ const at = `${field}[${i}]`;
5112
+ if (!isRecord4(t)) {
5113
+ errors.push({ field: at, message: "each entry must be an object" });
5114
+ return;
5115
+ }
5116
+ for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5117
+ const command = str2(t.command);
5118
+ if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
5119
+ if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
5120
+ for (const k of ["passed", "failed"]) {
5121
+ if (t[k] !== void 0 && (typeof t[k] !== "number" || !Number.isInteger(t[k]) || t[k] < 0)) errors.push({ field: `${at}.${k}`, message: `${k} must be a non-negative integer` });
5122
+ }
5123
+ const note = t.note === void 0 ? void 0 : str2(t.note);
5124
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5125
+ if (command && typeof t.exit === "number") {
5126
+ out.push({
5127
+ command,
5128
+ exit: t.exit,
5129
+ ...typeof t.passed === "number" ? { passed: t.passed } : {},
5130
+ ...typeof t.failed === "number" ? { failed: t.failed } : {},
5131
+ ...note ? { note } : {}
5132
+ });
5133
+ }
5134
+ });
5135
+ return out;
5136
+ }
5137
+ function validateFindingResponses(raw, field = "findingResponses") {
5138
+ const errors = [];
5139
+ if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
5140
+ if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
5141
+ const out = [];
5142
+ raw.forEach((r, i) => {
5143
+ const at = `${field}[${i}]`;
5144
+ if (!isRecord4(r)) {
5145
+ errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
5146
+ return;
5147
+ }
5148
+ for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5149
+ const id2 = str2(r.id);
5150
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5151
+ if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
5152
+ const note = str2(r.note);
5153
+ if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
5154
+ else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5155
+ if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
5156
+ });
5157
+ return errors.length ? { errors } : { responses: out, errors: [] };
5158
+ }
5159
+ function formatStageVerdictLine(input) {
5160
+ const parts = [`review: ${input.verdict}`];
5161
+ if (input.verdict === "skipped_no_diff") return parts[0];
5162
+ parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
5163
+ if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
5164
+ const tail = [];
5165
+ if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
5166
+ if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
5167
+ return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
5168
+ }
3794
5169
  // Annotate the CommonJS export names for ESM import in node:
3795
5170
  0 && (module.exports = {
5171
+ ASSISTANT_ACCOUNT_SLOT,
5172
+ ASSISTANT_FOLLOWER_ALLOWED_OPS,
3796
5173
  ASSISTANT_OWNER_VERBS,
5174
+ ASSISTANT_REMOTE_FOLLOW_COMMAND,
5175
+ ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
5176
+ ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
5177
+ ASSISTANT_REMOTE_PROJECT_COMMAND,
3797
5178
  ASSISTANT_REVIEW_TURN_VERBS,
3798
5179
  ASSISTANT_SESSION_ID_ARG,
3799
5180
  ASSISTANT_SESSION_ID_ENV,
@@ -3805,12 +5186,16 @@ function stableMeshNodeRow(row) {
3805
5186
  CANCEL_REASONS,
3806
5187
  CANONICAL_MESH_TOOL_COUNT,
3807
5188
  CANONICAL_MESH_TOOL_NAMES,
5189
+ CARRY_OVER_MISSION_GOAL,
5190
+ CARRY_OVER_MISSION_TITLE,
5191
+ CHANGELOG_SECTIONS,
3808
5192
  CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
3809
5193
  CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
3810
5194
  CLI_SLOT_RECIPES,
3811
5195
  COMMIT_STRENGTHS,
3812
5196
  CONSUME_PROFILES,
3813
5197
  COORDINATOR_ACK_OUTCOMES,
5198
+ COORDINATOR_SETTABLE_ITEM_STATES,
3814
5199
  DAEMON_METADATA_DOC_SPEC,
3815
5200
  DAEMON_P2P_SIGNAL_TYPES,
3816
5201
  DAEMON_STATUS_EVENT_NAMES,
@@ -3823,13 +5208,34 @@ function stableMeshNodeRow(row) {
3823
5208
  DASHBOARD_TO_DAEMON_P2P_TYPES,
3824
5209
  DASHBOARD_TO_USER_SESSION_TYPES,
3825
5210
  DASHBOARD_WIRE_VERSION,
5211
+ DECISION_PUSH_OPTIONS_MAX,
5212
+ DECISION_PUSH_OPTION_LABEL_MAX,
5213
+ DECISION_PUSH_QUESTION_MAX,
5214
+ DECISION_PUSH_RELAY_COMMAND,
5215
+ DECISION_PUSH_RELAY_SOURCE,
3826
5216
  DEFAULT_DIFFICULTY_BRAINS,
3827
5217
  DELIVERY_OUTCOMES,
3828
5218
  DELIVERY_VIAS,
3829
5219
  DISPATCH_FAILURE_REASONS,
5220
+ DISPATCH_REFUSAL_DETAIL_MAX,
3830
5221
  EVIDENCE_ENVELOPE_FIELD_SPECS,
3831
5222
  EVIDENCE_SOURCE_IDS,
5223
+ FINDING_CATEGORIES,
5224
+ FINDING_RESPONSES_MAX,
5225
+ FINDING_RESPONSE_KINDS,
5226
+ FINDING_SEVERITIES,
3832
5227
  HOLD_REASONS,
5228
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
5229
+ LAUNCH_DEFAULT_ERROR_CODES,
5230
+ LAUNCH_DEFAULT_ROLES,
5231
+ LAUNCH_DEFAULT_SOURCES,
5232
+ LEGACY_CARRY_OVER_MISSION_TITLE,
5233
+ LIGHT_BLOCK_REASONS,
5234
+ LIGHT_HOLD,
5235
+ LIGHT_LAND_MODES,
5236
+ LIGHT_REJECT,
5237
+ LIGHT_TESTS_RUN_MAX,
5238
+ LIGHT_WARNINGS,
3833
5239
  LIVENESS_RESULTS,
3834
5240
  MAX_MESH_RECORD_STRING,
3835
5241
  MAX_OWNED_PATHS,
@@ -3844,6 +5250,8 @@ function stableMeshNodeRow(row) {
3844
5250
  MESH_MISSION_STATUSES,
3845
5251
  MESH_P2P_SIGNAL_TYPES,
3846
5252
  MESH_RECORD_PAYLOAD_KEYS,
5253
+ MESH_RELEASE_CHANNELS,
5254
+ MESH_RELEASE_STATUSES,
3847
5255
  MESH_SESSION_CLEANUP_MODES,
3848
5256
  MESH_STATUS_DOC_SPEC,
3849
5257
  MESH_TASK_DIFFICULTIES,
@@ -3855,10 +5263,23 @@ function stableMeshNodeRow(row) {
3855
5263
  MESH_TOPIC_ENTRY_KINDS,
3856
5264
  MESH_TOPIC_PROTOCOL_VERSION,
3857
5265
  MISSION_BRIEF_RENDER_MAX_CHARS,
5266
+ MISSION_DECISION_ON_DUE,
5267
+ MISSION_DECISION_OPTION_IDS,
5268
+ MISSION_DECISION_URGENCIES,
5269
+ MISSION_GIT_STATES,
5270
+ MISSION_ITEM_KINDS,
5271
+ MISSION_ITEM_STATES,
5272
+ MISSION_LIMITS,
5273
+ MISSION_OUTCOMES,
5274
+ MISSION_REF_GIT_METHODS,
5275
+ MISSION_REF_GIT_STATUSES,
5276
+ MISSION_REF_KINDS,
5277
+ MISSION_RELEASE_EVENT_TYPES,
3858
5278
  MODEL_AXIS_SOURCES,
3859
5279
  MODEL_SELECTION_HISTORY_LIMIT,
3860
5280
  MeshChunkAssembler,
3861
5281
  NATIVE_TURN_OUTCOMES,
5282
+ NEEDS_WORDING_MARKER,
3862
5283
  NOTIFY_KINDS,
3863
5284
  NO_PROGRESS_OBSERVED_STATUSES,
3864
5285
  NPM_UPDATE_TAGS,
@@ -3868,16 +5289,37 @@ function stableMeshNodeRow(row) {
3868
5289
  OPERATOR_STATUS_REASON_VALUES,
3869
5290
  OPERATOR_STATUS_VALUES,
3870
5291
  OUTBOUND_MESSAGE_ORIGINS,
5292
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX,
5293
+ OWNER_ABANDON_CONFIRM_OPTIONS,
5294
+ OWNER_ABANDON_CONFIRM_QUESTION,
3871
5295
  P2P_SIGNAL_TYPES,
5296
+ PRIOR_FINDING_STATUSES,
3872
5297
  PROVIDER_FAILURES,
3873
5298
  QUOTA_BACKFILL_HORIZON_MS,
3874
5299
  QUOTA_RETRY_INFLIGHT_GRACE_MS,
3875
5300
  QUOTA_SUPPORTED_PROVIDERS,
3876
5301
  RECENT_SESSION_BUCKETS,
3877
5302
  RECLAIMING_SEND_REFUSALS,
5303
+ RELAY_REPROBE_BASE_DELAY_MS,
5304
+ RELAY_REPROBE_JITTER_RATIO,
5305
+ RELAY_REPROBE_MAX_DELAY_MS,
5306
+ RELEASE_ACTORS,
3878
5307
  RELEASE_CHANNELS,
5308
+ RELEASE_EVENT_TYPES,
5309
+ RELEASE_LIMITS,
5310
+ RELEASE_MEMBER_STATES,
3879
5311
  REMOVED_MESH_TOOLS,
3880
5312
  RETIRED_MESH_TOOLS,
5313
+ REVIEW_CHECKED_MAX,
5314
+ REVIEW_CLAIM_MAX_CHARS,
5315
+ REVIEW_EVIDENCE_MAX_CHARS,
5316
+ REVIEW_FINDINGS_MAX,
5317
+ REVIEW_FINDING_ID_MAX_CHARS,
5318
+ REVIEW_FIX_MAX_CHARS,
5319
+ REVIEW_NOTE_MAX_CHARS,
5320
+ REVIEW_TESTS_RUN_MAX,
5321
+ REVIEW_VERDICTS,
5322
+ RelayReprobeScheduler,
3881
5323
  SEND_POLICY_MODES,
3882
5324
  SEND_REFUSAL_REASONS,
3883
5325
  SERVER_STATUS_EVENT_NAMES,
@@ -3890,6 +5332,17 @@ function stableMeshNodeRow(row) {
3890
5332
  SESSION_STATUS_ALIASES,
3891
5333
  SESSION_STATUS_CLASS,
3892
5334
  SHARED_SESSION_TO_VIEWER_TYPES,
5335
+ STAGE_BLOCKED_REASONS,
5336
+ STAGE_DECIDE_ACTIONS,
5337
+ STAGE_DEFAULT_MAX_REVISIONS,
5338
+ STAGE_INDEPENDENCE_FALLBACK_MS,
5339
+ STAGE_INDEPENDENCE_MODES,
5340
+ STAGE_MAX_REVISIONS_LIMIT,
5341
+ STAGE_PARKED_PHASES,
5342
+ STAGE_PHASES,
5343
+ STAGE_PIPELINE_CEILING_DEFAULT_MS,
5344
+ STAGE_ROLES,
5345
+ STAGE_SELF_CHECK_MAX_BOUNCES,
3893
5346
  STATUS_PROBE_ARG_KEY,
3894
5347
  SUSPENSION_MODALS,
3895
5348
  SUSPENSION_RESOLUTIONS,
@@ -3915,17 +5368,26 @@ function stableMeshNodeRow(row) {
3915
5368
  VERSION_UPDATE_REASONS,
3916
5369
  VIEWER_TO_SHARED_SESSION_TYPES,
3917
5370
  WORKER_BRANCH_STATES,
5371
+ WORKER_COMMITS_MAX,
5372
+ WORKER_CURRENT_BRANCH_RULE,
5373
+ WORKER_DECISIONS_NEEDED_MAX,
3918
5374
  WORKER_PROTOCOL_FOOTER_MARKER,
3919
5375
  WORKER_REPORT_OUTCOMES,
5376
+ WORKER_REPORT_SUMMARY_MAX_CHARS,
3920
5377
  WORKER_TOOLS,
5378
+ aggregateMissionGitState,
3921
5379
  appendWorkerProtocolFooter,
3922
5380
  argsCarryStatusProbeMarker,
3923
5381
  assessQuotaFreshness,
5382
+ boundEventPayload,
3924
5383
  buildSlotProposal,
3925
5384
  canonicalDaemonId,
5385
+ changelogMissionMarker,
5386
+ classifyChangelogSection,
3926
5387
  classifySessionStatus,
3927
5388
  compareDashboardWireVersion,
3928
5389
  compareSemver,
5390
+ computeRelayReprobeDelay,
3929
5391
  daemonIdsEquivalent,
3930
5392
  decodeActiveWorkQueryRequest,
3931
5393
  decodeActiveWorkQueryResponse,
@@ -3968,6 +5430,8 @@ function stableMeshNodeRow(row) {
3968
5430
  decodeQueueQueryResponse,
3969
5431
  decodeQueueRequeueRequest,
3970
5432
  decodeQueueRequeueResponse,
5433
+ decodeQueueReviseRequest,
5434
+ decodeQueueReviseResponse,
3971
5435
  decodeRecordLocalRequest,
3972
5436
  decodeRecordLocalResponse,
3973
5437
  decodeRecoveryContextQueryRequest,
@@ -3987,6 +5451,8 @@ function stableMeshNodeRow(row) {
3987
5451
  decodeUserSessionToDashboard,
3988
5452
  decodeViewerToSharedSession,
3989
5453
  defaultProviderPriorityFromNodeFacts,
5454
+ defaultStagePlan,
5455
+ deriveItemDedupeKey,
3990
5456
  deriveProviderPriorityFromSlots,
3991
5457
  deriveSlotsFromLegacy,
3992
5458
  describeModelSelection,
@@ -3997,13 +5463,21 @@ function stableMeshNodeRow(row) {
3997
5463
  expandDaemonIdForms,
3998
5464
  findOwnershipConflicts,
3999
5465
  foldKeyedDoc,
5466
+ followedRemoteProjectKey,
5467
+ followerOpPermitted,
4000
5468
  formatQuotaAccount,
5469
+ formatStageVerdictLine,
4001
5470
  hasGitStatusEvidence,
4002
5471
  hasWorkerProtocolFooter,
4003
5472
  interpolateString,
5473
+ isActionableProviderApproval,
5474
+ isAssistantFollowerAllowedOp,
4004
5475
  isAssistantTool,
4005
5476
  isBlockedStatus,
5477
+ isBlockingSeverity,
4006
5478
  isBusyStatus,
5479
+ isCarryOverMissionRecord,
5480
+ isCarryOverMissionTitle,
4007
5481
  isChunkType,
4008
5482
  isCommitStrength,
4009
5483
  isDaemonDirectCommandType,
@@ -4019,14 +5493,21 @@ function stableMeshNodeRow(row) {
4019
5493
  isDeadStatus,
4020
5494
  isDowngrade,
4021
5495
  isEvidenceIdentifier,
5496
+ isFindingCategory,
5497
+ isFindingResponseKind,
5498
+ isFindingSeverity,
4022
5499
  isFiniteNumber,
4023
5500
  isIdleSessionState,
4024
5501
  isInputEnvelopeWire,
5502
+ isLaunchDefaultRole,
5503
+ isLaunchDefaultSource,
5504
+ isLightWorkerSession,
4025
5505
  isMeshDeliveryMode,
4026
5506
  isMeshIndexQueryResponse,
4027
5507
  isMeshMissionStatusValue,
4028
5508
  isMeshP2PSignalType,
4029
5509
  isMeshRecordPayload,
5510
+ isMeshReleaseChannel,
4030
5511
  isMeshTaskDifficulty,
4031
5512
  isMeshTaskMode,
4032
5513
  isMeshTaskPriority,
@@ -4034,17 +5515,24 @@ function stableMeshNodeRow(row) {
4034
5515
  isMeshTerminalTaskStatus,
4035
5516
  isMeshTopicEntry,
4036
5517
  isMessageId,
5518
+ isMissionOutcome,
5519
+ isMissionRefContained,
4037
5520
  isMissionUpsertResponse,
4038
5521
  isModelAxisSource,
5522
+ isNativeMarkerRef,
4039
5523
  isNonEmptyString,
4040
5524
  isNotifyKind,
4041
5525
  isOutboundMessage,
4042
5526
  isOutboundMessageOrigin,
4043
5527
  isP2PSignalType,
4044
5528
  isPhantomDaemonEntry,
5529
+ isPriorFindingStatus,
5530
+ isProviderQuestionBinding,
4045
5531
  isRawDaemonDoId,
4046
5532
  isReadyStatus,
4047
5533
  isRecord,
5534
+ isReleaseStatus,
5535
+ isReviewVerdict,
4048
5536
  isSendPolicy,
4049
5537
  isSendPolicyMode,
4050
5538
  isSendRefusal,
@@ -4053,6 +5541,8 @@ function stableMeshNodeRow(row) {
4053
5541
  isSessionLaunchedBy,
4054
5542
  isSessionStatus,
4055
5543
  isSharedSessionToViewerType,
5544
+ isStageBlockedReason,
5545
+ isStageEligibleTask,
4056
5546
  isSubmitOutcome,
4057
5547
  isSummaryRef,
4058
5548
  isTerminalSessionRecordStatus,
@@ -4071,6 +5561,7 @@ function stableMeshNodeRow(row) {
4071
5561
  isWorkingStatus,
4072
5562
  joinRepoPath,
4073
5563
  launchModelSelectionValue,
5564
+ lintChangelogText,
4074
5565
  machineCoreFromDaemonId,
4075
5566
  makeTypeGuard,
4076
5567
  measureWorstCaseChunkEnvelopeBytes,
@@ -4082,41 +5573,58 @@ function stableMeshNodeRow(row) {
4082
5573
  minutesUntilQuotaCheck,
4083
5574
  normalizeAuthOkLimits,
4084
5575
  normalizeBrainSlot,
5576
+ normalizeDecisionInput,
4085
5577
  normalizeDifficultyBrainMap,
5578
+ normalizeForDedupe,
4086
5579
  normalizeGitStatus,
4087
5580
  normalizeMeshNodeFacts,
4088
5581
  normalizeMeshNodeId,
4089
5582
  normalizeMeshSessionRecord,
4090
5583
  normalizeMeshWorkspaceForCompare,
4091
5584
  normalizeMissionBrief,
5585
+ normalizeMissionItemInput,
5586
+ normalizeMissionItemUpdate,
5587
+ normalizeMissionRefs,
5588
+ normalizeMissionSummary,
4092
5589
  normalizeNodeCapabilitySlot,
4093
5590
  normalizeNodeCapabilitySlots,
5591
+ normalizeOutcomeReason,
4094
5592
  normalizeOwnedPaths,
5593
+ normalizeReportCommits,
4095
5594
  normalizeSessionStatus,
4096
5595
  normalizeThinkingLevel,
4097
5596
  orderProvidersByBuiltinPreference,
4098
5597
  parseJsonRecord,
5598
+ parseRoleLaunchSelection,
4099
5599
  parseSemver,
4100
5600
  parseSessionLaunchRecord,
4101
5601
  pathsOverlap,
4102
5602
  pickBestTransitGitStatus,
4103
5603
  projectFileDiffRow,
4104
5604
  projectTurnEvidenceEntry,
5605
+ providerApprovalSnapshot,
4105
5606
  readBoolean,
4106
5607
  readEnvelopeFields,
4107
5608
  readGitSubmodules,
4108
5609
  readNumber,
4109
5610
  readOptionalRecord,
5611
+ readProviderDecision,
4110
5612
  readRecord,
4111
5613
  readString,
4112
5614
  readStringArray,
4113
5615
  readText,
4114
5616
  renderCoordinatorWorkerSection,
5617
+ renderLightWorkspaceRules,
4115
5618
  renderMissionBriefBlock,
5619
+ renderStageProtocolLines,
4116
5620
  renderWorkerProtocolFooter,
5621
+ resolveStagePlan,
4117
5622
  retiredMeshToolError,
5623
+ reviewIndependenceOf,
5624
+ sanitizeDispatchRefusalDetail,
4118
5625
  sanitizeModelIdentifier,
4119
5626
  sanitizeRefusalCode,
5627
+ sanitizeRemoteRepoIdentity,
4120
5628
  scoreGitStatusCandidate,
4121
5629
  scoreGitUpstreamFreshness,
4122
5630
  sessionIdsEquivalent,
@@ -4127,6 +5635,11 @@ function stableMeshNodeRow(row) {
4127
5635
  summarizeGitShape,
4128
5636
  supportsQuota,
4129
5637
  touchedFilesOutsideOwnership,
5638
+ truncateMissionText,
5639
+ unwrapPastedContent,
5640
+ validateFindingResponses,
5641
+ validateReviewReport,
5642
+ validateTestsRun,
4130
5643
  withStatusProbeMarker
4131
5644
  });
4132
5645
  //# sourceMappingURL=index.js.map