@ricsam/r5d-worker 0.0.136 → 0.0.138
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/README.md +4 -94
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/main.mjs +46 -7537
- package/dist/mjs/package.json +1 -1
- package/dist/mjs/personal/action-scheduler.mjs +31 -0
- package/dist/mjs/personal/client.mjs +215 -0
- package/dist/mjs/personal/runtime.mjs +328 -0
- package/dist/mjs/personal/tcp.mjs +217 -0
- package/dist/mjs/runtime/adapter.mjs +42 -0
- package/dist/mjs/runtime/client.mjs +95 -0
- package/dist/mjs/runtime/daemon.mjs +131 -0
- package/dist/mjs/runtime/executor.mjs +436 -0
- package/dist/mjs/runtime/index.mjs +15 -0
- package/dist/mjs/runtime/protocol.mjs +139 -0
- package/dist/mjs/runtime/pty-host.mjs +156 -0
- package/dist/mjs/runtime/pty.mjs +127 -0
- package/dist/mjs/runtime/releases/artifacts.mjs +201 -0
- package/dist/mjs/runtime/releases/grants.mjs +93 -0
- package/dist/mjs/runtime/releases/main.mjs +101 -0
- package/dist/mjs/runtime/releases/manager.mjs +541 -0
- package/dist/mjs/runtime/releases/process.mjs +88 -0
- package/dist/mjs/runtime/releases/retirement.mjs +18 -0
- package/dist/mjs/runtime/releases/rpc-client.mjs +184 -0
- package/dist/mjs/runtime/releases/rpc-main.mjs +213 -0
- package/dist/mjs/runtime/releases/rpc-protocol.mjs +103 -0
- package/dist/mjs/runtime/storage.mjs +156 -0
- package/dist/mjs/runtime/workspace/artifacts.mjs +121 -0
- package/dist/mjs/runtime/workspace/authority.mjs +1355 -0
- package/dist/mjs/runtime/workspace/contracts.mjs +60 -0
- package/dist/mjs/runtime/workspace/file-write.mjs +23 -0
- package/dist/mjs/runtime/workspace/files.mjs +308 -0
- package/dist/mjs/runtime/workspace/http-body.mjs +45 -0
- package/dist/mjs/runtime/workspace/storage-client.mjs +59 -0
- package/dist/mjs/runtime/workspace/storage-wire.mjs +53 -0
- package/dist/types/main.d.ts +0 -1167
- package/dist/types/personal/action-scheduler.d.ts +23 -0
- package/dist/types/personal/client.d.ts +14 -0
- package/dist/types/personal/runtime.d.ts +121 -0
- package/dist/types/personal/tcp.d.ts +14 -0
- package/dist/types/runtime/client.d.ts +17 -0
- package/dist/types/runtime/daemon.d.ts +8 -0
- package/dist/types/runtime/executor.d.ts +35 -0
- package/dist/types/runtime/index.d.ts +5 -0
- package/dist/types/runtime/protocol.d.ts +544 -0
- package/dist/types/runtime/pty.d.ts +30 -0
- package/dist/types/runtime/releases/artifacts.d.ts +51 -0
- package/dist/types/runtime/releases/grants.d.ts +16 -0
- package/dist/types/runtime/releases/manager.d.ts +145 -0
- package/dist/types/runtime/releases/process.d.ts +14 -0
- package/dist/types/runtime/releases/retirement.d.ts +15 -0
- package/dist/types/runtime/releases/rpc-client.d.ts +52 -0
- package/dist/types/runtime/releases/rpc-main.d.ts +10 -0
- package/dist/types/runtime/releases/rpc-protocol.d.ts +1139 -0
- package/dist/types/runtime/storage.d.ts +21 -0
- package/dist/types/runtime/test-harness.d.ts +53 -0
- package/dist/types/runtime/workspace/artifacts.d.ts +30 -0
- package/dist/types/runtime/workspace/authority.d.ts +338 -0
- package/dist/types/runtime/workspace/contracts.d.ts +86 -0
- package/dist/types/runtime/workspace/file-write.d.ts +14 -0
- package/dist/types/runtime/workspace/files.d.ts +21 -0
- package/dist/types/runtime/workspace/http-body.d.ts +9 -0
- package/dist/types/runtime/workspace/storage-client.d.ts +23 -0
- package/dist/types/runtime/workspace/storage-wire.d.ts +138 -0
- package/package.json +8 -6
- package/dist/cjs/atomic-rename.cjs +0 -303
- package/dist/cjs/browser-upload.cjs +0 -73
- package/dist/cjs/cli-update.cjs +0 -108
- package/dist/cjs/command-launcher.cjs +0 -423
- package/dist/cjs/control-command-policy.cjs +0 -177
- package/dist/cjs/git-blob-hash.cjs +0 -41
- package/dist/cjs/git-identity.cjs +0 -39
- package/dist/cjs/git-process-environment.cjs +0 -133
- package/dist/cjs/inline-output.cjs +0 -62
- package/dist/cjs/main.cjs +0 -7511
- package/dist/cjs/managed-paths.cjs +0 -215
- package/dist/cjs/plan-lint.cjs +0 -165
- package/dist/cjs/plan-parser.cjs +0 -127
- package/dist/cjs/plan-paths.cjs +0 -53
- package/dist/cjs/port-forward-client.cjs +0 -206
- package/dist/cjs/process-tree.cjs +0 -117
- package/dist/cjs/project-checkout-garbage.cjs +0 -219
- package/dist/cjs/project-mirror-fetch-policy.cjs +0 -82
- package/dist/cjs/project-mirror-refs-token.cjs +0 -85
- package/dist/cjs/project-workspace-state.cjs +0 -972
- package/dist/cjs/project-worktrees.cjs +0 -1713
- package/dist/cjs/pty-output-coalescer.cjs +0 -87
- package/dist/cjs/recovery-journal-protocol.cjs +0 -56
- package/dist/cjs/recovery-journal-runtime.cjs +0 -133
- package/dist/cjs/recovery-journal-thread.cjs +0 -9
- package/dist/cjs/recovery-journal.cjs +0 -742
- package/dist/cjs/recovery-output-window.cjs +0 -77
- package/dist/cjs/recovery-protocol.cjs +0 -31
- package/dist/cjs/recovery-store.cjs +0 -252
- package/dist/cjs/registry-auth.cjs +0 -310
- package/dist/cjs/repository-transition-policy.cjs +0 -49
- package/dist/cjs/runtime-version.cjs +0 -88
- package/dist/cjs/session-file-mutations.cjs +0 -61
- package/dist/cjs/supervisor.cjs +0 -147
- package/dist/cjs/three-way-merge.cjs +0 -346
- package/dist/cjs/working-tree-mirror.cjs +0 -1872
- package/dist/cjs/workspace-automatic-sync-policy.cjs +0 -79
- package/dist/cjs/workspace-branch-incarnation-policy.cjs +0 -37
- package/dist/cjs/workspace-command-sync-policy.cjs +0 -112
- package/dist/cjs/workspace-command-targets.cjs +0 -63
- package/dist/cjs/workspace-filesystem-executor-thread.cjs +0 -36
- package/dist/cjs/workspace-filesystem-executor.cjs +0 -327
- package/dist/cjs/workspace-filesystem-job-types.cjs +0 -144
- package/dist/cjs/workspace-filesystem-jobs.cjs +0 -59
- package/dist/cjs/workspace-git-sync.cjs +0 -3450
- package/dist/cjs/workspace-hydration-ledger.cjs +0 -66
- package/dist/cjs/workspace-hydration-merge.cjs +0 -433
- package/dist/cjs/workspace-hydration-recovery-state.cjs +0 -53
- package/dist/cjs/workspace-incident-state.cjs +0 -37
- package/dist/cjs/workspace-merge-projection.cjs +0 -467
- package/dist/cjs/workspace-mount-boundary.cjs +0 -71
- package/dist/cjs/workspace-mount-hold-fence.cjs +0 -120
- package/dist/cjs/workspace-mutation-gate.cjs +0 -127
- package/dist/cjs/workspace-path-move.cjs +0 -195
- package/dist/cjs/workspace-preserve-only-policy.cjs +0 -36
- package/dist/cjs/workspace-project-config-policy.cjs +0 -53
- package/dist/cjs/workspace-projection-ledger.cjs +0 -81
- package/dist/cjs/workspace-publication-evidence.cjs +0 -46
- package/dist/cjs/workspace-sync-coalescer.cjs +0 -58
- package/dist/mjs/atomic-rename.mjs +0 -261
- package/dist/mjs/browser-upload.mjs +0 -42
- package/dist/mjs/command-launcher.mjs +0 -393
- package/dist/mjs/control-command-policy.mjs +0 -146
- package/dist/mjs/git-blob-hash.mjs +0 -16
- package/dist/mjs/git-identity.mjs +0 -15
- package/dist/mjs/git-process-environment.mjs +0 -105
- package/dist/mjs/inline-output.mjs +0 -37
- package/dist/mjs/managed-paths.mjs +0 -174
- package/dist/mjs/plan-lint.mjs +0 -129
- package/dist/mjs/plan-parser.mjs +0 -94
- package/dist/mjs/plan-paths.mjs +0 -25
- package/dist/mjs/port-forward-client.mjs +0 -172
- package/dist/mjs/project-checkout-garbage.mjs +0 -178
- package/dist/mjs/project-mirror-fetch-policy.mjs +0 -56
- package/dist/mjs/project-mirror-refs-token.mjs +0 -53
- package/dist/mjs/project-workspace-state.mjs +0 -937
- package/dist/mjs/project-worktrees.mjs +0 -1657
- package/dist/mjs/pty-output-coalescer.mjs +0 -61
- package/dist/mjs/recovery-journal-protocol.mjs +0 -30
- package/dist/mjs/recovery-journal-runtime.mjs +0 -112
- package/dist/mjs/recovery-journal-thread.mjs +0 -8
- package/dist/mjs/recovery-journal.mjs +0 -694
- package/dist/mjs/recovery-output-window.mjs +0 -53
- package/dist/mjs/recovery-protocol.mjs +0 -6
- package/dist/mjs/recovery-store.mjs +0 -217
- package/dist/mjs/registry-auth.mjs +0 -269
- package/dist/mjs/repository-transition-policy.mjs +0 -22
- package/dist/mjs/runtime-version.mjs +0 -54
- package/dist/mjs/session-file-mutations.mjs +0 -37
- package/dist/mjs/supervisor.mjs +0 -114
- package/dist/mjs/three-way-merge.mjs +0 -318
- package/dist/mjs/working-tree-mirror.mjs +0 -1817
- package/dist/mjs/workspace-automatic-sync-policy.mjs +0 -48
- package/dist/mjs/workspace-branch-incarnation-policy.mjs +0 -13
- package/dist/mjs/workspace-command-sync-policy.mjs +0 -84
- package/dist/mjs/workspace-command-targets.mjs +0 -37
- package/dist/mjs/workspace-filesystem-executor-thread.mjs +0 -38
- package/dist/mjs/workspace-filesystem-executor.mjs +0 -287
- package/dist/mjs/workspace-filesystem-job-types.mjs +0 -116
- package/dist/mjs/workspace-filesystem-jobs.mjs +0 -55
- package/dist/mjs/workspace-git-sync.mjs +0 -3407
- package/dist/mjs/workspace-hydration-ledger.mjs +0 -42
- package/dist/mjs/workspace-hydration-merge.mjs +0 -399
- package/dist/mjs/workspace-hydration-recovery-state.mjs +0 -29
- package/dist/mjs/workspace-incident-state.mjs +0 -12
- package/dist/mjs/workspace-merge-projection.mjs +0 -433
- package/dist/mjs/workspace-mount-boundary.mjs +0 -37
- package/dist/mjs/workspace-mount-hold-fence.mjs +0 -95
- package/dist/mjs/workspace-mutation-gate.mjs +0 -103
- package/dist/mjs/workspace-path-move.mjs +0 -160
- package/dist/mjs/workspace-preserve-only-policy.mjs +0 -11
- package/dist/mjs/workspace-project-config-policy.mjs +0 -27
- package/dist/mjs/workspace-projection-ledger.mjs +0 -57
- package/dist/mjs/workspace-publication-evidence.mjs +0 -21
- package/dist/mjs/workspace-sync-coalescer.mjs +0 -34
- package/dist/types/atomic-rename.d.ts +0 -78
- package/dist/types/browser-upload.d.ts +0 -7
- package/dist/types/command-launcher.d.ts +0 -104
- package/dist/types/control-command-policy.d.ts +0 -53
- package/dist/types/git-blob-hash.d.ts +0 -10
- package/dist/types/git-identity.d.ts +0 -9
- package/dist/types/git-process-environment.d.ts +0 -9
- package/dist/types/inline-output.d.ts +0 -3
- package/dist/types/managed-paths.d.ts +0 -19
- package/dist/types/plan-lint.d.ts +0 -16
- package/dist/types/plan-parser.d.ts +0 -38
- package/dist/types/plan-paths.d.ts +0 -36
- package/dist/types/port-forward-client.d.ts +0 -8
- package/dist/types/project-checkout-garbage.d.ts +0 -86
- package/dist/types/project-mirror-fetch-policy.d.ts +0 -84
- package/dist/types/project-mirror-refs-token.d.ts +0 -53
- package/dist/types/project-workspace-state.d.ts +0 -188
- package/dist/types/project-worktrees.d.ts +0 -397
- package/dist/types/pty-output-coalescer.d.ts +0 -20
- package/dist/types/recovery-journal-protocol.d.ts +0 -35
- package/dist/types/recovery-journal-runtime.d.ts +0 -12
- package/dist/types/recovery-journal-thread.d.ts +0 -1
- package/dist/types/recovery-journal.d.ts +0 -248
- package/dist/types/recovery-output-window.d.ts +0 -19
- package/dist/types/recovery-protocol.d.ts +0 -59
- package/dist/types/recovery-store.d.ts +0 -52
- package/dist/types/registry-auth.d.ts +0 -47
- package/dist/types/repository-transition-policy.d.ts +0 -26
- package/dist/types/runtime-version.d.ts +0 -1
- package/dist/types/session-file-mutations.d.ts +0 -22
- package/dist/types/supervisor-daemonized-fixture.d.ts +0 -1
- package/dist/types/supervisor-launcher-cleanup-fixture.d.ts +0 -1
- package/dist/types/supervisor-signal-fixture.d.ts +0 -1
- package/dist/types/supervisor.d.ts +0 -23
- package/dist/types/three-way-merge.d.ts +0 -77
- package/dist/types/working-tree-mirror.d.ts +0 -424
- package/dist/types/workspace-automatic-sync-policy.d.ts +0 -57
- package/dist/types/workspace-branch-incarnation-policy.d.ts +0 -14
- package/dist/types/workspace-command-sync-policy.d.ts +0 -57
- package/dist/types/workspace-command-targets.d.ts +0 -37
- package/dist/types/workspace-filesystem-executor-thread.d.ts +0 -1
- package/dist/types/workspace-filesystem-executor.d.ts +0 -123
- package/dist/types/workspace-filesystem-job-types.d.ts +0 -288
- package/dist/types/workspace-filesystem-jobs.d.ts +0 -7
- package/dist/types/workspace-git-sync.d.ts +0 -495
- package/dist/types/workspace-hydration-ledger.d.ts +0 -43
- package/dist/types/workspace-hydration-merge.d.ts +0 -95
- package/dist/types/workspace-hydration-recovery-state.d.ts +0 -10
- package/dist/types/workspace-incident-state.d.ts +0 -19
- package/dist/types/workspace-merge-projection.d.ts +0 -60
- package/dist/types/workspace-mount-boundary.d.ts +0 -10
- package/dist/types/workspace-mount-hold-fence.d.ts +0 -42
- package/dist/types/workspace-mutation-gate.d.ts +0 -42
- package/dist/types/workspace-path-move.d.ts +0 -21
- package/dist/types/workspace-preserve-only-policy.d.ts +0 -15
- package/dist/types/workspace-project-config-policy.d.ts +0 -48
- package/dist/types/workspace-projection-ledger.d.ts +0 -59
- package/dist/types/workspace-publication-evidence.d.ts +0 -17
- package/dist/types/workspace-sync-coalescer.d.ts +0 -28
- /package/dist/types/{credential-authority-lock-fixture.d.ts → runtime/adapter.d.ts} +0 -0
- /package/dist/types/{recovery-journal-stall-fixture.d.ts → runtime/releases/main.d.ts} +0 -0
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markdown plan parser.
|
|
3
|
-
*
|
|
4
|
-
* Plans are plain Markdown files. The only structured region is the first
|
|
5
|
-
* "## Tasks" section, which contains checkbox task lines.
|
|
6
|
-
*/
|
|
7
|
-
export declare const PLAN_TASK_ID_REGEX: RegExp;
|
|
8
|
-
export declare const PLAN_TASK_LINE_REGEX: RegExp;
|
|
9
|
-
export declare const PLAN_TASKS_HEADING_REGEX: RegExp;
|
|
10
|
-
export interface PlanTask {
|
|
11
|
-
id: string;
|
|
12
|
-
description: string;
|
|
13
|
-
checked: boolean;
|
|
14
|
-
lineNumber: number;
|
|
15
|
-
}
|
|
16
|
-
export interface ParsedPlan {
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
content: string;
|
|
20
|
-
tasks: PlanTask[];
|
|
21
|
-
currentTask: PlanTask | null;
|
|
22
|
-
complete: boolean;
|
|
23
|
-
tasksStartLine: number | null;
|
|
24
|
-
tasksEndLine: number | null;
|
|
25
|
-
}
|
|
26
|
-
export type ParsedMarkdownPlan = ParsedPlan;
|
|
27
|
-
export declare function getPlanMetadata(content: string): {
|
|
28
|
-
title: string;
|
|
29
|
-
};
|
|
30
|
-
export declare function getTasksSectionRange(content: string): {
|
|
31
|
-
startIndex: number;
|
|
32
|
-
endIndex: number;
|
|
33
|
-
} | null;
|
|
34
|
-
export declare function parseMarkdownPlan(content: string, planId: string): ParsedPlan;
|
|
35
|
-
export declare const parsePlan: typeof parseMarkdownPlan;
|
|
36
|
-
export declare function createPlanMarkdown(planId: string, title?: string): string;
|
|
37
|
-
export declare function updateTaskCheckbox(content: string, taskId: string, checked: boolean): string;
|
|
38
|
-
export declare function formatPlanTitle(planId: string): string;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
type PlanTarget = {
|
|
2
|
-
type: "project";
|
|
3
|
-
} | {
|
|
4
|
-
type: "workspace";
|
|
5
|
-
rootProfile: "visible_projects" | "canonical_sync";
|
|
6
|
-
};
|
|
7
|
-
export declare const PLAN_EXTENSION = ".plan.md";
|
|
8
|
-
export declare function validatePlanId(planId: string): void;
|
|
9
|
-
export declare function assertPlanTarget(target: PlanTarget): void;
|
|
10
|
-
export declare function getWorkerPlansPath(target: PlanTarget): string;
|
|
11
|
-
/** The same worker path is used in prompts, injected reads, and file tools. */
|
|
12
|
-
export declare function getWorkerPlanPath(target: PlanTarget, planId: string): string;
|
|
13
|
-
export type WorkerReadPlanInput = {
|
|
14
|
-
planId: string;
|
|
15
|
-
createIfMissing: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type WorkerLintPlansInput = {
|
|
18
|
-
glob?: string;
|
|
19
|
-
};
|
|
20
|
-
export type WorkerUpdatePlanTaskInput = {
|
|
21
|
-
planId: string;
|
|
22
|
-
taskId: string;
|
|
23
|
-
checked: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type WorkerLintPlansResult = {
|
|
26
|
-
type: "lint_plans";
|
|
27
|
-
content: string;
|
|
28
|
-
};
|
|
29
|
-
export type WorkerUpdatePlanTaskResult = {
|
|
30
|
-
type: "update_task_status";
|
|
31
|
-
planId: string;
|
|
32
|
-
taskId: string;
|
|
33
|
-
checked: boolean;
|
|
34
|
-
message: string;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where a deleted branch checkout waits for collection. Staging is the only
|
|
3
|
-
* platform write into this directory and a live checkout always lives at
|
|
4
|
-
* `<projectRoot>/<branch>`, so a crash between staging and collection leaves
|
|
5
|
-
* nothing that a later sweep could confuse with a replacement branch. The
|
|
6
|
-
* filesystem is user-managed, though, so the collector never trusts the name
|
|
7
|
-
* alone: it removes only real directories or leaf links that sit under a real
|
|
8
|
-
* garbage directory of a real project directory (see `ownedStagedPath`).
|
|
9
|
-
* Distinct from `.r5d-removed`, which preserves paths that were not this
|
|
10
|
-
* project's worktree.
|
|
11
|
-
*/
|
|
12
|
-
export declare const PROJECT_DELETED_CHECKOUTS_DIRECTORY = ".r5d-deleted";
|
|
13
|
-
/**
|
|
14
|
-
* Rename a checkout this project owns out of the active namespace. One
|
|
15
|
-
* same-filesystem rename takes milliseconds whatever the tree holds, so the
|
|
16
|
-
* branch mutation lease is released long before the bytes are gone. The
|
|
17
|
-
* garbage directory must be a real directory: a planted link would make the
|
|
18
|
-
* later collection walk through it, so staging refuses rather than continue.
|
|
19
|
-
*/
|
|
20
|
-
export declare function stageProjectCheckoutForDeletion(projectRoot: string, branchName: string, checkoutPath: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Rename a whole project root out of the active namespace, into the
|
|
23
|
-
* namespace's garbage directory, so removing a deleted project never walks
|
|
24
|
-
* its checkouts on the worker event loop. Same guarantees as
|
|
25
|
-
* stageProjectCheckoutForDeletion: one same-filesystem rename, a real garbage
|
|
26
|
-
* directory, collection by the garbage collector later.
|
|
27
|
-
*/
|
|
28
|
-
export declare function stageProjectForDeletion(projectsRoot: string, projectRoot: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* True when `candidate` is lexically a direct entry of a project's garbage
|
|
31
|
-
* directory (`<namespace>/<project>/.r5d-deleted/<entry>`, a staged checkout)
|
|
32
|
-
* or of a namespace's garbage directory (`<namespace>/.r5d-deleted/<entry>`,
|
|
33
|
-
* a staged whole project) under `projectsRoot`.
|
|
34
|
-
*/
|
|
35
|
-
export declare function isStagedProjectCheckoutPath(projectsRoot: string, candidate: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether a lexically staged path is safe to remove right now: every ancestor
|
|
38
|
-
* below the projects root is a real directory (a linked namespace, project,
|
|
39
|
-
* or garbage directory would let a removal reach an unrelated tree through
|
|
40
|
-
* the link), and the entry itself is a real directory or a leaf link. Checked
|
|
41
|
-
* again immediately before the removal starts, never only at enqueue time.
|
|
42
|
-
*/
|
|
43
|
-
export declare function ownedStagedPath(projectsRoot: string, candidate: string): {
|
|
44
|
-
kind: "directory" | "link";
|
|
45
|
-
} | null;
|
|
46
|
-
/**
|
|
47
|
-
* Every owned staged checkout under `<projectsRoot>/<namespace>/<project>/.r5d-deleted/`
|
|
48
|
-
* and every owned staged project under `<projectsRoot>/<namespace>/.r5d-deleted/`;
|
|
49
|
-
* linked ancestors are not followed.
|
|
50
|
-
*/
|
|
51
|
-
export declare function discoverStagedProjectCheckouts(projectsRoot: string): string[];
|
|
52
|
-
/**
|
|
53
|
-
* Delete a staged tree in a child process so a large recursive removal never
|
|
54
|
-
* runs on the worker event loop, at the lowest CPU and (where supported) I/O
|
|
55
|
-
* priority so live agents on the same volume keep their share. A leaf link is
|
|
56
|
-
* unlinked in place; its target is never followed.
|
|
57
|
-
*/
|
|
58
|
-
export declare function removeStagedProjectCheckout(stagedPath: string): Promise<void>;
|
|
59
|
-
type Logger = (message: string) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Collects staged checkouts one at a time, outside every workspace lease.
|
|
62
|
-
* Entries are enqueued right after staging and by `sweep()` at worker start,
|
|
63
|
-
* so a crash at any point converges on the next start. A failed removal is
|
|
64
|
-
* logged and left for the next sweep.
|
|
65
|
-
*/
|
|
66
|
-
export declare class ProjectCheckoutGarbageCollector {
|
|
67
|
-
private readonly projectsRoot;
|
|
68
|
-
private readonly remove;
|
|
69
|
-
private readonly log;
|
|
70
|
-
private readonly queued;
|
|
71
|
-
private tail;
|
|
72
|
-
private collectedCount;
|
|
73
|
-
constructor(options: {
|
|
74
|
-
projectsRoot: string;
|
|
75
|
-
remove?: (stagedPath: string) => Promise<void>;
|
|
76
|
-
log?: Logger;
|
|
77
|
-
});
|
|
78
|
-
/** Number of removals that have completed successfully. */
|
|
79
|
-
get collected(): number;
|
|
80
|
-
/** Resolves once everything queued so far has been attempted. */
|
|
81
|
-
get idle(): Promise<void>;
|
|
82
|
-
enqueue(stagedPath: string): void;
|
|
83
|
-
/** Enqueue every staged checkout left behind by an earlier process. */
|
|
84
|
-
sweep(): number;
|
|
85
|
-
}
|
|
86
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decides which part of a project's hidden mirror a periodic observation must
|
|
3
|
-
* fetch, from the tokens the server advertises and the tokens the worker's
|
|
4
|
-
* own mirror refs cover (both computed with `project-mirror-refs-token.ts`).
|
|
5
|
-
*
|
|
6
|
-
* Skipping is fail-open: any missing or mismatched information fetches.
|
|
7
|
-
*
|
|
8
|
-
* There is deliberately no timed backstop refetch for matching tokens. The
|
|
9
|
-
* server recomputes every advertised token from the canonical repository on
|
|
10
|
-
* disk on each heartbeat sweep, so a matching token is a fresh statement that
|
|
11
|
-
* the fetch would transfer nothing, whoever moved the refs. The worker
|
|
12
|
-
* records the tokens it covers from its own refs after every fetch and lease
|
|
13
|
-
* push, with the same shared formula, so a skip can only be stale if the
|
|
14
|
-
* canonical repository moved after the sweep that produced the advertisement
|
|
15
|
-
* — which the next sweep corrects, exactly like a tip that lands mid-cycle —
|
|
16
|
-
* or if the formula itself were wrong, which the shared module and its locked
|
|
17
|
-
* vectors guard and a periodic blind fetch would only hide. A project or
|
|
18
|
-
* mount the server advertises no token for fetches every cycle, as before
|
|
19
|
-
* tokens existed.
|
|
20
|
-
*/
|
|
21
|
-
/** Why a fetch runs. `fail_closed` is never decided here: reset and remediation observation bypasses the gate. */
|
|
22
|
-
export type ProjectMirrorFetchReason = "skipping_disabled" | "no_advertised_token" | "never_fetched" | "token_changed" | "fail_closed";
|
|
23
|
-
export type ProjectMirrorFetchDecision = {
|
|
24
|
-
fetch: true;
|
|
25
|
-
reason: ProjectMirrorFetchReason;
|
|
26
|
-
} | {
|
|
27
|
-
fetch: false;
|
|
28
|
-
reason: "token_match";
|
|
29
|
-
};
|
|
30
|
-
export declare function projectMirrorFetchDecision(input: {
|
|
31
|
-
advertisedToken: string | undefined;
|
|
32
|
-
fetchedToken: string | undefined;
|
|
33
|
-
skippingEnabled: boolean;
|
|
34
|
-
}): ProjectMirrorFetchDecision;
|
|
35
|
-
export type ProjectMirrorObservationFetchPlan =
|
|
36
|
-
/** Fetch every canonical ref of the project, as observation always did before per-mount tokens. */
|
|
37
|
-
{
|
|
38
|
-
scope: "project";
|
|
39
|
-
reason: ProjectMirrorFetchReason;
|
|
40
|
-
}
|
|
41
|
-
/** Fetch only the named mounts' branch heads and handoff refs. */
|
|
42
|
-
| {
|
|
43
|
-
scope: "mounts";
|
|
44
|
-
mounts: Array<{
|
|
45
|
-
branchName: string;
|
|
46
|
-
reason: ProjectMirrorFetchReason;
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
|
-
/** Every token the observation depends on matches; reuse the local refs. */
|
|
50
|
-
| {
|
|
51
|
-
scope: "none";
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Plan one project's observation fetch. With per-mount tokens advertised for
|
|
55
|
-
* the project, each mount decides for itself and only changed mounts fetch;
|
|
56
|
-
* without them (an older server) the project token decides for the whole
|
|
57
|
-
* mirror.
|
|
58
|
-
*/
|
|
59
|
-
export declare function planProjectMirrorObservationFetch(input: {
|
|
60
|
-
branchNames: readonly string[];
|
|
61
|
-
advertisedProjectToken: string | undefined;
|
|
62
|
-
/** Per-mount tokens for this project, keyed by branch name; undefined when the server advertised none. */
|
|
63
|
-
advertisedMountTokens: ReadonlyMap<string, string> | undefined;
|
|
64
|
-
fetchedProjectToken: string | undefined;
|
|
65
|
-
fetchedMountTokens: ReadonlyMap<string, string>;
|
|
66
|
-
skippingEnabled: boolean;
|
|
67
|
-
}): ProjectMirrorObservationFetchPlan;
|
|
68
|
-
export type ProjectMirrorRefsTokensAdvertisement = {
|
|
69
|
-
/** One token per project id. */
|
|
70
|
-
projectTokens: Map<string, string>;
|
|
71
|
-
/** Per-mount tokens keyed by project id then branch name; a project is present only when the server advertised mount tokens for it. */
|
|
72
|
-
mountTokens: Map<string, Map<string, string>>;
|
|
73
|
-
/** Current head of the user's hidden workspace repository, when advertised. */
|
|
74
|
-
workspaceHead: string | undefined;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Read a `project_mirror_refs_tokens` message. Older servers send only
|
|
78
|
-
* `tokens`; malformed entries are dropped, which fails open into fetching.
|
|
79
|
-
*/
|
|
80
|
-
export declare function parseProjectMirrorRefsTokensMessage(message: {
|
|
81
|
-
tokens?: unknown;
|
|
82
|
-
mountTokens?: unknown;
|
|
83
|
-
workspaceHead?: unknown;
|
|
84
|
-
}): ProjectMirrorRefsTokensAdvertisement;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/** Canonical namespaces the token hashes; also the observation fetch's sources. */
|
|
2
|
-
export declare const PROJECT_MIRROR_REFS_TOKEN_NAMESPACES: readonly ["refs/heads/", "refs/r5d/server-synced/"];
|
|
3
|
-
/** Worker-local copy of a canonical `refs/heads/*` ref. */
|
|
4
|
-
export declare const PROJECT_MIRROR_REF_PREFIX = "refs/r5d/mirror/";
|
|
5
|
-
export declare const PROJECT_SERVER_SYNCED_REF_PREFIX = "refs/r5d/server-synced/";
|
|
6
|
-
/** `git for-each-ref` format both sides list refs with; see parseProjectMirrorRefListing. */
|
|
7
|
-
export declare const PROJECT_MIRROR_REF_LISTING_FORMAT = "--format=%(objectname) %(refname)";
|
|
8
|
-
export type ProjectMirrorRef = {
|
|
9
|
-
refname: string;
|
|
10
|
-
objectName: string;
|
|
11
|
-
};
|
|
12
|
-
/** One checked-out project branch, identified by its durable incarnation id. */
|
|
13
|
-
export type ProjectMirrorMount = {
|
|
14
|
-
branchName: string;
|
|
15
|
-
branchId: string;
|
|
16
|
-
};
|
|
17
|
-
export type ProjectMirrorRefsTokens = {
|
|
18
|
-
/** Hash over every ref in the observed namespaces. */
|
|
19
|
-
project: string;
|
|
20
|
-
/** Hash over one mount's branch head plus its handoff refs, keyed by branch name. */
|
|
21
|
-
mounts: Map<string, string>;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Hash a ref listing into a mirror-refs token. Both sides sort here rather
|
|
25
|
-
* than trusting git's listing order: renaming `refs/r5d/mirror/*` back to
|
|
26
|
-
* `refs/heads/*` changes sort neighborhoods.
|
|
27
|
-
*/
|
|
28
|
-
export declare function hashProjectMirrorRefs(refs: readonly ProjectMirrorRef[]): string;
|
|
29
|
-
/**
|
|
30
|
-
* Parse `git for-each-ref` output produced with
|
|
31
|
-
* PROJECT_MIRROR_REF_LISTING_FORMAT. Malformed rows throw rather than being
|
|
32
|
-
* dropped: a caller that cannot trust its listing must not produce a token.
|
|
33
|
-
* With `namespaces`, rows outside them throw too.
|
|
34
|
-
*/
|
|
35
|
-
export declare function parseProjectMirrorRefListing(output: string, options?: {
|
|
36
|
-
namespaces?: readonly string[];
|
|
37
|
-
}): ProjectMirrorRef[];
|
|
38
|
-
/**
|
|
39
|
-
* Rename locally fetched mirror refs into the namespaces the server hashes.
|
|
40
|
-
* Rows outside the two observed namespaces are dropped; the caller lists only
|
|
41
|
-
* those namespaces, so a dropped row means an unexpected listing, and dropping
|
|
42
|
-
* it can only make tokens differ — which fails open into a fetch.
|
|
43
|
-
*/
|
|
44
|
-
export declare function canonicalizeLocalProjectMirrorRefs(refs: readonly ProjectMirrorRef[]): ProjectMirrorRef[];
|
|
45
|
-
/** The canonical refs one mount's token covers: its branch head and its server-synced handoff refs. */
|
|
46
|
-
export declare function projectMirrorMountRefs(refs: readonly ProjectMirrorRef[], mount: ProjectMirrorMount): ProjectMirrorRef[];
|
|
47
|
-
/**
|
|
48
|
-
* Compute the project token and one token per mount from one canonical ref
|
|
49
|
-
* listing. A mount's token is the project formula applied to the mount's own
|
|
50
|
-
* refs, so a mount whose branch is the only ref of its project has the same
|
|
51
|
-
* token as the project.
|
|
52
|
-
*/
|
|
53
|
-
export declare function projectMirrorRefsTokens(refs: readonly ProjectMirrorRef[], mounts: readonly ProjectMirrorMount[]): ProjectMirrorRefsTokens;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { type CheckoutPathSegments } from "./managed-paths";
|
|
2
|
-
export declare const PROJECT_WORKSPACE_STATE_FILE = "project-workspace-state.json";
|
|
3
|
-
export type ProjectWorkspaceDesiredProjectInput = {
|
|
4
|
-
projectId: string;
|
|
5
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
6
|
-
defaultBranch: string;
|
|
7
|
-
branches: readonly {
|
|
8
|
-
branchName: string;
|
|
9
|
-
}[];
|
|
10
|
-
};
|
|
11
|
-
export type ProjectWorkspaceDesiredProject = {
|
|
12
|
-
projectId: string;
|
|
13
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
14
|
-
defaultBranch: string;
|
|
15
|
-
branches: Array<{
|
|
16
|
-
branchName: string;
|
|
17
|
-
}>;
|
|
18
|
-
};
|
|
19
|
-
export type LocallyPendingCreatedProjectBranch = {
|
|
20
|
-
/** Durable project_branches row incarnation; absent only in legacy state. */
|
|
21
|
-
branchId?: string;
|
|
22
|
-
projectId: string;
|
|
23
|
-
branchName: string;
|
|
24
|
-
};
|
|
25
|
-
export type PreserveOnlyProjectBranch = {
|
|
26
|
-
branchId: string;
|
|
27
|
-
projectId: string;
|
|
28
|
-
branchName: string;
|
|
29
|
-
};
|
|
30
|
-
export type EnabledRepositoryTransition = {
|
|
31
|
-
projectId: string;
|
|
32
|
-
transitionId: string | null;
|
|
33
|
-
};
|
|
34
|
-
type ProjectWorkspaceDeletionBase = {
|
|
35
|
-
id: string;
|
|
36
|
-
projectId: string;
|
|
37
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
38
|
-
treePublishedHead: string | null;
|
|
39
|
-
mirrorRefsDeleted: string[];
|
|
40
|
-
};
|
|
41
|
-
export type ProjectWorkspaceBranchDeletionTombstone = ProjectWorkspaceDeletionBase & {
|
|
42
|
-
kind: "branch";
|
|
43
|
-
branchName: string;
|
|
44
|
-
};
|
|
45
|
-
export type ProjectWorkspaceProjectDeletionTombstone = ProjectWorkspaceDeletionBase & {
|
|
46
|
-
kind: "project";
|
|
47
|
-
branchNames: string[];
|
|
48
|
-
};
|
|
49
|
-
export type ProjectWorkspaceDeletionTombstone = ProjectWorkspaceBranchDeletionTombstone | ProjectWorkspaceProjectDeletionTombstone;
|
|
50
|
-
export type PendingProjectWorkspaceTreeDeletion = {
|
|
51
|
-
tombstoneId: string;
|
|
52
|
-
kind: "branch";
|
|
53
|
-
projectId: string;
|
|
54
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
55
|
-
branchName: string;
|
|
56
|
-
managedPath: string;
|
|
57
|
-
primaryBranchName: string | null;
|
|
58
|
-
} | {
|
|
59
|
-
tombstoneId: string;
|
|
60
|
-
kind: "project";
|
|
61
|
-
projectId: string;
|
|
62
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
63
|
-
branchNames: string[];
|
|
64
|
-
managedPath: string;
|
|
65
|
-
projectDeleted: boolean;
|
|
66
|
-
};
|
|
67
|
-
export type PendingProjectMirrorRefDeletion = {
|
|
68
|
-
tombstoneId: string;
|
|
69
|
-
projectId: string;
|
|
70
|
-
branchName: string;
|
|
71
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
72
|
-
managedPath: string;
|
|
73
|
-
primaryBranchName: string | null;
|
|
74
|
-
treePublishedHead: string;
|
|
75
|
-
};
|
|
76
|
-
export type ProjectWorkspaceStateView = {
|
|
77
|
-
desiredProjects: ProjectWorkspaceDesiredProject[];
|
|
78
|
-
effectiveDesiredProjects: ProjectWorkspaceDesiredProject[];
|
|
79
|
-
locallyPendingCreatedBranches: LocallyPendingCreatedProjectBranch[];
|
|
80
|
-
enabledRepositoryTransitions: EnabledRepositoryTransition[];
|
|
81
|
-
tombstones: ProjectWorkspaceDeletionTombstone[];
|
|
82
|
-
pendingTreeDeletions: PendingProjectWorkspaceTreeDeletion[];
|
|
83
|
-
pendingMirrorRefDeletions: PendingProjectMirrorRefDeletion[];
|
|
84
|
-
};
|
|
85
|
-
export declare class ProjectWorkspacePendingBranchPathChangeError extends Error {
|
|
86
|
-
readonly projectId: string;
|
|
87
|
-
readonly branchName: string;
|
|
88
|
-
readonly currentCheckoutPathSegments: CheckoutPathSegments;
|
|
89
|
-
readonly incomingCheckoutPathSegments: CheckoutPathSegments;
|
|
90
|
-
constructor(input: {
|
|
91
|
-
projectId: string;
|
|
92
|
-
branchName: string;
|
|
93
|
-
currentCheckoutPathSegments: CheckoutPathSegments;
|
|
94
|
-
incomingCheckoutPathSegments: CheckoutPathSegments;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
export declare class ProjectWorkspaceCheckoutPathCollisionError extends Error {
|
|
98
|
-
readonly projectId: string;
|
|
99
|
-
readonly occupyingProjectId: string;
|
|
100
|
-
readonly checkoutPathSegments: CheckoutPathSegments;
|
|
101
|
-
constructor(input: {
|
|
102
|
-
projectId: string;
|
|
103
|
-
occupyingProjectId: string;
|
|
104
|
-
checkoutPathSegments: CheckoutPathSegments;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
export type StaleOuterProjectWorkspaceBranch = {
|
|
108
|
-
kind: "branch";
|
|
109
|
-
projectId: string;
|
|
110
|
-
branchName: string;
|
|
111
|
-
projectTreePath: string | null;
|
|
112
|
-
planTreePath: string | null;
|
|
113
|
-
};
|
|
114
|
-
export type StaleOuterProjectWorkspaceProject = {
|
|
115
|
-
kind: "project";
|
|
116
|
-
projectId: string;
|
|
117
|
-
projectTreePath: string | null;
|
|
118
|
-
planTreePath: string | null;
|
|
119
|
-
branches: Array<{
|
|
120
|
-
branchName: string;
|
|
121
|
-
projectTreePath: string | null;
|
|
122
|
-
planTreePath: string | null;
|
|
123
|
-
}>;
|
|
124
|
-
};
|
|
125
|
-
export type StaleOuterProjectWorkspaceEntry = StaleOuterProjectWorkspaceBranch | StaleOuterProjectWorkspaceProject;
|
|
126
|
-
/**
|
|
127
|
-
* A fresh authoritative configuration wins over any deletion staged by an
|
|
128
|
-
* older configuration. Remove only exact project/branch targets so unrelated
|
|
129
|
-
* cleanup (including an old checkout-path tombstone) remains durable.
|
|
130
|
-
*/
|
|
131
|
-
export declare function pruneAuthoritativelyDesiredBranchDeletions<T extends LocallyPendingCreatedProjectBranch>(pendingDeletions: Map<string, T>, desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[]): void;
|
|
132
|
-
/**
|
|
133
|
-
* Discover legacy outer-tree entries without trusting or walking arbitrary
|
|
134
|
-
* filesystem names. Only canonical managed project ids and encoded branch
|
|
135
|
-
* directory names are returned; symlinks, files, and non-layout entries are
|
|
136
|
-
* deliberately left for an operator.
|
|
137
|
-
*/
|
|
138
|
-
export declare function discoverStaleOuterProjectWorkspaceEntries(input: {
|
|
139
|
-
workspaceShadowRoot: string;
|
|
140
|
-
desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[];
|
|
141
|
-
locallyPendingCreatedBranches?: readonly LocallyPendingCreatedProjectBranch[];
|
|
142
|
-
}): StaleOuterProjectWorkspaceEntry[];
|
|
143
|
-
/**
|
|
144
|
-
* Durable worker-local ledger for desired project mounts and ordered deletion
|
|
145
|
-
* side effects. The caller must remove each managed path before including its
|
|
146
|
-
* tombstone in an outer-tree publication. Mirror refs may be acknowledged only
|
|
147
|
-
* after that publication is durably recorded.
|
|
148
|
-
*/
|
|
149
|
-
export declare class ProjectWorkspaceStateStore {
|
|
150
|
-
readonly stateRoot: string;
|
|
151
|
-
readonly projectsRoot: string;
|
|
152
|
-
readonly statePath: string;
|
|
153
|
-
constructor(input: {
|
|
154
|
-
stateRoot: string;
|
|
155
|
-
projectsRoot: string;
|
|
156
|
-
});
|
|
157
|
-
read(): ProjectWorkspaceStateView;
|
|
158
|
-
discoverStaleOuterEntries(workspaceShadowRoot: string): StaleOuterProjectWorkspaceEntry[];
|
|
159
|
-
reconcile(input: {
|
|
160
|
-
desiredProjects: readonly ProjectWorkspaceDesiredProjectInput[];
|
|
161
|
-
locallyPendingCreatedBranches?: readonly LocallyPendingCreatedProjectBranch[];
|
|
162
|
-
preserveOnlyBranches?: readonly PreserveOnlyProjectBranch[];
|
|
163
|
-
}): Promise<ProjectWorkspaceStateView>;
|
|
164
|
-
/** Record a successful enabled reseed without letting disabled config consume it. */
|
|
165
|
-
recordEnabledRepositoryTransition(input: EnabledRepositoryTransition): Promise<ProjectWorkspaceStateView>;
|
|
166
|
-
/** Persist the create intent before invoking Git so a crash cannot orphan an untracked worktree. */
|
|
167
|
-
recordPendingCreatedBranch(input: LocallyPendingCreatedProjectBranch & {
|
|
168
|
-
branchId: string;
|
|
169
|
-
}): Promise<ProjectWorkspaceStateView>;
|
|
170
|
-
/** Roll back an intent only when Git failed before creating its branch. */
|
|
171
|
-
rollbackPendingCreatedBranch(input: LocallyPendingCreatedProjectBranch): Promise<ProjectWorkspaceStateView>;
|
|
172
|
-
/** Clear a create intent after an authoritative desired config contains it. */
|
|
173
|
-
clearPendingCreatedBranch(input: LocallyPendingCreatedProjectBranch): Promise<ProjectWorkspaceStateView>;
|
|
174
|
-
/** Persist a branch tombstone before mutating its linked worktree or local ref. */
|
|
175
|
-
beginBranchDeletion(input: LocallyPendingCreatedProjectBranch): Promise<ProjectWorkspaceStateView>;
|
|
176
|
-
recordTreePublication(input: {
|
|
177
|
-
tombstoneIds: readonly string[];
|
|
178
|
-
publishedHead: string;
|
|
179
|
-
}): Promise<ProjectWorkspaceStateView>;
|
|
180
|
-
recordMirrorRefDeletion(input: {
|
|
181
|
-
tombstoneId: string;
|
|
182
|
-
branchName: string;
|
|
183
|
-
}): Promise<ProjectWorkspaceStateView>;
|
|
184
|
-
}
|
|
185
|
-
export declare const projectWorkspaceStateTestHarness: {
|
|
186
|
-
writeEmptyStateAtDurableRootBoundary(stateRoot: string, afterStateRootFsync: () => void): Promise<void>;
|
|
187
|
-
};
|
|
188
|
-
export {};
|