@themoltnet/pi-runtime 0.11.0 → 0.12.1
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 +126 -21
- package/dist/index.js +1247 -794
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -21,8 +21,10 @@ import { FindOperations } from '@earendil-works/pi-coding-agent';
|
|
|
21
21
|
import { GONDOLIN_BASE_EXECUTABLES } from '@themoltnet/sandbox-gondolin';
|
|
22
22
|
import { GrepToolDetails } from '@earendil-works/pi-coding-agent';
|
|
23
23
|
import { GrepToolInput } from '@earendil-works/pi-coding-agent';
|
|
24
|
-
import { GuestCredentialMode } from '@themoltnet/sandbox-gondolin';
|
|
25
24
|
import { GuestEnvironmentBoundaryError } from '@themoltnet/sandbox-gondolin';
|
|
25
|
+
import { HostCapabilityContribution } from '@themoltnet/agent-runtime';
|
|
26
|
+
import { HostCapabilityEvidenceLogger } from '@themoltnet/agent-runtime';
|
|
27
|
+
import { HostCapabilityManifestEntry } from '@themoltnet/agent-runtime';
|
|
26
28
|
import { isResolvedPathInsideRoot } from '@themoltnet/sandbox-gondolin';
|
|
27
29
|
import { loadCredentials } from '@themoltnet/sandbox-gondolin';
|
|
28
30
|
import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
|
|
@@ -31,7 +33,6 @@ import { ManagedVm } from '@themoltnet/sandbox-gondolin';
|
|
|
31
33
|
import { Model } from '@earendil-works/pi-ai';
|
|
32
34
|
import { ModelRegistry } from '@earendil-works/pi-coding-agent';
|
|
33
35
|
import { prepareBrokeredHttpSecrets } from '@themoltnet/sandbox-gondolin';
|
|
34
|
-
import { ProviderAuthSource } from '@themoltnet/sandbox-gondolin';
|
|
35
36
|
import { Readable } from 'node:stream';
|
|
36
37
|
import { ReadOperations } from '@earendil-works/pi-coding-agent';
|
|
37
38
|
import { ResumeCommand } from '@themoltnet/sandbox-gondolin';
|
|
@@ -55,6 +56,62 @@ import { WriteOperations } from '@earendil-works/pi-coding-agent';
|
|
|
55
56
|
|
|
56
57
|
export { activateAgentEnv }
|
|
57
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Non-secret identity of the agent a daemon runs as. Everything here may be
|
|
61
|
+
* projected into a sandbox guest; nothing here can sign.
|
|
62
|
+
*/
|
|
63
|
+
declare interface AgentIdentity {
|
|
64
|
+
agentName: string;
|
|
65
|
+
identityId: string;
|
|
66
|
+
/** `ed25519:<base64>` */
|
|
67
|
+
publicKey: string;
|
|
68
|
+
fingerprint: string;
|
|
69
|
+
gitName: string;
|
|
70
|
+
gitEmail: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The seam between key storage and everything that needs a signature.
|
|
75
|
+
*
|
|
76
|
+
* Implementations hold (or proxy to) the Ed25519 identity key; consumers never
|
|
77
|
+
* see key material. The operations are purpose-bound on purpose: there is no
|
|
78
|
+
* "sign these bytes" method, so a broker exposing this interface cannot be
|
|
79
|
+
* turned into a general signing oracle.
|
|
80
|
+
*/
|
|
81
|
+
declare interface AgentSigningCapability {
|
|
82
|
+
readonly identity: AgentIdentity;
|
|
83
|
+
/** Sign a pending MoltNet signing request owned by this identity. */
|
|
84
|
+
signDiaryEntry(input: {
|
|
85
|
+
signingRequestId: string;
|
|
86
|
+
}): Promise<{
|
|
87
|
+
signingRequestId: string;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Sign a validated SSHSIG envelope in the `git` namespace. The enforceable
|
|
91
|
+
* boundary is the namespace, which covers every git object signature
|
|
92
|
+
* (commits and tags); it is not commit-only.
|
|
93
|
+
*/
|
|
94
|
+
signGitCommit(input: {
|
|
95
|
+
sshsig: Uint8Array;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
/** Raw 64-byte Ed25519 signature over the envelope. */
|
|
98
|
+
signature: Uint8Array;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Stock signing capability: the guest keeps `git commit -S` and
|
|
104
|
+
* `moltnet entry create-signed`; signatures are produced on the host through
|
|
105
|
+
* the injected `AgentSigningCapability`. The guest receives only the signer
|
|
106
|
+
* origin, an ssh-agent socket served by the CLI, and a non-secret gitconfig.
|
|
107
|
+
*/
|
|
108
|
+
export declare const agentSigningCapability: HostCapabilityContribution<AgentSigningInjected>;
|
|
109
|
+
|
|
110
|
+
/** State the daemon injects for this capability. */
|
|
111
|
+
declare interface AgentSigningInjected {
|
|
112
|
+
signer: AgentSigningCapability;
|
|
113
|
+
}
|
|
114
|
+
|
|
58
115
|
/** Minimal shape of the SDK method the resolver needs (keeps deps testable). */
|
|
59
116
|
export declare interface AllowedToolsClient {
|
|
60
117
|
runtimeProfiles: {
|
|
@@ -213,7 +270,10 @@ declare type ContextRef = {
|
|
|
213
270
|
content: string;
|
|
214
271
|
};
|
|
215
272
|
|
|
216
|
-
export declare function createGondolinBashOps(vm: VM, localCwd: string, guestWorkspace: string
|
|
273
|
+
export declare function createGondolinBashOps(vm: VM, localCwd: string, guestWorkspace: string, config: {
|
|
274
|
+
lifecycle: GondolinToolLifecycle;
|
|
275
|
+
retireVm: (retirement: GondolinVmRetirement) => Promise<void>;
|
|
276
|
+
}): BashOperations;
|
|
217
277
|
|
|
218
278
|
export declare function createGondolinEditOps(vm: VM, localCwd: string, guestWorkspace: string): EditOperations;
|
|
219
279
|
|
|
@@ -227,8 +287,14 @@ export declare function createGondolinToolDefinitions(config: {
|
|
|
227
287
|
vm: VM;
|
|
228
288
|
cwdPath: string;
|
|
229
289
|
guestWorkspace: string;
|
|
290
|
+
lifecycle: GondolinToolLifecycle;
|
|
291
|
+
retireVm: (retirement: GondolinVmRetirement) => Promise<void>;
|
|
230
292
|
}): ToolDefinition[];
|
|
231
293
|
|
|
294
|
+
export declare function createGondolinToolLifecycle(config?: {
|
|
295
|
+
onRetired?: (retirement: GondolinVmRetirement) => void;
|
|
296
|
+
}): GondolinToolLifecycle;
|
|
297
|
+
|
|
232
298
|
export declare function createGondolinWriteOps(vm: VM, localCwd: string, guestWorkspace: string): WriteOperations;
|
|
233
299
|
|
|
234
300
|
/**
|
|
@@ -432,6 +498,7 @@ export declare interface DefinePiRuntimeOptions {
|
|
|
432
498
|
runtimeKind?: string;
|
|
433
499
|
vm: GondolinTemplateDefinition;
|
|
434
500
|
brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
|
|
501
|
+
hostCapabilities?: readonly HostCapabilityContribution<never>[];
|
|
435
502
|
tools?: readonly PiToolContribution[];
|
|
436
503
|
extensions?: readonly PiExtensionContribution[];
|
|
437
504
|
}
|
|
@@ -467,8 +534,6 @@ export declare interface ExecutePiTaskOptions {
|
|
|
467
534
|
agentName: string;
|
|
468
535
|
/** Already-authenticated host-side Agent. Daemon callers always supply it. */
|
|
469
536
|
moltnetAgent?: Agent;
|
|
470
|
-
/** Explicit trust boundary for MoltNet credentials inside the guest. */
|
|
471
|
-
guestCredentialMode?: GuestCredentialMode;
|
|
472
537
|
/**
|
|
473
538
|
* Host root that owns `.moltnet/<agentName>/`.
|
|
474
539
|
*
|
|
@@ -652,6 +717,15 @@ export declare interface ExecutePiTaskOptions {
|
|
|
652
717
|
toolPolicyLogger?: ToolPolicyLogger;
|
|
653
718
|
/** Trusted, statically imported operator runtime contributions. */
|
|
654
719
|
runtimeDefinition?: PiRuntimeDefinition;
|
|
720
|
+
/**
|
|
721
|
+
* Host-side signing capability injected by the daemon for host capabilities
|
|
722
|
+
* (never built from key material inside the runtime).
|
|
723
|
+
*/
|
|
724
|
+
hostCapabilitySigner?: AgentSigningCapability;
|
|
725
|
+
/** Non-secret agent identity projected to the guest by host capabilities. */
|
|
726
|
+
agentIdentity?: AgentIdentity;
|
|
727
|
+
/** Evidence logger for host capability decisions (defaults to the tool-policy logger). */
|
|
728
|
+
hostCapabilityLogger?: HostCapabilityEvidenceLogger;
|
|
655
729
|
/**
|
|
656
730
|
* Pre-resolved local VM template. Daemons resolve this before polling so
|
|
657
731
|
* profile requirements and executor attestation can be checked before claim.
|
|
@@ -717,7 +791,33 @@ export declare interface GondolinTemplateResolveContext {
|
|
|
717
791
|
onProgress?: (message: string) => void;
|
|
718
792
|
}
|
|
719
793
|
|
|
720
|
-
export
|
|
794
|
+
export declare interface GondolinToolLifecycle {
|
|
795
|
+
assertActive(): void;
|
|
796
|
+
getRetirement(): GondolinVmRetirement | null;
|
|
797
|
+
markRetired(retirement: GondolinVmRetirement): void;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export declare class GondolinVmRetiredError extends Error {
|
|
801
|
+
readonly retirement: GondolinVmRetirement;
|
|
802
|
+
readonly code = "sandbox_retired";
|
|
803
|
+
constructor(retirement: GondolinVmRetirement, options?: ErrorOptions);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export declare interface GondolinVmRetirement {
|
|
807
|
+
backendRetired: boolean;
|
|
808
|
+
reason: 'backend-retired' | 'backend-retirement-failed';
|
|
809
|
+
trigger: GondolinVmRetirementTrigger;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export declare type GondolinVmRetirementTrigger = 'cancellation' | 'timeout';
|
|
813
|
+
|
|
814
|
+
export declare function guardGondolinToolDefinitions(tools: readonly ToolDefinition[], lifecycle: GondolinToolLifecycle): ToolDefinition[];
|
|
815
|
+
|
|
816
|
+
export declare const GUEST_ALLOWED_SIGNERS_PATH = "/home/agent/.config/moltnet/allowed_signers";
|
|
817
|
+
|
|
818
|
+
export declare const GUEST_GITCONFIG_PATH = "/home/agent/.config/moltnet/gitconfig";
|
|
819
|
+
|
|
820
|
+
export declare const GUEST_SIGNER_SOCKET = "/run/moltnet/signer.sock";
|
|
721
821
|
|
|
722
822
|
export { GuestEnvironmentBoundaryError }
|
|
723
823
|
|
|
@@ -897,6 +997,11 @@ export declare interface MoltNetToolsConfig {
|
|
|
897
997
|
* entry creation behaves as before (env-derived diary, no auto-tags).
|
|
898
998
|
*/
|
|
899
999
|
getTaskContext?(): MoltNetTaskContext | null;
|
|
1000
|
+
/**
|
|
1001
|
+
* Host-side signing capability, when the daemon injected one. Enables
|
|
1002
|
+
* `signed: true` on `moltnet_create_entry`; the guest never sees the key.
|
|
1003
|
+
*/
|
|
1004
|
+
getSigner?(): AgentSigningCapability | null;
|
|
900
1005
|
/** Records recoverable task-provenance failures without ending the task. */
|
|
901
1006
|
onTaskProvenanceEvent?(event: 'task.provenance.entry_denied', details: {
|
|
902
1007
|
taskId: string;
|
|
@@ -909,9 +1014,6 @@ export declare function normalizeRetryTriageResult(value: unknown): PiRetryTriag
|
|
|
909
1014
|
|
|
910
1015
|
export declare const PI_EXECUTOR_MANIFEST_VERSION: "moltnet:executor-manifest:v1";
|
|
911
1016
|
|
|
912
|
-
/** Guest path where Pi expects its auth blob. */
|
|
913
|
-
export declare const PI_GUEST_AUTH_PATH = "/home/agent/.pi/agent/auth.json";
|
|
914
|
-
|
|
915
1017
|
export declare const PI_RUNTIME_DEFINITION_VERSION = "moltnet:pi-runtime:v1";
|
|
916
1018
|
|
|
917
1019
|
export declare interface PiBrokeredHttpSecretContribution {
|
|
@@ -962,6 +1064,8 @@ export declare interface PiExecutorManifest {
|
|
|
962
1064
|
ports: readonly number[];
|
|
963
1065
|
required: boolean;
|
|
964
1066
|
}[];
|
|
1067
|
+
/** Optional v1 extension, emitted only when capabilities are declared. */
|
|
1068
|
+
hostCapabilities?: HostCapabilityManifestEntry[];
|
|
965
1069
|
tools: {
|
|
966
1070
|
name: string;
|
|
967
1071
|
descriptorCid: string | null;
|
|
@@ -1010,13 +1114,6 @@ export declare interface PiOtelOptions {
|
|
|
1010
1114
|
onSessionContextChange?: (context: Context | undefined) => void;
|
|
1011
1115
|
}
|
|
1012
1116
|
|
|
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
|
-
|
|
1020
1117
|
export declare type PiRetryTriage = (input: PiRetryTriageInput) => Promise<PiRetryTriageResult>;
|
|
1021
1118
|
|
|
1022
1119
|
export declare type PiRetryTriageConfidence = RetryTriageConfidence;
|
|
@@ -1057,6 +1154,8 @@ export declare interface PiRuntimeDefinition {
|
|
|
1057
1154
|
readonly vm: GondolinTemplateDefinition;
|
|
1058
1155
|
/** Optional v1 extension; absent on independently packaged legacy runtimes. */
|
|
1059
1156
|
readonly brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
|
|
1157
|
+
/** Optional v1 extension: host capabilities served to the guest. */
|
|
1158
|
+
readonly hostCapabilities?: readonly HostCapabilityContribution<never>[];
|
|
1060
1159
|
readonly tools: readonly PiToolContribution[];
|
|
1061
1160
|
readonly extensions: readonly PiExtensionContribution[];
|
|
1062
1161
|
}
|
|
@@ -1165,8 +1264,6 @@ declare interface PiWorkspaceSeedPlan {
|
|
|
1165
1264
|
|
|
1166
1265
|
export { prepareBrokeredHttpSecrets }
|
|
1167
1266
|
|
|
1168
|
-
export { ProviderAuthSource }
|
|
1169
|
-
|
|
1170
1267
|
export declare interface ProviderErrorRetryEvent extends Record<string, unknown> {
|
|
1171
1268
|
event: 'provider_error_retry';
|
|
1172
1269
|
retry: number;
|
|
@@ -1199,7 +1296,7 @@ export declare interface ResolvedGondolinTemplate {
|
|
|
1199
1296
|
resumeCommands: readonly ResumeCommand[];
|
|
1200
1297
|
}
|
|
1201
1298
|
|
|
1202
|
-
export declare function resolveHostExecBaseEnv(
|
|
1299
|
+
export declare function resolveHostExecBaseEnv(agentEnv: Readonly<Record<string, string | undefined>>): Set<string>;
|
|
1203
1300
|
|
|
1204
1301
|
/**
|
|
1205
1302
|
* Resolve the session's tool policy at start-up.
|
|
@@ -1245,8 +1342,10 @@ export declare function resolveTaskWorktreePath(mainRepo: string, workspaceId: s
|
|
|
1245
1342
|
export { ResumeCommand }
|
|
1246
1343
|
|
|
1247
1344
|
/**
|
|
1248
|
-
* Resume a Gondolin VM for a Pi session.
|
|
1249
|
-
*
|
|
1345
|
+
* Resume a Gondolin VM for a Pi session. The Pi coding-agent session and its
|
|
1346
|
+
* model calls run host-side (`createAgentSession` reads the host `~/.pi/agent`
|
|
1347
|
+
* auth), so the guest carries no provider auth — it only executes Gondolin
|
|
1348
|
+
* tools via `vm.exec`. This is a thin pass-through to the sandbox package.
|
|
1250
1349
|
*/
|
|
1251
1350
|
export declare function resumeVm(config: VmConfig): Promise<ManagedVm>;
|
|
1252
1351
|
|
|
@@ -1279,6 +1378,12 @@ declare interface RuntimeInstructorSandbox {
|
|
|
1279
1378
|
allowedInternalHosts: readonly string[];
|
|
1280
1379
|
/** Guest names containing host-brokered opaque HTTP placeholders. */
|
|
1281
1380
|
brokeredSecretEnvNames?: readonly string[];
|
|
1381
|
+
/** Host capabilities served to the guest (attested in the manifest). */
|
|
1382
|
+
hostCapabilities?: readonly {
|
|
1383
|
+
name: string;
|
|
1384
|
+
origin: string;
|
|
1385
|
+
operations: readonly string[];
|
|
1386
|
+
}[];
|
|
1282
1387
|
}
|
|
1283
1388
|
|
|
1284
1389
|
declare interface RuntimeInstructorToolPolicy {
|