@stigmer/server 3.23.0 → 3.23.1-dev.20260923075205

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 (267) hide show
  1. package/dist/authorization/authorizer.d.ts +4 -8
  2. package/dist/authorization/authorizer.d.ts.map +1 -1
  3. package/dist/authorization/authorizer.js +5 -9
  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 +10 -25
  7. package/dist/authorization/derived-tuples.js.map +1 -1
  8. package/dist/authorization/evaluator.d.ts +7 -8
  9. package/dist/authorization/evaluator.d.ts.map +1 -1
  10. package/dist/authorization/evaluator.js +4 -20
  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 +5 -9
  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 +4 -5
  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 +3 -4
  26. package/dist/authorization/model/plugin.js.map +1 -1
  27. package/dist/authorization/model/rewrite.d.ts +8 -10
  28. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  29. package/dist/authorization/model/rewrite.js +0 -3
  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 +2 -3
  42. package/dist/authorization/organization-directory.js.map +1 -1
  43. package/dist/authorization/store-test-kit.d.ts +0 -6
  44. package/dist/authorization/store-test-kit.d.ts.map +1 -1
  45. package/dist/authorization/store-test-kit.js +16 -62
  46. package/dist/authorization/store-test-kit.js.map +1 -1
  47. package/dist/authorization/tuples.d.ts +13 -32
  48. package/dist/authorization/tuples.d.ts.map +1 -1
  49. package/dist/authorization/tuples.js +3 -11
  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 +3 -1
  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 +3 -1
  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 +3 -4
  62. package/dist/domain/agentinstance/controller.js.map +1 -1
  63. package/dist/domain/agentshare/constants.d.ts +6 -11
  64. package/dist/domain/agentshare/constants.d.ts.map +1 -1
  65. package/dist/domain/agentshare/constants.js +8 -16
  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 +3 -1
  69. package/dist/domain/agentshare/controller.js.map +1 -1
  70. package/dist/domain/agentshare/steps.d.ts +18 -25
  71. package/dist/domain/agentshare/steps.d.ts.map +1 -1
  72. package/dist/domain/agentshare/steps.js +41 -142
  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 +2 -3
  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 +2 -1
  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 +3 -4
  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 +1 -3
  85. package/dist/domain/plugin/controller.js.map +1 -1
  86. package/dist/domain/plugin/push.d.ts +7 -5
  87. package/dist/domain/plugin/push.d.ts.map +1 -1
  88. package/dist/domain/plugin/push.js +8 -14
  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 +3 -1
  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 +3 -2
  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 +0 -2
  98. package/dist/domain/skill/controller.js.map +1 -1
  99. package/dist/domain/workflow/agent-call-references.d.ts +54 -0
  100. package/dist/domain/workflow/agent-call-references.d.ts.map +1 -0
  101. package/dist/domain/workflow/agent-call-references.js +97 -0
  102. package/dist/domain/workflow/agent-call-references.js.map +1 -0
  103. package/dist/domain/workflow/controller.d.ts.map +1 -1
  104. package/dist/domain/workflow/controller.js +14 -6
  105. package/dist/domain/workflow/controller.js.map +1 -1
  106. package/dist/domain/workflow/registry/data/task-kind-registry.json +1 -1
  107. package/dist/domain/workflow/validation/task-config-constraints.d.ts +10 -1
  108. package/dist/domain/workflow/validation/task-config-constraints.d.ts.map +1 -1
  109. package/dist/domain/workflow/validation/task-config-constraints.js +3 -2
  110. package/dist/domain/workflow/validation/task-config-constraints.js.map +1 -1
  111. package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
  112. package/dist/domain/workflowexecution/controller.js +4 -2
  113. package/dist/domain/workflowexecution/controller.js.map +1 -1
  114. package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
  115. package/dist/domain/workflowinstance/controller.js +3 -4
  116. package/dist/domain/workflowinstance/controller.js.map +1 -1
  117. package/dist/extensions/authorization-queries.d.ts +6 -5
  118. package/dist/extensions/authorization-queries.d.ts.map +1 -1
  119. package/dist/extensions/list-read-scope.d.ts +1 -1
  120. package/dist/extensions/resource-authorization.d.ts +3 -2
  121. package/dist/extensions/resource-authorization.d.ts.map +1 -1
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/pipeline/apiresource-meta.d.ts +12 -3
  126. package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
  127. package/dist/pipeline/apiresource-meta.js +21 -10
  128. package/dist/pipeline/apiresource-meta.js.map +1 -1
  129. package/dist/pipeline/steps/authorization-tuples.d.ts +9 -3
  130. package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
  131. package/dist/pipeline/steps/authorization-tuples.js +9 -11
  132. package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
  133. package/dist/pipeline/steps/references.d.ts +178 -20
  134. package/dist/pipeline/steps/references.d.ts.map +1 -1
  135. package/dist/pipeline/steps/references.js +344 -43
  136. package/dist/pipeline/steps/references.js.map +1 -1
  137. package/dist/query/search/controller.js +0 -1
  138. package/dist/query/search/controller.js.map +1 -1
  139. package/dist/query/search/criteria.d.ts +1 -5
  140. package/dist/query/search/criteria.d.ts.map +1 -1
  141. package/dist/query/search/criteria.js +3 -13
  142. package/dist/query/search/criteria.js.map +1 -1
  143. package/dist/query/search/handler.d.ts +5 -4
  144. package/dist/query/search/handler.d.ts.map +1 -1
  145. package/dist/query/search/handler.js +7 -6
  146. package/dist/query/search/handler.js.map +1 -1
  147. package/dist/query/search/query-store.d.ts.map +1 -1
  148. package/dist/query/search/query-store.js +0 -2
  149. package/dist/query/search/query-store.js.map +1 -1
  150. package/dist/store/interface.d.ts +3 -6
  151. package/dist/store/interface.d.ts.map +1 -1
  152. package/dist/store/interface.js.map +1 -1
  153. package/dist/store/postgres/migrations.d.ts +3 -1
  154. package/dist/store/postgres/migrations.d.ts.map +1 -1
  155. package/dist/store/postgres/migrations.js +35 -1
  156. package/dist/store/postgres/migrations.js.map +1 -1
  157. package/dist/store/postgres/store.d.ts.map +1 -1
  158. package/dist/store/postgres/store.js +4 -9
  159. package/dist/store/postgres/store.js.map +1 -1
  160. package/dist/store/public-visibility-retired.d.ts +67 -0
  161. package/dist/store/public-visibility-retired.d.ts.map +1 -0
  162. package/dist/store/public-visibility-retired.js +55 -0
  163. package/dist/store/public-visibility-retired.js.map +1 -0
  164. package/dist/store/sqlite/migrations.d.ts +3 -1
  165. package/dist/store/sqlite/migrations.d.ts.map +1 -1
  166. package/dist/store/sqlite/migrations.js +36 -1
  167. package/dist/store/sqlite/migrations.js.map +1 -1
  168. package/dist/store/sqlite/store.d.ts.map +1 -1
  169. package/dist/store/sqlite/store.js +4 -8
  170. package/dist/store/sqlite/store.js.map +1 -1
  171. package/package.json +6 -6
  172. package/src/authorization/README.md +24 -26
  173. package/src/authorization/__tests__/authorizer.test.ts +10 -9
  174. package/src/authorization/__tests__/derived-tuples.test.ts +4 -11
  175. package/src/authorization/__tests__/evaluator.test.ts +14 -73
  176. package/src/authorization/__tests__/facts.test.ts +2 -2
  177. package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +19 -27
  178. package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +6 -98
  179. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +4 -61
  180. package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +1 -15
  181. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +1 -21
  182. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +1 -25
  183. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +1 -3
  184. package/src/authorization/__tests__/list-read-scope.test.ts +18 -17
  185. package/src/authorization/__tests__/store-tests.test.ts +2 -6
  186. package/src/authorization/__tests__/tuples.test.ts +12 -11
  187. package/src/authorization/authorizer.ts +4 -9
  188. package/src/authorization/derived-tuples.ts +14 -31
  189. package/src/authorization/evaluator.ts +8 -44
  190. package/src/authorization/list-read-scope.ts +5 -11
  191. package/src/authorization/model/agent.ts +2 -5
  192. package/src/authorization/model/agent_instance.ts +0 -2
  193. package/src/authorization/model/mcp_server.ts +0 -2
  194. package/src/authorization/model/plugin.ts +1 -4
  195. package/src/authorization/model/rewrite.ts +8 -13
  196. package/src/authorization/model/skill.ts +0 -2
  197. package/src/authorization/model/workflow.ts +0 -2
  198. package/src/authorization/model/workflow_instance.ts +0 -2
  199. package/src/authorization/organization-directory.ts +1 -3
  200. package/src/authorization/store-test-kit.ts +16 -75
  201. package/src/authorization/tuples.ts +16 -39
  202. package/src/domain/agent/__tests__/agent.test.ts +11 -4
  203. package/src/domain/agent/controller.ts +7 -7
  204. package/src/domain/agentchannel/__tests__/agentchannel.test.ts +223 -48
  205. package/src/domain/agentchannel/controller.ts +6 -1
  206. package/src/domain/agentexecution/controller.ts +6 -1
  207. package/src/domain/agentinstance/controller.ts +6 -12
  208. package/src/domain/agentshare/__tests__/agentshare.test.ts +196 -172
  209. package/src/domain/agentshare/__tests__/create-authorization.test.ts +16 -31
  210. package/src/domain/agentshare/constants.ts +14 -26
  211. package/src/domain/agentshare/controller.ts +6 -1
  212. package/src/domain/agentshare/steps.ts +41 -194
  213. package/src/domain/environment/controller.ts +5 -8
  214. package/src/domain/executioncontext/controller.ts +5 -1
  215. package/src/domain/mcpserver/__tests__/mcpserver.test.ts +115 -28
  216. package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +53 -18
  217. package/src/domain/mcpserver/controller.ts +6 -12
  218. package/src/domain/plugin/controller.ts +1 -8
  219. package/src/domain/plugin/push.ts +8 -16
  220. package/src/domain/schedule/controller.ts +6 -1
  221. package/src/domain/session/controller.ts +12 -4
  222. package/src/domain/skill/controller.ts +0 -7
  223. package/src/domain/workflow/__tests__/agent-call-references.test.ts +222 -0
  224. package/src/domain/workflow/agent-call-references.ts +157 -0
  225. package/src/domain/workflow/controller.ts +28 -10
  226. package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
  227. package/src/domain/workflow/validation/task-config-constraints.ts +7 -3
  228. package/src/domain/workflowexecution/controller.ts +7 -2
  229. package/src/domain/workflowinstance/controller.ts +6 -12
  230. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +32 -19
  231. package/src/extensions/__tests__/extension-composition.test.ts +4 -4
  232. package/src/extensions/__tests__/list-read-scope-composed.test.ts +9 -6
  233. package/src/extensions/authorization-queries.ts +6 -5
  234. package/src/extensions/list-read-scope.ts +1 -1
  235. package/src/extensions/resource-authorization.ts +3 -5
  236. package/src/index.ts +0 -1
  237. package/src/pipeline/__tests__/supports-visibility.test.ts +112 -0
  238. package/src/pipeline/apiresource-meta.ts +21 -10
  239. package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +18 -31
  240. package/src/pipeline/steps/__tests__/references.test.ts +703 -0
  241. package/src/pipeline/steps/authorization-tuples.ts +9 -11
  242. package/src/pipeline/steps/references.ts +578 -70
  243. package/src/query/search/__tests__/criteria.test.ts +0 -4
  244. package/src/query/search/__tests__/query-store.test.ts +11 -40
  245. package/src/query/search/controller.ts +0 -1
  246. package/src/query/search/criteria.ts +0 -14
  247. package/src/query/search/handler.ts +6 -7
  248. package/src/query/search/query-store.ts +0 -2
  249. package/src/store/__tests__/public-visibility-retired.test.ts +127 -0
  250. package/src/store/__tests__/store-contract.ts +6 -51
  251. package/src/store/interface.ts +3 -6
  252. package/src/store/postgres/__tests__/migrations.test.ts +187 -6
  253. package/src/store/postgres/__tests__/store-contract.test.ts +0 -2
  254. package/src/store/postgres/migrations.ts +48 -1
  255. package/src/store/postgres/store.ts +4 -11
  256. package/src/store/public-visibility-retired.ts +119 -0
  257. package/src/store/sqlite/__tests__/migrations.test.ts +191 -5
  258. package/src/store/sqlite/migrations.ts +45 -1
  259. package/src/store/sqlite/store.ts +4 -10
  260. package/dist/pipeline/steps/visibility-gates.d.ts +0 -27
  261. package/dist/pipeline/steps/visibility-gates.d.ts.map +0 -1
  262. package/dist/pipeline/steps/visibility-gates.js +0 -139
  263. package/dist/pipeline/steps/visibility-gates.js.map +0 -1
  264. package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +0 -98
  265. package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +0 -52
  266. package/src/pipeline/steps/__tests__/visibility-gates.test.ts +0 -187
  267. package/src/pipeline/steps/visibility-gates.ts +0 -174
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Pins the evaluator's semantics the store tests cannot express (the
3
3
  * cloud's `.fga.yaml` documents prove the model's answers; this file
