@wildo-ai/wildo-cli 1.1.12 → 1.1.13

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.
Files changed (102) hide show
  1. package/dist/src/commands/config/sync.command.d.ts.map +1 -1
  2. package/dist/src/commands/config/sync.command.js +1 -0
  3. package/dist/src/commands/config/sync.command.js.map +1 -1
  4. package/dist/src/commands/context/journey.command.d.ts.map +1 -1
  5. package/dist/src/commands/context/journey.command.js +8 -0
  6. package/dist/src/commands/context/journey.command.js.map +1 -1
  7. package/dist/src/commands/creation/drive.command.d.ts.map +1 -1
  8. package/dist/src/commands/creation/drive.command.js +2 -0
  9. package/dist/src/commands/creation/drive.command.js.map +1 -1
  10. package/dist/src/commands/fwk/publish-all.command.d.ts.map +1 -1
  11. package/dist/src/commands/fwk/publish-all.command.js +8 -0
  12. package/dist/src/commands/fwk/publish-all.command.js.map +1 -1
  13. package/dist/src/commands/local/dev.command.d.ts +68 -0
  14. package/dist/src/commands/local/dev.command.d.ts.map +1 -1
  15. package/dist/src/commands/local/dev.command.js +216 -8
  16. package/dist/src/commands/local/dev.command.js.map +1 -1
  17. package/dist/src/commands/local/doctor.command.d.ts +22 -9
  18. package/dist/src/commands/local/doctor.command.d.ts.map +1 -1
  19. package/dist/src/commands/local/doctor.command.js +45 -42
  20. package/dist/src/commands/local/doctor.command.js.map +1 -1
  21. package/dist/src/commands/providers/connect.command.d.ts.map +1 -1
  22. package/dist/src/commands/providers/connect.command.js +11 -1
  23. package/dist/src/commands/providers/connect.command.js.map +1 -1
  24. package/dist/src/commands/seal/currency.command.d.ts +13 -0
  25. package/dist/src/commands/seal/currency.command.d.ts.map +1 -0
  26. package/dist/src/commands/seal/currency.command.js +52 -0
  27. package/dist/src/commands/seal/currency.command.js.map +1 -0
  28. package/dist/src/commands/seal/seal-admin-door.utils.d.ts.map +1 -1
  29. package/dist/src/commands/seal/seal-admin-door.utils.js +2 -0
  30. package/dist/src/commands/seal/seal-admin-door.utils.js.map +1 -1
  31. package/dist/src/commands/seal/verify.command.d.ts +5 -0
  32. package/dist/src/commands/seal/verify.command.d.ts.map +1 -1
  33. package/dist/src/commands/seal/verify.command.js +26 -2
  34. package/dist/src/commands/seal/verify.command.js.map +1 -1
  35. package/dist/src/services/application/content-guardrail-classifier.service.d.ts +19 -0
  36. package/dist/src/services/application/content-guardrail-classifier.service.d.ts.map +1 -1
  37. package/dist/src/services/application/content-guardrail-classifier.service.js +75 -11
  38. package/dist/src/services/application/content-guardrail-classifier.service.js.map +1 -1
  39. package/dist/src/services/application/local-provider-doubles.service.d.ts +98 -0
  40. package/dist/src/services/application/local-provider-doubles.service.d.ts.map +1 -0
  41. package/dist/src/services/application/local-provider-doubles.service.js +214 -0
  42. package/dist/src/services/application/local-provider-doubles.service.js.map +1 -0
  43. package/dist/src/services/application/system-of-record-simulators.service.d.ts +21 -2
  44. package/dist/src/services/application/system-of-record-simulators.service.d.ts.map +1 -1
  45. package/dist/src/services/application/system-of-record-simulators.service.js +21 -12
  46. package/dist/src/services/application/system-of-record-simulators.service.js.map +1 -1
  47. package/dist/src/services/companion/creation-drive.service.d.ts +32 -2
  48. package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
  49. package/dist/src/services/companion/creation-drive.service.js +61 -4
  50. package/dist/src/services/companion/creation-drive.service.js.map +1 -1
  51. package/dist/src/services/credentials/credentials.schemas.d.ts +6 -0
  52. package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
  53. package/dist/src/services/credentials/credentials.schemas.js +7 -1
  54. package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
  55. package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
  56. package/dist/src/services/credentials/provider-env-vars.utils.js +11 -3
  57. package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
  58. package/dist/src/services/data-services/data-services.schemas.d.ts +9 -0
  59. package/dist/src/services/data-services/data-services.schemas.d.ts.map +1 -1
  60. package/dist/src/services/data-services/data-services.schemas.js +9 -0
  61. package/dist/src/services/data-services/data-services.schemas.js.map +1 -1
  62. package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
  63. package/dist/src/services/deployment/docker/docker-compose-generator.service.js +7 -2
  64. package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
  65. package/dist/src/services/deployment/local-dev-session-lease.service.d.ts.map +1 -1
  66. package/dist/src/services/deployment/local-dev-session-lease.service.js +22 -1
  67. package/dist/src/services/deployment/local-dev-session-lease.service.js.map +1 -1
  68. package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
  69. package/dist/src/services/environment/authored-infra-config.utils.js +1 -0
  70. package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
  71. package/dist/src/services/environment/authored-infra-member-authority.d.ts.map +1 -1
  72. package/dist/src/services/environment/authored-infra-member-authority.js +5 -0
  73. package/dist/src/services/environment/authored-infra-member-authority.js.map +1 -1
  74. package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
  75. package/dist/src/services/environment/env-configuration-generator.service.js +6 -3
  76. package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
  77. package/dist/src/services/environment/env-vars-builder.service.d.ts +6 -0
  78. package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
  79. package/dist/src/services/environment/env-vars-builder.service.js +24 -1
  80. package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
  81. package/dist/src/services/environment/environment-hydration.utils.d.ts.map +1 -1
  82. package/dist/src/services/environment/environment-hydration.utils.js +1 -0
  83. package/dist/src/services/environment/environment-hydration.utils.js.map +1 -1
  84. package/dist/src/services/environment/environment.schemas.d.ts +7 -1
  85. package/dist/src/services/environment/environment.schemas.d.ts.map +1 -1
  86. package/dist/src/services/environment/environment.schemas.js.map +1 -1
  87. package/dist/src/services/environment/runtime-bootstrap.service.d.ts +2 -0
  88. package/dist/src/services/environment/runtime-bootstrap.service.d.ts.map +1 -1
  89. package/dist/src/services/environment/runtime-bootstrap.service.js +4 -0
  90. package/dist/src/services/environment/runtime-bootstrap.service.js.map +1 -1
  91. package/dist/src/services/framework/framework-docker-publish.service.d.ts +13 -0
  92. package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
  93. package/dist/src/services/framework/framework-docker-publish.service.js +24 -7
  94. package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
  95. package/dist/src/services/registry/provider-connect.service.d.ts +57 -1
  96. package/dist/src/services/registry/provider-connect.service.d.ts.map +1 -1
  97. package/dist/src/services/registry/provider-connect.service.js +63 -2
  98. package/dist/src/services/registry/provider-connect.service.js.map +1 -1
  99. package/dist/tsconfig.build.tsbuildinfo +1 -1
  100. package/package.json +18 -18
  101. package/scripts/app-dependency-alignment/propagated-engine-overrides.json +1 -1
  102. package/wildo-framework.info.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-provider-doubles.service.js","sourceRoot":"","sources":["../../../../src/services/application/local-provider-doubles.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,wBAAwB,EAAiE,MAAM,uCAAuC,CAAC;AAoBhJ,wGAAwG;AACxG,MAAM,CAAC,MAAM,sBAAsB,GAA6C;IAC9E;QACE,WAAW,EAAE,sBAAsB;QACnC,cAAc,EAAE,2BAA2B;QAC3C,aAAa,EAAE,0BAA0B;QACzC,KAAK,EAAE;YACL,aAAa,EAAE,4BAA4B;YAC3C,GAAG,EAAE,0CAA0C;YAC/C,OAAO,EAAE,kDAAkD;YAC3D,SAAS,EAAE,yGAAyG;SACrH;QACD,oBAAoB,EAAE,0BAA0B;QAChD,mBAAmB,EAAE,6BAA6B;QAClD,SAAS,EAAE,mIAAmI;KAC/I;CACF,CAAC;AAEF,0FAA0F;AAC1F,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,W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AAmB,EAAE,CAAC,CAAC;YAC5E,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC;YACxB,IAAI,UAAuB,CAAC;YAC5B,IAAI,CAAC;gBACH,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,mBAAmB,IAAI,CAAC,CAAC;gBACzB,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAE,oCAAoC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC3G,SAAS;YACX,CAAC;YACD,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAC9B,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC;YACvC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC5B,IAAI,KAAK,CAAC,OAAO;gBAAE,OAAO;YAC1B,mBAAmB,GAAG,GAAG,EAAE,GAAG,SAAS,IAAI,uCAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC;YACjH,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC,CAAC;YACpF,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAE,oCAAoC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC7G,CAAC;IACH,CAAC,CAAC;IACF,KAAK,GAAG,EAAE,CAAC;IACX,OAAO;QACL,IAAI;YACF,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;YACrB,IAAI,EAAE,EAAE,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The local doubles a developer machine owes its application: a provider whose LOCAL secrets point its host at this\n * machine is served by a process that `wildo local dev` starts and keeps running.\n *\n * ## Why this exists\n *\n * Wonder Todos selects `azure-content-safety` for local development and points its host slot at the provider-simulators\n * double (`AZURE_CONTENT_SAFETY_HOST=127.0.0.1:18309`). Until this service, that double was started BY HAND, so after\n * every reboot nothing listened on the port, the classifier call failed with `ECONNREFUSED`, and every guarded agent's\n * reply was withheld as `OUTPUT_NOT_MODERATED` (\"This reply couldn't be checked against the content policy\"). The guard\n * was right to fail closed; the stack was wrong to leave the classifier it was told to use unstarted. Measured in four\n * separate sessions before this landed (2026-11-11 was the fifth).\n *\n * ## What it derives, and from what\n *\n * Nothing is authored for it. The local `secrets.json → providerEnv` already says where each provider is reached; a host\n * slot naming a loopback address WITH a port is a statement that this machine serves that provider, and the port is\n * where. A host naming anything else (a real vendor resource) is left alone: that is the developer's decision to use\n * the real service. A double is started only for a provider this table knows a double for.\n *\n * ## The table, and why it is a table\n *\n * {@link LOCAL_PROVIDER_DOUBLES} maps a provider to its double: which host and key slots the provider reads, and which\n * command line of `@wildo-ai/provider-simulators` stands in for it. The simulators import nothing from Wildo and this CLI\n * does not depend on them, so the join is written here and pinned by a test against both sides (the provider module's\n * slot names, the double's environment variables). Add a row when a new standalone double is added to the simulators.\n * The systems-of-record fleet is NOT a row: it is a separate plan (`wildo local sor-simulators`, #3039).\n *\n * ## Where the double comes from\n *\n * The same order as the fleet (`locateProviderSimulators`): the application's own `@wildo-ai/provider-simulators`\n * devDependency, then a framework checkout's source. An application with neither is TOLD, once, how to get one; the stack\n * still starts, and the guarded agents refuse their turns exactly as they would have.\n *\n * ## Who serves the port, and for how long\n *\n * Two applications on one machine may name the SAME port (Wonder Todos and Wonder Ledger both use 127.0.0.1:18309, with\n * one key). So a port that already answers is not a reason to give up on it: {@link superviseLocalProviderDouble} watches\n * it, and starts this stack's own double the moment it stops answering (the other stack stopped, or a double started by\n * hand died). A double of ours that exits is replaced only after the port is probed again, so a race for the port ends\n * with whoever holds it rather than a restart loop. The supervisor never kills a process it did not start.\n */\nimport { connect } from 'node:net';\n\nimport { locateProviderSimulators, type ProviderSimulatorsEntry, type ProviderSimulatorsLocation } from './system-of-record-simulators.service';\n\n/** One provider a local double can stand in for. */\nexport interface LocalProviderDoubleDefinition {\n /** The provider's ref, as the application's scope and selection name it. */\n readonly providerRef: string;\n /** The provider's host slot in `providerEnv`: `host:port` for a double. */\n readonly hostEnvVarName: string;\n /** The provider's API-key slot in `providerEnv`; the double is told to accept that key. */\n readonly keyEnvVarName: string;\n /** The simulators' command line for the double. */\n readonly entry: ProviderSimulatorsEntry;\n /** The double's own environment variable for the port to bind. */\n readonly doublePortEnvVarName: string;\n /** The double's own environment variable for the key it accepts. */\n readonly doubleKeyEnvVarName: string;\n /** What a person loses when the double is not running, for the one-line warning. */\n readonly withoutIt: string;\n}\n\n/** Every provider a standalone double stands in for. See the module comment for why this is a table. */\nexport const LOCAL_PROVIDER_DOUBLES: readonly LocalProviderDoubleDefinition[] = [\n {\n providerRef: 'azure-content-safety',\n hostEnvVarName: 'AZURE_CONTENT_SAFETY_HOST',\n keyEnvVarName: 'AZURE_CONTENT_SAFETY_KEY',\n entry: {\n checkoutEntry: 'src/content-safety/main.ts',\n bin: 'wildo-provider-simulators-content-safety',\n purpose: 'run the content-safety classifier double locally',\n otherwise: 'Or point AZURE_CONTENT_SAFETY_HOST at a real Azure AI Content Safety resource with `wildo secrets set`.',\n },\n doublePortEnvVarName: 'CONTENT_SAFETY_MOCK_PORT',\n doubleKeyEnvVarName: 'CONTENT_SAFETY_MOCK_API_KEY',\n withoutIt: 'every agent declaring contentGuardrails.promptInjection or outputModeration refuses or withholds its turns (OUTPUT_NOT_MODERATED)',\n },\n];\n\n/** Hosts that mean \"this machine\". `[::1]` is not one: the doubles bind IPv4 loopback. */\nconst LOOPBACK_HOSTNAMES: ReadonlySet<string> = new Set(['127.0.0.1', 'localhost']);\n\n/** A double this machine owes: the provider's definition, the port its host slot names, and the key it must accept. */\nexport interface PlannedLocalProviderDouble {\n readonly definition: LocalProviderDoubleDefinition;\n readonly port: number;\n /** The provider's key slot, which the double must accept; absent means the double's own default key. */\n readonly apiKey?: string;\n}\n\n/**\n * The doubles a `providerEnv` owes, in table order. Pure. A host slot that is absent, not a string, not loopback, or\n * carries no port owes nothing: the first three are a real vendor or no provider, and a loopback host without a port\n * names no place to serve.\n */\nexport function planLocalProviderDoubles(providerEnv: Readonly<Record<string, unknown>>): PlannedLocalProviderDouble[] {\n const planned: PlannedLocalProviderDouble[] = [];\n for (const definition of LOCAL_PROVIDER_DOUBLES) {\n const host = providerEnv[definition.hostEnvVarName];\n if (typeof host !== 'string' || host.trim() === '') continue;\n const port = loopbackPortOf(host.trim());\n if (port === undefined) continue;\n const apiKey = providerEnv[definition.keyEnvVarName];\n planned.push({ definition, port, ...(typeof apiKey === 'string' && apiKey !== '' ? { apiKey } : {}) });\n }\n return planned;\n}\n\n/** The port of a `host:port` slot value whose host is this machine; `undefined` otherwise (a bare host included). */\nexport function loopbackPortOf(hostSlotValue: string): number | undefined {\n let url: URL;\n try {\n // The slot holds a bare `host:port` (the engine refuses a scheme or a path); an accidental scheme is read too.\n url = new URL(/^[a-z]+:\\/\\//i.test(hostSlotValue) ? hostSlotValue : `http://${hostSlotValue}`);\n } catch {\n return undefined;\n }\n if (!LOOPBACK_HOSTNAMES.has(url.hostname) || url.port === '') return undefined;\n const port = Number(url.port);\n return Number.isInteger(port) && port > 0 && port <= 65_535 ? port : undefined;\n}\n\n/**\n * Whether something already accepts connections on `127.0.0.1:<port>`. A double already running (started by hand, or by\n * another stack of the same application) is left alone rather than raced for the port.\n */\nexport function isLoopbackPortAnswering(port: number, timeoutMs = 750): Promise<boolean> {\n return new Promise((resolve) => {\n const socket = connect({ host: '127.0.0.1', port });\n const settle = (answering: boolean): void => {\n socket.removeAllListeners();\n socket.destroy();\n resolve(answering);\n };\n socket.setTimeout(timeoutMs, () => settle(false));\n socket.once('connect', () => settle(true));\n socket.once('error', () => settle(false));\n });\n}\n\n/** How to run one planned double: the simulators' command line, with the port and key in its environment. */\nexport interface LocalProviderDoubleLaunch {\n readonly command: string;\n readonly args: readonly string[];\n readonly cwd: string;\n readonly env: NodeJS.ProcessEnv;\n readonly origin: ProviderSimulatorsLocation['origin'];\n}\n\n/**\n * The launch for a planned double. Throws `SystemOfRecordSimulatorsUnavailableError` (the simulators' shared refusal,\n * whose message names the devDependency to add) when neither the application nor a framework checkout has the package.\n */\nexport function resolveLocalProviderDoubleLaunch(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n readonly planned: PlannedLocalProviderDouble;\n readonly baseEnv?: NodeJS.ProcessEnv;\n}): LocalProviderDoubleLaunch {\n const { definition, port, apiKey } = input.planned;\n const location = locateProviderSimulators({ saasRoot: input.saasRoot, frameworkRoot: input.frameworkRoot, entry: definition.entry });\n return {\n command: location.command,\n args: [...location.launchArguments],\n cwd: location.cwd,\n origin: location.origin,\n env: {\n ...(input.baseEnv ?? process.env),\n [definition.doublePortEnvVarName]: String(port),\n ...(apiKey === undefined ? {} : { [definition.doubleKeyEnvVarName]: apiKey }),\n },\n };\n}\n\n/** A running double, as the supervisor sees it: something that ends. */\nexport interface LocalProviderDoubleGeneration {\n readonly exit: Promise<number>;\n}\n\n/** What the supervisor reports, so the caller decides how to word it. */\nexport enum LocalProviderDoubleEvent {\n /** Another process answers on the port; this stack watches it and starts nothing. */\n SERVED_ELSEWHERE = 'served-elsewhere',\n /** This stack starts its own double (first start, or the port stopped answering). */\n STARTING = 'starting',\n /** This stack's double exited while the stack runs; the port is probed again before anything is restarted. */\n EXITED = 'exited',\n}\n\nexport interface LocalProviderDoubleSupervisor {\n stop(): void;\n}\n\n/** How often a port served by somebody else is checked, and the cap on the delay after repeated exits. */\nexport const LOCAL_PROVIDER_DOUBLE_WATCH_INTERVAL_MS = 10_000;\nconst LOCAL_PROVIDER_DOUBLE_MAX_BACKOFF_MS = 30_000;\nconst LOCAL_PROVIDER_DOUBLE_HEALTHY_UPTIME_MS = 30_000;\n\n/**\n * Keep one port served for as long as the stack runs (see the module comment). `start` spawns this stack's double;\n * `onEvent` is told when the port is served elsewhere, when a double is started, and when one exits (with the exit code\n * and the number of consecutive short-lived exits, which a caller can use to decide when to warn). Never throws.\n */\nexport function superviseLocalProviderDouble<TGeneration extends LocalProviderDoubleGeneration>(options: {\n readonly port: number;\n readonly start: () => TGeneration;\n readonly onStarted: (generation: TGeneration) => void;\n readonly onEnded: (generation: TGeneration) => void;\n readonly onEvent: (event: LocalProviderDoubleEvent, detail: { readonly exitCode?: number; readonly consecutiveFailures: number }) => void;\n readonly probe?: (port: number) => Promise<boolean>;\n readonly sleep?: (ms: number, signal: { readonly stopped: boolean }) => Promise<void>;\n readonly now?: () => number;\n readonly watchIntervalMs?: number;\n}): LocalProviderDoubleSupervisor {\n const probe = options.probe ?? isLoopbackPortAnswering;\n const now = options.now ?? Date.now;\n const watchIntervalMs = options.watchIntervalMs ?? LOCAL_PROVIDER_DOUBLE_WATCH_INTERVAL_MS;\n const state = { stopped: false };\n let wake: (() => void) | undefined;\n const sleep = options.sleep ?? ((ms: number) => new Promise<void>((resolve) => {\n const timer = setTimeout(() => { wake = undefined; resolve(); }, ms);\n timer.unref?.();\n wake = () => { clearTimeout(timer); wake = undefined; resolve(); };\n }));\n\n const run = async (): Promise<void> => {\n let servedElsewhereReported = false;\n let consecutiveFailures = 0;\n while (!state.stopped) {\n let answering = false;\n try {\n answering = await probe(options.port);\n } catch {\n answering = false;\n }\n if (state.stopped) return;\n if (answering) {\n if (!servedElsewhereReported) options.onEvent(LocalProviderDoubleEvent.SERVED_ELSEWHERE, { consecutiveFailures });\n servedElsewhereReported = true;\n await sleep(watchIntervalMs, state);\n continue;\n }\n servedElsewhereReported = false;\n options.onEvent(LocalProviderDoubleEvent.STARTING, { consecutiveFailures });\n const startedAt = now();\n let generation: TGeneration;\n try {\n generation = options.start();\n } catch {\n consecutiveFailures += 1;\n await sleep(Math.min(1_000 * 2 ** (consecutiveFailures - 1), LOCAL_PROVIDER_DOUBLE_MAX_BACKOFF_MS), state);\n continue;\n }\n options.onStarted(generation);\n const exitCode = await generation.exit;\n options.onEnded(generation);\n if (state.stopped) return;\n consecutiveFailures = now() - startedAt >= LOCAL_PROVIDER_DOUBLE_HEALTHY_UPTIME_MS ? 1 : consecutiveFailures + 1;\n options.onEvent(LocalProviderDoubleEvent.EXITED, { exitCode, consecutiveFailures });\n await sleep(Math.min(1_000 * 2 ** (consecutiveFailures - 1), LOCAL_PROVIDER_DOUBLE_MAX_BACKOFF_MS), state);\n }\n };\n void run();\n return {\n stop(): void {\n state.stopped = true;\n wake?.();\n },\n };\n}\n"]}
