@wildo-ai/dev-companion 1.1.15 → 1.1.16

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 (96) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +165 -5
  3. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  4. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +239 -8
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +2 -1
  7. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +2 -1
  9. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  10. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts +68 -0
  11. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts.map +1 -0
  12. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js +198 -0
  13. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js.map +1 -0
  14. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts +138 -0
  15. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts.map +1 -0
  16. package/dist/esm/claude-cli/models/workspace-path-claims.models.js +204 -0
  17. package/dist/esm/claude-cli/models/workspace-path-claims.models.js.map +1 -0
  18. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +20 -0
  19. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  20. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +27 -12
  21. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  22. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +155 -3
  23. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  24. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +791 -151
  25. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  26. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  27. package/dist/esm/companion-api/controllers/companion.controller.js +7 -1
  28. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  29. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +1 -1
  30. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  31. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts +13 -0
  32. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts.map +1 -1
  33. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js +98 -16
  34. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js.map +1 -1
  35. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts +21 -1
  36. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  37. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +35 -3
  38. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  39. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts +62 -0
  40. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts.map +1 -0
  41. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js +62 -0
  42. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js.map +1 -0
  43. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts +62 -0
  44. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts.map +1 -0
  45. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js +62 -0
  46. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js.map +1 -0
  47. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +1 -1
  48. package/dist/esm/i18n/system_enums/workbench-build.en.js +1 -1
  49. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  50. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts +23 -0
  51. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts.map +1 -1
  52. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js +14 -0
  53. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js.map +1 -1
  54. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +12 -1
  55. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
  56. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +99 -1
  57. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
  58. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +5 -0
  59. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -1
  60. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +22 -1
  61. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -1
  62. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +67 -20
  63. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  64. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +344 -76
  65. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  66. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  67. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +9 -0
  68. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  69. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +47 -1
  70. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  71. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +98 -9
  72. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  73. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +38 -2
  74. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  75. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +176 -22
  76. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  77. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +45 -0
  78. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
  79. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +74 -0
  80. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
  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 +9 -1
  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 +64 -5
  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 +139 -14
  87. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  88. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts +19 -1
  89. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts.map +1 -1
  90. package/dist/esm/meta-workflows/services/website-demo-facts.models.js +7 -5
  91. package/dist/esm/meta-workflows/services/website-demo-facts.models.js.map +1 -1
  92. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts +2 -0
  93. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts.map +1 -1
  94. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js +3 -1
  95. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js.map +1 -1
  96. package/package.json +17 -17
