@wildo-ai/dev-companion 1.1.1 → 1.1.2
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/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +12 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +11 -0
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +153 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +419 -41
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +25 -10
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +65 -24
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +86 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +127 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -0
- package/dist/esm/companion-api/companion-api.schemas.d.ts +59 -2
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +60 -0
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +322 -21
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/inject/models/container.d.ts.map +1 -1
- package/dist/esm/core/inject/models/container.js +11 -0
- package/dist/esm/core/inject/models/container.js.map +1 -1
- package/dist/esm/core/inject/models/service-types.d.ts +5 -0
- package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/core/inject/models/service-types.js +5 -0
- package/dist/esm/core/inject/models/service-types.js.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +81 -0
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +11 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.js +39 -0
- package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +8 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +317 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +45 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +250 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +123 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +298 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +78 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +155 -6
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +131 -2
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +259 -9
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +243 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +417 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +186 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +368 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts +101 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js +278 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +365 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js +167 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +332 -3
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +19 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +164 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +3 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +36 -23
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +51 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +391 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -0
- package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.js +5 -0
- package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +103 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js +124 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -0
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +39 -2
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.js +122 -11
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts +6 -0
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.js.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts +23 -0
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.js +26 -4
- package/dist/esm/core/specifications/specification-context-factory.shared.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +82 -3
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +126 -12
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +13 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js +91 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts +38 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js +41 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js.map +1 -0
- package/dist/esm/i18n/index.d.ts +3 -3
- package/dist/esm/i18n/index.js +3 -3
- package/dist/esm/i18n/index.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts +31 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js +27 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +28 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +24 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts +138 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js +100 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +29 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +25 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +27 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +23 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +806 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +326 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts +26 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js +22 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts +202 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.js +209 -0
- package/dist/esm/i18n/system_enums/market.en.js.map +1 -0
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +112 -2
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +201 -34
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +31 -3
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +48 -12
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +36 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +1 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +75 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -0
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +105 -7
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +298 -24
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +46 -3
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +95 -2
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts +9 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js +13 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +12 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +23 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +120 -3
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +636 -81
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts +40 -0
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js +63 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +21 -0
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js +86 -2
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +12 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +47 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/.builder.pid +0 -9
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev supervisor's compile state, read from the SAME artifact the supervisor keys on — so this
|
|
3
|
+
* gate and the thing that kills agent children under a rebuild can never disagree about whether a
|
|
4
|
+
* rebuild is happening (issue #265; the predicate was proven operationally before it was code:
|
|
5
|
+
* dispatch attempts launched behind an all-`ready` read completed, attempts launched on health
|
|
6
|
+
* checks alone died).
|
|
7
|
+
*
|
|
8
|
+
* ## Why agent spawns consult this at all
|
|
9
|
+
*
|
|
10
|
+
* An in-flight ACP agent child dies with every companion pause: its stdin closes on the supervisor's
|
|
11
|
+
* restart and the CLI exits 0 mid-turn — nine measured kills across two lanes on 2026-09-02/03. The
|
|
12
|
+
* supervisor's pauses are LEGITIMATE (a dependency really is recompiling), so the fix is not to
|
|
13
|
+
* fight them but to stop spawning minutes-long turns into a window that is already churning.
|
|
14
|
+
*
|
|
15
|
+
* ## Absent-tolerant by design
|
|
16
|
+
*
|
|
17
|
+
* The status file is a DEV-ORCHESTRATOR artifact. A standalone application install has no framework
|
|
18
|
+
* checkout, no watchers, and no churn — `readable: false` there means "nothing to wait for", never
|
|
19
|
+
* an error. Same for a malformed or mid-write read: this is a convenience gate, and a gate that can
|
|
20
|
+
* fail closed on its own parse error would refuse work over a JSON hiccup.
|
|
21
|
+
*/
|
|
22
|
+
export interface DevCompileChurn {
|
|
23
|
+
/** False when no status artifact exists or it cannot be parsed — treat as quiet. */
|
|
24
|
+
readonly readable: boolean;
|
|
25
|
+
/** Package names currently NOT `ready` (compiling or failed). Empty when quiet. */
|
|
26
|
+
readonly busyPackages: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function readDevCompileChurn(frameworkRepositoryRoot: string | null | undefined): DevCompileChurn;
|
|
29
|
+
/**
|
|
30
|
+
* Wait (bounded) for the dev tree to stop compiling before spawning a long agent turn.
|
|
31
|
+
*
|
|
32
|
+
* BOUNDED, and proceeding on timeout rather than refusing: this gate exists to raise the odds of a
|
|
33
|
+
* turn surviving, not to become a new way work is withheld. A tree that churns for the whole bound
|
|
34
|
+
* (a busy multi-session day) gets the same behavior as before this gate existed — the spawn happens
|
|
35
|
+
* and takes its chances — with the wait logged so a killed turn's post-mortem can see the gate did
|
|
36
|
+
* what it could.
|
|
37
|
+
*/
|
|
38
|
+
export declare function waitForDevCompileQuiet(input: {
|
|
39
|
+
readonly frameworkRepositoryRoot: string | null | undefined;
|
|
40
|
+
readonly maximumWaitMs?: number;
|
|
41
|
+
readonly pollIntervalMs?: number;
|
|
42
|
+
readonly log?: (message: string, context?: Record<string, unknown>) => void;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
readonly waitedMs: number;
|
|
45
|
+
readonly quiet: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Is this agent-child failure INFRASTRUCTURE-shaped — the environment taking the turn away — rather
|
|
49
|
+
* than the agent failing at its work?
|
|
50
|
+
*
|
|
51
|
+
* Deliberately a closed list of measured signatures, not a heuristic:
|
|
52
|
+
* - the exit-0 mid-turn kill (stdin closed under a companion pause — #121's diagnosed cause, and
|
|
53
|
+
* the shape behind nine 2026-09-02/03 kills);
|
|
54
|
+
* - the provider's own overload/transient answers (529 observed live on 2026-09-03; 429 is the same
|
|
55
|
+
* class), which reach us as a named ACP error since the JSON-RPC rejection carries its message.
|
|
56
|
+
*
|
|
57
|
+
* A signature NOT on this list is the agent's outcome and is never retried here — a wrong answer
|
|
58
|
+
* retried is spend; a refusal retried is worse.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isInfrastructureShapedAgentFailure(message: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Is this failure the provider ACCOUNT refusing to serve the turn — quota exhausted, or the
|
|
63
|
+
* operator's login expired — rather than a transient or the agent's own outcome?
|
|
64
|
+
*
|
|
65
|
+
* Kept SEPARATE from {@link isInfrastructureShapedAgentFailure} because the two demand opposite
|
|
66
|
+
* immediate treatment: a 529/kill is worth one retry in seconds, while an account condition has a
|
|
67
|
+
* HUMAN-SCALE remedy — a quota resets hours later, an expired login needs someone to run
|
|
68
|
+
* `claude login` — so retrying now is pure spend that fails identically. What the two share is the
|
|
69
|
+
* LATER treatment: both are the environment taking the turn away rather than the agent failing at
|
|
70
|
+
* its work, so both must preserve a choreography's checkpoint for a relaunch (measured 2026-09-03:
|
|
71
|
+
* a 56-minute, 14-successful-children compliance run hit the 5-hour session limit in iteration 11
|
|
72
|
+
* and the conclusion consumed the checkpoint, discarding every accumulated evidence brief).
|
|
73
|
+
*
|
|
74
|
+
* Closed list of measured signatures, same discipline as the sibling:
|
|
75
|
+
* - `ACP agent error -32603: Internal error: You've hit your session limit · resets 9:40pm (Europe/Paris)`
|
|
76
|
+
* - `ACP agent error -32603: Internal error: Failed to authenticate: OAuth session expired and
|
|
77
|
+
* could not be refreshed` (2026-09-04, first iteration of the relaunch — the interactive shell
|
|
78
|
+
* refreshed the same login fine minutes later; the minimal-env child could not)
|
|
79
|
+
*/
|
|
80
|
+
export declare function isProviderAccountAgentFailure(message: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Did a concluded choreography END BY ENVIRONMENT — every child of its fatal iteration taken by
|
|
83
|
+
* infrastructure or quota — rather than reach a semantic conclusion?
|
|
84
|
+
*
|
|
85
|
+
* This is the predicate that decides whether the run's checkpoint survives its conclusion. The
|
|
86
|
+
* consuming rule ("a run that stopped because every child failed has still CONCLUDED") is right for
|
|
87
|
+
* a semantic failure: re-running would choose again over identical state. It is wrong when the
|
|
88
|
+
* children never got to do the work at all — that is the process-taken-away case the checkpoint
|
|
89
|
+
* exists for, arriving as child failures instead of a SIGTERM.
|
|
90
|
+
*
|
|
91
|
+
* Strict on purpose: ONE semantic failure among the fatal children means the next selection would
|
|
92
|
+
* see real information, so the conclusion stands and the checkpoint goes. An empty iteration list
|
|
93
|
+
* or a stop reason other than ALL_CHILDREN_FAILED is never environmental.
|
|
94
|
+
*/
|
|
95
|
+
export declare function choreographyEndedByEnvironment(input: {
|
|
96
|
+
readonly stoppedBecause: string;
|
|
97
|
+
readonly iterations: ReadonlyArray<{
|
|
98
|
+
readonly children: ReadonlyArray<{
|
|
99
|
+
readonly failure?: string;
|
|
100
|
+
}>;
|
|
101
|
+
}>;
|
|
102
|
+
}): boolean;
|
|
103
|
+
//# sourceMappingURL=dev-compile-quiet.companion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-compile-quiet.companion.d.ts","sourceRoot":"","sources":["../../../../../src/core/runtime/dev-compile-quiet.companion.ts"],"names":[],"mappings":"AAGA;;;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AAE,CAAC,CAAC;CACzG,GAAG,OAAO,CASV"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const DEV_COMPILE_STATUS_RELATIVE_PATH = '.wildo-runtime-signals/dev-compile-status.json';
|
|
4
|
+
export function readDevCompileChurn(frameworkRepositoryRoot) {
|
|
5
|
+
if (!frameworkRepositoryRoot)
|
|
6
|
+
return { readable: false, busyPackages: [] };
|
|
7
|
+
const statusPath = join(frameworkRepositoryRoot, DEV_COMPILE_STATUS_RELATIVE_PATH);
|
|
8
|
+
if (!existsSync(statusPath))
|
|
9
|
+
return { readable: false, busyPackages: [] };
|
|
10
|
+
try {
|
|
11
|
+
const parsed = JSON.parse(readFileSync(statusPath, 'utf8'));
|
|
12
|
+
const packages = parsed.packages ?? {};
|
|
13
|
+
const busyPackages = Object.entries(packages)
|
|
14
|
+
.filter(([, entry]) => String(entry?.status) !== 'ready')
|
|
15
|
+
.map(([name]) => name)
|
|
16
|
+
.sort();
|
|
17
|
+
return { readable: true, busyPackages };
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return { readable: false, busyPackages: [] };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Wait (bounded) for the dev tree to stop compiling before spawning a long agent turn.
|
|
25
|
+
*
|
|
26
|
+
* BOUNDED, and proceeding on timeout rather than refusing: this gate exists to raise the odds of a
|
|
27
|
+
* turn surviving, not to become a new way work is withheld. A tree that churns for the whole bound
|
|
28
|
+
* (a busy multi-session day) gets the same behavior as before this gate existed — the spawn happens
|
|
29
|
+
* and takes its chances — with the wait logged so a killed turn's post-mortem can see the gate did
|
|
30
|
+
* what it could.
|
|
31
|
+
*/
|
|
32
|
+
export async function waitForDevCompileQuiet(input) {
|
|
33
|
+
const maximumWaitMs = input.maximumWaitMs ?? 5 * 60 * 1000;
|
|
34
|
+
const pollIntervalMs = input.pollIntervalMs ?? 5000;
|
|
35
|
+
const startedAt = Date.now();
|
|
36
|
+
let churn = readDevCompileChurn(input.frameworkRepositoryRoot);
|
|
37
|
+
if (!churn.readable || churn.busyPackages.length === 0)
|
|
38
|
+
return { waitedMs: 0, quiet: true };
|
|
39
|
+
input.log?.('Deferring agent spawn: the dev tree is compiling', { busyPackages: churn.busyPackages.slice(0, 6) });
|
|
40
|
+
while (Date.now() - startedAt < maximumWaitMs) {
|
|
41
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
42
|
+
churn = readDevCompileChurn(input.frameworkRepositoryRoot);
|
|
43
|
+
if (!churn.readable || churn.busyPackages.length === 0) {
|
|
44
|
+
const waitedMs = Date.now() - startedAt;
|
|
45
|
+
input.log?.('Dev tree quiet; spawning agent', { waitedMs });
|
|
46
|
+
return { waitedMs, quiet: true };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const waitedMs = Date.now() - startedAt;
|
|
50
|
+
input.log?.('Dev tree still compiling after the bound; spawning anyway', { waitedMs, busyPackages: churn.busyPackages.slice(0, 6) });
|
|
51
|
+
return { waitedMs, quiet: false };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Is this agent-child failure INFRASTRUCTURE-shaped — the environment taking the turn away — rather
|
|
55
|
+
* than the agent failing at its work?
|
|
56
|
+
*
|
|
57
|
+
* Deliberately a closed list of measured signatures, not a heuristic:
|
|
58
|
+
* - the exit-0 mid-turn kill (stdin closed under a companion pause — #121's diagnosed cause, and
|
|
59
|
+
* the shape behind nine 2026-09-02/03 kills);
|
|
60
|
+
* - the provider's own overload/transient answers (529 observed live on 2026-09-03; 429 is the same
|
|
61
|
+
* class), which reach us as a named ACP error since the JSON-RPC rejection carries its message.
|
|
62
|
+
*
|
|
63
|
+
* A signature NOT on this list is the agent's outcome and is never retried here — a wrong answer
|
|
64
|
+
* retried is spend; a refusal retried is worse.
|
|
65
|
+
*/
|
|
66
|
+
export function isInfrastructureShapedAgentFailure(message) {
|
|
67
|
+
if (/Agent process exited before the turn completed/i.test(message))
|
|
68
|
+
return true;
|
|
69
|
+
if (/ACP agent error/.test(message) && /(529|429|Overloaded|overloaded_error|rate.?limit)/i.test(message))
|
|
70
|
+
return true;
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Is this failure the provider ACCOUNT refusing to serve the turn — quota exhausted, or the
|
|
75
|
+
* operator's login expired — rather than a transient or the agent's own outcome?
|
|
76
|
+
*
|
|
77
|
+
* Kept SEPARATE from {@link isInfrastructureShapedAgentFailure} because the two demand opposite
|
|
78
|
+
* immediate treatment: a 529/kill is worth one retry in seconds, while an account condition has a
|
|
79
|
+
* HUMAN-SCALE remedy — a quota resets hours later, an expired login needs someone to run
|
|
80
|
+
* `claude login` — so retrying now is pure spend that fails identically. What the two share is the
|
|
81
|
+
* LATER treatment: both are the environment taking the turn away rather than the agent failing at
|
|
82
|
+
* its work, so both must preserve a choreography's checkpoint for a relaunch (measured 2026-09-03:
|
|
83
|
+
* a 56-minute, 14-successful-children compliance run hit the 5-hour session limit in iteration 11
|
|
84
|
+
* and the conclusion consumed the checkpoint, discarding every accumulated evidence brief).
|
|
85
|
+
*
|
|
86
|
+
* Closed list of measured signatures, same discipline as the sibling:
|
|
87
|
+
* - `ACP agent error -32603: Internal error: You've hit your session limit · resets 9:40pm (Europe/Paris)`
|
|
88
|
+
* - `ACP agent error -32603: Internal error: Failed to authenticate: OAuth session expired and
|
|
89
|
+
* could not be refreshed` (2026-09-04, first iteration of the relaunch — the interactive shell
|
|
90
|
+
* refreshed the same login fine minutes later; the minimal-env child could not)
|
|
91
|
+
*/
|
|
92
|
+
export function isProviderAccountAgentFailure(message) {
|
|
93
|
+
if (!/ACP agent error/.test(message))
|
|
94
|
+
return false;
|
|
95
|
+
if (/(session limit|usage limit|hit your \S* ?limit)/i.test(message))
|
|
96
|
+
return true;
|
|
97
|
+
if (/Failed to authenticate|OAuth session expired/i.test(message))
|
|
98
|
+
return true;
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Did a concluded choreography END BY ENVIRONMENT — every child of its fatal iteration taken by
|
|
103
|
+
* infrastructure or quota — rather than reach a semantic conclusion?
|
|
104
|
+
*
|
|
105
|
+
* This is the predicate that decides whether the run's checkpoint survives its conclusion. The
|
|
106
|
+
* consuming rule ("a run that stopped because every child failed has still CONCLUDED") is right for
|
|
107
|
+
* a semantic failure: re-running would choose again over identical state. It is wrong when the
|
|
108
|
+
* children never got to do the work at all — that is the process-taken-away case the checkpoint
|
|
109
|
+
* exists for, arriving as child failures instead of a SIGTERM.
|
|
110
|
+
*
|
|
111
|
+
* Strict on purpose: ONE semantic failure among the fatal children means the next selection would
|
|
112
|
+
* see real information, so the conclusion stands and the checkpoint goes. An empty iteration list
|
|
113
|
+
* or a stop reason other than ALL_CHILDREN_FAILED is never environmental.
|
|
114
|
+
*/
|
|
115
|
+
export function choreographyEndedByEnvironment(input) {
|
|
116
|
+
if (input.stoppedBecause !== 'ALL_CHILDREN_FAILED')
|
|
117
|
+
return false;
|
|
118
|
+
const fatal = input.iterations[input.iterations.length - 1];
|
|
119
|
+
if (!fatal || fatal.children.length === 0)
|
|
120
|
+
return false;
|
|
121
|
+
return fatal.children.every((child) => child.failure !== undefined
|
|
122
|
+
&& (isInfrastructureShapedAgentFailure(child.failure) || isProviderAccountAgentFailure(child.failure)));
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=dev-compile-quiet.companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-compile-quiet.companion.js","sourceRoot":"","sources":["../../../../../src/core/runtime/dev-compile-quiet.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA8BjC,MAAM,gCAAgC,GAAG,gDAAgD,CAAC;AAE1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ent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * The dev supervisor's compile state, read from the SAME artifact the supervisor keys on — so this\n * gate and the thing that kills agent children under a rebuild can never disagree about whether a\n * rebuild is happening (issue #265; the predicate was proven operationally before it was code:\n * dispatch attempts launched behind an all-`ready` read completed, attempts launched on health\n * checks alone died).\n *\n * ## Why agent spawns consult this at all\n *\n * An in-flight ACP agent child dies with every companion pause: its stdin closes on the supervisor's\n * restart and the CLI exits 0 mid-turn — nine measured kills across two lanes on 2026-09-02/03. The\n * supervisor's pauses are LEGITIMATE (a dependency really is recompiling), so the fix is not to\n * fight them but to stop spawning minutes-long turns into a window that is already churning.\n *\n * ## Absent-tolerant by design\n *\n * The status file is a DEV-ORCHESTRATOR artifact. A standalone application install has no framework\n * checkout, no watchers, and no churn — `readable: false` there means \"nothing to wait for\", never\n * an error. Same for a malformed or mid-write read: this is a convenience gate, and a gate that can\n * fail closed on its own parse error would refuse work over a JSON hiccup.\n */\nexport interface DevCompileChurn {\n /** False when no status artifact exists or it cannot be parsed — treat as quiet. */\n readonly readable: boolean;\n /** Package names currently NOT `ready` (compiling or failed). Empty when quiet. */\n readonly busyPackages: readonly string[];\n}\n\nconst DEV_COMPILE_STATUS_RELATIVE_PATH = '.wildo-runtime-signals/dev-compile-status.json';\n\nexport function readDevCompileChurn(frameworkRepositoryRoot: string | null | undefined): DevCompileChurn {\n if (!frameworkRepositoryRoot) return { readable: false, busyPackages: [] };\n const statusPath = join(frameworkRepositoryRoot, DEV_COMPILE_STATUS_RELATIVE_PATH);\n if (!existsSync(statusPath)) return { readable: false, busyPackages: [] };\n try {\n const parsed = JSON.parse(readFileSync(statusPath, 'utf8')) as { packages?: Record<string, { status?: unknown }> };\n const packages = parsed.packages ?? {};\n const busyPackages = Object.entries(packages)\n .filter(([, entry]) => String(entry?.status) !== 'ready')\n .map(([name]) => name)\n .sort();\n return { readable: true, busyPackages };\n } catch {\n return { readable: false, busyPackages: [] };\n }\n}\n\n/**\n * Wait (bounded) for the dev tree to stop compiling before spawning a long agent turn.\n *\n * BOUNDED, and proceeding on timeout rather than refusing: this gate exists to raise the odds of a\n * turn surviving, not to become a new way work is withheld. A tree that churns for the whole bound\n * (a busy multi-session day) gets the same behavior as before this gate existed — the spawn happens\n * and takes its chances — with the wait logged so a killed turn's post-mortem can see the gate did\n * what it could.\n */\nexport async function waitForDevCompileQuiet(input: {\n readonly frameworkRepositoryRoot: string | null | undefined;\n readonly maximumWaitMs?: number;\n readonly pollIntervalMs?: number;\n readonly log?: (message: string, context?: Record<string, unknown>) => void;\n}): Promise<{ readonly waitedMs: number; readonly quiet: boolean }> {\n const maximumWaitMs = input.maximumWaitMs ?? 5 * 60 * 1000;\n const pollIntervalMs = input.pollIntervalMs ?? 5000;\n const startedAt = Date.now();\n let churn = readDevCompileChurn(input.frameworkRepositoryRoot);\n if (!churn.readable || churn.busyPackages.length === 0) return { waitedMs: 0, quiet: true };\n input.log?.('Deferring agent spawn: the dev tree is compiling', { busyPackages: churn.busyPackages.slice(0, 6) });\n while (Date.now() - startedAt < maximumWaitMs) {\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n churn = readDevCompileChurn(input.frameworkRepositoryRoot);\n if (!churn.readable || churn.busyPackages.length === 0) {\n const waitedMs = Date.now() - startedAt;\n input.log?.('Dev tree quiet; spawning agent', { waitedMs });\n return { waitedMs, quiet: true };\n }\n }\n const waitedMs = Date.now() - startedAt;\n input.log?.('Dev tree still compiling after the bound; spawning anyway', { waitedMs, busyPackages: churn.busyPackages.slice(0, 6) });\n return { waitedMs, quiet: false };\n}\n\n/**\n * Is this agent-child failure INFRASTRUCTURE-shaped — the environment taking the turn away — rather\n * than the agent failing at its work?\n *\n * Deliberately a closed list of measured signatures, not a heuristic:\n * - the exit-0 mid-turn kill (stdin closed under a companion pause — #121's diagnosed cause, and\n * the shape behind nine 2026-09-02/03 kills);\n * - the provider's own overload/transient answers (529 observed live on 2026-09-03; 429 is the same\n * class), which reach us as a named ACP error since the JSON-RPC rejection carries its message.\n *\n * A signature NOT on this list is the agent's outcome and is never retried here — a wrong answer\n * retried is spend; a refusal retried is worse.\n */\nexport function isInfrastructureShapedAgentFailure(message: string): boolean {\n if (/Agent process exited before the turn completed/i.test(message)) return true;\n if (/ACP agent error/.test(message) && /(529|429|Overloaded|overloaded_error|rate.?limit)/i.test(message)) return true;\n return false;\n}\n\n/**\n * Is this failure the provider ACCOUNT refusing to serve the turn — quota exhausted, or the\n * operator's login expired — rather than a transient or the agent's own outcome?\n *\n * Kept SEPARATE from {@link isInfrastructureShapedAgentFailure} because the two demand opposite\n * immediate treatment: a 529/kill is worth one retry in seconds, while an account condition has a\n * HUMAN-SCALE remedy — a quota resets hours later, an expired login needs someone to run\n * `claude login` — so retrying now is pure spend that fails identically. What the two share is the\n * LATER treatment: both are the environment taking the turn away rather than the agent failing at\n * its work, so both must preserve a choreography's checkpoint for a relaunch (measured 2026-09-03:\n * a 56-minute, 14-successful-children compliance run hit the 5-hour session limit in iteration 11\n * and the conclusion consumed the checkpoint, discarding every accumulated evidence brief).\n *\n * Closed list of measured signatures, same discipline as the sibling:\n * - `ACP agent error -32603: Internal error: You've hit your session limit · resets 9:40pm (Europe/Paris)`\n * - `ACP agent error -32603: Internal error: Failed to authenticate: OAuth session expired and\n * could not be refreshed` (2026-09-04, first iteration of the relaunch — the interactive shell\n * refreshed the same login fine minutes later; the minimal-env child could not)\n */\nexport function isProviderAccountAgentFailure(message: string): boolean {\n if (!/ACP agent error/.test(message)) return false;\n if (/(session limit|usage limit|hit your \\S* ?limit)/i.test(message)) return true;\n if (/Failed to authenticate|OAuth session expired/i.test(message)) return true;\n return false;\n}\n\n/**\n * Did a concluded choreography END BY ENVIRONMENT — every child of its fatal iteration taken by\n * infrastructure or quota — rather than reach a semantic conclusion?\n *\n * This is the predicate that decides whether the run's checkpoint survives its conclusion. The\n * consuming rule (\"a run that stopped because every child failed has still CONCLUDED\") is right for\n * a semantic failure: re-running would choose again over identical state. It is wrong when the\n * children never got to do the work at all — that is the process-taken-away case the checkpoint\n * exists for, arriving as child failures instead of a SIGTERM.\n *\n * Strict on purpose: ONE semantic failure among the fatal children means the next selection would\n * see real information, so the conclusion stands and the checkpoint goes. An empty iteration list\n * or a stop reason other than ALL_CHILDREN_FAILED is never environmental.\n */\nexport function choreographyEndedByEnvironment(input: {\n readonly stoppedBecause: string;\n readonly iterations: ReadonlyArray<{ readonly children: ReadonlyArray<{ readonly failure?: string }> }>;\n}): boolean {\n if (input.stoppedBecause !== 'ALL_CHILDREN_FAILED') return false;\n const fatal = input.iterations[input.iterations.length - 1];\n if (!fatal || fatal.children.length === 0) return false;\n return fatal.children.every(\n (child) =>\n child.failure !== undefined\n && (isInfrastructureShapedAgentFailure(child.failure) || isProviderAccountAgentFailure(child.failure)),\n );\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { I18nBackendService, HttpServerBackendService, MongoDBService, PostgreSQLDatabaseBackendService, RedisService, FileStorageRouterBackendService, ExternalProvidersRegistryBackendService, ObservabilityBackendService, WorkerShutdownManagerBackendService, FlowsActorsRegistryService, ControllersRegistryHandlerBackendService, ResourcesRegistryBackendService, ServicesRegistryHandlerBackendService, RepositoriesRegistryHandlerBackendService, type AbstractControllerBackendService, type ApplicationInitializationConfig, type AppConfiguration_BackendAuthored, type LoggerService } from '@wildo-ai/saas-backend-lib';
|
|
1
|
+
import { I18nBackendService, HttpServerBackendService, MongoDBService, PostgreSQLDatabaseBackendService, RedisService, FileStorageRouterBackendService, ExternalProvidersRegistryBackendService, ObservabilityBackendService, WorkerShutdownManagerBackendService, FlowsActorsRegistryService, ControllersRegistryHandlerBackendService, ResourcesRegistryBackendService, ServicesRegistryHandlerBackendService, RepositoriesRegistryHandlerBackendService, ResourceOperationCustomImplementationRegistryBackendService, type AbstractControllerBackendService, type ApplicationInitializationConfig, type AppConfiguration_BackendAuthored, type LoggerService } from '@wildo-ai/saas-backend-lib';
|
|
2
2
|
import { type PlatformAppConfigInitializerService } from '@wildo-ai/platform-shared-lib';
|
|
3
3
|
import type { SaasRuntimeProvidersArtifact } from '@wildo-ai/platform-config-lib';
|
|
4
|
+
import { IntrospectionSourceWatcherCompanionService } from '../../introspection/services/introspection-source-watcher.companion.service';
|
|
5
|
+
import { IntrospectionResourceNotifierCompanionService } from '../../introspection/resources/introspection-resource-notifier.companion.service';
|
|
6
|
+
import { IntrospectionResourceSourceCompanionService } from '../../introspection/resources/introspection-resource-source.companion.service';
|
|
4
7
|
import { CompanionAuthFloorCompanionService } from '../../auth/companion-auth-floor.companion.service';
|
|
5
8
|
import type { CompanionContext } from '../../context/companion-context';
|
|
6
9
|
import { CompanionStartupCompositionFence } from '../companion-startup-composition-fence';
|
|
@@ -41,12 +44,16 @@ export declare class StartCompanionApplicationService {
|
|
|
41
44
|
private readonly featuresController;
|
|
42
45
|
private readonly i18nService;
|
|
43
46
|
private readonly servicesRegistryService;
|
|
47
|
+
private readonly customImplRegistry;
|
|
44
48
|
private readonly repositoriesRegistryService;
|
|
45
49
|
private readonly appConfigInitializer;
|
|
46
50
|
private readonly companionContext;
|
|
47
51
|
private readonly authFloorService;
|
|
48
52
|
private readonly startupCompositionFence;
|
|
49
53
|
private readonly codingAgentDispatchService;
|
|
54
|
+
private readonly introspectionSourceWatcher;
|
|
55
|
+
private readonly introspectionResourceNotifier;
|
|
56
|
+
private readonly introspectionResourceSource;
|
|
50
57
|
private readonly logDebug;
|
|
51
58
|
private readonly readinessObservationProducerInstanceId;
|
|
52
59
|
private readinessObservationHeartbeat;
|
|
@@ -54,7 +61,7 @@ export declare class StartCompanionApplicationService {
|
|
|
54
61
|
private shutdownLifecycleRegistered;
|
|
55
62
|
constructor(logger: LoggerService, httpServerService: HttpServerBackendService, mongoDBService: MongoDBService, postgresqlDatabaseService: PostgreSQLDatabaseBackendService, redisService: RedisService, fileStorageRouter: FileStorageRouterBackendService, backendProviderRegistryService: {
|
|
56
63
|
initialize(registry?: unknown): void;
|
|
57
|
-
}, externalProvidersRegistryService: ExternalProvidersRegistryBackendService, observabilityBackendService: ObservabilityBackendService, workerShutdownManager: WorkerShutdownManagerBackendService, flowsActorsRegistryService: FlowsActorsRegistryService, resourcesRegistryService: ResourcesRegistryBackendService, controllersRegistryService: ControllersRegistryHandlerBackendService, i18nController: AbstractControllerBackendService, applicationConfigController: AbstractControllerBackendService, authenticationController: AbstractControllerBackendService, featuresController: AbstractControllerBackendService, i18nService: I18nBackendService, servicesRegistryService: ServicesRegistryHandlerBackendService, repositoriesRegistryService: RepositoriesRegistryHandlerBackendService, appConfigInitializer: PlatformAppConfigInitializerService, companionContext: CompanionContext, authFloorService: CompanionAuthFloorCompanionService, startupCompositionFence: CompanionStartupCompositionFence, codingAgentDispatchService: CodingAgentDispatchCompanionService);
|
|
64
|
+
}, externalProvidersRegistryService: ExternalProvidersRegistryBackendService, observabilityBackendService: ObservabilityBackendService, workerShutdownManager: WorkerShutdownManagerBackendService, flowsActorsRegistryService: FlowsActorsRegistryService, resourcesRegistryService: ResourcesRegistryBackendService, controllersRegistryService: ControllersRegistryHandlerBackendService, i18nController: AbstractControllerBackendService, applicationConfigController: AbstractControllerBackendService, authenticationController: AbstractControllerBackendService, featuresController: AbstractControllerBackendService, i18nService: I18nBackendService, servicesRegistryService: ServicesRegistryHandlerBackendService, customImplRegistry: ResourceOperationCustomImplementationRegistryBackendService, repositoriesRegistryService: RepositoriesRegistryHandlerBackendService, appConfigInitializer: PlatformAppConfigInitializerService, companionContext: CompanionContext, authFloorService: CompanionAuthFloorCompanionService, startupCompositionFence: CompanionStartupCompositionFence, codingAgentDispatchService: CodingAgentDispatchCompanionService, introspectionSourceWatcher: IntrospectionSourceWatcherCompanionService, introspectionResourceNotifier: IntrospectionResourceNotifierCompanionService, introspectionResourceSource: IntrospectionResourceSourceCompanionService);
|
|
58
65
|
/**
|
|
59
66
|
* Initialize the companion application using the typed config object.
|
|
60
67
|
*/
|
|
@@ -142,6 +149,21 @@ export declare class StartCompanionApplicationService {
|
|
|
142
149
|
*/
|
|
143
150
|
private initializePlatformRuntimeDependencies;
|
|
144
151
|
private initializePlatformHttpServer;
|
|
152
|
+
/**
|
|
153
|
+
* Start the plane that keeps introspection derivations current WITHOUT a reader asking.
|
|
154
|
+
*
|
|
155
|
+
* Ordered after the WebSocket server on purpose: the notifier's whole output is a socket emit, and
|
|
156
|
+
* starting it before the server exists would give it a window in which a recompilation is computed
|
|
157
|
+
* and then silently dropped.
|
|
158
|
+
*
|
|
159
|
+
* Failure here is NON-FATAL, and that is the important part. Everything this plane does is a
|
|
160
|
+
* latency and freshness improvement over a path that still works without it: with no watcher the
|
|
161
|
+
* derivation state stays in per-read observation, which is exactly the behaviour issue #159
|
|
162
|
+
* shipped. A companion that refuses to boot because a directory could not be watched would trade a
|
|
163
|
+
* slow workbench for no workbench — and the remedy for that would need the companion this failure
|
|
164
|
+
* just prevented from starting (`continuity-drift-and-cas-basis.md` Rule 3).
|
|
165
|
+
*/
|
|
166
|
+
private startIntrospectionFreshnessPlane;
|
|
145
167
|
/**
|
|
146
168
|
* Generated CRUD routes for the WORKBENCH resources — and for nothing else.
|
|
147
169
|
*
|
|
@@ -206,6 +228,21 @@ export declare class StartCompanionApplicationService {
|
|
|
206
228
|
* logger, error builder and services as everything else in this process.
|
|
207
229
|
*/
|
|
208
230
|
private resolveFrontendSupportControllers;
|
|
231
|
+
/**
|
|
232
|
+
* The creation-plane CONTROL resources the workbench consumes AS resources.
|
|
233
|
+
*
|
|
234
|
+
* These are the platform's own control-plane rows — the actor tasks and executions the companion
|
|
235
|
+
* itself writes (repository-direct) during playbook runs and coding dispatches. Their configs are
|
|
236
|
+
* shared platform vocabulary (`wildo-application-tasks` / `wildo-application-executions` in
|
|
237
|
+
* `@wildo-ai/platform-core-shared`), whose READ/LIST became ORG_MEMBER-gated API variants on
|
|
238
|
+
* 2026-09-01 precisely for this consumption (the decision is recorded on
|
|
239
|
+
* `createOrgMemberReadApiVariant` in those files). Writes remain repository-only; mounting here opens
|
|
240
|
+
* READ/LIST doors and nothing else.
|
|
241
|
+
*
|
|
242
|
+
* A hand list rather than a derivation, deliberately: consuming a control-plane type is a
|
|
243
|
+
* per-type DECISION (each one widens an HTTP surface), not a population to sweep.
|
|
244
|
+
*/
|
|
245
|
+
private static readonly CREATION_CONTROL_PLANE_RESOURCE_TYPES;
|
|
209
246
|
private initializeWorkbenchResourceControllers;
|
|
210
247
|
private registerCustomControllers;
|
|
211
248
|
/** Transport liveness only; semantic readiness is exposed separately below. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-companion-application.service.d.ts","sourceRoot":"","sources":["../../../../../../src/core/runtime/services/start-companion-application.service.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,kBAAkB,EAElB,wBAAwB,EACxB,cAAc,EACd,gCAAgC,EAChC,YAAY,EACZ,+BAA+B,EAC/B,uCAAuC,EACvC,2BAA2B,EAC3B,mCAAmC,EACnC,0BAA0B,EAC1B,wCAAwC,EACxC,+BAA+B,EAC/B,qCAAqC,EACrC,yCAAyC,
|
|
1
|
+
{"version":3,"file":"start-companion-application.service.d.ts","sourceRoot":"","sources":["../../../../../../src/core/runtime/services/start-companion-application.service.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,kBAAkB,EAElB,wBAAwB,EACxB,cAAc,EACd,gCAAgC,EAChC,YAAY,EACZ,+BAA+B,EAC/B,uCAAuC,EACvC,2BAA2B,EAC3B,mCAAmC,EACnC,0BAA0B,EAC1B,wCAAwC,EACxC,+BAA+B,EAC/B,qCAAqC,EACrC,yCAAyC,EACzC,2DAA2D,EAG3D,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACrC,KAAK,aAAa,EAEnB,MAAM,4BAA4B,CAAC;AAkBpC,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAGlF,OAAO,EAAE,0CAA0C,E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IAIrC;;;;;;;;;OASG;IACH,OAAO,CAAC,gCAAgC;IAkDxC,OAAO,CAAC,8BAA8B;IAWtC;;;;;;OAMG;IACH,OAAO,CAAC,kCAAkC;IAsB1C,4FAA4F;YAC9E,sBAAsB;CAiBrC"}
|
|
@@ -14,14 +14,18 @@ var StartCompanionApplicationService_1;
|
|
|
14
14
|
import { chmodSync, mkdirSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
15
15
|
import { dirname, join } from 'node:path';
|
|
16
16
|
import { injectable, inject } from 'inversify';
|
|
17
|
-
import { I18nBackendService, SAAS_SERVICE_TYPES, HttpServerBackendService, MongoDBService, PostgreSQLDatabaseBackendService, RedisService, FileStorageRouterBackendService, ExternalProvidersRegistryBackendService, ObservabilityBackendService, WorkerShutdownManagerBackendService, FlowsActorsRegistryService, ControllersRegistryHandlerBackendService, ResourcesRegistryBackendService, ServicesRegistryHandlerBackendService, RepositoriesRegistryHandlerBackendService, mergeBackendDomainModules, projectCaughtErrorLogFields, describeCaughtError, } from '@wildo-ai/saas-backend-lib';
|
|
17
|
+
import { I18nBackendService, SAAS_SERVICE_TYPES, HttpServerBackendService, MongoDBService, PostgreSQLDatabaseBackendService, RedisService, FileStorageRouterBackendService, ExternalProvidersRegistryBackendService, ObservabilityBackendService, WorkerShutdownManagerBackendService, FlowsActorsRegistryService, ControllersRegistryHandlerBackendService, ResourcesRegistryBackendService, ServicesRegistryHandlerBackendService, RepositoriesRegistryHandlerBackendService, ResourceOperationCustomImplementationRegistryBackendService, mergeBackendDomainModules, projectCaughtErrorLogFields, describeCaughtError, } from '@wildo-ai/saas-backend-lib';
|
|
18
18
|
import { CoreResourceType, buildSharedSaaSModulesRegistry, ENGINE_RUNTIME_REQUIRED_RESOURCE_TYPES, } from '@wildo-ai/saas-models';
|
|
19
19
|
import { registerFeatureSpecifications, registerRoleSpecifications, } from '@wildo-ai/saas-specifications';
|
|
20
20
|
import { PLATFORM_SHARED_SERVICE_TYPES, } from '@wildo-ai/platform-shared-lib';
|
|
21
21
|
import { COMPANION_SERVICE_TYPES } from '../../../core/inject/models/service-types.js';
|
|
22
|
+
import { IntrospectionSourceWatcherCompanionService } from '../../introspection/services/introspection-source-watcher.companion.service.js';
|
|
23
|
+
import { IntrospectionResourceNotifierCompanionService } from '../../introspection/resources/introspection-resource-notifier.companion.service.js';
|
|
24
|
+
import { IntrospectionResourceSourceCompanionService } from '../../introspection/resources/introspection-resource-source.companion.service.js';
|
|
25
|
+
import { createCreationPlaneDispatchFactories } from '../../introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js';
|
|
22
26
|
import { CompanionAuthFloorCompanionService } from '../../auth/companion-auth-floor.companion.service.js';
|
|
23
27
|
import { buildCompanionResolvedAppConfig, parseCompanionPlatformEnv, planCompanionPlatformStoreConnections, } from '../utils/companion-platform-config.companion.js';
|
|
24
|
-
import { WorkbenchShared_ResourceType } from '@wildo-ai/platform-core-shared';
|
|
28
|
+
import { CustomShared_ResourceType, WorkbenchShared_ResourceType } from '@wildo-ai/platform-core-shared';
|
|
25
29
|
import { companionPlatformCoreBackendModule, companionPlatformCoreSharedModule, companionWorkbenchSharedModule, } from '../utils/platform-core-domain-modules.companion.js';
|
|
26
30
|
import { loadBackendCompanionExports, loadSharedLibraryCompanionExports, loadSpecificationsCompanionExports, } from '../../context/companion-package-loaders.companion.js';
|
|
27
31
|
import { CompanionStartupCompositionFence } from '../companion-startup-composition-fence.js';
|
|
@@ -79,18 +83,22 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
|
|
|
79
83
|
featuresController;
|
|
80
84
|
i18nService;
|
|
81
85
|
servicesRegistryService;
|
|
86
|
+
customImplRegistry;
|
|
82
87
|
repositoriesRegistryService;
|
|
83
88
|
appConfigInitializer;
|
|
84
89
|
companionContext;
|
|
85
90
|
authFloorService;
|
|
86
91
|
startupCompositionFence;
|
|
87
92
|
codingAgentDispatchService;
|
|
93
|
+
introspectionSourceWatcher;
|
|
94
|
+
introspectionResourceNotifier;
|
|
95
|
+
introspectionResourceSource;
|
|
88
96
|
logDebug;
|
|
89
97
|
readinessObservationProducerInstanceId = `${process.pid}-${Date.now()}`;
|
|
90
98
|
readinessObservationHeartbeat = null;
|
|
91
99
|
initialized = false;
|
|
92
100
|
shutdownLifecycleRegistered = false;
|
|
93
|
-
constructor(logger, httpServerService, mongoDBService, postgresqlDatabaseService, redisService, fileStorageRouter, backendProviderRegistryService, externalProvidersRegistryService, observabilityBackendService, workerShutdownManager, flowsActorsRegistryService, resourcesRegistryService, controllersRegistryService, i18nController, applicationConfigController, authenticationController, featuresController, i18nService, servicesRegistryService, repositoriesRegistryService, appConfigInitializer, companionContext, authFloorService, startupCompositionFence, codingAgentDispatchService) {
|
|
101
|
+
constructor(logger, httpServerService, mongoDBService, postgresqlDatabaseService, redisService, fileStorageRouter, backendProviderRegistryService, externalProvidersRegistryService, observabilityBackendService, workerShutdownManager, flowsActorsRegistryService, resourcesRegistryService, controllersRegistryService, i18nController, applicationConfigController, authenticationController, featuresController, i18nService, servicesRegistryService, customImplRegistry, repositoriesRegistryService, appConfigInitializer, companionContext, authFloorService, startupCompositionFence, codingAgentDispatchService, introspectionSourceWatcher, introspectionResourceNotifier, introspectionResourceSource) {
|
|
94
102
|
this.logger = logger;
|
|
95
103
|
this.httpServerService = httpServerService;
|
|
96
104
|
this.mongoDBService = mongoDBService;
|
|
@@ -110,12 +118,16 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
|
|
|
110
118
|
this.featuresController = featuresController;
|
|
111
119
|
this.i18nService = i18nService;
|
|
112
120
|
this.servicesRegistryService = servicesRegistryService;
|
|
121
|
+
this.customImplRegistry = customImplRegistry;
|
|
113
122
|
this.repositoriesRegistryService = repositoriesRegistryService;
|
|
114
123
|
this.appConfigInitializer = appConfigInitializer;
|
|
115
124
|
this.companionContext = companionContext;
|
|
116
125
|
this.authFloorService = authFloorService;
|
|
117
126
|
this.startupCompositionFence = startupCompositionFence;
|
|
118
127
|
this.codingAgentDispatchService = codingAgentDispatchService;
|
|
128
|
+
this.introspectionSourceWatcher = introspectionSourceWatcher;
|
|
129
|
+
this.introspectionResourceNotifier = introspectionResourceNotifier;
|
|
130
|
+
this.introspectionResourceSource = introspectionResourceSource;
|
|
119
131
|
this.logDebug = this.logger.debugByType('StartCompanionApplication');
|
|
120
132
|
this.logger.setDebugTypeLogging('StartCompanionApplication', true);
|
|
121
133
|
}
|
|
@@ -512,6 +524,49 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
|
|
|
512
524
|
* permanent "Reconnecting" and which no log explains.
|
|
513
525
|
*/
|
|
514
526
|
await this.httpServerService.initialize({ skipWebSocket: false });
|
|
527
|
+
await this.startIntrospectionFreshnessPlane();
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Start the plane that keeps introspection derivations current WITHOUT a reader asking.
|
|
531
|
+
*
|
|
532
|
+
* Ordered after the WebSocket server on purpose: the notifier's whole output is a socket emit, and
|
|
533
|
+
* starting it before the server exists would give it a window in which a recompilation is computed
|
|
534
|
+
* and then silently dropped.
|
|
535
|
+
*
|
|
536
|
+
* Failure here is NON-FATAL, and that is the important part. Everything this plane does is a
|
|
537
|
+
* latency and freshness improvement over a path that still works without it: with no watcher the
|
|
538
|
+
* derivation state stays in per-read observation, which is exactly the behaviour issue #159
|
|
539
|
+
* shipped. A companion that refuses to boot because a directory could not be watched would trade a
|
|
540
|
+
* slow workbench for no workbench — and the remedy for that would need the companion this failure
|
|
541
|
+
* just prevented from starting (`continuity-drift-and-cas-basis.md` Rule 3).
|
|
542
|
+
*/
|
|
543
|
+
async startIntrospectionFreshnessPlane() {
|
|
544
|
+
try {
|
|
545
|
+
this.introspectionResourceNotifier.start();
|
|
546
|
+
await this.introspectionSourceWatcher.start();
|
|
547
|
+
this.logDebug('[StartCompanionApplication] Introspection freshness plane started');
|
|
548
|
+
/*
|
|
549
|
+
* Warming is started and NOT awaited. It spawns one subprocess per declared behavior, each
|
|
550
|
+
* importing the whole target application, so awaiting it would add the very 8.8 s to boot that
|
|
551
|
+
* it exists to remove from the first read. Boot completing while warming runs is the correct
|
|
552
|
+
* shape: a read arriving mid-warm joins the in-flight compilation rather than starting a
|
|
553
|
+
* second one.
|
|
554
|
+
*/
|
|
555
|
+
void this.introspectionResourceSource.warmDeclaredDerivations()
|
|
556
|
+
.then(({ attempted, failed }) => {
|
|
557
|
+
if (attempted === 0)
|
|
558
|
+
return;
|
|
559
|
+
this.logger.info('Introspection derivations warmed', { attempted, failed });
|
|
560
|
+
})
|
|
561
|
+
.catch((error) => {
|
|
562
|
+
this.logger.warn('Introspection derivation warming failed', {
|
|
563
|
+
error: error instanceof Error ? error.message : String(error),
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
catch (error) {
|
|
568
|
+
this.logger.warn('Introspection freshness plane failed to start; derivations fall back to per-read source observation', { error: error instanceof Error ? error.message : String(error) });
|
|
569
|
+
}
|
|
515
570
|
}
|
|
516
571
|
/**
|
|
517
572
|
* Generated CRUD routes for the WORKBENCH resources — and for nothing else.
|
|
@@ -611,8 +666,45 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
|
|
|
611
666
|
this.featuresController,
|
|
612
667
|
];
|
|
613
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* The creation-plane CONTROL resources the workbench consumes AS resources.
|
|
671
|
+
*
|
|
672
|
+
* These are the platform's own control-plane rows — the actor tasks and executions the companion
|
|
673
|
+
* itself writes (repository-direct) during playbook runs and coding dispatches. Their configs are
|
|
674
|
+
* shared platform vocabulary (`wildo-application-tasks` / `wildo-application-executions` in
|
|
675
|
+
* `@wildo-ai/platform-core-shared`), whose READ/LIST became ORG_MEMBER-gated API variants on
|
|
676
|
+
* 2026-09-01 precisely for this consumption (the decision is recorded on
|
|
677
|
+
* `createOrgMemberReadApiVariant` in those files). Writes remain repository-only; mounting here opens
|
|
678
|
+
* READ/LIST doors and nothing else.
|
|
679
|
+
*
|
|
680
|
+
* A hand list rather than a derivation, deliberately: consuming a control-plane type is a
|
|
681
|
+
* per-type DECISION (each one widens an HTTP surface), not a population to sweep.
|
|
682
|
+
*/
|
|
683
|
+
static CREATION_CONTROL_PLANE_RESOURCE_TYPES = [
|
|
684
|
+
/*
|
|
685
|
+
* The parent anchor first: every control-plane URL nests under
|
|
686
|
+
* `…/wildo-application/{wildoApplicationId}/…`, and the workbench bootstraps that id by LISTing
|
|
687
|
+
* this resource (one row per companion). Its config already carried API variants; mounting is
|
|
688
|
+
* all it needed.
|
|
689
|
+
*/
|
|
690
|
+
CustomShared_ResourceType.WILDO_APPLICATION,
|
|
691
|
+
/*
|
|
692
|
+
* ORGANIZATIONS rides with the plane: it is the PRIMARY SCOPE of all three control-plane types,
|
|
693
|
+
* so the workbench frontend registers it — and a registered organizations resource makes the
|
|
694
|
+
* engine shell READ the org rows it scopes by. Unmounted, those reads 404 on every session
|
|
695
|
+
* (measured); the rows exist in this application's own database, and the engine's standard
|
|
696
|
+
* controller serves them behind ordinary auth.
|
|
697
|
+
*/
|
|
698
|
+
CoreResourceType.ORGANIZATIONS,
|
|
699
|
+
CustomShared_ResourceType.WILDO_APPLICATION_ACTOR_TASKS,
|
|
700
|
+
CustomShared_ResourceType.WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS,
|
|
701
|
+
CustomShared_ResourceType.WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS,
|
|
702
|
+
];
|
|
614
703
|
async initializeWorkbenchResourceControllers() {
|
|
615
|
-
const workbenchResourceTypes =
|
|
704
|
+
const workbenchResourceTypes = [
|
|
705
|
+
...Object.values(WorkbenchShared_ResourceType),
|
|
706
|
+
...StartCompanionApplicationService_1.CREATION_CONTROL_PLANE_RESOURCE_TYPES,
|
|
707
|
+
];
|
|
616
708
|
/*
|
|
617
709
|
* SERVICES before CONTROLLERS, and both whitelisted to the same set.
|
|
618
710
|
*
|
|
@@ -648,6 +740,17 @@ let StartCompanionApplicationService = class StartCompanionApplicationService {
|
|
|
648
740
|
...workbenchResourceTypes,
|
|
649
741
|
...StartCompanionApplicationService_1.FRONTEND_SUPPORT_SERVICE_RESOURCE_TYPES,
|
|
650
742
|
]);
|
|
743
|
+
/*
|
|
744
|
+
* The creation board's DISPATCH operations (Phase 3 of `workbench-creation-board-resources.md`):
|
|
745
|
+
* OVERRIDE_ALL custom implementations delegating to the companion's own services. Initialized
|
|
746
|
+
* AFTER the services registry, because registrations validate against the CONFIGURED operation
|
|
747
|
+
* paths at init — a drifting identifier fails the boot here instead of becoming unreachable
|
|
748
|
+
* code (the exact silence the registry's own doc records). This list is the companion's WHOLE
|
|
749
|
+
* custom-impl registry, deliberately: the engine's `CoreBackend_ServiceImplementationsFactories`
|
|
750
|
+
* have never run in this process, and activating them here would change the behavior of every
|
|
751
|
+
* engine resource the companion mounts as a side effect of a board feature.
|
|
752
|
+
*/
|
|
753
|
+
this.customImplRegistry.initialize(createCreationPlaneDispatchFactories());
|
|
651
754
|
/*
|
|
652
755
|
* The engine's OWN runtime floor is mounted beside the workbench's resources, and it is the one
|
|
653
756
|
* exception to "controllers stay exactly the workbench's own resources".
|
|
@@ -819,12 +922,16 @@ StartCompanionApplicationService = StartCompanionApplicationService_1 = __decora
|
|
|
819
922
|
__param(16, inject(SAAS_SERVICE_TYPES.FeaturesController)),
|
|
820
923
|
__param(17, inject(SAAS_SERVICE_TYPES.I18nService)),
|
|
821
924
|
__param(18, inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService)),
|
|
822
|
-
__param(19, inject(SAAS_SERVICE_TYPES.
|
|
823
|
-
__param(20, inject(
|
|
824
|
-
__param(21, inject(
|
|
825
|
-
__param(22, inject(COMPANION_SERVICE_TYPES.
|
|
826
|
-
__param(23, inject(COMPANION_SERVICE_TYPES.
|
|
827
|
-
__param(24, inject(COMPANION_SERVICE_TYPES.
|
|
925
|
+
__param(19, inject(SAAS_SERVICE_TYPES.ResourceOperationCustomImplementationRegistryService)),
|
|
926
|
+
__param(20, inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService)),
|
|
927
|
+
__param(21, inject(PLATFORM_SHARED_SERVICE_TYPES.PlatformAppConfigInitializerService)),
|
|
928
|
+
__param(22, inject(COMPANION_SERVICE_TYPES.CompanionContext)),
|
|
929
|
+
__param(23, inject(COMPANION_SERVICE_TYPES.AuthFloorService)),
|
|
930
|
+
__param(24, inject(COMPANION_SERVICE_TYPES.CompanionStartupCompositionFence)),
|
|
931
|
+
__param(25, inject(COMPANION_SERVICE_TYPES.CodingAgentDispatchService)),
|
|
932
|
+
__param(26, inject(COMPANION_SERVICE_TYPES.IntrospectionSourceWatcherService)),
|
|
933
|
+
__param(27, inject(COMPANION_SERVICE_TYPES.IntrospectionResourceNotifierService)),
|
|
934
|
+
__param(28, inject(SAAS_SERVICE_TYPES.IntrospectionResourceSource)),
|
|
828
935
|
__metadata("design:paramtypes", [Function, HttpServerBackendService,
|
|
829
936
|
MongoDBService,
|
|
830
937
|
PostgreSQLDatabaseBackendService,
|
|
@@ -836,9 +943,13 @@ StartCompanionApplicationService = StartCompanionApplicationService_1 = __decora
|
|
|
836
943
|
ResourcesRegistryBackendService,
|
|
837
944
|
ControllersRegistryHandlerBackendService, Function, Function, Function, Function, I18nBackendService,
|
|
838
945
|
ServicesRegistryHandlerBackendService,
|
|
946
|
+
ResourceOperationCustomImplementationRegistryBackendService,
|
|
839
947
|
RepositoriesRegistryHandlerBackendService, Function, Object, CompanionAuthFloorCompanionService,
|
|
840
948
|
CompanionStartupCompositionFence,
|
|
841
|
-
CodingAgentDispatchCompanionService
|
|
949
|
+
CodingAgentDispatchCompanionService,
|
|
950
|
+
IntrospectionSourceWatcherCompanionService,
|
|
951
|
+
IntrospectionResourceNotifierCompanionService,
|
|
952
|
+
IntrospectionResourceSourceCompanionService])
|
|
842
953
|
], StartCompanionApplicationService);
|
|
843
954
|
export { StartCompanionApplicationService };
|
|
844
955
|
//# sourceMappingURL=start-companion-application.service.js.map
|