@myagentroam/agent 0.9.62 → 0.9.64

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 (119) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +4 -0
  3. package/dist/cli/codex-auth-file.js +268 -3
  4. package/dist/cli/main.js +427 -2
  5. package/dist/error.js +66 -2
  6. package/dist/host/contracts.js +20 -2
  7. package/dist/host/local-agent-host.js +146 -2
  8. package/dist/host/local-process-executor.js +39 -2
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +12 -2
  11. package/dist/model/anthropic-messages.js +474 -2
  12. package/dist/model/anthropic-thinking.js +33 -2
  13. package/dist/model/catalog-file.js +88 -2
  14. package/dist/model/configuration.js +137 -2
  15. package/dist/model/contracts.d.ts +2 -0
  16. package/dist/model/contracts.js +1 -2
  17. package/dist/model/http.js +529 -2
  18. package/dist/model/openai-responses.d.ts +2 -0
  19. package/dist/model/openai-responses.js +1602 -2
  20. package/dist/model/runtime-credential.js +35 -2
  21. package/dist/model/sse.js +199 -2
  22. package/dist/prompts/compact.js +25 -2
  23. package/dist/prompts/core.js +37 -2
  24. package/dist/prompts/execution-budget.js +10 -2
  25. package/dist/prompts/index.d.ts +3 -2
  26. package/dist/prompts/index.js +47 -2
  27. package/dist/prompts/modes.js +25 -2
  28. package/dist/prompts/output.js +1 -2
  29. package/dist/prompts/resources.d.ts +1 -1
  30. package/dist/prompts/resources.js +31 -2
  31. package/dist/prompts/subagent.d.ts +6 -0
  32. package/dist/prompts/subagent.js +29 -2
  33. package/dist/prompts/title.js +9 -2
  34. package/dist/prompts/workflow.js +32 -2
  35. package/dist/runtime/async-queue.js +62 -2
  36. package/dist/runtime/builtin-skills.js +19 -2
  37. package/dist/runtime/byted-ark-imagegen-skill.js +18 -2
  38. package/dist/runtime/codex-imagegen-skill.js +35 -2
  39. package/dist/runtime/compact.js +225 -2
  40. package/dist/runtime/context-gc-runtime.d.ts +35 -0
  41. package/dist/runtime/context-gc-runtime.js +163 -0
  42. package/dist/runtime/context-gc-tokens.d.ts +24 -0
  43. package/dist/runtime/context-gc-tokens.js +83 -0
  44. package/dist/runtime/context-gc.d.ts +66 -0
  45. package/dist/runtime/context-gc.js +909 -0
  46. package/dist/runtime/context-projection.d.ts +23 -0
  47. package/dist/runtime/context-projection.js +203 -0
  48. package/dist/runtime/environment-context.js +41 -2
  49. package/dist/runtime/execution-policy.js +13 -2
  50. package/dist/runtime/instructions.js +298 -2
  51. package/dist/runtime/normalize.js +40 -2
  52. package/dist/runtime/plan-output.js +95 -2
  53. package/dist/runtime/rollout-budget.d.ts +2 -0
  54. package/dist/runtime/rollout-budget.js +92 -2
  55. package/dist/runtime/token-budget.d.ts +2 -0
  56. package/dist/runtime/token-budget.js +44 -2
  57. package/dist/sdk/agent.js +1804 -2
  58. package/dist/sdk/types.d.ts +15 -5
  59. package/dist/sdk/types.js +1 -2
  60. package/dist/session/catalog.d.ts +5 -4
  61. package/dist/session/catalog.js +133 -2
  62. package/dist/session/context-gc-checkpoint.d.ts +148 -0
  63. package/dist/session/context-gc-checkpoint.js +665 -0
  64. package/dist/session/context-gc-replacements.d.ts +52 -0
  65. package/dist/session/context-gc-replacements.js +226 -0
  66. package/dist/session/context-gc-subagent.d.ts +43 -0
  67. package/dist/session/context-gc-subagent.js +267 -0
  68. package/dist/session/jsonl-store.d.ts +42 -4
  69. package/dist/session/jsonl-store.js +1657 -2
  70. package/dist/subagent/scheduler.d.ts +35 -2
  71. package/dist/subagent/scheduler.js +249 -2
  72. package/dist/subagent/session-controller.d.ts +94 -0
  73. package/dist/subagent/session-controller.js +675 -0
  74. package/dist/tools/agent-cancel.js +28 -2
  75. package/dist/tools/{task.d.ts → agent-message.d.ts} +2 -2
  76. package/dist/tools/agent-message.js +51 -0
  77. package/dist/tools/agent-start.js +84 -2
  78. package/dist/tools/agent-wait.js +53 -2
  79. package/dist/tools/apply-patch.js +478 -2
  80. package/dist/tools/code-mode.js +370 -2
  81. package/dist/tools/codex-image-gen.js +312 -2
  82. package/dist/tools/exec.js +455 -2
  83. package/dist/tools/execution-limits.d.ts +1 -0
  84. package/dist/tools/execution-limits.js +44 -2
  85. package/dist/tools/local-registry.js +233 -2
  86. package/dist/tools/local-workspace-tools.js +28 -2
  87. package/dist/tools/question.js +124 -2
  88. package/dist/tools/read-context.d.ts +16 -0
  89. package/dist/tools/read-context.js +85 -0
  90. package/dist/tools/read.d.ts +13 -0
  91. package/dist/tools/read.js +294 -2
  92. package/dist/tools/registry.js +76 -2
  93. package/dist/tools/runtime-context.d.ts +9 -2
  94. package/dist/tools/runtime-context.js +1 -2
  95. package/dist/tools/runtime.js +21 -2
  96. package/dist/tools/scheduler.js +41 -2
  97. package/dist/tools/shared/path-resolver.js +133 -2
  98. package/dist/tools/skill.js +37 -2
  99. package/dist/tools/todo-read.js +10 -2
  100. package/dist/tools/todo-write.js +65 -2
  101. package/dist/tools/todo.js +67 -2
  102. package/dist/tools/view-image.js +81 -2
  103. package/dist/tools/web-fetch.js +11 -2
  104. package/dist/tools/web-search.js +14 -2
  105. package/package.json +9 -7
  106. package/README.md +0 -3
  107. package/dist/runtime/prompt.d.ts +0 -9
  108. package/dist/runtime/prompt.js +0 -2
  109. package/dist/tools/shared/secret-redaction.d.ts +0 -4
  110. package/dist/tools/shared/secret-redaction.js +0 -2
  111. package/dist/tools/task-cancel.d.ts +0 -7
  112. package/dist/tools/task-cancel.js +0 -2
  113. package/dist/tools/task-output.d.ts +0 -7
  114. package/dist/tools/task-output.js +0 -2
  115. package/dist/tools/task-tools.d.ts +0 -36
  116. package/dist/tools/task-tools.js +0 -2
  117. package/dist/tools/task.js +0 -2
  118. package/dist/tools/todo-tools.d.ts +0 -25
  119. package/dist/tools/todo-tools.js +0 -2
