crysk 0.7.0 → 0.8.0

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 (133) hide show
  1. package/README.md +27 -23
  2. package/dist/SKILL-1q3658n0.md +74 -0
  3. package/dist/SKILL-25j4q9b8.md +143 -0
  4. package/dist/SKILL-4747bhne.md +143 -0
  5. package/dist/SKILL-4jc3sv23.md +74 -0
  6. package/dist/SKILL-c0492rch.md +540 -0
  7. package/dist/SKILL-d1nzkhhr.md +74 -0
  8. package/dist/SKILL-f8p7kvx0.md +143 -0
  9. package/dist/SKILL-gxd45g38.md +553 -0
  10. package/dist/SKILL-rec41991.md +66 -0
  11. package/dist/SKILL-zze8zj5g.md +536 -0
  12. package/dist/cli.js +24658 -24654
  13. package/dist/index.js +492 -463
  14. package/dist/opencode-ci-qrcv7a99.md +106 -0
  15. package/dist/opencode-ci-rdpcc7xc.md +106 -0
  16. package/dist/opencode-ci-yt0k74t0.md +106 -0
  17. package/dist/workflow-andv2dvm.yml +158 -0
  18. package/package.json +1 -1
  19. package/prompts/default/PROVENANCE.md +1 -0
  20. package/skills/crysk/SKILL.md +6 -6
  21. package/skills/crysk-ci-setup/SKILL.md +32 -33
  22. package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
  23. package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
  24. package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
  25. package/skills/crysk-loop/SKILL.md +37 -54
  26. package/skills/crysk-pr/SKILL.md +1 -1
  27. package/src/asset-manifest.ts +0 -6
  28. package/src/assets.ts +1 -4
  29. package/src/brand.ts +20 -30
  30. package/src/ci/gates.ts +155 -201
  31. package/src/ci/outcome.ts +4 -31
  32. package/src/ci/platform-limits.ts +135 -0
  33. package/src/ci/platform-report.ts +212 -126
  34. package/src/ci/platform.ts +28 -26
  35. package/src/ci/reporter.ts +25 -26
  36. package/src/ci/review-admission.ts +1 -2
  37. package/src/ci/review-levels.ts +12 -53
  38. package/src/ci/setup.ts +96 -66
  39. package/src/ci/trace-bundle.ts +11 -27
  40. package/src/ci/trace-transcripts.ts +4 -6
  41. package/src/ci/trigger.ts +3 -5
  42. package/src/cli.ts +6 -5
  43. package/src/commands/ci-setup-questions.ts +2 -55
  44. package/src/commands/ci-setup.ts +2 -26
  45. package/src/commands/triage.ts +131 -38
  46. package/src/commands/usage.ts +0 -1
  47. package/src/compare/compare.ts +3 -3
  48. package/src/compare/floor-test.ts +30 -201
  49. package/src/config/config.ts +6 -30
  50. package/src/diversity/accounting.ts +0 -26
  51. package/src/diversity/benchmark.ts +1 -17
  52. package/src/diversity/identity.ts +0 -14
  53. package/src/diversity/pipeline-integration.ts +0 -29
  54. package/src/doctor.ts +3 -6
  55. package/src/execution/claude-session-trace.ts +7 -2
  56. package/src/execution/contracts.ts +15 -9
  57. package/src/execution/harness.ts +165 -187
  58. package/src/execution/spend-limiter.ts +39 -131
  59. package/src/execution/usage-facts.ts +397 -0
  60. package/src/execution/usage-normalized.ts +33 -86
  61. package/src/harness/materiality-judge.ts +0 -5
  62. package/src/harness/pipeline-plan.ts +0 -3
  63. package/src/harness/replay-rows.ts +0 -5
  64. package/src/harness/route-runner.ts +2 -2
  65. package/src/harness/single-step.ts +3 -9
  66. package/src/index.ts +1 -1
  67. package/src/mcp/preflight.ts +2 -2
  68. package/src/model/catalog.ts +1 -3
  69. package/src/model/free-discovery.ts +11 -78
  70. package/src/model/model-name.ts +14 -4
  71. package/src/model/profiles/claude.ts +1 -2
  72. package/src/model/profiles/openai.ts +1 -2
  73. package/src/model/profiles.ts +1 -2
  74. package/src/model/provider-capabilities.ts +16 -55
  75. package/src/model/routing.ts +39 -36
  76. package/src/pr/admission.ts +6 -6
  77. package/src/pr/answered-findings.ts +8 -4
  78. package/src/pr/ci-publish.ts +0 -2
  79. package/src/pr/discovery.ts +4 -25
  80. package/src/pr/plan.ts +40 -121
  81. package/src/pr/pr-status.ts +14 -2
  82. package/src/pr/preflight.ts +15 -12
  83. package/src/pr/publish-outcome.ts +1 -19
  84. package/src/pr/review-pr.ts +10 -47
  85. package/src/pr/target.ts +76 -82
  86. package/src/production-runtime.ts +52 -114
  87. package/src/progress.ts +0 -54
  88. package/src/rereview/prepare.ts +4 -1
  89. package/src/rereview/state.ts +1 -1
  90. package/src/review/boundary.ts +4 -8
  91. package/src/review/drafts.ts +3 -3
  92. package/src/review/findings-conformance.ts +1 -1
  93. package/src/review/findings.ts +0 -4
  94. package/src/review/pipeline.ts +57 -395
  95. package/src/review/preflight.ts +162 -201
  96. package/src/review/prompt-set.ts +0 -2
  97. package/src/review/report.ts +2 -162
  98. package/src/review/review.ts +16 -65
  99. package/src/review/route-preflight.ts +3 -35
  100. package/src/review/run.ts +37 -73
  101. package/src/review/size-gate.ts +3 -3
  102. package/src/review/spec.ts +6 -11
  103. package/src/review/step-runner.ts +4 -4
  104. package/src/runner-authority.ts +10 -9
  105. package/src/security/credential-broker.ts +5 -6
  106. package/src/server/preflight.ts +0 -1
  107. package/src/server/server.ts +17 -6
  108. package/src/store/activity.ts +1 -2
  109. package/src/store/backfill-preflight.ts +0 -3
  110. package/src/store/backfill.ts +0 -1
  111. package/src/store/metrics-preflight.ts +4 -14
  112. package/src/store/metrics.ts +5 -5
  113. package/src/store/preflight.ts +0 -13
  114. package/src/store/store.ts +11 -12
  115. package/src/transport-registry.ts +6 -30
  116. package/src/transports/claude-code-cli.ts +149 -215
  117. package/src/transports/opencode-client.ts +4 -24
  118. package/src/transports/opencode-sdk.ts +17 -112
  119. package/src/triage/plain-reply.ts +37 -0
  120. package/src/ui/activity.ts +1 -6
  121. package/src/ui/config-edit.ts +14 -67
  122. package/src/ui/config.ts +3 -8
  123. package/src/ui/plan.ts +11 -198
  124. package/src/ui/progress.ts +3 -49
  125. package/src/ui/result.ts +18 -77
  126. package/src/ui/review-menu.ts +3 -12
  127. package/src/ui/select.ts +9 -79
  128. package/src/updater.ts +1 -1
  129. package/src/usage.ts +1 -7
  130. package/prompts/default/deep-review-parity.md +0 -152
  131. package/prompts/scout.md +0 -140
  132. package/src/ci/platform-estimate.ts +0 -111
  133. package/src/review/scout.ts +0 -323
