@xnetjs/data 1.0.0 → 2.1.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,3 +1,6 @@
1
+ import {
2
+ createNodeQueryDescriptor
3
+ } from "./chunk-S5RP5RKY.js";
1
4
  import {
2
5
  extKey
3
6
  } from "./chunk-PMUQACPY.js";
@@ -26,9 +29,6 @@ import {
26
29
  import {
27
30
  DatabaseViewSchema
28
31
  } from "./chunk-TRPXLCND.js";
29
- import {
30
- createNodeQueryDescriptor
31
- } from "./chunk-S5RP5RKY.js";
32
32
 
33
33
  // src/database/cell-types.ts
34
34
  var CELL_PREFIX = "cell_";
@@ -264,6 +264,30 @@ function getRichTextPlainText(doc, columnId) {
264
264
  const fragment = doc.getXmlFragment(`${RICHTEXT_PREFIX}${columnId}`);
265
265
  return extractPlainText(fragment);
266
266
  }
267
+ var BLOCK_ELEMENT_NAMES = /* @__PURE__ */ new Set([
268
+ // HTML-ish / legacy names
269
+ "p",
270
+ "h1",
271
+ "h2",
272
+ "h3",
273
+ "h4",
274
+ "h5",
275
+ "h6",
276
+ "li",
277
+ "blockquote",
278
+ // TipTap / BlockNote shared names
279
+ "paragraph",
280
+ "heading",
281
+ "codeBlock",
282
+ "listItem",
283
+ "taskItem",
284
+ // BlockNote (v4) block-content names
285
+ "bulletListItem",
286
+ "numberedListItem",
287
+ "checkListItem",
288
+ "toggleListItem",
289
+ "quote"
290
+ ]);
267
291
  function extractPlainText(fragment) {
268
292
  const parts = [];
269
293
  for (let i = 0; i < fragment.length; i++) {
@@ -276,7 +300,33 @@ function extractPlainText(fragment) {
276
300
  }
277
301
  return parts.join("");
278
302
  }
303
+ function inlineAtomText(element) {
304
+ const attr = (key) => {
305
+ const value = element.getAttribute(key);
306
+ return typeof value === "string" ? value : "";
307
+ };
308
+ switch (element.nodeName) {
309
+ case "mention": {
310
+ const label = attr("label") || attr("id");
311
+ return label ? `@${label}` : "";
312
+ }
313
+ case "hashtag": {
314
+ const name = attr("name");
315
+ return name ? `#${name}` : "";
316
+ }
317
+ case "wikilink":
318
+ return element.length === 0 ? attr("title") : null;
319
+ case "inlineMath":
320
+ return attr("latex");
321
+ default:
322
+ return null;
323
+ }
324
+ }
279
325
  function extractPlainTextFromElement(element) {
326
+ const atomText = inlineAtomText(element);
327
+ if (atomText !== null) {
328
+ return atomText;
329
+ }
280
330
  const parts = [];
281
331
  for (let i = 0; i < element.length; i++) {
282
332
  const item = element.get(i);
@@ -286,8 +336,7 @@ function extractPlainTextFromElement(element) {
286
336
  parts.push(extractPlainTextFromElement(item));
287
337
  }
288
338
  }
289
- const blockElements = ["p", "h1", "h2", "h3", "h4", "h5", "h6", "li", "blockquote"];
290
- if (blockElements.includes(element.nodeName)) {
339
+ if (BLOCK_ELEMENT_NAMES.has(element.nodeName)) {
291
340
  parts.push("\n");
292
341
  }
293
342
  return parts.join("");
@@ -0,0 +1,240 @@
1
+ import {
2
+ spaceCascadeAuthorization
3
+ } from "./chunk-JA56EQJO.js";
4
+ import {
5
+ created,
6
+ createdBy,
7
+ date,
8
+ defineSchema,
9
+ json,
10
+ number,
11
+ relation,
12
+ select,
13
+ text
14
+ } from "./chunk-RRXJNZX5.js";
15
+
16
+ // src/schema/schemas/agent.ts
17
+ var AGENT_PASSPORT_SCHEMA_IRI = "xnet://xnet.fyi/AgentPassport@1.0.0";
18
+ var AGENT_SESSION_SCHEMA_IRI = "xnet://xnet.fyi/AgentSession@1.0.0";
19
+ var AGENT_ACTION_SCHEMA_IRI = "xnet://xnet.fyi/AgentAction@1.0.0";
20
+ var AGENT_APPROVAL_SCHEMA_IRI = "xnet://xnet.fyi/AgentApproval@1.0.0";
21
+ var AGENT_NOTIFICATION_SCHEMA_IRI = "xnet://xnet.fyi/AgentNotification@1.0.0";
22
+ var AGENT_RUNTIMES = [
23
+ { id: "openclaw", name: "OpenClaw", color: "orange" },
24
+ { id: "hermes", name: "Hermes", color: "purple" },
25
+ { id: "claude-code", name: "Claude Code", color: "blue" },
26
+ { id: "other", name: "Other", color: "gray" }
27
+ ];
28
+ var passportStatuses = [
29
+ { id: "active", name: "Active", color: "green" },
30
+ { id: "revoked", name: "Revoked", color: "red" },
31
+ { id: "expired", name: "Expired", color: "gray" }
32
+ ];
33
+ var AgentPassportSchema = defineSchema({
34
+ name: "AgentPassport",
35
+ namespace: "xnet://xnet.fyi/",
36
+ properties: {
37
+ /** Home Space for the operator's agent-audit workspace — drives access. */
38
+ space: relation({}),
39
+ /** The agent's own did:key. Every change it makes is signed by this DID. */
40
+ agentDID: text({ required: true, maxLength: 256 }),
41
+ /** The operator DID that delegated authority to the agent. */
42
+ operatorDID: text({ required: true, maxLength: 256 }),
43
+ displayName: text({ maxLength: 120 }),
44
+ runtime: select({ options: AGENT_RUNTIMES, required: true, default: "other" }),
45
+ /** The operator-signed, attenuated UCAN delegated to `agentDID`. */
46
+ ucan: text({ required: true, maxLength: 8192 }),
47
+ /** Delegation expiry (epoch ms). Rotation is the near-term revocation. */
48
+ expiresAt: date({}),
49
+ status: select({ options: passportStatuses, required: true, default: "active" }),
50
+ createdAt: created(),
51
+ createdBy: createdBy()
52
+ },
53
+ document: void 0,
54
+ authorization: spaceCascadeAuthorization("space")
55
+ });
56
+ var AGENT_CHANNELS = [
57
+ { id: "whatsapp", name: "WhatsApp", color: "green" },
58
+ { id: "telegram", name: "Telegram", color: "blue" },
59
+ { id: "signal", name: "Signal", color: "blue" },
60
+ { id: "imessage", name: "iMessage", color: "green" },
61
+ { id: "discord", name: "Discord", color: "purple" },
62
+ { id: "slack", name: "Slack", color: "purple" },
63
+ { id: "app", name: "xNet app", color: "orange" },
64
+ { id: "cli", name: "CLI", color: "gray" },
65
+ { id: "other", name: "Other", color: "gray" }
66
+ ];
67
+ var AgentSessionSchema = defineSchema({
68
+ name: "AgentSession",
69
+ namespace: "xnet://xnet.fyi/",
70
+ properties: {
71
+ space: relation({}),
72
+ /** AgentPassport node id. */
73
+ passport: relation({}),
74
+ channel: select({ options: AGENT_CHANNELS, required: true, default: "other" }),
75
+ /** Channel-specific peer id (chat/thread id) — forensics for approvals. */
76
+ peer: text({ maxLength: 256 }),
77
+ startedAt: date({}),
78
+ lastActiveAt: date({}),
79
+ createdAt: created(),
80
+ createdBy: createdBy()
81
+ },
82
+ document: void 0,
83
+ authorization: spaceCascadeAuthorization("space")
84
+ });
85
+ var AGENT_RISKS = [
86
+ { id: "low", name: "Low", color: "green" },
87
+ { id: "medium", name: "Medium", color: "yellow" },
88
+ { id: "high", name: "High", color: "orange" },
89
+ { id: "critical", name: "Critical", color: "red" }
90
+ ];
91
+ var AGENT_ACTION_STATUSES = [
92
+ { id: "proposed", name: "Proposed", color: "gray" },
93
+ { id: "pending-approval", name: "Pending approval", color: "yellow" },
94
+ { id: "approved", name: "Approved", color: "blue" },
95
+ { id: "denied", name: "Denied", color: "red" },
96
+ { id: "applied", name: "Applied", color: "green" },
97
+ { id: "rolled-back", name: "Rolled back", color: "purple" },
98
+ { id: "failed", name: "Failed", color: "red" }
99
+ ];
100
+ var AGENT_REVERSIBILITIES = [
101
+ { id: "reversible", name: "Reversible", color: "green" },
102
+ { id: "compensatable", name: "Compensatable", color: "yellow" },
103
+ { id: "irreversible", name: "Irreversible", color: "red" }
104
+ ];
105
+ var AgentActionSchema = defineSchema({
106
+ name: "AgentAction",
107
+ namespace: "xnet://xnet.fyi/",
108
+ properties: {
109
+ space: relation({}),
110
+ /** AgentSession node id (deterministic; see `agentSessionId`). */
111
+ session: text({ required: true, maxLength: 256 }),
112
+ /** Monotonic sequence within the session — part of the deterministic id. */
113
+ seq: number({ integer: true }),
114
+ /** Tool name, e.g. `xnet_apply_page_markdown`. */
115
+ tool: text({ required: true, maxLength: 120 }),
116
+ /**
117
+ * The operator's instruction, verbatim. Sensitive — keep the audit Space
118
+ * tightly scoped, or store a redaction (see `redactInstruction`).
119
+ */
120
+ instruction: text({ maxLength: 4e3 }),
121
+ risk: select({ options: AGENT_RISKS, required: true, default: "low" }),
122
+ status: select({ options: AGENT_ACTION_STATUSES, required: true, default: "proposed" }),
123
+ reversibility: select({
124
+ options: AGENT_REVERSIBILITIES,
125
+ required: true,
126
+ default: "compensatable"
127
+ }),
128
+ /** Kernel change ids this action produced (links semantic → signed log). */
129
+ changeIds: json({}),
130
+ /** Error message when `status` is `failed`. */
131
+ error: text({ maxLength: 2e3 }),
132
+ /** Pending-approval expiry (epoch ms) — the ceremony TTL. */
133
+ approvalExpiresAt: date({}),
134
+ createdAt: created(),
135
+ createdBy: createdBy()
136
+ },
137
+ document: void 0,
138
+ authorization: spaceCascadeAuthorization("space")
139
+ });
140
+ var AGENT_APPROVAL_SURFACES = [
141
+ // Relayed by the agent itself — forgeable by a compromised gateway, so
142
+ // chat-surface approvals are capped at medium risk by the ceremony.
143
+ { id: "chat", name: "Chat", color: "yellow" },
144
+ // Confirmed in an xNet surface and signed by the operator's own DID.
145
+ { id: "app", name: "xNet app", color: "green" },
146
+ { id: "push", name: "Push", color: "green" }
147
+ ];
148
+ var AGENT_APPROVAL_DECISIONS = [
149
+ { id: "approved", name: "Approved", color: "green" },
150
+ { id: "denied", name: "Denied", color: "red" },
151
+ { id: "expired", name: "Expired", color: "gray" }
152
+ ];
153
+ var AgentApprovalSchema = defineSchema({
154
+ name: "AgentApproval",
155
+ namespace: "xnet://xnet.fyi/",
156
+ properties: {
157
+ space: relation({}),
158
+ /** AgentAction node id this decision gates. */
159
+ action: text({ required: true, maxLength: 256 }),
160
+ surface: select({ options: AGENT_APPROVAL_SURFACES, required: true, default: "chat" }),
161
+ decision: select({ options: AGENT_APPROVAL_DECISIONS, required: true, default: "expired" }),
162
+ /**
163
+ * DID that made the decision. For `surface: 'app'`/`'push'` this is the
164
+ * operator (the node is signed by their key — unforgeable by the agent).
165
+ */
166
+ approverDID: text({ maxLength: 256 }),
167
+ /** SHA-256 hex of the nonce — never the nonce itself. */
168
+ nonceHash: text({ maxLength: 64 }),
169
+ /** Channel peer that replied, for `surface: 'chat'` forensics. */
170
+ peer: text({ maxLength: 256 }),
171
+ decidedAt: date({}),
172
+ createdAt: created(),
173
+ createdBy: createdBy()
174
+ },
175
+ document: void 0,
176
+ authorization: spaceCascadeAuthorization("space")
177
+ });
178
+ var AGENT_NOTIFICATION_KINDS = [
179
+ { id: "info", name: "Info", color: "blue" },
180
+ { id: "approval-request", name: "Approval request", color: "yellow" },
181
+ { id: "alert", name: "Alert", color: "red" },
182
+ { id: "report", name: "Report", color: "green" }
183
+ ];
184
+ var AGENT_NOTIFICATION_STATUSES = [
185
+ { id: "pending", name: "Pending", color: "yellow" },
186
+ { id: "delivered", name: "Delivered", color: "green" },
187
+ { id: "dismissed", name: "Dismissed", color: "gray" }
188
+ ];
189
+ var AgentNotificationSchema = defineSchema({
190
+ name: "AgentNotification",
191
+ namespace: "xnet://xnet.fyi/",
192
+ properties: {
193
+ space: relation({}),
194
+ kind: select({ options: AGENT_NOTIFICATION_KINDS, required: true, default: "info" }),
195
+ title: text({ required: true, maxLength: 200 }),
196
+ body: text({ maxLength: 4e3 }),
197
+ /** Related AgentAction node id, when the notification concerns one. */
198
+ action: text({ maxLength: 256 }),
199
+ status: select({ options: AGENT_NOTIFICATION_STATUSES, required: true, default: "pending" }),
200
+ createdAt: created(),
201
+ createdBy: createdBy()
202
+ },
203
+ document: void 0,
204
+ authorization: spaceCascadeAuthorization("space")
205
+ });
206
+ var sanitizeIdPart = (value) => value.replace(/[^a-zA-Z0-9:_-]/g, "_");
207
+ var agentPassportId = (agentDID) => `agent-passport:${sanitizeIdPart(agentDID)}`;
208
+ var agentSessionId = (agentDID, sessionKey) => `agent-session:${sanitizeIdPart(agentDID)}:${sanitizeIdPart(sessionKey)}`;
209
+ var agentActionId = (sessionId, seq) => `agent-action:${sanitizeIdPart(sessionId)}:${seq}`;
210
+ var agentApprovalId = (actionId) => `agent-approval:${sanitizeIdPart(actionId)}`;
211
+ var agentNotificationId = (key) => `agent-notification:${sanitizeIdPart(key)}`;
212
+ var redactInstruction = (instruction, digestHex) => `[redacted ${instruction.length} chars sha256:${digestHex.slice(0, 16)}]`;
213
+
214
+ export {
215
+ AGENT_PASSPORT_SCHEMA_IRI,
216
+ AGENT_SESSION_SCHEMA_IRI,
217
+ AGENT_ACTION_SCHEMA_IRI,
218
+ AGENT_APPROVAL_SCHEMA_IRI,
219
+ AGENT_NOTIFICATION_SCHEMA_IRI,
220
+ AGENT_RUNTIMES,
221
+ AgentPassportSchema,
222
+ AGENT_CHANNELS,
223
+ AgentSessionSchema,
224
+ AGENT_RISKS,
225
+ AGENT_ACTION_STATUSES,
226
+ AGENT_REVERSIBILITIES,
227
+ AgentActionSchema,
228
+ AGENT_APPROVAL_SURFACES,
229
+ AGENT_APPROVAL_DECISIONS,
230
+ AgentApprovalSchema,
231
+ AGENT_NOTIFICATION_KINDS,
232
+ AGENT_NOTIFICATION_STATUSES,
233
+ AgentNotificationSchema,
234
+ agentPassportId,
235
+ agentSessionId,
236
+ agentActionId,
237
+ agentApprovalId,
238
+ agentNotificationId,
239
+ redactInstruction
240
+ };
@@ -8,12 +8,6 @@ import {
8
8
  revocationRecordId,
9
9
  revokedSubjects
10
10
  } from "./chunk-4KJ4NAMC.js";
11
- import {
12
- PresenceSummarySchema,
13
- SchemaDefinitionSchema,
14
- buildSystemNodeId,
15
- validateSchemaDefinitionNode
16
- } from "./chunk-XJBDESCX.js";
17
11
  import {
18
12
  extKey
19
13
  } from "./chunk-PMUQACPY.js";
@@ -21,6 +15,12 @@ import {
21
15
  EXTENSION_FIELD_SCHEMA_IRI,
22
16
  SCHEMA_EXTENSION_SCHEMA_IRI
23
17
  } from "./chunk-KTPSQJ5L.js";
18
+ import {
19
+ PresenceSummarySchema,
20
+ SchemaDefinitionSchema,
21
+ buildSystemNodeId,
22
+ validateSchemaDefinitionNode
23
+ } from "./chunk-XJBDESCX.js";
24
24
  import {
25
25
  checkbox,
26
26
  createNodeId,
@@ -397,7 +397,10 @@ var builtInSchemas = {
397
397
  "xnet://xnet.fyi/Canvas@1.0.0": () => import("./canvas-NQBTRNLS.js").then((m) => m.CanvasSchema),
398
398
  "xnet://xnet.fyi/Map@1.0.0": () => import("./map-BZAVGCR6.js").then((m) => m.MapSchema),
399
399
  "xnet://xnet.fyi/Comment@1.0.0": () => import("./comment-IAZJHG6G.js").then((m) => m.CommentSchema),
400
+ "xnet://xnet.fyi/Checkpoint@1.0.0": () => import("./checkpoint-MZHJ7PCZ.js").then((m) => m.CheckpointSchema),
401
+ "xnet://xnet.fyi/Draft@1.0.0": () => import("./draft-KGHITKX2.js").then((m) => m.DraftSchema),
400
402
  "xnet://xnet.fyi/Reaction@1.0.0": () => import("./reaction-KD3G75UH.js").then((m) => m.ReactionSchema),
403
+ "xnet://xnet.fyi/DebugReport@1.0.0": () => import("./debug-report-BTNZAKX3.js").then((m) => m.DebugReportSchema),
401
404
  "xnet://xnet.fyi/Profile@1.0.0": () => import("./profile-USKJ6PN7.js").then((m) => m.ProfileSchema),
402
405
  "xnet://xnet.fyi/Channel@1.0.0": () => import("./channel-474QAZGP.js").then((m) => m.ChannelSchema),
403
406
  "xnet://xnet.fyi/ChatMessage@1.0.0": () => import("./chat-message-LGLCITLE.js").then((m) => m.ChatMessageSchema),
@@ -441,6 +444,12 @@ var builtInSchemas = {
441
444
  "xnet://xnet.fyi/GameAsset@1.0.0": () => import("./game-7WW2JX6O.js").then((m) => m.GameAssetSchema),
442
445
  // Memory schema pack (exploration 0211)
443
446
  "xnet://xnet.fyi/MemoryItem@1.0.0": () => import("./memory-5PD3XCKB.js").then((m) => m.MemoryItemSchema),
447
+ // Agent schema pack (exploration 0337)
448
+ "xnet://xnet.fyi/AgentPassport@1.0.0": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentPassportSchema),
449
+ "xnet://xnet.fyi/AgentSession@1.0.0": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentSessionSchema),
450
+ "xnet://xnet.fyi/AgentAction@1.0.0": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentActionSchema),
451
+ "xnet://xnet.fyi/AgentApproval@1.0.0": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentApprovalSchema),
452
+ "xnet://xnet.fyi/AgentNotification@1.0.0": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentNotificationSchema),
444
453
  // Legacy unversioned IRIs (aliases for the current version)
445
454
  "xnet://xnet.fyi/Page": () => import("./page-UE5NPYEF.js").then((m) => m.PageSchema),
446
455
  "xnet://xnet.fyi/Folder": () => import("./folder-NU5TJFOT.js").then((m) => m.FolderSchema),
@@ -485,6 +494,7 @@ var builtInSchemas = {
485
494
  "xnet://xnet.fyi/Map": () => import("./map-BZAVGCR6.js").then((m) => m.MapSchema),
486
495
  "xnet://xnet.fyi/Comment": () => import("./comment-IAZJHG6G.js").then((m) => m.CommentSchema),
487
496
  "xnet://xnet.fyi/Reaction": () => import("./reaction-KD3G75UH.js").then((m) => m.ReactionSchema),
497
+ "xnet://xnet.fyi/DebugReport": () => import("./debug-report-BTNZAKX3.js").then((m) => m.DebugReportSchema),
488
498
  "xnet://xnet.fyi/Profile": () => import("./profile-USKJ6PN7.js").then((m) => m.ProfileSchema),
489
499
  "xnet://xnet.fyi/Channel": () => import("./channel-474QAZGP.js").then((m) => m.ChannelSchema),
490
500
  "xnet://xnet.fyi/ChatMessage": () => import("./chat-message-LGLCITLE.js").then((m) => m.ChatMessageSchema),
@@ -526,7 +536,13 @@ var builtInSchemas = {
526
536
  "xnet://xnet.fyi/GameEconomyEntry": () => import("./game-7WW2JX6O.js").then((m) => m.GameEconomyEntrySchema),
527
537
  "xnet://xnet.fyi/GameAsset": () => import("./game-7WW2JX6O.js").then((m) => m.GameAssetSchema),
528
538
  // Memory schema pack (exploration 0211)
529
- "xnet://xnet.fyi/MemoryItem": () => import("./memory-5PD3XCKB.js").then((m) => m.MemoryItemSchema)
539
+ "xnet://xnet.fyi/MemoryItem": () => import("./memory-5PD3XCKB.js").then((m) => m.MemoryItemSchema),
540
+ // Agent schema pack (exploration 0337)
541
+ "xnet://xnet.fyi/AgentPassport": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentPassportSchema),
542
+ "xnet://xnet.fyi/AgentSession": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentSessionSchema),
543
+ "xnet://xnet.fyi/AgentAction": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentActionSchema),
544
+ "xnet://xnet.fyi/AgentApproval": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentApprovalSchema),
545
+ "xnet://xnet.fyi/AgentNotification": () => import("./agent-OFQJQMNB.js").then((m) => m.AgentNotificationSchema)
530
546
  };
