@stigmer/server 3.27.2 → 3.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/README.md +2 -0
  2. package/dist/authorization/authorizer.d.ts +3 -3
  3. package/dist/authorization/authorizer.js +3 -3
  4. package/dist/authorization/derived-tuples.js +6 -1
  5. package/dist/authorization/derived-tuples.js.map +1 -1
  6. package/dist/authorization/evaluator.d.ts +9 -10
  7. package/dist/authorization/evaluator.d.ts.map +1 -1
  8. package/dist/authorization/evaluator.js.map +1 -1
  9. package/dist/authorization/list-read-scope.d.ts.map +1 -1
  10. package/dist/authorization/list-read-scope.js +29 -18
  11. package/dist/authorization/list-read-scope.js.map +1 -1
  12. package/dist/authorization/model/bindings.d.ts +41 -0
  13. package/dist/authorization/model/bindings.d.ts.map +1 -0
  14. package/dist/authorization/model/bindings.js +89 -0
  15. package/dist/authorization/model/bindings.js.map +1 -0
  16. package/dist/authorization/model/data/authorization-model.json +3141 -0
  17. package/dist/authorization/model/default-of.d.ts +2 -2
  18. package/dist/authorization/model/execution-viewer.d.ts +3 -0
  19. package/dist/authorization/model/execution-viewer.d.ts.map +1 -0
  20. package/dist/authorization/model/execution-viewer.js +50 -0
  21. package/dist/authorization/model/execution-viewer.js.map +1 -0
  22. package/dist/authorization/model/index.d.ts +33 -21
  23. package/dist/authorization/model/index.d.ts.map +1 -1
  24. package/dist/authorization/model/index.js +74 -52
  25. package/dist/authorization/model/index.js.map +1 -1
  26. package/dist/authorization/model/openfga-json.d.ts +18 -0
  27. package/dist/authorization/model/openfga-json.d.ts.map +1 -0
  28. package/dist/authorization/model/openfga-json.js +266 -0
  29. package/dist/authorization/model/openfga-json.js.map +1 -0
  30. package/dist/authorization/model/rewrite.d.ts +39 -67
  31. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  32. package/dist/authorization/model/rewrite.js +1 -117
  33. package/dist/authorization/model/rewrite.js.map +1 -1
  34. package/dist/authorization/strict-json.d.ts +20 -0
  35. package/dist/authorization/strict-json.d.ts.map +1 -0
  36. package/dist/authorization/strict-json.js +45 -0
  37. package/dist/authorization/strict-json.js.map +1 -0
  38. package/dist/boot/compose.d.ts.map +1 -1
  39. package/dist/boot/compose.js +9 -7
  40. package/dist/boot/compose.js.map +1 -1
  41. package/dist/domain/workflowexecution/list-index.d.ts +1 -1
  42. package/dist/extensions/list-read-scope.d.ts +20 -3
  43. package/dist/extensions/list-read-scope.d.ts.map +1 -1
  44. package/dist/extensions/list-read-scope.js +20 -1
  45. package/dist/extensions/list-read-scope.js.map +1 -1
  46. package/dist/index.d.ts +7 -8
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +15 -5
  49. package/dist/index.js.map +1 -1
  50. package/package.json +7 -6
  51. package/src/authorization/README.md +41 -34
  52. package/src/authorization/__tests__/authorizer.test.ts +5 -14
  53. package/src/authorization/__tests__/derived-tuples.test.ts +29 -27
  54. package/src/authorization/__tests__/evaluator.test.ts +53 -160
  55. package/src/authorization/__tests__/facts.test.ts +5 -11
  56. package/src/authorization/__tests__/list-read-scope.measure.test.ts +12 -20
  57. package/src/authorization/__tests__/list-read-scope.test.ts +15 -14
  58. package/src/authorization/__tests__/organization-directory.test.ts +2 -2
  59. package/src/authorization/__tests__/store-test-kit.ts +246 -0
  60. package/src/authorization/__tests__/store-tests.test.ts +92 -223
  61. package/src/authorization/__tests__/support.ts +30 -2
  62. package/src/authorization/__tests__/throwaway-model.ts +75 -0
  63. package/src/authorization/__tests__/wire-permissions.test.ts +141 -107
  64. package/src/authorization/authorizer.ts +3 -3
  65. package/src/authorization/derived-tuples.ts +7 -2
  66. package/src/authorization/evaluator.ts +8 -10
  67. package/src/authorization/list-read-scope.ts +37 -22
  68. package/src/authorization/model/__tests__/openfga-json.test.ts +353 -0
  69. package/src/authorization/model/__tests__/registry.test.ts +345 -277
  70. package/src/authorization/model/bindings.ts +131 -0
  71. package/src/authorization/model/data/authorization-model.json +3141 -0
  72. package/src/authorization/model/default-of.ts +2 -2
  73. package/src/authorization/model/execution-viewer.ts +56 -0
  74. package/src/authorization/model/index.ts +81 -72
  75. package/src/authorization/model/openfga-json.ts +310 -0
  76. package/src/authorization/model/rewrite.ts +39 -188
  77. package/src/authorization/strict-json.ts +52 -0
  78. package/src/boot/compose.ts +9 -7
  79. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +3 -6
  80. package/src/extensions/list-read-scope.ts +32 -4
  81. package/src/index.ts +15 -44
  82. package/dist/authorization/model/agent.d.ts +0 -2
  83. package/dist/authorization/model/agent.d.ts.map +0 -1
  84. package/dist/authorization/model/agent.js +0 -43
  85. package/dist/authorization/model/agent.js.map +0 -1
  86. package/dist/authorization/model/agent_channel.d.ts +0 -2
  87. package/dist/authorization/model/agent_channel.d.ts.map +0 -1
  88. package/dist/authorization/model/agent_channel.js +0 -39
  89. package/dist/authorization/model/agent_channel.js.map +0 -1
  90. package/dist/authorization/model/agent_execution.d.ts +0 -2
  91. package/dist/authorization/model/agent_execution.d.ts.map +0 -1
  92. package/dist/authorization/model/agent_execution.js +0 -25
  93. package/dist/authorization/model/agent_execution.js.map +0 -1
  94. package/dist/authorization/model/agent_instance.d.ts +0 -2
  95. package/dist/authorization/model/agent_instance.d.ts.map +0 -1
  96. package/dist/authorization/model/agent_instance.js +0 -48
  97. package/dist/authorization/model/agent_instance.js.map +0 -1
  98. package/dist/authorization/model/agent_share.d.ts +0 -2
  99. package/dist/authorization/model/agent_share.d.ts.map +0 -1
  100. package/dist/authorization/model/agent_share.js +0 -29
  101. package/dist/authorization/model/agent_share.js.map +0 -1
  102. package/dist/authorization/model/api_key.d.ts +0 -2
  103. package/dist/authorization/model/api_key.d.ts.map +0 -1
  104. package/dist/authorization/model/api_key.js +0 -27
  105. package/dist/authorization/model/api_key.js.map +0 -1
  106. package/dist/authorization/model/artifact.d.ts +0 -2
  107. package/dist/authorization/model/artifact.d.ts.map +0 -1
  108. package/dist/authorization/model/artifact.js +0 -27
  109. package/dist/authorization/model/artifact.js.map +0 -1
  110. package/dist/authorization/model/channel_app.d.ts +0 -2
  111. package/dist/authorization/model/channel_app.d.ts.map +0 -1
  112. package/dist/authorization/model/channel_app.js +0 -28
  113. package/dist/authorization/model/channel_app.js.map +0 -1
  114. package/dist/authorization/model/environment.d.ts +0 -2
  115. package/dist/authorization/model/environment.d.ts.map +0 -1
  116. package/dist/authorization/model/environment.js +0 -33
  117. package/dist/authorization/model/environment.js.map +0 -1
  118. package/dist/authorization/model/execution_context.d.ts +0 -2
  119. package/dist/authorization/model/execution_context.d.ts.map +0 -1
  120. package/dist/authorization/model/execution_context.js +0 -19
  121. package/dist/authorization/model/execution_context.js.map +0 -1
  122. package/dist/authorization/model/iam_policy.d.ts +0 -2
  123. package/dist/authorization/model/iam_policy.d.ts.map +0 -1
  124. package/dist/authorization/model/iam_policy.js +0 -31
  125. package/dist/authorization/model/iam_policy.js.map +0 -1
  126. package/dist/authorization/model/identity_account.d.ts +0 -2
  127. package/dist/authorization/model/identity_account.d.ts.map +0 -1
  128. package/dist/authorization/model/identity_account.js +0 -25
  129. package/dist/authorization/model/identity_account.js.map +0 -1
  130. package/dist/authorization/model/mcp_server.d.ts +0 -2
  131. package/dist/authorization/model/mcp_server.d.ts.map +0 -1
  132. package/dist/authorization/model/mcp_server.js +0 -38
  133. package/dist/authorization/model/mcp_server.js.map +0 -1
  134. package/dist/authorization/model/memory.d.ts +0 -2
  135. package/dist/authorization/model/memory.d.ts.map +0 -1
  136. package/dist/authorization/model/memory.js +0 -26
  137. package/dist/authorization/model/memory.js.map +0 -1
  138. package/dist/authorization/model/oauth_app.d.ts +0 -2
  139. package/dist/authorization/model/oauth_app.d.ts.map +0 -1
  140. package/dist/authorization/model/oauth_app.js +0 -31
  141. package/dist/authorization/model/oauth_app.js.map +0 -1
  142. package/dist/authorization/model/organization.d.ts +0 -2
  143. package/dist/authorization/model/organization.d.ts.map +0 -1
  144. package/dist/authorization/model/organization.js +0 -58
  145. package/dist/authorization/model/organization.js.map +0 -1
  146. package/dist/authorization/model/platform_client.d.ts +0 -2
  147. package/dist/authorization/model/platform_client.d.ts.map +0 -1
  148. package/dist/authorization/model/platform_client.js +0 -31
  149. package/dist/authorization/model/platform_client.js.map +0 -1
  150. package/dist/authorization/model/plugin.d.ts +0 -2
  151. package/dist/authorization/model/plugin.d.ts.map +0 -1
  152. package/dist/authorization/model/plugin.js +0 -45
  153. package/dist/authorization/model/plugin.js.map +0 -1
  154. package/dist/authorization/model/schedule.d.ts +0 -2
  155. package/dist/authorization/model/schedule.d.ts.map +0 -1
  156. package/dist/authorization/model/schedule.js +0 -34
  157. package/dist/authorization/model/schedule.js.map +0 -1
  158. package/dist/authorization/model/session.d.ts +0 -2
  159. package/dist/authorization/model/session.d.ts.map +0 -1
  160. package/dist/authorization/model/session.js +0 -38
  161. package/dist/authorization/model/session.js.map +0 -1
  162. package/dist/authorization/model/skill.d.ts +0 -2
  163. package/dist/authorization/model/skill.d.ts.map +0 -1
  164. package/dist/authorization/model/skill.js +0 -39
  165. package/dist/authorization/model/skill.js.map +0 -1
  166. package/dist/authorization/model/workflow.d.ts +0 -2
  167. package/dist/authorization/model/workflow.d.ts.map +0 -1
  168. package/dist/authorization/model/workflow.js +0 -39
  169. package/dist/authorization/model/workflow.js.map +0 -1
  170. package/dist/authorization/model/workflow_execution.d.ts +0 -2
  171. package/dist/authorization/model/workflow_execution.d.ts.map +0 -1
  172. package/dist/authorization/model/workflow_execution.js +0 -33
  173. package/dist/authorization/model/workflow_execution.js.map +0 -1
  174. package/dist/authorization/model/workflow_instance.d.ts +0 -2
  175. package/dist/authorization/model/workflow_instance.d.ts.map +0 -1
  176. package/dist/authorization/model/workflow_instance.js +0 -96
  177. package/dist/authorization/model/workflow_instance.js.map +0 -1
  178. package/dist/authorization/store-test-kit.d.ts +0 -62
  179. package/dist/authorization/store-test-kit.d.ts.map +0 -1
  180. package/dist/authorization/store-test-kit.js +0 -265
  181. package/dist/authorization/store-test-kit.js.map +0 -1
  182. package/src/authorization/__tests__/enterprise-model.ts +0 -59
  183. package/src/authorization/__tests__/fixtures/fga/agent-channel-owner.fga.yaml +0 -112
  184. package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +0 -177
  185. package/src/authorization/__tests__/fixtures/fga/agent-share-owner.fga.yaml +0 -109
  186. package/src/authorization/__tests__/fixtures/fga/artifact-org-and-owner.fga.yaml +0 -128
  187. package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +0 -318
  188. package/src/authorization/__tests__/fixtures/fga/channel-app-owner.fga.yaml +0 -125
  189. package/src/authorization/__tests__/fixtures/fga/channel-participation.fga.yaml +0 -201
  190. package/src/authorization/__tests__/fixtures/fga/channel-session-visibility.fga.yaml +0 -187
  191. package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +0 -214
  192. package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +0 -129
  193. package/src/authorization/__tests__/fixtures/fga/memory-subject-only.fga.yaml +0 -72
  194. package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +0 -308
  195. package/src/authorization/__tests__/fixtures/fga/org-shared-environment.fga.yaml +0 -144
  196. package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +0 -199
  197. package/src/authorization/__tests__/fixtures/fga/provider-standing-viewer.fga.yaml +0 -40
  198. package/src/authorization/__tests__/fixtures/fga/reserved-label-writer.fga.yaml +0 -41
  199. package/src/authorization/__tests__/fixtures/fga/schedule-owner.fga.yaml +0 -113
  200. package/src/authorization/__tests__/fixtures/fga/schedule-session-visibility.fga.yaml +0 -214
  201. package/src/authorization/__tests__/fixtures/fga/session-personal-resource.fga.yaml +0 -117
  202. package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +0 -190
  203. package/src/authorization/model/agent.ts +0 -64
  204. package/src/authorization/model/agent_channel.ts +0 -57
  205. package/src/authorization/model/agent_execution.ts +0 -33
  206. package/src/authorization/model/agent_instance.ts +0 -66
  207. package/src/authorization/model/agent_share.ts +0 -40
  208. package/src/authorization/model/api_key.ts +0 -28
  209. package/src/authorization/model/artifact.ts +0 -38
  210. package/src/authorization/model/channel_app.ts +0 -39
  211. package/src/authorization/model/environment.ts +0 -48
  212. package/src/authorization/model/execution_context.ts +0 -20
  213. package/src/authorization/model/iam_policy.ts +0 -42
  214. package/src/authorization/model/identity_account.ts +0 -26
  215. package/src/authorization/model/mcp_server.ts +0 -59
  216. package/src/authorization/model/memory.ts +0 -27
  217. package/src/authorization/model/oauth_app.ts +0 -43
  218. package/src/authorization/model/organization.ts +0 -59
  219. package/src/authorization/model/platform_client.ts +0 -43
  220. package/src/authorization/model/plugin.ts +0 -66
  221. package/src/authorization/model/schedule.ts +0 -49
  222. package/src/authorization/model/session.ts +0 -50
  223. package/src/authorization/model/skill.ts +0 -60
  224. package/src/authorization/model/workflow.ts +0 -60
  225. package/src/authorization/model/workflow_execution.ts +0 -46
  226. package/src/authorization/model/workflow_instance.ts +0 -125
  227. package/src/authorization/store-test-kit.ts +0 -395
