@xenosystem/agent-sdk 0.9.21 → 0.9.22

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 (46) hide show
  1. package/README.md +6 -3
  2. package/dist/artifacts/index.cjs +1 -1
  3. package/dist/artifacts/index.js +1 -1
  4. package/dist/automation/index.d.cts +28 -0
  5. package/dist/automation/index.d.ts +28 -0
  6. package/dist/control-plane/index.cjs +1 -1
  7. package/dist/control-plane/index.js +1 -1
  8. package/dist/electron/index.cjs +132 -128
  9. package/dist/electron/index.d.cts +56 -0
  10. package/dist/electron/index.d.ts +56 -0
  11. package/dist/electron/index.js +129 -125
  12. package/dist/electron/metafile-cjs.json +1 -1
  13. package/dist/electron/metafile-esm.json +1 -1
  14. package/dist/governance/index.d.cts +29 -0
  15. package/dist/governance/index.d.ts +29 -0
  16. package/dist/hosted/index.cjs +1 -1
  17. package/dist/hosted/index.js +1 -1
  18. package/dist/hosted/metafile-cjs.json +1 -1
  19. package/dist/hosted/metafile-esm.json +1 -1
  20. package/dist/index.cjs +336 -330
  21. package/dist/index.d.cts +165 -2
  22. package/dist/index.d.ts +165 -2
  23. package/dist/index.js +333 -327
  24. package/dist/mcp/index.d.cts +28 -0
  25. package/dist/mcp/index.d.ts +28 -0
  26. package/dist/metafile-cjs.json +1 -1
  27. package/dist/metafile-esm.json +1 -1
  28. package/dist/providers/metafile-cjs.json +1 -1
  29. package/dist/providers/metafile-esm.json +1 -1
  30. package/dist/session/index.cjs +56 -54
  31. package/dist/session/index.d.cts +63 -1
  32. package/dist/session/index.d.ts +63 -1
  33. package/dist/session/index.js +56 -54
  34. package/dist/session/metafile-cjs.json +1 -1
  35. package/dist/session/metafile-esm.json +1 -1
  36. package/dist/skills/index.d.cts +28 -0
  37. package/dist/skills/index.d.ts +28 -0
  38. package/dist/ui/index.d.cts +28 -0
  39. package/dist/ui/index.d.ts +28 -0
  40. package/dist/utils/index.cjs +17 -16
  41. package/dist/utils/index.d.cts +31 -1
  42. package/dist/utils/index.d.ts +31 -1
  43. package/dist/utils/index.js +14 -13
  44. package/dist/utils/metafile-cjs.json +1 -1
  45. package/dist/utils/metafile-esm.json +1 -1
  46. package/package.json +1 -1
