@hachej/boring-agent 0.1.90 → 0.1.91

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 (36) hide show
  1. package/dist/{chunk-4PKGVPJA.js → chunk-2GBHYJVC.js} +27 -5
  2. package/dist/{chunk-5CYVBVP3.js → chunk-BHH5NH7P.js} +4766 -2153
  3. package/dist/{chunk-BEFJNMKQ.js → chunk-CJ2BW2W2.js} +23 -8
  4. package/dist/{chunk-F7ZS27HE.js → chunk-IWBC6SF7.js} +93 -19
  5. package/dist/chunk-NITBKFG6.js +1246 -0
  6. package/dist/{chunk-JEDRQAR5.js → chunk-PZC76CIA.js} +7 -1
  7. package/dist/core/index.d.ts +5 -5
  8. package/dist/core/index.js +2 -2
  9. package/dist/{createHarness-UCCGMVQJ.js → createHarness-PMYRKDE4.js} +2 -2
  10. package/dist/errors-BEmw9HMp.d.ts +200 -0
  11. package/dist/front/index.d.ts +20 -4
  12. package/dist/front/index.js +172 -44
  13. package/dist/{harness-Rbkdpvse.d.ts → harness-Bt_GMNYR.d.ts} +2 -2
  14. package/dist/{workspaceAgentDispatcher-50Uzuxhs.d.ts → lease-2aXepSBL.d.ts} +266 -57
  15. package/dist/{protocol-CDA4bcP9.d.ts → middleware-CzW8n7B7.d.ts} +20 -2
  16. package/dist/piChatEvent-DBO3M5lu.d.ts +367 -0
  17. package/dist/{piChatSessionService-DDKPOj4x.d.ts → piChatSessionService-BaaVWke7.d.ts} +5 -1
  18. package/dist/{sandbox-OEG_l9GE.d.ts → sandbox-DAD8cWQR.d.ts} +14 -1
  19. package/dist/server/agent-host/testing/gatewayConformance.d.ts +41 -0
  20. package/dist/server/agent-host/testing/gatewayConformance.js +465 -0
  21. package/dist/server/index.d.ts +451 -528
  22. package/dist/server/index.js +43 -9
  23. package/dist/server/worker/index.d.ts +2 -2
  24. package/dist/server/worker/index.js +7 -7
  25. package/dist/shared/index.d.ts +109 -41
  26. package/dist/shared/index.js +65 -282
  27. package/dist/types-jcMapYr9.d.ts +759 -0
  28. package/docs/ACCESSIBILITY.md +4 -5
  29. package/docs/API.md +3 -0
  30. package/docs/AUTHORING.md +68 -0
  31. package/docs/ERROR_CODES.md +27 -6
  32. package/docs/README.md +1 -0
  33. package/package.json +17 -8
  34. package/dist/chunk-CFQQXJKK.js +0 -385
  35. package/dist/chunk-DGRKMMXO.js +0 -8
  36. package/dist/piChatEvent-CHgln6yx.d.ts +0 -367
@@ -1,20 +1,25 @@
1
- import { F as FileSearch, C as CompiledAgentBundle, S as Sha256Digest, A as AgentDeployment, a as ShareEntryStore, P as PluginRestartWarning, W as WorkspaceAgentDispatcherContext, b as WorkspaceAgentDispatcher } from '../workspaceAgentDispatcher-50Uzuxhs.js';
2
- import { W as Workspace, a as WorkspaceRuntimeContext, S as Sandbox, E as ExecOptions, b as ExecResult, c as WorkspaceChangeEvent } from '../sandbox-OEG_l9GE.js';
3
- import { T as ToolReadinessRequirement, s as TelemetrySink, t as AgentConfig, b as Agent, u as AgentTool, d as AgentActor, j as AgentEvent, v as AgentHarnessFactory } from '../harness-Rbkdpvse.js';
4
- export { w as AgentHarnessFactoryInput } from '../harness-Rbkdpvse.js';
5
- import { RuntimeHostOperations } from '@hachej/boring-bash/agent';
6
- import { CreateNodeWorkspaceOptions, BoringAgentRuntimePaths } from '@hachej/boring-sandbox/providers/node-workspace';
7
- import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, b as RemoteWorkerExecRequest } from '../protocol-CDA4bcP9.js';
8
- export { c as REMOTE_WORKER_PROVIDER, d as REMOTE_WORKER_RUNTIME_CWD, e as RemoteWorkerErrorPayload, f as RemoteWorkerExecResponse, g as RemoteWorkerFsEventEnvelope, W as WORKER_INTERNAL_TOKEN_HEADER, h as WORKER_REQUEST_ID_HEADER, i as WORKER_WORKSPACE_ID_HEADER } from '../protocol-CDA4bcP9.js';
1
+ import { P as ProvisionWorkspaceRuntimeOptions, W as WorkspaceProvisioningResult, R as RuntimeModeAdapter, a as RuntimeModeId, B as BuiltinRuntimeModeId, b as AgentRuntimeHostOperations, c as RuntimeBashStrategy, d as RuntimeFilesystemStrategy, M as ModeContext, e as WorkspaceProvisioningAdapter, f as RuntimeBundle, g as PiHarnessOptions, h as AgentMeteringSink, i as RuntimeFilesystemBinding, j as MeteringErrorLogger, k as ReadyStatusTracker, l as ResolvedAgentRuntimeScope, C as CreateAgentHostOptions, m as CompiledAgentHostAgentSpec, n as AgentRequestLedger, o as AgentEffectAdmission, p as AgentRequestKey, q as CreatedAgentHost, r as AgentFleetCompiler, A as AgentGatewayEffect, s as AgentRequestTarget, t as AgentRequestLedgerRecord, u as AgentRequestFailure, v as AgentHostLegacyRoutePolicy } from '../types-jcMapYr9.js';
2
+ export { w as AgentHostAddressedHttpProjectionOptions, x as AgentHostAgentSpec, y as AgentHostDescription, z as AgentHostHandle, D as AgentHostHttpProjectionOptions, E as AgentHostLegacyHttpProjectionOptions, F as AgentHostLegacyProjectionComposition, G as AgentHostLegacyProjectionLifecycle, H as AgentHostLegacyProjectionRuntime, I as AgentHostLegacyRoutePolicyMountInput, J as ConfiguredAgentHostAgentSpec, L as LegacyDefaultAgentHostSpec, K as MeteringReleaseInput, N as MeteringReleaseReason, O as MeteringReservationResult, Q as MeteringReserveInput, S as MeteringRunKind, T as MeteringRunScope, U as MeteringRunStatus, V as MeteringSettleInput, X as MeteringUsage, Y as MeteringUsageInput, Z as PI_PACKAGE_RESOURCE_FILTERS, _ as PiExtensionFactory, $ as PiPackageSource, a0 as PluginSkillSource, a1 as ResolvedEnvironmentScope, a2 as RuntimeFilesystemBindingOperations, a3 as RuntimeNodePackageSpec, a4 as RuntimeProvisioningContribution, a5 as RuntimePythonSpec, a6 as RuntimeTemplateContribution, a7 as WorkspaceProvisioningExecResult, a8 as compactPiPackages, a9 as createResourceSettingsManager, aa as mergePiPackageSources, ab as normalizeMeteringUsage, ac as piPackageSourceKey } from '../types-jcMapYr9.js';
3
+ import { E as ExecOptions, a as ExecResult, W as WorkspaceChangeEvent, b as Workspace, S as Sandbox } from '../sandbox-DAD8cWQR.js';
4
+ import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, b as RemoteWorkerExecRequest } from '../middleware-CzW8n7B7.js';
5
+ export { c as REMOTE_WORKER_PROVIDER, d as REMOTE_WORKER_RUNTIME_CWD, e as RemoteWorkerErrorPayload, f as RemoteWorkerExecResponse, g as RemoteWorkerFsEventEnvelope, W as WORKER_INTERNAL_TOKEN_HEADER, h as WORKER_REQUEST_ID_HEADER, i as WORKER_WORKSPACE_ID_HEADER, j as createAgentAuthMiddleware } from '../middleware-CzW8n7B7.js';
9
6
  import { SandboxProviderV1, WorkspaceSandboxPairV1 } from '@hachej/boring-sandbox/shared';
