@nuvin/agent-core 0.3.1-rc.2 → 0.4.0-rc.11

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 (45) hide show
  1. package/dist/VERSION +2 -2
  2. package/dist/agent/compaction-handoff.d.ts +70 -0
  3. package/dist/agent/context-compactor.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/agent/metrics.d.ts +7 -3
  6. package/dist/agent/model-request-measurement.d.ts +9 -0
  7. package/dist/chunk-D5IVWJHX.js +1 -1
  8. package/dist/chunk-EQGBU73Q.js +1 -1
  9. package/dist/chunk-GAZGO6N7.js +1 -1
  10. package/dist/chunk-HKK27UUP.js +1 -0
  11. package/dist/chunk-IUZALP6K.js +1 -1
  12. package/dist/chunk-LIE76IJA.js +1 -1
  13. package/dist/chunk-X7VAACWY.js +1 -1
  14. package/dist/chunk-YNOIG4FD.js +1 -1
  15. package/dist/chunk-YTDATWXW.js +1 -0
  16. package/dist/formats/index.js +1 -1
  17. package/dist/hooks/index.js +1 -1
  18. package/dist/isolate/index.js +1 -1
  19. package/dist/models/index.js +1 -1
  20. package/dist/models/model-registry.d.ts +1 -1
  21. package/dist/models/model-transports.d.ts +3 -0
  22. package/dist/models/routed-model.d.ts +5 -1
  23. package/dist/shared/bash-completion-visibility.d.ts +21 -0
  24. package/dist/shared/delegation-context.d.ts +34 -0
  25. package/dist/shared/index.d.ts +3 -0
  26. package/dist/shared/index.js +1 -1
  27. package/dist/shared/operation-scheduler.d.ts +17 -0
  28. package/dist/shared/types.d.ts +97 -4
  29. package/dist/tools/core/internal-tool-runtime.d.ts +4 -0
  30. package/dist/tools/core/runtime-manager-tools.d.ts +88 -3
  31. package/dist/tools/core/tools.d.ts +2 -0
  32. package/dist/tools/file-editing/bash-artifact-read.d.ts +13 -0
  33. package/dist/tools/file-editing/file-read-tool.d.ts +1 -0
  34. package/dist/tools/index.d.ts +1 -1
  35. package/dist/tools/index.js +1 -1
  36. package/dist/tools/program/program-isolate.d.ts +4 -1
  37. package/dist/tools/shell/background-bash-controller.d.ts +20 -17
  38. package/dist/tools/shell/background-bash-process.d.ts +2 -10
  39. package/dist/tools/shell/bash-artifact.d.ts +62 -0
  40. package/dist/tools/shell/bash-tool.d.ts +20 -7
  41. package/dist/tools/web/safe-fetch.d.ts +2 -0
  42. package/package.json +2 -2
  43. package/dist/chunk-FFIZ6TKW.js +0 -1
  44. package/dist/chunk-IMXQOWD3.js +0 -1
  45. package/dist/tools/shell/bash-output-tool.d.ts +0 -21
