wicked-crew 0.18.18 → 0.18.19

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 (142) hide show
  1. package/dist/api/chat-jobs.d.ts +2 -0
  2. package/dist/api/chat-jobs.d.ts.map +1 -1
  3. package/dist/api/chat-jobs.js.map +1 -1
  4. package/dist/api/chat-proposals.d.ts +6 -7
  5. package/dist/api/chat-proposals.d.ts.map +1 -1
  6. package/dist/api/chat-proposals.js +69 -33
  7. package/dist/api/chat-proposals.js.map +1 -1
  8. package/dist/api/chat-scope.d.ts +9 -0
  9. package/dist/api/chat-scope.d.ts.map +1 -1
  10. package/dist/api/chat-scope.js +33 -4
  11. package/dist/api/chat-scope.js.map +1 -1
  12. package/dist/api/delivery-index.d.ts.map +1 -1
  13. package/dist/api/delivery-index.js +13 -0
  14. package/dist/api/delivery-index.js.map +1 -1
  15. package/dist/api/mcp.js +1 -1
  16. package/dist/api/mcp.js.map +1 -1
  17. package/dist/api/needs.js +1 -1
  18. package/dist/api/needs.js.map +1 -1
  19. package/dist/api/redeliver.d.ts +48 -0
  20. package/dist/api/redeliver.d.ts.map +1 -0
  21. package/dist/api/redeliver.js +178 -0
  22. package/dist/api/redeliver.js.map +1 -0
  23. package/dist/api/roster-standing.d.ts +3 -1
  24. package/dist/api/roster-standing.d.ts.map +1 -1
  25. package/dist/api/roster-standing.js +2 -2
  26. package/dist/api/roster-standing.js.map +1 -1
  27. package/dist/api/routes.d.ts +8 -0
  28. package/dist/api/routes.d.ts.map +1 -1
  29. package/dist/api/routes.js +71 -28
  30. package/dist/api/routes.js.map +1 -1
  31. package/dist/api/run-base-notice.d.ts +5 -0
  32. package/dist/api/run-base-notice.d.ts.map +1 -0
  33. package/dist/api/run-base-notice.js +15 -0
  34. package/dist/api/run-base-notice.js.map +1 -0
  35. package/dist/api/seat-probe.d.ts +6 -5
  36. package/dist/api/seat-probe.d.ts.map +1 -1
  37. package/dist/api/seat-probe.js +11 -7
  38. package/dist/api/seat-probe.js.map +1 -1
  39. package/dist/api/seat-standing.js +4 -4
  40. package/dist/api/seat-standing.js.map +1 -1
  41. package/dist/api/server.d.ts.map +1 -1
  42. package/dist/api/server.js +13 -5
  43. package/dist/api/server.js.map +1 -1
  44. package/dist/api/system-snapshot.d.ts.map +1 -1
  45. package/dist/api/system-snapshot.js +3 -2
  46. package/dist/api/system-snapshot.js.map +1 -1
  47. package/dist/apps-server/server/lib/bundle/server.mjs +105 -1
  48. package/dist/cli/index.d.ts +1 -0
  49. package/dist/cli/index.d.ts.map +1 -1
  50. package/dist/cli/index.js +2 -0
  51. package/dist/cli/index.js.map +1 -1
  52. package/dist/cli/service.d.ts +2 -0
  53. package/dist/cli/service.d.ts.map +1 -1
  54. package/dist/cli/service.js +14 -0
  55. package/dist/cli/service.js.map +1 -1
  56. package/dist/core/adapter.d.ts +6 -2
  57. package/dist/core/adapter.d.ts.map +1 -1
  58. package/dist/core/adapter.js +3 -3
  59. package/dist/core/adapter.js.map +1 -1
  60. package/dist/core/bridge-reaper.d.ts +4 -3
  61. package/dist/core/bridge-reaper.d.ts.map +1 -1
  62. package/dist/core/bridge-reaper.js +24 -8
  63. package/dist/core/bridge-reaper.js.map +1 -1
  64. package/dist/core/deliver-exclusions.d.ts +5 -2
  65. package/dist/core/deliver-exclusions.d.ts.map +1 -1
  66. package/dist/core/deliver-exclusions.js +5 -2
  67. package/dist/core/deliver-exclusions.js.map +1 -1
  68. package/dist/core/deliver.d.ts +4 -0
  69. package/dist/core/deliver.d.ts.map +1 -1
  70. package/dist/core/deliver.js +110 -32
  71. package/dist/core/deliver.js.map +1 -1
  72. package/dist/core/redeliver.d.ts +16 -0
  73. package/dist/core/redeliver.d.ts.map +1 -0
  74. package/dist/core/redeliver.js +64 -0
  75. package/dist/core/redeliver.js.map +1 -0
  76. package/dist/core/threadpool.d.ts +3 -0
  77. package/dist/core/threadpool.d.ts.map +1 -0
  78. package/dist/core/threadpool.js +14 -0
  79. package/dist/core/threadpool.js.map +1 -0
  80. package/dist/interactive/council-outcome.js +1 -1
  81. package/dist/interactive/council-outcome.js.map +1 -1
  82. package/dist/learnings/extract.d.ts +7 -12
  83. package/dist/learnings/extract.d.ts.map +1 -1
  84. package/dist/learnings/extract.js +9 -40
  85. package/dist/learnings/extract.js.map +1 -1
  86. package/dist/learnings/service.d.ts +12 -15
  87. package/dist/learnings/service.d.ts.map +1 -1
  88. package/dist/learnings/service.js +23 -43
  89. package/dist/learnings/service.js.map +1 -1
  90. package/dist/mcp/env.js +3 -3
  91. package/dist/mcp/env.js.map +1 -1
  92. package/dist/mcp/registry.js +3 -3
  93. package/dist/mcp/registry.js.map +1 -1
  94. package/dist/projects/auto-refresh.d.ts +21 -0
  95. package/dist/projects/auto-refresh.d.ts.map +1 -1
  96. package/dist/projects/auto-refresh.js +55 -1
  97. package/dist/projects/auto-refresh.js.map +1 -1
  98. package/dist/projects/graph.d.ts +39 -0
  99. package/dist/projects/graph.d.ts.map +1 -1
  100. package/dist/projects/graph.js +144 -13
  101. package/dist/projects/graph.js.map +1 -1
  102. package/dist/schedules/scheduler.d.ts +40 -1
  103. package/dist/schedules/scheduler.d.ts.map +1 -1
  104. package/dist/schedules/scheduler.js +175 -13
  105. package/dist/schedules/scheduler.js.map +1 -1
  106. package/dist/schedules/store.d.ts +20 -0
  107. package/dist/schedules/store.d.ts.map +1 -1
  108. package/dist/schedules/store.js +17 -0
  109. package/dist/schedules/store.js.map +1 -1
  110. package/dist/sources/routes.js +1 -1
  111. package/dist/sources/routes.js.map +1 -1
  112. package/dist/standing-orders/parse.js +1 -1
  113. package/dist/standing-orders/parse.js.map +1 -1
  114. package/dist/studio/apps-standalone/runtime.js +1 -1
  115. package/dist/studio/assets/{KnowledgeGraph-JfsMExo3.js → KnowledgeGraph-DWw0I8RJ.js} +1 -1
  116. package/dist/studio/assets/index-C4Xj-zxa.css +32 -0
  117. package/dist/studio/assets/{index-pq0QeOmo.js → index-CrNY3d06.js} +305 -305
  118. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  119. package/dist/studio/editors/wicked-apps/index.html +2 -2
  120. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  121. package/dist/studio/editors/wicked-deck/index.html +13 -13
  122. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  123. package/dist/studio/editors/wicked-doc/index.html +12 -12
  124. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  125. package/dist/studio/editors/wicked-insights/index.html +2 -2
  126. package/dist/studio/editors/wicked-page/editor.json +1 -1
  127. package/dist/studio/editors/wicked-page/index.html +12 -12
  128. package/dist/studio/editors/wicked-video/editor.json +1 -1
  129. package/dist/studio/editors/wicked-video/index.html +10 -10
  130. package/dist/studio/index.html +2 -2
  131. package/dist/studio/testid-inventory.json +33 -3
  132. package/dist/working-doc/event-lines.d.ts +4 -0
  133. package/dist/working-doc/event-lines.d.ts.map +1 -1
  134. package/dist/working-doc/event-lines.js +8 -2
  135. package/dist/working-doc/event-lines.js.map +1 -1
  136. package/dist/working-doc/notes-index.d.ts.map +1 -1
  137. package/dist/working-doc/notes-index.js +2 -2
  138. package/dist/working-doc/notes-index.js.map +1 -1
  139. package/endpoint-manifest.json +26 -1
  140. package/package.json +4 -4
  141. package/workflows/distill-learnings.json +2 -2
  142. package/dist/studio/assets/index-CkosDNYp.css +0 -32
