@stigmer/server 3.21.0 → 3.22.1-dev.20260922095755
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/authorization/authorizer.d.ts +4 -8
- package/dist/authorization/authorizer.d.ts.map +1 -1
- package/dist/authorization/authorizer.js +5 -9
- package/dist/authorization/authorizer.js.map +1 -1
- package/dist/authorization/derived-tuples.d.ts.map +1 -1
- package/dist/authorization/derived-tuples.js +10 -25
- package/dist/authorization/derived-tuples.js.map +1 -1
- package/dist/authorization/evaluator.d.ts +13 -8
- package/dist/authorization/evaluator.d.ts.map +1 -1
- package/dist/authorization/evaluator.js +4 -20
- package/dist/authorization/evaluator.js.map +1 -1
- package/dist/authorization/list-read-scope.d.ts.map +1 -1
- package/dist/authorization/list-read-scope.js +24 -20
- package/dist/authorization/list-read-scope.js.map +1 -1
- package/dist/authorization/model/agent.d.ts.map +1 -1
- package/dist/authorization/model/agent.js +4 -5
- package/dist/authorization/model/agent.js.map +1 -1
- package/dist/authorization/model/agent_instance.d.ts.map +1 -1
- package/dist/authorization/model/agent_instance.js +2 -2
- package/dist/authorization/model/agent_instance.js.map +1 -1
- package/dist/authorization/model/mcp_server.d.ts.map +1 -1
- package/dist/authorization/model/mcp_server.js +2 -2
- package/dist/authorization/model/mcp_server.js.map +1 -1
- package/dist/authorization/model/organization.d.ts.map +1 -1
- package/dist/authorization/model/organization.js +2 -0
- package/dist/authorization/model/organization.js.map +1 -1
- package/dist/authorization/model/plugin.d.ts.map +1 -1
- package/dist/authorization/model/plugin.js +3 -4
- package/dist/authorization/model/plugin.js.map +1 -1
- package/dist/authorization/model/rewrite.d.ts +8 -10
- package/dist/authorization/model/rewrite.d.ts.map +1 -1
- package/dist/authorization/model/rewrite.js +0 -3
- package/dist/authorization/model/rewrite.js.map +1 -1
- package/dist/authorization/model/skill.d.ts.map +1 -1
- package/dist/authorization/model/skill.js +2 -2
- package/dist/authorization/model/skill.js.map +1 -1
- package/dist/authorization/model/workflow.d.ts.map +1 -1
- package/dist/authorization/model/workflow.js +2 -2
- package/dist/authorization/model/workflow.js.map +1 -1
- package/dist/authorization/model/workflow_instance.d.ts.map +1 -1
- package/dist/authorization/model/workflow_instance.js +2 -2
- package/dist/authorization/model/workflow_instance.js.map +1 -1
- package/dist/authorization/organization-directory.d.ts.map +1 -1
- package/dist/authorization/organization-directory.js +2 -3
- package/dist/authorization/organization-directory.js.map +1 -1
- package/dist/authorization/store-test-kit.d.ts +0 -6
- package/dist/authorization/store-test-kit.d.ts.map +1 -1
- package/dist/authorization/store-test-kit.js +16 -62
- package/dist/authorization/store-test-kit.js.map +1 -1
- package/dist/authorization/tuples.d.ts +13 -32
- package/dist/authorization/tuples.d.ts.map +1 -1
- package/dist/authorization/tuples.js +3 -11
- package/dist/authorization/tuples.js.map +1 -1
- package/dist/domain/agent/controller.d.ts.map +1 -1
- package/dist/domain/agent/controller.js +6 -4
- package/dist/domain/agent/controller.js.map +1 -1
- package/dist/domain/agentchannel/controller.d.ts.map +1 -1
- package/dist/domain/agentchannel/controller.js +9 -2
- package/dist/domain/agentchannel/controller.js.map +1 -1
- package/dist/domain/agentchannel/steps.d.ts +19 -0
- package/dist/domain/agentchannel/steps.d.ts.map +1 -1
- package/dist/domain/agentchannel/steps.js +32 -0
- package/dist/domain/agentchannel/steps.js.map +1 -1
- package/dist/domain/agentexecution/controller.d.ts.map +1 -1
- package/dist/domain/agentexecution/controller.js +3 -1
- package/dist/domain/agentexecution/controller.js.map +1 -1
- package/dist/domain/agentinstance/controller.d.ts +5 -5
- package/dist/domain/agentinstance/controller.d.ts.map +1 -1
- package/dist/domain/agentinstance/controller.js +9 -5
- package/dist/domain/agentinstance/controller.js.map +1 -1
- package/dist/domain/agentinstance/steps.d.ts +43 -8
- package/dist/domain/agentinstance/steps.d.ts.map +1 -1
- package/dist/domain/agentinstance/steps.js +71 -8
- package/dist/domain/agentinstance/steps.js.map +1 -1
- package/dist/domain/agentshare/constants.d.ts +6 -11
- package/dist/domain/agentshare/constants.d.ts.map +1 -1
- package/dist/domain/agentshare/constants.js +8 -16
- package/dist/domain/agentshare/constants.js.map +1 -1
- package/dist/domain/agentshare/controller.d.ts.map +1 -1
- package/dist/domain/agentshare/controller.js +10 -2
- package/dist/domain/agentshare/controller.js.map +1 -1
- package/dist/domain/agentshare/steps.d.ts +61 -10
- package/dist/domain/agentshare/steps.d.ts.map +1 -1
- package/dist/domain/agentshare/steps.js +121 -117
- package/dist/domain/agentshare/steps.js.map +1 -1
- package/dist/domain/artifact/controller.js +21 -25
- package/dist/domain/artifact/controller.js.map +1 -1
- package/dist/domain/channelapp/controller.d.ts.map +1 -1
- package/dist/domain/channelapp/controller.js +2 -0
- package/dist/domain/channelapp/controller.js.map +1 -1
- package/dist/domain/environment/controller.d.ts.map +1 -1
- package/dist/domain/environment/controller.js +4 -3
- package/dist/domain/environment/controller.js.map +1 -1
- package/dist/domain/executioncontext/controller.d.ts.map +1 -1
- package/dist/domain/executioncontext/controller.js +4 -1
- package/dist/domain/executioncontext/controller.js.map +1 -1
- package/dist/domain/executioncontext/steps.d.ts.map +1 -1
- package/dist/domain/executioncontext/steps.js +2 -1
- package/dist/domain/executioncontext/steps.js.map +1 -1
- package/dist/domain/mcpserver/connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/connect.js +8 -7
- package/dist/domain/mcpserver/connect.js.map +1 -1
- package/dist/domain/mcpserver/controller.d.ts.map +1 -1
- package/dist/domain/mcpserver/controller.js +5 -4
- package/dist/domain/mcpserver/controller.js.map +1 -1
- package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
- package/dist/domain/mcpserver/start-connect.js +8 -7
- package/dist/domain/mcpserver/start-connect.js.map +1 -1
- package/dist/domain/memory/controller.d.ts.map +1 -1
- package/dist/domain/memory/controller.js +6 -1
- package/dist/domain/memory/controller.js.map +1 -1
- package/dist/domain/memory/steps.d.ts +23 -0
- package/dist/domain/memory/steps.d.ts.map +1 -1
- package/dist/domain/memory/steps.js +35 -0
- package/dist/domain/memory/steps.js.map +1 -1
- package/dist/domain/oauthapp/controller.d.ts.map +1 -1
- package/dist/domain/oauthapp/controller.js +2 -0
- package/dist/domain/oauthapp/controller.js.map +1 -1
- package/dist/domain/plugin/controller.d.ts.map +1 -1
- package/dist/domain/plugin/controller.js +6 -27
- package/dist/domain/plugin/controller.js.map +1 -1
- package/dist/domain/plugin/push.d.ts +7 -5
- package/dist/domain/plugin/push.d.ts.map +1 -1
- package/dist/domain/plugin/push.js +8 -14
- package/dist/domain/plugin/push.js.map +1 -1
- package/dist/domain/schedule/controller.d.ts.map +1 -1
- package/dist/domain/schedule/controller.js +10 -2
- package/dist/domain/schedule/controller.js.map +1 -1
- package/dist/domain/schedule/steps.d.ts +19 -0
- package/dist/domain/schedule/steps.d.ts.map +1 -1
- package/dist/domain/schedule/steps.js +32 -0
- package/dist/domain/schedule/steps.js.map +1 -1
- package/dist/domain/session/controller.d.ts.map +1 -1
- package/dist/domain/session/controller.js +3 -2
- package/dist/domain/session/controller.js.map +1 -1
- package/dist/domain/session/steps.d.ts +8 -9
- package/dist/domain/session/steps.d.ts.map +1 -1
- package/dist/domain/session/steps.js +17 -21
- package/dist/domain/session/steps.js.map +1 -1
- package/dist/domain/skill/controller.d.ts.map +1 -1
- package/dist/domain/skill/controller.js +8 -19
- package/dist/domain/skill/controller.js.map +1 -1
- package/dist/domain/workflow/agent-call-references.d.ts +54 -0
- package/dist/domain/workflow/agent-call-references.d.ts.map +1 -0
- package/dist/domain/workflow/agent-call-references.js +97 -0
- package/dist/domain/workflow/agent-call-references.js.map +1 -0
- package/dist/domain/workflow/controller.d.ts.map +1 -1
- package/dist/domain/workflow/controller.js +44 -113
- package/dist/domain/workflow/controller.js.map +1 -1
- package/dist/domain/workflow/registry/data/task-kind-registry.json +1 -1
- package/dist/domain/workflow/validation/task-config-constraints.d.ts +10 -1
- package/dist/domain/workflow/validation/task-config-constraints.d.ts.map +1 -1
- package/dist/domain/workflow/validation/task-config-constraints.js +3 -2
- package/dist/domain/workflow/validation/task-config-constraints.js.map +1 -1
- package/dist/domain/workflow/version-resolution.d.ts +5 -0
- package/dist/domain/workflow/version-resolution.d.ts.map +1 -0
- package/dist/domain/workflow/version-resolution.js +113 -0
- package/dist/domain/workflow/version-resolution.js.map +1 -0
- package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
- package/dist/domain/workflowexecution/controller.js +4 -2
- package/dist/domain/workflowexecution/controller.js.map +1 -1
- package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
- package/dist/domain/workflowinstance/controller.js +9 -5
- package/dist/domain/workflowinstance/controller.js.map +1 -1
- package/dist/domain/workflowinstance/steps.d.ts +20 -0
- package/dist/domain/workflowinstance/steps.d.ts.map +1 -1
- package/dist/domain/workflowinstance/steps.js +39 -0
- package/dist/domain/workflowinstance/steps.js.map +1 -1
- package/dist/extensions/authorization-queries.d.ts +6 -5
- package/dist/extensions/authorization-queries.d.ts.map +1 -1
- package/dist/extensions/identity.d.ts +19 -0
- package/dist/extensions/identity.d.ts.map +1 -1
- package/dist/extensions/identity.js +22 -3
- package/dist/extensions/identity.js.map +1 -1
- package/dist/extensions/list-read-scope.d.ts +42 -8
- package/dist/extensions/list-read-scope.d.ts.map +1 -1
- package/dist/extensions/list-read-scope.js +13 -2
- package/dist/extensions/list-read-scope.js.map +1 -1
- package/dist/extensions/resource-authorization.d.ts +3 -2
- package/dist/extensions/resource-authorization.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/apiresource-meta.d.ts +12 -3
- package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
- package/dist/pipeline/apiresource-meta.js +21 -10
- package/dist/pipeline/apiresource-meta.js.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.d.ts +9 -3
- package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.js +9 -11
- package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
- package/dist/pipeline/steps/authorize-resolved-target.d.ts +88 -0
- package/dist/pipeline/steps/authorize-resolved-target.d.ts.map +1 -0
- package/dist/pipeline/steps/authorize-resolved-target.js +36 -0
- package/dist/pipeline/steps/authorize-resolved-target.js.map +1 -0
- package/dist/pipeline/steps/authorize.d.ts +27 -0
- package/dist/pipeline/steps/authorize.d.ts.map +1 -1
- package/dist/pipeline/steps/authorize.js +49 -10
- package/dist/pipeline/steps/authorize.js.map +1 -1
- package/dist/pipeline/steps/guard-memory-capture.d.ts.map +1 -1
- package/dist/pipeline/steps/guard-memory-capture.js +2 -1
- package/dist/pipeline/steps/guard-memory-capture.js.map +1 -1
- package/dist/pipeline/steps/guard-reserved-labels.d.ts.map +1 -1
- package/dist/pipeline/steps/guard-reserved-labels.js +6 -7
- package/dist/pipeline/steps/guard-reserved-labels.js.map +1 -1
- package/dist/pipeline/steps/helpers.d.ts +9 -5
- package/dist/pipeline/steps/helpers.d.ts.map +1 -1
- package/dist/pipeline/steps/helpers.js +11 -15
- package/dist/pipeline/steps/helpers.js.map +1 -1
- package/dist/pipeline/steps/references.d.ts +178 -20
- package/dist/pipeline/steps/references.d.ts.map +1 -1
- package/dist/pipeline/steps/references.js +344 -43
- package/dist/pipeline/steps/references.js.map +1 -1
- package/dist/pipeline/steps/version-history.d.ts +11 -0
- package/dist/pipeline/steps/version-history.d.ts.map +1 -1
- package/dist/pipeline/steps/version-history.js +26 -0
- package/dist/pipeline/steps/version-history.js.map +1 -1
- package/dist/query/search/controller.js +0 -1
- package/dist/query/search/controller.js.map +1 -1
- package/dist/query/search/criteria.d.ts +1 -5
- package/dist/query/search/criteria.d.ts.map +1 -1
- package/dist/query/search/criteria.js +3 -13
- package/dist/query/search/criteria.js.map +1 -1
- package/dist/query/search/handler.d.ts +5 -4
- package/dist/query/search/handler.d.ts.map +1 -1
- package/dist/query/search/handler.js +7 -6
- package/dist/query/search/handler.js.map +1 -1
- package/dist/query/search/query-store.d.ts.map +1 -1
- package/dist/query/search/query-store.js +0 -2
- package/dist/query/search/query-store.js.map +1 -1
- package/dist/store/interface.d.ts +3 -6
- package/dist/store/interface.d.ts.map +1 -1
- package/dist/store/interface.js.map +1 -1
- package/dist/store/postgres/migrations.d.ts +3 -1
- package/dist/store/postgres/migrations.d.ts.map +1 -1
- package/dist/store/postgres/migrations.js +35 -1
- package/dist/store/postgres/migrations.js.map +1 -1
- package/dist/store/postgres/store.d.ts.map +1 -1
- package/dist/store/postgres/store.js +4 -9
- package/dist/store/postgres/store.js.map +1 -1
- package/dist/store/public-visibility-retired.d.ts +67 -0
- package/dist/store/public-visibility-retired.d.ts.map +1 -0
- package/dist/store/public-visibility-retired.js +55 -0
- package/dist/store/public-visibility-retired.js.map +1 -0
- package/dist/store/sqlite/migrations.d.ts +3 -1
- package/dist/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/store/sqlite/migrations.js +36 -1
- package/dist/store/sqlite/migrations.js.map +1 -1
- package/dist/store/sqlite/store.d.ts.map +1 -1
- package/dist/store/sqlite/store.js +4 -8
- package/dist/store/sqlite/store.js.map +1 -1
- package/package.json +6 -6
- package/src/authorization/README.md +24 -26
- package/src/authorization/__tests__/authorizer.test.ts +10 -9
- package/src/authorization/__tests__/derived-tuples.test.ts +4 -11
- package/src/authorization/__tests__/evaluator.test.ts +14 -73
- package/src/authorization/__tests__/facts.test.ts +2 -2
- package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +6 -98
- package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +4 -61
- package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +1 -21
- package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +1 -25
- package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +1 -3
- package/src/authorization/__tests__/list-read-scope.test.ts +41 -29
- package/src/authorization/__tests__/skip-lane-inventory.test.ts +160 -0
- package/src/authorization/__tests__/store-tests.test.ts +1 -6
- package/src/authorization/__tests__/tuples.test.ts +12 -11
- package/src/authorization/__tests__/wire-permissions.test.ts +5 -5
- package/src/authorization/authorizer.ts +4 -9
- package/src/authorization/derived-tuples.ts +14 -31
- package/src/authorization/evaluator.ts +15 -44
- package/src/authorization/list-read-scope.ts +27 -22
- package/src/authorization/model/__tests__/registry.test.ts +2 -0
- package/src/authorization/model/agent.ts +2 -5
- package/src/authorization/model/agent_instance.ts +0 -2
- package/src/authorization/model/mcp_server.ts +0 -2
- package/src/authorization/model/organization.ts +2 -0
- package/src/authorization/model/plugin.ts +1 -4
- package/src/authorization/model/rewrite.ts +8 -13
- package/src/authorization/model/skill.ts +0 -2
- package/src/authorization/model/workflow.ts +0 -2
- package/src/authorization/model/workflow_instance.ts +0 -2
- package/src/authorization/organization-directory.ts +1 -3
- package/src/authorization/store-test-kit.ts +16 -75
- package/src/authorization/tuples.ts +16 -39
- package/src/domain/agent/__tests__/agent.test.ts +11 -4
- package/src/domain/agent/controller.ts +17 -7
- package/src/domain/agentchannel/__tests__/agentchannel.test.ts +223 -48
- package/src/domain/agentchannel/__tests__/create-authorization.test.ts +58 -0
- package/src/domain/agentchannel/controller.ts +25 -1
- package/src/domain/agentchannel/steps.ts +40 -0
- package/src/domain/agentexecution/controller.ts +6 -1
- package/src/domain/agentinstance/__tests__/create-authorization.composed.test.ts +243 -0
- package/src/domain/agentinstance/__tests__/create-authorization.test.ts +144 -0
- package/src/domain/agentinstance/controller.ts +30 -17
- package/src/domain/agentinstance/steps.ts +82 -8
- package/src/domain/agentshare/__tests__/agentshare.test.ts +196 -172
- package/src/domain/agentshare/__tests__/create-authorization.test.ts +71 -0
- package/src/domain/agentshare/__tests__/member-audience.test.ts +113 -0
- package/src/domain/agentshare/constants.ts +14 -26
- package/src/domain/agentshare/controller.ts +27 -1
- package/src/domain/agentshare/steps.ts +168 -155
- package/src/domain/artifact/controller.ts +18 -22
- package/src/domain/channelapp/controller.ts +10 -0
- package/src/domain/environment/controller.ts +15 -8
- package/src/domain/executioncontext/__tests__/executioncontext.test.ts +1 -0
- package/src/domain/executioncontext/controller.ts +15 -1
- package/src/domain/executioncontext/steps.ts +2 -1
- package/src/domain/mcpserver/__tests__/mcpserver.test.ts +115 -28
- package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +53 -18
- package/src/domain/mcpserver/connect.ts +11 -10
- package/src/domain/mcpserver/controller.ts +19 -13
- package/src/domain/mcpserver/start-connect.ts +17 -11
- package/src/domain/memory/__tests__/create-authorization.test.ts +59 -0
- package/src/domain/memory/controller.ts +11 -0
- package/src/domain/memory/steps.ts +41 -0
- package/src/domain/oauthapp/controller.ts +10 -0
- package/src/domain/plugin/controller.ts +23 -44
- package/src/domain/plugin/push.ts +8 -16
- package/src/domain/schedule/__tests__/create-authorization.test.ts +58 -0
- package/src/domain/schedule/controller.ts +26 -1
- package/src/domain/schedule/steps.ts +45 -2
- package/src/domain/session/controller.ts +12 -4
- package/src/domain/session/steps.ts +24 -32
- package/src/domain/skill/controller.ts +24 -30
- package/src/domain/workflow/__tests__/agent-call-references.test.ts +222 -0
- package/src/domain/workflow/agent-call-references.ts +157 -0
- package/src/domain/workflow/controller.ts +86 -155
- package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
- package/src/domain/workflow/validation/task-config-constraints.ts +7 -3
- package/src/domain/workflow/version-resolution.ts +166 -0
- package/src/domain/workflowexecution/controller.ts +7 -2
- package/src/domain/workflowinstance/__tests__/create-authorization.test.ts +109 -0
- package/src/domain/workflowinstance/controller.ts +25 -12
- package/src/domain/workflowinstance/steps.ts +49 -1
- package/src/extensions/__tests__/built-in-authorization-composed.test.ts +32 -19
- package/src/extensions/__tests__/composed-support.ts +38 -4
- package/src/extensions/__tests__/extension-composition.test.ts +4 -4
- package/src/extensions/__tests__/identity.test.ts +44 -1
- package/src/extensions/__tests__/list-read-scope-composed.test.ts +96 -7
- package/src/extensions/__tests__/list-read-scope.test.ts +63 -0
- package/src/extensions/authorization-queries.ts +6 -5
- package/src/extensions/identity.ts +23 -5
- package/src/extensions/list-read-scope.ts +48 -8
- package/src/extensions/resource-authorization.ts +3 -5
- package/src/index.ts +0 -1
- package/src/pipeline/__tests__/supports-visibility.test.ts +112 -0
- package/src/pipeline/apiresource-meta.ts +21 -10
- package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +18 -31
- package/src/pipeline/steps/__tests__/authorize-resolved-target.test.ts +285 -0
- package/src/pipeline/steps/__tests__/references.test.ts +703 -0
- package/src/pipeline/steps/authorization-tuples.ts +9 -11
- package/src/pipeline/steps/authorize-resolved-target.ts +129 -0
- package/src/pipeline/steps/authorize.ts +70 -13
- package/src/pipeline/steps/guard-memory-capture.ts +2 -1
- package/src/pipeline/steps/guard-reserved-labels.ts +6 -9
- package/src/pipeline/steps/helpers.ts +11 -15
- package/src/pipeline/steps/references.ts +578 -70
- package/src/pipeline/steps/version-history.ts +34 -0
- package/src/query/search/__tests__/criteria.test.ts +0 -4
- package/src/query/search/__tests__/query-store.test.ts +11 -40
- package/src/query/search/controller.ts +0 -1
- package/src/query/search/criteria.ts +0 -14
- package/src/query/search/handler.ts +6 -7
- package/src/query/search/query-store.ts +0 -2
- package/src/store/__tests__/public-visibility-retired.test.ts +127 -0
- package/src/store/__tests__/store-contract.ts +6 -51
- package/src/store/interface.ts +3 -6
- package/src/store/postgres/__tests__/migrations.test.ts +187 -6
- package/src/store/postgres/__tests__/store-contract.test.ts +0 -2
- package/src/store/postgres/migrations.ts +48 -1
- package/src/store/postgres/store.ts +4 -11
- package/src/store/public-visibility-retired.ts +119 -0
- package/src/store/sqlite/__tests__/migrations.test.ts +191 -5
- package/src/store/sqlite/migrations.ts +45 -1
- package/src/store/sqlite/store.ts +4 -10
- package/dist/pipeline/steps/visibility-gates.d.ts +0 -27
- package/dist/pipeline/steps/visibility-gates.d.ts.map +0 -1
- package/dist/pipeline/steps/visibility-gates.js +0 -139
- package/dist/pipeline/steps/visibility-gates.js.map +0 -1
- package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +0 -98
- package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +0 -52
- package/src/pipeline/steps/__tests__/visibility-gates.test.ts +0 -187
- package/src/pipeline/steps/visibility-gates.ts +0 -174
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins AuthorizeMemberAudience (steps.ts), the member-profile lane's gate:
|
|
3
|
+
* membership (can_view on the reference's organization) is asked before
|
|
4
|
+
* the share is loaded; deny and not-found both answer the lane's one
|
|
5
|
+
* NOT_FOUND, byte-identical to a missing share, so a share URL teaches a
|
|
6
|
+
* non-member nothing; unavailable is INTERNAL; an empty org asks nothing
|
|
7
|
+
* and is left to the loader's INVALID_ARGUMENT; the internal class skips.
|
|
8
|
+
*/
|
|
9
|
+
import { describe, expect, it } from "vitest";
|
|
10
|
+
import { create } from "@bufbuild/protobuf";
|
|
11
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
12
|
+
|
|
13
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
14
|
+
import { ApiResourceReferenceSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
15
|
+
import { IamPermission } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
Authorizer,
|
|
19
|
+
AuthzCheck,
|
|
20
|
+
AuthzDecision,
|
|
21
|
+
} from "../../../extensions/authorizer.js";
|
|
22
|
+
import type { CallerIdentity } from "../../../extensions/identity.js";
|
|
23
|
+
import { testCallerIdentity } from "../../../pipeline/__tests__/support.js";
|
|
24
|
+
import { RequestContext } from "../../../pipeline/request-context.js";
|
|
25
|
+
import { AUTHORIZATION_UNAVAILABLE_MESSAGE } from "../../../pipeline/steps/authorize.js";
|
|
26
|
+
import { newAuthorizeMemberAudienceStep, sharedNotFound } from "../steps.js";
|
|
27
|
+
|
|
28
|
+
function fakeAuthorizer(decision: AuthzDecision): {
|
|
29
|
+
authorizer: Authorizer;
|
|
30
|
+
checks: AuthzCheck[];
|
|
31
|
+
} {
|
|
32
|
+
const checks: AuthzCheck[] = [];
|
|
33
|
+
return {
|
|
34
|
+
checks,
|
|
35
|
+
authorizer: {
|
|
36
|
+
authorize(_caller, check) {
|
|
37
|
+
checks.push(check);
|
|
38
|
+
return Promise.resolve(decision);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ctxFor(org: string, caller: CallerIdentity = testCallerIdentity()) {
|
|
45
|
+
return new RequestContext(
|
|
46
|
+
ApiResourceReferenceSchema,
|
|
47
|
+
create(ApiResourceReferenceSchema, { org, slug: "helper" }),
|
|
48
|
+
caller,
|
|
49
|
+
ApiResourceKind.agent_share,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function captureError(
|
|
54
|
+
run: () => void | Promise<void>,
|
|
55
|
+
): Promise<ConnectError> {
|
|
56
|
+
try {
|
|
57
|
+
await run();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return ConnectError.from(error);
|
|
60
|
+
}
|
|
61
|
+
throw new Error("expected the step to reject");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe("AuthorizeMemberAudience", () => {
|
|
65
|
+
it("asks can_view on the reference's organization and admits an allow", async () => {
|
|
66
|
+
const { authorizer, checks } = fakeAuthorizer({ kind: "allow" });
|
|
67
|
+
await newAuthorizeMemberAudienceStep(authorizer).execute(ctxFor("acme"));
|
|
68
|
+
expect(checks).toEqual([
|
|
69
|
+
{
|
|
70
|
+
permission: IamPermission.can_view,
|
|
71
|
+
resourceKind: ApiResourceKind.organization,
|
|
72
|
+
resourceId: "acme",
|
|
73
|
+
},
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("deny and not-found both answer the lane's NOT_FOUND, byte-identical to a missing share", async () => {
|
|
78
|
+
for (const decision of [
|
|
79
|
+
{ kind: "deny", reason: "not a member" },
|
|
80
|
+
{ kind: "not-found" },
|
|
81
|
+
] as const) {
|
|
82
|
+
const { authorizer } = fakeAuthorizer(decision);
|
|
83
|
+
const error = await captureError(() =>
|
|
84
|
+
newAuthorizeMemberAudienceStep(authorizer).execute(ctxFor("acme")),
|
|
85
|
+
);
|
|
86
|
+
expect(error.code).toBe(Code.NotFound);
|
|
87
|
+
expect(error.rawMessage).toBe(sharedNotFound("helper").rawMessage);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("unavailable is INTERNAL, never a refusal", async () => {
|
|
92
|
+
const { authorizer } = fakeAuthorizer({
|
|
93
|
+
kind: "unavailable",
|
|
94
|
+
cause: new Error("backend down"),
|
|
95
|
+
});
|
|
96
|
+
const error = await captureError(() =>
|
|
97
|
+
newAuthorizeMemberAudienceStep(authorizer).execute(ctxFor("acme")),
|
|
98
|
+
);
|
|
99
|
+
expect(error.code).toBe(Code.Internal);
|
|
100
|
+
expect(error.rawMessage).toBe(AUTHORIZATION_UNAVAILABLE_MESSAGE);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("an empty org asks nothing (the loader's INVALID_ARGUMENT answers), and the internal class skips", async () => {
|
|
104
|
+
const denying = fakeAuthorizer({ kind: "deny", reason: "" });
|
|
105
|
+
await newAuthorizeMemberAudienceStep(denying.authorizer).execute(
|
|
106
|
+
ctxFor(""),
|
|
107
|
+
);
|
|
108
|
+
await newAuthorizeMemberAudienceStep(denying.authorizer).execute(
|
|
109
|
+
ctxFor("acme", testCallerIdentity({ callerClass: "internal" })),
|
|
110
|
+
);
|
|
111
|
+
expect(denying.checks).toEqual([]);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -17,10 +17,12 @@ export const SHARE_LINK_TOKEN_BYTES = 20;
|
|
|
17
17
|
* resolveShareDefaultsStep, byte-pinned. The share's org appears in the
|
|
18
18
|
* hosted chat URL and is the billing org, so it can never be inferred.
|
|
19
19
|
*/
|
|
20
|
-
export const ORG_REQUIRED_MESSAGE =
|
|
20
|
+
export const ORG_REQUIRED_MESSAGE =
|
|
21
|
+
"metadata.org is required for an agent share";
|
|
21
22
|
|
|
22
23
|
/** InvalidArgument copy when spec.agent_ref.slug is absent — Go, pinned. */
|
|
23
|
-
export const AGENT_REF_SLUG_REQUIRED_MESSAGE =
|
|
24
|
+
export const AGENT_REF_SLUG_REQUIRED_MESSAGE =
|
|
25
|
+
"spec.agent_ref.slug is required";
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* InvalidArgument copy for BOTH profile lanes when org is absent — Go
|
|
@@ -28,34 +30,20 @@ export const AGENT_REF_SLUG_REQUIRED_MESSAGE = "spec.agent_ref.slug is required"
|
|
|
28
30
|
* Anti-enumeration: an empty org would mean "match slug across all orgs"
|
|
29
31
|
* on a public endpoint.
|
|
30
32
|
*/
|
|
31
|
-
export const ORG_REQUIRED_FOR_LOOKUP_MESSAGE =
|
|
33
|
+
export const ORG_REQUIRED_FOR_LOOKUP_MESSAGE =
|
|
34
|
+
"org is required for shared agent lookup";
|
|
32
35
|
|
|
33
36
|
/**
|
|
34
|
-
* FailedPrecondition copy
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
+
* FailedPrecondition copy when spec.agent_ref names another organization's
|
|
38
|
+
* agent — the schedule's and the channel's same-organization sentence in
|
|
39
|
+
* the share's own words. A share offers an agent its own organization
|
|
40
|
+
* owns; to share another organization's agent, install the plugin that
|
|
41
|
+
* carries it and share the installed copy.
|
|
37
42
|
*/
|
|
38
|
-
export function
|
|
43
|
+
export function sameOrgInvariantMessage(refOrg: string): string {
|
|
39
44
|
return (
|
|
40
|
-
"
|
|
41
|
-
`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* FailedPrecondition copy naming every non-public dependency blocking a
|
|
47
|
-
* cross-org share (decision 013 D5) — Go validateCrossOrgShare,
|
|
48
|
-
* byte-pinned. Blockers are deduped, formatted "<kind> <org>/<slug>", and
|
|
49
|
-
* sorted, so the refusal is deterministic.
|
|
50
|
-
*/
|
|
51
|
-
export function crossOrgBlockersMessage(
|
|
52
|
-
agentOrg: string,
|
|
53
|
-
agentSlug: string,
|
|
54
|
-
blockers: readonly string[],
|
|
55
|
-
): string {
|
|
56
|
-
return (
|
|
57
|
-
`cannot share ${agentOrg}/${agentSlug} across organizations: ` +
|
|
58
|
-
`it references resources that are not public: ${blockers.join(", ")}`
|
|
45
|
+
"spec.agent_ref.org must match metadata.org — a share must live in " +
|
|
46
|
+
`the referenced agent's organization (${refOrg})`
|
|
59
47
|
);
|
|
60
48
|
}
|
|
61
49
|
|
|
@@ -60,6 +60,10 @@ import type { PipelineStep } from "../../pipeline/pipeline.js";
|
|
|
60
60
|
import { callerIdentityOf } from "../../pipeline/interceptors/auth.js";
|
|
61
61
|
import { RequestContext } from "../../pipeline/request-context.js";
|
|
62
62
|
import { newAuthorizeStep } from "../../pipeline/steps/authorize.js";
|
|
63
|
+
import {
|
|
64
|
+
loadedTargetAsMethod,
|
|
65
|
+
newAuthorizeResolvedTargetStep,
|
|
66
|
+
} from "../../pipeline/steps/authorize-resolved-target.js";
|
|
63
67
|
import { newGuardReservedLabelsStep } from "../../pipeline/steps/guard-reserved-labels.js";
|
|
64
68
|
import {
|
|
65
69
|
newBuildNewStateStep,
|
|
@@ -89,7 +93,10 @@ import {
|
|
|
89
93
|
TARGET_RESOURCE_KEY,
|
|
90
94
|
newLoadTargetStep,
|
|
91
95
|
} from "../../pipeline/steps/load-target.js";
|
|
92
|
-
import {
|
|
96
|
+
import {
|
|
97
|
+
newNormalizeReferencesStep,
|
|
98
|
+
newValidateReferencesStep,
|
|
99
|
+
} from "../../pipeline/steps/references.js";
|
|
93
100
|
import {
|
|
94
101
|
newCleanupIamPoliciesStep,
|
|
95
102
|
newCreateAuthorizationTuplesStep,
|
|
@@ -109,6 +116,8 @@ import {
|
|
|
109
116
|
newValidateShareUpdateStep,
|
|
110
117
|
sharedNotFound,
|
|
111
118
|
sharingLinkTokenAllowed,
|
|
119
|
+
resolveShareCreateTargets,
|
|
120
|
+
newAuthorizeMemberAudienceStep,
|
|
112
121
|
} from "./steps.js";
|
|
113
122
|
|
|
114
123
|
export interface AgentShareControllerDeps {
|
|
@@ -176,12 +185,20 @@ async function createShare(
|
|
|
176
185
|
.addStep(newValidateProtoStep())
|
|
177
186
|
.addStep(newValidateVisibilityStep())
|
|
178
187
|
.addStep(newResolveShareDefaultsStep(deps.store))
|
|
188
|
+
// Before the duplicate check (steps.ts, resolveShareCreateTargets).
|
|
189
|
+
.addStep(
|
|
190
|
+
newAuthorizeResolvedTargetStep(
|
|
191
|
+
deps.authorizer,
|
|
192
|
+
resolveShareCreateTargets,
|
|
193
|
+
),
|
|
194
|
+
)
|
|
179
195
|
.addStep(newResolveSlugStep())
|
|
180
196
|
.addStep(newCheckDuplicateStep(deps.store))
|
|
181
197
|
.addStep(newBuildNewStateStep())
|
|
182
198
|
.addStep(newGuardReservedLabelsStep(deps.authorizer))
|
|
183
199
|
.addStep(newStampAgentPinStep())
|
|
184
200
|
.addStep(newNormalizeReferencesStep())
|
|
201
|
+
.addStep(newValidateReferencesStep(deps.store))
|
|
185
202
|
.addStep(newPersistStep(deps.store))
|
|
186
203
|
.addStep(
|
|
187
204
|
newCreateAuthorizationTuplesStep(
|
|
@@ -226,6 +243,7 @@ async function update(
|
|
|
226
243
|
.addStep(newBuildUpdateStateStep())
|
|
227
244
|
.addStep(newGuardReservedLabelsStep(deps.authorizer))
|
|
228
245
|
.addStep(newNormalizeReferencesStep())
|
|
246
|
+
.addStep(newValidateReferencesStep(deps.store))
|
|
229
247
|
.addStep(newPersistStep(deps.store))
|
|
230
248
|
.build()
|
|
231
249
|
.execute(reqCtx);
|
|
@@ -491,6 +509,12 @@ async function getByReference(
|
|
|
491
509
|
)
|
|
492
510
|
.addStep(newValidateProtoStep())
|
|
493
511
|
.addStep(newLoadByReferenceStep(deps.store, AgentShareSchema))
|
|
512
|
+
.addStep(
|
|
513
|
+
newAuthorizeResolvedTargetStep(
|
|
514
|
+
deps.authorizer,
|
|
515
|
+
loadedTargetAsMethod(AgentShareQueryController.method.get),
|
|
516
|
+
),
|
|
517
|
+
)
|
|
494
518
|
.build()
|
|
495
519
|
.execute(reqCtx);
|
|
496
520
|
return reqCtx.get(TARGET_RESOURCE_KEY) as AgentShare;
|
|
@@ -797,6 +821,8 @@ async function getSharedProfileForMember(
|
|
|
797
821
|
),
|
|
798
822
|
)
|
|
799
823
|
.addStep(newValidateProtoStep())
|
|
824
|
+
// Membership before existence (steps.ts, AuthorizeMemberAudience).
|
|
825
|
+
.addStep(newAuthorizeMemberAudienceStep(deps.authorizer))
|
|
800
826
|
.addStep(newLoadShareForMemberProfileStep(deps.store))
|
|
801
827
|
.addStep(newProjectMemberSharedProfileStep(deps.store))
|
|
802
828
|
.build()
|