@stigmer/server 3.22.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.
Files changed (265) 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/blueprint-private-visibility.fga.yaml +6 -98
  178. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +4 -61
  179. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +1 -21
  180. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +1 -25
  181. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +1 -3
  182. package/src/authorization/__tests__/list-read-scope.test.ts +18 -17
  183. package/src/authorization/__tests__/store-tests.test.ts +1 -6
  184. package/src/authorization/__tests__/tuples.test.ts +12 -11
  185. package/src/authorization/authorizer.ts +4 -9
  186. package/src/authorization/derived-tuples.ts +14 -31
  187. package/src/authorization/evaluator.ts +8 -44
  188. package/src/authorization/list-read-scope.ts +5 -11
  189. package/src/authorization/model/agent.ts +2 -5
  190. package/src/authorization/model/agent_instance.ts +0 -2
  191. package/src/authorization/model/mcp_server.ts +0 -2
  192. package/src/authorization/model/plugin.ts +1 -4
  193. package/src/authorization/model/rewrite.ts +8 -13
  194. package/src/authorization/model/skill.ts +0 -2
  195. package/src/authorization/model/workflow.ts +0 -2
  196. package/src/authorization/model/workflow_instance.ts +0 -2
  197. package/src/authorization/organization-directory.ts +1 -3
  198. package/src/authorization/store-test-kit.ts +16 -75
  199. package/src/authorization/tuples.ts +16 -39
  200. package/src/domain/agent/__tests__/agent.test.ts +11 -4
  201. package/src/domain/agent/controller.ts +7 -7
  202. package/src/domain/agentchannel/__tests__/agentchannel.test.ts +223 -48
  203. package/src/domain/agentchannel/controller.ts +6 -1
  204. package/src/domain/agentexecution/controller.ts +6 -1
  205. package/src/domain/agentinstance/controller.ts +6 -12
  206. package/src/domain/agentshare/__tests__/agentshare.test.ts +196 -172
  207. package/src/domain/agentshare/__tests__/create-authorization.test.ts +16 -31
  208. package/src/domain/agentshare/constants.ts +14 -26
  209. package/src/domain/agentshare/controller.ts +6 -1
  210. package/src/domain/agentshare/steps.ts +41 -194
  211. package/src/domain/environment/controller.ts +5 -8
  212. package/src/domain/executioncontext/controller.ts +5 -1
  213. package/src/domain/mcpserver/__tests__/mcpserver.test.ts +115 -28
  214. package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +53 -18
  215. package/src/domain/mcpserver/controller.ts +6 -12
  216. package/src/domain/plugin/controller.ts +1 -8
  217. package/src/domain/plugin/push.ts +8 -16
  218. package/src/domain/schedule/controller.ts +6 -1
  219. package/src/domain/session/controller.ts +12 -4
  220. package/src/domain/skill/controller.ts +0 -7
  221. package/src/domain/workflow/__tests__/agent-call-references.test.ts +222 -0
  222. package/src/domain/workflow/agent-call-references.ts +157 -0
  223. package/src/domain/workflow/controller.ts +28 -10
  224. package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
  225. package/src/domain/workflow/validation/task-config-constraints.ts +7 -3
  226. package/src/domain/workflowexecution/controller.ts +7 -2
  227. package/src/domain/workflowinstance/controller.ts +6 -12
  228. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +32 -19
  229. package/src/extensions/__tests__/extension-composition.test.ts +4 -4
  230. package/src/extensions/__tests__/list-read-scope-composed.test.ts +9 -6
  231. package/src/extensions/authorization-queries.ts +6 -5
  232. package/src/extensions/list-read-scope.ts +1 -1
  233. package/src/extensions/resource-authorization.ts +3 -5
  234. package/src/index.ts +0 -1
  235. package/src/pipeline/__tests__/supports-visibility.test.ts +112 -0
  236. package/src/pipeline/apiresource-meta.ts +21 -10
  237. package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +18 -31
  238. package/src/pipeline/steps/__tests__/references.test.ts +703 -0
  239. package/src/pipeline/steps/authorization-tuples.ts +9 -11
  240. package/src/pipeline/steps/references.ts +578 -70
  241. package/src/query/search/__tests__/criteria.test.ts +0 -4
  242. package/src/query/search/__tests__/query-store.test.ts +11 -40
  243. package/src/query/search/controller.ts +0 -1
  244. package/src/query/search/criteria.ts +0 -14
  245. package/src/query/search/handler.ts +6 -7
  246. package/src/query/search/query-store.ts +0 -2
  247. package/src/store/__tests__/public-visibility-retired.test.ts +127 -0
  248. package/src/store/__tests__/store-contract.ts +6 -51
  249. package/src/store/interface.ts +3 -6
  250. package/src/store/postgres/__tests__/migrations.test.ts +187 -6
  251. package/src/store/postgres/__tests__/store-contract.test.ts +0 -2
  252. package/src/store/postgres/migrations.ts +48 -1
  253. package/src/store/postgres/store.ts +4 -11
  254. package/src/store/public-visibility-retired.ts +119 -0
  255. package/src/store/sqlite/__tests__/migrations.test.ts +191 -5
  256. package/src/store/sqlite/migrations.ts +45 -1
  257. package/src/store/sqlite/store.ts +4 -10
  258. package/dist/pipeline/steps/visibility-gates.d.ts +0 -27
  259. package/dist/pipeline/steps/visibility-gates.d.ts.map +0 -1
  260. package/dist/pipeline/steps/visibility-gates.js +0 -139
  261. package/dist/pipeline/steps/visibility-gates.js.map +0 -1
  262. package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +0 -98
  263. package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +0 -52
  264. package/src/pipeline/steps/__tests__/visibility-gates.test.ts +0 -187
  265. 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/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
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/default-instance-inheritance.fga.yaml
2
- # at commit b87dd1170 (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 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, public users (allow_public), and
11
- # platform users (identity_provider#platform_user). No enum-derived
10
+ # `viewer from default_of` — org members and platform users
11
+ # (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,8 +20,7 @@
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
- # everyone reaches default instances of public ones; personal instances
24
- # never leak.
23
+ # personal instances never leak.
25
24
  name: default-instance-inheritance