@@ -14,13 +14,13 @@ import { MetaWorkflow_ContextSourceScreeningOutcome, MetaWorkflow_ContextSourceT
14
14
  import { readCompiledResearchInformedContent } from '@wildo-ai/framework-knowledge';
15
15
  import { existsSync, readdirSync } from 'node:fs';
16
16
  import { randomUUID } from 'node:crypto';
17
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
17
+ import { mkdir, readFile, stat, writeFile } from 'node:fs/promises';
18
18
  import path, { join } from 'node:path';
19
19
  import { inject, injectable, optional } from 'inversify';
20
20
  import { AvailableLanguage } from '@wildo-ai/presets-components-models';
21
21
  import { ApplicationSchemaPlanObligation } from '../../core/config/application-schema-plan-obligation.companion.utils.js';
22
22
  import { experienceTaskSkillRefs, taskHasExperienceProduct } from './application-build-experience-skills.companion.service.js';
23
- import { buildWebsitePlanContextSource, citedRequirementRefsByWebsiteTask, deliveringTasksFor, deriveWebsiteClaimDelivery, deriveWebsiteTaskOrdering, describeWebsiteTaskCopySubjects, describeWebsiteTaskVisualSubjects, websiteTaskDemoResourceRef, websiteTaskSkillRefs, } from './application-build-website-context.companion.service.js';
23
+ import { buildWebsitePlanContextSource, citedRequirementRefsByWebsiteTask, deriveWebsiteClaimDelivery, deriveWebsiteClaimPrerequisites, deriveWebsiteTaskOrdering, describeWebsiteTaskCopySubjects, describeWebsiteTaskVisualSubjects, websiteTaskDemoResourceRef, websiteTaskSkillRefs, } from './application-build-website-context.companion.service.js';
24
24
  import { websiteDemoResourceFacts } from './website-demo-facts.models.js';
25
25
  import { collectWebsiteCopyDeclarations, currentWebsiteCopy, reviewWebsiteTaskCopy, } from './application-build-website-copy-review.companion.service.js';
26
26
  import { readWebsiteCopyReview, WebsiteCopyReviewOutcome } from '../models/website-copy-review.models.js';
@@ -34,7 +34,7 @@ import { assemblyRepairTaskRef, composeAssemblyRepairCodingContract, composeBuil
34
34
  import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
35
35
  import { Actor_Task_Topics, FlowsActors_Status } from '@wildo-ai/saas-models';
36
36
  import { PER_SERVICE_WEBSITE_CONFIG_FILE_NAME, resolveStaticWebsiteServiceEntry } from '@wildo-ai/saas-website/config-loader';
37
- import { AcceptOrigin, ApplicationSpecificationFamily, BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, FrontendConfigSurface, DomainPlanTenancyModel, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, PlacementSurface, RoadmapSnapshotSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
37
+ import { AcceptOrigin, ApplicationSpecificationFamily, BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, FrontendConfigSurface, DomainPlanTenancyModel, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, PlacementSubjectKind, PlacementSurface, RoadmapSnapshotSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
38
38
  import { TARGET_NEIGHBOURHOOD_NOTE, neighbourhoodForCodingBrief, relatedWorkspaceResources } from '../../core/introspection/workspace-element-index.companion.js';
39
39
  import { BRIEF_INCOMPLETE_SOURCE_REF, BRIEF_PROVENANCE_UNAVAILABLE_SOURCE_REF, ThirdPartyBriefContent } from '../models/build-brief-content-trust.models.js';
40
40
  import { companionScreeningVerdicts, DERIVED_TEXT_UNSCREENED_NOTICE, DERIVED_TEXT_UNSCREENED_SOURCE_REF, screenRunOutputSection, screenThirdPartyBriefElements, unscreenedClassifierReason, WITHHELD_RUN_OUTPUT_NOTICE, } from './build-brief-third-party-screening.companion.js';
@@ -50,7 +50,7 @@ import { companionRestartDrain } from '../../core/runtime/restart-drain.companio
50
50
  import { getWorkspaceMutationLockPath, loadConfig, loadInfraEnvConfig, loadSaasConfig, readBuildParallelism, WildoEnvironment, withDedicatedFileLock } from '@wildo-ai/platform-config-lib';
51
51
  import { CodingRunConcurrency, failedVerificationBesideSiblings } from '../../claude-cli/models/concurrent-coding-runs.models.js';
52
52
  import { CodingAgentDispatchCompanionService, } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
53
- import { ApplicationCodingTaskDisposition, ChangeSetFileChangeKind, CodingRunStart, deriveCodingRunStart, isApplicationCodingContractRefusal, readSettledRunFailureMessage, SETTLED_HEAD_OUTPUT_FIELD, } from '../../claude-cli/models/coding-agent-dispatch.models.js';
53
+ import { ApplicationCodingTaskDisposition, BUILD_TASK_SELF_DESCRIPTION_SOURCE_REF, ChangeSetFileChangeKind, CodingRunStart, deriveCodingRunStart, isApplicationCodingContractRefusal, readSettledRunFailureMessage, SETTLED_HEAD_OUTPUT_FIELD, } from '../../claude-cli/models/coding-agent-dispatch.models.js';
54
54
  import { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service.js';
55
55
  import { readIsolatedVerificationRecheck } from '../../claude-cli/models/shared-tree-reconciliation.models.js';
56
56
  import { composeLandingSourceKey, LandingProjectionCache } from './application-build-landing-projection.companion.js';
@@ -64,13 +64,14 @@ import { CompanionExecutionsCompanionService } from '../../executions/services/c
64
64
  import { CompanionCreateActorExecutionRequestSchema, CompanionCreateActorTaskRequestSchema, CompanionExecutionsListQuerySchema, CompanionUpdateActorTaskRequestSchema } from '../../companion-api/companion-api.schemas.js';
65
65
  import { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions.js';
66
66
  import { isApplicationStartupFailure, readApplicationBootFailures, readUnavailableApplicationRuntimes, } from '../../core/runtime/application-runtime-liveness.companion.js';
67
+ import { CarriedVerificationReason } from '../models/carried-verification-failure.models.js';
67
68
  import { MAXIMUM_INTERFERENCE_REARMS, NothingToRearmError, readBuildTaskInterference, landedOverrideContextSource, readBuildTaskLandedOverride, readBuildTaskRearm, withBuildTaskRearm, } from '../models/build-task-rearm.models.js';
68
69
  import { APPLICATION_BUILD_GENERATION_STEP_ACTOR_REF, APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions.js';
69
70
  import { APPLICATION_BUILD_DECISIONS_DOOR_ACTOR_REF, APPLICATION_BUILD_DECISIONS_SYSTEM_REF } from '../models/application-build-decisions.actors-system.definitions.js';
70
71
  import { readRecordedPlaybookSpend } from '../models/playbook-run-record.models.js';
71
72
  import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, readDesignSystemConfigImportsBrandDesign, signSchemaPlanInputs, generationStepCheckReadsSpecifications, generationStepReadsSpecifications, GenerationStepFailureOwner, readGenerationStepFailureOwner, } from './application-build-generation-step.companion.service.js';
72
73
  import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, SKILL_INDEX_BRIEF_SOURCE_REF, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
73
- import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
74
+ import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, resolveBuildPlanTaskExpectedWriteScope, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, customViewComponentRealisesPlannedView, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
74
75
  import { describeStaleFrontendLibrary, findStaleFrontendLibraryOutputs, readFrontendLibraryProgram } from './frontend-config-library-currency.companion.js';
75
76
  import { buildTaskDecisionsApplicationPath } from '../models/build-task-decisions-path.models.js';
76
77
  import { BuildTaskDecisionRefusedError, BuildTaskDecisionsStanding, resolveHonouredDecisionsBlob, followUpAwaitsReview, followUpsAwaitReviewUnder, parseBuildTaskDecisions, resolveClosedBuildTaskRefs, withBuildTaskDecision, } from './application-build-task-closure.companion.js';
@@ -446,6 +447,15 @@ export function projectBuildTaskAttempt(execution) {
446
447
  const carriedFailures = Array.isArray(output?.carriedVerificationDiagnoses)
447
448
  ? output.carriedVerificationDiagnoses.filter((entry) => typeof entry?.checkRef === 'string')
448
449
  : [];
450
+ const applicationFindings = Array.isArray(output?.applicationVerificationFindings)
451
+ ? output.applicationVerificationFindings
452
+ .filter((entry) => typeof entry?.checkRef === 'string' && typeof entry.finding === 'string')
453
+ .map((entry) => ({
454
+ checkRef: entry.checkRef,
455
+ finding: entry.finding,
456
+ writtenByTaskRefs: Array.isArray(entry.writtenByTaskRefs) ? entry.writtenByTaskRefs.map(String) : [],
457
+ }))
458
+ : [];
449
459
  const verification = Array.isArray(output?.verification)
450
460
  ? output.verification.filter((entry) => typeof entry?.checkRef === 'string')
451
461
  : [];
@@ -486,6 +496,7 @@ export function projectBuildTaskAttempt(execution) {
486
496
  ...(isolatedRecheck ? { isolatedRecheckPassed: isolatedRecheck.passed } : {}),
487
497
  ...(landedOverride ? { landedOverride } : {}),
488
498
  ...(carriedFailures.length > 0 ? { carriedFailures } : {}),
499
+ ...(applicationFindings.length > 0 ? { applicationFindings } : {}),
489
500
  ...(passedCheckRefs.length > 0 ? { passedCheckRefs } : {}),
490
501
  ...(typeof cost?.amount === 'number' && typeof cost.currency === 'string' ? { cost: { amount: cost.amount, currency: cost.currency } } : {}),
491
502
  ...(tokens ? { tokens } : {}),
@@ -656,7 +667,29 @@ export function deriveRepairsOwed(attemptsByTask) {
656
667
  for (const attempt of attempts) {
657
668
  for (const checkRef of attempt.passedCheckRefs ?? [])
658
669
  passes.push({ checkRef, at: attempt.startedAt });
659
- for (const carried of attempt.carriedFailures ?? []) {
670
+ /*
671
+ * A check charged for the run's own finding that ALSO met findings another writer caused (#3881 review F5): those are
672
+ * owed a repair too, with a diagnosis stating them, since nothing carried the check.
673
+ */
674
+ const carriedRefs = new Set((attempt.carriedFailures ?? []).map((carried) => carried.checkRef));
675
+ const chargedApplicationFindings = new Map();
676
+ for (const finding of attempt.applicationFindings ?? []) {
677
+ if (!carriedRefs.has(finding.checkRef))
678
+ chargedApplicationFindings.set(finding.checkRef, [...(chargedApplicationFindings.get(finding.checkRef) ?? []), finding]);
679
+ }
680
+ const owed = [
681
+ ...(attempt.carriedFailures ?? []),
682
+ ...[...chargedApplicationFindings].map(([checkRef, findings]) => ({
683
+ checkRef,
684
+ message: `findings about the application another writer caused: ${findings.map(({ finding }) => finding).join(' | ')}`,
685
+ outputTail: '',
686
+ offendingPaths: [],
687
+ producers: [],
688
+ carriedBecause: CarriedVerificationReason.FINDINGS_ANOTHER_WRITER_CAUSED,
689
+ applicationFindings: findings.map(({ finding, writtenByTaskRefs }) => ({ finding, writtenByTaskRefs })),
690
+ })),
691
+ ];
692
+ for (const carried of owed) {
660
693
  const entry = byCheck.get(carried.checkRef);
661
694
  if (entry === undefined) {
662
695
  byCheck.set(carried.checkRef, { firstSeenAt: attempt.startedAt, lastSeenAt: attempt.startedAt, affected: new Set([taskRef]), diagnosis: carried });
@@ -705,6 +738,23 @@ const CONCURRENT_ADMISSION_COMPILE_QUIET_MS = 30_000;
705
738
  function buildTaskProductWritePaths(task) {
706
739
  return resolveBuildTaskLandedProbes(task).flatMap((probe) => buildPlanTaskLandedProbeWritablePaths(probe));
707
740
  }
741
+ /**
742
+ * When an uncommitted path of the application last changed (#3933): its own modification time, or, when it is gone (a
743
+ * deletion, a rename's origin), the modification time of its nearest existing directory, which the removal updated.
744
+ * Never looks above the application root; `undefined` when nothing there can be read.
745
+ */
746
+ async function lastChangedAtMs(saasRoot, relativePath) {
747
+ const segments = relativePath.split('/').filter((segment) => segment.length > 0);
748
+ for (let depth = segments.length; depth >= 0; depth -= 1) {
749
+ try {
750
+ return (await stat(join(saasRoot, ...segments.slice(0, depth)))).mtimeMs;
751
+ }
752
+ catch {
753
+ // Gone: its directory's change time is the removal's.
754
+ }
755
+ }
756
+ return undefined;
757
+ }
708
758
  /** Whether two write sets may touch one file: an equal path, or a path under the other's directory. */
709
759
  export function productWritePathsMeet(left, right) {
710
760
  const covers = (path, other) => path === other || (path.endsWith('/') && other.startsWith(path));
@@ -717,8 +767,9 @@ export function productWritePathsMeet(left, right) {
717
767
  * a yield when a playbook the wave holds back needs the turn (`YIELD_REQUESTED`, honoured from
718
768
  * {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE}), and a held restart stops the filling on its own (`RESTART_PENDING`).
719
769
  *
720
- * Not higher (review M2), for two costs that grow with a wave: a run that failed its checks beside its siblings waits for
721
- * the wave's END to be re-checked alone (`AWAITING_ISOLATED_RECHECK`), its dependents with it; and every dispatch entry of
770
+ * Not higher (review M2), for two costs that grow with a wave: a run that failed its checks beside its siblings may wait
771
+ * until the wave's END to be re-checked alone (`AWAITING_ISOLATED_RECHECK`), its dependents with it, when a live run keeps
772
+ * writing what its checks read (#3998 re-checks it earlier otherwise); and every dispatch entry of
722
773
  * the wave's result carries the plan's ready and landed lists. Raised from 4 to 8 with #3204, and to 16 with #3884.
723
774
  */
724
775
  export const WAVE_DISPATCHES_PER_DEGREE = 16;
@@ -2594,18 +2645,49 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2594
2645
  readStaleExpertChartersHold() {
2595
2646
  return [...this.staleExpertChartersHeld.values()];
2596
2647
  }
2597
- /** The staffing step derived the charters again (#3204): every held step is offered again. */
2598
- releaseStaleExpertChartersHold(why) {
2599
- if (this.staleExpertChartersHeld.size === 0)
2648
+ /**
2649
+ * The staffing step derived the charters again (#3204): the held steps are offered again. With `repaired`, only the holds
2650
+ * that staffing run read when it started (#4022): it runs beside the build now, so a step held while it ran was refused
2651
+ * on charters it may not have derived. That step stays held until a staffing run that read its hold releases it, or
2652
+ * until the charters are committed after its refusal ({@link staleExpertChartersCommittedSince}, read by the selector);
2653
+ * released that way early, it is refused again if still stale, and the new hold starts another staffing run. Without
2654
+ * `repaired`, every hold.
2655
+ */
2656
+ releaseStaleExpertChartersHold(why, repaired) {
2657
+ const released = repaired === undefined
2658
+ ? [...this.staleExpertChartersHeld.keys()]
2659
+ : repaired.filter((held) => this.staleExpertChartersHeld.get(held.taskRef)?.observedAt === held.observedAt).map((held) => held.taskRef);
2660
+ if (released.length === 0)
2600
2661
  return;
2601
- this.logger.info?.('Generation steps held on stale expert charters are offered again', { taskRefs: [...this.staleExpertChartersHeld.keys()], why });
2602
- this.staleExpertChartersHeld.clear();
2662
+ this.logger.info?.('Generation steps held on stale expert charters are offered again', { taskRefs: released, why });
2663
+ for (const taskRef of released)
2664
+ this.staleExpertChartersHeld.delete(taskRef);
2603
2665
  }
2666
+ /**
2667
+ * Called each time a generation step is held on stale expert charters (#4022), so the build-dispatch step can start the
2668
+ * staffing run the moment the hold is set, beside the wave, instead of after the wave has drained. Returns the
2669
+ * unsubscribe. A listener that throws is logged and never fails the hold.
2670
+ */
2671
+ onStaleExpertChartersHeld(listener) {
2672
+ const listeners = this.staleExpertChartersHoldListeners ??= new Set();
2673
+ listeners.add(listener);
2674
+ return () => { listeners.delete(listener); };
2675
+ }
2676
+ /** Created by the first subscription, so a service built without its constructor (a test) holds the same way. */
2677
+ staleExpertChartersHoldListeners;
2604
2678
  holdForStaleExpertCharters(taskRef, refusal) {
2605
2679
  this.staleExpertChartersHeld.set(taskRef, { ...refusal, taskRef, observedAt: new Date().toISOString() });
2606
2680
  this.logger.warn?.('A generation step\'s panel refused stale expert charters; the step is held and the rest of the plan proceeds', {
2607
2681
  taskRef, seats: refusal.staleSeats.map((seat) => seat.roleRef),
2608
2682
  });
2683
+ for (const listener of this.staleExpertChartersHoldListeners ?? []) {
2684
+ try {
2685
+ listener();
2686
+ }
2687
+ catch (error) {
2688
+ this.logger.warn?.('A listener for stale-charter holds failed; the hold stands', { taskRef, error: describeCaughtError(error) });
2689
+ }
2690
+ }
2609
2691
  }
2610
2692
  /**
2611
2693
  * Whether a held step's charters were committed since its refusal (#3204), which releases it: the staffing step landed
@@ -2825,6 +2907,31 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2825
2907
  const reservations = new Map();
2826
2908
  // The task each admitted run builds, so its reservation is released when the run settles.
2827
2909
  const reservedTaskOfRun = new Map();
2910
+ /*
2911
+ * Where each live run of the wave is expected to write (#3998), by run: what a failed sibling's isolated re-check asks
2912
+ * before running beside it. A run absent here (a repair, a task whose scope could not be derived) holds every re-check.
2913
+ * Passed LIVE to the re-check, so a run admitted while it runs is known by the time it is asked about.
2914
+ */
2915
+ const expectedWriteScopeOfRun = new Map();
2916
+ /*
2917
+ * The wave's runs that failed their checks and may be owed an isolated re-check (#3998), asked after every settlement
2918
+ * instead of only at the wave's end. The dispatch decides which are owed one (failed beside siblings, none recorded),
2919
+ * and which may run beside the runs still live; one it does not re-check now stays here for the next settlement.
2920
+ */
2921
+ const awaitingRecheckRunIds = new Set();
2922
+ let earlyRecheck;
2923
+ // The settlements counted when the batch in flight started (review F2): one that settles DURING it is asked about after it.
2924
+ let settlementsAtEarlyRecheck = 0;
2925
+ const startEarlyRechecks = () => {
2926
+ if (earlyRecheck !== undefined || awaitingRecheckRunIds.size === 0 || typeof this.dispatch.recheckIsolatedBesideLiveRuns !== 'function')
2927
+ return;
2928
+ settlementsAtEarlyRecheck = settlements;
2929
+ earlyRecheck = this.dispatch.recheckIsolatedBesideLiveRuns({ taskIds: [...awaitingRecheckRunIds], expectedWriteScopes: expectedWriteScopeOfRun })
2930
+ .catch((error) => {
2931
+ this.logger.warn('Could not re-check the wave\'s failed runs beside the live ones; the next settlement or the wave\'s end asks again', { error: describeCaughtError(error) });
2932
+ return { rechecked: new Map(), resolvedTaskIds: [] };
2933
+ });
2934
+ };
2828
2935
  /*
2829
2936
  * How many runs and steps have settled in this wave (#3883 review M1): a slot that finds nothing ready on a reading taken
2830
2937
  * before the latest settlement says nothing about what that settlement unlocked, so it does not hold the launcher back.
@@ -2984,6 +3091,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2984
3091
  raceSetGrew();
2985
3092
  handedOn = true;
2986
3093
  reservedTaskOfRun.set(taskId, prepared.plan.taskRef);
3094
+ if (prepared.expectedWriteScope !== undefined)
3095
+ expectedWriteScopeOfRun.set(taskId, prepared.expectedWriteScope);
2987
3096
  guardHeldReadingAgainst(prepared.plan.taskRef);
2988
3097
  }
2989
3098
  catch (error) {
@@ -3124,17 +3233,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3124
3233
  launcher = fill().finally(() => { launcher = undefined; });
3125
3234
  };
3126
3235
  launch();
3127
- while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined) {
3236
+ while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined || earlyRecheck !== undefined) {
3128
3237
  const first = await Promise.race([
3129
3238
  ...[...inFlight.values()].map((run) => run.then((settled) => ({ kind: 'coding', run: settled }))),
3130
3239
  ...[...generationInFlight.values()].map((step) => step.then((settled) => ({ kind: 'generation', step: settled }))),
3131
3240
  ...[...preparing.values()].map((slot) => slot.then(() => ({ kind: 'slot' }))),
3132
3241
  ...(launcher !== undefined ? [launcher.then(() => ({ kind: 'launcher' }))] : []),
3133
3242
  drainWake.then(() => ({ kind: 'grew' })),
3243
+ ...(earlyRecheck !== undefined ? [earlyRecheck.then((answer) => ({ kind: 'rechecked', answer }))] : []),
3134
3244
  ]);
3135
3245
  // The set grew, or the launcher ended: look again at what is live, without relaunching (see `launch`).
3136
3246
  if (first.kind === 'launcher' || first.kind === 'grew')
3137
3247
  continue;
3248
+ if (first.kind === 'rechecked') {
3249
+ earlyRecheck = undefined;
3250
+ // Recorded, or owed none (failed alone, recorded by a sharing episode's end): asked no more (review F4).
3251
+ for (const taskId of first.answer.resolvedTaskIds)
3252
+ awaitingRecheckRunIds.delete(taskId);
3253
+ /*
3254
+ * A recorded re-check moves the landing as a settlement does (#3998): a pass lands the task, a failure makes it
3255
+ * dispatchable again in THIS wave (before #3998, in the next). So the held reading is dropped and a slot that found
3256
+ * nothing ready looks again.
3257
+ */
3258
+ if (first.answer.rechecked.size > 0) {
3259
+ fillLanding.current = undefined;
3260
+ fillLanding.pending = undefined;
3261
+ nothingReady = false;
3262
+ launch();
3263
+ }
3264
+ /*
3265
+ * A run that was not re-checked waits for something to settle, the only thing that changes its answer; so one that
3266
+ * settled while the batch ran is asked about now, or the run it freed would wait for the NEXT settlement (review F2).
3267
+ */
3268
+ if (settlements !== settlementsAtEarlyRecheck)
3269
+ startEarlyRechecks();
3270
+ continue;
3271
+ }
3138
3272
  if (first.kind === 'slot') {
3139
3273
  launch();
3140
3274
  continue;
@@ -3155,10 +3289,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3155
3289
  reservedTaskOfRun.delete(run.taskId);
3156
3290
  settlements += 1;
3157
3291
  // The startup repair is reported as a repair, never as one of the wave's runs (#3880 review F9).
3292
+ expectedWriteScopeOfRun.delete(run.taskId);
3158
3293
  if (run.taskId === startupRepairInWave?.taskId)
3159
3294
  continue;
3160
3295
  outcomes.push(run.outcome);
3161
3296
  settledTaskIds.push(run.taskId);
3297
+ if (run.outcome?.disposition === ApplicationCodingTaskDisposition.VERIFICATION_FAILED)
3298
+ awaitingRecheckRunIds.add(run.taskId);
3162
3299
  }
3163
3300
  }
3164
3301
  for (const step of await takeAlreadySettled(generationInFlight))
@@ -3172,6 +3309,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3172
3309
  await repairStartBesideLiveRuns(notBooting);
3173
3310
  }
3174
3311
  }
3312
+ // Something settled: a failed run may now be re-checked beside what is still live (#3998).
3313
+ startEarlyRechecks();
3175
3314
  launch();
3176
3315
  }
3177
3316
  // Every slot has closed its preparation, so the wave's record of them is complete when it returns.
@@ -3680,7 +3819,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3680
3819
  }
3681
3820
  if (entry.reason === Workbench_BuildTaskStuckReason.AWAITING_ISOLATED_RECHECK) {
3682
3821
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" failed its checks while other runs of this wave were writing beside it, so the failure may be theirs. `
3683
- + `Running it again now would meet the same tree; the wave's end runs its checks alone, and a pass lands it. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3822
+ + `Running it again now would meet the same tree; its checks run again alone once no live run writes what they read, at the latest when the wave ends, and a pass lands it. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3684
3823
  }
3685
3824
  if (entry.reason === Workbench_BuildTaskStuckReason.RAN_THIS_WAVE) {
3686
3825
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" already ran in this wave and has not landed, so the wave does not run it again on the tree it just met. `
@@ -3753,7 +3892,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3753
3892
  if (!completed && identicalFailures < GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER)
3754
3893
  return null;
3755
3894
  const since = latest.settledAt ?? latest.startedAt;
3756
- if (!(await this.generationStepInputsUnmovedSince(candidate, since)))
3895
+ if (!(await this.generationStepInputsUnmovedSince(candidate, latest.startedAt)))
3757
3896
  return null;
3758
3897
  if (completed) {
3759
3898
  return {
@@ -3774,17 +3913,31 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3774
3913
  };
3775
3914
  }
3776
3915
  /**
3777
- * Whether nothing a generation step reads has moved since `since` (#3233, #3709): no commit since then, and no dirty path
3778
- * in the working tree, touched what the step READS (`resolveGenerationStepReadRoots`) outside what it writes itself. A
3779
- * step that names no read roots (an unknown step ref) reads every path outside its write scope, the rule before #3709.
3780
- * Until #3709 every step read that way, so any sibling's checkpoint released a held step: on reference run 42886943490
3781
- * a documentation publication failing on the engine's examples could run again after each frontend view landed.
3782
- * `false` when git cannot be read, so a step is never held on an unknown.
3916
+ * Whether nothing a generation step reads has moved since its latest run STARTED (#3233, #3709): no commit since then,
3917
+ * and no uncommitted path edited since then, touched what the step READS (`resolveGenerationStepReadRoots`) outside what
3918
+ * it writes itself. A step that names no read roots (an unknown step ref) reads every path outside its write scope, the
3919
+ * rule before #3709. Until #3709 every step read that way, so any sibling's checkpoint released a held step: on
3920
+ * reference run 42886943490 a documentation publication failing on the engine's examples could run again after each
3921
+ * frontend view landed. From the run's START, not its end: an input changed while the run was running may not have
3922
+ * been read by it.
3923
+ *
3924
+ * An uncommitted path is dated, because being dirty says nothing about WHEN it changed (`readLandingSourceState` leaves
3925
+ * that to its caller): by its modification time, or, when it is gone (a deletion, a rename's origin), by its nearest
3926
+ * existing directory's, which a removal updates. Until #3933 any dirty input released the step, and a live application
3927
+ * nearly always has one: on client creation run 44257782469 the documentation publication failed 117 times in a row on
3928
+ * one missing role specification and was never held. What released it was not observed, so a release now logs the path
3929
+ * that caused it.
3930
+ *
3931
+ * `false` when git, or the application root, cannot be read, so a step is never held on an unknown.
3783
3932
  */
3784
- async generationStepInputsUnmovedSince(candidate, since) {
3933
+ async generationStepInputsUnmovedSince(candidate, ranFrom) {
3785
3934
  if (typeof this.git.listPathsCommittedSince !== 'function' || typeof this.git.readLandingSourceState !== 'function')
3786
3935
  return false;
3787
- const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(since), this.git.readLandingSourceState()]);
3936
+ const ranFromMs = Date.parse(ranFrom);
3937
+ const saasRoot = this.companionContext?.saasRoot;
3938
+ if (Number.isNaN(ranFromMs) || saasRoot === undefined)
3939
+ return false;
3940
+ const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(ranFrom), this.git.readLandingSourceState()]);
3788
3941
  if (committed === undefined || tree === undefined)
3789
3942
  return false;
3790
3943
  const ownRoots = await this.generationSteps.resolveGenerationStepWritableRoots(candidate);
@@ -3793,7 +3946,23 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3793
3946
  : undefined;
3794
3947
  const under = (roots, path) => roots.some((root) => (root.endsWith('/') ? path.startsWith(root) : path === root));
3795
3948
  const isInput = (path) => !under(ownRoots, path) && (readRoots === undefined || under(readRoots, path));
3796
- return ![...committed, ...tree.changedPaths].some(isInput);
3949
+ const released = (relativePath, why) => {
3950
+ this.logger.info?.('A generation step that ran on unchanged inputs is offered again: one of its inputs moved', {
3951
+ taskRef: candidate.taskRef, path: relativePath, why, ranFrom,
3952
+ });
3953
+ return false;
3954
+ };
3955
+ const committedInput = committed.find(isInput);
3956
+ if (committedInput !== undefined)
3957
+ return released(committedInput, 'committed since the latest run started');
3958
+ for (const relativePath of tree.changedPaths.filter(isInput)) {
3959
+ const changedAtMs = await lastChangedAtMs(saasRoot, relativePath);
3960
+ if (changedAtMs === undefined)
3961
+ return released(relativePath, 'uncommitted, and neither it nor a directory above it can be read');
3962
+ if (changedAtMs >= ranFromMs)
3963
+ return released(relativePath, 'uncommitted, and changed since the latest run started');
3964
+ }
3965
+ return true;
3797
3966
  }
3798
3967
  /**
3799
3968
  * The build tasks whose LATEST coding run failed its own verification and was not cleared since (#3220): no re-arm, and
@@ -4005,7 +4174,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4005
4174
  }
4006
4175
  /*
4007
4176
  * Its latest run failed its checks beside siblings, in THIS wave (#3204): run again now, it would meet the same tree its
4008
- * siblings are still writing. The wave's end re-checks it alone (a pass lands it); the next wave offers it if that failed.
4177
+ * siblings are still writing. It is re-checked alone once no live run is expected to write what its checks read (#3998),
4178
+ * at the latest at the wave's end; a pass lands it, a failure offers it again (in this same wave once re-checked early).
4179
+ * Held until that re-check is RECORDED on the run, so a task whose re-check is pending, or was discarded because what it
4180
+ * read moved, is never dispatched again meanwhile.
4009
4181
  * Only within the wave that ran it: a run left unchecked by an earlier wave (a restart) is offered, alone or not, rather
4010
4182
  * than held for a re-check nothing would run.
4011
4183
  */
@@ -4543,7 +4715,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4543
4715
  landedTaskRefs: [...landedTaskRefs].sort(),
4544
4716
  unverifiableLandedTaskRefs: resolution.unverifiableLandedTaskRefs,
4545
4717
  };
4546
- return { kind: 'CODING', plan, contract, stuckTasks: stuck, ...(landedOverride ? { landedOverride } : {}) };
4718
+ let expectedWriteScope;
4719
+ try {
4720
+ expectedWriteScope = resolveBuildPlanTaskExpectedWriteScope(task);
4721
+ }
4722
+ catch {
4723
+ // Unknown: a run whose writes cannot be predicted holds every isolated re-check beside it (#3998).
4724
+ expectedWriteScope = undefined;
4725
+ }
4726
+ return { kind: 'CODING', plan, contract, stuckTasks: stuck, ...(expectedWriteScope !== undefined ? { expectedWriteScope } : {}), ...(landedOverride ? { landedOverride } : {}) };
4547
4727
  }
4548
4728
  /**
4549
4729
  * Which tasks have landed, read from GIT.
@@ -4634,9 +4814,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4634
4814
  }
4635
4815
  /*
4636
4816
  * A task being built right now is progress, not stuck: the plan is not blocked while a wave runs. So is a task
4637
- * waiting for a live run that writes its file (CONTENDED), or for its wave's end to re-check it alone
4638
- * (AWAITING_ISOLATED_RECHECK, #3204): each clears by itself. Counted as stuck, they read a busy build as not moving,
4639
- * which lifts the hold on code-only refreshes and lets the umbrella loop re-run upstream lanes mid-build.
4817
+ * waiting for a live run that writes its file (CONTENDED), or for its re-check alone, run once no live run writes
4818
+ * what it reads or at the wave's end (AWAITING_ISOLATED_RECHECK, #3204, #3998): each clears by itself. Counted as stuck, they read a busy build as not moving,
4819
+ * which closes the dispatch on "every ready task is stuck" and stops the loop forcing a wave. (It no longer lifts the
4820
+ * hold on code-only refreshes: that hold follows the build being unfinished, stuck or not, since #4015.)
4640
4821
  */
4641
4822
  if (entry === null || BUILD_TASK_REASONS_THAT_ARE_PROGRESS.has(entry.reason))
4642
4823
  return undefined;
@@ -6728,9 +6909,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6728
6909
  const carried = new Map();
6729
6910
  const carriedAudiences = new Map();
6730
6911
  const contributingPaths = new Map();
6912
+ // Per surface, the custom views its resource-operation launchers open, with the launcher's audience (#4012).
6913
+ const hostedCustomViews = new Map();
6731
6914
  for (const row of shell.surfaces) {
6732
6915
  const identities = new Set();
6733
6916
  const audiences = new Map();
6917
+ const hosted = [];
6734
6918
  for (const launcher of row.launchers) {
6735
6919
  // Every identity it answers to: the plan names a resource in the singular, the shell carries its type (#3204).
6736
6920
  const launcherIdentities = launcherShellIdentities(launcher);
@@ -6740,18 +6924,64 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6740
6924
  ...(launcher.requiredRoles === undefined ? {} : { item: launcher.requiredRoles }),
6741
6925
  ...(launcher.sectionRequiredRoles === undefined ? {} : { section: launcher.sectionRequiredRoles }),
6742
6926
  };
6927
+ if (launcher.hostedCustomView !== undefined)
6928
+ hosted.push({ component: launcher.hostedCustomView, layers });
6743
6929
  for (const identity of launcherIdentities) {
6744
6930
  identities.add(identity);
6745
6931
  audiences.set(identity, [...(audiences.get(identity) ?? []), layers]);
6746
6932
  }
6747
6933
  }
6748
6934
  carriedAudiences.set(row.surface, audiences);
6935
+ hostedCustomViews.set(row.surface, hosted);
6749
6936
  for (const destinationRef of row.destinationRefs)
6750
6937
  identities.add(settingsDestinationShellIdentity(destinationRef));
6751
6938
  carried.set(row.surface, identities);
6752
6939
  contributingPaths.set(row.surface, [shellSurfaceConfigFile(row.surface), ...row.contributingModuleIds.map(shellModuleContributionFile)]);
6753
6940
  }
6754
6941
  const expectations = derivePlacementPlanShellExpectations(plan.data);
6942
+ /*
6943
+ * A planned view the build realised as a resource operation's custom view (#4012, reference run 44052185141): the
6944
+ * experience plan's `view-enquiry-capture` is the enquiry CREATE's `customView`, and the shell reaches it only through
6945
+ * the `enquiry` / `create` launcher, which therefore CARRIES the placed view. No plan says which operation hosts it, so
6946
+ * the oracle reads the binding and this asks whether the bound component is the planned view, by the rule the custom
6947
+ * view's own build task lands by. Before this, the sidebar and command-menu placements ran 4–5 times each and could
6948
+ * never land.
6949
+ *
6950
+ * Only for views the plan PLACES on the surface. A view it DECLINES is not counted as carried by an operation launcher
6951
+ * the plan places: declining a view and placing the operation that renders it is a plan saying "reach it through the
6952
+ * operation", and reading that launcher as the declined view would leave the surface unlandable unless the agent
6953
+ * removed an entry the plan placed. A launcher realising the view brings its audience with it; a plan placing the
6954
+ * view and the operation hosting it on ONE surface with different roles asks for one entry shown to two audiences,
6955
+ * which no shell satisfies and the audience check reports.
6956
+ *
6957
+ * A component realises at most ONE planned view: the most specific of every view the plan names, placed or declined
6958
+ * (#4012 review R1). The rule matches the view's words at the START of the name, so `FollowUpsDueCustomView` would also
6959
+ * read as `view-follow-ups`; with both planned, it is the due-follow-ups view only, and the concept view still needs a
6960
+ * launcher of its own.
6961
+ */
6962
+ const plannedViewRefs = [...new Set(plan.data.decisions.flatMap(({ subject }) => (subject.kind === PlacementSubjectKind.APP_VIEW ? [subject.viewRef] : [])))];
6963
+ const realisedViewIdentity = (component) => {
6964
+ const realised = plannedViewRefs
6965
+ .filter((viewRef) => customViewComponentRealisesPlannedView(component, viewRef))
6966
+ .map((viewRef) => placementSubjectShellIdentity({ kind: PlacementSubjectKind.APP_VIEW, viewRef }))
6967
+ .sort((left, right) => right.length - left.length);
6968
+ return realised[0];
6969
+ };
6970
+ for (const [surface, entries] of expectations.placed) {
6971
+ const hosted = hostedCustomViews.get(surface) ?? [];
6972
+ if (hosted.length === 0)
6973
+ continue;
6974
+ const placedViews = new Set(entries.filter(({ decision }) => decision.subject.kind === PlacementSubjectKind.APP_VIEW).map(({ shellIdentity }) => shellIdentity));
6975
+ const identities = carried.get(surface);
6976
+ const audiences = carriedAudiences.get(surface);
6977
+ for (const { component, layers } of hosted) {
6978
+ const identity = realisedViewIdentity(component);
6979
+ if (identity === undefined || !placedViews.has(identity))
6980
+ continue;
6981
+ identities.add(identity);
6982
+ audiences.set(identity, [...(audiences.get(identity) ?? []), layers]);
6983
+ }
6984
+ }
6755
6985
  const placed = new Map([...expectations.placed].map(([surface, entries]) => [surface, entries.map((entry) => entry.shellIdentity)]));
6756
6986
  const placedAudiences = new Map([...expectations.placed].map(([surface, entries]) => [
6757
6987
  surface, new Map(entries.map((entry) => [entry.shellIdentity, entry.audience])),
@@ -6969,67 +7199,81 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6969
7199
  * after its page, so website tasks ran beside the module tasks serving their requirements, read IN_PROGRESS, and wrote
6970
7200
  * "coming soon" for features that shipped an hour later, with nothing ever rewriting them. So each website task gains
6971
7201
  * a prerequisite on every task delivering a requirement it cites (website and documentation tasks excluded), follow-ups
6972
- * included, as they are appended before this step.
7202
+ * included, as they are appended before this step. Which edges are admissible is {@link deriveWebsiteClaimPrerequisites}'s
7203
+ * (one edge at a time, refused only when it would close a cycle); this host adds the guard and the logging.
6973
7204
  *
6974
7205
  * A page waits on everything its sections cite, since its title and description summarize them, so one feature task
6975
7206
  * that stays stuck holds back the whole page and its sections (re-review R4). That is the plan-stuck path, by design.
6976
- *
6977
- * A delivering task that itself waits on a website task would close a cycle with the added edges. Each website task's
6978
- * edges are kept or dropped TOGETHER, re-checked against the schema and the semantic floors (PREREQUISITE_CYCLE among
6979
- * them), so one cycle costs only the tasks it involves (re-review R2), and each is named in a warning: an ordering
6980
- * preference is never the reason the plan cannot be read.
6981
7207
  */
6982
7208
  withHostDerivedWebsiteClaimPrerequisites(graph, companionExports) {
6983
7209
  const citedByTask = citedRequirementRefsByWebsiteTask(graph.tasks, companionExports);
6984
7210
  /*
6985
7211
  * Held per plan content (#3204): the plan is read on every selection, board and landing read, many times a second at a
6986
- * wave's end, and when the combined edges close a cycle the fallback below re-parses and re-validates the whole plan
6987
- * once per website task. On reference run 42621319676 that warned 68 times per read (3,196 lines in 40 minutes) beside
6988
- * the companion's event-loop stalls. The answer depends only on the tasks and on what each website task cites.
7212
+ * wave's end. On reference run 42621319676 re-validating it per website task on each read warned 68 times per read
7213
+ * (3,196 lines in 40 minutes) beside the companion's event-loop stalls. The answer depends only on the tasks and on
7214
+ * what each website task cites.
6989
7215
  */
6990
7216
  const memoKey = JSON.stringify({ tasks: graph.tasks, cited: [...citedByTask].sort(([left], [right]) => left.localeCompare(right)) });
6991
7217
  if (this.websiteClaimPrerequisitesMemo?.key === memoKey)
6992
7218
  return this.websiteClaimPrerequisitesMemo.graph;
6993
- const derived = this.deriveWebsiteClaimPrerequisites(graph, citedByTask);
7219
+ const derived = this.deriveGuardedWebsiteClaimPrerequisites(graph, citedByTask);
6994
7220
  this.websiteClaimPrerequisitesMemo = { key: memoKey, graph: derived };
6995
7221
  return derived;
6996
7222
  }
6997
7223
  websiteClaimPrerequisitesMemo;
6998
- deriveWebsiteClaimPrerequisites(graph, citedByTask) {
6999
- const additions = new Map();
7000
- for (const task of graph.tasks) {
7001
- const cited = citedByTask.get(task.taskRef) ?? [];
7002
- const delivering = cited.flatMap((requirementRef) => deliveringTasksFor(requirementRef, graph.tasks)).map((entry) => entry.taskRef);
7003
- const added = [...new Set(delivering)].filter((taskRef) => taskRef !== task.taskRef && !task.prerequisiteTaskRefs.includes(taskRef));
7004
- if (added.length > 0)
7005
- additions.set(task.taskRef, added);
7006
- }
7007
- if (additions.size === 0)
7224
+ /** The hard-floor findings of the host's plan already logged: each is named once per process, never once per read, as the refused-website-task warning was (17,402 lines on reference run 44052185141). */
7225
+ loggedHostPlanFloorFindings = new Set();
7226
+ /**
7227
+ * The claim edges, held to the plan's hard floors RELATIVE TO THE PLAN THEY ARE ADDED TO.
7228
+ *
7229
+ * The host's plan may already carry a hard-floor finding this step did not cause: a follow-up of a RELATIONSHIP task
7230
+ * keeps that target and declares no product (a follow-up never declares one: it lands on its run, see
7231
+ * `resolveLandedTaskRefs`), which `RELATIONSHIP_TARGET_DISAGREES_WITH_PRODUCTS` reports. The floors are the AUTHORED
7232
+ * plan's contract (`readAuthoredBuildPlan` holds the plan to them); that one guards the domain-coverage count, which
7233
+ * reads authored targets only. Until this guard compared against the plan it extends, the first such follow-up made every
7234
+ * website task's edges look invalid on every read (reference runs 44052185141 and 44255624884, 77 and 76 website tasks per
7235
+ * pass), so pages were built before the features they describe. Such a finding is named once, never held against an edge.
7236
+ *
7237
+ * Only a finding the edges INTRODUCE refuses them, and then all of them: the edge-by-edge derivation can introduce none
7238
+ * today (it adds no edge that closes a cycle, the only floor a website task's prerequisites reach), so this is the guard
7239
+ * for a floor added tomorrow, which costs the claim ordering and never the plan's readability.
7240
+ */
7241
+ deriveGuardedWebsiteClaimPrerequisites(graph, citedByTask) {
7242
+ const derivation = deriveWebsiteClaimPrerequisites(graph, citedByTask);
7243
+ for (const [taskRef, withheld] of derivation.withheldPlanned) {
7244
+ this.logger.warn?.(`Website task "${taskRef}" does not wait on planned task(s) that already wait on it, since waiting would close a cycle`, { withheld });
7245
+ }
7246
+ if (derivation.withheldFollowUps.size > 0) {
7247
+ this.logDebug('Website tasks do not wait on follow-ups that already wait on them (derived from them, from their sections, or chained after one)', { withheld: Object.fromEntries(derivation.withheldFollowUps) });
7248
+ }
7249
+ /*
7250
+ * Keyed by the whole finding, message included. A cycle finding's message is its DFS trail, which an added edge can
7251
+ * change, so a cycle already in the plan could read as introduced and cost every claim edge. Fail-safe, and not
7252
+ * reachable today: the authored plan holds the cycle floor and every host-derived task waits only on tasks before it.
7253
+ */
7254
+ const floorFindings = (candidate) => validateBuildPlanTaskGraph(candidate)
7255
+ .filter((finding) => BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES.includes(finding.code))
7256
+ .map((finding) => ({ key: `${finding.code}\u0000${finding.taskRef}\u0000${finding.message}`, finding }));
7257
+ const baseline = floorFindings(graph);
7258
+ const unlogged = baseline.filter(({ key }) => !this.loggedHostPlanFloorFindings.has(key));
7259
+ if (unlogged.length > 0) {
7260
+ for (const { key } of unlogged)
7261
+ this.loggedHostPlanFloorFindings.add(key);
7262
+ this.logger.warn?.('The build plan as this host derives it carries hard-floor finding(s) on tasks it did not author; the website claim edges are judged only on what they add', {
7263
+ findings: unlogged.map(({ finding }) => `${finding.code} ${finding.taskRef}: ${finding.message}`),
7264
+ });
7265
+ }
7266
+ if (derivation.added.size === 0)
7267
+ return graph;
7268
+ const baselineKeys = new Set(baseline.map(({ key }) => key));
7269
+ const introduced = floorFindings(derivation.graph).filter(({ key }) => !baselineKeys.has(key));
7270
+ if (introduced.length > 0) {
7271
+ this.logger.warn?.('Website tasks keep their authored prerequisites: the edges to what their claims cite would introduce hard-floor finding(s)', {
7272
+ findings: introduced.map(({ finding }) => `${finding.code} ${finding.taskRef}: ${finding.message}`),
7273
+ });
7008
7274
  return graph;
7009
- const withEdges = (current, edges) => BuildPlanTaskGraphSchema.safeParse({
7010
- ...current,
7011
- tasks: current.tasks.map((task) => {
7012
- const added = edges.get(task.taskRef);
7013
- return added === undefined ? task : { ...task, prerequisiteTaskRefs: [...task.prerequisiteTaskRefs, ...added] };
7014
- }),
7015
- });
7016
- const isValid = (candidate) => candidate.success
7017
- && !validateBuildPlanTaskGraph(candidate.data).some((finding) => BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES.includes(finding.code));
7018
- const all = withEdges(graph, additions);
7019
- if (isValid(all))
7020
- return all.data;
7021
- // Some task's edges close a cycle: add them task by task, keeping each set that leaves the plan valid.
7022
- let current = graph;
7023
- for (const [taskRef, added] of additions) {
7024
- const candidate = withEdges(current, new Map([[taskRef, added]]));
7025
- if (isValid(candidate)) {
7026
- current = candidate.data;
7027
- }
7028
- else {
7029
- this.logger.warn?.(`Website task "${taskRef}" keeps its authored prerequisites: waiting on the tasks its claims cite would make the plan invalid`, { wouldWaitOn: added });
7030
- }
7031
7275
  }
7032
- return current;
7276
+ return derivation.graph;
7033
7277
  }
7034
7278
  /**
7035
7279
  * The build plan as the DISPATCH HOST reads it: the authored graph, plus the `database-migrations`
@@ -8488,6 +8732,18 @@ export { ApplicationBuildDispatchCompanionService };
8488
8732
  export function previousAttemptContextSource(run) {
8489
8733
  const tail = (value) => typeof value === 'string' && value.length > 0 ? value.slice(-PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS) : undefined;
8490
8734
  const verification = Array.isArray(run.output.verification) ? run.output.verification : [];
8735
+ /*
8736
+ * Findings about the APPLICATION that another writer caused (#3881), per check: the run was not charged with them, and
8737
+ * the retry is told so, so it fixes its own finding and leaves the others to the task that wrote them or to the
8738
+ * end-of-build repair. A check carried whole for them is marked too: it never failed this task.
8739
+ */
8740
+ const notThisTasks = new Map();
8741
+ for (const entry of Array.isArray(run.output.applicationVerificationFindings) ? run.output.applicationVerificationFindings : []) {
8742
+ const { checkRef, finding } = (typeof entry === 'object' && entry !== null ? entry : {});
8743
+ if (typeof checkRef === 'string' && typeof finding === 'string')
8744
+ notThisTasks.set(checkRef, [...(notThisTasks.get(checkRef) ?? []), finding]);
8745
+ }
8746
+ const carriedRefs = new Set(Array.isArray(run.output.carriedVerificationFailures) ? run.output.carriedVerificationFailures.map(String) : []);
8491
8747
  const failedChecks = verification
8492
8748
  .filter((entry) => typeof entry === 'object' && entry !== null)
8493
8749
  .filter((entry) => entry.outcome?.success === false)
@@ -8496,6 +8752,10 @@ export function previousAttemptContextSource(run) {
8496
8752
  ...(tail(entry.outcome?.message) ? { message: tail(entry.outcome?.message) } : {}),
8497
8753
  ...(tail(entry.outcome?.stdoutTail) ? { stdoutTail: tail(entry.outcome?.stdoutTail) } : {}),
8498
8754
  ...(tail(entry.outcome?.stderrTail) ? { stderrTail: tail(entry.outcome?.stderrTail) } : {}),
8755
+ ...(carriedRefs.has(String(entry.checkRef)) ? { notChargedToThisTask: true } : {}),
8756
+ ...(notThisTasks.has(String(entry.checkRef))
8757
+ ? { findingsNotThisTasks: notThisTasks.get(String(entry.checkRef)).map((finding) => finding.slice(0, PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS)) }
8758
+ : {}),
8499
8759
  }));
8500
8760
  const rearm = readBuildTaskRearm(run.memory);
8501
8761
  // A coding run records its failure as `error`, a refusal as `failure` — one reader for both (#2390).
@@ -8520,7 +8780,11 @@ export function previousAttemptContextSource(run) {
8520
8780
  + 'required check could not be asked. Nothing about the approach was judged; start the work normally, '
8521
8781
  + 'and read what it had reached if that helps.'
8522
8782
  : 'This task was attempted before and FAILED. Read why before starting: repeating the same approach '
8523
- + 'will fail the same way. Fix what the failure names; do not work around a check.';
8783
+ + 'will fail the same way. Fix what the failure names; do not work around a check.'
8784
+ + (notThisTasks.size > 0
8785
+ ? ' A failed check\'s `findingsNotThisTasks` are about the application, caused by another task writing beside '
8786
+ + 'this one: they are not this task\'s to fix, and the build owes them a repair. Fix the other findings.'
8787
+ : '');
8524
8788
  return {
8525
8789
  sourceRef: 'application-creation:context/previous-attempt',
8526
8790
  originRef: 'application-creation:origin/dev-companion',
@@ -8580,7 +8844,7 @@ export function buildTaskSelfDescriptionContextSource(task, totalTasks,
8580
8844
  /** The skills the agent is told to author with — the task's own unless the host derived better (a website task). */
8581
8845
  skillRefs = task.skillRefs) {
8582
8846
  return {
8583
- sourceRef: 'application-creation:context/build-task',
8847
+ sourceRef: BUILD_TASK_SELF_DESCRIPTION_SOURCE_REF,
8584
8848
  originRef: 'application-creation:origin/build-plan',
8585
8849
  // The committed build plan, decomposed from the application's own specifications.
8586
8850
  trust: MetaWorkflow_ContextSourceTrust.TRUSTED,
@@ -8730,7 +8994,11 @@ export function buildShellPlacementPlanContextSource(surface, companionExports)
8730
8994
  + 'placed on it below and none of the declined subjects, and every file that surface is composed from is committed. '
8731
8995
  + 'The declarationRefs in `produces` name these decisions; they are never spelled in the tree, so writing them as text lands nothing. '
8732
8996
  + 'Roles are written per layer, exactly as listed: a group\'s `requiredRoles` as `runtimeAvailability.requiredRoles` on its '
8733
- + 'sidebar section, and an entry\'s own `requiredRoles` on the entry. A layer that lists none carries none.',
8997
+ + 'sidebar section, and an entry\'s own `requiredRoles` on the entry. A layer that lists none carries none. '
8998
+ // #4012: a planned view built as an operation's custom view has no launcher of its own.
8999
+ + 'A placed view built as a resource operation\'s `customView` is carried by a RESOURCE_OPERATION launcher for that '
9000
+ + 'operation, which the shell reports with the bound component as `hostedCustomView`, when the component\'s name starts '
9001
+ + 'with the view ref\'s words (`view-enquiry-capture` is carried by an entry hosting `EnquiryCaptureCustomView`).',
8734
9002
  ...(groupsOnThisSurface.length === 0 ? {} : { groupsOnThisSurface }),
8735
9003
  placedOnThisSurface: (expectations.placed.get(surface) ?? []).map(describe),
8736
9004
  declinedEverywhere: expectations.declined.map(describe),