@nuvin/agent-core 0.3.1-rc.1 → 0.4.0-rc.10

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 +2 -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-NJFOEZ6V.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.156.1+b412ff32c417f855c2b2d1581b77058eed87c84b";
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 _0xa12d(){const _0x54fca8=['CMvTB3zLqwjVCNrmAxn0zw5LCG','ndm2mdu2wMzMt1n4','mtf3qLzdCxy','mZa4zermtvPl','ndbOrMfmEei','AxnjBNrLz2vY','zNjLzxPL','nZu1nfnXyLfzDa','mZuZmdG5mfD4BM9XsG','odiZntG1A3ziANjW','CMvQzwn0','Aw5KzxHpzG','DxnLCG','yxnZAxn0yw50','CMvZB2X2zq','ChvZAa','nZi5oty5nLfgv1b3sG','mtC5mtHks2XTuxC','CMvHC29U','y2fUy2vSBgvK','C3bSAwnL','mtHot05Hz3q','mtqYodqYCuL5BvHQ','mtbvz05kBe4','BgvUz3rO','AxngAw5PDgu'];_0xa12d=function(){return _0x54fca8;};return _0xa12d();}function _0x4e78(_0x5a20d2,_0x1715ee){_0x5a20d2=_0x5a20d2-0xf2;const _0xa12d51=_0xa12d();let _0x4e784f=_0xa12d51[_0x5a20d2];if(_0x4e78['xCRZap']===undefined){var _0x598005=function(_0xeecf60){const _0x33a269='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x47bd5c='',_0x5e854c='';for(let _0xd80262=0x0,_0x435b21,_0x5a2b6c,_0x4e3b13=0x0;_0x5a2b6c=_0xeecf60['charAt'](_0x4e3b13++);~_0x5a2b6c&&(_0x435b21=_0xd80262%0x4?_0x435b21*0x40+_0x5a2b6c:_0x5a2b6c,_0xd80262++%0x4)?_0x47bd5c+=String['fromCharCode'](0xff&_0x435b21>>(-0x2*_0xd80262&0x6)):0x0){_0x5a2b6c=_0x33a269['indexOf'](_0x5a2b6c);}for(let _0x41cb21=0x0,_0x2fbd1f=_0x47bd5c['length'];_0x41cb21<_0x2fbd1f;_0x41cb21++){_0x5e854c+='%'+('00'+_0x47bd5c['charCodeAt'](_0x41cb21)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5e854c);};_0x4e78['MzZhBT']=_0x598005,_0x4e78['xOyAfl']={},_0x4e78['xCRZap']=!![];}const _0x133e0e=_0xa12d51[0x0],_0x20a0a5=_0x5a20d2+_0x133e0e,_0x4eabef=_0x4e78['xOyAfl'][_0x20a0a5];return!_0x4eabef?(_0x4e784f=_0x4e78['MzZhBT'](_0x4e784f),_0x4e78['xOyAfl'][_0x20a0a5]=_0x4e784f):_0x4e784f=_0x4eabef,_0x4e784f;}(function(_0x294d11,_0x2ef005){const _0x1667c7={_0x54e868:0x87,_0x343269:0x86,_0x5bd13b:0x483,_0x5e657f:0x488,_0x2886eb:0x84,_0x30d989:0x79,_0x543a64:0x7c,_0x15638c:0x8a,_0x2c64d7:0x88,_0x2b2bfe:0x75,_0x459be1:0x7b,_0xf8cec4:0x491,_0x20737d:0x48c,_0x3ed4d0:0x484,_0x407f33:0x484,_0x5c0cc9:0x478,_0x195248:0x47f,_0x16e7dc:0x8f},_0x5ce733={_0x543381:0x388};function _0x42275a(_0x55c1d0,_0x1d818f,_0x42d00e,_0x3baf8c){return _0x4e78(_0x55c1d0-_0x5ce733._0x543381,_0x3baf8c);}function _0xf03c4e(_0x3e0110,_0x967b53,_0x3cb235,_0x57f01a){return _0x4e78(_0x57f01a- -0x7e,_0x967b53);}const _0x594c1a=_0x294d11();while(!![]){try{const _0x3e9c1a=parseInt(_0xf03c4e(0x8e,0x81,0x7d,_0x1667c7._0x54e868))/0x1*(parseInt(_0xf03c4e(_0x1667c7._0x343269,0x94,0x97,0x8d))/0x2)+-parseInt(_0x42275a(_0x1667c7._0x5bd13b,0x490,0x477,_0x1667c7._0x5e657f))/0x3*(-parseInt(_0xf03c4e(_0x1667c7._0x2886eb,0x79,0x86,_0x1667c7._0x30d989))/0x4)+-parseInt(_0xf03c4e(_0x1667c7._0x543a64,0x6d,0x70,0x7a))/0x5*(-parseInt(_0xf03c4e(_0x1667c7._0x15638c,_0x1667c7._0x2c64d7,0x90,0x8c))/0x6)+-parseInt(_0xf03c4e(0x82,0x8b,0x78,0x7f))/0x7+-parseInt(_0xf03c4e(_0x1667c7._0x2b2bfe,_0x1667c7._0x459be1,_0x1667c7._0x2b2bfe,0x77))/0x8*(parseInt(_0x42275a(_0x1667c7._0xf8cec4,0x49d,_0x1667c7._0x20737d,_0x1667c7._0x5e657f))/0x9)+-parseInt(_0x42275a(_0x1667c7._0x3ed4d0,0x486,_0x1667c7._0x407f33,_0x1667c7._0x5c0cc9))/0xa*(parseInt(_0x42275a(0x47e,0x47b,_0x1667c7._0x195248,_0x1667c7._0x407f33))/0xb)+parseInt(_0xf03c4e(_0x1667c7._0x16e7dc,0x85,0x7f,0x86))/0xc;if(_0x3e9c1a===_0x2ef005)break;else _0x594c1a['push'](_0x594c1a['shift']());}catch(_0x5df5e0){_0x594c1a['push'](_0x594c1a['shift']());}}}(_0xa12d,0x7aad2));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';function _0xbf1129(_0x3419ca,_0x309262,_0x4d3fb3,_0xb2043f){return _0x4e78(_0x309262-0x8a,_0x4d3fb3);}import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x3f6966(_0x126bfb,_0x525326,_0x5883e1,_0x34fae9){return _0x4e78(_0x126bfb- -0x188,_0x34fae9);}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x47bd5c){const _0x27625a={_0x1f5a48:0x80,_0x2b0140:0x79,_0xe8a8b2:0x76,_0x45647d:0x49},_0x1a83a3={_0x1d80e8:0xcf,_0x7fce0c:0x464,_0x54a214:0x46d,_0x247785:0x46b},_0x4af9d3={_0x3690dd:0x14a,_0x1fe2fc:0x14d,_0x5e3cce:0x97,_0x3db07b:0x97},_0x56ea1e={_0x1eb0ae:0x144,_0x482fd8:0x21},_0x5a082d={_0x1485ab:0x44},_0x4fd506={_0x56bf61:0xbf,_0x3177e5:0xb2,_0xe507c3:0xc9,_0x2e623f:0xde,_0x3e9c4b:0xe5,_0x4b4b88:0xe0,_0x228807:0xe6,_0x536959:0xf2},_0x5b838e={_0x349b9:0x10d,_0x1591bb:0x15c};function _0xadd2ea(_0x4f7eed,_0x2cc0a9,_0x138366,_0x3360a3){return _0x4e78(_0x4f7eed- -0x140,_0x2cc0a9);}if(!Number[_0x1d48d5(-_0x27625a._0x1f5a48,-_0x27625a._0x2b0140,-_0x27625a._0xe8a8b2,-0x89)](_0x47bd5c)||!Number[_0xadd2ea(-0x47,-0x3b,-_0x27625a._0x45647d,-0x40)](_0x47bd5c)||_0x47bd5c<=0x0)throw new Error('maxConcurrency\x20must\x20be\x20a\x20finite\x20positive\x20integer');let _0x5e854c=0x0;const _0xd80262=[],_0x435b21=()=>{let _0x41cb21=![];return()=>{if(_0x41cb21)return;_0x41cb21=!![],_0x5e854c-=0x1,_0x5a2b6c();};},_0x5a2b6c=()=>{const _0x17712b={_0x1bf50a:0x1a};function _0x44bc96(_0x35a7fb,_0x3a183a,_0x25a700,_0x3ca05b){return _0xadd2ea(_0x3a183a-_0x5b838e._0x349b9,_0x25a700,_0x25a700-_0x5b838e._0x1591bb,_0x3ca05b-0x52);}function _0x2f728a(_0x43c5eb,_0x2b4e1f,_0x324e5e,_0x4c7e18){return _0x1d48d5(_0x4c7e18- -0x7a,_0x43c5eb,_0x324e5e-_0x17712b._0x1bf50a,_0x4c7e18-0x5b);}while(_0xd80262[_0x44bc96(0xb7,_0x4fd506._0x56bf61,_0x4fd506._0x3177e5,_0x4fd506._0xe507c3)]>0x0){const _0x2fbd1f=_0xd80262['shift']();if(!_0x2fbd1f||_0x2fbd1f['cancelled'])continue;_0x2fbd1f[_0x2f728a(-_0x4fd506._0x2e623f,-_0x4fd506._0x3e9c4b,-_0x4fd506._0x4b4b88,-_0x4fd506._0x228807)]=!![],_0x2fbd1f['removeAbortListener'](),_0x5e854c+=0x1,_0x2fbd1f[_0x2f728a(-_0x4fd506._0x228807,-_0x4fd506._0x536959,-0xde,-0xeb)](_0x435b21());return;}},_0x4e3b13=()=>{if(_0x5e854c>=_0x47bd5c)return void 0x0;return _0x5e854c+=0x1,_0x435b21();};function _0x1d48d5(_0x4bd75c,_0x3c3f96,_0x48cd1d,_0x14dd08){return _0x4e78(_0x4bd75c- -0x173,_0x3c3f96);}return{'tryAcquire':_0x4e3b13,'acquire'(_0x5f0201){const _0x4d691f={_0x33650a:0x114,_0x7355e9:0x114,_0x547150:0x11f,_0x59a10a:0x114,_0x8eb392:0x238,_0x41d07d:0x23d,_0xa4fcff:0x249,_0x197be0:0x254,_0x58cd85:0x10b,_0x5c32c4:0x10f};function _0x57e623(_0x2d461d,_0x5cf904,_0x23533b,_0x211645){return _0x1d48d5(_0x211645-0x4dc,_0x23533b,_0x23533b-_0x5a082d._0x1485ab,_0x211645-0x68);}if(_0x5f0201?.['aborted'])return Promise[_0x53455e(0xc3,0xd3,_0x1a83a3._0x1d80e8,0xc4)](toAbortError(_0x5f0201[_0x53455e(0xe0,0xdc,0xd7,0xcb)]));const _0x41a01d=_0x4e3b13();if(_0x41a01d!==void 0x0)return Promise[_0x57e623(0x478,_0x1a83a3._0x7fce0c,_0x1a83a3._0x54a214,_0x1a83a3._0x247785)](_0x41a01d);function _0x53455e(_0x40d5c1,_0x57d5c8,_0x4309ab,_0x2a157e){return _0x1d48d5(_0x4309ab-_0x56ea1e._0x1eb0ae,_0x40d5c1,_0x4309ab-0x2,_0x2a157e-_0x56ea1e._0x482fd8);}return new Promise((_0x4c50a8,_0x3b9af3)=>{const _0x1846af={_0x7a6022:0xac,_0xf1ef57:0xf7},_0x252cf1={_0xe9151:0x35},_0x5d07e1={_0x3d09a1:0x21,_0x391d08:0x1b},_0x3d87fc={_0x21c33d:0x1c1},_0x3c2929={'resolve':_0x4c50a8,'reject':_0x3b9af3,'cancelled':![],'removeAbortListener':()=>{}};_0xd80262[_0x2daf52(-_0x4af9d3._0x3690dd,-_0x4af9d3._0x1fe2fc,-0x14d,-0x144)](_0x3c2929);function _0x40efae(_0x1d4070,_0x3a60d8,_0x25493f,_0x51a330){return _0x53455e(_0x3a60d8,_0x3a60d8-_0x3d87fc._0x21c33d,_0x25493f- -0x166,_0x51a330-0xa);}function _0x2daf52(_0x3fdd68,_0xb617b5,_0x33115a,_0x4d805e){return _0x53455e(_0x3fdd68,_0xb617b5-_0x5d07e1._0x3d09a1,_0x33115a- -0x221,_0x4d805e-_0x5d07e1._0x391d08);}_0x3c2929[_0x40efae(-_0x4af9d3._0x5e3cce,-_0x4af9d3._0x3db07b,-0xa1,-0xa1)]=addAbortListener(_0x5f0201,()=>{if(_0x3c2929[_0x413687(-0x23f,-0x240,-0x238,-0x238)])return;_0x3c2929[_0x53de73(-0x10b,-_0x4d691f._0x33650a,-_0x4d691f._0x7355e9,-0x110)]=!![];function _0x53de73(_0x31b28f,_0x50cffe,_0x12f483,_0x570bb5){return _0x2daf52(_0x570bb5,_0x50cffe-0x2e,_0x50cffe-_0x252cf1._0xe9151,_0x570bb5-0x1a2);}_0x3c2929['removeAbortListener']();const _0x33286d=_0xd80262[_0x53de73(-0x11b,-0x11c,-_0x4d691f._0x547150,-_0x4d691f._0x59a10a)](_0x3c2929);function _0x413687(_0x5ee2bf,_0x1937b5,_0xbaae2e,_0x130e42){return _0x2daf52(_0xbaae2e,_0x1937b5-_0x1846af._0x7a6022,_0x1937b5- -_0x1846af._0xf1ef57,_0x130e42-0x18a);}if(_0x33286d>=0x0)_0xd80262[_0x413687(-_0x4d691f._0x8eb392,-0x23f,-0x23a,-0x234)](_0x33286d,0x1);_0x3c2929[_0x413687(-_0x4d691f._0x41d07d,-_0x4d691f._0xa4fcff,-_0x4d691f._0x197be0,-0x24a)](toAbortError(_0x5f0201?.[_0x53de73(-0x112,-0x115,-_0x4d691f._0x58cd85,-_0x4d691f._0x5c32c4)]));});});}};}var MESSAGE_ROLES=[_0x3f6966(-0x87,-0x7a,-0x87,-0x7f),_0xbf1129(0x197,0x18a,0x185,0x185)];Object[_0x3f6966(-0x8e,-0x97,-0x90,-0x91)](MESSAGE_ROLES);export{MESSAGE_ROLES,OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
1
+ (function(_0x197514,_0x5617e2){const _0x9be990={_0x4b5143:0x235,_0x3844d6:0x225,_0x479669:0x23e,_0x1b187b:0x246,_0x1e58e0:0x55,_0x429226:0x59,_0x367c62:0x48,_0x739d10:0x3f,_0x858ef3:0x66,_0x3afa3c:0x4a,_0x49aecd:0x67,_0x4af617:0x53,_0x43d5f5:0x58,_0x1364c1:0x42,_0x2a3569:0x254,_0x53eded:0x247,_0x32b32f:0x23e,_0x281dc9:0x50,_0x5c2f5d:0x46,_0x5d91f2:0x5c,_0x28c366:0x3d,_0x3d291a:0x22e,_0x2b2744:0x227,_0x26d285:0x220,_0x2a87bb:0x255};function _0x297086(_0x2f38c9,_0x48e788,_0x37f480,_0x11be0f){return _0x2178(_0x2f38c9-0x170,_0x11be0f);}function _0x4d6cc7(_0x91cf20,_0x472c19,_0x16afd0,_0x2a6981){return _0x2178(_0x91cf20- -0x80,_0x2a6981);}const _0x158290=_0x197514();while(!![]){try{const _0x552bb1=-parseInt(_0x297086(_0x9be990._0x4b5143,0x232,_0x9be990._0x3844d6,_0x9be990._0x479669))/0x1+parseInt(_0x297086(0x236,_0x9be990._0x1b187b,0x240,0x23a))/0x2+parseInt(_0x4d6cc7(0x57,_0x9be990._0x1e58e0,0x4e,_0x9be990._0x429226))/0x3*(parseInt(_0x4d6cc7(_0x9be990._0x367c62,0x59,0x56,_0x9be990._0x739d10))/0x4)+parseInt(_0x4d6cc7(0x54,_0x9be990._0x858ef3,_0x9be990._0x3afa3c,_0x9be990._0x49aecd))/0x5*(parseInt(_0x4d6cc7(_0x9be990._0x4af617,_0x9be990._0x43d5f5,0x4f,_0x9be990._0x1364c1))/0x6)+parseInt(_0x297086(0x24a,0x237,0x252,0x248))/0x7*(parseInt(_0x297086(0x246,_0x9be990._0x2a3569,_0x9be990._0x53eded,_0x9be990._0x32b32f))/0x8)+parseInt(_0x4d6cc7(_0x9be990._0x281dc9,_0x9be990._0x5c2f5d,_0x9be990._0x5d91f2,_0x9be990._0x28c366))/0x9+-parseInt(_0x297086(_0x9be990._0x3d291a,_0x9be990._0x2b2744,_0x9be990._0x26d285,0x239))/0xa*(parseInt(_0x297086(0x245,_0x9be990._0x1b187b,0x235,_0x9be990._0x2a87bb))/0xb);if(_0x552bb1===_0x5617e2)break;else _0x158290['push'](_0x158290['shift']());}catch(_0x5a7a38){_0x158290['push'](_0x158290['shift']());}}}(_0x10c5,0x5194a));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 _0x2178(_0x12aa7d,_0x315d96){_0x12aa7d=_0x12aa7d-0xbb;const _0x10c593=_0x10c5();let _0x2178cb=_0x10c593[_0x12aa7d];if(_0x2178['txljNx']===undefined){var _0x39415d=function(_0x38ff21){const _0x47a61='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3198c2='',_0x495e27='';for(let _0x58d479=0x0,_0x3c9eaa,_0x175e84,_0x539a86=0x0;_0x175e84=_0x38ff21['charAt'](_0x539a86++);~_0x175e84&&(_0x3c9eaa=_0x58d479%0x4?_0x3c9eaa*0x40+_0x175e84:_0x175e84,_0x58d479++%0x4)?_0x3198c2+=String['fromCharCode'](0xff&_0x3c9eaa>>(-0x2*_0x58d479&0x6)):0x0){_0x175e84=_0x47a61['indexOf'](_0x175e84);}for(let _0xcd0340=0x0,_0x5e5b93=_0x3198c2['length'];_0xcd0340<_0x5e5b93;_0xcd0340++){_0x495e27+='%'+('00'+_0x3198c2['charCodeAt'](_0xcd0340)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x495e27);};_0x2178['DisMEe']=_0x39415d,_0x2178['bgflDD']={},_0x2178['txljNx']=!![];}const _0x5dd343=_0x10c593[0x0],_0x19e572=_0x12aa7d+_0x5dd343,_0x42e41d=_0x2178['bgflDD'][_0x19e572];return!_0x42e41d?(_0x2178cb=_0x2178['DisMEe'](_0x2178cb),_0x2178['bgflDD'][_0x19e572]=_0x2178cb):_0x2178cb=_0x42e41d,_0x2178cb;}function createAbortAwareSemaphore(_0x3198c2){const _0x5dbe8a={_0x24f1a1:0x190,_0x406d46:0x197},_0x5a23e6={_0x43d63c:0x2e7,_0x48335b:0x2ec,_0x4a63d6:0x315,_0x1a7b22:0x312,_0x1a12bb:0x83,_0x53f9ec:0x85,_0x209bd7:0x96},_0x39a1a5={_0x40d32b:0xd8,_0x5b05b9:0xdc,_0x32e167:0xca,_0x1cb02d:0xd9,_0x4fe95b:0xc6},_0x522f59={_0x5ef0e5:0x6b},_0x3cf71f={_0x319437:0xee,_0x540eec:0x3d8,_0x468de5:0x3e2,_0x22cc94:0x3ea,_0x511426:0x3f9,_0x35e103:0x3fc,_0x211890:0x3ea,_0x1dffcb:0x10b},_0x228bbf={_0x1f02b8:0x266};if(!Number['isFinite'](_0x3198c2)||!Number['isInteger'](_0x3198c2)||_0x3198c2<=0x0)throw new Error(_0x53bc1e(-0x1a0,-_0x5dbe8a._0x24f1a1,-_0x5dbe8a._0x406d46,-0x184));let _0x495e27=0x0;const _0x58d479=[],_0x3c9eaa=()=>{let _0xcd0340=![];return()=>{if(_0xcd0340)return;_0xcd0340=!![],_0x495e27-=0x1,_0x175e84();};};function _0x53bc1e(_0x4de170,_0xacaaef,_0x5dac2c,_0x1e3562){return _0x2178(_0x5dac2c- -_0x228bbf._0x1f02b8,_0x4de170);}const _0x175e84=()=>{const _0x180e4d={_0x232119:0x282},_0x1da5ad={_0x2c351f:0x39};function _0x2e9ddf(_0x4e1b14,_0x34743b,_0x3d059f,_0x21a0f1){return _0x53bc1e(_0x34743b,_0x34743b-0xd2,_0x21a0f1-0x584,_0x21a0f1-_0x1da5ad._0x2c351f);}function _0x4110f7(_0x1cbdd8,_0x560ca1,_0x48996c,_0x5a47ab){return _0x53bc1e(_0x48996c,_0x560ca1-0x114,_0x1cbdd8-_0x180e4d._0x232119,_0x5a47ab-0x1d);}while(_0x58d479[_0x2e9ddf(0x3f3,0x3e9,0x3e8,0x3e7)]>0x0){const _0x5e5b93=_0x58d479[_0x4110f7(0xfa,_0x3cf71f._0x319437,0x107,0xf9)]();if(!_0x5e5b93||_0x5e5b93[_0x2e9ddf(0x3f1,_0x3cf71f._0x540eec,_0x3cf71f._0x468de5,_0x3cf71f._0x22cc94)])continue;_0x5e5b93[_0x2e9ddf(0x3e2,_0x3cf71f._0x511426,_0x3cf71f._0x35e103,_0x3cf71f._0x211890)]=!![],_0x5e5b93['removeAbortListener'](),_0x495e27+=0x1,_0x5e5b93[_0x4110f7(0xfd,0xec,0x106,_0x3cf71f._0x1dffcb)](_0x3c9eaa());return;}},_0x539a86=()=>{if(_0x495e27>=_0x3198c2)return void 0x0;return _0x495e27+=0x1,_0x3c9eaa();};return{'tryAcquire':_0x539a86,'acquire'(_0xd3ffb5){const _0x39d201={_0x4c1cc7:0x87},_0xf490be={_0x3ed706:0xef,_0x3e8365:0x16c};if(_0xd3ffb5?.[_0x5e3529(-_0x5a23e6._0x43d63c,-0x2f6,-_0x5a23e6._0x48335b,-0x2e3)])return Promise[_0x5e3529(-0x315,-_0x5a23e6._0x4a63d6,-_0x5a23e6._0x1a7b22,-0x31b)](toAbortError(_0xd3ffb5['reason']));function _0x5e3529(_0xeb5321,_0x271bb7,_0x3aec83,_0x45eda6){return _0x53bc1e(_0x45eda6,_0x271bb7-_0xf490be._0x3ed706,_0x271bb7- -_0xf490be._0x3e8365,_0x45eda6-0x19a);}function _0x3d6262(_0x215877,_0x22532b,_0x516f81,_0x2000cc){return _0x53bc1e(_0x215877,_0x22532b-_0x522f59._0x5ef0e5,_0x516f81-0x100,_0x2000cc-0x30);}const _0x41c48e=_0x539a86();if(_0x41c48e!==void 0x0)return Promise[_0x3d6262(-0x7c,-_0x5a23e6._0x1a12bb,-_0x5a23e6._0x53f9ec,-_0x5a23e6._0x209bd7)](_0x41c48e);return new Promise((_0xedf66b,_0x4b1df5)=>{const _0x526d21={_0x18d485:0x50,_0x2105e7:0x52,_0x52a976:0x119,_0x1753db:0x10f,_0x35e40c:0x5e,_0x325022:0x68,_0x23cdd9:0x5f,_0x4338b3:0x53,_0x127857:0x6c,_0x537df6:0x65},_0x25934d={_0x49c109:0x7};function _0x11ff72(_0xcd1d0d,_0x55fa19,_0x2de0a7,_0x146a92){return _0x3d6262(_0x55fa19,_0x55fa19-0xa0,_0xcd1d0d-0x4b1,_0x146a92-_0x39d201._0x4c1cc7);}const _0x36d516={'resolve':_0xedf66b,'reject':_0x4b1df5,'cancelled':![],'removeAbortListener':()=>{}};function _0x46caab(_0x278341,_0x47a637,_0x1e71de,_0x2e9370){return _0x3d6262(_0x47a637,_0x47a637-_0x25934d._0x49c109,_0x278341- -0x2f,_0x2e9370-0x111);}_0x58d479[_0x46caab(-0xd4,-_0x39a1a5._0x40d32b,-_0x39a1a5._0x5b05b9,-_0x39a1a5._0x32e167)](_0x36d516),_0x36d516[_0x46caab(-_0x39a1a5._0x1cb02d,-0xda,-_0x39a1a5._0x4fe95b,-0xe1)]=addAbortListener(_0xd3ffb5,()=>{const _0x33529f={_0x19b359:0x57};if(_0x36d516[_0x10f0a9(-0x56,-0x4c,-_0x526d21._0x18d485,-_0x526d21._0x2105e7)])return;function _0x35013b(_0x5c9832,_0x58ef74,_0x220506,_0x26e28e){return _0x11ff72(_0x5c9832- -0x535,_0x58ef74,_0x220506-0x188,_0x26e28e-0xb);}_0x36d516[_0x35013b(-0x11e,-_0x526d21._0x52a976,-_0x526d21._0x1753db,-0x12a)]=!![],_0x36d516[_0x10f0a9(-0x66,-_0x526d21._0x35e40c,-0x53,-0x55)]();const _0x2e7841=_0x58d479[_0x10f0a9(-0x67,-0x5d,-_0x526d21._0x325022,-0x75)](_0x36d516);if(_0x2e7841>=0x0)_0x58d479[_0x10f0a9(-_0x526d21._0x23cdd9,-_0x526d21._0x4338b3,-0x4c,-_0x526d21._0x127857)](_0x2e7841,0x1);function _0x10f0a9(_0x39616b,_0x3972aa,_0x4b5ca5,_0x13811a){return _0x46caab(_0x39616b-0x73,_0x4b5ca5,_0x4b5ca5-_0x33529f._0x19b359,_0x13811a-0x10d);}_0x36d516[_0x10f0a9(-_0x526d21._0x537df6,-0x61,-0x55,-0x57)](toAbortError(_0xd3ffb5?.['reason']));});});}};}function createOperationScheduler(_0x4cde59){const _0x79d9={_0x148274:0x13a},_0x226c36={_0x598e21:0x19,_0x5976de:0x28,_0x1ee351:0x1b,_0x2dbe62:0x31,_0x4b9fc2:0x24,_0x1cac12:0x25},_0x5a8196={_0x465e12:0x10d,_0x514ea6:0x63},_0x17bc12={_0x234854:0xf9,_0x4ff6f4:0xe7,_0x9e2bb6:0xe3},_0x53cf32={_0x171d86:0x480,_0xc5b3ae:0x474,_0x1fe95d:0x24,_0x593123:0x29},_0x52c274={_0x126314:0x465,_0x15fb30:0x466,_0x564f72:0x456,_0x359bc5:0x227,_0x7b36ba:0x225,_0x19f0f9:0x237,_0xa8f126:0x22f,_0x25fee1:0x46d},_0x22cd51={_0x540759:0x143,_0x544e59:0x27},_0x571e8c={_0x1a2ff7:0x59f,_0x3c2df7:0x7b},_0x56a957={_0x2e93e3:0x274,_0x415dab:0x262,_0x2628fb:0x286,_0x218e81:0x456,_0xb93c71:0x45e,_0xce7eca:0x27e,_0x375da9:0x27a,_0x9347bb:0x26d,_0x5b950e:0x25f,_0x1087b3:0x26f,_0x413957:0x43d,_0x9f5b67:0x450,_0x3f277e:0x45d,_0x3f5026:0x27c,_0x2ea475:0x26f,_0x29c000:0x279,_0x56587d:0x25c,_0x24ac1e:0x25d},_0x12599c={_0xb2002a:0x592,_0x1dae09:0x20},_0x2964a6={_0xaf0a32:0x207},_0x161a96={_0x5cbac5:0x2ec,_0x518fbe:0x2f5,_0x1fd7ee:0x2f8},_0x166c46={_0x443b0c:0x21f,_0x4a9e4e:0x212,_0x4a8164:0x151,_0x56f31b:0x140,_0x1ee6fb:0x208,_0x382a45:0x118,_0x33dd6f:0x12c};if(!Number[_0x1994db(-0x127,-0x138,-0x133,-_0x79d9._0x148274)](_0x4cde59)||_0x4cde59<=0x0)throw new Error('maxConcurrency\x20must\x20be\x20a\x20positive\x20safe\x20integer');const _0x62f473=new Map(),_0x4ce427=(_0x3c4e3d,_0x3b207f)=>{const _0x2f09d7={_0xd4f922:0x112,_0x173d5f:0x104,_0x565244:0x101,_0xe568b:0x27e,_0x5448b4:0x11b,_0x4324a7:0x10f,_0x52b8c4:0x103,_0x441755:0x279,_0x2850de:0x289,_0x2c7f20:0x28a,_0x37d050:0x292,_0x2e00ea:0x282,_0x79e62b:0x275},_0x5e9ccf={_0x1061c3:0x263},_0x1b9dff={_0x440e13:0x17f,_0x353e77:0x179,_0x50f573:0x16d,_0x504b55:0x168,_0x1ec308:0x17b,_0x5bbcba:0x406,_0x6ddff9:0x412,_0x2ace4c:0x407,_0x3275c7:0x17d,_0x46036:0x187,_0x192f15:0x3f5,_0x2de264:0x3f5,_0x2a658f:0x3f9,_0x5b71c2:0x3db,_0x15c11c:0x174},_0x4cfd8a={_0x31492c:0x29a,_0x2d0d56:0x2a0,_0x2c48a0:0x287},_0x3cbfb6={_0x16d3ed:0xc9},_0x581bb8={_0x49af58:0x435,_0x4e680b:0x115};let _0x1b3a5c=_0x62f473[_0x1b08bb(_0x161a96._0x5cbac5,0x2ed,_0x161a96._0x518fbe,_0x161a96._0x1fd7ee)](_0x3c4e3d);!_0x1b3a5c&&(_0x1b3a5c={'ready':[],'starting':![],'registrations':0x0},_0x62f473[_0x1b08bb(0x30b,_0x161a96._0x1fd7ee,0x2f1,0x30c)](_0x3c4e3d,_0x1b3a5c));function _0x1b08bb(_0xdc5d01,_0x47cc01,_0x119716,_0xb29019){return _0x1994db(_0x47cc01-_0x581bb8._0x49af58,_0x47cc01-0xdc,_0x119716-_0x581bb8._0x4e680b,_0xb29019);}function _0xce6145(_0x4fbf75,_0x3470a1,_0x4a9939,_0x49b585){return _0x1994db(_0x4a9939-0xe6,_0x3470a1-0x3d,_0x4a9939-_0x3cbfb6._0x16d3ed,_0x49b585);}const _0x55b697=_0x1b3a5c;_0x55b697[_0xce6145(-0x33,-0x52,-0x42,-0x51)]++;const _0x287d3d={'source':_0x3b207f,'queued':![],'closed':![]},_0x181c93=()=>{const _0x2a0b45={_0xb18035:0x166,_0x101982:0xc9},_0x3a6277={_0x1a5729:0x75,_0x3c941d:0x474},_0xae92c5={_0x50655c:0x92};if(_0x55b697['starting'])return;function _0xfbfd3f(_0x173353,_0x25b4e0,_0x206362,_0x491390){return _0xce6145(_0x173353-_0xae92c5._0x50655c,_0x25b4e0-0x93,_0x173353-0x448,_0x25b4e0);}const _0x18caf3=_0x55b697[_0x5339a0(-_0x1b9dff._0x440e13,-0x160,-0x16e,-_0x1b9dff._0x353e77)][_0x5339a0(-0x172,-_0x1b9dff._0x50f573,-_0x1b9dff._0x504b55,-_0x1b9dff._0x1ec308)]();function _0x5339a0(_0xa9885e,_0x250778,_0x1729bd,_0xc7749){return _0x1b08bb(_0xa9885e-_0x3a6277._0x1a5729,_0x1729bd- -_0x3a6277._0x3c941d,_0x1729bd-0x158,_0x250778);}if(!_0x18caf3){if(_0x55b697[_0xfbfd3f(_0x1b9dff._0x5bbcba,_0x1b9dff._0x6ddff9,0x404,_0x1b9dff._0x2ace4c)]===0x0&&_0x62f473[_0x5339a0(-_0x1b9dff._0x3275c7,-0x195,-_0x1b9dff._0x46036,-0x192)](_0x3c4e3d)===_0x55b697)_0x62f473[_0xfbfd3f(_0x1b9dff._0x192f15,_0x1b9dff._0x2de264,0x3f4,0x3ef)](_0x3c4e3d);return;}_0x18caf3[_0xfbfd3f(0x3eb,_0x1b9dff._0x2a658f,0x3f5,_0x1b9dff._0x5b71c2)]=![],_0x55b697[_0x5339a0(-0x16b,-0x174,-0x16d,-0x16d)]=!![];let _0x12cf55=![];const _0x40f8ac=()=>{function _0x4bada1(_0x5a2d0a,_0x559ba7,_0x3a875b,_0x518ba1){return _0xfbfd3f(_0x5a2d0a- -_0x2a0b45._0xb18035,_0x518ba1,_0x3a875b-0x20,_0x518ba1-_0x2a0b45._0x101982);}if(_0x12cf55)return;_0x12cf55=!![],_0x55b697[_0x4bada1(_0x4cfd8a._0x31492c,_0x4cfd8a._0x2d0d56,_0x4cfd8a._0x2c48a0,0x298)]=![],queueMicrotask(_0x181c93);};_0x18caf3['source'][_0x5339a0(-0x183,-0x183,-0x175,-_0x1b9dff._0x15c11c)](_0x40f8ac);};return{'ready'(){const _0x334106={_0x50b948:0x101,_0x37b441:0x432,_0x48cfbe:0xa};if(_0x287d3d[_0x58969f(_0x166c46._0x443b0c,0x215,0x228,_0x166c46._0x4a9e4e)]||_0x287d3d[_0x250392(-0x14e,-_0x166c46._0x4a8164,-0x134,-_0x166c46._0x56f31b)])return;function _0x58969f(_0x27105c,_0x3468c9,_0x1f7906,_0x939fe7){return _0xce6145(_0x27105c-0x15a,_0x3468c9-0x85,_0x27105c-_0x5e9ccf._0x1061c3,_0x3468c9);}_0x287d3d[_0x58969f(0x206,0x1fd,0x217,_0x166c46._0x1ee6fb)]=!![],_0x55b697[_0x250392(-_0x166c46._0x382a45,-0x139,-0x12d,-_0x166c46._0x33dd6f)]['push'](_0x287d3d);function _0x250392(_0x451c4f,_0x1cfe7e,_0x131d79,_0x5b64f3){return _0x1b08bb(_0x451c4f-_0x334106._0x50b948,_0x5b64f3- -_0x334106._0x37b441,_0x131d79-_0x334106._0x48cfbe,_0x451c4f);}queueMicrotask(_0x181c93);},'close'(){const _0xbaab15={_0x3f4960:0xd7,_0x4177b3:0x1f9},_0x37e281={_0x2ad8c9:0x1a1};if(_0x287d3d[_0x22f5ff(_0x2f09d7._0xd4f922,_0x2f09d7._0x173d5f,_0x2f09d7._0x565244,0x105)])return;_0x287d3d[_0x563751(-0x271,-0x27a,-_0x2f09d7._0xe568b,-0x270)]=!![],_0x55b697[_0x22f5ff(0x114,_0x2f09d7._0x5448b4,_0x2f09d7._0x4324a7,0x10f)]--;function _0x563751(_0x4ff232,_0x59ef1d,_0x37d863,_0x59f044){return _0x1b08bb(_0x4ff232-_0x37e281._0x2ad8c9,_0x59f044- -0x57b,_0x37d863-0x108,_0x4ff232);}_0x287d3d[_0x22f5ff(0xf9,_0x2f09d7._0x52b8c4,0xec,0xf2)]&&(_0x55b697[_0x563751(-_0x2f09d7._0x441755,-_0x2f09d7._0x2850de,-0x27e,-0x275)][_0x563751(-0x292,-0x29a,-0x28a,-_0x2f09d7._0x2c7f20)](_0x55b697[_0x22f5ff(0x10d,0x106,0x11f,0xfe)][_0x563751(-0x290,-0x286,-0x293,-_0x2f09d7._0x37d050)](_0x287d3d),0x1),_0x287d3d[_0x563751(-0x286,-_0x2f09d7._0x2e00ea,-_0x2f09d7._0x79e62b,-_0x2f09d7._0x2850de)]=![]);function _0x22f5ff(_0x2c345c,_0x3e00b7,_0x32cfc8,_0x54d625){return _0x1b08bb(_0x2c345c-_0xbaab15._0x3f4960,_0x2c345c- -_0xbaab15._0x4177b3,_0x32cfc8-0xeb,_0x54d625);}_0x181c93();}};};function _0x1994db(_0x333270,_0x34f08c,_0x4b3d8c,_0x4d3048){return _0x2178(_0x333270- -_0x2964a6._0xaf0a32,_0x4d3048);}let _0x1ef224=0x0;const _0x1b0b07=new Map(),_0x563e06=[],_0x8d60cf=()=>{function _0x403c6d(_0x5d2138,_0x5154bc,_0xca427a,_0x4c8891){return _0x1994db(_0x5154bc-_0x12599c._0xb2002a,_0x5154bc-0xb6,_0xca427a-_0x12599c._0x1dae09,_0x5d2138);}function _0x163729(_0x15c46b,_0x12923f,_0xfb992,_0x3ffdc1){return _0x1994db(_0x15c46b- -0x136,_0x12923f-0x69,_0xfb992-0x197,_0x12923f);}while(_0x1ef224<_0x4cde59&&_0x563e06[_0x163729(-_0x56a957._0x2e93e3,-0x279,-_0x56a957._0x415dab,-_0x56a957._0x2628fb)]>0x0){const _0x2be9cd=_0x563e06[_0x403c6d(0x45f,0x469,_0x56a957._0x218e81,_0x56a957._0xb93c71)]();if(_0x2be9cd===void 0x0)break;const _0x2a9a75=_0x1b0b07[_0x163729(-_0x56a957._0xce7eca,-0x289,-_0x56a957._0x375da9,-_0x56a957._0x9347bb)](_0x2be9cd),_0x5162cf=_0x2a9a75?.[_0x163729(-_0x56a957._0x5b950e,-0x267,-_0x56a957._0x1087b3,-0x25c)]();if(!_0x2a9a75||!_0x5162cf)throw new Error('Ready\x20run\x20must\x20have\x20a\x20waiting\x20operation');_0x5162cf[_0x403c6d(0x440,0x447,_0x56a957._0x413957,0x457)]();if(_0x2a9a75[_0x403c6d(0x457,0x454,_0x56a957._0x9f5b67,_0x56a957._0x3f277e)]>0x0)_0x563e06[_0x163729(-_0x56a957._0x3f5026,-0x271,-0x285,-0x26e)](_0x2be9cd);else _0x1b0b07[_0x163729(-_0x56a957._0x2ea475,-0x27e,-0x276,-_0x56a957._0x29c000)](_0x2be9cd);_0x1ef224+=0x1;let _0x4a5309=![];_0x5162cf[_0x163729(-_0x56a957._0x56587d,-_0x56a957._0x24ac1e,-0x255,-0x269)]({'release'(){if(_0x4a5309)return;_0x4a5309=!![],_0x1ef224-=0x1,_0x8d60cf();}});}};return{'registerProducer':_0x4ce427,'acquire'(_0x93aeaa,_0x3ae3f9){if(_0x3ae3f9[_0x4e7bb7(0x486,0x488,_0x53cf32._0x171d86,_0x53cf32._0xc5b3ae)])return Promise[_0x3f555d(-0x37,-_0x53cf32._0x1fe95d,-_0x53cf32._0x593123,-0x25)](toAbortError(_0x3ae3f9[_0x4e7bb7(0x481,0x485,0x47b,0x473)]));function _0x4e7bb7(_0x45a859,_0x42f1f1,_0x425937,_0x2f7f23){return _0x1994db(_0x2f7f23-_0x571e8c._0x1a2ff7,_0x42f1f1-_0x571e8c._0x3c2df7,_0x425937-0x1d8,_0x45a859);}function _0x3f555d(_0x163c5f,_0x465967,_0x1099ae,_0x200e04){return _0x1994db(_0x465967-0x126,_0x465967-_0x22cd51._0x540759,_0x1099ae-_0x22cd51._0x544e59,_0x1099ae);}return new Promise((_0x76ddf5,_0x3bef55)=>{const _0x3cd615={_0x23acc3:0x3d},_0xa4bed2={_0x5dd5b5:0x149,_0x12af26:0x59},_0x4fc72a={_0x36598e:0x324,_0x3f2e25:0x1fa,_0x34aff9:0x1f1,_0x6d35fc:0x1ec,_0x221e76:0x1f3,_0x147b8f:0x30d},_0x153137={_0x37f2a8:0x18c,_0x34f47c:0x142,_0x1b45ca:0x47};let _0x302a56=_0x1b0b07[_0x5326d9(_0x52c274._0x126314,_0x52c274._0x15fb30,0x476,_0x52c274._0x564f72)](_0x93aeaa);!_0x302a56&&(_0x302a56=[],_0x1b0b07[_0x440840(-_0x52c274._0x359bc5,-_0x52c274._0x7b36ba,-0x22f,-_0x52c274._0x19f0f9)](_0x93aeaa,_0x302a56),_0x563e06['push'](_0x93aeaa));const _0x4d4e47={'resolve':_0x76ddf5,'removeAbortListener':()=>_0x3ae3f9[_0x440840(-0x23c,-0x245,-0x235,-0x236)](_0x440840(-0x24b,-0x238,-0x230,-0x241),_0x2c699a)},_0x563c19=_0x302a56,_0x2c699a=()=>{const _0x18724b={_0x3d7ec2:0x559};function _0xde2d40(_0x3cb14d,_0x694940,_0x79dd5b,_0x28dc9b){return _0x440840(_0x3cb14d-_0x153137._0x37f2a8,_0x694940-_0x153137._0x34f47c,_0x3cb14d,_0x28dc9b-_0x153137._0x1b45ca);}_0x563c19[_0x1c9780(_0x4fc72a._0x36598e,0x31b,0x32a,0x31b)](_0x563c19['indexOf'](_0x4d4e47),0x1);_0x563c19[_0xde2d40(-0x1f0,-0x1ee,-_0x4fc72a._0x3f2e25,-_0x4fc72a._0x34aff9)]===0x0&&(_0x1b0b07[_0xde2d40(-_0x4fc72a._0x6d35fc,-_0x4fc72a._0x221e76,-0x1f6,-0x1ec)](_0x93aeaa),_0x563e06['splice'](_0x563e06[_0x1c9780(0x318,0x313,_0x4fc72a._0x147b8f,0x314)](_0x93aeaa),0x1));function _0x1c9780(_0x7e2426,_0x2f2a21,_0x53aeca,_0x4f7b79){return _0x440840(_0x7e2426-0xba,_0x2f2a21-0x20,_0x53aeca,_0x2f2a21-_0x18724b._0x3d7ec2);}_0x4d4e47['removeAbortListener'](),_0x3bef55(toAbortError(_0x3ae3f9['reason']));};_0x3ae3f9['addEventListener'](_0x440840(-0x242,-_0x52c274._0xa8f126,-0x245,-0x241),_0x2c699a,{'once':!![]});function _0x5326d9(_0xc7d97c,_0x11bc51,_0x19bd26,_0x37e2f3){return _0x3f555d(_0xc7d97c-_0xa4bed2._0x5dd5b5,_0xc7d97c-0x487,_0x19bd26,_0x37e2f3-_0xa4bed2._0x12af26);}function _0x440840(_0x3de3ef,_0x26ca96,_0x3f1d36,_0x170e8d){return _0x4e7bb7(_0x3f1d36,_0x26ca96-0x168,_0x3f1d36-_0x3cd615._0x23acc3,_0x170e8d- -0x699);}_0x302a56[_0x5326d9(0x467,0x47a,_0x52c274._0x25fee1,0x469)](_0x4d4e47),_0x8d60cf();});},'inspectAdmission'(){const _0x558e82={_0x18a1b5:0x4e2},_0x45da34={_0x1c6d0c:0xe8};function _0xae1ca3(_0x16f368,_0x11618e,_0x5615dc,_0x455325){return _0x1994db(_0x5615dc-0x5e,_0x11618e-0x4e,_0x5615dc-_0x45da34._0x1c6d0c,_0x455325);}function _0x49beb9(_0x203393,_0x5d1a1f,_0x2da28d,_0x5d5b6b){return _0x1994db(_0x2da28d-_0x558e82._0x18a1b5,_0x5d1a1f-0xd7,_0x2da28d-0x150,_0x5d1a1f);}return[..._0x62f473][_0xae1ca3(-0xf3,-_0x17bc12._0x234854,-_0x17bc12._0x4ff6f4,-_0x17bc12._0x9e2bb6)](([_0x349b83,_0x2fccbe])=>({'runId':_0x349b83,'starting':_0x2fccbe[_0xae1ca3(-0xc2,-0xc4,-0xd0,-0xd4)],'callers':_0x2fccbe[_0x49beb9(0x3b2,0x3be,0x3ba,0x3b0)]}));},'inspect'(){function _0x289cd2(_0x406f75,_0x41dfcc,_0x1e4046,_0x32dcff){return _0x1994db(_0x41dfcc- -0x11,_0x41dfcc-0x5e,_0x1e4046-0x184,_0x406f75);}function _0x8d715f(_0xcd5dd8,_0xf7ebb3,_0x4ee1b9,_0x38fe8a){return _0x1994db(_0xf7ebb3-_0x5a8196._0x465e12,_0xf7ebb3-0x111,_0x4ee1b9-_0x5a8196._0x514ea6,_0x4ee1b9);}return{'active':_0x1ef224,'readyRunIds':[..._0x563e06],'waiting':[..._0x1b0b07[_0x8d715f(-_0x226c36._0x598e21,-_0x226c36._0x5976de,-_0x226c36._0x1ee351,-_0x226c36._0x2dbe62)]()][_0x8d715f(-0x42,-0x33,-_0x226c36._0x4b9fc2,-_0x226c36._0x1cac12)]((_0x5b23c9,_0x4b56eb)=>_0x5b23c9+_0x4b56eb[_0x8d715f(-0x41,-0x31,-0x30,-0x41)],0x0)};}};}var MESSAGE_ROLES=['assistant',_0x28e597(-0x1cd,-0x1c1,-0x1ba,-0x1ce)];function _0x28e597(_0x28849e,_0x26f0c6,_0x21f0e6,_0xa5df38){return _0x2178(_0x28849e- -0x29a,_0xa5df38);}Object['freeze'](MESSAGE_ROLES);export{MESSAGE_ROLES,OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,createOperationScheduler,isAbortError,isAgentOnlyBashCompletion,isAgentOnlyCoordinatorNotice,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};function _0x10c5(){const _0x553e7a=['nLzTBNLryG','mty0mdGZnxjKDw9lAa','mta0nuPQD0TkzG','mtKXmJH3Cvv5ALK','mtm4wLz1r0XV','CMvHzhK','C3rHCNrPBMC','ote3zhbHrxDQ','CMvHC29U','ywjVCNrLza','y2XVC2vK','C2HPzNq','CMvNAxn0CMf0Aw9UCW','AxntywzLsw50zwDLCG','CMvZB2X2zq','Aw5KzxHpzG','CMvTB3zLqwjVCNrmAxn0zw5LCG','CMvQzwn0','mtC3nZKWsxjlvuXZ','z2v0','ywjVCNq','ChvZAa','BwfW','C3bSAwnL','CxvLDwvK','nZK0otDlCLbUvM8','otiYmdaYzfvwu0zd','CMvKDwnL','ndGYodrKEvPwv0S','BgvUz3rO','C2v0','CMvTB3zLrxzLBNrmAxn0zw5LCG','y2fUy2vSBgvK','DxnLCG','zgvSzxrL','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','ndaWntaWou1oCe9Oua','C3rHCNq','DMfSDwvZ'];_0x10c5=function(){return _0x553e7a;};return _0x10c5();}
@@ -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;