@noodleseed/one 0.121.0 → 0.123.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/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/catalog-data-hosted-observability.d.ts.map +1 -1
- package/dist/commands/catalog-data-hosted-observability.js +33 -0
- package/dist/commands/catalog-data-hosted-observability.js.map +1 -1
- package/dist/commands/deploy-version-resolution.js +1 -1
- package/dist/commands/deploy-version-resolution.js.map +1 -1
- package/dist/commands/knowledge.d.ts +7 -0
- package/dist/commands/knowledge.d.ts.map +1 -0
- package/dist/commands/knowledge.js +129 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +5 -2
- package/dist/commands/session.js.map +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +19 -2
- package/dist/deploy.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/plugin-marketplace-docs.js +4 -4
- package/node_modules/@noodle-borg/agent-kit/dist/plugin-submission.js +8 -8
- package/node_modules/@noodle-borg/agent-kit/dist/plugin-submission.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/artifact-projection.d.ts +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/artifact-projection.d.ts.map +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/artifact-projection.js +7 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/artifact-projection.js.map +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-interactive.d.ts +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-interactive.d.ts.map +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-interactive.js.map +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-presentation.d.ts.map +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-presentation.js +1 -1
- package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-presentation.js.map +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/index.d.ts +2 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/dist/index.js +2 -0
- package/node_modules/@noodle-borg/assistant-gateway/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/assistant-gateway/package.json +3 -1
- package/node_modules/@noodle-borg/deploy-client/dist/deploy-knowledge.d.ts +21 -0
- package/node_modules/@noodle-borg/deploy-client/dist/deploy-knowledge.d.ts.map +1 -0
- package/node_modules/@noodle-borg/deploy-client/dist/deploy-knowledge.js +115 -0
- package/node_modules/@noodle-borg/deploy-client/dist/deploy-knowledge.js.map +1 -0
- package/node_modules/@noodle-borg/deploy-client/dist/index.d.ts +4 -0
- package/node_modules/@noodle-borg/deploy-client/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/deploy-client/dist/index.js +4 -0
- package/node_modules/@noodle-borg/deploy-client/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/deploy-client/package.json +34 -0
- package/node_modules/@noodle-borg/developer-mcp/dist/contracts.d.ts +30 -9
- package/node_modules/@noodle-borg/developer-mcp/dist/contracts.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/contracts.js +21 -6
- package/node_modules/@noodle-borg/developer-mcp/dist/contracts.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/port.d.ts +2 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/port.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/port.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/prompts.js +3 -3
- package/node_modules/@noodle-borg/developer-mcp/dist/prompts.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/resources.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/resources.js +10 -9
- package/node_modules/@noodle-borg/developer-mcp/dist/resources.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/results.d.ts +4 -3
- package/node_modules/@noodle-borg/developer-mcp/dist/results.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/results.js +5 -19
- package/node_modules/@noodle-borg/developer-mcp/dist/results.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/server.js +3 -3
- package/node_modules/@noodle-borg/developer-mcp/dist/server.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/apps.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/apps.js +6 -25
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/apps.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/context.d.ts +16 -3
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/context.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/context.js +22 -19
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/context.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/deployments.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/deployments.js +3 -9
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/deployments.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/diagnose.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/diagnose.js +15 -16
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/diagnose.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/operations.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/operations.js +9 -17
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/operations.js.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/rollback.d.ts.map +1 -1
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/rollback.js +7 -10
- package/node_modules/@noodle-borg/developer-mcp/dist/tools/rollback.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/bm25.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/bm25.js +4 -0
- package/node_modules/@noodle-borg/knowledge/dist/bm25.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/budget.d.ts +41 -17
- package/node_modules/@noodle-borg/knowledge/dist/budget.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/budget.js +0 -0
- package/node_modules/@noodle-borg/knowledge/dist/budget.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.d.ts +4 -0
- package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.js +28 -20
- package/node_modules/@noodle-borg/knowledge/dist/google-agent-search.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/index.d.ts +1 -0
- package/node_modules/@noodle-borg/knowledge/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/index.js +1 -0
- package/node_modules/@noodle-borg/knowledge/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/postgres-budget-store.d.ts +22 -0
- package/node_modules/@noodle-borg/knowledge/dist/postgres-budget-store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge/dist/postgres-budget-store.js +102 -0
- package/node_modules/@noodle-borg/knowledge/dist/postgres-budget-store.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.d.ts +7 -4
- package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.js +110 -25
- package/node_modules/@noodle-borg/knowledge/dist/postgres-revision-store.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/revision-store.d.ts +35 -4
- package/node_modules/@noodle-borg/knowledge/dist/revision-store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/knowledge/dist/revision-store.js +73 -17
- package/node_modules/@noodle-borg/knowledge/dist/revision-store.js.map +1 -1
- package/node_modules/@noodle-borg/knowledge/package.json +4 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/codec.d.ts +12 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/codec.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/codec.js +7 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/codec.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.d.ts +16 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.js +41 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/executor.d.ts +40 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/executor.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/executor.js +54 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/executor.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.d.ts +15 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.js +50 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/google-identity.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/http.d.ts +16 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/http.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/http.js +18 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/http.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/index.d.ts +18 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/index.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/index.js +18 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/index.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.d.ts +29 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.js +53 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/managed-google.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/paths.d.ts +21 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/paths.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/paths.js +28 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/paths.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/publication.d.ts +60 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/publication.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/publication.js +230 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/publication.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/routes.d.ts +38 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/routes.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/routes.js +100 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/routes.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/search-port.d.ts +31 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/search-port.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/search-port.js +36 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/search-port.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.d.ts +56 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.js +129 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/service-wiring.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/staging-store.d.ts +38 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/staging-store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/staging-store.js +77 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/staging-store.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.d.ts +28 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.d.ts.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.js +66 -0
- package/node_modules/@noodle-borg/knowledge-operations/dist/status-routes.js.map +1 -0
- package/node_modules/@noodle-borg/knowledge-operations/package.json +34 -0
- package/node_modules/@noodle-borg/protocol/dist/handlers/tools.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/handlers/tools.js +22 -1
- package/node_modules/@noodle-borg/protocol/dist/handlers/tools.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/knowledge-tool.d.ts +28 -0
- package/node_modules/@noodle-borg/protocol/dist/knowledge-tool.d.ts.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/knowledge-tool.js +26 -0
- package/node_modules/@noodle-borg/protocol/dist/knowledge-tool.js.map +1 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts +5 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.js +12 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/v2/server.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/v2/server.js +23 -2
- package/node_modules/@noodle-borg/protocol/dist/v2/server.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +28 -0
- package/node_modules/@noodle-borg/runtime/dist/execute.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/execute.js.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts +1 -1
- package/node_modules/@noodle-borg/runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/runtime/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/developer-grant-guard.d.ts +6 -4
- package/node_modules/@noodle-borg/service/dist/auth/developer-grant-guard.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/developer-grant-guard.js +13 -16
- package/node_modules/@noodle-borg/service/dist/auth/developer-grant-guard.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/developer-mcp/control-plane-adapter.d.ts +3 -2
- package/node_modules/@noodle-borg/service/dist/developer-mcp/control-plane-adapter.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/developer-mcp/control-plane-adapter.js +66 -47
- package/node_modules/@noodle-borg/service/dist/developer-mcp/control-plane-adapter.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/developer-mcp/mount.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/developer-mcp/mount.js +15 -16
- package/node_modules/@noodle-borg/service/dist/developer-mcp/mount.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts +2 -2
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +0 -2
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.js +0 -16
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-authorizer.d.ts +3 -28
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-authorizer.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-authorizer.js +8 -67
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-authorizer.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-bootstrap.d.ts +0 -4
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-bootstrap.js +1 -14
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js +45 -36
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.d.ts +2 -2
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js +20 -229
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-store-postgres.d.ts +3 -2
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-store-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-store-postgres.js +70 -36
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-store-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant.d.ts +17 -6
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant.js +98 -26
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +0 -2
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/options.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-compile.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/registry-compile.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-compile.js +6 -0
- package/node_modules/@noodle-borg/service/dist/registry-compile.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-recover.d.ts +26 -0
- package/node_modules/@noodle-borg/service/dist/registry-recover.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/registry-recover.js +58 -0
- package/node_modules/@noodle-borg/service/dist/registry-recover.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/registry-rollback.d.ts +10 -0
- package/node_modules/@noodle-borg/service/dist/registry-rollback.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-rollback.js +25 -0
- package/node_modules/@noodle-borg/service/dist/registry-rollback.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.d.ts +5 -0
- package/node_modules/@noodle-borg/service/dist/registry.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.js +36 -78
- package/node_modules/@noodle-borg/service/dist/registry.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/analytics.js +3 -3
- package/node_modules/@noodle-borg/service/dist/routes/analytics.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/apps.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/apps.js +6 -27
- package/node_modules/@noodle-borg/service/dist/routes/apps.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js +38 -14
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-replay.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +1 -3
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-knowledge.d.ts +32 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-knowledge.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-knowledge.js +42 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-knowledge.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js +11 -3
- package/node_modules/@noodle-borg/service/dist/routes/assistant.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/config-values.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/config-values.js +5 -8
- package/node_modules/@noodle-borg/service/dist/routes/config-values.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts +7 -6
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +7 -6
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deploy-preflight.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deploy-preflight.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deployment-package.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deployment-package.js +2 -7
- package/node_modules/@noodle-borg/service/dist/routes/deployment-package.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deployments.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/deployments.js +7 -20
- package/node_modules/@noodle-borg/service/dist/routes/deployments.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/diagnostics.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/diagnostics.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/envs.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/envs.js +4 -8
- package/node_modules/@noodle-borg/service/dist/routes/envs.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/logs.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/logs.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/rollback.js +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/rollback.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +4 -0
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +11 -1
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +21 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/package.json +3 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/index.js +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts +134 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.d.ts.map +1 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.js +101 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/knowledge.js.map +1 -0
- package/node_modules/@noodle-borg/wire-contracts/package.json +1 -0
- package/node_modules/@noodleseed/assistant/package.json +41 -16
- package/package.json +7 -2
- /package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-interactive.js +0 -0
- /package/node_modules/@noodle-borg/{service → assistant-gateway}/dist/assistant-presentation.d.ts +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-payload-size.d.ts +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-payload-size.d.ts.map +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-payload-size.js +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-payload-size.js.map +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-version.d.ts +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-version.d.ts.map +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-version.js +0 -0
- /package/{dist → node_modules/@noodle-borg/deploy-client/dist}/deploy-version.js.map +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { sendJson } from './http.js';
|
|
2
|
+
import { parseKnowledgePath } from './paths.js';
|
|
3
|
+
import { handleKnowledgeDocumentUpload, handleKnowledgePreflight, } from './routes.js';
|
|
4
|
+
import { handleKnowledgeList, handleKnowledgeStatus } from './status-routes.js';
|
|
5
|
+
export function dispatchKnowledgeRequest(req, res, url, deps) {
|
|
6
|
+
const ref = parseKnowledgePath(url.pathname);
|
|
7
|
+
if (ref === undefined)
|
|
8
|
+
return false;
|
|
9
|
+
const method = ref.kind === 'preflight' ? 'POST' : ref.kind === 'document' ? 'PUT' : 'GET';
|
|
10
|
+
if (method !== req.method)
|
|
11
|
+
return false;
|
|
12
|
+
const statusDeps = deps.routeDeps.status;
|
|
13
|
+
if ((ref.kind === 'list' || ref.kind === 'status') && statusDeps === undefined) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
deps.applySecurityHeaders(res);
|
|
17
|
+
if (deps.enforceHttps(req, res))
|
|
18
|
+
return true;
|
|
19
|
+
(async () => {
|
|
20
|
+
const identity = await deps.authorize(req, res, ref.tenant.org);
|
|
21
|
+
if (identity === false)
|
|
22
|
+
return;
|
|
23
|
+
if (ref.kind === 'preflight') {
|
|
24
|
+
await handleKnowledgePreflight(req, res, ref.tenant, deps.routeDeps);
|
|
25
|
+
}
|
|
26
|
+
else if (ref.kind === 'document') {
|
|
27
|
+
await handleKnowledgeDocumentUpload(req, res, ref.tenant, ref.sha256, deps.routeDeps);
|
|
28
|
+
}
|
|
29
|
+
else if (statusDeps !== undefined && ref.kind === 'list') {
|
|
30
|
+
await handleKnowledgeList(req, res, ref.tenant, statusDeps);
|
|
31
|
+
}
|
|
32
|
+
else if (statusDeps !== undefined && ref.kind === 'status') {
|
|
33
|
+
await handleKnowledgeStatus(req, res, ref.tenant, ref.component, statusDeps);
|
|
34
|
+
}
|
|
35
|
+
})().catch(() => {
|
|
36
|
+
if (!res.headersSent)
|
|
37
|
+
sendJson(res, 500, { error: 'internal error' });
|
|
38
|
+
});
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GAEzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAehF,MAAM,UAAU,wBAAwB,CACtC,GAAoB,EACpB,GAAmB,EACnB,GAAQ,EACR,IAA2B;IAE3B,MAAM,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3F,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IACzC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,UAAU,KAAK,SAA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YAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime `search_<name>` execution (ADR 0202 as amended): feature gate → bundled BM25 for
|
|
3
|
+
* documents → budget-gated managed site search → deterministic RRF fusion with the exact
|
|
4
|
+
* origin/path policy postfilter. Budget exhaustion on a mixed component is a typed error —
|
|
5
|
+
* blocked, never silently degraded to document-only. Document-only components never touch
|
|
6
|
+
* the budget (file search is bundled and costs nothing).
|
|
7
|
+
*/
|
|
8
|
+
import { type SearchBudgetCeilings, type SearchBudgetStore, type SearchHit, type SiteSearch } from '@noodle-borg/knowledge';
|
|
9
|
+
import type { KnowledgeDeployHooks } from './publication.js';
|
|
10
|
+
import { type KnowledgeTenantRef } from './routes.js';
|
|
11
|
+
/** The component facts the executor needs; a structural subset of the compiled component. */
|
|
12
|
+
export interface KnowledgeSearchComponent {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly sites: readonly {
|
|
15
|
+
readonly origin: string;
|
|
16
|
+
readonly include: readonly string[];
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
export interface KnowledgeSearchRequest {
|
|
20
|
+
readonly query: string;
|
|
21
|
+
readonly limit?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface KnowledgeSearchExecutor {
|
|
24
|
+
enabled(tenant: KnowledgeTenantRef): Promise<boolean>;
|
|
25
|
+
/** Throws `KnowledgeError` or `SearchBudgetExhaustedError`; never returns partial truth. */
|
|
26
|
+
search(tenant: KnowledgeTenantRef, component: KnowledgeSearchComponent, request: KnowledgeSearchRequest): Promise<readonly SearchHit[]>;
|
|
27
|
+
}
|
|
28
|
+
export interface KnowledgeSearchExecutorDeps {
|
|
29
|
+
readonly hooks: KnowledgeDeployHooks;
|
|
30
|
+
readonly knowledgeEnabled: (tenant: KnowledgeTenantRef) => Promise<boolean>;
|
|
31
|
+
/** Site-search spend control; absent means site search is unavailable (documents still serve). */
|
|
32
|
+
readonly budget?: {
|
|
33
|
+
readonly store: SearchBudgetStore;
|
|
34
|
+
readonly ceilings: (tenant: KnowledgeTenantRef) => Promise<SearchBudgetCeilings>;
|
|
35
|
+
};
|
|
36
|
+
/** Managed live-site adapter bound per tenant; absent until the managed project is configured. */
|
|
37
|
+
readonly siteSearchFor?: (tenant: KnowledgeTenantRef) => SiteSearch;
|
|
38
|
+
}
|
|
39
|
+
export declare function createKnowledgeSearchExecutor(deps: KnowledgeSearchExecutorDeps): KnowledgeSearchExecutor;
|
|
40
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAQL,KAAK,oBAAoB,EAEzB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC7F;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,4FAA4F;IAC5F,MAAM,CACJ,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,wBAAwB,EACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,kGAAkG;IAClG,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;QAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;KAClF,CAAC;IACF,kGAAkG;IAClG,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,UAAU,CAAC;CACrE;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,2BAA2B,GAChC,uBAAuB,CA8DzB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime `search_<name>` execution (ADR 0202 as amended): feature gate → bundled BM25 for
|
|
3
|
+
* documents → budget-gated managed site search → deterministic RRF fusion with the exact
|
|
4
|
+
* origin/path policy postfilter. Budget exhaustion on a mixed component is a typed error —
|
|
5
|
+
* blocked, never silently degraded to document-only. Document-only components never touch
|
|
6
|
+
* the budget (file search is bundled and costs nothing).
|
|
7
|
+
*/
|
|
8
|
+
import { DEFAULT_RESULT_LIMIT, fuseHits, KnowledgeError, MAX_QUERY_CHARS, MAX_RESULT_LIMIT, MIN_QUERY_CHARS, MIN_RESULT_LIMIT, SearchBudgetExhaustedError, } from '@noodle-borg/knowledge';
|
|
9
|
+
import { knowledgeEnableCommand } from './routes.js';
|
|
10
|
+
export function createKnowledgeSearchExecutor(deps) {
|
|
11
|
+
return {
|
|
12
|
+
enabled: (tenant) => deps.knowledgeEnabled(tenant),
|
|
13
|
+
async search(tenant, component, request) {
|
|
14
|
+
if (!(await deps.knowledgeEnabled(tenant))) {
|
|
15
|
+
throw new KnowledgeError('request', `knowledge is not enabled for this org/app/env; run: ${knowledgeEnableCommand(tenant)}`);
|
|
16
|
+
}
|
|
17
|
+
if (request.query.length < MIN_QUERY_CHARS || request.query.length > MAX_QUERY_CHARS) {
|
|
18
|
+
throw new KnowledgeError('request', `query must be between ${MIN_QUERY_CHARS} and ${MAX_QUERY_CHARS} characters`);
|
|
19
|
+
}
|
|
20
|
+
const limit = Math.min(MAX_RESULT_LIMIT, Math.max(MIN_RESULT_LIMIT, Math.floor(request.limit ?? DEFAULT_RESULT_LIMIT)));
|
|
21
|
+
const scope = { org: tenant.org, app: tenant.app, env: tenant.env };
|
|
22
|
+
const documents = await deps.hooks.searchDocuments(scope, component.name, {
|
|
23
|
+
query: request.query,
|
|
24
|
+
limit,
|
|
25
|
+
});
|
|
26
|
+
let sites = [];
|
|
27
|
+
const siteSearch = deps.siteSearchFor?.(tenant);
|
|
28
|
+
const wantsSites = component.sites.length > 0 && siteSearch !== undefined;
|
|
29
|
+
if (wantsSites && siteSearch !== undefined) {
|
|
30
|
+
if (deps.budget !== undefined) {
|
|
31
|
+
const ceilings = await deps.budget.ceilings(tenant);
|
|
32
|
+
const decision = await deps.budget.store.consume({ org: tenant.org, app: tenant.app }, 1, ceilings);
|
|
33
|
+
// Blocked, never degraded: a mixed component must not quietly answer from documents.
|
|
34
|
+
if (!decision.granted)
|
|
35
|
+
throw new SearchBudgetExhaustedError(decision.state);
|
|
36
|
+
}
|
|
37
|
+
const collected = [];
|
|
38
|
+
for (const policy of component.sites) {
|
|
39
|
+
const hits = await siteSearch.search({ origin: policy.origin, include: [...policy.include] }, { audience: 'public', revision: 'live' }, { query: request.query, limit });
|
|
40
|
+
collected.push(...hits);
|
|
41
|
+
}
|
|
42
|
+
sites = collected;
|
|
43
|
+
}
|
|
44
|
+
return fuseHits(documents, sites, {
|
|
45
|
+
limit,
|
|
46
|
+
sitePolicies: component.sites.map((policy) => ({
|
|
47
|
+
origin: policy.origin,
|
|
48
|
+
include: [...policy.include],
|
|
49
|
+
})),
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAEhB,0BAA0B,GAI3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAA2B,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAmC9E,MAAM,UAAU,6BAA6B,CAC3C,IAAiC;IAEjC,OAAO;QACL,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAElD,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO;YACrC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,cAAc,CACtB,SAAS,EACT,uDAAuD,sBAAsB,CAAC,MAAM,CAAC,EAAE,CACxF,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;gBACrF,MAAM,IAAI,cAAc,CACtB,SAAS,EACT,yBAAyB,eAAe,QAAQ,eAAe,aAAa,CAC7E,CAAC;YAC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CAAC;gBACD,MAAM,SAAS,GAAgB,EAAE,CAAC;gBAClC,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;oBACrC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,CAClC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,EACvD,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EACxC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,CAChC,CAAC;oBACF,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC1B,CAAC;gBACD,KAAK,GAAG,SAAS,CAAC;YACpB,CAAC;YAED,OAAO,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE;gBAChC,KAAK;gBACL,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;iBAC7B,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Noodle-side Google identities for the managed knowledge tier (ADR 0202 as amended): the
|
|
3
|
+
* Cloud Run runtime's ADC token impersonates the three least-privilege service accounts
|
|
4
|
+
* (provisioning is operator-only and never wired here; publication and search are). REST only —
|
|
5
|
+
* Apache packages never depend on `@google-cloud/*` — and tokens are cached until near expiry.
|
|
6
|
+
*/
|
|
7
|
+
import type { GoogleAccessTokenProvider } from '@noodle-borg/knowledge';
|
|
8
|
+
/** The Cloud Run / GCE runtime identity via the metadata server (ADC). */
|
|
9
|
+
export declare function metadataServiceTokenProvider(fetchImpl?: typeof fetch): GoogleAccessTokenProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Impersonate one least-privilege service account from a base identity that holds
|
|
12
|
+
* `roles/iam.serviceAccountTokenCreator` on it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function impersonatedTokenProvider(base: GoogleAccessTokenProvider, serviceAccountEmail: string, fetchImpl?: typeof fetch): GoogleAccessTokenProvider;
|
|
15
|
+
//# sourceMappingURL=google-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-identity.d.ts","sourceRoot":"","sources":["../src/google-identity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAYxE,0EAA0E;AAC1E,wBAAgB,4BAA4B,CAC1C,SAAS,GAAE,OAAO,KAAa,GAC9B,yBAAyB,CAgB3B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,yBAAyB,EAC/B,mBAAmB,EAAE,MAAM,EAC3B,SAAS,GAAE,OAAO,KAAa,GAC9B,yBAAyB,CA0B3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const METADATA_TOKEN_URL = 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token';
|
|
2
|
+
const IAM_CREDENTIALS_ROOT = 'https://iamcredentials.googleapis.com/v1';
|
|
3
|
+
const EXPIRY_SKEW_MS = 5 * 60 * 1000;
|
|
4
|
+
/** The Cloud Run / GCE runtime identity via the metadata server (ADC). */
|
|
5
|
+
export function metadataServiceTokenProvider(fetchImpl = fetch) {
|
|
6
|
+
let cached;
|
|
7
|
+
return async () => {
|
|
8
|
+
if (cached !== undefined && Date.now() < cached.expiresAt - EXPIRY_SKEW_MS) {
|
|
9
|
+
return cached.token;
|
|
10
|
+
}
|
|
11
|
+
const response = await fetchImpl(METADATA_TOKEN_URL, {
|
|
12
|
+
headers: { 'Metadata-Flavor': 'Google' },
|
|
13
|
+
});
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
throw new Error(`metadata token request returned HTTP ${response.status}`);
|
|
16
|
+
}
|
|
17
|
+
const body = (await response.json());
|
|
18
|
+
cached = { token: body.access_token, expiresAt: Date.now() + body.expires_in * 1000 };
|
|
19
|
+
return cached.token;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Impersonate one least-privilege service account from a base identity that holds
|
|
24
|
+
* `roles/iam.serviceAccountTokenCreator` on it.
|
|
25
|
+
*/
|
|
26
|
+
export function impersonatedTokenProvider(base, serviceAccountEmail, fetchImpl = fetch) {
|
|
27
|
+
let cached;
|
|
28
|
+
return async () => {
|
|
29
|
+
if (cached !== undefined && Date.now() < cached.expiresAt - EXPIRY_SKEW_MS) {
|
|
30
|
+
return cached.token;
|
|
31
|
+
}
|
|
32
|
+
const baseToken = await base();
|
|
33
|
+
const response = await fetchImpl(`${IAM_CREDENTIALS_ROOT}/projects/-/serviceAccounts/${encodeURIComponent(serviceAccountEmail)}:generateAccessToken`, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
authorization: `Bearer ${baseToken}`,
|
|
37
|
+
'content-type': 'application/json',
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify({ scope: ['https://www.googleapis.com/auth/cloud-platform'] }),
|
|
40
|
+
});
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
// Attributable without detail: the account and status only, never a response body.
|
|
43
|
+
throw new Error(`impersonation of ${serviceAccountEmail} returned HTTP ${response.status}`);
|
|
44
|
+
}
|
|
45
|
+
const body = (await response.json());
|
|
46
|
+
cached = { token: body.accessToken, expiresAt: Date.parse(body.expireTime) };
|
|
47
|
+
return cached.token;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=google-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-identity.js","sourceRoot":"","sources":["../src/google-identity.ts"],"names":[],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3E,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,IAAI,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,SAAS,CAC9B,GAAG,oBAAoB,+BAA+B,kBAAkB,CAAC,mBAAmB,CAAC,sBAAsB,EACnH;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,SAAS,EAAE;gBACpC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,gDAAgD,CAAC,EAAE,CAAC;SACpF,CACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,mFAAmF;YACnF,MAAM,IAAI,KAAK,CAAC,oBAAoB,mBAAmB,kBAAkB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9F,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAgD,CAAC;QACpF,MAAM,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal HTTP plumbing for knowledge route handlers. Byte-compatible with the service's
|
|
3
|
+
* wire behavior but deliberately independent of it — a module package never imports the
|
|
4
|
+
* service (the feedback-operations precedent).
|
|
5
|
+
*/
|
|
6
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
7
|
+
export declare function sendJson(res: ServerResponse, status: number, body: unknown): void;
|
|
8
|
+
export declare function readBody(req: IncomingMessage, maxBytes: number): Promise<{
|
|
9
|
+
ok: true;
|
|
10
|
+
body: Buffer;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
status: number;
|
|
14
|
+
error: string;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAGjF;AAED,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAYpF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function sendJson(res, status, body) {
|
|
2
|
+
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' });
|
|
3
|
+
res.end(JSON.stringify(body));
|
|
4
|
+
}
|
|
5
|
+
export async function readBody(req, maxBytes) {
|
|
6
|
+
const chunks = [];
|
|
7
|
+
let total = 0;
|
|
8
|
+
for await (const chunk of req) {
|
|
9
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
10
|
+
total += buffer.length;
|
|
11
|
+
if (total > maxBytes) {
|
|
12
|
+
return { ok: false, status: 413, error: `request body exceeds ${maxBytes} bytes` };
|
|
13
|
+
}
|
|
14
|
+
chunks.push(buffer);
|
|
15
|
+
}
|
|
16
|
+
return { ok: true, body: Buffer.concat(chunks) };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,QAAQ,CAAC,GAAmB,EAAE,MAAc,EAAE,IAAa;IACzE,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,iCAAiC,EAAE,CAAC,CAAC;IAC7E,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,GAAoB,EACpB,QAAgB;IAEhB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;QAC7E,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;QACvB,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;YACrB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,wBAAwB,QAAQ,QAAQ,EAAE,CAAC;QACrF,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge control-plane orchestration (ADR 0202 as amended). The service composes these
|
|
3
|
+
* behind its thin dispatch; the CLI never imports this package.
|
|
4
|
+
*/
|
|
5
|
+
export { type StringSecretBox, secretBoxDocumentCodec } from './codec.js';
|
|
6
|
+
export { dispatchKnowledgeRequest, type KnowledgeDispatchDeps } from './dispatch.js';
|
|
7
|
+
export { createKnowledgeSearchExecutor, type KnowledgeSearchComponent, type KnowledgeSearchExecutor, type KnowledgeSearchExecutorDeps, type KnowledgeSearchRequest, } from './executor.js';
|
|
8
|
+
export { impersonatedTokenProvider, metadataServiceTokenProvider, } from './google-identity.js';
|
|
9
|
+
export { readBody, sendJson } from './http.js';
|
|
10
|
+
export { type ManagedGoogleKnowledge, managedGoogleFromEnv, managedSiteProvisioned, managedSiteSearchFor, } from './managed-google.js';
|
|
11
|
+
export { type KnowledgeRouteRef, parseKnowledgePath } from './paths.js';
|
|
12
|
+
export { createKnowledgeDeployHooks, type KnowledgeDeployFailure, type KnowledgeDeployHooks, KnowledgePublicationError, type KnowledgePublicationPlan, withKnowledgePublication, } from './publication.js';
|
|
13
|
+
export { handleKnowledgeDocumentUpload, handleKnowledgePreflight, type KnowledgeRouteDeps, type KnowledgeTenantRef, knowledgeEnableCommand, knowledgeTenantKey, } from './routes.js';
|
|
14
|
+
export { type BoundKnowledgeSearchPort, bindKnowledgeSearchPort, type KnowledgeSearchPortFactory, knowledgeSearchPortFactory, } from './search-port.js';
|
|
15
|
+
export { budgetCeilingsResolver, buildKnowledgeRouteDeps, createPostgresKnowledgeStores, defaultKnowledgeStores, type KnowledgeServiceStores, wireKnowledge, } from './service-wiring.js';
|
|
16
|
+
export { InMemoryKnowledgeStagingStore, type KnowledgeStagingStore, PostgresKnowledgeStagingStore, STAGING_TTL_MS, } from './staging-store.js';
|
|
17
|
+
export { handleKnowledgeList, handleKnowledgeStatus, type KnowledgeStatusDeps, } from './status-routes.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAA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,EACrB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge control-plane orchestration (ADR 0202 as amended). The service composes these
|
|
3
|
+
* behind its thin dispatch; the CLI never imports this package.
|
|
4
|
+
*/
|
|
5
|
+
export { secretBoxDocumentCodec } from './codec.js';
|
|
6
|
+
export { dispatchKnowledgeRequest } from './dispatch.js';
|
|
7
|
+
export { createKnowledgeSearchExecutor, } from './executor.js';
|
|
8
|
+
export { impersonatedTokenProvider, metadataServiceTokenProvider, } from './google-identity.js';
|
|
9
|
+
export { readBody, sendJson } from './http.js';
|
|
10
|
+
export { managedGoogleFromEnv, managedSiteProvisioned, managedSiteSearchFor, } from './managed-google.js';
|
|
11
|
+
export { parseKnowledgePath } from './paths.js';
|
|
12
|
+
export { createKnowledgeDeployHooks, KnowledgePublicationError, withKnowledgePublication, } from './publication.js';
|
|
13
|
+
export { handleKnowledgeDocumentUpload, handleKnowledgePreflight, knowledgeEnableCommand, knowledgeTenantKey, } from './routes.js';
|
|
14
|
+
export { bindKnowledgeSearchPort, knowledgeSearchPortFactory, } from './search-port.js';
|
|
15
|
+
export { budgetCeilingsResolver, buildKnowledgeRouteDeps, createPostgresKnowledgeStores, defaultKnowledgeStores, wireKnowledge, } from './service-wiring.js';
|
|
16
|
+
export { InMemoryKnowledgeStagingStore, PostgresKnowledgeStagingStore, STAGING_TTL_MS, } from './staging-store.js';
|
|
17
|
+
export { handleKnowledgeList, handleKnowledgeStatus, } from './status-routes.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAwB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAA8B,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,6BAA6B,GAK9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAEL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA0B,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,0BAA0B,EAG1B,yBAAyB,EAEzB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EAGxB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,uBAAuB,EAEvB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,sBAAsB,EAEtB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAE7B,6BAA6B,EAC7B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed-bundled Google wiring (ADR 0202 as amended): resolve the Noodle-owned project and the
|
|
3
|
+
* two runtime-reachable identities (publication, search) from service environment, bind the
|
|
4
|
+
* sites-half adapter per tenant scope, and answer the honest site-provisioning question. The
|
|
5
|
+
* provisioning identity is deliberately unreachable from here — it exists only for the
|
|
6
|
+
* operator-run `scripts/knowledge-gcp-provision.mjs`.
|
|
7
|
+
*/
|
|
8
|
+
import { type GoogleAccessTokenProvider, type SiteSearch } from '@noodle-borg/knowledge';
|
|
9
|
+
import type { KnowledgeTenantRef } from './routes.js';
|
|
10
|
+
export interface ManagedGoogleKnowledge {
|
|
11
|
+
readonly project: string;
|
|
12
|
+
readonly location: string;
|
|
13
|
+
/** Reaches the deploy path only. */
|
|
14
|
+
readonly publicationTokens: GoogleAccessTokenProvider;
|
|
15
|
+
/** The only identity runtime execution may reach (ADR 0202 D9). */
|
|
16
|
+
readonly searchTokens: GoogleAccessTokenProvider;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Environment contract (set on the hosted service):
|
|
20
|
+
* `NOODLE_KNOWLEDGE_GCP_PROJECT` (required to enable the managed sites tier),
|
|
21
|
+
* `NOODLE_KNOWLEDGE_GCP_LOCATION` (default `global`),
|
|
22
|
+
* `NOODLE_KNOWLEDGE_PUBLICATION_SA` / `NOODLE_KNOWLEDGE_SEARCH_SA` (default the
|
|
23
|
+
* `knowledge-publication@` / `knowledge-search@` accounts in the project).
|
|
24
|
+
*/
|
|
25
|
+
export declare function managedGoogleFromEnv(env: NodeJS.ProcessEnv, fetchImpl?: typeof fetch): ManagedGoogleKnowledge | undefined;
|
|
26
|
+
export declare function managedSiteSearchFor(google: ManagedGoogleKnowledge, tenant: KnowledgeTenantRef): SiteSearch;
|
|
27
|
+
/** Does the tenant's WEBSITE data store exist? Read with the search identity (viewer). */
|
|
28
|
+
export declare function managedSiteProvisioned(google: ManagedGoogleKnowledge, tenant: KnowledgeTenantRef, fetchImpl?: typeof fetch): Promise<boolean>;
|
|
29
|
+
//# sourceMappingURL=managed-google.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-google.d.ts","sourceRoot":"","sources":["../src/managed-google.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAEL,KAAK,yBAAyB,EAG9B,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oCAAoC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IACtD,mEAAmE;IACnE,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,SAAS,GAAE,OAAO,KAAa,GAC9B,sBAAsB,GAAG,SAAS,CAgBpC;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,kBAAkB,GACzB,UAAU,CAOZ;AAED,0FAA0F;AAC1F,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,OAAO,CAAC,CAelB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed-bundled Google wiring (ADR 0202 as amended): resolve the Noodle-owned project and the
|
|
3
|
+
* two runtime-reachable identities (publication, search) from service environment, bind the
|
|
4
|
+
* sites-half adapter per tenant scope, and answer the honest site-provisioning question. The
|
|
5
|
+
* provisioning identity is deliberately unreachable from here — it exists only for the
|
|
6
|
+
* operator-run `scripts/knowledge-gcp-provision.mjs`.
|
|
7
|
+
*/
|
|
8
|
+
import { GOOGLE_SITE_COMPONENT, GoogleAgentSearchSites, googleDataStoreId, } from '@noodle-borg/knowledge';
|
|
9
|
+
import { impersonatedTokenProvider, metadataServiceTokenProvider } from './google-identity.js';
|
|
10
|
+
/**
|
|
11
|
+
* Environment contract (set on the hosted service):
|
|
12
|
+
* `NOODLE_KNOWLEDGE_GCP_PROJECT` (required to enable the managed sites tier),
|
|
13
|
+
* `NOODLE_KNOWLEDGE_GCP_LOCATION` (default `global`),
|
|
14
|
+
* `NOODLE_KNOWLEDGE_PUBLICATION_SA` / `NOODLE_KNOWLEDGE_SEARCH_SA` (default the
|
|
15
|
+
* `knowledge-publication@` / `knowledge-search@` accounts in the project).
|
|
16
|
+
*/
|
|
17
|
+
export function managedGoogleFromEnv(env, fetchImpl = fetch) {
|
|
18
|
+
const project = env.NOODLE_KNOWLEDGE_GCP_PROJECT;
|
|
19
|
+
if (project === undefined || project === '')
|
|
20
|
+
return undefined;
|
|
21
|
+
const location = env.NOODLE_KNOWLEDGE_GCP_LOCATION ?? 'global';
|
|
22
|
+
const base = metadataServiceTokenProvider(fetchImpl);
|
|
23
|
+
const publication = env.NOODLE_KNOWLEDGE_PUBLICATION_SA ??
|
|
24
|
+
`knowledge-publication@${project}.iam.gserviceaccount.com`;
|
|
25
|
+
const search = env.NOODLE_KNOWLEDGE_SEARCH_SA ?? `knowledge-search@${project}.iam.gserviceaccount.com`;
|
|
26
|
+
return {
|
|
27
|
+
project,
|
|
28
|
+
location,
|
|
29
|
+
publicationTokens: impersonatedTokenProvider(base, publication, fetchImpl),
|
|
30
|
+
searchTokens: impersonatedTokenProvider(base, search, fetchImpl),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function managedSiteSearchFor(google, tenant) {
|
|
34
|
+
return new GoogleAgentSearchSites({
|
|
35
|
+
project: google.project,
|
|
36
|
+
location: google.location,
|
|
37
|
+
tokenProvider: google.searchTokens,
|
|
38
|
+
scope: { org: tenant.org, app: tenant.app, env: tenant.env },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Does the tenant's WEBSITE data store exist? Read with the search identity (viewer). */
|
|
42
|
+
export async function managedSiteProvisioned(google, tenant, fetchImpl = fetch) {
|
|
43
|
+
const id = googleDataStoreId({ org: tenant.org, app: tenant.app, env: tenant.env }, GOOGLE_SITE_COMPONENT);
|
|
44
|
+
const token = await google.searchTokens();
|
|
45
|
+
const response = await fetchImpl(`https://discoveryengine.googleapis.com/v1/projects/${google.project}/locations/${google.location}/collections/default_collection/dataStores/${id}`, { headers: { authorization: `Bearer ${token}` } });
|
|
46
|
+
if (response.status === 404)
|
|
47
|
+
return false;
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`site datastore check for ${id} returned HTTP ${response.status}`);
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=managed-google.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-google.js","sourceRoot":"","sources":["../src/managed-google.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,qBAAqB,EAErB,sBAAsB,EACtB,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAY/F;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAsB,EACtB,YAA0B,KAAK;IAE/B,MAAM,OAAO,GAAG,GAAG,CAAC,4BAA4B,CAAC;IACjD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC9D,MAAM,QAAQ,GAAG,GAAG,CAAC,6BAA6B,IAAI,QAAQ,CAAC;IAC/D,MAAM,IAAI,GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,WAAW,GACf,GAAG,CAAC,+BAA+B;QACnC,yBAAyB,OAAO,0BAA0B,CAAC;IAC7D,MAAM,MAAM,GACV,GAAG,CAAC,0BAA0B,IAAI,oBAAoB,OAAO,0BAA0B,CAAC;IAC1F,OAAO;QACL,OAAO;QACP,QAAQ;QACR,iBAAiB,EAAE,yBAAyB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC;QAC1E,YAAY,EAAE,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAA8B,EAC9B,MAA0B;IAE1B,OAAO,IAAI,sBAAs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|
5
|
+
export type KnowledgeRouteRef = {
|
|
6
|
+
readonly kind: 'preflight';
|
|
7
|
+
readonly tenant: KnowledgeTenantRef;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'document';
|
|
10
|
+
readonly tenant: KnowledgeTenantRef;
|
|
11
|
+
readonly sha256: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'list';
|
|
14
|
+
readonly tenant: KnowledgeTenantRef;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'status';
|
|
17
|
+
readonly tenant: KnowledgeTenantRef;
|
|
18
|
+
readonly component: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseKnowledgePath(pathname: string): KnowledgeRouteRef | undefined;
|
|
21
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,GAC9D;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAQjG,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAkClF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const PREFLIGHT = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/preflight$/;
|
|
2
|
+
const DOCUMENT = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/documents\/([^/]+)$/;
|
|
3
|
+
const LIST = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge$/;
|
|
4
|
+
const STATUS = /^\/v1\/orgs\/([^/]+)\/apps\/([^/]+)\/envs\/([^/]+)\/knowledge\/([^/]+)\/status$/;
|
|
5
|
+
export function parseKnowledgePath(pathname) {
|
|
6
|
+
const preflight = PREFLIGHT.exec(pathname);
|
|
7
|
+
if (preflight !== null) {
|
|
8
|
+
const [, org, app, env] = preflight;
|
|
9
|
+
return { kind: 'preflight', tenant: { org, app, env } };
|
|
10
|
+
}
|
|
11
|
+
const list = LIST.exec(pathname);
|
|
12
|
+
if (list !== null) {
|
|
13
|
+
const [, org, app, env] = list;
|
|
14
|
+
return { kind: 'list', tenant: { org, app, env } };
|
|
15
|
+
}
|
|
16
|
+
const status = STATUS.exec(pathname);
|
|
17
|
+
if (status !== null) {
|
|
18
|
+
const [, org, app, env, component] = status;
|
|
19
|
+
return { kind: 'status', tenant: { org, app, env }, component };
|
|
20
|
+
}
|
|
21
|
+
const document = DOCUMENT.exec(pathname);
|
|
22
|
+
if (document !== null) {
|
|
23
|
+
const [, org, app, env, sha256] = document;
|
|
24
|
+
return { kind: 'document', tenant: { org, app, env }, sha256 };
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAWA,MAAM,SAAS,GAAG,2EAA2E,CA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B,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,QAMjC,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The deploy-coupled knowledge publication transaction (ADR 0202): lease → resolve bytes or
|
|
3
|
+
* reuse → stage (bundled index + revision + durable sealed text) → verify a positive filtered
|
|
4
|
+
* query → activate + pin, paired with the caller's artifact persistence. Any failure retains
|
|
5
|
+
* the previous artifact + revision pair; retry is idempotent by content hash.
|
|
6
|
+
*/
|
|
7
|
+
import { type CompiledKnowledgeComponent, type KnowledgeScope, type SearchHit, type SearchRequest } from '@noodle-borg/knowledge';
|
|
8
|
+
import { type KnowledgeTenantRef } from './routes.js';
|
|
9
|
+
import type { KnowledgeServiceStores } from './service-wiring.js';
|
|
10
|
+
export interface KnowledgeDeployFailure {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
}
|
|
15
|
+
/** Structured publication failure the registry maps onto its deploy error shape. */
|
|
16
|
+
export declare class KnowledgePublicationError extends Error {
|
|
17
|
+
readonly errors: readonly KnowledgeDeployFailure[];
|
|
18
|
+
constructor(errors: readonly KnowledgeDeployFailure[]);
|
|
19
|
+
}
|
|
20
|
+
interface PlannedComponent {
|
|
21
|
+
readonly component: CompiledKnowledgeComponent;
|
|
22
|
+
readonly scope: KnowledgeScope;
|
|
23
|
+
readonly revisionId: string;
|
|
24
|
+
readonly previousRevisionId?: string;
|
|
25
|
+
readonly lease: {
|
|
26
|
+
readonly scopeKey: string;
|
|
27
|
+
readonly leaseId: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface KnowledgePublicationPlan {
|
|
31
|
+
readonly components: readonly PlannedComponent[];
|
|
32
|
+
}
|
|
33
|
+
export interface KnowledgeDeployHooks {
|
|
34
|
+
publish(tenant: KnowledgeTenantRef, deploymentId: string, components: readonly CompiledKnowledgeComponent[]): Promise<KnowledgePublicationPlan>;
|
|
35
|
+
activate(plan: KnowledgePublicationPlan, deploymentId: string): Promise<void>;
|
|
36
|
+
/** Re-activate the previous revisions after a persistence failure. */
|
|
37
|
+
compensate(plan: KnowledgePublicationPlan, deploymentId: string): Promise<void>;
|
|
38
|
+
/** Release leases; always runs, success or failure. */
|
|
39
|
+
finish(plan: KnowledgePublicationPlan): Promise<void>;
|
|
40
|
+
/** Reselect every revision the deployment pinned; the bundled index rebuilds lazily. */
|
|
41
|
+
rollback(deploymentId: string): Promise<void>;
|
|
42
|
+
/** Search the active document revision, rebuilding the bundled index when stale. */
|
|
43
|
+
searchDocuments(scope: KnowledgeScope, componentName: string, request: SearchRequest): Promise<readonly SearchHit[]>;
|
|
44
|
+
/** Throttled GC: expired staging entries and unreferenced revisions. */
|
|
45
|
+
sweep(): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
export declare function createKnowledgeDeployHooks(stores: KnowledgeServiceStores, options: {
|
|
48
|
+
readonly knowledgeEnabled: (tenant: KnowledgeTenantRef) => Promise<boolean>;
|
|
49
|
+
/** Managed site datastore existence; when bound, a site() deploy fails before activation. */
|
|
50
|
+
readonly siteProvisioned?: (tenant: KnowledgeTenantRef) => Promise<boolean>;
|
|
51
|
+
readonly now?: () => Date;
|
|
52
|
+
}): KnowledgeDeployHooks;
|
|
53
|
+
/**
|
|
54
|
+
* Wrap the caller's persistence step in the full publication transaction. The order is the
|
|
55
|
+
* ADR 0202 pairing: stage + verify + activate the revision, persist the artifact, and on a
|
|
56
|
+
* persistence failure re-activate the previous revision so the retained pair stays coherent.
|
|
57
|
+
*/
|
|
58
|
+
export declare function withKnowledgePublication<T>(hooks: KnowledgeDeployHooks | undefined, tenant: KnowledgeTenantRef, deploymentId: string, components: readonly CompiledKnowledgeComponent[] | undefined, persist: () => Promise<T>): Promise<T>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=publication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../src/publication.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,0BAA0B,EAK/B,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,aAAa,CAAC;AAClG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,oFAAoF;AACpF,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC;gBAEvC,MAAM,EAAE,SAAS,sBAAsB,EAAE;CAKtD;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAClD;AA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