@graview/core 0.2.17 → 0.2.18

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 (157) hide show
  1. package/README.md +9 -0
  2. package/dist/app-places.d.ts.map +1 -1
  3. package/dist/app-places.js +3 -1
  4. package/dist/app-places.js.map +1 -1
  5. package/dist/app.d.ts +13 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +3 -1
  8. package/dist/app.js.map +1 -1
  9. package/dist/beginning.d.ts.map +1 -1
  10. package/dist/beginning.js +6 -2
  11. package/dist/beginning.js.map +1 -1
  12. package/dist/catalog.d.ts +52 -0
  13. package/dist/catalog.d.ts.map +1 -1
  14. package/dist/catalog.js +145 -0
  15. package/dist/catalog.js.map +1 -1
  16. package/dist/city.d.ts.map +1 -1
  17. package/dist/city.js +3 -1
  18. package/dist/city.js.map +1 -1
  19. package/dist/cli/check/index.d.ts +1 -0
  20. package/dist/cli/check/index.d.ts.map +1 -1
  21. package/dist/cli/check/index.js +1 -0
  22. package/dist/cli/check/index.js.map +1 -1
  23. package/dist/cli/check/policy.d.ts.map +1 -1
  24. package/dist/cli/check/policy.js +3 -1
  25. package/dist/cli/check/policy.js.map +1 -1
  26. package/dist/cli/check/rooms.d.ts +10 -0
  27. package/dist/cli/check/rooms.d.ts.map +1 -0
  28. package/dist/cli/check/rooms.js +23 -0
  29. package/dist/cli/check/rooms.js.map +1 -0
  30. package/dist/cli/check.d.ts +1 -1
  31. package/dist/cli/check.d.ts.map +1 -1
  32. package/dist/cli/check.js +18 -2
  33. package/dist/cli/check.js.map +1 -1
  34. package/dist/cli/describe.d.ts +1 -1
  35. package/dist/cli/describe.d.ts.map +1 -1
  36. package/dist/cli/describe.js +38 -4
  37. package/dist/cli/describe.js.map +1 -1
  38. package/dist/cli/document-schema.d.ts.map +1 -1
  39. package/dist/cli/document-schema.js +21 -0
  40. package/dist/cli/document-schema.js.map +1 -1
  41. package/dist/compose-home.js +1 -1
  42. package/dist/compose-home.js.map +1 -1
  43. package/dist/conformance/index.d.ts.map +1 -1
  44. package/dist/conformance/index.js +3 -1
  45. package/dist/conformance/index.js.map +1 -1
  46. package/dist/document/compile-checked.d.ts.map +1 -1
  47. package/dist/document/compile-checked.js +3 -2
  48. package/dist/document/compile-checked.js.map +1 -1
  49. package/dist/document/compiled.d.ts.map +1 -1
  50. package/dist/document/compiled.js +9 -1
  51. package/dist/document/compiled.js.map +1 -1
  52. package/dist/document/graview-template.d.ts +3 -3
  53. package/dist/document/purpose-spec.d.ts +2 -2
  54. package/dist/document/schema.d.ts +22 -21
  55. package/dist/document/schema.d.ts.map +1 -1
  56. package/dist/document/schema.js +6 -0
  57. package/dist/document/schema.js.map +1 -1
  58. package/dist/document/to-document.d.ts +1 -1
  59. package/dist/document/to-document.d.ts.map +1 -1
  60. package/dist/document/to-document.js +6 -2
  61. package/dist/document/to-document.js.map +1 -1
  62. package/dist/document/workflow-spec.d.ts +2 -2
  63. package/dist/document.schema.json +53 -2
  64. package/dist/field-sight.d.ts.map +1 -1
  65. package/dist/field-sight.js +6 -1
  66. package/dist/field-sight.js.map +1 -1
  67. package/dist/friction-record.d.ts +8 -0
  68. package/dist/friction-record.d.ts.map +1 -1
  69. package/dist/friction-record.js +25 -0
  70. package/dist/friction-record.js.map +1 -1
  71. package/dist/index.d.ts +9 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +7 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/installation.d.ts +2 -2
  76. package/dist/installation.d.ts.map +1 -1
  77. package/dist/installation.js +2 -0
  78. package/dist/installation.js.map +1 -1
  79. package/dist/mutations/define-mutation.d.ts +3 -0
  80. package/dist/mutations/define-mutation.d.ts.map +1 -1
  81. package/dist/mutations/define-mutation.js +2 -0
  82. package/dist/mutations/define-mutation.js.map +1 -1
  83. package/dist/mutations/derive-edits.d.ts.map +1 -1
  84. package/dist/mutations/derive-edits.js +7 -0
  85. package/dist/mutations/derive-edits.js.map +1 -1
  86. package/dist/mutations/derive-relations.d.ts.map +1 -1
  87. package/dist/mutations/derive-relations.js +4 -0
  88. package/dist/mutations/derive-relations.js.map +1 -1
  89. package/dist/mutations/derive-repeats.d.ts.map +1 -1
  90. package/dist/mutations/derive-repeats.js +4 -0
  91. package/dist/mutations/derive-repeats.js.map +1 -1
  92. package/dist/mutations/types.d.ts +24 -0
  93. package/dist/mutations/types.d.ts.map +1 -1
  94. package/dist/mutations/visitor-form.js +1 -1
  95. package/dist/mutations/visitor-form.js.map +1 -1
  96. package/dist/ops/digest.d.ts +2 -1
  97. package/dist/ops/digest.d.ts.map +1 -1
  98. package/dist/ops/digest.js +7 -1
  99. package/dist/ops/digest.js.map +1 -1
  100. package/dist/permissions/policy.d.ts +16 -0
  101. package/dist/permissions/policy.d.ts.map +1 -1
  102. package/dist/permissions/policy.js +16 -0
  103. package/dist/permissions/policy.js.map +1 -1
  104. package/dist/permissions/sight.d.ts +9 -0
  105. package/dist/permissions/sight.d.ts.map +1 -1
  106. package/dist/permissions/sight.js +18 -0
  107. package/dist/permissions/sight.js.map +1 -1
  108. package/dist/permissions/types.d.ts +24 -0
  109. package/dist/permissions/types.d.ts.map +1 -1
  110. package/dist/permissions/types.js.map +1 -1
  111. package/dist/rooms/findings.d.ts +53 -0
  112. package/dist/rooms/findings.d.ts.map +1 -0
  113. package/dist/rooms/findings.js +109 -0
  114. package/dist/rooms/findings.js.map +1 -0
  115. package/dist/rooms/kind.d.ts +86 -0
  116. package/dist/rooms/kind.d.ts.map +1 -0
  117. package/dist/rooms/kind.js +530 -0
  118. package/dist/rooms/kind.js.map +1 -0
  119. package/dist/rooms/read.d.ts +164 -0
  120. package/dist/rooms/read.d.ts.map +1 -0
  121. package/dist/rooms/read.js +246 -0
  122. package/dist/rooms/read.js.map +1 -0
  123. package/dist/rooms/shape.d.ts +133 -0
  124. package/dist/rooms/shape.d.ts.map +1 -0
  125. package/dist/rooms/shape.js +71 -0
  126. package/dist/rooms/shape.js.map +1 -0
  127. package/dist/rooms/support-open.d.ts +7 -0
  128. package/dist/rooms/support-open.d.ts.map +1 -0
  129. package/dist/rooms/support-open.js +25 -0
  130. package/dist/rooms/support-open.js.map +1 -0
  131. package/dist/rooms/support.d.ts +95 -0
  132. package/dist/rooms/support.d.ts.map +1 -0
  133. package/dist/rooms/support.js +62 -0
  134. package/dist/rooms/support.js.map +1 -0
  135. package/dist/rooms.d.ts +12 -0
  136. package/dist/rooms.d.ts.map +1 -0
  137. package/dist/rooms.js +25 -0
  138. package/dist/rooms.js.map +1 -0
  139. package/dist/seen.d.ts.map +1 -1
  140. package/dist/seen.js +84 -12
  141. package/dist/seen.js.map +1 -1
  142. package/dist/store.d.ts.map +1 -1
  143. package/dist/store.js +12 -2
  144. package/dist/store.js.map +1 -1
  145. package/dist/subscription-shape.d.ts +4 -0
  146. package/dist/subscription-shape.d.ts.map +1 -1
  147. package/dist/subscription-shape.js.map +1 -1
  148. package/dist/subscriptions.d.ts +8 -0
  149. package/dist/subscriptions.d.ts.map +1 -1
  150. package/dist/subscriptions.js +48 -2
  151. package/dist/subscriptions.js.map +1 -1
  152. package/dist/testing.d.ts.map +1 -1
  153. package/dist/testing.js +4 -0
  154. package/dist/testing.js.map +1 -1
  155. package/dist/version.d.ts +1 -1
  156. package/dist/version.js +1 -1
  157. package/package.json +5 -1
