@themoltnet/pi-runtime 0.10.1 → 0.11.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +159 -221
  2. package/dist/index.js +266 -2007
  3. package/package.json +8 -6
package/dist/index.d.ts CHANGED
@@ -1,25 +1,44 @@
1
+ import { activateAgentEnv } from '@themoltnet/sandbox-gondolin';
1
2
  import { Agent } from '@themoltnet/sdk';
2
3
  import { AgentSession } from '@earendil-works/pi-coding-agent';
3
4
  import { Api } from '@earendil-works/pi-ai';
5
+ import { assertGuestEnvironmentBoundary } from '@themoltnet/sandbox-gondolin';
6
+ import { assertHostAuthenticatedGuestEnvironment } from '@themoltnet/sandbox-gondolin';
4
7
  import { BashOperations } from '@earendil-works/pi-coding-agent';
8
+ import { BrokeredHttpSecretBinding } from '@themoltnet/sandbox-gondolin';
9
+ import { BrokeredHttpSecretBoundaryError } from '@themoltnet/sandbox-gondolin';
10
+ import { BrokeredHttpSecretDescriptor } from '@themoltnet/sandbox-gondolin';
5
11
  import { ClaimedTask } from '@themoltnet/agent-runtime';
6
12
  import { CommandAnalysis } from '@themoltnet/shell-command-analyzer';
7
13
  import { connect } from '@themoltnet/sdk';
8
14
  import { Context } from '@opentelemetry/api';
9
- import { ContextRef } from '@themoltnet/agent-runtime';
10
15
  import { EditOperations } from '@earendil-works/pi-coding-agent';
16
+ import { ensureSnapshot } from '@themoltnet/sandbox-gondolin';
17
+ import { EnsureSnapshotOptions } from '@themoltnet/sandbox-gondolin';
11
18
  import { ExtensionAPI } from '@earendil-works/pi-coding-agent';
19
+ import { findMainWorktree } from '@themoltnet/sandbox-gondolin';
12
20
  import { FindOperations } from '@earendil-works/pi-coding-agent';
21
+ import { GONDOLIN_BASE_EXECUTABLES } from '@themoltnet/sandbox-gondolin';
13
22
  import { GrepToolDetails } from '@earendil-works/pi-coding-agent';
14
23
  import { GrepToolInput } from '@earendil-works/pi-coding-agent';
24
+ import { GuestCredentialMode } from '@themoltnet/sandbox-gondolin';
25
+ import { GuestEnvironmentBoundaryError } from '@themoltnet/sandbox-gondolin';
26
+ import { isResolvedPathInsideRoot } from '@themoltnet/sandbox-gondolin';
27
+ import { loadCredentials } from '@themoltnet/sandbox-gondolin';
15
28
  import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
16
29
  import { LsOperations } from '@earendil-works/pi-coding-agent';
30
+ import { ManagedVm } from '@themoltnet/sandbox-gondolin';
17
31
  import { Model } from '@earendil-works/pi-ai';
18
32
  import { ModelRegistry } from '@earendil-works/pi-coding-agent';
33
+ import { prepareBrokeredHttpSecrets } from '@themoltnet/sandbox-gondolin';
34
+ import { ProviderAuthSource } from '@themoltnet/sandbox-gondolin';
19
35
  import { Readable } from 'node:stream';
20
36
  import { ReadOperations } from '@earendil-works/pi-coding-agent';
37
+ import { ResumeCommand } from '@themoltnet/sandbox-gondolin';
38
+ import { SandboxConfig } from '@themoltnet/sandbox-gondolin';
21
39
  import { ShellCommandAnalyzer } from '@themoltnet/shell-command-analyzer';
22
40
  import { Skill } from '@earendil-works/pi-coding-agent';
41
+ import { SnapshotConfig } from '@themoltnet/sandbox-gondolin';
23
42
  import { Static } from 'typebox';
24
43
  import { SubagentContractRegistry } from '@themoltnet/agent-runtime';
25
44
  import { TaskOutput } from '@themoltnet/agent-runtime';
@@ -29,13 +48,12 @@ import { ToolCallEvent } from '@earendil-works/pi-coding-agent';
29
48
  import { ToolDefinition } from '@earendil-works/pi-coding-agent';
30
49
  import { Type } from 'typebox';
31
50
  import { VM } from '@earendil-works/gondolin';
51
+ import { VmConfig } from '@themoltnet/sandbox-gondolin';
52
+ import { VmCredentials } from '@themoltnet/sandbox-gondolin';
53
+ import { VmDiagnostic } from '@themoltnet/sandbox-gondolin';
32
54
  import { WriteOperations } from '@earendil-works/pi-coding-agent';
33
55
 
34
- /**
35
- * Apply agent env vars to the host process, mirroring `moltnet start`.
36
- * Resolves relative paths (e.g. GIT_CONFIG_GLOBAL) against the repo root.
37
- */
38
- export declare function activateAgentEnv(agentEnv: Record<string, string | undefined>, repoRoot: string): void;
56
+ export { activateAgentEnv }
39
57
 
40
58
  /** Minimal shape of the SDK method the resolver needs (keeps deps testable). */
41
59
  export declare interface AllowedToolsClient {
@@ -55,17 +73,15 @@ export declare interface AllowedToolsClient {
55
73
  };
56
74
  }
57
75
 
58
- export declare function assertGuestEnvironmentBoundary(options: {
59
- guestCredentialMode: GuestCredentialMode;
60
- forwardEnv?: readonly string[];
61
- sandboxEnv?: Readonly<Record<string, string>>;
62
- }): void;
76
+ export { assertGuestEnvironmentBoundary }
77
+
78
+ export { assertHostAuthenticatedGuestEnvironment }
63
79
 
64
- /** @deprecated Prefer assertGuestEnvironmentBoundary for mode-aware checks. */
65
- export declare function assertHostAuthenticatedGuestEnvironment(options: {
66
- forwardEnv?: readonly string[];
67
- sandboxEnv?: Readonly<Record<string, string>>;
68
- }): void;
80
+ export { BrokeredHttpSecretBinding }
81
+
82
+ export { BrokeredHttpSecretBoundaryError }
83
+
84
+ export { BrokeredHttpSecretDescriptor }
69
85
 
70
86
  /**
71
87
  * Construct an `AgentSession`. By default it is in-memory; callers may opt
@@ -157,6 +173,46 @@ export declare function buildRuntimeKernel(ctx: RuntimeInstructorContext): strin
157
173
 
158
174
  export declare function buildWorkspaceMountInstructions(guestWorkspace: string): string;
159
175
 
176
+ declare const CONTEXT_BINDINGS: readonly ["skill", "context_inline", "prompt_prefix", "user_inline"];
177
+
178
+ declare type ContextBinding = (typeof CONTEXT_BINDINGS)[number];
179
+
180
+ declare const ContextBinding: Type.TUnsafe<"skill" | "context_inline" | "prompt_prefix" | "user_inline">;
181
+
182
+ /**
183
+ * One context entry. Bytes are inlined: the proposer chose them, and the
184
+ * task's `inputCid` already pins the entire input — including
185
+ * `context[]` — so we don't need a separate per-entry hash, fetcher, or
186
+ * flagged-content gate. Tasks reference rendered packs (or any other
187
+ * external content) by copying their bytes into `content` at task
188
+ * creation time.
189
+ *
190
+ * - `slug` — short identifier the daemon uses to disambiguate
191
+ * entries. For `skill` binding it becomes the directory
192
+ * name under the runtime's skill discovery path. Must be
193
+ * kebab-case-safe (alphanumeric + dashes/underscores).
194
+ * - `binding` — how the bytes are delivered to the LLM (see above).
195
+ * - `content` — UTF-8 text. Capped at 65,536 UTF-16 code units per
196
+ * entry; total per-task context bytes are bounded by the
197
+ * soft `maxItems` cap and per-binding daemon limits.
198
+ * Raised from 32 KiB in 2026-05 — protocol-heavy operator
199
+ * skills (e.g. `.claude/skills/legreffier/SKILL.md`) ship
200
+ * at ~35 KiB inline, and the original cap was sized for
201
+ * short example skills, not the kind of skill the eval
202
+ * substrate is dogfooded on (#943, #823).
203
+ */
204
+ declare const ContextRef: Type.TObject<{
205
+ slug: Type.TString;
206
+ binding: Type.TUnsafe<"skill" | "context_inline" | "prompt_prefix" | "user_inline">;
207
+ content: Type.TString;
208
+ }>;
209
+
210
+ declare type ContextRef = {
211
+ slug: string;
212
+ binding: ContextBinding;
213
+ content: string;
214
+ };
215
+
160
216
  export declare function createGondolinBashOps(vm: VM, localCwd: string, guestWorkspace: string): BashOperations;
