@shogo-ai/worker 1.9.1 → 1.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shogo-ai/worker",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Shogo Cloud Agent Worker — run Shogo agents on your own machine (laptop, devbox, CI).",
5
5
  "license": "MIT",
6
6
  "author": "Shogo Technologies, Inc.",
@@ -169,9 +169,14 @@ describe('CloudSyncWatcher', () => {
169
169
  watcher.start();
170
170
  await wait(50);
171
171
 
172
- writeFileSync(join(dir, '.shogo', 'db.sqlite'), 'SQLITE');
172
+ // App.tsx fires first so its watch event is queued before debounce starts;
173
+ // .shogo/db.sqlite arrives within the debounce window. The increased
174
+ // post-write wait absorbs cross-file timing variance (see
175
+ // gateway-mock side effect from git-cloner.test.ts's hoisted
176
+ // mock.module('node:child_process', ...) bloating bun's startup).
173
177
  writeFileSync(join(dir, 'App.tsx'), 'APP');
174
- await wait(400);
178
+ writeFileSync(join(dir, '.shogo', 'db.sqlite'), 'SQLITE');
179
+ await wait(700);
175
180
  await watcher.stop();
176
181
 
177
182
  const fileTransportPaths = calls.flatMap((c) => c.paths);
@@ -20,7 +20,15 @@
20
20
  import { watch, type FSWatcher, statSync } from 'node:fs';
21
21
  import { relative, sep, posix } from 'node:path';
22
22
  import type { CloudFileTransport } from '@shogo-ai/sdk/cloud-file-transport';
23
- import { commitAndPush } from './git-cloner.ts';
23
+ // commitAndPush is dynamically imported so this file does NOT eagerly
24
+ // pull in git-cloner.ts at module-load. git-cloner.ts captures
25
+ // `node:child_process` via `const execFileAsync = promisify(execFile)`
26
+ // at load time; if cloud-sync-watcher.ts (and its tests) trigger that
27
+ // load before git-cloner.test.ts's `mock.module('node:child_process', ...)`
28
+ // hoist runs, the mock no longer applies to the cached `execFileAsync`.
29
+ // Lazy resolution keeps git-cloner.ts unloaded until either a tests-
30
+ // supplied `opts.commitAndPush` short-circuits the default, or the
31
+ // real `flushGit` call path explicitly opts in.
24
32
 
25
33
  const DEBOUNCE_MS = 1500;
26
34
  const EXCLUDED_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '.vite', '.cache']);
@@ -126,7 +134,10 @@ export class CloudSyncWatcher {
126
134
  throw new Error('CloudSyncWatcher: mode: "git" requires the `git` option block');
127
135
  }
128
136
  this.git = opts.git;
129
- this.commitAndPush = opts.commitAndPush ?? commitAndPush;
137
+ this.commitAndPush = opts.commitAndPush ?? (async (args) => {
138
+ const mod = await import('./git-cloner.ts');
139
+ return mod.commitAndPush(args);
140
+ });
130
141
  }
131
142
 
132
143
  /**