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
dsh: a relaunch points a workspace's skills at the current install
bitcoinbuilder0be30cf8838d
diff --git a/cli/src/cli.ts b/cli/src/cli.tsindex 39a7169f5..a1bd64ab6 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -105,7 +105,7 @@ import { dshPinnedPermissionMode, dshVerdictPath, dshViewerName } from './dsh/maimport { catalogEntry } from './dsh/catalog.js'import { removeDsh } from './dsh/install.js'import { preTrustClaudeProject, preTrustCodexProject } from './lib/claudeTrust.js'-import { materializeWorkspace } from './dsh/materialize.js'+import { materializeWorkspace, relinkSkills } from './dsh/materialize.js'import { dshLaunch, type DshAccount } from './dsh/launch.js'import { DshViewerManager } from './dsh/viewer.js'import { ViewerLedger } from './dsh/viewerLedger.js'@@ -4220,6 +4220,13 @@ async function runForeground(session: AuthSession | null): Promise<void> {console.warn(`[dsh] ${id} is not installed on this machine · relaunching as its plain base engine`)return null}+ // Its skills as they are now, not as they were when the workspace was made — see relinkSkills.+ try {+ const relinked = relinkSkills(installed, workspace)+ if (relinked.created.length) console.log(`[dsh] ${id} relaunch · skills repointed: ${relinked.created.join(', ')}`)+ } catch (err) {+ console.warn(`[dsh] ${id} relaunch · skills not repointed: ${(err as Error).message}`)+ }return dshLaunch(installed, workspace, { privateGrid: backend.gridName() })},}diff --git a/cli/src/dsh/materialize.spec.ts b/cli/src/dsh/materialize.spec.tsindex f204316c8..f269449a1 100644--- a/cli/src/dsh/materialize.spec.ts+++ b/cli/src/dsh/materialize.spec.ts@@ -1,11 +1,11 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'-import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'+import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'import { tmpdir } from 'node:os'import { join } from 'node:path'import { fileURLToPath } from 'node:url'import type { InstalledDsh } from './installed.js'import { parseDshManifest, readDshManifest } from './manifest.js'-import { dshMarkerLine, materializeWorkspace, resolveDshCommand, skillDirsIn } from './materialize.js'+import { dshMarkerLine, materializeWorkspace, relinkSkills, resolveDshCommand, skillDirsIn } from './materialize.js'const STARTER = realpathSync(fileURLToPath(new URL('../../../store/starter', import.meta.url)))@@ -96,6 +96,41 @@ describe('materializeWorkspace', () => {})})+describe('relinkSkills', () => {+ // ⚠️ REGRESSION. Every update installs a harness beside the last (its directory is named for its+ // content), and a workspace linked its skills once, at create — so a Model Manager made in the+ // morning read the morning's skill all day, through every fix to it. A relaunch repoints them.+ let workspace: string, morning: string, evening: string+ const installedAt = (dir: string): InstalledDsh => ({ ...starter('codex'), dir, realDir: dir })+ beforeEach(() => {+ workspace = mkdtempSync(join(tmpdir(), 'dsh-ws-'))+ morning = mkdtempSync(join(tmpdir(), 'dsh-v1-')); cpSync(STARTER, morning, { recursive: true })+ evening = mkdtempSync(join(tmpdir(), 'dsh-v2-')); cpSync(STARTER, evening, { recursive: true })+ })+ afterEach(() => { for (const dir of [workspace, morning, evening]) rmSync(dir, { recursive: true, force: true }) })++ it("points a workspace's skill links at the current install, and touches nothing else", async () => {+ await materializeWorkspace(installedAt(morning), workspace)+ const link = join(workspace, '.agents', 'skills', 'hello')+ expect(readlinkSync(link)).toBe(join(morning, 'skills', 'hello'))+ const agents = readFileSync(join(workspace, 'AGENTS.md'), 'utf8')+ const result = relinkSkills(installedAt(evening), workspace)+ expect(readlinkSync(link)).toBe(join(evening, 'skills', 'hello'))+ expect(result.created).toEqual(['.agents/skills/hello'])+ // Instructions a person may have edited are not rewritten by a relaunch.+ expect(readFileSync(join(workspace, 'AGENTS.md'), 'utf8')).toBe(agents)+ // Already current: nothing to do.+ expect(relinkSkills(installedAt(evening), workspace)).toMatchObject({ created: [], kept: ['.agents/skills/hello'] })+ })++ it('leaves a real directory a person put in the skills folder alone', () => {+ mkdirSync(join(workspace, '.agents', 'skills', 'hello'), { recursive: true })+ const result = relinkSkills(installedAt(evening), workspace)+ expect(lstatSync(join(workspace, '.agents', 'skills', 'hello')).isSymbolicLink()).toBe(false)+ expect(result.warnings.some((w) => w.includes('hello'))).toBe(true)+ })+})+describe('skillDirsIn', () => {it('lists SKILL.md-bearing subdirectories, or the directory itself when it is one skill', () => {expect(skillDirsIn(join(STARTER, 'skills'))).toEqual([join(STARTER, 'skills', 'hello')])diff --git a/cli/src/dsh/materialize.ts b/cli/src/dsh/materialize.tsindex c35a23269..87b5fe79d 100644--- a/cli/src/dsh/materialize.ts+++ b/cli/src/dsh/materialize.ts@@ -138,6 +138,21 @@ function linkSkills(dsh: InstalledDsh, workspace: string, result: MaterializeRes}}+/**+ * Point the workspace's skill links at [dsh]'s CURRENT install, for a relaunch.+ *+ * ⚠️ Materialisation runs at create only, and a harness's skills live in a directory named for its+ * content, so every update installs beside the last rather than over it. A workspace made before an+ * update kept linking to the old one: the Model Manager in a morning's workspace read the morning's+ * skill all day, through every fix to it. The links are ours (step 3), so this repoints them; a file+ * a person put there instead is left alone, as at create.+ */+export function relinkSkills(dsh: InstalledDsh, workspace: string): MaterializeResult {+ const result: MaterializeResult = { created: [], kept: [], warnings: [], initLines: [] }+ if (dsh.manifest.kind !== 'viewer') linkSkills(dsh, workspace, result)+ return result+}+/** A command that is a path inside the harness becomes that absolute path, shell-quoted. */export function resolveDshCommand(dsh: Pick<InstalledDsh, 'realDir'>, command: string): string {if (/[\s;&|<>$`'"\\]/.test(command)) return command