531
547
 
532
548
  // src/schema/effective-schema.ts
@@ -0,0 +1,58 @@
1
+ import {
2
+ checkbox,
3
+ created,
4
+ createdBy,
5
+ defineSchema,
6
+ json,
7
+ relation,
8
+ select,
9
+ text
10
+ } from "./chunk-RRXJNZX5.js";
11
+ import {
12
+ presets
13
+ } from "./chunk-D4LUUZYD.js";
14
+
15
+ // src/schema/schemas/draft.ts
16
+ var DRAFT_SCHEMA_IRI = "xnet://xnet.fyi/Draft@1.0.0";
17
+ var DraftSchema = defineSchema({
18
+ name: "Draft",
19
+ namespace: "xnet://xnet.fyi/",
20
+ properties: {
21
+ /** Upwelling: titles that signal intent prevent conflicts */
22
+ name: text({ required: true, maxLength: 200 }),
23
+ status: select({
24
+ options: [
25
+ { id: "open", name: "Open", color: "blue" },
26
+ { id: "merged", name: "Merged", color: "green" },
27
+ { id: "discarded", name: "Discarded", color: "gray" }
28
+ ],
29
+ required: true,
30
+ default: "open"
31
+ }),
32
+ /** The host node/scope being drafted (page, board, database, …) */
33
+ target: relation({}),
34
+ /** original nodeId -> fork bookkeeping */
35
+ entries: json({}),
36
+ /** Draft-born node ids (no original; promoted on merge) */
37
+ created: json({}),
38
+ /** Original ids deleted inside the draft (tombstoned on merge) */
39
+ deletedIds: json({}),
40
+ /**
41
+ * P4 request surfacing: the draft author asks for a review; the
42
+ * Inbox/Requests surface lists open drafts with this flag set.
43
+ */
44
+ reviewRequested: checkbox({ default: false }),
45
+ /** Written once at merge: what the squash carried and who authored it */
46
+ mergeProvenance: json({}),
47
+ createdAt: created(),
48
+ createdBy: createdBy()
49
+ },
50
+ document: void 0,
51
+ // Creative privacy by construction: creator-only until shared (P5).
52
+ authorization: presets.private()
53
+ });
54
+
55
+ export {
56
+ DRAFT_SCHEMA_IRI,
57
+ DraftSchema
58
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ spaceCascadeAuthorization
3
+ } from "./chunk-JA56EQJO.js";
4
+ import {
5
+ created,
6
+ createdBy,
7
+ defineSchema,
8
+ json,
9
+ number,
10
+ relation,
11
+ select,
12
+ text
13
+ } from "./chunk-RRXJNZX5.js";
14
+
15
+ // src/schema/schemas/debug-report.ts
16
+ var lanes = [
17
+ { id: "auto", name: "Automatic", color: "gray" },
18
+ { id: "user", name: "User report", color: "blue" },
19
+ { id: "hub", name: "Hub", color: "purple" }
20
+ ];
21
+ var surfaces = [
22
+ { id: "web", name: "Web", color: "blue" },
23
+ { id: "electron", name: "Desktop", color: "green" },
24
+ { id: "hub", name: "Hub", color: "purple" },
25
+ { id: "cloud", name: "Cloud", color: "orange" },
26
+ { id: "unknown", name: "Unknown", color: "gray" }
27
+ ];
28
+ var statuses = [
29
+ { id: "new", name: "New", color: "red" },
30
+ { id: "acked", name: "Acknowledged", color: "yellow" },
31
+ { id: "in-progress", name: "In progress", color: "blue" },
32
+ { id: "fixed", name: "Fixed", color: "green" },
33
+ { id: "released", name: "Released", color: "gray" }
34
+ ];
35
+ var DebugReportSchema = defineSchema({
36
+ name: "DebugReport",
37
+ namespace: "xnet://xnet.fyi/",
38
+ properties: {
39
+ // Home Space for the operator's triage workspace — drives access control.
40
+ space: relation({}),
41
+ lane: select({ options: lanes, required: true, default: "auto" }),
42
+ /** Grouping key: hash(errorName + normalized top frame + release). */
43
+ fingerprint: text({ required: true, maxLength: 64 }),
44
+ errorName: text({ required: true, maxLength: 120 }),
45
+ message: text({ maxLength: 500 }),
46
+ stack: text({ maxLength: 6e3 }),
47
+ release: text({ maxLength: 64 }),
48
+ surface: select({ options: surfaces, required: true, default: "unknown" }),
49
+ bootStage: text({ maxLength: 64 }),
50
+ uaFamily: text({ maxLength: 64 }),
51
+ userDescription: text({ maxLength: 2e3 }),
52
+ /** Scrubbed recent console lines (user lane only). */
53
+ breadcrumbs: json({}),
54
+ /** Hub lane only: hub-salted sender hash, never a raw DID. */
55
+ didHash: text({ maxLength: 128 }),
56
+ occurrences: number({ integer: true }),
57
+ status: select({ options: statuses, required: true, default: "new" }),
58
+ firstSeen: number({}),
59
+ lastSeen: number({}),
60
+ createdAt: created(),
61
+ createdBy: createdBy()
62
+ },
63
+ document: void 0,
64
+ // Reports live in the operator's diagnostics Space and inherit its access.
65
+ authorization: spaceCascadeAuthorization("space")
66
+ });
67
+
68
+ export {
69
+ DebugReportSchema
70
+ };
@@ -1,6 +1,6 @@
1
1
  import { C as CellValue, a7 as FormSubmissionMeta, E as ColumnDefinition, h as FieldType, j as FieldConfig, K as SelectColor, k as FieldNode, S as SelectOptionNode, V as ViewType, W as FilterGroup, Z as SortConfig, U as ViewConfig, B as ColumnType, Y as FilterOperator, L as RollupAggregation, l as RollupColumnConfig } from './form-types-BlZvpDEE.js';
