wicked-crew 0.18.10 → 0.18.12

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 (157) hide show
  1. package/README.md +13 -8
  2. package/dist/api/cluster-status.d.ts +84 -0
  3. package/dist/api/cluster-status.d.ts.map +1 -0
  4. package/dist/api/cluster-status.js +197 -0
  5. package/dist/api/cluster-status.js.map +1 -0
  6. package/dist/api/needs.d.ts.map +1 -1
  7. package/dist/api/needs.js +3 -1
  8. package/dist/api/needs.js.map +1 -1
  9. package/dist/api/requirements.d.ts +30 -0
  10. package/dist/api/requirements.d.ts.map +1 -1
  11. package/dist/api/requirements.js +48 -2
  12. package/dist/api/requirements.js.map +1 -1
  13. package/dist/api/roster-standing.d.ts +3 -0
  14. package/dist/api/roster-standing.d.ts.map +1 -1
  15. package/dist/api/roster-standing.js +5 -3
  16. package/dist/api/roster-standing.js.map +1 -1
  17. package/dist/api/routes.d.ts +2 -0
  18. package/dist/api/routes.d.ts.map +1 -1
  19. package/dist/api/routes.js +38 -14
  20. package/dist/api/routes.js.map +1 -1
  21. package/dist/api/runtime-state.d.ts +20 -6
  22. package/dist/api/runtime-state.d.ts.map +1 -1
  23. package/dist/api/runtime-state.js +35 -14
  24. package/dist/api/runtime-state.js.map +1 -1
  25. package/dist/api/seat-container-login.d.ts +12 -0
  26. package/dist/api/seat-container-login.d.ts.map +1 -1
  27. package/dist/api/seat-container-login.js +37 -0
  28. package/dist/api/seat-container-login.js.map +1 -1
  29. package/dist/api/server.d.ts.map +1 -1
  30. package/dist/api/server.js +60 -47
  31. package/dist/api/server.js.map +1 -1
  32. package/dist/api/stall-watchdog.d.ts +15 -0
  33. package/dist/api/stall-watchdog.d.ts.map +1 -1
  34. package/dist/api/stall-watchdog.js +21 -1
  35. package/dist/api/stall-watchdog.js.map +1 -1
  36. package/dist/api/system-snapshot.d.ts.map +1 -1
  37. package/dist/api/system-snapshot.js +1 -0
  38. package/dist/api/system-snapshot.js.map +1 -1
  39. package/dist/apps/check.d.ts +12 -0
  40. package/dist/apps/check.d.ts.map +1 -1
  41. package/dist/apps/check.js +34 -8
  42. package/dist/apps/check.js.map +1 -1
  43. package/dist/apps/exec/executor.d.ts +2 -1
  44. package/dist/apps/exec/executor.d.ts.map +1 -1
  45. package/dist/apps/exec/executor.js +3 -2
  46. package/dist/apps/exec/executor.js.map +1 -1
  47. package/dist/apps/exec/limits.d.ts +7 -1
  48. package/dist/apps/exec/limits.d.ts.map +1 -1
  49. package/dist/apps/exec/limits.js +35 -2
  50. package/dist/apps/exec/limits.js.map +1 -1
  51. package/dist/apps/exec/source-stage.d.ts.map +1 -1
  52. package/dist/apps/exec/source-stage.js +3 -1
  53. package/dist/apps/exec/source-stage.js.map +1 -1
  54. package/dist/apps/self-check.d.ts +25 -0
  55. package/dist/apps/self-check.d.ts.map +1 -0
  56. package/dist/apps/self-check.js +102 -0
  57. package/dist/apps/self-check.js.map +1 -0
  58. package/dist/apps/store.d.ts +7 -1
  59. package/dist/apps/store.d.ts.map +1 -1
  60. package/dist/apps/store.js +10 -0
  61. package/dist/apps/store.js.map +1 -1
  62. package/dist/apps/turns.d.ts +10 -4
  63. package/dist/apps/turns.d.ts.map +1 -1
  64. package/dist/apps/turns.js +44 -4
  65. package/dist/apps/turns.js.map +1 -1
  66. package/dist/apps-server/server/lib/bundle/server.mjs +73 -18
  67. package/dist/core/deliver-text.d.ts.map +1 -1
  68. package/dist/core/deliver-text.js +54 -15
  69. package/dist/core/deliver-text.js.map +1 -1
  70. package/dist/core/estate-mcp-client.d.ts +3 -1
  71. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  72. package/dist/core/estate-mcp-client.js +22 -14
  73. package/dist/core/estate-mcp-client.js.map +1 -1
  74. package/dist/decisions/rules-brief.d.ts +23 -14
  75. package/dist/decisions/rules-brief.d.ts.map +1 -1
  76. package/dist/decisions/rules-brief.js +63 -60
  77. package/dist/decisions/rules-brief.js.map +1 -1
  78. package/dist/knowledge/estate-write.d.ts +5 -0
  79. package/dist/knowledge/estate-write.d.ts.map +1 -0
  80. package/dist/knowledge/estate-write.js +23 -0
  81. package/dist/knowledge/estate-write.js.map +1 -0
  82. package/dist/knowledge/gate/gate.d.ts +1 -1
  83. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  84. package/dist/knowledge/gate/gate.js +11 -7
  85. package/dist/knowledge/gate/gate.js.map +1 -1
  86. package/dist/knowledge/package.d.ts +11 -0
  87. package/dist/knowledge/package.d.ts.map +1 -1
  88. package/dist/knowledge/package.js +63 -28
  89. package/dist/knowledge/package.js.map +1 -1
  90. package/dist/knowledge/projector.d.ts +4 -2
  91. package/dist/knowledge/projector.d.ts.map +1 -1
  92. package/dist/knowledge/projector.js +5 -4
  93. package/dist/knowledge/projector.js.map +1 -1
  94. package/dist/knowledge/trackers/projector.d.ts +2 -0
  95. package/dist/knowledge/trackers/projector.d.ts.map +1 -1
  96. package/dist/knowledge/trackers/projector.js +4 -3
  97. package/dist/knowledge/trackers/projector.js.map +1 -1
  98. package/dist/mcp/broker.d.ts +5 -0
  99. package/dist/mcp/broker.d.ts.map +1 -1
  100. package/dist/mcp/broker.js +61 -4
  101. package/dist/mcp/broker.js.map +1 -1
  102. package/dist/mcp/classify.d.ts +2 -0
  103. package/dist/mcp/classify.d.ts.map +1 -1
  104. package/dist/mcp/classify.js +2 -0
  105. package/dist/mcp/classify.js.map +1 -1
  106. package/dist/mcp/estate-relay.d.ts +23 -1
  107. package/dist/mcp/estate-relay.d.ts.map +1 -1
  108. package/dist/mcp/estate-relay.js +67 -6
  109. package/dist/mcp/estate-relay.js.map +1 -1
  110. package/dist/mcp/registry.d.ts.map +1 -1
  111. package/dist/mcp/registry.js +6 -1
  112. package/dist/mcp/registry.js.map +1 -1
  113. package/dist/projects/state-home-registry.d.ts.map +1 -1
  114. package/dist/projects/state-home-registry.js +2 -0
  115. package/dist/projects/state-home-registry.js.map +1 -1
  116. package/dist/skills/plugin-source.d.ts +6 -2
  117. package/dist/skills/plugin-source.d.ts.map +1 -1
  118. package/dist/skills/plugin-source.js +6 -2
  119. package/dist/skills/plugin-source.js.map +1 -1
  120. package/dist/sources/ask.d.ts +28 -1
  121. package/dist/sources/ask.d.ts.map +1 -1
  122. package/dist/sources/ask.js +169 -26
  123. package/dist/sources/ask.js.map +1 -1
  124. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  125. package/dist/sources/drivers/sqlite.js +8 -3
  126. package/dist/sources/drivers/sqlite.js.map +1 -1
  127. package/dist/sources/policy/rules.d.ts +3 -0
  128. package/dist/sources/policy/rules.d.ts.map +1 -0
  129. package/dist/sources/policy/rules.js +21 -0
  130. package/dist/sources/policy/rules.js.map +1 -0
  131. package/dist/sources/policy/sqlite.d.ts +2 -0
  132. package/dist/sources/policy/sqlite.d.ts.map +1 -1
  133. package/dist/sources/policy/sqlite.js +6 -0
  134. package/dist/sources/policy/sqlite.js.map +1 -1
  135. package/dist/studio/apps-standalone/fixture.js +3 -3
  136. package/dist/studio/apps-standalone/runtime.css +38 -5
  137. package/dist/studio/apps-standalone/runtime.js +1 -1
  138. package/dist/studio/assets/{KnowledgeGraph-XPxkIReb.js → KnowledgeGraph-CkYQjsWZ.js} +1 -1
  139. package/dist/studio/assets/index-CrcZTJjG.css +32 -0
  140. package/dist/studio/assets/{index-3kldzSmP.js → index-o7_MgV7T.js} +305 -304
  141. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  142. package/dist/studio/editors/wicked-apps/index.html +40 -7
  143. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  144. package/dist/studio/editors/wicked-deck/index.html +1 -1
  145. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  146. package/dist/studio/editors/wicked-doc/index.html +1 -1
  147. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  148. package/dist/studio/editors/wicked-insights/index.html +1 -1
  149. package/dist/studio/editors/wicked-page/editor.json +1 -1
  150. package/dist/studio/editors/wicked-page/index.html +1 -1
  151. package/dist/studio/editors/wicked-video/editor.json +1 -1
  152. package/dist/studio/editors/wicked-video/index.html +1 -1
  153. package/dist/studio/index.html +2 -2
  154. package/dist/studio/testid-inventory.json +83 -5
  155. package/endpoint-manifest.json +1 -1
  156. package/package.json +4 -4
  157. package/dist/studio/assets/index-CnfeJvlM.css +0 -32
