@ran-sh/dsh-crew 1.10.9 → 2.0.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-crew",
3
- "version": "1.10.9",
3
+ "version": "2.0.1",
4
4
  "description": "Dispatch subtasks to DeepSeek Harness (DSH) agents as native subagents with live progress",
5
5
  "author": {
6
6
  "name": "ZSeven-W"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ran-sh/dsh-crew",
3
- "version": "1.10.9",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "main": "./src/hub/entry.mjs",
6
6
  "bin": {
@@ -21,6 +21,30 @@ function verifiedHubJob(job) {
21
21
  && context.runtime_id.trim().length > 0;
22
22
  }
23
23
 
24
+ // The row that asks whether a run can be stopped, or stopped by its own clock,
25
+ // needs a run that was — a job that was cancelled or that timed out is the
26
+ // evidence, not a success. Nothing produced this row at all, so it could never
27
+ // become PASS no matter what the machine did.
28
+ const CANCELLATION_CODES = new Set(['CANCELLED', 'WORKFLOW_CANCELLED', 'ATTEMPT_TIMEOUT', 'GIT_TIMEOUT']);
29
+
30
+ function observedCancellation(job) {
31
+ if (job?.status === 'cancelled' || job?.phase === 'cancelled') return true;
32
+ const codes = [job?.failure?.reason_code, job?.failure?.source_code, job?.error_code, job?.error];
33
+ return codes.some((code) => typeof code === 'string' && CANCELLATION_CODES.has(code));
34
+ }
35
+
36
+ // The two DeepSeek rows are about that provider specifically, so they are not
37
+ // filtered by the currently selected route: a machine running its workers on
38
+ // another provider has no DeepSeek execution to show, and the row should say so
39
+ // rather than borrow someone else's.
40
+ const DEEPSEEK_PROVIDER = 'deepseek-official';
41
+
42
+ function deepseekSlotRan(jobs, slot) {
43
+ return jobs.some((job) => job?.provider === DEEPSEEK_PROVIDER
44
+ && verifiedHubJob(job)
45
+ && new RegExp(slot, 'i').test(String(job?.model ?? '')));
46
+ }
47
+
24
48
  function hasBlockingProviderRecovery(body, currentSelections) {
25
49
  if (!Object.hasOwn(body, 'recovery_transactions')) return false;
26
50
  if (!Array.isArray(body.recovery_transactions)) return true;
@@ -115,6 +139,11 @@ export function buildHubExecutionRows(hubJobs = [], { currentSelections = null }
115
139
  && matchesCurrentRoute(job, currentSelections, 'reviewer')
116
140
  && verifiedHubJob(job)
117
141
  && job?.review_verdict === 'approve');
142
+ const cancellationObserved = jobs.some((job) => matchesCurrentRoute(
143
+ job,
144
+ currentSelections,
145
+ job?.role === 'reviewer' ? 'reviewer' : 'worker',
146
+ ) && observedCancellation(job));
118
147
  return [
119
148
  workerPassed
120
149
  ? { id: 'model_execution', status: 'PASS', reason_code: 'REAL_EXECUTION_PASSED', evidence_source: 'hub-jobs' }
@@ -132,6 +161,15 @@ export function buildHubExecutionRows(hubJobs = [], { currentSelections = null }
132
161
  reviewerPassed
133
162
  ? { id: 'reviewer_pipeline', status: 'PASS', reason_code: 'REAL_REVIEW_PASSED', evidence_source: 'hub-jobs' }
134
163
  : { id: 'reviewer_pipeline', status: 'NOT_RUN', reason_code: 'NO_EXECUTION_EVIDENCE', evidence_source: 'none' },
164
+ cancellationObserved
165
+ ? { id: 'cancellation_timeout_escalation', status: 'PASS', reason_code: 'CANCELLATION_OBSERVED', evidence_source: 'hub-jobs' }
166
+ : { id: 'cancellation_timeout_escalation', status: 'NOT_RUN', reason_code: 'NO_EXECUTION_EVIDENCE', evidence_source: 'none' },
167
+ deepseekSlotRan(jobs, 'flash')
168
+ ? { id: 'deepseek_flash', status: 'PASS', reason_code: 'DEEPSEEK_FLASH_EXECUTED', evidence_source: 'hub-jobs' }
169
+ : { id: 'deepseek_flash', status: 'NOT_RUN', reason_code: 'NO_EXECUTION_EVIDENCE', evidence_source: 'none' },
170
+ deepseekSlotRan(jobs, 'pro')
171
+ ? { id: 'deepseek_pro', status: 'PASS', reason_code: 'DEEPSEEK_PRO_EXECUTED', evidence_source: 'hub-jobs' }
172
+ : { id: 'deepseek_pro', status: 'NOT_RUN', reason_code: 'NO_EXECUTION_EVIDENCE', evidence_source: 'none' },
135
173
  ];
136
174
  }
137
175
 
package/src/hub/index.mjs CHANGED
@@ -22,6 +22,7 @@ import { readHarnessModelCatalog } from '../model-catalog.mjs';
22
22
  import { appendDeliveryInstructions, prependJobIdentity, parseDeliveryReport, formatDeliveryMetadata } from '../delivery.mjs';
23
23
  import { captureWorkspaceBaseline, captureWorkspaceDiff, NOT_A_GIT_REPOSITORY } from '../workspace-audit.mjs';
24
24
  import { applyWorkspaceEvidence, buildOutcome, JOB_PHASES } from '../workflow.mjs';
25
+ import { normalizeReviewVerdict } from '../workflow-runtime.mjs';
25
26
  import { boundedMachineCodeFromError } from '../structured-error-code.mjs';
26
27
  import { createCanonicalJobEvent, projectWorkflowView } from '../job-contracts.mjs';
27
28
  import { getHubRuntimeIdentity } from '../runtime-identity.mjs';
@@ -1096,12 +1097,12 @@ export class WorkerRegistry { constructor(ctx) {
1096
1097
  job.delivery_missing = parsed.missing;
1097
1098
  job.delivery_metadata = formatDeliveryMetadata(parsed);
1098
1099
  if (job.role === 'reviewer') {
1099
- const verdictText = String(parsed.sections?.Verdict ?? '').trim().toLowerCase();
1100
- const verdict = /^(approve|approved|pass)\b/.test(verdictText)
1101
- ? 'approve'
1102
- : /request.*chang|chang.*request|reject|needs changes/i.test(verdictText)
1103
- ? 'request_changes'
1104
- : 'inconclusive';
1100
+ // The rule for reading a verdict lives in one place. This block used to
1101
+ // carry its own copy, and the two copies drifted: the shared one learned
1102
+ // to see through `**Approved**`, this one did not, so the Hub recorded
1103
+ // `inconclusive` for a reviewer whose report the workflow accepted —
1104
+ // which also kept the readiness matrix from seeing a real review.
1105
+ const verdict = normalizeReviewVerdict(parsed.sections?.Verdict ?? job.result ?? '');
1105
1106
  const lines = (value) => String(value ?? '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(0, 40);
1106
1107
  job.review = {
1107
1108
  verdict, status: job.status, delivery_complete: parsed.complete === true,
@@ -36,7 +36,7 @@ export {
36
36
  // included in the identity contract.
37
37
  const RUNTIME_ID = randomUUID();
38
38
 
39
- export const RUNTIME_VERSION = '1.10.9';
39
+ export const RUNTIME_VERSION = '2.0.1';
40
40
  export const HUB_PROTOCOL_VERSION = 1;
41
41
 
42
42
  export const HUB_CAPABILITIES = Object.freeze([