@stigmer/server 3.22.1-dev.20260922095755 → 3.22.1

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.
Files changed (268) hide show
  1. package/dist/authorization/authorizer.d.ts +8 -4
  2. package/dist/authorization/authorizer.d.ts.map +1 -1
  3. package/dist/authorization/authorizer.js +9 -5
  4. package/dist/authorization/authorizer.js.map +1 -1
  5. package/dist/authorization/derived-tuples.d.ts.map +1 -1
  6. package/dist/authorization/derived-tuples.js +25 -10
  7. package/dist/authorization/derived-tuples.js.map +1 -1
  8. package/dist/authorization/evaluator.d.ts +8 -7
  9. package/dist/authorization/evaluator.d.ts.map +1 -1
  10. package/dist/authorization/evaluator.js +20 -4
  11. package/dist/authorization/evaluator.js.map +1 -1
  12. package/dist/authorization/list-read-scope.d.ts.map +1 -1
  13. package/dist/authorization/list-read-scope.js +9 -5
  14. package/dist/authorization/list-read-scope.js.map +1 -1
  15. package/dist/authorization/model/agent.d.ts.map +1 -1
  16. package/dist/authorization/model/agent.js +5 -4
  17. package/dist/authorization/model/agent.js.map +1 -1
  18. package/dist/authorization/model/agent_instance.d.ts.map +1 -1
  19. package/dist/authorization/model/agent_instance.js +2 -2
  20. package/dist/authorization/model/agent_instance.js.map +1 -1
  21. package/dist/authorization/model/mcp_server.d.ts.map +1 -1
  22. package/dist/authorization/model/mcp_server.js +2 -2
  23. package/dist/authorization/model/mcp_server.js.map +1 -1
  24. package/dist/authorization/model/plugin.d.ts.map +1 -1
  25. package/dist/authorization/model/plugin.js +4 -3
  26. package/dist/authorization/model/plugin.js.map +1 -1
  27. package/dist/authorization/model/rewrite.d.ts +10 -8
  28. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  29. package/dist/authorization/model/rewrite.js +3 -0
  30. package/dist/authorization/model/rewrite.js.map +1 -1
  31. package/dist/authorization/model/skill.d.ts.map +1 -1
  32. package/dist/authorization/model/skill.js +2 -2
  33. package/dist/authorization/model/skill.js.map +1 -1
  34. package/dist/authorization/model/workflow.d.ts.map +1 -1
  35. package/dist/authorization/model/workflow.js +2 -2
  36. package/dist/authorization/model/workflow.js.map +1 -1
  37. package/dist/authorization/model/workflow_instance.d.ts.map +1 -1
  38. package/dist/authorization/model/workflow_instance.js +2 -2
  39. package/dist/authorization/model/workflow_instance.js.map +1 -1
  40. package/dist/authorization/organization-directory.d.ts.map +1 -1
  41. package/dist/authorization/organization-directory.js +3 -2
  42. package/dist/authorization/organization-directory.js.map +1 -1
  43. package/dist/authorization/store-test-kit.d.ts +6 -0
  44. package/dist/authorization/store-test-kit.d.ts.map +1 -1
  45. package/dist/authorization/store-test-kit.js +62 -16
  46. package/dist/authorization/store-test-kit.js.map +1 -1
  47. package/dist/authorization/tuples.d.ts +32 -13
  48. package/dist/authorization/tuples.d.ts.map +1 -1
  49. package/dist/authorization/tuples.js +11 -3
  50. package/dist/authorization/tuples.js.map +1 -1
  51. package/dist/domain/agent/controller.d.ts.map +1 -1
  52. package/dist/domain/agent/controller.js +4 -4
  53. package/dist/domain/agent/controller.js.map +1 -1
  54. package/dist/domain/agentchannel/controller.d.ts.map +1 -1
  55. package/dist/domain/agentchannel/controller.js +1 -3
  56. package/dist/domain/agentchannel/controller.js.map +1 -1
  57. package/dist/domain/agentexecution/controller.d.ts.map +1 -1
  58. package/dist/domain/agentexecution/controller.js +1 -3
  59. package/dist/domain/agentexecution/controller.js.map +1 -1
  60. package/dist/domain/agentinstance/controller.d.ts.map +1 -1
  61. package/dist/domain/agentinstance/controller.js +4 -3
  62. package/dist/domain/agentinstance/controller.js.map +1 -1
  63. package/dist/domain/agentshare/constants.d.ts +11 -6
  64. package/dist/domain/agentshare/constants.d.ts.map +1 -1
  65. package/dist/domain/agentshare/constants.js +16 -8
  66. package/dist/domain/agentshare/constants.js.map +1 -1
  67. package/dist/domain/agentshare/controller.d.ts.map +1 -1
  68. package/dist/domain/agentshare/controller.js +1 -3
  69. package/dist/domain/agentshare/controller.js.map +1 -1
  70. package/dist/domain/agentshare/steps.d.ts +25 -18
  71. package/dist/domain/agentshare/steps.d.ts.map +1 -1
  72. package/dist/domain/agentshare/steps.js +142 -41
  73. package/dist/domain/agentshare/steps.js.map +1 -1
  74. package/dist/domain/environment/controller.d.ts.map +1 -1
  75. package/dist/domain/environment/controller.js +3 -2
  76. package/dist/domain/environment/controller.js.map +1 -1
  77. package/dist/domain/executioncontext/controller.d.ts.map +1 -1
  78. package/dist/domain/executioncontext/controller.js +1 -2
  79. package/dist/domain/executioncontext/controller.js.map +1 -1
  80. package/dist/domain/mcpserver/controller.d.ts.map +1 -1
  81. package/dist/domain/mcpserver/controller.js +4 -3
  82. package/dist/domain/mcpserver/controller.js.map +1 -1
  83. package/dist/domain/plugin/controller.d.ts.map +1 -1
  84. package/dist/domain/plugin/controller.js +3 -1
  85. package/dist/domain/plugin/controller.js.map +1 -1
  86. package/dist/domain/plugin/push.d.ts +5 -7
  87. package/dist/domain/plugin/push.d.ts.map +1 -1
  88. package/dist/domain/plugin/push.js +14 -8
  89. package/dist/domain/plugin/push.js.map +1 -1
  90. package/dist/domain/schedule/controller.d.ts.map +1 -1
  91. package/dist/domain/schedule/controller.js +1 -3
  92. package/dist/domain/schedule/controller.js.map +1 -1
  93. package/dist/domain/session/controller.d.ts.map +1 -1
  94. package/dist/domain/session/controller.js +2 -3
  95. package/dist/domain/session/controller.js.map +1 -1
  96. package/dist/domain/skill/controller.d.ts.map +1 -1
  97. package/dist/domain/skill/controller.js +2 -0
  98. package/dist/domain/skill/controller.js.map +1 -1
  99. package/dist/domain/workflow/controller.d.ts.map +1 -1
  100. package/dist/domain/workflow/controller.js +6 -14
  101. package/dist/domain/workflow/controller.js.map +1 -1
  102. package/dist/domain/workflow/registry/data/task-kind-registry.json +1 -1
  103. package/dist/domain/workflow/validation/task-config-constraints.d.ts +1 -10
  104. package/dist/domain/workflow/validation/task-config-constraints.d.ts.map +1 -1
  105. package/dist/domain/workflow/validation/task-config-constraints.js +2 -3
  106. package/dist/domain/workflow/validation/task-config-constraints.js.map +1 -1
  107. package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
  108. package/dist/domain/workflowexecution/controller.js +2 -4
  109. package/dist/domain/workflowexecution/controller.js.map +1 -1
  110. package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
  111. package/dist/domain/workflowinstance/controller.js +4 -3
  112. package/dist/domain/workflowinstance/controller.js.map +1 -1
  113. package/dist/extensions/authorization-queries.d.ts +5 -6
  114. package/dist/extensions/authorization-queries.d.ts.map +1 -1
  115. package/dist/extensions/list-read-scope.d.ts +1 -1
  116. package/dist/extensions/resource-authorization.d.ts +2 -3
  117. package/dist/extensions/resource-authorization.d.ts.map +1 -1
  118. package/dist/index.d.ts +3 -1
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +13 -0
  121. package/dist/index.js.map +1 -1
  122. package/dist/pipeline/apiresource-meta.d.ts +3 -12
  123. package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
  124. package/dist/pipeline/apiresource-meta.js +10 -21
  125. package/dist/pipeline/apiresource-meta.js.map +1 -1
  126. package/dist/pipeline/steps/authorization-tuples.d.ts +3 -9
  127. package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
  128. package/dist/pipeline/steps/authorization-tuples.js +11 -9
  129. package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
  130. package/dist/pipeline/steps/references.d.ts +20 -178
  131. package/dist/pipeline/steps/references.d.ts.map +1 -1
  132. package/dist/pipeline/steps/references.js +43 -344
  133. package/dist/pipeline/steps/references.js.map +1 -1
  134. package/dist/pipeline/steps/visibility-gates.d.ts +27 -0
  135. package/dist/pipeline/steps/visibility-gates.d.ts.map +1 -0
  136. package/dist/pipeline/steps/visibility-gates.js +139 -0
  137. package/dist/pipeline/steps/visibility-gates.js.map +1 -0
  138. package/dist/query/search/controller.js +1 -0
  139. package/dist/query/search/controller.js.map +1 -1
  140. package/dist/query/search/criteria.d.ts +5 -1
  141. package/dist/query/search/criteria.d.ts.map +1 -1
  142. package/dist/query/search/criteria.js +13 -3
  143. package/dist/query/search/criteria.js.map +1 -1
  144. package/dist/query/search/handler.d.ts +4 -5
  145. package/dist/query/search/handler.d.ts.map +1 -1
  146. package/dist/query/search/handler.js +6 -7
  147. package/dist/query/search/handler.js.map +1 -1
  148. package/dist/query/search/query-store.d.ts.map +1 -1
  149. package/dist/query/search/query-store.js +2 -0
  150. package/dist/query/search/query-store.js.map +1 -1
  151. package/dist/store/interface.d.ts +6 -3
  152. package/dist/store/interface.d.ts.map +1 -1
  153. package/dist/store/interface.js.map +1 -1
  154. package/dist/store/postgres/migrations.d.ts +1 -3
  155. package/dist/store/postgres/migrations.d.ts.map +1 -1
  156. package/dist/store/postgres/migrations.js +1 -35
  157. package/dist/store/postgres/migrations.js.map +1 -1
  158. package/dist/store/postgres/store.d.ts.map +1 -1
  159. package/dist/store/postgres/store.js +9 -4
  160. package/dist/store/postgres/store.js.map +1 -1
  161. package/dist/store/sqlite/migrations.d.ts +1 -3
  162. package/dist/store/sqlite/migrations.d.ts.map +1 -1
  163. package/dist/store/sqlite/migrations.js +1 -36
  164. package/dist/store/sqlite/migrations.js.map +1 -1
  165. package/dist/store/sqlite/store.d.ts.map +1 -1
  166. package/dist/store/sqlite/store.js +8 -4
  167. package/dist/store/sqlite/store.js.map +1 -1
  168. package/package.json +6 -6
  169. package/src/authorization/README.md +26 -24
  170. package/src/authorization/__tests__/authorizer.test.ts +9 -10
  171. package/src/authorization/__tests__/derived-tuples.test.ts +11 -4
  172. package/src/authorization/__tests__/evaluator.test.ts +73 -14
  173. package/src/authorization/__tests__/facts.test.ts +2 -2
  174. package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +185 -0
  175. package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +98 -6
  176. package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +98 -0
  177. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +61 -4
  178. package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +143 -0
  179. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +21 -1
  180. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +25 -1
  181. package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +52 -0
  182. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +3 -1
  183. package/src/authorization/__tests__/list-read-scope.test.ts +17 -18
  184. package/src/authorization/__tests__/store-tests.test.ts +8 -1
  185. package/src/authorization/__tests__/tuples.test.ts +11 -12
  186. package/src/authorization/authorizer.ts +9 -4
  187. package/src/authorization/derived-tuples.ts +31 -14
  188. package/src/authorization/evaluator.ts +44 -8
  189. package/src/authorization/list-read-scope.ts +11 -5
  190. package/src/authorization/model/agent.ts +5 -2
  191. package/src/authorization/model/agent_instance.ts +2 -0
  192. package/src/authorization/model/mcp_server.ts +2 -0
  193. package/src/authorization/model/plugin.ts +4 -1
  194. package/src/authorization/model/rewrite.ts +13 -8
  195. package/src/authorization/model/skill.ts +2 -0
  196. package/src/authorization/model/workflow.ts +2 -0
  197. package/src/authorization/model/workflow_instance.ts +2 -0
  198. package/src/authorization/organization-directory.ts +3 -1
  199. package/src/authorization/store-test-kit.ts +75 -16
  200. package/src/authorization/tuples.ts +39 -16
  201. package/src/domain/agent/__tests__/agent.test.ts +4 -11
  202. package/src/domain/agent/controller.ts +7 -7
  203. package/src/domain/agentchannel/__tests__/agentchannel.test.ts +48 -223
  204. package/src/domain/agentchannel/controller.ts +1 -6
  205. package/src/domain/agentexecution/controller.ts +1 -6
  206. package/src/domain/agentinstance/controller.ts +12 -6
  207. package/src/domain/agentshare/__tests__/agentshare.test.ts +172 -196
  208. package/src/domain/agentshare/__tests__/create-authorization.test.ts +31 -16
  209. package/src/domain/agentshare/constants.ts +26 -14
  210. package/src/domain/agentshare/controller.ts +1 -6
  211. package/src/domain/agentshare/steps.ts +194 -41
  212. package/src/domain/environment/controller.ts +8 -5
  213. package/src/domain/executioncontext/controller.ts +1 -5
  214. package/src/domain/mcpserver/__tests__/mcpserver.test.ts +28 -115
  215. package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +18 -53
  216. package/src/domain/mcpserver/controller.ts +12 -6
  217. package/src/domain/plugin/controller.ts +8 -1
  218. package/src/domain/plugin/push.ts +16 -8
  219. package/src/domain/schedule/controller.ts +1 -6
  220. package/src/domain/session/controller.ts +4 -12
  221. package/src/domain/skill/controller.ts +7 -0
  222. package/src/domain/workflow/controller.ts +10 -28
  223. package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
  224. package/src/domain/workflow/validation/task-config-constraints.ts +3 -7
  225. package/src/domain/workflowexecution/controller.ts +2 -7
  226. package/src/domain/workflowinstance/controller.ts +12 -6
  227. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +19 -32
  228. package/src/extensions/__tests__/extension-composition.test.ts +4 -4
  229. package/src/extensions/__tests__/list-read-scope-composed.test.ts +6 -9
  230. package/src/extensions/authorization-queries.ts +5 -6
  231. package/src/extensions/list-read-scope.ts +1 -1
  232. package/src/extensions/resource-authorization.ts +5 -3
  233. package/src/index.ts +14 -0
  234. package/src/pipeline/apiresource-meta.ts +10 -21
  235. package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +31 -18
  236. package/src/pipeline/steps/__tests__/visibility-gates.test.ts +187 -0
  237. package/src/pipeline/steps/authorization-tuples.ts +11 -9
  238. package/src/pipeline/steps/references.ts +70 -578
  239. package/src/pipeline/steps/visibility-gates.ts +174 -0
  240. package/src/query/search/__tests__/criteria.test.ts +4 -0
  241. package/src/query/search/__tests__/query-store.test.ts +40 -11
  242. package/src/query/search/controller.ts +1 -0
  243. package/src/query/search/criteria.ts +14 -0
  244. package/src/query/search/handler.ts +7 -6
  245. package/src/query/search/query-store.ts +2 -0
  246. package/src/store/__tests__/store-contract.ts +51 -6
  247. package/src/store/interface.ts +6 -3
  248. package/src/store/postgres/__tests__/migrations.test.ts +6 -187
  249. package/src/store/postgres/__tests__/store-contract.test.ts +2 -0
  250. package/src/store/postgres/migrations.ts +1 -48
  251. package/src/store/postgres/store.ts +11 -4
  252. package/src/store/sqlite/__tests__/migrations.test.ts +5 -191
  253. package/src/store/sqlite/migrations.ts +1 -45
  254. package/src/store/sqlite/store.ts +10 -4
  255. package/dist/domain/workflow/agent-call-references.d.ts +0 -54
  256. package/dist/domain/workflow/agent-call-references.d.ts.map +0 -1
  257. package/dist/domain/workflow/agent-call-references.js +0 -97
  258. package/dist/domain/workflow/agent-call-references.js.map +0 -1
  259. package/dist/store/public-visibility-retired.d.ts +0 -67
  260. package/dist/store/public-visibility-retired.d.ts.map +0 -1
  261. package/dist/store/public-visibility-retired.js +0 -55
  262. package/dist/store/public-visibility-retired.js.map +0 -1
  263. package/src/domain/workflow/__tests__/agent-call-references.test.ts +0 -222
  264. package/src/domain/workflow/agent-call-references.ts +0 -157
  265. package/src/pipeline/__tests__/supports-visibility.test.ts +0 -112
  266. package/src/pipeline/steps/__tests__/references.test.ts +0 -703
  267. package/src/store/__tests__/public-visibility-retired.test.ts +0 -127
  268. package/src/store/public-visibility-retired.ts +0 -119
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/blueprint-private-visibility.fga.yaml
2
- # as changed by stigmer-cloud#765 (the OpenFGA store test the cloud runs against its live model).
2
+ # at commit 2ec420161 (the OpenFGA store test the cloud runs against its live model).
3
3
  # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