@@ -1,2 +1,133 @@
1
- /* mar-release-protected */
2
- const _0x608599=_0x5efa;(function(_0x27493a,_0x18fee5){const _0x45224e=_0x5efa,_0x41f4d6=_0x27493a();while(!![]){try{const _0x5a238d=parseInt(_0x45224e(0x146))/(-0x4*0x4f2+-0x6*-0x199+0x175*0x7)*(parseInt(_0x45224e(0x13a))/(0xc5*0x2d+-0x432+0x1e6d*-0x1))+-parseInt(_0x45224e(0x161))/(-0x1*-0x5ef+0xead+0x1499*-0x1)*(parseInt(_0x45224e(0x156))/(0x1ba7*-0x1+0x452+0x1759))+parseInt(_0x45224e(0x14c))/(0xf5+0x1*-0x91e+0x82e)+parseInt(_0x45224e(0x15a))/(-0xd91+-0x1858+0x25ef)*(-parseInt(_0x45224e(0x158))/(-0x2386+0x7*0x351+0xc56))+parseInt(_0x45224e(0x14f))/(0x2158+-0x2*-0x463+0x150b*-0x2)*(parseInt(_0x45224e(0x142))/(-0x67d*-0x6+0x1e5f+0x7c*-0x8f))+parseInt(_0x45224e(0x13d))/(-0x1*0x3b7+0x132a+-0xf69*0x1)+parseInt(_0x45224e(0x144))/(0x1*0x282+-0x8ed+0x676);if(_0x5a238d===_0x18fee5)break;else _0x41f4d6['push'](_0x41f4d6['shift']());}catch(_0x189df4){_0x41f4d6['push'](_0x41f4d6['shift']());}}}(_0x33d9,0x63f2b*-0x1+0x3c356*0x1+0x193*0x4d5));import{lstat,realpath}from'node:fs/promises';import{dirname,isAbsolute,posix,relative,resolve,sep}from'node:path';import{MarAgentError}from'../../error.js';export class WorkspacePathResolver{[_0x608599(0x160)];#restrictPaths;#roots;#logicalWorkspacePath;constructor(_0xad1ba2,_0x4ebbb0={}){const _0x452abc=_0x608599;this[_0x452abc(0x160)]=resolve(_0xad1ba2),this.#restrictPaths=_0x4ebbb0[_0x452abc(0x15f)]===!![],this.#roots=[{'physicalPath':this[_0x452abc(0x160)],'writable':_0x4ebbb0[_0x452abc(0x135)]!==![]},...(_0x4ebbb0[_0x452abc(0x152)]??[])[_0x452abc(0x13f)](_0x260709=>({'logicalPath':logicalRoot(_0x260709[_0x452abc(0x14a)]),'physicalPath':resolve(_0x260709[_0x452abc(0x132)]),'writable':_0x260709[_0x452abc(0x134)]}))];const _0xf52f92=this.#roots[_0x452abc(0x14b)](_0x2c908f=>_0x2c908f[_0x452abc(0x14a)]===undefined?[]:[_0x2c908f[_0x452abc(0x14a)]])[_0x452abc(0x151)]();if(new Set(_0xf52f92)[_0x452abc(0x14e)]!==_0xf52f92[_0x452abc(0x13e)])throw denied(_0x452abc(0x145));const _0x106bd4=this.#roots[_0x452abc(0x143)](_0x3553ad=>_0x3553ad[_0x452abc(0x14a)]!==undefined);for(const [_0x498470,_0x2c892b]of _0x106bd4[_0x452abc(0x153)]()){if(_0x106bd4[_0x452abc(0x154)](_0x498470+(-0x2b*0x1f+-0x1ffb+0x2531))[_0x452abc(0x140)](_0x5bb205=>_0x5bb205[_0x452abc(0x132)]===_0x2c892b[_0x452abc(0x132)]&&_0x5bb205[_0x452abc(0x134)]!==_0x2c892b[_0x452abc(0x134)]))throw denied(_0x452abc(0x133));}this.#logicalWorkspacePath=_0x106bd4[_0x452abc(0x147)](_0x5e3948=>_0x5e3948[_0x452abc(0x132)]===this[_0x452abc(0x160)])?.[_0x452abc(0x14a)];}async[_0x608599(0x131)](_0x445607,_0x2e7919=![],_0x13bd4f=_0x608599(0x15b)){const _0x35c223=_0x608599;return(await this[_0x35c223(0x148)](_0x445607,_0x2e7919,_0x13bd4f))[_0x35c223(0x132)];}async[_0x608599(0x148)](_0x3ce2f2,_0x255b88=![],_0x3c6d7f=_0x608599(0x15b)){const _0x4e5645=_0x608599,_0x4bc22c=this.#select(_0x3ce2f2);if(_0x3c6d7f===_0x4e5645(0x155)&&!_0x4bc22c[_0x4e5645(0x160)][_0x4e5645(0x134)])throw denied(_0x4e5645(0x139));const _0x13f914=_0x4bc22c[_0x4e5645(0x149)];if(this.#restrictPaths&&!withinOrEqual(_0x4bc22c[_0x4e5645(0x160)][_0x4e5645(0x132)],_0x13f914))throw denied(_0x4e5645(0x15e));try{const _0x14118a=await realpath(_0x13f914);await lstat(_0x14118a);if(this.#restrictPaths&&!withinOrEqual(await realpath(_0x4bc22c[_0x4e5645(0x160)][_0x4e5645(0x132)]),_0x14118a))throw denied(_0x4e5645(0x13c));}catch(_0x3a087e){if(_0x3a087e instanceof MarAgentError)throw _0x3a087e;if(!_0x255b88)throw _0x3a087e;const _0x2ce0e1=await nearestExistingParent(dirname(_0x13f914));if(this.#restrictPaths&&!withinOrEqual(await realpath(_0x4bc22c[_0x4e5645(0x160)][_0x4e5645(0x132)]),await realpath(_0x2ce0e1)))throw denied(_0x4e5645(0x13c));}return{'physicalPath':_0x13f914,'displayPath':this.#display(_0x4bc22c)};}#select(_0x14b643){const _0x19b084=_0x608599;if(!isAbsolute(_0x14b643)){if(this.#logicalWorkspacePath!==undefined)return this.#selectAbsolute(posix[_0x19b084(0x150)](this.#logicalWorkspacePath,_0x14b643[_0x19b084(0x159)]('\x5c','/')));const _0xd7ca95=this.#roots[-0x97*0x3e+0x23a9+0xe9];return{'root':_0xd7ca95,'target':resolve(_0xd7ca95[_0x19b084(0x132)],_0x14b643)};}return this.#selectAbsolute(_0x14b643);}#display(_0x2a21c5){const _0x1cda88=_0x608599;if(_0x2a21c5[_0x1cda88(0x160)][_0x1cda88(0x14a)]===undefined)return _0x2a21c5[_0x1cda88(0x149)];const _0x4914f4=relative(_0x2a21c5[_0x1cda88(0x160)][_0x1cda88(0x132)],_0x2a21c5[_0x1cda88(0x149)])[_0x1cda88(0x137)](sep)[_0x1cda88(0x143)](Boolean);return _0x4914f4[_0x1cda88(0x13e)]===-0x10de+-0x3b8*0x9+0x1*0x3256?_0x2a21c5[_0x1cda88(0x160)][_0x1cda88(0x14a)]:posix[_0x1cda88(0x150)](_0x2a21c5[_0x1cda88(0x160)][_0x1cda88(0x14a)],..._0x4914f4);}#selectAbsolute(_0x4c48b9){const _0x54b667=_0x608599,_0x16e29e=posix[_0x54b667(0x15d)](_0x4c48b9[_0x54b667(0x159)]('\x5c','/')),_0x64d5bd=this.#roots[_0x54b667(0x143)](_0xfce049=>_0xfce049[_0x54b667(0x14a)]!==undefined)[_0x54b667(0x151)]((_0x209926,_0x3028c1)=>_0x3028c1[_0x54b667(0x14a)][_0x54b667(0x13e)]-_0x209926[_0x54b667(0x14a)][_0x54b667(0x13e)])[_0x54b667(0x147)](_0x32bea7=>_0x16e29e===_0x32bea7[_0x54b667(0x14a)]||_0x16e29e[_0x54b667(0x136)](_0x32bea7[_0x54b667(0x14a)]+'/'));if(_0x64d5bd!==undefined){const _0x3dc2ee=_0x16e29e[_0x54b667(0x154)](_0x64d5bd[_0x54b667(0x14a)][_0x54b667(0x13e)])[_0x54b667(0x14d)](/^\/+/u,'');return{'root':_0x64d5bd,'target':resolve(_0x64d5bd[_0x54b667(0x132)],..._0x3dc2ee[_0x54b667(0x137)]('/')[_0x54b667(0x143)](Boolean))};}if(this.#restrictPaths)throw denied(_0x54b667(0x15e));return{'root':{'physicalPath':dirname(resolve(_0x4c48b9)),'writable':!![]},'target':resolve(_0x4c48b9)};}}function logicalRoot(_0x39bab0){const _0x2a653c=_0x608599,_0x95e3ff=posix[_0x2a653c(0x15d)](_0x39bab0[_0x2a653c(0x159)]('\x5c','/'));if(!_0x95e3ff[_0x2a653c(0x136)]('/')||_0x95e3ff==='/'||_0x95e3ff[_0x2a653c(0x141)]('\x00'))throw denied(_0x2a653c(0x13b));return _0x95e3ff[_0x2a653c(0x14d)](/\/+$/u,'');}function _0x5efa(_0x24ec29,_0x945b01){_0x24ec29=_0x24ec29-(0xa51*-0x1+-0x1*-0x126d+-0x6eb);const _0x34c27d=_0x33d9();let _0x29a023=_0x34c27d[_0x24ec29];if(_0x5efa['jbuLCS']===undefined){var _0x56c03b=function(_0x165be9){const _0x2039e0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x406eca='',_0x545bdf='';for(let _0x2a3a1f=0x50b+0x12ff+-0x180a,_0x480731,_0x17fd30,_0x3a5621=0x200+-0x143d+0x123d;_0x17fd30=_0x165be9['charAt'](_0x3a5621++);~_0x17fd30&&(_0x480731=_0x2a3a1f%(0x23a9+0x402+-0x27a7)?_0x480731*(-0x10de+-0x3b8*0x9+0x1*0x3296)+_0x17fd30:_0x17fd30,_0x2a3a1f++%(-0x1e35+0x1970+0x4c9))?_0x406eca+=String['fromCharCode'](-0x1*0x28f+0x49f*0x1+-0x1*0x111&_0x480731>>(-(-0x16e6+0xad*0x10+0xc18)*_0x2a3a1f&-0x16a1+0x87a+0xe2d)):-0xe9*0x5+-0x2354+0x27e1){_0x17fd30=_0x2039e0['indexOf'](_0x17fd30);}for(let _0x4dd741=0x5*-0x279+-0x21*-0x3+0x6*0x1ff,_0x2e90ac=_0x406eca['length'];_0x4dd741<_0x2e90ac;_0x4dd741++){_0x545bdf+='%'+('00'+_0x406eca['charCodeAt'](_0x4dd741)['toString'](-0x1f26+-0x1*-0xfb5+-0x3f*-0x3f))['slice'](-(-0x127d*-0x1+0x2af*-0x7+0x1a*0x3));}return decodeURIComponent(_0x545bdf);};_0x5efa['jUdimU']=_0x56c03b,_0x5efa['kvebNI']={},_0x5efa['jbuLCS']=!![];}const _0x4f9ce0=_0x34c27d[0xbdb+0x7*-0x124+0x3df*-0x1];_0x5efa['xBmQsr']!==_0x4f9ce0&&(_0x5efa['kvebNI']={},_0x5efa['xBmQsr']=_0x4f9ce0);const _0x5c9be0=_0x5efa['kvebNI'][_0x24ec29];return _0x5c9be0===undefined?(_0x29a023=_0x5efa['jUdimU'](_0x29a023),_0x5efa['kvebNI'][_0x24ec29]=_0x29a023):_0x29a023=_0x5c9be0,_0x29a023;}function withinOrEqual(_0x4683b6,_0x3b30b3){const _0x4997ee=_0x608599,_0x9ac612=relative(_0x4683b6,_0x3b30b3);return _0x9ac612===''||_0x9ac612!=='..'&&!_0x9ac612[_0x4997ee(0x136)]('..'+sep);}function _0x33d9(){const _0x5f0764=['mtu4CKPuEe5U','tg9NAwnHBcbTB3vUDcbWyxrOigLZigLUDMfSAwqU','vgHLihjLCxvLC3rLzcbWyxrOigvZy2fWzxmGDgHLigfSBg93zwqGCM9VDc4','ndy5mJq0mgTiq21osG','BgvUz3rO','BwfW','C29Tzq','Aw5JBhvKzxm','ovnqELzQza','zMLSDgvY','ody5mdmZs0r1ufvK','tg9NAwnHBcbTB3vUDcbWyxrOCYbTDxn0igjLihvUAxf1zs4','ndaYm0n3vLjzBq','zMLUza','CMvZB2X2zvDPDgHeAxnWBgf5','DgfYz2v0','Bg9NAwnHBfbHDgG','zMXHDe1HCa','mteZmZiYmg5xrefcDq','CMvWBgfJzq','C2L6zq','otmWnJrtzK9dB0u','AM9PBG','C29YDa','Bw91BNrZ','zw50CMLLCW','C2XPy2u','D3jPDgu','mZiYoti4q1bTqLPv','y29Kzq','nJiZotq1DhDuCMLy','CMvWBgfJzufSBa','mZbpvw1HzKO','CMvHza','ru5pru5u','BM9YBwfSAxPL','vgHLihjLCxvLC3rLzcbWyxrOigLZig91DhnPzguGDgHLigfSBg93zwqGCM9VDhmU','CMvZDhjPy3rqyxrOCW','CM9VDa','mtjguxPXrgu','CMvZB2X2zq','CgH5C2LJywXqyxrO','tg9NAwnHBcbHBgLHC2vZigzVCIbVBMuGCgH5C2LJywWGCgf0AcbTDxn0ihvZzsb0AguGC2fTzsbHy2nLC3mGBw9Kzs4','D3jPDgfIBgu','CM9VDfDYAxrHyMXL','C3rHCNrZv2L0Aa','C3bSAxq','tufsx0fhru5ux0zjtevFqundrvntx0rftKLfra','vgHLihjLCxvLC3rLzcbWyxrOigLZihjLywqTB25SEs4'];_0x33d9=function(){return _0x5f0764;};return _0x33d9();}async function nearestExistingParent(_0x42dba6){const _0x1d7fe3=_0x608599;let _0x11e179=_0x42dba6;for(;;){try{return await lstat(_0x11e179),_0x11e179;}catch(_0x3b8da6){if(_0x3b8da6[_0x1d7fe3(0x157)]!==_0x1d7fe3(0x15c))throw _0x3b8da6;const _0x22bed8=dirname(_0x11e179);if(_0x22bed8===_0x11e179)throw _0x3b8da6;_0x11e179=_0x22bed8;}}}function denied(_0x46bc44){const _0x51329f=_0x608599;return new MarAgentError(_0x51329f(0x138),_0x46bc44);}
1
+ import { lstat, realpath } from 'node:fs/promises';
2
+ import { dirname, isAbsolute, posix, relative, resolve, sep } from 'node:path';
3
+ import { MarAgentError } from '../../error.js';
4
+ export class WorkspacePathResolver {
5
+ root;
6
+ #restrictPaths;
7
+ #roots;
8
+ #logicalWorkspacePath;
9
+ constructor(root, options = {}) {
10
+ this.root = resolve(root);
11
+ this.#restrictPaths = options.restrictPaths === true;
12
+ this.#roots = [
13
+ { physicalPath: this.root, writable: options.rootWritable !== false },
14
+ ...(options.mounts ?? []).map((mount) => ({
15
+ logicalPath: logicalRoot(mount.logicalPath),
16
+ physicalPath: resolve(mount.physicalPath),
17
+ writable: mount.writable
18
+ }))
19
+ ];
20
+ const logicalPaths = this.#roots
21
+ .flatMap((candidate) => (candidate.logicalPath === undefined ? [] : [candidate.logicalPath]))
22
+ .sort();
23
+ if (new Set(logicalPaths).size !== logicalPaths.length)
24
+ throw denied('Logical mount paths must be unique.');
25
+ const logicalMounts = this.#roots.filter((candidate) => candidate.logicalPath !== undefined);
26
+ for (const [index, mount] of logicalMounts.entries()) {
27
+ if (logicalMounts
28
+ .slice(index + 1)
29
+ .some((candidate) => candidate.physicalPath === mount.physicalPath && candidate.writable !== mount.writable))
30
+ throw denied('Logical aliases for one physical path must use the same access mode.');
31
+ }
32
+ this.#logicalWorkspacePath = logicalMounts.find((candidate) => candidate.physicalPath === this.root)?.logicalPath;
33
+ }
34
+ async resolve(input, allowMissing = false, access = 'read') {
35
+ return (await this.resolveWithDisplay(input, allowMissing, access)).physicalPath;
36
+ }
37
+ async resolveWithDisplay(input, allowMissing = false, access = 'read') {
38
+ const selected = this.#select(input);
39
+ if (access === 'write' && !selected.root.writable)
40
+ throw denied('The requested path is read-only.');
41
+ const target = selected.target;
42
+ if (this.#restrictPaths && !withinOrEqual(selected.root.physicalPath, target))
43
+ throw denied('The requested path is outside the allowed roots.');
44
+ try {
45
+ const resolved = await realpath(target);
46
+ await lstat(resolved);
47
+ if (this.#restrictPaths &&
48
+ !withinOrEqual(await realpath(selected.root.physicalPath), resolved))
49
+ throw denied('The requested path escapes the allowed root.');
50
+ }
51
+ catch (error) {
52
+ if (error instanceof MarAgentError)
53
+ throw error;
54
+ if (!allowMissing)
55
+ throw error;
56
+ const parent = await nearestExistingParent(dirname(target));
57
+ if (this.#restrictPaths &&
58
+ !withinOrEqual(await realpath(selected.root.physicalPath), await realpath(parent)))
59
+ throw denied('The requested path escapes the allowed root.');
60
+ }
61
+ return {
62
+ physicalPath: target,
63
+ displayPath: this.#display(selected)
64
+ };
65
+ }
66
+ #select(input) {
67
+ if (!isAbsolute(input)) {
68
+ if (this.#logicalWorkspacePath !== undefined)
69
+ return this.#selectAbsolute(posix.join(this.#logicalWorkspacePath, input.replaceAll('\\', '/')));
70
+ const root = this.#roots[0];
71
+ return { root, target: resolve(root.physicalPath, input) };
72
+ }
73
+ return this.#selectAbsolute(input);
74
+ }
75
+ #display(selected) {
76
+ if (selected.root.logicalPath === undefined)
77
+ return selected.target;
78
+ const suffix = relative(selected.root.physicalPath, selected.target).split(sep).filter(Boolean);
79
+ return suffix.length === 0
80
+ ? selected.root.logicalPath
81
+ : posix.join(selected.root.logicalPath, ...suffix);
82
+ }
83
+ #selectAbsolute(input) {
84
+ const normalized = posix.normalize(input.replaceAll('\\', '/'));
85
+ const mount = this.#roots
86
+ .filter((candidate) => candidate.logicalPath !== undefined)
87
+ .sort((left, right) => right.logicalPath.length - left.logicalPath.length)
88
+ .find((candidate) => normalized === candidate.logicalPath || normalized.startsWith(`${candidate.logicalPath}/`));
89
+ if (mount !== undefined) {
90
+ const suffix = normalized.slice(mount.logicalPath.length).replace(/^\/+/u, '');
91
+ return {
92
+ root: mount,
93
+ target: resolve(mount.physicalPath, ...suffix.split('/').filter(Boolean))
94
+ };
95
+ }
96
+ if (this.#restrictPaths)
97
+ throw denied('The requested path is outside the allowed roots.');
98
+ return {
99
+ root: { physicalPath: dirname(resolve(input)), writable: true },
100
+ target: resolve(input)
101
+ };
102
+ }
103
+ }
104
+ function logicalRoot(value) {
105
+ const normalized = posix.normalize(value.replaceAll('\\', '/'));
106
+ if (!normalized.startsWith('/') || normalized === '/' || normalized.includes('\0'))
107
+ throw denied('Logical mount path is invalid.');
108
+ return normalized.replace(/\/+$/u, '');
109
+ }
110
+ function withinOrEqual(parent, candidate) {
111
+ const relation = relative(parent, candidate);
112
+ return relation === '' || (relation !== '..' && !relation.startsWith(`..${sep}`));
113
+ }
114
+ async function nearestExistingParent(path) {
115
+ let candidate = path;
116
+ for (;;) {
117
+ try {
118
+ await lstat(candidate);
119
+ return candidate;
120
+ }
121
+ catch (error) {
122
+ if (error.code !== 'ENOENT')
123
+ throw error;
124
+ const parent = dirname(candidate);
125
+ if (parent === candidate)
126
+ throw error;
127
+ candidate = parent;
128
+ }
129
+ }
130
+ }
131
+ function denied(message) {
132
+ return new MarAgentError('MAR_AGENT_FILE_ACCESS_DENIED', message);
133
+ }
@@ -1,2 +1,37 @@
1
- /* mar-release-protected */
2
- const _0x2df1be=_0x3e71;(function(_0x1d09c6,_0x11d5f0){const _0x1318bc=_0x3e71,_0x34e92f=_0x1d09c6();while(!![]){try{const _0x3e2a7d=parseInt(_0x1318bc(0xe5))/(0x215d*0x1+0x43*-0xd+-0x1df5*0x1)+-parseInt(_0x1318bc(0xf2))/(-0x1e42+-0x8c*0x40+0x4144)*(-parseInt(_0x1318bc(0xff))/(0x10e*0x7+-0x11bf+0xa60))+parseInt(_0x1318bc(0xe7))/(-0x26b7+0x1769+0xf52)*(-parseInt(_0x1318bc(0xe8))/(0x5a*0x1b+-0x644*0x3+0x1f*0x4d))+-parseInt(_0x1318bc(0xec))/(0x19a4+0x942*-0x1+-0x105c)+parseInt(_0x1318bc(0xf0))/(-0x10f*-0x17+0x2106+-0x3958)+parseInt(_0x1318bc(0xfd))/(-0x174*0x4+0xa33+-0x45b)+parseInt(_0x1318bc(0xe6))/(0x5*0x4cd+-0x18c6+0x2*0x67);if(_0x3e2a7d===_0x11d5f0)break;else _0x34e92f['push'](_0x34e92f['shift']());}catch(_0x2e58b3){_0x34e92f['push'](_0x34e92f['shift']());}}}(_0x2b4e,-0x433b9+0x2b56d+0x469db));import{MarAgentError}from'../error.js';import{agentSkillSource,loadAgentSkill}from'../runtime/instructions.js';export const skillToolDefinition={'name':_0x2df1be(0xf4),'parallelSafety':_0x2df1be(0xfc),'description':_0x2df1be(0xeb),'inputSchema':{'type':_0x2df1be(0xf6),'properties':{'name':{'type':_0x2df1be(0xee),'minLength':0x1,'maxLength':0x80}},'required':[_0x2df1be(0x101)],'additionalProperties':![]}};function _0x3e71(_0xf13e16,_0x1730ba){_0xf13e16=_0xf13e16-(0x3a3+-0x1c9e*-0x1+-0x4*0x7d7);const _0x99ac4a=_0x2b4e();let _0x1d2c3b=_0x99ac4a[_0xf13e16];if(_0x3e71['ueGcOy']===undefined){var _0x2bfa8d=function(_0x548b0){const _0x586844='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2b8893='',_0x38a240='';for(let _0x5f4ad6=-0x26d3+0x14*-0x1b1+0x48a7,_0x4a4127,_0x4f7095,_0x4470c8=-0x11f0+0x112c+0x62*0x2;_0x4f7095=_0x548b0['charAt'](_0x4470c8++);~_0x4f7095&&(_0x4a4127=_0x5f4ad6%(0x4*-0x653+0x2*-0x8d3+0x2af6)?_0x4a4127*(-0x960+-0x20f0+0xaa4*0x4)+_0x4f7095:_0x4f7095,_0x5f4ad6++%(0x57*-0x55+-0x223c+-0x905*-0x7))?_0x2b8893+=String['fromCharCode'](0x2176+0x15ac+-0x3623&_0x4a4127>>(-(-0xdb4+0x2e*-0x8a+0x3*0xcd6)*_0x5f4ad6&-0x3ef*0x5+-0x123d+0x25ee)):0x1*0x134b+0xb83+-0x1ece){_0x4f7095=_0x586844['indexOf'](_0x4f7095);}for(let _0x13e522=0x1fa9+-0x3d*0x62+-0x84f*0x1,_0xac1a5d=_0x2b8893['length'];_0x13e522<_0xac1a5d;_0x13e522++){_0x38a240+='%'+('00'+_0x2b8893['charCodeAt'](_0x13e522)['toString'](-0x1853*-0x1+0xb01*-0x1+-0xd42*0x1))['slice'](-(-0x241d+0x3*0x61f+0x11c2));}return decodeURIComponent(_0x38a240);};_0x3e71['ONVLuG']=_0x2bfa8d,_0x3e71['tuqIIq']={},_0x3e71['ueGcOy']=!![];}const _0x526618=_0x99ac4a[-0x11ca+-0x9dc*0x1+-0x1ba6*-0x1];_0x3e71['twQESQ']!==_0x526618&&(_0x3e71['tuqIIq']={},_0x3e71['twQESQ']=_0x526618);const _0x8395=_0x3e71['tuqIIq'][_0xf13e16];return _0x8395===undefined?(_0x1d2c3b=_0x3e71['ONVLuG'](_0x1d2c3b),_0x3e71['tuqIIq'][_0xf13e16]=_0x1d2c3b):_0x1d2c3b=_0x8395,_0x1d2c3b;}export async function executeSkill(_0x2fc0eb,_0x35e12f){const _0x3f5ee2=_0x2df1be;_0x35e12f[_0x3f5ee2(0xfa)][_0x3f5ee2(0xea)]();if(_0x2fc0eb===null||typeof _0x2fc0eb!==_0x3f5ee2(0xf6)||Array[_0x3f5ee2(0xf7)](_0x2fc0eb))throw new MarAgentError(_0x3f5ee2(0x100),_0x3f5ee2(0xef));const _0x1beec9=_0x2fc0eb;if(typeof _0x1beec9[_0x3f5ee2(0x101)]!==_0x3f5ee2(0xee)||_0x1beec9[_0x3f5ee2(0x101)][_0x3f5ee2(0xfb)]===0x17c4+0x10a8+-0x1436*0x2||_0x1beec9[_0x3f5ee2(0x101)][_0x3f5ee2(0xfb)]>-0x3a9*0x7+0x1512+0x3*0x1af||Object[_0x3f5ee2(0xf5)](_0x1beec9)[_0x3f5ee2(0xf3)](_0x19b9d0=>_0x19b9d0!==_0x3f5ee2(0x101)))throw new MarAgentError(_0x3f5ee2(0x100),_0x3f5ee2(0xe9));const _0x243f0c=_0x35e12f[_0x3f5ee2(0xfe)][_0x3f5ee2(0xf1)](_0x1beec9[_0x3f5ee2(0x101)]);if(!_0x243f0c)throw new MarAgentError(_0x3f5ee2(0x100),_0x3f5ee2(0xf9));const _0x77ceb9=await loadAgentSkill(_0x243f0c);if(!_0x77ceb9)throw new MarAgentError(_0x3f5ee2(0x100),_0x3f5ee2(0xed));return _0x35e12f[_0x3f5ee2(0xfa)][_0x3f5ee2(0xea)](),{'content':_0x77ceb9,'data':{'name':_0x243f0c[_0x3f5ee2(0x101)],'description':_0x243f0c[_0x3f5ee2(0xf8)],'source':agentSkillSource(_0x243f0c)}};}function _0x2b4e(){const _0x56559c=['DgHYB3DjzKfIB3j0zwq','tg9HzcbHihnWzwnPywXPEMvKifnRAwXSihDOzw4GDgHLihrHC2SGBwf0y2HLCYbVBMuGBgLZDgvKigLUihrOzsbZExn0zw0GChjVBxb0lIbszxr1CM5ZigL0CYbPBNn0CNvJDgLVBNmGyw5KihnVDxjJztSGzMLSzs1IyxnLzcbtA2LSBhmGywXZBYbPBMnSDwrLigeGyMfZzsbKAxjLy3rVCNKGyw5KihjLC291CMnLlxbHDgGGC2fTCgXLlIbtreSGyNvPBhqTAw5ZigHHDMuGBM8GzMLSzxn5C3rLBsbIyxnLlIbuAguGBMfTzsbTDxn0igv4ywn0BhKGBwf0y2GGDgHLigfKDMvYDgLZzwqGy2f0ywXVzY4','mJaXmJq3mLHuywjnAa','u2TPBgWGy291BgqGBM90igjLigXVywrLzc4','C3rYAw5N','u2TPBgWGAw5WDxqGBxvZDcbIzsbHBIbVyMPLy3qU','ndGZnZKXwK1QB3r2','z2v0','ndq0nM1UqwrVBa','C29Tzq','C2TPBgW','A2v5CW','B2jQzwn0','AxnbCNjHEq','zgvZy3jPChrPB24','u2TPBgWGAxmGBM90igf2ywLSywjSzs4','C2LNBMfS','BgvUz3rO','C2fMzq','mtu1nZuZnLjIuMjPBq','C2TPBgXZ','ndi5tuHtqxzU','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','BMfTzq','mtKXotGZAMTls1ne','mZi1mtG4zNb4u2fH','nty2mdq0vMT1sg9g','mtbKuxnnz0m','u2TPBgWGAw5WDxqGAxmGAw52ywXPzc4'];_0x2b4e=function(){return _0x56559c;};return _0x2b4e();}
1
+ import { MarAgentError } from '../error.js';
2
+ import { agentSkillSource, loadAgentSkill } from '../runtime/instructions.js';
3
+ export const skillToolDefinition = {
4
+ name: 'skill',
5
+ parallelSafety: 'safe',
6
+ description: 'Load a specialized Skill when the task matches one listed in the system prompt. Returns its instructions and source; file-based Skills also include a base directory and resource-path sample. SDK built-ins have no filesystem base. The name must exactly match the advertised catalog.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ name: { type: 'string', minLength: 1, maxLength: 128 }
11
+ },
12
+ required: ['name'],
13
+ additionalProperties: false
14
+ }
15
+ };
16
+ export async function executeSkill(arguments_, context) {
17
+ context.signal.throwIfAborted();
18
+ if (arguments_ === null || typeof arguments_ !== 'object' || Array.isArray(arguments_))
19
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Skill input must be an object.');
20
+ const input = arguments_;
21
+ if (typeof input.name !== 'string' ||
22
+ input.name.length === 0 ||
23
+ input.name.length > 128 ||
24
+ Object.keys(input).some((key) => key !== 'name'))
25
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Skill input is invalid.');
26
+ const skill = context.skills.get(input.name);
27
+ if (!skill)
28
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Skill is not available.');
29
+ const content = await loadAgentSkill(skill);
30
+ if (!content)
31
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Skill could not be loaded.');
32
+ context.signal.throwIfAborted();
33
+ return {
34
+ content,
35
+ data: { name: skill.name, description: skill.description, source: agentSkillSource(skill) }
36
+ };
37
+ }
@@ -1,2 +1,10 @@
1
- /* mar-release-protected */
2
- const _0x4e4801=_0x114e;function _0xf4c8(){const _0x53eab9=['odq0mdi2mfHKqvPJAW','C3rYAw5NAwz5','ndG2odeXthDArM93','B2jQzwn0','uMvHzcb0AgLZihnLC3nPB27IGjLZign1CNjLBNqGvg9KBYbYzxzPC2LVBIbHBMqGAxrLBxmUifvZzsbIzwzVCMuGDxbKyxrPBMCGD2HLBIb0AguGCMv2AxnPB24GBwf5igHHDMuGy2HHBMDLzc4Grg8GBM90ihjLywqGyw4Gzw1WDhKGB3iGBMv3ifrVzg8GBwvYzwX5ihrVigrLy2LKzsb3Agv0AgvYihn0CMfPz2H0zM9YD2fYzcbIB3vUzgvKihDVCMSGBMvLzhmGB25LlG','mZbYA3b4vgO','CMvHza','Dg9KB19YzwfK','mtq4nte1B3LTDfzU','nJn0zffHs1i','odi3nZe0n0nMuhzoEq','nZzNBgf4wvu','Dg9KBW','mtq2mdqWv0HICxLQ','C2fMzq','CMvZB2X2zq','nda3nduWodbwwurJDuS','mte3mtm5mKrHwujRDa'];_0xf4c8=function(){return _0x53eab9;};return _0xf4c8();}(function(_0x226ba7,_0xaef11a){const _0x32ce39=_0x114e,_0xac616a=_0x226ba7();while(!![]){try{const _0x3aeb01=parseInt(_0x32ce39(0x1ec))/(-0xd*0x1b5+-0x88c+0x1ebe)+-parseInt(_0x32ce39(0x1dd))/(-0x14cb+0x252+0xf9*0x13)*(parseInt(_0x32ce39(0x1e5))/(-0x3*0x133+-0x1381*0x1+0x171d))+-parseInt(_0x32ce39(0x1e3))/(-0x22ae+-0x19e2+-0x4*-0xf25)*(-parseInt(_0x32ce39(0x1e0))/(0x3*-0x432+-0xf01+0x1b9c))+-parseInt(_0x32ce39(0x1ea))/(-0x110*-0x1+0x1*-0xc83+0xb79*0x1)+-parseInt(_0x32ce39(0x1e1))/(-0x79*0x17+-0x1*0x1e71+-0x13*-0x22d)*(parseInt(_0x32ce39(0x1e9))/(0x1aec+-0x1c18+0x134))+-parseInt(_0x32ce39(0x1e2))/(0x419*-0x3+-0x1*0x1f87+-0x67*-0x6d)+parseInt(_0x32ce39(0x1e8))/(0x1*0xd6e+-0x1279+-0x1*-0x515);if(_0x3aeb01===_0xaef11a)break;else _0xac616a['push'](_0xac616a['shift']());}catch(_0x3c4e96){_0xac616a['push'](_0xac616a['shift']());}}}(_0xf4c8,0xbb70e+0x678e2+-0x6b94d));function _0x114e(_0x26650f,_0x43b002){_0x26650f=_0x26650f-(0x1cfc+-0xf1a+-0x1*0xc07);const _0x149af2=_0xf4c8();let _0x2541c4=_0x149af2[_0x26650f];if(_0x114e['aWingU']===undefined){var _0x512a1f=function(_0x841e2b){const _0x164fb2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x32857d='',_0x55553e='';for(let _0x290fb2=0x1f08+-0x1b38+0x3d0*-0x1,_0x3d1c2d,_0x508018,_0x2b4cb2=0x1179+-0x438*-0x3+-0x1e21;_0x508018=_0x841e2b['charAt'](_0x2b4cb2++);~_0x508018&&(_0x3d1c2d=_0x290fb2%(-0x1*0x17e9+-0x4*0x48f+0x2a29)?_0x3d1c2d*(0x22db+-0x7c4+-0x1*0x1ad7)+_0x508018:_0x508018,_0x290fb2++%(0x2622+0x8d2+-0x2ef0))?_0x32857d+=String['fromCharCode'](-0x16ac+-0x3e6*0x4+0x13*0x211&_0x3d1c2d>>(-(-0x2484+-0xdf4+0x327a)*_0x290fb2&-0x15e0+0x3c2*-0xa+0x3b7a)):-0x2fe+-0x36*0x61+-0xbba*-0x2){_0x508018=_0x164fb2['indexOf'](_0x508018);}for(let _0x17e196=0xb0+0x2595+-0x2645,_0x50a15b=_0x32857d['length'];_0x17e196<_0x50a15b;_0x17e196++){_0x55553e+='%'+('00'+_0x32857d['charCodeAt'](_0x17e196)['toString'](-0x2255+0x8d*0x2e+-0x90f*-0x1))['slice'](-(0x2466+0x269+-0x387*0xb));}return decodeURIComponent(_0x55553e);};_0x114e['lKqOsa']=_0x512a1f,_0x114e['oomJtR']={},_0x114e['aWingU']=!![];}const _0x25134c=_0x149af2[-0x1*-0x17ea+0x731*-0x1+-0x10b9*0x1];_0x114e['pXXZcR']!==_0x25134c&&(_0x114e['oomJtR']={},_0x114e['pXXZcR']=_0x25134c);const _0x2c23bb=_0x114e['oomJtR'][_0x26650f];return _0x2c23bb===undefined?(_0x2541c4=_0x114e['lKqOsa'](_0x2541c4),_0x114e['oomJtR'][_0x26650f]=_0x2541c4):_0x2541c4=_0x2c23bb,_0x2541c4;}export const todoReadToolDefinition={'name':_0x4e4801(0x1df),'parallelSafety':_0x4e4801(0x1e6),'description':_0x4e4801(0x1dc),'inputSchema':{'type':_0x4e4801(0x1db),'properties':{},'additionalProperties':![]}};export function executeTodoRead(_0x32f3fc){const _0x278e0f=_0x4e4801,_0x5d2ed4=_0x32f3fc[_0x278e0f(0x1e4)][_0x278e0f(0x1de)]();return Promise[_0x278e0f(0x1e7)]({'content':JSON[_0x278e0f(0x1eb)](_0x5d2ed4),'data':_0x5d2ed4});}
1
+ export const todoReadToolDefinition = {
2
+ name: 'todo_read',
3
+ parallelSafety: 'safe',
4
+ description: 'Read this session’s current Todo revision and items. Use before updating when the revision may have changed. Do not read an empty or new Todo merely to decide whether straightforward bounded work needs one.',
5
+ inputSchema: { type: 'object', properties: {}, additionalProperties: false }
6
+ };
7
+ export function executeTodoRead(context) {
8
+ const plan = context.todo.read();
9
+ return Promise.resolve({ content: JSON.stringify(plan), data: plan });
10
+ }
@@ -1,2 +1,65 @@
1
- /* mar-release-protected */
2
- const _0x58c4bd=_0x4093;(function(_0x51dbdc,_0xc6b3a){const _0x2f4150=_0x4093,_0x51cb64=_0x51dbdc();while(!![]){try{const _0x239d48=-parseInt(_0x2f4150(0x1ae))/(-0x91a+-0x5*0xe+0x157*0x7)*(-parseInt(_0x2f4150(0x192))/(-0x1253+-0x2f9*-0x2+-0x1*-0xc63))+-parseInt(_0x2f4150(0x18d))/(0x1071+-0x17*-0xef+-0x25e7)*(-parseInt(_0x2f4150(0x1ac))/(0x1568+-0x168c+-0x128*-0x1))+parseInt(_0x2f4150(0x1b6))/(-0x21bb+-0xf78+0x3138)+parseInt(_0x2f4150(0x19f))/(0x13e6+-0x1*0x6cf+0xdf*-0xf)+-parseInt(_0x2f4150(0x1a6))/(0xc*-0xc9+0x1*0x1d7d+-0x140a)*(parseInt(_0x2f4150(0x197))/(0x3e*-0x29+0x26cb*0x1+-0x1cd5))+-parseInt(_0x2f4150(0x1a2))/(-0x86b*-0x2+0x869*-0x2+0x5)*(parseInt(_0x2f4150(0x190))/(0x7ae*0x1+0x1*-0x1c4b+0x14a7))+-parseInt(_0x2f4150(0x191))/(0x6ba+-0xc*0x90+0x11);if(_0x239d48===_0xc6b3a)break;else _0x51cb64['push'](_0x51cb64['shift']());}catch(_0x4efe96){_0x51cb64['push'](_0x51cb64['shift']());}}}(_0x46de,0x17f4c+0xb3bf*-0x1+-0x6675*-0x2));import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';function _0x4093(_0x51cb33,_0x28ff81){_0x51cb33=_0x51cb33-(0x19*-0x43+0x25bf+-0x92*0x34);const _0x4428ec=_0x46de();let _0x479826=_0x4428ec[_0x51cb33];if(_0x4093['QGMiug']===undefined){var _0x3697de=function(_0x56e728){const _0x3f0b57='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4d7088='',_0x23afb5='';for(let _0x3b381f=-0xbd4*0x1+-0xa98+0x166c,_0x2d8e45,_0x49b990,_0x494a54=-0x203c+0x3dc+0x1c60;_0x49b990=_0x56e728['charAt'](_0x494a54++);~_0x49b990&&(_0x2d8e45=_0x3b381f%(-0x2036+0x7*-0x10e+-0x1e*-0x152)?_0x2d8e45*(-0xf*-0x207+0x16f8+0x1d5*-0x1d)+_0x49b990:_0x49b990,_0x3b381f++%(-0x1*-0xa7b+-0x2c2*0x2+-0x4f3))?_0x4d7088+=String['fromCharCode'](0x1745*-0x1+-0x1*0x99e+-0x10f1*-0x2&_0x2d8e45>>(-(0x26ab*-0x1+-0x1*-0x989+0x1d24)*_0x3b381f&-0x13*-0xd2+-0x1405+0x475)):-0x262*-0x4+-0x1228+-0x20*-0x45){_0x49b990=_0x3f0b57['indexOf'](_0x49b990);}for(let _0x3931b8=-0x6c5+-0xd5c+0x1421,_0x2485f7=_0x4d7088['length'];_0x3931b8<_0x2485f7;_0x3931b8++){_0x23afb5+='%'+('00'+_0x4d7088['charCodeAt'](_0x3931b8)['toString'](-0x2089+-0x4ab*-0x3+0x1298))['slice'](-(-0x1cb0+-0x1*-0x183b+0x477));}return decodeURIComponent(_0x23afb5);};_0x4093['urNUad']=_0x3697de,_0x4093['tYeVzd']={},_0x4093['QGMiug']=!![];}const _0x3577d7=_0x4428ec[0x2490+0x16ec+-0xbc*0x51];_0x4093['ZGlMAg']!==_0x3577d7&&(_0x4093['tYeVzd']={},_0x4093['ZGlMAg']=_0x3577d7);const _0x3ab8d8=_0x4093['tYeVzd'][_0x51cb33];return _0x3ab8d8===undefined?(_0x479826=_0x4093['urNUad'](_0x479826),_0x4093['tYeVzd'][_0x51cb33]=_0x479826):_0x479826=_0x3ab8d8,_0x479826;}export const todoWriteToolDefinition={'name':_0x58c4bd(0x1b2),'parallelSafety':_0x58c4bd(0x18f),'description':_0x58c4bd(0x1a9),'inputSchema':{'type':_0x58c4bd(0x1a7),'properties':{'expectedRevision':{'type':_0x58c4bd(0x19b)},'items':{'type':_0x58c4bd(0x1a3),'maxItems':TOOL_EXECUTION_LIMITS[_0x58c4bd(0x1b3)],'items':{'type':_0x58c4bd(0x1a7),'properties':{'id':{'type':_0x58c4bd(0x196)},'step':{'type':_0x58c4bd(0x196),'maxLength':TOOL_EXECUTION_LIMITS[_0x58c4bd(0x18c)]},'status':{'enum':[_0x58c4bd(0x198),_0x58c4bd(0x1ab),_0x58c4bd(0x1b5)]}},'required':['id',_0x58c4bd(0x1a5),_0x58c4bd(0x1b1)],'additionalProperties':![]}}},'required':[_0x58c4bd(0x1ad),_0x58c4bd(0x19d)],'additionalProperties':![]}};export async function executeTodoWrite(_0x5c2bf4,_0xa78f0d){const _0x54855a=_0x58c4bd,_0x1e2c48=parseTodoWriteInput(_0x5c2bf4),_0x1349bc=_0xa78f0d[_0x54855a(0x1a8)][_0x54855a(0x1a4)](_0x1e2c48);return await _0xa78f0d[_0x54855a(0x19c)]({'type':_0x54855a(0x193),'revision':_0x1349bc[_0x54855a(0x19a)],'items':_0x1349bc[_0x54855a(0x19d)]}),{'content':JSON[_0x54855a(0x199)](_0x1349bc),'data':_0x1349bc};}function parseTodoWriteInput(_0x23f2f7){const _0x3f31f2=_0x58c4bd;if(!_0x23f2f7||typeof _0x23f2f7!==_0x3f31f2(0x1a7)||Array[_0x3f31f2(0x1aa)](_0x23f2f7))return invalid();const _0x326321=_0x23f2f7;if(Object[_0x3f31f2(0x1b4)](_0x326321)[_0x3f31f2(0x18e)](_0x42d449=>![_0x3f31f2(0x1ad),_0x3f31f2(0x19d)][_0x3f31f2(0x1af)](_0x42d449))||!Number[_0x3f31f2(0x1a0)](_0x326321[_0x3f31f2(0x1ad)])||_0x326321[_0x3f31f2(0x1ad)]<-0x2254+-0xae7+-0x2d3b*-0x1||!Array[_0x3f31f2(0x1aa)](_0x326321[_0x3f31f2(0x19d)])||_0x326321[_0x3f31f2(0x19d)][_0x3f31f2(0x195)]>TOOL_EXECUTION_LIMITS[_0x3f31f2(0x1b3)])return invalid();const _0x5c4102=_0x326321[_0x3f31f2(0x19d)][_0x3f31f2(0x1b0)](_0x2b3234=>{const _0x1b35ee=_0x3f31f2;if(!_0x2b3234||typeof _0x2b3234!==_0x1b35ee(0x1a7)||Array[_0x1b35ee(0x1aa)](_0x2b3234))return invalid();const _0x3da25b=_0x2b3234;if(Object[_0x1b35ee(0x1b4)](_0x3da25b)[_0x1b35ee(0x18e)](_0x127119=>!['id',_0x1b35ee(0x1a5),_0x1b35ee(0x1b1)][_0x1b35ee(0x1af)](_0x127119))||typeof _0x3da25b['id']!==_0x1b35ee(0x196)||_0x3da25b['id'][_0x1b35ee(0x1a1)]()[_0x1b35ee(0x195)]===-0x1a85+-0x958+0x23dd||_0x3da25b['id'][_0x1b35ee(0x195)]>-0x2*-0x1085+0x10f*0x6+-0x26*0x106||typeof _0x3da25b[_0x1b35ee(0x1a5)]!==_0x1b35ee(0x196)||_0x3da25b[_0x1b35ee(0x1a5)][_0x1b35ee(0x1a1)]()[_0x1b35ee(0x195)]===0x2*-0x392+0x5cd+-0x7*-0x31||_0x3da25b[_0x1b35ee(0x1a5)][_0x1b35ee(0x195)]>TOOL_EXECUTION_LIMITS[_0x1b35ee(0x18c)]||![_0x1b35ee(0x198),_0x1b35ee(0x1ab),_0x1b35ee(0x1b5)][_0x1b35ee(0x1af)](String(_0x3da25b[_0x1b35ee(0x1b1)])))return invalid();return{'id':_0x3da25b['id'],'step':_0x3da25b[_0x1b35ee(0x1a5)],'status':_0x3da25b[_0x1b35ee(0x1b1)]};});return{'expectedRevision':_0x326321[_0x3f31f2(0x1ad)],'items':_0x5c4102};}function invalid(){const _0x6146da=_0x58c4bd;throw new MarAgentError(_0x6146da(0x194),_0x6146da(0x19e));}function _0x46de(){const _0x13afc0=['AxrLBxm','vg9KBYbPBNb1DcbPCYbPBNzHBgLKlG','mte3nJe2mKrhvKLrDa','AxnjBNrLz2vY','DhjPBq','nJa2otqYyuTyyvjU','yxjYyxK','D3jPDgu','C3rLCa','ndLhEu9orNq','B2jQzwn0','Dg9KBW','uMvWBgfJzsb0AgLZihnLC3nPB27IGjLZigvUDgLYzsbuB2rVigXPC3qGDxnPBMCGB3b0Aw1PC3rPyYbLEhbLy3rLzfjLDMLZAw9UlIbqCMvZzxj2zsbZDgfIBguGsurZigfUzcbZDgf0DxnLCYbVBMX5ihDOzw4GzxH0zw5KAw5NihrOzsbZyw1Lig9IAMvJDgL2zs4GrM9YigeGBwf0zxjPywXSEsbKAwzMzxjLBNqGB2jQzwn0AxzLlcbPBMnSDwrLig9UBhKGDgHLig5LDYbVyMPLy3rPDMxIGjLZigL0zw1ZlIbeBYbUB3qGCMv0ywLUignVBxbSzxrLzcbPDgvTCYbMCM9TigfUigvHCMXPzxiGB2jQzwn0AxzLoYb3AgvUigfSBcbJDxjYzw50igL0zw1ZigfYzsbJB21WBgv0zwqSigrLzMf1BhqGysbZDwjZDgfUDgL2zsbUzxCGCMvXDwvZDcb0BYbYzxbSywnLBwvUDcb1BMXLC3mGDgHLihvZzxiGzxHWBgLJAxrSEsbHC2TZihrVignVBNrPBNvLlcbLEhrLBMqSihzLCMLMEsWGB3iGzM9SBg93ihvWlIbvC2uGB25SEsbHzNrLCIbuB2rVigHHCYbIzwvUignOB3nLBIbMB3iGy29VCMrPBMf0Aw9UlwHLyxz5ihDVCMS7ihn0CMfPz2H0zM9YD2fYzcbIB3vUzgvKihDVCMSGzg9LCYbUB3qGBMvLzcbPDc4Gs2vLCcbHDcbTB3n0ig9UzsbPBL9WCM9NCMvZCYbPDgvTigfUzcb1CgrHDguGC3rHDhvZzxmGywz0zxiGBwvHBMLUz2z1BcbZDgfNzsbJAgfUz2vZlIbxAgvUigfUB3rOzxiGC3vIC3rHBNrPDMuGDg9VBcbJywXSigLZigfSCMvHzhKGCMvHzhKGyw5KigrVzxmGBM90igrLCgvUzcbVBIb0AguGvg9KBYbYzxn1BhqSigLUy2X1zguGyM90AcbPBIb0AguGC2fTzsbTB2rLBcbYzxnWB25ZzsbPBNn0zwfKig9MihnWzw5KAw5NigeGCMvZCg9UC2uGB25SEsbMB3iGvg9KBYbIB29RA2vLCgLUzY4','AxnbCNjHEq','Aw5FChjVz3jLC3m','mteXodr4wvbRyLK','zxHWzwn0zwrszxzPC2LVBG','nZa5qM92CMX2','Aw5JBhvKzxm','BwfW','C3rHDhvZ','Dg9KB193CML0zq','Dg9KB01HEeL0zw1Z','A2v5CW','y29TCgXLDgvK','ote1mJK1A1n3te5e','Dg9KB01HEfrLEhrdAgfYywn0zxjZ','mte0zMDrCvPZ','C29Tzq','C2vYAwfS','mJbWyLLfs0i','mJG3ntqWmgT6BfrWDW','mtq0A2vkzKzK','Dg9KBY51CgrHDgvK','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','BgvUz3rO','C3rYAw5N','nda2mtzjsMDAEfq','CgvUzgLUzW','C3rYAw5NAwz5','CMv2AxnPB24','Aw50zwDLCG','zw1PDa'];_0x46de=function(){return _0x13afc0;};return _0x46de();}
1
+ import { MarAgentError } from '../error.js';
2
+ import { TOOL_EXECUTION_LIMITS } from './execution-limits.js';
3
+ export const todoWriteToolDefinition = {
4
+ name: 'todo_write',
5
+ parallelSafety: 'serial',
6
+ description: 'Replace this session’s entire Todo list using optimistic expectedRevision. Preserve stable IDs and statuses only when extending the same objective. For a materially different objective, include only the new objective’s items. Do not retain completed items from an earlier objective; when all current items are completed, default a substantive new request to replacement unless the user explicitly asks to continue, extend, verify, or follow up. Use only after Todo has been chosen for coordination-heavy work; straightforward bounded work does not need it. Keep at most one in_progress item and update statuses after meaningful stage changes. When another substantive tool call is already ready and does not depend on the Todo result, include both in the same model response instead of spending a response only for Todo bookkeeping.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ expectedRevision: { type: 'integer' },
11
+ items: {
12
+ type: 'array',
13
+ maxItems: TOOL_EXECUTION_LIMITS.todoMaxItems,
14
+ items: {
15
+ type: 'object',
16
+ properties: {
17
+ id: { type: 'string' },
18
+ step: { type: 'string', maxLength: TOOL_EXECUTION_LIMITS.todoMaxTextCharacters },
19
+ status: { enum: ['pending', 'in_progress', 'completed'] }
20
+ },
21
+ required: ['id', 'step', 'status'],
22
+ additionalProperties: false
23
+ }
24
+ }
25
+ },
26
+ required: ['expectedRevision', 'items'],
27
+ additionalProperties: false
28
+ }
29
+ };
30
+ export async function executeTodoWrite(arguments_, context) {
31
+ const value = parseTodoWriteInput(arguments_);
32
+ const todo = context.todo.write(value);
33
+ await context.emit({ type: 'todo.updated', revision: todo.revision, items: todo.items });
34
+ return { content: JSON.stringify(todo), data: todo };
35
+ }
36
+ function parseTodoWriteInput(value) {
37
+ if (!value || typeof value !== 'object' || Array.isArray(value))
38
+ return invalid();
39
+ const input = value;
40
+ if (Object.keys(input).some((key) => !['expectedRevision', 'items'].includes(key)) ||
41
+ !Number.isInteger(input.expectedRevision) ||
42
+ input.expectedRevision < 0 ||
43
+ !Array.isArray(input.items) ||
44
+ input.items.length > TOOL_EXECUTION_LIMITS.todoMaxItems)
45
+ return invalid();
46
+ const items = input.items.map((item) => {
47
+ if (!item || typeof item !== 'object' || Array.isArray(item))
48
+ return invalid();
49
+ const record = item;
50
+ if (Object.keys(record).some((key) => !['id', 'step', 'status'].includes(key)) ||
51
+ typeof record.id !== 'string' ||
52
+ record.id.trim().length === 0 ||
53
+ record.id.length > 128 ||
54
+ typeof record.step !== 'string' ||
55
+ record.step.trim().length === 0 ||
56
+ record.step.length > TOOL_EXECUTION_LIMITS.todoMaxTextCharacters ||
57
+ !['pending', 'in_progress', 'completed'].includes(String(record.status)))
58
+ return invalid();
59
+ return { id: record.id, step: record.step, status: record.status };
60
+ });
61
+ return { expectedRevision: input.expectedRevision, items };
62
+ }
63
+ function invalid() {
64
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Todo input is invalid.');
65
+ }
@@ -1,2 +1,67 @@
1
- /* mar-release-protected */
2
- const _0x486262=_0x5c09;function _0x3ed6(){const _0x16904c=['Aw5JBhvKzxm','tufsx0fhru5ux1rpre9Fq09orKXjq1q','zxHWzwn0zwrszxzPC2LVBG','Aw5FChjVz3jLC3m','nduWotaZmNn3Bgvdrq','B2jQzwn0','C29Tzq','vg9KBYbYzxzPC2LVBIbPCYbPBNzHBgLKlG','C2L6zq','AxntywzLsw50zwDLCG','mtG3odu2mK9iBfvlqq','ndiYnJKWnhfxsKfWqW','C3rLCa','nZuXmdG3nezQCKvkuG','C3rHDhvZ','DhjPBq','vg9KBYbYzxzPC2LVBIbPCYbZDgfSzs4','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','otKYnJa3DgLJEKDb','CgvUzgLUzW','zMLSDgvY','CMv2AxnPB24','AxrLBxm','y29TCgXLDgvK','AxnbCNjHEq','BwfW','odvOuKXrD1m','CMvZDg9Yzq','CMvHza','mJq5mtG4n0HhywjWuG','C3rYAw5N','vg9KBYbPDgvTCYbHCMuGAw52ywXPzc4','D3jPDgu','BgvUz3rO','y29Kzq','mJKZmtK2vwXcs05N'];_0x3ed6=function(){return _0x16904c;};return _0x3ed6();}(function(_0x2c8f99,_0x3292dd){const _0x2c54b3=_0x5c09,_0x4212b7=_0x2c8f99();while(!![]){try{const _0x4a69da=-parseInt(_0x2c54b3(0x16e))/(0x1958+0x1dc0+0x3*-0x125d)+-parseInt(_0x2c54b3(0x166))/(-0x1870+-0x2231+0x373*0x11)+-parseInt(_0x2c54b3(0x179))/(0x18d8+0x1*0x45d+0x2*-0xe99)+parseInt(_0x2c54b3(0x160))/(-0x2f*0x63+-0x2*0x5d4+0x1dd9)+-parseInt(_0x2c54b3(0x176))/(0x25b*0xc+0xdd0+0x3*-0xe05)*(-parseInt(_0x2c54b3(0x17f))/(0x1d0d+0x1f85*-0x1+0x27e))+parseInt(_0x2c54b3(0x169))/(-0x24b1+-0x1f*-0xfb+0x653)+parseInt(_0x2c54b3(0x167))/(-0x1*0x1d7+-0x178d+0xcb6*0x2);if(_0x4a69da===_0x3292dd)break;else _0x4212b7['push'](_0x4212b7['shift']());}catch(_0xba3f16){_0x4212b7['push'](_0x4212b7['shift']());}}}(_0x3ed6,0x4f70b*0x1+-0x113b00+0x186c7d));import{MarAgentError}from'../error.js';export class TodoStore{#revision=-0x1669+-0x17f0+0x2e59;#items=[];static[_0x486262(0x177)](_0x284654){const _0x431ab9=_0x486262;if(!Number[_0x431ab9(0x165)](_0x284654[_0x431ab9(0x171)])||_0x284654[_0x431ab9(0x171)]<0x2*0x121d+-0x11*0x49+-0x1f61)throw new MarAgentError(_0x431ab9(0x16d),_0x431ab9(0x163));const _0x2abcdf=new TodoStore();return _0x2abcdf.#revision=_0x284654[_0x431ab9(0x171)],_0x2abcdf.#items=normalizeTodoItems(_0x284654[_0x431ab9(0x172)]),_0x2abcdf;}[_0x486262(0x178)](){const _0x2de077=_0x486262;return{'revision':this.#revision,'items':this.#items[_0x2de077(0x175)](_0x538df8=>({..._0x538df8}))};}[_0x486262(0x17c)](_0x466276){const _0x4ee65c=_0x486262;if(_0x466276[_0x4ee65c(0x15e)]!==this.#revision)throw new MarAgentError(_0x4ee65c(0x15d),_0x4ee65c(0x16c),{'details':{'revision':this.#revision}});return this.#items=normalizeTodoItems(_0x466276[_0x4ee65c(0x172)]),this.#revision++,this[_0x4ee65c(0x178)]();}}function _0x5c09(_0x31ac36,_0x427354){_0x31ac36=_0x31ac36-(0x761*0x1+0xde*0x26+-0x26f8);const _0x47c5a7=_0x3ed6();let _0xc1a640=_0x47c5a7[_0x31ac36];if(_0x5c09['bmoymQ']===undefined){var _0x3a1600=function(_0x37897f){const _0x40e4c7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4eec95='',_0x1ebff9='';for(let _0x5836f4=-0xeec+-0x42d+0x1319,_0x41706a,_0x304b80,_0x1c68ba=-0xc76+-0x2*0x470+0x2*0xaab;_0x304b80=_0x37897f['charAt'](_0x1c68ba++);~_0x304b80&&(_0x41706a=_0x5836f4%(0xd80+0x261*-0x8+0x58c)?_0x41706a*(-0x1369+-0x2209+0x57*0x9e)+_0x304b80:_0x304b80,_0x5836f4++%(0x3*-0xb9+0x1*-0x23bc+0x25eb))?_0x4eec95+=String['fromCharCode'](-0x1*-0x39b+0x2443*-0x1+0x21a7&_0x41706a>>(-(0x1a5*-0xe+-0x145c*0x1+0x2b64)*_0x5836f4&-0x1*0xfa1+-0xd1b+0x1cc2)):-0x94d+-0x1a5e+0x1*0x23ab){_0x304b80=_0x40e4c7['indexOf'](_0x304b80);}for(let _0x34d244=0x156a+0x6*0x1f6+0x1f*-0x112,_0x4e9f73=_0x4eec95['length'];_0x34d244<_0x4e9f73;_0x34d244++){_0x1ebff9+='%'+('00'+_0x4eec95['charCodeAt'](_0x34d244)['toString'](0xa59+-0x25e2+-0x9*-0x311))['slice'](-(-0x4c4+0x1*-0x1687+0x1b4d));}return decodeURIComponent(_0x1ebff9);};_0x5c09['IizMTR']=_0x3a1600,_0x5c09['bDKvJd']={},_0x5c09['bmoymQ']=!![];}const _0x10c59a=_0x47c5a7[-0x1*-0x1abf+0x458*0x4+-0x2c1f];_0x5c09['jvOxCw']!==_0x10c59a&&(_0x5c09['bDKvJd']={},_0x5c09['jvOxCw']=_0x10c59a);const _0x201fdf=_0x5c09['bDKvJd'][_0x31ac36];return _0x201fdf===undefined?(_0xc1a640=_0x5c09['IizMTR'](_0xc1a640),_0x5c09['bDKvJd'][_0x31ac36]=_0xc1a640):_0xc1a640=_0x201fdf,_0xc1a640;}export function todoItemsFromSnapshot(_0x2d0b20){const _0xd042a=_0x486262;if(_0x2d0b20===null||typeof _0x2d0b20!==_0xd042a(0x161)||Array[_0xd042a(0x174)](_0x2d0b20))return undefined;const _0x413046=_0x2d0b20[_0xd042a(0x172)];if(!Array[_0xd042a(0x174)](_0x413046))return undefined;try{return normalizeTodoItems(_0x413046);}catch(_0x44fe4a){if(_0x44fe4a instanceof MarAgentError&&_0x44fe4a[_0xd042a(0x17e)]===_0xd042a(0x16d))return undefined;throw _0x44fe4a;}}export function restoreTodoStore(_0x3a4b7e){const _0x400458=_0x486262,_0x56f530=new TodoStore();for(const _0x30db99 of _0x3a4b7e){const _0x147e4b=todoItemsFromSnapshot(_0x30db99);if(!_0x147e4b)continue;_0x56f530[_0x400458(0x17c)]({'expectedRevision':_0x56f530[_0x400458(0x178)]()[_0x400458(0x171)],'items':_0x147e4b});}return _0x56f530;}function normalizeTodoItems(_0x341634){const _0x584aff=_0x486262;if(_0x341634[_0x584aff(0x170)](_0x36e7b8=>_0x36e7b8?.[_0x584aff(0x16a)]===_0x584aff(0x15f))[_0x584aff(0x17d)]>0xb3d+0x1f80+-0x2abc||new Set(_0x341634[_0x584aff(0x175)](_0x3beb12=>_0x3beb12?.['id']))[_0x584aff(0x164)]!==_0x341634[_0x584aff(0x17d)]||_0x341634[_0x584aff(0x162)](_0x24affb=>_0x24affb===null||typeof _0x24affb!==_0x584aff(0x161)||Array[_0x584aff(0x174)](_0x24affb)||typeof _0x24affb['id']!==_0x584aff(0x17a)||!_0x24affb['id']||typeof _0x24affb[_0x584aff(0x168)]!==_0x584aff(0x17a)||!_0x24affb[_0x584aff(0x168)][_0x584aff(0x16b)]()||![_0x584aff(0x16f),_0x584aff(0x15f),_0x584aff(0x173)][_0x584aff(0x180)](_0x24affb[_0x584aff(0x16a)])))throw new MarAgentError(_0x584aff(0x16d),_0x584aff(0x17b));return _0x341634[_0x584aff(0x175)](_0x365c77=>({..._0x365c77,'step':_0x365c77[_0x584aff(0x168)][_0x584aff(0x16b)]()}));}
1
+ import { MarAgentError } from '../error.js';
2
+ export class TodoStore {
3
+ #revision = 0;
4
+ #items = [];
5
+ static restore(snapshot) {
6
+ if (!Number.isSafeInteger(snapshot.revision) || snapshot.revision < 0)
7
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Todo revision is invalid.');
8
+ const todo = new TodoStore();
9
+ todo.#revision = snapshot.revision;
10
+ todo.#items = normalizeTodoItems(snapshot.items);
11
+ return todo;
12
+ }
13
+ read() {
14
+ return { revision: this.#revision, items: this.#items.map((item) => ({ ...item })) };
15
+ }
16
+ write(input) {
17
+ if (input.expectedRevision !== this.#revision)
18
+ throw new MarAgentError('MAR_AGENT_TODO_CONFLICT', 'Todo revision is stale.', {
19
+ details: { revision: this.#revision }
20
+ });
21
+ this.#items = normalizeTodoItems(input.items);
22
+ this.#revision++;
23
+ return this.read();
24
+ }
25
+ }
26
+ export function todoItemsFromSnapshot(snapshot) {
27
+ if (snapshot === null || typeof snapshot !== 'object' || Array.isArray(snapshot))
28
+ return undefined;
29
+ const items = snapshot.items;
30
+ if (!Array.isArray(items))
31
+ return undefined;
32
+ try {
33
+ return normalizeTodoItems(items);
34
+ }
35
+ catch (error) {
36
+ if (error instanceof MarAgentError && error.code === 'MAR_AGENT_TOOL_INPUT_INVALID')
37
+ return undefined;
38
+ throw error;
39
+ }
40
+ }
41
+ export function restoreTodoStore(snapshots) {
42
+ const todo = new TodoStore();
43
+ for (const snapshot of snapshots) {
44
+ const items = todoItemsFromSnapshot(snapshot);
45
+ if (!items)
46
+ continue;
47
+ todo.write({
48
+ expectedRevision: todo.read().revision,
49
+ items
50
+ });
51
+ }
52
+ return todo;
53
+ }
54
+ function normalizeTodoItems(items) {
55
+ if (items.filter((item) => item?.status === 'in_progress').length > 1 ||
56
+ new Set(items.map((item) => item?.id)).size !== items.length ||
57
+ items.some((item) => item === null ||
58
+ typeof item !== 'object' ||
59
+ Array.isArray(item) ||
60
+ typeof item.id !== 'string' ||
61
+ !item.id ||
62
+ typeof item.step !== 'string' ||
63
+ !item.step.trim() ||
64
+ !['pending', 'in_progress', 'completed'].includes(item.status)))
65
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Todo items are invalid.');
66
+ return items.map((item) => ({ ...item, step: item.step.trim() }));
67
+ }
@@ -1,2 +1,81 @@
1
- /* mar-release-protected */
2
- const _0xd2b187=_0x5551;(function(_0x463ed0,_0x5330ab){const _0x365e61=_0x5551,_0x3119ec=_0x463ed0();while(!![]){try{const _0x3a364a=-parseInt(_0x365e61(0x1a6))/(-0x7*-0x4a2+-0x39*-0x51+0x869*-0x6)+parseInt(_0x365e61(0x1bd))/(-0x1230+0x5c+-0x2f9*-0x6)*(-parseInt(_0x365e61(0x1b4))/(-0x18e*-0x1+0x493*0x2+0x17*-0x77))+parseInt(_0x365e61(0x1b7))/(-0x34e+0x1*-0x2ad+-0x5ff*-0x1)*(-parseInt(_0x365e61(0x1b3))/(0x2387+-0x2253+0x1*-0x12f))+parseInt(_0x365e61(0x1a7))/(-0xf08+-0x1b7*0x7+-0x3*-0x905)+parseInt(_0x365e61(0x1b6))/(0x2388+-0x111d+-0x1264)*(parseInt(_0x365e61(0x1b9))/(0x2283+-0x10*0xc0+-0x167b))+-parseInt(_0x365e61(0x1a5))/(0x5*0x162+0x645+-0xd26)*(parseInt(_0x365e61(0x18e))/(-0x12e9+-0xfaf+0x193*0x16))+parseInt(_0x365e61(0x184))/(-0x1be7+0x1*-0x1049+0x2c3b);if(_0x3a364a===_0x5330ab)break;else _0x3119ec['push'](_0x3119ec['shift']());}catch(_0x27b2e1){_0x3119ec['push'](_0x3119ec['shift']());}}}(_0x3c8a,-0x1b1e66+0x3*0x4ca32+0x1b06f4));import{createHash}from'node:crypto';import{open}from'node:fs/promises';import{MarAgentError}from'../error.js';import{TOOL_EXECUTION_LIMITS}from'./execution-limits.js';export const viewImageToolDefinition={'name':_0xd2b187(0x19b),'parallelSafety':_0xd2b187(0x1ba),'description':_0xd2b187(0x18d)+TOOL_EXECUTION_LIMITS[_0xd2b187(0x18f)]+_0xd2b187(0x1b0),'inputSchema':{'type':_0xd2b187(0x18b),'properties':{'path':{'type':_0xd2b187(0x19d),'description':_0xd2b187(0x1a4)}},'required':[_0xd2b187(0x1aa)],'additionalProperties':![]}};export class ViewImageTool{[_0xd2b187(0x1ae)];constructor(_0x3514cf){const _0xcec786=_0xd2b187;this[_0xcec786(0x1ae)]=_0x3514cf;}async[_0xd2b187(0x195)](_0x3f7dc7,_0x7fc1f5){const _0x2dc903=_0xd2b187,_0x150140=parseViewImageInput(_0x3f7dc7);_0x7fc1f5?.[_0x2dc903(0x1a8)]();const _0xc8aee2=await this[_0x2dc903(0x1ae)][_0x2dc903(0x1b1)](_0x150140[_0x2dc903(0x1aa)]),_0x192816=await open(_0xc8aee2,'r');try{const _0x662baa=await _0x192816[_0x2dc903(0x18a)]();if(!_0x662baa[_0x2dc903(0x1a3)]())throw new MarAgentError(_0x2dc903(0x190),_0x2dc903(0x1b8));if(_0x662baa[_0x2dc903(0x185)]>TOOL_EXECUTION_LIMITS[_0x2dc903(0x18f)])throw new MarAgentError(_0x2dc903(0x1a0),_0x2dc903(0x194)+TOOL_EXECUTION_LIMITS[_0x2dc903(0x18f)]+_0x2dc903(0x1af));_0x7fc1f5?.[_0x2dc903(0x1a8)]();const _0x5ca745=await _0x192816[_0x2dc903(0x1ad)]();_0x7fc1f5?.[_0x2dc903(0x1a8)]();if(_0x5ca745[_0x2dc903(0x1a9)]>TOOL_EXECUTION_LIMITS[_0x2dc903(0x18f)])throw new MarAgentError(_0x2dc903(0x1a0),_0x2dc903(0x194)+TOOL_EXECUTION_LIMITS[_0x2dc903(0x18f)]+_0x2dc903(0x1af));const _0x574eef=detectImageMime(_0x5ca745),_0x31d664={'path':_0x150140[_0x2dc903(0x1aa)],'mimeType':_0x574eef,'bytes':_0x5ca745[_0x2dc903(0x1a9)],'sha256':createHash(_0x2dc903(0x187))[_0x2dc903(0x197)](_0x5ca745)[_0x2dc903(0x1ac)](_0x2dc903(0x1bc))};return{'content':_0x2dc903(0x18c)+_0x150140[_0x2dc903(0x1aa)]+'\x20('+_0x574eef+',\x20'+_0x5ca745[_0x2dc903(0x1a9)]+_0x2dc903(0x19e)+_0x31d664[_0x2dc903(0x187)]+').','data':_0x31d664,'images':[{'mimeType':_0x574eef,'dataBase64':_0x5ca745[_0x2dc903(0x191)](_0x2dc903(0x193))}]};}finally{await _0x192816[_0x2dc903(0x186)]();}}}function parseViewImageInput(_0x52e0f6){const _0x39e5c8=_0xd2b187;if(!_0x52e0f6||typeof _0x52e0f6!==_0x39e5c8(0x18b))return invalidInput();const _0x3e84fb=_0x52e0f6;if(Object[_0x39e5c8(0x196)](_0x3e84fb)[_0x39e5c8(0x1b5)](_0x4357e0=>_0x4357e0!==_0x39e5c8(0x1aa))||typeof _0x3e84fb[_0x39e5c8(0x1aa)]!==_0x39e5c8(0x19d)||_0x3e84fb[_0x39e5c8(0x1aa)][_0x39e5c8(0x1b2)]===-0x18a7+-0x172e+0x2fd5)return invalidInput();return{'path':_0x3e84fb[_0x39e5c8(0x1aa)]};}export function detectImageMime(_0x5aad3a){const _0x403159=_0xd2b187;if(_0x5aad3a[_0x403159(0x1b2)]>=-0x2bf+-0x17*0x133+0x1e5c&&_0x5aad3a[_0x403159(0x199)](-0x1*-0x2623+0x2075+-0x4698,-0x164b+-0x415+0x1a68)[_0x403159(0x19f)](Buffer[_0x403159(0x19c)]([0xd41+0x527+-0x11df*0x1,-0x67+-0x26df*-0x1+-0x2628,0xd*-0x204+-0x18c6+0xc*0x446,0x1641+0x201e+-0x6*0x904,-0x65*-0x26+-0x174+-0xd7d,-0x390+0x1dc1+0x67*-0x41,0x4c5+0x1*-0x20cb+0x8*0x384,0x1064+0x1aea+-0x2b44])))return _0x403159(0x19a);if(_0x5aad3a[_0x403159(0x1b2)]>=-0xe*0x92+0x1c6b+-0x146c&&_0x5aad3a[-0x13b2*0x1+-0x4a7+0x1859]===0x497+0x1330*0x1+-0x16c8&&_0x5aad3a[-0x25bb+0x1f*0x8b+0x14e7]===0xbe*-0x29+-0x7c9*0x1+-0x12f*-0x21&&_0x5aad3a[-0xb*0x333+-0x11d8+-0x16f*-0x25]===-0x9*0x1f9+-0x245b+-0x1*-0x371b)return _0x403159(0x1a2);if(_0x5aad3a[_0x403159(0x1b2)]>=0x2589+0xaa*0x11+-0x30c7*0x1&&_0x5aad3a[_0x403159(0x199)](-0x189+-0xb*0x115+0xd70,0x5*-0x637+-0x1*0x10fc+-0x1*-0x3013)[_0x403159(0x191)](_0x403159(0x198))===_0x403159(0x188)&&_0x5aad3a[_0x403159(0x199)](0xd0e+-0x10a1+0x39b,-0x1*0x115f+-0x1c21*-0x1+0xab6*-0x1)[_0x403159(0x191)](_0x403159(0x198))===_0x403159(0x192))return _0x403159(0x1ab);throw new MarAgentError(_0x403159(0x1a1),_0x403159(0x1bb));}function _0x5551(_0x196dba,_0x17a616){_0x196dba=_0x196dba-(0x68*-0x5+-0x14ac+0x1838);const _0x2a0258=_0x3c8a();let _0x539864=_0x2a0258[_0x196dba];if(_0x5551['loECqe']===undefined){var _0x2b2385=function(_0x354a89){const _0x471b42='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x132bc5='',_0x4a3ecf='';for(let _0x5b8c3f=0xe7*-0x3+-0xc43+0xef8,_0x28f9ae,_0x1a3d1d,_0x443aef=-0x2096+-0x1e02+0x3e98;_0x1a3d1d=_0x354a89['charAt'](_0x443aef++);~_0x1a3d1d&&(_0x28f9ae=_0x5b8c3f%(-0x26f9+0x257b+0x182*0x1)?_0x28f9ae*(0xc3f+-0x6e+-0xb91)+_0x1a3d1d:_0x1a3d1d,_0x5b8c3f++%(-0x415+-0x2452+0x1*0x286b))?_0x132bc5+=String['fromCharCode'](-0xcb6*0x1+-0x2573+-0x665*-0x8&_0x28f9ae>>(-(0x2fa+-0x2334+0x203c)*_0x5b8c3f&0x214d+0x1*0xa93+0x15ed*-0x2)):-0x7*0x6f+-0x2*0x882+-0x57*-0x3b){_0x1a3d1d=_0x471b42['indexOf'](_0x1a3d1d);}for(let _0x17d28a=-0x1e2c+-0x221b*0x1+0x4047,_0x51f548=_0x132bc5['length'];_0x17d28a<_0x51f548;_0x17d28a++){_0x4a3ecf+='%'+('00'+_0x132bc5['charCodeAt'](_0x17d28a)['toString'](-0x856*-0x2+0x1465+0x1*-0x2501))['slice'](-(0x905*0x2+0x483+-0x168b));}return decodeURIComponent(_0x4a3ecf);};_0x5551['yoYCrR']=_0x2b2385,_0x5551['qFRMAv']={},_0x5551['loECqe']=!![];}const _0x161ffc=_0x2a0258[0x1*-0x1a37+-0x7fc+0x2233];_0x5551['ernFBj']!==_0x161ffc&&(_0x5551['qFRMAv']={},_0x5551['ernFBj']=_0x161ffc);const _0x1eb744=_0x5551['qFRMAv'][_0x196dba];return _0x1eb744===undefined?(_0x539864=_0x5551['yoYCrR'](_0x539864),_0x5551['qFRMAv'][_0x196dba]=_0x539864):_0x539864=_0x1eb744,_0x539864;}function _0x3c8a(){const _0x2cf119=['tufsx0fhru5ux1rpt0XFt1vuufvux0XjtuLu','tufsx0fhru5ux0LnquDfx0zpuK1bvf9vtLnvufbpuLrfra','Aw1Hz2uVANbLzW','AxngAwXL','uMvSyxrPDMuGD29YA3nWywnLihbHDgGGB3iGywjZB2X1DguGAw1Hz2uGCgf0Ac4','mtCXy01hr0LS','nte4mtvKzxvlqw0','mtiZmZy3ofnXz3PMrW','DgHYB3DjzKfIB3j0zwq','yNL0zuXLBMD0Aa','Cgf0Aa','Aw1Hz2uVD2vICa','zgLNzxn0','CMvHzezPBgu','Cgf0Ahm','lwj5DguGBgLTAxqU','igj5DgvZlIbnsu1figLZigrLDgvJDgvKigzYB20GzMLSzsbJB250zw50lcbUB3qGAxrZigv4DgvUC2LVBI4GvxnLihrOAxmGAw5ZDgvHzcbVzIbPBNn0ywXSAw5Nie9duIbVCIbJB252zxj0Aw5NihrOzsbPBwfNzsb0AhjVDwDOigv4zwmU','CMvZB2X2zq','BgvUz3rO','ndi2mty1ufzhrxzX','mZyZnte2revlvffk','C29Tzq','mZq1mZH4tgPVsu0','odbnv3fgAvG','ugf0AcbPCYbUB3qGysbYzwD1BgfYigzPBguU','mJm3nNjevuXzCq','C2fMzq','t25SEsbqtKCSiePqruCSigfUzcbxzwjqigLTywDLCYbHCMuGC3vWCg9YDgvKlG','Agv4','mJrjEePIzKK','mZeWmZG3otLAvNzet2O','C2L6zq','y2XVC2u','C2HHmJu2','uKLgrG','vMLLDYbPBwfNzsbPBNb1DcbPCYbPBNzHBgLKlG','C3rHDa','B2jQzwn0','vMLLD2vKigLTywDLia','uMvHzcbVBMuGA25VD24GBg9JywWGue5hlcbkuevhlcbVCIbxzwjqigLTywDLigfUzcbWCM92AwrLigL0CYbHy3r1ywWGCgL4zwXZihrVihrOzsb2AxnPB24Ty2fWywjSzsbTB2rLBc4GuMvSyxrPDMuGCgf0AhmGDxnLihrOzsb3B3jRC3bHy2u7igfIC29SDxrLihbHDgHZigfYzsbHBgXVD2vKlIbuAguGzMLSzsbTDxn0igjLigeGCMvNDwXHCIbMAwXLig5VigXHCMDLCIb0AgfUia','mtGYmZuWBLLOvNv1','DMLLD0LTywDLtwf4qNL0zxm','tufsx0fhru5ux1rpt0XFsu5qvvrFsu5wquXjra','Dg9tDhjPBMC','v0vcua','yMfZzty0','sw1Hz2uGzxHJzwvKCYb0AguG','zxHLy3v0zq','A2v5CW','DxbKyxrL','yxnJAwK','C3vIyxjYyxK','Aw1Hz2uVCg5N','DMLLD19PBwfNzq','zNjVBq','C3rYAw5N','igj5DgvZlcbZAgeYntyG','zxf1ywXZ'];_0x3c8a=function(){return _0x2cf119;};return _0x3c8a();}function invalidInput(){const _0x27628b=_0xd2b187;throw new MarAgentError(_0x27628b(0x190),_0x27628b(0x189));}
1
+ import { createHash } from 'node:crypto';
2
+ import { open } from 'node:fs/promises';
3
+ import { MarAgentError } from '../error.js';
4
+ import { TOOL_EXECUTION_LIMITS } from './execution-limits.js';
5
+ export const viewImageToolDefinition = {
6
+ name: 'view_image',
7
+ parallelSafety: 'safe',
8
+ description: `Read one known local PNG, JPEG, or WebP image and provide its actual pixels to the vision-capable model. Relative paths use the workspace; absolute paths are allowed. The file must be a regular file no larger than ${TOOL_EXECUTION_LIMITS.viewImageMaxBytes} bytes. MIME is detected from file content, not its extension. Use this instead of installing OCR or converting the image through exec.`,
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ path: { type: 'string', description: 'Relative workspace path or absolute image path.' }
13
+ },
14
+ required: ['path'],
15
+ additionalProperties: false
16
+ }
17
+ };
18
+ export class ViewImageTool {
19
+ paths;
20
+ constructor(paths) {
21
+ this.paths = paths;
22
+ }
23
+ async execute(arguments_, signal) {
24
+ const input = parseViewImageInput(arguments_);
25
+ signal?.throwIfAborted();
26
+ const path = await this.paths.resolve(input.path);
27
+ const handle = await open(path, 'r');
28
+ try {
29
+ const stat = await handle.stat();
30
+ if (!stat.isFile())
31
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'Path is not a regular file.');
32
+ if (stat.size > TOOL_EXECUTION_LIMITS.viewImageMaxBytes)
33
+ throw new MarAgentError('MAR_AGENT_TOOL_OUTPUT_LIMIT', `Image exceeds the ${TOOL_EXECUTION_LIMITS.viewImageMaxBytes}-byte limit.`);
34
+ signal?.throwIfAborted();
35
+ const data = await handle.readFile();
36
+ signal?.throwIfAborted();
37
+ if (data.byteLength > TOOL_EXECUTION_LIMITS.viewImageMaxBytes)
38
+ throw new MarAgentError('MAR_AGENT_TOOL_OUTPUT_LIMIT', `Image exceeds the ${TOOL_EXECUTION_LIMITS.viewImageMaxBytes}-byte limit.`);
39
+ const mimeType = detectImageMime(data);
40
+ const metadata = {
41
+ path: input.path,
42
+ mimeType,
43
+ bytes: data.byteLength,
44
+ sha256: createHash('sha256').update(data).digest('hex')
45
+ };
46
+ return {
47
+ content: `Viewed image ${input.path} (${mimeType}, ${data.byteLength} bytes, sha256 ${metadata.sha256}).`,
48
+ data: metadata,
49
+ images: [{ mimeType, dataBase64: data.toString('base64') }]
50
+ };
51
+ }
52
+ finally {
53
+ await handle.close();
54
+ }
55
+ }
56
+ }
57
+ function parseViewImageInput(value) {
58
+ if (!value || typeof value !== 'object')
59
+ return invalidInput();
60
+ const input = value;
61
+ if (Object.keys(input).some((key) => key !== 'path') ||
62
+ typeof input.path !== 'string' ||
63
+ input.path.length === 0)
64
+ return invalidInput();
65
+ return { path: input.path };
66
+ }
67
+ export function detectImageMime(data) {
68
+ if (data.length >= 8 &&
69
+ data.subarray(0, 8).equals(Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])))
70
+ return 'image/png';
71
+ if (data.length >= 3 && data[0] === 0xff && data[1] === 0xd8 && data[2] === 0xff)
72
+ return 'image/jpeg';
73
+ if (data.length >= 12 &&
74
+ data.subarray(0, 4).toString('ascii') === 'RIFF' &&
75
+ data.subarray(8, 12).toString('ascii') === 'WEBP')
76
+ return 'image/webp';
77
+ throw new MarAgentError('MAR_AGENT_IMAGE_FORMAT_UNSUPPORTED', 'Only PNG, JPEG, and WebP images are supported.');
78
+ }
79
+ function invalidInput() {
80
+ throw new MarAgentError('MAR_AGENT_TOOL_INPUT_INVALID', 'View image input is invalid.');
81
+ }
@@ -1,2 +1,11 @@
1
- /* mar-release-protected */
2
- const _0x3452bb=_0x589e;(function(_0x46facc,_0x424b88){const _0x120146=_0x589e,_0x5d17cb=_0x46facc();while(!![]){try{const _0x5a94a0=parseInt(_0x120146(0xeb))/(-0x145d+-0x42d+-0x188b*-0x1)+-parseInt(_0x120146(0xe5))/(-0x19*-0xa7+0xb3*0x2f+0x2*-0x1895)*(-parseInt(_0x120146(0xe2))/(-0x1581+0xa*0xa6+0x1e1*0x8))+parseInt(_0x120146(0xe9))/(0x2*0xef9+0x21c2+-0x3fb0)+-parseInt(_0x120146(0xdd))/(0x1fe1+0x4f6*-0x1+-0x1ae6)+-parseInt(_0x120146(0xe3))/(0xb72*-0x1+-0x8bd+0x1*0x1435)*(parseInt(_0x120146(0xe7))/(-0x216a+-0x26d7+0x4848))+-parseInt(_0x120146(0xdf))/(0x2577+-0x10fd*-0x2+-0x4769)+parseInt(_0x120146(0xe8))/(0x12ed+-0x202*0x9+-0xd2);if(_0x5a94a0===_0x424b88)break;else _0x5d17cb['push'](_0x5d17cb['shift']());}catch(_0x2c7085){_0x5d17cb['push'](_0x5d17cb['shift']());}}}(_0x2e9c,0xe23d2+0x118df5+-0x9b34a*0x2));function _0x589e(_0x127db2,_0x5f30a9){_0x127db2=_0x127db2-(-0x238c+0x16*0x6c+0x1b21);const _0x1d3ff=_0x2e9c();let _0x439787=_0x1d3ff[_0x127db2];if(_0x589e['WgVAJE']===undefined){var _0x57cc1f=function(_0x38500b){const _0x4bc25e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4378a8='',_0x33c8fd='';for(let _0x15714a=-0x7cd+0x16ef+0x2*-0x791,_0x379a44,_0x2cf747,_0x40f244=0x1031+0x137c+-0x23ad;_0x2cf747=_0x38500b['charAt'](_0x40f244++);~_0x2cf747&&(_0x379a44=_0x15714a%(-0x6c2+0xef+0x5d7)?_0x379a44*(0x916+-0xa83+0x1ad)+_0x2cf747:_0x2cf747,_0x15714a++%(0xa71+0x347+-0xdb4))?_0x4378a8+=String['fromCharCode'](-0xa*0x142+-0x756+-0x1*-0x14e9&_0x379a44>>(-(0x1dde+0x18c4+-0x36a0)*_0x15714a&-0xb*-0x31b+-0x1*0x15dc+-0xc47)):0x1ee8+0xa47*-0x3+0x1*-0x13){_0x2cf747=_0x4bc25e['indexOf'](_0x2cf747);}for(let _0x42b8bb=-0x72d+-0x2*0xe2d+-0x6b*-0x55,_0x3fd9d2=_0x4378a8['length'];_0x42b8bb<_0x3fd9d2;_0x42b8bb++){_0x33c8fd+='%'+('00'+_0x4378a8['charCodeAt'](_0x42b8bb)['toString'](-0x1789+-0x1735*-0x1+0x64))['slice'](-(0x2311+-0x1*0x1c6f+-0xd4*0x8));}return decodeURIComponent(_0x33c8fd);};_0x589e['NscBlT']=_0x57cc1f,_0x589e['QinMBs']={},_0x589e['WgVAJE']=!![];}const _0x54c504=_0x1d3ff[0x960+0xd92+-0x16f2];_0x589e['HmRTpa']!==_0x54c504&&(_0x589e['QinMBs']={},_0x589e['HmRTpa']=_0x54c504);const _0x1e6dcc=_0x589e['QinMBs'][_0x127db2];return _0x1e6dcc===undefined?(_0x439787=_0x589e['NscBlT'](_0x439787),_0x589e['QinMBs'][_0x127db2]=_0x439787):_0x439787=_0x1e6dcc,_0x439787;}export const webFetchToolDefinition={'name':_0x3452bb(0xde),'parallelSafety':_0x3452bb(0xe6),'description':_0x3452bb(0xea),'inputSchema':{'type':_0x3452bb(0xe1),'properties':{'url':{'type':_0x3452bb(0xe0)}},'required':[_0x3452bb(0xe4)],'additionalProperties':![]}};function _0x2e9c(){const _0x2409ec=['C3rYAw5N','B2jQzwn0','otC1DvrrExzX','mJi3nfziDMHXsa','DxjS','ndeXmhj2txvOrq','C2fMzq','mtm1mtD2vw1Rug8','mtm1mZi2nZLuD0fPr0O','mZiXndG0ofDSuhvrDW','rMv0y2GGysbZCgvJAwzPyYbivfrqig9YieHuvfbtifvstcWGAw5JBhvKAw5Nigv4CgXPy2L0BhKGCgvYBwL0DgvKigLUDhjHBMv0ifvsthmU','mJm2ntK3AuDdANvN','mtK5ntiWnxbvzNbfuG','D2vIx2zLDgnO','mtaYmde5mZzrzw9yAgS'];_0x2e9c=function(){return _0x2409ec;};return _0x2e9c();}
1
+ export const webFetchToolDefinition = {
2
+ name: 'web_fetch',
3
+ parallelSafety: 'safe',
4
+ description: 'Fetch a specific HTTP or HTTPS URL, including explicitly permitted intranet URLs.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: { url: { type: 'string' } },
8
+ required: ['url'],
9
+ additionalProperties: false
10
+ }
11
+ };
@@ -1,2 +1,14 @@
1
- /* mar-release-protected */
2
- function _0x2310(_0x168fae,_0x5b6a1d){_0x168fae=_0x168fae-(0x221a+0x2440+-0x45ca*0x1);const _0x21be25=_0x27f8();let _0x1dead5=_0x21be25[_0x168fae];if(_0x2310['LjIkOL']===undefined){var _0x37f09f=function(_0x53e7f1){const _0x56859c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xaa4fc4='',_0x44e681='';for(let _0x201efd=0xaba+-0x484+-0x636,_0x224afd,_0x58be5c,_0x519bc4=-0x2*-0x1e7+-0x1*-0x434+-0x802*0x1;_0x58be5c=_0x53e7f1['charAt'](_0x519bc4++);~_0x58be5c&&(_0x224afd=_0x201efd%(-0xe0d+0x1*-0x26dd+0x34ee)?_0x224afd*(-0x6cc+-0x21e8+-0x1*-0x28f4)+_0x58be5c:_0x58be5c,_0x201efd++%(0x631*0x2+-0x1*0x1ff9+0x139b))?_0xaa4fc4+=String['fromCharCode'](0x1027+0x1d18+-0x1d8*0x18&_0x224afd>>(-(0xdd1+-0xbe0+-0x21*0xf)*_0x201efd&0x1c2+-0x1d12+-0x1*-0x1b56)):0x11*0x3+-0x10*0xaa+-0x1*-0xa6d){_0x58be5c=_0x56859c['indexOf'](_0x58be5c);}for(let _0x4f7a55=-0x124*0x10+0xef9*0x2+-0xbb2,_0x3eee2e=_0xaa4fc4['length'];_0x4f7a55<_0x3eee2e;_0x4f7a55++){_0x44e681+='%'+('00'+_0xaa4fc4['charCodeAt'](_0x4f7a55)['toString'](0x3*-0x3df+0x2*0xcde+-0xe0f))['slice'](-(0x2369*0x1+0xd18+-0x41*0xbf));}return decodeURIComponent(_0x44e681);};_0x2310['eiKRQT']=_0x37f09f,_0x2310['zefuWY']={},_0x2310['LjIkOL']=!![];}const _0xe56df4=_0x21be25[0x293+-0x68d+0x3fa];_0x2310['QsQulQ']!==_0xe56df4&&(_0x2310['zefuWY']={},_0x2310['QsQulQ']=_0xe56df4);const _0x31be2f=_0x2310['zefuWY'][_0x168fae];return _0x31be2f===undefined?(_0x1dead5=_0x2310['eiKRQT'](_0x1dead5),_0x2310['zefuWY'][_0x168fae]=_0x1dead5):_0x1dead5=_0x31be2f,_0x1dead5;}const _0xa996c1=_0x2310;function _0x27f8(){const _0x1df4bc=['mteXmtq0q1f1C1jy','B2jQzwn0','nKfZte9xCW','nZyZmZm1qMDNzff3','Aw50zwDLCG','u2vHCMnOihrOzsb3zwiGzM9Yign1CNjLBNqGAw5MB3jTyxrPB24UifvZzsb3zwjFzMv0y2GGDg8GB3bLBIbHihnWzwnPzMLJihjLC3vSDc4','mZq3mtzKCxHdEKK','mte3mduWnePZzwXtAW','nJiYntu5wNvUvezQ','D2vIx3nLyxjJAa','mMvcvLb3Aq','u2vHCMnOihf1zxj5lG','mte1mdC3s1rIzvHP','CxvLCNK','C2fMzq','C3rYAw5N','otG5mdq2s0XcAvHj'];_0x27f8=function(){return _0x1df4bc;};return _0x27f8();}(function(_0x5b3e83,_0x251a81){const _0x513590=_0x2310,_0x5e2e52=_0x5b3e83();while(!![]){try{const _0x3b15ac=-parseInt(_0x513590(0x91))/(0x224e+-0x36*-0xae+-0x3*0x17ab)*(-parseInt(_0x513590(0x95))/(-0x3e3+-0x1480+-0x5*-0x4e1))+parseInt(_0x513590(0x97))/(-0xe8f+0x2c9*-0xd+-0x10ed*-0x3)+parseInt(_0x513590(0x92))/(0x1161+0x28d*-0x5+-0x49c)+-parseInt(_0x513590(0x9f))/(0xc7d+0x1aae+-0x2726)+parseInt(_0x513590(0x9e))/(0x1dc8+-0x94d+-0x1475)*(parseInt(_0x513590(0x93))/(-0x5*-0x727+-0x1ab5+-0x1*0x907))+-parseInt(_0x513590(0x9c))/(0x1*-0x2d3+0x16a*-0x5+0x9ed)+-parseInt(_0x513590(0x9b))/(-0x9bb+0x2*0xa3a+-0xab0);if(_0x3b15ac===_0x251a81)break;else _0x5e2e52['push'](_0x5e2e52['shift']());}catch(_0x21ab3b){_0x5e2e52['push'](_0x5e2e52['shift']());}}}(_0x27f8,-0x25713+0x3dd86*0x1+0x13195));export const webSearchToolDefinition={'name':_0xa996c1(0x94),'parallelSafety':_0xa996c1(0x99),'description':_0xa996c1(0x90),'inputSchema':{'type':_0xa996c1(0x9d),'properties':{'query':{'type':_0xa996c1(0x9a),'description':_0xa996c1(0x96)},'maxResults':{'type':_0xa996c1(0xa0),'minimum':0x1,'maximum':0xa,'default':0x8}},'required':[_0xa996c1(0x98)],'additionalProperties':![]}};
1
+ export const webSearchToolDefinition = {
2
+ name: 'web_search',
3
+ parallelSafety: 'safe',
4
+ description: 'Search the web for current information. Use web_fetch to open a specific result.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ query: { type: 'string', description: 'Search query.' },
9
+ maxResults: { type: 'integer', minimum: 1, maximum: 10, default: 8 }
10
+ },
11
+ required: ['query'],
12
+ additionalProperties: false
13
+ }
14
+ };
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.9.62",
3
+ "version": "0.9.64",
4
4
  "description": "Embeddable MAR coding agent SDK and CLI.",