@@ -24,6 +24,23 @@ export interface ProviderSimulatorsLocation {
24
24
  readonly launchArguments: readonly string[];
25
25
  readonly cwd: string;
26
26
  }
27
+ /**
28
+ * One command line of the simulators package, in its two forms: the SOURCE entry run with tsx from a framework checkout,
29
+ * and the `bin` a published copy declares. The developer fleet is one; a standalone double (the content-safety
30
+ * classifier, `local-provider-doubles.service.ts`) is another, which is why the locators below take one.
31
+ */
32
+ export interface ProviderSimulatorsEntry {
33
+ /** Relative to the package root, as source: `src/…/main.ts`. */
34
+ readonly checkoutEntry: string;
35
+ /** The `bin` name the published package declares for it. */
36
+ readonly bin: string;
37
+ /** What the command line is for, completing "To …": named in the remedy when the package is missing. */
38
+ readonly purpose: string;
39
+ /** The way out that needs no simulator, appended to that remedy. */
40
+ readonly otherwise: string;
41
+ }
42
+ /** The developer fleet's command line: the default every locator below is asked for. */
43
+ export declare const DEVELOPER_FLEET_SIMULATORS_ENTRY: ProviderSimulatorsEntry;
27
44
  /** The one line the plan command prints, before its JSON. Mirrors `DEVELOPER_FLEET_PLAN_SENTINEL` in the package. */
28
45
  export declare const DEVELOPER_FLEET_PLAN_SENTINEL = "__DEVELOPER_FLEET_PLAN__";
29
46
  /**
@@ -108,7 +125,7 @@ export interface SystemOfRecordSimulatorsContext {
108
125
  * The remedy when the application has no fleet: the devDependency to declare, and the other way out. When the application
109
126
  * already declares it, the remedy is only the install. One function, so the verbs and their tests name the same thing.
110
127
  */
111
- export declare function describeMissingProviderSimulators(saasRoot: string): string;
128
+ export declare function describeMissingProviderSimulators(saasRoot: string, entryPoint?: ProviderSimulatorsEntry): string;
112
129
  /**
113
130
  * The package as the APPLICATION resolves it, or `null` when the application does not have it. Throws when it has it
114
131
  * but cannot run it: the application chose that copy, so it is reported rather than replaced by another.
@@ -118,7 +135,7 @@ export declare function describeMissingProviderSimulators(saasRoot: string): str
118
135
  * since a manifest is not a code subpath, and resolving through `exports` would also turn any resolution error into "not
119
136
  * installed" and quietly fall back to a checkout.
120
137
  */
121
- export declare function resolveInstalledProviderSimulators(saasRoot: string): ProviderSimulatorsLocation | null;
138
+ export declare function resolveInstalledProviderSimulators(saasRoot: string, entryPoint?: ProviderSimulatorsEntry): ProviderSimulatorsLocation | null;
122
139
  /**
123
140
  * Where the developer fleet's command line is: the application's own copy first, then the framework checkout, else
124
141
  * COULD-NOT-ASK naming the devDependency to add (#3047).
@@ -126,6 +143,8 @@ export declare function resolveInstalledProviderSimulators(saasRoot: string): Pr
126
143
  export declare function locateProviderSimulators(input: {
127
144
  readonly saasRoot: string;
128
145
  readonly frameworkRoot: string | null;
146
+ /** Which command line of the package; the developer fleet when omitted. */
147
+ readonly entry?: ProviderSimulatorsEntry;
129
148
  }): ProviderSimulatorsLocation;