@@ -66,7 +66,7 @@ import { chatSeatAdmission, homeless } from './seat-standing.js';
66
66
  import { seatGovernanceDiagnostics, seatGovernanceWarnings, } from './seat-governance.js';
67
67
  import { seatWorkDefaultNow } from './seat-work-default.js';
68
68
  import { ROSTER_REFRESH_WAIT_MS, rosterWithStandingFactory } from './roster-standing.js';
69
- import { SeatContainerStatus, gatewayDirOf, isContainerLoginCli, isContainerSeatFloor, isHostSeatFloor, loginDetail, registerSeatContainerLoginRoutes, seatLoginDepsFor, } from './seat-container-login.js';
69
+ import { SeatContainerStatus, isContainerLoginCli, isContainerSeatFloor, isHostSeatFloor, loginDetail, registerSeatContainerLoginRoutes, seatLoginDepsFor, } from './seat-container-login.js';
70
70
  import { ChatTurnIndex } from './chat-turns.js';
71
71
  import { CHAT_ID, chatJobTurnLines, chatMakeDigest, ChatScopeIndex, chatScopeDeps, chatScopeStatement, prepareChatScratch, removeChatScratch, namedKindRefusal, resolveChatScope, } from './chat-scope.js';
72
72
  import { buildRequirementsMaps, publishRequirementsMaps, REQUIREMENTS_MAP_DIR } from './chat-requirements.js';