4
- * proves the machinery under them): how a person matches a tuple, what
5
- * the `allow_public` context does, that a direct tuple outside the line's
6
- * type restriction is ignored (model drift fails closed), how far a
7
- * resolution may walk, and that a declaration cycle or an undeclared
8
- * target is a thrown fault and never a silent deny.
4
+ * proves the machinery under them): how a person matches a tuple, that a
5
+ * direct tuple outside the line's type restriction is ignored (model drift
6
+ * fails closed), how far a resolution may walk, and that a declaration
7
+ * cycle or an undeclared target is a thrown fault and never a silent deny.
9
8
  *
10
9
  * The fixture source is the in-memory one the store-test kit uses, so the
11
10
  * two proofs share one tuple vocabulary. Where a case needs a shape the
@@ -30,7 +29,6 @@ import {
30
29
  direct,
31
30
  from,
32
31
  objectOf,
33
- publicWith,
34
32
  union,
35
33
  usersetOf,
36
34
  } from "../model/rewrite.js";
@@ -56,22 +54,17 @@ function person(accountId: string, ...aliases: string[]): Person {
56
54
  return { accountId, aliases: new Set([accountId, ...aliases]) };
57
55
  }
58
56
 
59
- const RESOLVE = { allow: true };
60
- const LIST = { allow: false };
61
-
62
57
  async function allowed(
63
58
  source: TupleSource,
64
59
  object: string,
65
60
  relation: string,
66
61
  who: Person,
67
- context = RESOLVE,
68
62
  ): Promise<boolean> {
69
63
  return checkRelation(
70
64
  { model: builtInModel, source },
71
65
  parseObjectRef(object),
72
66
  relation,
73
67
  who,
74
- context,
75
68
  );
76
69
  }
