wicked-crew 0.18.21 → 0.18.23
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-view.d.ts.map +1 -1
- package/dist/api/audit-view.js +1 -0
- package/dist/api/audit-view.js.map +1 -1
- 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 +77 -0
- package/dist/api/desk-snoozes.d.ts.map +1 -0
- package/dist/api/desk-snoozes.js +220 -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/domain-model.d.ts +56 -0
- package/dist/api/domain-model.d.ts.map +1 -0
- package/dist/api/domain-model.js +281 -0
- package/dist/api/domain-model.js.map +1 -0
- package/dist/api/domain-scope.d.ts +52 -0
- package/dist/api/domain-scope.d.ts.map +1 -0
- package/dist/api/domain-scope.js +156 -0
- package/dist/api/domain-scope.js.map +1 -0
- package/dist/api/eval-rule-store.d.ts +32 -0
- package/dist/api/eval-rule-store.d.ts.map +1 -0
- package/dist/api/eval-rule-store.js +77 -0
- package/dist/api/eval-rule-store.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 +19 -0
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +166 -3
- 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 +6 -4
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js +6 -3
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/routes.d.ts +21 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +578 -94
- 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/server.d.ts.map +1 -1
- package/dist/api/server.js +1 -0
- package/dist/api/server.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +5 -2
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +18 -6
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts.map +1 -1
- package/dist/api/testing.js +11 -8
- package/dist/api/testing.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/actions/write-path.d.ts +6 -2
- package/dist/apps/actions/write-path.d.ts.map +1 -1
- package/dist/apps/actions/write-path.js +7 -3
- package/dist/apps/actions/write-path.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 +19 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +38 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +27 -10
- package/dist/cli/mcp.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 +57 -6
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +208 -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/launch-posture.d.ts +3 -0
- package/dist/core/launch-posture.d.ts.map +1 -1
- package/dist/core/launch-posture.js +4 -0
- package/dist/core/launch-posture.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 +62 -0
- package/dist/core/stand-in.d.ts.map +1 -0
- package/dist/core/stand-in.js +153 -0
- package/dist/core/stand-in.js.map +1 -0
- package/dist/core/types.d.ts +22 -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 +44 -0
- package/dist/mcp/policies.d.ts.map +1 -1
- package/dist/mcp/policies.js +153 -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 +43 -3
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +224 -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/persona/routes.d.ts +1 -1
- package/dist/persona/store.d.ts +1 -1
- package/dist/schedules/routes.d.ts.map +1 -1
- package/dist/schedules/routes.js +6 -0
- package/dist/schedules/routes.js.map +1 -1
- 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/sources/routes.d.ts +2 -2
- package/dist/sources/routes.d.ts.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/assets/{KnowledgeGraph-yP4WsnST.js → KnowledgeGraph-BrHcKpFT.js} +1 -1
- package/dist/studio/assets/index-BCVvMebl.css +32 -0
- package/dist/studio/assets/{index-DW53FKuT.js → index-BqB2Ydq-.js} +337 -311
- 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 +953 -107
- 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 +100 -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/api/routes.js
CHANGED
|
@@ -8,7 +8,9 @@ import { busSeamsOffWarning, busUnavailableWarning } from '../core/bus-notice.js
|
|
|
8
8
|
import { vaultBinWarning, vaultDiagnostics } from '../core/vault-bin.js';
|
|
9
9
|
import { PlanSchema, toLaunchPlan } from './plan-schema.js';
|
|
10
10
|
import { record, z } from '../zod.js';
|
|
11
|
-
import { listRequirementsRead, setRepoMinimum, getRequirement, patchRequirement, retireRequirement, readRequirementsGraph, REQUIREMENTS_NOT_GENERATED, } from './requirements.js';
|
|
11
|
+
import { listRequirementsRead, setRepoMinimum, getRequirement, patchRequirement, retireRequirement, readRequirementsGraph, REQUIREMENTS_NOT_GENERATED, forgetRequirementsReads, } from './requirements.js';
|
|
12
|
+
import { DOMAIN_EXTRACTION_WORKFLOW, domainScopeJsonOf, domainScopeOfWords, rulingAnswerOf, rulingRequestOf } from './domain-model.js';
|
|
13
|
+
import { scopeCardFor } from './domain-scope.js';
|
|
12
14
|
import { randomUUID } from 'node:crypto';
|
|
13
15
|
import { homedir } from 'node:os';
|
|
14
16
|
import { readFileSync, existsSync, mkdirSync, realpathSync } from 'node:fs';
|
|
@@ -16,7 +18,7 @@ import { promises as fsp } from 'node:fs';
|
|
|
16
18
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
17
19
|
import { fileURLToPath } from 'node:url';
|
|
18
20
|
import { videoPalette } from '../appearance/video-palette.js';
|
|
19
|
-
import { CampaignsUnsupportedError, ChatUnsupportedError, CoreAdapter, MaintenanceDrainError, RepoUnregisterUnsupportedError, TERMINAL_RUN_STATUSES, ElicitationUnsupportedError, GovernanceReplayUnsupportedError, PlanGateNoteUnsupportedError, PlanLaunchUnsupportedError, SteeringUnsupportedError, addonSupportsQeOverride, addonSupportsReducedAssurance, humanGatePhaseIds, readNewWorkSeats, settingsFilePath } from '../core/adapter.js';
|
|
21
|
+
import { CampaignsUnsupportedError, ChatUnsupportedError, CoreAdapter, DomainRulingUnsupportedError, MaintenanceDrainError, RepoUnregisterUnsupportedError, TERMINAL_RUN_STATUSES, ElicitationUnsupportedError, GovernanceReplayUnsupportedError, PlanGateNoteUnsupportedError, PlanLaunchUnsupportedError, SteeringUnsupportedError, addonSupportsDomainScope, addonSupportsQeOverride, addonSupportsReducedAssurance, humanGatePhaseIds, readNewWorkSeats, settingsFilePath } from '../core/adapter.js';
|
|
20
22
|
import { codeGraphDb, codeGraphErrorStatus, repoFolderMissing, repoFolderMissingBody } from '../core/repoPaths.js';
|
|
21
23
|
import { resolveCursorUnit } from '../core/cursor.js';
|
|
22
24
|
/** Create `dir` (private) when missing and answer it — a read root must exist when a run launches. */
|
|
@@ -50,7 +52,7 @@ function turnReadRoots(scratchRoot) {
|
|
|
50
52
|
}
|
|
51
53
|
return roots;
|
|
52
54
|
}
|
|
53
|
-
import { detectRefusal, isOpenGate, offeredChoices, replayOpenGate } from './gate-cache.js';
|
|
55
|
+
import { detectRefusal, gateSeqOf, isOpenGate, offeredChoices, replayOpenGate } from './gate-cache.js';
|
|
54
56
|
import { acceptanceRequirementOf, buildAcceptanceView } from '../qe/acceptance.js';
|
|
55
57
|
import { runIdentityOf, wireIdentity } from '../core/run-identity.js';
|
|
56
58
|
import { buildWorkflowCatalog } from '../workflow-catalog/build.js';
|
|
@@ -89,6 +91,7 @@ import { estateExe, parseEstateTotals, projectGraphRefreshDiagnostics, readBlast
|
|
|
89
91
|
import { attachRepoToProject, createProjectRecorded, registerProjectRoutes } from '../projects/routes.js';
|
|
90
92
|
import { registerProjectAggregateRoutes } from './project-aggregates.js';
|
|
91
93
|
import { composeLaunch, composePreflight, registerProductRoutes } from './product.js';
|
|
94
|
+
import { registerProductPublishRoutes } from './product-publish.js';
|
|
92
95
|
import { buildWorkflowCatalogV2, parseCommand, resolveOption } from '../workflow-catalog/build-v2.js';
|
|
93
96
|
import { DEFAULT_PROJECT_ID } from '../projects/default-project.js';
|
|
94
97
|
import { DETECT_MAX_CHARS, DETECT_TIMEOUT_MS, DetectService, shadowCheck } from '../workflow-catalog/detect-service.js';
|
|
@@ -127,6 +130,7 @@ import { REQUIRED_GARDEN_VERSION } from '../skills/plugin-source.js';
|
|
|
127
130
|
import { isSeatKeyList } from '../core/job-seats.js';
|
|
128
131
|
import { engineRosterJson, noEligibleSeatBody, parseNoEligibleSeat, toEngineSeat } from '../core/engine-roster.js';
|
|
129
132
|
import { launchAssuranceNotice, readJudgeCoverage } from '../core/assurance.js';
|
|
133
|
+
import { STAND_IN_NEEDED_GATE, USE_STAND_INS_ACTION, consentFor, isStandInReview, preflightRefusal, readPreflight, settingConsent } from '../core/stand-in.js';
|
|
130
134
|
import { launchPosture } from '../core/launch-posture.js';
|
|
131
135
|
import { launchRequiresQe, mayRequireQe, qeAcceptanceMode, qeSettingSkipReason } from '../core/qe-acceptance-setting.js';
|
|
132
136
|
import { aggregateReceipt, postHocDeliveryAssurance, qeAcceptanceFromView, qeAcceptanceRefusal, QE_ACCEPTANCE_REQUIRED_CODE, receiptOf, qeAcceptanceNotRequired, qeDecisionBypasses, qeDecisionOf, qeAcceptanceSkippedAtGate, unreadableQeAcceptance, } from './delivery-assurance.js';
|
|
@@ -144,6 +148,7 @@ import { createDocInProcess, registerInteractiveProxy } from '../interactive/pro
|
|
|
144
148
|
import { CreateLauncher } from '../interactive/proposal-create.js';
|
|
145
149
|
import { ThemeLauncher } from './proposal-theme.js';
|
|
146
150
|
import { CHAT_GIT_PROTOCOLS, OnboardLauncher, probeGitUrl, withoutCredentials } from './proposal-onboard.js';
|
|
151
|
+
import { CutLauncher } from './proposal-cut.js';
|
|
147
152
|
import { RefineLauncher } from '../interactive/proposal-refine.js';
|
|
148
153
|
import { lineageSteps, protectedEdits } from '../interactive/protected-edits.js';
|
|
149
154
|
import { buildRunBrief } from './run-brief.js';
|
|
@@ -172,6 +177,7 @@ import { AuditLog } from './audit.js';
|
|
|
172
177
|
import { auditFor } from './audit-view.js';
|
|
173
178
|
import { ProposalDecisionIndex, recordProposalDecision } from './proposal-decisions.js';
|
|
174
179
|
import { AcpFoldCache, EngineVersionCache, FloorCacheCache, eventsDirOf, installedPackageVersion, hostSandboxLauncher, seatRosterFile, listStoreFiles, readStudioBundleVersion, } from './diagnostics.js';
|
|
180
|
+
import { DiskStoreCache, readDiskStores } from './disk-stores.js';
|
|
175
181
|
import { GovernanceDiagnostics } from './governance-health.js';
|
|
176
182
|
import { ATTACHMENT_LIMITS, ATTACHMENT_MAX_MESSAGE_BYTES, AttachmentError, ChatAttachmentStore, attachmentWire, attachmentsBlock, boundaryOf, parseMultipart, stageForSeat } from './chat-attachments.js';
|
|
177
183
|
import { CHAT_HISTORY_MAX_LIMIT, ChatHistoryStore, SeedRequestStore, decodeCursor } from './chat-history.js';
|
|
@@ -193,6 +199,7 @@ import { VoiceService, defaultVoiceDir } from '../voice/service.js';
|
|
|
193
199
|
import { TtsService } from '../voice/tts.js';
|
|
194
200
|
import { VoiceDashboardStore } from '../voice/dashboard.js';
|
|
195
201
|
import { registerVoiceRoutes } from '../voice/routes.js';
|
|
202
|
+
import { DeskSnoozes, holdSnoozed, registerDeskSnoozeRoutes } from './desk-snoozes.js';
|
|
196
203
|
import { VoiceInjectInputs } from '../voice/inject-input.js';
|
|
197
204
|
import { GroupIndex } from './group-index.js';
|
|
198
205
|
import { RunTimingIndex, recordRunLaunched } from './run-timing-index.js';
|
|
@@ -216,6 +223,7 @@ import { ConsiderationService } from '../decisions/consider.js';
|
|
|
216
223
|
import { engineConformance, gardenPackCheck } from '../editors/pack-install.js';
|
|
217
224
|
import { conformanceProvisioner, conformanceRuntimeReady, conformanceRuntimeRoot, conformanceVenvDir, editorPluginLaunchListener, venvPython } from '../editors/conformance-runtime.js';
|
|
218
225
|
import { EditorRegistry } from '../editors/registry.js';
|
|
226
|
+
import { packSkillsPort } from '../editors/pack-extras.js';
|
|
219
227
|
import { registerEditorRoutes, unitTokenProbe } from '../editors/routes.js';
|
|
220
228
|
import { broadcast } from '../events/bus.js';
|
|
221
229
|
import { AppWritePath } from '../apps/actions/write-path.js';
|
|
@@ -571,6 +579,13 @@ export function primaryRefusal(primary, clisJson) {
|
|
|
571
579
|
}
|
|
572
580
|
return null;
|
|
573
581
|
}
|
|
582
|
+
/** (api-types 0.232.0, J6 K1) {@link DomainScope}: what a domain model run covers. */
|
|
583
|
+
const DomainScopeSchema = z.strictObject({
|
|
584
|
+
intent: z.string().trim().min(1).max(2000),
|
|
585
|
+
phrases: z.array(z.string().trim().min(1).max(200)).max(50).optional(),
|
|
586
|
+
scopeHash: z.string().regex(/^[0-9a-f]{64}$/u, 'scopeHash is the 64-hex hash the scope card gave').optional(),
|
|
587
|
+
description: z.string().trim().min(1).max(200).optional(),
|
|
588
|
+
});
|
|
574
589
|
export const LaunchSchema = z.strictObject({
|
|
575
590
|
problem: z.string().min(1),
|
|
576
591
|
sessionId: z.string().min(1).optional(),
|
|
@@ -646,6 +661,9 @@ export const LaunchSchema = z.strictObject({
|
|
|
646
661
|
* "full assurance", the same as omitting it: the launcher never chooses for the caller, and a
|
|
647
662
|
* full-assurance launch on a one-CLI roster is answered with `assuranceNotice` (`core/assurance.ts`). */
|
|
648
663
|
reducedAssurance: z.boolean().optional(),
|
|
664
|
+
/** (api-types 0.231.0, DES-STANDIN-001 §4) A PERSON's consent to stand-in checks for this job: the answer to a
|
|
665
|
+
* `409 stand_in_choice` (its `retryWith`). A worker's bearer gets 403; never with `reducedAssurance`. */
|
|
666
|
+
standIns: z.literal(true).optional(),
|
|
649
667
|
/** (api-types 0.149.0, program DES-POWER-MODE) Power mode for this launch. Omitted: the daemon's
|
|
650
668
|
* `powerModeDefault` setting (on when unset). Applies to a repo-scoped plan or preset launch only. */
|
|
651
669
|
power: z.boolean().optional(),
|
|
@@ -662,9 +680,20 @@ export const LaunchSchema = z.strictObject({
|
|
|
662
680
|
documents: z.array(z.string().trim().min(1).max(300)).max(RUN_DOCS_TOKENS_MAX).optional(),
|
|
663
681
|
/** (DES-CATALOG-002 §2.d piece 4, CS4) The run's source pick (registered source names); `[]` = none. */
|
|
664
682
|
sources: z.array(z.string().trim().min(1).max(100)).max(RUN_SOURCES_MAX).optional(),
|
|
683
|
+
/** (api-types 0.232.0, J6 K1) A domain-extraction launch's scope: required on that workflow, refused on any other. */
|
|
684
|
+
domainScope: DomainScopeSchema.optional(),
|
|
685
|
+
}).refine((b) => b.domainScope === undefined || b.workflow === DOMAIN_EXTRACTION_WORKFLOW, {
|
|
686
|
+
path: ['domainScope'],
|
|
687
|
+
error: 'domainScope is the scope of a domain-extraction launch; this launch names another workflow',
|
|
688
|
+
}).refine((b) => b.workflow !== DOMAIN_EXTRACTION_WORKFLOW || b.domainScope !== undefined, {
|
|
689
|
+
path: ['domainScope'],
|
|
690
|
+
error: 'a domain model run needs its scope: say what the model should cover (domainScope.intent)',
|
|
665
691
|
}).refine((b) => b.documents === undefined || b.documents.length === 0 || b.chatId !== undefined, {
|
|
666
692
|
path: ['documents'],
|
|
667
693
|
error: 'documents are chat tokens: send the chatId they were named in',
|
|
694
|
+
}).refine((b) => b.standIns !== true || b.reducedAssurance !== true, {
|
|
695
|
+
path: ['standIns'],
|
|
696
|
+
error: 'standIns and reducedAssurance are mutually exclusive: stand-in checks are labelled checks, reduced assurance skips them',
|
|
668
697
|
}).refine((b) => b.skipQeAcceptance === undefined || b.forceQeAcceptance !== true, {
|
|
669
698
|
path: ['forceQeAcceptance'],
|
|
670
699
|
error: 'skipQeAcceptance and forceQeAcceptance are mutually exclusive — skip it with a reason, or force it',
|
|
@@ -762,16 +791,22 @@ export const GateSchema = z.strictObject({
|
|
|
762
791
|
amend: z.string().optional(),
|
|
763
792
|
action: z
|
|
764
793
|
.union([
|
|
765
|
-
z.enum(['approve', 'request_changes', 'reject', 'edit_plan', 'amend_intent', OPERATOR_JUDGMENT_ACTION, SKIP_QE_ACTION, SKIP_RULES_ACTION, ...ESCALATION_ACTIONS]),
|
|
794
|
+
z.enum(['approve', 'request_changes', 'reject', 'edit_plan', 'amend_intent', OPERATOR_JUDGMENT_ACTION, SKIP_QE_ACTION, SKIP_RULES_ACTION, USE_STAND_INS_ACTION, ...ESCALATION_ACTIONS]),
|
|
766
795
|
z.string().regex(CONSENT_CHOICE_ACTION, 'a consent choice is `consent:<choice id>`'),
|
|
767
796
|
])
|
|
768
797
|
.optional(),
|
|
769
798
|
amendScope: z.enum(['cursor', 'creator']).optional(),
|
|
799
|
+
/** (api-types 0.231.0, DES-STANDIN-001 §3.10) With `action: 'use_stand_ins'`: this job only, or every job (also
|
|
800
|
+
* saves the `standInReview: 'always'` setting). */
|
|
801
|
+
scope: z.enum(['job', 'always']).optional(),
|
|
770
802
|
/** DES-TEAMING-002 T3 — approve a `plan_approval` gate WITH AN EDIT (`GateDecision.plan`). */
|
|
771
803
|
plan: PlanSchema.optional(),
|
|
772
804
|
/** api-types 0.44.0 — the gate this decision answers (its unit `ord`). A mismatch with the run's
|
|
773
805
|
* open gate is a 409 `gate_changed`: the decision was made on a gate that is no longer open. */
|
|
774
806
|
ord: z.int().nonnegative().optional(),
|
|
807
|
+
/** (crew#1698, api-types 0.231.0) The OPENING of the gate this decision answers (`awaitingHuman.gateSeq`): a gate that
|
|
808
|
+
* closed and re-opened since, at the same ord too, is a 409 `gate_changed`. */
|
|
809
|
+
gateSeq: z.int().positive().optional(),
|
|
775
810
|
/** (api-types 0.192.0, DES-CATALOG-002 §4.6) At a `plan_approval` gate: the plan revision this answer was made on.
|
|
776
811
|
* Passed with `ord` into the engine's own serialized decision, which refuses a stale one (`gate_changed`). */
|
|
777
812
|
planRev: z.int().nonnegative().optional(),
|
|
@@ -790,8 +825,8 @@ export const GateSchema = z.strictObject({
|
|
|
790
825
|
.min(1)
|
|
791
826
|
.max(500)
|
|
792
827
|
.optional(),
|
|
793
|
-
}).refine((b) => (b.action === SKIP_RULES_ACTION) === (b.skipRules !== undefined), { path: ['skipRules'], error: 'skip_rules needs `skipRules`: [{id, reason}] for each rule you skip (unchecked, waived or disputed), each with your written reason; skipRules goes with skip_rules only' }).refine((b) => b.action !== SKIP_RULES_ACTION || (b.approve && b.amend === undefined && b.amendScope === undefined && b.plan === undefined), { path: ['action'], error: 'skip_rules takes approve: true and no amend, amendScope or plan — the reasons ride skipRules' }).refine((b) => b.skipRules === undefined || new Set(b.skipRules.map((r) => r.id)).size === b.skipRules.length, { path: ['skipRules'], error: 'skipRules names a rule twice' }).refine((b) => b.keepRules === undefined || (b.approve && (b.action === undefined || b.action === 'approve') && b.plan === undefined), { path: ['keepRules'], error: 'keepRules goes with a plain approve (no action other than approve, no plan) of a steering-author propose gate' }).refine((b) => b.action === undefined
|
|
794
|
-
|| (b.action === 'approve' || b.action === 'edit_plan' || b.action === 'amend_intent' || b.action === OPERATOR_JUDGMENT_ACTION || b.action === SKIP_QE_ACTION || b.action === SKIP_RULES_ACTION || isEscalationAction(b.action)) === b.approve, { path: ['action'], error: '`action` disagrees with `approve`: request_changes and reject require approve: false; approve, edit_plan, amend_intent, operator_judgment, skip_qe, skip_rules, extend, targeted, accept_partial, accept_suggestion, rejudge, retry_rules, retry_qe and consent:<id> require approve: true' }).refine(
|
|
828
|
+
}).refine((b) => (b.action === SKIP_RULES_ACTION) === (b.skipRules !== undefined), { path: ['skipRules'], error: 'skip_rules needs `skipRules`: [{id, reason}] for each rule you skip (unchecked, waived or disputed), each with your written reason; skipRules goes with skip_rules only' }).refine((b) => (b.action === USE_STAND_INS_ACTION) === (b.scope !== undefined), { path: ['scope'], error: "use_stand_ins needs `scope`: 'job' (this job) or 'always' (every job); scope goes with use_stand_ins only" }).refine((b) => b.action !== USE_STAND_INS_ACTION || (b.approve && b.amend === undefined && b.amendScope === undefined && b.plan === undefined), { path: ['action'], error: 'use_stand_ins takes approve: true and no amend, amendScope or plan' }).refine((b) => b.action !== SKIP_RULES_ACTION || (b.approve && b.amend === undefined && b.amendScope === undefined && b.plan === undefined), { path: ['action'], error: 'skip_rules takes approve: true and no amend, amendScope or plan — the reasons ride skipRules' }).refine((b) => b.skipRules === undefined || new Set(b.skipRules.map((r) => r.id)).size === b.skipRules.length, { path: ['skipRules'], error: 'skipRules names a rule twice' }).refine((b) => b.keepRules === undefined || (b.approve && (b.action === undefined || b.action === 'approve') && b.plan === undefined), { path: ['keepRules'], error: 'keepRules goes with a plain approve (no action other than approve, no plan) of a steering-author propose gate' }).refine((b) => b.action === undefined
|
|
829
|
+
|| (b.action === 'approve' || b.action === 'edit_plan' || b.action === 'amend_intent' || b.action === OPERATOR_JUDGMENT_ACTION || b.action === SKIP_QE_ACTION || b.action === SKIP_RULES_ACTION || b.action === USE_STAND_INS_ACTION || isEscalationAction(b.action)) === b.approve, { path: ['action'], error: '`action` disagrees with `approve`: request_changes and reject require approve: false; approve, edit_plan, amend_intent, operator_judgment, skip_qe, skip_rules, extend, targeted, accept_partial, accept_suggestion, rejudge, retry_rules, retry_qe, use_stand_ins and consent:<id> require approve: true' }).refine(
|
|
795
830
|
// (operator ruling 2026-10-21) The override's rationale IS its record: a blank one is a 400 here,
|
|
796
831
|
// before the engine is asked.
|
|
797
832
|
(b) => b.action !== OPERATOR_JUDGMENT_ACTION || (b.amend !== undefined && b.amend.trim() !== ''), { path: ['amend'], error: 'operator_judgment needs `amend`: your written rationale — why the failed floor is not the work\'s (an empty one is refused)' }).refine((b) => b.action !== OPERATOR_JUDGMENT_ACTION || (b.amendScope === undefined && b.plan === undefined), { path: ['amendScope'], error: 'operator_judgment takes no amendScope or plan — it answers the failed floor of the gated unit' }).refine(
|
|
@@ -838,11 +873,17 @@ export function injectWords(message) {
|
|
|
838
873
|
end -= 1;
|
|
839
874
|
return message.slice(0, end);
|
|
840
875
|
}
|
|
841
|
-
|
|
876
|
+
/** (crew#1698, api-types 0.231.0) `gateSeq`: which OPENING of the gate an answer was made on (`awaitingHuman.gateSeq`,
|
|
877
|
+
* `GET /runs/:id/gate`'s `gateSeq`). A gate that closed and re-opened since, at the same ord too, is another opening:
|
|
878
|
+
* 409 `gate_changed`. Optional; the ord check stands as before without it. */
|
|
879
|
+
const GateSeqSchema = z.int().positive().optional();
|
|
880
|
+
export const ResumeSchema = z.strictObject({ ord: z.int().nonnegative().optional(), gateSeq: GateSeqSchema });
|
|
842
881
|
// The manual reassign lever (crew#442): `cli` omitted lets the engine's council re-pick, the
|
|
843
882
|
// same shape the automatic stall-watchdog escalation uses for an unknown failover target.
|
|
844
883
|
const ReassignSchema = z.strictObject({
|
|
845
884
|
ord: z.int().nonnegative().optional(),
|
|
885
|
+
/** (crew#1698) The gate opening a gated reassign answers (see `ResumeSchema`). */
|
|
886
|
+
gateSeq: GateSeqSchema,
|
|
846
887
|
cli: z.string().min(1).optional(),
|
|
847
888
|
/** crew#1153: an operator note that rides a GATED reassign as the approve's amendment. Trimmed in
|
|
848
889
|
* the route; blank counts as absent. The byte cap (on the raw note) is checked there too so the 400 names the limit. */
|
|
@@ -1015,7 +1056,7 @@ export const ChatOpenSchema = z.strictObject({
|
|
|
1015
1056
|
}).optional(),
|
|
1016
1057
|
requestId: z.string().trim().min(1).max(128).optional(),
|
|
1017
1058
|
/** (api-types 0.192.0) What the client renders (`['job']`). */
|
|
1018
|
-
accepts: z.array(z.enum(['job', 'onboard'])).max(4).optional(),
|
|
1059
|
+
accepts: z.array(z.enum(['job', 'onboard', 'cut'])).max(4).optional(),
|
|
1019
1060
|
}).refine((b) => b.seed === undefined || (b.requestId !== undefined && b.chatId === undefined), {
|
|
1020
1061
|
path: ['seed'],
|
|
1021
1062
|
error: 'seed needs requestId and no chatId: the chat id derives from you and the request',
|
|
@@ -1173,6 +1214,9 @@ runtime = {}) {
|
|
|
1173
1214
|
return null;
|
|
1174
1215
|
} })(),
|
|
1175
1216
|
};
|
|
1217
|
+
// One store for the snooze routes and `GET /system`, which holds back the attention items snoozed (studio#1416).
|
|
1218
|
+
const deskSnoozes = new DeskSnoozes(audit);
|
|
1219
|
+
registerDeskSnoozeRoutes(app, { snoozes: deskSnoozes });
|
|
1176
1220
|
registerVoiceRoutes(app, { voice: voice.service, tts: voice.tts ?? new TtsService({ dir: defaultVoiceDir() }), dashboard: voice.dashboard, audit });
|
|
1177
1221
|
const voiceInputs = runtime.voiceInputs ?? new VoiceInjectInputs();
|
|
1178
1222
|
const openWithOs = runtime.openWithOs ?? openWithSystemDefault;
|
|
@@ -1212,10 +1256,13 @@ runtime = {}) {
|
|
|
1212
1256
|
'demo',
|
|
1213
1257
|
];
|
|
1214
1258
|
const chatArtifactFlags = chatArtifactsStub
|
|
1215
|
-
? { context: true, instructions: true, proposals: true, create: true, refine: true, theme: true, demo: true, stub: true, stubOps, onboard: true, cutInView: true }
|
|
1216
|
-
: { context: true, instructions: true, proposals: true, create: realCreate, refine: realRefine, theme: true, demo: false, onboard: true, cutInView: true };
|
|
1259
|
+
? { context: true, instructions: true, proposals: true, create: true, refine: true, theme: true, demo: true, stub: true, stubOps, onboard: true, cutInView: true, cut: true }
|
|
1260
|
+
: { context: true, instructions: true, proposals: true, create: realCreate, refine: realRefine, theme: true, demo: false, onboard: true, cutInView: true, cut: true };
|
|
1217
1261
|
const proposalLaunchers = new LaunchOnceRegistry();
|
|
1218
1262
|
proposalLaunchers.register('theme', new ThemeLauncher());
|
|
1263
|
+
// studio#1140 (a): Go on a cut card posts its frozen ops to the video tool's recut (real in the test configuration
|
|
1264
|
+
// too: it starts no run, and the video tool is the authority on every change).
|
|
1265
|
+
proposalLaunchers.register('cut', new CutLauncher({ bridgeFor: (projectId) => cutBridgeFor(projectId) }));
|
|
1219
1266
|
// crew-0182: what an onboard card is resolved and its Go is checked against (one set of reads for both).
|
|
1220
1267
|
// crew#1744: the one `git_url` reader (GET /repos, the repo search; the daemon hands the review service the same).
|
|
1221
1268
|
const repoOrigins = runtime.repoOrigins ?? new RepoOrigins();
|
|
@@ -1294,8 +1341,13 @@ runtime = {}) {
|
|
|
1294
1341
|
await deliveryResolver.settle(views, runtime.deliverySettleMs);
|
|
1295
1342
|
};
|
|
1296
1343
|
// crew#985: terminal runs with no `run.ended` entry are dated from the engine's event log before
|
|
1297
|
-
// the DTO is assembled (read-only
|
|
1344
|
+
// the DTO is assembled (read-only; once per run, kept across starts: crew#1880, `backfillEnded`).
|
|
1298
1345
|
const backfillEndedAt = async (views) => {
|
|
1346
|
+
// crew#1880: the adapter answers from facts kept across starts and one log read shared with the identity.
|
|
1347
|
+
if (typeof adapter.runEndedFact === 'function') {
|
|
1348
|
+
await runTimingIndex.backfillEnded(views, (view) => adapter.runEndedFact(view));
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1299
1351
|
if (typeof adapter.runEvents !== 'function')
|
|
1300
1352
|
return;
|
|
1301
1353
|
await runTimingIndex.backfillEndedFromEvents(views, (id) => adapter.runEvents(id));
|
|
@@ -1384,6 +1436,10 @@ runtime = {}) {
|
|
|
1384
1436
|
registry: editorRegistry,
|
|
1385
1437
|
adapter,
|
|
1386
1438
|
broadcast,
|
|
1439
|
+
// crew#1703: a pack's skills join the daemon skills root and are published as POST /skills/publish does; its
|
|
1440
|
+
// blocks become presets in the engine's store, checked against its phase catalog.
|
|
1441
|
+
skills: runtime.skills === undefined ? null : packSkillsPort(runtime.skills),
|
|
1442
|
+
presets: adapter,
|
|
1387
1443
|
packCheck: runtime.packCheck ?? gardenPackCheck(discoverLivePlugin()?.path ?? null),
|
|
1388
1444
|
conformance: runtime.editorConformance ?? engineConformance({ provision: editorConformanceRuntime }),
|
|
1389
1445
|
// F37: the grant write's §6.4 tripwire asks the engine whether a bearer is a governed unit's token.
|
|
@@ -1898,6 +1954,9 @@ runtime = {}) {
|
|
|
1898
1954
|
// assurance contract); a one-CLI full-assurance launch answers `assuranceNotice`. A route set
|
|
1899
1955
|
// that cannot probe the addon reports no capability — never an invented one.
|
|
1900
1956
|
reducedAssurance: typeof adapter.engineCapabilities === 'function' && addonSupportsReducedAssurance(),
|
|
1957
|
+
// (DES-STANDIN-001 §4, K2a) `POST /runs` asks the stand-in question (409 `stand_in_choice`), takes
|
|
1958
|
+
// `standIns: true`, the `standInReview` setting and the `use_stand_ins` gate answer: the linked engine carries them.
|
|
1959
|
+
standIns: typeof adapter.supportsStandIns === 'function' && adapter.supportsStandIns(),
|
|
1901
1960
|
// QE-IN-APP-WORKFLOWS: `LaunchRunBody.skipQeAcceptance` / `forceQeAcceptance` reach an addon
|
|
1902
1961
|
// that carries the QE decision; never an invented capability.
|
|
1903
1962
|
qeAcceptanceOverride: typeof adapter.engineCapabilities === 'function' && addonSupportsQeOverride(),
|
|
@@ -2000,6 +2059,8 @@ runtime = {}) {
|
|
|
2000
2059
|
const acpFoldCache = new AcpFoldCache();
|
|
2001
2060
|
const engineVersionCache = new EngineVersionCache();
|
|
2002
2061
|
const floorCacheCache = new FloorCacheCache();
|
|
2062
|
+
// crew#1126: what wicked holds on the state-home volume, read only when the disk row is low (60 s cache).
|
|
2063
|
+
const diskStoresCache = new DiskStoreCache(async (volumePath, deadline) => readDiskStores({ volumePath, deadline, floorCache: () => floorCacheCache.getRaw(), repos: await adapter.listRepos() }));
|
|
2003
2064
|
// The governance block (crew#495): the store the engine's emit seam writes to (as the adapter
|
|
2004
2065
|
// exported it — `null` on a boot that resolved none), its record count through the engine
|
|
2005
2066
|
// binding when the addon has one, and the dead-letter outbox folded on change. Built at boot so
|
|
@@ -2895,6 +2956,11 @@ runtime = {}) {
|
|
|
2895
2956
|
return reply.code(400).send(invalidBody(parsed.error, 'Invalid request body'));
|
|
2896
2957
|
}
|
|
2897
2958
|
const b = { ...parsed.data };
|
|
2959
|
+
// (DES-STANDIN-001 §3.8) Consent to stand-ins is a person's: a worker's or agent's bearer may only inherit the
|
|
2960
|
+
// consent a person already gave (the `standInReview` setting), never send its own.
|
|
2961
|
+
if (b.standIns === true && !isHumanOperator(req.actor)) {
|
|
2962
|
+
return reply.code(403).send({ code: 'human_operator_only', error: `only a person can consent to stand-in checks (standIns); you are ${req.actor.kind}/${req.actor.trust}` });
|
|
2963
|
+
}
|
|
2898
2964
|
// DES-CATALOG-002 §4.4: the words as the person gave them, before crew's framing line (the envelope's `words`, which
|
|
2899
2965
|
// a reshape relaunches from), with any block an earlier launch appended taken out.
|
|
2900
2966
|
const envelopeWords = stripLinkedIssues(stripRulesBrief(b.problem));
|
|
@@ -3093,6 +3159,14 @@ runtime = {}) {
|
|
|
3093
3159
|
input.skipQeAcceptanceReason = b.skipQeAcceptance.reason;
|
|
3094
3160
|
else if (settingSkip !== undefined)
|
|
3095
3161
|
input.skipQeAcceptanceReason = settingSkip;
|
|
3162
|
+
if (b.domainScope !== undefined) {
|
|
3163
|
+
// (J6 K1) The scope rides to the run's domain-run step through the engine (core writes it to the step's
|
|
3164
|
+
// private channel); an addon that would drop it is refused by name, before anything launches.
|
|
3165
|
+
if (!addonSupportsDomainScope()) {
|
|
3166
|
+
return reply.code(409).send({ code: 'engine_too_old', error: 'this engine cannot carry a domain model run\'s scope; upgrade wicked-crew so its pinned wicked-core-ts is used' });
|
|
3167
|
+
}
|
|
3168
|
+
input.domainScopeJson = domainScopeJsonOf(b.domainScope);
|
|
3169
|
+
}
|
|
3096
3170
|
if (b.forceQeAcceptance === true)
|
|
3097
3171
|
input.forceQeAcceptance = true;
|
|
3098
3172
|
let reviewChange;
|
|
@@ -3153,6 +3227,55 @@ runtime = {}) {
|
|
|
3153
3227
|
input.baseRef = ex.baseRef;
|
|
3154
3228
|
reviewChange = { target: ex.target, provenance: ex.provenance, runs: ex.runs, excluded, headSha: ex.headSha };
|
|
3155
3229
|
}
|
|
3230
|
+
// (DES-STANDIN-001 §4, K2a) THE STAND-IN CHOICE, before anything is written: the engine's preflight says which
|
|
3231
|
+
// independent roles this launch's roster is short of, on the shape it would take. Short with no consent → the 409
|
|
3232
|
+
// the launcher's caller draws as the choice; with consent (the person's `standIns`, or the `standInReview:
|
|
3233
|
+
// 'always'` setting) the run launches stand-in-aware and fills a short role with a labelled stand-in. A review
|
|
3234
|
+
// (review-change, the prepared reviews, run-evals), a demo and a reduced launch keep today's path (K2a scope).
|
|
3235
|
+
const standInEligible = b.reducedAssurance !== true && reviewChange === undefined
|
|
3236
|
+
&& !(b.workflow !== undefined && (reviewPrepared(b.workflow) || b.workflow === RUN_EVALS_WORKFLOW || DEMO_PRESETS.includes(b.workflow)));
|
|
3237
|
+
const standInsSupported = typeof adapter.supportsStandIns === 'function' && adapter.supportsStandIns();
|
|
3238
|
+
if (b.standIns === true && !standInEligible) {
|
|
3239
|
+
return reply.code(400).send({ code: 'stand_ins_refused', error: 'this launch does not take stand-ins (standIns): a review, a demo or a reduced launch keeps its own checks' });
|
|
3240
|
+
}
|
|
3241
|
+
if (b.standIns === true && !standInsSupported) {
|
|
3242
|
+
return reply.code(501).send({ error: 'stand-in checks need a wicked-core-ts that carries them (Core.independencePreflight and grantStandIns); upgrade the engine' });
|
|
3243
|
+
}
|
|
3244
|
+
// A draining daemon refuses the launch before it asks anything (the choice would only lead to the 503).
|
|
3245
|
+
if (typeof adapter.isDraining === 'function' && adapter.isDraining())
|
|
3246
|
+
return reply.code(503).send(maintenanceDrainBody(new MaintenanceDrainError()));
|
|
3247
|
+
if (standInEligible && standInsSupported) {
|
|
3248
|
+
const saved = await Promise.resolve().then(() => adapter.getSettings()).catch(() => undefined);
|
|
3249
|
+
const consent = consentFor(b.standIns === true, saved?.standInReview, `${req.actor.id} (${req.actor.kind})`, Date.now(), saved?.standInConsent);
|
|
3250
|
+
// The launcher that can show the choice asks the preflight with or without consent (codex r1 on b7-standin):
|
|
3251
|
+
// consent answers only the choice; a role no signed-in helper can stand in for is no_usable_helper either way.
|
|
3252
|
+
let preflight = null;
|
|
3253
|
+
if (ctx.standInChoice === true) {
|
|
3254
|
+
try {
|
|
3255
|
+
preflight = readPreflight(await adapter.independencePreflight(input));
|
|
3256
|
+
}
|
|
3257
|
+
catch (err) {
|
|
3258
|
+
// The engine refuses the shape as the launch would: the launch's own refusal, before anything is written.
|
|
3259
|
+
return reply.code(400).send({ error: `the launch was refused: ${message(err)}` });
|
|
3260
|
+
}
|
|
3261
|
+
// No helper signed in at all: the engine's own launch refusal (`no_eligible_seat`) names each benched seat, its
|
|
3262
|
+
// cause and the remedy; there is nothing a stand-in could stand in from.
|
|
3263
|
+
// (crew#1932) No plan and no workflow: the engine plans one unit with no review step (`resolve_launch_plan`'s
|
|
3264
|
+
// (None, None)), so the launch asks nothing; a check the work calls for still holds at the aware run's gate.
|
|
3265
|
+
const oneStep = input.plan === undefined && input.workflow === undefined && input.power !== true;
|
|
3266
|
+
const refusal = preflight === null || preflight.signedIn.length === 0 ? null : preflightRefusal(preflight, oneStep);
|
|
3267
|
+
if (refusal !== null && (consent === null || refusal.code === 'no_usable_helper'))
|
|
3268
|
+
return reply.code(409).send(refusal);
|
|
3269
|
+
}
|
|
3270
|
+
if (consent !== null) {
|
|
3271
|
+
input.standInAware = true;
|
|
3272
|
+
input.standIn = consent;
|
|
3273
|
+
}
|
|
3274
|
+
else if (preflight !== null) {
|
|
3275
|
+
// Not short: launched aware, so a seat lost mid-run holds at the stand-in gate instead of failing.
|
|
3276
|
+
input.standInAware = true;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3156
3279
|
// DES-L9 / crew#550 — REVISION: `revisesPr` names an OPEN same-repository pull request whose
|
|
3157
3280
|
// head branch becomes the run's base (`baseRef`, crew-internal → the engine's
|
|
3158
3281
|
// `LaunchSpec.base_ref`) and the push target of the composed deliver phase — the PR gains
|
|
@@ -3551,6 +3674,8 @@ runtime = {}) {
|
|
|
3551
3674
|
// DES-CATALOG-002 §4.4: the shape it was launched as, what it was launched with, and the proposal behind it.
|
|
3552
3675
|
...(b.shape !== undefined ? { shape: launchShapeOf(b.shape) } : {}),
|
|
3553
3676
|
...(ctx.fromProposal !== undefined ? { fromProposal: ctx.fromProposal } : {}),
|
|
3677
|
+
// crew#372: what a compose launched with (its requirements, level and steps), the only source publish trusts.
|
|
3678
|
+
...(ctx.target === 'compose' && ctx.compose !== undefined ? { compose: ctx.compose } : {}),
|
|
3554
3679
|
envelope: {
|
|
3555
3680
|
words: envelopeWords,
|
|
3556
3681
|
...(b.repoRef !== undefined ? { repoRef: b.repoRef } : {}),
|
|
@@ -3625,7 +3750,10 @@ runtime = {}) {
|
|
|
3625
3750
|
const skillsWarning = skillsAhead === null ? {} : { skillsWarning: { kind: skillsAhead.kind, severity: skillsAhead.severity, message: skillsAhead.message } };
|
|
3626
3751
|
// wicked-core#850: a full-assurance run on a one-CLI roster will wait at a gate for a seat that
|
|
3627
3752
|
// can evaluate or judge it; the answer names the explicit opt-in to relaunch with.
|
|
3628
|
-
|
|
3753
|
+
// (DES-STANDIN-001 §7.3) A stand-in-aware run asked its question before launching: no reduced-assurance offer.
|
|
3754
|
+
const notice = input.standInAware === true
|
|
3755
|
+
? null
|
|
3756
|
+
: launchAssuranceNotice({ runId, reducedAssurance: b.reducedAssurance, coverage: readJudgeCoverage(engineRosterJson(input.clisJson), input.repoRef !== undefined, runtime.judgeCoverage ?? CoreAdapter.judgeCoverage) });
|
|
3629
3757
|
const assuranceNotice = notice === null ? {} : { assuranceNotice: notice };
|
|
3630
3758
|
// (program DES-POWER-MODE) Whether the run is in power mode, and why not when it was wanted.
|
|
3631
3759
|
const power = { ...(input.power === true ? { power: true } : {}), ...(powerNotice !== null ? { powerNotice } : {}), ...(humanConfirmNotice !== null ? { humanConfirmNotice } : {}) };
|
|
@@ -3709,12 +3837,13 @@ runtime = {}) {
|
|
|
3709
3837
|
// wicked-core#461 — see the catch below); 400: zod reject or a retryOf naming no
|
|
3710
3838
|
// existing run; 422: the base-skill intake refusal (`base_skill_refused`, crew#554);
|
|
3711
3839
|
// 501: campaignId attach on an engine addon without the campaign bindings ("upgrade
|
|
3712
|
-
// the engine")
|
|
3713
|
-
|
|
3840
|
+
// the engine"); 403: `standIns` from a worker's bearer; 409 `stand_in_choice` / `no_usable_helper`: the
|
|
3841
|
+
// stand-in question (DES-STANDIN-001 §4).
|
|
3842
|
+
statusCodes: [201, 400, 403, 404, 409, 422, 501, 503],
|
|
3714
3843
|
},
|
|
3715
3844
|
},
|
|
3716
3845
|
}, async (req, reply) => {
|
|
3717
|
-
const launch = () => launchRun(req.body, { actor: actorOf(req), log: req.log });
|
|
3846
|
+
const launch = () => launchRun(req.body, { actor: actorOf(req), log: req.log, standInChoice: true });
|
|
3718
3847
|
const parsed = LaunchSchema.safeParse(req.body);
|
|
3719
3848
|
const out = parsed.success && parsed.data.chatId !== undefined
|
|
3720
3849
|
? await chatProposals.admitChat(parsed.data.chatId, launch)
|
|
@@ -3733,13 +3862,35 @@ runtime = {}) {
|
|
|
3733
3862
|
humanConfirm: z.string().min(1).optional(),
|
|
3734
3863
|
deliver: z.enum(['pr', 'none']).optional(),
|
|
3735
3864
|
deliverGate: z.enum(['human', 'auto']).optional(),
|
|
3865
|
+
domainScope: DomainScopeSchema.optional(),
|
|
3736
3866
|
}).refine((b) => b.plan === undefined || b.workflow === undefined, {
|
|
3737
3867
|
path: ['plan'],
|
|
3738
3868
|
error: 'plan and workflow are mutually exclusive',
|
|
3739
3869
|
}).refine((b) => b.deliverGate === undefined || b.deliver !== 'none', {
|
|
3740
3870
|
path: ['deliverGate'],
|
|
3741
3871
|
error: 'deliverGate has no meaning with deliver: "none" — there is no deliver phase to gate',
|
|
3872
|
+
}).refine((b) => b.domainScope === undefined || b.workflow === DOMAIN_EXTRACTION_WORKFLOW, {
|
|
3873
|
+
path: ['domainScope'],
|
|
3874
|
+
error: 'domainScope is the scope of a domain-extraction launch; this preview names another workflow',
|
|
3742
3875
|
});
|
|
3876
|
+
/** (J6 K1) The scope card of a domain-extraction preview with a repository, or why there is none. */
|
|
3877
|
+
const domainScopeCard = async (repoRef, scope) => {
|
|
3878
|
+
const repo = (await adapter.listRepos()).find((r) => r.id === repoRef);
|
|
3879
|
+
if (repo === undefined)
|
|
3880
|
+
return { error: `repository ${repoRef} is not registered` };
|
|
3881
|
+
// garden walks a missing folder as an empty tree, so a gone checkout would read as "nothing matched"
|
|
3882
|
+
const isDir = typeof repo.root_path === 'string' && repo.root_path !== '' && (await fsp.stat(repo.root_path).then((st) => st.isDirectory(), () => false));
|
|
3883
|
+
if (!isDir)
|
|
3884
|
+
return { error: `repository ${repoRef} has no checkout on this machine (its registered folder is missing)` };
|
|
3885
|
+
let db;
|
|
3886
|
+
try {
|
|
3887
|
+
db = codeGraphDb(repo);
|
|
3888
|
+
}
|
|
3889
|
+
catch (err) {
|
|
3890
|
+
return { error: message(err) };
|
|
3891
|
+
}
|
|
3892
|
+
return scopeCardFor({ root: repo.root_path, db, gardenRoot: gardenRootFor(process.env), scope });
|
|
3893
|
+
};
|
|
3743
3894
|
app.post(`${V}/runs/preview`, { config: { manifest: { requestType: 'LaunchPreviewBody', responseType: 'LaunchPreviewResponse', statusCodes: [200, 400] } } }, async (req, reply) => {
|
|
3744
3895
|
const parsed = LaunchPreviewSchema.safeParse(req.body ?? {});
|
|
3745
3896
|
if (!parsed.success)
|
|
@@ -3753,7 +3904,13 @@ runtime = {}) {
|
|
|
3753
3904
|
...(p.powerNotice !== null ? { powerNotice: p.powerNotice } : {}),
|
|
3754
3905
|
...(p.humanConfirmNotice !== null ? { humanConfirmNotice: p.humanConfirmNotice } : {}),
|
|
3755
3906
|
};
|
|
3756
|
-
|
|
3907
|
+
const scope = parsed.data.domainScope;
|
|
3908
|
+
if (scope === undefined)
|
|
3909
|
+
return { posture };
|
|
3910
|
+
const card = parsed.data.repoRef === undefined
|
|
3911
|
+
? { error: 'name the repository the model covers to see its scope' }
|
|
3912
|
+
: await domainScopeCard(parsed.data.repoRef, scope);
|
|
3913
|
+
return ('card' in card ? { posture, scopeCard: card.card } : { posture, scopeError: card.error });
|
|
3757
3914
|
});
|
|
3758
3915
|
/**
|
|
3759
3916
|
* (operator ruling 2026-11-06) Why a chat job can't run as a power run on this daemon now, else `null`: only a
|
|
@@ -3837,10 +3994,19 @@ runtime = {}) {
|
|
|
3837
3994
|
if (p.launch === 'run' || p.launch === undefined) {
|
|
3838
3995
|
if (resolved.workflow === null)
|
|
3839
3996
|
throw new Error(`${p.what.label} has no workflow to run`);
|
|
3997
|
+
// (J6 K1, coord R2 F1) A domain model job started from a chat maps what the person's words say it covers.
|
|
3998
|
+
let domainScope;
|
|
3999
|
+
if (resolved.workflow === DOMAIN_EXTRACTION_WORKFLOW) {
|
|
4000
|
+
const s = domainScopeOfWords(words, 'say it in this chat, then press Start again');
|
|
4001
|
+
if ('refusal' in s)
|
|
4002
|
+
throw new Error(s.refusal);
|
|
4003
|
+
domainScope = s.scope;
|
|
4004
|
+
}
|
|
3840
4005
|
const lines = inputLines(p);
|
|
3841
4006
|
const out = await launchRun({
|
|
3842
4007
|
problem: [words === '' ? p.what.label : words, ...(lines.length > 0 ? [`Inputs:\n${lines.map((l) => `- ${l}`).join('\n')}`] : [])].join('\n\n'),
|
|
3843
4008
|
workflow: resolved.workflow,
|
|
4009
|
+
...(domainScope !== undefined ? { domainScope } : {}),
|
|
3844
4010
|
...(p.repoRefs?.[0] !== undefined ? { repoRef: p.repoRefs[0] } : {}),
|
|
3845
4011
|
...(projectId !== null && projectId !== DEFAULT_PROJECT_ID ? { projectId } : {}),
|
|
3846
4012
|
...common,
|
|
@@ -4562,6 +4728,8 @@ runtime = {}) {
|
|
|
4562
4728
|
const chatAccepts = new Map();
|
|
4563
4729
|
/** (crew-0182) Chats whose client draws onboard cards (`accepts: ['onboard']`), by its newest declaration. */
|
|
4564
4730
|
const chatAcceptsOnboard = new Map();
|
|
4731
|
+
/** (studio#1140 (a)) Chats whose client draws cut cards (`accepts: ['cut']`), by its newest declaration. */
|
|
4732
|
+
const chatAcceptsCut = new Map();
|
|
4565
4733
|
/** (crew-0182) What a chat seat is told exists here: every project with its repositories, every registered repository. */
|
|
4566
4734
|
const readDaemonGrounding = async (chatId, accepts) => {
|
|
4567
4735
|
try {
|
|
@@ -4809,6 +4977,7 @@ runtime = {}) {
|
|
|
4809
4977
|
// A refused open (409 above) never touched the live chat's (codex r3).
|
|
4810
4978
|
chatAccepts.set(chatId, openAccepts);
|
|
4811
4979
|
chatAcceptsOnboard.set(chatId, b.accepts?.includes('onboard') === true);
|
|
4980
|
+
chatAcceptsCut.set(chatId, b.accepts?.includes('cut') === true);
|
|
4812
4981
|
// DC-S7: the in-force rules the statement lists; recorded as "told" only once the open succeeds.
|
|
4813
4982
|
let inForceAtOpen = [];
|
|
4814
4983
|
// Everything below either ends in `chatScopes.set(chatId, …, token)` or releases the reservation.
|
|
@@ -5090,7 +5259,7 @@ runtime = {}) {
|
|
|
5090
5259
|
/** (api-types 0.169.0, DES-CHAT-ARTIFACTS-001 §5.1) What studio shows beside the message. */
|
|
5091
5260
|
context: ChatMessageContextSchema.optional(),
|
|
5092
5261
|
/** (api-types 0.192.0, DES-CATALOG-002 §4.6) What the client renders (`['job']`): the newest declaration wins. */
|
|
5093
|
-
accepts: z.array(z.enum(['job', 'onboard'])).max(4).optional(),
|
|
5262
|
+
accepts: z.array(z.enum(['job', 'onboard', 'cut'])).max(4).optional(),
|
|
5094
5263
|
});
|
|
5095
5264
|
// DES-CHAT-ARTIFACTS-001 §5.1 (A1): what a turn's block reads — the docs roots, the decorated runs (project,
|
|
5096
5265
|
// document and chat ids), unit outputs and the acceptance line. One set of deps, so the block and the run pages
|
|
@@ -5104,6 +5273,7 @@ runtime = {}) {
|
|
|
5104
5273
|
const g = readGroundingBeneath(root, doc);
|
|
5105
5274
|
return g !== null && 'style' in g ? g.style : undefined;
|
|
5106
5275
|
},
|
|
5276
|
+
cutBridge: (projectId) => cutBridgeFor(projectId),
|
|
5107
5277
|
};
|
|
5108
5278
|
// DES-CHAT-ARTIFACTS-001 §4 (A2): proposals. Resolved from crew's own records (the same reads the turn block uses);
|
|
5109
5279
|
// records go to the live transcript, or the kept history copy once the chat has ended.
|
|
@@ -5335,6 +5505,8 @@ runtime = {}) {
|
|
|
5335
5505
|
},
|
|
5336
5506
|
acceptsJobs: (chatId) => chatAccepts.get(chatId) === true,
|
|
5337
5507
|
acceptsOnboard: (chatId) => chatAcceptsOnboard.get(chatId) === true,
|
|
5508
|
+
acceptsCut: (chatId) => chatArtifactFlags.cut === true && chatAcceptsCut.get(chatId) === true,
|
|
5509
|
+
cut: { bridgeFor: (projectId) => cutBridgeFor(projectId) },
|
|
5338
5510
|
onboard: {
|
|
5339
5511
|
...onboardReads,
|
|
5340
5512
|
originOf,
|
|
@@ -5469,6 +5641,7 @@ runtime = {}) {
|
|
|
5469
5641
|
if (parsed.data.accepts !== undefined) {
|
|
5470
5642
|
chatAccepts.set(id, parsed.data.accepts.includes('job'));
|
|
5471
5643
|
chatAcceptsOnboard.set(id, parsed.data.accepts.includes('onboard'));
|
|
5644
|
+
chatAcceptsCut.set(id, parsed.data.accepts.includes('cut'));
|
|
5472
5645
|
}
|
|
5473
5646
|
after();
|
|
5474
5647
|
if (preface !== null)
|
|
@@ -5583,7 +5756,7 @@ runtime = {}) {
|
|
|
5583
5756
|
// A7: a seat is told it can propose a studio theme only when this message carried the tab's appearance (a client
|
|
5584
5757
|
// that can preview and apply one sends it).
|
|
5585
5758
|
// crew-0182: this message's own onboard declaration (the chat's stored one changes once the message is accepted).
|
|
5586
|
-
const themeClient = { appearance: msgContext?.appearance !== undefined, onboard: parsed.data.accepts !== undefined ? parsed.data.accepts.includes('onboard') : chatAcceptsOnboard.get(id) === true };
|
|
5759
|
+
const themeClient = { appearance: msgContext?.appearance !== undefined, onboard: parsed.data.accepts !== undefined ? parsed.data.accepts.includes('onboard') : chatAcceptsOnboard.get(id) === true, cut: parsed.data.accepts !== undefined ? parsed.data.accepts.includes('cut') : chatAcceptsCut.get(id) === true };
|
|
5587
5760
|
// DES-CATALOG-002 §2.3, §4.6: the per-message job lines (the chat catalog digest, the open proposal, the held plan),
|
|
5588
5761
|
// read here, before the last check (no await after it). Never in an analysis.
|
|
5589
5762
|
// The declaration this message's instructions are written for: its own, else the chat's (applied to the chat only
|
|
@@ -5605,6 +5778,8 @@ runtime = {}) {
|
|
|
5605
5778
|
context: msgContext,
|
|
5606
5779
|
records: chatTranscripts?.read(id) ?? [],
|
|
5607
5780
|
attachmentIds: chatAttachments.list(id).map((a) => a.id),
|
|
5781
|
+
// This message's own declaration, else the chat's (the reply to this turn is resolved the same way).
|
|
5782
|
+
acceptsCut: chatArtifactFlags.cut === true && (parsed.data.accepts !== undefined ? parsed.data.accepts.includes('cut') : chatAcceptsCut.get(id) === true),
|
|
5608
5783
|
}, chatContextDeps);
|
|
5609
5784
|
contextBlock = built.block;
|
|
5610
5785
|
turnBinding = built.binding;
|
|
@@ -5726,6 +5901,11 @@ runtime = {}) {
|
|
|
5726
5901
|
],
|
|
5727
5902
|
}
|
|
5728
5903
|
: {}),
|
|
5904
|
+
// wicked-core#1463: an "All repos" chat reads every registered repository; a unit whose
|
|
5905
|
+
// repositories pass the container copy-in's cap leaves out those that do not fit (each
|
|
5906
|
+
// with a note in its place) instead of failing every turn. A repo or project scope names
|
|
5907
|
+
// what the person asked about, so its repositories stay required.
|
|
5908
|
+
...(scope?.kind === 'everything' && readRoots.length > 0 ? { optionalReadRoots: [...readRoots] } : {}),
|
|
5729
5909
|
};
|
|
5730
5910
|
const runId = await adapter.launchRun(input);
|
|
5731
5911
|
// The scope's roots (not the attachments directory) are what a later turn compares against.
|
|
@@ -6668,6 +6848,12 @@ runtime = {}) {
|
|
|
6668
6848
|
...(refusal !== undefined ? { refusal } : {}),
|
|
6669
6849
|
...(gateKind !== undefined ? { gateKind } : {}),
|
|
6670
6850
|
...(frame !== undefined ? offeredChoices(frame) : {}),
|
|
6851
|
+
// (crew#1698) The opening the record shows: the row's `gate_seq` only, the one an answer is checked
|
|
6852
|
+
// against (a frame's beside an unnumbered row would be an opening no answer could name).
|
|
6853
|
+
...(() => {
|
|
6854
|
+
const seq = gateSeqOf(durableGate['gate_seq']);
|
|
6855
|
+
return seq !== undefined ? { gateSeq: seq } : {};
|
|
6856
|
+
})(),
|
|
6671
6857
|
};
|
|
6672
6858
|
}
|
|
6673
6859
|
const events = await adapter.runEvents(id);
|
|
@@ -6717,7 +6903,7 @@ runtime = {}) {
|
|
|
6717
6903
|
* cursor unit) — an engine, or a run, older than the table.
|
|
6718
6904
|
*/
|
|
6719
6905
|
async function gateForDecision(run, namedOrd, opts = {}) {
|
|
6720
|
-
const decided = await gateOfRecord(run, namedOrd);
|
|
6906
|
+
const decided = await gateOfRecord(run, namedOrd, opts.gateSeq);
|
|
6721
6907
|
// DES-CATALOG-002 §4.6 (codex r1): a plan held for a run launched from a chat proposal is approved only by an
|
|
6722
6908
|
// answer bound to its version (`POST /runs/:id/gate` with `planRev`); every other approving path (a gated resume or
|
|
6723
6909
|
// reassign, a plan edit at the gate, a standing order) is refused there. Declining stays open.
|
|
@@ -6739,7 +6925,7 @@ runtime = {}) {
|
|
|
6739
6925
|
}
|
|
6740
6926
|
return decided;
|
|
6741
6927
|
}
|
|
6742
|
-
async function gateOfRecord(run, namedOrd) {
|
|
6928
|
+
async function gateOfRecord(run, namedOrd, namedSeq) {
|
|
6743
6929
|
const id = run.session.id;
|
|
6744
6930
|
const unitAt = (ord) => (run.units ?? []).find((u) => u.ord === ord);
|
|
6745
6931
|
const unknown = (why) => ({ refusal: { code: 409, body: { error: `Gate unknown: ${why} — refresh and decide again.`, code: 'gate_unknown' } } });
|
|
@@ -6757,15 +6943,38 @@ runtime = {}) {
|
|
|
6757
6943
|
} } };
|
|
6758
6944
|
}
|
|
6759
6945
|
const kind = recorded.row['gate_kind'];
|
|
6760
|
-
|
|
6946
|
+
// (core#1808) Which opening of the gate the record shows: a `use_stand_ins` answer names it to the engine.
|
|
6947
|
+
const seq = recorded.row['gate_seq'];
|
|
6948
|
+
const openSeq = typeof seq === 'number' && Number.isInteger(seq) && seq > 0 ? seq : undefined;
|
|
6949
|
+
// (crew#1698) An answer naming another opening of this gate (closed and re-opened since, same ord too).
|
|
6950
|
+
if (namedSeq !== undefined && namedSeq !== openSeq) {
|
|
6951
|
+
return openSeq === undefined
|
|
6952
|
+
? unknown(`this decision names opening ${namedSeq} of the gate before unit ${recorded.ord}, but the engine's record does not number its openings`)
|
|
6953
|
+
: { refusal: { code: 409, body: {
|
|
6954
|
+
error: `Gate changed: this decision was made on an earlier opening of the gate before unit ${recorded.ord} (opening ${namedSeq}; open now: ${openSeq}). Read the open gate before deciding.`,
|
|
6955
|
+
code: 'gate_changed',
|
|
6956
|
+
openOrd: recorded.ord,
|
|
6957
|
+
openGateSeq: openSeq,
|
|
6958
|
+
} } };
|
|
6959
|
+
}
|
|
6960
|
+
return {
|
|
6961
|
+
ord: recorded.ord,
|
|
6962
|
+
gated: unitAt(recorded.ord),
|
|
6963
|
+
prompt: recorded.row.prompt,
|
|
6964
|
+
gateKind: typeof kind === 'string' && kind !== '' ? kind : undefined,
|
|
6965
|
+
...(openSeq !== undefined ? { gateSeq: openSeq } : {}),
|
|
6966
|
+
};
|
|
6761
6967
|
}
|
|
6762
|
-
if (namedOrd !== undefined) {
|
|
6763
|
-
return unknown(`this decision names the gate before unit ${namedOrd}, but the engine's record `
|
|
6968
|
+
if (namedOrd !== undefined || namedSeq !== undefined) {
|
|
6969
|
+
return unknown(`this decision names the gate${namedOrd !== undefined ? ` before unit ${namedOrd}` : ` opening ${namedSeq ?? ''}`}, but the engine's record `
|
|
6764
6970
|
+ `${recorded === null ? 'keeps no durable gate row' : 'shows no open gate'} for this run, so the daemon cannot confirm the named one`);
|
|
6765
6971
|
}
|
|
6766
6972
|
const open = await resolveOpenGate(id).catch(() => null);
|
|
6767
|
-
if (isOpenGate(open))
|
|
6973
|
+
if (isOpenGate(open)) {
|
|
6974
|
+
// (crew#1698, codex delta) No open durable row: no opening is bound (only a row the addon wrote numbers one, and
|
|
6975
|
+
// only an addon that writes `gate_seq` takes the expectation), whatever a cached or logged frame says.
|
|
6768
6976
|
return { ord: open.ord, gated: unitAt(open.ord), prompt: open.prompt, gateKind: open.gateKind };
|
|
6977
|
+
}
|
|
6769
6978
|
const gated = [...(run.units ?? [])].sort((a, b) => a.ord - b.ord)[run.session.unit_ix];
|
|
6770
6979
|
return { ord: undefined, gated, prompt: undefined, gateKind: undefined };
|
|
6771
6980
|
}
|
|
@@ -6890,6 +7099,17 @@ runtime = {}) {
|
|
|
6890
7099
|
},
|
|
6891
7100
|
};
|
|
6892
7101
|
}
|
|
7102
|
+
// (DES-STANDIN-001 §3.8) Consent to stand-ins is a person's: a seat's token or a standing order is refused.
|
|
7103
|
+
if (parsed.data.action === USE_STAND_INS_ACTION && !isHumanOperator(actor)) {
|
|
7104
|
+
audit.record('gate.stand_ins_refused', actor, {
|
|
7105
|
+
runId: id,
|
|
7106
|
+
detail: { reason: 'human_operator_only', ...(parsed.data.ord !== undefined ? { ord: parsed.data.ord } : {}) },
|
|
7107
|
+
});
|
|
7108
|
+
return {
|
|
7109
|
+
code: 403,
|
|
7110
|
+
body: { error: `only a person can consent to stand-in checks (you are ${actor.kind}/${actor.trust})`, code: 'human_operator_only' },
|
|
7111
|
+
};
|
|
7112
|
+
}
|
|
6893
7113
|
if (parsed.data.action === SKIP_QE_ACTION && !isHumanOperator(actor)) {
|
|
6894
7114
|
audit.record('gate.skip_qe_refused', actor, {
|
|
6895
7115
|
runId: id,
|
|
@@ -6913,11 +7133,14 @@ runtime = {}) {
|
|
|
6913
7133
|
// Decision integrity (api-types 0.44.0; crew#1083 rounds 3–5): the gate this decision answers
|
|
6914
7134
|
// is the RECORD's — read first thing inside the lock, so the gated unit and its delivery
|
|
6915
7135
|
// checks below are the ones the record confirms ({@link gateForDecision}).
|
|
6916
|
-
const decided = await gateForDecision(run, parsed.data.ord, { declining: !parsed.data.approve, versioned: true });
|
|
7136
|
+
const decided = await gateForDecision(run, parsed.data.ord, { declining: !parsed.data.approve, versioned: true, ...(parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) });
|
|
6917
7137
|
if ('refusal' in decided) {
|
|
6918
7138
|
const r = decided.refusal.body;
|
|
6919
7139
|
return r?.code === 'gate_changed' ? { code: decided.refusal.code, body: { ...(await currentPlanOf(id, false)), ...r } } : decided.refusal;
|
|
6920
7140
|
}
|
|
7141
|
+
if (parsed.data.action === USE_STAND_INS_ACTION) {
|
|
7142
|
+
return useStandInsAtGate(id, decided, parsed.data.scope ?? 'job', actor, parsed.data.input, extraDetail);
|
|
7143
|
+
}
|
|
6921
7144
|
// (wicked-core#1683) A noted Land that skips open steering rules is the same human-only
|
|
6922
7145
|
// decision as skip_rules. Read its rules under the decision lock and keep them for the audit.
|
|
6923
7146
|
const landNote = parsed.data.amend?.trim() ?? '';
|
|
@@ -7015,8 +7238,8 @@ runtime = {}) {
|
|
|
7015
7238
|
// gate ("judged by operator").
|
|
7016
7239
|
adapter.recordGateActor?.(id, `${actor.id} (${actor.kind})`);
|
|
7017
7240
|
const expect = parsed.data.planRev !== undefined
|
|
7018
|
-
? { ...expectFor(decided.ord), planRev: parsed.data.planRev }
|
|
7019
|
-
: expectFor(decided.ord);
|
|
7241
|
+
? { ...expectFor(decided.ord, decided.gateSeq), planRev: parsed.data.planRev }
|
|
7242
|
+
: expectFor(decided.ord, decided.gateSeq);
|
|
7020
7243
|
const confirmArgs = [
|
|
7021
7244
|
id,
|
|
7022
7245
|
parsed.data.approve,
|
|
@@ -7119,13 +7342,82 @@ runtime = {}) {
|
|
|
7119
7342
|
}
|
|
7120
7343
|
});
|
|
7121
7344
|
}
|
|
7345
|
+
/**
|
|
7346
|
+
* (DES-STANDIN-001 §3.10, crew#1856) `{approve: true, action: 'use_stand_ins', scope}` at a `stand_in_needed` gate:
|
|
7347
|
+
* the engine's `grantStandIns` with the open gate's opening (`gateSeq`, from the record) and the person as `actor`,
|
|
7348
|
+
* so a gate that closed and re-opened since is refused `gate_changed`. `always` also saves `standInReview:
|
|
7349
|
+
* 'always'` (after the grant took: a refused grant changes nothing). Runs inside {@link decideExclusively}.
|
|
7350
|
+
*/
|
|
7351
|
+
async function useStandInsAtGate(id, decided, scope, actor, input, extraDetail) {
|
|
7352
|
+
if (decided.gateKind !== STAND_IN_NEEDED_GATE) {
|
|
7353
|
+
return { code: 409, body: {
|
|
7354
|
+
code: 'gate_changed',
|
|
7355
|
+
error: `Gate changed: use_stand_ins answers a stand-in gate (stand_in_needed), but the open gate is ${decided.gateKind ?? 'not one'}. Read the gate again.`,
|
|
7356
|
+
...(decided.ord !== undefined ? { openOrd: decided.ord } : {}),
|
|
7357
|
+
} };
|
|
7358
|
+
}
|
|
7359
|
+
if (decided.gateSeq === undefined) {
|
|
7360
|
+
return { code: 409, body: { code: 'gate_unknown', error: 'Gate unknown: the engine\'s record does not say which opening of this gate is open, so stand-ins cannot be granted for it — refresh and decide again.' } };
|
|
7361
|
+
}
|
|
7362
|
+
if (typeof adapter.grantStandIns !== 'function' || typeof adapter.supportsStandIns !== 'function' || !adapter.supportsStandIns()) {
|
|
7363
|
+
return { code: 501, body: { error: 'Using stand-ins at a gate needs a wicked-core-ts with Core.grantStandIns; upgrade the engine' } };
|
|
7364
|
+
}
|
|
7365
|
+
const who = `${actor.id} (${actor.kind})`;
|
|
7366
|
+
let status;
|
|
7367
|
+
try {
|
|
7368
|
+
status = await adapter.grantStandIns(id, scope, decided.gateSeq, who, decided.ord);
|
|
7369
|
+
}
|
|
7370
|
+
catch (err) {
|
|
7371
|
+
if (err instanceof MaintenanceDrainError)
|
|
7372
|
+
return { code: 503, body: maintenanceDrainBody(err) };
|
|
7373
|
+
const changed = await gateChangedRefusal(id, err);
|
|
7374
|
+
if (changed !== null)
|
|
7375
|
+
return changed;
|
|
7376
|
+
return { code: 409, body: { error: message(err) } };
|
|
7377
|
+
}
|
|
7378
|
+
let setting;
|
|
7379
|
+
if (scope === 'always') {
|
|
7380
|
+
try {
|
|
7381
|
+
// The person who answered every job is the setting's author (wicked-core#1930 F6).
|
|
7382
|
+
await adapter.updateSettings({ standInReview: 'always', standInConsent: settingConsent(who) });
|
|
7383
|
+
audit.record('settings.updated', actor, { detail: { changed: ['standInReview'], via: 'gate', runId: id } });
|
|
7384
|
+
setting = 'saved';
|
|
7385
|
+
}
|
|
7386
|
+
catch (err) {
|
|
7387
|
+
// The grant took (this run goes on with stand-ins); only the standing choice failed to save, and the answer says so.
|
|
7388
|
+
setting = 'failed';
|
|
7389
|
+
audit.record('settings.update_failed', actor, { detail: { key: 'standInReview', via: 'gate', runId: id, error: message(err) } });
|
|
7390
|
+
}
|
|
7391
|
+
}
|
|
7392
|
+
audit.record('gate.decided', actor, {
|
|
7393
|
+
runId: id,
|
|
7394
|
+
detail: {
|
|
7395
|
+
approve: true,
|
|
7396
|
+
choice: USE_STAND_INS_ACTION,
|
|
7397
|
+
action: USE_STAND_INS_ACTION,
|
|
7398
|
+
scope,
|
|
7399
|
+
gateSeq: decided.gateSeq,
|
|
7400
|
+
...(decided.ord !== undefined ? { ord: decided.ord } : {}),
|
|
7401
|
+
...(input !== undefined ? { input } : {}),
|
|
7402
|
+
...extraDetail,
|
|
7403
|
+
status,
|
|
7404
|
+
},
|
|
7405
|
+
});
|
|
7406
|
+
return { code: 200, body: { status, ...(setting !== undefined ? { standInReview: setting } : {}) } };
|
|
7407
|
+
}
|
|
7122
7408
|
/** (DES-CATALOG-002 §4.6) The plan a gate holds now, for a `gate_changed` answer: its ord and revision, best-effort. */
|
|
7123
7409
|
async function currentPlanOf(runId, readGate = true) {
|
|
7124
7410
|
try {
|
|
7125
7411
|
// The caller that already read the open gate (and names its ord) asks for the plan revision only.
|
|
7126
7412
|
const recorded = readGate ? await recordedOpenGate(runId) : null;
|
|
7127
7413
|
const rev = openPlanGateRev(await busRows(adapter.busDbPath, runId));
|
|
7128
|
-
|
|
7414
|
+
// (crew#1698) …and the opening open now, as the daemon's own gate_changed says it.
|
|
7415
|
+
const openSeq = recorded?.state === 'open' ? gateSeqOf(recorded.row['gate_seq']) : undefined;
|
|
7416
|
+
return {
|
|
7417
|
+
...(recorded?.state === 'open' ? { openOrd: recorded.ord } : {}),
|
|
7418
|
+
...(openSeq !== undefined ? { openGateSeq: openSeq } : {}),
|
|
7419
|
+
...(rev !== undefined ? { planRev: rev } : {}),
|
|
7420
|
+
};
|
|
7129
7421
|
}
|
|
7130
7422
|
catch {
|
|
7131
7423
|
return {};
|
|
@@ -7135,8 +7427,12 @@ runtime = {}) {
|
|
|
7135
7427
|
function adapterSupportsPlanSendBack() {
|
|
7136
7428
|
return typeof adapter.supportsPlanSendBack === 'function' && adapter.supportsPlanSendBack();
|
|
7137
7429
|
}
|
|
7138
|
-
|
|
7139
|
-
|
|
7430
|
+
/** What a confirm expects the open gate to be: its ord and (crew#1698, core#1808) the opening the record showed, which
|
|
7431
|
+
* the engine compares inside its serialized decision, so a gate that re-opened after this read still loses. */
|
|
7432
|
+
function expectFor(decidedOrd, gateSeq) {
|
|
7433
|
+
return decidedOrd !== undefined && adapterSupportsPlanSendBack()
|
|
7434
|
+
? { ord: decidedOrd, ...(gateSeq !== undefined ? { gateSeq } : {}) }
|
|
7435
|
+
: undefined;
|
|
7140
7436
|
}
|
|
7141
7437
|
async function gateChangedRefusal(id, err) {
|
|
7142
7438
|
if (!/^gate_changed\b/u.test(message(err)))
|
|
@@ -7332,13 +7628,21 @@ runtime = {}) {
|
|
|
7332
7628
|
}
|
|
7333
7629
|
try {
|
|
7334
7630
|
const gated = run.session.status === 'awaiting_human';
|
|
7631
|
+
// (crew#1698, codex r1 on b7-standin) A resume naming a gate OPENING answers that gate: once it has closed,
|
|
7632
|
+
// nothing is resumed on its word.
|
|
7633
|
+
if (!gated && parsed.data.gateSeq !== undefined) {
|
|
7634
|
+
return reply.code(409).send({
|
|
7635
|
+
code: 'gate_changed',
|
|
7636
|
+
error: `Gate changed: this decision was made on opening ${parsed.data.gateSeq} of a gate, but run ${id} is ${run.session.status}, not parked at a gate — it was answered. Nothing was resumed.`,
|
|
7637
|
+
});
|
|
7638
|
+
}
|
|
7335
7639
|
// A gated resume IS a gate approval, so it lands a steering-author proposal exactly like
|
|
7336
7640
|
// POST /runs/:id/gate would — the "no side door" rule (task #88) holds for the landing
|
|
7337
7641
|
// write too (crew#388). Prompt captured pre-confirm; see the gate route.
|
|
7338
7642
|
// A gated resume IS an approve, so it is judged by the record like every decision, passes the
|
|
7339
7643
|
// same delivery checks (freeze, EX-03) — no side door around the deliver gate — and answers
|
|
7340
7644
|
// with the gated unit's receipt.
|
|
7341
|
-
const decided = gated ? await gateForDecision(run, parsed.data.ord) : undefined;
|
|
7645
|
+
const decided = gated ? await gateForDecision(run, parsed.data.ord, parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) : undefined;
|
|
7342
7646
|
if (decided !== undefined && 'refusal' in decided)
|
|
7343
7647
|
return reply.code(decided.refusal.code).send(decided.refusal.body);
|
|
7344
7648
|
const steeringPropose = gated && isSteeringAuthorRun(run);
|
|
@@ -7355,7 +7659,7 @@ runtime = {}) {
|
|
|
7355
7659
|
const who = actorOf(req);
|
|
7356
7660
|
adapter.recordGateActor?.(id, `${who.id} (${who.kind})`);
|
|
7357
7661
|
}
|
|
7358
|
-
const status = gated ? await adapter.confirmGate(id, true, undefined, undefined, undefined, undefined, expectFor(decided?.ord)) : await adapter.resumeRun(id);
|
|
7662
|
+
const status = gated ? await adapter.confirmGate(id, true, undefined, undefined, undefined, undefined, expectFor(decided?.ord, decided !== undefined && !('refusal' in decided) ? decided.gateSeq : undefined)) : await adapter.resumeRun(id);
|
|
7359
7663
|
// A resume of a gated run IS a gate approval — audit it as one, so the
|
|
7360
7664
|
// "who approved" trail has no side door (task #88).
|
|
7361
7665
|
audit.record(gated ? 'gate.decided' : 'run.resumed', actorOf(req), {
|
|
@@ -7442,6 +7746,23 @@ runtime = {}) {
|
|
|
7442
7746
|
return false;
|
|
7443
7747
|
}
|
|
7444
7748
|
}
|
|
7749
|
+
/** (J6 K1) Whether `workflow` names a preset whose every step runs as a host tool (`executor.type: "tool"`), so it
|
|
7750
|
+
* has no agent session to lead in power mode. A read that fails answers `false`. Hoisted. */
|
|
7751
|
+
async function presetIsToolOnly(workflow, projectId) {
|
|
7752
|
+
if (typeof adapter.listPresets !== 'function')
|
|
7753
|
+
return false;
|
|
7754
|
+
try {
|
|
7755
|
+
const preset = (await adapter.listPresets(projectId)).find((p) => p.name === workflow);
|
|
7756
|
+
const steps = preset?.steps ?? [];
|
|
7757
|
+
return steps.length > 0 && steps.every((s) => {
|
|
7758
|
+
const ex = s['executor'];
|
|
7759
|
+
return typeof ex === 'object' && ex !== null && ex.type === 'tool';
|
|
7760
|
+
});
|
|
7761
|
+
}
|
|
7762
|
+
catch {
|
|
7763
|
+
return false;
|
|
7764
|
+
}
|
|
7765
|
+
}
|
|
7445
7766
|
/** The linked engine runs power mode (an adapter double without the method does not). Hoisted. */
|
|
7446
7767
|
function powerSupported() {
|
|
7447
7768
|
return typeof adapter.supportsPowerMode === 'function' && adapter.supportsPowerMode();
|
|
@@ -7455,6 +7776,7 @@ runtime = {}) {
|
|
|
7455
7776
|
powerModeDefault: async () => (await adapter.getSettings()).powerModeDefault ?? true,
|
|
7456
7777
|
namesPreset,
|
|
7457
7778
|
powerSupported,
|
|
7779
|
+
toolOnly: presetIsToolOnly,
|
|
7458
7780
|
// The delivery contract (crew#393): a completed code run must end with a reviewable
|
|
7459
7781
|
// deliverable, or an explicit, recorded decision not to. So the deliver option is resolved
|
|
7460
7782
|
// HERE, at the boundary, for every launch:
|
|
@@ -7709,7 +8031,8 @@ runtime = {}) {
|
|
|
7709
8031
|
return actions
|
|
7710
8032
|
.filter((a) => declines(a) || !(a.action === SKIP_QE_ACTION ? skipRefused : approveRefused))
|
|
7711
8033
|
.filter((a) => !(steering && a.action === 'reassign'))
|
|
7712
|
-
.map((a) => (a.action === SKIP_QE_ACTION || a.action === SKIP_RULES_ACTION ||
|
|
8034
|
+
.map((a) => (a.action === SKIP_QE_ACTION || a.action === SKIP_RULES_ACTION || a.action === USE_STAND_INS_ACTION
|
|
8035
|
+
|| (a.action === 'approve' && a.noteIntent === 'skip_rules')
|
|
7713
8036
|
? { ...a, humanOnly: true } : a));
|
|
7714
8037
|
}
|
|
7715
8038
|
/**
|
|
@@ -7798,6 +8121,14 @@ runtime = {}) {
|
|
|
7798
8121
|
error: `run ${id} is executing, not parked at a gate — a note rides only a gated reassign (it is the approve's amendment). Nothing was reassigned.`,
|
|
7799
8122
|
});
|
|
7800
8123
|
}
|
|
8124
|
+
// (crew#1698, codex r1 on b7-standin) An answer naming a gate OPENING was made on a gate: once that gate has
|
|
8125
|
+
// closed (another decision released it before this one got the lock), it changes no running work.
|
|
8126
|
+
if (!gated && parsed.data.gateSeq !== undefined) {
|
|
8127
|
+
return reply.code(409).send({
|
|
8128
|
+
code: 'gate_changed',
|
|
8129
|
+
error: `Gate changed: this decision was made on opening ${parsed.data.gateSeq} of a gate, but run ${id} is ${run.session.status}, not parked at a gate — it was answered. Nothing was reassigned.`,
|
|
8130
|
+
});
|
|
8131
|
+
}
|
|
7801
8132
|
const requestedCli = parsed.data.cli;
|
|
7802
8133
|
if (requestedCli !== undefined) {
|
|
7803
8134
|
const pool = Array.isArray(run.session.clis) ? run.session.clis : [];
|
|
@@ -7810,7 +8141,7 @@ runtime = {}) {
|
|
|
7810
8141
|
// A gated reassign APPROVES the gate, so it is judged by the record like every decision and passes
|
|
7811
8142
|
// the same delivery checks (freeze, wicked-core#850 EX-03) when the gate holds the deliver unit
|
|
7812
8143
|
// (codex r1 on the EX-03 PR).
|
|
7813
|
-
const decided = gated ? await gateForDecision(run, parsed.data.ord) : undefined;
|
|
8144
|
+
const decided = gated ? await gateForDecision(run, parsed.data.ord, parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) : undefined;
|
|
7814
8145
|
if (decided !== undefined && 'refusal' in decided)
|
|
7815
8146
|
return reply.code(decided.refusal.code).send(decided.refusal.body);
|
|
7816
8147
|
if (decided !== undefined) {
|
|
@@ -7858,7 +8189,7 @@ runtime = {}) {
|
|
|
7858
8189
|
return; // refused above for a gated run
|
|
7859
8190
|
const who = actorOf(req);
|
|
7860
8191
|
adapter.recordGateActor?.(id, `${who.id} (${who.kind})`);
|
|
7861
|
-
const status = await adapter.confirmGate(id, true, note, undefined, undefined, undefined, expectFor(decided?.ord));
|
|
8192
|
+
const status = await adapter.confirmGate(id, true, note, undefined, undefined, undefined, expectFor(decided?.ord, decided !== undefined && !('refusal' in decided) ? decided.gateSeq : undefined));
|
|
7862
8193
|
noteRode = note !== undefined;
|
|
7863
8194
|
audit.record('gate.decided', actorOf(req), {
|
|
7864
8195
|
runId: id,
|
|
@@ -8059,13 +8390,21 @@ runtime = {}) {
|
|
|
8059
8390
|
if (cached) {
|
|
8060
8391
|
const run = await runOf();
|
|
8061
8392
|
const servable = recorded === null
|
|
8062
|
-
|
|
8393
|
+
// (crew#1698) …and of the record's opening, when the row numbers it: a gate that re-opened at the
|
|
8394
|
+
// same ord while the pump was behind is not the cached one.
|
|
8395
|
+
|| (recorded.state === 'open' && cached.ord === recorded.ord
|
|
8396
|
+
&& (gateSeqOf(recorded.row['gate_seq']) === undefined || cached.gateSeq === gateSeqOf(recorded.row['gate_seq'])))
|
|
8063
8397
|
|| (recorded.state === 'none' && run?.session.status === 'awaiting_human');
|
|
8064
8398
|
if (servable) {
|
|
8065
8399
|
const offers = await offersAt(cached.ord, run);
|
|
8066
8400
|
if (offers === null)
|
|
8067
8401
|
return unavailable503();
|
|
8068
|
-
|
|
8402
|
+
// (crew#1698, codex delta) Beside an open durable row the opening is the ROW's only: a frame's number beside
|
|
8403
|
+
// an unnumbered row is one no answer could name (POST checks the row).
|
|
8404
|
+
const entry = { ...cached };
|
|
8405
|
+
delete entry.gateSeq;
|
|
8406
|
+
const rowSeq = recorded?.state === 'open' ? gateSeqOf(recorded.row['gate_seq']) : cached.gateSeq;
|
|
8407
|
+
return { runId: id, ...entry, ...(rowSeq !== undefined ? { gateSeq: rowSeq } : {}), ...offers };
|
|
8069
8408
|
}
|
|
8070
8409
|
gateCache.forget(id);
|
|
8071
8410
|
}
|
|
@@ -8098,9 +8437,15 @@ runtime = {}) {
|
|
|
8098
8437
|
// that read, the record is read once more (it may have moved on, legitimately, meanwhile): an
|
|
8099
8438
|
// answer that matches it is served; otherwise the entry is dropped and the gate resolved once
|
|
8100
8439
|
// more from the record, and if that still disagrees nothing verified is served.
|
|
8101
|
-
|
|
8440
|
+
// (crew#1698, codex delta) The opening too, when the row numbers it: a stale frame of an earlier opening at the
|
|
8441
|
+
// same ord is the same disagreement.
|
|
8442
|
+
const sameOpening = (o, r) => isOpenGate(o) && r?.state === 'open' && o.ord === r.ord
|
|
8443
|
+
&& (gateSeqOf(r.row['gate_seq']) === undefined || o.gateSeq === gateSeqOf(r.row['gate_seq']));
|
|
8444
|
+
let record = recorded;
|
|
8445
|
+
if (recorded?.state === 'open' && isOpenGate(open) && !sameOpening(open, recorded)) {
|
|
8102
8446
|
const now = await recordedOpenGate(id);
|
|
8103
|
-
|
|
8447
|
+
record = now;
|
|
8448
|
+
const matchesNow = (o) => sameOpening(o, now);
|
|
8104
8449
|
if (!matchesNow(open)) {
|
|
8105
8450
|
gateCache.forget(id);
|
|
8106
8451
|
open = await resolveOpenGate(id);
|
|
@@ -8140,6 +8485,13 @@ runtime = {}) {
|
|
|
8140
8485
|
const offers = await offersAt(open.ord, run);
|
|
8141
8486
|
if (offers === null)
|
|
8142
8487
|
return unavailable503();
|
|
8488
|
+
// (crew#1698, codex delta) Beside an open durable row, its opening only (see the cache-hit path above).
|
|
8489
|
+
if (record?.state === 'open') {
|
|
8490
|
+
const entry = { ...open };
|
|
8491
|
+
delete entry.gateSeq;
|
|
8492
|
+
const rowSeq = gateSeqOf(record.row['gate_seq']);
|
|
8493
|
+
return { runId: id, ...entry, ...(rowSeq !== undefined ? { gateSeq: rowSeq } : {}), ...offers };
|
|
8494
|
+
}
|
|
8143
8495
|
return { runId: id, ...open, ...offers };
|
|
8144
8496
|
});
|
|
8145
8497
|
// ── Elicitation (DES-002) ────────────────────────────────────────────────────
|
|
@@ -8568,13 +8920,16 @@ runtime = {}) {
|
|
|
8568
8920
|
return err?.code === 'ENOENT';
|
|
8569
8921
|
}
|
|
8570
8922
|
};
|
|
8923
|
+
const NOT_INDEXED = { error: 'this repository has no code graph yet: index it first', code: 'not_indexed' };
|
|
8924
|
+
// studio#1402 (codex r1): "not indexed" needs BOTH the engine's own open failure (it reads `open graph <db>: open
|
|
8925
|
+
// estate store read-only at "<db>": storage error: unable to open database file: <db>`) and a confirmed missing graph
|
|
8926
|
+
// file. Any other failure on such a repo (a binding drift, a bad answer) stays a server error, never "not indexed".
|
|
8927
|
+
const notIndexedFailure = async (repo, msg) => repoReadStatus(msg) === 500 && /unable to open database file/i.test(msg) && (await repoNotIndexed(repo));
|
|
8571
8928
|
const repoReadFailure = async (reply, repo, err) => {
|
|
8572
8929
|
const msg = message(err);
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
}
|
|
8577
|
-
return reply.code(status).send({ error: msg });
|
|
8930
|
+
if (await notIndexedFailure(repo, msg))
|
|
8931
|
+
return reply.code(404).send(NOT_INDEXED);
|
|
8932
|
+
return reply.code(repoReadStatus(msg)).send({ error: msg });
|
|
8578
8933
|
};
|
|
8579
8934
|
app.get(`${V}/governance/coverage`, async (req, reply) => {
|
|
8580
8935
|
// FINDING-009: with `?repo=<ref>`, report coverage over THAT repo's own code graph. The bare
|
|
@@ -8596,8 +8951,8 @@ runtime = {}) {
|
|
|
8596
8951
|
app.get(`${V}/governance/graph`, async (req, reply) => {
|
|
8597
8952
|
// #122: node-count-by-kind summary of a repo's OWN code graph. Repo-scoped ONLY — there is no
|
|
8598
8953
|
// meaningful daemon-wide graph view (the daemon store holds run/governance nodes, not a repo's
|
|
8599
|
-
// code graph), so a missing `?repo=` is a 400, an unknown repo a 404,
|
|
8600
|
-
// failure a 500 (not masked as 404).
|
|
8954
|
+
// code graph), so a missing `?repo=` is a 400, an unknown repo a 404, a repo not indexed yet a 200 with no
|
|
8955
|
+
// kinds (studio#1402), and an engine/binding failure a 500 (not masked as 404).
|
|
8601
8956
|
const repo = repoParam(req);
|
|
8602
8957
|
if (!repo) {
|
|
8603
8958
|
return reply.code(400).send({ error: 'governance/graph requires a ?repo=<ref>' });
|
|
@@ -8607,6 +8962,11 @@ runtime = {}) {
|
|
|
8607
8962
|
return { kinds };
|
|
8608
8963
|
}
|
|
8609
8964
|
catch (err) {
|
|
8965
|
+
// studio#1402: a known repo with no code graph yet is a state, not an error. The summary answers 200 with no
|
|
8966
|
+
// kinds and the reason (`code: 'not_indexed'`), so Repositories, Understand and a repository's page make no 404
|
|
8967
|
+
// per repo not indexed yet; every reader of `{ kinds }` draws "not built". An unknown id stays a plain 404.
|
|
8968
|
+
if (await notIndexedFailure(repo, message(err)))
|
|
8969
|
+
return { kinds: [], ...NOT_INDEXED };
|
|
8610
8970
|
return repoReadFailure(reply, repo, err);
|
|
8611
8971
|
}
|
|
8612
8972
|
});
|
|
@@ -9026,6 +9386,60 @@ runtime = {}) {
|
|
|
9026
9386
|
offset: z.coerce.number().int().min(0).prefault(0),
|
|
9027
9387
|
limit: z.coerce.number().int().min(1).max(200).prefault(50),
|
|
9028
9388
|
}).strict();
|
|
9389
|
+
// (J6 K1) A person's Confirm or Reject on the 1.2.0 domain model: core writes the ruling and rebuilds the model
|
|
9390
|
+
// (`Core.domainRuling`), so the next read shows it. The engine refuses by name (a stale statement, one that changed
|
|
9391
|
+
// since it was shown, one already settled), and nothing is written then.
|
|
9392
|
+
const DomainRulingSchema = z.strictObject({
|
|
9393
|
+
statement: z.string().trim().min(1).max(500).optional(),
|
|
9394
|
+
target: z.string().trim().min(1).max(1000).optional(),
|
|
9395
|
+
expect: z.string().trim().min(1).max(200).optional(),
|
|
9396
|
+
expectTarget: z.string().trim().min(1).max(200),
|
|
9397
|
+
action: z.enum(['confirm', 'reject']),
|
|
9398
|
+
note: z.string().trim().min(1).max(2000).optional(),
|
|
9399
|
+
}).refine((b) => (b.statement === undefined) !== (b.target === undefined), {
|
|
9400
|
+
path: ['statement'],
|
|
9401
|
+
error: 'name one statement or one target',
|
|
9402
|
+
}).refine((b) => b.statement === undefined || b.expect !== undefined, {
|
|
9403
|
+
path: ['expect'],
|
|
9404
|
+
error: 'a statement ruling carries the statement key it was shown (expect)',
|
|
9405
|
+
}).refine((b) => b.target === undefined || b.action === 'confirm', {
|
|
9406
|
+
path: ['action'],
|
|
9407
|
+
error: 'a target is confirmed (its lines make no business decision); a statement is what gets rejected',
|
|
9408
|
+
}).refine((b) => b.action !== 'reject' || b.note !== undefined, {
|
|
9409
|
+
path: ['note'],
|
|
9410
|
+
error: 'say why the statement is wrong (note)',
|
|
9411
|
+
});
|
|
9412
|
+
app.post(`${V}/repos/:id/requirements/rulings`, { config: { manifest: { requestType: 'DomainRulingBody', responseType: 'DomainRulingResponse', statusCodes: [200, 400, 403, 404, 409, 500, 501] } } }, async (req, reply) => {
|
|
9413
|
+
const { id } = req.params;
|
|
9414
|
+
const actor = actorOf(req);
|
|
9415
|
+
if (!isHumanOperator(actor)) {
|
|
9416
|
+
return reply.code(403).send({ code: 'ruling_refused', error: `a ruling on the domain model is a person's call (you are ${actor.kind}/${actor.trust}); nothing was written` });
|
|
9417
|
+
}
|
|
9418
|
+
const repo = (await adapter.listRepos()).find((r) => r.id === id);
|
|
9419
|
+
if (!repo)
|
|
9420
|
+
return reply.code(404).send({ error: `Repo ${id} not found` });
|
|
9421
|
+
const parsed = DomainRulingSchema.safeParse(req.body ?? {});
|
|
9422
|
+
if (!parsed.success)
|
|
9423
|
+
return reply.code(400).send(invalidBody(parsed.error, 'Invalid ruling'));
|
|
9424
|
+
let raw;
|
|
9425
|
+
try {
|
|
9426
|
+
raw = await adapter.domainRuling(repo.id, rulingRequestOf(parsed.data, actor.id));
|
|
9427
|
+
}
|
|
9428
|
+
catch (err) {
|
|
9429
|
+
const msg = message(err);
|
|
9430
|
+
if (err instanceof DomainRulingUnsupportedError)
|
|
9431
|
+
return reply.code(501).send({ code: 'engine_too_old', error: msg });
|
|
9432
|
+
return reply.code(500).send({ code: 'engine', error: msg });
|
|
9433
|
+
}
|
|
9434
|
+
finally {
|
|
9435
|
+
// The ruling may have been written even when the answer did not arrive: the next read rebuilds its index.
|
|
9436
|
+
forgetRequirementsReads(repo);
|
|
9437
|
+
}
|
|
9438
|
+
const answer = rulingAnswerOf(raw);
|
|
9439
|
+
if (answer.status === 200)
|
|
9440
|
+
audit.record('requirements.ruling', actor, { detail: { repoId: repo.id, subject: answer.body.ruling.subject, id: answer.body.ruling.id, action: answer.body.ruling.action } });
|
|
9441
|
+
return reply.code(answer.status).send(answer.body);
|
|
9442
|
+
});
|
|
9029
9443
|
app.get(`${V}/repos/:id/requirements`, async (req, reply) => {
|
|
9030
9444
|
const { id } = req.params;
|
|
9031
9445
|
const repos = await adapter.listRepos();
|
|
@@ -9053,7 +9467,10 @@ runtime = {}) {
|
|
|
9053
9467
|
// Not generated yet is a state, typed by `code`, not a refusal (lane repo-page). It says how
|
|
9054
9468
|
// far the repository is ("23% real requirements · 4397 placeholders · target 80%";
|
|
9055
9469
|
// wicked-core#1233), from the very engine read the page used, when it has a store to count.
|
|
9056
|
-
|
|
9470
|
+
// A 200, not a 404 (studio#986): a repository nobody has generated requirements for is a normal
|
|
9471
|
+
// answer, and studio reads it for every such repository on each page. `code` is the discriminator;
|
|
9472
|
+
// the 404 stays only for a repository that is not registered (no `code`).
|
|
9473
|
+
return reply.code(200).send({
|
|
9057
9474
|
...REQUIREMENTS_NOT_GENERATED,
|
|
9058
9475
|
...(coverage === null ? {} : { coverage }),
|
|
9059
9476
|
...(minimum === null ? {} : { minimum }),
|
|
@@ -9669,6 +10086,17 @@ runtime = {}) {
|
|
|
9669
10086
|
return reply.code(403).send({ error: 'Only a person can change the power mode default (powerModeDefault)' });
|
|
9670
10087
|
}
|
|
9671
10088
|
}
|
|
10089
|
+
// standInReview (DES-STANDIN-001 §4, K2a): 'ask' | 'always'. 'always' is a person's standing consent to stand-in
|
|
10090
|
+
// checks on every later job (labelled everywhere, never independent), so a typo is a 400 and only a PERSON may
|
|
10091
|
+
// change it (a worker's bearer gets 403): a worker may only inherit the consent a person gave.
|
|
10092
|
+
if (Object.hasOwn(patch, 'standInReview')) {
|
|
10093
|
+
if (!isStandInReview(patch.standInReview)) {
|
|
10094
|
+
return reply.code(400).send({ error: "standInReview must be 'ask' or 'always'" });
|
|
10095
|
+
}
|
|
10096
|
+
if (!isHumanOperator(actorOf(req))) {
|
|
10097
|
+
return reply.code(403).send({ error: 'Only a person can change stand-in review (standInReview)' });
|
|
10098
|
+
}
|
|
10099
|
+
}
|
|
9672
10100
|
// newWorkSeats (F1/F2): which seats new chats and jobs are drawn from (`core/job-seats.ts`). A list of seat keys,
|
|
9673
10101
|
// or null for the default rule; a person's choice only (a worker's bearer gets 403).
|
|
9674
10102
|
if (Object.hasOwn(patch, 'newWorkSeats')) {
|
|
@@ -9783,6 +10211,7 @@ runtime = {}) {
|
|
|
9783
10211
|
'deliverDefault',
|
|
9784
10212
|
'qeAcceptance',
|
|
9785
10213
|
'powerModeDefault',
|
|
10214
|
+
'standInReview',
|
|
9786
10215
|
'newWorkSeats',
|
|
9787
10216
|
'onboardingAutoCapture',
|
|
9788
10217
|
'deliverIdentityLogin',
|
|
@@ -9816,9 +10245,24 @@ runtime = {}) {
|
|
|
9816
10245
|
const changed = watchNext === undefined ? Object.keys(safe) : [...Object.keys(safe), 'watch'];
|
|
9817
10246
|
const ignored = Object.keys(patch).filter((k) => !Object.hasOwn(safe, k) && !(k === 'watch' && watchNext !== undefined));
|
|
9818
10247
|
const derive = watchNext;
|
|
9819
|
-
|
|
10248
|
+
// standInConsent (wicked-core#1930 F6) is the daemon's, never a body's (not in `allowed`): the person who turns
|
|
10249
|
+
// standInReview to 'always' is its author, read against the STORED value inside the write queue. Saving 'always'
|
|
10250
|
+
// again keeps the author who turned it on (a client that re-sends every key must not re-sign it); 'ask' clears it.
|
|
10251
|
+
const consentWho = `${actorOf(req).id} (${actorOf(req).kind})`;
|
|
10252
|
+
const consentAt = Date.now();
|
|
10253
|
+
const consent = !Object.hasOwn(safe, 'standInReview')
|
|
10254
|
+
? undefined
|
|
10255
|
+
: (current) => safe.standInReview !== 'always'
|
|
10256
|
+
? { standInConsent: undefined }
|
|
10257
|
+
: current.standInReview === 'always' && current.standInConsent !== undefined
|
|
10258
|
+
? {}
|
|
10259
|
+
: { standInConsent: settingConsent(consentWho, consentAt) };
|
|
10260
|
+
const settings = derive === undefined && consent === undefined
|
|
9820
10261
|
? await adapter.updateSettings(safe)
|
|
9821
|
-
: await adapter.updateSettings(safe, (current) => ({
|
|
10262
|
+
: await adapter.updateSettings(safe, (current) => ({
|
|
10263
|
+
...(derive !== undefined ? { watch: derive(current) } : {}),
|
|
10264
|
+
...(consent !== undefined ? consent(current) : {}),
|
|
10265
|
+
}));
|
|
9822
10266
|
if (watchNext !== undefined)
|
|
9823
10267
|
runtime.watchRegistry?.()?.applySettings(settings.watch);
|
|
9824
10268
|
// Re-apply the worker-config root to this process's env (seat sign-in). The engine reads
|
|
@@ -9908,23 +10352,37 @@ runtime = {}) {
|
|
|
9908
10352
|
}),
|
|
9909
10353
|
};
|
|
9910
10354
|
});
|
|
9911
|
-
// POST /proposals {content, project?, source?} → proposal.submit → 201 { id } (api-types 0.54.0
|
|
9912
|
-
// A skin files ONE
|
|
9913
|
-
// of two candidate outputs, and the pick becomes "prefers takes like X"
|
|
9914
|
-
// accept it here. The kind (`memory`)
|
|
9915
|
-
// caller cannot file a policy through this door (the schema is strict).
|
|
9916
|
-
// `project`
|
|
10355
|
+
// POST /proposals {content, project?, repo?, tier?, source?} → proposal.submit → 201 { id } (api-types 0.54.0;
|
|
10356
|
+
// tier and repo 0.228.0, studio#1095). A skin files ONE memory into the same review queue — studio's "takes" (the
|
|
10357
|
+
// person picks one of two candidate outputs, and the pick becomes "prefers takes like X") and the Memory page's
|
|
10358
|
+
// add — learned only once they accept it here. The kind (`memory`) and `capture: "preference"` marker are the
|
|
10359
|
+
// daemon's; a caller cannot file a policy through this door (the schema is strict). The tier is the person's
|
|
10360
|
+
// choice of three (a fact by default); `project` and `repo` become those facets, so it is recalled there only.
|
|
10361
|
+
// `repo` is a registered repository's id (a run's `repo_ref`, which recall matches): one no registry row carries is
|
|
10362
|
+
// a 400 `repo_unknown`, since a memory on it would never be recalled; a registry that cannot be read is a 503.
|
|
9917
10363
|
app.post(`${V}/proposals`, {
|
|
9918
10364
|
config: {
|
|
9919
|
-
manifest: { requestType: 'FileProposalBody', responseType: 'FileProposalResponse', statusCodes: [201, 400, 502] },
|
|
10365
|
+
manifest: { requestType: 'FileProposalBody', responseType: 'FileProposalResponse', statusCodes: [201, 400, 502, 503] },
|
|
9920
10366
|
},
|
|
9921
10367
|
}, async (req, reply) => {
|
|
9922
10368
|
const parsed = FileProposalSchema.safeParse(req.body ?? {});
|
|
9923
10369
|
if (!parsed.success) {
|
|
9924
10370
|
return reply.code(400).send(invalidBody(parsed.error, 'Invalid proposal body'));
|
|
9925
10371
|
}
|
|
9926
|
-
const { content, project, source } = parsed.data;
|
|
9927
|
-
|
|
10372
|
+
const { content, project, repo, tier, source } = parsed.data;
|
|
10373
|
+
if (repo !== undefined) {
|
|
10374
|
+
let known;
|
|
10375
|
+
try {
|
|
10376
|
+
known = (await adapter.listRepos()).some((r) => r.id === repo);
|
|
10377
|
+
}
|
|
10378
|
+
catch (err) {
|
|
10379
|
+
return reply.code(503).send({ error: `the repository list could not be read (${err instanceof Error ? err.message : String(err)}); nothing was filed, try again` });
|
|
10380
|
+
}
|
|
10381
|
+
if (!known) {
|
|
10382
|
+
return reply.code(400).send({ error: `no registered repository has the id '${repo}', so a memory on it would never be recalled; pick one from GET /repos`, code: 'repo_unknown' });
|
|
10383
|
+
}
|
|
10384
|
+
}
|
|
10385
|
+
const payload = { content, tier: tier ?? 'semantic', capture: 'preference' };
|
|
9928
10386
|
if (source !== undefined)
|
|
9929
10387
|
payload.source = source;
|
|
9930
10388
|
let submitted;
|
|
@@ -9932,7 +10390,7 @@ runtime = {}) {
|
|
|
9932
10390
|
submitted = (await estateTool('proposal.submit', {
|
|
9933
10391
|
kind_type: 'memory',
|
|
9934
10392
|
payload,
|
|
9935
|
-
facets: project !== undefined ? { project } : {},
|
|
10393
|
+
facets: { ...(project !== undefined ? { project } : {}), ...(repo !== undefined ? { repo } : {}) },
|
|
9936
10394
|
}));
|
|
9937
10395
|
}
|
|
9938
10396
|
catch (err) {
|
|
@@ -11061,6 +11519,10 @@ runtime = {}) {
|
|
|
11061
11519
|
...(runtime.dataGate !== undefined ? { gate: runtime.dataGate } : {}),
|
|
11062
11520
|
...(mcpPolicies !== undefined ? { policies: mcpPolicies } : {}),
|
|
11063
11521
|
...(runtime.mcpCalls !== undefined ? { usage: runtime.mcpCalls } : {}),
|
|
11522
|
+
// (crew#1514) A rename lists the apps that use the source.
|
|
11523
|
+
...(runtime.apps !== undefined ? { appsUsing: (name) => runtime.apps.appsUsing(name) } : {}),
|
|
11524
|
+
// (crew#1906) A rename withdraws the old name's row-write grants.
|
|
11525
|
+
...(appsWritePath !== undefined ? { rowWriteGrants: appsWritePath } : {}),
|
|
11064
11526
|
audit,
|
|
11065
11527
|
actorOf,
|
|
11066
11528
|
});
|
|
@@ -11113,6 +11575,17 @@ runtime = {}) {
|
|
|
11113
11575
|
audit,
|
|
11114
11576
|
actorOf,
|
|
11115
11577
|
});
|
|
11578
|
+
// crew#372: publish a finished compose's plan as GitHub issues of a project-linked tracker (human-only, card first).
|
|
11579
|
+
registerProductPublishRoutes(app, {
|
|
11580
|
+
...(runtime.mcpRegistryStore !== undefined ? { store: runtime.mcpRegistryStore } : {}),
|
|
11581
|
+
...(runtime.dataGate !== undefined ? { pm: runtime.dataGate.pm } : {}),
|
|
11582
|
+
projectExists: async (id) => (await adapter.projectGet(id).catch(() => null)) !== null,
|
|
11583
|
+
composeOf: (runId) => runTimingIndex.composeOf(runId),
|
|
11584
|
+
runView: (runId) => adapter.runView(runId),
|
|
11585
|
+
workOutput: (unitId) => adapter.workOutput(unitId),
|
|
11586
|
+
audit,
|
|
11587
|
+
actorOf,
|
|
11588
|
+
});
|
|
11116
11589
|
// DES-KNOWLEDGE-DATA-001 §10 (B4): profile a source into data-shape proposals, and the Knowledge map (both human-only).
|
|
11117
11590
|
registerShapeRoutes(app, {
|
|
11118
11591
|
...(runtime.mcp !== undefined ? { registry: runtime.mcp } : {}),
|
|
@@ -11129,11 +11602,42 @@ runtime = {}) {
|
|
|
11129
11602
|
: {}),
|
|
11130
11603
|
...(appsKnowledge !== undefined ? { knowledge: appsKnowledge } : {}),
|
|
11131
11604
|
});
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11605
|
+
const bridgeCallFor = async (projectId) => {
|
|
11606
|
+
const root = await projectDocsRoot(adapter, projectSettings, projectId);
|
|
11607
|
+
if (root === null)
|
|
11608
|
+
return null;
|
|
11609
|
+
const bridge = await interactiveBridges.ensure(root);
|
|
11610
|
+
return async (method, path, body, opts) => {
|
|
11611
|
+
const raw = Buffer.isBuffer(body);
|
|
11612
|
+
const res = await fetch(`http://${bridge.host}:${bridge.port}${path}`, {
|
|
11613
|
+
method,
|
|
11614
|
+
...(body === undefined ? {} : {
|
|
11615
|
+
headers: { 'content-type': raw ? 'application/octet-stream' : 'application/json' },
|
|
11616
|
+
body: raw ? new Uint8Array(body) : JSON.stringify(body),
|
|
11617
|
+
}),
|
|
11618
|
+
// A segment upload or a render (ffmpeg) can take minutes on a loaded host.
|
|
11619
|
+
signal: AbortSignal.timeout(opts?.timeoutMs ?? 600_000),
|
|
11620
|
+
});
|
|
11621
|
+
let parsed = {};
|
|
11622
|
+
try {
|
|
11623
|
+
const j = await res.json();
|
|
11624
|
+
if (j !== null && typeof j === 'object' && !Array.isArray(j))
|
|
11625
|
+
parsed = j;
|
|
11626
|
+
}
|
|
11627
|
+
catch {
|
|
11628
|
+
parsed = {};
|
|
11629
|
+
}
|
|
11630
|
+
return { status: res.status, body: parsed };
|
|
11631
|
+
};
|
|
11632
|
+
};
|
|
11633
|
+
/** (studio#1140 (a)) The video tool as the chat's cut reads and Go call it: a read is quick, a recut renders (up to
|
|
11634
|
+
* two ffmpeg passes of 180 s each, plus the probe and writes). */
|
|
11635
|
+
const cutBridgeFor = async (projectId) => {
|
|
11636
|
+
const call = await bridgeCallFor(projectId);
|
|
11637
|
+
if (call === null)
|
|
11638
|
+
return null;
|
|
11639
|
+
return (method, path, body) => call(method, path, body, { timeoutMs: method === 'GET' ? 30_000 : 900_000 });
|
|
11640
|
+
};
|
|
11137
11641
|
const interactiveBridges = runtime.interactiveBridges ??
|
|
11138
11642
|
new InteractiveBridgePool({
|
|
11139
11643
|
log: (m) => app.log.warn(m),
|
|
@@ -11235,6 +11739,8 @@ runtime = {}) {
|
|
|
11235
11739
|
}
|
|
11236
11740
|
})();
|
|
11237
11741
|
// Reads the folds and the run list depend on, each bounded.
|
|
11742
|
+
// The snoozes in force (studio#1416): a read that fails or runs late holds nothing back.
|
|
11743
|
+
const snoozesP = settleWithin(() => deskSnoozes.list(), PROBE_TIMEOUT_MS);
|
|
11238
11744
|
const viewsP = settleWithin(async () => {
|
|
11239
11745
|
const detail = await adapter.sessionsDetail();
|
|
11240
11746
|
await backfillEndedAt(detail);
|
|
@@ -11307,7 +11813,7 @@ runtime = {}) {
|
|
|
11307
11813
|
tailLagMs: watchHealth?.tail_lag_ms ?? null,
|
|
11308
11814
|
}),
|
|
11309
11815
|
probeVault({ vault: adapter.vaultBin != null ? vaultDiagnostics(adapter.vaultBin) : null, exec: systemExec }),
|
|
11310
|
-
diskRow(stateHome),
|
|
11816
|
+
diskRow(stateHome, undefined, undefined, undefined, stateHome === null ? null : (deadline) => diskStoresCache.get(stateHome, deadline)),
|
|
11311
11817
|
probeSeatImages({
|
|
11312
11818
|
containerFloor,
|
|
11313
11819
|
clis: rosterSeatClis(),
|
|
@@ -11493,6 +11999,7 @@ runtime = {}) {
|
|
|
11493
11999
|
gaps,
|
|
11494
12000
|
infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
|
|
11495
12001
|
costOf: (id) => runCosts.get(id),
|
|
12002
|
+
engine: clusterReader.engine(),
|
|
11496
12003
|
});
|
|
11497
12004
|
if (typeof adapter.runEvents === 'function' && first.unresolved.length > 0) {
|
|
11498
12005
|
const byId = new Map(allViews.map((v) => [v.session.id, v]));
|
|
@@ -11510,8 +12017,11 @@ runtime = {}) {
|
|
|
11510
12017
|
gaps,
|
|
11511
12018
|
infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
|
|
11512
12019
|
costOf: (id) => runCosts.get(id),
|
|
12020
|
+
engine: clusterReader.engine(),
|
|
11513
12021
|
});
|
|
11514
12022
|
const toReview = await toReviewP;
|
|
12023
|
+
const snoozes = await snoozesP;
|
|
12024
|
+
const held = holdSnoozed(needs.attention, snoozes.kind === 'ok' ? snoozes.value : [], Date.now());
|
|
11515
12025
|
// A run list that could not be read never reads green: the daemon row (degraded, "did not list
|
|
11516
12026
|
// its runs") is in attention as a slowdown, and the level stays at least yellow.
|
|
11517
12027
|
return assembleSnapshot({
|
|
@@ -11520,7 +12030,8 @@ runtime = {}) {
|
|
|
11520
12030
|
runs,
|
|
11521
12031
|
infra,
|
|
11522
12032
|
governance,
|
|
11523
|
-
attention:
|
|
12033
|
+
attention: held.attention,
|
|
12034
|
+
snoozed: held.snoozed,
|
|
11524
12035
|
unresolved: needs.unresolved,
|
|
11525
12036
|
unresolvedSpend: needs.unresolvedSpend,
|
|
11526
12037
|
toReview: toReview.kind === 'ok' ? toReview.value : null,
|
|
@@ -11647,34 +12158,7 @@ runtime = {}) {
|
|
|
11647
12158
|
log: (m) => app.log.warn(m),
|
|
11648
12159
|
});
|
|
11649
12160
|
// ── A demo run's video as an editable document (the video editor re-cuts it through E1's per-doc API) ──
|
|
11650
|
-
registerDemoDocumentRoute(app, adapter, {
|
|
11651
|
-
bridgeFor: async (projectId) => {
|
|
11652
|
-
const root = await projectDocsRoot(adapter, projectSettings, projectId);
|
|
11653
|
-
if (root === null)
|
|
11654
|
-
return null;
|
|
11655
|
-
const bridge = await interactiveBridges.ensure(root);
|
|
11656
|
-
return async (method, path, body) => {
|
|
11657
|
-
const raw = Buffer.isBuffer(body);
|
|
11658
|
-
const res = await fetch(`http://${bridge.host}:${bridge.port}${path}`, {
|
|
11659
|
-
method,
|
|
11660
|
-
headers: { 'content-type': raw ? 'application/octet-stream' : 'application/json' },
|
|
11661
|
-
body: raw ? new Uint8Array(body) : JSON.stringify(body),
|
|
11662
|
-
// A segment upload or the import's render (ffmpeg) can take minutes on a loaded host.
|
|
11663
|
-
signal: AbortSignal.timeout(600_000),
|
|
11664
|
-
});
|
|
11665
|
-
let parsed = {};
|
|
11666
|
-
try {
|
|
11667
|
-
const j = await res.json();
|
|
11668
|
-
if (j !== null && typeof j === 'object' && !Array.isArray(j))
|
|
11669
|
-
parsed = j;
|
|
11670
|
-
}
|
|
11671
|
-
catch {
|
|
11672
|
-
parsed = {};
|
|
11673
|
-
}
|
|
11674
|
-
return { status: res.status, body: parsed };
|
|
11675
|
-
};
|
|
11676
|
-
},
|
|
11677
|
-
});
|
|
12161
|
+
registerDemoDocumentRoute(app, adapter, { bridgeFor: bridgeCallFor });
|
|
11678
12162
|
// ── Project-attributed docs list (crew#472) ──
|
|
11679
12163
|
// `GET /projects/:id/interactive/api/docs` relays the bridge's list and stamps each row with
|
|
11680
12164
|
// the mount's `projectId` — the attribution the bridge cannot know. Same static-over-wildcard
|