@wildo-ai/dev-companion 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  3. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +8 -6
  4. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  5. package/dist/esm/companion-api/controllers/companion.controller.d.ts +6 -0
  6. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  7. package/dist/esm/companion-api/controllers/companion.controller.js +13 -1
  8. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  9. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  10. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +7 -0
  11. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  12. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +5 -1
  13. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -1
  14. package/dist/esm/core/introspection/resources/launch-blockers.companion.js +37 -4
  15. package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -1
  16. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +14 -0
  17. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  18. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +48 -0
  19. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  20. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts +128 -0
  21. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts.map +1 -0
  22. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js +180 -0
  23. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js.map +1 -0
  24. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts +9 -0
  25. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts.map +1 -1
  26. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js +25 -3
  27. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js.map +1 -1
  28. package/dist/esm/core/runtime/restart-drain.companion.d.ts +107 -0
  29. package/dist/esm/core/runtime/restart-drain.companion.d.ts.map +1 -0
  30. package/dist/esm/core/runtime/restart-drain.companion.js +237 -0
  31. package/dist/esm/core/runtime/restart-drain.companion.js.map +1 -0
  32. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
  33. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  34. package/dist/esm/executions/services/companion-executions.companion.service.js +34 -8
  35. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  36. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +40 -0
  37. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  38. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +13 -0
  39. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  40. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +40 -0
  41. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  42. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +40 -0
  43. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  44. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +5 -0
  45. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  46. package/dist/esm/i18n/system_enums/application-creation.en.js +6 -0
  47. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  48. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +5 -0
  49. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts.map +1 -1
  50. package/dist/esm/i18n/system_enums/application-creation.fr.js +5 -0
  51. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  52. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +2 -0
  53. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  54. package/dist/esm/i18n/system_enums/workbench-build.en.js +2 -0
  55. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  56. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +5 -1
  57. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  58. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +5 -1
  59. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  60. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +12 -0
  61. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  62. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +9 -0
  63. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  64. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +80 -4
  65. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  66. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +235 -42
  67. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  68. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +56 -3
  69. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  70. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +182 -33
  71. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  72. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +58 -0
  73. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  74. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +116 -2
  75. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  76. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +12 -0
  77. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  78. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +31 -7
  79. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  80. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +2 -2
  81. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  82. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +10 -8
  83. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  84. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +67 -2
  85. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  86. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +243 -48
  87. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  88. package/package.json +17 -17
