@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specification-context-factory.shared.js","sourceRoot":"","sources":["../../../../../src/core/specifications/specification-context-factory.shared.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,UAAU,MAAM,YAAY,CAAC;AAcpC,MAAM,UAAU,uBAAuB,CAAS,QAAgB;IAC9D,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CA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AY;QACrB,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,YAAY;QACjB,CAAC,CAAC,CAAC,oBAAoB,YAAY,EAAE,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,sBAAsB,CAAC,OAAgC;IAC9D,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type {\n ExtractedFieldSpec,\n ExtractedFieldSpecDerived,\n RequiredFeaturesSpecification,\n} from '@wildo-ai/saas-specifications';\nimport { CollectionElementKind } from '@wildo-ai/zod-decorators';\nimport Handlebars from 'handlebars';\n\nexport interface MarkdownListItem {\n text: string;\n}\n\nexport interface MarkdownCodeExample {\n title: string;\n description?: string;\n language: string;\n code: string;\n notes?: MarkdownListItem[];\n}\n\nexport function compileMarkdownTemplate<TModel>(template: string): (model: TModel) => string {\n const render = Handlebars.compile(template, { noEscape: true });\n return (model: TModel) => render(model).trimEnd() + '\\n';\n}\n\nexport function toMarkdownListItems(\n values: Array<string | undefined>,\n): MarkdownListItem[] | undefined {\n const items = values\n .filter((value): value is string => Boolean(value && value.trim().length))\n .map((value) => ({ text: value }));\n return items.length > 0 ? items : undefined;\n}\n\nexport function toMarkdownCodeExampleNotes(\n values: string[] | undefined,\n): MarkdownListItem[] | undefined {\n return toMarkdownListItems(values ?? []);\n}\n\nexport function formatImportTarget(symbol: {\n packageName: string;\n importPath?: string;\n}): string {\n return symbol.importPath ? `${symbol.packageName}/${symbol.importPath}` : symbol.packageName;\n}\n\nexport function formatCodeSymbolRef(symbol: {\n packageName: string;\n exportName: string;\n importPath?: string;\n}): string {\n return `Import \\`${symbol.exportName}\\` from \\`${formatImportTarget(symbol)}\\`.`;\n}\n\nexport function formatNamedMemberRef(namedMember: {\n declaration: {\n packageName: string;\n exportName: string;\n importPath?: string;\n };\n memberName: string;\n}): string {\n return `Use member \\`${namedMember.memberName}\\` from \\`${namedMember.declaration.exportName}\\` imported via \\`${formatImportTarget(namedMember.declaration)}\\`.`;\n}\n\nexport function formatCollectionEntryRef(collectionEntry: {\n collectionSymbol: {\n packageName: string;\n exportName: string;\n importPath?: string;\n };\n identifierField: string;\n identifierValue: string;\n}): string {\n return `Use the entry where \\`${collectionEntry.identifierField}\\` is \\`${collectionEntry.identifierValue}\\` from \\`${collectionEntry.collectionSymbol.exportName}\\` imported via \\`${formatImportTarget(collectionEntry.collectionSymbol)}\\`.`;\n}\n\n/**\n * Render a `SpecificationOwnerRef` as a list of bullet-ready lines:\n * one header line carrying the owner identity, followed by one bullet\n * per authored note.\n *\n * # Companion-bullet contract\n *\n * `SpecificationOwnerRef.notes` is a `string[]` of distinct caveats —\n * see `engine/saas-specifications/src/_core/definition-specification.schemas.ts`\n * (\"Extra caveats for downstream tooling when ownership alone is not\n * enough\"). The earlier inline `Notes: ${notes.join(' ')}` flatten\n * silently merged authored entries onto a single line and broke the\n * companion-bullet promise that downstream tooling depends on for\n * grep-able per-note lines (`Owner note: ...`). This mirrors the\n * symmetric fix landed for `TranslationSlotSpecification.notes` in\n * `non-composite-view-specification-context.shared.ts` +\n * `composite-view-specification-context.factory.ts` — see the\n * `TranslationSlotSpecification.notes` JSDoc in\n * `engine/saas-specifications/src/_core/translation-slot-specification.schemas.ts`\n * for the canonical multi-bullet contract.\n *\n * # Why an array, not a string\n *\n * Returning `string[]` makes the per-bullet contract enforced at the\n * type level: every list-shaped consumer must spread the result into\n * its `toMarkdownListItems([...lines])` call, which means each note is\n * guaranteed to surface as its own structural bullet. The previous\n * single-string API let the notes silently collapse onto the caller's\n * adjacent line without any signal at the call site.\n *\n * # Inline-then-extract consumers\n *\n * Renderers whose macro pattern packs multiple owner-bearing items onto\n * a single bullet line (e.g. the frontend-component contribution\n * rendering — \"one bullet per contribution\") cannot spread the bullet\n * array into a list. Those call sites use {@link formatOwnerRefHeader}\n * for the inline `Owner: …` fragment in the structural summary, and\n * separately map `owner.notes` to per-bullet lines with their own\n * path-aware label (e.g. `${contributionLabel} owner note: ${note}`)\n * so that authored owner notes still surface as their own bullets in\n * the parent bullet block. This avoids collapsing distinct owner notes\n * into a single inline blob while still respecting the macro pattern.\n */\nexport function formatOwnerRefBullets(owner: {\n ownerId: string;\n ownerKind: string;\n notes?: string[];\n}): string[] {\n const header = formatOwnerRefHeader(owner);\n const noteLines = (owner.notes ?? []).map((note) => `Owner note: ${note}`);\n return [header, ...noteLines];\n}\n\n/**\n * Single-line `Owner: …` fragment for inline-then-extract consumers.\n *\n * Returns only the owner identity header (without any note bullets),\n * suitable for embedding inside a single structural summary line that\n * already aggregates several fields (e.g. a frontend-component\n * contribution line with kind/identity/path/load/owner/symbols all\n * joined). Owner notes MUST be emitted separately as their own bullets\n * by the caller — this helper deliberately drops them so the inline\n * fragment stays compact and the per-bullet contract for\n * `SpecificationOwnerRef.notes` is honoured at the parent bullet block.\n *\n * Use {@link formatOwnerRefBullets} for list-shaped consumers that can\n * spread the bullet array directly.\n */\nexport function formatOwnerRefHeader(owner: {\n ownerId: string;\n ownerKind: string;\n}): string {\n return `Owner: \\`${owner.ownerId}\\` (\\`${owner.ownerKind}\\`).`;\n}\n\nexport function formatLiteralLine(label: string, value: string | undefined): string | undefined {\n return value && value.trim().length > 0 ? `${label}: ${value}` : undefined;\n}\n\n/**\n * Per-call options for {@link formatRequiredFeaturesBullets}.\n *\n * `formatFeatureRef` decides how each authored `featureRef` literal is\n * rendered inside the produced lines. Two contracts coexist in the\n * renderer family today, both honoured by this single helper:\n *\n * - **Onboarding-view / future flow-gating call sites** pass\n * `formatFeatureRefWithCrossLink` from `cross-registry-rendering.shared`\n * so unresolved refs surface a `(unknown)` flag (matches the\n * fail-closed validator contract in\n * `assertOptionalRequiredFeaturesSpecification` with\n * `crossRegistry: 'fail-closed'`).\n * - **M2M (outbound webhook) call site** passes a bare\n * `(ref) => \\`\\\\\\`${ref}\\\\\\`\\`` formatter — the M2M dispatcher honours\n * any application-defined gate beyond the engine baseline (see\n * `ResourceOperationM2MSpecification.requiredFeatures` JSDoc),\n * so the renderer must NOT decorate refs the spec registry doesn't\n * know about. Decoration would mislead readers into thinking M2M\n * has a registry-resolution invariant that does not exist at runtime.\n * See `cross-registry-rendering.shared.ts` \"M2M is intentionally out\n * of scope\" section for the matching renderer-side rationale.\n */\nexport interface FormatRequiredFeaturesBulletsOptions {\n formatFeatureRef: (ref: string) => string;\n}\n\n/**\n * Render the optional `requiredFeatures` documentation slot as a\n * header line + per-`limitChecks[i]` bullet block. Returns `undefined`\n * when the slot is absent so callers' `.filter(Boolean)` /\n * `toMarkdownListItems(...)` strips it cleanly.\n *\n * # Output shape\n *\n * Header line:\n * - `Required features: \\`A\\`, \\`B\\`` when `mode` is unset or `'OR'`\n * (the runtime default — surfacing \"(mode: OR)\" on every authored\n * slot adds noise without adding information).\n * - `Required features: \\`A\\`, \\`B\\` (mode: AND)` when `mode === 'AND'`\n * (the rare authored override — flagged so AI / human readers\n * immediately see the deviating combination semantics).\n *\n * One bullet per `limitChecks[i]`:\n * - `Limit check: \\`<featureRef>\\``\n * - `Limit check: \\`<featureRef>\\` · increment=<N>` when `increment` is\n * authored (matches the runtime `LimitCheckSchema.increment` field).\n * - `Limit check: \\`<featureRef>\\` · countingOverride=present` when an\n * authored `countingOverride` object exists. The shape of that object\n * is intentionally not enumerated at the spec layer\n * (`assertOptionalCountingOverrideShape` only checks it's an object —\n * the runtime axes of `LimitCountingConfig` are not mirrored), so the\n * renderer surfaces presence-only rather than re-serialising the\n * payload. Authors who want detail should consult the runtime\n * `LimitCountingConfig` schema directly.\n *\n * # Why a single helper for two consumers\n *\n * Both M2M (`ResourceOperationM2MSpecification.requiredFeatures`) and\n * onboarding-view (`OnboardingViewSpecificationConfig.requiredFeatures`)\n * consume the same `RequiredFeaturesSpecification` schema (extracted\n * by `non-view-specification-coverage` Step 5 Phase 0). Before this\n * helper existed, M2M emitted a single inline headline-part while\n * onboarding-view emitted a multi-line bullet block — two divergent\n * renderings for one structural type, with no semantic justification\n * for the asymmetry. This helper unifies both surfaces on the\n * onboarding-view-shaped multi-line bullets (the strictly more\n * informative form). See Phase 4.5 finding F-4 in\n * `m2m-webhook-organization-delivery-phase4-audit.md` for the audit.\n *\n * # Consumers\n *\n * All three surfaces that read the same `RequiredFeaturesSpecification`\n * schema now flow through this helper:\n *\n * 1. **M2M (outbound webhook)** — `resource-specification-context\n * .factory.ts → formatM2MRequiredFeaturesLine` — passes the bare\n * `(ref) => \\`\\\\\\`${ref}\\\\\\`\\`` formatter (no cross-link decoration,\n * per the M2M-out-of-scope rationale above).\n * 2. **Onboarding view** — `onboarding-view-specification-context\n * .factory.ts → buildRequiredFeaturesLines` — passes\n * `formatFeatureRefWithCrossLink` so unresolved refs surface the\n * `(unknown)` flag.\n * 3. **Guidance flow audience block** — `guidance-flow-specification-context\n * .factory.ts → buildAudienceLines` — same `formatFeatureRefWithCrossLink`\n * contract as the onboarding-view caller. Migrated from a divergent\n * inline `Required features (OR): …` rendering by P3/I1 closure of\n * `.cursor/plans/non-view-specification-coverage-step9-spec-infrastructure-hardening.md`\n * (originally tracked in `m2m-webhook-organization-delivery-phase4-5-hardening.md`\n * Step 4 follow-up). Before that closure the audience block always\n * emitted `(OR)` even when the mode was the runtime default — the\n * inline implementation also bypassed `formatFeatureRefWithCrossLink`\n * so dangling feature refs were not flagged.\n */\nexport function formatRequiredFeaturesBullets(\n requiredFeatures: RequiredFeaturesSpecification | undefined,\n options: FormatRequiredFeaturesBulletsOptions,\n): string[] | undefined {\n if (!requiredFeatures) {\n return undefined;\n }\n const refs = requiredFeatures.featureRefs.map(options.formatFeatureRef).join(', ');\n const modeSuffix = requiredFeatures.mode === 'AND' ? ' (mode: AND)' : '';\n const lines: string[] = [`Required features: ${refs}${modeSuffix}`];\n for (const limitCheck of requiredFeatures.limitChecks ?? []) {\n const ref = options.formatFeatureRef(limitCheck.featureRef);\n const incrementSuffix = typeof limitCheck.increment === 'number'\n ? ` · increment=${limitCheck.increment}`\n : '';\n const countingOverrideSuffix = limitCheck.countingOverride !== undefined\n ? ' · countingOverride=present'\n : '';\n lines.push(`Limit check: ${ref}${incrementSuffix}${countingOverrideSuffix}`);\n }\n return lines;\n}\n\nexport interface FieldSpecInput {\n fieldName: string;\n specDecorator: string;\n params: Record<string, unknown>;\n /**\n * Framework-derived structural metadata extracted from the Zod schema\n * (and, in Phase 2B, the relationship registry). The renderer consults\n * `derived` for structural facts — e.g. `arraySpec` element kind / primitive\n * type / union branches — so authors no longer hand-author what the\n * framework can compute. Author-supplied fields (`elementMeaning`,\n * `enumDeclaration`, `notes`) still come from `params`.\n */\n derived?: ExtractedFieldSpecDerived;\n /**\n * Where this field came from in the resource schema chain — derived from\n * the engine's `ExtractedFieldSpec.origin` (the owning vocabulary in\n * `@wildo-ai/saas-specifications`) rather than re-declared here.\n */\n origin?: ExtractedFieldSpec['origin'];\n}\n\n/**\n * Renders a field spec into a multi-line markdown block with:\n * - A heading line showing the field name, meaning, decorator, importance, and origin.\n * - Sub-lines for decorator-specific usage details (enum values, FK target, etc.).\n *\n * Lines are joined with `\\n` so templates that render each field as a list\n * item still get one logical block per field.\n */\nexport function formatFieldSpecBlock(fieldSpec: FieldSpecInput): string {\n const params = fieldSpec.params;\n const meaning = typeof params.meaning === 'string' ? params.meaning : undefined;\n const whyItMatters = typeof params.whyItMatters === 'string' ? params.whyItMatters : undefined;\n const importance = typeof params.importance === 'string' ? params.importance : undefined;\n\n const originSuffix = formatFieldOrigin(fieldSpec.origin);\n const importanceSuffix = importance ? ` [${importance}]` : '';\n\n const heading = meaning\n ? `\\`${fieldSpec.fieldName}\\` (${fieldSpec.specDecorator}${importanceSuffix}): ${meaning}${originSuffix}`\n : `\\`${fieldSpec.fieldName}\\` (${fieldSpec.specDecorator}${importanceSuffix})${originSuffix}`;\n\n const subLines: string[] = [];\n\n if (whyItMatters) {\n subLines.push(` Why it matters: ${whyItMatters}`);\n }\n\n subLines.push(...formatDecoratorUsageLines(fieldSpec.specDecorator, params, fieldSpec.derived));\n\n return subLines.length > 0\n ? [heading, ...subLines].join('\\n')\n : heading;\n}\n\nfunction formatFieldOrigin(\n origin: FieldSpecInput['origin'],\n): string {\n if (!origin) {\n return '';\n }\n if (origin.scope === 'inherited' && origin.variantPath?.length) {\n const path = origin.variantPath\n .map((seg) => `${seg.discriminatorField}=${seg.discriminatorValue}`)\n .join(' → ');\n return ` (inherited via ${path})`;\n }\n return origin.scope === 'inherited' ? ' (inherited)' : '';\n}\n\n/**\n * Produces sub-lines specific to each decorator type. Each line is\n * indented with two spaces so it renders as nested context below\n * the heading in a markdown list.\n */\nfunction formatDecoratorUsageLines(\n decorator: string,\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n switch (decorator) {\n case 'enumSpec':\n return formatEnumUsageLines(params);\n case 'foreignKeySpec':\n return formatForeignKeyUsageLines(params, derived);\n case 'arraySpec':\n return formatArrayUsageLines(params, derived);\n case 'stringSpec':\n return formatStringUsageLines(params);\n case 'numberSpec':\n case 'bigDecimalSpec':\n return formatNumberUsageLines(params);\n case 'dateSpec':\n case 'dateTimeSpec':\n return formatDateUsageLines(params);\n case 'objectSpec':\n return formatObjectUsageLines(params);\n default:\n return [];\n }\n}\n\nfunction formatEnumUsageLines(params: Record<string, unknown>): string[] {\n const lines: string[] = [];\n\n const enumDecl = params.enumDeclaration as\n | { packageName: string; exportName: string; importPath?: string }\n | undefined;\n if (enumDecl) {\n lines.push(` Import: \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\``);\n }\n\n const values = params.values as Record<string, { meaning?: string }> | undefined;\n if (values && Object.keys(values).length > 0) {\n lines.push(' Values:');\n for (const [value, config] of Object.entries(values)) {\n const valueMeaning = config?.meaning;\n lines.push(valueMeaning\n ? ` - \\`${value}\\`: ${valueMeaning}`\n : ` - \\`${value}\\``);\n }\n }\n\n return lines;\n}\n\n/**\n * Renders foreign-key usage by combining:\n *\n * - Author-supplied prose from `params.relationshipContext` (the business\n * meaning of the link — not derivable from the registry).\n * - Registry-derived target from `derived.foreignKeyTarget.resourceType`\n * (Phase 2B — the relationship registry's `foreignKeyField` is the\n * single source of truth for FK target resolution per Q6-2b).\n * - A fail-closed unresolved signal from\n * `derived.foreignKeyTargetUnresolved` so prompts stay honest about a\n * missing relationship instead of silently dropping the FK line. The\n * Phase 4 completeness validator promotes the same signal into a hard\n * error at companion-load time; the renderer surfaces it earlier so it\n * shows up in already-rendered prompts even if the validator is opt-in.\n */\nfunction formatForeignKeyUsageLines(\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n const lines: string[] = [];\n\n const relationshipContext = typeof params.relationshipContext === 'string'\n ? params.relationshipContext\n : undefined;\n if (relationshipContext) {\n lines.push(` Relationship: ${relationshipContext}`);\n }\n\n const target = derived?.foreignKeyTarget;\n if (target) {\n lines.push(` Target resource: \\`${target.resourceType}\\``);\n } else if (derived?.foreignKeyTargetUnresolved) {\n const unresolved = derived.foreignKeyTargetUnresolved;\n lines.push(\n ` Target resource: UNRESOLVED — ${unresolved.reason}.`,\n );\n }\n\n return lines;\n}\n\n/**\n * Renders array element details by combining:\n *\n * - Author-supplied semantics from `params.elementType` (`enumDeclaration`\n * for the vocabulary import path; `notes` for free-form caveats).\n * - Framework-derived structural facts from `derived.arrayElement`\n * (`kind`, `primitiveType`, `unionBranches`).\n *\n * The split mirrors Step 6 D-6 Phase 2A: structural truth lives in the Zod\n * schema and is computed once by the extractor; intent and import-path\n * anchors stay author-supplied because they are not derivable from the\n * runtime schema.\n */\nfunction formatArrayUsageLines(\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n const lines: string[] = [];\n\n const elementMeaning = typeof params.elementMeaning === 'string'\n ? params.elementMeaning\n : undefined;\n if (elementMeaning) {\n lines.push(` Element meaning: ${elementMeaning}`);\n }\n\n const authoredElementType = params.elementType as\n | {\n enumDeclaration?: { packageName: string; exportName: string; importPath?: string };\n notes?: string[];\n }\n | undefined;\n\n const arrayElement = derived?.arrayElement;\n\n if (arrayElement) {\n const kindLabel = arrayElement.kind;\n const enumDecl = authoredElementType?.enumDeclaration;\n const enumDetail = enumDecl\n ? ` — use \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\``\n : '';\n const primitiveDetail = arrayElement.kind === CollectionElementKind.PRIMITIVE && arrayElement.primitiveType\n ? ` (${arrayElement.primitiveType})`\n : '';\n lines.push(` Element type: ${kindLabel}${primitiveDetail}${enumDetail}`);\n\n if (arrayElement.kind === CollectionElementKind.UNION && arrayElement.unionBranches?.length) {\n lines.push(' Union branches:');\n for (const branch of arrayElement.unionBranches) {\n const branchDetail = branch.kind === CollectionElementKind.PRIMITIVE && branch.primitiveType\n ? ` (${branch.primitiveType})`\n : '';\n lines.push(` - ${branch.kind}${branchDetail}`);\n }\n }\n } else if (authoredElementType?.enumDeclaration) {\n // Fallback: tests / manually constructed `additionalFieldSpecs` that\n // bypass the extractor still want the import-path line surfaced.\n const enumDecl = authoredElementType.enumDeclaration;\n lines.push(` Element type: use \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\``);\n }\n\n for (const note of authoredElementType?.notes ?? []) {\n lines.push(` ${note}`);\n }\n\n return lines;\n}\n\nfunction formatStringUsageLines(params: Record<string, unknown>): string[] {\n const semanticRole = typeof params.semanticRole === 'string'\n ? params.semanticRole\n : undefined;\n return semanticRole\n ? [` Semantic role: ${semanticRole}`]\n : [];\n}\n\nfunction formatNumberUsageLines(params: Record<string, unknown>): string[] {\n const unit = typeof params.unit === 'string' ? params.unit : undefined;\n return unit ? [` Unit: ${unit}`] : [];\n}\n\nfunction formatDateUsageLines(params: Record<string, unknown>): string[] {\n const temporalRole = typeof params.temporalRole === 'string'\n ? params.temporalRole\n : undefined;\n return temporalRole\n ? [` Temporal role: ${temporalRole}`]\n : [];\n}\n\n/**\n * Object-spec usage lines are intentionally empty.\n *\n * `objectSpec()` carries no extra structural metadata after the Step 6 D-6\n * Phase 1 collapse — its `meaning` / `whyItMatters` / `importance` are\n * already rendered by the base block. The decorator still exists so the\n * Phase 4 completeness validator can detect spec-bearing nested structures,\n * but renderers contribute no additional lines for it.\n */\nfunction formatObjectUsageLines(_params: Record<string, unknown>): string[] {\n return [];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"specification-context-factory.shared.js","sourceRoot":"","sources":["../../../../../src/core/specifications/specification-context-factory.shared.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,UAAU,MAAM,YAAY,CAAC;AAcpC,MAAM,UAAU,uBAAuB,CAAS,QAAgB;IAC9D,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,MAAiC;IAEjC,MAAM,KAAK,GAAG,MAAM;SACjB,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;SACzE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,MAA4B;IAE5B,OAAO,mBAAmB,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAGlC;IACC,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CA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E,KAAK,IAAI,EAAE,EAAE,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,sBAAsB,CAAC,MAA+B;IAC7D,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ;QAC1D,CAAC,CAAC,MAAM,CAAC,YAAY;QACrB,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,YAAY;QACjB,CAAC,CAAC,CAAC,oBAAoB,YAAY,EAAE,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,sBAAsB,CAAC,MAA+B;IAC7D,MAAM,IAAI,GAAG,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAA+B;IAC3D,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ;QAC1D,CAAC,CAAC,MAAM,CAAC,YAAY;QACrB,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,YAAY;QACjB,CAAC,CAAC,CAAC,oBAAoB,YAAY,EAAE,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,sBAAsB,CAAC,OAAgC;IAC9D,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type {\n ExtractedFieldSpec,\n ExtractedFieldSpecDerived,\n RequiredFeaturesSpecification,\n} from '@wildo-ai/saas-specifications';\nimport { CollectionElementKind } from '@wildo-ai/zod-decorators';\nimport Handlebars from 'handlebars';\n\nexport interface MarkdownListItem {\n text: string;\n}\n\nexport interface MarkdownCodeExample {\n title: string;\n description?: string;\n language: string;\n code: string;\n notes?: MarkdownListItem[];\n}\n\nexport function compileMarkdownTemplate<TModel>(template: string): (model: TModel) => string {\n const render = Handlebars.compile(template, { noEscape: true });\n return (model: TModel) => render(model).trimEnd() + '\\n';\n}\n\nexport function toMarkdownListItems(\n values: Array<string | undefined>,\n): MarkdownListItem[] | undefined {\n const items = values\n .filter((value): value is string => Boolean(value && value.trim().length))\n .map((value) => ({ text: value }));\n return items.length > 0 ? items : undefined;\n}\n\nexport function toMarkdownCodeExampleNotes(\n values: string[] | undefined,\n): MarkdownListItem[] | undefined {\n return toMarkdownListItems(values ?? []);\n}\n\n/**\n * The IMPORT SPECIFIER for a symbol — `packageName`, plus `importPath` only when that\n * is a public subpath the owning package declares in `package.json#exports`.\n *\n * `filePathHint` is deliberately NOT consulted here. It is a module location, and\n * concatenating it onto the package name is exactly the defect issue #150 records:\n * an application package declares no export-map entry for its internal modules, so\n * `@app/main-app/modules/.../tasks.ui-behavior` cannot resolve, and a coding agent was\n * being handed it as the address to import from.\n */\nexport function formatImportTarget(symbol: {\n packageName: string;\n importPath?: string;\n}): string {\n return symbol.importPath ? `${symbol.packageName}/${symbol.importPath}` : symbol.packageName;\n}\n\n/**\n * The LOCATION sentence appended after an import instruction, when the ref carries one.\n *\n * Rendered as prose rather than as a specifier so no downstream reader can mistake it\n * for something importable — the whole point of splitting the two senses. Empty string\n * when unauthored, so every caller can append it unconditionally.\n */\nexport function formatSymbolLocationSuffix(symbol: { filePathHint?: string }): string {\n return symbol.filePathHint\n ? ` It is defined at \\`${symbol.filePathHint}\\` inside that package — a location for reading, not an import path.`\n : '';\n}\n\nexport function formatCodeSymbolRef(symbol: {\n packageName: string;\n exportName: string;\n importPath?: string;\n filePathHint?: string;\n}): string {\n return `Import \\`${symbol.exportName}\\` from \\`${formatImportTarget(symbol)}\\`.${formatSymbolLocationSuffix(symbol)}`;\n}\n\nexport function formatNamedMemberRef(namedMember: {\n declaration: {\n packageName: string;\n exportName: string;\n importPath?: string;\n filePathHint?: string;\n };\n memberName: string;\n}): string {\n return `Use member \\`${namedMember.memberName}\\` from \\`${namedMember.declaration.exportName}\\` imported via \\`${formatImportTarget(namedMember.declaration)}\\`.${formatSymbolLocationSuffix(namedMember.declaration)}`;\n}\n\nexport function formatCollectionEntryRef(collectionEntry: {\n collectionSymbol: {\n packageName: string;\n exportName: string;\n importPath?: string;\n filePathHint?: string;\n };\n identifierField: string;\n identifierValue: string;\n}): string {\n return `Use the entry where \\`${collectionEntry.identifierField}\\` is \\`${collectionEntry.identifierValue}\\` from \\`${collectionEntry.collectionSymbol.exportName}\\` imported via \\`${formatImportTarget(collectionEntry.collectionSymbol)}\\`.${formatSymbolLocationSuffix(collectionEntry.collectionSymbol)}`;\n}\n\n/**\n * Render a `SpecificationOwnerRef` as a list of bullet-ready lines:\n * one header line carrying the owner identity, followed by one bullet\n * per authored note.\n *\n * # Companion-bullet contract\n *\n * `SpecificationOwnerRef.notes` is a `string[]` of distinct caveats —\n * see `engine/saas-specifications/src/_core/definition-specification.schemas.ts`\n * (\"Extra caveats for downstream tooling when ownership alone is not\n * enough\"). The earlier inline `Notes: ${notes.join(' ')}` flatten\n * silently merged authored entries onto a single line and broke the\n * companion-bullet promise that downstream tooling depends on for\n * grep-able per-note lines (`Owner note: ...`). This mirrors the\n * symmetric fix landed for `TranslationSlotSpecification.notes` in\n * `non-composite-view-specification-context.shared.ts` +\n * `composite-view-specification-context.factory.ts` — see the\n * `TranslationSlotSpecification.notes` JSDoc in\n * `engine/saas-specifications/src/_core/translation-slot-specification.schemas.ts`\n * for the canonical multi-bullet contract.\n *\n * # Why an array, not a string\n *\n * Returning `string[]` makes the per-bullet contract enforced at the\n * type level: every list-shaped consumer must spread the result into\n * its `toMarkdownListItems([...lines])` call, which means each note is\n * guaranteed to surface as its own structural bullet. The previous\n * single-string API let the notes silently collapse onto the caller's\n * adjacent line without any signal at the call site.\n *\n * # Inline-then-extract consumers\n *\n * Renderers whose macro pattern packs multiple owner-bearing items onto\n * a single bullet line (e.g. the frontend-component contribution\n * rendering — \"one bullet per contribution\") cannot spread the bullet\n * array into a list. Those call sites use {@link formatOwnerRefHeader}\n * for the inline `Owner: …` fragment in the structural summary, and\n * separately map `owner.notes` to per-bullet lines with their own\n * path-aware label (e.g. `${contributionLabel} owner note: ${note}`)\n * so that authored owner notes still surface as their own bullets in\n * the parent bullet block. This avoids collapsing distinct owner notes\n * into a single inline blob while still respecting the macro pattern.\n */\nexport function formatOwnerRefBullets(owner: {\n ownerId: string;\n ownerKind: string;\n notes?: string[];\n}): string[] {\n const header = formatOwnerRefHeader(owner);\n const noteLines = (owner.notes ?? []).map((note) => `Owner note: ${note}`);\n return [header, ...noteLines];\n}\n\n/**\n * Single-line `Owner: …` fragment for inline-then-extract consumers.\n *\n * Returns only the owner identity header (without any note bullets),\n * suitable for embedding inside a single structural summary line that\n * already aggregates several fields (e.g. a frontend-component\n * contribution line with kind/identity/path/load/owner/symbols all\n * joined). Owner notes MUST be emitted separately as their own bullets\n * by the caller — this helper deliberately drops them so the inline\n * fragment stays compact and the per-bullet contract for\n * `SpecificationOwnerRef.notes` is honoured at the parent bullet block.\n *\n * Use {@link formatOwnerRefBullets} for list-shaped consumers that can\n * spread the bullet array directly.\n */\nexport function formatOwnerRefHeader(owner: {\n ownerId: string;\n ownerKind: string;\n}): string {\n return `Owner: \\`${owner.ownerId}\\` (\\`${owner.ownerKind}\\`).`;\n}\n\nexport function formatLiteralLine(label: string, value: string | undefined): string | undefined {\n return value && value.trim().length > 0 ? `${label}: ${value}` : undefined;\n}\n\n/**\n * Per-call options for {@link formatRequiredFeaturesBullets}.\n *\n * `formatFeatureRef` decides how each authored `featureRef` literal is\n * rendered inside the produced lines. Two contracts coexist in the\n * renderer family today, both honoured by this single helper:\n *\n * - **Onboarding-view / future flow-gating call sites** pass\n * `formatFeatureRefWithCrossLink` from `cross-registry-rendering.shared`\n * so unresolved refs surface a `(unknown)` flag (matches the\n * fail-closed validator contract in\n * `assertOptionalRequiredFeaturesSpecification` with\n * `crossRegistry: 'fail-closed'`).\n * - **M2M (outbound webhook) call site** passes a bare\n * `(ref) => \\`\\\\\\`${ref}\\\\\\`\\`` formatter — the M2M dispatcher honours\n * any application-defined gate beyond the engine baseline (see\n * `ResourceOperationM2MSpecification.requiredFeatures` JSDoc),\n * so the renderer must NOT decorate refs the spec registry doesn't\n * know about. Decoration would mislead readers into thinking M2M\n * has a registry-resolution invariant that does not exist at runtime.\n * See `cross-registry-rendering.shared.ts` \"M2M is intentionally out\n * of scope\" section for the matching renderer-side rationale.\n */\nexport interface FormatRequiredFeaturesBulletsOptions {\n formatFeatureRef: (ref: string) => string;\n}\n\n/**\n * Render the optional `requiredFeatures` documentation slot as a\n * header line + per-`limitChecks[i]` bullet block. Returns `undefined`\n * when the slot is absent so callers' `.filter(Boolean)` /\n * `toMarkdownListItems(...)` strips it cleanly.\n *\n * # Output shape\n *\n * Header line:\n * - `Required features: \\`A\\`, \\`B\\`` when `mode` is unset or `'OR'`\n * (the runtime default — surfacing \"(mode: OR)\" on every authored\n * slot adds noise without adding information).\n * - `Required features: \\`A\\`, \\`B\\` (mode: AND)` when `mode === 'AND'`\n * (the rare authored override — flagged so AI / human readers\n * immediately see the deviating combination semantics).\n *\n * One bullet per `limitChecks[i]`:\n * - `Limit check: \\`<featureRef>\\``\n * - `Limit check: \\`<featureRef>\\` · increment=<N>` when `increment` is\n * authored (matches the runtime `LimitCheckSchema.increment` field).\n * - `Limit check: \\`<featureRef>\\` · countingOverride=present` when an\n * authored `countingOverride` object exists. The shape of that object\n * is intentionally not enumerated at the spec layer\n * (`assertOptionalCountingOverrideShape` only checks it's an object —\n * the runtime axes of `LimitCountingConfig` are not mirrored), so the\n * renderer surfaces presence-only rather than re-serialising the\n * payload. Authors who want detail should consult the runtime\n * `LimitCountingConfig` schema directly.\n *\n * # Why a single helper for two consumers\n *\n * Both M2M (`ResourceOperationM2MSpecification.requiredFeatures`) and\n * onboarding-view (`OnboardingViewSpecificationConfig.requiredFeatures`)\n * consume the same `RequiredFeaturesSpecification` schema (extracted\n * by `non-view-specification-coverage` Step 5 Phase 0). Before this\n * helper existed, M2M emitted a single inline headline-part while\n * onboarding-view emitted a multi-line bullet block — two divergent\n * renderings for one structural type, with no semantic justification\n * for the asymmetry. This helper unifies both surfaces on the\n * onboarding-view-shaped multi-line bullets (the strictly more\n * informative form). See Phase 4.5 finding F-4 in\n * `m2m-webhook-organization-delivery-phase4-audit.md` for the audit.\n *\n * # Consumers\n *\n * All three surfaces that read the same `RequiredFeaturesSpecification`\n * schema now flow through this helper:\n *\n * 1. **M2M (outbound webhook)** — `resource-specification-context\n * .factory.ts → formatM2MRequiredFeaturesLine` — passes the bare\n * `(ref) => \\`\\\\\\`${ref}\\\\\\`\\`` formatter (no cross-link decoration,\n * per the M2M-out-of-scope rationale above).\n * 2. **Onboarding view** — `onboarding-view-specification-context\n * .factory.ts → buildRequiredFeaturesLines` — passes\n * `formatFeatureRefWithCrossLink` so unresolved refs surface the\n * `(unknown)` flag.\n * 3. **Guidance flow audience block** — `guidance-flow-specification-context\n * .factory.ts → buildAudienceLines` — same `formatFeatureRefWithCrossLink`\n * contract as the onboarding-view caller. Migrated from a divergent\n * inline `Required features (OR): …` rendering by P3/I1 closure of\n * `.cursor/plans/non-view-specification-coverage-step9-spec-infrastructure-hardening.md`\n * (originally tracked in `m2m-webhook-organization-delivery-phase4-5-hardening.md`\n * Step 4 follow-up). Before that closure the audience block always\n * emitted `(OR)` even when the mode was the runtime default — the\n * inline implementation also bypassed `formatFeatureRefWithCrossLink`\n * so dangling feature refs were not flagged.\n */\nexport function formatRequiredFeaturesBullets(\n requiredFeatures: RequiredFeaturesSpecification | undefined,\n options: FormatRequiredFeaturesBulletsOptions,\n): string[] | undefined {\n if (!requiredFeatures) {\n return undefined;\n }\n const refs = requiredFeatures.featureRefs.map(options.formatFeatureRef).join(', ');\n const modeSuffix = requiredFeatures.mode === 'AND' ? ' (mode: AND)' : '';\n const lines: string[] = [`Required features: ${refs}${modeSuffix}`];\n for (const limitCheck of requiredFeatures.limitChecks ?? []) {\n const ref = options.formatFeatureRef(limitCheck.featureRef);\n const incrementSuffix = typeof limitCheck.increment === 'number'\n ? ` · increment=${limitCheck.increment}`\n : '';\n const countingOverrideSuffix = limitCheck.countingOverride !== undefined\n ? ' · countingOverride=present'\n : '';\n lines.push(`Limit check: ${ref}${incrementSuffix}${countingOverrideSuffix}`);\n }\n return lines;\n}\n\nexport interface FieldSpecInput {\n fieldName: string;\n specDecorator: string;\n params: Record<string, unknown>;\n /**\n * Framework-derived structural metadata extracted from the Zod schema\n * (and, in Phase 2B, the relationship registry). The renderer consults\n * `derived` for structural facts — e.g. `arraySpec` element kind / primitive\n * type / union branches — so authors no longer hand-author what the\n * framework can compute. Author-supplied fields (`elementMeaning`,\n * `enumDeclaration`, `notes`) still come from `params`.\n */\n derived?: ExtractedFieldSpecDerived;\n /**\n * Where this field came from in the resource schema chain — derived from\n * the engine's `ExtractedFieldSpec.origin` (the owning vocabulary in\n * `@wildo-ai/saas-specifications`) rather than re-declared here.\n */\n origin?: ExtractedFieldSpec['origin'];\n}\n\n/**\n * Renders a field spec into a multi-line markdown block with:\n * - A heading line showing the field name, meaning, decorator, importance, and origin.\n * - Sub-lines for decorator-specific usage details (enum values, FK target, etc.).\n *\n * Lines are joined with `\\n` so templates that render each field as a list\n * item still get one logical block per field.\n */\nexport function formatFieldSpecBlock(fieldSpec: FieldSpecInput): string {\n const params = fieldSpec.params;\n const meaning = typeof params.meaning === 'string' ? params.meaning : undefined;\n const whyItMatters = typeof params.whyItMatters === 'string' ? params.whyItMatters : undefined;\n const importance = typeof params.importance === 'string' ? params.importance : undefined;\n\n const originSuffix = formatFieldOrigin(fieldSpec.origin);\n const importanceSuffix = importance ? ` [${importance}]` : '';\n\n const heading = meaning\n ? `\\`${fieldSpec.fieldName}\\` (${fieldSpec.specDecorator}${importanceSuffix}): ${meaning}${originSuffix}`\n : `\\`${fieldSpec.fieldName}\\` (${fieldSpec.specDecorator}${importanceSuffix})${originSuffix}`;\n\n const subLines: string[] = [];\n\n if (whyItMatters) {\n subLines.push(` Why it matters: ${whyItMatters}`);\n }\n\n subLines.push(...formatDecoratorUsageLines(fieldSpec.specDecorator, params, fieldSpec.derived));\n\n return subLines.length > 0\n ? [heading, ...subLines].join('\\n')\n : heading;\n}\n\nfunction formatFieldOrigin(\n origin: FieldSpecInput['origin'],\n): string {\n if (!origin) {\n return '';\n }\n if (origin.scope === 'inherited' && origin.variantPath?.length) {\n const path = origin.variantPath\n .map((seg) => `${seg.discriminatorField}=${seg.discriminatorValue}`)\n .join(' → ');\n return ` (inherited via ${path})`;\n }\n return origin.scope === 'inherited' ? ' (inherited)' : '';\n}\n\n/**\n * Produces sub-lines specific to each decorator type. Each line is\n * indented with two spaces so it renders as nested context below\n * the heading in a markdown list.\n */\nfunction formatDecoratorUsageLines(\n decorator: string,\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n switch (decorator) {\n case 'enumSpec':\n return formatEnumUsageLines(params);\n case 'foreignKeySpec':\n return formatForeignKeyUsageLines(params, derived);\n case 'arraySpec':\n return formatArrayUsageLines(params, derived);\n case 'stringSpec':\n return formatStringUsageLines(params);\n case 'numberSpec':\n case 'bigDecimalSpec':\n return formatNumberUsageLines(params);\n case 'dateSpec':\n case 'dateTimeSpec':\n return formatDateUsageLines(params);\n case 'objectSpec':\n return formatObjectUsageLines(params);\n default:\n return [];\n }\n}\n\nfunction formatEnumUsageLines(params: Record<string, unknown>): string[] {\n const lines: string[] = [];\n\n const enumDecl = params.enumDeclaration as\n | { packageName: string; exportName: string; importPath?: string; filePathHint?: string }\n | undefined;\n if (enumDecl) {\n lines.push(` Import: \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\`${formatSymbolLocationSuffix(enumDecl)}`);\n }\n\n const values = params.values as Record<string, { meaning?: string }> | undefined;\n if (values && Object.keys(values).length > 0) {\n lines.push(' Values:');\n for (const [value, config] of Object.entries(values)) {\n const valueMeaning = config?.meaning;\n lines.push(valueMeaning\n ? ` - \\`${value}\\`: ${valueMeaning}`\n : ` - \\`${value}\\``);\n }\n }\n\n return lines;\n}\n\n/**\n * Renders foreign-key usage by combining:\n *\n * - Author-supplied prose from `params.relationshipContext` (the business\n * meaning of the link — not derivable from the registry).\n * - Registry-derived target from `derived.foreignKeyTarget.resourceType`\n * (Phase 2B — the relationship registry's `foreignKeyField` is the\n * single source of truth for FK target resolution per Q6-2b).\n * - A fail-closed unresolved signal from\n * `derived.foreignKeyTargetUnresolved` so prompts stay honest about a\n * missing relationship instead of silently dropping the FK line. The\n * Phase 4 completeness validator promotes the same signal into a hard\n * error at companion-load time; the renderer surfaces it earlier so it\n * shows up in already-rendered prompts even if the validator is opt-in.\n */\nfunction formatForeignKeyUsageLines(\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n const lines: string[] = [];\n\n const relationshipContext = typeof params.relationshipContext === 'string'\n ? params.relationshipContext\n : undefined;\n if (relationshipContext) {\n lines.push(` Relationship: ${relationshipContext}`);\n }\n\n const target = derived?.foreignKeyTarget;\n if (target) {\n lines.push(` Target resource: \\`${target.resourceType}\\``);\n } else if (derived?.foreignKeyTargetUnresolved) {\n const unresolved = derived.foreignKeyTargetUnresolved;\n lines.push(\n ` Target resource: UNRESOLVED — ${unresolved.reason}.`,\n );\n }\n\n return lines;\n}\n\n/**\n * Renders array element details by combining:\n *\n * - Author-supplied semantics from `params.elementType` (`enumDeclaration`\n * for the vocabulary import path; `notes` for free-form caveats).\n * - Framework-derived structural facts from `derived.arrayElement`\n * (`kind`, `primitiveType`, `unionBranches`).\n *\n * The split mirrors Step 6 D-6 Phase 2A: structural truth lives in the Zod\n * schema and is computed once by the extractor; intent and import-path\n * anchors stay author-supplied because they are not derivable from the\n * runtime schema.\n */\nfunction formatArrayUsageLines(\n params: Record<string, unknown>,\n derived: ExtractedFieldSpecDerived | undefined,\n): string[] {\n const lines: string[] = [];\n\n const elementMeaning = typeof params.elementMeaning === 'string'\n ? params.elementMeaning\n : undefined;\n if (elementMeaning) {\n lines.push(` Element meaning: ${elementMeaning}`);\n }\n\n const authoredElementType = params.elementType as\n | {\n enumDeclaration?: { packageName: string; exportName: string; importPath?: string; filePathHint?: string };\n notes?: string[];\n }\n | undefined;\n\n const arrayElement = derived?.arrayElement;\n\n if (arrayElement) {\n const kindLabel = arrayElement.kind;\n const enumDecl = authoredElementType?.enumDeclaration;\n const enumDetail = enumDecl\n ? ` — use \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\``\n : '';\n const primitiveDetail = arrayElement.kind === CollectionElementKind.PRIMITIVE && arrayElement.primitiveType\n ? ` (${arrayElement.primitiveType})`\n : '';\n lines.push(` Element type: ${kindLabel}${primitiveDetail}${enumDetail}`);\n\n if (arrayElement.kind === CollectionElementKind.UNION && arrayElement.unionBranches?.length) {\n lines.push(' Union branches:');\n for (const branch of arrayElement.unionBranches) {\n const branchDetail = branch.kind === CollectionElementKind.PRIMITIVE && branch.primitiveType\n ? ` (${branch.primitiveType})`\n : '';\n lines.push(` - ${branch.kind}${branchDetail}`);\n }\n }\n } else if (authoredElementType?.enumDeclaration) {\n // Fallback: tests / manually constructed `additionalFieldSpecs` that\n // bypass the extractor still want the import-path line surfaced.\n const enumDecl = authoredElementType.enumDeclaration;\n lines.push(` Element type: use \\`${enumDecl.exportName}\\` from \\`${formatImportTarget(enumDecl)}\\``);\n }\n\n for (const note of authoredElementType?.notes ?? []) {\n lines.push(` ${note}`);\n }\n\n return lines;\n}\n\nfunction formatStringUsageLines(params: Record<string, unknown>): string[] {\n const semanticRole = typeof params.semanticRole === 'string'\n ? params.semanticRole\n : undefined;\n return semanticRole\n ? [` Semantic role: ${semanticRole}`]\n : [];\n}\n\nfunction formatNumberUsageLines(params: Record<string, unknown>): string[] {\n const unit = typeof params.unit === 'string' ? params.unit : undefined;\n return unit ? [` Unit: ${unit}`] : [];\n}\n\nfunction formatDateUsageLines(params: Record<string, unknown>): string[] {\n const temporalRole = typeof params.temporalRole === 'string'\n ? params.temporalRole\n : undefined;\n return temporalRole\n ? [` Temporal role: ${temporalRole}`]\n : [];\n}\n\n/**\n * Object-spec usage lines are intentionally empty.\n *\n * `objectSpec()` carries no extra structural metadata after the Step 6 D-6\n * Phase 1 collapse — its `meaning` / `whyItMatters` / `importance` are\n * already rendered by the base block. The decorator still exists so the\n * Phase 4 completeness validator can detect spec-bearing nested structures,\n * but renderers contribute no additional lines for it.\n */\nfunction formatObjectUsageLines(_params: Record<string, unknown>): string[] {\n return [];\n}\n"]}
|
|
@@ -1,10 +1,55 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
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';
|
|
2
|
+
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService, WebSocketService } from "@wildo-ai/saas-backend-lib";
|
|
3
|
+
import { Actors_Task_Schema, ActorSystem_ExecutionSchema, CoreResourceOperation, CoreWebSocketEvent, FlowSystem_Execution_Schema, ResourceAction, ResourceScopeRoomKey } 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
|
+
}
|
|
8
53
|
type Wildo_Application_ActorSystem_Execution = z.infer<typeof ActorSystem_ExecutionSchema> & {
|
|
9
54
|
_id: string;
|
|
10
55
|
_version?: number;
|
|
@@ -33,9 +78,10 @@ export declare class CompanionExecutionsCompanionService {
|
|
|
33
78
|
private readonly executionContextCreator;
|
|
34
79
|
private readonly companionContext;
|
|
35
80
|
private readonly traceabilityService;
|
|
81
|
+
private readonly websocketService;
|
|
36
82
|
private readonly logDebug;
|
|
37
83
|
private ownershipPromise?;
|
|
38
|
-
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService, repositoriesRegistry: RepositoriesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, executionContextCreator: ExecutionContextCreatorBackendService, companionContext: CompanionContext, traceabilityService: CompanionTraceabilityService);
|
|
84
|
+
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService, repositoriesRegistry: RepositoriesRegistryHandlerBackendService, resourcesRegistry: ResourcesRegistryBackendService, executionContextCreator: ExecutionContextCreatorBackendService, companionContext: CompanionContext, traceabilityService: CompanionTraceabilityService, websocketService: WebSocketService);
|
|
39
85
|
createActorExecution(payload: CompanionCreateActorExecutionRequest, sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution>;
|
|
40
86
|
createFlowExecution(payload: CompanionCreateFlowExecutionRequest, sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_FlowSystem_Execution>;
|
|
41
87
|
getActorExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution>;
|
|
@@ -52,6 +98,39 @@ export declare class CompanionExecutionsCompanionService {
|
|
|
52
98
|
* Resolving and memoizing that ownership keeps all repository calls scoped to
|
|
53
99
|
* the truthful platform parent instead of falling back to tenant-app semantics.
|
|
54
100
|
*/
|
|
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;
|
|
55
134
|
private resolveOwnership;
|
|
56
135
|
private loadOwnership;
|
|
57
136
|
/**
|
|
@@ -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":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAE1B,qCAAqC,EACrC,aAAa,EACb,yCAAyC,EACzC,2CAA2C,EAC3C,+BAA+B,EAE/B,gBAAgB,EAIjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAGlB,2BAA2B,EAG3B,cAAc,EACd,oBAAoB,EAKrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EACV,4BAA4B,EAC5B,+BAA+B,EAC/B,oCAAoC,EACpC,mCAAmC,EACnC,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAuD,KAAK,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AACnK;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qCAAqC,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
@@ -11,12 +11,52 @@ 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, } from "@wildo-ai/saas-backend-lib";
|
|
15
|
-
import { CoreResourceOperation, ErrorCustomMessageReference, ErrorType, FlowsActors_ElementKind, FlowsActors_Status, ResourceSerializationUtils, deriveTrustedSystemWritePreservedFields, isWildoBackendError, } from '@wildo-ai/saas-models';
|
|
14
|
+
import { ErrorBuilderBackendService, ExecutionContextCreatorBackendService, LoggerService, RepositoriesRegistryHandlerBackendService, ResourcePersistenceUnitOfWorkBackendService, ResourcesRegistryBackendService, SAAS_SERVICE_TYPES, WebSocketService, buildScopeRoomNotificationPayload, registerTransactionPostCommitEffect, } from "@wildo-ai/saas-backend-lib";
|
|
15
|
+
import { CoreResourceOperation, CoreWebSocketEvent, ErrorCustomMessageReference, ErrorType, FlowsActors_ElementKind, FlowsActors_Status, ResourceAction, ResourceScopeRoomKey, 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
|
+
}
|
|
20
60
|
const WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE = "wildoApplicationActorSystemExecutions";
|
|
21
61
|
const WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE = "wildoApplicationFlowSystemExecutions";
|
|
22
62
|
const WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE = "wildoApplicationActorTasks";
|
|
@@ -42,9 +82,10 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
42
82
|
executionContextCreator;
|
|
43
83
|
companionContext;
|
|
44
84
|
traceabilityService;
|
|
85
|
+
websocketService;
|
|
45
86
|
logDebug;
|
|
46
87
|
ownershipPromise;
|
|
47
|
-
constructor(logger, errorBuilder, resourcePersistenceUnitOfWork, repositoriesRegistry, resourcesRegistry, executionContextCreator, companionContext, traceabilityService) {
|
|
88
|
+
constructor(logger, errorBuilder, resourcePersistenceUnitOfWork, repositoriesRegistry, resourcesRegistry, executionContextCreator, companionContext, traceabilityService, websocketService) {
|
|
48
89
|
this.logger = logger;
|
|
49
90
|
this.errorBuilder = errorBuilder;
|
|
50
91
|
this.resourcePersistenceUnitOfWork = resourcePersistenceUnitOfWork;
|
|
@@ -53,6 +94,7 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
53
94
|
this.executionContextCreator = executionContextCreator;
|
|
54
95
|
this.companionContext = companionContext;
|
|
55
96
|
this.traceabilityService = traceabilityService;
|
|
97
|
+
this.websocketService = websocketService;
|
|
56
98
|
this.logDebug = this.logger.debugByType("CompanionExecutionsCompanionService");
|
|
57
99
|
this.logger.setDebugTypeLogging("CompanionExecutionsCompanionService", true);
|
|
58
100
|
}
|
|
@@ -91,6 +133,9 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
91
133
|
...this.buildRepositoryOptions(transaction),
|
|
92
134
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
93
135
|
});
|
|
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.
|
|
94
139
|
if (payload.standaloneTasks.length === 0) {
|
|
95
140
|
return createdExecution;
|
|
96
141
|
}
|
|
@@ -160,6 +205,8 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
160
205
|
const flowExecution = await repository.create(executionContext, createData, {
|
|
161
206
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
162
207
|
});
|
|
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);
|
|
163
210
|
if (sessionContext) {
|
|
164
211
|
await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION, flowExecution._id);
|
|
165
212
|
}
|
|
@@ -408,12 +455,14 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
408
455
|
organizationId: ownership.organizationId,
|
|
409
456
|
wildoApplicationId: ownership.wildoApplicationId,
|
|
410
457
|
...(payload.wildoApplicationActorSystemExecutionId ? { wildoApplicationActorSystemExecutionId: payload.wildoApplicationActorSystemExecutionId } : {}),
|
|
458
|
+
...(payload.workbenchBuildPlanTaskId ? { workbenchBuildPlanTaskId: payload.workbenchBuildPlanTaskId } : {}),
|
|
411
459
|
};
|
|
412
460
|
const createdTask = await repository.create(executionContext, createData, {
|
|
413
461
|
...this.buildRepositoryOptions(transaction),
|
|
414
462
|
preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, createData, CoreResourceOperation.CREATE),
|
|
415
463
|
});
|
|
416
464
|
await this.syncTaskIntoExecutionSnapshot(createdTask, transaction, sessionContext);
|
|
465
|
+
this.publishControlPlaneMutation(transaction, WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, ownership, String(createdTask._id), ResourceAction.CREATED);
|
|
417
466
|
return createdTask;
|
|
418
467
|
});
|
|
419
468
|
if (sessionContext) {
|
|
@@ -609,6 +658,7 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
609
658
|
await this.removeTaskFromExecutionSnapshot(existingTask, transaction, sessionContext);
|
|
610
659
|
}
|
|
611
660
|
await this.syncTaskIntoExecutionSnapshot(updatedTask, transaction, sessionContext);
|
|
661
|
+
this.publishControlPlaneMutation(transaction, WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, ownership, String(updatedTask._id), ResourceAction.UPDATED);
|
|
612
662
|
return updatedTask;
|
|
613
663
|
});
|
|
614
664
|
if (sessionContext) {
|
|
@@ -652,6 +702,64 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
652
702
|
* Resolving and memoizing that ownership keeps all repository calls scoped to
|
|
653
703
|
* the truthful platform parent instead of falling back to tenant-app semantics.
|
|
654
704
|
*/
|
|
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
|
+
}
|
|
655
763
|
async resolveOwnership(sessionContext) {
|
|
656
764
|
if (!this.ownershipPromise) {
|
|
657
765
|
const ownershipPromise = this.loadOwnership(sessionContext).catch((error) => {
|
|
@@ -1054,15 +1162,19 @@ let CompanionExecutionsCompanionService = class CompanionExecutionsCompanionServ
|
|
|
1054
1162
|
if (fieldEntries.length === 0) {
|
|
1055
1163
|
return;
|
|
1056
1164
|
}
|
|
1165
|
+
/*
|
|
1166
|
+
* ADAPTER-NEUTRAL on purpose, and the previous body is the cautionary tale: it reached
|
|
1167
|
+
* `mongooseModel.findOneAndUpdate` + `getNativeSession` directly, which exists only on the
|
|
1168
|
+
* MongoDB repository — on a PostgreSQL-backed application (wonder-crm) the call threw
|
|
1169
|
+
* `repository.getNativeSession is not a function`, the interactive lane's park-persistence
|
|
1170
|
+
* write died on it, and the failure handler then recorded the whole parked run as
|
|
1171
|
+
* `agent_execution_failed`, destroying the suspension the restart-durability door needed
|
|
1172
|
+
* (measured 2026-09-04, first live park on PG). `atomicConditionalSet` is on the repository
|
|
1173
|
+
* CONTRACT — an adapter that cannot compile it fails to build — and its `clearFields` is
|
|
1174
|
+
* exactly the unset: `$unset` on MongoDB, `SET col = NULL` (+ read-path omission) on PG.
|
|
1175
|
+
*/
|
|
1057
1176
|
const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);
|
|
1058
|
-
|
|
1059
|
-
await repository.mongooseModel.findOneAndUpdate({ _id: taskId, wildoApplicationId }, {
|
|
1060
|
-
$unset: Object.fromEntries(fieldEntries),
|
|
1061
|
-
}, {
|
|
1062
|
-
runValidators: true,
|
|
1063
|
-
new: true,
|
|
1064
|
-
...(session ? { session } : {}),
|
|
1065
|
-
});
|
|
1177
|
+
await repository.atomicConditionalSet({ _id: taskId, wildoApplicationId }, undefined, fieldEntries.map(([field]) => field), this.buildRepositoryOptions(transaction));
|
|
1066
1178
|
}
|
|
1067
1179
|
buildRepositoryOptions(transaction) {
|
|
1068
1180
|
return transaction ? { transaction } : undefined;
|
|
@@ -1268,12 +1380,14 @@ CompanionExecutionsCompanionService = __decorate([
|
|
|
1268
1380
|
__param(5, inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService)),
|
|
1269
1381
|
__param(6, inject(COMPANION_SERVICE_TYPES.CompanionContext)),
|
|
1270
1382
|
__param(7, inject(COMPANION_SERVICE_TYPES.TraceabilityService)),
|
|
1383
|
+
__param(8, inject(SAAS_SERVICE_TYPES.WebSocketService)),
|
|
1271
1384
|
__metadata("design:paramtypes", [LoggerService,
|
|
1272
1385
|
ErrorBuilderBackendService,
|
|
1273
1386
|
ResourcePersistenceUnitOfWorkBackendService,
|
|
1274
1387
|
RepositoriesRegistryHandlerBackendService,
|
|
1275
1388
|
ResourcesRegistryBackendService,
|
|
1276
|
-
ExecutionContextCreatorBackendService, Object, CompanionTraceabilityService
|
|
1389
|
+
ExecutionContextCreatorBackendService, Object, CompanionTraceabilityService,
|
|
1390
|
+
WebSocketService])
|
|
1277
1391
|
], CompanionExecutionsCompanionService);
|
|
1278
1392
|
export { CompanionExecutionsCompanionService };
|
|
1279
1393
|
//# sourceMappingURL=companion-executions.companion.service.js.map
|