@themoltnet/pi-extension 0.24.1 → 0.26.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 +6 -0
- package/dist/index.js +66 -26
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -505,6 +505,12 @@ export declare interface PiTaskExecutionPlan {
|
|
|
505
505
|
* worktree is required.
|
|
506
506
|
*/
|
|
507
507
|
worktreeBranch: string | null;
|
|
508
|
+
/**
|
|
509
|
+
* Base ref a NEW `worktreeBranch` is cut from. Used by `fork` continuations
|
|
510
|
+
* to branch from the parent's tip instead of the default (main/HEAD). Ignored
|
|
511
|
+
* when `worktreeBranch` already exists.
|
|
512
|
+
*/
|
|
513
|
+
worktreeBaseRef?: string | null;
|
|
508
514
|
/**
|
|
509
515
|
* Lifetime of the task workspace from the daemon's point of view.
|
|
510
516
|
* `attempt` = disposable; `session` = keep stable for the reuse key.
|
package/dist/index.js
CHANGED
|
@@ -7781,9 +7781,7 @@ function createMoltNetTools(config) {
|
|
|
7781
7781
|
Type.Literal("episodic"),
|
|
7782
7782
|
Type.Literal("semantic"),
|
|
7783
7783
|
Type.Literal("procedural"),
|
|
7784
|
-
Type.Literal("reflection")
|
|
7785
|
-
Type.Literal("identity"),
|
|
7786
|
-
Type.Literal("soul")
|
|
7784
|
+
Type.Literal("reflection")
|
|
7787
7785
|
]), { description: "Scope the tag count to these entry types" }))
|
|
7788
7786
|
}),
|
|
7789
7787
|
async execute(_id, params) {
|
|
@@ -7822,7 +7820,7 @@ function createMoltNetTools(config) {
|
|
|
7822
7820
|
description: "Tags to exclude — entry must have NONE of these. Max 20.",
|
|
7823
7821
|
maxItems: 20
|
|
7824
7822
|
})),
|
|
7825
|
-
entryType: Type.Optional(Type.String({ description: "Filter by entry type (procedural, semantic, episodic, reflection
|
|
7823
|
+
entryType: Type.Optional(Type.String({ description: "Filter by entry type (procedural, semantic, episodic, reflection)." })),
|
|
7826
7824
|
taskFilter: Type.Optional(Type.Object({
|
|
7827
7825
|
taskId: Type.Optional(Type.String()),
|
|
7828
7826
|
taskType: Type.Optional(Type.String()),
|
|
@@ -7923,8 +7921,8 @@ function createMoltNetTools(config) {
|
|
|
7923
7921
|
maxItems: 20
|
|
7924
7922
|
})),
|
|
7925
7923
|
entryTypes: Type.Optional(Type.Array(Type.String(), {
|
|
7926
|
-
description: "Restrict to these entry types (procedural, semantic, episodic, reflection
|
|
7927
|
-
maxItems:
|
|
7924
|
+
description: "Restrict to these entry types (procedural, semantic, episodic, reflection). Max 4.",
|
|
7925
|
+
maxItems: 4
|
|
7928
7926
|
})),
|
|
7929
7927
|
taskFilter: Type.Optional(Type.Object({
|
|
7930
7928
|
taskId: Type.Optional(Type.String()),
|
|
@@ -13482,6 +13480,54 @@ function validateRubricWeights(rubric) {
|
|
|
13482
13480
|
return null;
|
|
13483
13481
|
}
|
|
13484
13482
|
//#endregion
|
|
13483
|
+
//#region ../tasks/src/runtime-models.ts
|
|
13484
|
+
/**
|
|
13485
|
+
* Runtime model catalog: a list of supported provider/model couples that
|
|
13486
|
+
* MoltNet daemons can target. Backed by the `runtime_models` table.
|
|
13487
|
+
*
|
|
13488
|
+
* Scope is intrinsic to the row:
|
|
13489
|
+
* - `teamId == null` => global entry (MoltNet-seeded, read-only to most callers)
|
|
13490
|
+
* - `teamId != null` => team-owned custom entry
|
|
13491
|
+
*
|
|
13492
|
+
* The REST API exposes a single shape regardless of scope; the team header
|
|
13493
|
+
* gates which rows are returned.
|
|
13494
|
+
*/
|
|
13495
|
+
var RuntimeModelProvider = String$1({
|
|
13496
|
+
minLength: 1,
|
|
13497
|
+
maxLength: 100,
|
|
13498
|
+
pattern: "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$"
|
|
13499
|
+
});
|
|
13500
|
+
var RuntimeModelName = String$1({
|
|
13501
|
+
minLength: 1,
|
|
13502
|
+
maxLength: 200,
|
|
13503
|
+
pattern: "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
|
|
13504
|
+
});
|
|
13505
|
+
var RuntimeModelCapabilities = Record(String$1({
|
|
13506
|
+
minLength: 1,
|
|
13507
|
+
maxLength: 64
|
|
13508
|
+
}), Union([
|
|
13509
|
+
Boolean$1(),
|
|
13510
|
+
Number$1(),
|
|
13511
|
+
String$1({ maxLength: 256 })
|
|
13512
|
+
]));
|
|
13513
|
+
_Object_({
|
|
13514
|
+
id: String$1({ format: "uuid" }),
|
|
13515
|
+
teamId: Union([String$1({ format: "uuid" }), Null()]),
|
|
13516
|
+
provider: RuntimeModelProvider,
|
|
13517
|
+
model: RuntimeModelName,
|
|
13518
|
+
displayName: Union([String$1({ maxLength: 200 }), Null()]),
|
|
13519
|
+
description: Union([String$1({ maxLength: 4096 }), Null()]),
|
|
13520
|
+
capabilities: RuntimeModelCapabilities,
|
|
13521
|
+
isActive: Boolean$1(),
|
|
13522
|
+
createdByAgentId: Union([String$1({ format: "uuid" }), Null()]),
|
|
13523
|
+
createdByHumanId: Union([String$1({ format: "uuid" }), Null()]),
|
|
13524
|
+
createdAt: String$1({ format: "date-time" }),
|
|
13525
|
+
updatedAt: String$1({ format: "date-time" })
|
|
13526
|
+
}, {
|
|
13527
|
+
$id: "RuntimeModel",
|
|
13528
|
+
additionalProperties: false
|
|
13529
|
+
});
|
|
13530
|
+
//#endregion
|
|
13485
13531
|
//#region ../tasks/src/runtime-profiles.ts
|
|
13486
13532
|
var RuntimeProfileName = String$1({
|
|
13487
13533
|
minLength: 1,
|
|
@@ -14022,20 +14068,17 @@ var FreeformOutput = _Object_({
|
|
|
14022
14068
|
* 3. `freeform.sourceAttemptNotCompleted` — named attempt is missing
|
|
14023
14069
|
* or not in `completed` state; warm continuation only makes sense
|
|
14024
14070
|
* once the parent has produced a terminal output.
|
|
14025
|
-
* 4. `freeform.
|
|
14026
|
-
* surface for copy-on-write continuation tracked in #1293; v1
|
|
14027
|
-
* rejects it server-side so daemons never have to branch.
|
|
14028
|
-
* 5. `freeform.executionWorkspaceNotInheritable` — caller set
|
|
14071
|
+
* 4. `freeform.executionWorkspaceNotInheritable` — caller set
|
|
14029
14072
|
* `execution.workspace` together with `continueFrom`. Workspace
|
|
14030
14073
|
* mode for a continuation is inherited from the parent slot
|
|
14031
14074
|
* (`maybeAttachWarmSlotContext` forces `dedicated_worktree` +
|
|
14032
14075
|
* the parent's worktreeBranch), so any caller-supplied override
|
|
14033
14076
|
* is silently dropped at the daemon plan stage. Reject explicitly
|
|
14034
14077
|
* so misconfiguration surfaces at create time.
|
|
14035
|
-
*
|
|
14078
|
+
* 5. `freeform.sourceNotResumeEligible` — `daemonState` is null or
|
|
14036
14079
|
* `slotResumableUntil` is null. Older completions (pre-#1287) and
|
|
14037
14080
|
* daemons that opt out fall here.
|
|
14038
|
-
*
|
|
14081
|
+
* 6. `freeform.sourceResumeExpired` — `slotResumableUntil` is in the
|
|
14039
14082
|
* past; the warm slot's TTL has elapsed and no daemon is
|
|
14040
14083
|
* guaranteed to still hold it.
|
|
14041
14084
|
*
|
|
@@ -14056,11 +14099,6 @@ async function validateFreeformInputAsync(input, ctx) {
|
|
|
14056
14099
|
message: `Source task type '${source.taskType}' is not continuable; only freeform → freeform is supported in v1`,
|
|
14057
14100
|
code: "freeform.sourceTaskTypeNotSupported"
|
|
14058
14101
|
}];
|
|
14059
|
-
if (cf.mode === "fork") return [{
|
|
14060
|
-
field: "input/continueFrom/mode",
|
|
14061
|
-
message: "fork mode not yet implemented; see https://github.com/getlarge/themoltnet/issues/1293",
|
|
14062
|
-
code: "freeform.forkModeNotImplemented"
|
|
14063
|
-
}];
|
|
14064
14102
|
if (input.execution?.workspace) return [{
|
|
14065
14103
|
field: "input/execution/workspace",
|
|
14066
14104
|
message: "execution.workspace is inherited from the parent slot when continueFrom is set; omit it",
|
|
@@ -18552,8 +18590,8 @@ function buildJudgePackUserPrompt(input, ctx) {
|
|
|
18552
18590
|
" to the array of source entry IDs (max 50). Do NOT call",
|
|
18553
18591
|
" `moltnet_get_entry` per entry. For each returned entry, classify as",
|
|
18554
18592
|
" REQUIRED-SIGNED or OPTIONAL using this rule:",
|
|
18555
|
-
" • REQUIRED-SIGNED iff `entryType` is `
|
|
18556
|
-
"
|
|
18593
|
+
" • REQUIRED-SIGNED iff `entryType` is `procedural` AND `tags`",
|
|
18594
|
+
" contains `risk:high`.",
|
|
18557
18595
|
" • All others (`episodic`, `reflection`, unsigned `semantic`,",
|
|
18558
18596
|
" `procedural` with `risk:low`/`risk:medium`/no risk tag) are",
|
|
18559
18597
|
" OPTIONAL — DO NOT penalize when unsigned.",
|
|
@@ -23215,10 +23253,11 @@ function prepareTaskWorkspace(task, requestedMountPath, executionPlan) {
|
|
|
23215
23253
|
const relMount = relative(mainRepo, requestedMountPath);
|
|
23216
23254
|
const cwdPath = relMount === "" || relMount.startsWith("..") ? worktreeDir : join(worktreeDir, relMount);
|
|
23217
23255
|
const keepWorkspace = executionPlan?.workspaceScope === "session" && executionPlan.sessionKey !== null;
|
|
23218
|
-
|
|
23256
|
+
const baseRefOverride = executionPlan?.worktreeBaseRef ?? null;
|
|
23257
|
+
if (keepWorkspace) ensureReusableTaskWorktree(mainRepo, worktreeDir, branch, baseRefOverride);
|
|
23219
23258
|
else {
|
|
23220
23259
|
removeExistingTaskWorktree(mainRepo, worktreeDir);
|
|
23221
|
-
addTaskWorktree(mainRepo, worktreeDir, branch);
|
|
23260
|
+
addTaskWorktree(mainRepo, worktreeDir, branch, baseRefOverride);
|
|
23222
23261
|
}
|
|
23223
23262
|
return {
|
|
23224
23263
|
mountPath: mainRepo,
|
|
@@ -23243,14 +23282,15 @@ function resolveTaskWorktreePath(mainRepo, workspaceId) {
|
|
|
23243
23282
|
function resolveTaskScratchPath(mainRepo, workspaceId) {
|
|
23244
23283
|
return join(mainRepo, ".moltnet", "d", "task-workspaces", workspaceId);
|
|
23245
23284
|
}
|
|
23246
|
-
function ensureReusableTaskWorktree(mainRepo, worktreeDir, branch) {
|
|
23285
|
+
function ensureReusableTaskWorktree(mainRepo, worktreeDir, branch, baseRefOverride = null) {
|
|
23247
23286
|
if (isRegisteredWorktree(mainRepo, worktreeDir)) return;
|
|
23248
23287
|
if (existsSync(worktreeDir)) throw new Error(`Expected reusable worktree ${worktreeDir} to be git-managed, but it exists outside git worktree metadata.`);
|
|
23249
|
-
addTaskWorktree(mainRepo, worktreeDir, branch);
|
|
23288
|
+
addTaskWorktree(mainRepo, worktreeDir, branch, baseRefOverride);
|
|
23250
23289
|
}
|
|
23251
|
-
function addTaskWorktree(mainRepo, worktreeDir, branch) {
|
|
23252
|
-
const
|
|
23253
|
-
|
|
23290
|
+
function addTaskWorktree(mainRepo, worktreeDir, branch, baseRefOverride = null) {
|
|
23291
|
+
const branchExists = gitRefExists(mainRepo, `refs/heads/${branch}`);
|
|
23292
|
+
const baseRef = baseRefOverride ?? resolveWorktreeBaseRef(mainRepo);
|
|
23293
|
+
execFileSync("git", branchExists ? [
|
|
23254
23294
|
"-C",
|
|
23255
23295
|
mainRepo,
|
|
23256
23296
|
"worktree",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/pi-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.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
|
"keywords": [
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@earendil-works/gondolin": "^0.9.1",
|
|
37
37
|
"@opentelemetry/api": "^1.9.0",
|
|
38
38
|
"typebox": "^1.2.8",
|
|
39
|
-
"@themoltnet/
|
|
40
|
-
"@themoltnet/
|
|
39
|
+
"@themoltnet/sdk": "0.108.0",
|
|
40
|
+
"@themoltnet/agent-runtime": "0.26.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@earendil-works/pi-coding-agent": ">=0.74.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@earendil-works/pi-ai": "^0.74.0",
|
|
56
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
56
|
+
"@earendil-works/pi-coding-agent": "^0.79.4",
|
|
57
57
|
"@opentelemetry/sdk-metrics": "^2.5.1",
|
|
58
58
|
"@opentelemetry/sdk-trace-base": "^2.5.1",
|
|
59
59
|
"@types/node": "^22.19.0",
|