@ricsam/r5d-worker 0.0.35 → 0.0.37

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.
@@ -11,39 +11,6 @@ type WorkerReadFileResult = {
11
11
  truncated: boolean;
12
12
  continuation?: string;
13
13
  };
14
- type WorkerProjectManifestEntry = {
15
- projectId: string;
16
- repoSlug: string;
17
- projectPath: string;
18
- repoHttpUrl: string | null;
19
- repoAuthHeader: string | null;
20
- defaultBranch: string;
21
- branches: string[];
22
- internalRemoteUrl: string;
23
- };
24
- type WorkerRepositorySyncTarget = {
25
- projectId: string;
26
- projectPath: string;
27
- branchName: string;
28
- };
29
- type WorkerRepositorySyncSelector = {
30
- projectId: string;
31
- branchName: string;
32
- };
33
- type WorkerRepositorySyncResult = {
34
- status: "completed" | "partial" | "blocked";
35
- results: Array<WorkerRepositorySyncTarget & ({
36
- status: "synced";
37
- commitHash: string;
38
- } | {
39
- status: "failed";
40
- error: string;
41
- })>;
42
- blockedBy: Array<WorkerRepositorySyncTarget & {
43
- kind: "dirty_checkout" | "shell";
44
- id: string;
45
- }>;
46
- };
47
14
  type WorkerGrepResult = {
48
15
  type: "grep";
49
16
  content: string;
@@ -72,28 +39,6 @@ type WorkerViewFileBytesResult = {
72
39
  width: number;
73
40
  height: number;
74
41
  };
75
- type WorkerManagedCheckout = {
76
- projectId: string;
77
- projectPath: string;
78
- branchName: string;
79
- checkoutPath: string;
80
- };
81
- type WorkerResolveManagedPathResult = {
82
- type: "resolve_managed_path";
83
- resolved: (WorkerManagedCheckout & {
84
- inputPath: string;
85
- absolutePath: string;
86
- repoRelativePath: string;
87
- }) | null;
88
- };
89
- type WorkerWorkspaceStatusResult = {
90
- type: "workspace_status";
91
- checkouts: Array<WorkerManagedCheckout & {
92
- commitHash: string;
93
- status: string;
94
- dirty: boolean;
95
- }>;
96
- };
97
42
  export declare function isArtifactEnvPath(filePath: string): boolean;
98
43
  export declare function syncSessionArtifacts(input: {
99
44
  baseUrl: string;
@@ -145,13 +90,6 @@ export declare function resolveWorkerFilePath(branchPath: string, inputPath: str
145
90
  export declare function resolveProjectFilePath(branchPath: string, inputPath: string): Extract<ResolvedWorkerFilePath, {
146
91
  scope: "project";
147
92
  }>;
148
- export declare function resolveManagedCheckoutPath(input: {
149
- projectsRoot: string;
150
- manifests: WorkerProjectManifestEntry[];
151
- originProjectId: string;
152
- originBranchName: string;
153
- inputPath: string;
154
- }): WorkerResolveManagedPathResult;
155
93
  export declare function githubCliEnv(token: string | null | undefined): Record<string, string>;
156
94
  export declare function ensureVisibleGitCheckout(input: {
157
95
  projectRoot: string;
@@ -162,36 +100,6 @@ export declare function ensureVisibleGitCheckout(input: {
162
100
  defaultBranch: string;
163
101
  reconcileExistingOrigin?: boolean;
164
102
  }): string;
165
- export declare function findRepositorySyncBlockers(input: {
166
- targets: WorkerRepositorySyncTarget[];
167
- shells: Array<{
168
- id: string;
169
- projectId: string;
170
- branchName: string;
171
- }>;
172
- }): WorkerRepositorySyncResult["blockedBy"];
173
- export declare function selectManifestSyncTargets(input: {
174
- manifests: WorkerProjectManifestEntry[];
175
- requestedTargets?: WorkerRepositorySyncSelector[];
176
- }): Array<{
177
- manifest: WorkerProjectManifestEntry;
178
- branchName: string;
179
- }>;
180
- export declare function syncManifestProjectsFromInternal(input: {
181
- baseUrl: string;
182
- token: string;
183
- projectsRoot: string;
184
- syncRoot: string;
185
- manifests: WorkerProjectManifestEntry[];
186
- requestedTargets?: WorkerRepositorySyncSelector[];
187
- }): Promise<WorkerRepositorySyncResult>;
188
- export declare function inspectManagedWorkspace(input: {
189
- baseUrl: string;
190
- token: string;
191
- projectsRoot: string;
192
- syncRoot: string;
193
- manifests: WorkerProjectManifestEntry[];
194
- }): Promise<WorkerWorkspaceStatusResult>;
195
103
  export declare function readWorkerTextFile(branchPath: string, filePath: string, offset?: number, limit?: number): WorkerReadFileResult;
196
104
  export declare function grepWorkerFiles(branchPath: string, input: {
197
105
  pattern: string;
@@ -0,0 +1,73 @@
1
+ export declare const WORKSPACE_BRANCH = "main";
2
+ export declare const MAX_WORKSPACE_SYNC_DIFF_BYTES: number;
3
+ export declare const WORKSPACE_PERIODIC_SCAN_INTERVAL_MS = 5000;
4
+ export type WorkspaceProjectManifestEntry = {
5
+ projectId: string;
6
+ repoSlug: string;
7
+ projectPath: string;
8
+ repoHttpUrl: string | null;
9
+ repoAuthHeader: string | null;
10
+ defaultBranch: string;
11
+ branches: string[];
12
+ };
13
+ export type WorkspaceSyncTrigger = {
14
+ type: "connect" | "inbound_head" | "write" | "edit" | "plan_write" | "task_status" | "shell_inline" | "process_terminal" | "process_cancel" | "periodic" | "manual" | "remediation" | "remediation_confirm" | "remediation_reset";
15
+ sessionId?: string;
16
+ processRunId?: string;
17
+ toolCallId?: string;
18
+ projectId?: string;
19
+ branchName?: string;
20
+ detail?: string;
21
+ };
22
+ export type WorkspaceSyncOutcome = "no_change" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "reset" | "failed";
23
+ export type WorkspaceSyncResult = {
24
+ type: "workspace_sync";
25
+ attemptId: string;
26
+ workerLabel: string;
27
+ trigger: WorkspaceSyncTrigger;
28
+ outcome: WorkspaceSyncOutcome;
29
+ startingHead: string | null;
30
+ candidateHead?: string;
31
+ publishedHead?: string;
32
+ rebaseCount: number;
33
+ diffSizeBytes: number;
34
+ gitStatus: string;
35
+ affectedProjects: string[];
36
+ affectedPaths: string[];
37
+ discardedPaths: string[];
38
+ localChangesDiscarded: boolean;
39
+ error?: string;
40
+ };
41
+ export type WorkspaceSyncInput = {
42
+ attemptId?: string;
43
+ workerLabel: string;
44
+ remoteUrl: string;
45
+ authHeader?: string;
46
+ projectsRoot: string;
47
+ plansRoot: string;
48
+ shadowRoot: string;
49
+ projects: WorkspaceProjectManifestEntry[];
50
+ trigger: WorkspaceSyncTrigger;
51
+ confirmedLargeDiff?: boolean;
52
+ confirmationReason?: string;
53
+ resetToCanonical?: boolean;
54
+ skipVisibleMirror?: boolean;
55
+ newVisibleCheckouts?: Array<{
56
+ projectId: string;
57
+ branchName: string;
58
+ }>;
59
+ };
60
+ export declare function encodeWorkspaceBranch(branchName: string): string;
61
+ export declare function workspaceProjectBranchRelativePath(projectId: string, branchName: string): string;
62
+ export declare function workspacePlansRelativePath(projectId: string, branchName: string): string;
63
+ export declare function visibleProjectBranchPath(projectsRoot: string, manifest: WorkspaceProjectManifestEntry, branchName: string): string;
64
+ export declare function mirrorVisibleWorkspaceToShadow(input: WorkspaceSyncInput, excludedCheckouts?: ReadonlySet<string>): void;
65
+ export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput): void;
66
+ export declare function synchronizeWorkspace(rawInput: WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
67
+ export declare function calculateWorkspaceDiffFingerprint(input: WorkspaceSyncInput): string;
68
+ export declare class WorkspaceSyncSingleFlight {
69
+ private queue;
70
+ run(input: WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
71
+ fingerprint(input: WorkspaceSyncInput): Promise<string>;
72
+ afterCurrent(): Promise<void>;
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",