@hachej/boring-agent 0.1.78 → 0.1.80

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.
@@ -0,0 +1,104 @@
1
+ import { W as WorkspaceRuntimeContext, S as Sandbox, d as Stat, e as Entry, b as ExecResult, c as WorkspaceChangeEvent } from './sandbox-DthfJaOB.js';
2
+
3
+ interface BwrapResourceLimits {
4
+ cpuSeconds?: number;
5
+ fileSizeBlocks?: number;
6
+ maxProcesses?: number;
7
+ openFiles?: number;
8
+ virtualMemoryKb?: number;
9
+ }
10
+ interface CreateBwrapSandboxOptions {
11
+ hostWorkspaceRoot?: string;
12
+ runtimeContext?: WorkspaceRuntimeContext;
13
+ network?: 'shared' | 'isolated';
14
+ dropAllCapabilities?: boolean;
15
+ resourceLimits?: BwrapResourceLimits;
16
+ }
17
+ declare function createBwrapSandbox(opts?: CreateBwrapSandboxOptions): Sandbox;
18
+
19
+ declare const REMOTE_WORKER_RUNTIME_CWD = "/workspace";
20
+ declare const REMOTE_WORKER_PROVIDER = "remote-worker";
21
+ declare const WORKER_INTERNAL_TOKEN_HEADER = "x-boring-internal-token";
22
+ declare const WORKER_WORKSPACE_ID_HEADER = "x-boring-workspace-id";
23
+ declare const WORKER_REQUEST_ID_HEADER = "x-boring-request-id";
24
+ type RemoteWorkerWorkspaceOp = {
25
+ op: 'readFile';
26
+ path: string;
27
+ } | {
28
+ op: 'readBinaryFile';
29
+ path: string;
30
+ } | {
31
+ op: 'writeFile';
32
+ path: string;
33
+ data: string;
34
+ } | {
35
+ op: 'writeBinaryFile';
36
+ path: string;
37
+ dataBase64: string;
38
+ } | {
39
+ op: 'readFileWithStat';
40
+ path: string;
41
+ } | {
42
+ op: 'writeFileWithStat';
43
+ path: string;
44
+ data: string;
45
+ } | {
46
+ op: 'writeBinaryFileWithStat';
47
+ path: string;
48
+ dataBase64: string;
49
+ } | {
50
+ op: 'unlink';
51
+ path: string;
52
+ } | {
53
+ op: 'readdir';
54
+ path: string;
55
+ } | {
56
+ op: 'stat';
57
+ path: string;
58
+ } | {
59
+ op: 'mkdir';
60
+ path: string;
61
+ recursive?: boolean;
62
+ } | {
63
+ op: 'rename';
64
+ from: string;
65
+ to: string;
66
+ };
67
+ type RemoteWorkerWorkspaceResult = {
68
+ content: string;
69
+ } | {
70
+ dataBase64: string;
71
+ } | {
72
+ stat: Stat;
73
+ } | {
74
+ content: string;
75
+ stat: Stat;
76
+ } | {
77
+ entries: Entry[];
78
+ } | {
79
+ ok: true;
80
+ };
81
+ interface RemoteWorkerExecRequest {
82
+ cmd: string;
83
+ cwd?: string;
84
+ env?: Record<string, string>;
85
+ timeoutMs?: number;
86
+ maxOutputBytes?: number;
87
+ }
88
+ interface RemoteWorkerExecResponse extends Omit<ExecResult, 'stdout' | 'stderr'> {
89
+ stdoutBase64: string;
90
+ stderrBase64: string;
91
+ }
92
+ interface RemoteWorkerErrorPayload {
93
+ error: {
94
+ code: string;
95
+ message: string;
96
+ statusCode?: number;
97
+ details?: unknown;
98
+ };
99
+ }
100
+ interface RemoteWorkerFsEventEnvelope {
101
+ event: WorkspaceChangeEvent;
102
+ }
103
+
104
+ export { type BwrapResourceLimits as B, type CreateBwrapSandboxOptions as C, type RemoteWorkerWorkspaceOp as R, WORKER_INTERNAL_TOKEN_HEADER as W, type RemoteWorkerWorkspaceResult as a, type RemoteWorkerExecRequest as b, REMOTE_WORKER_PROVIDER as c, REMOTE_WORKER_RUNTIME_CWD as d, type RemoteWorkerErrorPayload as e, type RemoteWorkerExecResponse as f, type RemoteWorkerFsEventEnvelope as g, WORKER_REQUEST_ID_HEADER as h, WORKER_WORKSPACE_ID_HEADER as i, createBwrapSandbox as j };
@@ -1,6 +1,3 @@
1
- import { e as InterruptReceipt, h as StopReceipt } from './piChatCommand-BuWXytap.js';
2
- import { t as AgentSendInput, j as AgentEvent } from './harness-OsJBlx4u.js';
3
-
4
1
  interface WorkspaceRuntimeContext {
5
2
  /** Agent-visible working directory shared by file-tree and shell execution. */
6
3
  readonly runtimeCwd: string;
@@ -288,77 +285,4 @@ interface IsolatedCodeOutput {
288
285
  exitCode: number;
289
286
  }
290
287
 
291
- interface SandboxHandleRecord {
292
- workspaceId: string;
293
- sandboxId: string;
294
- snapshotId?: string;
295
- createdAt: string;
296
- lastUsedAt: string;
297
- }
298
- interface SandboxHandleStore {
299
- get(workspaceId: string): Promise<SandboxHandleRecord | null>;
300
- put(record: SandboxHandleRecord): Promise<void>;
301
- delete(workspaceId: string): Promise<void>;
302
- list(): Promise<SandboxHandleRecord[]>;
303
- }
304
-
305
- interface FileSearch {
306
- search(glob: string, limit?: number): Promise<string[]>;
307
- }
308
-
309
- /**
310
- * Browser CustomEvent name dispatched on `window` after the workspace's
311
- * agent-plugin hot reload subscriber commits a registry change (load,
312
- * unload, or error).
313
- *
314
- * Declared in `@hachej/boring-agent` (not `@hachej/boring-workspace`)
315
- * so the agent's ChatPanel — which listens for this event to refresh
316
- * its slash-command palette / banner state — can import it without
317
- * creating a workspace → agent → workspace cycle. Workspace's
318
- * `useAgentPluginHotReload` imports the same constant.
319
- */
320
- declare const WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT = "boring-ui:agent-plugins-reloaded";
321
- /**
322
- * One per plugin that loaded successfully but whose server-side surfaces
323
- * (Fastify routes / agent tools) still hold pre-reload code. Shared
324
- * between the agent's /reload HTTP route + the ChatPanel banner so the
325
- * agent layer has ONE declaration of this wire shape. Mirrors what the
326
- * workspace's `collectRestartWarnings()` emits (workspace owns the
327
- * canonical `PluginRestartWarning` type; we redeclare here only because
328
- * the agent layer must not depend on workspace).
329
- */
330
- interface PluginRestartWarning {
331
- id: string;
332
- surfaces: string[];
333
- message: string;
334
- }
335
- /**
336
- * Browser CustomEvent name dispatched on `window` when a `showNotification`
337
- * UI command arrives from the server (e.g. from a plugin slash command that
338
- * calls `notify()`). `PiChatPanel` listens for this to show the
339
- * `CommandRunStatus` banner above the composer.
340
- */
341
- declare const WORKSPACE_COMMAND_NOTIFY_EVENT = "boring-ui:command-notify";
342
- /**
343
- * Payload carried by `WORKSPACE_COMMAND_NOTIFY_EVENT`. Maps directly to
344
- * what `uiCommandDispatcher` extracts from the `showNotification` command.
345
- */
346
- interface CommandNotifyPayload {
347
- message: string;
348
- tone: 'success' | 'error' | 'info' | 'warn';
349
- /** Name of the command that triggered the notification (without leading slash). */
350
- command?: string;
351
- }
352
-
353
- interface WorkspaceAgentDispatcherContext {
354
- workspaceId: string;
355
- userId: string;
356
- }
357
- type WorkspaceAgentDispatcherSendInput = Omit<AgentSendInput, 'ctx'>;
358
- interface WorkspaceAgentDispatcher {
359
- send(input: WorkspaceAgentDispatcherSendInput): AsyncIterable<AgentEvent>;
360
- interrupt(sessionId: string): Promise<InterruptReceipt>;
361
- stop(sessionId: string): Promise<StopReceipt>;
362
- }
363
-
364
- export { type CommandNotifyPayload as C, type Entry as E, type FileSearch as F, type IsolatedCodeInput as I, type PluginRestartWarning as P, type Sandbox as S, type Workspace as W, type ExecOptions as a, type ExecResult as b, type IsolatedCodeOutput as c, type SandboxCapability as d, type SandboxHandleRecord as e, type SandboxHandleStore as f, type Stat as g, WORKSPACE_AGENT_PLUGINS_RELOADED_EVENT as h, WORKSPACE_COMMAND_NOTIFY_EVENT as i, type WorkspaceAgentDispatcher as j, type WorkspaceAgentDispatcherContext as k, type WorkspaceAgentDispatcherSendInput as l, type WorkspaceRuntimeContext as m, type WorkspaceChangeEvent as n };
288
+ export type { ExecOptions as E, IsolatedCodeInput as I, Sandbox as S, WorkspaceRuntimeContext as W, Workspace as a, ExecResult as b, WorkspaceChangeEvent as c, Stat as d, Entry as e, IsolatedCodeOutput as f, SandboxCapability as g };
@@ -1,14 +1,15 @@
1
- import { m as WorkspaceRuntimeContext, S as Sandbox, f as SandboxHandleStore, e as SandboxHandleRecord, W as Workspace, F as FileSearch, g as Stat, E as Entry, b as ExecResult, n as WorkspaceChangeEvent, a as ExecOptions, P as PluginRestartWarning, k as WorkspaceAgentDispatcherContext, j as WorkspaceAgentDispatcher } from '../workspaceAgentDispatcher-Cl3EBveh.js';
1
+ import { W as WorkspaceRuntimeContext, S as Sandbox, a as Workspace, E as ExecOptions, b as ExecResult, c as WorkspaceChangeEvent } from '../sandbox-DthfJaOB.js';
2
+ import { R as RemoteWorkerWorkspaceOp, a as RemoteWorkerWorkspaceResult, b as RemoteWorkerExecRequest } from '../protocol-B_OQKfbI.js';
3
+ export { B as BwrapResourceLimits, C as CreateBwrapSandboxOptions, 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 createBwrapSandbox } from '../protocol-B_OQKfbI.js';
4
+ import { S as SandboxHandleStore, a as SandboxHandleRecord, F as FileSearch, C as CompiledAgentBundle, b as Sha256Digest, A as AgentDeployment, P as PluginRestartWarning, W as WorkspaceAgentDispatcherContext, c as WorkspaceAgentDispatcher } from '../workspaceAgentDispatcher-Wi6NIh2G.js';
2
5
  import { Sandbox as Sandbox$1 } from '@vercel/sandbox';
3
- import { x as TelemetrySink, E as ToolReadinessRequirement, j as AgentEvent, c as Agent, d as AgentActor, A as AgentTool, F as AgentHarnessFactory } from '../harness-OsJBlx4u.js';
4
- export { w as AgentConfig, G as AgentHarnessFactoryInput } from '../harness-OsJBlx4u.js';
6
+ import { T as TelemetrySink, s as ToolReadinessRequirement, t as AgentConfig, b as Agent, d as AgentActor, j as AgentEvent, u as AgentTool, v as AgentHarnessFactory } from '../harness-BZW5Jiy3.js';
7
+ export { w as AgentHarnessFactoryInput } from '../harness-BZW5Jiy3.js';
5
8
  import { FastifyInstance, FastifyRequest, FastifyPluginAsync } from 'fastify';
6
- export { createAgent } from '../core/index.js';
7
- import { S as SessionCtx, f as ErrorCode } from '../session-FUiMWsyX.js';
9
+ import { E as ErrorCode, o as SessionCtx, C as ChatModelSelection } from '../piChatEvent-CpoTZau1.js';
8
10
  import { IncomingMessage, ServerResponse } from 'node:http';
9
11
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
10
12
  import { PackageSource, ExtensionFactory, SettingsManager } from '@mariozechner/pi-coding-agent';
11
- import { a as ChatModelSelection } from '../piChatCommand-BuWXytap.js';
12
13
  import 'zod';
13
14
 
14
15
  interface CreateDirectSandboxOptions {
@@ -16,22 +17,6 @@ interface CreateDirectSandboxOptions {
16
17
  }
17
18
  declare function createDirectSandbox(opts?: CreateDirectSandboxOptions): Sandbox;
18
19
 
19
- interface BwrapResourceLimits {
20
- cpuSeconds?: number;
21
- fileSizeBlocks?: number;
22
- maxProcesses?: number;
23
- openFiles?: number;
24
- virtualMemoryKb?: number;
25
- }
26
- interface CreateBwrapSandboxOptions {
27
- hostWorkspaceRoot?: string;
28
- runtimeContext?: WorkspaceRuntimeContext;
29
- network?: 'shared' | 'isolated';
30
- dropAllCapabilities?: boolean;
31
- resourceLimits?: BwrapResourceLimits;
32
- }
33
- declare function createBwrapSandbox(opts?: CreateBwrapSandboxOptions): Sandbox;
34
-
35
20
  interface FileHandleStoreOptions {
36
21
  storePath?: string;
37
22
  }
@@ -557,91 +542,6 @@ interface RuntimeBundle {
557
542
  filesystemBindings?: RuntimeFilesystemBinding[];
558
543
  }
559
544
 
560
- declare const REMOTE_WORKER_RUNTIME_CWD = "/workspace";
561
- declare const REMOTE_WORKER_PROVIDER = "remote-worker";
562
- declare const WORKER_INTERNAL_TOKEN_HEADER = "x-boring-internal-token";
563
- declare const WORKER_WORKSPACE_ID_HEADER = "x-boring-workspace-id";
564
- declare const WORKER_REQUEST_ID_HEADER = "x-boring-request-id";
565
- type RemoteWorkerWorkspaceOp = {
566
- op: 'readFile';
567
- path: string;
568
- } | {
569
- op: 'readBinaryFile';
570
- path: string;
571
- } | {
572
- op: 'writeFile';
573
- path: string;
574
- data: string;
575
- } | {
576
- op: 'writeBinaryFile';
577
- path: string;
578
- dataBase64: string;
579
- } | {
580
- op: 'readFileWithStat';
581
- path: string;
582
- } | {
583
- op: 'writeFileWithStat';
584
- path: string;
585
- data: string;
586
- } | {
587
- op: 'writeBinaryFileWithStat';
588
- path: string;
589
- dataBase64: string;
590
- } | {
591
- op: 'unlink';
592
- path: string;
593
- } | {
594
- op: 'readdir';
595
- path: string;
596
- } | {
597
- op: 'stat';
598
- path: string;
599
- } | {
600
- op: 'mkdir';
601
- path: string;
602
- recursive?: boolean;
603
- } | {
604
- op: 'rename';
605
- from: string;
606
- to: string;
607
- };
608
- type RemoteWorkerWorkspaceResult = {
609
- content: string;
610
- } | {
611
- dataBase64: string;
612
- } | {
613
- stat: Stat;
614
- } | {
615
- content: string;
616
- stat: Stat;
617
- } | {
618
- entries: Entry[];
619
- } | {
620
- ok: true;
621
- };
622
- interface RemoteWorkerExecRequest {
623
- cmd: string;
624
- cwd?: string;
625
- env?: Record<string, string>;
626
- timeoutMs?: number;
627
- maxOutputBytes?: number;
628
- }
629
- interface RemoteWorkerExecResponse extends Omit<ExecResult, 'stdout' | 'stderr'> {
630
- stdoutBase64: string;
631
- stderrBase64: string;
632
- }
633
- interface RemoteWorkerErrorPayload {
634
- error: {
635
- code: string;
636
- message: string;
637
- statusCode?: number;
638
- details?: unknown;
639
- };
640
- }
641
- interface RemoteWorkerFsEventEnvelope {
642
- event: WorkspaceChangeEvent;
643
- }
644
-
645
545
  interface RemoteWorkerClientOptions {
646
546
  baseUrl: string;
647
547
  token: string;
@@ -790,16 +690,90 @@ interface ResolveModeOptions {
790
690
  }
791
691
  declare function resolveMode(mode?: RuntimeModeId, opts?: ResolveModeOptions): RuntimeModeAdapter;
792
692
 
693
+ declare function createAgent(config: AgentConfig): Agent;
694
+
695
+ 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';
696
+ type AgentDirectoryCompilerPublicErrorCode = Extract<ErrorCode, 'CONFIG_INVALID' | 'PATH_NOT_FOUND' | 'PATH_SYMLINK_ESCAPE'>;
697
+ declare class AgentDirectoryCompilerError extends Error {
698
+ readonly code: AgentDirectoryCompilerPublicErrorCode;
699
+ readonly compilerCode: AgentDirectoryCompilerErrorCode;
700
+ readonly field: string;
701
+ constructor(input: {
702
+ code: AgentDirectoryCompilerPublicErrorCode;
703
+ compilerCode: AgentDirectoryCompilerErrorCode;
704
+ field: string;
705
+ message: string;
706
+ cause?: unknown;
707
+ });
708
+ }
709
+ declare function compileAgentDirectory(directory: string): Promise<CompiledAgentBundle>;
710
+
711
+ interface ResolvedAgent {
712
+ readonly workspace: Readonly<{
713
+ workspaceId: string;
714
+ defaultDeploymentId: string;
715
+ compositionDigest: Sha256Digest;
716
+ }>;
717
+ readonly deployment: Readonly<{
718
+ deploymentId: string;
719
+ version: string;
720
+ agentId: string;
721
+ digest: Sha256Digest;
722
+ }>;
723
+ readonly definition: Readonly<{
724
+ definitionId: string;
725
+ version: string;
726
+ digest: Sha256Digest;
727
+ instructionsRef: string;
728
+ }>;
729
+ readonly instructions: Readonly<{
730
+ ref: string;
731
+ content: string;
732
+ }>;
733
+ readonly resolvedDigest: Sha256Digest;
734
+ }
735
+ declare function resolveAgentDeployment(bundle: CompiledAgentBundle, deployment: AgentDeployment, authorizedBinding: unknown): Promise<ResolvedAgent>;
736
+
793
737
  declare const MANAGED_AGENT_MCP_ORIGIN_SURFACE = "mcp-managed-agent";
794
- declare const MANAGED_AGENT_MCP_DELIVERY_RULE = "M1-pr1 DELIVERY v0: delegate_task returns final assistant text and artifact file references only; share-link delivery is gated on PR #424.";
738
+ declare const MANAGED_AGENT_MCP_DELIVERY_RULE = "M1 DELIVERY v0: delegate_task returns bounded final assistant text and at most one complete authorized inline Markdown artifact; no artifact paths, truncation, or share-link delivery.";
795
739
  type ManagedAgentDelegationStatus = 'running' | 'completed' | 'error';
796
740
  type ManagedAgentDelegateStatus = ManagedAgentDelegationStatus;
797
- interface ManagedAgentArtifactRef {
741
+ interface ManagedAgentArtifactCandidate {
798
742
  path: string;
799
743
  mediaType?: string;
800
744
  title?: string;
801
- content?: string;
802
- truncated?: boolean;
745
+ content?: unknown;
746
+ truncated?: unknown;
747
+ }
748
+ /** @deprecated Use ManagedAgentArtifactCandidate for internal artifact path candidates. */
749
+ type ManagedAgentArtifactRef = ManagedAgentArtifactCandidate;
750
+ interface ManagedAgentArtifact {
751
+ content: string;
752
+ sha256: `sha256:${string}`;
753
+ byteSize: number;
754
+ mediaType?: string;
755
+ title?: string;
756
+ }
757
+ interface ManagedAgentWorkspaceResolutionInput {
758
+ brief: string;
759
+ ctx: SessionCtx;
760
+ request: ManagedAgentDelegateRequestContext;
761
+ }
762
+ interface ManagedAgentDelegateRunInput {
763
+ brief: string;
764
+ ctx: SessionCtx;
765
+ request: ManagedAgentDelegateRequestContext;
766
+ actor: AgentActor;
767
+ signal?: AbortSignal;
768
+ onSessionStarted?: (sessionId: string) => void;
769
+ }
770
+ interface ManagedAgentDelegateRunner {
771
+ run(input: ManagedAgentDelegateRunInput): AsyncIterable<AgentEvent>;
772
+ stop?(sessionId: string, ctx: SessionCtx): Promise<void> | void;
773
+ }
774
+ interface ManagedAgentBoundRunnerWorkspace {
775
+ runner: ManagedAgentDelegateRunner;
776
+ workspace: Workspace;
803
777
  }
804
778
  interface ManagedAgentDelegateProgress {
805
779
  at: string;
@@ -811,7 +785,7 @@ interface ManagedAgentDelegateResult {
811
785
  delegationId: string;
812
786
  status: 'completed';
813
787
  finalAssistantText: string;
814
- artifacts: ManagedAgentArtifactRef[];
788
+ artifact?: ManagedAgentArtifact;
815
789
  deliveryRule: typeof MANAGED_AGENT_MCP_DELIVERY_RULE;
816
790
  }
817
791
  interface ManagedAgentDelegateStatusResult {
@@ -842,25 +816,31 @@ interface ManagedAgentCollectArtifactsInput {
842
816
  delegationId: string;
843
817
  sessionId: string;
844
818
  ctx: SessionCtx;
819
+ request: ManagedAgentDelegateRequestContext;
845
820
  finalAssistantText: string;
846
821
  events: readonly AgentEvent[];
847
822
  }
848
823
  interface ManagedAgentMcpDelegateOptions {
849
- agent: Agent;
824
+ agent?: Agent;
850
825
  resolveSessionCtx(input: {
851
826
  brief: string;
852
827
  request: ManagedAgentDelegateRequestContext;
853
828
  }): SessionCtx | Promise<SessionCtx>;
829
+ resolveWorkspace?(input: ManagedAgentWorkspaceResolutionInput): Workspace | Promise<Workspace>;
830
+ resolveRunnerWorkspace?(input: ManagedAgentWorkspaceResolutionInput & {
831
+ actor: AgentActor;
832
+ }): ManagedAgentBoundRunnerWorkspace | Promise<ManagedAgentBoundRunnerWorkspace>;
854
833
  resolveActor?(input: {
855
834
  brief: string;
856
835
  ctx: SessionCtx;
857
836
  request: ManagedAgentDelegateRequestContext;
858
837
  }): AgentActor | Promise<AgentActor>;
859
- collectArtifacts?(input: ManagedAgentCollectArtifactsInput): ManagedAgentArtifactRef[] | Promise<ManagedAgentArtifactRef[]>;
838
+ collectArtifacts?(input: ManagedAgentCollectArtifactsInput): ManagedAgentArtifactCandidate[] | Promise<ManagedAgentArtifactCandidate[]>;
860
839
  createDelegationId?: () => string;
861
840
  now?: () => Date;
841
+ maxBriefBytes?: number;
842
+ /** Optional additional character cap retained for host compatibility. */
862
843
  maxBriefChars?: number;
863
- maxInlineArtifactContentChars?: number;
864
844
  terminalRetentionMs?: number;
865
845
  maxDelegations?: number;
866
846
  redactionCanaries?: readonly string[];
@@ -874,8 +854,8 @@ declare class ManagedAgentMcpDelegateController {
874
854
  private readonly delegations;
875
855
  private readonly createDelegationId;
876
856
  private readonly now;
877
- private readonly maxBriefChars;
878
- private readonly maxInlineArtifactContentChars;
857
+ private readonly maxBriefBytes;
858
+ private readonly maxBriefChars?;
879
859
  private readonly terminalRetentionMs;
880
860
  private readonly maxDelegations;
881
861
  private readonly redactionCanaries;
@@ -888,11 +868,15 @@ declare class ManagedAgentMcpDelegateController {
888
868
  private pruneDelegations;
889
869
  private parseBrief;
890
870
  private resolveSessionCtx;
871
+ private resolveWorkspace;
872
+ private resolveRunnerWorkspace;
873
+ private createAgentDelegateRunner;
891
874
  private assertNotAborted;
892
875
  private stopDelegatedSession;
893
876
  private resolveActor;
894
877
  private observeEvent;
895
878
  private pushProgress;
879
+ private validateFinalAssistantText;
896
880
  private collectArtifacts;
897
881
  private toSafeError;
898
882
  private assertPublicPayloadSafe;
@@ -901,14 +885,19 @@ declare class ManagedAgentMcpDelegateController {
901
885
  }
902
886
  declare function createManagedAgentMcpDelegateController(options: ManagedAgentMcpDelegateOptions): ManagedAgentMcpDelegateController;
903
887
 
904
- interface ManagedAgentMcpServerOptions extends ManagedAgentMcpDelegateOptions {
888
+ interface ManagedAgentMcpPresentationOptions {
905
889
  name?: string;
906
890
  version?: string;
891
+ maxBriefChars?: number;
907
892
  }
908
- interface ManagedAgentMcpHttpHandlerOptions extends ManagedAgentMcpServerOptions {
909
- controller?: ManagedAgentMcpDelegateController;
893
+ interface ManagedAgentMcpServerOptions extends ManagedAgentMcpDelegateOptions, ManagedAgentMcpPresentationOptions {
910
894
  }
911
- declare function createManagedAgentMcpServer(options: ManagedAgentMcpServerOptions, controller?: ManagedAgentMcpDelegateController): McpServer;
895
+ type ManagedAgentMcpHttpHandlerOptions = (ManagedAgentMcpPresentationOptions & {
896
+ controller: ManagedAgentMcpDelegateController;
897
+ }) | (ManagedAgentMcpServerOptions & {
898
+ controller?: undefined;
899
+ });
900
+ declare function createManagedAgentMcpServer(options: ManagedAgentMcpServerOptions): McpServer;
912
901
  declare function createManagedAgentMcpHttpHandler(options: ManagedAgentMcpHttpHandlerOptions): (req: IncomingMessage, res: ServerResponse, parsedBody?: unknown) => Promise<void>;
913
902
 
914
903
  interface ReloadHookDiagnostic {
@@ -1086,8 +1075,13 @@ declare function normalizeMeteringUsage(value: unknown): MeteringUsage | undefin
1086
1075
  interface WorkspaceAgentDispatcherResolveOptions {
1087
1076
  request?: FastifyRequest;
1088
1077
  }
1078
+ interface WorkspaceAgentDispatcherBinding {
1079
+ dispatcher: WorkspaceAgentDispatcher;
1080
+ workspace: Workspace;
1081
+ }
1089
1082
  interface WorkspaceAgentDispatcherResolver {
1090
1083
  resolve(ctx: WorkspaceAgentDispatcherContext, options?: WorkspaceAgentDispatcherResolveOptions): Promise<WorkspaceAgentDispatcher>;
1084
+ resolveWithWorkspace?(ctx: WorkspaceAgentDispatcherContext, options?: WorkspaceAgentDispatcherResolveOptions): Promise<WorkspaceAgentDispatcherBinding>;
1091
1085
  }
1092
1086
 
1093
1087
  interface CreateAgentAppOptions {
@@ -1332,6 +1326,8 @@ interface RegisterAgentRoutesOptions {
1332
1326
  runtimeLayout: BoringAgentRuntimePaths;
1333
1327
  provisioningAdapter?: WorkspaceProvisioningAdapter;
1334
1328
  request?: FastifyRequest;
1329
+ /** Aborted when this binding retires; retirement still drains the task before provider disposal. */
1330
+ signal: AbortSignal;
1335
1331
  }) => WorkspaceProvisioningResult | undefined | Promise<WorkspaceProvisioningResult | undefined>;
1336
1332
  provisionWorkspace?: boolean;
1337
1333
  /** Optional hook called before /api/v1/agent/reload reloads the harness. */
@@ -1379,4 +1375,4 @@ interface Logger {
1379
1375
  }
1380
1376
  declare function createLogger(prefix: string): Logger;
1381
1377
 
1382
- export { AgentHarnessFactory, type AgentMeteringSink, type BoringAgentRuntimePaths, type BuiltinRuntimeModeId, type BwrapResourceLimits, type CreateAgentAppOptions, type CreateBwrapSandboxOptions, type CreateVercelProvisioningAdapterOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, MANAGED_AGENT_MCP_DELIVERY_RULE, MANAGED_AGENT_MCP_ORIGIN_SURFACE, type ManagedAgentArtifactRef, type ManagedAgentCollectArtifactsInput, type ManagedAgentDelegateInput, type ManagedAgentDelegateProgress, type ManagedAgentDelegateRequestContext, type ManagedAgentDelegateResult, type ManagedAgentDelegateStatus, type ManagedAgentDelegateStatusResult, ManagedAgentMcpDelegateController, type ManagedAgentMcpDelegateOptions, ManagedAgentMcpError, type ManagedAgentMcpHttpHandlerOptions, type ManagedAgentMcpServerOptions, type ManagedAgentSafeError, 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, REMOTE_WORKER_PROVIDER, REMOTE_WORKER_RUNTIME_CWD, type RegisterAgentRoutesOptions, RemoteWorkerClient, RemoteWorkerClientError, type RemoteWorkerClientOptions, type RemoteWorkerErrorPayload, type RemoteWorkerExecRequest, type RemoteWorkerExecResponse, type RemoteWorkerFsEventEnvelope, type RemoteWorkerModeAdapterOptions, type RemoteWorkerWorkspaceOp, type RemoteWorkerWorkspaceResult, 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 SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, VERCEL_PROVISIONING_CACHE_ROOT, VERCEL_SANDBOX_WORKSPACE_ROOT, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, WORKER_INTERNAL_TOKEN_HEADER, WORKER_REQUEST_ID_HEADER, WORKER_WORKSPACE_ID_HEADER, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, constantTimeTokenEqual, createAgentApp, createBwrapSandbox, createDirectSandbox, createLogger, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createNodeWorkspace, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelProvisioningAdapter, createVercelSandboxWorkspace, decodeBytesFromWorker, encodeBytesForWorker, fileRoutes, getBoringAgentPathEntries, getBoringAgentRuntimeEnv, getBoringAgentRuntimePaths, hasBwrap, mergePiPackageSources, normalizeMeteringUsage, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, resolveMode, resolveSandboxHandle };
1378
+ export { AgentConfig, AgentDirectoryCompilerError, type AgentDirectoryCompilerErrorCode, type AgentDirectoryCompilerPublicErrorCode, AgentHarnessFactory, type AgentMeteringSink, type BoringAgentRuntimePaths, type BuiltinRuntimeModeId, type CreateAgentAppOptions, type CreateVercelProvisioningAdapterOptions, type DeploymentSnapshotProvider, type DeploymentSnapshotRecipe, type DeploymentSnapshotResult, type DeploymentSnapshotStatus, FileHandleStore, type LogFields, type Logger, 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 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 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 SnapshotBakeOptions, type SnapshotBakeResult, UV_SETUP_COMMANDS, VERCEL_PROVISIONING_CACHE_ROOT, VERCEL_SANDBOX_WORKSPACE_ROOT, UV_SETUP_COMMANDS as VERCEL_UV_SETUP_COMMANDS, type VercelBakeClient, type VercelBakeSandbox, type VercelDeploymentSnapshotOptions, type WorkspaceAgentDispatcherBinding, type WorkspaceAgentDispatcherResolveOptions, type WorkspaceAgentDispatcherResolver, type WorkspaceProvisioningAdapter, type WorkspaceProvisioningExecResult, type WorkspaceProvisioningResult, applyCspHeaders, autoDetectMode, bakeSnapshotIfNeeded, buildDeploymentSnapshotRecipe, buildPackageHash, buildSnapshotRecipeHash, compactPiPackages, compileAgentDirectory, constantTimeTokenEqual, createAgent, createAgentApp, createDirectSandbox, createLogger, createManagedAgentMcpDelegateController, createManagedAgentMcpHttpHandler, createManagedAgentMcpServer, createNodeWorkspace, createRemoteWorkerModeAdapter, createRemoteWorkerSandbox, createRemoteWorkerWorkspace, createResourceSettingsManager, createVercelDeploymentSnapshotProvider, createVercelProvisioningAdapter, createVercelSandboxWorkspace, decodeBytesFromWorker, encodeBytesForWorker, fileRoutes, getBoringAgentPathEntries, getBoringAgentRuntimeEnv, getBoringAgentRuntimePaths, hasBwrap, mergePiPackageSources, normalizeMeteringUsage, piPackageSourceKey, prepareDeploymentSnapshot, prepareVercelDeploymentSnapshot, provisionRuntimeWorkspace, provisionWorkspaceRuntime, registerAgentRoutes, resolveAgentDeployment, resolveMode, resolveSandboxHandle };