@nuvin/agent-core 0.2.0-rc.9 → 0.2.0

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 (73) hide show
  1. package/dist/VERSION +2 -2
  2. package/dist/agent/index.js +1 -1
  3. package/dist/chunk-D5IVWJHX.js +1 -1
  4. package/dist/chunk-FFIZ6TKW.js +1 -1
  5. package/dist/chunk-GAZGO6N7.js +1 -0
  6. package/dist/chunk-IUZALP6K.js +1 -1
  7. package/dist/chunk-KIIEBXJF.js +1 -0
  8. package/dist/chunk-LIE76IJA.js +1 -1
  9. package/dist/chunk-X7VAACWY.js +1 -1
  10. package/dist/chunk-YNOIG4FD.js +1 -1
  11. package/dist/formats/index.js +1 -1
  12. package/dist/hooks/index.js +1 -1
  13. package/dist/models/index.d.ts +1 -0
  14. package/dist/models/index.js +1 -1
  15. package/dist/shared/index.js +1 -1
  16. package/dist/shared/types.d.ts +11 -2
  17. package/dist/tools/{internal-tool-runtime.d.ts → core/internal-tool-runtime.d.ts} +1 -1
  18. package/dist/tools/core/mock-tool-runtime.d.ts +3 -0
  19. package/dist/tools/core/runtime-manager-tools.d.ts +132 -0
  20. package/dist/tools/{tool-output-offload.d.ts → core/tool-output-offload.d.ts} +1 -1
  21. package/dist/tools/{tools.d.ts → core/tools.d.ts} +1 -1
  22. package/dist/tools/file-editing/anchored-file-edit.d.ts +53 -0
  23. package/dist/tools/file-editing/anchored-file-errors.d.ts +5 -0
  24. package/dist/tools/file-editing/anchored-file-operations.d.ts +38 -0
  25. package/dist/tools/file-editing/anchored-file-read.d.ts +37 -0
  26. package/dist/tools/file-editing/atomic-file-write.d.ts +19 -0
  27. package/dist/tools/file-editing/file-edit-tool.d.ts +166 -0
  28. package/dist/tools/file-editing/file-mutation-coordinator.d.ts +13 -0
  29. package/dist/tools/{file-new-tool.d.ts → file-editing/file-new-tool.d.ts} +5 -2
  30. package/dist/tools/file-editing/file-observation-store.d.ts +40 -0
  31. package/dist/tools/{file-read-tool.d.ts → file-editing/file-read-tool.d.ts} +8 -2
  32. package/dist/tools/file-editing/file-snapshot.d.ts +16 -0
  33. package/dist/tools/file-editing/hashline-file-edit-adapter.d.ts +19 -0
  34. package/dist/tools/file-editing/structured-file-edit-adapter.d.ts +94 -0
  35. package/dist/tools/file-editing/workspace-paths.d.ts +20 -0
  36. package/dist/tools/index.d.ts +43 -34
  37. package/dist/tools/index.js +1 -1
  38. package/dist/tools/{mcp-connection-generation.d.ts → mcp/mcp-connection-generation.d.ts} +1 -1
  39. package/dist/tools/{mcp-tool-adapter.d.ts → mcp/mcp-tool-adapter.d.ts} +3 -3
  40. package/dist/tools/{glob-tool.d.ts → search/glob-tool.d.ts} +2 -2
  41. package/dist/tools/{grep-tool.d.ts → search/grep-tool.d.ts} +2 -2
  42. package/dist/tools/{ls-tool.d.ts → search/ls-tool.d.ts} +2 -2
  43. package/dist/tools/{view-file-tool.d.ts → search/view-file-tool.d.ts} +2 -2
  44. package/dist/tools/{ask-user-tool.d.ts → session/ask-user-tool.d.ts} +4 -4
  45. package/dist/tools/{lsp-tool.d.ts → session/lsp-tool.d.ts} +5 -5
  46. package/dist/tools/{skill-tool.d.ts → session/skill-tool.d.ts} +2 -2
  47. package/dist/tools/{todo-write-tool.d.ts → session/todo-write-tool.d.ts} +2 -2
  48. package/dist/tools/session/update-topic-tool.d.ts +12 -0
  49. package/dist/tools/{bash-output-tool.d.ts → shell/bash-output-tool.d.ts} +2 -2
  50. package/dist/tools/{bash-tool.d.ts → shell/bash-tool.d.ts} +5 -5
  51. package/dist/tools/{command-tool.d.ts → shell/command-tool.d.ts} +2 -2
  52. package/dist/tools/{kill-shell-tool.d.ts → shell/kill-shell-tool.d.ts} +2 -2
  53. package/dist/tools/{web-fetch-tool.d.ts → web/web-fetch-tool.d.ts} +2 -2
  54. package/dist/tools/{web-search-tool.d.ts → web/web-search-tool.d.ts} +2 -2
  55. package/package.json +3 -2
  56. package/dist/chunk-VYW6MSQ3.js +0 -1
  57. package/dist/tools/file-edit-tool.d.ts +0 -34
  58. package/dist/tools/mock-tool-runtime.d.ts +0 -3
  59. package/dist/tools/runtime-manager-tools.d.ts +0 -79
  60. package/dist/tools/update-topic-tool.d.ts +0 -12
  61. package/dist/tools/workspace-paths.d.ts +0 -5
  62. /package/dist/tools/{file-mutation.d.ts → file-editing/file-mutation.d.ts} +0 -0
  63. /package/dist/tools/{mcp-oauth-provider.d.ts → mcp/mcp-oauth-provider.d.ts} +0 -0
  64. /package/dist/tools/{mcp-safe-error-provenance.d.ts → mcp/mcp-safe-error-provenance.d.ts} +0 -0
  65. /package/dist/tools/{mcp-safe-error.d.ts → mcp/mcp-safe-error.d.ts} +0 -0
  66. /package/dist/tools/{mcp-server-manager.d.ts → mcp/mcp-server-manager.d.ts} +0 -0
  67. /package/dist/tools/{grep-engine.d.ts → search/grep-engine.d.ts} +0 -0
  68. /package/dist/tools/{ripgrep.d.ts → search/ripgrep.d.ts} +0 -0
  69. /package/dist/tools/{background-process-registry.d.ts → shell/background-process-registry.d.ts} +0 -0
  70. /package/dist/tools/{bash-internals.d.ts → shell/bash-internals.d.ts} +0 -0
  71. /package/dist/tools/{process-tree-termination.d.ts → shell/process-tree-termination.d.ts} +0 -0
  72. /package/dist/tools/{terminal-output-normalizer.d.ts → shell/terminal-output-normalizer.d.ts} +0 -0
  73. /package/dist/tools/{safe-fetch.d.ts → web/safe-fetch.d.ts} +0 -0
