The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Accept Windows folders when adding a machine to a Swarm (#1556)
0xken157e156b0b9baa
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex b2110baa3..aa1e41389 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -804,6 +804,13 @@ it('records the lead project once and accepts installed engines beyond Claude anf.run(command, owner, { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })expect(f.state.machines![0]!.engines).toEqual(['claude', 'codex', 'pi', 'opencode'])})+it('accepts POSIX, Windows drive and UNC folders and refuses relative, drive-relative and control-character ones', () => {+ const contribute = (cwd: string) => commandSchema.safeParse({ type: 'machine.contribute', machineId: 'host', name: 'PC', cwd, engines: ['claude'], maxAgents: 1 })+ for (const cwd of ['/repo', 'C:\\Users\\dev\\data', 'c:/Users/dev/data', 'D:\\', '\\\\server\\share\\x']) expect(contribute(cwd).success, cwd).toBe(true)+ for (const cwd of ['repo', './repo', 'C:repo', 'C:', '\\repo', '\\\\server', '\\\\\\x', 'C:\\a\nb', '/a\u0000b']) expect(contribute(cwd).success, cwd).toBe(false)+ const refused = contribute('relative')+ expect(!refused.success && refused.error.issues[0]!.message).toBe('Use a full folder path, such as /home/me/work or C:\\Users\\me\\work.')+})it('restricts recording a legacy project to the owner or controlling lead', () => {const f = fixture(); f.invite()const command: Command = { type: 'tab.project', machineId: 'host', project: { cwd: '/repo', repositoryUrl: null } }diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex b8bb675ef..6f86766a2 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -20,7 +20,10 @@ const configuration = z.object({effort: z.string().max(80).nullable(), contextWindow: z.number().int().positive().safe().nullable(),engineVersion: z.string().max(160).nullable(),}).strict()-const path = z.string().min(1).max(4096).regex(/^\//).refine(value => !/[\x00-\x1f\x7f]/.test(value))+// A full path on the machine that will use it: POSIX (/x), a Windows drive (C:\x or C:/x) or UNC (\\server\share). Never relative or drive-relative (C:x).+const path = z.string().min(1).max(4096)+ .regex(/^(\/|[A-Za-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/])/, 'Use a full folder path, such as /home/me/work or C:\\Users\\me\\work.')+ .refine(value => !/[\x00-\x1f\x7f]/.test(value), 'A folder path cannot contain control characters.')const repositoryUrl = z.string().max(4096).refine(value => {if (/[\x00-\x20\x7f]/.test(value)) return falseif (/^git@[^/@:]+:[^@]+$/.test(value)) return truediff --git a/cli/src/superTabs/contribution.windows.spec.ts b/cli/src/superTabs/contribution.windows.spec.tsnew file mode 100644index 000000000..d89d80a23--- /dev/null+++ b/cli/src/superTabs/contribution.windows.spec.ts@@ -0,0 +1,24 @@+// What Add machine sends from a Windows daemon: node:path is win32's, as it is there, so the swarm workspace is a+// drive path (C:\…) that the backend accepts for machine.contribute.cwd.+import * as nodePath from 'node:path'+import { describe, expect, it, vi } from 'vitest'+import { fakeCore } from '../testing/fakeCore.js'+import { prepareContribution } from './contribution.js'++vi.mock('node:path', async (original) => {+ const real = await original<typeof nodePath>()+ return { ...real, ...real.win32, default: real.win32, win32: real.win32, posix: real.posix }+})+vi.mock('node:fs/promises', async (original) => ({ ...await original<object>(), mkdir: vi.fn(async () => undefined) }))++describe('contributing a Windows machine to a swarm', () => {+ it('offers the swarm workspace as a drive path under the daemon data folder', async () => {+ const core = fakeCore({ dataDir: 'C:\\Users\\dev\\.harness\\cli\\data' })+ const request = vi.fn(async () => ({ engines: [{ engine: 'claude', installed: true, signedIn: true }] }))+ const deps = { backend: vi.fn(async () => ({ state: {} })), open: vi.fn(async () => ({ request, close: vi.fn() })), prepare: vi.fn(),+ capacity: vi.fn(async () => ({ ok: true, resources: { memoryTotalBytes: 8 * 1024 ** 3, memoryUsedBytes: 0, projectDiskFreeBytes: 1e11 } })) }+ const result = await prepareContribution(core, { tabId: 'tab', scope: 'swarm' }, deps as never)+ expect(result).toMatchObject({ scope: 'swarm', cwd: 'C:\\Users\\dev\\.harness\\cli\\data\\swarm-projects\\tab' })+ expect(deps.prepare).not.toHaveBeenCalled()+ })+})