@@ -397,7 +397,6 @@ export interface CanonicalRunRow {
397
397
  tokens_in: number;
398
398
  tokens_out: number;
399
399
  tokens_total: number;
400
- cost_usd_est: number;
401
400
  blocking: number;
402
401
  advisory: number;
403
402
  root_causes_json: string | null;
@@ -474,7 +473,6 @@ export interface RunAgentRow {
474
473
  duration_ms: number;
475
474
  tokens_in: number;
476
475
  tokens_out: number;
477
- cost_usd_est: number;
478
476
  attempts: number;
479
477
  status: string;
480
478
  }
@@ -506,8 +504,6 @@ export interface DiversityAttemptRow {
506
504
  replicate: number;
507
505
  attempt: number;
508
506
  status: string;
509
- cash_cost_usd: number | null;
510
- notional_cost_usd: number | null;
511
507
  }
512
508
 
513
509
  export interface DiversityObservationRow {
@@ -581,7 +577,6 @@ export function projectCompleteRun(input: {
581
577
  tokens_in: input.doc.telemetry.tokens_in,
582
578
  tokens_out: input.doc.telemetry.tokens_out,
583
579
  tokens_total: input.doc.telemetry.tokens_total,
584
- cost_usd_est: input.doc.telemetry.cost_usd_est,
585
580
  blocking,
586
581
  advisory,
587
582
  root_causes_json: input.doc.debug.root_causes
@@ -676,7 +671,6 @@ export function projectCompleteRun(input: {
676
671
  duration_ms: usage.duration_ms,
677
672
  tokens_in: usage.tokens_in,
678
673
  tokens_out: usage.tokens_out,
679
- cost_usd_est: usage.cost_usd_est,
680
674
  attempts: usage.attempts,
681
675
  status: usage.status,
682
676
  }))
@@ -687,7 +681,6 @@ export function projectCompleteRun(input: {
687
681
  duration_ms: usage.duration_ms,
688
682
  tokens_in: 0,
689
683
  tokens_out: 0,
690
- cost_usd_est: 0,
691
684
  attempts: 1,
692
685
  status: "ok",
693
686
  }),
@@ -710,12 +703,6 @@ export function projectCompleteRun(input: {
710
703
  replicate: Number(row.replicate ?? 1),
711
704
  attempt: Number(row.attempt ?? 1),
712
705
  status: String(row.status ?? "completed"),
713
- cash_cost_usd:
714
- typeof row.cashCostUsd === "number" ? row.cashCostUsd : null,
715
- notional_cost_usd:
716
- typeof row.notionalCostUsd === "number"
717
- ? row.notionalCostUsd
718
- : null,
719
706
  });
720
707
  }
721
708
  }
@@ -59,14 +59,14 @@ export function openProductStore(dbPath: string): Database {
59
59
  }
60
60
 
61
61
  // `generated_at` on conflict: a live re-run into the same run dir (an explicit
62
- // --out) is a new run, so its timestamp moves with its cost and head. The
62
+ // --out) is a new run, so its timestamp moves with its head. The
63
63
  // historical backfill keeps the stored one only for the SAME run: it
64
64
  // re-derives the time from artifacts and must not rewrite when that run
65
65
  // happened. The live persist always stamps after the pipeline wrote its
66
66
  // artifacts (store/preflight.ts), so for the run a row describes the artifact
67
67
  // time is never later than the stored one. A different head, or a later
68
68
  // artifact time, is a later run in the same run dir whose live persist was
69
- // missed: it takes the artifact's own time along with its cost and head.
69
+ // missed: it takes the artifact's own time along with its head.
70
70
  function runUpsertSql(keepGeneratedAt: boolean): string {
71
71
  return RUN_UPSERT_SQL.replace(
72
72
  "generated_at = runs.generated_at",
@@ -78,6 +78,11 @@ function runUpsertSql(keepGeneratedAt: boolean): string {
78
78
  );
79
79
  }
80
80
 
81
+ // `runs.cost_usd_est` (and `run_agents.cost_usd_est` below) is a LEGACY column:
82
+ // NOT NULL since the first schema, kept so rows written before the engine
83
+ // dropped dollars stay readable and so no migration is needed. New rows carry
84
+ // the constant 0 because the column cannot be omitted; nothing reads it, and a
85
+ // re-ingest of an existing run leaves that run row's stored figure untouched.
81
86
  const RUN_UPSERT_SQL = `
82
87
  INSERT INTO runs (
83
88
  repo_id, run_dir, pr, checkout_path, head_sha, base_sha, diff_from_sha,
@@ -89,7 +94,7 @@ const RUN_UPSERT_SQL = `
89
94
  blocking, advisory, root_causes_json, greptile_found, diversity_plan_json
90
95
  ) VALUES (
91
96
  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
92
- ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
97
+ ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?
93
98
  )
94
99
  ON CONFLICT(repo_id, run_dir) DO UPDATE SET
95
100
  repo_id = excluded.repo_id,
@@ -122,7 +127,6 @@ const RUN_UPSERT_SQL = `
122
127
  tokens_in = excluded.tokens_in,
123
128
  tokens_out = excluded.tokens_out,
124
129
  tokens_total = excluded.tokens_total,
125
- cost_usd_est = excluded.cost_usd_est,
126
130
  blocking = excluded.blocking,
127
131
  advisory = excluded.advisory,
128
132
  root_causes_json = excluded.root_causes_json,
@@ -163,7 +167,6 @@ function runParams(row: CanonicalRunRow): SQLQueryBindings[] {
163
167
  row.tokens_in,
164
168
  row.tokens_out,
165
169
  row.tokens_total,
166
- row.cost_usd_est,
167
170
  row.blocking,
168
171
  row.advisory,
169
172
  row.root_causes_json,
@@ -312,7 +315,7 @@ export function saveRunTransaction(
312
315
  INSERT INTO run_agents (
313
316
  run_id, agent_key, tokens_total, duration_ms, tokens_in, tokens_out,
314
317
  cost_usd_est, attempts, status
315
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
318
+ ) VALUES (?, ?, ?, ?, ?, ?, 0, ?, ?)
316
319
  `);