161
217
 
162
218
  export declare function createGondolinEditOps(vm: VM, localCwd: string, guestWorkspace: string): EditOperations;
@@ -340,6 +396,8 @@ export declare function decideForEvent(event: ToolCallEvent, policy: SessionTool
340
396
  */
341
397
  export declare function decideToolCall(input: GateInput): GateDecision;
342
398
 
399
+ export declare const DEFAULT_BROKERED_HTTP_SECRET_RESOLUTION_TIMEOUT_MS = 30000;
400
+
343
401
  export declare function defineGondolinTemplate(options: DefineGondolinTemplateOptions): GondolinTemplateDefinition;
344
402
 
345
403
  export declare interface DefineGondolinTemplateOptions {
@@ -353,6 +411,17 @@ export declare interface DefineGondolinTemplateOptions {
353
411
  resumeCommands?: readonly ResumeCommand[];
354
412
  }
355
413
 
414
+ /**
415
+ * Declare a value-free HTTP credential requirement in trusted runtime code.
416
+ * The resolver runs per attempt on the daemon host; its return value is never
417
+ * added to the runtime definition or executor manifest.
418
+ */
419
+ export declare function definePiBrokeredHttpSecret(options: DefinePiBrokeredHttpSecretOptions): PiBrokeredHttpSecretContribution;
420
+
421
+ export declare interface DefinePiBrokeredHttpSecretOptions extends BrokeredHttpSecretDescriptor {
422
+ resolve: (context: PiBrokeredHttpSecretResolveContext) => string | undefined | Promise<string | undefined>;
423
+ }
424
+
356
425
  export declare function definePiExtension(options: PiExtensionOptions): PiExtensionContribution;
357
426
 
358
427
  export declare function definePiRuntime(options: DefinePiRuntimeOptions): PiRuntimeDefinition;
@@ -362,6 +431,7 @@ export declare interface DefinePiRuntimeOptions {
362
431
  version: string;
363
432
  runtimeKind?: string;
364
433
  vm: GondolinTemplateDefinition;
434
+ brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
365
435
  tools?: readonly PiToolContribution[];
366
436
  extensions?: readonly PiExtensionContribution[];
367
437
  }
@@ -378,18 +448,9 @@ export declare function enabledPiToolNames(input: {
378
448
  policy?: ModelVisibleToolPolicy;
379
449
  }): string[] | undefined;
380
450
 
381
- /**
382
- * Ensure a cached snapshot exists, building one if needed.
383
- * Returns the absolute path to the qcow2 checkpoint file.
384
- */
385
- export declare function ensureSnapshot(options?: EnsureSnapshotOptions): Promise<string>;
451
+ export { ensureSnapshot }
386
452
 
387
- export declare interface EnsureSnapshotOptions {
388
- config?: SnapshotConfig;
389
- onProgress?: (message: string) => void;
390
- /** Max number of old snapshots to keep (default 1). */
391
- maxCached?: number;
392
- }
453
+ export { EnsureSnapshotOptions }
393
454
 
394
455
  export declare function executeGondolinGrep(vm: VM, localCwd: string, guestWorkspace: string, params: GrepToolInput, signal?: AbortSignal): Promise<TextToolResult<GrepToolDetails>>;
395
456
 
@@ -467,6 +528,8 @@ export declare interface ExecutePiTaskOptions {
467
528
  onSnapshotProgress?: (message: string) => void;
468
529
  /** Structured VM credential-boundary diagnostics. */
469
530
  onVmDiagnostic?: (diagnostic: VmDiagnostic) => void;
531
+ /** Internal VM-resume seam for executor integration tests. */
532
+ resumeVm?: typeof resumeVm;
470
533
  /**
471
534
  * Optional pre-resolved checkpoint path. If omitted, `ensureSnapshot` is
472
535
  * invoked. Useful for batch execution where the caller wants to cache
@@ -600,11 +663,7 @@ export declare interface ExecutePiTaskOptions {
600
663
 
601
664
  export declare function filterModelVisibleTools(tools: readonly ToolDefinition[], policy?: ModelVisibleToolPolicy): ToolDefinition[];
602
665
 
603
- /**
604
- * Resolve the main worktree root (where .moltnet/ lives — it's untracked,
605
- * only exists in the main worktree, not in git worktrees).
606
- */
607
- export declare function findMainWorktree(startPath?: string): string;
666
+ export { findMainWorktree }
608
667
 
609
668
  export declare type GateDecision = {
610
669
  allow: true;
@@ -641,8 +700,7 @@ export declare interface GateInput {
641
700
  analyze: (command: string) => CommandAnalysis;
642
701
  }
643
702
 
644
- /** Commands guaranteed by the base Gondolin snapshot. */
645
- export declare const GONDOLIN_BASE_EXECUTABLES: readonly string[];
703
+ export { GONDOLIN_BASE_EXECUTABLES }
646
704
 
647
705
  export declare const GONDOLIN_TOOL_NAMES: readonly ["read", "write", "edit", "bash", "ls", "find", "grep"];
648
706
 
@@ -659,12 +717,9 @@ export declare interface GondolinTemplateResolveContext {
659
717
  onProgress?: (message: string) => void;
660
718
  }
661
719
 
662
- export declare type GuestCredentialMode = 'guest-config' | 'host-authenticated';
720
+ export { GuestCredentialMode }
663
721
 
664
- export declare class GuestEnvironmentBoundaryError extends Error {
665
- readonly refusedNames: readonly string[];
666
- constructor(refusedNames: readonly string[]);
667
- }
722
+ export { GuestEnvironmentBoundaryError }
668
723
 
669
724
  /**
670
725
  * Baseline env keys forwarded to host-exec child processes.
@@ -715,27 +770,13 @@ export declare interface InjectTaskContextArgs {
715
770
 
716
771
  export declare function isKernelTool(name: string): boolean;
717
772
 
718
- /**
719
- * Check containment for already-resolved lexical or real paths.
720
- *
721
- * Callers that accept untrusted paths must resolve/realpath at their I/O
722
- * boundary first; keeping the platform-specific relative-path rule here avoids
723
- * subtly different `..` and absolute-path handling across runtime cleanup,
724
- * session sync, and artifact staging.
725
- */
726
- export declare function isResolvedPathInsideRoot(path: string, root: string): boolean;
773
+ export { isResolvedPathInsideRoot }
727
774
 
728
775
  export declare function isToolVisible(name: string, policy?: ModelVisibleToolPolicy): boolean;
729
776
 
730
- export declare function loadCredentials(agentDir: string, mode?: GuestCredentialMode, onDiagnostic?: (diagnostic: VmDiagnostic) => void): VmCredentials;
777
+ export { loadCredentials }
731
778
 
732
- export declare interface ManagedVm {
733
- vm: VM;
734
- credentials: VmCredentials;
735
- mountPath: string;
736
- guestWorkspace: string;
737
- agentDir: string;
738
- }
779
+ export { ManagedVm }
739
780
 
740
781
  declare interface MatchedShellCommand {
741
782
  executable: string;
@@ -743,6 +784,13 @@ declare interface MatchedShellCommand {
743
784
  argvPrefixLength: number;
744
785
  }
745
786
 
787
+ export declare function materializePiBrokeredHttpSecrets(input: {
788
+ runtime: PiRuntimeDefinition;
789
+ context: Omit<PiBrokeredHttpSecretResolveContext, 'signal'>;
790
+ signal?: AbortSignal;
791
+ timeoutMs?: number;
792
+ }): Promise<BrokeredHttpSecretBinding[]>;
793
+
746
794
  export declare function materializePiExtensions(input: {
747
795
  runtime: PiRuntimeDefinition;
748
796
  context: PiToolContext;
@@ -861,8 +909,31 @@ export declare function normalizeRetryTriageResult(value: unknown): PiRetryTriag
861
909
 
862
910
  export declare const PI_EXECUTOR_MANIFEST_VERSION: "moltnet:executor-manifest:v1";
863
911
 
912
+ /** Guest path where Pi expects its auth blob. */
913
+ export declare const PI_GUEST_AUTH_PATH = "/home/agent/.pi/agent/auth.json";
914
+
864
915
  export declare const PI_RUNTIME_DEFINITION_VERSION = "moltnet:pi-runtime:v1";
865
916
 
917
+ export declare interface PiBrokeredHttpSecretContribution {
918
+ readonly kind: 'brokered_http_secret';
919
+ readonly descriptor: BrokeredHttpSecretDescriptor;
920
+ readonly resolve: (context: PiBrokeredHttpSecretResolveContext) => string | undefined | Promise<string | undefined>;
921
+ }
922
+
923
+ export declare class PiBrokeredHttpSecretResolutionError extends Error {
924
+ readonly requirementId: string;
925
+ readonly retryable: boolean;
926
+ constructor(requirementId: string, message: string, retryable: boolean);
927
+ }
928
+
929
+ export declare interface PiBrokeredHttpSecretResolveContext {
930
+ agentName: string;
931
+ claimedTask: ClaimedTask;
932
+ cwdPath: string;
933
+ /** Cancelled when the attempt stops or the resolver exceeds its deadline. */
934
+ signal: AbortSignal;
935
+ }
936
+
866
937
  export declare interface PiExecutorManifest {
867
938
  schemaVersion: typeof PI_EXECUTOR_MANIFEST_VERSION;
868
939
  runtime: {
@@ -882,6 +953,15 @@ export declare interface PiExecutorManifest {
882
953
  templateFingerprint: string;
883
954
  guestAssetBuildId: string;
884
955
  };
956
+ /** Optional v1 extension, emitted only when requirements are declared. */
957
+ brokeredHttpSecrets?: {
958
+ id: string;
959
+ guestEnv: string;
960
+ hosts: readonly string[];
961
+ protocol: 'https' | 'http';
962
+ ports: readonly number[];
963
+ required: boolean;
964
+ }[];
885
965
  tools: {
886
966
  name: string;
887
967
  descriptorCid: string | null;
@@ -930,6 +1010,13 @@ export declare interface PiOtelOptions {
930
1010
  onSessionContextChange?: (context: Context | undefined) => void;
931
1011
  }
932
1012
 
1013
+ /**
1014
+ * Pi's provider authentication as a sandbox `ProviderAuthSource`. CI writes
1015
+ * `auth.json` under `PI_CODING_AGENT_DIR`; local runs fall back to the
1016
+ * canonical `~/.pi/agent` dir when the override is unset.
1017
+ */
1018
+ export declare function piProviderAuth(): ProviderAuthSource;
1019
+
933
1020
  export declare type PiRetryTriage = (input: PiRetryTriageInput) => Promise<PiRetryTriageResult>;
934
1021
 
935
1022
  export declare type PiRetryTriageConfidence = RetryTriageConfidence;
@@ -968,6 +1055,8 @@ export declare interface PiRuntimeDefinition {
968
1055
  readonly version: string;
969
1056
  readonly runtimeKind: string;
970
1057
  readonly vm: GondolinTemplateDefinition;
1058
+ /** Optional v1 extension; absent on independently packaged legacy runtimes. */
1059
+ readonly brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
971
1060
  readonly tools: readonly PiToolContribution[];
972
1061
  readonly extensions: readonly PiExtensionContribution[];
973
1062
  }
@@ -1074,6 +1163,10 @@ declare interface PiWorkspaceSeedPlan {
1074
1163
  source: 'producer';
1075
1164
  }
1076
1165
 
1166
+ export { prepareBrokeredHttpSecrets }
1167
+
1168
+ export { ProviderAuthSource }
1169
+
1077
1170
  export declare interface ProviderErrorRetryEvent extends Record<string, unknown> {
1078
1171
  event: 'provider_error_retry';
1079
1172
  retry: number;
@@ -1149,31 +1242,11 @@ declare interface ResolveSessionToolPolicyInput {
1149
1242
 
1150
1243
  export declare function resolveTaskWorktreePath(mainRepo: string, workspaceId: string): string;
1151
1244
 
1152
- export declare interface ResumeCommand {
1153
- /** Shell command, same semantics as the string form. */
1154
- run: string;
1155
- /** Optional generic runtime predicate for whether this step should run. */
1156
- when?: ResumeCommandWhen;
1157
- /** Additional attempts on non-zero exit. Default 0. */
1158
- retries?: number;
1159
- /** Linear backoff between attempts in ms. Delay before attempt N+1 is
1160
- * `(N + 1) * retryBackoffMs` (so 2s, 4s, … with the default). */
1161
- retryBackoffMs?: number;
1162
- }
1163
-
1164
- /** Structured form of a resume command with optional retry policy. */
1165
- declare interface ResumeCommandWhen {
1166
- /**
1167
- * Effective workspace mode(s) that should run this command.
1168
- * Evaluated by the runtime from the mounted workspace shape rather than
1169
- * from task type semantics.
1170
- */
1171
- workspaceMode?: ('shared_mount' | 'dedicated_worktree' | 'scratch_mount')[];
1172
- }
1245
+ export { ResumeCommand }
1173
1246
 
1174
1247
  /**
1175
- * Resume a VM from a checkpoint, inject credentials, configure egress +
1176
- * TLS. Returns the managed VM handle.
1248
+ * Resume a Gondolin VM for a Pi session. Identical to the sandbox package's
1249
+ * `resumeVm`, with Pi's provider auth supplied unless the caller overrides it.
1177
1250
  */
1178
1251
  export declare function resumeVm(config: VmConfig): Promise<ManagedVm>;
1179
1252
 
@@ -1204,6 +1277,8 @@ declare interface RuntimeInstructorSandbox {
1204
1277
  verifiedExecutables: readonly string[];
1205
1278
  allowedHosts: readonly string[];
1206
1279
  allowedInternalHosts: readonly string[];
1280
+ /** Guest names containing host-brokered opaque HTTP placeholders. */
1281
+ brokeredSecretEnvNames?: readonly string[];
1207
1282
  }
1208
1283
 
1209
1284
  declare interface RuntimeInstructorToolPolicy {
@@ -1219,78 +1294,7 @@ declare interface RuntimeInstructorToolPolicy {
1219
1294
  degraded: boolean;
1220
1295
  }
1221
1296
 
1222
- export declare interface SandboxConfig {
1223
- /**
1224
- * Operator-owned snapshot build settings. Runtime profiles must never
1225
- * populate this field.
1226
- */
1227
- snapshot?: {
1228
- /** Shell commands to run after the base setup. */
1229
- setupCommands?: string[];
1230
- /** Additional hosts to allow network access during build. */
1231
- allowedHosts?: string[];
1232
- /** Overlay disk size (default '3G'). */
1233
- overlaySize?: string;
1234
- };
1235
- /** Runtime network egress policy. Separate from snapshot build access. */
1236
- network?: {
1237
- /** Additional host patterns allowed while the VM is running.
1238
- * Internal and private address resolution remains blocked. */
1239
- allowedHosts?: string[];
1240
- /** Host patterns explicitly allowed to resolve to internal/private IPs. */
1241
- allowedInternalHosts?: string[];
1242
- };
1243
- /** Operator-owned shell commands to run every VM resume, after platform setup
1244
- * (TLS, DNS, git safe.directory, tmpfs node_modules) and before
1245
- * the agent session starts. Use for per-session bootstrap that
1246
- * doesn't belong baked into the snapshot.
1247
- *
1248
- * Not included in the snapshot cache key — changes here apply on
1249
- * every resume without triggering a snapshot rebuild. Each command
1250
- * runs in a fresh shell with `set -eu` and `set -o pipefail`; a
1251
- * non-zero exit (including from any segment of a pipeline) aborts
1252
- * resume with the failing command's stderr/stdout tail.
1253
- *
1254
- * Each entry is either a raw string (no retries) or an object
1255
- * `{ run, when?, retries?, retryBackoffMs? }`. `when` gates the
1256
- * command on generic runtime properties such as effective
1257
- * `workspaceMode`; this keeps sandbox policy decoupled from task
1258
- * types. `retries` is the number of ADDITIONAL attempts after the
1259
- * first failure (default 0 = no retry). Use for steps that hit the
1260
- * network and may legitimately race DHCP/registry availability on a
1261
- * fresh resume (e.g. `pnpm install`). The wrapped command must be
1262
- * idempotent. */
1263
- resumeCommands?: (string | ResumeCommand)[];
1264
- /** VFS shadow settings — hide host paths from the guest. */
1265
- vfs?: {
1266
- /** Paths (relative to workspace root) to shadow from the host mount. */
1267
- shadow?: string[];
1268
- /** What to do with writes to shadowed paths: 'deny' or 'tmpfs' (default 'tmpfs'). */
1269
- shadowMode?: 'deny' | 'tmpfs';
1270
- };
1271
- /** Environment variable overrides for the guest VM (applied on top of defaults). */
1272
- env?: Record<string, string>;
1273
- /** Host-side escape hatch policy. Applies only to `moltnet_host_exec`. */
1274
- hostExec?: {
1275
- /**
1276
- * `true` auto-approves every allowed executable. An array auto-approves
1277
- * only commands matching one of the executable/argument rules.
1278
- */
1279
- autoApprove?: boolean | {
1280
- executable: string;
1281
- argsPrefix?: string[];
1282
- argsContains?: string[];
1283
- argsExcludes?: string[];
1284
- }[];
1285
- };
1286
- /** VM resource allocation. */
1287
- resources?: {
1288
- /** Memory size in qemu syntax (default '1G'). */
1289
- memory?: string;
1290
- /** CPU count (default 2). */
1291
- cpus?: number;
1292
- };
1293
- }
1297
+ export { SandboxConfig }
1294
1298
 
1295
1299
  /** The resolved allow-set + enforcement mode for a runtime session. */
1296
1300
  export declare interface SessionToolPolicy {
@@ -1317,8 +1321,7 @@ declare interface ShellCommandRule {
1317
1321
  argvPrefix: readonly [string, string, ...string[]];
1318
1322
  }
1319
1323
 
1320
- /** Extract snapshot-specific config for backwards compat with ensureSnapshot. */
1321
- export declare type SnapshotConfig = NonNullable<SandboxConfig['snapshot']>;
1324
+ export { SnapshotConfig }
1322
1325
 
1323
1326
  export declare interface SubagentToolHandle {
1324
1327
  /** ToolDefinition to register via `customTools` on the parent session. */
@@ -1423,76 +1426,11 @@ export declare type TurnEventHandlerFactory = (claimedTask: ClaimedTask) => Turn
1423
1426
 
1424
1427
  export declare type TurnEventKind = Parameters<TaskReporter['record']>[0]['kind'];
1425
1428
 
1426
- export declare interface VmConfig {
1427
- /** Absolute path to the qcow2 checkpoint. */
1428
- checkpointPath: string;
1429
- /** MoltNet agent name (used to resolve credentials). */
1430
- agentName: string;
1431
- /**
1432
- * Trust boundary for guest credentials. `guest-config` injects the complete
1433
- * legacy agent directory. `host-authenticated` never reads or injects it and
1434
- * relies exclusively on the supplied host-side Agent for MoltNet operations.
1435
- */
1436
- guestCredentialMode?: GuestCredentialMode;
1437
- /**
1438
- * Host root that owns `.moltnet/<agentName>/`.
1439
- *
1440
- * Defaults to the main git worktree for backwards compatibility. Daemon
1441
- * callers pass the sandbox root so non-git scratch/shared tasks can boot.
1442
- */
1443
- agentRootDir?: string;
1444
- /** Host directory to mount into the VM. */
1445
- mountPath: string;
1446
- /** Effective workspace shape selected by the caller. */
1447
- workspaceMode?: 'shared_mount' | 'dedicated_worktree' | 'scratch_mount';
1448
- /** Additional hosts to allow in egress policy. */
1449
- extraAllowedHosts?: string[];
1450
- /** Full sandbox config (vfs shadows, env overrides). */
1451
- sandboxConfig?: SandboxConfig;
1452
- /**
1453
- * Host environment variable names to copy into the VM process.
1454
- *
1455
- * Runtime profiles use this for provider API keys: `requiredEnv` proves the
1456
- * daemon host has the secret, and this allowlist forwards only those names
1457
- * into the guest without storing secret values in the profile.
1458
- */
1459
- forwardEnv?: string[];
1460
- /** Structured credential-boundary diagnostics for daemon loggers. */
1461
- onDiagnostic?: (diagnostic: VmDiagnostic) => void;
1462
- /** Abort resume/setup work, closing any live VM owned by resumeVm. */
1463
- signal?: AbortSignal;
1464
- }
1429
+ export { VmConfig }
1465
1430
 
1466
- export declare interface VmCredentials {
1467
- /** Empty in host-authenticated mode; retained as strings for API stability. */
1468
- moltnetJson: string;
1469
- /** Empty in host-authenticated mode; retained as strings for API stability. */
1470
- agentEnvRaw: string;
1471
- /**
1472
- * Pi OAuth/API-key auth blob. Null when neither `~/.pi/agent/auth.json`
1473
- * (resolved via `PI_CODING_AGENT_DIR` when set) is present — in that
1474
- * case the daemon relies on Pi's env-var providers (`ANTHROPIC_API_KEY`,
1475
- * etc.) carried via `agentEnv` and the host environment instead. CI uses
1476
- * this path.
1477
- */
1478
- piAuthJson: string | null;
1479
- agentEnv: Record<string, string | undefined>;
1480
- gitconfig: string | null;
1481
- sshPrivateKey: string | null;
1482
- sshPublicKey: string | null;
1483
- allowedSigners: string | null;
1484
- /** Raw PEM content of the GitHub App private key, or null if not configured. */
1485
- githubAppPem: string | null;
1486
- /** VM-local filename for the GitHub App PEM (basename of host path), or null. */
1487
- githubAppPemFilename: string | null;
1488
- }
1431
+ export { VmCredentials }
1489
1432
 
1490
- export declare interface VmDiagnostic {
1491
- event: 'vm.credentials.mode' | 'vm.credentials.github_key_missing';
1492
- level: 'info' | 'warning';
1493
- message: string;
1494
- credentialMode: GuestCredentialMode;
1495
- }
1433
+ export { VmDiagnostic }
1496
1434
 
1497
1435
  /**
1498
1436
  * Subset of `@earendil-works/gondolin`'s `VmFs` we actually use. We