amalgm 0.1.67 → 0.1.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalgm",
3
- "version": "0.1.67",
3
+ "version": "0.1.68",
4
4
  "description": "Amalgm local computer runtime: login, MCP, chat, events, previews, and tunnels.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -203,6 +203,9 @@ function runtimeEnv(contract, baseEnv = process.env) {
203
203
  env.CLAUDE_CONFIG_DIR = contract.auth.runtimeHome;
204
204
  env.OPENCODE_HOME = contract.auth.runtimeHome;
205
205
  env.OPENCODE_CONFIG_DIR = contract.auth.runtimeHome;
206
+ if (contract.harness === 'claude_code' && contract.authMethod === 'provider_auth') {
207
+ delete env.CLAUDE_CONFIG_DIR;
208
+ }
206
209
  }
207
210
  env.IS_SANDBOX = '1';
208
211
  if (baseEnv.AMALGM_RUNTIME_TOKEN) env.AMALGM_RUNTIME_TOKEN = baseEnv.AMALGM_RUNTIME_TOKEN;
@@ -84,7 +84,7 @@ test('claude provider auth uses a pinned CLI home with native config copied sepa
84
84
  });
85
85
 
86
86
  assert.equal(env.HOME, envelope.runtimeHome);
87
- assert.equal(env.CLAUDE_CONFIG_DIR, envelope.runtimeHome);
87
+ assert.equal(env.CLAUDE_CONFIG_DIR, undefined);
88
88
  assert.equal(env.ANTHROPIC_API_KEY, undefined);
89
89
  });
90
90
 
@@ -196,3 +196,23 @@ test('claude native sync skips debug symlinks', () => {
196
196
  assert.equal(fs.existsSync(path.join(runtimeHome, 'debug', 'latest')), false);
197
197
  });
198
198
  });
199
+
200
+ test('claude native sync links native keychains on macOS', () => {
201
+ withNativeHome((home) => {
202
+ const source = path.join(home, '.claude');
203
+ fs.mkdirSync(source, { recursive: true });
204
+ fs.writeFileSync(path.join(source, 'settings.json'), '{"hooks":{}}');
205
+ fs.mkdirSync(path.join(home, 'Library', 'Keychains'), { recursive: true });
206
+
207
+ const runtimeHome = path.join(home, 'runtime-home');
208
+ syncClaudeNativeConfig(runtimeHome);
209
+
210
+ const keychains = path.join(runtimeHome, 'Library', 'Keychains');
211
+ if (process.platform === 'darwin') {
212
+ assert.equal(fs.lstatSync(keychains).isSymbolicLink(), true);
213
+ assert.equal(fs.realpathSync(keychains), fs.realpathSync(path.join(home, 'Library', 'Keychains')));
214
+ } else {
215
+ assert.equal(fs.existsSync(keychains), false);
216
+ }
217
+ });
218
+ });
@@ -120,6 +120,28 @@ function removeOutboundSymlink(root, relativePath) {
120
120
  }
121
121
  }
122
122
 
123
+ function ensureNativeKeychainAlias(runtimeHome) {
124
+ if (process.platform !== 'darwin' || !runtimeHome) return false;
125
+ const source = path.join(nativeHome(), 'Library', 'Keychains');
126
+ if (!exists(source)) return false;
127
+ const target = path.join(runtimeHome, 'Library', 'Keychains');
128
+ try {
129
+ const stat = fs.lstatSync(target);
130
+ if (stat.isSymbolicLink()) {
131
+ const linkTarget = fs.readlinkSync(target);
132
+ if (path.resolve(path.dirname(target), linkTarget) === path.resolve(source)) return true;
133
+ }
134
+ fs.rmSync(target, { recursive: true, force: true });
135
+ } catch {}
136
+ fs.mkdirSync(path.dirname(target), { recursive: true });
137
+ try {
138
+ fs.symlinkSync(source, target, 'dir');
139
+ return true;
140
+ } catch {
141
+ return false;
142
+ }
143
+ }
144
+
123
145
  function nativeHome() {
124
146
  return process.env.AMALGM_NATIVE_HOME || os.homedir();
125
147
  }
@@ -199,6 +221,7 @@ function syncClaudeNativeConfig(runtimeHome) {
199
221
  removeOutboundSymlink(runtimeHome, path.join('debug', 'latest'));
200
222
  const copied = copyConfigTree(sourceDir, runtimeHome);
201
223
  ensureHomeAlias(runtimeHome, '.claude');
224
+ ensureNativeKeychainAlias(runtimeHome);
202
225
  copyFileIfPresent(path.join(home, '.claude.json'), path.join(runtimeHome, '.claude.json'));
203
226
  copyConfigTree(path.join(home, '.config', 'claude'), path.join(runtimeHome, '.config', 'claude'));
204
227
  return copied ? { sourceDir, runtimeHome } : null;
@@ -259,6 +282,7 @@ module.exports = {
259
282
  copyConfigTree,
260
283
  copyDirBounded,
261
284
  copyFileIfPresent,
285
+ ensureNativeKeychainAlias,
262
286
  ensureHomeAlias,
263
287
  shouldCopyConfigPath,
264
288
  },