77
70
 
@@ -100,67 +93,17 @@ describe("a person against a direct tuple", () => {
100
93
  });
101
94
  });
102
95
 
103
- describe("the public wildcard and its condition", () => {
104
- const publicViewer = (object: string): Tuple => ({
105
- object: parseObjectRef(object),
106
- relation: "viewer",
107
- subject: {
108
- form: "wildcard",
109
- type: "identity_account",
110
- condition: "allow_public",
111
- },
112
- });
113
- const source = newInMemoryTupleSource([
114
- tuple("agent:open#organization@organization:acme"),
115
- publicViewer("agent:open"),
116
- ]);
117
- const stranger = person("ida_mallory");
118
-
119
- it("reads for anyone on a point check (the cloud's `allow: true`) and for nobody in a listing (`allow: false`)", async () => {
96
+ describe("a stranger against a row with no grant that names them", () => {
97
+ it("reads nothing: no subject form reaches every account, so a stranger holds no relation on a row they were not granted", async () => {
98
+ const source = newInMemoryTupleSource([
99
+ tuple("agent:open#organization@organization:acme"),
100
+ tuple("agent:open#owner@identity_account:ida_carol"),
101
+ tuple("agent:open#viewer@organization:acme#viewer"),
102
+ ]);
103
+ const stranger = person("ida_mallory");
120
104
  expect(await allowed(source, "agent:open", "can_view", stranger)).toBe(
121
- true,
105
+ false,
122
106
  );
123
- expect(
124
- await allowed(source, "agent:open", "can_view", stranger, LIST),
125
- ).toBe(false);
126
- });
127
-
128
- it("ignores a wildcard tuple that carries no condition where the line demands one — a tuple the cloud could never have written", async () => {
129
- const bare = newInMemoryTupleSource([
130
- tuple("agent:open#viewer@identity_account:*"),
131
- ]);
132
- expect(await allowed(bare, "agent:open", "can_view", stranger)).toBe(false);
133
- });
134
-
135
- it("is a thrown fault under a condition the transcript names but the evaluator does not know — a model that grew a condition", async () => {
136
- const grown = declareKind({
137
- kind: ApiResourceKind.agent,
138
- schema: AgentSchema,
139
- source: "test/grown.fga",
140
- relations: [
141
- ["viewer", direct(publicWith("identity_account", "after_hours"))],
142
- ],
143
- });
144
- const afterHours = newInMemoryTupleSource([
145
- {
146
- object: parseObjectRef("agent:open"),
147
- relation: "viewer",
148
- subject: {
149
- form: "wildcard",
150
- type: "identity_account",
151
- condition: "after_hours",
152
- },
153
- },
154
- ]);
155
- await expect(
156
- checkRelation(
157
- { model: newModel([grown]), source: afterHours },
158
- parseObjectRef("agent:open"),
159
- "viewer",
160
- stranger,
161
- RESOLVE,
162
- ),
163
- ).rejects.toMatchObject({ reason: "unknown-condition" });
164
107
  });
165
108
  });
166
109
 
@@ -277,7 +220,6 @@ describe("the walk itself", () => {
277
220
  parseObjectRef("agent:n0"),
278
221
  "next",
279
222
  person("ida_nobody"),
280
- RESOLVE,
281
223
  ),
282
224
  ).rejects.toMatchObject({ reason: "resolution-depth-exceeded" });
283
225
  });
@@ -298,7 +240,6 @@ describe("the walk itself", () => {
298
240
  parseObjectRef("agent:x"),
299
241
  "a",
300
242
  person("ida_nobody"),
301
- RESOLVE,
302
243
  ),
303
244
  ).rejects.toBeInstanceOf(AuthorizationEvaluationError);
304
245
  });