4
  # file against this evaluator at the re-pin, so a stale copy is caught there.
5
5
  # Store tests for real blueprint privacy (Phase 3 of the visibility model).
@@ -14,6 +14,7 @@
14
14
  # viewers; pre-cloud#257 tuples carried #member, which excluded
15
15
  # viewer-role users — still honored until backfilled, see the
16
16
  # legacy-bot fixture)
17
+ # PUBLIC viewer@identity_account:* (allow_public) + the ORG tuple
17
18
  # PLATFORM platform_viewer@identity_provider:<idp>#platform_user + the ORG tuple
18
19
  #
19
20
  # Read vs spend: an org viewer-role user READS org-visible blueprints (and, at
@@ -22,8 +23,9 @@
22
23
  # can_create_execution_in permissions, which require member-or-guest. The
23
24
  # vera assertions pin both halves of that contract.
24
25
  #
25
- # The ORG tuple rides along on PLATFORM (the "org floor") so a shared
26
- # blueprint stays listable in its own org.
26
+ # The ORG tuple rides along on PUBLIC/PLATFORM (the "org floor") so a shared
27
+ # blueprint stays listable in its own org — org-scoped ListObjects runs with
28
+ # {"allow": false}, which suppresses the public wildcard.
27
29
  #
28
30
  # T08 exception: org ADMINS (and org owners, via the role hierarchy) are
