@taco-ai/cli 0.3.6 → 0.3.8
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/lib/installHelpers.ts +7 -13
- package/lib/paths.ts +4 -4
- package/lib/start.ts +9 -18
- package/lib/upgrade.ts +9 -20
- package/lib/upgradeApply.ts +12 -24
- package/package.json +3 -3
package/lib/installHelpers.ts
CHANGED
|
@@ -7,21 +7,15 @@
|
|
|
7
7
|
* Resolution order, first match wins:
|
|
8
8
|
* 1. TACO_SIDECAR_NODE / _BUNDLE / _RESOURCES env triple — explicit override.
|
|
9
9
|
* 2. An installed `@taco-ai/sidecar-<platform>` package, located via
|
|
10
|
-
* `createRequire` and validated against its `manifest.json`.
|
|
11
|
-
* released path.
|
|
10
|
+
* `createRequire` and validated against its `manifest.json`.
|
|
12
11
|
* 3. Dev checkout: `packages/sidecar/dist/runtime/<triple>/`, which
|
|
13
|
-
* `buildRuntime.mjs` emits with the
|
|
14
|
-
* (`lib/index.mjs`, `bin/taco-sidecar-node`, `agents/`, `skills/`,
|
|
15
|
-
* `manifest.json`). Needed because the per-platform optionalDependencies
|
|
16
|
-
* were dropped from the sidecar manifest, so a dev checkout has no
|
|
17
|
-
* platform package to resolve at (2).
|
|
12
|
+
* `buildRuntime.mjs` emits with the platform package's layout.
|
|
18
13
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* propagates without re-running `taco install
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `taco install` re-runs.
|
|
14
|
+
* The resolved tree is used in place — the launchd / schtasks wrapper points
|
|
15
|
+
* at its existing location, so a `pnpm update` or a runtime rebuild
|
|
16
|
+
* propagates without re-running `taco install`. Deleting that tree (for
|
|
17
|
+
* example node_modules or dist) leaves the service wrapper dangling until
|
|
18
|
+
* `taco install` runs again.
|
|
25
19
|
*/
|
|
26
20
|
|
|
27
21
|
import { spawn } from "node:child_process";
|
package/lib/paths.ts
CHANGED
|
@@ -84,21 +84,21 @@ export function controlSocketPath(runtimeDir: string = RUNTIME_DIR): string {
|
|
|
84
84
|
return join(runtimeDir, "sidecar-ctl.sock");
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/** Daemon pid file (Unix only; Windows uses service control manager
|
|
87
|
+
/** Daemon pid file (Unix only; Windows uses service control manager). */
|
|
88
88
|
export function runtimePidFile(runtimeDir: string = RUNTIME_DIR): string {
|
|
89
89
|
return join(runtimeDir, "sidecar.pid");
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/** Upgrade marker file
|
|
92
|
+
/** Upgrade marker file. */
|
|
93
93
|
export const UPGRADE_MARKER = join(TACO_HOME, "upgrade-marker.json");
|
|
94
94
|
|
|
95
95
|
/** Logs root — launchd/schtasks redirect the daemon's stdout/stderr here. */
|
|
96
96
|
export const LOG_DIR = join(TACO_HOME, "logs");
|
|
97
97
|
|
|
98
|
-
/** Upgrade staging area —
|
|
98
|
+
/** Upgrade staging area — the new bundle is downloaded here before swapping. */
|
|
99
99
|
export const STAGING_DIR = join(TACO_HOME, "staging");
|
|
100
100
|
|
|
101
|
-
/** Scheduler job definitions root
|
|
101
|
+
/** Scheduler job definitions root. */
|
|
102
102
|
export const JOBS_DIR = join(TACO_HOME, "jobs");
|
|
103
103
|
|
|
104
104
|
/** Create the directory tree under $TACO_HOME that `taco install` + later PRs rely on.
|
package/lib/start.ts
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `taco start` — ensure a daemon is running and report its socket path.
|
|
3
3
|
*
|
|
4
|
-
* Idempotent
|
|
5
|
-
*
|
|
6
|
-
* spawn), and macOS launchd `RunAtLoad=true` adds a third. Spawning
|
|
7
|
-
* unconditionally meant two daemons racing to bind the same control socket,
|
|
8
|
-
* where the loser exited non-zero and launchd restarted it forever.
|
|
4
|
+
* Idempotent: several independent callers reach this, so an already-running
|
|
5
|
+
* daemon is reused rather than duplicated.
|
|
9
6
|
*
|
|
10
|
-
* Flow:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* but stale daemon is reaped first, via the same kill path as a wedged
|
|
16
|
-
* one.
|
|
17
|
-
* 3. Otherwise elect a spawner via `start.lock`. The winner spawns and waits
|
|
18
|
-
* for readiness; losers skip the spawn and wait on the same socket.
|
|
19
|
-
* 4. Print the NDJSON socket path to stdout (single line) so callers
|
|
20
|
-
* (Tauri UI / scripts) can read it via `Command::output()`.
|
|
7
|
+
* Flow: resolve $TACO_HOME + runtime dir (create both if missing); reuse a
|
|
8
|
+
* daemon answering on the NDJSON socket that already runs this launch's code
|
|
9
|
+
* (pid-record version match; dev checkouts never match — a stale one is
|
|
10
|
+
* reaped first); else elect a spawner via `start.lock` (winner spawns,
|
|
11
|
+
* losers wait on the same socket). Print the NDJSON socket path to stdout.
|
|
21
12
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
13
|
+
* Exits once ready: a launcher, not a supervisor — staying alive would tie
|
|
14
|
+
* the daemon's lifetime to whoever ran `taco start`.
|
|
24
15
|
*/
|
|
25
16
|
|
|
26
17
|
import { readFileSync, unlinkSync } from "node:fs";
|
package/lib/upgrade.ts
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `taco upgrade` — fetch the latest sidecar bundle for the current
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* `taco upgrade` — fetch the latest sidecar bundle for the current platform
|
|
3
|
+
* from the npm registry, verify the tarball's `integrity` (sha512-base64)
|
|
4
|
+
* against the downloaded bytes, extract to staging, and write the upgrade
|
|
5
|
+
* marker. The daemon's orchestrator sees that marker and shuts itself down;
|
|
6
|
+
* the UI's reconnect loop then runs `taco upgrade --apply` to swap staging
|
|
7
|
+
* into live.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* registry is the source of truth, supports anonymous GETs, and ships
|
|
11
|
-
* an `integrity` (sha512-base64) field we verify against the
|
|
12
|
-
* downloaded bytes.
|
|
13
|
-
*
|
|
14
|
-
* Layout on disk after a successful run:
|
|
15
|
-
* $TACO_HOME/cache/sidecar/<platform>-<version>.tgz downloaded tarball
|
|
16
|
-
* $TACO_HOME/staging/sidecar-<platform>-<version>/ extracted bundle
|
|
17
|
-
* $TACO_HOME/upgrade-marker.json the marker
|
|
18
|
-
*
|
|
19
|
-
* The daemon's UpgradeOrchestrator reads the marker on its 6h recheck,
|
|
20
|
-
* sees the staging dir exists, and asks the host to shut down. The UI's
|
|
21
|
-
* reconnect loop then runs `taco upgrade --apply` (commit 6's companion)
|
|
22
|
-
* which swaps staging into live and restarts.
|
|
9
|
+
* Layout: $TACO_HOME/cache/sidecar/<platform>-<version>.tgz (tarball),
|
|
10
|
+
* $TACO_HOME/staging/sidecar-<platform>-<version>/ (bundle),
|
|
11
|
+
* $TACO_HOME/upgrade-marker.json (marker).
|
|
23
12
|
*/
|
|
24
13
|
|
|
25
14
|
import { createHash } from "node:crypto";
|
package/lib/upgradeApply.ts
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `taco upgrade --apply` — atomic swap of the staged bundle into the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* down (because the marker pointed at a real staging dir).
|
|
2
|
+
* `taco upgrade --apply` — atomic swap of the staged bundle into the live
|
|
3
|
+
* install dir, then clear the marker. Run by the UI's reconnect loop (or by
|
|
4
|
+
* `taco start`) once the daemon's UpgradeOrchestrator has shut itself down.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 4. Rename `staging_dir` → `live_dir` (atomic if prev rename
|
|
17
|
-
* succeeded; on EXDEV across filesystems we fall back to
|
|
18
|
-
* copyFile + unlink so a cross-mount install doesn't wedge).
|
|
19
|
-
* 5. On any failure: rename `live_dir.prev` back to `live_dir`
|
|
20
|
-
* so the daemon's next start picks up the old binary instead of
|
|
21
|
-
* a half-swapped tree.
|
|
22
|
-
* 6. Clear the marker.
|
|
23
|
-
* 7. Best-effort: send control.shutdown so the (about-to-restart)
|
|
24
|
-
* daemon stops cleanly; the service manager (launchd / schtasks)
|
|
25
|
-
* respawns against the new binary. If no service is installed,
|
|
26
|
-
* the UI's reconnect loop runs `taco start` itself.
|
|
6
|
+
* 1. Read the marker (missing → throw) and check staging still holds a
|
|
7
|
+
* manifest.json — missing staging clears the marker, malformed staging
|
|
8
|
+
* keeps it so a re-run can re-download.
|
|
9
|
+
* 2. Rename `live_dir` → `live_dir.prev`.
|
|
10
|
+
* 3. Rename `staging_dir` → `live_dir` (on EXDEV fall back to copyFile +
|
|
11
|
+
* unlink).
|
|
12
|
+
* 4. On failure rename `.prev` back so the next start picks up the old
|
|
13
|
+
* binary instead of a half-swapped tree.
|
|
14
|
+
* 5. Clear the marker, run the optional `stop` hook, drop the rollback target.
|
|
27
15
|
*/
|
|
28
16
|
|
|
29
17
|
import { copyFile, mkdir, rename, rm, stat } from "node:fs/promises";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taco-ai/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Taco CLI — launcher + daemon supervisor for the sidecar. Wraps @taco-ai/sidecar with user-facing subcommands (start, status, install, upgrade).",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"tar": "^7.5.22",
|
|
25
|
-
"@taco-ai/shared": "0.3.
|
|
26
|
-
"@taco-ai/sidecar": "0.3.
|
|
25
|
+
"@taco-ai/shared": "0.3.8",
|
|
26
|
+
"@taco-ai/sidecar": "0.3.8"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.7.0",
|