2
- import { ao as NodeQueryMaterializedViewOptions, h as NodeState, B as PropertyType, S as SchemaIRI, a as Schema } from './types-B5rrBwRI.js';
3
- import { N as NodeStore } from './store-B0fb6WdJ.js';
2
+ import { ar as NodeQueryMaterializedViewOptions, h as NodeState, E as PropertyType, S as SchemaIRI, a as Schema } from './types-C64g-IXg.js';
3
+ import { N as NodeStore } from './store-BIDKtpjW.js';
4
4
  import * as Y from 'yjs';
5
5
 
6
6
  /**
@@ -1,12 +1,12 @@
1
1
  import { W as FilterGroup, E as ColumnDefinition, B as ColumnType, V as ViewType, Z as SortConfig } from '../form-types-BlZvpDEE.js';
2
2
  export { a as CELL_PREFIX, C as CellValue, G as ColumnConfig, aq as ColumnSummaryResult, at as DEFAULT_ROW_HEIGHT, n as DateColumnConfig, n as DateFieldConfig, D as DateRange, H as EmptyConfig, p as FIELD_TYPES, j as FieldConfig, k as FieldNode, h as FieldType, o as FileColumnConfig, o as FileFieldConfig, F as FileRef, X as FilterCondition, Y as FilterOperator, a6 as FormAudience, a3 as FormConfirmation, a5 as FormFieldRule, a2 as FormQuestion, a7 as FormSubmissionMeta, a8 as FormValidationError, a9 as FormValidationResult, a4 as FormViewConfig, m as FormulaColumnConfig, m as FormulaFieldConfig, N as NumberColumnConfig, N as NumberFieldConfig, ac as PUBLIC_SAFE_FORM_FIELD_TYPES, ab as PublicFormDefinition, aa as PublicFormQuestion, as as ROW_HEIGHTS, ar as ROW_HEIGHT_PX, R as RelationColumnConfig, R as RelationFieldConfig, L as RollupAggregation, l as RollupColumnConfig, l as RollupFieldConfig, ax as RowHeight, q as SELECT_COLORS, aj as SUMMARY_FUNCTIONS_BY_TYPE, K as SelectColor, I as SelectColumnConfig, J as SelectOption, S as SelectOptionNode, ap as SummaryColumnLike, an as SummaryFunction, ao as SummaryRow, T as TextColumnConfig, T as TextFieldConfig, U as ViewConfig, aw as asRowHeight, u as autoColor, ah as buildPublicFormDefinition, c as cellKey, b as columnIdFromKey, am as computeColumnSummary, f as fromCellProperties, P as isAutoColumnType, x as isAutoFieldType, i as isCellKey, g as isCellValue, O as isComputedColumnType, w as isComputedFieldType, d as isDateRange, r as isFieldType, e as isFileRef, al as isFilledValue, $ as isFilterCondition, _ as isFilterGroup, ad as isFormFieldTypeAllowed, ae as isFormQuestionVisible, M as isNodeStoreColumnType, v as isNodeStoreFieldType, s as isSelectColor, Q as isYDocColumnType, y as isYDocFieldType, a1 as requiresDateColumn, av as resolveRowHeightPx, au as rowHeightLabel, ai as submissionRowId, ak as summaryFunctionLabel, a0 as supportsGrouping, t as toCellProperties, z as toFieldNode, A as toSelectOptionNode, ag as validateFormSubmission, af as visibleFormQuestions } from '../form-types-BlZvpDEE.js';
3
- export { cD as CloneSchemaOptions, cE as CloneSchemaResult, cF as CloneSourceData, ax as ConvertContext, ay as ConvertedCell, cx as CreateDatabaseSchemaResolverOptions, O as CreateExtensionFieldOptions, w as CreateFieldOptions, C as CreateRowOptions, x as CreateSelectOptionOptions, Z as CreateViewOptions, b8 as CsvExportOptions, aV as CsvParseOptions, cm as DATABASE_SCHEMA_NAMESPACE, cn as DATABASE_SCHEMA_PREFIX, ag as DEFAULT_DATABASE_SCHEMA_VERSION, au as DatabaseDocumentModel, D as DatabaseRowNode, cp as DatabaseSchemaMetadata, cw as DocFetcher, N as EnsureExtensionOptions, b7 as ExportRow, bb as ExportedColumn, ba as ExportedJSON, bQ as FilterableRow, aH as FormulaRow, aF as FormulaService, aI as FormulaValidationResult, c2 as GroupAggregates, c0 as GroupConfig, b$ as GroupableRow, aX as InferredColumn, b9 as JsonExportOptions, aY as JsonParseOptions, M as MAX_KEY_LENGTH, co as MAX_VERSION_HISTORY, bF as OPERATORS_BY_TYPE, bG as OPERATOR_LABELS, aU as ParsedCSV, aW as ParsedJSON, ca as QueryOptions, cb as QueryResult, Q as QueryRowsOptions, a as QueryRowsResult, c9 as QueryableRow, R as RICHTEXT_PREFIX, aE as RollupContext, aD as RollupRow, c1 as RowGroup, cr as SchemaVersionEntry, af as SetupDatabaseResult, bW as SortableRow, cq as StoredColumn, U as UpdateFieldOptions, _ as UpdateViewOptions, cs as VersionBumpType, Y as ViewNode, ao as addDefaultTableView, an as addDefaultTitleColumn, bU as addOrToggleSort, bv as addViewSort, az as aggregate, aB as batchComputeRollups, ci as buildDatabaseSchema, ai as buildSchemaFromFields, cc as buildSchemaIRI, cg as bumpSchemaVersion, aw as cellValueToText, e as checkNeedsRebalancing, bt as clearViewFilters, bx as clearViewSorts, cz as cloneColumns, cA as cloneSampleRows, cy as cloneSchema, b_ as collapseAllGroups, bO as combineFiltersAnd, bP as combineFiltersOr, j as compareSortKeys, aA as computeRollup, av as convertCellValue, bN as createAnyOfFilter, bg as createColumn, b0 as createCsvBlob, ct as createDatabaseSchemaResolver, bM as createEqualsFilter, J as createExtensionField, B as createField, c4 as createFilterQuery, aG as createFormulaService, ch as createInitialSchemaMetadata, b5 as createJsonBlob, ak as createNodeDatabaseSchemaResolver, c6 as createPaginatedQuery, c as createRow, T as createSelectOption, bS as createSort, c5 as createSortQuery, cj as createVersionEntry, bo as createView, a1 as createViewNode, bi as deleteColumn, L as deleteExtensionField, F as deleteField, as as deleteMeta, t as deleteRichTextCell, d as deleteRow, W as deleteSelectOption, bq as deleteView, a3 as deleteViewNode, b1 as downloadCsv, b6 as downloadJson, bk as duplicateColumn, H as duplicateField, br as duplicateView, a4 as duplicateViewNode, ad as effectiveFieldSortKey, I as ensureSchemaExtension, a_ as escapeCSV, c3 as executeQuery, bZ as expandAllGroups, aZ as exportToCsv, b2 as exportToJson, b3 as exportToJsonArray, b4 as exportToNdjson, cu as extractSchemaFromDoc, ah as fieldsToStoredColumns, bL as filterRows, c7 as flattenGroups, a$ as formatValue, cB as generateColumnIdMap, f as generateSortKey, h as generateSortKeyWithJitter, cI as getAggregationResultType, bd as getColumn, be as getColumnIndex, bc as getColumns, at as getDatabaseDocumentModel, aj as getDatabaseSchemaIRI, S as getDatabaseSelectOptions, cG as getEmptyValue, z as getField, y as getFields, aq as getMeta, bJ as getOperatorLabel, bH as getOperatorsForType, l as getRichTextCell, s as getRichTextColumnIds, v as getRichTextPlainText, g as getRow, cv as getSchemaIRIFromDoc, P as getSelectOptions, bf as getTitleColumn, A as getTitleField, c8 as getTotalFromGroups, cl as getVersionBumpType, bm as getView, bn as getViewByType, a0 as getViewNode, $ as getViewNodes, bl as getViews, bX as groupRows, aL as guessColumnType, p as hasRichTextColumns, o as hasRichTextContent, bC as hideColumn, aO as inferColumnTypes, aQ as inferColumnsFromRows, aR as inferTypeFromValues, al as initializeDatabaseDoc, am as isDatabaseDocInitialized, ce as isDatabaseSchemaIRI, cH as isNumericAggregation, bI as isValidOperator, i as isValidSortKey, G as moveField, m as moveRow, X as moveSelectOption, a5 as moveView, n as needsRebalancing, bK as operatorRequiresValue, aJ as parseCSV, aK as parseCSVLine, cd as parseDatabaseSchemaIRI, aP as parseJSON, aN as parseRow, aM as parseValue, cf as parseVersion, ck as pruneVersionHistory, q as queryRows, r as rebalanceDatabase, k as rebalanceSortKeys, cC as remapViewColumnIds, bV as removeSort, bw as removeViewSort, K as renameExtensionField, bj as reorderColumn, bD as reorderViewColumns, bE as setColumnWidth, aa as setFieldHidden, ar as setMeta, ac as setViewFieldOrder, ab as setViewFieldWidth, bs as setViewFilters, by as setViewGroupBy, a6 as setViewNodeFilters, a8 as setViewNodeGroupBy, a7 as setViewNodeSorts, bu as setViewSorts, bA as setVisibleColumns, ae as setupDatabase, ap as setupNewDatabase, bB as showColumn, bR as sortRows, aS as toColumnDefinitions, bz as toggleGroupCollapsed, bY as toggleGroupCollapsedState, bT as toggleSortDirection, a9 as toggleViewGroupCollapsed, u as updateCell, b as updateCells, bh as updateColumn, E as updateField, V as updateSelectOption, bp as updateView, a2 as updateViewNode, aT as validateJsonData, aC as validateRollupConfig } from '../clone-Bj0nQyMc.js';
4
- import '../types-B5rrBwRI.js';
3
+ export { cD as CloneSchemaOptions, cE as CloneSchemaResult, cF as CloneSourceData, ax as ConvertContext, ay as ConvertedCell, cx as CreateDatabaseSchemaResolverOptions, O as CreateExtensionFieldOptions, w as CreateFieldOptions, C as CreateRowOptions, x as CreateSelectOptionOptions, Z as CreateViewOptions, b8 as CsvExportOptions, aV as CsvParseOptions, cm as DATABASE_SCHEMA_NAMESPACE, cn as DATABASE_SCHEMA_PREFIX, ag as DEFAULT_DATABASE_SCHEMA_VERSION, au as DatabaseDocumentModel, D as DatabaseRowNode, cp as DatabaseSchemaMetadata, cw as DocFetcher, N as EnsureExtensionOptions, b7 as ExportRow, bb as ExportedColumn, ba as ExportedJSON, bQ as FilterableRow, aH as FormulaRow, aF as FormulaService, aI as FormulaValidationResult, c2 as GroupAggregates, c0 as GroupConfig, b$ as GroupableRow, aX as InferredColumn, b9 as JsonExportOptions, aY as JsonParseOptions, M as MAX_KEY_LENGTH, co as MAX_VERSION_HISTORY, bF as OPERATORS_BY_TYPE, bG as OPERATOR_LABELS, aU as ParsedCSV, aW as ParsedJSON, ca as QueryOptions, cb as QueryResult, Q as QueryRowsOptions, a as QueryRowsResult, c9 as QueryableRow, R as RICHTEXT_PREFIX, aE as RollupContext, aD as RollupRow, c1 as RowGroup, cr as SchemaVersionEntry, af as SetupDatabaseResult, bW as SortableRow, cq as StoredColumn, U as UpdateFieldOptions, _ as UpdateViewOptions, cs as VersionBumpType, Y as ViewNode, ao as addDefaultTableView, an as addDefaultTitleColumn, bU as addOrToggleSort, bv as addViewSort, az as aggregate, aB as batchComputeRollups, ci as buildDatabaseSchema, ai as buildSchemaFromFields, cc as buildSchemaIRI, cg as bumpSchemaVersion, aw as cellValueToText, e as checkNeedsRebalancing, bt as clearViewFilters, bx as clearViewSorts, cz as cloneColumns, cA as cloneSampleRows, cy as cloneSchema, b_ as collapseAllGroups, bO as combineFiltersAnd, bP as combineFiltersOr, j as compareSortKeys, aA as computeRollup, av as convertCellValue, bN as createAnyOfFilter, bg as createColumn, b0 as createCsvBlob, ct as createDatabaseSchemaResolver, bM as createEqualsFilter, J as createExtensionField, B as createField, c4 as createFilterQuery, aG as createFormulaService, ch as createInitialSchemaMetadata, b5 as createJsonBlob, ak as createNodeDatabaseSchemaResolver, c6 as createPaginatedQuery, c as createRow, T as createSelectOption, bS as createSort, c5 as createSortQuery, cj as createVersionEntry, bo as createView, a1 as createViewNode, bi as deleteColumn, L as deleteExtensionField, F as deleteField, as as deleteMeta, t as deleteRichTextCell, d as deleteRow, W as deleteSelectOption, bq as deleteView, a3 as deleteViewNode, b1 as downloadCsv, b6 as downloadJson, bk as duplicateColumn, H as duplicateField, br as duplicateView, a4 as duplicateViewNode, ad as effectiveFieldSortKey, I as ensureSchemaExtension, a_ as escapeCSV, c3 as executeQuery, bZ as expandAllGroups, aZ as exportToCsv, b2 as exportToJson, b3 as exportToJsonArray, b4 as exportToNdjson, cu as extractSchemaFromDoc, ah as fieldsToStoredColumns, bL as filterRows, c7 as flattenGroups, a$ as formatValue, cB as generateColumnIdMap, f as generateSortKey, h as generateSortKeyWithJitter, cI as getAggregationResultType, bd as getColumn, be as getColumnIndex, bc as getColumns, at as getDatabaseDocumentModel, aj as getDatabaseSchemaIRI, S as getDatabaseSelectOptions, cG as getEmptyValue, z as getField, y as getFields, aq as getMeta, bJ as getOperatorLabel, bH as getOperatorsForType, l as getRichTextCell, s as getRichTextColumnIds, v as getRichTextPlainText, g as getRow, cv as getSchemaIRIFromDoc, P as getSelectOptions, bf as getTitleColumn, A as getTitleField, c8 as getTotalFromGroups, cl as getVersionBumpType, bm as getView, bn as getViewByType, a0 as getViewNode, $ as getViewNodes, bl as getViews, bX as groupRows, aL as guessColumnType, p as hasRichTextColumns, o as hasRichTextContent, bC as hideColumn, aO as inferColumnTypes, aQ as inferColumnsFromRows, aR as inferTypeFromValues, al as initializeDatabaseDoc, am as isDatabaseDocInitialized, ce as isDatabaseSchemaIRI, cH as isNumericAggregation, bI as isValidOperator, i as isValidSortKey, G as moveField, m as moveRow, X as moveSelectOption, a5 as moveView, n as needsRebalancing, bK as operatorRequiresValue, aJ as parseCSV, aK as parseCSVLine, cd as parseDatabaseSchemaIRI, aP as parseJSON, aN as parseRow, aM as parseValue, cf as parseVersion, ck as pruneVersionHistory, q as queryRows, r as rebalanceDatabase, k as rebalanceSortKeys, cC as remapViewColumnIds, bV as removeSort, bw as removeViewSort, K as renameExtensionField, bj as reorderColumn, bD as reorderViewColumns, bE as setColumnWidth, aa as setFieldHidden, ar as setMeta, ac as setViewFieldOrder, ab as setViewFieldWidth, bs as setViewFilters, by as setViewGroupBy, a6 as setViewNodeFilters, a8 as setViewNodeGroupBy, a7 as setViewNodeSorts, bu as setViewSorts, bA as setVisibleColumns, ae as setupDatabase, ap as setupNewDatabase, bB as showColumn, bR as sortRows, aS as toColumnDefinitions, bz as toggleGroupCollapsed, bY as toggleGroupCollapsedState, bT as toggleSortDirection, a9 as toggleViewGroupCollapsed, u as updateCell, b as updateCells, bh as updateColumn, E as updateField, V as updateSelectOption, bp as updateView, a2 as updateViewNode, aT as validateJsonData, aC as validateRollupConfig } from '../clone-DNcpkYAA.js';
4
+ import '../types-C64g-IXg.js';
5
5
  import '@xnetjs/core';
6
6
  import '@xnetjs/crypto';
7
7
  import '@xnetjs/sqlite';
8
8
  import '@xnetjs/sync';
9
- import '../store-B0fb6WdJ.js';
9
+ import '../store-BIDKtpjW.js';
10
10
  import 'yjs';
11
11
 
12
12
  /**
@@ -252,7 +252,8 @@ import {
252
252
  validateTemplate,
253
253
  visibleFormQuestions,
254
254
  wouldCreateCircular
255
- } from "../chunk-ENA6NEFY.js";
255
+ } from "../chunk-DESSPQBS.js";
256
+ import "../chunk-S5RP5RKY.js";
256
257
  import "../chunk-PMUQACPY.js";
257
258
  import "../chunk-KTPSQJ5L.js";
258
259
  import {
@@ -269,7 +270,6 @@ import "../chunk-WWQO7QKV.js";
269
270
  import "../chunk-OIWW5TG3.js";
270
271
  import "../chunk-TRPXLCND.js";
271
272
  import "../chunk-JA56EQJO.js";
272
- import "../chunk-S5RP5RKY.js";
273
273
  import "../chunk-LK5ZIAIE.js";
274
274
  import "../chunk-RRXJNZX5.js";
275
275
  import "../chunk-D4LUUZYD.js";
@@ -0,0 +1,10 @@
1
+ import {
2
+ DebugReportSchema
3
+ } from "./chunk-Z5I2T75Z.js";
4
+ import "./chunk-JA56EQJO.js";
5
+ import "./chunk-LK5ZIAIE.js";
6
+ import "./chunk-RRXJNZX5.js";
7
+ import "./chunk-D4LUUZYD.js";
8
+ export {
9
+ DebugReportSchema
10
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ DRAFT_SCHEMA_IRI,
3
+ DraftSchema
4
+ } from "./chunk-MEAIGK3W.js";
5
+ import "./chunk-RRXJNZX5.js";
6
+ import "./chunk-D4LUUZYD.js";
7
+ export {
8
+ DRAFT_SCHEMA_IRI,
9
+ DraftSchema
10
+ };
@@ -1,6 +1,6 @@
1
1
  import { SerializedAuthorization, SerializedRoleResolver, PolicyEvaluator, DID, AuthDecision, RoleResolver, AuthDenyReason, AuthCheckInput, AuthTrace, AuthExpression } from '@xnetjs/core';
2
- import { a as Schema, h as NodeState, v as NodeChangeEvent, w as GrantIndex, O as OfflineAuthPolicy, D as DefinedSchema } from './types-B5rrBwRI.js';
3
- import { S as SchemaRegistry } from './registry-BGD80QCd.js';
2
+ import { a as Schema, h as NodeState, w as NodeChangeEvent, x as GrantIndex, O as OfflineAuthPolicy, D as DefinedSchema } from './types-C64g-IXg.js';
3
+ import { S as SchemaRegistry } from './registry-s1fYgCSj.js';
4
4
 
5
5
  /**
6
6
  * Permission-matrix reflection.