317
320
  for (const a of projected.agents) {
318
321
  insertAgent.run(
@@ -322,7 +325,6 @@ export function saveRunTransaction(
322
325
  a.duration_ms,
323
326
  a.tokens_in,
324
327
  a.tokens_out,
325
- a.cost_usd_est,
326
328
  a.attempts,
327
329
  a.status,
328
330
  );
@@ -333,8 +335,8 @@ export function saveRunTransaction(
333
335
  const insertAttempt = db.query(`
334
336
  INSERT INTO diversity_attempts (
335
337
  run_id, attempt_id, leg_id, arm_id, specialty, replicate, attempt,
336
- status, cash_cost_usd, notional_cost_usd
337
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
338
+ status
339
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
338
340
  `);
339
341
  for (const attempt of projected.diversityAttempts) {
340
342
  insertAttempt.run(
@@ -346,8 +348,6 @@ export function saveRunTransaction(
346
348
  attempt.replicate,
347
349
  attempt.attempt,
348
350
  attempt.status,
349
- attempt.cash_cost_usd,
350
- attempt.notional_cost_usd,
351
351
  );
352
352
  }
353
353
  }
@@ -546,7 +546,6 @@ export function exportFindingsDocument(
546
546
  tokens_in: run.tokens_in,
547
547
  tokens_out: run.tokens_out,
548
548
  tokens_total: run.tokens_total,
549
- cost_usd_est: run.cost_usd_est,
550
549
  ...(agentRows.length > 0 ? { per_agent } : {}),
551
550
  };
552
551
 
@@ -396,7 +396,6 @@ export interface D1_11ReadinessEvidence {
396
396
  readonly sdkAvailable: boolean;
397
397
  readonly credentialAuthority: boolean;
398
398
  readonly workspaceBroker: boolean;
399
- readonly pricingReady: boolean;
400
399
  readonly issues?: readonly {
401
400
  code: string;
402
401
  message: string;
@@ -415,12 +414,7 @@ export function checkD1_11Readiness(
415
414
  if (!evidence) {
416
415
  return {
417
416
  ready: false,
418
- missing: [
419
- "sdkAvailable",
420
- "credentialAuthority",
421
- "workspaceBroker",
422
- "pricingReady",
423
- ],
417
+ missing: ["sdkAvailable", "credentialAuthority", "workspaceBroker"],
424
418
  };
425
419
  }
426
420
 
@@ -435,9 +429,6 @@ export function checkD1_11Readiness(
435
429
  if (!report.isolation.workspaceReadBroker) {
436
430
  missing.push("workspaceBroker");
437
431
  }
438
- if (!report.billing.pricingReady) {
439
- missing.push("pricingReady");
440
- }
441
432
  const hasDeferredSdkIssue = (report.issues ?? []).some(
442
433
  (i) => i.code === "real_sdk_adapter_deferred_to_d1_11",
443
434
  );
@@ -455,9 +446,6 @@ export function checkD1_11Readiness(
455
446
  if (!d1Evidence.workspaceBroker) {
456
447
  missing.push("workspaceBroker");
457
448
  }
458
- if (!d1Evidence.pricingReady) {
459
- missing.push("pricingReady");
460
- }
461
449
  }
462
450
 
463
451
  return {
@@ -665,9 +653,9 @@ export class DefaultTransportRegistry implements TransportRegistry {
665
653
  // Every caller of the public `createProductionRuntime` that supplies
666
654
  // its own registry bypasses the only wiring that sets it
667
655
  // (`productionFallbackRegistry`), so a metered route's records were
668
- // stamped "subscription" — which makes `settlementFromUsage`'s
669
- // metered-zero rule dead and lets an unaccountable provider $0 settle
670
- // as a truthful cost. `defaultOptions.credentialKind` is now the
656
+ // stamped "subscription" — which files a metered route's usage under
657
+ // the wrong credential class for the platform's pricing.
658
+ // `defaultOptions.credentialKind` is now the
671
659
  // FALLBACK for callers holding no binding; `get()`'s merge order
672
660
  // (`{ ...defaultOptions, ...options }`) lets the per-binding value win.
673
661
  //
@@ -679,8 +667,8 @@ export class DefaultTransportRegistry implements TransportRegistry {
679
667
  // the metered test (`credentialKindBillsMetered` is false for free, so
680
668
  // order is what keeps the stamp exact). Everything downstream passes the
681
669
  // mode through generically — the transport stamps it onto every usage
682
- // record (incl. `noSessionUsage`, which stays settleable at 0 with empty
683
- // tokens) and `settlementFromUsage`'s free-nonzero rule reads it.
670
+ // record (incl. `noSessionUsage`, which stays complete with empty
671
+ // tokens).
684
672
  const usageBillingMode: UsageBillingMode =
685
673
  merged.credentialKind === "provider_free"
686
674
  ? "free"
@@ -915,18 +903,6 @@ export class DefaultTransportRegistry implements TransportRegistry {
915
903
  },
916
904
  billing: {
917
905
  mode: "subscription",
918
- // #137 leaves this hardcoded: no model id is in scope. This is
919
- // the synthetic report for a backend whose transport could not
920
- // be CONSTRUCTED (OpenCodeProductionGatedError), so there is no
921
- // route, no client and no model behind it — and the report is
922
- // already blocking on `d1_11_production_gated`.
923
- //
924
- // 2026-09-02: NOT the case the OpenCode transport's `true`
925
- // covers. That claim is a TRANSPORT reporting the provider cost
926
- // it reads off each assistant message; here there is no
927
- // transport to make the claim, so `false` is the only honest
928
- // answer and stays one.
929
- pricingReady: false,
930
906
  },
931
907
  issues: [
932
908
  {