29
31
  # composed into blueprint `owner` and therefore see, list, and manage
@@ -37,8 +39,8 @@
37
39
  # Scenario: org "acme" has owner-creator carol, org admin oscar, plain
38
40
  # member dave, and read-only viewer vera (the role SSO auto-provisioning
39
41
  # grants by default); mallory belongs to an unrelated org. Carol authors one
40
- # blueprint of each kind at PRIVATE, plus an ORG agent and a legacy ORG
41
- # agent whose tuple still carries the pre-cloud#257 shape.
42
+ # blueprint of each kind at PRIVATE, plus an ORG agent, a PUBLIC agent, and
43
+ # a legacy ORG agent whose tuple still carries the pre-cloud#257 shape.
42
44
  name: blueprint-private-visibility
43
45
  model_file: ../model/fga.mod
44
46
 
@@ -112,6 +114,22 @@ tuples:
112
114
  relation: viewer
113
115
  object: agent:legacy-bot
114
116
 
117
+ # --- PUBLIC agent (wildcard + org floor tuple) ---
118
+ - user: organization:acme
119
+ relation: organization
120
+ object: agent:open-bot
121
+ - user: identity_account:carol
122
+ relation: owner
123
+ object: agent:open-bot
124
+ - user: identity_account:*
125
+ relation: viewer
126
+ object: agent:open-bot
127
+ condition:
128
+ name: allow_public
129
+ - user: organization:acme#viewer
130
+ relation: viewer
131
+ object: agent:open-bot
132
+
115
133
  # --- PRIVATE agent with an explicit individual viewer grant ---
116
134
  - user: organization:acme
117
135
  relation: organization
@@ -128,6 +146,8 @@ tests:
128
146
  check:
129
147
  - user: identity_account:dave
130
148
  object: agent:secret-bot
149
+ context:
150
+ allow: false
131
151
  assertions:
132
152
  can_view: false
133
153
  can_execute: false
@@ -135,16 +155,22 @@ tests:
135
155
  can_clone: false
136
156
  - user: identity_account:dave
137
157
  object: skill:secret-notes
158
+ context:
159
+ allow: false
138
160
  assertions:
139
161
  can_view: false
140
162
  can_use: false
141
163
  - user: identity_account:dave
142
164
  object: workflow:secret-flow
165
+ context:
166
+ allow: false
143
167
  assertions:
144
168
  can_view: false
145
169
  can_execute: false
146
170
  - user: identity_account:dave
147
171
  object: mcp_server:secret-tools
172
+ context:
173
+ allow: false
148
174
  assertions:
149
175
  can_view: false
150
176
  can_use: false
@@ -154,6 +180,8 @@ tests:
154
180
  check:
155
181
  - user: identity_account:oscar
156
182
  object: agent:secret-bot
183
+ context:
184
+ allow: false
157
185
  assertions:
158
186
  can_view: true
159
187
  can_edit: true