26
25
  model_file: ../model/fga.mod
27
26
 
@@ -115,35 +114,6 @@ tuples:
115
114
  relation: default_of
116
115
  object: agent_instance:internal-default
117
116
 
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
-
147
117
  # --- Platform-shared workflow + its default instance ---
148
118
  - user: organization:planton
149
119
  relation: organization
@@ -175,8 +145,6 @@ tests:
175
145
  check:
176
146
  - user: identity_account:alice
177
147
  object: agent_instance:sara-default
178
- context:
179
- allow: false
180
148
  assertions:
181
149
  can_view: true
182
150
  can_execute: true
@@ -187,8 +155,6 @@ tests:
187
155
  check:
188
156
  - user: identity_account:mallory
189
157
  object: agent_instance:sara-default
190
- context:
191
- allow: false
192
158
  assertions:
193
159
  can_view: false
194
160
  can_execute: false
@@ -199,14 +165,10 @@ tests:
199
165
  # default_of tuple — only she (its owner) can reach it.
200
166
  - user: identity_account:swarup
201
167
  object: agent_instance:alice-personal
202
- context:
203
- allow: false
204
168
  assertions:
205
169
  can_view: false
206
170
  - user: identity_account:alice
207
171
  object: agent_instance:alice-personal
208
- context:
209
- allow: false
210
172
  assertions:
211
173
  can_view: true
212
174
  can_edit: true
@@ -215,8 +177,6 @@ tests:
215
177
  check:
216
178
  - user: identity_account:priya
217
179
  object: agent_instance:internal-default
218
- context:
219
- allow: false
220
180
  assertions:
221
181
  can_view: true
222
182
  can_execute: true
@@ -226,34 +186,19 @@ tests:
226
186
  # read audience, and the default instance inherits it structurally.
227
187
  - user: identity_account:veda
228
188
  object: agent_instance:internal-default
229
- context:
230
- allow: false
231
189
  assertions:
232
190
  can_view: true
233
191
  can_edit: false
234
192
  # Managed-org membership grants nothing on non-platform-shared agents.
235
193
  - user: identity_account:alice
236
194
  object: agent_instance:internal-default
237
- context:
238
- allow: false
239
195
  assertions:
240
196
  can_view: false
241
197
 
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
-
251
198
  - name: managed-org member reaches the default instance of a platform-shared workflow
252
199
  check:
253
200
  - user: identity_account:alice
254
201
  object: workflow_instance:onboarding-default
255
- context:
256
- allow: false
257
202
  assertions:
258
203
  can_view: true
259
204
  can_execute: true
@@ -263,8 +208,6 @@ tests:
263
208
  list_objects:
264
209
  - user: identity_account:alice
265
210
  type: agent_instance
266
- context:
267
- allow: false
268
211
  assertions:
269
212
  can_view:
270
213
  - agent_instance:sara-default
@@ -1,5 +1,5 @@
1
1
  # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/org-admin-owner-inheritance.fga.yaml
2
- # as changed by stigmer-cloud#757 (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 org-admin owner inheritance (T08).
@@ -131,8 +131,6 @@ tests:
131
131
  check:
132
132
  - user: identity_account:ana
133
133
  object: agent:carols-bot
134
- context:
135
- allow: false
136
134
  assertions:
137
135
  can_view: true
138
136
  can_edit: true
@@ -169,8 +167,6 @@ tests:
169
167
  can_grant_access: true
170
168
  - user: identity_account:ana
171
169
  object: skill:carols-notes
172
- context:
173
- allow: false
174
170
  assertions:
175
171
  can_view: true
176
172
  can_edit: true
@@ -178,8 +174,6 @@ tests:
178
174
  can_grant_access: true
179
175
  - user: identity_account:ana
180
176
  object: workflow:carols-flow
181
- context:
182
- allow: false
183
177
  assertions:
184
178
  can_view: true
185
179
  can_edit: true
@@ -197,8 +191,6 @@ tests:
197
191
  check:
198
192
  - user: identity_account:root
199
193
  object: agent:carols-bot
200
- context:
201
- allow: false
202
194
  assertions:
203
195
  can_edit: true
204
196
  can_delete: true
@@ -218,8 +210,6 @@ tests:
218
210
  check:
219
211
  - user: identity_account:dave
220
212
  object: agent:carols-bot
221
- context:
222
- allow: false
223
213
  assertions:
224
214
  can_view: false
225
215
  can_edit: false
@@ -250,8 +240,6 @@ tests:
250
240
  check:
251
241
  - user: identity_account:zara
252
242
  object: agent:carols-bot
253
- context:
254
- allow: false
255
243
  assertions:
256
244
  can_view: false
257
245
  can_edit: false
@@ -266,8 +254,6 @@ tests:
266
254
  check:
267
255
  - user: identity_account:ana
268
256
  object: agent_instance:carols-instance
269
- context:
270
- allow: false
271
257
  assertions:
272
258
  can_view: false
273
259
  can_edit: false
@@ -297,8 +283,6 @@ tests:
297
283
  check:
298
284
  - user: identity_account:carol
299
285
  object: agent:carols-bot
300
- context:
301
- allow: false
302
286
  assertions:
303
287
  can_view: true
304
288
  can_edit: true
@@ -309,8 +293,6 @@ tests:
309
293
  list_objects:
310
294
  - user: identity_account:ana
311
295
  type: agent
312
- context:
313
- allow: false
314
296
  assertions:
315
297
  can_view:
316
298
  - agent:carols-bot
@@ -318,8 +300,6 @@ tests:
318
300
  - agent:carols-bot
319
301
  - user: identity_account:ana
320
302
  type: agent_instance
321
- context:
322
- allow: false
323
303
  assertions:
324
304
  can_view: []
325
305
  - user: identity_account:ana