@qredence/fleet 0.10.0 → 0.10.1

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/prime-runtime.d.mts +19 -0
  3. package/bin/prime-runtime.mjs +42 -5
  4. package/dist/web/client/assets/{index-Cf8tRpHL.js → index-CEZTSuLf.js} +2 -2
  5. package/dist/web/client/assets/{routes--tnF7d6H.js → routes-EKRITFZz.js} +1 -1
  6. package/dist/web/client/bundle-budget.json +2 -2
  7. package/dist/web/server/{_tanstack-start-manifest_v-Io433TLr-YWPNQWQI.js → _tanstack-start-manifest_v-BiMhF9NX-QUZEGAB6.js} +4 -4
  8. package/dist/web/server/{artifacts-panel-cYqS54cM-K6SF3K6W.js → artifacts-panel-BNiaRF83-HDC6VQ66.js} +3 -3
  9. package/dist/web/server/{chat-command-palette-BDnwcymZ-DSTFIAOD.js → chat-command-palette-CT9aJAWG-LV26BDEW.js} +2 -2
  10. package/dist/web/server/{chunk-NSFKPEFI.js → chunk-27J2LPAW.js} +2 -2
  11. package/dist/web/server/{chunk-37EK2TYH.js → chunk-3CU2ITG7.js} +16 -16
  12. package/dist/web/server/{chunk-FI3UF2GW.js → chunk-3R7XCOWI.js} +3 -3
  13. package/dist/web/server/{chunk-RHJEOG37.js → chunk-4TKPOOIG.js} +4 -4
  14. package/dist/web/server/{chunk-2OC2FKHR.js → chunk-4YQ7RBB7.js} +3 -3
  15. package/dist/web/server/{chunk-W7GGECTL.js → chunk-5XRESJQR.js} +3 -3
  16. package/dist/web/server/{chunk-W2GI7NRX.js → chunk-LEZMRXSP.js} +42 -37
  17. package/dist/web/server/{create-project-dialog-BS5Sva46-BO4RLW2Q.js → create-project-dialog-EwieT1Vw-X5MYQSZM.js} +2 -2
  18. package/dist/web/server/{openui-renderer-Q31y65CQ-QNVSP4NN.js → openui-renderer-DCkg_JoD-4QCKSVY5.js} +2 -2
  19. package/dist/web/server/{resources-panel-CH8sG0Od-4BZN6SLY.js → resources-panel-s0mgyvgQ-FVMBBLJJ.js} +3 -3
  20. package/dist/web/server/{router-8EzTM9Eq-COVGJKKX.js → router-DXxChQOI-B7VVEX3H.js} +1 -1
  21. package/dist/web/server/{routes-88H0fiN3-WIAZJ3RT.js → routes-D-g2ILNg-LDYCQ4NU.js} +1 -1
  22. package/dist/web/server/server.js +2 -2
  23. package/dist/web/server/{session-activity-panel-CgSOde03-B5RCAGB4.js → session-activity-panel-wC0jAJvs-QAHJXPAM.js} +3 -3
  24. package/dist/web/server/{session-reasoning-panel-Dmny6YTk-D3HQV2YB.js → session-reasoning-panel-B_K8YgF5-AQPMFM3Y.js} +2 -2
  25. package/dist/web/server/{session-tool-renderer-BrnTO2w3-V6EE6AB2.js → session-tool-renderer-D96BACVh-CH5CV3TS.js} +2 -2
  26. package/dist/web/server/{session-tree-panel-BEqR_cAJ-TZS7VRCB.js → session-tree-panel-CZGXNZIP-FBB3XGMN.js} +2 -2
  27. package/dist/web/server/{settings-dialog-DkesVBrS-BAAA3YNU.js → settings-dialog-BrjqiTVe-H7WOTB4I.js} +3 -3
  28. package/dist/web/server/{subagent-chat-panel-Bfmt1bCE-DKDVH3NJ.js → subagent-chat-panel-Dz62jo_m-X4ZRN5KI.js} +5 -5
  29. package/dist/web/server/{subagents-panel-ChJDDvad-GNCHDTPB.js → subagents-panel-CwpbzJJz-N3ISHODM.js} +5 -5
  30. package/dist/web/server/{workspace-panel-Cij_JylD-WPYSV5FA.js → workspace-panel-C7akv5b9-XUKEHPOP.js} +3 -3
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b78235: Keep the packaged kernel runtime when `fleet-prime` installs Prime Agent
8
+
9
+ 0.10.0 fixed the runtime install inside the web server, but the `fleet-prime`
10
+ command installs Prime Agent itself before it starts the server, and that path
11
+ still kept only the `prime-agent` executable and deleted the
12
+ `prime-agent-runtime` directory the kernel bootstraps from. The server then
13
+ reused that binary as-is, so sessions started from the npm package could still
14
+ fail with "the runtime bundle that ships beside the Prime Agent binary is
15
+ missing".
16
+
17
+ `fleet-prime` and the server now share one installer. It keeps
18
+ `prime-agent-runtime` beside the binary, and an existing binary-only install
19
+ under `~/.prime/fleet/runtimes` is repaired automatically on the next start; no
20
+ manual cleanup is needed.
21
+
3
22
  ## 0.10.0