@@ -161,11 +189,15 @@ tests:
161
189
  can_execute: true
162
190
  - user: identity_account:oscar
163
191
  object: skill:secret-notes
192
+ context:
193
+ allow: false
164
194
  assertions:
165
195
  can_view: true
166
196
  can_edit: true
167
197
  - user: identity_account:oscar
168
198
  object: workflow:secret-flow
199
+ context:
200
+ allow: false
169
201
  assertions:
170
202
  can_view: true
171
203
  can_edit: true
@@ -173,6 +205,8 @@ tests:
173
205
  # four private-blueprint kinds are pinned to the same rule.
174
206
  - user: identity_account:oscar
175
207
  object: mcp_server:secret-tools
208
+ context:
209
+ allow: false
176
210
  assertions:
177
211
  can_view: true
178
212
  can_edit: true
@@ -181,17 +215,22 @@ tests:
181
215
  list_objects:
182
216
  - user: identity_account:oscar
183
217
  type: agent
218
+ context:
219
+ allow: false
184
220
  assertions:
185
221
  can_view:
186
222
  - agent:secret-bot
187
223
  - agent:team-bot
188
224
  - agent:legacy-bot
225
+ - agent:open-bot
189
226
  - agent:shared-secret
190
227
 
191
228
  - name: owner retains full access to private blueprints
192
229
  check:
193
230
  - user: identity_account:carol
194
231
  object: agent:secret-bot
232
+ context:
233
+ allow: false
195
234
  assertions:
196
235
  can_view: true
197
236
  can_execute: true
@@ -200,6 +239,8 @@ tests:
200
239
  can_delete: true
201
240
  - user: identity_account:carol
202
241
  object: workflow:secret-flow
242
+ context:
243
+ allow: false
203
244
  assertions:
204
245
  can_view: true
205
246
  can_execute: true
@@ -209,6 +250,8 @@ tests:
209
250
  check:
210
251
  - user: identity_account:dave
211
252
  object: agent:team-bot
253
+ context:
254
+ allow: false
212
255
  assertions:
213
256
  can_view: true
214
257
  can_execute: true
@@ -217,10 +260,33 @@ tests:
217
260
  can_delete: false
218
261
  - user: identity_account:mallory
219
262
  object: agent:team-bot
263
+ context:
264
+ allow: false
220
265
  assertions:
221
266
  can_view: false
222
267
  can_execute: false
223
268
 
269
+ - name: public agent is reachable by everyone with allow context, and by org members without it
270
+ check:
271
+ # Outsider resolves through the conditional wildcard ({"allow": true}).
272
+ - user: identity_account:mallory
273
+ object: agent:open-bot
274
+ context:
275
+ allow: true
276
+ assertions:
277
+ can_view: true
278
+ can_execute: true
279
+ # Org member resolves through the org floor tuple even with the
280
+ # wildcard suppressed — this is what keeps public blueprints in
281
+ # org-scoped listings.
282
+ - user: identity_account:dave
283
+ object: agent:open-bot
284
+ context:
285
+ allow: false
286
+ assertions:
287
+ can_view: true
288
+ can_execute: true
289
+
224
290
  - name: explicit individual viewer grant on a private agent conveys view and run
225
291
  check:
226
292
  # Run-what-you-can-read: can_execute derives from viewer, so an
@@ -228,30 +294,38 @@ tests:
228
294
  # which checks can_view).
229
295
  - user: identity_account:dave
230
296
  object: agent:shared-secret
297
+ context:
298
+ allow: false
231
299
  assertions:
232
300
  can_view: true
233
301
  can_execute: true
234
302
  can_edit: false
235
303
 
236
- - name: org member's listable agents exclude private ones
304
+ - name: org member's listable agents exclude private ones (wildcard suppressed)
237
305
  list_objects:
238
306
  - user: identity_account:dave
239
307
  type: agent
308
+ context:
309
+ allow: false
240
310
  assertions:
241
311
  can_view:
242
312
  - agent:team-bot
243
313
  - agent:legacy-bot
314
+ - agent:open-bot
244
315
  - agent:shared-secret
245
316
 
246
317
  - name: owner's listable agents include everything they authored
247
318
  list_objects:
248
319
  - user: identity_account:carol
249
320
  type: agent
321
+ context:
322
+ allow: false
250
323
  assertions:
251
324
  can_view:
252
325
  - agent:secret-bot
253
326
  - agent:team-bot
254
327
  - agent:legacy-bot
328
+ - agent:open-bot
255
329
  - agent:shared-secret
256
330
 
