@q-agent/agent 0.1.15 → 0.1.17

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/src/runner.js +19 -1
  2. package/package.json +1 -1
@@ -1018,6 +1018,21 @@ async function processAuthoringJob(cfg, job) {
1018
1018
  // file (avoids a huge argv); task prompt via stdin.
1019
1019
  const systemFile = path.join(workDir, "system-prompt.txt");
1020
1020
  fs.writeFileSync(systemFile, job.systemPrompt, "utf-8");
1021
+ // Use the app's saved Claude credential (shipped in the claim) so we don't
1022
+ // need a separate `claude login` on this machine. Write it locked-down into
1023
+ // the temp workspace (removed with workDir); empty ⇒ fall back to the agent's
1024
+ // own login (no CLAUDE_CONFIG_DIR override).
1025
+ let claudeConfigDir = "";
1026
+ if (job.claudeCredentials) {
1027
+ claudeConfigDir = path.join(workDir, ".claude-config");
1028
+ fs.mkdirSync(claudeConfigDir, { recursive: true });
1029
+ const credFile = path.join(claudeConfigDir, ".credentials.json");
1030
+ fs.writeFileSync(credFile, job.claudeCredentials, "utf-8");
1031
+ try {
1032
+ fs.chmodSync(credFile, 0o600);
1033
+ }
1034
+ catch { /* best-effort on Windows */ }
1035
+ }
1021
1036
  // On Windows `claude` is a .cmd shim, which Node can only launch via a shell;
1022
1037
  // quote the path-bearing args there. On POSIX we spawn without a shell.
1023
1038
  const useShell = process.platform === "win32";
@@ -1032,9 +1047,12 @@ async function processAuthoringJob(cfg, job) {
1032
1047
  "--add-dir", q(workDir),
1033
1048
  "--max-budget-usd", String(job.maxBudgetUsd),
1034
1049
  ];
1050
+ const claudeEnv = { ...process.env, BU_CDP_URL: `http://127.0.0.1:${port}` };
1051
+ if (claudeConfigDir)
1052
+ claudeEnv.CLAUDE_CONFIG_DIR = claudeConfigDir;
1035
1053
  claude = (0, child_process_1.spawn)("claude", claudeArgs, {
1036
1054
  cwd: workDir,
1037
- env: { ...process.env, BU_CDP_URL: `http://127.0.0.1:${port}` },
1055
+ env: claudeEnv,
1038
1056
  stdio: ["pipe", "pipe", "pipe"],
1039
1057
  shell: useShell,
1040
1058
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q-agent/agent",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Q-Agent Local Agent — claims execution jobs from the Q-Agent server and runs Playwright locally, so manual login/MFA happens on the user's own machine and session credentials never leave it.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {