@themoltnet/pi-extension 0.19.1 → 0.19.3
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 +9 -0
- package/dist/index.js +110 -7
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -507,6 +507,10 @@ export declare interface PiTaskExecutionPlan {
|
|
|
507
507
|
* inspection by applying VFS shadowing on top of the mounted path.
|
|
508
508
|
*/
|
|
509
509
|
workspaceAttachment?: PiWorkspaceAttachmentPlan | null;
|
|
510
|
+
/**
|
|
511
|
+
* Optional seed content for a freshly created scratch workspace.
|
|
512
|
+
*/
|
|
513
|
+
workspaceSeed?: PiWorkspaceSeedPlan | null;
|
|
510
514
|
/**
|
|
511
515
|
* Optional location for file-backed Pi session history. When omitted,
|
|
512
516
|
* the executor keeps the conversation in memory for this attempt only.
|
|
@@ -522,6 +526,11 @@ declare interface PiWorkspaceAttachmentPlan {
|
|
|
522
526
|
shadowWrites?: 'deny' | 'tmpfs';
|
|
523
527
|
}
|
|
524
528
|
|
|
529
|
+
declare interface PiWorkspaceSeedPlan {
|
|
530
|
+
copyFromPath: string;
|
|
531
|
+
source: 'producer';
|
|
532
|
+
}
|
|
533
|
+
|
|
525
534
|
export declare function resolveTaskWorktreePath(mainRepo: string, workspaceId: string): string;
|
|
526
535
|
|
|
527
536
|
export declare interface ResumeCommand {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
|
|
4
|
-
import path, { join, relative } from "node:path";
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
|
|
4
|
+
import path, { join, relative, sep } from "node:path";
|
|
5
5
|
import { DefaultResourceLoader, SessionManager, createAgentSession, createBashTool, createBashToolDefinition, createEditTool, createEditToolDefinition, createReadTool, createReadToolDefinition, createSyntheticSourceInfo, createWriteTool, createWriteToolDefinition, defineTool, parseFrontmatter } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
@@ -1797,6 +1797,32 @@ var removeTeamMember = (options) => (options.client ?? client).delete({
|
|
|
1797
1797
|
...options
|
|
1798
1798
|
});
|
|
1799
1799
|
/**
|
|
1800
|
+
* Update a member role between member and manager. Requires manage_members permission.
|
|
1801
|
+
*/
|
|
1802
|
+
var updateTeamMemberRole = (options) => (options.client ?? client).patch({
|
|
1803
|
+
security: [
|
|
1804
|
+
{
|
|
1805
|
+
scheme: "bearer",
|
|
1806
|
+
type: "http"
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
name: "X-Moltnet-Session-Token",
|
|
1810
|
+
type: "apiKey"
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
in: "cookie",
|
|
1814
|
+
name: "ory_kratos_session",
|
|
1815
|
+
type: "apiKey"
|
|
1816
|
+
}
|
|
1817
|
+
],
|
|
1818
|
+
url: "/teams/{id}/members/{subjectId}",
|
|
1819
|
+
...options,
|
|
1820
|
+
headers: {
|
|
1821
|
+
"Content-Type": "application/json",
|
|
1822
|
+
...options.headers
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
/**
|
|
1800
1826
|
* List invite codes. Requires manage_members permission.
|
|
1801
1827
|
*/
|
|
1802
1828
|
var listTeamInvites = (options) => (options.client ?? client).get({
|
|
@@ -4861,6 +4887,17 @@ function createTeamsNamespace(context) {
|
|
|
4861
4887
|
}
|
|
4862
4888
|
}));
|
|
4863
4889
|
},
|
|
4890
|
+
async updateMemberRole(teamId, subjectId, role) {
|
|
4891
|
+
return unwrapResult(await updateTeamMemberRole({
|
|
4892
|
+
client,
|
|
4893
|
+
auth,
|
|
4894
|
+
path: {
|
|
4895
|
+
id: teamId,
|
|
4896
|
+
subjectId
|
|
4897
|
+
},
|
|
4898
|
+
body: { role }
|
|
4899
|
+
}));
|
|
4900
|
+
},
|
|
4864
4901
|
invites: {
|
|
4865
4902
|
async create(teamId, body) {
|
|
4866
4903
|
return unwrapResult(await createTeamInvite({
|
|
@@ -9632,7 +9669,8 @@ var PrReviewSubject = Type$1.Object({
|
|
|
9632
9669
|
var PrReviewInput = Type$1.Object({
|
|
9633
9670
|
subject: PrReviewSubject,
|
|
9634
9671
|
taskPrompt: Type$1.Optional(Type$1.String({ minLength: 1 })),
|
|
9635
|
-
successCriteria: SuccessCriteria
|
|
9672
|
+
successCriteria: SuccessCriteria,
|
|
9673
|
+
context: Type$1.Optional(TaskContext)
|
|
9636
9674
|
}, {
|
|
9637
9675
|
$id: "PrReviewInput",
|
|
9638
9676
|
additionalProperties: false
|
|
@@ -10794,7 +10832,7 @@ function buildJudgeEvalAttemptUserPrompt(input, ctx) {
|
|
|
10794
10832
|
"If the accepted attempt output lists `artifacts[].path`, treat those",
|
|
10795
10833
|
"paths as relative to the current workspace root unless the output",
|
|
10796
10834
|
"explicitly says otherwise.",
|
|
10797
|
-
ctx.workspace.mode === "dedicated_worktree" ? `This attachment is a dedicated producer worktree${ctx.workspace.branch ? ` on branch \`${ctx.workspace.branch}\`` : ""}.` : ctx.workspace.mode === "scratch_mount" ? "This
|
|
10835
|
+
ctx.workspace.mode === "dedicated_worktree" ? `This attachment is a dedicated producer worktree${ctx.workspace.branch ? ` on branch \`${ctx.workspace.branch}\`` : ""}.` : ctx.workspace.mode === "scratch_mount" ? "This workspace is a fresh judge-owned scratch copy of the producer workspace." : "This attachment is the producer shared workspace mounted with shadow writes for safe inspection.",
|
|
10798
10836
|
""
|
|
10799
10837
|
].join("\n") : "";
|
|
10800
10838
|
return [
|
|
@@ -13303,7 +13341,7 @@ var require_transport = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13303
13341
|
var { createRequire: createRequire$1 } = __require("module");
|
|
13304
13342
|
var { existsSync: existsSync$1 } = __require("node:fs");
|
|
13305
13343
|
var getCallers = require_caller();
|
|
13306
|
-
var { join: join$1, isAbsolute, sep } = __require("node:path");
|
|
13344
|
+
var { join: join$1, isAbsolute, sep: sep$1 } = __require("node:path");
|
|
13307
13345
|
var { fileURLToPath } = __require("node:url");
|
|
13308
13346
|
var sleep = require_atomic_sleep();
|
|
13309
13347
|
var onExit = require_on_exit_leak_free();
|
|
@@ -13471,7 +13509,7 @@ var require_transport = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13471
13509
|
if (origin === "pino/file") return join$1(__dirname, "..", "file.js");
|
|
13472
13510
|
let fixTarget;
|
|
13473
13511
|
for (const filePath of callers) try {
|
|
13474
|
-
fixTarget = createRequire$1(filePath === "node:repl" ? process.cwd() + sep : filePath).resolve(origin);
|
|
13512
|
+
fixTarget = createRequire$1(filePath === "node:repl" ? process.cwd() + sep$1 : filePath).resolve(origin);
|
|
13475
13513
|
break;
|
|
13476
13514
|
} catch (err) {
|
|
13477
13515
|
continue;
|
|
@@ -15469,6 +15507,8 @@ function prepareTaskWorkspace(task, requestedMountPath, executionPlan) {
|
|
|
15469
15507
|
});
|
|
15470
15508
|
mkdirSync(scratchDir, { recursive: true });
|
|
15471
15509
|
}
|
|
15510
|
+
const workspaceSeed = executionPlan?.workspaceSeed ?? null;
|
|
15511
|
+
if (workspaceSeed) copyDirectoryContents(workspaceSeed.copyFromPath, scratchDir);
|
|
15472
15512
|
return {
|
|
15473
15513
|
mountPath: scratchDir,
|
|
15474
15514
|
cwdPath: scratchDir,
|
|
@@ -15590,6 +15630,68 @@ function gitRefExists(mainRepo, ref) {
|
|
|
15590
15630
|
return false;
|
|
15591
15631
|
}
|
|
15592
15632
|
}
|
|
15633
|
+
function copyDirectoryContents(sourceDir, targetDir) {
|
|
15634
|
+
if (!existsSync(sourceDir)) throw new Error(`Workspace seed source is missing: ${sourceDir}`);
|
|
15635
|
+
if (existsSync(join(sourceDir, ".git"))) initializeScratchGitRepo(sourceDir, targetDir);
|
|
15636
|
+
const resolvedTargetDir = realpathSync(targetDir);
|
|
15637
|
+
for (const entry of readdirSync(sourceDir)) {
|
|
15638
|
+
const sourceEntry = join(sourceDir, entry);
|
|
15639
|
+
if (shouldSkipSeedEntry(sourceEntry, entry, resolvedTargetDir)) continue;
|
|
15640
|
+
cpSync(sourceEntry, join(targetDir, entry), { recursive: true });
|
|
15641
|
+
}
|
|
15642
|
+
}
|
|
15643
|
+
function initializeScratchGitRepo(sourceDir, targetDir) {
|
|
15644
|
+
execFileSync("git", [
|
|
15645
|
+
"-C",
|
|
15646
|
+
targetDir,
|
|
15647
|
+
"init"
|
|
15648
|
+
], { stdio: "pipe" });
|
|
15649
|
+
let headCommit = null;
|
|
15650
|
+
try {
|
|
15651
|
+
headCommit = execFileSync("git", [
|
|
15652
|
+
"-C",
|
|
15653
|
+
sourceDir,
|
|
15654
|
+
"rev-parse",
|
|
15655
|
+
"HEAD"
|
|
15656
|
+
], {
|
|
15657
|
+
encoding: "utf8",
|
|
15658
|
+
stdio: "pipe"
|
|
15659
|
+
}).trim();
|
|
15660
|
+
} catch {
|
|
15661
|
+
headCommit = null;
|
|
15662
|
+
}
|
|
15663
|
+
if (!headCommit) return;
|
|
15664
|
+
execFileSync("git", [
|
|
15665
|
+
"-C",
|
|
15666
|
+
targetDir,
|
|
15667
|
+
"remote",
|
|
15668
|
+
"add",
|
|
15669
|
+
"origin",
|
|
15670
|
+
sourceDir
|
|
15671
|
+
], { stdio: "pipe" });
|
|
15672
|
+
execFileSync("git", [
|
|
15673
|
+
"-C",
|
|
15674
|
+
targetDir,
|
|
15675
|
+
"fetch",
|
|
15676
|
+
"--quiet",
|
|
15677
|
+
"--depth=1",
|
|
15678
|
+
"origin",
|
|
15679
|
+
headCommit
|
|
15680
|
+
], { stdio: "pipe" });
|
|
15681
|
+
execFileSync("git", [
|
|
15682
|
+
"-C",
|
|
15683
|
+
targetDir,
|
|
15684
|
+
"checkout",
|
|
15685
|
+
"--quiet",
|
|
15686
|
+
"--detach",
|
|
15687
|
+
"FETCH_HEAD"
|
|
15688
|
+
], { stdio: "pipe" });
|
|
15689
|
+
}
|
|
15690
|
+
function shouldSkipSeedEntry(sourceEntry, entryName, resolvedTargetDir) {
|
|
15691
|
+
if (entryName === ".git") return true;
|
|
15692
|
+
const resolvedSourceEntry = realpathSync(sourceEntry);
|
|
15693
|
+
return resolvedTargetDir === resolvedSourceEntry || resolvedTargetDir.startsWith(`${resolvedSourceEntry}${sep}`);
|
|
15694
|
+
}
|
|
15593
15695
|
//#endregion
|
|
15594
15696
|
//#region src/runtime/execute-pi-task.ts
|
|
15595
15697
|
/**
|
|
@@ -15795,7 +15897,8 @@ async function executePiTask(claimedTask, reporter, opts) {
|
|
|
15795
15897
|
workspace: {
|
|
15796
15898
|
mode: activeWorkspace.mode,
|
|
15797
15899
|
branch: activeWorkspace.branch,
|
|
15798
|
-
attached: executionPlan?.workspaceAttachment !== void 0
|
|
15900
|
+
attached: executionPlan?.workspaceAttachment !== void 0 || executionPlan?.workspaceSeed?.source === "producer",
|
|
15901
|
+
source: executionPlan?.workspaceSeed?.source === "producer" ? "producer_copy" : executionPlan?.workspaceAttachment !== void 0 ? "producer_attachment" : void 0
|
|
15799
15902
|
},
|
|
15800
15903
|
extras: opts.promptExtras
|
|
15801
15904
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/pi-extension",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
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,8 +31,8 @@
|
|
|
31
31
|
"@earendil-works/gondolin": "^0.9.1",
|
|
32
32
|
"@opentelemetry/api": "^1.9.0",
|
|
33
33
|
"@sinclair/typebox": "^0.34.0",
|
|
34
|
-
"@themoltnet/
|
|
35
|
-
"@themoltnet/
|
|
34
|
+
"@themoltnet/agent-runtime": "0.18.2",
|
|
35
|
+
"@themoltnet/sdk": "0.104.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@earendil-works/pi-coding-agent": ">=0.74.0",
|