@wildo-ai/dev-companion 1.1.14 → 1.1.15
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 +68 -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 +77 -5
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +46 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +39 -2
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
- package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
- package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
- package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +16 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +44 -4
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +79 -6
- 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 +291 -40
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
- package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts +3 -2
- package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
- 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 +24 -14
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
- package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
- package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
- package/dist/esm/core/introspection/workspace-element-index.companion.js.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +53 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
- 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 +13 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
- package/dist/esm/email/services/email-template.companion.service.d.ts +5 -0
- package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
- package/dist/esm/email/services/email-template.companion.service.js +44 -11
- package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
- package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
- package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
- package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
- package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
- package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +35 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +2 -2
- package/dist/esm/i18n/system_enums/workbench-build.en.js +2 -2
- package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
- package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
- package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +9 -0
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +18 -2
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +33 -6
- 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 +97 -19
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +21 -8
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +65 -12
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +48 -26
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +12 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +7 -0
- 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 +81 -4
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
- package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
- package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
- package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
- package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
- package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-source-files.companion.js +45 -0
- package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
- package/package.json +17 -17
|
@@ -70,7 +70,7 @@ export declare const labels: {
|
|
|
70
70
|
readonly contended: "Waits for a task being built that writes the same file";
|
|
71
71
|
readonly awaiting_isolated_recheck: "Failed a check while other tasks were writing: its checks run again alone when the wave ends";
|
|
72
72
|
readonly ran_this_wave: "Already ran in this wave without landing: the next wave offers it again";
|
|
73
|
-
readonly landing_unknown: "Whether it landed cannot be
|
|
73
|
+
readonly landing_unknown: "Whether it landed, or its work passes, cannot be known yet: waiting for its check to answer";
|
|
74
74
|
readonly follow_up_awaiting_review: "A follow-up waiting for your review: approve it to run it, or decline it";
|
|
75
75
|
readonly stale_expert_charters: "Waiting for its experts' charters to be derived again from what changed since";
|
|
76
76
|
readonly repeated_identical_failure: "Failed the same way twice with nothing it reads changed: fix the cause, then run it by name";
|
|
@@ -78,7 +78,7 @@ export declare const labels: {
|
|
|
78
78
|
};
|
|
79
79
|
readonly CodingRunFailureAttribution: {
|
|
80
80
|
readonly task: "The task's own failure: it counts";
|
|
81
|
-
readonly host: "The environment's failure: forgiven, up to a bound";
|
|
81
|
+
readonly host: "The environment's failure: forgiven, up to a bound, and never counted when a check could not be asked";
|
|
82
82
|
};
|
|
83
83
|
readonly SchemaPlanSyncState: {
|
|
84
84
|
readonly in_sync: "The model and the accepted schema plan agree";
|
|
@@ -75,7 +75,7 @@ export const labels = {
|
|
|
75
75
|
contended: 'Waits for a task being built that writes the same file',
|
|
76
76
|
awaiting_isolated_recheck: 'Failed a check while other tasks were writing: its checks run again alone when the wave ends',
|
|
77
77
|
ran_this_wave: 'Already ran in this wave without landing: the next wave offers it again',
|
|
78
|
-
landing_unknown: 'Whether it landed cannot be
|
|
78
|
+
landing_unknown: 'Whether it landed, or its work passes, cannot be known yet: waiting for its check to answer',
|
|
79
79
|
follow_up_awaiting_review: 'A follow-up waiting for your review: approve it to run it, or decline it',
|
|
80
80
|
stale_expert_charters: 'Waiting for its experts\' charters to be derived again from what changed since',
|
|
81
81
|
repeated_identical_failure: 'Failed the same way twice with nothing it reads changed: fix the cause, then run it by name',
|
|
@@ -88,7 +88,7 @@ export const labels = {
|
|
|
88
88
|
*/
|
|
89
89
|
CodingRunFailureAttribution: {
|
|
90
90
|
task: "The task's own failure: it counts",
|
|
91
|
-
host: "The environment's failure: forgiven, up to a bound",
|
|
91
|
+
host: "The environment's failure: forgiven, up to a bound, and never counted when a check could not be asked",
|
|
92
92
|
},
|
|
93
93
|
/*
|
|
94
94
|
* Where a generation step that has not landed stands (#2530): it has work to do, or its check could not answer, in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workbench-build.en.js","sourceRoot":"","sources":["../../../../src/i18n/system_enums/workbench-build.en.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,YAAY,EAAE;QACZ,4BAA4B,EAAE;YAC5B,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,QAAQ;SACjB;QACD;;;;WAIG;QACH,sBAAsB,EAAE;YACtB,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,qBAAqB;SAClC;QACD,mFAAmF;QACnF,6BAA6B,EAAE;YAC7B,YAAY,EAAE,sBAAsB;YACpC,eAAe,EAAE,oBAAoB;YACrC,qBAAqB,EAAE,8BAA8B;SACtD;QACD,iDAAiD;QACjD,wBAAwB,EAAE;YACxB,iBAAiB,EAAE,6BAA6B;YAChD,gBAAgB,EAAE,6BAA6B;SAChD;QACD,gHAAgH;QAChH,yBAAyB,EAAE;YACzB,SAAS,EAAE,4DAA4D;YACvE,eAAe,EAAE,uBAAuB;YACxC,eAAe,EAAE,+CAA+C;YAChE,WAAW,EAAE,6DAA6D;SAC3E;QACD,iHAAiH;QACjH,sBAAsB,EAAE;YACtB,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,6BAA6B;SAC3C;QACD,8FAA8F;QAC9F,4BAA4B,EAAE;YAC5B,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,SAAS;SACnB;QACD;;;;WAIG;QACH,8BAA8B,EAAE;YAC9B,kBAAkB,EAAE,oEAAoE;YACxF,sBAAsB,EAAE,uCAAuC;YAC/D,qBAAqB,EAAE,iDAAiD;YACxE,kBAAkB,EAAE,mEAAmE;YACvF,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE,wDAAwD;YACnE,yBAAyB,EAAE,8FAA8F;YACzH,aAAa,EAAE,yEAAyE;YACxF,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"workbench-build.en.js","sourceRoot":"","sources":["../../../../src/i18n/system_enums/workbench-build.en.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,YAAY,EAAE;QACZ,4BAA4B,EAAE;YAC5B,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,QAAQ;SACjB;QACD;;;;WAIG;QACH,sBAAsB,EAAE;YACtB,IAAI,EAAE,eAAe;YACrB,UAAU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,EAAE;YACrB,OAAO,EAAE,0CAA0C;YACnD,KAAK,EAAE,4CAA4C;YACnD,YAAY,EAAE,qCAAqC;SACpD;QACD,gBAAgB,EAAE;YAChB,OAAO,EAAE,oCAAoC;YAC7C,KAAK,EAAE,sCAAsC;YAC7C,YAAY,EAAE,6BAA6B;SAC5C;QACD;;;WAGG;QACH,oBAAoB,EAAE;YACpB,iBAAiB,EAAE,2CAA2C;YAC9D,uBAAuB,EAAE,mCAAmC;YAC5D,oBAAoB,EAAE,qBAAqB;YAC3C,WAAW,EAAE,oDAAoD;YACjE,8BAA8B,EAAE,gCAAgC;SACjE;QACD,qGAAqG;QACrG,oBAAoB,EAAE;YACpB,iBAAiB,EAAE,uBAAuB;YAC1C,mBAAmB,EAAE,mBAAmB;YACxC,QAAQ,EAAE,4CAA4C;SACvD;KACF;CACO,CAAC","sourcesContent":["/**\n * English (en) — the BUILD vocabularies: the dispatch phase, the plan-task status, why a ready task is stuck, and whose\n * failure a failed coding run was.\n *\n * Authored under `system_enums` rather than per resource field because each field DECLARES its enum\n * (`.systemEnum('Workbench_BuildDispatchPhase')`, `.systemEnum('WorkbenchBuildPlanTaskStatus')`),\n * which is what makes this block readable at all: the frontend words a value through the vocabulary\n * its FIELD declares and no other. The task status was worded per field until #1321 registered its\n * colours by vocabulary name; the words moved with the declaration, so one enum has one home.\n *\n * ## The wording rule\n *\n * These are read by somebody asking \"what happened to this task\", so they are written as OUTCOMES in\n * a person's words rather than as the lane's internal states. \"Admitted\" is the one that would be\n * opaque on its own — it means a coding run was accepted and is running, and its result lives in the\n * actor-task row rather than here — so it is worded as the running state it is.\n */\nexport const labels = {\n system_enums: {\n Workbench_BuildDispatchPhase: {\n submitted: 'Submitted',\n admitted: 'Running',\n finished: 'Finished',\n failed: 'Failed',\n },\n /**\n * What a resource IS to the module that lists it (#1482). The domain plan splits its resources\n * into two lists and the projection keeps that distinction as a role, because \"the module is\n * about this\" and \"the module needs this\" are different claims about the same name.\n */\n DomainPlanResourceRole: {\n main: 'Main resource',\n supporting: 'Supporting resource',\n },\n /** How organizations of one type come to exist and admit their members (#3032). */\n DomainPlanOrganizationJoining: {\n SELF_SERVICE: 'Sign up on their own',\n INVITATION_ONLY: 'By invitation only',\n DIRECTORY_PROVISIONED: 'From their company directory',\n },\n /** Where one resource's records live (#3039). */\n DomainPlanRecordLocation: {\n APPLICATION_STORE: \"The application's own store\",\n SYSTEM_OF_RECORD: 'An outside system of record',\n },\n /** Whether an outside system's records are split by legal entity (#3045), laid down from the system's facet. */\n DomainPlanRecordPartition: {\n NOT_SPLIT: 'Not split: every member who may read them sees all of them',\n BY_LEGAL_ENTITY: 'Split by legal entity',\n CANNOT_BE_SPLIT: 'Cannot be split: the system declares no split',\n UNCONFIRMED: 'Split by legal entity, not yet confirmed against the system',\n },\n /** What an acting organization sees of the other organization's own records (#3032). The engine's vocabulary. */\n TenantRecordVisibility: {\n role: 'Every record its role reaches',\n shared_only: 'Only records shared with it',\n },\n /** Where one build-plan task stands: dispatchable now, done, or waiting on a prerequisite. */\n WorkbenchBuildPlanTaskStatus: {\n ready: 'Ready',\n landed: 'Landed',\n blocked: 'Blocked',\n },\n /*\n * Why a ready task is passed over (#1451). Worded as the REMEDY, because the remedy is the only\n * thing a reader needs and each reason's is different. The facts a remedy names (the uncommitted\n * paths, the question, the document) are the row's own fields, shown beside these words.\n */\n Workbench_BuildTaskStuckReason: {\n completed_unlanded: 'Ran, but its product is missing: fix what it declares, or the work',\n parked_awaiting_answer: 'Waiting for an answer to its question',\n no_document_blueprint: 'Produces a document the catalog does not define',\n attempts_exhausted: 'Failed every attempt it is allowed: fix the cause, then re-arm it',\n in_flight: 'Being built right now',\n contended: 'Waits for a task being built that writes the same file',\n awaiting_isolated_recheck: 'Failed a check while other tasks were writing: its checks run again alone when the wave ends',\n ran_this_wave: 'Already ran in this wave without landing: the next wave offers it again',\n landing_unknown: 'Whether it landed, or its work passes, cannot be known yet: waiting for its check to answer',\n follow_up_awaiting_review: 'A follow-up waiting for your review: approve it to run it, or decline it',\n stale_expert_charters: 'Waiting for its experts\\' charters to be derived again from what changed since',\n repeated_identical_failure: 'Failed the same way twice with nothing it reads changed: fix the cause, then run it by name',\n failure_outside_application: 'Failed on a cause in the framework, not in this application: fix it there, then run it by name',\n },\n /*\n * Whose failure a failed coding run was (#1581, shown per attempt since #2530). Worded as what it means for the\n * task's attempt budget, because that is why anyone reads it: the task's own failures count, the host's are forgiven\n * up to a bound.\n */\n CodingRunFailureAttribution: {\n task: \"The task's own failure: it counts\",\n host: \"The environment's failure: forgiven, up to a bound, and never counted when a check could not be asked\",\n },\n /*\n * Where a generation step that has not landed stands (#2530): it has work to do, or its check could not answer, in\n * which case running it again would fail the same way. Each step's own words, since each checks something different.\n */\n SchemaPlanSyncState: {\n in_sync: 'The model and the accepted schema plan agree',\n drifted: 'The model has changes no migration covers yet',\n unanswerable: 'The schema plan could not be checked',\n },\n DesignTokenBlockState: {\n current: 'The stylesheet matches the design system',\n stale: 'The stylesheet is behind the design system',\n unanswerable: 'The stylesheet could not be checked',\n },\n BrandDesignState: {\n current: 'The brand design matches the brand',\n stale: 'The brand design is behind the brand',\n unanswerable: 'The brand could not be read',\n },\n /*\n * Why a build task was put back in the queue (#1535, offered and shown in the workbench since #2530). The first\n * three are a person's; the last is the build wave's own, after a sibling run lost the task's product.\n */\n BuildTaskRearmReason: {\n 'probe-corrected': 'The landing check was wrong, and is fixed',\n 'blocking-defect-fixed': 'A defect that blocked it is fixed',\n 'operator-judgement': 'It should run again',\n environment: 'The network or the machine failed it, not the task',\n 'interfered-by-concurrent-run': 'Another run overwrote its work',\n },\n /* How a task a person closed is accounted for (#3224, #3227): what made it done, if anything did. */\n BuildTaskClosureKind: {\n satisfied_by_task: 'Another task built it',\n satisfied_by_commit: 'A commit built it',\n declined: 'Declined: the gap it answers is not worked',\n },\n },\n} as const;\n"]}
|
package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-template-labelling-units.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/email-template-labelling-units.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwD,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEtH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,2EAA2E,CAAC;AACjI,OAAO,EAAE,sCAAsC,EAAE,MAAM,kEAAkE,CAAC;AAI1H,OAAO,EAGL,KAAK,0BAA0B,EAEhC,MAAM,gDAAgD,CAAC;AAUxD;;;;;;;;;;;GAWG;AACH,qBACa,2CAA2C;IAEjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEnF,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAE5C,OAAO,CAAC,QAAQ,CAAC,sBAAsB;gBALa,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB,EAEpF,2BAA2B,EAAE,oCAAoC,EAEjE,sBAAsB,EAAE,sCAAsC;IAGjF;;;;OAIG;IACU,sBAAsB,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"email-template-labelling-units.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/email-template-labelling-units.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwD,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEtH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,2EAA2E,CAAC;AACjI,OAAO,EAAE,sCAAsC,EAAE,MAAM,kEAAkE,CAAC;AAI1H,OAAO,EAGL,KAAK,0BAA0B,EAEhC,MAAM,gDAAgD,CAAC;AAUxD;;;;;;;;;;;GAWG;AACH,qBACa,2CAA2C;IAEjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEnF,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAE5C,OAAO,CAAC,QAAQ,CAAC,sBAAsB;gBALa,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB,EAEpF,2BAA2B,EAAE,oCAAoC,EAEjE,sBAAsB,EAAE,sCAAsC;IAGjF;;;;OAIG;IACU,sBAAsB,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAsC1G;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IA0BhC;;;;;;;;OAQG;YACW,eAAe;CA0B9B;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAQ/F;AAED,+DAA+D;AAC/D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK7E"}
|
package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js
CHANGED
|
@@ -17,7 +17,7 @@ import { EMAIL_COMPONENT_LABELS_DIRECTORY, SAAS_SERVICE_TYPES } from '@wildo-ai/
|
|
|
17
17
|
import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
|
|
18
18
|
import { TranslationPlacementCompanionService } from '../../core/introspection/services/translation-placement.companion.service.js';
|
|
19
19
|
import { EmailSpecContextLoaderCompanionService } from '../../email/services/email-spec-context-loader.companion.service.js';
|
|
20
|
-
import {
|
|
20
|
+
import { resolveEmailTemplateArtifactPlacement } from '../../email/utils/email-template-fs-discovery.utils.js';
|
|
21
21
|
import { LabellingUnitCategory } from '../models/labelling-unit.models.js';
|
|
22
22
|
import { emailComponentLabelsUnitRef, emailTemplateLabellingUnitId, } from '../models/email-template-labelling-unit.models.js';
|
|
23
23
|
/**
|
|
@@ -62,7 +62,7 @@ let EmailTemplateLabellingUnitsCompanionService = class EmailTemplateLabellingUn
|
|
|
62
62
|
includeBackendEmail: true,
|
|
63
63
|
});
|
|
64
64
|
const ownership = snapshot.backendEmail.flatMap((entry) => entry.emailTemplateOwnership);
|
|
65
|
-
const targets =
|
|
65
|
+
const { targets, unplaced } = resolveEmailTemplateArtifactPlacement(this.companionContext.saasRoot, ownership, templateRefs && templateRefs.length > 0 ? [...templateRefs] : undefined);
|
|
66
66
|
if (snapshot.warnings.length > 0) {
|
|
67
67
|
this.logger.warn('Email template placement answered with warnings — the email translate plan may be short', {
|
|
68
68
|
warnings: snapshot.warnings,
|
|
@@ -80,7 +80,11 @@ let EmailTemplateLabellingUnitsCompanionService = class EmailTemplateLabellingUn
|
|
|
80
80
|
}))
|
|
81
81
|
.concat(this.planComponentLabelsUnits(ownership, templateRefs))
|
|
82
82
|
.sort((left, right) => left.templateRef.localeCompare(right.templateRef));
|
|
83
|
-
|
|
83
|
+
/*
|
|
84
|
+
* A template whose owner registers it from no folder the companion can read has no file to translate (#3904 review
|
|
85
|
+
* F2): said in the plan's warnings, never dropped in silence.
|
|
86
|
+
*/
|
|
87
|
+
return { units, warnings: [...snapshot.warnings, ...unplaced.map((entry) => `${entry.templateRef}: not translated, ${entry.reason}.`)] };
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
86
90
|
* One unit per owner that declares words for its shared email components (#2884): `components/labels.{locale}.ts`
|
package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-template-labelling-units.companion.service.js","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/email-template-labelling-units.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,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AAuB,CAAC,YAAoB;IAChE,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,MAAM,KAAK,GAAG,mDAAmD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC","sourcesContent":["import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { EMAIL_COMPONENT_LABELS_DIRECTORY, SAAS_SERVICE_TYPES, type LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { TranslationPlacementCompanionService } from '../../core/introspection/services/translation-placement.companion.service';\nimport { EmailSpecContextLoaderCompanionService } from '../../email/services/email-spec-context-loader.companion.service';\nimport { resolveEmailTemplateArtifactTargets } from '../../email/utils/email-template-fs-discovery.utils';\nimport type { CompanionEmailTemplateOwnershipDescriptor } from '@wildo-ai/saas-models/companion';\nimport { LabellingUnitCategory, type LabellingUnitSpecContext } from '../models/labelling-unit.models';\nimport {\n emailComponentLabelsUnitRef,\n emailTemplateLabellingUnitId,\n type EmailTemplateLabellingPlan,\n type EmailTemplateLabellingUnit,\n} from '../models/email-template-labelling-unit.models';\n\n/**\n * The `system.` prefix of a system email ref. Only system emails carry an authored\n * `SystemEmailTemplateSpecification`; asking the spec loader for a resource email's ref would log a\n * \"no specification found\" warning per template — ninety of them per run — for a lookup that cannot\n * succeed by construction.\n */\nconst SYSTEM_EMAIL_TEMPLATE_REF_PREFIX = 'system.';\n\n/**\n * Plans the translate pipeline's email lane (#1908): one {@link EmailTemplateLabellingUnit} per email\n * template the application's backend owners declare.\n *\n * Discovery is the SAME the email generator and status routes use — the backend\n * `email-template-placement-info` introspection (engine root + every module's email root) resolved to\n * directories by `resolveEmailTemplateArtifactTargets` — so the translation lane cannot see a\n * different set of templates from the one `wildo generate email` writes.\n *\n * Deliberately separate from `LabellingPlannerCompanionService.planAllUnits()`: that plan is what\n * LABELLIZE iterates, and an email's primary words are authored, never labellized.\n */\n@injectable()\nexport class EmailTemplateLabellingUnitsCompanionService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TranslationPlacementService)\n private readonly translationPlacementService: TranslationPlacementCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailSpecContextLoader)\n private readonly emailSpecContextLoader: EmailSpecContextLoaderCompanionService,\n ) {}\n\n /**\n * Every email template the backend owners declare, as translate units.\n *\n * @param templateRefs - restrict to these refs; omit for every template.\n */\n public async planEmailTemplateUnits(templateRefs?: readonly string[]): Promise<EmailTemplateLabellingPlan> {\n const snapshot = await this.translationPlacementService.getPlacementSnapshot({\n includeShared: false,\n includeFrontend: false,\n includeBackendEmail: true,\n });\n const ownership = snapshot.backendEmail.flatMap((entry) => entry.emailTemplateOwnership);\n const targets = resolveEmailTemplateArtifactTargets(\n this.companionContext.saasRoot,\n ownership,\n templateRefs && templateRefs.length > 0 ? [...templateRefs] : undefined,\n );\n if (snapshot.warnings.length > 0) {\n this.logger.warn('Email template placement answered with warnings — the email translate plan may be short', {\n warnings: snapshot.warnings,\n });\n }\n\n const units = targets\n .map((target): EmailTemplateLabellingUnit => ({\n category: LabellingUnitCategory.EMAIL_TEMPLATE,\n id: emailTemplateLabellingUnitId(target.templateRef),\n templateRef: target.templateRef,\n ownerId: target.ownerId,\n displayLabel: `email ${target.templateRef}`,\n templateDirectory: target.dirPath,\n loadSpecContext: () => this.loadSpecContext(target.templateRef, target.templatePath),\n }))\n .concat(this.planComponentLabelsUnits(ownership, templateRefs))\n .sort((left, right) => left.templateRef.localeCompare(right.templateRef));\n\n return { units, warnings: [...snapshot.warnings] };\n }\n\n /**\n * One unit per owner that declares words for its shared email components (#2884): `components/labels.{locale}.ts`\n * under the owner's email root, which the runtime reads with `scanEmailComponentLabels`. Named in a `templateRefs`\n * restriction by its pseudo ref (`emailComponentLabelsUnitRef`), and planned with every template otherwise.\n */\n private planComponentLabelsUnits(\n ownership: readonly CompanionEmailTemplateOwnershipDescriptor[],\n templateRefs: readonly string[] | undefined,\n ): EmailTemplateLabellingUnit[] {\n const allow = templateRefs && templateRefs.length > 0 ? new Set(templateRefs) : null;\n return ownership\n .filter((owner) => owner.declaresComponentLabels === true && owner.rootsByRole.backend)\n .map((owner) => ({ owner, templateRef: emailComponentLabelsUnitRef(owner.ownerId) }))\n .filter(({ templateRef }) => !allow || allow.has(templateRef))\n .map(({ owner, templateRef }): EmailTemplateLabellingUnit => ({\n category: LabellingUnitCategory.EMAIL_TEMPLATE,\n id: emailTemplateLabellingUnitId(templateRef),\n templateRef,\n ownerId: owner.ownerId,\n displayLabel: `email components of ${owner.ownerId}`,\n templateDirectory: path.resolve(this.companionContext.saasRoot, owner.rootsByRole.backend!, EMAIL_COMPONENT_LABELS_DIRECTORY),\n loadSpecContext: async () => ({\n description: 'These are the words of the shared components EVERY transactional email of this application renders, '\n + 'such as the footer (\"sent by\" the application, the support contact). They sit around each email\\'s own text, '\n + 'so keep them short, neutral and consistent with the register of the emails. Keep every `{placeholder}` '\n + 'and the leading and trailing spaces exactly as the source has them.',\n origin: [path.join(owner.rootsByRole.backend!, EMAIL_COMPONENT_LABELS_DIRECTORY)],\n }),\n }));\n }\n\n /**\n * The context replayed into an email's translation prompt: what the email is FOR, so terminology and\n * register follow the message rather than a word-by-word reading of fragments.\n *\n * Two sources, both authored and both optional: the system email's `SystemEmailTemplateSpecification`\n * (purpose, tone, per-slot meaning — the same TRANSLATION_CONTEXT the email generator's translator\n * used), and the template's own `description`, which every template declares for diagnostics. Never\n * throws: a missing context degrades the prompt, it does not fail the unit.\n */\n private async loadSpecContext(templateRef: string, templatePath: string): Promise<LabellingUnitSpecContext | undefined> {\n const parts: string[] = [];\n const origin: string[] = [];\n\n if (templateRef.startsWith(SYSTEM_EMAIL_TEMPLATE_REF_PREFIX)) {\n const specification = await this.emailSpecContextLoader.loadTranslationContext(templateRef);\n if (specification?.description) {\n parts.push(specification.description.trim());\n origin.push(`systemEmailTemplateSpecifications.${templateRef}`);\n }\n }\n\n const templateDescription = await readTemplateDescription(templatePath);\n if (templateDescription) {\n parts.push(`What this email is for: ${templateDescription}`);\n origin.push(templatePath);\n }\n\n parts.push(\n 'These are the words of ONE transactional email. Some values are sentence FRAGMENTS the template joins '\n + 'with live values (a name, an organization) — translate each fragment so the joined sentence reads '\n + 'naturally, and keep the leading and trailing spaces exactly as the source has them.',\n );\n\n return { description: parts.join('\\n\\n'), origin };\n }\n}\n\n/**\n * The `description: '…'` a template declares on its `EmailTemplateDefinition`, read without executing\n * the template. Absent when the template declares none or the file cannot be read.\n */\nexport async function readTemplateDescription(templatePath: string): Promise<string | undefined> {\n let source: string;\n try {\n source = await fs.readFile(templatePath, 'utf-8');\n } catch {\n return undefined;\n }\n return extractTemplateDescription(source);\n}\n\n/** Pure half of {@link readTemplateDescription}, for tests. */\nexport function extractTemplateDescription(source: string): string | undefined {\n const match = /\\bdescription:\\s*(['\"])((?:\\\\.|(?!\\1)[^\\\\\\n])*)\\1/.exec(source);\n if (!match) return undefined;\n const value = match[2]!.replace(/\\\\(.)/g, '$1').trim();\n return value.length > 0 ? value : undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"email-template-labelling-units.companion.service.js","sourceRoot":"","sources":["../../../../src/i18n-labelling/services/email-template-labelling-units.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAsB,MAAM,4BAA4B,CAAC;AACtH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,oCAAoC,EAAE,MAAM,2EAA2E,CAAC;AACjI,OAAO,EAAE,sCAAsC,EAAE,MAAM,kEAAkE,CAAC;AAC1H,OAAO,EAAE,qCAAqC,EAAE,MAAM,qDAAqD,CAAC;AAE5G,OAAO,EAAE,qBAAqB,EAAiC,MAAM,iCAAiC,CAAC;AACvG,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAG7B,MAAM,gDAAgD,CAAC;AAExD;;;;;GAKG;AACH,MAAM,gCAAgC,GAAG,SAAS,CAAC;AAEnD;;;;;;;;;;;GAWG;AAEI,IAAM,2CAA2C,GAAjD,MAAM,2CAA2C;IAEA;IACe;IAElD;IAEA;IANnB,YACsD,MAAqB,EACN,gBAAkC,EAEpF,2BAAiE,EAEjE,sBAA8D;QAL3B,WAAM,GAAN,MAAM,CAAe;QACN,qBAAgB,GAAhB,gBAAgB,CAAkB;QAEpF,gCAA2B,GAA3B,2BAA2B,CAAsC;QAEjE,2BAAsB,GAAtB,sBAAsB,CAAwC;IAC9E,CAAC;IAEJ;;;;OAIG;IACI,KAAK,CAAC,sBAAsB,CAAC,YAAgC;QAClE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,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CAAC;QAEF,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IACrD,CAAC;CACF,CAAA;AAvHY,2CAA2C;IADvD,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,2BAA2B,CAAC,CAAA;IAE3D,WAAA,MAAM,CAAC,uBAAuB,CAAC,sBAAsB,CAAC,CAAA;uDADT,oCAAoC;QAEzC,sCAAsC;GAPtE,2CAA2C,CAuHvD;;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,YAAoB;IAChE,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,MAAM,KAAK,GAAG,mDAAmD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC","sourcesContent":["import * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { EMAIL_COMPONENT_LABELS_DIRECTORY, SAAS_SERVICE_TYPES, type LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { TranslationPlacementCompanionService } from '../../core/introspection/services/translation-placement.companion.service';\nimport { EmailSpecContextLoaderCompanionService } from '../../email/services/email-spec-context-loader.companion.service';\nimport { resolveEmailTemplateArtifactPlacement } from '../../email/utils/email-template-fs-discovery.utils';\nimport type { CompanionEmailTemplateOwnershipDescriptor } from '@wildo-ai/saas-models/companion';\nimport { LabellingUnitCategory, type LabellingUnitSpecContext } from '../models/labelling-unit.models';\nimport {\n emailComponentLabelsUnitRef,\n emailTemplateLabellingUnitId,\n type EmailTemplateLabellingPlan,\n type EmailTemplateLabellingUnit,\n} from '../models/email-template-labelling-unit.models';\n\n/**\n * The `system.` prefix of a system email ref. Only system emails carry an authored\n * `SystemEmailTemplateSpecification`; asking the spec loader for a resource email's ref would log a\n * \"no specification found\" warning per template — ninety of them per run — for a lookup that cannot\n * succeed by construction.\n */\nconst SYSTEM_EMAIL_TEMPLATE_REF_PREFIX = 'system.';\n\n/**\n * Plans the translate pipeline's email lane (#1908): one {@link EmailTemplateLabellingUnit} per email\n * template the application's backend owners declare.\n *\n * Discovery is the SAME the email generator and status routes use — the backend\n * `email-template-placement-info` introspection (engine root + every module's email root) resolved to\n * directories by `resolveEmailTemplateArtifactTargets` — so the translation lane cannot see a\n * different set of templates from the one `wildo generate email` writes.\n *\n * Deliberately separate from `LabellingPlannerCompanionService.planAllUnits()`: that plan is what\n * LABELLIZE iterates, and an email's primary words are authored, never labellized.\n */\n@injectable()\nexport class EmailTemplateLabellingUnitsCompanionService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TranslationPlacementService)\n private readonly translationPlacementService: TranslationPlacementCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailSpecContextLoader)\n private readonly emailSpecContextLoader: EmailSpecContextLoaderCompanionService,\n ) {}\n\n /**\n * Every email template the backend owners declare, as translate units.\n *\n * @param templateRefs - restrict to these refs; omit for every template.\n */\n public async planEmailTemplateUnits(templateRefs?: readonly string[]): Promise<EmailTemplateLabellingPlan> {\n const snapshot = await this.translationPlacementService.getPlacementSnapshot({\n includeShared: false,\n includeFrontend: false,\n includeBackendEmail: true,\n });\n const ownership = snapshot.backendEmail.flatMap((entry) => entry.emailTemplateOwnership);\n const { targets, unplaced } = resolveEmailTemplateArtifactPlacement(\n this.companionContext.saasRoot,\n ownership,\n templateRefs && templateRefs.length > 0 ? [...templateRefs] : undefined,\n );\n if (snapshot.warnings.length > 0) {\n this.logger.warn('Email template placement answered with warnings — the email translate plan may be short', {\n warnings: snapshot.warnings,\n });\n }\n\n const units = targets\n .map((target): EmailTemplateLabellingUnit => ({\n category: LabellingUnitCategory.EMAIL_TEMPLATE,\n id: emailTemplateLabellingUnitId(target.templateRef),\n templateRef: target.templateRef,\n ownerId: target.ownerId,\n displayLabel: `email ${target.templateRef}`,\n templateDirectory: target.dirPath,\n loadSpecContext: () => this.loadSpecContext(target.templateRef, target.templatePath),\n }))\n .concat(this.planComponentLabelsUnits(ownership, templateRefs))\n .sort((left, right) => left.templateRef.localeCompare(right.templateRef));\n\n /*\n * A template whose owner registers it from no folder the companion can read has no file to translate (#3904 review\n * F2): said in the plan's warnings, never dropped in silence.\n */\n return { units, warnings: [...snapshot.warnings, ...unplaced.map((entry) => `${entry.templateRef}: not translated, ${entry.reason}.`)] };\n }\n\n /**\n * One unit per owner that declares words for its shared email components (#2884): `components/labels.{locale}.ts`\n * under the owner's email root, which the runtime reads with `scanEmailComponentLabels`. Named in a `templateRefs`\n * restriction by its pseudo ref (`emailComponentLabelsUnitRef`), and planned with every template otherwise.\n */\n private planComponentLabelsUnits(\n ownership: readonly CompanionEmailTemplateOwnershipDescriptor[],\n templateRefs: readonly string[] | undefined,\n ): EmailTemplateLabellingUnit[] {\n const allow = templateRefs && templateRefs.length > 0 ? new Set(templateRefs) : null;\n return ownership\n .filter((owner) => owner.declaresComponentLabels === true && owner.rootsByRole.backend)\n .map((owner) => ({ owner, templateRef: emailComponentLabelsUnitRef(owner.ownerId) }))\n .filter(({ templateRef }) => !allow || allow.has(templateRef))\n .map(({ owner, templateRef }): EmailTemplateLabellingUnit => ({\n category: LabellingUnitCategory.EMAIL_TEMPLATE,\n id: emailTemplateLabellingUnitId(templateRef),\n templateRef,\n ownerId: owner.ownerId,\n displayLabel: `email components of ${owner.ownerId}`,\n templateDirectory: path.resolve(this.companionContext.saasRoot, owner.rootsByRole.backend!, EMAIL_COMPONENT_LABELS_DIRECTORY),\n loadSpecContext: async () => ({\n description: 'These are the words of the shared components EVERY transactional email of this application renders, '\n + 'such as the footer (\"sent by\" the application, the support contact). They sit around each email\\'s own text, '\n + 'so keep them short, neutral and consistent with the register of the emails. Keep every `{placeholder}` '\n + 'and the leading and trailing spaces exactly as the source has them.',\n origin: [path.join(owner.rootsByRole.backend!, EMAIL_COMPONENT_LABELS_DIRECTORY)],\n }),\n }));\n }\n\n /**\n * The context replayed into an email's translation prompt: what the email is FOR, so terminology and\n * register follow the message rather than a word-by-word reading of fragments.\n *\n * Two sources, both authored and both optional: the system email's `SystemEmailTemplateSpecification`\n * (purpose, tone, per-slot meaning — the same TRANSLATION_CONTEXT the email generator's translator\n * used), and the template's own `description`, which every template declares for diagnostics. Never\n * throws: a missing context degrades the prompt, it does not fail the unit.\n */\n private async loadSpecContext(templateRef: string, templatePath: string): Promise<LabellingUnitSpecContext | undefined> {\n const parts: string[] = [];\n const origin: string[] = [];\n\n if (templateRef.startsWith(SYSTEM_EMAIL_TEMPLATE_REF_PREFIX)) {\n const specification = await this.emailSpecContextLoader.loadTranslationContext(templateRef);\n if (specification?.description) {\n parts.push(specification.description.trim());\n origin.push(`systemEmailTemplateSpecifications.${templateRef}`);\n }\n }\n\n const templateDescription = await readTemplateDescription(templatePath);\n if (templateDescription) {\n parts.push(`What this email is for: ${templateDescription}`);\n origin.push(templatePath);\n }\n\n parts.push(\n 'These are the words of ONE transactional email. Some values are sentence FRAGMENTS the template joins '\n + 'with live values (a name, an organization) — translate each fragment so the joined sentence reads '\n + 'naturally, and keep the leading and trailing spaces exactly as the source has them.',\n );\n\n return { description: parts.join('\\n\\n'), origin };\n }\n}\n\n/**\n * The `description: '…'` a template declares on its `EmailTemplateDefinition`, read without executing\n * the template. Absent when the template declares none or the file cannot be read.\n */\nexport async function readTemplateDescription(templatePath: string): Promise<string | undefined> {\n let source: string;\n try {\n source = await fs.readFile(templatePath, 'utf-8');\n } catch {\n return undefined;\n }\n return extractTemplateDescription(source);\n}\n\n/** Pure half of {@link readTemplateDescription}, for tests. */\nexport function extractTemplateDescription(source: string): string | undefined {\n const match = /\\bdescription:\\s*(['\"])((?:\\\\.|(?!\\1)[^\\\\\\n])*)\\1/.exec(source);\n if (!match) return undefined;\n const value = match[2]!.replace(/\\\\(.)/g, '$1').trim();\n return value.length > 0 ? value : undefined;\n}\n"]}
|
|
@@ -88,6 +88,15 @@ export declare function classifyPlaybookRefsByJourneyPhase(admitsOf: (ref: strin
|
|
|
88
88
|
export declare function deriveCreationJourneyTimeline(input: {
|
|
89
89
|
readonly now: Date;
|
|
90
90
|
readonly playbookRuns: readonly CreationJourneyPlaybookRun[];
|
|
91
|
+
/**
|
|
92
|
+
* Completed research turns (#3896), from their evidence records: a research child writes no playbook-run row, so a phase
|
|
93
|
+
* whose first work is research would otherwise start at its first OTHER run. Absent means none were read.
|
|
94
|
+
*/
|
|
95
|
+
readonly researchTurns?: readonly {
|
|
96
|
+
readonly playbookRef: string;
|
|
97
|
+
readonly startedAt: string;
|
|
98
|
+
readonly elapsedMs: number;
|
|
99
|
+
}[];
|
|
91
100
|
readonly buildAttempts: readonly CreationJourneyBuildAttempt[];
|
|
92
101
|
readonly phaseOf: ReadonlyMap<string, CreationJourneyPhase>;
|
|
93
102
|
readonly ambiguousPlaybookRefs: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-journey-timeline.models.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/models/creation-journey-timeline.models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,6BAA6B,EAI7B,oBAAoB,EAEpB,KAAK,6BAA6B,EAGlC,KAAK,wBAAwB,EAC9B,MAAM,gCAAgC,CAAC;AAExC;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2FAA2F;IAC3F,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED,iCAAiC;AACjC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,6BAA6B,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AASD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAyBvH;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,GAAG;IAChG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD,CAoBA;
|
|
1
|
+
{"version":3,"file":"creation-journey-timeline.models.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/models/creation-journey-timeline.models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,6BAA6B,EAI7B,oBAAoB,EAEpB,KAAK,6BAA6B,EAGlC,KAAK,wBAAwB,EAC9B,MAAM,gCAAgC,CAAC;AAExC;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAA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IAC5D,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD,CAoBA;AAsCD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,YAAY,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7H,QAAQ,CAAC,aAAa,EAAE,SAAS,2BAA2B,EAAE,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,yHAAyH;IACzH,QAAQ,CAAC,cAAc,EAAE,SAAS,6BAA6B,EAAE,GAAG,IAAI,CAAC;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC,GAAG,wBAAwB,CA4I3B"}
|
|
@@ -112,8 +112,8 @@ function playbookRunWindow(run, nowMs) {
|
|
|
112
112
|
*/
|
|
113
113
|
export function deriveCreationJourneyTimeline(input) {
|
|
114
114
|
const nowMs = input.now.getTime();
|
|
115
|
-
const spans = new Map(CREATION_JOURNEY_PHASE_ORDER.map((phase) => [phase, { inFlight: false, waitingOnPerson: false, playbookRuns: 0, buildAttempts: 0 }]));
|
|
116
|
-
const wall = { inFlight: false, waitingOnPerson: false, playbookRuns: 0, buildAttempts: 0 };
|
|
115
|
+
const spans = new Map(CREATION_JOURNEY_PHASE_ORDER.map((phase) => [phase, { inFlight: false, waitingOnPerson: false, playbookRuns: 0, researchTurns: 0, buildAttempts: 0 }]));
|
|
116
|
+
const wall = { inFlight: false, waitingOnPerson: false, playbookRuns: 0, researchTurns: 0, buildAttempts: 0 };
|
|
117
117
|
let outsidePhasePlaybookRuns = 0;
|
|
118
118
|
for (const run of input.playbookRuns) {
|
|
119
119
|
const window = playbookRunWindow(run, nowMs);
|
|
@@ -132,6 +132,21 @@ export function deriveCreationJourneyTimeline(input) {
|
|
|
132
132
|
span.waitingOnPerson ||= window.waitingOnPerson;
|
|
133
133
|
span.playbookRuns += 1;
|
|
134
134
|
}
|
|
135
|
+
// A research turn widens its phase like a playbook run does, and the wall clock with it (#3896). Never in flight: only
|
|
136
|
+
// a completed turn writes its record.
|
|
137
|
+
for (const turn of input.researchTurns ?? []) {
|
|
138
|
+
const startMs = instantMs(turn.startedAt);
|
|
139
|
+
if (startMs === undefined)
|
|
140
|
+
continue;
|
|
141
|
+
const endMs = startMs + Math.max(0, turn.elapsedMs);
|
|
142
|
+
widen(wall, startMs, endMs);
|
|
143
|
+
const phase = input.phaseOf.get(turn.playbookRef);
|
|
144
|
+
if (phase === undefined)
|
|
145
|
+
continue;
|
|
146
|
+
const span = spans.get(phase);
|
|
147
|
+
widen(span, startMs, endMs);
|
|
148
|
+
span.researchTurns += 1;
|
|
149
|
+
}
|
|
135
150
|
const byTask = new Map();
|
|
136
151
|
const build = spans.get(CreationJourneyPhase.BUILD);
|
|
137
152
|
const attemptTimings = [];
|
|
@@ -190,6 +205,7 @@ export function deriveCreationJourneyTimeline(input) {
|
|
|
190
205
|
inFlight: span.inFlight,
|
|
191
206
|
waitingOnPerson: span.waitingOnPerson,
|
|
192
207
|
playbookRuns: span.playbookRuns,
|
|
208
|
+
researchTurns: span.researchTurns,
|
|
193
209
|
buildAttempts: span.buildAttempts,
|
|
194
210
|
};
|
|
195
211
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-journey-timeline.models.js","sourceRoot":"","sources":["../../../../src/meta-workflows/models/creation-journey-timeline.models.ts"],"names":[],"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AE,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC;QACvD,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["import { FlowsActors_Status } from '@wildo-ai/saas-models';\nimport {\n BuildDispatchWaitMeasuredFrom,\n CREATION_JOURNEY_PHASE_LANE_REFS,\n CREATION_JOURNEY_PHASE_ORDER,\n CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT,\n CreationJourneyPhase,\n type CreationJourney_BuildAttemptTiming,\n type CreationJourney_BuildPlanTask,\n type CreationJourney_PhaseSpan,\n type CreationJourney_SlowBuildTask,\n type CreationJourney_Timeline,\n} from '@wildo-ai/platform-core-shared';\n\n/**\n * The creation journey's timeline, derived from rows (#3206, epic #3204): per-phase spans, the wall clock, and the\n * build tasks that took longest, each split into its dispatch wait and its run time.\n *\n * Pure: the companion's run-report service reads the rows and the catalog, and this function decides nothing a row\n * does not say. Nothing is stored: the playbook runs' executions and each build attempt's row ARE the record, and a\n * restart loses no figure, because every instant used here is on a row (the attempt's preparation start since #3206).\n */\n\n/** One playbook run as the timeline reads it: its execution row's instants and status. */\nexport interface CreationJourneyPlaybookRun {\n readonly runId: string;\n readonly playbookRef: string;\n readonly startedAt: string;\n readonly finishedAt?: string;\n readonly status: FlowsActors_Status;\n /** When it stopped to ask a person, for a run waiting on one. */\n readonly suspendedAt?: string;\n}\n\n/**\n * One build-task attempt's instants, as its execution and task rows record them.\n *\n * - `selectedAt` — the execution row's creation: the task was chosen and its brief composed.\n * - `preparationStartedAt` — the door that dispatched it began preparing it: a wave's slot, or a single-task door's\n * read of the plan (stamped on the task's input since #3206; absent only on an older row).\n * - `admittedAt` — the task row's start instant: the coding lane admitted the run, or a generation step began.\n * Absent for a run that never started (a refusal at admission).\n * - `settledAt` — the execution's finish instant; absent while it waits or runs.\n */\nexport interface CreationJourneyBuildAttempt {\n readonly taskRef: string;\n readonly selectedAt: string;\n readonly preparationStartedAt?: string;\n readonly admittedAt?: string;\n readonly settledAt?: string;\n /** When it parked on a question to a person, for an attempt that is waiting on one now. */\n readonly waitingOnPersonSince?: string;\n /**\n * The startup sweep of a later companion process settled it: `settledAt` is that restart, not when the run stopped,\n * which no row records. Its time is still counted, and marked.\n */\n readonly endedByCompanionRestart: boolean;\n readonly generationStep: boolean;\n}\n\n/** One attempt's time, split. */\nexport interface BuildAttemptTiming {\n readonly startedAtMs: number;\n readonly endedAtMs: number;\n readonly dispatchWaitMs: number;\n readonly runMs: number;\n readonly measuredFrom: BuildDispatchWaitMeasuredFrom;\n readonly inFlight: boolean;\n readonly waitingOnPerson: boolean;\n}\n\n/** Milliseconds of an ISO instant, or `undefined` for one that does not parse. */\nfunction instantMs(value: string | undefined): number | undefined {\n if (value === undefined) return undefined;\n const ms = Date.parse(value);\n return Number.isFinite(ms) ? ms : undefined;\n}\n\n/**\n * Split one attempt's time into the wait for its dispatch and its run.\n *\n * The wait runs from the slot's preparation start (else the row's opening, a floor) to admission; the run from\n * admission to settling. An attempt that was never admitted spent all its time waiting: it is a selection that never\n * became a run, and that time is exactly the gap #3206 could not see. An attempt parked on a question ends where it\n * parked: the time since is a person's, as a playbook run waiting on one is. Instants that disagree (an admission\n * recorded before its own preparation) are clamped rather than producing a negative duration. `undefined` when the\n * attempt carries no readable start.\n */\nexport function measureBuildAttempt(attempt: CreationJourneyBuildAttempt, nowMs: number): BuildAttemptTiming | undefined {\n const preparationMs = instantMs(attempt.preparationStartedAt);\n const selectedMs = instantMs(attempt.selectedAt);\n const waitFromMs = preparationMs ?? selectedMs;\n if (waitFromMs === undefined) return undefined;\n const measuredFrom = preparationMs !== undefined ? BuildDispatchWaitMeasuredFrom.PREPARATION : BuildDispatchWaitMeasuredFrom.SELECTION;\n const settledMs = instantMs(attempt.settledAt);\n const parkedMs = settledMs === undefined ? instantMs(attempt.waitingOnPersonSince) : undefined;\n const waitingOnPerson = parkedMs !== undefined;\n const inFlight = settledMs === undefined && !waitingOnPerson;\n const endedAtMs = Math.max(waitFromMs, settledMs ?? parkedMs ?? nowMs);\n const admittedMs = instantMs(attempt.admittedAt);\n if (admittedMs === undefined) {\n return { startedAtMs: waitFromMs, endedAtMs, dispatchWaitMs: endedAtMs - waitFromMs, runMs: 0, measuredFrom, inFlight, waitingOnPerson };\n }\n const admittedClampedMs = Math.min(Math.max(admittedMs, waitFromMs), endedAtMs);\n return {\n startedAtMs: waitFromMs,\n endedAtMs,\n dispatchWaitMs: admittedClampedMs - waitFromMs,\n runMs: endedAtMs - admittedClampedMs,\n measuredFrom,\n inFlight,\n waitingOnPerson,\n };\n}\n\n/**\n * Which phase each playbook ref is the work of: every ref a lane's choreography admits, transitively, and the lane\n * itself. A ref two lanes admit is placed in NEITHER and reported: its row names no lane (a nested run records only\n * its tree's root, the umbrella), so placing it would be a guess. One since 2026-11-06: `top_down.expert-personas`, which\n * the conception lane staffs with and the build lane re-runs when a panel's charters go stale (#3204).\n */\nexport function classifyPlaybookRefsByJourneyPhase(admitsOf: (ref: string) => readonly string[]): {\n readonly phaseOf: ReadonlyMap<string, CreationJourneyPhase>;\n readonly ambiguousPlaybookRefs: readonly string[];\n} {\n const lanesOf = new Map<string, CreationJourneyPhase[]>();\n for (const phase of CREATION_JOURNEY_PHASE_ORDER) {\n const seen = new Set<string>();\n const pending = [CREATION_JOURNEY_PHASE_LANE_REFS[phase]];\n while (pending.length > 0) {\n const ref = pending.pop()!;\n if (seen.has(ref)) continue;\n seen.add(ref);\n pending.push(...admitsOf(ref));\n }\n for (const ref of seen) lanesOf.set(ref, [...(lanesOf.get(ref) ?? []), phase]);\n }\n const phaseOf = new Map<string, CreationJourneyPhase>();\n const ambiguousPlaybookRefs: string[] = [];\n for (const [ref, phases] of lanesOf) {\n if (phases.length === 1) phaseOf.set(ref, phases[0]!);\n else ambiguousPlaybookRefs.push(ref);\n }\n return { phaseOf, ambiguousPlaybookRefs: ambiguousPlaybookRefs.sort() };\n}\n\n/** A span being accumulated. */\ninterface SpanAccumulator {\n startMs?: number;\n endMs?: number;\n inFlight: boolean;\n waitingOnPerson: boolean;\n playbookRuns: number;\n buildAttempts: number;\n}\n\nfunction widen(span: SpanAccumulator, startMs: number, endMs: number): void {\n span.startMs = span.startMs === undefined ? startMs : Math.min(span.startMs, startMs);\n span.endMs = span.endMs === undefined ? endMs : Math.max(span.endMs, endMs);\n}\n\n/** Whether a row still has work under way: PENDING (selected, not started) or PROCESSING. */\nfunction isUnderWay(status: FlowsActors_Status): boolean {\n return status === FlowsActors_Status.PENDING || status === FlowsActors_Status.PROCESSING;\n}\n\n/**\n * The window of one playbook run: its row's creation to its finish. One still under way ends at the read's instant;\n * one waiting on a person ends where it began waiting (time spent waiting for an answer is the person's, and the\n * phase is marked as waiting rather than stretched to now).\n */\nfunction playbookRunWindow(run: CreationJourneyPlaybookRun, nowMs: number): { startMs: number; endMs: number; inFlight: boolean; waitingOnPerson: boolean } | undefined {\n const startMs = instantMs(run.startedAt);\n if (startMs === undefined) return undefined;\n if (isUnderWay(run.status)) return { startMs, endMs: Math.max(startMs, nowMs), inFlight: true, waitingOnPerson: false };\n if (run.status === FlowsActors_Status.AWAITING_APPROVAL) {\n return { startMs, endMs: Math.max(startMs, instantMs(run.suspendedAt) ?? startMs), inFlight: false, waitingOnPerson: true };\n }\n return { startMs, endMs: Math.max(startMs, instantMs(run.finishedAt) ?? startMs), inFlight: false, waitingOnPerson: false };\n}\n\n/**\n * Derive the timeline: each phase's first start to its last settle, the wall clock over everything, and the\n * {@link CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT} build tasks with the most wait plus run time.\n *\n * The BUILD phase's span covers its lane's playbook runs AND every build-task attempt, whoever started it: a single-task\n * dispatch (`wildo build run --single`, the workbench, a named run) starts no build-lane playbook, and its runs are\n * still the build. The wall clock covers every playbook run (a phase's or not) and every attempt.\n *\n * A run a companion restart ended is measured to that restart, because no row records when it really stopped: a build\n * attempt says so on its task line, and a playbook run cannot, so a phase that a restart interrupted may run long.\n */\nexport function deriveCreationJourneyTimeline(input: {\n readonly now: Date;\n readonly playbookRuns: readonly CreationJourneyPlaybookRun[];\n readonly buildAttempts: readonly CreationJourneyBuildAttempt[];\n readonly phaseOf: ReadonlyMap<string, CreationJourneyPhase>;\n readonly ambiguousPlaybookRefs: readonly string[];\n /** The accepted build plan's graph, carried through for a budget reader; NULL when there is none or it is unreadable. */\n readonly buildPlanGraph: readonly CreationJourney_BuildPlanTask[] | null;\n readonly notChecked: readonly string[];\n}): CreationJourney_Timeline {\n const nowMs = input.now.getTime();\n const spans = new Map<CreationJourneyPhase, SpanAccumulator>(\n CREATION_JOURNEY_PHASE_ORDER.map((phase) => [phase, { inFlight: false, waitingOnPerson: false, playbookRuns: 0, buildAttempts: 0 }]),\n );\n const wall: SpanAccumulator = { inFlight: false, waitingOnPerson: false, playbookRuns: 0, buildAttempts: 0 };\n let outsidePhasePlaybookRuns = 0;\n\n for (const run of input.playbookRuns) {\n const window = playbookRunWindow(run, nowMs);\n if (window === undefined) continue;\n widen(wall, window.startMs, window.endMs);\n wall.inFlight ||= window.inFlight;\n const phase = input.phaseOf.get(run.playbookRef);\n if (phase === undefined) {\n outsidePhasePlaybookRuns += 1;\n continue;\n }\n const span = spans.get(phase)!;\n widen(span, window.startMs, window.endMs);\n span.inFlight ||= window.inFlight;\n span.waitingOnPerson ||= window.waitingOnPerson;\n span.playbookRuns += 1;\n }\n\n const byTask = new Map<string, {\n attempts: number; dispatchWaitMs: number; runMs: number; fromSelection: boolean; inFlight: boolean; waitingOnPerson: boolean;\n endedByCompanionRestart: boolean; generationStep: boolean;\n }>();\n const build = spans.get(CreationJourneyPhase.BUILD)!;\n const attemptTimings: { readonly startedAtMs: number; readonly entry: CreationJourney_BuildAttemptTiming }[] = [];\n for (const attempt of input.buildAttempts) {\n const timing = measureBuildAttempt(attempt, nowMs);\n if (timing === undefined) continue;\n /*\n * The same split as the task totals below, per attempt (#3204's budget): a p95 is a statement about attempts, and a\n * task's sum over several attempts would hide a fast retry behind a slow first run. The admission instant is the\n * clamped one the split used, so `startedAt + dispatchWaitMs` is always `admittedAt`.\n */\n const admittedAtMs = instantMs(attempt.admittedAt) === undefined ? undefined : timing.startedAtMs + timing.dispatchWaitMs;\n attemptTimings.push({\n startedAtMs: timing.startedAtMs,\n entry: {\n taskRef: attempt.taskRef,\n startedAt: new Date(timing.startedAtMs).toISOString(),\n ...(admittedAtMs !== undefined ? { admittedAt: new Date(admittedAtMs).toISOString() } : {}),\n endedAt: new Date(timing.endedAtMs).toISOString(),\n dispatchWaitMs: timing.dispatchWaitMs,\n runMs: timing.runMs,\n dispatchWaitMeasuredFrom: timing.measuredFrom,\n inFlight: timing.inFlight,\n waitingOnPerson: timing.waitingOnPerson,\n endedByCompanionRestart: attempt.endedByCompanionRestart,\n generationStep: attempt.generationStep,\n },\n });\n widen(build, timing.startedAtMs, timing.endedAtMs);\n widen(wall, timing.startedAtMs, timing.endedAtMs);\n build.inFlight ||= timing.inFlight;\n build.waitingOnPerson ||= timing.waitingOnPerson;\n wall.inFlight ||= timing.inFlight;\n build.buildAttempts += 1;\n const task = byTask.get(attempt.taskRef) ?? {\n attempts: 0, dispatchWaitMs: 0, runMs: 0, fromSelection: false, inFlight: false, waitingOnPerson: false, endedByCompanionRestart: false, generationStep: false,\n };\n task.attempts += 1;\n task.dispatchWaitMs += timing.dispatchWaitMs;\n task.runMs += timing.runMs;\n task.fromSelection ||= timing.measuredFrom === BuildDispatchWaitMeasuredFrom.SELECTION;\n task.inFlight ||= timing.inFlight;\n task.waitingOnPerson ||= timing.waitingOnPerson;\n task.endedByCompanionRestart ||= attempt.endedByCompanionRestart;\n task.generationStep ||= attempt.generationStep;\n byTask.set(attempt.taskRef, task);\n }\n\n const phases: CreationJourney_PhaseSpan[] = CREATION_JOURNEY_PHASE_ORDER.map((phase) => {\n const span = spans.get(phase)!;\n const ran = span.startMs !== undefined && span.endMs !== undefined;\n return {\n phase,\n laneRef: CREATION_JOURNEY_PHASE_LANE_REFS[phase],\n ...(ran ? { startedAt: new Date(span.startMs!).toISOString(), endedAt: new Date(span.endMs!).toISOString(), durationMs: span.endMs! - span.startMs! } : {}),\n inFlight: span.inFlight,\n waitingOnPerson: span.waitingOnPerson,\n playbookRuns: span.playbookRuns,\n buildAttempts: span.buildAttempts,\n };\n });\n\n const slowestBuildTasks: CreationJourney_SlowBuildTask[] = [...byTask]\n .map(([taskRef, task]) => ({\n taskRef,\n attempts: task.attempts,\n dispatchWaitMs: task.dispatchWaitMs,\n runMs: task.runMs,\n totalMs: task.dispatchWaitMs + task.runMs,\n dispatchWaitMeasuredFrom: task.fromSelection ? BuildDispatchWaitMeasuredFrom.SELECTION : BuildDispatchWaitMeasuredFrom.PREPARATION,\n inFlight: task.inFlight,\n waitingOnPerson: task.waitingOnPerson,\n endedByCompanionRestart: task.endedByCompanionRestart,\n generationStep: task.generationStep,\n }))\n .sort((left, right) => right.totalMs - left.totalMs || left.taskRef.localeCompare(right.taskRef))\n .slice(0, CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT);\n\n return {\n generatedAt: input.now.toISOString(),\n wallClock: wall.startMs === undefined || wall.endMs === undefined ? null : {\n startedAt: new Date(wall.startMs).toISOString(),\n endedAt: new Date(wall.endMs).toISOString(),\n durationMs: wall.endMs - wall.startMs,\n inFlight: wall.inFlight,\n },\n phases,\n slowestBuildTasks,\n attemptedBuildTasks: byTask.size,\n buildAttemptTimings: attemptTimings\n .sort((left, right) => left.startedAtMs - right.startedAtMs || left.entry.taskRef.localeCompare(right.entry.taskRef))\n .map(({ entry }) => entry),\n buildPlanGraph: input.buildPlanGraph === null ? null : input.buildPlanGraph.map((task) => ({ taskRef: task.taskRef, prerequisiteTaskRefs: [...task.prerequisiteTaskRefs] })),\n outsidePhasePlaybookRuns,\n ambiguousPlaybookRefs: [...input.ambiguousPlaybookRefs],\n notChecked: [...input.notChecked],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"creation-journey-timeline.models.js","sourceRoot":"","sources":["../../../../src/meta-workflows/models/creation-journey-tim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,CAAC,WAAW,EAAE;YAC3C,UAAU,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO;YACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB;QACD,MAAM;QACN,iBAAiB;QACjB,mBAAmB,EAAE,MAAM,CAAC,IAAI;QAChC,mBAAmB,EAAE,cAAc;aAChC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;aACpH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC;QAC5B,cAAc,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAC5K,wBAAwB;QACxB,qBAAqB,EAAE,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC;QACvD,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;KAClC,CAAC;AACJ,CAAC","sourcesContent":["import { FlowsActors_Status } from '@wildo-ai/saas-models';\nimport {\n BuildDispatchWaitMeasuredFrom,\n CREATION_JOURNEY_PHASE_LANE_REFS,\n CREATION_JOURNEY_PHASE_ORDER,\n CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT,\n CreationJourneyPhase,\n type CreationJourney_BuildAttemptTiming,\n type CreationJourney_BuildPlanTask,\n type CreationJourney_PhaseSpan,\n type CreationJourney_SlowBuildTask,\n type CreationJourney_Timeline,\n} from '@wildo-ai/platform-core-shared';\n\n/**\n * The creation journey's timeline, derived from rows (#3206, epic #3204): per-phase spans, the wall clock, and the\n * build tasks that took longest, each split into its dispatch wait and its run time.\n *\n * Pure: the companion's run-report service reads the rows and the catalog, and this function decides nothing a row\n * does not say. Nothing is stored: the playbook runs' executions and each build attempt's row ARE the record, and a\n * restart loses no figure, because every instant used here is on a row (the attempt's preparation start since #3206).\n */\n\n/** One playbook run as the timeline reads it: its execution row's instants and status. */\nexport interface CreationJourneyPlaybookRun {\n readonly runId: string;\n readonly playbookRef: string;\n readonly startedAt: string;\n readonly finishedAt?: string;\n readonly status: FlowsActors_Status;\n /** When it stopped to ask a person, for a run waiting on one. */\n readonly suspendedAt?: string;\n}\n\n/**\n * One build-task attempt's instants, as its execution and task rows record them.\n *\n * - `selectedAt` — the execution row's creation: the task was chosen and its brief composed.\n * - `preparationStartedAt` — the door that dispatched it began preparing it: a wave's slot, or a single-task door's\n * read of the plan (stamped on the task's input since #3206; absent only on an older row).\n * - `admittedAt` — the task row's start instant: the coding lane admitted the run, or a generation step began.\n * Absent for a run that never started (a refusal at admission).\n * - `settledAt` — the execution's finish instant; absent while it waits or runs.\n */\nexport interface CreationJourneyBuildAttempt {\n readonly taskRef: string;\n readonly selectedAt: string;\n readonly preparationStartedAt?: string;\n readonly admittedAt?: string;\n readonly settledAt?: string;\n /** When it parked on a question to a person, for an attempt that is waiting on one now. */\n readonly waitingOnPersonSince?: string;\n /**\n * The startup sweep of a later companion process settled it: `settledAt` is that restart, not when the run stopped,\n * which no row records. Its time is still counted, and marked.\n */\n readonly endedByCompanionRestart: boolean;\n readonly generationStep: boolean;\n}\n\n/** One attempt's time, split. */\nexport interface BuildAttemptTiming {\n readonly startedAtMs: number;\n readonly endedAtMs: number;\n readonly dispatchWaitMs: number;\n readonly runMs: number;\n readonly measuredFrom: BuildDispatchWaitMeasuredFrom;\n readonly inFlight: boolean;\n readonly waitingOnPerson: boolean;\n}\n\n/** Milliseconds of an ISO instant, or `undefined` for one that does not parse. */\nfunction instantMs(value: string | undefined): number | undefined {\n if (value === undefined) return undefined;\n const ms = Date.parse(value);\n return Number.isFinite(ms) ? ms : undefined;\n}\n\n/**\n * Split one attempt's time into the wait for its dispatch and its run.\n *\n * The wait runs from the slot's preparation start (else the row's opening, a floor) to admission; the run from\n * admission to settling. An attempt that was never admitted spent all its time waiting: it is a selection that never\n * became a run, and that time is exactly the gap #3206 could not see. An attempt parked on a question ends where it\n * parked: the time since is a person's, as a playbook run waiting on one is. Instants that disagree (an admission\n * recorded before its own preparation) are clamped rather than producing a negative duration. `undefined` when the\n * attempt carries no readable start.\n */\nexport function measureBuildAttempt(attempt: CreationJourneyBuildAttempt, nowMs: number): BuildAttemptTiming | undefined {\n const preparationMs = instantMs(attempt.preparationStartedAt);\n const selectedMs = instantMs(attempt.selectedAt);\n const waitFromMs = preparationMs ?? selectedMs;\n if (waitFromMs === undefined) return undefined;\n const measuredFrom = preparationMs !== undefined ? BuildDispatchWaitMeasuredFrom.PREPARATION : BuildDispatchWaitMeasuredFrom.SELECTION;\n const settledMs = instantMs(attempt.settledAt);\n const parkedMs = settledMs === undefined ? instantMs(attempt.waitingOnPersonSince) : undefined;\n const waitingOnPerson = parkedMs !== undefined;\n const inFlight = settledMs === undefined && !waitingOnPerson;\n const endedAtMs = Math.max(waitFromMs, settledMs ?? parkedMs ?? nowMs);\n const admittedMs = instantMs(attempt.admittedAt);\n if (admittedMs === undefined) {\n return { startedAtMs: waitFromMs, endedAtMs, dispatchWaitMs: endedAtMs - waitFromMs, runMs: 0, measuredFrom, inFlight, waitingOnPerson };\n }\n const admittedClampedMs = Math.min(Math.max(admittedMs, waitFromMs), endedAtMs);\n return {\n startedAtMs: waitFromMs,\n endedAtMs,\n dispatchWaitMs: admittedClampedMs - waitFromMs,\n runMs: endedAtMs - admittedClampedMs,\n measuredFrom,\n inFlight,\n waitingOnPerson,\n };\n}\n\n/**\n * Which phase each playbook ref is the work of: every ref a lane's choreography admits, transitively, and the lane\n * itself. A ref two lanes admit is placed in NEITHER and reported: its row names no lane (a nested run records only\n * its tree's root, the umbrella), so placing it would be a guess. One since 2026-11-06: `top_down.expert-personas`, which\n * the conception lane staffs with and the build lane re-runs when a panel's charters go stale (#3204).\n */\nexport function classifyPlaybookRefsByJourneyPhase(admitsOf: (ref: string) => readonly string[]): {\n readonly phaseOf: ReadonlyMap<string, CreationJourneyPhase>;\n readonly ambiguousPlaybookRefs: readonly string[];\n} {\n const lanesOf = new Map<string, CreationJourneyPhase[]>();\n for (const phase of CREATION_JOURNEY_PHASE_ORDER) {\n const seen = new Set<string>();\n const pending = [CREATION_JOURNEY_PHASE_LANE_REFS[phase]];\n while (pending.length > 0) {\n const ref = pending.pop()!;\n if (seen.has(ref)) continue;\n seen.add(ref);\n pending.push(...admitsOf(ref));\n }\n for (const ref of seen) lanesOf.set(ref, [...(lanesOf.get(ref) ?? []), phase]);\n }\n const phaseOf = new Map<string, CreationJourneyPhase>();\n const ambiguousPlaybookRefs: string[] = [];\n for (const [ref, phases] of lanesOf) {\n if (phases.length === 1) phaseOf.set(ref, phases[0]!);\n else ambiguousPlaybookRefs.push(ref);\n }\n return { phaseOf, ambiguousPlaybookRefs: ambiguousPlaybookRefs.sort() };\n}\n\n/** A span being accumulated. */\ninterface SpanAccumulator {\n startMs?: number;\n endMs?: number;\n inFlight: boolean;\n waitingOnPerson: boolean;\n playbookRuns: number;\n researchTurns: number;\n buildAttempts: number;\n}\n\nfunction widen(span: SpanAccumulator, startMs: number, endMs: number): void {\n span.startMs = span.startMs === undefined ? startMs : Math.min(span.startMs, startMs);\n span.endMs = span.endMs === undefined ? endMs : Math.max(span.endMs, endMs);\n}\n\n/** Whether a row still has work under way: PENDING (selected, not started) or PROCESSING. */\nfunction isUnderWay(status: FlowsActors_Status): boolean {\n return status === FlowsActors_Status.PENDING || status === FlowsActors_Status.PROCESSING;\n}\n\n/**\n * The window of one playbook run: its row's creation to its finish. One still under way ends at the read's instant;\n * one waiting on a person ends where it began waiting (time spent waiting for an answer is the person's, and the\n * phase is marked as waiting rather than stretched to now).\n */\nfunction playbookRunWindow(run: CreationJourneyPlaybookRun, nowMs: number): { startMs: number; endMs: number; inFlight: boolean; waitingOnPerson: boolean } | undefined {\n const startMs = instantMs(run.startedAt);\n if (startMs === undefined) return undefined;\n if (isUnderWay(run.status)) return { startMs, endMs: Math.max(startMs, nowMs), inFlight: true, waitingOnPerson: false };\n if (run.status === FlowsActors_Status.AWAITING_APPROVAL) {\n return { startMs, endMs: Math.max(startMs, instantMs(run.suspendedAt) ?? startMs), inFlight: false, waitingOnPerson: true };\n }\n return { startMs, endMs: Math.max(startMs, instantMs(run.finishedAt) ?? startMs), inFlight: false, waitingOnPerson: false };\n}\n\n/**\n * Derive the timeline: each phase's first start to its last settle, the wall clock over everything, and the\n * {@link CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT} build tasks with the most wait plus run time.\n *\n * The BUILD phase's span covers its lane's playbook runs AND every build-task attempt, whoever started it: a single-task\n * dispatch (`wildo build run --single`, the workbench, a named run) starts no build-lane playbook, and its runs are\n * still the build. The wall clock covers every playbook run (a phase's or not) and every attempt.\n *\n * A run a companion restart ended is measured to that restart, because no row records when it really stopped: a build\n * attempt says so on its task line, and a playbook run cannot, so a phase that a restart interrupted may run long.\n */\nexport function deriveCreationJourneyTimeline(input: {\n readonly now: Date;\n readonly playbookRuns: readonly CreationJourneyPlaybookRun[];\n /**\n * Completed research turns (#3896), from their evidence records: a research child writes no playbook-run row, so a phase\n * whose first work is research would otherwise start at its first OTHER run. Absent means none were read.\n */\n readonly researchTurns?: readonly { readonly playbookRef: string; readonly startedAt: string; readonly elapsedMs: number }[];\n readonly buildAttempts: readonly CreationJourneyBuildAttempt[];\n readonly phaseOf: ReadonlyMap<string, CreationJourneyPhase>;\n readonly ambiguousPlaybookRefs: readonly string[];\n /** The accepted build plan's graph, carried through for a budget reader; NULL when there is none or it is unreadable. */\n readonly buildPlanGraph: readonly CreationJourney_BuildPlanTask[] | null;\n readonly notChecked: readonly string[];\n}): CreationJourney_Timeline {\n const nowMs = input.now.getTime();\n const spans = new Map<CreationJourneyPhase, SpanAccumulator>(\n CREATION_JOURNEY_PHASE_ORDER.map((phase) => [phase, { inFlight: false, waitingOnPerson: false, playbookRuns: 0, researchTurns: 0, buildAttempts: 0 }]),\n );\n const wall: SpanAccumulator = { inFlight: false, waitingOnPerson: false, playbookRuns: 0, researchTurns: 0, buildAttempts: 0 };\n let outsidePhasePlaybookRuns = 0;\n\n for (const run of input.playbookRuns) {\n const window = playbookRunWindow(run, nowMs);\n if (window === undefined) continue;\n widen(wall, window.startMs, window.endMs);\n wall.inFlight ||= window.inFlight;\n const phase = input.phaseOf.get(run.playbookRef);\n if (phase === undefined) {\n outsidePhasePlaybookRuns += 1;\n continue;\n }\n const span = spans.get(phase)!;\n widen(span, window.startMs, window.endMs);\n span.inFlight ||= window.inFlight;\n span.waitingOnPerson ||= window.waitingOnPerson;\n span.playbookRuns += 1;\n }\n\n // A research turn widens its phase like a playbook run does, and the wall clock with it (#3896). Never in flight: only\n // a completed turn writes its record.\n for (const turn of input.researchTurns ?? []) {\n const startMs = instantMs(turn.startedAt);\n if (startMs === undefined) continue;\n const endMs = startMs + Math.max(0, turn.elapsedMs);\n widen(wall, startMs, endMs);\n const phase = input.phaseOf.get(turn.playbookRef);\n if (phase === undefined) continue;\n const span = spans.get(phase)!;\n widen(span, startMs, endMs);\n span.researchTurns += 1;\n }\n\n const byTask = new Map<string, {\n attempts: number; dispatchWaitMs: number; runMs: number; fromSelection: boolean; inFlight: boolean; waitingOnPerson: boolean;\n endedByCompanionRestart: boolean; generationStep: boolean;\n }>();\n const build = spans.get(CreationJourneyPhase.BUILD)!;\n const attemptTimings: { readonly startedAtMs: number; readonly entry: CreationJourney_BuildAttemptTiming }[] = [];\n for (const attempt of input.buildAttempts) {\n const timing = measureBuildAttempt(attempt, nowMs);\n if (timing === undefined) continue;\n /*\n * The same split as the task totals below, per attempt (#3204's budget): a p95 is a statement about attempts, and a\n * task's sum over several attempts would hide a fast retry behind a slow first run. The admission instant is the\n * clamped one the split used, so `startedAt + dispatchWaitMs` is always `admittedAt`.\n */\n const admittedAtMs = instantMs(attempt.admittedAt) === undefined ? undefined : timing.startedAtMs + timing.dispatchWaitMs;\n attemptTimings.push({\n startedAtMs: timing.startedAtMs,\n entry: {\n taskRef: attempt.taskRef,\n startedAt: new Date(timing.startedAtMs).toISOString(),\n ...(admittedAtMs !== undefined ? { admittedAt: new Date(admittedAtMs).toISOString() } : {}),\n endedAt: new Date(timing.endedAtMs).toISOString(),\n dispatchWaitMs: timing.dispatchWaitMs,\n runMs: timing.runMs,\n dispatchWaitMeasuredFrom: timing.measuredFrom,\n inFlight: timing.inFlight,\n waitingOnPerson: timing.waitingOnPerson,\n endedByCompanionRestart: attempt.endedByCompanionRestart,\n generationStep: attempt.generationStep,\n },\n });\n widen(build, timing.startedAtMs, timing.endedAtMs);\n widen(wall, timing.startedAtMs, timing.endedAtMs);\n build.inFlight ||= timing.inFlight;\n build.waitingOnPerson ||= timing.waitingOnPerson;\n wall.inFlight ||= timing.inFlight;\n build.buildAttempts += 1;\n const task = byTask.get(attempt.taskRef) ?? {\n attempts: 0, dispatchWaitMs: 0, runMs: 0, fromSelection: false, inFlight: false, waitingOnPerson: false, endedByCompanionRestart: false, generationStep: false,\n };\n task.attempts += 1;\n task.dispatchWaitMs += timing.dispatchWaitMs;\n task.runMs += timing.runMs;\n task.fromSelection ||= timing.measuredFrom === BuildDispatchWaitMeasuredFrom.SELECTION;\n task.inFlight ||= timing.inFlight;\n task.waitingOnPerson ||= timing.waitingOnPerson;\n task.endedByCompanionRestart ||= attempt.endedByCompanionRestart;\n task.generationStep ||= attempt.generationStep;\n byTask.set(attempt.taskRef, task);\n }\n\n const phases: CreationJourney_PhaseSpan[] = CREATION_JOURNEY_PHASE_ORDER.map((phase) => {\n const span = spans.get(phase)!;\n const ran = span.startMs !== undefined && span.endMs !== undefined;\n return {\n phase,\n laneRef: CREATION_JOURNEY_PHASE_LANE_REFS[phase],\n ...(ran ? { startedAt: new Date(span.startMs!).toISOString(), endedAt: new Date(span.endMs!).toISOString(), durationMs: span.endMs! - span.startMs! } : {}),\n inFlight: span.inFlight,\n waitingOnPerson: span.waitingOnPerson,\n playbookRuns: span.playbookRuns,\n researchTurns: span.researchTurns,\n buildAttempts: span.buildAttempts,\n };\n });\n\n const slowestBuildTasks: CreationJourney_SlowBuildTask[] = [...byTask]\n .map(([taskRef, task]) => ({\n taskRef,\n attempts: task.attempts,\n dispatchWaitMs: task.dispatchWaitMs,\n runMs: task.runMs,\n totalMs: task.dispatchWaitMs + task.runMs,\n dispatchWaitMeasuredFrom: task.fromSelection ? BuildDispatchWaitMeasuredFrom.SELECTION : BuildDispatchWaitMeasuredFrom.PREPARATION,\n inFlight: task.inFlight,\n waitingOnPerson: task.waitingOnPerson,\n endedByCompanionRestart: task.endedByCompanionRestart,\n generationStep: task.generationStep,\n }))\n .sort((left, right) => right.totalMs - left.totalMs || left.taskRef.localeCompare(right.taskRef))\n .slice(0, CREATION_JOURNEY_SLOWEST_BUILD_TASK_COUNT);\n\n return {\n generatedAt: input.now.toISOString(),\n wallClock: wall.startMs === undefined || wall.endMs === undefined ? null : {\n startedAt: new Date(wall.startMs).toISOString(),\n endedAt: new Date(wall.endMs).toISOString(),\n durationMs: wall.endMs - wall.startMs,\n inFlight: wall.inFlight,\n },\n phases,\n slowestBuildTasks,\n attemptedBuildTasks: byTask.size,\n buildAttemptTimings: attemptTimings\n .sort((left, right) => left.startedAtMs - right.startedAtMs || left.entry.taskRef.localeCompare(right.entry.taskRef))\n .map(({ entry }) => entry),\n buildPlanGraph: input.buildPlanGraph === null ? null : input.buildPlanGraph.map((task) => ({ taskRef: task.taskRef, prerequisiteTaskRefs: [...task.prerequisiteTaskRefs] })),\n outsidePhasePlaybookRuns,\n ambiguousPlaybookRefs: [...input.ambiguousPlaybookRefs],\n notChecked: [...input.notChecked],\n };\n}\n"]}
|
|
@@ -771,13 +771,22 @@ export interface ApplicationBuildDispatchPlan {
|
|
|
771
771
|
/** Whether two write sets may touch one file: an equal path, or a path under the other's directory. */
|
|
772
772
|
export declare function productWritePathsMeet(left: readonly string[], right: readonly string[]): boolean;
|
|
773
773
|
/**
|
|
774
|
-
* Dispatches one wave call may make per slot before it returns
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
774
|
+
* Dispatches one wave call may make per slot before it returns: the outer bound, no longer the loop's only turn (#3884). A
|
|
775
|
+
* wave returns only once its live runs have drained, so each drain costs the tail of its slowest run: on reference run
|
|
776
|
+
* 43691253927 every drain at the former 8 per slot held about 20 minutes with 0 to 5 sessions running. The loop now asks for
|
|
777
|
+
* a yield when a playbook the wave holds back needs the turn (`YIELD_REQUESTED`, honoured from
|
|
778
|
+
* {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE}), and a held restart stops the filling on its own (`RESTART_PENDING`).
|
|
779
|
+
*
|
|
780
|
+
* Not higher (review M2), for two costs that grow with a wave: a run that failed its checks beside its siblings waits for
|
|
781
|
+
* the wave's END to be re-checked alone (`AWAITING_ISOLATED_RECHECK`), its dependents with it; and every dispatch entry of
|
|
782
|
+
* the wave's result carries the plan's ready and landed lists. Raised from 4 to 8 with #3204, and to 16 with #3884.
|
|
783
|
+
*/
|
|
784
|
+
export declare const WAVE_DISPATCHES_PER_DEGREE = 16;
|
|
785
|
+
/**
|
|
786
|
+
* The dispatches per slot a wave starts before it honours a yield the loop asked for (#3884 review H2): the former cap, so a
|
|
787
|
+
* playbook the loop holds back but never chooses can shorten a wave to what it was before #3884, and no further.
|
|
779
788
|
*/
|
|
780
|
-
export declare const
|
|
789
|
+
export declare const WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE = 8;
|
|
781
790
|
/** Why a wave stopped taking new tasks — it always still drains the runs already live. */
|
|
782
791
|
export declare enum ApplicationBuildWaveStop {
|
|
783
792
|
/** No task is ready and no run is live: the plan is done, blocked, or every ready task is stuck. */
|
|
@@ -790,6 +799,12 @@ export declare enum ApplicationBuildWaveStop {
|
|
|
790
799
|
* termination rests on that pass-over; without it a step whose landing stays unmet would be selected again forever.
|
|
791
800
|
*/
|
|
792
801
|
GENERATION_STEP_REPEATED = "generation-step-repeated",
|
|
802
|
+
/**
|
|
803
|
+
* The playbook loop asked the wave to yield (#3884): a playbook it holds back writes what the wave's lane writes, so the
|
|
804
|
+
* wave starts nothing more and drains, and that playbook runs at the wave's end. The yield the dispatch cap used to force
|
|
805
|
+
* every 8 dispatches per slot, whether or not anything was waiting.
|
|
806
|
+
*/
|
|
807
|
+
YIELD_REQUESTED = "yield-requested",
|
|
793
808
|
/** An admission was refused; the refusal is on the dispatch entry. */
|
|
794
809
|
DISPATCH_REFUSED = "dispatch-refused",
|
|
795
810
|
/**
|
|
@@ -1338,6 +1353,12 @@ export declare class ApplicationBuildDispatchCompanionService {
|
|
|
1338
1353
|
private lastBuildPreparation;
|
|
1339
1354
|
/** When `wildo build stop` asked the running wave to stop (#3206); cleared when the wave ends. */
|
|
1340
1355
|
private buildWaveStopRequestedAt;
|
|
1356
|
+
/**
|
|
1357
|
+
* Why the playbook loop asked the running wave to YIELD (#3884), cleared when the wave ends: a playbook it holds back
|
|
1358
|
+
* because the wave's lane writes what it writes. Unlike a person's stop it holds nothing afterwards; the next wave fills
|
|
1359
|
+
* as usual once the held playbook has had its turn.
|
|
1360
|
+
*/
|
|
1361
|
+
private buildWaveYieldRequestedBecause;
|
|
1341
1362
|
/**
|
|
1342
1363
|
* The build HOLD a person's `wildo build stop` sets (#3206), kept after the wave it ended: while it is set no build
|
|
1343
1364
|
* wave or task starts unless a person's door released it first ({@link releaseBuildStopHold}) — not the choreography
|
|
@@ -1687,6 +1708,12 @@ export declare class ApplicationBuildDispatchCompanionService {
|
|
|
1687
1708
|
readonly waveStartedAt?: string;
|
|
1688
1709
|
readonly requestedAt?: string;
|
|
1689
1710
|
};
|
|
1711
|
+
/**
|
|
1712
|
+
* Ask the build wave to yield (#3884): once it has dispatched {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE} per slot,
|
|
1713
|
+
* it starts nothing more, drains and returns, so a playbook the loop holds back because of it can run. Idempotent. A
|
|
1714
|
+
* request made before the wave starts applies to it; every request is cleared when a wave ends.
|
|
1715
|
+
*/
|
|
1716
|
+
requestBuildWaveYield(because: string): void;
|
|
1690
1717
|
/** The generation steps held because their panel refused stale expert charters (#3204); empty when none is. */
|
|
1691
1718
|
readStaleExpertChartersHold(): readonly StaleExpertChartersHeld[];
|
|
1692
1719
|
/** The staffing step derived the charters again (#3204): every held step is offered again. */
|