@@ -1,4 +1,4 @@
1
- import { type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';
1
+ import { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';
2
2
  import type { ApplicationCodingMetRequirement, ApplicationCodingUnmetRequirement } from '../../claude-cli/models/coding-agent-dispatch.models';
3
3
  /**
4
4
  * The ref prefix of a FOLLOW-UP task the host derives when a completed coding run reports a requirement it could not
@@ -15,6 +15,57 @@ export interface FollowUpReportingRun {
15
15
  /** What the run STATED is met, with where (#3227); absent states nothing. */
16
16
  readonly metRequirements?: readonly ApplicationCodingMetRequirement[];
17
17
  }
18
+ /**
19
+ * What a task's TARGET can do about a requirement it reports unmet (#3701), total over {@link BuildPlanTaskTargetKind}: a
20
+ * kind added to the vocabulary does not compile until somebody says whether its follow-up can close a product gap.
21
+ */
22
+ export declare enum FollowUpTargetReach {
23
+ /** Its scope builds the product: a follow-up on it can close what the product lacks. */
24
+ DELIVERS = "DELIVERS",
25
+ /**
26
+ * Its scope PRESENTS the product (the marketing website, the technical documentation): it can describe a feature, and
27
+ * never build one. A follow-up on it can only reword the page, which is how the reference run of 2026-11-10 landed 31
28
+ * follow-ups with the features they reported still missing.
29
+ */
30
+ PRESENTS = "PRESENTS",
31
+ /** A companion generation step: no coding run ever runs it. */
32
+ GENERATES = "GENERATES"
33
+ }
34
+ export declare const BUILD_TARGET_FOLLOW_UP_REACH: Readonly<Record<BuildPlanTaskTargetKind, FollowUpTargetReach>>;
35
+ /**
36
+ * The skill a follow-up lifted to a whole MODULE carries beside its serving tasks' skills: the MODULE kind's own reason to
37
+ * exist is registering the module in every layer, and that is the skill that teaches it.
38
+ */
39
+ export declare const MODULE_FOLLOW_UP_SKILL_REF = "module-registration";
40
+ /**
41
+ * The scope that CLOSES a product gap on one serving task's target (#3701). Every module-scoped kind writes a subset of
42
+ * its module's MODULE scope (the coding policy's own prefixes: a resource stage, a relationship file, a module's frontend
43
+ * or backend layer), and only the MODULE scope reaches the module registries. A gap a presenting task reports can be
44
+ * anywhere in the module, so it goes to the module; an application-wide target closes in its own scope.
45
+ */
46
+ export declare function productClosingTarget(target: BuildPlanTask['target']): BuildPlanTask['target'] | undefined;
47
+ /** Where one reported gap's follow-up runs: its target, the tasks it was derived from, and their skills and topic. */
48
+ export interface FollowUpClosingScope {
49
+ readonly target: BuildPlanTask['target'];
50
+ /** Empty when the follow-up stays on its origin's target; else the product tasks serving the requirement in this scope. */
51
+ readonly servingTaskRefs: readonly string[];
52
+ readonly skillRefs: readonly string[];
53
+ readonly functionalTopic: BuildPlanTask['functionalTopic'];
54
+ }
55
+ /**
56
+ * WHERE a gap one origin reported is closed (#3701), through the decomposer's own mapping from a requirement to the work
57
+ * that delivers it: the plan's `servesRefs`.
58
+ *
59
+ * - An origin whose target DELIVERS the product closes its own gap: one scope, the origin's (unchanged since #2496).
60
+ * - An origin that PRESENTS the product (a website section, a documentation chapter) reported that the product does not
61
+ * do what the page describes. The gap goes to every product task serving the same requirement, lifted to the scope that
62
+ * closes it ({@link productClosingTarget}), one scope per distinct target, in plan order. The reference run's
63
+ * bid-records gap ("not registered in the backend or frontend module registries") was reported by a website section and
64
+ * went back to that section; it now goes to the bid-records MODULE.
65
+ * - A presenting origin whose requirement no product task serves is a requirement only pages deliver (a public case
66
+ * study): it stays on the origin's target.
67
+ */
68
+ export declare function resolveFollowUpClosingScopes(origin: BuildPlanTask, requirementRef: string, planTasks: readonly BuildPlanTask[]): readonly FollowUpClosingScope[];
18
69
  /** One gap one origin's run reported, as a follow-up carries it. */
19
70
  export interface FollowUpGap {
20
71
  readonly originTaskRef: string;
@@ -118,8 +169,10 @@ export declare function targetKey(target: BuildPlanTask['target']): string;
118
169
  * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still
119
170
  * told to read what was built since and change nothing when a gap is met.
120
171
  *
121
- * Unchanged: the chain is one step long (a follow-up's own report derives nothing), a follow-up keeps its origin's target
122
- * and skills, and an origin whose target lands by its own probe or is a generation step derives nothing.
172
+ * Unchanged: the chain is one step long (a follow-up's own report derives nothing), and an origin whose target lands by
173
+ * its own probe or is a generation step derives nothing. A follow-up keeps its origin's target and skills, EXCEPT when the
174
+ * origin only presents the product (#3701): its gaps go to the product scopes serving the requirement, see
175
+ * {@link resolveFollowUpClosingScopes}.
123
176
  */
124
177
  export declare function deriveBuildPlanFollowUpTasks(input: {
125
178
  readonly tasks: readonly BuildPlanTask[];
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-follow-up-derivation.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEjH,OAAO,KAAK,EAAE,+BAA+B,EAAE,i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AAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxE;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC9D,GAAG,kBAAkB,CA0ErB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACzE,GAAG,SAAS,mBAAmB,EAAE,CA+BjC;AAED,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yHAAyH;IACzH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,GAAG,SAAS,eAAe,EAAE,CAmB7B"}
1
+ {"version":3,"file":"application-build-follow-up-derivation.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.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mBAAmB,CAAC,CAAC;CAC9D,GAAG,kBAAkB,CAkGrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACzE,GAAG,SAAS,mBAAmB,EAAE,CAyCjC;AAED,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yHAAyH;IACzH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACxE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,GAAG,SAAS,eAAe,EAAE,CAmB7B"}
@@ -7,6 +7,119 @@ import { resolveBuildTaskLandedProbes } from './application-build-task-coding-po
7
7
  * the chain is one step long; what it leaves unmet is shown on its record.
8
8
  */
9
9
  export const HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX = 'build-task-follow-up-';
10
+ /**
11
+ * What a task's TARGET can do about a requirement it reports unmet (#3701), total over {@link BuildPlanTaskTargetKind}: a
12
+ * kind added to the vocabulary does not compile until somebody says whether its follow-up can close a product gap.
13
+ */
14
+ export var FollowUpTargetReach;
15
+ (function (FollowUpTargetReach) {
16
+ /** Its scope builds the product: a follow-up on it can close what the product lacks. */
17
+ FollowUpTargetReach["DELIVERS"] = "DELIVERS";
18
+ /**
19
+ * Its scope PRESENTS the product (the marketing website, the technical documentation): it can describe a feature, and
20
+ * never build one. A follow-up on it can only reword the page, which is how the reference run of 2026-11-10 landed 31
21
+ * follow-ups with the features they reported still missing.
22
+ */
23
+ FollowUpTargetReach["PRESENTS"] = "PRESENTS";
24
+ /** A companion generation step: no coding run ever runs it. */
25
+ FollowUpTargetReach["GENERATES"] = "GENERATES";
26
+ })(FollowUpTargetReach || (FollowUpTargetReach = {}));
27
+ export const BUILD_TARGET_FOLLOW_UP_REACH = {
28
+ [BuildPlanTaskTargetKind.MODULE]: FollowUpTargetReach.DELIVERS,
29
+ [BuildPlanTaskTargetKind.RESOURCE_STAGE]: FollowUpTargetReach.DELIVERS,
30
+ [BuildPlanTaskTargetKind.RELATIONSHIP]: FollowUpTargetReach.DELIVERS,
31
+ [BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP]: FollowUpTargetReach.GENERATES,
32
+ [BuildPlanTaskTargetKind.SHELL_PLACEMENT]: FollowUpTargetReach.DELIVERS,
33
+ [BuildPlanTaskTargetKind.MODULE_FRONTEND]: FollowUpTargetReach.DELIVERS,
34
+ [BuildPlanTaskTargetKind.MODULE_BACKEND]: FollowUpTargetReach.DELIVERS,
35
+ [BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG]: FollowUpTargetReach.DELIVERS,
36
+ [BuildPlanTaskTargetKind.WEBSITE]: FollowUpTargetReach.PRESENTS,
37
+ [BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION]: FollowUpTargetReach.PRESENTS,
38
+ [BuildPlanTaskTargetKind.WORKER]: FollowUpTargetReach.DELIVERS,
39
+ [BuildPlanTaskTargetKind.MINION]: FollowUpTargetReach.DELIVERS,
40
+ [BuildPlanTaskTargetKind.PROVIDER_BINDING]: FollowUpTargetReach.DELIVERS,
41
+ [BuildPlanTaskTargetKind.BILLING_CATALOG]: FollowUpTargetReach.DELIVERS,
42
+ [BuildPlanTaskTargetKind.APPLICATION_ROLES]: FollowUpTargetReach.DELIVERS,
43
+ [BuildPlanTaskTargetKind.ORGANIZATION_MODEL]: FollowUpTargetReach.DELIVERS,
44
+ };
45
+ /**
46
+ * The skill a follow-up lifted to a whole MODULE carries beside its serving tasks' skills: the MODULE kind's own reason to
47
+ * exist is registering the module in every layer, and that is the skill that teaches it.
48
+ */
49
+ export const MODULE_FOLLOW_UP_SKILL_REF = 'module-registration';
50
+ /**
51
+ * The scope that CLOSES a product gap on one serving task's target (#3701). Every module-scoped kind writes a subset of
52
+ * its module's MODULE scope (the coding policy's own prefixes: a resource stage, a relationship file, a module's frontend
53
+ * or backend layer), and only the MODULE scope reaches the module registries. A gap a presenting task reports can be
54
+ * anywhere in the module, so it goes to the module; an application-wide target closes in its own scope.
55
+ */
56
+ export function productClosingTarget(target) {
57
+ switch (target.kind) {
58
+ case BuildPlanTaskTargetKind.MODULE:
59
+ case BuildPlanTaskTargetKind.RESOURCE_STAGE:
60
+ case BuildPlanTaskTargetKind.RELATIONSHIP:
61
+ case BuildPlanTaskTargetKind.MODULE_FRONTEND:
62
+ case BuildPlanTaskTargetKind.MODULE_BACKEND:
63
+ return { kind: BuildPlanTaskTargetKind.MODULE, moduleRef: target.moduleRef };
64
+ case BuildPlanTaskTargetKind.SHELL_PLACEMENT:
65
+ case BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG:
66
+ case BuildPlanTaskTargetKind.WORKER:
67
+ case BuildPlanTaskTargetKind.MINION:
68
+ case BuildPlanTaskTargetKind.PROVIDER_BINDING:
69
+ case BuildPlanTaskTargetKind.BILLING_CATALOG:
70
+ case BuildPlanTaskTargetKind.APPLICATION_ROLES:
71
+ case BuildPlanTaskTargetKind.ORGANIZATION_MODEL:
72
+ return target;
73
+ case BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP:
74
+ case BuildPlanTaskTargetKind.WEBSITE:
75
+ case BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION:
76
+ return undefined;
77
+ default: {
78
+ const unhandled = target;
79
+ throw new Error(`Unhandled build-plan target ${JSON.stringify(unhandled)}.`);
80
+ }
81
+ }
82
+ }
83
+ /**
84
+ * WHERE a gap one origin reported is closed (#3701), through the decomposer's own mapping from a requirement to the work
85
+ * that delivers it: the plan's `servesRefs`.
86
+ *
87
+ * - An origin whose target DELIVERS the product closes its own gap: one scope, the origin's (unchanged since #2496).
88
+ * - An origin that PRESENTS the product (a website section, a documentation chapter) reported that the product does not
89
+ * do what the page describes. The gap goes to every product task serving the same requirement, lifted to the scope that
90
+ * closes it ({@link productClosingTarget}), one scope per distinct target, in plan order. The reference run's
91
+ * bid-records gap ("not registered in the backend or frontend module registries") was reported by a website section and
92
+ * went back to that section; it now goes to the bid-records MODULE.
93
+ * - A presenting origin whose requirement no product task serves is a requirement only pages deliver (a public case
94
+ * study): it stays on the origin's target.
95
+ */
96
+ export function resolveFollowUpClosingScopes(origin, requirementRef, planTasks) {
97
+ const own = { target: origin.target, servingTaskRefs: [], skillRefs: origin.skillRefs, functionalTopic: origin.functionalTopic };
98
+ if (BUILD_TARGET_FOLLOW_UP_REACH[origin.target.kind] !== FollowUpTargetReach.PRESENTS)
99
+ return [own];
100
+ const scopes = new Map();
101
+ for (const task of planTasks) {
102
+ if (task.taskRef === origin.taskRef || !task.servesRefs.includes(requirementRef))
103
+ continue;
104
+ if (BUILD_TARGET_FOLLOW_UP_REACH[task.target.kind] !== FollowUpTargetReach.DELIVERS)
105
+ continue;
106
+ const target = productClosingTarget(task.target);
107
+ if (target === undefined)
108
+ continue;
109
+ const key = targetKey(target);
110
+ const entry = scopes.get(key) ?? { target, serving: [] };
111
+ entry.serving.push(task);
112
+ scopes.set(key, entry);
113
+ }
114
+ if (scopes.size === 0)
115
+ return [own];
116
+ return [...scopes.values()].map(({ target, serving }) => ({
117
+ target,
118
+ servingTaskRefs: serving.map((task) => task.taskRef),
119
+ skillRefs: [...new Set([...(target.kind === BuildPlanTaskTargetKind.MODULE ? [MODULE_FOLLOW_UP_SKILL_REF] : []), ...serving.flatMap((task) => task.skillRefs)])],
120
+ functionalTopic: serving[0].functionalTopic,
121
+ }));
122
+ }
10
123
  /** Why a reported gap derives no follow-up task (#2496). */
11
124
  export var FollowUpGapNotDerivedReason;
12
125
  (function (FollowUpGapNotDerivedReason) {
@@ -83,8 +196,10 @@ export function targetKey(target) {
83
196
  * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still
84
197
  * told to read what was built since and change nothing when a gap is met.
85
198
  *
86
- * Unchanged: the chain is one step long (a follow-up's own report derives nothing), a follow-up keeps its origin's target
87
- * and skills, and an origin whose target lands by its own probe or is a generation step derives nothing.
199
+ * Unchanged: the chain is one step long (a follow-up's own report derives nothing), and an origin whose target lands by
200
+ * its own probe or is a generation step derives nothing. A follow-up keeps its origin's target and skills, EXCEPT when the
201
+ * origin only presents the product (#3701): its gaps go to the product scopes serving the requirement, see
202
+ * {@link resolveFollowUpClosingScopes}.
88
203
  */
89
204
  export function deriveBuildPlanFollowUpTasks(input) {
90
205
  const notDerived = [];
@@ -128,33 +243,57 @@ export function deriveBuildPlanFollowUpTasks(input) {
128
243
  const refByOriginRequirement = new Map();
129
244
  const previousOnTarget = new Map();
130
245
  for (const { origin, run, gaps } of reports) {
131
- const taskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);
132
- const key = targetKey(origin.target);
133
- const previous = previousOnTarget.get(key);
134
- previousOnTarget.set(key, taskRef);
135
- const requirementRefs = [...new Set(gaps.map((gap) => gap.requirementRef))];
136
- const servingTasks = [...new Set(planTasks
137
- .filter((task) => task.taskRef !== origin.taskRef && requirementRefs.some((ref) => task.servesRefs.includes(ref)))
138
- .map((task) => task.taskRef))];
139
- const task = chainFollowUpAfter({
140
- taskRef,
141
- objective: `Meet what ${origin.taskRef} reported still unmet: `
142
- + gaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ')
143
- + ' Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '
144
- + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')
145
- + 'Derived by the dispatch host from that run\'s closing report.',
146
- target: origin.target,
147
- produces: [],
148
- functionalTopic: origin.functionalTopic,
149
- skillRefs: origin.skillRefs,
150
- // The origin FIRST (`followUpOf` reads it); the follow-up before it on the same target is added by the chain.
151
- prerequisiteTaskRefs: [origin.taskRef],
152
- // Only refs the origin serves: a free-text ref would be a dangling citation in the plan.
153
- servesRefs: requirementRefs.filter((ref) => origin.servesRefs.includes(ref)),
154
- }, previous);
155
- followUps.push({ task, gaps, targetKey: key });
156
- for (const gap of gaps)
157
- refByOriginRequirement.set(`${gap.originTaskRef}\u0000${gap.requirementRef}`, taskRef);
246
+ /*
247
+ * One follow-up per CLOSING SCOPE of this report (#3701): the origin's own, unless the origin only presents the product,
248
+ * in which case each product scope serving a reported requirement gets the gaps it can close. A routed follow-up's ref
249
+ * adds its scope to the run's token, so the same report keeps deriving the same tasks.
250
+ */
251
+ const byScope = new Map();
252
+ for (const gap of gaps) {
253
+ for (const scope of resolveFollowUpClosingScopes(origin, gap.requirementRef, planTasks)) {
254
+ const key = targetKey(scope.target);
255
+ const entry = byScope.get(key) ?? { scope, gaps: [] };
256
+ entry.gaps.push(gap);
257
+ byScope.set(key, entry);
258
+ }
259
+ }
260
+ for (const [key, { scope, gaps: scopeGaps }] of byScope) {
261
+ const routed = scope.servingTaskRefs.length > 0;
262
+ const taskRef = routed ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\u0000${key}`) : deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);
263
+ const previous = previousOnTarget.get(key);
264
+ previousOnTarget.set(key, taskRef);
265
+ const requirementRefs = [...new Set(scopeGaps.map((gap) => gap.requirementRef))];
266
+ const servingTasks = [...new Set(planTasks
267
+ .filter((task) => task.taskRef !== origin.taskRef && requirementRefs.some((ref) => task.servesRefs.includes(ref)))
268
+ .map((task) => task.taskRef))];
269
+ const task = chainFollowUpAfter({
270
+ taskRef,
271
+ objective: (routed
272
+ ? `${origin.taskRef} presents the product and reported that the product does not yet deliver: `
273
+ + scopeGaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ')
274
+ + ` Build what is missing in this scope, where ${scope.servingTaskRefs.join(', ')} built the requirement; a page cannot. `
275
+ + 'If what is missing lies outside this scope, change nothing and report it. '
276
+ : `Meet what ${origin.taskRef} reported still unmet: `
277
+ + scopeGaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ') + ' ')
278
+ + 'Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '
279
+ + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')
280
+ + 'Derived by the dispatch host from that run\'s closing report.',
281
+ target: scope.target,
282
+ produces: [],
283
+ functionalTopic: scope.functionalTopic,
284
+ skillRefs: [...scope.skillRefs],
285
+ // The origin FIRST (`followUpOf` reads it); the follow-up before it on the same target is added by the chain.
286
+ prerequisiteTaskRefs: [origin.taskRef],
287
+ // Only refs the origin serves: a free-text ref would be a dangling citation in the plan.
288
+ servesRefs: requirementRefs.filter((ref) => origin.servesRefs.includes(ref)),
289
+ }, previous);
290
+ followUps.push({ task, gaps: scopeGaps, targetKey: key });
291
+ for (const gap of scopeGaps) {
292
+ const originRequirement = `${gap.originTaskRef}\u0000${gap.requirementRef}`;
293
+ if (!refByOriginRequirement.has(originRequirement))
294
+ refByOriginRequirement.set(originRequirement, taskRef);
295
+ }
296
+ }
158
297
  }
159
298
  return {
160
299
  followUps,
@@ -191,12 +330,21 @@ export function collectFollowUpGapsMetSince(input) {
191
330
  if (Number.isNaN(reportedAt))
192
331
  continue;
193
332
  const followUpTaskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);
194
- const key = targetKey(origin.target);
195
333
  for (const entry of run.unmetRequirements ?? []) {
334
+ /*
335
+ * A statement counts from a task writing a scope that CLOSES the gap (#3701): the origin's own, or for a presenting
336
+ * origin the product scopes its gap is routed to, where a task's target is read through the same lift.
337
+ */
338
+ const scopes = resolveFollowUpClosingScopes(origin, entry.requirementRef, planTasks);
339
+ const closingKeys = new Set(scopes.map((scope) => targetKey(scope.target)));
340
+ const routedRefs = new Set(scopes.filter((scope) => scope.servingTaskRefs.length > 0)
341
+ .map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\u0000${targetKey(scope.target)}`)));
342
+ const routed = routedRefs.size > 0;
196
343
  for (const task of input.tasks) {
197
- if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef)
344
+ if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef || routedRefs.has(task.taskRef))
198
345
  continue;
199
- if (targetKey(task.target) !== key || !task.servesRefs.includes(entry.requirementRef))
346
+ const taskScope = routed ? productClosingTarget(task.target) : task.target;
347
+ if (taskScope === undefined || !closingKeys.has(targetKey(taskScope)) || !task.servesRefs.includes(entry.requirementRef))
200
348
  continue;
201
349
  const later = input.latestCompletedRuns.get(task.taskRef);
202
350
  if (later === undefined || !(Date.parse(later.startedAt) > reportedAt))
@@ -208,7 +356,8 @@ export function collectFollowUpGapsMetSince(input) {
208
356
  continue;
209
357
  candidates.push({
210
358
  gap: { originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing },
211
- followUpTaskRef,
359
+ // A routed gap's first follow-up (#3701): the host keeps the gap when it was ever attempted.
360
+ followUpTaskRef: routed ? [...routedRefs][0] : followUpTaskRef,
212
361
  metByTaskRef: task.taskRef,
213
362
  metByRunTaskId: later.runTaskId,
214
363
  evidence: met.evidence,
@@ -1 +1 @@
1
- {"version":3,"file":"application-build-follow-up-derivation.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,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IAAI,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';\n\nimport type { ApplicationCodingMetRequirement, ApplicationCodingUnmetRequirement } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { resolveBuildTaskLandedProbes } from './application-build-task-coding-policy.companion.service';\n\n/**\n * The ref prefix of a FOLLOW-UP task the host derives when a completed coding run reports a requirement it could not\n * fully meet (#2496): `build-task-follow-up-<origin>-<token>`. A follow-up's own report derives nothing further, so\n * the chain is one step long; what it leaves unmet is shown on its record.\n */\nexport const HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX = 'build-task-follow-up-';\n\n/** What the derivation reads of a task's latest COMPLETED coding run. */\nexport interface FollowUpReportingRun {\n readonly runTaskId: string;\n readonly startedAt: string;\n readonly settledAt?: string;\n readonly unmetRequirements?: readonly ApplicationCodingUnmetRequirement[];\n /** What the run STATED is met, with where (#3227); absent states nothing. */\n readonly metRequirements?: readonly ApplicationCodingMetRequirement[];\n}\n\n/** One gap one origin's run reported, as a follow-up carries it. */\nexport interface FollowUpGap {\n readonly originTaskRef: string;\n readonly reportingRunTaskId: string;\n readonly requirementRef: string;\n readonly missing: string;\n}\n\n/** A reported gap the derivation did not turn into a follow-up, and why, so the log can say it. */\nexport interface FollowUpGapNotDerived extends FollowUpGap {\n readonly reason: FollowUpGapNotDerivedReason;\n /** For {@link FollowUpGapNotDerivedReason.MET_SINCE}: the run that stated it met, and where. */\n readonly metSince?: Omit<FollowUpGapMetSince, 'gap' | 'followUpTaskRef'>;\n}\n\n/** Why a reported gap derives no follow-up task (#2496). */\nexport enum FollowUpGapNotDerivedReason {\n /** The origin's target lands by its own probe (a shell placement), so a follow-up would read as landed without running. */\n TARGET_LANDS_BY_ITS_OWN_PROBE = 'TARGET_LANDS_BY_ITS_OWN_PROBE',\n /** The origin is a companion generation step, which no coding run ever runs. */\n GENERATION_STEP = 'GENERATION_STEP',\n /**\n * A LANDED later run of another task on the same target, serving the same requirement, STATED it met (#3227): its closing\n * report's `wildo-requirements-met` block names the requirement, with where. Measured on app-creation-test-007: six of\n * eleven follow-ups changed nothing, their workers saying another task had already met the gap, at about 20 minutes of\n * selection and a run each. Only that positive statement drops a gap; silence and a malformed block never do.\n */\n MET_SINCE = 'MET_SINCE',\n}\n\n/** A reported gap a later run states is met (#3227): the candidate a host may drop, once it has checked the run landed. */\nexport interface FollowUpGapMetSince {\n readonly gap: FollowUpGap;\n /** The follow-up the gap would derive: a host keeps the gap when that follow-up was ever attempted (#2530). */\n readonly followUpTaskRef: string;\n /** The task whose run stated it met. */\n readonly metByTaskRef: string;\n /** That run: a host drops the gap only when the run LANDED (everything it wrote is committed). */\n readonly metByRunTaskId: string;\n /** Where the run said it is met. */\n readonly evidence: string;\n}\n\n/** The key one gap is addressed by: its origin, its reporting run and its requirement. */\nexport function followUpGapKey(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${gap.originTaskRef}\\u0000${gap.reportingRunTaskId}\\u0000${gap.requirementRef}`;\n}\n\n/** One derived follow-up task, with every gap it answers. */\nexport interface DerivedFollowUp {\n /** The task, chained after the follow-up before it on its target (see {@link chainFollowUpAfter}). */\n readonly task: BuildPlanTask;\n readonly gaps: readonly FollowUpGap[];\n /** Its target's identity: the follow-ups sharing one are chained, in the order their reports settled. */\n readonly targetKey: string;\n}\n\nexport interface FollowUpDerivation {\n readonly followUps: readonly DerivedFollowUp[];\n readonly notDerived: readonly FollowUpGapNotDerived[];\n /** The follow-up that carries one origin's reported requirement, when one does (the website claim delivery asks). */\n followUpTaskRefFor(originTaskRef: string, requirementRef: string): string | undefined;\n /** Whether one origin's reported requirement was dropped because a landed later run stated it met (#3227). */\n gapMetSince(originTaskRef: string, requirementRef: string): boolean;\n}\n\n/**\n * The follow-up ref of ONE origin's ONE reporting run: the origin, then a token of the run, so the same report derives the\n * same task on every read while a later run reporting again derives a NEW task (the old follow-up's completed run must not\n * land the new report at birth). Always a slug the graph schema accepts: an origin ref with no ASCII letter or digit is\n * named by a digest instead, so no agent-written string can make the plan unreadable.\n *\n * The requirement is not part of the ref (#3227): one run reporting two requirements is ONE follow-up. app-creation-test-007\n * ran `…job-config-…-building-customer-lifecycle-3d9049` and `…job-config-…-shared-office-field-customer-context-3d9049`,\n * the same task, from the same run, twice, both changing nothing.\n */\nexport function deriveFollowUpTaskRef(originTaskRef: string, reportingRunTaskId: string): string {\n const slug = (value: string) => value.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');\n const digest = (value: string) => createHash('sha256').update(value).digest('hex');\n const origin = slug(originTaskRef.replace(/^build-task-/u, '')) || `t${digest(originTaskRef).slice(0, 8)}`;\n return `${HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX}${origin}-${digest(reportingRunTaskId).slice(0, 6)}`;\n}\n\n/**\n * A follow-up waiting on its origin and, when there is one, on the follow-up before it on its target. One function, so the\n * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain\n * naming a task the plan does not hold would make the plan unreadable.\n */\nexport function chainFollowUpAfter(followUp: BuildPlanTask, previousOnTarget: string | undefined): BuildPlanTask {\n const origin = followUp.prerequisiteTaskRefs[0]!;\n return { ...followUp, prerequisiteTaskRefs: previousOnTarget === undefined ? [origin] : [origin, previousOnTarget] };\n}\n\n/** A target's identity: two tasks with equal targets write the same scope (#3227). */\nexport function targetKey(target: BuildPlanTask['target']): string {\n const entries = Object.entries(target as Record<string, unknown>).sort(([left], [right]) => left.localeCompare(right));\n return JSON.stringify(entries);\n}\n\n/**\n * The follow-up tasks the reported gaps derive (#2496, #3227). Pure: the dispatch host supplies the plan and each task's\n * latest completed run.\n *\n * ## One follow-up per reporting run, chained per target\n *\n * - **Every requirement one run reported is folded into one follow-up** (#3227): one scope, one worker, one set of\n * checks, instead of the same task once per requirement.\n * - **Its identity is the origin and the reporting run, and nothing else**, so it is STABLE while that report stands:\n * another task on the same target reporting later derives a NEW follow-up rather than renaming this one. A follow-up\n * the build is running, or has run, therefore never leaves the plan because somebody else reported (#2530); and a\n * completed follow-up is never re-derived with gaps it already answered.\n * - **Follow-ups on one target are chained IN THE ORDER THEIR REPORTS SETTLED** (then by origin ref), each waiting on the\n * one before it: they write one scope, and two of them at once would overwrite each other (the interference that made\n * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan\n * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was\n * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.\n *\n * ## A gap a later run STATED met is dropped; silence drops nothing\n *\n * Dropping on ABSENCE was tried and withdrawn (review of 5e3ab7d76): a missing block, a malformed one and a run that never\n * looked at the requirement all read the same, so it closed gaps nobody had closed. The worker contract now carries the\n * positive half, a `wildo-requirements-met` block, and a gap is dropped only when {@link collectFollowUpGapsMetSince} finds\n * a later run that states it and the host confirms that run LANDED and the follow-up was never attempted (`metSince`).\n * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still\n * told to read what was built since and change nothing when a gap is met.\n *\n * Unchanged: the chain is one step long (a follow-up's own report derives nothing), a follow-up keeps its origin's target\n * and skills, and an origin whose target lands by its own probe or is a generation step derives nothing.\n */\nexport function deriveBuildPlanFollowUpTasks(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n /**\n * The gaps a host CONFIRMED met since (#3227), by {@link followUpGapKey}: candidates from\n * {@link collectFollowUpGapsMetSince} whose stating run landed and whose follow-up was never attempted. Absent drops\n * nothing, which is the reading when the host could not check.\n */\n readonly metSince?: ReadonlyMap<string, FollowUpGapMetSince>;\n}): FollowUpDerivation {\n const notDerived: FollowUpGapNotDerived[] = [];\n const reports: { readonly origin: BuildPlanTask; readonly run: FollowUpReportingRun; readonly gaps: readonly FollowUpGap[] }[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n const reported = run?.unmetRequirements ?? [];\n if (run === undefined || reported.length === 0) continue;\n const reportedGaps = reported.map((entry) => ({ originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing }));\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.GENERATION_STEP })));\n continue;\n }\n if (resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.TARGET_LANDS_BY_ITS_OWN_PROBE })));\n continue;\n }\n // A gap a landed later run stated met, as the host confirmed (#3227): dropped, and named.\n const gaps = reportedGaps.filter((gap) => {\n const met = input.metSince?.get(followUpGapKey(gap));\n if (met === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.MET_SINCE, metSince: { metByTaskRef: met.metByTaskRef, metByRunTaskId: met.metByRunTaskId, evidence: met.evidence } });\n return false;\n });\n if (gaps.length === 0) continue;\n reports.push({ origin, run, gaps });\n }\n // Report order: when the reporting run settled (its start when it recorded no settlement), then the origin's ref. A\n // timestamp that does not parse sorts last, never as 1970, so it cannot jump ahead of reports whose time is known.\n const reportedAt = (run: FollowUpReportingRun): number => {\n const at = Date.parse(run.settledAt ?? run.startedAt);\n return Number.isNaN(at) ? Number.POSITIVE_INFINITY : at;\n };\n const byReportedAt = (left: number, right: number): number => (left === right ? 0 : left < right ? -1 : 1);\n reports.sort((left, right) => byReportedAt(reportedAt(left.run), reportedAt(right.run)) || left.origin.taskRef.localeCompare(right.origin.taskRef));\n\n const followUps: DerivedFollowUp[] = [];\n const refByOriginRequirement = new Map<string, string>();\n const previousOnTarget = new Map<string, string>();\n for (const { origin, run, gaps } of reports) {\n const taskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n const key = targetKey(origin.target);\n const previous = previousOnTarget.get(key);\n previousOnTarget.set(key, taskRef);\n const requirementRefs = [...new Set(gaps.map((gap) => gap.requirementRef))];\n const servingTasks = [...new Set(planTasks\n .filter((task) => task.taskRef !== origin.taskRef && requirementRefs.some((ref) => task.servesRefs.includes(ref)))\n .map((task) => task.taskRef))];\n const task = chainFollowUpAfter({\n taskRef,\n objective: `Meet what ${origin.taskRef} reported still unmet: `\n + gaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ')\n + ' Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '\n + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')\n + 'Derived by the dispatch host from that run\\'s closing report.',\n target: origin.target,\n produces: [],\n functionalTopic: origin.functionalTopic,\n skillRefs: origin.skillRefs,\n // The origin FIRST (`followUpOf` reads it); the follow-up before it on the same target is added by the chain.\n prerequisiteTaskRefs: [origin.taskRef],\n // Only refs the origin serves: a free-text ref would be a dangling citation in the plan.\n servesRefs: requirementRefs.filter((ref) => origin.servesRefs.includes(ref)),\n } as BuildPlanTask, previous);\n followUps.push({ task, gaps, targetKey: key });\n for (const gap of gaps) refByOriginRequirement.set(`${gap.originTaskRef}\\u0000${gap.requirementRef}`, taskRef);\n }\n return {\n followUps,\n notDerived,\n followUpTaskRefFor: (originTaskRef, requirementRef) => refByOriginRequirement.get(`${originTaskRef}\\u0000${requirementRef}`),\n gapMetSince: (originTaskRef, requirementRef) => notDerived.some((gap) => gap.reason === FollowUpGapNotDerivedReason.MET_SINCE\n && gap.originTaskRef === originTaskRef && gap.requirementRef === requirementRef),\n };\n}\n\n/**\n * The reported gaps a LATER run states met (#3227), pure: the candidates a host may drop. For each gap an eligible origin\n * reported (one the derivation would turn into a follow-up), the first other task that\n *\n * - writes the SAME target (two tasks with equal targets write the same scope, so its statement is about the same surface),\n * - serves the same requirement,\n * - completed a run that STARTED after the reporting run settled (it read the tree the report described, or a later one),\n * - and whose run's `wildo-requirements-met` block names the requirement and its unmet block does not.\n *\n * EVERY such task is a candidate, in plan order, so a statement whose run has not landed does not hide one that has. A\n * gap's own follow-up is never its verifier: once it has run, it is attempted and keeps the gap anyway. The host must\n * still confirm that the stating run LANDED and that the follow-up was never attempted before it passes a candidate on as\n * `metSince`; this function only finds who said so.\n */\nexport function collectFollowUpGapsMetSince(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n}): readonly FollowUpGapMetSince[] {\n const candidates: FollowUpGapMetSince[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n if (run === undefined || (run.unmetRequirements ?? []).length === 0) continue;\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP || resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) continue;\n const reportedAt = Date.parse(run.settledAt ?? run.startedAt);\n if (Number.isNaN(reportedAt)) continue;\n const followUpTaskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n const key = targetKey(origin.target);\n for (const entry of run.unmetRequirements ?? []) {\n for (const task of input.tasks) {\n if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef) continue;\n if (targetKey(task.target) !== key || !task.servesRefs.includes(entry.requirementRef)) continue;\n const later = input.latestCompletedRuns.get(task.taskRef);\n if (later === undefined || !(Date.parse(later.startedAt) > reportedAt)) continue;\n if ((later.unmetRequirements ?? []).some((unmet) => unmet.requirementRef === entry.requirementRef)) continue;\n const met = (later.metRequirements ?? []).find((statement) => statement.requirementRef === entry.requirementRef);\n if (met === undefined) continue;\n candidates.push({\n gap: { originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing },\n followUpTaskRef,\n metByTaskRef: task.taskRef,\n metByRunTaskId: later.runTaskId,\n evidence: met.evidence,\n });\n }\n }\n }\n return candidates;\n}\n\n/** One reported gap still open, on one requirement (#2580): what the maturity reading caps the requirement for. */\nexport interface OpenReportedGap {\n readonly requirementRef: string;\n /** The task whose latest completed run reported it: an origin, or a follow-up still reporting it. */\n readonly originTaskRef: string;\n readonly missing: string;\n /** The follow-up derived to answer it, not landed yet. Absent when none was derived, or for a follow-up's own report. */\n readonly followUpTaskRef?: string;\n}\n\n/**\n * The reported gaps still OPEN (#2580), pure: a requirement carrying one is partly met, whatever probe found its file.\n *\n * - **A derived follow-up not landed yet**: every gap it carries is open, and names it.\n * - **A gap that derived no follow-up** because its target lands by its own probe or is a generation step: open, with no\n * follow-up, since nothing in the build will answer it. A gap a landed later run STATED met (`MET_SINCE`) is closed.\n * - **A LANDED follow-up whose own latest run still reports a requirement**: open, under the follow-up's ref. A follow-up's\n * report derives nothing further (the chain is one step long), so this is the only place it is still counted.\n *\n * A landed follow-up whose run reports nothing has closed its origin's gaps. Read from the same derivation that appends\n * the follow-ups to the plan, so the reading and the plan cannot disagree about which follow-up answers which gap.\n */\nexport function collectOpenReportedGaps(input: {\n readonly derivation: Pick<FollowUpDerivation, 'followUps' | 'notDerived'>;\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n readonly landedTaskRefs: ReadonlySet<string>;\n}): readonly OpenReportedGap[] {\n const open: OpenReportedGap[] = [];\n for (const followUp of input.derivation.followUps) {\n if (input.landedTaskRefs.has(followUp.task.taskRef)) continue;\n for (const gap of followUp.gaps) {\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing, followUpTaskRef: followUp.task.taskRef });\n }\n }\n for (const gap of input.derivation.notDerived) {\n if (gap.reason === FollowUpGapNotDerivedReason.MET_SINCE) continue;\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing });\n }\n for (const task of input.tasks) {\n if (!task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) || !input.landedTaskRefs.has(task.taskRef)) continue;\n for (const entry of input.latestCompletedRuns.get(task.taskRef)?.unmetRequirements ?? []) {\n open.push({ requirementRef: entry.requirementRef, originTaskRef: task.taskRef, missing: entry.missing });\n }\n }\n return open;\n}\n"]}
1
+ {"version":3,"file":"application-build-follow-up-derivation.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/application-build-follow-up-derivation.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAGjH,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAExG;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,uBAAuB,CAAC;AAY9E;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,wFAAwF;IACxF,4CAAqB,CAAA;IACrB;;;;OAIG;IACH,4CAAqB,CAAA;IACrB,+DAA+D;IAC/D,8CAAuB,CAAA;AACzB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAmE;IAC1G,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IAC9D,CAAC,uBAAuB,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IACtE,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,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as-specifications/application-creation';\n\nimport type { ApplicationCodingMetRequirement, ApplicationCodingUnmetRequirement } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport { resolveBuildTaskLandedProbes } from './application-build-task-coding-policy.companion.service';\n\n/**\n * The ref prefix of a FOLLOW-UP task the host derives when a completed coding run reports a requirement it could not\n * fully meet (#2496): `build-task-follow-up-<origin>-<token>`. A follow-up's own report derives nothing further, so\n * the chain is one step long; what it leaves unmet is shown on its record.\n */\nexport const HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX = 'build-task-follow-up-';\n\n/** What the derivation reads of a task's latest COMPLETED coding run. */\nexport interface FollowUpReportingRun {\n readonly runTaskId: string;\n readonly startedAt: string;\n readonly settledAt?: string;\n readonly unmetRequirements?: readonly ApplicationCodingUnmetRequirement[];\n /** What the run STATED is met, with where (#3227); absent states nothing. */\n readonly metRequirements?: readonly ApplicationCodingMetRequirement[];\n}\n\n/**\n * What a task's TARGET can do about a requirement it reports unmet (#3701), total over {@link BuildPlanTaskTargetKind}: a\n * kind added to the vocabulary does not compile until somebody says whether its follow-up can close a product gap.\n */\nexport enum FollowUpTargetReach {\n /** Its scope builds the product: a follow-up on it can close what the product lacks. */\n DELIVERS = 'DELIVERS',\n /**\n * Its scope PRESENTS the product (the marketing website, the technical documentation): it can describe a feature, and\n * never build one. A follow-up on it can only reword the page, which is how the reference run of 2026-11-10 landed 31\n * follow-ups with the features they reported still missing.\n */\n PRESENTS = 'PRESENTS',\n /** A companion generation step: no coding run ever runs it. */\n GENERATES = 'GENERATES',\n}\n\nexport const BUILD_TARGET_FOLLOW_UP_REACH: Readonly<Record<BuildPlanTaskTargetKind, FollowUpTargetReach>> = {\n [BuildPlanTaskTargetKind.MODULE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RESOURCE_STAGE]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.RELATIONSHIP]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP]: FollowUpTargetReach.GENERATES,\n [BuildPlanTaskTargetKind.SHELL_PLACEMENT]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_FRONTEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MODULE_BACKEND]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.WEBSITE]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION]: FollowUpTargetReach.PRESENTS,\n [BuildPlanTaskTargetKind.WORKER]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.MINION]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.PROVIDER_BINDING]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.BILLING_CATALOG]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.APPLICATION_ROLES]: FollowUpTargetReach.DELIVERS,\n [BuildPlanTaskTargetKind.ORGANIZATION_MODEL]: FollowUpTargetReach.DELIVERS,\n};\n\n/**\n * The skill a follow-up lifted to a whole MODULE carries beside its serving tasks' skills: the MODULE kind's own reason to\n * exist is registering the module in every layer, and that is the skill that teaches it.\n */\nexport const MODULE_FOLLOW_UP_SKILL_REF = 'module-registration';\n\n/**\n * The scope that CLOSES a product gap on one serving task's target (#3701). Every module-scoped kind writes a subset of\n * its module's MODULE scope (the coding policy's own prefixes: a resource stage, a relationship file, a module's frontend\n * or backend layer), and only the MODULE scope reaches the module registries. A gap a presenting task reports can be\n * anywhere in the module, so it goes to the module; an application-wide target closes in its own scope.\n */\nexport function productClosingTarget(target: BuildPlanTask['target']): BuildPlanTask['target'] | undefined {\n switch (target.kind) {\n case BuildPlanTaskTargetKind.MODULE:\n case BuildPlanTaskTargetKind.RESOURCE_STAGE:\n case BuildPlanTaskTargetKind.RELATIONSHIP:\n case BuildPlanTaskTargetKind.MODULE_FRONTEND:\n case BuildPlanTaskTargetKind.MODULE_BACKEND:\n return { kind: BuildPlanTaskTargetKind.MODULE, moduleRef: target.moduleRef } as BuildPlanTask['target'];\n case BuildPlanTaskTargetKind.SHELL_PLACEMENT:\n case BuildPlanTaskTargetKind.APPLICATION_FRONTEND_CONFIG:\n case BuildPlanTaskTargetKind.WORKER:\n case BuildPlanTaskTargetKind.MINION:\n case BuildPlanTaskTargetKind.PROVIDER_BINDING:\n case BuildPlanTaskTargetKind.BILLING_CATALOG:\n case BuildPlanTaskTargetKind.APPLICATION_ROLES:\n case BuildPlanTaskTargetKind.ORGANIZATION_MODEL:\n return target;\n case BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP:\n case BuildPlanTaskTargetKind.WEBSITE:\n case BuildPlanTaskTargetKind.TECHNICAL_DOCUMENTATION:\n return undefined;\n default: {\n const unhandled: never = target;\n throw new Error(`Unhandled build-plan target ${JSON.stringify(unhandled)}.`);\n }\n }\n}\n\n/** Where one reported gap's follow-up runs: its target, the tasks it was derived from, and their skills and topic. */\nexport interface FollowUpClosingScope {\n readonly target: BuildPlanTask['target'];\n /** Empty when the follow-up stays on its origin's target; else the product tasks serving the requirement in this scope. */\n readonly servingTaskRefs: readonly string[];\n readonly skillRefs: readonly string[];\n readonly functionalTopic: BuildPlanTask['functionalTopic'];\n}\n\n/**\n * WHERE a gap one origin reported is closed (#3701), through the decomposer's own mapping from a requirement to the work\n * that delivers it: the plan's `servesRefs`.\n *\n * - An origin whose target DELIVERS the product closes its own gap: one scope, the origin's (unchanged since #2496).\n * - An origin that PRESENTS the product (a website section, a documentation chapter) reported that the product does not\n * do what the page describes. The gap goes to every product task serving the same requirement, lifted to the scope that\n * closes it ({@link productClosingTarget}), one scope per distinct target, in plan order. The reference run's\n * bid-records gap (\"not registered in the backend or frontend module registries\") was reported by a website section and\n * went back to that section; it now goes to the bid-records MODULE.\n * - A presenting origin whose requirement no product task serves is a requirement only pages deliver (a public case\n * study): it stays on the origin's target.\n */\nexport function resolveFollowUpClosingScopes(origin: BuildPlanTask, requirementRef: string, planTasks: readonly BuildPlanTask[]): readonly FollowUpClosingScope[] {\n const own: FollowUpClosingScope = { target: origin.target, servingTaskRefs: [], skillRefs: origin.skillRefs, functionalTopic: origin.functionalTopic };\n if (BUILD_TARGET_FOLLOW_UP_REACH[origin.target.kind] !== FollowUpTargetReach.PRESENTS) return [own];\n const scopes = new Map<string, { target: BuildPlanTask['target']; serving: BuildPlanTask[] }>();\n for (const task of planTasks) {\n if (task.taskRef === origin.taskRef || !task.servesRefs.includes(requirementRef)) continue;\n if (BUILD_TARGET_FOLLOW_UP_REACH[task.target.kind] !== FollowUpTargetReach.DELIVERS) continue;\n const target = productClosingTarget(task.target);\n if (target === undefined) continue;\n const key = targetKey(target);\n const entry = scopes.get(key) ?? { target, serving: [] };\n entry.serving.push(task);\n scopes.set(key, entry);\n }\n if (scopes.size === 0) return [own];\n return [...scopes.values()].map(({ target, serving }) => ({\n target,\n servingTaskRefs: serving.map((task) => task.taskRef),\n skillRefs: [...new Set([...(target.kind === BuildPlanTaskTargetKind.MODULE ? [MODULE_FOLLOW_UP_SKILL_REF] : []), ...serving.flatMap((task) => task.skillRefs)])],\n functionalTopic: serving[0]!.functionalTopic,\n }));\n}\n\n/** One gap one origin's run reported, as a follow-up carries it. */\nexport interface FollowUpGap {\n readonly originTaskRef: string;\n readonly reportingRunTaskId: string;\n readonly requirementRef: string;\n readonly missing: string;\n}\n\n/** A reported gap the derivation did not turn into a follow-up, and why, so the log can say it. */\nexport interface FollowUpGapNotDerived extends FollowUpGap {\n readonly reason: FollowUpGapNotDerivedReason;\n /** For {@link FollowUpGapNotDerivedReason.MET_SINCE}: the run that stated it met, and where. */\n readonly metSince?: Omit<FollowUpGapMetSince, 'gap' | 'followUpTaskRef'>;\n}\n\n/** Why a reported gap derives no follow-up task (#2496). */\nexport enum FollowUpGapNotDerivedReason {\n /** The origin's target lands by its own probe (a shell placement), so a follow-up would read as landed without running. */\n TARGET_LANDS_BY_ITS_OWN_PROBE = 'TARGET_LANDS_BY_ITS_OWN_PROBE',\n /** The origin is a companion generation step, which no coding run ever runs. */\n GENERATION_STEP = 'GENERATION_STEP',\n /**\n * A LANDED later run of another task on the same target, serving the same requirement, STATED it met (#3227): its closing\n * report's `wildo-requirements-met` block names the requirement, with where. Measured on app-creation-test-007: six of\n * eleven follow-ups changed nothing, their workers saying another task had already met the gap, at about 20 minutes of\n * selection and a run each. Only that positive statement drops a gap; silence and a malformed block never do.\n */\n MET_SINCE = 'MET_SINCE',\n}\n\n/** A reported gap a later run states is met (#3227): the candidate a host may drop, once it has checked the run landed. */\nexport interface FollowUpGapMetSince {\n readonly gap: FollowUpGap;\n /** The follow-up the gap would derive: a host keeps the gap when that follow-up was ever attempted (#2530). */\n readonly followUpTaskRef: string;\n /** The task whose run stated it met. */\n readonly metByTaskRef: string;\n /** That run: a host drops the gap only when the run LANDED (everything it wrote is committed). */\n readonly metByRunTaskId: string;\n /** Where the run said it is met. */\n readonly evidence: string;\n}\n\n/** The key one gap is addressed by: its origin, its reporting run and its requirement. */\nexport function followUpGapKey(gap: Pick<FollowUpGap, 'originTaskRef' | 'reportingRunTaskId' | 'requirementRef'>): string {\n return `${gap.originTaskRef}\\u0000${gap.reportingRunTaskId}\\u0000${gap.requirementRef}`;\n}\n\n/** One derived follow-up task, with every gap it answers. */\nexport interface DerivedFollowUp {\n /** The task, chained after the follow-up before it on its target (see {@link chainFollowUpAfter}). */\n readonly task: BuildPlanTask;\n readonly gaps: readonly FollowUpGap[];\n /** Its target's identity: the follow-ups sharing one are chained, in the order their reports settled. */\n readonly targetKey: string;\n}\n\nexport interface FollowUpDerivation {\n readonly followUps: readonly DerivedFollowUp[];\n readonly notDerived: readonly FollowUpGapNotDerived[];\n /** The follow-up that carries one origin's reported requirement, when one does (the website claim delivery asks). */\n followUpTaskRefFor(originTaskRef: string, requirementRef: string): string | undefined;\n /** Whether one origin's reported requirement was dropped because a landed later run stated it met (#3227). */\n gapMetSince(originTaskRef: string, requirementRef: string): boolean;\n}\n\n/**\n * The follow-up ref of ONE origin's ONE reporting run: the origin, then a token of the run, so the same report derives the\n * same task on every read while a later run reporting again derives a NEW task (the old follow-up's completed run must not\n * land the new report at birth). Always a slug the graph schema accepts: an origin ref with no ASCII letter or digit is\n * named by a digest instead, so no agent-written string can make the plan unreadable.\n *\n * The requirement is not part of the ref (#3227): one run reporting two requirements is ONE follow-up. app-creation-test-007\n * ran `…job-config-…-building-customer-lifecycle-3d9049` and `…job-config-…-shared-office-field-customer-context-3d9049`,\n * the same task, from the same run, twice, both changing nothing.\n */\nexport function deriveFollowUpTaskRef(originTaskRef: string, reportingRunTaskId: string): string {\n const slug = (value: string) => value.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');\n const digest = (value: string) => createHash('sha256').update(value).digest('hex');\n const origin = slug(originTaskRef.replace(/^build-task-/u, '')) || `t${digest(originTaskRef).slice(0, 8)}`;\n return `${HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX}${origin}-${digest(reportingRunTaskId).slice(0, 6)}`;\n}\n\n/**\n * A follow-up waiting on its origin and, when there is one, on the follow-up before it on its target. One function, so the\n * dispatch host can re-link a follow-up after one it could not append (a name collision, a schema refusal): a chain\n * naming a task the plan does not hold would make the plan unreadable.\n */\nexport function chainFollowUpAfter(followUp: BuildPlanTask, previousOnTarget: string | undefined): BuildPlanTask {\n const origin = followUp.prerequisiteTaskRefs[0]!;\n return { ...followUp, prerequisiteTaskRefs: previousOnTarget === undefined ? [origin] : [origin, previousOnTarget] };\n}\n\n/** A target's identity: two tasks with equal targets write the same scope (#3227). */\nexport function targetKey(target: BuildPlanTask['target']): string {\n const entries = Object.entries(target as Record<string, unknown>).sort(([left], [right]) => left.localeCompare(right));\n return JSON.stringify(entries);\n}\n\n/**\n * The follow-up tasks the reported gaps derive (#2496, #3227). Pure: the dispatch host supplies the plan and each task's\n * latest completed run.\n *\n * ## One follow-up per reporting run, chained per target\n *\n * - **Every requirement one run reported is folded into one follow-up** (#3227): one scope, one worker, one set of\n * checks, instead of the same task once per requirement.\n * - **Its identity is the origin and the reporting run, and nothing else**, so it is STABLE while that report stands:\n * another task on the same target reporting later derives a NEW follow-up rather than renaming this one. A follow-up\n * the build is running, or has run, therefore never leaves the plan because somebody else reported (#2530); and a\n * completed follow-up is never re-derived with gaps it already answered.\n * - **Follow-ups on one target are chained IN THE ORDER THEIR REPORTS SETTLED** (then by origin ref), each waiting on the\n * one before it: they write one scope, and two of them at once would overwrite each other (the interference that made\n * the wave re-run each alone). Report order rather than plan order, so a new report always joins the TAIL: in plan\n * order, an origin earlier in the plan reporting later went to the head, made a running follow-up wait on it, and was\n * ready at once beside it (review of f077ae7db). A follow-up declares no product, so no interference check could see it.\n *\n * ## A gap a later run STATED met is dropped; silence drops nothing\n *\n * Dropping on ABSENCE was tried and withdrawn (review of 5e3ab7d76): a missing block, a malformed one and a run that never\n * looked at the requirement all read the same, so it closed gaps nobody had closed. The worker contract now carries the\n * positive half, a `wildo-requirements-met` block, and a gap is dropped only when {@link collectFollowUpGapsMetSince} finds\n * a later run that states it and the host confirms that run LANDED and the follow-up was never attempted (`metSince`).\n * Every drop is in `notDerived`, with the run and its evidence, so the host logs it. The follow-up's own worker is still\n * told to read what was built since and change nothing when a gap is met.\n *\n * Unchanged: the chain is one step long (a follow-up's own report derives nothing), and an origin whose target lands by\n * its own probe or is a generation step derives nothing. A follow-up keeps its origin's target and skills, EXCEPT when the\n * origin only presents the product (#3701): its gaps go to the product scopes serving the requirement, see\n * {@link resolveFollowUpClosingScopes}.\n */\nexport function deriveBuildPlanFollowUpTasks(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n /**\n * The gaps a host CONFIRMED met since (#3227), by {@link followUpGapKey}: candidates from\n * {@link collectFollowUpGapsMetSince} whose stating run landed and whose follow-up was never attempted. Absent drops\n * nothing, which is the reading when the host could not check.\n */\n readonly metSince?: ReadonlyMap<string, FollowUpGapMetSince>;\n}): FollowUpDerivation {\n const notDerived: FollowUpGapNotDerived[] = [];\n const reports: { readonly origin: BuildPlanTask; readonly run: FollowUpReportingRun; readonly gaps: readonly FollowUpGap[] }[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n const reported = run?.unmetRequirements ?? [];\n if (run === undefined || reported.length === 0) continue;\n const reportedGaps = reported.map((entry) => ({ originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing }));\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.GENERATION_STEP })));\n continue;\n }\n if (resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) {\n notDerived.push(...reportedGaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.TARGET_LANDS_BY_ITS_OWN_PROBE })));\n continue;\n }\n // A gap a landed later run stated met, as the host confirmed (#3227): dropped, and named.\n const gaps = reportedGaps.filter((gap) => {\n const met = input.metSince?.get(followUpGapKey(gap));\n if (met === undefined) return true;\n notDerived.push({ ...gap, reason: FollowUpGapNotDerivedReason.MET_SINCE, metSince: { metByTaskRef: met.metByTaskRef, metByRunTaskId: met.metByRunTaskId, evidence: met.evidence } });\n return false;\n });\n if (gaps.length === 0) continue;\n reports.push({ origin, run, gaps });\n }\n // Report order: when the reporting run settled (its start when it recorded no settlement), then the origin's ref. A\n // timestamp that does not parse sorts last, never as 1970, so it cannot jump ahead of reports whose time is known.\n const reportedAt = (run: FollowUpReportingRun): number => {\n const at = Date.parse(run.settledAt ?? run.startedAt);\n return Number.isNaN(at) ? Number.POSITIVE_INFINITY : at;\n };\n const byReportedAt = (left: number, right: number): number => (left === right ? 0 : left < right ? -1 : 1);\n reports.sort((left, right) => byReportedAt(reportedAt(left.run), reportedAt(right.run)) || left.origin.taskRef.localeCompare(right.origin.taskRef));\n\n const followUps: DerivedFollowUp[] = [];\n const refByOriginRequirement = new Map<string, string>();\n const previousOnTarget = new Map<string, string>();\n for (const { origin, run, gaps } of reports) {\n /*\n * One follow-up per CLOSING SCOPE of this report (#3701): the origin's own, unless the origin only presents the product,\n * in which case each product scope serving a reported requirement gets the gaps it can close. A routed follow-up's ref\n * adds its scope to the run's token, so the same report keeps deriving the same tasks.\n */\n const byScope = new Map<string, { scope: FollowUpClosingScope; gaps: FollowUpGap[] }>();\n for (const gap of gaps) {\n for (const scope of resolveFollowUpClosingScopes(origin, gap.requirementRef, planTasks)) {\n const key = targetKey(scope.target);\n const entry = byScope.get(key) ?? { scope, gaps: [] };\n entry.gaps.push(gap);\n byScope.set(key, entry);\n }\n }\n for (const [key, { scope, gaps: scopeGaps }] of byScope) {\n const routed = scope.servingTaskRefs.length > 0;\n const taskRef = routed ? deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${key}`) : deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n const previous = previousOnTarget.get(key);\n previousOnTarget.set(key, taskRef);\n const requirementRefs = [...new Set(scopeGaps.map((gap) => gap.requirementRef))];\n const servingTasks = [...new Set(planTasks\n .filter((task) => task.taskRef !== origin.taskRef && requirementRefs.some((ref) => task.servesRefs.includes(ref)))\n .map((task) => task.taskRef))];\n const task = chainFollowUpAfter({\n taskRef,\n objective: (routed\n ? `${origin.taskRef} presents the product and reported that the product does not yet deliver: `\n + scopeGaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ')\n + ` Build what is missing in this scope, where ${scope.servingTaskRefs.join(', ')} built the requirement; a page cannot. `\n + 'If what is missing lies outside this scope, change nothing and report it. '\n : `Meet what ${origin.taskRef} reported still unmet: `\n + scopeGaps.map((gap) => `${gap.requirementRef}: ${gap.missing}`).join(' ') + ' ')\n + 'Read what is already built first: if a task that ran since has met one, change nothing for it and say so. '\n + (servingTasks.length > 0 ? `Other tasks serving them: ${servingTasks.join(', ')}; their work is theirs. ` : '')\n + 'Derived by the dispatch host from that run\\'s closing report.',\n target: scope.target,\n produces: [],\n functionalTopic: scope.functionalTopic,\n skillRefs: [...scope.skillRefs],\n // The origin FIRST (`followUpOf` reads it); the follow-up before it on the same target is added by the chain.\n prerequisiteTaskRefs: [origin.taskRef],\n // Only refs the origin serves: a free-text ref would be a dangling citation in the plan.\n servesRefs: requirementRefs.filter((ref) => origin.servesRefs.includes(ref)),\n } as BuildPlanTask, previous);\n followUps.push({ task, gaps: scopeGaps, targetKey: key });\n for (const gap of scopeGaps) {\n const originRequirement = `${gap.originTaskRef}\\u0000${gap.requirementRef}`;\n if (!refByOriginRequirement.has(originRequirement)) refByOriginRequirement.set(originRequirement, taskRef);\n }\n }\n }\n return {\n followUps,\n notDerived,\n followUpTaskRefFor: (originTaskRef, requirementRef) => refByOriginRequirement.get(`${originTaskRef}\\u0000${requirementRef}`),\n gapMetSince: (originTaskRef, requirementRef) => notDerived.some((gap) => gap.reason === FollowUpGapNotDerivedReason.MET_SINCE\n && gap.originTaskRef === originTaskRef && gap.requirementRef === requirementRef),\n };\n}\n\n/**\n * The reported gaps a LATER run states met (#3227), pure: the candidates a host may drop. For each gap an eligible origin\n * reported (one the derivation would turn into a follow-up), the first other task that\n *\n * - writes the SAME target (two tasks with equal targets write the same scope, so its statement is about the same surface),\n * - serves the same requirement,\n * - completed a run that STARTED after the reporting run settled (it read the tree the report described, or a later one),\n * - and whose run's `wildo-requirements-met` block names the requirement and its unmet block does not.\n *\n * EVERY such task is a candidate, in plan order, so a statement whose run has not landed does not hide one that has. A\n * gap's own follow-up is never its verifier: once it has run, it is attempted and keeps the gap anyway. The host must\n * still confirm that the stating run LANDED and that the follow-up was never attempted before it passes a candidate on as\n * `metSince`; this function only finds who said so.\n */\nexport function collectFollowUpGapsMetSince(input: {\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n}): readonly FollowUpGapMetSince[] {\n const candidates: FollowUpGapMetSince[] = [];\n const planTasks = input.tasks.filter((task) => !task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX));\n for (const origin of planTasks) {\n const run = input.latestCompletedRuns.get(origin.taskRef);\n if (run === undefined || (run.unmetRequirements ?? []).length === 0) continue;\n if (origin.target.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP || resolveBuildTaskLandedProbes({ ...origin, produces: [] }).length > 0) continue;\n const reportedAt = Date.parse(run.settledAt ?? run.startedAt);\n if (Number.isNaN(reportedAt)) continue;\n const followUpTaskRef = deriveFollowUpTaskRef(origin.taskRef, run.runTaskId);\n for (const entry of run.unmetRequirements ?? []) {\n /*\n * A statement counts from a task writing a scope that CLOSES the gap (#3701): the origin's own, or for a presenting\n * origin the product scopes its gap is routed to, where a task's target is read through the same lift.\n */\n const scopes = resolveFollowUpClosingScopes(origin, entry.requirementRef, planTasks);\n const closingKeys = new Set(scopes.map((scope) => targetKey(scope.target)));\n const routedRefs = new Set(scopes.filter((scope) => scope.servingTaskRefs.length > 0)\n .map((scope) => deriveFollowUpTaskRef(origin.taskRef, `${run.runTaskId}\\u0000${targetKey(scope.target)}`)));\n const routed = routedRefs.size > 0;\n for (const task of input.tasks) {\n if (task.taskRef === origin.taskRef || task.taskRef === followUpTaskRef || routedRefs.has(task.taskRef)) continue;\n const taskScope = routed ? productClosingTarget(task.target) : task.target;\n if (taskScope === undefined || !closingKeys.has(targetKey(taskScope)) || !task.servesRefs.includes(entry.requirementRef)) continue;\n const later = input.latestCompletedRuns.get(task.taskRef);\n if (later === undefined || !(Date.parse(later.startedAt) > reportedAt)) continue;\n if ((later.unmetRequirements ?? []).some((unmet) => unmet.requirementRef === entry.requirementRef)) continue;\n const met = (later.metRequirements ?? []).find((statement) => statement.requirementRef === entry.requirementRef);\n if (met === undefined) continue;\n candidates.push({\n gap: { originTaskRef: origin.taskRef, reportingRunTaskId: run.runTaskId, requirementRef: entry.requirementRef, missing: entry.missing },\n // A routed gap's first follow-up (#3701): the host keeps the gap when it was ever attempted.\n followUpTaskRef: routed ? [...routedRefs][0]! : followUpTaskRef,\n metByTaskRef: task.taskRef,\n metByRunTaskId: later.runTaskId,\n evidence: met.evidence,\n });\n }\n }\n }\n return candidates;\n}\n\n/** One reported gap still open, on one requirement (#2580): what the maturity reading caps the requirement for. */\nexport interface OpenReportedGap {\n readonly requirementRef: string;\n /** The task whose latest completed run reported it: an origin, or a follow-up still reporting it. */\n readonly originTaskRef: string;\n readonly missing: string;\n /** The follow-up derived to answer it, not landed yet. Absent when none was derived, or for a follow-up's own report. */\n readonly followUpTaskRef?: string;\n}\n\n/**\n * The reported gaps still OPEN (#2580), pure: a requirement carrying one is partly met, whatever probe found its file.\n *\n * - **A derived follow-up not landed yet**: every gap it carries is open, and names it.\n * - **A gap that derived no follow-up** because its target lands by its own probe or is a generation step: open, with no\n * follow-up, since nothing in the build will answer it. A gap a landed later run STATED met (`MET_SINCE`) is closed.\n * - **A LANDED follow-up whose own latest run still reports a requirement**: open, under the follow-up's ref. A follow-up's\n * report derives nothing further (the chain is one step long), so this is the only place it is still counted.\n *\n * A landed follow-up whose run reports nothing has closed its origin's gaps. Read from the same derivation that appends\n * the follow-ups to the plan, so the reading and the plan cannot disagree about which follow-up answers which gap.\n */\nexport function collectOpenReportedGaps(input: {\n readonly derivation: Pick<FollowUpDerivation, 'followUps' | 'notDerived'>;\n readonly tasks: readonly BuildPlanTask[];\n readonly latestCompletedRuns: ReadonlyMap<string, FollowUpReportingRun>;\n readonly landedTaskRefs: ReadonlySet<string>;\n}): readonly OpenReportedGap[] {\n const open: OpenReportedGap[] = [];\n for (const followUp of input.derivation.followUps) {\n if (input.landedTaskRefs.has(followUp.task.taskRef)) continue;\n for (const gap of followUp.gaps) {\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing, followUpTaskRef: followUp.task.taskRef });\n }\n }\n for (const gap of input.derivation.notDerived) {\n if (gap.reason === FollowUpGapNotDerivedReason.MET_SINCE) continue;\n open.push({ requirementRef: gap.requirementRef, originTaskRef: gap.originTaskRef, missing: gap.missing });\n }\n for (const task of input.tasks) {\n if (!task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) || !input.landedTaskRefs.has(task.taskRef)) continue;\n for (const entry of input.latestCompletedRuns.get(task.taskRef)?.unmetRequirements ?? []) {\n open.push({ requirementRef: entry.requirementRef, originTaskRef: task.taskRef, missing: entry.missing });\n }\n }\n return open;\n}\n"]}
@@ -223,6 +223,57 @@ export declare enum GenerationStepWriteScope {
223
223
  }
224
224
  /** Total over the steps, so a step added tomorrow does not compile until somebody says what it may write. */
225
225
  export declare const GENERATION_STEP_WRITE_SCOPE: Readonly<Record<ApplicationBuildGenerationStep, GenerationStepWriteScope>>;
226
+ /**
227
+ * What a generation step READS in the application's tree (#3709): the roots (a directory with its trailing slash, or one
228
+ * file) whose change may change what the step produces. A step held for having run on unchanged inputs (#3233) or for
229
+ * failing the same way twice (#3709) is released by a commit or an edit under one of these, and by nothing else, so a
230
+ * sibling's frontend view no longer releases the documentation publication.
231
+ *
232
+ * GENEROUS on purpose, because the two errors cost differently. A root listed here that the step does not read costs one
233
+ * more run after an unrelated change. A root it reads and that is missing here holds the step over a change that could
234
+ * have fixed it, until somebody runs it by name or re-arms it. So a root is left out only when the step's pipeline
235
+ * plainly never opens it.
236
+ *
237
+ * Never the whole story: what a step reads outside the application (the engine's own examples and label keys, the
238
+ * platform's templates) is no path in this tree. A failure caused there names that owner instead
239
+ * (`GenerationStepFailureOwner`), and a person releases the step once it is fixed.
240
+ *
241
+ * Total over the steps, so a step added tomorrow does not compile until somebody says what it reads.
242
+ * `I18N_TRANSLATIONS` is the one DERIVED entry (`undefined` here): it reads the primary locale's label units, which
243
+ * {@link ApplicationBuildGenerationStepCompanionService.resolveGenerationStepReadRoots} reads off the labels step's own
244
+ * evidence, so the two cannot name different trees.
245
+ */
246
+ export declare const GENERATION_STEP_READ_ROOTS: Readonly<Record<ApplicationBuildGenerationStep, readonly string[] | undefined>>;
247
+ /**
248
+ * WHO can fix a generation step's failure (#3709): the application, or the framework it is built on. Recorded on the failed
249
+ * run's row, so the dispatch can refuse by name rather than spend attempts on a cause no change in the application reaches.
250
+ *
251
+ * Classified POSITIVELY only ({@link classifyGenerationStepFailureOwner}): a failure the step cannot attribute carries no
252
+ * owner and is treated as before. "Application" is never inferred from the absence of a framework cause.
253
+ *
254
+ * Measured on reference run 42886943490: `build-task-documentation-publication` failed 21 times on OpenAPI examples the
255
+ * engine's own resource specifications author, fixed in the engine (446014e0f). No run of the application could have.
256
+ */
257
+ export declare enum GenerationStepFailureOwner {
258
+ /** The cause is in what the application authored; a change in its tree can fix it. */
259
+ APPLICATION = "application",
260
+ /** The cause is in the framework (an engine package, the platform); only a framework change, then a re-run, fixes it. */
261
+ FRAMEWORK = "framework"
262
+ }
263
+ /** The owner a generation step's failure was classified with, or `undefined` when it was not (or is not an object). */
264
+ export declare function readGenerationStepFailureOwner(error: unknown): GenerationStepFailureOwner | undefined;
265
+ /**
266
+ * Who owns a generation step's failure, or `undefined` when the step cannot tell (#3709).
267
+ *
268
+ * The documentation publication refuses with `OpenApiAuthoredExampleError` when an authored example is untrue of its
269
+ * schema, and each finding names its operation's resource. An example of an engine resource (`CoreResourceType`) is
270
+ * authored in the engine's resource specification, so a refusal whose findings are ALL on engine resources is the
271
+ * framework's; one naming any application resource is the application's (its finding is one the application fixes).
272
+ * A finding with no resource leaves the failure unclassified.
273
+ *
274
+ * Every other step and failure is unclassified until a cause is measured and given a rule here, rather than guessed.
275
+ */
276
+ export declare function classifyGenerationStepFailureOwner(generationStepRef: string, error: unknown): GenerationStepFailureOwner | undefined;
226
277
  /**
227
278
  * How a generation step proves it did its work.
228
279
  *
@@ -660,6 +711,13 @@ export declare class ApplicationBuildGenerationStepCompanionService {
660
711
  * `resolveGenerationStepEvidencePaths` already throws `ApplicationBuildUnknownGenerationStepError` for one.
661
712
  */
662
713
  resolveGenerationStepWritableRoots(task: BuildPlanTask): Promise<readonly string[]>;
714
+ /**
715
+ * What this task's generation step reads in the application's tree ({@link GENERATION_STEP_READ_ROOTS}, #3709), or
716
+ * `undefined` for a step ref the vocabulary does not know: the caller then reads every path outside the step's write
717
+ * scope as an input, the rule before #3709, rather than holding a step on a guess. Translations read the primary
718
+ * locale's label units, taken from the labels step's own evidence, and the configuration's locale set.
719
+ */
720
+ resolveGenerationStepReadRoots(task: BuildPlanTask): Promise<readonly string[] | undefined>;
663
721
  /**
664
722
  * How this task proves it landed — the ONLY landed authority for a generation step.
665
723
  *