wicked-crew 0.18.21 → 0.18.22
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/api/audit.d.ts +28 -1
- package/dist/api/audit.d.ts.map +1 -1
- package/dist/api/audit.js +90 -9
- package/dist/api/audit.js.map +1 -1
- package/dist/api/auth.d.ts +7 -0
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +53 -10
- package/dist/api/auth.js.map +1 -1
- package/dist/api/capture.d.ts +11 -2
- package/dist/api/capture.d.ts.map +1 -1
- package/dist/api/capture.js +7 -2
- package/dist/api/capture.js.map +1 -1
- package/dist/api/chat-context.d.ts +6 -1
- package/dist/api/chat-context.d.ts.map +1 -1
- package/dist/api/chat-context.js +45 -11
- package/dist/api/chat-context.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +24 -7
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +98 -18
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-scope.d.ts +6 -2
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +13 -7
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/cluster-status.d.ts +17 -0
- package/dist/api/cluster-status.d.ts.map +1 -1
- package/dist/api/cluster-status.js +70 -3
- package/dist/api/cluster-status.js.map +1 -1
- package/dist/api/compose-facts.d.ts +35 -0
- package/dist/api/compose-facts.d.ts.map +1 -0
- package/dist/api/compose-facts.js +46 -0
- package/dist/api/compose-facts.js.map +1 -0
- package/dist/api/cut-read.d.ts +62 -0
- package/dist/api/cut-read.d.ts.map +1 -0
- package/dist/api/cut-read.js +101 -0
- package/dist/api/cut-read.js.map +1 -0
- package/dist/api/desk-snoozes.d.ts +54 -0
- package/dist/api/desk-snoozes.d.ts.map +1 -0
- package/dist/api/desk-snoozes.js +174 -0
- package/dist/api/desk-snoozes.js.map +1 -0
- package/dist/api/diagnostics.d.ts +4 -0
- package/dist/api/diagnostics.d.ts.map +1 -1
- package/dist/api/diagnostics.js +15 -7
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/api/disk-stores.d.ts +66 -0
- package/dist/api/disk-stores.d.ts.map +1 -0
- package/dist/api/disk-stores.js +206 -0
- package/dist/api/disk-stores.js.map +1 -0
- package/dist/api/gate-cache.d.ts +8 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +8 -1
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/mcp.d.ts +16 -0
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +118 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts +3 -0
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +7 -3
- package/dist/api/needs.js.map +1 -1
- package/dist/api/post-hoc-deliver.d.ts +7 -0
- package/dist/api/post-hoc-deliver.d.ts.map +1 -1
- package/dist/api/post-hoc-deliver.js +16 -5
- package/dist/api/post-hoc-deliver.js.map +1 -1
- package/dist/api/product-publish.d.ts +242 -0
- package/dist/api/product-publish.d.ts.map +1 -0
- package/dist/api/product-publish.js +902 -0
- package/dist/api/product-publish.js.map +1 -0
- package/dist/api/product.d.ts +5 -6
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +4 -4
- package/dist/api/product.js.map +1 -1
- package/dist/api/proposal-cut.d.ts +95 -0
- package/dist/api/proposal-cut.d.ts.map +1 -0
- package/dist/api/proposal-cut.js +231 -0
- package/dist/api/proposal-cut.js.map +1 -0
- package/dist/api/requirements.d.ts +3 -3
- package/dist/api/requirements.js +3 -3
- package/dist/api/routes.d.ts +15 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +410 -88
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-liveness.d.ts.map +1 -1
- package/dist/api/run-liveness.js +3 -1
- package/dist/api/run-liveness.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +10 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +29 -9
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/seat-container-login.d.ts +11 -17
- package/dist/api/seat-container-login.d.ts.map +1 -1
- package/dist/api/seat-container-login.js +36 -69
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +2 -1
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +17 -6
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/ui-text.d.ts.map +1 -1
- package/dist/api/ui-text.js +3 -1
- package/dist/api/ui-text.js.map +1 -1
- package/dist/apps/store.d.ts +11 -0
- package/dist/apps/store.d.ts.map +1 -1
- package/dist/apps/store.js +47 -0
- package/dist/apps/store.js.map +1 -1
- package/dist/apps-server/server/lib/bundle/server.mjs +12 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/start-stand-ins.d.ts +13 -0
- package/dist/cli/start-stand-ins.d.ts.map +1 -0
- package/dist/cli/start-stand-ins.js +30 -0
- package/dist/cli/start-stand-ins.js.map +1 -0
- package/dist/core/adapter.d.ts +43 -6
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +169 -30
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/ado-env.d.ts +17 -0
- package/dist/core/ado-env.d.ts.map +1 -0
- package/dist/core/ado-env.js +34 -0
- package/dist/core/ado-env.js.map +1 -0
- package/dist/core/deliver-text.d.ts +17 -0
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +76 -1
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts +6 -0
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +12 -4
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/exec.d.ts +1 -10
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -17
- package/dist/core/exec.js.map +1 -1
- package/dist/core/governance-store.d.ts +3 -1
- package/dist/core/governance-store.d.ts.map +1 -1
- package/dist/core/governance-store.js +7 -2
- package/dist/core/governance-store.js.map +1 -1
- package/dist/core/repo-clone.d.ts.map +1 -1
- package/dist/core/repo-clone.js +2 -1
- package/dist/core/repo-clone.js.map +1 -1
- package/dist/core/run-log-facts.d.ts +56 -0
- package/dist/core/run-log-facts.d.ts.map +1 -0
- package/dist/core/run-log-facts.js +230 -0
- package/dist/core/run-log-facts.js.map +1 -0
- package/dist/core/shutdown.d.ts +27 -0
- package/dist/core/shutdown.d.ts.map +1 -1
- package/dist/core/shutdown.js +72 -0
- package/dist/core/shutdown.js.map +1 -1
- package/dist/core/stand-in.d.ts +40 -0
- package/dist/core/stand-in.d.ts.map +1 -0
- package/dist/core/stand-in.js +118 -0
- package/dist/core/stand-in.js.map +1 -0
- package/dist/core/types.d.ts +17 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/editors/pack-extras.d.ts +162 -0
- package/dist/editors/pack-extras.d.ts.map +1 -0
- package/dist/editors/pack-extras.js +596 -0
- package/dist/editors/pack-extras.js.map +1 -0
- package/dist/editors/pack-install.d.ts +15 -7
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +140 -19
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +42 -3
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +114 -11
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +10 -5
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +45 -11
- package/dist/editors/routes.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +5 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +4 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/landing-guard.d.ts.map +1 -1
- package/dist/interactive/landing-guard.js +79 -5
- package/dist/interactive/landing-guard.js.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.js +3 -2
- package/dist/knowledge/adapters/toolbox/memory.js.map +1 -1
- package/dist/knowledge/trackers/set.d.ts +28 -0
- package/dist/knowledge/trackers/set.d.ts.map +1 -1
- package/dist/knowledge/trackers/set.js +26 -0
- package/dist/knowledge/trackers/set.js.map +1 -1
- package/dist/mcp/policies.d.ts +35 -0
- package/dist/mcp/policies.d.ts.map +1 -1
- package/dist/mcp/policies.js +138 -1
- package/dist/mcp/policies.js.map +1 -1
- package/dist/mcp/registry-store.d.ts +10 -0
- package/dist/mcp/registry-store.d.ts.map +1 -1
- package/dist/mcp/registry-store.js.map +1 -1
- package/dist/mcp/registry.d.ts +40 -3
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +211 -16
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/trigger-names.d.ts +32 -0
- package/dist/mcp/trigger-names.d.ts.map +1 -0
- package/dist/mcp/trigger-names.js +529 -0
- package/dist/mcp/trigger-names.js.map +1 -0
- package/dist/skills/store.d.ts +11 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +37 -3
- package/dist/skills/store.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/assets/{KnowledgeGraph-yP4WsnST.js → KnowledgeGraph-D6RRLDnV.js} +1 -1
- package/dist/studio/assets/{index-DW53FKuT.js → index-BLo9vFQI.js} +324 -310
- package/dist/studio/assets/index-xW21Gkam.css +32 -0
- package/dist/studio/editors/wicked-apps/editor.json +1 -1
- package/dist/studio/editors/wicked-apps/index.html +1 -1
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +1 -1
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +1 -1
- package/dist/studio/editors/wicked-insights/editor.json +1 -1
- package/dist/studio/editors/wicked-insights/index.html +1 -1
- package/dist/studio/editors/wicked-page/editor.json +1 -1
- package/dist/studio/editors/wicked-page/index.html +1 -1
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +539 -5
- package/dist/team/routes.d.ts +4 -1
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +1 -1
- package/dist/team/routes.js.map +1 -1
- package/dist/voice/tts.d.ts +6 -0
- package/dist/voice/tts.d.ts.map +1 -1
- package/dist/voice/tts.js +16 -1
- package/dist/voice/tts.js.map +1 -1
- package/endpoint-manifest.json +85 -6
- package/package.json +4 -4
- package/voice-locks/darwin-arm64-cp310.txt +12 -0
- package/voice-locks/darwin-arm64-cp311.txt +8 -0
- package/voice-locks/darwin-arm64-cp312.txt +8 -0
- package/voice-locks/darwin-arm64-cp313.txt +8 -0
- package/voice-locks/darwin-arm64-cp314.txt +8 -0
- package/voice-locks/darwin-arm64-cp39.txt +12 -0
- package/voice-locks/darwin-x64-cp310.txt +12 -0
- package/voice-locks/darwin-x64-cp311.txt +12 -0
- package/voice-locks/darwin-x64-cp312.txt +12 -0
- package/voice-locks/darwin-x64-cp313.txt +12 -0
- package/voice-locks/darwin-x64-cp39.txt +12 -0
- package/voice-locks/linux-arm64-cp310.txt +12 -0
- package/voice-locks/linux-arm64-cp311.txt +8 -0
- package/voice-locks/linux-arm64-cp312.txt +8 -0
- package/voice-locks/linux-arm64-cp313.txt +8 -0
- package/voice-locks/linux-arm64-cp314.txt +8 -0
- package/voice-locks/linux-arm64-cp39.txt +12 -0
- package/voice-locks/linux-x64-cp310.txt +12 -0
- package/voice-locks/linux-x64-cp311.txt +8 -0
- package/voice-locks/linux-x64-cp312.txt +8 -0
- package/voice-locks/linux-x64-cp313.txt +8 -0
- package/voice-locks/linux-x64-cp314.txt +8 -0
- package/voice-locks/linux-x64-cp39.txt +12 -0
- package/dist/studio/assets/index-DNaLjJ7M.css +0 -32
package/dist/core/adapter.js
CHANGED
|
@@ -14,6 +14,7 @@ import { homedir } from 'node:os';
|
|
|
14
14
|
import { randomUUID } from 'node:crypto';
|
|
15
15
|
import { RunReadLane } from './run-read-lane.js';
|
|
16
16
|
import { AskError, AskUnsupportedError } from './types.js';
|
|
17
|
+
import { factsFromEvents, runFingerprint, RunFactsFile } from './run-log-facts.js';
|
|
17
18
|
import { DEFAULT_SETTINGS } from './types.js';
|
|
18
19
|
import { BASE_SKILL_REF_SHAPE } from '../skills/base-skill.js';
|
|
19
20
|
import { cloneRepository } from './repo-clone.js';
|
|
@@ -951,6 +952,10 @@ export class CoreAdapter {
|
|
|
951
952
|
applyGovernanceStoreEnv(this.governanceStore);
|
|
952
953
|
this.stub = opts.stub === true;
|
|
953
954
|
this.dbPath = opts.dbPath;
|
|
955
|
+
this.runFactsFile =
|
|
956
|
+
typeof opts.dbPath === 'string' && opts.dbPath !== '' && opts.dbPath !== ':memory:'
|
|
957
|
+
? new RunFactsFile(`${opts.dbPath}.run-facts.jsonl`, opts.dbPath)
|
|
958
|
+
: null;
|
|
954
959
|
// The QE acceptance setting's engine mirror (`syncEngineQeSetting`) must hold BEFORE the engine
|
|
955
960
|
// arms its bus bridge inside `spawn`, or a bus request in between would launch under the
|
|
956
961
|
// default: hand the boot value over in the engine's own variable, read at spawn.
|
|
@@ -1211,6 +1216,10 @@ export class CoreAdapter {
|
|
|
1211
1216
|
setDraining(drain) {
|
|
1212
1217
|
this.drainSince = drain ? (this.drainSince ?? Date.now()) : null;
|
|
1213
1218
|
}
|
|
1219
|
+
/** Whether new work is refused for maintenance (the launch's stand-in question is not asked of a draining daemon). */
|
|
1220
|
+
isDraining() {
|
|
1221
|
+
return this.drainSince !== null;
|
|
1222
|
+
}
|
|
1214
1223
|
/** Parked and human-held runs are idle for maintenance, but still hold their repository. */
|
|
1215
1224
|
async maintenanceState() {
|
|
1216
1225
|
const active = (await this.sessionsDetail())
|
|
@@ -1532,6 +1541,12 @@ export class CoreAdapter {
|
|
|
1532
1541
|
if (input.extraReadRoots !== undefined && input.extraReadRoots.length > 0) {
|
|
1533
1542
|
opts.extraReadRoots = input.extraReadRoots;
|
|
1534
1543
|
}
|
|
1544
|
+
// wicked-core#1463: an older addon ignores the field, which only keeps every read root
|
|
1545
|
+
// required (today's fail-closed behaviour), so it needs no version gate. Widened locally, as
|
|
1546
|
+
// `primary` and `voice` are, so crew still compiles against an addon's older declarations.
|
|
1547
|
+
if (input.optionalReadRoots !== undefined && input.optionalReadRoots.length > 0) {
|
|
1548
|
+
opts.optionalReadRoots = input.optionalReadRoots;
|
|
1549
|
+
}
|
|
1535
1550
|
if (input.excludeSeats !== undefined && input.excludeSeats.length > 0) {
|
|
1536
1551
|
// Fail CLOSED on an old addon (napi ignores undeclared fields): a silently-dropped exclusion
|
|
1537
1552
|
// would let the seat that wrote the work judge it — the one thing the caller asked to rule out.
|
|
@@ -1551,6 +1566,17 @@ export class CoreAdapter {
|
|
|
1551
1566
|
}
|
|
1552
1567
|
opts.reducedAssurance = true;
|
|
1553
1568
|
}
|
|
1569
|
+
// (DES-STANDIN-001 §3.8, K2a) Fail CLOSED on an addon without stand-ins (napi ignores undeclared fields): the
|
|
1570
|
+
// person's consent would be dropped and the run would hold or fail where they were told it would be checked.
|
|
1571
|
+
if (input.standInAware === true) {
|
|
1572
|
+
if (!this.supportsStandIns()) {
|
|
1573
|
+
throw new Error('stand-in checks need a wicked-core-ts that carries them (Core.independencePreflight and grantStandIns); upgrade the engine');
|
|
1574
|
+
}
|
|
1575
|
+
const o = opts;
|
|
1576
|
+
o.standInAware = true;
|
|
1577
|
+
if (input.standIn !== undefined)
|
|
1578
|
+
o.standInJson = JSON.stringify(input.standIn);
|
|
1579
|
+
}
|
|
1554
1580
|
// (program DES-POWER-MODE) Fail CLOSED on an addon without power mode (napi ignores an undeclared
|
|
1555
1581
|
// field): the run would launch phased while its launcher reported power mode on.
|
|
1556
1582
|
if (input.power === true) {
|
|
@@ -1874,9 +1900,11 @@ export class CoreAdapter {
|
|
|
1874
1900
|
return Promise.reject(new PlanGateNoteUnsupportedError());
|
|
1875
1901
|
}
|
|
1876
1902
|
const core = this.core;
|
|
1903
|
+
// (crew#1698, core#1808) `expectGateSeq`: the opening of the gate the record showed; the engine refuses a
|
|
1904
|
+
// gate that closed and re-opened since (`gate_changed:`), at the same ord too.
|
|
1877
1905
|
return plan !== undefined
|
|
1878
|
-
? core.confirmGate(runId, true, note ?? null, 'edit_plan', null, JSON.stringify(plan), actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null)
|
|
1879
|
-
: core.confirmGate(runId, approve, amend ?? null, action ?? null, amendScope ?? null, null, actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null);
|
|
1906
|
+
? core.confirmGate(runId, true, note ?? null, 'edit_plan', null, JSON.stringify(plan), actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null, expect.gateSeq ?? null)
|
|
1907
|
+
: core.confirmGate(runId, approve, amend ?? null, action ?? null, amendScope ?? null, null, actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null, expect.gateSeq ?? null);
|
|
1880
1908
|
}, undefined, resumesWork);
|
|
1881
1909
|
}
|
|
1882
1910
|
return this.handedToEngine('run', runId, () => {
|
|
@@ -2038,6 +2066,45 @@ export class CoreAdapter {
|
|
|
2038
2066
|
const C = Core;
|
|
2039
2067
|
return typeof C.supportsPlanSendBack === 'function' && C.supportsPlanSendBack() === true;
|
|
2040
2068
|
}
|
|
2069
|
+
/** (DES-STANDIN-001 §3.9, §3.10; K2a) The linked engine takes stand-in launches: it carries both the preflight and
|
|
2070
|
+
* the gate grant (method presence, as core-ts documents). Read at call time. */
|
|
2071
|
+
supportsStandIns() {
|
|
2072
|
+
const c = this.core;
|
|
2073
|
+
return typeof c.independencePreflight === 'function' && typeof c.grantStandIns === 'function';
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* (DES-STANDIN-001 §3.9) Which independent roles this launch would be short of, on the shape it would take: the
|
|
2077
|
+
* engine resolves the contract through the launch's own code. Rejects as the launch would refuse the shape.
|
|
2078
|
+
*/
|
|
2079
|
+
async independencePreflight(input) {
|
|
2080
|
+
const core = this.core;
|
|
2081
|
+
const shape = {
|
|
2082
|
+
...(input.workflow !== undefined ? { workflow: input.workflow } : {}),
|
|
2083
|
+
...(input.projectId !== undefined ? { projectId: input.projectId } : {}),
|
|
2084
|
+
...(input.plan !== undefined ? { planJson: JSON.stringify(input.plan) } : {}),
|
|
2085
|
+
...(input.power === true ? { power: true } : {}),
|
|
2086
|
+
...(input.primary !== undefined ? { primary: input.primary } : {}),
|
|
2087
|
+
...(input.excludeSeats !== undefined && input.excludeSeats.length > 0 ? { excludeSeats: input.excludeSeats } : {}),
|
|
2088
|
+
...(input.skipQeAcceptanceReason !== undefined ? { skipQeAcceptanceReason: input.skipQeAcceptanceReason } : {}),
|
|
2089
|
+
...(input.forceQeAcceptance === true ? { forceQeAcceptance: true } : {}),
|
|
2090
|
+
repoBound: input.repoRef !== undefined,
|
|
2091
|
+
};
|
|
2092
|
+
return core.independencePreflight(engineRosterJson(input.clisJson), JSON.stringify(shape));
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* (DES-STANDIN-001 §3.10, crew#1856) USE STAND-INS at the run's open `stand_in_needed` gate: the person's consent
|
|
2096
|
+
* (`scope`) goes on the run and the held check continues. `gateSeq` is the open gate's opening (its durable row's
|
|
2097
|
+
* `gate_seq`), `actor` the server's name for the person. The engine refuses a stale opening (`gate_changed:`).
|
|
2098
|
+
*/
|
|
2099
|
+
grantStandIns(runId, scope, gateSeq, actor, ord) {
|
|
2100
|
+
const core = this.core;
|
|
2101
|
+
return this.handedToEngine('run', runId, () => {
|
|
2102
|
+
if (!this.supportsStandIns()) {
|
|
2103
|
+
return Promise.reject(new Error('Using stand-ins at a gate needs a wicked-core-ts with Core.grantStandIns; upgrade the engine'));
|
|
2104
|
+
}
|
|
2105
|
+
return core.grantStandIns(runId, scope, gateSeq, actor, ord ?? null);
|
|
2106
|
+
}, undefined, true);
|
|
2107
|
+
}
|
|
2041
2108
|
/** (workdoc-all-runs; core lane context-block-core) The linked engine keeps a per-run CONTEXT BLOCK it hands every
|
|
2042
2109
|
* seat it spawns (`Core.supportsRunContext`). Until it does, crew's working document re-sends the person's context
|
|
2043
2110
|
* before each later worker step (the standing note). Read at call time. */
|
|
@@ -2133,41 +2200,108 @@ export class CoreAdapter {
|
|
|
2133
2200
|
}
|
|
2134
2201
|
/**
|
|
2135
2202
|
* Each run's launch name as the engine RECORDED it — `sessionStarted.workflowId` from its event
|
|
2136
|
-
* log (the preset, the registered def, `<run>:plan-<rev>`, or `null` for free text).
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
*
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2203
|
+
* log (the preset, the registered def, `<run>:plan-<rev>`, or `null` for free text). Seam X2 — the one input
|
|
2204
|
+
* `resolveRunIdentity` needs that the session record lacks.
|
|
2205
|
+
*
|
|
2206
|
+
* crew#1880: read through the run's log FACTS (run-log-facts.ts), one read per run answering both this and the
|
|
2207
|
+
* `ended_at` backfill ({@link runEndedFact}). A read made while the run is terminal is FINAL (its facts settle);
|
|
2208
|
+
* one made while it is live keeps only a found launch name (a live run's frame may not be flushed yet). A final
|
|
2209
|
+
* read's positive facts are kept beside the store, so the next start reads no log for them.
|
|
2210
|
+
*/
|
|
2211
|
+
runFactsMemo = new Map();
|
|
2212
|
+
/** One in-flight read per run and kind (a terminal-time read is never answered by a live-time one). */
|
|
2213
|
+
runFactsReads = new Map();
|
|
2214
|
+
/** crew#1880: `<db>.run-facts.jsonl`; null for an in-memory or unnamed store. */
|
|
2215
|
+
runFactsFile;
|
|
2216
|
+
/** One read of a run's log, shared by concurrent callers. `null` = no event-log binding; a failed read throws. */
|
|
2217
|
+
readRunFacts(view) {
|
|
2143
2218
|
const id = view.session.id;
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2219
|
+
const final = TERMINAL_RUN_STATUSES.has(view.session.status);
|
|
2220
|
+
const key = `${final ? 'T' : 'L'}:${id}`;
|
|
2221
|
+
const inFlight = this.runFactsReads.get(key);
|
|
2222
|
+
if (inFlight !== undefined)
|
|
2223
|
+
return inFlight;
|
|
2224
|
+
const read = (async () => {
|
|
2225
|
+
const events = await this.runEvents(id);
|
|
2226
|
+
if (events === null)
|
|
2227
|
+
return null;
|
|
2228
|
+
const facts = { ...factsFromEvents(events), final };
|
|
2229
|
+
if (final) {
|
|
2230
|
+
this.runFactsMemo.set(id, facts);
|
|
2231
|
+
this.runFactsFile?.put(id, runFingerprint(view.session.problem), facts);
|
|
2232
|
+
}
|
|
2233
|
+
else if (facts.launched !== undefined && this.runFactsMemo.get(id)?.final !== true) {
|
|
2234
|
+
this.runFactsMemo.set(id, facts);
|
|
2235
|
+
}
|
|
2236
|
+
return facts;
|
|
2237
|
+
})();
|
|
2238
|
+
this.runFactsReads.set(key, read);
|
|
2239
|
+
const clear = () => {
|
|
2240
|
+
if (this.runFactsReads.get(key) === read)
|
|
2241
|
+
this.runFactsReads.delete(key);
|
|
2242
|
+
};
|
|
2243
|
+
read.then(clear, clear);
|
|
2244
|
+
return read;
|
|
2245
|
+
}
|
|
2246
|
+
/** The facts kept for this run on disk (bound to its problem). A kept launch name is folded into the in-process
|
|
2247
|
+
* memo (so later folds skip the hash); the memo is FINAL only when both facts were kept (a negative never is). */
|
|
2248
|
+
keptRunFacts(view) {
|
|
2249
|
+
if (this.runFactsFile === null)
|
|
2250
|
+
return undefined;
|
|
2251
|
+
const kept = this.runFactsFile.get(view.session.id, runFingerprint(view.session.problem));
|
|
2252
|
+
if (kept?.launched !== undefined) {
|
|
2253
|
+
this.runFactsMemo.set(view.session.id, {
|
|
2254
|
+
launched: kept.launched,
|
|
2255
|
+
endedAt: kept.endedAt ?? null,
|
|
2256
|
+
final: kept.endedAt !== undefined,
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
return kept;
|
|
2260
|
+
}
|
|
2261
|
+
async launchedWorkflowOf(view) {
|
|
2262
|
+
const known = this.runFactsMemo.get(view.session.id);
|
|
2263
|
+
if (known !== undefined && (known.final || known.launched !== undefined))
|
|
2264
|
+
return known.launched;
|
|
2265
|
+
const kept = this.keptRunFacts(view);
|
|
2266
|
+
if (kept?.launched !== undefined)
|
|
2267
|
+
return kept.launched;
|
|
2147
2268
|
try {
|
|
2148
|
-
|
|
2269
|
+
return (await this.readRunFacts(view))?.launched;
|
|
2149
2270
|
}
|
|
2150
2271
|
catch {
|
|
2151
2272
|
return undefined;
|
|
2152
2273
|
}
|
|
2153
|
-
|
|
2274
|
+
}
|
|
2275
|
+
/**
|
|
2276
|
+
* crew#1880: a terminal run's FIRST terminal frame `ts` (millis), for the `ended_at` backfill — from the in-process
|
|
2277
|
+
* memo, the kept facts, or one read of its log (shared with the identity read). `null` = the log holds no terminal
|
|
2278
|
+
* frame; `undefined` = no event-log binding. A failed read throws (the backfill retries it on a later request).
|
|
2279
|
+
*/
|
|
2280
|
+
async runEndedFact(view) {
|
|
2281
|
+
const known = this.runFactsMemo.get(view.session.id);
|
|
2282
|
+
if (known?.final === true)
|
|
2283
|
+
return known.endedAt;
|
|
2284
|
+
const kept = this.keptRunFacts(view);
|
|
2285
|
+
if (kept?.endedAt !== undefined)
|
|
2286
|
+
return kept.endedAt;
|
|
2287
|
+
const facts = await this.readRunFacts(view);
|
|
2288
|
+
if (facts === null)
|
|
2154
2289
|
return undefined;
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
this.launchedWorkflows.set(id, launched);
|
|
2161
|
-
}
|
|
2162
|
-
return launched;
|
|
2290
|
+
return facts.final ? facts.endedAt : null;
|
|
2291
|
+
}
|
|
2292
|
+
/** crew#1880: write the kept facts still buffered (tests; `close` flushes too). */
|
|
2293
|
+
flushRunFacts() {
|
|
2294
|
+
return this.runFactsFile?.flush() ?? Promise.resolve();
|
|
2163
2295
|
}
|
|
2164
2296
|
/**
|
|
2165
2297
|
* (DES-CATALOG-002 §2.3) The name one run was launched under, as the engine recorded it (`sessionStarted.workflowId`):
|
|
2166
2298
|
* the run fence's fallback for a run crew no longer holds in memory. Memoized once found; `undefined` = not known.
|
|
2167
2299
|
*/
|
|
2168
2300
|
async launchedWorkflowOfRun(runId) {
|
|
2169
|
-
|
|
2170
|
-
|
|
2301
|
+
// As before crew#1880: a found launch name, or a terminal run's settled "none", answers without a read.
|
|
2302
|
+
const known = this.runFactsMemo.get(runId);
|
|
2303
|
+
if (known !== undefined && (known.final || known.launched !== undefined))
|
|
2304
|
+
return known.launched;
|
|
2171
2305
|
let events;
|
|
2172
2306
|
try {
|
|
2173
2307
|
events = await this.runEvents(runId);
|
|
@@ -2175,13 +2309,14 @@ export class CoreAdapter {
|
|
|
2175
2309
|
catch {
|
|
2176
2310
|
return undefined;
|
|
2177
2311
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2312
|
+
if (events === null)
|
|
2313
|
+
return undefined;
|
|
2314
|
+
const facts = factsFromEvents(events);
|
|
2315
|
+
if (facts.launched === undefined)
|
|
2180
2316
|
return undefined;
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
return launched;
|
|
2317
|
+
if (known === undefined)
|
|
2318
|
+
this.runFactsMemo.set(runId, { ...facts, final: false });
|
|
2319
|
+
return facts.launched;
|
|
2185
2320
|
}
|
|
2186
2321
|
/**
|
|
2187
2322
|
* Every run + its ordered units, each with its `run_identity` (seam X2) resolved from the engine's
|
|
@@ -3540,6 +3675,9 @@ export class CoreAdapter {
|
|
|
3540
3675
|
// powerModeDefault (program DES-POWER-MODE): a boolean only; anything else reads as the shipped default (on).
|
|
3541
3676
|
if ('powerModeDefault' in parsed && typeof parsed.powerModeDefault !== 'boolean')
|
|
3542
3677
|
delete parsed.powerModeDefault;
|
|
3678
|
+
// standInReview (DES-STANDIN-001 §4): 'ask' | 'always' only; anything else reads as unset ('ask', asked each time).
|
|
3679
|
+
if ('standInReview' in parsed && parsed.standInReview !== 'ask' && parsed.standInReview !== 'always')
|
|
3680
|
+
delete parsed.standInReview;
|
|
3543
3681
|
// newWorkSeats (F1/F2): a list of seat keys, or null. An invalid value is left out of the settings served (they
|
|
3544
3682
|
// keep the API's type) but KEPT for the next write (`kept`): new work reads it strictly (`readNewWorkSeats`) and
|
|
3545
3683
|
// refuses it, and an unrelated write that erased it would quietly widen the pool to every seat.
|
|
@@ -3651,6 +3789,7 @@ export class CoreAdapter {
|
|
|
3651
3789
|
if (this.closed)
|
|
3652
3790
|
return;
|
|
3653
3791
|
this.closed = true;
|
|
3792
|
+
void this.runFactsFile?.flush();
|
|
3654
3793
|
if (this.engineBus !== null && this.busDbPath !== undefined)
|
|
3655
3794
|
detachEngineBus(this.busDbPath, this.engineBus);
|
|
3656
3795
|
this.listeners.clear();
|