@xenosystem/agent-sdk 0.10.34 → 0.10.36
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.
- package/README.md +34 -1
- package/dist/artifacts/index.cjs +1 -1
- package/dist/artifacts/index.js +1 -1
- package/dist/automation/index.cjs +1 -1
- package/dist/automation/index.js +1 -1
- package/dist/control-plane/index.cjs +1 -1
- package/dist/control-plane/index.js +1 -1
- package/dist/coordination/index.cjs +2 -2
- package/dist/coordination/index.js +2 -2
- package/dist/coordination/metafile-cjs.json +1 -1
- package/dist/coordination/metafile-esm.json +1 -1
- package/dist/electron/index.cjs +215 -201
- package/dist/electron/index.d.cts +67 -1
- package/dist/electron/index.d.ts +67 -1
- package/dist/electron/index.js +215 -201
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/index.cjs +384 -379
- package/dist/index.d.cts +118 -36
- package/dist/index.d.ts +118 -36
- package/dist/index.js +384 -379
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/index.cjs +10 -10
- package/dist/providers/index.d.cts +49 -33
- package/dist/providers/index.d.ts +49 -33
- package/dist/providers/index.js +10 -10
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/session/index.cjs +1 -1
- package/dist/session/index.js +1 -1
- package/dist/utils/index.cjs +15 -15
- package/dist/utils/index.d.cts +15 -2
- package/dist/utils/index.d.ts +15 -2
- package/dist/utils/index.js +14 -14
- package/dist/utils/metafile-cjs.json +1 -1
- package/dist/utils/metafile-esm.json +1 -1
- package/dist/workforce/index.cjs +1 -1
- package/dist/workforce/index.d.cts +7 -2
- package/dist/workforce/index.d.ts +7 -2
- package/dist/workforce/index.js +1 -1
- package/dist/workforce/metafile-cjs.json +1 -1
- package/dist/workforce/metafile-esm.json +1 -1
- package/ownership/ownership-policy.json +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/config/models.ts":{"bytes":17947,"imports":[{"path":"src/utils/request-context.ts","kind":"import-statement","original":"../utils/request-context.js"}],"format":"esm"},"src/core/llm-provider.ts":{"bytes":13791,"imports":[],"format":"esm"},"src/providers/DualLLMProvider.ts":{"bytes":19125,"imports":[{"path":"src/config/models.ts","kind":"import-statement","original":"../config/models.js"},{"path":"src/core/llm-provider.ts","kind":"import-statement","original":"../core/llm-provider.js"}],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/observability/telemetry.ts":{"bytes":7271,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true}],"format":"esm"},"src/observability/index.ts":{"bytes":32,"imports":[{"path":"src/observability/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"src/utils/context-overflow-phrases.ts":{"bytes":2266,"imports":[],"format":"esm"},"src/providers/provider-errors.ts":{"bytes":8749,"imports":[{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/utils/context-overflow-phrases.ts","kind":"import-statement","original":"../utils/context-overflow-phrases.js"}],"format":"esm"},"src/providers/endpoint-policy.ts":{"bytes":6439,"imports":[{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/pinned-provider-dispatcher.ts":{"bytes":3986,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"}],"format":"esm"},"src/providers/bounded-provider-transport.ts":{"bytes":13579,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/pinned-provider-dispatcher.ts","kind":"import-statement","original":"./pinned-provider-dispatcher.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/utils/json-schema.ts":{"bytes":43478,"imports":[{"path":"node:net","kind":"import-statement","external":true}],"format":"esm"},"src/providers/tool-schema-projection.ts":{"bytes":12249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/json-schema.ts","kind":"import-statement","original":"../utils/json-schema.js"}],"format":"esm"},"src/providers/tool-name-codec.ts":{"bytes":3174,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/acknowledgement.ts":{"bytes":1197,"imports":[],"format":"esm"},"src/providers/quota.ts":{"bytes":9783,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/acknowledgement.ts","kind":"import-statement","original":"../utils/acknowledgement.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/direct-provider.ts":{"bytes":56992,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"../utils/tool-result-content.js"},{"path":"src/providers/bounded-provider-transport.ts","kind":"import-statement","original":"./bounded-provider-transport.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/providers/catalog.ts":{"bytes":24437,"imports":[{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"../utils/text-security.js"}],"format":"esm"},"src/utils/fs.ts":{"bytes":13355,"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/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2496,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/providers/file-connection-store.ts":{"bytes":8338,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"../control-plane/lock.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"}],"format":"esm"},"src/providers/quota-store.ts":{"bytes":15760,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/providers/index.ts":{"bytes":1735,"imports":[{"path":"src/providers/DualLLMProvider.ts","kind":"import-statement","original":"./DualLLMProvider.js"},{"path":"src/providers/direct-provider.ts","kind":"import-statement","original":"./direct-provider.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"},{"path":"src/providers/file-connection-store.ts","kind":"import-statement","original":"./file-connection-store.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"},{"path":"src/providers/quota-store.ts","kind":"import-statement","original":"./quota-store.js"}],"format":"esm"}},"outputs":{"dist/providers/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:perf_hooks","kind":"require-call","external":true},{"path":"node:dns/promises","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:http","kind":"require-call","external":true},{"path":"node:https","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:events","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/providers/index.ts","inputs":{"src/providers/index.ts":{"bytesInOutput":1037},"src/config/models.ts":{"bytesInOutput":56},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":5739},"src/providers/direct-provider.ts":{"bytesInOutput":26343},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6200},"src/observability/telemetry.ts":{"bytesInOutput":1600},"src/observability/index.ts":{"bytesInOutput":0},"src/providers/endpoint-policy.ts":{"bytesInOutput":3343},"src/utils/context-overflow-phrases.ts":{"bytesInOutput":169},"src/providers/provider-errors.ts":{"bytesInOutput":3248},"src/providers/pinned-provider-dispatcher.ts":{"bytesInOutput":1519},"src/providers/tool-schema-projection.ts":{"bytesInOutput":5711},"src/utils/json-schema.ts":{"bytesInOutput":19790},"src/providers/tool-name-codec.ts":{"bytesInOutput":556},"src/providers/quota.ts":{"bytesInOutput":3430},"src/utils/acknowledgement.ts":{"bytesInOutput":470},"src/utils/text-security.ts":{"bytesInOutput":180},"src/providers/catalog.ts":{"bytesInOutput":11932},"src/providers/file-connection-store.ts":{"bytesInOutput":3784},"src/utils/fs.ts":{"bytesInOutput":319},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1067},"src/providers/quota-store.ts":{"bytesInOutput":8105}},"bytes":108129}}}
|
|
1
|
+
{"inputs":{"src/observability/telemetry.ts":{"bytes":7271,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true}],"format":"esm"},"src/observability/index.ts":{"bytes":32,"imports":[{"path":"src/observability/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"src/utils/context-overflow-phrases.ts":{"bytes":2266,"imports":[],"format":"esm"},"src/providers/provider-error-redaction.ts":{"bytes":9369,"imports":[],"format":"esm"},"src/providers/provider-errors.ts":{"bytes":19820,"imports":[{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/utils/context-overflow-phrases.ts","kind":"import-statement","original":"../utils/context-overflow-phrases.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/providers/legacy-chat-stream.ts":{"bytes":5039,"imports":[{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/config/models.ts":{"bytes":17947,"imports":[{"path":"src/utils/request-context.ts","kind":"import-statement","original":"../utils/request-context.js"}],"format":"esm"},"src/core/llm-provider.ts":{"bytes":13791,"imports":[],"format":"esm"},"src/providers/DualLLMProvider.ts":{"bytes":21175,"imports":[{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/legacy-chat-stream.ts","kind":"import-statement","original":"./legacy-chat-stream.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"},{"path":"src/config/models.ts","kind":"import-statement","original":"../config/models.js"},{"path":"src/core/llm-provider.ts","kind":"import-statement","original":"../core/llm-provider.js"}],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/providers/endpoint-policy.ts":{"bytes":6439,"imports":[{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/pinned-provider-dispatcher.ts":{"bytes":3986,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"}],"format":"esm"},"src/providers/bounded-provider-transport.ts":{"bytes":15376,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/pinned-provider-dispatcher.ts","kind":"import-statement","original":"./pinned-provider-dispatcher.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/utils/json-schema.ts":{"bytes":43478,"imports":[{"path":"node:net","kind":"import-statement","external":true}],"format":"esm"},"src/providers/tool-schema-projection.ts":{"bytes":12249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/json-schema.ts","kind":"import-statement","original":"../utils/json-schema.js"}],"format":"esm"},"src/providers/tool-name-codec.ts":{"bytes":4437,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/acknowledgement.ts":{"bytes":1197,"imports":[],"format":"esm"},"src/providers/quota.ts":{"bytes":9783,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/acknowledgement.ts","kind":"import-statement","original":"../utils/acknowledgement.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/direct-provider.ts":{"bytes":58249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"../utils/tool-result-content.js"},{"path":"src/providers/bounded-provider-transport.ts","kind":"import-statement","original":"./bounded-provider-transport.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/providers/catalog.ts":{"bytes":24437,"imports":[{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"../utils/text-security.js"}],"format":"esm"},"src/utils/fs.ts":{"bytes":13355,"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/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2496,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/providers/file-connection-store.ts":{"bytes":8338,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"../control-plane/lock.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"}],"format":"esm"},"src/providers/quota-store.ts":{"bytes":15760,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/providers/index.ts":{"bytes":1766,"imports":[{"path":"src/providers/DualLLMProvider.ts","kind":"import-statement","original":"./DualLLMProvider.js"},{"path":"src/providers/direct-provider.ts","kind":"import-statement","original":"./direct-provider.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"},{"path":"src/providers/file-connection-store.ts","kind":"import-statement","original":"./file-connection-store.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"},{"path":"src/providers/quota-store.ts","kind":"import-statement","original":"./quota-store.js"}],"format":"esm"}},"outputs":{"dist/providers/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:perf_hooks","kind":"require-call","external":true},{"path":"node:dns/promises","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:http","kind":"require-call","external":true},{"path":"node:https","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:events","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:net","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:os","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/providers/index.ts","inputs":{"src/providers/index.ts":{"bytesInOutput":1072},"src/observability/telemetry.ts":{"bytesInOutput":1600},"src/observability/index.ts":{"bytesInOutput":0},"src/utils/context-overflow-phrases.ts":{"bytesInOutput":169},"src/providers/provider-error-redaction.ts":{"bytesInOutput":3342},"src/providers/provider-errors.ts":{"bytesInOutput":7208},"src/providers/legacy-chat-stream.ts":{"bytesInOutput":1431},"src/config/models.ts":{"bytesInOutput":56},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":6184},"src/providers/direct-provider.ts":{"bytesInOutput":26717},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6799},"src/providers/endpoint-policy.ts":{"bytesInOutput":3344},"src/providers/pinned-provider-dispatcher.ts":{"bytesInOutput":1519},"src/providers/tool-schema-projection.ts":{"bytesInOutput":5719},"src/utils/json-schema.ts":{"bytesInOutput":19807},"src/providers/tool-name-codec.ts":{"bytesInOutput":1044},"src/providers/quota.ts":{"bytesInOutput":3430},"src/utils/acknowledgement.ts":{"bytesInOutput":470},"src/utils/text-security.ts":{"bytesInOutput":180},"src/providers/catalog.ts":{"bytesInOutput":11934},"src/providers/file-connection-store.ts":{"bytesInOutput":3784},"src/utils/fs.ts":{"bytesInOutput":319},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1067},"src/providers/quota-store.ts":{"bytesInOutput":8105}},"bytes":118859}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/config/models.ts":{"bytes":17947,"imports":[{"path":"src/utils/request-context.ts","kind":"import-statement","original":"../utils/request-context.js"}],"format":"esm"},"src/core/llm-provider.ts":{"bytes":13791,"imports":[],"format":"esm"},"src/providers/DualLLMProvider.ts":{"bytes":19125,"imports":[{"path":"src/config/models.ts","kind":"import-statement","original":"../config/models.js"},{"path":"src/core/llm-provider.ts","kind":"import-statement","original":"../core/llm-provider.js"}],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/observability/telemetry.ts":{"bytes":7271,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true}],"format":"esm"},"src/observability/index.ts":{"bytes":32,"imports":[{"path":"src/observability/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"src/utils/context-overflow-phrases.ts":{"bytes":2266,"imports":[],"format":"esm"},"src/providers/provider-errors.ts":{"bytes":8749,"imports":[{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/utils/context-overflow-phrases.ts","kind":"import-statement","original":"../utils/context-overflow-phrases.js"}],"format":"esm"},"src/providers/endpoint-policy.ts":{"bytes":6439,"imports":[{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/pinned-provider-dispatcher.ts":{"bytes":3986,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"}],"format":"esm"},"src/providers/bounded-provider-transport.ts":{"bytes":13579,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/pinned-provider-dispatcher.ts","kind":"import-statement","original":"./pinned-provider-dispatcher.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/utils/json-schema.ts":{"bytes":43478,"imports":[{"path":"node:net","kind":"import-statement","external":true}],"format":"esm"},"src/providers/tool-schema-projection.ts":{"bytes":12249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/json-schema.ts","kind":"import-statement","original":"../utils/json-schema.js"}],"format":"esm"},"src/providers/tool-name-codec.ts":{"bytes":3174,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/acknowledgement.ts":{"bytes":1197,"imports":[],"format":"esm"},"src/providers/quota.ts":{"bytes":9783,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/acknowledgement.ts","kind":"import-statement","original":"../utils/acknowledgement.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/direct-provider.ts":{"bytes":56992,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"../utils/tool-result-content.js"},{"path":"src/providers/bounded-provider-transport.ts","kind":"import-statement","original":"./bounded-provider-transport.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/providers/catalog.ts":{"bytes":24437,"imports":[{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"../utils/text-security.js"}],"format":"esm"},"src/utils/fs.ts":{"bytes":13355,"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/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2496,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/providers/file-connection-store.ts":{"bytes":8338,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"../control-plane/lock.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"}],"format":"esm"},"src/providers/quota-store.ts":{"bytes":15760,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/providers/index.ts":{"bytes":1735,"imports":[{"path":"src/providers/DualLLMProvider.ts","kind":"import-statement","original":"./DualLLMProvider.js"},{"path":"src/providers/direct-provider.ts","kind":"import-statement","original":"./direct-provider.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"},{"path":"src/providers/file-connection-store.ts","kind":"import-statement","original":"./file-connection-store.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"},{"path":"src/providers/quota-store.ts","kind":"import-statement","original":"./quota-store.js"}],"format":"esm"}},"outputs":{"dist/providers/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["BUILT_IN_XENO_PROVIDER_PRESETS","DualLLMProvider","FileQuotaAuthority","FileXenoProviderConnectionStore","PROVIDER_TOOL_NAME_PATTERN","ProviderError","QuotaAcknowledgementError","QuotaError","ToolSchemaProjectionError","XENO_PROVIDER_CATALOG_SCHEMA_VERSION","XENO_PROVIDER_CONNECTION_STORE_SCHEMA_VERSION","XenoProviderCatalog","assertDirectEndpointResolution","classifyProviderHttpError","createDirectProvider","createOllamaNativeProvider","createQuotaGovernedProvider","createToolNameCodec","directProviderConfigFromConnection","isQuotaControlError","normalizeQuotaScope","parseRetryAfter","probeXenoProvider","projectToolDefinitionsForProvider","projectToolSchemaForProvider","providerCapabilityError","providerProtocolError","quotaAncestors","quotaInteger","quotaScopeKey","quotaText","selectXenoProviderRoute","validateDirectEndpoint"],"entryPoint":"src/providers/index.ts","inputs":{"src/config/models.ts":{"bytesInOutput":56},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":5739},"src/providers/index.ts":{"bytesInOutput":0},"src/providers/direct-provider.ts":{"bytesInOutput":26310},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6174},"src/observability/telemetry.ts":{"bytesInOutput":1599},"src/observability/index.ts":{"bytesInOutput":0},"src/providers/endpoint-policy.ts":{"bytesInOutput":3316},"src/utils/context-overflow-phrases.ts":{"bytesInOutput":169},"src/providers/provider-errors.ts":{"bytesInOutput":3247},"src/providers/pinned-provider-dispatcher.ts":{"bytesInOutput":1519},"src/providers/tool-schema-projection.ts":{"bytesInOutput":5709},"src/utils/json-schema.ts":{"bytesInOutput":19782},"src/providers/tool-name-codec.ts":{"bytesInOutput":558},"src/providers/quota.ts":{"bytesInOutput":3412},"src/utils/acknowledgement.ts":{"bytesInOutput":470},"src/utils/text-security.ts":{"bytesInOutput":180},"src/providers/catalog.ts":{"bytesInOutput":11924},"src/providers/file-connection-store.ts":{"bytesInOutput":3774},"src/utils/fs.ts":{"bytesInOutput":314},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1054},"src/providers/quota-store.ts":{"bytesInOutput":8082}},"bytes":106502}}}
|
|
1
|
+
{"inputs":{"src/observability/telemetry.ts":{"bytes":7271,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true}],"format":"esm"},"src/observability/index.ts":{"bytes":32,"imports":[{"path":"src/observability/telemetry.ts","kind":"import-statement","original":"./telemetry.js"}],"format":"esm"},"src/utils/context-overflow-phrases.ts":{"bytes":2266,"imports":[],"format":"esm"},"src/providers/provider-error-redaction.ts":{"bytes":9369,"imports":[],"format":"esm"},"src/providers/provider-errors.ts":{"bytes":19820,"imports":[{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/utils/context-overflow-phrases.ts","kind":"import-statement","original":"../utils/context-overflow-phrases.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/providers/legacy-chat-stream.ts":{"bytes":5039,"imports":[{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/utils/request-context.ts":{"bytes":3679,"imports":[],"format":"esm"},"src/config/models.ts":{"bytes":17947,"imports":[{"path":"src/utils/request-context.ts","kind":"import-statement","original":"../utils/request-context.js"}],"format":"esm"},"src/core/llm-provider.ts":{"bytes":13791,"imports":[],"format":"esm"},"src/providers/DualLLMProvider.ts":{"bytes":21175,"imports":[{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/legacy-chat-stream.ts","kind":"import-statement","original":"./legacy-chat-stream.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"},{"path":"src/config/models.ts","kind":"import-statement","original":"../config/models.js"},{"path":"src/core/llm-provider.ts","kind":"import-statement","original":"../core/llm-provider.js"}],"format":"esm"},"src/utils/tool-result-content.ts":{"bytes":4820,"imports":[],"format":"esm"},"src/providers/endpoint-policy.ts":{"bytes":6439,"imports":[{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/pinned-provider-dispatcher.ts":{"bytes":3986,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"}],"format":"esm"},"src/providers/bounded-provider-transport.ts":{"bytes":15376,"imports":[{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"src/observability/index.ts","kind":"import-statement","original":"../observability/index.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/pinned-provider-dispatcher.ts","kind":"import-statement","original":"./pinned-provider-dispatcher.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/provider-error-redaction.ts","kind":"import-statement","original":"./provider-error-redaction.js"}],"format":"esm"},"src/utils/json-schema.ts":{"bytes":43478,"imports":[{"path":"node:net","kind":"import-statement","external":true}],"format":"esm"},"src/providers/tool-schema-projection.ts":{"bytes":12249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/json-schema.ts","kind":"import-statement","original":"../utils/json-schema.js"}],"format":"esm"},"src/providers/tool-name-codec.ts":{"bytes":4437,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/acknowledgement.ts":{"bytes":1197,"imports":[],"format":"esm"},"src/providers/quota.ts":{"bytes":9783,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/acknowledgement.ts","kind":"import-statement","original":"../utils/acknowledgement.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"}],"format":"esm"},"src/providers/direct-provider.ts":{"bytes":58249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/utils/tool-result-content.ts","kind":"import-statement","original":"../utils/tool-result-content.js"},{"path":"src/providers/bounded-provider-transport.ts","kind":"import-statement","original":"./bounded-provider-transport.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/utils/text-security.ts":{"bytes":809,"imports":[],"format":"esm"},"src/providers/catalog.ts":{"bytes":24437,"imports":[{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/utils/text-security.ts","kind":"import-statement","original":"../utils/text-security.js"}],"format":"esm"},"src/utils/fs.ts":{"bytes":13355,"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/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/control-plane/lock.ts":{"bytes":2496,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/providers/file-connection-store.ts":{"bytes":8338,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/utils/fs.ts","kind":"import-statement","original":"../utils/fs.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/control-plane/lock.ts","kind":"import-statement","original":"../control-plane/lock.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"}],"format":"esm"},"src/providers/quota-store.ts":{"bytes":15760,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"}],"format":"esm"},"src/providers/index.ts":{"bytes":1766,"imports":[{"path":"src/providers/DualLLMProvider.ts","kind":"import-statement","original":"./DualLLMProvider.js"},{"path":"src/providers/direct-provider.ts","kind":"import-statement","original":"./direct-provider.js"},{"path":"src/providers/provider-errors.ts","kind":"import-statement","original":"./provider-errors.js"},{"path":"src/providers/endpoint-policy.ts","kind":"import-statement","original":"./endpoint-policy.js"},{"path":"src/providers/tool-schema-projection.ts","kind":"import-statement","original":"./tool-schema-projection.js"},{"path":"src/providers/tool-name-codec.ts","kind":"import-statement","original":"./tool-name-codec.js"},{"path":"src/providers/catalog.ts","kind":"import-statement","original":"./catalog.js"},{"path":"src/providers/file-connection-store.ts","kind":"import-statement","original":"./file-connection-store.js"},{"path":"src/providers/quota.ts","kind":"import-statement","original":"./quota.js"},{"path":"src/providers/quota-store.ts","kind":"import-statement","original":"./quota-store.js"}],"format":"esm"}},"outputs":{"dist/providers/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:perf_hooks","kind":"import-statement","external":true},{"path":"node:dns/promises","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:events","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:net","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["BUILT_IN_XENO_PROVIDER_PRESETS","DualLLMProvider","FileQuotaAuthority","FileXenoProviderConnectionStore","PROVIDER_TOOL_NAME_PATTERN","ProviderError","QuotaAcknowledgementError","QuotaError","ToolSchemaProjectionError","XENO_PROVIDER_CATALOG_SCHEMA_VERSION","XENO_PROVIDER_CONNECTION_STORE_SCHEMA_VERSION","XenoProviderCatalog","assertDirectEndpointResolution","classifyProviderHttpError","classifyProviderStreamError","createDirectProvider","createOllamaNativeProvider","createQuotaGovernedProvider","createToolNameCodec","directProviderConfigFromConnection","isQuotaControlError","normalizeQuotaScope","parseRetryAfter","probeXenoProvider","projectToolDefinitionsForProvider","projectToolSchemaForProvider","providerCapabilityError","providerProtocolError","quotaAncestors","quotaInteger","quotaScopeKey","quotaText","selectXenoProviderRoute","validateDirectEndpoint"],"entryPoint":"src/providers/index.ts","inputs":{"src/observability/telemetry.ts":{"bytesInOutput":1600},"src/observability/index.ts":{"bytesInOutput":0},"src/utils/context-overflow-phrases.ts":{"bytesInOutput":169},"src/providers/provider-error-redaction.ts":{"bytesInOutput":3342},"src/providers/provider-errors.ts":{"bytesInOutput":7208},"src/providers/legacy-chat-stream.ts":{"bytesInOutput":1431},"src/config/models.ts":{"bytesInOutput":56},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":6184},"src/providers/index.ts":{"bytesInOutput":0},"src/providers/direct-provider.ts":{"bytesInOutput":26684},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6776},"src/providers/endpoint-policy.ts":{"bytesInOutput":3317},"src/providers/pinned-provider-dispatcher.ts":{"bytesInOutput":1519},"src/providers/tool-schema-projection.ts":{"bytesInOutput":5709},"src/utils/json-schema.ts":{"bytesInOutput":19782},"src/providers/tool-name-codec.ts":{"bytesInOutput":1046},"src/providers/quota.ts":{"bytesInOutput":3412},"src/utils/acknowledgement.ts":{"bytesInOutput":470},"src/utils/text-security.ts":{"bytesInOutput":180},"src/providers/catalog.ts":{"bytesInOutput":11934},"src/providers/file-connection-store.ts":{"bytesInOutput":3774},"src/utils/fs.ts":{"bytesInOutput":314},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1054},"src/providers/quota-store.ts":{"bytesInOutput":8090}},"bytes":117199}}}
|
package/dist/session/index.cjs
CHANGED
|
@@ -48,7 +48,7 @@ ${this.stringify(e.data)}
|
|
|
48
48
|
`)+`
|
|
49
49
|
`;await k(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await k(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await k(u,l)}catch(l){this.workspaceMirrorDisabled=!0,B("Transcript workspace mirror disabled",l)}}}async truncateAfterMessageCount(e){let t=await S(this.transcriptPath);if(!t)return;let r=ee(t),s=Math.max(0,e),i=0,o=[];for(let u of r){if(u.type==="user_message"||u.type==="assistant_message"){if(i>=s)break;i+=1}o.push(u)}let a=o.length>0?o.map(u=>JSON.stringify(u)).join(`
|
|
50
50
|
`)+`
|
|
51
|
-
`:"";await k(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await k(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await k(u,l)}catch(l){this.workspaceMirrorDisabled=!0,B("Transcript workspace mirror disabled",l)}}}getSequence(){return this.sequence}async initialize(){try{let e=await S(this.transcriptPath);if(!e){this.sequence=0;return}let t=ee(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);B(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};var te=_(require("path"),1),mt=require("crypto"),ht=require("fs/promises");var tr={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit",CoordinationSend:"Send",CoordinationQuery:"Receive"};function he(n){return tr[n]??n}var D=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=te.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await N(this.checkpointsDir);let t=(0,mt.randomUUID)(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=te.join(this.checkpointsDir,`${t}.json`);return await k(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await it(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await S(r);if(s){let i=E(s,null);if(i){let o=await(0,ht.stat)(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=te.join(this.checkpointsDir,`${e}.json`),r;try{r=await S(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=E(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=he(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=te.join(this.checkpointsDir,`${e}.json`);await $(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};var U=_(require("path"),1),je=_(require("os"),1),j=_(require("fs"),1);var rr=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),nr=globalThis,Fe=nr[rr]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},Be=Fe.cleanups;function sr(){for(let n of Be)try{n()}catch{}}function wt(n){return Be.add(n),!Fe.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(Fe.exitHandlerRegistered=!0,process.on("exit",sr)),()=>{Be.delete(n)}}var yt="0.10.
|
|
51
|
+
`:"";await k(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await k(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await k(u,l)}catch(l){this.workspaceMirrorDisabled=!0,B("Transcript workspace mirror disabled",l)}}}getSequence(){return this.sequence}async initialize(){try{let e=await S(this.transcriptPath);if(!e){this.sequence=0;return}let t=ee(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);B(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};var te=_(require("path"),1),mt=require("crypto"),ht=require("fs/promises");var tr={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit",CoordinationSend:"Send",CoordinationQuery:"Receive"};function he(n){return tr[n]??n}var D=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=te.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await N(this.checkpointsDir);let t=(0,mt.randomUUID)(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=te.join(this.checkpointsDir,`${t}.json`);return await k(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await it(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await S(r);if(s){let i=E(s,null);if(i){let o=await(0,ht.stat)(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=te.join(this.checkpointsDir,`${e}.json`),r;try{r=await S(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=E(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=he(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=te.join(this.checkpointsDir,`${e}.json`);await $(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};var U=_(require("path"),1),je=_(require("os"),1),j=_(require("fs"),1);var rr=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),nr=globalThis,Fe=nr[rr]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},Be=Fe.cleanups;function sr(){for(let n of Be)try{n()}catch{}}function wt(n){return Be.add(n),!Fe.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(Fe.exitHandlerRegistered=!0,process.on("exit",sr)),()=>{Be.delete(n)}}var yt="0.10.36";var ir=1e4,or=6e4,ar="session.lock",cr="lock.json",Z=new Map;function Ue(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function ur(){for(let[n,e]of Z)try{let t=E(j.readFileSync(n,"utf8"),null);Ue(t,e)&&j.unlinkSync(n)}catch{}Z.clear()}wt(ur);var G=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=U.join(e,ar),this.legacyLockPath=U.join(e,cr),this.sessionId=U.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:je.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:yt,acquiredAt:e,updatedAt:e,heartbeat:e},r=U.dirname(this.lockPath);await j.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await $(s)}try{await j.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,Z.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let c=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${c?.pid} on ${c?.hostname}`)}await $(this.lockPath);try{await j.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(c){throw c.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):c}this.acquiredOwner=t,Z.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;Z.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Ue(t,e)&&await $(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===je.hostname())try{return process.kill(t.pid,0),!1}catch(i){return i.code!=="EPERM"}let r=new Date(t.heartbeat).getTime();return Date.now()-r>or}startHeartbeat(e=ir){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){q("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}q(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Ue(e,t)){this.acquiredOwner=void 0,Z.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await k(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await S(e);return t?E(t,null):null}async findExistingLockPath(){return await S(this.lockPath)?this.lockPath:await S(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await de(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await $(a),r.push(U.basename(s))}}return r}};var C=_(require("path"),1);var re=1;var A=_(require("path"),1);function lr(n,e){let t=A.resolve(n),r=A.resolve(n,e);return r===t?!0:t===A.parse(t).root?r.startsWith(t):r.startsWith(t+A.sep)}function J(n,e){if(A.isAbsolute(e))return A.resolve(e);if(!lr(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return A.resolve(n,e)}function we(n,e=process.platform){let t=A.resolve(n);return e==="win32"?t.toLowerCase():t}function V(n){if(n!==void 0&&n!=="agent"&&n!=="chatOnly")throw new Error("Invalid session execution mode; expected agent or chatOnly.")}var P=_(require("path"),1),Se=_(require("os"),1),R=_(require("node:fs/promises"),1),xe=require("node:crypto");var z=require("node:os");var He=require("node:path"),fn=(0,z.platform)();var mn=(0,z.release)(),hn=(0,z.homedir)();function ye(){let n=process.env.XENO_AGENT_HOME?.trim();return n?(0,He.resolve)(n):(0,He.resolve)((0,z.homedir)(),".xeno-agent")}var kt=1,St="recent.json",dr=".lock",vt=".entries",pr=3e4,qe=6e4,bt=new Set(["EACCES","EBUSY","EPERM"]),gr=[5,10,20,40,80,160,320],ke=new Map;function fr(n,e){let t=(0,xe.createHash)("sha256").update(e).digest("hex");return P.join(`${n}${vt}`,`${t}.json`)}async function We(n,e,t){let r={schemaVersion:1,key:e,entry:t};await k(fr(n,e),JSON.stringify(r)+`
|
|
52
52
|
`)}async function mr(n,e){let t=`${n}${vt}`,r;try{r=await R.readdir(t)}catch(s){if(s.code==="ENOENT")return;throw s}await Promise.all(r.filter(s=>s.endsWith(".json")).map(async s=>{let i=await R.readFile(P.join(t,s),"utf8").catch(()=>""),o=E(i,null);if(!(!o||o.schemaVersion!==1||typeof o.key!="string")){if(o.entry===null){delete e[o.key];return}typeof o.entry.sessionId!="string"||typeof o.entry.endedAt!="string"||(e[o.key]=o.entry)}}))}function xt(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function hr(n){try{let[e,t]=await Promise.all([R.readFile(P.join(n,"owner.json"),"utf8").catch(()=>""),R.stat(n)]),r=E(e,null);return r?.hostname===Se.hostname()&&xt(r.pid)?!1:r?.hostname&&r.hostname!==Se.hostname()||!r?Date.now()-t.mtimeMs>qe:Date.now()-t.mtimeMs>qe||!xt(r.pid)}catch{return!1}}async function Et(n){for(let e=0;;e+=1)try{await R.rm(n,{recursive:!0});return}catch(t){let r=t.code;if(r==="ENOENT")return;let s=gr[e];if(process.platform!=="win32"||!r||!bt.has(r)||s===void 0)throw t;await new Promise(i=>setTimeout(i,s))}}async function wr(n,e){try{let t=await R.readFile(P.join(n,"owner.json"),"utf8");E(t,null)?.token===e&&await Et(n)}catch(t){if(t.code!=="ENOENT")throw t}}async function Ge(n,e){let t=X(n),r=ke.get(t)??Promise.resolve(),s,i=new Promise(o=>{s=o});ke.set(t,i),await r;try{return await yr(t,e)}finally{s(),ke.get(t)===i&&ke.delete(t)}}async function yr(n,e){let t=`${n}${dr}`,r=(0,xe.randomUUID)(),s=Date.now();await R.mkdir(P.dirname(n),{recursive:!0});for(let i=0;;i+=1){let o={schemaVersion:1,token:r,pid:process.pid,hostname:Se.hostname(),acquiredAt:new Date().toISOString()};try{await R.mkdir(t),await R.writeFile(P.join(t,"owner.json"),JSON.stringify(o),"utf8");break}catch(a){let c=a.code,u=process.platform==="win32"&&!!c&&bt.has(c);if(c!=="EEXIST"&&!u)throw a;if(await hr(t)){await Et(t);continue}if(Date.now()-s>=pr)throw new Error(`Timed out waiting for recent-sessions index lock: ${t}`);let l=Math.min(100,5+i*5)+Math.floor(Math.random()*10);await new Promise(p=>setTimeout(p,l))}}try{return await e()}finally{await wr(t,r)}}function X(n){return n===void 0?P.join(ye(),St):P.join(n,".xeno-agent",St)}function ne(n){let e=P.normalize(n).replace(/[\\/]+$/,""),t=e.length>0?e:P.parse(P.normalize(n)).root;return process.platform==="win32"?t.toLowerCase():t}async function H(n){let e=X(n),t=le(e)?await S(e):null,r=t?E(t,null):null,s=r&&typeof r=="object"?r:null,i={},o=s?.version===kt&&s.entries&&typeof s.entries=="object"?s.entries:{};for(let[a,c]of Object.entries(o)){if(!c||typeof c!="object")continue;let u=c;typeof u.sessionId!="string"||u.sessionId.length===0||typeof u.endedAt=="string"&&(i[a]={sessionId:u.sessionId,endedAt:u.endedAt,role:typeof u.role=="string"?u.role:void 0})}return await mr(e,i),{version:kt,entries:i}}async function ve(n,e={}){let t=await H(e.homeDir),r=ne(n),s=t.entries[r];if(s&&!(e.role&&s.role&&s.role!==e.role))return s}async function be(n,e={}){let t=ne(n.cwd),r={sessionId:n.sessionId,role:n.role,endedAt:n.endedAt??new Date().toISOString()},s=X(e.homeDir);await We(s,t,r),await Ge(e.homeDir,async()=>{let i=await H(e.homeDir);i.entries[t]=r,await k(s,JSON.stringify(i,null,2)+`
|
|
53
53
|
`)})}async function Tt(n,e={}){let t=ne(n),r=X(e.homeDir);(await H(e.homeDir)).entries[t]&&(await We(r,t,null),await Ge(e.homeDir,async()=>{let i=await H(e.homeDir);delete i.entries[t],await k(r,JSON.stringify(i,null,2)+`
|
|
54
54
|
`)}))}async function se(n,e={}){let t=await H(e.homeDir),r=Object.entries(t.entries).filter(([,i])=>i.sessionId===n).map(([i])=>i);if(r.length===0)return;let s=X(e.homeDir);await Promise.all(r.map(i=>We(s,i,null))),await Ge(e.homeDir,async()=>{let i=await H(e.homeDir);for(let[o,a]of Object.entries(i.entries))a.sessionId===n&&delete i.entries[o];await k(s,JSON.stringify(i,null,2)+`
|
package/dist/session/index.js
CHANGED
|
@@ -48,7 +48,7 @@ ${this.stringify(e.data)}
|
|
|
48
48
|
`)+`
|
|
49
49
|
`;await y(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await y(u,l)}catch(l){this.workspaceMirrorDisabled=!0,L("Transcript workspace mirror disabled",l)}}}async truncateAfterMessageCount(e){let t=await k(this.transcriptPath);if(!t)return;let r=Q(t),s=Math.max(0,e),i=0,o=[];for(let u of r){if(u.type==="user_message"||u.type==="assistant_message"){if(i>=s)break;i+=1}o.push(u)}let a=o.length>0?o.map(u=>JSON.stringify(u)).join(`
|
|
50
50
|
`)+`
|
|
51
|
-
`:"";await y(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await y(u,l)}catch(l){this.workspaceMirrorDisabled=!0,L("Transcript workspace mirror disabled",l)}}}getSequence(){return this.sequence}async initialize(){try{let e=await k(this.transcriptPath);if(!e){this.sequence=0;return}let t=Q(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);L(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};import*as Y from"path";import{randomUUID as Vt}from"crypto";import{stat as zt}from"fs/promises";var Jt={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit",CoordinationSend:"Send",CoordinationQuery:"Receive"};function ae(n){return Jt[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=Y.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await C(this.checkpointsDir);let t=Vt(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=Y.join(this.checkpointsDir,`${t}.json`);return await y(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await ze(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await k(r);if(s){let i=b(s,null);if(i){let o=await zt(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=Y.join(this.checkpointsDir,`${e}.json`),r;try{r=await k(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=b(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=ae(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=Y.join(this.checkpointsDir,`${e}.json`);await O(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};import*as B from"path";import*as Pe from"os";import*as F from"fs";var Xt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),Kt=globalThis,Ee=Kt[Xt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},Te=Ee.cleanups;function Qt(){for(let n of Te)try{n()}catch{}}function st(n){return Te.add(n),!Ee.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(Ee.exitHandlerRegistered=!0,process.on("exit",Qt)),()=>{Te.delete(n)}}var it="0.10.
|
|
51
|
+
`:"";await y(this.transcriptPath,a);let c=this.buildMarkdownDocument(o,"session store");if(await y(this.markdownPath,c),!this.workspaceMirrorDisabled){let u=await this.resolveWorkspaceMarkdownPath();if(u)try{let l=this.buildMarkdownDocument(o,"workspace mirror");await y(u,l)}catch(l){this.workspaceMirrorDisabled=!0,L("Transcript workspace mirror disabled",l)}}}getSequence(){return this.sequence}async initialize(){try{let e=await k(this.transcriptPath);if(!e){this.sequence=0;return}let t=Q(e);if(t.length===0){this.sequence=0;return}let r=t[t.length-1];this.sequence=r.sequence+1}catch(e){let t=e instanceof Error?e.message:String(e);L(`Transcript initialization warning: ${t}. Starting with empty transcript.`),this.sequence=0}}async flush(){await this.writeQueue}};import*as Y from"path";import{randomUUID as Vt}from"crypto";import{stat as zt}from"fs/promises";var Jt={View:"Read",Replace:"Write",GlobTool:"Glob",GrepTool:"Grep",SQLiteAnalyze:"SqliteAnalyze",ReadNotebook:"NotebookRead",NotebookEditCell:"NotebookEdit",CoordinationSend:"Send",CoordinationQuery:"Receive"};function ae(n){return Jt[n]??n}var A=class{sessionDir;checkpointsDir;autoInterval;lastCheckpointMessageCount=0;constructor(e,t){this.sessionDir=e,this.checkpointsDir=Y.join(e,"checkpoints"),this.autoInterval=t?.autoInterval??10}async initialize(){let e=await this.list();e.length>0&&(this.lastCheckpointMessageCount=e[0].messageCount)}async create(e){await C(this.checkpointsDir);let t=Vt(),r={id:t,name:e.description,trigger:e.trigger,createdAt:new Date().toISOString(),messageCount:e.messages.length,tokenCount:this.estimateTokens(e.messages)},s={info:r,messages:e.messages},i=Y.join(this.checkpointsDir,`${t}.json`);return await y(i,JSON.stringify(s,null,2)),this.lastCheckpointMessageCount=e.messages.length,r}async list(){let e=await ze(this.checkpointsDir,/\.json$/),t=[];for(let r of e){let s=await k(r);if(s){let i=b(s,null);if(i){let o=await zt(r);t.push({info:i.info,modifiedAtMs:o.mtimeMs})}}}return t.sort((r,s)=>new Date(s.info.createdAt).getTime()-new Date(r.info.createdAt).getTime()||s.modifiedAtMs-r.modifiedAtMs).map(({info:r})=>r)}async restore(e){let t=Y.join(this.checkpointsDir,`${e}.json`),r;try{r=await k(t)}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to read checkpoint ${e}: ${o}`)}if(!r)throw new Error(`Checkpoint not found: ${e} (path: ${t})`);let s=b(r,null);if(!s)throw new Error(`Invalid checkpoint data for ${e}: JSON parse failed`);if(!s.messages||!Array.isArray(s.messages))throw new Error(`Invalid checkpoint data for ${e}: missing or invalid messages array`);if(!s.info)throw new Error(`Invalid checkpoint data for ${e}: missing info object`);return{messages:s.messages,info:s.info}}shouldAutoCheckpoint(e){return e-this.lastCheckpointMessageCount>=this.autoInterval}static isDangerousOperation(e,t){if(e=ae(e),e==="Write")return!0;if(e==="Bash"){let s=t.command?.toLowerCase()||"";return["rm ","del ","git push","git reset","drop ","truncate"].some(o=>s.includes(o))}return!1}async delete(e){let t=Y.join(this.checkpointsDir,`${e}.json`);await O(t)}estimateTokens(e){let t=0;for(let r of e)if(typeof r.content=="string")t+=Math.ceil(r.content.length/4);else if(Array.isArray(r.content))for(let s of r.content)"text"in s&&(t+=Math.ceil(s.text.length/4));return t}};import*as B from"path";import*as Pe from"os";import*as F from"fs";var Xt=Symbol.for("@xenosystem/agent-sdk/shutdown-registry"),Kt=globalThis,Ee=Kt[Xt]??={cleanups:new Set,exitHandlerRegistered:!1,signalHandlersInstalled:!1},Te=Ee.cleanups;function Qt(){for(let n of Te)try{n()}catch{}}function st(n){return Te.add(n),!Ee.exitHandlerRegistered&&typeof process<"u"&&typeof process.on=="function"&&(Ee.exitHandlerRegistered=!0,process.on("exit",Qt)),()=>{Te.delete(n)}}var it="0.10.36";var Yt=1e4,Zt=6e4,er="session.lock",tr="lock.json",J=new Map;function Re(n,e){return n!=null&&n.pid===e.pid&&n.hostname===e.hostname&&n.processStartedAt===e.processStartedAt&&n.acquiredAt===e.acquiredAt}function rr(){for(let[n,e]of J)try{let t=b(F.readFileSync(n,"utf8"),null);Re(t,e)&&F.unlinkSync(n)}catch{}J.clear()}st(rr);var V=class n{sessionDir;lockPath;legacyLockPath;sessionId;heartbeatTimer;acquiredOwner;constructor(e){this.sessionDir=e,this.lockPath=B.join(e,er),this.legacyLockPath=B.join(e,tr),this.sessionId=B.basename(e)}async acquire(){let e=new Date().toISOString(),t={schemaVersion:1,name:`session:${this.sessionId}`,sessionId:this.sessionId,pid:process.pid,hostname:Pe.hostname(),processStartedAt:new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString(),version:it,acquiredAt:e,updatedAt:e,heartbeat:e},r=B.dirname(this.lockPath);await F.promises.mkdir(r,{recursive:!0});let s=await this.findExistingLockPath();if(s){if(!await this.isStalePath(s)){let o=await this.readLockAt(s);throw new Error(`Session ${this.sessionId} is already locked by PID ${o?.pid} on ${o?.hostname}`)}await O(s)}try{await F.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"}),this.acquiredOwner=t,J.set(this.lockPath,t)}catch(i){if(i.code==="EEXIST"){if(!await this.isStalePath(this.lockPath)){let c=await this.readLockAt(this.lockPath);throw new Error(`Session ${this.sessionId} is already locked by PID ${c?.pid} on ${c?.hostname}`)}await O(this.lockPath);try{await F.promises.writeFile(this.lockPath,JSON.stringify(t,null,2),{flag:"wx",encoding:"utf-8"})}catch(c){throw c.code==="EEXIST"?new Error(`Session ${this.sessionId} lock was acquired by another process during stale recovery`):c}this.acquiredOwner=t,J.set(this.lockPath,t)}else throw i}}async release(){this.stopHeartbeat();let e=this.acquiredOwner;if(this.acquiredOwner=void 0,!e)return;J.delete(this.lockPath);let t=await this.readLockAt(this.lockPath);Re(t,e)&&await O(this.lockPath)}async isLocked(){let e=await this.findExistingLockPath();return e?!await this.isStalePath(e):!1}async isStale(){let e=await this.findExistingLockPath();return e?this.isStalePath(e):!1}async isStalePath(e){let t=await this.readLockAt(e);if(!t)return!1;if(t.hostname===Pe.hostname())try{return process.kill(t.pid,0),!1}catch(i){return i.code!=="EPERM"}let r=new Date(t.heartbeat).getTime();return Date.now()-r>Zt}startHeartbeat(e=Yt){this.heartbeatTimer&&this.stopHeartbeat(),this.heartbeatTimer=setInterval(async()=>{try{await this.updateHeartbeat()}catch(t){let r=t instanceof Error?t.message:String(t);if(t?.code==="ENOENT"){j("SessionLock: Session directory removed, stopping heartbeat"),this.stopHeartbeat();return}j(`SessionLock: Failed to update heartbeat: ${r}`)}},e),this.heartbeatTimer.unref()}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async updateHeartbeat(){let e=await this.readLockAt(this.lockPath),t=this.acquiredOwner;if(!(!e||!t)){if(!Re(e,t)){this.acquiredOwner=void 0,J.delete(this.lockPath),this.stopHeartbeat();return}e.heartbeat=new Date().toISOString(),e.updatedAt=e.heartbeat,await y(this.lockPath,JSON.stringify(e,null,2))}}async readLock(){let e=await this.findExistingLockPath();return e?this.readLockAt(e):null}async readLockAt(e){let t=await k(e);return t?b(t,null):null}async findExistingLockPath(){return await k(this.lockPath)?this.lockPath:await k(this.legacyLockPath)?this.legacyLockPath:null}static async cleanStale(e){let t=await ie(e),r=[];for(let s of t){let i=new n(s);if(await i.isStale()){let a=await i.findExistingLockPath();a&&await O(a),r.push(B.basename(s))}}return r}};import*as I from"path";var Z=1;import*as _ from"path";function nr(n,e){let t=_.resolve(n),r=_.resolve(n,e);return r===t?!0:t===_.parse(t).root?r.startsWith(t):r.startsWith(t+_.sep)}function H(n,e){if(_.isAbsolute(e))return _.resolve(e);if(!nr(n,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return _.resolve(n,e)}function ce(n,e=process.platform){let t=_.resolve(n);return e==="win32"?t.toLowerCase():t}function q(n){if(n!==void 0&&n!=="agent"&&n!=="chatOnly")throw new Error("Invalid session execution mode; expected agent or chatOnly.")}import*as T from"path";import*as de from"os";import*as P from"node:fs/promises";import{createHash as or,randomUUID as ar}from"node:crypto";import{homedir as at,platform as sr,release as ir}from"node:os";import{resolve as ot}from"node:path";var Tn=sr();var Pn=ir(),Rn=at();function ue(){let n=process.env.XENO_AGENT_HOME?.trim();return n?ot(n):ot(at(),".xeno-agent")}var ct=1,ut="recent.json",cr=".lock",dt=".entries",ur=3e4,_e=6e4,pt=new Set(["EACCES","EBUSY","EPERM"]),lr=[5,10,20,40,80,160,320],le=new Map;function dr(n,e){let t=or("sha256").update(e).digest("hex");return T.join(`${n}${dt}`,`${t}.json`)}async function Me(n,e,t){let r={schemaVersion:1,key:e,entry:t};await y(dr(n,e),JSON.stringify(r)+`
|
|
52
52
|
`)}async function pr(n,e){let t=`${n}${dt}`,r;try{r=await P.readdir(t)}catch(s){if(s.code==="ENOENT")return;throw s}await Promise.all(r.filter(s=>s.endsWith(".json")).map(async s=>{let i=await P.readFile(T.join(t,s),"utf8").catch(()=>""),o=b(i,null);if(!(!o||o.schemaVersion!==1||typeof o.key!="string")){if(o.entry===null){delete e[o.key];return}typeof o.entry.sessionId!="string"||typeof o.entry.endedAt!="string"||(e[o.key]=o.entry)}}))}function lt(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function gr(n){try{let[e,t]=await Promise.all([P.readFile(T.join(n,"owner.json"),"utf8").catch(()=>""),P.stat(n)]),r=b(e,null);return r?.hostname===de.hostname()&<(r.pid)?!1:r?.hostname&&r.hostname!==de.hostname()||!r?Date.now()-t.mtimeMs>_e:Date.now()-t.mtimeMs>_e||!lt(r.pid)}catch{return!1}}async function gt(n){for(let e=0;;e+=1)try{await P.rm(n,{recursive:!0});return}catch(t){let r=t.code;if(r==="ENOENT")return;let s=lr[e];if(process.platform!=="win32"||!r||!pt.has(r)||s===void 0)throw t;await new Promise(i=>setTimeout(i,s))}}async function fr(n,e){try{let t=await P.readFile(T.join(n,"owner.json"),"utf8");b(t,null)?.token===e&&await gt(n)}catch(t){if(t.code!=="ENOENT")throw t}}async function Ie(n,e){let t=z(n),r=le.get(t)??Promise.resolve(),s,i=new Promise(o=>{s=o});le.set(t,i),await r;try{return await mr(t,e)}finally{s(),le.get(t)===i&&le.delete(t)}}async function mr(n,e){let t=`${n}${cr}`,r=ar(),s=Date.now();await P.mkdir(T.dirname(n),{recursive:!0});for(let i=0;;i+=1){let o={schemaVersion:1,token:r,pid:process.pid,hostname:de.hostname(),acquiredAt:new Date().toISOString()};try{await P.mkdir(t),await P.writeFile(T.join(t,"owner.json"),JSON.stringify(o),"utf8");break}catch(a){let c=a.code,u=process.platform==="win32"&&!!c&&pt.has(c);if(c!=="EEXIST"&&!u)throw a;if(await gr(t)){await gt(t);continue}if(Date.now()-s>=ur)throw new Error(`Timed out waiting for recent-sessions index lock: ${t}`);let l=Math.min(100,5+i*5)+Math.floor(Math.random()*10);await new Promise(p=>setTimeout(p,l))}}try{return await e()}finally{await fr(t,r)}}function z(n){return n===void 0?T.join(ue(),ut):T.join(n,".xeno-agent",ut)}function pe(n){let e=T.normalize(n).replace(/[\\/]+$/,""),t=e.length>0?e:T.parse(T.normalize(n)).root;return process.platform==="win32"?t.toLowerCase():t}async function W(n){let e=z(n),t=se(e)?await k(e):null,r=t?b(t,null):null,s=r&&typeof r=="object"?r:null,i={},o=s?.version===ct&&s.entries&&typeof s.entries=="object"?s.entries:{};for(let[a,c]of Object.entries(o)){if(!c||typeof c!="object")continue;let u=c;typeof u.sessionId!="string"||u.sessionId.length===0||typeof u.endedAt=="string"&&(i[a]={sessionId:u.sessionId,endedAt:u.endedAt,role:typeof u.role=="string"?u.role:void 0})}return await pr(e,i),{version:ct,entries:i}}async function Ae(n,e={}){let t=await W(e.homeDir),r=pe(n),s=t.entries[r];if(s&&!(e.role&&s.role&&s.role!==e.role))return s}async function De(n,e={}){let t=pe(n.cwd),r={sessionId:n.sessionId,role:n.role,endedAt:n.endedAt??new Date().toISOString()},s=z(e.homeDir);await Me(s,t,r),await Ie(e.homeDir,async()=>{let i=await W(e.homeDir);i.entries[t]=r,await y(s,JSON.stringify(i,null,2)+`
|
|
53
53
|
`)})}async function hr(n,e={}){let t=pe(n),r=z(e.homeDir);(await W(e.homeDir)).entries[t]&&(await Me(r,t,null),await Ie(e.homeDir,async()=>{let i=await W(e.homeDir);delete i.entries[t],await y(r,JSON.stringify(i,null,2)+`
|
|
54
54
|
`)}))}async function ge(n,e={}){let t=await W(e.homeDir),r=Object.entries(t.entries).filter(([,i])=>i.sessionId===n).map(([i])=>i);if(r.length===0)return;let s=z(e.homeDir);await Promise.all(r.map(i=>Me(s,i,null))),await Ie(e.homeDir,async()=>{let i=await W(e.homeDir);for(let[o,a]of Object.entries(i.entries))a.sessionId===n&&delete i.entries[o];await y(s,JSON.stringify(i,null,2)+`
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,"utf-8")}async function Nt(t,e){let n=a.dirname(t);await
|
|
1
|
+
"use strict";var bt=Object.create;var T=Object.defineProperty;var wt=Object.getOwnPropertyDescriptor;var Et=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var Ct=(t,e)=>{for(var n in e)T(t,n,{get:e[n],enumerable:!0})},P=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Et(e))!Tt.call(t,o)&&o!==n&&T(t,o,{get:()=>e[o],enumerable:!(r=wt(e,o))||r.enumerable});return t};var v=(t,e,n)=>(n=t!=null?bt(Rt(t)):{},P(e||!t||!t.__esModule?T(n,"default",{value:t,enumerable:!0}):n,t)),At=t=>P(T({},"__esModule",{value:!0}),t);var un={};Ct(un,{ApiTransientError:()=>w,HOME_DIR:()=>ie,IS_LINUX:()=>re,IS_MAC:()=>ne,IS_WINDOWS:()=>V,LogLevel:()=>et,OS_VERSION:()=>oe,PLATFORM:()=>A,accountTextTokens:()=>Oe,appendDurableLine:()=>Nt,appendLine:()=>$t,benchmarkLeakError:()=>Ke,buildToolResultBlock:()=>sn,buildToolResultText:()=>xt,calculateCost:()=>De,commandMentionsBenchmarkLeak:()=>Ze,conservativeTokenAccountingAdapter:()=>st,copyTextToClipboard:()=>je,createSafeRegex:()=>me,debug:()=>be,decodeTextBuffer:()=>q,deleteDir:()=>Xt,deleteFile:()=>qt,detectLineEnding:()=>z,detectPreferredLineEnding:()=>Bt,detectTextEncoding:()=>j,encodeTextBuffer:()=>X,ensureDir:()=>C,error:()=>Re,estimateTokens:()=>at,estimateTokensForModel:()=>it,existsSync:()=>Ft,filterBenchmarkLeakPaths:()=>Ge,findSimilarFile:()=>It,fitsInBudget:()=>Be,formatCost:()=>Fe,getAgentHome:()=>se,getBenchmarkReferenceOverwriteHint:()=>Qe,getBoolean:()=>ge,getConfigDir:()=>ae,getLogLevel:()=>ye,getNumber:()=>pe,getProjectConfigDir:()=>ue,getRetryErrorContext:()=>N,getShellName:()=>ce,getString:()=>de,getToolResultTransportContent:()=>en,hasDir:()=>Mt,hasDisallowedAsciiControlCharacter:()=>an,hasFile:()=>kt,hasFrontmatter:()=>Gt,hasMixedLineEndings:()=>Ot,hasNonTextToolResultContent:()=>rn,hasTransientStatusMention:()=>rt,info:()=>we,isBenchmarkLeakPath:()=>L,isBenchmarkMode:()=>O,isGitRepo:()=>le,isPathSafe:()=>Z,isRetryableError:()=>ot,listDirs:()=>Wt,listFiles:()=>jt,normalizeLineEndings:()=>H,normalizeXenoRequestContext:()=>ke,parseDocument:()=>Yt,parseJsonLines:()=>Jt,pathIdentityKey:()=>ee,readFileSafe:()=>_t,readIfExists:()=>Dt,readTextFile:()=>J,remainingBudget:()=>Pe,renameReplacingWithRetry:()=>F,safeJsonParse:()=>zt,safeJsonStringify:()=>Ht,safeRegexTest:()=>he,safeResolvePath:()=>te,setLogLevel:()=>xe,stringifyDocument:()=>Ut,toTransportAssistantBlocks:()=>on,toolAssistantContentToText:()=>mt,toolResultContentToText:()=>tn,truncateToTokens:()=>Le,validateRegexPattern:()=>tt,validateRequired:()=>fe,warn:()=>Ee,withRetry:()=>Ne,writeAtomic:()=>D,writeTextFile:()=>Lt,xenoRequestContextHeaders:()=>Me});module.exports=At(un);var b=require("node:fs"),m=require("node:fs"),u=v(require("node:fs/promises"),1),a=v(require("node:path"),1);function kt(t){try{return(0,m.existsSync)(t)&&(0,m.statSync)(t).isFile()}catch{return!1}}function Mt(t){try{return(0,m.existsSync)(t)&&(0,m.statSync)(t).isDirectory()}catch{return!1}}function _t(t,e=""){try{return(0,b.readFileSync)(t,"utf-8")}catch{return e}}async function C(t){await u.mkdir(t,{recursive:!0})}async function D(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 u.writeFile(o,e),await F(o,t)}finally{try{await u.unlink(o)}catch{}}}var St=new Set(["EACCES","EBUSY","EPERM"]),vt=[10,20,40,80,160,320,640];async function F(t,e){for(let n=0;;n+=1)try{await u.rename(t,e);return}catch(r){let o=r.code,i=vt[n];if(process.platform!=="win32"||!o||!St.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 u.appendFile(t,e+`
|
|
2
|
+
`,"utf-8")}async function Nt(t,e){let n=a.dirname(t);await C(n);let r=await u.open(t,"a");try{await r.writeFile(e+`
|
|
3
3
|
`,"utf-8"),await r.sync()}finally{await r.close()}}function j(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 W(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 q(t,e){switch(e){case"utf8-bom":return t.subarray(3).toString("utf8");case"utf16le":return t.subarray(2).toString("utf16le");case"utf16be":return W(t.subarray(2)).toString("utf16le");default:return t.toString("utf8")}}function X(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]),W(Buffer.from(t,"utf16le"))]);default:return Buffer.from(t,"utf8")}}function z(t){return t.includes(`\r
|
|
4
4
|
`)?"CRLF":"LF"}function H(t,e){let n=t.replace(/\r\n/g,`
|
|
5
5
|
`);return e==="CRLF"?n.replace(/\n/g,`\r
|
|
6
6
|
`):n}function Ot(t){return t.includes(`\r
|
|
7
|
-
`)?/(^|[^\r])\n/.test(t):!1}async function J(t){let e=await u.readFile(t),n=j(e),r=q(e,n);return{content:r,encoding:n,lineEnding:z(r),sizeBytes:e.length}}async function Lt(t,e,n){let r=n?.preserveLineEndings?e:H(e,n?.lineEnding??"LF");await D(t,X(r,n?.encoding??"utf8"))}async function Bt(t){let e=new Set,n=a.resolve(t);for(;!e.has(n);){e.add(n);try{let o=(0,
|
|
7
|
+
`)?/(^|[^\r])\n/.test(t):!1}async function J(t){let e=await u.readFile(t),n=j(e),r=q(e,n);return{content:r,encoding:n,lineEnding:z(r),sizeBytes:e.length}}async function Lt(t,e,n){let r=n?.preserveLineEndings?e:H(e,n?.lineEnding??"LF");await D(t,X(r,n?.encoding??"utf8"))}async function Bt(t){let e=new Set,n=a.resolve(t);for(;!e.has(n);){e.add(n);try{let o=(0,b.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 f=a.join(n,i),c=await J(f);if(c.content.length>0)return c.lineEnding}catch{}}}catch{}let r=a.dirname(n);if(r===n)break;n=r}return"LF"}function Pt(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 f=(0,b.readdirSync)(s.dir,{withFileTypes:!0});for(let c of f){let l=a.join(s.dir,c.name);if(c.isFile()){if(r.push(l),r.length>=n)break;continue}c.isDirectory()&&s.depth<e&&!c.name.startsWith(".")&&c.name!=="node_modules"&&o.push({dir:l,depth:s.depth+1})}}catch{}}}return r}function I(t,e){let n=a.relative(t,e);return n===""||!n.startsWith("..")&&!a.isAbsolute(n)}function It(t,e){try{let n=a.dirname(t),r=a.basename(t,a.extname(t)).toLowerCase(),o=a.basename(t).toLowerCase(),i=[n,a.dirname(n)],s=e!==void 0&&I(e,t)?e:void 0,f=i.flatMap(l=>Pt(l,2,500)).filter(l=>s===void 0||I(s,l)),c=null;for(let l of f){let E=a.basename(l).toLowerCase(),R=a.basename(l,a.extname(l)).toLowerCase(),y=null;if(E===o?y=0:R===r?y=1:(E.includes(r)||r.includes(R))&&(y=2),y===null)continue;let yt=a.relative(n,l).split(a.sep).length,B=y+yt*.01;(!c||B<c.score)&&(c={filePath:l,score:B})}return c?.filePath??null}catch{}return null}async function Dt(t){try{return await u.readFile(t,"utf-8")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Ft(t){return(0,m.existsSync)(t)}async function jt(t,e){try{let r=(await u.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 Wt(t){try{return(await u.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 qt(t){try{await u.unlink(t)}catch(e){if(e.code!=="ENOENT")throw e}}async function Xt(t){try{await u.rm(t,{recursive:!0,force:!0})}catch(e){if(e.code!=="ENOENT")throw e}}function zt(t,e){try{return JSON.parse(t)}catch{return e}}function Ht(t,e="{}"){try{return JSON.stringify(t)}catch{return e}}function Jt(t){let e=[];for(let n of t.split(`
|
|
8
8
|
`)){let r=n.trim();if(r)try{e.push(JSON.parse(r))}catch{}}return e}function Yt(t){let e=Kt(t);return{frontmatter:e.frontmatter,content:e.content.trim()}}function Ut(t,e){let n=Object.fromEntries(Object.entries(t).filter(([r,o])=>o!==void 0));return["---",K(n),"---","",e].join(`
|
|
9
|
-
`)}function Gt(t){return t.trimStart().startsWith("---")}function Kt(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],
|
|
9
|
+
`)}function Gt(t){return t.trimStart().startsWith("---")}function Kt(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],f=o.index+s.length;return{frontmatter:U(i),content:r.slice(f)}}function U(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=Qt(o,r+1);if(i.key==="<<")throw new Error("YAML merge keys are not supported.");if(i.value!==""){e[i.key]=G(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)=>G(i.trimStart().slice(2),e+s+1)),nextIndex:r}:{value:U(n.join(`
|
|
10
10
|
`)),nextIndex:r}}function Qt(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 G(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 Y(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 Y(t,e);if(t.includes("[")||t.includes("]")||t.includes("{")||t.includes("}"))throw new Error(`Unsupported YAML scalar at line ${e}.`);return t}function Y(t,e){try{return JSON.parse(t)}catch{throw new Error(`Invalid YAML scalar at line ${e}.`)}}function K(t,e=""){return Object.entries(t).map(([n,r])=>Vt(n,r,e)).join(`
|
|
11
11
|
`)}function Vt(t,e,n){return Array.isArray(e)?`${n}${t}: ${JSON.stringify(e)}`:e&&typeof e=="object"?`${n}${t}:
|
|
12
|
-
${K(e,`${n} `)}`:`${n}${t}: ${JSON.stringify(e)}`}var d
|
|
13
|
-
`):process.stderr.write(`[${
|
|
14
|
-
`))}function
|
|
15
|
-
`):process.stderr.write(`[${
|
|
16
|
-
`))}function Ee(t,e){x<=2&&(e!==void 0?process.stderr.write(`[${
|
|
17
|
-
`):process.stderr.write(`[${
|
|
18
|
-
`))}function Re(t,e){x<=3&&(e!==void 0?process.stderr.write(`[${
|
|
19
|
-
`):process.stderr.write(`[${
|
|
20
|
-
`))}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 Te=/^[A-Za-z0-9:._*-]{1,64}$/,Ae=/^[A-Za-z0-9_-][A-Za-z0-9 _-]{0,30}[A-Za-z0-9_-]$/,Ce=/^[0-9][0-9A-Za-z.+-]{0,40}$/;function ke(t){if(!t||typeof t!="object")throw new TypeError("requestContext must be an object");let e=Object.keys(t).filter(r=>r!=="surface"&&r!=="client");if(e.length>0)throw new TypeError(`requestContext does not accept: ${e.join(", ")}`);if(typeof t.surface!="string"||!Te.test(t.surface))throw new TypeError("requestContext.surface must match /^[A-Za-z0-9:._*-]{1,64}$/");if(t.client===void 0)return Object.freeze({surface:t.surface});let n=t.client;if(!n||typeof n!="object"||Object.keys(n).some(r=>r!=="name"&&r!=="version"))throw new TypeError("requestContext.client must be { name, version }");if(typeof n.name!="string"||!Ae.test(n.name))throw new TypeError("requestContext.client.name must be 2-32 characters of letters, digits, space, _ or -");if(typeof n.version!="string"||!Ce.test(n.version))throw new TypeError("requestContext.client.version must start with a digit, e.g. 1.2.3");return Object.freeze({surface:t.surface,client:Object.freeze({name:n.name,version:n.version})})}function Me(t){return t?{"X-Xeno-Surface":t.surface,...t.client?{"X-Xeno-Client":`${t.client.name}/${t.client.version}`}:{}}:{}}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}},M={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function _(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function _e(t={}){let e=Math.max(0,t.maxRetries??_("XENO_API_MAX_RETRIES",M.maxRetries)),n=Math.max(50,t.baseDelayMs??_("XENO_API_BASE_DELAY_MS",M.baseDelayMs)),r=Math.max(n,t.maxDelayMs??_("XENO_API_MAX_DELAY_MS",M.maxDelayMs)),o=Math.max(0,t.jitterMs??_("XENO_API_RETRY_JITTER_MS",M.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function Se(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 nt(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function $e(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 nt(n)?{statusCode:429}:{}}var v="408|425|429|500|502|503|504";function rt(t){let e=new RegExp(`(?:\\bstatus(?:[ _-]?code)?\\b\\s*[=:]?\\s*|\\bhttp\\b\\s*|\\bapi\\b\\s*|\\bcode\\b\\s*[=:]\\s*|\\berror\\b\\s*)(?:${v})\\b`,"i"),n=new RegExp(`\\b(?:${v})\\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*(?:${v})\\b`);return e.test(t)||n.test(t)||r.test(t)}function ot(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:rt(t.message)?!0:nt(t.message)||$e(t.message.toLowerCase())}return!1}function ve(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function Ne(t,e={}){let n=_e(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw ve(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):ot(i))||o===n.maxRetries)throw i;let l=N(i),c=Se(o,l,n),f=e.getDelayMs?.(i,o,c),E=typeof f=="number"&&f>=0?f:c;await new Promise(R=>setTimeout(R,E))}throw r}var it=(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))},st=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:it,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 Oe(t,e,n=st){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function at(t){return t?Math.ceil(t.length/4):0}function Le(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 Be(t,e){return at(t)<=e}function Pe(t,e){return Math.max(0,e-t)}var Ie={"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 De(t,e,n){let r=Ie[t];return r?e/1e6*r.input+n/1e6*r.output:0}function Fe(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var ut=require("node:child_process");function je(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,ut.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 ft(t){return t.replace(/\\/g,"/").toLowerCase()}var We=["golden","solution","answer","expected"],qe=["expected","golden","reference","answer","answers"],Xe=new Set([";","&&","||","|"]);function lt(t){return ft(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function ze(t){return We.some(e=>t.includes(e))}function ct(t){return qe.some(e=>t.includes(e))}function dt(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 He(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(S).filter(e=>e.length>0)??[]}function pt(t){let e=lt(t),n=dt(e.at(-1)??"");return ct(n)||e.some(r=>ct(r))}function mt(t){let e=ft(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 Je(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function Ye(t){let e=He(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 l=e[s];if(!l||Xe.has(l))break;l!=="--"&&(l.startsWith("-")||o.push(l))}if(o.length<2)continue;let i=o.at(-1);if(mt(i)){for(let s of o.slice(0,-1))if(Je(s)&&pt(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function Ue(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)&&pt(o)&&mt(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function O(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function L(t){let e=lt(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=dt(e.at(-1)??"");return e.includes("tests")&&ze(n)}function Ge(t){return O()?t.filter(e=>!L(e)):t}function Ke(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 Ze(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>L(e))}function Qe(t){if(!O())return null;let e=Ye(t)??Ue(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(`
|
|
21
|
-
`):null}function Ve(t){return/^data:([^;,]+)[;,]/i.exec(t.trim())?.[1]}function
|
|
12
|
+
${K(e,`${n} `)}`:`${n}${t}: ${JSON.stringify(e)}`}var d=v(require("path"),1);function Z(t,e){let n=d.resolve(t),r=d.resolve(t,e);return r===n?!0:n===d.parse(n).root?r.startsWith(n):r.startsWith(n+d.sep)}function te(t,e){if(d.isAbsolute(e))return d.resolve(e);if(!Z(t,e))throw new Error(`PathSecurity: Path traversal attempt detected: ${e}`);return d.resolve(t,e)}function ee(t,e=process.platform){let n=d.resolve(t);return e==="win32"?n.toLowerCase():n}var p=require("node:os"),Q=require("node:child_process"),h=require("node:path"),A=(0,p.platform)(),V=A==="win32",ne=A==="darwin",re=A==="linux",oe=(0,p.release)(),ie=(0,p.homedir)();function se(){let t=process.env.XENO_AGENT_HOME?.trim();return t?(0,h.resolve)(t):(0,h.resolve)((0,p.homedir)(),".xeno-agent")}function ae(){let t=process.env.XENO_CONFIG_DIR?.trim();return t?(0,h.resolve)(t):(0,h.resolve)((0,p.homedir)(),".xeno-code")}function ue(t){return(0,h.resolve)(t,".xeno-code")}function ce(){return V?"powershell":process.env.SHELL?.split("/").pop()??"bash"}function le(t){try{return(0,Q.execSync)("git rev-parse --is-inside-work-tree",{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function fe(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 de(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 pe(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 ge(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 tt(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 me(t,e,n=5e3){let r=tt(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 he(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 et=(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))(et||{}),x=1;function xe(t){x=t}function ye(){return x}function g(){return new Date().toISOString()}function be(t,e){x<=0&&(e!==void 0?process.stderr.write(`[${g()}] DEBUG: ${t} ${k(e)}
|
|
13
|
+
`):process.stderr.write(`[${g()}] DEBUG: ${t}
|
|
14
|
+
`))}function we(t,e){x<=1&&(e!==void 0?process.stderr.write(`[${g()}] INFO: ${t} ${k(e)}
|
|
15
|
+
`):process.stderr.write(`[${g()}] INFO: ${t}
|
|
16
|
+
`))}function Ee(t,e){x<=2&&(e!==void 0?process.stderr.write(`[${g()}] WARN: ${t} ${k(e)}
|
|
17
|
+
`):process.stderr.write(`[${g()}] WARN: ${t}
|
|
18
|
+
`))}function Re(t,e){x<=3&&(e!==void 0?process.stderr.write(`[${g()}] ERROR: ${t} ${k(e)}
|
|
19
|
+
`):process.stderr.write(`[${g()}] ERROR: ${t}
|
|
20
|
+
`))}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 Te=/^[A-Za-z0-9:._*-]{1,64}$/,Ce=/^[A-Za-z0-9_-][A-Za-z0-9 _-]{0,30}[A-Za-z0-9_-]$/,Ae=/^[0-9][0-9A-Za-z.+-]{0,40}$/;function ke(t){if(!t||typeof t!="object")throw new TypeError("requestContext must be an object");let e=Object.keys(t).filter(r=>r!=="surface"&&r!=="client");if(e.length>0)throw new TypeError(`requestContext does not accept: ${e.join(", ")}`);if(typeof t.surface!="string"||!Te.test(t.surface))throw new TypeError("requestContext.surface must match /^[A-Za-z0-9:._*-]{1,64}$/");if(t.client===void 0)return Object.freeze({surface:t.surface});let n=t.client;if(!n||typeof n!="object"||Object.keys(n).some(r=>r!=="name"&&r!=="version"))throw new TypeError("requestContext.client must be { name, version }");if(typeof n.name!="string"||!Ce.test(n.name))throw new TypeError("requestContext.client.name must be 2-32 characters of letters, digits, space, _ or -");if(typeof n.version!="string"||!Ae.test(n.version))throw new TypeError("requestContext.client.version must start with a digit, e.g. 1.2.3");return Object.freeze({surface:t.surface,client:Object.freeze({name:n.name,version:n.version})})}function Me(t){return t?{"X-Xeno-Surface":t.surface,...t.client?{"X-Xeno-Client":`${t.client.name}/${t.client.version}`}:{}}:{}}var w=class extends Error{statusCode;body;retryAfterMs;requestId;cfRay;constructor(e,n={}){super(e,n.cause!==void 0?{cause:n.cause}:void 0),this.name="ApiTransientError",this.statusCode=n.statusCode,this.retryAfterMs=n.retryAfterMs,this.requestId=n.requestId,this.cfRay=n.cfRay;for(let r of["code","category","retryable","providerCode","remedy"])n[r]!==void 0&&Object.defineProperty(this,r,{value:n[r],enumerable:!0,configurable:!0,writable:!1})}},M={maxRetries:3,baseDelayMs:1e3,maxDelayMs:3e4,jitterMs:300};function _(t,e){let n=process.env[t],r=n?Number.parseInt(n,10):Number.NaN;return!Number.isFinite(r)||r<0?e:r}function _e(t={}){let e=Math.max(0,t.maxRetries??_("XENO_API_MAX_RETRIES",M.maxRetries)),n=Math.max(50,t.baseDelayMs??_("XENO_API_BASE_DELAY_MS",M.baseDelayMs)),r=Math.max(n,t.maxDelayMs??_("XENO_API_MAX_DELAY_MS",M.maxDelayMs)),o=Math.max(0,t.jitterMs??_("XENO_API_RETRY_JITTER_MS",M.jitterMs));return{maxRetries:e,baseDelayMs:n,maxDelayMs:r,jitterMs:o}}function Se(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 nt(t){let e=t.toLowerCase();return e.includes("rate limit")||e.includes("too many requests")||e.includes("429")}function ve(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 w)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 nt(n)?{statusCode:429}:{}}var $="408|425|429|500|502|503|504";function rt(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 ot(t){if(t&&typeof t=="object"&&"retryable"in t)return t.retryable===!0;if(t instanceof w){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:rt(t.message)?!0:nt(t.message)||ve(t.message.toLowerCase())}return!1}function $e(t){if(t.onAbort)return t.onAbort();let e=new Error("The operation was aborted");return e.name="AbortError",e}async function Ne(t,e={}){let n=_e(e),r;for(let o=0;o<=n.maxRetries;o++)try{if(e.signal?.aborted)throw $e(e);return e.onBeforeAttempt?.(o),await t()}catch(i){if(r=i,!(e.shouldRetry?e.shouldRetry(i,o):ot(i))||o===n.maxRetries)throw i;let f=N(i),c=Se(o,f,n),l=e.getDelayMs?.(i,o,c),E=typeof l=="number"&&l>=0?l:c;await new Promise(R=>setTimeout(R,E))}throw r}var it=(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))},st=Object.freeze({id:"xeno-conservative-v1",source:"estimated",countText:it,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 Oe(t,e,n=st){return{tokens:Math.max(0,Math.ceil(n.countText(t,e))),source:n.source,adapterId:n.id}}function at(t){return t?Math.ceil(t.length/4):0}function Le(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 Be(t,e){return at(t)<=e}function Pe(t,e){return Math.max(0,e-t)}var Ie={"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 De(t,e,n){let r=Ie[t];return r?e/1e6*r.input+n/1e6*r.output:0}function Fe(t){return t<=0?"$0.00":t<.001?"<$0.001":t<.01?`$${t.toFixed(4)}`:t<1?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var ut=require("node:child_process");function je(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,ut.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 lt(t){return t.replace(/\\/g,"/").toLowerCase()}var We=["golden","solution","answer","expected"],qe=["expected","golden","reference","answer","answers"],Xe=new Set([";","&&","||","|"]);function ft(t){return lt(t).replace(/^\.\/+/,"").split("/").map(e=>e.trim()).filter(e=>e.length>0)}function ze(t){return We.some(e=>t.includes(e))}function ct(t){return qe.some(e=>t.includes(e))}function dt(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 He(t){return t.match(/"[^"]*"|'[^']*'|&&|\|\||[;|]|[^\s;|&]+/g)?.map(S).filter(e=>e.length>0)??[]}function pt(t){let e=ft(t),n=dt(e.at(-1)??"");return ct(n)||e.some(r=>ct(r))}function gt(t){let e=lt(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 Je(t){return/[\\/]/.test(t)||/\.[A-Za-z0-9]{1,8}$/.test(t)}function Ye(t){let e=He(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 f=e[s];if(!f||Xe.has(f))break;f!=="--"&&(f.startsWith("-")||o.push(f))}if(o.length<2)continue;let i=o.at(-1);if(gt(i)){for(let s of o.slice(0,-1))if(Je(s)&&pt(s))return{sourcePath:s,destinationPath:i,operation:r}}}return null}function Ue(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)&&pt(o)&>(i))return{sourcePath:o,destinationPath:i,operation:n.source.startsWith("\\bdd")?"dd":"redirect"}}return null}function O(){return process.env.XENO_BENCHMARK_MODE?.trim().toLowerCase()==="terminal-bench"}function L(t){let e=ft(t);if(e.includes("solution")||e.includes("xeno-audit")||e.includes(".xeno")&&e.includes("audit"))return!0;let n=dt(e.at(-1)??"");return e.includes("tests")&&ze(n)}function Ge(t){return O()?t.filter(e=>!L(e)):t}function Ke(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 Ze(t){return t.split(/[\s"'`;|&]+/).map(e=>e.trim()).filter(e=>e.length>0&&/[\\/]/.test(e)).some(e=>L(e))}function Qe(t){if(!O())return null;let e=Ye(t)??Ue(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(`
|
|
21
|
+
`):null}function Ve(t){return/^data:([^;,]+)[;,]/i.exec(t.trim())?.[1]}function mt(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 ${Ve(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(`
|
|
22
22
|
|
|
23
|
-
`).trim()}function ht(t){let e=t.trim();return e.length>0?[{type:"text",text:e}]:[]}function tn(t){return typeof t=="string"?t:
|
|
23
|
+
`).trim()}function ht(t){let e=t.trim();return e.length>0?[{type:"text",text:e}]:[]}function tn(t){return typeof t=="string"?t:mt(t)}function xt(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(`
|
|
24
24
|
`)}function en(t){let e=t.assistant_content&&t.assistant_content.length>0?t.assistant_content:typeof t.content=="string"?ht(t.content):t.content,n=t.assistant_only_content??[],r=nn(t),o=[...e,...n,...r?[r]:[]];return o.length>0?o:t.content}function nn(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(`
|
|
25
25
|
`)}}function rn(t){return Array.isArray(t)&&t.some(e=>e.type!=="text")}function on(t){return typeof t=="string"?ht(t):t}function sn(t,e){return{type:"tool_result",tool_use_id:t,content:xt(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 an(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,hasMixedLineEndings,hasNonTextToolResultContent,hasTransientStatusMention,info,isBenchmarkLeakPath,isBenchmarkMode,isGitRepo,isPathSafe,isRetryableError,listDirs,listFiles,normalizeLineEndings,normalizeXenoRequestContext,parseDocument,parseJsonLines,pathIdentityKey,readFileSafe,readIfExists,readTextFile,remainingBudget,renameReplacingWithRetry,safeJsonParse,safeJsonStringify,safeRegexTest,safeResolvePath,setLogLevel,stringifyDocument,toTransportAssistantBlocks,toolAssistantContentToText,toolResultContentToText,truncateToTokens,validateRegexPattern,validateRequired,warn,withRetry,writeAtomic,writeTextFile,xenoRequestContextHeaders});
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -105,13 +105,26 @@ interface RetryErrorContext {
|
|
|
105
105
|
requestId?: string;
|
|
106
106
|
cfRay?: string;
|
|
107
107
|
}
|
|
108
|
+
interface ApiTransientErrorClassification {
|
|
109
|
+
code?: string;
|
|
110
|
+
category?: string;
|
|
111
|
+
retryable?: boolean;
|
|
112
|
+
providerCode?: string;
|
|
113
|
+
remedy?: string;
|
|
114
|
+
cause?: unknown;
|
|
115
|
+
}
|
|
108
116
|
declare class ApiTransientError extends Error {
|
|
109
117
|
readonly statusCode?: number;
|
|
110
118
|
readonly body?: string;
|
|
111
119
|
readonly retryAfterMs?: number;
|
|
112
120
|
readonly requestId?: string;
|
|
113
121
|
readonly cfRay?: string;
|
|
114
|
-
|
|
122
|
+
readonly code?: string;
|
|
123
|
+
readonly category?: string;
|
|
124
|
+
readonly retryable?: boolean;
|
|
125
|
+
readonly providerCode?: string;
|
|
126
|
+
readonly remedy?: string;
|
|
127
|
+
constructor(message: string, context?: RetryErrorContext & ApiTransientErrorClassification);
|
|
115
128
|
}
|
|
116
129
|
declare function getRetryErrorContext(error: unknown): RetryErrorContext;
|
|
117
130
|
declare function hasTransientStatusMention(message: string): boolean;
|
|
@@ -299,4 +312,4 @@ interface XenoAsciiControlCharacterPolicy {
|
|
|
299
312
|
allowLineBreaks?: boolean;
|
|
300
313
|
}
|
|
301
314
|
declare function hasDisallowedAsciiControlCharacter(value: string, policy?: XenoAsciiControlCharacterPolicy): boolean;
|
|
302
|
-
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, type XenoRequestContext, 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, hasMixedLineEndings, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, normalizeXenoRequestContext, parseDocument, parseJsonLines, pathIdentityKey, readFileSafe, readIfExists, readTextFile, remainingBudget, renameReplacingWithRetry, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile, xenoRequestContextHeaders };
|
|
315
|
+
export { ApiTransientError, type ApiTransientErrorClassification, 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, type XenoRequestContext, 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, hasMixedLineEndings, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, normalizeXenoRequestContext, parseDocument, parseJsonLines, pathIdentityKey, readFileSafe, readIfExists, readTextFile, remainingBudget, renameReplacingWithRetry, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile, xenoRequestContextHeaders };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -105,13 +105,26 @@ interface RetryErrorContext {
|
|
|
105
105
|
requestId?: string;
|
|
106
106
|
cfRay?: string;
|
|
107
107
|
}
|
|
108
|
+
interface ApiTransientErrorClassification {
|
|
109
|
+
code?: string;
|
|
110
|
+
category?: string;
|
|
111
|
+
retryable?: boolean;
|
|
112
|
+
providerCode?: string;
|
|
113
|
+
remedy?: string;
|
|
114
|
+
cause?: unknown;
|
|
115
|
+
}
|
|
108
116
|
declare class ApiTransientError extends Error {
|
|
109
117
|
readonly statusCode?: number;
|
|
110
118
|
readonly body?: string;
|
|
111
119
|
readonly retryAfterMs?: number;
|
|
112
120
|
readonly requestId?: string;
|
|
113
121
|
readonly cfRay?: string;
|
|
114
|
-
|
|
122
|
+
readonly code?: string;
|
|
123
|
+
readonly category?: string;
|
|
124
|
+
readonly retryable?: boolean;
|
|
125
|
+
readonly providerCode?: string;
|
|
126
|
+
readonly remedy?: string;
|
|
127
|
+
constructor(message: string, context?: RetryErrorContext & ApiTransientErrorClassification);
|
|
115
128
|
}
|
|
116
129
|
declare function getRetryErrorContext(error: unknown): RetryErrorContext;
|
|
117
130
|
declare function hasTransientStatusMention(message: string): boolean;
|
|
@@ -299,4 +312,4 @@ interface XenoAsciiControlCharacterPolicy {
|
|
|
299
312
|
allowLineBreaks?: boolean;
|
|
300
313
|
}
|
|
301
314
|
declare function hasDisallowedAsciiControlCharacter(value: string, policy?: XenoAsciiControlCharacterPolicy): boolean;
|
|
302
|
-
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, type XenoRequestContext, 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, hasMixedLineEndings, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, normalizeXenoRequestContext, parseDocument, parseJsonLines, pathIdentityKey, readFileSafe, readIfExists, readTextFile, remainingBudget, renameReplacingWithRetry, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile, xenoRequestContextHeaders };
|
|
315
|
+
export { ApiTransientError, type ApiTransientErrorClassification, 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, type XenoRequestContext, 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, hasMixedLineEndings, hasNonTextToolResultContent, hasTransientStatusMention, info, isBenchmarkLeakPath, isBenchmarkMode, isGitRepo, isPathSafe, isRetryableError, listDirs, listFiles, normalizeLineEndings, normalizeXenoRequestContext, parseDocument, parseJsonLines, pathIdentityKey, readFileSafe, readIfExists, readTextFile, remainingBudget, renameReplacingWithRetry, safeJsonParse, safeJsonStringify, safeRegexTest, safeResolvePath, setLogLevel, stringifyDocument, toTransportAssistantBlocks, toolAssistantContentToText, toolResultContentToText, truncateToTokens, validateRegexPattern, validateRequired, warn, withRetry, writeAtomic, writeTextFile, xenoRequestContextHeaders };
|