@@ -1,3 +1,4 @@
1
+ import { registerRedeliverRoutes } from './redeliver.js';
1
2
  import { REVIEW_WORKFLOW } from '../insights/workflow.js';
2
3
  import { runUsageCost } from '../insights/run-facts.js';
3
4
  import { appsRuntimeDir, appsServerArtifact, containerEngineKnown } from '../apps/publish/artifacts.js';
@@ -1355,7 +1356,7 @@ runtime = {}) {
1355
1356
  engine: adapter,
1356
1357
  roster: async () => {
1357
1358
  await rosterWithStanding.ready?.();
1358
- return JSON.stringify(launchRosterNaming(rosterWithStanding(), undefined));
1359
+ return JSON.stringify(launchRosterNaming(rosterWithStanding({ launch: true }), undefined));
1359
1360
  },
1360
1361
  registry: runtime.mcp ?? null,
1361
1362
  grantOf: (slug, action) => appsWritePath?.getGrant(slug, action) ?? null,
@@ -1647,6 +1648,10 @@ runtime = {}) {
1647
1648
  // driving this function directly (tests) has no hooks, so downstream code
1648
1649
  // still gets the ONE actor shape via this accessor.
1649
1650
  const actorOf = (req) => req.actor ?? LOCAL_ACTOR;
1651
+ function clientDetail(req) {
1652
+ const userAgent = req.headers['user-agent'];
1653
+ return typeof userAgent === 'string' ? { client: { userAgent: userAgent.slice(0, 200) } } : {};
1654
+ }
1650
1655
  // crew#753: the blocking `skills.garden` finding (an installed garden older than the minimum), or
1651
1656
  // `null`. Read from the skills runtime's cached health; no seam ⇒ nothing to judge.
1652
1657
  const gardenBlocker = () => {
@@ -2781,7 +2786,7 @@ runtime = {}) {
2781
2786
  // (`core/engine-roster.ts`), so a signed-out seat is never convened, never a judge.
2782
2787
  // (operator ruling 2026-10-11) …minus the opt-in seats (opencode): a launch gets one only
2783
2788
  // when it names it.
2784
- clisJson: b.clisJson ?? JSON.stringify(launchRosterNaming(rosterWithStanding(), b.primary)),
2789
+ clisJson: b.clisJson ?? JSON.stringify(launchRosterNaming(rosterWithStanding({ launch: true }), b.primary)),
2785
2790
  };
2786
2791
  // A capture launch (api/capture.ts) reads its materials from a per-run inbox outside every
2787
2792
  // sandbox: the capture route registered it under the run id it minted.
@@ -3584,7 +3589,7 @@ runtime = {}) {
3584
3589
  // by name, never launched on a stale snapshot. A seat added meanwhile still doesn't join (narrowed to the card).
3585
3590
  await rosterWithStanding.ready?.();
3586
3591
  // crew#1590: every seat on the card is named, so an opt-in seat the person picked is on the roster too.
3587
- const { clisJson } = jobLaunchRoster(launchRosterNaming(rosterWithStanding(), p.seats?.lead ?? undefined, p.seats?.keys ?? []), p);
3592
+ const { clisJson } = jobLaunchRoster(launchRosterNaming(rosterWithStanding({ launch: true }), p.seats?.lead ?? undefined, p.seats?.keys ?? []), p);
3588
3593
  const common = jobLaunchCommon(p, { runId: d.identity.runId, chatId: d.chatId }, {
3589
3594
  ...(clisJson !== undefined ? { clisJson } : {}),
3590
3595
  selfSeated,
@@ -3997,6 +4002,11 @@ runtime = {}) {
3997
4002
  repoDeliverChain.delete(repoRef);
3998
4003
  }
3999
4004
  };
4005
+ registerRedeliverRoutes(app, {
4006
+ adapter, index: deliveryIndex, audit, freeze: deliveryFreeze, actorOf, repoRootOf, withRepoDeliverLock,
4007
+ ghExec: runtime.redeliverGhExec, exec: runtime.redeliverExec, checkRunTree: runtime.checkRunTree,
4008
+ identityFor: async (ref) => deliverIdentityFor(await adapter.getSettings(), ref).login || undefined,
4009
+ });
4000
4010
  /** The last words of a failed deliver script — enough to name the refusal, bounded so a full
4001
4011
  * git transcript never becomes an error body. */
4002
4012
  const deliverErrorTail = (output) => {
@@ -4653,10 +4663,10 @@ runtime = {}) {
4653
4663
  'the run cannot bind; scope the ask to one repository, sign a seat in, or open it unscoped'
4654
4664
  : refused.some((r) => r.source === 'engine')
4655
4665
  ? 'no seat picked for this ask can take a turn: every one is signed out, disabled, or benched by the ' +
4656
- 'engine in a recent run (out of quota, say); sign another seat in from the Agents page, turn one ' +
4666
+ 'engine in a recent run (out of quota, say); sign another seat in from the Helpers page, turn one ' +
4657
4667
  'back on, or wait for the bench to lift'
4658
4668
  : 'no seat in the roster can take a turn (every seat is signed out or disabled); sign a seat ' +
4659
- 'in from the Agents page, or name seats with `clis`') + ' — see refused',
4669
+ 'in from the Helpers page, or name seats with `clis`') + ' — see refused',
4660
4670
  refused,
