@themoltnet/agent-daemon 0.18.0 → 0.18.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 (2) hide show
  1. package/dist/main.js +25 -13
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -32845,8 +32845,7 @@ async function resumeVm(config) {
32845
32845
  signal: config.signal
32846
32846
  });
32847
32847
  if (creds.gitconfig) {
32848
- const vmSigningKey = `${vmSshDir}/id_ed25519`;
32849
- const vmGitconfig = creds.gitconfig.replace(/signingKey\s*=\s*.+/g, `signingKey = ${vmSigningKey}`);
32848
+ const vmGitconfig = rewriteGitconfigPaths(creds.gitconfig, vmSshDir, vmAgentDir);
32850
32849
  await vm.fs.writeFile(`${vmAgentDir}/gitconfig`, vmGitconfig, {
32851
32850
  mode: 420,
32852
32851
  signal: config.signal
@@ -32869,17 +32868,6 @@ async function resumeVm(config) {
32869
32868
  signal: config.signal
32870
32869
  });
32871
32870
  await vm.exec("chown -R agent:agent /home/agent/.pi /home/agent/.moltnet", { signal: config.signal });
32872
- const gitCredHelperPath = `${vmSshDir}/git-credential-moltnet`;
32873
- const credHelperScript = `#!/bin/sh
32874
- echo "username=x-access-token"
32875
- echo "password=$(moltnet github token --credentials ${vmSshDir}/moltnet.json)"
32876
- `;
32877
- await vm.fs.writeFile(gitCredHelperPath, credHelperScript, {
32878
- mode: 493,
32879
- signal: config.signal
32880
- });
32881
- await vmRun(vm, "git credential helper", `git config --global credential.helper ${gitCredHelperPath} && \
32882
- git config --global url."https://github.com/".insteadOf "git@github.com:"`, config.signal);
32883
32871
  return {
32884
32872
  vm,
32885
32873
  credentials: creds,
@@ -32898,6 +32886,30 @@ echo "password=$(moltnet github token --credentials ${vmSshDir}/moltnet.json)"
32898
32886
  }
32899
32887
  }
32900
32888
  /**
32889
+ * Rewrite host-absolute paths inside an agent gitconfig to VM-local
32890
+ * equivalents before injecting it into the guest.
32891
+ *
32892
+ * Two rewrites:
32893
+ * - `signingKey = <host path>` → `<vmSshDir>/id_ed25519`
32894
+ * - `... credential-helper --credentials <host moltnet.json>`
32895
+ * → `<vmAgentDir>/moltnet.json`
32896
+ *
32897
+ * The credential-helper line is generated host-side by `moltnet github setup`
32898
+ * with a host-absolute `--credentials` path; inside the guest that path is
32899
+ * invalid, so it must point at the VM-side moltnet.json. The `insteadOf`
32900
+ * rewrite rule and every other line are workspace-independent and pass through
32901
+ * unchanged. A gitconfig without a credential helper is rewritten only for
32902
+ * `signingKey`.
32903
+ *
32904
+ * This is the single source of truth for git push auth in the guest: the
32905
+ * injected gitconfig carries the tokenless mint-on-demand helper, so the VM
32906
+ * no longer hand-rolls a credential-helper script or runs an imperative
32907
+ * `git config --global ... insteadOf` against the guest $HOME.
32908
+ */
32909
+ function rewriteGitconfigPaths(gitconfig, vmSshDir, vmAgentDir) {
32910
+ return gitconfig.replace(/signingKey\s*=\s*.+/g, `signingKey = ${vmSshDir}/id_ed25519`).replace(/(moltnet github credential-helper --credentials )\S+/g, `$1${vmAgentDir}/moltnet.json`);
32911
+ }
32912
+ /**
32901
32913
  * Rewrite host-absolute paths inside moltnet.json to VM-local equivalents.
32902
32914
  *
32903
32915
  * Fields rewritten:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "description": "MoltNet agent daemon — claims and executes tasks (fulfill_brief, assess_brief) from the MoltNet task-service via Pi-headless. CLI: moltnet-agent.",
@@ -45,10 +45,10 @@
45
45
  "@opentelemetry/semantic-conventions": "^1.39.0",
46
46
  "pino": "^10.3.1",
47
47
  "pino-pretty": "^13.1.3",
48
- "@themoltnet/agent-daemon-state": "0.2.0",
49
48
  "@themoltnet/agent-runtime": "0.25.0",
50
- "@themoltnet/pi-extension": "0.24.0",
51
- "@themoltnet/sdk": "0.108.0"
49
+ "@themoltnet/sdk": "0.108.0",
50
+ "@themoltnet/pi-extension": "0.24.1",
51
+ "@themoltnet/agent-daemon-state": "0.2.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "tsx": "^4.7.0",