@nuvin/agent-core 0.0.0-rc.13 → 0.0.0-rc.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ import { bj as AnyExtensionRegistration, o as ToolUseBlock, aG as ToolExecutionContext, b0 as ToolRuntimeDispatchDecision } from '../types-CSXSwpwn.js';
2
+ import { HooksConfig } from '@nuvin/config';
3
+ export { CommandHookConfig, HookMatcherGroup, HooksConfig } from '@nuvin/config';
4
+
5
+ type HookEventName = "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "Notification" | "SessionStart" | "SessionEnd";
6
+ interface ResolvedHook {
7
+ command: string;
8
+ timeout: number;
9
+ }
10
+ /** JSON payload written to hook's stdin. */
11
+ interface HookInput {
12
+ session_id?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ /** JSON output parsed from hook's stdout. */
16
+ interface HookOutput {
17
+ /** Approve or block the action. PreToolUse only. */
18
+ decision?: "approve" | "block";
19
+ /** Reason for block. PreToolUse only. */
20
+ reason?: string;
21
+ /**
22
+ * Event-specific outputs. For PreToolUse, this carries `permissionDecision`
23
+ * (Claude Code compat). For all events, this carries `additionalContext`.
24
+ */
25
+ hookSpecificOutput?: {
26
+ /** Echoed event name — not required to parse, but useful for debugging. */
27
+ hookEventName?: string;
28
+ /** Auto-approve/deny/ask the permission. PreToolUse only. */
29
+ permissionDecision?: "allow" | "deny" | "ask";
30
+ /** Reason for the permission decision. */
31
+ permissionDecisionReason?: string;
32
+ /** Inject additional context into the prompt/system. */
33
+ additionalContext?: string;
34
+ };
35
+ }
36
+ /** Internal result from executing a hook command. */
37
+ interface HookResult {
38
+ status: "pass" | "block" | "error";
39
+ output?: HookOutput;
40
+ error?: string;
41
+ duration_ms: number;
42
+ }
43
+
44
+ declare function executeCommandHook(command: string, input: HookInput, timeoutSeconds?: number, projectDir?: string): Promise<HookResult>;
45
+
46
+ type HookExecutorFn = typeof executeCommandHook;
47
+ interface HookRegistryLike {
48
+ getHooks(event: HookEventName, toolName?: string): ResolvedHook[];
49
+ hasHooks?: (event: HookEventName) => boolean;
50
+ }
51
+ interface CreateHookExtensionsOptions {
52
+ sessionId?: string;
53
+ projectDir?: string;
54
+ }
55
+ /**
56
+ * Creates observer extension registrations for non-blocking hook events.
57
+ * PreToolUse blocking is handled separately via onToolCall middleware
58
+ * (see createHookOnToolCallMiddleware).
59
+ */
60
+ declare function createHookExtensions(registry: HookRegistryLike, executor: HookExecutorFn, options?: CreateHookExtensionsOptions): AnyExtensionRegistration[];
61
+ /**
62
+ * Creates an onToolCall middleware that runs PreToolUse hooks before
63
+ * delegating to the original approval handler.
64
+ *
65
+ * Returns `{ action: "reject" }` if any hook blocks, otherwise delegates
66
+ * to the original handler.
67
+ */
68
+ declare function createHookOnToolCallMiddleware(registry: HookRegistryLike, executor: HookExecutorFn, originalOnToolCall: (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined, options?: CreateHookExtensionsOptions): (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
69
+
70
+ interface HookRegistry {
71
+ getHooks(event: HookEventName, toolName?: string): ResolvedHook[];
72
+ hasHooks(event: HookEventName): boolean;
73
+ }
74
+ declare function createHookRegistry(config: HooksConfig): HookRegistry;
75
+
76
+ export { type HookEventName, type HookExecutorFn, type HookInput, type HookOutput, type HookRegistry, type HookRegistryLike, type HookResult, type ResolvedHook, createHookExtensions, createHookOnToolCallMiddleware, createHookRegistry, executeCommandHook };
@@ -0,0 +1 @@
1
+ function _0x1531(_0x3ae6e0,_0x4ac9f2){_0x3ae6e0=_0x3ae6e0-0x188;const _0x203408=_0x2034();let _0x153156=_0x203408[_0x3ae6e0];if(_0x1531['TevQRT']===undefined){var _0x487aa4=function(_0x48d945){const _0xe32dd3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2c6685='',_0x2dbead='';for(let _0x5686ae=0x0,_0x5aa212,_0x461ac7,_0x255274=0x0;_0x461ac7=_0x48d945['charAt'](_0x255274++);~_0x461ac7&&(_0x5aa212=_0x5686ae%0x4?_0x5aa212*0x40+_0x461ac7:_0x461ac7,_0x5686ae++%0x4)?_0x2c6685+=String['fromCharCode'](0xff&_0x5aa212>>(-0x2*_0x5686ae&0x6)):0x0){_0x461ac7=_0xe32dd3['indexOf'](_0x461ac7);}for(let _0x2f8dab=0x0,_0x513c65=_0x2c6685['length'];_0x2f8dab<_0x513c65;_0x2f8dab++){_0x2dbead+='%'+('00'+_0x2c6685['charCodeAt'](_0x2f8dab)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2dbead);};_0x1531['BaAHwv']=_0x487aa4,_0x1531['VKhBfs']={},_0x1531['TevQRT']=!![];}const _0x197a83=_0x203408[0x0],_0x56eb3d=_0x3ae6e0+_0x197a83,_0x4bd7cf=_0x1531['VKhBfs'][_0x56eb3d];return!_0x4bd7cf?(_0x153156=_0x1531['BaAHwv'](_0x153156),_0x1531['VKhBfs'][_0x56eb3d]=_0x153156):_0x153156=_0x4bd7cf,_0x153156;}(function(_0x1d13b2,_0x42f083){const _0x28cf41={_0x114920:0x193,_0x28140d:0x199,_0xd7158d:0x1c5,_0x32a198:0x1a6,_0x4b1c93:0x30b,_0x5d0a94:0x320,_0x391f3d:0x1a0,_0x3202f6:0x1a5,_0x5aa432:0x315,_0x2b0ea3:0x2f0,_0x59c06c:0x19c,_0x37e64a:0x17c,_0x59e651:0x17b,_0x247c98:0x189,_0x5c2482:0x18d,_0x9f6ad8:0x19b,_0x2835d5:0x334,_0x4dd4e7:0x319,_0x505f9e:0x339,_0x160b7a:0x19d,_0x5aa12a:0x17d,_0x3bb9a0:0x2ed,_0x46e7c1:0x30a,_0x1f354b:0x2d5},_0x3eb78b={_0x3df12b:0x34d};function _0x3a9608(_0x42f1dc,_0x715efe,_0x3c3da8,_0x2d9264){return _0x1531(_0x2d9264- -_0x3eb78b._0x3df12b,_0x42f1dc);}const _0x64bf9b=_0x1d13b2();function _0x31e55b(_0x257e78,_0x375990,_0x5b8aa0,_0x40a590){return _0x1531(_0x5b8aa0-0x160,_0x257e78);}while(!![]){try{const _0x3eda73=parseInt(_0x3a9608(-_0x28cf41._0x114920,-_0x28cf41._0x28140d,-_0x28cf41._0xd7158d,-_0x28cf41._0x32a198))/0x1*(parseInt(_0x31e55b(_0x28cf41._0x4b1c93,0x310,_0x28cf41._0x5d0a94,0x306))/0x2)+-parseInt(_0x3a9608(-_0x28cf41._0x391f3d,-_0x28cf41._0x3202f6,-0x1b8,-0x1c0))/0x3+-parseInt(_0x31e55b(_0x28cf41._0x5aa432,_0x28cf41._0x2b0ea3,0x2fd,0x2e3))/0x4*(-parseInt(_0x3a9608(-_0x28cf41._0x59c06c,-0x183,-0x18b,-0x197))/0x5)+-parseInt(_0x3a9608(-_0x28cf41._0x37e64a,-_0x28cf41._0x59e651,-_0x28cf41._0x247c98,-0x194))/0x6+parseInt(_0x3a9608(-0x17b,-_0x28cf41._0x5c2482,-0x1a0,-_0x28cf41._0x9f6ad8))/0x7+-parseInt(_0x31e55b(_0x28cf41._0x2835d5,_0x28cf41._0x4dd4e7,0x322,_0x28cf41._0x505f9e))/0x8+-parseInt(_0x3a9608(-0x174,-_0x28cf41._0x160b7a,-_0x28cf41._0x5aa12a,-0x18e))/0x9*(-parseInt(_0x31e55b(_0x28cf41._0x3bb9a0,_0x28cf41._0x46e7c1,0x2f2,_0x28cf41._0x1f354b))/0xa);if(_0x3eda73===_0x42f083)break;else _0x64bf9b['push'](_0x64bf9b['shift']());}catch(_0x47027d){_0x64bf9b['push'](_0x64bf9b['shift']());}}}(_0x2034,0xbf7c3));import{spawn}from'child_process';var DEFAULT_TIMEOUT_S=0x3c;async function executeCommandHook(_0x2c6685,_0x2dbead,_0x5686ae=DEFAULT_TIMEOUT_S,_0x5aa212){const _0xb13ac3={_0x35581f:0x175,_0x576f6d:0x188},_0x14e47d={_0x3f0275:0x20,_0x218d24:0x9,_0x5e8113:0x3,_0x68ed47:0x12,_0x28967b:0x178,_0xcb7096:0x15e,_0xa5a6:0x31,_0x17cc61:0x3a,_0x1ad5ee:0x38,_0x337279:0x26,_0x404581:0x166,_0x73e74b:0x177,_0x1bc915:0x17e,_0x23cc85:0x192,_0x1186b9:0x192,_0x4e9db3:0x30,_0x3c1d4d:0x17a,_0x73f059:0x17d,_0x4e9a40:0x19a,_0x38d9c9:0x2e,_0x5708aa:0x195,_0x225093:0x19c,_0x58a38e:0x199},_0x313665={_0x413e3a:0xaf,_0x1ccc3b:0xd7,_0xe88ec9:0xc0,_0x50962b:0xb5,_0xfbb962:0xeb},_0x582b33={_0x5ebcfe:0x30},_0x5c83ec={_0x274be:0x1a4,_0x57bea6:0xc6},_0xa366b={_0x3bba84:0x148,_0x2fcbf7:0x12b},_0x38cc98={_0x475274:0x121,_0x45fbe4:0x118,_0x532f3f:0x10a};function _0x3ee5b2(_0x1e2080,_0x3a9c1d,_0x1aaa82,_0x27eb4b){return _0x1531(_0x3a9c1d- -0x21,_0x27eb4b);}const _0x461ac7=Date[_0x3ee5b2(_0xb13ac3._0x35581f,0x177,0x16b,_0xb13ac3._0x576f6d)]();return new Promise(_0x255274=>{const _0x4b3f06={_0x30011c:0x67,_0x13c2b5:0x79,_0x578136:0x6c,_0x1ca36d:0x3ff,_0x4c3e2b:0x40e,_0x1fa3e3:0x3fb,_0x302c9a:0x407,_0x2a0f6:0x3f3,_0x52dd89:0x3dc,_0x2ae971:0x3e8,_0x270c0c:0x3e5,_0x358c05:0x412,_0x1d6728:0x86,_0x55ecc4:0xa4,_0x21826f:0x94,_0xfb9fae:0x68,_0x53d2e6:0x85,_0x4f7e50:0x3e4,_0xd1b117:0x3c8},_0x1dd72b={_0x5baf34:0xfb,_0x4da4d5:0x413,_0x277443:0x9c},_0x386f53={_0x179bea:0x2d,_0x109347:0x213},_0x49f588={_0x321437:0x216,_0x2c38b:0x1f1,_0x2ea262:0x1f8},_0x2e634d={_0x3a54da:0xed},_0x2a31a4={_0x461f1c:0xea,_0x1f1aa8:0xbb},_0x2f8dab=spawn('sh',['-c',_0x2c6685],{'stdio':[_0xeff669(0x10,-0x4,-0x9,-0x18),_0xeff669(-_0x14e47d._0x3f0275,-0x23,-_0x14e47d._0x218d24,-0xa),_0xeff669(_0x14e47d._0x5e8113,-0x12,-_0x14e47d._0x218d24,-_0x14e47d._0x68ed47)],'env':{...process[_0x1f41d3(-_0x14e47d._0x28967b,-_0x14e47d._0xcb7096,-0x170,-0x17b)],'CLAUDE_PROJECT_DIR':_0x5aa212??process[_0xeff669(-_0x14e47d._0xa5a6,-0x32,-_0x14e47d._0x17cc61,-_0x14e47d._0x1ad5ee)]()}});let _0x513c65='',_0xfe920='';_0x2f8dab['stdout']['on'](_0xeff669(-0x10,-_0x14e47d._0x68ed47,-_0x14e47d._0x337279,-0x16),_0x4ad396=>{_0x513c65+=_0x4ad396['toString']();}),_0x2f8dab[_0x1f41d3(-_0x14e47d._0x404581,-0x197,-0x187,-_0x14e47d._0x73e74b)]['on'](_0xeff669(-0x16,-0x13,-0x26,-0x17),_0x5f2b5d=>{const _0x2f97e6={_0x1698cd:0x1c3};function _0x41a607(_0xba82eb,_0x5db34b,_0x997b24,_0x2d2343){return _0x1f41d3(_0xba82eb-_0x2f97e6._0x1698cd,_0x5db34b,_0x997b24-0x184,_0x2d2343-0xac);}_0xfe920+=_0x5f2b5d[_0x41a607(-0x124,-_0x38cc98._0x475274,-_0x38cc98._0x45fbe4,-_0x38cc98._0x532f3f)]();}),_0x2f8dab[_0x1f41d3(-_0x14e47d._0x1bc915,-0x1a2,-_0x14e47d._0x23cc85,-_0x14e47d._0x1186b9)]['on'](_0xeff669(-0xc,-_0x14e47d._0x4e9db3,-_0x14e47d._0x3f0275,-0x3a),_0x1d6e6c=>{function _0x2ce66f(_0x1d07b7,_0x5de937,_0x4834d1,_0x9d9dd2){return _0x1f41d3(_0x1d07b7-_0x2a31a4._0x461f1c,_0x9d9dd2,_0x4834d1-_0x2a31a4._0x1f1aa8,_0x5de937-0x2c1);}if(_0x1d6e6c[_0x2ce66f(0x13d,_0xa366b._0x3bba84,0x143,_0xa366b._0x2fcbf7)]!=='EPIPE')throw _0x1d6e6c;}),_0x2f8dab['stdin'][_0x1f41d3(-0x170,-_0x14e47d._0x3c1d4d,-0x165,-_0x14e47d._0x73f059)](JSON[_0x1f41d3(-_0x14e47d._0x4e9a40,-0x198,-0x1b7,-0x1a9)](_0x2dbead)),_0x2f8dab['stdin']['end']();function _0xeff669(_0x53dcbe,_0x48456d,_0x41a2b7,_0x2c15cf){return _0x3ee5b2(_0x53dcbe-0x1ba,_0x41a2b7- -_0x5c83ec._0x274be,_0x41a2b7-_0x5c83ec._0x57bea6,_0x53dcbe);}const _0x50f49a=setTimeout(()=>{const _0x237a3e={_0x35e10b:0x142,_0x2bf393:0x17d,_0x2d574a:0x77};function _0x374535(_0x7d238,_0x290f1b,_0x1be863,_0x26098f){return _0x1f41d3(_0x7d238-_0x237a3e._0x35e10b,_0x290f1b,_0x1be863-_0x237a3e._0x2bf393,_0x26098f- -_0x237a3e._0x2d574a);}function _0x438a5e(_0x3b98f2,_0x3fd0b3,_0x158c49,_0x4b24b9){return _0xeff669(_0x3b98f2,_0x3fd0b3-_0x2e634d._0x3a54da,_0x4b24b9- -0x65,_0x4b24b9-0x188);}_0x2f8dab[_0x438a5e(-0x5a,-0x85,-0x76,-0x6f)]('SIGKILL'),_0x255274({'status':'error','error':_0x374535(-_0x49f588._0x321437,-0x1fc,-_0x49f588._0x2c38b,-_0x49f588._0x2ea262)+_0x5686ae+'s','duration_ms':Date['now']()-_0x461ac7});},_0x5686ae*0x3e8);_0x2f8dab['on'](_0xeff669(0x0,-0x13,-0x1c,-_0x14e47d._0x38d9c9),_0x6de020=>{clearTimeout(_0x50f49a);function _0x3ecce5(_0x413aba,_0x83b1a6,_0x300f09,_0x4ecc63){return _0x1f41d3(_0x413aba-_0x386f53._0x179bea,_0x413aba,_0x300f09-0xeb,_0x83b1a6-_0x386f53._0x109347);}function _0x5bff85(_0x270b18,_0x1c599d,_0x352e19,_0x1fa430){return _0xeff669(_0x352e19,_0x1c599d-_0x1dd72b._0x5baf34,_0x270b18-_0x1dd72b._0x4da4d5,_0x1fa430-_0x1dd72b._0x277443);}const _0x364bcb=Date['now']()-_0x461ac7;if(_0x6de020===0x2){_0x255274({'status':_0x3ecce5(_0x4b3f06._0x30011c,_0x4b3f06._0x13c2b5,0x72,_0x4b3f06._0x578136),'output':{'decision':'block','reason':_0xfe920[_0x5bff85(_0x4b3f06._0x1ca36d,0x41d,_0x4b3f06._0x4c3e2b,_0x4b3f06._0x1fa3e3)]()||_0x5bff85(0x412,0x3f2,0x400,_0x4b3f06._0x302c9a)},'duration_ms':_0x364bcb});return;}if(_0x6de020!==0x0){_0x255274({'status':_0x5bff85(_0x4b3f06._0x2a0f6,_0x4b3f06._0x52dd89,_0x4b3f06._0x2ae971,_0x4b3f06._0x270c0c),'error':'Hook\x20exited\x20with\x20code\x20'+_0x6de020+(_0xfe920[_0x3ecce5(0x67,0x86,0x70,0x92)]()?':\x20'+_0xfe920[_0x5bff85(0x3ff,0x3e6,_0x4b3f06._0x358c05,0x3f2)]():''),'duration_ms':_0x364bcb});return;}const _0x55b2c1=_0x513c65[_0x3ecce5(0x8d,_0x4b3f06._0x1d6728,_0x4b3f06._0x55ecc4,_0x4b3f06._0x21826f)]();if(_0x55b2c1[_0x3ecce5(0x82,0x77,0x94,0x7b)]===0x0){_0x255274({'status':_0x3ecce5(0x6b,_0x4b3f06._0xfb9fae,0x5d,_0x4b3f06._0x53d2e6),'duration_ms':_0x364bcb});return;}try{const _0x101f23=JSON['parse'](_0x55b2c1);_0x255274({'status':_0x5bff85(0x3e1,_0x4b3f06._0x4f7e50,0x3d0,_0x4b3f06._0xd1b117),'output':_0x101f23,'duration_ms':_0x364bcb});}catch{_0x255274({'status':'pass','duration_ms':_0x364bcb});}});function _0x1f41d3(_0x41c15a,_0x2ef2ca,_0x1704d7,_0x498369){return _0x3ee5b2(_0x41c15a-_0x582b33._0x5ebcfe,_0x498369- -0x31d,_0x1704d7-0xb5,_0x2ef2ca);}_0x2f8dab['on'](_0x1f41d3(-0x1a5,-_0x14e47d._0x5708aa,-_0x14e47d._0x225093,-_0x14e47d._0x58a38e),_0x11f8c2=>{const _0x41a1b9={_0x20463d:0xcb,_0x1cbb0d:0xd9},_0x116304={_0xd7bde:0xd,_0x1ac7e7:0x600};function _0x4e928e(_0x371580,_0x98faf3,_0x25473c,_0x5c848d){return _0x1f41d3(_0x371580-0xe1,_0x25473c,_0x25473c-_0x116304._0xd7bde,_0x5c848d-_0x116304._0x1ac7e7);}function _0x156080(_0x5f12d4,_0x57292c,_0x25912d,_0x12afc7){return _0x1f41d3(_0x5f12d4-0x177,_0x57292c,_0x25912d-_0x41a1b9._0x20463d,_0x12afc7-_0x41a1b9._0x1cbb0d);}clearTimeout(_0x50f49a),_0x255274({'status':_0x156080(-_0x313665._0x413e3a,-_0x313665._0x1ccc3b,-0xb5,-_0x313665._0xe88ec9),'error':_0x11f8c2[_0x156080(-0x9a,-0xcd,-0xb2,-_0x313665._0x50962b)],'duration_ms':Date[_0x156080(-0xb2,-_0x313665._0xfbb962,-0xd1,-0xcd)]()-_0x461ac7});});});}function createHookExtensions(_0x4e10d9,_0x3acb50,_0x5b66a2={}){const _0x4111b3={_0x1ae384:0x4b1,_0x88e7e0:0xcb,_0x14caf8:0xd4,_0x54f481:0xc1,_0xbcd343:0xaf,_0x4b14ff:0x9d,_0x77d15:0xb9,_0x12278e:0x84,_0x145792:0xa9,_0x5704cc:0xb5,_0xfc7546:0x4c3,_0xc711bc:0x4aa},_0x127ce9={_0x214869:0x254,_0x429d75:0x24d,_0x51f93e:0x256,_0x12f2a7:0x248,_0x3fdb38:0x1f2,_0x41a8dc:0x203,_0x5ac661:0x252,_0x29fc54:0x231,_0xed5364:0x236,_0xb2b8d9:0x237,_0x1f2771:0x231,_0x4acbc7:0x23f},_0x554361={_0x13a04f:0x2a8,_0x41cfa0:0x2a7,_0x15b173:0x2b5,_0x4dad17:0x2b6,_0x502e99:0x2c7,_0x11a722:0x25d,_0x1957b1:0x253,_0xcf0b72:0x24c,_0x286b73:0x261,_0x17c464:0x25b},_0x4f7f3a={_0x584cb0:0x227,_0x5e4d38:0x22c,_0x3b3645:0x1df,_0x68a068:0x1c9,_0x49a7e3:0x251,_0x3b9f42:0x220,_0x1bd719:0x244,_0x4e6d0d:0x1ed},_0x1e6ca6={_0xc9807:0x2a2},_0xf159d9=[],{sessionId:_0x30f1da,projectDir:_0x597533}=_0x5b66a2,_0x512c27=_0x339e31=>_0x4e10d9[_0x38be7e(-0xd1,-0xb8,-0x9c,-0xa7)]?_0x4e10d9['hasHooks'](_0x339e31):_0x4e10d9['getHooks'](_0x339e31)[_0x439220(0x4ce,0x4b5,0x4ad,0x4a3)]>0x0;_0x512c27(_0x439220(0x4ce,_0x4111b3._0x1ae384,0x49a,0x49b))&&_0xf159d9['push']({'id':_0x38be7e(-_0x4111b3._0x88e7e0,-_0x4111b3._0x14caf8,-0xcf,-0xd3),'stage':'afterToolResult','kind':_0x38be7e(-0xc5,-0xbb,-_0x4111b3._0x54f481,-0xcb),'order':0x0,'enabled':!![],'run':async(_0x4be79a,_0x169e72)=>{function _0x243963(_0x34045c,_0x10f027,_0x4440cd,_0x19aa03){return _0x38be7e(_0x34045c-0x12f,_0x19aa03-_0x1e6ca6._0xc9807,_0x34045c,_0x19aa03-0x137);}function _0x2c00b8(_0x215fff,_0x37cf56,_0x314654,_0x2b4a29){return _0x439220(_0x314654,_0x2b4a29- -0x6e2,_0x314654-0x16c,_0x2b4a29-0x119);}const _0x346169=_0x4e10d9['getHooks']('PostToolUse',_0x4be79a[_0x2c00b8(-0x242,-0x222,-_0x4f7f3a._0x584cb0,-_0x4f7f3a._0x5e4d38)]);for(const _0x46f130 of _0x346169){const _0x45248a={'tool_name':_0x4be79a['toolName'],'tool_input':void 0x0,'tool_output':_0x4be79a['output'],'tool_result_status':_0x4be79a[_0x243963(0x1be,0x1cb,_0x4f7f3a._0x3b3645,_0x4f7f3a._0x68a068)],'session_id':_0x30f1da??_0x169e72[_0x2c00b8(-_0x4f7f3a._0x49a7e3,-_0x4f7f3a._0x3b9f42,-_0x4f7f3a._0x1bd719,-0x235)]['sessionId']};await _0x3acb50(_0x46f130[_0x243963(0x1e9,0x1d2,_0x4f7f3a._0x4e6d0d,0x1ed)],_0x45248a,_0x46f130['timeout'],_0x597533);}}});function _0x439220(_0x252c0e,_0x55efca,_0x16bc20,_0x98cf4e){return _0x1531(_0x55efca-0x313,_0x252c0e);}_0x512c27(_0x38be7e(-_0x4111b3._0xbcd343,-_0x4111b3._0x4b14ff,-_0x4111b3._0x77d15,-_0x4111b3._0x12278e))&&_0xf159d9['push']({'id':'hook:Stop','stage':'beforeFinalOutput','kind':'observer','order':0x0,'enabled':!![],'run':async(_0x41f67c,_0x39e5ea)=>{const _0x1c09f5={_0x43fb05:0x26d,_0x48ef39:0x1c8};function _0x2b7850(_0x40093a,_0x5b6e7c,_0x45a153,_0x15ac87){return _0x439220(_0x15ac87,_0x40093a- -_0x1c09f5._0x43fb05,_0x45a153-_0x1c09f5._0x48ef39,_0x15ac87-0x1df);}const _0x354689=_0x4e10d9[_0x5b0e3b(_0x554361._0x13a04f,0x2b6,_0x554361._0x41cfa0,0x2bb)]('Stop');function _0x5b0e3b(_0x487b04,_0x4c6a47,_0x3b691e,_0x1b6ff1){return _0x439220(_0x4c6a47,_0x487b04- -0x1f4,_0x3b691e-0xf2,_0x1b6ff1-0x46);}for(const _0x59ac10 of _0x354689){const _0x1ed037={'stop_reason':_0x5b0e3b(_0x554361._0x15b173,0x2cd,_0x554361._0x4dad17,_0x554361._0x502e99),'session_id':_0x30f1da??_0x39e5ea[_0x2b7850(0x240,_0x554361._0x11a722,_0x554361._0x1957b1,0x226)][_0x2b7850(_0x554361._0xcf0b72,0x24f,_0x554361._0x286b73,_0x554361._0x17c464)]};await _0x3acb50(_0x59ac10[_0x5b0e3b(0x2cd,0x2e7,0x2ad,0x2d9)],_0x1ed037,_0x59ac10['timeout'],_0x597533);}}});_0x512c27(_0x38be7e(-0xb4,-_0x4111b3._0x145792,-_0x4111b3._0x5704cc,-0x8d))&&_0xf159d9[_0x439220(_0x4111b3._0xfc7546,0x4a7,0x4ab,_0x4111b3._0xc711bc)]({'id':'hook:Notification','stage':'afterTurnComplete','kind':'observer','order':0x0,'enabled':!![],'run':async(_0x372855,_0x3107c4)=>{const _0x3e0ad3={_0x2b4344:0x30},_0x45104f=_0x4e10d9['getHooks'](_0x3e6336(-0x22b,-0x242,-0x212,-0x24a));function _0x23b4d6(_0x4a5d5d,_0x3bdc35,_0x51b512,_0x161009){return _0x439220(_0x161009,_0x51b512- -0x2c7,_0x51b512-0x1ba,_0x161009-0xe4);}function _0x3e6336(_0x33f02e,_0x55917d,_0x56ac9e,_0x2a1e68){return _0x38be7e(_0x33f02e-_0x3e0ad3._0x2b4344,_0x33f02e- -0x182,_0x2a1e68,_0x2a1e68-0xad);}for(const _0x513ad8 of _0x45104f){const _0x3a9de7={'message':_0x3e6336(-_0x127ce9._0x214869,-_0x127ce9._0x429d75,-_0x127ce9._0x51f93e,-_0x127ce9._0x12f2a7),'session_id':_0x30f1da??_0x372855[_0x23b4d6(0x1fd,0x1e4,_0x127ce9._0x3fdb38,_0x127ce9._0x41a8dc)]};await _0x3acb50(_0x513ad8[_0x3e6336(-0x237,-_0x127ce9._0x5ac661,-_0x127ce9._0x29fc54,-0x23f)],_0x3a9de7,_0x513ad8[_0x3e6336(-_0x127ce9._0xed5364,-_0x127ce9._0xb2b8d9,-_0x127ce9._0x1f2771,-_0x127ce9._0x4acbc7)],_0x597533);}}});function _0x38be7e(_0x504c96,_0xf3d931,_0x4b1cbf,_0x307e8e){return _0x1531(_0xf3d931- -0x263,_0x4b1cbf);}return _0xf159d9;}function createHookOnToolCallMiddleware(_0x44706d,_0x5265cd,_0xee1570,_0x23b4dd={}){const _0x6c2962={_0x540ece:0x31b,_0x32bb3b:0x312,_0x244d1c:0x257,_0x98901a:0x21b,_0x5af483:0x313,_0x13e010:0x207,_0x19aa62:0x22d,_0x3cb680:0x23b,_0x2e05bc:0x2ec,_0x4dd29b:0x210,_0x335d16:0x1f8,_0x4bb590:0x22f,_0x98be1d:0x22e,_0x6bb0ad:0x215,_0x3e55cf:0x2fe,_0x62fcb4:0x2ff,_0xf33e29:0x2f8,_0x19b3aa:0x223,_0x1f8034:0x21e,_0x13718c:0x20c,_0x544d7c:0x230,_0x1386f6:0x2ef,_0x10e4b8:0x209,_0x8ee971:0x224,_0x2f7409:0x31f,_0x3ed240:0x303,_0x43a0c8:0x2e6},_0x28d079={_0x3998de:0x163},{sessionId:_0x4dc17a,projectDir:_0x512cf4}=_0x23b4dd;return async(_0x993348,_0x330847)=>{const _0x3facb6={_0x24f974:0x79};function _0x380905(_0x49b4a3,_0x415464,_0x2a0e8a,_0x42744f){return _0x1531(_0x415464-_0x28d079._0x3998de,_0x42744f);}const _0x46ad7c=_0x44706d['getHooks'](_0x380905(0x337,_0x6c2962._0x540ece,0x336,_0x6c2962._0x32bb3b),_0x993348['name']);function _0x42e6a(_0x5a06c0,_0x304b5c,_0x3778fa,_0x34ed3b){return _0x1531(_0x5a06c0-_0x3facb6._0x24f974,_0x3778fa);}for(const _0x1f5700 of _0x46ad7c){const _0x945e7c={'tool_name':_0x993348['name'],'tool_input':_0x993348[_0x42e6a(0x237,_0x6c2962._0x244d1c,0x256,_0x6c2962._0x98901a)],'session_id':_0x4dc17a},_0x19be5c=await _0x5265cd(_0x1f5700['command'],_0x945e7c,_0x1f5700[_0x380905(0x32e,0x312,_0x6c2962._0x5af483,0x312)],_0x512cf4),_0x392203=_0x19be5c['output']?.[_0x42e6a(0x210,0x1f8,_0x6c2962._0x13e010,0x1f0)]?.[_0x42e6a(_0x6c2962._0x19aa62,0x221,_0x6c2962._0x3cb680,0x21f)];if(_0x392203==='allow')return{'action':_0x380905(0x320,0x318,0x322,0x313)};if(_0x392203==='deny')return{'action':_0x380905(0x303,0x2f3,0x2ee,_0x6c2962._0x2e05bc),'reason':_0x19be5c['output']?.[_0x42e6a(_0x6c2962._0x4dd29b,_0x6c2962._0x335d16,_0x6c2962._0x4bb590,0x202)]?.[_0x42e6a(0x226,0x245,_0x6c2962._0x98be1d,_0x6c2962._0x6bb0ad)]||_0x380905(0x314,_0x6c2962._0x3e55cf,0x2e3,0x2f6)+_0x993348[_0x380905(0x301,_0x6c2962._0x62fcb4,0x2ee,_0x6c2962._0xf33e29)]};if(_0x19be5c[_0x42e6a(0x203,_0x6c2962._0x19b3aa,_0x6c2962._0x1f8034,_0x6c2962._0x13718c)]==='block'||_0x19be5c[_0x42e6a(_0x6c2962._0x544d7c,0x240,0x215,_0x6c2962._0x6bb0ad)]?.[_0x380905(_0x6c2962._0x2e05bc,_0x6c2962._0x1386f6,0x2d6,0x30c)]==='block')return{'action':_0x42e6a(_0x6c2962._0x10e4b8,0x228,0x217,_0x6c2962._0x8ee971),'reason':_0x19be5c['output']?.['reason']||_0x380905(_0x6c2962._0x2f7409,_0x6c2962._0x3ed240,0x31a,_0x6c2962._0x3e55cf)+_0x993348[_0x380905(_0x6c2962._0x43a0c8,0x2ff,0x302,0x2f7)]};}return _0xee1570(_0x993348,_0x330847);};}function _0x2034(){const _0x2be18b=['B3v0Chv0','uhjLvg9VBfvZzq','nJu2mti4ofzWEKftAa','tM90AwzPy2f0Aw9U','A2LSBa','CgLWzq','sg9VAYb0Aw1LzcbVDxqGywz0zxiG','Aw5WDxq','oda4nZeZCgHwwezr','nKrLvNPbzG','D3jPDgu','nJi2nJu1mM1ICwXdEG','zw52','sg9VAYbIBg9JA2vKigv4zwn1DgLVBG','y29Kzq','u3rVCa','C3rKzxjY','Dg9tDhjPBMC','z2v0sg9VA3m','C3rHDhvZ','y3DK','zgvJAxnPB24','mtmZodqYm3fKrwH2sW','Ag9VA3m','Ag9VAZPqB3n0vg9VBfvZzq','CMvQzwn0','qwDLBNqGzMLUAxnOzwqGCMvZCg9UzgLUzW','mtKWu3zKDLbZ','CgfZCW','ChvZAa','C3rYAw5NAwz5','zw5Kx3r1CM4','Ag9VA1nWzwnPzMLJt3v0Chv0','BM93','DgvZDa','C3rHDgu','ugvYBwLZC2LVBIbKzw5PzwqGzM9Yia','BMfTzq','otzmAerzv3e','ug9ZDfrVB2XvC2u','zgf0yq','qMXVy2TLzcbIEsbqCMvuB29SvxnLigHVB2SGzM9Yia','BwfW','BgvUz3rO','Dg9VBe5HBwu','yMXVy2S','zxjYB3i','C2vZC2LVBKLK','mtK1nJy3qNvtsLvj','B2jZzxj2zxi','y2XVC2u','xIG/oG','AgfZsg9VA3m','C3rKAw4','CgvYBwLZC2LVBKrLy2LZAw9UuMvHC29U','y29TBwfUza','DgLTzw91Da','BwvZC2fNzq','DhjPBq','mJq1mZi5n0XeDvzJvq','Bwf0y2HLCG','CgvYBwLZC2LVBKrLy2LZAw9U','CNvU','otyZnZbjA3LvEwS'];_0x2034=function(){return _0x2be18b;};return _0x2034();}var DEFAULT_TIMEOUT_S2=0x3c;function createHookRegistry(_0x1b8e12){const _0x2459cd={_0x4b8d50:0x16d,_0x308aeb:0x170,_0x30b89b:0x567,_0xd2c11:0x553,_0x277872:0x582,_0x1cca8a:0x561,_0x3d36ae:0x570,_0x2b58f6:0x562,_0xbf7f4:0x567,_0x347285:0x580,_0x7d99d1:0x58d,_0x56c031:0x16f,_0x43ae8e:0x153,_0x186df1:0x15b,_0x5d39bf:0x167,_0x1e5f90:0x157,_0x43b6cb:0x182,_0x150066:0x163,_0x3d76d0:0x15e,_0x30846c:0x181,_0x1de789:0x193},_0x35eec3={_0x4df1a0:0x563,_0x1bc506:0x559,_0x5c0e47:0x54f},_0x1cf4d8={_0xce6fb2:0x3c9};return{'hasHooks'(_0x2367b8){function _0x545b59(_0x5a8c69,_0x433b7c,_0xaa4ba4,_0x10260b){return _0x1531(_0x5a8c69-_0x1cf4d8._0xce6fb2,_0x433b7c);}return(_0x1b8e12[_0x2367b8]?.[_0x545b59(0x56b,_0x35eec3._0x4df1a0,_0x35eec3._0x1bc506,_0x35eec3._0x5c0e47)]??0x0)>0x0;},'getHooks'(_0x1010ba,_0x4ec4ac){const _0x514e25={_0x310cb4:0x2a},_0x42f18b=_0x1b8e12[_0x1010ba];if(!_0x42f18b)return[];function _0x38501b(_0x3f3100,_0x26190d,_0x58eec0,_0x1337b0){return _0x1531(_0x3f3100-0x3c6,_0x58eec0);}function _0x1a59ba(_0xfe930f,_0x3e6048,_0x199cb1,_0x57d432){return _0x1531(_0xfe930f- -_0x514e25._0x310cb4,_0x3e6048);}const _0x3630b9=[];for(const _0x6c9b94 of _0x42f18b){if(!_0x6c9b94['matcher']||_0x6c9b94[_0x1a59ba(0x189,0x185,0x194,_0x2459cd._0x4b8d50)]==='*'){_0x3630b9[_0x1a59ba(0x16a,0x166,0x177,0x16d)](..._0x6c9b94[_0x1a59ba(0x164,0x171,0x15b,_0x2459cd._0x308aeb)][_0x38501b(_0x2459cd._0x30b89b,_0x2459cd._0xd2c11,_0x2459cd._0x277872,_0x2459cd._0x1cca8a)](_0x542a3e=>({'command':_0x542a3e[_0x1a59ba(0x184,0x19c,0x19c,0x196)],'timeout':_0x542a3e[_0x1a59ba(0x185,0x17a,0x16f,0x19e)]??DEFAULT_TIMEOUT_S2})));continue;}if(_0x4ec4ac===void 0x0)continue;const _0x243581=new RegExp(_0x38501b(_0x2459cd._0x3d36ae,0x562,0x574,_0x2459cd._0x2b58f6)+_0x6c9b94[_0x38501b(0x579,_0x2459cd._0xbf7f4,_0x2459cd._0x347285,_0x2459cd._0x7d99d1)]+')$');_0x243581[_0x1a59ba(_0x2459cd._0x56c031,_0x2459cd._0x43ae8e,_0x2459cd._0x186df1,_0x2459cd._0x5d39bf)](_0x4ec4ac)&&_0x3630b9[_0x1a59ba(0x16a,0x188,_0x2459cd._0x1e5f90,_0x2459cd._0x43b6cb)](..._0x6c9b94[_0x1a59ba(0x164,_0x2459cd._0x150066,_0x2459cd._0x3d76d0,_0x2459cd._0x308aeb)][_0x1a59ba(0x177,_0x2459cd._0x30846c,_0x2459cd._0x308aeb,_0x2459cd._0x1de789)](_0x4429f8=>({'command':_0x4429f8[_0x1a59ba(0x184,0x192,0x188,0x193)],'timeout':_0x4429f8['timeout']??DEFAULT_TIMEOUT_S2})));}return _0x3630b9;}};}export{createHookExtensions,createHookOnToolCallMiddleware,createHookRegistry,executeCommandHook};
@@ -1,6 +1,6 @@
1
- import { P as ProviderSessionResolver, r as ResolvedProviderSession, s as ProviderRequestMutator, l as ModelRequest, t as PreparedRequest, C as ChatRequest, u as ProviderCredential, E as EngineChatModel, v as ReasoningConfig, w as ChatResponseChunk, n as ChatResponse, x as ModelExecutionOptions, B as BaseChatModelOptions, y as ModelInfo, z as ModelLimits } from '../types-DQXrm4dp.js';
2
- export { D as ProviderCredentialKind, F as ProviderEndpoints } from '../types-DQXrm4dp.js';
3
- import { t as toOpenAiResponsesRequest } from '../provider-adapters-BZo_Yh3I.js';
1
+ import { P as ProviderSessionResolver, r as ResolvedProviderSession, s as ProviderRequestMutator, l as ModelRequest, t as PreparedRequest, C as ChatRequest, u as ProviderCredential, E as EngineChatModel, v as ReasoningConfig, w as ChatResponseChunk, n as ChatResponse, x as ModelExecutionOptions, B as BaseChatModelOptions, y as ModelInfo, z as ModelLimits } from '../types-CSXSwpwn.js';
2
+ export { D as ProviderCredentialKind, F as ProviderEndpoints } from '../types-CSXSwpwn.js';
3
+ import { t as toOpenAiResponsesRequest } from '../provider-adapters-CVC34mwR.js';
4
4
 
5
5
  interface PrepareProviderRequestOptions {
6
6
  sessionManager?: ProviderSessionManager;