@themoltnet/pi-runtime 0.11.0 → 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 +96 -0
  2. package/dist/index.js +1074 -711
  3. package/package.json +5 -5
package/dist/index.d.ts CHANGED
@@ -23,6 +23,9 @@ import { GrepToolDetails } from '@earendil-works/pi-coding-agent';
23
23
  import { GrepToolInput } from '@earendil-works/pi-coding-agent';
24
24
  import { GuestCredentialMode } from '@themoltnet/sandbox-gondolin';
25
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';
26
29
  import { isResolvedPathInsideRoot } from '@themoltnet/sandbox-gondolin';
27
30
  import { loadCredentials } from '@themoltnet/sandbox-gondolin';
28
31
  import { LoadSkillsResult } from '@earendil-works/pi-coding-agent';
@@ -55,6 +58,62 @@ import { WriteOperations } from '@earendil-works/pi-coding-agent';
55
58
 
56
59
  export { activateAgentEnv }
57
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
+
104
+ /**
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.
109
+ */
110
+ export declare const agentSigningCapability: HostCapabilityContribution<AgentSigningInjected>;
111
+
112
+ /** State the daemon injects for this capability. */
113
+ declare interface AgentSigningInjected {
114
+ signer: AgentSigningCapability;
115
+ }
116
+
58
117
  /** Minimal shape of the SDK method the resolver needs (keeps deps testable). */
59
118
  export declare interface AllowedToolsClient {
60
119
  runtimeProfiles: {
@@ -432,6 +491,7 @@ export declare interface DefinePiRuntimeOptions {
432
491
  runtimeKind?: string;
433
492
  vm: GondolinTemplateDefinition;
434
493
  brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
494
+ hostCapabilities?: readonly HostCapabilityContribution<never>[];
435
495
  tools?: readonly PiToolContribution[];
436
496
  extensions?: readonly PiExtensionContribution[];
437
497
  }
@@ -652,6 +712,15 @@ export declare interface ExecutePiTaskOptions {
652
712
  toolPolicyLogger?: ToolPolicyLogger;
653
713
  /** Trusted, statically imported operator runtime contributions. */
654
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;
655
724
  /**
656
725
  * Pre-resolved local VM template. Daemons resolve this before polling so
657
726
  * profile requirements and executor attestation can be checked before claim.
@@ -717,6 +786,12 @@ export declare interface GondolinTemplateResolveContext {
717
786
  onProgress?: (message: string) => void;
718
787
  }
719
788
 
789
+ export declare const GUEST_ALLOWED_SIGNERS_PATH = "/home/agent/.config/moltnet/allowed_signers";
790
+
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
+
720
795
  export { GuestCredentialMode }
721
796
 
722
797
  export { GuestEnvironmentBoundaryError }
@@ -897,6 +972,11 @@ export declare interface MoltNetToolsConfig {
897
972
  * entry creation behaves as before (env-derived diary, no auto-tags).
898
973
  */
899
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;
900
980
  /** Records recoverable task-provenance failures without ending the task. */
901
981
  onTaskProvenanceEvent?(event: 'task.provenance.entry_denied', details: {
902
982
  taskId: string;
@@ -962,6 +1042,8 @@ export declare interface PiExecutorManifest {
962
1042
  ports: readonly number[];
963
1043
  required: boolean;
964
1044
  }[];
1045
+ /** Optional v1 extension, emitted only when capabilities are declared. */
1046
+ hostCapabilities?: HostCapabilityManifestEntry[];
965
1047
  tools: {
966
1048
  name: string;
967
1049
  descriptorCid: string | null;
@@ -1057,6 +1139,8 @@ export declare interface PiRuntimeDefinition {
1057
1139
  readonly vm: GondolinTemplateDefinition;
1058
1140
  /** Optional v1 extension; absent on independently packaged legacy runtimes. */
1059
1141
  readonly brokeredHttpSecrets?: readonly PiBrokeredHttpSecretContribution[];
1142
+ /** Optional v1 extension: host capabilities served to the guest. */
1143
+ readonly hostCapabilities?: readonly HostCapabilityContribution<never>[];
1060
1144
  readonly tools: readonly PiToolContribution[];
1061
1145
  readonly extensions: readonly PiExtensionContribution[];
1062
1146
  }
@@ -1279,6 +1363,18 @@ declare interface RuntimeInstructorSandbox {
1279
1363
  allowedInternalHosts: readonly string[];
1280
1364
  /** Guest names containing host-brokered opaque HTTP placeholders. */
1281
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';
1282
1378
  }
1283
1379
 
1284
1380
  declare interface RuntimeInstructorToolPolicy {