@termhub/agent 0.1.6 → 0.1.7

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 (2) hide show
  1. package/dist/cli.js +16 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -490,14 +490,26 @@ function buildPasteScript(name) {
490
490
  }
491
491
 
492
492
  // ../../packages/machine-ops/dist/ai-credentials.js
493
+ var CREDENTIAL_SEPARATOR = "---termhub-credential---";
493
494
  function credentialScript(provider) {
494
495
  switch (provider) {
495
496
  case "claude":
496
497
  return [
497
- `if [ -f "$D/.credentials.json" ]; then cat "$D/.credentials.json"`,
498
- `elif [ "$(uname -s)" = Darwin ]; then security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null || true`,
498
+ `SEP=${shellQuote(CREDENTIAL_SEPARATOR)}`,
499
+ // 1. the on-disk copy (Linux, and macOS when the keychain entry is missing/disabled)
500
+ `if [ -f "$D/.credentials.json" ]; then cat "$D/.credentials.json" 2>/dev/null || true; fi`,
501
+ `printf '\\n%s\\n' "$SEP"`,
502
+ `if [ "$(uname -s 2>/dev/null)" = Darwin ]; then`,
503
+ ` D=\${D%/}`,
504
+ // 2a. the per-config-dir keychain item (CLAUDE_CONFIG_DIR accounts)
505
+ ` H=$(printf %s "$D" | shasum -a 256 2>/dev/null | cut -c1-8) || true`,
506
+ ` if [ -n "$H" ]; then security find-generic-password -s "Claude Code-credentials-$H" -w 2>/dev/null || true; fi`,
507
+ ` printf '\\n%s\\n' "$SEP"`,
508
+ // 2b. the unsuffixed item, only for the default dir (it belongs to a different account otherwise)
509
+ ` if [ "$D" = "$HOME/.claude" ]; then security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null || true; fi`,
510
+ ` printf '\\n%s\\n' "$SEP"`,
499
511
  `fi`
500
- ].join("; ");
512
+ ].join("\n");
501
513
  case "chatgpt":
502
514
  return `if [ -f "$D/auth.json" ]; then cat "$D/auth.json"; fi`;
503
515
  case "gemini":
@@ -1242,7 +1254,7 @@ async function status(deps = {}) {
1242
1254
  }
1243
1255
 
1244
1256
  // src/version.ts
1245
- var AGENT_VERSION = "0.1.6";
1257
+ var AGENT_VERSION = "0.1.7";
1246
1258
 
1247
1259
  // src/run.ts
1248
1260
  function detectOs(platform = process.platform) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@termhub/agent",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Agente do termhub: conecta esta máquina ao servidor por WebSocket de saída (sem SSH) e expõe os terminais tmux no navegador.",
5
5
  "license": "MIT",
6
6
  "private": false,