agent-relay 4.0.32 → 4.0.33
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/bin/agent-relay-broker-darwin-arm64 +0 -0
- package/bin/agent-relay-broker-darwin-x64 +0 -0
- package/bin/agent-relay-broker-linux-arm64 +0 -0
- package/bin/agent-relay-broker-linux-x64 +0 -0
- package/dist/src/cli/commands/on/start.d.ts.map +1 -1
- package/dist/src/cli/commands/on/start.js +149 -111
- package/dist/src/cli/commands/on/start.js.map +1 -1
- package/node_modules/@agent-relay/cloud/package.json +2 -2
- package/node_modules/@agent-relay/config/package.json +1 -1
- package/node_modules/@agent-relay/hooks/package.json +4 -4
- package/node_modules/@agent-relay/sdk/package.json +2 -2
- package/node_modules/@agent-relay/telemetry/package.json +1 -1
- package/node_modules/@agent-relay/trajectory/package.json +2 -2
- package/node_modules/@agent-relay/user-directory/package.json +2 -2
- package/node_modules/@agent-relay/utils/package.json +2 -2
- package/node_modules/@relayfile/local-mount/README.md +215 -0
- package/node_modules/@relayfile/local-mount/dist/auto-sync.d.ts +31 -0
- package/node_modules/@relayfile/local-mount/dist/auto-sync.js +466 -0
- package/node_modules/@relayfile/local-mount/dist/dotfiles.d.ts +18 -0
- package/node_modules/@relayfile/local-mount/dist/dotfiles.js +43 -0
- package/node_modules/@relayfile/local-mount/dist/index.d.ts +4 -0
- package/node_modules/@relayfile/local-mount/dist/index.js +3 -0
- package/node_modules/@relayfile/local-mount/dist/launch.d.ts +50 -0
- package/node_modules/@relayfile/local-mount/dist/launch.js +129 -0
- package/node_modules/@relayfile/local-mount/dist/symlink-mount.d.ts +23 -0
- package/{dist/src/cli/commands/on → node_modules/@relayfile/local-mount/dist}/symlink-mount.js +88 -20
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/LICENSE +21 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/README.md +305 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.d.ts +90 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.js +629 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.d.ts +215 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.js +798 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/package.json +1 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.d.ts +90 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.js +635 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.d.ts +215 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.js +804 -0
- package/node_modules/@relayfile/local-mount/node_modules/chokidar/package.json +69 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/LICENSE +21 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/README.md +120 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.d.ts +108 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.js +257 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/package.json +1 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.d.ts +108 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.js +263 -0
- package/node_modules/@relayfile/local-mount/node_modules/readdirp/package.json +70 -0
- package/node_modules/@relayfile/local-mount/package.json +47 -0
- package/node_modules/@smithy/config-resolver/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/index.js +2 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +32 -14
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +16 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +17 -10
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +6 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +6 -3
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +23 -11
- package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +9 -3
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +16 -8
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +8 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +6 -1
- package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +6 -3
- package/node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +3 -3
- package/node_modules/@smithy/middleware-retry/package.json +5 -5
- package/node_modules/@smithy/middleware-serde/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +188 -93
- package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +45 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +71 -35
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -18
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +41 -40
- package/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +42 -0
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +34 -14
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +32 -8
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -5
- package/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +5 -0
- package/node_modules/@smithy/service-error-classification/dist-es/index.js +4 -0
- package/node_modules/@smithy/service-error-classification/dist-types/index.d.ts +6 -0
- package/node_modules/@smithy/service-error-classification/package.json +1 -1
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
- package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +65 -53
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js +9 -7
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js +12 -8
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js +14 -13
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js +7 -4
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js +10 -8
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js +4 -4
- package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js +5 -5
- package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js +4 -4
- package/node_modules/@smithy/util-endpoints/dist-types/types/shared.d.ts +3 -3
- package/node_modules/@smithy/util-endpoints/dist-types/utils/endpointFunctions.d.ts +2 -15
- package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateCondition.d.ts +6 -3
- package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateConditions.d.ts +3 -3
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointHeaders.d.ts +1 -1
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointProperties.d.ts +2 -2
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getReferenceValue.d.ts +2 -2
- package/node_modules/@smithy/util-endpoints/package.json +1 -1
- package/node_modules/@smithy/util-retry/package.json +2 -2
- package/node_modules/@smithy/util-stream/package.json +2 -2
- package/package.json +25 -11
- package/packages/cloud/package.json +2 -2
- package/packages/config/package.json +1 -1
- package/packages/hooks/package.json +4 -4
- package/packages/sdk/package.json +2 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +2 -2
- package/dist/src/cli/commands/on/symlink-mount.d.ts +0 -12
- package/dist/src/cli/commands/on/symlink-mount.d.ts.map +0 -1
- package/dist/src/cli/commands/on/symlink-mount.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/trajectory",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.33",
|
|
4
4
|
"description": "Trajectory integration utilities (trail/PDERO) for Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/config": "4.0.
|
|
25
|
+
"@agent-relay/config": "4.0.33"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/user-directory",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.33",
|
|
4
4
|
"description": "User directory service for agent-relay (per-user credential storage)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/utils": "4.0.
|
|
25
|
+
"@agent-relay/utils": "4.0.33"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.33",
|
|
4
4
|
"description": "Shared utilities for agent-relay: logging, name generation, command resolution, update checking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"vitest": "^3.2.4"
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@agent-relay/config": "4.0.
|
|
114
|
+
"@agent-relay/config": "4.0.33",
|
|
115
115
|
"compare-versions": "^6.1.1"
|
|
116
116
|
},
|
|
117
117
|
"publishConfig": {
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# @relayfile/local-mount
|
|
2
|
+
|
|
3
|
+
Create a temporary mounted mirror of a project directory, enforce `.agentignore` and `.agentreadonly` rules inside that mount, run an agent or CLI there, then sync writable changes back to the real project on exit.
|
|
4
|
+
|
|
5
|
+
This package is useful when you want an agent to work in a constrained workspace without giving it direct write access to every file in the source tree.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @relayfile/local-mount
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What it exports
|
|
14
|
+
|
|
15
|
+
### `createSymlinkMount(projectDir, mountDir, options)`
|
|
16
|
+
|
|
17
|
+
Builds a mounted copy of `projectDir` at `mountDir` and returns a handle:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
interface SymlinkMountHandle {
|
|
21
|
+
mountDir: string;
|
|
22
|
+
syncBack(): Promise<number>;
|
|
23
|
+
startAutoSync(opts?: AutoSyncOptions): AutoSyncHandle;
|
|
24
|
+
cleanup(): void;
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Behavior:
|
|
29
|
+
- Copies regular files into the mount
|
|
30
|
+
- Applies ignore rules from `ignoredPatterns`
|
|
31
|
+
- Marks read-only matches as mode `0o444`
|
|
32
|
+
- Excludes `.git` and `node_modules` by default
|
|
33
|
+
- Writes `_MOUNT_README.md` and `.relayfile-local-mount` into the mount
|
|
34
|
+
- Skips syncing `_MOUNT_README.md`, `.relayfile-local-mount`, ignored files, read-only files, and symlinks back to the source project
|
|
35
|
+
|
|
36
|
+
### `readAgentDotfiles(projectDir, options?)`
|
|
37
|
+
|
|
38
|
+
Reads project-local permission dotfiles and returns compiled pattern lists:
|
|
39
|
+
|
|
40
|
+
- `.agentignore`
|
|
41
|
+
- `.agentreadonly`
|
|
42
|
+
- `.{agentName}.agentignore` (optional)
|
|
43
|
+
- `.{agentName}.agentreadonly` (optional)
|
|
44
|
+
|
|
45
|
+
Blank lines and `#` comments are ignored.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const { ignoredPatterns, readonlyPatterns } = readAgentDotfiles(projectDir, {
|
|
49
|
+
agentName: 'reviewer',
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `launchOnMount(options)`
|
|
54
|
+
|
|
55
|
+
High-level helper that:
|
|
56
|
+
1. creates a mount,
|
|
57
|
+
2. starts bidirectional auto-sync (see below, controllable via `autoSync`),
|
|
58
|
+
3. runs a CLI inside the mount,
|
|
59
|
+
4. forwards `SIGINT` and `SIGTERM`,
|
|
60
|
+
5. stops auto-sync and runs a final sync-back pass after the child exits,
|
|
61
|
+
6. cleans up the mount directory.
|
|
62
|
+
|
|
63
|
+
It resolves with the child process exit code. `onAfterSync(count)` receives the sum of files changed by auto-sync plus the final sync-back pass.
|
|
64
|
+
|
|
65
|
+
### Auto-sync
|
|
66
|
+
|
|
67
|
+
By default, `launchOnMount` keeps the mount and project directory in sync continuously while the CLI is running, rather than only at exit. The same machinery is available standalone via `handle.startAutoSync()`.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
interface AutoSyncOptions {
|
|
71
|
+
/** Full-reconcile interval as a safety net. Default: 10_000 ms. */
|
|
72
|
+
scanIntervalMs?: number;
|
|
73
|
+
/** chokidar `awaitWriteFinish` stability threshold. Default: 200 ms. */
|
|
74
|
+
writeFinishMs?: number;
|
|
75
|
+
/** Invoked on sync errors. Defaults to swallowing them. */
|
|
76
|
+
onError?: (err: Error) => void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface AutoSyncHandle {
|
|
80
|
+
stop(): Promise<void>;
|
|
81
|
+
reconcile(): Promise<number>;
|
|
82
|
+
totalChanges(): number;
|
|
83
|
+
ready(): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Control it from `launchOnMount`:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
// Disable entirely — only the final sync-back pass runs.
|
|
91
|
+
launchOnMount({ /* ... */, autoSync: false });
|
|
92
|
+
|
|
93
|
+
// Tune it.
|
|
94
|
+
launchOnMount({ /* ... */, autoSync: { scanIntervalMs: 5_000, writeFinishMs: 100 } });
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
How it works:
|
|
98
|
+
- chokidar watches both the mount and the project tree
|
|
99
|
+
- every `scanIntervalMs`, a full reconcile walks both trees as a safety net for missed events
|
|
100
|
+
- per-file `mtime` is tracked at the last sync, so the scan skips files that haven't changed
|
|
101
|
+
|
|
102
|
+
Conflict and delete rules:
|
|
103
|
+
- both sides changed since last sync → **mount wins**
|
|
104
|
+
- only one side changed → propagate that change
|
|
105
|
+
- one side deleted and the other unchanged since last sync → propagate the delete
|
|
106
|
+
- one side deleted and the other changed since last sync → recreate the missing file from the changed side
|
|
107
|
+
- readonly paths never flow mount→project; project-side edits still flow into the mount (the mount copy is re-chmodded `0o444`)
|
|
108
|
+
- `_MOUNT_README.md`, `.relayfile-local-mount`, ignored paths, and excluded directories never cross
|
|
109
|
+
|
|
110
|
+
## Dotfile semantics
|
|
111
|
+
|
|
112
|
+
`@relayfile/local-mount` uses glob-style patterns, powered by [`ignore`](https://www.npmjs.com/package/ignore).
|
|
113
|
+
|
|
114
|
+
### `.agentignore`
|
|
115
|
+
|
|
116
|
+
Files matching these patterns are omitted from the mount entirely.
|
|
117
|
+
|
|
118
|
+
Example:
|
|
119
|
+
|
|
120
|
+
```gitignore
|
|
121
|
+
secrets/
|
|
122
|
+
.env
|
|
123
|
+
coverage/
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `.agentreadonly`
|
|
127
|
+
|
|
128
|
+
Files matching these patterns are copied into the mount, but made read-only.
|
|
129
|
+
Changes to those files are not synced back.
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
|
|
133
|
+
```gitignore
|
|
134
|
+
package.json
|
|
135
|
+
docs/**
|
|
136
|
+
*.lock
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Per-agent overrides
|
|
140
|
+
|
|
141
|
+
If you pass `agentName`, the package also reads:
|
|
142
|
+
|
|
143
|
+
- `.{agentName}.agentignore`
|
|
144
|
+
- `.{agentName}.agentreadonly`
|
|
145
|
+
|
|
146
|
+
Those patterns are appended to the generic ones.
|
|
147
|
+
|
|
148
|
+
## Practical example
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { launchOnMount, readAgentDotfiles } from '@relayfile/local-mount';
|
|
152
|
+
import path from 'node:path';
|
|
153
|
+
import os from 'node:os';
|
|
154
|
+
|
|
155
|
+
const projectDir = '/projects/acme-api';
|
|
156
|
+
const mountDir = path.join(os.tmpdir(), 'acme-api-agent-mount');
|
|
157
|
+
|
|
158
|
+
const { ignoredPatterns, readonlyPatterns } = readAgentDotfiles(projectDir, {
|
|
159
|
+
agentName: 'reviewer',
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const result = await launchOnMount({
|
|
163
|
+
cli: 'claude',
|
|
164
|
+
args: ['--print', 'Review the codebase and update TODOs if needed.'],
|
|
165
|
+
projectDir,
|
|
166
|
+
mountDir,
|
|
167
|
+
ignoredPatterns,
|
|
168
|
+
readonlyPatterns,
|
|
169
|
+
excludeDirs: ['dist'],
|
|
170
|
+
agentName: 'reviewer',
|
|
171
|
+
onBeforeLaunch: async (dir) => {
|
|
172
|
+
// Add extra instructions or scratch files inside the mount if needed.
|
|
173
|
+
console.log(`Mount ready at ${dir}`);
|
|
174
|
+
},
|
|
175
|
+
onAfterSync: async (count) => {
|
|
176
|
+
console.log(`Synced ${count} writable file(s) back to the project`);
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
console.log(result.exitCode);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Sync-back behavior
|
|
184
|
+
|
|
185
|
+
`syncBack()` is the one-shot, mount-only sweep used as a final pass (and available on its own if you disable auto-sync). It only writes files that are safe and writable:
|
|
186
|
+
|
|
187
|
+
- changed writable files are copied back
|
|
188
|
+
- new writable files created in the mount are copied back
|
|
189
|
+
- unchanged files are skipped
|
|
190
|
+
- ignored files are skipped
|
|
191
|
+
- read-only matches are skipped
|
|
192
|
+
- symlinks inside the mount are skipped
|
|
193
|
+
|
|
194
|
+
The returned number is the count of files written back to `projectDir` in that pass. `syncBack()` never deletes — delete propagation is handled by auto-sync.
|
|
195
|
+
|
|
196
|
+
## Safety constraints
|
|
197
|
+
|
|
198
|
+
The implementation is intentionally conservative about `mountDir`:
|
|
199
|
+
|
|
200
|
+
- `mountDir` must be different from `projectDir`
|
|
201
|
+
- `mountDir` cannot be a filesystem root
|
|
202
|
+
- `mountDir` cannot overlap the source project directory in either direction
|
|
203
|
+
- if `mountDir` already exists, it must contain the `.relayfile-local-mount` marker file from a previous mount created by this package
|
|
204
|
+
|
|
205
|
+
These checks help prevent accidental deletion of unrelated directories during mount recreation and cleanup.
|
|
206
|
+
|
|
207
|
+
## Notes
|
|
208
|
+
|
|
209
|
+
- Requires Node.js 18+
|
|
210
|
+
- The current implementation copies files into the mount rather than creating filesystem-level FUSE mounts
|
|
211
|
+
- Source symlinks are only copied when they resolve to regular files inside the source project
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface AutoSyncContext {
|
|
2
|
+
realMountDir: string;
|
|
3
|
+
realProjectDir: string;
|
|
4
|
+
isExcluded: (relPosix: string) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Directory-only ignore patterns (ending in `/`) must only match when the
|
|
7
|
+
* path is a directory. Callers that know the path's type pass `isDirectory`;
|
|
8
|
+
* callers that don't (chokidar's prune filter) should check both forms.
|
|
9
|
+
*/
|
|
10
|
+
isIgnored: (relPosix: string, isDirectory?: boolean) => boolean;
|
|
11
|
+
isReadonly: (relPosix: string) => boolean;
|
|
12
|
+
isReservedFile: (relPosix: string) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AutoSyncOptions {
|
|
15
|
+
/** Full-reconcile interval as a safety net. Default: 10_000ms. */
|
|
16
|
+
scanIntervalMs?: number;
|
|
17
|
+
/** chokidar awaitWriteFinish stabilityThreshold in ms. Default: 200. */
|
|
18
|
+
writeFinishMs?: number;
|
|
19
|
+
/** Invoked on errors during sync — logged by default consumer. */
|
|
20
|
+
onError?: (err: Error) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface AutoSyncHandle {
|
|
23
|
+
stop(): Promise<void>;
|
|
24
|
+
/** Force a reconcile now; returns number of files copied/deleted. */
|
|
25
|
+
reconcile(): Promise<number>;
|
|
26
|
+
/** Cumulative files changed (copied or deleted) since autosync started. */
|
|
27
|
+
totalChanges(): number;
|
|
28
|
+
/** Resolves once both watchers have completed their initial scan. */
|
|
29
|
+
ready(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function startAutoSync(ctx: AutoSyncContext, opts?: AutoSyncOptions): AutoSyncHandle;
|