@leitwerk-dev/worker 0.5.11 → 0.5.12
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/{chunk-OJ2YL4ZP.js → chunk-CY5MQV4X.js} +98 -147
- package/dist/chunk-CY5MQV4X.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/runtime/bootstrap.d.ts.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/worker-entry.js +1 -1
- package/dist/workspace/checkout-tool.d.ts +2 -2
- package/dist/workspace/checkout-tool.d.ts.map +1 -1
- package/dist/workspace/manifest.d.ts +0 -7
- package/dist/workspace/manifest.d.ts.map +1 -1
- package/dist/workspace/node-run-root-git-ops.d.ts +4 -2
- package/dist/workspace/node-run-root-git-ops.d.ts.map +1 -1
- package/dist/workspace/run-root.d.ts +12 -13
- package/dist/workspace/run-root.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/runtime/bootstrap.ts +10 -8
- package/src/runtime/index.ts +4 -0
- package/src/workspace/checkout-tool.ts +12 -13
- package/src/workspace/manifest.ts +0 -45
- package/src/workspace/node-run-root-git-ops.ts +45 -18
- package/src/workspace/run-root.ts +73 -112
- package/dist/chunk-OJ2YL4ZP.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,cAAc,EAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EACX,+BAA+B,EAC/B,uBAAuB,EACvB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EACX,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,KAAK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,EAAE,uBAAuB,CAAC;CACpC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAwBzC;AAED,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,0BAA0B,GAC9B,OAAO,CAAC,4BAA4B,CAAC,CAuSvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAsB,MAAM,eAAe,CAAC;AAmB9E,OAAO,EACN,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC3B,MAAM,eAAe,CAAC;AAEvB,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC7B,gBAAgB;IAChB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,gBAAgB;IAChB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAsB,MAAM,eAAe,CAAC;AAmB9E,OAAO,EACN,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC3B,MAAM,eAAe,CAAC;AAEvB,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC7B,gBAAgB;IAChB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,gBAAgB;IAChB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA6ahF"}
|
package/dist/worker-entry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProcessProject } from "@leitwerk-dev/domain";
|
|
2
2
|
import type { PiCustomTool } from "@leitwerk-dev/process-sdk";
|
|
3
|
-
import { type RunRootGitOps } from "./run-root.js";
|
|
3
|
+
import { type RunRootGitOps, type RunRootPlan } from "./run-root.js";
|
|
4
4
|
/** @internal */
|
|
5
|
-
export declare function createCheckoutTool(workspaceRoot: string, instanceId: string, projects: readonly ProcessProject[], git: RunRootGitOps): PiCustomTool;
|
|
5
|
+
export declare function createCheckoutTool(workspaceRoot: string, instanceId: string, projects: readonly ProcessProject[], git: RunRootGitOps, submodules?: RunRootPlan["submodules"]): PiCustomTool;
|
|
6
6
|
//# sourceMappingURL=checkout-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-tool.d.ts","sourceRoot":"","sources":["../../src/workspace/checkout-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"checkout-tool.d.ts","sourceRoot":"","sources":["../../src/workspace/checkout-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,MAAM,eAAe,CAAC;AAEvB,gBAAgB;AAChB,wBAAgB,kBAAkB,CACjC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,GAAG,EAAE,aAAa,EAClB,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,GACpC,YAAY,CAiDd"}
|
|
@@ -16,12 +16,6 @@ export interface ComponentManifestEntry extends ComponentCheckoutPlan {
|
|
|
16
16
|
/** Exact read-only checkout requested by a process preparation. */
|
|
17
17
|
revision?: string;
|
|
18
18
|
}
|
|
19
|
-
export interface ManifestDiff {
|
|
20
|
-
stale: string[];
|
|
21
|
-
missing: string[];
|
|
22
|
-
extra: string[];
|
|
23
|
-
unchanged: string[];
|
|
24
|
-
}
|
|
25
19
|
export declare function serializeManifest(manifest: ComponentManifest): string;
|
|
26
20
|
export declare function deserializeManifest(content: string): {
|
|
27
21
|
ok: true;
|
|
@@ -30,5 +24,4 @@ export declare function deserializeManifest(content: string): {
|
|
|
30
24
|
ok: false;
|
|
31
25
|
error: string;
|
|
32
26
|
};
|
|
33
|
-
export declare function diffManifest(existing: ComponentManifest, serverProjects: ComponentCheckoutPlan[]): ManifestDiff;
|
|
34
27
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/workspace/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/workspace/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAErE;AAgDD,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,MAAM,GACb;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAM1E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { prepareRepositorySubmodules } from "@leitwerk-dev/process-sdk";
|
|
1
2
|
import type { WorkerRepositoryCredential } from "@leitwerk-dev/worker-protocol";
|
|
2
3
|
import type { RunRootGitOps } from "./run-root.js";
|
|
3
4
|
export declare class NodeRunRootGitOps implements RunRootGitOps {
|
|
@@ -8,11 +9,12 @@ export declare class NodeRunRootGitOps implements RunRootGitOps {
|
|
|
8
9
|
writeFile(repoDir: string, filePath: string, content: string): Promise<void>;
|
|
9
10
|
readFile(repoDir: string, filePath: string): Promise<string | null>;
|
|
10
11
|
clone(repoLocator: string, targetDir: string): Promise<void>;
|
|
12
|
+
prepareSubmodules: typeof prepareRepositorySubmodules;
|
|
11
13
|
checkout(repoDir: string, branch: string): Promise<void>;
|
|
12
|
-
checkoutRevision(repoDir: string, revision: string): Promise<
|
|
14
|
+
checkoutRevision(repoDir: string, revision: string, preserveSubmodules?: boolean): Promise<string>;
|
|
13
15
|
createBranch(repoDir: string, branchName: string, startPoint: string): Promise<void>;
|
|
14
16
|
branchExists(repoDir: string, branchName: string): Promise<boolean>;
|
|
15
17
|
getHeadSha(repoDir: string): Promise<string>;
|
|
16
|
-
listFiles(repoDir: string,
|
|
18
|
+
listFiles(repoDir: string, patterns: string[], excludeSubmodules?: boolean): Promise<string[]>;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=node-run-root-git-ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-run-root-git-ops.d.ts","sourceRoot":"","sources":["../../src/workspace/node-run-root-git-ops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-run-root-git-ops.d.ts","sourceRoot":"","sources":["../../src/workspace/node-run-root-git-ops.ts"],"names":[],"mappings":"AAWA,OAAO,EAGN,2BAA2B,EAM3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAGhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,qBAAa,iBAAkB,YAAW,aAAa;;IAGtD,8BAA8B,CAAC,WAAW,EAAE,SAAS,0BAA0B,EAAE,GAAG,IAAI;IA6CxF,4BAA4B,IAAI,IAAI;YAOtB,MAAM;IAcd,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5E,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQnE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWlE,iBAAiB,qCAA+B;IAE1C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,gBAAgB,CACrB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,kBAAkB,UAAQ,GACxB,OAAO,CAAC,MAAM,CAAC;IAiCZ,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYnE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI5C,SAAS,CACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,EAClB,iBAAiB,UAAQ,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC;CAcpB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type ComponentCheckoutPlan, type ComponentManifest
|
|
1
|
+
import { type ComponentCheckoutPlan, type ComponentManifest } from "./manifest.js";
|
|
2
2
|
/** @internal */
|
|
3
3
|
export interface GitOps {
|
|
4
4
|
/** @internal */
|
|
5
5
|
clone(repoLocator: string, targetDir: string): Promise<void>;
|
|
6
6
|
/** @internal */
|
|
7
7
|
checkout(repoDir: string, branch: string): Promise<void>;
|
|
8
|
-
/** Refuse dirty worktrees
|
|
9
|
-
checkoutRevision?(repoDir: string, revision: string): Promise<
|
|
8
|
+
/** Refuse dirty worktrees, pin an exact commit, and return the verified SHA. @internal */
|
|
9
|
+
checkoutRevision?(repoDir: string, revision: string, preserveSubmodules?: boolean): Promise<string>;
|
|
10
10
|
/** @internal */
|
|
11
11
|
createBranch(repoDir: string, branchName: string, startPoint: string): Promise<void>;
|
|
12
12
|
/** @internal */
|
|
@@ -16,7 +16,9 @@ export interface GitOps {
|
|
|
16
16
|
/** @internal */
|
|
17
17
|
readFile(repoDir: string, filePath: string): Promise<string | null>;
|
|
18
18
|
/** @internal */
|
|
19
|
-
listFiles(repoDir: string,
|
|
19
|
+
listFiles(repoDir: string, patterns: string[], excludeSubmodules?: boolean): Promise<string[]>;
|
|
20
|
+
/** @internal */
|
|
21
|
+
prepareSubmodules(projectKey: string, repoDir: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
20
22
|
}
|
|
21
23
|
/** @internal */
|
|
22
24
|
export type RunRootGitOps = GitOps & {
|
|
@@ -31,25 +33,22 @@ export interface RunRootPlan {
|
|
|
31
33
|
workspaceRoot: string;
|
|
32
34
|
instanceId: string;
|
|
33
35
|
components: ComponentCheckoutPlan[];
|
|
36
|
+
submodules?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
};
|
|
34
39
|
}
|
|
35
40
|
export interface MaterializeResult {
|
|
36
41
|
manifest: ComponentManifest;
|
|
37
42
|
aggregatedAgentsMdSources: string[];
|
|
38
43
|
loadedSkills: string[];
|
|
39
|
-
|
|
40
|
-
export interface ValidationResult {
|
|
41
|
-
valid: boolean;
|
|
42
|
-
diff: ManifestDiff;
|
|
43
|
-
existingManifest: ComponentManifest | null;
|
|
44
|
+
submoduleWarnings?: string[];
|
|
44
45
|
}
|
|
45
46
|
export declare class RunRootPreparationError extends Error {
|
|
46
47
|
readonly errors: readonly string[];
|
|
47
48
|
constructor(errors: readonly string[]);
|
|
48
49
|
}
|
|
49
|
-
export declare function planRunRoot(workspaceRoot: string, instanceId: string, projectSnapshots: ComponentCheckoutPlan[]): RunRootPlan;
|
|
50
|
-
export declare function materializeRunRoot(plan: RunRootPlan, git: RunRootGitOps): Promise<MaterializeResult>;
|
|
50
|
+
export declare function planRunRoot(workspaceRoot: string, instanceId: string, projectSnapshots: ComponentCheckoutPlan[], submodules?: RunRootPlan["submodules"]): RunRootPlan;
|
|
51
51
|
/** @internal */
|
|
52
52
|
export declare function prepareOnDemandRunRoot(plan: RunRootPlan, git: RunRootGitOps, projectKey?: string, revision?: string): Promise<MaterializeResult>;
|
|
53
|
-
export declare function
|
|
54
|
-
export declare function repairRunRoot(validation: ValidationResult, plan: RunRootPlan, git: RunRootGitOps): Promise<MaterializeResult>;
|
|
53
|
+
export declare function materializeRunRoot(plan: RunRootPlan, git: RunRootGitOps, resume?: boolean): Promise<MaterializeResult>;
|
|
55
54
|
//# sourceMappingURL=run-root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-root.d.ts","sourceRoot":"","sources":["../../src/workspace/run-root.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAItB,
|
|
1
|
+
{"version":3,"file":"run-root.d.ts","sourceRoot":"","sources":["../../src/workspace/run-root.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAItB,MAAM,eAAe,CAAC;AAGvB,gBAAgB;AAChB,MAAM,WAAW,MAAM;IACtB,gBAAgB;IAChB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,gBAAgB;IAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,0FAA0F;IAC1F,gBAAgB,CAAC,CAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,gBAAgB;IAChB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UA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AE,WAAW,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,yBAAyB,EAAE,MAAM,EAAE,CAAC;IACpC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;gBAEvB,MAAM,EAAE,SAAS,MAAM,EAAE;CAKrC;AAwBD,wBAAgB,WAAW,CAC1B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,qBAAqB,EAAE,EACzC,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,GACpC,WAAW,CAOb;AA+JD,gBAAgB;AAChB,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,aAAa,EAClB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,CAAC,CAiB5B;AAQD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,UAAQ,8BAM7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/worker",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@earendil-works/pi-ai": "^1.7.0",
|
|
27
27
|
"@earendil-works/pi-coding-agent": "^1.7.0",
|
|
28
|
-
"@leitwerk-dev/domain": "0.5.
|
|
29
|
-
"@leitwerk-dev/extension-runtime": "0.5.
|
|
30
|
-
"@leitwerk-dev/process-sdk": "0.5.
|
|
31
|
-
"@leitwerk-dev/protocol": "0.5.
|
|
32
|
-
"@leitwerk-dev/watcher-utils": "0.5.
|
|
33
|
-
"@leitwerk-dev/worker-protocol": "0.5.
|
|
28
|
+
"@leitwerk-dev/domain": "0.5.12",
|
|
29
|
+
"@leitwerk-dev/extension-runtime": "0.5.12",
|
|
30
|
+
"@leitwerk-dev/process-sdk": "0.5.12",
|
|
31
|
+
"@leitwerk-dev/protocol": "0.5.12",
|
|
32
|
+
"@leitwerk-dev/watcher-utils": "0.5.12",
|
|
33
|
+
"@leitwerk-dev/worker-protocol": "0.5.12",
|
|
34
34
|
"execa": "^9.6.1",
|
|
35
35
|
"fast-glob": "^3.3.3",
|
|
36
36
|
"valibot": "^1.3.1"
|
package/src/runtime/bootstrap.ts
CHANGED
|
@@ -56,8 +56,6 @@ import {
|
|
|
56
56
|
planRunRoot,
|
|
57
57
|
prepareOnDemandRunRoot,
|
|
58
58
|
type RunRootGitOps,
|
|
59
|
-
repairRunRoot,
|
|
60
|
-
validateRunRoot,
|
|
61
59
|
} from "../workspace/run-root.js";
|
|
62
60
|
import type { WorkerRuntimeScheduler } from "./adapters.js";
|
|
63
61
|
|
|
@@ -462,7 +460,14 @@ export async function bootstrapWorkerRuntime(
|
|
|
462
460
|
baseBranch: project.baseBranch,
|
|
463
461
|
workBranch: project.workBranch ?? "",
|
|
464
462
|
}));
|
|
465
|
-
const plan = planRunRoot(
|
|
463
|
+
const plan = planRunRoot(
|
|
464
|
+
workspaceRoot,
|
|
465
|
+
deps.instanceId,
|
|
466
|
+
runRootProjects,
|
|
467
|
+
resolvedWorkerProcess?.runtime?.repositorySubmodules === "best_effort"
|
|
468
|
+
? { signal: deps.toolPreparationSignal }
|
|
469
|
+
: undefined,
|
|
470
|
+
);
|
|
466
471
|
|
|
467
472
|
const runRootPreparation =
|
|
468
473
|
resolvedWorkerProcess?.runtime?.repositoryCheckout === "none"
|
|
@@ -472,11 +477,7 @@ export async function bootstrapWorkerRuntime(
|
|
|
472
477
|
}))
|
|
473
478
|
: resolvedWorkerProcess?.runtime?.repositoryCheckout === "on_demand"
|
|
474
479
|
? prepareOnDemandRunRoot(plan, deps.gitOps)
|
|
475
|
-
: deps.payload.resume
|
|
476
|
-
? validateRunRoot(workspaceRoot, runRootProjects, deps.gitOps).then((validation) =>
|
|
477
|
-
repairRunRoot(validation, plan, deps.gitOps),
|
|
478
|
-
)
|
|
479
|
-
: materializeRunRoot(plan, deps.gitOps);
|
|
480
|
+
: materializeRunRoot(plan, deps.gitOps, deps.payload.resume);
|
|
480
481
|
|
|
481
482
|
const resolvedPiConfig = llmPayload
|
|
482
483
|
? resolveProcessPiConfig({
|
|
@@ -504,6 +505,7 @@ export async function bootstrapWorkerRuntime(
|
|
|
504
505
|
let loadedSkillFiles: Array<{ name: string; path: string }> = [];
|
|
505
506
|
let receipt: WorkerBootstrapReceipt;
|
|
506
507
|
const runRoot = await runRootPreparation;
|
|
508
|
+
if ("submoduleWarnings" in runRoot) diagnostics.push(...(runRoot.submoduleWarnings ?? []));
|
|
507
509
|
let preparedTools: PreparedToolEnvironment | undefined;
|
|
508
510
|
if (resolvedWorkerProcess?.runtime?.developmentTools) {
|
|
509
511
|
if (!deps.payload.developmentTools) {
|
package/src/runtime/index.ts
CHANGED
|
@@ -270,6 +270,10 @@ export function createWorkerRuntime(options: WorkerRuntimeOptions): WorkerRuntim
|
|
|
270
270
|
command.session.processSnapshot.id,
|
|
271
271
|
command.session.projectSnapshots,
|
|
272
272
|
adapters.gitOps,
|
|
273
|
+
command.session.resolvedWorkerProcess.runtime?.repositorySubmodules ===
|
|
274
|
+
"best_effort"
|
|
275
|
+
? { signal }
|
|
276
|
+
: undefined,
|
|
273
277
|
),
|
|
274
278
|
]
|
|
275
279
|
: []),
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import type { ProcessProject } from "@leitwerk-dev/domain";
|
|
3
3
|
import type { PiCustomTool } from "@leitwerk-dev/process-sdk";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
planRunRoot,
|
|
6
|
+
prepareOnDemandRunRoot,
|
|
7
|
+
type RunRootGitOps,
|
|
8
|
+
type RunRootPlan,
|
|
9
|
+
} from "./run-root.js";
|
|
5
10
|
|
|
6
11
|
/** @internal */
|
|
7
12
|
export function createCheckoutTool(
|
|
@@ -9,6 +14,7 @@ export function createCheckoutTool(
|
|
|
9
14
|
instanceId: string,
|
|
10
15
|
projects: readonly ProcessProject[],
|
|
11
16
|
git: RunRootGitOps,
|
|
17
|
+
submodules?: RunRootPlan["submodules"],
|
|
12
18
|
): PiCustomTool {
|
|
13
19
|
return {
|
|
14
20
|
name: "checkout_repository",
|
|
@@ -29,11 +35,7 @@ export function createCheckoutTool(
|
|
|
29
35
|
executionMode: "sequential",
|
|
30
36
|
async execute(args) {
|
|
31
37
|
if (typeof args.projectKey !== "string") throw new Error("projectKey is required");
|
|
32
|
-
if (
|
|
33
|
-
args.revision !== undefined &&
|
|
34
|
-
(typeof args.revision !== "string" ||
|
|
35
|
-
!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(args.revision))
|
|
36
|
-
)
|
|
38
|
+
if (args.revision !== undefined && typeof args.revision !== "string")
|
|
37
39
|
throw new Error("Use a captured full commit SHA");
|
|
38
40
|
const plan = planRunRoot(
|
|
39
41
|
workspaceRoot,
|
|
@@ -44,13 +46,9 @@ export function createCheckoutTool(
|
|
|
44
46
|
baseBranch: project.baseBranch,
|
|
45
47
|
workBranch: project.workBranch || project.baseBranch,
|
|
46
48
|
})),
|
|
49
|
+
submodules,
|
|
47
50
|
);
|
|
48
|
-
const result = await prepareOnDemandRunRoot(
|
|
49
|
-
plan,
|
|
50
|
-
git,
|
|
51
|
-
args.projectKey,
|
|
52
|
-
args.revision as string | undefined,
|
|
53
|
-
);
|
|
51
|
+
const result = await prepareOnDemandRunRoot(plan, git, args.projectKey, args.revision);
|
|
54
52
|
const entry = result.manifest.components.find(
|
|
55
53
|
(component) => component.key === args.projectKey,
|
|
56
54
|
);
|
|
@@ -58,8 +56,9 @@ export function createCheckoutTool(
|
|
|
58
56
|
const repositoryPath = path.join(workspaceRoot, entry.key);
|
|
59
57
|
return {
|
|
60
58
|
...entry,
|
|
61
|
-
headSha: await git.getHeadSha(repositoryPath),
|
|
59
|
+
headSha: entry.revision ? entry.headSha : await git.getHeadSha(repositoryPath),
|
|
62
60
|
path: repositoryPath,
|
|
61
|
+
...(result.submoduleWarnings ? { warnings: result.submoduleWarnings } : {}),
|
|
63
62
|
instructions:
|
|
64
63
|
"Read this repository's AGENTS.md before inspection; revalidate any wiki guidance against this revision. This checkout is retained, not automatically updated to the remote head.",
|
|
65
64
|
};
|
|
@@ -21,13 +21,6 @@ export interface ComponentManifestEntry extends ComponentCheckoutPlan {
|
|
|
21
21
|
revision?: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface ManifestDiff {
|
|
25
|
-
stale: string[];
|
|
26
|
-
missing: string[];
|
|
27
|
-
extra: string[];
|
|
28
|
-
unchanged: string[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
24
|
export function serializeManifest(manifest: ComponentManifest): string {
|
|
32
25
|
return JSON.stringify(manifest, null, 2);
|
|
33
26
|
}
|
|
@@ -87,41 +80,3 @@ export function deserializeManifest(
|
|
|
87
80
|
}
|
|
88
81
|
return { ok: true, manifest: result.output };
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
export function diffManifest(
|
|
92
|
-
existing: ComponentManifest,
|
|
93
|
-
serverProjects: ComponentCheckoutPlan[],
|
|
94
|
-
): ManifestDiff {
|
|
95
|
-
const stale: string[] = [];
|
|
96
|
-
const missing: string[] = [];
|
|
97
|
-
const extra: string[] = [];
|
|
98
|
-
const unchanged: string[] = [];
|
|
99
|
-
|
|
100
|
-
const byKey = new Map(existing.components.map((c) => [c.key, c]));
|
|
101
|
-
const serverByKey = new Map(serverProjects.map((p) => [p.key, p]));
|
|
102
|
-
|
|
103
|
-
for (const p of serverProjects) {
|
|
104
|
-
const m = byKey.get(p.key);
|
|
105
|
-
if (!m) {
|
|
106
|
-
missing.push(p.key);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (
|
|
110
|
-
m.repoLocator === p.repoLocator &&
|
|
111
|
-
m.baseBranch === p.baseBranch &&
|
|
112
|
-
m.workBranch === p.workBranch
|
|
113
|
-
) {
|
|
114
|
-
unchanged.push(p.key);
|
|
115
|
-
} else {
|
|
116
|
-
stale.push(p.key);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
for (const c of existing.components) {
|
|
121
|
-
if (!serverByKey.has(c.key)) {
|
|
122
|
-
extra.push(c.key);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return { stale, missing, extra, unchanged };
|
|
127
|
-
}
|
|
@@ -12,6 +12,7 @@ import path from "node:path";
|
|
|
12
12
|
import {
|
|
13
13
|
clearRepositoryGitHttpsHelpers,
|
|
14
14
|
clearRepositoryGitSshWrappers,
|
|
15
|
+
prepareRepositorySubmodules,
|
|
15
16
|
repositoryGitArgs,
|
|
16
17
|
repositoryGitSubprocessEnv,
|
|
17
18
|
repositoryHttpsUrl,
|
|
@@ -118,14 +119,34 @@ export class NodeRunRootGitOps implements RunRootGitOps {
|
|
|
118
119
|
);
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
prepareSubmodules = prepareRepositorySubmodules;
|
|
123
|
+
|
|
121
124
|
async checkout(repoDir: string, branch: string): Promise<void> {
|
|
122
|
-
await this.runGit(["checkout", branch], repoDir);
|
|
125
|
+
await this.runGit(["checkout", "--no-recurse-submodules", branch], repoDir);
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
async checkoutRevision(
|
|
128
|
+
async checkoutRevision(
|
|
129
|
+
repoDir: string,
|
|
130
|
+
revision: string,
|
|
131
|
+
preserveSubmodules = false,
|
|
132
|
+
): Promise<string> {
|
|
126
133
|
if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(revision))
|
|
127
134
|
throw new Error("Use a captured full commit SHA");
|
|
128
|
-
|
|
135
|
+
const status = await this.runGit(
|
|
136
|
+
[
|
|
137
|
+
"status",
|
|
138
|
+
"--porcelain",
|
|
139
|
+
"--untracked-files=all",
|
|
140
|
+
...(preserveSubmodules ? ["--ignore-submodules=all"] : []),
|
|
141
|
+
],
|
|
142
|
+
repoDir,
|
|
143
|
+
);
|
|
144
|
+
// In best-effort mode a mismatched child must not prevent reusing the
|
|
145
|
+
// parent checkout, but a staged gitlink is still a parent change.
|
|
146
|
+
const staged = preserveSubmodules
|
|
147
|
+
? await this.runGit(["diff", "--cached", "--name-only", "--ignore-submodules=none"], repoDir)
|
|
148
|
+
: "";
|
|
149
|
+
if (status.trim() || staged.trim())
|
|
129
150
|
throw new Error(
|
|
130
151
|
"Repository has local changes; preserve or remove them before retrying inspection",
|
|
131
152
|
);
|
|
@@ -134,9 +155,11 @@ export class NodeRunRootGitOps implements RunRootGitOps {
|
|
|
134
155
|
} catch {
|
|
135
156
|
await this.runGit(["fetch", "origin", revision], repoDir, path.basename(repoDir));
|
|
136
157
|
}
|
|
137
|
-
await this.runGit(["checkout", "--detach", revision], repoDir);
|
|
138
|
-
|
|
158
|
+
await this.runGit(["checkout", "--no-recurse-submodules", "--detach", revision], repoDir);
|
|
159
|
+
const head = await this.getHeadSha(repoDir);
|
|
160
|
+
if (head.toLowerCase() !== revision.toLowerCase())
|
|
139
161
|
throw new Error("Checkout HEAD does not match captured commit");
|
|
162
|
+
return head;
|
|
140
163
|
}
|
|
141
164
|
|
|
142
165
|
async createBranch(repoDir: string, branchName: string, startPoint: string): Promise<void> {
|
|
@@ -159,19 +182,23 @@ export class NodeRunRootGitOps implements RunRootGitOps {
|
|
|
159
182
|
return (await this.runGit(["rev-parse", "HEAD"], repoDir)).trim();
|
|
160
183
|
}
|
|
161
184
|
|
|
162
|
-
async listFiles(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
async listFiles(
|
|
186
|
+
repoDir: string,
|
|
187
|
+
patterns: string[],
|
|
188
|
+
excludeSubmodules = false,
|
|
189
|
+
): Promise<string[]> {
|
|
190
|
+
const cwd = path.resolve(repoDir);
|
|
191
|
+
if (!existsSync(cwd)) return [];
|
|
192
|
+
const files = await fg(patterns, { cwd, dot: true, onlyFiles: true, ignore: ["**/.git/**"] });
|
|
193
|
+
const index = excludeSubmodules ? await this.runGit(["ls-files", "--stage", "-z"], cwd) : "";
|
|
194
|
+
const gitlinks = index
|
|
195
|
+
.split("\0")
|
|
196
|
+
.flatMap((entry) =>
|
|
197
|
+
entry.startsWith("160000 ") ? [`${entry.slice(entry.indexOf("\t") + 1)}/`] : [],
|
|
198
|
+
);
|
|
199
|
+
return files
|
|
200
|
+
.filter((file) => !gitlinks.some((link) => file.startsWith(link)))
|
|
201
|
+
.sort((a, b) => a.localeCompare(b));
|
|
175
202
|
}
|
|
176
203
|
}
|
|
177
204
|
|