@@ -41,7 +41,7 @@ export interface ResolvedModelProfile {
41
41
  export declare const REASONING_METADATA_VERSIONS: {
42
42
  readonly anthropic: "2026-07-22";
43
43
  readonly openai: "2026-07-22";
44
- readonly codex: "0.153.4+3d2ee51ca2d5db578f328aa75e20aa22c0197c9a";
44
+ readonly codex: "0.159.2+ff6aec96948b70d94983af2641a6b67c94faeff5";
45
45
  };
46
46
  export declare function getProviderProfile(provider: string): ProviderProfile | undefined;
47
47
  export declare function getModelProfile(provider: string, model: string): ModelProfile | undefined;
@@ -14,4 +14,7 @@ export declare function iterateSseEvents(response: Response, signal?: AbortSigna
14
14
  export declare function waitForWebSocketOpen(socket: ModelWebSocket, signal?: AbortSignal): Promise<void>;
15
15
  export declare function iterateWebSocketMessages(socket: ModelWebSocket, signal?: AbortSignal): AsyncIterable<Record<string, unknown>>;
16
16
  export declare function toWebSocketUrl(baseUrl: string, path: string): string;
17
+ /** Consume a body under the request's cancellation ownership, including injected transports. */
18
+ export declare function readModelText(response: Response, signal?: AbortSignal): Promise<string>;
19
+ export declare function readModelJson(response: Response, signal?: AbortSignal): Promise<unknown>;
17
20
  //# sourceMappingURL=model-transports.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { OperationLease } from "../shared/delegation-context.ts";
1
2
  import type { ChatRequest, ChatResponse, ChatResponseChunk, EngineChatModel, ModelExecutionOptions, ReasoningConfig } from "../shared/types.ts";
2
3
  import type { ModelSurfaceRouter } from "./model-surface-router.ts";
3
4
  import type { WebSocketFactory } from "./model-transports.ts";
@@ -56,6 +57,9 @@ export declare class RoutedModel implements EngineChatModel {
56
57
  protected readonly router: ModelSurfaceRouter;
57
58
  protected readonly sessionManager?: ProviderSessionManager;
58
59
  protected readonly webSocketFactory: WebSocketFactory;
60
+ private readonly responseLeases;
61
+ protected beginModelAttempt(options?: ModelExecutionOptions): Promise<OperationLease | undefined>;
62
+ private closeResponse;
59
63
  private readonly surfaces;
60
64
  constructor(options: RoutedModelOptions);
61
65
  complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
@@ -84,7 +88,7 @@ export declare class RoutedModel implements EngineChatModel {
84
88
  includeContentType?: boolean;
85
89
  }): Promise<Headers>;
86
90
  protected mapApiError(error: Error): Error;
87
- protected toApiError(response: Response): Promise<Error>;
91
+ protected toApiError(response: Response, signal?: AbortSignal): Promise<Error>;
88
92
  private getSurface;
89
93
  protected withPricingProviderId(request: ChatRequest): ChatRequest;
90
94
  private prepareChatRequest;
@@ -0,0 +1,21 @@
1
+ /** Trusted visibility is independent of display-only command presentation. */
2
+ export declare function isAgentOnlyBashCompletion(value: unknown): value is Record<string, unknown> & {
3
+ deliveryKind: "bash-completion";
4
+ transcriptVisibility: "agent-only";
5
+ subagentReport?: never;
6
+ presentation?: never;
7
+ noticeRole?: never;
8
+ };
9
+ /**
10
+ * Trusted agent-only coordinator notices — both `bash-completion` and
11
+ * `background-work-stopped` stay out of the user transcript under the same
12
+ * negative checks (no report/presentation/noticeRole fields).
13
+ */
14
+ export declare function isAgentOnlyCoordinatorNotice(value: unknown): value is Record<string, unknown> & {
15
+ deliveryKind: "bash-completion" | "background-work-stopped";
16
+ transcriptVisibility: "agent-only";
17
+ subagentReport?: never;
18
+ presentation?: never;
19
+ noticeRole?: never;
20
+ };
21
+ //# sourceMappingURL=bash-completion-visibility.d.ts.map
@@ -0,0 +1,34 @@
1
+ /** Trusted execution lineage, authored by the runtime rather than model input. */
2
+ export type DelegationIdentity = Readonly<{
3
+ rootId: string;
4
+ runId: string;
5
+ parentRunId?: string;
6
+ sessionId: string;
7
+ depth: number;
8
+ allocationGeneration: number;
9
+ }>;
10
+ export type OperationLease = Readonly<{
11
+ release(): void;
12
+ }>;
13
+ /** A live caller retains its input/result arrays; dispatch pulls one item only
14
+ * when this run has no other not-yet-entered operation. No per-item waiters. */
15
+ export interface OperationProducer {
16
+ /** Pull exactly one input. Deliver errors to the caller's result storage and
17
+ * acknowledge entry or terminal pre-entry failure; do not throw from start. */
18
+ start(entered: () => void): void;
19
+ }
20
+ export interface OperationProducerHandle {
21
+ /** Coalesced readiness of this live caller, not a per-input admission wait. */
22
+ ready(): void;
23
+ close(): void;
24
+ }
25
+ export interface OperationScheduler {
26
+ registerProducer?(runId: string, producer: OperationProducer): OperationProducerHandle;
27
+ /** Low-level acquisition for a pulled operation or an entered owner's resume.
28
+ * Fan-out producers must not eagerly acquire once per pending input. */
29
+ acquire(runId: string, signal: AbortSignal): Promise<OperationLease>;
30
+ }
31
+ export interface ModelAttemptGate {
32
+ begin(identity: DelegationIdentity, signal: AbortSignal): Promise<OperationLease>;
33
+ }
34
+ //# sourceMappingURL=delegation-context.d.ts.map
@@ -1,6 +1,9 @@
1
1
  export * from "./abort.ts";
2
2
  export * from "./abort-aware-semaphore.ts";
3
+ export * from "./bash-completion-visibility.ts";
4
+ export * from "./delegation-context.ts";
3
5
  export * from "./model-identity.ts";
6
+ export * from "./operation-scheduler.ts";
4
7
  export * from "./reasoning-config.ts";
5
8
  export * from "./turn-failed.ts";
6
9
  export * from "./types.ts";
@@ -1 +1 @@
1
- (function(_0x3f3dc2,_0x2b1fee){const _0x32df5c={_0x1d46d5:0x1c3,_0x5aa4da:0x1c6,_0x17a06f:0x1d6,_0xb9e1db:0x1cc,_0x1f5282:0x1d2,_0x3d2f6e:0x1ca,_0x4401cb:0x169,_0x51e034:0x15f,_0x2d42c3:0x15a,_0x397569:0x174,_0x3aecf9:0x1ce,_0x5bc1a3:0x15b,_0x21d2f1:0x160,_0x2fbe98:0x16a,_0x345354:0x173,_0x5e05bd:0x1cd,_0x2a679d:0x1c8,_0xe4bc21:0x1c2,_0x150a37:0x1af},_0x7cbece={_0x21ebe2:0x31},_0x9903d0={_0x4151a2:0x30};function _0x344f09(_0x1b3f67,_0x45e4e2,_0x1faf92,_0x35e830){return _0x26dd(_0x1faf92- -_0x9903d0._0x4151a2,_0x35e830);}function _0x502ee5(_0x3081ef,_0x2c35c3,_0x484a27,_0x5e0ddb){return _0x26dd(_0x2c35c3-_0x7cbece._0x21ebe2,_0x484a27);}const _0x3efb74=_0x3f3dc2();while(!![]){try{const _0x4bfc8b=-parseInt(_0x502ee5(0x1c1,0x1c2,_0x32df5c._0x1d46d5,_0x32df5c._0x5aa4da))/0x1*(parseInt(_0x502ee5(_0x32df5c._0x17a06f,_0x32df5c._0xb9e1db,_0x32df5c._0x1f5282,0x1ca))/0x2)+-parseInt(_0x502ee5(0x1c1,0x1be,_0x32df5c._0x3d2f6e,0x1b2))/0x3+-parseInt(_0x344f09(_0x32df5c._0x4401cb,_0x32df5c._0x51e034,0x162,_0x32df5c._0x2d42c3))/0x4+-parseInt(_0x344f09(_0x32df5c._0x397569,0x174,0x171,0x16d))/0x5*(parseInt(_0x502ee5(0x1d3,0x1cf,_0x32df5c._0x17a06f,_0x32df5c._0x3aecf9))/0x6)+-parseInt(_0x344f09(_0x32df5c._0x5bc1a3,_0x32df5c._0x5bc1a3,_0x32df5c._0x21d2f1,_0x32df5c._0x5bc1a3))/0x7+parseInt(_0x344f09(0x163,_0x32df5c._0x2fbe98,0x167,_0x32df5c._0x345354))/0x8*(parseInt(_0x502ee5(0x1c4,_0x32df5c._0x5e05bd,_0x32df5c._0x2a679d,_0x32df5c._0x5e05bd))/0x9)+parseInt(_0x344f09(0x16c,0x16a,0x16a,0x16d))/0xa*(parseInt(_0x502ee5(0x1bf,0x1bb,_0x32df5c._0xe4bc21,_0x32df5c._0x150a37))/0xb);if(_0x4bfc8b===_0x2b1fee)break;else _0x3efb74['push'](_0x3efb74['shift']());}catch(_0x1adbfd){_0x3efb74['push'](_0x3efb74['shift']());}}}(_0x4f45,0xcdbeb));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x4f45(){const _0x2492b3=['mtK0odu1nMX5q1zLvG','DxnLCG','yxnZAxn0yw50','BgvUz3rO','AxngAw5PDgu','oezmtLj2yW','CMvTB3zLqwjVCNrmAxn0zw5LCG','y2fUy2vSBgvK','mtb0zMfgAgK','nJeWELP3AMTU','mZaXmtCWnNzgrM9Tva','CMvZB2X2zq','nKzjCenSAq','C3bSAwnL','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','mZq1nJC1nxDUzffssW','ndy4mtiWmdDYsLf1wwO','CMvQzwn0','CMvHC29U','ndGXmdm5nuTiC2zPzW','Aw5KzxHpzG','ywjVCNrLza','mJi5mJy3nxjYwMLiwa','mJa5mLz5AhzRyG'];_0x4f45=function(){return _0x2492b3;};return _0x4f45();}function _0x43062f(_0xdabb73,_0x340ec5,_0x45a228,_0x3846c1){const _0x52e970={_0x127601:0xdc};return _0x26dd(_0x3846c1- -_0x52e970._0x127601,_0x340ec5);}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x40402b){const _0x1b36e3={_0x269742:0xb3,_0x3869df:0xad,_0x2d2560:0xa4,_0x16a7d1:0xa3,_0x1bea64:0x9d},_0x4dafb6={_0x49100e:0x242,_0x500458:0x23e},_0x156b2a={_0x5a18e4:0x168,_0x1e8d94:0x10d},_0x551796={_0x362cc0:0x57,_0x4b811c:0x55,_0x3aea24:0x61,_0x8531d3:0x66,_0x39722b:0x5a,_0x20b2a3:0x5b,_0x4d88c0:0x52,_0x364656:0x56,_0x186525:0x61},_0x3c1550={_0x2e6652:0x1f1,_0x21d2d6:0x50},_0x25ec9f={_0x256843:0x7f,_0x2e0eb2:0x45};if(!Number[_0x16950f(-_0x1b36e3._0x269742,-0xb1,-_0x1b36e3._0x3869df,-0xa1)](_0x40402b)||!Number['isInteger'](_0x40402b)||_0x40402b<=0x0)throw new Error(_0x16950f(-0xab,-_0x1b36e3._0x2d2560,-_0x1b36e3._0x16a7d1,-_0x1b36e3._0x1bea64));let _0x2326cc=0x0;const _0xddd9ed=[];function _0x1d3b3f(_0x2999bf,_0x528cd9,_0x52c131,_0x339324){return _0x26dd(_0x339324- -0x348,_0x2999bf);}const _0x3d4f15=()=>{let _0x1536fb=![];return()=>{if(_0x1536fb)return;_0x1536fb=!![],_0x2326cc-=0x1,_0x469068();};},_0x469068=()=>{function _0x48ea57(_0x57b895,_0x49802c,_0x42c258,_0x453e8b){return _0x16950f(_0x57b895,_0x49802c-_0x25ec9f._0x256843,_0x42c258-0x15a,_0x453e8b-_0x25ec9f._0x2e0eb2);}function _0x6c1a7(_0x28f6dc,_0x37eb2c,_0x534037,_0xfb5a8){return _0x16950f(_0x534037,_0x37eb2c-_0x3c1550._0x2e6652,_0x37eb2c-_0x3c1550._0x21d2d6,_0xfb5a8-0x127);}while(_0xddd9ed[_0x6c1a7(-0x62,-0x5e,-_0x551796._0x362cc0,-_0x551796._0x4b811c)]>0x0){const _0x4c2418=_0xddd9ed['shift']();if(!_0x4c2418||_0x4c2418[_0x6c1a7(-_0x551796._0x3aea24,-0x5a,-0x5a,-_0x551796._0x8531d3)])continue;_0x4c2418[_0x6c1a7(-0x50,-_0x551796._0x39722b,-0x65,-_0x551796._0x4b811c)]=!![],_0x4c2418[_0x6c1a7(-0x57,-_0x551796._0x20b2a3,-_0x551796._0x4d88c0,-_0x551796._0x39722b)](),_0x2326cc+=0x1,_0x4c2418[_0x6c1a7(-0x56,-_0x551796._0x364656,-_0x551796._0x186525,-0x50)](_0x3d4f15());return;}};function _0x16950f(_0xd4c709,_0x282766,_0x34f732,_0xebf102){return _0x26dd(_0x34f732- -0x243,_0xd4c709);}const _0x4be7a=()=>{if(_0x2326cc>=_0x40402b)return void 0x0;return _0x2326cc+=0x1,_0x3d4f15();};return{'tryAcquire':_0x4be7a,'acquire'(_0x5183d4){const _0x5a7cbe={_0x327916:0x109,_0x27ae18:0xf8,_0x3cc9de:0x108,_0x31eca0:0x103,_0x5994c2:0x111,_0x13aee7:0xf9,_0x5c7f29:0xfa,_0x5781c4:0xfd,_0x57026c:0xfb,_0x52523d:0x2ad,_0x34440d:0x2b3},_0x356804={_0x5df42a:0x1e,_0x83d871:0x30};function _0x30fae4(_0x3c5b6d,_0x4eaa89,_0x57d279,_0x421230){return _0x16950f(_0x57d279,_0x4eaa89-_0x356804._0x5df42a,_0x421230- -0x18e,_0x421230-_0x356804._0x83d871);}if(_0x5183d4?.[_0x30fae4(-0x24d,-0x23c,-0x246,-_0x4dafb6._0x49100e)])return Promise['reject'](toAbortError(_0x5183d4[_0x30fae4(-0x24f,-_0x4dafb6._0x500458,-0x24d,-0x245)]));const _0x595e27=_0x4be7a();if(_0x595e27!==void 0x0)return Promise['resolve'](_0x595e27);function _0x4e44c9(_0xad30f9,_0x1bf98d,_0x47d923,_0x141571){return _0x16950f(_0x47d923,_0x1bf98d-_0x156b2a._0x5a18e4,_0x141571- -0x72,_0x141571-_0x156b2a._0x1e8d94);}return new Promise((_0x49f22a,_0x3030e6)=>{const _0x3d3bcf={'resolve':_0x49f22a,'reject':_0x3030e6,'cancelled':![],'removeAbortListener':()=>{}};_0xddd9ed['push'](_0x3d3bcf),_0x3d3bcf['removeAbortListener']=addAbortListener(_0x5183d4,()=>{const _0x21beb0={_0x248f5f:0x29c};if(_0x3d3bcf[_0x242678(-0xff,-_0x5a7cbe._0x327916,-0x103,-_0x5a7cbe._0x27ae18)])return;_0x3d3bcf[_0x242678(-0xfe,-_0x5a7cbe._0x3cc9de,-_0x5a7cbe._0x31eca0,-0x10e)]=!![],_0x3d3bcf['removeAbortListener']();const _0x5d112a=_0xddd9ed[_0x242678(-_0x5a7cbe._0x5994c2,-0x10a,-0x10e,-0x103)](_0x3d3bcf);if(_0x5d112a>=0x0)_0xddd9ed[_0x242678(-_0x5a7cbe._0x13aee7,-_0x5a7cbe._0x5c7f29,-_0x5a7cbe._0x5781c4,-_0x5a7cbe._0x57026c)](_0x5d112a,0x1);function _0x46623b(_0x5b6ac8,_0x1be020,_0x57547d,_0xb5908f){return _0x26dd(_0xb5908f-0x128,_0x5b6ac8);}function _0x242678(_0x3c8bd9,_0x38a51b,_0x53bd3e,_0x28fa02){return _0x26dd(_0x53bd3e- -_0x21beb0._0x248f5f,_0x28fa02);}_0x3d3bcf[_0x46623b(0x2b8,_0x5a7cbe._0x52523d,0x2b9,_0x5a7cbe._0x34440d)](toAbortError(_0x5183d4?.['reason']));});});}};}function _0x26dd(_0x5f4d05,_0x4d7b23){_0x5f4d05=_0x5f4d05-0x18a;const _0x4f45fa=_0x4f45();let _0x26dd0d=_0x4f45fa[_0x5f4d05];if(_0x26dd['VZKJrs']===undefined){var _0x45fd4d=function(_0x304a2b){const _0x5b2713='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x40402b='',_0x2326cc='';for(let _0xddd9ed=0x0,_0x3d4f15,_0x469068,_0x4be7a=0x0;_0x469068=_0x304a2b['charAt'](_0x4be7a++);~_0x469068&&(_0x3d4f15=_0xddd9ed%0x4?_0x3d4f15*0x40+_0x469068:_0x469068,_0xddd9ed++%0x4)?_0x40402b+=String['fromCharCode'](0xff&_0x3d4f15>>(-0x2*_0xddd9ed&0x6)):0x0){_0x469068=_0x5b2713['indexOf'](_0x469068);}for(let _0x1536fb=0x0,_0x4c2418=_0x40402b['length'];_0x1536fb<_0x4c2418;_0x1536fb++){_0x2326cc+='%'+('00'+_0x40402b['charCodeAt'](_0x1536fb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2326cc);};_0x26dd['eFcrGT']=_0x45fd4d,_0x26dd['QUDOLx']={},_0x26dd['VZKJrs']=!![];}const _0x4009e6=_0x4f45fa[0x0],_0x5918ed=_0x5f4d05+_0x4009e6,_0x2d1ae0=_0x26dd['QUDOLx'][_0x5918ed];return!_0x2d1ae0?(_0x26dd0d=_0x26dd['eFcrGT'](_0x26dd0d),_0x26dd['QUDOLx'][_0x5918ed]=_0x26dd0d):_0x26dd0d=_0x2d1ae0,_0x26dd0d;}var MESSAGE_ROLES=[_0x43062f(0xb4,0xc2,0xb1,0xb8),_0x4dc2c6(0xc6,0xce,0xcb,0xcc)];Object['freeze'](MESSAGE_ROLES);function _0x4dc2c6(_0x592679,_0x1c92e9,_0x1dfd5a,_0x833d61){return _0x26dd(_0x592679- -0xcd,_0x1c92e9);}export{MESSAGE_ROLES,OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
1
+ (function(_0x157036,_0x7e93c5){const _0x4931ef={_0x2044cb:0x174,_0x3e305a:0x16f,_0x20c137:0x162,_0x454d46:0x154,_0x21bd6f:0x174,_0x1b8005:0x146,_0x3390dd:0x14b,_0x1fa095:0x156,_0x5ba1f4:0x173,_0x500c92:0x15c,_0xac0750:0x15e,_0x4e94ab:0x148,_0x243ff7:0x150,_0x580774:0x158,_0x3a081d:0x161,_0x3d8dfa:0x15d,_0x53bd50:0x25c,_0x415988:0x26d,_0x243a41:0x148,_0x459378:0x157,_0x4fad32:0x26f,_0x45f276:0x257,_0x383bce:0x28f},_0xf2eddb={_0x34a5e3:0x1dd},_0x1be325=_0x157036();function _0x591ccc(_0x5792ad,_0xf48a1f,_0x54849f,_0x29d5a2){return _0x5e6f(_0x54849f- -0x2fd,_0x5792ad);}function _0x3150b3(_0x1d48ad,_0x4a112f,_0x442c22,_0x1f7a2e){return _0x5e6f(_0x442c22- -_0xf2eddb._0x34a5e3,_0x1d48ad);}while(!![]){try{const _0x3e775e=-parseInt(_0x3150b3(-_0x4931ef._0x2044cb,-_0x4931ef._0x3e305a,-_0x4931ef._0x20c137,-0x14d))/0x1*(-parseInt(_0x3150b3(-_0x4931ef._0x454d46,-0x164,-0x164,-_0x4931ef._0x21bd6f))/0x2)+-parseInt(_0x3150b3(-0x15e,-_0x4931ef._0x1b8005,-_0x4931ef._0x3390dd,-0x15f))/0x3*(-parseInt(_0x3150b3(-0x145,-0x159,-0x155,-_0x4931ef._0x1fa095))/0x4)+-parseInt(_0x3150b3(-_0x4931ef._0x5ba1f4,-_0x4931ef._0x500c92,-_0x4931ef._0xac0750,-0x14f))/0x5*(-parseInt(_0x3150b3(-0x153,-_0x4931ef._0x4e94ab,-_0x4931ef._0x243ff7,-_0x4931ef._0x580774))/0x6)+parseInt(_0x3150b3(-0x15d,-_0x4931ef._0x3a081d,-_0x4931ef._0x3d8dfa,-0x16f))/0x7*(parseInt(_0x591ccc(-0x26b,-_0x4931ef._0x53bd50,-_0x4931ef._0x415988,-0x279))/0x8)+-parseInt(_0x3150b3(-0x145,-0x131,-0x146,-_0x4931ef._0x243a41))/0x9+-parseInt(_0x3150b3(-_0x4931ef._0x3a081d,-0x15e,-0x156,-_0x4931ef._0x459378))/0xa+-parseInt(_0x591ccc(-_0x4931ef._0x4fad32,-0x275,-0x26a,-_0x4931ef._0x45f276))/0xb*(-parseInt(_0x591ccc(-_0x4931ef._0x383bce,-0x273,-0x27a,-0x26c))/0xc);if(_0x3e775e===_0x7e93c5)break;else _0x1be325['push'](_0x1be325['shift']());}catch(_0x4a8bf8){_0x1be325['push'](_0x1be325['shift']());}}}(_0x445f,0xb3602));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';import{TurnFailedError,isAgentOnlyBashCompletion,isAgentOnlyCoordinatorNotice}from'../chunk-YTDATWXW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x8781b2){const _0x259e27={_0x436308:0x130,_0x2ba35a:0x143,_0x411828:0x12f,_0xd24de5:0x142,_0x2b1839:0x140,_0x2e80fd:0x119},_0x39a4ac={_0x27648c:0x9e,_0x10028a:0xa9,_0xbf92af:0xb8,_0x316dd8:0x2ef,_0x3cd59b:0x2dc,_0x34a8a8:0x301,_0x5cc7c2:0x2f1,_0x78a3e2:0x2d0,_0x273cfd:0x2d5},_0x4d42e9={_0x59146e:0x1b1,_0x4ea71a:0xb5,_0x5b0908:0x52},_0x58a7c4={_0x3368fb:0x1ab,_0x4a29eb:0x45},_0x29c704={_0x12ba45:0x46,_0x211ab0:0x36,_0x55cfb0:0x42,_0x146368:0x44,_0x22646c:0x135,_0x8bb47:0x12a,_0x45353e:0x13c},_0x301c88={_0x3d7dce:0x1a},_0x20d175={_0x5eed11:0xa5};if(!Number[_0x40ff20(0x125,_0x259e27._0x436308,_0x259e27._0x2ba35a,_0x259e27._0x411828)](_0x8781b2)||!Number[_0x40ff20(_0x259e27._0xd24de5,_0x259e27._0x2b1839,0x130,0x151)](_0x8781b2)||_0x8781b2<=0x0)throw new Error(_0x40ff20(0x124,0x121,_0x259e27._0x2e80fd,0x11f));function _0xe24f06(_0xd9680f,_0x1a4021,_0xe41ba2,_0xab13ee){return _0x5e6f(_0xab13ee-0x77,_0x1a4021);}let _0x286c0d=0x0;const _0x5b6e37=[],_0x126cf8=()=>{let _0x539590=![];return()=>{if(_0x539590)return;_0x539590=!![],_0x286c0d-=0x1,_0x370c4();};};function _0x40ff20(_0x49c7fc,_0x31eb25,_0x5b26d1,_0x3d8da7){return _0x5e6f(_0x31eb25-_0x20d175._0x5eed11,_0x49c7fc);}const _0x370c4=()=>{const _0x230727={_0x1ca370:0x1ad};function _0x20b950(_0x2deddf,_0x345283,_0x4fc3c1,_0x3a08b1){return _0x40ff20(_0x345283,_0x3a08b1- -0x16e,_0x4fc3c1-_0x230727._0x1ca370,_0x3a08b1-0x71);}function _0x4d585d(_0x5c11aa,_0x5bcfee,_0x1ca997,_0x4d9f98){return _0x40ff20(_0x5bcfee,_0x5c11aa-_0x301c88._0x3d7dce,_0x1ca997-0x1e6,_0x4d9f98-0x109);}while(_0x5b6e37[_0x20b950(-_0x29c704._0x12ba45,-_0x29c704._0x211ab0,-_0x29c704._0x55cfb0,-_0x29c704._0x146368)]>0x0){const _0x5771fe=_0x5b6e37['shift']();if(!_0x5771fe||_0x5771fe['cancelled'])continue;_0x5771fe[_0x4d585d(_0x29c704._0x22646c,_0x29c704._0x8bb47,0x12c,_0x29c704._0x45353e)]=!![],_0x5771fe['removeAbortListener'](),_0x286c0d+=0x1,_0x5771fe['resolve'](_0x126cf8());return;}},_0x4c809b=()=>{if(_0x286c0d>=_0x8781b2)return void 0x0;return _0x286c0d+=0x1,_0x126cf8();};return{'tryAcquire':_0x4c809b,'acquire'(_0x25c0f3){const _0xcd25bf={_0x3d7781:0x34b,_0x91cdfa:0x353,_0x4082c1:0x345,_0x5bf78d:0x33e},_0x15c55b={_0x32023b:0x178,_0x41997d:0x170,_0x2f8502:0x168,_0x597b95:0x143,_0x4c58d8:0x149,_0xa12796:0x14c,_0x30aa21:0x179,_0x110087:0x165,_0x1e82f5:0x6f,_0x551f2f:0x7f,_0x3b941f:0x80,_0x2426fe:0x136,_0x5e4890:0x142,_0x31718f:0x14d},_0x23cedd={_0x9d0d7e:0x2c};if(_0x25c0f3?.[_0x2b6ad8(0xcb,0xc6,0xc1,0xcf)])return Promise[_0x2b6ad8(0xbc,_0x39a4ac._0x27648c,_0x39a4ac._0x10028a,_0x39a4ac._0xbf92af)](toAbortError(_0x25c0f3[_0x283a00(_0x39a4ac._0x316dd8,_0x39a4ac._0x3cd59b,_0x39a4ac._0x34a8a8,0x2f2)]));const _0x388ce1=_0x4c809b();function _0x283a00(_0x49b883,_0x54e6c0,_0x41e535,_0x7a43e2){return _0xe24f06(_0x49b883-_0x58a7c4._0x3368fb,_0x41e535,_0x41e535-_0x58a7c4._0x4a29eb,_0x49b883-0x1d9);}if(_0x388ce1!==void 0x0)return Promise[_0x283a00(0x2dc,_0x39a4ac._0x5cc7c2,_0x39a4ac._0x78a3e2,_0x39a4ac._0x273cfd)](_0x388ce1);function _0x2b6ad8(_0x580625,_0x344213,_0x52d3ff,_0x28adfa){return _0xe24f06(_0x580625-_0x4d42e9._0x59146e,_0x580625,_0x52d3ff-_0x4d42e9._0x4ea71a,_0x52d3ff- -_0x4d42e9._0x5b0908);}return new Promise((_0x55b40f,_0x4aaad3)=>{const _0x3160d9={_0x53db46:0x10},_0x7d8aaf={_0x1e6948:0x1a0,_0x11e636:0xcc,_0x58e54:0x7e},_0x1bd3aa={'resolve':_0x55b40f,'reject':_0x4aaad3,'cancelled':![],'removeAbortListener':()=>{}};function _0x591663(_0x16788b,_0x1f7e18,_0xafb3a1,_0x236be1){return _0x2b6ad8(_0xafb3a1,_0x1f7e18-_0x7d8aaf._0x1e6948,_0x236be1- -_0x7d8aaf._0x11e636,_0x236be1-_0x7d8aaf._0x58e54);}function _0x5c35c5(_0x5d8bab,_0x5e10cb,_0x3b6d60,_0x48dec9){return _0x283a00(_0x5d8bab- -0x631,_0x5e10cb-0x36,_0x48dec9,_0x48dec9-_0x23cedd._0x9d0d7e);}_0x5b6e37[_0x5c35c5(-_0xcd25bf._0x3d7781,-0x352,-_0xcd25bf._0x91cdfa,-0x354)](_0x1bd3aa),_0x1bd3aa[_0x5c35c5(-0x349,-_0xcd25bf._0x4082c1,-_0xcd25bf._0x5bf78d,-0x35e)]=addAbortListener(_0x25c0f3,()=>{const _0xece441={_0x5797ab:0x4c};if(_0x1bd3aa[_0x1b34fa(-_0x15c55b._0x32023b,-_0x15c55b._0x41997d,-_0x15c55b._0x2f8502,-0x17d)])return;_0x1bd3aa['cancelled']=!![],_0x1bd3aa[_0x1b34fa(-_0x15c55b._0x597b95,-0x14e,-_0x15c55b._0x4c58d8,-_0x15c55b._0xa12796)]();const _0x407476=_0x5b6e37[_0x1b34fa(-0x162,-0x168,-_0x15c55b._0x30aa21,-_0x15c55b._0x110087)](_0x1bd3aa);function _0xb403eb(_0x3c8c4a,_0x43009b,_0x5f1a16,_0x3fbd48){return _0x591663(_0x3c8c4a-0x1cb,_0x43009b-0x194,_0x5f1a16,_0x3c8c4a- -_0xece441._0x5797ab);}function _0x1b34fa(_0x448f12,_0x4111c5,_0x59b85f,_0x25c414){return _0x591663(_0x448f12-0x31,_0x4111c5-_0x3160d9._0x53db46,_0x448f12,_0x4111c5- -0x13f);}if(_0x407476>=0x0)_0x5b6e37[_0x1b34fa(-0x15e,-0x152,-0x155,-0x162)](_0x407476,0x1);_0x1bd3aa[_0xb403eb(-_0x15c55b._0x1e82f5,-0x6c,-_0x15c55b._0x551f2f,-_0x15c55b._0x3b941f)](toAbortError(_0x25c0f3?.[_0x1b34fa(-_0x15c55b._0x2426fe,-0x147,-_0x15c55b._0x5e4890,-_0x15c55b._0x31718f)]));});});}};}function _0x5e6f(_0x355e57,_0x5f81ec){_0x355e57=_0x355e57-0x76;const _0x445f74=_0x445f();let _0x5e6fb0=_0x445f74[_0x355e57];if(_0x5e6f['TKlZrc']===undefined){var _0x2c489f=function(_0x5a61fb){const _0x37e686='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x8781b2='',_0x286c0d='';for(let _0x5b6e37=0x0,_0x126cf8,_0x370c4,_0x4c809b=0x0;_0x370c4=_0x5a61fb['charAt'](_0x4c809b++);~_0x370c4&&(_0x126cf8=_0x5b6e37%0x4?_0x126cf8*0x40+_0x370c4:_0x370c4,_0x5b6e37++%0x4)?_0x8781b2+=String['fromCharCode'](0xff&_0x126cf8>>(-0x2*_0x5b6e37&0x6)):0x0){_0x370c4=_0x37e686['indexOf'](_0x370c4);}for(let _0x539590=0x0,_0x5771fe=_0x8781b2['length'];_0x539590<_0x5771fe;_0x539590++){_0x286c0d+='%'+('00'+_0x8781b2['charCodeAt'](_0x539590)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x286c0d);};_0x5e6f['rqosxa']=_0x2c489f,_0x5e6f['ZVpfkl']={},_0x5e6f['TKlZrc']=!![];}const _0x4096cc=_0x445f74[0x0],_0x22a0d6=_0x355e57+_0x4096cc,_0x5c06f6=_0x5e6f['ZVpfkl'][_0x22a0d6];return!_0x5c06f6?(_0x5e6fb0=_0x5e6f['rqosxa'](_0x5e6fb0),_0x5e6f['ZVpfkl'][_0x22a0d6]=_0x5e6fb0):_0x5e6fb0=_0x5c06f6,_0x5e6fb0;}function createOperationScheduler(_0x2b2b8f){const _0x1331b0={_0x12e960:0x3a0,_0x2827eb:0x3c3},_0x127dad={_0x1470d5:0x1c0},_0x783f99={_0x32cc91:0x52},_0x472e98={_0xe060ff:0xa0},_0x317b02={_0x2d5d71:0x135,_0x4f4aba:0x15a},_0x16f6b0={_0x2064be:0x7f},_0x4041dd={_0x44e534:0x409,_0x3019dd:0x3f3,_0x169516:0x421,_0xfe603b:0x42f,_0x3e655:0x426,_0x546ff4:0x40a,_0x2f8afb:0x418,_0x51d6d3:0x40b,_0x19c2d4:0x423},_0x4849f8={_0x598a55:0x148,_0x215aff:0x66},_0x392536={_0x4d62e4:0x33,_0x47915e:0x37},_0x1b1c86={_0x16cf4b:0x31f};if(!Number['isSafeInteger'](_0x2b2b8f)||_0x2b2b8f<=0x0)throw new Error(_0x3bf9fb(_0x1331b0._0x12e960,0x3c1,_0x1331b0._0x2827eb,0x3ae));function _0x3bf9fb(_0x56f1ef,_0x431b7d,_0x111246,_0x3f7e73){return _0x5e6f(_0x3f7e73-_0x1b1c86._0x16cf4b,_0x56f1ef);}const _0x10c083=new Map(),_0x278ce8=(_0x21605f,_0x170a9b)=>{const _0x5357df={_0x20464a:0x382,_0x58d08a:0x371,_0x4a6ce9:0x370,_0x11dc54:0x36d,_0x4c1dad:0x37d,_0x2bd1ef:0x38e,_0x1cfc91:0x36b,_0x3e42d7:0x247,_0x358267:0x23a,_0x4bba94:0x24d,_0x4996f9:0x244},_0x130b81={_0x345b39:0x108,_0x46ac3:0x27f},_0x7aaa4f={_0x54cd1b:0x34,_0x56c147:0x2c,_0x22caa6:0x1f1,_0x31c2ac:0x1ef,_0x5c2de5:0x1f0},_0x442da6={_0x297de0:0x2a9,_0x90df:0x2b4,_0x1d0774:0x2a0,_0x39b7e8:0x2aa,_0x5bc8bd:0x1e6,_0x46a25c:0x2b1,_0xa7277b:0x2b0,_0x3be1b2:0x2af,_0x38be26:0x204,_0xb0d59b:0x2d7,_0x3d9a36:0x2d0,_0x17b5b7:0x1de},_0x48f9c5={_0x5c5c0e:0xf4,_0x2de026:0x275},_0x335d74={_0x19ef27:0x1df,_0x5cb46c:0x362};let _0xc1747f=_0x10c083[_0x315a45(_0x392536._0x4d62e4,0x3c,0x2f,_0x392536._0x47915e)](_0x21605f);!_0xc1747f&&(_0xc1747f={'ready':[],'starting':![],'registrations':0x0},_0x10c083['set'](_0x21605f,_0xc1747f));const _0x42abcc=_0xc1747f;function _0x315a45(_0x503da3,_0x5d5053,_0x32904a,_0x2098c3){return _0x3bf9fb(_0x5d5053,_0x5d5053-_0x335d74._0x19ef27,_0x32904a-0xe2,_0x2098c3- -_0x335d74._0x5cb46c);}_0x42abcc['registrations']++;const _0x50fb75={'source':_0x170a9b,'queued':![],'closed':![]},_0x40c093=()=>{const _0x193658={_0x363d81:0x128,_0x4f98e1:0x139},_0x584686={_0x14fac0:0xee,_0x37015f:0x49},_0x107883={_0x1e8320:0x62};if(_0x42abcc[_0x3108ab(_0x442da6._0x297de0,0x2b5,0x2a1,_0x442da6._0x90df)])return;const _0x56c11f=_0x42abcc[_0x3108ab(_0x442da6._0x1d0774,0x29f,0x296,_0x442da6._0x39b7e8)][_0x4d59ae(-0x1e2,-_0x442da6._0x5bc8bd,-0x1cd,-0x1f5)]();if(!_0x56c11f){if(_0x42abcc[_0x3108ab(_0x442da6._0x46a25c,_0x442da6._0xa7277b,0x2ba,_0x442da6._0x3be1b2)]===0x0&&_0x10c083[_0x4d59ae(-0x201,-_0x442da6._0x38be26,-0x1f2,-0x1ec)](_0x21605f)===_0x42abcc)_0x10c083[_0x3108ab(_0x442da6._0xb0d59b,_0x442da6._0x3d9a36,_0x442da6._0x3be1b2,0x2c3)](_0x21605f);return;}function _0x3108ab(_0x3d7c95,_0xbece2b,_0x2df992,_0x5b2eff){return _0x315a45(_0x3d7c95-_0x48f9c5._0x5c5c0e,_0x2df992,_0x2df992-0x40,_0x5b2eff-_0x48f9c5._0x2de026);}_0x56c11f['queued']=![],_0x42abcc['starting']=!![];function _0x4d59ae(_0x5c22eb,_0x2a17ae,_0x56ae56,_0x5f2e90){return _0x315a45(_0x5c22eb-_0x107883._0x1e8320,_0x5f2e90,_0x56ae56-0x117,_0x5c22eb- -0x238);}let _0x3f7520=![];const _0x4ff061=()=>{if(_0x3f7520)return;_0x3f7520=!![];function _0x1a3de4(_0x4987e1,_0x4d0bd3,_0x217db3,_0x166080){return _0x4d59ae(_0x4987e1-0x32b,_0x4d0bd3-_0x584686._0x14fac0,_0x217db3-_0x584686._0x37015f,_0x4d0bd3);}_0x42abcc[_0x1a3de4(0x132,_0x193658._0x363d81,_0x193658._0x4f98e1,0x142)]=![],queueMicrotask(_0x40c093);};_0x56c11f[_0x3108ab(0x29e,0x2a9,0x2c1,0x2b3)][_0x4d59ae(-_0x442da6._0x17b5b7,-0x1e3,-0x1e0,-0x1da)](_0x4ff061);};return{'ready'(){const _0x19b1a0={_0x3f62f3:0x17d,_0xc24c0e:0x31};if(_0x50fb75[_0x5c6dad(-_0x7aaa4f._0x54cd1b,-0x3d,-0x38,-_0x7aaa4f._0x56c147)]||_0x50fb75[_0x264179(0x1e7,0x1d2,_0x7aaa4f._0x22caa6,_0x7aaa4f._0x31c2ac)])return;_0x50fb75[_0x264179(0x1e7,_0x7aaa4f._0x22caa6,_0x7aaa4f._0x5c2de5,0x1ea)]=!![];function _0x264179(_0x4b9116,_0x53ab9c,_0x297ac9,_0x1ef14b){return _0x315a45(_0x4b9116-0xf,_0x1ef14b,_0x297ac9-0x1ef,_0x4b9116-0x1a1);}_0x42abcc['ready']['push'](_0x50fb75);function _0x5c6dad(_0x2b3b46,_0xbcab9a,_0x2156c8,_0x2a4c08){return _0x315a45(_0x2b3b46-_0x19b1a0._0x3f62f3,_0x2b3b46,_0x2156c8-_0x19b1a0._0xc24c0e,_0xbcab9a- -0x80);}queueMicrotask(_0x40c093);},'close'(){const _0x316590={_0x29de98:0x170,_0x3c7da0:0x66};if(_0x50fb75['closed'])return;_0x50fb75['closed']=!![];function _0x175452(_0xf85c16,_0x43191a,_0x166b04,_0x1acb54){return _0x315a45(_0xf85c16-0x191,_0xf85c16,_0x166b04-_0x130b81._0x345b39,_0x1acb54- -_0x130b81._0x46ac3);}_0x42abcc[_0x1e50f2(_0x5357df._0x20464a,_0x5357df._0x58d08a,0x37f,_0x5357df._0x4a6ce9)]--;_0x50fb75[_0x1e50f2(_0x5357df._0x11dc54,_0x5357df._0x4c1dad,_0x5357df._0x2bd1ef,_0x5357df._0x1cfc91)]&&(_0x42abcc[_0x175452(-0x250,-0x25e,-0x254,-0x24a)]['splice'](_0x42abcc['ready'][_0x175452(-_0x5357df._0x3e42d7,-_0x5357df._0x358267,-_0x5357df._0x4bba94,-_0x5357df._0x4996f9)](_0x50fb75),0x1),_0x50fb75['queued']=![]);function _0x1e50f2(_0x5a1528,_0x304d4d,_0x474c2b,_0x1f5432){return _0x315a45(_0x5a1528-_0x316590._0x29de98,_0x474c2b,_0x474c2b-_0x316590._0x3c7da0,_0x304d4d-0x337);}_0x40c093();}};};let _0x5168f4=0x0;const _0x211713=new Map(),_0x1849c5=[],_0x1fde5a=()=>{const _0x4336b8={_0x4c130c:0x5f,_0x3e9f0f:0x169,_0xddd5a6:0x523};function _0x3b9dd3(_0x4a961b,_0x1a12c7,_0x32edcb,_0x3abedc){return _0x3bf9fb(_0x3abedc,_0x1a12c7-0x157,_0x32edcb-_0x4849f8._0x598a55,_0x1a12c7-_0x4849f8._0x215aff);}function _0x147831(_0x2852c5,_0x2d6e67,_0x5ba342,_0x327a22){return _0x3bf9fb(_0x5ba342,_0x2d6e67-_0x4336b8._0x4c130c,_0x5ba342-_0x4336b8._0x3e9f0f,_0x2852c5- -_0x4336b8._0xddd5a6);}while(_0x5168f4<_0x2b2b8f&&_0x1849c5['length']>0x0){const _0x36b4ef=_0x1849c5[_0x3b9dd3(0x422,0x41e,0x420,0x414)]();if(_0x36b4ef===void 0x0)break;const _0x1ee908=_0x211713[_0x3b9dd3(_0x4041dd._0x44e534,0x3ff,0x3fa,_0x4041dd._0x3019dd)](_0x36b4ef),_0x5f4e35=_0x1ee908?.[_0x3b9dd3(_0x4041dd._0x169516,0x41e,0x431,0x425)]();if(!_0x1ee908||!_0x5f4e35)throw new Error(_0x3b9dd3(_0x4041dd._0xfe603b,0x41f,0x416,_0x4041dd._0x3e655));_0x5f4e35['removeAbortListener']();if(_0x1ee908[_0x3b9dd3(0x414,_0x4041dd._0x546ff4,_0x4041dd._0x2f8afb,0x3fc)]>0x0)_0x1849c5[_0x3b9dd3(_0x4041dd._0x51d6d3,0x41b,0x420,_0x4041dd._0x19c2d4)](_0x36b4ef);else _0x211713['delete'](_0x36b4ef);_0x5168f4+=0x1;let _0x415e6e=![];_0x5f4e35[_0x3b9dd3(_0x4041dd._0x19c2d4,0x411,0x41d,0x417)]({'release'(){if(_0x415e6e)return;_0x415e6e=!![],_0x5168f4-=0x1,_0x1fde5a();}});}};return{'registerProducer':_0x278ce8,'acquire'(_0x523b0c,_0x5d1f55){const _0x58db1e={_0x5a483c:0x1,_0x35ed3b:0x10,_0x159e59:0x11e,_0x2f22ea:0x121,_0x1d8441:0x11d,_0x3d375d:0x2e,_0x50a971:0x2c,_0x4ddfcc:0x40},_0x4f8c8a={_0x2a7dd2:0x3d5,_0x215d9f:0x110},_0x56b575={_0x29696b:0x166,_0x444877:0x4f8};function _0xb8490b(_0x555c62,_0x3163a1,_0x162140,_0x51ee1b){return _0x3bf9fb(_0x51ee1b,_0x3163a1-0x32,_0x162140-_0x56b575._0x29696b,_0x162140- -_0x56b575._0x444877);}function _0x3ba07b(_0x1da345,_0x3df48c,_0xb6f3f5,_0x2c64ab){return _0x3bf9fb(_0x1da345,_0x3df48c-_0x16f6b0._0x2064be,_0xb6f3f5-0xd2,_0x3df48c-0x4c);}if(_0x5d1f55[_0xb8490b(-0x129,-0x134,-0x13d,-_0x317b02._0x2d5d71)])return Promise[_0xb8490b(-0x166,-_0x317b02._0x4f4aba,-0x155,-0x141)](toAbortError(_0x5d1f55['reason']));return new Promise((_0x420f2d,_0x43fedb)=>{const _0x57fcba={_0x20df0d:0x176,_0x5f0de6:0x197,_0x1561d4:0x164,_0x3e4bbe:0x226,_0x234156:0x248,_0x54f3cf:0x227,_0x4c8ac9:0x209,_0x1c071a:0x219},_0x189962={_0x8dbc13:0xdc,_0x29f374:0x1d7};let _0x114b18=_0x211713[_0x1db3bc(-_0x58db1e._0x5a483c,0x18,_0x58db1e._0x35ed3b,0x15)](_0x523b0c);!_0x114b18&&(_0x114b18=[],_0x211713[_0x3f01db(_0x58db1e._0x159e59,0x10e,0x113,_0x58db1e._0x2f22ea)](_0x523b0c,_0x114b18),_0x1849c5[_0x3f01db(_0x58db1e._0x1d8441,0x114,0x11b,0x128)](_0x523b0c));const _0xc607d1={'resolve':_0x420f2d,'removeAbortListener':()=>_0x5d1f55[_0x1db3bc(0x2b,0x31,0x2b,0x35)](_0x3f01db(0x10e,0x109,0xfc,0x108),_0x18d97e)};function _0x3f01db(_0x293e38,_0x5d647c,_0xa591e1,_0x8402f7){return _0x3ba07b(_0x5d647c,_0xa591e1- -0x2e6,_0xa591e1-_0x189962._0x8dbc13,_0x8402f7-_0x189962._0x29f374);}const _0x41f79b=_0x114b18;function _0x1db3bc(_0x1941e5,_0x12ca61,_0x435817,_0x453a3f){return _0x3ba07b(_0x453a3f,_0x435817- -_0x4f8c8a._0x2a7dd2,_0x435817-_0x4f8c8a._0x215d9f,_0x453a3f-0xb);}const _0x18d97e=()=>{const _0x4f87d0={_0x27c2e0:0x1b7};_0x41f79b[_0x57170c(_0x57fcba._0x20df0d,0x175,0x182,_0x57fcba._0x5f0de6)](_0x41f79b[_0x57170c(_0x57fcba._0x1561d4,0x17f,0x16c,0x15d)](_0xc607d1),0x1);_0x41f79b['length']===0x0&&(_0x211713[_0x57170c(0x190,0x17b,0x17f,0x16e)](_0x523b0c),_0x1849c5[_0x46cf6c(-0x232,-0x215,-0x20f,-0x21d)](_0x1849c5[_0x46cf6c(-_0x57fcba._0x3e4bbe,-_0x57fcba._0x234156,-0x226,-0x233)](_0x523b0c),0x1));function _0x57170c(_0x1e1470,_0x14a653,_0x268bfc,_0x52d462){return _0x1db3bc(_0x1e1470-_0x4f87d0._0x27c2e0,_0x14a653-0xf5,_0x268bfc-0x158,_0x52d462);}function _0x46cf6c(_0xa20c7a,_0x211583,_0x300f95,_0x53907b){return _0x3f01db(_0xa20c7a-0x6a,_0x300f95,_0x53907b- -0x336,_0x53907b-0xe2);}_0xc607d1[_0x46cf6c(-_0x57fcba._0x54f3cf,-0x222,-_0x57fcba._0x4c8ac9,-_0x57fcba._0x1c071a)](),_0x43fedb(toAbortError(_0x5d1f55['reason']));};_0x5d1f55['addEventListener'](_0x3f01db(0x10b,0x103,0xfc,0xe7),_0x18d97e,{'once':!![]}),_0x114b18[_0x1db3bc(0x41,_0x58db1e._0x3d375d,_0x58db1e._0x50a971,_0x58db1e._0x4ddfcc)](_0xc607d1),_0x1fde5a();});},'inspectAdmission'(){function _0x29c9ae(_0x1fd9de,_0x393a42,_0x398465,_0x227fc3){return _0x3bf9fb(_0x393a42,_0x393a42-0xb2,_0x398465-_0x472e98._0xe060ff,_0x1fd9de- -0x691);}function _0x3406d0(_0x101bcd,_0x10f5ea,_0x45523a,_0x252f8f){return _0x3bf9fb(_0x45523a,_0x10f5ea-0x129,_0x45523a-0xec,_0x101bcd- -0x3eb);}return[..._0x10c083][_0x3406d0(-0x42,-0x2d,-0x40,-_0x783f99._0x32cc91)](([_0x7ebd8f,_0x48f554])=>({'runId':_0x7ebd8f,'starting':_0x48f554['starting'],'callers':_0x48f554[_0x3406d0(-0x4f,-0x3d,-0x56,-0x5a)]}));},'inspect'(){function _0x5dd124(_0x278aa9,_0x2aa14c,_0x5cc9c4,_0x228e18){return _0x3bf9fb(_0x2aa14c,_0x2aa14c-_0x127dad._0x1470d5,_0x5cc9c4-0x5b,_0x228e18- -0x2ec);}return{'active':_0x5168f4,'readyRunIds':[..._0x1849c5],'waiting':[..._0x211713['values']()]['reduce']((_0x23b5f7,_0x40850a)=>_0x23b5f7+_0x40850a[_0x5dd124(0xcb,0xa5,0xc5,0xb8)],0x0)};}};}function _0x445f(){const _0x501b81=['BgvUz3rO','y2XVC2vK','mJm2ndyYmgDPzwXQwq','mtaXntzJvhrYq2i','CxvLDwvK','BwfW','AxngAw5PDgu','CMvZB2X2zq','mtyYntr3zKfYvfC','C2v0','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHihbVC2L0AxzLihnHzMuGAw50zwDLCG','nti1nNnLBMX5tW','zgvSzxrL','mZi3Ew1mALDd','mtfwq29ptLq','C3bSAwnL','CMvTB3zLrxzLBNrmAxn0zw5LCG','ChvZAa','mtmXnde5mZvkwMn1q0m','CMvTB3zLqwjVCNrmAxn0zw5LCG','C2HPzNq','uMvHzhKGCNvUig11C3qGAgf2zsbHihDHAxrPBMCGB3bLCMf0Aw9U','AxnjBNrLz2vY','ywjVCNrLza','C3rHCNq','yxnZAxn0yw50','CMvHC29U','y2fUy2vSBgvK','ywjVCNq','CMvHzhK','mJqYmtjgvMPmAee','z2v0','mZzqAhfltei','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','CMvNAxn0CMf0Aw9UCW','Aw5KzxHpzG','nZK1qMvtsgHq','mJe3n0HdvKnRAq','C291CMnL','C3rHCNrPBMC','mtmWmduYodHIsKHxvvC','CMvQzwn0'];_0x445f=function(){return _0x501b81;};return _0x445f();}var MESSAGE_ROLES=[_0x2ef804(-0xb5,-0xc6,-0xb0,-0xa9),'user'];function _0x2ef804(_0x24de5a,_0x289a34,_0x5b52e7,_0x24d832){const _0x2eecb4={_0x1fc952:0x153};return _0x5e6f(_0x24de5a- -_0x2eecb4._0x1fc952,_0x5b52e7);}Object['freeze'](MESSAGE_ROLES);export{MESSAGE_ROLES,OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,createOperationScheduler,isAbortError,isAgentOnlyBashCompletion,isAgentOnlyCoordinatorNotice,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
@@ -0,0 +1,17 @@
1
+ import type { OperationProducer, OperationProducerHandle, OperationScheduler } from "./delegation-context.ts";
2
+ /** Diagnostic snapshot for host tests, never part of a tool schema. */
3
+ export interface InspectableOperationScheduler extends OperationScheduler {
4
+ registerProducer(runId: string, producer: OperationProducer): OperationProducerHandle;
5
+ inspect(): {
6
+ active: number;
7
+ readyRunIds: string[];
8
+ waiting: number;
9
+ };
10
+ inspectAdmission(): {
11
+ runId: string;
12
+ starting: boolean;
13
+ callers: number;
14
+ }[];
15
+ }
16
+ export declare function createOperationScheduler(maxConcurrency: number): InspectableOperationScheduler;
17
+ //# sourceMappingURL=operation-scheduler.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { DelegationIdentity, ModelAttemptGate, OperationScheduler } from "./delegation-context.ts";
1
2
  export type JsonPrimitive = boolean | number | string | null;
2
3
  export interface JsonObject {
3
4
  [key: string]: JsonValue;
@@ -259,7 +260,14 @@ export interface PersistedModelCallMetricsV1 {
259
260
  modelTimeMs: number;
260
261
  completesRequest: boolean;
261
262
  }
262
- export type PersistedModelCallMetrics = PersistedModelCallMetricsV1;
263
+ export interface PersistedModelCallMetricsV2 {
264
+ version: 2;
265
+ usage: ChatResponseUsage;
266
+ modelTimeMs: number;
267
+ completesRequest: boolean;
268
+ timeToFirstOutputMs?: number;
269
+ }
270
+ export type PersistedModelCallMetrics = PersistedModelCallMetricsV1 | PersistedModelCallMetricsV2;
263
271
  export interface ChatResponse {
264
272
  id: string;
265
273
  content: AssistantContentBlock[];
@@ -320,6 +328,24 @@ export interface DoneChunk {
320
328
  response: ChatResponse;
321
329
  }
322
330
  export type ChatResponseChunk = AnthropicSignatureDeltaChunk | AnthropicThinkingDeltaChunk | ContentDeltaChunk | DoneChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk | ProviderStreamResetChunk | ProviderRetryChunk | ToolUseDeltaChunk;
331
+ export type LiveModelRequestMetrics = Readonly<{
332
+ requestId: string;
333
+ attempt: number;
334
+ state: "waiting" | "retrying" | "streaming";
335
+ estimatedOutputTokensPerSecond?: number;
336
+ timeToFirstOutputMs?: number;
337
+ }>;
338
+ export type CompletedModelRequestTiming = Readonly<{
339
+ requestId: string;
340
+ modelTimeMs: number;
341
+ timeToFirstOutputMs?: number;
342
+ }>;
343
+ export interface ModelRequestMeasurement {
344
+ observe(chunk: ChatResponseChunk): void;
345
+ snapshot(): LiveModelRequestMetrics | undefined;
346
+ finish(): CompletedModelRequestTiming;
347
+ cancel(): void;
348
+ }
323
349
  export interface ModelLimits {
324
350
  contextWindow?: number;
325
351
  maxContextWindow?: number;
@@ -430,8 +456,11 @@ export interface ChatModel {
430
456
  }
431
457
  export interface ModelExecutionOptions {
432
458
  signal?: AbortSignal;
459
+ delegationIdentity?: DelegationIdentity;
460
+ operationScheduler?: OperationScheduler;
461
+ modelAttemptGate?: ModelAttemptGate;
433
462
  }
434
- export interface TurnMessageMeta {
463
+ export type TurnMessageMeta = {
435
464
  provider?: string;
436
465
  model?: string;
437
466
  modelIdentity?: string;
@@ -446,6 +475,8 @@ export interface TurnMessageMeta {
446
475
  reasoningCompletedAt?: number;
447
476
  /** Marks a canonical user-role append submitted by a trusted runtime source. */
448
477
  submissionOrigin?: "coordinator" | "agent";
478
+ /** ms epoch when this user message was queued as a mid-turn steer. */
479
+ steeredAt?: number;
449
480
  /** Canonical sender ID for an agent-origin user-role append. */
450
481
  senderAgentId?: string;
451
482
  /** Trusted structured metadata for a coordinator-authored subagent report. */
@@ -459,7 +490,18 @@ export interface TurnMessageMeta {
459
490
  presentation?: "command-echo" | "command-notice";
460
491
  /** Notice row kind for presentation === "command-notice". */
461
492
  noticeRole?: "info" | "warning" | "error";
462
- }
493
+ } & ({
494
+ deliveryKind?: never;
495
+ transcriptVisibility?: never;
496
+ } | {
497
+ submissionOrigin: "coordinator";
498
+ deliveryKind: "bash-completion" | "background-work-stopped";
499
+ transcriptVisibility: "agent-only";
500
+ senderAgentId?: never;
501
+ subagentReport?: never;
502
+ presentation?: never;
503
+ noticeRole?: never;
504
+ });
463
505
  export interface EngineChatModel {
464
506
  model: string;
465
507
  modelIdentity: string;
@@ -484,6 +526,8 @@ export type ToolExecutionScope = Readonly<{
484
526
  toolCallPath: readonly string[];
485
527
  }>;
486
528
  export interface NestedToolExecutionRequest {
529
+ /** Host producer acknowledgment, never part of model input or publication. */
530
+ onExecutionEntered?: () => void;
487
531
  requestedName: string;
488
532
  tool?: AnyToolDefinition;
489
533
  toolCall: ToolUseBlock;
@@ -505,6 +549,8 @@ export interface AgentEventContext {
505
549
  turnId: string;
506
550
  state: TurnState;
507
551
  executionScope: ToolExecutionScope;
552
+ /** Internal execution cancellation, when this event originates from a tool. */
553
+ signal?: AbortSignal;
508
554
  }
509
555
  export type AskUserOption = {
510
556
  label: string;
@@ -525,6 +571,9 @@ export type AskUserQuestionRequest = {
525
571
  export type ToolPermissionClass = "read" | "write" | "always-confirm";
526
572
  export interface ToolExecutionContext extends AgentEventContext {
527
573
  signal: AbortSignal;
574
+ delegationIdentity?: DelegationIdentity;
575
+ operationScheduler?: OperationScheduler;
576
+ modelAttemptGate?: ModelAttemptGate;
528
577
  toolCallId?: string;
529
578
  permissionClass?: ToolPermissionClass;
530
579
  executionAuthorization?: unknown;
@@ -571,6 +620,8 @@ export interface AgentModelRequestEvent {
571
620
  }
572
621
  export interface AgentModelResponseEvent {
573
622
  type: "model_response";
623
+ requestId?: string;
624
+ timeToFirstOutputMs?: number;
574
625
  /** Exact provider/model-call duration measured by the turn engine. */
575
626
  modelTimeMs?: number;
576
627
  response: ChatResponse;
@@ -634,7 +685,19 @@ export interface AgentProviderStreamResetEvent {
634
685
  assistantMessageId: string;
635
686
  reasoningMessageId: string;
636
687
  }
637
- export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentProviderStreamResetEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
688
+ export type DelegatedModelIdentity = Readonly<{
689
+ runId: string;
690
+ /** 1-based delegated lifecycle order, not Agent.turnIndex or event time. */
691
+ turnNumber: number;
692
+ /** Absent only for the existing implicit synchronous/legacy first turn. */
693
+ turnId?: string;
694
+ modelIdentity: string;
695
+ }>;
696
+ export type AgentDelegatedModelResolvedEvent = DelegatedModelIdentity & Readonly<{
697
+ type: "delegated_model_resolved";
698
+ parentToolCallId: string;
699
+ }>;
700
+ export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentDelegatedModelResolvedEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentProviderStreamResetEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
638
701
  export type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
639
702
  export type ToolRuntimeDispatchDecision = {
640
703
  action: "reject";
@@ -691,6 +754,8 @@ export interface ToolDefinition<TInput extends object = JsonObject, TYield exten
691
754
  inputSchema: TSchema;
692
755
  permissionClass?: ToolPermissionClass;
693
756
  internalLifecycle?: ToolDefinitionLifecycle;
757
+ /** Trusted host-only classification; never read from tool-call input. */
758
+ internalExecution?: "orchestration";
694
759
  execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
695
760
  }
696
761
  export type AnyToolDefinition = ToolDefinition<object, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
@@ -747,6 +812,7 @@ export interface ExtensionRegistry {
747
812
  runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
748
813
  }
749
814
  export interface RunTurnDeps {
815
+ startModelRequestMeasurement?: (requestId: string) => ModelRequestMeasurement;
750
816
  registry: ExtensionRegistry;
751
817
  chatModel: EngineChatModel;
752
818
  toolRuntime: ToolRuntime;
@@ -756,28 +822,52 @@ export interface RunTurnDeps {
756
822
  outputFormat?: OutputFormat;
757
823
  executionScope?: ToolExecutionScope;
758
824
  beginProgramTrace?: BeginProgramTrace;
825
+ delegationIdentity?: DelegationIdentity;
826
+ operationScheduler?: OperationScheduler;
827
+ modelAttemptGate?: ModelAttemptGate;
759
828
  }
760
829
  export type AgentInput = MessageInput | string;
761
830
  /** Immutable ownership metadata for the exact agent submission being sent. */
762
831
  export type AgentSubmission = Readonly<{
763
832
  origin: "user";
833
+ deliveryKind?: never;
834
+ transcriptVisibility?: never;
764
835
  }> | Readonly<{
765
836
  origin: "coordinator";
766
837
  token: string;
767
838
  /** Trusted delegated report delivery whose provider text must remain verbatim. */
768
839
  deliveryKind?: "subagent-report";
840
+ transcriptVisibility?: never;
769
841
  subagentReport?: SubagentReportMeta;
842
+ }> | Readonly<{
843
+ origin: "coordinator";
844
+ token: string;
845
+ deliveryKind: "bash-completion";
846
+ transcriptVisibility: "agent-only";
847
+ subagentReport?: never;
848
+ }> | Readonly<{
849
+ origin: "coordinator";
850
+ token: string;
851
+ deliveryKind: "background-work-stopped";
852
+ transcriptVisibility: "agent-only";
853
+ subagentReport?: never;
770
854
  }> | Readonly<{
771
855
  origin: "agent";
772
856
  senderAgentId: string;
857
+ deliveryKind?: never;
858
+ transcriptVisibility?: never;
773
859
  }>;
774
860
  export type TurnSteeringInput = MessageInput | Readonly<{
775
861
  input: MessageInput;
776
862
  submission: AgentSubmission;
863
+ /** ms epoch when the steer was queued; carried into persisted meta. */
864
+ steeredAt?: number;
777
865
  }>;
778
866
  export type SteeringInput = AgentInput | Readonly<{
779
867
  input: AgentInput;
780
868
  submission: AgentSubmission;
869
+ /** ms epoch when the steer was queued; carried into persisted meta. */
870
+ steeredAt?: number;
781
871
  }>;
782
872
  export type SteeringInputDrain = () => Promise<SteeringInput[]>;
783
873
  export interface AgentSendOptions {
@@ -805,6 +895,9 @@ export interface AgentOptions {
805
895
  outputFormat?: OutputFormat;
806
896
  executionScope?: ToolExecutionScope;
807
897
  beginProgramTrace?: BeginProgramTrace;
898
+ delegationIdentity?: DelegationIdentity;
899
+ operationScheduler?: OperationScheduler;
900
+ modelAttemptGate?: ModelAttemptGate;
808
901
  }
809
902
  export interface AgentDefinitionFactoryContext {
810
903
  agentId: string;
@@ -1,10 +1,14 @@
1
1
  import type { AgentEvent, AnyToolDefinition, BeginProgramTrace, ExtensionRegistry, ToolExecutionContext, ToolRuntime, ToolRuntimeToolCallHandler } from "../../shared/types.ts";
2
2
  type InternalToolRuntimeEventHandler = (event: AgentEvent, ctx: ToolExecutionContext) => Promise<void> | void;
3
3
  interface InternalToolRuntimeOptions {
4
+ onExecutionEntered?: () => void;
4
5
  onEvent?: InternalToolRuntimeEventHandler;
5
6
  onToolCall?: ToolRuntimeToolCallHandler;
6
7
  registry?: ExtensionRegistry;
7
8
  beginProgramTrace?: BeginProgramTrace;
9
+ delegationIdentity?: ToolExecutionContext["delegationIdentity"];
10
+ operationScheduler?: ToolExecutionContext["operationScheduler"];
11
+ modelAttemptGate?: ToolExecutionContext["modelAttemptGate"];
8
12
  }
9
13
  export declare function closeBoundNestedToolExecution(executeNestedTool: ToolExecutionContext["executeNestedTool"], reason?: unknown): void;
10
14
  export declare function drainBoundNestedToolPersistence(executeNestedTool: ToolExecutionContext["executeNestedTool"]): Promise<void>;
@@ -1,18 +1,26 @@
1
1
  import { Agent } from "../../agent/agent.ts";
2
2
  import type { AbortAwareSemaphore } from "../../shared/abort-aware-semaphore.ts";
3
- import type { AgentDefinitionFactoryContext, AgentOptions } from "../../shared/types.ts";
3
+ import type { DelegationIdentity } from "../../shared/delegation-context.ts";
4
+ import type { AgentDefinitionFactoryContext, AgentOptions, DelegatedModelIdentity, ModelExecutionOptions, ModelUsageTotals } from "../../shared/types.ts";
4
5
  export declare const MODEL_TIERS: readonly ["fast", "balanced", "powerful"];
5
6
  export type ModelTier = (typeof MODEL_TIERS)[number];
6
7
  export type BackgroundAssignmentState = "started" | "queued";
7
8
  export type BackgroundMessageState = BackgroundAssignmentState | "queued-as-steering";
8
- export type BackgroundDelegationFailureCode = "subagent-not-found" | "subagent-corrupt" | "subagent-unavailable" | "subagent-busy" | "subagent-closing";
9
+ export type BackgroundDelegationFailureCode = "subagent-not-found" | "subagent-corrupt" | "subagent-unavailable" | "subagent-busy" | "subagent-closing" | "delegation_depth_limit" | "delegation_outstanding_limit" | "delegation_run_limit";
9
10
  export type BackgroundAssignmentRequest = Readonly<{
11
+ delegationIdentity?: DelegationIdentity;
12
+ /** Ancestor tool-call path of the AssignTask trigger inside the caller's scope. */
13
+ originPath?: readonly string[];
10
14
  agentId: string;
11
15
  task: string;
12
16
  senderAgentId: string;
13
17
  parentSessionId: string;
14
18
  parentToolCallId: string;
15
19
  requestedModelTier?: ModelTier;
20
+ /** Short user-facing summary of the delegated work (AssignTask `description`). */
21
+ description?: string;
22
+ /** Optional short display name for the run (AssignTask `nickname`). */
23
+ nickname?: string;
16
24
  }>;
17
25
  export type BackgroundMessageRequest = Readonly<{
18
26
  runId: string;
@@ -20,10 +28,16 @@ export type BackgroundMessageRequest = Readonly<{
20
28
  senderAgentId: string;
21
29
  parentSessionId: string;
22
30
  triggerToolCallId: string;
31
+ /** Runtime-authored full tool call path, including any Program wrapper. */
32
+ originPath?: readonly string[];
33
+ /** Trusted caller identity issuing the SendMessage; must own the target. */
34
+ caller?: DelegationIdentity;
23
35
  }>;
24
36
  export type BackgroundStopRequest = Readonly<{
25
37
  runId: string;
26
38
  parentSessionId: string;
39
+ /** Trusted caller identity requesting the stop. */
40
+ caller?: DelegationIdentity;
27
41
  }>;
28
42
  export type BackgroundDelegationRejection = Readonly<{
29
43
  kind: "rejected";
@@ -49,12 +63,37 @@ export type BackgroundStopResult = Readonly<{
49
63
  agentId: string;
50
64
  state: "idle" | "stopping";
51
65
  }> | BackgroundDelegationRejection;
66
+ export type DelegatedRunState = "idle" | "queued" | "running" | "closing";
67
+ /** Snapshot of one live delegated conversation, as reported by ListAgents. */
68
+ export type DelegatedRunSummary = Readonly<{
69
+ runId: string;
70
+ agentId: string;
71
+ state: DelegatedRunState;
72
+ /** Set when state is "idle": the conversation is quiesced, awaiting SendMessage. */
73
+ waitingFor?: "steering";
74
+ task?: string;
75
+ description?: string;
76
+ nickname?: string;
77
+ requestedModelTier?: ModelTier;
78
+ childSessionId: string;
79
+ usage: ModelUsageTotals;
80
+ }>;
81
+ export type BackgroundListRequest = Readonly<{
82
+ parentSessionId: string;
83
+ runId?: string;
84
+ /** Trusted caller identity; restricts the listing to owned descendants. */
85
+ caller?: DelegationIdentity;
86
+ }>;
87
+ export type BackgroundListResult = Readonly<{
88
+ runs: readonly DelegatedRunSummary[];
89
+ }>;
52
90
  export interface BackgroundDelegationCapability {
53
91
  assign(request: BackgroundAssignmentRequest): Promise<BackgroundAssignmentResult>;
54
92
  sendMessage(request: BackgroundMessageRequest): Promise<BackgroundMessageResult>;
55
93
  stopAgent(request: BackgroundStopRequest): Promise<BackgroundStopResult>;
94
+ list(request: BackgroundListRequest): Promise<BackgroundListResult>;
56
95
  }
57
- export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
96
+ export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext, ModelExecutionOptions {
58
97
  parentSessionId: string;
59
98
  runId: string;
60
99
  signal: AbortSignal;
@@ -70,6 +109,8 @@ export type DelegatedRoutingMetadata = {
70
109
  export type DelegatedAgentResolution = {
71
110
  options: AgentOptions;
72
111
  routing?: DelegatedRoutingMetadata;
112
+ constructionNotices?: readonly string[];
113
+ isConstructionNoticeCurrent?: () => boolean;
73
114
  };
74
115
  export declare class DelegatedResolutionError extends Error {
75
116
  readonly requestedModelTier: ModelTier;
@@ -88,13 +129,18 @@ export type DelegatedRunOutcome = Readonly<{
88
129
  }>;
89
130
  export interface DelegatedRunLifecycleHooks {
90
131
  start(agent: Agent, context: DelegatedAgentFactoryContext): Promise<void>;
132
+ modelResolved?(context: DelegatedAgentFactoryContext, model: DelegatedModelIdentity): Promise<void>;
91
133
  finish(context: DelegatedAgentFactoryContext, outcome: DelegatedRunOutcome): Promise<void>;
92
134
  }
93
135
  export type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => DelegatedAgentFactoryResult | Promise<DelegatedAgentFactoryResult>);
136
+ export type DelegationAssignmentMode = "synchronous" | "background";
94
137
  export interface CreateDelegationToolsOptions {
95
138
  agents?: Record<string, DelegatedAgentDefinition>;
96
139
  lifecycle?: DelegatedRunLifecycleHooks;
140
+ /** @deprecated Runtime scheduling uses operationScheduler, never a whole-run permit. */
97
141
  semaphore?: AbortAwareSemaphore;
142
+ /** Persists reservation/start before resolving or constructing executable child work. */
143
+ admitRun?(context: DelegatedAgentFactoryContext, parent: DelegationIdentity | undefined): Promise<DelegationIdentity>;
98
144
  /** Register an active child for shared tool refresh; returns its cleanup callback. */
99
145
  registerActiveAgent?: (agent: Agent, context: DelegatedAgentFactoryContext) => () => void;
100
146
  registerActiveRun?: (entry: {
@@ -112,11 +158,27 @@ export interface CreateDelegationToolsOptions {
112
158
  * delegation factory's own failure-release may safely converge here.
113
159
  */
114
160
  releaseAgentResources?: (context: DelegatedAgentFactoryContext) => void;
161
+ /**
162
+ * Selects AssignTask execution independently of management-tool availability.
163
+ * Catalog assembly always sets this. Omitted, background capability selects
164
+ * background mode and its absence selects the synchronous executor used by
165
+ * existing unit tests.
166
+ */
167
+ assignmentMode?: DelegationAssignmentMode;
168
+ /** Caller-bound lifecycle service for SendMessage, StopAgent, and ListAgents. */
115
169
  background?: BackgroundDelegationCapability;
116
170
  }
117
171
  export declare function isValidDelegatedRunId(value: unknown): value is string;
118
172
  export declare function createDelegatedRunId(): string;
119
173
  export declare function resolveDelegatedAgentOptions(definition: DelegatedAgentDefinition, ctx: DelegatedAgentFactoryContext): Promise<DelegatedAgentResolution>;
174
+ /**
175
+ * Canonical accepted-assignment output. This exact text is persisted in
176
+ * transcripts and re-validated verbatim by the runtime's transcript projection
177
+ * (transcript-message-projection.ts), so the grammar lives here, not in the
178
+ * consumer.
179
+ */
180
+ export declare function formatBackgroundAssignmentOutput(runId: string, state: BackgroundAssignmentState): string;
181
+ export declare function resolveDelegationAssignmentMode(options: CreateDelegationToolsOptions): DelegationAssignmentMode;
120
182
  export declare function createAssignTaskTool(options: CreateDelegationToolsOptions): import("../../shared/types.ts").ToolDefinition<{
121
183
  description: string;
122
184
  agentId: string;
@@ -186,6 +248,18 @@ export declare function createStopAgentTool(background: BackgroundDelegationCapa
186
248
  required: string[];
187
249
  additionalProperties: false;
188
250
  }>;
251
+ export declare function createListAgentsTool(background: BackgroundDelegationCapability): import("../../shared/types.ts").ToolDefinition<{
252
+ runId?: string | undefined;
253
+ }, never, import("../../shared/types.ts").ToolOutputEnvelope, {
254
+ type: "object";
255
+ properties: {
256
+ runId: {
257
+ type: "string";
258
+ };
259
+ };
260
+ required: never[];
261
+ additionalProperties: false;
262
+ }>;
189
263
  export declare const createDelegateToAgentTool: typeof createAssignTaskTool;
190
264
  export declare function createDelegationTools(options: CreateDelegationToolsOptions): (import("../../shared/types.ts").ToolDefinition<{
191
265
  description: string;
@@ -231,6 +305,17 @@ export declare function createDelegationTools(options: CreateDelegationToolsOpti
231
305
  };
232
306
  required: string[];
233
307
  additionalProperties: false;
308
+ }> | import("../../shared/types.ts").ToolDefinition<{
309
+ runId?: string | undefined;
310
+ }, never, import("../../shared/types.ts").ToolOutputEnvelope, {
311
+ type: "object";
312
+ properties: {
313
+ runId: {
314
+ type: "string";
315
+ };
316
+ };
317
+ required: never[];
318
+ additionalProperties: false;
234
319
  }>)[];
235
320
  export {};
236
321
  //# sourceMappingURL=runtime-manager-tools.d.ts.map
@@ -11,6 +11,8 @@ export declare function defineTool<TSchema extends JsonSchemaObject, TYield exte
11
11
  inputSchema: TSchema;
12
12
  permissionClass: ToolPermissionClass;
13
13
  internalLifecycle?: ToolDefinitionLifecycle;
14
+ /** Trusted host-only classification; never read from tool-call input. */
15
+ internalExecution?: "orchestration";
14
16
  execute(input: InferJsonSchema<TSchema>, ctx: ToolExecutionContext): AsyncGenerator<TYield, TReturn, void>;
15
17
  }): ToolDefinition<InferJsonSchema<TSchema>, TYield, TReturn, TSchema>;
16
18
  export declare function resolveToolPermissionClass(tool: AnyToolDefinition | undefined): ToolPermissionClass;
@@ -0,0 +1,13 @@
1
+ import type { FileHandle } from "node:fs/promises";
2
+ import type { ToolOutputEnvelope } from "../../shared/types.ts";
3
+ /** Reads only the fstat byte snapshot of an already authorized descriptor.
4
+ * Memory is one 64 KiB read/decoder chunk plus a response-budget-sized prefix.
5
+ * A clipped line cannot be resumed with line pagination; only later lines can.
6
+ */
7
+ export declare function readBashArtifactText(input: Readonly<{
8
+ file: FileHandle;
9
+ lineStart?: number;
10
+ lineEnd?: number;
11
+ maxBytes: number;
12
+ }>): Promise<ToolOutputEnvelope>;
13
+ //# sourceMappingURL=bash-artifact-read.d.ts.map
@@ -8,6 +8,7 @@ export interface FileReadToolOptions {
8
8
  mode?: FileEditMode;
9
9
  observations?: FileObservationStore;
10
10
  outputBudgetBytes?: number;
11
+ bashArtifactSessionsRoot?: string;
11
12
  }
12
13
  export declare function createFileReadTool(options?: FileReadToolOptions): import("../../shared/types.ts").ToolDefinition<{
13
14
  path: string;