@@ -165,7 +165,8 @@ import { AcpFoldCache, EngineVersionCache, FloorCacheCache, eventsDirOf, install
165
165
  import { GovernanceDiagnostics } from './governance-health.js';
166
166
  import { ATTACHMENT_LIMITS, ATTACHMENT_MAX_MESSAGE_BYTES, AttachmentError, ChatAttachmentStore, attachmentWire, attachmentsBlock, boundaryOf, parseMultipart, stageForSeat } from './chat-attachments.js';
167
167
  import { CHAT_HISTORY_MAX_LIMIT, ChatHistoryStore, decodeCursor } from './chat-history.js';
168
- import { PROBE_TIMEOUT_MS, SYSTEM_BUDGET_MS, SYSTEM_STATS_DAYS, SYSTEM_STATS_TTL_MS, WeekFoldCache, assembleSnapshot, buildNeeds, buildClis, buildGovernance, diskRow, estateReadonlyCall, infraRow, judgeGaps, livenessThresholds, loadRow, probeBroker, probeBus, probeEstate, probeGateway, probeInteractive, probeVault, readBridgeLockAsync, readWeek, resolveContainerRuntime, runLiveness, settleWithin, skillsRow, sortRuns, stateHomeRow, reposRow, unfinished, } from './system-snapshot.js';
168
+ import { PROBE_TIMEOUT_MS, SYSTEM_BUDGET_MS, SYSTEM_STATS_DAYS, SYSTEM_STATS_TTL_MS, WeekFoldCache, assembleSnapshot, buildNeeds, buildClis, buildGovernance, diskRow, estateReadonlyCall, infraRow, judgeGaps, livenessThresholds, loadRow, probeBroker, probeBus, probeEstate, probeInteractive, probeVault, readBridgeLockAsync, readWeek, runLiveness, settleWithin, skillsRow, sortRuns, stateHomeRow, reposRow, unfinished, } from './system-snapshot.js';
169
+ import { CLUSTER_TIMEOUT_MS, ClusterStatusReader, clusterDiagnostics, clusterRows } from './cluster-status.js';
169
170
  import { idleClis, parseSeatImageStatus, probeSeatImages, SeatImageRebuilder } from './seat-images.js';
170
171
  import { RunCostCache } from './needs.js';
171
172
  import { governanceStoreFix, legacyHomeOutboxPath } from '../core/governance-store.js';
@@ -1858,9 +1859,17 @@ runtime = {}) {
1858
1859
  // binding when the addon has one, and the dead-letter outbox folded on change. Built at boot so
1859
1860
  // the record baseline is the boot baseline.
1860
1861
  const governanceDiagnostics = new GovernanceDiagnostics(adapter.governanceStore ?? null, CoreAdapter.eventStoreCounter(), runtime.governanceLegacyOutboxPath === undefined ? legacyHomeOutboxPath() : runtime.governanceLegacyOutboxPath);
1862
+ // The daemon's Kubernetes cluster (k8s runner): one bounded, single-flight read of the engine's
1863
+ // `cluster status --json`, shared by `/diagnostics.cluster` and the `/system` cluster + gateway rows.
1864
+ const clusterSystemExec = runtime.systemExec ?? ((file, args, opts) => execCapped(file, args, { timeout: opts.timeout }));
1865
+ const clusterReader = new ClusterStatusReader(() => {
1866
+ const db = typeof adapter.dbPath === 'string' && adapter.dbPath !== '' && adapter.dbPath !== ':memory:' ? adapter.dbPath : null;
1867
+ return { exe: (process.env['WICKED_CORE_EXE'] ?? '').trim() || null, home: db !== null ? stateHomeOfDb(db) : null, exec: clusterSystemExec };
1868
+ });
1861
1869
  // The diagnostics body, shared by `GET /diagnostics` (the raw dump) and `GET /system` (the
1862
1870
  // Nerve Center snapshot, which carries every block of it on its rows — DES-SYSTEM-VIEW).
1863
- const diagnosticsNow = async () => {
1871
+ // `/system` reads the cluster itself (its own bound), so only `/diagnostics` waits on it here.
1872
+ const diagnosticsNow = async (opts = {}) => {
1864
1873
  // `dbPath` is a readonly field of the real adapter; a stub-driven route set may lack it,
1865
1874
  // and diagnostics over an unknown store honestly reports no stores and no ACP record.
1866
1875
  const dbPath = typeof adapter.dbPath === 'string' && adapter.dbPath !== '' ? adapter.dbPath : null;
@@ -1924,9 +1933,11 @@ runtime = {}) {
1924
1933
  repoWatch: runtime.repoWatch?.diagnostics() ?? null,
1925
1934
  // wicked-crew#1481: every project graph refresh since boot — running (with its budget) or idle, and its last failure.
1926
1935
  projectGraphRefresh: projectGraphRefreshDiagnostics(),
1936
+ // The daemon's Kubernetes cluster (k8s runner), on the container floor only.
1937
+ ...(opts.cluster === true && isContainerSeatFloor() ? { cluster: clusterDiagnostics(await clusterReader.read()) } : {}),
1927
1938
  };
1928
1939
  };
1929
- app.get(`${V}/diagnostics`, { config: { manifest: { responseType: 'DiagnosticsResponse', statusCodes: [200] } } }, async () => diagnosticsNow());
1940
+ app.get(`${V}/diagnostics`, { config: { manifest: { responseType: 'DiagnosticsResponse', statusCodes: [200] } } }, async () => diagnosticsNow({ cluster: true }));
1930
1941
  // Who am I talking to the daemon as? (task #88). In local mode this is
1931
1942
  // always the implicit full-trust local actor; in required mode it names the
1932
1943
  // token's actor — the cheap probe a skin uses to decide what to render.
@@ -3088,10 +3099,11 @@ runtime = {}) {
3088
3099
  // worker cannot read GitHub. The daemon reads each linked issue now and appends its text to the
3089
3100
  // problem, inside a marked block the deliver text takes back out. Workflow launches only: the
3090
3101
  // free-text planner turns sentences into units, so issue text there would become work units.
3091
- // E7 (operator ruling 2026-11-05) + DES-RULE-CHECK-001 S1: the project's in-force steering rules ride in the brief,
3092
- // in a marked block the deliver text takes back out (decisions/rules-brief.ts), so the review and QE seats can judge
3093
- // the work against them. Every rule is matched against the job and listed as applies / may apply / not applicable
3094
- // with the fact; none is cut. The steps are not known at launch (a run may be planned into catalog steps whose ids
3102
+ // E7 (operator ruling 2026-11-05) + DES-RULE-CHECK-001 S1: the project's in-force steering rules are indexed in the
3103
+ // brief, in a marked block the deliver text takes back out (decisions/rules-brief.ts), so the review and QE seats can
3104
+ // judge the work against them. Every rule is matched against the job and named as applies / may apply / not
3105
+ // applicable, by id, severity and a one-liner, with the command a seat pulls each whole statement with (the estate
3106
+ // relay answers it from this same in-force set; agents pull, operator 2026-11-11). The steps are not known at launch (a run may be planned into catalog steps whose ids
3095
3107
  // are the planner's), so step scopes decide nothing here; the def's kinds only order the list. Governed launches
3096
3108
  // only (a named workflow or an explicit plan); best-effort: an unreadable store launches without it.
3097
3109
  const briefRules = async (workflow) => {
@@ -10196,7 +10208,6 @@ runtime = {}) {
10196
10208
  return entries.filter((e) => e.actor?.kind === 'human').length;
10197
10209
  }, PROBE_TIMEOUT_MS);