130
149
  /**
131
150
  * The application's port base: the lowest `defaultPort` among its backend services (a service with no `frontendType`),
@@ -1 +1 @@
1
- {"version":3,"file":"system-of-record-simulators.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/system-of-record-simulators.service.ts"],"names":[],"mappings":"AAmDA,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAI5H,OAAO,EAAE,oCAAoC,EAAE,KAAK,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AAG5I,kEAAkE;AAClE,eAAO,MAAM,iCAAiC,yCAAyC,CAAC;AAExF,kHAAkH;AAClH,eAAO,MAAM,2BAA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E,CAAA;CAAE,CA8B1F;AAED,uGAAuG;AACvG,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAE/I;AAOD,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,gBAAgB,EAAE,CAS/K;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAS9J;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB7F;AAED,iFAAiF;AACjF,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,IAAI,CAAC,+BAA+B,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG,MAAM,CAQjI"}
1
+ {"version":3,"file":"system-of-record-simulators.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/system-of-record-simulators.service.ts"],"names":[],"mappings":"AAmDA,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAI5H,OAAO,EAAE,oCAAoC,EAAE,KAAK,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AAG5I,kEAAkE;AAClE,eAAO,MAA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AM,EAAE,CAS9J;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB7F;AAED,iFAAiF;AACjF,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,IAAI,CAAC,+BAA+B,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG,MAAM,CAQjI"}
@@ -75,6 +75,13 @@ export var ProviderSimulatorsOrigin;
75
75
  /** The framework checkout's source, from the simulators' own lockfile. */
76
76
  ProviderSimulatorsOrigin["CHECKOUT"] = "checkout";
77
77
  })(ProviderSimulatorsOrigin || (ProviderSimulatorsOrigin = {}));
78
+ /** The developer fleet's command line: the default every locator below is asked for. */
79
+ export const DEVELOPER_FLEET_SIMULATORS_ENTRY = {
80
+ checkoutEntry: DEVELOPER_FLEET_ENTRY,
81
+ bin: DEVELOPER_FLEET_BIN,
82
+ purpose: 'run its systems of record locally',
83
+ otherwise: 'Or point each instance at a real vendor: its address in the local infra config, its secret with `wildo secrets set`.',
84
+ };
78
85
  /** The one line the plan command prints, before its JSON. Mirrors `DEVELOPER_FLEET_PLAN_SENTINEL` in the package. */
79
86
  export const DEVELOPER_FLEET_PLAN_SENTINEL = '__DEVELOPER_FLEET_PLAN__';
80
87
  /**
@@ -118,13 +125,13 @@ export class SystemOfRecordSimulatorsUnavailableError extends Error {
118
125
  * The remedy when the application has no fleet: the devDependency to declare, and the other way out. When the application
119
126
  * already declares it, the remedy is only the install. One function, so the verbs and their tests name the same thing.
120
127
  */