257
331
  # ── cloud#257: the viewer-role cell (previously untested) ──────────────
@@ -262,16 +336,27 @@ tests:
262
336
  # spend refusal is pinned separately on the org permissions below.
263
337
  - user: identity_account:vera
264
338
  object: agent:team-bot
339
+ context:
340
+ allow: false
265
341
  assertions:
266
342
  can_view: true
267
343
  can_clone: true
268
344
  can_execute: true
269
345
  can_edit: false
270
346
  can_delete: false
347
+ # The org floor of a PUBLIC blueprint reaches viewers the same way.
348
+ - user: identity_account:vera
349
+ object: agent:open-bot
350
+ context:
351
+ allow: false
352
+ assertions:
353
+ can_view: true
271
354
  # Private stays private — the viewer role grants nothing beyond the
272
355
  # explicit visibility tuples.
273
356
  - user: identity_account:vera
274
357
  object: agent:secret-bot
358
+ context:
359
+ allow: false
275
360
  assertions:
276
361
  can_view: false
277
362
  can_execute: false
@@ -297,6 +382,8 @@ tests:
297
382
  check:
298
383
  - user: identity_account:dave
299
384
  object: agent:legacy-bot
385
+ context:
386
+ allow: false
300
387
  assertions:
301
388
  can_view: true
302
389
  can_execute: true
@@ -305,6 +392,8 @@ tests:
305
392
  # organization#member. The boot backfill converges these tuples.
306
393
  - user: identity_account:vera
307
394
  object: agent:legacy-bot
395
+ context:
396
+ allow: false
308
397
  assertions:
309
398
  can_view: false
310
399
  can_execute: false
@@ -313,6 +402,9 @@ tests:
313
402
  list_objects:
314
403
  - user: identity_account:vera
315
404
  type: agent
405
+ context:
406
+ allow: false
316
407
  assertions:
317
408
  can_view:
318
409
  - agent:team-bot
410
+ - agent:open-bot
@@ -0,0 +1,98 @@
1
+ # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/cross-org-share-creation.fga.yaml
2
+ # at commit 2ec420161 (the OpenFGA store test the cloud runs against its live model).
3
+ # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
+ # file against this evaluator at the re-pin, so a stale copy is caught there.
5
+ # Cross-org share creation, the FGA half of the decision 013 D2 consent
6
+ # bar. Creating a share of ANOTHER org's marketplace-public agent requires:
7
+ #
8
+ # 1. can_execute on the agent — granted to every authenticated account by
9
+ # the allow_public wildcard when the agent is public (checked here),
10
+ # and to nobody cross-org when it is not.
11
+ # 2. can_create_agent_share on the SHARE's own org — admin-level: a
12
+ # public share spends the org's credits on the open internet. The
13
+ # per-kind can_create_* pattern, one more row.
14
+ #
15
+ # The same-org bar (agent can_edit) is untouched and pinned by
16
+ # agent-share-owner.fga.yaml; the app-level halves of the contract
17
+ # (visibility check, audience rule, dependency sweep, agent-id pin) are
18
+ # handler logic outside FGA, pinned by the Java and Go unit tests.
19
+
20
+ name: cross-org-share-creation
21
+ model_file: ../model/fga.mod
22
+
23
+ tuples:
24
+ # provider-org publishes a marketplace-public agent (the conditional
25
+ # wildcard viewer tuple visibility_public writes).
26
+ - user: organization:provider-org
27
+ relation: organization
28
+ object: agent:public-helper
29
+ - user: identity_account:paula
30
+ relation: owner
31
+ object: agent:public-helper
32
+ - user: identity_account:*
33
+ relation: viewer
34
+ object: agent:public-helper
35
+ condition:
36
+ name: allow_public
37
+ context: {}
38
+
39
+ # A private agent in the same provider org — the wildcard is absent.
40
+ - user: organization:provider-org
41
+ relation: organization
42
+ object: agent:private-helper
43
+ - user: identity_account:paula
44
+ relation: owner
45
+ object: agent:private-helper
46
+
47
+ # consumer-org: an admin and a plain member.
48
+ - user: identity_account:adam
49
+ relation: admin
50
+ object: organization:consumer-org
51
+ - user: identity_account:mia
52
+ relation: member
53
+ object: organization:consumer-org
54
+
55
+ tests:
56
+ - name: consumer-org admin holds both halves of the cross-org bar
57
+ check:
58
+ - user: identity_account:adam
59
+ object: agent:public-helper
60
+ context:
61
+ allow: true
62
+ assertions:
63
+ can_execute: true
64
+ can_edit: false
65
+ - user: identity_account:adam
66
+ object: organization:consumer-org
67
+ assertions:
68
+ can_create_agent_share: true
69
+
70
+ - name: plain member lacks the org-side bar (spending is admin-level)
71
+ check:
72
+ - user: identity_account:mia
73
+ object: agent:public-helper
74
+ context:
75
+ allow: true
76
+ assertions:
77
+ can_execute: true
78
+ - user: identity_account:mia
79
+ object: organization:consumer-org
80
+ assertions:
81
+ can_create_agent_share: false
82
+
83
+ - name: nobody cross-org can execute a private agent
84
+ check:
85
+ - user: identity_account:adam
86
+ object: agent:private-helper
87
+ context:
88
+ allow: true
89
+ assertions:
90
+ can_execute: false
91
+ can_view: false
92
+
93
+ - name: the org-side bar does not leak across orgs
94
+ check:
95
+ - user: identity_account:paula
96
+ object: organization:consumer-org
97
+ assertions:
98
+ can_create_agent_share: false
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/default-instance-inheritance.fga.yaml
2
- # as changed by stigmer-cloud#765 (the OpenFGA store test the cloud runs against its live model).
2
+ # at commit b87dd1170 (the OpenFGA store test the cloud runs against its live model).
3
3
  # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