@@ -1,117 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/session-personal-resource.fga.yaml
2
- # at commit b87dd1170 (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 the session personal-resource model, including owner
6
- # deletability (2026-07-08-owner-session-delete changelog entry).
7
- #
8
- # Sessions are always private: no visibility tuples are ever written, so
9
- # access is owner + explicit viewer grants only. Org admins have no implicit
10
- # access, and platform operators have no session-delete override — the
11
- # platform-level can_delete_session relation was removed in favor of
12
- # `can_delete: owner` on the session itself (deletion no longer threatens
13
- # the billing trail; usage records are immutable and denormalized).
14
- #
15
- # Agent executions inherit ALL access from their parent session
16
- # (`owner from session`), so the execution assertions here pin the
17
- # inheritance that session cascade-delete relies on.
18
- #
19
- # Run with:
20
- # fga model test --tests session-personal-resource.fga.yaml
21
- #
22
- # Scenario: org "acme" has admin alice, member bob (session creator), and
23
- # member carol. dana is a platform operator with no relation to the session.
24
- name: session-personal-resource
25
- model_file: ../model/fga.mod
26
-
27
- tuples:
28
- # --- Org roles ---
29
- - user: identity_account:alice
30
- relation: admin
31
- object: organization:acme
32
- - user: identity_account:bob
33
- relation: member
34
- object: organization:acme
35
- - user: identity_account:carol
36
- relation: member
37
- object: organization:acme
38
-
39
- # --- Platform operator (no relation to the session) ---
40
- - user: identity_account:dana
41
- relation: operator
42
- object: platform:stigmer
43
-
44
- # --- bob's session (tuples written on create) ---
45
- - user: organization:acme
46
- relation: organization
47
- object: session:bobs-chat
48
- - user: identity_account:bob
49
- relation: owner
50
- object: session:bobs-chat
51
-
52
- # --- carol holds an explicit viewer grant on the session ---
53
- - user: identity_account:carol
54
- relation: viewer
55
- object: session:bobs-chat
56
-
57
- # --- an execution inside the session ---
58
- - user: session:bobs-chat
59
- relation: session
60
- object: agent_execution:run-1
61
-
62
- tests:
63
- - name: owner has full control including delete
64
- check:
65
- - user: identity_account:bob
66
- object: session:bobs-chat
67
- assertions:
68
- can_view: true
69
- can_edit: true
70
- can_delete: true
71
- can_create_execution_in: true
72
- can_grant_access: true
73
-
74
- - name: explicit viewer can view and run, but not edit or delete
75
- check:
76
- - user: identity_account:carol
77
- object: session:bobs-chat
78
- assertions:
79
- can_view: true
80
- can_create_execution_in: true
81
- can_edit: false
82
- can_delete: false
83
- can_grant_access: false
84
-
85
- - name: org admin has no implicit access to a personal session
86
- check:
87
- - user: identity_account:alice
88
- object: session:bobs-chat
89
- assertions:
90
- can_view: false
91
- can_edit: false
92
- can_delete: false
93
-
94
- - name: platform operator has no session-delete override
95
- check:
96
- - user: identity_account:dana
97
- object: session:bobs-chat
98
- assertions:
99
- can_view: false
100
- can_delete: false
101
-
102
- - name: execution access is inherited from the parent session
103
- check:
104
- - user: identity_account:bob
105
- object: agent_execution:run-1
106
- assertions:
107
- can_view: true
108
- can_edit: true
109
- - user: identity_account:carol
110
- object: agent_execution:run-1
111
- assertions:
112
- can_view: true
113
- can_edit: false
114
- - user: identity_account:alice
115
- object: agent_execution:run-1
116
- assertions:
117
- can_view: false
@@ -1,190 +0,0 @@
1
- # Pinned copy of stigmer-cloud backend/services/stigmer-server/fga/tests/workflow-execution-sharing.fga.yaml
2
- # as changed by stigmer-cloud#765 (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 workflow_execution sharing and run observability.
6
- #
7
- # Two independent axes govern who can read a run's inputs/outputs:
8
- #
9
- # 1. Per-execution sharing — the triggerer (owner) grants viewer on a single
10
- # workflow_execution. Enabled by the new can_grant_access / can_view_access
11
- # relations (mirrors session.fga).
12
- # 2. Instance-level run observability — opt-in via the workflow_instance's
13
- # `execution_viewer` relation, inherited by every execution through
14
- # `viewer = ... or execution_viewer from workflow_instance`.
15
- #
16
- # The critical invariant: making an instance org-RUNNABLE (instance#viewer for
17
- # org members) must NOT leak run history. Only execution_viewer does that.
18
- #
19
- # Run with:
20
- # fga model test --tests workflow-execution-sharing.fga.yaml
21
- #
22
- # Scenario: org "acme" with members alice (triggerer), bob, carol; outsider
23
- # org with member mallory. inst1 is org-runnable but keeps runs private; inst2
24
- # opts into org-wide run observability.
25
- name: workflow-execution-sharing
26
- model_file: ../model/fga.mod
27
-
28
- tuples:
29
- # --- Org memberships ---
30
- - user: identity_account:alice
31
- relation: member
32
- object: organization:acme
33
- - user: identity_account:bob
34
- relation: member
35
- object: organization:acme
36
- - user: identity_account:carol
37
- relation: member
38
- object: organization:acme
39
- - user: identity_account:vera
40
- relation: viewer
41
- object: organization:acme
42
- - user: identity_account:mallory
43
- relation: member
44
- object: organization:outsider
45
-
46
- # --- inst1: ORG-RUNNABLE instance, runs stay PRIVATE (no execution_viewer) ---
47
- - user: organization:acme
48
- relation: organization
49
- object: workflow_instance:inst1
50
- - user: identity_account:alice
51
- relation: owner
52
- object: workflow_instance:inst1
53
- # Everyone in the org can SEE the instance (cloud#257 viewer shape;
54
- # RUNNING it is additionally gated in Java on can_create_execution_in)...
55
- - user: organization:acme#viewer
56
- relation: viewer
57
- object: workflow_instance:inst1
58
- # ...but NO execution_viewer tuple, so run history is not shared.
59
-
60
- # run1: alice's run on inst1, no explicit grants.
61
- - user: organization:acme
62
- relation: organization
63
- object: workflow_execution:run1
64
- - user: workflow_instance:inst1
65
- relation: workflow_instance
66
- object: workflow_execution:run1
67
- - user: identity_account:alice
68
- relation: owner
69
- object: workflow_execution:run1
70
-
71
- # run1b: alice's run on inst1, explicitly shared with bob (per-execution).
72
- - user: organization:acme
73
- relation: organization
74
- object: workflow_execution:run1b
75
- - user: workflow_instance:inst1
76
- relation: workflow_instance
77
- object: workflow_execution:run1b
78
- - user: identity_account:alice
79
- relation: owner
80
- object: workflow_execution:run1b
81
- - user: identity_account:bob
82
- relation: viewer
83
- object: workflow_execution:run1b
84
-
85
- # --- inst2: opts into ORG-WIDE run observability (execution_viewer) ---
86
- - user: organization:acme
87
- relation: organization
88
- object: workflow_instance:inst2
89
- - user: identity_account:alice
90
- relation: owner
91
- object: workflow_instance:inst2
92
- - user: organization:acme#viewer
93
- relation: execution_viewer
94
- object: workflow_instance:inst2
95
-
96
- # run2: alice's run on inst2.
97
- - user: organization:acme
98
- relation: organization
99
- object: workflow_execution:run2
100
- - user: workflow_instance:inst2
101
- relation: workflow_instance
102
- object: workflow_execution:run2
103
- - user: identity_account:alice
104
- relation: owner
105
- object: workflow_execution:run2
106
-
107
- tests:
108
- - name: triggerer always sees and can manage sharing of their own run
109
- check:
110
- - user: identity_account:alice
111
- object: workflow_execution:run1
112
- assertions:
113
- can_view: true
114
- can_grant_access: true
115
- can_view_access: true
116
-
117
- - name: org-runnable instance does NOT leak run history to teammates
118
- check:
119
- # bob and carol can see/run inst1, but cannot read alice's run1.
120
- - user: identity_account:bob
121
- object: workflow_execution:run1
122
- assertions:
123
- can_view: false
124
- can_view_access: false
125
- - user: identity_account:carol
126
- object: workflow_execution:run1
127
- assertions:
128
- can_view: false
129
-
130
- - name: per-execution share grants exactly the named teammate
131
- check:
132
- - user: identity_account:bob
133
- object: workflow_execution:run1b
134
- assertions:
135
- can_view: true
136
- can_view_access: true
137
- # A viewer cannot re-share (only the owner can grant).
138
- - user: identity_account:bob
139
- object: workflow_execution:run1b
140
- assertions:
141
- can_grant_access: false
142
- # Another org member not on the grant sees nothing.
143
- - user: identity_account:carol
144
- object: workflow_execution:run1b
145
- assertions:
146
- can_view: false
147
-
148
- - name: instance execution_viewer opt-in shares all runs org-wide
149
- check:
150
- - user: identity_account:bob
151
- object: workflow_execution:run2
152
- assertions:
153
- can_view: true
154
- - user: identity_account:carol
155
- object: workflow_execution:run2
156
- assertions:
157
- can_view: true
158
- # cloud#257: run observability is a pure read grant, so the org's
159
- # read-only viewers are exactly its audience.
160
- - user: identity_account:vera
161
- object: workflow_execution:run2
162
- assertions:
163
- can_view: true
164
- # Outsiders never gain access through org-scoped observability.
165
- - user: identity_account:mallory
166
- object: workflow_execution:run2
167
- assertions:
168
- can_view: false
169
-
170
- - name: run privacy holds against org viewers exactly as against members
171
- check:
172
- # No execution_viewer opt-in on inst1 → vera reads the instance but
173
- # never alice's run history.
174
- - user: identity_account:vera
175
- object: workflow_instance:inst1
176
- assertions:
177
- can_view: true
178
- - user: identity_account:vera
179
- object: workflow_execution:run1
180
- assertions:
181
- can_view: false
182
-
183
- - name: list a teammate's viewable runs reflects both sharing axes
184
- list_objects:
185
- - user: identity_account:bob
186
- type: workflow_execution
187
- assertions:
188
- can_view:
189
- - workflow_execution:run1b
190
- - workflow_execution:run2
@@ -1,64 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/agent.fga — a blueprint: owned by its
3
- * creator and by the organization's admins (`admin from organization`),
4
- * read by whoever the visibility axis lets in. The `organization#member`
5
- * and `organization#viewer` usersets on `viewer` are the org-visibility
6
- * tuple's two shapes (the cloud writes `#viewer` since cloud#257; `#member`
7
- * is the legacy shape it still honours), and `platform_viewer` is an
8
- * identity-provider userset no open-source tuple ever names. `team#member`
9
- * is the Enterprise team grant; open source serves no team, so no tuple
10
- * here ever names one.
11
- */
12
- import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
13
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
14
-
15
- import {
16
- computed,
17
- declareKind,
18
- direct,
19
- from,
20
- objectOf,
21
- union,
22
- usersetOf,
23
- } from "./rewrite.js";
24
-
25
- export const agentDeclaration = declareKind({
26
- kind: ApiResourceKind.agent,
27
- schema: AgentSchema,
28
- source: "fga/model/agentic/agent.fga",
29
- relations: [
30
- ["organization", direct(objectOf("organization"))],
31
- [
32
- "owner",
33
- union(
34
- direct(objectOf("identity_account")),
35
- from("admin", "organization"),
36
- ),
37
- ],
38
- [
39
- "platform_viewer",
40
- direct(usersetOf("identity_provider", "platform_user")),
41
- ],
42
- [
43
- "viewer",
44
- union(
45
- direct(
46
- objectOf("identity_account"),
47
- usersetOf("organization", "member"),
48
- usersetOf("organization", "viewer"),
49
- usersetOf("team", "member"),
50
- ),
51
- computed("owner"),
52
- computed("platform_viewer"),
53
- ),
54
- ],
55
- ["can_view", computed("viewer")],
56
- ["can_edit", computed("owner")],
57
- ["can_delete", computed("owner")],
58
- ["can_execute", computed("viewer")],
59
- ["can_create_instance", computed("can_execute")],
60
- ["can_clone", computed("viewer")],
61
- ["can_grant_access", computed("owner")],
62
- ["can_view_access", computed("viewer")],
63
- ],
64
- });
@@ -1,57 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/agent_channel.fga — a channel binding,
3
- * admin-owned like a blueprint, with `participant` as the one relation
4
- * between owner and viewer: the conversation-participation role
5
- * (reply and takeover without configuration authority), grantable as a
6
- * role on this kind alone. Every owner participates; every participant
7
- * views. Both grantable relations may name an Enterprise team
8
- * (`team#member`), which no open-source tuple ever does.
9
- */
10
- import { AgentChannelSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/api_pb";
11
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
12
-
13
- import {
14
- computed,
15
- declareKind,
16
- direct,
17
- from,
18
- objectOf,
19
- union,
20
- usersetOf,
21
- } from "./rewrite.js";
22
-
23
- export const agentChannelDeclaration = declareKind({
24
- kind: ApiResourceKind.agent_channel,
25
- schema: AgentChannelSchema,
26
- source: "fga/model/agentic/agent_channel.fga",
27
- relations: [
28
- ["organization", direct(objectOf("organization"))],
29
- [
30
- "owner",
31
- union(
32
- direct(objectOf("identity_account")),
33
- from("admin", "organization"),
34
- ),
35
- ],
36
- [
37
- "participant",
38
- union(
39
- direct(objectOf("identity_account"), usersetOf("team", "member")),
40
- computed("owner"),
41
- ),
42
- ],
43
- [
44
- "viewer",
45
- union(
46
- direct(objectOf("identity_account"), usersetOf("team", "member")),
47
- computed("participant"),
48
- ),
49
- ],
50
- ["can_view", computed("viewer")],
51
- ["can_edit", computed("owner")],
52
- ["can_delete", computed("owner")],
53
- ["can_participate", computed("participant")],
54
- ["can_grant_access", computed("owner")],
55
- ["can_view_access", computed("viewer")],
56
- ],
57
- });
@@ -1,33 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/agent_execution.fga — a run is its
3
- * session's: no owner tuple of its own (`kind_meta` attribution
4
- * INHERITED), every relation a hop through `session`, which the
5
- * derivation writes from `spec.session_id`. `can_view: viewer or
6
- * can_view from session` walks a parent PERMISSION whose own arms include
7
- * the session's channel and schedule hops; the evaluator resolves those
8
- * on the session's declaration, so this file needs no knowledge of them.
9
- */
10
- import { AgentExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
11
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
12
-
13
- import {
14
- computed,
15
- declareKind,
16
- direct,
17
- from,
18
- objectOf,
19
- union,
20
- } from "./rewrite.js";
21
-
22
- export const agentExecutionDeclaration = declareKind({
23
- kind: ApiResourceKind.agent_execution,
24
- schema: AgentExecutionSchema,
25
- source: "fga/model/agentic/agent_execution.fga",
26
- relations: [
27
- ["session", direct(objectOf("session"))],
28
- ["owner", from("owner", "session")],
29
- ["viewer", union(from("viewer", "session"), computed("owner"))],
30
- ["can_view", union(computed("viewer"), from("can_view", "session"))],
31
- ["can_edit", computed("owner")],
32
- ],
33
- });
@@ -1,66 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/agent_instance.fga — a person's
3
- * configuration of an agent: owner-only in every write (no admin arm,
4
- * unlike the blueprint), readable through its own visibility axis or, for
5
- * the system-managed default instance, through the blueprint's whole
6
- * viewer set (`viewer from default_of`; default-of.ts). `agent` is the
7
- * parent link written on every instance for tracking and walked by
8
- * nothing; `default_of` is the derived link written on the default
9
- * instance alone. `team#member` on `viewer` is the Enterprise team grant,
10
- * which no open-source tuple ever names.
11
- */
12
- import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
13
- import { AgentInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
14
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
15
-
16
- import { defaultOfBlueprint } from "./default-of.js";
17
- import {
18
- computed,
19
- declareKind,
20
- direct,
21
- from,
22
- objectOf,
23
- union,
24
- usersetOf,
25
- } from "./rewrite.js";
26
-
27
- export const agentInstanceDeclaration = declareKind({
28
- kind: ApiResourceKind.agent_instance,
29
- schema: AgentInstanceSchema,
30
- source: "fga/model/agentic/agent_instance.fga",
31
- relations: [
32
- ["organization", direct(objectOf("organization"))],
33
- ["agent", direct(objectOf("agent"))],
34
- ["default_of", direct(objectOf("agent"))],
35
- ["owner", direct(objectOf("identity_account"))],
36
- [
37
- "viewer",
38
- union(
39
- direct(
40
- objectOf("identity_account"),
41
- usersetOf("organization", "member"),
42
- usersetOf("organization", "viewer"),
43
- usersetOf("team", "member"),
44
- ),
45
- computed("owner"),
46
- from("viewer", "default_of"),
47
- ),
48
- ],
49
- ["can_view", computed("viewer")],
50
- ["can_execute", computed("can_view")],
51
- ["can_edit", computed("owner")],
52
- ["can_delete", computed("owner")],
53
- ["can_grant_access", computed("owner")],
54
- ["can_view_access", computed("viewer")],
55
- ],
56
- derived: [
57
- [
58
- "default_of",
59
- defaultOfBlueprint({
60
- kind: ApiResourceKind.agent,
61
- schema: AgentSchema,
62
- defaultInstanceIdOf: (agent) => agent.status?.defaultInstanceId ?? "",
63
- }),
64
- ],
65
- ],
66
- });
@@ -1,40 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/agent_share.fga — a share link's
3
- * configuration row, admin-owned; its anonymous visitors are the cloud's
4
- * `guest` credential on the organization, a class no open-source lane
5
- * mints, so on this edition a share is visible to its owners and explicit
6
- * grantees only.
7
- */
8
- import { AgentShareSchema } from "@stigmer/protos/ai/stigmer/agentic/agentshare/v1/api_pb";
9
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
10
-
11
- import {
12
- computed,
13
- declareKind,
14
- direct,
15
- from,
16
- objectOf,
17
- union,
18
- } from "./rewrite.js";
19
-
20
- export const agentShareDeclaration = declareKind({
21
- kind: ApiResourceKind.agent_share,
22
- schema: AgentShareSchema,
23
- source: "fga/model/agentic/agent_share.fga",
24
- relations: [
25
- ["organization", direct(objectOf("organization"))],
26
- [
27
- "owner",
28
- union(
29
- direct(objectOf("identity_account")),
30
- from("admin", "organization"),
31
- ),
32
- ],
33
- ["viewer", union(direct(objectOf("identity_account")), computed("owner"))],
34
- ["can_view", computed("viewer")],
35
- ["can_edit", computed("owner")],
36
- ["can_delete", computed("owner")],
37
- ["can_grant_access", computed("owner")],
38
- ["can_view_access", computed("viewer")],
39
- ],
40
- });
@@ -1,28 +0,0 @@
1
- /**
2
- * Transcript of fga/model/iam/api_key.fga — a credential, owner-only in
3
- * every verb: no organization link (`kind_meta` scope OWNER_ONLY) and no
4
- * admin arm, so the key a person minted is theirs to view, rotate, revoke
5
- * and use, and nobody else's. `can_rotate`, `can_revoke` and `can_use` are
6
- * the file's own verbs; the wire vocabulary names only the first three.
7
- */
8
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
9
- import { ApiKeySchema } from "@stigmer/protos/ai/stigmer/iam/apikey/v1/api_pb";
10
-
11
- import { computed, declareKind, direct, objectOf } from "./rewrite.js";
12
-
13
- export const apiKeyDeclaration = declareKind({
14
- kind: ApiResourceKind.api_key,
15
- schema: ApiKeySchema,
16
- source: "fga/model/iam/api_key.fga",
17
- relations: [
18
- ["owner", direct(objectOf("identity_account"))],
19
- ["can_view", computed("owner")],
20
- ["can_edit", computed("owner")],
21
- ["can_delete", computed("owner")],
22
- ["can_rotate", computed("owner")],
23
- ["can_revoke", computed("owner")],
24
- ["can_use", computed("owner")],
25
- ["can_grant_access", computed("owner")],
26
- ["can_view_access", computed("owner")],
27
- ],
28
- });
@@ -1,38 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/artifact.fga — an organization's shared
3
- * output: read by its creator and by every organization viewer (`viewer
4
- * from organization`, no visibility tuple involved — the kind has no
5
- * visibility axis), edited by the organization's admins alone (the
6
- * creator does NOT edit through `owner`), and with no `can_delete` line
7
- * at all. The wire annotates only `can_view` and `can_edit` on it.
8
- */
9
- import { ArtifactSchema } from "@stigmer/protos/ai/stigmer/agentic/artifact/v1/api_pb";
10
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
11
-
12
- import {
13
- computed,
14
- declareKind,
15
- direct,
16
- from,
17
- objectOf,
18
- union,
19
- } from "./rewrite.js";
20
-
21
- export const artifactDeclaration = declareKind({
22
- kind: ApiResourceKind.artifact,
23
- schema: ArtifactSchema,
24
- source: "fga/model/agentic/artifact.fga",
25
- relations: [
26
- ["organization", direct(objectOf("organization"))],
27
- ["owner", direct(objectOf("identity_account"))],
28
- [
29
- "viewer",
30
- union(
31
- direct(objectOf("identity_account")),
32
- from("viewer", "organization"),
33
- ),
34
- ],
35
- ["can_view", union(computed("owner"), computed("viewer"))],
36
- ["can_edit", from("admin", "organization")],
37
- ],
38
- });
@@ -1,39 +0,0 @@
1
- /**
2
- * Transcript of fga/model/agentic/channel_app.fga — a messaging-platform
3
- * app registration, admin-owned, viewable by its owners and explicit
4
- * grantees: the same shape as agent_share, kept as its own file so the
5
- * drift compare reads this file's lines.
6
- */
7
- import { ChannelAppSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/api_pb";
8
- import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
9
-
10
- import {
11
- computed,
12
- declareKind,
13
- direct,
14
- from,
15
- objectOf,
16
- union,
17
- } from "./rewrite.js";
18
-
19
- export const channelAppDeclaration = declareKind({
20
- kind: ApiResourceKind.channel_app,
21
- schema: ChannelAppSchema,
22
- source: "fga/model/agentic/channel_app.fga",
23
- relations: [
24
- ["organization", direct(objectOf("organization"))],
25
- [
26
- "owner",
27
- union(
28
- direct(objectOf("identity_account")),
29
- from("admin", "organization"),
30
- ),
31
- ],
32
- ["viewer", union(direct(objectOf("identity_account")), computed("owner"))],
33
- ["can_view", computed("viewer")],
34
- ["can_edit", computed("owner")],
35
- ["can_delete", computed("owner")],
36
- ["can_grant_access", computed("owner")],
37
- ["can_view_access", computed("viewer")],
38
- ],
39
- });