10
- import { E as ErrorCode, l as SessionCtx, m as ChatModelSelection } from '../piChatEvent-CHgln6yx.js';
7
+ import { S as SandboxHandleStore, C as CompiledAgentBundle, a as Sha256Digest, A as AgentDeployment, b as ShareEntryStore, P as PluginRestartWarning, W as WorkspaceAgentDispatcherContext, c as WorkspaceAgentDispatcher, d as ProviderId, e as CredentialFieldId, R as ResolvedCredentialMaterialV1, f as AuthorizedWorkspaceCredentialScopeV1, V as VerifiedWorkspaceCredentialAuthorityV1, g as WorkspaceCredentialAuthorityVerifierV1, h as CredentialConsumerBindingRegistryV1, i as ProviderRegistryV1, j as WorkspaceCredentialResolverV1, k as ProviderCredentialRefV1, l as ResolvedCredentialLeaseV1 } from '../lease-2aXepSBL.js';
8
+ import { s as AgentConfig, b as Agent, d as AgentActor, j as AgentEvent, t as AgentTool, u as AgentHarnessFactory, T as TelemetrySink, A as AgentHarness } from '../harness-Bt_GMNYR.js';
9
+ export { v as AgentHarnessFactoryInput } from '../harness-Bt_GMNYR.js';
10
+ import { b as PiChatEvent, E as ErrorCode, l as SessionCtx, S as SessionStore, m as SessionListOptions, k as SessionSummary, n as PiChatSnapshot, c as PromptPayload, d as PromptReceipt, F as FollowUpPayload, e as FollowUpReceipt, f as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, i as StopPayload, j as StopReceipt } from '../piChatEvent-DBO3M5lu.js';
11
+ import { A as AgentGateway, a as AuthorizedAgentScope, b as AgentSessionRef, c as AgentSessionActivity, V as VerifiedAgentScopeClaim, d as AgentSessionSummary, e as AgentSessionStateSnapshot, f as AgentSessionConnection, J as JsonValue, g as AgentGatewayErrorDTO } from '../errors-BEmw9HMp.js';
11
12
  import { IncomingMessage, ServerResponse } from 'node:http';
12
13
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
14
  import { FastifyRequest, FastifyInstance, FastifyPluginAsync } from 'fastify';
14
- import { PackageSource, ExtensionFactory, SettingsManager } from '@mariozechner/pi-coding-agent';
15
- import { a as AgentEffectAdmission } from '../piChatSessionService-DDKPOj4x.js';
15
+ import { i as PiSessionRequestContext, g as PiChatSessionService, h as PiSessionCreateInit, e as PiChatEventSubscriber, P as PiChatEventStreamResult, a as AgentEffectAdmission$1 } from '../piChatSessionService-BaaVWke7.js';
16
+ import { BoringAgentRuntimePaths } from '@hachej/boring-sandbox/providers/node-workspace';
17
+ import '@hachej/boring-bash/agent';
18
+ import '@mariozechner/pi-coding-agent';
16
19
  import 'zod';
17
20
 
