@adhdev/mesh-shared 1.0.82-rc.1 → 1.0.82-rc.100

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 +13 -0
  4. package/dist/index.js +1683 -120
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1540 -120
  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 +75 -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 +65 -0
  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 +208 -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 +41 -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 +14 -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 +70 -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 +139 -0
  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 +457 -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 +45 -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 +94 -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,14 +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,
150
+ QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
151
+ QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
100
152
  QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
101
153
  RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
102
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,
103
159
  RELEASE_CHANNELS: () => RELEASE_CHANNELS,
160
+ RELEASE_EVENT_TYPES: () => RELEASE_EVENT_TYPES,
161
+ RELEASE_LIMITS: () => RELEASE_LIMITS,
162
+ RELEASE_MEMBER_STATES: () => RELEASE_MEMBER_STATES,
104
163
  REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
105
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,
106
175
  SEND_POLICY_MODES: () => SEND_POLICY_MODES,
107
176
  SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
108
177
  SERVER_STATUS_EVENT_NAMES: () => SERVER_STATUS_EVENT_NAMES,
@@ -115,6 +184,17 @@ __export(index_exports, {
115
184
  SESSION_STATUS_ALIASES: () => SESSION_STATUS_ALIASES,
116
185
  SESSION_STATUS_CLASS: () => SESSION_STATUS_CLASS,
117
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,
118
198
  STATUS_PROBE_ARG_KEY: () => STATUS_PROBE_ARG_KEY,
119
199
  SUSPENSION_MODALS: () => SUSPENSION_MODALS,
120
200
  SUSPENSION_RESOLUTIONS: () => SUSPENSION_RESOLUTIONS,
@@ -140,16 +220,27 @@ __export(index_exports, {
140
220
  VERSION_UPDATE_REASONS: () => VERSION_UPDATE_REASONS,
141
221
  VIEWER_TO_SHARED_SESSION_TYPES: () => VIEWER_TO_SHARED_SESSION_TYPES,
142
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,
143
226
  WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
144
227
  WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
228
+ WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
229
+ WORKER_SHELL_LITERAL_PATHS_RULE: () => WORKER_SHELL_LITERAL_PATHS_RULE,
145
230
  WORKER_TOOLS: () => WORKER_TOOLS,
231
+ aggregateMissionGitState: () => aggregateMissionGitState,
146
232
  appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
147
233
  argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
234
+ assessQuotaFreshness: () => assessQuotaFreshness,
235
+ boundEventPayload: () => boundEventPayload,
148
236
  buildSlotProposal: () => buildSlotProposal,
149
237
  canonicalDaemonId: () => canonicalDaemonId,
238
+ changelogMissionMarker: () => changelogMissionMarker,
239
+ classifyChangelogSection: () => classifyChangelogSection,
150
240
  classifySessionStatus: () => classifySessionStatus,
151
241
  compareDashboardWireVersion: () => compareDashboardWireVersion,
152
242
  compareSemver: () => compareSemver,
243
+ computeRelayReprobeDelay: () => computeRelayReprobeDelay,
153
244
  daemonIdsEquivalent: () => daemonIdsEquivalent,
154
245
  decodeActiveWorkQueryRequest: () => decodeActiveWorkQueryRequest,
155
246
  decodeActiveWorkQueryResponse: () => decodeActiveWorkQueryResponse,
@@ -192,6 +283,8 @@ __export(index_exports, {
192
283
  decodeQueueQueryResponse: () => decodeQueueQueryResponse,
193
284
  decodeQueueRequeueRequest: () => decodeQueueRequeueRequest,
194
285
  decodeQueueRequeueResponse: () => decodeQueueRequeueResponse,
286
+ decodeQueueReviseRequest: () => decodeQueueReviseRequest,
287
+ decodeQueueReviseResponse: () => decodeQueueReviseResponse,
195
288
  decodeRecordLocalRequest: () => decodeRecordLocalRequest,
196
289
  decodeRecordLocalResponse: () => decodeRecordLocalResponse,
197
290
  decodeRecoveryContextQueryRequest: () => decodeRecoveryContextQueryRequest,
@@ -211,6 +304,8 @@ __export(index_exports, {
211
304
  decodeUserSessionToDashboard: () => decodeUserSessionToDashboard,
212
305
  decodeViewerToSharedSession: () => decodeViewerToSharedSession,
213
306
  defaultProviderPriorityFromNodeFacts: () => defaultProviderPriorityFromNodeFacts,
307
+ defaultStagePlan: () => defaultStagePlan,
308
+ deriveItemDedupeKey: () => deriveItemDedupeKey,
214
309
  deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
215
310
  deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
216
311
  describeModelSelection: () => describeModelSelection,
@@ -221,13 +316,21 @@ __export(index_exports, {
221
316
  expandDaemonIdForms: () => expandDaemonIdForms,
222
317
  findOwnershipConflicts: () => findOwnershipConflicts,
223
318
  foldKeyedDoc: () => foldKeyedDoc,
319
+ followedRemoteProjectKey: () => followedRemoteProjectKey,
320
+ followerOpPermitted: () => followerOpPermitted,
224
321
  formatQuotaAccount: () => formatQuotaAccount,
322
+ formatStageVerdictLine: () => formatStageVerdictLine,
225
323
  hasGitStatusEvidence: () => hasGitStatusEvidence,
226
324
  hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
227
325
  interpolateString: () => interpolateString,
326
+ isActionableProviderApproval: () => isActionableProviderApproval,
327
+ isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
228
328
  isAssistantTool: () => isAssistantTool,
229
329
  isBlockedStatus: () => isBlockedStatus,
330
+ isBlockingSeverity: () => isBlockingSeverity,
230
331
  isBusyStatus: () => isBusyStatus,
332
+ isCarryOverMissionRecord: () => isCarryOverMissionRecord,
333
+ isCarryOverMissionTitle: () => isCarryOverMissionTitle,
231
334
  isChunkType: () => isChunkType,
232
335
  isCommitStrength: () => isCommitStrength,
233
336
  isDaemonDirectCommandType: () => isDaemonDirectCommandType,
@@ -243,14 +346,21 @@ __export(index_exports, {
243
346
  isDeadStatus: () => isDeadStatus,
244
347
  isDowngrade: () => isDowngrade,
245
348
  isEvidenceIdentifier: () => isEvidenceIdentifier,
349
+ isFindingCategory: () => isFindingCategory,
350
+ isFindingResponseKind: () => isFindingResponseKind,
351
+ isFindingSeverity: () => isFindingSeverity,
246
352
  isFiniteNumber: () => isFiniteNumber,
247
353
  isIdleSessionState: () => isIdleSessionState,
248
354
  isInputEnvelopeWire: () => isInputEnvelopeWire,
355
+ isLaunchDefaultRole: () => isLaunchDefaultRole,
356
+ isLaunchDefaultSource: () => isLaunchDefaultSource,
357
+ isLightWorkerSession: () => isLightWorkerSession,
249
358
  isMeshDeliveryMode: () => isMeshDeliveryMode,
250
359
  isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
251
360
  isMeshMissionStatusValue: () => isMeshMissionStatusValue,
252
361
  isMeshP2PSignalType: () => isMeshP2PSignalType,
253
362
  isMeshRecordPayload: () => isMeshRecordPayload,
363
+ isMeshReleaseChannel: () => isMeshReleaseChannel,
254
364
  isMeshTaskDifficulty: () => isMeshTaskDifficulty,
255
365
  isMeshTaskMode: () => isMeshTaskMode,
256
366
  isMeshTaskPriority: () => isMeshTaskPriority,
@@ -258,17 +368,24 @@ __export(index_exports, {
258
368
  isMeshTerminalTaskStatus: () => isMeshTerminalTaskStatus,
259
369
  isMeshTopicEntry: () => isMeshTopicEntry,
260
370
  isMessageId: () => isMessageId,
371
+ isMissionOutcome: () => isMissionOutcome,
372
+ isMissionRefContained: () => isMissionRefContained,
261
373
  isMissionUpsertResponse: () => isMissionUpsertResponse,
262
374
  isModelAxisSource: () => isModelAxisSource,
375
+ isNativeMarkerRef: () => isNativeMarkerRef,
263
376
  isNonEmptyString: () => isNonEmptyString,
264
377
  isNotifyKind: () => isNotifyKind,
265
378
  isOutboundMessage: () => isOutboundMessage,
266
379
  isOutboundMessageOrigin: () => isOutboundMessageOrigin,
267
380
  isP2PSignalType: () => isP2PSignalType,
268
381
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
382
+ isPriorFindingStatus: () => isPriorFindingStatus,
383
+ isProviderQuestionBinding: () => isProviderQuestionBinding,
269
384
  isRawDaemonDoId: () => isRawDaemonDoId,
270
385
  isReadyStatus: () => isReadyStatus,
271
386
  isRecord: () => isRecord,
387
+ isReleaseStatus: () => isReleaseStatus,
388
+ isReviewVerdict: () => isReviewVerdict,
272
389
  isSendPolicy: () => isSendPolicy,
273
390
  isSendPolicyMode: () => isSendPolicyMode,
274
391
  isSendRefusal: () => isSendRefusal,
@@ -277,6 +394,8 @@ __export(index_exports, {
277
394
  isSessionLaunchedBy: () => isSessionLaunchedBy,
278
395
  isSessionStatus: () => isSessionStatus,
279
396
  isSharedSessionToViewerType: () => isSharedSessionToViewerType,
397
+ isStageBlockedReason: () => isStageBlockedReason,
398
+ isStageEligibleTask: () => isStageEligibleTask,
280
399
  isSubmitOutcome: () => isSubmitOutcome,
281
400
  isSummaryRef: () => isSummaryRef,
282
401
  isTerminalSessionRecordStatus: () => isTerminalSessionRecordStatus,
@@ -295,6 +414,7 @@ __export(index_exports, {
295
414
  isWorkingStatus: () => isWorkingStatus,
296
415
  joinRepoPath: () => joinRepoPath,
297
416
  launchModelSelectionValue: () => launchModelSelectionValue,
417
+ lintChangelogText: () => lintChangelogText,
298
418
  machineCoreFromDaemonId: () => machineCoreFromDaemonId,
299
419
  makeTypeGuard: () => makeTypeGuard,
300
420
  measureWorstCaseChunkEnvelopeBytes: () => measureWorstCaseChunkEnvelopeBytes,
@@ -303,43 +423,61 @@ __export(index_exports, {
303
423
  meshUtf8ByteLength: () => meshUtf8ByteLength,
304
424
  meshWorkspacesEquivalent: () => meshWorkspacesEquivalent,
305
425
  mintMessageId: () => mintMessageId,
426
+ minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
306
427
  normalizeAuthOkLimits: () => normalizeAuthOkLimits,
307
428
  normalizeBrainSlot: () => normalizeBrainSlot,
429
+ normalizeDecisionInput: () => normalizeDecisionInput,
308
430
  normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
431
+ normalizeForDedupe: () => normalizeForDedupe,
309
432
  normalizeGitStatus: () => normalizeGitStatus,
310
433
  normalizeMeshNodeFacts: () => normalizeMeshNodeFacts,
311
434
  normalizeMeshNodeId: () => normalizeMeshNodeId,
312
435
  normalizeMeshSessionRecord: () => normalizeMeshSessionRecord,
313
436
  normalizeMeshWorkspaceForCompare: () => normalizeMeshWorkspaceForCompare,
314
437
  normalizeMissionBrief: () => normalizeMissionBrief,
438
+ normalizeMissionItemInput: () => normalizeMissionItemInput,
439
+ normalizeMissionItemUpdate: () => normalizeMissionItemUpdate,
440
+ normalizeMissionRefs: () => normalizeMissionRefs,
441
+ normalizeMissionSummary: () => normalizeMissionSummary,
315
442
  normalizeNodeCapabilitySlot: () => normalizeNodeCapabilitySlot,
316
443
  normalizeNodeCapabilitySlots: () => normalizeNodeCapabilitySlots,
444
+ normalizeOutcomeReason: () => normalizeOutcomeReason,
317
445
  normalizeOwnedPaths: () => normalizeOwnedPaths,
446
+ normalizeReportCommits: () => normalizeReportCommits,
318
447
  normalizeSessionStatus: () => normalizeSessionStatus,
319
448
  normalizeThinkingLevel: () => normalizeThinkingLevel,
320
449
  orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
321
450
  parseJsonRecord: () => parseJsonRecord,
451
+ parseRoleLaunchSelection: () => parseRoleLaunchSelection,
322
452
  parseSemver: () => parseSemver,
323
453
  parseSessionLaunchRecord: () => parseSessionLaunchRecord,
324
454
  pathsOverlap: () => pathsOverlap,
325
455
  pickBestTransitGitStatus: () => pickBestTransitGitStatus,
326
456
  projectFileDiffRow: () => projectFileDiffRow,
327
457
  projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
458
+ providerApprovalSnapshot: () => providerApprovalSnapshot,
328
459
  readBoolean: () => readBoolean,
329
460
  readEnvelopeFields: () => readEnvelopeFields,
330
461
  readGitSubmodules: () => readGitSubmodules,
331
462
  readNumber: () => readNumber,
332
463
  readOptionalRecord: () => readOptionalRecord,
464
+ readProviderDecision: () => readProviderDecision,
333
465
  readRecord: () => readRecord,
334
466
  readString: () => readString,
335
467
  readStringArray: () => readStringArray,
336
468
  readText: () => readText,
337
469
  renderCoordinatorWorkerSection: () => renderCoordinatorWorkerSection,
470
+ renderLightWorkspaceRules: () => renderLightWorkspaceRules,
338
471
  renderMissionBriefBlock: () => renderMissionBriefBlock,
472
+ renderStageProtocolLines: () => renderStageProtocolLines,
339
473
  renderWorkerProtocolFooter: () => renderWorkerProtocolFooter,
474
+ resolveStagePlan: () => resolveStagePlan,
340
475
  retiredMeshToolError: () => retiredMeshToolError,
476
+ reviewIndependenceOf: () => reviewIndependenceOf,
477
+ sanitizeDispatchRefusalDetail: () => sanitizeDispatchRefusalDetail,
341
478
  sanitizeModelIdentifier: () => sanitizeModelIdentifier,
342
479
  sanitizeRefusalCode: () => sanitizeRefusalCode,
480
+ sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
343
481
  scoreGitStatusCandidate: () => scoreGitStatusCandidate,
344
482
  scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
345
483
  sessionIdsEquivalent: () => sessionIdsEquivalent,
@@ -350,6 +488,11 @@ __export(index_exports, {
350
488
  summarizeGitShape: () => summarizeGitShape,
351
489
  supportsQuota: () => supportsQuota,
352
490
  touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
491
+ truncateMissionText: () => truncateMissionText,
492
+ unwrapPastedContent: () => unwrapPastedContent,
493
+ validateFindingResponses: () => validateFindingResponses,
494
+ validateReviewReport: () => validateReviewReport,
495
+ validateTestsRun: () => validateTestsRun,
353
496
  withStatusProbeMarker: () => withStatusProbeMarker
354
497
  });
355
498
  module.exports = __toCommonJS(index_exports);
@@ -550,15 +693,15 @@ function pickBestTransitGitStatus(node, options) {
550
693
  }
551
694
 
552
695
  // src/session-normalize.ts
553
- function deriveSyntheticSessionId(record) {
696
+ function deriveSyntheticSessionId(record2) {
554
697
  const parts = [
555
- readString(record.workspace),
556
- readString(record.providerType, record.provider),
557
- readString(record.role),
558
- readString(record.state, record.status),
559
- readString(record.title),
560
- readString(record.createdAt, record.created_at),
561
- readString(record.startedAt, record.started_at)
698
+ readString(record2.workspace),
699
+ readString(record2.providerType, record2.provider),
700
+ readString(record2.role),
701
+ readString(record2.state, record2.status),
702
+ readString(record2.title),
703
+ readString(record2.createdAt, record2.created_at),
704
+ readString(record2.startedAt, record2.started_at)
562
705
  ].filter((part) => Boolean(part));
563
706
  if (parts.length === 0) return void 0;
564
707
  return `synthetic:${parts.join("|")}`;
@@ -570,33 +713,33 @@ function sessionIdsEquivalent(a, b) {
570
713
  return idA === idB;
571
714
  }
572
715
  function normalizeMeshSessionRecord(entry) {
573
- const record = readRecord(entry);
574
- const sessionId = readString(record.sessionId, record.session_id, record.id) ?? deriveSyntheticSessionId(record);
716
+ const record2 = readRecord(entry);
717
+ const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
575
718
  if (!sessionId) return null;
576
719
  return {
577
720
  sessionId,
578
- ...readString(record.providerType, record.provider) ? { providerType: readString(record.providerType, record.provider) } : {},
579
- ...readString(record.state, record.status) ? { state: readString(record.state, record.status) } : {},
580
- ...readString(record.chatStatus, record.chat_status) ? { chatStatus: readString(record.chatStatus, record.chat_status) } : {},
581
- ...readString(record.lifecycle) ? { lifecycle: readString(record.lifecycle) } : {},
582
- ...readString(record.surfaceKind, record.surface_kind) ? { surfaceKind: readString(record.surfaceKind, record.surface_kind) } : {},
583
- ...readString(record.recoveryState, record.recovery_state) ? { recoveryState: readString(record.recoveryState, record.recovery_state) } : {},
584
- ...readString(record.workspace) ? { workspace: readString(record.workspace) } : {},
585
- ...readString(record.title) ? { title: readString(record.title) } : {},
586
- ...readString(record.role) ? { role: readString(record.role) } : {},
587
- ...readBoolean(record.isSelfCoordinator, record.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record.isSelfCoordinator, record.is_self_coordinator) } : {},
588
- ...readString(record.statusNote, record.status_note) ? { statusNote: readString(record.statusNote, record.status_note) } : {},
589
- ...readString(record.createdAt, record.created_at) ? { createdAt: readString(record.createdAt, record.created_at) } : {},
590
- ...readString(record.startedAt, record.started_at) ? { startedAt: readString(record.startedAt, record.started_at) } : {},
591
- ...readString(record.lastActivityAt, record.last_activity_at) ? { lastActivityAt: readString(record.lastActivityAt, record.last_activity_at) } : {},
592
- ...readBoolean(record.isCached, record.is_cached) !== void 0 ? { isCached: readBoolean(record.isCached, record.is_cached) } : {}
721
+ ...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
722
+ ...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
723
+ ...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
724
+ ...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
725
+ ...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
726
+ ...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
727
+ ...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
728
+ ...readString(record2.title) ? { title: readString(record2.title) } : {},
729
+ ...readString(record2.role) ? { role: readString(record2.role) } : {},
730
+ ...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
731
+ ...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
732
+ ...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
733
+ ...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
734
+ ...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
735
+ ...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
593
736
  };
594
737
  }
595
738
 
596
739
  // src/node-normalize.ts
597
740
  function normalizeMeshNodeId(node) {
598
- const record = node && typeof node === "object" ? node : {};
599
- return readString(record.id, record.nodeId, record.node_id);
741
+ const record2 = node && typeof node === "object" ? node : {};
742
+ return readString(record2.id, record2.nodeId, record2.node_id);
600
743
  }
601
744
  function meshNodeIdMatches(node, candidateId) {
602
745
  if (!candidateId) return false;
@@ -608,12 +751,12 @@ function meshNodeIdMatches(node, candidateId) {
608
751
  // src/node-facts.ts
609
752
  function normalizeMeshNodeFacts(raw) {
610
753
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
611
- const record = raw;
612
- const schemaVersion = Number(record.schemaVersion);
613
- const reportedAt = Number(record.reportedAt);
754
+ const record2 = raw;
755
+ const schemaVersion = Number(record2.schemaVersion);
756
+ const reportedAt = Number(record2.reportedAt);
614
757
  if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
615
758
  if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
616
- return { ...record, schemaVersion, reportedAt };
759
+ return { ...record2, schemaVersion, reportedAt };
617
760
  }
618
761
  var QUOTA_SUPPORTED_PROVIDERS = [
619
762
  "antigravity-cli",
@@ -656,6 +799,52 @@ function defaultProviderPriorityFromNodeFacts(facts) {
656
799
  return orderProvidersByBuiltinPreference(detected.length ? detected : enabled);
657
800
  }
658
801
 
802
+ // src/quota-freshness.ts
803
+ var QUOTA_RETRY_INFLIGHT_GRACE_MS = 6e4;
804
+ var QUOTA_BACKFILL_HORIZON_MS = 60 * 60 * 1e3;
805
+ function hasUsableWindow(window) {
806
+ return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
807
+ }
808
+ function hasReading(quota) {
809
+ if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
810
+ return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
811
+ }
812
+ function finiteMs(value) {
813
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
814
+ }
815
+ function backfillCheckAt(quota, now) {
816
+ const dataDue = finiteMs(quota.updatedAt);
817
+ const attempted = finiteMs(quota.metadata?.fetchedAt);
818
+ const dueAt = Math.max(
819
+ dataDue === void 0 ? Number.NEGATIVE_INFINITY : dataDue + QUOTA_BACKFILL_HORIZON_MS,
820
+ attempted === void 0 ? Number.NEGATIVE_INFINITY : attempted + QUOTA_BACKFILL_HORIZON_MS
821
+ );
822
+ return Number.isFinite(dueAt) && dueAt > now ? dueAt : void 0;
823
+ }
824
+ function assessQuotaFreshness(quota, now = Date.now()) {
825
+ const meta = quota.metadata;
826
+ const kind = meta?.failureKind;
827
+ const userMustAct = kind === "no-data" && quota.provider !== "codex-cli";
828
+ const awaitsCliUse = kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
829
+ if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
830
+ if (awaitsCliUse) return hasReading(quota) ? { cue: "stale", userMustAct: false } : { userMustAct: false };
831
+ if (meta?.lastGoodWindows !== true) {
832
+ const measuredAt = finiteMs(quota.updatedAt);
833
+ if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
834
+ return { cue: "stale", userMustAct };
835
+ }
836
+ return { userMustAct };
837
+ }
838
+ const retryAtMs = finiteMs(meta?.retryAtMs);
839
+ const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
840
+ if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
841
+ const nextCheckAt = backfillCheckAt(quota, now);
842
+ return nextCheckAt === void 0 ? { cue: "stale", userMustAct: false } : { cue: "stale", userMustAct: false, nextCheckAt };
843
+ }
844
+ function minutesUntilQuotaCheck(nextCheckAt, now = Date.now()) {
845
+ return Math.max(1, Math.round((nextCheckAt - now) / 6e4));
846
+ }
847
+
659
848
  // src/workspace-normalize.ts
660
849
  function normalizeMeshWorkspaceForCompare(dir) {
661
850
  if (typeof dir !== "string") return "";
@@ -685,19 +874,21 @@ function isPhantomDaemonEntry(entry) {
685
874
  function machineCoreFromDaemonId(id2) {
686
875
  const trimmed = readString(id2);
687
876
  if (!trimmed) return void 0;
877
+ const lower = trimmed.toLowerCase();
688
878
  for (const prefix of DAEMON_ID_PREFIXES) {
689
- if (trimmed.startsWith(prefix)) {
879
+ if (lower.startsWith(prefix)) {
690
880
  const core = trimmed.slice(prefix.length).trim();
691
- return core || void 0;
881
+ if (!core) return void 0;
882
+ return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
692
883
  }
693
884
  }
694
- return trimmed;
885
+ return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
695
886
  }
696
887
  function canonicalDaemonId(id2) {
697
888
  const core = machineCoreFromDaemonId(id2);
698
889
  if (!core) return void 0;
699
- if (!core.startsWith("mach_")) return core;
700
- return `daemon_${core}`;
890
+ if (!/^mach_/i.test(core)) return core;
891
+ return `daemon_mach_${core.slice(5)}`;
701
892
  }
702
893
  function daemonIdsEquivalent(a, b) {
703
894
  const coreA = machineCoreFromDaemonId(a);
@@ -726,9 +917,9 @@ function expandDaemonIdForms(ids) {
726
917
 
727
918
  // src/git-summarize.ts
728
919
  function summarizeGitShape(status) {
729
- const record = readRecord(status);
730
- if (!Object.keys(record).length) return null;
731
- const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => {
920
+ const record2 = readRecord(status);
921
+ if (!Object.keys(record2).length) return null;
922
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
732
923
  const sub = readRecord(entry);
733
924
  return {
734
925
  path: readString(sub.path) ?? null,
@@ -738,23 +929,23 @@ function summarizeGitShape(status) {
738
929
  };
739
930
  }) : [];
740
931
  return {
741
- isGitRepo: readBoolean(record.isGitRepo),
742
- workspace: readString(record.workspace) ?? null,
743
- repoRoot: readString(record.repoRoot, record.repo_root) ?? null,
744
- branch: readString(record.branch) ?? null,
745
- upstream: readString(record.upstream) ?? null,
746
- upstreamStatus: readString(record.upstreamStatus, record.upstream_status) ?? null,
747
- headCommit: readString(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
748
- ahead: readNumber(record.ahead) ?? null,
749
- behind: readNumber(record.behind) ?? null,
932
+ isGitRepo: readBoolean(record2.isGitRepo),
933
+ workspace: readString(record2.workspace) ?? null,
934
+ repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
935
+ branch: readString(record2.branch) ?? null,
936
+ upstream: readString(record2.upstream) ?? null,
937
+ upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
938
+ headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
939
+ ahead: readNumber(record2.ahead) ?? null,
940
+ behind: readNumber(record2.behind) ?? null,
750
941
  dirtyCounts: {
751
- staged: readNumber(record.staged) ?? 0,
752
- modified: readNumber(record.modified) ?? 0,
753
- untracked: readNumber(record.untracked) ?? 0,
754
- deleted: readNumber(record.deleted) ?? 0,
755
- renamed: readNumber(record.renamed) ?? 0
942
+ staged: readNumber(record2.staged) ?? 0,
943
+ modified: readNumber(record2.modified) ?? 0,
944
+ untracked: readNumber(record2.untracked) ?? 0,
945
+ deleted: readNumber(record2.deleted) ?? 0,
946
+ renamed: readNumber(record2.renamed) ?? 0
756
947
  },
757
- lastCheckedAt: readNumber(record.lastCheckedAt, record.last_checked_at) ?? null,
948
+ lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
758
949
  submoduleCount: submodules.length,
759
950
  submodules
760
951
  };
@@ -920,10 +1111,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
920
1111
  ],
921
1112
  "antigravity-cli": [
922
1113
  {
923
- model: "Gemini 3.1 Pro (High)",
1114
+ model: "Gemini 3.8 Flash (High)",
1115
+ modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
924
1116
  difficulty: ["easy"],
925
1117
  maxParallel: 2,
926
1118
  rationale: "Cheap capacity for easy tasks."
1119
+ },
1120
+ {
1121
+ model: "Gemini 4 Argon (Medium)",
1122
+ modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
1123
+ difficulty: ["medium"],
1124
+ maxParallel: 2,
1125
+ rationale: "Balanced Argon tier for medium tasks."
1126
+ },
1127
+ {
1128
+ model: "Gemini 4 Argon (High)",
1129
+ modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
1130
+ difficulty: ["difficult"],
1131
+ maxParallel: 1,
1132
+ rationale: "Reserved for hard tasks; capped at 1 to bound cost."
927
1133
  }
928
1134
  ],
929
1135
  "cursor-cli": [
@@ -962,6 +1168,24 @@ function dedupeDetected(detected) {
962
1168
  }
963
1169
  return out;
964
1170
  }
1171
+ function resolveRecipeModel(recipe, modelOptions) {
1172
+ if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
1173
+ return recipe.model;
1174
+ }
1175
+ const available = new Set(
1176
+ modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
1177
+ );
1178
+ if (available.size === 0) return recipe.model;
1179
+ const candidates = [
1180
+ ...recipe.model ? [recipe.model] : [],
1181
+ ...recipe.modelCandidates ?? []
1182
+ ];
1183
+ for (const candidate of candidates) {
1184
+ const trimmed = typeof candidate === "string" ? candidate.trim() : "";
1185
+ if (trimmed && available.has(trimmed)) return trimmed;
1186
+ }
1187
+ return recipe.model;
1188
+ }
965
1189
  function buildSlotProposal(detected, currentSlots = []) {
966
1190
  const providers = dedupeDetected(detected ?? []);
967
1191
  const proposedSlots = [];
@@ -977,7 +1201,7 @@ function buildSlotProposal(detected, currentSlots = []) {
977
1201
  for (const recipe of recipes) {
978
1202
  const slot = normalizeNodeCapabilitySlot({
979
1203
  provider: provider.type,
980
- model: recipe.model,
1204
+ model: resolveRecipeModel(recipe, provider.modelOptions),
981
1205
  thinkingLevel: recipe.thinkingLevel,
982
1206
  difficulty: recipe.difficulty,
983
1207
  maxParallel: recipe.maxParallel
@@ -1030,7 +1254,12 @@ var CANONICAL_MESH_TOOL_NAMES = [
1030
1254
  "mesh_enqueue_task",
1031
1255
  "mesh_view_queue",
1032
1256
  "mesh_queue_cancel",
1257
+ "mesh_task_stage_decide",
1258
+ "mesh_direct_cancel",
1033
1259
  "mesh_queue_requeue",
1260
+ "mesh_queue_revise",
1261
+ "mesh_light_land",
1262
+ "mesh_light_discard",
1034
1263
  "mesh_send_task",
1035
1264
  "mesh_read_chat",
1036
1265
  "mesh_read_debug",
@@ -1047,8 +1276,13 @@ var CANONICAL_MESH_TOOL_NAMES = [
1047
1276
  "mesh_list_pending_approvals",
1048
1277
  "mesh_create",
1049
1278
  "mesh_add_node",
1279
+ "mesh_reattach_source_parent",
1280
+ "mesh_attach_remote",
1281
+ "mesh_host_pairing",
1050
1282
  "mesh_clone_node",
1051
1283
  "mesh_remove_node",
1284
+ "mesh_retry_node_bootstrap",
1285
+ "mesh_recover_node_identity",
1052
1286
  "mesh_cleanup_worktree_nodes",
1053
1287
  "mesh_refine_node",
1054
1288
  "mesh_refine_batch",
@@ -1065,8 +1299,20 @@ var CANONICAL_MESH_TOOL_NAMES = [
1065
1299
  "mesh_reconcile_ledger",
1066
1300
  "mesh_mission_upsert",
1067
1301
  "mesh_mission_list",
1302
+ "mesh_mission_git_eval",
1303
+ "mesh_release_upsert",
1304
+ "mesh_release_scope",
1305
+ "mesh_release_list",
1306
+ "mesh_release_record_deploy",
1307
+ "mesh_release_changelog_draft",
1308
+ "mesh_file_transfer",
1068
1309
  "mesh_review_inbox",
1069
- "mesh_node_slots"
1310
+ "mesh_node_slots",
1311
+ "driver_list",
1312
+ "driver_describe",
1313
+ "artifact_list",
1314
+ "artifact_read",
1315
+ "artifact_register"
1070
1316
  ];
1071
1317
  var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
1072
1318
  var RETIRED_MESH_TOOLS = {
@@ -1376,9 +1622,15 @@ var DAEMON_STATUS_EVENT_NAMES = [
1376
1622
  "agent:waiting_choice",
1377
1623
  "agent:generating_completed",
1378
1624
  "agent:stopped",
1379
- "monitor:no_progress"
1625
+ "monitor:no_progress",
1626
+ // An owner decision (structured missions) needs the owner. Server-bound for the push only;
1627
+ // the dashboard learns about decisions over P2P (`mission_decisions_list`).
1628
+ "agent:decision_needed"
1380
1629
  ];
1381
1630
  var isDaemonStatusEventName = makeTypeGuard(DAEMON_STATUS_EVENT_NAMES);
1631
+ var DECISION_PUSH_QUESTION_MAX = 80;
1632
+ var DECISION_PUSH_OPTION_LABEL_MAX = 24;
1633
+ var DECISION_PUSH_OPTIONS_MAX = 3;
1382
1634
  var RELEASE_CHANNELS = ["stable", "preview"];
1383
1635
  var NPM_UPDATE_TAGS = ["latest", "next"];
1384
1636
  var VERSION_UPDATE_REASONS = ["force_update_below", "major_minor_mismatch", "patch_mismatch", "daemon_ahead"];
@@ -1741,21 +1993,22 @@ function isTerminalSessionRecordStatus(raw) {
1741
1993
  return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
1742
1994
  }
1743
1995
  function isIdleSessionState(state) {
1744
- const record = state && typeof state === "object" ? state : {};
1745
- const status = typeof record.status === "string" ? record.status.trim().toLowerCase() : "";
1996
+ const record2 = state && typeof state === "object" ? state : {};
1997
+ const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
1746
1998
  if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
1747
- return isReadyStatus(status) || record.activeChat?.status === "waiting_input";
1999
+ return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
1748
2000
  }
1749
2001
 
1750
2002
  // src/mesh-vocabulary.ts
1751
- var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
1752
- var MESH_TERMINAL_TASK_STATUSES = ["completed", "failed", "cancelled"];
2003
+ var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
2004
+ var MESH_TERMINAL_TASK_STATUSES = ["completed", "blocked", "failed", "cancelled"];
1753
2005
  var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
1754
2006
  var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
1755
2007
  var MESH_THINKING_LEVELS = ["low", "medium", "high"];
1756
2008
  var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
1757
2009
  var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
1758
2010
  var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
2011
+ var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
1759
2012
  var WORKER_BRANCH_STATES = [
1760
2013
  "merged_to_main",
1761
2014
  "pushed_feature_branch_needs_merge",
@@ -1822,6 +2075,7 @@ var SEND_REFUSAL_REASONS = [
1822
2075
  "no_target",
1823
2076
  "bootstrap_pending",
1824
2077
  "duplicate_dispatch",
2078
+ "new_work_held",
1825
2079
  "internal_error"
1826
2080
  ];
1827
2081
  function isSendRefusal(value) {
@@ -1853,6 +2107,14 @@ function isOutboundMessage(value) {
1853
2107
  const candidate = value;
1854
2108
  return isMessageId(candidate.messageId) && typeof candidate.sessionId === "string" && candidate.sessionId.length > 0 && isInputEnvelopeWire(candidate.input) && isOutboundMessageOrigin(candidate.origin) && isSendPolicy(candidate.policy) && typeof candidate.createdAt === "number";
1855
2109
  }
2110
+ var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2111
+ var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
2112
+ function unwrapPastedContent(text) {
2113
+ const lines = text.replace(/\r\n?/g, "\n").split("\n");
2114
+ const first = lines.findIndex((line) => line.trim());
2115
+ if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
2116
+ return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
2117
+ }
1856
2118
 
1857
2119
  // src/mission-brief.ts
1858
2120
  var GOAL_MAX = 500;
@@ -1938,13 +2200,39 @@ var WORKER_TOOLS = [
1938
2200
  "peer_context_pull",
1939
2201
  "git_status",
1940
2202
  "git_log",
1941
- "git_diff"
2203
+ "git_diff",
2204
+ "driver_list",
2205
+ "driver_describe",
2206
+ "driver_invoke",
2207
+ "driver_scaffold",
2208
+ "driver_validate",
2209
+ "driver_export",
2210
+ "driver_install",
2211
+ "artifact_register",
2212
+ "artifact_list",
2213
+ "artifact_read",
2214
+ // Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
2215
+ // read claim (C1) and the authoritative head/notice pull.
2216
+ "contract_read",
2217
+ "contract_observe",
2218
+ "contract_current"
1942
2219
  ];
1943
2220
  var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
1944
2221
  function isWorkerTool(value) {
1945
2222
  return typeof value === "string" && WORKER_TOOL_SET.has(value);
1946
2223
  }
1947
2224
  var WORKER_PROTOCOL_FOOTER_MARKER = "--- adhdev worker protocol ---";
2225
+ function renderLightWorkspaceRules(light) {
2226
+ const base = light.ossBaseSha ? `${light.baseSha} (oss ${light.ossBaseSha})` : light.baseSha;
2227
+ return [
2228
+ `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.`,
2229
+ "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`.",
2230
+ "Do not start long-running servers on fixed ports. Run the narrowest tests that cover your change and list them in `report_completion.testsRun`.",
2231
+ 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."
2232
+ ];
2233
+ }
2234
+ 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.";
2235
+ var WORKER_SHELL_LITERAL_PATHS_RULE = "In shell commands, write file and directory paths literally (absolute, or relative to your workspace) instead of through shell variables (`N=dir; cat $N/x`) or `$(...)` substitutions, and keep to one simple command per call, so the command can be checked before it runs. This does not change what you are allowed to run or read.";
1948
2236
  function hasWorkerProtocolFooter(body) {
1949
2237
  return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
1950
2238
  }
@@ -1966,6 +2254,9 @@ function renderWorkerProtocolFooter(input = {}) {
1966
2254
  if (input.readonly) scope.push("read-only");
1967
2255
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
1968
2256
  else lines.push("You are a delegated worker.");
2257
+ if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
2258
+ else if (input.commitOnCurrentBranch && input.stage?.role !== "review") lines.push(WORKER_CURRENT_BRANCH_RULE);
2259
+ lines.push(WORKER_SHELL_LITERAL_PATHS_RULE);
1969
2260
  if (input.workerMcp === false) {
1970
2261
  lines.push(
1971
2262
  "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.",
@@ -1985,15 +2276,30 @@ function renderWorkerProtocolFooter(input = {}) {
1985
2276
  "Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
1986
2277
  "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`.",
1987
2278
  "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 `[]`.",
1988
- "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."
2279
+ "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.",
2280
+ "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.",
2281
+ "`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."
1989
2282
  );
1990
2283
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
1991
2284
  lines.push(
1992
2285
  `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.`
1993
2286
  );
1994
2287
  }
2288
+ if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
1995
2289
  return lines.join("\n");
1996
2290
  }
2291
+ function renderStageProtocolLines(stage) {
2292
+ if (stage.role === "review") {
2293
+ return [
2294
+ `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.") + " Do not write any file for the review, not even a report: a new or changed file in the reviewed checkout fails the review as reviewer_mutated_source, and `artifact_register` refuses files outside the workspace. Put every finding in the `review` field of `report_completion` \u2014 that is the review record.",
2295
+ "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."
2296
+ ];
2297
+ }
2298
+ return [
2299
+ `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. When your change is committed, report outcome \`completed\` \u2014 the review starts only after that report, so never report \`blocked\` because the review has not run yet. You may receive review findings as a follow-up memo in this same session.`,
2300
+ ...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."] : []
2301
+ ];
2302
+ }
1997
2303
  function stripWorkerProtocolFooter(body) {
1998
2304
  if (typeof body !== "string") return body;
1999
2305
  const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
@@ -2023,15 +2329,30 @@ function renderCoordinatorWorkerSection() {
2023
2329
  // src/assistant-protocol.ts
2024
2330
  var ASSISTANT_TOOLS = [
2025
2331
  "projects",
2332
+ "environment",
2333
+ "assistant_action",
2334
+ "project_watch",
2026
2335
  "project_status",
2027
2336
  "project_send",
2028
2337
  "project_read",
2029
2338
  "project_add",
2339
+ "project_attach_remote",
2030
2340
  "discover_repos",
2031
2341
  "memory",
2342
+ "memory_search",
2032
2343
  "skill_view",
2033
2344
  "skill_manage",
2034
- "project_note"
2345
+ "project_note",
2346
+ "launch_defaults",
2347
+ "launch_defaults_set",
2348
+ "driver_list",
2349
+ "driver_describe",
2350
+ "artifact_list",
2351
+ "artifact_read",
2352
+ "decision_answer",
2353
+ "decision_request",
2354
+ "session_control",
2355
+ "file_transfer"
2035
2356
  ];
2036
2357
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
2037
2358
  function isAssistantTool(value) {
@@ -2039,50 +2360,170 @@ function isAssistantTool(value) {
2039
2360
  }
2040
2361
  var ASSISTANT_VERB = {
2041
2362
  // tool verbs
2363
+ driverList: "driver_list",
2364
+ driverDescribe: "driver_describe",
2042
2365
  projects: "assistant_projects",
2366
+ environment: "assistant_environment",
2367
+ action: "assistant_action",
2368
+ watch: "assistant_project_watch",
2369
+ executionState: "assistant_execution_state",
2370
+ executionSettings: "assistant_execution_settings",
2043
2371
  projectStatus: "assistant_project_status",
2044
2372
  projectSend: "assistant_project_send",
2045
2373
  projectRead: "assistant_project_read",
2046
2374
  projectAdd: "assistant_project_add",
2375
+ projectAttachRemote: "assistant_project_attach_remote",
2047
2376
  discoverRepos: "assistant_discover_repos",
2048
2377
  memory: "assistant_memory",
2378
+ /** Pull-only FTS search over the archive tier (memory design 2026-11-01 §3.4). */
2379
+ memorySearch: "assistant_memory_search",
2049
2380
  skillView: "assistant_skill_view",
2050
2381
  skillManage: "assistant_skill_manage",
2051
2382
  projectNote: "assistant_project_note",
2383
+ launchDefaults: "assistant_launch_defaults",
2384
+ launchDefaultsSet: "assistant_launch_defaults_set",
2385
+ artifactList: "assistant_artifact_list",
2386
+ artifactRead: "assistant_artifact_read",
2387
+ /** Owner-decision inbox (structured-missions design 2026-10-28 §6.3): the owner's words recorded as answers. */
2388
+ decisionAnswer: "assistant_decision_answer",
2389
+ /** Register a plain-text question a coordinator put to the owner as a decision item (§5.2). */
2390
+ decisionRequest: "assistant_decision_request",
2391
+ /** Stop / restart / switch the provider of a coordinator, worker or the assistant session (handoff design 2026-11-01 §4). */
2392
+ sessionControl: "assistant_session_control",
2393
+ /** Request / status / cancel the assistant's own project file transfers (owner approves in the dashboard; file-transfer design section 6). */
2394
+ fileTransfer: "assistant_file_transfer",
2052
2395
  // assistant-side daemon verbs without a tool of the same name
2053
2396
  launch: "launch_assistant",
2054
2397
  pendingRelays: "assistant_pending_relays",
2055
2398
  // owner verbs (dashboard only)
2056
2399
  stagedResolve: "assistant_staged_resolve",
2057
2400
  storeAdmin: "assistant_store_admin",
2058
- importSkills: "assistant_import_skills"
2401
+ importSkills: "assistant_import_skills",
2402
+ /** Owner skill list (attach/view counts, save proposals, recent skill metrics); reads move no counter. */
2403
+ skillsList: "assistant_skills_list",
2404
+ /** Owner: what the assistant remembered recently, with undo handles (memory design §3.2). */
2405
+ memoryDigest: "assistant_memory_digest",
2406
+ /** Owner: reverse one remembered write or one batch (memory design §3.2). Never an assistant tool. */
2407
+ memoryUndo: "assistant_memory_undo",
2408
+ /** Projects the assistant is following (open relay threads) — list / stop following. */
2409
+ threads: "assistant_threads",
2410
+ threadClose: "assistant_thread_close"
2059
2411
  };
2060
2412
  var ASSISTANT_TOOL_VERBS = {
2413
+ driver_list: ASSISTANT_VERB.driverList,
2414
+ driver_describe: ASSISTANT_VERB.driverDescribe,
2061
2415
  projects: ASSISTANT_VERB.projects,
2416
+ environment: ASSISTANT_VERB.environment,
2417
+ assistant_action: ASSISTANT_VERB.action,
2418
+ project_watch: ASSISTANT_VERB.watch,
2062
2419
  project_status: ASSISTANT_VERB.projectStatus,
2063
2420
  project_send: ASSISTANT_VERB.projectSend,
2064
2421
  project_read: ASSISTANT_VERB.projectRead,
2065
2422
  project_add: ASSISTANT_VERB.projectAdd,
2423
+ project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
2066
2424
  discover_repos: ASSISTANT_VERB.discoverRepos,
2067
2425
  memory: ASSISTANT_VERB.memory,
2426
+ memory_search: ASSISTANT_VERB.memorySearch,
2068
2427
  skill_view: ASSISTANT_VERB.skillView,
2069
2428
  skill_manage: ASSISTANT_VERB.skillManage,
2070
- project_note: ASSISTANT_VERB.projectNote
2429
+ project_note: ASSISTANT_VERB.projectNote,
2430
+ launch_defaults: ASSISTANT_VERB.launchDefaults,
2431
+ launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
2432
+ artifact_list: ASSISTANT_VERB.artifactList,
2433
+ artifact_read: ASSISTANT_VERB.artifactRead,
2434
+ decision_answer: ASSISTANT_VERB.decisionAnswer,
2435
+ decision_request: ASSISTANT_VERB.decisionRequest,
2436
+ session_control: ASSISTANT_VERB.sessionControl,
2437
+ file_transfer: ASSISTANT_VERB.fileTransfer
2071
2438
  };
2072
- var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
2439
+ 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"];
2073
2440
  var ASSISTANT_OWNER_VERBS = [
2441
+ ASSISTANT_VERB.executionSettings,
2074
2442
  ASSISTANT_VERB.stagedResolve,
2075
2443
  ASSISTANT_VERB.storeAdmin,
2076
- ASSISTANT_VERB.importSkills
2444
+ ASSISTANT_VERB.importSkills,
2445
+ ASSISTANT_VERB.skillsList,
2446
+ ASSISTANT_VERB.memoryDigest,
2447
+ ASSISTANT_VERB.memoryUndo,
2448
+ ASSISTANT_VERB.threadClose
2077
2449
  ];
2078
2450
  var ASSISTANT_REVIEW_TURN_VERBS = [
2079
2451
  ASSISTANT_VERB.memory,
2452
+ ASSISTANT_VERB.memorySearch,
2080
2453
  ASSISTANT_VERB.skillView,
2081
2454
  ASSISTANT_VERB.skillManage,
2082
2455
  ASSISTANT_VERB.projectNote
2083
2456
  ];
2084
2457
  var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
2085
2458
  var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
2459
+ var ASSISTANT_ACCOUNT_SLOT = "personal";
2460
+ var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
2461
+ var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
2462
+ var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
2463
+ var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
2464
+ var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read", "decision_list", "decision_answer", "decision_request"];
2465
+ var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
2466
+ function isAssistantFollowerAllowedOp(value) {
2467
+ return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
2468
+ }
2469
+ var DECISION_OP_IMPLIED_BY = {
2470
+ decision_list: "status",
2471
+ decision_answer: "send",
2472
+ decision_request: "send"
2473
+ };
2474
+ function followerOpPermitted(op, allowedOps) {
2475
+ if (!isAssistantFollowerAllowedOp(op)) return false;
2476
+ if (allowedOps.includes(op)) return true;
2477
+ const implied = DECISION_OP_IMPLIED_BY[op];
2478
+ return implied !== void 0 && allowedOps.includes(implied);
2479
+ }
2480
+ function followedRemoteProjectKey(hostDaemonId, meshId) {
2481
+ const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
2482
+ return `${canonHost}::${meshId.trim()}`;
2483
+ }
2484
+ function sanitizeRemoteRepoIdentity(raw) {
2485
+ if (typeof raw !== "string") return null;
2486
+ const trimmed = raw.trim();
2487
+ if (!trimmed) return null;
2488
+ if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
2489
+ return null;
2490
+ }
2491
+ const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
2492
+ if (!withoutQuery) return null;
2493
+ let host = "";
2494
+ let repoPath = "";
2495
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
2496
+ try {
2497
+ const url = new URL(withoutQuery);
2498
+ if (url.protocol === "file:") return null;
2499
+ host = url.hostname.toLowerCase();
2500
+ repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2501
+ } catch {
2502
+ return null;
2503
+ }
2504
+ } else {
2505
+ const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
2506
+ if (scpMatch) {
2507
+ host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
2508
+ repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2509
+ } else {
2510
+ const slash = withoutQuery.indexOf("/");
2511
+ if (slash > 0) {
2512
+ const rawHost = withoutQuery.slice(0, slash);
2513
+ const atIdx = rawHost.lastIndexOf("@");
2514
+ host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
2515
+ repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
2516
+ }
2517
+ }
2518
+ }
2519
+ if (!host || !repoPath) return null;
2520
+ if (!host.includes(".") && host !== "localhost") return null;
2521
+ if (/[\s@:\\]/.test(host)) return null;
2522
+ const segments = repoPath.split("/").filter(Boolean);
2523
+ if (segments.length === 0) return null;
2524
+ if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
2525
+ return `${host}/${segments.join("/")}`.slice(0, 200);
2526
+ }
2086
2527
 
2087
2528
  // src/turn-evidence.ts
2088
2529
  var MESH_TOPIC_PROTOCOL_VERSION = 2;
@@ -2118,18 +2559,29 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
2118
2559
  var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
2119
2560
  var DELIVERY_OUTCOMES = ["delivered", "queued"];
2120
2561
  var DELIVERY_VIAS = ["local", "p2p"];
2121
- var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout"];
2562
+ var DISPATCH_FAILURE_REASONS = ["worker_absent", "transport_error", "spawn_failed", "rejected_by_worker", "timeout", "submit_unconfirmed"];
2122
2563
  function sanitizeRefusalCode(value) {
2123
2564
  if (typeof value !== "string") return void 0;
2124
2565
  const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
2125
2566
  if (!normalized) return void 0;
2126
2567
  return normalized.slice(0, 64);
2127
2568
  }
2569
+ var DISPATCH_REFUSAL_DETAIL_MAX = 200;
2570
+ function sanitizeDispatchRefusalDetail(code, message) {
2571
+ const cleanCode = sanitizeRefusalCode(code);
2572
+ let cleanMessage;
2573
+ if (typeof message === "string") {
2574
+ const line = message.replace(/(?:[A-Za-z]:)?[\\/](?:Users|home)[\\/][^\s\\/]+/g, "~").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
2575
+ if (line) cleanMessage = line.length > DISPATCH_REFUSAL_DETAIL_MAX ? `${line.slice(0, DISPATCH_REFUSAL_DETAIL_MAX - 1)}\u2026` : line;
2576
+ }
2577
+ if (!cleanCode && !cleanMessage) return void 0;
2578
+ return { ...cleanCode ? { code: cleanCode } : {}, ...cleanMessage ? { message: cleanMessage } : {} };
2579
+ }
2128
2580
  var CONSUME_PROFILES = ["default", "native_source"];
2129
2581
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2130
2582
  var SUSPENSION_MODALS = ["approval", "choice"];
2131
- var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
2132
- var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
2583
+ var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
2584
+ var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
2133
2585
  var TURN_END_STRENGTHS = ["genuine", "weak"];
2134
2586
  var TURN_END_BLOCK_REASONS = [
2135
2587
  "missing_final_assistant",
@@ -2137,9 +2589,9 @@ var TURN_END_BLOCK_REASONS = [
2137
2589
  "terminal_block_hard_cap",
2138
2590
  "decoupled_completion"
2139
2591
  ];
2140
- var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
2592
+ var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
2141
2593
  var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
2142
- var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
2594
+ var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
2143
2595
  var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
2144
2596
  var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
2145
2597
  var OPERATOR_STATUSES = ["completed", "failed"];
@@ -2166,9 +2618,10 @@ var HOLD_REASONS = [
2166
2618
  // — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
2167
2619
  // a session whose FSM never shows the idle edge again does not wait for
2168
2620
  // liveness / hard_ceiling.
2169
- "await_end"
2621
+ "await_end",
2622
+ "report_correction"
2170
2623
  ];
2171
- var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2624
+ var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
2172
2625
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
2173
2626
  var TURN_REASONS = [
2174
2627
  // commits
@@ -2177,9 +2630,15 @@ var TURN_REASONS = [
2177
2630
  "transcript_final",
2178
2631
  "worker_reported",
2179
2632
  "finalization_timeout_no_response",
2633
+ "weak_end_liveness_unconfirmed",
2634
+ "weak_end_probe_unobserved",
2635
+ "report_correction_expired",
2180
2636
  "session_error",
2181
2637
  "provider_auth_failed",
2182
2638
  "provider_billing_failed",
2639
+ "provider_usage_limit_exceeded",
2640
+ "provider_server_overloaded",
2641
+ "provider_error",
2183
2642
  "operator_cancel",
2184
2643
  "intentional_cleanup",
2185
2644
  "task_removed",
@@ -2192,6 +2651,8 @@ var TURN_REASONS = [
2192
2651
  "reclaim_budget_exhausted",
2193
2652
  "hollow_max_retries",
2194
2653
  "migration_orphan",
2654
+ // a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
2655
+ "writer_unreachable",
2195
2656
  // reclaims (generation + 1)
2196
2657
  "dispatch_refused_session_exited",
2197
2658
  "dispatch_refused_no_target",
@@ -2207,6 +2668,7 @@ var TURN_REASONS = [
2207
2668
  ];
2208
2669
  var NOTIFY_KINDS = [
2209
2670
  "completed",
2671
+ "blocked",
2210
2672
  "failed",
2211
2673
  "cancelled",
2212
2674
  "stopped",
@@ -2256,8 +2718,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2256
2718
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
2257
2719
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
2258
2720
  turn_started: { retro: bool },
2259
- suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
2260
- suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
2721
+ suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
2722
+ suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
2261
2723
  turn_end: {
2262
2724
  strength: en(TURN_END_STRENGTHS),
2263
2725
  afterFinalizationTimeout: boolOpt,
@@ -2267,6 +2729,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2267
2729
  releasedByHardCap: boolOpt,
2268
2730
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
2269
2731
  live: { t: "live", optional: true },
2732
+ nativeMarker: { t: "native_marker", optional: true },
2270
2733
  reportExpected: boolOpt,
2271
2734
  providerFailure: enOpt(PROVIDER_FAILURES)
2272
2735
  },
@@ -2280,7 +2743,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2280
2743
  },
2281
2744
  transcript_activity: { newestActivityAt: ms },
2282
2745
  no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
2283
- liveness: { result: en(LIVENESS_RESULTS) },
2746
+ liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
2284
2747
  process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
2285
2748
  session_error: { reason: en(SESSION_ERROR_REASONS) },
2286
2749
  worker_report: {
@@ -2290,6 +2753,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2290
2753
  branchState: enOpt(WORKER_BRANCH_STATES),
2291
2754
  touchedFileCount: intOpt
2292
2755
  },
2756
+ worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
2293
2757
  worker_progress: { note: { t: "summary_ref", optional: true } },
2294
2758
  git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
2295
2759
  cancel: { reason: en(CANCEL_REASONS) },
@@ -2337,7 +2801,7 @@ function isLiveTurnPending(value) {
2337
2801
  return isRecord2(value) && hasOnlyKeys(value, ["modal", "adapterPending", "trailingTool", "newestActivityAt"]) && typeof value.modal === "boolean" && typeof value.adapterPending === "boolean" && typeof value.trailingTool === "boolean" && (value.newestActivityAt === void 0 || isFiniteNumber2(value.newestActivityAt));
2338
2802
  }
2339
2803
  function isNativeMarkerRef(value) {
2340
- return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
2804
+ return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId", "receivedAt", "startedAt", "errorAt"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId)) && ["receivedAt", "startedAt", "errorAt"].every((key) => value[key] === void 0 || isFiniteNumber2(value[key]));
2341
2805
  }
2342
2806
  function isCoordinatorIdentity(value) {
2343
2807
  return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
@@ -2460,17 +2924,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
2460
2924
  };
2461
2925
  }
2462
2926
 
2927
+ // src/launch-defaults.ts
2928
+ var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
2929
+ var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
2930
+ var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
2931
+ function isLaunchDefaultRole(value) {
2932
+ return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
2933
+ }
2934
+ function isLaunchDefaultSource(value) {
2935
+ return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
2936
+ }
2937
+ var LAUNCH_DEFAULT_ERROR_CODES = [
2938
+ "invalid_args",
2939
+ "launch_default_required",
2940
+ "launch_default_unavailable",
2941
+ "launch_selection_invalid",
2942
+ "launch_default_invalid",
2943
+ "revision_conflict",
2944
+ "store_unavailable",
2945
+ "store_busy",
2946
+ "persistence_failed",
2947
+ "project_not_found",
2948
+ "project_ambiguous",
2949
+ "project_not_hosted",
2950
+ "project_storage_unavailable",
2951
+ "staging_unavailable",
2952
+ "staging_failed",
2953
+ "review_turn_tool_denied"
2954
+ ];
2955
+
2956
+ // src/role-launch.ts
2957
+ function record(value) {
2958
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2959
+ }
2960
+ function ref(value) {
2961
+ const r = record(value);
2962
+ 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;
2963
+ return {
2964
+ role: r.role,
2965
+ scope: r.scope,
2966
+ revision: r.revision,
2967
+ ...r.scope === "project" ? { projectId: r.projectId } : {}
2968
+ };
2969
+ }
2970
+ function axis(value) {
2971
+ const a = record(value);
2972
+ if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
2973
+ const defaultRef = ref(a.defaultRef);
2974
+ 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;
2975
+ return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
2976
+ }
2977
+ function parseRoleLaunchSelection(value) {
2978
+ const r = record(value), s = record(r?.selection), a = record(r?.applied);
2979
+ 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;
2980
+ const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
2981
+ 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;
2982
+ const defaultRef = ref(r.defaultRef);
2983
+ return {
2984
+ role: r.role,
2985
+ selection: {
2986
+ provider: s.provider,
2987
+ ...typeof s.model === "string" ? { model: s.model } : {},
2988
+ ...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
2989
+ },
2990
+ applied: { provider, model, thinkingLevel },
2991
+ ...defaultRef ? { defaultRef } : {},
2992
+ documentRevision: r.documentRevision
2993
+ };
2994
+ }
2995
+
2463
2996
  // src/session-launch.ts
2464
2997
  var MODEL_AXIS_SOURCES = [
2465
2998
  /** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
2466
2999
  "user",
2467
3000
  /** The dashboard dialog restored it from the last launch (browser-local memory). */
2468
3001
  "remembered",
3002
+ /** The authoritative daemon role default or host project override. */
3003
+ "stored_default",
3004
+ "project_default",
2469
3005
  /** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
2470
3006
  "mesh_slot",
2471
3007
  /** An explicit per-task model / thinking level on a mesh queue task. */
2472
3008
  "task_override",
2473
- /** Nothing was requested; the provider's default is known (discovery / manifest). */
3009
+ /** Nothing requested: the provider chooses; resolvedDefault records it when known. */
2474
3010
  "provider_default",
2475
3011
  /** A value was requested without saying where it came from, or nothing is known. */
2476
3012
  "unspecified"
@@ -2514,10 +3050,10 @@ function readFiniteNumber(value) {
2514
3050
  }
2515
3051
  function parseModelSelection(raw) {
2516
3052
  if (!raw || typeof raw !== "object") return void 0;
2517
- const record = raw;
3053
+ const record2 = raw;
2518
3054
  const history = [];
2519
- if (Array.isArray(record.history)) {
2520
- for (const entry of record.history) {
3055
+ if (Array.isArray(record2.history)) {
3056
+ for (const entry of record2.history) {
2521
3057
  if (!entry || typeof entry !== "object") continue;
2522
3058
  const e = entry;
2523
3059
  const value = readString(e.value);
@@ -2526,41 +3062,45 @@ function parseModelSelection(raw) {
2526
3062
  if (value && at !== void 0 && via) history.push({ at, value, via });
2527
3063
  }
2528
3064
  }
2529
- const requested = readString(record.requested);
2530
- const launchValue = readString(record.launchValue);
2531
- const resolvedDefault = readString(record.resolvedDefault);
2532
- const current = readString(record.current);
2533
- const observed = readString(record.observed);
2534
- const observedAt = readFiniteNumber(record.observedAt);
3065
+ const requested = readString(record2.requested);
3066
+ const launchValue = readString(record2.launchValue);
3067
+ const resolvedDefault = readString(record2.resolvedDefault);
3068
+ const current = readString(record2.current);
3069
+ const observed = readString(record2.observed);
3070
+ const observedAt = readFiniteNumber(record2.observedAt);
3071
+ const fallback = record2.fallback === true;
2535
3072
  return {
2536
- source: isModelAxisSource(record.source) ? record.source : "unspecified",
3073
+ source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
2537
3074
  ...requested ? { requested } : {},
2538
3075
  ...launchValue ? { launchValue } : {},
2539
3076
  ...resolvedDefault ? { resolvedDefault } : {},
2540
3077
  ...current ? { current } : {},
2541
3078
  ...observed ? { observed } : {},
2542
3079
  ...observedAt !== void 0 ? { observedAt } : {},
3080
+ ...fallback ? { fallback } : {},
2543
3081
  history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
2544
3082
  };
2545
3083
  }
2546
3084
  function parseSessionLaunchRecord(raw) {
2547
3085
  if (!raw || typeof raw !== "object") return void 0;
2548
- const record = raw;
2549
- const sessionId = readString(record.sessionId);
2550
- const providerType = readString(record.providerType);
2551
- const launchedAt = readFiniteNumber(record.launchedAt);
2552
- const model = parseModelSelection(record.model);
2553
- const thinkingLevel = parseModelSelection(record.thinkingLevel);
3086
+ const record2 = raw;
3087
+ const sessionId = readString(record2.sessionId);
3088
+ const providerType = readString(record2.providerType);
3089
+ const launchedAt = readFiniteNumber(record2.launchedAt);
3090
+ const model = parseModelSelection(record2.model);
3091
+ const thinkingLevel = parseModelSelection(record2.thinkingLevel);
2554
3092
  if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
2555
- const providerVersion = readString(record.providerVersion);
2556
- const workspace = readString(record.workspace);
2557
- const autoApproveModeId = readString(record.autoApproveModeId);
3093
+ const providerVersion = readString(record2.providerVersion);
3094
+ const workspace = readString(record2.workspace);
3095
+ const autoApproveModeId = readString(record2.autoApproveModeId);
3096
+ const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
2558
3097
  return {
3098
+ ...roleLaunch ? { roleLaunch } : {},
2559
3099
  sessionId,
2560
3100
  providerType,
2561
3101
  ...providerVersion ? { providerVersion } : {},
2562
- ...record.providerChannel === "stable" || record.providerChannel === "preview" ? { providerChannel: record.providerChannel } : {},
2563
- launchedBy: isSessionLaunchedBy(record.launchedBy) ? record.launchedBy : "api",
3102
+ ...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
3103
+ launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
2564
3104
  launchedAt,
2565
3105
  ...workspace ? { workspace } : {},
2566
3106
  model,
@@ -2624,7 +3164,7 @@ function isTurnAttemptRefValue(value) {
2624
3164
  function isTurnObserveResponse(value) {
2625
3165
  return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
2626
3166
  }
2627
- var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
3167
+ var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
2628
3168
  function isTurnOutcomeValue(value) {
2629
3169
  return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
2630
3170
  }
@@ -2850,8 +3390,23 @@ function isMissionBriefWire(value) {
2850
3390
  }
2851
3391
  return true;
2852
3392
  }
3393
+ var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
3394
+ function isOpenItemCountsWire(value) {
3395
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
3396
+ return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
3397
+ }
3398
+ function isStructuredMissionFields(value) {
3399
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3400
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3401
+ }
3402
+ if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
3403
+ if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
3404
+ if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
3405
+ return true;
3406
+ }
2853
3407
  function isMeshMissionRecordWire(value) {
2854
- if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
3408
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
3409
+ if (!isStructuredMissionFields(value)) return false;
2855
3410
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
2856
3411
  if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
2857
3412
  if (!isMeshMissionStatusValue(value.status)) return false;
@@ -2859,11 +3414,22 @@ function isMeshMissionRecordWire(value) {
2859
3414
  return true;
2860
3415
  }
2861
3416
  function isMissionUpsertRequest(value) {
2862
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
3417
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
2863
3418
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2864
3419
  if (!isEvidenceIdentifier(value.meshId)) return false;
2865
3420
  if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
2866
- if (typeof value.title !== "string" || value.title.trim().length === 0) return false;
3421
+ if (typeof value.title !== "string") return false;
3422
+ if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
3423
+ if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
3424
+ if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
3425
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3426
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3427
+ }
3428
+ if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
3429
+ for (const k of ["itemsAdd", "itemsUpdate"]) {
3430
+ const list = value[k];
3431
+ if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
3432
+ }
2867
3433
  if (value.goal !== void 0 && typeof value.goal !== "string") return false;
2868
3434
  if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
2869
3435
  if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
@@ -2873,7 +3439,7 @@ function decodeMissionUpsertRequest(value) {
2873
3439
  return isMissionUpsertRequest(value) ? value : null;
2874
3440
  }
2875
3441
  function isMissionUpsertResponse(value) {
2876
- return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
3442
+ return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
2877
3443
  }
2878
3444
  function decodeMissionUpsertResponse(value) {
2879
3445
  return isMissionUpsertResponse(value) ? value : null;
@@ -2899,7 +3465,10 @@ function decodeMissionQueryResponse(value) {
2899
3465
  return isMissionQueryResponse(value) ? value : null;
2900
3466
  }
2901
3467
  function isMissionListQueryRequest(value) {
2902
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
3468
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
3469
+ for (const k of ["structured", "items", "history"]) {
3470
+ if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
3471
+ }
2903
3472
  if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
2904
3473
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2905
3474
  if (!isEvidenceIdentifier(value.meshId)) return false;
@@ -2925,12 +3494,13 @@ function isMeshMissionTaskAggregateWire(value) {
2925
3494
  return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
2926
3495
  }
2927
3496
  function isMeshMissionStatsWire(value) {
2928
- const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
3497
+ const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
2929
3498
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
2930
3499
  if (!isEvidenceIdentifier(value.missionId)) return false;
2931
3500
  for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
2932
3501
  if (!isNonNegativeInt(value[k])) return false;
2933
3502
  }
3503
+ if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
2934
3504
  if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
2935
3505
  if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
2936
3506
  return true;
@@ -2940,7 +3510,7 @@ function isMissionListSummaryWire(value) {
2940
3510
  const hasGoal = "goal" in value;
2941
3511
  const hasPreview = "goalPreview" in value && "goalTruncated" in value;
2942
3512
  if (hasGoal === hasPreview) return false;
2943
- const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
3513
+ const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
2944
3514
  const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
2945
3515
  if (!hasOnlyKeys2(value, allowed)) return false;
2946
3516
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
@@ -2954,6 +3524,10 @@ function isMissionListSummaryWire(value) {
2954
3524
  if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
2955
3525
  if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
2956
3526
  if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
3527
+ if (!isStructuredMissionFields(value)) return false;
3528
+ for (const k of ["items", "history"]) {
3529
+ if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
3530
+ }
2957
3531
  return true;
2958
3532
  }
2959
3533
  function isMeshMissionHistoryFoldWire(value) {
@@ -3052,12 +3626,15 @@ function isLedgerQueryEntryWire(value) {
3052
3626
  return true;
3053
3627
  }
3054
3628
  function isLedgerQuerySummaryWire(value) {
3055
- const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
3629
+ const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed", "recentRefineFailures"];
3056
3630
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
3057
3631
  if (!isEvidenceIdentifier(value.meshId)) return false;
3058
3632
  for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
3059
3633
  if (!isNonNegativeInt(value[k])) return false;
3060
3634
  }
3635
+ if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
3636
+ if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
3637
+ if (value.recentRefineFailures !== void 0 && !isNonNegativeInt(value.recentRefineFailures)) return false;
3061
3638
  if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
3062
3639
  return true;
3063
3640
  }
@@ -3101,9 +3678,10 @@ function isQueueDependencyHeadWire(value) {
3101
3678
  return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
3102
3679
  }
3103
3680
  function isQueueQueryResponse(value) {
3104
- if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
3681
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
3105
3682
  if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
3106
3683
  if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
3684
+ if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
3107
3685
  if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
3108
3686
  if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
3109
3687
  return true;
@@ -3161,7 +3739,7 @@ function decodeQueueRequeueRequest(value) {
3161
3739
  return isQueueRequeueRequest(value) ? value : null;
3162
3740
  }
3163
3741
  function isQueueRequeueResponse(value) {
3164
- return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
3742
+ 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");
3165
3743
  }
3166
3744
  function decodeQueueRequeueResponse(value) {
3167
3745
  return isQueueRequeueResponse(value) ? value : null;
@@ -3225,6 +3803,24 @@ function isRecoveryContextQueryResponse(value) {
3225
3803
  function decodeRecoveryContextQueryResponse(value) {
3226
3804
  return isRecoveryContextQueryResponse(value) ? value : null;
3227
3805
  }
3806
+ function decodeQueueReviseRequest(value) {
3807
+ 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;
3808
+ if (value.dryRun !== void 0 && typeof value.dryRun !== "boolean") return null;
3809
+ if (value.deferScheduling !== void 0 && typeof value.deferScheduling !== "boolean") return null;
3810
+ const p = value.patch;
3811
+ if (p.requestQuotaOverride && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
3812
+ if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
3813
+ if (p.attestActiveOwnership && value.deferScheduling !== void 0) return null;
3814
+ if (p.attestActiveOwnership !== void 0 && (p.attestActiveOwnership !== true || Object.keys(p).length !== 1)) return null;
3815
+ if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
3816
+ if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
3817
+ if (p.difficulty !== void 0 && p.difficulty !== "easy" && p.difficulty !== "medium" && p.difficulty !== "difficult" && p.difficulty !== "freeform") return null;
3818
+ for (const key of ["ownedPaths", "dependsOn"]) {
3819
+ if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
3820
+ }
3821
+ return value;
3822
+ }
3823
+ var decodeQueueReviseResponse = decodeQueueRequeueResponse;
3228
3824
 
3229
3825
  // src/turn-ipc-stats.ts
3230
3826
  function isTaskStatsQueryRequest(value) {
@@ -3323,6 +3919,7 @@ var TURN_IPC_COMMANDS = [
3323
3919
  "queue_enqueue_batch",
3324
3920
  "queue_cancel",
3325
3921
  "queue_requeue",
3922
+ "queue_revise",
3326
3923
  "direct_dispatch_record",
3327
3924
  "active_work_query",
3328
3925
  "recovery_context_query",
@@ -3406,14 +4003,11 @@ function normalizeOwnedPaths(input) {
3406
4003
  }
3407
4004
  function entryContains(base, path) {
3408
4005
  if (path === base.path) return true;
3409
- if (base.subtree && (path === base.path || path.startsWith(`${base.path}/`))) return true;
4006
+ if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
3410
4007
  return false;
3411
4008
  }
3412
4009
  function entriesOverlap(a, b) {
3413
- if (a.path === b.path) return true;
3414
- if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
3415
- if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
3416
- return false;
4010
+ return entryContains(a, b.path) || entryContains(b, a.path);
3417
4011
  }
3418
4012
  function pathsOverlap(a, b) {
3419
4013
  if (a.paths.length === 0 || b.paths.length === 0) return false;
@@ -3465,6 +4059,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
3465
4059
  return { undeclaredTouched, unusedDeclarations };
3466
4060
  }
3467
4061
 
4062
+ // src/mission-items.ts
4063
+ var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
4064
+ var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
4065
+ var COORDINATOR_SETTABLE_ITEM_STATES = {
4066
+ remaining: ["open", "done", "dropped"],
4067
+ live_check: ["open", "done", "dropped"],
4068
+ evidence: ["open", "done", "dropped"],
4069
+ decision: ["open", "withdrawn", "superseded"]
4070
+ };
4071
+ var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
4072
+ function isMissionOutcome(value) {
4073
+ return typeof value === "string" && MISSION_OUTCOMES.includes(value);
4074
+ }
4075
+ var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
4076
+ var MISSION_LIMITS = {
4077
+ summary: 300,
4078
+ outcomeReason: 500,
4079
+ itemText: 300,
4080
+ machine: 80,
4081
+ refs: 8,
4082
+ refValue: 300,
4083
+ refRepo: 120,
4084
+ refNote: 200,
4085
+ dedupeKey: 400,
4086
+ question: 300,
4087
+ context: 600,
4088
+ options: 5,
4089
+ optionLabel: 60,
4090
+ optionDetail: 200,
4091
+ /** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
4092
+ openItemsPerMission: 200,
4093
+ /** One event payload (serialized). */
4094
+ eventPayloadBytes: 16 * 1024,
4095
+ /** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
4096
+ itemsPerCall: 50
4097
+ };
4098
+ var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
4099
+ var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
4100
+ var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
4101
+ function truncateMissionText(value, max) {
4102
+ if (value.length <= max) return value;
4103
+ return `${value.slice(0, max - 1).trimEnd()}\u2026`;
4104
+ }
4105
+ function str(value) {
4106
+ return typeof value === "string" ? value.trim() : "";
4107
+ }
4108
+ function collapse(value) {
4109
+ return value.replace(/\s+/g, " ").trim();
4110
+ }
4111
+ function normalizeMissionSummary(value) {
4112
+ if (typeof value !== "string") return null;
4113
+ const text = collapse(value);
4114
+ return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
4115
+ }
4116
+ function normalizeOutcomeReason(value) {
4117
+ if (typeof value !== "string") return null;
4118
+ const text = value.trim();
4119
+ return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
4120
+ }
4121
+ function normalizeMissionRefs(value) {
4122
+ if (!Array.isArray(value)) return { refs: [], truncated: false };
4123
+ const refs = [];
4124
+ let truncated = false;
4125
+ for (const raw of value) {
4126
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4127
+ const r = raw;
4128
+ const kind = str(r.kind);
4129
+ const refValue = str(r.value);
4130
+ if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
4131
+ if (refs.length >= MISSION_LIMITS.refs) {
4132
+ truncated = true;
4133
+ break;
4134
+ }
4135
+ const repo = str(r.repo);
4136
+ const note = str(r.note);
4137
+ refs.push({
4138
+ kind,
4139
+ ...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
4140
+ value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
4141
+ ...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
4142
+ });
4143
+ }
4144
+ return { refs, truncated };
4145
+ }
4146
+ function normalizeOptions(value, truncated) {
4147
+ if (!Array.isArray(value)) return [];
4148
+ const out = [];
4149
+ for (const raw of value) {
4150
+ if (typeof raw === "string" && raw.trim()) {
4151
+ if (out.length >= MISSION_LIMITS.options) {
4152
+ truncated.push("options");
4153
+ break;
4154
+ }
4155
+ out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
4156
+ continue;
4157
+ }
4158
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4159
+ const o = raw;
4160
+ const label = collapse(str(o.label));
4161
+ if (!label) continue;
4162
+ if (out.length >= MISSION_LIMITS.options) {
4163
+ truncated.push("options");
4164
+ break;
4165
+ }
4166
+ const detail = str(o.detail);
4167
+ out.push({
4168
+ id: MISSION_DECISION_OPTION_IDS[out.length],
4169
+ label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
4170
+ ...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
4171
+ });
4172
+ }
4173
+ return out;
4174
+ }
4175
+ function normalizeDueAt(value) {
4176
+ if (typeof value !== "string" || !value.trim()) return void 0;
4177
+ const ms2 = Date.parse(value);
4178
+ return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
4179
+ }
4180
+ function normalizeDecisionInput(raw, truncated) {
4181
+ const questionSource = collapse(str(raw.question) || str(raw.text));
4182
+ if (!questionSource) return null;
4183
+ if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
4184
+ const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
4185
+ const contextSource = str(raw.context);
4186
+ if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
4187
+ const options = normalizeOptions(raw.options, truncated);
4188
+ const recommendedRaw = str(raw.recommended);
4189
+ const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
4190
+ const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
4191
+ const onDueRaw = str(raw.onDue ?? raw.on_due);
4192
+ const urgencyRaw = str(raw.urgency);
4193
+ const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
4194
+ return {
4195
+ question,
4196
+ ...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
4197
+ options,
4198
+ ...recommended ? { recommended } : {},
4199
+ allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
4200
+ ...dueAt ? { dueAt } : {},
4201
+ // apply_recommended without a recommended option has nothing to apply — fall back to remind.
4202
+ onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
4203
+ urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
4204
+ };
4205
+ }
4206
+ function normalizeForDedupe(text) {
4207
+ return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
4208
+ }
4209
+ function deriveItemDedupeKey(kind, parts) {
4210
+ const explicit = str(parts.explicit);
4211
+ if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
4212
+ if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4213
+ if (kind === "evidence") {
4214
+ const ref2 = parts.refs?.[0];
4215
+ if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
4216
+ }
4217
+ const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
4218
+ return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4219
+ }
4220
+ function normalizeMissionItemInput(raw) {
4221
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
4222
+ const r = raw;
4223
+ const kind = str(r.kind) || "remaining";
4224
+ if (!MISSION_ITEM_KINDS.includes(kind)) {
4225
+ return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
4226
+ }
4227
+ const truncated = [];
4228
+ const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
4229
+ if (refsTruncated) truncated.push("refs");
4230
+ const machineRaw = collapse(str(r.machine));
4231
+ const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
4232
+ const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
4233
+ if (kind === "decision") {
4234
+ const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
4235
+ const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
4236
+ if (!decision) return { error: "decision item needs a question" };
4237
+ return {
4238
+ item: {
4239
+ kind,
4240
+ text: decision.question,
4241
+ ...machine ? { machine } : {},
4242
+ refs,
4243
+ decision,
4244
+ dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
4245
+ truncated
4246
+ }
4247
+ };
4248
+ }
4249
+ const textSource = collapse(str(r.text));
4250
+ if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
4251
+ if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
4252
+ const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
4253
+ return {
4254
+ item: {
4255
+ kind,
4256
+ text,
4257
+ ...machine ? { machine } : {},
4258
+ refs,
4259
+ dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
4260
+ truncated
4261
+ }
4262
+ };
4263
+ }
4264
+ function normalizeMissionItemUpdate(raw) {
4265
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
4266
+ const r = raw;
4267
+ const id2 = str(r.id ?? r.item_id ?? r.itemId);
4268
+ if (!id2) return { error: "update needs an item id" };
4269
+ const truncated = [];
4270
+ const update = { id: id2 };
4271
+ if (r.state !== void 0) {
4272
+ const state = str(r.state);
4273
+ if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
4274
+ update.state = state;
4275
+ }
4276
+ if (typeof r.text === "string") {
4277
+ const text = collapse(r.text);
4278
+ if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
4279
+ if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
4280
+ }
4281
+ if (r.machine === null) update.machine = null;
4282
+ else if (typeof r.machine === "string") {
4283
+ const machine = collapse(r.machine);
4284
+ update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
4285
+ }
4286
+ if (r.refs !== void 0) {
4287
+ const { refs, truncated: t } = normalizeMissionRefs(r.refs);
4288
+ if (t) truncated.push("refs");
4289
+ update.refs = refs;
4290
+ }
4291
+ return { update, truncated };
4292
+ }
4293
+ function boundEventPayload(payload) {
4294
+ let json = JSON.stringify(payload);
4295
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4296
+ const shrunk = {};
4297
+ for (const [k, v] of Object.entries(payload)) {
4298
+ shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
4299
+ }
4300
+ shrunk.payloadTruncated = true;
4301
+ json = JSON.stringify(shrunk);
4302
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4303
+ return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
4304
+ }
4305
+ var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
4306
+ var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
4307
+ var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
4308
+ function isCarryOverMissionRecord(m) {
4309
+ return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
4310
+ }
4311
+ function isCarryOverMissionTitle(title) {
4312
+ if (typeof title !== "string") return false;
4313
+ const t = title.trim();
4314
+ return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
4315
+ }
4316
+ var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
4317
+ var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
4318
+ var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
4319
+ var WORKER_DECISIONS_NEEDED_MAX = 3;
4320
+ var WORKER_COMMITS_MAX = 20;
4321
+ var SHA_RE = /^[0-9a-f]{7,64}$/i;
4322
+ function normalizeReportCommits(value) {
4323
+ if (!Array.isArray(value)) return null;
4324
+ const out = [];
4325
+ for (const v of value) {
4326
+ if (typeof v !== "string") return null;
4327
+ const sha = v.trim();
4328
+ if (!SHA_RE.test(sha)) return null;
4329
+ if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
4330
+ }
4331
+ return out;
4332
+ }
4333
+
4334
+ // src/mission-git-state.ts
4335
+ var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
4336
+ var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
4337
+ var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
4338
+ function isMissionRefContained(status) {
4339
+ return status === "contained_ancestor" || status === "contained_patch_equivalent";
4340
+ }
4341
+ function aggregateMissionGitState(statuses) {
4342
+ const total = statuses.length;
4343
+ const contained = statuses.filter(isMissionRefContained).length;
4344
+ const notContained = statuses.filter((s) => s === "not_contained").length;
4345
+ const unknown = statuses.filter((s) => s === "unknown").length;
4346
+ const counts = { total, contained, notContained, unknown };
4347
+ if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
4348
+ if (contained === total) return { state: "landed", partialUnknown: false, counts };
4349
+ if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
4350
+ if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
4351
+ return { state: "unknown", partialUnknown: false, counts };
4352
+ }
4353
+
4354
+ // src/release.ts
4355
+ var MESH_RELEASE_CHANNELS = ["preview", "stable"];
4356
+ function isMeshReleaseChannel(value) {
4357
+ return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
4358
+ }
4359
+ var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
4360
+ function isReleaseStatus(value) {
4361
+ return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
4362
+ }
4363
+ var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
4364
+ var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
4365
+ var RELEASE_EVENT_TYPES = [
4366
+ "created",
4367
+ "status_changed",
4368
+ "scope_added",
4369
+ "scope_moved",
4370
+ "scope_removed",
4371
+ "deploy_recorded",
4372
+ "changelog_drafted",
4373
+ "changelog_applied"
4374
+ ];
4375
+ var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
4376
+ var RELEASE_LIMITS = {
4377
+ name: 80,
4378
+ note: 500,
4379
+ /** `mesh_missions.release_note`: one user/operator-visible sentence. */
4380
+ releaseNote: 400,
4381
+ missionsPerCall: 100,
4382
+ changelogEntries: 300
4383
+ };
4384
+ var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
4385
+ var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
4386
+ function changelogMissionMarker(missionId) {
4387
+ return `<!-- m:${missionId.slice(0, 8)} -->`;
4388
+ }
4389
+ function classifyChangelogSection(text, hint) {
4390
+ const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
4391
+ if (m) {
4392
+ const key = m[1].toLowerCase();
4393
+ return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
4394
+ }
4395
+ const probe = `${hint ?? ""} ${text}`.toLowerCase();
4396
+ if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
4397
+ if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
4398
+ return { section: "Changed", text };
4399
+ }
4400
+ function lintChangelogText(text) {
4401
+ const out = [];
4402
+ if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
4403
+ if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
4404
+ 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");
4405
+ if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
4406
+ return out;
4407
+ }
4408
+
4409
+ // src/decision-push-relay.ts
4410
+ var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
4411
+ var DECISION_PUSH_RELAY_SOURCE = "push_relay";
4412
+
3468
4413
  // src/keyed-doc-delta.ts
3469
4414
  function sig(value) {
3470
4415
  if (value === void 0) return void 0;
@@ -3685,7 +4630,15 @@ function foldKeyedDoc(held, delta, spec) {
3685
4630
  const heldList = heldCollections.get(path);
3686
4631
  if (change?.absent) {
3687
4632
  const [head2, tail2] = splitPath(path);
3688
- if (!tail2) delete next[head2];
4633
+ if (!tail2) {
4634
+ delete next[head2];
4635
+ continue;
4636
+ }
4637
+ const parent2 = next[head2];
4638
+ if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
4639
+ const copy = { ...parent2 };
4640
+ delete copy[tail2];
4641
+ next[head2] = copy;
3689
4642
  continue;
3690
4643
  }
3691
4644
  if (!change && heldList === void 0) continue;
@@ -3749,9 +4702,482 @@ function stableMeshNodeRow(row) {
3749
4702
  }
3750
4703
  return out;
3751
4704
  }
4705
+
4706
+ // src/provider-approval.ts
4707
+ function isActionableProviderApproval(approval) {
4708
+ 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());
4709
+ }
4710
+ function readProviderDecision(approval, waiting, hasModal = false) {
4711
+ if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
4712
+ if (!waiting) return null;
4713
+ return {
4714
+ source: hasModal ? "legacy_provider" : "status_only",
4715
+ type: "unknown",
4716
+ compatibility: hasModal ? "session_only" : "unknown",
4717
+ evidence: "unavailable",
4718
+ lifecycle: "pending",
4719
+ modalKey: null,
4720
+ createdAt: null,
4721
+ resolvedAt: null,
4722
+ description: "",
4723
+ buttons: [],
4724
+ actionable: false
4725
+ };
4726
+ }
4727
+ function providerApprovalSnapshot(approval) {
4728
+ if (!approval) return null;
4729
+ const {
4730
+ source,
4731
+ type,
4732
+ lifecycle,
4733
+ modalKey,
4734
+ createdAt,
4735
+ resolvedAt,
4736
+ providerType,
4737
+ sessionId,
4738
+ nodeId,
4739
+ meshId,
4740
+ taskId,
4741
+ attemptId,
4742
+ generation
4743
+ } = approval;
4744
+ return {
4745
+ source,
4746
+ type,
4747
+ lifecycle,
4748
+ modalKey,
4749
+ createdAt,
4750
+ resolvedAt,
4751
+ providerType,
4752
+ sessionId,
4753
+ nodeId,
4754
+ meshId,
4755
+ taskId,
4756
+ attemptId,
4757
+ generation,
4758
+ evidence: "cached",
4759
+ actionable: false,
4760
+ description: "",
4761
+ buttons: []
4762
+ };
4763
+ }
4764
+
4765
+ // src/provider-question.ts
4766
+ function isProviderQuestionBinding(value) {
4767
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
4768
+ const b = value;
4769
+ if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
4770
+ const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
4771
+ if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
4772
+ if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
4773
+ return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
4774
+ }
4775
+
4776
+ // src/task-source-phase.ts
4777
+ function reviewIndependenceOf(review) {
4778
+ return review.independence ?? "different_provider";
4779
+ }
4780
+
4781
+ // src/light-task.ts
4782
+ var LIGHT_REJECT = {
4783
+ REQUIRES_LOCAL_BASE: "light_requires_local_base",
4784
+ NOT_CONFIGURED: "light_workspace_not_configured",
4785
+ REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
4786
+ MODE_CONFLICT: "light_mode_conflict"
4787
+ };
4788
+ var LIGHT_HOLD = {
4789
+ PREPARE_FAILED: "light_workspace_prepare_failed",
4790
+ LIMIT: "light_workspace_limit",
4791
+ DISK_LOW: "light_workspace_disk_low",
4792
+ CAP: "max_light_parallel_tasks_reached"
4793
+ };
4794
+ var LIGHT_BLOCK_REASONS = [
4795
+ "light_uncommitted_changes",
4796
+ "light_dependency_change",
4797
+ "light_lineage_unproven",
4798
+ "shared_checkout_mutated"
4799
+ ];
4800
+ var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
4801
+ var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
4802
+ var LIGHT_TESTS_RUN_MAX = 20;
4803
+ function isLightWorkerSession(session) {
4804
+ const s = session;
4805
+ if (!s || typeof s !== "object") return false;
4806
+ const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
4807
+ return has(s.settings) || has(s.launchRecord?.settings) || has(s);
4808
+ }
4809
+
4810
+ // src/relay-reprobe.ts
4811
+ var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
4812
+ var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
4813
+ var RELAY_REPROBE_JITTER_RATIO = 0.2;
4814
+ function computeRelayReprobeDelay(failures, random, timing = {}) {
4815
+ const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
4816
+ const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
4817
+ const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
4818
+ const grown = Math.min(max, base * 2 ** Math.max(0, failures));
4819
+ const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
4820
+ return Math.round(grown * factor);
4821
+ }
4822
+ var RelayReprobeScheduler = class {
4823
+ constructor(options) {
4824
+ this.options = options;
4825
+ }
4826
+ handle = null;
4827
+ running = false;
4828
+ inFlight = false;
4829
+ failureCount = 0;
4830
+ generation = 0;
4831
+ get isRunning() {
4832
+ return this.running;
4833
+ }
4834
+ get failures() {
4835
+ return this.failureCount;
4836
+ }
4837
+ get probing() {
4838
+ return this.inFlight;
4839
+ }
4840
+ /** Begin probing (idempotent). Call when a connection is selected as relay. */
4841
+ start() {
4842
+ if (this.running) return;
4843
+ this.running = true;
4844
+ this.failureCount = 0;
4845
+ this.generation++;
4846
+ this.schedule();
4847
+ }
4848
+ /** Stop for good (direct path found, connection closed, auth epoch changed). */
4849
+ stop() {
4850
+ this.running = false;
4851
+ this.generation++;
4852
+ if (this.handle !== null) {
4853
+ this.options.clearTimer(this.handle);
4854
+ this.handle = null;
4855
+ }
4856
+ }
4857
+ schedule() {
4858
+ if (!this.running) return;
4859
+ const generation = this.generation;
4860
+ const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
4861
+ this.handle = this.options.setTimer(() => {
4862
+ this.handle = null;
4863
+ void this.tick(generation);
4864
+ }, delay);
4865
+ }
4866
+ async tick(generation) {
4867
+ if (!this.running || generation !== this.generation) return;
4868
+ if (this.inFlight || !this.options.shouldProbe()) {
4869
+ this.schedule();
4870
+ return;
4871
+ }
4872
+ this.inFlight = true;
4873
+ let outcome;
4874
+ try {
4875
+ outcome = await this.options.probe();
4876
+ } catch {
4877
+ outcome = "failed";
4878
+ }
4879
+ this.inFlight = false;
4880
+ if (!this.running || generation !== this.generation) return;
4881
+ if (outcome === "direct") {
4882
+ this.stop();
4883
+ return;
4884
+ }
4885
+ if (outcome !== "skipped") this.failureCount++;
4886
+ this.schedule();
4887
+ }
4888
+ };
4889
+
4890
+ // src/task-stages.ts
4891
+ var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
4892
+ var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
4893
+ var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
4894
+ var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
4895
+ var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
4896
+ var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
4897
+ var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
4898
+ var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
4899
+ var STAGE_ROLES = ["implement", "revise", "review"];
4900
+ var STAGE_BLOCKED_REASONS = [
4901
+ "review_unresolved",
4902
+ "review_rejected_approach",
4903
+ "review_unavailable",
4904
+ "self_check_failed",
4905
+ "stage_pipeline_ceiling",
4906
+ "reviewer_mutated_source",
4907
+ // The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
4908
+ "reviewer_integrity_unverifiable"
4909
+ ];
4910
+ var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
4911
+ var STAGE_MAX_REVISIONS_LIMIT = 3;
4912
+ var STAGE_DEFAULT_MAX_REVISIONS = 2;
4913
+ var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
4914
+ var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
4915
+ var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
4916
+ var REVIEW_FINDINGS_MAX = 30;
4917
+ var REVIEW_CLAIM_MAX_CHARS = 500;
4918
+ var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
4919
+ var REVIEW_FIX_MAX_CHARS = 500;
4920
+ var REVIEW_FINDING_ID_MAX_CHARS = 40;
4921
+ var REVIEW_CHECKED_MAX = 20;
4922
+ var REVIEW_NOTE_MAX_CHARS = 500;
4923
+ var REVIEW_TESTS_RUN_MAX = 20;
4924
+ var FINDING_RESPONSES_MAX = 30;
4925
+ function makeGuard4(values) {
4926
+ const set = new Set(values);
4927
+ return (value) => typeof value === "string" && set.has(value);
4928
+ }
4929
+ var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
4930
+ var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
4931
+ var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
4932
+ var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
4933
+ var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
4934
+ var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
4935
+ var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
4936
+ function isBlockingSeverity(severity) {
4937
+ return severity === "blocking" || severity === "major";
4938
+ }
4939
+ function resolveStagePlan(raw, task, opts = {}) {
4940
+ const eligible = isStageEligibleTask(task);
4941
+ if (raw === void 0 || raw === null) return (opts.defaultOn ?? true) && defaultsOnFor(task) ? defaultStagePlan() : null;
4942
+ if (raw === false) return null;
4943
+ if (raw === true) {
4944
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4945
+ return defaultStagePlan();
4946
+ }
4947
+ if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
4948
+ const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
4949
+ for (const key of Object.keys(raw)) {
4950
+ if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
4951
+ }
4952
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4953
+ const rawMax = raw.max_revisions ?? raw.maxRevisions;
4954
+ let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
4955
+ if (rawMax !== void 0) {
4956
+ if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
4957
+ throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
4958
+ }
4959
+ maxRevisions = rawMax;
4960
+ }
4961
+ let independence = "fresh_session_ok";
4962
+ if (raw.independence !== void 0) {
4963
+ if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
4964
+ throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
4965
+ }
4966
+ independence = raw.independence;
4967
+ }
4968
+ return { review: true, maxRevisions, independence };
4969
+ }
4970
+ function defaultStagePlan() {
4971
+ return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
4972
+ }
4973
+ function isStageEligibleTask(task) {
4974
+ if (task.readonly) return false;
4975
+ return (task.taskMode ?? "code_change") === "code_change";
4976
+ }
4977
+ function defaultsOnFor(task) {
4978
+ return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
4979
+ }
4980
+ function str2(value) {
4981
+ return typeof value === "string" ? value.trim() : "";
4982
+ }
4983
+ function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
4984
+ if (!Array.isArray(value)) {
4985
+ errors.push({ field, message: `${field} must be an array of strings` });
4986
+ return [];
4987
+ }
4988
+ if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
4989
+ const out = [];
4990
+ for (const item of value) {
4991
+ const text = str2(item);
4992
+ if (!text) continue;
4993
+ if (text.length > maxChars) {
4994
+ errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
4995
+ continue;
4996
+ }
4997
+ out.push(text);
4998
+ }
4999
+ 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` });
5000
+ return out;
5001
+ }
5002
+ function validateReviewReport(raw, ctx) {
5003
+ const errors = [];
5004
+ if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
5005
+ const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
5006
+ 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(", ")})` });
5007
+ const verdict = raw.verdict;
5008
+ if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
5009
+ const findings = [];
5010
+ if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
5011
+ else {
5012
+ 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` });
5013
+ const seen = /* @__PURE__ */ new Set();
5014
+ raw.findings.forEach((f, i) => {
5015
+ const at = `review.findings[${i}]`;
5016
+ if (!isRecord4(f)) {
5017
+ errors.push({ field: at, message: "each finding must be an object" });
5018
+ return;
5019
+ }
5020
+ const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
5021
+ for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5022
+ const id2 = str2(f.id);
5023
+ 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)` });
5024
+ else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
5025
+ else seen.add(id2);
5026
+ if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
5027
+ if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
5028
+ const claim = str2(f.claim);
5029
+ if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
5030
+ else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
5031
+ const evidence = str2(f.evidence);
5032
+ if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
5033
+ else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
5034
+ const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
5035
+ if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
5036
+ if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
5037
+ 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" });
5038
+ if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
5039
+ findings.push({
5040
+ id: id2,
5041
+ severity: f.severity,
5042
+ category: f.category,
5043
+ ...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
5044
+ ...typeof f.line === "number" ? { line: f.line } : {},
5045
+ claim,
5046
+ evidence,
5047
+ ...fix ? { suggestedFix: fix } : {}
5048
+ });
5049
+ }
5050
+ });
5051
+ }
5052
+ const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5053
+ const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5054
+ let priorFindings;
5055
+ if (raw.priorFindings !== void 0) {
5056
+ if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
5057
+ else {
5058
+ priorFindings = [];
5059
+ raw.priorFindings.forEach((p, i) => {
5060
+ const at = `review.priorFindings[${i}]`;
5061
+ if (!isRecord4(p)) {
5062
+ errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
5063
+ return;
5064
+ }
5065
+ for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5066
+ const id2 = str2(p.id);
5067
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5068
+ if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
5069
+ const note = p.note === void 0 ? void 0 : str2(p.note);
5070
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5071
+ if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
5072
+ });
5073
+ }
5074
+ }
5075
+ const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
5076
+ if (isReviewVerdict(verdict)) {
5077
+ const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
5078
+ if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
5079
+ errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
5080
+ }
5081
+ if (verdict === "approve" && blocking.length > 0) {
5082
+ errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
5083
+ }
5084
+ if (verdict === "approve_with_nits" && blocking.length > 0) {
5085
+ errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
5086
+ }
5087
+ }
5088
+ if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
5089
+ const answered = new Set((priorFindings ?? []).map((p) => p.id));
5090
+ const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
5091
+ 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(", ")}` });
5092
+ }
5093
+ if (errors.length) return { errors };
5094
+ return {
5095
+ report: {
5096
+ verdict,
5097
+ findings,
5098
+ ...priorFindings?.length ? { priorFindings } : {},
5099
+ checked,
5100
+ notChecked,
5101
+ ...testsRun?.length ? { testsRun } : {}
5102
+ },
5103
+ errors: []
5104
+ };
5105
+ }
5106
+ function validateTestsRun(raw, field, errors) {
5107
+ if (!Array.isArray(raw)) {
5108
+ errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
5109
+ return [];
5110
+ }
5111
+ if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
5112
+ const out = [];
5113
+ raw.forEach((t, i) => {
5114
+ const at = `${field}[${i}]`;
5115
+ if (!isRecord4(t)) {
5116
+ errors.push({ field: at, message: "each entry must be an object" });
5117
+ return;
5118
+ }
5119
+ for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5120
+ const command = str2(t.command);
5121
+ if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
5122
+ if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
5123
+ for (const k of ["passed", "failed"]) {
5124
+ 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` });
5125
+ }
5126
+ const note = t.note === void 0 ? void 0 : str2(t.note);
5127
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5128
+ if (command && typeof t.exit === "number") {
5129
+ out.push({
5130
+ command,
5131
+ exit: t.exit,
5132
+ ...typeof t.passed === "number" ? { passed: t.passed } : {},
5133
+ ...typeof t.failed === "number" ? { failed: t.failed } : {},
5134
+ ...note ? { note } : {}
5135
+ });
5136
+ }
5137
+ });
5138
+ return out;
5139
+ }
5140
+ function validateFindingResponses(raw, field = "findingResponses") {
5141
+ const errors = [];
5142
+ if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
5143
+ if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
5144
+ const out = [];
5145
+ raw.forEach((r, i) => {
5146
+ const at = `${field}[${i}]`;
5147
+ if (!isRecord4(r)) {
5148
+ errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
5149
+ return;
5150
+ }
5151
+ for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5152
+ const id2 = str2(r.id);
5153
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5154
+ if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
5155
+ const note = str2(r.note);
5156
+ if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
5157
+ else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5158
+ if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
5159
+ });
5160
+ return errors.length ? { errors } : { responses: out, errors: [] };
5161
+ }
5162
+ function formatStageVerdictLine(input) {
5163
+ const parts = [`review: ${input.verdict}`];
5164
+ if (input.verdict === "skipped_no_diff") return parts[0];
5165
+ parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
5166
+ if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
5167
+ const tail = [];
5168
+ if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
5169
+ if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
5170
+ return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
5171
+ }
3752
5172
  // Annotate the CommonJS export names for ESM import in node:
3753
5173
  0 && (module.exports = {
5174
+ ASSISTANT_ACCOUNT_SLOT,
5175
+ ASSISTANT_FOLLOWER_ALLOWED_OPS,
3754
5176
  ASSISTANT_OWNER_VERBS,
5177
+ ASSISTANT_REMOTE_FOLLOW_COMMAND,
5178
+ ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
5179
+ ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
5180
+ ASSISTANT_REMOTE_PROJECT_COMMAND,
3755
5181
  ASSISTANT_REVIEW_TURN_VERBS,
3756
5182
  ASSISTANT_SESSION_ID_ARG,
3757
5183
  ASSISTANT_SESSION_ID_ENV,
@@ -3763,12 +5189,16 @@ function stableMeshNodeRow(row) {
3763
5189
  CANCEL_REASONS,
3764
5190
  CANONICAL_MESH_TOOL_COUNT,
3765
5191
  CANONICAL_MESH_TOOL_NAMES,
5192
+ CARRY_OVER_MISSION_GOAL,
5193
+ CARRY_OVER_MISSION_TITLE,
5194
+ CHANGELOG_SECTIONS,
3766
5195
  CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
3767
5196
  CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
3768
5197
  CLI_SLOT_RECIPES,
3769
5198
  COMMIT_STRENGTHS,
3770
5199
  CONSUME_PROFILES,
3771
5200
  COORDINATOR_ACK_OUTCOMES,
5201
+ COORDINATOR_SETTABLE_ITEM_STATES,
3772
5202
  DAEMON_METADATA_DOC_SPEC,
3773
5203
  DAEMON_P2P_SIGNAL_TYPES,
3774
5204
  DAEMON_STATUS_EVENT_NAMES,
@@ -3781,13 +5211,34 @@ function stableMeshNodeRow(row) {
3781
5211
  DASHBOARD_TO_DAEMON_P2P_TYPES,
3782
5212
  DASHBOARD_TO_USER_SESSION_TYPES,
3783
5213
  DASHBOARD_WIRE_VERSION,
5214
+ DECISION_PUSH_OPTIONS_MAX,
5215
+ DECISION_PUSH_OPTION_LABEL_MAX,
5216
+ DECISION_PUSH_QUESTION_MAX,
5217
+ DECISION_PUSH_RELAY_COMMAND,
5218
+ DECISION_PUSH_RELAY_SOURCE,
3784
5219
  DEFAULT_DIFFICULTY_BRAINS,
3785
5220
  DELIVERY_OUTCOMES,
3786
5221
  DELIVERY_VIAS,
3787
5222
  DISPATCH_FAILURE_REASONS,
5223
+ DISPATCH_REFUSAL_DETAIL_MAX,
3788
5224
  EVIDENCE_ENVELOPE_FIELD_SPECS,
3789
5225
  EVIDENCE_SOURCE_IDS,
5226
+ FINDING_CATEGORIES,
5227
+ FINDING_RESPONSES_MAX,
5228
+ FINDING_RESPONSE_KINDS,
5229
+ FINDING_SEVERITIES,
3790
5230
  HOLD_REASONS,
5231
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
5232
+ LAUNCH_DEFAULT_ERROR_CODES,
5233
+ LAUNCH_DEFAULT_ROLES,
5234
+ LAUNCH_DEFAULT_SOURCES,
5235
+ LEGACY_CARRY_OVER_MISSION_TITLE,
5236
+ LIGHT_BLOCK_REASONS,
5237
+ LIGHT_HOLD,
5238
+ LIGHT_LAND_MODES,
5239
+ LIGHT_REJECT,
5240
+ LIGHT_TESTS_RUN_MAX,
5241
+ LIGHT_WARNINGS,
3791
5242
  LIVENESS_RESULTS,
3792
5243
  MAX_MESH_RECORD_STRING,
3793
5244
  MAX_OWNED_PATHS,
@@ -3802,6 +5253,8 @@ function stableMeshNodeRow(row) {
3802
5253
  MESH_MISSION_STATUSES,
3803
5254
  MESH_P2P_SIGNAL_TYPES,
3804
5255
  MESH_RECORD_PAYLOAD_KEYS,
5256
+ MESH_RELEASE_CHANNELS,
5257
+ MESH_RELEASE_STATUSES,
3805
5258
  MESH_SESSION_CLEANUP_MODES,
3806
5259
  MESH_STATUS_DOC_SPEC,
3807
5260
  MESH_TASK_DIFFICULTIES,
@@ -3813,10 +5266,23 @@ function stableMeshNodeRow(row) {
3813
5266
  MESH_TOPIC_ENTRY_KINDS,
3814
5267
  MESH_TOPIC_PROTOCOL_VERSION,
3815
5268
  MISSION_BRIEF_RENDER_MAX_CHARS,
5269
+ MISSION_DECISION_ON_DUE,
5270
+ MISSION_DECISION_OPTION_IDS,
5271
+ MISSION_DECISION_URGENCIES,
5272
+ MISSION_GIT_STATES,
5273
+ MISSION_ITEM_KINDS,
5274
+ MISSION_ITEM_STATES,
5275
+ MISSION_LIMITS,
5276
+ MISSION_OUTCOMES,
5277
+ MISSION_REF_GIT_METHODS,
5278
+ MISSION_REF_GIT_STATUSES,
5279
+ MISSION_REF_KINDS,
5280
+ MISSION_RELEASE_EVENT_TYPES,
3816
5281
  MODEL_AXIS_SOURCES,
3817
5282
  MODEL_SELECTION_HISTORY_LIMIT,
3818
5283
  MeshChunkAssembler,
3819
5284
  NATIVE_TURN_OUTCOMES,
5285
+ NEEDS_WORDING_MARKER,
3820
5286
  NOTIFY_KINDS,
3821
5287
  NO_PROGRESS_OBSERVED_STATUSES,
3822
5288
  NPM_UPDATE_TAGS,
@@ -3826,14 +5292,37 @@ function stableMeshNodeRow(row) {
3826
5292
  OPERATOR_STATUS_REASON_VALUES,
3827
5293
  OPERATOR_STATUS_VALUES,
3828
5294
  OUTBOUND_MESSAGE_ORIGINS,
5295
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX,
5296
+ OWNER_ABANDON_CONFIRM_OPTIONS,
5297
+ OWNER_ABANDON_CONFIRM_QUESTION,
3829
5298
  P2P_SIGNAL_TYPES,
5299
+ PRIOR_FINDING_STATUSES,
3830
5300
  PROVIDER_FAILURES,
5301
+ QUOTA_BACKFILL_HORIZON_MS,
5302
+ QUOTA_RETRY_INFLIGHT_GRACE_MS,
3831
5303
  QUOTA_SUPPORTED_PROVIDERS,
3832
5304
  RECENT_SESSION_BUCKETS,
3833
5305
  RECLAIMING_SEND_REFUSALS,
5306
+ RELAY_REPROBE_BASE_DELAY_MS,
5307
+ RELAY_REPROBE_JITTER_RATIO,
5308
+ RELAY_REPROBE_MAX_DELAY_MS,
5309
+ RELEASE_ACTORS,
3834
5310
  RELEASE_CHANNELS,
5311
+ RELEASE_EVENT_TYPES,
5312
+ RELEASE_LIMITS,
5313
+ RELEASE_MEMBER_STATES,
3835
5314
  REMOVED_MESH_TOOLS,
3836
5315
  RETIRED_MESH_TOOLS,
5316
+ REVIEW_CHECKED_MAX,
5317
+ REVIEW_CLAIM_MAX_CHARS,
5318
+ REVIEW_EVIDENCE_MAX_CHARS,
5319
+ REVIEW_FINDINGS_MAX,
5320
+ REVIEW_FINDING_ID_MAX_CHARS,
5321
+ REVIEW_FIX_MAX_CHARS,
5322
+ REVIEW_NOTE_MAX_CHARS,
5323
+ REVIEW_TESTS_RUN_MAX,
5324
+ REVIEW_VERDICTS,
5325
+ RelayReprobeScheduler,
3837
5326
  SEND_POLICY_MODES,
3838
5327
  SEND_REFUSAL_REASONS,
3839
5328
  SERVER_STATUS_EVENT_NAMES,
@@ -3846,6 +5335,17 @@ function stableMeshNodeRow(row) {
3846
5335
  SESSION_STATUS_ALIASES,
3847
5336
  SESSION_STATUS_CLASS,
3848
5337
  SHARED_SESSION_TO_VIEWER_TYPES,
5338
+ STAGE_BLOCKED_REASONS,
5339
+ STAGE_DECIDE_ACTIONS,
5340
+ STAGE_DEFAULT_MAX_REVISIONS,
5341
+ STAGE_INDEPENDENCE_FALLBACK_MS,
5342
+ STAGE_INDEPENDENCE_MODES,
5343
+ STAGE_MAX_REVISIONS_LIMIT,
5344
+ STAGE_PARKED_PHASES,
5345
+ STAGE_PHASES,
5346
+ STAGE_PIPELINE_CEILING_DEFAULT_MS,
5347
+ STAGE_ROLES,
5348
+ STAGE_SELF_CHECK_MAX_BOUNCES,
3849
5349
  STATUS_PROBE_ARG_KEY,
3850
5350
  SUSPENSION_MODALS,
3851
5351
  SUSPENSION_RESOLUTIONS,
@@ -3871,16 +5371,27 @@ function stableMeshNodeRow(row) {
3871
5371
  VERSION_UPDATE_REASONS,
3872
5372
  VIEWER_TO_SHARED_SESSION_TYPES,
3873
5373
  WORKER_BRANCH_STATES,
5374
+ WORKER_COMMITS_MAX,
5375
+ WORKER_CURRENT_BRANCH_RULE,
5376
+ WORKER_DECISIONS_NEEDED_MAX,
3874
5377
  WORKER_PROTOCOL_FOOTER_MARKER,
3875
5378
  WORKER_REPORT_OUTCOMES,
5379
+ WORKER_REPORT_SUMMARY_MAX_CHARS,
5380
+ WORKER_SHELL_LITERAL_PATHS_RULE,
3876
5381
  WORKER_TOOLS,
5382
+ aggregateMissionGitState,
3877
5383
  appendWorkerProtocolFooter,
3878
5384
  argsCarryStatusProbeMarker,
5385
+ assessQuotaFreshness,
5386
+ boundEventPayload,
3879
5387
  buildSlotProposal,
3880
5388
  canonicalDaemonId,
5389
+ changelogMissionMarker,
5390
+ classifyChangelogSection,
3881
5391
  classifySessionStatus,
3882
5392
  compareDashboardWireVersion,
3883
5393
  compareSemver,
5394
+ computeRelayReprobeDelay,
3884
5395
  daemonIdsEquivalent,
3885
5396
  decodeActiveWorkQueryRequest,
3886
5397
  decodeActiveWorkQueryResponse,
@@ -3923,6 +5434,8 @@ function stableMeshNodeRow(row) {
3923
5434
  decodeQueueQueryResponse,
3924
5435
  decodeQueueRequeueRequest,
3925
5436
  decodeQueueRequeueResponse,
5437
+ decodeQueueReviseRequest,
5438
+ decodeQueueReviseResponse,
3926
5439
  decodeRecordLocalRequest,
3927
5440
  decodeRecordLocalResponse,
3928
5441
  decodeRecoveryContextQueryRequest,
@@ -3942,6 +5455,8 @@ function stableMeshNodeRow(row) {
3942
5455
  decodeUserSessionToDashboard,
3943
5456
  decodeViewerToSharedSession,
3944
5457
  defaultProviderPriorityFromNodeFacts,
5458
+ defaultStagePlan,
5459
+ deriveItemDedupeKey,
3945
5460
  deriveProviderPriorityFromSlots,
3946
5461
  deriveSlotsFromLegacy,
3947
5462
  describeModelSelection,
@@ -3952,13 +5467,21 @@ function stableMeshNodeRow(row) {
3952
5467
  expandDaemonIdForms,
3953
5468
  findOwnershipConflicts,
3954
5469
  foldKeyedDoc,
5470
+ followedRemoteProjectKey,
5471
+ followerOpPermitted,
3955
5472
  formatQuotaAccount,
5473
+ formatStageVerdictLine,
3956
5474
  hasGitStatusEvidence,
3957
5475
  hasWorkerProtocolFooter,
3958
5476
  interpolateString,
5477
+ isActionableProviderApproval,
5478
+ isAssistantFollowerAllowedOp,
3959
5479
  isAssistantTool,
3960
5480
  isBlockedStatus,
5481
+ isBlockingSeverity,
3961
5482
  isBusyStatus,
5483
+ isCarryOverMissionRecord,
5484
+ isCarryOverMissionTitle,
3962
5485
  isChunkType,
3963
5486
  isCommitStrength,
3964
5487
  isDaemonDirectCommandType,
@@ -3974,14 +5497,21 @@ function stableMeshNodeRow(row) {
3974
5497
  isDeadStatus,
3975
5498
  isDowngrade,
3976
5499
  isEvidenceIdentifier,
5500
+ isFindingCategory,
5501
+ isFindingResponseKind,
5502
+ isFindingSeverity,
3977
5503
  isFiniteNumber,
3978
5504
  isIdleSessionState,
3979
5505
  isInputEnvelopeWire,
5506
+ isLaunchDefaultRole,
5507
+ isLaunchDefaultSource,
5508
+ isLightWorkerSession,
3980
5509
  isMeshDeliveryMode,
3981
5510
  isMeshIndexQueryResponse,
3982
5511
  isMeshMissionStatusValue,
3983
5512
  isMeshP2PSignalType,
3984
5513
  isMeshRecordPayload,
5514
+ isMeshReleaseChannel,
3985
5515
  isMeshTaskDifficulty,
3986
5516
  isMeshTaskMode,
3987
5517
  isMeshTaskPriority,
@@ -3989,17 +5519,24 @@ function stableMeshNodeRow(row) {
3989
5519
  isMeshTerminalTaskStatus,
3990
5520
  isMeshTopicEntry,
3991
5521
  isMessageId,
5522
+ isMissionOutcome,
5523
+ isMissionRefContained,
3992
5524
  isMissionUpsertResponse,
3993
5525
  isModelAxisSource,
5526
+ isNativeMarkerRef,
3994
5527
  isNonEmptyString,
3995
5528
  isNotifyKind,
3996
5529
  isOutboundMessage,
3997
5530
  isOutboundMessageOrigin,
3998
5531
  isP2PSignalType,
3999
5532
  isPhantomDaemonEntry,
5533
+ isPriorFindingStatus,
5534
+ isProviderQuestionBinding,
4000
5535
  isRawDaemonDoId,
4001
5536
  isReadyStatus,
4002
5537
  isRecord,
5538
+ isReleaseStatus,
5539
+ isReviewVerdict,
4003
5540
  isSendPolicy,
4004
5541
  isSendPolicyMode,
4005
5542
  isSendRefusal,
@@ -4008,6 +5545,8 @@ function stableMeshNodeRow(row) {
4008
5545
  isSessionLaunchedBy,
4009
5546
  isSessionStatus,
4010
5547
  isSharedSessionToViewerType,
5548
+ isStageBlockedReason,
5549
+ isStageEligibleTask,
4011
5550
  isSubmitOutcome,
4012
5551
  isSummaryRef,
4013
5552
  isTerminalSessionRecordStatus,
@@ -4026,6 +5565,7 @@ function stableMeshNodeRow(row) {
4026
5565
  isWorkingStatus,
4027
5566
  joinRepoPath,
4028
5567
  launchModelSelectionValue,
5568
+ lintChangelogText,
4029
5569
  machineCoreFromDaemonId,
4030
5570
  makeTypeGuard,
4031
5571
  measureWorstCaseChunkEnvelopeBytes,
@@ -4034,43 +5574,61 @@ function stableMeshNodeRow(row) {
4034
5574
  meshUtf8ByteLength,
4035
5575
  meshWorkspacesEquivalent,
4036
5576
  mintMessageId,
5577
+ minutesUntilQuotaCheck,
4037
5578
  normalizeAuthOkLimits,
4038
5579
  normalizeBrainSlot,
5580
+ normalizeDecisionInput,
4039
5581
  normalizeDifficultyBrainMap,
5582
+ normalizeForDedupe,
4040
5583
  normalizeGitStatus,
4041
5584
  normalizeMeshNodeFacts,
4042
5585
  normalizeMeshNodeId,
4043
5586
  normalizeMeshSessionRecord,
4044
5587
  normalizeMeshWorkspaceForCompare,
4045
5588
  normalizeMissionBrief,
5589
+ normalizeMissionItemInput,
5590
+ normalizeMissionItemUpdate,
5591
+ normalizeMissionRefs,
5592
+ normalizeMissionSummary,
4046
5593
  normalizeNodeCapabilitySlot,
4047
5594
  normalizeNodeCapabilitySlots,
5595
+ normalizeOutcomeReason,
4048
5596
  normalizeOwnedPaths,
5597
+ normalizeReportCommits,
4049
5598
  normalizeSessionStatus,
4050
5599
  normalizeThinkingLevel,
4051
5600
  orderProvidersByBuiltinPreference,
4052
5601
  parseJsonRecord,
5602
+ parseRoleLaunchSelection,
4053
5603
  parseSemver,
4054
5604
  parseSessionLaunchRecord,
4055
5605
  pathsOverlap,
4056
5606
  pickBestTransitGitStatus,
4057
5607
  projectFileDiffRow,
4058
5608
  projectTurnEvidenceEntry,
5609
+ providerApprovalSnapshot,
4059
5610
  readBoolean,
4060
5611
  readEnvelopeFields,
4061
5612
  readGitSubmodules,
4062
5613
  readNumber,
4063
5614
  readOptionalRecord,
5615
+ readProviderDecision,
4064
5616
  readRecord,
4065
5617
  readString,
4066
5618
  readStringArray,
4067
5619
  readText,
4068
5620
  renderCoordinatorWorkerSection,
5621
+ renderLightWorkspaceRules,
4069
5622
  renderMissionBriefBlock,
5623
+ renderStageProtocolLines,
4070
5624
  renderWorkerProtocolFooter,
5625
+ resolveStagePlan,
4071
5626
  retiredMeshToolError,
5627
+ reviewIndependenceOf,
5628
+ sanitizeDispatchRefusalDetail,
4072
5629
  sanitizeModelIdentifier,
4073
5630
  sanitizeRefusalCode,
5631
+ sanitizeRemoteRepoIdentity,
4074
5632
  scoreGitStatusCandidate,
4075
5633
  scoreGitUpstreamFreshness,
4076
5634
  sessionIdsEquivalent,
@@ -4081,6 +5639,11 @@ function stableMeshNodeRow(row) {
4081
5639
  summarizeGitShape,
4082
5640
  supportsQuota,
4083
5641
  touchedFilesOutsideOwnership,
5642
+ truncateMissionText,
5643
+ unwrapPastedContent,
5644
+ validateFindingResponses,
5645
+ validateReviewReport,
5646
+ validateTestsRun,
4084
5647
  withStatusProbeMarker
4085
5648
  });
4086
5649
  //# sourceMappingURL=index.js.map