@xemahq/contracts 0.60.0 → 0.61.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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "algorithm": "sha256/len-framed-v1",
3
- "hash": "b56c26a60c38e5104d2a6ac074005d040784b47a21b30760853680b264ee753d",
3
+ "hash": "86876ed052a59bcb643685a3c0afc5a762b2abe9bc2f1fa786d28958a9f4f791",
4
4
  "fileCount": 589
5
5
  }
@@ -91,12 +91,16 @@ type project
91
91
  # descendants inside the delegation's scope. An org-owned session writes
92
92
  # `owner` (organization) and `anchor`, and no `parent` and no `participant`.
93
93
  #
94
- # `can_act` is ACTING INSIDE the session (posting a turn, interrupting it,
95
- # changing its threads), which is narrower than `xema_write` (managing it):
96
- # a turn runs with the session's authority, so only its owner and the editors
97
- # the owner invited may act. It derives NOTHING from `parent`: a project
98
- # editor or an org admin holds `xema_write` on a colleague's session and still
99
- # may not act in it. An `editor` is also a reader.
94
+ # `can_act` is the human turn/interrupt permission (editor/owner). Human
95
+ # session relations never confer workload execution authority; that requires
96
+ # the session's verified launch delegation. It derives NOTHING from `parent`.
97
+ #
98
+ # Managing the session (`xema_write` / `xema_admin`) is the OWNER ONLY and
99
+ # derives NOTHING from `parent`: a parent reader, a parent writer or an org
100
+ # admin only READS the session (`xema_read from parent`); they neither act in
101
+ # it nor manage it. A future admin "close a member's session" door needs an
102
+ # explicit governance capability; inherited manage does not exist.
103
+ # An `editor` is also a reader.
100
104
  type xema_session
101
105
  relations
102
106
  define parent: [org, project, ${XEMA_PARENT_TYPES}]
@@ -104,8 +108,8 @@ type xema_session
104
108
  define owner: [user, agent, organization]
105
109
  define participant: [user, agent]
106
110
  define editor: [user, agent]
107
- define xema_admin: owner or xema_admin from parent
108
- define xema_write: owner or xema_write from parent
111
+ define xema_admin: owner
112
+ define xema_write: owner
109
113
  define xema_read: owner or participant or editor or xema_read from parent
110
114
  define can_read: xema_read
111
115
  define can_write: xema_write
@@ -158,7 +158,7 @@ tests:
158
158
  can_read: false
159
159
  # A user-owned session in project p1: olga owns it, ed is an invited editor,
160
160
  # erin an invited (read-only) participant.
161
- - name: only a session's owner and its invited editors may act in it; parent write never confers acting
161
+ - name: only a session's owner and its invited editors may act in it; parent read is read-only, parent write and org admin never act or manage
162
162
  tuples:
163
163
  - user: project:org1|p1
164
164
  relation: parent
@@ -178,12 +178,17 @@ tests:
178
178
  assertions:
179
179
  can_act: true
180
180
  can_read: true
181
+ can_write: true
182
+ xema_write: true
183
+ xema_admin: true
181
184
  - user: user:ed
182
185
  object: xema_session:org1|s5
183
186
  assertions:
184
187
  can_act: true
185
188
  can_read: true
186
189
  can_write: false
190
+ xema_write: false
191
+ xema_admin: false
187
192
  - user: user:erin
188
193
  object: xema_session:org1|s5
189
194
  assertions:
@@ -195,18 +200,27 @@ tests:
195
200
  assertions:
196
201
  can_act: false
197
202
  can_read: true
198
- # project editor: manages through the parent, may not act
203
+ can_write: false
204
+ xema_write: false
205
+ xema_admin: false
206
+ # project editor: reads through the parent, neither acts nor manages
199
207
  - user: user:pat
200
208
  object: xema_session:org1|s5
201
209
  assertions:
210
+ can_read: true
202
211
  can_act: false
203
- can_write: true
204
- # org admin: manages through the parent, may not act
212
+ can_write: false
213
+ xema_write: false
214
+ xema_admin: false
215
+ # org admin: reads through the parent, neither acts nor manages
205
216
  - user: user:root
206
217
  object: xema_session:org1|s5
207
218
  assertions:
219
+ can_read: true
208
220
  can_act: false
209
- can_write: true
221
+ can_write: false
222
+ xema_write: false
223
+ xema_admin: false
210
224
  - user: user:dave
211
225
  object: xema_session:org1|s5
212
226
  assertions:
@@ -215,6 +229,45 @@ tests:
215
229
  object: xema_session:org1|s2
216
230
  assertions:
217
231
  can_act: false
232
+ # A session with `reference` and no parent tuple: the parent chain grants
233
+ # nothing, so a project reader, a project editor and the org admin get
234
+ # nothing at all.
235
+ - name: a session without a parent tuple grants parent readers, parent writers and org admins nothing
236
+ tuples:
237
+ - user: user:olga
238
+ relation: owner
239
+ object: xema_session:org1|s6
240
+ check:
241
+ - user: user:bob
242
+ object: xema_session:org1|s6
243
+ assertions:
244
+ can_read: false
245
+ can_act: false
246
+ can_write: false
247
+ xema_write: false
248
+ xema_admin: false
249
+ - user: user:pat
250
+ object: xema_session:org1|s6
251
+ assertions:
252
+ can_read: false
253
+ can_act: false
254
+ can_write: false
255
+ xema_write: false
256
+ xema_admin: false
257
+ - user: user:root
258
+ object: xema_session:org1|s6
259
+ assertions:
260
+ can_read: false
261
+ can_act: false
262
+ can_write: false
263
+ xema_write: false
264
+ xema_admin: false
265
+ - user: user:olga
266
+ object: xema_session:org1|s6
267
+ assertions:
268
+ can_read: true
269
+ can_act: true
270
+ can_write: true
218
271
  # ── Durable delegation: may_delegate_for defaults ──────────────────────
219
272
  # `user#is_self` is NEVER stored: the PDP supplies it per decision as a
220
273
  # CONTEXTUAL tuple for the asking principal (`buildSelfContextualTuples`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/contracts",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework deps; the one runtime dependency beside zod is the OpenFGA syntax transformer the authorization-module composer runs.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",