@wildo-ai/dev-companion 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +12 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +11 -0
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +153 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +419 -41
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +25 -10
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +65 -24
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +86 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +127 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -0
- package/dist/esm/companion-api/companion-api.schemas.d.ts +59 -2
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +60 -0
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +322 -21
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/inject/models/container.d.ts.map +1 -1
- package/dist/esm/core/inject/models/container.js +11 -0
- package/dist/esm/core/inject/models/container.js.map +1 -1
- package/dist/esm/core/inject/models/service-types.d.ts +5 -0
- package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/core/inject/models/service-types.js +5 -0
- package/dist/esm/core/inject/models/service-types.js.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +81 -0
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +11 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.js +39 -0
- package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +8 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +317 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +45 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +250 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +123 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +298 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +78 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +155 -6
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +131 -2
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +259 -9
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +243 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +417 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +186 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +368 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts +101 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js +278 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +365 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js +167 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +332 -3
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +19 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +164 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +3 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +36 -23
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +51 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +391 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -0
- package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.js +5 -0
- package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +103 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js +124 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -0
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +39 -2
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.js +122 -11
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts +6 -0
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.js.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts +23 -0
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.js +26 -4
- package/dist/esm/core/specifications/specification-context-factory.shared.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +82 -3
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +126 -12
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +13 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js +91 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts +38 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js +41 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js.map +1 -0
- package/dist/esm/i18n/index.d.ts +3 -3
- package/dist/esm/i18n/index.js +3 -3
- package/dist/esm/i18n/index.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts +31 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js +27 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +28 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +24 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts +138 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js +100 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +29 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +25 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +27 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +23 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +806 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +326 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts +26 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js +22 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts +202 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.js +209 -0
- package/dist/esm/i18n/system_enums/market.en.js.map +1 -0
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +112 -2
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +201 -34
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +31 -3
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +48 -12
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +36 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +1 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +75 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -0
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +105 -7
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +298 -24
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +46 -3
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +95 -2
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts +9 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js +13 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +12 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +23 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +120 -3
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +636 -81
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts +40 -0
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js +63 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +21 -0
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js +86 -2
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +12 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +47 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/.builder.pid +0 -9
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
|
@@ -43,6 +43,14 @@ export declare const SuspendedPlaybookRunSchema: z.ZodObject<{
|
|
|
43
43
|
}, z.core.$strip>>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
export type SuspendedPlaybookRun = z.infer<typeof SuspendedPlaybookRunSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* One waiting run as a LISTING sees it — enough to decide whether to answer it, and to answer it.
|
|
48
|
+
*
|
|
49
|
+
* Derived from the record's own schema rather than restated, so a field that changes shape there
|
|
50
|
+
* cannot drift here. What is left out is the resume INPUTS (`creatorBrief`, `elicitationAnswers`,
|
|
51
|
+
* `priorAnswers`): they can be large, and none of them helps a reader choose between waiting runs.
|
|
52
|
+
*/
|
|
53
|
+
export type SuspendedPlaybookRunSummary = Pick<SuspendedPlaybookRun, 'runId' | 'playbookRef' | 'family' | 'suspendedAt' | 'round' | 'requests'>;
|
|
46
54
|
/** Named so the transport answers 404 rather than 500 for a resume of a run that is not waiting. */
|
|
47
55
|
export declare class SuspendedPlaybookRunNotFoundError extends Error {
|
|
48
56
|
constructor(runId: string);
|
|
@@ -55,6 +63,38 @@ export declare class PlaybookSuspendedRunCompanionService {
|
|
|
55
63
|
save(record: SuspendedPlaybookRun): Promise<void>;
|
|
56
64
|
/** Throws rather than returning null: every caller here is resuming, and "not waiting" is the answer. */
|
|
57
65
|
load(runId: string): Promise<SuspendedPlaybookRun>;
|
|
66
|
+
/**
|
|
67
|
+
* Every run currently waiting for answers — the read that makes a suspension REACHABLE.
|
|
68
|
+
*
|
|
69
|
+
* ## Why this had to exist
|
|
70
|
+
*
|
|
71
|
+
* `save`, `load` and `consume` are all a RESUME needs, and a resume needs a `runId` it was already
|
|
72
|
+
* given. So the only handle on a waiting run was the HTTP response its creator received: reload the
|
|
73
|
+
* page, open a second tab, or restart the browser, and the run stayed suspended on disk with nobody
|
|
74
|
+
* able to name it. Over `curl` that is survivable — the id sits in terminal scrollback — but a
|
|
75
|
+
* browser surface holds it in component state, so an ordinary navigation lost it.
|
|
76
|
+
*
|
|
77
|
+
* ## What it returns, and what it deliberately does not
|
|
78
|
+
*
|
|
79
|
+
* A SUMMARY, not the record. `creatorBrief`, `elicitationAnswers` and `priorAnswers` are the inputs
|
|
80
|
+
* a resume replays; they can be large and none of them helps a reader decide which run to answer.
|
|
81
|
+
* The `requests` ARE included, because a listing that says a run is waiting without saying what it
|
|
82
|
+
* asked cannot be acted on — the reader would have to resume blind to find out.
|
|
83
|
+
*
|
|
84
|
+
* ## Unreadable records are REPORTED, not skipped
|
|
85
|
+
*
|
|
86
|
+
* `load` treats a record it cannot parse as "not waiting", which is right for a resume: it cannot
|
|
87
|
+
* resume from it either way. Silently dropping it from a LISTING is different — the file then sits
|
|
88
|
+
* in a directory nobody can see, forever, and the listing's emptiness reads as "nothing is
|
|
89
|
+
* waiting". So they come back in their own array. A reader can then delete them; the directory is
|
|
90
|
+
* disposable state, and that is a safe act.
|
|
91
|
+
*
|
|
92
|
+
* Newest first, because the run a creator has just lost is the one they are looking for.
|
|
93
|
+
*/
|
|
94
|
+
list(): Promise<{
|
|
95
|
+
readonly suspended: readonly SuspendedPlaybookRunSummary[];
|
|
96
|
+
readonly unreadable: readonly string[];
|
|
97
|
+
}>;
|
|
58
98
|
/**
|
|
59
99
|
* Consume the checkpoint. Called on EVERY terminal outcome — accepted, declined or cancelled —
|
|
60
100
|
* because a record that outlives its run would let one suspension be resumed twice and produce two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-suspended-run.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-suspended-run.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAG1G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;iBAqBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,oGAAoG;AACpG,qBAAa,iCAAkC,SAAQ,KAAK;gBACvC,KAAK,EAAE,MAAM;CAMjC;AAED,qBACa,oCAAoC;IAIV,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAJrF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB;IAK1F,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D,yGAAyG;IAC5F,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB/D;;;;OAIG;IACU,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,WAAW;CAKpB"}
|
|
1
|
+
{"version":3,"file":"playbook-suspended-run.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-suspended-run.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAG1G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;iBAqBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,oBAAoB,EACpB,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,CAC1E,CAAC;AAEF,oGAAoG;AACpG,qBAAa,iCAAkC,SAAQ,KAAK;gBACvC,KAAK,EAAE,MAAM;CAMjC;AAED,qBACa,oCAAoC;IAIV,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAJrF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB;IAK1F,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D,yGAAyG;IAC5F,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB/D;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACU,IAAI,IAAI,OAAO,CAAC;QAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,2BAA2B,EAAE,CAAC;QAC3D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;KACxC,CAAC;IAmCF;;;;OAIG;IACU,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,WAAW;CAKpB"}
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
13
|
+
import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
14
14
|
import * as path from 'node:path';
|
|
15
15
|
import { inject, injectable } from 'inversify';
|
|
16
16
|
import { z } from 'zod';
|
|
@@ -98,6 +98,68 @@ let PlaybookSuspendedRunCompanionService = class PlaybookSuspendedRunCompanionSe
|
|
|
98
98
|
throw new SuspendedPlaybookRunNotFoundError(runId);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Every run currently waiting for answers — the read that makes a suspension REACHABLE.
|
|
103
|
+
*
|
|
104
|
+
* ## Why this had to exist
|
|
105
|
+
*
|
|
106
|
+
* `save`, `load` and `consume` are all a RESUME needs, and a resume needs a `runId` it was already
|
|
107
|
+
* given. So the only handle on a waiting run was the HTTP response its creator received: reload the
|
|
108
|
+
* page, open a second tab, or restart the browser, and the run stayed suspended on disk with nobody
|
|
109
|
+
* able to name it. Over `curl` that is survivable — the id sits in terminal scrollback — but a
|
|
110
|
+
* browser surface holds it in component state, so an ordinary navigation lost it.
|
|
111
|
+
*
|
|
112
|
+
* ## What it returns, and what it deliberately does not
|
|
113
|
+
*
|
|
114
|
+
* A SUMMARY, not the record. `creatorBrief`, `elicitationAnswers` and `priorAnswers` are the inputs
|
|
115
|
+
* a resume replays; they can be large and none of them helps a reader decide which run to answer.
|
|
116
|
+
* The `requests` ARE included, because a listing that says a run is waiting without saying what it
|
|
117
|
+
* asked cannot be acted on — the reader would have to resume blind to find out.
|
|
118
|
+
*
|
|
119
|
+
* ## Unreadable records are REPORTED, not skipped
|
|
120
|
+
*
|
|
121
|
+
* `load` treats a record it cannot parse as "not waiting", which is right for a resume: it cannot
|
|
122
|
+
* resume from it either way. Silently dropping it from a LISTING is different — the file then sits
|
|
123
|
+
* in a directory nobody can see, forever, and the listing's emptiness reads as "nothing is
|
|
124
|
+
* waiting". So they come back in their own array. A reader can then delete them; the directory is
|
|
125
|
+
* disposable state, and that is a safe act.
|
|
126
|
+
*
|
|
127
|
+
* Newest first, because the run a creator has just lost is the one they are looking for.
|
|
128
|
+
*/
|
|
129
|
+
async list() {
|
|
130
|
+
let names;
|
|
131
|
+
try {
|
|
132
|
+
names = await readdir(this.resolveDirectory());
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// No directory yet is the ordinary case — nothing has ever suspended — not a fault.
|
|
136
|
+
return { suspended: [], unreadable: [] };
|
|
137
|
+
}
|
|
138
|
+
const suspended = [];
|
|
139
|
+
const unreadable = [];
|
|
140
|
+
for (const name of names.filter((entry) => entry.endsWith('.json'))) {
|
|
141
|
+
const runId = name.slice(0, -'.json'.length);
|
|
142
|
+
let record;
|
|
143
|
+
try {
|
|
144
|
+
record = SuspendedPlaybookRunSchema.parse(JSON.parse(await readFile(path.join(this.resolveDirectory(), name), 'utf8')));
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
unreadable.push(runId);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
suspended.push({
|
|
151
|
+
runId: record.runId,
|
|
152
|
+
playbookRef: record.playbookRef,
|
|
153
|
+
family: record.family,
|
|
154
|
+
suspendedAt: record.suspendedAt,
|
|
155
|
+
round: record.round,
|
|
156
|
+
requests: record.requests,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
suspended.sort((left, right) => right.suspendedAt.localeCompare(left.suspendedAt));
|
|
160
|
+
unreadable.sort();
|
|
161
|
+
return { suspended, unreadable };
|
|
162
|
+
}
|
|
101
163
|
/**
|
|
102
164
|
* Consume the checkpoint. Called on EVERY terminal outcome — accepted, declined or cancelled —
|
|
103
165
|
* because a record that outlives its run would let one suspension be resumed twice and produce two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-suspended-run.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-suspended-run.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAE1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF;;;;;;;;;;;;;;;;GAgBG;A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BAAgB,CAAC,CAAA;;GALxC,oCAAoC,CAsDhD","sourcesContent":["import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { MetaWorkflow_ElicitationQuestionKind } from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\n\n/**\n * The CHECKPOINT behind a suspended playbook run — the state a resume needs, and nothing more.\n *\n * This is the industry pattern's persistence half: LangGraph's checkpointer, Step Functions' task\n * token, Temporal's workflow state. Wildo's version is deliberately the smallest of those, because\n * the thing being resumed is small: a suspended run has produced NOTHING (the clarification check\n * runs before the artifact call), so there is no partial artifact to snapshot — only the inputs that\n * would rebuild the same brief, plus the questions asked and any answers already given.\n *\n * ## Disposable, like every other per-run cache here\n *\n * It lives under `.wildo-saas/state/`, which is machine-local and gitignored\n * (`.claude/rules/one-source-of-truth.md`, rule 5: runtime state is a per-run cache, never truth).\n * Losing it costs a re-run of a playbook that had written nothing — never a fact about the product.\n * The ANSWERS, by contrast, are product decisions and reach the committed artifact through the\n * brief; this record is only how they get there.\n */\n\nexport const SuspendedPlaybookRunSchema = z.object({\n runId: z.string().min(1),\n playbookRef: z.string().min(1),\n /** The output being derived when the questions arose. */\n family: z.string().min(1),\n suspendedAt: z.string().min(1),\n /** Rounds already spent, so the budget survives a resume rather than resetting. */\n round: z.number().int().min(1),\n creatorBrief: z.string().optional(),\n /** The playbook's DECLARED up-front interview answers, replayed verbatim on resume. */\n elicitationAnswers: z.array(z.object({ questionRef: z.string().min(1), answer: z.string() })),\n /** Clarification answers from EARLIER rounds — cumulative, so the model never re-asks. */\n priorAnswers: z.array(z.object({ ref: z.string().min(1), answer: z.string() })),\n /** The questions this suspension is waiting on. */\n requests: z.array(z.object({\n ref: z.string().min(1),\n question: z.string().min(1),\n why: z.string().min(1),\n kind: z.enum(MetaWorkflow_ElicitationQuestionKind),\n options: z.array(z.string()).optional(),\n })),\n});\nexport type SuspendedPlaybookRun = z.infer<typeof SuspendedPlaybookRunSchema>;\n\n/** Named so the transport answers 404 rather than 500 for a resume of a run that is not waiting. */\nexport class SuspendedPlaybookRunNotFoundError extends Error {\n public constructor(runId: string) {\n super(\n `No suspended playbook run \"${runId}\" is waiting for answers. It may have been resumed already, `\n + 'cancelled, or lost with the companion state directory (which is disposable — re-run the playbook).',\n );\n }\n}\n\n@injectable()\nexport class PlaybookSuspendedRunCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('PlaybookSuspendedRunCompanionService');\n }\n\n public async save(record: SuspendedPlaybookRun): Promise<void> {\n const parsed = SuspendedPlaybookRunSchema.parse(record);\n await mkdir(this.resolveDirectory(), { recursive: true });\n await writeFile(this.resolvePath(parsed.runId), JSON.stringify(parsed, null, 2), 'utf8');\n this.logDebug('Playbook run suspended awaiting creator answers', {\n runId: parsed.runId, playbookRef: parsed.playbookRef, round: parsed.round, requests: parsed.requests.length,\n });\n }\n\n /** Throws rather than returning null: every caller here is resuming, and \"not waiting\" is the answer. */\n public async load(runId: string): Promise<SuspendedPlaybookRun> {\n let raw: string;\n try {\n raw = await readFile(this.resolvePath(runId), 'utf8');\n } catch {\n throw new SuspendedPlaybookRunNotFoundError(runId);\n }\n try {\n return SuspendedPlaybookRunSchema.parse(JSON.parse(raw));\n } catch {\n // A record this process cannot parse is a record it cannot resume from. Say so as \"not\n // waiting\" rather than 500-ing on a disposable cache the creator can simply re-run past.\n throw new SuspendedPlaybookRunNotFoundError(runId);\n }\n }\n\n /**\n * Consume the checkpoint. Called on EVERY terminal outcome — accepted, declined or cancelled —\n * because a record that outlives its run would let one suspension be resumed twice and produce two\n * artifacts from one question.\n */\n public async consume(runId: string): Promise<void> {\n await rm(this.resolvePath(runId), { force: true });\n }\n\n private resolveDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/suspended-runs');\n }\n\n private resolvePath(runId: string): string {\n // The runId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(runId)) throw new SuspendedPlaybookRunNotFoundError(runId);\n return path.join(this.resolveDirectory(), `${runId}.json`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"playbook-suspended-run.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-suspended-run.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAE1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,yDAAyD;IACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CA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CAAA;;GALxC,oCAAoC,CAwHhD","sourcesContent":["import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { MetaWorkflow_ElicitationQuestionKind } from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\n\n/**\n * The CHECKPOINT behind a suspended playbook run — the state a resume needs, and nothing more.\n *\n * This is the industry pattern's persistence half: LangGraph's checkpointer, Step Functions' task\n * token, Temporal's workflow state. Wildo's version is deliberately the smallest of those, because\n * the thing being resumed is small: a suspended run has produced NOTHING (the clarification check\n * runs before the artifact call), so there is no partial artifact to snapshot — only the inputs that\n * would rebuild the same brief, plus the questions asked and any answers already given.\n *\n * ## Disposable, like every other per-run cache here\n *\n * It lives under `.wildo-saas/state/`, which is machine-local and gitignored\n * (`.claude/rules/one-source-of-truth.md`, rule 5: runtime state is a per-run cache, never truth).\n * Losing it costs a re-run of a playbook that had written nothing — never a fact about the product.\n * The ANSWERS, by contrast, are product decisions and reach the committed artifact through the\n * brief; this record is only how they get there.\n */\n\nexport const SuspendedPlaybookRunSchema = z.object({\n runId: z.string().min(1),\n playbookRef: z.string().min(1),\n /** The output being derived when the questions arose. */\n family: z.string().min(1),\n suspendedAt: z.string().min(1),\n /** Rounds already spent, so the budget survives a resume rather than resetting. */\n round: z.number().int().min(1),\n creatorBrief: z.string().optional(),\n /** The playbook's DECLARED up-front interview answers, replayed verbatim on resume. */\n elicitationAnswers: z.array(z.object({ questionRef: z.string().min(1), answer: z.string() })),\n /** Clarification answers from EARLIER rounds — cumulative, so the model never re-asks. */\n priorAnswers: z.array(z.object({ ref: z.string().min(1), answer: z.string() })),\n /** The questions this suspension is waiting on. */\n requests: z.array(z.object({\n ref: z.string().min(1),\n question: z.string().min(1),\n why: z.string().min(1),\n kind: z.enum(MetaWorkflow_ElicitationQuestionKind),\n options: z.array(z.string()).optional(),\n })),\n});\nexport type SuspendedPlaybookRun = z.infer<typeof SuspendedPlaybookRunSchema>;\n\n/**\n * One waiting run as a LISTING sees it — enough to decide whether to answer it, and to answer it.\n *\n * Derived from the record's own schema rather than restated, so a field that changes shape there\n * cannot drift here. What is left out is the resume INPUTS (`creatorBrief`, `elicitationAnswers`,\n * `priorAnswers`): they can be large, and none of them helps a reader choose between waiting runs.\n */\nexport type SuspendedPlaybookRunSummary = Pick<\n SuspendedPlaybookRun,\n 'runId' | 'playbookRef' | 'family' | 'suspendedAt' | 'round' | 'requests'\n>;\n\n/** Named so the transport answers 404 rather than 500 for a resume of a run that is not waiting. */\nexport class SuspendedPlaybookRunNotFoundError extends Error {\n public constructor(runId: string) {\n super(\n `No suspended playbook run \"${runId}\" is waiting for answers. It may have been resumed already, `\n + 'cancelled, or lost with the companion state directory (which is disposable — re-run the playbook).',\n );\n }\n}\n\n@injectable()\nexport class PlaybookSuspendedRunCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('PlaybookSuspendedRunCompanionService');\n }\n\n public async save(record: SuspendedPlaybookRun): Promise<void> {\n const parsed = SuspendedPlaybookRunSchema.parse(record);\n await mkdir(this.resolveDirectory(), { recursive: true });\n await writeFile(this.resolvePath(parsed.runId), JSON.stringify(parsed, null, 2), 'utf8');\n this.logDebug('Playbook run suspended awaiting creator answers', {\n runId: parsed.runId, playbookRef: parsed.playbookRef, round: parsed.round, requests: parsed.requests.length,\n });\n }\n\n /** Throws rather than returning null: every caller here is resuming, and \"not waiting\" is the answer. */\n public async load(runId: string): Promise<SuspendedPlaybookRun> {\n let raw: string;\n try {\n raw = await readFile(this.resolvePath(runId), 'utf8');\n } catch {\n throw new SuspendedPlaybookRunNotFoundError(runId);\n }\n try {\n return SuspendedPlaybookRunSchema.parse(JSON.parse(raw));\n } catch {\n // A record this process cannot parse is a record it cannot resume from. Say so as \"not\n // waiting\" rather than 500-ing on a disposable cache the creator can simply re-run past.\n throw new SuspendedPlaybookRunNotFoundError(runId);\n }\n }\n\n /**\n * Every run currently waiting for answers — the read that makes a suspension REACHABLE.\n *\n * ## Why this had to exist\n *\n * `save`, `load` and `consume` are all a RESUME needs, and a resume needs a `runId` it was already\n * given. So the only handle on a waiting run was the HTTP response its creator received: reload the\n * page, open a second tab, or restart the browser, and the run stayed suspended on disk with nobody\n * able to name it. Over `curl` that is survivable — the id sits in terminal scrollback — but a\n * browser surface holds it in component state, so an ordinary navigation lost it.\n *\n * ## What it returns, and what it deliberately does not\n *\n * A SUMMARY, not the record. `creatorBrief`, `elicitationAnswers` and `priorAnswers` are the inputs\n * a resume replays; they can be large and none of them helps a reader decide which run to answer.\n * The `requests` ARE included, because a listing that says a run is waiting without saying what it\n * asked cannot be acted on — the reader would have to resume blind to find out.\n *\n * ## Unreadable records are REPORTED, not skipped\n *\n * `load` treats a record it cannot parse as \"not waiting\", which is right for a resume: it cannot\n * resume from it either way. Silently dropping it from a LISTING is different — the file then sits\n * in a directory nobody can see, forever, and the listing's emptiness reads as \"nothing is\n * waiting\". So they come back in their own array. A reader can then delete them; the directory is\n * disposable state, and that is a safe act.\n *\n * Newest first, because the run a creator has just lost is the one they are looking for.\n */\n public async list(): Promise<{\n readonly suspended: readonly SuspendedPlaybookRunSummary[];\n readonly unreadable: readonly string[];\n }> {\n let names: string[];\n try {\n names = await readdir(this.resolveDirectory());\n } catch {\n // No directory yet is the ordinary case — nothing has ever suspended — not a fault.\n return { suspended: [], unreadable: [] };\n }\n\n const suspended: SuspendedPlaybookRunSummary[] = [];\n const unreadable: string[] = [];\n for (const name of names.filter((entry) => entry.endsWith('.json'))) {\n const runId = name.slice(0, -'.json'.length);\n let record: SuspendedPlaybookRun;\n try {\n record = SuspendedPlaybookRunSchema.parse(JSON.parse(await readFile(path.join(this.resolveDirectory(), name), 'utf8')));\n } catch {\n unreadable.push(runId);\n continue;\n }\n suspended.push({\n runId: record.runId,\n playbookRef: record.playbookRef,\n family: record.family,\n suspendedAt: record.suspendedAt,\n round: record.round,\n requests: record.requests,\n });\n }\n\n suspended.sort((left, right) => right.suspendedAt.localeCompare(left.suspendedAt));\n unreadable.sort();\n return { suspended, unreadable };\n }\n\n /**\n * Consume the checkpoint. Called on EVERY terminal outcome — accepted, declined or cancelled —\n * because a record that outlives its run would let one suspension be resumed twice and produce two\n * artifacts from one question.\n */\n public async consume(runId: string): Promise<void> {\n await rm(this.resolvePath(runId), { force: true });\n }\n\n private resolveDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/suspended-runs');\n }\n\n private resolvePath(runId: string): string {\n // The runId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(runId)) throw new SuspendedPlaybookRunNotFoundError(runId);\n return path.join(this.resolveDirectory(), `${runId}.json`);\n }\n}\n"]}
|
|
@@ -62,6 +62,27 @@ export declare class TechnicalDocCompanionService {
|
|
|
62
62
|
* not an application-authored use-case selection.
|
|
63
63
|
*/
|
|
64
64
|
deriveApplicationDocumentationBundles(input: TechnicalDocumentationEnvironmentIdentityInput): Promise<TechnicalDocumentationApplicationDerivationResult>;
|
|
65
|
+
/**
|
|
66
|
+
* The application facts the documentation names instead of hedging: the product's own name and
|
|
67
|
+
* the base URLs it publishes.
|
|
68
|
+
*
|
|
69
|
+
* The name is what a customer calls the product — `displayName` from `wildo.saas.config.ts`,
|
|
70
|
+
* falling back to the application's `name`. Deliberately NOT `publicMarketingTitle`: that is the documentation SITE's
|
|
71
|
+
* title ("Wonder Todos — Technical Documentation") and reads wrong inside a sentence.
|
|
72
|
+
*
|
|
73
|
+
* The base URLs are the ones the application already authors for its API reference, so the
|
|
74
|
+
* guides and the reference name the same origins by construction.
|
|
75
|
+
*/
|
|
76
|
+
private resolveApplicationConnectionInputs;
|
|
77
|
+
/**
|
|
78
|
+
* The sign-in policy this application actually applies, per user type.
|
|
79
|
+
*
|
|
80
|
+
* Read from `userTypes[<key>].auth`, which is where all authentication policy lives — there are
|
|
81
|
+
* no global defaults. Enabled methods go through `getEnabledMethods`, the same helper the runtime
|
|
82
|
+
* uses, rather than re-reading the boolean-or-object shorthand here; and they are ordered by the
|
|
83
|
+
* engine's own enum so two applications list the same methods in the same order.
|
|
84
|
+
*/
|
|
85
|
+
private resolveApplicationAuthenticationInputs;
|
|
65
86
|
/**
|
|
66
87
|
* Publishes the complete managed documentation tree at stable generated paths.
|
|
67
88
|
* This operation synchronizes the framework-owned consumer documentation into
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"technical-doc.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/technical-doc/services/technical-doc.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,aAAa,EAId,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,wBAAwB,EAQxB,KAAK,+BAA+B,EAEpC,KAAK,WAAW,EAChB,KAAK,iCAAiC,
|
|
1
|
+
{"version":3,"file":"technical-doc.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/technical-doc/services/technical-doc.companion.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,aAAa,EAId,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,wBAAwB,EAQxB,KAAK,+BAA+B,EAEpC,KAAK,WAAW,EAChB,KAAK,iCAAiC,EAKvC,MAAM,wCAAwC,CAAC;AAChD,OAAO,E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,OAAO,CAAC;QACT,QAAQ,CAAC,UAAU,EAAE,iDAAiD,CAAC;QACvE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;QAChE,QAAQ,CAAC,WAAW,EAAE,+BAA+B,CAAC;QACtD,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;KAC3C,CAAC;IA6BF;;;;;;;;;;;;OAYG;IACU,wBAAwB,IAAI,OAAO,CAAC,iCAAiC,CAAC;IAuCnF;;;;OAIG;IACU,uBAAuB,IAAI,OAAO,CAAC;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IAQvH;;;;;;;;;;OAUG;YACW,uBAAuB;IAsDrC;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,uBAAuB;IA+C/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;YACW,sBAAsB;IAoEpC;;;;;;OAMG;YACW,mCAAmC;IAmBjD;;;;;;OAMG;IACH,OAAO,CAAC,8BAA8B;IAiBtC,OAAO,CAAC,iCAAiC;CAM1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,UAAU,EAAE,uBAAuB,CAAC,gCAAgC,CAAC,GACpE,WAAW,EAAE,CAuCf;AAkID,6DAA6D"}
|
|
@@ -46,7 +46,7 @@ import { existsSync } from 'node:fs';
|
|
|
46
46
|
import * as path from 'node:path';
|
|
47
47
|
import { inject, injectable } from 'inversify';
|
|
48
48
|
import { AppConfigurationService, ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, resolveFeatureGatedCoreResourceExclusions, describeCaughtError, } from '@wildo-ai/saas-backend-lib';
|
|
49
|
-
import { CoreResourceType, ErrorCustomMessageReference, ErrorType } from '@wildo-ai/saas-models';
|
|
49
|
+
import { AuthMethod, CoreResourceType, ErrorCustomMessageReference, ErrorType, getEnabledMethods } from '@wildo-ai/saas-models';
|
|
50
50
|
import { AppFrontendType, loadConfig } from '@wildo-ai/platform-config-lib';
|
|
51
51
|
import { generateOpenApiDocuments, resolveTechnicalDocumentationForbiddenPublicSentinels, resolveTechnicalDocumentationOutputBudgets, OpenApiGenerationInputSchema, resolveApplicationOrganizationRoleDocumentation, } from '@wildo-ai/saas-technical-doc/companion';
|
|
52
52
|
import { createApiReferenceLinkIndex, resolveTechnicalDocumentationApiReferenceLink, } from '@wildo-ai/saas-technical-doc';
|
|
@@ -115,8 +115,84 @@ let TechnicalDocCompanionService = class TechnicalDocCompanionService {
|
|
|
115
115
|
hasConfiguredA2aSkills: subprocessOutput.hasConfiguredA2aSkills,
|
|
116
116
|
organizationRoles,
|
|
117
117
|
organizationUnitAwareResources: subprocessOutput.organizationUnitAwareResources,
|
|
118
|
+
...this.resolveApplicationConnectionInputs(technicalDocConfig),
|
|
119
|
+
authentication: this.resolveApplicationAuthenticationInputs(),
|
|
120
|
+
integration: { mcpTools: subprocessOutput.mcpTools, webhookEvents: subprocessOutput.webhookEvents },
|
|
118
121
|
});
|
|
119
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* The application facts the documentation names instead of hedging: the product's own name and
|
|
125
|
+
* the base URLs it publishes.
|
|
126
|
+
*
|
|
127
|
+
* The name is what a customer calls the product — `displayName` from `wildo.saas.config.ts`,
|
|
128
|
+
* falling back to the application's `name`. Deliberately NOT `publicMarketingTitle`: that is the documentation SITE's
|
|
129
|
+
* title ("Wonder Todos — Technical Documentation") and reads wrong inside a sentence.
|
|
130
|
+
*
|
|
131
|
+
* The base URLs are the ones the application already authors for its API reference, so the
|
|
132
|
+
* guides and the reference name the same origins by construction.
|
|
133
|
+
*/
|
|
134
|
+
resolveApplicationConnectionInputs(technicalDocConfig) {
|
|
135
|
+
const saasConfig = this.companionContext.saasConfig;
|
|
136
|
+
const applicationName = saasConfig.displayName?.trim() || saasConfig.name.trim();
|
|
137
|
+
if (applicationName.length === 0) {
|
|
138
|
+
throw new Error('technical-documentation requires the application to declare a name (displayName or name in wildo.saas.config.ts)');
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
applicationName,
|
|
142
|
+
apiServers: (technicalDocConfig.apiServers ?? []).map((server) => ({
|
|
143
|
+
url: server.url,
|
|
144
|
+
...(server.description === undefined ? {} : { description: server.description }),
|
|
145
|
+
})),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The sign-in policy this application actually applies, per user type.
|
|
150
|
+
*
|
|
151
|
+
* Read from `userTypes[<key>].auth`, which is where all authentication policy lives — there are
|
|
152
|
+
* no global defaults. Enabled methods go through `getEnabledMethods`, the same helper the runtime
|
|
153
|
+
* uses, rather than re-reading the boolean-or-object shorthand here; and they are ordered by the
|
|
154
|
+
* engine's own enum so two applications list the same methods in the same order.
|
|
155
|
+
*/
|
|
156
|
+
resolveApplicationAuthenticationInputs() {
|
|
157
|
+
const userTypes = Object.entries(this.appConfigService.config.userTypes ?? {}).map(([userTypeKey, definition]) => {
|
|
158
|
+
const auth = definition.auth;
|
|
159
|
+
const enabled = getEnabledMethods(auth.authMethodsEnabled);
|
|
160
|
+
return {
|
|
161
|
+
userTypeKey,
|
|
162
|
+
enabledMethods: Object.values(AuthMethod).filter((method) => enabled.has(method)),
|
|
163
|
+
multifactor: {
|
|
164
|
+
required: auth.mfaPolicy.requireMFA,
|
|
165
|
+
strongRequired: auth.mfaPolicy.requireStrongMFA,
|
|
166
|
+
enrollmentGracePeriodDays: auth.mfaPolicy.enrollmentGracePeriodDays,
|
|
167
|
+
passkeyExemptFromMultifactor: auth.mfaPolicy.passkeyExemptFromMFA,
|
|
168
|
+
...(auth.mfaPolicy.acceptableMFAMethods === undefined ? {} : { acceptableMethods: auth.mfaPolicy.acceptableMFAMethods }),
|
|
169
|
+
},
|
|
170
|
+
password: {
|
|
171
|
+
minLength: auth.passwordPolicy.minLength,
|
|
172
|
+
maxLength: auth.passwordPolicy.maxLength,
|
|
173
|
+
requireUppercase: auth.passwordPolicy.requireUppercase,
|
|
174
|
+
requireLowercase: auth.passwordPolicy.requireLowercase,
|
|
175
|
+
requireNumbers: auth.passwordPolicy.requireNumbers,
|
|
176
|
+
requireSpecialChars: auth.passwordPolicy.requireSpecialChars,
|
|
177
|
+
expiryDays: auth.passwordPolicy.expiryDays,
|
|
178
|
+
},
|
|
179
|
+
session: {
|
|
180
|
+
durationMinutes: auth.sessionDurationMinutes,
|
|
181
|
+
...(auth.maxConcurrentSessions === undefined ? {} : { maxConcurrentSessions: auth.maxConcurrentSessions }),
|
|
182
|
+
},
|
|
183
|
+
lockout: {
|
|
184
|
+
maxLoginAttempts: auth.lockoutPolicy.maxLoginAttempts,
|
|
185
|
+
lockoutDurationMinutes: auth.lockoutPolicy.lockoutDurationMinutes,
|
|
186
|
+
progressive: auth.lockoutPolicy.progressiveLockout,
|
|
187
|
+
maxProgressiveLockoutHours: auth.lockoutPolicy.maxProgressiveLockoutHours,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
if (userTypes.length === 0) {
|
|
192
|
+
throw new Error('technical-documentation requires the application to declare at least one user type');
|
|
193
|
+
}
|
|
194
|
+
return { userTypes };
|
|
195
|
+
}
|
|
120
196
|
/**
|
|
121
197
|
* Publishes the complete managed documentation tree at stable generated paths.
|
|
122
198
|
* This operation synchronizes the framework-owned consumer documentation into
|
|
@@ -181,6 +257,9 @@ let TechnicalDocCompanionService = class TechnicalDocCompanionService {
|
|
|
181
257
|
hasConfiguredA2aSkills: subprocessOutput.hasConfiguredA2aSkills,
|
|
182
258
|
organizationRoles,
|
|
183
259
|
organizationUnitAwareResources: subprocessOutput.organizationUnitAwareResources,
|
|
260
|
+
...this.resolveApplicationConnectionInputs(technicalDocConfig),
|
|
261
|
+
authentication: this.resolveApplicationAuthenticationInputs(),
|
|
262
|
+
integration: { mcpTools: subprocessOutput.mcpTools, webhookEvents: subprocessOutput.webhookEvents },
|
|
184
263
|
});
|
|
185
264
|
const generationInput = this.assembleGenerationInput(subprocessOutput, technicalDocConfig);
|
|
186
265
|
return Object.freeze({
|
|
@@ -441,7 +520,12 @@ let TechnicalDocCompanionService = class TechnicalDocCompanionService {
|
|
|
441
520
|
}
|
|
442
521
|
let loaded;
|
|
443
522
|
try {
|
|
444
|
-
|
|
523
|
+
// `freshModuleCache` is what makes the docblock's "evaluated for every request" true. Calling
|
|
524
|
+
// `loadConfig` again is NOT enough on its own: jiti's module cache is process-global, so
|
|
525
|
+
// without this the second evaluation returns the first one's result and a valid taxonomy,
|
|
526
|
+
// server or overview edit stays invisible until an unrelated restart — precisely the outcome
|
|
527
|
+
// the contract above rejects. Same defect as issue #170, different read site.
|
|
528
|
+
loaded = await loadConfig(techDocConfigPath, { freshModuleCache: true });
|
|
445
529
|
}
|
|
446
530
|
catch (e) {
|
|
447
531
|
throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {
|