@themoltnet/pi-extension 0.12.0 → 0.13.0

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/dist/index.d.ts CHANGED
@@ -426,7 +426,13 @@ export declare interface VmConfig {
426
426
  export declare interface VmCredentials {
427
427
  moltnetJson: string;
428
428
  agentEnvRaw: string;
429
- piAuthJson: string;
429
+ /**
430
+ * Pi OAuth/API-key auth blob. Null when neither `~/.pi/agent/auth.json`
431
+ * (or its `PI_AUTH_PATH` override) is present — in that case the daemon
432
+ * relies on Pi's env-var providers (`ANTHROPIC_API_KEY`, etc.) carried
433
+ * via `agentEnv` and the host environment instead. CI uses this path.
434
+ */
435
+ piAuthJson: string | null;
430
436
  agentEnv: Record<string, string | undefined>;
431
437
  gitconfig: string | null;
432
438
  sshPrivateKey: string | null;
package/dist/index.js CHANGED
@@ -8195,9 +8195,8 @@ function findMainWorktree() {
8195
8195
  function loadCredentials(agentDir) {
8196
8196
  const moltnetJson = readFileSync(path.join(agentDir, "moltnet.json"), "utf8");
8197
8197
  const agentEnvRaw = readFileSync(path.join(agentDir, "env"), "utf8");
8198
- const piAuthPath = path.join(process.env.HOME ?? "", ".pi", "agent", "auth.json");
8199
- if (!existsSync(piAuthPath)) throw new Error(`Pi OAuth credentials not found at ${piAuthPath}. Run: pi login`);
8200
- const piAuthJson = readFileSync(piAuthPath, "utf8");
8198
+ const piAuthPath = process.env.PI_AUTH_PATH ?? path.join(process.env.HOME ?? "", ".pi", "agent", "auth.json");
8199
+ const piAuthJson = existsSync(piAuthPath) ? readFileSync(piAuthPath, "utf8") : null;
8201
8200
  const gitconfigPath = path.join(agentDir, "gitconfig");
8202
8201
  const gitconfig = existsSync(gitconfigPath) ? readFileSync(gitconfigPath, "utf8") : null;
8203
8202
  const sshDir = path.join(agentDir, "ssh");
@@ -8315,7 +8314,7 @@ async function resumeVm(config) {
8315
8314
  nameserver 1.1.1.1" > /etc/resolv.conf'`);
8316
8315
  const vmSshDir = `${vmAgentDir}/ssh`;
8317
8316
  await vm.exec(`mkdir -p ${vmAgentDir}/ssh /home/agent/.pi/agent`);
8318
- await vm.fs.writeFile("/home/agent/.pi/agent/auth.json", creds.piAuthJson, { mode: 384 });
8317
+ if (creds.piAuthJson !== null) await vm.fs.writeFile("/home/agent/.pi/agent/auth.json", creds.piAuthJson, { mode: 384 });
8319
8318
  const vmMoltnetJson = rewriteMoltnetJsonPaths(creds.moltnetJson, vmAgentDir, vmSshDir, creds.githubAppPemFilename);
8320
8319
  await vm.fs.writeFile(`${vmAgentDir}/moltnet.json`, vmMoltnetJson, { mode: 384 });
8321
8320
  await vm.fs.writeFile(`${vmAgentDir}/env`, creds.agentEnvRaw, { mode: 384 });
@@ -9853,7 +9852,21 @@ function buildFulfillBriefPrompt(input, ctx) {
9853
9852
  ...seedFiles.map((f) => `- \`${f}\``),
9854
9853
  ""
9855
9854
  ].join("\n") : "";
9856
- const branchSlug = scopeHint ? `feat/${scopeHint}-` : "feat/";
9855
+ const branchSlug = ctx.correlationId ? `moltnet/${ctx.correlationId}/` : scopeHint ? `feat/${scopeHint}-` : "feat/";
9856
+ const correlationSection = ctx.correlationId ? [
9857
+ "### Correlation",
9858
+ "",
9859
+ `This task carries correlationId \`${ctx.correlationId}\`. You MUST:`,
9860
+ "",
9861
+ `1. Name your branch \`moltnet/${ctx.correlationId}/<short-slug>\` — use a`,
9862
+ " slug derived from the brief title (lowercase-kebab, ≤60 chars).",
9863
+ `2. Include the trailer \`Moltnet-Correlation-Id: ${ctx.correlationId}\` on`,
9864
+ " your **first** commit on that branch (subsequent commits do not need it).",
9865
+ "",
9866
+ "These are recovery anchors for the MoltNet mention-bot. Do not deviate",
9867
+ "from this branch naming scheme when correlationId is set.",
9868
+ ""
9869
+ ].join("\n") : "";
9857
9870
  return [
9858
9871
  "# Fulfill Brief Agent",
9859
9872
  "",
@@ -9873,6 +9886,7 @@ function buildFulfillBriefPrompt(input, ctx) {
9873
9886
  "",
9874
9887
  criteriaSection,
9875
9888
  seedSection,
9889
+ correlationSection,
9876
9890
  "### Workflow",
9877
9891
  "",
9878
9892
  `1. Create a feature branch (starting prefix suggestion: \`${branchSlug}<short-slug>\`).`,
@@ -10101,7 +10115,8 @@ function buildPromptForTask(task, ctx) {
10101
10115
  }
10102
10116
  return buildFulfillBriefPrompt(task.input, {
10103
10117
  diaryId: ctx.diaryId,
10104
- taskId: ctx.taskId
10118
+ taskId: ctx.taskId,
10119
+ correlationId: task.correlationId
10105
10120
  });
10106
10121
  case ASSESS_BRIEF_TYPE:
10107
10122
  if (!Value.Check(AssessBriefInput, task.input)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@themoltnet/pi-extension",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "description": "MoltNet pi extension — sandboxed tool execution in Gondolin VMs with MoltNet identity and persistent memory",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "@earendil-works/gondolin": "^0.7.0",
32
32
  "@opentelemetry/api": "^1.9.0",
33
33
  "@sinclair/typebox": "^0.34.0",
34
- "@themoltnet/agent-runtime": "0.9.0",
34
+ "@themoltnet/agent-runtime": "0.10.0",
35
35
  "@themoltnet/sdk": "0.98.0"
36
36
  },
37
37
  "peerDependencies": {