@hachej/boring-agent 0.1.100 → 0.1.103

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/{DebugDrawer-2TO5SE2D.js → DebugDrawer-JNA43SVR.js} +2 -1
  2. package/dist/chunk-2BGLZZ7T.js +10 -0
  3. package/dist/{chunk-46HJK2ES.js → chunk-4XOW57KJ.js} +3 -8
  4. package/dist/{chunk-ZOHN72OS.js → chunk-6WKQ4FC4.js} +127 -138
  5. package/dist/{chunk-LSO2AO6Q.js → chunk-7QM22DU7.js} +1 -3
  6. package/dist/{chunk-3OEDBRKY.js → chunk-JNEKOVMJ.js} +1 -1
  7. package/dist/{chunk-VXF5DWS6.js → chunk-K25PK5EC.js} +1 -0
  8. package/dist/chunk-N6THTH7P.js +110 -0
  9. package/dist/{chunk-GRMDMWBW.js → chunk-TW7G33QH.js} +23 -40
  10. package/dist/core/index.d.ts +5 -5
  11. package/dist/core/index.js +1 -1
  12. package/dist/{createHarness-5TEXLUYX.js → createHarness-4Q6DQBRT.js} +2 -2
  13. package/dist/{errors-cNC4HMpV.d.ts → errors-szpcDUFQ.d.ts} +3 -4
  14. package/dist/{file-search-QxnanNjO.d.ts → file-search-BXdSm-Yq.d.ts} +5 -5
  15. package/dist/front/artifacts.d.ts +34 -0
  16. package/dist/front/artifacts.js +21 -0
  17. package/dist/front/index.d.ts +6 -20
  18. package/dist/front/index.js +604 -710
  19. package/dist/{harness-DS8jLKIx.d.ts → harness-erpL2SER.d.ts} +2 -2
  20. package/dist/{lease-D8WC6pQl.d.ts → lease-K-EZhdL-.d.ts} +3 -3
  21. package/dist/{middleware-Cq_cYHjJ.d.ts → middleware-CaAEXpi5.d.ts} +11 -2
  22. package/dist/{piChatEvent-B3ehh9V0.d.ts → piChatEvent-g1nIBh44.d.ts} +14 -16
  23. package/dist/{piChatSessionService-xnv8rcdh.d.ts → piChatSessionService-DugeRHzb.d.ts} +1 -3
  24. package/dist/{sandbox-KQiEdz4W.d.ts → sandbox-BMhut3kh.d.ts} +6 -1
  25. package/dist/server/agent-host/testing/gatewayConformance.d.ts +6 -6
  26. package/dist/server/agent-host/testing/gatewayConformance.js +3 -4
  27. package/dist/server/index.d.ts +24 -35
  28. package/dist/server/index.js +7 -5
  29. package/dist/server/worker/index.d.ts +3 -2
  30. package/dist/server/worker/index.js +25 -6
  31. package/dist/shared/index.d.ts +29 -29
  32. package/dist/shared/index.js +3 -3
  33. package/dist/{types-BPzq-RwN.d.ts → types-BnjMLAd5.d.ts} +14 -6
  34. package/docs/AGENT_GATEWAY_V0.md +3 -4
  35. package/docs/ERROR_CODES.md +1 -0
  36. package/package.json +16 -12
