@adhdev/mesh-shared 1.0.82-rc.45 → 1.0.82-rc.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +452 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +402 -1
- package/dist/index.mjs.map +1 -1
- package/dist/light-task.d.ts +89 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/task-source-phase.d.ts +9 -1
- package/dist/task-stages.d.ts +206 -0
- package/dist/turn-evidence.d.ts +16 -2
- package/dist/turn-ipc-mission.d.ts +2 -0
- package/dist/worker-protocol.d.ts +25 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/light-task.ts +103 -0
- package/src/mesh-tool-names.ts +3 -0
- package/src/task-source-phase.ts +10 -1
- package/src/task-stages.ts +455 -0
- package/src/turn-evidence.ts +29 -0
- package/src/turn-ipc-mission.ts +4 -1
- package/src/worker-protocol.ts +48 -0
package/dist/index.js
CHANGED
|
@@ -69,14 +69,25 @@ __export(index_exports, {
|
|
|
69
69
|
DELIVERY_OUTCOMES: () => DELIVERY_OUTCOMES,
|
|
70
70
|
DELIVERY_VIAS: () => DELIVERY_VIAS,
|
|
71
71
|
DISPATCH_FAILURE_REASONS: () => DISPATCH_FAILURE_REASONS,
|
|
72
|
+
DISPATCH_REFUSAL_DETAIL_MAX: () => DISPATCH_REFUSAL_DETAIL_MAX,
|
|
72
73
|
EVIDENCE_ENVELOPE_FIELD_SPECS: () => EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
73
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,
|
|
74
79
|
HOLD_REASONS: () => HOLD_REASONS,
|
|
75
80
|
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE: () => LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
76
81
|
LAUNCH_DEFAULT_ERROR_CODES: () => LAUNCH_DEFAULT_ERROR_CODES,
|
|
77
82
|
LAUNCH_DEFAULT_ROLES: () => LAUNCH_DEFAULT_ROLES,
|
|
78
83
|
LAUNCH_DEFAULT_SOURCES: () => LAUNCH_DEFAULT_SOURCES,
|
|
79
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,
|
|
80
91
|
LIVENESS_RESULTS: () => LIVENESS_RESULTS,
|
|
81
92
|
MAX_MESH_RECORD_STRING: () => MAX_MESH_RECORD_STRING,
|
|
82
93
|
MAX_OWNED_PATHS: () => MAX_OWNED_PATHS,
|
|
@@ -134,6 +145,7 @@ __export(index_exports, {
|
|
|
134
145
|
OWNER_ABANDON_CONFIRM_OPTIONS: () => OWNER_ABANDON_CONFIRM_OPTIONS,
|
|
135
146
|
OWNER_ABANDON_CONFIRM_QUESTION: () => OWNER_ABANDON_CONFIRM_QUESTION,
|
|
136
147
|
P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
|
|
148
|
+
PRIOR_FINDING_STATUSES: () => PRIOR_FINDING_STATUSES,
|
|
137
149
|
PROVIDER_FAILURES: () => PROVIDER_FAILURES,
|
|
138
150
|
QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
|
|
139
151
|
QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
@@ -150,6 +162,15 @@ __export(index_exports, {
|
|
|
150
162
|
RELEASE_MEMBER_STATES: () => RELEASE_MEMBER_STATES,
|
|
151
163
|
REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
|
|
152
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,
|
|
153
174
|
RelayReprobeScheduler: () => RelayReprobeScheduler,
|
|
154
175
|
SEND_POLICY_MODES: () => SEND_POLICY_MODES,
|
|
155
176
|
SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
|
|
@@ -163,6 +184,17 @@ __export(index_exports, {
|
|
|
163
184
|
SESSION_STATUS_ALIASES: () => SESSION_STATUS_ALIASES,
|
|
164
185
|
SESSION_STATUS_CLASS: () => SESSION_STATUS_CLASS,
|
|
165
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,
|
|
166
198
|
STATUS_PROBE_ARG_KEY: () => STATUS_PROBE_ARG_KEY,
|
|
167
199
|
SUSPENSION_MODALS: () => SUSPENSION_MODALS,
|
|
168
200
|
SUSPENSION_RESOLUTIONS: () => SUSPENSION_RESOLUTIONS,
|
|
@@ -270,6 +302,7 @@ __export(index_exports, {
|
|
|
270
302
|
decodeUserSessionToDashboard: () => decodeUserSessionToDashboard,
|
|
271
303
|
decodeViewerToSharedSession: () => decodeViewerToSharedSession,
|
|
272
304
|
defaultProviderPriorityFromNodeFacts: () => defaultProviderPriorityFromNodeFacts,
|
|
305
|
+
defaultStagePlan: () => defaultStagePlan,
|
|
273
306
|
deriveItemDedupeKey: () => deriveItemDedupeKey,
|
|
274
307
|
deriveProviderPriorityFromSlots: () => deriveProviderPriorityFromSlots,
|
|
275
308
|
deriveSlotsFromLegacy: () => deriveSlotsFromLegacy,
|
|
@@ -284,6 +317,7 @@ __export(index_exports, {
|
|
|
284
317
|
followedRemoteProjectKey: () => followedRemoteProjectKey,
|
|
285
318
|
followerOpPermitted: () => followerOpPermitted,
|
|
286
319
|
formatQuotaAccount: () => formatQuotaAccount,
|
|
320
|
+
formatStageVerdictLine: () => formatStageVerdictLine,
|
|
287
321
|
hasGitStatusEvidence: () => hasGitStatusEvidence,
|
|
288
322
|
hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
|
|
289
323
|
interpolateString: () => interpolateString,
|
|
@@ -291,6 +325,7 @@ __export(index_exports, {
|
|
|
291
325
|
isAssistantFollowerAllowedOp: () => isAssistantFollowerAllowedOp,
|
|
292
326
|
isAssistantTool: () => isAssistantTool,
|
|
293
327
|
isBlockedStatus: () => isBlockedStatus,
|
|
328
|
+
isBlockingSeverity: () => isBlockingSeverity,
|
|
294
329
|
isBusyStatus: () => isBusyStatus,
|
|
295
330
|
isCarryOverMissionRecord: () => isCarryOverMissionRecord,
|
|
296
331
|
isCarryOverMissionTitle: () => isCarryOverMissionTitle,
|
|
@@ -309,6 +344,9 @@ __export(index_exports, {
|
|
|
309
344
|
isDeadStatus: () => isDeadStatus,
|
|
310
345
|
isDowngrade: () => isDowngrade,
|
|
311
346
|
isEvidenceIdentifier: () => isEvidenceIdentifier,
|
|
347
|
+
isFindingCategory: () => isFindingCategory,
|
|
348
|
+
isFindingResponseKind: () => isFindingResponseKind,
|
|
349
|
+
isFindingSeverity: () => isFindingSeverity,
|
|
312
350
|
isFiniteNumber: () => isFiniteNumber,
|
|
313
351
|
isIdleSessionState: () => isIdleSessionState,
|
|
314
352
|
isInputEnvelopeWire: () => isInputEnvelopeWire,
|
|
@@ -338,11 +376,13 @@ __export(index_exports, {
|
|
|
338
376
|
isOutboundMessageOrigin: () => isOutboundMessageOrigin,
|
|
339
377
|
isP2PSignalType: () => isP2PSignalType,
|
|
340
378
|
isPhantomDaemonEntry: () => isPhantomDaemonEntry,
|
|
379
|
+
isPriorFindingStatus: () => isPriorFindingStatus,
|
|
341
380
|
isProviderQuestionBinding: () => isProviderQuestionBinding,
|
|
342
381
|
isRawDaemonDoId: () => isRawDaemonDoId,
|
|
343
382
|
isReadyStatus: () => isReadyStatus,
|
|
344
383
|
isRecord: () => isRecord,
|
|
345
384
|
isReleaseStatus: () => isReleaseStatus,
|
|
385
|
+
isReviewVerdict: () => isReviewVerdict,
|
|
346
386
|
isSendPolicy: () => isSendPolicy,
|
|
347
387
|
isSendPolicyMode: () => isSendPolicyMode,
|
|
348
388
|
isSendRefusal: () => isSendRefusal,
|
|
@@ -351,6 +391,8 @@ __export(index_exports, {
|
|
|
351
391
|
isSessionLaunchedBy: () => isSessionLaunchedBy,
|
|
352
392
|
isSessionStatus: () => isSessionStatus,
|
|
353
393
|
isSharedSessionToViewerType: () => isSharedSessionToViewerType,
|
|
394
|
+
isStageBlockedReason: () => isStageBlockedReason,
|
|
395
|
+
isStageEligibleTask: () => isStageEligibleTask,
|
|
354
396
|
isSubmitOutcome: () => isSubmitOutcome,
|
|
355
397
|
isSummaryRef: () => isSummaryRef,
|
|
356
398
|
isTerminalSessionRecordStatus: () => isTerminalSessionRecordStatus,
|
|
@@ -422,9 +464,14 @@ __export(index_exports, {
|
|
|
422
464
|
readStringArray: () => readStringArray,
|
|
423
465
|
readText: () => readText,
|
|
424
466
|
renderCoordinatorWorkerSection: () => renderCoordinatorWorkerSection,
|
|
467
|
+
renderLightWorkspaceRules: () => renderLightWorkspaceRules,
|
|
425
468
|
renderMissionBriefBlock: () => renderMissionBriefBlock,
|
|
469
|
+
renderStageProtocolLines: () => renderStageProtocolLines,
|
|
426
470
|
renderWorkerProtocolFooter: () => renderWorkerProtocolFooter,
|
|
471
|
+
resolveStagePlan: () => resolveStagePlan,
|
|
427
472
|
retiredMeshToolError: () => retiredMeshToolError,
|
|
473
|
+
reviewIndependenceOf: () => reviewIndependenceOf,
|
|
474
|
+
sanitizeDispatchRefusalDetail: () => sanitizeDispatchRefusalDetail,
|
|
428
475
|
sanitizeModelIdentifier: () => sanitizeModelIdentifier,
|
|
429
476
|
sanitizeRefusalCode: () => sanitizeRefusalCode,
|
|
430
477
|
sanitizeRemoteRepoIdentity: () => sanitizeRemoteRepoIdentity,
|
|
@@ -440,6 +487,9 @@ __export(index_exports, {
|
|
|
440
487
|
touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
|
|
441
488
|
truncateMissionText: () => truncateMissionText,
|
|
442
489
|
unwrapPastedContent: () => unwrapPastedContent,
|
|
490
|
+
validateFindingResponses: () => validateFindingResponses,
|
|
491
|
+
validateReviewReport: () => validateReviewReport,
|
|
492
|
+
validateTestsRun: () => validateTestsRun,
|
|
443
493
|
withStatusProbeMarker: () => withStatusProbeMarker
|
|
444
494
|
});
|
|
445
495
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1201,9 +1251,12 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1201
1251
|
"mesh_enqueue_task",
|
|
1202
1252
|
"mesh_view_queue",
|
|
1203
1253
|
"mesh_queue_cancel",
|
|
1254
|
+
"mesh_task_stage_decide",
|
|
1204
1255
|
"mesh_direct_cancel",
|
|
1205
1256
|
"mesh_queue_requeue",
|
|
1206
1257
|
"mesh_queue_revise",
|
|
1258
|
+
"mesh_light_land",
|
|
1259
|
+
"mesh_light_discard",
|
|
1207
1260
|
"mesh_send_task",
|
|
1208
1261
|
"mesh_read_chat",
|
|
1209
1262
|
"mesh_read_debug",
|
|
@@ -2163,6 +2216,15 @@ function isWorkerTool(value) {
|
|
|
2163
2216
|
return typeof value === "string" && WORKER_TOOL_SET.has(value);
|
|
2164
2217
|
}
|
|
2165
2218
|
var WORKER_PROTOCOL_FOOTER_MARKER = "--- adhdev worker protocol ---";
|
|
2219
|
+
function renderLightWorkspaceRules(light) {
|
|
2220
|
+
const base = light.ossBaseSha ? `${light.baseSha} (oss ${light.ossBaseSha})` : light.baseSha;
|
|
2221
|
+
return [
|
|
2222
|
+
`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.`,
|
|
2223
|
+
"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`.",
|
|
2224
|
+
"Do not start long-running servers on fixed ports. Run the narrowest tests that cover your change and list them in `report_completion.testsRun`.",
|
|
2225
|
+
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."
|
|
2226
|
+
];
|
|
2227
|
+
}
|
|
2166
2228
|
function hasWorkerProtocolFooter(body) {
|
|
2167
2229
|
return typeof body === "string" && body.includes(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
2168
2230
|
}
|
|
@@ -2184,6 +2246,7 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
2184
2246
|
if (input.readonly) scope.push("read-only");
|
|
2185
2247
|
if (scope.length) lines.push(`You are a delegated worker (${scope.join(", ")}).`);
|
|
2186
2248
|
else lines.push("You are a delegated worker.");
|
|
2249
|
+
if (input.light) lines.push(...renderLightWorkspaceRules(input.light));
|
|
2187
2250
|
if (input.workerMcp === false) {
|
|
2188
2251
|
lines.push(
|
|
2189
2252
|
"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.",
|
|
@@ -2211,8 +2274,21 @@ function renderWorkerProtocolFooter(input = {}) {
|
|
|
2211
2274
|
`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.`
|
|
2212
2275
|
);
|
|
2213
2276
|
}
|
|
2277
|
+
if (input.stage) lines.push(...renderStageProtocolLines(input.stage));
|
|
2214
2278
|
return lines.join("\n");
|
|
2215
2279
|
}
|
|
2280
|
+
function renderStageProtocolLines(stage) {
|
|
2281
|
+
if (stage.role === "review") {
|
|
2282
|
+
return [
|
|
2283
|
+
`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."),
|
|
2284
|
+
"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."
|
|
2285
|
+
];
|
|
2286
|
+
}
|
|
2287
|
+
return [
|
|
2288
|
+
`STAGE: your \`report_completion\` is a stage report (${stage.role}, round ${stage.round}). An independent reviewer reads your diff next, so commit your work and leave the workspace clean before you report. You may receive review findings as a follow-up memo in this same session.`,
|
|
2289
|
+
...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."] : []
|
|
2290
|
+
];
|
|
2291
|
+
}
|
|
2216
2292
|
function stripWorkerProtocolFooter(body) {
|
|
2217
2293
|
if (typeof body !== "string") return body;
|
|
2218
2294
|
const at = body.indexOf(WORKER_PROTOCOL_FOOTER_MARKER);
|
|
@@ -2475,6 +2551,17 @@ function sanitizeRefusalCode(value) {
|
|
|
2475
2551
|
if (!normalized) return void 0;
|
|
2476
2552
|
return normalized.slice(0, 64);
|
|
2477
2553
|
}
|
|
2554
|
+
var DISPATCH_REFUSAL_DETAIL_MAX = 200;
|
|
2555
|
+
function sanitizeDispatchRefusalDetail(code, message) {
|
|
2556
|
+
const cleanCode = sanitizeRefusalCode(code);
|
|
2557
|
+
let cleanMessage;
|
|
2558
|
+
if (typeof message === "string") {
|
|
2559
|
+
const line = message.replace(/(?:[A-Za-z]:)?[\\/](?:Users|home)[\\/][^\s\\/]+/g, "~").replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
2560
|
+
if (line) cleanMessage = line.length > DISPATCH_REFUSAL_DETAIL_MAX ? `${line.slice(0, DISPATCH_REFUSAL_DETAIL_MAX - 1)}\u2026` : line;
|
|
2561
|
+
}
|
|
2562
|
+
if (!cleanCode && !cleanMessage) return void 0;
|
|
2563
|
+
return { ...cleanCode ? { code: cleanCode } : {}, ...cleanMessage ? { message: cleanMessage } : {} };
|
|
2564
|
+
}
|
|
2478
2565
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
2479
2566
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
2480
2567
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
@@ -2549,6 +2636,8 @@ var TURN_REASONS = [
|
|
|
2549
2636
|
"reclaim_budget_exhausted",
|
|
2550
2637
|
"hollow_max_retries",
|
|
2551
2638
|
"migration_orphan",
|
|
2639
|
+
// a stopping attempt whose writer node stayed unreachable (or was removed) past the bound
|
|
2640
|
+
"writer_unreachable",
|
|
2552
2641
|
// reclaims (generation + 1)
|
|
2553
2642
|
"dispatch_refused_session_exited",
|
|
2554
2643
|
"dispatch_refused_no_target",
|
|
@@ -3522,13 +3611,14 @@ function isLedgerQueryEntryWire(value) {
|
|
|
3522
3611
|
return true;
|
|
3523
3612
|
}
|
|
3524
3613
|
function isLedgerQuerySummaryWire(value) {
|
|
3525
|
-
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures"];
|
|
3614
|
+
const keys = ["meshId", "totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskBlocked", "taskStalled", "sessionLaunched", "checkpointCreated", "lastActivityAt", "recentFailures", "taskBlocked", "refineFailed"];
|
|
3526
3615
|
if (!isRecord(value) || !hasOnlyKeys2(value, keys)) return false;
|
|
3527
3616
|
if (!isEvidenceIdentifier(value.meshId)) return false;
|
|
3528
3617
|
for (const k of ["totalEntries", "taskDispatched", "taskCompleted", "taskFailed", "taskStalled", "sessionLaunched", "checkpointCreated", "recentFailures"]) {
|
|
3529
3618
|
if (!isNonNegativeInt(value[k])) return false;
|
|
3530
3619
|
}
|
|
3531
3620
|
if (value.taskBlocked !== void 0 && !isNonNegativeInt(value.taskBlocked)) return false;
|
|
3621
|
+
if (value.refineFailed !== void 0 && !isNonNegativeInt(value.refineFailed)) return false;
|
|
3532
3622
|
if (value.lastActivityAt !== null && typeof value.lastActivityAt !== "string") return false;
|
|
3533
3623
|
return true;
|
|
3534
3624
|
}
|
|
@@ -4660,6 +4750,34 @@ function isProviderQuestionBinding(value) {
|
|
|
4660
4750
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
4661
4751
|
}
|
|
4662
4752
|
|
|
4753
|
+
// src/task-source-phase.ts
|
|
4754
|
+
function reviewIndependenceOf(review) {
|
|
4755
|
+
return review.independence ?? "different_provider";
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
// src/light-task.ts
|
|
4759
|
+
var LIGHT_REJECT = {
|
|
4760
|
+
REQUIRES_LOCAL_BASE: "light_requires_local_base",
|
|
4761
|
+
NOT_CONFIGURED: "light_workspace_not_configured",
|
|
4762
|
+
REQUIRES_OWNED_PATHS: "light_requires_owned_paths",
|
|
4763
|
+
MODE_CONFLICT: "light_mode_conflict"
|
|
4764
|
+
};
|
|
4765
|
+
var LIGHT_HOLD = {
|
|
4766
|
+
PREPARE_FAILED: "light_workspace_prepare_failed",
|
|
4767
|
+
LIMIT: "light_workspace_limit",
|
|
4768
|
+
DISK_LOW: "light_workspace_disk_low",
|
|
4769
|
+
CAP: "max_light_parallel_tasks_reached"
|
|
4770
|
+
};
|
|
4771
|
+
var LIGHT_BLOCK_REASONS = [
|
|
4772
|
+
"light_uncommitted_changes",
|
|
4773
|
+
"light_dependency_change",
|
|
4774
|
+
"light_lineage_unproven",
|
|
4775
|
+
"shared_checkout_mutated"
|
|
4776
|
+
];
|
|
4777
|
+
var LIGHT_WARNINGS = ["shared_checkout_changed_during_task", "light_base_dirty_overlap"];
|
|
4778
|
+
var LIGHT_LAND_MODES = ["refine", "apply_to_checkout"];
|
|
4779
|
+
var LIGHT_TESTS_RUN_MAX = 20;
|
|
4780
|
+
|
|
4663
4781
|
// src/relay-reprobe.ts
|
|
4664
4782
|
var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
|
|
4665
4783
|
var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
|
|
@@ -4739,6 +4857,289 @@ var RelayReprobeScheduler = class {
|
|
|
4739
4857
|
this.schedule();
|
|
4740
4858
|
}
|
|
4741
4859
|
};
|
|
4860
|
+
|
|
4861
|
+
// src/task-stages.ts
|
|
4862
|
+
var REVIEW_VERDICTS = ["approve", "approve_with_nits", "changes_requested", "reject_approach"];
|
|
4863
|
+
var FINDING_SEVERITIES = ["blocking", "major", "minor", "nit"];
|
|
4864
|
+
var FINDING_CATEGORIES = ["correctness", "regression", "test_gap", "scope", "security", "performance", "maintainability"];
|
|
4865
|
+
var PRIOR_FINDING_STATUSES = ["resolved", "unresolved", "dispute_accepted", "dispute_rejected"];
|
|
4866
|
+
var FINDING_RESPONSE_KINDS = ["fixed", "disputed"];
|
|
4867
|
+
var STAGE_PHASES = ["implementing", "self_checking", "awaiting_review", "reviewing", "revising", "done"];
|
|
4868
|
+
var STAGE_PARKED_PHASES = ["self_checking", "awaiting_review", "reviewing"];
|
|
4869
|
+
var STAGE_INDEPENDENCE_MODES = ["different_provider", "fresh_session_ok"];
|
|
4870
|
+
var STAGE_ROLES = ["implement", "revise", "review"];
|
|
4871
|
+
var STAGE_BLOCKED_REASONS = [
|
|
4872
|
+
"review_unresolved",
|
|
4873
|
+
"review_rejected_approach",
|
|
4874
|
+
"review_unavailable",
|
|
4875
|
+
"self_check_failed",
|
|
4876
|
+
"stage_pipeline_ceiling",
|
|
4877
|
+
"reviewer_mutated_source",
|
|
4878
|
+
// The read-lease checkout could not be fingerprinted (start or end): the review's integrity cannot be verified.
|
|
4879
|
+
"reviewer_integrity_unverifiable"
|
|
4880
|
+
];
|
|
4881
|
+
var STAGE_DECIDE_ACTIONS = ["accept", "revise_once", "rereview", "abandon"];
|
|
4882
|
+
var STAGE_MAX_REVISIONS_LIMIT = 3;
|
|
4883
|
+
var STAGE_DEFAULT_MAX_REVISIONS = 2;
|
|
4884
|
+
var STAGE_SELF_CHECK_MAX_BOUNCES = 2;
|
|
4885
|
+
var STAGE_INDEPENDENCE_FALLBACK_MS = 10 * 60 * 1e3;
|
|
4886
|
+
var STAGE_PIPELINE_CEILING_DEFAULT_MS = 4 * 60 * 60 * 1e3;
|
|
4887
|
+
var REVIEW_FINDINGS_MAX = 30;
|
|
4888
|
+
var REVIEW_CLAIM_MAX_CHARS = 500;
|
|
4889
|
+
var REVIEW_EVIDENCE_MAX_CHARS = 1e3;
|
|
4890
|
+
var REVIEW_FIX_MAX_CHARS = 500;
|
|
4891
|
+
var REVIEW_FINDING_ID_MAX_CHARS = 40;
|
|
4892
|
+
var REVIEW_CHECKED_MAX = 20;
|
|
4893
|
+
var REVIEW_NOTE_MAX_CHARS = 500;
|
|
4894
|
+
var REVIEW_TESTS_RUN_MAX = 20;
|
|
4895
|
+
var FINDING_RESPONSES_MAX = 30;
|
|
4896
|
+
function makeGuard4(values) {
|
|
4897
|
+
const set = new Set(values);
|
|
4898
|
+
return (value) => typeof value === "string" && set.has(value);
|
|
4899
|
+
}
|
|
4900
|
+
var isReviewVerdict = makeGuard4(REVIEW_VERDICTS);
|
|
4901
|
+
var isFindingSeverity = makeGuard4(FINDING_SEVERITIES);
|
|
4902
|
+
var isFindingCategory = makeGuard4(FINDING_CATEGORIES);
|
|
4903
|
+
var isPriorFindingStatus = makeGuard4(PRIOR_FINDING_STATUSES);
|
|
4904
|
+
var isFindingResponseKind = makeGuard4(FINDING_RESPONSE_KINDS);
|
|
4905
|
+
var isStageBlockedReason = makeGuard4(STAGE_BLOCKED_REASONS);
|
|
4906
|
+
var isRecord4 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
4907
|
+
function isBlockingSeverity(severity) {
|
|
4908
|
+
return severity === "blocking" || severity === "major";
|
|
4909
|
+
}
|
|
4910
|
+
function resolveStagePlan(raw, task, opts = {}) {
|
|
4911
|
+
const eligible = isStageEligibleTask(task);
|
|
4912
|
+
if (raw === void 0 || raw === null) return (opts.defaultOn ?? true) && defaultsOnFor(task) ? defaultStagePlan() : null;
|
|
4913
|
+
if (raw === false) return null;
|
|
4914
|
+
if (raw === true) {
|
|
4915
|
+
if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
|
|
4916
|
+
return defaultStagePlan();
|
|
4917
|
+
}
|
|
4918
|
+
if (!isRecord4(raw)) throw new Error("invalid_review_option: review must be true, false or {max_revisions?, independence?}");
|
|
4919
|
+
const allowed = /* @__PURE__ */ new Set(["max_revisions", "maxRevisions", "independence"]);
|
|
4920
|
+
for (const key of Object.keys(raw)) {
|
|
4921
|
+
if (!allowed.has(key)) throw new Error(`invalid_review_option: unknown review key '${key}' (expected max_revisions, independence)`);
|
|
4922
|
+
}
|
|
4923
|
+
if (!eligible) throw new Error(`invalid_review_option: review requires a non-readonly code_change task (got taskMode=${task.taskMode ?? "unset"}${task.readonly ? ", readonly" : ""})`);
|
|
4924
|
+
const rawMax = raw.max_revisions ?? raw.maxRevisions;
|
|
4925
|
+
let maxRevisions = STAGE_DEFAULT_MAX_REVISIONS;
|
|
4926
|
+
if (rawMax !== void 0) {
|
|
4927
|
+
if (typeof rawMax !== "number" || !Number.isInteger(rawMax) || rawMax < 0 || rawMax > STAGE_MAX_REVISIONS_LIMIT) {
|
|
4928
|
+
throw new Error(`invalid_review_option: max_revisions must be an integer 0..${STAGE_MAX_REVISIONS_LIMIT}`);
|
|
4929
|
+
}
|
|
4930
|
+
maxRevisions = rawMax;
|
|
4931
|
+
}
|
|
4932
|
+
let independence = "fresh_session_ok";
|
|
4933
|
+
if (raw.independence !== void 0) {
|
|
4934
|
+
if (!STAGE_INDEPENDENCE_MODES.includes(raw.independence)) {
|
|
4935
|
+
throw new Error(`invalid_review_option: independence must be one of ${STAGE_INDEPENDENCE_MODES.join(" | ")}`);
|
|
4936
|
+
}
|
|
4937
|
+
independence = raw.independence;
|
|
4938
|
+
}
|
|
4939
|
+
return { review: true, maxRevisions, independence };
|
|
4940
|
+
}
|
|
4941
|
+
function defaultStagePlan() {
|
|
4942
|
+
return { review: true, maxRevisions: STAGE_DEFAULT_MAX_REVISIONS, independence: "fresh_session_ok" };
|
|
4943
|
+
}
|
|
4944
|
+
function isStageEligibleTask(task) {
|
|
4945
|
+
if (task.readonly) return false;
|
|
4946
|
+
return (task.taskMode ?? "code_change") === "code_change";
|
|
4947
|
+
}
|
|
4948
|
+
function defaultsOnFor(task) {
|
|
4949
|
+
return isStageEligibleTask(task) && (task.difficulty === "medium" || task.difficulty === "difficult");
|
|
4950
|
+
}
|
|
4951
|
+
function str2(value) {
|
|
4952
|
+
return typeof value === "string" ? value.trim() : "";
|
|
4953
|
+
}
|
|
4954
|
+
function validateStringList(value, field, max, maxChars, errors, minItems = 0) {
|
|
4955
|
+
if (!Array.isArray(value)) {
|
|
4956
|
+
errors.push({ field, message: `${field} must be an array of strings` });
|
|
4957
|
+
return [];
|
|
4958
|
+
}
|
|
4959
|
+
if (value.length > max) errors.push({ field, message: `${field} has ${value.length} entries, over the ${max} limit` });
|
|
4960
|
+
const out = [];
|
|
4961
|
+
for (const item of value) {
|
|
4962
|
+
const text = str2(item);
|
|
4963
|
+
if (!text) continue;
|
|
4964
|
+
if (text.length > maxChars) {
|
|
4965
|
+
errors.push({ field, message: `${field} contains an entry over ${maxChars} chars` });
|
|
4966
|
+
continue;
|
|
4967
|
+
}
|
|
4968
|
+
out.push(text);
|
|
4969
|
+
}
|
|
4970
|
+
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` });
|
|
4971
|
+
return out;
|
|
4972
|
+
}
|
|
4973
|
+
function validateReviewReport(raw, ctx) {
|
|
4974
|
+
const errors = [];
|
|
4975
|
+
if (!isRecord4(raw)) return { errors: [{ field: "review", message: "review must be an object {verdict, findings, checked, notChecked, ...}" }] };
|
|
4976
|
+
const KNOWN = /* @__PURE__ */ new Set(["verdict", "findings", "priorFindings", "checked", "notChecked", "testsRun"]);
|
|
4977
|
+
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(", ")})` });
|
|
4978
|
+
const verdict = raw.verdict;
|
|
4979
|
+
if (!isReviewVerdict(verdict)) errors.push({ field: "review.verdict", message: `verdict must be one of ${REVIEW_VERDICTS.join(" | ")}` });
|
|
4980
|
+
const findings = [];
|
|
4981
|
+
if (!Array.isArray(raw.findings)) errors.push({ field: "review.findings", message: "findings must be an array (use [] when there are none)" });
|
|
4982
|
+
else {
|
|
4983
|
+
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` });
|
|
4984
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4985
|
+
raw.findings.forEach((f, i) => {
|
|
4986
|
+
const at = `review.findings[${i}]`;
|
|
4987
|
+
if (!isRecord4(f)) {
|
|
4988
|
+
errors.push({ field: at, message: "each finding must be an object" });
|
|
4989
|
+
return;
|
|
4990
|
+
}
|
|
4991
|
+
const FK = /* @__PURE__ */ new Set(["id", "severity", "category", "file", "line", "claim", "evidence", "suggestedFix"]);
|
|
4992
|
+
for (const key of Object.keys(f)) if (!FK.has(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
4993
|
+
const id2 = str2(f.id);
|
|
4994
|
+
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)` });
|
|
4995
|
+
else if (seen.has(id2)) errors.push({ field: `${at}.id`, message: `duplicate finding id '${id2}'` });
|
|
4996
|
+
else seen.add(id2);
|
|
4997
|
+
if (!isFindingSeverity(f.severity)) errors.push({ field: `${at}.severity`, message: `severity must be one of ${FINDING_SEVERITIES.join(" | ")}` });
|
|
4998
|
+
if (!isFindingCategory(f.category)) errors.push({ field: `${at}.category`, message: `category must be one of ${FINDING_CATEGORIES.join(" | ")}` });
|
|
4999
|
+
const claim = str2(f.claim);
|
|
5000
|
+
if (!claim) errors.push({ field: `${at}.claim`, message: "claim is required" });
|
|
5001
|
+
else if (claim.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.claim`, message: `claim is over ${REVIEW_CLAIM_MAX_CHARS} chars` });
|
|
5002
|
+
const evidence = str2(f.evidence);
|
|
5003
|
+
if (!evidence) errors.push({ field: `${at}.evidence`, message: "evidence is required \u2014 what did you read or run to know this" });
|
|
5004
|
+
else if (evidence.length > REVIEW_EVIDENCE_MAX_CHARS) errors.push({ field: `${at}.evidence`, message: `evidence is over ${REVIEW_EVIDENCE_MAX_CHARS} chars` });
|
|
5005
|
+
const fix = f.suggestedFix === void 0 ? void 0 : str2(f.suggestedFix);
|
|
5006
|
+
if (fix !== void 0 && fix.length > REVIEW_FIX_MAX_CHARS) errors.push({ field: `${at}.suggestedFix`, message: `suggestedFix is over ${REVIEW_FIX_MAX_CHARS} chars` });
|
|
5007
|
+
if (f.file !== void 0 && typeof f.file !== "string") errors.push({ field: `${at}.file`, message: "file must be a string" });
|
|
5008
|
+
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" });
|
|
5009
|
+
if (id2 && isFindingSeverity(f.severity) && isFindingCategory(f.category) && claim && evidence) {
|
|
5010
|
+
findings.push({
|
|
5011
|
+
id: id2,
|
|
5012
|
+
severity: f.severity,
|
|
5013
|
+
category: f.category,
|
|
5014
|
+
...typeof f.file === "string" && f.file.trim() ? { file: f.file.trim() } : {},
|
|
5015
|
+
...typeof f.line === "number" ? { line: f.line } : {},
|
|
5016
|
+
claim,
|
|
5017
|
+
evidence,
|
|
5018
|
+
...fix ? { suggestedFix: fix } : {}
|
|
5019
|
+
});
|
|
5020
|
+
}
|
|
5021
|
+
});
|
|
5022
|
+
}
|
|
5023
|
+
const checked = validateStringList(raw.checked, "review.checked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
5024
|
+
const notChecked = validateStringList(raw.notChecked, "review.notChecked", REVIEW_CHECKED_MAX, REVIEW_CLAIM_MAX_CHARS, errors, 1);
|
|
5025
|
+
let priorFindings;
|
|
5026
|
+
if (raw.priorFindings !== void 0) {
|
|
5027
|
+
if (!Array.isArray(raw.priorFindings)) errors.push({ field: "review.priorFindings", message: "priorFindings must be an array" });
|
|
5028
|
+
else {
|
|
5029
|
+
priorFindings = [];
|
|
5030
|
+
raw.priorFindings.forEach((p, i) => {
|
|
5031
|
+
const at = `review.priorFindings[${i}]`;
|
|
5032
|
+
if (!isRecord4(p)) {
|
|
5033
|
+
errors.push({ field: at, message: "each entry must be an object {id, status, note?}" });
|
|
5034
|
+
return;
|
|
5035
|
+
}
|
|
5036
|
+
for (const key of Object.keys(p)) if (!["id", "status", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
5037
|
+
const id2 = str2(p.id);
|
|
5038
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
5039
|
+
if (!isPriorFindingStatus(p.status)) errors.push({ field: `${at}.status`, message: `status must be one of ${PRIOR_FINDING_STATUSES.join(" | ")}` });
|
|
5040
|
+
const note = p.note === void 0 ? void 0 : str2(p.note);
|
|
5041
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
5042
|
+
if (id2 && isPriorFindingStatus(p.status)) priorFindings.push({ id: id2, status: p.status, ...note ? { note } : {} });
|
|
5043
|
+
});
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
const testsRun = raw.testsRun === void 0 ? void 0 : validateTestsRun(raw.testsRun, "review.testsRun", errors);
|
|
5047
|
+
if (isReviewVerdict(verdict)) {
|
|
5048
|
+
const blocking = findings.filter((f) => isBlockingSeverity(f.severity));
|
|
5049
|
+
if (verdict === "changes_requested" && blocking.length === 0 && Array.isArray(raw.findings) && errors.length === 0) {
|
|
5050
|
+
errors.push({ field: "review.verdict", message: "changes_requested needs at least one blocking or major finding \u2014 nits alone are approve_with_nits" });
|
|
5051
|
+
}
|
|
5052
|
+
if (verdict === "approve" && blocking.length > 0) {
|
|
5053
|
+
errors.push({ field: "review.verdict", message: "approve cannot carry blocking or major findings" });
|
|
5054
|
+
}
|
|
5055
|
+
if (verdict === "approve_with_nits" && blocking.length > 0) {
|
|
5056
|
+
errors.push({ field: "review.verdict", message: "approve_with_nits cannot carry blocking or major findings \u2014 use changes_requested" });
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
if (ctx.round >= 2 && ctx.priorOpenBlockingIds?.length) {
|
|
5060
|
+
const answered = new Set((priorFindings ?? []).map((p) => p.id));
|
|
5061
|
+
const missing = ctx.priorOpenBlockingIds.filter((id2) => !answered.has(id2));
|
|
5062
|
+
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(", ")}` });
|
|
5063
|
+
}
|
|
5064
|
+
if (errors.length) return { errors };
|
|
5065
|
+
return {
|
|
5066
|
+
report: {
|
|
5067
|
+
verdict,
|
|
5068
|
+
findings,
|
|
5069
|
+
...priorFindings?.length ? { priorFindings } : {},
|
|
5070
|
+
checked,
|
|
5071
|
+
notChecked,
|
|
5072
|
+
...testsRun?.length ? { testsRun } : {}
|
|
5073
|
+
},
|
|
5074
|
+
errors: []
|
|
5075
|
+
};
|
|
5076
|
+
}
|
|
5077
|
+
function validateTestsRun(raw, field, errors) {
|
|
5078
|
+
if (!Array.isArray(raw)) {
|
|
5079
|
+
errors.push({ field, message: `${field} must be an array of {command, exit, passed?, failed?, note?}` });
|
|
5080
|
+
return [];
|
|
5081
|
+
}
|
|
5082
|
+
if (raw.length > REVIEW_TESTS_RUN_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${REVIEW_TESTS_RUN_MAX} limit` });
|
|
5083
|
+
const out = [];
|
|
5084
|
+
raw.forEach((t, i) => {
|
|
5085
|
+
const at = `${field}[${i}]`;
|
|
5086
|
+
if (!isRecord4(t)) {
|
|
5087
|
+
errors.push({ field: at, message: "each entry must be an object" });
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
for (const key of Object.keys(t)) if (!["command", "exit", "passed", "failed", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
5091
|
+
const command = str2(t.command);
|
|
5092
|
+
if (!command || command.length > REVIEW_CLAIM_MAX_CHARS) errors.push({ field: `${at}.command`, message: `command is required (\u2264 ${REVIEW_CLAIM_MAX_CHARS} chars)` });
|
|
5093
|
+
if (typeof t.exit !== "number" || !Number.isInteger(t.exit)) errors.push({ field: `${at}.exit`, message: "exit must be an integer" });
|
|
5094
|
+
for (const k of ["passed", "failed"]) {
|
|
5095
|
+
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` });
|
|
5096
|
+
}
|
|
5097
|
+
const note = t.note === void 0 ? void 0 : str2(t.note);
|
|
5098
|
+
if (note !== void 0 && note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
5099
|
+
if (command && typeof t.exit === "number") {
|
|
5100
|
+
out.push({
|
|
5101
|
+
command,
|
|
5102
|
+
exit: t.exit,
|
|
5103
|
+
...typeof t.passed === "number" ? { passed: t.passed } : {},
|
|
5104
|
+
...typeof t.failed === "number" ? { failed: t.failed } : {},
|
|
5105
|
+
...note ? { note } : {}
|
|
5106
|
+
});
|
|
5107
|
+
}
|
|
5108
|
+
});
|
|
5109
|
+
return out;
|
|
5110
|
+
}
|
|
5111
|
+
function validateFindingResponses(raw, field = "findingResponses") {
|
|
5112
|
+
const errors = [];
|
|
5113
|
+
if (!Array.isArray(raw)) return { errors: [{ field, message: `${field} must be an array of {id, response, note}` }] };
|
|
5114
|
+
if (raw.length > FINDING_RESPONSES_MAX) errors.push({ field, message: `${field} has ${raw.length} entries, over the ${FINDING_RESPONSES_MAX} limit` });
|
|
5115
|
+
const out = [];
|
|
5116
|
+
raw.forEach((r, i) => {
|
|
5117
|
+
const at = `${field}[${i}]`;
|
|
5118
|
+
if (!isRecord4(r)) {
|
|
5119
|
+
errors.push({ field: at, message: "each entry must be an object {id, response, note}" });
|
|
5120
|
+
return;
|
|
5121
|
+
}
|
|
5122
|
+
for (const key of Object.keys(r)) if (!["id", "response", "note"].includes(key)) errors.push({ field: `${at}.${key}`, message: `unknown field '${key}'` });
|
|
5123
|
+
const id2 = str2(r.id);
|
|
5124
|
+
if (!id2) errors.push({ field: `${at}.id`, message: "id is required" });
|
|
5125
|
+
if (!isFindingResponseKind(r.response)) errors.push({ field: `${at}.response`, message: `response must be one of ${FINDING_RESPONSE_KINDS.join(" | ")}` });
|
|
5126
|
+
const note = str2(r.note);
|
|
5127
|
+
if (!note) errors.push({ field: `${at}.note`, message: "note is required \u2014 say what changed, or why you dispute it" });
|
|
5128
|
+
else if (note.length > REVIEW_NOTE_MAX_CHARS) errors.push({ field: `${at}.note`, message: `note is over ${REVIEW_NOTE_MAX_CHARS} chars` });
|
|
5129
|
+
if (id2 && isFindingResponseKind(r.response) && note && note.length <= REVIEW_NOTE_MAX_CHARS) out.push({ id: id2, response: r.response, note });
|
|
5130
|
+
});
|
|
5131
|
+
return errors.length ? { errors } : { responses: out, errors: [] };
|
|
5132
|
+
}
|
|
5133
|
+
function formatStageVerdictLine(input) {
|
|
5134
|
+
const parts = [`review: ${input.verdict}`];
|
|
5135
|
+
if (input.verdict === "skipped_no_diff") return parts[0];
|
|
5136
|
+
parts.push(`${input.rounds} round${input.rounds === 1 ? "" : "s"}`);
|
|
5137
|
+
if (input.reviewerProvider) parts.push(`reviewer ${input.reviewerProvider} (${input.independenceUsed ?? "different_provider"})`);
|
|
5138
|
+
const tail = [];
|
|
5139
|
+
if (input.fixed) tail.push(`${input.fixed} finding${input.fixed === 1 ? "" : "s"} fixed`);
|
|
5140
|
+
if (input.openNits) tail.push(`${input.openNits} nit${input.openNits === 1 ? "" : "s"} open`);
|
|
5141
|
+
return tail.length ? `${parts.join(" \xB7 ")} \xB7 ${tail.join(", ")}` : parts.join(" \xB7 ");
|
|
5142
|
+
}
|
|
4742
5143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4743
5144
|
0 && (module.exports = {
|
|
4744
5145
|
ASSISTANT_ACCOUNT_SLOT,
|
|
@@ -4790,14 +5191,25 @@ var RelayReprobeScheduler = class {
|
|
|
4790
5191
|
DELIVERY_OUTCOMES,
|
|
4791
5192
|
DELIVERY_VIAS,
|
|
4792
5193
|
DISPATCH_FAILURE_REASONS,
|
|
5194
|
+
DISPATCH_REFUSAL_DETAIL_MAX,
|
|
4793
5195
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
4794
5196
|
EVIDENCE_SOURCE_IDS,
|
|
5197
|
+
FINDING_CATEGORIES,
|
|
5198
|
+
FINDING_RESPONSES_MAX,
|
|
5199
|
+
FINDING_RESPONSE_KINDS,
|
|
5200
|
+
FINDING_SEVERITIES,
|
|
4795
5201
|
HOLD_REASONS,
|
|
4796
5202
|
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
4797
5203
|
LAUNCH_DEFAULT_ERROR_CODES,
|
|
4798
5204
|
LAUNCH_DEFAULT_ROLES,
|
|
4799
5205
|
LAUNCH_DEFAULT_SOURCES,
|
|
4800
5206
|
LEGACY_CARRY_OVER_MISSION_TITLE,
|
|
5207
|
+
LIGHT_BLOCK_REASONS,
|
|
5208
|
+
LIGHT_HOLD,
|
|
5209
|
+
LIGHT_LAND_MODES,
|
|
5210
|
+
LIGHT_REJECT,
|
|
5211
|
+
LIGHT_TESTS_RUN_MAX,
|
|
5212
|
+
LIGHT_WARNINGS,
|
|
4801
5213
|
LIVENESS_RESULTS,
|
|
4802
5214
|
MAX_MESH_RECORD_STRING,
|
|
4803
5215
|
MAX_OWNED_PATHS,
|
|
@@ -4855,6 +5267,7 @@ var RelayReprobeScheduler = class {
|
|
|
4855
5267
|
OWNER_ABANDON_CONFIRM_OPTIONS,
|
|
4856
5268
|
OWNER_ABANDON_CONFIRM_QUESTION,
|
|
4857
5269
|
P2P_SIGNAL_TYPES,
|
|
5270
|
+
PRIOR_FINDING_STATUSES,
|
|
4858
5271
|
PROVIDER_FAILURES,
|
|
4859
5272
|
QUOTA_BACKFILL_HORIZON_MS,
|
|
4860
5273
|
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
@@ -4871,6 +5284,15 @@ var RelayReprobeScheduler = class {
|
|
|
4871
5284
|
RELEASE_MEMBER_STATES,
|
|
4872
5285
|
REMOVED_MESH_TOOLS,
|
|
4873
5286
|
RETIRED_MESH_TOOLS,
|
|
5287
|
+
REVIEW_CHECKED_MAX,
|
|
5288
|
+
REVIEW_CLAIM_MAX_CHARS,
|
|
5289
|
+
REVIEW_EVIDENCE_MAX_CHARS,
|
|
5290
|
+
REVIEW_FINDINGS_MAX,
|
|
5291
|
+
REVIEW_FINDING_ID_MAX_CHARS,
|
|
5292
|
+
REVIEW_FIX_MAX_CHARS,
|
|
5293
|
+
REVIEW_NOTE_MAX_CHARS,
|
|
5294
|
+
REVIEW_TESTS_RUN_MAX,
|
|
5295
|
+
REVIEW_VERDICTS,
|
|
4874
5296
|
RelayReprobeScheduler,
|
|
4875
5297
|
SEND_POLICY_MODES,
|
|
4876
5298
|
SEND_REFUSAL_REASONS,
|
|
@@ -4884,6 +5306,17 @@ var RelayReprobeScheduler = class {
|
|
|
4884
5306
|
SESSION_STATUS_ALIASES,
|
|
4885
5307
|
SESSION_STATUS_CLASS,
|
|
4886
5308
|
SHARED_SESSION_TO_VIEWER_TYPES,
|
|
5309
|
+
STAGE_BLOCKED_REASONS,
|
|
5310
|
+
STAGE_DECIDE_ACTIONS,
|
|
5311
|
+
STAGE_DEFAULT_MAX_REVISIONS,
|
|
5312
|
+
STAGE_INDEPENDENCE_FALLBACK_MS,
|
|
5313
|
+
STAGE_INDEPENDENCE_MODES,
|
|
5314
|
+
STAGE_MAX_REVISIONS_LIMIT,
|
|
5315
|
+
STAGE_PARKED_PHASES,
|
|
5316
|
+
STAGE_PHASES,
|
|
5317
|
+
STAGE_PIPELINE_CEILING_DEFAULT_MS,
|
|
5318
|
+
STAGE_ROLES,
|
|
5319
|
+
STAGE_SELF_CHECK_MAX_BOUNCES,
|
|
4887
5320
|
STATUS_PROBE_ARG_KEY,
|
|
4888
5321
|
SUSPENSION_MODALS,
|
|
4889
5322
|
SUSPENSION_RESOLUTIONS,
|
|
@@ -4991,6 +5424,7 @@ var RelayReprobeScheduler = class {
|
|
|
4991
5424
|
decodeUserSessionToDashboard,
|
|
4992
5425
|
decodeViewerToSharedSession,
|
|
4993
5426
|
defaultProviderPriorityFromNodeFacts,
|
|
5427
|
+
defaultStagePlan,
|
|
4994
5428
|
deriveItemDedupeKey,
|
|
4995
5429
|
deriveProviderPriorityFromSlots,
|
|
4996
5430
|
deriveSlotsFromLegacy,
|
|
@@ -5005,6 +5439,7 @@ var RelayReprobeScheduler = class {
|
|
|
5005
5439
|
followedRemoteProjectKey,
|
|
5006
5440
|
followerOpPermitted,
|
|
5007
5441
|
formatQuotaAccount,
|
|
5442
|
+
formatStageVerdictLine,
|
|
5008
5443
|
hasGitStatusEvidence,
|
|
5009
5444
|
hasWorkerProtocolFooter,
|
|
5010
5445
|
interpolateString,
|
|
@@ -5012,6 +5447,7 @@ var RelayReprobeScheduler = class {
|
|
|
5012
5447
|
isAssistantFollowerAllowedOp,
|
|
5013
5448
|
isAssistantTool,
|
|
5014
5449
|
isBlockedStatus,
|
|
5450
|
+
isBlockingSeverity,
|
|
5015
5451
|
isBusyStatus,
|
|
5016
5452
|
isCarryOverMissionRecord,
|
|
5017
5453
|
isCarryOverMissionTitle,
|
|
@@ -5030,6 +5466,9 @@ var RelayReprobeScheduler = class {
|
|
|
5030
5466
|
isDeadStatus,
|
|
5031
5467
|
isDowngrade,
|
|
5032
5468
|
isEvidenceIdentifier,
|
|
5469
|
+
isFindingCategory,
|
|
5470
|
+
isFindingResponseKind,
|
|
5471
|
+
isFindingSeverity,
|
|
5033
5472
|
isFiniteNumber,
|
|
5034
5473
|
isIdleSessionState,
|
|
5035
5474
|
isInputEnvelopeWire,
|
|
@@ -5059,11 +5498,13 @@ var RelayReprobeScheduler = class {
|
|
|
5059
5498
|
isOutboundMessageOrigin,
|
|
5060
5499
|
isP2PSignalType,
|
|
5061
5500
|
isPhantomDaemonEntry,
|
|
5501
|
+
isPriorFindingStatus,
|
|
5062
5502
|
isProviderQuestionBinding,
|
|
5063
5503
|
isRawDaemonDoId,
|
|
5064
5504
|
isReadyStatus,
|
|
5065
5505
|
isRecord,
|
|
5066
5506
|
isReleaseStatus,
|
|
5507
|
+
isReviewVerdict,
|
|
5067
5508
|
isSendPolicy,
|
|
5068
5509
|
isSendPolicyMode,
|
|
5069
5510
|
isSendRefusal,
|
|
@@ -5072,6 +5513,8 @@ var RelayReprobeScheduler = class {
|
|
|
5072
5513
|
isSessionLaunchedBy,
|
|
5073
5514
|
isSessionStatus,
|
|
5074
5515
|
isSharedSessionToViewerType,
|
|
5516
|
+
isStageBlockedReason,
|
|
5517
|
+
isStageEligibleTask,
|
|
5075
5518
|
isSubmitOutcome,
|
|
5076
5519
|
isSummaryRef,
|
|
5077
5520
|
isTerminalSessionRecordStatus,
|
|
@@ -5143,9 +5586,14 @@ var RelayReprobeScheduler = class {
|
|
|
5143
5586
|
readStringArray,
|
|
5144
5587
|
readText,
|
|
5145
5588
|
renderCoordinatorWorkerSection,
|
|
5589
|
+
renderLightWorkspaceRules,
|
|
5146
5590
|
renderMissionBriefBlock,
|
|
5591
|
+
renderStageProtocolLines,
|
|
5147
5592
|
renderWorkerProtocolFooter,
|
|
5593
|
+
resolveStagePlan,
|
|
5148
5594
|
retiredMeshToolError,
|
|
5595
|
+
reviewIndependenceOf,
|
|
5596
|
+
sanitizeDispatchRefusalDetail,
|
|
5149
5597
|
sanitizeModelIdentifier,
|
|
5150
5598
|
sanitizeRefusalCode,
|
|
5151
5599
|
sanitizeRemoteRepoIdentity,
|
|
@@ -5161,6 +5609,9 @@ var RelayReprobeScheduler = class {
|
|
|
5161
5609
|
touchedFilesOutsideOwnership,
|
|
5162
5610
|
truncateMissionText,
|
|
5163
5611
|
unwrapPastedContent,
|
|
5612
|
+
validateFindingResponses,
|
|
5613
|
+
validateReviewReport,
|
|
5614
|
+
validateTestsRun,
|
|
5164
5615
|
withStatusProbeMarker
|
|
5165
5616
|
});
|
|
5166
5617
|
//# sourceMappingURL=index.js.map
|