@adhdev/mesh-shared 1.0.82-rc.12 → 1.0.82-rc.120

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 (60) hide show
  1. package/dist/assistant-protocol.d.ts +158 -6
  2. package/dist/decision-push-relay.d.ts +20 -0
  3. package/dist/index.d.ts +10 -0
  4. package/dist/index.js +1534 -112
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1400 -112
  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 +54 -1
  15. package/dist/outbound-message.d.ts +9 -2
  16. package/dist/protocol/daemon-server.d.ts +42 -2
  17. package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
  18. package/dist/protocol/dashboard-server.d.ts +20 -2
  19. package/dist/quota-freshness.d.ts +4 -4
  20. package/dist/relay-reprobe.d.ts +52 -0
  21. package/dist/release.d.ts +90 -0
  22. package/dist/role-launch.d.ts +11 -0
  23. package/dist/session-launch.d.ts +10 -22
  24. package/dist/slot-proposal.d.ts +14 -0
  25. package/dist/task-source-phase.d.ts +83 -0
  26. package/dist/task-stages.d.ts +210 -0
  27. package/dist/turn-evidence.d.ts +31 -9
  28. package/dist/turn-ipc-mission.d.ts +72 -1
  29. package/dist/turn-ipc-queue.d.ts +30 -0
  30. package/dist/turn-ipc.d.ts +2 -2
  31. package/dist/worker-protocol.d.ts +41 -1
  32. package/package.json +1 -1
  33. package/src/assistant-protocol.ts +294 -6
  34. package/src/daemon-normalize.ts +7 -5
  35. package/src/decision-push-relay.ts +23 -0
  36. package/src/index.ts +11 -0
  37. package/src/launch-defaults.ts +170 -0
  38. package/src/light-task.ts +116 -0
  39. package/src/mesh-tool-names.ts +22 -0
  40. package/src/mesh-vocabulary.ts +12 -2
  41. package/src/mission-git-state.ts +112 -0
  42. package/src/mission-items.ts +421 -0
  43. package/src/node-facts.ts +54 -1
  44. package/src/outbound-message.ts +19 -0
  45. package/src/protocol/daemon-server.ts +37 -2
  46. package/src/protocol/dashboard-server.ts +13 -2
  47. package/src/quota-freshness.ts +29 -13
  48. package/src/relay-reprobe.ts +117 -0
  49. package/src/release.ts +121 -0
  50. package/src/role-launch.ts +51 -0
  51. package/src/session-launch.ts +17 -1
  52. package/src/slot-proposal.ts +61 -2
  53. package/src/task-source-phase.ts +70 -0
  54. package/src/task-stages.ts +459 -0
  55. package/src/turn-evidence.ts +47 -7
  56. package/src/turn-ipc-mission.ts +127 -11
  57. package/src/turn-ipc-queue.ts +45 -2
  58. package/src/turn-ipc-turn.ts +1 -1
  59. package/src/turn-ipc.ts +1 -0
  60. 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,16 +141,37 @@ __export(index_exports, {
95
141
  OPERATOR_STATUS_REASON_VALUES: () => OPERATOR_STATUS_REASON_VALUES,
96
142
  OPERATOR_STATUS_VALUES: () => OPERATOR_STATUS_VALUES,
97
143
  OUTBOUND_MESSAGE_ORIGINS: () => OUTBOUND_MESSAGE_ORIGINS,
144
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX: () => OWNER_ABANDON_CONFIRM_KEY_PREFIX,
145
+ OWNER_ABANDON_CONFIRM_OPTIONS: () => OWNER_ABANDON_CONFIRM_OPTIONS,
146
+ OWNER_ABANDON_CONFIRM_QUESTION: () => OWNER_ABANDON_CONFIRM_QUESTION,
98
147
  P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
148
+ PRIOR_FINDING_STATUSES: () => PRIOR_FINDING_STATUSES,
99
149
  PROVIDER_FAILURES: () => PROVIDER_FAILURES,
100
150
  QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
101
151
  QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
102
152
  QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
103
153
  RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
104
154
  RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
155
+ RELAY_REPROBE_BASE_DELAY_MS: () => RELAY_REPROBE_BASE_DELAY_MS,
156
+ RELAY_REPROBE_JITTER_RATIO: () => RELAY_REPROBE_JITTER_RATIO,
157
+ RELAY_REPROBE_MAX_DELAY_MS: () => RELAY_REPROBE_MAX_DELAY_MS,
158
+ RELEASE_ACTORS: () => RELEASE_ACTORS,
105
159
  RELEASE_CHANNELS: () => RELEASE_CHANNELS,
160
+ RELEASE_EVENT_TYPES: () => RELEASE_EVENT_TYPES,
161
+ RELEASE_LIMITS: () => RELEASE_LIMITS,
162
+ RELEASE_MEMBER_STATES: () => RELEASE_MEMBER_STATES,
106
163
  REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
107
164
  RETIRED_MESH_TOOLS: () => RETIRED_MESH_TOOLS,
165
+ REVIEW_CHECKED_MAX: () => REVIEW_CHECKED_MAX,
166
+ REVIEW_CLAIM_MAX_CHARS: () => REVIEW_CLAIM_MAX_CHARS,
167
+ REVIEW_EVIDENCE_MAX_CHARS: () => REVIEW_EVIDENCE_MAX_CHARS,
168
+ REVIEW_FINDINGS_MAX: () => REVIEW_FINDINGS_MAX,
169
+ REVIEW_FINDING_ID_MAX_CHARS: () => REVIEW_FINDING_ID_MAX_CHARS,
170
+ REVIEW_FIX_MAX_CHARS: () => REVIEW_FIX_MAX_CHARS,
171
+ REVIEW_NOTE_MAX_CHARS: () => REVIEW_NOTE_MAX_CHARS,
172
+ REVIEW_TESTS_RUN_MAX: () => REVIEW_TESTS_RUN_MAX,
173
+ REVIEW_VERDICTS: () => REVIEW_VERDICTS,
174
+ RelayReprobeScheduler: () => RelayReprobeScheduler,
108
175
  SEND_POLICY_MODES: () => SEND_POLICY_MODES,
109
176
  SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
110
177
  SERVER_STATUS_EVENT_NAMES: () => SERVER_STATUS_EVENT_NAMES,
@@ -117,6 +184,17 @@ __export(index_exports, {
117
184
  SESSION_STATUS_ALIASES: () => SESSION_STATUS_ALIASES,
118
185
  SESSION_STATUS_CLASS: () => SESSION_STATUS_CLASS,
119
186
  SHARED_SESSION_TO_VIEWER_TYPES: () => SHARED_SESSION_TO_VIEWER_TYPES,
187
+ STAGE_BLOCKED_REASONS: () => STAGE_BLOCKED_REASONS,
188
+ STAGE_DECIDE_ACTIONS: () => STAGE_DECIDE_ACTIONS,
189
+ STAGE_DEFAULT_MAX_REVISIONS: () => STAGE_DEFAULT_MAX_REVISIONS,
190
+ STAGE_INDEPENDENCE_FALLBACK_MS: () => STAGE_INDEPENDENCE_FALLBACK_MS,
191
+ STAGE_INDEPENDENCE_MODES: () => STAGE_INDEPENDENCE_MODES,
192
+ STAGE_MAX_REVISIONS_LIMIT: () => STAGE_MAX_REVISIONS_LIMIT,
193
+ STAGE_PARKED_PHASES: () => STAGE_PARKED_PHASES,
194
+ STAGE_PHASES: () => STAGE_PHASES,
195
+ STAGE_PIPELINE_CEILING_DEFAULT_MS: () => STAGE_PIPELINE_CEILING_DEFAULT_MS,
196
+ STAGE_ROLES: () => STAGE_ROLES,
197
+ STAGE_SELF_CHECK_MAX_BOUNCES: () => STAGE_SELF_CHECK_MAX_BOUNCES,
120
198
  STATUS_PROBE_ARG_KEY: () => STATUS_PROBE_ARG_KEY,
121
199
  SUSPENSION_MODALS: () => SUSPENSION_MODALS,
122
200
  SUSPENSION_RESOLUTIONS: () => SUSPENSION_RESOLUTIONS,
@@ -142,17 +220,27 @@ __export(index_exports, {
142
220
  VERSION_UPDATE_REASONS: () => VERSION_UPDATE_REASONS,
143
221
  VIEWER_TO_SHARED_SESSION_TYPES: () => VIEWER_TO_SHARED_SESSION_TYPES,
144
222
  WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
223
+ WORKER_COMMITS_MAX: () => WORKER_COMMITS_MAX,
224
+ WORKER_CURRENT_BRANCH_RULE: () => WORKER_CURRENT_BRANCH_RULE,
225
+ WORKER_DECISIONS_NEEDED_MAX: () => WORKER_DECISIONS_NEEDED_MAX,
145
226
  WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
146
227
  WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
228
+ WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
229
+ WORKER_SHELL_LITERAL_PATHS_RULE: () => WORKER_SHELL_LITERAL_PATHS_RULE,
147
230
  WORKER_TOOLS: () => WORKER_TOOLS,
231
+ aggregateMissionGitState: () => aggregateMissionGitState,
148
232
  appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
149
233
  argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
150
234
  assessQuotaFreshness: () => assessQuotaFreshness,
235
+ boundEventPayload: () => boundEventPayload,
151
236
  buildSlotProposal: () => buildSlotProposal,
152
237
  canonicalDaemonId: () => canonicalDaemonId,
238
+ changelogMissionMarker: () => changelogMissionMarker,
239
+ classifyChangelogSection: () => classifyChangelogSection,
153
240
  classifySessionStatus: () => classifySessionStatus,
154
241
  compareDashboardWireVersion: () => compareDashboardWireVersion,
155
242
  compareSemver: () => compareSemver,
243
+ computeRelayReprobeDelay: () => computeRelayReprobeDelay,
156
244
  daemonIdsEquivalent: () => daemonIdsEquivalent,
157
245
  decodeActiveWorkQueryRequest: () => decodeActiveWorkQueryRequest,
158
246
  decodeActiveWorkQueryResponse: () => decodeActiveWorkQueryResponse,
@@ -195,6 +283,8 @@ __export(index_exports, {
195
283
  decodeQueueQueryResponse: () => decodeQueueQueryResponse,
196
284
  decodeQueueRequeueRequest: () => decodeQueueRequeueRequest,
197
285
  decodeQueueRequeueResponse: () => decodeQueueRequeueResponse,
286
+ decodeQueueReviseRequest: () => decodeQueueReviseRequest,
287
+ decodeQueueReviseResponse: () => decodeQueueReviseResponse,
198
288
  decodeRecordLocalRequest: () => decodeRecordLocalRequest,
199
289
  decodeRecordLocalResponse: () => decodeRecordLocalResponse,
200
290
  decodeRecoveryContextQueryRequest: () => decodeRecoveryContextQueryRequest,
@@ -214,6 +304,8 @@ __export(index_exports, {
214
304
  decodeUserSessionToDashboard: () => decodeUserSessionToDashboard,
215
305
  decodeViewerToSharedSession: () => decodeViewerToSharedSession,
216
306
  defaultProviderPriorityFromNodeFacts: () => defaultProviderPriorityFromNodeFacts,
307
+ defaultStagePlan: () => defaultStagePlan,
308
+ deriveItemDedupeKey: () => deriveItemDedupeKey,
217
309
  deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
218
310
  deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
219
311
  describeModelSelection: () => describeModelSelection,
@@ -224,14 +316,21 @@ __export(index_exports, {
224
316
  expandDaemonIdForms: () => expandDaemonIdForms,
225
317
  findOwnershipConflicts: () => findOwnershipConflicts,
226
318
  foldKeyedDoc: () => foldKeyedDoc,
319
+ followedRemoteProjectKey: () => followedRemoteProjectKey,
320
+ followerOpPermitted: () => followerOpPermitted,
227
321
  formatQuotaAccount: () => formatQuotaAccount,
322
+ formatStageVerdictLine: () => formatStageVerdictLine,
228
323
  hasGitStatusEvidence: () => hasGitStatusEvidence,
229
324
  hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
230
325
  interpolateString: () => interpolateString,
231
326
  isActionableProviderApproval: () => isActionableProviderApproval,
327
+ isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
232
328
  isAssistantTool: () => isAssistantTool,
233
329
  isBlockedStatus: () => isBlockedStatus,
330
+ isBlockingSeverity: () => isBlockingSeverity,
234
331
  isBusyStatus: () => isBusyStatus,
332
+ isCarryOverMissionRecord: () => isCarryOverMissionRecord,
333
+ isCarryOverMissionTitle: () => isCarryOverMissionTitle,
235
334
  isChunkType: () => isChunkType,
236
335
  isCommitStrength: () => isCommitStrength,
237
336
  isDaemonDirectCommandType: () => isDaemonDirectCommandType,
@@ -247,14 +346,21 @@ __export(index_exports, {
247
346
  isDeadStatus: () => isDeadStatus,
248
347
  isDowngrade: () => isDowngrade,
249
348
  isEvidenceIdentifier: () => isEvidenceIdentifier,
349
+ isFindingCategory: () => isFindingCategory,
350
+ isFindingResponseKind: () => isFindingResponseKind,
351
+ isFindingSeverity: () => isFindingSeverity,
250
352
  isFiniteNumber: () => isFiniteNumber,
251
353
  isIdleSessionState: () => isIdleSessionState,
252
354
  isInputEnvelopeWire: () => isInputEnvelopeWire,
355
+ isLaunchDefaultRole: () => isLaunchDefaultRole,
356
+ isLaunchDefaultSource: () => isLaunchDefaultSource,
357
+ isLightWorkerSession: () => isLightWorkerSession,
253
358
  isMeshDeliveryMode: () => isMeshDeliveryMode,
254
359
  isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
255
360
  isMeshMissionStatusValue: () => isMeshMissionStatusValue,
256
361
  isMeshP2PSignalType: () => isMeshP2PSignalType,
257
362
  isMeshRecordPayload: () => isMeshRecordPayload,
363
+ isMeshReleaseChannel: () => isMeshReleaseChannel,
258
364
  isMeshTaskDifficulty: () => isMeshTaskDifficulty,
259
365
  isMeshTaskMode: () => isMeshTaskMode,
260
366
  isMeshTaskPriority: () => isMeshTaskPriority,
@@ -262,6 +368,8 @@ __export(index_exports, {
262
368
  isMeshTerminalTaskStatus: () => isMeshTerminalTaskStatus,
263
369
  isMeshTopicEntry: () => isMeshTopicEntry,
264
370
  isMessageId: () => isMessageId,
371
+ isMissionOutcome: () => isMissionOutcome,
372
+ isMissionRefContained: () => isMissionRefContained,
265
373
  isMissionUpsertResponse: () => isMissionUpsertResponse,
266
374
  isModelAxisSource: () => isModelAxisSource,
267
375
  isNativeMarkerRef: () => isNativeMarkerRef,
@@ -271,10 +379,13 @@ __export(index_exports, {
271
379
  isOutboundMessageOrigin: () => isOutboundMessageOrigin,
272
380
  isP2PSignalType: () => isP2PSignalType,
273
381
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
382
+ isPriorFindingStatus: () => isPriorFindingStatus,
274
383
  isProviderQuestionBinding: () => isProviderQuestionBinding,
275
384
  isRawDaemonDoId: () => isRawDaemonDoId,
276
385
  isReadyStatus: () => isReadyStatus,
277
386
  isRecord: () => isRecord,
387
+ isReleaseStatus: () => isReleaseStatus,
388
+ isReviewVerdict: () => isReviewVerdict,
278
389
  isSendPolicy: () => isSendPolicy,
279
390
  isSendPolicyMode: () => isSendPolicyMode,
280
391
  isSendRefusal: () => isSendRefusal,
@@ -283,6 +394,8 @@ __export(index_exports, {
283
394
  isSessionLaunchedBy: () => isSessionLaunchedBy,
284
395
  isSessionStatus: () => isSessionStatus,
285
396
  isSharedSessionToViewerType: () => isSharedSessionToViewerType,
397
+ isStageBlockedReason: () => isStageBlockedReason,
398
+ isStageEligibleTask: () => isStageEligibleTask,
286
399
  isSubmitOutcome: () => isSubmitOutcome,
287
400
  isSummaryRef: () => isSummaryRef,
288
401
  isTerminalSessionRecordStatus: () => isTerminalSessionRecordStatus,
@@ -301,6 +414,7 @@ __export(index_exports, {
301
414
  isWorkingStatus: () => isWorkingStatus,
302
415
  joinRepoPath: () => joinRepoPath,
303
416
  launchModelSelectionValue: () => launchModelSelectionValue,
417
+ lintChangelogText: () => lintChangelogText,
304
418
  machineCoreFromDaemonId: () => machineCoreFromDaemonId,
305
419
  makeTypeGuard: () => makeTypeGuard,
306
420
  measureWorstCaseChunkEnvelopeBytes: () => measureWorstCaseChunkEnvelopeBytes,
@@ -312,20 +426,29 @@ __export(index_exports, {
312
426
  minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
313
427
  normalizeAuthOkLimits: () => normalizeAuthOkLimits,
314
428
  normalizeBrainSlot: () => normalizeBrainSlot,
429
+ normalizeDecisionInput: () => normalizeDecisionInput,
315
430
  normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
431
+ normalizeForDedupe: () => normalizeForDedupe,
316
432
  normalizeGitStatus: () => normalizeGitStatus,
317
433
  normalizeMeshNodeFacts: () => normalizeMeshNodeFacts,
318
434
  normalizeMeshNodeId: () => normalizeMeshNodeId,
319
435
  normalizeMeshSessionRecord: () => normalizeMeshSessionRecord,
320
436
  normalizeMeshWorkspaceForCompare: () => normalizeMeshWorkspaceForCompare,
321
437
  normalizeMissionBrief: () => normalizeMissionBrief,
438
+ normalizeMissionItemInput: () => normalizeMissionItemInput,
439
+ normalizeMissionItemUpdate: () => normalizeMissionItemUpdate,
440
+ normalizeMissionRefs: () => normalizeMissionRefs,
441
+ normalizeMissionSummary: () => normalizeMissionSummary,
322
442
  normalizeNodeCapabilitySlot: () => normalizeNodeCapabilitySlot,
323
443
  normalizeNodeCapabilitySlots: () => normalizeNodeCapabilitySlots,
444
+ normalizeOutcomeReason: () => normalizeOutcomeReason,
324
445
  normalizeOwnedPaths: () => normalizeOwnedPaths,
446
+ normalizeReportCommits: () => normalizeReportCommits,
325
447
  normalizeSessionStatus: () => normalizeSessionStatus,
326
448
  normalizeThinkingLevel: () => normalizeThinkingLevel,
327
449
  orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
328
450
  parseJsonRecord: () => parseJsonRecord,
451
+ parseRoleLaunchSelection: () => parseRoleLaunchSelection,
329
452
  parseSemver: () => parseSemver,
330
453
  parseSessionLaunchRecord: () => parseSessionLaunchRecord,
331
454
  pathsOverlap: () => pathsOverlap,
@@ -344,11 +467,17 @@ __export(index_exports, {
344
467
  readStringArray: () => readStringArray,
345
468
  readText: () => readText,
346
469
  renderCoordinatorWorkerSection: () => renderCoordinatorWorkerSection,
470
+ renderLightWorkspaceRules: () => renderLightWorkspaceRules,
347
471
  renderMissionBriefBlock: () => renderMissionBriefBlock,
472
+ renderStageProtocolLines: () => renderStageProtocolLines,
348
473
  renderWorkerProtocolFooter: () => renderWorkerProtocolFooter,
474
+ resolveStagePlan: () => resolveStagePlan,
349
475
  retiredMeshToolError: () => retiredMeshToolError,
476
+ reviewIndependenceOf: () => reviewIndependenceOf,
477
+ sanitizeDispatchRefusalDetail: () => sanitizeDispatchRefusalDetail,
350
478
  sanitizeModelIdentifier: () => sanitizeModelIdentifier,
351
479
  sanitizeRefusalCode: () => sanitizeRefusalCode,
480
+ sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
352
481
  scoreGitStatusCandidate: () => scoreGitStatusCandidate,
353
482
  scoreGitUpstreamFreshness: () => scoreGitUpstreamFreshness,
354
483
  sessionIdsEquivalent: () => sessionIdsEquivalent,
@@ -359,6 +488,11 @@ __export(index_exports, {
359
488
  summarizeGitShape: () => summarizeGitShape,
360
489
  supportsQuota: () => supportsQuota,
361
490
  touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
491
+ truncateMissionText: () => truncateMissionText,
492
+ unwrapPastedContent: () => unwrapPastedContent,
493
+ validateFindingResponses: () => validateFindingResponses,
494
+ validateReviewReport: () => validateReviewReport,
495
+ validateTestsRun: () => validateTestsRun,
362
496
  withStatusProbeMarker: () => withStatusProbeMarker
363
497
  });
364
498
  module.exports = __toCommonJS(index_exports);
@@ -559,15 +693,15 @@ function pickBestTransitGitStatus(node, options) {
559
693
  }
560
694
 
561
695
  // src/session-normalize.ts
562
- function deriveSyntheticSessionId(record) {
696
+ function deriveSyntheticSessionId(record2) {
563
697
  const parts = [
564
- readString(record.workspace),
565
- readString(record.providerType, record.provider),
566
- readString(record.role),
567
- readString(record.state, record.status),
568
- readString(record.title),
569
- readString(record.createdAt, record.created_at),
570
- 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)
571
705
  ].filter((part) => Boolean(part));
572
706
  if (parts.length === 0) return void 0;
573
707
  return `synthetic:${parts.join("|")}`;
@@ -579,33 +713,33 @@ function sessionIdsEquivalent(a, b) {
579
713
  return idA === idB;
580
714
  }
581
715
  function normalizeMeshSessionRecord(entry) {
582
- const record = readRecord(entry);
583
- 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);
584
718
  if (!sessionId) return null;
585
719
  return {
586
720
  sessionId,
587
- ...readString(record.providerType, record.provider) ? { providerType: readString(record.providerType, record.provider) } : {},
588
- ...readString(record.state, record.status) ? { state: readString(record.state, record.status) } : {},
589
- ...readString(record.chatStatus, record.chat_status) ? { chatStatus: readString(record.chatStatus, record.chat_status) } : {},
590
- ...readString(record.lifecycle) ? { lifecycle: readString(record.lifecycle) } : {},
591
- ...readString(record.surfaceKind, record.surface_kind) ? { surfaceKind: readString(record.surfaceKind, record.surface_kind) } : {},
592
- ...readString(record.recoveryState, record.recovery_state) ? { recoveryState: readString(record.recoveryState, record.recovery_state) } : {},
593
- ...readString(record.workspace) ? { workspace: readString(record.workspace) } : {},
594
- ...readString(record.title) ? { title: readString(record.title) } : {},
595
- ...readString(record.role) ? { role: readString(record.role) } : {},
596
- ...readBoolean(record.isSelfCoordinator, record.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record.isSelfCoordinator, record.is_self_coordinator) } : {},
597
- ...readString(record.statusNote, record.status_note) ? { statusNote: readString(record.statusNote, record.status_note) } : {},
598
- ...readString(record.createdAt, record.created_at) ? { createdAt: readString(record.createdAt, record.created_at) } : {},
599
- ...readString(record.startedAt, record.started_at) ? { startedAt: readString(record.startedAt, record.started_at) } : {},
600
- ...readString(record.lastActivityAt, record.last_activity_at) ? { lastActivityAt: readString(record.lastActivityAt, record.last_activity_at) } : {},
601
- ...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) } : {}
602
736
  };
603
737
  }
604
738
 
605
739
  // src/node-normalize.ts
606
740
  function normalizeMeshNodeId(node) {
607
- const record = node && typeof node === "object" ? node : {};
608
- 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);
609
743
  }
610
744
  function meshNodeIdMatches(node, candidateId) {
611
745
  if (!candidateId) return false;
@@ -617,12 +751,12 @@ function meshNodeIdMatches(node, candidateId) {
617
751
  // src/node-facts.ts
618
752
  function normalizeMeshNodeFacts(raw) {
619
753
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
620
- const record = raw;
621
- const schemaVersion = Number(record.schemaVersion);
622
- const reportedAt = Number(record.reportedAt);
754
+ const record2 = raw;
755
+ const schemaVersion = Number(record2.schemaVersion);
756
+ const reportedAt = Number(record2.reportedAt);
623
757
  if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
624
758
  if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
625
- return { ...record, schemaVersion, reportedAt };
759
+ return { ...record2, schemaVersion, reportedAt };
626
760
  }
627
761
  var QUOTA_SUPPORTED_PROVIDERS = [
628
762
  "antigravity-cli",
@@ -672,7 +806,7 @@ function hasUsableWindow(window) {
672
806
  return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
673
807
  }
674
808
  function hasReading(quota) {
675
- if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly)) return true;
809
+ if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
676
810
  return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
677
811
  }
678
812
  function finiteMs(value) {
@@ -690,9 +824,17 @@ function backfillCheckAt(quota, now) {
690
824
  function assessQuotaFreshness(quota, now = Date.now()) {
691
825
  const meta = quota.metadata;
692
826
  const kind = meta?.failureKind;
693
- const userMustAct = kind === "no-data" && quota.provider !== "codex-cli" || kind === "expired-token" && quota.provider === "antigravity-cli";
694
- if (userMustAct && hasReading(quota)) return { cue: "stale", userMustAct: true };
695
- if (meta?.lastGoodWindows !== true) return { userMustAct };
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
+ }
696
838
  const retryAtMs = finiteMs(meta?.retryAtMs);
697
839
  const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
698
840
  if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
@@ -732,19 +874,21 @@ function isPhantomDaemonEntry(entry) {
732
874
  function machineCoreFromDaemonId(id2) {
733
875
  const trimmed = readString(id2);
734
876
  if (!trimmed) return void 0;
877
+ const lower = trimmed.toLowerCase();
735
878
  for (const prefix of DAEMON_ID_PREFIXES) {
736
- if (trimmed.startsWith(prefix)) {
879
+ if (lower.startsWith(prefix)) {
737
880
  const core = trimmed.slice(prefix.length).trim();
738
- return core || void 0;
881
+ if (!core) return void 0;
882
+ return /^mach_/i.test(core) ? `mach_${core.slice(5)}` : core;
739
883
  }
740
884
  }
741
- return trimmed;
885
+ return /^mach_/i.test(trimmed) ? `mach_${trimmed.slice(5)}` : trimmed;
742
886
  }
743
887
  function canonicalDaemonId(id2) {
744
888
  const core = machineCoreFromDaemonId(id2);
745
889
  if (!core) return void 0;
746
- if (!core.startsWith("mach_")) return core;
747
- return `daemon_${core}`;
890
+ if (!/^mach_/i.test(core)) return core;
891
+ return `daemon_mach_${core.slice(5)}`;
748
892
  }
749
893
  function daemonIdsEquivalent(a, b) {
750
894
  const coreA = machineCoreFromDaemonId(a);
@@ -773,9 +917,9 @@ function expandDaemonIdForms(ids) {
773
917
 
774
918
  // src/git-summarize.ts
775
919
  function summarizeGitShape(status) {
776
- const record = readRecord(status);
777
- if (!Object.keys(record).length) return null;
778
- 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) => {
779
923
  const sub = readRecord(entry);
780
924
  return {
781
925
  path: readString(sub.path) ?? null,
@@ -785,23 +929,23 @@ function summarizeGitShape(status) {
785
929
  };
786
930
  }) : [];
787
931
  return {
788
- isGitRepo: readBoolean(record.isGitRepo),
789
- workspace: readString(record.workspace) ?? null,
790
- repoRoot: readString(record.repoRoot, record.repo_root) ?? null,
791
- branch: readString(record.branch) ?? null,
792
- upstream: readString(record.upstream) ?? null,
793
- upstreamStatus: readString(record.upstreamStatus, record.upstream_status) ?? null,
794
- headCommit: readString(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
795
- ahead: readNumber(record.ahead) ?? null,
796
- 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,
797
941
  dirtyCounts: {
798
- staged: readNumber(record.staged) ?? 0,
799
- modified: readNumber(record.modified) ?? 0,
800
- untracked: readNumber(record.untracked) ?? 0,
801
- deleted: readNumber(record.deleted) ?? 0,
802
- 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
803
947
  },
804
- lastCheckedAt: readNumber(record.lastCheckedAt, record.last_checked_at) ?? null,
948
+ lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
805
949
  submoduleCount: submodules.length,
806
950
  submodules
807
951
  };
@@ -967,10 +1111,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
967
1111
  ],
968
1112
  "antigravity-cli": [
969
1113
  {
970
- 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)"],
971
1116
  difficulty: ["easy"],
972
1117
  maxParallel: 2,
973
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."
974
1133
  }
975
1134
  ],
976
1135
  "cursor-cli": [
@@ -1009,6 +1168,24 @@ function dedupeDetected(detected) {
1009
1168
  }
1010
1169
  return out;
1011
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
+ }
1012
1189
  function buildSlotProposal(detected, currentSlots = []) {
1013
1190
  const providers = dedupeDetected(detected ?? []);
1014
1191
  const proposedSlots = [];
@@ -1024,7 +1201,7 @@ function buildSlotProposal(detected, currentSlots = []) {
1024
1201
  for (const recipe of recipes) {
1025
1202
  const slot = normalizeNodeCapabilitySlot({
1026
1203
  provider: provider.type,
1027
- model: recipe.model,
1204
+ model: resolveRecipeModel(recipe, provider.modelOptions),
1028
1205
  thinkingLevel: recipe.thinkingLevel,
1029
1206
  difficulty: recipe.difficulty,
1030
1207
  maxParallel: recipe.maxParallel
@@ -1077,7 +1254,12 @@ var CANONICAL_MESH_TOOL_NAMES = [
1077
1254
  "mesh_enqueue_task",
1078
1255
  "mesh_view_queue",
1079
1256
  "mesh_queue_cancel",
1257
+ "mesh_task_stage_decide",
1258
+ "mesh_direct_cancel",
1080
1259
  "mesh_queue_requeue",
1260
+ "mesh_queue_revise",
1261
+ "mesh_light_land",
1262
+ "mesh_light_discard",
1081
1263
  "mesh_send_task",
1082
1264
  "mesh_read_chat",
1083
1265
  "mesh_read_debug",
@@ -1094,8 +1276,13 @@ var CANONICAL_MESH_TOOL_NAMES = [
1094
1276
  "mesh_list_pending_approvals",
1095
1277
  "mesh_create",
1096
1278
  "mesh_add_node",
1279
+ "mesh_reattach_source_parent",
1280
+ "mesh_attach_remote",
1281
+ "mesh_host_pairing",
1097
1282
  "mesh_clone_node",
1098
1283
  "mesh_remove_node",
1284
+ "mesh_retry_node_bootstrap",
1285
+ "mesh_recover_node_identity",
1099
1286
  "mesh_cleanup_worktree_nodes",
1100
1287
  "mesh_refine_node",
1101
1288
  "mesh_refine_batch",
@@ -1112,8 +1299,20 @@ var CANONICAL_MESH_TOOL_NAMES = [
1112
1299
  "mesh_reconcile_ledger",
1113
1300
  "mesh_mission_upsert",
1114
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",
1115
1309
  "mesh_review_inbox",
1116
- "mesh_node_slots"
1310
+ "mesh_node_slots",
1311
+ "driver_list",
1312
+ "driver_describe",
1313
+ "artifact_list",
1314
+ "artifact_read",
1315
+ "artifact_register"
1117
1316
  ];
1118
1317
  var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
1119
1318
  var RETIRED_MESH_TOOLS = {
@@ -1423,9 +1622,15 @@ var DAEMON_STATUS_EVENT_NAMES = [
1423
1622
  "agent:waiting_choice",
1424
1623
  "agent:generating_completed",
1425
1624
  "agent:stopped",
1426
- "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"
1427
1629
  ];
1428
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;
1429
1634
  var RELEASE_CHANNELS = ["stable", "preview"];
1430
1635
  var NPM_UPDATE_TAGS = ["latest", "next"];
1431
1636
  var VERSION_UPDATE_REASONS = ["force_update_below", "major_minor_mismatch", "patch_mismatch", "daemon_ahead"];
@@ -1788,21 +1993,22 @@ function isTerminalSessionRecordStatus(raw) {
1788
1993
  return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
1789
1994
  }
1790
1995
  function isIdleSessionState(state) {
1791
- const record = state && typeof state === "object" ? state : {};
1792
- 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() : "";
1793
1998
  if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
1794
- return isReadyStatus(status) || record.activeChat?.status === "waiting_input";
1999
+ return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
1795
2000
  }
1796
2001
 
1797
2002
  // src/mesh-vocabulary.ts
1798
- var MESH_TASK_STATUSES = ["pending", "assigned", "completed", "failed", "cancelled"];
1799
- 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"];
1800
2005
  var MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
1801
2006
  var MESH_TASK_PRIORITIES = ["low", "normal", "high"];
1802
2007
  var MESH_THINKING_LEVELS = ["low", "medium", "high"];
1803
2008
  var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
1804
2009
  var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
1805
2010
  var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
2011
+ var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
1806
2012
  var WORKER_BRANCH_STATES = [
1807
2013
  "merged_to_main",
1808
2014
  "pushed_feature_branch_needs_merge",
@@ -1869,6 +2075,7 @@ var SEND_REFUSAL_REASONS = [
1869
2075
  "no_target",
1870
2076
  "bootstrap_pending",
1871
2077
  "duplicate_dispatch",
2078
+ "new_work_held",
1872
2079
  "internal_error"
1873
2080
  ];
1874
2081
  function isSendRefusal(value) {
@@ -1900,6 +2107,14 @@ function isOutboundMessage(value) {
1900
2107
  const candidate = value;
1901
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";
1902
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
+ }
1903
2118
 
1904
2119
  // src/mission-brief.ts
1905
2120
  var GOAL_MAX = 500;
@@ -1985,13 +2200,39 @@ var WORKER_TOOLS = [
1985
2200
  "peer_context_pull",
1986
2201
  "git_status",
1987
2202
  "git_log",
1988
- "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"
1989
2219
  ];
1990
2220
  var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
1991
2221
  function isWorkerTool(value) {
1992
2222
  return typeof value === "string" && WORKER_TOOL_SET.has(value);
1993
2223
  }
1994
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.";
1995
2236
  function hasWorkerProtocolFooter(body) {
1996
2237
  return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
1997
2238
  }
@@ -2013,6 +2254,9 @@ function renderWorkerProtocolFooter(input = {}) {
2013
2254
  if (input.readonly) scope.push("read-only");
2014
2255
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
2015
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);
2016
2260
  if (input.workerMcp === false) {
2017
2261
  lines.push(
2018
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.",
@@ -2032,15 +2276,30 @@ function renderWorkerProtocolFooter(input = {}) {
2032
2276
  "Memos from the coordinator arrive appended to the response of whichever worker tool you call next; read them and follow them.",
2033
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`.",
2034
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 `[]`.",
2035
- "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."
2036
2282
  );
2037
2283
  if (input.enclosedHandoffNotes && input.enclosedHandoffNotes > 0) {
2038
2284
  lines.push(
2039
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.`
2040
2286
  );
2041
2287
  }
2288
+ if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
2042
2289
  return lines.join("\n");
2043
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
+ }
2044
2303
  function stripWorkerProtocolFooter(body) {
2045
2304
  if (typeof body !== "string") return body;
2046
2305
  const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
@@ -2077,11 +2336,23 @@ var ASSISTANT_TOOLS = [
2077
2336
  "project_send",
2078
2337
  "project_read",
2079
2338
  "project_add",
2339
+ "project_attach_remote",
2080
2340
  "discover_repos",
2081
2341
  "memory",
2342
+ "memory_search",
2082
2343
  "skill_view",
2083
2344
  "skill_manage",
2084
- "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"
2085
2356
  ];
2086
2357
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
2087
2358
  function isAssistantTool(value) {
@@ -2089,6 +2360,8 @@ function isAssistantTool(value) {
2089
2360
  }
2090
2361
  var ASSISTANT_VERB = {
2091
2362
  // tool verbs
2363
+ driverList: "driver_list",
2364
+ driverDescribe: "driver_describe",
2092
2365
  projects: "assistant_projects",
2093
2366
  environment: "assistant_environment",
2094
2367
  action: "assistant_action",
@@ -2099,20 +2372,46 @@ var ASSISTANT_VERB = {
2099
2372
  projectSend: "assistant_project_send",
2100
2373
  projectRead: "assistant_project_read",
2101
2374
  projectAdd: "assistant_project_add",
2375
+ projectAttachRemote: "assistant_project_attach_remote",
2102
2376
  discoverRepos: "assistant_discover_repos",
2103
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",
2104
2380
  skillView: "assistant_skill_view",
2105
2381
  skillManage: "assistant_skill_manage",
2106
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",
2107
2395
  // assistant-side daemon verbs without a tool of the same name
2108
2396
  launch: "launch_assistant",
2109
2397
  pendingRelays: "assistant_pending_relays",
2110
2398
  // owner verbs (dashboard only)
2111
2399
  stagedResolve: "assistant_staged_resolve",
2112
2400
  storeAdmin: "assistant_store_admin",
2113
- 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"
2114
2411
  };
2115
2412
  var ASSISTANT_TOOL_VERBS = {
2413
+ driver_list: ASSISTANT_VERB.driverList,
2414
+ driver_describe: ASSISTANT_VERB.driverDescribe,
2116
2415
  projects: ASSISTANT_VERB.projects,
2117
2416
  environment: ASSISTANT_VERB.environment,
2118
2417
  assistant_action: ASSISTANT_VERB.action,
@@ -2121,27 +2420,110 @@ var ASSISTANT_TOOL_VERBS = {
2121
2420
  project_send: ASSISTANT_VERB.projectSend,
2122
2421
  project_read: ASSISTANT_VERB.projectRead,
2123
2422
  project_add: ASSISTANT_VERB.projectAdd,
2423
+ project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
2124
2424
  discover_repos: ASSISTANT_VERB.discoverRepos,
2125
2425
  memory: ASSISTANT_VERB.memory,
2426
+ memory_search: ASSISTANT_VERB.memorySearch,
2126
2427
  skill_view: ASSISTANT_VERB.skillView,
2127
2428
  skill_manage: ASSISTANT_VERB.skillManage,
2128
- 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
2129
2438
  };
2130
- var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "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"];
2131
2440
  var ASSISTANT_OWNER_VERBS = [
2132
2441
  ASSISTANT_VERB.executionSettings,
2133
2442
  ASSISTANT_VERB.stagedResolve,
2134
2443
  ASSISTANT_VERB.storeAdmin,
2135
- ASSISTANT_VERB.importSkills
2444
+ ASSISTANT_VERB.importSkills,
2445
+ ASSISTANT_VERB.skillsList,
2446
+ ASSISTANT_VERB.memoryDigest,
2447
+ ASSISTANT_VERB.memoryUndo,
2448
+ ASSISTANT_VERB.threadClose
2136
2449
  ];
2137
2450
  var ASSISTANT_REVIEW_TURN_VERBS = [
2138
2451
  ASSISTANT_VERB.memory,
2452
+ ASSISTANT_VERB.memorySearch,
2139
2453
  ASSISTANT_VERB.skillView,
2140
2454
  ASSISTANT_VERB.skillManage,
2141
2455
  ASSISTANT_VERB.projectNote
2142
2456
  ];
2143
2457
  var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
2144
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
+ }
2145
2527
 
2146
2528
  // src/turn-evidence.ts
2147
2529
  var MESH_TOPIC_PROTOCOL_VERSION = 2;
@@ -2177,13 +2559,24 @@ var TURN_SCOPES = ["mesh_queue", "mesh_direct", "plain"];
2177
2559
  var RECLAIMING_SEND_REFUSALS = ["session_exited", "no_target", "unsupported_input"];
2178
2560
  var DELIVERY_OUTCOMES = ["delivered", "queued"];
2179
2561
  var DELIVERY_VIAS = ["local", "p2p"];
2180
- 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"];
2181
2563
  function sanitizeRefusalCode(value) {
2182
2564
  if (typeof value !== "string") return void 0;
2183
2565
  const normalized = value.trim().toLowerCase().replace(/[^a-z_]/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
2184
2566
  if (!normalized) return void 0;
2185
2567
  return normalized.slice(0, 64);
2186
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
+ }
2187
2580
  var CONSUME_PROFILES = ["default", "native_source"];
2188
2581
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2189
2582
  var SUSPENSION_MODALS = ["approval", "choice"];
@@ -2225,9 +2618,13 @@ var HOLD_REASONS = [
2225
2618
  // — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
2226
2619
  // a session whose FSM never shows the idle edge again does not wait for
2227
2620
  // liveness / hard_ceiling.
2228
- "await_end"
2621
+ "await_end",
2622
+ "report_correction",
2623
+ // A generating mesh attempt with no output/activity for `stallReclaimMs`: expiry reclaims it
2624
+ // (`stalled_no_output`) instead of waiting for the hard ceiling. Re-armed by every output.
2625
+ "stall_ceiling"
2229
2626
  ];
2230
- var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
2627
+ var TURN_OUTCOMES = ["completed", "blocked", "failed", "cancelled"];
2231
2628
  var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
2232
2629
  var TURN_REASONS = [
2233
2630
  // commits
@@ -2236,6 +2633,10 @@ var TURN_REASONS = [
2236
2633
  "transcript_final",
2237
2634
  "worker_reported",
2238
2635
  "finalization_timeout_no_response",
2636
+ "weak_end_liveness_unconfirmed",
2637
+ "weak_end_probe_unobserved",
2638
+ "report_correction_expired",
2639
+ "report_missing_timeout",
2239
2640
  "session_error",
2240
2641
  "provider_auth_failed",
2241
2642
  "provider_billing_failed",
@@ -2254,6 +2655,8 @@ var TURN_REASONS = [
2254
2655
  "reclaim_budget_exhausted",
2255
2656
  "hollow_max_retries",
2256
2657
  "migration_orphan",
2658
+ // a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
2659
+ "writer_unreachable",
2257
2660
  // reclaims (generation + 1)
2258
2661
  "dispatch_refused_session_exited",
2259
2662
  "dispatch_refused_no_target",
@@ -2265,10 +2668,13 @@ var TURN_REASONS = [
2265
2668
  "hollow_completion",
2266
2669
  "assigned_stranded_dispatch_unconfirmed",
2267
2670
  "delivered_not_consumed_redrive",
2268
- "delivered_no_turn_deadline"
2671
+ "delivered_no_turn_deadline",
2672
+ // a generating worker produced no output/activity for the stall reclaim bound
2673
+ "stalled_no_output"
2269
2674
  ];
2270
2675
  var NOTIFY_KINDS = [
2271
2676
  "completed",
2677
+ "blocked",
2272
2678
  "failed",
2273
2679
  "cancelled",
2274
2680
  "stopped",
@@ -2343,7 +2749,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2343
2749
  },
2344
2750
  transcript_activity: { newestActivityAt: ms },
2345
2751
  no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
2346
- liveness: { result: en(LIVENESS_RESULTS) },
2752
+ liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
2347
2753
  process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
2348
2754
  session_error: { reason: en(SESSION_ERROR_REASONS) },
2349
2755
  worker_report: {
@@ -2353,6 +2759,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2353
2759
  branchState: enOpt(WORKER_BRANCH_STATES),
2354
2760
  touchedFileCount: intOpt
2355
2761
  },
2762
+ worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
2356
2763
  worker_progress: { note: { t: "summary_ref", optional: true } },
2357
2764
  git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
2358
2765
  cancel: { reason: en(CANCEL_REASONS) },
@@ -2523,17 +2930,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
2523
2930
  };
2524
2931
  }
2525
2932
 
2933
+ // src/launch-defaults.ts
2934
+ var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
2935
+ var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
2936
+ var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
2937
+ function isLaunchDefaultRole(value) {
2938
+ return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
2939
+ }
2940
+ function isLaunchDefaultSource(value) {
2941
+ return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
2942
+ }
2943
+ var LAUNCH_DEFAULT_ERROR_CODES = [
2944
+ "invalid_args",
2945
+ "launch_default_required",
2946
+ "launch_default_unavailable",
2947
+ "launch_selection_invalid",
2948
+ "launch_default_invalid",
2949
+ "revision_conflict",
2950
+ "store_unavailable",
2951
+ "store_busy",
2952
+ "persistence_failed",
2953
+ "project_not_found",
2954
+ "project_ambiguous",
2955
+ "project_not_hosted",
2956
+ "project_storage_unavailable",
2957
+ "staging_unavailable",
2958
+ "staging_failed",
2959
+ "review_turn_tool_denied"
2960
+ ];
2961
+
2962
+ // src/role-launch.ts
2963
+ function record(value) {
2964
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2965
+ }
2966
+ function ref(value) {
2967
+ const r = record(value);
2968
+ 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;
2969
+ return {
2970
+ role: r.role,
2971
+ scope: r.scope,
2972
+ revision: r.revision,
2973
+ ...r.scope === "project" ? { projectId: r.projectId } : {}
2974
+ };
2975
+ }
2976
+ function axis(value) {
2977
+ const a = record(value);
2978
+ if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
2979
+ const defaultRef = ref(a.defaultRef);
2980
+ 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;
2981
+ return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
2982
+ }
2983
+ function parseRoleLaunchSelection(value) {
2984
+ const r = record(value), s = record(r?.selection), a = record(r?.applied);
2985
+ 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;
2986
+ const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
2987
+ 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;
2988
+ const defaultRef = ref(r.defaultRef);
2989
+ return {
2990
+ role: r.role,
2991
+ selection: {
2992
+ provider: s.provider,
2993
+ ...typeof s.model === "string" ? { model: s.model } : {},
2994
+ ...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
2995
+ },
2996
+ applied: { provider, model, thinkingLevel },
2997
+ ...defaultRef ? { defaultRef } : {},
2998
+ documentRevision: r.documentRevision
2999
+ };
3000
+ }
3001
+
2526
3002
  // src/session-launch.ts
2527
3003
  var MODEL_AXIS_SOURCES = [
2528
3004
  /** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
2529
3005
  "user",
2530
3006
  /** The dashboard dialog restored it from the last launch (browser-local memory). */
2531
3007
  "remembered",
3008
+ /** The authoritative daemon role default or host project override. */
3009
+ "stored_default",
3010
+ "project_default",
2532
3011
  /** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
2533
3012
  "mesh_slot",
2534
3013
  /** An explicit per-task model / thinking level on a mesh queue task. */
2535
3014
  "task_override",
2536
- /** Nothing was requested; the provider's default is known (discovery / manifest). */
3015
+ /** Nothing requested: the provider chooses; resolvedDefault records it when known. */
2537
3016
  "provider_default",
2538
3017
  /** A value was requested without saying where it came from, or nothing is known. */
2539
3018
  "unspecified"
@@ -2577,10 +3056,10 @@ function readFiniteNumber(value) {
2577
3056
  }
2578
3057
  function parseModelSelection(raw) {
2579
3058
  if (!raw || typeof raw !== "object") return void 0;
2580
- const record = raw;
3059
+ const record2 = raw;
2581
3060
  const history = [];
2582
- if (Array.isArray(record.history)) {
2583
- for (const entry of record.history) {
3061
+ if (Array.isArray(record2.history)) {
3062
+ for (const entry of record2.history) {
2584
3063
  if (!entry || typeof entry !== "object") continue;
2585
3064
  const e = entry;
2586
3065
  const value = readString(e.value);
@@ -2589,41 +3068,45 @@ function parseModelSelection(raw) {
2589
3068
  if (value && at !== void 0 && via) history.push({ at, value, via });
2590
3069
  }
2591
3070
  }
2592
- const requested = readString(record.requested);
2593
- const launchValue = readString(record.launchValue);
2594
- const resolvedDefault = readString(record.resolvedDefault);
2595
- const current = readString(record.current);
2596
- const observed = readString(record.observed);
2597
- const observedAt = readFiniteNumber(record.observedAt);
3071
+ const requested = readString(record2.requested);
3072
+ const launchValue = readString(record2.launchValue);
3073
+ const resolvedDefault = readString(record2.resolvedDefault);
3074
+ const current = readString(record2.current);
3075
+ const observed = readString(record2.observed);
3076
+ const observedAt = readFiniteNumber(record2.observedAt);
3077
+ const fallback = record2.fallback === true;
2598
3078
  return {
2599
- source: isModelAxisSource(record.source) ? record.source : "unspecified",
3079
+ source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
2600
3080
  ...requested ? { requested } : {},
2601
3081
  ...launchValue ? { launchValue } : {},
2602
3082
  ...resolvedDefault ? { resolvedDefault } : {},
2603
3083
  ...current ? { current } : {},
2604
3084
  ...observed ? { observed } : {},
2605
3085
  ...observedAt !== void 0 ? { observedAt } : {},
3086
+ ...fallback ? { fallback } : {},
2606
3087
  history: history.slice(-MODEL_SELECTION_HISTORY_LIMIT)
2607
3088
  };
2608
3089
  }
2609
3090
  function parseSessionLaunchRecord(raw) {
2610
3091
  if (!raw || typeof raw !== "object") return void 0;
2611
- const record = raw;
2612
- const sessionId = readString(record.sessionId);
2613
- const providerType = readString(record.providerType);
2614
- const launchedAt = readFiniteNumber(record.launchedAt);
2615
- const model = parseModelSelection(record.model);
2616
- const thinkingLevel = parseModelSelection(record.thinkingLevel);
3092
+ const record2 = raw;
3093
+ const sessionId = readString(record2.sessionId);
3094
+ const providerType = readString(record2.providerType);
3095
+ const launchedAt = readFiniteNumber(record2.launchedAt);
3096
+ const model = parseModelSelection(record2.model);
3097
+ const thinkingLevel = parseModelSelection(record2.thinkingLevel);
2617
3098
  if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
2618
- const providerVersion = readString(record.providerVersion);
2619
- const workspace = readString(record.workspace);
2620
- const autoApproveModeId = readString(record.autoApproveModeId);
3099
+ const providerVersion = readString(record2.providerVersion);
3100
+ const workspace = readString(record2.workspace);
3101
+ const autoApproveModeId = readString(record2.autoApproveModeId);
3102
+ const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
2621
3103
  return {
3104
+ ...roleLaunch ? { roleLaunch } : {},
2622
3105
  sessionId,
2623
3106
  providerType,
2624
3107
  ...providerVersion ? { providerVersion } : {},
2625
- ...record.providerChannel === "stable" || record.providerChannel === "preview" ? { providerChannel: record.providerChannel } : {},
2626
- launchedBy: isSessionLaunchedBy(record.launchedBy) ? record.launchedBy : "api",
3108
+ ...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
3109
+ launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
2627
3110
  launchedAt,
2628
3111
  ...workspace ? { workspace } : {},
2629
3112
  model,
@@ -2687,7 +3170,7 @@ function isTurnAttemptRefValue(value) {
2687
3170
  function isTurnObserveResponse(value) {
2688
3171
  return isRecord(value) && hasOnlyKeys2(value, ["verdict", "attemptRef", "outcome"]) && isTurnObserveVerdict(value.verdict) && isTurnAttemptRefValue(value.attemptRef) && (value.outcome === void 0 || isTurnOutcomeValue(value.outcome));
2689
3172
  }
2690
- var TURN_OUTCOMES_LOCAL = ["completed", "failed", "cancelled"];
3173
+ var TURN_OUTCOMES_LOCAL = ["completed", "blocked", "failed", "cancelled"];
2691
3174
  function isTurnOutcomeValue(value) {
2692
3175
  return typeof value === "string" && TURN_OUTCOMES_LOCAL.includes(value);
2693
3176
  }
@@ -2913,8 +3396,23 @@ function isMissionBriefWire(value) {
2913
3396
  }
2914
3397
  return true;
2915
3398
  }
3399
+ var STRUCTURED_MISSION_KEYS = ["summary", "releaseNote", "outcome", "outcomeReason", "version", "carryOver", "openItems"];
3400
+ function isOpenItemCountsWire(value) {
3401
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["remaining", "live_check", "decision", "evidence"])) return false;
3402
+ return ["remaining", "live_check", "decision", "evidence"].every((k) => isNonNegativeInt(value[k]));
3403
+ }
3404
+ function isStructuredMissionFields(value) {
3405
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3406
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3407
+ }
3408
+ if (value.version !== void 0 && !isNonNegativeInt(value.version)) return false;
3409
+ if (value.carryOver !== void 0 && typeof value.carryOver !== "boolean") return false;
3410
+ if (value.openItems !== void 0 && !isOpenItemCountsWire(value.openItems)) return false;
3411
+ return true;
3412
+ }
2916
3413
  function isMeshMissionRecordWire(value) {
2917
- if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief"])) return false;
3414
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["id", "meshId", "title", "goal", "status", "brief", ...STRUCTURED_MISSION_KEYS])) return false;
3415
+ if (!isStructuredMissionFields(value)) return false;
2918
3416
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
2919
3417
  if (typeof value.title !== "string" || typeof value.goal !== "string") return false;
2920
3418
  if (!isMeshMissionStatusValue(value.status)) return false;
@@ -2922,11 +3420,22 @@ function isMeshMissionRecordWire(value) {
2922
3420
  return true;
2923
3421
  }
2924
3422
  function isMissionUpsertRequest(value) {
2925
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief"])) return false;
3423
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "id", "title", "goal", "status", "brief", "structured", "summary", "releaseNote", "outcome", "outcomeReason", "carryOverTo", "toCarryOver", "itemsAdd", "itemsUpdate"])) return false;
2926
3424
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2927
3425
  if (!isEvidenceIdentifier(value.meshId)) return false;
2928
3426
  if (value.id !== void 0 && !isEvidenceIdentifier(value.id)) return false;
2929
- if (typeof value.title !== "string" || value.title.trim().length === 0) return false;
3427
+ if (typeof value.title !== "string") return false;
3428
+ if (value.title.trim().length === 0 && value.toCarryOver !== true && value.id === void 0) return false;
3429
+ if (value.structured !== void 0 && typeof value.structured !== "boolean") return false;
3430
+ if (value.toCarryOver !== void 0 && typeof value.toCarryOver !== "boolean") return false;
3431
+ for (const k of ["summary", "releaseNote", "outcome", "outcomeReason"]) {
3432
+ if (value[k] !== void 0 && typeof value[k] !== "string") return false;
3433
+ }
3434
+ if (value.carryOverTo !== void 0 && !isEvidenceIdentifier(value.carryOverTo)) return false;
3435
+ for (const k of ["itemsAdd", "itemsUpdate"]) {
3436
+ const list = value[k];
3437
+ if (list !== void 0 && (!Array.isArray(list) || list.length > 500 || !list.every(isRecord))) return false;
3438
+ }
2930
3439
  if (value.goal !== void 0 && typeof value.goal !== "string") return false;
2931
3440
  if (value.status !== void 0 && !isMeshMissionStatusValue(value.status)) return false;
2932
3441
  if (value.brief !== void 0 && value.brief !== null && !isMissionBriefWire(value.brief)) return false;
@@ -2936,7 +3445,7 @@ function decodeMissionUpsertRequest(value) {
2936
3445
  return isMissionUpsertRequest(value) ? value : null;
2937
3446
  }
2938
3447
  function isMissionUpsertResponse(value) {
2939
- return isRecord(value) && hasOnlyKeys2(value, ["mission"]) && isMeshMissionRecordWire(value.mission);
3448
+ return isRecord(value) && hasOnlyKeys2(value, ["mission", "result"]) && isMeshMissionRecordWire(value.mission) && (value.result === void 0 || isRecord(value.result));
2940
3449
  }
2941
3450
  function decodeMissionUpsertResponse(value) {
2942
3451
  return isMissionUpsertResponse(value) ? value : null;
@@ -2962,7 +3471,10 @@ function decodeMissionQueryResponse(value) {
2962
3471
  return isMissionQueryResponse(value) ? value : null;
2963
3472
  }
2964
3473
  function isMissionListQueryRequest(value) {
2965
- if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView"])) return false;
3474
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["v", "meshId", "statuses", "verbose", "withStats", "limit", "historyIdLimit", "meshStatusView", "structured", "items", "history"])) return false;
3475
+ for (const k of ["structured", "items", "history"]) {
3476
+ if (value[k] !== void 0 && typeof value[k] !== "boolean") return false;
3477
+ }
2966
3478
  if (value.meshStatusView !== void 0 && value.meshStatusView !== "compact" && value.meshStatusView !== "verbose") return false;
2967
3479
  if (value.v !== TURN_IPC_PROTOCOL_VERSION) return false;
2968
3480
  if (!isEvidenceIdentifier(value.meshId)) return false;
@@ -2988,12 +3500,13 @@ function isMeshMissionTaskAggregateWire(value) {
2988
3500
  return value.lastActivityAt === null || typeof value.lastActivityAt === "string";
2989
3501
  }
2990
3502
  function isMeshMissionStatsWire(value) {
2991
- const keys = ["missionId", "taskCount", "completed", "failed", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
3503
+ const keys = ["missionId", "taskCount", "completed", "failed", "blocked", "totalDurationMs", "wallClockMs", "retries", "incompleteTaskIds"];
2992
3504
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
2993
3505
  if (!isEvidenceIdentifier(value.missionId)) return false;
2994
3506
  for (const k of ["taskCount", "completed", "failed", "totalDurationMs", "retries"]) {
2995
3507
  if (!isNonNegativeInt(value[k])) return false;
2996
3508
  }
3509
+ if (value.blocked !== void 0 && !isNonNegativeInt(value.blocked)) return false;
2997
3510
  if (value.wallClockMs !== null && !isNonNegativeInt(value.wallClockMs)) return false;
2998
3511
  if (!Array.isArray(value.incompleteTaskIds) || !value.incompleteTaskIds.every(isEvidenceIdentifier)) return false;
2999
3512
  return true;
@@ -3003,7 +3516,7 @@ function isMissionListSummaryWire(value) {
3003
3516
  const hasGoal = "goal" in value;
3004
3517
  const hasPreview = "goalPreview" in value && "goalTruncated" in value;
3005
3518
  if (hasGoal === hasPreview) return false;
3006
- const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt"];
3519
+ const baseKeys = ["id", "meshId", "title", "status", "tasks", "stats", "brief", "createdAt", "updatedAt", "closeCandidateEmittedAt", ...STRUCTURED_MISSION_KEYS, "items", "history"];
3007
3520
  const allowed = hasGoal ? [...baseKeys, "goal"] : [...baseKeys, "goalPreview", "goalTruncated"];
3008
3521
  if (!hasOnlyKeys2(value, allowed)) return false;
3009
3522
  if (!isEvidenceIdentifier(value.id) || !isEvidenceIdentifier(value.meshId)) return false;
@@ -3017,6 +3530,10 @@ function isMissionListSummaryWire(value) {
3017
3530
  if (value.createdAt !== void 0 && typeof value.createdAt !== "string") return false;
3018
3531
  if (value.updatedAt !== void 0 && typeof value.updatedAt !== "string") return false;
3019
3532
  if (value.closeCandidateEmittedAt !== void 0 && value.closeCandidateEmittedAt !== null && typeof value.closeCandidateEmittedAt !== "string") return false;
3533
+ if (!isStructuredMissionFields(value)) return false;
3534
+ for (const k of ["items", "history"]) {
3535
+ if (value[k] !== void 0 && (!Array.isArray(value[k]) || !value[k].every(isRecord))) return false;
3536
+ }
3020
3537
  return true;
3021
3538
  }
3022
3539
  function isMeshMissionHistoryFoldWire(value) {
@@ -3115,12 +3632,15 @@ function isLedgerQueryEntryWire(value) {
3115
3632
  return true;
3116
3633
  }
3117
3634
  function isLedgerQuerySummaryWire(value) {
3118
- const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
3635
+ const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed", "recentRefineFailures"];
3119
3636
  if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
3120
3637
  if (!isEvidenceIdentifier(value.meshId)) return false;
3121
3638
  for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
3122
3639
  if (!isNonNegativeInt(value[k])) return false;
3123
3640
  }
3641
+ if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
3642
+ if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
3643
+ if (value.recentRefineFailures !== void 0 && !isNonNegativeInt(value.recentRefineFailures)) return false;
3124
3644
  if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
3125
3645
  return true;
3126
3646
  }
@@ -3164,9 +3684,10 @@ function isQueueDependencyHeadWire(value) {
3164
3684
  return isRecord(value) && hasOnlyKeys2(value, ["id", "status", "cancelReason"]) && typeof value.id === "string" && typeof value.status === "string" && (value.cancelReason === void 0 || typeof value.cancelReason === "string");
3165
3685
  }
3166
3686
  function isQueueQueryResponse(value) {
3167
- if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "dependencyHeads"])) return false;
3687
+ if (!isRecord(value) || !hasOnlyKeys2(value, ["entries", "counts", "oldHistoricalCount", "legacyReportedBlockedCount", "dependencyHeads"])) return false;
3168
3688
  if (!Array.isArray(value.entries) || !value.entries.every(isQueueEntryWire)) return false;
3169
3689
  if (value.counts !== void 0 && (!isRecord(value.counts) || !Object.values(value.counts).every(isNonNegativeInt))) return false;
3690
+ if (value.legacyReportedBlockedCount !== void 0 && !isNonNegativeInt(value.legacyReportedBlockedCount)) return false;
3170
3691
  if (value.oldHistoricalCount !== void 0 && !isNonNegativeInt(value.oldHistoricalCount)) return false;
3171
3692
  if (value.dependencyHeads !== void 0 && (!Array.isArray(value.dependencyHeads) || !value.dependencyHeads.every(isQueueDependencyHeadWire))) return false;
3172
3693
  return true;
@@ -3224,7 +3745,7 @@ function decodeQueueRequeueRequest(value) {
3224
3745
  return isQueueRequeueRequest(value) ? value : null;
3225
3746
  }
3226
3747
  function isQueueRequeueResponse(value) {
3227
- return isRecord(value) && hasOnlyKeys2(value, ["task"]) && (value.task === null || isQueueEntryWire(value.task));
3748
+ 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");
3228
3749
  }
3229
3750
  function decodeQueueRequeueResponse(value) {
3230
3751
  return isQueueRequeueResponse(value) ? value : null;
@@ -3288,6 +3809,24 @@ function isRecoveryContextQueryResponse(value) {
3288
3809
  function decodeRecoveryContextQueryResponse(value) {
3289
3810
  return isRecoveryContextQueryResponse(value) ? value : null;
3290
3811
  }
3812
+ function decodeQueueReviseRequest(value) {
3813
+ 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;
3814
+ if (value.dryRun !== void 0 && typeof value.dryRun !== "boolean") return null;
3815
+ if (value.deferScheduling !== void 0 && typeof value.deferScheduling !== "boolean") return null;
3816
+ const p = value.patch;
3817
+ if (p.requestQuotaOverride && (value.dryRun !== void 0 || value.deferScheduling !== void 0)) return null;
3818
+ if (p.requestQuotaOverride !== void 0 && (p.requestQuotaOverride !== true || Object.keys(p).length !== 1)) return null;
3819
+ if (p.attestActiveOwnership && value.deferScheduling !== void 0) return null;
3820
+ if (p.attestActiveOwnership !== void 0 && (p.attestActiveOwnership !== true || Object.keys(p).length !== 1)) return null;
3821
+ if (p.message !== void 0 && (typeof p.message !== "string" || !p.message.trim())) return null;
3822
+ if (p.phase !== void 0 && p.phase !== "source" && p.phase !== "integration") return null;
3823
+ if (p.difficulty !== void 0 && p.difficulty !== "easy" && p.difficulty !== "medium" && p.difficulty !== "difficult" && p.difficulty !== "freeform") return null;
3824
+ for (const key of ["ownedPaths", "dependsOn"]) {
3825
+ if (p[key] !== void 0 && (!Array.isArray(p[key]) || !p[key].every((x) => typeof x === "string" && !!x.trim()))) return null;
3826
+ }
3827
+ return value;
3828
+ }
3829
+ var decodeQueueReviseResponse = decodeQueueRequeueResponse;
3291
3830
 
3292
3831
  // src/turn-ipc-stats.ts
3293
3832
  function isTaskStatsQueryRequest(value) {
@@ -3386,6 +3925,7 @@ var TURN_IPC_COMMANDS = [
3386
3925
  "queue_enqueue_batch",
3387
3926
  "queue_cancel",
3388
3927
  "queue_requeue",
3928
+ "queue_revise",
3389
3929
  "direct_dispatch_record",
3390
3930
  "active_work_query",
3391
3931
  "recovery_context_query",
@@ -3525,6 +4065,357 @@ function touchedFilesOutsideOwnership(touched, owned) {
3525
4065
  return { undeclaredTouched, unusedDeclarations };
3526
4066
  }
3527
4067
 
4068
+ // src/mission-items.ts
4069
+ var MISSION_ITEM_KINDS = ["remaining", "live_check", "decision", "evidence"];
4070
+ var MISSION_ITEM_STATES = ["open", "done", "failed", "dropped", "moved", "answered", "expired", "withdrawn", "superseded"];
4071
+ var COORDINATOR_SETTABLE_ITEM_STATES = {
4072
+ remaining: ["open", "done", "dropped"],
4073
+ live_check: ["open", "done", "dropped"],
4074
+ evidence: ["open", "done", "dropped"],
4075
+ decision: ["open", "withdrawn", "superseded"]
4076
+ };
4077
+ var MISSION_OUTCOMES = ["merged", "verified_live", "superseded", "not_needed", "owner_abandoned", "unspecified"];
4078
+ function isMissionOutcome(value) {
4079
+ return typeof value === "string" && MISSION_OUTCOMES.includes(value);
4080
+ }
4081
+ var MISSION_REF_KINDS = ["commit", "branch", "pr", "task", "artifact", "mission", "url"];
4082
+ var MISSION_LIMITS = {
4083
+ summary: 300,
4084
+ outcomeReason: 500,
4085
+ itemText: 300,
4086
+ machine: 80,
4087
+ refs: 8,
4088
+ refValue: 300,
4089
+ refRepo: 120,
4090
+ refNote: 200,
4091
+ dedupeKey: 400,
4092
+ question: 300,
4093
+ context: 600,
4094
+ options: 5,
4095
+ optionLabel: 60,
4096
+ optionDetail: 200,
4097
+ /** Open items per mission before the oldest `remaining` fold into a "N more" summary item. */
4098
+ openItemsPerMission: 200,
4099
+ /** One event payload (serialized). */
4100
+ eventPayloadBytes: 16 * 1024,
4101
+ /** items_add / items_update entries honoured per call (extra entries are reported, not applied). */
4102
+ itemsPerCall: 50
4103
+ };
4104
+ var MISSION_DECISION_OPTION_IDS = ["a", "b", "c", "d", "e"];
4105
+ var MISSION_DECISION_URGENCIES = ["normal", "blocking"];
4106
+ var MISSION_DECISION_ON_DUE = ["remind", "apply_recommended"];
4107
+ function truncateMissionText(value, max) {
4108
+ if (value.length <= max) return value;
4109
+ return `${value.slice(0, max - 1).trimEnd()}\u2026`;
4110
+ }
4111
+ function str(value) {
4112
+ return typeof value === "string" ? value.trim() : "";
4113
+ }
4114
+ function collapse(value) {
4115
+ return value.replace(/\s+/g, " ").trim();
4116
+ }
4117
+ function normalizeMissionSummary(value) {
4118
+ if (typeof value !== "string") return null;
4119
+ const text = collapse(value);
4120
+ return { value: truncateMissionText(text, MISSION_LIMITS.summary), truncated: text.length > MISSION_LIMITS.summary };
4121
+ }
4122
+ function normalizeOutcomeReason(value) {
4123
+ if (typeof value !== "string") return null;
4124
+ const text = value.trim();
4125
+ return { value: truncateMissionText(text, MISSION_LIMITS.outcomeReason), truncated: text.length > MISSION_LIMITS.outcomeReason };
4126
+ }
4127
+ function normalizeMissionRefs(value) {
4128
+ if (!Array.isArray(value)) return { refs: [], truncated: false };
4129
+ const refs = [];
4130
+ let truncated = false;
4131
+ for (const raw of value) {
4132
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4133
+ const r = raw;
4134
+ const kind = str(r.kind);
4135
+ const refValue = str(r.value);
4136
+ if (!MISSION_REF_KINDS.includes(kind) || !refValue) continue;
4137
+ if (refs.length >= MISSION_LIMITS.refs) {
4138
+ truncated = true;
4139
+ break;
4140
+ }
4141
+ const repo = str(r.repo);
4142
+ const note = str(r.note);
4143
+ refs.push({
4144
+ kind,
4145
+ ...repo ? { repo: truncateMissionText(repo, MISSION_LIMITS.refRepo) } : {},
4146
+ value: truncateMissionText(refValue, MISSION_LIMITS.refValue),
4147
+ ...note ? { note: truncateMissionText(note, MISSION_LIMITS.refNote) } : {}
4148
+ });
4149
+ }
4150
+ return { refs, truncated };
4151
+ }
4152
+ function normalizeOptions(value, truncated) {
4153
+ if (!Array.isArray(value)) return [];
4154
+ const out = [];
4155
+ for (const raw of value) {
4156
+ if (typeof raw === "string" && raw.trim()) {
4157
+ if (out.length >= MISSION_LIMITS.options) {
4158
+ truncated.push("options");
4159
+ break;
4160
+ }
4161
+ out.push({ id: MISSION_DECISION_OPTION_IDS[out.length], label: truncateMissionText(raw.trim(), MISSION_LIMITS.optionLabel) });
4162
+ continue;
4163
+ }
4164
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
4165
+ const o = raw;
4166
+ const label = collapse(str(o.label));
4167
+ if (!label) continue;
4168
+ if (out.length >= MISSION_LIMITS.options) {
4169
+ truncated.push("options");
4170
+ break;
4171
+ }
4172
+ const detail = str(o.detail);
4173
+ out.push({
4174
+ id: MISSION_DECISION_OPTION_IDS[out.length],
4175
+ label: truncateMissionText(label, MISSION_LIMITS.optionLabel),
4176
+ ...detail ? { detail: truncateMissionText(detail, MISSION_LIMITS.optionDetail) } : {}
4177
+ });
4178
+ }
4179
+ return out;
4180
+ }
4181
+ function normalizeDueAt(value) {
4182
+ if (typeof value !== "string" || !value.trim()) return void 0;
4183
+ const ms2 = Date.parse(value);
4184
+ return Number.isNaN(ms2) ? void 0 : new Date(ms2).toISOString();
4185
+ }
4186
+ function normalizeDecisionInput(raw, truncated) {
4187
+ const questionSource = collapse(str(raw.question) || str(raw.text));
4188
+ if (!questionSource) return null;
4189
+ if (questionSource.length > MISSION_LIMITS.question) truncated.push("question");
4190
+ const question = truncateMissionText(questionSource, MISSION_LIMITS.question);
4191
+ const contextSource = str(raw.context);
4192
+ if (contextSource.length > MISSION_LIMITS.context) truncated.push("context");
4193
+ const options = normalizeOptions(raw.options, truncated);
4194
+ const recommendedRaw = str(raw.recommended);
4195
+ const recommended = recommendedRaw && options.some((o) => o.id === recommendedRaw) ? recommendedRaw : options.find((o) => recommendedRaw && o.label.toLowerCase() === recommendedRaw.toLowerCase())?.id;
4196
+ const dueAt = normalizeDueAt(raw.dueAt ?? raw.due_at);
4197
+ const onDueRaw = str(raw.onDue ?? raw.on_due);
4198
+ const urgencyRaw = str(raw.urgency);
4199
+ const allowFreeTextRaw = raw.allowFreeText ?? raw.allow_free_text;
4200
+ return {
4201
+ question,
4202
+ ...contextSource ? { context: truncateMissionText(contextSource, MISSION_LIMITS.context) } : {},
4203
+ options,
4204
+ ...recommended ? { recommended } : {},
4205
+ allowFreeText: typeof allowFreeTextRaw === "boolean" ? allowFreeTextRaw : true,
4206
+ ...dueAt ? { dueAt } : {},
4207
+ // apply_recommended without a recommended option has nothing to apply — fall back to remind.
4208
+ onDue: onDueRaw === "apply_recommended" && recommended ? "apply_recommended" : "remind",
4209
+ urgency: urgencyRaw === "blocking" ? "blocking" : "normal"
4210
+ };
4211
+ }
4212
+ function normalizeForDedupe(text) {
4213
+ return collapse(text).toLowerCase().replace(/[\s.!?。]+$/u, "");
4214
+ }
4215
+ function deriveItemDedupeKey(kind, parts) {
4216
+ const explicit = str(parts.explicit);
4217
+ if (explicit) return truncateMissionText(`k:${explicit}`, MISSION_LIMITS.dedupeKey);
4218
+ if (kind === "decision") return truncateMissionText(`decision:${normalizeForDedupe(parts.question ?? parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4219
+ if (kind === "evidence") {
4220
+ const ref2 = parts.refs?.[0];
4221
+ if (ref2) return truncateMissionText(`evidence:${ref2.kind}:${ref2.repo ?? ""}:${ref2.value}`, MISSION_LIMITS.dedupeKey);
4222
+ }
4223
+ const machine = parts.machine ? `@${normalizeForDedupe(parts.machine)}` : "";
4224
+ return truncateMissionText(`${kind}${machine}:${normalizeForDedupe(parts.text ?? "")}`, MISSION_LIMITS.dedupeKey);
4225
+ }
4226
+ function normalizeMissionItemInput(raw) {
4227
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "item must be an object" };
4228
+ const r = raw;
4229
+ const kind = str(r.kind) || "remaining";
4230
+ if (!MISSION_ITEM_KINDS.includes(kind)) {
4231
+ return { error: `invalid kind '${kind}' (valid: ${MISSION_ITEM_KINDS.join(", ")})` };
4232
+ }
4233
+ const truncated = [];
4234
+ const { refs, truncated: refsTruncated } = normalizeMissionRefs(r.refs);
4235
+ if (refsTruncated) truncated.push("refs");
4236
+ const machineRaw = collapse(str(r.machine));
4237
+ const machine = machineRaw ? truncateMissionText(machineRaw, MISSION_LIMITS.machine) : void 0;
4238
+ const explicitKey = str(r.dedupe_key ?? r.dedupeKey);
4239
+ if (kind === "decision") {
4240
+ const decisionRaw = r.decision && typeof r.decision === "object" && !Array.isArray(r.decision) ? r.decision : r;
4241
+ const decision = normalizeDecisionInput({ ...decisionRaw, question: decisionRaw.question ?? r.question ?? r.text }, truncated);
4242
+ if (!decision) return { error: "decision item needs a question" };
4243
+ return {
4244
+ item: {
4245
+ kind,
4246
+ text: decision.question,
4247
+ ...machine ? { machine } : {},
4248
+ refs,
4249
+ decision,
4250
+ dedupeKey: deriveItemDedupeKey("decision", { question: decision.question, explicit: explicitKey }),
4251
+ truncated
4252
+ }
4253
+ };
4254
+ }
4255
+ const textSource = collapse(str(r.text));
4256
+ if (!textSource && !(kind === "evidence" && refs.length > 0)) return { error: `${kind} item needs text` };
4257
+ if (textSource.length > MISSION_LIMITS.itemText) truncated.push("text");
4258
+ const text = truncateMissionText(textSource || `${refs[0].kind}: ${refs[0].value}`, MISSION_LIMITS.itemText);
4259
+ return {
4260
+ item: {
4261
+ kind,
4262
+ text,
4263
+ ...machine ? { machine } : {},
4264
+ refs,
4265
+ dedupeKey: deriveItemDedupeKey(kind, { text, machine, refs, explicit: explicitKey }),
4266
+ truncated
4267
+ }
4268
+ };
4269
+ }
4270
+ function normalizeMissionItemUpdate(raw) {
4271
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { error: "update must be an object" };
4272
+ const r = raw;
4273
+ const id2 = str(r.id ?? r.item_id ?? r.itemId);
4274
+ if (!id2) return { error: "update needs an item id" };
4275
+ const truncated = [];
4276
+ const update = { id: id2 };
4277
+ if (r.state !== void 0) {
4278
+ const state = str(r.state);
4279
+ if (!MISSION_ITEM_STATES.includes(state)) return { error: `invalid state '${state}'` };
4280
+ update.state = state;
4281
+ }
4282
+ if (typeof r.text === "string") {
4283
+ const text = collapse(r.text);
4284
+ if (text.length > MISSION_LIMITS.itemText) truncated.push("text");
4285
+ if (text) update.text = truncateMissionText(text, MISSION_LIMITS.itemText);
4286
+ }
4287
+ if (r.machine === null) update.machine = null;
4288
+ else if (typeof r.machine === "string") {
4289
+ const machine = collapse(r.machine);
4290
+ update.machine = machine ? truncateMissionText(machine, MISSION_LIMITS.machine) : null;
4291
+ }
4292
+ if (r.refs !== void 0) {
4293
+ const { refs, truncated: t } = normalizeMissionRefs(r.refs);
4294
+ if (t) truncated.push("refs");
4295
+ update.refs = refs;
4296
+ }
4297
+ return { update, truncated };
4298
+ }
4299
+ function boundEventPayload(payload) {
4300
+ let json = JSON.stringify(payload);
4301
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4302
+ const shrunk = {};
4303
+ for (const [k, v] of Object.entries(payload)) {
4304
+ shrunk[k] = typeof v === "string" && v.length > 4e3 ? `${v.slice(0, 4e3)}\u2026` : v;
4305
+ }
4306
+ shrunk.payloadTruncated = true;
4307
+ json = JSON.stringify(shrunk);
4308
+ if (json.length <= MISSION_LIMITS.eventPayloadBytes) return json;
4309
+ return JSON.stringify({ payloadTruncated: true, keys: Object.keys(payload).slice(0, 20) });
4310
+ }
4311
+ var CARRY_OVER_MISSION_TITLE = "Carry-over \u2014 open items from closed missions";
4312
+ var LEGACY_CARRY_OVER_MISSION_TITLE = "\uC774\uC6D4 \u2014 \uB2EB\uD78C \uBBF8\uC158\uC5D0\uC11C \uB118\uC5B4\uC628 \uD56D\uBAA9";
4313
+ var CARRY_OVER_MISSION_GOAL = "Open items carried over from closed missions, and decisions requested without a mission. Managed automatically \u2014 do not close.";
4314
+ function isCarryOverMissionRecord(m) {
4315
+ return !!m && (m.isCarryOver === true || isCarryOverMissionTitle(m.title));
4316
+ }
4317
+ function isCarryOverMissionTitle(title) {
4318
+ if (typeof title !== "string") return false;
4319
+ const t = title.trim();
4320
+ return t === CARRY_OVER_MISSION_TITLE || t === LEGACY_CARRY_OVER_MISSION_TITLE;
4321
+ }
4322
+ var OWNER_ABANDON_CONFIRM_KEY_PREFIX = "owner-abandon-confirm:";
4323
+ var OWNER_ABANDON_CONFIRM_QUESTION = "The coordinator closed this as 'owner abandoned' \u2014 correct?";
4324
+ var OWNER_ABANDON_CONFIRM_OPTIONS = ["Correct", "Reopen"];
4325
+ var WORKER_DECISIONS_NEEDED_MAX = 3;
4326
+ var WORKER_COMMITS_MAX = 20;
4327
+ var SHA_RE = /^[0-9a-f]{7,64}$/i;
4328
+ function normalizeReportCommits(value) {
4329
+ if (!Array.isArray(value)) return null;
4330
+ const out = [];
4331
+ for (const v of value) {
4332
+ if (typeof v !== "string") return null;
4333
+ const sha = v.trim();
4334
+ if (!SHA_RE.test(sha)) return null;
4335
+ if (!out.includes(sha.toLowerCase())) out.push(sha.toLowerCase());
4336
+ }
4337
+ return out;
4338
+ }
4339
+
4340
+ // src/mission-git-state.ts
4341
+ var MISSION_REF_GIT_STATUSES = ["contained_ancestor", "contained_patch_equivalent", "not_contained", "unknown"];
4342
+ var MISSION_REF_GIT_METHODS = ["ancestry", "cherry", "residual_patch"];
4343
+ var MISSION_GIT_STATES = ["no_refs", "landed", "partial", "not_landed", "unknown"];
4344
+ function isMissionRefContained(status) {
4345
+ return status === "contained_ancestor" || status === "contained_patch_equivalent";
4346
+ }
4347
+ function aggregateMissionGitState(statuses) {
4348
+ const total = statuses.length;
4349
+ const contained = statuses.filter(isMissionRefContained).length;
4350
+ const notContained = statuses.filter((s) => s === "not_contained").length;
4351
+ const unknown = statuses.filter((s) => s === "unknown").length;
4352
+ const counts = { total, contained, notContained, unknown };
4353
+ if (total === 0) return { state: "no_refs", partialUnknown: false, counts };
4354
+ if (contained === total) return { state: "landed", partialUnknown: false, counts };
4355
+ if (contained > 0) return { state: "partial", partialUnknown: unknown > 0, counts };
4356
+ if (notContained === total) return { state: "not_landed", partialUnknown: false, counts };
4357
+ return { state: "unknown", partialUnknown: false, counts };
4358
+ }
4359
+
4360
+ // src/release.ts
4361
+ var MESH_RELEASE_CHANNELS = ["preview", "stable"];
4362
+ function isMeshReleaseChannel(value) {
4363
+ return typeof value === "string" && MESH_RELEASE_CHANNELS.includes(value);
4364
+ }
4365
+ var MESH_RELEASE_STATUSES = ["planned", "frozen", "deployed", "verified", "superseded", "cancelled"];
4366
+ function isReleaseStatus(value) {
4367
+ return typeof value === "string" && MESH_RELEASE_STATUSES.includes(value);
4368
+ }
4369
+ var RELEASE_MEMBER_STATES = ["member", "moved_out", "removed"];
4370
+ var RELEASE_ACTORS = ["coordinator", "owner", "assistant", "script"];
4371
+ var RELEASE_EVENT_TYPES = [
4372
+ "created",
4373
+ "status_changed",
4374
+ "scope_added",
4375
+ "scope_moved",
4376
+ "scope_removed",
4377
+ "deploy_recorded",
4378
+ "changelog_drafted",
4379
+ "changelog_applied"
4380
+ ];
4381
+ var MISSION_RELEASE_EVENT_TYPES = ["release_attached", "release_moved", "release_detached"];
4382
+ var RELEASE_LIMITS = {
4383
+ name: 80,
4384
+ note: 500,
4385
+ /** `mesh_missions.release_note`: one user/operator-visible sentence. */
4386
+ releaseNote: 400,
4387
+ missionsPerCall: 100,
4388
+ changelogEntries: 300
4389
+ };
4390
+ var CHANGELOG_SECTIONS = ["Added", "Fixed", "Changed"];
4391
+ var NEEDS_WORDING_MARKER = "[needs user-facing wording]";
4392
+ function changelogMissionMarker(missionId) {
4393
+ return `<!-- m:${missionId.slice(0, 8)} -->`;
4394
+ }
4395
+ function classifyChangelogSection(text, hint) {
4396
+ const m = /^\s*\[(added|fixed|changed)\]\s*/i.exec(text);
4397
+ if (m) {
4398
+ const key = m[1].toLowerCase();
4399
+ return { section: key === "added" ? "Added" : key === "fixed" ? "Fixed" : "Changed", text: text.slice(m[0].length).trim() };
4400
+ }
4401
+ const probe = `${hint ?? ""} ${text}`.toLowerCase();
4402
+ if (/\b(fix|fixes|fixed|bug|regression|crash|error)\b|오류|결함|버그|수정/.test(probe)) return { section: "Fixed", text };
4403
+ if (/\b(add|adds|added|new|introduc\w*|support\w*)\b|신규|추가/.test(probe)) return { section: "Added", text };
4404
+ return { section: "Changed", text };
4405
+ }
4406
+ function lintChangelogText(text) {
4407
+ const out = [];
4408
+ if (/\bwave[\s-]*\d+/i.test(text) || /웨이브\s*\d+/.test(text)) out.push("mentions an internal wave number");
4409
+ if (/\brc[.\s-]?\d+\b/i.test(text)) out.push("mentions an internal rc number");
4410
+ 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");
4411
+ if (/\bmission\b/i.test(text)) out.push('mentions "mission" (internal vocabulary)');
4412
+ return out;
4413
+ }
4414
+
4415
+ // src/decision-push-relay.ts
4416
+ var DECISION_PUSH_RELAY_COMMAND = "mission_decision_push_relay_answer";
4417
+ var DECISION_PUSH_RELAY_SOURCE = "push_relay";
4418
+
3528
4419
  // src/keyed-doc-delta.ts
3529
4420
  function sig(value) {
3530
4421
  if (value === void 0) return void 0;
@@ -3887,9 +4778,412 @@ function isProviderQuestionBinding(value) {
3887
4778
  if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
3888
4779
  return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
3889
4780
  }
4781
+
4782
+ // src/task-source-phase.ts
4783
+ function reviewIndependenceOf(review) {
4784
+ return review.independence ?? "different_provider";
4785
+ }
4786
+
4787
+ // src/light-task.ts
4788
+ var LIGHT_REJECT = {
4789
+ REQUIRES_LOCAL_BASE: "light_requires_local_base",
4790
+ NOT_CONFIGURED: "light_workspace_not_configured",
4791
+ REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
4792
+ MODE_CONFLICT: "light_mode_conflict"
4793
+ };
4794
+ var LIGHT_HOLD = {
4795
+ PREPARE_FAILED: "light_workspace_prepare_failed",
4796
+ LIMIT: "light_workspace_limit",
4797
+ DISK_LOW: "light_workspace_disk_low",
4798
+ CAP: "max_light_parallel_tasks_reached"
4799
+ };
4800
+ var LIGHT_BLOCK_REASONS = [
4801
+ "light_uncommitted_changes",
4802
+ "light_dependency_change",
4803
+ "light_lineage_unproven",
4804
+ "shared_checkout_mutated"
4805
+ ];
4806
+ var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
4807
+ var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
4808
+ var LIGHT_TESTS_RUN_MAX = 20;
4809
+ function isLightWorkerSession(session) {
4810
+ const s = session;
4811
+ if (!s || typeof s !== "object") return false;
4812
+ const has = (o) => !!o && typeof o === "object" && typeof o.lightWorkspaceId === "string" && o.lightWorkspaceId.trim() !== "";
4813
+ return has(s.settings) || has(s.launchRecord?.settings) || has(s);
4814
+ }
4815
+
4816
+ // src/relay-reprobe.ts
4817
+ var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
4818
+ var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
4819
+ var RELAY_REPROBE_JITTER_RATIO = 0.2;
4820
+ function computeRelayReprobeDelay(failures, random, timing = {}) {
4821
+ const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
4822
+ const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
4823
+ const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
4824
+ const grown = Math.min(max, base * 2 ** Math.max(0, failures));
4825
+ const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
4826
+ return Math.round(grown * factor);
4827
+ }
4828
+ var RelayReprobeScheduler = class {
4829
+ constructor(options) {
4830
+ this.options = options;
4831
+ }
4832
+ handle = null;
4833
+ running = false;
4834
+ inFlight = false;
4835
+ failureCount = 0;
4836
+ generation = 0;
4837
+ get isRunning() {
4838
+ return this.running;
4839
+ }
4840
+ get failures() {
4841
+ return this.failureCount;
4842
+ }
4843
+ get probing() {
4844
+ return this.inFlight;
4845
+ }
4846
+ /** Begin probing (idempotent). Call when a connection is selected as relay. */
4847
+ start() {
4848
+ if (this.running) return;
4849
+ this.running = true;
4850
+ this.failureCount = 0;
4851
+ this.generation++;
4852
+ this.schedule();
4853
+ }
4854
+ /** Stop for good (direct path found, connection closed, auth epoch changed). */
4855
+ stop() {
4856
+ this.running = false;
4857
+ this.generation++;
4858
+ if (this.handle !== null) {
4859
+ this.options.clearTimer(this.handle);
4860
+ this.handle = null;
4861
+ }
4862
+ }
4863
+ schedule() {
4864
+ if (!this.running) return;
4865
+ const generation = this.generation;
4866
+ const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
4867
+ this.handle = this.options.setTimer(() => {
4868
+ this.handle = null;
4869
+ void this.tick(generation);
4870
+ }, delay);
4871
+ }
4872
+ async tick(generation) {
4873
+ if (!this.running || generation !== this.generation) return;
4874
+ if (this.inFlight || !this.options.shouldProbe()) {
4875
+ this.schedule();
4876
+ return;
4877
+ }
4878
+ this.inFlight = true;
4879
+ let outcome;
4880
+ try {
4881
+ outcome = await this.options.probe();
4882
+ } catch {
4883
+ outcome = "failed";
4884
+ }
4885
+ this.inFlight = false;
4886
+ if (!this.running || generation !== this.generation) return;
4887
+ if (outcome === "direct") {
4888
+ this.stop();
4889
+ return;
4890
+ }
4891
+ if (outcome !== "skipped") this.failureCount++;
4892
+ this.schedule();
4893
+ }
4894
+ };
4895
+
4896
+ // src/task-stages.ts
4897
+ var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
4898
+ var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
4899
+ var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
4900
+ var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
4901
+ var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
4902
+ var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
4903
+ var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
4904
+ var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
4905
+ var STAGE_ROLES = ["implement", "revise", "review"];
4906
+ var STAGE_BLOCKED_REASONS = [
4907
+ "review_unresolved",
4908
+ "review_rejected_approach",
4909
+ "review_unavailable",
4910
+ "self_check_failed",
4911
+ "stage_pipeline_ceiling",
4912
+ "reviewer_mutated_source",
4913
+ // The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
4914
+ "reviewer_integrity_unverifiable"
4915
+ ];
4916
+ var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
4917
+ var STAGE_MAX_REVISIONS_LIMIT = 3;
4918
+ var STAGE_DEFAULT_MAX_REVISIONS = 2;
4919
+ var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
4920
+ var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
4921
+ var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
4922
+ var REVIEW_FINDINGS_MAX = 30;
4923
+ var REVIEW_CLAIM_MAX_CHARS = 500;
4924
+ var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
4925
+ var REVIEW_FIX_MAX_CHARS = 500;
4926
+ var REVIEW_FINDING_ID_MAX_CHARS = 40;
4927
+ var REVIEW_CHECKED_MAX = 20;
4928
+ var REVIEW_NOTE_MAX_CHARS = 500;
4929
+ var REVIEW_TESTS_RUN_MAX = 20;
4930
+ var FINDING_RESPONSES_MAX = 30;
4931
+ function makeGuard4(values) {
4932
+ const set = new Set(values);
4933
+ return (value) => typeof value === "string" && set.has(value);
4934
+ }
4935
+ var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
4936
+ var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
4937
+ var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
4938
+ var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
4939
+ var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
4940
+ var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
4941
+ var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
4942
+ function isBlockingSeverity(severity) {
4943
+ return severity === "blocking" || severity === "major";
4944
+ }
4945
+ function resolveStagePlan(raw, task, opts = {}) {
4946
+ const eligible = isStageEligibleTask(task);
4947
+ if (raw === void 0 || raw === null) return (opts.defaultOn ?? false) && defaultsOnFor(task) ? defaultStagePlan() : null;
4948
+ if (raw === false) return null;
4949
+ if (raw === true) {
4950
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4951
+ return defaultStagePlan();
4952
+ }
4953
+ if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
4954
+ const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
4955
+ for (const key of Object.keys(raw)) {
4956
+ if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
4957
+ }
4958
+ if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
4959
+ const rawMax = raw.max_revisions ?? raw.maxRevisions;
4960
+ let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
4961
+ if (rawMax !== void 0) {
4962
+ if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
4963
+ throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
4964
+ }
4965
+ maxRevisions = rawMax;
4966
+ }
4967
+ let independence = "fresh_session_ok";
4968
+ if (raw.independence !== void 0) {
4969
+ if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
4970
+ throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
4971
+ }
4972
+ independence = raw.independence;
4973
+ }
4974
+ return { review: true, maxRevisions, independence };
4975
+ }
4976
+ function defaultStagePlan() {
4977
+ return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
4978
+ }
4979
+ function isStageEligibleTask(task) {
4980
+ if (task.readonly) return false;
4981
+ return (task.taskMode ?? "code_change") === "code_change";
4982
+ }
4983
+ function defaultsOnFor(task) {
4984
+ return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
4985
+ }
4986
+ function str2(value) {
4987
+ return typeof value === "string" ? value.trim() : "";
4988
+ }
4989
+ function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
4990
+ if (!Array.isArray(value)) {
4991
+ errors.push({ field, message: `${field} must be an array of strings` });
4992
+ return [];
4993
+ }
4994
+ if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
4995
+ const out = [];
4996
+ for (const item of value) {
4997
+ const text = str2(item);
4998
+ if (!text) continue;
4999
+ if (text.length > maxChars) {
5000
+ errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
5001
+ continue;
5002
+ }
5003
+ out.push(text);
5004
+ }
5005
+ 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` });
5006
+ return out;
5007
+ }
5008
+ function validateReviewReport(raw, ctx) {
5009
+ const errors = [];
5010
+ if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
5011
+ const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
5012
+ 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(", ")})` });
5013
+ const verdict = raw.verdict;
5014
+ if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
5015
+ const findings = [];
5016
+ if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
5017
+ else {
5018
+ 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` });
5019
+ const seen = /* @__PURE__ */ new Set();
5020
+ raw.findings.forEach((f, i) => {
5021
+ const at = `review.findings[${i}]`;
5022
+ if (!isRecord4(f)) {
5023
+ errors.push({ field: at, message: "each finding must be an object" });
5024
+ return;
5025
+ }
5026
+ const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
5027
+ for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5028
+ const id2 = str2(f.id);
5029
+ 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)` });
5030
+ else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
5031
+ else seen.add(id2);
5032
+ if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
5033
+ if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
5034
+ const claim = str2(f.claim);
5035
+ if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
5036
+ else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
5037
+ const evidence = str2(f.evidence);
5038
+ if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
5039
+ else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
5040
+ const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
5041
+ if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
5042
+ if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
5043
+ 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" });
5044
+ if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
5045
+ findings.push({
5046
+ id: id2,
5047
+ severity: f.severity,
5048
+ category: f.category,
5049
+ ...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
5050
+ ...typeof f.line === "number" ? { line: f.line } : {},
5051
+ claim,
5052
+ evidence,
5053
+ ...fix ? { suggestedFix: fix } : {}
5054
+ });
5055
+ }
5056
+ });
5057
+ }
5058
+ const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5059
+ const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
5060
+ let priorFindings;
5061
+ if (raw.priorFindings !== void 0) {
5062
+ if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
5063
+ else {
5064
+ priorFindings = [];
5065
+ raw.priorFindings.forEach((p, i) => {
5066
+ const at = `review.priorFindings[${i}]`;
5067
+ if (!isRecord4(p)) {
5068
+ errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
5069
+ return;
5070
+ }
5071
+ for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5072
+ const id2 = str2(p.id);
5073
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5074
+ if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
5075
+ const note = p.note === void 0 ? void 0 : str2(p.note);
5076
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5077
+ if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
5078
+ });
5079
+ }
5080
+ }
5081
+ const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
5082
+ if (isReviewVerdict(verdict)) {
5083
+ const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
5084
+ if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
5085
+ errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
5086
+ }
5087
+ if (verdict === "approve" && blocking.length > 0) {
5088
+ errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
5089
+ }
5090
+ if (verdict === "approve_with_nits" && blocking.length > 0) {
5091
+ errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
5092
+ }
5093
+ }
5094
+ if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
5095
+ const answered = new Set((priorFindings ?? []).map((p) => p.id));
5096
+ const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
5097
+ 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(", ")}` });
5098
+ }
5099
+ if (errors.length) return { errors };
5100
+ return {
5101
+ report: {
5102
+ verdict,
5103
+ findings,
5104
+ ...priorFindings?.length ? { priorFindings } : {},
5105
+ checked,
5106
+ notChecked,
5107
+ ...testsRun?.length ? { testsRun } : {}
5108
+ },
5109
+ errors: []
5110
+ };
5111
+ }
5112
+ function validateTestsRun(raw, field, errors) {
5113
+ if (!Array.isArray(raw)) {
5114
+ errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
5115
+ return [];
5116
+ }
5117
+ if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
5118
+ const out = [];
5119
+ raw.forEach((t, i) => {
5120
+ const at = `${field}[${i}]`;
5121
+ if (!isRecord4(t)) {
5122
+ errors.push({ field: at, message: "each entry must be an object" });
5123
+ return;
5124
+ }
5125
+ for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5126
+ const command = str2(t.command);
5127
+ if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
5128
+ if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
5129
+ for (const k of ["passed", "failed"]) {
5130
+ 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` });
5131
+ }
5132
+ const note = t.note === void 0 ? void 0 : str2(t.note);
5133
+ if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5134
+ if (command && typeof t.exit === "number") {
5135
+ out.push({
5136
+ command,
5137
+ exit: t.exit,
5138
+ ...typeof t.passed === "number" ? { passed: t.passed } : {},
5139
+ ...typeof t.failed === "number" ? { failed: t.failed } : {},
5140
+ ...note ? { note } : {}
5141
+ });
5142
+ }
5143
+ });
5144
+ return out;
5145
+ }
5146
+ function validateFindingResponses(raw, field = "findingResponses") {
5147
+ const errors = [];
5148
+ if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
5149
+ if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
5150
+ const out = [];
5151
+ raw.forEach((r, i) => {
5152
+ const at = `${field}[${i}]`;
5153
+ if (!isRecord4(r)) {
5154
+ errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
5155
+ return;
5156
+ }
5157
+ for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
5158
+ const id2 = str2(r.id);
5159
+ if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
5160
+ if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
5161
+ const note = str2(r.note);
5162
+ if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
5163
+ else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
5164
+ if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
5165
+ });
5166
+ return errors.length ? { errors } : { responses: out, errors: [] };
5167
+ }
5168
+ function formatStageVerdictLine(input) {
5169
+ const parts = [`review: ${input.verdict}`];
5170
+ if (input.verdict === "skipped_no_diff") return parts[0];
5171
+ parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
5172
+ if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
5173
+ const tail = [];
5174
+ if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
5175
+ if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
5176
+ return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
5177
+ }
3890
5178
  // Annotate the CommonJS export names for ESM import in node:
3891
5179
  0 && (module.exports = {
5180
+ ASSISTANT_ACCOUNT_SLOT,
5181
+ ASSISTANT_FOLLOWER_ALLOWED_OPS,
3892
5182
  ASSISTANT_OWNER_VERBS,
5183
+ ASSISTANT_REMOTE_FOLLOW_COMMAND,
5184
+ ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
5185
+ ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
5186
+ ASSISTANT_REMOTE_PROJECT_COMMAND,
3893
5187
  ASSISTANT_REVIEW_TURN_VERBS,
3894
5188
  ASSISTANT_SESSION_ID_ARG,
3895
5189
  ASSISTANT_SESSION_ID_ENV,
@@ -3901,12 +5195,16 @@ function isProviderQuestionBinding(value) {
3901
5195
  CANCEL_REASONS,
3902
5196
  CANONICAL_MESH_TOOL_COUNT,
3903
5197
  CANONICAL_MESH_TOOL_NAMES,
5198
+ CARRY_OVER_MISSION_GOAL,
5199
+ CARRY_OVER_MISSION_TITLE,
5200
+ CHANGELOG_SECTIONS,
3904
5201
  CLAUDE_TUI_REVIEW_PAGE_NOT_FOCUSED_PREFIX,
3905
5202
  CLAUDE_TUI_REVIEW_UNCONFIRMED_PREFIX,
3906
5203
  CLI_SLOT_RECIPES,
3907
5204
  COMMIT_STRENGTHS,
3908
5205
  CONSUME_PROFILES,
3909
5206
  COORDINATOR_ACK_OUTCOMES,
5207
+ COORDINATOR_SETTABLE_ITEM_STATES,
3910
5208
  DAEMON_METADATA_DOC_SPEC,
3911
5209
  DAEMON_P2P_SIGNAL_TYPES,
3912
5210
  DAEMON_STATUS_EVENT_NAMES,
@@ -3919,13 +5217,34 @@ function isProviderQuestionBinding(value) {
3919
5217
  DASHBOARD_TO_DAEMON_P2P_TYPES,
3920
5218
  DASHBOARD_TO_USER_SESSION_TYPES,
3921
5219
  DASHBOARD_WIRE_VERSION,
5220
+ DECISION_PUSH_OPTIONS_MAX,
5221
+ DECISION_PUSH_OPTION_LABEL_MAX,
5222
+ DECISION_PUSH_QUESTION_MAX,
5223
+ DECISION_PUSH_RELAY_COMMAND,
5224
+ DECISION_PUSH_RELAY_SOURCE,
3922
5225
  DEFAULT_DIFFICULTY_BRAINS,
3923
5226
  DELIVERY_OUTCOMES,
3924
5227
  DELIVERY_VIAS,
3925
5228
  DISPATCH_FAILURE_REASONS,
5229
+ DISPATCH_REFUSAL_DETAIL_MAX,
3926
5230
  EVIDENCE_ENVELOPE_FIELD_SPECS,
3927
5231
  EVIDENCE_SOURCE_IDS,
5232
+ FINDING_CATEGORIES,
5233
+ FINDING_RESPONSES_MAX,
5234
+ FINDING_RESPONSE_KINDS,
5235
+ FINDING_SEVERITIES,
3928
5236
  HOLD_REASONS,
5237
+ LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
5238
+ LAUNCH_DEFAULT_ERROR_CODES,
5239
+ LAUNCH_DEFAULT_ROLES,
5240
+ LAUNCH_DEFAULT_SOURCES,
5241
+ LEGACY_CARRY_OVER_MISSION_TITLE,
5242
+ LIGHT_BLOCK_REASONS,
5243
+ LIGHT_HOLD,
5244
+ LIGHT_LAND_MODES,
5245
+ LIGHT_REJECT,
5246
+ LIGHT_TESTS_RUN_MAX,
5247
+ LIGHT_WARNINGS,
3929
5248
  LIVENESS_RESULTS,
3930
5249
  MAX_MESH_RECORD_STRING,
3931
5250
  MAX_OWNED_PATHS,
@@ -3940,6 +5259,8 @@ function isProviderQuestionBinding(value) {
3940
5259
  MESH_MISSION_STATUSES,
3941
5260
  MESH_P2P_SIGNAL_TYPES,
3942
5261
  MESH_RECORD_PAYLOAD_KEYS,
5262
+ MESH_RELEASE_CHANNELS,
5263
+ MESH_RELEASE_STATUSES,
3943
5264
  MESH_SESSION_CLEANUP_MODES,
3944
5265
  MESH_STATUS_DOC_SPEC,
3945
5266
  MESH_TASK_DIFFICULTIES,
@@ -3951,10 +5272,23 @@ function isProviderQuestionBinding(value) {
3951
5272
  MESH_TOPIC_ENTRY_KINDS,
3952
5273
  MESH_TOPIC_PROTOCOL_VERSION,
3953
5274
  MISSION_BRIEF_RENDER_MAX_CHARS,
5275
+ MISSION_DECISION_ON_DUE,
5276
+ MISSION_DECISION_OPTION_IDS,
5277
+ MISSION_DECISION_URGENCIES,
5278
+ MISSION_GIT_STATES,
5279
+ MISSION_ITEM_KINDS,
5280
+ MISSION_ITEM_STATES,
5281
+ MISSION_LIMITS,
5282
+ MISSION_OUTCOMES,
5283
+ MISSION_REF_GIT_METHODS,
5284
+ MISSION_REF_GIT_STATUSES,
5285
+ MISSION_REF_KINDS,
5286
+ MISSION_RELEASE_EVENT_TYPES,
3954
5287
  MODEL_AXIS_SOURCES,
3955
5288
  MODEL_SELECTION_HISTORY_LIMIT,
3956
5289
  MeshChunkAssembler,
3957
5290
  NATIVE_TURN_OUTCOMES,
5291
+ NEEDS_WORDING_MARKER,
3958
5292
  NOTIFY_KINDS,
3959
5293
  NO_PROGRESS_OBSERVED_STATUSES,
3960
5294
  NPM_UPDATE_TAGS,
@@ -3964,16 +5298,37 @@ function isProviderQuestionBinding(value) {
3964
5298
  OPERATOR_STATUS_REASON_VALUES,
3965
5299
  OPERATOR_STATUS_VALUES,
3966
5300
  OUTBOUND_MESSAGE_ORIGINS,
5301
+ OWNER_ABANDON_CONFIRM_KEY_PREFIX,
5302
+ OWNER_ABANDON_CONFIRM_OPTIONS,
5303
+ OWNER_ABANDON_CONFIRM_QUESTION,
3967
5304
  P2P_SIGNAL_TYPES,
5305
+ PRIOR_FINDING_STATUSES,
3968
5306
  PROVIDER_FAILURES,
3969
5307
  QUOTA_BACKFILL_HORIZON_MS,
3970
5308
  QUOTA_RETRY_INFLIGHT_GRACE_MS,
3971
5309
  QUOTA_SUPPORTED_PROVIDERS,
3972
5310
  RECENT_SESSION_BUCKETS,
3973
5311
  RECLAIMING_SEND_REFUSALS,
5312
+ RELAY_REPROBE_BASE_DELAY_MS,
5313
+ RELAY_REPROBE_JITTER_RATIO,
5314
+ RELAY_REPROBE_MAX_DELAY_MS,
5315
+ RELEASE_ACTORS,
3974
5316
  RELEASE_CHANNELS,
5317
+ RELEASE_EVENT_TYPES,
5318
+ RELEASE_LIMITS,
5319
+ RELEASE_MEMBER_STATES,
3975
5320
  REMOVED_MESH_TOOLS,
3976
5321
  RETIRED_MESH_TOOLS,
5322
+ REVIEW_CHECKED_MAX,
5323
+ REVIEW_CLAIM_MAX_CHARS,
5324
+ REVIEW_EVIDENCE_MAX_CHARS,
5325
+ REVIEW_FINDINGS_MAX,
5326
+ REVIEW_FINDING_ID_MAX_CHARS,
5327
+ REVIEW_FIX_MAX_CHARS,
5328
+ REVIEW_NOTE_MAX_CHARS,
5329
+ REVIEW_TESTS_RUN_MAX,
5330
+ REVIEW_VERDICTS,
5331
+ RelayReprobeScheduler,
3977
5332
  SEND_POLICY_MODES,
3978
5333
  SEND_REFUSAL_REASONS,
3979
5334
  SERVER_STATUS_EVENT_NAMES,
@@ -3986,6 +5341,17 @@ function isProviderQuestionBinding(value) {
3986
5341
  SESSION_STATUS_ALIASES,
3987
5342
  SESSION_STATUS_CLASS,
3988
5343
  SHARED_SESSION_TO_VIEWER_TYPES,
5344
+ STAGE_BLOCKED_REASONS,
5345
+ STAGE_DECIDE_ACTIONS,
5346
+ STAGE_DEFAULT_MAX_REVISIONS,
5347
+ STAGE_INDEPENDENCE_FALLBACK_MS,
5348
+ STAGE_INDEPENDENCE_MODES,
5349
+ STAGE_MAX_REVISIONS_LIMIT,
5350
+ STAGE_PARKED_PHASES,
5351
+ STAGE_PHASES,
5352
+ STAGE_PIPELINE_CEILING_DEFAULT_MS,
5353
+ STAGE_ROLES,
5354
+ STAGE_SELF_CHECK_MAX_BOUNCES,
3989
5355
  STATUS_PROBE_ARG_KEY,
3990
5356
  SUSPENSION_MODALS,
3991
5357
  SUSPENSION_RESOLUTIONS,
@@ -4011,17 +5377,27 @@ function isProviderQuestionBinding(value) {
4011
5377
  VERSION_UPDATE_REASONS,
4012
5378
  VIEWER_TO_SHARED_SESSION_TYPES,
4013
5379
  WORKER_BRANCH_STATES,
5380
+ WORKER_COMMITS_MAX,
5381
+ WORKER_CURRENT_BRANCH_RULE,
5382
+ WORKER_DECISIONS_NEEDED_MAX,
4014
5383
  WORKER_PROTOCOL_FOOTER_MARKER,
4015
5384
  WORKER_REPORT_OUTCOMES,
5385
+ WORKER_REPORT_SUMMARY_MAX_CHARS,
5386
+ WORKER_SHELL_LITERAL_PATHS_RULE,
4016
5387
  WORKER_TOOLS,
5388
+ aggregateMissionGitState,
4017
5389
  appendWorkerProtocolFooter,
4018
5390
  argsCarryStatusProbeMarker,
4019
5391
  assessQuotaFreshness,
5392
+ boundEventPayload,
4020
5393
  buildSlotProposal,
4021
5394
  canonicalDaemonId,
5395
+ changelogMissionMarker,
5396
+ classifyChangelogSection,
4022
5397
  classifySessionStatus,
4023
5398
  compareDashboardWireVersion,
4024
5399
  compareSemver,
5400
+ computeRelayReprobeDelay,
4025
5401
  daemonIdsEquivalent,
4026
5402
  decodeActiveWorkQueryRequest,
4027
5403
  decodeActiveWorkQueryResponse,
@@ -4064,6 +5440,8 @@ function isProviderQuestionBinding(value) {
4064
5440
  decodeQueueQueryResponse,
4065
5441
  decodeQueueRequeueRequest,
4066
5442
  decodeQueueRequeueResponse,
5443
+ decodeQueueReviseRequest,
5444
+ decodeQueueReviseResponse,
4067
5445
  decodeRecordLocalRequest,
4068
5446
  decodeRecordLocalResponse,
4069
5447
  decodeRecoveryContextQueryRequest,
@@ -4083,6 +5461,8 @@ function isProviderQuestionBinding(value) {
4083
5461
  decodeUserSessionToDashboard,
4084
5462
  decodeViewerToSharedSession,
4085
5463
  defaultProviderPriorityFromNodeFacts,
5464
+ defaultStagePlan,
5465
+ deriveItemDedupeKey,
4086
5466
  deriveProviderPriorityFromSlots,
4087
5467
  deriveSlotsFromLegacy,
4088
5468
  describeModelSelection,
@@ -4093,14 +5473,21 @@ function isProviderQuestionBinding(value) {
4093
5473
  expandDaemonIdForms,
4094
5474
  findOwnershipConflicts,
4095
5475
  foldKeyedDoc,
5476
+ followedRemoteProjectKey,
5477
+ followerOpPermitted,
4096
5478
  formatQuotaAccount,
5479
+ formatStageVerdictLine,
4097
5480
  hasGitStatusEvidence,
4098
5481
  hasWorkerProtocolFooter,
4099
5482
  interpolateString,
4100
5483
  isActionableProviderApproval,
5484
+ isAssistantFollowerAllowedOp,
4101
5485
  isAssistantTool,
4102
5486
  isBlockedStatus,
5487
+ isBlockingSeverity,
4103
5488
  isBusyStatus,
5489
+ isCarryOverMissionRecord,
5490
+ isCarryOverMissionTitle,
4104
5491
  isChunkType,
4105
5492
  isCommitStrength,
4106
5493
  isDaemonDirectCommandType,
@@ -4116,14 +5503,21 @@ function isProviderQuestionBinding(value) {
4116
5503
  isDeadStatus,
4117
5504
  isDowngrade,
4118
5505
  isEvidenceIdentifier,
5506
+ isFindingCategory,
5507
+ isFindingResponseKind,
5508
+ isFindingSeverity,
4119
5509
  isFiniteNumber,
4120
5510
  isIdleSessionState,
4121
5511
  isInputEnvelopeWire,
5512
+ isLaunchDefaultRole,
5513
+ isLaunchDefaultSource,
5514
+ isLightWorkerSession,
4122
5515
  isMeshDeliveryMode,
4123
5516
  isMeshIndexQueryResponse,
4124
5517
  isMeshMissionStatusValue,
4125
5518
  isMeshP2PSignalType,
4126
5519
  isMeshRecordPayload,
5520
+ isMeshReleaseChannel,
4127
5521
  isMeshTaskDifficulty,
4128
5522
  isMeshTaskMode,
4129
5523
  isMeshTaskPriority,
@@ -4131,6 +5525,8 @@ function isProviderQuestionBinding(value) {
4131
5525
  isMeshTerminalTaskStatus,
4132
5526
  isMeshTopicEntry,
4133
5527
  isMessageId,
5528
+ isMissionOutcome,
5529
+ isMissionRefContained,
4134
5530
  isMissionUpsertResponse,
4135
5531
  isModelAxisSource,
4136
5532
  isNativeMarkerRef,
@@ -4140,10 +5536,13 @@ function isProviderQuestionBinding(value) {
4140
5536
  isOutboundMessageOrigin,
4141
5537
  isP2PSignalType,
4142
5538
  isPhantomDaemonEntry,
5539
+ isPriorFindingStatus,
4143
5540
  isProviderQuestionBinding,
4144
5541
  isRawDaemonDoId,
4145
5542
  isReadyStatus,
4146
5543
  isRecord,
5544
+ isReleaseStatus,
5545
+ isReviewVerdict,
4147
5546
  isSendPolicy,
4148
5547
  isSendPolicyMode,
4149
5548
  isSendRefusal,
@@ -4152,6 +5551,8 @@ function isProviderQuestionBinding(value) {
4152
5551
  isSessionLaunchedBy,
4153
5552
  isSessionStatus,
4154
5553
  isSharedSessionToViewerType,
5554
+ isStageBlockedReason,
5555
+ isStageEligibleTask,
4155
5556
  isSubmitOutcome,
4156
5557
  isSummaryRef,
4157
5558
  isTerminalSessionRecordStatus,
@@ -4170,6 +5571,7 @@ function isProviderQuestionBinding(value) {
4170
5571
  isWorkingStatus,
4171
5572
  joinRepoPath,
4172
5573
  launchModelSelectionValue,
5574
+ lintChangelogText,
4173
5575
  machineCoreFromDaemonId,
4174
5576
  makeTypeGuard,
4175
5577
  measureWorstCaseChunkEnvelopeBytes,
@@ -4181,20 +5583,29 @@ function isProviderQuestionBinding(value) {
4181
5583
  minutesUntilQuotaCheck,
4182
5584
  normalizeAuthOkLimits,
4183
5585
  normalizeBrainSlot,
5586
+ normalizeDecisionInput,
4184
5587
  normalizeDifficultyBrainMap,
5588
+ normalizeForDedupe,
4185
5589
  normalizeGitStatus,
4186
5590
  normalizeMeshNodeFacts,
4187
5591
  normalizeMeshNodeId,
4188
5592
  normalizeMeshSessionRecord,
4189
5593
  normalizeMeshWorkspaceForCompare,
4190
5594
  normalizeMissionBrief,
5595
+ normalizeMissionItemInput,
5596
+ normalizeMissionItemUpdate,
5597
+ normalizeMissionRefs,
5598
+ normalizeMissionSummary,
4191
5599
  normalizeNodeCapabilitySlot,
4192
5600
  normalizeNodeCapabilitySlots,
5601
+ normalizeOutcomeReason,
4193
5602
  normalizeOwnedPaths,
5603
+ normalizeReportCommits,
4194
5604
  normalizeSessionStatus,
4195
5605
  normalizeThinkingLevel,
4196
5606
  orderProvidersByBuiltinPreference,
4197
5607
  parseJsonRecord,
5608
+ parseRoleLaunchSelection,
4198
5609
  parseSemver,
4199
5610
  parseSessionLaunchRecord,
4200
5611
  pathsOverlap,
@@ -4213,11 +5624,17 @@ function isProviderQuestionBinding(value) {
4213
5624
  readStringArray,
4214
5625
  readText,
4215
5626
  renderCoordinatorWorkerSection,
5627
+ renderLightWorkspaceRules,
4216
5628
  renderMissionBriefBlock,
5629
+ renderStageProtocolLines,
4217
5630
  renderWorkerProtocolFooter,
5631
+ resolveStagePlan,
4218
5632
  retiredMeshToolError,
5633
+ reviewIndependenceOf,
5634
+ sanitizeDispatchRefusalDetail,
4219
5635
  sanitizeModelIdentifier,
4220
5636
  sanitizeRefusalCode,
5637
+ sanitizeRemoteRepoIdentity,
4221
5638
  scoreGitStatusCandidate,
4222
5639
  scoreGitUpstreamFreshness,
4223
5640
  sessionIdsEquivalent,
@@ -4228,6 +5645,11 @@ function isProviderQuestionBinding(value) {
4228
5645
  summarizeGitShape,
4229
5646
  supportsQuota,
4230
5647
  touchedFilesOutsideOwnership,
5648
+ truncateMissionText,
5649
+ unwrapPastedContent,
5650
+ validateFindingResponses,
5651
+ validateReviewReport,
5652
+ validateTestsRun,
4231
5653
  withStatusProbeMarker
4232
5654
  });
4233
5655
  //# sourceMappingURL=index.js.map