@mycadet/cli 0.13.0-dev.202611131045.a556a8a → 0.13.0-dev.202611140220.fac72d3

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 (25) hide show
  1. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +1 -1
  2. package/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  3. package/node_modules/@mycadet/environments/package.json +1 -1
  4. package/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  5. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  6. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/package.json +1 -1
  7. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  8. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +1 -1
  9. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/package.json +1 -1
  10. package/node_modules/@mycadet/local-mode/package.json +1 -1
  11. package/node_modules/@mycadet/local-mode/src/__tests__/hatch-config.test.ts +110 -99
  12. package/node_modules/@mycadet/local-mode/src/__tests__/{hatch-local-overlay.test.ts → hatch-local-config-api.test.ts} +60 -50
  13. package/node_modules/@mycadet/local-mode/src/__tests__/local-exec-invocation.test.ts +15 -5
  14. package/node_modules/@mycadet/local-mode/src/__tests__/teleport-init.test.ts +1 -8
  15. package/node_modules/@mycadet/local-mode/src/index.ts +3 -9
  16. package/node_modules/@mycadet/local-mode/src/remotes/docker/hatch.ts +15 -48
  17. package/node_modules/@mycadet/local-mode/src/remotes/local/common.ts +82 -40
  18. package/node_modules/@mycadet/local-mode/src/remotes/local/exec.ts +8 -61
  19. package/node_modules/@mycadet/local-mode/src/remotes/local/hatch-config.ts +71 -44
  20. package/node_modules/@mycadet/local-mode/src/remotes/local/hatch.ts +15 -8
  21. package/node_modules/@mycadet/local-mode/src/remotes/local/teleport.ts +5 -13
  22. package/node_modules/@mycadet/local-mode/src/remotes/local/wake.ts +10 -38
  23. package/node_modules/@mycadet/service-contracts/package.json +1 -1
  24. package/node_modules/@mycadet/shared/package.json +1 -1
  25. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/service-contracts",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/avatar-manifest",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/environments",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/ipc-server-utils",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/avatar-manifest",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/environments",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/ipc-server-utils",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/service-contracts",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/shared",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "exports": {
6
6
  ".": "./github-repository.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/local-mode",
3
- "version": "0.13.0-dev.202611131045.a556a8a",
3
+ "version": "0.13.0-dev.202611140220.fac72d3",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,25 +1,12 @@
1
- import { readFileSync, rmSync } from "fs";
2
1
  import { describe, expect, test } from "bun:test";
3
2
 
4
3
  import {
4
+ applyHatchConfig,
5
5
  buildHatchConfigValues,
6
6
  buildNestedConfig,
7
- writeInitialConfig,
8
7
  } from "../remotes/local/hatch-config";
9
8
 
