@xenosystem/agent-sdk 0.10.5 → 0.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coordination/index.cjs +2 -2
- package/dist/coordination/index.d.cts +4 -2
- package/dist/coordination/index.d.ts +4 -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 +2 -2
- package/dist/electron/index.js +2 -2
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/index.cjs +219 -219
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +217 -217
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/index.cjs +6 -6
- package/dist/providers/index.js +6 -6
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/workforce/index.cjs +1 -1
- package/dist/workforce/index.d.cts +131 -1
- package/dist/workforce/index.d.ts +131 -1
- package/dist/workforce/index.js +1 -1
- package/dist/workforce/metafile-cjs.json +1 -1
- package/dist/workforce/metafile-esm.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/config/models.ts":{"bytes":16323,"imports":[],"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/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":
|
|
1
|
+
{"inputs":{"src/config/models.ts":{"bytes":16323,"imports":[],"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/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":55136,"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/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/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":8269,"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/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":1627,"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/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:fs/promises","kind":"require-call","external":true},{"path":"node:path","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":976},"src/config/models.ts":{"bytesInOutput":50},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":5733},"src/providers/direct-provider.ts":{"bytesInOutput":25786},"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/quota.ts":{"bytesInOutput":3435},"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":3788},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1067},"src/providers/quota-store.ts":{"bytesInOutput":8105}},"bytes":106426}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/config/models.ts":{"bytes":16323,"imports":[],"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/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":55008,"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/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/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":8269,"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/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":1627,"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/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:fs/promises","kind":"import-statement","external":true},{"path":"node:path","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","ProviderError","QuotaAcknowledgementError","QuotaError","ToolSchemaProjectionError","XENO_PROVIDER_CATALOG_SCHEMA_VERSION","XENO_PROVIDER_CONNECTION_STORE_SCHEMA_VERSION","XenoProviderCatalog","assertDirectEndpointResolution","classifyProviderHttpError","createDirectProvider","createOllamaNativeProvider","createQuotaGovernedProvider","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":50},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":5733},"src/providers/index.ts":{"bytesInOutput":0},"src/providers/direct-provider.ts":{"bytesInOutput":25643},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6167},"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/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":3787},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1054},"src/providers/quota-store.ts":{"bytesInOutput":8082}},"bytes":104898}}}
|
|
1
|
+
{"inputs":{"src/config/models.ts":{"bytes":16323,"imports":[],"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/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":55136,"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/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/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":8269,"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/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":1627,"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/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:fs/promises","kind":"import-statement","external":true},{"path":"node:path","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","ProviderError","QuotaAcknowledgementError","QuotaError","ToolSchemaProjectionError","XENO_PROVIDER_CATALOG_SCHEMA_VERSION","XENO_PROVIDER_CONNECTION_STORE_SCHEMA_VERSION","XenoProviderCatalog","assertDirectEndpointResolution","classifyProviderHttpError","createDirectProvider","createOllamaNativeProvider","createQuotaGovernedProvider","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":50},"src/core/llm-provider.ts":{"bytesInOutput":1142},"src/providers/DualLLMProvider.ts":{"bytesInOutput":5733},"src/providers/index.ts":{"bytesInOutput":0},"src/providers/direct-provider.ts":{"bytesInOutput":25751},"src/utils/tool-result-content.ts":{"bytesInOutput":436},"src/providers/bounded-provider-transport.ts":{"bytesInOutput":6167},"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/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":3787},"src/artifacts/hash.ts":{"bytesInOutput":564},"src/control-plane/lock.ts":{"bytesInOutput":1054},"src/providers/quota-store.ts":{"bytesInOutput":8082}},"bytes":105006}}}
|
package/dist/workforce/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var N=(r,t)=>{for(var e in t)S(r,e,{get:t[e],enumerable:!0})},z=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!j.call(r,s)&&s!==e&&S(r,s,{get:()=>t[s],enumerable:!(i=O(t,s))||i.enumerable});return r};var C=r=>z(S({},"__esModule",{value:!0}),r);var B={};N(B,{RUN_LEASE_MAX_SECONDS:()=>I,RUN_LEASE_SKEW_SECONDS:()=>_,RunAuthorityRefusedError:()=>v,RunStepRefused:()=>c,createWorkforceRunAuthority:()=>H,verifyWorkforceRunLease:()=>R});module.exports=C(B);var A=require("node:crypto"),$="/api/workforce/run-admissions/authorize-step",U="/api/oauth2/jwks",I=60,_=5,D="xeno-run-lease+jwt",K=1e4,q=65536,c=class extends Error{constructor(e){super(`run step refused: ${e}`);this.reason=e;this.name="RunStepRefused",this.details={reason:e}}reason;details};function R(r,t){let e=y=>({valid:!1,reason:y}),i=typeof r=="string"?r.split("."):[];if(i.length!==3)return e("malformed");let s,n;try{s=JSON.parse(Buffer.from(i[0],"base64url").toString("utf8")),n=JSON.parse(Buffer.from(i[1],"base64url").toString("utf8"))}catch{return e("malformed")}if(s.alg!=="ES256"||s.typ!==D)return e("wrong_type");if(!t.publicKey)return e("unknown_key");if(!(0,A.verify)("sha256",Buffer.from(`${i[0]}.${i[1]}`),{key:t.publicKey,dsaEncoding:"ieee-p1363"},Buffer.from(i[2],"base64url")))return e("bad_signature");if(n.iss!=="xeno-platform"||n.aud!=="xeno-run-runtime"||n.sub!==t.admissionId)return e("wrong_subject");if(!Number.isSafeInteger(n.iat)||!Number.isSafeInteger(n.exp)||n.exp<=n.iat||n.exp-n.iat>I)return e("unbounded");if(!Array.isArray(n.caps)||!n.caps.every(y=>typeof y=="string"))return e("malformed");let p;try{p=BigInt(n.seq)}catch{return e("malformed")}if(p<t.minSequence)return e("superseded");if(t.nowWallMs/1e3>=n.exp-_)return e("expired");if(t.receivedAtMono===null)return e("requires_online_reauthorization");let d=(t.nowMono-t.receivedAtMono)/1e3;return d<0?e("requires_online_reauthorization"):d>=n.exp-n.iat-_?e("expired"):{valid:!0,sequence:p,claims:n}}async function W(r,t){let e=r.headers.get("content-length");if(e!==null&&(!/^\d+$/.test(e)||Number(e)>q))throw new Error("response too large");if(!r.body)return null;let i=r.body.getReader(),s=[],n=0;try{for(;;){let{done:d,value:y}=await i.read();if(t.aborted)throw new Error("response did not complete before the deadline");if(d)break;if(n+=y.byteLength,n>q)throw new Error("response too large");s.push(y)}}finally{try{i.releaseLock()}catch{}}let h=new Uint8Array(n),p=0;for(let d of s)h.set(d,p),p+=d.byteLength;return h.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(h)):null}function H(r){let t=r.fetchImpl??globalThis.fetch,e=r.clock??{wallMs:()=>Date.now(),monoMs:()=>performance.now()},i=r.admissionId;if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i))throw new Error("invalid admission id");let s;try{s=new URL(r.issuer)}catch{throw new Error("invalid issuer")}if(s.protocol!=="https:"||s.pathname!=="/"||s.username||s.password||s.search||s.hash)throw new Error("invalid issuer");let n=s.origin,h=new Map,p=new Map,d=null,y=async(o,a,l)=>{let u=`${n}${a}`,m=new AbortController,f=setTimeout(()=>m.abort(),K);f.unref?.();try{let g=null;if(o==="POST"&&(g=await r.authorizeRequest({method:o,url:u}),!g))throw new c("authority_unavailable");let k=await t(u,{method:o,redirect:"error",signal:m.signal,headers:{accept:"application/json",...l?{"content-type":"application/json"}:{},...g?{authorization:g.authorization,...g.dpop?{dpop:g.dpop}:{}}:{}},...l?{body:JSON.stringify(l)}:{}});return{status:k.status,json:await W(k,m.signal)}}finally{clearTimeout(f)}},x=async o=>{if(h.has(o))return h.get(o);let{status:a,json:l}=await y("GET",U);if(a!==200||!l||typeof l!="object"||!Array.isArray(l.keys))return null;for(let u of l.keys)if(!(typeof u.kid!="string"||u.kty!=="EC"||u.crv!=="P-256"))try{h.set(u.kid,(0,A.createPublicKey)({key:{kty:"EC",crv:"P-256",x:u.x,y:u.y},format:"jwk"}))}catch{}return h.get(o)??null},E=()=>r.sequenceStore.read(i)??0n,M=(o,a)=>`${o}:${a??""}`,L=async o=>{let a=JSON.parse(Buffer.from(o.token.split(".")[0],"base64url").toString("utf8")).kid;return R(o.token,{publicKey:await x(a),admissionId:i,receivedAtMono:o.receivedAtMono,nowMono:e.monoMs(),nowWallMs:e.wallMs(),minSequence:E()}).valid},T=async(o,a,l)=>{if(l.throwIfAborted(),d)throw new c(d);let u=p.get(M(o,a));if(u&&await L(u).catch(()=>!1))return;let m;try{m=await y("POST",$,{admissionId:i,operation:o,...a?{capability:a}:{}})}catch(b){throw b instanceof c?b:new c("authority_unavailable")}let f=m.json;if(m.status!==200||f?.success!==!0||typeof f.token!="string"){let b=typeof f?.details?.reason=="string"&&/^[a-z_]{1,64}$/.test(f.details.reason)?f.details.reason:"authority_unavailable";throw b==="admission_revoked"&&(d=b),new c(b)}let g=e.monoMs(),k=(()=>{try{return JSON.parse(Buffer.from(f.token.split(".")[0],"base64url").toString("utf8"))}catch{return null}})();if(typeof k?.kid!="string")throw new c("authority_unavailable");let w=R(f.token,{publicKey:await x(k.kid).catch(()=>null),admissionId:i,receivedAtMono:g,nowMono:e.monoMs(),nowWallMs:e.wallMs(),minSequence:E()});if(!w.valid)throw new c("authority_unavailable");if(o==="privileged_call"&&w.claims.cap!==a)throw new c("authority_unavailable");await r.sequenceStore.write(i,w.sequence),p.set(M(o,a),{token:f.token,sequence:w.sequence,operation:o,capability:a,capabilities:w.claims.caps,iat:w.claims.iat,exp:w.claims.exp,receivedAtMono:g})};return{authorizeDispatch:(o,a)=>T("provider_dispatch",null,a),authorizeToolCall:(o,a)=>{let l=r.capabilityForTool(o.toolName);return l===null||!/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/.test(l)?Promise.reject(new c("capability_not_admitted")):T("privileged_call",l,a)}}}var v=class extends Error{code="RUN_AUTHORITY_REFUSED";retryable=!1;reason;step;constructor(t,e,i){super(`Run authority refused the ${t==="dispatch"?"provider dispatch":"tool call"}: ${e}`,i),this.name="RunAuthorityRefusedError",this.reason=e,this.step=t}};0&&(module.exports={RUN_LEASE_MAX_SECONDS,RUN_LEASE_SKEW_SECONDS,RunAuthorityRefusedError,RunStepRefused,createWorkforceRunAuthority,verifyWorkforceRunLease});
|
|
1
|
+
"use strict";var O=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var D=(e,r)=>{for(var n in r)O(e,n,{get:r[n],enumerable:!0})},J=(e,r,n,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of H(r))!V.call(e,o)&&o!==n&&O(e,o,{get:()=>r[o],enumerable:!(c=z(r,o))||c.enumerable});return e};var K=e=>J(O({},"__esModule",{value:!0}),e);var le={};D(le,{RUN_LEASE_MAX_SECONDS:()=>N,RUN_LEASE_SKEW_SECONDS:()=>C,RunAuthorityRefusedError:()=>P,RunStepRefused:()=>w,WorkforceAdmissionRefused:()=>m,createWorkforceRunAdmissionClient:()=>ce,createWorkforceRunAuthority:()=>X,verifyWorkforceRunLease:()=>W});module.exports=K(le);var L=require("node:crypto"),q="/api/workforce/run-admissions/authorize-step",B="/api/oauth2/jwks",N=60,C=5,Y="xeno-run-lease+jwt",Z=1e4,j=65536,w=class extends Error{constructor(n){super(`run step refused: ${n}`);this.reason=n;this.name="RunStepRefused",this.details={reason:n}}reason;details};function W(e,r){let n=s=>({valid:!1,reason:s}),c=typeof e=="string"?e.split("."):[];if(c.length!==3)return n("malformed");let o,l;try{o=JSON.parse(Buffer.from(c[0],"base64url").toString("utf8")),l=JSON.parse(Buffer.from(c[1],"base64url").toString("utf8"))}catch{return n("malformed")}if(o.alg!=="ES256"||o.typ!==Y)return n("wrong_type");if(!r.publicKey)return n("unknown_key");if(!(0,L.verify)("sha256",Buffer.from(`${c[0]}.${c[1]}`),{key:r.publicKey,dsaEncoding:"ieee-p1363"},Buffer.from(c[2],"base64url")))return n("bad_signature");if(l.iss!=="xeno-platform"||l.aud!=="xeno-run-runtime"||l.sub!==r.admissionId)return n("wrong_subject");if(!Number.isSafeInteger(l.iat)||!Number.isSafeInteger(l.exp)||l.exp<=l.iat||l.exp-l.iat>N)return n("unbounded");if(!Array.isArray(l.caps)||!l.caps.every(s=>typeof s=="string"))return n("malformed");let d;try{d=BigInt(l.seq)}catch{return n("malformed")}if(d<r.minSequence)return n("superseded");if(r.nowWallMs/1e3>=l.exp-C)return n("expired");if(r.receivedAtMono===null)return n("requires_online_reauthorization");let i=(r.nowMono-r.receivedAtMono)/1e3;return i<0?n("requires_online_reauthorization"):i>=l.exp-l.iat-C?n("expired"):{valid:!0,sequence:d,claims:l}}async function F(e,r){let n=e.headers.get("content-length");if(n!==null&&(!/^\d+$/.test(n)||Number(n)>j))throw new Error("response too large");if(!e.body)return null;let c=e.body.getReader(),o=[],l=0;try{for(;;){let{done:i,value:s}=await c.read();if(r.aborted)throw new Error("response did not complete before the deadline");if(i)break;if(l+=s.byteLength,l>j)throw new Error("response too large");o.push(s)}}finally{try{c.releaseLock()}catch{}}let t=new Uint8Array(l),d=0;for(let i of o)t.set(i,d),d+=i.byteLength;return t.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t)):null}function X(e){let r=e.fetchImpl??globalThis.fetch,n=e.clock??{wallMs:()=>Date.now(),monoMs:()=>performance.now()},c=e.admissionId;if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(c))throw new Error("invalid admission id");let o;try{o=new URL(e.issuer)}catch{throw new Error("invalid issuer")}if(o.protocol!=="https:"||o.pathname!=="/"||o.username||o.password||o.search||o.hash)throw new Error("invalid issuer");let l=o.origin,t=new Map,d=new Map,i=null,s=async(a,f,u)=>{let p=`${l}${f}`,R=new AbortController,b=setTimeout(()=>R.abort(),Z);b.unref?.();try{let I=null;if(a==="POST"&&(I=await e.authorizeRequest({method:a,url:p}),!I))throw new w("authority_unavailable");let M=await r(p,{method:a,redirect:"error",signal:R.signal,headers:{accept:"application/json",...u?{"content-type":"application/json"}:{},...I?{authorization:I.authorization,...I.dpop?{dpop:I.dpop}:{}}:{}},...u?{body:JSON.stringify(u)}:{}});return{status:M.status,json:await F(M,R.signal)}}finally{clearTimeout(b)}},h=async a=>{if(t.has(a))return t.get(a);let{status:f,json:u}=await s("GET",B);if(f!==200||!u||typeof u!="object"||!Array.isArray(u.keys))return null;for(let p of u.keys)if(!(typeof p.kid!="string"||p.kty!=="EC"||p.crv!=="P-256"))try{t.set(p.kid,(0,L.createPublicKey)({key:{kty:"EC",crv:"P-256",x:p.x,y:p.y},format:"jwk"}))}catch{}return t.get(a)??null},A=()=>e.sequenceStore.read(c)??0n,y=(a,f)=>`${a}:${f??""}`,_=async a=>{let f=JSON.parse(Buffer.from(a.token.split(".")[0],"base64url").toString("utf8")).kid;return W(a.token,{publicKey:await h(f),admissionId:c,receivedAtMono:a.receivedAtMono,nowMono:n.monoMs(),nowWallMs:n.wallMs(),minSequence:A()}).valid},k=async(a,f,u)=>{if(u.throwIfAborted(),i)throw new w(i);let p=d.get(y(a,f));if(p&&await _(p).catch(()=>!1))return;let R;try{R=await s("POST",q,{admissionId:c,operation:a,...f?{capability:f}:{}})}catch(T){throw T instanceof w?T:new w("authority_unavailable")}let b=R.json;if(R.status!==200||b?.success!==!0||typeof b.token!="string"){let T=typeof b?.details?.reason=="string"&&/^[a-z_]{1,64}$/.test(b.details.reason)?b.details.reason:"authority_unavailable";throw T==="admission_revoked"&&(i=T),new w(T)}let I=n.monoMs(),M=(()=>{try{return JSON.parse(Buffer.from(b.token.split(".")[0],"base64url").toString("utf8"))}catch{return null}})();if(typeof M?.kid!="string")throw new w("authority_unavailable");let v=W(b.token,{publicKey:await h(M.kid).catch(()=>null),admissionId:c,receivedAtMono:I,nowMono:n.monoMs(),nowWallMs:n.wallMs(),minSequence:A()});if(!v.valid)throw new w("authority_unavailable");if(a==="privileged_call"&&v.claims.cap!==f)throw new w("authority_unavailable");await e.sequenceStore.write(c,v.sequence),d.set(y(a,f),{token:b.token,sequence:v.sequence,operation:a,capability:f,capabilities:v.claims.caps,iat:v.claims.iat,exp:v.claims.exp,receivedAtMono:I})};return{authorizeDispatch:(a,f)=>k("provider_dispatch",null,f),authorizeToolCall:(a,f)=>{let u=e.capabilityForTool(a.toolName);return u===null||!/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/.test(u)?Promise.reject(new w("capability_not_admitted")):k("privileged_call",u,f)}}}var Q="/api/workforce/run-admissions",G="/api/workforce/run-admissions/revoke",ee="/api/workforce/run-admissions/authority",te="/api/workforce/run-admissions/pin";var S=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ne=/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/,$=/^[a-z_]{1,64}$/,re=new Set(["bad_input","denied","not_found","needs_approval","conflict","rate_limited","unavailable","timeout","internal"]),m=class extends Error{constructor(n,c,o={}){super(`workforce admission refused: ${n}/${c}`);this.code=n;this.reason=c;this.name="WorkforceAdmissionRefused",this.details={reason:c,...o}}code;reason;details},E=()=>new m("unavailable","authority_unavailable"),g=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),x=e=>Array.isArray(e)&&e.length<=64&&e.every(r=>typeof r=="string"&&ne.test(r));function oe(e){if(!g(e)||e.schemaVersion!==1||typeof e.admissionId!="string"||!S.test(e.admissionId)||typeof e.operationId!="string"||!S.test(e.operationId))return null;let r=e.agent;if(!g(r)||typeof r.resourceId!="string"||!S.test(r.resourceId)||!Number.isSafeInteger(r.version)||typeof r.contentHash!="string")return null;let n=e.capabilities;if(!g(n)||!x(n.effective)||!x(n.requested))return null;let c=e.payer;if(!g(c)||typeof c.kind!="string")return null;let o=e.budget;return!g(o)||typeof o.ceilingMicro!="string"||!/^[1-9][0-9]{0,17}$/.test(o.ceilingMicro)||!g(e.target)||typeof e.admittedAt!="string"||!Number.isFinite(Date.parse(e.admittedAt))?null:e}var ie=/^[0-9a-f]{64}$/;function se(e,r,n,c){if(!g(e)||e.schemaVersion!==1)return null;let o=e.agent;if(!g(o)||typeof o.resourceId!="string"||o.resourceId.toLowerCase()!==r||!Number.isSafeInteger(o.version)||o.version<1||typeof o.contentHash!="string"||!ie.test(o.contentHash)||!g(e.target)||JSON.stringify(Object.entries(e.target).map(([d,i])=>[d,typeof i=="string"?i.toLowerCase():i]).sort())!==JSON.stringify(Object.entries(n).map(([d,i])=>[d,typeof i=="string"?i.toLowerCase():i]).sort()))return null;let l=e.team;if(c?!g(l)||typeof l.teamId!="string"||l.teamId.toLowerCase()!==c:l!==null)return null;let t=e.terms;return!g(t)||!x(t.definition)||!x(t.target)?null:{schemaVersion:1,agent:{resourceId:r,version:o.version,contentHash:o.contentHash},target:{...n},team:c?{teamId:c}:null,terms:{definition:[...t.definition],target:[...t.target]}}}function U(e,r){return!g(e)||e.schemaVersion!==1||e.admissionId!==r||typeof e.revoked!="boolean"?null:{schemaVersion:1,admissionId:r,revoked:e.revoked,reason:typeof e.reason=="string"&&$.test(e.reason)?e.reason:null,revokedAt:typeof e.revokedAt=="string"?e.revokedAt:null,latestLeaseSequence:typeof e.latestLeaseSequence=="string"?e.latestLeaseSequence:null}}async function ae(e,r){let n=e.headers.get("content-length");if(n!==null&&(!/^\d+$/.test(n)||Number(n)>65536))throw new Error("response too large");if(!e.body)return null;let c=e.body.getReader(),o=[],l=0;try{for(;;){let{done:i,value:s}=await c.read();if(r.aborted)throw new Error("response did not complete before the deadline");if(i)break;if(l+=s.byteLength,l>65536)throw new Error("response too large");o.push(s)}}finally{try{c.releaseLock()}catch{}}let t=new Uint8Array(l),d=0;for(let i of o)t.set(i,d),d+=i.byteLength;return t.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t)):null}function ce(e){let r=e.fetchImpl??globalThis.fetch,n;try{n=new URL(e.issuer)}catch{throw new Error("invalid issuer")}if(n.protocol!=="https:"||n.pathname!=="/"||n.username||n.password||n.search||n.hash)throw new Error("invalid issuer");let c=n.origin,o=async(t,d,i)=>{let s=`${c}${t}`,h=new AbortController,A=()=>h.abort();i?.addEventListener("abort",A,{once:!0});let y=setTimeout(A,15e3);y.unref?.();try{i?.throwIfAborted();let _=await e.authorizeRequest({method:"POST",url:s});if(!_)throw E();let k,a;try{k=await r(s,{method:"POST",redirect:"error",signal:h.signal,headers:{accept:"application/json","content-type":"application/json",authorization:_.authorization,..._.dpop?{dpop:_.dpop}:{}},body:JSON.stringify(d)}),a=await ae(k,h.signal)}catch(p){throw i?.aborted?p:E()}if(k.status===200&&g(a)&&a.success===!0)return a;let f=g(a)&&typeof a.code=="string"&&re.has(a.code)?a.code:null,u=g(a)&&g(a.details)?a.details:null;throw f&&u&&u.schemaVersion===1&&typeof u.reason=="string"&&$.test(u.reason)?new m(f,u.reason,{...Number.isSafeInteger(u.currentVersion)?{currentVersion:u.currentVersion}:{},...typeof u.availableMicro=="string"&&/^[0-9]{1,20}$/.test(u.availableMicro)?{availableMicro:u.availableMicro}:{},...typeof u.field=="string"&&/^[a-zA-Z.]{1,64}$/.test(u.field)?{field:u.field}:{}}):f?new m(f,f==="denied"&&k.status===403&&g(a)&&typeof a.required_scope=="string"?"insufficient_scope":f):E()}finally{clearTimeout(y),i?.removeEventListener("abort",A)}},l=t=>{if(typeof t!="string"||!S.test(t))throw new m("bad_input","invalid_admission");return t.toLowerCase()};return{async admit(t,d){if(!S.test(t.operationId))throw new m("bad_input","invalid_operation");if(!x(t.capabilities))throw new m("bad_input","invalid_capabilities");if(t.runtimeCapabilities!==void 0&&!x(t.runtimeCapabilities))throw new m("bad_input","invalid_runtime_capabilities");if(!/^[1-9][0-9]{0,17}$/.test(t.budget?.ceilingMicro??""))throw new m("bad_input","invalid_budget_ceiling");let i={operationId:t.operationId,agent:{resourceId:t.agent.resourceId,version:t.agent.version,contentHash:t.agent.contentHash},target:{...t.target},capabilities:[...t.capabilities],budget:{ceilingMicro:t.budget.ceilingMicro},...t.expectedActorAccountId?{expectedActorAccountId:t.expectedActorAccountId}:{},...t.team?{team:{teamId:t.team.teamId}}:{},...t.conversationId?{conversationId:t.conversationId}:{},...t.root?{root:{bindingId:t.root.bindingId,installationId:t.root.installationId}}:{},...t.runtimeCapabilities?{runtimeCapabilities:[...t.runtimeCapabilities]}:{}},s=await o(Q,i,d),h=oe(s.admission);if(!h||h.operationId.toLowerCase()!==t.operationId.toLowerCase())throw E();return{admission:h,replayed:s.replayed===!0}},async revoke(t,d){let i=l(t),s=U(await o(G,{admissionId:i},d),i);if(!s||!s.revoked)throw E();return s},async pin(t,d){let i=t?.agent?.resourceId;if(typeof i!="string"||!S.test(i))throw new m("bad_input","invalid_agent_resource");let s=t.target,h=g(s)?s.kind==="personal"?[s.ownerUserId]:s.kind==="workspace"?[s.assignmentId]:s.kind==="project"?[s.projectId,s.participationId]:null:null;if(!h||!h.every(a=>typeof a=="string"&&S.test(a)))throw new m("bad_input","invalid_target");let A=s.kind==="personal"?{kind:"personal",ownerUserId:s.ownerUserId}:s.kind==="workspace"?{kind:"workspace",assignmentId:s.assignmentId}:{kind:"project",projectId:s.projectId,participationId:s.participationId},y=t.team?t.team.teamId:null;if(y!==null&&(typeof y!="string"||!S.test(y)))throw new m("bad_input","invalid_team");let _={agent:{resourceId:i},target:A,...y?{team:{teamId:y}}:{},...t.expectedActorAccountId?{expectedActorAccountId:t.expectedActorAccountId}:{}},k=se(await o(te,_,d),i.toLowerCase(),A,y?y.toLowerCase():null);if(!k)throw E();return k},async authority(t,d){let i=l(t),s=U(await o(ee,{admissionId:i},d),i);if(!s)throw E();return s}}}var P=class extends Error{code="RUN_AUTHORITY_REFUSED";retryable=!1;reason;step;constructor(r,n,c){super(`Run authority refused the ${r==="dispatch"?"provider dispatch":"tool call"}: ${n}`,c),this.name="RunAuthorityRefusedError",this.reason=n,this.step=r}};0&&(module.exports={RUN_LEASE_MAX_SECONDS,RUN_LEASE_SKEW_SECONDS,RunAuthorityRefusedError,RunStepRefused,WorkforceAdmissionRefused,createWorkforceRunAdmissionClient,createWorkforceRunAuthority,verifyWorkforceRunLease});
|
|
@@ -83,4 +83,134 @@ declare function verifyWorkforceRunLease(token: string, input: {
|
|
|
83
83
|
minSequence: bigint;
|
|
84
84
|
}): LeaseVerdict;
|
|
85
85
|
declare function createWorkforceRunAuthority(options: WorkforceRunAuthorityOptions): RunAuthority;
|
|
86
|
-
|
|
86
|
+
type WorkforceAdmissionTarget = {
|
|
87
|
+
kind: "personal";
|
|
88
|
+
ownerUserId: string;
|
|
89
|
+
} | {
|
|
90
|
+
kind: "workspace";
|
|
91
|
+
assignmentId: string;
|
|
92
|
+
} | {
|
|
93
|
+
kind: "project";
|
|
94
|
+
projectId: string;
|
|
95
|
+
participationId: string;
|
|
96
|
+
};
|
|
97
|
+
interface WorkforceAdmissionRequest {
|
|
98
|
+
operationId: string;
|
|
99
|
+
expectedActorAccountId?: string;
|
|
100
|
+
agent: {
|
|
101
|
+
resourceId: string;
|
|
102
|
+
version: number;
|
|
103
|
+
contentHash: string;
|
|
104
|
+
};
|
|
105
|
+
target: WorkforceAdmissionTarget;
|
|
106
|
+
team?: {
|
|
107
|
+
teamId: string;
|
|
108
|
+
};
|
|
109
|
+
conversationId?: string;
|
|
110
|
+
root?: {
|
|
111
|
+
bindingId: string;
|
|
112
|
+
installationId: string;
|
|
113
|
+
};
|
|
114
|
+
capabilities: string[];
|
|
115
|
+
runtimeCapabilities?: string[];
|
|
116
|
+
budget: {
|
|
117
|
+
ceilingMicro: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
interface WorkforceAdmission {
|
|
121
|
+
schemaVersion: 1;
|
|
122
|
+
admissionId: string;
|
|
123
|
+
operationId: string;
|
|
124
|
+
agent: {
|
|
125
|
+
resourceId: string;
|
|
126
|
+
version: number;
|
|
127
|
+
contentHash: string;
|
|
128
|
+
};
|
|
129
|
+
target: Record<string, unknown>;
|
|
130
|
+
team: Record<string, unknown> | null;
|
|
131
|
+
conversationId: string | null;
|
|
132
|
+
payer: {
|
|
133
|
+
kind: string;
|
|
134
|
+
userId: string | null;
|
|
135
|
+
};
|
|
136
|
+
budget: {
|
|
137
|
+
ceilingMicro: string;
|
|
138
|
+
};
|
|
139
|
+
capabilities: {
|
|
140
|
+
requested: string[];
|
|
141
|
+
effective: string[];
|
|
142
|
+
terms: unknown;
|
|
143
|
+
};
|
|
144
|
+
memoryNamespace: string | null;
|
|
145
|
+
admittedAt: string;
|
|
146
|
+
}
|
|
147
|
+
interface WorkforceRunnablePin {
|
|
148
|
+
schemaVersion: 1;
|
|
149
|
+
agent: {
|
|
150
|
+
resourceId: string;
|
|
151
|
+
version: number;
|
|
152
|
+
contentHash: string;
|
|
153
|
+
};
|
|
154
|
+
target: WorkforceAdmissionTarget;
|
|
155
|
+
team: {
|
|
156
|
+
teamId: string;
|
|
157
|
+
} | null;
|
|
158
|
+
terms: {
|
|
159
|
+
definition: string[];
|
|
160
|
+
target: string[];
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
interface WorkforceRunAuthorityState {
|
|
164
|
+
schemaVersion: 1;
|
|
165
|
+
admissionId: string;
|
|
166
|
+
revoked: boolean;
|
|
167
|
+
reason: string | null;
|
|
168
|
+
revokedAt: string | null;
|
|
169
|
+
latestLeaseSequence: string | null;
|
|
170
|
+
}
|
|
171
|
+
declare class WorkforceAdmissionRefused extends Error {
|
|
172
|
+
readonly code: string;
|
|
173
|
+
readonly reason: string;
|
|
174
|
+
readonly details: {
|
|
175
|
+
reason: string;
|
|
176
|
+
currentVersion?: number;
|
|
177
|
+
availableMicro?: string;
|
|
178
|
+
field?: string;
|
|
179
|
+
};
|
|
180
|
+
constructor(code: string, reason: string, extra?: {
|
|
181
|
+
currentVersion?: number;
|
|
182
|
+
availableMicro?: string;
|
|
183
|
+
field?: string;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
interface WorkforceRunAdmissionClientOptions {
|
|
187
|
+
issuer: string;
|
|
188
|
+
authorizeRequest(target: {
|
|
189
|
+
method: string;
|
|
190
|
+
url: string;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
authorization: string;
|
|
193
|
+
dpop?: string;
|
|
194
|
+
} | null>;
|
|
195
|
+
fetchImpl?: typeof fetch;
|
|
196
|
+
}
|
|
197
|
+
interface WorkforceRunAdmissionClient {
|
|
198
|
+
admit(request: WorkforceAdmissionRequest, signal?: AbortSignal): Promise<{
|
|
199
|
+
admission: WorkforceAdmission;
|
|
200
|
+
replayed: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
revoke(admissionId: string, signal?: AbortSignal): Promise<WorkforceRunAuthorityState>;
|
|
203
|
+
authority(admissionId: string, signal?: AbortSignal): Promise<WorkforceRunAuthorityState>;
|
|
204
|
+
pin(request: {
|
|
205
|
+
agent: {
|
|
206
|
+
resourceId: string;
|
|
207
|
+
};
|
|
208
|
+
target: WorkforceAdmissionTarget;
|
|
209
|
+
team?: {
|
|
210
|
+
teamId: string;
|
|
211
|
+
};
|
|
212
|
+
expectedActorAccountId?: string;
|
|
213
|
+
}, signal?: AbortSignal): Promise<WorkforceRunnablePin>;
|
|
214
|
+
}
|
|
215
|
+
declare function createWorkforceRunAdmissionClient(options: WorkforceRunAdmissionClientOptions): WorkforceRunAdmissionClient;
|
|
216
|
+
export { RUN_LEASE_MAX_SECONDS, RUN_LEASE_SKEW_SECONDS, type RunAuthority, type RunAuthorityDispatch, RunAuthorityRefusedError, type RunAuthorityToolCall, type RunLeaseSequenceStore, RunStepRefused, type WorkforceAdmission, WorkforceAdmissionRefused, type WorkforceAdmissionRequest, type WorkforceAdmissionTarget, type WorkforceRunAdmissionClient, type WorkforceRunAdmissionClientOptions, type WorkforceRunAuthorityOptions, type WorkforceRunAuthorityState, type WorkforceRunnablePin, createWorkforceRunAdmissionClient, createWorkforceRunAuthority, verifyWorkforceRunLease };
|
|
@@ -83,4 +83,134 @@ declare function verifyWorkforceRunLease(token: string, input: {
|
|
|
83
83
|
minSequence: bigint;
|
|
84
84
|
}): LeaseVerdict;
|
|
85
85
|
declare function createWorkforceRunAuthority(options: WorkforceRunAuthorityOptions): RunAuthority;
|
|
86
|
-
|
|
86
|
+
type WorkforceAdmissionTarget = {
|
|
87
|
+
kind: "personal";
|
|
88
|
+
ownerUserId: string;
|
|
89
|
+
} | {
|
|
90
|
+
kind: "workspace";
|
|
91
|
+
assignmentId: string;
|
|
92
|
+
} | {
|
|
93
|
+
kind: "project";
|
|
94
|
+
projectId: string;
|
|
95
|
+
participationId: string;
|
|
96
|
+
};
|
|
97
|
+
interface WorkforceAdmissionRequest {
|
|
98
|
+
operationId: string;
|
|
99
|
+
expectedActorAccountId?: string;
|
|
100
|
+
agent: {
|
|
101
|
+
resourceId: string;
|
|
102
|
+
version: number;
|
|
103
|
+
contentHash: string;
|
|
104
|
+
};
|
|
105
|
+
target: WorkforceAdmissionTarget;
|
|
106
|
+
team?: {
|
|
107
|
+
teamId: string;
|
|
108
|
+
};
|
|
109
|
+
conversationId?: string;
|
|
110
|
+
root?: {
|
|
111
|
+
bindingId: string;
|
|
112
|
+
installationId: string;
|
|
113
|
+
};
|
|
114
|
+
capabilities: string[];
|
|
115
|
+
runtimeCapabilities?: string[];
|
|
116
|
+
budget: {
|
|
117
|
+
ceilingMicro: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
interface WorkforceAdmission {
|
|
121
|
+
schemaVersion: 1;
|
|
122
|
+
admissionId: string;
|
|
123
|
+
operationId: string;
|
|
124
|
+
agent: {
|
|
125
|
+
resourceId: string;
|
|
126
|
+
version: number;
|
|
127
|
+
contentHash: string;
|
|
128
|
+
};
|
|
129
|
+
target: Record<string, unknown>;
|
|
130
|
+
team: Record<string, unknown> | null;
|
|
131
|
+
conversationId: string | null;
|
|
132
|
+
payer: {
|
|
133
|
+
kind: string;
|
|
134
|
+
userId: string | null;
|
|
135
|
+
};
|
|
136
|
+
budget: {
|
|
137
|
+
ceilingMicro: string;
|
|
138
|
+
};
|
|
139
|
+
capabilities: {
|
|
140
|
+
requested: string[];
|
|
141
|
+
effective: string[];
|
|
142
|
+
terms: unknown;
|
|
143
|
+
};
|
|
144
|
+
memoryNamespace: string | null;
|
|
145
|
+
admittedAt: string;
|
|
146
|
+
}
|
|
147
|
+
interface WorkforceRunnablePin {
|
|
148
|
+
schemaVersion: 1;
|
|
149
|
+
agent: {
|
|
150
|
+
resourceId: string;
|
|
151
|
+
version: number;
|
|
152
|
+
contentHash: string;
|
|
153
|
+
};
|
|
154
|
+
target: WorkforceAdmissionTarget;
|
|
155
|
+
team: {
|
|
156
|
+
teamId: string;
|
|
157
|
+
} | null;
|
|
158
|
+
terms: {
|
|
159
|
+
definition: string[];
|
|
160
|
+
target: string[];
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
interface WorkforceRunAuthorityState {
|
|
164
|
+
schemaVersion: 1;
|
|
165
|
+
admissionId: string;
|
|
166
|
+
revoked: boolean;
|
|
167
|
+
reason: string | null;
|
|
168
|
+
revokedAt: string | null;
|
|
169
|
+
latestLeaseSequence: string | null;
|
|
170
|
+
}
|
|
171
|
+
declare class WorkforceAdmissionRefused extends Error {
|
|
172
|
+
readonly code: string;
|
|
173
|
+
readonly reason: string;
|
|
174
|
+
readonly details: {
|
|
175
|
+
reason: string;
|
|
176
|
+
currentVersion?: number;
|
|
177
|
+
availableMicro?: string;
|
|
178
|
+
field?: string;
|
|
179
|
+
};
|
|
180
|
+
constructor(code: string, reason: string, extra?: {
|
|
181
|
+
currentVersion?: number;
|
|
182
|
+
availableMicro?: string;
|
|
183
|
+
field?: string;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
interface WorkforceRunAdmissionClientOptions {
|
|
187
|
+
issuer: string;
|
|
188
|
+
authorizeRequest(target: {
|
|
189
|
+
method: string;
|
|
190
|
+
url: string;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
authorization: string;
|
|
193
|
+
dpop?: string;
|
|
194
|
+
} | null>;
|
|
195
|
+
fetchImpl?: typeof fetch;
|
|
196
|
+
}
|
|
197
|
+
interface WorkforceRunAdmissionClient {
|
|
198
|
+
admit(request: WorkforceAdmissionRequest, signal?: AbortSignal): Promise<{
|
|
199
|
+
admission: WorkforceAdmission;
|
|
200
|
+
replayed: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
revoke(admissionId: string, signal?: AbortSignal): Promise<WorkforceRunAuthorityState>;
|
|
203
|
+
authority(admissionId: string, signal?: AbortSignal): Promise<WorkforceRunAuthorityState>;
|
|
204
|
+
pin(request: {
|
|
205
|
+
agent: {
|
|
206
|
+
resourceId: string;
|
|
207
|
+
};
|
|
208
|
+
target: WorkforceAdmissionTarget;
|
|
209
|
+
team?: {
|
|
210
|
+
teamId: string;
|
|
211
|
+
};
|
|
212
|
+
expectedActorAccountId?: string;
|
|
213
|
+
}, signal?: AbortSignal): Promise<WorkforceRunnablePin>;
|
|
214
|
+
}
|
|
215
|
+
declare function createWorkforceRunAdmissionClient(options: WorkforceRunAdmissionClientOptions): WorkforceRunAdmissionClient;
|
|
216
|
+
export { RUN_LEASE_MAX_SECONDS, RUN_LEASE_SKEW_SECONDS, type RunAuthority, type RunAuthorityDispatch, RunAuthorityRefusedError, type RunAuthorityToolCall, type RunLeaseSequenceStore, RunStepRefused, type WorkforceAdmission, WorkforceAdmissionRefused, type WorkforceAdmissionRequest, type WorkforceAdmissionTarget, type WorkforceRunAdmissionClient, type WorkforceRunAdmissionClientOptions, type WorkforceRunAuthorityOptions, type WorkforceRunAuthorityState, type WorkforceRunnablePin, createWorkforceRunAdmissionClient, createWorkforceRunAuthority, verifyWorkforceRunLease };
|
package/dist/workforce/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPublicKey as q,verify as I}from"node:crypto";var L="/api/workforce/run-admissions/authorize-step",O="/api/oauth2/jwks",P=60,x=5,j="xeno-run-lease+jwt",N=1e4,E=65536,f=class extends Error{constructor(e){super(`run step refused: ${e}`);this.reason=e;this.name="RunStepRefused",this.details={reason:e}}reason;details};function M(i,s){let e=y=>({valid:!1,reason:y}),n=typeof i=="string"?i.split("."):[];if(n.length!==3)return e("malformed");let a,t;try{a=JSON.parse(Buffer.from(n[0],"base64url").toString("utf8")),t=JSON.parse(Buffer.from(n[1],"base64url").toString("utf8"))}catch{return e("malformed")}if(a.alg!=="ES256"||a.typ!==j)return e("wrong_type");if(!s.publicKey)return e("unknown_key");if(!I("sha256",Buffer.from(`${n[0]}.${n[1]}`),{key:s.publicKey,dsaEncoding:"ieee-p1363"},Buffer.from(n[2],"base64url")))return e("bad_signature");if(t.iss!=="xeno-platform"||t.aud!=="xeno-run-runtime"||t.sub!==s.admissionId)return e("wrong_subject");if(!Number.isSafeInteger(t.iat)||!Number.isSafeInteger(t.exp)||t.exp<=t.iat||t.exp-t.iat>P)return e("unbounded");if(!Array.isArray(t.caps)||!t.caps.every(y=>typeof y=="string"))return e("malformed");let p;try{p=BigInt(t.seq)}catch{return e("malformed")}if(p<s.minSequence)return e("superseded");if(s.nowWallMs/1e3>=t.exp-x)return e("expired");if(s.receivedAtMono===null)return e("requires_online_reauthorization");let c=(s.nowMono-s.receivedAtMono)/1e3;return c<0?e("requires_online_reauthorization"):c>=t.exp-t.iat-x?e("expired"):{valid:!0,sequence:p,claims:t}}async function z(i,s){let e=i.headers.get("content-length");if(e!==null&&(!/^\d+$/.test(e)||Number(e)>E))throw new Error("response too large");if(!i.body)return null;let n=i.body.getReader(),a=[],t=0;try{for(;;){let{done:c,value:y}=await n.read();if(s.aborted)throw new Error("response did not complete before the deadline");if(c)break;if(t+=y.byteLength,t>E)throw new Error("response too large");a.push(y)}}finally{try{n.releaseLock()}catch{}}let h=new Uint8Array(t),p=0;for(let c of a)h.set(c,p),p+=c.byteLength;return h.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(h)):null}function $(i){let s=i.fetchImpl??globalThis.fetch,e=i.clock??{wallMs:()=>Date.now(),monoMs:()=>performance.now()},n=i.admissionId;if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n))throw new Error("invalid admission id");let a;try{a=new URL(i.issuer)}catch{throw new Error("invalid issuer")}if(a.protocol!=="https:"||a.pathname!=="/"||a.username||a.password||a.search||a.hash)throw new Error("invalid issuer");let t=a.origin,h=new Map,p=new Map,c=null,y=async(r,o,l)=>{let u=`${t}${o}`,m=new AbortController,d=setTimeout(()=>m.abort(),N);d.unref?.();try{let g=null;if(r==="POST"&&(g=await i.authorizeRequest({method:r,url:u}),!g))throw new f("authority_unavailable");let k=await s(u,{method:r,redirect:"error",signal:m.signal,headers:{accept:"application/json",...l?{"content-type":"application/json"}:{},...g?{authorization:g.authorization,...g.dpop?{dpop:g.dpop}:{}}:{}},...l?{body:JSON.stringify(l)}:{}});return{status:k.status,json:await z(k,m.signal)}}finally{clearTimeout(d)}},v=async r=>{if(h.has(r))return h.get(r);let{status:o,json:l}=await y("GET",O);if(o!==200||!l||typeof l!="object"||!Array.isArray(l.keys))return null;for(let u of l.keys)if(!(typeof u.kid!="string"||u.kty!=="EC"||u.crv!=="P-256"))try{h.set(u.kid,q({key:{kty:"EC",crv:"P-256",x:u.x,y:u.y},format:"jwk"}))}catch{}return h.get(r)??null},S=()=>i.sequenceStore.read(n)??0n,_=(r,o)=>`${r}:${o??""}`,T=async r=>{let o=JSON.parse(Buffer.from(r.token.split(".")[0],"base64url").toString("utf8")).kid;return M(r.token,{publicKey:await v(o),admissionId:n,receivedAtMono:r.receivedAtMono,nowMono:e.monoMs(),nowWallMs:e.wallMs(),minSequence:S()}).valid},R=async(r,o,l)=>{if(l.throwIfAborted(),c)throw new f(c);let u=p.get(_(r,o));if(u&&await T(u).catch(()=>!1))return;let m;try{m=await y("POST",L,{admissionId:n,operation:r,...o?{capability:o}:{}})}catch(b){throw b instanceof f?b:new f("authority_unavailable")}let d=m.json;if(m.status!==200||d?.success!==!0||typeof d.token!="string"){let b=typeof d?.details?.reason=="string"&&/^[a-z_]{1,64}$/.test(d.details.reason)?d.details.reason:"authority_unavailable";throw b==="admission_revoked"&&(c=b),new f(b)}let g=e.monoMs(),k=(()=>{try{return JSON.parse(Buffer.from(d.token.split(".")[0],"base64url").toString("utf8"))}catch{return null}})();if(typeof k?.kid!="string")throw new f("authority_unavailable");let w=M(d.token,{publicKey:await v(k.kid).catch(()=>null),admissionId:n,receivedAtMono:g,nowMono:e.monoMs(),nowWallMs:e.wallMs(),minSequence:S()});if(!w.valid)throw new f("authority_unavailable");if(r==="privileged_call"&&w.claims.cap!==o)throw new f("authority_unavailable");await i.sequenceStore.write(n,w.sequence),p.set(_(r,o),{token:d.token,sequence:w.sequence,operation:r,capability:o,capabilities:w.claims.caps,iat:w.claims.iat,exp:w.claims.exp,receivedAtMono:g})};return{authorizeDispatch:(r,o)=>R("provider_dispatch",null,o),authorizeToolCall:(r,o)=>{let l=i.capabilityForTool(r.toolName);return l===null||!/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/.test(l)?Promise.reject(new f("capability_not_admitted")):R("privileged_call",l,o)}}}var A=class extends Error{code="RUN_AUTHORITY_REFUSED";retryable=!1;reason;step;constructor(s,e,n){super(`Run authority refused the ${s==="dispatch"?"provider dispatch":"tool call"}: ${e}`,n),this.name="RunAuthorityRefusedError",this.reason=e,this.step=s}};export{P as RUN_LEASE_MAX_SECONDS,x as RUN_LEASE_SKEW_SECONDS,A as RunAuthorityRefusedError,f as RunStepRefused,$ as createWorkforceRunAuthority,M as verifyWorkforceRunLease};
|
|
1
|
+
import{createPublicKey as N,verify as U}from"node:crypto";var $="/api/workforce/run-admissions/authorize-step",z="/api/oauth2/jwks",H=60,P=5,V="xeno-run-lease+jwt",D=1e4,O=65536,b=class extends Error{constructor(n){super(`run step refused: ${n}`);this.reason=n;this.name="RunStepRefused",this.details={reason:n}}reason;details};function C(e,a){let n=o=>({valid:!1,reason:o}),l=typeof e=="string"?e.split("."):[];if(l.length!==3)return n("malformed");let i,c;try{i=JSON.parse(Buffer.from(l[0],"base64url").toString("utf8")),c=JSON.parse(Buffer.from(l[1],"base64url").toString("utf8"))}catch{return n("malformed")}if(i.alg!=="ES256"||i.typ!==V)return n("wrong_type");if(!a.publicKey)return n("unknown_key");if(!U("sha256",Buffer.from(`${l[0]}.${l[1]}`),{key:a.publicKey,dsaEncoding:"ieee-p1363"},Buffer.from(l[2],"base64url")))return n("bad_signature");if(c.iss!=="xeno-platform"||c.aud!=="xeno-run-runtime"||c.sub!==a.admissionId)return n("wrong_subject");if(!Number.isSafeInteger(c.iat)||!Number.isSafeInteger(c.exp)||c.exp<=c.iat||c.exp-c.iat>H)return n("unbounded");if(!Array.isArray(c.caps)||!c.caps.every(o=>typeof o=="string"))return n("malformed");let d;try{d=BigInt(c.seq)}catch{return n("malformed")}if(d<a.minSequence)return n("superseded");if(a.nowWallMs/1e3>=c.exp-P)return n("expired");if(a.receivedAtMono===null)return n("requires_online_reauthorization");let r=(a.nowMono-a.receivedAtMono)/1e3;return r<0?n("requires_online_reauthorization"):r>=c.exp-c.iat-P?n("expired"):{valid:!0,sequence:d,claims:c}}async function J(e,a){let n=e.headers.get("content-length");if(n!==null&&(!/^\d+$/.test(n)||Number(n)>O))throw new Error("response too large");if(!e.body)return null;let l=e.body.getReader(),i=[],c=0;try{for(;;){let{done:r,value:o}=await l.read();if(a.aborted)throw new Error("response did not complete before the deadline");if(r)break;if(c+=o.byteLength,c>O)throw new Error("response too large");i.push(o)}}finally{try{l.releaseLock()}catch{}}let t=new Uint8Array(c),d=0;for(let r of i)t.set(r,d),d+=r.byteLength;return t.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t)):null}function ne(e){let a=e.fetchImpl??globalThis.fetch,n=e.clock??{wallMs:()=>Date.now(),monoMs:()=>performance.now()},l=e.admissionId;if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(l))throw new Error("invalid admission id");let i;try{i=new URL(e.issuer)}catch{throw new Error("invalid issuer")}if(i.protocol!=="https:"||i.pathname!=="/"||i.username||i.password||i.search||i.hash)throw new Error("invalid issuer");let c=i.origin,t=new Map,d=new Map,r=null,o=async(s,f,u)=>{let p=`${c}${f}`,R=new AbortController,w=setTimeout(()=>R.abort(),D);w.unref?.();try{let I=null;if(s==="POST"&&(I=await e.authorizeRequest({method:s,url:p}),!I))throw new b("authority_unavailable");let M=await a(p,{method:s,redirect:"error",signal:R.signal,headers:{accept:"application/json",...u?{"content-type":"application/json"}:{},...I?{authorization:I.authorization,...I.dpop?{dpop:I.dpop}:{}}:{}},...u?{body:JSON.stringify(u)}:{}});return{status:M.status,json:await J(M,R.signal)}}finally{clearTimeout(w)}},m=async s=>{if(t.has(s))return t.get(s);let{status:f,json:u}=await o("GET",z);if(f!==200||!u||typeof u!="object"||!Array.isArray(u.keys))return null;for(let p of u.keys)if(!(typeof p.kid!="string"||p.kty!=="EC"||p.crv!=="P-256"))try{t.set(p.kid,N({key:{kty:"EC",crv:"P-256",x:p.x,y:p.y},format:"jwk"}))}catch{}return t.get(s)??null},A=()=>e.sequenceStore.read(l)??0n,h=(s,f)=>`${s}:${f??""}`,_=async s=>{let f=JSON.parse(Buffer.from(s.token.split(".")[0],"base64url").toString("utf8")).kid;return C(s.token,{publicKey:await m(f),admissionId:l,receivedAtMono:s.receivedAtMono,nowMono:n.monoMs(),nowWallMs:n.wallMs(),minSequence:A()}).valid},k=async(s,f,u)=>{if(u.throwIfAborted(),r)throw new b(r);let p=d.get(h(s,f));if(p&&await _(p).catch(()=>!1))return;let R;try{R=await o("POST",$,{admissionId:l,operation:s,...f?{capability:f}:{}})}catch(T){throw T instanceof b?T:new b("authority_unavailable")}let w=R.json;if(R.status!==200||w?.success!==!0||typeof w.token!="string"){let T=typeof w?.details?.reason=="string"&&/^[a-z_]{1,64}$/.test(w.details.reason)?w.details.reason:"authority_unavailable";throw T==="admission_revoked"&&(r=T),new b(T)}let I=n.monoMs(),M=(()=>{try{return JSON.parse(Buffer.from(w.token.split(".")[0],"base64url").toString("utf8"))}catch{return null}})();if(typeof M?.kid!="string")throw new b("authority_unavailable");let v=C(w.token,{publicKey:await m(M.kid).catch(()=>null),admissionId:l,receivedAtMono:I,nowMono:n.monoMs(),nowWallMs:n.wallMs(),minSequence:A()});if(!v.valid)throw new b("authority_unavailable");if(s==="privileged_call"&&v.claims.cap!==f)throw new b("authority_unavailable");await e.sequenceStore.write(l,v.sequence),d.set(h(s,f),{token:w.token,sequence:v.sequence,operation:s,capability:f,capabilities:v.claims.caps,iat:v.claims.iat,exp:v.claims.exp,receivedAtMono:I})};return{authorizeDispatch:(s,f)=>k("provider_dispatch",null,f),authorizeToolCall:(s,f)=>{let u=e.capabilityForTool(s.toolName);return u===null||!/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/.test(u)?Promise.reject(new b("capability_not_admitted")):k("privileged_call",u,f)}}}var K="/api/workforce/run-admissions",q="/api/workforce/run-admissions/revoke",B="/api/workforce/run-admissions/authority",Y="/api/workforce/run-admissions/pin";var S=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Z=/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/,j=/^[a-z_]{1,64}$/,F=new Set(["bad_input","denied","not_found","needs_approval","conflict","rate_limited","unavailable","timeout","internal"]),y=class extends Error{constructor(n,l,i={}){super(`workforce admission refused: ${n}/${l}`);this.code=n;this.reason=l;this.name="WorkforceAdmissionRefused",this.details={reason:l,...i}}code;reason;details},E=()=>new y("unavailable","authority_unavailable"),g=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),x=e=>Array.isArray(e)&&e.length<=64&&e.every(a=>typeof a=="string"&&Z.test(a));function X(e){if(!g(e)||e.schemaVersion!==1||typeof e.admissionId!="string"||!S.test(e.admissionId)||typeof e.operationId!="string"||!S.test(e.operationId))return null;let a=e.agent;if(!g(a)||typeof a.resourceId!="string"||!S.test(a.resourceId)||!Number.isSafeInteger(a.version)||typeof a.contentHash!="string")return null;let n=e.capabilities;if(!g(n)||!x(n.effective)||!x(n.requested))return null;let l=e.payer;if(!g(l)||typeof l.kind!="string")return null;let i=e.budget;return!g(i)||typeof i.ceilingMicro!="string"||!/^[1-9][0-9]{0,17}$/.test(i.ceilingMicro)||!g(e.target)||typeof e.admittedAt!="string"||!Number.isFinite(Date.parse(e.admittedAt))?null:e}var Q=/^[0-9a-f]{64}$/;function G(e,a,n,l){if(!g(e)||e.schemaVersion!==1)return null;let i=e.agent;if(!g(i)||typeof i.resourceId!="string"||i.resourceId.toLowerCase()!==a||!Number.isSafeInteger(i.version)||i.version<1||typeof i.contentHash!="string"||!Q.test(i.contentHash)||!g(e.target)||JSON.stringify(Object.entries(e.target).map(([d,r])=>[d,typeof r=="string"?r.toLowerCase():r]).sort())!==JSON.stringify(Object.entries(n).map(([d,r])=>[d,typeof r=="string"?r.toLowerCase():r]).sort()))return null;let c=e.team;if(l?!g(c)||typeof c.teamId!="string"||c.teamId.toLowerCase()!==l:c!==null)return null;let t=e.terms;return!g(t)||!x(t.definition)||!x(t.target)?null:{schemaVersion:1,agent:{resourceId:a,version:i.version,contentHash:i.contentHash},target:{...n},team:l?{teamId:l}:null,terms:{definition:[...t.definition],target:[...t.target]}}}function W(e,a){return!g(e)||e.schemaVersion!==1||e.admissionId!==a||typeof e.revoked!="boolean"?null:{schemaVersion:1,admissionId:a,revoked:e.revoked,reason:typeof e.reason=="string"&&j.test(e.reason)?e.reason:null,revokedAt:typeof e.revokedAt=="string"?e.revokedAt:null,latestLeaseSequence:typeof e.latestLeaseSequence=="string"?e.latestLeaseSequence:null}}async function ee(e,a){let n=e.headers.get("content-length");if(n!==null&&(!/^\d+$/.test(n)||Number(n)>65536))throw new Error("response too large");if(!e.body)return null;let l=e.body.getReader(),i=[],c=0;try{for(;;){let{done:r,value:o}=await l.read();if(a.aborted)throw new Error("response did not complete before the deadline");if(r)break;if(c+=o.byteLength,c>65536)throw new Error("response too large");i.push(o)}}finally{try{l.releaseLock()}catch{}}let t=new Uint8Array(c),d=0;for(let r of i)t.set(r,d),d+=r.byteLength;return t.length?JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(t)):null}function oe(e){let a=e.fetchImpl??globalThis.fetch,n;try{n=new URL(e.issuer)}catch{throw new Error("invalid issuer")}if(n.protocol!=="https:"||n.pathname!=="/"||n.username||n.password||n.search||n.hash)throw new Error("invalid issuer");let l=n.origin,i=async(t,d,r)=>{let o=`${l}${t}`,m=new AbortController,A=()=>m.abort();r?.addEventListener("abort",A,{once:!0});let h=setTimeout(A,15e3);h.unref?.();try{r?.throwIfAborted();let _=await e.authorizeRequest({method:"POST",url:o});if(!_)throw E();let k,s;try{k=await a(o,{method:"POST",redirect:"error",signal:m.signal,headers:{accept:"application/json","content-type":"application/json",authorization:_.authorization,..._.dpop?{dpop:_.dpop}:{}},body:JSON.stringify(d)}),s=await ee(k,m.signal)}catch(p){throw r?.aborted?p:E()}if(k.status===200&&g(s)&&s.success===!0)return s;let f=g(s)&&typeof s.code=="string"&&F.has(s.code)?s.code:null,u=g(s)&&g(s.details)?s.details:null;throw f&&u&&u.schemaVersion===1&&typeof u.reason=="string"&&j.test(u.reason)?new y(f,u.reason,{...Number.isSafeInteger(u.currentVersion)?{currentVersion:u.currentVersion}:{},...typeof u.availableMicro=="string"&&/^[0-9]{1,20}$/.test(u.availableMicro)?{availableMicro:u.availableMicro}:{},...typeof u.field=="string"&&/^[a-zA-Z.]{1,64}$/.test(u.field)?{field:u.field}:{}}):f?new y(f,f==="denied"&&k.status===403&&g(s)&&typeof s.required_scope=="string"?"insufficient_scope":f):E()}finally{clearTimeout(h),r?.removeEventListener("abort",A)}},c=t=>{if(typeof t!="string"||!S.test(t))throw new y("bad_input","invalid_admission");return t.toLowerCase()};return{async admit(t,d){if(!S.test(t.operationId))throw new y("bad_input","invalid_operation");if(!x(t.capabilities))throw new y("bad_input","invalid_capabilities");if(t.runtimeCapabilities!==void 0&&!x(t.runtimeCapabilities))throw new y("bad_input","invalid_runtime_capabilities");if(!/^[1-9][0-9]{0,17}$/.test(t.budget?.ceilingMicro??""))throw new y("bad_input","invalid_budget_ceiling");let r={operationId:t.operationId,agent:{resourceId:t.agent.resourceId,version:t.agent.version,contentHash:t.agent.contentHash},target:{...t.target},capabilities:[...t.capabilities],budget:{ceilingMicro:t.budget.ceilingMicro},...t.expectedActorAccountId?{expectedActorAccountId:t.expectedActorAccountId}:{},...t.team?{team:{teamId:t.team.teamId}}:{},...t.conversationId?{conversationId:t.conversationId}:{},...t.root?{root:{bindingId:t.root.bindingId,installationId:t.root.installationId}}:{},...t.runtimeCapabilities?{runtimeCapabilities:[...t.runtimeCapabilities]}:{}},o=await i(K,r,d),m=X(o.admission);if(!m||m.operationId.toLowerCase()!==t.operationId.toLowerCase())throw E();return{admission:m,replayed:o.replayed===!0}},async revoke(t,d){let r=c(t),o=W(await i(q,{admissionId:r},d),r);if(!o||!o.revoked)throw E();return o},async pin(t,d){let r=t?.agent?.resourceId;if(typeof r!="string"||!S.test(r))throw new y("bad_input","invalid_agent_resource");let o=t.target,m=g(o)?o.kind==="personal"?[o.ownerUserId]:o.kind==="workspace"?[o.assignmentId]:o.kind==="project"?[o.projectId,o.participationId]:null:null;if(!m||!m.every(s=>typeof s=="string"&&S.test(s)))throw new y("bad_input","invalid_target");let A=o.kind==="personal"?{kind:"personal",ownerUserId:o.ownerUserId}:o.kind==="workspace"?{kind:"workspace",assignmentId:o.assignmentId}:{kind:"project",projectId:o.projectId,participationId:o.participationId},h=t.team?t.team.teamId:null;if(h!==null&&(typeof h!="string"||!S.test(h)))throw new y("bad_input","invalid_team");let _={agent:{resourceId:r},target:A,...h?{team:{teamId:h}}:{},...t.expectedActorAccountId?{expectedActorAccountId:t.expectedActorAccountId}:{}},k=G(await i(Y,_,d),r.toLowerCase(),A,h?h.toLowerCase():null);if(!k)throw E();return k},async authority(t,d){let r=c(t),o=W(await i(B,{admissionId:r},d),r);if(!o)throw E();return o}}}var L=class extends Error{code="RUN_AUTHORITY_REFUSED";retryable=!1;reason;step;constructor(a,n,l){super(`Run authority refused the ${a==="dispatch"?"provider dispatch":"tool call"}: ${n}`,l),this.name="RunAuthorityRefusedError",this.reason=n,this.step=a}};export{H as RUN_LEASE_MAX_SECONDS,P as RUN_LEASE_SKEW_SECONDS,L as RunAuthorityRefusedError,b as RunStepRefused,y as WorkforceAdmissionRefused,oe as createWorkforceRunAdmissionClient,ne as createWorkforceRunAuthority,C as verifyWorkforceRunLease};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/workforce/run-authority-client.ts":{"bytes":15410,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/core/agent-loop/run-authority.ts":{"bytes":4631,"imports":[],"format":"esm"},"src/workforce/index.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/workforce/run-authority-client.ts":{"bytes":15410,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/workforce/run-admission-client.ts":{"bytes":20292,"imports":[],"format":"esm"},"src/core/agent-loop/run-authority.ts":{"bytes":4631,"imports":[],"format":"esm"},"src/workforce/index.ts":{"bytes":745,"imports":[{"path":"src/workforce/run-authority-client.ts","kind":"import-statement","original":"./run-authority-client.js"},{"path":"src/workforce/run-admission-client.ts","kind":"import-statement","original":"./run-admission-client.js"},{"path":"src/core/agent-loop/run-authority.ts","kind":"import-statement","original":"../core/agent-loop/run-authority.js"}],"format":"esm"}},"outputs":{"dist/workforce/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/workforce/index.ts","inputs":{"src/workforce/index.ts":{"bytesInOutput":285},"src/workforce/run-authority-client.ts":{"bytesInOutput":5212},"src/workforce/run-admission-client.ts":{"bytesInOutput":7112},"src/core/agent-loop/run-authority.ts":{"bytesInOutput":257}},"bytes":13511}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/workforce/run-authority-client.ts":{"bytes":15410,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/core/agent-loop/run-authority.ts":{"bytes":4631,"imports":[],"format":"esm"},"src/workforce/index.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/workforce/run-authority-client.ts":{"bytes":15410,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/workforce/run-admission-client.ts":{"bytes":20292,"imports":[],"format":"esm"},"src/core/agent-loop/run-authority.ts":{"bytes":4631,"imports":[],"format":"esm"},"src/workforce/index.ts":{"bytes":745,"imports":[{"path":"src/workforce/run-authority-client.ts","kind":"import-statement","original":"./run-authority-client.js"},{"path":"src/workforce/run-admission-client.ts","kind":"import-statement","original":"./run-admission-client.js"},{"path":"src/core/agent-loop/run-authority.ts","kind":"import-statement","original":"../core/agent-loop/run-authority.js"}],"format":"esm"}},"outputs":{"dist/workforce/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"exports":["RUN_LEASE_MAX_SECONDS","RUN_LEASE_SKEW_SECONDS","RunAuthorityRefusedError","RunStepRefused","WorkforceAdmissionRefused","createWorkforceRunAdmissionClient","createWorkforceRunAuthority","verifyWorkforceRunLease"],"entryPoint":"src/workforce/index.ts","inputs":{"src/workforce/run-authority-client.ts":{"bytesInOutput":5215},"src/workforce/index.ts":{"bytesInOutput":0},"src/workforce/run-admission-client.ts":{"bytesInOutput":7098},"src/core/agent-loop/run-authority.ts":{"bytesInOutput":257}},"bytes":12818}}}
|