wicked-crew 0.18.21 → 0.18.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/audit.d.ts +28 -1
- package/dist/api/audit.d.ts.map +1 -1
- package/dist/api/audit.js +90 -9
- package/dist/api/audit.js.map +1 -1
- package/dist/api/auth.d.ts +7 -0
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +53 -10
- package/dist/api/auth.js.map +1 -1
- package/dist/api/capture.d.ts +11 -2
- package/dist/api/capture.d.ts.map +1 -1
- package/dist/api/capture.js +7 -2
- package/dist/api/capture.js.map +1 -1
- package/dist/api/chat-context.d.ts +6 -1
- package/dist/api/chat-context.d.ts.map +1 -1
- package/dist/api/chat-context.js +45 -11
- package/dist/api/chat-context.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +24 -7
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +98 -18
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-scope.d.ts +6 -2
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +13 -7
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/cluster-status.d.ts +17 -0
- package/dist/api/cluster-status.d.ts.map +1 -1
- package/dist/api/cluster-status.js +70 -3
- package/dist/api/cluster-status.js.map +1 -1
- package/dist/api/compose-facts.d.ts +35 -0
- package/dist/api/compose-facts.d.ts.map +1 -0
- package/dist/api/compose-facts.js +46 -0
- package/dist/api/compose-facts.js.map +1 -0
- package/dist/api/cut-read.d.ts +62 -0
- package/dist/api/cut-read.d.ts.map +1 -0
- package/dist/api/cut-read.js +101 -0
- package/dist/api/cut-read.js.map +1 -0
- package/dist/api/desk-snoozes.d.ts +54 -0
- package/dist/api/desk-snoozes.d.ts.map +1 -0
- package/dist/api/desk-snoozes.js +174 -0
- package/dist/api/desk-snoozes.js.map +1 -0
- package/dist/api/diagnostics.d.ts +4 -0
- package/dist/api/diagnostics.d.ts.map +1 -1
- package/dist/api/diagnostics.js +15 -7
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/api/disk-stores.d.ts +66 -0
- package/dist/api/disk-stores.d.ts.map +1 -0
- package/dist/api/disk-stores.js +206 -0
- package/dist/api/disk-stores.js.map +1 -0
- package/dist/api/gate-cache.d.ts +8 -0
- package/dist/api/gate-cache.d.ts.map +1 -1
- package/dist/api/gate-cache.js +8 -1
- package/dist/api/gate-cache.js.map +1 -1
- package/dist/api/mcp.d.ts +16 -0
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +118 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.d.ts +3 -0
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +7 -3
- package/dist/api/needs.js.map +1 -1
- package/dist/api/post-hoc-deliver.d.ts +7 -0
- package/dist/api/post-hoc-deliver.d.ts.map +1 -1
- package/dist/api/post-hoc-deliver.js +16 -5
- package/dist/api/post-hoc-deliver.js.map +1 -1
- package/dist/api/product-publish.d.ts +242 -0
- package/dist/api/product-publish.d.ts.map +1 -0
- package/dist/api/product-publish.js +902 -0
- package/dist/api/product-publish.js.map +1 -0
- package/dist/api/product.d.ts +5 -6
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +4 -4
- package/dist/api/product.js.map +1 -1
- package/dist/api/proposal-cut.d.ts +95 -0
- package/dist/api/proposal-cut.d.ts.map +1 -0
- package/dist/api/proposal-cut.js +231 -0
- package/dist/api/proposal-cut.js.map +1 -0
- package/dist/api/requirements.d.ts +3 -3
- package/dist/api/requirements.js +3 -3
- package/dist/api/routes.d.ts +15 -0
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +410 -88
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-liveness.d.ts.map +1 -1
- package/dist/api/run-liveness.js +3 -1
- package/dist/api/run-liveness.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +10 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +29 -9
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/seat-container-login.d.ts +11 -17
- package/dist/api/seat-container-login.d.ts.map +1 -1
- package/dist/api/seat-container-login.js +36 -69
- package/dist/api/seat-container-login.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +2 -1
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +17 -6
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/ui-text.d.ts.map +1 -1
- package/dist/api/ui-text.js +3 -1
- package/dist/api/ui-text.js.map +1 -1
- package/dist/apps/store.d.ts +11 -0
- package/dist/apps/store.d.ts.map +1 -1
- package/dist/apps/store.js +47 -0
- package/dist/apps/store.js.map +1 -1
- package/dist/apps-server/server/lib/bundle/server.mjs +12 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -52
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/start-stand-ins.d.ts +13 -0
- package/dist/cli/start-stand-ins.d.ts.map +1 -0
- package/dist/cli/start-stand-ins.js +30 -0
- package/dist/cli/start-stand-ins.js.map +1 -0
- package/dist/core/adapter.d.ts +43 -6
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +169 -30
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/ado-env.d.ts +17 -0
- package/dist/core/ado-env.d.ts.map +1 -0
- package/dist/core/ado-env.js +34 -0
- package/dist/core/ado-env.js.map +1 -0
- package/dist/core/deliver-text.d.ts +17 -0
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +76 -1
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts +6 -0
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +12 -4
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/exec.d.ts +1 -10
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -17
- package/dist/core/exec.js.map +1 -1
- package/dist/core/governance-store.d.ts +3 -1
- package/dist/core/governance-store.d.ts.map +1 -1
- package/dist/core/governance-store.js +7 -2
- package/dist/core/governance-store.js.map +1 -1
- package/dist/core/repo-clone.d.ts.map +1 -1
- package/dist/core/repo-clone.js +2 -1
- package/dist/core/repo-clone.js.map +1 -1
- package/dist/core/run-log-facts.d.ts +56 -0
- package/dist/core/run-log-facts.d.ts.map +1 -0
- package/dist/core/run-log-facts.js +230 -0
- package/dist/core/run-log-facts.js.map +1 -0
- package/dist/core/shutdown.d.ts +27 -0
- package/dist/core/shutdown.d.ts.map +1 -1
- package/dist/core/shutdown.js +72 -0
- package/dist/core/shutdown.js.map +1 -1
- package/dist/core/stand-in.d.ts +40 -0
- package/dist/core/stand-in.d.ts.map +1 -0
- package/dist/core/stand-in.js +118 -0
- package/dist/core/stand-in.js.map +1 -0
- package/dist/core/types.d.ts +17 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/editors/pack-extras.d.ts +162 -0
- package/dist/editors/pack-extras.d.ts.map +1 -0
- package/dist/editors/pack-extras.js +596 -0
- package/dist/editors/pack-extras.js.map +1 -0
- package/dist/editors/pack-install.d.ts +15 -7
- package/dist/editors/pack-install.d.ts.map +1 -1
- package/dist/editors/pack-install.js +140 -19
- package/dist/editors/pack-install.js.map +1 -1
- package/dist/editors/registry.d.ts +42 -3
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +114 -11
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +10 -5
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +45 -11
- package/dist/editors/routes.js.map +1 -1
- package/dist/interactive/bridge-pool.d.ts +5 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +4 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/landing-guard.d.ts.map +1 -1
- package/dist/interactive/landing-guard.js +79 -5
- package/dist/interactive/landing-guard.js.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -1
- package/dist/knowledge/adapters/toolbox/memory.js +3 -2
- package/dist/knowledge/adapters/toolbox/memory.js.map +1 -1
- package/dist/knowledge/trackers/set.d.ts +28 -0
- package/dist/knowledge/trackers/set.d.ts.map +1 -1
- package/dist/knowledge/trackers/set.js +26 -0
- package/dist/knowledge/trackers/set.js.map +1 -1
- package/dist/mcp/policies.d.ts +35 -0
- package/dist/mcp/policies.d.ts.map +1 -1
- package/dist/mcp/policies.js +138 -1
- package/dist/mcp/policies.js.map +1 -1
- package/dist/mcp/registry-store.d.ts +10 -0
- package/dist/mcp/registry-store.d.ts.map +1 -1
- package/dist/mcp/registry-store.js.map +1 -1
- package/dist/mcp/registry.d.ts +40 -3
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +211 -16
- package/dist/mcp/registry.js.map +1 -1
- package/dist/mcp/trigger-names.d.ts +32 -0
- package/dist/mcp/trigger-names.d.ts.map +1 -0
- package/dist/mcp/trigger-names.js +529 -0
- package/dist/mcp/trigger-names.js.map +1 -0
- package/dist/skills/store.d.ts +11 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +37 -3
- package/dist/skills/store.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/assets/{KnowledgeGraph-yP4WsnST.js → KnowledgeGraph-D6RRLDnV.js} +1 -1
- package/dist/studio/assets/{index-DW53FKuT.js → index-BLo9vFQI.js} +324 -310
- package/dist/studio/assets/index-xW21Gkam.css +32 -0
- package/dist/studio/editors/wicked-apps/editor.json +1 -1
- package/dist/studio/editors/wicked-apps/index.html +1 -1
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +1 -1
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +1 -1
- package/dist/studio/editors/wicked-insights/editor.json +1 -1
- package/dist/studio/editors/wicked-insights/index.html +1 -1
- package/dist/studio/editors/wicked-page/editor.json +1 -1
- package/dist/studio/editors/wicked-page/index.html +1 -1
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +539 -5
- package/dist/team/routes.d.ts +4 -1
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +1 -1
- package/dist/team/routes.js.map +1 -1
- package/dist/voice/tts.d.ts +6 -0
- package/dist/voice/tts.d.ts.map +1 -1
- package/dist/voice/tts.js +16 -1
- package/dist/voice/tts.js.map +1 -1
- package/endpoint-manifest.json +85 -6
- package/package.json +4 -4
- package/voice-locks/darwin-arm64-cp310.txt +12 -0
- package/voice-locks/darwin-arm64-cp311.txt +8 -0
- package/voice-locks/darwin-arm64-cp312.txt +8 -0
- package/voice-locks/darwin-arm64-cp313.txt +8 -0
- package/voice-locks/darwin-arm64-cp314.txt +8 -0
- package/voice-locks/darwin-arm64-cp39.txt +12 -0
- package/voice-locks/darwin-x64-cp310.txt +12 -0
- package/voice-locks/darwin-x64-cp311.txt +12 -0
- package/voice-locks/darwin-x64-cp312.txt +12 -0
- package/voice-locks/darwin-x64-cp313.txt +12 -0
- package/voice-locks/darwin-x64-cp39.txt +12 -0
- package/voice-locks/linux-arm64-cp310.txt +12 -0
- package/voice-locks/linux-arm64-cp311.txt +8 -0
- package/voice-locks/linux-arm64-cp312.txt +8 -0
- package/voice-locks/linux-arm64-cp313.txt +8 -0
- package/voice-locks/linux-arm64-cp314.txt +8 -0
- package/voice-locks/linux-arm64-cp39.txt +12 -0
- package/voice-locks/linux-x64-cp310.txt +12 -0
- package/voice-locks/linux-x64-cp311.txt +8 -0
- package/voice-locks/linux-x64-cp312.txt +8 -0
- package/voice-locks/linux-x64-cp313.txt +8 -0
- package/voice-locks/linux-x64-cp314.txt +8 -0
- package/voice-locks/linux-x64-cp39.txt +12 -0
- package/dist/studio/assets/index-DNaLjJ7M.css +0 -32
package/dist/api/routes.js
CHANGED
|
@@ -50,7 +50,7 @@ function turnReadRoots(scratchRoot) {
|
|
|
50
50
|
}
|
|
51
51
|
return roots;
|
|
52
52
|
}
|
|
53
|
-
import { detectRefusal, isOpenGate, offeredChoices, replayOpenGate } from './gate-cache.js';
|
|
53
|
+
import { detectRefusal, gateSeqOf, isOpenGate, offeredChoices, replayOpenGate } from './gate-cache.js';
|
|
54
54
|
import { acceptanceRequirementOf, buildAcceptanceView } from '../qe/acceptance.js';
|
|
55
55
|
import { runIdentityOf, wireIdentity } from '../core/run-identity.js';
|
|
56
56
|
import { buildWorkflowCatalog } from '../workflow-catalog/build.js';
|
|
@@ -89,6 +89,7 @@ import { estateExe, parseEstateTotals, projectGraphRefreshDiagnostics, readBlast
|
|
|
89
89
|
import { attachRepoToProject, createProjectRecorded, registerProjectRoutes } from '../projects/routes.js';
|
|
90
90
|
import { registerProjectAggregateRoutes } from './project-aggregates.js';
|
|
91
91
|
import { composeLaunch, composePreflight, registerProductRoutes } from './product.js';
|
|
92
|
+
import { registerProductPublishRoutes } from './product-publish.js';
|
|
92
93
|
import { buildWorkflowCatalogV2, parseCommand, resolveOption } from '../workflow-catalog/build-v2.js';
|
|
93
94
|
import { DEFAULT_PROJECT_ID } from '../projects/default-project.js';
|
|
94
95
|
import { DETECT_MAX_CHARS, DETECT_TIMEOUT_MS, DetectService, shadowCheck } from '../workflow-catalog/detect-service.js';
|
|
@@ -127,6 +128,7 @@ import { REQUIRED_GARDEN_VERSION } from '../skills/plugin-source.js';
|
|
|
127
128
|
import { isSeatKeyList } from '../core/job-seats.js';
|
|
128
129
|
import { engineRosterJson, noEligibleSeatBody, parseNoEligibleSeat, toEngineSeat } from '../core/engine-roster.js';
|
|
129
130
|
import { launchAssuranceNotice, readJudgeCoverage } from '../core/assurance.js';
|
|
131
|
+
import { STAND_IN_NEEDED_GATE, USE_STAND_INS_ACTION, consentFor, isStandInReview, preflightRefusal, readPreflight } from '../core/stand-in.js';
|
|
130
132
|
import { launchPosture } from '../core/launch-posture.js';
|
|
131
133
|
import { launchRequiresQe, mayRequireQe, qeAcceptanceMode, qeSettingSkipReason } from '../core/qe-acceptance-setting.js';
|
|
132
134
|
import { aggregateReceipt, postHocDeliveryAssurance, qeAcceptanceFromView, qeAcceptanceRefusal, QE_ACCEPTANCE_REQUIRED_CODE, receiptOf, qeAcceptanceNotRequired, qeDecisionBypasses, qeDecisionOf, qeAcceptanceSkippedAtGate, unreadableQeAcceptance, } from './delivery-assurance.js';
|
|
@@ -144,6 +146,7 @@ import { createDocInProcess, registerInteractiveProxy } from '../interactive/pro
|
|
|
144
146
|
import { CreateLauncher } from '../interactive/proposal-create.js';
|
|
145
147
|
import { ThemeLauncher } from './proposal-theme.js';
|
|
146
148
|
import { CHAT_GIT_PROTOCOLS, OnboardLauncher, probeGitUrl, withoutCredentials } from './proposal-onboard.js';
|
|
149
|
+
import { CutLauncher } from './proposal-cut.js';
|
|
147
150
|
import { RefineLauncher } from '../interactive/proposal-refine.js';
|
|
148
151
|
import { lineageSteps, protectedEdits } from '../interactive/protected-edits.js';
|
|
149
152
|
import { buildRunBrief } from './run-brief.js';
|
|
@@ -172,6 +175,7 @@ import { AuditLog } from './audit.js';
|
|
|
172
175
|
import { auditFor } from './audit-view.js';
|
|
173
176
|
import { ProposalDecisionIndex, recordProposalDecision } from './proposal-decisions.js';
|
|
174
177
|
import { AcpFoldCache, EngineVersionCache, FloorCacheCache, eventsDirOf, installedPackageVersion, hostSandboxLauncher, seatRosterFile, listStoreFiles, readStudioBundleVersion, } from './diagnostics.js';
|
|
178
|
+
import { DiskStoreCache, readDiskStores } from './disk-stores.js';
|
|
175
179
|
import { GovernanceDiagnostics } from './governance-health.js';
|
|
176
180
|
import { ATTACHMENT_LIMITS, ATTACHMENT_MAX_MESSAGE_BYTES, AttachmentError, ChatAttachmentStore, attachmentWire, attachmentsBlock, boundaryOf, parseMultipart, stageForSeat } from './chat-attachments.js';
|
|
177
181
|
import { CHAT_HISTORY_MAX_LIMIT, ChatHistoryStore, SeedRequestStore, decodeCursor } from './chat-history.js';
|
|
@@ -193,6 +197,7 @@ import { VoiceService, defaultVoiceDir } from '../voice/service.js';
|
|
|
193
197
|
import { TtsService } from '../voice/tts.js';
|
|
194
198
|
import { VoiceDashboardStore } from '../voice/dashboard.js';
|
|
195
199
|
import { registerVoiceRoutes } from '../voice/routes.js';
|
|
200
|
+
import { DeskSnoozes, registerDeskSnoozeRoutes } from './desk-snoozes.js';
|
|
196
201
|
import { VoiceInjectInputs } from '../voice/inject-input.js';
|
|
197
202
|
import { GroupIndex } from './group-index.js';
|
|
198
203
|
import { RunTimingIndex, recordRunLaunched } from './run-timing-index.js';
|
|
@@ -216,6 +221,7 @@ import { ConsiderationService } from '../decisions/consider.js';
|
|
|
216
221
|
import { engineConformance, gardenPackCheck } from '../editors/pack-install.js';
|
|
217
222
|
import { conformanceProvisioner, conformanceRuntimeReady, conformanceRuntimeRoot, conformanceVenvDir, editorPluginLaunchListener, venvPython } from '../editors/conformance-runtime.js';
|
|
218
223
|
import { EditorRegistry } from '../editors/registry.js';
|
|
224
|
+
import { packSkillsPort } from '../editors/pack-extras.js';
|
|
219
225
|
import { registerEditorRoutes, unitTokenProbe } from '../editors/routes.js';
|
|
220
226
|
import { broadcast } from '../events/bus.js';
|
|
221
227
|
import { AppWritePath } from '../apps/actions/write-path.js';
|
|
@@ -646,6 +652,9 @@ export const LaunchSchema = z.strictObject({
|
|
|
646
652
|
* "full assurance", the same as omitting it: the launcher never chooses for the caller, and a
|
|
647
653
|
* full-assurance launch on a one-CLI roster is answered with `assuranceNotice` (`core/assurance.ts`). */
|
|
648
654
|
reducedAssurance: z.boolean().optional(),
|
|
655
|
+
/** (api-types 0.231.0, DES-STANDIN-001 §4) A PERSON's consent to stand-in checks for this job: the answer to a
|
|
656
|
+
* `409 stand_in_choice` (its `retryWith`). A worker's bearer gets 403; never with `reducedAssurance`. */
|
|
657
|
+
standIns: z.literal(true).optional(),
|
|
649
658
|
/** (api-types 0.149.0, program DES-POWER-MODE) Power mode for this launch. Omitted: the daemon's
|
|
650
659
|
* `powerModeDefault` setting (on when unset). Applies to a repo-scoped plan or preset launch only. */
|
|
651
660
|
power: z.boolean().optional(),
|
|
@@ -665,6 +674,9 @@ export const LaunchSchema = z.strictObject({
|
|
|
665
674
|
}).refine((b) => b.documents === undefined || b.documents.length === 0 || b.chatId !== undefined, {
|
|
666
675
|
path: ['documents'],
|
|
667
676
|
error: 'documents are chat tokens: send the chatId they were named in',
|
|
677
|
+
}).refine((b) => b.standIns !== true || b.reducedAssurance !== true, {
|
|
678
|
+
path: ['standIns'],
|
|
679
|
+
error: 'standIns and reducedAssurance are mutually exclusive: stand-in checks are labelled checks, reduced assurance skips them',
|
|
668
680
|
}).refine((b) => b.skipQeAcceptance === undefined || b.forceQeAcceptance !== true, {
|
|
669
681
|
path: ['forceQeAcceptance'],
|
|
670
682
|
error: 'skipQeAcceptance and forceQeAcceptance are mutually exclusive — skip it with a reason, or force it',
|
|
@@ -762,16 +774,22 @@ export const GateSchema = z.strictObject({
|
|
|
762
774
|
amend: z.string().optional(),
|
|
763
775
|
action: z
|
|
764
776
|
.union([
|
|
765
|
-
z.enum(['approve', 'request_changes', 'reject', 'edit_plan', 'amend_intent', OPERATOR_JUDGMENT_ACTION, SKIP_QE_ACTION, SKIP_RULES_ACTION, ...ESCALATION_ACTIONS]),
|
|
777
|
+
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
778
|
z.string().regex(CONSENT_CHOICE_ACTION, 'a consent choice is `consent:<choice id>`'),
|
|
767
779
|
])
|
|
768
780
|
.optional(),
|
|
769
781
|
amendScope: z.enum(['cursor', 'creator']).optional(),
|
|
782
|
+
/** (api-types 0.231.0, DES-STANDIN-001 §3.10) With `action: 'use_stand_ins'`: this job only, or every job (also
|
|
783
|
+
* saves the `standInReview: 'always'` setting). */
|
|
784
|
+
scope: z.enum(['job', 'always']).optional(),
|
|
770
785
|
/** DES-TEAMING-002 T3 — approve a `plan_approval` gate WITH AN EDIT (`GateDecision.plan`). */
|
|
771
786
|
plan: PlanSchema.optional(),
|
|
772
787
|
/** api-types 0.44.0 — the gate this decision answers (its unit `ord`). A mismatch with the run's
|
|
773
788
|
* open gate is a 409 `gate_changed`: the decision was made on a gate that is no longer open. */
|
|
774
789
|
ord: z.int().nonnegative().optional(),
|
|
790
|
+
/** (crew#1698, api-types 0.231.0) The OPENING of the gate this decision answers (`awaitingHuman.gateSeq`): a gate that
|
|
791
|
+
* closed and re-opened since, at the same ord too, is a 409 `gate_changed`. */
|
|
792
|
+
gateSeq: z.int().positive().optional(),
|
|
775
793
|
/** (api-types 0.192.0, DES-CATALOG-002 §4.6) At a `plan_approval` gate: the plan revision this answer was made on.
|
|
776
794
|
* Passed with `ord` into the engine's own serialized decision, which refuses a stale one (`gate_changed`). */
|
|
777
795
|
planRev: z.int().nonnegative().optional(),
|
|
@@ -790,8 +808,8 @@ export const GateSchema = z.strictObject({
|
|
|
790
808
|
.min(1)
|
|
791
809
|
.max(500)
|
|
792
810
|
.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(
|
|
811
|
+
}).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
|
|
812
|
+
|| (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
813
|
// (operator ruling 2026-10-21) The override's rationale IS its record: a blank one is a 400 here,
|
|
796
814
|
// before the engine is asked.
|
|
797
815
|
(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 +856,17 @@ export function injectWords(message) {
|
|
|
838
856
|
end -= 1;
|
|
839
857
|
return message.slice(0, end);
|
|
840
858
|
}
|
|
841
|
-
|
|
859
|
+
/** (crew#1698, api-types 0.231.0) `gateSeq`: which OPENING of the gate an answer was made on (`awaitingHuman.gateSeq`,
|
|
860
|
+
* `GET /runs/:id/gate`'s `gateSeq`). A gate that closed and re-opened since, at the same ord too, is another opening:
|
|
861
|
+
* 409 `gate_changed`. Optional; the ord check stands as before without it. */
|
|
862
|
+
const GateSeqSchema = z.int().positive().optional();
|
|
863
|
+
export const ResumeSchema = z.strictObject({ ord: z.int().nonnegative().optional(), gateSeq: GateSeqSchema });
|
|
842
864
|
// The manual reassign lever (crew#442): `cli` omitted lets the engine's council re-pick, the
|
|
843
865
|
// same shape the automatic stall-watchdog escalation uses for an unknown failover target.
|
|
844
866
|
const ReassignSchema = z.strictObject({
|
|
845
867
|
ord: z.int().nonnegative().optional(),
|
|
868
|
+
/** (crew#1698) The gate opening a gated reassign answers (see `ResumeSchema`). */
|
|
869
|
+
gateSeq: GateSeqSchema,
|
|
846
870
|
cli: z.string().min(1).optional(),
|
|
847
871
|
/** crew#1153: an operator note that rides a GATED reassign as the approve's amendment. Trimmed in
|
|
848
872
|
* 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 +1039,7 @@ export const ChatOpenSchema = z.strictObject({
|
|
|
1015
1039
|
}).optional(),
|
|
1016
1040
|
requestId: z.string().trim().min(1).max(128).optional(),
|
|
1017
1041
|
/** (api-types 0.192.0) What the client renders (`['job']`). */
|
|
1018
|
-
accepts: z.array(z.enum(['job', 'onboard'])).max(4).optional(),
|
|
1042
|
+
accepts: z.array(z.enum(['job', 'onboard', 'cut'])).max(4).optional(),
|
|
1019
1043
|
}).refine((b) => b.seed === undefined || (b.requestId !== undefined && b.chatId === undefined), {
|
|
1020
1044
|
path: ['seed'],
|
|
1021
1045
|
error: 'seed needs requestId and no chatId: the chat id derives from you and the request',
|
|
@@ -1173,6 +1197,7 @@ runtime = {}) {
|
|
|
1173
1197
|
return null;
|
|
1174
1198
|
} })(),
|
|
1175
1199
|
};
|
|
1200
|
+
registerDeskSnoozeRoutes(app, { snoozes: new DeskSnoozes(audit) });
|
|
1176
1201
|
registerVoiceRoutes(app, { voice: voice.service, tts: voice.tts ?? new TtsService({ dir: defaultVoiceDir() }), dashboard: voice.dashboard, audit });
|
|
1177
1202
|
const voiceInputs = runtime.voiceInputs ?? new VoiceInjectInputs();
|
|
1178
1203
|
const openWithOs = runtime.openWithOs ?? openWithSystemDefault;
|
|
@@ -1212,10 +1237,13 @@ runtime = {}) {
|
|
|
1212
1237
|
'demo',
|
|
1213
1238
|
];
|
|
1214
1239
|
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 };
|
|
1240
|
+
? { context: true, instructions: true, proposals: true, create: true, refine: true, theme: true, demo: true, stub: true, stubOps, onboard: true, cutInView: true, cut: true }
|
|
1241
|
+
: { context: true, instructions: true, proposals: true, create: realCreate, refine: realRefine, theme: true, demo: false, onboard: true, cutInView: true, cut: true };
|
|
1217
1242
|
const proposalLaunchers = new LaunchOnceRegistry();
|
|
1218
1243
|
proposalLaunchers.register('theme', new ThemeLauncher());
|
|
1244
|
+
// studio#1140 (a): Go on a cut card posts its frozen ops to the video tool's recut (real in the test configuration
|
|
1245
|
+
// too: it starts no run, and the video tool is the authority on every change).
|
|
1246
|
+
proposalLaunchers.register('cut', new CutLauncher({ bridgeFor: (projectId) => cutBridgeFor(projectId) }));
|
|
1219
1247
|
// crew-0182: what an onboard card is resolved and its Go is checked against (one set of reads for both).
|
|
1220
1248
|
// crew#1744: the one `git_url` reader (GET /repos, the repo search; the daemon hands the review service the same).
|
|
1221
1249
|
const repoOrigins = runtime.repoOrigins ?? new RepoOrigins();
|
|
@@ -1294,8 +1322,13 @@ runtime = {}) {
|
|
|
1294
1322
|
await deliveryResolver.settle(views, runtime.deliverySettleMs);
|
|
1295
1323
|
};
|
|
1296
1324
|
// 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
|
|
1325
|
+
// the DTO is assembled (read-only; once per run, kept across starts: crew#1880, `backfillEnded`).
|
|
1298
1326
|
const backfillEndedAt = async (views) => {
|
|
1327
|
+
// crew#1880: the adapter answers from facts kept across starts and one log read shared with the identity.
|
|
1328
|
+
if (typeof adapter.runEndedFact === 'function') {
|
|
1329
|
+
await runTimingIndex.backfillEnded(views, (view) => adapter.runEndedFact(view));
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1299
1332
|
if (typeof adapter.runEvents !== 'function')
|
|
1300
1333
|
return;
|
|
1301
1334
|
await runTimingIndex.backfillEndedFromEvents(views, (id) => adapter.runEvents(id));
|
|
@@ -1384,6 +1417,10 @@ runtime = {}) {
|
|
|
1384
1417
|
registry: editorRegistry,
|
|
1385
1418
|
adapter,
|
|
1386
1419
|
broadcast,
|
|
1420
|
+
// crew#1703: a pack's skills join the daemon skills root and are published as POST /skills/publish does; its
|
|
1421
|
+
// blocks become presets in the engine's store, checked against its phase catalog.
|
|
1422
|
+
skills: runtime.skills === undefined ? null : packSkillsPort(runtime.skills),
|
|
1423
|
+
presets: adapter,
|
|
1387
1424
|
packCheck: runtime.packCheck ?? gardenPackCheck(discoverLivePlugin()?.path ?? null),
|
|
1388
1425
|
conformance: runtime.editorConformance ?? engineConformance({ provision: editorConformanceRuntime }),
|
|
1389
1426
|
// F37: the grant write's §6.4 tripwire asks the engine whether a bearer is a governed unit's token.
|
|
@@ -1898,6 +1935,9 @@ runtime = {}) {
|
|
|
1898
1935
|
// assurance contract); a one-CLI full-assurance launch answers `assuranceNotice`. A route set
|
|
1899
1936
|
// that cannot probe the addon reports no capability — never an invented one.
|
|
1900
1937
|
reducedAssurance: typeof adapter.engineCapabilities === 'function' && addonSupportsReducedAssurance(),
|
|
1938
|
+
// (DES-STANDIN-001 §4, K2a) `POST /runs` asks the stand-in question (409 `stand_in_choice`), takes
|
|
1939
|
+
// `standIns: true`, the `standInReview` setting and the `use_stand_ins` gate answer: the linked engine carries them.
|
|
1940
|
+
standIns: typeof adapter.supportsStandIns === 'function' && adapter.supportsStandIns(),
|
|
1901
1941
|
// QE-IN-APP-WORKFLOWS: `LaunchRunBody.skipQeAcceptance` / `forceQeAcceptance` reach an addon
|
|
1902
1942
|
// that carries the QE decision; never an invented capability.
|
|
1903
1943
|
qeAcceptanceOverride: typeof adapter.engineCapabilities === 'function' && addonSupportsQeOverride(),
|
|
@@ -2000,6 +2040,8 @@ runtime = {}) {
|
|
|
2000
2040
|
const acpFoldCache = new AcpFoldCache();
|
|
2001
2041
|
const engineVersionCache = new EngineVersionCache();
|
|
2002
2042
|
const floorCacheCache = new FloorCacheCache();
|
|
2043
|
+
// crew#1126: what wicked holds on the state-home volume, read only when the disk row is low (60 s cache).
|
|
2044
|
+
const diskStoresCache = new DiskStoreCache(async (volumePath, deadline) => readDiskStores({ volumePath, deadline, floorCache: () => floorCacheCache.getRaw(), repos: await adapter.listRepos() }));
|
|
2003
2045
|
// The governance block (crew#495): the store the engine's emit seam writes to (as the adapter
|
|
2004
2046
|
// exported it — `null` on a boot that resolved none), its record count through the engine
|
|
2005
2047
|
// binding when the addon has one, and the dead-letter outbox folded on change. Built at boot so
|
|
@@ -2895,6 +2937,11 @@ runtime = {}) {
|
|
|
2895
2937
|
return reply.code(400).send(invalidBody(parsed.error, 'Invalid request body'));
|
|
2896
2938
|
}
|
|
2897
2939
|
const b = { ...parsed.data };
|
|
2940
|
+
// (DES-STANDIN-001 §3.8) Consent to stand-ins is a person's: a worker's or agent's bearer may only inherit the
|
|
2941
|
+
// consent a person already gave (the `standInReview` setting), never send its own.
|
|
2942
|
+
if (b.standIns === true && !isHumanOperator(req.actor)) {
|
|
2943
|
+
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}` });
|
|
2944
|
+
}
|
|
2898
2945
|
// DES-CATALOG-002 §4.4: the words as the person gave them, before crew's framing line (the envelope's `words`, which
|
|
2899
2946
|
// a reshape relaunches from), with any block an earlier launch appended taken out.
|
|
2900
2947
|
const envelopeWords = stripLinkedIssues(stripRulesBrief(b.problem));
|
|
@@ -3153,6 +3200,52 @@ runtime = {}) {
|
|
|
3153
3200
|
input.baseRef = ex.baseRef;
|
|
3154
3201
|
reviewChange = { target: ex.target, provenance: ex.provenance, runs: ex.runs, excluded, headSha: ex.headSha };
|
|
3155
3202
|
}
|
|
3203
|
+
// (DES-STANDIN-001 §4, K2a) THE STAND-IN CHOICE, before anything is written: the engine's preflight says which
|
|
3204
|
+
// independent roles this launch's roster is short of, on the shape it would take. Short with no consent → the 409
|
|
3205
|
+
// the launcher's caller draws as the choice; with consent (the person's `standIns`, or the `standInReview:
|
|
3206
|
+
// 'always'` setting) the run launches stand-in-aware and fills a short role with a labelled stand-in. A review
|
|
3207
|
+
// (review-change, the prepared reviews, run-evals), a demo and a reduced launch keep today's path (K2a scope).
|
|
3208
|
+
const standInEligible = b.reducedAssurance !== true && reviewChange === undefined
|
|
3209
|
+
&& !(b.workflow !== undefined && (reviewPrepared(b.workflow) || b.workflow === RUN_EVALS_WORKFLOW || DEMO_PRESETS.includes(b.workflow)));
|
|
3210
|
+
const standInsSupported = typeof adapter.supportsStandIns === 'function' && adapter.supportsStandIns();
|
|
3211
|
+
if (b.standIns === true && !standInEligible) {
|
|
3212
|
+
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' });
|
|
3213
|
+
}
|
|
3214
|
+
if (b.standIns === true && !standInsSupported) {
|
|
3215
|
+
return reply.code(501).send({ error: 'stand-in checks need a wicked-core-ts that carries them (Core.independencePreflight and grantStandIns); upgrade the engine' });
|
|
3216
|
+
}
|
|
3217
|
+
// A draining daemon refuses the launch before it asks anything (the choice would only lead to the 503).
|
|
3218
|
+
if (typeof adapter.isDraining === 'function' && adapter.isDraining())
|
|
3219
|
+
return reply.code(503).send(maintenanceDrainBody(new MaintenanceDrainError()));
|
|
3220
|
+
if (standInEligible && standInsSupported) {
|
|
3221
|
+
const setting = await Promise.resolve().then(() => adapter.getSettings()).then((s) => s.standInReview).catch(() => undefined);
|
|
3222
|
+
const consent = consentFor(b.standIns === true, setting, `${req.actor.id} (${req.actor.kind})`);
|
|
3223
|
+
// The launcher that can show the choice asks the preflight with or without consent (codex r1 on b7-standin):
|
|
3224
|
+
// consent answers only the choice; a role no signed-in helper can stand in for is no_usable_helper either way.
|
|
3225
|
+
let preflight = null;
|
|
3226
|
+
if (ctx.standInChoice === true) {
|
|
3227
|
+
try {
|
|
3228
|
+
preflight = readPreflight(await adapter.independencePreflight(input));
|
|
3229
|
+
}
|
|
3230
|
+
catch (err) {
|
|
3231
|
+
// The engine refuses the shape as the launch would: the launch's own refusal, before anything is written.
|
|
3232
|
+
return reply.code(400).send({ error: `the launch was refused: ${message(err)}` });
|
|
3233
|
+
}
|
|
3234
|
+
// No helper signed in at all: the engine's own launch refusal (`no_eligible_seat`) names each benched seat, its
|
|
3235
|
+
// cause and the remedy; there is nothing a stand-in could stand in from.
|
|
3236
|
+
const refusal = preflight === null || preflight.signedIn.length === 0 ? null : preflightRefusal(preflight);
|
|
3237
|
+
if (refusal !== null && (consent === null || refusal.code === 'no_usable_helper'))
|
|
3238
|
+
return reply.code(409).send(refusal);
|
|
3239
|
+
}
|
|
3240
|
+
if (consent !== null) {
|
|
3241
|
+
input.standInAware = true;
|
|
3242
|
+
input.standIn = consent;
|
|
3243
|
+
}
|
|
3244
|
+
else if (preflight !== null) {
|
|
3245
|
+
// Not short: launched aware, so a seat lost mid-run holds at the stand-in gate instead of failing.
|
|
3246
|
+
input.standInAware = true;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3156
3249
|
// DES-L9 / crew#550 — REVISION: `revisesPr` names an OPEN same-repository pull request whose
|
|
3157
3250
|
// head branch becomes the run's base (`baseRef`, crew-internal → the engine's
|
|
3158
3251
|
// `LaunchSpec.base_ref`) and the push target of the composed deliver phase — the PR gains
|
|
@@ -3551,6 +3644,8 @@ runtime = {}) {
|
|
|
3551
3644
|
// DES-CATALOG-002 §4.4: the shape it was launched as, what it was launched with, and the proposal behind it.
|
|
3552
3645
|
...(b.shape !== undefined ? { shape: launchShapeOf(b.shape) } : {}),
|
|
3553
3646
|
...(ctx.fromProposal !== undefined ? { fromProposal: ctx.fromProposal } : {}),
|
|
3647
|
+
// crew#372: what a compose launched with (its requirements, level and steps), the only source publish trusts.
|
|
3648
|
+
...(ctx.target === 'compose' && ctx.compose !== undefined ? { compose: ctx.compose } : {}),
|
|
3554
3649
|
envelope: {
|
|
3555
3650
|
words: envelopeWords,
|
|
3556
3651
|
...(b.repoRef !== undefined ? { repoRef: b.repoRef } : {}),
|
|
@@ -3625,7 +3720,10 @@ runtime = {}) {
|
|
|
3625
3720
|
const skillsWarning = skillsAhead === null ? {} : { skillsWarning: { kind: skillsAhead.kind, severity: skillsAhead.severity, message: skillsAhead.message } };
|
|
3626
3721
|
// wicked-core#850: a full-assurance run on a one-CLI roster will wait at a gate for a seat that
|
|
3627
3722
|
// can evaluate or judge it; the answer names the explicit opt-in to relaunch with.
|
|
3628
|
-
|
|
3723
|
+
// (DES-STANDIN-001 §7.3) A stand-in-aware run asked its question before launching: no reduced-assurance offer.
|
|
3724
|
+
const notice = input.standInAware === true
|
|
3725
|
+
? null
|
|
3726
|
+
: launchAssuranceNotice({ runId, reducedAssurance: b.reducedAssurance, coverage: readJudgeCoverage(engineRosterJson(input.clisJson), input.repoRef !== undefined, runtime.judgeCoverage ?? CoreAdapter.judgeCoverage) });
|
|
3629
3727
|
const assuranceNotice = notice === null ? {} : { assuranceNotice: notice };
|
|
3630
3728
|
// (program DES-POWER-MODE) Whether the run is in power mode, and why not when it was wanted.
|
|
3631
3729
|
const power = { ...(input.power === true ? { power: true } : {}), ...(powerNotice !== null ? { powerNotice } : {}), ...(humanConfirmNotice !== null ? { humanConfirmNotice } : {}) };
|
|
@@ -3709,12 +3807,13 @@ runtime = {}) {
|
|
|
3709
3807
|
// wicked-core#461 — see the catch below); 400: zod reject or a retryOf naming no
|
|
3710
3808
|
// existing run; 422: the base-skill intake refusal (`base_skill_refused`, crew#554);
|
|
3711
3809
|
// 501: campaignId attach on an engine addon without the campaign bindings ("upgrade
|
|
3712
|
-
// the engine")
|
|
3713
|
-
|
|
3810
|
+
// the engine"); 403: `standIns` from a worker's bearer; 409 `stand_in_choice` / `no_usable_helper`: the
|
|
3811
|
+
// stand-in question (DES-STANDIN-001 §4).
|
|
3812
|
+
statusCodes: [201, 400, 403, 404, 409, 422, 501, 503],
|
|
3714
3813
|
},
|
|
3715
3814
|
},
|
|
3716
3815
|
}, async (req, reply) => {
|
|
3717
|
-
const launch = () => launchRun(req.body, { actor: actorOf(req), log: req.log });
|
|
3816
|
+
const launch = () => launchRun(req.body, { actor: actorOf(req), log: req.log, standInChoice: true });
|
|
3718
3817
|
const parsed = LaunchSchema.safeParse(req.body);
|
|
3719
3818
|
const out = parsed.success && parsed.data.chatId !== undefined
|
|
3720
3819
|
? await chatProposals.admitChat(parsed.data.chatId, launch)
|
|
@@ -4562,6 +4661,8 @@ runtime = {}) {
|
|
|
4562
4661
|
const chatAccepts = new Map();
|
|
4563
4662
|
/** (crew-0182) Chats whose client draws onboard cards (`accepts: ['onboard']`), by its newest declaration. */
|
|
4564
4663
|
const chatAcceptsOnboard = new Map();
|
|
4664
|
+
/** (studio#1140 (a)) Chats whose client draws cut cards (`accepts: ['cut']`), by its newest declaration. */
|
|
4665
|
+
const chatAcceptsCut = new Map();
|
|
4565
4666
|
/** (crew-0182) What a chat seat is told exists here: every project with its repositories, every registered repository. */
|
|
4566
4667
|
const readDaemonGrounding = async (chatId, accepts) => {
|
|
4567
4668
|
try {
|
|
@@ -4809,6 +4910,7 @@ runtime = {}) {
|
|
|
4809
4910
|
// A refused open (409 above) never touched the live chat's (codex r3).
|
|
4810
4911
|
chatAccepts.set(chatId, openAccepts);
|
|
4811
4912
|
chatAcceptsOnboard.set(chatId, b.accepts?.includes('onboard') === true);
|
|
4913
|
+
chatAcceptsCut.set(chatId, b.accepts?.includes('cut') === true);
|
|
4812
4914
|
// DC-S7: the in-force rules the statement lists; recorded as "told" only once the open succeeds.
|
|
4813
4915
|
let inForceAtOpen = [];
|
|
4814
4916
|
// Everything below either ends in `chatScopes.set(chatId, …, token)` or releases the reservation.
|
|
@@ -5090,7 +5192,7 @@ runtime = {}) {
|
|
|
5090
5192
|
/** (api-types 0.169.0, DES-CHAT-ARTIFACTS-001 §5.1) What studio shows beside the message. */
|
|
5091
5193
|
context: ChatMessageContextSchema.optional(),
|
|
5092
5194
|
/** (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(),
|
|
5195
|
+
accepts: z.array(z.enum(['job', 'onboard', 'cut'])).max(4).optional(),
|
|
5094
5196
|
});
|
|
5095
5197
|
// DES-CHAT-ARTIFACTS-001 §5.1 (A1): what a turn's block reads — the docs roots, the decorated runs (project,
|
|
5096
5198
|
// document and chat ids), unit outputs and the acceptance line. One set of deps, so the block and the run pages
|
|
@@ -5104,6 +5206,7 @@ runtime = {}) {
|
|
|
5104
5206
|
const g = readGroundingBeneath(root, doc);
|
|
5105
5207
|
return g !== null && 'style' in g ? g.style : undefined;
|
|
5106
5208
|
},
|
|
5209
|
+
cutBridge: (projectId) => cutBridgeFor(projectId),
|
|
5107
5210
|
};
|
|
5108
5211
|
// DES-CHAT-ARTIFACTS-001 §4 (A2): proposals. Resolved from crew's own records (the same reads the turn block uses);
|
|
5109
5212
|
// records go to the live transcript, or the kept history copy once the chat has ended.
|
|
@@ -5335,6 +5438,8 @@ runtime = {}) {
|
|
|
5335
5438
|
},
|
|
5336
5439
|
acceptsJobs: (chatId) => chatAccepts.get(chatId) === true,
|
|
5337
5440
|
acceptsOnboard: (chatId) => chatAcceptsOnboard.get(chatId) === true,
|
|
5441
|
+
acceptsCut: (chatId) => chatArtifactFlags.cut === true && chatAcceptsCut.get(chatId) === true,
|
|
5442
|
+
cut: { bridgeFor: (projectId) => cutBridgeFor(projectId) },
|
|
5338
5443
|
onboard: {
|
|
5339
5444
|
...onboardReads,
|
|
5340
5445
|
originOf,
|
|
@@ -5469,6 +5574,7 @@ runtime = {}) {
|
|
|
5469
5574
|
if (parsed.data.accepts !== undefined) {
|
|
5470
5575
|
chatAccepts.set(id, parsed.data.accepts.includes('job'));
|
|
5471
5576
|
chatAcceptsOnboard.set(id, parsed.data.accepts.includes('onboard'));
|
|
5577
|
+
chatAcceptsCut.set(id, parsed.data.accepts.includes('cut'));
|
|
5472
5578
|
}
|
|
5473
5579
|
after();
|
|
5474
5580
|
if (preface !== null)
|
|
@@ -5583,7 +5689,7 @@ runtime = {}) {
|
|
|
5583
5689
|
// A7: a seat is told it can propose a studio theme only when this message carried the tab's appearance (a client
|
|
5584
5690
|
// that can preview and apply one sends it).
|
|
5585
5691
|
// 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 };
|
|
5692
|
+
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
5693
|
// DES-CATALOG-002 §2.3, §4.6: the per-message job lines (the chat catalog digest, the open proposal, the held plan),
|
|
5588
5694
|
// read here, before the last check (no await after it). Never in an analysis.
|
|
5589
5695
|
// The declaration this message's instructions are written for: its own, else the chat's (applied to the chat only
|
|
@@ -5605,6 +5711,8 @@ runtime = {}) {
|
|
|
5605
5711
|
context: msgContext,
|
|
5606
5712
|
records: chatTranscripts?.read(id) ?? [],
|
|
5607
5713
|
attachmentIds: chatAttachments.list(id).map((a) => a.id),
|
|
5714
|
+
// This message's own declaration, else the chat's (the reply to this turn is resolved the same way).
|
|
5715
|
+
acceptsCut: chatArtifactFlags.cut === true && (parsed.data.accepts !== undefined ? parsed.data.accepts.includes('cut') : chatAcceptsCut.get(id) === true),
|
|
5608
5716
|
}, chatContextDeps);
|
|
5609
5717
|
contextBlock = built.block;
|
|
5610
5718
|
turnBinding = built.binding;
|
|
@@ -5726,6 +5834,11 @@ runtime = {}) {
|
|
|
5726
5834
|
],
|
|
5727
5835
|
}
|
|
5728
5836
|
: {}),
|
|
5837
|
+
// wicked-core#1463: an "All repos" chat reads every registered repository; a unit whose
|
|
5838
|
+
// repositories pass the container copy-in's cap leaves out those that do not fit (each
|
|
5839
|
+
// with a note in its place) instead of failing every turn. A repo or project scope names
|
|
5840
|
+
// what the person asked about, so its repositories stay required.
|
|
5841
|
+
...(scope?.kind === 'everything' && readRoots.length > 0 ? { optionalReadRoots: [...readRoots] } : {}),
|
|
5729
5842
|
};
|
|
5730
5843
|
const runId = await adapter.launchRun(input);
|
|
5731
5844
|
// The scope's roots (not the attachments directory) are what a later turn compares against.
|
|
@@ -6668,6 +6781,12 @@ runtime = {}) {
|
|
|
6668
6781
|
...(refusal !== undefined ? { refusal } : {}),
|
|
6669
6782
|
...(gateKind !== undefined ? { gateKind } : {}),
|
|
6670
6783
|
...(frame !== undefined ? offeredChoices(frame) : {}),
|
|
6784
|
+
// (crew#1698) The opening the record shows: the row's `gate_seq` only, the one an answer is checked
|
|
6785
|
+
// against (a frame's beside an unnumbered row would be an opening no answer could name).
|
|
6786
|
+
...(() => {
|
|
6787
|
+
const seq = gateSeqOf(durableGate['gate_seq']);
|
|
6788
|
+
return seq !== undefined ? { gateSeq: seq } : {};
|
|
6789
|
+
})(),
|
|
6671
6790
|
};
|
|
6672
6791
|
}
|
|
6673
6792
|
const events = await adapter.runEvents(id);
|
|
@@ -6717,7 +6836,7 @@ runtime = {}) {
|
|
|
6717
6836
|
* cursor unit) — an engine, or a run, older than the table.
|
|
6718
6837
|
*/
|
|
6719
6838
|
async function gateForDecision(run, namedOrd, opts = {}) {
|
|
6720
|
-
const decided = await gateOfRecord(run, namedOrd);
|
|
6839
|
+
const decided = await gateOfRecord(run, namedOrd, opts.gateSeq);
|
|
6721
6840
|
// DES-CATALOG-002 §4.6 (codex r1): a plan held for a run launched from a chat proposal is approved only by an
|
|
6722
6841
|
// answer bound to its version (`POST /runs/:id/gate` with `planRev`); every other approving path (a gated resume or
|
|
6723
6842
|
// reassign, a plan edit at the gate, a standing order) is refused there. Declining stays open.
|
|
@@ -6739,7 +6858,7 @@ runtime = {}) {
|
|
|
6739
6858
|
}
|
|
6740
6859
|
return decided;
|
|
6741
6860
|
}
|
|
6742
|
-
async function gateOfRecord(run, namedOrd) {
|
|
6861
|
+
async function gateOfRecord(run, namedOrd, namedSeq) {
|
|
6743
6862
|
const id = run.session.id;
|
|
6744
6863
|
const unitAt = (ord) => (run.units ?? []).find((u) => u.ord === ord);
|
|
6745
6864
|
const unknown = (why) => ({ refusal: { code: 409, body: { error: `Gate unknown: ${why} — refresh and decide again.`, code: 'gate_unknown' } } });
|
|
@@ -6757,15 +6876,38 @@ runtime = {}) {
|
|
|
6757
6876
|
} } };
|
|
6758
6877
|
}
|
|
6759
6878
|
const kind = recorded.row['gate_kind'];
|
|
6760
|
-
|
|
6879
|
+
// (core#1808) Which opening of the gate the record shows: a `use_stand_ins` answer names it to the engine.
|
|
6880
|
+
const seq = recorded.row['gate_seq'];
|
|
6881
|
+
const openSeq = typeof seq === 'number' && Number.isInteger(seq) && seq > 0 ? seq : undefined;
|
|
6882
|
+
// (crew#1698) An answer naming another opening of this gate (closed and re-opened since, same ord too).
|
|
6883
|
+
if (namedSeq !== undefined && namedSeq !== openSeq) {
|
|
6884
|
+
return openSeq === undefined
|
|
6885
|
+
? unknown(`this decision names opening ${namedSeq} of the gate before unit ${recorded.ord}, but the engine's record does not number its openings`)
|
|
6886
|
+
: { refusal: { code: 409, body: {
|
|
6887
|
+
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.`,
|
|
6888
|
+
code: 'gate_changed',
|
|
6889
|
+
openOrd: recorded.ord,
|
|
6890
|
+
openGateSeq: openSeq,
|
|
6891
|
+
} } };
|
|
6892
|
+
}
|
|
6893
|
+
return {
|
|
6894
|
+
ord: recorded.ord,
|
|
6895
|
+
gated: unitAt(recorded.ord),
|
|
6896
|
+
prompt: recorded.row.prompt,
|
|
6897
|
+
gateKind: typeof kind === 'string' && kind !== '' ? kind : undefined,
|
|
6898
|
+
...(openSeq !== undefined ? { gateSeq: openSeq } : {}),
|
|
6899
|
+
};
|
|
6761
6900
|
}
|
|
6762
|
-
if (namedOrd !== undefined) {
|
|
6763
|
-
return unknown(`this decision names the gate before unit ${namedOrd}, but the engine's record `
|
|
6901
|
+
if (namedOrd !== undefined || namedSeq !== undefined) {
|
|
6902
|
+
return unknown(`this decision names the gate${namedOrd !== undefined ? ` before unit ${namedOrd}` : ` opening ${namedSeq ?? ''}`}, but the engine's record `
|
|
6764
6903
|
+ `${recorded === null ? 'keeps no durable gate row' : 'shows no open gate'} for this run, so the daemon cannot confirm the named one`);
|
|
6765
6904
|
}
|
|
6766
6905
|
const open = await resolveOpenGate(id).catch(() => null);
|
|
6767
|
-
if (isOpenGate(open))
|
|
6906
|
+
if (isOpenGate(open)) {
|
|
6907
|
+
// (crew#1698, codex delta) No open durable row: no opening is bound (only a row the addon wrote numbers one, and
|
|
6908
|
+
// only an addon that writes `gate_seq` takes the expectation), whatever a cached or logged frame says.
|
|
6768
6909
|
return { ord: open.ord, gated: unitAt(open.ord), prompt: open.prompt, gateKind: open.gateKind };
|
|
6910
|
+
}
|
|
6769
6911
|
const gated = [...(run.units ?? [])].sort((a, b) => a.ord - b.ord)[run.session.unit_ix];
|
|
6770
6912
|
return { ord: undefined, gated, prompt: undefined, gateKind: undefined };
|
|
6771
6913
|
}
|
|
@@ -6890,6 +7032,17 @@ runtime = {}) {
|
|
|
6890
7032
|
},
|
|
6891
7033
|
};
|
|
6892
7034
|
}
|
|
7035
|
+
// (DES-STANDIN-001 §3.8) Consent to stand-ins is a person's: a seat's token or a standing order is refused.
|
|
7036
|
+
if (parsed.data.action === USE_STAND_INS_ACTION && !isHumanOperator(actor)) {
|
|
7037
|
+
audit.record('gate.stand_ins_refused', actor, {
|
|
7038
|
+
runId: id,
|
|
7039
|
+
detail: { reason: 'human_operator_only', ...(parsed.data.ord !== undefined ? { ord: parsed.data.ord } : {}) },
|
|
7040
|
+
});
|
|
7041
|
+
return {
|
|
7042
|
+
code: 403,
|
|
7043
|
+
body: { error: `only a person can consent to stand-in checks (you are ${actor.kind}/${actor.trust})`, code: 'human_operator_only' },
|
|
7044
|
+
};
|
|
7045
|
+
}
|
|
6893
7046
|
if (parsed.data.action === SKIP_QE_ACTION && !isHumanOperator(actor)) {
|
|
6894
7047
|
audit.record('gate.skip_qe_refused', actor, {
|
|
6895
7048
|
runId: id,
|
|
@@ -6913,11 +7066,14 @@ runtime = {}) {
|
|
|
6913
7066
|
// Decision integrity (api-types 0.44.0; crew#1083 rounds 3–5): the gate this decision answers
|
|
6914
7067
|
// is the RECORD's — read first thing inside the lock, so the gated unit and its delivery
|
|
6915
7068
|
// 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 });
|
|
7069
|
+
const decided = await gateForDecision(run, parsed.data.ord, { declining: !parsed.data.approve, versioned: true, ...(parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) });
|
|
6917
7070
|
if ('refusal' in decided) {
|
|
6918
7071
|
const r = decided.refusal.body;
|
|
6919
7072
|
return r?.code === 'gate_changed' ? { code: decided.refusal.code, body: { ...(await currentPlanOf(id, false)), ...r } } : decided.refusal;
|
|
6920
7073
|
}
|
|
7074
|
+
if (parsed.data.action === USE_STAND_INS_ACTION) {
|
|
7075
|
+
return useStandInsAtGate(id, decided, parsed.data.scope ?? 'job', actor, parsed.data.input, extraDetail);
|
|
7076
|
+
}
|
|
6921
7077
|
// (wicked-core#1683) A noted Land that skips open steering rules is the same human-only
|
|
6922
7078
|
// decision as skip_rules. Read its rules under the decision lock and keep them for the audit.
|
|
6923
7079
|
const landNote = parsed.data.amend?.trim() ?? '';
|
|
@@ -7015,8 +7171,8 @@ runtime = {}) {
|
|
|
7015
7171
|
// gate ("judged by operator").
|
|
7016
7172
|
adapter.recordGateActor?.(id, `${actor.id} (${actor.kind})`);
|
|
7017
7173
|
const expect = parsed.data.planRev !== undefined
|
|
7018
|
-
? { ...expectFor(decided.ord), planRev: parsed.data.planRev }
|
|
7019
|
-
: expectFor(decided.ord);
|
|
7174
|
+
? { ...expectFor(decided.ord, decided.gateSeq), planRev: parsed.data.planRev }
|
|
7175
|
+
: expectFor(decided.ord, decided.gateSeq);
|
|
7020
7176
|
const confirmArgs = [
|
|
7021
7177
|
id,
|
|
7022
7178
|
parsed.data.approve,
|
|
@@ -7119,13 +7275,81 @@ runtime = {}) {
|
|
|
7119
7275
|
}
|
|
7120
7276
|
});
|
|
7121
7277
|
}
|
|
7278
|
+
/**
|
|
7279
|
+
* (DES-STANDIN-001 §3.10, crew#1856) `{approve: true, action: 'use_stand_ins', scope}` at a `stand_in_needed` gate:
|
|
7280
|
+
* the engine's `grantStandIns` with the open gate's opening (`gateSeq`, from the record) and the person as `actor`,
|
|
7281
|
+
* so a gate that closed and re-opened since is refused `gate_changed`. `always` also saves `standInReview:
|
|
7282
|
+
* 'always'` (after the grant took: a refused grant changes nothing). Runs inside {@link decideExclusively}.
|
|
7283
|
+
*/
|
|
7284
|
+
async function useStandInsAtGate(id, decided, scope, actor, input, extraDetail) {
|
|
7285
|
+
if (decided.gateKind !== STAND_IN_NEEDED_GATE) {
|
|
7286
|
+
return { code: 409, body: {
|
|
7287
|
+
code: 'gate_changed',
|
|
7288
|
+
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.`,
|
|
7289
|
+
...(decided.ord !== undefined ? { openOrd: decided.ord } : {}),
|
|
7290
|
+
} };
|
|
7291
|
+
}
|
|
7292
|
+
if (decided.gateSeq === undefined) {
|
|
7293
|
+
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.' } };
|
|
7294
|
+
}
|
|
7295
|
+
if (typeof adapter.grantStandIns !== 'function' || typeof adapter.supportsStandIns !== 'function' || !adapter.supportsStandIns()) {
|
|
7296
|
+
return { code: 501, body: { error: 'Using stand-ins at a gate needs a wicked-core-ts with Core.grantStandIns; upgrade the engine' } };
|
|
7297
|
+
}
|
|
7298
|
+
const who = `${actor.id} (${actor.kind})`;
|
|
7299
|
+
let status;
|
|
7300
|
+
try {
|
|
7301
|
+
status = await adapter.grantStandIns(id, scope, decided.gateSeq, who, decided.ord);
|
|
7302
|
+
}
|
|
7303
|
+
catch (err) {
|
|
7304
|
+
if (err instanceof MaintenanceDrainError)
|
|
7305
|
+
return { code: 503, body: maintenanceDrainBody(err) };
|
|
7306
|
+
const changed = await gateChangedRefusal(id, err);
|
|
7307
|
+
if (changed !== null)
|
|
7308
|
+
return changed;
|
|
7309
|
+
return { code: 409, body: { error: message(err) } };
|
|
7310
|
+
}
|
|
7311
|
+
let setting;
|
|
7312
|
+
if (scope === 'always') {
|
|
7313
|
+
try {
|
|
7314
|
+
await adapter.updateSettings({ standInReview: 'always' });
|
|
7315
|
+
audit.record('settings.updated', actor, { detail: { changed: ['standInReview'], via: 'gate', runId: id } });
|
|
7316
|
+
setting = 'saved';
|
|
7317
|
+
}
|
|
7318
|
+
catch (err) {
|
|
7319
|
+
// The grant took (this run goes on with stand-ins); only the standing choice failed to save, and the answer says so.
|
|
7320
|
+
setting = 'failed';
|
|
7321
|
+
audit.record('settings.update_failed', actor, { detail: { key: 'standInReview', via: 'gate', runId: id, error: message(err) } });
|
|
7322
|
+
}
|
|
7323
|
+
}
|
|
7324
|
+
audit.record('gate.decided', actor, {
|
|
7325
|
+
runId: id,
|
|
7326
|
+
detail: {
|
|
7327
|
+
approve: true,
|
|
7328
|
+
choice: USE_STAND_INS_ACTION,
|
|
7329
|
+
action: USE_STAND_INS_ACTION,
|
|
7330
|
+
scope,
|
|
7331
|
+
gateSeq: decided.gateSeq,
|
|
7332
|
+
...(decided.ord !== undefined ? { ord: decided.ord } : {}),
|
|
7333
|
+
...(input !== undefined ? { input } : {}),
|
|
7334
|
+
...extraDetail,
|
|
7335
|
+
status,
|
|
7336
|
+
},
|
|
7337
|
+
});
|
|
7338
|
+
return { code: 200, body: { status, ...(setting !== undefined ? { standInReview: setting } : {}) } };
|
|
7339
|
+
}
|
|
7122
7340
|
/** (DES-CATALOG-002 §4.6) The plan a gate holds now, for a `gate_changed` answer: its ord and revision, best-effort. */
|
|
7123
7341
|
async function currentPlanOf(runId, readGate = true) {
|
|
7124
7342
|
try {
|
|
7125
7343
|
// The caller that already read the open gate (and names its ord) asks for the plan revision only.
|
|
7126
7344
|
const recorded = readGate ? await recordedOpenGate(runId) : null;
|
|
7127
7345
|
const rev = openPlanGateRev(await busRows(adapter.busDbPath, runId));
|
|
7128
|
-
|
|
7346
|
+
// (crew#1698) …and the opening open now, as the daemon's own gate_changed says it.
|
|
7347
|
+
const openSeq = recorded?.state === 'open' ? gateSeqOf(recorded.row['gate_seq']) : undefined;
|
|
7348
|
+
return {
|
|
7349
|
+
...(recorded?.state === 'open' ? { openOrd: recorded.ord } : {}),
|
|
7350
|
+
...(openSeq !== undefined ? { openGateSeq: openSeq } : {}),
|
|
7351
|
+
...(rev !== undefined ? { planRev: rev } : {}),
|
|
7352
|
+
};
|
|
7129
7353
|
}
|
|
7130
7354
|
catch {
|
|
7131
7355
|
return {};
|
|
@@ -7135,8 +7359,12 @@ runtime = {}) {
|
|
|
7135
7359
|
function adapterSupportsPlanSendBack() {
|
|
7136
7360
|
return typeof adapter.supportsPlanSendBack === 'function' && adapter.supportsPlanSendBack();
|
|
7137
7361
|
}
|
|
7138
|
-
|
|
7139
|
-
|
|
7362
|
+
/** What a confirm expects the open gate to be: its ord and (crew#1698, core#1808) the opening the record showed, which
|
|
7363
|
+
* the engine compares inside its serialized decision, so a gate that re-opened after this read still loses. */
|
|
7364
|
+
function expectFor(decidedOrd, gateSeq) {
|
|
7365
|
+
return decidedOrd !== undefined && adapterSupportsPlanSendBack()
|
|
7366
|
+
? { ord: decidedOrd, ...(gateSeq !== undefined ? { gateSeq } : {}) }
|
|
7367
|
+
: undefined;
|
|
7140
7368
|
}
|
|
7141
7369
|
async function gateChangedRefusal(id, err) {
|
|
7142
7370
|
if (!/^gate_changed\b/u.test(message(err)))
|
|
@@ -7332,13 +7560,21 @@ runtime = {}) {
|
|
|
7332
7560
|
}
|
|
7333
7561
|
try {
|
|
7334
7562
|
const gated = run.session.status === 'awaiting_human';
|
|
7563
|
+
// (crew#1698, codex r1 on b7-standin) A resume naming a gate OPENING answers that gate: once it has closed,
|
|
7564
|
+
// nothing is resumed on its word.
|
|
7565
|
+
if (!gated && parsed.data.gateSeq !== undefined) {
|
|
7566
|
+
return reply.code(409).send({
|
|
7567
|
+
code: 'gate_changed',
|
|
7568
|
+
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.`,
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7335
7571
|
// A gated resume IS a gate approval, so it lands a steering-author proposal exactly like
|
|
7336
7572
|
// POST /runs/:id/gate would — the "no side door" rule (task #88) holds for the landing
|
|
7337
7573
|
// write too (crew#388). Prompt captured pre-confirm; see the gate route.
|
|
7338
7574
|
// A gated resume IS an approve, so it is judged by the record like every decision, passes the
|
|
7339
7575
|
// same delivery checks (freeze, EX-03) — no side door around the deliver gate — and answers
|
|
7340
7576
|
// with the gated unit's receipt.
|
|
7341
|
-
const decided = gated ? await gateForDecision(run, parsed.data.ord) : undefined;
|
|
7577
|
+
const decided = gated ? await gateForDecision(run, parsed.data.ord, parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) : undefined;
|
|
7342
7578
|
if (decided !== undefined && 'refusal' in decided)
|
|
7343
7579
|
return reply.code(decided.refusal.code).send(decided.refusal.body);
|
|
7344
7580
|
const steeringPropose = gated && isSteeringAuthorRun(run);
|
|
@@ -7355,7 +7591,7 @@ runtime = {}) {
|
|
|
7355
7591
|
const who = actorOf(req);
|
|
7356
7592
|
adapter.recordGateActor?.(id, `${who.id} (${who.kind})`);
|
|
7357
7593
|
}
|
|
7358
|
-
const status = gated ? await adapter.confirmGate(id, true, undefined, undefined, undefined, undefined, expectFor(decided?.ord)) : await adapter.resumeRun(id);
|
|
7594
|
+
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
7595
|
// A resume of a gated run IS a gate approval — audit it as one, so the
|
|
7360
7596
|
// "who approved" trail has no side door (task #88).
|
|
7361
7597
|
audit.record(gated ? 'gate.decided' : 'run.resumed', actorOf(req), {
|
|
@@ -7709,7 +7945,8 @@ runtime = {}) {
|
|
|
7709
7945
|
return actions
|
|
7710
7946
|
.filter((a) => declines(a) || !(a.action === SKIP_QE_ACTION ? skipRefused : approveRefused))
|
|
7711
7947
|
.filter((a) => !(steering && a.action === 'reassign'))
|
|
7712
|
-
.map((a) => (a.action === SKIP_QE_ACTION || a.action === SKIP_RULES_ACTION ||
|
|
7948
|
+
.map((a) => (a.action === SKIP_QE_ACTION || a.action === SKIP_RULES_ACTION || a.action === USE_STAND_INS_ACTION
|
|
7949
|
+
|| (a.action === 'approve' && a.noteIntent === 'skip_rules')
|
|
7713
7950
|
? { ...a, humanOnly: true } : a));
|
|
7714
7951
|
}
|
|
7715
7952
|
/**
|
|
@@ -7798,6 +8035,14 @@ runtime = {}) {
|
|
|
7798
8035
|
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
8036
|
});
|
|
7800
8037
|
}
|
|
8038
|
+
// (crew#1698, codex r1 on b7-standin) An answer naming a gate OPENING was made on a gate: once that gate has
|
|
8039
|
+
// closed (another decision released it before this one got the lock), it changes no running work.
|
|
8040
|
+
if (!gated && parsed.data.gateSeq !== undefined) {
|
|
8041
|
+
return reply.code(409).send({
|
|
8042
|
+
code: 'gate_changed',
|
|
8043
|
+
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.`,
|
|
8044
|
+
});
|
|
8045
|
+
}
|
|
7801
8046
|
const requestedCli = parsed.data.cli;
|
|
7802
8047
|
if (requestedCli !== undefined) {
|
|
7803
8048
|
const pool = Array.isArray(run.session.clis) ? run.session.clis : [];
|
|
@@ -7810,7 +8055,7 @@ runtime = {}) {
|
|
|
7810
8055
|
// A gated reassign APPROVES the gate, so it is judged by the record like every decision and passes
|
|
7811
8056
|
// the same delivery checks (freeze, wicked-core#850 EX-03) when the gate holds the deliver unit
|
|
7812
8057
|
// (codex r1 on the EX-03 PR).
|
|
7813
|
-
const decided = gated ? await gateForDecision(run, parsed.data.ord) : undefined;
|
|
8058
|
+
const decided = gated ? await gateForDecision(run, parsed.data.ord, parsed.data.gateSeq !== undefined ? { gateSeq: parsed.data.gateSeq } : {}) : undefined;
|
|
7814
8059
|
if (decided !== undefined && 'refusal' in decided)
|
|
7815
8060
|
return reply.code(decided.refusal.code).send(decided.refusal.body);
|
|
7816
8061
|
if (decided !== undefined) {
|
|
@@ -7858,7 +8103,7 @@ runtime = {}) {
|
|
|
7858
8103
|
return; // refused above for a gated run
|
|
7859
8104
|
const who = actorOf(req);
|
|
7860
8105
|
adapter.recordGateActor?.(id, `${who.id} (${who.kind})`);
|
|
7861
|
-
const status = await adapter.confirmGate(id, true, note, undefined, undefined, undefined, expectFor(decided?.ord));
|
|
8106
|
+
const status = await adapter.confirmGate(id, true, note, undefined, undefined, undefined, expectFor(decided?.ord, decided !== undefined && !('refusal' in decided) ? decided.gateSeq : undefined));
|
|
7862
8107
|
noteRode = note !== undefined;
|
|
7863
8108
|
audit.record('gate.decided', actorOf(req), {
|
|
7864
8109
|
runId: id,
|
|
@@ -8059,13 +8304,21 @@ runtime = {}) {
|
|
|
8059
8304
|
if (cached) {
|
|
8060
8305
|
const run = await runOf();
|
|
8061
8306
|
const servable = recorded === null
|
|
8062
|
-
|
|
8307
|
+
// (crew#1698) …and of the record's opening, when the row numbers it: a gate that re-opened at the
|
|
8308
|
+
// same ord while the pump was behind is not the cached one.
|
|
8309
|
+
|| (recorded.state === 'open' && cached.ord === recorded.ord
|
|
8310
|
+
&& (gateSeqOf(recorded.row['gate_seq']) === undefined || cached.gateSeq === gateSeqOf(recorded.row['gate_seq'])))
|
|
8063
8311
|
|| (recorded.state === 'none' && run?.session.status === 'awaiting_human');
|
|
8064
8312
|
if (servable) {
|
|
8065
8313
|
const offers = await offersAt(cached.ord, run);
|
|
8066
8314
|
if (offers === null)
|
|
8067
8315
|
return unavailable503();
|
|
8068
|
-
|
|
8316
|
+
// (crew#1698, codex delta) Beside an open durable row the opening is the ROW's only: a frame's number beside
|
|
8317
|
+
// an unnumbered row is one no answer could name (POST checks the row).
|
|
8318
|
+
const entry = { ...cached };
|
|
8319
|
+
delete entry.gateSeq;
|
|
8320
|
+
const rowSeq = recorded?.state === 'open' ? gateSeqOf(recorded.row['gate_seq']) : cached.gateSeq;
|
|
8321
|
+
return { runId: id, ...entry, ...(rowSeq !== undefined ? { gateSeq: rowSeq } : {}), ...offers };
|
|
8069
8322
|
}
|
|
8070
8323
|
gateCache.forget(id);
|
|
8071
8324
|
}
|
|
@@ -8098,9 +8351,15 @@ runtime = {}) {
|
|
|
8098
8351
|
// that read, the record is read once more (it may have moved on, legitimately, meanwhile): an
|
|
8099
8352
|
// answer that matches it is served; otherwise the entry is dropped and the gate resolved once
|
|
8100
8353
|
// more from the record, and if that still disagrees nothing verified is served.
|
|
8101
|
-
|
|
8354
|
+
// (crew#1698, codex delta) The opening too, when the row numbers it: a stale frame of an earlier opening at the
|
|
8355
|
+
// same ord is the same disagreement.
|
|
8356
|
+
const sameOpening = (o, r) => isOpenGate(o) && r?.state === 'open' && o.ord === r.ord
|
|
8357
|
+
&& (gateSeqOf(r.row['gate_seq']) === undefined || o.gateSeq === gateSeqOf(r.row['gate_seq']));
|
|
8358
|
+
let record = recorded;
|
|
8359
|
+
if (recorded?.state === 'open' && isOpenGate(open) && !sameOpening(open, recorded)) {
|
|
8102
8360
|
const now = await recordedOpenGate(id);
|
|
8103
|
-
|
|
8361
|
+
record = now;
|
|
8362
|
+
const matchesNow = (o) => sameOpening(o, now);
|
|
8104
8363
|
if (!matchesNow(open)) {
|
|
8105
8364
|
gateCache.forget(id);
|
|
8106
8365
|
open = await resolveOpenGate(id);
|
|
@@ -8140,6 +8399,13 @@ runtime = {}) {
|
|
|
8140
8399
|
const offers = await offersAt(open.ord, run);
|
|
8141
8400
|
if (offers === null)
|
|
8142
8401
|
return unavailable503();
|
|
8402
|
+
// (crew#1698, codex delta) Beside an open durable row, its opening only (see the cache-hit path above).
|
|
8403
|
+
if (record?.state === 'open') {
|
|
8404
|
+
const entry = { ...open };
|
|
8405
|
+
delete entry.gateSeq;
|
|
8406
|
+
const rowSeq = gateSeqOf(record.row['gate_seq']);
|
|
8407
|
+
return { runId: id, ...entry, ...(rowSeq !== undefined ? { gateSeq: rowSeq } : {}), ...offers };
|
|
8408
|
+
}
|
|
8143
8409
|
return { runId: id, ...open, ...offers };
|
|
8144
8410
|
});
|
|
8145
8411
|
// ── Elicitation (DES-002) ────────────────────────────────────────────────────
|
|
@@ -8568,13 +8834,16 @@ runtime = {}) {
|
|
|
8568
8834
|
return err?.code === 'ENOENT';
|
|
8569
8835
|
}
|
|
8570
8836
|
};
|
|
8837
|
+
const NOT_INDEXED = { error: 'this repository has no code graph yet: index it first', code: 'not_indexed' };
|
|
8838
|
+
// studio#1402 (codex r1): "not indexed" needs BOTH the engine's own open failure (it reads `open graph <db>: open
|
|
8839
|
+
// estate store read-only at "<db>": storage error: unable to open database file: <db>`) and a confirmed missing graph
|
|
8840
|
+
// file. Any other failure on such a repo (a binding drift, a bad answer) stays a server error, never "not indexed".
|
|
8841
|
+
const notIndexedFailure = async (repo, msg) => repoReadStatus(msg) === 500 && /unable to open database file/i.test(msg) && (await repoNotIndexed(repo));
|
|
8571
8842
|
const repoReadFailure = async (reply, repo, err) => {
|
|
8572
8843
|
const msg = message(err);
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
}
|
|
8577
|
-
return reply.code(status).send({ error: msg });
|
|
8844
|
+
if (await notIndexedFailure(repo, msg))
|
|
8845
|
+
return reply.code(404).send(NOT_INDEXED);
|
|
8846
|
+
return reply.code(repoReadStatus(msg)).send({ error: msg });
|
|
8578
8847
|
};
|
|
8579
8848
|
app.get(`${V}/governance/coverage`, async (req, reply) => {
|
|
8580
8849
|
// FINDING-009: with `?repo=<ref>`, report coverage over THAT repo's own code graph. The bare
|
|
@@ -8596,8 +8865,8 @@ runtime = {}) {
|
|
|
8596
8865
|
app.get(`${V}/governance/graph`, async (req, reply) => {
|
|
8597
8866
|
// #122: node-count-by-kind summary of a repo's OWN code graph. Repo-scoped ONLY — there is no
|
|
8598
8867
|
// 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).
|
|
8868
|
+
// code graph), so a missing `?repo=` is a 400, an unknown repo a 404, a repo not indexed yet a 200 with no
|
|
8869
|
+
// kinds (studio#1402), and an engine/binding failure a 500 (not masked as 404).
|
|
8601
8870
|
const repo = repoParam(req);
|
|
8602
8871
|
if (!repo) {
|
|
8603
8872
|
return reply.code(400).send({ error: 'governance/graph requires a ?repo=<ref>' });
|
|
@@ -8607,6 +8876,11 @@ runtime = {}) {
|
|
|
8607
8876
|
return { kinds };
|
|
8608
8877
|
}
|
|
8609
8878
|
catch (err) {
|
|
8879
|
+
// studio#1402: a known repo with no code graph yet is a state, not an error. The summary answers 200 with no
|
|
8880
|
+
// kinds and the reason (`code: 'not_indexed'`), so Repositories, Understand and a repository's page make no 404
|
|
8881
|
+
// per repo not indexed yet; every reader of `{ kinds }` draws "not built". An unknown id stays a plain 404.
|
|
8882
|
+
if (await notIndexedFailure(repo, message(err)))
|
|
8883
|
+
return { kinds: [], ...NOT_INDEXED };
|
|
8610
8884
|
return repoReadFailure(reply, repo, err);
|
|
8611
8885
|
}
|
|
8612
8886
|
});
|
|
@@ -9053,7 +9327,10 @@ runtime = {}) {
|
|
|
9053
9327
|
// Not generated yet is a state, typed by `code`, not a refusal (lane repo-page). It says how
|
|
9054
9328
|
// far the repository is ("23% real requirements · 4397 placeholders · target 80%";
|
|
9055
9329
|
// wicked-core#1233), from the very engine read the page used, when it has a store to count.
|
|
9056
|
-
|
|
9330
|
+
// A 200, not a 404 (studio#986): a repository nobody has generated requirements for is a normal
|
|
9331
|
+
// answer, and studio reads it for every such repository on each page. `code` is the discriminator;
|
|
9332
|
+
// the 404 stays only for a repository that is not registered (no `code`).
|
|
9333
|
+
return reply.code(200).send({
|
|
9057
9334
|
...REQUIREMENTS_NOT_GENERATED,
|
|
9058
9335
|
...(coverage === null ? {} : { coverage }),
|
|
9059
9336
|
...(minimum === null ? {} : { minimum }),
|
|
@@ -9669,6 +9946,17 @@ runtime = {}) {
|
|
|
9669
9946
|
return reply.code(403).send({ error: 'Only a person can change the power mode default (powerModeDefault)' });
|
|
9670
9947
|
}
|
|
9671
9948
|
}
|
|
9949
|
+
// standInReview (DES-STANDIN-001 §4, K2a): 'ask' | 'always'. 'always' is a person's standing consent to stand-in
|
|
9950
|
+
// checks on every later job (labelled everywhere, never independent), so a typo is a 400 and only a PERSON may
|
|
9951
|
+
// change it (a worker's bearer gets 403): a worker may only inherit the consent a person gave.
|
|
9952
|
+
if (Object.hasOwn(patch, 'standInReview')) {
|
|
9953
|
+
if (!isStandInReview(patch.standInReview)) {
|
|
9954
|
+
return reply.code(400).send({ error: "standInReview must be 'ask' or 'always'" });
|
|
9955
|
+
}
|
|
9956
|
+
if (!isHumanOperator(actorOf(req))) {
|
|
9957
|
+
return reply.code(403).send({ error: 'Only a person can change stand-in review (standInReview)' });
|
|
9958
|
+
}
|
|
9959
|
+
}
|
|
9672
9960
|
// newWorkSeats (F1/F2): which seats new chats and jobs are drawn from (`core/job-seats.ts`). A list of seat keys,
|
|
9673
9961
|
// or null for the default rule; a person's choice only (a worker's bearer gets 403).
|
|
9674
9962
|
if (Object.hasOwn(patch, 'newWorkSeats')) {
|
|
@@ -9783,6 +10071,7 @@ runtime = {}) {
|
|
|
9783
10071
|
'deliverDefault',
|
|
9784
10072
|
'qeAcceptance',
|
|
9785
10073
|
'powerModeDefault',
|
|
10074
|
+
'standInReview',
|
|
9786
10075
|
'newWorkSeats',
|
|
9787
10076
|
'onboardingAutoCapture',
|
|
9788
10077
|
'deliverIdentityLogin',
|
|
@@ -9908,23 +10197,37 @@ runtime = {}) {
|
|
|
9908
10197
|
}),
|
|
9909
10198
|
};
|
|
9910
10199
|
});
|
|
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`
|
|
10200
|
+
// POST /proposals {content, project?, repo?, tier?, source?} → proposal.submit → 201 { id } (api-types 0.54.0;
|
|
10201
|
+
// tier and repo 0.228.0, studio#1095). A skin files ONE memory into the same review queue — studio's "takes" (the
|
|
10202
|
+
// person picks one of two candidate outputs, and the pick becomes "prefers takes like X") and the Memory page's
|
|
10203
|
+
// add — learned only once they accept it here. The kind (`memory`) and `capture: "preference"` marker are the
|
|
10204
|
+
// daemon's; a caller cannot file a policy through this door (the schema is strict). The tier is the person's
|
|
10205
|
+
// choice of three (a fact by default); `project` and `repo` become those facets, so it is recalled there only.
|
|
10206
|
+
// `repo` is a registered repository's id (a run's `repo_ref`, which recall matches): one no registry row carries is
|
|
10207
|
+
// a 400 `repo_unknown`, since a memory on it would never be recalled; a registry that cannot be read is a 503.
|
|
9917
10208
|
app.post(`${V}/proposals`, {
|
|
9918
10209
|
config: {
|
|
9919
|
-
manifest: { requestType: 'FileProposalBody', responseType: 'FileProposalResponse', statusCodes: [201, 400, 502] },
|
|
10210
|
+
manifest: { requestType: 'FileProposalBody', responseType: 'FileProposalResponse', statusCodes: [201, 400, 502, 503] },
|
|
9920
10211
|
},
|
|
9921
10212
|
}, async (req, reply) => {
|
|
9922
10213
|
const parsed = FileProposalSchema.safeParse(req.body ?? {});
|
|
9923
10214
|
if (!parsed.success) {
|
|
9924
10215
|
return reply.code(400).send(invalidBody(parsed.error, 'Invalid proposal body'));
|
|
9925
10216
|
}
|
|
9926
|
-
const { content, project, source } = parsed.data;
|
|
9927
|
-
|
|
10217
|
+
const { content, project, repo, tier, source } = parsed.data;
|
|
10218
|
+
if (repo !== undefined) {
|
|
10219
|
+
let known;
|
|
10220
|
+
try {
|
|
10221
|
+
known = (await adapter.listRepos()).some((r) => r.id === repo);
|
|
10222
|
+
}
|
|
10223
|
+
catch (err) {
|
|
10224
|
+
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` });
|
|
10225
|
+
}
|
|
10226
|
+
if (!known) {
|
|
10227
|
+
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' });
|
|
10228
|
+
}
|
|
10229
|
+
}
|
|
10230
|
+
const payload = { content, tier: tier ?? 'semantic', capture: 'preference' };
|
|
9928
10231
|
if (source !== undefined)
|
|
9929
10232
|
payload.source = source;
|
|
9930
10233
|
let submitted;
|
|
@@ -9932,7 +10235,7 @@ runtime = {}) {
|
|
|
9932
10235
|
submitted = (await estateTool('proposal.submit', {
|
|
9933
10236
|
kind_type: 'memory',
|
|
9934
10237
|
payload,
|
|
9935
|
-
facets: project !== undefined ? { project } : {},
|
|
10238
|
+
facets: { ...(project !== undefined ? { project } : {}), ...(repo !== undefined ? { repo } : {}) },
|
|
9936
10239
|
}));
|
|
9937
10240
|
}
|
|
9938
10241
|
catch (err) {
|
|
@@ -11061,6 +11364,8 @@ runtime = {}) {
|
|
|
11061
11364
|
...(runtime.dataGate !== undefined ? { gate: runtime.dataGate } : {}),
|
|
11062
11365
|
...(mcpPolicies !== undefined ? { policies: mcpPolicies } : {}),
|
|
11063
11366
|
...(runtime.mcpCalls !== undefined ? { usage: runtime.mcpCalls } : {}),
|
|
11367
|
+
// (crew#1514) A rename lists the apps that use the source.
|
|
11368
|
+
...(runtime.apps !== undefined ? { appsUsing: (name) => runtime.apps.appsUsing(name) } : {}),
|
|
11064
11369
|
audit,
|
|
11065
11370
|
actorOf,
|
|
11066
11371
|
});
|
|
@@ -11113,6 +11418,17 @@ runtime = {}) {
|
|
|
11113
11418
|
audit,
|
|
11114
11419
|
actorOf,
|
|
11115
11420
|
});
|
|
11421
|
+
// crew#372: publish a finished compose's plan as GitHub issues of a project-linked tracker (human-only, card first).
|
|
11422
|
+
registerProductPublishRoutes(app, {
|
|
11423
|
+
...(runtime.mcpRegistryStore !== undefined ? { store: runtime.mcpRegistryStore } : {}),
|
|
11424
|
+
...(runtime.dataGate !== undefined ? { pm: runtime.dataGate.pm } : {}),
|
|
11425
|
+
projectExists: async (id) => (await adapter.projectGet(id).catch(() => null)) !== null,
|
|
11426
|
+
composeOf: (runId) => runTimingIndex.composeOf(runId),
|
|
11427
|
+
runView: (runId) => adapter.runView(runId),
|
|
11428
|
+
workOutput: (unitId) => adapter.workOutput(unitId),
|
|
11429
|
+
audit,
|
|
11430
|
+
actorOf,
|
|
11431
|
+
});
|
|
11116
11432
|
// DES-KNOWLEDGE-DATA-001 §10 (B4): profile a source into data-shape proposals, and the Knowledge map (both human-only).
|
|
11117
11433
|
registerShapeRoutes(app, {
|
|
11118
11434
|
...(runtime.mcp !== undefined ? { registry: runtime.mcp } : {}),
|
|
@@ -11129,11 +11445,42 @@ runtime = {}) {
|
|
|
11129
11445
|
: {}),
|
|
11130
11446
|
...(appsKnowledge !== undefined ? { knowledge: appsKnowledge } : {}),
|
|
11131
11447
|
});
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11448
|
+
const bridgeCallFor = async (projectId) => {
|
|
11449
|
+
const root = await projectDocsRoot(adapter, projectSettings, projectId);
|
|
11450
|
+
if (root === null)
|
|
11451
|
+
return null;
|
|
11452
|
+
const bridge = await interactiveBridges.ensure(root);
|
|
11453
|
+
return async (method, path, body, opts) => {
|
|
11454
|
+
const raw = Buffer.isBuffer(body);
|
|
11455
|
+
const res = await fetch(`http://${bridge.host}:${bridge.port}${path}`, {
|
|
11456
|
+
method,
|
|
11457
|
+
...(body === undefined ? {} : {
|
|
11458
|
+
headers: { 'content-type': raw ? 'application/octet-stream' : 'application/json' },
|
|
11459
|
+
body: raw ? new Uint8Array(body) : JSON.stringify(body),
|
|
11460
|
+
}),
|
|
11461
|
+
// A segment upload or a render (ffmpeg) can take minutes on a loaded host.
|
|
11462
|
+
signal: AbortSignal.timeout(opts?.timeoutMs ?? 600_000),
|
|
11463
|
+
});
|
|
11464
|
+
let parsed = {};
|
|
11465
|
+
try {
|
|
11466
|
+
const j = await res.json();
|
|
11467
|
+
if (j !== null && typeof j === 'object' && !Array.isArray(j))
|
|
11468
|
+
parsed = j;
|
|
11469
|
+
}
|
|
11470
|
+
catch {
|
|
11471
|
+
parsed = {};
|
|
11472
|
+
}
|
|
11473
|
+
return { status: res.status, body: parsed };
|
|
11474
|
+
};
|
|
11475
|
+
};
|
|
11476
|
+
/** (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
|
|
11477
|
+
* two ffmpeg passes of 180 s each, plus the probe and writes). */
|
|
11478
|
+
const cutBridgeFor = async (projectId) => {
|
|
11479
|
+
const call = await bridgeCallFor(projectId);
|
|
11480
|
+
if (call === null)
|
|
11481
|
+
return null;
|
|
11482
|
+
return (method, path, body) => call(method, path, body, { timeoutMs: method === 'GET' ? 30_000 : 900_000 });
|
|
11483
|
+
};
|
|
11137
11484
|
const interactiveBridges = runtime.interactiveBridges ??
|
|
11138
11485
|
new InteractiveBridgePool({
|
|
11139
11486
|
log: (m) => app.log.warn(m),
|
|
@@ -11307,7 +11654,7 @@ runtime = {}) {
|
|
|
11307
11654
|
tailLagMs: watchHealth?.tail_lag_ms ?? null,
|
|
11308
11655
|
}),
|
|
11309
11656
|
probeVault({ vault: adapter.vaultBin != null ? vaultDiagnostics(adapter.vaultBin) : null, exec: systemExec }),
|
|
11310
|
-
diskRow(stateHome),
|
|
11657
|
+
diskRow(stateHome, undefined, undefined, undefined, stateHome === null ? null : (deadline) => diskStoresCache.get(stateHome, deadline)),
|
|
11311
11658
|
probeSeatImages({
|
|
11312
11659
|
containerFloor,
|
|
11313
11660
|
clis: rosterSeatClis(),
|
|
@@ -11493,6 +11840,7 @@ runtime = {}) {
|
|
|
11493
11840
|
gaps,
|
|
11494
11841
|
infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
|
|
11495
11842
|
costOf: (id) => runCosts.get(id),
|
|
11843
|
+
engine: clusterReader.engine(),
|
|
11496
11844
|
});
|
|
11497
11845
|
if (typeof adapter.runEvents === 'function' && first.unresolved.length > 0) {
|
|
11498
11846
|
const byId = new Map(allViews.map((v) => [v.session.id, v]));
|
|
@@ -11510,6 +11858,7 @@ runtime = {}) {
|
|
|
11510
11858
|
gaps,
|
|
11511
11859
|
infraHoldsLive: (key) => (key === 'gateway' || key === 'broker' || key === 'cluster' ? containerFloor : key === 'skills' || key === 'state_home' || key === 'disk' || key === 'daemon'),
|
|
11512
11860
|
costOf: (id) => runCosts.get(id),
|
|
11861
|
+
engine: clusterReader.engine(),
|
|
11513
11862
|
});
|
|
11514
11863
|
const toReview = await toReviewP;
|
|
11515
11864
|
// A run list that could not be read never reads green: the daemon row (degraded, "did not list
|
|
@@ -11647,34 +11996,7 @@ runtime = {}) {
|
|
|
11647
11996
|
log: (m) => app.log.warn(m),
|
|
11648
11997
|
});
|
|
11649
11998
|
// ── 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
|
-
});
|
|
11999
|
+
registerDemoDocumentRoute(app, adapter, { bridgeFor: bridgeCallFor });
|
|
11678
12000
|
// ── Project-attributed docs list (crew#472) ──
|
|
11679
12001
|
// `GET /projects/:id/interactive/api/docs` relays the bridge's list and stamps each row with
|
|
11680
12002
|
// the mount's `projectId` — the attribution the bridge cannot know. Same static-over-wildcard
|