10
- function readInitialConfig(
11
- configValues: Record<string, string>,
12
- ): Record<string, unknown> {
13
- const path = writeInitialConfig(configValues);
14
- expect(path).toBeDefined();
15
- try {
16
- return JSON.parse(readFileSync(path!, "utf-8")) as Record<string, unknown>;
17
- } finally {
18
- if (path !== undefined) rmSync(path, { force: true });
19
- }
20
- }
21
-
22
- describe("config-utils", () => {
9
+ describe("hatch-config", () => {
23
10
  test("buildNestedConfig only converts dot-notation values", () => {
24
11
  expect(
25
12
  buildNestedConfig({
@@ -36,51 +23,9 @@ describe("config-utils", () => {
36
23
  });
37
24
  });
38
25
 
39
- test("buildHatchConfigValues adds the default hatch provider when no config exists", () => {
40
- expect(buildHatchConfigValues({}, "anthropic")).toEqual({
41
- "llm.default.provider": "anthropic",
42
- });
43
- });
44
-
45
- test("buildHatchConfigValues preserves explicit provider config", () => {
46
- expect(
47
- buildHatchConfigValues(
48
- {
49
- "llm.default.provider": "openai",
50
- "llm.default.model": "gpt-5.4",
51
- },
52
- "anthropic",
53
- ),
54
- ).toEqual({
55
- "llm.default.provider": "openai",
56
- "llm.default.model": "gpt-5.4",
57
- });
58
- });
59
-
60
- test("buildHatchConfigValues skips internal hatches without provider setup", () => {
61
- expect(buildHatchConfigValues({}, undefined)).toEqual({});
62
- expect(buildHatchConfigValues({}, null)).toEqual({});
63
- });
64
-
65
- test("writeInitialConfig does not add a mainAgent callSite for Anthropic defaults", () => {
66
- expect(
67
- readInitialConfig({
68
- "llm.default.provider": "anthropic",
69
- "llm.default.model": "claude-opus-4-7",
70
- }),
71
- ).toEqual({
72
- llm: {
73
- default: {
74
- provider: "anthropic",
75
- model: "claude-opus-4-7",
76
- },
77
- },
78
- });
79
- });
80
-
81
- test("writeInitialConfig preserves profile-based Anthropic model selection", () => {
26
+ test("buildNestedConfig preserves nested fragments like profile overrides", () => {
82
27
  expect(
83
- readInitialConfig({
28
+ buildNestedConfig({
84
29
  "llm.activeProfile": "quality-optimized",
85
30
  "llm.profiles.quality-optimized.provider": "anthropic",
86
31
  "llm.profiles.quality-optimized.model": "claude-opus-4-7",
@@ -100,9 +45,9 @@ describe("config-utils", () => {
100
45
  });
101
46
  });
102
47
 
103
- test("writeInitialConfig preserves explicit mainAgent overrides without rewriting them", () => {
48
+ test("buildNestedConfig does not invent a mainAgent callSite for Anthropic defaults", () => {
104
49
  expect(
105
- readInitialConfig({
50
+ buildNestedConfig({
106
51
  "llm.default.provider": "anthropic",
107
52
  "llm.default.model": "claude-opus-4-7",
108
53
  "llm.callSites.mainAgent.model": "claude-haiku-4-5-20251001",
@@ -122,55 +67,121 @@ describe("config-utils", () => {
122
67
  });
123
68
  });
124
69
 
125
- test("writeInitialConfig respects explicit non-default Anthropic models", () => {
126
- expect(
127
- readInitialConfig({
128
- "llm.default.provider": "anthropic",
129
- "llm.default.model": "claude-haiku-4-5-20251001",
130
- }),
131
- ).toEqual({
132
- llm: {
133
- default: {
134
- provider: "anthropic",
135
- model: "claude-haiku-4-5-20251001",
136
- },
137
- },
70
+ test("buildHatchConfigValues adds the default hatch provider when no config exists", () => {
71
+ expect(buildHatchConfigValues({}, "anthropic")).toEqual({
72
+ "llm.default.provider": "anthropic",
138
73
  });
139
74
  });
140
75
 
141
- test("writeInitialConfig leaves active OpenAI profile config unchanged", () => {
76
+ test("buildHatchConfigValues preserves explicit provider config", () => {
142
77
  expect(
143
- readInitialConfig({
144
- "llm.activeProfile": "fast",
145
- "llm.profiles.fast.provider": "openai",
146
- "llm.profiles.fast.model": "gpt-5.5",
147
- }),
148
- ).toEqual({
149
- llm: {
150
- activeProfile: "fast",
151
- profiles: {
152
- fast: {
153
- provider: "openai",
154
- model: "gpt-5.5",
155
- },
78
+ buildHatchConfigValues(
79
+ {
80
+ "llm.default.provider": "openai",
81
+ "llm.default.model": "gpt-5.4",
156
82
  },
83
+ "anthropic",
84
+ ),
85
+ ).toEqual({
86
+ "llm.default.provider": "openai",
87
+ "llm.default.model": "gpt-5.4",
88
+ });
89
+ });
90
+
91
+ test("buildHatchConfigValues skips internal hatches without provider setup", () => {
92
+ expect(buildHatchConfigValues({}, undefined)).toEqual({});
93
+ expect(buildHatchConfigValues({}, null)).toEqual({});
94
+ });
95
+
96
+ test("applyHatchConfig sets each dotted path through the config API", async () => {
97
+ const calls: { url: string; body: unknown; auth?: string }[] = [];
98
+ const response = new Response(JSON.stringify({ ok: true }), {
99
+ status: 200,
100
+ });
101
+ await applyHatchConfig({
102
+ gatewayUrl: "http://localhost:4444/",
103
+ bearerToken: "test-token",
104
+ configValues: {
105
+ "llm.default.model": "claude-opus-4-7",
106
+ "llm.default.provider": "anthropic",
157
107
  },
108
+ fetchImpl: (async (url, init) => {
109
+ calls.push({
110
+ url: String(url),
111
+ body: JSON.parse(String(init?.body)),
112
+ auth: new Headers(init?.headers).get("Authorization") ?? undefined,
113
+ });
114
+ return response;
115
+ }) as typeof fetch,
158
116
  });
117
+
118
+ expect(calls.map((c) => c.url)).toEqual([
119
+ "http://localhost:4444/v1/config/set",
120
+ "http://localhost:4444/v1/config/set",
121
+ ]);
122
+ expect(calls.map((c) => c.body)).toEqual([
123
+ { path: "llm.default.model", value: "claude-opus-4-7" },
124
+ { path: "llm.default.provider", value: "anthropic" },
125
+ ]);
126
+ for (const call of calls) {
127
+ expect(call.auth).toBe("Bearer test-token");
128
+ }
159
129
  });
160
130
 
161
- test("writeInitialConfig does not add Opus for non-Anthropic providers", () => {
162
- expect(
163
- readInitialConfig({
131
+ test("applyHatchConfig is a no-op without values", async () => {
132
+ let fetched = false;
133
+ await applyHatchConfig({
134
+ gatewayUrl: "http://localhost:4444",
135
+ bearerToken: "test-token",
136
+ configValues: {},
137
+ fetchImpl: (async (..._args: unknown[]) => {
138
+ fetched = true;
139
+ return new Response("{}", { status: 200 });
140
+ }) as typeof fetch,
141
+ });
142
+ expect(fetched).toBe(false);
143
+ });
144
+
145
+ test("applyHatchConfig skips with a warning when no token was leased", async () => {
146
+ const warnings: string[] = [];
147
+ let fetched = false;
148
+ await applyHatchConfig({
149
+ gatewayUrl: "http://localhost:4444",
150
+ configValues: { "llm.default.provider": "anthropic" },
151
+ fetchImpl: (async (..._args: unknown[]) => {
152
+ fetched = true;
153
+ return new Response("{}", { status: 200 });
154
+ }) as typeof fetch,
155
+ log: (m) => warnings.push(m),
156
+ });
157
+ expect(fetched).toBe(false);
158
+ expect(warnings.join("\n")).toContain("assistant config set");
159
+ });
160
+
161
+ test("applyHatchConfig keeps applying the remaining keys when one fails", async () => {
162
+ const paths: string[] = [];
163
+ const warnings: string[] = [];
164
+ await applyHatchConfig({
165
+ gatewayUrl: "http://localhost:4444",
166
+ bearerToken: "test-token",
167
+ configValues: {
168
+ "llm.default.model": "gpt-5.4",
164
169
  "llm.default.provider": "openai",
165
- "llm.default.model": "gpt-5.5",
166
- }),
167
- ).toEqual({
168
- llm: {
169
- default: {
170
- provider: "openai",
171
- model: "gpt-5.5",
172
- },
173
170
  },
171
+ fetchImpl: (async (...args: Parameters<typeof fetch>) => {
172
+ const body = JSON.parse(String(args[1]?.body)) as { path: string };
173
+ paths.push(body.path);
174
+ if (body.path === "llm.default.model") {
175
+ return new Response("boom", { status: 500 });
176
+ }
177
+ return new Response("{}", { status: 200 });
178
+ }) as typeof fetch,
179
+ log: (m) => warnings.push(m),
174
180
  });
181
+
182
+ // Both keys attempted; the failure warns and names a re-apply path.
183
+ expect(paths).toEqual(["llm.default.model", "llm.default.provider"]);
184
+ expect(warnings.join("\n")).toContain("llm.default.model");
185
+ expect(warnings.join("\n")).toContain("assistant config set");
175
186
  });
176
187
  });
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Pins the local hatch leg's first-boot config overlay: the provider the
3
- * caller picked IS the fresh daemon's default. The docker leg injects the
4
- * pick through buildHatchConfigValues; when this leg skipped that step the
5
- * daemon booted on the schema's anthropic fallback and every send died 422
6
- * for a connection the user never picked ("anthropic-personal has no API
7
- * key stored") while the fireworks key they did store sat unused.
2
+ * Pins the local hatch leg's config handoff: the provider the caller picked
3
+ * reaches the assistant's public config API (`POST /v1/config/set`) after
4
+ * wake — the same route the docker leg, the web client, and
5
+ * `assistant config set` use. When this leg skipped the pick the daemon
6
+ * booted on the schema's anthropic fallback and every send died 422 for a
7
+ * connection the user never picked ("anthropic-personal has no API key
8
+ * stored") while the fireworks key they did store sat unused.
8
9
  */
9
10
 
10
11
  import {
@@ -16,29 +17,39 @@ import {
16
17
  test,
17
18
  mock,
18
19
  } from "bun:test";
19
- import { mkdtempSync, readFileSync, rmSync } from "node:fs";
20
+ import { mkdtempSync, rmSync } from "node:fs";
20
21
  import os from "node:os";
21
22
  import path from "node:path";
22
23
 
23
- let capturedOverlayPath: string | undefined;
24
+ interface CapturedApply {
25
+ gatewayUrl: string;
26
+ bearerToken?: string;
27
+ configValues: Record<string, string>;
28
+ }
29
+
30
+ let capturedApply: CapturedApply | undefined;
24
31
 
25
32
  // Spread the actual module under the override — mocking without the spread
26
33
  // replaces the whole module record for every file that runs later in the
27
34
  // same bun test process.
28
35
  const actualLocalWake = await import("../remotes/local/wake");
29
- const wakeMock = mock<
30
- (entry: unknown, opts?: { defaultWorkspaceConfigPath?: string }) => Promise<{
31
- ok: true;
32
- }>
33
- >(async (_entry, opts) => {
34
- capturedOverlayPath = opts?.defaultWorkspaceConfigPath;
35
- return { ok: true };
36
- });
36
+ const wakeMock = mock(
37
+ async (_entry: unknown, _opts?: { watch?: boolean }) =>
38
+ ({ ok: true }) as never,
39
+ );
37
40
  mock.module("../remotes/local/wake", () => ({
38
41
  ...actualLocalWake,
39
42
  wakeLocal: wakeMock,
40
43
  }));
41
44
 
45
+ const actualHatchConfig = await import("../remotes/local/hatch-config");
46
+ mock.module("../remotes/local/hatch-config", () => ({
47
+ ...actualHatchConfig,
48
+ applyHatchConfig: async (options: CapturedApply) => {
49
+ capturedApply = options;
50
+ },
51
+ }));
52
+
42
53
  // Spread the actual modules under the overrides — other modules in the
43
54
  // import graph need the exports this test doesn't touch.
44
55
  const actualGuardianToken = await import("../guardian-token");
@@ -46,7 +57,7 @@ mock.module("../guardian-token", () => ({
46
57
  ...actualGuardianToken,
47
58
  // A valid-shaped token: the lease succeeding keeps the leg's post-hatch
48
59
  // steps instant (a failing lease retries with sleeps), and this test is
49
- // about the overlay, not the lease.
60
+ // about the config handoff, not the lease.
50
61
  leaseGuardianToken: async () => ({
51
62
  guardianPrincipalId: "principal-test",
52
63
  accessToken: "test-token",
@@ -60,13 +71,13 @@ mock.module("../guardian-token", () => ({
60
71
  }));
61
72
 
62
73
  const actualProviderCredentials = await import("../provider-credentials");
63
- mock.module("../../provider-credentials", () => ({
74
+ mock.module("../provider-credentials", () => ({
64
75
  ...actualProviderCredentials,
65
76
  configureHatchProviderApiKey: async () => {},
66
77
  }));
67
78
 
68
79
  const actualCloudAuth = await import("../cloud-auth");
69
- mock.module("../../cloud-auth", () => ({
80
+ mock.module("../cloud-auth", () => ({
70
81
  ...actualCloudAuth,
71
82
  readCloudToken: () => null,
72
83
  }));
@@ -75,9 +86,10 @@ const { hatchLocal } = await import("../remotes/local/hatch");
75
86
 
76
87
  afterAll(() => {
77
88
  mock.module("../remotes/local/wake", () => actualLocalWake);
89
+ mock.module("../remotes/local/hatch-config", () => actualHatchConfig);
78
90
  mock.module("../guardian-token", () => actualGuardianToken);
79
- mock.module("../../provider-credentials", () => actualProviderCredentials);
80
- mock.module("../../cloud-auth", () => actualCloudAuth);
91
+ mock.module("../provider-credentials", () => actualProviderCredentials);
92
+ mock.module("../cloud-auth", () => actualCloudAuth);
81
93
  });
82
94
 
83
95
  let home: string;
@@ -85,7 +97,7 @@ const ENV_KEYS = ["XDG_CONFIG_HOME", "XDG_DATA_HOME"] as const;
85
97
  const saved = new Map<string, string | undefined>();
86
98
 
87
99
  beforeEach(() => {
88
- home = mkdtempSync(path.join(os.tmpdir(), "hatch-local-overlay-"));
100
+ home = mkdtempSync(path.join(os.tmpdir(), "hatch-local-config-api-"));
89
101
  for (const key of ENV_KEYS) {
90
102
  saved.set(key, process.env[key]);
91
103
  process.env[key] = path.join(home, key.toLowerCase());
@@ -100,45 +112,43 @@ afterEach(() => {
100
112
  rmSync(home, { recursive: true, force: true });
101
113
  });
102
114
 
103
- describe("hatchLocal's first-boot config overlay", () => {
104
- test("the picked provider rides the overlay as llm.default.provider", async () => {
115
+ describe("hatchLocal's config API handoff", () => {
116
+ test("the picked provider rides the config API as llm.default.provider", async () => {
105
117
  const result = await hatchLocal({
106
- name: "overlay-probe",
118
+ name: "config-api-probe",
107
119
  provider: "fireworks",
108
- reporter: { progress: () => {}, log: () => {}, warn: () => {}, error: () => {} },
120
+ reporter: {
121
+ progress: () => {},
122
+ log: () => {},
123
+ warn: () => {},
124
+ error: () => {},
125
+ },
109
126
  });
110
127
  expect(result.ok).toBe(true);
111
- expect(capturedOverlayPath).toBeDefined();
112
- try {
113
- const overlay = JSON.parse(
114
- readFileSync(capturedOverlayPath!, "utf-8"),
115
- ) as Record<string, unknown>;
116
- expect(overlay).toMatchObject({
117
- llm: { default: { provider: "fireworks" } },
118
- });
119
- } finally {
120
- if (capturedOverlayPath) rmSync(capturedOverlayPath, { force: true });
121
- }
128
+ expect(capturedApply).toBeDefined();
129
+ expect(capturedApply?.bearerToken).toBe("test-token");
130
+ expect(capturedApply?.gatewayUrl).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/);
131
+ expect(capturedApply?.configValues).toMatchObject({
132
+ "llm.default.provider": "fireworks",
133
+ });
122
134
  });
123
135
 
124
136
  test("explicit config wins over the pick", async () => {
125
137
  const result = await hatchLocal({
126
- name: "overlay-probe-2",
138
+ name: "config-api-probe-2",
127
139
  provider: "fireworks",
128
140
  configValues: { "llm.default.provider": "openai" },
129
- reporter: { progress: () => {}, log: () => {}, warn: () => {}, error: () => {} },
141
+ reporter: {
142
+ progress: () => {},
143
+ log: () => {},
144
+ warn: () => {},
145
+ error: () => {},
146
+ },
130
147
  });
131
148
  expect(result.ok).toBe(true);
132
- expect(capturedOverlayPath).toBeDefined();
133
- try {
134
- const overlay = JSON.parse(
135
- readFileSync(capturedOverlayPath!, "utf-8"),
136
- ) as Record<string, unknown>;
137
- expect(overlay).toMatchObject({
138
- llm: { default: { provider: "openai" } },
139
- });
140
- } finally {
141
- if (capturedOverlayPath) rmSync(capturedOverlayPath, { force: true });
142
- }
149
+ expect(capturedApply).toBeDefined();
150
+ expect(capturedApply?.configValues).toMatchObject({
151
+ "llm.default.provider": "openai",
152
+ });
143
153
  });
144
154
  });
@@ -1,8 +1,15 @@
1
- import { chmodSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
1
+ import {
2
+ chmodSync,
3
+ mkdirSync,
4
+ readFileSync,
5
+ rmSync,
6
+ statSync,
7
+ writeFileSync,
8
+ } from "node:fs";
2
9
  import { tmpdir } from "node:os";
3
10
  import { join } from "node:path";
4
11
  import { afterEach, beforeEach, describe, expect, test } from "bun:test";
5
- import { ensureLocalBinShims } from "../remotes/local/exec";
12
+ import { ensureLocalBinShims } from "../remotes/local/common";
6
13
 
7
14
  // The bin/ folder is the contract: exec prepends it to the child's PATH, so
8
15
  // EVERY invocation shape — argv, compound commands, pipes, shell scripts —
@@ -90,9 +97,12 @@ describe("ensureLocalBinShims", () => {
90
97
  "src",
91
98
  "index.ts",
92
99
  );
93
- mkdirSync(join(runtimeDir, "node_modules", "@mycadet", "assistant", "src"), {
94
- recursive: true,
95
- });
100
+ mkdirSync(
101
+ join(runtimeDir, "node_modules", "@mycadet", "assistant", "src"),
102
+ {
103
+ recursive: true,
104
+ },
105
+ );
96
106
  writeFileSync(fakeIndex, "export {};\n");
97
107
  chmodSync(fakeIndex, 0o644);
98
108
  ensureLocalBinShims(entry());
@@ -6,7 +6,6 @@ import * as lockfile from "../lockfile";
6
6
  import * as lookup from "../operations/lookup";
7
7
  import * as hatchLock from "../remotes/local/hatch-lock";
8
8
  import * as localHatch from "../remotes/local/hatch";
9
- import * as hatchConfig from "../remotes/local/hatch-config";
10
9
  import { initializeDockerTeleportTarget } from "../remotes/docker/teleport";
11
10
  import { initializeLocalTeleportTarget } from "../remotes/local/teleport";
12
11
 
@@ -86,7 +85,7 @@ test("a fresh docker target initializes the volumes without creating containers"
86
85
  ).toBe(true);
87
86
  });
88
87
 
89
- test("a fresh local target writes config, installs the archive, then persists", async () => {
88
+ test("a fresh local target installs the archive, then persists", async () => {
90
89
  const withLock = spyOn(hatchLock, "withLocalHatchLock").mockImplementation(
91
90
  async (action) => action(),
92
91
  );
@@ -99,10 +98,6 @@ test("a fresh local target writes config, installs the archive, then persists",
99
98
  daemonPort: 7831,
100
99
  cesPort: 7832,
101
100
  } as never);
102
- const writeConfig = spyOn(
103
- hatchConfig,
104
- "writeInitialConfig",
105
- ).mockImplementation(() => "/config-path");
106
101
  let saved: { assistantId: string; hatchedAt?: string } | undefined;
107
102
  const findEntry = spyOn(lookup, "findAssistantByName").mockImplementation(
108
103
  () => (saved ?? null) as never,
@@ -126,7 +121,6 @@ test("a fresh local target writes config, installs the archive, then persists",
126
121
  expect(result.assistantId).toBe("fresh-local");
127
122
  expect(result.hatchedAt).toBeDefined();
128
123
  expect(withLock).toHaveBeenCalledTimes(1);
129
- expect(writeConfig).toHaveBeenCalledTimes(1);
130
124
  expect(localArchive).toHaveBeenCalledWith(
131
125
  expect.objectContaining({ assistantId: "fresh-local" }),
132
126
  "/backups/source-pre-teleport.tar.gz",
@@ -140,7 +134,6 @@ test("a fresh local target writes config, installs the archive, then persists",
140
134
  for (const spy of [
141
135
  withLock,
142
136
  placement,
143
- writeConfig,
144
137
  findEntry,
145
138
  localArchive,
146
139
  localSave,
@@ -23,11 +23,8 @@ export {
23
23
  export { stageBasetenBuildContext } from "./remotes/baseten/context";
24
24
  export { execBasetenSandbox } from "./remotes/baseten/exec";
25
25
  export { localExecDirForService } from "./remotes/local/exec";
26
- export { ensureLocalBinShims } from "./remotes/local/exec";
27
- export {
28
- DEFAULT_EXEC_TIMEOUT,
29
- execCommand,
30
- } from "./operations/exec";
26
+ export { ensureLocalBinShims } from "./remotes/local/common";
27
+ export { DEFAULT_EXEC_TIMEOUT, execCommand } from "./operations/exec";
31
28
  export {
32
29
  appleContainerPair,
33
30
  execAppleContainer,
@@ -51,10 +48,7 @@ export type {
51
48
  ResolvedManagedAssistant,
52
49
  } from "./remotes/cloud/exec";
53
50
  export { RemoteExecTimeoutError } from "./remotes/cloud/exec";
54
- export type {
55
- ExecCommandOptions,
56
- ExecCommandResult,
57
- } from "./operations/exec";
51
+ export type { ExecCommandOptions, ExecCommandResult } from "./operations/exec";
58
52
  export { createBackup, formatSize } from "./backup-ops";
59
53
 
60
54
  export { type ManagedProcessEntry } from "./daemon-readiness";