4
23
 
5
24
  ### Minor Changes
@@ -0,0 +1,19 @@
1
+ export interface PrimeRuntimeAsset {
2
+ archive: string;
3
+ sha256: string;
4
+ executableSha256: string;
5
+ }
6
+
7
+ export interface PrimeRuntimeManifest {
8
+ rust: { version: string; baseUrl: string; platforms: Record<string, PrimeRuntimeAsset | undefined> };
9
+ }
10
+
11
+ export function runtimeTarget(os?: string, cpu?: string): string;
12
+
13
+ export function ensurePrimeRuntime(options: {
14
+ manifest: PrimeRuntimeManifest;
15
+ installRoot?: string;
16
+ home?: string;
17
+ fetch?: typeof fetch;
18
+ target?: string;
19
+ }): Promise<string>;
@@ -1,9 +1,13 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { createHash } from "node:crypto";
3
- import { chmod, mkdir, mkdtemp, open, rename, rm, writeFile } from "node:fs/promises";
3
+ import { chmod, mkdir, mkdtemp, open, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { arch, homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
+ // This module is the single Prime Agent runtime installer. The npm launcher
8
+ // (`fleet-prime`) runs it directly, and the web server re-exports it from
9
+ // `web/server/src/prime-runtime.ts`, so both install the same payload.
10
+
7
11
  export function runtimeTarget(os = platform(), cpu = arch()) {
8
12
  const target = `${os}-${cpu}`;
9
13
  if (!["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64"].includes(target)) {
@@ -26,7 +30,13 @@ export async function ensurePrimeRuntime({
26
30
  if (!asset) throw new Error(`Fleet has no pinned Prime Agent runtime for ${target}`);
27
31
  const destination = installRoot ?? join(home, ".prime", "fleet", "runtimes", runtime.version, target);
28
32
  const executable = join(destination, "prime-agent");
29
- if (await matchesDigest(executable, asset.executableSha256)) return executable;
33
+ const packagedRuntime = join(destination, "prime-agent-runtime");
34
+ // A verified binary is not enough: the kernel bootstraps from the packaged
35
+ // runtime beside it. Installs made by earlier Fleet releases kept only the
36
+ // executable, so that state is repaired rather than short-circuited.
37
+ if ((await matchesDigest(executable, asset.executableSha256)) && (await directoryExists(packagedRuntime))) {
38
+ return executable;
39
+ }
30
40
 
31
41
  await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
32
42
  const staging = await mkdtemp(join(dirname(destination), ".fleet-prime-runtime-"));
@@ -50,18 +60,45 @@ export async function ensurePrimeRuntime({
50
60
  const result = spawnSync("tar", ["-xzf", archivePath, "-C", unpacked], { encoding: "utf8" });
51
61
  if (result.status !== 0)
52
62
  throw new Error(`Could not extract Prime Agent runtime: ${result.stderr || "tar failed"}`);
53
- if (!(await matchesDigest(join(unpacked, "prime-agent"), asset.executableSha256))) {
63
+ const extractedBinary = join(unpacked, "prime-agent");
64
+ if (!(await matchesDigest(extractedBinary, asset.executableSha256))) {
54
65
  throw new Error("Extracted Prime Agent executable checksum mismatch; refusing to install it.");
55
66
  }
56
- await chmod(join(unpacked, "prime-agent"), 0o755);
67
+ await chmod(extractedBinary, 0o755);
57
68
  await mkdir(destination, { recursive: true, mode: 0o700 });
58
- await rename(join(unpacked, "prime-agent"), executable);
69
+ // The kernel bootstraps from `prime-agent-runtime/`, which ships beside the
70
+ // binary. It lands before the executable is replaced, so a failed rename
71
+ // cannot leave a binary that looks current with no runtime. Any existing
72
+ // copy (possibly damaged) is moved aside into the private staging dir
73
+ // rather than deleted in place, so the window with no runtime is two
74
+ // renames, and the verified copy always replaces it.
75
+ const extractedRuntime = join(unpacked, "prime-agent-runtime");
76
+ if (await directoryExists(extractedRuntime)) {
77
+ await rename(packagedRuntime, join(staging, "previous-runtime")).catch((error) => {
78
+ if (error.code !== "ENOENT") throw error;
79
+ });
80
+ await rename(extractedRuntime, packagedRuntime).catch((error) => {
81
+ // A concurrent install of the same checksummed archive placed it first.
82
+ if (error.code !== "ENOTEMPTY" && error.code !== "EEXIST") throw error;
83
+ });
84
+ }
85
+ await rename(extractedBinary, executable);
59
86
  return executable;
60
87
  } finally {
61
88
  await rm(staging, { recursive: true, force: true });
62
89
  }
63
90
  }
64
91
 
92
+ async function directoryExists(path) {
93
+ try {
94
+ return (await stat(path)).isDirectory();
95
+ } catch (error) {
96
+ // Only absence means "not installed"; surface permission or symlink errors.
97
+ if (error.code === "ENOENT" || error.code === "ENOTDIR") return false;
98
+ throw error;
99
+ }
100
+ }
101
+
65
102
  async function matchesDigest(path, expected) {
66
103
  let file;
67
104
  try {