@cat-factory/orchestration 0.240.0 → 0.242.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container/dependencies.d.ts +24 -1
- package/dist/container/dependencies.d.ts.map +1 -1
- package/dist/container/module-shapes.d.ts +8 -0
- package/dist/container/module-shapes.d.ts.map +1 -1
- package/dist/container/modules.d.ts.map +1 -1
- package/dist/container/modules.js +9 -2
- package/dist/container/modules.js.map +1 -1
- package/dist/container/runtime.d.ts +1 -0
- package/dist/container/runtime.d.ts.map +1 -1
- package/dist/container/runtime.js +7 -1
- package/dist/container/runtime.js.map +1 -1
- package/dist/container.d.ts +9 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +2 -1
- package/dist/container.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/artifacts/artifactRetention.d.ts +11 -4
- package/dist/modules/artifacts/artifactRetention.d.ts.map +1 -1
- package/dist/modules/artifacts/artifactRetention.js +11 -4
- package/dist/modules/artifacts/artifactRetention.js.map +1 -1
- package/dist/modules/board/BoardService.d.ts +43 -23
- package/dist/modules/board/BoardService.d.ts.map +1 -1
- package/dist/modules/board/BoardService.js +109 -126
- package/dist/modules/board/BoardService.js.map +1 -1
- package/dist/modules/board/newServiceFrameDefaults.d.ts +18 -1
- package/dist/modules/board/newServiceFrameDefaults.d.ts.map +1 -1
- package/dist/modules/board/newServiceFrameDefaults.js +17 -0
- package/dist/modules/board/newServiceFrameDefaults.js.map +1 -1
- package/dist/modules/board/publicBoardReads.d.ts +56 -2
- package/dist/modules/board/publicBoardReads.d.ts.map +1 -1
- package/dist/modules/board/publicBoardReads.js +53 -0
- package/dist/modules/board/publicBoardReads.js.map +1 -1
- package/dist/modules/board/serviceRepoLinkage.d.ts +51 -0
- package/dist/modules/board/serviceRepoLinkage.d.ts.map +1 -0
- package/dist/modules/board/serviceRepoLinkage.js +54 -0
- package/dist/modules/board/serviceRepoLinkage.js.map +1 -0
- package/dist/modules/board/sharedServiceMount.d.ts +30 -0
- package/dist/modules/board/sharedServiceMount.d.ts.map +1 -0
- package/dist/modules/board/sharedServiceMount.js +91 -0
- package/dist/modules/board/sharedServiceMount.js.map +1 -0
- package/dist/modules/execution/AgentDispatchController.d.ts.map +1 -1
- package/dist/modules/execution/AgentDispatchController.js +11 -17
- package/dist/modules/execution/AgentDispatchController.js.map +1 -1
- package/dist/modules/execution/CompanionController.d.ts.map +1 -1
- package/dist/modules/execution/CompanionController.js +5 -22
- package/dist/modules/execution/CompanionController.js.map +1 -1
- package/dist/modules/execution/DeployerStepController.d.ts.map +1 -1
- package/dist/modules/execution/DeployerStepController.js +2 -4
- package/dist/modules/execution/DeployerStepController.js.map +1 -1
- package/dist/modules/execution/FollowUpGateController.js +3 -3
- package/dist/modules/execution/FollowUpGateController.js.map +1 -1
- package/dist/modules/execution/ForkDecisionController.d.ts.map +1 -1
- package/dist/modules/execution/ForkDecisionController.js +1 -2
- package/dist/modules/execution/ForkDecisionController.js.map +1 -1
- package/dist/modules/execution/GateHelperDispatcher.d.ts.map +1 -1
- package/dist/modules/execution/GateHelperDispatcher.js +1 -2
- package/dist/modules/execution/GateHelperDispatcher.js.map +1 -1
- package/dist/modules/execution/GateStepController.d.ts.map +1 -1
- package/dist/modules/execution/GateStepController.js +1 -2
- package/dist/modules/execution/GateStepController.js.map +1 -1
- package/dist/modules/execution/HumanTestController.d.ts.map +1 -1
- package/dist/modules/execution/HumanTestController.js +7 -32
- package/dist/modules/execution/HumanTestController.js.map +1 -1
- package/dist/modules/execution/InterviewGateController.d.ts.map +1 -1
- package/dist/modules/execution/InterviewGateController.js +2 -21
- package/dist/modules/execution/InterviewGateController.js.map +1 -1
- package/dist/modules/execution/JudgeStepController.d.ts.map +1 -1
- package/dist/modules/execution/JudgeStepController.js +1 -2
- package/dist/modules/execution/JudgeStepController.js.map +1 -1
- package/dist/modules/execution/OneShotStepController.d.ts.map +1 -1
- package/dist/modules/execution/OneShotStepController.js +1 -2
- package/dist/modules/execution/OneShotStepController.js.map +1 -1
- package/dist/modules/execution/PollRunningController.d.ts.map +1 -1
- package/dist/modules/execution/PollRunningController.js +2 -4
- package/dist/modules/execution/PollRunningController.js.map +1 -1
- package/dist/modules/execution/RalphController.d.ts.map +1 -1
- package/dist/modules/execution/RalphController.js +5 -9
- package/dist/modules/execution/RalphController.js.map +1 -1
- package/dist/modules/execution/ReviewGateController.d.ts.map +1 -1
- package/dist/modules/execution/ReviewGateController.js +2 -20
- package/dist/modules/execution/ReviewGateController.js.map +1 -1
- package/dist/modules/execution/RunDispatcher.d.ts.map +1 -1
- package/dist/modules/execution/RunDispatcher.js +20 -58
- package/dist/modules/execution/RunDispatcher.js.map +1 -1
- package/dist/modules/execution/RunStateMachine.d.ts +49 -0
- package/dist/modules/execution/RunStateMachine.d.ts.map +1 -1
- package/dist/modules/execution/RunStateMachine.js +84 -0
- package/dist/modules/execution/RunStateMachine.js.map +1 -1
- package/dist/modules/execution/TesterController.d.ts.map +1 -1
- package/dist/modules/execution/TesterController.js +9 -21
- package/dist/modules/execution/TesterController.js.map +1 -1
- package/dist/modules/execution/VisualConfirmationController.d.ts.map +1 -1
- package/dist/modules/execution/VisualConfirmationController.js +6 -30
- package/dist/modules/execution/VisualConfirmationController.js.map +1 -1
- package/dist/modules/execution/step-fold.logic.d.ts +24 -0
- package/dist/modules/execution/step-fold.logic.d.ts.map +1 -1
- package/dist/modules/execution/step-fold.logic.js +29 -0
- package/dist/modules/execution/step-fold.logic.js.map +1 -1
- package/dist/modules/execution/stepPreamble.d.ts.map +1 -1
- package/dist/modules/execution/stepPreamble.js +2 -4
- package/dist/modules/execution/stepPreamble.js.map +1 -1
- package/dist/modules/notifications/NotificationService.d.ts.map +1 -1
- package/dist/modules/notifications/NotificationService.js +15 -9
- package/dist/modules/notifications/NotificationService.js.map +1 -1
- package/dist/modules/notifications/NotificationSettingsService.d.ts +28 -0
- package/dist/modules/notifications/NotificationSettingsService.d.ts.map +1 -0
- package/dist/modules/notifications/NotificationSettingsService.js +50 -0
- package/dist/modules/notifications/NotificationSettingsService.js.map +1 -0
- package/package.json +11 -11
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import type { AddTaskInput, BlockEditAuthority } from '@cat-factory/contracts';
|
|
2
|
-
import type { Block, BlockRepository, BlockStatus } from '@cat-factory/kernel';
|
|
1
|
+
import type { AddTaskInput, BlockEditAuthority, GitHubRepo } from '@cat-factory/contracts';
|
|
2
|
+
import type { Block, BlockRepository, BlockStatus, RepoProjectionRepository, ServiceRepository } from '@cat-factory/kernel';
|
|
3
|
+
/** A repository the workspace can back a service with, and the service already backing it. */
|
|
4
|
+
export interface PublicRepoOption {
|
|
5
|
+
repo: GitHubRepo;
|
|
6
|
+
/**
|
|
7
|
+
* The frame block id of the WHOLE-REPO service this repository already backs ON THIS BOARD, or
|
|
8
|
+
* null.
|
|
9
|
+
*
|
|
10
|
+
* Null for a monorepo even when its subdirectories back services, because a monorepo can back
|
|
11
|
+
* more: the field answers "is this choice already spent", and for a monorepo it never is.
|
|
12
|
+
*/
|
|
13
|
+
serviceBlockId: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* True when the repository already backs a whole-repo service homed on ANOTHER board of the
|
|
16
|
+
* account, so nothing on a workspace-scoped surface can name it.
|
|
17
|
+
*
|
|
18
|
+
* The third state the pair `serviceBlockId: string` / `serviceBlockId: null` cannot express, and
|
|
19
|
+
* the one a caller most needs: the choice IS spent (the create refuses it, since the frame it
|
|
20
|
+
* would answer with is one this key could neither list nor file a task under), but there is no
|
|
21
|
+
* id here that would address the service. Reporting it as a plain `null` said the opposite of
|
|
22
|
+
* both facts, and steered a caller straight into the refusal.
|
|
23
|
+
*/
|
|
24
|
+
linkedElsewhere: boolean;
|
|
25
|
+
}
|
|
3
26
|
export interface PublicBoardReadsDeps {
|
|
4
27
|
blockRepository: BlockRepository;
|
|
28
|
+
/** The workspace's projected repositories; absent ⇒ no VCS integration wired on this facade. */
|
|
29
|
+
repoProjectionRepository?: RepoProjectionRepository;
|
|
30
|
+
/** The account-owned services frames map onto; absent ⇒ nothing can report a repo's service. */
|
|
31
|
+
serviceRepository?: ServiceRepository;
|
|
32
|
+
/** The workspace's owning account, for the account-scoped service dedupe the create applies. */
|
|
33
|
+
accountOf(workspaceId: string): Promise<string | null | undefined>;
|
|
5
34
|
/** Throws when the workspace does not exist; bound from the owning service. */
|
|
6
35
|
requireWorkspace(workspaceId: string): Promise<unknown>;
|
|
7
36
|
/** The normal task-creation path, reused verbatim so placement + task-type validation applies. */
|
|
@@ -12,6 +41,31 @@ export declare class PublicBoardReads {
|
|
|
12
41
|
constructor(deps: PublicBoardReadsDeps);
|
|
13
42
|
/** The workspace's board services (visible service frames). */
|
|
14
43
|
listServices(workspaceId: string): Promise<Block[]>;
|
|
44
|
+
/**
|
|
45
|
+
* The repositories this workspace can back a service with, each paired with the service that
|
|
46
|
+
* already backs it.
|
|
47
|
+
*
|
|
48
|
+
* The discovery read behind headless service creation: the create takes a provider repo id, and
|
|
49
|
+
* before this nothing on the external surface served one, so the one act of board setup a
|
|
50
|
+
* deployment could not perform without a browser was also the one it could not even DESCRIBE.
|
|
51
|
+
*
|
|
52
|
+
* Three reads, all batched, never per-repo: the projection list, the workspace's frames, and ONE
|
|
53
|
+
* account-scoped service list. The pairing is then an in-memory index: a `getByRepo`
|
|
54
|
+
* per repository would be the N+1 this codebase bans, and on a workspace with a hundred
|
|
55
|
+
* repositories it is a hundred queries to render one picker.
|
|
56
|
+
*
|
|
57
|
+
* The service read is ACCOUNT-scoped rather than scoped to this board's frames, because that is
|
|
58
|
+
* the population the CREATE dedupes against (`findAccountWholeRepoService`). Asking only about
|
|
59
|
+
* this board's own frames answers "no service backs this repository" for one the create will
|
|
60
|
+
* refuse, and the two have to agree: a discovery read whose whole job is to say what a caller
|
|
61
|
+
* may ask for cannot be reading a narrower table than the endpoint that decides.
|
|
62
|
+
*
|
|
63
|
+
* An unwired VCS integration answers an EMPTY list rather than throwing: this is a discovery
|
|
64
|
+
* read, and "you have connected no repositories" and "this deployment has no VCS integration" are
|
|
65
|
+
* the same instruction to the caller, connect one before creating a repo-backed service. The
|
|
66
|
+
* CREATE is where the distinction bites, and it refuses there with the reason.
|
|
67
|
+
*/
|
|
68
|
+
listRepoOptions(workspaceId: string): Promise<PublicRepoOption[]>;
|
|
15
69
|
/**
|
|
16
70
|
* Refuse a container that cannot hold a new task: missing / not the workspace's / a headless
|
|
17
71
|
* `internal` anchor / not a frame / archived.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicBoardReads.d.ts","sourceRoot":"","sources":["../../../src/modules/board/publicBoardReads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"publicBoardReads.d.ts","sourceRoot":"","sources":["../../../src/modules/board/publicBoardReads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC1F,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,WAAW,EACX,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAe5B,8FAA8F;AAC9F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAA;IAChB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;;;;;;;;OASG;IACH,eAAe,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,eAAe,CAAA;IAChC,gGAAgG;IAChG,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,gGAAgG;IAChG,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,gGAAgG;IAChG,SAAS,CAAC,WAAW,EAAE,MA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jB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC9D,OAAO,CAAC;QAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAUtD;CACF"}
|
|
@@ -11,6 +11,59 @@ export class PublicBoardReads {
|
|
|
11
11
|
const blocks = await this.deps.blockRepository.listByWorkspace(workspaceId);
|
|
12
12
|
return blocks.filter((b) => b.level === 'frame' && !b.internal && !b.archived);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The repositories this workspace can back a service with, each paired with the service that
|
|
16
|
+
* already backs it.
|
|
17
|
+
*
|
|
18
|
+
* The discovery read behind headless service creation: the create takes a provider repo id, and
|
|
19
|
+
* before this nothing on the external surface served one, so the one act of board setup a
|
|
20
|
+
* deployment could not perform without a browser was also the one it could not even DESCRIBE.
|
|
21
|
+
*
|
|
22
|
+
* Three reads, all batched, never per-repo: the projection list, the workspace's frames, and ONE
|
|
23
|
+
* account-scoped service list. The pairing is then an in-memory index: a `getByRepo`
|
|
24
|
+
* per repository would be the N+1 this codebase bans, and on a workspace with a hundred
|
|
25
|
+
* repositories it is a hundred queries to render one picker.
|
|
26
|
+
*
|
|
27
|
+
* The service read is ACCOUNT-scoped rather than scoped to this board's frames, because that is
|
|
28
|
+
* the population the CREATE dedupes against (`findAccountWholeRepoService`). Asking only about
|
|
29
|
+
* this board's own frames answers "no service backs this repository" for one the create will
|
|
30
|
+
* refuse, and the two have to agree: a discovery read whose whole job is to say what a caller
|
|
31
|
+
* may ask for cannot be reading a narrower table than the endpoint that decides.
|
|
32
|
+
*
|
|
33
|
+
* An unwired VCS integration answers an EMPTY list rather than throwing: this is a discovery
|
|
34
|
+
* read, and "you have connected no repositories" and "this deployment has no VCS integration" are
|
|
35
|
+
* the same instruction to the caller, connect one before creating a repo-backed service. The
|
|
36
|
+
* CREATE is where the distinction bites, and it refuses there with the reason.
|
|
37
|
+
*/
|
|
38
|
+
async listRepoOptions(workspaceId) {
|
|
39
|
+
await this.deps.requireWorkspace(workspaceId);
|
|
40
|
+
if (!this.deps.repoProjectionRepository)
|
|
41
|
+
return [];
|
|
42
|
+
const repos = await this.deps.repoProjectionRepository.list(workspaceId);
|
|
43
|
+
if (repos.length === 0)
|
|
44
|
+
return [];
|
|
45
|
+
const frames = (await this.deps.blockRepository.listByWorkspace(workspaceId)).filter((block) => block.level === 'frame' && !block.internal && !block.archived);
|
|
46
|
+
const services = this.deps.serviceRepository
|
|
47
|
+
? await this.deps.serviceRepository.listByAccount((await this.deps.accountOf(workspaceId)) ?? null)
|
|
48
|
+
: [];
|
|
49
|
+
// Whole-repo services only (no `directory`), which is exactly what `serviceBlockId` claims.
|
|
50
|
+
const byRepo = new Map(services
|
|
51
|
+
.filter((service) => service.repoGithubId != null && !service.directory)
|
|
52
|
+
.map((service) => [service.repoGithubId, service.frameBlockId]));
|
|
53
|
+
const visibleFrames = new Set(frames.map((frame) => frame.id));
|
|
54
|
+
return repos.map((repo) => {
|
|
55
|
+
const frameBlockId = byRepo.get(repo.githubId);
|
|
56
|
+
// A service homed on another board (one this board merely mounts, or does not mount at all)
|
|
57
|
+
// is not a frame of THIS workspace, so its id is withheld: it would name a block this key
|
|
58
|
+
// cannot read. `linkedElsewhere` is what stops that withholding reading as "available".
|
|
59
|
+
const homedHere = frameBlockId !== undefined && visibleFrames.has(frameBlockId);
|
|
60
|
+
return {
|
|
61
|
+
repo,
|
|
62
|
+
serviceBlockId: homedHere ? frameBlockId : null,
|
|
63
|
+
linkedElsewhere: frameBlockId !== undefined && !homedHere,
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
14
67
|
/**
|
|
15
68
|
* Refuse a container that cannot hold a new task: missing / not the workspace's / a headless
|
|
16
69
|
* `internal` anchor / not a frame / archived.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicBoardReads.js","sourceRoot":"","sources":["../../../src/modules/board/publicBoardReads.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicBoardReads.js","sourceRoot":"","sources":["../../../src/modules/board/publicBoardReads.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAyD5C,MAAM,OAAO,gBAAgB;IACE,IAAI;IAAjC,YAA6B,IAA0B;oBAA1B,IAAI;IAAyB,CAAC;IAE3D,+DAA+D;IAC/D,KAAK,CAAC,YAAY,CAAC,WAAmB;QACpC,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAChF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,eAAe,CAAC,WAAmB;QACvC,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB;YAAE,OAAO,EAAE,CAAA;QAClD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAA;QACjC,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CA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I,EAAE,OAAO,EAAE,CAAA;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AddServiceFromRepoInput } from '@cat-factory/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* How a create should treat a repository that ALREADY backs an account-owned service whose frame
|
|
4
|
+
* block is homed on ANOTHER workspace.
|
|
5
|
+
*
|
|
6
|
+
* `mount` shares that service onto this board and answers with the frame homed elsewhere, which is
|
|
7
|
+
* right for the app: the SPA renders a COMPOSED board, so a mounted frame is one of its blocks.
|
|
8
|
+
*
|
|
9
|
+
* `refuse` is for a caller that can only address blocks homed HERE. The public API is the one
|
|
10
|
+
* that exists: every read on it is a workspace-scoped repository read (see `publicBoardReads`), so
|
|
11
|
+
* a foreign-homed frame id would come back from a 201 that no other endpoint on the surface can
|
|
12
|
+
* honour — `GET /api/v1/services` would not list it and `POST /api/v1/services/{id}/tasks` would
|
|
13
|
+
* 404 on it. Answering with an id like that is worse than refusing, because it reads as success.
|
|
14
|
+
*/
|
|
15
|
+
export type SharedServicePolicy = 'mount' | 'refuse';
|
|
16
|
+
/** How this create pins the new service to its repository, once every guard has passed. */
|
|
17
|
+
export interface ServiceRepoLinkage {
|
|
18
|
+
/** The repository's monorepo flag as it stands AFTER this create (the request's, or the stored one). */
|
|
19
|
+
isMonorepo: boolean;
|
|
20
|
+
/** The normalised subdirectory the service is pinned to; undefined for a whole-repo service. */
|
|
21
|
+
directory: string | undefined;
|
|
22
|
+
/** Whether {@link isMonorepo} differs from what is stored, so the projection has to be written. */
|
|
23
|
+
flagChanged: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Settle the repo linkage a create asks for, or throw the refusal that names what is wrong.
|
|
27
|
+
*
|
|
28
|
+
* Both halves of the monorepo rule are enforced, against the flag as it will stand after the call:
|
|
29
|
+
*
|
|
30
|
+
* - A monorepo service MUST name a subdirectory, or execution has nothing to scope agents to.
|
|
31
|
+
* - A whole-repo service must NOT name one. This half was the silent one: `resolveRepoTarget`
|
|
32
|
+
* reads a service's `directory` only when the repo is a monorepo, so a directory stored against
|
|
33
|
+
* a whole-repo service is ignored at dispatch and the agents run at the repository root, while
|
|
34
|
+
* the caller and the created service both say the work is pinned to a subdirectory. Refusing is
|
|
35
|
+
* the only honest answer, since neither reading of the request can be delivered.
|
|
36
|
+
*
|
|
37
|
+
* The request's own flag is what decides, and its ABSENCE means "leave the repository as it is"
|
|
38
|
+
* rather than "this is not a monorepo": a caller that names a directory without naming the flag is
|
|
39
|
+
* pinning a subdirectory of a repository somebody has already marked as a monorepo, which is the
|
|
40
|
+
* ordinary case, and reading the omission as `false` would refuse it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveServiceRepoLinkage(input: Pick<AddServiceFromRepoInput, 'directory' | 'isMonorepo'>, storedIsMonorepo: boolean): ServiceRepoLinkage;
|
|
43
|
+
/**
|
|
44
|
+
* Coerce a user-supplied monorepo service subdirectory into a clean, SAFE relative path
|
|
45
|
+
* (or undefined when absent/empty): normalise separators, drop `.`/empty segments, and
|
|
46
|
+
* reject any `..` segment or absolute path so the stored value can never escape the repo
|
|
47
|
+
* checkout when it later becomes an agent's cwd. Mirrors the harness's `sanitizeService
|
|
48
|
+
* Directory`, kept here so a bad value is rejected before the service row is written.
|
|
49
|
+
*/
|
|
50
|
+
export declare function normalizeServiceDirectory(raw: string | undefined): string | undefined;
|
|
51
|
+
//# sourceMappingURL=serviceRepoLinkage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceRepoLinkage.d.ts","sourceRoot":"","sources":["../../../src/modules/board/serviceRepoLinkage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAcrE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpD,2FAA2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,wGAAwG;IACxG,UAAU,EAAE,OAAO,CAAA;IACnB,gGAAgG;IAChG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,mGAAmG;IACnG,WAAW,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,YAAY,CAAC,EAChE,gBAAgB,EAAE,OAAO,GACxB,kBAAkB,CAepB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAYrF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ValidationError } from '@cat-factory/kernel';
|
|
2
|
+
/**
|
|
3
|
+
* Settle the repo linkage a create asks for, or throw the refusal that names what is wrong.
|
|
4
|
+
*
|
|
5
|
+
* Both halves of the monorepo rule are enforced, against the flag as it will stand after the call:
|
|
6
|
+
*
|
|
7
|
+
* - A monorepo service MUST name a subdirectory, or execution has nothing to scope agents to.
|
|
8
|
+
* - A whole-repo service must NOT name one. This half was the silent one: `resolveRepoTarget`
|
|
9
|
+
* reads a service's `directory` only when the repo is a monorepo, so a directory stored against
|
|
10
|
+
* a whole-repo service is ignored at dispatch and the agents run at the repository root, while
|
|
11
|
+
* the caller and the created service both say the work is pinned to a subdirectory. Refusing is
|
|
12
|
+
* the only honest answer, since neither reading of the request can be delivered.
|
|
13
|
+
*
|
|
14
|
+
* The request's own flag is what decides, and its ABSENCE means "leave the repository as it is"
|
|
15
|
+
* rather than "this is not a monorepo": a caller that names a directory without naming the flag is
|
|
16
|
+
* pinning a subdirectory of a repository somebody has already marked as a monorepo, which is the
|
|
17
|
+
* ordinary case, and reading the omission as `false` would refuse it.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveServiceRepoLinkage(input, storedIsMonorepo) {
|
|
20
|
+
const isMonorepo = input.isMonorepo ?? storedIsMonorepo;
|
|
21
|
+
const directory = normalizeServiceDirectory(input.directory);
|
|
22
|
+
if (isMonorepo && !directory) {
|
|
23
|
+
throw new ValidationError('Select a service directory for this monorepo', {
|
|
24
|
+
reason: 'monorepo_requires_directory',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!isMonorepo && directory) {
|
|
28
|
+
throw new ValidationError('A whole-repo service cannot name a directory; mark the repository as a monorepo to pin a subdirectory', { reason: 'directory_requires_monorepo' });
|
|
29
|
+
}
|
|
30
|
+
return { isMonorepo, directory, flagChanged: isMonorepo !== storedIsMonorepo };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Coerce a user-supplied monorepo service subdirectory into a clean, SAFE relative path
|
|
34
|
+
* (or undefined when absent/empty): normalise separators, drop `.`/empty segments, and
|
|
35
|
+
* reject any `..` segment or absolute path so the stored value can never escape the repo
|
|
36
|
+
* checkout when it later becomes an agent's cwd. Mirrors the harness's `sanitizeService
|
|
37
|
+
* Directory`, kept here so a bad value is rejected before the service row is written.
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeServiceDirectory(raw) {
|
|
40
|
+
if (!raw)
|
|
41
|
+
return undefined;
|
|
42
|
+
const segments = raw
|
|
43
|
+
.trim()
|
|
44
|
+
.replace(/\\/g, '/')
|
|
45
|
+
.split('/')
|
|
46
|
+
.filter((s) => s !== '' && s !== '.');
|
|
47
|
+
if (segments.length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
if (segments.some((s) => s === '..')) {
|
|
50
|
+
throw new ValidationError('Service directory must be a path inside the repository');
|
|
51
|
+
}
|
|
52
|
+
return segments.join('/');
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=serviceRepoLinkage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceRepoLinkage.js","sourceRoot":"","sources":["../../../src/modules/board/serviceRepoLinkage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CA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AAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Block, BlockRepository, Clock, GitHubRepo, GroupCacheHandle, RepoProjectionRepository, Service, ServiceRepository, WorkspaceMountRepository, WorkspaceRepository } from '@cat-factory/kernel';
|
|
2
|
+
import type { BoardChangeReason } from './board.logic.js';
|
|
3
|
+
import type { ServiceRepoLinkage, SharedServicePolicy } from './serviceRepoLinkage.js';
|
|
4
|
+
export interface SharedServiceMountDeps {
|
|
5
|
+
blockRepository: BlockRepository;
|
|
6
|
+
workspaceRepository: WorkspaceRepository;
|
|
7
|
+
clock: Clock;
|
|
8
|
+
/** Optional: in-org service sharing unwired means nothing to dedupe against. */
|
|
9
|
+
serviceRepository?: ServiceRepository;
|
|
10
|
+
/** Optional: without mounts a shared service cannot be placed on a second board. */
|
|
11
|
+
workspaceMountRepository?: WorkspaceMountRepository;
|
|
12
|
+
/** Optional: absent ⇒ no VCS integration, so no monorepo flag to write. */
|
|
13
|
+
repoProjectionRepository?: RepoProjectionRepository;
|
|
14
|
+
/** Optional projection cache, invalidated per workspace when the flag moves. */
|
|
15
|
+
repoProjectionCache?: GroupCacheHandle<GitHubRepo[]>;
|
|
16
|
+
/** The service's own board-event emitter, bound so the fan-out stays one implementation. */
|
|
17
|
+
emitBoardChanged(workspaceId: string, change: {
|
|
18
|
+
reason: BoardChangeReason;
|
|
19
|
+
blockId: string;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createSharedServiceMount(deps: SharedServiceMountDeps): {
|
|
23
|
+
findAccountWholeRepoService: (workspaceId: string, repoGithubId: number) => Promise<Service | null>;
|
|
24
|
+
mountExistingService: (workspaceId: string, service: Service, policy: SharedServicePolicy, position?: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}) => Promise<Block>;
|
|
28
|
+
persistMonorepoFlag: (workspaceId: string, repo: GitHubRepo, linkage: ServiceRepoLinkage) => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=sharedServiceMount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedServiceMount.d.ts","sourceRoot":"","sources":["../../../src/modules/board/sharedServiceMount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,wBAAwB,EACxB,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAWtF,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,eAAe,CAAA;IAChC,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,KAAK,EAAE,KAAK,CAAA;IACZ,gFAAgF;IAChF,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,oFAAoF;IACpF,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,2EAA2E;IAC3E,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAA;IACpD,4FAA4F;IAC5F,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB;+CAOpD,MAAM,gBACL,MAAM,KACnB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;wCAkBX,MAAM,WACV,OAAO,UACR,mBAAmB,aAChB;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAClC,OAAO,CAAC,KAAK,CAAC;uCA6DF,MAAM,QACb,UAAU,WACP,kBAAkB,KAC1B,OAAO,CAAC,IAAI,CAAC;EAWjB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { applyMountLayout, ValidationError } from '@cat-factory/kernel';
|
|
2
|
+
export function createSharedServiceMount(deps) {
|
|
3
|
+
/**
|
|
4
|
+
* The account's existing WHOLE-REPO (non-monorepo, no subdirectory) service for a repo, or null.
|
|
5
|
+
* Account-scoped so it dedups a shared repo across the org regardless of which installation each
|
|
6
|
+
* board reached it through. Requires the service repo to be wired.
|
|
7
|
+
*/
|
|
8
|
+
async function findAccountWholeRepoService(workspaceId, repoGithubId) {
|
|
9
|
+
if (!deps.serviceRepository)
|
|
10
|
+
return null;
|
|
11
|
+
const account = (await deps.workspaceRepository.accountOf(workspaceId)) ?? null;
|
|
12
|
+
const services = await deps.serviceRepository.listByAccount(account);
|
|
13
|
+
return services.find((s) => s.repoGithubId === repoGithubId && !s.directory) ?? null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Mount an EXISTING account-owned service onto `workspaceId` and return its frame block —
|
|
17
|
+
* the shared-service path taken by `addServiceFromRepo` when the repo already backs a
|
|
18
|
+
* service. Mounting (not re-creating) is how two boards in one org work on the same service
|
|
19
|
+
* with a shared subtree/task list. Same-org only; idempotent when already mounted here.
|
|
20
|
+
*
|
|
21
|
+
* `policy` decides what a service homed on ANOTHER board means to this caller: the app mounts
|
|
22
|
+
* it and renders it as part of the composed board, while a caller whose every read is
|
|
23
|
+
* workspace-scoped cannot address the returned frame at all. See {@link SharedServicePolicy}.
|
|
24
|
+
*/
|
|
25
|
+
async function mountExistingService(workspaceId, service, policy, position) {
|
|
26
|
+
if (!deps.workspaceMountRepository) {
|
|
27
|
+
throw new ValidationError('This repository is already linked to a board service');
|
|
28
|
+
}
|
|
29
|
+
// A service is shared strictly within its account — never mount one from another org.
|
|
30
|
+
const account = await deps.workspaceRepository.accountOf(workspaceId);
|
|
31
|
+
if ((account ?? null) !== (service.accountId ?? null)) {
|
|
32
|
+
throw new ValidationError('This repository is already linked to a service in another organization');
|
|
33
|
+
}
|
|
34
|
+
const home = await deps.blockRepository.findById(service.frameBlockId);
|
|
35
|
+
if (!home) {
|
|
36
|
+
// The service's frame block is gone (a stale orphan). Surface a clean error rather than
|
|
37
|
+
// mounting a dead frame; the delete cascade normally reclaims such orphans.
|
|
38
|
+
throw new ValidationError('This repository is already linked to a board service');
|
|
39
|
+
}
|
|
40
|
+
if (policy === 'refuse' && home.workspaceId !== workspaceId) {
|
|
41
|
+
// Refused BEFORE the mount is written: a caller that cannot address the frame gains nothing
|
|
42
|
+
// from the board silently acquiring a service it asked to CREATE, and would then have to
|
|
43
|
+
// undo a mount it never asked for through a surface that cannot see it.
|
|
44
|
+
throw new ValidationError('This repository already backs a service on another board in this organization', { reason: 'repo_service_homed_elsewhere' });
|
|
45
|
+
}
|
|
46
|
+
let mount = await deps.workspaceMountRepository.get(workspaceId, service.id);
|
|
47
|
+
if (!mount) {
|
|
48
|
+
const existingMounts = await deps.workspaceMountRepository.listByWorkspace(workspaceId);
|
|
49
|
+
// Lay a new mount out on a 5-wide grid (matching ServiceMountService) when no explicit
|
|
50
|
+
// position is given, so shared services don't pile onto the same point.
|
|
51
|
+
const n = existingMounts.length;
|
|
52
|
+
mount = {
|
|
53
|
+
workspaceId,
|
|
54
|
+
serviceId: service.id,
|
|
55
|
+
position: position ?? { x: 80 + (n % 5) * 48, y: 80 + Math.floor(n / 5) * 48 },
|
|
56
|
+
size: null,
|
|
57
|
+
createdAt: deps.clock.now(),
|
|
58
|
+
};
|
|
59
|
+
await deps.workspaceMountRepository.upsert(mount);
|
|
60
|
+
// Fan out from the frame's HOME so every board mounting the shared service refreshes. A
|
|
61
|
+
// FRAME, and each target board reads its own mount, so there is no payload to carry.
|
|
62
|
+
await deps.emitBoardChanged(home.workspaceId, {
|
|
63
|
+
reason: 'block-added',
|
|
64
|
+
blockId: home.block.id,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// The frame block is the one homed on ANOTHER board, carrying that board's coordinates —
|
|
68
|
+
// return it placed where THIS board just mounted it, or the SPA drops the imported service
|
|
69
|
+
// at the home board's spot until the next full refresh.
|
|
70
|
+
return applyMountLayout(home.block, mount);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Write the repository's monorepo flag, once the create it rides along with is going to happen.
|
|
74
|
+
*
|
|
75
|
+
* A no-op when the request asked for the flag already stored, which is the ordinary case: the
|
|
76
|
+
* app sends the flag with every add, and only the one that CHANGES it owes a write. Mutates the
|
|
77
|
+
* caller's `repo` alongside the row so the rest of the create reads one value.
|
|
78
|
+
*/
|
|
79
|
+
async function persistMonorepoFlag(workspaceId, repo, linkage) {
|
|
80
|
+
if (!linkage.flagChanged || !deps.repoProjectionRepository)
|
|
81
|
+
return;
|
|
82
|
+
await deps.repoProjectionRepository.setMonorepo(workspaceId, repo.githubId, linkage.isMonorepo);
|
|
83
|
+
repo.isMonorepo = linkage.isMonorepo;
|
|
84
|
+
// The monorepo flag decides whether `resolveRepoTarget` hands agents the service
|
|
85
|
+
// subdirectory, so drop the cached projection or a warmed entry keeps serving the
|
|
86
|
+
// old flag until its TTL — the agent would run at the repo root instead of the pin.
|
|
87
|
+
await deps.repoProjectionCache?.invalidateGroup(workspaceId);
|
|
88
|
+
}
|
|
89
|
+
return { findAccountWholeRepoService, mountExistingService, persistMonorepoFlag };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=sharedServiceMount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedServiceMount.js","sourceRoot":"","sources":["../../../src/modules/board/sharedServiceMount.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAgCvE,MAAM,UAAU,wBAAwB,CAAC,IAA4B;IACnE;;;;OAIG;IAC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;IAED;;;;;;OAMG;IACH,KAAK,UAAU,mBAAmB,CAChC,WAAmB,EACnB,IAAgB,EAChB,OAA2B;QAE3B,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,wBAAwB;YAAE,OAAM;QAClE,MAAM,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;QAC/F,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACpC,iFAAiF;QACjF,kFAAkF;QAClF,oFAAoF;QACpF,MAAM,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,WAAW,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAA;AACnF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentDispatchController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/AgentDispatchController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,eAAe,EACf,cAAc,EAEd,eAAe,EACf,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAA;IAC5B,eAAe,EAAE,eAAe,CAAA;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,cAAc,EAAE,mBAAmB,CAAA;IACnC,QAAQ,EAAE,sBAAsB,CAAA;IAChC,OAAO,EAAE,oBAAoB,CAAA;IAC7B,eAAe,EAAE,eAAe,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,2BAA2B,CAAC,EAAE,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,oBAAoB,CAAC,CAAA;IAClC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAA;IACjF,gBAAgB,EAAE,CAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,cAAc,KACnB,OAAO,CAAC,aAAa,CAAC,CAAA;CAC5B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,iBAAiB,EAAI;IAExD;;;;;;;;OAQG;IACG,eAAe,CACnB,GAAG,EAAE,kBAAkB,EACvB,YAAY,CAAC,EAAE,MAAM,EACrB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,GAClD,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"AgentDispatchController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/AgentDispatchController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,eAAe,EACf,cAAc,EAEd,eAAe,EACf,KAA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aAAa,CAAC,CAAA;CAC5B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,iBAAiB,EAAI;IAExD;;;;;;;;OAQG;IACG,eAAe,CACnB,GAAG,EAAE,kBAAkB,EACvB,YAAY,CAAC,EAAE,MAAM,EACrB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,GAClD,OAAO,CAAC,aAAa,CAAC,CAgJxB;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,wBAAwB;IAuBhC;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAa9B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAmB7B;;;;;;OAMG;IACH,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAQ1F;IAED;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO5E;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,uBAAuB,CAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GACvC,OAAO,CAAC,OAAO,CAAC,CAsClB;IAED;;;;;;OAMG;YACW,sBAAsB;IAqBpC;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAY9F;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getErrorMessage, isAsyncAgentExecutor, parseLocalModelId } from '@cat-factory/kernel';
|
|
2
2
|
import { PR_REVIEWER_KIND, resolvePrNumber } from '@cat-factory/agents';
|
|
3
|
-
import {
|
|
3
|
+
import { recordDispatchedJob } from './step-fold.logic.js';
|
|
4
4
|
import { classifyDispatchFailure } from './job.logic.js';
|
|
5
5
|
import { initialPrReviewState } from './prReview.logic.js';
|
|
6
6
|
/**
|
|
@@ -62,7 +62,10 @@ export class AgentDispatchController {
|
|
|
62
62
|
}
|
|
63
63
|
const executor = this.deps.agentExecutor;
|
|
64
64
|
if (isAsyncAgentExecutor(executor) && executor.runsAsync(context)) {
|
|
65
|
-
|
|
65
|
+
// Held as a local so the `awaiting_job` report below is a `string` on BOTH paths: this
|
|
66
|
+
// dispatch's own stamp, or the id a Workflows replay re-entered with.
|
|
67
|
+
let jobId = step.jobId;
|
|
68
|
+
if (!jobId) {
|
|
66
69
|
// The model is fixed the moment its ref resolves (block pin > workspace
|
|
67
70
|
// default > env routing) — long before the container is up — so name it on
|
|
68
71
|
// the very first "spinning up container" emit instead of waiting for the
|
|
@@ -97,8 +100,7 @@ export class AgentDispatchController {
|
|
|
97
100
|
// handle refines this block below with what only the dispatch knows (the repo it
|
|
98
101
|
// resolved, the model it confirmed).
|
|
99
102
|
this.beginDispatchDiagnostics(instance, context, step.model ?? null);
|
|
100
|
-
await this.deps.runStateMachine.
|
|
101
|
-
await this.deps.runStateMachine.emitInstance(workspaceId, instance);
|
|
103
|
+
await this.deps.runStateMachine.persistAndEmit(workspaceId, instance);
|
|
102
104
|
let handle;
|
|
103
105
|
try {
|
|
104
106
|
handle = await executor.startJob(context);
|
|
@@ -126,13 +128,10 @@ export class AgentDispatchController {
|
|
|
126
128
|
// carries it. The step's own failure fields are overwritten by a later retry of the
|
|
127
129
|
// step; this survives as the record of what the run's last dispatch attempted.
|
|
128
130
|
this.recordDispatchFailure(instance, classified);
|
|
129
|
-
await this.deps.runStateMachine.
|
|
130
|
-
await this.deps.runStateMachine.emitInstance(workspaceId, instance);
|
|
131
|
+
await this.deps.runStateMachine.persistAndEmit(workspaceId, instance);
|
|
131
132
|
return { kind: 'job_failed', ...classified };
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
// Record the model at dispatch — the poll site can't resolve it later.
|
|
135
|
-
recordDispatchAttribution(step, handle, context.agentKind);
|
|
134
|
+
jobId = recordDispatchedJob(step, handle, context.agentKind);
|
|
136
135
|
// Surface web-search availability + provider on the step (run details), resolved
|
|
137
136
|
// backend-side at dispatch. A static per-run fact, not gated by prompt telemetry.
|
|
138
137
|
if (handle.search)
|
|
@@ -142,13 +141,9 @@ export class AgentDispatchController {
|
|
|
142
141
|
// is unknown until the transport reports it on the first poll, so `pollAgentJob`
|
|
143
142
|
// fills that in then.
|
|
144
143
|
this.recordAcceptedDispatch(instance, handle);
|
|
145
|
-
|
|
146
|
-
// live phase + the container id/url arrive on the first poll.
|
|
147
|
-
step.container = { status: 'up' };
|
|
148
|
-
await this.deps.runStateMachine.casPersist(workspaceId, instance);
|
|
149
|
-
await this.deps.runStateMachine.emitInstance(workspaceId, instance);
|
|
144
|
+
await this.deps.runStateMachine.persistAndEmit(workspaceId, instance);
|
|
150
145
|
}
|
|
151
|
-
return { kind: 'awaiting_job', jobId
|
|
146
|
+
return { kind: 'awaiting_job', jobId, stepIndex: instance.currentStep };
|
|
152
147
|
}
|
|
153
148
|
// Inline path: the model is resolved before the (blocking) LLM call, so surface
|
|
154
149
|
// it now — the board names the model while the step is querying instead of only
|
|
@@ -167,8 +162,7 @@ export class AgentDispatchController {
|
|
|
167
162
|
// `failRun` re-reads the instance from storage. Gating this on the model having changed left
|
|
168
163
|
// the failure this block exists to explain with no diagnostics whenever the preview resolved
|
|
169
164
|
// nothing or resolved what the step already carried.
|
|
170
|
-
await this.deps.runStateMachine.
|
|
171
|
-
await this.deps.runStateMachine.emitInstance(workspaceId, instance);
|
|
165
|
+
await this.deps.runStateMachine.persistAndEmit(workspaceId, instance);
|
|
172
166
|
const result = await this.runAgent(context, options);
|
|
173
167
|
return this.deps.recordStepResult(workspaceId, instance, step, isFinalStep, result);
|
|
174
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentDispatchController.js","sourceRoot":"","sources":["../../../src/modules/execution/AgentDispatchController.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC9F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentDispatchController.js","sourceRoot":"","sources":["../../../src/modules/execution/AgentDispatchController.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC9F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAsC,MAAM,gBAAgB,CAAA;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAsC1D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,uBAAuB;IACL,IAAI;IAAjC,YAA6B,IAAuB;oBAAvB,IAAI;IAAsB,CAAC;IAExD;;;;;;;;OAQG;IACH,KAAK,CAAC,eAAe,CACnB,GAAuB,EACvB,YAAqB,EACrB,cAAmD;QAEnD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;QAExE,8EAA8E;QAC9E,4EAA4E;QAC5E,2EAA2E;QAC3E,8EAA8E;QAC9E,mDAAmD;QACnD,EAAE;QACF,uFAAuF;QACvF,sFAAsF;QACtF,yFAAyF;QACzF,2FAA2F;QAC3F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CACzD,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,KAAK,EACL;YACE,GA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K,CAAC,cAAc,IAAI,SAAS,CAAC,CAAA;QACnE,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,CAAA;QACjC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;YAC9E,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAA;YAChD,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAA;YACzB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,CACtC,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,EAClD,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CACxB,CAAA;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAwB,EAAE,OAAO,GAAmB,EAAE;QACnE,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0EAA0E;YAC1E,0EAA0E;YAC1E,IAAI,OAAO,CAAC,kBAAkB;gBAAE,MAAM,KAAK,CAAA;YAC3C,wEAAwE;YACxE,OAAO;gBACL,MAAM,EAAE,gBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE;aACjD,CAAA;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompanionController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/CompanionController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM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,iBAAiB,EAC3B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAkCxB;IAED;;;;;;;;OAQG;IACG,uBAAuB,CAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,aAAa,CAAC,CASxB;IAED,wFAAwF;IACxF,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;;;;;;;;OAgBG;YACW,eAAe;IAwG7B;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAgD9B;;;;;OAKG;YACW,sBAAsB;IA+
|
|
1
|
+
{"version":3,"file":"CompanionController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/CompanionController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAyC/C;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,KAAK,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YACW,sBAAsB;IA+CpC;;;;;;;;;OASG;YACW,aAAa;CAiB5B"}
|
|
@@ -217,9 +217,9 @@ export class CompanionController {
|
|
|
217
217
|
feedback: assessment?.summary ?? '',
|
|
218
218
|
...(assessment?.comments?.length ? { comments: assessment.comments } : {}),
|
|
219
219
|
});
|
|
220
|
-
await this.deps.stateMachine.
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
await this.deps.stateMachine.persistAndEmit(workspaceId, instance, {
|
|
221
|
+
blockStatus: 'in_progress',
|
|
222
|
+
});
|
|
223
223
|
return { kind: 'continue' };
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
@@ -299,27 +299,10 @@ export class CompanionController {
|
|
|
299
299
|
step.approval = buildStepApproval(step, this.deps.idGenerator.next('appr'), producer?.output ?? step.output ?? '');
|
|
300
300
|
this.deps.stepGraph.pauseStepForInput(step);
|
|
301
301
|
instance.status = 'blocked';
|
|
302
|
-
await this.deps.stateMachine.
|
|
303
|
-
await this.deps.stateMachine.casPersist(workspaceId, instance);
|
|
304
|
-
await this.deps.stateMachine.emitInstance(workspaceId, instance);
|
|
302
|
+
await this.deps.stateMachine.persistAndEmit(workspaceId, instance, { blockStatus: 'blocked' });
|
|
305
303
|
return { kind: 'awaiting_decision', decisionId: step.approval.id };
|
|
306
304
|
}
|
|
307
|
-
|
|
308
|
-
instance.status = 'done';
|
|
309
|
-
await this.deps.stateMachine.finalizeBlock(workspaceId, instance, undefined);
|
|
310
|
-
await this.deps.stateMachine.casPersist(workspaceId, instance);
|
|
311
|
-
await this.deps.stateMachine.emitInstance(workspaceId, instance);
|
|
312
|
-
await this.deps.stateMachine.stopRunContainer(workspaceId, instance);
|
|
313
|
-
return { kind: 'done' };
|
|
314
|
-
}
|
|
315
|
-
instance.currentStep += 1;
|
|
316
|
-
const next = instance.steps[instance.currentStep];
|
|
317
|
-
if (next)
|
|
318
|
-
this.deps.stepGraph.startStep(next);
|
|
319
|
-
await this.deps.stateMachine.updateBlockProgress(workspaceId, instance, 'in_progress');
|
|
320
|
-
await this.deps.stateMachine.casPersist(workspaceId, instance);
|
|
321
|
-
await this.deps.stateMachine.emitInstance(workspaceId, instance);
|
|
322
|
-
return { kind: 'continue' };
|
|
305
|
+
return this.deps.stateMachine.settleStepAndAdvance(workspaceId, instance, isFinalStep);
|
|
323
306
|
}
|
|
324
307
|
/**
|
|
325
308
|
* Run a companion step and parse its JSON verdict, with ONE repair retry when the
|