@wildo-ai/dev-companion 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +4 -12
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +0 -16
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +0 -17
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +0 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +2 -27
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +1 -8
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +9 -4
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +21 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +1 -39
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +1 -3
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +23 -36
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.js +0 -5
- package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +3 -82
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +4 -113
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +3 -82
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +54 -138
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +1 -27
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +5 -38
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +0 -25
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +0 -37
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +2 -7
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +30 -122
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js +0 -2
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +1 -3
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +1 -38
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +0 -36
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +0 -1
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +0 -75
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +0 -1
package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-plane-projection.companion.service.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/resources/creation-plane-projection.companion.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,sCAAsC,EACvC,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AACnH,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,+EAA+E,CAAC;AAC9I,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,gFAAgF,CAAC;AAC/I,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,yEAAyE,CAAC;AAwClI;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,+CAAyC,CAAC;AAEpF,qBACa,uCAAuC;IAiBhD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAErC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAtB5C,OAAO,CAAC,gBAAgB,CAAiF;IACzG,OAAO,CAAC,qBAAqB,CAAK;IAClC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB,CAAK;IAC7B,oGAAoG;IACpG,OAAO,CAAC,mBAAmB,CAA4D;gBAIpE,kBAAkB,EAAE,2BAA2B,EAE/C,oBAAoB,EAAE,wCAAwC,EAE9D,gBAAgB,EAAE,wCAAwC,EAE1D,yBAAyB,EAAE,kCAAkC;IAYzE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI5C;;;OAGG;IACI,qBAAqB,IAAI,IAAI;IAYvB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YAkB1E,6BAA6B;
|
|
1
|
+
{"version":3,"file":"creation-plane-projection.companion.service.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/resources/creation-plane-projection.companion.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,sCAAsC,EACvC,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AACnH,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,+EAA+E,CAAC;AAC9I,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,gFAAgF,CAAC;AAC/I,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,yEAAyE,CAAC;AAwClI;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,+CAAyC,CAAC;AAEpF,qBACa,uCAAuC;IAiBhD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAErC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAtB5C,OAAO,CAAC,gBAAgB,CAAiF;IACzG,OAAO,CAAC,qBAAqB,CAAK;IAClC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB,CAAK;IAC7B,oGAAoG;IACpG,OAAO,CAAC,mBAAmB,CAA4D;gBAIpE,kBAAkB,EAAE,2BAA2B,EAE/C,oBAAoB,EAAE,wCAAwC,EAE9D,gBAAgB,EAAE,wCAAwC,EAE1D,yBAAyB,EAAE,kCAAkC;IAYzE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI5C;;;OAGG;IACI,qBAAqB,IAAI,IAAI;IAYvB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YAkB1E,6BAA6B;YAgD7B,uBAAuB;YAUvB,wBAAwB;YA2CxB,sBAAsB;IAgBpC,OAAO,CAAC,eAAe;CAsBxB"}
|
package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js
CHANGED
|
@@ -134,14 +134,7 @@ let CreationPlaneProjectionCompanionService = class CreationPlaneProjectionCompa
|
|
|
134
134
|
const rows = this.stampIdentities(board.playbooks.map((playbook) => ({
|
|
135
135
|
playbookRef: playbook.playbookRef,
|
|
136
136
|
playbookVersion: playbook.playbookVersion,
|
|
137
|
-
|
|
138
|
-
* The PLAYBOOK's own taxonomy label, which is what the field's name implies and what the
|
|
139
|
-
* workbench renders per row. It carried `board.phase` — the APPLICATION-level derived phase —
|
|
140
|
-
* until 2026-09-04, so every row showed the same value and the row badge was describing
|
|
141
|
-
* something other than the row. The derived application phase no longer exists; this is the
|
|
142
|
-
* only phase there ever truthfully was.
|
|
143
|
-
*/
|
|
144
|
-
phase: String(playbook.phase),
|
|
137
|
+
phase: String(board.phase),
|
|
145
138
|
intent: playbook.intent,
|
|
146
139
|
eligible: playbook.eligible,
|
|
147
140
|
unmet: playbook.unmet,
|
package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-plane-projection.companion.service.js","sourceRoot":"","sources":["../../../../../../src/core/introspection/resources/creation-plane-projection.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,qCAAqC,EACrC,8BAA8B,EAC9B,sCAAsC,GACvC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,2GAA2G;AAC3G,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,sCAAsC,CAAC;AAG7E,IAAM,uCAAuC,GAA7C,MAAM,uCAAuC;IAiB/B;IAEA;IAEA;IAEA;IAtBX,gBAAgB,GAA4E,IAAI,CAAC;IACjG,qBAAqB,GAAG,CAAC,CAAC;IAClC;;;;;;;OAOG;IACK,gBAAgB,GAAG,CAAC,CAAC;IAC7B,oGAAoG;IAC5F,mBAAmB,GAAuD,IAAI,CAAC;IAEvF,YAEmB,kBAA+C,EAE/C,oBAA8D,EAE9D,gBAA0D,EAE1D,yBAA6D;QAN7D,uBAAkB,GAAlB,kBAAkB,CAA6B;QAE/C,yBAAoB,GAApB,oBAAoB,CAA0C;QAE9D,qBAAgB,GAAhB,gBAAgB,CAA0C;QAE1D,8BAAyB,GAAzB,yBAAyB,CAAoC;QAE9E;;;;;;WAMG;QACH,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACrF,CAAC;IAEM,QAAQ,CAAC,UAAkB;QAChC,OAAO,qCAAqC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACpE,CAA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,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,QAAQ,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;YACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;gBAC/C,MAAM,IAAI,KAAK,CACb,4BAA4B,QAAQ,mCAAmC,QAAQ,OAAO,GAAG,YAAY;sBACnG,aAAa,QAAQ,0EAA0E;sBAC/F,mCAAmC,CACtC,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACxB,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3NY,uCAAuC;IADnD,UAAU,EAAE;IAiBR,WAAA,MAAM,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAA;IAElD,WAAA,MAAM,CAAC,uBAAuB,CAAC,+BAA+B,CAAC,CAAA;IAE/D,WAAA,MAAM,CAAC,uBAAuB,CAAC,+BAA+B,CAAC,CAAA;IAE/D,WAAA,MAAM,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,CAAA;;GAtBjD,uCAAuC,CA2NnD","sourcesContent":["import { inject, injectable } from 'inversify';\nimport {\n WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS,\n WorkbenchCreationPlaneBehavior,\n sanitizeWorkbenchCreationPlaneIdentity,\n} from '@wildo-ai/platform-core-shared';\n\nimport { COMPANION_SERVICE_TYPES } from '../../inject/models/service-types';\nimport type { PlaybookRunCompanionService } from '../../../meta-workflows/services/playbook-run.companion.service';\nimport type { ApplicationBuildDispatchCompanionService } from '../../../meta-workflows/services/application-build-dispatch.companion.service';\nimport type { PlaybookRunWriteRegisterCompanionService } from '../../../meta-workflows/services/playbook-run-write-register.companion.service';\nimport type { ExecutionTraceReadCompanionService } from '../../../meta-workflows/services/execution-trace-read.companion.service';\n\n/**\n * The IN-PROCESS half of the companion's introspection source — the CREATION PLANE\n * (`workbench-creation-board-resources.md` Phase 2; the mechanism that decided issue #166).\n *\n * The four behaviors here project the companion's OWN runtime services: no subprocess, no app-dist\n * import, milliseconds per read — except the eligibility board, whose ~10-second recompute is\n * exactly why the CACHE below exists. The behavior-id vocabulary is owned by\n * `@wildo-ai/platform-core-shared` (`WorkbenchCreationPlaneBehavior`), the same package that writes\n * the ids into the resource bindings, so the two ends cannot drift.\n *\n * ## The eligibility cache (requirement R3 of the plan)\n *\n * Resource surfaces multiply the consumers of a LIST (RMM, embedded lists, label resolution), so\n * serving the raw recompute would make the board WORSE than the bespoke route it replaces. The\n * cache is `{rows, computedAt}` with a TTL, invalidated through the write register's mutation seam\n * (see the constructor) and by the explicit refresh route; Phase 3 adds operation-success\n * invalidation when dispatches become custom operations. `computedAt` is projected onto every row\n * so the board can render \"as of\".\n *\n * Rule-5 posture (`one-source-of-truth.md`): this is a per-run projection cache. Deleting it costs\n * one recompute, never truth, and nothing anywhere reads it as an acceptance.\n *\n * ## Identity sanitization, and why it is here\n *\n * The binding's `identityFields` composition refuses any value outside `[a-zA-Z0-9_-]`, and this\n * plane's business keys legitimately violate it: playbook refs carry dots (`top_down.phase-gate`),\n * trace session ids are `dev-<ISO-ish>` directory names. So each projection emits its identity\n * field itself — `.` becomes `__`, any other invalid character becomes `-` — and REFUSES on a\n * post-sanitization duplicate rather than serving two rows under one id (the same trade the\n * source's composed-identity stamping makes, for the same reason: READ returning an arbitrary row\n * is worse than a refusal).\n */\n\nconst ELIGIBILITY_CACHE_TTL_MS = 60_000;\n\n/** The trace index is bounded by the shared workbench page ceiling, not by the read route's default 50. */\nconst TRACE_SESSION_LIMIT = 1000;\n\n/**\n * Re-exported from the SHARED vocabulary (`@wildo-ai/platform-core-shared`), where the identity\n * rule moved once the frontend needed it too — an interrupted run's re-dispatch derives the row\n * address from its `playbookRef`. One named source; this alias keeps companion-side call sites\n * and pins stable.\n */\nexport const sanitizeCreationPlaneIdentity = sanitizeWorkbenchCreationPlaneIdentity;\n\n@injectable()\nexport class CreationPlaneProjectionCompanionService {\n private eligibilityCache: { rows: readonly Record<string, unknown>[]; computedAt: string } | null = null;\n private eligibilityCachedAtMs = 0;\n /**\n * Bumped by every {@link invalidateEligibility}. A recompute captures it BEFORE deriving and\n * refuses to populate the cache when it moved — without this, an invalidation that fires while\n * a recompute is in flight (a poll-started derivation straddling a dispatch's post-operation\n * invalidation) is silently cancelled out: the in-flight closure would repopulate the cache\n * with the PRE-mutation board for up to the TTL, which is the exact \"as of before your\n * dispatch\" answer this cache's contract forbids.\n */\n private eligibilityEpoch = 0;\n /** Concurrent LISTs during a cold recompute share ONE derivation instead of stacking ~10s reads. */\n private eligibilityInFlight: Promise<readonly Record<string, unknown>[]> | null = null;\n\n constructor(\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunService)\n private readonly playbookRunService: PlaybookRunCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService)\n private readonly buildDispatchService: ApplicationBuildDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService)\n private readonly runWriteRegister: PlaybookRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ExecutionTraceReadService)\n private readonly executionTraceReadService: ExecutionTraceReadCompanionService,\n ) {\n /*\n * A run landing files is exactly the event that changes playbook eligibility, and every run's\n * landing reports to the write register — so the register's mutation seam is the ONE hook that\n * covers playbook runs AND reverts without this service being wired into each dispatch handler\n * (the N-call-sites shape that drifts). What it does NOT cover — a coding-agent landing the\n * HUMAN commits in git — no hook can see, and the TTL is what bounds that staleness.\n */\n this.runWriteRegister.registerMutationListener(() => this.invalidateEligibility());\n }\n\n public supports(behaviorId: string): boolean {\n return WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS.includes(behaviorId);\n }\n\n /**\n * Drop the eligibility cache. Called after every creation-plane mutation — the board must not\n * answer \"as of before your dispatch\" to the person who just dispatched.\n */\n public invalidateEligibility(): void {\n this.eligibilityEpoch += 1;\n this.eligibilityCache = null;\n this.eligibilityCachedAtMs = 0;\n /*\n * Also drop the in-flight handle: a reader arriving AFTER the invalidation must start a fresh\n * derivation rather than join one computing the pre-mutation board. The orphaned computation\n * still completes for its own callers, and the epoch guard keeps it out of the cache.\n */\n this.eligibilityInFlight = null;\n }\n\n public async deriveRows(behaviorId: string): Promise<readonly Record<string, unknown>[]> {\n switch (behaviorId as WorkbenchCreationPlaneBehavior) {\n case WorkbenchCreationPlaneBehavior.PLAYBOOK_ELIGIBILITY:\n return this.derivePlaybookEligibilityRows();\n case WorkbenchCreationPlaneBehavior.BUILD_PLAN_TASKS:\n return this.deriveBuildPlanTaskRows();\n case WorkbenchCreationPlaneBehavior.RUN_WRITE_RECORDS:\n return this.deriveRunWriteRecordRows();\n case WorkbenchCreationPlaneBehavior.TRACE_SESSIONS:\n return this.deriveTraceSessionRows();\n default:\n throw new Error(\n `'${behaviorId}' is not a creation-plane behavior. The supported set is: `\n + `${WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS.join(', ')}.`,\n );\n }\n }\n\n private async derivePlaybookEligibilityRows(): Promise<readonly Record<string, unknown>[]> {\n const now = Date.now();\n if (this.eligibilityCache && now - this.eligibilityCachedAtMs < ELIGIBILITY_CACHE_TTL_MS) {\n return this.eligibilityCache.rows;\n }\n if (this.eligibilityInFlight) return this.eligibilityInFlight;\n\n const epochAtStart = this.eligibilityEpoch;\n const flight = (async () => {\n const board = await this.playbookRunService.listPlaybookEligibility();\n const computedAt = new Date().toISOString();\n const rows = this.stampIdentities(\n board.playbooks.map((playbook) => ({\n playbookRef: playbook.playbookRef,\n playbookVersion: playbook.playbookVersion,\n /*\n * The PLAYBOOK's own taxonomy label, which is what the field's name implies and what the\n * workbench renders per row. It carried `board.phase` — the APPLICATION-level derived phase —\n * until 2026-09-04, so every row showed the same value and the row badge was describing\n * something other than the row. The derived application phase no longer exists; this is the\n * only phase there ever truthfully was.\n */\n phase: String(playbook.phase),\n intent: playbook.intent,\n eligible: playbook.eligible,\n unmet: playbook.unmet,\n blockedOnlyBySequencing: playbook.blockedOnlyBySequencing,\n requiresElicitation: playbook.requiresElicitation,\n wouldReplace: playbook.wouldReplace,\n unlandableFamilies: playbook.unlandableFamilies,\n staleOutputs: playbook.staleOutputs,\n computedAt,\n })),\n 'workbenchPlaybookId',\n (row) => String(row.playbookRef),\n WorkbenchCreationPlaneBehavior.PLAYBOOK_ELIGIBILITY,\n );\n if (this.eligibilityEpoch === epochAtStart) {\n this.eligibilityCache = { rows, computedAt };\n this.eligibilityCachedAtMs = Date.now();\n }\n // An epoch that moved means something mutated mid-derivation: serve the computed rows to\n // THIS caller (they are at worst one mutation old, same as any read that finished a moment\n // earlier) but do not cache them — the next read recomputes against the post-mutation world.\n return rows;\n })();\n this.eligibilityInFlight = flight;\n try {\n return await flight;\n } finally {\n // Only clear OUR handle — an invalidation may have nulled it and a newer flight taken the slot.\n if (this.eligibilityInFlight === flight) this.eligibilityInFlight = null;\n }\n }\n\n private async deriveBuildPlanTaskRows(): Promise<readonly Record<string, unknown>[]> {\n const tasks = await this.buildDispatchService.describeBuildPlanBoard();\n return this.stampIdentities(\n tasks.map((task) => ({ ...task })),\n 'workbenchBuildPlanTaskId',\n (row) => String(row.taskRef),\n WorkbenchCreationPlaneBehavior.BUILD_PLAN_TASKS,\n );\n }\n\n private async deriveRunWriteRecordRows(): Promise<readonly Record<string, unknown>[]> {\n const records = await this.runWriteRegister.list();\n /*\n * The trace JOIN (Phase 4, R5): a runId is `<sessionId>-<playbookRef>-<ts>`, so the session is\n * resolved by longest-prefix match against the live session index. Listed ONCE per derivation\n * — a per-record listing would re-read the directory N times for one answer. NULL when nothing\n * matches: the register legitimately outlives its trace directory, and a dangling reference\n * would render as a broken link.\n *\n * Resolved against the UNBOUNDED id listing, not the display-limited summaries: the join is a\n * correctness question and must not lose links for records older than the newest\n * TRACE_SESSION_LIMIT sessions (completion-review finding 11a). The bound stays on the\n * trace-sessions ROWS below, where it is a display decision.\n */\n const sessionIdsLongestFirst = [...await this.executionTraceReadService.listSessionIds()]\n .sort((a, b) => b.length - a.length);\n return this.stampIdentities(\n records.map((record) => {\n const sessionId = sessionIdsLongestFirst.find((candidate) => record.runId.startsWith(`${candidate}-`));\n return {\n runId: record.runId,\n playbookRef: record.playbookRef,\n /*\n * The join keys, SANITIZED so values match the target rows' addressable ids — the same\n * identity rule every creation-plane row is addressed by.\n */\n workbenchPlaybookId: sanitizeWorkbenchCreationPlaneIdentity(record.playbookRef),\n workbenchTraceSessionId: sessionId ? sanitizeWorkbenchCreationPlaneIdentity(sessionId) : null,\n at: record.at,\n /*\n * Pre-image BYTES stay behind: `previousContent` belongs to the revert mechanism, and a\n * LIST carrying every pre-image would ship the working tree's history on every render.\n */\n files: record.files.map((file) => ({ path: file.path, existedBefore: file.existedBefore })),\n fileCount: record.files.length,\n };\n }),\n 'workbenchRunWriteRecordId',\n (row) => String(row.runId),\n WorkbenchCreationPlaneBehavior.RUN_WRITE_RECORDS,\n );\n }\n\n private async deriveTraceSessionRows(): Promise<readonly Record<string, unknown>[]> {\n const sessions = await this.executionTraceReadService.listSessions(TRACE_SESSION_LIMIT);\n return this.stampIdentities(\n sessions.map((session) => ({\n sessionId: session.sessionId,\n startedAt: session.startedAt,\n label: session.label,\n eventCount: session.eventCount,\n stepCount: session.stepCount,\n })),\n 'workbenchTraceSessionId',\n (row) => String(row.sessionId),\n WorkbenchCreationPlaneBehavior.TRACE_SESSIONS,\n );\n }\n\n private stampIdentities(\n rows: readonly Record<string, unknown>[],\n fieldIdentifier: string,\n businessKey: (row: Record<string, unknown>) => string,\n behavior: WorkbenchCreationPlaneBehavior,\n ): readonly Record<string, unknown>[] {\n const seen = new Map<string, string>();\n return rows.map((row) => {\n const raw = businessKey(row);\n const identity = sanitizeCreationPlaneIdentity(raw);\n const previous = seen.get(identity);\n if (previous !== undefined && previous !== raw) {\n throw new Error(\n `Creation-plane behavior '${behavior}' sanitized two distinct keys ('${previous}', '${raw}') to one `\n + `identity '${identity}'. Served, READ would return an arbitrary one of them; refused instead. `\n + 'Rename one of the colliding keys.',\n );\n }\n seen.set(identity, raw);\n return { ...row, [fieldIdentifier]: identity };\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"creation-plane-projection.companion.service.js","sourceRoot":"","sources":["../../../../../../src/core/introspection/resources/creation-plane-projection.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,qCAAqC,EACrC,8BAA8B,EAC9B,sCAAsC,GACvC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,2GAA2G;AAC3G,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,sCAAsC,CAAC;AAG7E,IAAM,uCAAuC,GAA7C,MAAM,uCAAuC;IAiB/B;IAEA;IAEA;IAEA;IAtBX,gBAAgB,GAA4E,IAAI,CAAC;IACjG,qBAAqB,GAAG,CAAC,CAAC;IAClC;;;;;;;OAOG;IACK,gBAAgB,GAAG,CAAC,CAAC;IAC7B,oGAAoG;IAC5F,mBAAmB,GAAuD,IAAI,CAAC;IAEvF,YAEmB,kBAA+C,EAE/C,oBAA8D,EAE9D,gBAA0D,EAE1D,yBAA6D;QAN7D,uBAAkB,GAAlB,kBAAkB,CAA6B;QA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M,CAAC,uBAAuB,CAAC,yBAAyB,CAAC,CAAA;;GAtBjD,uCAAuC,CAoNnD","sourcesContent":["import { inject, injectable } from 'inversify';\nimport {\n WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS,\n WorkbenchCreationPlaneBehavior,\n sanitizeWorkbenchCreationPlaneIdentity,\n} from '@wildo-ai/platform-core-shared';\n\nimport { COMPANION_SERVICE_TYPES } from '../../inject/models/service-types';\nimport type { PlaybookRunCompanionService } from '../../../meta-workflows/services/playbook-run.companion.service';\nimport type { ApplicationBuildDispatchCompanionService } from '../../../meta-workflows/services/application-build-dispatch.companion.service';\nimport type { PlaybookRunWriteRegisterCompanionService } from '../../../meta-workflows/services/playbook-run-write-register.companion.service';\nimport type { ExecutionTraceReadCompanionService } from '../../../meta-workflows/services/execution-trace-read.companion.service';\n\n/**\n * The IN-PROCESS half of the companion's introspection source — the CREATION PLANE\n * (`workbench-creation-board-resources.md` Phase 2; the mechanism that decided issue #166).\n *\n * The four behaviors here project the companion's OWN runtime services: no subprocess, no app-dist\n * import, milliseconds per read — except the eligibility board, whose ~10-second recompute is\n * exactly why the CACHE below exists. The behavior-id vocabulary is owned by\n * `@wildo-ai/platform-core-shared` (`WorkbenchCreationPlaneBehavior`), the same package that writes\n * the ids into the resource bindings, so the two ends cannot drift.\n *\n * ## The eligibility cache (requirement R3 of the plan)\n *\n * Resource surfaces multiply the consumers of a LIST (RMM, embedded lists, label resolution), so\n * serving the raw recompute would make the board WORSE than the bespoke route it replaces. The\n * cache is `{rows, computedAt}` with a TTL, invalidated through the write register's mutation seam\n * (see the constructor) and by the explicit refresh route; Phase 3 adds operation-success\n * invalidation when dispatches become custom operations. `computedAt` is projected onto every row\n * so the board can render \"as of\".\n *\n * Rule-5 posture (`one-source-of-truth.md`): this is a per-run projection cache. Deleting it costs\n * one recompute, never truth, and nothing anywhere reads it as an acceptance.\n *\n * ## Identity sanitization, and why it is here\n *\n * The binding's `identityFields` composition refuses any value outside `[a-zA-Z0-9_-]`, and this\n * plane's business keys legitimately violate it: playbook refs carry dots (`top_down.phase-gate`),\n * trace session ids are `dev-<ISO-ish>` directory names. So each projection emits its identity\n * field itself — `.` becomes `__`, any other invalid character becomes `-` — and REFUSES on a\n * post-sanitization duplicate rather than serving two rows under one id (the same trade the\n * source's composed-identity stamping makes, for the same reason: READ returning an arbitrary row\n * is worse than a refusal).\n */\n\nconst ELIGIBILITY_CACHE_TTL_MS = 60_000;\n\n/** The trace index is bounded by the shared workbench page ceiling, not by the read route's default 50. */\nconst TRACE_SESSION_LIMIT = 1000;\n\n/**\n * Re-exported from the SHARED vocabulary (`@wildo-ai/platform-core-shared`), where the identity\n * rule moved once the frontend needed it too — an interrupted run's re-dispatch derives the row\n * address from its `playbookRef`. One named source; this alias keeps companion-side call sites\n * and pins stable.\n */\nexport const sanitizeCreationPlaneIdentity = sanitizeWorkbenchCreationPlaneIdentity;\n\n@injectable()\nexport class CreationPlaneProjectionCompanionService {\n private eligibilityCache: { rows: readonly Record<string, unknown>[]; computedAt: string } | null = null;\n private eligibilityCachedAtMs = 0;\n /**\n * Bumped by every {@link invalidateEligibility}. A recompute captures it BEFORE deriving and\n * refuses to populate the cache when it moved — without this, an invalidation that fires while\n * a recompute is in flight (a poll-started derivation straddling a dispatch's post-operation\n * invalidation) is silently cancelled out: the in-flight closure would repopulate the cache\n * with the PRE-mutation board for up to the TTL, which is the exact \"as of before your\n * dispatch\" answer this cache's contract forbids.\n */\n private eligibilityEpoch = 0;\n /** Concurrent LISTs during a cold recompute share ONE derivation instead of stacking ~10s reads. */\n private eligibilityInFlight: Promise<readonly Record<string, unknown>[]> | null = null;\n\n constructor(\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunService)\n private readonly playbookRunService: PlaybookRunCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService)\n private readonly buildDispatchService: ApplicationBuildDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService)\n private readonly runWriteRegister: PlaybookRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ExecutionTraceReadService)\n private readonly executionTraceReadService: ExecutionTraceReadCompanionService,\n ) {\n /*\n * A run landing files is exactly the event that changes playbook eligibility, and every run's\n * landing reports to the write register — so the register's mutation seam is the ONE hook that\n * covers playbook runs AND reverts without this service being wired into each dispatch handler\n * (the N-call-sites shape that drifts). What it does NOT cover — a coding-agent landing the\n * HUMAN commits in git — no hook can see, and the TTL is what bounds that staleness.\n */\n this.runWriteRegister.registerMutationListener(() => this.invalidateEligibility());\n }\n\n public supports(behaviorId: string): boolean {\n return WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS.includes(behaviorId);\n }\n\n /**\n * Drop the eligibility cache. Called after every creation-plane mutation — the board must not\n * answer \"as of before your dispatch\" to the person who just dispatched.\n */\n public invalidateEligibility(): void {\n this.eligibilityEpoch += 1;\n this.eligibilityCache = null;\n this.eligibilityCachedAtMs = 0;\n /*\n * Also drop the in-flight handle: a reader arriving AFTER the invalidation must start a fresh\n * derivation rather than join one computing the pre-mutation board. The orphaned computation\n * still completes for its own callers, and the epoch guard keeps it out of the cache.\n */\n this.eligibilityInFlight = null;\n }\n\n public async deriveRows(behaviorId: string): Promise<readonly Record<string, unknown>[]> {\n switch (behaviorId as WorkbenchCreationPlaneBehavior) {\n case WorkbenchCreationPlaneBehavior.PLAYBOOK_ELIGIBILITY:\n return this.derivePlaybookEligibilityRows();\n case WorkbenchCreationPlaneBehavior.BUILD_PLAN_TASKS:\n return this.deriveBuildPlanTaskRows();\n case WorkbenchCreationPlaneBehavior.RUN_WRITE_RECORDS:\n return this.deriveRunWriteRecordRows();\n case WorkbenchCreationPlaneBehavior.TRACE_SESSIONS:\n return this.deriveTraceSessionRows();\n default:\n throw new Error(\n `'${behaviorId}' is not a creation-plane behavior. The supported set is: `\n + `${WORKBENCH_CREATION_PLANE_BEHAVIOR_IDS.join(', ')}.`,\n );\n }\n }\n\n private async derivePlaybookEligibilityRows(): Promise<readonly Record<string, unknown>[]> {\n const now = Date.now();\n if (this.eligibilityCache && now - this.eligibilityCachedAtMs < ELIGIBILITY_CACHE_TTL_MS) {\n return this.eligibilityCache.rows;\n }\n if (this.eligibilityInFlight) return this.eligibilityInFlight;\n\n const epochAtStart = this.eligibilityEpoch;\n const flight = (async () => {\n const board = await this.playbookRunService.listPlaybookEligibility();\n const computedAt = new Date().toISOString();\n const rows = this.stampIdentities(\n board.playbooks.map((playbook) => ({\n playbookRef: playbook.playbookRef,\n playbookVersion: playbook.playbookVersion,\n phase: String(board.phase),\n intent: playbook.intent,\n eligible: playbook.eligible,\n unmet: playbook.unmet,\n blockedOnlyBySequencing: playbook.blockedOnlyBySequencing,\n requiresElicitation: playbook.requiresElicitation,\n wouldReplace: playbook.wouldReplace,\n unlandableFamilies: playbook.unlandableFamilies,\n staleOutputs: playbook.staleOutputs,\n computedAt,\n })),\n 'workbenchPlaybookId',\n (row) => String(row.playbookRef),\n WorkbenchCreationPlaneBehavior.PLAYBOOK_ELIGIBILITY,\n );\n if (this.eligibilityEpoch === epochAtStart) {\n this.eligibilityCache = { rows, computedAt };\n this.eligibilityCachedAtMs = Date.now();\n }\n // An epoch that moved means something mutated mid-derivation: serve the computed rows to\n // THIS caller (they are at worst one mutation old, same as any read that finished a moment\n // earlier) but do not cache them — the next read recomputes against the post-mutation world.\n return rows;\n })();\n this.eligibilityInFlight = flight;\n try {\n return await flight;\n } finally {\n // Only clear OUR handle — an invalidation may have nulled it and a newer flight taken the slot.\n if (this.eligibilityInFlight === flight) this.eligibilityInFlight = null;\n }\n }\n\n private async deriveBuildPlanTaskRows(): Promise<readonly Record<string, unknown>[]> {\n const tasks = await this.buildDispatchService.describeBuildPlanBoard();\n return this.stampIdentities(\n tasks.map((task) => ({ ...task })),\n 'workbenchBuildPlanTaskId',\n (row) => String(row.taskRef),\n WorkbenchCreationPlaneBehavior.BUILD_PLAN_TASKS,\n );\n }\n\n private async deriveRunWriteRecordRows(): Promise<readonly Record<string, unknown>[]> {\n const records = await this.runWriteRegister.list();\n /*\n * The trace JOIN (Phase 4, R5): a runId is `<sessionId>-<playbookRef>-<ts>`, so the session is\n * resolved by longest-prefix match against the live session index. Listed ONCE per derivation\n * — a per-record listing would re-read the directory N times for one answer. NULL when nothing\n * matches: the register legitimately outlives its trace directory, and a dangling reference\n * would render as a broken link.\n *\n * Resolved against the UNBOUNDED id listing, not the display-limited summaries: the join is a\n * correctness question and must not lose links for records older than the newest\n * TRACE_SESSION_LIMIT sessions (completion-review finding 11a). The bound stays on the\n * trace-sessions ROWS below, where it is a display decision.\n */\n const sessionIdsLongestFirst = [...await this.executionTraceReadService.listSessionIds()]\n .sort((a, b) => b.length - a.length);\n return this.stampIdentities(\n records.map((record) => {\n const sessionId = sessionIdsLongestFirst.find((candidate) => record.runId.startsWith(`${candidate}-`));\n return {\n runId: record.runId,\n playbookRef: record.playbookRef,\n /*\n * The join keys, SANITIZED so values match the target rows' addressable ids — the same\n * identity rule every creation-plane row is addressed by.\n */\n workbenchPlaybookId: sanitizeWorkbenchCreationPlaneIdentity(record.playbookRef),\n workbenchTraceSessionId: sessionId ? sanitizeWorkbenchCreationPlaneIdentity(sessionId) : null,\n at: record.at,\n /*\n * Pre-image BYTES stay behind: `previousContent` belongs to the revert mechanism, and a\n * LIST carrying every pre-image would ship the working tree's history on every render.\n */\n files: record.files.map((file) => ({ path: file.path, existedBefore: file.existedBefore })),\n fileCount: record.files.length,\n };\n }),\n 'workbenchRunWriteRecordId',\n (row) => String(row.runId),\n WorkbenchCreationPlaneBehavior.RUN_WRITE_RECORDS,\n );\n }\n\n private async deriveTraceSessionRows(): Promise<readonly Record<string, unknown>[]> {\n const sessions = await this.executionTraceReadService.listSessions(TRACE_SESSION_LIMIT);\n return this.stampIdentities(\n sessions.map((session) => ({\n sessionId: session.sessionId,\n startedAt: session.startedAt,\n label: session.label,\n eventCount: session.eventCount,\n stepCount: session.stepCount,\n })),\n 'workbenchTraceSessionId',\n (row) => String(row.sessionId),\n WorkbenchCreationPlaneBehavior.TRACE_SESSIONS,\n );\n }\n\n private stampIdentities(\n rows: readonly Record<string, unknown>[],\n fieldIdentifier: string,\n businessKey: (row: Record<string, unknown>) => string,\n behavior: WorkbenchCreationPlaneBehavior,\n ): readonly Record<string, unknown>[] {\n const seen = new Map<string, string>();\n return rows.map((row) => {\n const raw = businessKey(row);\n const identity = sanitizeCreationPlaneIdentity(raw);\n const previous = seen.get(identity);\n if (previous !== undefined && previous !== raw) {\n throw new Error(\n `Creation-plane behavior '${behavior}' sanitized two distinct keys ('${previous}', '${raw}') to one `\n + `identity '${identity}'. Served, READ would return an arbitrary one of them; refused instead. `\n + 'Rename one of the colliding keys.',\n );\n }\n seen.set(identity, raw);\n return { ...row, [fieldIdentifier]: identity };\n });\n }\n}\n"]}
|
|
@@ -73,7 +73,7 @@ export interface DomainModelProjectionInput {
|
|
|
73
73
|
resourceOperationsByResourceType: Record<string, readonly DomainModelOperationRow[]>;
|
|
74
74
|
/** The behavioural configuration of each resource, keyed by resource type. */
|
|
75
75
|
resourceAdvancedByResourceType: Record<string, Record<string, unknown>>;
|
|
76
|
-
/** The `frontend.views` operation refs the
|
|
76
|
+
/** The `frontend.views` operation refs the specification declares, keyed by resource type. */
|
|
77
77
|
resourceViewRefsByResourceType: Record<string, readonly string[]>;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
@@ -284,7 +284,10 @@ export interface DomainModelResourceRow {
|
|
|
284
284
|
* enrichment: a name answers "does this field exist", which the node already implies by counting
|
|
285
285
|
* them, and nothing else. A reader opening a resource wants what the field IS — its type, whether
|
|
286
286
|
* it is optional, whether it is a key, an index, a foreign key and to what, what personal-data
|
|
287
|
-
* category it carries, and whatever the
|
|
287
|
+
* category it carries, and whatever the specification says it MEANS.
|
|
288
|
+
*
|
|
289
|
+
* spec-cite: N/A — "the specification" here is Wildo's OWN `*.resource.specification.ts` layer, not an external standard, and the quoted
|
|
290
|
+
* fragments are questions this panel answers rather than any document's words.
|
|
288
291
|
*
|
|
289
292
|
* The entries are `ExtractedFieldSpec` from `@wildo-ai/saas-specifications`, produced by the same
|
|
290
293
|
* extractor the `resource-specifications` behavior uses — not a second reading of the same
|
|
@@ -306,7 +309,9 @@ export interface DomainModelResourceRow {
|
|
|
306
309
|
*/
|
|
307
310
|
operations: DomainModelOperationRow[];
|
|
308
311
|
/**
|
|
309
|
-
* The per-operation FRONTEND overlay refs the
|
|
312
|
+
* The per-operation FRONTEND overlay refs the specification declares — `frontend.views`.
|
|
313
|
+
*
|
|
314
|
+
* spec-cite: N/A — "the specification" is Wildo's own specification layer; the quoted fragment is the question this field answers.
|
|
310
315
|
*
|
|
311
316
|
* Keys only. The entries themselves are authoring prose about how an operation surfaces, which
|
|
312
317
|
* belongs to the specification reader rather than to a domain-model panel; what this answers is
|
|
@@ -329,7 +334,7 @@ export interface DomainModelResourceRow {
|
|
|
329
334
|
/**
|
|
330
335
|
* Which part of its owner this resource belongs to — the SECOND grouping axis, under the module.
|
|
331
336
|
*
|
|
332
|
-
* `null` means the
|
|
337
|
+
* `null` means the specification declares none, which is what an application's own resources
|
|
333
338
|
* normally look like today and what an engine resource with no spec at all looks like (one, at the
|
|
334
339
|
* time of writing: `consumableTokens`). A consumer grouping by this must carry an "unclassified"
|
|
335
340
|
* bucket and say so; folding those rows into a real group is how a grouping starts lying.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-domain-model.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/application-domain-model.behavior.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,4BAA4B;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,0BAA0B;IACzC,mEAAmE;IACnE,aAAa,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACjD,qDAAqD;IACrD,qBAAqB,EAAE,SAAS,4BAA4B,EAAE,CAAC;IAC/D,kGAAkG;IAClG,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,GAAG,SAAS,CAAC;IACjF,2FAA2F;IAC3F,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAAC;IAC7E,gFAAgF;IAChF,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAC,CAAC;IACrF,8EAA8E;IAC9E,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,
|
|
1
|
+
{"version":3,"file":"application-domain-model.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/application-domain-model.behavior.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpF;;;;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G,IAAI,CAAC;IAC7B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,yBAAyB;AACzB,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B;;;;;;;;OAQG;IACH,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC;;;;;;;;OAQG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oFAAoF;IACpF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sGAAsG;IACtG,6FAA6F;IAC7F,aAAa,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAClD,wEAAwE;IACxE,aAAa,EAAE,0BAA0B,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,sBAAsB,EAAE,CAAC;CAC3C;AAkED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,0BAA0B,GAChC,qBAAqB,CAmGvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-domain-model.behavior.js","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/application-domain-model.behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,uBAAuB,CAAC;AA4WjF,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAE5C,SAAS,oBAAoB,CAAC,YAA0C;IACtE,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,mCAAmC,CAAC;QAC7F,aAAa,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C,CAAC;YACjC,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO;QACL,eAAe,EAAE;YACf,GAAG,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC1C,GAAG,CAAC,GAAG,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACnD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { Resources_SharedUtils, type ResourceType } from '@wildo-ai/saas-models';\nimport type { AnyResourceSpecificationConfig } from '@wildo-ai/saas-specifications';\n\n/**\n * **application-domain-model** — the observed application's domain model as ONE projection:\n * every resource, the module that owns it, the relationships it participates in, and the prose of\n * its specification.\n *\n * ## Why this exists beside two behaviors that already answer half of it each\n *\n * The workbench used to draw its structure from two behaviors — `resource-specifications` for\n * module→resource ownership merged with the specification overlay, and `resources-registry` for the\n * compiled relationship edges. Each spawns its own subprocess importing the application's module\n * graph from TypeScript SOURCE, so a graph assembled from both is assembled from **two reads of a\n * mutating working tree**: the nodes can come from one state of the application and the edges from\n * the next. Nothing detects that, and the result is a picture of an application that never existed.\n *\n * So this is not a convenience wrapper over the other two. It is the only shape in which \"resources,\n * their relationships and their module membership\" is internally consistent. It also happens to cost\n * one derivation instead of two, which is the smaller of the two reasons.\n *\n * The two existing behaviors are untouched: they answer different questions (a full field-spec\n * projection, a full registry snapshot with the FK-resolution sweep) for consumers that are not this\n * one.\n *\n * ## What is projected, and what deliberately is not\n *\n * The specification's PROSE — `purpose`, `businessRole`, `lifecycleRole`, `businessConstraints` —\n * plus each resource's field NAMES. Not `operations`, `frontend`, `codeHandling` or the extracted\n * per-field specs: those are large, they are what makes `resource-specifications` expensive, and a\n * domain-model panel reads none of them. Stated rather than left implicit so the next reader does not\n * mistake the omission for an oversight; a consumer that needs them asks `resource-specifications`,\n * which is exactly what it is for.\n */\n\n/**\n * The relationship shape this projection reads.\n *\n * Structural rather than `ResourceRelationship`, because the rows cross a subprocess boundary from\n * the OBSERVED application's registry, which may have been built against a different engine revision\n * than the companion. Binding the engine type here would make a relationship the observed\n * application can legitimately declare unreadable — the same reasoning\n * the workbench's own relationship schema gives for keeping its vocabularies as plain strings.\n */\nexport interface DomainModelRelationshipInput {\n resourceType1: string;\n resourceType2: string;\n cardinality1: string;\n cardinality2: string;\n nature: string;\n foreignKeyField?: string;\n jointResourceType?: string;\n isPrimaryScope?: boolean;\n accessScopeStrategy?: string;\n parentResourceRequirement?: string;\n primaryScope?: string;\n allowCycle?: boolean;\n isDisabled?: boolean;\n}\n\n/** One of the observed application's shared modules, as `loadSharedModules()` answers it. */\nexport interface DomainModelModuleInput {\n moduleId: string;\n kind?: string;\n resourceConfigurations?: Record<string, unknown>;\n}\n\nexport interface DomainModelProjectionInput {\n /** The application's own shared modules, in registration order. */\n sharedModules: readonly DomainModelModuleInput[];\n /** The application's compiled relationship edges. */\n resourceRelationships: readonly DomainModelRelationshipInput[];\n /** The merged specification overlay, keyed by resource type. Absent when the app exports none. */\n specificationOverlay: Record<string, AnyResourceSpecificationConfig> | undefined;\n /** Everything the framework knows about each resource's fields, keyed by resource type. */\n resourceFieldsByResourceType: Record<string, readonly DomainModelFieldRow[]>;\n /** Every declared operation, projected for a reader, keyed by resource type. */\n resourceOperationsByResourceType: Record<string, readonly DomainModelOperationRow[]>;\n /** The behavioural configuration of each resource, keyed by resource type. */\n resourceAdvancedByResourceType: Record<string, Record<string, unknown>>;\n /** The `frontend.views` operation refs the resource specification declares, keyed by resource type. */\n resourceViewRefsByResourceType: Record<string, readonly string[]>;\n}\n\n/**\n * ONE FIELD, as the extractor answers it.\n *\n * A structural mirror of `ExtractedFieldSpec` rather than the imported type, for the reason the\n * relationship rows are structural: these cross a subprocess boundary as JSON, and a type whose\n * shape is owned elsewhere would let a change there alter this contract silently.\n */\nexport interface DomainModelFieldRow {\n fieldName: string;\n /** Which `{primitive}Spec()` decorator carried the authored prose, when one did. */\n specDecorator: string | null;\n /** The authored spec params — `meaning`, `whyItMatters`, `importance`, enum values, … */\n params: Record<string, unknown> | null;\n /**\n * The field's DECORATOR metadata, exactly as the schema declares it.\n *\n * `derived` is the extractor's INTERPRETATION — kind, primitive, foreign-key target. This is the\n * raw record beside it, and it carries what the interpretation does not: `isSummaryField`,\n * `isHidden`, `excludeFromCreate` / `excludeFromUpdate`, `dataCategories`, `isDBIndexed`,\n * `isUnique`, `isPrimaryKey`, and whatever a decorator adds tomorrow.\n *\n * OPAQUE for the reason `advanced` is: the set is open, and a projection that picked keys out of it\n * would report the subset its author knew about.\n *\n * What it does NOT contain, measured rather than assumed: anything from a `*.ui-behavior.tsx`. Those\n * decorators are applied by a FRONTEND module the companion never loads — the subprocess resolves\n * `library`, `specifications` and `service` targets and there is no frontend one — so on engine\n * resources this record holds structural decorators only. That is a reachability limit, not an\n * omission here.\n */\n metadata: Record<string, unknown> | null;\n /** What the framework DERIVED about the field: kind, primitive, optionality, FK target, … */\n derived: Record<string, unknown> | null;\n /** Base schema, or a variant of it — and which variant. */\n origin: Record<string, unknown> | null;\n}\n\n/** ONE OPERATION, projected to what changes its behaviour — never its DTOs. */\nexport interface DomainModelOperationRow {\n /** The operation's own identifier — a core verb or a custom one. */\n operationIdentifier: string;\n /** The operation's TRANSPORT kind: `api_call`, `internal_call`, `repository_only`, … */\n variantType: string | null;\n /**\n * WHICH variant of that transport this row is — `admin`, `summary`, `context`, … — or `null` for\n * the unnamed default.\n *\n * The missing half of an operation's identity, and its absence was a real defect rather than\n * missing detail. `organizations` declares FOUR operations that are all `read` × `api_call`,\n * separated only by this key; measured across the engine's core map, 133 of 794 operations collided\n * on the pair without it. The panel keyed its rows on the colliding pair, so React saw duplicate\n * keys and one accordion row stood for several distinct operations.\n */\n variantKey: string | null;\n /** For a CUSTOM operation, the core verb it behaves like. `null` for a core operation. */\n resourceOperationLike: string | null;\n /** Whether this variant is the one an unqualified call resolves to. */\n isDefault: boolean;\n /** The roles admitted. An EMPTY array is a real answer: no role gate on this variant. */\n roles: string[];\n riskLevel: string | null;\n /** Declared but not implemented — the operation answers, and says it is a placeholder. */\n isUnimplemented: boolean;\n isDisabled: boolean;\n requiresStepUpAuthentication: boolean;\n admitsCrossTenantPlatformAdministration: boolean;\n /** Whether the operation emits an auditable event, and which. */\n auditableEventType: string | null;\n /** Whether the operation is exposed over MCP. */\n isMcpExposed: boolean;\n /** Feature flags that must be on for the operation to exist at all. */\n requiredFeatures: string[];\n /**\n * Everything ELSE the materialized operation declares — the HTTP verb, the runtime mode, bulk and\n * API-key posture, notification fan-out, custom-implementation modes, authoritative fields.\n *\n * A deny list over the operation's own keys, for the third time in this projection and for the same\n * reason each time: an allow list reports the subset its author knew about, and this one proved it\n * — a hand-picked set of twelve fields was shipped and `variantKey`, `httpVerb`, `isBulkOperation`\n * and `serviceRuntimeMode` were all absent from it, which is what \"there are lots of information\n * missing\" was.\n *\n * The six DTO schemas are excluded by name. Each serializes to tens of kilobytes, and together they\n * would put megabytes on the wire to say which verbs exist.\n */\n attributes: Record<string, unknown>;\n /**\n * The authored SPECIFICATION for this operation, when the resource's spec describes it.\n *\n * Keyed by `operationIdentifier`, so every variant of one verb carries the same entry — the spec\n * describes the operation, and its per-variant prose lives inside that entry rather than beside it.\n * `null` means the specification does not mention this operation, which is a gap a reader can act\n * on rather than an absence of data.\n */\n specification: Record<string, unknown> | null;\n /** The authored FRONTEND view overlay for this operation (`frontend.views`), when there is one. */\n view: Record<string, unknown> | null;\n}\n\n/** One relationship, as it rides on BOTH resources it joins. */\nexport interface DomainModelRelationshipRow {\n /**\n * Stable identity for ONE edge, composed from every field this projection carries about it.\n *\n * Composed from the whole tuple rather than from `resourceType1 + resourceType2 +\n * foreignKeyField` — the triple the retired `workbenchResourceRelationships` resource addressed a\n * row by — because the discriminating field is not always present: a MANY-to-MANY edge carries\n * `jointResourceType` and no `foreignKeyField`, so that triple is not total here.\n *\n * The consequence is deliberate and worth stating: two edges that agree on every one of these\n * fields are indistinguishable to a graph, so merging them loses nothing a reader could have seen.\n * Two that differ anywhere get distinct ids and both are drawn. This id is internal to the\n * projection and its consumer — it never becomes a URL path parameter — so it is not held to the\n * URL-safe charset an addressable introspection key must satisfy.\n */\n relationshipId: string;\n resourceType1: string;\n resourceType2: string;\n cardinality1: string;\n cardinality2: string;\n /**\n * `composition`, `reference` or `association` — the observed application's vocabulary, and a plain\n * string precisely so a FOURTH value it may legitimately declare is projected rather than refused.\n *\n * Those three are all `RelationshipNature` declares today. Naming a value that does not exist would\n * be worse than naming none: a reader would conclude such an edge falls into the consumer's\n * unrecognised-nature bucket and hunt a defect that cannot occur.\n */\n nature: string;\n foreignKeyField: string | null;\n /**\n * Which side's rows CARRY the foreign key — the direction an arrow must point.\n *\n * Resolved by {@link Resources_SharedUtils.resolveForeignKeyHolderResourceType}, never from\n * declaration order. `resourceType1` is not reliably the referenced side: a child-first\n * declaration such as `(TODOS, USERS, MANY, ONE, { foreignKeyField: 'assignedToUserId' })` is\n * valid and puts the referenced resource in `resourceType2`. Reading position instead of\n * cardinality is the defect that once materialized required FK columns onto the wrong collection.\n */\n foreignKeyHolderResourceType: string;\n /** The junction resource of a MANY-to-MANY, which the framework requires such an edge to name. */\n jointResourceType: string | null;\n /** Whether this edge is the structural ownership anchor that gives `resourceType2` its scope. */\n isPrimaryScope: boolean;\n /**\n * Whether the edge is DECLARED BUT INACTIVE.\n *\n * Load-bearing rather than completeness: an edge the application has disabled does not constrain\n * anything at runtime, and a graph that draws it identically to a live one tells its reader the\n * application has a relationship it does not have. That is the one field here whose absence made\n * the picture WRONG rather than merely thinner, which is why it travels even though the dogfood\n * application currently disables none (measured 2026-08-31: 0 of 16).\n */\n isDisabled: boolean;\n /**\n * How a caller reaches rows on the far side — `requires_context`, `standalone`, and whatever else\n * the observed application's engine revision declares.\n *\n * A plain string for the same reason `nature` is one: this projection describes an application\n * that may have been built against a different engine revision than the companion reading it.\n */\n accessScopeStrategy: string | null;\n /** Whether the parent endpoint is `mandatory` or `optional` for the child's addressing. */\n parentResourceRequirement: string | null;\n /**\n * The resource this edge anchors scope to, when it is a primary-scope edge.\n *\n * Distinct from {@link isPrimaryScope}, which says only THAT it anchors: this names WHICH resource\n * the scope resolves to, and the two are not derivable from one another on an edge whose endpoints\n * are both scoped.\n */\n primaryScope: string | null;\n /** Whether a cycle through this edge is permitted — a graph-shape fact a graph should be able to show. */\n allowCycle: boolean;\n}\n\n/** The specification's prose, for the panel a selected node opens. */\nexport interface DomainModelSpecificationRow {\n purpose: string;\n businessRole: string;\n lifecycleRole: string | null;\n businessConstraints: string[];\n}\n\n/** One resource node. */\nexport interface DomainModelResourceRow {\n resourceType: string;\n /**\n * The module that registers this resource, or `null`.\n *\n * `null` is not a gap — it is the fact that no module of the OBSERVED APPLICATION owns this\n * resource, which is true of every ENGINE resource. All of them are emitted, because an application\n * does not merge two of them: `initializeResources` applies the engine's core factory map\n * unconditionally, so `files`, `apiKeys` and the rest are as registered in the running application\n * as the ones it declares itself.\n *\n * Two SHAPES of engine row arrive, and the consumer separates them without help: one whose\n * relationships reach a resource that HAS a module (`organizations`, `users` — the scope anchors,\n * the most load-bearing edges in the graph), and one whose relationships reach only other engine\n * resources. That distinction is derivable from the rows, so no field states it.\n *\n * No `origin` vocabulary is introduced for this. The absence of a module IS the distinction, and a\n * second field restating it is a second thing that can disagree.\n */\n moduleId: string | null;\n /**\n * Every field of the materialized `mainSchema`, with everything the framework knows about it.\n *\n * This replaced a bare `fieldNames: string[]`, and the replacement is the point rather than an\n * enrichment: a name answers \"does this field exist\", which the node already implies by counting\n * them, and nothing else. A reader opening a resource wants what the field IS — its type, whether\n * it is optional, whether it is a key, an index, a foreign key and to what, what personal-data\n * category it carries, and whatever the resource specification says it MEANS.\n *\n * The entries are `ExtractedFieldSpec` from `@wildo-ai/saas-specifications`, produced by the same\n * extractor the `resource-specifications` behavior uses — not a second reading of the same\n * decorators. `params` carries the authored spec prose, `derived` the structural facts the\n * framework computed, `origin` whether the field comes from the base schema or a variant.\n *\n * Structural rather than the imported type, for the reason the relationship rows are: these cross a\n * subprocess boundary as JSON.\n */\n fields: DomainModelFieldRow[];\n /**\n * Every operation the resource configuration declares, projected to what a READER needs.\n *\n * A materialized operation carries its full request, response, summary, context, internal and\n * repository DTOs — six Zod schemas, each of which serializes to tens of kilobytes. Projecting the\n * operation objects wholesale would put megabytes on the wire to say which verbs exist; this\n * carries the identity, the variant, the authorization and the flags that change what the operation\n * DOES, and nothing that is a schema.\n */\n operations: DomainModelOperationRow[];\n /**\n * The per-operation FRONTEND overlay refs the resource specification declares — `frontend.views`.\n *\n * Keys only. The entries themselves are authoring prose about how an operation surfaces, which\n * belongs to the specification reader rather than to a domain-model panel; what this answers is\n * \"which of this resource's operations have an authored view\", which is a gap a reader can act on.\n */\n viewRefs: string[];\n /**\n * The configuration facts that are neither prose nor structure — persistence, policy, bindings.\n *\n * Everything on a `ResourceConfiguration` that decides how the resource BEHAVES rather than what it\n * holds: which database it lives in, whether it is a system resource, its retention, transposition,\n * portability and data-subject policies, its HTTP and introspection bindings.\n *\n * Carried as an OPAQUE record rather than a typed shape, and that is deliberate. The set is open —\n * `ResourceConfiguration` has grown four of these fields in as many months — and a hand-written\n * projection reports the subset its author knew about, so a policy added tomorrow would be\n * invisible here with nothing to say so. Reading the keys means it appears by itself.\n */\n advanced: Record<string, unknown>;\n /**\n * Which part of its owner this resource belongs to — the SECOND grouping axis, under the module.\n *\n * `null` means the resource specification declares none, which is what an application's own resources\n * normally look like today and what an engine resource with no spec at all looks like (one, at the\n * time of writing: `consumableTokens`). A consumer grouping by this must carry an \"unclassified\"\n * bucket and say so; folding those rows into a real group is how a grouping starts lying.\n *\n * Carried on the ROW rather than inside `specification`, because that object is authoring PROSE a\n * reader reads and this is a key a consumer groups by. Nesting it there would make every grouped\n * surface reach through a nullable prose block to find its grouping key.\n */\n subDomain: string | null;\n /** `domain` / `engine` — the kind the owning module declares, when there is one. */\n moduleKind: string | null;\n /** Field names of the materialized `mainSchema`. Empty when the factory could not be materialized. */\n /** The specification's prose, or `null` when this resource has no authored specification. */\n specification: DomainModelSpecificationRow | null;\n /** Every relationship this resource participates in, on either side. */\n relationships: DomainModelRelationshipRow[];\n}\n\nexport interface DomainModelProjection {\n domainResources: DomainModelResourceRow[];\n}\n\nconst RELATIONSHIP_IDENTITY_SEPARATOR = '|';\n\nfunction buildRelationshipRow(relationship: DomainModelRelationshipInput): DomainModelRelationshipRow {\n const foreignKeyHolderResourceType = Resources_SharedUtils.resolveForeignKeyHolderResourceType({\n resourceType1: relationship.resourceType1 as ResourceType,\n resourceType2: relationship.resourceType2 as ResourceType,\n cardinality1: relationship.cardinality1 as never,\n cardinality2: relationship.cardinality2 as never,\n });\n\n return {\n relationshipId: [\n relationship.resourceType1,\n relationship.resourceType2,\n relationship.cardinality1,\n relationship.cardinality2,\n relationship.nature,\n relationship.foreignKeyField ?? '',\n relationship.jointResourceType ?? '',\n /*\n * The five fields added 2026-08-31 are in the identity for the reason the doc above gives:\n * two edges that differ ANYWHERE a reader can see must get distinct ids and both be drawn.\n * `isDisabled` is the one that makes this more than bookkeeping — an active and a disabled\n * edge between the same two resources render differently, so collapsing them to one id would\n * silently drop whichever came second.\n */\n relationship.accessScopeStrategy ?? '',\n relationship.parentResourceRequirement ?? '',\n relationship.primaryScope ?? '',\n relationship.allowCycle === true ? 'cycle' : '',\n relationship.isDisabled === true ? 'disabled' : '',\n ].join(RELATIONSHIP_IDENTITY_SEPARATOR),\n resourceType1: relationship.resourceType1,\n resourceType2: relationship.resourceType2,\n cardinality1: relationship.cardinality1,\n cardinality2: relationship.cardinality2,\n nature: relationship.nature,\n foreignKeyField: relationship.foreignKeyField ?? null,\n foreignKeyHolderResourceType: String(foreignKeyHolderResourceType),\n jointResourceType: relationship.jointResourceType ?? null,\n isPrimaryScope: relationship.isPrimaryScope === true,\n isDisabled: relationship.isDisabled === true,\n accessScopeStrategy: relationship.accessScopeStrategy ?? null,\n parentResourceRequirement: relationship.parentResourceRequirement ?? null,\n primaryScope: relationship.primaryScope ?? null,\n allowCycle: relationship.allowCycle === true,\n };\n}\n\nfunction projectSpecification(\n specification: AnyResourceSpecificationConfig | undefined,\n): DomainModelSpecificationRow | null {\n if (!specification) {\n return null;\n }\n\n return {\n purpose: specification.purpose,\n businessRole: specification.businessRole,\n lifecycleRole: specification.lifecycleRole ?? null,\n businessConstraints: [...(specification.businessConstraints ?? [])],\n };\n}\n\n/**\n * Project the observed application's domain model.\n *\n * Pure and synchronous: every input is already resolved by the handler, which is what makes the\n * projection testable without a subprocess, a companion or an application on disk.\n *\n * Rows are emitted in a STABLE order — modules in registration order with their resources\n * alphabetical, then the boundary nodes alphabetical — because the consumer lays a graph out from\n * them, and a layout that moves between two reads of an unchanged application reads as a change to\n * the application.\n */\nexport function projectApplicationDomainModel(\n input: DomainModelProjectionInput,\n): DomainModelProjection {\n const moduleByResourceType = new Map<string, DomainModelModuleInput>();\n for (const sharedModule of input.sharedModules) {\n for (const resourceType of Object.keys(sharedModule.resourceConfigurations ?? {})) {\n /*\n * LAST module wins, matching `buildSharedSaaSModulesRegistry`'s own `Object.assign` merge.\n * A resource registered by two modules is answered by the later one at runtime, so a graph\n * that credited the earlier one would disagree with the application it is describing.\n */\n moduleByResourceType.set(resourceType, sharedModule);\n }\n }\n\n const relationshipRows = input.resourceRelationships.map(buildRelationshipRow);\n const relationshipsByResourceType = new Map<string, DomainModelRelationshipRow[]>();\n const addRelationship = (resourceType: string, row: DomainModelRelationshipRow): void => {\n const existing = relationshipsByResourceType.get(resourceType);\n if (existing) {\n existing.push(row);\n return;\n }\n relationshipsByResourceType.set(resourceType, [row]);\n };\n for (const row of relationshipRows) {\n addRelationship(row.resourceType1, row);\n /*\n * A self-relationship joins one resource to itself, and listing it twice on the same row would\n * duplicate an edge the graph draws once.\n */\n if (row.resourceType2 !== row.resourceType1) {\n addRelationship(row.resourceType2, row);\n }\n }\n\n /*\n * Every resource NO MODULE of the observed application owns — from TWO sources, and both are\n * needed.\n *\n * - the ENDPOINTS of the relationship rows. A node must exist for every end of every edge, or the\n * edge cannot be drawn at all and vanishes silently. This source alone is what the projection\n * had, and it is why it answered only the handful of engine types the application points at.\n * - the keys of `resourceFieldsByResourceType`. The handler supplies one entry per resource\n * the application RUNS, which is its own plus the engine's whole merged vocabulary. An engine\n * resource that relates to nothing is in no edge, so the first source drops it — and \"the engine\n * resources that happen to have a relationship\" is not a set anyone asked about.\n *\n * The union is therefore \"what this application runs and no module of it declares\", which is the\n * question the consumer's engine boxes answer.\n */\n const ownedResourceTypes = new Set(moduleByResourceType.keys());\n const boundaryResourceTypes = new Set<string>();\n for (const row of relationshipRows) {\n for (const endpoint of [row.resourceType1, row.resourceType2]) {\n if (!ownedResourceTypes.has(endpoint)) {\n boundaryResourceTypes.add(endpoint);\n }\n }\n }\n for (const resourceType of Object.keys(input.resourceFieldsByResourceType)) {\n if (!ownedResourceTypes.has(resourceType)) {\n boundaryResourceTypes.add(resourceType);\n }\n }\n\n const buildRow = (resourceType: string): DomainModelResourceRow => {\n const owningModule = moduleByResourceType.get(resourceType);\n return {\n resourceType,\n moduleId: owningModule?.moduleId ?? null,\n moduleKind: owningModule?.kind ?? null,\n subDomain: input.specificationOverlay?.[resourceType]?.subDomain ?? null,\n fields: [...(input.resourceFieldsByResourceType[resourceType] ?? [])],\n operations: [...(input.resourceOperationsByResourceType[resourceType] ?? [])],\n viewRefs: [...(input.resourceViewRefsByResourceType[resourceType] ?? [])],\n advanced: input.resourceAdvancedByResourceType[resourceType] ?? {},\n specification: projectSpecification(input.specificationOverlay?.[resourceType]),\n relationships: relationshipsByResourceType.get(resourceType) ?? [],\n };\n };\n\n const orderedOwnedResourceTypes: string[] = [];\n const alreadyEmitted = new Set<string>();\n for (const sharedModule of input.sharedModules) {\n for (const resourceType of Object.keys(sharedModule.resourceConfigurations ?? {}).sort()) {\n // Guard against a resource registered by two modules being emitted twice; the map above\n // already decided which module owns it.\n if (alreadyEmitted.has(resourceType)) continue;\n if (moduleByResourceType.get(resourceType)?.moduleId !== sharedModule.moduleId) continue;\n alreadyEmitted.add(resourceType);\n orderedOwnedResourceTypes.push(resourceType);\n }\n }\n\n return {\n domainResources: [\n ...orderedOwnedResourceTypes.map(buildRow),\n ...[...boundaryResourceTypes].sort().map(buildRow),\n ],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-domain-model.behavior.js","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/application-domain-model.behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,uBAAuB,CAAC;AAiXjF,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAE5C,SAAS,oBAAoB,CAAC,YAA0C;IACtE,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,mCAAmC,CAAC;QAC7F,aAAa,EAAE,YAAY,CAAC,aAA6B;QACzD,aAAa,EAAE,YAAY,CAAC,aAA6B;QACzD,YAAY,EAAE,YAAY,CAAC,YAAqB;QAChD,YAAY,EAAE,YAAY,CAAC,YAAqB;KACjD,CAAC,CAAC;IAEH,OAAO;QACL,cAAc,EAAE;YACd,YAAY,CAAC,aAAa;YAC1B,YAAY,CAAC,aAAa;YAC1B,YAAY,CAAC,YAAY;YACzB,YAAY,CAAC,YAAY;YACzB,YAAY,CAAC,MAAM;YACnB,YAAY,CAAC,eAAe,IAAI,EAAE;YAClC,YAAY,CAAC,iBAAiB,IAAI,EAAE;YACpC;;;;;;eAMG;YACH,YAAY,CAAC,mBAAmB,IAAI,EAAE;YACtC,YAAY,CAAC,yBAAyB,IAAI,EAAE;YAC5C,YAAY,CAAC,YAAY,IAAI,EAAE;YAC/B,YAAY,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC/C,YAAY,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;SACnD,CAAC,IAAI,CAAC,+BAA+B,CAAC;QACvC,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,aAAa,EAAE,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AM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACzC,KAAK,MAAM,YAAY,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QAC/C,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACzF,wFAAwF;YACxF,wCAAwC;YACxC,IAAI,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC;gBAAE,SAAS;YAC/C,IAAI,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,QAAQ,KAAK,YAAY,CAAC,QAAQ;gBAAE,SAAS;YACzF,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YACjC,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO;QACL,eAAe,EAAE;YACf,GAAG,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC1C,GAAG,CAAC,GAAG,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACnD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { Resources_SharedUtils, type ResourceType } from '@wildo-ai/saas-models';\nimport type { AnyResourceSpecificationConfig } from '@wildo-ai/saas-specifications';\n\n/**\n * **application-domain-model** — the observed application's domain model as ONE projection:\n * every resource, the module that owns it, the relationships it participates in, and the prose of\n * its specification.\n *\n * ## Why this exists beside two behaviors that already answer half of it each\n *\n * The workbench used to draw its structure from two behaviors — `resource-specifications` for\n * module→resource ownership merged with the specification overlay, and `resources-registry` for the\n * compiled relationship edges. Each spawns its own subprocess importing the application's module\n * graph from TypeScript SOURCE, so a graph assembled from both is assembled from **two reads of a\n * mutating working tree**: the nodes can come from one state of the application and the edges from\n * the next. Nothing detects that, and the result is a picture of an application that never existed.\n *\n * So this is not a convenience wrapper over the other two. It is the only shape in which \"resources,\n * their relationships and their module membership\" is internally consistent. It also happens to cost\n * one derivation instead of two, which is the smaller of the two reasons.\n *\n * The two existing behaviors are untouched: they answer different questions (a full field-spec\n * projection, a full registry snapshot with the FK-resolution sweep) for consumers that are not this\n * one.\n *\n * ## What is projected, and what deliberately is not\n *\n * The specification's PROSE — `purpose`, `businessRole`, `lifecycleRole`, `businessConstraints` —\n * plus each resource's field NAMES. Not `operations`, `frontend`, `codeHandling` or the extracted\n * per-field specs: those are large, they are what makes `resource-specifications` expensive, and a\n * domain-model panel reads none of them. Stated rather than left implicit so the next reader does not\n * mistake the omission for an oversight; a consumer that needs them asks `resource-specifications`,\n * which is exactly what it is for.\n */\n\n/**\n * The relationship shape this projection reads.\n *\n * Structural rather than `ResourceRelationship`, because the rows cross a subprocess boundary from\n * the OBSERVED application's registry, which may have been built against a different engine revision\n * than the companion. Binding the engine type here would make a relationship the observed\n * application can legitimately declare unreadable — the same reasoning\n * the workbench's own relationship schema gives for keeping its vocabularies as plain strings.\n */\nexport interface DomainModelRelationshipInput {\n resourceType1: string;\n resourceType2: string;\n cardinality1: string;\n cardinality2: string;\n nature: string;\n foreignKeyField?: string;\n jointResourceType?: string;\n isPrimaryScope?: boolean;\n accessScopeStrategy?: string;\n parentResourceRequirement?: string;\n primaryScope?: string;\n allowCycle?: boolean;\n isDisabled?: boolean;\n}\n\n/** One of the observed application's shared modules, as `loadSharedModules()` answers it. */\nexport interface DomainModelModuleInput {\n moduleId: string;\n kind?: string;\n resourceConfigurations?: Record<string, unknown>;\n}\n\nexport interface DomainModelProjectionInput {\n /** The application's own shared modules, in registration order. */\n sharedModules: readonly DomainModelModuleInput[];\n /** The application's compiled relationship edges. */\n resourceRelationships: readonly DomainModelRelationshipInput[];\n /** The merged specification overlay, keyed by resource type. Absent when the app exports none. */\n specificationOverlay: Record<string, AnyResourceSpecificationConfig> | undefined;\n /** Everything the framework knows about each resource's fields, keyed by resource type. */\n resourceFieldsByResourceType: Record<string, readonly DomainModelFieldRow[]>;\n /** Every declared operation, projected for a reader, keyed by resource type. */\n resourceOperationsByResourceType: Record<string, readonly DomainModelOperationRow[]>;\n /** The behavioural configuration of each resource, keyed by resource type. */\n resourceAdvancedByResourceType: Record<string, Record<string, unknown>>;\n /** The `frontend.views` operation refs the specification declares, keyed by resource type. */\n resourceViewRefsByResourceType: Record<string, readonly string[]>;\n}\n\n/**\n * ONE FIELD, as the extractor answers it.\n *\n * A structural mirror of `ExtractedFieldSpec` rather than the imported type, for the reason the\n * relationship rows are structural: these cross a subprocess boundary as JSON, and a type whose\n * shape is owned elsewhere would let a change there alter this contract silently.\n */\nexport interface DomainModelFieldRow {\n fieldName: string;\n /** Which `{primitive}Spec()` decorator carried the authored prose, when one did. */\n specDecorator: string | null;\n /** The authored spec params — `meaning`, `whyItMatters`, `importance`, enum values, … */\n params: Record<string, unknown> | null;\n /**\n * The field's DECORATOR metadata, exactly as the schema declares it.\n *\n * `derived` is the extractor's INTERPRETATION — kind, primitive, foreign-key target. This is the\n * raw record beside it, and it carries what the interpretation does not: `isSummaryField`,\n * `isHidden`, `excludeFromCreate` / `excludeFromUpdate`, `dataCategories`, `isDBIndexed`,\n * `isUnique`, `isPrimaryKey`, and whatever a decorator adds tomorrow.\n *\n * OPAQUE for the reason `advanced` is: the set is open, and a projection that picked keys out of it\n * would report the subset its author knew about.\n *\n * What it does NOT contain, measured rather than assumed: anything from a `*.ui-behavior.tsx`. Those\n * decorators are applied by a FRONTEND module the companion never loads — the subprocess resolves\n * `library`, `specifications` and `service` targets and there is no frontend one — so on engine\n * resources this record holds structural decorators only. That is a reachability limit, not an\n * omission here.\n */\n metadata: Record<string, unknown> | null;\n /** What the framework DERIVED about the field: kind, primitive, optionality, FK target, … */\n derived: Record<string, unknown> | null;\n /** Base schema, or a variant of it — and which variant. */\n origin: Record<string, unknown> | null;\n}\n\n/** ONE OPERATION, projected to what changes its behaviour — never its DTOs. */\nexport interface DomainModelOperationRow {\n /** The operation's own identifier — a core verb or a custom one. */\n operationIdentifier: string;\n /** The operation's TRANSPORT kind: `api_call`, `internal_call`, `repository_only`, … */\n variantType: string | null;\n /**\n * WHICH variant of that transport this row is — `admin`, `summary`, `context`, … — or `null` for\n * the unnamed default.\n *\n * The missing half of an operation's identity, and its absence was a real defect rather than\n * missing detail. `organizations` declares FOUR operations that are all `read` × `api_call`,\n * separated only by this key; measured across the engine's core map, 133 of 794 operations collided\n * on the pair without it. The panel keyed its rows on the colliding pair, so React saw duplicate\n * keys and one accordion row stood for several distinct operations.\n */\n variantKey: string | null;\n /** For a CUSTOM operation, the core verb it behaves like. `null` for a core operation. */\n resourceOperationLike: string | null;\n /** Whether this variant is the one an unqualified call resolves to. */\n isDefault: boolean;\n /** The roles admitted. An EMPTY array is a real answer: no role gate on this variant. */\n roles: string[];\n riskLevel: string | null;\n /** Declared but not implemented — the operation answers, and says it is a placeholder. */\n isUnimplemented: boolean;\n isDisabled: boolean;\n requiresStepUpAuthentication: boolean;\n admitsCrossTenantPlatformAdministration: boolean;\n /** Whether the operation emits an auditable event, and which. */\n auditableEventType: string | null;\n /** Whether the operation is exposed over MCP. */\n isMcpExposed: boolean;\n /** Feature flags that must be on for the operation to exist at all. */\n requiredFeatures: string[];\n /**\n * Everything ELSE the materialized operation declares — the HTTP verb, the runtime mode, bulk and\n * API-key posture, notification fan-out, custom-implementation modes, authoritative fields.\n *\n * A deny list over the operation's own keys, for the third time in this projection and for the same\n * reason each time: an allow list reports the subset its author knew about, and this one proved it\n * — a hand-picked set of twelve fields was shipped and `variantKey`, `httpVerb`, `isBulkOperation`\n * and `serviceRuntimeMode` were all absent from it, which is what \"there are lots of information\n * missing\" was.\n *\n * The six DTO schemas are excluded by name. Each serializes to tens of kilobytes, and together they\n * would put megabytes on the wire to say which verbs exist.\n */\n attributes: Record<string, unknown>;\n /**\n * The authored SPECIFICATION for this operation, when the resource's spec describes it.\n *\n * Keyed by `operationIdentifier`, so every variant of one verb carries the same entry — the spec\n * describes the operation, and its per-variant prose lives inside that entry rather than beside it.\n * `null` means the specification does not mention this operation, which is a gap a reader can act\n * on rather than an absence of data.\n */\n specification: Record<string, unknown> | null;\n /** The authored FRONTEND view overlay for this operation (`frontend.views`), when there is one. */\n view: Record<string, unknown> | null;\n}\n\n/** One relationship, as it rides on BOTH resources it joins. */\nexport interface DomainModelRelationshipRow {\n /**\n * Stable identity for ONE edge, composed from every field this projection carries about it.\n *\n * Composed from the whole tuple rather than from `resourceType1 + resourceType2 +\n * foreignKeyField` — the triple the retired `workbenchResourceRelationships` resource addressed a\n * row by — because the discriminating field is not always present: a MANY-to-MANY edge carries\n * `jointResourceType` and no `foreignKeyField`, so that triple is not total here.\n *\n * The consequence is deliberate and worth stating: two edges that agree on every one of these\n * fields are indistinguishable to a graph, so merging them loses nothing a reader could have seen.\n * Two that differ anywhere get distinct ids and both are drawn. This id is internal to the\n * projection and its consumer — it never becomes a URL path parameter — so it is not held to the\n * URL-safe charset an addressable introspection key must satisfy.\n */\n relationshipId: string;\n resourceType1: string;\n resourceType2: string;\n cardinality1: string;\n cardinality2: string;\n /**\n * `composition`, `reference` or `association` — the observed application's vocabulary, and a plain\n * string precisely so a FOURTH value it may legitimately declare is projected rather than refused.\n *\n * Those three are all `RelationshipNature` declares today. Naming a value that does not exist would\n * be worse than naming none: a reader would conclude such an edge falls into the consumer's\n * unrecognised-nature bucket and hunt a defect that cannot occur.\n */\n nature: string;\n foreignKeyField: string | null;\n /**\n * Which side's rows CARRY the foreign key — the direction an arrow must point.\n *\n * Resolved by {@link Resources_SharedUtils.resolveForeignKeyHolderResourceType}, never from\n * declaration order. `resourceType1` is not reliably the referenced side: a child-first\n * declaration such as `(TODOS, USERS, MANY, ONE, { foreignKeyField: 'assignedToUserId' })` is\n * valid and puts the referenced resource in `resourceType2`. Reading position instead of\n * cardinality is the defect that once materialized required FK columns onto the wrong collection.\n */\n foreignKeyHolderResourceType: string;\n /** The junction resource of a MANY-to-MANY, which the framework requires such an edge to name. */\n jointResourceType: string | null;\n /** Whether this edge is the structural ownership anchor that gives `resourceType2` its scope. */\n isPrimaryScope: boolean;\n /**\n * Whether the edge is DECLARED BUT INACTIVE.\n *\n * Load-bearing rather than completeness: an edge the application has disabled does not constrain\n * anything at runtime, and a graph that draws it identically to a live one tells its reader the\n * application has a relationship it does not have. That is the one field here whose absence made\n * the picture WRONG rather than merely thinner, which is why it travels even though the dogfood\n * application currently disables none (measured 2026-08-31: 0 of 16).\n */\n isDisabled: boolean;\n /**\n * How a caller reaches rows on the far side — `requires_context`, `standalone`, and whatever else\n * the observed application's engine revision declares.\n *\n * A plain string for the same reason `nature` is one: this projection describes an application\n * that may have been built against a different engine revision than the companion reading it.\n */\n accessScopeStrategy: string | null;\n /** Whether the parent endpoint is `mandatory` or `optional` for the child's addressing. */\n parentResourceRequirement: string | null;\n /**\n * The resource this edge anchors scope to, when it is a primary-scope edge.\n *\n * Distinct from {@link isPrimaryScope}, which says only THAT it anchors: this names WHICH resource\n * the scope resolves to, and the two are not derivable from one another on an edge whose endpoints\n * are both scoped.\n */\n primaryScope: string | null;\n /** Whether a cycle through this edge is permitted — a graph-shape fact a graph should be able to show. */\n allowCycle: boolean;\n}\n\n/** The specification's prose, for the panel a selected node opens. */\nexport interface DomainModelSpecificationRow {\n purpose: string;\n businessRole: string;\n lifecycleRole: string | null;\n businessConstraints: string[];\n}\n\n/** One resource node. */\nexport interface DomainModelResourceRow {\n resourceType: string;\n /**\n * The module that registers this resource, or `null`.\n *\n * `null` is not a gap — it is the fact that no module of the OBSERVED APPLICATION owns this\n * resource, which is true of every ENGINE resource. All of them are emitted, because an application\n * does not merge two of them: `initializeResources` applies the engine's core factory map\n * unconditionally, so `files`, `apiKeys` and the rest are as registered in the running application\n * as the ones it declares itself.\n *\n * Two SHAPES of engine row arrive, and the consumer separates them without help: one whose\n * relationships reach a resource that HAS a module (`organizations`, `users` — the scope anchors,\n * the most load-bearing edges in the graph), and one whose relationships reach only other engine\n * resources. That distinction is derivable from the rows, so no field states it.\n *\n * No `origin` vocabulary is introduced for this. The absence of a module IS the distinction, and a\n * second field restating it is a second thing that can disagree.\n */\n moduleId: string | null;\n /**\n * Every field of the materialized `mainSchema`, with everything the framework knows about it.\n *\n * This replaced a bare `fieldNames: string[]`, and the replacement is the point rather than an\n * enrichment: a name answers \"does this field exist\", which the node already implies by counting\n * them, and nothing else. A reader opening a resource wants what the field IS — its type, whether\n * it is optional, whether it is a key, an index, a foreign key and to what, what personal-data\n * category it carries, and whatever the specification says it MEANS.\n *\n * spec-cite: N/A — \"the specification\" here is Wildo's OWN `*.resource.specification.ts` layer, not an external standard, and the quoted\n * fragments are questions this panel answers rather than any document's words.\n *\n * The entries are `ExtractedFieldSpec` from `@wildo-ai/saas-specifications`, produced by the same\n * extractor the `resource-specifications` behavior uses — not a second reading of the same\n * decorators. `params` carries the authored spec prose, `derived` the structural facts the\n * framework computed, `origin` whether the field comes from the base schema or a variant.\n *\n * Structural rather than the imported type, for the reason the relationship rows are: these cross a\n * subprocess boundary as JSON.\n */\n fields: DomainModelFieldRow[];\n /**\n * Every operation the resource configuration declares, projected to what a READER needs.\n *\n * A materialized operation carries its full request, response, summary, context, internal and\n * repository DTOs — six Zod schemas, each of which serializes to tens of kilobytes. Projecting the\n * operation objects wholesale would put megabytes on the wire to say which verbs exist; this\n * carries the identity, the variant, the authorization and the flags that change what the operation\n * DOES, and nothing that is a schema.\n */\n operations: DomainModelOperationRow[];\n /**\n * The per-operation FRONTEND overlay refs the specification declares — `frontend.views`.\n *\n * spec-cite: N/A — \"the specification\" is Wildo's own specification layer; the quoted fragment is the question this field answers.\n *\n * Keys only. The entries themselves are authoring prose about how an operation surfaces, which\n * belongs to the specification reader rather than to a domain-model panel; what this answers is\n * \"which of this resource's operations have an authored view\", which is a gap a reader can act on.\n */\n viewRefs: string[];\n /**\n * The configuration facts that are neither prose nor structure — persistence, policy, bindings.\n *\n * Everything on a `ResourceConfiguration` that decides how the resource BEHAVES rather than what it\n * holds: which database it lives in, whether it is a system resource, its retention, transposition,\n * portability and data-subject policies, its HTTP and introspection bindings.\n *\n * Carried as an OPAQUE record rather than a typed shape, and that is deliberate. The set is open —\n * `ResourceConfiguration` has grown four of these fields in as many months — and a hand-written\n * projection reports the subset its author knew about, so a policy added tomorrow would be\n * invisible here with nothing to say so. Reading the keys means it appears by itself.\n */\n advanced: Record<string, unknown>;\n /**\n * Which part of its owner this resource belongs to — the SECOND grouping axis, under the module.\n *\n * `null` means the specification declares none, which is what an application's own resources\n * normally look like today and what an engine resource with no spec at all looks like (one, at the\n * time of writing: `consumableTokens`). A consumer grouping by this must carry an \"unclassified\"\n * bucket and say so; folding those rows into a real group is how a grouping starts lying.\n *\n * Carried on the ROW rather than inside `specification`, because that object is authoring PROSE a\n * reader reads and this is a key a consumer groups by. Nesting it there would make every grouped\n * surface reach through a nullable prose block to find its grouping key.\n */\n subDomain: string | null;\n /** `domain` / `engine` — the kind the owning module declares, when there is one. */\n moduleKind: string | null;\n /** Field names of the materialized `mainSchema`. Empty when the factory could not be materialized. */\n /** The specification's prose, or `null` when this resource has no authored specification. */\n specification: DomainModelSpecificationRow | null;\n /** Every relationship this resource participates in, on either side. */\n relationships: DomainModelRelationshipRow[];\n}\n\nexport interface DomainModelProjection {\n domainResources: DomainModelResourceRow[];\n}\n\nconst RELATIONSHIP_IDENTITY_SEPARATOR = '|';\n\nfunction buildRelationshipRow(relationship: DomainModelRelationshipInput): DomainModelRelationshipRow {\n const foreignKeyHolderResourceType = Resources_SharedUtils.resolveForeignKeyHolderResourceType({\n resourceType1: relationship.resourceType1 as ResourceType,\n resourceType2: relationship.resourceType2 as ResourceType,\n cardinality1: relationship.cardinality1 as never,\n cardinality2: relationship.cardinality2 as never,\n });\n\n return {\n relationshipId: [\n relationship.resourceType1,\n relationship.resourceType2,\n relationship.cardinality1,\n relationship.cardinality2,\n relationship.nature,\n relationship.foreignKeyField ?? '',\n relationship.jointResourceType ?? '',\n /*\n * The five fields added 2026-08-31 are in the identity for the reason the doc above gives:\n * two edges that differ ANYWHERE a reader can see must get distinct ids and both be drawn.\n * `isDisabled` is the one that makes this more than bookkeeping — an active and a disabled\n * edge between the same two resources render differently, so collapsing them to one id would\n * silently drop whichever came second.\n */\n relationship.accessScopeStrategy ?? '',\n relationship.parentResourceRequirement ?? '',\n relationship.primaryScope ?? '',\n relationship.allowCycle === true ? 'cycle' : '',\n relationship.isDisabled === true ? 'disabled' : '',\n ].join(RELATIONSHIP_IDENTITY_SEPARATOR),\n resourceType1: relationship.resourceType1,\n resourceType2: relationship.resourceType2,\n cardinality1: relationship.cardinality1,\n cardinality2: relationship.cardinality2,\n nature: relationship.nature,\n foreignKeyField: relationship.foreignKeyField ?? null,\n foreignKeyHolderResourceType: String(foreignKeyHolderResourceType),\n jointResourceType: relationship.jointResourceType ?? null,\n isPrimaryScope: relationship.isPrimaryScope === true,\n isDisabled: relationship.isDisabled === true,\n accessScopeStrategy: relationship.accessScopeStrategy ?? null,\n parentResourceRequirement: relationship.parentResourceRequirement ?? null,\n primaryScope: relationship.primaryScope ?? null,\n allowCycle: relationship.allowCycle === true,\n };\n}\n\nfunction projectSpecification(\n specification: AnyResourceSpecificationConfig | undefined,\n): DomainModelSpecificationRow | null {\n if (!specification) {\n return null;\n }\n\n return {\n purpose: specification.purpose,\n businessRole: specification.businessRole,\n lifecycleRole: specification.lifecycleRole ?? null,\n businessConstraints: [...(specification.businessConstraints ?? [])],\n };\n}\n\n/**\n * Project the observed application's domain model.\n *\n * Pure and synchronous: every input is already resolved by the handler, which is what makes the\n * projection testable without a subprocess, a companion or an application on disk.\n *\n * Rows are emitted in a STABLE order — modules in registration order with their resources\n * alphabetical, then the boundary nodes alphabetical — because the consumer lays a graph out from\n * them, and a layout that moves between two reads of an unchanged application reads as a change to\n * the application.\n */\nexport function projectApplicationDomainModel(\n input: DomainModelProjectionInput,\n): DomainModelProjection {\n const moduleByResourceType = new Map<string, DomainModelModuleInput>();\n for (const sharedModule of input.sharedModules) {\n for (const resourceType of Object.keys(sharedModule.resourceConfigurations ?? {})) {\n /*\n * LAST module wins, matching `buildSharedSaaSModulesRegistry`'s own `Object.assign` merge.\n * A resource registered by two modules is answered by the later one at runtime, so a graph\n * that credited the earlier one would disagree with the application it is describing.\n */\n moduleByResourceType.set(resourceType, sharedModule);\n }\n }\n\n const relationshipRows = input.resourceRelationships.map(buildRelationshipRow);\n const relationshipsByResourceType = new Map<string, DomainModelRelationshipRow[]>();\n const addRelationship = (resourceType: string, row: DomainModelRelationshipRow): void => {\n const existing = relationshipsByResourceType.get(resourceType);\n if (existing) {\n existing.push(row);\n return;\n }\n relationshipsByResourceType.set(resourceType, [row]);\n };\n for (const row of relationshipRows) {\n addRelationship(row.resourceType1, row);\n /*\n * A self-relationship joins one resource to itself, and listing it twice on the same row would\n * duplicate an edge the graph draws once.\n */\n if (row.resourceType2 !== row.resourceType1) {\n addRelationship(row.resourceType2, row);\n }\n }\n\n /*\n * Every resource NO MODULE of the observed application owns — from TWO sources, and both are\n * needed.\n *\n * - the ENDPOINTS of the relationship rows. A node must exist for every end of every edge, or the\n * edge cannot be drawn at all and vanishes silently. This source alone is what the projection\n * had, and it is why it answered only the handful of engine types the application points at.\n * - the keys of `resourceFieldsByResourceType`. The handler supplies one entry per resource\n * the application RUNS, which is its own plus the engine's whole merged vocabulary. An engine\n * resource that relates to nothing is in no edge, so the first source drops it — and \"the engine\n * resources that happen to have a relationship\" is not a set anyone asked about.\n *\n * The union is therefore \"what this application runs and no module of it declares\", which is the\n * question the consumer's engine boxes answer.\n */\n const ownedResourceTypes = new Set(moduleByResourceType.keys());\n const boundaryResourceTypes = new Set<string>();\n for (const row of relationshipRows) {\n for (const endpoint of [row.resourceType1, row.resourceType2]) {\n if (!ownedResourceTypes.has(endpoint)) {\n boundaryResourceTypes.add(endpoint);\n }\n }\n }\n for (const resourceType of Object.keys(input.resourceFieldsByResourceType)) {\n if (!ownedResourceTypes.has(resourceType)) {\n boundaryResourceTypes.add(resourceType);\n }\n }\n\n const buildRow = (resourceType: string): DomainModelResourceRow => {\n const owningModule = moduleByResourceType.get(resourceType);\n return {\n resourceType,\n moduleId: owningModule?.moduleId ?? null,\n moduleKind: owningModule?.kind ?? null,\n subDomain: input.specificationOverlay?.[resourceType]?.subDomain ?? null,\n fields: [...(input.resourceFieldsByResourceType[resourceType] ?? [])],\n operations: [...(input.resourceOperationsByResourceType[resourceType] ?? [])],\n viewRefs: [...(input.resourceViewRefsByResourceType[resourceType] ?? [])],\n advanced: input.resourceAdvancedByResourceType[resourceType] ?? {},\n specification: projectSpecification(input.specificationOverlay?.[resourceType]),\n relationships: relationshipsByResourceType.get(resourceType) ?? [],\n };\n };\n\n const orderedOwnedResourceTypes: string[] = [];\n const alreadyEmitted = new Set<string>();\n for (const sharedModule of input.sharedModules) {\n for (const resourceType of Object.keys(sharedModule.resourceConfigurations ?? {}).sort()) {\n // Guard against a resource registered by two modules being emitted twice; the map above\n // already decided which module owns it.\n if (alreadyEmitted.has(resourceType)) continue;\n if (moduleByResourceType.get(resourceType)?.moduleId !== sharedModule.moduleId) continue;\n alreadyEmitted.add(resourceType);\n orderedOwnedResourceTypes.push(resourceType);\n }\n }\n\n return {\n domainResources: [\n ...orderedOwnedResourceTypes.map(buildRow),\n ...[...boundaryResourceTypes].sort().map(buildRow),\n ],\n };\n}\n"]}
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FAMILY ASPECTS — every second-level aspect row of every landed family, in ONE projection.
|
|
3
|
+
*
|
|
4
|
+
* One behavior for forty resources, on the same single-import consistency argument as
|
|
5
|
+
* `application-domain-model`: the aspect rows CROSS-REFERENCE each other (a requirement's
|
|
6
|
+
* `icpRefs` must be routable against the ICP key set), so deriving them from one read of one
|
|
7
|
+
* companion-exports module is the only shape in which the graph's two ends describe the same
|
|
8
|
+
* working tree. Each aspect resource binds this behavior at its own `rowsPath`.
|
|
9
|
+
*
|
|
10
|
+
* ## What a row is
|
|
11
|
+
*
|
|
12
|
+
* The spine envelope (see `workbench-aspect-resources.custom.shared.schemas.ts`): composed
|
|
13
|
+
* identity, `family` backlink, `aspectKey`, `title` (the registry's headline field), the full
|
|
14
|
+
* item as `content`, plus the aspect's FLATTENED reference fields. Flattening happens here:
|
|
15
|
+
*
|
|
16
|
+
* - through-edges lift the key(s) out of edge objects (`jobs[].jobRef` → `jobRefs`),
|
|
17
|
+
* - multi-target edges route each key BY MEMBERSHIP into its per-target split field
|
|
18
|
+
* (`deliversRequirementRefs` → `deliversFunctionalRequirementRefs` + …); a key belonging to
|
|
19
|
+
* NO target keeps the graph honest by landing in none of them — the raw value stays readable
|
|
20
|
+
* in `content`, so a dangling ref is visible without becoming a dead reference control.
|
|
21
|
+
*/
|
|
1
22
|
interface FamilyAspectRow {
|
|
2
23
|
readonly [field: string]: unknown;
|
|
3
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"family-aspects.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/family-aspects.behavior.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"family-aspects.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/family-aspects.behavior.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,UAAU,eAAe;IACvB,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;CACpC,GAAG;IACF,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE,GAAG,kBAAkB,CAAC;CAC9E,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,qBAAqB,CAwExB"}
|
|
@@ -2,44 +2,6 @@ import { FAMILY_ASPECTS_REGISTRY, FamilyAspectKind, } from '@wildo-ai/saas-speci
|
|
|
2
2
|
import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS } from '@wildo-ai/application-creation-runtime';
|
|
3
3
|
import { WORKBENCH_ASPECT_DESCRIPTORS, WorkbenchShared_ResourceFieldIdentifier, } from '@wildo-ai/platform-core-shared';
|
|
4
4
|
import { resolveSpecificationsCompanionExports } from './companion-introspection-module-exports.utils.js';
|
|
5
|
-
/**
|
|
6
|
-
* FAMILY ASPECTS — every second-level aspect row of every landed family, in ONE projection.
|
|
7
|
-
*
|
|
8
|
-
* One behavior for forty resources, on the same single-import consistency argument as
|
|
9
|
-
* `application-domain-model`: the aspect rows CROSS-REFERENCE each other (a requirement's
|
|
10
|
-
* `icpRefs` must be routable against the ICP key set), so deriving them from one read of one
|
|
11
|
-
* companion-exports module is the only shape in which the graph's two ends describe the same
|
|
12
|
-
* working tree. Each aspect resource binds this behavior at its own `rowsPath`.
|
|
13
|
-
*
|
|
14
|
-
* ## What a row is
|
|
15
|
-
*
|
|
16
|
-
* The spine envelope (see `workbench-aspect-resources.custom.shared.schemas.ts`): composed
|
|
17
|
-
* identity, `family` backlink, `aspectKey`, `title` (the registry's headline field), the full
|
|
18
|
-
* item as `content`, plus the aspect's FLATTENED reference fields. Flattening happens here:
|
|
19
|
-
*
|
|
20
|
-
* - through-edges lift the key(s) out of edge objects (`jobs[].jobRef` → `jobRefs`),
|
|
21
|
-
* - multi-target edges route each key BY MEMBERSHIP into its per-target split field
|
|
22
|
-
* (`deliversRequirementRefs` → `deliversFunctionalRequirementRefs` + …); a key belonging to
|
|
23
|
-
* NO target keeps the graph honest by landing in none of them — the raw value stays readable
|
|
24
|
-
* in `content`, so a dangling ref is visible without becoming a dead reference control.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* The headline value at a declared field path — plain-object segments only.
|
|
28
|
-
*
|
|
29
|
-
* A path rather than a key because a family's reader-facing name is not always top-level: a feature
|
|
30
|
-
* draft's is `draft.purpose`, under a wrapper that exists because the payload is authored ref-lessly.
|
|
31
|
-
* A missing segment yields `undefined` and the caller falls back to the row identity, so a drifted
|
|
32
|
-
* path degrades to the slug rather than throwing — and the registry pin is what stops it drifting.
|
|
33
|
-
*/
|
|
34
|
-
function resolveHeadlineValue(item, fieldPath) {
|
|
35
|
-
let current = item;
|
|
36
|
-
for (const segment of fieldPath.split('.')) {
|
|
37
|
-
if (current === null || typeof current !== 'object')
|
|
38
|
-
return undefined;
|
|
39
|
-
current = current[segment];
|
|
40
|
-
}
|
|
41
|
-
return current;
|
|
42
|
-
}
|
|
43
5
|
const DESCRIPTOR_BY_ASPECT_KEY = new Map(WORKBENCH_ASPECT_DESCRIPTORS.map((descriptor) => [descriptor.aspectKey, descriptor]));
|
|
44
6
|
export function projectFamilyAspects(input) {
|
|
45
7
|
const companionExports = resolveSpecificationsCompanionExports(input.moduleExports);
|
|
@@ -87,7 +49,7 @@ export function projectFamilyAspects(input) {
|
|
|
87
49
|
const identity = declaration.businessKey !== undefined
|
|
88
50
|
? String(item[declaration.businessKey] ?? `${aspectKey}[${index}]`)
|
|
89
51
|
: declaration.kind === FamilyAspectKind.SINGLETON ? aspectKey : `${aspectKey}[${index}]`;
|
|
90
|
-
const headline =
|
|
52
|
+
const headline = item[declaration.headlineField];
|
|
91
53
|
const row = {
|
|
92
54
|
[identityField]: identity,
|
|
93
55
|
family,
|
|
@@ -1 +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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AAC,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\n/**\n * The headline value at a declared field path — plain-object segments only.\n *\n * A path rather than a key because a family's reader-facing name is not always top-level: a feature\n * draft's is `draft.purpose`, under a wrapper that exists because the payload is authored ref-lessly.\n * A missing segment yields `undefined` and the caller falls back to the row identity, so a drifted\n * path degrades to the slug rather than throwing — and the registry pin is what stops it drifting.\n */\nfunction resolveHeadlineValue(item: FamilyAspectRow, fieldPath: string): unknown {\n let current: unknown = item;\n for (const segment of fieldPath.split('.')) {\n if (current === null || typeof current !== 'object') return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\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 = resolveHeadlineValue(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"]}
|
|
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,EA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AAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACjD,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACpC,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,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"]}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { CoreResourceType, type ResourceConfiguration_Operation, type ResourceConfiguration_Operation_ApiCall, type ResourceConfiguration_Operation_ApiCallWithCallback, type ResourceConfiguration_Operation_UrlInitiatorInfo, type ResourceRelationship, type FlowActorSystem } from '@wildo-ai/saas-models';
|
|
38
38
|
import { type AnyResourceSpecificationConfig } from '@wildo-ai/saas-specifications';
|
|
39
|
-
import { OpenApiSection, type OperationDoc, type OperationHttpDoc, type OpenApiGenerationProjectorStats, type OperationProjection, type ResourceTag, type ApplicationOrganizationRoleDocumentationSource, type ApplicationOrganizationUnitResourceDocumentation, type ApplicationRoleDocumentationSource
|
|
39
|
+
import { OpenApiSection, type OperationDoc, type OperationHttpDoc, type OpenApiGenerationProjectorStats, type OperationProjection, type ResourceTag, type ApplicationOrganizationRoleDocumentationSource, type ApplicationOrganizationUnitResourceDocumentation, type ApplicationRoleDocumentationSource } from '@wildo-ai/saas-technical-doc/companion';
|
|
40
40
|
/**
|
|
41
41
|
* Wire format returned by the `'openapi-generation-input'` subprocess
|
|
42
42
|
* behavior. It carries the JSON-safe facts that require the application module
|
|
@@ -54,8 +54,6 @@ export interface OpenApiGenerationInputSubprocessOutput {
|
|
|
54
54
|
operations: OperationProjection[];
|
|
55
55
|
/** True when the final application registry declares at least one usable MCP tool operation. */
|
|
56
56
|
hasConfiguredMcpToolOperations: boolean;
|
|
57
|
-
mcpTools: readonly ApplicationMcpToolSource[];
|
|
58
|
-
webhookEvents: readonly ApplicationWebhookEventSource[];
|
|
59
57
|
/** True when the final startup declaration contains at least one actor system that A2A can expose as a skill. */
|
|
60
58
|
hasConfiguredA2aSkills: boolean;
|
|
61
59
|
/** Every resolved organization-scoped role, joined to its authored semantics. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-generation-input.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/openapi-generation-input.behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAaL,gBAAgB,EAgBhB,KAAK,+BAA+B,EACpC,KAAK,uCAAuC,EAC5C,KAAK,mDAAmD,EACxD,KAAK,gDAAgD,EACrD,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAKL,KAAK,8BAA8B,EAEpC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAOL,cAAc,EAMd,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EACpC,KAAK,mBAAmB,EAQxB,KAAK,WAAW,EAChB,KAAK,8CAA8C,EACnD,KAAK,gDAAgD,EACrD,KAAK,kCAAkC,
|
|
1
|
+
{"version":3,"file":"openapi-generation-input.behavior.d.ts","sourceRoot":"","sources":["../../../../../../src/core/introspection/subprocess/openapi-generation-input.behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAaL,gBAAgB,EAgBhB,KAAK,+BAA+B,EACpC,KAAK,uCAAuC,EAC5C,KAAK,mDAAmD,EACxD,KAAK,gDAAgD,EACrD,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAKL,KAAK,8BAA8B,EAEpC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAOL,cAAc,EAMd,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,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