@themoltnet/pi-runtime 0.10.1 → 0.12.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 +253 -219
  2. package/dist/index.js +1334 -2712
  3. package/package.json +7 -5
package/dist/index.d.ts CHANGED
@@ -1,25 +1,47 @@
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 { HostCapabilityContribution } from '@themoltnet/agent-runtime';
27
+ import { HostCapabilityEvidenceLogger } from '@themoltnet/agent-runtime';
28
+ import { HostCapabilityManifestEntry } from '@themoltnet/agent-runtime';
29
+ import { isResolvedPathInsideRoot } from '@themoltnet/sandbox-gondolin';
30
+ import { loadCredentials } from '@themoltnet/sandbox-gondolin';
15
31
  import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
16
32
  import { LsOperations } from '@earendil-works/pi-coding-agent';
33
+ import { ManagedVm } from '@themoltnet/sandbox-gondolin';
17
34
  import { Model } from '@earendil-works/pi-ai';
18
35
  import { ModelRegistry } from '@earendil-works/pi-coding-agent';
36
+ import { prepareBrokeredHttpSecrets } from '@themoltnet/sandbox-gondolin';
37
+ import { ProviderAuthSource } from '@themoltnet/sandbox-gondolin';
19
38
  import { Readable } from 'node:stream';
20
39
  import { ReadOperations } from '@earendil-works/pi-coding-agent';
40
+ import { ResumeCommand } from '@themoltnet/sandbox-gondolin';
41
+ import { SandboxConfig } from '@themoltnet/sandbox-gondolin';
21
42
  import { ShellCommandAnalyzer } from '@themoltnet/shell-command-analyzer';
22
43
  import { Skill } from '@earendil-works/pi-coding-agent';
44
+ import { SnapshotConfig } from '@themoltnet/sandbox-gondolin';
23
45
  import { Static } from 'typebox';
24
46
  import { SubagentContractRegistry } from '@themoltnet/agent-runtime';
25
47
  import { TaskOutput } from '@themoltnet/agent-runtime';
@@ -29,13 +51,68 @@ import { ToolCallEvent } from '@earendil-works/pi-coding-agent';
29
51
  import { ToolDefinition } from '@earendil-works/pi-coding-agent';
30
52
  import { Type } from 'typebox';
31
53
  import { VM } from '@earendil-works/gondolin';
54
+ import { VmConfig } from '@themoltnet/sandbox-gondolin';
55
+ import { VmCredentials } from '@themoltnet/sandbox-gondolin';
56
+ import { VmDiagnostic } from '@themoltnet/sandbox-gondolin';
32
57
  import { WriteOperations } from '@earendil-works/pi-coding-agent';
33
58
 
59
+ export { activateAgentEnv }
60
+
61
+ /**
62
+ * Non-secret identity of the agent a daemon runs as. Everything here may be
63
+ * projected into a sandbox guest; nothing here can sign.
64
+ */
65
+ declare interface AgentIdentity {
66
+ agentName: string;
67
+ identityId: string;
68
+ /** `ed25519:<base64>` */
69
+ publicKey: string;
70
+ fingerprint: string;
71
+ gitName: string;
72
+ gitEmail: string;
73
+ }
74
+
75
+ /**
76
+ * The seam between key storage and everything that needs a signature.
77
+ *
78
+ * Implementations hold (or proxy to) the Ed25519 identity key; consumers never
79
+ * see key material. The operations are purpose-bound on purpose: there is no
80
+ * "sign these bytes" method, so a broker exposing this interface cannot be
81
+ * turned into a general signing oracle.
82
+ */
83
+ declare interface AgentSigningCapability {
84
+ readonly identity: AgentIdentity;
85
+ /** Sign a pending MoltNet signing request owned by this identity. */
86
+ signDiaryEntry(input: {
87
+ signingRequestId: string;
88
+ }): Promise<{
89
+ signingRequestId: string;
90
+ }>;
91
+ /**
92
+ * Sign a validated SSHSIG envelope in the `git` namespace. The enforceable
93
+ * boundary is the namespace, which covers every git object signature
94
+ * (commits and tags); it is not commit-only.
95
+ */
96
+ signGitCommit(input: {
97
+ sshsig: Uint8Array;
98
+ }): Promise<{
99
+ /** Raw 64-byte Ed25519 signature over the envelope. */
100
+ signature: Uint8Array;
101
+ }>;
102
+ }
103
+
34
104
  /**
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.
105
+ * Stock signing capability: the guest keeps `git commit -S` and
106
+ * `moltnet entry create-signed`; signatures are produced on the host through
107
+ * the injected `AgentSigningCapability`. The guest receives only the signer
108
+ * origin, an ssh-agent socket served by the CLI, and a non-secret gitconfig.
37
109
  */