121
- export function describeMissingProviderSimulators(saasRoot) {
122
- const otherwise = 'Or point each instance at a real vendor: its address in the local infra config, its secret with `wildo secrets set`.';
128
+ export function describeMissingProviderSimulators(saasRoot, entryPoint = DEVELOPER_FLEET_SIMULATORS_ENTRY) {
129
+ const otherwise = entryPoint.otherwise;
123
130
  if (applicationDeclaresProviderSimulators(saasRoot)) {
124
131
  return `The application declares ${PROVIDER_SIMULATORS_PACKAGE} but it is not installed: run \`wildo config sync\` (it links the package to `
125
132
  + `your framework release) and \`pnpm install\`. ${otherwise}`;
126
133
  }
127
- return `The provider simulator fleet is not installed in this application. To run its systems of record locally, add `
134
+ return `The provider simulators are not installed in this application. To ${entryPoint.purpose}, add `
128
135
  + `"${PROVIDER_SIMULATORS_PACKAGE}": "*" to the devDependencies of the application's root package.json, run \`wildo config sync\` `
129
136
  + `(it links the package to your framework release) and \`pnpm install\`. ${otherwise}`;
130
137
  }
@@ -150,7 +157,7 @@ function applicationDeclaresProviderSimulators(saasRoot) {
150
157
  * since a manifest is not a code subpath, and resolving through `exports` would also turn any resolution error into "not
151
158
  * installed" and quietly fall back to a checkout.
152
159
  */
153
- export function resolveInstalledProviderSimulators(saasRoot) {
160
+ export function resolveInstalledProviderSimulators(saasRoot, entryPoint = DEVELOPER_FLEET_SIMULATORS_ENTRY) {
154
161
  const lookup = createRequire(join(saasRoot, 'package.json')).resolve.paths(PROVIDER_SIMULATORS_PACKAGE) ?? [];
155
162
  const candidate = lookup.map((directory) => join(directory, PROVIDER_SIMULATORS_PACKAGE)).find((root) => existsSync(join(root, 'package.json')));
156
163
  if (candidate === undefined)
@@ -163,12 +170,13 @@ export function resolveInstalledProviderSimulators(saasRoot) {
163
170
  catch (error) {
164
171
  throw new SystemOfRecordSimulatorsUnavailableError(`The application has ${PROVIDER_SIMULATORS_PACKAGE} at ${root}, but its package.json cannot be read (${error.message}). Reinstall it with \`pnpm install\`.`);
165
172
  }
166
- const binEntry = typeof manifest.bin === 'object' ? manifest.bin[DEVELOPER_FLEET_BIN] : undefined;
173
+ const binEntry = typeof manifest.bin === 'object' ? manifest.bin[entryPoint.bin] : undefined;
167
174
  const entry = binEntry === undefined ? undefined : join(root, binEntry);
168
175
  if (entry === undefined || !existsSync(entry)) {
169
176
  throw new SystemOfRecordSimulatorsUnavailableError(`The application has ${PROVIDER_SIMULATORS_PACKAGE}${manifest.version === undefined ? '' : `@${manifest.version}`} at ${root}, but it carries no `
170
- + `built developer fleet (its \`${DEVELOPER_FLEET_BIN}\` command line${entry === undefined ? ' is not declared' : ` is missing: ${entry}`}). `
171
- + 'Reinstall it with `pnpm install`. When it is linked to a framework checkout, build it there first: '
177
+ + `built \`${entryPoint.bin}\` command line (${entry === undefined ? 'it is not declared' : `it is missing: ${entry}`}). `
178
+ + 'Reinstall it with `pnpm install`; when the command line is not declared at all, the installed release predates it, so move '
179
+ + 'to a framework release that carries it (`wildo update`). When it is linked to a framework checkout, build it there first: '
172
180
  + `(cd <framework>/${PROVIDER_SIMULATORS_RELATIVE_PATH} && pnpm install && pnpm run build).`);
173
181
  }
174
182
  return { origin: ProviderSimulatorsOrigin.APPLICATION, root, command: process.execPath, launchArguments: [SILENCED_NODE_WARNING, entry], cwd: saasRoot };
@@ -178,19 +186,20 @@ export function resolveInstalledProviderSimulators(saasRoot) {
178
186
  * COULD-NOT-ASK naming the devDependency to add (#3047).
179
187
  */
180
188
  export function locateProviderSimulators(input) {
181
- const installed = resolveInstalledProviderSimulators(input.saasRoot);
189
+ const entryPoint = input.entry ?? DEVELOPER_FLEET_SIMULATORS_ENTRY;
190
+ const installed = resolveInstalledProviderSimulators(input.saasRoot, entryPoint);
182
191
  if (installed !== null)
183
192
  return installed;
184
193
  if (input.frameworkRoot === null)
185
- throw new SystemOfRecordSimulatorsUnavailableError(describeMissingProviderSimulators(input.saasRoot));
194
+ throw new SystemOfRecordSimulatorsUnavailableError(describeMissingProviderSimulators(input.saasRoot, entryPoint));
186
195
  const simulatorsRoot = join(input.frameworkRoot, PROVIDER_SIMULATORS_RELATIVE_PATH);
187
- if (!existsSync(join(simulatorsRoot, DEVELOPER_FLEET_ENTRY))) {
188
- throw new SystemOfRecordSimulatorsUnavailableError(`The framework checkout at ${input.frameworkRoot} has no developer fleet (${PROVIDER_SIMULATORS_RELATIVE_PATH}/${DEVELOPER_FLEET_ENTRY}); update it.`);
196
+ if (!existsSync(join(simulatorsRoot, entryPoint.checkoutEntry))) {
197
+ throw new SystemOfRecordSimulatorsUnavailableError(`The framework checkout at ${input.frameworkRoot} has no ${entryPoint.bin} (${PROVIDER_SIMULATORS_RELATIVE_PATH}/${entryPoint.checkoutEntry}); update it.`);
189
198
  }
190
199
  if (!existsSync(join(simulatorsRoot, 'node_modules'))) {
191
200
  throw new SystemOfRecordSimulatorsUnavailableError(`The provider simulators are not installed. They keep their own lockfile:\n\n (cd ${simulatorsRoot} && pnpm install)\n`);
192
201
  }
193
- return { origin: ProviderSimulatorsOrigin.CHECKOUT, root: simulatorsRoot, command: 'pnpm', launchArguments: ['exec', 'tsx', DEVELOPER_FLEET_ENTRY], cwd: simulatorsRoot };
202
+ return { origin: ProviderSimulatorsOrigin.CHECKOUT, root: simulatorsRoot, command: 'pnpm', launchArguments: ['exec', 'tsx', entryPoint.checkoutEntry], cwd: simulatorsRoot };
194
203
  }
195
204
  /**
196
205
  * The application's port base: the lowest `defaultPort` among its backend services (a service with no `frontendType`),
@@ -1 +1 @@
1
- {"version":3,"file":"system-of-record-simulators.service.js","sourceRoot":"","sources":["../../../../src/services/application/system-of-record-simulators.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAW,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAA4D,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACxH,OAAO,EAAE,o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AAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACpM,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,0CAA0C,CAAC,CAAC;IAC3J,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Runs an application's systems of record against the provider simulator fleet on a developer machine (#3039): the\n * service behind `wildo local sor-simulators`, `wildo local sor-secrets` and `wildo local sor-addresses`.\n *\n * ## What it derives, and from what\n *\n * Everything is derived from what the application already declares, so a created application gets a working local ERP\n * the moment its CONFIG task declares an instance, with nothing restated by hand:\n *\n * - **which instances**: `systemsOfRecord` in `wildo.saas.config.ts`, kept to those whose LOCAL address is absent or\n * loopback. An instance addressed at a real vendor, or declared `{ enabled: false }`, is the developer's decision and\n * is reported, never overridden.\n * - **which ports**: the application's port block, its allocated port base (the lowest backend `defaultPort`, which\n * `wildo init`'s allocator keeps unique among sibling applications) plus {@link SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET}.\n * Two applications on one machine therefore never contend for a face.\n * - **which data**: `system-of-record-simulators/fleet.dataset.ts` (neutral) or `fleet.fixture.ts` (vendor-shaped) at\n * the application root, else the fleet's starter dataset.\n * - **addresses, secrets, faces**: the simulators package's developer-fleet plan, asked through its own command line,\n * because that package is not a dependency of this CLI. Where that command line is found is\n * {@link locateProviderSimulators}.\n *\n * ## The join with the engine\n *\n * The plan restates each vendor's slots, because the simulators import nothing from Wildo. So before a secret is seeded\n * or an address written, the plan is checked against the slots the ENGINE resolves for the instance\n * ({@link resolveDeclaredSystemOfRecordSecrets}): a required slot the plan does not fill, or a slot the engine does not\n * have, refuses that instance. A double cannot silently drift from the facet it stands in for.\n *\n * ## Where the fleet comes from (#3047)\n *\n * `@wildo-ai/provider-simulators` is a published OPT-IN framework package (decided by Paul, 2026-10-21): an application\n * that wants a local system of record declares it as a devDependency of its root (`\"*\"`, linked by `wildo config sync`\n * to its framework release, or to a `file:` path in a framework checkout). The fleet is looked for in this order:\n *\n * 1. **the application's own `node_modules`**: the package it declared, run as its `bin` with this CLI's node. That is\n * what an application created in app-creator mode has, and what a framework-development application that declares\n * the package runs too, so both modes run the same artifact;\n * 2. **the framework checkout**: the package's source, run with tsx from its own lockfile. What the dogfood applications\n * use, since they do not declare it;\n * 3. neither: every verb answers COULD-NOT-ASK (exit 2) naming the devDependency to add, never a blocked task. Pointing\n * the instance at a real vendor is the other way out.\n *\n * An application that declares the package and has it broken (installed without its build) is refused with that\n * remedy, rather than silently served from a checkout it did not choose.\n */\nimport { spawn, spawnSync } from 'node:child_process';\nimport { generateKeyPairSync } from 'node:crypto';\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nimport { WildoLocationType, type WildoSaasConfig, type WildoSystemsOfRecordEnvConfig } from '@wildo-ai/platform-config-lib';\nimport { deriveSystemOfRecordEnvVarName } from '@wildo-ai/saas-models';\n\nimport { loadAuthoredInfraEnvConfig, resolveAuthoredInfraConfigPath } from '../environment/authored-infra-config.utils';\nimport { resolveDeclaredSystemOfRecordSecrets, type DeclaredSystemOfRecordSecrets } from '../credentials/application-secret-owners.service';\nimport { writeInstanceAddresses } from './infra-system-of-record-addresses.editor';\n\n/** The simulators package, relative to the framework checkout. */\nexport const PROVIDER_SIMULATORS_RELATIVE_PATH = 'platform/testing/provider-simulators';\n\n/** The simulators' published package name: the devDependency an application declares to run the fleet (#3047). */\nexport const PROVIDER_SIMULATORS_PACKAGE = '@wildo-ai/provider-simulators';\n\n/** The developer fleet's command line inside that package, as SOURCE (the checkout form, run with tsx). */\nexport const DEVELOPER_FLEET_ENTRY = 'src/developer-fleet/main.ts';\n\n/** The developer fleet's command line as the published package declares it: its `bin` name (the installed form). */\nexport const DEVELOPER_FLEET_BIN = 'wildo-provider-simulators-fleet';\n\n/**\n * Node's warning when it loads the application's `.ts` data module from a package with no `\"type\"`: true, harmless, and\n * printed on stderr, whose LAST line is how a refusal is reported. Silenced in the installed form, where node (not tsx)\n * loads that module.\n */\nconst SILENCED_NODE_WARNING = '--disable-warning=MODULE_TYPELESS_PACKAGE_JSON';\n\n/** Where the fleet's command line was found. */\nexport enum ProviderSimulatorsOrigin {\n /** The application's own `node_modules`: the package it declared as a devDependency. */\n APPLICATION = 'application',\n /** The framework checkout's source, from the simulators' own lockfile. */\n CHECKOUT = 'checkout',\n}\n\n/** How to run the developer fleet's command line: `command ...launchArguments <subcommand> …`, in `cwd`. */\nexport interface ProviderSimulatorsLocation {\n readonly origin: ProviderSimulatorsOrigin;\n /** The package root that was found. */\n readonly root: string;\n readonly command: string;\n readonly launchArguments: readonly string[];\n readonly cwd: string;\n}\n\n/** The one line the plan command prints, before its JSON. Mirrors `DEVELOPER_FLEET_PLAN_SENTINEL` in the package. */\nexport const DEVELOPER_FLEET_PLAN_SENTINEL = '__DEVELOPER_FLEET_PLAN__';\n\n/**\n * The application's simulator port block starts this far above its port base: 4301 → 18301, 4311 → 18311. The block the\n * two dogfood applications already used, and above every port tier the CLI allocates (4xxx services, 5xxx platform), so\n * it cannot meet one of them. A port base is allocated on a stride of 10 and the fleet uses 8 of the 10.\n */\nexport const SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET = 14_000;\n\n/** Where an application keeps the records its fleet serves, relative to its root. The two forms are exclusive. */\nexport const APPLICATION_FLEET_DATASET_RELATIVE_PATH = 'system-of-record-simulators/fleet.dataset.ts';\nexport const APPLICATION_FLEET_FIXTURE_RELATIVE_PATH = 'system-of-record-simulators/fleet.fixture.ts';\n\n/** The environment these verbs act on: the developer machine. */\nconst LOCAL_ENVIRONMENT = WildoLocationType.LOCAL;\n\n/** Hosts an address may name and still be \"this machine's fleet\". */\nconst LOOPBACK_HOSTS: ReadonlySet<string> = new Set(['127.0.0.1', 'localhost', '[::1]', '::1']);\n\n/**\n * How many ports of the application's block the fleet may use: the faces sit at offsets 0–7 (the simulators'\n * `DEVELOPER_FLEET_FACE_PORT_OFFSET`). An address on this machine OUTSIDE that range is not the fleet's — a vendor\n * sandbox tunnelled to localhost, another double — and is left alone with its real secret.\n */\nexport const FLEET_PORT_BLOCK_SIZE = 8;\n\n/** What a verb decided about one declared instance's local address. */\nexport enum SystemOfRecordLocalStanding {\n /** No address yet, or a loopback one inside the application's fleet port block: the fleet serves it. */\n FLEET = 'fleet',\n /** `{ enabled: false }`: the environment says it has no access. Left alone. */\n DECLARED_ABSENT = 'declared-absent',\n /**\n * Addressed somewhere the fleet does not listen: another host (a real vendor), or this machine outside the fleet's\n * port block (a tunnelled sandbox, another double). Left alone, address and secret.\n */\n REAL_VENDOR = 'real-vendor',\n}\n\nexport interface ClassifiedSystemOfRecordInstance {\n readonly name: string;\n readonly vendor: string;\n readonly credentialKind?: string;\n /** The dialect the instance declares — it decides the fleet's plan for a vendor spoken over several wires (#3391). */\n readonly dialect: string;\n readonly standing: SystemOfRecordLocalStanding;\n /** The address the local infra config authors today, when it authors one. */\n readonly currentAddress?: Readonly<Record<string, string>>;\n}\n\n/** The plan as the simulators print it: the JSON contract of `main.ts plan`, minus nothing this CLI reads. */\nexport interface DeveloperFleetPlanContract {\n readonly portBlockStart: number;\n readonly faces: ReadonlyArray<{ readonly face: string; readonly port: number }>;\n readonly instances: ReadonlyArray<{\n readonly name: string;\n readonly vendor: string;\n readonly face: string;\n readonly credentialKind: string;\n readonly address: Readonly<Record<string, string>>;\n readonly secrets: ReadonlyArray<{ readonly slot: string; readonly source: string; readonly value?: string }>;\n }>;\n readonly unserved: ReadonlyArray<{ readonly name: string; readonly vendor: string; readonly reason: string }>;\n readonly dataKind: string;\n readonly omissions: readonly string[];\n}\n\n/** The value of `secrets[].source` that asks the caller to generate a private key (`DeveloperFleetSecretSource`). */\nexport const GENERATE_RSA_PKCS8_PRIVATE_KEY = 'generate-rsa-pkcs8-private-key';\n\n/** A verb that could not even ask: the fleet is unreachable, or the application gives it nothing to plan. */\nexport class SystemOfRecordSimulatorsUnavailableError extends Error {}\n\nexport interface SystemOfRecordSimulatorsContext {\n readonly saasRoot: string;\n readonly simulators: ProviderSimulatorsLocation;\n readonly portBlockStart: number;\n readonly instances: readonly ClassifiedSystemOfRecordInstance[];\n /** `['--dataset', path]`, `['--fixture', path]`, or `[]` for the starter dataset. */\n readonly dataArguments: readonly string[];\n readonly infraConfigPath: string;\n}\n\n/**\n * The remedy when the application has no fleet: the devDependency to declare, and the other way out. When the application\n * already declares it, the remedy is only the install. One function, so the verbs and their tests name the same thing.\n */\nexport function describeMissingProviderSimulators(saasRoot: string): string {\n const otherwise = 'Or point each instance at a real vendor: its address in the local infra config, its secret with `wildo secrets set`.';\n if (applicationDeclaresProviderSimulators(saasRoot)) {\n return `The application declares ${PROVIDER_SIMULATORS_PACKAGE} but it is not installed: run \\`wildo config sync\\` (it links the package to `\n + `your framework release) and \\`pnpm install\\`. ${otherwise}`;\n }\n return `The provider simulator fleet is not installed in this application. To run its systems of record locally, add `\n + `\"${PROVIDER_SIMULATORS_PACKAGE}\": \"*\" to the devDependencies of the application's root package.json, run \\`wildo config sync\\` `\n + `(it links the package to your framework release) and \\`pnpm install\\`. ${otherwise}`;\n}\n\n/** Whether the application's root manifest declares the simulators, in any dependency field. */\nfunction applicationDeclaresProviderSimulators(saasRoot: string): boolean {\n const manifestPath = join(saasRoot, 'package.json');\n if (!existsSync(manifestPath)) return false;\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Partial<Record<string, Record<string, string>>>;\n return ['dependencies', 'devDependencies', 'optionalDependencies'].some((field) => manifest[field]?.[PROVIDER_SIMULATORS_PACKAGE] !== undefined);\n } catch {\n return false;\n }\n}\n\n/**\n * The package as the APPLICATION resolves it, or `null` when the application does not have it. Throws when it has it\n * but cannot run it: the application chose that copy, so it is reported rather than replaced by another.\n *\n * Found by Node's own lookup order (`require.resolve.paths`: the `node_modules` directories from the application root\n * upward), reading the manifest at each, rather than by resolving a specifier: the package exports no `./package.json`,\n * since a manifest is not a code subpath, and resolving through `exports` would also turn any resolution error into \"not\n * installed\" and quietly fall back to a checkout.\n */\nexport function resolveInstalledProviderSimulators(saasRoot: string): ProviderSimulatorsLocation | null {\n const lookup = createRequire(join(saasRoot, 'package.json')).resolve.paths(PROVIDER_SIMULATORS_PACKAGE) ?? [];\n const candidate = lookup.map((directory) => join(directory, PROVIDER_SIMULATORS_PACKAGE)).find((root) => existsSync(join(root, 'package.json')));\n if (candidate === undefined) return null;\n const root = realpathSync(candidate);\n let manifest: { bin?: Record<string, string> | string; version?: string };\n try {\n manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as typeof manifest;\n } catch (error) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The application has ${PROVIDER_SIMULATORS_PACKAGE} at ${root}, but its package.json cannot be read (${(error as Error).message}). Reinstall it with \\`pnpm install\\`.`);\n }\n const binEntry = typeof manifest.bin === 'object' ? manifest.bin[DEVELOPER_FLEET_BIN] : undefined;\n const entry = binEntry === undefined ? undefined : join(root, binEntry);\n if (entry === undefined || !existsSync(entry)) {\n throw new SystemOfRecordSimulatorsUnavailableError(\n `The application has ${PROVIDER_SIMULATORS_PACKAGE}${manifest.version === undefined ? '' : `@${manifest.version}`} at ${root}, but it carries no `\n + `built developer fleet (its \\`${DEVELOPER_FLEET_BIN}\\` command line${entry === undefined ? ' is not declared' : ` is missing: ${entry}`}). `\n + 'Reinstall it with `pnpm install`. When it is linked to a framework checkout, build it there first: '\n + `(cd <framework>/${PROVIDER_SIMULATORS_RELATIVE_PATH} && pnpm install && pnpm run build).`,\n );\n }\n return { origin: ProviderSimulatorsOrigin.APPLICATION, root, command: process.execPath, launchArguments: [SILENCED_NODE_WARNING, entry], cwd: saasRoot };\n}\n\n/**\n * Where the developer fleet's command line is: the application's own copy first, then the framework checkout, else\n * COULD-NOT-ASK naming the devDependency to add (#3047).\n */\nexport function locateProviderSimulators(input: { readonly saasRoot: string; readonly frameworkRoot: string | null }): ProviderSimulatorsLocation {\n const installed = resolveInstalledProviderSimulators(input.saasRoot);\n if (installed !== null) return installed;\n if (input.frameworkRoot === null) throw new SystemOfRecordSimulatorsUnavailableError(describeMissingProviderSimulators(input.saasRoot));\n const simulatorsRoot = join(input.frameworkRoot, PROVIDER_SIMULATORS_RELATIVE_PATH);\n if (!existsSync(join(simulatorsRoot, DEVELOPER_FLEET_ENTRY))) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The framework checkout at ${input.frameworkRoot} has no developer fleet (${PROVIDER_SIMULATORS_RELATIVE_PATH}/${DEVELOPER_FLEET_ENTRY}); update it.`);\n }\n if (!existsSync(join(simulatorsRoot, 'node_modules'))) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The provider simulators are not installed. They keep their own lockfile:\\n\\n (cd ${simulatorsRoot} && pnpm install)\\n`);\n }\n return { origin: ProviderSimulatorsOrigin.CHECKOUT, root: simulatorsRoot, command: 'pnpm', launchArguments: ['exec', 'tsx', DEVELOPER_FLEET_ENTRY], cwd: simulatorsRoot };\n}\n\n/**\n * The application's port base: the lowest `defaultPort` among its backend services (a service with no `frontendType`),\n * which is what `wildo init` allocated. Refused when no backend declares one: an invented block could land on another\n * application's fleet.\n */\nexport function resolveApplicationPortBase(saasConfig: Pick<WildoSaasConfig, 'services'>): number {\n const ports = Object.values(saasConfig.services ?? {})\n .filter((service) => service.frontendType === undefined && typeof service.defaultPort === 'number')\n .map((service) => service.defaultPort as number);\n if (ports.length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('No backend service in wildo.saas.config.ts declares a `defaultPort`, so the application has no port block for its simulators.');\n }\n return Math.min(...ports);\n}\n\n/** Is this address the fleet's: on this machine, on a port of the application's fleet block? */\nfunction isFleetAddress(address: Readonly<Record<string, string>>, portBlockStart: number): boolean {\n const baseUrl = address.baseUrl;\n if (baseUrl === undefined) return false;\n try {\n const url = new URL(baseUrl);\n const port = Number(url.port);\n return LOOPBACK_HOSTS.has(url.hostname) && Number.isInteger(port) && port >= portBlockStart && port < portBlockStart + FLEET_PORT_BLOCK_SIZE;\n } catch {\n return false;\n }\n}\n\n/** Every declared instance with its local standing. Pure over the two declarations and the application's port block. */\nexport function classifySystemOfRecordInstances(\n declared: WildoSaasConfig['systemsOfRecord'],\n localAddresses: WildoSystemsOfRecordEnvConfig | undefined,\n portBlockStart: number,\n): ClassifiedSystemOfRecordInstance[] {\n return Object.entries(declared ?? {}).map(([name, declaration]) => {\n const local = localAddresses?.[name];\n const base = {\n name,\n vendor: declaration.vendor,\n dialect: declaration.dialect,\n ...(declaration.credential?.kind === undefined ? {} : { credentialKind: declaration.credential.kind }),\n };\n if (local !== undefined && 'enabled' in local) return { ...base, standing: SystemOfRecordLocalStanding.DECLARED_ABSENT };\n const currentAddress = local === undefined || !('address' in local) ? undefined : local.address;\n if (currentAddress === undefined) return { ...base, standing: SystemOfRecordLocalStanding.FLEET };\n return { ...base, currentAddress, standing: isFleetAddress(currentAddress, portBlockStart) ? SystemOfRecordLocalStanding.FLEET : SystemOfRecordLocalStanding.REAL_VENDOR };\n });\n}\n\n/** The application's data module, as plan arguments. Both forms present is refused: a fleet starts from one. */\nexport function resolveApplicationFleetData(saasRoot: string): string[] {\n const dataset = join(saasRoot, APPLICATION_FLEET_DATASET_RELATIVE_PATH);\n const fixture = join(saasRoot, APPLICATION_FLEET_FIXTURE_RELATIVE_PATH);\n if (existsSync(dataset) && existsSync(fixture)) {\n throw new SystemOfRecordSimulatorsUnavailableError(`Both ${APPLICATION_FLEET_DATASET_RELATIVE_PATH} and ${APPLICATION_FLEET_FIXTURE_RELATIVE_PATH} exist; a fleet starts from one description of its data. Remove one.`);\n }\n if (existsSync(dataset)) return ['--dataset', dataset];\n if (existsSync(fixture)) return ['--fixture', fixture];\n return [];\n}\n\n/** Everything a verb needs, loaded once. */\nexport async function loadSystemOfRecordSimulatorsContext(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n readonly saasConfig: WildoSaasConfig;\n}): Promise<SystemOfRecordSimulatorsContext> {\n const simulators = locateProviderSimulators({ saasRoot: input.saasRoot, frameworkRoot: input.frameworkRoot });\n if (Object.keys(input.saasConfig.systemsOfRecord ?? {}).length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('wildo.saas.config.ts declares no system of record, so there is nothing for the simulators to serve.');\n }\n const infra = await loadAuthoredInfraEnvConfig(LOCAL_ENVIRONMENT, input.saasRoot);\n const portBlockStart = resolveApplicationPortBase(input.saasConfig) + SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET;\n return {\n saasRoot: input.saasRoot,\n simulators,\n portBlockStart,\n instances: classifySystemOfRecordInstances(input.saasConfig.systemsOfRecord, infra?.config.systemsOfRecord, portBlockStart),\n dataArguments: resolveApplicationFleetData(input.saasRoot),\n infraConfigPath: infra?.path ?? resolveAuthoredInfraConfigPath(input.saasRoot, LOCAL_ENVIRONMENT),\n };\n}\n\n/** The developer-fleet command line's arguments for one subcommand. */\nfunction fleetArguments(context: SystemOfRecordSimulatorsContext, subcommand: 'plan' | 'serve'): string[] {\n const instances = context.instances\n .filter(({ standing }) => standing === SystemOfRecordLocalStanding.FLEET)\n .map(({ name, vendor, credentialKind, dialect }) => ({ name, vendor, dialect, ...(credentialKind === undefined ? {} : { credentialKind }) }));\n return [...context.simulators.launchArguments, subcommand, '--port-block', String(context.portBlockStart), '--instances', JSON.stringify(instances), ...context.dataArguments];\n}\n\n/** Read the plan line out of the command's stdout. Exported for its test. */\nexport function parseDeveloperFleetPlanOutput(stdout: string): DeveloperFleetPlanContract {\n const line = stdout.split('\\n').find((candidate) => candidate.startsWith(DEVELOPER_FLEET_PLAN_SENTINEL));\n if (line === undefined) throw new Error('The developer fleet printed no plan.');\n return JSON.parse(line.slice(DEVELOPER_FLEET_PLAN_SENTINEL.length)) as DeveloperFleetPlanContract;\n}\n\n/** Ask the simulators for the plan. A refusal there (a malformed dataset) is reported with its own last line. */\nexport function requestDeveloperFleetPlan(context: SystemOfRecordSimulatorsContext): DeveloperFleetPlanContract {\n const run = spawnSync(context.simulators.command, fleetArguments(context, 'plan'), { cwd: context.simulators.cwd, encoding: 'utf8', timeout: 120_000 });\n if (run.status !== 0) {\n const reason = `${run.stderr ?? ''}`.trim().split('\\n').at(-1) || run.error?.message || `exit ${String(run.status)}`;\n throw new Error(`The developer fleet could not plan: ${reason}`);\n }\n return parseDeveloperFleetPlanOutput(run.stdout);\n}\n\n/**\n * Refuse, as could-not-ask, a plan that serves nothing: every declared instance is left alone or unserved, so none of\n * the three verbs has anything to do. One rule for all three, so they answer the same exit code for the same state.\n */\nexport function requireServedInstances(plan: DeveloperFleetPlanContract): void {\n if (plan.instances.length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('No declared system of record is served by the simulators (see above), so there is nothing to do.');\n }\n}\n\n/** One instance's local address compared with the plan's. */\nexport interface FleetAddressComparison {\n readonly name: string;\n readonly expected: Readonly<Record<string, string>>;\n readonly current?: Readonly<Record<string, string>>;\n readonly matches: boolean;\n /** One phrase per slot that differs (`certificateKeyId is 'a', the simulators need 'b'`). Empty when it matches or has no address. */\n readonly differences: readonly string[];\n}\n\n/** Each planned instance's address against what the local infra config authors. Pure. */\nexport function compareFleetAddresses(plan: DeveloperFleetPlanContract, instances: readonly ClassifiedSystemOfRecordInstance[]): FleetAddressComparison[] {\n return plan.instances.map(({ name, address }) => {\n const current = instances.find((instance) => instance.name === name)?.currentAddress;\n const differences = current === undefined ? [] : [...new Set([...Object.keys(address), ...Object.keys(current)])].flatMap((slot) => {\n if (current[slot] === address[slot]) return [];\n if (address[slot] === undefined) return [`${slot} is set and the simulators use no such slot`];\n return [current[slot] === undefined ? `${slot} is missing (the simulators need '${address[slot]}')` : `${slot} is '${current[slot]}', the simulators need '${address[slot]}'`];\n });\n return { name, expected: address, ...(current === undefined ? {} : { current }), matches: current !== undefined && differences.length === 0, differences };\n });\n}\n\n/**\n * The plan checked against the slots the engine resolves for each instance. Answers, per instance, why it is refused\n * (empty when it is not), plus what could not be checked. Pure over its inputs; the caller resolves the engine's slots.\n */\nexport function checkPlanAgainstEngineSlots(\n plan: DeveloperFleetPlanContract,\n engine: { readonly systems: readonly DeclaredSystemOfRecordSecrets[]; readonly incomplete: readonly string[] },\n): { readonly refused: ReadonlyMap<string, string>; readonly unchecked: readonly string[] } {\n const refused = new Map<string, string>();\n const unchecked: string[] = [...engine.incomplete];\n for (const instance of plan.instances) {\n const resolved = engine.systems.find(({ name }) => name === instance.name);\n if (resolved === undefined || resolved.secretSlots === null) {\n unchecked.push(`System of record '${instance.name}': the engine's slots could not be resolved, so the plan's slots are not checked against them.`);\n continue;\n }\n const problems: string[] = [];\n const plannedSecrets = new Set(instance.secrets.map(({ slot }) => slot));\n for (const slot of resolved.secretSlots) {\n if (slot.required && !plannedSecrets.has(slot.slug)) problems.push(`the engine requires the secret slot '${slot.slug}' and the fleet does not provide it`);\n }\n for (const slot of plannedSecrets) {\n if (!resolved.secretSlots.some(({ slug }) => slug === slot)) problems.push(`the fleet provides a secret slot '${slot}' the engine does not have`);\n }\n if (resolved.addressSlots !== null) {\n for (const slot of resolved.addressSlots) {\n if (slot.required && instance.address[slot.slug] === undefined) problems.push(`the engine requires the address slot '${slot.slug}' and the fleet does not provide it`);\n }\n for (const slot of Object.keys(instance.address)) {\n if (!resolved.addressSlots.some(({ slug }) => slug === slot)) problems.push(`the fleet provides an address slot '${slot}' the engine does not have`);\n }\n } else {\n unchecked.push(`System of record '${instance.name}': its address slots could not be read from its facet, so they are not checked.`);\n }\n if (problems.length > 0) refused.set(instance.name, problems.join('; '));\n }\n return { refused, unchecked };\n}\n\n/** The engine's slots for the declared instances, through the same resolution `wildo secrets` uses. */\nexport async function resolveEngineSlots(saasRoot: string, saasConfig: WildoSaasConfig): ReturnType<typeof resolveDeclaredSystemOfRecordSecrets> {\n return resolveDeclaredSystemOfRecordSecrets({ saasRoot, declared: saasConfig.systemsOfRecord ?? {} });\n}\n\n/** An unencrypted PKCS#8 RSA private key, generated on this machine (the form NetSuite's certificate slot requires). */\nfunction generatePrivateKeyPem(): string {\n return generateKeyPairSync('rsa', { modulusLength: 2048, privateKeyEncoding: { type: 'pkcs8', format: 'pem' }, publicKeyEncoding: { type: 'spki', format: 'pem' } }).privateKey;\n}\n\n/** One secret a seeding run sets: its derived variable name and its value. */\nexport interface FleetSecretToSet {\n readonly instance: string;\n readonly envVarName: string;\n readonly value: string;\n}\n\n/**\n * The secrets to seed for the planned instances the engine check did not refuse. Pure but for key generation, which a\n * dry run skips (`generateKeys: false` leaves a generated slot's value empty).\n */\nexport function fleetSecretsToSet(plan: DeveloperFleetPlanContract, refused: ReadonlyMap<string, string>, options: { readonly generateKeys?: boolean } = {}): FleetSecretToSet[] {\n const generateKeys = options.generateKeys !== false;\n return plan.instances\n .filter(({ name }) => !refused.has(name))\n .flatMap(({ name, secrets }) => secrets.map((secret) => ({\n instance: name,\n envVarName: deriveSystemOfRecordEnvVarName(name, secret.slot),\n value: secret.source === GENERATE_RSA_PKCS8_PRIVATE_KEY ? (generateKeys ? generatePrivateKeyPem() : '') : secret.value!,\n })));\n}\n\n/** Write the planned addresses into the local infra config, for the instances the engine check did not refuse. */\nexport function writeFleetAddresses(context: SystemOfRecordSimulatorsContext, plan: DeveloperFleetPlanContract, refused: ReadonlyMap<string, string>): string[] {\n const instances = plan.instances.filter(({ name }) => !refused.has(name)).map(({ name, address }) => ({ name, address }));\n if (!existsSync(context.infraConfigPath)) {\n throw new SystemOfRecordSimulatorsUnavailableError(`There is no local infra config at ${context.infraConfigPath} to write the addresses into.`);\n }\n const before = readFileSync(context.infraConfigPath, 'utf8');\n const after = writeInstanceAddresses(before, context.infraConfigPath, instances);\n if (after !== before) writeFileSync(context.infraConfigPath, after, 'utf8');\n return instances.map(({ name }) => name);\n}\n\n/**\n * Start the fleet in the foreground, its output inherited, until it exits or this process is interrupted. Resolves with\n * the fleet's exit code, or 0 when the developer stopped it (Ctrl-C is how it is meant to end, whatever code the\n * interrupted child chain reports).\n */\nexport function serveDeveloperFleet(context: SystemOfRecordSimulatorsContext): Promise<number> {\n return new Promise((resolve) => {\n const child = spawn(context.simulators.command, fleetArguments(context, 'serve'), { cwd: context.simulators.cwd, stdio: 'inherit' });\n let stopped = false;\n const forward = (signal: NodeJS.Signals): void => {\n stopped = true;\n if (!child.killed) child.kill(signal);\n };\n process.on('SIGINT', forward);\n process.on('SIGTERM', forward);\n child.on('error', (error) => {\n process.off('SIGINT', forward);\n process.off('SIGTERM', forward);\n // eslint-disable-next-line no-console\n console.error(`The developer fleet could not start: ${error.message}`);\n resolve(1);\n });\n child.on('exit', (code, signal) => {\n process.off('SIGINT', forward);\n process.off('SIGTERM', forward);\n resolve(stopped ? 0 : code ?? (signal === null ? 0 : 1));\n });\n });\n}\n\n/** Copy the starter dataset into the application, refusing to replace a file. */\nexport function scaffoldApplicationFleetDataset(context: Pick<SystemOfRecordSimulatorsContext, 'saasRoot' | 'simulators'>): string {\n const target = join(context.saasRoot, APPLICATION_FLEET_DATASET_RELATIVE_PATH);\n if (existsSync(join(context.saasRoot, APPLICATION_FLEET_FIXTURE_RELATIVE_PATH))) {\n throw new Error(`${APPLICATION_FLEET_FIXTURE_RELATIVE_PATH} already describes this application's data; a fleet starts from one description, so no dataset is scaffolded beside it.`);\n }\n const run = spawnSync(context.simulators.command, [...context.simulators.launchArguments, 'scaffold-dataset', '--to', target], { cwd: context.simulators.cwd, encoding: 'utf8', timeout: 120_000 });\n if (run.status !== 0) throw new Error(`${run.stderr ?? ''}`.trim().split('\\n').at(-1) || run.error?.message || 'the starter dataset could not be written');\n return target;\n}\n"]}
1
+ {"version":3,"file":"system-of-record-simulators.service.js","sourceRoot":"","sources":["../../../../src/services/application/system-of-record-simulators.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OA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CAAC;AAChB,CAAC","sourcesContent":["/**\n * Runs an application's systems of record against the provider simulator fleet on a developer machine (#3039): the\n * service behind `wildo local sor-simulators`, `wildo local sor-secrets` and `wildo local sor-addresses`.\n *\n * ## What it derives, and from what\n *\n * Everything is derived from what the application already declares, so a created application gets a working local ERP\n * the moment its CONFIG task declares an instance, with nothing restated by hand:\n *\n * - **which instances**: `systemsOfRecord` in `wildo.saas.config.ts`, kept to those whose LOCAL address is absent or\n * loopback. An instance addressed at a real vendor, or declared `{ enabled: false }`, is the developer's decision and\n * is reported, never overridden.\n * - **which ports**: the application's port block, its allocated port base (the lowest backend `defaultPort`, which\n * `wildo init`'s allocator keeps unique among sibling applications) plus {@link SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET}.\n * Two applications on one machine therefore never contend for a face.\n * - **which data**: `system-of-record-simulators/fleet.dataset.ts` (neutral) or `fleet.fixture.ts` (vendor-shaped) at\n * the application root, else the fleet's starter dataset.\n * - **addresses, secrets, faces**: the simulators package's developer-fleet plan, asked through its own command line,\n * because that package is not a dependency of this CLI. Where that command line is found is\n * {@link locateProviderSimulators}.\n *\n * ## The join with the engine\n *\n * The plan restates each vendor's slots, because the simulators import nothing from Wildo. So before a secret is seeded\n * or an address written, the plan is checked against the slots the ENGINE resolves for the instance\n * ({@link resolveDeclaredSystemOfRecordSecrets}): a required slot the plan does not fill, or a slot the engine does not\n * have, refuses that instance. A double cannot silently drift from the facet it stands in for.\n *\n * ## Where the fleet comes from (#3047)\n *\n * `@wildo-ai/provider-simulators` is a published OPT-IN framework package (decided by Paul, 2026-10-21): an application\n * that wants a local system of record declares it as a devDependency of its root (`\"*\"`, linked by `wildo config sync`\n * to its framework release, or to a `file:` path in a framework checkout). The fleet is looked for in this order:\n *\n * 1. **the application's own `node_modules`**: the package it declared, run as its `bin` with this CLI's node. That is\n * what an application created in app-creator mode has, and what a framework-development application that declares\n * the package runs too, so both modes run the same artifact;\n * 2. **the framework checkout**: the package's source, run with tsx from its own lockfile. What the dogfood applications\n * use, since they do not declare it;\n * 3. neither: every verb answers COULD-NOT-ASK (exit 2) naming the devDependency to add, never a blocked task. Pointing\n * the instance at a real vendor is the other way out.\n *\n * An application that declares the package and has it broken (installed without its build) is refused with that\n * remedy, rather than silently served from a checkout it did not choose.\n */\nimport { spawn, spawnSync } from 'node:child_process';\nimport { generateKeyPairSync } from 'node:crypto';\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nimport { WildoLocationType, type WildoSaasConfig, type WildoSystemsOfRecordEnvConfig } from '@wildo-ai/platform-config-lib';\nimport { deriveSystemOfRecordEnvVarName } from '@wildo-ai/saas-models';\n\nimport { loadAuthoredInfraEnvConfig, resolveAuthoredInfraConfigPath } from '../environment/authored-infra-config.utils';\nimport { resolveDeclaredSystemOfRecordSecrets, type DeclaredSystemOfRecordSecrets } from '../credentials/application-secret-owners.service';\nimport { writeInstanceAddresses } from './infra-system-of-record-addresses.editor';\n\n/** The simulators package, relative to the framework checkout. */\nexport const PROVIDER_SIMULATORS_RELATIVE_PATH = 'platform/testing/provider-simulators';\n\n/** The simulators' published package name: the devDependency an application declares to run the fleet (#3047). */\nexport const PROVIDER_SIMULATORS_PACKAGE = '@wildo-ai/provider-simulators';\n\n/** The developer fleet's command line inside that package, as SOURCE (the checkout form, run with tsx). */\nexport const DEVELOPER_FLEET_ENTRY = 'src/developer-fleet/main.ts';\n\n/** The developer fleet's command line as the published package declares it: its `bin` name (the installed form). */\nexport const DEVELOPER_FLEET_BIN = 'wildo-provider-simulators-fleet';\n\n/**\n * Node's warning when it loads the application's `.ts` data module from a package with no `\"type\"`: true, harmless, and\n * printed on stderr, whose LAST line is how a refusal is reported. Silenced in the installed form, where node (not tsx)\n * loads that module.\n */\nconst SILENCED_NODE_WARNING = '--disable-warning=MODULE_TYPELESS_PACKAGE_JSON';\n\n/** Where the fleet's command line was found. */\nexport enum ProviderSimulatorsOrigin {\n /** The application's own `node_modules`: the package it declared as a devDependency. */\n APPLICATION = 'application',\n /** The framework checkout's source, from the simulators' own lockfile. */\n CHECKOUT = 'checkout',\n}\n\n/** How to run the developer fleet's command line: `command ...launchArguments <subcommand> …`, in `cwd`. */\nexport interface ProviderSimulatorsLocation {\n readonly origin: ProviderSimulatorsOrigin;\n /** The package root that was found. */\n readonly root: string;\n readonly command: string;\n readonly launchArguments: readonly string[];\n readonly cwd: string;\n}\n\n/**\n * One command line of the simulators package, in its two forms: the SOURCE entry run with tsx from a framework checkout,\n * and the `bin` a published copy declares. The developer fleet is one; a standalone double (the content-safety\n * classifier, `local-provider-doubles.service.ts`) is another, which is why the locators below take one.\n */\nexport interface ProviderSimulatorsEntry {\n /** Relative to the package root, as source: `src/…/main.ts`. */\n readonly checkoutEntry: string;\n /** The `bin` name the published package declares for it. */\n readonly bin: string;\n /** What the command line is for, completing \"To …\": named in the remedy when the package is missing. */\n readonly purpose: string;\n /** The way out that needs no simulator, appended to that remedy. */\n readonly otherwise: string;\n}\n\n/** The developer fleet's command line: the default every locator below is asked for. */\nexport const DEVELOPER_FLEET_SIMULATORS_ENTRY: ProviderSimulatorsEntry = {\n checkoutEntry: DEVELOPER_FLEET_ENTRY,\n bin: DEVELOPER_FLEET_BIN,\n purpose: 'run its systems of record locally',\n otherwise: 'Or point each instance at a real vendor: its address in the local infra config, its secret with `wildo secrets set`.',\n};\n\n/** The one line the plan command prints, before its JSON. Mirrors `DEVELOPER_FLEET_PLAN_SENTINEL` in the package. */\nexport const DEVELOPER_FLEET_PLAN_SENTINEL = '__DEVELOPER_FLEET_PLAN__';\n\n/**\n * The application's simulator port block starts this far above its port base: 4301 → 18301, 4311 → 18311. The block the\n * two dogfood applications already used, and above every port tier the CLI allocates (4xxx services, 5xxx platform), so\n * it cannot meet one of them. A port base is allocated on a stride of 10 and the fleet uses 8 of the 10.\n */\nexport const SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET = 14_000;\n\n/** Where an application keeps the records its fleet serves, relative to its root. The two forms are exclusive. */\nexport const APPLICATION_FLEET_DATASET_RELATIVE_PATH = 'system-of-record-simulators/fleet.dataset.ts';\nexport const APPLICATION_FLEET_FIXTURE_RELATIVE_PATH = 'system-of-record-simulators/fleet.fixture.ts';\n\n/** The environment these verbs act on: the developer machine. */\nconst LOCAL_ENVIRONMENT = WildoLocationType.LOCAL;\n\n/** Hosts an address may name and still be \"this machine's fleet\". */\nconst LOOPBACK_HOSTS: ReadonlySet<string> = new Set(['127.0.0.1', 'localhost', '[::1]', '::1']);\n\n/**\n * How many ports of the application's block the fleet may use: the faces sit at offsets 0–7 (the simulators'\n * `DEVELOPER_FLEET_FACE_PORT_OFFSET`). An address on this machine OUTSIDE that range is not the fleet's — a vendor\n * sandbox tunnelled to localhost, another double — and is left alone with its real secret.\n */\nexport const FLEET_PORT_BLOCK_SIZE = 8;\n\n/** What a verb decided about one declared instance's local address. */\nexport enum SystemOfRecordLocalStanding {\n /** No address yet, or a loopback one inside the application's fleet port block: the fleet serves it. */\n FLEET = 'fleet',\n /** `{ enabled: false }`: the environment says it has no access. Left alone. */\n DECLARED_ABSENT = 'declared-absent',\n /**\n * Addressed somewhere the fleet does not listen: another host (a real vendor), or this machine outside the fleet's\n * port block (a tunnelled sandbox, another double). Left alone, address and secret.\n */\n REAL_VENDOR = 'real-vendor',\n}\n\nexport interface ClassifiedSystemOfRecordInstance {\n readonly name: string;\n readonly vendor: string;\n readonly credentialKind?: string;\n /** The dialect the instance declares — it decides the fleet's plan for a vendor spoken over several wires (#3391). */\n readonly dialect: string;\n readonly standing: SystemOfRecordLocalStanding;\n /** The address the local infra config authors today, when it authors one. */\n readonly currentAddress?: Readonly<Record<string, string>>;\n}\n\n/** The plan as the simulators print it: the JSON contract of `main.ts plan`, minus nothing this CLI reads. */\nexport interface DeveloperFleetPlanContract {\n readonly portBlockStart: number;\n readonly faces: ReadonlyArray<{ readonly face: string; readonly port: number }>;\n readonly instances: ReadonlyArray<{\n readonly name: string;\n readonly vendor: string;\n readonly face: string;\n readonly credentialKind: string;\n readonly address: Readonly<Record<string, string>>;\n readonly secrets: ReadonlyArray<{ readonly slot: string; readonly source: string; readonly value?: string }>;\n }>;\n readonly unserved: ReadonlyArray<{ readonly name: string; readonly vendor: string; readonly reason: string }>;\n readonly dataKind: string;\n readonly omissions: readonly string[];\n}\n\n/** The value of `secrets[].source` that asks the caller to generate a private key (`DeveloperFleetSecretSource`). */\nexport const GENERATE_RSA_PKCS8_PRIVATE_KEY = 'generate-rsa-pkcs8-private-key';\n\n/** A verb that could not even ask: the fleet is unreachable, or the application gives it nothing to plan. */\nexport class SystemOfRecordSimulatorsUnavailableError extends Error {}\n\nexport interface SystemOfRecordSimulatorsContext {\n readonly saasRoot: string;\n readonly simulators: ProviderSimulatorsLocation;\n readonly portBlockStart: number;\n readonly instances: readonly ClassifiedSystemOfRecordInstance[];\n /** `['--dataset', path]`, `['--fixture', path]`, or `[]` for the starter dataset. */\n readonly dataArguments: readonly string[];\n readonly infraConfigPath: string;\n}\n\n/**\n * The remedy when the application has no fleet: the devDependency to declare, and the other way out. When the application\n * already declares it, the remedy is only the install. One function, so the verbs and their tests name the same thing.\n */\nexport function describeMissingProviderSimulators(saasRoot: string, entryPoint: ProviderSimulatorsEntry = DEVELOPER_FLEET_SIMULATORS_ENTRY): string {\n const otherwise = entryPoint.otherwise;\n if (applicationDeclaresProviderSimulators(saasRoot)) {\n return `The application declares ${PROVIDER_SIMULATORS_PACKAGE} but it is not installed: run \\`wildo config sync\\` (it links the package to `\n + `your framework release) and \\`pnpm install\\`. ${otherwise}`;\n }\n return `The provider simulators are not installed in this application. To ${entryPoint.purpose}, add `\n + `\"${PROVIDER_SIMULATORS_PACKAGE}\": \"*\" to the devDependencies of the application's root package.json, run \\`wildo config sync\\` `\n + `(it links the package to your framework release) and \\`pnpm install\\`. ${otherwise}`;\n}\n\n/** Whether the application's root manifest declares the simulators, in any dependency field. */\nfunction applicationDeclaresProviderSimulators(saasRoot: string): boolean {\n const manifestPath = join(saasRoot, 'package.json');\n if (!existsSync(manifestPath)) return false;\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Partial<Record<string, Record<string, string>>>;\n return ['dependencies', 'devDependencies', 'optionalDependencies'].some((field) => manifest[field]?.[PROVIDER_SIMULATORS_PACKAGE] !== undefined);\n } catch {\n return false;\n }\n}\n\n/**\n * The package as the APPLICATION resolves it, or `null` when the application does not have it. Throws when it has it\n * but cannot run it: the application chose that copy, so it is reported rather than replaced by another.\n *\n * Found by Node's own lookup order (`require.resolve.paths`: the `node_modules` directories from the application root\n * upward), reading the manifest at each, rather than by resolving a specifier: the package exports no `./package.json`,\n * since a manifest is not a code subpath, and resolving through `exports` would also turn any resolution error into \"not\n * installed\" and quietly fall back to a checkout.\n */\nexport function resolveInstalledProviderSimulators(saasRoot: string, entryPoint: ProviderSimulatorsEntry = DEVELOPER_FLEET_SIMULATORS_ENTRY): ProviderSimulatorsLocation | null {\n const lookup = createRequire(join(saasRoot, 'package.json')).resolve.paths(PROVIDER_SIMULATORS_PACKAGE) ?? [];\n const candidate = lookup.map((directory) => join(directory, PROVIDER_SIMULATORS_PACKAGE)).find((root) => existsSync(join(root, 'package.json')));\n if (candidate === undefined) return null;\n const root = realpathSync(candidate);\n let manifest: { bin?: Record<string, string> | string; version?: string };\n try {\n manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as typeof manifest;\n } catch (error) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The application has ${PROVIDER_SIMULATORS_PACKAGE} at ${root}, but its package.json cannot be read (${(error as Error).message}). Reinstall it with \\`pnpm install\\`.`);\n }\n const binEntry = typeof manifest.bin === 'object' ? manifest.bin[entryPoint.bin] : undefined;\n const entry = binEntry === undefined ? undefined : join(root, binEntry);\n if (entry === undefined || !existsSync(entry)) {\n throw new SystemOfRecordSimulatorsUnavailableError(\n `The application has ${PROVIDER_SIMULATORS_PACKAGE}${manifest.version === undefined ? '' : `@${manifest.version}`} at ${root}, but it carries no `\n + `built \\`${entryPoint.bin}\\` command line (${entry === undefined ? 'it is not declared' : `it is missing: ${entry}`}). `\n + 'Reinstall it with `pnpm install`; when the command line is not declared at all, the installed release predates it, so move '\n + 'to a framework release that carries it (`wildo update`). When it is linked to a framework checkout, build it there first: '\n + `(cd <framework>/${PROVIDER_SIMULATORS_RELATIVE_PATH} && pnpm install && pnpm run build).`,\n );\n }\n return { origin: ProviderSimulatorsOrigin.APPLICATION, root, command: process.execPath, launchArguments: [SILENCED_NODE_WARNING, entry], cwd: saasRoot };\n}\n\n/**\n * Where the developer fleet's command line is: the application's own copy first, then the framework checkout, else\n * COULD-NOT-ASK naming the devDependency to add (#3047).\n */\nexport function locateProviderSimulators(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n /** Which command line of the package; the developer fleet when omitted. */\n readonly entry?: ProviderSimulatorsEntry;\n}): ProviderSimulatorsLocation {\n const entryPoint = input.entry ?? DEVELOPER_FLEET_SIMULATORS_ENTRY;\n const installed = resolveInstalledProviderSimulators(input.saasRoot, entryPoint);\n if (installed !== null) return installed;\n if (input.frameworkRoot === null) throw new SystemOfRecordSimulatorsUnavailableError(describeMissingProviderSimulators(input.saasRoot, entryPoint));\n const simulatorsRoot = join(input.frameworkRoot, PROVIDER_SIMULATORS_RELATIVE_PATH);\n if (!existsSync(join(simulatorsRoot, entryPoint.checkoutEntry))) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The framework checkout at ${input.frameworkRoot} has no ${entryPoint.bin} (${PROVIDER_SIMULATORS_RELATIVE_PATH}/${entryPoint.checkoutEntry}); update it.`);\n }\n if (!existsSync(join(simulatorsRoot, 'node_modules'))) {\n throw new SystemOfRecordSimulatorsUnavailableError(`The provider simulators are not installed. They keep their own lockfile:\\n\\n (cd ${simulatorsRoot} && pnpm install)\\n`);\n }\n return { origin: ProviderSimulatorsOrigin.CHECKOUT, root: simulatorsRoot, command: 'pnpm', launchArguments: ['exec', 'tsx', entryPoint.checkoutEntry], cwd: simulatorsRoot };\n}\n\n/**\n * The application's port base: the lowest `defaultPort` among its backend services (a service with no `frontendType`),\n * which is what `wildo init` allocated. Refused when no backend declares one: an invented block could land on another\n * application's fleet.\n */\nexport function resolveApplicationPortBase(saasConfig: Pick<WildoSaasConfig, 'services'>): number {\n const ports = Object.values(saasConfig.services ?? {})\n .filter((service) => service.frontendType === undefined && typeof service.defaultPort === 'number')\n .map((service) => service.defaultPort as number);\n if (ports.length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('No backend service in wildo.saas.config.ts declares a `defaultPort`, so the application has no port block for its simulators.');\n }\n return Math.min(...ports);\n}\n\n/** Is this address the fleet's: on this machine, on a port of the application's fleet block? */\nfunction isFleetAddress(address: Readonly<Record<string, string>>, portBlockStart: number): boolean {\n const baseUrl = address.baseUrl;\n if (baseUrl === undefined) return false;\n try {\n const url = new URL(baseUrl);\n const port = Number(url.port);\n return LOOPBACK_HOSTS.has(url.hostname) && Number.isInteger(port) && port >= portBlockStart && port < portBlockStart + FLEET_PORT_BLOCK_SIZE;\n } catch {\n return false;\n }\n}\n\n/** Every declared instance with its local standing. Pure over the two declarations and the application's port block. */\nexport function classifySystemOfRecordInstances(\n declared: WildoSaasConfig['systemsOfRecord'],\n localAddresses: WildoSystemsOfRecordEnvConfig | undefined,\n portBlockStart: number,\n): ClassifiedSystemOfRecordInstance[] {\n return Object.entries(declared ?? {}).map(([name, declaration]) => {\n const local = localAddresses?.[name];\n const base = {\n name,\n vendor: declaration.vendor,\n dialect: declaration.dialect,\n ...(declaration.credential?.kind === undefined ? {} : { credentialKind: declaration.credential.kind }),\n };\n if (local !== undefined && 'enabled' in local) return { ...base, standing: SystemOfRecordLocalStanding.DECLARED_ABSENT };\n const currentAddress = local === undefined || !('address' in local) ? undefined : local.address;\n if (currentAddress === undefined) return { ...base, standing: SystemOfRecordLocalStanding.FLEET };\n return { ...base, currentAddress, standing: isFleetAddress(currentAddress, portBlockStart) ? SystemOfRecordLocalStanding.FLEET : SystemOfRecordLocalStanding.REAL_VENDOR };\n });\n}\n\n/** The application's data module, as plan arguments. Both forms present is refused: a fleet starts from one. */\nexport function resolveApplicationFleetData(saasRoot: string): string[] {\n const dataset = join(saasRoot, APPLICATION_FLEET_DATASET_RELATIVE_PATH);\n const fixture = join(saasRoot, APPLICATION_FLEET_FIXTURE_RELATIVE_PATH);\n if (existsSync(dataset) && existsSync(fixture)) {\n throw new SystemOfRecordSimulatorsUnavailableError(`Both ${APPLICATION_FLEET_DATASET_RELATIVE_PATH} and ${APPLICATION_FLEET_FIXTURE_RELATIVE_PATH} exist; a fleet starts from one description of its data. Remove one.`);\n }\n if (existsSync(dataset)) return ['--dataset', dataset];\n if (existsSync(fixture)) return ['--fixture', fixture];\n return [];\n}\n\n/** Everything a verb needs, loaded once. */\nexport async function loadSystemOfRecordSimulatorsContext(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n readonly saasConfig: WildoSaasConfig;\n}): Promise<SystemOfRecordSimulatorsContext> {\n const simulators = locateProviderSimulators({ saasRoot: input.saasRoot, frameworkRoot: input.frameworkRoot });\n if (Object.keys(input.saasConfig.systemsOfRecord ?? {}).length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('wildo.saas.config.ts declares no system of record, so there is nothing for the simulators to serve.');\n }\n const infra = await loadAuthoredInfraEnvConfig(LOCAL_ENVIRONMENT, input.saasRoot);\n const portBlockStart = resolveApplicationPortBase(input.saasConfig) + SYSTEM_OF_RECORD_SIMULATOR_PORT_OFFSET;\n return {\n saasRoot: input.saasRoot,\n simulators,\n portBlockStart,\n instances: classifySystemOfRecordInstances(input.saasConfig.systemsOfRecord, infra?.config.systemsOfRecord, portBlockStart),\n dataArguments: resolveApplicationFleetData(input.saasRoot),\n infraConfigPath: infra?.path ?? resolveAuthoredInfraConfigPath(input.saasRoot, LOCAL_ENVIRONMENT),\n };\n}\n\n/** The developer-fleet command line's arguments for one subcommand. */\nfunction fleetArguments(context: SystemOfRecordSimulatorsContext, subcommand: 'plan' | 'serve'): string[] {\n const instances = context.instances\n .filter(({ standing }) => standing === SystemOfRecordLocalStanding.FLEET)\n .map(({ name, vendor, credentialKind, dialect }) => ({ name, vendor, dialect, ...(credentialKind === undefined ? {} : { credentialKind }) }));\n return [...context.simulators.launchArguments, subcommand, '--port-block', String(context.portBlockStart), '--instances', JSON.stringify(instances), ...context.dataArguments];\n}\n\n/** Read the plan line out of the command's stdout. Exported for its test. */\nexport function parseDeveloperFleetPlanOutput(stdout: string): DeveloperFleetPlanContract {\n const line = stdout.split('\\n').find((candidate) => candidate.startsWith(DEVELOPER_FLEET_PLAN_SENTINEL));\n if (line === undefined) throw new Error('The developer fleet printed no plan.');\n return JSON.parse(line.slice(DEVELOPER_FLEET_PLAN_SENTINEL.length)) as DeveloperFleetPlanContract;\n}\n\n/** Ask the simulators for the plan. A refusal there (a malformed dataset) is reported with its own last line. */\nexport function requestDeveloperFleetPlan(context: SystemOfRecordSimulatorsContext): DeveloperFleetPlanContract {\n const run = spawnSync(context.simulators.command, fleetArguments(context, 'plan'), { cwd: context.simulators.cwd, encoding: 'utf8', timeout: 120_000 });\n if (run.status !== 0) {\n const reason = `${run.stderr ?? ''}`.trim().split('\\n').at(-1) || run.error?.message || `exit ${String(run.status)}`;\n throw new Error(`The developer fleet could not plan: ${reason}`);\n }\n return parseDeveloperFleetPlanOutput(run.stdout);\n}\n\n/**\n * Refuse, as could-not-ask, a plan that serves nothing: every declared instance is left alone or unserved, so none of\n * the three verbs has anything to do. One rule for all three, so they answer the same exit code for the same state.\n */\nexport function requireServedInstances(plan: DeveloperFleetPlanContract): void {\n if (plan.instances.length === 0) {\n throw new SystemOfRecordSimulatorsUnavailableError('No declared system of record is served by the simulators (see above), so there is nothing to do.');\n }\n}\n\n/** One instance's local address compared with the plan's. */\nexport interface FleetAddressComparison {\n readonly name: string;\n readonly expected: Readonly<Record<string, string>>;\n readonly current?: Readonly<Record<string, string>>;\n readonly matches: boolean;\n /** One phrase per slot that differs (`certificateKeyId is 'a', the simulators need 'b'`). Empty when it matches or has no address. */\n readonly differences: readonly string[];\n}\n\n/** Each planned instance's address against what the local infra config authors. Pure. */\nexport function compareFleetAddresses(plan: DeveloperFleetPlanContract, instances: readonly ClassifiedSystemOfRecordInstance[]): FleetAddressComparison[] {\n return plan.instances.map(({ name, address }) => {\n const current = instances.find((instance) => instance.name === name)?.currentAddress;\n const differences = current === undefined ? [] : [...new Set([...Object.keys(address), ...Object.keys(current)])].flatMap((slot) => {\n if (current[slot] === address[slot]) return [];\n if (address[slot] === undefined) return [`${slot} is set and the simulators use no such slot`];\n return [current[slot] === undefined ? `${slot} is missing (the simulators need '${address[slot]}')` : `${slot} is '${current[slot]}', the simulators need '${address[slot]}'`];\n });\n return { name, expected: address, ...(current === undefined ? {} : { current }), matches: current !== undefined && differences.length === 0, differences };\n });\n}\n\n/**\n * The plan checked against the slots the engine resolves for each instance. Answers, per instance, why it is refused\n * (empty when it is not), plus what could not be checked. Pure over its inputs; the caller resolves the engine's slots.\n */\nexport function checkPlanAgainstEngineSlots(\n plan: DeveloperFleetPlanContract,\n engine: { readonly systems: readonly DeclaredSystemOfRecordSecrets[]; readonly incomplete: readonly string[] },\n): { readonly refused: ReadonlyMap<string, string>; readonly unchecked: readonly string[] } {\n const refused = new Map<string, string>();\n const unchecked: string[] = [...engine.incomplete];\n for (const instance of plan.instances) {\n const resolved = engine.systems.find(({ name }) => name === instance.name);\n if (resolved === undefined || resolved.secretSlots === null) {\n unchecked.push(`System of record '${instance.name}': the engine's slots could not be resolved, so the plan's slots are not checked against them.`);\n continue;\n }\n const problems: string[] = [];\n const plannedSecrets = new Set(instance.secrets.map(({ slot }) => slot));\n for (const slot of resolved.secretSlots) {\n if (slot.required && !plannedSecrets.has(slot.slug)) problems.push(`the engine requires the secret slot '${slot.slug}' and the fleet does not provide it`);\n }\n for (const slot of plannedSecrets) {\n if (!resolved.secretSlots.some(({ slug }) => slug === slot)) problems.push(`the fleet provides a secret slot '${slot}' the engine does not have`);\n }\n if (resolved.addressSlots !== null) {\n for (const slot of resolved.addressSlots) {\n if (slot.required && instance.address[slot.slug] === undefined) problems.push(`the engine requires the address slot '${slot.slug}' and the fleet does not provide it`);\n }\n for (const slot of Object.keys(instance.address)) {\n if (!resolved.addressSlots.some(({ slug }) => slug === slot)) problems.push(`the fleet provides an address slot '${slot}' the engine does not have`);\n }\n } else {\n unchecked.push(`System of record '${instance.name}': its address slots could not be read from its facet, so they are not checked.`);\n }\n if (problems.length > 0) refused.set(instance.name, problems.join('; '));\n }\n return { refused, unchecked };\n}\n\n/** The engine's slots for the declared instances, through the same resolution `wildo secrets` uses. */\nexport async function resolveEngineSlots(saasRoot: string, saasConfig: WildoSaasConfig): ReturnType<typeof resolveDeclaredSystemOfRecordSecrets> {\n return resolveDeclaredSystemOfRecordSecrets({ saasRoot, declared: saasConfig.systemsOfRecord ?? {} });\n}\n\n/** An unencrypted PKCS#8 RSA private key, generated on this machine (the form NetSuite's certificate slot requires). */\nfunction generatePrivateKeyPem(): string {\n return generateKeyPairSync('rsa', { modulusLength: 2048, privateKeyEncoding: { type: 'pkcs8', format: 'pem' }, publicKeyEncoding: { type: 'spki', format: 'pem' } }).privateKey;\n}\n\n/** One secret a seeding run sets: its derived variable name and its value. */\nexport interface FleetSecretToSet {\n readonly instance: string;\n readonly envVarName: string;\n readonly value: string;\n}\n\n/**\n * The secrets to seed for the planned instances the engine check did not refuse. Pure but for key generation, which a\n * dry run skips (`generateKeys: false` leaves a generated slot's value empty).\n */\nexport function fleetSecretsToSet(plan: DeveloperFleetPlanContract, refused: ReadonlyMap<string, string>, options: { readonly generateKeys?: boolean } = {}): FleetSecretToSet[] {\n const generateKeys = options.generateKeys !== false;\n return plan.instances\n .filter(({ name }) => !refused.has(name))\n .flatMap(({ name, secrets }) => secrets.map((secret) => ({\n instance: name,\n envVarName: deriveSystemOfRecordEnvVarName(name, secret.slot),\n value: secret.source === GENERATE_RSA_PKCS8_PRIVATE_KEY ? (generateKeys ? generatePrivateKeyPem() : '') : secret.value!,\n })));\n}\n\n/** Write the planned addresses into the local infra config, for the instances the engine check did not refuse. */\nexport function writeFleetAddresses(context: SystemOfRecordSimulatorsContext, plan: DeveloperFleetPlanContract, refused: ReadonlyMap<string, string>): string[] {\n const instances = plan.instances.filter(({ name }) => !refused.has(name)).map(({ name, address }) => ({ name, address }));\n if (!existsSync(context.infraConfigPath)) {\n throw new SystemOfRecordSimulatorsUnavailableError(`There is no local infra config at ${context.infraConfigPath} to write the addresses into.`);\n }\n const before = readFileSync(context.infraConfigPath, 'utf8');\n const after = writeInstanceAddresses(before, context.infraConfigPath, instances);\n if (after !== before) writeFileSync(context.infraConfigPath, after, 'utf8');\n return instances.map(({ name }) => name);\n}\n\n/**\n * Start the fleet in the foreground, its output inherited, until it exits or this process is interrupted. Resolves with\n * the fleet's exit code, or 0 when the developer stopped it (Ctrl-C is how it is meant to end, whatever code the\n * interrupted child chain reports).\n */\nexport function serveDeveloperFleet(context: SystemOfRecordSimulatorsContext): Promise<number> {\n return new Promise((resolve) => {\n const child = spawn(context.simulators.command, fleetArguments(context, 'serve'), { cwd: context.simulators.cwd, stdio: 'inherit' });\n let stopped = false;\n const forward = (signal: NodeJS.Signals): void => {\n stopped = true;\n if (!child.killed) child.kill(signal);\n };\n process.on('SIGINT', forward);\n process.on('SIGTERM', forward);\n child.on('error', (error) => {\n process.off('SIGINT', forward);\n process.off('SIGTERM', forward);\n // eslint-disable-next-line no-console\n console.error(`The developer fleet could not start: ${error.message}`);\n resolve(1);\n });\n child.on('exit', (code, signal) => {\n process.off('SIGINT', forward);\n process.off('SIGTERM', forward);\n resolve(stopped ? 0 : code ?? (signal === null ? 0 : 1));\n });\n });\n}\n\n/** Copy the starter dataset into the application, refusing to replace a file. */\nexport function scaffoldApplicationFleetDataset(context: Pick<SystemOfRecordSimulatorsContext, 'saasRoot' | 'simulators'>): string {\n const target = join(context.saasRoot, APPLICATION_FLEET_DATASET_RELATIVE_PATH);\n if (existsSync(join(context.saasRoot, APPLICATION_FLEET_FIXTURE_RELATIVE_PATH))) {\n throw new Error(`${APPLICATION_FLEET_FIXTURE_RELATIVE_PATH} already describes this application's data; a fleet starts from one description, so no dataset is scaffolded beside it.`);\n }\n const run = spawnSync(context.simulators.command, [...context.simulators.launchArguments, 'scaffold-dataset', '--to', target], { cwd: context.simulators.cwd, encoding: 'utf8', timeout: 120_000 });\n if (run.status !== 0) throw new Error(`${run.stderr ?? ''}`.trim().split('\\n').at(-1) || run.error?.message || 'the starter dataset could not be written');\n return target;\n}\n"]}
@@ -18,6 +18,10 @@
18
18
  * limit holds until its stated reset, the connectivity hold waits on the network, or the companion is down;
19
19
  * - **stop**, naming the rule that fired and what it waits for.
20
20
  *
21
+ * The loop's model choosing to stop is not the goal reached: the drive then asks where the application stands against its
22
+ * own requirements (`GET /creation/requirements/standing`, #3701), and calls the goal reached only when no requirement
23
+ * carries an open item.
24
+ *
21
25
  * After every loop, it accepts what the autonomy posture says the SYSTEM accepts (`POST /creation/drive/accept`, never
22
26
  * inside a live coding run), and stops when the posture leaves acceptance to a person: a marked critical gate, armed.
23
27
  *
@@ -39,7 +43,7 @@
39
43
  * The spend is the run report's measured total since the drive began (#2231, #2232), a floor wherever a run reported no
40
44
  * cost.
41
45
  */
42
- import { type CreationConsole_Feed, type CreationDrive_AcceptOutcome, type CreationDrive_Status } from '@wildo-ai/platform-core-shared';
46
+ import { type CreationConsole_Feed, type CreationDrive_AcceptOutcome, type CreationDrive_RequirementsStanding, type CreationDrive_Status } from '@wildo-ai/platform-core-shared';
43
47
  import { type ModelProviderAccountRefusal } from '@wildo-ai/saas-models';
44
48
  import type { ConsoleLoopResult } from './creation-console.service';
45
49
  /** The only drive mode: run until a stop rule fires. Named so `--until` is a closed vocabulary. */
@@ -48,8 +52,23 @@ export declare enum CreationDriveUntil {
48
52
  }
49
53
  /** Why the driver stopped. Every exit is one of these, and the report names it with what it waits for. */
50
54
  export declare enum CreationDriveStopRule {
51
- /** The loop's selector chose to stop with nothing running and nothing asked: it judged the goal met. */
55
+ /**
56
+ * The loop's selector chose to stop with nothing running and nothing asked, AND the application's requirements carry no
57
+ * open item (#3701): the goal is reached by measurement, never by the model's judgement alone.
58
+ */
52
59
  GOAL_REACHED = "goal-reached",
60
+ /**
61
+ * The loop's selector chose to stop, and the application's own requirements still carry open items (#3701): a reported
62
+ * gap, a configuration that does not meet one, one nothing addresses or with no build work landed. The model judged the
63
+ * creation done and the measurement says it is not, so the drive stops and names them: each is closed by the task named
64
+ * beside it, or by a person who starts refinement or decides the requirement is out of scope.
65
+ */
66
+ REQUIREMENTS_OPEN = "requirements-open",
67
+ /**
68
+ * The loop's selector chose to stop, and where the application stands against its requirements could not be read
69
+ * (#3701): whether the goal is reached is unknown, so the drive says that rather than claim it.
70
+ */
71
+ GOAL_UNMEASURED = "goal-unmeasured",
53
72
  /** Nothing is eligible to run, nothing runs, nothing is asked. */
54
73
  NOTHING_LEFT = "nothing-left",
55
74
  /**
@@ -139,6 +158,15 @@ export interface CreationDriveObservation {
139
158
  readonly stopRationale?: string;
140
159
  readonly waitedSince: boolean;
141
160
  };
161
+ /**
162
+ * Where the application stands against its own requirements (#3701), read once the last loop chose to stop: the
163
+ * `standing`, or why it could not be read. Absent when it was not asked.
164
+ */
165
+ readonly requirements?: {
166
+ readonly standing: CreationDrive_RequirementsStanding;
167
+ } | {
168
+ readonly unreadBecause: string;
169
+ };
142
170
  /** Since when the drive has waited on the coding agent's network without a break (ms on the drive's clock). */
143
171
  readonly networkWaitSinceMs?: number;
144
172
  readonly nowMs?: number;
@@ -172,6 +200,8 @@ export declare function decideCreationDriveStep(observation: CreationDriveObserv
172
200
  export interface CreationDrivePort {
173
201
  readonly readFeed: () => Promise<CreationConsole_Feed>;
174
202
  readonly readStatus: () => Promise<CreationDrive_Status>;
203
+ /** Where the application stands against its requirements, derived live (#3701). Asked only once a loop chose to stop. */
204
+ readonly readRequirementsStanding: () => Promise<CreationDrive_RequirementsStanding>;
175
205
  /** The run report's measured total, USD; undefined when it reports none or cannot be read. */
176
206
  readonly readSpentUsd: () => Promise<number | undefined>;
177
207
  readonly runLoop: (request: {
@@ -1 +1 @@
1
- {"version":3,"file":"creation-drive.service.d.ts","sourceRoot":"","sources":["../../../../src/services/companion/creation-drive.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAuC,KAAK,2BAA2B,EAAuB,MAAM,uBAAuB,CAAC;AAEnI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,mGAAmG;AACnG,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;CAChB;AAED,0GAA0G;AAC1G,oBAAY,qBAAqB;IAC/B,wGAAwG;IACxG,YAAY,iBAAiB;IAC7B,kEAAkE;IAClE,YAAY,iBAAiB;IAC7B;;;OAGG;IACH,kBAAkB,uBAAuB;IACzC,0HAA0H;IAC1H,YAAY,iBAAiB;IAC7B,oFAAoF;IACpF,uBAAuB,4BAA4B;IACnD,6FAA6F;IAC7F,UAAU,eAAe;IACzB,6GAA6G;IAC7G,YAAY,iBAAiB;IAC7B,yGAAyG;IACzG,YAAY,iBAAiB;IAC7B,2FAA2F;IAC3F,0BAA0B,+BAA+B;IACzD,oFAAoF;IACpF,gBAAgB,qBAAqB;IACrC,uCAAuC;IACvC,kBAAkB,uBAAuB;IACzC,kCAAkC;IAClC,aAAa,kBAAkB;IAC/B,yGAAyG;IACzG,uBAAuB,4BAA4B;IACnD,uFAAuF;IACvF,qBAAqB,0BAA0B;IAC/C;;;OAGG;IACH,YAAY,iBAAiB;IAC7B;;;;;OAKG;IACH,wBAAwB,6BAA6B;IACrD;;;;;OAKG;IACH,6BAA6B,kCAAkC;CAChE;AAED,+CAA+C;AAC/C,oBAAY,uBAAuB;IACjC,mGAAmG;IACn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AsB,CAAC,EAAE,2BAA2B,CAAC;CAC/D;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmK/B"}
1
+ {"version":3,"file":"creation-drive.service.d.ts","sourceRoot":"","sources":["../../../../src/services/companion/creation-drive.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAuC,KAAK,2BAA2B,EAAuB,MAAM,uBAAuB,CAAC;AAEnI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,mGAAmG;AACnG,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;CAChB;AAED,0GAA0G;AAC1G,oBAAY,qBAAqB;IAC/B;;;OAGG;IACH,YAAY,iBAAiB;IAC7B;;;;;OAKG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,eAAe,oBAAoB;IACnC,kEAAkE;IAClE,YAAY,iBAAiB;IAC7B;;;OAGG;IACH,kBAAkB,uBAAuB;IACzC,0HAA0H;IAC1H,YAAY,iBAAiB;IAC7B,oFAAoF;IACpF,uBAAuB,4BAA4B;IACnD,6FAA6F;IAC7F,UAAU,eAAe;IACzB,6GAA6G;IAC7G,YAAY,iBAAiB;IAC7B,yGAAyG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