@@ -1 +1 @@
1
- (function(_0x347104,_0x4b6609){const _0x12014c={_0x42e73f:0x1c1,_0x2237ee:0x1c2,_0x23a14d:0x1c2,_0x5917d7:0x493,_0x23cfb6:0x497,_0x821fff:0x1cb,_0x5d567d:0x1c5,_0x58fb21:0x1bd,_0x531651:0x49f,_0x9fc41:0x496,_0x5df345:0x48d,_0x1e749d:0x49d,_0x1ce2fc:0x48e,_0x48f1f5:0x49d,_0x165d7d:0x49a,_0x2323f8:0x491,_0x5db008:0x48c,_0x56cec3:0x492,_0x5f3ed5:0x488,_0x356e0e:0x486,_0x3107dc:0x493,_0x23957b:0x486};function _0x264a77(_0x932f5c,_0x121573,_0x1d032a,_0x17ae08){return _0x2b31(_0x121573- -0x340,_0x17ae08);}const _0x156f07=_0x347104();function _0x4fd38c(_0x3a0663,_0x545063,_0x53eb22,_0x30d64c){return _0x2b31(_0x545063-0x309,_0x30d64c);}while(!![]){try{const _0xe552cd=parseInt(_0x264a77(-_0x12014c._0x42e73f,-_0x12014c._0x2237ee,-_0x12014c._0x23a14d,-0x1cd))/0x1+parseInt(_0x4fd38c(_0x12014c._0x5917d7,_0x12014c._0x5917d7,_0x12014c._0x23cfb6,0x496))/0x2*(parseInt(_0x4fd38c(0x495,0x499,0x491,0x4a0))/0x3)+parseInt(_0x264a77(-0x1c7,-0x1c0,-0x1ba,-_0x12014c._0x821fff))/0x4+-parseInt(_0x264a77(-0x1c5,-0x1bd,-_0x12014c._0x5d567d,-_0x12014c._0x58fb21))/0x5*(-parseInt(_0x4fd38c(_0x12014c._0x531651,_0x12014c._0x9fc41,_0x12014c._0x5df345,_0x12014c._0x1e749d))/0x6)+-parseInt(_0x4fd38c(0x497,0x48d,_0x12014c._0x1ce2fc,0x489))/0x7*(-parseInt(_0x4fd38c(_0x12014c._0x48f1f5,_0x12014c._0x165d7d,_0x12014c._0x2323f8,0x498))/0x8)+-parseInt(_0x4fd38c(_0x12014c._0x5db008,_0x12014c._0x56cec3,0x48e,_0x12014c._0x5f3ed5))/0x9*(parseInt(_0x4fd38c(0x48e,0x491,_0x12014c._0x356e0e,0x48b))/0xa)+-parseInt(_0x4fd38c(0x485,0x48f,0x497,0x486))/0xb*(parseInt(_0x4fd38c(_0x12014c._0x3107dc,0x490,0x492,_0x12014c._0x23957b))/0xc);if(_0xe552cd===_0x4b6609)break;else _0x156f07['push'](_0x156f07['shift']());}catch(_0x2417f6){_0x156f07['push'](_0x156f07['shift']());}}}(_0x410f,0xd7533));function _0x410f(){const _0x20d539=['ChvZAa','mtyYnZa1ou5pDNfssW','CMvTB3zLqwjVCNrmAxn0zw5LCG','mtGXmJiWog1dBhzXqG','Bwf4q29Uy3vYCMvUy3KGBxvZDcbIzsbHigzPBML0zsbWB3nPDgL2zsbPBNrLz2vY','AxnjBNrLz2vY','nxnmD1rsDW','mJfKyKPIzfi','C2HPzNq','nduYmtKZmdzuC25vDu0','mtjywvvXwNu','mta1mhrvvgH4zW','ode0otvNs3f6z3e','nJiXodjdBg9rv1m','y2fUy2vSBgvK','BgvUz3rO','nte3mZa3nfjAs2D3CW','CMvQzwn0','CMvZB2X2zq','mtuZs1r4ruXZ','mZC3nta5nNjcCufdAW','C3bSAwnL'];_0x410f=function(){return _0x20d539;};return _0x410f();}import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x3a164e){const _0x4c1d77={_0x2e52f5:0x254,_0xfccf89:0x260,_0x210f79:0x230,_0x2b02a2:0x22a},_0x271fcb={_0x1feb00:0x7c,_0x378f38:0x7e,_0x5f2be0:0x85,_0x2b76f5:0x84,_0x1e6cc0:0x86},_0x387e75={_0x2817a5:0x198},_0x3add55={_0x259226:0x74,_0x3627b6:0x4,_0x26f9b6:0x1,_0x931307:0x0,_0x49baea:0x3,_0xf24f58:0x9,_0x3c7144:0xa,_0x4579c2:0xa},_0x2dc613={_0x2d402d:0x253},_0x4ff36e={_0x1fff85:0x3e1},_0x696c44={_0x9712f5:0x3ab};function _0x99bd2(_0x2b54,_0xfaafe3,_0x48feb4,_0x11b899){return _0x2b31(_0x48feb4- -_0x696c44._0x9712f5,_0x2b54);}if(!Number['isFinite'](_0x3a164e)||!Number[_0x372d40(-0x255,-_0x4c1d77._0x2e52f5,-0x25f,-_0x4c1d77._0xfccf89)](_0x3a164e)||_0x3a164e<=0x0)throw new Error(_0x99bd2(-_0x4c1d77._0x210f79,-0x229,-_0x4c1d77._0x2b02a2,-0x226));let _0x15e098=0x0;function _0x372d40(_0x25249b,_0xaf1917,_0x849462,_0x5b35fc){return _0x2b31(_0x849462- -_0x4ff36e._0x1fff85,_0xaf1917);}const _0x413ae3=[],_0x2d34b0=()=>{let _0xb7cd35=![];return()=>{if(_0xb7cd35)return;_0xb7cd35=!![],_0x15e098-=0x1,_0x5a09aa();};},_0x5a09aa=()=>{function _0x365d1a(_0x5e3b80,_0x32428b,_0x5dd29c,_0x683b15){return _0x372d40(_0x5e3b80-0xa3,_0x5dd29c,_0x32428b-0x2be,_0x683b15-0xa0);}function _0x500b4c(_0x1ec8d6,_0x5cafb3,_0x1f3de2,_0xa05293){return _0x372d40(_0x1ec8d6-0x72,_0x1ec8d6,_0x5cafb3-_0x2dc613._0x2d402d,_0xa05293-0x18c);}while(_0x413ae3[_0x365d1a(_0x3add55._0x259226,0x69,0x6c,0x69)]>0x0){const _0xd94b67=_0x413ae3[_0x500b4c(-0x10,-0x9,-0x11,-0xc)]();if(!_0xd94b67||_0xd94b67[_0x500b4c(_0x3add55._0x3627b6,-0x3,-0xc,-_0x3add55._0x26f9b6)])continue;_0xd94b67[_0x500b4c(_0x3add55._0x931307,-_0x3add55._0x49baea,0x0,-_0x3add55._0xf24f58)]=!![],_0xd94b67['removeAbortListener'](),_0x15e098+=0x1,_0xd94b67[_0x500b4c(-0x3,0x1,-_0x3add55._0x3c7144,_0x3add55._0x4579c2)](_0x2d34b0());return;}};return{'acquire'(_0x56eb81){const _0x46a582={_0x2f596e:0x1d7,_0x25ea00:0x1d3,_0x5b5809:0x1df},_0x5efb61={_0x642230:0x15c,_0x98bbdb:0x26f},_0x298b95={_0x472d7a:0x627};if(_0x56eb81?.['aborted'])return Promise[_0x2dc467(-_0x271fcb._0x1feb00,-_0x271fcb._0x378f38,-_0x271fcb._0x5f2be0,-0x83)](toAbortError(_0x56eb81['reason']));function _0x17afa9(_0xb02781,_0x398316,_0x527f73,_0x1db5b8){return _0x99bd2(_0xb02781,_0x398316-0x133,_0x398316-_0x298b95._0x472d7a,_0x1db5b8-0xf9);}if(_0x15e098<_0x3a164e)return _0x15e098+=0x1,Promise[_0x2dc467(-0x7a,-0x7e,-_0x271fcb._0x2b76f5,-_0x271fcb._0x1e6cc0)](_0x2d34b0());function _0x2dc467(_0x4fd7c8,_0x1c63e3,_0x5d62b3,_0x443df1){return _0x99bd2(_0x443df1,_0x1c63e3-0xee,_0x5d62b3-_0x387e75._0x2817a5,_0x443df1-0x63);}return new Promise((_0x2197bd,_0x3c3874)=>{const _0x29c107={_0x499aab:0x1f9,_0x4ba2cf:0x20b,_0x2aed88:0x205,_0x4f145c:0x208,_0x6a6d40:0x1fd,_0x6dd31c:0x284,_0x3b1b42:0x286,_0x170f7c:0x27d};function _0x250129(_0x20dafb,_0x27553f,_0x2ce09d,_0x26e36b){return _0x2dc467(_0x20dafb-_0x5efb61._0x642230,_0x27553f-0xcd,_0x26e36b-_0x5efb61._0x98bbdb,_0x2ce09d);}const _0x7fbf49={'resolve':_0x2197bd,'reject':_0x3c3874,'cancelled':![],'removeAbortListener':()=>{}};_0x413ae3[_0x250129(_0x46a582._0x2f596e,_0x46a582._0x25ea00,_0x46a582._0x5b5809,0x1d9)](_0x7fbf49),_0x7fbf49['removeAbortListener']=addAbortListener(_0x56eb81,()=>{const _0x2fb8a0={_0x387bd4:0x5f},_0x5bd777={_0xc947ea:0x3e0};function _0x577125(_0x348c1d,_0x31bd7b,_0x16707c,_0x5906aa){return _0x250129(_0x348c1d-0x1d0,_0x31bd7b-0x7d,_0x16707c,_0x31bd7b- -_0x5bd777._0xc947ea);}if(_0x7fbf49[_0x577125(-0x1fe,-0x1f9,-_0x29c107._0x499aab,-0x1f4)])return;_0x7fbf49[_0x577125(-0x1f7,-0x1f9,-0x1f1,-0x1f4)]=!![],_0x7fbf49[_0x577125(-_0x29c107._0x4ba2cf,-_0x29c107._0x2aed88,-_0x29c107._0x4f145c,-_0x29c107._0x6a6d40)]();function _0x6d6e12(_0x5299a5,_0x4716f8,_0x217f55,_0x392d95){return _0x250129(_0x5299a5-0x37,_0x4716f8-_0x2fb8a0._0x387bd4,_0x217f55,_0x5299a5-0x94);}const _0x2737a4=_0x413ae3['indexOf'](_0x7fbf49);if(_0x2737a4>=0x0)_0x413ae3[_0x6d6e12(0x282,_0x29c107._0x6dd31c,_0x29c107._0x3b1b42,_0x29c107._0x170f7c)](_0x2737a4,0x1);_0x7fbf49['reject'](toAbortError(_0x56eb81?.['reason']));});});}};}function _0x2b31(_0x991c51,_0x3ffe1e){_0x991c51=_0x991c51-0x17d;const _0x410ff7=_0x410f();let _0x2b313e=_0x410ff7[_0x991c51];if(_0x2b31['FRQNLp']===undefined){var _0x2036da=function(_0x2e5fa6){const _0x39abd8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3a164e='',_0x15e098='';for(let _0x413ae3=0x0,_0x2d34b0,_0x5a09aa,_0xb7cd35=0x0;_0x5a09aa=_0x2e5fa6['charAt'](_0xb7cd35++);~_0x5a09aa&&(_0x2d34b0=_0x413ae3%0x4?_0x2d34b0*0x40+_0x5a09aa:_0x5a09aa,_0x413ae3++%0x4)?_0x3a164e+=String['fromCharCode'](0xff&_0x2d34b0>>(-0x2*_0x413ae3&0x6)):0x0){_0x5a09aa=_0x39abd8['indexOf'](_0x5a09aa);}for(let _0xd94b67=0x0,_0x56eb81=_0x3a164e['length'];_0xd94b67<_0x56eb81;_0xd94b67++){_0x15e098+='%'+('00'+_0x3a164e['charCodeAt'](_0xd94b67)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x15e098);};_0x2b31['ysWSkz']=_0x2036da,_0x2b31['JZLwRk']={},_0x2b31['FRQNLp']=!![];}const _0x27e41d=_0x410ff7[0x0],_0x171c35=_0x991c51+_0x27e41d,_0x23baf9=_0x2b31['JZLwRk'][_0x171c35];return!_0x23baf9?(_0x2b313e=_0x2b31['ysWSkz'](_0x2b313e),_0x2b31['JZLwRk'][_0x171c35]=_0x2b313e):_0x2b313e=_0x23baf9,_0x2b313e;}export{OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
1
+ (function(_0x26ff1a,_0x289c81){const _0x397676={_0x40615f:0xe8,_0x41a750:0xe7,_0x353743:0xe0,_0xa5ffd0:0xe1,_0x2543d2:0x479,_0x4a2857:0xf7,_0x18cc06:0xf1,_0x7d2aed:0x46b,_0xa7175a:0x458,_0x10f36f:0xe4,_0x1eba56:0xea,_0x224c7d:0x46d,_0x9f0269:0x473},_0x4e519a={_0xf85db6:0x3c8},_0x9121d5={_0x3b372b:0x18d};function _0x3cc5c9(_0x4b5400,_0x56e1fc,_0x1cb1a6,_0x510978){return _0x24d9(_0x4b5400- -_0x9121d5._0x3b372b,_0x56e1fc);}const _0x1f5b93=_0x26ff1a();function _0x156eae(_0x5aadb3,_0x1c022b,_0x3a2d41,_0x223733){return _0x24d9(_0x3a2d41-_0x4e519a._0xf85db6,_0x5aadb3);}while(!![]){try{const _0x3456b8=-parseInt(_0x3cc5c9(-_0x397676._0x40615f,-_0x397676._0x41a750,-_0x397676._0x353743,-_0x397676._0xa5ffd0))/0x1+parseInt(_0x156eae(_0x397676._0x2543d2,0x473,0x474,0x47b))/0x2+-parseInt(_0x3cc5c9(-0xf0,-_0x397676._0x40615f,-_0x397676._0x4a2857,-_0x397676._0x18cc06))/0x3*(parseInt(_0x156eae(0x46c,_0x397676._0x7d2aed,0x468,0x467))/0x4)+parseInt(_0x156eae(_0x397676._0xa7175a,0x460,0x462,0x466))/0x5+parseInt(_0x3cc5c9(-_0x397676._0x10f36f,-_0x397676._0x1eba56,-0xdb,-0xe8))/0x6+parseInt(_0x3cc5c9(-0xe9,-0xe8,-0xdf,-0xe9))/0x7+parseInt(_0x156eae(0x46c,0x467,0x467,0x46a))/0x8*(parseInt(_0x156eae(0x477,_0x397676._0x224c7d,_0x397676._0x9f0269,0x46c))/0x9);if(_0x3456b8===_0x289c81)break;else _0x1f5b93['push'](_0x1f5b93['shift']());}catch(_0x31097e){_0x1f5b93['push'](_0x1f5b93['shift']());}}}(_0x3222,0x3c762));import{modelIdentityFromParts}from'../chunk-D5IVWJHX.js';function _0x24d9(_0x5a9121,_0x275fd1){_0x5a9121=_0x5a9121-0x9a;const _0x322244=_0x3222();let _0x24d943=_0x322244[_0x5a9121];if(_0x24d9['ApGnul']===undefined){var _0x352f70=function(_0x69bb97){const _0x451100='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x418d85='',_0x16febf='';for(let _0x24fb75=0x0,_0xcb0c63,_0x295dda,_0x29cb62=0x0;_0x295dda=_0x69bb97['charAt'](_0x29cb62++);~_0x295dda&&(_0xcb0c63=_0x24fb75%0x4?_0xcb0c63*0x40+_0x295dda:_0x295dda,_0x24fb75++%0x4)?_0x418d85+=String['fromCharCode'](0xff&_0xcb0c63>>(-0x2*_0x24fb75&0x6)):0x0){_0x295dda=_0x451100['indexOf'](_0x295dda);}for(let _0x54d39c=0x0,_0x443488=_0x418d85['length'];_0x54d39c<_0x443488;_0x54d39c++){_0x16febf+='%'+('00'+_0x418d85['charCodeAt'](_0x54d39c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x16febf);};_0x24d9['RMVWeh']=_0x352f70,_0x24d9['pXKqSB']={},_0x24d9['ApGnul']=!![];}const _0x25ebce=_0x322244[0x0],_0x43d619=_0x5a9121+_0x25ebce,_0x1ede3f=_0x24d9['pXKqSB'][_0x43d619];return!_0x1ede3f?(_0x24d943=_0x24d9['RMVWeh'](_0x24d943),_0x24d9['pXKqSB'][_0x43d619]=_0x24d943):_0x24d943=_0x1ede3f,_0x24d943;}function _0x3222(){const _0x13fea=['ntK0nZC2ruPpvNbk','mZCYmtu0sfPTuwjZ','CMvZB2X2zq','CMvHC29U','ChvZAa','mtKXody2mLndB2vVtW','AxngAw5PDgu','nte1ndnmCu56AhK','ndi0mdz6zMPOu3e','ode4mJe1yNDfrMTm','C3bSAwnL','CMvTB3zLqwjVCNrmAxn0zw5LCG','otGXotLnC0DsBMm','C2HPzNq','nda4wxfxtMno','mZjLA0zdAgO','ywjVCNrLza','y2fUy2vSBgvK','Aw5KzxHpzG'];_0x3222=function(){return _0x13fea;};return _0x3222();}import{resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig}from'../chunk-IUZALP6K.js';import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';function createAbortAwareSemaphore(_0x418d85){const _0x174853={_0x2a77d5:0x231},_0xab26eb={_0x34ce67:0x48e,_0x3806f9:0x485},_0xbd5bad={_0x5e775a:0xff,_0x54193c:0x262,_0x10ff3b:0x158},_0x21b548={_0x1bbe83:0x8,_0xf1ae38:0x9,_0x30fd53:0x11,_0x55c8d6:0x5,_0x7a6d64:0xb},_0x31fed8={_0x1ae3d7:0x1b9};if(!Number[_0x33c326(_0x174853._0x2a77d5,0x239,0x23d,0x230)](_0x418d85)||!Number['isInteger'](_0x418d85)||_0x418d85<=0x0)throw new Error('maxConcurrency\x20must\x20be\x20a\x20finite\x20positive\x20integer');let _0x16febf=0x0;const _0x24fb75=[];function _0x33c326(_0x29a3ec,_0x41f1ec,_0x24a95a,_0x3b8447){return _0x24d9(_0x41f1ec-0x18f,_0x3b8447);}const _0xcb0c63=()=>{let _0x29cb62=![];return()=>{if(_0x29cb62)return;_0x29cb62=!![],_0x16febf-=0x1,_0x295dda();};},_0x295dda=()=>{const _0x513670={_0x33f1f3:0x16f,_0xa9ec3b:0x222,_0xcd865c:0x161};function _0x48ab7b(_0x335619,_0x4f95c1,_0x3a8af7,_0x2aaefa){return _0x33c326(_0x335619-_0x513670._0x33f1f3,_0x4f95c1- -_0x513670._0xa9ec3b,_0x3a8af7-_0x513670._0xcd865c,_0x2aaefa);}function _0x3cf211(_0x2e9bb0,_0x22ac69,_0x1ace7f,_0x15548e){return _0x33c326(_0x2e9bb0-_0x31fed8._0x1ae3d7,_0x22ac69- -0xb0,_0x1ace7f-0x11b,_0x15548e);}while(_0x24fb75['length']>0x0){const _0x54d39c=_0x24fb75[_0x48ab7b(0x12,0xb,0x7,_0x21b548._0x1bbe83)]();if(!_0x54d39c||_0x54d39c['cancelled'])continue;_0x54d39c[_0x48ab7b(0xa,0xf,_0x21b548._0xf1ae38,_0x21b548._0x30fd53)]=!![],_0x54d39c[_0x48ab7b(_0x21b548._0x55c8d6,0x9,0x8,_0x21b548._0x7a6d64)](),_0x16febf+=0x1,_0x54d39c[_0x48ab7b(0xc,0x13,0x10,0xc)](_0xcb0c63());return;}};return{'acquire'(_0x443488){const _0x58075a={_0x101b6b:0x2c0,_0x1c422a:0x1d0,_0x1b9f73:0x1d6},_0x83632c={_0x2ee822:0x110,_0x3dc952:0x119,_0x4c14d8:0x10d,_0x22e9ac:0x269,_0x92155a:0x271,_0x5ec57a:0x275,_0x924143:0x11b,_0x215bc0:0x110,_0x2b64c6:0x113},_0xe04a0d={_0x155202:0x150};if(_0x443488?.[_0x275a35(_0xab26eb._0x34ce67,0x48a,0x487,0x488)])return Promise['reject'](toAbortError(_0x443488['reason']));function _0x275a35(_0x8693e5,_0x464c14,_0x1d480d,_0x5683be){return _0x33c326(_0x8693e5-0x13e,_0x5683be-0x258,_0x1d480d-0x9a,_0x464c14);}if(_0x16febf<_0x418d85)return _0x16febf+=0x1,Promise[_0x275a35(0x48b,_0xab26eb._0x3806f9,0x493,0x48d)](_0xcb0c63());function _0x2696d8(_0x39b4ec,_0x57af20,_0x417400,_0x228bfa){return _0x33c326(_0x39b4ec-_0xbd5bad._0x5e775a,_0x417400- -_0xbd5bad._0x54193c,_0x417400-_0xbd5bad._0x10ff3b,_0x228bfa);}return new Promise((_0x2621f7,_0x4d1dce)=>{const _0x29565a={_0x3afff0:0xd5},_0x1a7d49={'resolve':_0x2621f7,'reject':_0x4d1dce,'cancelled':![],'removeAbortListener':()=>{}};_0x24fb75[_0x59b0f5(0x2b6,0x2c5,_0x58075a._0x101b6b,0x2bc)](_0x1a7d49);function _0x59b0f5(_0x5e9cb4,_0x5d58ef,_0x53098a,_0x51d0fa){return _0x275a35(_0x5e9cb4-0x155,_0x5d58ef,_0x53098a-_0xe04a0d._0x155202,_0x51d0fa- -0x1d3);}function _0x33b2ab(_0x30a5e9,_0x20c4bd,_0x43f686,_0x24d1f6){return _0x2696d8(_0x30a5e9-0x156,_0x20c4bd-_0x29565a._0x3afff0,_0x43f686-0x20d,_0x20c4bd);}_0x1a7d49[_0x33b2ab(_0x58075a._0x1c422a,0x1e0,_0x58075a._0x1b9f73,0x1ce)]=addAbortListener(_0x443488,()=>{const _0x198a9d={_0x2302f6:0x196,_0x60383b:0x13},_0x496f1c={_0x4961bb:0x13b,_0x455112:0xcf};if(_0x1a7d49[_0x41c919(-_0x83632c._0x2ee822,-_0x83632c._0x3dc952,-0x114,-_0x83632c._0x4c14d8)])return;function _0x56061a(_0x4920f3,_0x19fdb3,_0x20eb40,_0x275eed){return _0x33b2ab(_0x4920f3-_0x496f1c._0x4961bb,_0x275eed,_0x20eb40-0x93,_0x275eed-_0x496f1c._0x455112);}function _0x41c919(_0x29ae47,_0x477dc1,_0x3161b2,_0x6ebf7c){return _0x59b0f5(_0x29ae47-_0x198a9d._0x2302f6,_0x477dc1,_0x3161b2-_0x198a9d._0x60383b,_0x3161b2- -0x3ca);}_0x1a7d49['cancelled']=!![],_0x1a7d49[_0x56061a(0x264,0x265,0x269,0x261)]();const _0x33c15b=_0x24fb75[_0x56061a(_0x83632c._0x22e9ac,_0x83632c._0x92155a,0x270,_0x83632c._0x5ec57a)](_0x1a7d49);if(_0x33c15b>=0x0)_0x24fb75[_0x41c919(-0x116,-_0x83632c._0x924143,-0x11b,-0x120)](_0x33c15b,0x1);_0x1a7d49['reject'](toAbortError(_0x443488?.[_0x41c919(-_0x83632c._0x215bc0,-0x105,-0x10f,-_0x83632c._0x2b64c6)]));});});}};}export{OperationAbortedError,TurnFailedError,addAbortListener,createAbortAwareSemaphore,isAbortError,modelIdentityFromParts,resolveAnthropicReasoningConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
@@ -277,6 +277,9 @@ export interface OpenAiReasoningSummaryDeltaChunk {
277
277
  outputIndex: number;
278
278
  summaryIndex: number;
279
279
  }
280
+ export interface ProviderStreamResetChunk {
281
+ type: "provider_stream_reset";
282
+ }
280
283
  export interface ProviderRetryChunk {
281
284
  type: "provider_retry";
282
285
  attempt: number;
@@ -290,7 +293,7 @@ export interface DoneChunk {
290
293
  type: "done";
291
294
  response: ChatResponse;
292
295
  }
293
- export type ChatResponseChunk = AnthropicSignatureDeltaChunk | AnthropicThinkingDeltaChunk | ContentDeltaChunk | DoneChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk | ProviderRetryChunk | ToolUseDeltaChunk;
296
+ export type ChatResponseChunk = AnthropicSignatureDeltaChunk | AnthropicThinkingDeltaChunk | ContentDeltaChunk | DoneChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk | ProviderStreamResetChunk | ProviderRetryChunk | ToolUseDeltaChunk;
294
297
  export interface ModelLimits {
295
298
  contextWindow?: number;
296
299
  maxOutput?: number;
@@ -554,8 +557,14 @@ export interface AgentTurnCompleteEvent {
554
557
  state: TurnState;
555
558
  }
556
559
  export interface AgentProviderRetryEvent extends ProviderRetryChunk {
560
+ assistantMessageId: string;
561
+ }
562
+ export interface AgentProviderStreamResetEvent {
563
+ type: "provider_stream_reset";
564
+ assistantMessageId: string;
565
+ reasoningMessageId: string;
557
566
  }
558
- export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
567
+ export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentProviderRetryEvent | AgentProviderStreamResetEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
559
568
  export type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
560
569
  export type ToolRuntimeDispatchDecision = {
561
570
  action: "reject";
@@ -1,4 +1,4 @@
1
- import type { AnyToolDefinition, ToolRuntime, ToolRuntimeEventHandler, ToolRuntimeToolCallHandler } from "../shared/types.ts";
1
+ import type { AnyToolDefinition, ToolRuntime, ToolRuntimeEventHandler, ToolRuntimeToolCallHandler } from "../../shared/types.ts";
2
2
  interface InternalToolRuntimeOptions {
3
3
  onEvent?: ToolRuntimeEventHandler;
4
4
  onToolCall?: ToolRuntimeToolCallHandler;
@@ -0,0 +1,3 @@
1
+ import type { ToolRuntime } from "../../shared/types.ts";
2
+ export declare function createMockToolRuntime(): ToolRuntime;
3
+ //# sourceMappingURL=mock-tool-runtime.d.ts.map
@@ -0,0 +1,132 @@
1
+ import { Agent } from "../../agent/agent.ts";
2
+ import type { AbortAwareSemaphore } from "../../shared/abort-aware-semaphore.ts";
3
+ import type { AgentDefinitionFactoryContext, AgentOptions } from "../../shared/types.ts";
4
+ export declare const MODEL_TIERS: readonly ["fast", "balanced", "powerful"];
5
+ export type ModelTier = (typeof MODEL_TIERS)[number];
6
+ export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
7
+ parentSessionId: string;
8
+ runId: string;
9
+ signal: AbortSignal;
10
+ modelTier?: ModelTier;
11
+ }
12
+ export type DelegatedRoutingMetadata = {
13
+ requestedModelTier: ModelTier;
14
+ agentModelSet?: string;
15
+ resolvedModelIdentity: string;
16
+ };
17
+ export type DelegatedAgentResolution = {
18
+ options: AgentOptions;
19
+ routing?: DelegatedRoutingMetadata;
20
+ };
21
+ export declare class DelegatedResolutionError extends Error {
22
+ readonly requestedModelTier: ModelTier;
23
+ readonly agentModelSet?: string;
24
+ readonly selector?: string;
25
+ constructor(message: string, metadata: {
26
+ requestedModelTier: ModelTier;
27
+ agentModelSet?: string;
28
+ selector?: string;
29
+ }, options?: ErrorOptions);
30
+ }
31
+ type DelegatedAgentFactoryResult = AgentOptions | DelegatedAgentResolution;
32
+ export type DelegatedRunOutcome = Readonly<{
33
+ status: "completed" | "failed" | "aborted";
34
+ errorMessage?: string;
35
+ }>;
36
+ export interface DelegatedRunLifecycleHooks {
37
+ start(agent: Agent, context: DelegatedAgentFactoryContext): Promise<void>;
38
+ finish(context: DelegatedAgentFactoryContext, outcome: DelegatedRunOutcome): Promise<void>;
39
+ }
40
+ export type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => DelegatedAgentFactoryResult | Promise<DelegatedAgentFactoryResult>);
41
+ export interface CreateDelegationToolsOptions {
42
+ agents?: Record<string, DelegatedAgentDefinition>;
43
+ lifecycle?: DelegatedRunLifecycleHooks;
44
+ semaphore?: AbortAwareSemaphore;
45
+ /** Register an active child for shared tool refresh; returns its cleanup callback. */
46
+ registerActiveAgent?: (agent: Agent, context: DelegatedAgentFactoryContext) => () => void;
47
+ registerActiveRun?: (entry: {
48
+ runId: string;
49
+ abortController: AbortController;
50
+ completion: Promise<void>;
51
+ }) => () => void;
52
+ /** Render a resolved child prompt immediately before constructing its Agent. */
53
+ renderSystemPrompt?: (systemPrompt: string) => string;
54
+ /**
55
+ * Idempotent delegated-resource release (e.g. the run's observation store),
56
+ * invoked from the outer `finally` on EVERY terminal path: success, abort,
57
+ * factory rejection, `Agent` construction failure, and registration failure.
58
+ * The runtime wires this to its idempotent per-run store release, so the
59
+ * delegation factory's own failure-release may safely converge here.
60
+ */
61
+ releaseAgentResources?: (context: DelegatedAgentFactoryContext) => void;
62
+ }
63
+ export declare function resolveDelegatedAgentOptions(definition: DelegatedAgentDefinition, ctx: DelegatedAgentFactoryContext): Promise<DelegatedAgentResolution>;
64
+ export declare function createAssignTaskTool(options: CreateDelegationToolsOptions): import("../../shared/types.ts").ToolDefinition<{
65
+ description: string;
66
+ agentId: string;
67
+ nickname: string;
68
+ task: string;
69
+ modelTier: "fast" | "balanced" | "powerful";
70
+ }, import("../../shared/types.ts").ToolOutputEnvelope, import("../../shared/types.ts").ToolOutputEnvelope, {
71
+ type: "object";
72
+ properties: {
73
+ agentId: {
74
+ type: "string";
75
+ description: string;
76
+ };
77
+ description: {
78
+ type: "string";
79
+ description: string;
80
+ };
81
+ nickname: {
82
+ type: "string";
83
+ description: string;
84
+ };
85
+ task: {
86
+ type: "string";
87
+ description: string;
88
+ };
89
+ modelTier: {
90
+ type: "string";
91
+ enum: ("fast" | "balanced" | "powerful")[];
92
+ description: string;
93
+ };
94
+ };
95
+ required: string[];
96
+ }>;
97
+ export declare const createDelegateToAgentTool: typeof createAssignTaskTool;
98
+ export declare function createDelegationTools(options: CreateDelegationToolsOptions): import("../../shared/types.ts").ToolDefinition<{
99
+ description: string;
100
+ agentId: string;
101
+ nickname: string;
102
+ task: string;
103
+ modelTier: "fast" | "balanced" | "powerful";
104
+ }, import("../../shared/types.ts").ToolOutputEnvelope, import("../../shared/types.ts").ToolOutputEnvelope, {
105
+ type: "object";
106
+ properties: {
107
+ agentId: {
108
+ type: "string";
109
+ description: string;
110
+ };
111
+ description: {
112
+ type: "string";
113
+ description: string;
114
+ };
115
+ nickname: {
116
+ type: "string";
117
+ description: string;
118
+ };
119
+ task: {
120
+ type: "string";
121
+ description: string;
122
+ };
123
+ modelTier: {
124
+ type: "string";
125
+ enum: ("fast" | "balanced" | "powerful")[];
126
+ description: string;
127
+ };
128
+ };
129
+ required: string[];
130
+ }>[];
131
+ export {};
132
+ //# sourceMappingURL=runtime-manager-tools.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ToolResult } from "../shared/types.ts";
1
+ import type { ToolResult } from "../../shared/types.ts";
2
2
  export interface ToolOutputOffloadOptions {
3
3
  maxBytes: number;
4
4
  sessionDir?: string;
@@ -1,4 +1,4 @@
1
- import type { AnyToolDefinition, InferJsonSchema, JsonObject, JsonSchemaObject, JsonValue, ToolDefinition, ToolDefinitionLifecycle, ToolExecutionContext, ToolOutputEnvelope, ToolOutputValue, ToolPermissionClass, ToolResultChunk, ToolResultContent, ToolSchema } from "../shared/types.ts";
1
+ import type { AnyToolDefinition, InferJsonSchema, JsonObject, JsonSchemaObject, JsonValue, ToolDefinition, ToolDefinitionLifecycle, ToolExecutionContext, ToolOutputEnvelope, ToolOutputValue, ToolPermissionClass, ToolResultChunk, ToolResultContent, ToolSchema } from "../../shared/types.ts";
2
2
  export declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
3
3
  export declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
4
4
  export declare class ToolExecutionError extends Error {
@@ -0,0 +1,53 @@
1
+ import type { Stats } from "node:fs";
2
+ import type { ToolExecutionContext, ToolOutputEnvelope } from "../../shared/types.ts";
3
+ import { type CanonicalFileEditBlock, type CanonicalFileOperation } from "./anchored-file-operations.ts";
4
+ import type { FileMutationCoordinator } from "./file-mutation-coordinator.ts";
5
+ import type { FileObservationStore } from "./file-observation-store.ts";
6
+ import { type AnchoredFileEditMode } from "./structured-file-edit-adapter.ts";
7
+ /**
8
+ * Upper bound on the canonical preview text an edit may produce. Authored
9
+ * replacement content is already bounded by the adapters; this bound also
10
+ * caps source-derived `oldText` when a huge range is deleted/replaced so the
11
+ * approval preview stays small enough to audit.
12
+ */
13
+ export declare const MAX_ANCHORED_PREVIEW_BYTES: number;
14
+ export interface CanonicalFileEditPreview {
15
+ mode: AnchoredFileEditMode;
16
+ filePath: string;
17
+ canonicalPath: string;
18
+ tag: string;
19
+ digest: string;
20
+ operationCount: number;
21
+ operations: readonly CanonicalFileOperation[];
22
+ blocks: readonly CanonicalFileEditBlock[];
23
+ }
24
+ export interface AnchoredFileEditEnvironment {
25
+ defaultCwd: string;
26
+ allowedDirs: readonly string[];
27
+ observations: FileObservationStore;
28
+ mutations: FileMutationCoordinator;
29
+ outputBudgetBytes: number;
30
+ }
31
+ export interface AnchoredFileEditStructuredResult {
32
+ preview: CanonicalFileEditPreview;
33
+ beforeDigest: string;
34
+ afterDigest: string;
35
+ beforeTag: string;
36
+ afterTag: string;
37
+ bytesWritten: number;
38
+ dryRun: boolean;
39
+ operationCount: number;
40
+ tokenClassification: "edit";
41
+ }
42
+ /**
43
+ * Filesystem seams for under-lock execution tests. Production callers omit the
44
+ * argument and receive the default Node filesystem backed by `atomicReplaceFile`.
45
+ */
46
+ export interface AnchoredFileEditFileSystem {
47
+ readFile(path: string): Promise<Buffer>;
48
+ stat(path: string): Promise<Stats>;
49
+ atomicWrite(target: string, bytes: Uint8Array, mode: number): Promise<void>;
50
+ }
51
+ export declare function prepareAnchoredFileEditApproval(mode: AnchoredFileEditMode, input: unknown, sessionId: string, environment: Omit<AnchoredFileEditEnvironment, "mutations">): Promise<CanonicalFileEditPreview>;
52
+ export declare function executeAnchoredFileEdit(mode: AnchoredFileEditMode, input: unknown, context: ToolExecutionContext, environment: AnchoredFileEditEnvironment, fileSystem?: AnchoredFileEditFileSystem): Promise<ToolOutputEnvelope>;
53
+ //# sourceMappingURL=anchored-file-edit.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { JsonValue } from "../../shared/types.ts";
2
+ import { ToolExecutionError } from "../core/tools.ts";
3
+ export type AnchoredFileErrorCode = "invalid_patch" | "unknown_snapshot" | "ambiguous_snapshot_tag" | "stale_snapshot" | "unseen_lines" | "invalid_range" | "overlapping_operations" | "no_change" | "write_failed" | "post_write_drift";
4
+ export declare function createAnchoredFileError(code: AnchoredFileErrorCode, message: string, structured?: Record<string, JsonValue>): ToolExecutionError;
5
+ //# sourceMappingURL=anchored-file-errors.d.ts.map
@@ -0,0 +1,38 @@
1
+ import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
2
+ export type CanonicalFileOperation = {
3
+ operation: "replace";
4
+ startLine: number;
5
+ endLine: number;
6
+ content: string;
7
+ } | {
8
+ operation: "delete";
9
+ startLine: number;
10
+ endLine: number;
11
+ } | {
12
+ operation: "insert";
13
+ position: "before" | "after";
14
+ line: number;
15
+ content: string;
16
+ };
17
+ export interface FileEditLineNumbers {
18
+ oldStartLine: number;
19
+ oldEndLine: number;
20
+ newStartLine: number;
21
+ newEndLine: number;
22
+ oldLineCount: number;
23
+ newLineCount: number;
24
+ }
25
+ export interface CanonicalFileEditBlock {
26
+ oldText: string;
27
+ newText: string;
28
+ lineNumbers: FileEditLineNumbers;
29
+ }
30
+ export interface PreparedCanonicalFileEdit {
31
+ afterText: string;
32
+ operations: readonly CanonicalFileOperation[];
33
+ blocks: readonly CanonicalFileEditBlock[];
34
+ requiredLines: readonly number[];
35
+ payloadDigest: string;
36
+ }
37
+ export declare function prepareCanonicalFileEdit(snapshot: NormalizedFileSnapshot, observedLines: ReadonlySet<number>, operations: readonly CanonicalFileOperation[]): PreparedCanonicalFileEdit;
38
+ //# sourceMappingURL=anchored-file-operations.d.ts.map
@@ -0,0 +1,37 @@
1
+ import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
2
+ export interface AnchoredReadFormatRequest {
3
+ displayPath: string;
4
+ snapshot: NormalizedFileSnapshot;
5
+ lineStart?: number;
6
+ lineEnd?: number;
7
+ maxBytes: number;
8
+ }
9
+ export interface AnchoredReadFormatResult {
10
+ output: string;
11
+ displayedLines: readonly number[];
12
+ lineStart?: number;
13
+ lineEnd?: number;
14
+ truncated: boolean;
15
+ nextLineStart?: number;
16
+ }
17
+ /**
18
+ * Format a normalized snapshot as byte-bounded `N:text` rows under a
19
+ * `[displayPath#TAG]` header.
20
+ *
21
+ * Bytes for the header and the deterministic truncation guidance are reserved
22
+ * before any numbered row is accepted, so the returned text never grows large
23
+ * enough for a later output-offload transformer to remove rows. Rows are never
24
+ * split: a row is accepted only when it and the worst-case guidance fit the
25
+ * budget. The displayed range follows exact FileRead's clamping/ordering.
26
+ * Provenance is returned separately (`displayedLines`) so the caller records
27
+ * exactly what the model saw after final formatting.
28
+ */
29
+ export declare function formatAnchoredFileRead(request: AnchoredReadFormatRequest): AnchoredReadFormatResult;
30
+ /**
31
+ * True when `text` renders within `maxColumns` terminal display columns.
32
+ * Width is measured with `string-width` (grapheme-aware display width), never
33
+ * JavaScript string length, so CJK, combining marks, and emoji sequences are
34
+ * counted the way a terminal renders them.
35
+ */
36
+ export declare function isWithinDisplayColumns(text: string, maxColumns: number): boolean;
37
+ //# sourceMappingURL=anchored-file-read.d.ts.map
@@ -0,0 +1,19 @@
1
+ export interface AtomicFileSystem {
2
+ writeFile(path: string, bytes: Uint8Array, options: {
3
+ mode: number;
4
+ }): Promise<void>;
5
+ chmod(path: string, mode: number): Promise<void>;
6
+ rename(from: string, to: string): Promise<void>;
7
+ rm(path: string, options: {
8
+ force: true;
9
+ }): Promise<void>;
10
+ }
11
+ /**
12
+ * Atomically replace `target` with `bytes`, preserving permission mode.
13
+ *
14
+ * Writes an unguessable same-directory temporary file, applies `mode & 0o7777`,
15
+ * renames it over the target, and unconditionally removes the temporary path
16
+ * in `finally` so every write/chmod/rename failure still cleans up.
17
+ */
18
+ export declare function atomicReplaceFile(target: string, bytes: Uint8Array, mode: number, fileSystem?: AtomicFileSystem): Promise<void>;
19
+ //# sourceMappingURL=atomic-file-write.d.ts.map
@@ -0,0 +1,166 @@
1
+ import type { FileMutationCoordinator } from "./file-mutation-coordinator.ts";
2
+ import type { FileObservationStore } from "./file-observation-store.ts";
3
+ import { type FileEditMode } from "./structured-file-edit-adapter.ts";
4
+ export interface FileEditToolOptions {
5
+ allowedDirs?: readonly string[];
6
+ defaultCwd?: string;
7
+ name?: string;
8
+ mode?: FileEditMode;
9
+ observations?: FileObservationStore;
10
+ mutations?: FileMutationCoordinator;
11
+ outputBudgetBytes?: number;
12
+ }
13
+ export declare function createFileEditTool(options?: FileEditToolOptions): import("../../shared/types.ts").ToolDefinition<{
14
+ tag: string;
15
+ filePath: string;
16
+ operations: ({
17
+ content: string;
18
+ operation: "replace";
19
+ startLine: number;
20
+ endLine: number;
21
+ line?: undefined;
22
+ position?: undefined;
23
+ } | {
24
+ operation: "delete";
25
+ startLine: number;
26
+ endLine: number;
27
+ content?: undefined;
28
+ line?: undefined;
29
+ position?: undefined;
30
+ } | {
31
+ content: string;
32
+ line: number;
33
+ position: "before" | "after";
34
+ operation: "insert";
35
+ startLine?: undefined;
36
+ endLine?: undefined;
37
+ })[];
38
+ description?: string | undefined;
39
+ dryRun?: boolean | undefined;
40
+ } | {
41
+ patch: string;
42
+ description?: string | undefined;
43
+ dryRun?: boolean | undefined;
44
+ }, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
45
+ readonly type: "object";
46
+ readonly properties: {
47
+ readonly filePath: {
48
+ readonly type: "string";
49
+ };
50
+ readonly tag: {
51
+ readonly type: "string";
52
+ };
53
+ readonly description: {
54
+ readonly type: "string";
55
+ };
56
+ readonly operations: {
57
+ readonly type: "array";
58
+ readonly items: {
59
+ readonly anyOf: readonly [{
60
+ readonly type: "object";
61
+ readonly properties: {
62
+ readonly operation: {
63
+ readonly type: "string";
64
+ readonly enum: readonly ["replace"];
65
+ };
66
+ readonly startLine: {
67
+ readonly type: "number";
68
+ };
69
+ readonly endLine: {
70
+ readonly type: "number";
71
+ };
72
+ readonly content: {
73
+ readonly type: "string";
74
+ };
75
+ };
76
+ readonly required: readonly ["operation", "startLine", "endLine", "content"];
77
+ readonly additionalProperties: false;
78
+ }, {
79
+ readonly type: "object";
80
+ readonly properties: {
81
+ readonly operation: {
82
+ readonly type: "string";
83
+ readonly enum: readonly ["delete"];
84
+ };
85
+ readonly startLine: {
86
+ readonly type: "number";
87
+ };
88
+ readonly endLine: {
89
+ readonly type: "number";
90
+ };
91
+ };
92
+ readonly required: readonly ["operation", "startLine", "endLine"];
93
+ readonly additionalProperties: false;
94
+ }, {
95
+ readonly type: "object";
96
+ readonly properties: {
97
+ readonly operation: {
98
+ readonly type: "string";
99
+ readonly enum: readonly ["insert"];
100
+ };
101
+ readonly position: {
102
+ readonly type: "string";
103
+ readonly enum: readonly ["before", "after"];
104
+ };
105
+ readonly line: {
106
+ readonly type: "number";
107
+ };
108
+ readonly content: {
109
+ readonly type: "string";
110
+ };
111
+ };
112
+ readonly required: readonly ["operation", "position", "line", "content"];
113
+ readonly additionalProperties: false;
114
+ }];
115
+ };
116
+ };
117
+ readonly dryRun: {
118
+ readonly type: "boolean";
119
+ };
120
+ };
121
+ readonly required: readonly ["filePath", "tag", "operations"];
122
+ readonly additionalProperties: false;
123
+ } | {
124
+ readonly type: "object";
125
+ readonly properties: {
126
+ readonly patch: {
127
+ readonly type: "string";
128
+ };
129
+ readonly description: {
130
+ readonly type: "string";
131
+ };
132
+ readonly dryRun: {
133
+ readonly type: "boolean";
134
+ };
135
+ };
136
+ readonly required: readonly ["patch"];
137
+ readonly additionalProperties: false;
138
+ }> | import("../../shared/types.ts").ToolDefinition<{
139
+ filePath: string;
140
+ oldText: string;
141
+ newText: string;
142
+ description?: string | undefined;
143
+ dryRun?: boolean | undefined;
144
+ }, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
145
+ type: "object";
146
+ properties: {
147
+ filePath: {
148
+ type: "string";
149
+ };
150
+ description: {
151
+ type: "string";
152
+ description: string;
153
+ };
154
+ oldText: {
155
+ type: "string";
156
+ };
157
+ newText: {
158
+ type: "string";
159
+ };
160
+ dryRun: {
161
+ type: "boolean";
162
+ };
163
+ };
164
+ required: readonly ["filePath", "oldText", "newText"];
165
+ }>;
166
+ //# sourceMappingURL=file-edit-tool.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Runtime-wide per-canonical-path async lock.
3
+ *
4
+ * One queued tail per canonical path; a new caller chains behind the live
5
+ * tail and becomes the new tail. The map entry is removed only when that
6
+ * exact tail settles, so a stale settled tail never blocks later callers and
7
+ * a rejected task cannot poison the queue.
8
+ */
9
+ export declare class FileMutationCoordinator {
10
+ private readonly tails;
11
+ runExclusive<T>(canonicalPath: string, signal: AbortSignal, task: () => Promise<T>): Promise<T>;
12
+ }
13
+ //# sourceMappingURL=file-mutation-coordinator.d.ts.map
@@ -1,12 +1,15 @@
1
+ import type { FileObservationStore } from "./file-observation-store.ts";
1
2
  export interface FileNewToolOptions {
2
3
  allowedDirs?: readonly string[];
3
4
  defaultCwd?: string;
4
5
  name?: string;
6
+ observations?: FileObservationStore;
7
+ anchored?: boolean;
5
8
  }
6
- export declare function createFileNewTool(options?: FileNewToolOptions): import("../shared/types.ts").ToolDefinition<{
9
+ export declare function createFileNewTool(options?: FileNewToolOptions): import("../../shared/types.ts").ToolDefinition<{
7
10
  content: string;
8
11
  filePath: string;
9
- }, import("../shared/types.ts").ToolOutputEnvelope, undefined, {
12
+ }, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
10
13
  type: "object";
11
14
  properties: {
12
15
  filePath: {
@@ -0,0 +1,40 @@
1
+ import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
2
+ export declare const FILE_OBSERVATION_LIMITS: {
3
+ readonly maxPaths: 30;
4
+ readonly maxVersionsPerPath: 4;
5
+ readonly maxSnapshotBytes: number;
6
+ };
7
+ export interface ObservedFileSnapshot {
8
+ snapshot: NormalizedFileSnapshot;
9
+ observedLines: ReadonlySet<number>;
10
+ }
11
+ export interface FileObservationStoreOptions {
12
+ limits?: {
13
+ maxPaths: number;
14
+ maxVersionsPerPath: number;
15
+ maxSnapshotBytes: number;
16
+ };
17
+ tagForDigest?: (digest: string) => string;
18
+ }
19
+ export declare class FileObservationStore {
20
+ private readonly limits;
21
+ private readonly tagForDigest?;
22
+ private sessionId;
23
+ private versionsByPath;
24
+ private recency;
25
+ private totalBytes;
26
+ private bytesByDigest;
27
+ private noChangeCounters;
28
+ constructor(options?: FileObservationStoreOptions);
29
+ bindSession(sessionId: string): void;
30
+ record(snapshot: NormalizedFileSnapshot, observedLines: readonly number[]): ObservedFileSnapshot;
31
+ resolve(canonicalPath: string, tag: string): ObservedFileSnapshot;
32
+ recordNoChange(canonicalPath: string, payloadDigest: string): number;
33
+ resetNoChange(canonicalPath: string): void;
34
+ clear(): void;
35
+ private touchPath;
36
+ private evictLeastRecentlyUsedPath;
37
+ private acquireBytes;
38
+ private releaseBytes;
39
+ }
40
+ //# sourceMappingURL=file-observation-store.d.ts.map