@wildo-ai/dev-companion 1.1.2 → 1.1.3
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/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +4 -12
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +0 -16
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +0 -17
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +0 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +2 -27
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +1 -8
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +9 -4
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +21 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +1 -39
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +1 -3
- 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 +23 -36
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.js +0 -5
- package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +3 -82
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +4 -113
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +3 -82
- 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 +54 -138
- 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 +1 -27
- 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 +5 -38
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +0 -25
- 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 +0 -37
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +2 -7
- 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 +30 -122
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- 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 +0 -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 +1 -3
- 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 +1 -38
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +0 -36
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +0 -1
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +0 -75
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +0 -1
|
@@ -9,7 +9,6 @@ import { buildLabellingActorSystemDefinitions } from '../../i18n-labelling/model
|
|
|
9
9
|
import { buildMetaWorkflowsActorSystemDefinitions } from '../../meta-workflows/models/meta-workflows.actors-system.definitions.js';
|
|
10
10
|
import { applicationCodingAgents } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
|
|
11
11
|
import { applicationResearchAgents } from '../../meta-workflows/models/application-research-agent.actors-system.definitions.js';
|
|
12
|
-
import { briefAdequacyAgents } from '../../meta-workflows/models/brief-adequacy.actors-system.definitions.js';
|
|
13
12
|
import { buildLogoGenerationAgent } from '../../brand/models/logo-generation.actors-system.definitions.js';
|
|
14
13
|
import { buildLogoJudgeAgent } from '../../brand/models/logo-judge.actors-system.definitions.js';
|
|
15
14
|
import { buildExpertPersonaDerivationAgent } from '../../expert-personas/models/expert-persona-derivation.actors-system.definitions.js';
|
|
@@ -131,10 +130,6 @@ export async function assembleCompanionStartup(companionContext, runtimeConfig)
|
|
|
131
130
|
// The read-only sibling: same ACP transport, opposite posture. Registered beside the coding
|
|
132
131
|
// Agent so "registered exactly once" stays one list to read.
|
|
133
132
|
...applicationResearchAgents,
|
|
134
|
-
// The brief-adequacy gate (#254's rescoped shape): judges one composed brief per opted-in
|
|
135
|
-
// playbook run and proposes add-only context repairs. Registered beside its siblings so
|
|
136
|
-
// "registered exactly once" stays one list to read.
|
|
137
|
-
...briefAdequacyAgents,
|
|
138
133
|
// Companion-owned IMAGE agent (brand/logo generation step). Registered
|
|
139
134
|
// here, like labelling/meta-workflows — not shipped as an engine default.
|
|
140
135
|
buildLogoGenerationAgent(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-startup-assembly.js","sourceRoot":"","sources":["../../../../../src/core/runtime/companion-startup-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,wCAAwC,EAAE,MAAM,+BAA+B,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6DAA6D,CAAC;AAC1F,OAAO,EAEL,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,iEAAiE,CAAC;AACvH,OAAO,EAAE,wCAAwC,EAAE,MAAM,sEAAsE,CAAC;AAChI,OAAO,EAAE,uBAAuB,EAAE,MAAM,gFAAgF,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kFAAkF,CAAC;AAC7H,OAAO,EAAE,mBAAmB,EAAE,MAAM,sEAAsE,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,8DAA8D,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE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E;gBACjE,GAAG,uBAAuB;gBAC1B,4FAA4F;gBAC5F,6DAA6D;gBAC7D,GAAG,yBAAyB;gBAC5B,0FAA0F;gBAC1F,wFAAwF;gBACxF,oDAAoD;gBACpD,GAAG,mBAAmB;gBACtB,uEAAuE;gBACvE,0EAA0E;gBAC1E,wBAAwB,EAAE;gBAC1B,wEAAwE;gBACxE,uEAAuE;gBACvE,mBAAmB,EAAE;gBACrB,2DAA2D;gBAC3D,qEAAqE;gBACrE,uDAAuD;gBACvD,iCAAiC,EAAE;gBACnC,kEAAkE;gBAClE,iEAAiE;gBACjE,8DAA8D;gBAC9D,+BAA+B,EAAE;gBACjC,gEAAgE;gBAChE,kCAAkC,EAAE;gBACpC,8DAA8D;gBAC9D,GAAG,qBAAqB,CAAC,MAAM;aAChC;SACF;KACF,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import {\n setupSaasBackendInjection,\n marketGenerationAgent,\n MARKET_GENERATION_AGENT_REF,\n describeCaughtError,\n} from '@wildo-ai/saas-backend-lib';\nimport type { FlowsActors_Agent } from '@wildo-ai/saas-models';\nimport { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport { PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS } from '@wildo-ai/platform-config-lib';\nimport type { SaasRuntimeProvidersArtifact } from '@wildo-ai/platform-config-lib';\n\nimport { emailAgents } from '../../email/models/email-template.actors-system.definitions';\nimport {\n CompanionController,\n setupCompanionInjection,\n} from '../inject/models/container';\nimport { COMPANION_SERVICE_TYPES } from '../inject/models/service-types';\nimport { buildLabellingActorSystemDefinitions } from '../../i18n-labelling/models/labelling.actors-system.definitions';\nimport { buildMetaWorkflowsActorSystemDefinitions } from '../../meta-workflows/models/meta-workflows.actors-system.definitions';\nimport { applicationCodingAgents } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions';\nimport { applicationResearchAgents } from '../../meta-workflows/models/application-research-agent.actors-system.definitions';\nimport { briefAdequacyAgents } from '../../meta-workflows/models/brief-adequacy.actors-system.definitions';\nimport { buildLogoGenerationAgent } from '../../brand/models/logo-generation.actors-system.definitions';\nimport { buildLogoJudgeAgent } from '../../brand/models/logo-judge.actors-system.definitions';\nimport { buildExpertPersonaDerivationAgent } from '../../expert-personas/models/expert-persona-derivation.actors-system.definitions';\nimport { buildExpertPersonaCritiqueAgent } from '../../expert-personas/models/expert-persona-critique.actors-system.definitions';\nimport { buildDeliberationTextProducerAgent } from '../../deliberations/models/deliberation-agents.actors-system.definitions';\nimport { loadCommittedExpertAgents } from '../../deliberations/utils/load-committed-expert-agents';\nimport type { CompanionContext } from '../context/companion-context';\nimport { loadBackendCompanionExports } from '../context/companion-package-loaders.companion';\nimport type { CompanionRuntimeConfig } from './models/companion-runtime.models';\nimport type { CompanionStartupConfig } from './services/start-companion-application.service';\n\n/**\n * The complete ordinary companion composition: the DI container and the exact\n * startup config object `StartCompanionApplicationService.initialize` accepts.\n */\nexport interface AssembledCompanionStartup {\n readonly container: ReturnType<typeof setupSaasBackendInjection>;\n readonly startupConfig: CompanionStartupConfig;\n}\n\n/**\n * Loads the companion's provider-runtime topology from the APPLICATION's generated JSON artifact\n * (`.wildo-saas/generated/providers/companion.runtime-providers.generated.json`).\n *\n * This used to be a compiled-in `src/generated/wildo-provider-runtime.generated.ts` module, like\n * the backend/minion/worker hosts still use. That shape cannot survive the dist-only companion\n * distribution (issue #64): the generated module is APP-SPECIFIC data, the canonical companion\n * package at `platform/factory` is app-agnostic, and the delivered drop carries no source and no\n * compiler. The artifact content is pure environment-independent topology data, and `wildo config\n * sync` already materializes it as JSON at a path this process can reach through its application\n * root — so the JSON is the one authority and no per-companion module exists any more.\n */\nasync function loadProviderRuntime(saasRoot: string): Promise<SaasRuntimeProvidersArtifact> {\n const artifactPath = join(saasRoot, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS.companion);\n try {\n const providerRuntime = JSON.parse(await readFile(artifactPath, 'utf8')) as SaasRuntimeProvidersArtifact;\n if (!providerRuntime?.scope || providerRuntime.artifactKind !== 'companion') {\n throw new Error('Companion provider runtime artifact does not carry a companion scope.');\n }\n return providerRuntime;\n } catch (error) {\n throw new Error(\n `Missing or invalid companion provider runtime artifact at ${artifactPath}. `\n + 'Run `wildo config sync` before starting this companion. '\n + describeCaughtError(error),\n );\n }\n}\n\n/**\n * Resolve the market generation agent the companion registers under\n * `MARKET_GENERATION_AGENT_REF`.\n *\n * Returns the application-authored override\n * (`BackendCompanionExports.marketGenerationAgentOverride`) when present,\n * otherwise the framework default (`marketGenerationAgent` from\n * `@wildo-ai/saas-backend-lib`). The override must reuse the canonical ref:\n * the market service invokes the agent by that fixed ref, so an override\n * under a different ref would be dead-registered and never reached. We fail\n * fast at startup with a precise message rather than silently rewrite the\n * ref (a silent rewrite would mask the authoring mistake).\n */\nfunction resolveMarketGenerationAgent(\n override: FlowsActors_Agent | undefined,\n): FlowsActors_Agent {\n if (!override) {\n return marketGenerationAgent;\n }\n if (override.ref !== MARKET_GENERATION_AGENT_REF) {\n throw new Error(\n `Application market generation agent override must use ref \"${MARKET_GENERATION_AGENT_REF}\" `\n + `(received \"${override.ref}\"). The companion invokes the market generation agent by this fixed `\n + `ref, so an override under a different ref would never be reached. Set the override's \\`ref\\` to `\n + `the canonical value (import MARKET_GENERATION_AGENT_REF from '@wildo-ai/saas-backend-lib').`,\n );\n }\n return override;\n}\n\n/**\n * Assemble the ONE ordinary companion startup composition without starting it.\n *\n * This is the single authority for what the companion mounts and registers:\n * `src/index.ts` starts exactly this composition, and the explicit\n * first-activation maintenance operation (Step 4) boots the same assembly so\n * the startup-composition observer captures the true ordinary controller/agent\n * graph rather than a hand-maintained copy that could drift from it. Assembly\n * performs loader I/O (backend companion exports, generated provider runtime,\n * committed expert charters) and DI wiring only — no HTTP, no Mongo, no\n * continuity recovery, no durable effect.\n */\nexport async function assembleCompanionStartup(\n companionContext: CompanionContext,\n runtimeConfig: CompanionRuntimeConfig,\n): Promise<AssembledCompanionStartup> {\n const { backendConfig, marketGenerationAgentOverride } = await loadBackendCompanionExports(companionContext);\n const providerRuntime = await loadProviderRuntime(companionContext.saasRoot);\n\n // The market generation agent ships a framework default; the application\n // may override provider/model/persona via its backend companion-exports.\n const effectiveMarketGenerationAgent = resolveMarketGenerationAgent(marketGenerationAgentOverride);\n\n // Charter-built expert agents (RF-6): one deliberation agent per\n // COMMITTED ExpertPersonaCharter. Fail-open here (an app without\n // charters boots normally); the deliberation composer fail-closes.\n const committedExpertAgents = await loadCommittedExpertAgents(companionContext.saasRoot);\n\n const labellingDefinitions = buildLabellingActorSystemDefinitions();\n const metaWorkflowsDefinitions = buildMetaWorkflowsActorSystemDefinitions();\n\n const container = setupCompanionInjection(\n setupSaasBackendInjection() as never,\n companionContext,\n runtimeConfig,\n ) as ReturnType<typeof setupSaasBackendInjection>;\n\n const companionController = container.get(\n COMPANION_SERVICE_TYPES.CompanionController as never,\n ) as CompanionController;\n\n\n \n // Public-v2 assessment surface: catalog status/next reads plus token-gated\n // episode-addressed status/next and the non-terminal working-admission\n // `run`. READY posture only — see `customControllers` below.\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n const startupConfig: CompanionStartupConfig = {\n /*\n * Mounted in BOTH postures. In the healthy one it is an ordinary operator route; in the degraded one it is\n * the only way out, since a registry the companion cannot accept is exactly what closed everything else.\n */\n /*\n * The journey, public-v2 episode, workbench and assurance HTTP surfaces were deleted with the\n * accepted-state ledger they served. `companionController` is the surviving general surface; the\n * playbook-execution routes return here as the rebuild reaches them\n * (`.claude/plans/rebuild-playbook-execution.md`, P3).\n */\n customControllers: [companionController],\n backendConfig,\n providerRuntime,\n flowsActorsRegistry: {\n flowActorSystemsFactoryMap: {\n ...labellingDefinitions.factoryMap,\n ...metaWorkflowsDefinitions.factoryMap,\n },\n agents: [\n ...emailAgents,\n ...labellingDefinitions.agents,\n effectiveMarketGenerationAgent,\n ...metaWorkflowsDefinitions.agents,\n // The application coding agent (Claude Code through the ordinary\n // Flows/Actors AGENT_CLIENT_PROTOCOL path, `claude-code-acp` profile\n // authored in wildo.saas.config.ts). Registered exactly once, here,\n // in the one startup Agent collection — F2's typed task wrapper\n // resolves it by ref; there is no second dispatcher or registry.\n ...applicationCodingAgents,\n // The read-only sibling: same ACP transport, opposite posture. Registered beside the coding\n // Agent so \"registered exactly once\" stays one list to read.\n ...applicationResearchAgents,\n // The brief-adequacy gate (#254's rescoped shape): judges one composed brief per opted-in\n // playbook run and proposes add-only context repairs. Registered beside its siblings so\n // \"registered exactly once\" stays one list to read.\n ...briefAdequacyAgents,\n // Companion-owned IMAGE agent (brand/logo generation step). Registered\n // here, like labelling/meta-workflows — not shipped as an engine default.\n buildLogoGenerationAgent(),\n // Companion-owned JUDGE agent (brand/logo ACCEPT review point) — scores\n // a staged candidate against the authored brief (GENERATE_STRUCTURED).\n buildLogoJudgeAgent(),\n // Companion-owned expert-persona DERIVATION agent (agentic\n // deliberation system) — compiles app-specific persona charters from\n // framework role templates + the app's spec artifacts.\n buildExpertPersonaDerivationAgent(),\n // Companion-owned expert-persona CRITIQUE agent — the self-review\n // pass of the multi-pass derivation protocol (draft → critique →\n // finalize); a dedicated critic, separate from the generator.\n buildExpertPersonaCritiqueAgent(),\n // Deliberation TEXT producer (revision step for TEXT subjects).\n buildDeliberationTextProducerAgent(),\n // One deliberation agent per COMMITTED expert charter (RF-6).\n ...committedExpertAgents.agents,\n ],\n },\n };\n\n return { container, startupConfig };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"companion-startup-assembly.js","sourceRoot":"","sources":["../../../../../src/core/runtime/companion-startup-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,O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AAG,SAAS,CAAC,GAAG,CACvC,uBAAuB,CAAC,mBAA4B,CAC9B,CAAC;IAIzB,2EAA2E;IAC3E,uEAAuE;IACvE,6DAA6D;IAoB7D,MAAM,aAAa,GAA2B;QAC5C;;;WAGG;QACH;;;;;WAKG;QACH,iBAAiB,EAAE,CAAC,mBAAmB,CAAC;QACxC,aAAa;QACb,eAAe;QACf,mBAAmB,EAAE;YACnB,0BAA0B,EAAE;gBAC1B,GAAG,oBAAoB,CAAC,UAAU;gBAClC,GAAG,wBAAwB,CAAC,UAAU;aACvC;YACD,MAAM,EAAE;gBACN,GAAG,WAAW;gBACd,GAAG,oBAAoB,CAAC,MAAM;gBAC9B,8BAA8B;gBAC9B,GAAG,wBAAwB,CAAC,MAAM;gBAClC,iEAAiE;gBACjE,qEAAqE;gBACrE,oEAAoE;gBACpE,gEAAgE;gBAChE,iEAAiE;gBACjE,GAAG,uBAAuB;gBAC1B,4FAA4F;gBAC5F,6DAA6D;gBAC7D,GAAG,yBAAyB;gBAC5B,uEAAuE;gBACvE,0EAA0E;gBAC1E,wBAAwB,EAAE;gBAC1B,wEAAwE;gBACxE,uEAAuE;gBACvE,mBAAmB,EAAE;gBACrB,2DAA2D;gBAC3D,qEAAqE;gBACrE,uDAAuD;gBACvD,iCAAiC,EAAE;gBACnC,kEAAkE;gBAClE,iEAAiE;gBACjE,8DAA8D;gBAC9D,+BAA+B,EAAE;gBACjC,gEAAgE;gBAChE,kCAAkC,EAAE;gBACpC,8DAA8D;gBAC9D,GAAG,qBAAqB,CAAC,MAAM;aAChC;SACF;KACF,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import {\n setupSaasBackendInjection,\n marketGenerationAgent,\n MARKET_GENERATION_AGENT_REF,\n describeCaughtError,\n} from '@wildo-ai/saas-backend-lib';\nimport type { FlowsActors_Agent } from '@wildo-ai/saas-models';\nimport { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport { PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS } from '@wildo-ai/platform-config-lib';\nimport type { SaasRuntimeProvidersArtifact } from '@wildo-ai/platform-config-lib';\n\nimport { emailAgents } from '../../email/models/email-template.actors-system.definitions';\nimport {\n CompanionController,\n setupCompanionInjection,\n} from '../inject/models/container';\nimport { COMPANION_SERVICE_TYPES } from '../inject/models/service-types';\nimport { buildLabellingActorSystemDefinitions } from '../../i18n-labelling/models/labelling.actors-system.definitions';\nimport { buildMetaWorkflowsActorSystemDefinitions } from '../../meta-workflows/models/meta-workflows.actors-system.definitions';\nimport { applicationCodingAgents } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions';\nimport { applicationResearchAgents } from '../../meta-workflows/models/application-research-agent.actors-system.definitions';\nimport { buildLogoGenerationAgent } from '../../brand/models/logo-generation.actors-system.definitions';\nimport { buildLogoJudgeAgent } from '../../brand/models/logo-judge.actors-system.definitions';\nimport { buildExpertPersonaDerivationAgent } from '../../expert-personas/models/expert-persona-derivation.actors-system.definitions';\nimport { buildExpertPersonaCritiqueAgent } from '../../expert-personas/models/expert-persona-critique.actors-system.definitions';\nimport { buildDeliberationTextProducerAgent } from '../../deliberations/models/deliberation-agents.actors-system.definitions';\nimport { loadCommittedExpertAgents } from '../../deliberations/utils/load-committed-expert-agents';\nimport type { CompanionContext } from '../context/companion-context';\nimport { loadBackendCompanionExports } from '../context/companion-package-loaders.companion';\nimport type { CompanionRuntimeConfig } from './models/companion-runtime.models';\nimport type { CompanionStartupConfig } from './services/start-companion-application.service';\n\n/**\n * The complete ordinary companion composition: the DI container and the exact\n * startup config object `StartCompanionApplicationService.initialize` accepts.\n */\nexport interface AssembledCompanionStartup {\n readonly container: ReturnType<typeof setupSaasBackendInjection>;\n readonly startupConfig: CompanionStartupConfig;\n}\n\n/**\n * Loads the companion's provider-runtime topology from the APPLICATION's generated JSON artifact\n * (`.wildo-saas/generated/providers/companion.runtime-providers.generated.json`).\n *\n * This used to be a compiled-in `src/generated/wildo-provider-runtime.generated.ts` module, like\n * the backend/minion/worker hosts still use. That shape cannot survive the dist-only companion\n * distribution (issue #64): the generated module is APP-SPECIFIC data, the canonical companion\n * package at `platform/factory` is app-agnostic, and the delivered drop carries no source and no\n * compiler. The artifact content is pure environment-independent topology data, and `wildo config\n * sync` already materializes it as JSON at a path this process can reach through its application\n * root — so the JSON is the one authority and no per-companion module exists any more.\n */\nasync function loadProviderRuntime(saasRoot: string): Promise<SaasRuntimeProvidersArtifact> {\n const artifactPath = join(saasRoot, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS.companion);\n try {\n const providerRuntime = JSON.parse(await readFile(artifactPath, 'utf8')) as SaasRuntimeProvidersArtifact;\n if (!providerRuntime?.scope || providerRuntime.artifactKind !== 'companion') {\n throw new Error('Companion provider runtime artifact does not carry a companion scope.');\n }\n return providerRuntime;\n } catch (error) {\n throw new Error(\n `Missing or invalid companion provider runtime artifact at ${artifactPath}. `\n + 'Run `wildo config sync` before starting this companion. '\n + describeCaughtError(error),\n );\n }\n}\n\n/**\n * Resolve the market generation agent the companion registers under\n * `MARKET_GENERATION_AGENT_REF`.\n *\n * Returns the application-authored override\n * (`BackendCompanionExports.marketGenerationAgentOverride`) when present,\n * otherwise the framework default (`marketGenerationAgent` from\n * `@wildo-ai/saas-backend-lib`). The override must reuse the canonical ref:\n * the market service invokes the agent by that fixed ref, so an override\n * under a different ref would be dead-registered and never reached. We fail\n * fast at startup with a precise message rather than silently rewrite the\n * ref (a silent rewrite would mask the authoring mistake).\n */\nfunction resolveMarketGenerationAgent(\n override: FlowsActors_Agent | undefined,\n): FlowsActors_Agent {\n if (!override) {\n return marketGenerationAgent;\n }\n if (override.ref !== MARKET_GENERATION_AGENT_REF) {\n throw new Error(\n `Application market generation agent override must use ref \"${MARKET_GENERATION_AGENT_REF}\" `\n + `(received \"${override.ref}\"). The companion invokes the market generation agent by this fixed `\n + `ref, so an override under a different ref would never be reached. Set the override's \\`ref\\` to `\n + `the canonical value (import MARKET_GENERATION_AGENT_REF from '@wildo-ai/saas-backend-lib').`,\n );\n }\n return override;\n}\n\n/**\n * Assemble the ONE ordinary companion startup composition without starting it.\n *\n * This is the single authority for what the companion mounts and registers:\n * `src/index.ts` starts exactly this composition, and the explicit\n * first-activation maintenance operation (Step 4) boots the same assembly so\n * the startup-composition observer captures the true ordinary controller/agent\n * graph rather than a hand-maintained copy that could drift from it. Assembly\n * performs loader I/O (backend companion exports, generated provider runtime,\n * committed expert charters) and DI wiring only — no HTTP, no Mongo, no\n * continuity recovery, no durable effect.\n */\nexport async function assembleCompanionStartup(\n companionContext: CompanionContext,\n runtimeConfig: CompanionRuntimeConfig,\n): Promise<AssembledCompanionStartup> {\n const { backendConfig, marketGenerationAgentOverride } = await loadBackendCompanionExports(companionContext);\n const providerRuntime = await loadProviderRuntime(companionContext.saasRoot);\n\n // The market generation agent ships a framework default; the application\n // may override provider/model/persona via its backend companion-exports.\n const effectiveMarketGenerationAgent = resolveMarketGenerationAgent(marketGenerationAgentOverride);\n\n // Charter-built expert agents (RF-6): one deliberation agent per\n // COMMITTED ExpertPersonaCharter. Fail-open here (an app without\n // charters boots normally); the deliberation composer fail-closes.\n const committedExpertAgents = await loadCommittedExpertAgents(companionContext.saasRoot);\n\n const labellingDefinitions = buildLabellingActorSystemDefinitions();\n const metaWorkflowsDefinitions = buildMetaWorkflowsActorSystemDefinitions();\n\n const container = setupCompanionInjection(\n setupSaasBackendInjection() as never,\n companionContext,\n runtimeConfig,\n ) as ReturnType<typeof setupSaasBackendInjection>;\n\n const companionController = container.get(\n COMPANION_SERVICE_TYPES.CompanionController as never,\n ) as CompanionController;\n\n\n \n // Public-v2 assessment surface: catalog status/next reads plus token-gated\n // episode-addressed status/next and the non-terminal working-admission\n // `run`. READY posture only — see `customControllers` below.\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n const startupConfig: CompanionStartupConfig = {\n /*\n * Mounted in BOTH postures. In the healthy one it is an ordinary operator route; in the degraded one it is\n * the only way out, since a registry the companion cannot accept is exactly what closed everything else.\n */\n /*\n * The journey, public-v2 episode, workbench and assurance HTTP surfaces were deleted with the\n * accepted-state ledger they served. `companionController` is the surviving general surface; the\n * playbook-execution routes return here as the rebuild reaches them\n * (`.claude/plans/rebuild-playbook-execution.md`, P3).\n */\n customControllers: [companionController],\n backendConfig,\n providerRuntime,\n flowsActorsRegistry: {\n flowActorSystemsFactoryMap: {\n ...labellingDefinitions.factoryMap,\n ...metaWorkflowsDefinitions.factoryMap,\n },\n agents: [\n ...emailAgents,\n ...labellingDefinitions.agents,\n effectiveMarketGenerationAgent,\n ...metaWorkflowsDefinitions.agents,\n // The application coding agent (Claude Code through the ordinary\n // Flows/Actors AGENT_CLIENT_PROTOCOL path, `claude-code-acp` profile\n // authored in wildo.saas.config.ts). Registered exactly once, here,\n // in the one startup Agent collection — F2's typed task wrapper\n // resolves it by ref; there is no second dispatcher or registry.\n ...applicationCodingAgents,\n // The read-only sibling: same ACP transport, opposite posture. Registered beside the coding\n // Agent so \"registered exactly once\" stays one list to read.\n ...applicationResearchAgents,\n // Companion-owned IMAGE agent (brand/logo generation step). Registered\n // here, like labelling/meta-workflows — not shipped as an engine default.\n buildLogoGenerationAgent(),\n // Companion-owned JUDGE agent (brand/logo ACCEPT review point) — scores\n // a staged candidate against the authored brief (GENERATE_STRUCTURED).\n buildLogoJudgeAgent(),\n // Companion-owned expert-persona DERIVATION agent (agentic\n // deliberation system) — compiles app-specific persona charters from\n // framework role templates + the app's spec artifacts.\n buildExpertPersonaDerivationAgent(),\n // Companion-owned expert-persona CRITIQUE agent — the self-review\n // pass of the multi-pass derivation protocol (draft → critique →\n // finalize); a dedicated critic, separate from the generator.\n buildExpertPersonaCritiqueAgent(),\n // Deliberation TEXT producer (revision step for TEXT subjects).\n buildDeliberationTextProducerAgent(),\n // One deliberation agent per COMMITTED expert charter (RF-6).\n ...committedExpertAgents.agents,\n ],\n },\n };\n\n return { container, startupConfig };\n}\n"]}
|
|
@@ -1,55 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService
|
|
3
|
-
import { Actors_Task_Schema, ActorSystem_ExecutionSchema,
|
|
2
|
+
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService } from "@wildo-ai/saas-backend-lib";
|
|
3
|
+
import { Actors_Task_Schema, ActorSystem_ExecutionSchema, FlowSystem_Execution_Schema } from '@wildo-ai/saas-models';
|
|
4
4
|
import type { CompanionActorTasksListQuery, CompanionCreateActorTaskRequest, CompanionCreateActorExecutionRequest, CompanionCreateFlowExecutionRequest, CompanionExecutionsListQuery, CompanionUpdateActorTaskRequest } from "../../companion-api/companion-api.schemas";
|
|
5
5
|
import type { CompanionContext } from "../../core/context/companion-context";
|
|
6
6
|
import { CompanionTraceabilityService } from "../../core/traceability/companion-traceability.service";
|
|
7
7
|
import { type CompanionExecutionSessionContext } from "../../core/traceability/companion-traceability.models";
|
|
8
|
-
/**
|
|
9
|
-
* The room and payload for one repository-direct control-plane mutation (issue #286).
|
|
10
|
-
*
|
|
11
|
-
* Exported and pure so the two properties that MATTER can be pinned without standing up the whole
|
|
12
|
-
* service: which room the event goes to, and what it carries.
|
|
13
|
-
*
|
|
14
|
-
* ## The ORGANIZATION room is a tenant-isolation decision, not a detail
|
|
15
|
-
*
|
|
16
|
-
* `wildoApplicationActorTasks` and both execution resources declare `isPrimaryScope: true` on their
|
|
17
|
-
* ORGANIZATIONS relationship, so a row belongs to ONE tenant. The sibling introspection notifier
|
|
18
|
-
* legitimately broadcasts to the APPLICATION room because every resource it serves is
|
|
19
|
-
* APPLICATION-anchored; doing that here would carry one tenant's row ids to every user of the
|
|
20
|
-
* application.
|
|
21
|
-
*
|
|
22
|
-
* ## Notification-grade, never row data
|
|
23
|
-
*
|
|
24
|
-
* `currentObject` is deliberately absent. A scope room fans out to every member of the tenant, and
|
|
25
|
-
* these rows carry coding-agent input and output that a collection event has no business
|
|
26
|
-
* broadcasting. Subscribers learn WHAT moved and refetch through their own authorization — the same
|
|
27
|
-
* contract the introspection notifier's collection lane uses.
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildControlPlaneMutationNotification(resourceType: string, ownership: CompanionExecutionOwnership, resourceId: string, action: ResourceAction): {
|
|
30
|
-
resourceType: string;
|
|
31
|
-
rooms: {
|
|
32
|
-
scopeKey: ResourceScopeRoomKey;
|
|
33
|
-
scopeId: string;
|
|
34
|
-
}[];
|
|
35
|
-
event: CoreWebSocketEvent;
|
|
36
|
-
payload: {
|
|
37
|
-
resourceType: string;
|
|
38
|
-
resourceId: string;
|
|
39
|
-
contextResourceIdentifiers: {
|
|
40
|
-
organizationId: string;
|
|
41
|
-
applicationId: string;
|
|
42
|
-
};
|
|
43
|
-
action: ResourceAction;
|
|
44
|
-
affectedIds: string[];
|
|
45
|
-
operationIdentifier: CoreResourceOperation;
|
|
46
|
-
currentObject: any;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
interface CompanionExecutionOwnership {
|
|
50
|
-
organizationId: string;
|
|
51
|
-
wildoApplicationId: string;
|
|
52
|
-
}
|
|
53
8
|
type Wildo_Application_ActorSystem_Execution = z.infer<typeof ActorSystem_ExecutionSchema> & {
|
|
54
9
|
_id: string;
|
|
55
10
|
_version?: number;
|
|
@@ -78,10 +33,9 @@ export declare class CompanionExecutionsCompanionService {
|
|
|
78
33
|
private readonly executionContextCreator;
|
|
79
34
|
private readonly companionContext;
|
|
80
35
|
private readonly traceabilityService;
|
|
81
|
-
private readonly websocketService;
|
|
82
36
|
private readonly logDebug;
|
|
83
37
|
private ownershipPromise?;
|
|
84
|
-
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService, repositoriesRegistry: RepositoriesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, executionContextCreator: ExecutionContextCreatorBackendService, companionContext: CompanionContext, traceabilityService: CompanionTraceabilityService
|
|
38
|
+
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService, repositoriesRegistry: RepositoriesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, executionContextCreator: ExecutionContextCreatorBackendService, companionContext: CompanionContext, traceabilityService: CompanionTraceabilityService);
|
|
85
39
|
createActorExecution(payload: CompanionCreateActorExecutionRequest, sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution>;
|
|
86
40
|
createFlowExecution(payload: CompanionCreateFlowExecutionRequest, sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_FlowSystem_Execution>;
|
|
87
41
|
getActorExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution>;
|
|
@@ -98,39 +52,6 @@ export declare class CompanionExecutionsCompanionService {
|
|
|
98
52
|
* Resolving and memoizing that ownership keeps all repository calls scoped to
|
|
99
53
|
* the truthful platform parent instead of falling back to tenant-app semantics.
|
|
100
54
|
*/
|
|
101
|
-
/**
|
|
102
|
-
* Announce a control-plane row the companion wrote REPOSITORY-DIRECT (issue #286).
|
|
103
|
-
*
|
|
104
|
-
* ## Why these writes were silent
|
|
105
|
-
*
|
|
106
|
-
* The engine emits `RESOURCE_UPDATED` from its resource CONTROLLERS, after the operation commits.
|
|
107
|
-
* These rows never pass through one: the companion writes them straight to the repository inside
|
|
108
|
-
* its own transaction, which is deliberate (they are control-plane records, and their CREATE and
|
|
109
|
-
* UPDATE variants are `REPOSITORY_ONLY` precisely so no generated write API exists). The cost was
|
|
110
|
-
* that nothing ever announced them: a board watching actor tasks or executions learned about a
|
|
111
|
-
* new row only from a 30-second poll, and a SECOND browser learned nothing at all, because the
|
|
112
|
-
* only invalidation was one the dispatching page emitted to itself.
|
|
113
|
-
*
|
|
114
|
-
* ## The ORGANIZATION room, and why not the application room
|
|
115
|
-
*
|
|
116
|
-
* These resources declare `isPrimaryScope: true` on their ORGANIZATIONS relationship, so a row
|
|
117
|
-
* belongs to one tenant. Broadcasting to the application room — which the sibling introspection
|
|
118
|
-
* notifier legitimately uses, because every resource IT serves is APPLICATION-anchored — would
|
|
119
|
-
* carry one tenant's row ids to every user of the application. The room is keyed on the row's own
|
|
120
|
-
* `organizationId`, which the ownership resolution has already established for the write itself.
|
|
121
|
-
*
|
|
122
|
-
* ## Notification-grade, and after COMMIT
|
|
123
|
-
*
|
|
124
|
-
* Registered as a post-commit effect: announcing a row inside the transaction would advertise a
|
|
125
|
-
* write that can still roll back. The payload carries no `currentObject` — a scope room fans out
|
|
126
|
-
* to every member, and these rows carry coding-agent input and output that a collection event has
|
|
127
|
-
* no business broadcasting. Subscribers learn WHAT moved and refetch through their own
|
|
128
|
-
* authorization, which is the same contract the introspection notifier's collection lane uses.
|
|
129
|
-
*
|
|
130
|
-
* Failure is swallowed by design: an announcement that could fail a committed write would make a
|
|
131
|
-
* notification defect look like a persistence defect.
|
|
132
|
-
*/
|
|
133
|
-
private publishControlPlaneMutation;
|
|
134
55
|
private resolveOwnership;
|
|
135
56
|
private loadOwnership;
|
|
136
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-executions.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/executions/services/companion-executions.companion.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAE1B,qCAAqC,EACrC,aAAa,EACb,yCAAyC,EACzC,2CAA2C,EAC3C,+BAA+B,
|
|
1
|
+
{"version":3,"file":"companion-executions.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/executions/services/companion-executions.companion.service.ts"],"names":[],"mappings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BAAmB;IAK3B,OAAO,CAAC,yBAAyB;IAwBjC,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAWnC,OAAO,CAAC,sBAAsB;CAU/B"}
|
|
@@ -11,52 +11,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import { inject, injectable } from "inversify";
|
|
14
|
-
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService, SAAS_SERVICE_TYPES,
|
|
15
|
-
import { CoreResourceOperation,
|
|
14
|
+
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService, SAAS_SERVICE_TYPES, } from "@wildo-ai/saas-backend-lib";
|
|
15
|
+
import { CoreResourceOperation, ErrorCustomMessageReference, ErrorType, FlowsActors_ElementKind, FlowsActors_Status, ResourceSerializationUtils, deriveTrustedSystemWritePreservedFields, isWildoBackendError, } from '@wildo-ai/saas-models';
|
|
16
16
|
import { CustomShared_ResourceType } from "@wildo-ai/platform-core-shared";
|
|
17
17
|
import { COMPANION_SERVICE_TYPES } from "../../core/inject/models/service-types.js";
|
|
18
18
|
import { CompanionTraceabilityService } from "../../core/traceability/companion-traceability.service.js";
|
|
19
19
|
import { CompanionTraceabilityLevel, CompanionTraceAliasKind } from "../../core/traceability/companion-traceability.models.js";
|
|
20
|
-
/**
|
|
21
|
-
* The room and payload for one repository-direct control-plane mutation (issue #286).
|
|
22
|
-
*
|
|
23
|
-
* Exported and pure so the two properties that MATTER can be pinned without standing up the whole
|
|
24
|
-
* service: which room the event goes to, and what it carries.
|
|
25
|
-
*
|
|
26
|
-
* ## The ORGANIZATION room is a tenant-isolation decision, not a detail
|
|
27
|
-
*
|
|
28
|
-
* `wildoApplicationActorTasks` and both execution resources declare `isPrimaryScope: true` on their
|
|
29
|
-
* ORGANIZATIONS relationship, so a row belongs to ONE tenant. The sibling introspection notifier
|
|
30
|
-
* legitimately broadcasts to the APPLICATION room because every resource it serves is
|
|
31
|
-
* APPLICATION-anchored; doing that here would carry one tenant's row ids to every user of the
|
|
32
|
-
* application.
|
|
33
|
-
*
|
|
34
|
-
* ## Notification-grade, never row data
|
|
35
|
-
*
|
|
36
|
-
* `currentObject` is deliberately absent. A scope room fans out to every member of the tenant, and
|
|
37
|
-
* these rows carry coding-agent input and output that a collection event has no business
|
|
38
|
-
* broadcasting. Subscribers learn WHAT moved and refetch through their own authorization — the same
|
|
39
|
-
* contract the introspection notifier's collection lane uses.
|
|
40
|
-
*/
|
|
41
|
-
export function buildControlPlaneMutationNotification(resourceType, ownership, resourceId, action) {
|
|
42
|
-
return {
|
|
43
|
-
resourceType,
|
|
44
|
-
rooms: [{ scopeKey: ResourceScopeRoomKey.ORGANIZATION, scopeId: ownership.organizationId }],
|
|
45
|
-
event: CoreWebSocketEvent.RESOURCE_UPDATED,
|
|
46
|
-
payload: {
|
|
47
|
-
resourceType,
|
|
48
|
-
resourceId,
|
|
49
|
-
contextResourceIdentifiers: {
|
|
50
|
-
organizationId: ownership.organizationId,
|
|
51
|
-
applicationId: ownership.wildoApplicationId,
|
|
52
|
-
},
|
|
53
|
-
action,
|
|
54
|
-
affectedIds: [resourceId],
|
|
55
|
-
operationIdentifier: CoreResourceOperation.LIST,
|
|
56
|
-
currentObject: undefined,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
20
|
const WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE = "wildoApplicationActorSystemExecutions";
|
|
61
21
|
const WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE = "wildoApplicationFlowSystemExecutions";
|
|
62
22
|
const WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE = "wildoApplicationActorTasks";
|
|
@@ -82,10 +42,9 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
82
42
|
executionContextCreator;
|
|
83
43
|
companionContext;
|
|
84
44
|
traceabilityService;
|
|
85
|
-
websocketService;
|
|
86
45
|
logDebug;
|
|
87
46
|
ownershipPromise;
|
|
88
|
-
constructor(logger, errorBuilder, resourcePersistenceUnitOfWork, repositoriesRegistry, resourcesRegistry, executionContextCreator, companionContext, traceabilityService
|
|
47
|
+
constructor(logger, errorBuilder, resourcePersistenceUnitOfWork, repositoriesRegistry, resourcesRegistry, executionContextCreator, companionContext, traceabilityService) {
|
|
89
48
|
this.logger = logger;
|
|
90
49
|
this.errorBuilder = errorBuilder;
|
|
91
50
|
this.resourcePersistenceUnitOfWork = resourcePersistenceUnitOfWork;
|
|
@@ -94,7 +53,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
94
53
|
this.executionContextCreator = executionContextCreator;
|
|
95
54
|
this.companionContext = companionContext;
|
|
96
55
|
this.traceabilityService = traceabilityService;
|
|
97
|
-
this.websocketService = websocketService;
|
|
98
56
|
this.logDebug = this.logger.debugByType("CompanionExecutionsCompanionService");
|
|
99
57
|
this.logger.setDebugTypeLogging("CompanionExecutionsCompanionService", true);
|
|
100
58
|
}
|
|
@@ -133,9 +91,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
133
91
|
...this.buildRepositoryOptions(transaction),
|
|
134
92
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
135
93
|
});
|
|
136
|
-
this.publishControlPlaneMutation(transaction, WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE, ownership, String(createdExecution._id), ResourceAction.CREATED);
|
|
137
|
-
// Announced ONCE, here, because both return paths below concern this same row — the
|
|
138
|
-
// snapshot update that may follow is the same execution, not a second one.
|
|
139
94
|
if (payload.standaloneTasks.length === 0) {
|
|
140
95
|
return createdExecution;
|
|
141
96
|
}
|
|
@@ -205,8 +160,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
205
160
|
const flowExecution = await repository.create(executionContext, createData, {
|
|
206
161
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
207
162
|
});
|
|
208
|
-
// `null` transaction: this write is NOT wrapped in one, so it is already durable here.
|
|
209
|
-
this.publishControlPlaneMutation(null, WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE, ownership, String(flowExecution._id), ResourceAction.CREATED);
|
|
210
163
|
if (sessionContext) {
|
|
211
164
|
await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION, flowExecution._id);
|
|
212
165
|
}
|
|
@@ -462,7 +415,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
462
415
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
463
416
|
});
|
|
464
417
|
await this.syncTaskIntoExecutionSnapshot(createdTask, transaction, sessionContext);
|
|
465
|
-
this.publishControlPlaneMutation(transaction, WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, ownership, String(createdTask._id), ResourceAction.CREATED);
|
|
466
418
|
return createdTask;
|
|
467
419
|
});
|
|
468
420
|
if (sessionContext) {
|
|
@@ -658,7 +610,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
658
610
|
await this.removeTaskFromExecutionSnapshot(existingTask, transaction, sessionContext);
|
|
659
611
|
}
|
|
660
612
|
await this.syncTaskIntoExecutionSnapshot(updatedTask, transaction, sessionContext);
|
|
661
|
-
this.publishControlPlaneMutation(transaction, WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, ownership, String(updatedTask._id), ResourceAction.UPDATED);
|
|
662
613
|
return updatedTask;
|
|
663
614
|
});
|
|
664
615
|
if (sessionContext) {
|
|
@@ -702,64 +653,6 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
702
653
|
* Resolving and memoizing that ownership keeps all repository calls scoped to
|
|
703
654
|
* the truthful platform parent instead of falling back to tenant-app semantics.
|
|
704
655
|
*/
|
|
705
|
-
/**
|
|
706
|
-
* Announce a control-plane row the companion wrote REPOSITORY-DIRECT (issue #286).
|
|
707
|
-
*
|
|
708
|
-
* ## Why these writes were silent
|
|
709
|
-
*
|
|
710
|
-
* The engine emits `RESOURCE_UPDATED` from its resource CONTROLLERS, after the operation commits.
|
|
711
|
-
* These rows never pass through one: the companion writes them straight to the repository inside
|
|
712
|
-
* its own transaction, which is deliberate (they are control-plane records, and their CREATE and
|
|
713
|
-
* UPDATE variants are `REPOSITORY_ONLY` precisely so no generated write API exists). The cost was
|
|
714
|
-
* that nothing ever announced them: a board watching actor tasks or executions learned about a
|
|
715
|
-
* new row only from a 30-second poll, and a SECOND browser learned nothing at all, because the
|
|
716
|
-
* only invalidation was one the dispatching page emitted to itself.
|
|
717
|
-
*
|
|
718
|
-
* ## The ORGANIZATION room, and why not the application room
|
|
719
|
-
*
|
|
720
|
-
* These resources declare `isPrimaryScope: true` on their ORGANIZATIONS relationship, so a row
|
|
721
|
-
* belongs to one tenant. Broadcasting to the application room — which the sibling introspection
|
|
722
|
-
* notifier legitimately uses, because every resource IT serves is APPLICATION-anchored — would
|
|
723
|
-
* carry one tenant's row ids to every user of the application. The room is keyed on the row's own
|
|
724
|
-
* `organizationId`, which the ownership resolution has already established for the write itself.
|
|
725
|
-
*
|
|
726
|
-
* ## Notification-grade, and after COMMIT
|
|
727
|
-
*
|
|
728
|
-
* Registered as a post-commit effect: announcing a row inside the transaction would advertise a
|
|
729
|
-
* write that can still roll back. The payload carries no `currentObject` — a scope room fans out
|
|
730
|
-
* to every member, and these rows carry coding-agent input and output that a collection event has
|
|
731
|
-
* no business broadcasting. Subscribers learn WHAT moved and refetch through their own
|
|
732
|
-
* authorization, which is the same contract the introspection notifier's collection lane uses.
|
|
733
|
-
*
|
|
734
|
-
* Failure is swallowed by design: an announcement that could fail a committed write would make a
|
|
735
|
-
* notification defect look like a persistence defect.
|
|
736
|
-
*/
|
|
737
|
-
publishControlPlaneMutation(
|
|
738
|
-
/** `null` for a write that was not wrapped in a transaction — it is already committed. */
|
|
739
|
-
transaction, resourceType, ownership, resourceId, action) {
|
|
740
|
-
if (!resourceId)
|
|
741
|
-
return;
|
|
742
|
-
const announce = async () => {
|
|
743
|
-
{
|
|
744
|
-
try {
|
|
745
|
-
const notification = buildControlPlaneMutationNotification(resourceType, ownership, resourceId, action);
|
|
746
|
-
this.websocketService.emitToScopeRooms(notification.resourceType, notification.rooms, notification.event, buildScopeRoomNotificationPayload(notification.payload));
|
|
747
|
-
}
|
|
748
|
-
catch (error) {
|
|
749
|
-
this.logger.warn?.(`[CompanionExecutions] Could not announce ${resourceType} ${resourceId}: `
|
|
750
|
-
+ `${error instanceof Error ? error.message : String(error)}`);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
if (transaction === null) {
|
|
755
|
-
void announce();
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
registerTransactionPostCommitEffect(transaction, {
|
|
759
|
-
key: `control-plane-notify:${resourceType}:${resourceId}:${action}`,
|
|
760
|
-
execute: announce,
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
656
|
async resolveOwnership(sessionContext) {
|
|
764
657
|
if (!this.ownershipPromise) {
|
|
765
658
|
const ownershipPromise = this.loadOwnership(sessionContext).catch((error) => {
|
|
@@ -1380,14 +1273,12 @@ CompanionExecutionsCompanionService = __decorate([
|
|
|
1380
1273
|
__param(5, inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService)),
|
|
1381
1274
|
__param(6, inject(COMPANION_SERVICE_TYPES.CompanionContext)),
|
|
1382
1275
|
__param(7, inject(COMPANION_SERVICE_TYPES.TraceabilityService)),
|
|
1383
|
-
__param(8, inject(SAAS_SERVICE_TYPES.WebSocketService)),
|
|
1384
1276
|
__metadata("design:paramtypes", [LoggerService,
|
|
1385
1277
|
ErrorBuilderBackendService,
|
|
1386
1278
|
ResourcePersistenceUnitOfWorkBackendService,
|
|
1387
1279
|
RepositoriesRegistryHandlerBackendService,
|
|
1388
1280
|
ResourcesRegistryBackendService,
|
|
1389
|
-
ExecutionContextCreatorBackendService, Object, CompanionTraceabilityService
|
|
1390
|
-
WebSocketService])
|
|
1281
|
+
ExecutionContextCreatorBackendService, Object, CompanionTraceabilityService])
|
|
1391
1282
|
], CompanionExecutionsCompanionService);
|
|
1392
1283
|
export { CompanionExecutionsCompanionService };
|
|
1393
1284
|
//# sourceMappingURL=companion-executions.companion.service.js.map
|