5
+ "license": "Apache-2.0",
5
6
  "type": "module",
6
7
  "files": [
7
8
  "dist/**/*.js",
8
9
  "dist/**/*.d.ts",
9
- "README.md"
10
+ "LICENSE",
11
+ "NOTICE"
10
12
  ],
11
13
  "exports": {
12
14
  ".": {
@@ -18,26 +20,26 @@
18
20
  "maragent": "./dist/cli/main.js"
19
21
  },
20
22
  "engines": {
21
- "node": ">=22.13 <25"
23
+ "node": ">=22.13"
22
24
  },
23
25
  "publishConfig": {
24
26
  "access": "public"
25
27
  },
26
28
  "dependencies": {
27
- "tiktoken": "1.0.22",
28
29
  "undici": "7.29.0",
29
30
  "ws": "8.21.3",
30
31
  "zod": "4.4.3"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/ws": "8.18.1"
34
+ "@types/ws": "8.18.1",
35
+ "vitest": "^4.0.14"
34
36
  },
35
37
  "scripts": {
36
- "build": "tsc -p tsconfig.json",
38
+ "build": "node ../scripts/clean-build-output.mjs dist && tsc -p tsconfig.json",
37
39
  "typecheck": "tsc -p tsconfig.json --noEmit",
38
40
  "test:unit": "vitest run --config vitest.config.ts test/unit",
39
41
  "test:performance": "vitest run --config vitest.performance.config.ts",
40
- "test:memory": "node --expose-gc ../node_modules/vitest/vitest.mjs run --config vitest.memory.config.ts",
42
+ "test:memory": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.memory.config.ts",
41
43
  "test:e2e": "vitest run --config vitest.config.ts test/e2e --no-file-parallelism",
42
44
  "test": "pnpm test:unit",
43
45
  "lint": "prettier --check ."
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @myagentroam/agent
2
-
3
- Embeddable MAR coding agent SDK and the `maragent` CLI. Internal design is documented in [`docs/design/README.md`](docs/design/README.md).
@@ -1,9 +0,0 @@
1
- import type { ExecutionMode } from '../sdk/types.js';
2
- export declare const MAR_AGENT_PROMPT_VERSION = "1.2";
3
- export declare function buildSystemPrompt(input: {
4
- mode: ExecutionMode;
5
- platform: string;
6
- workspace: string;
7
- tools: readonly string[];
8
- extension?: string | undefined;
9
- }): string;