@@ -1,21 +1,21 @@
1
- import { P as ProvisionWorkspaceRuntimeOptions, W as WorkspaceProvisioningResult, a as PiPackageSource, R as RuntimeModeAdapter, b as RuntimeModeId, B as BuiltinRuntimeModeId, c as AgentRuntimeHostOperations, d as RuntimeBashStrategy, e as RuntimeFilesystemStrategy, M as ModeContext, f as WorkspaceProvisioningAdapter, g as AgentInstructionFileRef, C as ConfiguredAgentHostAgentSpec, h as AgentHostAgentSpec, i as RuntimeBundle, j as PiHarnessOptions, k as AgentMeteringSink, l as RuntimeFilesystemBinding, m as CreatedAgentHost, n as MeteringErrorLogger, o as ReadyStatusTracker, p as ResolvedAgentRuntimeScope, q as CreateAgentHostOptions, r as CompiledAgentHostAgentSpec, s as AgentRequestLedger, t as AgentEffectAdmission, u as AuthorizedEnvironmentIntent, v as AgentHostEnvironmentScope, w as AgentRequestKey, x as AgentRequestLedgerPrepareResult, y as AgentRequestFailure, z as AgentRequestLedgerRecord, D as AgentFleetCompiler, E as AgentRequestTarget, F as RuntimeFilesystemAccessDecision } from '../types-BPzq-RwN.js';
2
- export { A as AgentGatewayEffect, G as AgentHostDescription, H as AgentHostDirectProjectionOptions, I as AgentHostDispatcherRunInput, J as AgentHostEnvironmentLease, K as AgentHostHandle, L as LegacyDefaultAgentHostSpec, N as MeteringReleaseInput, O as MeteringReleaseReason, Q as MeteringReservationResult, S as MeteringReserveInput, T as MeteringRunKind, U as MeteringRunScope, V as MeteringRunStatus, X as MeteringSettleInput, Y as MeteringUsage, Z as MeteringUsageInput, _ as PI_PACKAGE_RESOURCE_FILTERS, $ as PiExtensionFactory, 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 mergePiPackageSources, aa as normalizeMeteringUsage, ab as piPackageSourceKey } from '../types-BPzq-RwN.js';
3
- import { E as ExecOptions, a as ExecResult, W as WorkspaceChangeEvent, b as Workspace, S as Sandbox } from '../sandbox-KQiEdz4W.js';
4
- export { R as RuntimeFilesystemCapability } from '../sandbox-KQiEdz4W.js';
5
- import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, b as RemoteWorkerExecRequest } from '../middleware-Cq_cYHjJ.js';
6
- 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-Cq_cYHjJ.js';
1
+ import { P as ProvisionWorkspaceRuntimeOptions, W as WorkspaceProvisioningResult, a as PiPackageSource, R as RuntimeModeAdapter, b as RuntimeModeId, B as BuiltinRuntimeModeId, c as AgentRuntimeHostOperations, d as RuntimeBashStrategy, e as RuntimeFilesystemStrategy, M as ModeContext, f as WorkspaceProvisioningAdapter, g as AgentInstructionFileRef, C as ConfiguredAgentHostAgentSpec, h as AgentHostAgentSpec, i as RuntimeBundle, j as PiHarnessOptions, k as AgentMeteringSink, l as RuntimeFilesystemBinding, m as CreatedAgentHost, n as MeteringErrorLogger, o as ReadyStatusTracker, p as CreateAgentHostOptions, q as CompiledAgentHostAgentSpec, r as AgentRequestLedger, s as AgentEffectAdmission, t as AuthorizedEnvironmentIntent, u as AgentHostEnvironmentScope, v as ResolvedAgentRuntimeScope, w as AgentRequestKey, x as AgentRequestLedgerPrepareResult, y as AgentRequestFailure, z as AgentRequestLedgerRecord, D as AgentFleetCompiler, E as AgentRequestTarget, F as RuntimeFilesystemAccessDecision } from '../types-BnjMLAd5.js';
2
+ export { A as AgentGatewayEffect, G as AgentHostDescription, H as AgentHostDirectProjectionOptions, I as AgentHostDispatcherRunInput, J as AgentHostEnvironmentLease, K as AgentHostHandle, L as LegacyDefaultAgentHostSpec, N as MeteringReleaseInput, O as MeteringReleaseReason, Q as MeteringReservationResult, S as MeteringReserveInput, T as MeteringRunKind, U as MeteringRunScope, V as MeteringRunStatus, X as MeteringSettleInput, Y as MeteringUsage, Z as MeteringUsageInput, _ as PI_PACKAGE_RESOURCE_FILTERS, $ as PiExtensionFactory, 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 mergePiPackageSources, aa as normalizeMeteringUsage, ab as piPackageSourceKey } from '../types-BnjMLAd5.js';
3
+ import { d as ExecOptions, a as ExecResult, W as WorkspaceChangeEvent, b as Workspace, c as Sandbox } from '../sandbox-BMhut3kh.js';
4
+ export { h as RuntimeFilesystemCapability } from '../sandbox-BMhut3kh.js';
5
+ import { b as RemoteWorkerHealthResponse, R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, c as RemoteWorkerExecRequest } from '../middleware-CaAEXpi5.js';
6
+ export { d as REMOTE_WORKER_EXCLUSIVE_BINARY_CREATE_CAPABILITY, e as REMOTE_WORKER_PROVIDER, f as REMOTE_WORKER_RUNTIME_CWD, g as RemoteWorkerErrorPayload, h as RemoteWorkerExecResponse, i as RemoteWorkerFsEventEnvelope, W as WORKER_INTERNAL_TOKEN_HEADER, j as WORKER_REQUEST_ID_HEADER, k as WORKER_WORKSPACE_ID_HEADER, l as createAgentAuthMiddleware } from '../middleware-CaAEXpi5.js';
7
7
  import { SandboxProviderV1, WorkspaceSandboxPairV1 } from '@hachej/boring-sandbox/shared';