38
- export declare function activateAgentEnv(agentEnv: Record<string, string | undefined>, repoRoot: string): void;
110
+ export declare const agentSigningCapability: HostCapabilityContribution<AgentSigningInjected>;
111
+
112
+ /** State the daemon injects for this capability. */
113
+ declare interface AgentSigningInjected {
114
+ signer: AgentSigningCapability;
115
+ }
39
116
 
40
117
  /** Minimal shape of the SDK method the resolver needs (keeps deps testable). */
41
118
  export declare interface AllowedToolsClient {
@@ -55,17 +132,15 @@ export declare interface AllowedToolsClient {
55
132
  };
56
133
  }
57
134
 
58
- export declare function assertGuestEnvironmentBoundary(options: {
59
- guestCredentialMode: GuestCredentialMode;
60
- forwardEnv?: readonly string[];
61
- sandboxEnv?: Readonly<Record<string, string>>;
62
- }): void;
135
+ export { assertGuestEnvironmentBoundary }
136
+
137
+ export { assertHostAuthenticatedGuestEnvironment }
138
+
139
+ export { BrokeredHttpSecretBinding }
63
140
 
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;
141
+ export { BrokeredHttpSecretBoundaryError }
142
+
143
+ export { BrokeredHttpSecretDescriptor }
69
144
 
70
145
  /**
71
146
  * Construct an `AgentSession`. By default it is in-memory; callers may opt
@@ -157,6 +232,46 @@ export declare function buildRuntimeKernel(ctx: RuntimeInstructorContext): strin
157
232
 
158
233
  export declare function buildWorkspaceMountInstructions(guestWorkspace: string): string;
159
234
 
235
+ declare const CONTEXT_BINDINGS: readonly ["skill", "context_inline", "prompt_prefix", "user_inline"];
236
+
237
+ declare type ContextBinding = (typeof CONTEXT_BINDINGS)[number];
238
+
239
+ declare const ContextBinding: Type.TUnsafe<"skill" | "context_inline" | "prompt_prefix" | "user_inline">;
240
+
241
+ /**
242
+ * One context entry. Bytes are inlined: the proposer chose them, and the
243
+ * task's `inputCid` already pins the entire input — including
244
+ * `context[]` — so we don't need a separate per-entry hash, fetcher, or
245
+ * flagged-content gate. Tasks reference rendered packs (or any other
246
+ * external content) by copying their bytes into `content` at task
247
+ * creation time.
248
+ *
249
+ * - `slug` — short identifier the daemon uses to disambiguate
250
+ * entries. For `skill` binding it becomes the directory
251
+ * name under the runtime's skill discovery path. Must be
252
+ * kebab-case-safe (alphanumeric + dashes/underscores).
253
+ * - `binding` — how the bytes are delivered to the LLM (see above).
254
+ * - `content` — UTF-8 text. Capped at 65,536 UTF-16 code units per
255
+ * entry; total per-task context bytes are bounded by the
256
+ * soft `maxItems` cap and per-binding daemon limits.
257
+ * Raised from 32 KiB in 2026-05 — protocol-heavy operator
258
+ * skills (e.g. `.claude/skills/legreffier/SKILL.md`) ship
259
+ * at ~35 KiB inline, and the original cap was sized for
260
+ * short example skills, not the kind of skill the eval
261
+ * substrate is dogfooded on (#943, #823).
262
+ */
263
+ declare const ContextRef: Type.TObject<{
264
+ slug: Type.TString;
265
+ binding: Type.TUnsafe<"skill" | "context_inline" | "prompt_prefix" | "user_inline">;
266
+ content: Type.TString;
267
+ }>;
268
+
269
+ declare type ContextRef = {
270
+ slug: string;
271
+ binding: ContextBinding;
272
+ content: string;
273
+ };
274
+
160
275
  export declare function createGondolinBashOps(vm: VM, localCwd: string, guestWorkspace: string): BashOperations;
