@warpgogol/forge 10.0.0 → 10.1.1
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/CHANGELOG.md +27 -0
- package/bin/cli.ts +17 -0
- package/dist/bin/cli.js +17 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/rfc/probe-batch.d.ts.map +1 -1
- package/dist/os/rfc/probe-batch.js +13 -6
- package/dist/os/rfc/probe-batch.js.map +1 -1
- package/dist/src/contract/core-nodes.d.ts +8 -0
- package/dist/src/contract/core-nodes.d.ts.map +1 -0
- package/dist/src/contract/core-nodes.js +101 -0
- package/dist/src/contract/core-nodes.js.map +1 -0
- package/dist/src/contract/evaluator.d.ts +48 -0
- package/dist/src/contract/evaluator.d.ts.map +1 -0
- package/dist/src/contract/evaluator.js +158 -0
- package/dist/src/contract/evaluator.js.map +1 -0
- package/dist/src/contract/evidence-store.d.ts +17 -0
- package/dist/src/contract/evidence-store.d.ts.map +1 -0
- package/dist/src/contract/evidence-store.js +113 -0
- package/dist/src/contract/evidence-store.js.map +1 -0
- package/dist/src/contract/executors/zero-deps.d.ts +3 -0
- package/dist/src/contract/executors/zero-deps.d.ts.map +1 -0
- package/dist/src/contract/executors/zero-deps.js +88 -0
- package/dist/src/contract/executors/zero-deps.js.map +1 -0
- package/dist/src/contract/fingerprint.d.ts +34 -0
- package/dist/src/contract/fingerprint.d.ts.map +1 -0
- package/dist/src/contract/fingerprint.js +153 -0
- package/dist/src/contract/fingerprint.js.map +1 -0
- package/dist/src/contract/graph.d.ts +23 -0
- package/dist/src/contract/graph.d.ts.map +1 -0
- package/dist/src/contract/graph.js +158 -0
- package/dist/src/contract/graph.js.map +1 -0
- package/dist/src/contract/migration-map.d.ts +51 -0
- package/dist/src/contract/migration-map.d.ts.map +1 -0
- package/dist/src/contract/migration-map.js +130 -0
- package/dist/src/contract/migration-map.js.map +1 -0
- package/dist/src/contract/types.d.ts +108 -0
- package/dist/src/contract/types.d.ts.map +1 -0
- package/dist/src/contract/types.js +23 -0
- package/dist/src/contract/types.js.map +1 -0
- package/dist/src/integration/drain.d.ts +37 -0
- package/dist/src/integration/drain.d.ts.map +1 -0
- package/dist/src/integration/drain.js +235 -0
- package/dist/src/integration/drain.js.map +1 -0
- package/dist/src/integration/enqueue.d.ts +30 -0
- package/dist/src/integration/enqueue.d.ts.map +1 -0
- package/dist/src/integration/enqueue.js +64 -0
- package/dist/src/integration/enqueue.js.map +1 -0
- package/dist/src/integration/gitops.d.ts +33 -0
- package/dist/src/integration/gitops.d.ts.map +1 -0
- package/dist/src/integration/gitops.js +128 -0
- package/dist/src/integration/gitops.js.map +1 -0
- package/dist/src/integration/lease.d.ts +16 -0
- package/dist/src/integration/lease.d.ts.map +1 -0
- package/dist/src/integration/lease.js +140 -0
- package/dist/src/integration/lease.js.map +1 -0
- package/dist/src/integration/materialize.d.ts +7 -0
- package/dist/src/integration/materialize.d.ts.map +1 -0
- package/dist/src/integration/materialize.js +34 -0
- package/dist/src/integration/materialize.js.map +1 -0
- package/dist/src/integration/store.d.ts +21 -0
- package/dist/src/integration/store.d.ts.map +1 -0
- package/dist/src/integration/store.js +131 -0
- package/dist/src/integration/store.js.map +1 -0
- package/dist/src/integration/types.d.ts +71 -0
- package/dist/src/integration/types.d.ts.map +1 -0
- package/dist/src/integration/types.js +18 -0
- package/dist/src/integration/types.js.map +1 -0
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +4 -0
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +77 -2
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/sdk/cli-bridge.d.ts +26 -0
- package/dist/src/sdk/cli-bridge.d.ts.map +1 -0
- package/dist/src/sdk/cli-bridge.js +89 -0
- package/dist/src/sdk/cli-bridge.js.map +1 -0
- package/dist/src/sdk/context.d.ts +13 -0
- package/dist/src/sdk/context.d.ts.map +1 -0
- package/dist/src/sdk/context.js +128 -0
- package/dist/src/sdk/context.js.map +1 -0
- package/dist/src/sdk/hooks.d.ts +14 -0
- package/dist/src/sdk/hooks.d.ts.map +1 -0
- package/dist/src/sdk/hooks.js +35 -0
- package/dist/src/sdk/hooks.js.map +1 -0
- package/dist/src/sdk/loader.d.ts +26 -0
- package/dist/src/sdk/loader.d.ts.map +1 -0
- package/dist/src/sdk/loader.js +170 -0
- package/dist/src/sdk/loader.js.map +1 -0
- package/dist/src/sdk/scan.d.ts +16 -0
- package/dist/src/sdk/scan.d.ts.map +1 -0
- package/dist/src/sdk/scan.js +126 -0
- package/dist/src/sdk/scan.js.map +1 -0
- package/dist/src/sdk/skills-gen.d.ts +27 -0
- package/dist/src/sdk/skills-gen.d.ts.map +1 -0
- package/dist/src/sdk/skills-gen.js +87 -0
- package/dist/src/sdk/skills-gen.js.map +1 -0
- package/dist/src/sdk/types.d.ts +141 -0
- package/dist/src/sdk/types.d.ts.map +1 -0
- package/dist/src/sdk/types.js +34 -0
- package/dist/src/sdk/types.js.map +1 -0
- package/dist/src/utils/gitignore-entry.d.ts +3 -0
- package/dist/src/utils/gitignore-entry.d.ts.map +1 -0
- package/dist/src/utils/gitignore-entry.js +24 -0
- package/dist/src/utils/gitignore-entry.js.map +1 -0
- package/dist/src/utils/verifier-git.d.ts.map +1 -1
- package/dist/src/utils/verifier-git.js +18 -2
- package/dist/src/utils/verifier-git.js.map +1 -1
- package/os/rfc/probe-batch.ts +13 -6
- package/package.json +17 -1
- package/src/contract/core-nodes.ts +111 -0
- package/src/contract/evaluator.ts +207 -0
- package/src/contract/evidence-store.ts +119 -0
- package/src/contract/executors/zero-deps.ts +92 -0
- package/src/contract/fingerprint.ts +176 -0
- package/src/contract/graph.ts +181 -0
- package/src/contract/migration-map.ts +174 -0
- package/src/contract/types.ts +125 -0
- package/src/integration/drain.ts +323 -0
- package/src/integration/enqueue.ts +92 -0
- package/src/integration/gitops.ts +174 -0
- package/src/integration/lease.ts +144 -0
- package/src/integration/materialize.ts +40 -0
- package/src/integration/store.ts +153 -0
- package/src/integration/types.ts +79 -0
- package/src/onboarding/init.ts +4 -0
- package/src/onboarding/upgrade.ts +84 -1
- package/src/sdk/cli-bridge.ts +94 -0
- package/src/sdk/context.ts +135 -0
- package/src/sdk/hooks.ts +51 -0
- package/src/sdk/loader.ts +187 -0
- package/src/sdk/scan.ts +132 -0
- package/src/sdk/skills-gen.ts +104 -0
- package/src/sdk/types.ts +158 -0
- package/src/utils/gitignore-entry.ts +24 -0
- package/src/utils/verifier-git.ts +17 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enqueue.d.ts","sourceRoot":"","sources":["../../../src/integration/enqueue.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEtF,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,GAAG,SAAa,GAAG,MAAM,CAIlD;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,CAkBnF;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,SAAK,GAAG,SAAS,CAchF;AAED,sFAAsF;AACtF,eAAO,MAAM,+BAA+B,uQACqN,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Enqueue path + read-only observability surfaces (Werkstatt RFC-1647) — sessions
|
|
5
|
+
freeze their work into immutable units and enqueue atomically; queue state is
|
|
6
|
+
inspectable at all times through read-only surfaces consuming frozen state only.
|
|
7
|
+
The conflicted-recovery contract names itself verbatim: the owning session
|
|
8
|
+
rebases onto the current head and re-enqueues a NEW unit — units are immutable,
|
|
9
|
+
re-enqueue is a new id.
|
|
10
|
+
</purpose>
|
|
11
|
+
<non-goals>
|
|
12
|
+
<item>No drain triggers as daemons — enqueueing commands may trigger an on-demand drain.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1647 (WP-4): initial enqueue + observability.</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
import { randomBytes } from "node:crypto";
|
|
19
|
+
import { isTerminal } from "./types.js";
|
|
20
|
+
/** uuidv7-style time-ordered id — millisecond prefix keeps FIFO sort stable. */
|
|
21
|
+
export function newUnitId(now = Date.now()) {
|
|
22
|
+
const timeHex = now.toString(16).padStart(12, "0");
|
|
23
|
+
const rand = randomBytes(8).toString("hex");
|
|
24
|
+
return `${timeHex}-${rand}`;
|
|
25
|
+
}
|
|
26
|
+
/** Freeze-and-enqueue: the unit either exists complete in the queue or not at all. */
|
|
27
|
+
export function enqueueUnit(store, input) {
|
|
28
|
+
const unit = {
|
|
29
|
+
schema: "forge:integration-unit/v1",
|
|
30
|
+
id: newUnitId(),
|
|
31
|
+
treeDigest: input.treeDigest,
|
|
32
|
+
baseRef: input.baseRef,
|
|
33
|
+
source: {
|
|
34
|
+
sessionId: input.sessionId,
|
|
35
|
+
worktreePath: input.worktreePath,
|
|
36
|
+
governanceIds: input.governanceIds,
|
|
37
|
+
},
|
|
38
|
+
commitChain: input.commitChain,
|
|
39
|
+
enqueuedAt: new Date().toISOString(),
|
|
40
|
+
state: { status: "queued" },
|
|
41
|
+
attempts: 0,
|
|
42
|
+
};
|
|
43
|
+
store.enqueue(unit);
|
|
44
|
+
return unit;
|
|
45
|
+
}
|
|
46
|
+
/** Read-only queue state — consumes frozen records and the append-only journal only. */
|
|
47
|
+
export function inspectQueue(store, journalTailLines = 20) {
|
|
48
|
+
const units = store.units().map((u) => ({
|
|
49
|
+
id: u.id,
|
|
50
|
+
status: u.state.status,
|
|
51
|
+
enqueuedAt: u.enqueuedAt,
|
|
52
|
+
sessionId: u.source.sessionId,
|
|
53
|
+
terminal: isTerminal(u.state),
|
|
54
|
+
}));
|
|
55
|
+
const journal = store.journal();
|
|
56
|
+
return {
|
|
57
|
+
units,
|
|
58
|
+
journalTail: journal.slice(-journalTailLines),
|
|
59
|
+
liveLease: false, // lease state is operational, not evidence — callers may probe separately
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Verbatim recovery path named in every conflicted terminal — the agent contract. */
|
|
63
|
+
export const CONFLICTED_RECOVERY_INSTRUCTION = "This unit is terminally conflicted and is never retried in place. The owning session rebases its worktree onto the current head, resolves the named paths, freezes the result as a NEW unit and re-enqueues it — units are immutable, re-enqueue is a new id.";
|
|
64
|
+
//# sourceMappingURL=enqueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enqueue.js","sourceRoot":"","sources":["../../../src/integration/enqueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;EAgBE;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,UAAU,EAA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MAAM;QACtB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS;QAC7B,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;KAC9B,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IAChC,OAAO;QACL,KAAK;QACL,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC;QAC7C,SAAS,EAAE,KAAK,EAAE,0EAA0E;KAC7F,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,+BAA+B,GAC1C,+PAA+P,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface GitExec {
|
|
2
|
+
(args: string[], cwd: string): string;
|
|
3
|
+
}
|
|
4
|
+
export declare const defaultGitExec: GitExec;
|
|
5
|
+
export declare function resolveRef(git: GitExec, repoDir: string, ref: string): string;
|
|
6
|
+
export declare function treeOfCommit(git: GitExec, repoDir: string, commitSha: string): string;
|
|
7
|
+
export declare function commitExists(git: GitExec, repoDir: string, sha: string): boolean;
|
|
8
|
+
export declare function commitTreeEquals(git: GitExec, repoDir: string, sha: string, treeDigest: string): boolean;
|
|
9
|
+
export interface ReplayResult {
|
|
10
|
+
ok: true;
|
|
11
|
+
candidateCommit: string;
|
|
12
|
+
candidateTree: string;
|
|
13
|
+
replayedCount: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ReplayConflict {
|
|
16
|
+
ok: false;
|
|
17
|
+
conflictingPaths: string[];
|
|
18
|
+
atCommit: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Rebase-materialize: replay the chain commit-by-commit onto the current head
|
|
22
|
+
* using merge-tree with the commit's parent as merge-base — exact cherry-pick
|
|
23
|
+
* tree semantics, no worktree, no checkout. Each step materializes its own
|
|
24
|
+
* commit object (never squashed). First conflict stops the replay and names
|
|
25
|
+
* the conflicting paths per-commit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function replayChainOntoHead(git: GitExec, repoDir: string, headSha: string, commitChain: string[]): ReplayResult | ReplayConflict;
|
|
28
|
+
/**
|
|
29
|
+
* Integrate the candidate into the governed ref — the single write point.
|
|
30
|
+
* update-ref is atomic; the candidate commits already live in this object store.
|
|
31
|
+
*/
|
|
32
|
+
export declare function integrateCandidate(git: GitExec, repoDir: string, governedRef: string, candidateCommit: string): void;
|
|
33
|
+
//# sourceMappingURL=gitops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitops.d.ts","sourceRoot":"","sources":["../../../src/integration/gitops.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,EAAE,OAC4D,CAAC;AAE1F,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAErF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhF;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAMxG;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,IAAI,CAAC;IACT,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,KAAK,CAAC;IACV,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAiDD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EAAE,GACpB,YAAY,GAAG,cAAc,CAmC/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB,IAAI,CAEN"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Git operations substrate for the integration queue (Werkstatt RFC-1647) — pure
|
|
5
|
+
plumbing, no worktrees: commit-chain replay via merge-tree --write-tree with the
|
|
6
|
+
replayed commit's parent as merge-base (exact cherry-pick semantics), commit
|
|
7
|
+
materialization via commit-tree into the repo's own object store. Squash is
|
|
8
|
+
forbidden: the chain replays commit-by-commit preserving messages, authorship
|
|
9
|
+
and governance trailers. Objects never leave the main object store, so the
|
|
10
|
+
candidate survives independent of any scratch lifetime.
|
|
11
|
+
</purpose>
|
|
12
|
+
<non-goals>
|
|
13
|
+
<item>No evaluation or verdict logic — git mechanics only.</item>
|
|
14
|
+
</non-goals>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1647 (WP-4): plumbing-only — merge-tree/commit-tree, zero worktrees.</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
20
|
+
export const defaultGitExec = (args, cwd) => execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
21
|
+
export function resolveRef(git, repoDir, ref) {
|
|
22
|
+
return git(["rev-parse", ref], repoDir).trim();
|
|
23
|
+
}
|
|
24
|
+
export function treeOfCommit(git, repoDir, commitSha) {
|
|
25
|
+
return git(["rev-parse", `${commitSha}^{tree}`], repoDir).trim();
|
|
26
|
+
}
|
|
27
|
+
export function commitExists(git, repoDir, sha) {
|
|
28
|
+
try {
|
|
29
|
+
git(["cat-file", "-e", sha], repoDir);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function commitTreeEquals(git, repoDir, sha, treeDigest) {
|
|
37
|
+
try {
|
|
38
|
+
return treeOfCommit(git, repoDir, sha) === treeDigest;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One merge-tree execution, exit status as the conflict signal. Output format:
|
|
46
|
+
* first line the tree oid; on conflict a section of conflicted-file records
|
|
47
|
+
* whose lines carry the path as the last whitespace-separated token.
|
|
48
|
+
*/
|
|
49
|
+
function runMergeTree(repoDir, base, ours, theirs) {
|
|
50
|
+
const res = spawnSync("git", ["merge-tree", "--write-tree", "--merge-base", base, ours, theirs], {
|
|
51
|
+
cwd: repoDir,
|
|
52
|
+
encoding: "utf8",
|
|
53
|
+
});
|
|
54
|
+
const out = res.stdout ?? "";
|
|
55
|
+
const lines = out.split("\n");
|
|
56
|
+
const tree = lines[0]?.trim() || null;
|
|
57
|
+
const conflicted = res.status !== 0;
|
|
58
|
+
const conflictedPaths = conflicted
|
|
59
|
+
? [
|
|
60
|
+
...new Set(lines
|
|
61
|
+
.slice(1)
|
|
62
|
+
.map((l) => l.trim())
|
|
63
|
+
.filter((l) => /^\d+ \d+ [0-9a-f]{7,40} \d+\t?.+/i.test(l) || l.includes("\t"))
|
|
64
|
+
.map((l) => l.split(/\s+/).pop() ?? "")
|
|
65
|
+
.filter(Boolean)),
|
|
66
|
+
]
|
|
67
|
+
: [];
|
|
68
|
+
return { conflicted, tree, conflictedPaths };
|
|
69
|
+
}
|
|
70
|
+
function commitMeta(git, repoDir, commit) {
|
|
71
|
+
const sep = "@@META@@";
|
|
72
|
+
const message = git(["log", "-1", "--format=%B", commit], repoDir);
|
|
73
|
+
const meta = git(["log", "-1", `--format=${sep}%an${sep}%ae${sep}%aI`, commit], repoDir).trim().split(sep).filter(Boolean);
|
|
74
|
+
return {
|
|
75
|
+
message: message.trimEnd(),
|
|
76
|
+
authorName: meta[1] ?? "integration-queue",
|
|
77
|
+
authorEmail: meta[2] ?? "queue@localhost",
|
|
78
|
+
authorDate: meta[3] ?? new Date().toISOString(),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Rebase-materialize: replay the chain commit-by-commit onto the current head
|
|
83
|
+
* using merge-tree with the commit's parent as merge-base — exact cherry-pick
|
|
84
|
+
* tree semantics, no worktree, no checkout. Each step materializes its own
|
|
85
|
+
* commit object (never squashed). First conflict stops the replay and names
|
|
86
|
+
* the conflicting paths per-commit.
|
|
87
|
+
*/
|
|
88
|
+
export function replayChainOntoHead(git, repoDir, headSha, commitChain) {
|
|
89
|
+
let tip = headSha;
|
|
90
|
+
let replayed = 0;
|
|
91
|
+
for (const commit of commitChain) {
|
|
92
|
+
const parent = git(["rev-parse", `${commit}^`], repoDir).trim();
|
|
93
|
+
const outcome = runMergeTree(repoDir, parent, tip, commit);
|
|
94
|
+
if (outcome.conflicted || !outcome.tree) {
|
|
95
|
+
return {
|
|
96
|
+
ok: false,
|
|
97
|
+
conflictingPaths: outcome.conflictedPaths.length > 0 ? outcome.conflictedPaths : ["(conflict — paths unparsed)"],
|
|
98
|
+
atCommit: commit,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const meta = commitMeta(git, repoDir, commit);
|
|
102
|
+
const env = {
|
|
103
|
+
...process.env,
|
|
104
|
+
GIT_AUTHOR_NAME: meta.authorName,
|
|
105
|
+
GIT_AUTHOR_EMAIL: meta.authorEmail,
|
|
106
|
+
GIT_AUTHOR_DATE: meta.authorDate,
|
|
107
|
+
GIT_COMMITTER_NAME: meta.authorName,
|
|
108
|
+
GIT_COMMITTER_EMAIL: meta.authorEmail,
|
|
109
|
+
};
|
|
110
|
+
const newCommit = execFileSync("git", ["commit-tree", outcome.tree, "-p", tip, "-m", meta.message], {
|
|
111
|
+
cwd: repoDir,
|
|
112
|
+
encoding: "utf8",
|
|
113
|
+
env,
|
|
114
|
+
}).trim();
|
|
115
|
+
tip = newCommit;
|
|
116
|
+
replayed += 1;
|
|
117
|
+
}
|
|
118
|
+
const candidateTree = treeOfCommit(git, repoDir, tip);
|
|
119
|
+
return { ok: true, candidateCommit: tip, candidateTree, replayedCount: replayed };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Integrate the candidate into the governed ref — the single write point.
|
|
123
|
+
* update-ref is atomic; the candidate commits already live in this object store.
|
|
124
|
+
*/
|
|
125
|
+
export function integrateCandidate(git, repoDir, governedRef, candidateCommit) {
|
|
126
|
+
git(["update-ref", governedRef, candidateCommit], repoDir);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=gitops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitops.js","sourceRoot":"","sources":["../../../src/integration/gitops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM7D,MAAM,CAAC,MAAM,cAAc,GAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CACnD,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAE1F,MAAM,UAAU,UAAU,CAAC,GAAY,EAAE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,CAAC,WAAW;SACtC,CAAC;QACF,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;YAClG,GAAG,EAAE,OAAO;YACZ,QAAQ,EAAE,MAAM;YAChB,GAAG;SACJ,CAAC,CAAC,IAAI,EAAE,CAAC;QACV,GAAG,GAAG,SAAS,CAAC;QAChB,QAAQ,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AACpF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAY,EACZ,OAAe,EACf,WAAmB,EACnB,eAAuB;IAEvB,GAAG,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DrainLease } from "./types.ts";
|
|
2
|
+
/** Lease TTL in ms — minutes-scale per RFC; heartbeat cadence must be < ttl/2. */
|
|
3
|
+
export declare const LEASE_TTL_MS: number;
|
|
4
|
+
export declare const HEARTBEAT_CADENCE_MS: number;
|
|
5
|
+
export interface LeaseHandle {
|
|
6
|
+
lease: DrainLease;
|
|
7
|
+
heartbeat(): void;
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Acquire the drain lease atomically. Returns null when a live unexpired lease
|
|
12
|
+
* is held — the caller reports drain-in-progress and exits 0. Expired or dead
|
|
13
|
+
* leases are reclaimed; re-entry safety is the drain's idempotency contract.
|
|
14
|
+
*/
|
|
15
|
+
export declare function acquireLease(queueDir: string, ttlMs?: number): LeaseHandle | null;
|
|
16
|
+
//# sourceMappingURL=lease.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../../src/integration/lease.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,kFAAkF;AAClF,eAAO,MAAM,YAAY,QAAgB,CAAC;AAC1C,eAAO,MAAM,oBAAoB,QAAY,CAAC;AAW9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,IAAI,IAAI,CAAC;IAClB,OAAO,IAAI,IAAI,CAAC;CACjB;AAwBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAe,GAAG,WAAW,GAAG,IAAI,CA0EvF"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Drain lease machinery (Werkstatt RFC-1647) — atomic acquisition, heartbeat, expiry
|
|
5
|
+
and reclaim, same-machine boot-id fencing inheriting the v9 machine-local trust
|
|
6
|
+
model. Lease is per-unit-processing, re-acquired with a fresh heartbeat at each
|
|
7
|
+
unit boundary; heartbeat cadence strictly less than half the TTL. Worst-case
|
|
8
|
+
duplicate work is one unit evaluation, never one corruption.
|
|
9
|
+
</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No multi-host fencing — v1 is single-machine scope by design.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1647 (WP-4): initial lease machinery.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
import { closeSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeSync } from "node:fs";
|
|
18
|
+
import { randomBytes } from "node:crypto";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
/** Lease TTL in ms — minutes-scale per RFC; heartbeat cadence must be < ttl/2. */
|
|
21
|
+
export const LEASE_TTL_MS = 5 * 60 * 1000;
|
|
22
|
+
export const HEARTBEAT_CADENCE_MS = 60 * 1000; // < LEASE_TTL_MS / 2 — fixed relationship
|
|
23
|
+
function hostBootId() {
|
|
24
|
+
try {
|
|
25
|
+
return readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim();
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Non-Linux fallback: machine+process start is the best available fence in v1 scope.
|
|
29
|
+
return `unknown-${process.pid}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function readLease(path) {
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function isExpired(lease, now, ttlMs) {
|
|
41
|
+
return new Date(lease.heartbeatAt).getTime() + ttlMs < now;
|
|
42
|
+
}
|
|
43
|
+
function isLiveHolder(lease) {
|
|
44
|
+
if (lease.hostBootId !== hostBootId())
|
|
45
|
+
return false; // different boot — holder is gone
|
|
46
|
+
try {
|
|
47
|
+
process.kill(lease.workerPid, 0);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Acquire the drain lease atomically. Returns null when a live unexpired lease
|
|
56
|
+
* is held — the caller reports drain-in-progress and exits 0. Expired or dead
|
|
57
|
+
* leases are reclaimed; re-entry safety is the drain's idempotency contract.
|
|
58
|
+
*/
|
|
59
|
+
export function acquireLease(queueDir, ttlMs = LEASE_TTL_MS) {
|
|
60
|
+
mkdirSync(queueDir, { recursive: true });
|
|
61
|
+
const leasePath = join(queueDir, "lease.json");
|
|
62
|
+
const now = Date.now();
|
|
63
|
+
const existing = readLease(leasePath);
|
|
64
|
+
if (existing && !isExpired(existing, now, ttlMs) && isLiveHolder(existing)) {
|
|
65
|
+
return null; // held by a live worker — never double-process
|
|
66
|
+
}
|
|
67
|
+
// Atomic take: write to a unique temp and rename — the rename is atomic on
|
|
68
|
+
// POSIX, and concurrent racers converge on one winner's file. Losers detect
|
|
69
|
+
// the loss by re-reading: the lease on disk names a different leaseId.
|
|
70
|
+
const lease = {
|
|
71
|
+
leaseId: randomBytes(8).toString("hex"),
|
|
72
|
+
workerPid: process.pid,
|
|
73
|
+
hostBootId: hostBootId(),
|
|
74
|
+
acquiredAt: new Date(now).toISOString(),
|
|
75
|
+
heartbeatAt: new Date(now).toISOString(),
|
|
76
|
+
};
|
|
77
|
+
const tmp = join(queueDir, `.lease-${lease.leaseId}`);
|
|
78
|
+
const fd = openSync(tmp, "w");
|
|
79
|
+
try {
|
|
80
|
+
writeSync(fd, JSON.stringify(lease, null, 2));
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
closeSync(fd);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
renameSync(tmp, leasePath);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
try {
|
|
90
|
+
unlinkSync(tmp);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// best effort
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Verify the win — a concurrent racer's rename may have landed after ours.
|
|
97
|
+
const onDisk = readLease(leasePath);
|
|
98
|
+
if (!onDisk || onDisk.leaseId !== lease.leaseId)
|
|
99
|
+
return null;
|
|
100
|
+
return {
|
|
101
|
+
lease,
|
|
102
|
+
heartbeat() {
|
|
103
|
+
const current = readLease(leasePath);
|
|
104
|
+
if (!current || current.leaseId !== lease.leaseId)
|
|
105
|
+
return; // lost — heartbeating another's lease is worse than expiry
|
|
106
|
+
const updated = { ...current, heartbeatAt: new Date().toISOString() };
|
|
107
|
+
const htmp = join(queueDir, `.lease-hb-${lease.leaseId}`);
|
|
108
|
+
const hfd = openSync(htmp, "w");
|
|
109
|
+
try {
|
|
110
|
+
writeSync(hfd, JSON.stringify(updated, null, 2));
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
closeSync(hfd);
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
renameSync(htmp, leasePath);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
try {
|
|
120
|
+
unlinkSync(htmp);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// best effort
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
release() {
|
|
128
|
+
const current = readLease(leasePath);
|
|
129
|
+
if (current?.leaseId === lease.leaseId) {
|
|
130
|
+
try {
|
|
131
|
+
unlinkSync(leasePath);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// already gone
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=lease.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease.js","sourceRoot":"","sources":["../../../src/integration/lease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AAEF,OAAO,EAAE,SAAS,EAAc,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACtH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,kFAAkF;AAClF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,0CAA0C;AAEzF,SAAS,UAAU;IAC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|
+
root: string;
|
|
3
|
+
cleanup(): void;
|
|
4
|
+
}
|
|
5
|
+
/** Expand a git tree object into a fresh ephemeral directory. */
|
|
6
|
+
export declare function materializeTree(repoDir: string, treeDigest: string): MaterializedTree;
|
|
7
|
+
//# sourceMappingURL=materialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../../../src/integration/materialize.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAarF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Candidate tree materialization (Werkstatt RFC-1647) — the contract graph evaluates
|
|
5
|
+
the exact content that would integrate. The frozen candidate tree object is
|
|
6
|
+
expanded into an ephemeral filesystem root via git archive; callers own cleanup.
|
|
7
|
+
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No caching of materializations — evaluation frequency is human-scale.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1647 (WP-4): initial materializer.</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
import { execFileSync } from "node:child_process";
|
|
16
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
/** Expand a git tree object into a fresh ephemeral directory. */
|
|
20
|
+
export function materializeTree(repoDir, treeDigest) {
|
|
21
|
+
const root = mkdtempSync(join(tmpdir(), "forge-candidate-"));
|
|
22
|
+
// git archive writes a tar of the tree to stdout — expand in place.
|
|
23
|
+
execFileSync("sh", ["-c", `git archive "${treeDigest}" | tar -x -C "${root}"`], {
|
|
24
|
+
cwd: repoDir,
|
|
25
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
root,
|
|
29
|
+
cleanup() {
|
|
30
|
+
rmSync(root, { recursive: true, force: true });
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=materialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.js","sourceRoot":"","sources":["../../../src/integration/materialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;EAaE;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,UAAkB;IACjE,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC7D,oEAAoE;IACpE,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,UAAU,kBAAkB,IAAI,GAAG,CAAC,EAAE;QAC9E,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IACH,OAAO;QACL,IAAI;QACJ,OAAO;YACL,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IntegrationUnit, QueueJournalEntry } from "./types.ts";
|
|
2
|
+
export interface QueueStore {
|
|
3
|
+
/**
|
|
4
|
+
* Atomic enqueue: the unit record is staged, then becomes visible through one
|
|
5
|
+
* atomic journal append. Either the unit exists complete in the queue or not
|
|
6
|
+
* at all — partial units are impossible by construction.
|
|
7
|
+
*/
|
|
8
|
+
enqueue(unit: IntegrationUnit): void;
|
|
9
|
+
appendJournal(entry: QueueJournalEntry): void;
|
|
10
|
+
readUnit(id: string): IntegrationUnit | null;
|
|
11
|
+
writeUnit(unit: IntegrationUnit): void;
|
|
12
|
+
/** All live units folded from journal + records — never-enqueued partial entries discarded. */
|
|
13
|
+
units(): IntegrationUnit[];
|
|
14
|
+
journal(): QueueJournalEntry[];
|
|
15
|
+
checkpoint(): void;
|
|
16
|
+
queueDir: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function createQueueStore(queueDir: string): QueueStore;
|
|
19
|
+
/** Garbage-collect staging residue older than crash windows — safe because incomplete units are never visible. */
|
|
20
|
+
export declare function cleanStagingResidue(queueDir: string): number;
|
|
21
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/integration/store.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAcrE,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAAC;IAC7C,SAAS,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IACvC,+FAA+F;IAC/F,KAAK,IAAI,eAAe,EAAE,CAAC;IAC3B,OAAO,IAAI,iBAAiB,EAAE,CAAC;IAC/B,UAAU,IAAI,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAoF7D;AAED,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAa5D"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Queue persistence (Werkstatt RFC-1647) — atomic enqueue via staging plus a single
|
|
5
|
+
journal append; append-only journal as the source of truth with bounded fold via
|
|
6
|
+
checkpoints; unit records immutable once terminal. A journal entry referencing a
|
|
7
|
+
missing or incomplete unit record is proof of crash-mid-enqueue and is discarded
|
|
8
|
+
as never-enqueued.
|
|
9
|
+
</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No lease or drain logic — persistence only.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1647 (WP-4): initial queue store.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, unlinkSync, writeSync } from "node:fs";
|
|
18
|
+
import { randomBytes } from "node:crypto";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
function atomicWrite(path, content) {
|
|
21
|
+
mkdirSync(join(path, ".."), { recursive: true });
|
|
22
|
+
const tmp = join(join(path, ".."), `.tmp-${randomBytes(8).toString("hex")}`);
|
|
23
|
+
const fd = openSync(tmp, "w");
|
|
24
|
+
try {
|
|
25
|
+
writeSync(fd, content);
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
closeSync(fd);
|
|
29
|
+
}
|
|
30
|
+
renameSync(tmp, path);
|
|
31
|
+
}
|
|
32
|
+
export function createQueueStore(queueDir) {
|
|
33
|
+
const unitsDir = join(queueDir, "units");
|
|
34
|
+
const journalPath = join(queueDir, "journal.log");
|
|
35
|
+
const checkpointPath = join(queueDir, "checkpoint.json");
|
|
36
|
+
mkdirSync(unitsDir, { recursive: true });
|
|
37
|
+
function unitPath(id) {
|
|
38
|
+
return join(unitsDir, `${id}.json`);
|
|
39
|
+
}
|
|
40
|
+
function appendJournal(entry) {
|
|
41
|
+
mkdirSync(queueDir, { recursive: true });
|
|
42
|
+
const fd = openSync(journalPath, "a");
|
|
43
|
+
try {
|
|
44
|
+
writeSync(fd, JSON.stringify(entry) + "\n");
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
closeSync(fd);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function readJournalRaw() {
|
|
51
|
+
if (!existsSync(journalPath))
|
|
52
|
+
return [];
|
|
53
|
+
return readFileSync(journalPath, "utf8")
|
|
54
|
+
.split("\n")
|
|
55
|
+
.filter((l) => l.trim().length > 0)
|
|
56
|
+
.map((l) => JSON.parse(l));
|
|
57
|
+
}
|
|
58
|
+
function readUnit(id) {
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(readFileSync(unitPath(id), "utf8"));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function writeUnit(unit) {
|
|
67
|
+
atomicWrite(unitPath(unit.id), JSON.stringify(unit, null, 2));
|
|
68
|
+
}
|
|
69
|
+
function units() {
|
|
70
|
+
// Fold the journal: a unit is live when its enqueued entry resolves to a
|
|
71
|
+
// complete record. Entries referencing missing/incomplete records are proof
|
|
72
|
+
// of crash-mid-enqueue — discarded as never-enqueued.
|
|
73
|
+
const entries = readJournalRaw();
|
|
74
|
+
const ids = [];
|
|
75
|
+
for (const e of entries) {
|
|
76
|
+
if (e.transition === "enqueued" && !ids.includes(e.unitId)) {
|
|
77
|
+
if (readUnit(e.unitId) != null)
|
|
78
|
+
ids.push(e.unitId);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return ids.map((id) => readUnit(id)).filter(Boolean);
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
queueDir,
|
|
85
|
+
enqueue(unit) {
|
|
86
|
+
// Stage the complete record first, then the single atomic journal append
|
|
87
|
+
// that makes it visible. Reverse order would expose a referencing entry
|
|
88
|
+
// without a record; this order makes crash-mid-enqueue detectable and
|
|
89
|
+
// discardable.
|
|
90
|
+
writeUnit(unit);
|
|
91
|
+
appendJournal({
|
|
92
|
+
schema: "forge:queue-journal/v1",
|
|
93
|
+
unitId: unit.id,
|
|
94
|
+
transition: "enqueued",
|
|
95
|
+
at: new Date().toISOString(),
|
|
96
|
+
actor: `session:${unit.source.sessionId}`,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
appendJournal,
|
|
100
|
+
readUnit,
|
|
101
|
+
writeUnit,
|
|
102
|
+
units,
|
|
103
|
+
journal: readJournalRaw,
|
|
104
|
+
checkpoint() {
|
|
105
|
+
// Fold-on-read stays bounded by checkpoint spacing, not journal age.
|
|
106
|
+
const snapshot = {
|
|
107
|
+
at: new Date().toISOString(),
|
|
108
|
+
units: units().map((u) => ({ id: u.id, state: u.state })),
|
|
109
|
+
};
|
|
110
|
+
atomicWrite(checkpointPath, JSON.stringify(snapshot, null, 2));
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Garbage-collect staging residue older than crash windows — safe because incomplete units are never visible. */
|
|
115
|
+
export function cleanStagingResidue(queueDir) {
|
|
116
|
+
const staging = join(queueDir, "staging");
|
|
117
|
+
if (!existsSync(staging))
|
|
118
|
+
return 0;
|
|
119
|
+
let removed = 0;
|
|
120
|
+
for (const entry of readdirSync(staging)) {
|
|
121
|
+
try {
|
|
122
|
+
unlinkSync(join(staging, entry));
|
|
123
|
+
removed += 1;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// concurrent writer — leave it
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return removed;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/integration/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AAEF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnI,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7E,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IACD,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC;AAmBD,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,IAAI,CAAC,Q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