@ricsam/r5d-worker 0.0.46 → 0.0.47

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.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bun
2
+ import { type WorkspaceProjectManifestEntry } from "./workspace-sync";
2
3
  type WorkerReadFileResult = {
3
4
  type: "read";
4
5
  kind: "text";
@@ -11,6 +12,7 @@ type WorkerReadFileResult = {
11
12
  truncated: boolean;
12
13
  continuation?: string;
13
14
  };
15
+ type WorkerProjectManifestEntry = WorkspaceProjectManifestEntry;
14
16
  type WorkerWriteFileResult = {
15
17
  type: "write";
16
18
  file: string;
@@ -81,6 +83,13 @@ type GitAuth = {
81
83
  extraHeaderUrl: string;
82
84
  header: string;
83
85
  };
86
+ declare function gitAuthArgs(auth?: GitAuth): string[];
87
+ export declare const visibleCheckoutGitTestHarness: {
88
+ gitAuthArgs: typeof gitAuthArgs;
89
+ commandArgs: (args: string[], auth?: GitAuth) => string[];
90
+ cloneArgs: (remoteUrl: string, branchPath: string) => string[];
91
+ fetchArgs: (...args: string[]) => string[];
92
+ };
84
93
  type ResolvedWorkerFilePath = {
85
94
  absolutePath: string;
86
95
  displayPath: string;
@@ -99,16 +108,44 @@ type ResolvedWorkerFilePath = {
99
108
  virtualRootPath: string;
100
109
  };
101
110
  export declare function resolveWorkerFilePath(branchPath: string, inputPath: string, builtInPaths?: WorkerBuiltInToolPaths): ResolvedWorkerFilePath;
111
+ export declare function visibleCheckoutRemoteFor(input: {
112
+ baseUrl: string;
113
+ token: string;
114
+ projectId: string;
115
+ branchName: string;
116
+ manifest?: WorkerProjectManifestEntry;
117
+ }): {
118
+ remoteUrl: string;
119
+ authHeader: string | null;
120
+ persistAuth: boolean;
121
+ reconcileExistingOrigin: boolean;
122
+ requireRemoteBranch: boolean;
123
+ requiredBaseCommit: string | null;
124
+ };
102
125
  export declare function githubCliEnv(token: string | null | undefined): Record<string, string>;
103
126
  export declare function ensureVisibleGitCheckout(input: {
104
127
  projectRoot: string;
105
128
  branchName: string;
106
- githubRemoteUrl: string;
107
- githubAuth?: GitAuth;
108
- githubAuthHeader?: string | null;
129
+ remoteUrl: string;
130
+ remoteAuth?: GitAuth;
131
+ persistentAuthHeader?: string | null;
109
132
  defaultBranch: string;
110
133
  reconcileExistingOrigin?: boolean;
134
+ requireRemoteBranch?: boolean;
135
+ requiredBaseCommit?: string | null;
136
+ allowRequiredRemoteMigration?: boolean;
137
+ clearPersistentAuth?: boolean;
111
138
  }): string;
139
+ type VisibleCheckoutTarget = {
140
+ projectId: string;
141
+ branchName: string;
142
+ };
143
+ export declare function workspaceSyncCheckoutTargets(input: {
144
+ projects: readonly WorkspaceProjectManifestEntry[];
145
+ pendingTargets: readonly VisibleCheckoutTarget[];
146
+ includeAllManifestCheckouts: boolean;
147
+ canonicalCheckoutOnly?: VisibleCheckoutTarget;
148
+ }): VisibleCheckoutTarget[];
112
149
  export declare function readWorkerTextFile(branchPath: string, filePath: string, offset?: number, limit?: number, builtInPaths?: WorkerBuiltInToolPaths): WorkerReadFileResult;
113
150
  export declare function writeWorkerTextFile(branchPath: string, filePath: string, content: string, builtInPaths?: WorkerBuiltInToolPaths): WorkerWriteFileResult;
114
151
  export declare function editWorkerTextFile(branchPath: string, filePath: string, edits: Array<{
@@ -10,6 +10,10 @@ export type WorkspaceProjectManifestEntry = {
10
10
  repoAuthHeader: string | null;
11
11
  defaultBranch: string;
12
12
  branches: string[];
13
+ canonicalCheckouts: Array<{
14
+ branchName: string;
15
+ scaffoldCommitHash: string;
16
+ }>;
13
17
  };
14
18
  export type WorkspaceSyncTrigger = {
15
19
  type: "connect" | "inbound_head" | "write" | "edit" | "shell_inline" | "process_terminal" | "process_cancel" | "periodic" | "manual" | "remediation" | "remediation_confirm" | "remediation_reset";
@@ -18,6 +22,12 @@ export type WorkspaceSyncTrigger = {
18
22
  toolCallId?: string;
19
23
  projectId?: string;
20
24
  branchName?: string;
25
+ /**
26
+ * Restricts this synchronization to the exact canonical resolver checkout
27
+ * identified by projectId/branchName. Ordinary synchronization never reads
28
+ * or writes canonical resolver checkout subtrees.
29
+ */
30
+ canonicalCheckoutOnly?: boolean;
21
31
  detail?: string;
22
32
  };
23
33
  export type WorkspaceSyncOutcome = "no_change" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "reset" | "failed";
@@ -37,6 +47,7 @@ export type WorkspaceSyncResult = {
37
47
  affectedPaths: string[];
38
48
  discardedPaths: string[];
39
49
  localChangesDiscarded: boolean;
50
+ sampledCanonicalCheckoutTreeHash?: string;
40
51
  error?: string;
41
52
  };
42
53
  export type WorkspaceSyncInput = {
@@ -59,13 +70,28 @@ export type WorkspaceSyncInput = {
59
70
  }>;
60
71
  };
61
72
  export declare function encodeWorkspaceBranch(branchName: string): string;
73
+ /**
74
+ * Treat canonical resolver checkouts as a separate synchronization authority.
75
+ * Generic workspace scans omit them; an explicitly scoped request contains
76
+ * exactly one resolver checkout and no sibling branches.
77
+ */
78
+ export declare function workspaceProjectsForSync(projects: readonly WorkspaceProjectManifestEntry[], trigger: WorkspaceSyncTrigger): WorkspaceProjectManifestEntry[];
62
79
  export declare function workspaceProjectBranchRelativePath(projectId: string, branchName: string): string;
63
80
  export declare function workspacePlansRelativePath(projectId: string, branchName: string): string;
64
81
  export declare function visibleProjectBranchPath(projectsRoot: string, manifest: WorkspaceProjectManifestEntry, branchName: string): string;
65
- export declare function mirrorVisibleWorkspaceToShadow(input: WorkspaceSyncInput, excludedCheckouts?: ReadonlySet<string>): void;
66
- export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput): void;
82
+ type GitlinkEntry = {
83
+ filePath: string;
84
+ objectId: string;
85
+ };
86
+ type GitlinkProjection = {
87
+ entries: GitlinkEntry[];
88
+ opaqueRoots: string[];
89
+ };
90
+ export declare function assertCanonicalCheckoutIndexMatchesWorktree(checkoutPath: string): void;
91
+ export declare function mirrorVisibleWorkspaceToShadow(input: WorkspaceSyncInput, excludedCheckouts?: ReadonlySet<string>): GitlinkProjection;
92
+ export declare function mirrorShadowWorkspaceToVisible(input: WorkspaceSyncInput, opaqueWorkspaceRoots?: readonly string[]): void;
67
93
  export declare function synchronizeWorkspace(rawInput: WorkspaceSyncInput): Promise<WorkspaceSyncResult>;
68
- export declare function calculateWorkspaceDiffFingerprint(input: WorkspaceSyncInput): string;
94
+ export declare function calculateWorkspaceDiffFingerprint(rawInput: WorkspaceSyncInput): string;
69
95
  export declare class WorkspaceSyncSingleFlight {
70
96
  private queue;
71
97
  private enqueue;
@@ -75,3 +101,4 @@ export declare class WorkspaceSyncSingleFlight {
75
101
  fingerprintPrepared(prepare: () => WorkspaceSyncInput): Promise<string>;
76
102
  afterCurrent(): Promise<void>;
77
103
  }
104
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",