@@ -0,0 +1,71 @@
1
+ /**
2
+ * ROOMS: WHERE THE PEOPLE IN AN APP TALK TO EACH OTHER (Graview HQ
3
+ * feature:f-chat-rooms).
4
+ *
5
+ * rooms: {
6
+ * household: { title: "Household" },
7
+ * "task-talk": { title: "Comments", about: "task", mentions: true },
8
+ * }
9
+ *
10
+ * A room is declared, as a workflow is: by its address word, with a title.
11
+ * Without `about` it is one room for the whole app; with `about: "<kind>"`
12
+ * it is a thread on each record of that kind, drawn beside the record's
13
+ * page. `read` and `post` name the roles that may read it and post in it,
14
+ * and default to whoever may see the app (or the record, for a thread);
15
+ * `moderate` names the roles that may remove anybody's message, where
16
+ * everybody else removes only their own. `mentions` (on unless false)
17
+ * reads `@Name` in a message as a person of the app, who is told.
18
+ *
19
+ * What is said in a room is a record of the framework's own kind,
20
+ * `message` (`MESSAGE_KIND`), made, changed and removed by three acts the
21
+ * framework adds to an app that declares a room (`post-message`,
22
+ * `edit-message`, `remove-message`) — so sight, roles, history and undo
23
+ * hold of a message as of any record, and an agent's seat has the acts as
24
+ * tools. The same shape in a document (`rooms`) and in
25
+ * `defineApp({ rooms })`; `graview check` holds each to the declaration
26
+ * (`room-*`); `@graview/core/rooms` reads them (`roomsOf`, `threadOf`,
27
+ * `messagesIn`, `unreadFor`, `mentionsIn`).
28
+ */
29
+ /** The framework's own kind every room's messages are records of. An app that declares rooms may not declare one of its own by this name (`room-kind-taken`). */
30
+ export const MESSAGE_KIND = "message";
31
+ /** The three acts an app with rooms is given. */
32
+ export const POST_MESSAGE = "post-message";
33
+ export const EDIT_MESSAGE = "edit-message";
34
+ export const REMOVE_MESSAGE = "remove-message";
35
+ export const ROOM_ACTS = [POST_MESSAGE, EDIT_MESSAGE, REMOVE_MESSAGE];
36
+ /**
37
+ * THE FRAMEWORK'S OWN ROOMS (Graview HQ feature:f-conversations-in-the-graph):
38
+ * where every app keeps what its people said to its AI and what the AI said
39
+ * back, whether or not it declares rooms of its own. `~asks` holds the
40
+ * inline AI's questions (the menu's "Ask") and the seat's conversation;
41
+ * `~design` holds the "Better UI" conversations that change how the app
42
+ * looks. An app need not declare them, and may not declare a room of its
43
+ * own whose id starts with `~` (`room-id-reserved`). A conversation in one
44
+ * is seen only by whoever asked it, until they share it.
45
+ */
46
+ export const ASKS_ROOM = "~asks";
47
+ export const DESIGN_ROOM = "~design";
48
+ export const FRAMEWORK_ROOMS = [ASKS_ROOM, DESIGN_ROOM];
49
+ /** Whether a room is one the framework keeps, not one an app declared. */
50
+ export const isFrameworkRoom = (room) => room === ASKS_ROOM || room === DESIGN_ROOM;
51
+ const FRAMEWORK_ROOM_TITLES = { [ASKS_ROOM]: "Questions to the AI", [DESIGN_ROOM]: "Design changes" };
52
+ /** A framework room's title, in plain words ("Questions to the AI", "Design changes"); undefined for a room the app declared. */
53
+ export const frameworkRoomTitle = (room) => (isFrameworkRoom(room) ? FRAMEWORK_ROOM_TITLES[room] : undefined);
54
+ /** The acts every app is given for its conversations with the AI: keep a finished turn, settle what became of it, share the conversation. */
55
+ export const KEEP_AI_TURN = "keep-ai-turn";
56
+ export const SETTLE_AI_TURN = "settle-ai-turn";
57
+ export const SHARE_CONVERSATION = "share-conversation";
58
+ export const AI_ROOM_ACTS = [KEEP_AI_TURN, SETTLE_AI_TURN, SHARE_CONVERSATION];
59
+ /** Whether an act is one of those: kept by the page's AI desk and the conversation's own controls, never offered among an app's acts or an agent's tools. */
60
+ export const isAiRoomAct = (name) => name === KEEP_AI_TURN || name === SETTLE_AI_TURN || name === SHARE_CONVERSATION;
61
+ /** The module a room's kind and acts are in, so a host may turn rooms off for an installation (`enabledModules`) as it turns off any module. */
62
+ export const ROOMS_MODULE = "rooms";
63
+ /** The most an app declares, and the longest a message is: a message is talk, not a document. */
64
+ export const MOST_ROOMS = 24;
65
+ export const LONGEST_MESSAGE = 4000;
66
+ export const LONGEST_ROOM_TITLE = 60;
67
+ /** The view name a person's "read up to" markers are kept under (`ViewerState`), one key a room or thread. */
68
+ export const ROOMS_READ_STATE = "graview:rooms";
69
+ /** Where a room's messages are, said as one key: the room alone, or the room and the record a thread is on. */
70
+ export const roomKey = (room, about) => (about ? `${room}@${about}` : room);
71
+ //# sourceMappingURL=shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape.js","sourceRoot":"","sources":["../../src/rooms/shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAuBH,iKAAiK;AACjK,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AAEtC,iDAAiD;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,MAAM,CAAC,MAAM,YA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,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,iGAAiG;AACjG,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,8GAA8G;AAC9G,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AA0ChD,+GAA+G;AAC/G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,KAAc,EAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Says how a support declaration's panel is opened, until the answer is called. */
2
+ export declare function whenSupportOpened(support: object, open: () => void): () => void;
3
+ /** Opens the panel of a support declaration, where a face draws one. Answers whether one did. */
4
+ export declare function openSupport(support: object): boolean;
5
+ /** The row's words: "Chat with Graview", or the host's title where it already says chat. */
6
+ export declare const supportRowLabel: (title: string) => string;
7
+ //# sourceMappingURL=support-open.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-open.d.ts","sourceRoot":"","sources":["../../src/rooms/support-open.ts"],"names":[],"mappings":"AAUA,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAK/E;AAED,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED,4FAA4F;AAC5F,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,MAAsF,CAAC"}
@@ -0,0 +1,25 @@
1
+ /*
2
+ * WHO OPENS A SUPPORT PANEL (Graview HQ feature:f-support-chat): the face
3
+ * that draws it says so for the host's declaration (`whenSupportOpened`),
4
+ * and whatever offers "Chat with …" — the routed face's own menu, an
5
+ * embed's bar above it — asks for it (`openSupport`). A weak map and a
6
+ * call, so a bar that offers the row carries nothing of the panel.
7
+ */
8
+ const OPENERS = new WeakMap();
9
+ /** Says how a support declaration's panel is opened, until the answer is called. */
10
+ export function whenSupportOpened(support, open) {
11
+ OPENERS.set(support, open);
12
+ return () => {
13
+ if (OPENERS.get(support) === open)
14
+ OPENERS.delete(support);
15
+ };
16
+ }
17
+ /** Opens the panel of a support declaration, where a face draws one. Answers whether one did. */
18
+ export function openSupport(support) {
19
+ const open = OPENERS.get(support);
20
+ open?.();
21
+ return open !== undefined;
22
+ }
23
+ /** The row's words: "Chat with Graview", or the host's title where it already says chat. */
24
+ export const supportRowLabel = (title) => (/^chat\b/i.test(title.trim()) ? title.trim() : `Chat with ${title.trim()}`);
25
+ //# sourceMappingURL=support-open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-open.js","sourceRoot":"","sources":["../../src/rooms/support-open.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAsB,CAAC;AAElD,oFAAoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,IAAgB;IACjE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,GAAG,EAAE;QACV,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI;YAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,EAAE,CAAC;IACT,OAAO,IAAI,KAAK,SAAS,CAAC;AAC5B,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC"}
@@ -0,0 +1,95 @@
1
+ import type { FrictionDraft } from "../friction-record.js";
2
+ import type { MessageRecord } from "./shape.js";
3
+ /** One message of a support thread: a room's message's shape, from the person or from staff. */
4
+ export interface SupportMessage extends Pick<MessageRecord, "id" | "body" | "at" | "author"> {
5
+ readonly from: "person" | "staff";
6
+ readonly authorName?: string;
7
+ readonly replyTo?: string;
8
+ }
9
+ /** What the person wrote, before the transport keeps it. */
10
+ export interface SupportDraft {
11
+ readonly body: string;
12
+ readonly replyTo?: string;
13
+ }
14
+ /** A reply from staff, as the transport hands it to the page. */
15
+ export type SupportReply = SupportMessage;
16
+ /**
17
+ * WHERE THE PERSON WAS WHEN THEY WROTE, carried by every message: the app,
18
+ * the place and the record they were on, who they are and which roles they
19
+ * hold, what they last could not do, and the framework's version.
20
+ */
21
+ export interface SupportContext {
22
+ readonly app: string;
23
+ readonly appTitle?: string;
24
+ /** The page's address, as the routed face says it: `/tasks/t-book`. */
25
+ readonly place?: string;
26
+ /** The record the place is of, where it is one. */
27
+ readonly record?: {
28
+ readonly id: string;
29
+ readonly kind: string;
30
+ readonly label: string;
31
+ };
32
+ readonly person?: {
33
+ readonly id?: string;
34
+ readonly name?: string;
35
+ readonly kind: string;
36
+ };
37
+ readonly roles: readonly string[];
38
+ /** What they last looked for and could not do, in words: at most `SUPPORT_CONTEXT_FRICTION`, newest last. */
39
+ readonly friction: readonly string[];
40
+ /** The framework's version, `FRAMEWORK_VERSION`. */
41
+ readonly version: string;
42
+ readonly at: string;
43
+ }
44
+ /** The most of the person's recent friction a message carries. */
45
+ export declare const SUPPORT_CONTEXT_FRICTION = 5;
46
+ /**
47
+ * HOW A HOST CARRIES THE THREAD: `send` keeps a message the person wrote,
48
+ * with its context, and answers it as kept (or nothing, and the page keeps
49
+ * its own copy); `subscribe` tells the page each reply from staff, and
50
+ * answers how to stop; `history`, where the host keeps the thread, gives
51
+ * it back when the panel opens.
52
+ */
53
+ export interface SupportTransport {
54
+ send(message: SupportDraft, context: SupportContext): Promise<SupportMessage | void>;
55
+ subscribe(onReply: (reply: SupportReply) => void): () => void;
56
+ history?(): Promise<readonly SupportMessage[]>;
57
+ }
58
+ /** What a host hands `PagesApp` and `mount` to offer "Chat with …" in the person's menu. */
59
+ export interface SupportDeclaration {
60
+ /** Who the person talks to, as the menu says it: "Chat with Graview". The row is "Chat with <title>" unless the title already says so. */
61
+ readonly title: string;
62
+ readonly transport: SupportTransport;
63
+ /** A sentence at the top of the panel; unsaid, that replies come later and arrive here. */
64
+ readonly description?: string;
65
+ }
66
+ /** The context a message carries, from what the page knows: friction said in words, the last few only. */
67
+ export declare function supportContextOf(input: Omit<SupportContext, "friction" | "at"> & {
68
+ readonly friction?: readonly FrictionDraft[];
69
+ readonly at?: string;
70
+ }): SupportContext;
71
+ /** A transport that keeps the thread in memory, for tests and development, answering each message with a reply after a while. */
72
+ export interface MemorySupport extends SupportTransport {
73
+ /** Everything the person sent, with its context, in order. */
74
+ readonly sent: readonly {
75
+ readonly message: SupportMessage;
76
+ readonly context: SupportContext;
77
+ }[];
78
+ /** Hand the page a reply from staff now, as a staff inbox would. */
79
+ reply(body: string, options?: {
80
+ readonly authorName?: string;
81
+ readonly replyTo?: string;
82
+ }): SupportReply;
83
+ }
84
+ /**
85
+ * A SUPPORT THREAD IN MEMORY: what the person sends is kept here, and —
86
+ * unless `answer` says nothing — staff answer it `delayMs` later
87
+ * (`answer`'s words, else that a person will read it soon). `reply` hands
88
+ * the page a reply of your own.
89
+ */
90
+ export declare function memorySupport(options?: {
91
+ readonly answer?: (message: SupportMessage, context: SupportContext) => string | undefined;
92
+ readonly delayMs?: number;
93
+ readonly staffName?: string;
94
+ }): MemorySupport;
95
+ //# s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AAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;KAAE,EAAE,CAAC;IACjG,oEAAoE;IACpE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC;CAC1G;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,KAAK,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,aAAa,CA+BjN"}
@@ -0,0 +1,62 @@
1
+ import { withArticle } from "../schema/define-node.js";
2
+ /** The most of the person's recent friction a message carries. */
3
+ export const SUPPORT_CONTEXT_FRICTION = 5;
4
+ /** One friction draft said in words, never a selector. */
5
+ function frictionLine(draft) {
6
+ switch (draft.type) {
7
+ case "search-miss":
8
+ return `Searched for “${draft.words}”${draft.kind ? ` in ${draft.kind}` : ""} and found nothing.`;
9
+ case "unanswered":
10
+ return `Asked “${draft.question}” and was not answered${draft.lacks ? `: ${draft.lacks}` : "."}`;
11
+ case "refused":
12
+ return `Pressed ${draft.act}${draft.kind ? ` on ${withArticle(draft.kind)}` : ""} and was refused (${draft.code}).`;
13
+ case "tool-invalid":
14
+ return `An agent's call of ${draft.tool} was refused: ${draft.message}`;
15
+ }
16
+ }
17
+ /** The context a message carries, from what the page knows: friction said in words, the last few only. */
18
+ export function supportContextOf(input) {
19
+ const { friction, at, ...rest } = input;
20
+ return { ...rest, friction: (friction ?? []).slice(-SUPPORT_CONTEXT_FRICTION).map(frictionLine), at: at ?? new Date().toISOString() };
21
+ }
22
+ /**
23
+ * A SUPPORT THREAD IN MEMORY: what the person sends is kept here, and —
24
+ * unless `answer` says nothing — staff answer it `delayMs` later
25
+ * (`answer`'s words, else that a person will read it soon). `reply` hands
26
+ * the page a reply of your own.
27
+ */
28
+ export function memorySupport(options = {}) {
29
+ const thread = [];
30
+ const sent = [];
31
+ const listeners = new Set();
32
+ let n = 0;
33
+ const staffName = options.staffName ?? "Support";
34
+ const reply = (body, more = {}) => {
35
+ const message = { id: `support:${++n}`, body, at: new Date().toISOString(), author: "staff", authorName: more.authorName ?? staffName, from: "staff", ...(more.replyTo ? { replyTo: more.replyTo } : {}) };
36
+ thread.push(message);
37
+ for (const listener of listeners)
38
+ listener(message);
39
+ return message;
40
+ };
41
+ return {
42
+ sent,
43
+ reply,
44
+ async send(draft, context) {
45
+ const message = { id: `support:${++n}`, body: draft.body, at: new Date().toISOString(), author: context.person?.id ?? "person", ...(context.person?.name ? { authorName: context.person.name } : {}), from: "person", ...(draft.replyTo ? { replyTo: draft.replyTo } : {}) };
46
+ thread.push(message);
47
+ sent.push({ message, context });
48
+ const answer = options.answer ? options.answer(message, context) : `Thanks, ${context.person?.name ?? "there"} — a person will read this and answer here.`;
49
+ if (answer !== undefined)
50
+ setTimeout(() => reply(answer, { replyTo: message.id }), options.delayMs ?? 600);
51
+ return message;
52
+ },
53
+ subscribe(onReply) {
54
+ listeners.add(onReply);
55
+ return () => listeners.delete(onReply);
56
+ },
57
+ async history() {
58
+ return [...thread];
59
+ },
60
+ };
61
+ }
62
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/rooms/support.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAkDvD,kEAAkE;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAwB1C,0DAA0D;AAC1D,SAAS,YAAY,CAA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,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC7R,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,OAAO,6CAA6C,CAAC;YAC3J,IAAI,MAAM,KAAK,SAAS;gBAAE,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;YAC3G,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,SAAS,CAAC,OAAO;YACf,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,OAAO;YACX,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ export { AI_ROOM_ACTS, ASKS_ROOM, DESIGN_ROOM, FRAMEWORK_ROOMS, frameworkRoomTitle, isFrameworkRoom, KEEP_AI_TURN, SETTLE_AI_TURN, SHARE_CONVERSATION } from "./rooms/shape.js";
2
+ export type { AiDoor, ConversationShare, FrameworkRoom } from "./rooms/shape.js";
3
+ export { EDIT_MESSAGE, LONGEST_MESSAGE, LONGEST_ROOM_TITLE, MESSAGE_KIND, MOST_ROOMS, POST_MESSAGE, REMOVE_MESSAGE, ROOM_ACTS, ROOMS_READ_STATE, roomKey } from "./rooms/shape.js";
4
+ export type { AppRooms, MessageRecord, RoomDeclaration } from "./rooms/shape.js";
5
+ export { aiRoomActs, editorRolesOf, frameworkRoomSights, isPlaceless, messageKind, roomActs, roomSights, isRoomsOwn, roomsFolded, roomsPolicy, ROOMS_GRANT, unfoldedApp, withoutTalk, withRooms, mentionsOnIn } from "./rooms/kind.js";
6
+ export { allMessages, appRooms, conversationsOf, hasRooms, mayEdit, mayPostIn, mayReadAiTurn, mayReadRoom, mayRemove, mentionablesOf, mentionsIn, messagesIn, readUpToOf, roomsOf, roomWords, talkAbout, threadKey, threadOf, threadRootOf, threadsIn, threadsOf, unreadFor } from "./rooms/read.js";
7
+ export type { Conversation, ConversationsOptions, Mentionable, MessageThread, ReadUpTo, ResolvedRoom, Unread } from "./rooms/read.js";
8
+ export { appRoomFindings, documentRoomFindings, roomFindings, roomWorldOfApp } from "./rooms/findings.js";
9
+ export type { RoomFinding, RoomFindingCode, RoomWorld } from "./rooms/findings.js";
10
+ export { supportContextOf, memorySupport, SUPPORT_CONTEXT_FRICTION } from "./rooms/support.js";
11
+ export type { MemorySupport, SupportContext, SupportDraft, SupportMessage, SupportReply, SupportTransport, SupportDeclaration } from "./rooms/support.js";
12
+ //# sourceMappingURL=rooms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../src/rooms.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChL,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,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graview/core/rooms` — WHERE THE PEOPLE IN AN APP TALK TO EACH OTHER
3
+ * (Graview HQ feature:f-chat-rooms).
4
+ *
5
+ * The declaration's `rooms`, read: each resolved with its defaults
6
+ * (`roomsOf`), the thread a record has (`threadOf`), what was said in a
7
+ * room or thread as a seat is served it (`messagesIn`), what a person has
8
+ * not read (`unreadFor`) and whom a message mentions (`mentionsIn`); the
9
+ * replies filed under the message they answer (`threadsIn`), every
10
+ * conversation a seat may read (`conversationsOf`) and how much is said
11
+ * about each record (`talkAbout`); who may
12
+ * read, post, edit and remove; and what the checker says of them
13
+ * (`roomFindings`). What `defineApp` and a compiled document fold in — the
14
+ * message kind and its three acts — is `withRooms`. An entry of its own,
15
+ * fetched by a page that draws a room, a thread or an unread count. The
16
+ * shapes (`AppRooms`, `RoomDeclaration`, `MessageRecord`) are on
17
+ * `@graview/core`.
18
+ */
19
+ export { AI_ROOM_ACTS, ASKS_ROOM, DESIGN_ROOM, FRAMEWORK_ROOMS, frameworkRoomTitle, isFrameworkRoom, KEEP_AI_TURN, SETTLE_AI_TURN, SHARE_CONVERSATION } from "./rooms/shape.js";
20
+ export { EDIT_MESSAGE, LONGEST_MESSAGE, LONGEST_ROOM_TITLE, MESSAGE_KIND, MOST_ROOMS, POST_MESSAGE, REMOVE_MESSAGE, ROOM_ACTS, ROOMS_READ_STATE, roomKey } from "./rooms/shape.js";
21
+ export { aiRoomActs, editorRolesOf, frameworkRoomSights, isPlaceless, messageKind, roomActs, roomSights, isRoomsOwn, roomsFolded, roomsPolicy, ROOMS_GRANT, unfoldedApp, withoutTalk, withRooms, mentionsOnIn } from "./rooms/kind.js";
22
+ export { allMessages, appRooms, conversationsOf, hasRooms, mayEdit, mayPostIn, mayReadAiTurn, mayReadRoom, mayRemove, mentionablesOf, mentionsIn, messagesIn, readUpToOf, roomsOf, roomWords, talkAbout, threadKey, threadOf, threadRootOf, threadsIn, threadsOf, unreadFor } from "./rooms/read.js";
23
+ export { appRoomFindings, documentRoomFindings, roomFindings, roomWorldOfApp } from "./rooms/findings.js";
24
+ export { supportContextOf, memorySupport, SUPPORT_CONTEXT_FRICTION } from "./rooms/support.js";
25
+ //# sourceMappingURL=rooms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms.js","sourceRoot":"","sources":["../src/rooms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEhL,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEnL,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvO,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAErS,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1G,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAE,M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GAAG,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,SAAS,EAAE,CA6FtK;AAED,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,CA0R5E"}
package/dist/seen.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isPlaceless } from "./rooms/kind.js";
1
2
  import { batchesOf, undoneIn } from "./ops/log.js";