10198
10210
  // The infra probes, all at once.
10199
- const gatewayDir = stateHome !== null ? gatewayDirOf(join(stateHome, 'gateway')) : null;
10200
10211
  const interactiveRoots = [...new Set([defaultInteractiveRoot(stateHome ?? undefined), ...interactiveBridges.keys()])];
10201
10212
  const watch = runtime.watchRegistry?.() ?? null;
10202
10213
  const watchHealth = watch !== null ? (() => { try {
@@ -10212,8 +10223,14 @@ runtime = {}) {
10212
10223
  clis: roster.map((r) => r.key).filter((k) => isContainerLoginCli(k)),
10213
10224
  status: (cli) => containerStatus.refreshFresh(cli),
10214
10225
  });
10226
+ // The cluster and the gateway (a Deployment in the daemon's namespace) from one read.
10227
+ const clusterStarted = Date.now();
10228
+ // Bounded by what is left of the snapshot's budget too (a slow start must not push it past 8 s):
10229
+ // the assembly after the infra probes keeps about 1.5 s.
10230
+ const clusterP = (containerFloor ? clusterReader.read(Math.min(CLUSTER_TIMEOUT_MS, left() - 1_500)) : Promise.resolve(null))
10231
+ .then((read) => clusterRows(read, containerFloor, clusterStarted));
10215
10232
  const infraP = Promise.all([
10216
- probeGateway({ containerFloor, gatewayDir, runtime: containerFloor ? resolveContainerRuntime() : null, exec: systemExec }),
10233
+ clusterP.then((rows) => rows.gateway),
10217
10234
  brokerP,
10218
10235
  probeInteractive({
10219
10236
  roots: interactiveRoots,
@@ -10242,6 +10259,7 @@ runtime = {}) {
10242
10259
  status: seatImageStatus,
10243
10260
  rebuild: () => seatImageRebuilder.current(),
10244
10261
  }),
10262
+ clusterP.then((rows) => rows.cluster),
10245
10263
  ]);
10246
10264
  const [views, settings, openGates, diag, ping, rules, gatesByYou, infraProbed, reposRead] = await Promise.all([
10247
10265
  viewsP, settingsP, gatesP, diagP, pingP, rulesP, gatesByYouP, infraP, reposP,
@@ -10280,9 +10298,14 @@ runtime = {}) {
10280
10298
  const relay = runtime.runEvidence?.(id);
10281
10299
  if (relay !== undefined)
10282
10300
  best = { at: relay.at, source: relay.source };
10283
- if (dbPath !== null) {
10301
+ // crew#1501: the run's log file is touched by heartbeats too, so its mtime proves nothing once
10302
+ // the watchdog has the run on its clock; it stands in only before the first sweep saw the run.
10303
+ const clock = runtime.runClockStart?.(id);
10304
+ if (best === null && clock !== undefined)
10305
+ best = { at: clock, source: 'relay' };
10306
+ if (best === null && dbPath !== null) {
10284
10307
  const st = await settleWithin(() => fsp.stat(join(eventsDirOf(dbPath), `${id}.ndjson`)), EVIDENCE_TIMEOUT_MS);
10285
- if (st.kind === 'ok' && (best === null || st.value.mtimeMs > best.at))
10308
+ if (st.kind === 'ok' && st.value.mtimeMs > 0)
10286
10309
  best = { at: Math.floor(st.value.mtimeMs), source: 'event_log' };
10287
10310
  }
10288
10311
  return best;
@@ -10372,6 +10395,7 @@ runtime = {}) {
10372
10395
  stateHomeRow(d === null ? null : (d.stateHome ?? null)),
10373
10396
  storesRow,
10374
10397
  seatFloorRow,
10398
+ infraProbed[8],
10375
10399
  infraProbed[7],
10376
10400
  reposRow(reposRead),
10377
10401
  infraProbed[6],
@@ -10400,7 +10424,7 @@ runtime = {}) {
10400
10424
  infra,
10401
10425
  clis,
10402
10426
  gaps,
10403
- infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
10427
+ infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
10404
10428
  costOf: (id) => runCosts.get(id),
10405
10429
  });
10406
10430
  if (typeof adapter.runEvents === 'function' && first.unresolved.length > 0) {
@@ -10417,7 +10441,7 @@ runtime = {}) {
10417
10441
  infra,
10418
10442
  clis,
10419
10443
  gaps,
10420
- infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
10444
+ infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
10421
10445
  costOf: (id) => runCosts.get(id),
10422
10446
  });
10423
10447
  const toReview = await toReviewP;