21
+ declare function provisionWorkspaceRuntime(opts: ProvisionWorkspaceRuntimeOptions): Promise<WorkspaceProvisioningResult>;
22
+
18
23
  /**
19
24
  * uv setup for Python-family runtimes (e.g. Vercel `python3.13`), which already
20
25
  * ship `pip` and usually `uv`. Verify-or-install via the on-PATH `uv`.
@@ -50,364 +55,6 @@ declare function prepareDeploymentSnapshot(provider: DeploymentSnapshotProvider,
50
55
 
51
56
  declare function resolveWorkspaceRoot(defaultRoot?: string): string;
52
57
 
53
- type ReadyState = 'provisioning' | 'ready' | 'degraded';
54
- type CapabilityState = 'not-started' | 'preparing' | 'ready' | 'failed';
55
- interface CapabilityReadinessDetail {
56
- state: CapabilityState;
57
- requirement?: ToolReadinessRequirement;
58
- startedAt?: string;
59
- completedAt?: string;
60
- errorCode?: string;
61
- causeCode?: string;
62
- retryable?: boolean;
63
- message?: string;
64
- }
65
- interface AgentCapabilityReadiness {
66
- chat: CapabilityReadinessDetail;
67
- workspace: CapabilityReadinessDetail;
68
- runtimeDependencies: CapabilityReadinessDetail;
69
- }
70
- interface ReadyStatusEvent {
71
- state: ReadyState;
72
- sandboxReady: boolean;
73
- harnessReady: boolean;
74
- capabilities: AgentCapabilityReadiness;
75
- message?: string;
76
- timestamp: string;
77
- }
78
- interface ReadinessSnapshot {
79
- sandboxReady: boolean;
80
- harnessReady: boolean;
81
- capabilities: AgentCapabilityReadiness;
82
- degradedReason?: string;
83
- }
84
- type StatusHandler = (event: ReadyStatusEvent) => void;
85
- declare class ReadyStatusTracker {
86
- private _sandboxReady;
87
- private _harnessReady;
88
- private _degradedReason?;
89
- private _capabilities;
90
- private subscribers;
91
- constructor(opts?: {
92
- sandboxReady?: boolean;
93
- harnessReady?: boolean;
94
- capabilities?: Partial<AgentCapabilityReadiness>;
95
- });
96
- get state(): ReadyState;
97
- isReady(): boolean;
98
- getReadiness(): ReadinessSnapshot;
99
- getCapabilities(): AgentCapabilityReadiness;
100
- updateCapability(name: keyof AgentCapabilityReadiness, detail: CapabilityReadinessDetail): void;
101
- updateRuntimeDependencies(detail: CapabilityReadinessDetail): void;
102
- markSandboxReady(): void;
103
- markHarnessReady(): void;
104
- markDegraded(reason: string): void;
105
- clearDegraded(): void;
106
- subscribe(handler: StatusHandler): () => void;
107
- private emit;
108
- private snapshot;
109
- }
110
-
111
- /**
112
- * Host-owned values used by Agent's provider-neutral runtime composition.
113
- *
114
- * The concrete implementation lives outside packages/agent/src so Agent can
115
- * consume an injected Workspace + Sandbox pair without importing provider
116
- * runtime values.
117
- */
118
- interface AgentRuntimeHostOperations extends RuntimeHostOperations {
119
- createNodeWorkspace(root: string, options?: CreateNodeWorkspaceOptions): Workspace;
120
- getNodeWorkspaceHostRoot(workspace: Workspace): string | undefined;
121
- getBoringAgentRuntimePaths(workspaceRoot: string): BoringAgentRuntimePaths;
122
- getBoringAgentRuntimeEnv(paths: BoringAgentRuntimePaths, cacheRoot?: string): Record<string, string>;
123
- getBoringAgentPathEntries(paths: BoringAgentRuntimePaths): string[];
124
- readonly runtimeLayout: Readonly<{
125
- agentDir: string;
126
- runtimeDirNames: readonly string[];
127
- gitignoreContent: string;
128
- }>;
129
- validatePath(root: string, requestedPath: string): string;
130
- assertRealPathWithinWorkspace(root: string, targetPath: string): Promise<void>;
131
- isIgnoredDirName(name: string): boolean;
132
- }
133
-
134
- interface ProvisioningLogger {
135
- info?(message: string, fields?: Record<string, unknown>): void;
136
- warn?(message: string, fields?: Record<string, unknown>): void;
137
- error?(message: string, fields?: Record<string, unknown>): void;
138
- }
139
-
140
- interface PluginSkillSource {
141
- name: string;
142
- source: string | URL;
143
- }
144
- interface RuntimeTemplateContribution$1 {
145
- id: string;
146
- path: string | URL;
147
- target?: string;
148
- }
149
- interface RuntimePythonSpec$1 {
150
- id: string;
151
- projectFile: string | URL;
152
- packageName?: string;
153
- packageRoot?: string | URL;
154
- version?: string;
155
- extraLibs?: string[];
156
- env?: Record<string, string | URL>;
157
- expectedBins?: string[];
158
- }
159
- interface RuntimeNodePackageSpec$1 {
160
- id: string;
161
- packageName: string;
162
- packageRoot?: string | URL;
163
- version?: string;
164
- expectedBins?: string[];
165
- }
166
- interface RuntimeProvisioningContribution$1 {
167
- templateDirs?: RuntimeTemplateContribution$1[];
168
- python?: RuntimePythonSpec$1[];
169
- nodePackages?: RuntimeNodePackageSpec$1[];
170
- }
171
- interface WorkspaceProvisioningResult {
172
- changed: boolean;
173
- env: Record<string, string>;
174
- pathEntries: string[];
175
- skillPaths: string[];
176
- }
177
- interface WorkspaceProvisioningExecResult {
178
- stdout?: string;
179
- stderr?: string;
180
- }
181
- interface ResolveInstallSourceOpts {
182
- kind: 'node' | 'python';
183
- id: string;
184
- fingerprint: string;
185
- }
186
- interface WorkspaceProvisioningAdapter {
187
- mode: 'direct' | 'local' | 'vercel-sandbox';
188
- exec(command: string, args: string[], opts?: {
189
- cwd?: string;
190
- env?: Record<string, string>;
191
- timeoutMs?: number;
192
- }): Promise<WorkspaceProvisioningExecResult | void>;
193
- resolveInstallSource(source: string | URL, opts: ResolveInstallSourceOpts): Promise<string>;
194
- workspaceFs: {
195
- exists(workspaceRelativePath: string): Promise<boolean>;
196
- /** Remove a workspace-relative generated path. Missing path is success. */
197
- rm(workspaceRelativePath: string): Promise<void>;
198
- /** Create a workspace-relative directory recursively. */
199
- mkdir(workspaceRelativePath: string): Promise<void>;
200
- writeText(workspaceRelativePath: string, content: string): Promise<void>;
201
- readText(workspaceRelativePath: string): Promise<string | null>;
202
- /** Copy a host file or directory into the workspace; directory copies are recursive. */
203
- copyFromHost(hostSourcePath: string | URL, workspaceRelativeTarget: string): Promise<void>;
204
- };
205
- getRuntimeCacheRoot(): string;
206
- }
207
- interface ProvisioningTelemetryContext {
208
- workspaceId?: string;
209
- sessionId?: string;
210
- requestId?: string;
211
- runtimeMode?: string;
212
- }
213
- interface ProvisionWorkspaceRuntimeOptions {
214
- plugins: Array<{
215
- id: string;
216
- skills?: PluginSkillSource[];
217
- provisioning?: RuntimeProvisioningContribution$1;
218
- }>;
219
- adapter: WorkspaceProvisioningAdapter;
220
- runtimeLayout: BoringAgentRuntimePaths;
221
- runtimeHost: AgentRuntimeHostOperations;
222
- logger?: ProvisioningLogger;
223
- telemetry?: TelemetrySink;
224
- telemetryContext?: ProvisioningTelemetryContext;
225
- }
226
-
227
- declare function provisionWorkspaceRuntime(opts: ProvisionWorkspaceRuntimeOptions): Promise<WorkspaceProvisioningResult>;
228
-
229
- type BuiltinRuntimeModeId = 'direct' | 'local' | 'vercel-sandbox';
230
- type RuntimeModeId = BuiltinRuntimeModeId | (string & {});
231
- interface RuntimeModeReadinessHooks {
232
- initialSandboxReady?: boolean;
233
- initialWorkspaceReadiness?: CapabilityReadinessDetail;
234
- onTrackerCreated?: (tracker: ReadyStatusTracker) => void;
235
- }
236
- type RuntimeCachedBindingHealthCheckResult = {
237
- state: 'ok';
238
- } | {
239
- state: 'recreate';
240
- message?: string;
241
- error?: unknown;
242
- };
243
- interface RuntimeCachedBindingHealthCheck {
244
- intervalMs?: number;
245
- check(ctx: {
246
- runtimeBundle: RuntimeBundle;
247
- workspaceId: string;
248
- }): Promise<RuntimeCachedBindingHealthCheckResult>;
249
- }
250
- type RuntimeBashStrategy = {
251
- kind: 'host';
252
- preserveHostHome?: boolean;
253
- } | {
254
- kind: 'local-sandbox';
255
- sandboxRoot: string;
256
- } | {
257
- kind: 'remote';
258
- defaultPath?: string;
259
- };
260
- interface RuntimeRemoteWorkspacePathOptions {
261
- rootAliases?: string[];
262
- toRemotePath?: (value: string) => string;
263
- toRuntimePath?: (value: string) => string;
264
- sanitizeErrorText?: (value: string) => string;
265
- }
266
- type RuntimeFilesystemStrategy = {
267
- kind: 'host';
268
- } | {
269
- kind: 'remote-workspace';
270
- pathOptions?: RuntimeRemoteWorkspacePathOptions;
271
- };
272
- interface RuntimeModeAdapter {
273
- readonly id: RuntimeModeId;
274
- readonly runtimeHost?: AgentRuntimeHostOperations;
275
- /**
276
- * Declares whether the workspace files are strongly available on the host
277
- * path before create() runs. Composition layers use this to decide whether
278
- * host-side fs checks/prompts are safe without hard-coding sandbox IDs.
279
- */
280
- readonly workspaceFsCapability?: Workspace['fsCapability'];
281
- readonly readiness?: RuntimeModeReadinessHooks;
282
- readonly cachedBindingHealthCheck?: RuntimeCachedBindingHealthCheck;
283
- create(ctx: ModeContext): Promise<RuntimeBundle>;
284
- getRuntimeLayoutRoot?(ctx: ModeContext): string;
285
- evictCachedRuntime?(ctx: {
286
- workspaceId: string;
287
- }): void | Promise<void>;
288
- dispose?(): Promise<void>;
289
- }
290
- interface ModeContext {
291
- workspaceRoot: string;
292
- sessionId: string;
293
- workspaceId?: string;
294
- templatePath?: string;
295
- requestId?: string;
296
- telemetry?: TelemetrySink;
297
- }
298
- interface RuntimeFilesystemBindingOperations {
299
- read(descriptor: {
300
- filesystem: string;
301
- path: string;
302
- }): Promise<{
303
- content: string;
304
- mtimeMs?: number;
305
- metadata?: unknown;
306
- }>;
307
- list(descriptor: {
308
- filesystem: string;
309
- path: string;
310
- }): Promise<{
311
- entries: string[];
312
- metadata?: unknown;
313
- }>;
314
- find(descriptor: {
315
- filesystem: string;
316
- path: string;
317
- }, pattern: string, options?: {
318
- limit?: number;
319
- offset?: number;
320
- }): Promise<{
321
- paths: string[];
322
- metadata?: unknown;
323
- }>;
324
- grep(descriptor: {
325
- filesystem: string;
326
- path: string;
327
- }, pattern: string, options?: {
328
- limit?: number;
329
- offset?: number;
330
- }): Promise<{
331
- matches: Array<{
332
- path: string;
333
- line: number;
334
- text: string;
335
- }>;
336
- metadata?: unknown;
337
- }>;
338
- stat(descriptor: {
339
- filesystem: string;
340
- path: string;
341
- }): Promise<{
342
- isDirectory: boolean;
343
- metadata?: unknown;
344
- }>;
345
- write?(descriptor: {
346
- filesystem: string;
347
- path: string;
348
- content: string;
349
- expectedMtimeMs?: number;
350
- }): Promise<{
351
- mtimeMs?: number;
352
- metadata?: unknown;
353
- }>;
354
- delete?(descriptor: {
355
- filesystem: string;
356
- path: string;
357
- }): Promise<{
358
- metadata?: unknown;
359
- }>;
360
- move?(descriptor: {
361
- filesystem: string;
362
- from: string;
363
- to: string;
364
- }): Promise<{
365
- metadata?: unknown;
366
- }>;
367
- mkdir?(descriptor: {
368
- filesystem: string;
369
- path: string;
370
- recursive?: boolean;
371
- }): Promise<{
372
- metadata?: unknown;
373
- }>;
374
- rejectMutation(operation: string, descriptor: {
375
- filesystem: string;
376
- path: string;
377
- }): never;
378
- }
379
- interface RuntimeFilesystemBinding {
380
- readonly filesystem: string;
381
- readonly access: 'readonly' | 'readwrite';
382
- readonly operations: RuntimeFilesystemBindingOperations;
383
- }
384
- interface RuntimeBundle {
385
- runtimeContext?: WorkspaceRuntimeContext;
386
- /**
387
- * Server-private host/storage root for host-side filesystem work. Do not use
388
- * this as the agent-visible cwd; Workspace.root remains the public runtime
389
- * namespace shown to tools/model.
390
- */
391
- storageRoot?: string;
392
- workspace: Workspace;
393
- sandbox: Sandbox;
394
- fileSearch: FileSearch;
395
- /** Host-owned provider utilities injected at the application boundary. */
396
- runtimeHost?: AgentRuntimeHostOperations;
397
- /** Optional per-execution runtime env provider for local/direct operations that do not call Sandbox.exec. */
398
- getRuntimeEnv?: () => Promise<Record<string, string>>;
399
- /** Runtime-owned bash execution strategy, consumed by the agent bash tool builder. */
400
- bash?: RuntimeBashStrategy;
401
- /** Runtime-owned filesystem strategy, consumed by the agent filesystem tool builder. */
402
- filesystem?: RuntimeFilesystemStrategy;
403
- /** Optional filesystem bindings prepared for this runtime/session. */
404
- filesystemBindings?: RuntimeFilesystemBinding[];
405
- /** Provisioning operations derived from this bundle's acquired Workspace + Sandbox pair. */
406
- provisioningAdapter?: WorkspaceProvisioningAdapter;
407
- /** Idempotently releases the acquired Workspace + Sandbox pair. */
408
- disposeRuntime?: () => Promise<void>;
409
- }
410
-
411
58
  interface RemoteWorkerClientOptions {
412
59
  baseUrl: string;
413
60
  token: string;
@@ -559,6 +206,44 @@ interface ProviderRuntimeModeAdapterOptions {
559
206
  }
560
207
  declare function createProviderRuntimeModeAdapter(options: ProviderRuntimeModeAdapterOptions): RuntimeModeAdapter;
561
208
 
209
+ declare const sandboxRuntimeHostOperations: AgentRuntimeHostOperations;
210
+ interface SandboxRuntimeModeOptions {
211
+ readonly sandboxHandleStore?: SandboxHandleStore;
212
+ }
213
+ /** Built-in runtime layout root without exposing provider package constants to consumers. */
214
+ declare function resolveBuiltinRuntimeLayoutRoot(mode: BuiltinRuntimeModeId, workspaceRoot: string): string;
215
+ declare function createSandboxRuntimeModeAdapter(mode: BuiltinRuntimeModeId, options?: SandboxRuntimeModeOptions): RuntimeModeAdapter;
216
+
217
+ interface EventStreamReadResult {
218
+ events: Array<{
219
+ data: unknown;
220
+ offset: string;
221
+ }>;
222
+ nextOffset: string;
223
+ upToDate: boolean;
224
+ closed: boolean;
225
+ }
226
+ interface EventStreamMeta {
227
+ nextOffset: string;
228
+ closed: boolean;
229
+ }
230
+ interface EventStreamStore {
231
+ createStream(path: string): Promise<void>;
232
+ appendEvent(path: string, event: unknown): Promise<string>;
233
+ appendEventOnce(path: string, key: string, event: unknown): Promise<string>;
234
+ appendAgentEvent(sessionId: string, chunk: PiChatEvent, opts?: {
235
+ idempotencyKey?: string;
236
+ streamPath?: string;
237
+ }): Promise<string>;
238
+ readEvents(path: string, opts?: {
239
+ offset?: string;
240
+ limit?: number;
241
+ }): Promise<EventStreamReadResult>;
242
+ closeStream(path: string): Promise<void>;
243
+ getStreamMeta(path: string): Promise<EventStreamMeta | null>;
244
+ subscribe(path: string, listener: () => void): () => void;
245
+ }
246
+
562
247
  declare function createAgent(config: AgentConfig): Agent;
563
248
 
564
249
  type AgentDirectoryCompilerErrorCode = 'AGENT_DIRECTORY_NOT_FOUND' | 'AGENT_DIRECTORY_NOT_DIRECTORY' | 'AGENT_MANIFEST_NOT_FOUND' | 'AGENT_MANIFEST_NOT_FILE' | 'AGENT_MANIFEST_INVALID_UTF8' | 'AGENT_MANIFEST_INVALID_JSON' | 'AGENT_ASSET_NOT_FOUND' | 'AGENT_ASSET_NOT_FILE' | 'AGENT_ASSET_INVALID_UTF8' | 'AGENT_PATH_SYMLINK_ESCAPE' | 'AGENT_PATH_CHANGED_DURING_READ' | 'AGENT_DIRECTORY_IO_FAILED';
@@ -577,21 +262,18 @@ declare class AgentDirectoryCompilerError extends Error {
577
262
  }
578
263
  declare function compileAgentDirectory(directory: string): Promise<CompiledAgentBundle>;
579
264
 
580
- type AuthoredAgentMaterializationErrorCode = Extract<ErrorCode, 'AUTHORED_AGENT_ID_INVALID' | 'AUTHORED_AGENT_TYPE_MISMATCH' | 'AUTHORED_AGENT_CATALOG_REQUIRED' | 'AUTHORED_AGENT_CATALOG_INVALID' | 'AUTHORED_AGENT_REFERENCE_UNKNOWN' | 'AUTHORED_AGENT_REFERENCE_UNSUPPORTED' | 'AUTHORED_AGENT_TOOL_INVALID' | 'AUTHORED_AGENT_TOOL_COLLISION'>;
581
- type MaterializedAgentSourceV1 = Readonly<{
265
+ type AuthoredAgentMaterializationErrorCode = Extract<ErrorCode, 'AUTHORED_AGENT_ID_INVALID' | 'AUTHORED_AGENT_TYPE_MISMATCH' | 'AUTHORED_AGENT_REFERENCE_UNSUPPORTED'>;
266
+ type AuthoredAgentSourceV1 = Readonly<{
582
267
  schemaVersion: 1;
583
268
  agentTypeId: string;
584
269
  version: string;
585
270
  label?: string;
271
+ description?: string;
586
272
  instructions: string;
587
- tools: readonly AgentTool[];
588
- declaredToolRefs: readonly string[];
589
273
  }>;
590
- type AuthoredAgentToolCatalog = ReadonlyMap<string, AgentTool>;
591
274
  interface MaterializeAgentDirectoryInput {
592
275
  directory: string;
593
276
  expectedAgentTypeId?: string;
594
- toolCatalog?: AuthoredAgentToolCatalog;
595
277
  }
596
278
  declare class AuthoredAgentMaterializationError extends Error {
597
279
  readonly code: AuthoredAgentMaterializationErrorCode;
@@ -602,7 +284,11 @@ declare class AuthoredAgentMaterializationError extends Error {
602
284
  message: string;
603
285
  });
604
286
  }
605
- declare function materializeAgentDirectory(input: MaterializeAgentDirectoryInput): Promise<MaterializedAgentSourceV1>;
287
+ /**
288
+ * Loads declarative authored identity, safe metadata, and instructions.
289
+ * Executable behavior is selected only by trusted host/plugin policy.
290
+ */
291
+ declare function materializeAgentDirectory(input: MaterializeAgentDirectoryInput): Promise<AuthoredAgentSourceV1>;
606
292
 
607
293
  interface ResolvedAgentDigestInput {
608
294
  readonly workspaceId: string;
@@ -725,7 +411,13 @@ interface ManagedAgentCollectArtifactsInput {
725
411
  events: readonly AgentEvent[];
726
412
  }
727
413
  interface ManagedAgentMcpDelegateOptions {
728
- agent?: Agent;
414
+ gateway?: AgentGateway;
415
+ agentTypeId?: string;
416
+ resolveGatewayScope?(input: {
417
+ brief: string;
418
+ ctx: SessionCtx;
419
+ request: ManagedAgentDelegateRequestContext;
420
+ }): AuthorizedAgentScope | Promise<AuthorizedAgentScope>;
729
421
  resolveSessionCtx(input: {
730
422
  brief: string;
731
423
  request: ManagedAgentDelegateRequestContext;
@@ -774,7 +466,7 @@ declare class ManagedAgentMcpDelegateController {
774
466
  private resolveSessionCtx;
775
467
  private resolveWorkspace;
776
468
  private resolveRunnerWorkspace;
777
- private createAgentDelegateRunner;
469
+ private createGatewayDelegateRunner;
778
470
  private assertNotAborted;
779
471
  private stopDelegatedSession;
780
472
  private resolveActor;
@@ -863,150 +555,6 @@ interface RuntimeEnvContribution {
863
555
  getEnv(ctx: RuntimeEnvContributionContext): Record<string, string> | Promise<Record<string, string>>;
864
556
  }
865
557
 
866
- type PiPackageSource = PackageSource;
867
- declare const PI_PACKAGE_RESOURCE_FILTERS: readonly ["extensions", "skills", "prompts", "themes"];
868
- declare function piPackageSourceKey(source: PiPackageSource): string;
869
- declare function compactPiPackages(sources: Array<PiPackageSource | undefined>): PiPackageSource[];
870
- declare function mergePiPackageSources(base?: PiPackageSource[], additional?: PiPackageSource[]): PiPackageSource[];
871
-
872
- interface PiHarnessOptions {
873
- noContextFiles?: boolean;
874
- noSkills?: boolean;
875
- additionalSkillPaths?: string[];
876
- /**
877
- * Additional native Pi package sources to enable for this agent runtime.
878
- * These are applied as in-memory SettingsManager overrides, so host/plugin
879
- * declarations do not mutate .pi/settings.json.
880
- */
881
- packages?: PiPackageSource[];
882
- /**
883
- * Additional native pi extension entrypoints. Pi loads these through jiti and
884
- * re-imports them on ctx.reload(), which is required for hot-reloadable
885
- * boring agent plugins.
886
- */
887
- extensionPaths?: string[];
888
- /** In-process host extensions. Use only for trusted built-ins; hot plugin code should use paths. */
889
- extensionFactories?: ExtensionFactory[];
890
- /**
891
- * Optional source of hot-reloadable Pi resources. Pi calls it on every
892
- * reloadSession() (and once at session build) and merges the result with
893
- * the static fields above. Lets the workspace plugin layer refresh
894
- * package.json-discovered skills/packages/extensions without mutating
895
- * arrays that the harness already captured.
896
- */
897
- getHotReloadableResources?: () => HotReloadablePiResources;
898
- /** Reject an explicit unavailable/unknown model instead of silently falling back. */
899
- strictModelResolution?: boolean;
900
- }
901
- interface HotReloadablePiResources {
902
- additionalSkillPaths?: string[];
903
- packages?: PiPackageSource[];
904
- extensionPaths?: string[];
905
- }
906
- type PiExtensionFactory = ExtensionFactory;
907
- declare function createResourceSettingsManager(cwd: string, agentDir: string, piPackages: PiPackageSource[]): SettingsManager;
908
-
909
- /**
910
- * Generic metering seam for hosts that bill native Pi usage.
911
- *
912
- * The agent package owns lifecycle correctness (when to reserve, record,
913
- * settle, release based on native Pi events); the host-provided sink owns
914
- * persistence and product policy (credits, pricing, currencies, hard stops).
915
- *
916
- * Lifecycle per accepted prompt/follow-up ("run", identified by `runId`):
917
- *
918
- * reserveRun before execution starts; throwing rejects the request
919
- * (fail closed) so hosts can enforce hard stops.
920
- * recordUsage once per native assistant message carrying usage.
921
- * `usageId` is a stable idempotency key.
922
- * settleRun when the run reaches a native terminal state and usage
923
- * was recorded (or it finished ok).
924
- * releaseRun when the run never produced billable usage: rejected
925
- * execution, cleared queue, cancel/abort, or error before
926
- * any usage arrived.
927
- *
928
- * Every run terminates with exactly one settle or release from the
929
- * coordinator; sinks should still treat all four methods as idempotent
930
- * because process restarts and client retries can replay transitions.
931
- */
932
- interface AgentMeteringSink {
933
- /** False means the sink is installed but policy is disabled/no-op. Omitted means active for fail-closed callers. */
934
- isEnabled?: () => boolean;
935
- reserveRun(input: MeteringReserveInput): Promise<MeteringReservationResult>;
936
- /** Records the usage and returns the credit micros it was actually billed. The
937
- * coordinator counts a usage as billable from this charged amount (not raw provider
938
- * fields), so a row that prices to 0 (e.g. cost-only usage when provider cost isn't
939
- * trusted) doesn't make a free run settle. */
940
- recordUsage(input: MeteringUsageInput): Promise<MeteringUsageResult>;
941
- settleRun(input: MeteringSettleInput): Promise<void>;
942
- releaseRun(input: MeteringReleaseInput): Promise<void>;
943
- }
944
- interface MeteringUsageResult {
945
- /** Credit micros this usage row was billed (0 = no real debit). */
946
- billedMicros: number;
947
- }
948
- interface MeteringRunScope {
949
- workspaceId?: string;
950
- userId?: string;
951
- userEmail?: string;
952
- userEmailVerified?: boolean;
953
- sessionId: string;
954
- /** Stable id for one accepted prompt/follow-up run. */
955
- runId: string;
956
- source: 'pi-chat';
957
- }
958
- type MeteringRunKind = 'prompt' | 'followup';
959
- interface MeteringReserveInput extends MeteringRunScope {
960
- kind: MeteringRunKind;
961
- message: string;
962
- model?: ChatModelSelection;
963
- }
964
- /** Sinks without reservation rows can return an empty object. */
965
- interface MeteringReservationResult {
966
- reservationId?: string;
967
- }
968
- interface MeteringUsage {
969
- input: number;
970
- output: number;
971
- cacheRead: number;
972
- cacheWrite: number;
973
- cost: {
974
- input: number;
975
- output: number;
976
- cacheRead: number;
977
- cacheWrite: number;
978
- total: number;
979
- };
980
- }
981
- interface MeteringUsageInput extends MeteringRunScope {
982
- reservationId?: string;
983
- /** Stable idempotency key for this usage row. */
984
- usageId: string;
985
- messageId?: string;
986
- model?: {
987
- provider?: string;
988
- id?: string;
989
- };
990
- usage: MeteringUsage;
991
- stopReason?: string;
992
- metadata?: Record<string, unknown>;
993
- }
994
- type MeteringRunStatus = 'ok' | 'error' | 'aborted';
995
- interface MeteringSettleInput extends MeteringRunScope {
996
- reservationId?: string;
997
- status: MeteringRunStatus;
998
- }
999
- type MeteringReleaseReason = 'run-rejected' | 'queue-cleared' | 'cancelled' | 'error-before-usage' | 'usage-write-failed' | 'fallback-hold-charge';
1000
- interface MeteringReleaseInput extends MeteringRunScope {
1001
- reservationId?: string;
1002
- reason: MeteringReleaseReason;
1003
- }
1004
- type MeteringErrorLogger = (message: string, error: unknown) => void;
1005
- /** Native Pi usage objects always carry token + cost breakdowns; normalize
1006
- * defensively (zero-filling gaps and clamping negatives) so a partial object
1007
- * from an unexpected provider still meters as zeros instead of NaN. */
1008
- declare function normalizeMeteringUsage(value: unknown): MeteringUsage | undefined;
1009
-
1010
558
  interface WorkspaceAgentDispatcherResolveOptions {
1011
559
  request?: FastifyRequest;
1012
560
  }
@@ -1066,6 +614,11 @@ interface CreateAgentAppOptions {
1066
614
  userEmailVerified?: boolean;
1067
615
  requestId?: string;
1068
616
  }) => RuntimeFilesystemBinding[] | undefined | Promise<RuntimeFilesystemBinding[] | undefined>;
617
+ /**
618
+ * Trusted host seam for resolving Pi HTTP session scope. The default keeps
619
+ * unauthenticated requests workspace-only and authenticated requests user-scoped.
620
+ */
621
+ resolvePiSessionRequestContext?: (request: FastifyRequest, defaultContext: PiSessionRequestContext) => PiSessionRequestContext | Promise<PiSessionRequestContext>;
1069
622
  /** Generic runtime env contributors. Agent stays workspace-neutral; hosts decide env names/values. */
1070
623
  runtimeEnvContributions?: RuntimeEnvContribution[];
1071
624
  /** Runtime-aware provisioning hook. Runs after Workspace/Sandbox creation and before tools/harness. */
@@ -1118,6 +671,302 @@ interface CreateAgentAppOptions {
1118
671
  }
1119
672
  declare function createAgentApp(opts?: CreateAgentAppOptions): Promise<FastifyInstance>;
1120
673
 
674
+ interface HarnessPiChatServiceOptions {
675
+ harness: AgentHarness;
676
+ sessionStore: SessionStore;
677
+ workdir: string;
678
+ workspace?: Workspace;
679
+ eventStore?: EventStreamStore;
680
+ /**
681
+ * Optional host billing sink. When set, accepted prompts/follow-ups reserve
682
+ * before execution (a rejecting sink blocks the request), native assistant
683
+ * usage is recorded per message, and every run settles or releases from
684
+ * native terminal lifecycle.
685
+ */
686
+ metering?: AgentMeteringSink;
687
+ /** Host-owned process-lifetime projection of live session activity. */
688
+ onEvent?: (sessionId: string, event: PiChatEvent) => void;
689
+ /** Receives non-fatal metering pipeline failures (default: console.warn). */
690
+ meteringLogger?: MeteringErrorLogger;
691
+ }
692
+ declare class HarnessPiChatService implements PiChatSessionService {
693
+ private readonly harness;
694
+ private readonly sessionStore;
695
+ private readonly workdir;
696
+ private readonly workspace?;
697
+ private readonly eventStore?;
698
+ private readonly onEvent?;
699
+ private readonly channels;
700
+ private readonly channelCreations;
701
+ private readonly messageMetadata;
702
+ private readonly activePromptRuns;
703
+ private readonly syntheticPromptFailures;
704
+ private readonly activeSyntheticPromptErrors;
705
+ private readonly lifecycle;
706
+ private readonly metering?;
707
+ private disposePromise?;
708
+ constructor(options: HarnessPiChatServiceOptions);
709
+ /** Test/diagnostic hook: resolves once queued metering sink calls settle. */
710
+ flushMetering(): Promise<void>;
711
+ dispose(): Promise<void>;
712
+ private disposeService;
713
+ listSessions(ctx: PiSessionRequestContext, options?: SessionListOptions): Promise<SessionSummary[]>;
714
+ createSession(ctx: PiSessionRequestContext, init?: PiSessionCreateInit): Promise<SessionSummary>;
715
+ deleteSession(ctx: PiSessionRequestContext, sessionId: string): Promise<void>;
716
+ private deleteSessionBeforeDispose;
717
+ readAttachment(ctx: PiSessionRequestContext, sessionId: string, messageId: string, index: number): Promise<{
718
+ data: Uint8Array;
719
+ mediaType: string;
720
+ filename?: string;
721
+ }>;
722
+ readState(ctx: PiSessionRequestContext, sessionId: string): Promise<PiChatSnapshot>;
723
+ private readStateBeforeDispose;
724
+ private harnessMayHaveLiveSession;
725
+ private readPersistedState;
726
+ subscribe(ctx: PiSessionRequestContext, sessionId: string, cursor: number, subscriber: PiChatEventSubscriber): Promise<PiChatEventStreamResult>;
727
+ private subscribeBeforeDispose;
728
+ prompt(ctx: PiSessionRequestContext, sessionId: string, payload: PromptPayload): Promise<PromptReceipt>;
729
+ private promptBeforeDispose;
730
+ followUp(ctx: PiSessionRequestContext, sessionId: string, payload: FollowUpPayload): Promise<FollowUpReceipt>;
731
+ private followUpBeforeDispose;
732
+ clearQueue(ctx: PiSessionRequestContext, sessionId: string, payload: QueueClearPayload): Promise<QueueClearReceipt>;
733
+ private clearQueueBeforeDispose;
734
+ interrupt(ctx: PiSessionRequestContext, sessionId: string, _payload: InterruptPayload): Promise<{
735
+ accepted: true;
736
+ cursor: number;
737
+ }>;
738
+ private interruptBeforeDispose;
739
+ stop(ctx: PiSessionRequestContext, sessionId: string, _payload: StopPayload): Promise<StopReceipt>;
740
+ private stopBeforeDispose;
741
+ private clearAllFollowUps;
742
+ private nextFollowUpForInterrupt;
743
+ private autoPostInterruptedFollowUp;
744
+ private runPrompt;
745
+ private trackActiveRun;
746
+ private clearAutoPostedFollowUpForFallback;
747
+ private canClearAutoPostedFollowUpForFallback;
748
+ private enrichSyntheticPromptFailures;
749
+ private publishAutoPostedFollowUpRunError;
750
+ private publishChannelEvents;
751
+ private publishChannelEventSync;
752
+ private publishPromptRunError;
753
+ private runAndDrainPublishQueue;
754
+ private drainPublishQueue;
755
+ private getAdapter;
756
+ private getChannel;
757
+ private ensureChannel;
758
+ /** Coalesce concurrent cold callers so only one adapter subscription wins. */
759
+ private createChannelOnce;
760
+ private buildChannel;
761
+ private readDurableLatestPiChatSeq;
762
+ private assertCanAccessSession;
763
+ private sessionKey;
764
+ }
765
+
766
+ interface EnvironmentProvisioningSnapshot {
767
+ readonly changed: boolean;
768
+ readonly env: Readonly<Record<string, string>>;
769
+ readonly pathEntries: readonly string[];
770
+ readonly skillPaths: readonly string[];
771
+ }
772
+ interface EnvironmentLease {
773
+ readonly bundle: RuntimeBundle;
774
+ /** One immutable Environment-owned snapshot shared by every compatible Agent binding. */
775
+ readonly provisioning?: EnvironmentProvisioningSnapshot;
776
+ release(): void;
777
+ retire(): Promise<void>;
778
+ }
779
+
780
+ interface BuiltAgentComposition {
781
+ readonly agent: Agent;
782
+ readonly harness: AgentHarness;
783
+ readonly sessionStore: SessionStore;
784
+ readonly service: HarnessPiChatService;
785
+ readonly tools: readonly AgentTool[];
786
+ readonly runtimeBundle: RuntimeBundle;
787
+ readonly readyTracker: ReadyStatusTracker;
788
+ readonly runtimeScopeIdentity: string;
789
+ dispose(): Promise<void>;
790
+ }
791
+
792
+ interface AgentSessionRuntimeAuthority {
793
+ readonly runtimeScope: ResolvedAgentRuntimeScope;
794
+ /** Absent only for a pre-AH0 transcript created before runtime pins existed. */
795
+ readonly runtimeScopeIdentity?: string;
796
+ }
797
+ /** Process-lifetime live-turn projection. Reads never create activity rows. */
798
+ declare class AgentSessionActivityIndex {
799
+ private readonly activity;
800
+ get(workspaceScopeId: string, ref: AgentSessionRef): AgentSessionActivity;
801
+ set(workspaceScopeId: string, ref: AgentSessionRef, activity: AgentSessionActivity): void;
802
+ delete(workspaceScopeId: string, ref: AgentSessionRef): void;
803
+ observe(workspaceScopeId: string, ref: AgentSessionRef, event: PiChatEvent): void;
804
+ }
805
+
806
+ interface RuntimeBinding {
807
+ readonly key: string;
808
+ readonly scope: ResolvedAgentRuntimeScope;
809
+ readonly environmentLease: EnvironmentLease;
810
+ readonly composition: BuiltAgentComposition;
811
+ }
812
+ interface AgentHostRuntime {
813
+ readonly options: CreateAgentHostOptions;
814
+ readonly compiledAgents: readonly CompiledAgentHostAgentSpec[];
815
+ readonly compiledById: ReadonlyMap<string, CompiledAgentHostAgentSpec>;
816
+ readonly ledger: AgentRequestLedger;
817
+ readonly effectAdmission: AgentEffectAdmission;
818
+ readonly activity: AgentSessionActivityIndex;
819
+ listSessionSummaries(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim): Promise<readonly SessionSummary[]>;
820
+ isDraining(): boolean;
821
+ assertOpen(): void;
822
+ verify(scope: AuthorizedAgentScope): Promise<VerifiedAgentScopeClaim>;
823
+ resolveSessionRuntime(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, sessionId: string): Promise<AgentSessionRuntimeAuthority | undefined>;
824
+ resolveBinding(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, resolvedRuntimeScope?: ResolvedAgentRuntimeScope): Promise<RuntimeBinding>;
825
+ startDrain(): void;
826
+ drainRuntime(): Promise<void>;
827
+ registerSubscription(close: () => void | Promise<void>): () => void;
828
+ trackEffect<T>(effect: Promise<T>, key: AgentRequestKey): Promise<T>;
829
+ retireCompatibilityComposition(composition: BuiltAgentComposition): Promise<void>;
830
+ closeRuntime(): Promise<void>;
831
+ }
832
+ declare function createAgentHost(options: CreateAgentHostOptions): Promise<CreatedAgentHost>;
833
+
834
+ declare const AgentFleetCompilationErrorCode: {
835
+ readonly AGENT_FLEET_PLUGIN_UNKNOWN: "AGENT_FLEET_PLUGIN_UNKNOWN";
836
+ readonly AGENT_FLEET_CONFIG_BINDING_UNKNOWN: "AGENT_FLEET_CONFIG_BINDING_UNKNOWN";
837
+ readonly AGENT_FLEET_MODEL_POLICY_UNCOMPILED: "AGENT_FLEET_MODEL_POLICY_UNCOMPILED";
838
+ };
839
+ type AgentFleetCompilationErrorCode = (typeof AgentFleetCompilationErrorCode)[keyof typeof AgentFleetCompilationErrorCode];
840
+ declare class AgentFleetCompilationError extends Error {
841
+ readonly code: AgentFleetCompilationErrorCode;
842
+ readonly details: Readonly<Record<string, string>>;
843
+ constructor(code: AgentFleetCompilationErrorCode, message: string, details: Readonly<Record<string, string>>);
844
+ }
845
+ interface AgentFleetPluginBindingContract {
846
+ readonly id: string;
847
+ readonly configKeys?: readonly string[];
848
+ }
849
+ interface CreateValidatingAgentFleetCompilerOptions {
850
+ readonly plugins: readonly AgentFleetPluginBindingContract[];
851
+ readonly compiler?: AgentFleetCompiler;
852
+ /**
853
+ * Keeps Core's existing fail-closed policy when it has no app compiler.
854
+ * This is not model allowlist validation.
855
+ */
856
+ readonly requireCompilerForModelPolicy?: boolean;
857
+ }
858
+ /**
859
+ * The one reusable fleet binding-validation funnel. Apps supply only their
860
+ * already-resolved plugin contracts and optional stricter policy compiler.
861
+ */
862
+ declare function createValidatingAgentFleetCompiler(options: CreateValidatingAgentFleetCompilerOptions): AgentFleetCompiler;
863
+
864
+ declare class EmbeddedAgentGateway implements AgentGateway {
865
+ private readonly runtime;
866
+ private readonly cursorSecret;
867
+ private readonly connections;
868
+ private readonly effects;
869
+ private readonly pins;
870
+ private readonly writerTails;
871
+ private sessionRuntimeResolutionObserver?;
872
+ private closed;
873
+ constructor(runtime: AgentHostRuntime);
874
+ /** Server-only test observer for distinguishing runtime pin resolution paths. */
875
+ setSessionRuntimeResolutionObserverForTesting(observer: (input: {
876
+ readonly source: 'pre-ah0-compatibility-fallback' | 'persisted-runtime-pin';
877
+ readonly runtimeScopeIdentity: string;
878
+ }) => void): void;
879
+ /** Test-only activity seam used by the shared implementation conformance. */
880
+ setActivityForTesting(workspaceScopeId: string, ref: AgentSessionRef, activity: AgentSessionActivity): void;
881
+ private assertOpen;
882
+ private verify;
883
+ listAgents(input: {
884
+ readonly scope: AuthorizedAgentScope;
885
+ }): Promise<{
886
+ definition?: {
887
+ version: string;
888
+ digest: string;
889
+ } | undefined;
890
+ agentTypeId: string;
891
+ label: string;
892
+ }[]>;
893
+ listSessions(input: Parameters<AgentGateway['listSessions']>[0]): Promise<{
894
+ nextCursor?: string | undefined;
895
+ sessions: AgentSessionSummary[];
896
+ }>;
897
+ createSession(input: Parameters<AgentGateway['createSession']>[0]): Promise<AgentSessionRef>;
898
+ readSessionState(input: Parameters<AgentGateway['readSessionState']>[0]): Promise<AgentSessionStateSnapshot>;
899
+ connectSession(input: Parameters<AgentGateway['connectSession']>[0]): Promise<AgentSessionConnection>;
900
+ private send;
901
+ renameSession(input: Parameters<AgentGateway['renameSession']>[0]): Promise<AgentSessionSummary>;
902
+ deleteSession(input: Parameters<AgentGateway['deleteSession']>[0]): Promise<void>;
903
+ close(): Promise<void>;
904
+ private bindingForSession;
905
+ private loadSummary;
906
+ private sessionEffect;
907
+ /** Internal legacy-alias seam; never exposed through the public Gateway contract. */
908
+ runLegacyCompatibilityEffect(input: {
909
+ readonly scope: AuthorizedAgentScope;
910
+ readonly operation: AgentGatewayEffect;
911
+ readonly target: AgentRequestTarget;
912
+ readonly requestId: string;
913
+ readonly payload: JsonValue;
914
+ readonly action: () => Promise<unknown>;
915
+ }): Promise<unknown>;
916
+ private effect;
917
+ private replayReceipt;
918
+ private failure;
919
+ private withWriter;
920
+ private encodeCursor;
921
+ private decodeCursor;
922
+ }
923
+
924
+ /** Process-lifetime Level-B ledger with the exact published state machine. */
925
+ declare class InMemoryAgentRequestLedger implements AgentRequestLedger {
926
+ private readonly records;
927
+ prepare(key: AgentRequestKey, digest: string): Promise<AgentRequestLedgerRecord>;
928
+ acceptAdmission(key: AgentRequestKey, admissionReceipt: string): Promise<void>;
929
+ beginEffect(key: AgentRequestKey): Promise<void>;
930
+ reject(key: AgentRequestKey, failure: AgentRequestFailure): Promise<void>;
931
+ complete(key: AgentRequestKey, receipt: JsonValue): Promise<void>;
932
+ markOutcomeUnknown(key: AgentRequestKey, error: AgentGatewayErrorDTO): Promise<void>;
933
+ read(key: AgentRequestKey): Promise<AgentRequestLedgerRecord | undefined>;
934
+ private transition;
935
+ }
936
+
937
+ interface RuntimeScopeIdentityInput {
938
+ readonly artifacts: readonly {
939
+ readonly pluginId: string;
940
+ readonly digest: string;
941
+ }[];
942
+ readonly validatedConfig: JsonValue;
943
+ readonly grants: readonly string[];
944
+ readonly placementIdentity: string;
945
+ readonly isolationMode: string;
946
+ readonly toolContractDigests: readonly string[];
947
+ readonly provisioningGeneration: string;
948
+ readonly bindingInputs?: JsonValue;
949
+ }
950
+ interface EnvironmentProvisioningIdentityInput {
951
+ readonly placementIdentity: string;
952
+ readonly providerDigest: string;
953
+ readonly provisioningArtifactDigests: readonly string[];
954
+ readonly provisioningGeneration: string;
955
+ readonly templateDigest?: string;
956
+ }
957
+ /**
958
+ * Produces the complete Agent-binding identity. Grants intentionally
959
+ * participate here even though they do not participate in Environment
960
+ * provisioning identity.
961
+ */
962
+ declare function createResolvedRuntimeScopeIdentity(input: RuntimeScopeIdentityInput): string;
963
+ /**
964
+ * Produces only the Environment-mutating identity. Contribution grants and
965
+ * tool contracts are deliberately absent, so grant-only changes share the
966
+ * same canonical Environment lease.
967
+ */
968
+ declare function createEnvironmentProvisioningFingerprint(input: EnvironmentProvisioningIdentityInput): string;
969
+
1121
970
  interface HeaderLike {
1122
971
  setHeader(name: string, value: string): void;
1123
972
  }
@@ -1169,7 +1018,29 @@ interface ModelsRoutesOptions {
1169
1018
  filterModels?: (ctx: ModelFilterContext, models: readonly ModelSummary[], defaultModel: AgentModelSelection | undefined) => ModelFilterResult | Promise<ModelFilterResult>;
1170
1019
  }
1171
1020
 
1021
+ type PiSessionRequestContextResolver = (request: FastifyRequest, defaultContext: PiSessionRequestContext) => PiSessionRequestContext | Promise<PiSessionRequestContext>;
1022
+
1023
+ interface PrebuiltAgentHostRoutePolicy {
1024
+ /** The sole Host instance constructed by the embedding composition root. */
1025
+ readonly created: CreatedAgentHost;
1026
+ /** Default Agent used by the legacy unaddressed route family. */
1027
+ readonly defaultAgentTypeId: string;
1028
+ /**
1029
+ * App-owned capability issuer. The app may replace workspaceScopeId with its
1030
+ * canonical workspace/storage partition while retaining the normalized
1031
+ * runtime scope as private issuer context.
1032
+ */
1033
+ issueScope(input: {
1034
+ readonly claim: VerifiedAgentScopeClaim;
1035
+ readonly runtimeScope: ResolvedAgentRuntimeScope;
1036
+ }): AuthorizedAgentScope;
1037
+ }
1172
1038
  interface RegisterAgentRoutesOptions {
1039
+ /**
1040
+ * Reuse a Host created by the embedding composition root. Omission preserves
1041
+ * the historical wrapper behavior and constructs one legacy default Host.
1042
+ */
1043
+ agentHost?: PrebuiltAgentHostRoutePolicy;
1173
1044
  workspaceRoot?: string;
1174
1045
  sessionId?: string;
1175
1046
  templatePath?: string;
@@ -1185,6 +1056,8 @@ interface RegisterAgentRoutesOptions {
1185
1056
  runtimeHost?: AgentRuntimeHostOperations;
1186
1057
  version?: string;
1187
1058
  extraTools?: AgentTool[];
1059
+ /** When true, omit the six filesystem tools (read/write/edit/find/grep/ls). */
1060
+ disableDefaultFileTools?: boolean;
1188
1061
  getExtraTools?: (ctx: {
1189
1062
  workspaceId: string;
1190
1063
  workspaceRoot: string;
@@ -1223,10 +1096,12 @@ interface RegisterAgentRoutesOptions {
1223
1096
  sessionNamespace?: string;
1224
1097
  /** Optional explicit root for file-backed Pi chat transcript storage. */
1225
1098
  sessionRoot?: string;
1099
+ /** Trusted host seam for resolving Pi HTTP session scope. */
1100
+ resolvePiSessionRequestContext?: PiSessionRequestContextResolver;
1226
1101
  /** Optional best-effort telemetry sink supplied by an embedding host. */
1227
1102
  telemetry?: TelemetrySink;
1228
1103
  /** Optional host admission called immediately before each agent effect. */
1229
- admitEffect?: AgentEffectAdmission;
1104
+ admitEffect?: AgentEffectAdmission$1;
1230
1105
  /** Generic request-aware model filtering seam. Hosts may filter per user/workspace. */
1231
1106
  filterModels?: ModelsRoutesOptions['filterModels'];
1232
1107
  /** Generic per-request/per-run filesystem binding seam. Hosts may return user/session-filtered bindings. */
@@ -1285,6 +1160,8 @@ interface RegisterAgentRoutesOptions {
1285
1160
  runtimeMode: RuntimeModeId;
1286
1161
  runtimeLayout: BoringAgentRuntimePaths;
1287
1162
  provisioningAdapter?: WorkspaceProvisioningAdapter;
1163
+ /** Already-created paired Workspace/Sandbox runtime for this binding. */
1164
+ runtimeBundle: RuntimeBundle;
1288
1165
  request?: FastifyRequest;
1289
1166
  /** Aborted when this binding retires; retirement still drains the task before provider disposal. */
1290
1167
  signal: AbortSignal;
@@ -1315,13 +1192,59 @@ interface RegisterAgentRoutesOptions {
1315
1192
  */
1316
1193
  onWorkspaceAgentDispatcher?: (resolver: WorkspaceAgentDispatcherResolver) => void;
1317
1194
  }
1195
+ interface AgentHostLegacyRouteScopePolicy {
1196
+ /** App-owned capability issuer for the already-created Host. */
1197
+ issueScope(input: {
1198
+ readonly claim: VerifiedAgentScopeClaim;
1199
+ readonly runtimeScope: ResolvedAgentRuntimeScope;
1200
+ }): AuthorizedAgentScope;
1201
+ /** True only for the legacy wrapper whose Host admission calls admitEffect. */
1202
+ readonly gatewayUsesLegacyAdmission?: boolean;
1203
+ }
1204
+ type AgentHostLegacyRoutePolicyOptions = Omit<RegisterAgentRoutesOptions, 'agentHost' | 'runtimeModeAdapter'> & {
1205
+ readonly runtimeModeAdapter: RuntimeModeAdapter;
1206
+ };
1207
+
1208
+ /** Normalize legacy options into the nested Host projection seam. */
1209
+ declare function createAgentHostLegacyRoutePolicy(options: AgentHostLegacyRoutePolicyOptions, scopePolicy: AgentHostLegacyRouteScopePolicy): AgentHostLegacyRoutePolicy;
1210
+
1318
1211
  /**
1319
- * Fastify plugin that mounts agent routes onto a host app (typically core-built).
1212
+ * Compatibility wrapper for legacy embedding callers.
1320
1213
  *
1321
- * Shape B counterpart to createAgentApp (Shape A). The host provides its own
1322
- * Fastify instance, auth, and stores; this plugin only adds routes + runtime.
1323
- * No auth middleware is registered — the host's authHook handles authentication.
1214
+ * It normalizes legacy construction inputs, creates or reuses exactly one Host,
1215
+ * and delegates the complete route profile through CreatedAgentHost.registerRoutes().
1324
1216
  */
1325
1217
  declare const registerAgentRoutes: FastifyPluginAsync<RegisterAgentRoutesOptions>;
1326
1218
 
1327
- export { AgentConfig, AgentDirectoryCompilerError, type AgentDirectoryCompilerErrorCode, type AgentDirectoryCompilerPublicErrorCode, AgentHarnessFactory, type AgentMeteringSink, type AgentRuntimeHostOperations, AuthoredAgentMaterializationError, type AuthoredAgentMaterializationErrorCode, type AuthoredAgentToolCatalog, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, MANAGED_AGENT_MCP_DELIVERY_RULE, MANAGED_AGENT_MCP_ORIGIN_SURFACE, type ManagedAgentArtifact, type ManagedAgentArtifactCandidate, type ManagedAgentArtifactRef, type ManagedAgentBoundRunnerWorkspace, type ManagedAgentCollectArtifactsInput, type ManagedAgentDelegateInput, type ManagedAgentDelegateProgress, type ManagedAgentDelegateRequestContext, type ManagedAgentDelegateResult, type ManagedAgentDelegateRunInput, type ManagedAgentDelegateRunner, type ManagedAgentDelegateStatus, type ManagedAgentDelegateStatusResult, ManagedAgentMcpDelegateController, type ManagedAgentMcpDelegateOptions, ManagedAgentMcpError, type ManagedAgentMcpHttpHandlerOptions, type ManagedAgentMcpServerOptions, type ManagedAgentSafeError, type ManagedAgentWorkspaceResolutionInput, type MaterializeAgentDirectoryInput, type MaterializedAgentSourceV1, type MeteringErrorLogger, type MeteringReleaseInput, type MeteringReleaseReason, type MeteringReservationResult, type MeteringReserveInput, type MeteringRunKind, type MeteringRunScope, type MeteringRunStatus, type MeteringSettleInput, type MeteringUsage, type MeteringUsageInput, type ModeContext, PI_PACKAGE_RESOURCE_FILTERS, type PiExtensionFactory, type PiHarnessOptions, type PiPackageSource, type PluginSkillSource, type ProvisionRuntimeWorkspaceOptions, type ProvisionWorkspaceRuntimeOptions, type ProvisioningArtifactRequest, type RegisterAgentRoutesOptions, RemoteWorkerClient, RemoteWorkerClientError, type RemoteWorkerClientOptions, RemoteWorkerExecRequest, type RemoteWorkerModeAdapterOptions, RemoteWorkerWorkspaceOp, RemoteWorkerWorkspaceResult, type ResolvedAgent, type ResolvedAgentDigestInput, type RuntimeBundle, type RuntimeEnvContribution, type RuntimeEnvContributionContext, type RuntimeFilesystemBinding, type RuntimeFilesystemBindingOperations, type RuntimeModeAdapter, type RuntimeModeId, type RuntimeNodePackageSpec$1 as RuntimeNodePackageSpec, type RuntimeProvisioningContribution$1 as RuntimeProvisioningContribution, type RuntimePythonSpec$1 as RuntimePythonSpec, type RuntimeTemplateContribution$1 as RuntimeTemplateContribution, type RuntimeWorkspaceProvisioningResult, type ShareEntryMcpResourceOptions, UV_SETUP_COMMANDS, type WorkspaceAgentDispatcherBinding, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, buildDeploymentSnapshotRecipe, compactPiPackages, compileAgentDirectory, constantTimeTokenEqual, createAgent, createAgentApp, createDirectModeAdapter, createLocalModeAdapter, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createProviderRuntimeModeAdapter, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResolvedAgentDigest, createResourceSettingsManager, createVercelSandboxModeAdapter, decodeBytesFromWorker, encodeBytesForWorker, hasBwrap, materializeAgentDirectory, mergePiPackageSources, normalizeMeteringUsage, piPackageSourceKey, prepareDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, registerShareEntryResources, resolveAgentDeployment, resolveMode, resolveWorkspaceRoot, shareResourceUri };
1219
+ interface CredentialStoreBackendV1 {
1220
+ read(workspaceId: string, providerId: ProviderId, allowedFieldIds: readonly CredentialFieldId[]): Promise<ResolvedCredentialMaterialV1 & {
1221
+ credentialVersion: number;
1222
+ }>;
1223
+ }
1224
+ interface HostSideCredentialResolverOptionsV1 {
1225
+ readonly authorityVerifier: WorkspaceCredentialAuthorityVerifierV1;
1226
+ readonly bindingRegistry: CredentialConsumerBindingRegistryV1;
1227
+ readonly providerRegistry: ProviderRegistryV1;
1228
+ /**
1229
+ * Storage boundary only. Vault/KmsBackend composition is deferred to bead
1230
+ * 16f.2 and will implement this interface without changing the resolver.
1231
+ */
1232
+ readonly backend: CredentialStoreBackendV1;
1233
+ }
1234
+ interface InMemoryCredentialBackendEntryV1 {
1235
+ readonly workspaceId: string;
1236
+ readonly providerId: ProviderId;
1237
+ readonly material: ResolvedCredentialMaterialV1;
1238
+ readonly credentialVersion: number;
1239
+ }
1240
+ interface FakeAuthorityVerifierGrantV1 {
1241
+ readonly scope: AuthorizedWorkspaceCredentialScopeV1;
1242
+ readonly authority: VerifiedWorkspaceCredentialAuthorityV1;
1243
+ }
1244
+ declare function createHostSideCredentialResolverV1(options: HostSideCredentialResolverOptionsV1): WorkspaceCredentialResolverV1;
1245
+ declare function createFakeAuthorityVerifierV1(grants: readonly FakeAuthorityVerifierGrantV1[]): WorkspaceCredentialAuthorityVerifierV1;
1246
+ declare function createInMemoryCredentialBackendV1(entries: readonly InMemoryCredentialBackendEntryV1[]): CredentialStoreBackendV1;
1247
+
1248
+ declare function withResolvedCredential<T>(resolver: WorkspaceCredentialResolverV1, workspace: AuthorizedWorkspaceCredentialScopeV1, ref: ProviderCredentialRefV1, fn: (lease: ResolvedCredentialLeaseV1) => T | Promise<T>): Promise<T>;
1249
+
1250
+ export { AgentConfig, AgentDirectoryCompilerError, type AgentDirectoryCompilerErrorCode, type AgentDirectoryCompilerPublicErrorCode, AgentEffectAdmission, AgentFleetCompilationError, AgentFleetCompilationErrorCode, AgentFleetCompiler, type AgentFleetPluginBindingContract, AgentGatewayEffect, AgentHarnessFactory, AgentHostLegacyRoutePolicy, type AgentHostLegacyRoutePolicyOptions, type AgentHostLegacyRouteScopePolicy, AgentMeteringSink, AgentRequestKey, AgentRequestLedger, AgentRequestLedgerRecord, AgentRuntimeHostOperations, AuthoredAgentMaterializationError, type AuthoredAgentMaterializationErrorCode, type AuthoredAgentSourceV1, AuthorizedAgentScope, BuiltinRuntimeModeId, CompiledAgentHostAgentSpec, type CreateAgentAppOptions, CreateAgentHostOptions, type CreateValidatingAgentFleetCompilerOptions, CreatedAgentHost, type CredentialStoreBackendV1, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, EmbeddedAgentGateway, type FakeAuthorityVerifierGrantV1, type HostSideCredentialResolverOptionsV1, InMemoryAgentRequestLedger, type InMemoryCredentialBackendEntryV1, MANAGED_AGENT_MCP_DELIVERY_RULE, MANAGED_AGENT_MCP_ORIGIN_SURFACE, type ManagedAgentArtifact, type ManagedAgentArtifactCandidate, type ManagedAgentArtifactRef, type ManagedAgentBoundRunnerWorkspace, type ManagedAgentCollectArtifactsInput, type ManagedAgentDelegateInput, type ManagedAgentDelegateProgress, type ManagedAgentDelegateRequestContext, type ManagedAgentDelegateResult, type ManagedAgentDelegateRunInput, type ManagedAgentDelegateRunner, type ManagedAgentDelegateStatus, type ManagedAgentDelegateStatusResult, ManagedAgentMcpDelegateController, type ManagedAgentMcpDelegateOptions, ManagedAgentMcpError, type ManagedAgentMcpHttpHandlerOptions, type ManagedAgentMcpServerOptions, type ManagedAgentSafeError, type ManagedAgentWorkspaceResolutionInput, type MaterializeAgentDirectoryInput, MeteringErrorLogger, ModeContext, PiHarnessOptions, type PrebuiltAgentHostRoutePolicy, type ProvisionRuntimeWorkspaceOptions, ProvisionWorkspaceRuntimeOptions, type ProvisioningArtifactRequest, type RegisterAgentRoutesOptions, RemoteWorkerClient, RemoteWorkerClientError, type RemoteWorkerClientOptions, RemoteWorkerExecRequest, type RemoteWorkerModeAdapterOptions, RemoteWorkerWorkspaceOp, RemoteWorkerWorkspaceResult, type ResolvedAgent, type ResolvedAgentDigestInput, ResolvedAgentRuntimeScope, RuntimeBundle, type RuntimeEnvContribution, type RuntimeEnvContributionContext, RuntimeFilesystemBinding, RuntimeModeAdapter, RuntimeModeId, type RuntimeWorkspaceProvisioningResult, type SandboxRuntimeModeOptions, type ShareEntryMcpResourceOptions, UV_SETUP_COMMANDS, VerifiedAgentScopeClaim, type WorkspaceAgentDispatcherBinding, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, WorkspaceProvisioningAdapter, WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, buildDeploymentSnapshotRecipe, compileAgentDirectory, constantTimeTokenEqual, createAgent, createAgentApp, createAgentHost, createAgentHostLegacyRoutePolicy, createDirectModeAdapter, createEnvironmentProvisioningFingerprint, createFakeAuthorityVerifierV1, createHostSideCredentialResolverV1, createInMemoryCredentialBackendV1, createLocalModeAdapter, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createProviderRuntimeModeAdapter, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResolvedAgentDigest, createResolvedRuntimeScopeIdentity, createSandboxRuntimeModeAdapter, createValidatingAgentFleetCompiler, createVercelSandboxModeAdapter, decodeBytesFromWorker, encodeBytesForWorker, hasBwrap, materializeAgentDirectory, prepareDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, registerShareEntryResources, resolveAgentDeployment, resolveBuiltinRuntimeLayoutRoot, resolveMode, resolveWorkspaceRoot, sandboxRuntimeHostOperations, shareResourceUri, withResolvedCredential };