2
3
  import { checkUndo } from "./ops/undo.js";
3
4
  import { writersOf } from "./ops/writers.js";
@@ -8,7 +9,7 @@ import { PERSON_SEAT } from "./graph/archived.js";
8
9
  import { isUnset } from "./graph/primitives.js";
9
10
  import { seatsKept, takesBindingBack, unseated } from "./binding-served.js";
10
11
  import { presentOf } from "./seat-of.js";
11
- import { FIELD_SIGHT, fieldsJudged, partialSight, recordsOf, sees } from "./permissions/sight.js";
12
+ import { FIELD_SIGHT, fieldsJudged, partialSight, recordsOf, scopedSight, sees } from "./permissions/sight.js";
12
13
  import { diffSnapshots } from "./graph/diff.js";
13
14
  import { CREATED_BY, isTouchedField, judgedOnTouches, TOUCHED_FIELDS, UPDATED_BY } from "./graph/touched.js";
14
15
  import { nodeRefKinds } from "./mutations/node-ref.js";
@@ -55,7 +56,7 @@ export function seesEveryRecord(store, author) {
55
56
  const acting = actingAs(author);
56
57
  // A sight that shows only some fields shows no record until they can be judged: it fails closed here as in `sees`.
57
58
  const judged = fieldsJudged(store);
58
- const inSight = (kind) => !off.has(kind) && (sights.length === 0 || sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, acting) && !sight.own && !sight.via && (judged || !partialSight(sight))));
59
+ const inSight = (kind) => !off.has(kind) && (sights.length === 0 || sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, acting) && !sight.own && !sight.via && !scopedSight(sight) && (judged || !partialSight(sight))));
59
60
  /*
60
61
  * AND NONE OF IT WITHHELD WHOLE (`seatLens`): a record whose required
61
62
  * field names one the seat may not see is not served to it, so a kind
@@ -64,9 +65,17 @@ export function seesEveryRecord(store, author) {
64
65
  * the record is there. Which ids a field names is judged by sight alone,
65
66
  * so this asks no further than one step.
66
67
  */