4
  # file against this evaluator at the re-pin, so a stale copy is caught there.
5
5
  # Store tests for default-instance structural inheritance (default_of).
@@ -7,8 +7,8 @@
7
7
  # A blueprint's system-managed default instance carries a single
8
8
  # instance#default_of@<blueprint>:<id>
9
9
  # tuple and inherits the blueprint's ENTIRE viewer set through
10
- # `viewer from default_of` — org members and platform users
11
- # (identity_provider#platform_user). No enum-derived
10
+ # `viewer from default_of` — org members, public users (allow_public), and
11
+ # platform users (identity_provider#platform_user). No enum-derived
12
12
  # visibility tuples are ever written on default instances, so their access
13
13
  # can never drift from the template's.
14
14
  #
@@ -20,7 +20,8 @@
20
20
  # visibility level; each has a default instance linked via default_of.
21
21
  # Alice (acme member) reaches default instances of platform-shared
22
22
  # blueprints; planton members reach default instances of org-visible ones;
23
- # personal instances never leak.
23
+ # everyone reaches default instances of public ones; personal instances
24
+ # never leak.
24
25
  name: default-instance-inheritance
25
26
  model_file: ../model/fga.mod
26
27
 
@@ -114,6 +115,35 @@ tuples:
114
115
  relation: default_of
115
116
  object: agent_instance:internal-default
116
117
 
118
+ # --- Public agent + its default instance ---
119
+ # PUBLIC carries the org floor tuple too (viewer@org#viewer).
120
+ - user: organization:planton
121
+ relation: organization
122
+ object: agent:public-bot
123
+ - user: identity_account:swarup
124
+ relation: owner
125
+ object: agent:public-bot
126
+ - user: identity_account:*
127
+ relation: viewer
128
+ object: agent:public-bot
129
+ condition:
130
+ name: allow_public
131
+ - user: organization:planton#viewer
132
+ relation: viewer
133
+ object: agent:public-bot
134
+ - user: organization:planton
135
+ relation: organization
136
+ object: agent_instance:public-bot-default
137
+ - user: agent:public-bot
138
+ relation: agent
139
+ object: agent_instance:public-bot-default
140
+ - user: identity_account:swarup
141
+ relation: owner
142
+ object: agent_instance:public-bot-default
143
+ - user: agent:public-bot
144
+ relation: default_of
145
+ object: agent_instance:public-bot-default
146
+
117
147
  # --- Platform-shared workflow + its default instance ---
118
148
  - user: organization:planton
119
149
  relation: organization
@@ -145,6 +175,8 @@ tests:
145
175
  check:
146
176
  - user: identity_account:alice
147
177
  object: agent_instance:sara-default
178
+ context:
179
+ allow: false
148
180
  assertions:
149
181
  can_view: true
150
182
  can_execute: true
@@ -155,6 +187,8 @@ tests:
155
187
  check:
156
188
  - user: identity_account:mallory
157
189
  object: agent_instance:sara-default
190
+ context:
191
+ allow: false
158
192
  assertions:
159
193
  can_view: false
160
194
  can_execute: false
@@ -165,10 +199,14 @@ tests:
165
199
  # default_of tuple — only she (its owner) can reach it.
166
200
  - user: identity_account:swarup
167
201
  object: agent_instance:alice-personal
202
+ context:
203
+ allow: false
168
204
  assertions:
169
205
  can_view: false
170
206
  - user: identity_account:alice
171
207
  object: agent_instance:alice-personal
208
+ context:
209
+ allow: false
172
210
  assertions:
173
211
  can_view: true
174
212
  can_edit: true
@@ -177,6 +215,8 @@ tests:
177
215
  check:
178
216
  - user: identity_account:priya
179
217
  object: agent_instance:internal-default
218
+ context:
219
+ allow: false
180
220
  assertions:
181
221
  can_view: true
182
222
  can_execute: true
@@ -186,19 +226,34 @@ tests:
186
226
  # read audience, and the default instance inherits it structurally.
187
227
  - user: identity_account:veda
188
228
  object: agent_instance:internal-default
229
+ context:
230
+ allow: false
189
231
  assertions:
190
232
  can_view: true
191
233
  can_edit: false
192
234
  # Managed-org membership grants nothing on non-platform-shared agents.
193
235
  - user: identity_account:alice
194
236
  object: agent_instance:internal-default
237
+ context:
238
+ allow: false
195
239
  assertions:
196
240
  can_view: false
197
241
 
242
+ - name: everyone reaches the default instance of a public agent
243
+ check:
244
+ - user: identity_account:mallory
245
+ object: agent_instance:public-bot-default
246
+ context:
247
+ allow: true
248
+ assertions:
249
+ can_view: true
250
+
198
251
  - name: managed-org member reaches the default instance of a platform-shared workflow
199
252
  check:
200
253
  - user: identity_account:alice
201
254
  object: workflow_instance:onboarding-default