161
276
 
162
277
  export declare function createGondolinEditOps(vm: VM, localCwd: string, guestWorkspace: string): EditOperations;
@@ -340,6 +455,8 @@ export declare function decideForEvent(event: ToolCallEvent, policy: SessionTool
340
455
  */
341
456
  export declare function decideToolCall(input: GateInput): GateDecision;
342
457
 
458
+ export declare const DEFAULT_BROKERED_HTTP_SECRET_RESOLUTION_TIMEOUT_MS = 30000;
459
+
343
460
  export declare function defineGondolinTemplate(options: DefineGondolinTemplateOptions): GondolinTemplateDefinition;
344
461
 
345
462
  export declare interface DefineGondolinTemplateOptions {
@@ -353,6 +470,17 @@ export declare interface DefineGondolinTemplateOptions {
353
470
  resumeCommands?: readonly ResumeCommand[];
354
471
  }
355
472
 
473
+ /**
474
+ * Declare a value-free HTTP credential requirement in trusted runtime code.
475
+ * The resolver runs per attempt on the daemon host; its return value is never
476
+ * added to the runtime definition or executor manifest.
477
+ */
478
+ export declare function definePiBrokeredHttpSecret(options: DefinePiBrokeredHttpSecretOptions): PiBrokeredHttpSecretContribution;
479
+
480
+ export declare interface DefinePiBrokeredHttpSecretOptions extends BrokeredHttpSecretDescriptor {
481
+ resolve: (context: PiBrokeredHttpSecretResolveContext) => string | undefined | Promise<string | undefined>;
482
+ }
483
+
356
484
  export declare function definePiExtension(options: PiExtensionOptions): PiExtensionContribution;
357
485
 
358
486
  export declare function definePiRuntime(options: DefinePiRuntimeOptions): PiRuntimeDefinition;
@@ -362,6 +490,8 @@ export declare interface DefinePiRuntimeOptions {
362
490
  version: string;
363
491
  runtimeKind?: string;
364
492
  vm: GondolinTemplateDefinition;
493
+ brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
494
+ hostCapabilities?: readonly HostCapabilityContribution<never>[];
365
495
  tools?: readonly PiToolContribution[];
366
496
  extensions?: readonly PiExtensionContribution[];
367
497
  }
@@ -378,18 +508,9 @@ export declare function enabledPiToolNames(input: {
378
508
  policy?: ModelVisibleToolPolicy;
379
509
  }): string[] | undefined;
380
510
 
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>;
511
+ export { ensureSnapshot }
386
512
 
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
- }
513
+ export { EnsureSnapshotOptions }
393
514
 
394
515
  export declare function executeGondolinGrep(vm: VM, localCwd: string, guestWorkspace: string, params: GrepToolInput, signal?: AbortSignal): Promise<TextToolResult<GrepToolDetails>>;
395
516
 
@@ -467,6 +588,8 @@ export declare interface ExecutePiTaskOptions {
467
588
  onSnapshotProgress?: (message: string) => void;
468
589
  /** Structured VM credential-boundary diagnostics. */
469
590
  onVmDiagnostic?: (diagnostic: VmDiagnostic) => void;
591
+ /** Internal VM-resume seam for executor integration tests. */
592
+ resumeVm?: typeof resumeVm;
470
593
  /**
471
594
  * Optional pre-resolved checkpoint path. If omitted, `ensureSnapshot` is
472
595
  * invoked. Useful for batch execution where the caller wants to cache
@@ -589,6 +712,15 @@ export declare interface ExecutePiTaskOptions {
589
712
  toolPolicyLogger?: ToolPolicyLogger;
590
713
  /** Trusted, statically imported operator runtime contributions. */
591
714
  runtimeDefinition?: PiRuntimeDefinition;
715
+ /**
716
+ * Host-side signing capability injected by the daemon for host capabilities
717
+ * (never built from key material inside the runtime).
718
+ */
719
+ hostCapabilitySigner?: AgentSigningCapability;
720
+ /** Non-secret agent identity projected to the guest by host capabilities. */
721
+ agentIdentity?: AgentIdentity;
722
+ /** Evidence logger for host capability decisions (defaults to the tool-policy logger). */
723
+ hostCapabilityLogger?: HostCapabilityEvidenceLogger;
592
724
  /**
593
725
  * Pre-resolved local VM template. Daemons resolve this before polling so
594
726
  * profile requirements and executor attestation can be checked before claim.
@@ -600,11 +732,7 @@ export declare interface ExecutePiTaskOptions {
600
732
 
601
733
  export declare function filterModelVisibleTools(tools: readonly ToolDefinition[], policy?: ModelVisibleToolPolicy): ToolDefinition[];
602
734
 
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;
735
+ export { findMainWorktree }
608
736
 
609
737
  export declare type GateDecision = {
610
738
  allow: true;
@@ -641,8 +769,7 @@ export declare interface GateInput {
641
769
  analyze: (command: string) => CommandAnalysis;
642
770
  }
643
771
 
644
- /** Commands guaranteed by the base Gondolin snapshot. */
645
- export declare const GONDOLIN_BASE_EXECUTABLES: readonly string[];
772
+ export { GONDOLIN_BASE_EXECUTABLES }
646
773
 
647
774
  export declare const GONDOLIN_TOOL_NAMES: readonly ["read", "write", "edit", "bash", "ls", "find", "grep"];
648
775
 
@@ -659,12 +786,15 @@ export declare interface GondolinTemplateResolveContext {
659
786
  onProgress?: (message: string) => void;
660
787
  }
661
788
 
662
- export declare type GuestCredentialMode = 'guest-config' | 'host-authenticated';
789
+ export declare const GUEST_ALLOWED_SIGNERS_PATH = "/home/agent/.config/moltnet/allowed_signers";
663
790
 
664
- export declare class GuestEnvironmentBoundaryError extends Error {
665
- readonly refusedNames: readonly string[];
666
- constructor(refusedNames: readonly string[]);
667
- }
791
+ export declare const GUEST_GITCONFIG_PATH = "/home/agent/.config/moltnet/gitconfig";
792
+
793
+ export declare const GUEST_SIGNER_SOCKET = "/run/moltnet/signer.sock";
794
+
795
+ export { GuestCredentialMode }
796
+
797
+ export { GuestEnvironmentBoundaryError }
668
798
 
669
799
  /**
670
800
  * Baseline env keys forwarded to host-exec child processes.
@@ -715,27 +845,13 @@ export declare interface InjectTaskContextArgs {
715
845
 
716
846
  export declare function isKernelTool(name: string): boolean;
717
847
 
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;
848
+ export { isResolvedPathInsideRoot }
727
849
 
728
850
  export declare function isToolVisible(name: string, policy?: ModelVisibleToolPolicy): boolean;
729
851
 
730
- export declare function loadCredentials(agentDir: string, mode?: GuestCredentialMode, onDiagnostic?: (diagnostic: VmDiagnostic) => void): VmCredentials;
852
+ export { loadCredentials }
731
853
 
732
- export declare interface ManagedVm {
733
- vm: VM;
734
- credentials: VmCredentials;
735
- mountPath: string;
736
- guestWorkspace: string;
737
- agentDir: string;
738
- }
854
+ export { ManagedVm }
739
855
 
740
856
  declare interface MatchedShellCommand {
741
857
  executable: string;
@@ -743,6 +859,13 @@ declare interface MatchedShellCommand {
743
859
  argvPrefixLength: number;
744
860
  }
745
861
 
862
+ export declare function materializePiBrokeredHttpSecrets(input: {
863
+ runtime: PiRuntimeDefinition;
864
+ context: Omit<PiBrokeredHttpSecretResolveContext, 'signal'>;
865
+ signal?: AbortSignal;
866
+ timeoutMs?: number;
867
+ }): Promise<BrokeredHttpSecretBinding[]>;
868
+
746
869
  export declare function materializePiExtensions(input: {
747
870
  runtime: PiRuntimeDefinition;
748
871
  context: PiToolContext;
@@ -849,6 +972,11 @@ export declare interface MoltNetToolsConfig {
849
972
  * entry creation behaves as before (env-derived diary, no auto-tags).
850
973
  */
851
974
  getTaskContext?(): MoltNetTaskContext | null;
975
+ /**
976
+ * Host-side signing capability, when the daemon injected one. Enables
977
+ * `signed: true` on `moltnet_create_entry`; the guest never sees the key.
978
+ */
979
+ getSigner?(): AgentSigningCapability | null;
852
980
  /** Records recoverable task-provenance failures without ending the task. */
853
981
  onTaskProvenanceEvent?(event: 'task.provenance.entry_denied', details: {
854
982
  taskId: string;
@@ -861,8 +989,31 @@ export declare function normalizeRetryTriageResult(value: unknown): PiRetryTriag
861
989
 
862
990
  export declare const PI_EXECUTOR_MANIFEST_VERSION: "moltnet:executor-manifest:v1";
863
991
 
992
+ /** Guest path where Pi expects its auth blob. */
993
+ export declare const PI_GUEST_AUTH_PATH = "/home/agent/.pi/agent/auth.json";
994
+
864
995
  export declare const PI_RUNTIME_DEFINITION_VERSION = "moltnet:pi-runtime:v1";
865
996
 
997
+ export declare interface PiBrokeredHttpSecretContribution {
998
+ readonly kind: 'brokered_http_secret';
999
+ readonly descriptor: BrokeredHttpSecretDescriptor;
1000
+ readonly resolve: (context: PiBrokeredHttpSecretResolveContext) => string | undefined | Promise<string | undefined>;
1001
+ }
1002
+
1003
+ export declare class PiBrokeredHttpSecretResolutionError extends Error {
1004
+ readonly requirementId: string;
1005
+ readonly retryable: boolean;
1006
+ constructor(requirementId: string, message: string, retryable: boolean);
1007
+ }
1008
+
1009
+ export declare interface PiBrokeredHttpSecretResolveContext {
1010
+ agentName: string;
1011
+ claimedTask: ClaimedTask;
1012
+ cwdPath: string;
1013
+ /** Cancelled when the attempt stops or the resolver exceeds its deadline. */
1014
+ signal: AbortSignal;
1015
+ }
1016
+
866
1017
  export declare interface PiExecutorManifest {
867
1018
  schemaVersion: typeof PI_EXECUTOR_MANIFEST_VERSION;
868
1019
  runtime: {
@@ -882,6 +1033,17 @@ export declare interface PiExecutorManifest {
882
1033
  templateFingerprint: string;
883
1034
  guestAssetBuildId: string;
884
1035
  };
1036
+ /** Optional v1 extension, emitted only when requirements are declared. */
1037
+ brokeredHttpSecrets?: {
1038
+ id: string;
1039
+ guestEnv: string;
1040
+ hosts: readonly string[];
1041
+ protocol: 'https' | 'http';
1042
+ ports: readonly number[];
1043
+ required: boolean;
1044
+ }[];
1045
+ /** Optional v1 extension, emitted only when capabilities are declared. */
1046
+ hostCapabilities?: HostCapabilityManifestEntry[];
885
1047
  tools: {
886
1048
  name: string;
887
1049
  descriptorCid: string | null;
@@ -930,6 +1092,13 @@ export declare interface PiOtelOptions {
930
1092
  onSessionContextChange?: (context: Context | undefined) => void;
931
1093
  }
932
1094
 
1095
+ /**
1096
+ * Pi's provider authentication as a sandbox `ProviderAuthSource`. CI writes
1097
+ * `auth.json` under `PI_CODING_AGENT_DIR`; local runs fall back to the
1098
+ * canonical `~/.pi/agent` dir when the override is unset.
1099
+ */
1100
+ export declare function piProviderAuth(): ProviderAuthSource;
1101
+
933
1102
  export declare type PiRetryTriage = (input: PiRetryTriageInput) => Promise<PiRetryTriageResult>;
934
1103
 
935
1104
  export declare type PiRetryTriageConfidence = RetryTriageConfidence;
@@ -968,6 +1137,10 @@ export declare interface PiRuntimeDefinition {
968
1137
  readonly version: string;
969
1138
  readonly runtimeKind: string;
970
1139
  readonly vm: GondolinTemplateDefinition;
1140
+ /** Optional v1 extension; absent on independently packaged legacy runtimes. */
1141
+ readonly brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
1142
+ /** Optional v1 extension: host capabilities served to the guest. */
1143
+ readonly hostCapabilities?: readonly HostCapabilityContribution<never>[];
971
1144
  readonly tools: readonly PiToolContribution[];
972
1145
  readonly extensions: readonly PiExtensionContribution[];
973
1146
  }
@@ -1074,6 +1247,10 @@ declare interface PiWorkspaceSeedPlan {
1074
1247
  source: 'producer';
1075
1248
  }
1076
1249
 
1250
+ export { prepareBrokeredHttpSecrets }
1251
+
1252
+ export { ProviderAuthSource }
1253
+
1077
1254
  export declare interface ProviderErrorRetryEvent extends Record<string, unknown> {
1078
1255
  event: 'provider_error_retry';
1079
1256
  retry: number;
@@ -1149,31 +1326,11 @@ declare interface ResolveSessionToolPolicyInput {
1149
1326
 
1150
1327
  export declare function resolveTaskWorktreePath(mainRepo: string, workspaceId: string): string;
1151
1328
 
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
- }
1329
+ export { ResumeCommand }
1173
1330
 
1174
1331
  /**
1175
- * Resume a VM from a checkpoint, inject credentials, configure egress +
1176
- * TLS. Returns the managed VM handle.
1332
+ * Resume a Gondolin VM for a Pi session. Identical to the sandbox package's
1333
+ * `resumeVm`, with Pi's provider auth supplied unless the caller overrides it.
1177
1334
  */
1178
1335
  export declare function resumeVm(config: VmConfig): Promise<ManagedVm>;
1179
1336
 
@@ -1204,6 +1361,20 @@ declare interface RuntimeInstructorSandbox {
1204
1361
  verifiedExecutables: readonly string[];
1205
1362
  allowedHosts: readonly string[];
1206
1363
  allowedInternalHosts: readonly string[];
1364
+ /** Guest names containing host-brokered opaque HTTP placeholders. */
1365
+ brokeredSecretEnvNames?: readonly string[];
1366
+ /** Host capabilities served to the guest (attested in the manifest). */
1367
+ hostCapabilities?: readonly {
1368
+ name: string;
1369
+ origin: string;
1370
+ operations: readonly string[];
1371
+ }[];
1372
+ /**
1373
+ * Guest credential mode. In `host-authenticated` the guest CLI carries no
1374
+ * identity credentials, so REST-backed CLI paths (e.g. `moltnet entry
1375
+ * create-signed`) cannot authenticate; host-side SDK tools must be used.
1376
+ */
1377
+ guestCredentialMode?: 'guest-config' | 'host-authenticated';
1207
1378
  }
1208
1379
 
1209
1380
  declare interface RuntimeInstructorToolPolicy {
@@ -1219,78 +1390,7 @@ declare interface RuntimeInstructorToolPolicy {
1219
1390
  degraded: boolean;
1220
1391
  }
1221
1392
 
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
- }
1393
+ export { SandboxConfig }
1294
1394
 
1295
1395
  /** The resolved allow-set + enforcement mode for a runtime session. */
1296
1396
  export declare interface SessionToolPolicy {
@@ -1317,8 +1417,7 @@ declare interface ShellCommandRule {
1317
1417
  argvPrefix: readonly [string, string, ...string[]];
1318
1418
  }
1319
1419
 
1320
- /** Extract snapshot-specific config for backwards compat with ensureSnapshot. */
1321
- export declare type SnapshotConfig = NonNullable<SandboxConfig['snapshot']>;
1420
+ export { SnapshotConfig }
1322
1421
 
1323
1422
  export declare interface SubagentToolHandle {
1324
1423
  /** ToolDefinition to register via `customTools` on the parent session. */
@@ -1423,76 +1522,11 @@ export declare type TurnEventHandlerFactory = (claimedTask: ClaimedTask) => Turn
1423
1522
 
1424
1523
  export declare type TurnEventKind = Parameters<TaskReporter['record']>[0]['kind'];
1425
1524
 
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
- }
1525
+ export { VmConfig }
1465
1526
 
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
- }
1527
+ export { VmCredentials }
1489
1528
 
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
- }
1529
+ export { VmDiagnostic }
1496
1530
 
1497
1531
  /**
1498
1532
  * Subset of `@earendil-works/gondolin`'s `VmFs` we actually use. We