@nuvin/agent-core 0.2.0-rc.4 → 0.2.0-rc.6

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,5 @@
1
+ export interface AbortAwareSemaphore {
2
+ acquire(signal?: AbortSignal): Promise<() => void>;
3
+ }
4
+ export declare function createAbortAwareSemaphore(maxConcurrency: number): AbortAwareSemaphore;
5
+ //# sourceMappingURL=abort-aware-semaphore.d.ts.map
@@ -1,4 +1,5 @@
1
1
  export * from "./abort.ts";
2
+ export * from "./abort-aware-semaphore.ts";
2
3
  export * from "./model-identity.ts";
3
4
  export * from "./reasoning-config.ts";
4
5
  export * from "./turn-failed.ts";
@@ -1 +1 @@
1
- (function(_0x5decff,_0x3c2c65){var _0x456f32={_0x42f1f7:0x27c,_0x126e93:0x277,_0x368610:0x276,_0xe76eb8:0x244,_0x74400e:0x245,_0x14c5e3:0x273,_0x13ad44:0x248,_0x525a5c:0x250,_0x11e31e:0x24a,_0x216957:0x276,_0x51acd3:0x27c,_0x322857:0x275,_0x4d6895:0x27b,_0x410316:0x274,_0x208522:0x24c,_0x1bcaf8:0x24d,_0x14786d:0x249,_0x3939e7:0x246},_0x3140d5={_0xfe6fcd:0x374};function _0x8cbafb(_0x3e2fb7,_0x2c8786,_0x4a7e95,_0x11c6a1){return _0x491b(_0x11c6a1-0x14a,_0x4a7e95);}var _0x12381e=_0x5decff();function _0xc870c6(_0x26c597,_0x1342d0,_0x39868f,_0x44c244){return _0x491b(_0x1342d0- -_0x3140d5._0xfe6fcd,_0x44c244);}while(!![]){try{var _0x5299ac=-parseInt(_0xc870c6(-_0x456f32._0x42f1f7,-_0x456f32._0x126e93,-_0x456f32._0x368610,-0x272))/0x1*(parseInt(_0x8cbafb(_0x456f32._0xe76eb8,0x245,0x249,_0x456f32._0x74400e))/0x2)+-parseInt(_0xc870c6(-0x270,-_0x456f32._0x14c5e3,-0x276,-0x276))/0x3+parseInt(_0x8cbafb(_0x456f32._0x13ad44,_0x456f32._0x525a5c,_0x456f32._0x11e31e,_0x456f32._0x11e31e))/0x4*(parseInt(_0xc870c6(-0x26d,-0x272,-_0x456f32._0x216957,-0x271))/0x5)+-parseInt(_0xc870c6(-_0x456f32._0x51acd3,-0x27a,-_0x456f32._0x322857,-0x27b))/0x6*(parseInt(_0xc870c6(-0x27b,-0x27c,-0x27a,-0x278))/0x7)+-parseInt(_0x8cbafb(0x23f,0x246,0x248,0x243))/0x8*(parseInt(_0xc870c6(-_0x456f32._0x4d6895,-_0x456f32._0x216957,-0x27a,-_0x456f32._0x410316))/0x9)+parseInt(_0x8cbafb(_0x456f32._0x208522,_0x456f32._0x1bcaf8,0x245,_0x456f32._0x14786d))/0xa+parseInt(_0x8cbafb(_0x456f32._0x3939e7,_0x456f32._0x11e31e,0x243,_0x456f32._0x3939e7))/0xb;if(_0x5299ac===_0x3c2c65)break;else _0x12381e['push'](_0x12381e['shift']());}catch(_0x159437){_0x12381e['push'](_0x12381e['shift']());}}}(_0x3405,0x8db6d));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';function _0x491b(_0x341534,_0x5a81be){_0x341534=_0x341534-0xf8;var _0x340527=_0x3405();var _0x491bd9=_0x340527[_0x341534];if(_0x491b['RlwUjy']===undefined){var _0x2e4e10=function(_0x4a94a4){var _0x498c35='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x32ea79='',_0x2b8e1b='';for(var _0x283b30=0x0,_0x439ee3,_0x1873ba,_0x29be11=0x0;_0x1873ba=_0x4a94a4['charAt'](_0x29be11++);~_0x1873ba&&(_0x439ee3=_0x283b30%0x4?_0x439ee3*0x40+_0x1873ba:_0x1873ba,_0x283b30++%0x4)?_0x32ea79+=String['fromCharCode'](0xff&_0x439ee3>>(-0x2*_0x283b30&0x6)):0x0){_0x1873ba=_0x498c35['indexOf'](_0x1873ba);}for(var _0x3a3de9=0x0,_0x32f36e=_0x32ea79['length'];_0x3a3de9<_0x32f36e;_0x3a3de9++){_0x2b8e1b+='%'+('00'+_0x32ea79['charCodeAt'](_0x3a3de9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2b8e1b);};_0x491b['ebrCTv']=_0x2e4e10,_0x491b['YhpFIX']={},_0x491b['RlwUjy']=!![];}var _0x524e7f=_0x340527[0x0],_0x4994aa=_0x341534+_0x524e7f,_0x14eff7=_0x491b['YhpFIX'][_0x4994aa];return!_0x14eff7?(_0x491bd9=_0x491b['ebrCTv'](_0x491bd9),_0x491b['YhpFIX'][_0x4994aa]=_0x491bd9):_0x491bd9=_0x14eff7,_0x491bd9;}function _0x3405(){var _0x253c5f=['mJu2otyXmhLTEez2Bq','ngPjBgrlqW','ntq0nZi1turfwun3','mJqYnJyXnw1ht0nxEG','mZK2mdq0nNrND2XRsG','mte1odiYneznu0zSrq','nNDlsfbREG','mta1otrLs3L2DMW','ote0mdq2muvsrMDOAq','mtLRz1P5uKK','ovHPzenqzG'];_0x3405=function(){return _0x253c5f;};return _0x3405();}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
1
+ (function(_0x317438,_0x1b25ac){const _0x5b9c0e={_0x37eff3:0x385,_0x3e566f:0x380,_0x9001cf:0x37b,_0xb7e884:0x391,_0x2aef8a:0x38b,_0x5bc8ad:0x2d2,_0x1fe05f:0x2de,_0xdbcdb:0x2e5,_0x67107f:0x2db,_0x25daf5:0x2de,_0x17cbc1:0x2d3,_0x53524d:0x2d7,_0x36d99e:0x2c5,_0x347675:0x389,_0x4f5f80:0x371,_0x4611ba:0x2e0},_0x3a72b9={_0x58da5f:0x2f0};function _0x2eed58(_0x54702f,_0x5f5697,_0x61da23,_0x39411f){return _0xeee3(_0x5f5697-_0x3a72b9._0x58da5f,_0x39411f);}function _0x5c1ccb(_0xe046e8,_0x5e1c57,_0x305515,_0x2d7341){return _0xeee3(_0x2d7341- -0x36c,_0x5e1c57);}const _0x3139e6=_0x317438();while(!![]){try{const _0x33589e=parseInt(_0x2eed58(_0x5b9c0e._0x37eff3,0x37d,_0x5b9c0e._0x3e566f,_0x5b9c0e._0x9001cf))/0x1*(parseInt(_0x2eed58(_0x5b9c0e._0xb7e884,_0x5b9c0e._0x2aef8a,_0x5b9c0e._0x2aef8a,0x393))/0x2)+parseInt(_0x5c1ccb(-0x2db,-_0x5b9c0e._0x5bc8ad,-_0x5b9c0e._0x1fe05f,-0x2d6))/0x3+parseInt(_0x5c1ccb(-0x2da,-_0x5b9c0e._0xdbcdb,-0x2de,-_0x5b9c0e._0x67107f))/0x4+parseInt(_0x5c1ccb(-_0x5b9c0e._0x5bc8ad,-_0x5b9c0e._0x5bc8ad,-_0x5b9c0e._0x25daf5,-0x2d8))/0x5+parseInt(_0x5c1ccb(-0x2e1,-_0x5b9c0e._0x1fe05f,-_0x5b9c0e._0x17cbc1,-_0x5b9c0e._0x53524d))/0x6*(-parseInt(_0x5c1ccb(-_0x5b9c0e._0x5bc8ad,-_0x5b9c0e._0x36d99e,-0x2d5,-0x2cf))/0x7)+parseInt(_0x2eed58(0x379,0x383,0x38a,_0x5b9c0e._0x347675))/0x8*(parseInt(_0x2eed58(0x380,0x37a,_0x5b9c0e._0x4f5f80,0x380))/0x9)+-parseInt(_0x5c1ccb(-0x2eb,-0x2e5,-0x2e0,-_0x5b9c0e._0x4611ba))/0xa;if(_0x33589e===_0x1b25ac)break;else _0x3139e6['push'](_0x3139e6['shift']());}catch(_0xcbbf65){_0x3139e6['push'](_0x3139e6['shift']());}}}(_0x2f97,0xd96a1));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';function _0xeee3(_0x259eab,_0x33531b){_0x259eab=_0x259eab-0x88;const _0x2f97ac=_0x2f97();let _0xeee3bb=_0x2f97ac[_0x259eab];if(_0xeee3['CAvcji']===undefined){var _0x2b98d6=function(_0x32a33b){const _0x9a9871='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x13dd01='',_0x186adb='';for(let _0xc04370=0x0,_0x252330,_0x68f2ec,_0x5d1cb3=0x0;_0x68f2ec=_0x32a33b['charAt'](_0x5d1cb3++);~_0x68f2ec&&(_0x252330=_0xc04370%0x4?_0x252330*0x40+_0x68f2ec:_0x68f2ec,_0xc04370++%0x4)?_0x13dd01+=String['fromCharCode'](0xff&_0x252330>>(-0x2*_0xc04370&0x6)):0x0){_0x68f2ec=_0x9a9871['indexOf'](_0x68f2ec);}for(let _0x530fb3=0x0,_0x4103c1=_0x13dd01['length'];_0x530fb3<_0x4103c1;_0x530fb3++){_0x186adb+='%'+('00'+_0x13dd01['charCodeAt'](_0x530fb3)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x186adb);};_0xeee3['fNgpBw']=_0x2b98d6,_0xeee3['nzpYcT']={},_0xeee3['CAvcji']=!![];}const _0x3a3070=_0x2f97ac[0x0],_0x3885fc=_0x259eab+_0x3a3070,_0x5e7798=_0xeee3['nzpYcT'][_0x3885fc];return!_0x5e7798?(_0xeee3bb=_0xeee3['fNgpBw'](_0xeee3bb),_0xeee3['nzpYcT'][_0x3885fc]=_0xeee3bb):_0xeee3bb=_0x5e7798,_0xeee3bb;}function _0x2f97(){const _0x415384=['mZu0ndm4otbeDMP3u24','nZu0otaYEfrtDuPv','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','ywjVCNrLza','CMvTB3zLqwjVCNrmAxn0zw5LCG','mZe0nZKYng5Rtg5ezG','AxngAw5PDgu','mti5ndi1mJHXuNPzvKi','ndK4mdmXmhzgyMT3wa','nZHqAvnqvfq','nduWmdm5meDOrNbXtG','BgvUz3rO','C2HPzNq','Aw5KzxHpzG','CMvHC29U','mNHJs0nVuG','CMvZB2X2zq','nJu3ndq3D3v2q0ny','CMvQzwn0','y2fUy2vSBgvK','oxvdBvf4vq','ChvZAa'];_0x2f97=function(){return _0x415384;};return _0x2f97();}import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x13dd01){const _0x1aaac0={_0x22aba1:0x40,_0x385124:0x44},_0xa73bd1={_0x54d55f:0x406,_0x357f30:0x3fb,_0x16e19d:0x3f3,_0x1e4898:0x3f8,_0x176f87:0x3f4,_0x3c46b3:0x405,_0x37ff4e:0x402,_0x47096d:0x408,_0x506dfa:0x40b},_0x3fbba0={_0x1affc8:0x13,_0x5e8f89:0x3f},_0x57825f={_0x3f0d79:0x243,_0x955a8:0x237,_0x19de1b:0x23a,_0x4594c7:0x24a,_0x58258a:0x281,_0x3333cf:0x24b,_0x36e339:0x248,_0x4b7acd:0x265,_0x5d4c0a:0x258,_0xe297b6:0x26a},_0x8ccb26={_0x313f28:0x28a,_0x7d7a6f:0x1ea,_0x176126:0x17c};if(!Number[_0xe50f89(-0xa0,-0xa8,-0xb6,-0xab)](_0x13dd01)||!Number['isInteger'](_0x13dd01)||_0x13dd01<=0x0)throw new Error(_0x52d1e4(0x41,_0x1aaac0._0x22aba1,0x3d,_0x1aaac0._0x385124));let _0x186adb=0x0;const _0xc04370=[];function _0x52d1e4(_0x39eabe,_0x285353,_0xb06cf5,_0x390e30){return _0xeee3(_0x39eabe- -0x4d,_0x285353);}const _0x252330=()=>{let _0x5d1cb3=![];return()=>{if(_0x5d1cb3)return;_0x5d1cb3=!![],_0x186adb-=0x1,_0x68f2ec();};};function _0xe50f89(_0x403ef9,_0x536d0e,_0x1c72bb,_0x141e6f){return _0xeee3(_0x141e6f- -0x13d,_0x1c72bb);}const _0x68f2ec=()=>{const _0x26e638={_0x3b24ed:0xe1};function _0x490e3e(_0x5de8ec,_0x4afb09,_0x40ac32,_0x1e2849){return _0x52d1e4(_0x5de8ec- -0x2b2,_0x4afb09,_0x40ac32-0x12,_0x1e2849-_0x26e638._0x3b24ed);}function _0x5572dc(_0x4408d7,_0x24f1b9,_0x51297f,_0x1c63e2){return _0x52d1e4(_0x51297f- -_0x8ccb26._0x313f28,_0x24f1b9,_0x51297f-_0x8ccb26._0x7d7a6f,_0x1c63e2-_0x8ccb26._0x176126);}while(_0xc04370[_0x5572dc(-0x246,-0x23b,-0x240,-_0x57825f._0x3f0d79)]>0x0){const _0x530fb3=_0xc04370[_0x5572dc(-_0x57825f._0x955a8,-_0x57825f._0x19de1b,-0x23f,-_0x57825f._0x4594c7)]();if(!_0x530fb3||_0x530fb3[_0x490e3e(-0x276,-0x279,-0x274,-_0x57825f._0x58258a)])continue;_0x530fb3[_0x5572dc(-_0x57825f._0x3333cf,-_0x57825f._0x36e339,-0x24e,-0x24b)]=!![],_0x530fb3['removeAbortListener'](),_0x186adb+=0x1,_0x530fb3[_0x490e3e(-0x263,-_0x57825f._0x4b7acd,-_0x57825f._0x5d4c0a,-_0x57825f._0xe297b6)](_0x252330());return;}};return{'acquire'(_0x4103c1){const _0x2ba079={_0x414035:0x9,_0x377e6a:0xe,_0x47cf1c:0x369,_0x540ec0:0x371,_0x5d6c16:0x372},_0x314512={_0x196988:0x3de,_0x368abf:0x3e6,_0x798173:0x127,_0x138aba:0x132,_0x218e6c:0x12a,_0x59dab9:0x3db,_0x6b5a5b:0x3ef,_0x1b1fb3:0x142,_0x14db60:0x143,_0x53a473:0x13a,_0x5ab508:0x3dd,_0x558ab5:0x3d5},_0x49edf0={_0x703fff:0x1dd,_0x5da6f6:0x3e9,_0x5af775:0x1a2};function _0xbbe509(_0xb51364,_0x7c4f53,_0x498fdc,_0x22bc2e){return _0xe50f89(_0xb51364-_0x3fbba0._0x1affc8,_0x7c4f53-_0x3fbba0._0x5e8f89,_0xb51364,_0x498fdc-0x4a9);}function _0x31925b(_0x2e3d09,_0x25f79f,_0x2383ed,_0x203b1f){return _0xe50f89(_0x2e3d09-0x176,_0x25f79f-0x14d,_0x203b1f,_0x2383ed- -0x14d);}if(_0x4103c1?.[_0xbbe509(0x3fe,_0xa73bd1._0x54d55f,_0xa73bd1._0x357f30,0x3f4)])return Promise[_0xbbe509(_0xa73bd1._0x16e19d,_0xa73bd1._0x1e4898,_0xa73bd1._0x176f87,0x3fe)](toAbortError(_0x4103c1['reason']));if(_0x186adb<_0x13dd01)return _0x186adb+=0x1,Promise[_0xbbe509(_0xa73bd1._0x3c46b3,_0xa73bd1._0x37ff4e,_0xa73bd1._0x47096d,_0xa73bd1._0x506dfa)](_0x252330());return new Promise((_0x4a8981,_0x2f1c1a)=>{const _0x27f7f2={_0x22e902:0x1dd,_0x48e9b8:0x74},_0x192103={_0x4ce8ac:0xe3},_0x4022f2={_0x2ae436:0x18a};function _0x2b219c(_0x442936,_0x395f82,_0x363291,_0x10435d){return _0x31925b(_0x442936-_0x4022f2._0x2ae436,_0x395f82-0xca,_0x363291-0x56b,_0x10435d);}function _0x3d3195(_0x15b794,_0x500e44,_0x5996f4,_0x5c184c){return _0xbbe509(_0x500e44,_0x500e44-_0x49edf0._0x703fff,_0x5c184c- -_0x49edf0._0x5da6f6,_0x5c184c-_0x49edf0._0x5af775);}const _0x4548be={'resolve':_0x4a8981,'reject':_0x2f1c1a,'cancelled':![],'removeAbortListener':()=>{}};_0xc04370[_0x3d3195(0x19,_0x2ba079._0x414035,0x15,_0x2ba079._0x377e6a)](_0x4548be),_0x4548be[_0x2b219c(_0x2ba079._0x47cf1c,0x366,_0x2ba079._0x540ec0,_0x2ba079._0x5d6c16)]=addAbortListener(_0x4103c1,()=>{if(_0x4548be[_0x210c2d(_0x314512._0x196988,0x3e8,0x3d7,_0x314512._0x368abf)])return;_0x4548be[_0x29acac(_0x314512._0x798173,_0x314512._0x138aba,_0x314512._0x138aba,_0x314512._0x218e6c)]=!![],_0x4548be[_0x210c2d(0x3e5,_0x314512._0x59dab9,_0x314512._0x6b5a5b,0x3dd)]();function _0x29acac(_0x5999a8,_0x1aeec8,_0x2340f5,_0x5a6192){return _0x3d3195(_0x5999a8-_0x192103._0x4ce8ac,_0x2340f5,_0x2340f5-0x108,_0x1aeec8-0x126);}function _0x210c2d(_0x7c667b,_0x37d899,_0x63882d,_0x10fddf){return _0x2b219c(_0x7c667b-_0x27f7f2._0x22e902,_0x37d899-0x1c8,_0x7c667b-_0x27f7f2._0x48e9b8,_0x10fddf);}const _0x32eb32=_0xc04370[_0x29acac(0x143,_0x314512._0x1b1fb3,_0x314512._0x14db60,_0x314512._0x53a473)](_0x4548be);if(_0x32eb32>=0x0)_0xc04370['splice'](_0x32eb32,0x1);_0x4548be[_0x210c2d(_0x314512._0x5ab508,0x3d9,_0x314512._0x558ab5,0x3e7)](toAbortError(_0x4103c1?.[_0x210c2d(0x3ef,0x3ee,0x3e4,0x3f4)]));});});}};}export{OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
@@ -668,10 +668,18 @@ export interface RunTurnDeps {
668
668
  }
669
669
  export type AgentInput = MessageInput | string;
670
670
  export type SteeringInputDrain = () => Promise<AgentInput[]>;
671
+ /** Immutable ownership metadata for the exact agent submission being sent. */
672
+ export type AgentSubmission = Readonly<{
673
+ origin: "user";
674
+ }> | Readonly<{
675
+ origin: "coordinator";
676
+ token: string;
677
+ }>;
671
678
  export interface AgentSendOptions {
672
679
  streaming?: boolean;
673
680
  signal?: AbortSignal;
674
681
  drainSteering?: SteeringInputDrain;
682
+ submission?: AgentSubmission;
675
683
  }
676
684
  export interface AgentOptions {
677
685
  sessionId?: string;
@@ -1,16 +1,34 @@
1
1
  import type { ChildProcess } from "node:child_process";
2
2
  import { StringDecoder } from "node:string_decoder";
3
- export type BackgroundProcessStatus = "running" | "exited" | "killed" | "error";
3
+ import { type ProcessTreeSignalAdapter } from "./process-tree-termination.ts";
4
+ import { type TerminalOutputNormalizer } from "./terminal-output-normalizer.ts";
5
+ export type BackgroundProcessStatus = "running" | "terminating" | "exited" | "killed" | "error";
6
+ export interface BackgroundProcessReservation {
7
+ readonly id: string;
8
+ }
9
+ export interface BackgroundProcessTerminationResult {
10
+ shellId: string;
11
+ outcome: "killed" | "already-terminal" | "failed";
12
+ status: BackgroundProcessStatus;
13
+ exitCode: number | null;
14
+ signal: NodeJS.Signals | null;
15
+ error: string | null;
16
+ gracefulRequested: boolean;
17
+ forceRequested: boolean;
18
+ }
4
19
  export interface BackgroundProcessEntry {
5
20
  shellId: string;
6
21
  command: string;
7
22
  cwd: string;
8
23
  pid: number | undefined;
24
+ processGroupId: number | undefined;
9
25
  status: BackgroundProcessStatus;
10
26
  exitCode: number | null;
11
27
  signal: NodeJS.Signals | null;
12
28
  startedAt: number;
13
- error?: string;
29
+ error: string | null;
30
+ gracefulRequested: boolean;
31
+ forceRequested: boolean;
14
32
  child: ChildProcess | null;
15
33
  buffer: string[];
16
34
  bufferChars: number;
@@ -19,29 +37,58 @@ export interface BackgroundProcessEntry {
19
37
  readCursor: number;
20
38
  stdoutDecoder: StringDecoder;
21
39
  stderrDecoder: StringDecoder;
40
+ stdoutNormalizer: TerminalOutputNormalizer;
41
+ stderrNormalizer: TerminalOutputNormalizer;
22
42
  stripAnsi: boolean;
23
43
  killRequested: boolean;
24
44
  processExited: boolean;
45
+ streamsFlushed: boolean;
46
+ terminalSettled: boolean;
47
+ terminalPromise: Promise<void>;
48
+ resolveTerminal: () => void;
49
+ terminationPromise?: Promise<BackgroundProcessTerminationResult>;
50
+ terminationSettled: boolean;
25
51
  }
26
52
  export interface BackgroundProcessReadResult {
27
53
  output: string;
28
54
  status: BackgroundProcessStatus;
29
55
  exitCode: number | null;
30
56
  signal: NodeJS.Signals | null;
57
+ error: string | null;
31
58
  truncated: boolean;
32
59
  }
33
60
  export interface BackgroundProcessRegistryOptions {
34
61
  maxConcurrent?: number;
35
62
  maxEntries?: number;
36
63
  capChars?: number;
64
+ platform?: NodeJS.Platform;
65
+ signalAdapter?: ProcessTreeSignalAdapter;
37
66
  }
67
+ export declare class BackgroundProcessCleanupError extends Error {
68
+ readonly results: BackgroundProcessTerminationResult[];
69
+ constructor(results: BackgroundProcessTerminationResult[]);
70
+ }
71
+ export declare function isTerminalStatus(status: BackgroundProcessStatus): boolean;
38
72
  export declare class BackgroundProcessRegistry {
39
73
  private readonly entries;
74
+ private readonly reservations;
40
75
  private readonly maxConcurrent;
41
76
  private readonly maxEntries;
42
77
  private readonly capChars;
78
+ private readonly platform;
79
+ private readonly signalAdapter;
43
80
  private counter;
44
81
  constructor(opts?: BackgroundProcessRegistryOptions);
82
+ reserve(): BackgroundProcessReservation;
83
+ release(reservation: BackgroundProcessReservation): void;
84
+ attach(reservation: BackgroundProcessReservation, opts: {
85
+ child: ChildProcess;
86
+ command: string;
87
+ cwd: string;
88
+ stripAnsi: boolean;
89
+ processGroupId?: number;
90
+ }): BackgroundProcessEntry;
91
+ /** Compatibility adapter for callers being migrated to reserve/attach. */
45
92
  spawn(opts: {
46
93
  child: ChildProcess;
47
94
  command: string;
@@ -52,12 +99,17 @@ export declare class BackgroundProcessRegistry {
52
99
  regex?: string;
53
100
  }): BackgroundProcessReadResult;
54
101
  list(): BackgroundProcessEntry[];
55
- kill(shellId: string): {
56
- status: BackgroundProcessStatus;
57
- exitCode: number | null;
58
- signal: NodeJS.Signals | null;
59
- };
60
- closeAll(): Promise<void>;
102
+ kill(shellId: string): Promise<BackgroundProcessTerminationResult>;
103
+ closeAll(): Promise<BackgroundProcessTerminationResult[]>;
104
+ reset(): Promise<BackgroundProcessTerminationResult[]>;
105
+ private terminate;
106
+ private confirmed;
107
+ private failed;
108
+ private result;
109
+ private waitForTerminal;
110
+ private appendDecoded;
111
+ private settleTerminal;
112
+ private flushStreams;
61
113
  private append;
62
114
  private evictIfNeeded;
63
115
  }
@@ -0,0 +1,15 @@
1
+ export interface ExactTextReplacement {
2
+ before: string;
3
+ after: string;
4
+ lineNumbers: {
5
+ oldStartLine: number;
6
+ oldEndLine: number;
7
+ newStartLine: number;
8
+ newEndLine: number;
9
+ oldLineCount: number;
10
+ newLineCount: number;
11
+ };
12
+ }
13
+ export declare function sha256Bytes(value: string | Uint8Array): string;
14
+ export declare function replaceFirstExact(before: string, oldText: string, newText: string): ExactTextReplacement | undefined;
15
+ //# sourceMappingURL=file-mutation.d.ts.map
@@ -0,0 +1,22 @@
1
+ import * as Ripgrep from "./ripgrep.ts";
2
+ export declare const GREP_DEFAULT_LIMIT = 100;
3
+ export declare const GREP_MAX_PATTERN_LENGTH = 1024;
4
+ export declare const GREP_MAX_SNIPPET_LENGTH = 2000;
5
+ export interface RegexSearchOptions {
6
+ cwd: string;
7
+ pattern: string;
8
+ files?: readonly string[];
9
+ glob?: string;
10
+ context?: number;
11
+ limit?: number;
12
+ }
13
+ export interface RegexSearchResult {
14
+ matches: Ripgrep.RipgrepMatch[];
15
+ matchCount: number;
16
+ fileCount: number;
17
+ truncated: boolean;
18
+ }
19
+ export declare function validateGrepPattern(pattern: string): void;
20
+ export declare function boundedGrepSnippet(line: string): string;
21
+ export declare function searchRegex(options: RegexSearchOptions): Promise<RegexSearchResult>;
22
+ //# sourceMappingURL=grep-engine.d.ts.map
@@ -8,8 +8,8 @@ export declare function createGrepTool(options?: GrepToolOptions): import("../sh
8
8
  pattern: string;
9
9
  include?: string | undefined;
10
10
  path?: string | undefined;
11
- limit?: number | undefined;
12
11
  context?: number | undefined;
12
+ limit?: number | undefined;
13
13
  }, import("../shared/types.ts").ToolOutputEnvelope, undefined, {
14
14
  type: "object";
15
15
  properties: {
@@ -5,9 +5,11 @@ export * from "./bash-output-tool.ts";
5
5
  export * from "./bash-tool.ts";
6
6
  export * from "./command-tool.ts";
7
7
  export * from "./file-edit-tool.ts";
8
+ export * from "./file-mutation.ts";
8
9
  export * from "./file-new-tool.ts";
9
10
  export * from "./file-read-tool.ts";
10
11
  export * from "./glob-tool.ts";
12
+ export * from "./grep-engine.ts";
11
13
  export * from "./grep-tool.ts";
12
14
  export * from "./internal-tool-runtime.ts";
13
15
  export * from "./kill-shell-tool.ts";