@themoltnet/pi-runtime 0.4.0 → 0.6.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 +68 -34
- package/dist/index.js +3161 -29932
- package/package.json +15 -9
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { GrepToolInput } from '@earendil-works/pi-coding-agent';
|
|
|
14
14
|
import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
|
|
15
15
|
import { LsOperations } from '@earendil-works/pi-coding-agent';
|
|
16
16
|
import { Model } from '@earendil-works/pi-ai';
|
|
17
|
+
import { ModelRegistry } from '@earendil-works/pi-coding-agent';
|
|
17
18
|
import { Readable } from 'node:stream';
|
|
18
19
|
import { ReadOperations } from '@earendil-works/pi-coding-agent';
|
|
19
20
|
import { ShellCommandAnalyzer } from '@themoltnet/shell-command-analyzer';
|
|
@@ -69,6 +70,8 @@ declare interface BuildAgentSessionArgs {
|
|
|
69
70
|
piAuthDir: string;
|
|
70
71
|
/** Resolved pi model handle (provider + model id). */
|
|
71
72
|
modelHandle: Model<Api>;
|
|
73
|
+
/** Registry that resolved modelHandle, including custom providers/auth. */
|
|
74
|
+
modelRegistry?: ModelRegistry;
|
|
72
75
|
/** Optional runtime-profile thinking/reasoning level applied at session start. */
|
|
73
76
|
thinkingLevel?: PiThinkingLevel | null;
|
|
74
77
|
/** Optional runtime-profile sampling temperature applied to provider requests. */
|
|
@@ -189,6 +192,8 @@ export declare interface CreateSubagentToolArgs {
|
|
|
189
192
|
piAuthDir: string;
|
|
190
193
|
/** Resolved pi model handle — subagents share it. */
|
|
191
194
|
modelHandle: Model<Api>;
|
|
195
|
+
/** Registry that resolved modelHandle — subagents share it. */
|
|
196
|
+
modelRegistry?: ModelRegistry;
|
|
192
197
|
/** Runtime-profile thinking/reasoning level — subagents inherit it. */
|
|
193
198
|
thinkingLevel?: PiThinkingLevel | null;
|
|
194
199
|
/** Runtime-profile sampling temperature — subagents inherit it. */
|
|
@@ -349,10 +354,7 @@ export declare function definePiTool(options: PiToolFactoryOptions): PiToolContr
|
|
|
349
354
|
export declare function enabledPiToolNames(input: {
|
|
350
355
|
tools: readonly ToolDefinition[];
|
|
351
356
|
extensions?: readonly PiExtensionContribution[];
|
|
352
|
-
policy?:
|
|
353
|
-
enforcement: ToolEnforcement;
|
|
354
|
-
allowedTools: ReadonlySet<string>;
|
|
355
|
-
};
|
|
357
|
+
policy?: ModelVisibleToolPolicy;
|
|
356
358
|
}): string[] | undefined;
|
|
357
359
|
|
|
358
360
|
/**
|
|
@@ -496,18 +498,11 @@ export declare interface ExecutePiTaskOptions {
|
|
|
496
498
|
*/
|
|
497
499
|
maxBashTimeouts?: number;
|
|
498
500
|
/**
|
|
499
|
-
* Number of
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Number of same-session re-prompts when the model ends its turn WITHOUT
|
|
506
|
-
* calling the submit-output tool at all (no captured payload and no
|
|
507
|
-
* exhausted validation budget). Distinct from
|
|
508
|
-
* `maxSubmitValidationRetries`, which recovers *invalid-args* submit calls.
|
|
509
|
-
* Each re-prompt names the submit tool and forbids a prose reply. When the
|
|
510
|
-
* budget is spent the attempt still fails with `submit_output_missing`.
|
|
501
|
+
* Number of same-session re-prompts when the model ends its turn without a
|
|
502
|
+
* valid submit-output call. A missing call receives the ordinary submit
|
|
503
|
+
* reminder; an invalid call receives its latest validation failure. When the
|
|
504
|
+
* budget is spent the attempt fails with the latest validation error, or
|
|
505
|
+
* `submit_output_missing` if the tool was never called.
|
|
511
506
|
* Only applies to task types that register a submit tool. Default `3`. Set
|
|
512
507
|
* to `0` to disable. See #1528.
|
|
513
508
|
*/
|
|
@@ -576,10 +571,7 @@ export declare interface ExecutePiTaskOptions {
|
|
|
576
571
|
resolveVmTemplate?: () => Promise<ResolvedGondolinTemplate>;
|
|
577
572
|
}
|
|
578
573
|
|
|
579
|
-
export declare function filterModelVisibleTools(tools: readonly ToolDefinition[], policy?:
|
|
580
|
-
enforcement: ToolEnforcement;
|
|
581
|
-
allowedTools: ReadonlySet<string>;
|
|
582
|
-
}): ToolDefinition[];
|
|
574
|
+
export declare function filterModelVisibleTools(tools: readonly ToolDefinition[], policy?: ModelVisibleToolPolicy): ToolDefinition[];
|
|
583
575
|
|
|
584
576
|
/**
|
|
585
577
|
* Resolve the main worktree root (where .moltnet/ lives — it's untracked,
|
|
@@ -689,10 +681,17 @@ export declare interface InjectTaskContextArgs {
|
|
|
689
681
|
|
|
690
682
|
export declare function isKernelTool(name: string): boolean;
|
|
691
683
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
684
|
+
/**
|
|
685
|
+
* Check containment for already-resolved lexical or real paths.
|
|
686
|
+
*
|
|
687
|
+
* Callers that accept untrusted paths must resolve/realpath at their I/O
|
|
688
|
+
* boundary first; keeping the platform-specific relative-path rule here avoids
|
|
689
|
+
* subtly different `..` and absolute-path handling across runtime cleanup,
|
|
690
|
+
* session sync, and artifact staging.
|
|
691
|
+
*/
|
|
692
|
+
export declare function isResolvedPathInsideRoot(path: string, root: string): boolean;
|
|
693
|
+
|
|
694
|
+
export declare function isToolVisible(name: string, policy?: ModelVisibleToolPolicy): boolean;
|
|
696
695
|
|
|
697
696
|
export declare function loadCredentials(agentDir: string): VmCredentials;
|
|
698
697
|
|
|
@@ -714,20 +713,14 @@ export declare function materializePiExtensions(input: {
|
|
|
714
713
|
runtime: PiRuntimeDefinition;
|
|
715
714
|
context: PiToolContext;
|
|
716
715
|
target: 'parent' | 'subagent';
|
|
717
|
-
policy?:
|
|
718
|
-
enforcement: ToolEnforcement;
|
|
719
|
-
allowedTools: ReadonlySet<string>;
|
|
720
|
-
};
|
|
716
|
+
policy?: ModelVisibleToolPolicy;
|
|
721
717
|
}): Promise<PiExtensionFactory[]>;
|
|
722
718
|
|
|
723
719
|
export declare function materializePiTools(input: {
|
|
724
720
|
runtime: PiRuntimeDefinition;
|
|
725
721
|
context: PiToolContext;
|
|
726
722
|
target: 'parent' | 'subagent';
|
|
727
|
-
policy?:
|
|
728
|
-
enforcement: ToolEnforcement;
|
|
729
|
-
allowedTools: ReadonlySet<string>;
|
|
730
|
-
};
|
|
723
|
+
policy?: ModelVisibleToolPolicy;
|
|
731
724
|
}): Promise<ToolDefinition[]>;
|
|
732
725
|
|
|
733
726
|
/**
|
|
@@ -742,6 +735,14 @@ declare interface MissingShellCommand {
|
|
|
742
735
|
dynamicTokenCount: number;
|
|
743
736
|
}
|
|
744
737
|
|
|
738
|
+
export declare interface ModelVisibleToolPolicy {
|
|
739
|
+
enforcement: ToolEnforcement;
|
|
740
|
+
allowedTools: ReadonlySet<string>;
|
|
741
|
+
allowedShellCommands?: readonly {
|
|
742
|
+
argvPrefix: readonly string[];
|
|
743
|
+
}[];
|
|
744
|
+
}
|
|
745
|
+
|
|
745
746
|
export declare const MOLTNET_TOOL_NAMES: readonly ["moltnet_pack_get", "moltnet_pack_create", "moltnet_pack_provenance", "moltnet_pack_render", "moltnet_rendered_pack_list", "moltnet_rendered_pack_get", "moltnet_diary_tags", "moltnet_list_entries", "moltnet_get_entry", "moltnet_search_entries", "moltnet_create_entry", "moltnet_get_task", "moltnet_list_task_attempts", "moltnet_list_task_messages", "moltnet_upload_task_artifact", "moltnet_list_task_artifacts", "moltnet_download_task_artifact", "moltnet_review_session_errors", "moltnet_host_exec"];
|
|
746
747
|
|
|
747
748
|
declare type MoltNetAgent = Awaited<ReturnType<typeof connect>>;
|
|
@@ -948,10 +949,16 @@ export declare interface PiTaskExecutionPlan {
|
|
|
948
949
|
*/
|
|
949
950
|
workspaceId: string | null;
|
|
950
951
|
/**
|
|
951
|
-
* Branch to create or reopen for the workspace. `null`
|
|
952
|
-
* worktree is
|
|
952
|
+
* Branch to create or reopen for the workspace. `null` may instead mean a
|
|
953
|
+
* detached dedicated worktree when `workspaceRevision` is present.
|
|
953
954
|
*/
|
|
954
955
|
worktreeBranch: string | null;
|
|
956
|
+
/**
|
|
957
|
+
* Immutable commit that must back the selected workspace. Shared mounts are
|
|
958
|
+
* verified against it; dedicated review worktrees are created detached at
|
|
959
|
+
* it. `null` preserves the existing branch-oriented behavior.
|
|
960
|
+
*/
|
|
961
|
+
workspaceRevision?: string | null;
|
|
955
962
|
/**
|
|
956
963
|
* Base ref a NEW `worktreeBranch` is cut from. Used by `fork` continuations
|
|
957
964
|
* to branch from the parent's tip instead of the default (main/HEAD). Ignored
|
|
@@ -1134,6 +1141,33 @@ declare interface RuntimeInstructorContext {
|
|
|
1134
1141
|
guestWorkspace: string;
|
|
1135
1142
|
/** Optional correlation id grouping this task with others. */
|
|
1136
1143
|
correlationId: string | null;
|
|
1144
|
+
/** Effective, session-start policy projected into model-visible guidance. */
|
|
1145
|
+
toolPolicy?: RuntimeInstructorToolPolicy;
|
|
1146
|
+
sandbox?: RuntimeInstructorSandbox;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
declare interface RuntimeInstructorSandbox {
|
|
1150
|
+
workspaceMode: 'shared_mount' | 'dedicated_worktree' | 'scratch_mount';
|
|
1151
|
+
workspaceRevision?: string | null;
|
|
1152
|
+
vfsShadowMode: 'none' | 'deny' | 'tmpfs';
|
|
1153
|
+
vfsShadowPatterns: readonly string[];
|
|
1154
|
+
nodeModulesWriteMode?: 'tmpfs';
|
|
1155
|
+
verifiedExecutables: readonly string[];
|
|
1156
|
+
allowedHosts: readonly string[];
|
|
1157
|
+
allowedInternalHosts: readonly string[];
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
declare interface RuntimeInstructorToolPolicy {
|
|
1161
|
+
enforcement: 'off' | 'watch' | 'enforce';
|
|
1162
|
+
allowedTools: readonly string[];
|
|
1163
|
+
allowedShellCommands: readonly {
|
|
1164
|
+
argvPrefix: readonly string[];
|
|
1165
|
+
}[];
|
|
1166
|
+
unavailableTools?: readonly string[];
|
|
1167
|
+
unavailableShellCommands?: readonly {
|
|
1168
|
+
argvPrefix: readonly string[];
|
|
1169
|
+
}[];
|
|
1170
|
+
degraded: boolean;
|
|
1137
1171
|
}
|
|
1138
1172
|
|
|
1139
1173
|
export declare interface SandboxConfig {
|