255
+ context:
256
+ allow: false
202
257
  assertions:
203
258
  can_view: true
204
259
  can_execute: true
@@ -208,6 +263,8 @@ tests:
208
263
  list_objects:
209
264
  - user: identity_account:alice
210
265
  type: agent_instance
266
+ context:
267
+ allow: false
211
268
  assertions:
212
269
  can_view:
213
270
  - agent_instance:sara-default
@@ -0,0 +1,143 @@
1
+ # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/mcp-server-authoring.fga.yaml
2
+ # at commit 4c03c38d2 (the OpenFGA store test the cloud runs against its live model).
3
+ # The body below is byte-identical to the source; the cloud re-runs the LIVE
4
+ # file against this evaluator at the re-pin, so a stale copy is caught there.
5
+ # Store tests for MCP-server authoring: an MCP server is an organization's
6
+ # blueprint, so creating one takes the organization's admin bar
7
+ # (can_create_mcp_server: admin), the bar agents, workflows and skills
8
+ # already take. Until stigmer#1209 (v3.22.0) the create ran no check in
9
+ # either edition and any member could author one; these pin the bar and
10
+ # the story it leaves for members: an admin authors the server org-visible
11
+ # and a member connects it (can_connect) with their own credentials, while
12
+ # a private server stays the owner's and the admins'.
13
+ #
14
+ # Run: fga model test --tests mcp-server-authoring.fga.yaml
15
+
16
+ name: mcp-server-authoring
17
+ model_file: ../model/fga.mod
18
+
19
+ tuples:
20
+ # Org acme: olivia owns it, oscar administers, dave is a plain member,
21
+ # vera a read-only viewer; mallory belongs to an unrelated org.
22
+ - user: identity_account:olivia
23
+ relation: owner
24
+ object: organization:acme
25
+ - user: identity_account:oscar
26
+ relation: admin
27
+ object: organization:acme
28
+ - user: identity_account:dave
29
+ relation: member
30
+ object: organization:acme
31
+ - user: identity_account:vera
32
+ relation: viewer
33
+ object: organization:acme
34
+ - user: identity_account:mallory
35
+ relation: member
36
+ object: organization:other
37
+
38
+ # An ORG-visible server oscar authored (the org viewer tuple the
39
+ # visibility writer emits).
40
+ - user: organization:acme
41
+ relation: organization
42
+ object: mcp_server:github
43
+ - user: identity_account:oscar
44
+ relation: owner
45
+ object: mcp_server:github
46
+ - user: organization:acme#viewer
47
+ relation: viewer
48
+ object: mcp_server:github
49
+
50
+ # A PRIVATE server oscar authored (no visibility tuple).
51
+ - user: organization:acme
52
+ relation: organization
53
+ object: mcp_server:vault
54
+ - user: identity_account:oscar
55
+ relation: owner
56
+ object: mcp_server:vault
57
+
58
+ tests:
59
+ - name: authoring an MCP server is an admin act, the blueprint bar
60
+ check:
61
+ - user: identity_account:olivia
62
+ object: organization:acme
63
+ assertions:
64
+ can_create_mcp_server: true
65
+ can_create_agent: true
66
+ - user: identity_account:oscar
67
+ object: organization:acme
68
+ assertions:
69
+ can_create_mcp_server: true
70
+ can_create_agent: true
71
+
72
+ - name: a member, a viewer and an outsider cannot author one
73
+ check:
74
+ - user: identity_account:dave
75
+ object: organization:acme
76
+ assertions:
77
+ can_create_mcp_server: false
78
+ - user: identity_account:vera
79
+ object: organization:acme
80
+ assertions:
81
+ can_create_mcp_server: false
82
+ - user: identity_account:mallory
83
+ object: organization:acme
84
+ assertions:
85
+ can_create_mcp_server: false
86
+
87
+ - name: a member connects an admin-authored org-visible server with their own credentials
88
+ check:
89
+ - user: identity_account:dave
90
+ object: mcp_server:github
91
+ context:
92
+ allow: false
93
+ assertions:
94
+ can_view: true
95
+ can_connect: true
96
+ can_edit: false
97
+ - user: identity_account:vera
98
+ object: mcp_server:github
99
+ context:
100
+ allow: false
101
+ assertions:
102
+ can_view: true
103
+ can_connect: true
104
+ can_edit: false
105
+ - user: identity_account:mallory
106
+ object: mcp_server:github
107
+ context:
108
+ allow: false
109
+ assertions:
110
+ can_view: false
111
+ can_connect: false
112
+
113
+ - name: a private server stays with its author and the org admins
114
+ check:
115
+ - user: identity_account:oscar
116
+ object: mcp_server:vault
117
+ context:
118
+ allow: false
119
+ assertions:
120
+ can_view: true
121
+ can_connect: true
122
+ can_edit: true
123
+ - user: identity_account:olivia
124
+ object: mcp_server:vault
125
+ context:
126
+ allow: false
127
+ assertions:
128
+ can_view: true
129
+ can_edit: true
130
+ - user: identity_account:dave
131
+ object: mcp_server:vault
132
+ context:
133
+ allow: false
134
+ assertions:
135
+ can_view: false
136
+ can_connect: false
137
+ - user: identity_account:vera
138
+ object: mcp_server:vault
139
+ context:
140
+ allow: false
141
+ assertions:
142
+ can_view: false
143
+ can_connect: false