@themoltnet/pi-extension 0.12.0 → 0.13.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.
- package/dist/index.d.ts +13 -7
- package/dist/index.js +23 -8
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BashOperations } from '@
|
|
1
|
+
import { BashOperations } from '@earendil-works/pi-coding-agent';
|
|
2
2
|
import { connect } from '@themoltnet/sdk';
|
|
3
|
-
import { EditOperations } from '@
|
|
4
|
-
import { ExtensionAPI } from '@
|
|
5
|
-
import { ReadOperations } from '@
|
|
3
|
+
import { EditOperations } from '@earendil-works/pi-coding-agent';
|
|
4
|
+
import { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
5
|
+
import { ReadOperations } from '@earendil-works/pi-coding-agent';
|
|
6
6
|
import { Static } from '@sinclair/typebox';
|
|
7
7
|
import { TArray } from '@sinclair/typebox';
|
|
8
8
|
import { TBoolean } from '@sinclair/typebox';
|
|
@@ -11,14 +11,14 @@ import { TLiteral } from '@sinclair/typebox';
|
|
|
11
11
|
import { TNull } from '@sinclair/typebox';
|
|
12
12
|
import { TNumber } from '@sinclair/typebox';
|
|
13
13
|
import { TObject } from '@sinclair/typebox';
|
|
14
|
-
import { ToolDefinition } from '@
|
|
14
|
+
import { ToolDefinition } from '@earendil-works/pi-coding-agent';
|
|
15
15
|
import { TOptional } from '@sinclair/typebox';
|
|
16
16
|
import { TRecord } from '@sinclair/typebox';
|
|
17
17
|
import { TString } from '@sinclair/typebox';
|
|
18
18
|
import { TUnion } from '@sinclair/typebox';
|
|
19
19
|
import { TUnknown } from '@sinclair/typebox';
|
|
20
20
|
import { VM } from '@earendil-works/gondolin';
|
|
21
|
-
import { WriteOperations } from '@
|
|
21
|
+
import { WriteOperations } from '@earendil-works/pi-coding-agent';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Apply agent env vars to the host process, mirroring `moltnet start`.
|
|
@@ -426,7 +426,13 @@ export declare interface VmConfig {
|
|
|
426
426
|
export declare interface VmCredentials {
|
|
427
427
|
moltnetJson: string;
|
|
428
428
|
agentEnvRaw: string;
|
|
429
|
-
|
|
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
|
@@ -2,12 +2,12 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
|
|
4
4
|
import path, { join } from "node:path";
|
|
5
|
-
import { DefaultResourceLoader, SessionManager, createAgentSession, createBashTool, createBashToolDefinition, createEditTool, createEditToolDefinition, createReadTool, createReadToolDefinition, createWriteTool, createWriteToolDefinition, defineTool } from "@
|
|
5
|
+
import { DefaultResourceLoader, SessionManager, createAgentSession, createBashTool, createBashToolDefinition, createEditTool, createEditToolDefinition, createReadTool, createReadToolDefinition, createWriteTool, createWriteToolDefinition, defineTool } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import crypto, { createHash as createHash$1 } from "crypto";
|
|
8
8
|
import { readFile } from "node:fs/promises";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
|
-
import { Type, getModel } from "@
|
|
10
|
+
import { Type, getModel } from "@earendil-works/pi-ai";
|
|
11
11
|
import { RealFSProvider, ShadowProvider, VM, VmCheckpoint, createHttpHooks, createShadowPathPredicate, ensureImageSelector, loadGuestAssets } from "@earendil-works/gondolin";
|
|
12
12
|
import { parseEnv } from "node:util";
|
|
13
13
|
import { SpanStatusCode, context, metrics, trace } from "@opentelemetry/api";
|
|
@@ -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
|
-
|
|
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.
|
|
3
|
+
"version": "0.13.1",
|
|
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,24 +31,24 @@
|
|
|
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.
|
|
34
|
+
"@themoltnet/agent-runtime": "0.10.0",
|
|
35
35
|
"@themoltnet/sdk": "0.98.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
38
|
+
"@earendil-works/pi-coding-agent": ">=0.74.0",
|
|
39
|
+
"@earendil-works/pi-ai": ">=0.74.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
|
-
"@
|
|
42
|
+
"@earendil-works/pi-coding-agent": {
|
|
43
43
|
"optional": false
|
|
44
44
|
},
|
|
45
|
-
"@
|
|
45
|
+
"@earendil-works/pi-ai": {
|
|
46
46
|
"optional": false
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
50
|
+
"@earendil-works/pi-ai": "^0.74.0",
|
|
51
|
+
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
52
52
|
"@opentelemetry/sdk-metrics": "^2.5.1",
|
|
53
53
|
"@opentelemetry/sdk-trace-base": "^2.5.1",
|
|
54
54
|
"@types/node": "^20.11.0",
|