@@ -1 +1 @@
1
- {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":10745,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":14636,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":9029,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26059,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":11984,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1182,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"fs/promises","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/session/index.ts","inputs":{"src/session/index.ts":{"bytesInOutput":689},"src/session/id-generator.ts":{"bytesInOutput":340},"src/session/transcript.ts":{"bytesInOutput":6602},"src/utils/fs.ts":{"bytesInOutput":1447},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2302},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3195},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2698},"src/utils/path-security.ts":{"bytesInOutput":314},"src/session/recent-sessions.ts":{"bytesInOutput":4297},"src/utils/platform.ts":{"bytesInOutput":244},"src/session/manager.ts":{"bytesInOutput":4166},"src/session/turn-restore.ts":{"bytesInOutput":13491}},"bytes":43225}}}
1
+ {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":9029,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26200,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":8144,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":13384,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"crypto","kind":"require-call","external":true},{"path":"fs/promises","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:child_process","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/session/index.ts","inputs":{"src/session/index.ts":{"bytesInOutput":753},"src/session/id-generator.ts":{"bytesInOutput":340},"src/session/transcript.ts":{"bytesInOutput":7794},"src/utils/fs.ts":{"bytesInOutput":1604},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":489},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2302},"src/tools/tool-names.ts":{"bytesInOutput":190},"src/session/lock.ts":{"bytesInOutput":3195},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2698},"src/utils/path-security.ts":{"bytesInOutput":314},"src/session/recent-sessions.ts":{"bytesInOutput":4297},"src/utils/platform.ts":{"bytesInOutput":244},"src/session/manager.ts":{"bytesInOutput":4673},"src/session/recovery.ts":{"bytesInOutput":2845},"src/session/turn-restore.ts":{"bytesInOutput":13491}},"bytes":48040}}}
@@ -1 +1 @@
1
- {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":10745,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":14636,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":9029,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26059,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":11984,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1182,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["CheckpointManager","DIRECT_SHELL_CONTEXT_WARNING","MAX_DIRECT_SHELL_OUTPUT_CHARS","SessionLock","SessionManager","SessionRegistry","TranscriptWriter","TurnRestoreManager","createDirectShellMessage","forgetRecentSession","forgetRecentSessionById","formatDirectShellContext","generateSessionId","getRecentSessionsIndexPath","isDirectShellMessage","isValidSessionId","loadRecentSessionsIndex","lookupRecentSession","normalizeDirectShellResultRecord","normalizeWorkingDirectory","parseSessionId","readSessionFormatVersion","recordRecentSession"],"entryPoint":"src/session/index.ts","inputs":{"src/session/id-generator.ts":{"bytesInOutput":338},"src/session/index.ts":{"bytesInOutput":0},"src/session/transcript.ts":{"bytesInOutput":6599},"src/utils/fs.ts":{"bytesInOutput":1458},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":484},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2300},"src/tools/tool-names.ts":{"bytesInOutput":189},"src/session/lock.ts":{"bytesInOutput":3190},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2693},"src/utils/path-security.ts":{"bytesInOutput":310},"src/session/recent-sessions.ts":{"bytesInOutput":4294},"src/utils/platform.ts":{"bytesInOutput":226},"src/session/manager.ts":{"bytesInOutput":4163},"src/session/turn-restore.ts":{"bytesInOutput":13081}},"bytes":41619}}}
1
+ {"inputs":{"src/session/id-generator.ts":{"bytes":870,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fs.ts":{"bytes":11386,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/json.ts":{"bytes":804,"imports":[],"format":"esm"},"src/utils/logger.ts":{"bytes":3719,"imports":[],"format":"esm"},"src/session/direct-shell.ts":{"bytes":2317,"imports":[],"format":"esm"},"src/session/transcript.ts":{"bytes":17585,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"}],"format":"esm"},"src/tools/tool-names.ts":{"bytes":2604,"imports":[],"format":"esm"},"src/session/checkpoint.ts":{"bytes":5786,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"}],"format":"esm"},"src/runtime/shutdown.ts":{"bytes":7260,"imports":[],"format":"esm"},"src/version.ts":{"bytes":37,"imports":[],"format":"esm"},"src/session/lock.ts":{"bytes":9029,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/runtime/shutdown.ts","kind":"import-statement","original":"../runtime/shutdown.js"},{"path":"src/version.ts","kind":"import-statement","original":"../version.js"}],"format":"esm"},"src/types.ts":{"bytes":26200,"imports":[],"format":"esm"},"src/utils/path-security.ts":{"bytes":993,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/platform.ts":{"bytes":5600,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/session/recent-sessions.ts":{"bytes":15374,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/registry.ts":{"bytes":9603,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/utils/platform.ts","kind":"import-statement","original":"../utils/platform.js"}],"format":"esm"},"src/session/recovery.ts":{"bytes":8144,"imports":[{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"}],"format":"esm"},"src/session/manager.ts":{"bytes":13384,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/utils/json.ts","kind":"import-statement","original":"../utils/json.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"}],"format":"esm"},"src/session/turn-restore.ts":{"bytes":30241,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/tools/tool-names.ts","kind":"import-statement","original":"../tools/tool-names.js"},{"path":"src/utils/path-security.ts","kind":"import-statement","original":"../utils/path-security.js"}],"format":"esm"},"src/session/index.ts":{"bytes":1360,"imports":[{"path":"src/session/id-generator.ts","kind":"import-statement","original":"./id-generator.js"},{"path":"src/session/transcript.ts","kind":"import-statement","original":"./transcript.js"},{"path":"src/session/checkpoint.ts","kind":"import-statement","original":"./checkpoint.js"},{"path":"src/session/lock.ts","kind":"import-statement","original":"./lock.js"},{"path":"src/session/registry.ts","kind":"import-statement","original":"./registry.js"},{"path":"src/session/manager.ts","kind":"import-statement","original":"./manager.js"},{"path":"src/session/recovery.ts","kind":"import-statement","original":"./recovery.js"},{"path":"src/session/direct-shell.ts","kind":"import-statement","original":"./direct-shell.js"},{"path":"src/session/recent-sessions.ts","kind":"import-statement","original":"./recent-sessions.js"},{"path":"src/session/turn-restore.ts","kind":"import-statement","original":"./turn-restore.js"}],"format":"esm"}},"outputs":{"dist/session/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"crypto","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"os","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["CheckpointManager","DIRECT_SHELL_CONTEXT_WARNING","MAX_DIRECT_SHELL_OUTPUT_CHARS","SessionLock","SessionManager","SessionRegistry","TranscriptWriter","TurnRestoreManager","createDirectShellMessage","forgetRecentSession","forgetRecentSessionById","formatDirectShellContext","generateSessionId","getRecentSessionsIndexPath","isDirectShellMessage","isValidSessionId","loadRecentSessionsIndex","lookupRecentSession","normalizeDirectShellResultRecord","normalizeWorkingDirectory","parseSessionId","readSessionFormatVersion","recordRecentSession","recoverSessionMessages","repairInterruptedToolCalls"],"entryPoint":"src/session/index.ts","inputs":{"src/session/id-generator.ts":{"bytesInOutput":338},"src/session/index.ts":{"bytesInOutput":0},"src/session/transcript.ts":{"bytesInOutput":7788},"src/utils/fs.ts":{"bytesInOutput":1614},"src/utils/json.ts":{"bytesInOutput":170},"src/utils/logger.ts":{"bytesInOutput":484},"src/session/direct-shell.ts":{"bytesInOutput":1071},"src/session/checkpoint.ts":{"bytesInOutput":2300},"src/tools/tool-names.ts":{"bytesInOutput":189},"src/session/lock.ts":{"bytesInOutput":3190},"src/runtime/shutdown.ts":{"bytesInOutput":400},"src/version.ts":{"bytesInOutput":16},"src/session/registry.ts":{"bytesInOutput":2693},"src/utils/path-security.ts":{"bytesInOutput":310},"src/session/recent-sessions.ts":{"bytesInOutput":4299},"src/utils/platform.ts":{"bytesInOutput":226},"src/session/manager.ts":{"bytesInOutput":4670},"src/session/recovery.ts":{"bytesInOutput":2845},"src/session/turn-restore.ts":{"bytesInOutput":13081}},"bytes":46383}}}
@@ -1,3 +1,30 @@
1
+ declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
+ interface WebContextEvidenceProjection {
3
+ evidenceId: string;
4
+ requestId: string;
5
+ sourceUrl: string;
6
+ finalUrl?: string;
7
+ citations: Array<{
8
+ url: string;
9
+ title?: string;
10
+ artifactId?: string;
11
+ }>;
12
+ }
13
+ interface WebContextToolResult {
14
+ schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA;
15
+ operation: "search" | "fetch";
16
+ requestId: string;
17
+ evidence: WebContextEvidenceProjection;
18
+ job?: {
19
+ jobId: string;
20
+ state: string;
21
+ };
22
+ artifact?: {
23
+ artifactId: string;
24
+ mediaType: string;
25
+ bytes: number;
26
+ };
27
+ }
1
28
  interface ToolDefinition {
2
29
  name: string;
3
30
  description: string;
@@ -104,6 +131,7 @@ interface ToolResult {
104
131
  assistantOnlyContent?: ToolAssistantContentBlock[];
105
132
  operation?: ToolOperationSnapshot;
106
133
  evidence?: ToolEvidence[];
134
+ webContext?: WebContextToolResult;
107
135
  retryable?: boolean;
108
136
  }
109
137
  interface ToolExecutionContext {
@@ -1,3 +1,30 @@
1
+ declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
+ interface WebContextEvidenceProjection {
3
+ evidenceId: string;
4
+ requestId: string;
5
+ sourceUrl: string;
6
+ finalUrl?: string;
7
+ citations: Array<{
8
+ url: string;
9
+ title?: string;
10
+ artifactId?: string;
11
+ }>;
12
+ }
13
+ interface WebContextToolResult {
14
+ schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA;
15
+ operation: "search" | "fetch";
16
+ requestId: string;
17
+ evidence: WebContextEvidenceProjection;
18
+ job?: {
19
+ jobId: string;
20
+ state: string;
21
+ };
22
+ artifact?: {
23
+ artifactId: string;
24
+ mediaType: string;
25
+ bytes: number;
26
+ };
27
+ }
1
28
  interface ToolDefinition {
2
29
  name: string;
3
30
  description: string;
@@ -104,6 +131,7 @@ interface ToolResult {
104
131
  assistantOnlyContent?: ToolAssistantContentBlock[];
105
132
  operation?: ToolOperationSnapshot;
106
133
  evidence?: ToolEvidence[];
134
+ webContext?: WebContextToolResult;
107
135
  retryable?: boolean;
108
136
  }
109
137
  interface ToolExecutionContext {
@@ -1,3 +1,30 @@
1
+ declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
+ interface WebContextEvidenceProjection {
3
+ evidenceId: string;
4
+ requestId: string;
5
+ sourceUrl: string;
6
+ finalUrl?: string;
7
+ citations: Array<{
8
+ url: string;
9
+ title?: string;
10
+ artifactId?: string;
11
+ }>;
12
+ }
13
+ interface WebContextToolResult {
14
+ schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA;
15
+ operation: "search" | "fetch";
16
+ requestId: string;
17
+ evidence: WebContextEvidenceProjection;
18
+ job?: {
19
+ jobId: string;
20
+ state: string;
21
+ };
22
+ artifact?: {
23
+ artifactId: string;
24
+ mediaType: string;
25
+ bytes: number;
26
+ };
27
+ }
1
28
  interface ImageUrlBlock {
2
29
  type: "image_url";
3
30
  image_url: {
@@ -71,6 +98,7 @@ interface ToolResult {
71
98
  assistantOnlyContent?: ToolAssistantContentBlock[];
72
99
  operation?: ToolOperationSnapshot;
73
100
  evidence?: ToolEvidence[];
101
+ webContext?: WebContextToolResult;
74
102
  retryable?: boolean;
75
103
  }
76
104
  interface TextBlock {
@@ -1,3 +1,30 @@
1
+ declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
2
+ interface WebContextEvidenceProjection {
3
+ evidenceId: string;
4
+ requestId: string;
5
+ sourceUrl: string;
6
+ finalUrl?: string;
7
+ citations: Array<{
8
+ url: string;
9
+ title?: string;
10
+ artifactId?: string;
11
+ }>;
12
+ }
13
+ interface WebContextToolResult {
14
+ schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA;
15
+ operation: "search" | "fetch";
16
+ requestId: string;
17
+ evidence: WebContextEvidenceProjection;
18
+ job?: {
19
+ jobId: string;
20
+ state: string;
21
+ };
22
+ artifact?: {
23
+ artifactId: string;
24
+ mediaType: string;
25
+ bytes: number;
26
+ };
27
+ }
1
28
  interface ImageUrlBlock {
2
29
  type: "image_url";
3
30
  image_url: {
@@ -71,6 +98,7 @@ interface ToolResult {
71
98
  assistantOnlyContent?: ToolAssistantContentBlock[];
72
99
  operation?: ToolOperationSnapshot;
73
100
  evidence?: ToolEvidence[];
101
+ webContext?: WebContextToolResult;
74
102
  retryable?: boolean;
75
103
  }
76
104
  interface TextBlock {
@@ -1,23 +1,24 @@
1
- "use strict";var gt=Object.create;var w=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var bt=(t,e)=>{for(var n in e)w(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xt(e))!Et.call(t,o)&&o!==n&&w(t,o,{get:()=>e[o],enumerable:!(r=ht(e,o))||r.enumerable});return t};var _=(t,e,n)=>(n=t!=null?gt(yt(t)):{},B(e||!t||!t.__esModule?w(n,"default",{value:t,enumerable:!0}):n,t)),wt=t=>B(w({},"__esModule",{value:!0}),t);var Ke={};bt(Ke,{ApiTransientError:()=>b,HOME_DIR:()=>Vt,IS_LINUX:()=>Qt,IS_MAC:()=>Kt,IS_WINDOWS:()=>K,LogLevel:()=>Z,OS_VERSION:()=>Zt,PLATFORM:()=>R,accountTextTokens:()=>Re,appendLine:()=>_t,benchmarkLeakError:()=>Fe,buildToolResultBlock:()=>Ge,buildToolResultText:()=>mt,calculateCost:()=>Se,commandMentionsBenchmarkLeak:()=>We,conservativeTokenAccountingAdapter:()=>rt,copyTextToClipboard:()=>Ce,createSafeRegex:()=>ce,debug:()=>pe,decodeTextBuffer:()=>F,deleteDir:()=>Dt,deleteFile:()=>It,detectLineEnding:()=>j,detectPreferredLineEnding:()=>$t,detectTextEncoding:()=>I,encodeTextBuffer:()=>W,ensureDir:()=>C,error:()=>he,estimateTokens:()=>ot,estimateTokensForModel:()=>nt,existsSync:()=>Lt,filterBenchmarkLeakPaths:()=>De,findSimilarFile:()=>vt,fitsInBudget:()=>ke,formatCost:()=>_e,getAgentHome:()=>te,getBenchmarkReferenceOverwriteHint:()=>je,getBoolean:()=>ue,getConfigDir:()=>ee,getLogLevel:()=>de,getNumber:()=>ae,getProjectConfigDir:()=>ne,getRetryErrorContext:()=>N,getShellName:()=>re,getString:()=>se,getToolResultTransportContent:()=>Je,hasDir:()=>Tt,hasDisallowedAsciiControlCharacter:()=>Ue,hasFile:()=>Rt,hasFrontmatter:()=>Jt,hasNonTextToolResultContent:()=>Ye,hasTransientStatusMention:()=>tt,info:()=>me,isBenchmarkLeakPath:()=>O,isBenchmarkMode:()=>v,isGitRepo:()=>oe,isPathSafe:()=>G,isRetryableError:()=>et,listDirs:()=>Pt,listFiles:()=>Bt,normalizeLineEndings:()=>q,parseDocument:()=>qt,parseJsonLines:()=>jt,readFileSafe:()=>kt,readIfExists:()=>Ot,readTextFile:()=>H,remainingBudget:()=>Ae,safeJsonParse:()=>Ft,safeJsonStringify:()=>Wt,safeRegexTest:()=>le,safeResolvePath:()=>Ut,setLogLevel:()=>fe,stringifyDocument:()=>Ht,toTransportAssistantBlocks:()=>ze,toolAssistantContentToText:()=>dt,toolResultContentToText:()=>He,truncateToTokens:()=>Te,validateRegexPattern:()=>Q,validateRequired:()=>ie,warn:()=>ge,withRetry:()=>we,writeAtomic:()=>P,writeTextFile:()=>Ct});module.exports=wt(Ke);var E=require("node:fs"),h=require("node:fs"),c=_(require("node:fs/promises"),1),a=_(require("node:path"),1);function Rt(t){try{return(0,h.existsSync)(t)&&(0,h.statSync)(t).isFile()}catch{return!1}}function Tt(t){try{return(0,h.existsSync)(t)&&(0,h.statSync)(t).isDirectory()}catch{return!1}}function kt(t,e=""){try{return(0,E.readFileSync)(t,"utf-8")}catch{return e}}async function C(t){await c.mkdir(t,{recursive:!0})}async function P(t,e){let n=a.dirname(t);await C(n);let r=Math.random().toString(36).substring(2,15),o=`${t}.tmp.${process.pid}.${r}`;try{await c.writeFile(o,e),await St(o,t)}finally{try{await c.unlink(o)}catch{}}}var At=new Set(["EACCES","EBUSY","EPERM"]),Mt=[10,20,40,80,160,320,640];async function St(t,e){for(let n=0;;n+=1)try{await c.rename(t,e);return}catch(r){let o=r.code,i=Mt[n];if(process.platform!=="win32"||!o||!At.has(o)||i===void 0)throw r;await new Promise(s=>setTimeout(s,i))}}async function _t(t,e){let n=a.dirname(t);await C(n),await c.appendFile(t,e+`
2
- `,"utf-8")}function I(t){return t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191?"utf8-bom":t.length>=2&&t[0]===255&&t[1]===254?"utf16le":t.length>=2&&t[0]===254&&t[1]===255?"utf16be":"utf8"}function D(t){let e=Buffer.from(t);for(let n=0;n+1<e.length;n+=2){let r=e[n];e[n]=e[n+1],e[n+1]=r}return e}function F(t,e){switch(e){case"utf8-bom":return t.subarray(3).toString("utf8");case"utf16le":return t.subarray(2).toString("utf16le");case"utf16be":return D(t.subarray(2)).toString("utf16le");default:return t.toString("utf8")}}function W(t,e){switch(e){case"utf8-bom":return Buffer.concat([Buffer.from([239,187,191]),Buffer.from(t,"utf8")]);case"utf16le":return Buffer.concat([Buffer.from([255,254]),Buffer.from(t,"utf16le")]);case"utf16be":return Buffer.concat([Buffer.from([254,255]),D(Buffer.from(t,"utf16le"))]);default:return Buffer.from(t,"utf8")}}function j(t){return t.includes(`\r
1
+ "use strict";var gt=Object.create;var E=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty;var bt=(t,e)=>{for(var n in e)E(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xt(e))!wt.call(t,o)&&o!==n&&E(t,o,{get:()=>e[o],enumerable:!(r=ht(e,o))||r.enumerable});return t};var C=(t,e,n)=>(n=t!=null?gt(yt(t)):{},B(e||!t||!t.__esModule?E(n,"default",{value:t,enumerable:!0}):n,t)),Et=t=>B(E({},"__esModule",{value:!0}),t);var Qe={};bt(Qe,{ApiTransientError:()=>b,HOME_DIR:()=>te,IS_LINUX:()=>Zt,IS_MAC:()=>Qt,IS_WINDOWS:()=>K,LogLevel:()=>Z,OS_VERSION:()=>Vt,PLATFORM:()=>T,accountTextTokens:()=>Te,appendDurableLine:()=>Ct,appendLine:()=>_t,benchmarkLeakError:()=>We,buildToolResultBlock:()=>Ue,buildToolResultText:()=>mt,calculateCost:()=>_e,commandMentionsBenchmarkLeak:()=>je,conservativeTokenAccountingAdapter:()=>rt,copyTextToClipboard:()=>$e,createSafeRegex:()=>le,debug:()=>me,decodeTextBuffer:()=>F,deleteDir:()=>Ft,deleteFile:()=>It,detectLineEnding:()=>j,detectPreferredLineEnding:()=>Nt,detectTextEncoding:()=>D,encodeTextBuffer:()=>W,ensureDir:()=>R,error:()=>xe,estimateTokens:()=>ot,estimateTokensForModel:()=>nt,existsSync:()=>Bt,filterBenchmarkLeakPaths:()=>Fe,findSimilarFile:()=>Ot,fitsInBudget:()=>Ae,formatCost:()=>Ce,getAgentHome:()=>ee,getBenchmarkReferenceOverwriteHint:()=>qe,getBoolean:()=>ce,getConfigDir:()=>ne,getLogLevel:()=>pe,getNumber:()=>ue,getProjectConfigDir:()=>re,getRetryErrorContext:()=>N,getShellName:()=>oe,getString:()=>ae,getToolResultTransportContent:()=>Xe,hasDir:()=>Tt,hasDisallowedAsciiControlCharacter:()=>Ke,hasFile:()=>Rt,hasFrontmatter:()=>Xt,hasNonTextToolResultContent:()=>ze,hasTransientStatusMention:()=>tt,info:()=>ge,isBenchmarkLeakPath:()=>O,isBenchmarkMode:()=>v,isGitRepo:()=>ie,isPathSafe:()=>G,isRetryableError:()=>et,listDirs:()=>Dt,listFiles:()=>Pt,normalizeLineEndings:()=>q,parseDocument:()=>Ht,parseJsonLines:()=>qt,readFileSafe:()=>kt,readIfExists:()=>Lt,readTextFile:()=>H,remainingBudget:()=>Me,safeJsonParse:()=>Wt,safeJsonStringify:()=>jt,safeRegexTest:()=>fe,safeResolvePath:()=>Kt,setLogLevel:()=>de,stringifyDocument:()=>Jt,toTransportAssistantBlocks:()=>Ge,toolAssistantContentToText:()=>dt,toolResultContentToText:()=>Je,truncateToTokens:()=>ke,validateRegexPattern:()=>Q,validateRequired:()=>se,warn:()=>he,withRetry:()=>Re,writeAtomic:()=>P,writeTextFile:()=>$t});module.exports=Et(Qe);var w=require("node:fs"),h=require("node:fs"),c=C(require("node:fs/promises"),1),a=C(require("node:path"),1);function Rt(t){try{return(0,h.existsSync)(t)&&(0,h.statSync)(t).isFile()}catch{return!1}}function Tt(t){try{return(0,h.existsSync)(t)&&(0,h.statSync)(t).isDirectory()}catch{return!1}}function kt(t,e=""){try{return(0,w.readFileSync)(t,"utf-8")}catch{return e}}async function R(t){await c.mkdir(t,{recursive:!0})}async function P(t,e){let n=a.dirname(t);await R(n);let r=Math.random().toString(36).substring(2,15),o=`${t}.tmp.${process.pid}.${r}`;try{await c.writeFile(o,e),await St(o,t)}finally{try{await c.unlink(o)}catch{}}}var At=new Set(["EACCES","EBUSY","EPERM"]),Mt=[10,20,40,80,160,320,640];async function St(t,e){for(let n=0;;n+=1)try{await c.rename(t,e);return}catch(r){let o=r.code,i=Mt[n];if(process.platform!=="win32"||!o||!At.has(o)||i===void 0)throw r;await new Promise(s=>setTimeout(s,i))}}async function _t(t,e){let n=a.dirname(t);await R(n),await c.appendFile(t,e+`
2
+ `,"utf-8")}async function Ct(t,e){let n=a.dirname(t);await R(n);let r=await c.open(t,"a");try{await r.writeFile(e+`
3
+ `,"utf-8"),await r.sync()}finally{await r.close()}}function D(t){return t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191?"utf8-bom":t.length>=2&&t[0]===255&&t[1]===254?"utf16le":t.length>=2&&t[0]===254&&t[1]===255?"utf16be":"utf8"}function I(t){let e=Buffer.from(t);for(let n=0;n+1<e.length;n+=2){let r=e[n];e[n]=e[n+1],e[n+1]=r}return e}function F(t,e){switch(e){case"utf8-bom":return t.subarray(3).toString("utf8");case"utf16le":return t.subarray(2).toString("utf16le");case"utf16be":return I(t.subarray(2)).toString("utf16le");default:return t.toString("utf8")}}function W(t,e){switch(e){case"utf8-bom":return Buffer.concat([Buffer.from([239,187,191]),Buffer.from(t,"utf8")]);case"utf16le":return Buffer.concat([Buffer.from([255,254]),Buffer.from(t,"utf16le")]);case"utf16be":return Buffer.concat([Buffer.from([254,255]),I(Buffer.from(t,"utf16le"))]);default:return Buffer.from(t,"utf8")}}function j(t){return t.includes(`\r
3
4
  `)?"CRLF":"LF"}function q(t,e){let n=t.replace(/\r\n/g,`
4
5
  `);return e==="CRLF"?n.replace(/\n/g,`\r
5
- `):n}async function H(t){let e=await c.readFile(t),n=I(e),r=F(e,n);return{content:r,encoding:n,lineEnding:j(r),sizeBytes:e.length}}async function Ct(t,e,n){let r=q(e,n?.lineEnding??"LF");await P(t,W(r,n?.encoding??"utf8"))}async function $t(t){let e=new Set,n=a.resolve(t);for(;!e.has(n);){e.add(n);try{let o=(0,E.readdirSync)(n,{withFileTypes:!0}).filter(i=>i.isFile()).map(i=>i.name).sort();for(let i of o){if(i.startsWith("."))continue;let s=a.extname(i).toLowerCase();if([".ts",".tsx",".js",".jsx",".json",".md",".txt",".yaml",".yml",".css",".html",".xml",".sh",".ps1"].includes(s))try{let u=a.join(n,i),l=await H(u);if(l.content.length>0)return l.lineEnding}catch{}}}catch{}let r=a.dirname(n);if(r===n)break;n=r}return"LF"}function Nt(t,e,n){let r=[],o=[{dir:t,depth:0}],i=new Set;for(;o.length>0&&r.length<n;){let s=o.shift();if(!i.has(s.dir)){i.add(s.dir);try{let u=(0,E.readdirSync)(s.dir,{withFileTypes:!0});for(let l of u){let d=a.join(s.dir,l.name);if(l.isFile()){if(r.push(d),r.length>=n)break;continue}l.isDirectory()&&s.depth<e&&!l.name.startsWith(".")&&l.name!=="node_modules"&&o.push({dir:d,depth:s.depth+1})}}catch{}}}return r}function vt(t){try{let e=a.dirname(t),n=a.basename(t,a.extname(t)).toLowerCase(),r=a.basename(t).toLowerCase(),i=[e,a.dirname(e)].flatMap(u=>Nt(u,2,500)),s=null;for(let u of i){let l=a.basename(u).toLowerCase(),d=a.basename(u,a.extname(u)).toLowerCase(),g=null;if(l===r?g=0:d===n?g=1:(l.includes(n)||n.includes(d))&&(g=2),g===null)continue;let S=a.relative(e,u).split(a.sep).length,L=g+S*.01;(!s||L<s.score)&&(s={filePath:u,score:L})}return s?.filePath??null}catch{}return null}async function Ot(t){try{return await c.readFile(t,"utf-8")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Lt(t){return(0,h.existsSync)(t)}async function Bt(t,e){try{let r=(await c.readdir(t,{withFileTypes:!0})).filter(o=>o.isFile()).map(o=>a.join(t,o.name));return e&&(r=r.filter(o=>e.test(a.basename(o)))),r}catch(n){if(n.code==="ENOENT")return[];throw n}}async function Pt(t){try{return(await c.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>a.join(t,n.name))}catch(e){if(e.code==="ENOENT")return[];throw e}}async function It(t){try{await c.unlink(t)}catch(e){if(e.code!=="ENOENT")throw e}}async function Dt(t){try{await c.rm(t,{recursive:!0,force:!0})}catch(e){if(e.code!=="ENOENT")throw e}}function Ft(t,e){try{return JSON.parse(t)}catch{return e}}function Wt(t,e="{}"){try{return JSON.stringify(t)}catch{return e}}function jt(t){let e=[];for(let n of t.split(`
6
- `)){let r=n.trim();if(r)try{e.push(JSON.parse(r))}catch{}}return e}function qt(t){let e=Xt(t);return{frontmatter:e.frontmatter,content:e.content.trim()}}function Ht(t,e){let n=Object.fromEntries(Object.entries(t).filter(([r,o])=>o!==void 0));return["---",z(n),"---","",e].join(`
7
- `)}function Jt(t){return t.trimStart().startsWith("---")}function Xt(t){let e=t.replace(/^\uFEFF/,"");if(!e.startsWith("---"))return{frontmatter:{},content:t};let n=e.search(/\r?\n/);if(n<0||e.slice(0,n).trim()!=="---")return{frontmatter:{},content:t};let r=e.slice(n+(e[n]==="\r"?2:1)),o=r.match(/(?:^|\r?\n)---[ \t]*(?:\r?\n|$)/);if(!o||o.index===void 0)throw new Error("YAML frontmatter is not closed.");let i=r.slice(0,o.index),s=o[0],u=o.index+s.length;return{frontmatter:X(i),content:r.slice(u)}}function X(t){let e={},n=t.split(/\r?\n/);for(let r=0;r<n.length;r+=1){let o=n[r];if(!o.trim()||o.trimStart().startsWith("#"))continue;if(/^\s/.test(o))throw new Error(`Unexpected indentation at line ${r+1}.`);let i=zt(o,r+1);if(i.key==="<<")throw new Error("YAML merge keys are not supported.");if(i.value!==""){e[i.key]=Y(i.value,r+1);continue}let s=Yt(n,r+1);e[i.key]=s.value,r=s.nextIndex-1}return e}function Yt(t,e){let n=[],r=e;for(;r<t.length;r+=1){let i=t[r];if(!i.trim()){n.push(i);continue}if(!/^\s/.test(i))break;n.push(i.replace(/^ {2}/,""))}let o=n.filter(i=>i.trim()&&!i.trimStart().startsWith("#"));return o.length===0?{value:{},nextIndex:r}:o.every(i=>i.trimStart().startsWith("- "))?{value:o.map((i,s)=>Y(i.trimStart().slice(2),e+s+1)),nextIndex:r}:{value:X(n.join(`
8
- `)),nextIndex:r}}function zt(t,e){let n=t.indexOf(":");if(n<=0)throw new Error(`Invalid YAML line ${e}.`);let r=t.slice(0,n).trim(),o=t.slice(n+1).trim();if(!r)throw new Error(`Invalid YAML key at line ${e}.`);return{key:r,value:o}}function Y(t,e){if(t==="")return"";if(t==="[]")return[];if(t==="{}")return{};if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;if(/^-?\d+(?:\.\d+)?$/.test(t))return Number(t);if(t.startsWith('"'))return J(t,e);if(t.startsWith("'")){if(!t.endsWith("'"))throw new Error(`Unclosed quoted scalar at line ${e}.`);return t.slice(1,-1).replace(/''/g,"'")}if(t.startsWith("[")||t.startsWith("{"))return J(t,e);if(t.includes("[")||t.includes("]")||t.includes("{")||t.includes("}"))throw new Error(`Unsupported YAML scalar at line ${e}.`);return t}function J(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid YAML scalar at line ${e}.`)}}function z(t,e=""){return Object.entries(t).map(([n,r])=>Gt(n,r,e)).join(`
9
- `)}function Gt(t,e,n){return Array.isArray(e)?`${n}${t}: ${JSON.stringify(e)}`:e&&typeof e=="object"?`${n}${t}:
10
- ${z(e,`${n} `)}`:`${n}${t}: ${JSON.stringify(e)}`}var f=_(require("path"),1);function G(t,e){let n=f.resolve(t),r=f.resolve(t,e);return r===n?!0:n===f.parse(n).root?r.startsWith(n):r.startsWith(n+f.sep)}function Ut(t,e){if(f.isAbsolute(e))return f.resolve(e);if(!G(t,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return f.resolve(t,e)}var p=require("node:os"),U=require("node:child_process"),x=require("node:path"),R=(0,p.platform)(),K=R==="win32",Kt=R==="darwin",Qt=R==="linux",Zt=(0,p.release)(),Vt=(0,p.homedir)();function te(){let t=process.env.XENO_AGENT_HOME?.trim();return t?(0,x.resolve)(t):(0,x.resolve)((0,p.homedir)(),".xeno-agent")}function ee(){let t=process.env.XENO_CONFIG_DIR?.trim();return t?(0,x.resolve)(t):(0,x.resolve)((0,p.homedir)(),".xeno-code")}function ne(t){return(0,x.resolve)(t,".xeno-code")}function re(){return K?"powershell":process.env.SHELL?.split("/").pop()??"bash"}function oe(t){try{return(0,U.execSync)("git rev-parse --is-inside-work-tree",{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function ie(t,e){for(let n of e)if(t[n]===void 0||t[n]===null||t[n]==="")return`Missing required parameter: ${n}`;return null}function se(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="string")throw new Error(`Parameter ${e} must be a string, got ${typeof r}`);return r}function ae(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="number")throw new Error(`Parameter ${e} must be a number, got ${typeof r}`);if(isNaN(r))throw new Error(`Parameter ${e} is NaN`);return r}function ue(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="boolean")throw new Error(`Parameter ${e} must be a boolean, got ${typeof r}`);return r}function Q(t){if(t.length>5e3)return"Pattern too long (max 5000 characters)";let n=[/(\.\*){3,}/,/(\+\+|\*\*)/,/(.*\+.*\+.*\+)/];for(let r of n)if(r.test(t))return"Pattern contains potentially unsafe constructs that could cause excessive backtracking";return null}function ce(t,e,n=5e3){let r=Q(t);if(r)throw new Error(r);try{return new RegExp(t,e)}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`Invalid regex pattern: ${i}`)}}function le(t,e,n=1e3){if(e.length>1e5)throw new Error(`Input too large for safe regex test (${e.length} chars, max 100000)`);return t.test(e)}var Z=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Z||{}),y=1;function fe(t){y=t}function de(){return y}function m(){return new Date().toISOString()}function pe(t,e){y<=0&&(e!==void 0?process.stderr.write(`[${m()}] DEBUG: ${t} ${T(e)}
6
+ `):n}async function H(t){let e=await c.readFile(t),n=D(e),r=F(e,n);return{content:r,encoding:n,lineEnding:j(r),sizeBytes:e.length}}async function $t(t,e,n){let r=q(e,n?.lineEnding??"LF");await P(t,W(r,n?.encoding??"utf8"))}async function Nt(t){let e=new Set,n=a.resolve(t);for(;!e.has(n);){e.add(n);try{let o=(0,w.readdirSync)(n,{withFileTypes:!0}).filter(i=>i.isFile()).map(i=>i.name).sort();for(let i of o){if(i.startsWith("."))continue;let s=a.extname(i).toLowerCase();if([".ts",".tsx",".js",".jsx",".json",".md",".txt",".yaml",".yml",".css",".html",".xml",".sh",".ps1"].includes(s))try{let u=a.join(n,i),l=await H(u);if(l.content.length>0)return l.lineEnding}catch{}}}catch{}let r=a.dirname(n);if(r===n)break;n=r}return"LF"}function vt(t,e,n){let r=[],o=[{dir:t,depth:0}],i=new Set;for(;o.length>0&&r.length<n;){let s=o.shift();if(!i.has(s.dir)){i.add(s.dir);try{let u=(0,w.readdirSync)(s.dir,{withFileTypes:!0});for(let l of u){let d=a.join(s.dir,l.name);if(l.isFile()){if(r.push(d),r.length>=n)break;continue}l.isDirectory()&&s.depth<e&&!l.name.startsWith(".")&&l.name!=="node_modules"&&o.push({dir:d,depth:s.depth+1})}}catch{}}}return r}function Ot(t){try{let e=a.dirname(t),n=a.basename(t,a.extname(t)).toLowerCase(),r=a.basename(t).toLowerCase(),i=[e,a.dirname(e)].flatMap(u=>vt(u,2,500)),s=null;for(let u of i){let l=a.basename(u).toLowerCase(),d=a.basename(u,a.extname(u)).toLowerCase(),g=null;if(l===r?g=0:d===n?g=1:(l.includes(n)||n.includes(d))&&(g=2),g===null)continue;let _=a.relative(e,u).split(a.sep).length,L=g+_*.01;(!s||L<s.score)&&(s={filePath:u,score:L})}return s?.filePath??null}catch{}return null}async function Lt(t){try{return await c.readFile(t,"utf-8")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Bt(t){return(0,h.existsSync)(t)}async function Pt(t,e){try{let r=(await c.readdir(t,{withFileTypes:!0})).filter(o=>o.isFile()).map(o=>a.join(t,o.name));return e&&(r=r.filter(o=>e.test(a.basename(o)))),r}catch(n){if(n.code==="ENOENT")return[];throw n}}async function Dt(t){try{return(await c.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>a.join(t,n.name))}catch(e){if(e.code==="ENOENT")return[];throw e}}async function It(t){try{await c.unlink(t)}catch(e){if(e.code!=="ENOENT")throw e}}async function Ft(t){try{await c.rm(t,{recursive:!0,force:!0})}catch(e){if(e.code!=="ENOENT")throw e}}function Wt(t,e){try{return JSON.parse(t)}catch{return e}}function jt(t,e="{}"){try{return JSON.stringify(t)}catch{return e}}function qt(t){let e=[];for(let n of t.split(`
7
+ `)){let r=n.trim();if(r)try{e.push(JSON.parse(r))}catch{}}return e}function Ht(t){let e=Yt(t);return{frontmatter:e.frontmatter,content:e.content.trim()}}function Jt(t,e){let n=Object.fromEntries(Object.entries(t).filter(([r,o])=>o!==void 0));return["---",z(n),"---","",e].join(`
8
+ `)}function Xt(t){return t.trimStart().startsWith("---")}function Yt(t){let e=t.replace(/^\uFEFF/,"");if(!e.startsWith("---"))return{frontmatter:{},content:t};let n=e.search(/\r?\n/);if(n<0||e.slice(0,n).trim()!=="---")return{frontmatter:{},content:t};let r=e.slice(n+(e[n]==="\r"?2:1)),o=r.match(/(?:^|\r?\n)---[ \t]*(?:\r?\n|$)/);if(!o||o.index===void 0)throw new Error("YAML frontmatter is not closed.");let i=r.slice(0,o.index),s=o[0],u=o.index+s.length;return{frontmatter:X(i),content:r.slice(u)}}function X(t){let e={},n=t.split(/\r?\n/);for(let r=0;r<n.length;r+=1){let o=n[r];if(!o.trim()||o.trimStart().startsWith("#"))continue;if(/^\s/.test(o))throw new Error(`Unexpected indentation at line ${r+1}.`);let i=Gt(o,r+1);if(i.key==="<<")throw new Error("YAML merge keys are not supported.");if(i.value!==""){e[i.key]=Y(i.value,r+1);continue}let s=zt(n,r+1);e[i.key]=s.value,r=s.nextIndex-1}return e}function zt(t,e){let n=[],r=e;for(;r<t.length;r+=1){let i=t[r];if(!i.trim()){n.push(i);continue}if(!/^\s/.test(i))break;n.push(i.replace(/^ {2}/,""))}let o=n.filter(i=>i.trim()&&!i.trimStart().startsWith("#"));return o.length===0?{value:{},nextIndex:r}:o.every(i=>i.trimStart().startsWith("- "))?{value:o.map((i,s)=>Y(i.trimStart().slice(2),e+s+1)),nextIndex:r}:{value:X(n.join(`
9
+ `)),nextIndex:r}}function Gt(t,e){let n=t.indexOf(":");if(n<=0)throw new Error(`Invalid YAML line ${e}.`);let r=t.slice(0,n).trim(),o=t.slice(n+1).trim();if(!r)throw new Error(`Invalid YAML key at line ${e}.`);return{key:r,value:o}}function Y(t,e){if(t==="")return"";if(t==="[]")return[];if(t==="{}")return{};if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;if(/^-?\d+(?:\.\d+)?$/.test(t))return Number(t);if(t.startsWith('"'))return J(t,e);if(t.startsWith("'")){if(!t.endsWith("'"))throw new Error(`Unclosed quoted scalar at line ${e}.`);return t.slice(1,-1).replace(/''/g,"'")}if(t.startsWith("[")||t.startsWith("{"))return J(t,e);if(t.includes("[")||t.includes("]")||t.includes("{")||t.includes("}"))throw new Error(`Unsupported YAML scalar at line ${e}.`);return t}function J(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid YAML scalar at line ${e}.`)}}function z(t,e=""){return Object.entries(t).map(([n,r])=>Ut(n,r,e)).join(`
10
+ `)}function Ut(t,e,n){return Array.isArray(e)?`${n}${t}: ${JSON.stringify(e)}`:e&&typeof e=="object"?`${n}${t}:
11
+ ${z(e,`${n} `)}`:`${n}${t}: ${JSON.stringify(e)}`}var f=C(require("path"),1);function G(t,e){let n=f.resolve(t),r=f.resolve(t,e);return r===n?!0:n===f.parse(n).root?r.startsWith(n):r.startsWith(n+f.sep)}function Kt(t,e){if(f.isAbsolute(e))return f.resolve(e);if(!G(t,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return f.resolve(t,e)}var p=require("node:os"),U=require("node:child_process"),x=require("node:path"),T=(0,p.platform)(),K=T==="win32",Qt=T==="darwin",Zt=T==="linux",Vt=(0,p.release)(),te=(0,p.homedir)();function ee(){let t=process.env.XENO_AGENT_HOME?.trim();return t?(0,x.resolve)(t):(0,x.resolve)((0,p.homedir)(),".xeno-agent")}function ne(){let t=process.env.XENO_CONFIG_DIR?.trim();return t?(0,x.resolve)(t):(0,x.resolve)((0,p.homedir)(),".xeno-code")}function re(t){return(0,x.resolve)(t,".xeno-code")}function oe(){return K?"powershell":process.env.SHELL?.split("/").pop()??"bash"}function ie(t){try{return(0,U.execSync)("git rev-parse --is-inside-work-tree",{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function se(t,e){for(let n of e)if(t[n]===void 0||t[n]===null||t[n]==="")return`Missing required parameter: ${n}`;return null}function ae(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="string")throw new Error(`Parameter ${e} must be a string, got ${typeof r}`);return r}function ue(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="number")throw new Error(`Parameter ${e} must be a number, got ${typeof r}`);if(isNaN(r))throw new Error(`Parameter ${e} is NaN`);return r}function ce(t,e,n){let r=t[e];if(r==null){if(n!==void 0)return n;throw new Error(`Missing required parameter: ${e}`)}if(typeof r!="boolean")throw new Error(`Parameter ${e} must be a boolean, got ${typeof r}`);return r}function Q(t){if(t.length>5e3)return"Pattern too long (max 5000 characters)";let n=[/(\.\*){3,}/,/(\+\+|\*\*)/,/(.*\+.*\+.*\+)/];for(let r of n)if(r.test(t))return"Pattern contains potentially unsafe constructs that could cause excessive backtracking";return null}function le(t,e,n=5e3){let r=Q(t);if(r)throw new Error(r);try{return new RegExp(t,e)}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`Invalid regex pattern: ${i}`)}}function fe(t,e,n=1e3){if(e.length>1e5)throw new Error(`Input too large for safe regex test (${e.length} chars, max 100000)`);return t.test(e)}var Z=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Z||{}),y=1;function de(t){y=t}function pe(){return y}function m(){return new Date().toISOString()}function me(t,e){y<=0&&(e!==void 0?process.stderr.write(`[${m()}] DEBUG: ${t} ${k(e)}
11
12
  `):process.stderr.write(`[${m()}] DEBUG: ${t}
12
- `))}function me(t,e){y<=1&&(e!==void 0?process.stderr.write(`[${m()}] INFO: ${t} ${T(e)}
13
+ `))}function ge(t,e){y<=1&&(e!==void 0?process.stderr.write(`[${m()}] INFO: ${t} ${k(e)}
13
14
  `):process.stderr.write(`[${m()}] INFO: ${t}
14
- `))}function ge(t,e){y<=2&&(e!==void 0?process.stderr.write(`[${m()}] WARN: ${t} ${T(e)}
15
+ `))}function he(t,e){y<=2&&(e!==void 0?process.stderr.write(`[${m()}] WARN: ${t} ${k(e)}
15
16
  `):process.stderr.write(`[${m()}] WARN: ${t}
16
- `))}function he(t,e){y<=3&&(e!==void 0?process.stderr.write(`[${m()}] ERROR: ${t} ${T(e)}
17
+ `))}function xe(t,e){y<=3&&(e!==void 0?process.stderr.write(`[${m()}] ERROR: ${t} ${k(e)}
17
18
  `):process.stderr.write(`[${m()}] ERROR: ${t}
18
- `))}function T(t){if(t==null)return"";if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}var b=class extends Error{statusCode;body;retryAfterMs;requestId;cfRay;constructor(e,n={}){super(e),this.name="ApiTransientError",this.statusCode=n.statusCode,this.retryAfterMs=n.retryAfterMs,this.requestId=n.requestId,this.cfRay=n.cfRay}},k={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function A(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function xe(t={}){let e=Math.max(0,t.maxRetries??A("XENO_API_MAX_RETRIES",k.maxRetries)),n=Math.max(50,t.baseDelayMs??A("XENO_API_BASE_DELAY_MS",k.baseDelayMs)),r=Math.max(n,t.maxDelayMs??A("XENO_API_MAX_DELAY_MS",k.maxDelayMs)),o=Math.max(0,t.jitterMs??A("XENO_API_RETRY_JITTER_MS",k.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function ye(t,e,n){if(e.retryAfterMs&&e.retryAfterMs>0)return Math.min(e.retryAfterMs,n.maxDelayMs);let r=Math.min(n.baseDelayMs*Math.pow(2,t),n.maxDelayMs),o=Math.floor(Math.random()*n.jitterMs);return Math.min(r+o,n.maxDelayMs)}function V(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function Ee(t){let e=t.toLowerCase();return e.includes("network")||e.includes("timeout")||e.includes("fetch failed")||e.includes("socket hang up")||e.includes("econnreset")||e.includes("eai_again")||e.includes("enotfound")||e.includes("econnrefused")||e.includes("tls")||e.includes("temporarily unavailable")}function N(t){if(t instanceof b)return{statusCode:t.statusCode,retryAfterMs:t.retryAfterMs,requestId:t.requestId,cfRay:t.cfRay};if(!(t instanceof Error))return{};let e=t;if(e.statusCode!==void 0||e.retryAfterMs!==void 0||e.requestId!==void 0||e.cfRay!==void 0)return{statusCode:e.statusCode,retryAfterMs:e.retryAfterMs,requestId:e.requestId,cfRay:e.cfRay};let n=t.message.toLowerCase();return V(n)?{statusCode:429}:{}}var $="408|425|429|500|502|503|504";function tt(t){let e=new RegExp(`(?:\\bstatus(?:[ _-]?code)?\\b\\s*[=:]?\\s*|\\bhttp\\b\\s*|\\bapi\\b\\s*|\\bcode\\b\\s*[=:]\\s*|\\berror\\b\\s*)(?:${$})\\b`,"i"),n=new RegExp(`\\b(?:${$})\\s+(?:internal|bad\\s+gateway|service\\s+unavailable|gateway\\s+time|request\\s+time|too\\s+early|too\\s+many)`,"i"),r=new RegExp(`^\\s*(?:${$})\\b`);return e.test(t)||n.test(t)||r.test(t)}function et(t){if(t&&typeof t=="object"&&"retryable"in t)return t.retryable===!0;if(t instanceof b){let{statusCode:e}=N(t);if(e)return e===429||e>=500||e===408||e===409||e===425}if(t instanceof Error){let e=t.name?.toLowerCase()??"";return e==="aborterror"||e==="agentinterruptederror"||t.message.toLowerCase().includes("aborted")||t.message.toLowerCase().includes("interrupted")?!1:tt(t.message)?!0:V(t.message)||Ee(t.message.toLowerCase())}return!1}function be(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function we(t,e={}){let n=xe(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw be(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):et(i))||o===n.maxRetries)throw i;let u=N(i),l=ye(o,u,n),d=e.getDelayMs?.(i,o,l),g=typeof d=="number"&&d>=0?d:l;await new Promise(S=>setTimeout(S,g))}throw r}var nt=(t,e)=>{if(!t)return 0;let n=e.toLowerCase(),r=n.includes("claude")?3.5:n.includes("gemini")?3.8:(/(^|[/_-])(gpt|o\d)/.test(n),4),o=[...t].filter(s=>s.codePointAt(0)>127).length,i=Math.ceil(t.length/r);return Math.max(1,i+Math.ceil(o*.35))},rt=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:nt,countImage:({detail:t})=>t==="high"?2e3:t==="low"?512:1200,safetyMarginRatio:t=>{let e=t.toLowerCase();return e.includes("claude")?.12:e.includes("gemini")?.14:/(^|[/_-])(gpt|o\d)/.test(e)?.1:.18}});function Re(t,e,n=rt){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function ot(t){return t?Math.ceil(t.length/4):0}function Te(t,e){if(!t||e<=0)return"";let n=e*4;if(t.length<=n)return t;let r=t.slice(0,n),o=r.lastIndexOf(" ");return o>n*.8&&(r=r.slice(0,o)),r+"..."}function ke(t,e){return ot(t)<=e}function Ae(t,e){return Math.max(0,e-t)}var Me={"claude-opus-4-6-thinking":{input:15,output:75},"claude-opus-4-6":{input:15,output:75},"claude-opus-4-5-thinking":{input:15,output:75},"claude-sonnet-4-6":{input:3,output:15},"claude-sonnet-4-5-thinking":{input:3,output:15},"claude-sonnet-4-5":{input:3,output:15},"gemini-2.5-flash":{input:.15,output:.6},"gemini-2.5-flash-lite":{input:.075,output:.3},"gemini-3-flash":{input:.15,output:.6},"gemini-3-pro-high":{input:1.25,output:5},"gpt-5":{input:5,output:15},"gpt-5-codex":{input:5,output:15},"gpt-5.1":{input:5,output:15},"gpt-5.1-codex":{input:5,output:15},"gpt-5.2":{input:5,output:15},"gpt-5.2-codex":{input:5,output:15},"kimi-k2":{input:.6,output:2.4},"kimi-k2-thinking":{input:.6,output:2.4},"kimi-k2.5":{input:.6,output:2.4}};function Se(t,e,n){let r=Me[t];return r?e/1e6*r.input+n/1e6*r.output:0}function _e(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var it=require("node:child_process");function Ce(t){let e=process.platform==="win32"?[{command:"clip.exe",args:[]}]:process.platform==="darwin"?[{command:"pbcopy",args:[]}]:[{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}],n=null;for(let r of e)try{let o=(0,it.spawnSync)(r.command,r.args,{input:t,encoding:"utf8"});if(o.error){n=o.error.message;continue}if(o.status===0)return;n=o.stderr||o.stdout||`exit ${o.status}`}catch(o){n=o instanceof Error?o.message:String(o)}throw new Error(`Clipboard copy failed${n?`: ${n}`:""}`)}function at(t){return t.replace(/\\/g,"/").toLowerCase()}var $e=["golden","solution","answer","expected"],Ne=["expected","golden","reference","answer","answers"],ve=new Set([";","&&","||","|"]);function ut(t){return at(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function Oe(t){return $e.some(e=>t.includes(e))}function st(t){return Ne.some(e=>t.includes(e))}function ct(t){return t.split("::",1)[0]?.split("?",1)[0]?.split("#",1)[0]??t}function M(t){let e=t.trim().replace(/^[({]+/,"").replace(/[),;]+$/,"");return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1)),e}function Le(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(M).filter(e=>e.length>0)??[]}function lt(t){let e=ut(t),n=ct(e.at(-1)??"");return st(n)||e.some(r=>st(r))}function ft(t){let e=at(M(t));return!e||e==="/dev/null"||e.startsWith("/tmp/")||e.startsWith("tmp/")||e.startsWith("/var/tmp/")||e.startsWith("var/tmp/")?!1:e.startsWith("/app/")||e.startsWith("./")?!0:!e.startsWith("/")}function Be(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function Pe(t){let e=Le(t);for(let n=0;n<e.length;n+=1){let r=e[n]?.toLowerCase();if(r!=="cp"&&r!=="mv"&&r!=="rsync"&&r!=="install")continue;let o=[];for(let s=n+1;s<e.length;s+=1){let u=e[s];if(!u||ve.has(u))break;u!=="--"&&(u.startsWith("-")||o.push(u))}if(o.length<2)continue;let i=o.at(-1);if(ft(i)){for(let s of o.slice(0,-1))if(Be(s)&&lt(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function Ie(t){let e=[/\bcat\s+(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*>\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i,/\bdd\b[\s\S]*?\bif=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))[\s\S]*?\bof=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i];for(let n of e){let r=t.match(n);if(!r)continue;let o=M(r[1]??r[2]??r[3]??""),i=M(r[4]??r[5]??r[6]??"");if(!(!o||!i)&&lt(o)&&ft(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function v(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function O(t){let e=ut(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=ct(e.at(-1)??"");return e.includes("tests")&&Oe(n)}function De(t){return v()?t.filter(e=>!O(e)):t}function Fe(t){return`Benchmark safety: access to verifier answer or benchmark trace artifacts is blocked (${t}). Use task inputs and verifier logic, not golden, solution, or agent audit files.`}function We(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>O(e))}function je(t){if(!v())return null;let e=Pe(t)??Ie(t);return e?["[xeno guidance]",`Benchmark safety blocked ${e.operation} from reference-like source ${e.sourcePath} to protected destination ${e.destinationPath}.`,"Do not copy expected, golden, reference, or answer files over task inputs or submission artifacts to make validation pass.","If a previous check polluted an input, restore/regenerate the original source input, then rerun the actual script or program under test."].join(`
19
- `):null}function qe(t){return/^data:([^;,]+)[;,]/i.exec(t.trim())?.[1]}function dt(t){let e=[];for(let n of t){if(n.type==="text"){e.push(n.text);continue}if(n.type==="image_url"){e.push(`[image ${qe(n.image_url.url)??"unknown"}]`);continue}let r=n.text??n.data;if(r&&r.trim().length>0){e.push(r);continue}let o=n.uri??n.mimeType??"resource";e.push(`[resource ${o}]`)}return e.join(`
19
+ `))}function k(t){if(t==null)return"";if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}var b=class extends Error{statusCode;body;retryAfterMs;requestId;cfRay;constructor(e,n={}){super(e),this.name="ApiTransientError",this.statusCode=n.statusCode,this.retryAfterMs=n.retryAfterMs,this.requestId=n.requestId,this.cfRay=n.cfRay}},A={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function M(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function ye(t={}){let e=Math.max(0,t.maxRetries??M("XENO_API_MAX_RETRIES",A.maxRetries)),n=Math.max(50,t.baseDelayMs??M("XENO_API_BASE_DELAY_MS",A.baseDelayMs)),r=Math.max(n,t.maxDelayMs??M("XENO_API_MAX_DELAY_MS",A.maxDelayMs)),o=Math.max(0,t.jitterMs??M("XENO_API_RETRY_JITTER_MS",A.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function we(t,e,n){if(e.retryAfterMs&&e.retryAfterMs>0)return Math.min(e.retryAfterMs,n.maxDelayMs);let r=Math.min(n.baseDelayMs*Math.pow(2,t),n.maxDelayMs),o=Math.floor(Math.random()*n.jitterMs);return Math.min(r+o,n.maxDelayMs)}function V(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function be(t){let e=t.toLowerCase();return e.includes("network")||e.includes("timeout")||e.includes("fetch failed")||e.includes("socket hang up")||e.includes("econnreset")||e.includes("eai_again")||e.includes("enotfound")||e.includes("econnrefused")||e.includes("tls")||e.includes("temporarily unavailable")}function N(t){if(t instanceof b)return{statusCode:t.statusCode,retryAfterMs:t.retryAfterMs,requestId:t.requestId,cfRay:t.cfRay};if(!(t instanceof Error))return{};let e=t;if(e.statusCode!==void 0||e.retryAfterMs!==void 0||e.requestId!==void 0||e.cfRay!==void 0)return{statusCode:e.statusCode,retryAfterMs:e.retryAfterMs,requestId:e.requestId,cfRay:e.cfRay};let n=t.message.toLowerCase();return V(n)?{statusCode:429}:{}}var $="408|425|429|500|502|503|504";function tt(t){let e=new RegExp(`(?:\\bstatus(?:[ _-]?code)?\\b\\s*[=:]?\\s*|\\bhttp\\b\\s*|\\bapi\\b\\s*|\\bcode\\b\\s*[=:]\\s*|\\berror\\b\\s*)(?:${$})\\b`,"i"),n=new RegExp(`\\b(?:${$})\\s+(?:internal|bad\\s+gateway|service\\s+unavailable|gateway\\s+time|request\\s+time|too\\s+early|too\\s+many)`,"i"),r=new RegExp(`^\\s*(?:${$})\\b`);return e.test(t)||n.test(t)||r.test(t)}function et(t){if(t&&typeof t=="object"&&"retryable"in t)return t.retryable===!0;if(t instanceof b){let{statusCode:e}=N(t);if(e)return e===429||e>=500||e===408||e===409||e===425}if(t instanceof Error){let e=t.name?.toLowerCase()??"";return e==="aborterror"||e==="agentinterruptederror"||t.message.toLowerCase().includes("aborted")||t.message.toLowerCase().includes("interrupted")?!1:tt(t.message)?!0:V(t.message)||be(t.message.toLowerCase())}return!1}function Ee(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function Re(t,e={}){let n=ye(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw Ee(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):et(i))||o===n.maxRetries)throw i;let u=N(i),l=we(o,u,n),d=e.getDelayMs?.(i,o,l),g=typeof d=="number"&&d>=0?d:l;await new Promise(_=>setTimeout(_,g))}throw r}var nt=(t,e)=>{if(!t)return 0;let n=e.toLowerCase(),r=n.includes("claude")?3.5:n.includes("gemini")?3.8:(/(^|[/_-])(gpt|o\d)/.test(n),4),o=[...t].filter(s=>s.codePointAt(0)>127).length,i=Math.ceil(t.length/r);return Math.max(1,i+Math.ceil(o*.35))},rt=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:nt,countImage:({detail:t})=>t==="high"?2e3:t==="low"?512:1200,safetyMarginRatio:t=>{let e=t.toLowerCase();return e.includes("claude")?.12:e.includes("gemini")?.14:/(^|[/_-])(gpt|o\d)/.test(e)?.1:.18}});function Te(t,e,n=rt){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function ot(t){return t?Math.ceil(t.length/4):0}function ke(t,e){if(!t||e<=0)return"";let n=e*4;if(t.length<=n)return t;let r=t.slice(0,n),o=r.lastIndexOf(" ");return o>n*.8&&(r=r.slice(0,o)),r+"..."}function Ae(t,e){return ot(t)<=e}function Me(t,e){return Math.max(0,e-t)}var Se={"claude-opus-4-6-thinking":{input:15,output:75},"claude-opus-4-6":{input:15,output:75},"claude-opus-4-5-thinking":{input:15,output:75},"claude-sonnet-4-6":{input:3,output:15},"claude-sonnet-4-5-thinking":{input:3,output:15},"claude-sonnet-4-5":{input:3,output:15},"gemini-2.5-flash":{input:.15,output:.6},"gemini-2.5-flash-lite":{input:.075,output:.3},"gemini-3-flash":{input:.15,output:.6},"gemini-3-pro-high":{input:1.25,output:5},"gpt-5":{input:5,output:15},"gpt-5-codex":{input:5,output:15},"gpt-5.1":{input:5,output:15},"gpt-5.1-codex":{input:5,output:15},"gpt-5.2":{input:5,output:15},"gpt-5.2-codex":{input:5,output:15},"kimi-k2":{input:.6,output:2.4},"kimi-k2-thinking":{input:.6,output:2.4},"kimi-k2.5":{input:.6,output:2.4}};function _e(t,e,n){let r=Se[t];return r?e/1e6*r.input+n/1e6*r.output:0}function Ce(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var it=require("node:child_process");function $e(t){let e=process.platform==="win32"?[{command:"clip.exe",args:[]}]:process.platform==="darwin"?[{command:"pbcopy",args:[]}]:[{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}],n=null;for(let r of e)try{let o=(0,it.spawnSync)(r.command,r.args,{input:t,encoding:"utf8"});if(o.error){n=o.error.message;continue}if(o.status===0)return;n=o.stderr||o.stdout||`exit ${o.status}`}catch(o){n=o instanceof Error?o.message:String(o)}throw new Error(`Clipboard copy failed${n?`: ${n}`:""}`)}function at(t){return t.replace(/\\/g,"/").toLowerCase()}var Ne=["golden","solution","answer","expected"],ve=["expected","golden","reference","answer","answers"],Oe=new Set([";","&&","||","|"]);function ut(t){return at(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function Le(t){return Ne.some(e=>t.includes(e))}function st(t){return ve.some(e=>t.includes(e))}function ct(t){return t.split("::",1)[0]?.split("?",1)[0]?.split("#",1)[0]??t}function S(t){let e=t.trim().replace(/^[({]+/,"").replace(/[),;]+$/,"");return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1)),e}function Be(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(S).filter(e=>e.length>0)??[]}function lt(t){let e=ut(t),n=ct(e.at(-1)??"");return st(n)||e.some(r=>st(r))}function ft(t){let e=at(S(t));return!e||e==="/dev/null"||e.startsWith("/tmp/")||e.startsWith("tmp/")||e.startsWith("/var/tmp/")||e.startsWith("var/tmp/")?!1:e.startsWith("/app/")||e.startsWith("./")?!0:!e.startsWith("/")}function Pe(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function De(t){let e=Be(t);for(let n=0;n<e.length;n+=1){let r=e[n]?.toLowerCase();if(r!=="cp"&&r!=="mv"&&r!=="rsync"&&r!=="install")continue;let o=[];for(let s=n+1;s<e.length;s+=1){let u=e[s];if(!u||Oe.has(u))break;u!=="--"&&(u.startsWith("-")||o.push(u))}if(o.length<2)continue;let i=o.at(-1);if(ft(i)){for(let s of o.slice(0,-1))if(Pe(s)&&lt(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function Ie(t){let e=[/\bcat\s+(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))\s*>\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i,/\bdd\b[\s\S]*?\bif=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))[\s\S]*?\bof=(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/i];for(let n of e){let r=t.match(n);if(!r)continue;let o=S(r[1]??r[2]??r[3]??""),i=S(r[4]??r[5]??r[6]??"");if(!(!o||!i)&&lt(o)&&ft(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function v(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function O(t){let e=ut(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=ct(e.at(-1)??"");return e.includes("tests")&&Le(n)}function Fe(t){return v()?t.filter(e=>!O(e)):t}function We(t){return`Benchmark safety: access to verifier answer or benchmark trace artifacts is blocked (${t}). Use task inputs and verifier logic, not golden, solution, or agent audit files.`}function je(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>O(e))}function qe(t){if(!v())return null;let e=De(t)??Ie(t);return e?["[xeno guidance]",`Benchmark safety blocked ${e.operation} from reference-like source ${e.sourcePath} to protected destination ${e.destinationPath}.`,"Do not copy expected, golden, reference, or answer files over task inputs or submission artifacts to make validation pass.","If a previous check polluted an input, restore/regenerate the original source input, then rerun the actual script or program under test."].join(`
20
+ `):null}function He(t){return/^data:([^;,]+)[;,]/i.exec(t.trim())?.[1]}function dt(t){let e=[];for(let n of t){if(n.type==="text"){e.push(n.text);continue}if(n.type==="image_url"){e.push(`[image ${He(n.image_url.url)??"unknown"}]`);continue}let r=n.text??n.data;if(r&&r.trim().length>0){e.push(r);continue}let o=n.uri??n.mimeType??"resource";e.push(`[resource ${o}]`)}return e.join(`
20
21
 
21
- `).trim()}function pt(t){let e=t.trim();return e.length>0?[{type:"text",text:e}]:[]}function He(t){return typeof t=="string"?t:dt(t)}function mt(t){if(t.success)return t.output;let e=[`Error: ${t.error??"Tool execution failed"}`];return t.output.trim().length>0&&e.push(t.output),e.join(`
22
- `)}function Je(t){let e=t.assistant_content&&t.assistant_content.length>0?t.assistant_content:typeof t.content=="string"?pt(t.content):t.content,n=t.assistant_only_content??[],r=Xe(t),o=[...e,...n,...r?[r]:[]];return o.length>0?o:t.content}function Xe(t){let e=t.operation;if(!e)return null;let n=t.evidence??e.evidence??[],r=n.filter(i=>i.status==="verified").length,o=n.filter(i=>i.status==="failed").length;return{type:"text",text:["[xeno_operation]",`operation_id: ${e.operationId}`,`state: ${e.state}`,`terminal: ${e.terminal?"yes":"no"}`,`completion_policy: ${e.completionPolicy}`,e.taskId?`task_id: ${e.taskId}`:null,e.completionReason?`completion_reason: ${e.completionReason}`:null,`evidence: ${r} verified, ${o} failed`,t.retryable===void 0?null:`retryable: ${t.retryable?"yes":"no"}`,"[/xeno_operation]"].filter(i=>!!i).join(`
23
- `)}}function Ye(t){return Array.isArray(t)&&t.some(e=>e.type!=="text")}function ze(t){return typeof t=="string"?pt(t):t}function Ge(t,e){return{type:"tool_result",tool_use_id:t,content:mt(e),...e.assistantContent&&e.assistantContent.length>0?{assistant_content:e.assistantContent}:{},...e.assistantOnlyContent&&e.assistantOnlyContent.length>0?{assistant_only_content:e.assistantOnlyContent}:{},is_error:!e.success,...e.operation?{operation:e.operation}:{},...e.evidence&&e.evidence.length>0?{evidence:e.evidence}:{},...e.retryable!==void 0?{retryable:e.retryable}:{}}}function Ue(t,e={}){for(let n of t){let r=n.codePointAt(0);if(r===127)return!0;if(!(r>31)&&!(r===9&&e.allowTab===!0)&&!((r===10||r===13)&&e.allowLineBreaks===!0))return!0}return!1}0&&(module.exports={ApiTransientError,HOME_DIR,IS_LINUX,IS_MAC,IS_WINDOWS,LogLevel,OS_VERSION,PLATFORM,accountTextTokens,appendLine,benchmarkLeakError,buildToolResultBlock,buildToolResultText,calculateCost,commandMentionsBenchmarkLeak,conservativeTokenAccountingAdapter,copyTextToClipboard,createSafeRegex,debug,decodeTextBuffer,deleteDir,deleteFile,detectLineEnding,detectPreferredLineEnding,detectTextEncoding,encodeTextBuffer,ensureDir,error,estimateTokens,estimateTokensForModel,existsSync,filterBenchmarkLeakPaths,findSimilarFile,fitsInBudget,formatCost,getAgentHome,getBenchmarkReferenceOverwriteHint,getBoolean,getConfigDir,getLogLevel,getNumber,getProjectConfigDir,getRetryErrorContext,getShellName,getString,getToolResultTransportContent,hasDir,hasDisallowedAsciiControlCharacter,hasFile,hasFrontmatter,hasNonTextToolResultContent,hasTransientStatusMention,info,isBenchmarkLeakPath,isBenchmarkMode,isGitRepo,isPathSafe,isRetryableError,listDirs,listFiles,normalizeLineEndings,parseDocument,parseJsonLines,readFileSafe,readIfExists,readTextFile,remainingBudget,safeJsonParse,safeJsonStringify,safeRegexTest,safeResolvePath,setLogLevel,stringifyDocument,toTransportAssistantBlocks,toolAssistantContentToText,toolResultContentToText,truncateToTokens,validateRegexPattern,validateRequired,warn,withRetry,writeAtomic,writeTextFile});
22
+ `).trim()}function pt(t){let e=t.trim();return e.length>0?[{type:"text",text:e}]:[]}function Je(t){return typeof t=="string"?t:dt(t)}function mt(t){if(t.success)return t.output;let e=[`Error: ${t.error??"Tool execution failed"}`];return t.output.trim().length>0&&e.push(t.output),e.join(`
23
+ `)}function Xe(t){let e=t.assistant_content&&t.assistant_content.length>0?t.assistant_content:typeof t.content=="string"?pt(t.content):t.content,n=t.assistant_only_content??[],r=Ye(t),o=[...e,...n,...r?[r]:[]];return o.length>0?o:t.content}function Ye(t){let e=t.operation;if(!e)return null;let n=t.evidence??e.evidence??[],r=n.filter(i=>i.status==="verified").length,o=n.filter(i=>i.status==="failed").length;return{type:"text",text:["[xeno_operation]",`operation_id: ${e.operationId}`,`state: ${e.state}`,`terminal: ${e.terminal?"yes":"no"}`,`completion_policy: ${e.completionPolicy}`,e.taskId?`task_id: ${e.taskId}`:null,e.completionReason?`completion_reason: ${e.completionReason}`:null,`evidence: ${r} verified, ${o} failed`,t.retryable===void 0?null:`retryable: ${t.retryable?"yes":"no"}`,"[/xeno_operation]"].filter(i=>!!i).join(`
24
+ `)}}function ze(t){return Array.isArray(t)&&t.some(e=>e.type!=="text")}function Ge(t){return typeof t=="string"?pt(t):t}function Ue(t,e){return{type:"tool_result",tool_use_id:t,content:mt(e),...e.assistantContent&&e.assistantContent.length>0?{assistant_content:e.assistantContent}:{},...e.assistantOnlyContent&&e.assistantOnlyContent.length>0?{assistant_only_content:e.assistantOnlyContent}:{},is_error:!e.success,...e.operation?{operation:e.operation}:{},...e.evidence&&e.evidence.length>0?{evidence:e.evidence}:{},...e.webContext?{web_context:e.webContext}:{},...e.retryable!==void 0?{retryable:e.retryable}:{}}}function Ke(t,e={}){for(let n of t){let r=n.codePointAt(0);if(r===127)return!0;if(!(r>31)&&!(r===9&&e.allowTab===!0)&&!((r===10||r===13)&&e.allowLineBreaks===!0))return!0}return!1}0&&(module.exports={ApiTransientError,HOME_DIR,IS_LINUX,IS_MAC,IS_WINDOWS,LogLevel,OS_VERSION,PLATFORM,accountTextTokens,appendDurableLine,appendLine,benchmarkLeakError,buildToolResultBlock,buildToolResultText,calculateCost,commandMentionsBenchmarkLeak,conservativeTokenAccountingAdapter,copyTextToClipboard,createSafeRegex,debug,decodeTextBuffer,deleteDir,deleteFile,detectLineEnding,detectPreferredLineEnding,detectTextEncoding,encodeTextBuffer,ensureDir,error,estimateTokens,estimateTokensForModel,existsSync,filterBenchmarkLeakPaths,findSimilarFile,fitsInBudget,formatCost,getAgentHome,getBenchmarkReferenceOverwriteHint,getBoolean,getConfigDir,getLogLevel,getNumber,getProjectConfigDir,getRetryErrorContext,getShellName,getString,getToolResultTransportContent,hasDir,hasDisallowedAsciiControlCharacter,hasFile,hasFrontmatter,hasNonTextToolResultContent,hasTransientStatusMention,info,isBenchmarkLeakPath,isBenchmarkMode,isGitRepo,isPathSafe,isRetryableError,listDirs,listFiles,normalizeLineEndings,parseDocument,parseJsonLines,readFileSafe,readIfExists,readTextFile,remainingBudget,safeJsonParse,safeJsonStringify,safeRegexTest,safeResolvePath,setLogLevel,stringifyDocument,toTransportAssistantBlocks,toolAssistantContentToText,toolResultContentToText,truncateToTokens,validateRegexPattern,validateRequired,warn,withRetry,writeAtomic,writeTextFile});
@@ -12,6 +12,7 @@ declare function readFileSafe(filePath: string, fallback?: string): string;
12
12
  declare function ensureDir(dirPath: string): Promise<void>;
13
13
  declare function writeAtomic(filePath: string, content: string | Buffer): Promise<void>;
14
14
  declare function appendLine(filePath: string, line: string): Promise<void>;
15
+ declare function appendDurableLine(filePath: string, line: string): Promise<void>;
15
16
  declare function detectTextEncoding(buffer: Buffer): TextEncoding;
16
17
  declare function decodeTextBuffer(buffer: Buffer, encoding: TextEncoding): string;
17
18
  declare function encodeTextBuffer(content: string, encoding: TextEncoding): Buffer;
@@ -135,6 +136,33 @@ declare function filterBenchmarkLeakPaths(paths: string[]): string[];
135
136
  declare function benchmarkLeakError(target: string): string;
136
137
  declare function commandMentionsBenchmarkLeak(command: string): boolean;
137
138
  declare function getBenchmarkReferenceOverwriteHint(command: string): string | null;
139
+ declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1";
140
+ interface WebContextEvidenceProjection {
141
+ evidenceId: string;
142
+ requestId: string;
143
+ sourceUrl: string;
144
+ finalUrl?: string;
145
+ citations: Array<{
146
+ url: string;
147
+ title?: string;
148
+ artifactId?: string;
149
+ }>;
150
+ }
151
+ interface WebContextToolResult {
152
+ schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA;
153
+ operation: "search" | "fetch";
154
+ requestId: string;
155
+ evidence: WebContextEvidenceProjection;
156
+ job?: {
157
+ jobId: string;
158
+ state: string;
159
+ };
160
+ artifact?: {
161
+ artifactId: string;
162
+ mediaType: string;
163
+ bytes: number;
164
+ };
165
+ }
138
166
  interface ImageUrlBlock {
139
167
  type: "image_url";
140
168
  image_url: {
@@ -209,6 +237,7 @@ interface ToolResult {
209
237
  assistantOnlyContent?: ToolAssistantContentBlock[];
210
238
  operation?: ToolOperationSnapshot;
211
239
  evidence?: ToolEvidence[];
240
+ webContext?: WebContextToolResult;
212
241
  retryable?: boolean;
213
242
  }
214
243
  interface TextBlock {
@@ -224,6 +253,7 @@ interface ToolResultBlock {
224
253
  is_error?: boolean;
225
254
  operation?: ToolOperationSnapshot;
226
255
  evidence?: ToolEvidence[];
256
+ web_context?: WebContextToolResult;
227
257
  retryable?: boolean;
228
258
  }
229
259
  declare function toolAssistantContentToText(blocks: ToolAssistantContentBlock[]): string;
@@ -245,4 +275,4 @@ interface XenoAsciiControlCharacterPolicy {
245
275
  allowLineBreaks?: boolean;
246
276
  }
247
277
  declare function hasDisallowedAsciiControlCharacter(value: string, policy?: XenoAsciiControlCharacterPolicy): boolean;
248
- export { ApiTransientError, HOME_DIR, IS_LINUX, IS_MAC, IS_WINDOWS, type LineEnding, LogLevel, OS_VERSION, PLATFORM, type ParsedDocument, type RetryErrorContext, type RetryOptions, type TextEncoding, type TextFileContents, type TokenAccountingAdapter, type TokenAccountingResult, type TokenAccountingSource, type TokenEstimator, type XenoAsciiControlCharacterPolicy, accountTextTokens, appendLine, benchmarkLeakError, buildToolResultBlock, buildToolResultText, calculateCost, commandMentionsBenchmarkLeak, conservativeTokenAccountingAdapter, copyTextToClipboard, createSafeRegex, debug, decodeTextBuffer, deleteDir, deleteFile, detectLineEnding, detectPreferredLineEnding, detectTextEncoding, encodeTextBuffer, ensureDir, error, estimateTokens, estimateTokensForModel, existsSync, filterBenchmarkLeakPaths, findSimilarFile, fitsInBudget, formatCost, getAgentHome, getBenchmarkReferenceOverwriteHint, getBoolean, getConfigDir, getLogLevel, getNumber, getProjectConfigDir, getRetryErrorContext, getShellName, getString, getToolResultTransportContent, hasDir, hasDisallowedAsciiControlCharacter, hasFile, hasFrontmatter, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, parseDocument, parseJsonLines, readFileSafe, readIfExists, readTextFile, remainingBudget, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile };
278
+ export { ApiTransientError, HOME_DIR, IS_LINUX, IS_MAC, IS_WINDOWS, type LineEnding, LogLevel, OS_VERSION, PLATFORM, type ParsedDocument, type RetryErrorContext, type RetryOptions, type TextEncoding, type TextFileContents, type TokenAccountingAdapter, type TokenAccountingResult, type TokenAccountingSource, type TokenEstimator, type XenoAsciiControlCharacterPolicy, accountTextTokens, appendDurableLine, appendLine, benchmarkLeakError, buildToolResultBlock, buildToolResultText, calculateCost, commandMentionsBenchmarkLeak, conservativeTokenAccountingAdapter, copyTextToClipboard, createSafeRegex, debug, decodeTextBuffer, deleteDir, deleteFile, detectLineEnding, detectPreferredLineEnding, detectTextEncoding, encodeTextBuffer, ensureDir, error, estimateTokens, estimateTokensForModel, existsSync, filterBenchmarkLeakPaths, findSimilarFile, fitsInBudget, formatCost, getAgentHome, getBenchmarkReferenceOverwriteHint, getBoolean, getConfigDir, getLogLevel, getNumber, getProjectConfigDir, getRetryErrorContext, getShellName, getString, getToolResultTransportContent, hasDir, hasDisallowedAsciiControlCharacter, hasFile, hasFrontmatter, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, parseDocument, parseJsonLines, readFileSafe, readIfExists, readTextFile, remainingBudget, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile };