@neurouter/server 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +10 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/app.d.ts +29 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +79 -0
- package/dist/app.js.map +1 -0
- package/dist/console.d.ts +16 -0
- package/dist/console.d.ts.map +1 -0
- package/dist/console.js +149 -0
- package/dist/console.js.map +1 -0
- package/dist/controlplane/api/context.d.ts +64 -0
- package/dist/controlplane/api/context.d.ts.map +1 -0
- package/dist/controlplane/api/context.js +7 -0
- package/dist/controlplane/api/context.js.map +1 -0
- package/dist/controlplane/api/plugin.d.ts +8 -0
- package/dist/controlplane/api/plugin.d.ts.map +1 -0
- package/dist/controlplane/api/plugin.js +36 -0
- package/dist/controlplane/api/plugin.js.map +1 -0
- package/dist/controlplane/api/ports.d.ts +40 -0
- package/dist/controlplane/api/ports.d.ts.map +1 -0
- package/dist/controlplane/api/ports.js +2 -0
- package/dist/controlplane/api/ports.js.map +1 -0
- package/dist/controlplane/api/problem.d.ts +15 -0
- package/dist/controlplane/api/problem.d.ts.map +1 -0
- package/dist/controlplane/api/problem.js +80 -0
- package/dist/controlplane/api/problem.js.map +1 -0
- package/dist/controlplane/api/routes/audit.d.ts +6 -0
- package/dist/controlplane/api/routes/audit.d.ts.map +1 -0
- package/dist/controlplane/api/routes/audit.js +139 -0
- package/dist/controlplane/api/routes/audit.js.map +1 -0
- package/dist/controlplane/api/routes/auth.d.ts +10 -0
- package/dist/controlplane/api/routes/auth.d.ts.map +1 -0
- package/dist/controlplane/api/routes/auth.js +125 -0
- package/dist/controlplane/api/routes/auth.js.map +1 -0
- package/dist/controlplane/api/routes/environments.d.ts +5 -0
- package/dist/controlplane/api/routes/environments.d.ts.map +1 -0
- package/dist/controlplane/api/routes/environments.js +118 -0
- package/dist/controlplane/api/routes/environments.js.map +1 -0
- package/dist/controlplane/api/routes/evals.d.ts +5 -0
- package/dist/controlplane/api/routes/evals.d.ts.map +1 -0
- package/dist/controlplane/api/routes/evals.js +348 -0
- package/dist/controlplane/api/routes/evals.js.map +1 -0
- package/dist/controlplane/api/routes/inbox.d.ts +5 -0
- package/dist/controlplane/api/routes/inbox.d.ts.map +1 -0
- package/dist/controlplane/api/routes/inbox.js +226 -0
- package/dist/controlplane/api/routes/inbox.js.map +1 -0
- package/dist/controlplane/api/routes/keys.d.ts +5 -0
- package/dist/controlplane/api/routes/keys.d.ts.map +1 -0
- package/dist/controlplane/api/routes/keys.js +176 -0
- package/dist/controlplane/api/routes/keys.js.map +1 -0
- package/dist/controlplane/api/routes/metrics.d.ts +5 -0
- package/dist/controlplane/api/routes/metrics.d.ts.map +1 -0
- package/dist/controlplane/api/routes/metrics.js +197 -0
- package/dist/controlplane/api/routes/metrics.js.map +1 -0
- package/dist/controlplane/api/routes/overlays.d.ts +36 -0
- package/dist/controlplane/api/routes/overlays.d.ts.map +1 -0
- package/dist/controlplane/api/routes/overlays.js +244 -0
- package/dist/controlplane/api/routes/overlays.js.map +1 -0
- package/dist/controlplane/api/routes/public.d.ts +7 -0
- package/dist/controlplane/api/routes/public.d.ts.map +1 -0
- package/dist/controlplane/api/routes/public.js +71 -0
- package/dist/controlplane/api/routes/public.js.map +1 -0
- package/dist/controlplane/api/routes/servers.d.ts +45 -0
- package/dist/controlplane/api/routes/servers.d.ts.map +1 -0
- package/dist/controlplane/api/routes/servers.js +423 -0
- package/dist/controlplane/api/routes/servers.js.map +1 -0
- package/dist/controlplane/api/routes/settings.d.ts +21 -0
- package/dist/controlplane/api/routes/settings.d.ts.map +1 -0
- package/dist/controlplane/api/routes/settings.js +408 -0
- package/dist/controlplane/api/routes/settings.js.map +1 -0
- package/dist/controlplane/api/routes/tasks.d.ts +12 -0
- package/dist/controlplane/api/routes/tasks.d.ts.map +1 -0
- package/dist/controlplane/api/routes/tasks.js +144 -0
- package/dist/controlplane/api/routes/tasks.js.map +1 -0
- package/dist/controlplane/api/routes/tools.d.ts +14 -0
- package/dist/controlplane/api/routes/tools.d.ts.map +1 -0
- package/dist/controlplane/api/routes/tools.js +174 -0
- package/dist/controlplane/api/routes/tools.js.map +1 -0
- package/dist/controlplane/api/routes.d.ts +25 -0
- package/dist/controlplane/api/routes.d.ts.map +1 -0
- package/dist/controlplane/api/routes.js +43 -0
- package/dist/controlplane/api/routes.js.map +1 -0
- package/dist/controlplane/api/views.d.ts +53 -0
- package/dist/controlplane/api/views.d.ts.map +1 -0
- package/dist/controlplane/api/views.js +290 -0
- package/dist/controlplane/api/views.js.map +1 -0
- package/dist/controlplane/auth/guards.d.ts +40 -0
- package/dist/controlplane/auth/guards.d.ts.map +1 -0
- package/dist/controlplane/auth/guards.js +87 -0
- package/dist/controlplane/auth/guards.js.map +1 -0
- package/dist/controlplane/auth/local-link.d.ts +28 -0
- package/dist/controlplane/auth/local-link.d.ts.map +1 -0
- package/dist/controlplane/auth/local-link.js +41 -0
- package/dist/controlplane/auth/local-link.js.map +1 -0
- package/dist/controlplane/auth/login.d.ts +51 -0
- package/dist/controlplane/auth/login.d.ts.map +1 -0
- package/dist/controlplane/auth/login.js +115 -0
- package/dist/controlplane/auth/login.js.map +1 -0
- package/dist/controlplane/auth/oidc.d.ts +63 -0
- package/dist/controlplane/auth/oidc.d.ts.map +1 -0
- package/dist/controlplane/auth/oidc.js +76 -0
- package/dist/controlplane/auth/oidc.js.map +1 -0
- package/dist/controlplane/auth/sessions.d.ts +46 -0
- package/dist/controlplane/auth/sessions.d.ts.map +1 -0
- package/dist/controlplane/auth/sessions.js +65 -0
- package/dist/controlplane/auth/sessions.js.map +1 -0
- package/dist/controlplane/config-sync/reconcile.d.ts +88 -0
- package/dist/controlplane/config-sync/reconcile.d.ts.map +1 -0
- package/dist/controlplane/config-sync/reconcile.js +287 -0
- package/dist/controlplane/config-sync/reconcile.js.map +1 -0
- package/dist/controlplane/environments/environments.service.d.ts +46 -0
- package/dist/controlplane/environments/environments.service.d.ts.map +1 -0
- package/dist/controlplane/environments/environments.service.js +209 -0
- package/dist/controlplane/environments/environments.service.js.map +1 -0
- package/dist/controlplane/evals/evals.service.d.ts +126 -0
- package/dist/controlplane/evals/evals.service.d.ts.map +1 -0
- package/dist/controlplane/evals/evals.service.js +551 -0
- package/dist/controlplane/evals/evals.service.js.map +1 -0
- package/dist/controlplane/evals/model-keys.d.ts +37 -0
- package/dist/controlplane/evals/model-keys.d.ts.map +1 -0
- package/dist/controlplane/evals/model-keys.js +43 -0
- package/dist/controlplane/evals/model-keys.js.map +1 -0
- package/dist/controlplane/keys/api-key-format.d.ts +19 -0
- package/dist/controlplane/keys/api-key-format.d.ts.map +1 -0
- package/dist/controlplane/keys/api-key-format.js +39 -0
- package/dist/controlplane/keys/api-key-format.js.map +1 -0
- package/dist/controlplane/keys/api-keys.service.d.ts +42 -0
- package/dist/controlplane/keys/api-keys.service.d.ts.map +1 -0
- package/dist/controlplane/keys/api-keys.service.js +91 -0
- package/dist/controlplane/keys/api-keys.service.js.map +1 -0
- package/dist/controlplane/oauth/authorize.d.ts +101 -0
- package/dist/controlplane/oauth/authorize.d.ts.map +1 -0
- package/dist/controlplane/oauth/authorize.js +172 -0
- package/dist/controlplane/oauth/authorize.js.map +1 -0
- package/dist/controlplane/oauth/cimd.d.ts +52 -0
- package/dist/controlplane/oauth/cimd.d.ts.map +1 -0
- package/dist/controlplane/oauth/cimd.js +173 -0
- package/dist/controlplane/oauth/cimd.js.map +1 -0
- package/dist/controlplane/oauth/clients.service.d.ts +101 -0
- package/dist/controlplane/oauth/clients.service.d.ts.map +1 -0
- package/dist/controlplane/oauth/clients.service.js +269 -0
- package/dist/controlplane/oauth/clients.service.js.map +1 -0
- package/dist/controlplane/oauth/metadata.d.ts +27 -0
- package/dist/controlplane/oauth/metadata.d.ts.map +1 -0
- package/dist/controlplane/oauth/metadata.js +35 -0
- package/dist/controlplane/oauth/metadata.js.map +1 -0
- package/dist/controlplane/oauth/pkce.d.ts +8 -0
- package/dist/controlplane/oauth/pkce.d.ts.map +1 -0
- package/dist/controlplane/oauth/pkce.js +16 -0
- package/dist/controlplane/oauth/pkce.js.map +1 -0
- package/dist/controlplane/oauth/redirect-uri.d.ts +15 -0
- package/dist/controlplane/oauth/redirect-uri.d.ts.map +1 -0
- package/dist/controlplane/oauth/redirect-uri.js +61 -0
- package/dist/controlplane/oauth/redirect-uri.js.map +1 -0
- package/dist/controlplane/oauth/resource.d.ts +28 -0
- package/dist/controlplane/oauth/resource.d.ts.map +1 -0
- package/dist/controlplane/oauth/resource.js +49 -0
- package/dist/controlplane/oauth/resource.js.map +1 -0
- package/dist/controlplane/oauth/routes.d.ts +28 -0
- package/dist/controlplane/oauth/routes.d.ts.map +1 -0
- package/dist/controlplane/oauth/routes.js +191 -0
- package/dist/controlplane/oauth/routes.js.map +1 -0
- package/dist/controlplane/oauth/session.d.ts +36 -0
- package/dist/controlplane/oauth/session.d.ts.map +1 -0
- package/dist/controlplane/oauth/session.js +38 -0
- package/dist/controlplane/oauth/session.js.map +1 -0
- package/dist/controlplane/oauth/tokens.service.d.ts +105 -0
- package/dist/controlplane/oauth/tokens.service.d.ts.map +1 -0
- package/dist/controlplane/oauth/tokens.service.js +209 -0
- package/dist/controlplane/oauth/tokens.service.js.map +1 -0
- package/dist/controlplane/servers/builds.service.d.ts +54 -0
- package/dist/controlplane/servers/builds.service.d.ts.map +1 -0
- package/dist/controlplane/servers/builds.service.js +173 -0
- package/dist/controlplane/servers/builds.service.js.map +1 -0
- package/dist/controlplane/servers/fetch-spec.d.ts +13 -0
- package/dist/controlplane/servers/fetch-spec.d.ts.map +1 -0
- package/dist/controlplane/servers/fetch-spec.js +30 -0
- package/dist/controlplane/servers/fetch-spec.js.map +1 -0
- package/dist/controlplane/servers/servers.service.d.ts +87 -0
- package/dist/controlplane/servers/servers.service.d.ts.map +1 -0
- package/dist/controlplane/servers/servers.service.js +168 -0
- package/dist/controlplane/servers/servers.service.js.map +1 -0
- package/dist/controlplane/traces/traces.service.d.ts +38 -0
- package/dist/controlplane/traces/traces.service.d.ts.map +1 -0
- package/dist/controlplane/traces/traces.service.js +189 -0
- package/dist/controlplane/traces/traces.service.js.map +1 -0
- package/dist/controlplane/upstream-oauth/upstream-oauth.service.d.ts +70 -0
- package/dist/controlplane/upstream-oauth/upstream-oauth.service.d.ts.map +1 -0
- package/dist/controlplane/upstream-oauth/upstream-oauth.service.js +208 -0
- package/dist/controlplane/upstream-oauth/upstream-oauth.service.js.map +1 -0
- package/dist/controlplane/users/users.service.d.ts +33 -0
- package/dist/controlplane/users/users.service.d.ts.map +1 -0
- package/dist/controlplane/users/users.service.js +68 -0
- package/dist/controlplane/users/users.service.js.map +1 -0
- package/dist/dataplane/auth/authenticate.d.ts +58 -0
- package/dist/dataplane/auth/authenticate.d.ts.map +1 -0
- package/dist/dataplane/auth/authenticate.js +152 -0
- package/dist/dataplane/auth/authenticate.js.map +1 -0
- package/dist/dataplane/auth/external-jwt.d.ts +30 -0
- package/dist/dataplane/auth/external-jwt.d.ts.map +1 -0
- package/dist/dataplane/auth/external-jwt.js +78 -0
- package/dist/dataplane/auth/external-jwt.js.map +1 -0
- package/dist/dataplane/code/executor-health.d.ts +24 -0
- package/dist/dataplane/code/executor-health.d.ts.map +1 -0
- package/dist/dataplane/code/executor-health.js +49 -0
- package/dist/dataplane/code/executor-health.js.map +1 -0
- package/dist/dataplane/code/run-script.d.ts +90 -0
- package/dist/dataplane/code/run-script.d.ts.map +1 -0
- package/dist/dataplane/code/run-script.js +320 -0
- package/dist/dataplane/code/run-script.js.map +1 -0
- package/dist/dataplane/code/tokenize.d.ts +44 -0
- package/dist/dataplane/code/tokenize.d.ts.map +1 -0
- package/dist/dataplane/code/tokenize.js +267 -0
- package/dist/dataplane/code/tokenize.js.map +1 -0
- package/dist/dataplane/code/validate.d.ts +30 -0
- package/dist/dataplane/code/validate.d.ts.map +1 -0
- package/dist/dataplane/code/validate.js +94 -0
- package/dist/dataplane/code/validate.js.map +1 -0
- package/dist/dataplane/code/wrap.d.ts +20 -0
- package/dist/dataplane/code/wrap.d.ts.map +1 -0
- package/dist/dataplane/code/wrap.js +108 -0
- package/dist/dataplane/code/wrap.js.map +1 -0
- package/dist/dataplane/http/circuit-breaker.d.ts +23 -0
- package/dist/dataplane/http/circuit-breaker.d.ts.map +1 -0
- package/dist/dataplane/http/circuit-breaker.js +53 -0
- package/dist/dataplane/http/circuit-breaker.js.map +1 -0
- package/dist/dataplane/http/credentials.d.ts +59 -0
- package/dist/dataplane/http/credentials.d.ts.map +1 -0
- package/dist/dataplane/http/credentials.js +93 -0
- package/dist/dataplane/http/credentials.js.map +1 -0
- package/dist/dataplane/http/errors.d.ts +16 -0
- package/dist/dataplane/http/errors.d.ts.map +1 -0
- package/dist/dataplane/http/errors.js +32 -0
- package/dist/dataplane/http/errors.js.map +1 -0
- package/dist/dataplane/http/invoker.d.ts +56 -0
- package/dist/dataplane/http/invoker.d.ts.map +1 -0
- package/dist/dataplane/http/invoker.js +114 -0
- package/dist/dataplane/http/invoker.js.map +1 -0
- package/dist/dataplane/http/request-builder.d.ts +39 -0
- package/dist/dataplane/http/request-builder.d.ts.map +1 -0
- package/dist/dataplane/http/request-builder.js +162 -0
- package/dist/dataplane/http/request-builder.js.map +1 -0
- package/dist/dataplane/mcp/challenge.d.ts +14 -0
- package/dist/dataplane/mcp/challenge.d.ts.map +1 -0
- package/dist/dataplane/mcp/challenge.js +25 -0
- package/dist/dataplane/mcp/challenge.js.map +1 -0
- package/dist/dataplane/mcp/dispatch.d.ts +64 -0
- package/dist/dataplane/mcp/dispatch.d.ts.map +1 -0
- package/dist/dataplane/mcp/dispatch.js +165 -0
- package/dist/dataplane/mcp/dispatch.js.map +1 -0
- package/dist/dataplane/mcp/event-bus.d.ts +19 -0
- package/dist/dataplane/mcp/event-bus.d.ts.map +1 -0
- package/dist/dataplane/mcp/event-bus.js +39 -0
- package/dist/dataplane/mcp/event-bus.js.map +1 -0
- package/dist/dataplane/mcp/inflight.d.ts +66 -0
- package/dist/dataplane/mcp/inflight.d.ts.map +1 -0
- package/dist/dataplane/mcp/inflight.js +135 -0
- package/dist/dataplane/mcp/inflight.js.map +1 -0
- package/dist/dataplane/mcp/origin.d.ts +7 -0
- package/dist/dataplane/mcp/origin.d.ts.map +1 -0
- package/dist/dataplane/mcp/origin.js +27 -0
- package/dist/dataplane/mcp/origin.js.map +1 -0
- package/dist/dataplane/mcp/route.d.ts +43 -0
- package/dist/dataplane/mcp/route.d.ts.map +1 -0
- package/dist/dataplane/mcp/route.js +280 -0
- package/dist/dataplane/mcp/route.js.map +1 -0
- package/dist/dataplane/mcp/surface.d.ts +43 -0
- package/dist/dataplane/mcp/surface.d.ts.map +1 -0
- package/dist/dataplane/mcp/surface.js +133 -0
- package/dist/dataplane/mcp/surface.js.map +1 -0
- package/dist/dataplane/mcp/translate.d.ts +16 -0
- package/dist/dataplane/mcp/translate.d.ts.map +1 -0
- package/dist/dataplane/mcp/translate.js +33 -0
- package/dist/dataplane/mcp/translate.js.map +1 -0
- package/dist/dataplane/mock/mock-upstream.d.ts +23 -0
- package/dist/dataplane/mock/mock-upstream.d.ts.map +1 -0
- package/dist/dataplane/mock/mock-upstream.js +26 -0
- package/dist/dataplane/mock/mock-upstream.js.map +1 -0
- package/dist/dataplane/ops/ops.d.ts +66 -0
- package/dist/dataplane/ops/ops.d.ts.map +1 -0
- package/dist/dataplane/ops/ops.js +315 -0
- package/dist/dataplane/ops/ops.js.map +1 -0
- package/dist/dataplane/pipeline/arg-validate.d.ts +19 -0
- package/dist/dataplane/pipeline/arg-validate.d.ts.map +1 -0
- package/dist/dataplane/pipeline/arg-validate.js +61 -0
- package/dist/dataplane/pipeline/arg-validate.js.map +1 -0
- package/dist/dataplane/pipeline/context.d.ts +78 -0
- package/dist/dataplane/pipeline/context.d.ts.map +1 -0
- package/dist/dataplane/pipeline/context.js +13 -0
- package/dist/dataplane/pipeline/context.js.map +1 -0
- package/dist/dataplane/pipeline/errors.d.ts +53 -0
- package/dist/dataplane/pipeline/errors.d.ts.map +1 -0
- package/dist/dataplane/pipeline/errors.js +61 -0
- package/dist/dataplane/pipeline/errors.js.map +1 -0
- package/dist/dataplane/pipeline/pipeline.d.ts +128 -0
- package/dist/dataplane/pipeline/pipeline.d.ts.map +1 -0
- package/dist/dataplane/pipeline/pipeline.js +443 -0
- package/dist/dataplane/pipeline/pipeline.js.map +1 -0
- package/dist/dataplane/pipeline/policy.d.ts +24 -0
- package/dist/dataplane/pipeline/policy.d.ts.map +1 -0
- package/dist/dataplane/pipeline/policy.js +93 -0
- package/dist/dataplane/pipeline/policy.js.map +1 -0
- package/dist/dataplane/rate-limit/limiter.d.ts +42 -0
- package/dist/dataplane/rate-limit/limiter.d.ts.map +1 -0
- package/dist/dataplane/rate-limit/limiter.js +34 -0
- package/dist/dataplane/rate-limit/limiter.js.map +1 -0
- package/dist/dataplane/rate-limit/stores.d.ts +56 -0
- package/dist/dataplane/rate-limit/stores.d.ts.map +1 -0
- package/dist/dataplane/rate-limit/stores.js +95 -0
- package/dist/dataplane/rate-limit/stores.js.map +1 -0
- package/dist/dataplane/rate-limit/token-bucket.d.ts +19 -0
- package/dist/dataplane/rate-limit/token-bucket.d.ts.map +1 -0
- package/dist/dataplane/rate-limit/token-bucket.js +16 -0
- package/dist/dataplane/rate-limit/token-bucket.js.map +1 -0
- package/dist/dataplane/search/document.d.ts +22 -0
- package/dist/dataplane/search/document.d.ts.map +1 -0
- package/dist/dataplane/search/document.js +45 -0
- package/dist/dataplane/search/document.js.map +1 -0
- package/dist/dataplane/search/embed-worker.d.ts +2 -0
- package/dist/dataplane/search/embed-worker.d.ts.map +1 -0
- package/dist/dataplane/search/embed-worker.js +55 -0
- package/dist/dataplane/search/embed-worker.js.map +1 -0
- package/dist/dataplane/search/embedder.d.ts +113 -0
- package/dist/dataplane/search/embedder.d.ts.map +1 -0
- package/dist/dataplane/search/embedder.js +216 -0
- package/dist/dataplane/search/embedder.js.map +1 -0
- package/dist/dataplane/search/hybrid.d.ts +28 -0
- package/dist/dataplane/search/hybrid.d.ts.map +1 -0
- package/dist/dataplane/search/hybrid.js +45 -0
- package/dist/dataplane/search/hybrid.js.map +1 -0
- package/dist/dataplane/search/indexer.d.ts +62 -0
- package/dist/dataplane/search/indexer.d.ts.map +1 -0
- package/dist/dataplane/search/indexer.js +105 -0
- package/dist/dataplane/search/indexer.js.map +1 -0
- package/dist/dataplane/search/keyword-index.d.ts +26 -0
- package/dist/dataplane/search/keyword-index.d.ts.map +1 -0
- package/dist/dataplane/search/keyword-index.js +60 -0
- package/dist/dataplane/search/keyword-index.js.map +1 -0
- package/dist/dataplane/search/model-profiles.d.ts +12 -0
- package/dist/dataplane/search/model-profiles.d.ts.map +1 -0
- package/dist/dataplane/search/model-profiles.js +12 -0
- package/dist/dataplane/search/model-profiles.js.map +1 -0
- package/dist/dataplane/search/search.service.d.ts +39 -0
- package/dist/dataplane/search/search.service.d.ts.map +1 -0
- package/dist/dataplane/search/search.service.js +69 -0
- package/dist/dataplane/search/search.service.js.map +1 -0
- package/dist/dataplane/search/suggest.d.ts +15 -0
- package/dist/dataplane/search/suggest.d.ts.map +1 -0
- package/dist/dataplane/search/suggest.js +76 -0
- package/dist/dataplane/search/suggest.js.map +1 -0
- package/dist/dataplane/search/vector-index.d.ts +49 -0
- package/dist/dataplane/search/vector-index.d.ts.map +1 -0
- package/dist/dataplane/search/vector-index.js +72 -0
- package/dist/dataplane/search/vector-index.js.map +1 -0
- package/dist/dataplane/shaping/result-pages.d.ts +19 -0
- package/dist/dataplane/shaping/result-pages.d.ts.map +1 -0
- package/dist/dataplane/shaping/result-pages.js +37 -0
- package/dist/dataplane/shaping/result-pages.js.map +1 -0
- package/dist/dataplane/shaping/sanitize.d.ts +6 -0
- package/dist/dataplane/shaping/sanitize.d.ts.map +1 -0
- package/dist/dataplane/shaping/sanitize.js +31 -0
- package/dist/dataplane/shaping/sanitize.js.map +1 -0
- package/dist/dataplane/tasks/tracker.d.ts +60 -0
- package/dist/dataplane/tasks/tracker.d.ts.map +1 -0
- package/dist/dataplane/tasks/tracker.js +178 -0
- package/dist/dataplane/tasks/tracker.js.map +1 -0
- package/dist/dataplane/tasks/usage.d.ts +8 -0
- package/dist/dataplane/tasks/usage.d.ts.map +1 -0
- package/dist/dataplane/tasks/usage.js +35 -0
- package/dist/dataplane/tasks/usage.js.map +1 -0
- package/dist/deps.d.ts +133 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +356 -0
- package/dist/deps.js.map +1 -0
- package/dist/health/routes.d.ts +22 -0
- package/dist/health/routes.d.ts.map +1 -0
- package/dist/health/routes.js +40 -0
- package/dist/health/routes.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation.d.ts +10 -0
- package/dist/instrumentation.d.ts.map +1 -0
- package/dist/instrumentation.js +72 -0
- package/dist/instrumentation.js.map +1 -0
- package/dist/jobs.d.ts +5 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +96 -0
- package/dist/jobs.js.map +1 -0
- package/dist/kernel/audit/archive/azure.d.ts +42 -0
- package/dist/kernel/audit/archive/azure.d.ts.map +1 -0
- package/dist/kernel/audit/archive/azure.js +80 -0
- package/dist/kernel/audit/archive/azure.js.map +1 -0
- package/dist/kernel/audit/archive/gcs.d.ts +27 -0
- package/dist/kernel/audit/archive/gcs.d.ts.map +1 -0
- package/dist/kernel/audit/archive/gcs.js +42 -0
- package/dist/kernel/audit/archive/gcs.js.map +1 -0
- package/dist/kernel/audit/archive/index.d.ts +20 -0
- package/dist/kernel/audit/archive/index.d.ts.map +1 -0
- package/dist/kernel/audit/archive/index.js +90 -0
- package/dist/kernel/audit/archive/index.js.map +1 -0
- package/dist/kernel/audit/archive/local-fs.d.ts +10 -0
- package/dist/kernel/audit/archive/local-fs.d.ts.map +1 -0
- package/dist/kernel/audit/archive/local-fs.js +24 -0
- package/dist/kernel/audit/archive/local-fs.js.map +1 -0
- package/dist/kernel/audit/archive/s3.d.ts +49 -0
- package/dist/kernel/audit/archive/s3.d.ts.map +1 -0
- package/dist/kernel/audit/archive/s3.js +85 -0
- package/dist/kernel/audit/archive/s3.js.map +1 -0
- package/dist/kernel/audit/archive/store.d.ts +34 -0
- package/dist/kernel/audit/archive/store.d.ts.map +1 -0
- package/dist/kernel/audit/archive/store.js +27 -0
- package/dist/kernel/audit/archive/store.js.map +1 -0
- package/dist/kernel/audit/chain.d.ts +33 -0
- package/dist/kernel/audit/chain.d.ts.map +1 -0
- package/dist/kernel/audit/chain.js +64 -0
- package/dist/kernel/audit/chain.js.map +1 -0
- package/dist/kernel/audit/checkpoints.d.ts +30 -0
- package/dist/kernel/audit/checkpoints.d.ts.map +1 -0
- package/dist/kernel/audit/checkpoints.js +33 -0
- package/dist/kernel/audit/checkpoints.js.map +1 -0
- package/dist/kernel/audit/export.d.ts +14 -0
- package/dist/kernel/audit/export.d.ts.map +1 -0
- package/dist/kernel/audit/export.js +88 -0
- package/dist/kernel/audit/export.js.map +1 -0
- package/dist/kernel/audit/partitions.d.ts +29 -0
- package/dist/kernel/audit/partitions.d.ts.map +1 -0
- package/dist/kernel/audit/partitions.js +58 -0
- package/dist/kernel/audit/partitions.js.map +1 -0
- package/dist/kernel/audit/query.d.ts +28 -0
- package/dist/kernel/audit/query.d.ts.map +1 -0
- package/dist/kernel/audit/query.js +114 -0
- package/dist/kernel/audit/query.js.map +1 -0
- package/dist/kernel/audit/recorder.d.ts +53 -0
- package/dist/kernel/audit/recorder.d.ts.map +1 -0
- package/dist/kernel/audit/recorder.js +71 -0
- package/dist/kernel/audit/recorder.js.map +1 -0
- package/dist/kernel/audit/redact.d.ts +69 -0
- package/dist/kernel/audit/redact.d.ts.map +1 -0
- package/dist/kernel/audit/redact.js +202 -0
- package/dist/kernel/audit/redact.js.map +1 -0
- package/dist/kernel/audit/redaction-rules.service.d.ts +34 -0
- package/dist/kernel/audit/redaction-rules.service.d.ts.map +1 -0
- package/dist/kernel/audit/redaction-rules.service.js +53 -0
- package/dist/kernel/audit/redaction-rules.service.js.map +1 -0
- package/dist/kernel/audit/retention.d.ts +54 -0
- package/dist/kernel/audit/retention.d.ts.map +1 -0
- package/dist/kernel/audit/retention.js +119 -0
- package/dist/kernel/audit/retention.js.map +1 -0
- package/dist/kernel/audit/sinks/dispatcher.d.ts +38 -0
- package/dist/kernel/audit/sinks/dispatcher.d.ts.map +1 -0
- package/dist/kernel/audit/sinks/dispatcher.js +68 -0
- package/dist/kernel/audit/sinks/dispatcher.js.map +1 -0
- package/dist/kernel/audit/sinks/otel-logs.d.ts +25 -0
- package/dist/kernel/audit/sinks/otel-logs.d.ts.map +1 -0
- package/dist/kernel/audit/sinks/otel-logs.js +51 -0
- package/dist/kernel/audit/sinks/otel-logs.js.map +1 -0
- package/dist/kernel/audit/sinks/sink.d.ts +14 -0
- package/dist/kernel/audit/sinks/sink.d.ts.map +1 -0
- package/dist/kernel/audit/sinks/sink.js +9 -0
- package/dist/kernel/audit/sinks/sink.js.map +1 -0
- package/dist/kernel/audit/sinks/webhook.d.ts +29 -0
- package/dist/kernel/audit/sinks/webhook.d.ts.map +1 -0
- package/dist/kernel/audit/sinks/webhook.js +49 -0
- package/dist/kernel/audit/sinks/webhook.js.map +1 -0
- package/dist/kernel/audit/store.d.ts +158 -0
- package/dist/kernel/audit/store.d.ts.map +1 -0
- package/dist/kernel/audit/store.js +155 -0
- package/dist/kernel/audit/store.js.map +1 -0
- package/dist/kernel/audit/types.d.ts +136 -0
- package/dist/kernel/audit/types.d.ts.map +1 -0
- package/dist/kernel/audit/types.js +2 -0
- package/dist/kernel/audit/types.js.map +1 -0
- package/dist/kernel/audit/verify.d.ts +22 -0
- package/dist/kernel/audit/verify.d.ts.map +1 -0
- package/dist/kernel/audit/verify.js +96 -0
- package/dist/kernel/audit/verify.js.map +1 -0
- package/dist/kernel/audit/writer.d.ts +85 -0
- package/dist/kernel/audit/writer.d.ts.map +1 -0
- package/dist/kernel/audit/writer.js +255 -0
- package/dist/kernel/audit/writer.js.map +1 -0
- package/dist/kernel/config/env.d.ts +119 -0
- package/dist/kernel/config/env.d.ts.map +1 -0
- package/dist/kernel/config/env.js +173 -0
- package/dist/kernel/config/env.js.map +1 -0
- package/dist/kernel/config/load.d.ts +51 -0
- package/dist/kernel/config/load.d.ts.map +1 -0
- package/dist/kernel/config/load.js +102 -0
- package/dist/kernel/config/load.js.map +1 -0
- package/dist/kernel/coordination/memory.d.ts +20 -0
- package/dist/kernel/coordination/memory.d.ts.map +1 -0
- package/dist/kernel/coordination/memory.js +92 -0
- package/dist/kernel/coordination/memory.js.map +1 -0
- package/dist/kernel/coordination/postgres.d.ts +47 -0
- package/dist/kernel/coordination/postgres.d.ts.map +1 -0
- package/dist/kernel/coordination/postgres.js +111 -0
- package/dist/kernel/coordination/postgres.js.map +1 -0
- package/dist/kernel/coordination/types.d.ts +37 -0
- package/dist/kernel/coordination/types.d.ts.map +1 -0
- package/dist/kernel/coordination/types.js +2 -0
- package/dist/kernel/coordination/types.js.map +1 -0
- package/dist/kernel/coordination/wait.d.ts +4 -0
- package/dist/kernel/coordination/wait.d.ts.map +1 -0
- package/dist/kernel/coordination/wait.js +38 -0
- package/dist/kernel/coordination/wait.js.map +1 -0
- package/dist/kernel/db/columns.d.ts +25 -0
- package/dist/kernel/db/columns.d.ts.map +1 -0
- package/dist/kernel/db/columns.js +32 -0
- package/dist/kernel/db/columns.js.map +1 -0
- package/dist/kernel/db/empty-in-plugin.d.ts +7 -0
- package/dist/kernel/db/empty-in-plugin.d.ts.map +1 -0
- package/dist/kernel/db/empty-in-plugin.js +28 -0
- package/dist/kernel/db/empty-in-plugin.js.map +1 -0
- package/dist/kernel/db/index.d.ts +67 -0
- package/dist/kernel/db/index.d.ts.map +1 -0
- package/dist/kernel/db/index.js +72 -0
- package/dist/kernel/db/index.js.map +1 -0
- package/dist/kernel/db/migrations/audit/0006_audit.d.ts +7 -0
- package/dist/kernel/db/migrations/audit/0006_audit.d.ts.map +1 -0
- package/dist/kernel/db/migrations/audit/0006_audit.js +125 -0
- package/dist/kernel/db/migrations/audit/0006_audit.js.map +1 -0
- package/dist/kernel/db/migrations/audit/0007_metrics.d.ts +6 -0
- package/dist/kernel/db/migrations/audit/0007_metrics.d.ts.map +1 -0
- package/dist/kernel/db/migrations/audit/0007_metrics.js +38 -0
- package/dist/kernel/db/migrations/audit/0007_metrics.js.map +1 -0
- package/dist/kernel/db/migrations/index.d.ts +10 -0
- package/dist/kernel/db/migrations/index.d.ts.map +1 -0
- package/dist/kernel/db/migrations/index.js +15 -0
- package/dist/kernel/db/migrations/index.js.map +1 -0
- package/dist/kernel/db/migrations/main/0001_core.d.ts +4 -0
- package/dist/kernel/db/migrations/main/0001_core.d.ts.map +1 -0
- package/dist/kernel/db/migrations/main/0001_core.js +178 -0
- package/dist/kernel/db/migrations/main/0001_core.js.map +1 -0
- package/dist/kernel/db/migrations/main/0002_servers.d.ts +4 -0
- package/dist/kernel/db/migrations/main/0002_servers.d.ts.map +1 -0
- package/dist/kernel/db/migrations/main/0002_servers.js +240 -0
- package/dist/kernel/db/migrations/main/0002_servers.js.map +1 -0
- package/dist/kernel/db/migrations/main/0003_auth.d.ts +4 -0
- package/dist/kernel/db/migrations/main/0003_auth.d.ts.map +1 -0
- package/dist/kernel/db/migrations/main/0003_auth.js +125 -0
- package/dist/kernel/db/migrations/main/0003_auth.js.map +1 -0
- package/dist/kernel/db/migrations/main/0004_ops.d.ts +4 -0
- package/dist/kernel/db/migrations/main/0004_ops.d.ts.map +1 -0
- package/dist/kernel/db/migrations/main/0004_ops.js +196 -0
- package/dist/kernel/db/migrations/main/0004_ops.js.map +1 -0
- package/dist/kernel/db/migrations/main/0005_evals.d.ts +4 -0
- package/dist/kernel/db/migrations/main/0005_evals.d.ts.map +1 -0
- package/dist/kernel/db/migrations/main/0005_evals.js +117 -0
- package/dist/kernel/db/migrations/main/0005_evals.js.map +1 -0
- package/dist/kernel/db/migrations/types.d.ts +17 -0
- package/dist/kernel/db/migrations/types.d.ts.map +1 -0
- package/dist/kernel/db/migrations/types.js +7 -0
- package/dist/kernel/db/migrations/types.js.map +1 -0
- package/dist/kernel/db/migrator.d.ts +29 -0
- package/dist/kernel/db/migrator.d.ts.map +1 -0
- package/dist/kernel/db/migrator.js +64 -0
- package/dist/kernel/db/migrator.js.map +1 -0
- package/dist/kernel/db/postgres.d.ts +35 -0
- package/dist/kernel/db/postgres.d.ts.map +1 -0
- package/dist/kernel/db/postgres.js +44 -0
- package/dist/kernel/db/postgres.js.map +1 -0
- package/dist/kernel/db/schema.d.ts +936 -0
- package/dist/kernel/db/schema.d.ts.map +1 -0
- package/dist/kernel/db/schema.js +61 -0
- package/dist/kernel/db/schema.js.map +1 -0
- package/dist/kernel/db/sqlite.d.ts +20 -0
- package/dist/kernel/db/sqlite.d.ts.map +1 -0
- package/dist/kernel/db/sqlite.js +31 -0
- package/dist/kernel/db/sqlite.js.map +1 -0
- package/dist/kernel/db/tools-fts.d.ts +11 -0
- package/dist/kernel/db/tools-fts.d.ts.map +1 -0
- package/dist/kernel/db/tools-fts.js +17 -0
- package/dist/kernel/db/tools-fts.js.map +1 -0
- package/dist/kernel/db/url.d.ts +17 -0
- package/dist/kernel/db/url.d.ts.map +1 -0
- package/dist/kernel/db/url.js +30 -0
- package/dist/kernel/db/url.js.map +1 -0
- package/dist/kernel/jobs/jobs.service.d.ts +24 -0
- package/dist/kernel/jobs/jobs.service.d.ts.map +1 -0
- package/dist/kernel/jobs/jobs.service.js +65 -0
- package/dist/kernel/jobs/jobs.service.js.map +1 -0
- package/dist/kernel/jobs/scheduler.d.ts +34 -0
- package/dist/kernel/jobs/scheduler.d.ts.map +1 -0
- package/dist/kernel/jobs/scheduler.js +70 -0
- package/dist/kernel/jobs/scheduler.js.map +1 -0
- package/dist/kernel/lib/clock.d.ts +11 -0
- package/dist/kernel/lib/clock.d.ts.map +1 -0
- package/dist/kernel/lib/clock.js +15 -0
- package/dist/kernel/lib/clock.js.map +1 -0
- package/dist/kernel/lib/crypto.d.ts +12 -0
- package/dist/kernel/lib/crypto.d.ts.map +1 -0
- package/dist/kernel/lib/crypto.js +48 -0
- package/dist/kernel/lib/crypto.js.map +1 -0
- package/dist/kernel/lib/errors.d.ts +29 -0
- package/dist/kernel/lib/errors.d.ts.map +1 -0
- package/dist/kernel/lib/errors.js +40 -0
- package/dist/kernel/lib/errors.js.map +1 -0
- package/dist/kernel/lib/histogram.d.ts +28 -0
- package/dist/kernel/lib/histogram.d.ts.map +1 -0
- package/dist/kernel/lib/histogram.js +70 -0
- package/dist/kernel/lib/histogram.js.map +1 -0
- package/dist/kernel/lib/ids.d.ts +3 -0
- package/dist/kernel/lib/ids.d.ts.map +1 -0
- package/dist/kernel/lib/ids.js +6 -0
- package/dist/kernel/lib/ids.js.map +1 -0
- package/dist/kernel/lib/jcs.d.ts +5 -0
- package/dist/kernel/lib/jcs.d.ts.map +1 -0
- package/dist/kernel/lib/jcs.js +14 -0
- package/dist/kernel/lib/jcs.js.map +1 -0
- package/dist/kernel/lib/json.d.ts +9 -0
- package/dist/kernel/lib/json.d.ts.map +1 -0
- package/dist/kernel/lib/json.js +21 -0
- package/dist/kernel/lib/json.js.map +1 -0
- package/dist/kernel/lib/keyset.d.ts +25 -0
- package/dist/kernel/lib/keyset.d.ts.map +1 -0
- package/dist/kernel/lib/keyset.js +36 -0
- package/dist/kernel/lib/keyset.js.map +1 -0
- package/dist/kernel/lib/logger.d.ts +12 -0
- package/dist/kernel/lib/logger.d.ts.map +1 -0
- package/dist/kernel/lib/logger.js +41 -0
- package/dist/kernel/lib/logger.js.map +1 -0
- package/dist/kernel/lib/net/safe-fetch.d.ts +36 -0
- package/dist/kernel/lib/net/safe-fetch.d.ts.map +1 -0
- package/dist/kernel/lib/net/safe-fetch.js +106 -0
- package/dist/kernel/lib/net/safe-fetch.js.map +1 -0
- package/dist/kernel/lib/net/ssrf-guard.d.ts +30 -0
- package/dist/kernel/lib/net/ssrf-guard.d.ts.map +1 -0
- package/dist/kernel/lib/net/ssrf-guard.js +78 -0
- package/dist/kernel/lib/net/ssrf-guard.js.map +1 -0
- package/dist/kernel/lib/pagination.d.ts +14 -0
- package/dist/kernel/lib/pagination.d.ts.map +1 -0
- package/dist/kernel/lib/pagination.js +40 -0
- package/dist/kernel/lib/pagination.js.map +1 -0
- package/dist/kernel/observability/metrics.d.ts +53 -0
- package/dist/kernel/observability/metrics.d.ts.map +1 -0
- package/dist/kernel/observability/metrics.js +95 -0
- package/dist/kernel/observability/metrics.js.map +1 -0
- package/dist/kernel/observability/tracing.d.ts +32 -0
- package/dist/kernel/observability/tracing.d.ts.map +1 -0
- package/dist/kernel/observability/tracing.js +116 -0
- package/dist/kernel/observability/tracing.js.map +1 -0
- package/dist/kernel/principal.d.ts +16 -0
- package/dist/kernel/principal.d.ts.map +1 -0
- package/dist/kernel/principal.js +9 -0
- package/dist/kernel/principal.js.map +1 -0
- package/dist/kernel/runtime-config.d.ts +194 -0
- package/dist/kernel/runtime-config.d.ts.map +1 -0
- package/dist/kernel/runtime-config.js +192 -0
- package/dist/kernel/runtime-config.js.map +1 -0
- package/dist/kernel/secrets/builtin.provider.d.ts +26 -0
- package/dist/kernel/secrets/builtin.provider.d.ts.map +1 -0
- package/dist/kernel/secrets/builtin.provider.js +65 -0
- package/dist/kernel/secrets/builtin.provider.js.map +1 -0
- package/dist/kernel/secrets/envelope.d.ts +16 -0
- package/dist/kernel/secrets/envelope.d.ts.map +1 -0
- package/dist/kernel/secrets/envelope.js +44 -0
- package/dist/kernel/secrets/envelope.js.map +1 -0
- package/dist/kernel/secrets/envelope.service.d.ts +38 -0
- package/dist/kernel/secrets/envelope.service.d.ts.map +1 -0
- package/dist/kernel/secrets/envelope.service.js +86 -0
- package/dist/kernel/secrets/envelope.service.js.map +1 -0
- package/dist/kernel/secrets/keyring.d.ts +30 -0
- package/dist/kernel/secrets/keyring.d.ts.map +1 -0
- package/dist/kernel/secrets/keyring.js +32 -0
- package/dist/kernel/secrets/keyring.js.map +1 -0
- package/dist/kernel/secrets/named-secrets.d.ts +33 -0
- package/dist/kernel/secrets/named-secrets.d.ts.map +1 -0
- package/dist/kernel/secrets/named-secrets.js +63 -0
- package/dist/kernel/secrets/named-secrets.js.map +1 -0
- package/dist/kernel/secrets/provider.d.ts +17 -0
- package/dist/kernel/secrets/provider.d.ts.map +1 -0
- package/dist/kernel/secrets/provider.js +2 -0
- package/dist/kernel/secrets/provider.js.map +1 -0
- package/dist/kernel/secrets/rotation.d.ts +25 -0
- package/dist/kernel/secrets/rotation.d.ts.map +1 -0
- package/dist/kernel/secrets/rotation.js +32 -0
- package/dist/kernel/secrets/rotation.js.map +1 -0
- package/dist/kernel/settings/settings.service.d.ts +98 -0
- package/dist/kernel/settings/settings.service.d.ts.map +1 -0
- package/dist/kernel/settings/settings.service.js +92 -0
- package/dist/kernel/settings/settings.service.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +39 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.d.ts +5 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +58 -0
- package/dist/routes.js.map +1 -0
- package/dist/scripts/fetch-model.d.ts +2 -0
- package/dist/scripts/fetch-model.d.ts.map +1 -0
- package/dist/scripts/fetch-model.js +34 -0
- package/dist/scripts/fetch-model.js.map +1 -0
- package/dist/scripts/gen-schema.d.ts +2 -0
- package/dist/scripts/gen-schema.d.ts.map +1 -0
- package/dist/scripts/gen-schema.js +71 -0
- package/dist/scripts/gen-schema.js.map +1 -0
- package/dist/scripts/keys.d.ts +2 -0
- package/dist/scripts/keys.d.ts.map +1 -0
- package/dist/scripts/keys.js +24 -0
- package/dist/scripts/keys.js.map +1 -0
- package/dist/scripts/migrate.d.ts +2 -0
- package/dist/scripts/migrate.d.ts.map +1 -0
- package/dist/scripts/migrate.js +45 -0
- package/dist/scripts/migrate.js.map +1 -0
- package/dist/server.d.ts +30 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +129 -0
- package/dist/server.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/dist/web/static.d.ts +30 -0
- package/dist/web/static.d.ts.map +1 -0
- package/dist/web/static.js +65 -0
- package/dist/web/static.js.map +1 -0
- package/package.json +106 -4
- package/web-dist/assets/CompositeItem-B2Bd2eM-.js +2 -0
- package/web-dist/assets/CompositeItem-B2Bd2eM-.js.map +1 -0
- package/web-dist/assets/DialogRoot-h0udFiba.js +2 -0
- package/web-dist/assets/DialogRoot-h0udFiba.js.map +1 -0
- package/web-dist/assets/DialogTitle-fTXvJGbH.js +2 -0
- package/web-dist/assets/DialogTitle-fTXvJGbH.js.map +1 -0
- package/web-dist/assets/DirectionContext-CRBE3EOa.js +2 -0
- package/web-dist/assets/DirectionContext-CRBE3EOa.js.map +1 -0
- package/web-dist/assets/FieldItemContext-B4r08RkZ.js +2 -0
- package/web-dist/assets/FieldItemContext-B4r08RkZ.js.map +1 -0
- package/web-dist/assets/FloatingPortal-D_eDEbvZ.js +2 -0
- package/web-dist/assets/FloatingPortal-D_eDEbvZ.js.map +1 -0
- package/web-dist/assets/FloatingPortalLite-DWlDzoqv.js +2 -0
- package/web-dist/assets/FloatingPortalLite-DWlDzoqv.js.map +1 -0
- package/web-dist/assets/Separator-DDDyVkeP.js +2 -0
- package/web-dist/assets/Separator-DDDyVkeP.js.map +1 -0
- package/web-dist/assets/_app-BY6-IpyI.js +2 -0
- package/web-dist/assets/_app-BY6-IpyI.js.map +1 -0
- package/web-dist/assets/_app-Ba10rJVa.js +2 -0
- package/web-dist/assets/_app-Ba10rJVa.js.map +1 -0
- package/web-dist/assets/_app-Bv2dBVot.js +2 -0
- package/web-dist/assets/_app-Bv2dBVot.js.map +1 -0
- package/web-dist/assets/_groupId-ENiG99V5.js +2 -0
- package/web-dist/assets/_groupId-ENiG99V5.js.map +1 -0
- package/web-dist/assets/_issueId-CAHjIiZ8.js +2 -0
- package/web-dist/assets/_issueId-CAHjIiZ8.js.map +1 -0
- package/web-dist/assets/_runId-XmmZmpWa.js +4 -0
- package/web-dist/assets/_runId-XmmZmpWa.js.map +1 -0
- package/web-dist/assets/_serverId-C9y6ztaL.js +2 -0
- package/web-dist/assets/_serverId-C9y6ztaL.js.map +1 -0
- package/web-dist/assets/_taskId-D8fVBV_H.js +2 -0
- package/web-dist/assets/_taskId-D8fVBV_H.js.map +1 -0
- package/web-dist/assets/_toolId-CnbF7zls.js +6 -0
- package/web-dist/assets/_toolId-CnbF7zls.js.map +1 -0
- package/web-dist/assets/alert-OPOFnW2X.js +2 -0
- package/web-dist/assets/alert-OPOFnW2X.js.map +1 -0
- package/web-dist/assets/api-client-CnTzbAbK.js +56 -0
- package/web-dist/assets/api-client-CnTzbAbK.js.map +1 -0
- package/web-dist/assets/appearance-D7nZLK7y.js +2 -0
- package/web-dist/assets/appearance-D7nZLK7y.js.map +1 -0
- package/web-dist/assets/arrow-up-Dop2Zfy9.js +2 -0
- package/web-dist/assets/arrow-up-Dop2Zfy9.js.map +1 -0
- package/web-dist/assets/audit-Cws4Sb1Z.js +2 -0
- package/web-dist/assets/audit-Cws4Sb1Z.js.map +1 -0
- package/web-dist/assets/button-0-kx6BS-.js +2 -0
- package/web-dist/assets/button-0-kx6BS-.js.map +1 -0
- package/web-dist/assets/card-bOMGzWND.js +2 -0
- package/web-dist/assets/card-bOMGzWND.js.map +1 -0
- package/web-dist/assets/chevron-right-jlmAjiMj.js +2 -0
- package/web-dist/assets/chevron-right-jlmAjiMj.js.map +1 -0
- package/web-dist/assets/client-snippet-DyzxqQDv.js +2 -0
- package/web-dist/assets/client-snippet-DyzxqQDv.js.map +1 -0
- package/web-dist/assets/code-view-Dp3S3g6k.js +4 -0
- package/web-dist/assets/code-view-Dp3S3g6k.js.map +1 -0
- package/web-dist/assets/compare-CHKwYuEP.js +2 -0
- package/web-dist/assets/compare-CHKwYuEP.js.map +1 -0
- package/web-dist/assets/components-CNkWqS3X.js +2 -0
- package/web-dist/assets/components-CNkWqS3X.js.map +1 -0
- package/web-dist/assets/components-DYbjYUzw.js +2 -0
- package/web-dist/assets/components-DYbjYUzw.js.map +1 -0
- package/web-dist/assets/composite-Bfwhy6qy.js +2 -0
- package/web-dist/assets/composite-Bfwhy6qy.js.map +1 -0
- package/web-dist/assets/confirm-dialog-BY5FJuQC.js +2 -0
- package/web-dist/assets/confirm-dialog-BY5FJuQC.js.map +1 -0
- package/web-dist/assets/connect-DEWuCUqH.js +2 -0
- package/web-dist/assets/connect-DEWuCUqH.js.map +1 -0
- package/web-dist/assets/core-CveQFPAO.js +13 -0
- package/web-dist/assets/core-CveQFPAO.js.map +1 -0
- package/web-dist/assets/create-key-dialog-DbtnDlv9.js +3 -0
- package/web-dist/assets/create-key-dialog-DbtnDlv9.js.map +1 -0
- package/web-dist/assets/createLucideIcon-4wkYGrAu.js +2 -0
- package/web-dist/assets/createLucideIcon-4wkYGrAu.js.map +1 -0
- package/web-dist/assets/crumbs-CFOzyevD.js +2 -0
- package/web-dist/assets/crumbs-CFOzyevD.js.map +1 -0
- package/web-dist/assets/data-table-DL8nsehq.js +2 -0
- package/web-dist/assets/data-table-DL8nsehq.js.map +1 -0
- package/web-dist/assets/download-BJL2mMMG.js +2 -0
- package/web-dist/assets/download-BJL2mMMG.js.map +1 -0
- package/web-dist/assets/download-Ct9K1Blk.js +2 -0
- package/web-dist/assets/download-Ct9K1Blk.js.map +1 -0
- package/web-dist/assets/draft-bar-DQo326FN.js +2 -0
- package/web-dist/assets/draft-bar-DQo326FN.js.map +1 -0
- package/web-dist/assets/engine-javascript-C30F4iNc.js +142 -0
- package/web-dist/assets/engine-javascript-C30F4iNc.js.map +1 -0
- package/web-dist/assets/env-summary-C8OSGAi1.js +2 -0
- package/web-dist/assets/env-summary-C8OSGAi1.js.map +1 -0
- package/web-dist/assets/environments-xDHrvcC0.js +2 -0
- package/web-dist/assets/environments-xDHrvcC0.js.map +1 -0
- package/web-dist/assets/evals-D103yj9M.js +2 -0
- package/web-dist/assets/evals-D103yj9M.js.map +1 -0
- package/web-dist/assets/file-drop-BUz7NVu0.js +2 -0
- package/web-dist/assets/file-drop-BUz7NVu0.js.map +1 -0
- package/web-dist/assets/file-text-BzSWwAXx.js +2 -0
- package/web-dist/assets/file-text-BzSWwAXx.js.map +1 -0
- package/web-dist/assets/file-up-DhxoycHf.js +2 -0
- package/web-dist/assets/file-up-DhxoycHf.js.map +1 -0
- package/web-dist/assets/gauge-DB20Sf_v.js +2 -0
- package/web-dist/assets/gauge-DB20Sf_v.js.map +1 -0
- package/web-dist/assets/github-dark-default-DXG-b-1a.js +2 -0
- package/web-dist/assets/github-dark-default-DXG-b-1a.js.map +1 -0
- package/web-dist/assets/github-light-default-BXViO-2h.js +2 -0
- package/web-dist/assets/github-light-default-BXViO-2h.js.map +1 -0
- package/web-dist/assets/graphql-CSsyTQ1B.js +2 -0
- package/web-dist/assets/graphql-CSsyTQ1B.js.map +1 -0
- package/web-dist/assets/inbox--axfoemS.js +2 -0
- package/web-dist/assets/inbox--axfoemS.js.map +1 -0
- package/web-dist/assets/inbox-Bg9XxN9I.js +2 -0
- package/web-dist/assets/inbox-Bg9XxN9I.js.map +1 -0
- package/web-dist/assets/index-CI-LmJP7.css +2 -0
- package/web-dist/assets/index-EqRZkjd6.js +17 -0
- package/web-dist/assets/index-EqRZkjd6.js.map +1 -0
- package/web-dist/assets/inertValue-BEKHztUQ.js +2 -0
- package/web-dist/assets/inertValue-BEKHztUQ.js.map +1 -0
- package/web-dist/assets/json-qhed-kSA.js +2 -0
- package/web-dist/assets/json-qhed-kSA.js.map +1 -0
- package/web-dist/assets/json-viewer-DFAY-JaC.js +2 -0
- package/web-dist/assets/json-viewer-DFAY-JaC.js.map +1 -0
- package/web-dist/assets/key-round-CPrc1zQr.js +2 -0
- package/web-dist/assets/key-round-CPrc1zQr.js.map +1 -0
- package/web-dist/assets/keys-D2H6bYnB.js +2 -0
- package/web-dist/assets/keys-D2H6bYnB.js.map +1 -0
- package/web-dist/assets/labels-B8sf8Hg_.js +2 -0
- package/web-dist/assets/labels-B8sf8Hg_.js.map +1 -0
- package/web-dist/assets/link-CByMaQfX.js +3 -0
- package/web-dist/assets/link-CByMaQfX.js.map +1 -0
- package/web-dist/assets/link-tabs-C06q3Y1p.js +2 -0
- package/web-dist/assets/link-tabs-C06q3Y1p.js.map +1 -0
- package/web-dist/assets/link-xDlPECzC.js +2 -0
- package/web-dist/assets/link-xDlPECzC.js.map +1 -0
- package/web-dist/assets/list-tree-Cq6aoA_B.js +2 -0
- package/web-dist/assets/list-tree-Cq6aoA_B.js.map +1 -0
- package/web-dist/assets/logged-out-Cia2QO9r.js +2 -0
- package/web-dist/assets/logged-out-Cia2QO9r.js.map +1 -0
- package/web-dist/assets/login-DgDPuB_V.js +2 -0
- package/web-dist/assets/login-DgDPuB_V.js.map +1 -0
- package/web-dist/assets/mode-recommendation-DoHGuZUm.js +2 -0
- package/web-dist/assets/mode-recommendation-DoHGuZUm.js.map +1 -0
- package/web-dist/assets/models-DPi2Bzvy.js +2 -0
- package/web-dist/assets/models-DPi2Bzvy.js.map +1 -0
- package/web-dist/assets/navigation-Crt8lW1m.js +2 -0
- package/web-dist/assets/navigation-Crt8lW1m.js.map +1 -0
- package/web-dist/assets/new-Ccw0Hlfl.js +5 -0
- package/web-dist/assets/new-Ccw0Hlfl.js.map +1 -0
- package/web-dist/assets/overlay-C_UeOJOw.js +2 -0
- package/web-dist/assets/overlay-C_UeOJOw.js.map +1 -0
- package/web-dist/assets/page-header-CHk7bso7.js +2 -0
- package/web-dist/assets/page-header-CHk7bso7.js.map +1 -0
- package/web-dist/assets/permissions-Bf3wb1Jv.js +2 -0
- package/web-dist/assets/permissions-Bf3wb1Jv.js.map +1 -0
- package/web-dist/assets/plug-CrM5MZO2.js +2 -0
- package/web-dist/assets/plug-CrM5MZO2.js.map +1 -0
- package/web-dist/assets/plus-C6_H380k.js +2 -0
- package/web-dist/assets/plus-C6_H380k.js.map +1 -0
- package/web-dist/assets/progress-DaZnZarb.js +2 -0
- package/web-dist/assets/progress-DaZnZarb.js.map +1 -0
- package/web-dist/assets/python-gzcpVVnB.js +2 -0
- package/web-dist/assets/python-gzcpVVnB.js.map +1 -0
- package/web-dist/assets/queries-3DiENdpp.js +2 -0
- package/web-dist/assets/queries-3DiENdpp.js.map +1 -0
- package/web-dist/assets/queries-CJD0QpGi.js +2 -0
- package/web-dist/assets/queries-CJD0QpGi.js.map +1 -0
- package/web-dist/assets/queries-CaU3gifI.js +2 -0
- package/web-dist/assets/queries-CaU3gifI.js.map +1 -0
- package/web-dist/assets/queries-DOMFJPBg.js +2 -0
- package/web-dist/assets/queries-DOMFJPBg.js.map +1 -0
- package/web-dist/assets/queries-DzYj_ZKK.js +2 -0
- package/web-dist/assets/queries-DzYj_ZKK.js.map +1 -0
- package/web-dist/assets/queries-O4X2594T.js +2 -0
- package/web-dist/assets/queries-O4X2594T.js.map +1 -0
- package/web-dist/assets/queries-iauKjcDt.js +2 -0
- package/web-dist/assets/queries-iauKjcDt.js.map +1 -0
- package/web-dist/assets/queries-yxFwGLDb.js +2 -0
- package/web-dist/assets/queries-yxFwGLDb.js.map +1 -0
- package/web-dist/assets/reason-parts-B6nt3n-F.js +2 -0
- package/web-dist/assets/reason-parts-B6nt3n-F.js.map +1 -0
- package/web-dist/assets/redirect-B4OxYbs2.js +2 -0
- package/web-dist/assets/redirect-B4OxYbs2.js.map +1 -0
- package/web-dist/assets/refresh-cw-Dk41furN.js +2 -0
- package/web-dist/assets/refresh-cw-Dk41furN.js.map +1 -0
- package/web-dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/web-dist/assets/route-Ba10rJVa.js +2 -0
- package/web-dist/assets/route-Ba10rJVa.js.map +1 -0
- package/web-dist/assets/route-DFvqBlRc.js +2 -0
- package/web-dist/assets/route-DFvqBlRc.js.map +1 -0
- package/web-dist/assets/score-ring-D3Ff8hXt.js +2 -0
- package/web-dist/assets/score-ring-D3Ff8hXt.js.map +1 -0
- package/web-dist/assets/section-Bq1blJ9c.js +2 -0
- package/web-dist/assets/section-Bq1blJ9c.js.map +1 -0
- package/web-dist/assets/segmented-RsFdV9xJ.js +2 -0
- package/web-dist/assets/segmented-RsFdV9xJ.js.map +1 -0
- package/web-dist/assets/separator-CcxDVEHH.js +2 -0
- package/web-dist/assets/separator-CcxDVEHH.js.map +1 -0
- package/web-dist/assets/server-BvD6BIlz.js +2 -0
- package/web-dist/assets/server-BvD6BIlz.js.map +1 -0
- package/web-dist/assets/server-switcher-hOm8Popx.js +2 -0
- package/web-dist/assets/server-switcher-hOm8Popx.js.map +1 -0
- package/web-dist/assets/servers-DBjU_qiZ.js +2 -0
- package/web-dist/assets/servers-DBjU_qiZ.js.map +1 -0
- package/web-dist/assets/settings-DCmODejD.js +2 -0
- package/web-dist/assets/settings-DCmODejD.js.map +1 -0
- package/web-dist/assets/settings-zp4uTZ2u.js +2 -0
- package/web-dist/assets/settings-zp4uTZ2u.js.map +1 -0
- package/web-dist/assets/sheet-CZ77BIgN.js +2 -0
- package/web-dist/assets/sheet-CZ77BIgN.js.map +1 -0
- package/web-dist/assets/skeleton-CuU6NqIG.js +2 -0
- package/web-dist/assets/skeleton-CuU6NqIG.js.map +1 -0
- package/web-dist/assets/sparkles-DMF5S9tx.js +2 -0
- package/web-dist/assets/sparkles-DMF5S9tx.js.map +1 -0
- package/web-dist/assets/spec-Bhk7L9IF.js +2 -0
- package/web-dist/assets/spec-Bhk7L9IF.js.map +1 -0
- package/web-dist/assets/spinner-BLf8_Ajk.js +2 -0
- package/web-dist/assets/spinner-BLf8_Ajk.js.map +1 -0
- package/web-dist/assets/states-Z2xH3pUB.js +2 -0
- package/web-dist/assets/states-Z2xH3pUB.js.map +1 -0
- package/web-dist/assets/storage-CuUK35fn.js +2 -0
- package/web-dist/assets/storage-CuUK35fn.js.map +1 -0
- package/web-dist/assets/store-SrwTVjPk.js +2 -0
- package/web-dist/assets/store-SrwTVjPk.js.map +1 -0
- package/web-dist/assets/switch-C_lbqEIt.js +2 -0
- package/web-dist/assets/switch-C_lbqEIt.js.map +1 -0
- package/web-dist/assets/tasks-CRKt_Suy.js +2 -0
- package/web-dist/assets/tasks-CRKt_Suy.js.map +1 -0
- package/web-dist/assets/timeline-Cye1s7g_.js +2 -0
- package/web-dist/assets/timeline-Cye1s7g_.js.map +1 -0
- package/web-dist/assets/tools-C5I1npEn.js +2 -0
- package/web-dist/assets/tools-C5I1npEn.js.map +1 -0
- package/web-dist/assets/tooltip--tDonqxM.js +2 -0
- package/web-dist/assets/tooltip--tDonqxM.js.map +1 -0
- package/web-dist/assets/use-cursor-stack-DIOApcfL.js +2 -0
- package/web-dist/assets/use-cursor-stack-DIOApcfL.js.map +1 -0
- package/web-dist/assets/use-debounced-value-CSowsQHr.js +2 -0
- package/web-dist/assets/use-debounced-value-CSowsQHr.js.map +1 -0
- package/web-dist/assets/use-min-width-b55txtG6.js +2 -0
- package/web-dist/assets/use-min-width-b55txtG6.js.map +1 -0
- package/web-dist/assets/use-mobile-R850ZQZG.js +2 -0
- package/web-dist/assets/use-mobile-R850ZQZG.js.map +1 -0
- package/web-dist/assets/useAriaLabelledBy-DjHYrmeF.js +2 -0
- package/web-dist/assets/useAriaLabelledBy-DjHYrmeF.js.map +1 -0
- package/web-dist/assets/useBaseQuery-BoQjiPOp.js +2 -0
- package/web-dist/assets/useBaseQuery-BoQjiPOp.js.map +1 -0
- package/web-dist/assets/useBaseUiId-BUBV7JiZ.js +2 -0
- package/web-dist/assets/useBaseUiId-BUBV7JiZ.js.map +1 -0
- package/web-dist/assets/useButton-DQ6Sgg7h.js +2 -0
- package/web-dist/assets/useButton-DQ6Sgg7h.js.map +1 -0
- package/web-dist/assets/useControlled-B9BFcdfh.js +2 -0
- package/web-dist/assets/useControlled-B9BFcdfh.js.map +1 -0
- package/web-dist/assets/useNavigate-CrwlTILa.js +2 -0
- package/web-dist/assets/useNavigate-CrwlTILa.js.map +1 -0
- package/web-dist/assets/useOpenChangeComplete-DUM-_E2z.js +2 -0
- package/web-dist/assets/useOpenChangeComplete-DUM-_E2z.js.map +1 -0
- package/web-dist/assets/usePositioner-BQnDdcQL.js +2 -0
- package/web-dist/assets/usePositioner-BQnDdcQL.js.map +1 -0
- package/web-dist/assets/useQuery-BkgWvtTa.js +2 -0
- package/web-dist/assets/useQuery-BkgWvtTa.js.map +1 -0
- package/web-dist/assets/useRegisterFieldControl-DuodOtnM.js +2 -0
- package/web-dist/assets/useRegisterFieldControl-DuodOtnM.js.map +1 -0
- package/web-dist/assets/useRouterState-DeGPqG1m.js +2 -0
- package/web-dist/assets/useRouterState-DeGPqG1m.js.map +1 -0
- package/web-dist/assets/useScrollLock-BWBVawYJ.js +2 -0
- package/web-dist/assets/useScrollLock-BWBVawYJ.js.map +1 -0
- package/web-dist/assets/useTimeout-SGSgaiy1.js +2 -0
- package/web-dist/assets/useTimeout-SGSgaiy1.js.map +1 -0
- package/web-dist/assets/useTransitionStatus-Dy_zd4z2.js +2 -0
- package/web-dist/assets/useTransitionStatus-Dy_zd4z2.js.map +1 -0
- package/web-dist/assets/useTriggerFocusGuards-9VjGYE1p.js +2 -0
- package/web-dist/assets/useTriggerFocusGuards-9VjGYE1p.js.map +1 -0
- package/web-dist/assets/useValueChanged-BqSvidps.js +2 -0
- package/web-dist/assets/useValueChanged-BqSvidps.js.map +1 -0
- package/web-dist/assets/utils-BFSetRo1.js +2 -0
- package/web-dist/assets/utils-BFSetRo1.js.map +1 -0
- package/web-dist/assets/wrench-CIdGHcvJ.js +2 -0
- package/web-dist/assets/wrench-CIdGHcvJ.js.map +1 -0
- package/web-dist/assets/x-5OcgPlDp.js +2 -0
- package/web-dist/assets/x-5OcgPlDp.js.map +1 -0
- package/web-dist/assets/yaml-rwi0_p6S.js +2 -0
- package/web-dist/assets/yaml-rwi0_p6S.js.map +1 -0
- package/web-dist/favicon.svg +1 -0
- package/web-dist/index.html +55 -0
- package/web-dist/theme-init.js +44 -0
- package/README.md +0 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { ERROR_CATALOG, fillTemplate, META_ERROR_ID, META_NEXT_TOOLS, META_RETRY_AFTER_MS } from '@neurouter/shared';
|
|
3
|
+
import { toJsonColumn } from '../../kernel/lib/json.js';
|
|
4
|
+
const B62 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
5
|
+
export function base62(bytes, len) {
|
|
6
|
+
let out = '';
|
|
7
|
+
for (const b of randomBytes(bytes))
|
|
8
|
+
out += B62[b % 62];
|
|
9
|
+
return out.slice(0, len);
|
|
10
|
+
}
|
|
11
|
+
export const newErrorId = () => `err_${base62(24, 16)}`;
|
|
12
|
+
export const ERROR_EVENT_TTL_MS = 7 * 86_400_000;
|
|
13
|
+
/** Hints at the moment of need (§11.3). */
|
|
14
|
+
export function hintsFor(code) {
|
|
15
|
+
const out = ['neurouter_explain_error'];
|
|
16
|
+
if (['not_permitted', 'writes_disabled', 'unknown_tool', 'upstream_auth'].includes(code))
|
|
17
|
+
out.push('neurouter_whoami');
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
/** `error_events` rows (§7.2): what `neurouter_explain_error` explains. Detail must already be redacted. */
|
|
21
|
+
export class ErrorEvents {
|
|
22
|
+
db;
|
|
23
|
+
now;
|
|
24
|
+
constructor(db, now) {
|
|
25
|
+
this.db = db;
|
|
26
|
+
this.now = now;
|
|
27
|
+
}
|
|
28
|
+
async record(e) {
|
|
29
|
+
const errorId = newErrorId();
|
|
30
|
+
const t = this.now();
|
|
31
|
+
await this.db
|
|
32
|
+
.insertInto('error_events')
|
|
33
|
+
.values({ error_id: errorId, tenant_id: e.tenantId, task_id: e.taskId, audit_id: e.auditId, tool_name: e.toolName, code: e.code, detail: toJsonColumn(e.detail), created_at: t, expires_at: t + ERROR_EVENT_TTL_MS })
|
|
34
|
+
.execute();
|
|
35
|
+
return errorId;
|
|
36
|
+
}
|
|
37
|
+
async get(tenantId, errorId) {
|
|
38
|
+
const r = await this.db.selectFrom('error_events').selectAll().where('error_id', '=', errorId).where('tenant_id', '=', tenantId).executeTakeFirst();
|
|
39
|
+
if (!r || r.expires_at <= this.now())
|
|
40
|
+
return null;
|
|
41
|
+
const detail = typeof r.detail === 'string' ? JSON.parse(r.detail) : r.detail;
|
|
42
|
+
return { code: r.code, detail, toolName: r.tool_name, auditId: r.audit_id, taskId: r.task_id };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Explanation for an error code with its placeholders filled. */
|
|
46
|
+
export function explain(code, detail) {
|
|
47
|
+
const c = ERROR_CATALOG[code] ?? ERROR_CATALOG.upstream_error;
|
|
48
|
+
return { code, title: c.title, explanation: fillTemplate(c.explanation, detail), how_to_fix: fillTemplate(c.howToFix, detail) };
|
|
49
|
+
}
|
|
50
|
+
/** MCP error result (`isError: true`, not a JSON-RPC error) carrying error_id + next-tools (§9.6, §11.3). */
|
|
51
|
+
export function errorResult(message, errorId, code, extra = {}) {
|
|
52
|
+
const next = [...new Set([...(extra.nextTools ?? []), ...hintsFor(code)])];
|
|
53
|
+
const suffix = errorId ? ` (error_id=${errorId}; call neurouter_explain_error for how to fix)` : '';
|
|
54
|
+
const meta = { [META_NEXT_TOOLS]: next, ...(extra.meta ?? {}) };
|
|
55
|
+
if (errorId)
|
|
56
|
+
meta[META_ERROR_ID] = errorId;
|
|
57
|
+
if (extra.retryAfterMs !== undefined)
|
|
58
|
+
meta[META_RETRY_AFTER_MS] = extra.retryAfterMs;
|
|
59
|
+
return { content: [{ type: 'text', text: `${message}${suffix}` }], isError: true, structuredContent: { error: { code, message, ...(errorId ? { error_id: errorId } : {}) } }, _meta: meta };
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/dataplane/pipe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,IAAI,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC9L,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type AuditDecision, type AuditStatus, type ErrorCode, type PolicyStepName, type PolicyStepResult, type ToolDef } from '@neurouter/shared';
|
|
2
|
+
import type { AuditRecorder } from '../../kernel/audit/recorder.js';
|
|
3
|
+
import type { AuditEventInput } from '../../kernel/audit/types.js';
|
|
4
|
+
import type { Metrics } from '../../kernel/observability/metrics.js';
|
|
5
|
+
import type { CredentialResolver } from '../http/credentials.js';
|
|
6
|
+
import { type HttpInvoker, type MockUpstream } from '../http/invoker.js';
|
|
7
|
+
import type { RateLimiter } from '../rate-limit/limiter.js';
|
|
8
|
+
import type { ResultPages } from '../shaping/result-pages.js';
|
|
9
|
+
import type { TaskTracker } from '../tasks/tracker.js';
|
|
10
|
+
import type { ArgValidator } from './arg-validate.js';
|
|
11
|
+
import { type RunContext } from './context.js';
|
|
12
|
+
import { type ErrorEvents } from './errors.js';
|
|
13
|
+
export interface PolicyStep {
|
|
14
|
+
step: PolicyStepName;
|
|
15
|
+
result: PolicyStepResult;
|
|
16
|
+
detail?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface McpToolResult {
|
|
19
|
+
content: Array<{
|
|
20
|
+
type: 'text';
|
|
21
|
+
text: string;
|
|
22
|
+
}>;
|
|
23
|
+
structuredContent?: Record<string, unknown>;
|
|
24
|
+
isError?: boolean;
|
|
25
|
+
_meta?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export interface PlannedChange {
|
|
28
|
+
tool: string;
|
|
29
|
+
method: string;
|
|
30
|
+
path: string;
|
|
31
|
+
arguments: Record<string, unknown>;
|
|
32
|
+
wouldConfirm: boolean;
|
|
33
|
+
argsHash: string;
|
|
34
|
+
}
|
|
35
|
+
/** What the confirmation step asks the MCP layer (§9.7). */
|
|
36
|
+
export type ConfirmOutcome = {
|
|
37
|
+
status: 'approved';
|
|
38
|
+
} | {
|
|
39
|
+
status: 'declined';
|
|
40
|
+
} | {
|
|
41
|
+
status: 'unsupported';
|
|
42
|
+
} | {
|
|
43
|
+
status: 'pending';
|
|
44
|
+
result: unknown;
|
|
45
|
+
};
|
|
46
|
+
export interface Confirmer {
|
|
47
|
+
confirm(req: {
|
|
48
|
+
tool: ToolDef;
|
|
49
|
+
args: Record<string, unknown>;
|
|
50
|
+
argsHash: string;
|
|
51
|
+
message: string;
|
|
52
|
+
}): Promise<ConfirmOutcome>;
|
|
53
|
+
}
|
|
54
|
+
export interface InvokeOptions {
|
|
55
|
+
/** Resolve by Python name (`ns.fn`) instead of the MCP name (scripts). */
|
|
56
|
+
byPyName?: boolean;
|
|
57
|
+
confirmer?: Confirmer | null;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
/** Collect planned writes (dry-run scripts). */
|
|
60
|
+
planned?: PlannedChange[];
|
|
61
|
+
}
|
|
62
|
+
export interface ToolOutcome {
|
|
63
|
+
ok: boolean;
|
|
64
|
+
/** true when the tool is unknown/hidden/not permitted (direct MCP calls answer JSON-RPC -32602). */
|
|
65
|
+
unknown: boolean;
|
|
66
|
+
decision: AuditDecision;
|
|
67
|
+
status: AuditStatus;
|
|
68
|
+
result: McpToolResult;
|
|
69
|
+
/** Shaped JSON value (scripts get this as the function's return value). */
|
|
70
|
+
value?: unknown;
|
|
71
|
+
error?: {
|
|
72
|
+
code: ErrorCode;
|
|
73
|
+
message: string;
|
|
74
|
+
errorId: string | null;
|
|
75
|
+
};
|
|
76
|
+
auditId: string;
|
|
77
|
+
/** MRTR `input_required` result for a pending prod confirmation. */
|
|
78
|
+
inputRequired?: unknown;
|
|
79
|
+
tool?: ToolDef;
|
|
80
|
+
}
|
|
81
|
+
export interface PipelineDeps {
|
|
82
|
+
audit: AuditRecorder;
|
|
83
|
+
tracker: TaskTracker;
|
|
84
|
+
limiter: RateLimiter;
|
|
85
|
+
args: ArgValidator;
|
|
86
|
+
credentials: CredentialResolver;
|
|
87
|
+
http: HttpInvoker;
|
|
88
|
+
mock: MockUpstream;
|
|
89
|
+
pages: ResultPages;
|
|
90
|
+
errors: ErrorEvents;
|
|
91
|
+
metrics?: Metrics;
|
|
92
|
+
now: () => number;
|
|
93
|
+
publicUrl: string;
|
|
94
|
+
version: string;
|
|
95
|
+
/** Records usage + traffic examples after a successful call (post-commit; never fails the call). */
|
|
96
|
+
onSuccess?: (ctx: RunContext, tool: ToolDef, args: Record<string, unknown>) => void;
|
|
97
|
+
log: {
|
|
98
|
+
warn: (o: object, m: string) => void;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export declare function argsHashOf(tool: string, args: Record<string, unknown>): string;
|
|
102
|
+
/** Finds a visible tool the principal may see (profile filter); hidden/out-of-profile = unknown (§18.3). */
|
|
103
|
+
export declare function resolveVisibleTool(ctx: RunContext, name: string, byPyName?: boolean): ToolDef | null;
|
|
104
|
+
/** Kill switch lookup (§9.6 step 2): global, server, environment, tool; kinds all / writes / code_mode. */
|
|
105
|
+
export declare function killSwitchFor(ctx: RunContext, tool: ToolDef | null, kinds: readonly ('all' | 'writes' | 'code_mode')[]): {
|
|
106
|
+
target: string;
|
|
107
|
+
kind: string;
|
|
108
|
+
reason: string;
|
|
109
|
+
} | null;
|
|
110
|
+
/** Whether a write tool is enabled in the environment (§9.7, read-only by default). */
|
|
111
|
+
export declare function writeEnabled(ctx: RunContext, tool: ToolDef): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The policy pipeline (§9.6). One implementation serves direct calls, `call_tool`, every inner call
|
|
114
|
+
* of a script and composite tools. Each step appends to `policy_trail`; every non-allowed outcome
|
|
115
|
+
* creates an `error_events` row and returns `error_id` + `next-tools` hints.
|
|
116
|
+
*/
|
|
117
|
+
export declare class Pipeline {
|
|
118
|
+
private readonly d;
|
|
119
|
+
constructor(d: PipelineDeps);
|
|
120
|
+
private base;
|
|
121
|
+
/** Shared audit base for other producers (search, ops, scripts). */
|
|
122
|
+
auditBase(ctx: RunContext): Omit<AuditEventInput, 'id' | 'ts' | 'kind' | 'decision' | 'status'>;
|
|
123
|
+
invoke(ctx: RunContext, name: string, rawArgs: Record<string, unknown>, opts?: InvokeOptions): Promise<ToolOutcome>;
|
|
124
|
+
plannedChange(tool: ToolDef, args: Record<string, unknown>, wouldConfirm: boolean, argsHash: string): PlannedChange;
|
|
125
|
+
confirmMessage(ctx: RunContext, tool: ToolDef, args: Record<string, unknown>): string;
|
|
126
|
+
private callMock;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/dataplane/pipeline/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAWL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AAE7G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM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QAAQ,CAAC;IAIzF,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAiS7H,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa;IAMnH,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;YASvE,QAAQ;CA2BvB"}
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { shapeResponse, wrapStructured } from '@neurouter/compiler';
|
|
2
|
+
import { META_CALL_ID, META_DRY_RUN, META_GRAPHQL_ERRORS, META_NEXT_TOOLS, META_RESULT_HANDLE, META_RETRY_AFTER_MS, META_TASK_ID, META_TRUNCATED, META_UNTRUSTED, META_UPSTREAM_HEADERS, } from '@neurouter/shared';
|
|
3
|
+
import { hashCanonical } from '../../kernel/lib/jcs.js';
|
|
4
|
+
import { newId } from '../../kernel/lib/ids.js';
|
|
5
|
+
import { InvokeError } from '../http/invoker.js';
|
|
6
|
+
import { buildHttpRequest, RequestBuildError, toSpecArgs, applyArgTransforms, hostAllowed } from '../http/request-builder.js';
|
|
7
|
+
import { scanUntrusted, UNTRUSTED_PREFIX } from '../shaping/sanitize.js';
|
|
8
|
+
import { principalUserId, traceIdOf } from './context.js';
|
|
9
|
+
import { errorResult } from './errors.js';
|
|
10
|
+
import { evaluatePolicies } from './policy.js';
|
|
11
|
+
const PREVIEW_TEXT_BYTES = 8192;
|
|
12
|
+
export function argsHashOf(tool, args) {
|
|
13
|
+
return hashCanonical({ tool, args });
|
|
14
|
+
}
|
|
15
|
+
function compactJson(v) {
|
|
16
|
+
const s = JSON.stringify(v);
|
|
17
|
+
if (s === undefined)
|
|
18
|
+
return 'null';
|
|
19
|
+
if (Buffer.byteLength(s) <= PREVIEW_TEXT_BYTES)
|
|
20
|
+
return s;
|
|
21
|
+
return `${Buffer.from(s).subarray(0, PREVIEW_TEXT_BYTES - 40).toString('utf8')}… (truncated preview)`;
|
|
22
|
+
}
|
|
23
|
+
/** Finds a visible tool the principal may see (profile filter); hidden/out-of-profile = unknown (§18.3). */
|
|
24
|
+
export function resolveVisibleTool(ctx, name, byPyName = false) {
|
|
25
|
+
const tools = ctx.bundle.build.tools;
|
|
26
|
+
const t = byPyName ? tools.find((x) => x.pyName === name) : tools.find((x) => x.name === name);
|
|
27
|
+
if (!t || t.hidden)
|
|
28
|
+
return null;
|
|
29
|
+
if (ctx.principal.type === 'api_key' && ctx.principal.profile) {
|
|
30
|
+
const allowed = ctx.bundle.build.profiles[ctx.principal.profile];
|
|
31
|
+
if (allowed && !allowed.includes(t.name))
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
/** Kill switch lookup (§9.6 step 2): global, server, environment, tool; kinds all / writes / code_mode. */
|
|
37
|
+
export function killSwitchFor(ctx, tool, kinds) {
|
|
38
|
+
const b = ctx.bundle;
|
|
39
|
+
for (const k of b.killSwitches) {
|
|
40
|
+
if (!kinds.includes(k.kind))
|
|
41
|
+
continue;
|
|
42
|
+
const hit = k.scope === 'global' ||
|
|
43
|
+
(k.scope === 'server' && (k.target === b.server.id || k.target === b.server.slug)) ||
|
|
44
|
+
(k.scope === 'environment' && (k.target === b.environment.id || k.target === `${b.server.slug}/${b.environment.slug}`)) ||
|
|
45
|
+
(k.scope === 'tool' && tool !== null && (k.target === `${b.server.slug}/${b.environment.slug}/${tool.name}` || k.target === `${b.server.slug}/*/${tool.name}`));
|
|
46
|
+
if (hit)
|
|
47
|
+
return { target: k.scope === 'global' ? 'Everything' : k.target, kind: k.kind, reason: k.reason };
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/** Whether a write tool is enabled in the environment (§9.7, read-only by default). */
|
|
52
|
+
export function writeEnabled(ctx, tool) {
|
|
53
|
+
const w = ctx.bundle.environment.writes;
|
|
54
|
+
if (!w.enabled)
|
|
55
|
+
return false;
|
|
56
|
+
return w.tools === null || w.tools.includes(tool.name);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The policy pipeline (§9.6). One implementation serves direct calls, `call_tool`, every inner call
|
|
60
|
+
* of a script and composite tools. Each step appends to `policy_trail`; every non-allowed outcome
|
|
61
|
+
* creates an `error_events` row and returns `error_id` + `next-tools` hints.
|
|
62
|
+
*/
|
|
63
|
+
export class Pipeline {
|
|
64
|
+
d;
|
|
65
|
+
constructor(d) {
|
|
66
|
+
this.d = d;
|
|
67
|
+
}
|
|
68
|
+
base(ctx) {
|
|
69
|
+
const p = ctx.principal;
|
|
70
|
+
return {
|
|
71
|
+
tenantId: ctx.tenantId,
|
|
72
|
+
requestId: ctx.requestId,
|
|
73
|
+
userId: principalUserId(p),
|
|
74
|
+
apiKeyId: p.type === 'api_key' ? p.apiKeyId : null,
|
|
75
|
+
oauthClientId: p.type === 'user' ? p.oauthClientId : null,
|
|
76
|
+
principalType: p.type,
|
|
77
|
+
externalSubject: p.type === 'external' ? p.subject : null,
|
|
78
|
+
credentialKey: ctx.credentialKey,
|
|
79
|
+
clientName: ctx.client.name,
|
|
80
|
+
clientVersion: ctx.client.version,
|
|
81
|
+
protocolVersion: ctx.client.protocolVersion,
|
|
82
|
+
clientEra: ctx.client.era,
|
|
83
|
+
serverId: ctx.server.id,
|
|
84
|
+
environmentId: ctx.environment.id,
|
|
85
|
+
environmentKind: ctx.environment.kind,
|
|
86
|
+
taskId: ctx.taskId,
|
|
87
|
+
scriptRunId: ctx.scriptRunId ?? null,
|
|
88
|
+
via: ctx.via,
|
|
89
|
+
mode: ctx.mode,
|
|
90
|
+
traceId: traceIdOf(ctx.traceparent),
|
|
91
|
+
ip: ctx.ip,
|
|
92
|
+
userAgent: ctx.userAgent,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Shared audit base for other producers (search, ops, scripts). */
|
|
96
|
+
auditBase(ctx) {
|
|
97
|
+
return this.base(ctx);
|
|
98
|
+
}
|
|
99
|
+
async invoke(ctx, name, rawArgs, opts = {}) {
|
|
100
|
+
const start = this.d.now();
|
|
101
|
+
const auditId = newId();
|
|
102
|
+
const trail = [];
|
|
103
|
+
const step = (s, r, detail) => trail.push({ step: s, result: r, ...(detail ? { detail } : {}) });
|
|
104
|
+
let tool = null;
|
|
105
|
+
let args = rawArgs;
|
|
106
|
+
const metaBase = () => ({ [META_CALL_ID]: auditId, ...(ctx.taskId ? { [META_TASK_ID]: ctx.taskId } : {}) });
|
|
107
|
+
const record = (decision, status, extra = {}) => {
|
|
108
|
+
step('audit', 'pass');
|
|
109
|
+
const write = tool?.risk.write ?? false;
|
|
110
|
+
this.d.audit.record({
|
|
111
|
+
...this.base(ctx),
|
|
112
|
+
id: auditId,
|
|
113
|
+
kind: 'tool_call',
|
|
114
|
+
toolName: tool?.name ?? name,
|
|
115
|
+
toolId: tool ? (ctx.bundle.build.toolRowIds[tool.name] ?? null) : null,
|
|
116
|
+
decision,
|
|
117
|
+
status,
|
|
118
|
+
params: args,
|
|
119
|
+
write,
|
|
120
|
+
dryRun: decision === 'dry_run',
|
|
121
|
+
confirm: decision === 'confirmed' ? 'elicited' : 'none',
|
|
122
|
+
policyTrail: trail,
|
|
123
|
+
latencyMs: this.d.now() - start,
|
|
124
|
+
...extra,
|
|
125
|
+
});
|
|
126
|
+
this.d.metrics?.toolCall(ctx.bundle.server.slug, ctx.bundle.environment.slug, tool?.name ?? name, ctx.via, decision, status, (this.d.now() - start) / 1000);
|
|
127
|
+
const blocked = decision.startsWith('denied_');
|
|
128
|
+
this.d.tracker.bump(ctx.taskId, { call_count: 1, ...(status !== 'ok' && !blocked ? { error_count: 1 } : {}), ...(blocked ? { blocked_count: 1 } : {}), ...(write && status === 'ok' && decision !== 'dry_run' ? { write_count: 1 } : {}) });
|
|
129
|
+
if (tool)
|
|
130
|
+
this.d.tracker.remember(ctx.taskId, { tool: tool.name, tags: tool.tags, ok: status === 'ok' && !blocked });
|
|
131
|
+
};
|
|
132
|
+
const fail = async (decision, status, code, message, detail, extra = {}) => {
|
|
133
|
+
let errorId = null;
|
|
134
|
+
try {
|
|
135
|
+
errorId = await this.d.errors.record({ tenantId: ctx.tenantId, taskId: ctx.taskId, auditId, toolName: tool?.name ?? name, code, detail: { tool: tool?.name ?? name, environment: ctx.environment.slug, ...detail } });
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
this.d.log.warn({ err }, 'error event not recorded');
|
|
139
|
+
}
|
|
140
|
+
record(decision, status, { errorCode: code, errorMessage: message.slice(0, 1000), errorId, decisionReason: code, ...(extra.audit ?? {}) });
|
|
141
|
+
const r = errorResult(message, errorId, code, { ...(extra.retryAfterMs !== undefined ? { retryAfterMs: extra.retryAfterMs } : {}), ...(extra.nextTools ? { nextTools: extra.nextTools } : {}), meta: metaBase() });
|
|
142
|
+
return { ok: false, unknown: extra.unknown ?? false, decision, status, result: r, error: { code, message, errorId }, auditId, ...(tool ? { tool } : {}) };
|
|
143
|
+
};
|
|
144
|
+
// 0 audit admission (fail closed, not audited)
|
|
145
|
+
if (!this.d.audit.canAccept()) {
|
|
146
|
+
return { ok: false, unknown: false, decision: 'denied_disabled', status: 'blocked', result: errorResult('Audit unavailable: tool calls are refused until audit logging recovers. Retry shortly.', null, 'audit_unavailable'), error: { code: 'audit_unavailable', message: 'Audit unavailable', errorId: null }, auditId };
|
|
147
|
+
}
|
|
148
|
+
// 1 resolve (hidden / out-of-profile = unknown; identical responses, §18.3)
|
|
149
|
+
tool = resolveVisibleTool(ctx, name, opts.byPyName);
|
|
150
|
+
if (!tool) {
|
|
151
|
+
step('resolve', 'fail', 'unknown');
|
|
152
|
+
const out = await fail('denied_acl', 'blocked', 'unknown_tool', `Tool not found or not permitted: ${name}. Use search_tools to find tools you can call.`, {}, { unknown: true, nextTools: ['search_tools'] });
|
|
153
|
+
return out;
|
|
154
|
+
}
|
|
155
|
+
step('resolve', 'pass', tool.name);
|
|
156
|
+
// 2 kill switches
|
|
157
|
+
const ks = killSwitchFor(ctx, tool, tool.risk.write ? ['all', 'writes'] : ['all']) ?? (ctx.via === 'script' ? killSwitchFor(ctx, tool, ['code_mode']) : null);
|
|
158
|
+
if (ks) {
|
|
159
|
+
step('kill_switch', 'fail', `${ks.kind}:${ks.target}`);
|
|
160
|
+
return fail('denied_disabled', 'blocked', 'kill_switch', `${tool.name} is disabled by the operator (${ks.kind}).`, { target: ks.target, kind: ks.kind, reason: ks.reason ? `: ${ks.reason}` : '' });
|
|
161
|
+
}
|
|
162
|
+
step('kill_switch', 'pass');
|
|
163
|
+
// 3 ACL: scopes
|
|
164
|
+
const scopes = ctx.principal.scopes;
|
|
165
|
+
if (!scopes.includes('tools:read')) {
|
|
166
|
+
step('acl', 'fail', 'tools:read');
|
|
167
|
+
return fail('denied_acl', 'blocked', 'not_permitted', `Your credential may not call tools (missing scope tools:read).`, { scope: 'tools:read' });
|
|
168
|
+
}
|
|
169
|
+
if (tool.risk.write && !scopes.includes('tools:write')) {
|
|
170
|
+
step('acl', 'fail', 'tools:write');
|
|
171
|
+
return fail('denied_acl', 'blocked', 'not_permitted', `${tool.name} changes data and your credential lacks the tools:write scope.`, { scope: 'tools:write' });
|
|
172
|
+
}
|
|
173
|
+
step('acl', 'pass');
|
|
174
|
+
// 4 read-only default
|
|
175
|
+
if (tool.risk.write && !writeEnabled(ctx, tool)) {
|
|
176
|
+
step('read_only', 'fail');
|
|
177
|
+
const w = ctx.bundle.environment.writes;
|
|
178
|
+
const allowList = w.enabled && w.tools ? ` (writes are enabled only for: ${w.tools.join(', ') || 'no tools'})` : ' (read-only)';
|
|
179
|
+
return fail('denied_read_only', 'blocked', 'writes_disabled', `Writes are off in the ${ctx.environment.slug} environment${allowList}; ${tool.name} was not called.`, { allowList });
|
|
180
|
+
}
|
|
181
|
+
step('read_only', tool.risk.write ? 'pass' : 'skip');
|
|
182
|
+
// 5 arguments: overlay defaults, ajv against the input schema (compiled per defHash)
|
|
183
|
+
args = applyArgTransforms(tool, rawArgs);
|
|
184
|
+
const check = this.d.args.check(tool.defHash, tool.inputSchema, args);
|
|
185
|
+
if (!check.ok) {
|
|
186
|
+
step('arguments', 'fail', check.errors.slice(0, 3).join('; '));
|
|
187
|
+
return fail('allowed', 'invalid_args', 'invalid_args', `Invalid arguments for ${tool.name}:\n- ${check.errors.join('\n- ')}`, { errors: check.errors.join('; '), schema: JSON.stringify(tool.inputSchema).slice(0, 1500) });
|
|
188
|
+
}
|
|
189
|
+
step('arguments', 'pass');
|
|
190
|
+
// 6 policies (incl. built-in no-raw-urls and data-flow rules over the task history)
|
|
191
|
+
const pol = evaluatePolicies(ctx.bundle.environment.policies, tool, args, this.d.tracker.callHistory(ctx.taskId), new Date(this.d.now()));
|
|
192
|
+
if (pol.deny) {
|
|
193
|
+
step('policy', 'fail', pol.policy);
|
|
194
|
+
return fail('denied_policy', 'blocked', 'policy_denied', `${pol.message} (policy ${pol.policy})`, { policy: pol.policy, message: pol.message });
|
|
195
|
+
}
|
|
196
|
+
step('policy', 'pass');
|
|
197
|
+
// 7 rate limits (principal, principal × tool)
|
|
198
|
+
const lim = ctx.bundle.environment.limits;
|
|
199
|
+
const principalLimit = ctx.principal.type === 'api_key' && ctx.principal.rateLimit ? ctx.principal.rateLimit : lim.rateLimit;
|
|
200
|
+
const rl = await this.d.limiter.take(this.d.limiter.checksFor({ environmentId: ctx.environment.id, credentialKey: ctx.credentialKey, tool: tool.name, principalLimit, toolLimit: lim.toolRateLimit }));
|
|
201
|
+
if (!rl.allowed) {
|
|
202
|
+
step('rate_limit', 'fail', rl.scope);
|
|
203
|
+
const secs = Math.max(1, Math.ceil(rl.retryAfterMs / 1000));
|
|
204
|
+
this.d.metrics?.rateLimited(rl.scope);
|
|
205
|
+
return fail('denied_rate_limit', 'blocked', 'rate_limited', `Rate limit exceeded for ${tool.name}; retry after ${secs}s.`, { retryAfterSec: secs, scopeDetail: ` (${rl.scope})` }, { retryAfterMs: rl.retryAfterMs });
|
|
206
|
+
}
|
|
207
|
+
step('rate_limit', 'pass');
|
|
208
|
+
const argsHash = argsHashOf(tool.name, args);
|
|
209
|
+
const isProdWrite = tool.risk.write && ctx.environment.kind === 'prod';
|
|
210
|
+
const confirmMode = ctx.bundle.environment.writes.confirm;
|
|
211
|
+
const wouldConfirm = isProdWrite && confirmMode !== 'none';
|
|
212
|
+
// 8 dry-run short-circuit
|
|
213
|
+
if (ctx.dryRun && tool.risk.write) {
|
|
214
|
+
step('dry_run', 'pass');
|
|
215
|
+
const planned = this.plannedChange(tool, args, wouldConfirm, argsHash);
|
|
216
|
+
opts.planned?.push(planned);
|
|
217
|
+
const value = { dry_run: true, planned: { tool: planned.tool, method: planned.method, path: planned.path, arguments: planned.arguments } };
|
|
218
|
+
record('dry_run', 'ok', { output: value });
|
|
219
|
+
return { ok: true, unknown: false, decision: 'dry_run', status: 'ok', value, result: { content: [{ type: 'text', text: compactJson(value) }], structuredContent: value, _meta: { ...metaBase(), [META_DRY_RUN]: true } }, auditId, tool };
|
|
220
|
+
}
|
|
221
|
+
step('dry_run', 'skip');
|
|
222
|
+
// 9 write confirmation on prod (§9.7)
|
|
223
|
+
let decision = 'allowed';
|
|
224
|
+
if (wouldConfirm) {
|
|
225
|
+
if (ctx.via === 'script' && ctx.approvedPlan) {
|
|
226
|
+
if (!ctx.approvedPlan.has(`${tool.name}|${argsHash}`)) {
|
|
227
|
+
step('confirm', 'fail', 'not in approved plan');
|
|
228
|
+
return fail('denied_confirmation', 'blocked', 'confirmation_declined', `This write is not in the approved plan; ${tool.name} was not called.`, {});
|
|
229
|
+
}
|
|
230
|
+
decision = 'confirmed';
|
|
231
|
+
step('confirm', 'pass', 'approved plan');
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const msg = this.confirmMessage(ctx, tool, args);
|
|
235
|
+
const out = opts.confirmer ? await opts.confirmer.confirm({ tool, args, argsHash, message: msg }) : { status: 'unsupported' };
|
|
236
|
+
if (out.status === 'pending') {
|
|
237
|
+
step('confirm', 'skip', 'elicitation sent');
|
|
238
|
+
return { ok: false, unknown: false, decision: 'allowed', status: 'ok', result: { content: [] }, auditId, inputRequired: out.result, tool };
|
|
239
|
+
}
|
|
240
|
+
if (out.status === 'unsupported') {
|
|
241
|
+
step('confirm', 'fail', 'unsupported');
|
|
242
|
+
return fail('denied_confirmation', 'blocked', 'confirmation_unsupported', 'This client cannot ask the user to confirm production writes.', {});
|
|
243
|
+
}
|
|
244
|
+
if (out.status === 'declined') {
|
|
245
|
+
step('confirm', 'fail', 'declined');
|
|
246
|
+
return fail('denied_confirmation', 'blocked', 'confirmation_declined', `The user declined ${tool.title || tool.name} in PROD.`, {});
|
|
247
|
+
}
|
|
248
|
+
decision = 'confirmed';
|
|
249
|
+
step('confirm', 'pass', 'elicited');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
step('confirm', 'skip');
|
|
254
|
+
// 10–11 routing, credentials, request build, invoke
|
|
255
|
+
if (tool.kind === 'composite') {
|
|
256
|
+
step('routing', 'fail', 'composite');
|
|
257
|
+
return fail(decision, 'tool_error', 'executor_unavailable', `${tool.name} is a composite tool; it runs through code mode.`, {});
|
|
258
|
+
}
|
|
259
|
+
let upstream;
|
|
260
|
+
const env = ctx.bundle.environment;
|
|
261
|
+
const specArgs = toSpecArgs(tool, args);
|
|
262
|
+
let urlTemplate = '';
|
|
263
|
+
try {
|
|
264
|
+
if (env.isMock) {
|
|
265
|
+
step('routing', 'pass', 'mock');
|
|
266
|
+
upstream = await this.callMock(ctx, tool, specArgs);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const cred = await this.d.credentials.resolve(env.auth, {
|
|
270
|
+
environmentId: env.id,
|
|
271
|
+
userId: principalUserId(ctx.principal),
|
|
272
|
+
inbound: ctx.principal.type === 'external' ? { bearer: ctx.principal.bearer, audiences: (ctx.principal.audiences ?? []) } : null,
|
|
273
|
+
publicUrl: this.d.publicUrl,
|
|
274
|
+
});
|
|
275
|
+
if (!cred.ok) {
|
|
276
|
+
step('routing', 'fail', cred.code);
|
|
277
|
+
if (cred.code === 'credential_missing')
|
|
278
|
+
return fail(decision, 'tool_error', 'credential_missing', `The ${env.slug} environment has no credential configured.`, { ref: cred.ref });
|
|
279
|
+
return fail(decision, 'tool_error', 'upstream_auth_required', `Connect your account first: ${cred.connectUrl}`, { connectUrl: cred.connectUrl });
|
|
280
|
+
}
|
|
281
|
+
step('routing', 'pass', env.baseUrl);
|
|
282
|
+
if (tool.binding.type === 'graphql') {
|
|
283
|
+
const base = new URL(env.baseUrl);
|
|
284
|
+
const url = new URL(base.origin + base.pathname.replace(/\/$/, '') + (tool.binding.endpointPath ?? ''));
|
|
285
|
+
if (!hostAllowed(url, env.allowedHosts))
|
|
286
|
+
throw new RequestBuildError(`host ${url.host} is not in allowedHosts`, 'host_not_allowed');
|
|
287
|
+
urlTemplate = url.pathname;
|
|
288
|
+
const variables = Object.fromEntries(tool.binding.variables.map((v) => [v.name, specArgs[v.arg]]).filter(([, v]) => v !== undefined));
|
|
289
|
+
upstream = await this.d.http.invoke(env.id, { method: 'POST', url, urlTemplate, headers: { accept: 'application/json', 'content-type': 'application/json', 'user-agent': `neurouter/${this.d.version}`, ...lower(env.headers), ...cred.headers }, body: JSON.stringify({ query: tool.binding.document, variables }) }, { timeoutMs: lim.timeoutMs, maxBytes: lim.maxResponseBytes, allowHttp: env.allowHttp, ...(opts.signal ? { signal: opts.signal } : {}) });
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
const req = buildHttpRequest(tool, specArgs, { baseUrl: env.baseUrl, headers: env.headers, allowedHosts: env.allowedHosts, credentials: cred }, this.d.version);
|
|
293
|
+
urlTemplate = req.urlTemplate;
|
|
294
|
+
upstream = await this.d.http.invoke(env.id, req, { timeoutMs: lim.timeoutMs, maxBytes: lim.maxResponseBytes, allowHttp: env.allowHttp, ...(opts.signal ? { signal: opts.signal } : {}) });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
step('upstream', 'pass', String(upstream.status));
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
if (err instanceof RequestBuildError) {
|
|
301
|
+
step('routing', 'fail', err.code);
|
|
302
|
+
if (err.code === 'host_not_allowed')
|
|
303
|
+
return fail('denied_policy', 'blocked', 'policy_denied', err.message, { policy: 'allowed-hosts', message: err.message });
|
|
304
|
+
return fail(decision, 'invalid_args', 'invalid_args', err.message, { errors: err.message });
|
|
305
|
+
}
|
|
306
|
+
const ie = err instanceof InvokeError ? err : new InvokeError(err.message, 'transport');
|
|
307
|
+
step('upstream', 'fail', ie.kind);
|
|
308
|
+
if (ie.kind === 'cancelled') {
|
|
309
|
+
record(decision, 'cancelled', { errorCode: 'cancelled' });
|
|
310
|
+
return { ok: false, unknown: false, decision, status: 'cancelled', result: errorResult('Cancelled', null, 'upstream_error'), auditId, tool };
|
|
311
|
+
}
|
|
312
|
+
if (ie.kind === 'timeout')
|
|
313
|
+
return fail(decision, 'timeout', 'timeout', `The API did not answer within ${lim.timeoutMs} ms.`, { timeoutMs: lim.timeoutMs });
|
|
314
|
+
if (ie.kind === 'response_too_large')
|
|
315
|
+
return fail(decision, 'upstream_error', 'response_too_large', `The API response exceeded ${lim.maxResponseBytes} bytes.`, { maxBytes: lim.maxResponseBytes });
|
|
316
|
+
if (ie.kind === 'blocked')
|
|
317
|
+
return fail('denied_policy', 'blocked', 'policy_denied', 'The upstream address is not allowed by the outbound network policy.', { policy: 'ssrf-guard', message: 'blocked address' });
|
|
318
|
+
return fail(decision, 'upstream_error', 'upstream_error', `The API is unreachable (${ie.kind}).`, { detail: ie.message.slice(0, 300) });
|
|
319
|
+
}
|
|
320
|
+
// 12 response: status mapping, redact/shaping/truncation, untrusted scan
|
|
321
|
+
const upstreamMeta = { upstreamStatus: upstream.status, upstreamLatencyMs: upstream.latencyMs };
|
|
322
|
+
const st = upstream.status;
|
|
323
|
+
if (st < 200 || st >= 300 || (tool.binding.type === 'http' && tool.binding.successStatuses.length && !tool.binding.successStatuses.includes(st) && st >= 300)) {
|
|
324
|
+
const excerpt = compactJson(upstream.body).slice(0, 1024);
|
|
325
|
+
const retryAfterMs = upstream.headers['retry-after'] ? Math.max(0, Number(upstream.headers['retry-after']) * 1000) || undefined : undefined;
|
|
326
|
+
const a = { audit: upstreamMeta };
|
|
327
|
+
if (st === 401 || st === 403)
|
|
328
|
+
return fail(decision, 'tool_error', 'upstream_auth', `The API answered ${st} for ${tool.name}.`, { status: st }, a);
|
|
329
|
+
if (st === 404)
|
|
330
|
+
return fail(decision, 'tool_error', 'upstream_not_found', `The API answered 404 for ${tool.name}: ${excerpt}`, { status: st }, a);
|
|
331
|
+
if (st === 409)
|
|
332
|
+
return fail(decision, 'tool_error', 'upstream_conflict', `The API reported a conflict: ${excerpt}`, { detail: excerpt }, a);
|
|
333
|
+
if (st === 400 || st === 422)
|
|
334
|
+
return fail(decision, 'tool_error', 'upstream_validation', `The API rejected the request: ${excerpt}`, { detail: excerpt }, a);
|
|
335
|
+
if (st === 429)
|
|
336
|
+
return fail(decision, 'tool_error', 'upstream_rate_limited', 'The API answered 429 (rate limited).', { retryAfterSec: retryAfterMs ? Math.ceil(retryAfterMs / 1000) : 60 }, { ...a, ...(retryAfterMs ? { retryAfterMs } : {}) });
|
|
337
|
+
if (st >= 500)
|
|
338
|
+
return fail(decision, 'upstream_error', 'upstream_error', `The API failed with ${st}: ${excerpt}`, { detail: `${st} ${excerpt.slice(0, 200)}` }, a);
|
|
339
|
+
return fail(decision, 'tool_error', 'upstream_validation', `The API answered ${st}: ${excerpt}`, { detail: excerpt }, a);
|
|
340
|
+
}
|
|
341
|
+
let body = upstream.body;
|
|
342
|
+
const meta = metaBase();
|
|
343
|
+
if (tool.binding.type === 'graphql' && body && typeof body === 'object') {
|
|
344
|
+
const g = body;
|
|
345
|
+
if (g.errors?.length && !g.data)
|
|
346
|
+
return fail(decision, 'tool_error', 'upstream_validation', `GraphQL errors: ${g.errors.map((e) => e.message).join('; ').slice(0, 800)}`, { detail: g.errors.map((e) => e.message).join('; ').slice(0, 800) }, { audit: upstreamMeta });
|
|
347
|
+
if (g.errors?.length)
|
|
348
|
+
meta[META_GRAPHQL_ERRORS] = g.errors.map((e) => e.message ?? '');
|
|
349
|
+
let v = g.data ?? null;
|
|
350
|
+
for (const p of tool.binding.resultPath)
|
|
351
|
+
v = v && typeof v === 'object' ? v[p] : undefined;
|
|
352
|
+
body = v ?? null;
|
|
353
|
+
}
|
|
354
|
+
let value = body;
|
|
355
|
+
let text;
|
|
356
|
+
let shaped;
|
|
357
|
+
try {
|
|
358
|
+
shaped = shapeResponse(body, tool.shaping, { maxBytes: 64 * 1024 });
|
|
359
|
+
value = shaped.value;
|
|
360
|
+
if (shaped.truncated) {
|
|
361
|
+
const handle = await this.d.pages.store(ctx.tenantId, ctx.credentialKey, shaped.full);
|
|
362
|
+
meta[META_RESULT_HANDLE] = handle;
|
|
363
|
+
meta[META_TRUNCATED] = shaped.truncated;
|
|
364
|
+
meta[META_NEXT_TOOLS] = ['neurouter_read_result'];
|
|
365
|
+
}
|
|
366
|
+
step('response', 'pass', shaped.truncated ? 'truncated' : undefined);
|
|
367
|
+
}
|
|
368
|
+
catch (err) {
|
|
369
|
+
this.d.log.warn({ err, tool: tool.name }, 'response shaping failed; returning the raw result');
|
|
370
|
+
step('response', 'skip', 'shaping failed');
|
|
371
|
+
}
|
|
372
|
+
text = compactJson(value);
|
|
373
|
+
if (shaped?.truncated) {
|
|
374
|
+
const t = shaped.truncated;
|
|
375
|
+
text = `${t.totalItems !== undefined ? `Showing ${t.returnedItems ?? '?'} of ${t.totalItems} items.` : `Showing ${t.returnedBytes} of ${t.totalBytes} bytes.`} Call neurouter_read_result(handle="${String(meta[META_RESULT_HANDLE])}", offset) for more.\n${text}`;
|
|
376
|
+
}
|
|
377
|
+
if (scanUntrusted(value)) {
|
|
378
|
+
meta[META_UNTRUSTED] = true;
|
|
379
|
+
meta[META_NEXT_TOOLS] = [...new Set([...(meta[META_NEXT_TOOLS] ?? []), 'neurouter_report_issue'])];
|
|
380
|
+
text = `${UNTRUSTED_PREFIX}\n${text}`;
|
|
381
|
+
}
|
|
382
|
+
const keep = Object.fromEntries(Object.entries(upstream.headers).filter(([k]) => k === 'link' || k.startsWith('x-ratelimit')));
|
|
383
|
+
if (Object.keys(keep).length)
|
|
384
|
+
meta[META_UPSTREAM_HEADERS] = keep;
|
|
385
|
+
if (upstream.headers['retry-after'])
|
|
386
|
+
meta[META_RETRY_AFTER_MS] = Number(upstream.headers['retry-after']) * 1000;
|
|
387
|
+
// 13 record
|
|
388
|
+
record(decision, 'ok', { ...upstreamMeta, output: value });
|
|
389
|
+
try {
|
|
390
|
+
this.d.onSuccess?.(ctx, tool, rawArgs);
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
this.d.log.warn({ err }, 'post-call hook failed');
|
|
394
|
+
}
|
|
395
|
+
void urlTemplate;
|
|
396
|
+
return { ok: true, unknown: false, decision, status: 'ok', value, result: { content: [{ type: 'text', text }], structuredContent: wrapStructured(value), _meta: meta }, auditId, tool };
|
|
397
|
+
}
|
|
398
|
+
plannedChange(tool, args, wouldConfirm, argsHash) {
|
|
399
|
+
const method = tool.binding.type === 'http' ? tool.binding.method : tool.binding.type === 'graphql' ? 'POST' : 'SCRIPT';
|
|
400
|
+
const path = tool.binding.type === 'http' ? tool.binding.pathTemplate : tool.binding.type === 'graphql' ? `graphql:${tool.binding.operationType}` : tool.name;
|
|
401
|
+
return { tool: tool.name, method, path, arguments: args, wouldConfirm, argsHash };
|
|
402
|
+
}
|
|
403
|
+
confirmMessage(ctx, tool, args) {
|
|
404
|
+
const p = this.plannedChange(tool, args, true, '');
|
|
405
|
+
const summary = Object.entries(args)
|
|
406
|
+
.slice(0, 8)
|
|
407
|
+
.map(([k, v]) => `${k}=${typeof v === 'string' ? v.slice(0, 60) : JSON.stringify(v)?.slice(0, 60)}`)
|
|
408
|
+
.join(', ');
|
|
409
|
+
return `Allow ${ctx.client.name ?? 'this agent'} to ${tool.title || tool.name} in PROD?\n${p.method} ${p.path}\n${summary}`;
|
|
410
|
+
}
|
|
411
|
+
async callMock(ctx, tool, specArgs) {
|
|
412
|
+
const ns = ctx.mockNamespace ?? `env:${ctx.environment.id}`;
|
|
413
|
+
const started = this.d.now();
|
|
414
|
+
let method = 'POST';
|
|
415
|
+
let path = '/graphql';
|
|
416
|
+
let query = {};
|
|
417
|
+
let body;
|
|
418
|
+
const headers = {};
|
|
419
|
+
if (tool.binding.type === 'http') {
|
|
420
|
+
const req = buildHttpRequest(tool, specArgs, { baseUrl: 'http://mock.invalid', headers: {}, allowedHosts: ['mock.invalid'], credentials: { headers: {}, query: {} } }, this.d.version);
|
|
421
|
+
method = req.method;
|
|
422
|
+
path = req.url.pathname;
|
|
423
|
+
query = {};
|
|
424
|
+
for (const [k, v] of req.url.searchParams) {
|
|
425
|
+
const prev = query[k];
|
|
426
|
+
query[k] = prev === undefined ? v : Array.isArray(prev) ? [...prev, v] : [prev, v];
|
|
427
|
+
}
|
|
428
|
+
body = req.body !== undefined ? JSON.parse(req.body) : undefined;
|
|
429
|
+
Object.assign(headers, req.headers);
|
|
430
|
+
}
|
|
431
|
+
else if (tool.binding.type === 'graphql') {
|
|
432
|
+
path = tool.binding.endpointPath ?? '/graphql';
|
|
433
|
+
body = { query: tool.binding.document, variables: Object.fromEntries(tool.binding.variables.map((v) => [v.name, specArgs[v.arg]]).filter(([, v]) => v !== undefined)) };
|
|
434
|
+
}
|
|
435
|
+
const res = await this.d.mock.handle({ environmentId: ctx.environment.id, namespace: ns, method, path, query, headers, body, mockModel: ctx.bundle.build.mockModel() });
|
|
436
|
+
const json = res.body === undefined ? '' : JSON.stringify(res.body);
|
|
437
|
+
return { status: res.status, body: res.body ?? null, bytes: Buffer.byteLength(json ?? ''), headers: Object.fromEntries(Object.entries(res.headers ?? {}).filter(([k]) => /^(link|retry-after|x-ratelimit-.*)$/i.test(k)).map(([k, v]) => [k.toLowerCase(), v])), latencyMs: this.d.now() - started };
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function lower(h) {
|
|
441
|
+
return Object.fromEntries(Object.entries(h).map(([k, v]) => [k.toLowerCase(), v]));
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=pipeline.js.map
|