acryl 0.1.18 → 0.1.30

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.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process'
3
+ import { createRequire } from 'node:module'
4
+ import { dirname, join } from 'node:path'
5
+ import { createInterface } from 'node:readline/promises'
6
+ import { stdin, stderr } from 'node:process'
7
+ import { runtimeLauncher, targetFor } from './runtime.js'
8
+ import { acquireDesktopInstaller } from './desktop-runtime.js'
9
+ import { acquireWebRuntime, fetchReleaseManifest, hasVerifiedWebRuntime, manifestUrl, managedWebRoot, selectWebArtifact } from './web-runtime.js'
10
+
11
+ const require = createRequire(import.meta.url)
12
+ const selectorVersion = require('./package.json').version
13
+ const args = process.argv.slice(2)
14
+
15
+ function run(command, commandArgs) {
16
+ const child = spawn(command, commandArgs, { stdio: 'inherit' })
17
+ child.once('error', cause => {
18
+ console.error(`acryl: ${cause.message}`)
19
+ process.exitCode = 1
20
+ })
21
+ child.once('exit', code => { process.exitCode = code ?? 1 })
22
+ }
23
+
24
+ async function confirmDownload() {
25
+ if (!stdin.isTTY || !stderr.isTTY) return false
26
+ const prompt = createInterface({ input: stdin, output: stderr })
27
+ try {
28
+ return (await prompt.question('ACRYL Web will download a verified matching runtime. Continue? [y/N] ')).trim().toLowerCase() === 'y'
29
+ } finally { prompt.close() }
30
+ }
31
+
32
+ function openInstaller(path) {
33
+ const opener = process.platform === 'darwin' ? ['open', [path]]
34
+ : process.platform === 'win32' ? ['cmd', ['/c', 'start', '', path]]
35
+ : ['xdg-open', [path]]
36
+ const child = spawn(...opener, { stdio: 'ignore' })
37
+ child.once('error', () => {})
38
+ }
39
+
40
+ async function runDesktop(desktopArgs) {
41
+ const noOpen = desktopArgs.includes('--no-open')
42
+ const result = await acquireDesktopInstaller({
43
+ version: selectorVersion,
44
+ ...(noOpen ? {} : { open: openInstaller }),
45
+ })
46
+ console.log(`ACRYL desktop installer ${result.version}: ${result.path}`)
47
+ if (noOpen) console.log('use --no-open to download without launching')
48
+ }
49
+
50
+ async function runWeb(webArgs) {
51
+ const yes = webArgs.includes('--yes') || webArgs.includes('-y')
52
+ const forwarded = webArgs.filter(arg => arg !== '--yes' && arg !== '-y')
53
+ const target = targetFor({ platform: process.platform, arch: process.arch })
54
+ const root = join(managedWebRoot(), selectorVersion, target)
55
+ let launcher
56
+ try { launcher = runtimeLauncher({ require, platform: process.platform, arch: process.arch }) } catch (cause) {
57
+ throw new Error(`matching CLI runtime is unavailable: ${cause instanceof Error ? cause.message : String(cause)}`)
58
+ }
59
+ // The CLI runtime is resolved first so a partial/broken selector never downloads Web.
60
+ void launcher
61
+ const manifest = await fetchReleaseManifest(manifestUrl(selectorVersion))
62
+ const artifact = selectWebArtifact(manifest, { version: selectorVersion, target })
63
+ const cached = hasVerifiedWebRuntime(root, { version: selectorVersion, target, sha256: artifact.sha256 })
64
+ if (!cached && !yes && !(await confirmDownload())) {
65
+ throw new Error('Web runtime acquisition requires confirmation. Re-run with: acryl web --yes')
66
+ }
67
+ const result = await acquireWebRuntime({ root: managedWebRoot(), version: selectorVersion, target, manifest })
68
+ run(join(result.root, 'runtime', 'bin', process.platform === 'win32' ? 'acryl-web.cmd' : 'acryl-web'), forwarded)
69
+ }
70
+
71
+ if (args[0] === 'web') {
72
+ runWeb(args.slice(1)).catch(cause => {
73
+ console.error(`acryl: ${cause instanceof Error ? cause.message : String(cause)}`)
74
+ process.exitCode = 1
75
+ })
76
+ } else if (args[0] === 'desktop') {
77
+ runDesktop(args.slice(1)).catch(cause => {
78
+ console.error(`acryl: ${cause instanceof Error ? cause.message : String(cause)}`)
79
+ process.exitCode = 1
80
+ })
81
+ } else {
82
+ try { run(runtimeLauncher(), args) } catch (cause) {
83
+ console.error(`acryl: ${cause instanceof Error ? cause.message : String(cause)}`)
84
+ process.exitCode = 1
85
+ }
86
+ }
@@ -0,0 +1,69 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
3
+ import { homedir } from 'node:os'
4
+ import { join } from 'node:path'
5
+
6
+ const API = 'https://api.github.com/repos/acryldev/acryl/releases/tags'
7
+
8
+ function fail(message) { throw new Error(`acryl desktop: ${message}`) }
9
+
10
+ export function managedDesktopRoot(env = process.env) {
11
+ if (env.ACRYL_DESKTOP_HOME) return env.ACRYL_DESKTOP_HOME
12
+ if (process.platform === 'win32') return join(env.LOCALAPPDATA ?? join(homedir(), 'AppData', 'Local'), 'Acryl', 'desktop')
13
+ return join(env.XDG_DATA_HOME ?? join(homedir(), '.local', 'share'), 'acryl', 'desktop')
14
+ }
15
+
16
+ function installerExt() {
17
+ if (process.platform === 'darwin') return '.dmg'
18
+ if (process.platform === 'linux') return '.deb'
19
+ if (process.platform === 'win32') return '.exe'
20
+ fail(`unsupported platform: ${process.platform}`)
21
+ }
22
+
23
+ function archHint() {
24
+ if (process.arch === 'arm64') return ['arm64', 'aarch64', 'universal']
25
+ return ['x64', 'amd64', 'x86_64']
26
+ }
27
+
28
+ /** Pick the installer asset for the current platform/arch from a desktop release. */
29
+ export function selectDesktopInstaller(release, { platform = process.platform, arch = process.arch } = {}) {
30
+ if (!release || !Array.isArray(release.assets)) fail('desktop release is malformed')
31
+ const ext = installerExt()
32
+ const archs = archHint()
33
+ let candidates = release.assets.filter(asset => asset && typeof asset.name === 'string' && asset.name.endsWith(ext))
34
+ // Prefer the arch whose name mentions our arch; else prefer the universal one.
35
+ const prefer = candidates.filter(asset => archs.some(hint => asset.name.includes(hint)))
36
+ const chosen = prefer[0] ?? candidates[0]
37
+ if (!chosen) fail(`release has no ${ext} installer for ${platform}-${arch}`)
38
+ return { name: chosen.name, url: chosen.browser_download_url, size: chosen.size }
39
+ }
40
+
41
+ function downloadUrl(base) {
42
+ return join(base, 'release', 'download')
43
+ }
44
+
45
+ function defaultDownload(url) {
46
+ return fetch(url, { redirect: 'follow' }).then(async res => {
47
+ if (!res.ok) fail(`desktop installer download failed: ${res.status} ${res.statusText}`)
48
+ return Buffer.from(await res.arrayBuffer())
49
+ })
50
+ }
51
+
52
+ /** Download the matching desktop installer into the managed cache and return its path. */
53
+ export async function acquireDesktopInstaller({ version, download = defaultDownload, open }) {
54
+ const tag = `desktop-v${version}`
55
+ const response = await fetch(`${API}/${tag}`, { headers: { Accept: 'application/vnd.github+json' } })
56
+ if (!response.ok) fail(`desktop release ${tag} not found (${response.status})`)
57
+ const release = await response.json()
58
+ const installer = selectDesktopInstaller(release)
59
+ const root = managedDesktopRoot()
60
+ const dir = join(root, version)
61
+ mkdirSync(dir, { recursive: true })
62
+ const target = join(dir, installer.name)
63
+ if (!existsSync(target)) {
64
+ const bytes = await download(installer.url)
65
+ writeFileSync(target, Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes))
66
+ }
67
+ if (typeof open === 'function') await open(target)
68
+ return { path: target, version, size: installer.size }
69
+ }
package/package.json CHANGED
@@ -1,64 +1,27 @@
1
1
  {
2
2
  "name": "acryl",
3
- "version": "0.1.18",
4
- "description": "A persistent, agent-agnostic coding environment. Keep your context, change your agent.",
5
- "license": "MIT",
3
+ "version": "0.1.30",
4
+ "private": false,
6
5
  "type": "module",
7
- "main": "lib/index.js",
8
- "exports": {
9
- ".": {
10
- "types": "./lib/types/index.d.ts",
11
- "default": "./lib/index.js"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
6
  "bin": {
16
- "acryl": "./lib/bin.js"
7
+ "acryl": "./bin.js"
17
8
  },
18
9
  "files": [
19
- "lib/**",
20
- "README.md"
10
+ "bin.js",
11
+ "runtime.js",
12
+ "release-contract.js",
13
+ "web-runtime.js",
14
+ "desktop-runtime.js"
21
15
  ],
22
- "dependencies": {
23
- "@deepseek-ai/cordis": "4.0.1",
24
- "@deepseek-ai/cordis-plugin-group": "1.0.1",
25
- "@deepseek-ai/cordis-plugin-hmr": "1.0.16",
26
- "@deepseek-ai/cordis-plugin-include": "1.0.6",
27
- "@deepseek-ai/cordis-plugin-loader": "1.0.2",
28
- "@deepseek-ai/cordis-plugin-timer": "1.1.3",
29
- "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
30
- "@deepseek-ai/dsh-app-boot": "0.1.1-rc.2",
31
- "@deepseek-ai/dsh-authorization": "0.1.1-rc.2",
32
- "@deepseek-ai/dsh-base": "0.1.1-rc.2",
33
- "@deepseek-ai/dsh": "0.1.1-rc.2",
34
- "@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
35
- "@deepseek-ai/dsh-goal": "0.1.1-rc.2",
36
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
37
- "@deepseek-ai/dsh-sandbox-local": "0.1.1-rc.2",
38
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
39
- "@deepseek-ai/dsh-session-stats": "0.1.1-rc.2",
40
- "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
41
- "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
42
- "@deepseek-ai/dsh-typert-loader": "0.1.1-rc.2",
43
- "@deepseek-ai/dsh-web-app": "0.1.1-rc.2",
44
- "@earendil-works/pi-tui": "0.84.2",
45
- "diff": "9.0.0"
16
+ "optionalDependencies": {
17
+ "acryl-cli-darwin-arm64": "0.1.30",
18
+ "acryl-cli-linux-arm64": "0.1.30",
19
+ "acryl-cli-linux-x64": "0.1.30",
20
+ "acryl-cli-windows-x64": "0.1.30"
46
21
  },
47
22
  "engines": {
48
- "node": ">=22"
23
+ "node": ">=22.19.0 || >=24.0.0"
49
24
  },
50
- "keywords": [
51
- "ai",
52
- "coding-agent",
53
- "agent",
54
- "agentic-development",
55
- "cli",
56
- "tui",
57
- "developer-tools",
58
- "context",
59
- "agent-context",
60
- "multi-agent",
61
- "cordis",
62
- "deepseek-harness"
63
- ]
25
+ "description": "ACRYL CLI target-runtime selector",
26
+ "license": "MIT"
64
27
  }
@@ -0,0 +1,81 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { readFileSync, readdirSync, statSync } from 'node:fs'
3
+ import { join, relative } from 'node:path'
4
+
5
+ export const RECEIPT_SCHEMA_VERSION = 1
6
+
7
+ // darwin-x64 is intentionally absent: GitHub's macos-14 runners are arm64 and
8
+ // cannot cross-compile sharp/koffi's native binaries for x64, so the CLI is
9
+ // not published for that target. Intel Mac users build it themselves via
10
+ // scripts/build-darwin-x64-from-source.sh and run the archive directly,
11
+ // outside the npm-published selector/runtime resolution below.
12
+ export const CLI_TARGETS = Object.freeze({
13
+ 'darwin-arm64': { platform: 'darwin', arch: 'arm64', npmOs: 'darwin', npmCpu: 'arm64' },
14
+ 'linux-arm64': { platform: 'linux', arch: 'arm64', npmOs: 'linux', npmCpu: 'arm64' },
15
+ 'linux-x64': { platform: 'linux', arch: 'x64', npmOs: 'linux', npmCpu: 'x64' },
16
+ 'windows-x64': { platform: 'win32', arch: 'x64', npmOs: 'win32', npmCpu: 'x64' },
17
+ })
18
+
19
+ export function targetForNode({ platform, arch }) {
20
+ const target = Object.entries(CLI_TARGETS).find(([, value]) => value.platform === platform && value.arch === arch)?.[0]
21
+ if (!target) throw new Error(`unsupported ACRYL target: ${platform}/${arch}. Supported targets: ${Object.keys(CLI_TARGETS).join(', ')}`)
22
+ return target
23
+ }
24
+
25
+ export function targetPackageName(target) {
26
+ if (!CLI_TARGETS[target]) throw new Error(`unknown ACRYL target: ${target}`)
27
+ return `acryl-cli-${target}`
28
+ }
29
+
30
+ export function sha256(value) {
31
+ return createHash('sha256').update(value).digest('hex')
32
+ }
33
+
34
+ /** Hash a prepared runtime tree in a stable, receipt-excluding form. */
35
+ export function payloadSha256(directory) {
36
+ const entries = []
37
+ const visit = current => {
38
+ for (const entry of readdirSync(current)) {
39
+ const absolute = join(current, entry)
40
+ const path = relative(directory, absolute).replaceAll('\\\\', '/')
41
+ if (path === 'receipt.json') continue
42
+ // npm strips .npmignore/.gitignore/.npmrc when packing a vendored
43
+ // node_modules, so exclude them from the payload hash or the installed
44
+ // runtime would fail receipt validation.
45
+ if (/\/(?:\.npmignore|\.gitignore|\.npmrc)$/u.test(path)) continue
46
+ if (statSync(absolute).isDirectory()) visit(absolute)
47
+ else entries.push(`${path}\u0000${sha256(readFileSync(absolute))}`)
48
+ }
49
+ }
50
+ visit(directory)
51
+ return sha256(entries.sort().join('\n'))
52
+ }
53
+
54
+ export function receiptFor({ surface = 'cli', target, version, payloadSha256 }) {
55
+ if (!CLI_TARGETS[target]) throw new Error(`unknown ACRYL target: ${target}`)
56
+ if (!/^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.-]+)?$/.test(version)) throw new Error(`invalid release version: ${version}`)
57
+ if (!/^[a-f0-9]{64}$/u.test(payloadSha256)) throw new Error('receipt payloadSha256 must be a SHA-256 hex digest')
58
+ return { schemaVersion: RECEIPT_SCHEMA_VERSION, surface, target, version, packageName: targetPackageName(target), payloadSha256 }
59
+ }
60
+
61
+ export function validateReceipt(receipt, { surface = 'cli', target, version, packageName = targetPackageName(target) } = {}) {
62
+ if (!receipt || typeof receipt !== 'object') throw new Error('runtime receipt is missing or invalid')
63
+ if (receipt.schemaVersion !== RECEIPT_SCHEMA_VERSION) throw new Error(`unsupported runtime receipt schema: ${String(receipt.schemaVersion)}`)
64
+ for (const [key, expected] of Object.entries({ surface, target, version, packageName })) {
65
+ if (expected !== undefined && receipt[key] !== expected) throw new Error(`runtime receipt ${key} mismatch: expected ${expected}, found ${String(receipt[key])}`)
66
+ }
67
+ if (!/^[a-f0-9]{64}$/u.test(receipt.payloadSha256)) throw new Error('runtime receipt has invalid payloadSha256')
68
+ return receipt
69
+ }
70
+
71
+ export function validatePayloadReceipt(receipt, directory) {
72
+ const actual = payloadSha256(directory)
73
+ if (receipt.payloadSha256 !== actual) throw new Error(`runtime receipt payload hash mismatch: expected ${receipt.payloadSha256}, found ${actual}`)
74
+ return receipt
75
+ }
76
+
77
+ export function readAndValidateReceipt(path, expected) {
78
+ let receipt
79
+ try { receipt = JSON.parse(readFileSync(path, 'utf8')) } catch { throw new Error('runtime receipt is missing or invalid JSON') }
80
+ return validateReceipt(receipt, expected)
81
+ }
package/runtime.js ADDED
@@ -0,0 +1,37 @@
1
+ import { createRequire } from 'node:module'
2
+ import { dirname, join } from 'node:path'
3
+ import { readFileSync } from 'node:fs'
4
+ import { targetForNode, targetPackageName, validatePayloadReceipt, validateReceipt } from './release-contract.js'
5
+
6
+ export const targetFor = targetForNode
7
+ export { targetPackageName }
8
+
9
+ function installedManifest(path) {
10
+ try { return JSON.parse(readFileSync(path, 'utf8')) } catch { throw new Error('runtime package metadata is invalid') }
11
+ }
12
+
13
+ /** Resolve and validate the installed, exact-version target runtime before executing it. */
14
+ export function runtimeLauncher({ require = createRequire(import.meta.url), platform = process.platform, arch = process.arch, version } = {}) {
15
+ const target = targetForNode({ platform, arch })
16
+ const packageName = targetPackageName(target)
17
+ let root
18
+ try { root = dirname(require.resolve(`${packageName}/package.json`)) } catch {
19
+ throw new Error(`ACRYL CLI runtime ${packageName} is missing. Reinstall with: npm install -g acryl --include=optional`)
20
+ }
21
+ const manifest = installedManifest(join(root, 'package.json'))
22
+ const selectorVersion = version ?? JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version
23
+ if (manifest.name !== packageName || manifest.version !== selectorVersion) {
24
+ throw new Error(`ACRYL CLI runtime ${packageName} does not match selector version ${selectorVersion}. Reinstall with: npm install -g acryl --include=optional`)
25
+ }
26
+ let receipt
27
+ try { receipt = JSON.parse(readFileSync(join(root, 'runtime', 'receipt.json'), 'utf8')) } catch {
28
+ throw new Error(`ACRYL CLI runtime ${packageName} has no valid receipt. Reinstall with: npm install -g acryl --include=optional`)
29
+ }
30
+ try {
31
+ validateReceipt(receipt, { target, version: selectorVersion, packageName })
32
+ validatePayloadReceipt(receipt, join(root, 'runtime'))
33
+ } catch (cause) {
34
+ throw new Error(`ACRYL CLI runtime ${packageName} receipt validation failed: ${cause.message}. Reinstall with: npm install -g acryl --include=optional`)
35
+ }
36
+ return join(root, 'runtime', 'bin', platform === 'win32' ? 'acryl.cmd' : 'acryl')
37
+ }
package/web-runtime.js ADDED
@@ -0,0 +1,133 @@
1
+ import { createHash, randomUUID } from 'node:crypto'
2
+ import { execFileSync } from 'node:child_process'
3
+ import {
4
+ existsSync,
5
+ mkdirSync,
6
+ readFileSync,
7
+ renameSync,
8
+ rmSync,
9
+ writeFileSync,
10
+ } from 'node:fs'
11
+ import { homedir } from 'node:os'
12
+ import { dirname, join } from 'node:path'
13
+
14
+ const RECEIPT_NAME = '.acryl-web-runtime.json'
15
+ const DEFAULT_RELEASE = 'https://github.com/acryldev/acryl/releases/download'
16
+
17
+ function fail(message) { throw new Error(`acryl web: ${message}`) }
18
+
19
+ export function managedWebRoot(env = process.env) {
20
+ if (env.ACRYL_WEB_HOME) return env.ACRYL_WEB_HOME
21
+ if (process.platform === 'win32') return join(env.LOCALAPPDATA ?? join(homedir(), 'AppData', 'Local'), 'Acryl', 'web')
22
+ return join(env.XDG_DATA_HOME ?? join(homedir(), '.local', 'share'), 'acryl', 'web')
23
+ }
24
+
25
+ export function manifestUrl(version, env = process.env) {
26
+ return env.ACRYL_RELEASE_MANIFEST_URL ?? `${DEFAULT_RELEASE}/v${version}/release-manifest.json`
27
+ }
28
+
29
+ export function confirmWebAcquisition({ yes, interactive, confirm }) {
30
+ if (yes) return true
31
+ return interactive && confirm !== undefined ? confirm() : false
32
+ }
33
+
34
+ export function selectWebArtifact(manifest, { version, target }) {
35
+ if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest)
36
+ || manifest.schemaVersion !== 1 || typeof manifest.version !== 'string' || !Array.isArray(manifest.artifacts)) {
37
+ fail('release manifest is malformed')
38
+ }
39
+ if (manifest.version !== version) fail(`release manifest version ${manifest.version} does not match installed CLI version ${version}`)
40
+ const matches = manifest.artifacts.filter(artifact => artifact !== null && typeof artifact === 'object'
41
+ && artifact.surface === 'web' && artifact.target === target)
42
+ if (matches.length !== 1) fail(`release manifest does not contain a Web artifact for version ${version} target ${target}`)
43
+ const artifact = matches[0]
44
+ let url
45
+ try { url = new URL(artifact.location, manifest.artifactBaseUrl).toString() } catch { fail(`Web artifact for version ${version} target ${target} has an invalid location`) }
46
+ if (typeof artifact.location !== 'string'
47
+ || artifact.integrity?.algorithm !== 'sha256' || typeof artifact.integrity.value !== 'string' || !/^[a-f0-9]{64}$/u.test(artifact.integrity.value)
48
+ || artifact.receipt?.schemaVersion !== 1 || artifact.receipt.surface !== 'web' || artifact.receipt.target !== target
49
+ || artifact.receipt.version !== version || artifact.receipt.location !== artifact.location
50
+ || artifact.receipt.integrity?.algorithm !== 'sha256' || artifact.receipt.integrity?.value !== artifact.integrity.value
51
+ || artifact.receipt.capabilityBaseline !== manifest.capabilityBaseline) {
52
+ fail(`Web artifact for version ${version} target ${target} is malformed`)
53
+ }
54
+ return { ...artifact, url, sha256: artifact.integrity.value }
55
+ }
56
+
57
+ function receiptPath(root) { return join(root, RECEIPT_NAME) }
58
+
59
+ export function hasVerifiedWebRuntime(root, { version, target, sha256 }) {
60
+ try {
61
+ const receipt = JSON.parse(readFileSync(receiptPath(root), 'utf8'))
62
+ const launcher = join(root, 'runtime', 'bin', process.platform === 'win32' ? 'acryl-web.cmd' : 'acryl-web')
63
+ return receipt?.schemaVersion === 1 && receipt.surface === 'web'
64
+ && receipt.version === version && receipt.target === target && receipt.integrity?.algorithm === 'sha256'
65
+ && receipt.integrity?.value === sha256 && existsSync(launcher)
66
+ } catch { return false }
67
+ }
68
+
69
+ function defaultExtract(archive, destination) {
70
+ execFileSync('tar', ['-xzf', archive, '--no-same-owner', '--no-same-permissions', '--strip-components=1', '-C', destination])
71
+ }
72
+
73
+ async function defaultDownload(url) {
74
+ const response = await fetch(url, { redirect: 'error' })
75
+ if (!response.ok) fail(`Web artifact download failed: ${response.status} ${response.statusText}`)
76
+ return Buffer.from(await response.arrayBuffer())
77
+ }
78
+
79
+ /**
80
+ * Fetch, verify, extract, and atomically commit a target-specific Web runtime.
81
+ * The only durable record is an integrity receipt and executable payload.
82
+ */
83
+ export async function acquireWebRuntime({
84
+ root = managedWebRoot(), version, target, manifest, download = defaultDownload, extract = defaultExtract,
85
+ }) {
86
+ const artifact = selectWebArtifact(manifest, { version, target })
87
+ const installed = join(root, version, target)
88
+ if (hasVerifiedWebRuntime(installed, { version, target, sha256: artifact.sha256 })) return { root: installed, artifact, reused: true }
89
+
90
+ mkdirSync(dirname(installed), { recursive: true })
91
+ const staging = `${installed}.install-${randomUUID()}`
92
+ const archive = join(staging, 'runtime.tar.gz')
93
+ try {
94
+ mkdirSync(staging, { recursive: true })
95
+ const bytes = await download(artifact.url)
96
+ const buffer = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes)
97
+ const actual = createHash('sha256').update(buffer).digest('hex')
98
+ if (actual !== artifact.sha256) fail(`Web artifact checksum verification failed for version ${version} target ${target}`)
99
+ writeFileSync(archive, buffer, { mode: 0o600 })
100
+ extract(archive, staging)
101
+ rmSync(archive, { force: true })
102
+ const launcher = join(staging, 'runtime', 'bin', process.platform === 'win32' ? 'acryl-web.cmd' : 'acryl-web')
103
+ if (!existsSync(launcher)) fail(`Web runtime readiness check failed for version ${version} target ${target}`)
104
+ writeFileSync(receiptPath(staging), `${JSON.stringify(artifact.receipt)}\n`, { mode: 0o600 })
105
+ // Do not replace a previously verified cache. A concurrent verified install wins.
106
+ if (existsSync(installed)) {
107
+ if (hasVerifiedWebRuntime(installed, { version, target, sha256: artifact.sha256 })) return { root: installed, artifact, reused: true }
108
+ const previous = `${installed}.previous-${randomUUID()}`
109
+ renameSync(installed, previous)
110
+ try {
111
+ renameSync(staging, installed)
112
+ } catch (cause) {
113
+ renameSync(previous, installed)
114
+ throw cause
115
+ }
116
+ rmSync(previous, { recursive: true, force: true })
117
+ return { root: installed, artifact, reused: false }
118
+ }
119
+ renameSync(staging, installed)
120
+ return { root: installed, artifact, reused: false }
121
+ } finally {
122
+ rmSync(staging, { recursive: true, force: true })
123
+ }
124
+ }
125
+
126
+ export async function fetchReleaseManifest(url = manifestUrl('unknown')) {
127
+ const response = await fetch(url, { redirect: 'error' })
128
+ if (!response.ok) fail(`release manifest lookup failed: ${response.status} ${response.statusText}`)
129
+ try {
130
+ const manifest = await response.json()
131
+ return { ...manifest, artifactBaseUrl: url }
132
+ } catch { fail('release manifest is malformed') }
133
+ }
package/README.md DELETED
@@ -1,66 +0,0 @@
1
- # ACRYL
2
-
3
- **A persistent, agent-agnostic coding environment.**
4
-
5
- Keep your project, context, and workflow while changing coding agents.
6
-
7
- ACRYL owns the persistent development environment - workspace, context, tasks, artifacts, sessions, and handoffs - while coding agents remain replaceable workers. Use Claude Code, Codex, OpenCode, Pi, Gemini CLI, DeepSeek, ACP-compatible agents, or your own agent without tying your project to any one of them.
8
-
9
- **Same project. Same context. Same work. Different agents.**
10
-
11
- ACRYL is built to adapt to your workflow, not lock you into an agent. Extend it with agents, tools, context systems, memory, workflows, terminals, UI capabilities, and Cordis plugins.
12
-
13
- ## Install
14
-
15
- ```bash
16
- npm install -g acryl
17
- ```
18
-
19
- ## Run
20
-
21
- ```bash
22
- acryl # terminal client (default)
23
- acryl web # serve the local ACRYL web runtime
24
- ```
25
-
26
- A standalone Desktop application is distributed separately.
27
-
28
- ## Why ACRYL?
29
-
30
- Coding agents are temporary. Your development context shouldn't be.
31
-
32
- Most coding agents own their own sessions, context, tools, and history. Switching agents usually means starting over, copying context manually, or maintaining several disconnected development environments.
33
-
34
- ACRYL reverses that relationship:
35
-
36
- ```text
37
- Project and context
38
- ↓
39
- ACRYL
40
- ↓
41
- Coding agents
42
- ```
43
-
44
- The project belongs to ACRYL. Agents enter, work, and leave.
45
-
46
- ## Make it yours
47
-
48
- ACRYL is built around composable capabilities rather than a sealed application.
49
-
50
- Agents, models, tools, memory systems, context engines, terminals, workflows, editors, and UI surfaces can be provided as replaceable capabilities.
51
-
52
- Underneath, ACRYL uses Cordis for lifecycle-managed plugins, replaceable services, reactive dependency injection, typed events, scoped composition, and reversible effects.
53
-
54
- The goal is simple:
55
-
56
- **Change the agent, extend the environment, keep the work.**
57
-
58
- ## Links
59
-
60
- - Website: https://acryl.dev
61
- - Source: https://github.com/acryldev/acryl
62
- - Discord: https://discord.gg/cY9KXMex69
63
-
64
- ## License
65
-
66
- MIT