opencode-pilot 0.9.1 → 0.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 +1 -1
- package/service/actions.js +10 -1
- package/test/unit/actions.test.js +4 -4
package/package.json
CHANGED
package/service/actions.js
CHANGED
|
@@ -102,7 +102,10 @@ function isServerHealthy(project) {
|
|
|
102
102
|
* 1. Exact sandbox match (highest priority)
|
|
103
103
|
* 2. Exact worktree match
|
|
104
104
|
* 3. Target is subdirectory of worktree
|
|
105
|
-
*
|
|
105
|
+
*
|
|
106
|
+
* NOTE: Global servers (worktree="/") are NOT used - sessions spawned via
|
|
107
|
+
* pilot should run in isolated mode rather than attach to the global project,
|
|
108
|
+
* since the global project doesn't have the right working directory context.
|
|
106
109
|
*
|
|
107
110
|
* @param {string} targetDir - The directory we want to work in
|
|
108
111
|
* @param {object} [options] - Options for testing/mocking
|
|
@@ -145,6 +148,12 @@ export async function discoverOpencodeServer(targetDir, options = {}) {
|
|
|
145
148
|
const worktree = project.worktree || '/';
|
|
146
149
|
const sandboxes = project.sandboxes || [];
|
|
147
150
|
|
|
151
|
+
// Skip global servers - pilot sessions should run isolated
|
|
152
|
+
if (worktree === '/') {
|
|
153
|
+
debug(`discoverOpencodeServer: ${url} is global project, skipping`);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
|
|
148
157
|
const score = getPathMatchScore(targetDir, worktree, sandboxes);
|
|
149
158
|
debug(`discoverOpencodeServer: ${url} worktree=${worktree} score=${score}`);
|
|
150
159
|
|
|
@@ -394,25 +394,25 @@ describe('actions.js', () => {
|
|
|
394
394
|
assert.strictEqual(result, 'http://localhost:4000');
|
|
395
395
|
});
|
|
396
396
|
|
|
397
|
-
test('
|
|
397
|
+
test('skips global project servers', async () => {
|
|
398
398
|
const { discoverOpencodeServer } = await import('../../service/actions.js');
|
|
399
399
|
|
|
400
400
|
const mockPorts = async () => [3000];
|
|
401
401
|
const mockFetch = async (url) => {
|
|
402
402
|
if (url === 'http://localhost:3000/project/current') {
|
|
403
|
-
//
|
|
403
|
+
// Global project with worktree="/"
|
|
404
404
|
return { ok: true, json: async () => ({ id: 'global', worktree: '/', sandboxes: [], time: { created: 1 } }) };
|
|
405
405
|
}
|
|
406
406
|
return { ok: false };
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
// Global servers
|
|
409
|
+
// Global servers should be skipped - pilot sessions should run isolated
|
|
410
410
|
const result = await discoverOpencodeServer('/Users/test/random/path', {
|
|
411
411
|
getPorts: mockPorts,
|
|
412
412
|
fetch: mockFetch
|
|
413
413
|
});
|
|
414
414
|
|
|
415
|
-
assert.strictEqual(result,
|
|
415
|
+
assert.strictEqual(result, null);
|
|
416
416
|
});
|
|
417
417
|
|
|
418
418
|
test('returns null when fetch fails for all servers', async () => {
|