8
- import { S as SandboxHandleStore, C as CompiledAgentBundle, a as Sha256Digest, A as AgentDeployment, b as ShareEntryStore, P as ProviderId, c as CredentialFieldId, R as ResolvedCredentialMaterialV1, d as AuthorizedWorkspaceCredentialScopeV1, V as VerifiedWorkspaceCredentialAuthorityV1, W as WorkspaceCredentialAuthorityVerifierV1, e as CredentialConsumerBindingRegistryV1, f as ProviderRegistryV1, g as WorkspaceCredentialResolverV1, h as ProviderCredentialRefV1, i as ResolvedCredentialLeaseV1 } from '../lease-D8WC6pQl.js';
9
- import { E as ErrorCode, l as SessionCtx, b as PiChatEvent, 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-B3ehh9V0.js';
10
- import { J as JsonValue, b as AgentGateway, c as AuthorizedAgentScope, d as AgentSessionRef, e as AgentSessionActivity, V as VerifiedAgentScopeClaim, f as AgentGatewayErrorDTO, g as AgentSessionSummary, h as AgentSessionStateSnapshot, i as AgentSessionConnection } from '../errors-cNC4HMpV.js';
11
- import { d as AgentActor, j as AgentEvent, T as TelemetrySink, s as AgentTool, t as AgentHarnessFactory, A as AgentHarness } from '../harness-DS8jLKIx.js';
12
- export { u as AgentConfig, v as AgentHarnessFactoryInput } from '../harness-DS8jLKIx.js';
8
+ import { F as SandboxHandleStore, k as CompiledAgentBundle, a as Sha256Digest, i as AgentDeployment, M as ShareEntryStore, y as ProviderId, c as CredentialFieldId, B as ResolvedCredentialMaterialV1, d as AuthorizedWorkspaceCredentialScopeV1, V as VerifiedWorkspaceCredentialAuthorityV1, X as WorkspaceCredentialAuthorityVerifierV1, n as CredentialConsumerBindingRegistryV1, z as ProviderRegistryV1, Y as WorkspaceCredentialResolverV1, P as ProviderCredentialRefV1, R as ResolvedCredentialLeaseV1 } from '../lease-K-EZhdL-.js';
9
+ import { y as ErrorCode, n as SessionCtx, c as PiChatEvent, S as SessionStore, a as SessionListOptions, b as SessionSummary, P as PiChatSnapshot, d as PromptPayload, e as PromptReceipt, F as FollowUpPayload, f as FollowUpReceipt, Q as QueueClearPayload, g as QueueClearReceipt, I as InterruptPayload, i as StopPayload, j as StopReceipt } from '../piChatEvent-g1nIBh44.js';
10
+ import { x as JsonValue, A as AgentGateway, a as AuthorizedAgentScope, b as AgentSessionRef, c as AgentSessionActivity, V as VerifiedAgentScopeClaim, i as AgentGatewayErrorDTO, p as AgentSessionSummary, o as AgentSessionStateSnapshot, l as AgentSessionConnection } from '../errors-szpcDUFQ.js';
11
+ import { d as AgentActor, j as AgentEvent, v as TelemetrySink, s as AgentTool, D as AgentHarnessFactory, A as AgentHarness } from '../harness-erpL2SER.js';
12
+ export { u as AgentConfig, E as AgentHarnessFactoryInput } from '../harness-erpL2SER.js';
13
13
  import { IncomingMessage, ServerResponse } from 'node:http';
14
14
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
15
15
  import { FastifyRequest, FastifyInstance, FastifyPluginCallback } from 'fastify';
16
- import { i as PiSessionRequestContext, g as PiChatSessionService, h as PiSessionCreateInit, e as PiChatEventSubscriber, P as PiChatEventStreamResult } from '../piChatSessionService-xnv8rcdh.js';
17
- import { W as WorkspaceAgentDirectRunInput, a as WorkspaceAgentDirectRunCallback, b as WorkspaceAgentDispatcherContext, c as WorkspaceAgentDispatcher, d as WorkspaceAgentGatewayBinding } from '../file-search-QxnanNjO.js';
18
- export { L as LeaseBoundWorkspaceAgent } from '../file-search-QxnanNjO.js';
16
+ import { i as PiSessionRequestContext, g as PiChatSessionService, h as PiSessionCreateInit, e as PiChatEventSubscriber, P as PiChatEventStreamResult } from '../piChatSessionService-DugeRHzb.js';
17
+ import { c as WorkspaceAgentDirectRunInput, W as WorkspaceAgentDirectRunCallback, f as WorkspaceAgentDispatcherContext, e as WorkspaceAgentDispatcher, i as WorkspaceAgentGatewayBinding } from '../file-search-BXdSm-Yq.js';
18
+ export { L as LeaseBoundWorkspaceAgent } from '../file-search-BXdSm-Yq.js';
19
19
  import { SettingsManager } from '@mariozechner/pi-coding-agent';
20
20
  import '@hachej/boring-bash/agent';
21
21
  import '@hachej/boring-sandbox/providers/node-workspace';
@@ -95,7 +95,7 @@ declare class RemoteWorkerClient {
95
95
  private timeoutError;
96
96
  private abortedError;
97
97
  private fetchWithTimeout;
98
- health(): Promise<void>;
98
+ health(): Promise<RemoteWorkerHealthResponse>;
99
99
  workspace(op: RemoteWorkerWorkspaceOp): Promise<RemoteWorkerWorkspaceResult>;
100
100
  exec(input: RemoteWorkerExecRequest, opts?: Pick<ExecOptions, 'signal'>): Promise<ExecResult>;
101
101
  watch(onEvent: (event: WorkspaceChangeEvent) => void, onError?: (error: Error) => void): {
@@ -115,7 +115,7 @@ interface RemoteWorkerModeAdapterOptions {
115
115
  }
116
116
  declare function createRemoteWorkerModeAdapter(opts?: RemoteWorkerModeAdapterOptions): RuntimeModeAdapter;
117
117
 
118
- declare function createRemoteWorkerWorkspace(client: RemoteWorkerClient): Workspace;
118
+ declare function createRemoteWorkerWorkspace(client: RemoteWorkerClient, supportsExclusiveBinaryCreate?: boolean): Workspace;
119
119
 
120
120
  declare function createRemoteWorkerSandbox(client: RemoteWorkerClient): Sandbox;
121
121
 
@@ -1068,15 +1068,9 @@ interface BuiltAgentComposition {
1068
1068
  readonly tools: readonly AgentTool[];
1069
1069
  readonly runtimeBundle: RuntimeBundle;
1070
1070
  readonly readyTracker: ReadyStatusTracker;
1071
- readonly runtimeScopeIdentity: string;
1072
1071
  dispose(): Promise<void>;
1073
1072
  }
1074
1073
 
1075
- interface AgentSessionRuntimeAuthority {
1076
- readonly runtimeScope: ResolvedAgentRuntimeScope;
1077
- /** Absent only for a pre-AH0 transcript created before runtime pins existed. */
1078
- readonly runtimeScopeIdentity?: string;
1079
- }
1080
1074
  interface AgentSessionActivityUpdate {
1081
1075
  readonly ref: AgentSessionRef;
1082
1076
  readonly status: AgentSessionActivity;
@@ -1117,11 +1111,10 @@ interface AgentHostRuntime {
1117
1111
  resolveEnvironmentScope(scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, intent: AuthorizedEnvironmentIntent): Promise<AgentHostEnvironmentScope>;
1118
1112
  acquireEnvironment(scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, intent: AuthorizedEnvironmentIntent): Promise<EnvironmentLease>;
1119
1113
  acquireResolvedEnvironment(workspaceScopeId: string, environment: AgentHostEnvironmentScope): Promise<EnvironmentLease>;
1120
- resolveSessionRuntime(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, sessionId: string): Promise<AgentSessionRuntimeAuthority | undefined>;
1114
+ resolveSessionRuntime(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, sessionId: string): Promise<ResolvedAgentRuntimeScope | undefined>;
1121
1115
  resolveAgentRuntimeScope(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, operation: 'new-binding' | 'existing-session' | 'reload', requestId: string, sessionId?: string): Promise<ResolvedAgentRuntimeScope>;
1122
- resolveBinding(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, resolvedRuntimeScope?: ResolvedAgentRuntimeScope, purpose?: 'current' | 'pinned'): Promise<RuntimeBinding>;
1123
- findPublishedBinding(agentTypeId: string, workspaceScopeId: string, runtimeScopeIdentity?: string, physicalBindingIdentity?: string, provisioningFingerprint?: string): RuntimeBinding | undefined;
1124
- findPublishedCurrentBinding(agentTypeId: string, workspaceScopeId: string, physicalBindingIdentity: string, runtimeScopeIdentity?: string, provisioningFingerprint?: string): RuntimeBinding | undefined;
1116
+ resolveBinding(agentTypeId: string, scope: AuthorizedAgentScope, claim: VerifiedAgentScopeClaim, resolvedRuntimeScope?: ResolvedAgentRuntimeScope): Promise<RuntimeBinding>;
1117
+ findPublishedCurrentBinding(agentTypeId: string, workspaceScopeId: string, physicalBindingIdentity: string, bindingIdentity?: string, provisioningFingerprint?: string): RuntimeBinding | undefined;
1125
1118
  startDrain(): void;
1126
1119
  drainRuntime(): Promise<void>;
1127
1120
  registerSubscription(close: () => void | Promise<void>): () => void;
@@ -1182,10 +1175,8 @@ declare class EmbeddedAgentGateway implements AgentGateway {
1182
1175
  private readonly runtime;
1183
1176
  private readonly cursorSecret;
1184
1177
  private readonly connections;
1185
- private readonly pins;
1186
- private readonly unpinnedSessionFallbackPins;
1187
1178
  private readonly writerTails;
1188
- private sessionRuntimeResolutionObserver?;
1179
+ private readonly knownSessions;
1189
1180
  private closed;
1190
1181
  constructor(runtime: AgentHostRuntime);
1191
1182
  /** Host-owned addressed runtime-capability effect seam. */
@@ -1208,16 +1199,11 @@ declare class EmbeddedAgentGateway implements AgentGateway {
1208
1199
  claim: VerifiedAgentScopeClaim;
1209
1200
  binding: RuntimeBinding;
1210
1201
  }>;
1211
- /** Side-effect-free reload lookup: validates persisted existence/pin and requires an already-published binding. */
1202
+ /** Side-effect-free reload lookup: validates session access and requires the current binding to be published. */
1212
1203
  inspectPublishedSessionBinding(scope: AuthorizedAgentScope, ref: AgentSessionRef): Promise<{
1213
1204
  claim: VerifiedAgentScopeClaim;
1214
1205
  binding: RuntimeBinding;
1215
1206
  }>;
1216
- /** Server-only test observer for distinguishing runtime pin resolution paths. */
1217
- setSessionRuntimeResolutionObserverForTesting(observer: (input: {
1218
- readonly source: 'unpinned-session-fallback' | 'persisted-runtime-pin';
1219
- readonly runtimeScopeIdentity: string;
1220
- }) => void): void;
1221
1207
  /** Test-only activity seam used by the shared implementation conformance. */
1222
1208
  setActivityForTesting(workspaceScopeId: string, ref: AgentSessionRef, activity: AgentSessionActivity): void;
1223
1209
  private assertOpen;
@@ -1350,6 +1336,8 @@ interface PiResourceDigestInput {
1350
1336
  readonly piUserHome: string;
1351
1337
  /** Mirrors Pi's noSkills resource-loader option. */
1352
1338
  readonly noSkills: boolean;
1339
+ /** Mirrors Pi's noContextFiles resource-loader option; omitted stays sealed. */
1340
+ readonly noContextFiles?: boolean;
1353
1341
  readonly promptParts?: readonly (string | undefined)[];
1354
1342
  readonly additionalSkillPaths?: readonly string[];
1355
1343
  readonly packages?: readonly PiPackageSource[];
@@ -1370,6 +1358,7 @@ declare function createPiResourceDigestInput(input: {
1370
1358
  readonly piAgentDir?: string;
1371
1359
  readonly piUserHome?: string;
1372
1360
  readonly noSkills?: boolean;
1361
+ readonly noContextFiles?: boolean;
1373
1362
  readonly resourceSets: readonly PiResourceSet[];
1374
1363
  readonly authorizedRoots: readonly string[];
1375
1364
  readonly limits?: Partial<PiResourceDigestLimits>;
@@ -13,6 +13,7 @@ import {
13
13
  MANAGED_AGENT_MCP_ORIGIN_SURFACE,
14
14
  ManagedAgentMcpDelegateController,
15
15
  ManagedAgentMcpError,
16
+ REMOTE_WORKER_EXCLUSIVE_BINARY_CREATE_CAPABILITY,
16
17
  REMOTE_WORKER_PROVIDER,
17
18
  REMOTE_WORKER_RUNTIME_CWD,
18
19
  RUNTIME_FILESYSTEM_BINDING_DUPLICATE_CODE,
@@ -88,20 +89,20 @@ import {
88
89
  shareResourceUri,
89
90
  withResolvedCredential,
90
91
  withRuntimeEnvContributions
91
- } from "../chunk-ZOHN72OS.js";
92
+ } from "../chunk-6WKQ4FC4.js";
92
93
  import {
93
94
  PI_PACKAGE_RESOURCE_FILTERS,
94
95
  compactPiPackages,
95
96
  createResourceSettingsManager,
96
97
  mergePiPackageSources,
97
98
  piPackageSourceKey
98
- } from "../chunk-GRMDMWBW.js";
99
- import "../chunk-3OEDBRKY.js";
99
+ } from "../chunk-TW7G33QH.js";
100
+ import "../chunk-JNEKOVMJ.js";
100
101
  import "../chunk-4IQ4HHBG.js";
101
102
  import "../chunk-WSQ5QNIY.js";
102
- import "../chunk-LSO2AO6Q.js";
103
+ import "../chunk-7QM22DU7.js";
103
104
  import "../chunk-YGRQ4Q5P.js";
104
- import "../chunk-VXF5DWS6.js";
105
+ import "../chunk-K25PK5EC.js";
105
106
  export {
106
107
  AgentDirectoryCompilerError,
107
108
  AgentFleetCompilationError,
@@ -118,6 +119,7 @@ export {
118
119
  ManagedAgentMcpDelegateController,
119
120
  ManagedAgentMcpError,
120
121
  PI_PACKAGE_RESOURCE_FILTERS,
122
+ REMOTE_WORKER_EXCLUSIVE_BINARY_CREATE_CAPABILITY,
121
123
  REMOTE_WORKER_PROVIDER,
122
124
  REMOTE_WORKER_RUNTIME_CWD,
123
125
  RUNTIME_FILESYSTEM_BINDING_DUPLICATE_CODE,
@@ -1,8 +1,8 @@
1
1
  import { FastifyInstance, FastifyRequest, FastifyReply, FastifyServerOptions } from 'fastify';
2
2
  import { BwrapResourceLimits } from '@hachej/boring-sandbox/providers/bwrap';
3
3
  import { SandboxProviderV1 } from '@hachej/boring-sandbox/shared';
4
- import { b as Workspace, S as Sandbox } from '../../sandbox-KQiEdz4W.js';
5
- import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult } from '../../middleware-Cq_cYHjJ.js';
4
+ import { b as Workspace, c as Sandbox } from '../../sandbox-BMhut3kh.js';
5
+ import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult } from '../../middleware-CaAEXpi5.js';
6
6
 
7
7
  interface WorkerConfig {
8
8
  workspaceRoot: string;
@@ -22,6 +22,7 @@ declare const WORKER_ERROR_CODES: {
22
22
  readonly VALIDATION_ERROR: "validation_error";
23
23
  readonly INVALID_WORKSPACE_ID: "invalid_workspace_id";
24
24
  readonly NOT_IMPLEMENTED: "not_implemented";
25
+ readonly ALREADY_EXISTS: "REMOTE_WORKER_ALREADY_EXISTS";
25
26
  readonly EXEC_CONCURRENCY_LIMIT: "exec_concurrency_limit";
26
27
  readonly UNSUPPORTED_WORKSPACE_OP: "unsupported_workspace_op";
27
28
  };
@@ -1,14 +1,15 @@
1
1
  import {
2
+ REMOTE_WORKER_EXCLUSIVE_BINARY_CREATE_CAPABILITY,
2
3
  WORKER_INTERNAL_TOKEN_HEADER,
3
4
  constantTimeTokenEqual
4
- } from "../../chunk-ZOHN72OS.js";
5
- import "../../chunk-GRMDMWBW.js";
6
- import "../../chunk-3OEDBRKY.js";
5
+ } from "../../chunk-6WKQ4FC4.js";
6
+ import "../../chunk-TW7G33QH.js";
7
+ import "../../chunk-JNEKOVMJ.js";
7
8
  import "../../chunk-4IQ4HHBG.js";
8
9
  import "../../chunk-WSQ5QNIY.js";
9
- import "../../chunk-LSO2AO6Q.js";
10
+ import "../../chunk-7QM22DU7.js";
10
11
  import "../../chunk-YGRQ4Q5P.js";
11
- import "../../chunk-VXF5DWS6.js";
12
+ import "../../chunk-K25PK5EC.js";
12
13
 
13
14
  // src/server/worker/index.ts
14
15
  import Fastify from "fastify";
@@ -58,6 +59,7 @@ var WORKER_ERROR_CODES = {
58
59
  VALIDATION_ERROR: "validation_error",
59
60
  INVALID_WORKSPACE_ID: "invalid_workspace_id",
60
61
  NOT_IMPLEMENTED: "not_implemented",
62
+ ALREADY_EXISTS: "REMOTE_WORKER_ALREADY_EXISTS",
61
63
  EXEC_CONCURRENCY_LIMIT: "exec_concurrency_limit",
62
64
  UNSUPPORTED_WORKSPACE_OP: "unsupported_workspace_op"
63
65
  };
@@ -154,6 +156,20 @@ async function runWorkspaceOp(workspace, op) {
154
156
  if (!workspace.writeBinaryFile) throw Object.assign(new Error("binary write unsupported"), { statusCode: 501, code: WORKER_ERROR_CODES.NOT_IMPLEMENTED });
155
157
  await workspace.writeBinaryFile(op.path, new Uint8Array(Buffer.from(op.dataBase64, "base64")));
156
158
  return { ok: true };
159
+ case "createBinaryFile":
160
+ if (!workspace.createBinaryFile) throw Object.assign(new Error("exclusive binary create unsupported"), { statusCode: 501, code: WORKER_ERROR_CODES.NOT_IMPLEMENTED });
161
+ try {
162
+ await workspace.createBinaryFile(op.path, new Uint8Array(Buffer.from(op.dataBase64, "base64")));
163
+ } catch (error) {
164
+ if (error?.code === "EEXIST") {
165
+ throw Object.assign(new Error("exclusive binary create destination exists"), {
166
+ statusCode: 409,
167
+ code: WORKER_ERROR_CODES.ALREADY_EXISTS
168
+ });
169
+ }
170
+ throw error;
171
+ }
172
+ return { ok: true };
157
173
  case "readFileWithStat":
158
174
  if (!workspace.readFileWithStat) {
159
175
  return { content: await workspace.readFile(op.path), stat: await workspace.stat(op.path) };
@@ -247,7 +263,10 @@ async function registerWorkerRoutes(app, config, runtimeProvider) {
247
263
  }
248
264
  });
249
265
  app.get("/health", async () => ({ ok: true }));
250
- app.get("/internal/health", async () => ({ ok: true }));
266
+ app.get("/internal/health", async () => ({
267
+ ok: true,
268
+ capabilities: [REMOTE_WORKER_EXCLUSIVE_BINARY_CREATE_CAPABILITY]
269
+ }));
251
270
  app.addHook("preHandler", async (request, reply) => {
252
271
  if (request.method === "GET" && request.url === "/health") return;
253
272
  if (!verifyInternalToken(request, reply, config.internalToken)) return reply;