@@ -332,7 +273,7 @@ describe("declareKind validates a transcript at load", () => {
332
273
  source: "test/bad.fga",
333
274
  relations: [
334
275
  ["viewer", direct(objectOf("identity_account"))],
335
- ["viewer", direct(publicWith("identity_account", "allow_public"))],
276
+ ["viewer", direct(usersetOf("organization", "viewer"))],
336
277
  ],
337
278
  }),
338
279
  ).toThrow("declared twice");
@@ -50,7 +50,7 @@ describe("rowFactsOf against the tuple lifecycle's own resolution", () => {
50
50
  for (const visibility of [
51
51
  ApiResourceVisibility.visibility_private,
52
52
  ApiResourceVisibility.visibility_org,
53
- ApiResourceVisibility.visibility_public,
53
+ ApiResourceVisibility.visibility_platform,
54
54
  ]) {
55
55
  it(`${declaration.type} at ${ApiResourceVisibility[visibility]}: the same parent links and visibility shapes`, () => {
56
56
  const row = fixtureRow(declaration, {
@@ -133,7 +133,7 @@ describe("a list candidate against the loaded row — the facts' two producers",
133
133
  for (const visibility of [
134
134
  ApiResourceVisibility.visibility_private,
135
135
  ApiResourceVisibility.visibility_org,
136
- ApiResourceVisibility.visibility_public,
136
+ ApiResourceVisibility.visibility_platform,
137
137
  ]) {
138
138
  it(`${declaration.type} at ${ApiResourceVisibility[visibility]}: the candidate the helper builds carries the facts the driver derives from`, async () => {
139
139
  const row = fixtureRow(declaration, {
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/agent-instance-creation.fga.yaml
2
- # at commit 4c03c38d2 (the OpenFGA store test the cloud runs against its live model).
2
+ # as changed by stigmer-cloud#765 (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 agent-instance creation: two halves, asked together by
@@ -8,15 +8,15 @@
8
8
  # agent may instantiate it). The organization half is
9
9
  # can_create_agent_instance: member on the organization the instance is
10
10
  # created IN, which is the caller's own, not the agent's: a personal
11
- # instance of another organization's public agent lives in the caller's
12
- # organization (the marketplace case), so the agent's permission alone
13
- # would let a row be planted in any organization named on the request.
11
+ # instance of another organization's platform-visible agent lives in the
12
+ # caller's organization (the tenant-family case), so the agent's permission
13
+ # alone would let a row be planted in any organization named on the request.
14
14
  #
15
15
  # What these pin: owners, admins and members hold the organization half;
16
16
  # a viewer-role account may run an org-visible agent (the agent half) and
17
17
  # still lacks the organization half; a guest holds neither; an outsider
18
- # holds neither; and the marketplace case passes on the caller's own
19
- # organization while the agent half comes from the public wildcard.
18
+ # holds neither; and the tenant-family case passes on the caller's own
19
+ # organization while the agent half comes from the platform_viewer grant.
20
20
  #
21
21
  # Run: fga model test --tests agent-instance-creation.fga.yaml
22
22
 
@@ -47,6 +47,15 @@ tuples:
47
47
  relation: member
48
48
  object: organization:consumer
49
49
 
50
+ # acme owns identity_provider:idp1, which manages consumer: the two are
51
+ # one tenant family, the audience a platform-visible agent reaches.
52
+ - user: organization:acme
53
+ relation: organization
54
+ object: identity_provider:idp1
55
+ - user: organization:consumer
56
+ relation: managed_org
57
+ object: identity_provider:idp1
58
+
50
59
  # An ORG-visible agent in acme, authored by oscar.
51
60
  - user: organization:acme
52
61
  relation: organization
@@ -66,7 +75,7 @@ tuples:
66
75
  relation: owner
67
76
  object: agent:secret-bot
68
77
 
69
- # A PUBLIC marketplace agent in acme (the conditional wildcard plus the
78
+ # A PLATFORM-visible agent in acme (the platform_viewer grant plus the
70
79
  # org floor tuple the visibility writer emits).
71
80
  - user: organization:acme
72
81
  relation: organization
@@ -74,12 +83,9 @@ tuples:
74
83
  - user: identity_account:oscar
75
84
  relation: owner
76
85
  object: agent:open-bot
77
- - user: identity_account:*
78
- relation: viewer
86
+ - user: identity_provider:idp1#platform_user
87
+ relation: platform_viewer
79
88
  object: agent:open-bot
80
- condition:
81
- name: allow_public
82
- context: {}
83
89
  - user: organization:acme#viewer
84
90
  relation: viewer
85
91
  object: agent:open-bot
@@ -121,8 +127,6 @@ tests:
121
127
  check:
122
128
  - user: identity_account:dave
123
129
  object: agent:team-bot
124
- context:
125
- allow: false
126
130
  assertions:
127
131
  can_create_instance: true
128
132
  can_execute: true
@@ -131,8 +135,6 @@ tests:
131
135
  check:
132
136
  - user: identity_account:vera
133
137
  object: agent:team-bot
134
- context:
135
- allow: false
136
138
  assertions:
137
139
  can_create_instance: true
138
140
  - user: identity_account:vera
@@ -144,35 +146,25 @@ tests:
144
146
  check:
145
147
  - user: identity_account:oscar
146
148
  object: agent:secret-bot
147
- context:
148
- allow: false
149
149
  assertions:
150
150
  can_create_instance: true
151
151
  - user: identity_account:olivia
152
152
  object: agent:secret-bot
153
- context:
154
- allow: false
155
153
  assertions:
156
154
  can_create_instance: true
157
155
  - user: identity_account:dave
158
156
  object: agent:secret-bot
159
- context:
160
- allow: false
161
157
  assertions:
162
158
  can_create_instance: false
163
159
  - user: identity_account:mia
164
160
  object: agent:secret-bot
165
- context:
166
- allow: false
167
161
  assertions:
168
162
  can_create_instance: false
169
163
 
170
- - name: the marketplace case, the agent half from the wildcard and the organization half at home
164
+ - name: the tenant-family case, the agent half from platform_viewer and the organization half at home
171
165
  check:
172
166
  - user: identity_account:mia
173
167
  object: agent:open-bot
174
- context:
175
- allow: true
176
168
  assertions:
177
169
  can_create_instance: true
178
170
  - user: identity_account:mia
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/blueprint-private-visibility.fga.yaml
2
- # at commit 2ec420161 (the OpenFGA store test the cloud runs against its live model).
2
+ # as changed by stigmer-cloud#765 (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,7 +14,6 @@
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
18
17
  # PLATFORM platform_viewer@identity_provider:<idp>#platform_user + the ORG tuple
19
18
  #
20
19
  # Read vs spend: an org viewer-role user READS org-visible blueprints (and, at
@@ -23,9 +22,8 @@
23
22
  # can_create_execution_in permissions, which require member-or-guest. The
24
23
  # vera assertions pin both halves of that contract.
25
24
  #
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.
25
+ # The ORG tuple rides along on PLATFORM (the "org floor") so a shared
26
+ # blueprint stays listable in its own org.
29
27
  #
30
28
  # T08 exception: org ADMINS (and org owners, via the role hierarchy) are
31
29
  # composed into blueprint `owner` and therefore see, list, and manage
@@ -39,8 +37,8 @@
39
37
  # Scenario: org "acme" has owner-creator carol, org admin oscar, plain
40
38
  # member dave, and read-only viewer vera (the role SSO auto-provisioning
41
39
  # grants by default); mallory belongs to an unrelated org. Carol authors one
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.
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.
44
42
  name: blueprint-private-visibility
45
43
  model_file: ../model/fga.mod
46
44
 
@@ -114,22 +112,6 @@ tuples:
114
112
  relation: viewer
115
113
  object: agent:legacy-bot
116
114
 
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
-
133
115
  # --- PRIVATE agent with an explicit individual viewer grant ---
134
116
  - user: organization:acme
135
117
  relation: organization
@@ -146,8 +128,6 @@ tests:
146
128
  check:
147
129
  - user: identity_account:dave
148
130
  object: agent:secret-bot
149
- context:
150
- allow: false
151
131
  assertions:
152
132
  can_view: false
153
133
  can_execute: false
@@ -155,22 +135,16 @@ tests:
155
135
  can_clone: false
156
136
  - user: identity_account:dave
157
137
  object: skill:secret-notes
158
- context:
159
- allow: false
160
138
  assertions:
161
139
  can_view: false
162
140
  can_use: false
163
141
  - user: identity_account:dave
164
142
  object: workflow:secret-flow
165
- context:
166
- allow: false
167
143
  assertions:
168
144
  can_view: false
169
145
  can_execute: false
170
146
  - user: identity_account:dave
171
147
  object: mcp_server:secret-tools
172
- context:
173
- allow: false
174
148
  assertions:
175
149
  can_view: false
176
150
  can_use: false
@@ -180,8 +154,6 @@ tests:
180
154
  check:
181
155
  - user: identity_account:oscar
182
156
  object: agent:secret-bot
183
- context:
184
- allow: false
185
157
  assertions:
186
158
  can_view: true
187
159
  can_edit: true
@@ -189,15 +161,11 @@ tests:
189
161
  can_execute: true
190
162
  - user: identity_account:oscar
191
163
  object: skill:secret-notes
192
- context:
193
- allow: false
194
164
  assertions:
195
165
  can_view: true
196
166
  can_edit: true
197
167
  - user: identity_account:oscar
198
168
  object: workflow:secret-flow
199
- context:
200
- allow: false
201
169
  assertions:
202
170
  can_view: true
203
171
  can_edit: true
@@ -205,8 +173,6 @@ tests:
205
173
  # four private-blueprint kinds are pinned to the same rule.
206
174
  - user: identity_account:oscar
207
175
  object: mcp_server:secret-tools
208
- context:
209
- allow: false
210
176
  assertions:
211
177
  can_view: true
212
178
  can_edit: true
@@ -215,22 +181,17 @@ tests:
215
181
  list_objects:
216
182
  - user: identity_account:oscar
217
183
  type: agent
218
- context:
219
- allow: false
220
184
  assertions:
221
185
  can_view:
222
186
  - agent:secret-bot
223
187
  - agent:team-bot
224
188
  - agent:legacy-bot
225
- - agent:open-bot
226
189
  - agent:shared-secret
227
190
 
228
191
  - name: owner retains full access to private blueprints
229
192
  check:
230
193
  - user: identity_account:carol
231
194
  object: agent:secret-bot
232
- context:
233
- allow: false
234
195
  assertions:
235
196
  can_view: true
236
197
  can_execute: true
@@ -239,8 +200,6 @@ tests:
239
200
  can_delete: true
240
201
  - user: identity_account:carol
241
202
  object: workflow:secret-flow
242
- context:
243
- allow: false
244
203
  assertions:
245
204
  can_view: true
246
205
  can_execute: true
@@ -250,8 +209,6 @@ tests:
250
209
  check:
251
210
  - user: identity_account:dave
252
211
  object: agent:team-bot
253
- context:
254
- allow: false
255
212
  assertions:
256
213
  can_view: true
257
214
  can_execute: true
@@ -260,33 +217,10 @@ tests:
260
217
  can_delete: false
261
218
  - user: identity_account:mallory
262
219
  object: agent:team-bot
263
- context:
264
- allow: false
265
220
  assertions:
266
221
  can_view: false
267
222
  can_execute: false
268
223
 
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
-
290
224
  - name: explicit individual viewer grant on a private agent conveys view and run
291
225
  check:
292
226
  # Run-what-you-can-read: can_execute derives from viewer, so an
@@ -294,38 +228,30 @@ tests:
294
228
  # which checks can_view).
295
229
  - user: identity_account:dave
296
230
  object: agent:shared-secret
297
- context:
298
- allow: false
299
231
  assertions:
300
232
  can_view: true
301
233
  can_execute: true
302
234
  can_edit: false
303
235
 
304
- - name: org member's listable agents exclude private ones (wildcard suppressed)
236
+ - name: org member's listable agents exclude private ones
305
237
  list_objects:
306
238
  - user: identity_account:dave
307
239
  type: agent
308
- context:
309
- allow: false
310
240
  assertions:
311
241
  can_view:
312
242
  - agent:team-bot
313
243
  - agent:legacy-bot
314
- - agent:open-bot
315
244
  - agent:shared-secret
316
245
 
317
246
  - name: owner's listable agents include everything they authored
318
247
  list_objects:
319
248
  - user: identity_account:carol
320
249
  type: agent
321
- context:
322
- allow: false
323
250
  assertions:
324
251
  can_view:
325
252
  - agent:secret-bot
326
253
  - agent:team-bot
327
254
  - agent:legacy-bot
328
- - agent:open-bot
329
255
  - agent:shared-secret
330
256
 
331
257
  # ── cloud#257: the viewer-role cell (previously untested) ──────────────
@@ -336,27 +262,16 @@ tests:
336
262
  # spend refusal is pinned separately on the org permissions below.
337
263
  - user: identity_account:vera
338
264
  object: agent:team-bot
339
- context:
340
- allow: false
341
265
  assertions:
342
266
  can_view: true
343
267
  can_clone: true
344
268
  can_execute: true
345
269
  can_edit: false
346
270
  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
354
271
  # Private stays private — the viewer role grants nothing beyond the
355
272
  # explicit visibility tuples.
356
273
  - user: identity_account:vera
357
274
  object: agent:secret-bot
358
- context:
359
- allow: false
360
275
  assertions:
361
276
  can_view: false
362
277
  can_execute: false
@@ -382,8 +297,6 @@ tests:
382
297
  check:
383
298
  - user: identity_account:dave
384
299
  object: agent:legacy-bot
385
- context:
386
- allow: false
387
300
  assertions:
388
301
  can_view: true
389
302
  can_execute: true
@@ -392,8 +305,6 @@ tests:
392
305
  # organization#member. The boot backfill converges these tuples.
393
306
  - user: identity_account:vera
394
307
  object: agent:legacy-bot
395
- context:
396
- allow: false
397
308
  assertions:
398
309
  can_view: false
399
310
  can_execute: false
@@ -402,9 +313,6 @@ tests:
402
313
  list_objects:
403
314
  - user: identity_account:vera
404
315
  type: agent
405
- context:
406
- allow: false
407
316
  assertions:
408
317
  can_view:
409
318
  - agent:team-bot
410
- - agent:open-bot