@wildo-ai/dev-companion 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/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 +408 -38
- 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 +70 -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 +110 -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 +62 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +295 -19
- 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 +243 -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 +370 -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 +40 -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 +126 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
- 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/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.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +13 -8
- 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 +31 -0
- 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 +91 -8
- 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 +4 -2
- 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 +10 -7
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +80 -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 +261 -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 +113 -1
- 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 +517 -54
- 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 +84 -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 +10 -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 +10 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/.builder.pid +0 -9
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { FAMILY_ASPECTS_REGISTRY, FamilyAspectKind, } from '@wildo-ai/saas-specifications';
|
|
2
|
+
import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS } from '@wildo-ai/application-creation-runtime';
|
|
3
|
+
import { WORKBENCH_ASPECT_DESCRIPTORS, WorkbenchShared_ResourceFieldIdentifier, } from '@wildo-ai/platform-core-shared';
|
|
4
|
+
import { resolveSpecificationsCompanionExports } from './companion-introspection-module-exports.utils.js';
|
|
5
|
+
const DESCRIPTOR_BY_ASPECT_KEY = new Map(WORKBENCH_ASPECT_DESCRIPTORS.map((descriptor) => [descriptor.aspectKey, descriptor]));
|
|
6
|
+
export function projectFamilyAspects(input) {
|
|
7
|
+
const companionExports = resolveSpecificationsCompanionExports(input.moduleExports);
|
|
8
|
+
const bindingBySchemaRef = new Map(APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.map((binding) => [binding.schemaRef, binding]));
|
|
9
|
+
// ── Pass 1: raw items per aspect (needed before edges — membership routing reads key sets). ──
|
|
10
|
+
const itemsByAspectKey = new Map();
|
|
11
|
+
for (const familyDeclaration of FAMILY_ASPECTS_REGISTRY) {
|
|
12
|
+
const binding = bindingBySchemaRef.get(familyDeclaration.schemaRef);
|
|
13
|
+
if (!binding)
|
|
14
|
+
continue;
|
|
15
|
+
const snapshot = binding.companionExportsField === undefined
|
|
16
|
+
? undefined
|
|
17
|
+
: companionExports[binding.companionExportsField];
|
|
18
|
+
for (const aspect of familyDeclaration.aspects) {
|
|
19
|
+
const member = snapshot?.[aspect.snapshotPath];
|
|
20
|
+
const items = aspect.kind === FamilyAspectKind.SINGLETON
|
|
21
|
+
? (member && typeof member === 'object' ? [member] : [])
|
|
22
|
+
: (Array.isArray(member) ? member : []);
|
|
23
|
+
itemsByAspectKey.set(aspect.key, { family: binding.family, items, declaration: aspect });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// ── Key sets per aspect, for membership routing of multi-target edges. ──
|
|
27
|
+
const keySetByAspectKey = new Map();
|
|
28
|
+
for (const [aspectKey, { items, declaration }] of itemsByAspectKey) {
|
|
29
|
+
const keys = new Set();
|
|
30
|
+
if (declaration.businessKey !== undefined) {
|
|
31
|
+
for (const item of items) {
|
|
32
|
+
const value = item[declaration.businessKey];
|
|
33
|
+
if (typeof value === 'string')
|
|
34
|
+
keys.add(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
keySetByAspectKey.set(aspectKey, keys);
|
|
38
|
+
}
|
|
39
|
+
// ── Pass 2: envelope rows. ──
|
|
40
|
+
const rowsByPath = {};
|
|
41
|
+
let totalRows = 0;
|
|
42
|
+
for (const [aspectKey, { family, items, declaration }] of itemsByAspectKey) {
|
|
43
|
+
const descriptor = DESCRIPTOR_BY_ASPECT_KEY.get(aspectKey);
|
|
44
|
+
if (!descriptor)
|
|
45
|
+
continue; // spine coverage is the parity test's business, not a crash site
|
|
46
|
+
// The projection must emit the exact composed field the spine's identifier map names.
|
|
47
|
+
const identityField = WorkbenchShared_ResourceFieldIdentifier[descriptor.resourceType];
|
|
48
|
+
rowsByPath[descriptor.rowsPath] = items.map((item, index) => {
|
|
49
|
+
const identity = declaration.businessKey !== undefined
|
|
50
|
+
? String(item[declaration.businessKey] ?? `${aspectKey}[${index}]`)
|
|
51
|
+
: declaration.kind === FamilyAspectKind.SINGLETON ? aspectKey : `${aspectKey}[${index}]`;
|
|
52
|
+
const headline = item[declaration.headlineField];
|
|
53
|
+
const row = {
|
|
54
|
+
[identityField]: identity,
|
|
55
|
+
family,
|
|
56
|
+
aspectKey,
|
|
57
|
+
title: typeof headline === 'string' ? headline : identity,
|
|
58
|
+
content: item,
|
|
59
|
+
};
|
|
60
|
+
for (const edge of declaration.edges) {
|
|
61
|
+
applyEdge({ row, item, aspect: declaration, edge, descriptor, keySetByAspectKey });
|
|
62
|
+
}
|
|
63
|
+
return row;
|
|
64
|
+
});
|
|
65
|
+
totalRows += items.length;
|
|
66
|
+
}
|
|
67
|
+
const trace = {
|
|
68
|
+
aspects: itemsByAspectKey.size,
|
|
69
|
+
rows: totalRows,
|
|
70
|
+
evaluatedAt: input.evaluatedAt,
|
|
71
|
+
};
|
|
72
|
+
return { ...rowsByPath, trace };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Flatten one registry edge into the row's spine field(s).
|
|
76
|
+
*
|
|
77
|
+
* The spine field for a target is the descriptor edge whose `targetAspectKey` matches — unique
|
|
78
|
+
* per (aspect, target) by construction, and the parity test pins that uniqueness, because this
|
|
79
|
+
* join is exactly where a second same-target edge would silently merge two meanings.
|
|
80
|
+
*/
|
|
81
|
+
function applyEdge(context) {
|
|
82
|
+
const keys = extractEdgeKeys(context.item, context.edge);
|
|
83
|
+
for (const targetAspectKey of context.edge.targetAspects) {
|
|
84
|
+
const spineEdge = context.descriptor.edges.find((entry) => entry.targetAspectKey === targetAspectKey);
|
|
85
|
+
if (!spineEdge)
|
|
86
|
+
continue;
|
|
87
|
+
const targetKeys = context.edge.targetAspects.length === 1
|
|
88
|
+
? keys
|
|
89
|
+
: keys.filter((key) => context.keySetByAspectKey.get(targetAspectKey)?.has(key));
|
|
90
|
+
if (spineEdge.many) {
|
|
91
|
+
context.row[spineEdge.field] = targetKeys;
|
|
92
|
+
}
|
|
93
|
+
else if (targetKeys.length > 0) {
|
|
94
|
+
context.row[spineEdge.field] = targetKeys[0];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** Lift the reference key(s) out of the item — plain, array, or through an edge object/array. */
|
|
99
|
+
function extractEdgeKeys(item, edge) {
|
|
100
|
+
const raw = item[edge.field];
|
|
101
|
+
if (raw === undefined || raw === null)
|
|
102
|
+
return [];
|
|
103
|
+
if (edge.throughField === undefined) {
|
|
104
|
+
if (typeof raw === 'string')
|
|
105
|
+
return [raw];
|
|
106
|
+
if (Array.isArray(raw))
|
|
107
|
+
return raw.filter((entry) => typeof entry === 'string');
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
const carriers = Array.isArray(raw) ? raw : [raw];
|
|
111
|
+
const keys = [];
|
|
112
|
+
for (const carrier of carriers) {
|
|
113
|
+
if (!carrier || typeof carrier !== 'object')
|
|
114
|
+
continue;
|
|
115
|
+
const through = carrier[edge.throughField];
|
|
116
|
+
if (typeof through === 'string')
|
|
117
|
+
keys.push(through);
|
|
118
|
+
else if (Array.isArray(through)) {
|
|
119
|
+
for (const entry of through)
|
|
120
|
+
if (typeof entry === 'string')
|
|
121
|
+
keys.push(entry);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return keys;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=family-aspects.behavior.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-aspects.behavior.js","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/family-aspects.behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAGvB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,GAExC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAwCvG,MAAM,wBAAwB,GAAmD,IAAI,GAAG,CACtF,4BAA4B,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EA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AAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC;QACjG,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,SAAS;QACtD,MAAM,OAAO,GAAI,OAAmC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxE,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,KAAK,MAAM,KAAK,IAAI,OAAO;gBAAE,IAAI,OAAO,KAAK,KAAK,QAAQ;oBAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {\n FAMILY_ASPECTS_REGISTRY,\n type FamilyAspectDeclaration,\n type FamilyAspectEdge,\n FamilyAspectKind,\n} from '@wildo-ai/saas-specifications';\nimport { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS } from '@wildo-ai/application-creation-runtime';\nimport {\n WORKBENCH_ASPECT_DESCRIPTORS,\n WorkbenchShared_ResourceFieldIdentifier,\n type WorkbenchAspectDescriptor,\n} from '@wildo-ai/platform-core-shared';\n\nimport { resolveSpecificationsCompanionExports } from './companion-introspection-module-exports.utils';\n\n/**\n * FAMILY ASPECTS — every second-level aspect row of every landed family, in ONE projection.\n *\n * One behavior for forty resources, on the same single-import consistency argument as\n * `application-domain-model`: the aspect rows CROSS-REFERENCE each other (a requirement's\n * `icpRefs` must be routable against the ICP key set), so deriving them from one read of one\n * companion-exports module is the only shape in which the graph's two ends describe the same\n * working tree. Each aspect resource binds this behavior at its own `rowsPath`.\n *\n * ## What a row is\n *\n * The spine envelope (see `workbench-aspect-resources.custom.shared.schemas.ts`): composed\n * identity, `family` backlink, `aspectKey`, `title` (the registry's headline field), the full\n * item as `content`, plus the aspect's FLATTENED reference fields. Flattening happens here:\n *\n * - through-edges lift the key(s) out of edge objects (`jobs[].jobRef` → `jobRefs`),\n * - multi-target edges route each key BY MEMBERSHIP into its per-target split field\n * (`deliversRequirementRefs` → `deliversFunctionalRequirementRefs` + …); a key belonging to\n * NO target keeps the graph honest by landing in none of them — the raw value stays readable\n * in `content`, so a dangling ref is visible without becoming a dead reference control.\n */\n\ninterface FamilyAspectRow {\n readonly [field: string]: unknown;\n}\n\nexport type FamilyAspectsResponse = {\n readonly trace: FamilyAspectsTrace;\n} & {\n readonly [rowsPath: string]: readonly FamilyAspectRow[] | FamilyAspectsTrace;\n};\n\nexport interface FamilyAspectsTrace {\n readonly aspects: number;\n readonly rows: number;\n readonly evaluatedAt: string;\n}\n\nconst DESCRIPTOR_BY_ASPECT_KEY: ReadonlyMap<string, WorkbenchAspectDescriptor> = new Map(\n WORKBENCH_ASPECT_DESCRIPTORS.map((descriptor) => [descriptor.aspectKey, descriptor]),\n);\n\nexport function projectFamilyAspects(input: {\n readonly moduleExports: Record<string, unknown>;\n readonly evaluatedAt: string;\n}): FamilyAspectsResponse {\n const companionExports = resolveSpecificationsCompanionExports(input.moduleExports) as unknown as Record<string, unknown>;\n const bindingBySchemaRef = new Map(\n APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.map((binding) => [binding.schemaRef as string, binding]),\n );\n\n // ── Pass 1: raw items per aspect (needed before edges — membership routing reads key sets). ──\n const itemsByAspectKey = new Map<string, { family: string; items: Record<string, unknown>[]; declaration: FamilyAspectDeclaration }>();\n for (const familyDeclaration of FAMILY_ASPECTS_REGISTRY) {\n const binding = bindingBySchemaRef.get(familyDeclaration.schemaRef);\n if (!binding) continue;\n const snapshot = binding.companionExportsField === undefined\n ? undefined\n : (companionExports[binding.companionExportsField] as Record<string, unknown> | undefined);\n for (const aspect of familyDeclaration.aspects) {\n const member = snapshot?.[aspect.snapshotPath];\n const items = aspect.kind === FamilyAspectKind.SINGLETON\n ? (member && typeof member === 'object' ? [member as Record<string, unknown>] : [])\n : (Array.isArray(member) ? (member as Record<string, unknown>[]) : []);\n itemsByAspectKey.set(aspect.key, { family: binding.family, items, declaration: aspect });\n }\n }\n\n // ── Key sets per aspect, for membership routing of multi-target edges. ──\n const keySetByAspectKey = new Map<string, Set<string>>();\n for (const [aspectKey, { items, declaration }] of itemsByAspectKey) {\n const keys = new Set<string>();\n if (declaration.businessKey !== undefined) {\n for (const item of items) {\n const value = item[declaration.businessKey];\n if (typeof value === 'string') keys.add(value);\n }\n }\n keySetByAspectKey.set(aspectKey, keys);\n }\n\n // ── Pass 2: envelope rows. ──\n const rowsByPath: Record<string, FamilyAspectRow[]> = {};\n let totalRows = 0;\n for (const [aspectKey, { family, items, declaration }] of itemsByAspectKey) {\n const descriptor = DESCRIPTOR_BY_ASPECT_KEY.get(aspectKey);\n if (!descriptor) continue; // spine coverage is the parity test's business, not a crash site\n // The projection must emit the exact composed field the spine's identifier map names.\n const identityField = WorkbenchShared_ResourceFieldIdentifier[descriptor.resourceType];\n\n rowsByPath[descriptor.rowsPath] = items.map((item, index) => {\n const identity = declaration.businessKey !== undefined\n ? String(item[declaration.businessKey] ?? `${aspectKey}[${index}]`)\n : declaration.kind === FamilyAspectKind.SINGLETON ? aspectKey : `${aspectKey}[${index}]`;\n const headline = item[declaration.headlineField];\n\n const row: Record<string, unknown> = {\n [identityField]: identity,\n family,\n aspectKey,\n title: typeof headline === 'string' ? headline : identity,\n content: item,\n };\n for (const edge of declaration.edges) {\n applyEdge({ row, item, aspect: declaration, edge, descriptor, keySetByAspectKey });\n }\n return row;\n });\n totalRows += items.length;\n }\n\n const trace: FamilyAspectsTrace = {\n aspects: itemsByAspectKey.size,\n rows: totalRows,\n evaluatedAt: input.evaluatedAt,\n };\n return { ...rowsByPath, trace };\n}\n\n/**\n * Flatten one registry edge into the row's spine field(s).\n *\n * The spine field for a target is the descriptor edge whose `targetAspectKey` matches — unique\n * per (aspect, target) by construction, and the parity test pins that uniqueness, because this\n * join is exactly where a second same-target edge would silently merge two meanings.\n */\nfunction applyEdge(context: {\n row: Record<string, unknown>;\n item: Record<string, unknown>;\n aspect: FamilyAspectDeclaration;\n edge: FamilyAspectEdge;\n descriptor: WorkbenchAspectDescriptor;\n keySetByAspectKey: ReadonlyMap<string, Set<string>>;\n}): void {\n const keys = extractEdgeKeys(context.item, context.edge);\n for (const targetAspectKey of context.edge.targetAspects) {\n const spineEdge = context.descriptor.edges.find((entry) => entry.targetAspectKey === targetAspectKey);\n if (!spineEdge) continue;\n const targetKeys = context.edge.targetAspects.length === 1\n ? keys\n : keys.filter((key) => context.keySetByAspectKey.get(targetAspectKey)?.has(key));\n if (spineEdge.many) {\n context.row[spineEdge.field] = targetKeys;\n } else if (targetKeys.length > 0) {\n context.row[spineEdge.field] = targetKeys[0];\n }\n }\n}\n\n/** Lift the reference key(s) out of the item — plain, array, or through an edge object/array. */\nfunction extractEdgeKeys(item: Record<string, unknown>, edge: FamilyAspectEdge): string[] {\n const raw = item[edge.field];\n if (raw === undefined || raw === null) return [];\n if (edge.throughField === undefined) {\n if (typeof raw === 'string') return [raw];\n if (Array.isArray(raw)) return raw.filter((entry): entry is string => typeof entry === 'string');\n return [];\n }\n const carriers = Array.isArray(raw) ? raw : [raw];\n const keys: string[] = [];\n for (const carrier of carriers) {\n if (!carrier || typeof carrier !== 'object') continue;\n const through = (carrier as Record<string, unknown>)[edge.throughField];\n if (typeof through === 'string') keys.push(through);\n else if (Array.isArray(through)) {\n for (const entry of through) if (typeof entry === 'string') keys.push(entry);\n }\n }\n return keys;\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { WorkbenchSpecificationArtifactConcern, WorkbenchSpecificationArtifactState } from '@wildo-ai/platform-core-shared';
|
|
2
|
+
/** One family row, JSON-safe, matching `Workbench_SpecificationArtifact_Schema`. */
|
|
3
|
+
export interface SpecificationArtifactRow {
|
|
4
|
+
readonly family: string;
|
|
5
|
+
readonly title: string;
|
|
6
|
+
/** Static per-family subtitle — see {@link FAMILY_DESCRIPTIONS}. */
|
|
7
|
+
readonly description: string;
|
|
8
|
+
/** One-line pulse of the landed content, `null` when nothing landed. See {@link deriveContentPulse}. */
|
|
9
|
+
readonly contentSummary: string | null;
|
|
10
|
+
readonly concern: WorkbenchSpecificationArtifactConcern;
|
|
11
|
+
readonly state: WorkbenchSpecificationArtifactState;
|
|
12
|
+
readonly schemaRef: string;
|
|
13
|
+
readonly sourcePath: string | null;
|
|
14
|
+
readonly errorCount: number;
|
|
15
|
+
readonly warnCount: number;
|
|
16
|
+
readonly producedByPlaybookRefs: string[];
|
|
17
|
+
/**
|
|
18
|
+
* The landed family value, RAW — exactly what the specifications package exports, never the
|
|
19
|
+
* validator's parsed output (whose schema `.default()`s would inject content the author never
|
|
20
|
+
* wrote). The workbench's per-family templates render from this; the markdown `document` beside
|
|
21
|
+
* it is their structural fallback. `null` when the family has not landed.
|
|
22
|
+
*/
|
|
23
|
+
readonly content: Record<string, unknown> | null;
|
|
24
|
+
readonly document: string | null;
|
|
25
|
+
readonly issues: string | null;
|
|
26
|
+
readonly decisionRecord: string | null;
|
|
27
|
+
readonly diagram: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface SpecificationArtifactsResponse {
|
|
30
|
+
readonly artifacts: SpecificationArtifactRow[];
|
|
31
|
+
readonly trace: {
|
|
32
|
+
readonly families: number;
|
|
33
|
+
readonly landed: number;
|
|
34
|
+
readonly invalid: number;
|
|
35
|
+
readonly evaluatedAt: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Project every application-specification family for a human reviewer.
|
|
40
|
+
*
|
|
41
|
+
* `packageRoot` is the specifications package's absolute root, and `appRelativePackagePrefix` its
|
|
42
|
+
* directory name relative to the application — so a row can name a path a reader recognizes
|
|
43
|
+
* (`specifications/src/vision/index.ts`) rather than one that only makes sense inside the package.
|
|
44
|
+
*/
|
|
45
|
+
export declare function projectSpecificationArtifacts(input: {
|
|
46
|
+
readonly moduleExports: Record<string, unknown>;
|
|
47
|
+
readonly packageRoot: string;
|
|
48
|
+
readonly appRelativePackagePrefix: string;
|
|
49
|
+
readonly evaluatedAt: string;
|
|
50
|
+
}): SpecificationArtifactsResponse;
|
|
51
|
+
//# sourceMappingURL=specification-artifacts.behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specification-artifacts.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/specification-artifacts.behavior.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,qCAAqC,EACrC,mCAAmC,EACpC,MAAM,gCAAgC,CAAC;AA0IxC,oFAAoF;AACpF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,qCAAqC,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,mCAAmC,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,EAAE,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,SAAS,EAAE,wBAAwB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH;AA4OD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,8BAA8B,CA+BjC"}
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS, getFamilyPackageRelativePath, renderSpecificationFamilyReviewDocument, } from '@wildo-ai/application-creation-runtime';
|
|
4
|
+
import { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';
|
|
5
|
+
import { WorkbenchSpecificationArtifactConcern, WorkbenchSpecificationArtifactState, } from '@wildo-ai/platform-core-shared';
|
|
6
|
+
import { JourneyArtifactValidationState } from '@wildo-ai/saas-specifications/application-creation';
|
|
7
|
+
import { resolveSpecificationsCompanionExports } from './companion-introspection-module-exports.utils.js';
|
|
8
|
+
/**
|
|
9
|
+
* The operator-facing projection of the application's specification families (issue #162).
|
|
10
|
+
*
|
|
11
|
+
* ## What was missing, and what was already there
|
|
12
|
+
*
|
|
13
|
+
* Nine companion behaviors already READ this content — `market-context-for-icp`,
|
|
14
|
+
* `market-render-prompt`, `brand-render-prompt`, `compliance-primary-facts`,
|
|
15
|
+
* `definition-specifications`, `specification-context-parts` and their siblings — and every one of
|
|
16
|
+
* them renders PROSE FOR A LANGUAGE MODEL. The loading and resolution paths were proven; what did
|
|
17
|
+
* not exist was a projection whose consumer is a human. So a creator could not review, compare or
|
|
18
|
+
* revise anything the journey had decided about their product without opening TypeScript files in an
|
|
19
|
+
* editor.
|
|
20
|
+
*
|
|
21
|
+
* Reusing one of those renderers to fill a UI would ship an LLM context block into a human surface.
|
|
22
|
+
* This behavior therefore renders through `renderSpecificationFamilyReviewDocument`, whose only
|
|
23
|
+
* reader is a person.
|
|
24
|
+
*
|
|
25
|
+
* ## Why it REPORTS where `definition-specifications` REFUSES
|
|
26
|
+
*
|
|
27
|
+
* That behavior runs the same validators through the same authority and THROWS on any ERROR-severity
|
|
28
|
+
* issue — correct for a durable load-time guard, and exactly wrong for a review surface: it would
|
|
29
|
+
* make an invalid artifact the one thing a reviewer cannot look at, precisely when they most need to
|
|
30
|
+
* see it. The two cannot disagree about what is VALID, because the validator is the same object; they
|
|
31
|
+
* differ only in what to do about an invalid answer.
|
|
32
|
+
*
|
|
33
|
+
* ## Pure, deterministic, and read-only by construction
|
|
34
|
+
*
|
|
35
|
+
* Reads the authored snapshots off the specifications companion exports, the two committed markdown
|
|
36
|
+
* records beside each family, and the compiled playbook catalog. No LLM, no network, no write, and no
|
|
37
|
+
* state: acceptance of a specification is a human git commit (`.claude/rules/one-source-of-truth.md`
|
|
38
|
+
* rule 2), so there is nowhere here for an acceptance state to accumulate.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* The family's name in a creator's words.
|
|
42
|
+
*
|
|
43
|
+
* Authored rather than derived from the family slug, because the two genuinely diverge in the
|
|
44
|
+
* direction that matters: `vision-brief` names a product VISION, `business-model` a pricing and
|
|
45
|
+
* revenue model, `compliance-program` an assurance PROGRAMME. Humanizing the slug would produce
|
|
46
|
+
* "Vision brief" and "Compliance program" — accurate about the id, and a worse answer to "what am I
|
|
47
|
+
* looking at" than the words the domain already uses.
|
|
48
|
+
*
|
|
49
|
+
* A family with no entry falls back to its slug rather than being dropped; see
|
|
50
|
+
* {@link classifyFamily}.
|
|
51
|
+
*/
|
|
52
|
+
const FAMILY_TITLES = {
|
|
53
|
+
'vision-brief': 'Vision',
|
|
54
|
+
'market-snapshot': 'Market',
|
|
55
|
+
requirements: 'Requirements',
|
|
56
|
+
'feature-drafts': 'Feature drafts',
|
|
57
|
+
'business-model': 'Business model',
|
|
58
|
+
roadmap: 'Roadmap',
|
|
59
|
+
'domain-plan': 'Domain plan',
|
|
60
|
+
'build-plan': 'Build plan',
|
|
61
|
+
'placement-plan': 'Placement plan',
|
|
62
|
+
'brand-brief': 'Brand',
|
|
63
|
+
'compliance-program': 'Assurance programme',
|
|
64
|
+
'compliance-document-candidate': 'Governed-document drafts',
|
|
65
|
+
'document-publication': 'Document publication',
|
|
66
|
+
'document-release-policy': 'Document release policy',
|
|
67
|
+
'document-facts': 'Document facts',
|
|
68
|
+
'document-facts-authored': 'Document facts you decide',
|
|
69
|
+
'processor-register': 'Who else processes your data',
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* What each family IS, in one sentence a creator recognizes — the summary card's subtitle.
|
|
73
|
+
*
|
|
74
|
+
* Static and present whether or not anything landed: on a NOT_LANDED card this sentence is the
|
|
75
|
+
* whole answer to "why would I care", and on a landed one it frames the pulse beside it. Authored
|
|
76
|
+
* in the creator's vocabulary, not the framework's — "the files this product must publish", never
|
|
77
|
+
* "the governed-document candidate family".
|
|
78
|
+
*/
|
|
79
|
+
const FAMILY_DESCRIPTIONS = {
|
|
80
|
+
'vision-brief': 'The founding intent — the idea, the problem it answers, and what success looks like.',
|
|
81
|
+
'market-snapshot': 'Who this product is for and how it is positioned — category, ICPs, personas, messaging.',
|
|
82
|
+
requirements: 'What the product must do, functionally and non-functionally, with acceptance criteria.',
|
|
83
|
+
'feature-drafts': 'Accepted feature intent — spec-first drafts awaiting their runtime definitions.',
|
|
84
|
+
'business-model': 'How the product earns — the revenue model and its pricing plans.',
|
|
85
|
+
roadmap: 'The build order — phases, their objectives, and what each one delivers.',
|
|
86
|
+
'domain-plan': 'The domain model as planned — modules, their purposes, and the relationships between resources.',
|
|
87
|
+
'build-plan': 'The task graph the coding lane executes — objectives, targets and prerequisites.',
|
|
88
|
+
'placement-plan': 'Where every destination sits in the application shell, and why.',
|
|
89
|
+
'brand-brief': 'How the product presents itself — name, logo direction and visual tone.',
|
|
90
|
+
'compliance-program': 'The controls this product commits to, and the authorities they answer.',
|
|
91
|
+
'compliance-document-candidate': 'Drafts of the public governed documents this product must publish.',
|
|
92
|
+
'document-publication': 'Which locales and jurisdictions each governed document publishes in.',
|
|
93
|
+
'document-release-policy': 'How each required document may be released — draft, attested, or reviewed.',
|
|
94
|
+
'document-facts': 'The accepted raw facts governed documents are built from.',
|
|
95
|
+
'document-facts-authored': 'The facts nobody can derive for you — the ones you decide or have reviewed.',
|
|
96
|
+
'processor-register': 'Every vendor that handles your users\' personal data, who they legally are, and where.',
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Which question each family answers — the axis the workbench groups its list by.
|
|
100
|
+
*
|
|
101
|
+
* Lives HERE, beside the authority it must stay exhaustive over, rather than beside the enum in
|
|
102
|
+
* `platform-core-shared`: that package cannot reach `@wildo-ai/application-creation-runtime`, so a
|
|
103
|
+
* map declared there could never be checked against the population it classifies. A companion test
|
|
104
|
+
* asserts every authority family has an entry, which is the only place both are in scope.
|
|
105
|
+
*/
|
|
106
|
+
const FAMILY_CONCERNS = {
|
|
107
|
+
'vision-brief': WorkbenchSpecificationArtifactConcern.INTENT,
|
|
108
|
+
'market-snapshot': WorkbenchSpecificationArtifactConcern.INTENT,
|
|
109
|
+
requirements: WorkbenchSpecificationArtifactConcern.SCOPE,
|
|
110
|
+
'feature-drafts': WorkbenchSpecificationArtifactConcern.SCOPE,
|
|
111
|
+
'business-model': WorkbenchSpecificationArtifactConcern.SCOPE,
|
|
112
|
+
roadmap: WorkbenchSpecificationArtifactConcern.DELIVERY,
|
|
113
|
+
/*
|
|
114
|
+
* `domain-plan` and `build-plan` are INCLUDED even though issues #160 and #163 build richer
|
|
115
|
+
* surfaces for them (a graph, a board). They are the same KIND of artifact as their neighbours —
|
|
116
|
+
* a landed, validated, reviewable family — and excluding them would mean hand-maintaining a
|
|
117
|
+
* subtraction from the authority's population, which is the list-that-restates-a-list shape that
|
|
118
|
+
* rots. The graph and the board are additional views of two families, not replacements for
|
|
119
|
+
* reading them.
|
|
120
|
+
*/
|
|
121
|
+
'domain-plan': WorkbenchSpecificationArtifactConcern.DELIVERY,
|
|
122
|
+
'build-plan': WorkbenchSpecificationArtifactConcern.DELIVERY,
|
|
123
|
+
'placement-plan': WorkbenchSpecificationArtifactConcern.DELIVERY,
|
|
124
|
+
'brand-brief': WorkbenchSpecificationArtifactConcern.IDENTITY,
|
|
125
|
+
'compliance-program': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
126
|
+
'compliance-document-candidate': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
127
|
+
'document-publication': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
128
|
+
'document-release-policy': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
129
|
+
'document-facts': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
130
|
+
'document-facts-authored': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
131
|
+
'processor-register': WorkbenchSpecificationArtifactConcern.OBLIGATIONS,
|
|
132
|
+
};
|
|
133
|
+
/** The companion records a landing writes beside a family's own `index.ts`. */
|
|
134
|
+
const DECISION_RECORD_FILE_NAME = 'DECISIONS.md';
|
|
135
|
+
const DIAGRAM_FILE_NAME = 'DIAGRAM.md';
|
|
136
|
+
function classifyFamily(family) {
|
|
137
|
+
return FAMILY_CONCERNS[family] ?? WorkbenchSpecificationArtifactConcern.UNCLASSIFIED;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Every playbook whose declared `outputs[].family` is `family`.
|
|
141
|
+
*
|
|
142
|
+
* The durable half of "what produced this": a fact about the compiled catalog, carried in git, true
|
|
143
|
+
* whether or not any run's state still exists. A link to the RUN that produced a particular value was
|
|
144
|
+
* deliberately not built — runs, traces and the write register are a per-run cache under
|
|
145
|
+
* `one-source-of-truth.md` rule 5, so a durable artifact pointing into deletable state is dangling by
|
|
146
|
+
* design. The link runs the other way: a run may name what it wrote.
|
|
147
|
+
*
|
|
148
|
+
* Built ONCE per derivation rather than per family: the catalog read is the same 21 files either way,
|
|
149
|
+
* and looping it fifteen times would multiply the only file I/O in this behavior by fifteen.
|
|
150
|
+
*/
|
|
151
|
+
function buildPlaybookRefsByFamily() {
|
|
152
|
+
const byFamily = new Map();
|
|
153
|
+
for (const entry of listFrameworkKnowledgePlaybooks()) {
|
|
154
|
+
const hydrated = getFrameworkKnowledgePlaybook(entry.ref);
|
|
155
|
+
const outputs = hydrated?.playbook?.outputs ?? [];
|
|
156
|
+
for (const output of outputs) {
|
|
157
|
+
if (typeof output?.family !== 'string' || output.family.length === 0)
|
|
158
|
+
continue;
|
|
159
|
+
const refs = byFamily.get(output.family) ?? [];
|
|
160
|
+
if (!refs.includes(entry.ref))
|
|
161
|
+
refs.push(entry.ref);
|
|
162
|
+
byFamily.set(output.family, refs);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return byFamily;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Read a markdown record committed beside a family, or `null`.
|
|
169
|
+
*
|
|
170
|
+
* `null` for an absent file is a FACT with a precise meaning, and the two files mean different things
|
|
171
|
+
* by their absence: no `DIAGRAM.md` means this family has no diagram renderer, while no
|
|
172
|
+
* `DECISIONS.md` means the run that produced it asked the creator nothing — never that no
|
|
173
|
+
* clarification happened. The row's JSDoc carries that distinction to the reader; here both are just
|
|
174
|
+
* a missing file.
|
|
175
|
+
*/
|
|
176
|
+
function readCommittedRecord(packageRoot, familyRelativePath, fileName) {
|
|
177
|
+
const path = join(packageRoot, dirname(familyRelativePath), fileName);
|
|
178
|
+
if (!existsSync(path))
|
|
179
|
+
return null;
|
|
180
|
+
try {
|
|
181
|
+
const content = readFileSync(path, 'utf8').trim();
|
|
182
|
+
return content.length > 0 ? content : null;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
/*
|
|
186
|
+
* A record that cannot be READ is reported as absent rather than failing the derivation. It is
|
|
187
|
+
* supporting provenance beside the artifact, not the artifact — refusing the whole page because
|
|
188
|
+
* one sibling file is unreadable would deny a reviewer the fifteen rows that are fine.
|
|
189
|
+
*/
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The validator's findings, rendered for a reader.
|
|
195
|
+
*
|
|
196
|
+
* Errors before warnings, because the two are different instructions: an error says this artifact no
|
|
197
|
+
* longer satisfies its own contract, a warning says its authoring has drifted. Only the counts reach
|
|
198
|
+
* the list; this is what a reviewer opens the row to read.
|
|
199
|
+
*/
|
|
200
|
+
function renderIssues(errorDetails, warnCount) {
|
|
201
|
+
if (errorDetails.length === 0 && warnCount === 0)
|
|
202
|
+
return null;
|
|
203
|
+
const lines = [];
|
|
204
|
+
if (errorDetails.length > 0) {
|
|
205
|
+
lines.push(`**${errorDetails.length} error${errorDetails.length === 1 ? '' : 's'}** — the artifact does not satisfy its own contract.`, '');
|
|
206
|
+
for (const detail of errorDetails)
|
|
207
|
+
lines.push(`- ${detail}`);
|
|
208
|
+
lines.push('');
|
|
209
|
+
}
|
|
210
|
+
if (warnCount > 0) {
|
|
211
|
+
lines.push(`**${warnCount} warning${warnCount === 1 ? '' : 's'}** — authoring drift the validator reports without invalidating the artifact.`, '', 'Warning detail is not carried here: the family validators return warnings alongside errors and', 'only the errors are projected as text today. Open the file to read them.');
|
|
212
|
+
}
|
|
213
|
+
return lines.join('\n').trim();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* One line saying HOW MUCH landed — counts and the artifact's own headline, never truncated prose.
|
|
217
|
+
*
|
|
218
|
+
* Read with plain optional access over the RAW value rather than through the family schemas: the
|
|
219
|
+
* pulse must survive an INVALID artifact (which the projection deliberately still serves), and a
|
|
220
|
+
* reader shown "3 ICPs" beside a red badge knows more than one shown nothing. A family this
|
|
221
|
+
* function does not know yields `null`, and the card simply carries no pulse — absence is honest
|
|
222
|
+
* for a sixteenth family until its line is written.
|
|
223
|
+
*/
|
|
224
|
+
function deriveContentPulse(family, snapshot) {
|
|
225
|
+
const count = (key) => (Array.isArray(snapshot[key]) ? snapshot[key].length : 0);
|
|
226
|
+
const text = (path) => {
|
|
227
|
+
let value = snapshot;
|
|
228
|
+
for (const key of path) {
|
|
229
|
+
if (!value || typeof value !== 'object')
|
|
230
|
+
return null;
|
|
231
|
+
value = value[key];
|
|
232
|
+
}
|
|
233
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
|
|
234
|
+
};
|
|
235
|
+
/*
|
|
236
|
+
* Each entry names its SINGULAR; the plural defaults to `+s` and is spelled out where English
|
|
237
|
+
* disagrees. "1 ICPs" on a live card is what bought this parameter.
|
|
238
|
+
*/
|
|
239
|
+
const parts = (entries) => {
|
|
240
|
+
const present = entries
|
|
241
|
+
.filter(([n]) => n > 0)
|
|
242
|
+
.map(([n, singular, plural]) => `${n} ${n === 1 ? singular : plural ?? `${singular}s`}`);
|
|
243
|
+
return present.length > 0 ? present.join(' · ') : null;
|
|
244
|
+
};
|
|
245
|
+
switch (family) {
|
|
246
|
+
case 'vision-brief':
|
|
247
|
+
return text(['idea', 'oneLiner']);
|
|
248
|
+
case 'market-snapshot':
|
|
249
|
+
return parts([[count('icps'), 'ICP'], [count('personas'), 'persona'], [count('positionings'), 'positioning'], [count('tonesOfVoice'), 'tone of voice', 'tones of voice']]);
|
|
250
|
+
case 'requirements':
|
|
251
|
+
return parts([[count('functional'), 'functional', 'functional'], [count('nonFunctional'), 'non-functional', 'non-functional']]);
|
|
252
|
+
case 'feature-drafts':
|
|
253
|
+
return parts([[count('drafts'), 'feature draft']]);
|
|
254
|
+
case 'business-model': {
|
|
255
|
+
const model = typeof snapshot.revenueModel === 'string' ? snapshot.revenueModel.toLowerCase().replace(/_/g, ' ') : null;
|
|
256
|
+
const plans = parts([[count('plans'), 'plan']]);
|
|
257
|
+
return model && plans ? `${model} · ${plans}` : model ?? plans;
|
|
258
|
+
}
|
|
259
|
+
case 'roadmap':
|
|
260
|
+
return parts([[count('phases'), 'phase']]);
|
|
261
|
+
case 'domain-plan':
|
|
262
|
+
return parts([[count('modules'), 'module'], [count('relationships'), 'relationship']]);
|
|
263
|
+
case 'build-plan':
|
|
264
|
+
return parts([[count('tasks'), 'task']]);
|
|
265
|
+
case 'placement-plan':
|
|
266
|
+
return parts([[count('groups'), 'group'], [count('decisions'), 'decision']]);
|
|
267
|
+
case 'brand-brief': {
|
|
268
|
+
const name = text(['name', 'brandName']);
|
|
269
|
+
const tagline = text(['name', 'tagline']);
|
|
270
|
+
return name ? (tagline ? `${name} — ${tagline}` : name) : null;
|
|
271
|
+
}
|
|
272
|
+
case 'compliance-program':
|
|
273
|
+
return parts([[count('roleAuthorities'), 'role authority', 'role authorities'], [count('capabilityAuthorities'), 'capability authority', 'capability authorities'], [count('implementationStatements'), 'implementation statement']]);
|
|
274
|
+
case 'compliance-document-candidate': {
|
|
275
|
+
const title = text(['title']);
|
|
276
|
+
const sections = parts([[count('sections'), 'section']]);
|
|
277
|
+
return title ? (sections ? `${title} · ${sections}` : title) : sections;
|
|
278
|
+
}
|
|
279
|
+
case 'document-publication':
|
|
280
|
+
return parts([[count('variants'), 'publication variant']]);
|
|
281
|
+
case 'document-release-policy':
|
|
282
|
+
return parts([[count('selections'), 'selection']]);
|
|
283
|
+
case 'document-facts':
|
|
284
|
+
case 'document-facts-authored':
|
|
285
|
+
return parts([[count('declarations'), 'declaration']]);
|
|
286
|
+
case 'processor-register':
|
|
287
|
+
return parts([[count('processors'), 'processor']]);
|
|
288
|
+
default:
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function projectFamily(input) {
|
|
293
|
+
const { binding, snapshot, packageRoot, appRelativePackagePrefix, playbookRefsByFamily } = input;
|
|
294
|
+
const familyRelativePath = getFamilyPackageRelativePath(binding.family);
|
|
295
|
+
const title = FAMILY_TITLES[binding.family] ?? binding.family;
|
|
296
|
+
const base = {
|
|
297
|
+
family: binding.family,
|
|
298
|
+
title,
|
|
299
|
+
/*
|
|
300
|
+
* The slug fallback keeps a sixteenth family SERVABLE before its sentence is authored — and the
|
|
301
|
+
* coverage pin beside the titles test is what turns that fallback into a red test naming the
|
|
302
|
+
* family, so it never quietly ships as a subtitle.
|
|
303
|
+
*/
|
|
304
|
+
description: FAMILY_DESCRIPTIONS[binding.family] ?? binding.family,
|
|
305
|
+
concern: classifyFamily(binding.family),
|
|
306
|
+
schemaRef: binding.schemaRef,
|
|
307
|
+
sourcePath: familyRelativePath ? `${appRelativePackagePrefix}/${familyRelativePath}` : null,
|
|
308
|
+
producedByPlaybookRefs: [...(playbookRefsByFamily.get(binding.family) ?? [])],
|
|
309
|
+
};
|
|
310
|
+
if (snapshot === undefined || snapshot === null) {
|
|
311
|
+
return {
|
|
312
|
+
...base,
|
|
313
|
+
state: WorkbenchSpecificationArtifactState.NOT_LANDED,
|
|
314
|
+
errorCount: 0,
|
|
315
|
+
warnCount: 0,
|
|
316
|
+
contentSummary: null,
|
|
317
|
+
content: null,
|
|
318
|
+
document: null,
|
|
319
|
+
issues: null,
|
|
320
|
+
decisionRecord: null,
|
|
321
|
+
diagram: null,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const validation = binding.validate(snapshot);
|
|
325
|
+
return {
|
|
326
|
+
...base,
|
|
327
|
+
state: validation.validation === JourneyArtifactValidationState.VALID
|
|
328
|
+
? WorkbenchSpecificationArtifactState.LANDED_VALID
|
|
329
|
+
: WorkbenchSpecificationArtifactState.LANDED_INVALID,
|
|
330
|
+
errorCount: validation.errorCount,
|
|
331
|
+
warnCount: validation.warnCount,
|
|
332
|
+
contentSummary: typeof snapshot === 'object' && !Array.isArray(snapshot)
|
|
333
|
+
? deriveContentPulse(binding.family, snapshot)
|
|
334
|
+
: null,
|
|
335
|
+
/*
|
|
336
|
+
* Both carried from the RAW snapshot, not from the validator's parsed output. The validator
|
|
337
|
+
* parses with the family schema, whose `.default()` members would inject values the author never
|
|
338
|
+
* wrote — a reviewer would then be shown, and could accept, content nobody authored. Mutation-
|
|
339
|
+
* proven on the `document` half (parsed-value render reddens the raw-value pin); `content`
|
|
340
|
+
* follows the same rule for the same reason.
|
|
341
|
+
*
|
|
342
|
+
* Every family binding's `snapshotSchema` is an object, so a landed snapshot is one; anything
|
|
343
|
+
* else is reported rather than smuggled through as a non-object the row schema would refuse.
|
|
344
|
+
*/
|
|
345
|
+
content: typeof snapshot === 'object' && !Array.isArray(snapshot) ? snapshot : null,
|
|
346
|
+
document: renderSpecificationFamilyReviewDocument({ title, value: snapshot }),
|
|
347
|
+
issues: renderIssues(validation.errorDetails, validation.warnCount),
|
|
348
|
+
decisionRecord: familyRelativePath
|
|
349
|
+
? readCommittedRecord(packageRoot, familyRelativePath, DECISION_RECORD_FILE_NAME)
|
|
350
|
+
: null,
|
|
351
|
+
diagram: familyRelativePath
|
|
352
|
+
? readCommittedRecord(packageRoot, familyRelativePath, DIAGRAM_FILE_NAME)
|
|
353
|
+
: null,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Project every application-specification family for a human reviewer.
|
|
358
|
+
*
|
|
359
|
+
* `packageRoot` is the specifications package's absolute root, and `appRelativePackagePrefix` its
|
|
360
|
+
* directory name relative to the application — so a row can name a path a reader recognizes
|
|
361
|
+
* (`specifications/src/vision/index.ts`) rather than one that only makes sense inside the package.
|
|
362
|
+
*/
|
|
363
|
+
export function projectSpecificationArtifacts(input) {
|
|
364
|
+
const companionExports = resolveSpecificationsCompanionExports(input.moduleExports);
|
|
365
|
+
const playbookRefsByFamily = buildPlaybookRefsByFamily();
|
|
366
|
+
const artifacts = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.map((binding) => projectFamily({
|
|
367
|
+
binding,
|
|
368
|
+
/*
|
|
369
|
+
* A family with no `companionExportsField` is a DRAFT — it is not accepted application truth
|
|
370
|
+
* and has no slot to read (`compliance-document-candidate`). It is reported as NOT_LANDED
|
|
371
|
+
* rather than skipped, for the same reason absent families are rows at all: an omitted row and
|
|
372
|
+
* a family that does not exist look identical to a reader.
|
|
373
|
+
*/
|
|
374
|
+
snapshot: binding.companionExportsField === undefined
|
|
375
|
+
? undefined
|
|
376
|
+
: companionExports[binding.companionExportsField],
|
|
377
|
+
packageRoot: input.packageRoot,
|
|
378
|
+
appRelativePackagePrefix: input.appRelativePackagePrefix,
|
|
379
|
+
playbookRefsByFamily,
|
|
380
|
+
}));
|
|
381
|
+
return {
|
|
382
|
+
artifacts,
|
|
383
|
+
trace: {
|
|
384
|
+
families: artifacts.length,
|
|
385
|
+
landed: artifacts.filter((artifact) => artifact.state !== WorkbenchSpecificationArtifactState.NOT_LANDED).length,
|
|
386
|
+
invalid: artifacts.filter((artifact) => artifact.state === WorkbenchSpecificationArtifactState.LANDED_INVALID).length,
|
|
387
|
+
evaluatedAt: input.evaluatedAt,
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=specification-artifacts.behavior.js.map
|