67
- const wholly = store.schema.kinds.every(inSight);
68
+ /*
69
+ * THE FRAMEWORK'S OWN KINDS STAND OUTSIDE IT (Graview HQ
70
+ * feature:f-chat-rooms): a room's messages are seen by room, so no seat
71
+ * sees every one of them, and that is no reason to tell it less of the
72
+ * app's own records. Their ids say nothing of what is hidden: a message's
73
+ * is minted unguessable (`post-message`).
74
+ */
75
+ const kinds = store.schema.kinds.filter((kind) => !isPlaceless(store.schema.tryDefinition?.(kind)));
76
+ const wholly = kinds.every(inSight);
68
77
  const full = (kind) => inSight(kind) && requiredRefs(store.schema, kind).every((targets) => targets.every((target) => (target === "*" ? wholly : inSight(target))));
69
- const everything = wholly && store.schema.kinds.every(full);
78
+ const everything = wholly && kinds.every(full);
70
79
  return (kind) => everything || (kind !== undefined && full(kind));
71
80
  }
72
81
  /**
@@ -82,7 +91,8 @@ export function toldTouches(store, principal) {
82
91
  return false;
83
92
  const acting = actingAs(principal);
84
93
  const sights = store.policy?.sees ?? [];
85
- const whole = (kind) => sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, acting) && !sight.own && !sight.via && !partialSight(sight));
94
+ const placeless = (kind) => isPlaceless(store.schema.tryDefinition?.(kind));
95
+ const whole = (kind) => placeless(kind) || sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, acting) && !sight.own && !sight.via && !scopedSight(sight) && !partialSight(sight));
86
96
  return sights.every((sight) => !partialSight(sight) || !grantsTo(sight, acting) || sight.kinds.every(whole));
87
97
  }
88
98
  /**
@@ -346,6 +356,15 @@ function lensFor(store, principal) {
346
356
  };
347
357
  // Pinned, a record is served once however often the reading asks for it: no record or id changes under a pin.
348
358
  const servedOnce = new WeakMap();
359
+ /*
360
+ * Unpinned, a record is served again only once the store has moved: what
361
+ * judges it — the policy, what is off, who is bound, the records a sight
362
+ * follows — moves only by an op, so the same record asked twice at one
363
+ * moment (every act weighed over the same chosen records) is judged once.
364
+ */
365
+ const servedAt = new WeakMap();
366
+ const moment = () => `${store.version}:${length()}`;
367
+ let pinnedAt;
349
368
  const served = pinned