4661
4671
  });
4662
4672
  }
@@ -6664,6 +6674,7 @@ runtime = {}) {
6664
6674
  runId: id,
6665
6675
  detail: {
6666
6676
  approve: parsed.data.approve,
6677
+ choice: parsed.data.action ?? (parsed.data.approve ? 'approve' : 'reject'),
6667
6678
  ...(parsed.data.amend !== undefined ? { amend: parsed.data.amend } : {}),
6668
6679
  ...(parsed.data.action !== undefined ? { action: parsed.data.action } : {}),
6669
6680
  ...(parsed.data.amendScope !== undefined ? { amendScope: parsed.data.amendScope } : {}),
@@ -6754,7 +6765,7 @@ runtime = {}) {
6754
6765
  },
6755
6766
  }, async (req, reply) => {
6756
6767
  const { id } = req.params;
6757
- const out = await decideGate(id, req.body, actorOf(req));
6768
+ const out = await decideGate(id, req.body, actorOf(req), clientDetail(req));
6758
6769
  return reply.code(out.code).send(out.body);
6759
6770
  });
6760
6771
  /**
@@ -6950,7 +6961,7 @@ runtime = {}) {
6950
6961
  // "who approved" trail has no side door (task #88).
6951
6962
  audit.record(gated ? 'gate.decided' : 'run.resumed', actorOf(req), {
6952
6963
  runId: id,
6953
- detail: gated ? { approve: true, via: 'resume', status } : { status },
6964
+ detail: gated ? { approve: true, via: 'resume', ...clientDetail(req), status } : { status },
6954
6965
  });
6955
6966
  const landing = steeringPropose
6956
6967
  ? await landSteeringProposal({ adapter, audit, actor: actorOf(req) }, run, gatePrompt)
@@ -7398,7 +7409,7 @@ runtime = {}) {
7398
7409
  noteRode = note !== undefined;
7399
7410
  audit.record('gate.decided', actorOf(req), {
7400
7411
  runId: id,
7401
- detail: { approve: true, via: 'reassign', status },
7412
+ detail: { approve: true, via: 'reassign', ...clientDetail(req), status },
7402
7413
  });
7403
7414
  };
7404
7415
  const reassigned = (approved) => {
@@ -7473,12 +7484,11 @@ runtime = {}) {
7473
7484
  // await sees a change the adapter learned of during it (a frame, or a write it made); any other
7474
7485
  // change is at most the snapshot's age bound old.
7475
7486
  const runOf = () => adapter.runView(id);
7476
- // wicked-core#850: the gate answer carries the gated unit's receipt — what assured the work it asks about.
7477
- const unitAt = async (ord) => (await runOf())?.units?.find((u) => u.ord === ord);
7478
7487
  // (rejudge, api-types 0.134.0) A gate whose unit no judge could rule on says whether its judge
7479
7488
  // can be re-run now, and from which seats — the engine's own selection, read each time (a seat
7480
7489
  // signed in since the pause counts). Absent on every other gate and on an addon without the read.
7481
- const rejudgeAt = async (ord, gated) => {
7490
+ const rejudgeAt = async (ord, run) => {
7491
+ const gated = run?.units?.find((u) => u.ord === ord);
7482
7492
  const denial = gated?.denial;
7483
7493
  if (gated?.status !== 'rejected' || denial?.source !== 'judge_unavailable')
7484
7494
  return {};
@@ -7499,10 +7509,10 @@ runtime = {}) {
7499
7509
  // PLACE: `{approve: true, action: 'skip_qe', amend: <reason>, ord}` on this gate, labelled on
7500
7510
  // the run, every later gate and the delivery — never a relaunch. Read each time (a PASS
7501
7511
  // recorded since the pause withdraws it). Absent on every other gate.
7502
- const skipQeAt = async (gated) => {
7512
+ const skipQeAt = async (ord, run) => {
7513
+ const gated = run?.units?.find((u) => u.ord === ord);
7503
7514
  if (gated === undefined || !isDeliverUnit(gated))
7504
7515
  return {};
7505
- const run = await runOf();
7506
7516
  if (run === undefined)
7507
7517
  return {};
7508
7518
  const decision = qeDecisionOf(run);
@@ -7523,26 +7533,56 @@ runtime = {}) {
7523
7533
  };
7524
7534
  // (crew#1512, studio#1170) EVERY ANSWER THIS GATE TAKES NOW: the engine's own list (each candidate run
7525
7535
  // through its decision path's pre-checks), less what crew refuses itself (`crewGateActions`). Read each
7526
- // time; absent on an addon without the read, or when the engine's open gate is not this one.
7527
- const actionsAt = async (ord, gated) => {
7536
+ // time; absent only on an addon without the read. A failed or moved read gets one retry, then
7537
+ // a retryable 503 (crew#1579), so a skin cannot mistake an unavailable list for no capability.
7538
+ // crew#1634: a mismatch that cannot heal is not retryable: with no open gate row the ord comes from the
7539
+ // cache or the log while the engine names its cursor's (or 0), and an unknown run has no engine list at
7540
+ // all. Those answer the gate without `actions` (the old fallback); a thrown read stays a 503.
7541
+ const actionsAt = async (ord, run) => {
7528
7542
  if (typeof adapter.gateActions !== 'function')
7529
7543
  return {};
7530
- try {
7531
- const listed = await adapter.gateActions(id);
7532
- if (listed === null || listed.ord !== ord)
7544
+ let threw = false;
7545
+ for (let attempt = 0; attempt < 2; attempt++) {
7546
+ let listed;
7547
+ try {
7548
+ listed = await adapter.gateActions(id);
7549
+ }
7550
+ catch {
7551
+ threw = true;
7552
+ continue;
7553
+ }
7554
+ if (listed === null)
7533
7555
  return {};
7534
- const run = await runOf();
7556
+ if (listed.ord !== ord)
7557
+ continue;
7535
7558
  if (run === undefined)
7536
7559
  return {};
7560
+ const gated = run.units?.find((u) => u.ord === ord);
7537
7561
  return {
7538
7562
  actions: await crewGateActions(run, gated, listed.gateKind, listed.actions),
7539
7563
  ...(listed.planRev !== undefined ? { planRev: listed.planRev } : {}),
7540
7564
  };
7541
7565
  }
7542
- catch {
7543
- // A failed read lists nothing; the skin falls back to the gate's own offers.
7544
- return {};
7545
- }
7566
+ // Persistent only if it still holds NOW: a gate that opened or advanced during the read shows as an open row on
7567
+ // this durable re-read, and that is a race, so 503 whatever the run snapshot says (it may predate the run).
7568
+ if (threw)
7569
+ return null;
7570
+ return (await recordedOpenGate(id))?.state === 'open' ? null : {};
7571
+ };
7572
+ const actionsUnavailable = {
7573
+ error: 'Gate actions unavailable: the engine\'s answers for this gate could not be read consistently — retry.',
7574
+ code: 'gate_actions_unavailable',
7575
+ };
7576
+ const unavailable503 = () => reply.header('Retry-After', '1').code(503).send(actionsUnavailable);
7577
+ // crew#1629: start the engine's action read immediately, alongside the other offers. Every
7578
+ // offer and the receipt use the run already in hand; the record/cache overlap reads stay separate.
7579
+ const offersAt = async (ord, run) => {
7580
+ const gated = run?.units?.find((u) => u.ord === ord);
7581
+ const actions = actionsAt(ord, run);
7582
+ const [rejudge, skipQe, listed] = await Promise.all([rejudgeAt(ord, run), skipQeAt(ord, run), actions]);
7583
+ if (listed === null)
7584
+ return null;
7585
+ return { assurance: receiptOf(gated), ...rejudge, ...skipQe, ...listed };
7546
7586
  };
7547
7587
  // The record judges the cache (crew#1083 round 7): rows that disagree on the ord are 409
7548
7588
  // `gate_unknown` whether or not something is cached, and a cached entry is served — for its
@@ -7565,9 +7605,10 @@ runtime = {}) {
7565
7605
  || (recorded.state === 'open' && cached.ord === recorded.ord)
7566
7606
  || (recorded.state === 'none' && (await runOf())?.session.status === 'awaiting_human');
7567
7607
  if (servable) {
7568
- // One read of the gated unit serves both its receipt and its re-judge offer.
7569
- const gated = await unitAt(cached.ord);
7570
- return { runId: id, ...cached, assurance: receiptOf(gated), ...(await rejudgeAt(cached.ord, gated)), ...(await skipQeAt(gated)), ...(await actionsAt(cached.ord, gated)) };
7608
+ const offers = await offersAt(cached.ord, await runOf());
7609
+ if (offers === null)
7610
+ return unavailable503();
7611
+ return { runId: id, ...cached, ...offers };
7571
7612
  }
7572
7613
  gateCache.forget(id);
7573
7614
  }
@@ -7643,8 +7684,10 @@ runtime = {}) {
7643
7684
  // genuinely lost), as does a gate whose `awaitingHuman` predates the log's retention.
7644
7685
  return reply.code(404).send({ error: 'No open gate for this run' });
7645
7686
  }
7646
- const gatedUnit = run.units?.find((u) => u.ord === open.ord);
7647
- return { runId: id, ...open, assurance: receiptOf(gatedUnit), ...(await rejudgeAt(open.ord, gatedUnit)), ...(await skipQeAt(gatedUnit)), ...(await actionsAt(open.ord, gatedUnit)) };
7687
+ const offers = await offersAt(open.ord, run);
7688
+ if (offers === null)
7689
+ return unavailable503();
7690
+ return { runId: id, ...open, ...offers };
7648
7691
  });
7649
7692
  // ── Elicitation (DES-002) ────────────────────────────────────────────────────
7650
7693
  //