350
369
  ? (node) => {
351
370
  let held = servedOnce.get(node);
@@ -353,7 +372,15 @@ function lensFor(store, principal) {
353
372
  servedOnce.set(node, (held = { node: judge(node) }));
354
373
  return held.node;
355
374
  }
356
- : judge;
375
+ : (node) => {
376
+ const at = moment();
377
+ const held = servedAt.get(node);
378
+ if (held && held.at === at)
379
+ return held.node;
380
+ const out = judge(node);
381
+ servedAt.set(node, { at, node: out });
382
+ return out;
383
+ };
357
384
  const showsNow = (id) => {
358
385
  if (!sees(id))
359
386
  return false;
@@ -395,8 +422,13 @@ function lensFor(store, principal) {
395
422
  toldTouches: told,
396
423
  reboundTouches,
397
424
  keepsSeat,
398
- // A pinned lens is already of one moment: pinning it again is itself.
399
- pin: pinned ? () => lens : () => pinWith(fresh()),
425
+ // A pinned lens is already of one moment: pinning it again is itself. And the seat's own lens pins once a moment: every read until the store moves shares what was judged.
426
+ pin: pinned ? () => lens : () => {
427
+ const at = moment();
428
+ if (pinnedAt?.at !== at)
429
+ pinnedAt = { at, lens: pinWith(fresh()) };
430
+ return pinnedAt.lens;
431
+ },
400
432
  };
401
433
  // Keeping what its sight keeps of a record's fields, when field sight is loaded (Roadmap f-field-sight).
402
434
  return FIELD_SIGHT.lens?.(lens, store, principal) ?? lens;
@@ -408,7 +440,27 @@ function lensFor(store, principal) {
408
440
  const records = recordsOf(store.log);
409
441
  return over(pinnedSight(store, principal, memo.judged, memo.unnamed), () => (writers ??= writersOf(store.log)), () => at, (id) => graph.getNode(id)?.kind ?? records.kindOf(id), memo);
410
442
  }
411
- const lens = over(seesId(store, principal), () => writersOf(store.log), length, (id) => graph.getNode(id)?.kind ?? recordsOf(store.log).kindOf(id));
443
+ /*
444
+ * The seat's own lens judges each id once a moment: what judges it — the
445
+ * policy, what is off, who is bound, who made what, the records a sight
446
+ * follows — moves only by an op, so a reading of every record (the scene
447
+ * drawn again as a hand lets go) asks each id once until the store moves.
448
+ */
449
+ const judgeId = seesId(store, principal);
450
+ let judgedAt;
451
+ const judgedIds = new Map();
452
+ const seesNow = (id) => {
453
+ const at = `${store.version}:${length()}`;
454
+ if (at !== judgedAt) {
455
+ judgedIds.clear();
456
+ judgedAt = at;
457
+ }
458
+ let seen = judgedIds.get(id);
459
+ if (seen === undefined)
460
+ judgedIds.set(id, (seen = judgeId(id)));
461
+ return seen;
462
+ };
463
+ const lens = over(seesNow, () => writersOf(store.log), length, (id) => graph.getNode(id)?.kind ?? recordsOf(store.log).kindOf(id));
412
464
  return { lens, pinWith };
413
465
  }
414
466
  const SERVED_LOGS = new WeakMap();
@@ -859,16 +911,36 @@ export function seatView(store, principal) {
859
911
  * store; a whole graph, a snapshot or a neighborhood by the lens pinned
860
912
  * for that one reading, each id and record judged once in it.
861
913
  */
862
- const judging = (seat) => {
914
+ const judging = (seat, ofOneMoment = false) => {
863
915
  const served = (node) => (node === undefined ? undefined : seat.served(node));
864
916
  const seenNode = (node) => served(node) !== undefined;
865
917
  const seenId = (id) => seenNode(full.getNode(id));
866
- const seenEdge = (edge) => seenId(edge.from) && seenId(edge.to) && !namesUnseen(edge, seat.sees);
918
+ const judgeEdge = (edge) => seenId(edge.from) && seenId(edge.to) && !namesUnseen(edge, seat.sees);
919
+ // Pinned, a link is judged once however often a reading asks for it: no record or link changes under a pin.
920
+ const edgesSeen = ofOneMoment ? new WeakMap() : undefined;
921
+ const seenEdge = (edge) => {
922
+ if (!edgesSeen)
923
+ return judgeEdge(edge);
924
+ let seen = edgesSeen.get(edge);
925
+ if (seen === undefined)
926
+ edgesSeen.set(edge, (seen = judgeEdge(edge)));
927
+ return seen;
928
+ };
867
929
  const servedAll = (nodes) => nodes.flatMap((node) => served(node) ?? []);
868
930
  return { served, seenNode, seenId, seenEdge, servedAll };
869
931
  };
870
932
  const { served, seenId } = judging(lens);
871
- const pinned = () => judging(lens.pin?.() ?? lens);
933
+ // Each moment's pinned lens judged through one set of reads, so what one read judged the next does not judge again.
934
+ const judgingOf = new WeakMap();
935
+ const pinned = () => {
936
+ const seat = lens.pin?.() ?? lens;
937
+ if (seat === lens)
938
+ return judging(lens);
939
+ let reads = judgingOf.get(seat);
940
+ if (!reads)
941
+ judgingOf.set(seat, (reads = judging(seat, true)));
942
+ return reads;
943
+ };
872
944
  /** A graph of another moment — an epoch's base, at `seq` — as this seat is served it: its records, as who wrote them then, and its links between them. */
873
945
  const servedGraph = (snapshot, seq) => {
874
946
  const writers = writersOf(store.log);