@niscorp/moss 0.3.3 → 0.5.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 (175) hide show
  1. package/CHANGELOG.md +534 -0
  2. package/DESIGN.md +265 -49
  3. package/DOCS.md +1524 -341
  4. package/README.md +37 -20
  5. package/dist/app-BoVB0_0j.d.ts +143 -0
  6. package/dist/app-Cc8VnOz8.d.cts +143 -0
  7. package/dist/chunk-3RIWTXGI.cjs +174 -0
  8. package/dist/chunk-3RIWTXGI.cjs.map +1 -0
  9. package/dist/chunk-4ZGAFZGS.js +152 -0
  10. package/dist/chunk-4ZGAFZGS.js.map +1 -0
  11. package/dist/chunk-5U2ZZUI5.cjs +137 -0
  12. package/dist/chunk-5U2ZZUI5.cjs.map +1 -0
  13. package/dist/chunk-6QPTMKRE.cjs +53 -0
  14. package/dist/chunk-6QPTMKRE.cjs.map +1 -0
  15. package/dist/chunk-BQRPR2F7.js +2704 -0
  16. package/dist/chunk-BQRPR2F7.js.map +1 -0
  17. package/dist/chunk-BZK37HR3.cjs +2716 -0
  18. package/dist/chunk-BZK37HR3.cjs.map +1 -0
  19. package/dist/chunk-FTFME3HS.cjs +383 -0
  20. package/dist/chunk-FTFME3HS.cjs.map +1 -0
  21. package/dist/{chunk-NE2EXMTO.js → chunk-FTZ6NFKZ.js} +43 -16
  22. package/dist/chunk-FTZ6NFKZ.js.map +1 -0
  23. package/dist/chunk-IUJ2TRNB.cjs +57 -0
  24. package/dist/chunk-IUJ2TRNB.cjs.map +1 -0
  25. package/dist/chunk-IW3A2YIC.js +49 -0
  26. package/dist/chunk-IW3A2YIC.js.map +1 -0
  27. package/dist/chunk-JYBHJDT7.cjs +30 -0
  28. package/dist/chunk-JYBHJDT7.cjs.map +1 -0
  29. package/dist/chunk-NRZ3Z2FF.js +61 -0
  30. package/dist/chunk-NRZ3Z2FF.js.map +1 -0
  31. package/dist/chunk-PCPQMC7A.js +26 -0
  32. package/dist/chunk-PCPQMC7A.js.map +1 -0
  33. package/dist/chunk-T5BRTFKP.js +53 -0
  34. package/dist/chunk-T5BRTFKP.js.map +1 -0
  35. package/dist/chunk-TGKDS2T7.cjs +330 -0
  36. package/dist/chunk-TGKDS2T7.cjs.map +1 -0
  37. package/dist/chunk-TLNRFAQ6.js +326 -0
  38. package/dist/chunk-TLNRFAQ6.js.map +1 -0
  39. package/dist/chunk-VKQPOZDJ.cjs +72 -0
  40. package/dist/chunk-VKQPOZDJ.cjs.map +1 -0
  41. package/dist/chunk-ZWB6QDGF.js +374 -0
  42. package/dist/chunk-ZWB6QDGF.js.map +1 -0
  43. package/dist/client/node.cjs.map +1 -1
  44. package/dist/client/node.d.cts +3 -1
  45. package/dist/client/node.d.ts +3 -1
  46. package/dist/client/node.js.map +1 -1
  47. package/dist/client.cjs +14 -302
  48. package/dist/client.cjs.map +1 -1
  49. package/dist/client.d.cts +9 -33
  50. package/dist/client.d.ts +9 -33
  51. package/dist/client.js +2 -2
  52. package/dist/document-CU3muGbz.d.cts +169 -0
  53. package/dist/document-UFbAd-Ka.d.ts +169 -0
  54. package/dist/env-CY8EGWnD.d.cts +24 -0
  55. package/dist/env-DEPqqHEb.d.ts +24 -0
  56. package/dist/index-BuDuOSyx.d.cts +130 -0
  57. package/dist/index-BuDuOSyx.d.ts +130 -0
  58. package/dist/index.cjs +45 -3918
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.cts +46 -100
  61. package/dist/index.d.ts +46 -100
  62. package/dist/index.js +4 -94
  63. package/dist/index.js.map +1 -1
  64. package/dist/integrations.cjs +975 -0
  65. package/dist/integrations.cjs.map +1 -0
  66. package/dist/integrations.d.cts +63 -0
  67. package/dist/integrations.d.ts +63 -0
  68. package/dist/integrations.js +972 -0
  69. package/dist/integrations.js.map +1 -0
  70. package/dist/messages-CSwCJgH3.d.cts +51 -0
  71. package/dist/messages-CSwCJgH3.d.ts +51 -0
  72. package/dist/node.cjs +17 -3457
  73. package/dist/node.cjs.map +1 -1
  74. package/dist/node.d.cts +13 -10
  75. package/dist/node.d.ts +13 -10
  76. package/dist/node.js +5 -3
  77. package/dist/protocol.cjs +24 -0
  78. package/dist/protocol.cjs.map +1 -0
  79. package/dist/protocol.d.cts +11 -0
  80. package/dist/protocol.d.ts +11 -0
  81. package/dist/protocol.js +3 -0
  82. package/dist/protocol.js.map +1 -0
  83. package/dist/slots-96gNc9uH.d.cts +12 -0
  84. package/dist/slots-BX5N0Juv.d.ts +14 -0
  85. package/dist/slots-CU-AbnJg.d.cts +14 -0
  86. package/dist/slots-sLXDrlbG.d.ts +12 -0
  87. package/dist/socket-D90h1xSV.d.cts +24 -0
  88. package/dist/socket-D90h1xSV.d.ts +24 -0
  89. package/dist/targets-DInbLzff.d.cts +9 -0
  90. package/dist/targets-DInbLzff.d.ts +9 -0
  91. package/dist/terminal/dom/index.cjs +8 -3
  92. package/dist/terminal/dom/index.cjs.map +1 -1
  93. package/dist/terminal/dom/index.d.cts +3 -0
  94. package/dist/terminal/dom/index.d.ts +3 -0
  95. package/dist/terminal/dom/index.js +8 -3
  96. package/dist/terminal/dom/index.js.map +1 -1
  97. package/dist/terminal/dom/server.cjs +2 -7
  98. package/dist/terminal/dom/server.cjs.map +1 -1
  99. package/dist/terminal/dom/server.d.cts +3 -5
  100. package/dist/terminal/dom/server.d.ts +3 -5
  101. package/dist/terminal/dom/server.js +2 -7
  102. package/dist/terminal/dom/server.js.map +1 -1
  103. package/dist/terminal/index.cjs +22 -300
  104. package/dist/terminal/index.cjs.map +1 -1
  105. package/dist/terminal/index.d.cts +7 -2
  106. package/dist/terminal/index.d.ts +7 -2
  107. package/dist/terminal/index.js +21 -22
  108. package/dist/terminal/index.js.map +1 -1
  109. package/dist/terminal/ink/index.d.ts +3 -2
  110. package/dist/terminal/ink/index.js +149 -106
  111. package/dist/terminal/ink/index.js.map +1 -1
  112. package/dist/terminal/react/index.cjs +21 -71
  113. package/dist/terminal/react/index.cjs.map +1 -1
  114. package/dist/terminal/react/index.d.cts +5 -2
  115. package/dist/terminal/react/index.d.ts +5 -2
  116. package/dist/terminal/react/index.js +17 -20
  117. package/dist/terminal/react/index.js.map +1 -1
  118. package/dist/terminal/react/server.cjs +4 -68
  119. package/dist/terminal/react/server.cjs.map +1 -1
  120. package/dist/terminal/react/server.d.cts +9 -6
  121. package/dist/terminal/react/server.d.ts +9 -6
  122. package/dist/terminal/react/server.js +3 -18
  123. package/dist/terminal/react/server.js.map +1 -1
  124. package/dist/terminal/tty/index.cjs +147 -130
  125. package/dist/terminal/tty/index.cjs.map +1 -1
  126. package/dist/terminal/tty/index.d.cts +4 -2
  127. package/dist/terminal/tty/index.d.ts +4 -2
  128. package/dist/terminal/tty/index.js +147 -130
  129. package/dist/terminal/tty/index.js.map +1 -1
  130. package/dist/terminal/vue/index.cjs +20 -72
  131. package/dist/terminal/vue/index.cjs.map +1 -1
  132. package/dist/terminal/vue/index.d.cts +8 -12
  133. package/dist/terminal/vue/index.d.ts +8 -12
  134. package/dist/terminal/vue/index.js +45 -1
  135. package/dist/terminal/vue/index.js.map +1 -1
  136. package/dist/terminal/vue/server.cjs +4 -76
  137. package/dist/terminal/vue/server.cjs.map +1 -1
  138. package/dist/terminal/vue/server.d.cts +7 -6
  139. package/dist/terminal/vue/server.d.ts +7 -6
  140. package/dist/terminal/vue/server.js +3 -10
  141. package/dist/terminal/vue/server.js.map +1 -1
  142. package/dist/tide.cjs +41 -0
  143. package/dist/tide.cjs.map +1 -0
  144. package/dist/tide.d.cts +25 -0
  145. package/dist/tide.d.ts +25 -0
  146. package/dist/tide.js +39 -0
  147. package/dist/tide.js.map +1 -0
  148. package/dist/unverified.cjs +12 -0
  149. package/dist/unverified.cjs.map +1 -0
  150. package/dist/unverified.d.cts +7 -0
  151. package/dist/unverified.d.ts +7 -0
  152. package/dist/unverified.js +10 -0
  153. package/dist/unverified.js.map +1 -0
  154. package/dist/vite.cjs +96 -232
  155. package/dist/vite.cjs.map +1 -1
  156. package/dist/vite.d.cts +6 -8
  157. package/dist/vite.d.ts +6 -8
  158. package/dist/vite.js +97 -71
  159. package/dist/vite.js.map +1 -1
  160. package/package.json +56 -13
  161. package/dist/chunk-4T6KAXBP.js +0 -256
  162. package/dist/chunk-4T6KAXBP.js.map +0 -1
  163. package/dist/chunk-AUZMT3GL.js +0 -3406
  164. package/dist/chunk-AUZMT3GL.js.map +0 -1
  165. package/dist/chunk-EMRDIZLY.js +0 -99
  166. package/dist/chunk-EMRDIZLY.js.map +0 -1
  167. package/dist/chunk-HOZID4EM.js +0 -366
  168. package/dist/chunk-HOZID4EM.js.map +0 -1
  169. package/dist/chunk-NE2EXMTO.js.map +0 -1
  170. package/dist/chunk-SK4PDGEE.js +0 -55
  171. package/dist/chunk-SK4PDGEE.js.map +0 -1
  172. package/dist/document-DhWxieUc.d.cts +0 -1024
  173. package/dist/document-DhWxieUc.d.ts +0 -1024
  174. package/dist/slots-Do9ScG7v.d.cts +0 -37
  175. package/dist/slots-Do9ScG7v.d.ts +0 -37
package/dist/client.d.ts CHANGED
@@ -1,20 +1,14 @@
1
1
  import { RenderNode, NovaEvent } from '@niscorp/nova';
2
+ import { D as DocumentSnapshot } from './messages-CSwCJgH3.js';
3
+ import { W as WireEnv } from './env-DEPqqHEb.js';
4
+ export { b as browserEnv, r as readDocumentSnapshot } from './env-DEPqqHEb.js';
5
+ import 'zod';
2
6
 
3
- type WireTokenStore = {
4
- load: () => string | null;
5
- save: (token: string) => void;
6
- clear: () => void;
7
- held?: () => boolean;
8
- key?: string;
9
- };
10
- type WireEnv = {
11
- tokens: WireTokenStore;
12
- socket: (upgrade: {
13
- url: string;
14
- offered: string[];
15
- }) => WebSocket;
16
- defaultUrl: () => string;
7
+ type WireSnapshot = {
8
+ frame: RenderNode[];
9
+ trees: ReadonlyMap<string, RenderNode[]>;
17
10
  };
11
+
18
12
  type WireConfig = {
19
13
  url?: string;
20
14
  env?: WireEnv;
@@ -22,20 +16,6 @@ type WireConfig = {
22
16
  initial?: DocumentSnapshot;
23
17
  path?: string;
24
18
  };
25
- type DocumentSnapshot = {
26
- frame: RenderNode[];
27
- trees: Record<string, RenderNode[]>;
28
- seed?: string;
29
- principal: boolean;
30
- path?: string;
31
- live?: boolean;
32
- };
33
- declare const SNAPSHOT_ELEMENT_ID = "nisc-snapshot";
34
- declare const readDocumentSnapshot: (doc?: Pick<Document, "getElementById">) => DocumentSnapshot | undefined;
35
- type WireSnapshot = {
36
- frame: RenderNode[];
37
- trees: ReadonlyMap<string, RenderNode[]>;
38
- };
39
19
  type WireStatus = 'connecting' | 'open' | 'closed' | 'incompatible' | 'static';
40
20
  type Wire = {
41
21
  subscribe: (listener: () => void) => () => void;
@@ -48,10 +28,6 @@ type Wire = {
48
28
  popTo: (canvas: string, instance: string) => void;
49
29
  dispose: () => void;
50
30
  };
51
- declare const browserEnv: (config?: {
52
- tokenKey?: string;
53
- cookie?: boolean;
54
- }) => WireEnv;
55
31
  declare const createWire: (config?: WireConfig) => Wire;
56
32
 
57
- export { type DocumentSnapshot, SNAPSHOT_ELEMENT_ID, type Wire, type WireConfig, type WireEnv, type WireSnapshot, type WireStatus, type WireTokenStore, browserEnv, createWire, readDocumentSnapshot };
33
+ export { DocumentSnapshot, type Wire, type WireConfig, WireEnv, type WireSnapshot, type WireStatus, createWire };
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- export { SNAPSHOT_ELEMENT_ID, browserEnv, createWire, readDocumentSnapshot } from './chunk-4T6KAXBP.js';
2
- import './chunk-HOZID4EM.js';
1
+ export { browserEnv, createWire, readDocumentSnapshot } from './chunk-TLNRFAQ6.js';
2
+ import './chunk-4ZGAFZGS.js';
3
3
  //# sourceMappingURL=client.js.map
4
4
  //# sourceMappingURL=client.js.map
@@ -0,0 +1,169 @@
1
+ import { Hono } from 'hono';
2
+ import { VerifyReport } from '@niscorp/charter';
3
+ import { Shell, RenderNode, ActionDefinition } from '@niscorp/nova';
4
+ import { ScopePolicy } from '@niscorp/vex';
5
+ import { S as SocketAccept } from './socket-D90h1xSV.cjs';
6
+ import { ScreenHead } from '@niscorp/nova/document';
7
+
8
+ type IdentityReport = {
9
+ principal: string;
10
+ since: number;
11
+ lastSeen: number;
12
+ };
13
+ type IdentityRecord = {
14
+ roles: readonly string[];
15
+ scope: Record<string, unknown>;
16
+ installed?: readonly string[];
17
+ tag?: string;
18
+ };
19
+
20
+ type ResolvedIdentity = {
21
+ roles: readonly string[];
22
+ scope: Record<string, unknown>;
23
+ installed: readonly string[] | undefined;
24
+ memoKey: string;
25
+ record?: IdentityRecord;
26
+ };
27
+
28
+ type Catalog = {
29
+ ids: readonly string[];
30
+ hash: string;
31
+ };
32
+
33
+ type ExecuteAs = (role: string, fingerprint: string, context: Record<string, unknown>, scope?: Record<string, unknown>) => Promise<unknown>;
34
+
35
+ type ShellConnection = {
36
+ send: (text: string) => void;
37
+ close: (code?: number, reason?: string) => void;
38
+ seal?: (token: string) => Promise<string>;
39
+ };
40
+ type ShellSession = {
41
+ readonly shell: Shell;
42
+ attach: (connection: ShellConnection, options?: {
43
+ delta?: boolean;
44
+ }) => void;
45
+ detach: (connection: ShellConnection) => void;
46
+ resync: (connection: ShellConnection) => void;
47
+ dispatch: (canvas: string, event: Record<string, unknown>) => void;
48
+ publish: (channel: string, payload?: unknown) => void;
49
+ back: () => boolean;
50
+ popTo: (canvas: string, instance: string) => void;
51
+ reset: () => void;
52
+ };
53
+ type ShellReport = {
54
+ principal: string;
55
+ connections: number;
56
+ since: number;
57
+ idleSince: number | null;
58
+ canvases: {
59
+ id: string;
60
+ actions: readonly string[];
61
+ }[];
62
+ };
63
+ type ShellSnapshot = {
64
+ frame: RenderNode[];
65
+ trees: Record<string, RenderNode[]>;
66
+ seed?: string;
67
+ settled: boolean;
68
+ live: boolean;
69
+ why: string[];
70
+ drawnWith: string[];
71
+ };
72
+ type ShellOpening = {
73
+ seed?: string;
74
+ inputs?: Record<string, Record<string, unknown>>;
75
+ };
76
+ type ShellHost = {
77
+ session: (token: string | null, principal: string | null, options?: ShellOpening) => Promise<ShellSession>;
78
+ snapshot: (token: string | null, principal: string | null, options?: {
79
+ waitMs?: number;
80
+ inputs?: ShellOpening['inputs'];
81
+ }) => Promise<ShellSnapshot>;
82
+ deliver: (principal: string, channel: string, payload?: unknown) => boolean;
83
+ list: () => ShellReport[];
84
+ reset: (principal: string) => boolean;
85
+ };
86
+
87
+ type Env = {
88
+ Variables: {
89
+ principal: string | null;
90
+ resolved: ResolvedIdentity;
91
+ };
92
+ };
93
+ type MossServer = Hono<Env> & {
94
+ socket: SocketAccept;
95
+ shells?: ShellHost;
96
+ principalOf: (token: string) => Promise<string | null>;
97
+ page: (path: string) => {
98
+ name: string;
99
+ host: ShellHost;
100
+ inputs: Record<string, Record<string, unknown>>;
101
+ } | undefined;
102
+ pages: readonly {
103
+ name: string;
104
+ path: string;
105
+ }[];
106
+ refresh: () => void;
107
+ replaceActions: (source: string, actions: Record<string, ActionDefinition>) => void;
108
+ actions: () => Readonly<Record<string, ActionDefinition>>;
109
+ catalogOf: (principal: string | null) => Promise<Catalog>;
110
+ policyForRoles: (roles: readonly string[]) => ScopePolicy;
111
+ charterReport: () => VerifyReport;
112
+ invalidateIdentity: (principal: string) => boolean;
113
+ identity: (principal: string | null) => Promise<IdentityRecord>;
114
+ executeAs: ExecuteAs;
115
+ invalidateTenant: (tag: string) => number;
116
+ nudge: (principal: string, channel: string) => void;
117
+ close: () => void;
118
+ identities?: {
119
+ list: () => IdentityReport[];
120
+ meter: () => {
121
+ size: number;
122
+ max: number;
123
+ resolved: number;
124
+ evicted: number;
125
+ expired: number;
126
+ };
127
+ };
128
+ };
129
+
130
+ type DocumentHost = Pick<ShellHost, 'snapshot'>;
131
+ type DocumentSource = {
132
+ principalOf: (token: string) => Promise<string | null>;
133
+ page: (path: string) => {
134
+ name: string;
135
+ host: DocumentHost;
136
+ inputs: Record<string, Record<string, unknown>>;
137
+ } | undefined;
138
+ shells?: DocumentHost;
139
+ };
140
+ type DocumentConfig = {
141
+ server: DocumentSource;
142
+ template: string;
143
+ request: {
144
+ path: string;
145
+ cookie?: string | null;
146
+ host?: string | null;
147
+ };
148
+ draw: (snapshot: ShellSnapshot) => string | Promise<string>;
149
+ htmlAttributes?: (snapshot: ShellSnapshot) => Record<string, string>;
150
+ site?: string;
151
+ tokenKey?: string;
152
+ waitMs?: number;
153
+ root?: string;
154
+ };
155
+ type DrawnDocument = {
156
+ html: string;
157
+ headers: Record<string, string>;
158
+ drawn: boolean;
159
+ principal: string | null;
160
+ page?: string;
161
+ head?: ScreenHead;
162
+ live?: boolean;
163
+ why?: string[];
164
+ drawnWith?: string[];
165
+ settled?: boolean;
166
+ };
167
+ declare const renderDocument: (config: DocumentConfig) => Promise<DrawnDocument>;
168
+
169
+ export { type DocumentConfig as D, type ExecuteAs as E, type IdentityRecord as I, type MossServer as M, type ShellHost as S, type DrawnDocument as a, type ShellSnapshot as b, renderDocument as r };
@@ -0,0 +1,169 @@
1
+ import { Hono } from 'hono';
2
+ import { VerifyReport } from '@niscorp/charter';
3
+ import { Shell, RenderNode, ActionDefinition } from '@niscorp/nova';
4
+ import { ScopePolicy } from '@niscorp/vex';
5
+ import { S as SocketAccept } from './socket-D90h1xSV.js';
6
+ import { ScreenHead } from '@niscorp/nova/document';
7
+
8
+ type IdentityReport = {
9
+ principal: string;
10
+ since: number;
11
+ lastSeen: number;
12
+ };
13
+ type IdentityRecord = {
14
+ roles: readonly string[];
15
+ scope: Record<string, unknown>;
16
+ installed?: readonly string[];
17
+ tag?: string;
18
+ };
19
+
20
+ type ResolvedIdentity = {
21
+ roles: readonly string[];
22
+ scope: Record<string, unknown>;
23
+ installed: readonly string[] | undefined;
24
+ memoKey: string;
25
+ record?: IdentityRecord;
26
+ };
27
+
28
+ type Catalog = {
29
+ ids: readonly string[];
30
+ hash: string;
31
+ };
32
+
33
+ type ExecuteAs = (role: string, fingerprint: string, context: Record<string, unknown>, scope?: Record<string, unknown>) => Promise<unknown>;
34
+
35
+ type ShellConnection = {
36
+ send: (text: string) => void;
37
+ close: (code?: number, reason?: string) => void;
38
+ seal?: (token: string) => Promise<string>;
39
+ };
40
+ type ShellSession = {
41
+ readonly shell: Shell;
42
+ attach: (connection: ShellConnection, options?: {
43
+ delta?: boolean;
44
+ }) => void;
45
+ detach: (connection: ShellConnection) => void;
46
+ resync: (connection: ShellConnection) => void;
47
+ dispatch: (canvas: string, event: Record<string, unknown>) => void;
48
+ publish: (channel: string, payload?: unknown) => void;
49
+ back: () => boolean;
50
+ popTo: (canvas: string, instance: string) => void;
51
+ reset: () => void;
52
+ };
53
+ type ShellReport = {
54
+ principal: string;
55
+ connections: number;
56
+ since: number;
57
+ idleSince: number | null;
58
+ canvases: {
59
+ id: string;
60
+ actions: readonly string[];
61
+ }[];
62
+ };
63
+ type ShellSnapshot = {
64
+ frame: RenderNode[];
65
+ trees: Record<string, RenderNode[]>;
66
+ seed?: string;
67
+ settled: boolean;
68
+ live: boolean;
69
+ why: string[];
70
+ drawnWith: string[];
71
+ };
72
+ type ShellOpening = {
73
+ seed?: string;
74
+ inputs?: Record<string, Record<string, unknown>>;
75
+ };
76
+ type ShellHost = {
77
+ session: (token: string | null, principal: string | null, options?: ShellOpening) => Promise<ShellSession>;
78
+ snapshot: (token: string | null, principal: string | null, options?: {
79
+ waitMs?: number;
80
+ inputs?: ShellOpening['inputs'];
81
+ }) => Promise<ShellSnapshot>;
82
+ deliver: (principal: string, channel: string, payload?: unknown) => boolean;
83
+ list: () => ShellReport[];
84
+ reset: (principal: string) => boolean;
85
+ };
86
+
87
+ type Env = {
88
+ Variables: {
89
+ principal: string | null;
90
+ resolved: ResolvedIdentity;
91
+ };
92
+ };
93
+ type MossServer = Hono<Env> & {
94
+ socket: SocketAccept;
95
+ shells?: ShellHost;
96
+ principalOf: (token: string) => Promise<string | null>;
97
+ page: (path: string) => {
98
+ name: string;
99
+ host: ShellHost;
100
+ inputs: Record<string, Record<string, unknown>>;
101
+ } | undefined;
102
+ pages: readonly {
103
+ name: string;
104
+ path: string;
105
+ }[];
106
+ refresh: () => void;
107
+ replaceActions: (source: string, actions: Record<string, ActionDefinition>) => void;
108
+ actions: () => Readonly<Record<string, ActionDefinition>>;
109
+ catalogOf: (principal: string | null) => Promise<Catalog>;
110
+ policyForRoles: (roles: readonly string[]) => ScopePolicy;
111
+ charterReport: () => VerifyReport;
112
+ invalidateIdentity: (principal: string) => boolean;
113
+ identity: (principal: string | null) => Promise<IdentityRecord>;
114
+ executeAs: ExecuteAs;
115
+ invalidateTenant: (tag: string) => number;
116
+ nudge: (principal: string, channel: string) => void;
117
+ close: () => void;
118
+ identities?: {
119
+ list: () => IdentityReport[];
120
+ meter: () => {
121
+ size: number;
122
+ max: number;
123
+ resolved: number;
124
+ evicted: number;
125
+ expired: number;
126
+ };
127
+ };
128
+ };
129
+
130
+ type DocumentHost = Pick<ShellHost, 'snapshot'>;
131
+ type DocumentSource = {
132
+ principalOf: (token: string) => Promise<string | null>;
133
+ page: (path: string) => {
134
+ name: string;
135
+ host: DocumentHost;
136
+ inputs: Record<string, Record<string, unknown>>;
137
+ } | undefined;
138
+ shells?: DocumentHost;
139
+ };
140
+ type DocumentConfig = {
141
+ server: DocumentSource;
142
+ template: string;
143
+ request: {
144
+ path: string;
145
+ cookie?: string | null;
146
+ host?: string | null;
147
+ };
148
+ draw: (snapshot: ShellSnapshot) => string | Promise<string>;
149
+ htmlAttributes?: (snapshot: ShellSnapshot) => Record<string, string>;
150
+ site?: string;
151
+ tokenKey?: string;
152
+ waitMs?: number;
153
+ root?: string;
154
+ };
155
+ type DrawnDocument = {
156
+ html: string;
157
+ headers: Record<string, string>;
158
+ drawn: boolean;
159
+ principal: string | null;
160
+ page?: string;
161
+ head?: ScreenHead;
162
+ live?: boolean;
163
+ why?: string[];
164
+ drawnWith?: string[];
165
+ settled?: boolean;
166
+ };
167
+ declare const renderDocument: (config: DocumentConfig) => Promise<DrawnDocument>;
168
+
169
+ export { type DocumentConfig as D, type ExecuteAs as E, type IdentityRecord as I, type MossServer as M, type ShellHost as S, type DrawnDocument as a, type ShellSnapshot as b, renderDocument as r };
@@ -0,0 +1,24 @@
1
+ import { D as DocumentSnapshot } from './messages-CSwCJgH3.cjs';
2
+
3
+ type WireTokenStore = {
4
+ load: () => string | null;
5
+ save: (token: string) => void;
6
+ clear: () => void;
7
+ held?: () => boolean;
8
+ key?: string;
9
+ };
10
+ type WireEnv = {
11
+ tokens: WireTokenStore;
12
+ socket: (upgrade: {
13
+ url: string;
14
+ offered: string[];
15
+ }) => WebSocket;
16
+ defaultUrl: () => string;
17
+ };
18
+ declare const browserEnv: (config?: {
19
+ tokenKey?: string;
20
+ cookie?: boolean;
21
+ }) => WireEnv;
22
+ declare const readDocumentSnapshot: (doc?: Pick<Document, "getElementById">) => DocumentSnapshot | undefined;
23
+
24
+ export { type WireEnv as W, browserEnv as b, readDocumentSnapshot as r };
@@ -0,0 +1,24 @@
1
+ import { D as DocumentSnapshot } from './messages-CSwCJgH3.js';
2
+
3
+ type WireTokenStore = {
4
+ load: () => string | null;
5
+ save: (token: string) => void;
6
+ clear: () => void;
7
+ held?: () => boolean;
8
+ key?: string;
9
+ };
10
+ type WireEnv = {
11
+ tokens: WireTokenStore;
12
+ socket: (upgrade: {
13
+ url: string;
14
+ offered: string[];
15
+ }) => WebSocket;
16
+ defaultUrl: () => string;
17
+ };
18
+ declare const browserEnv: (config?: {
19
+ tokenKey?: string;
20
+ cookie?: boolean;
21
+ }) => WireEnv;
22
+ declare const readDocumentSnapshot: (doc?: Pick<Document, "getElementById">) => DocumentSnapshot | undefined;
23
+
24
+ export { type WireEnv as W, browserEnv as b, readDocumentSnapshot as r };
@@ -0,0 +1,130 @@
1
+ import { Context, Next, Hono } from 'hono';
2
+ import { Charter } from '@niscorp/charter';
3
+ import { ActionDefinition, FetchFn } from '@niscorp/nova';
4
+ import { Sequence, Upgrader } from '@niscorp/strata';
5
+ import { DocumentStore } from '@niscorp/strata/postgres';
6
+ import { PgPool, MutationClient, CacheBackend, QueryEngineConfig, SeedEntry, SeedMutation, WriteEvent } from '@niscorp/vex';
7
+ import { z } from 'zod';
8
+
9
+ type SessionVerifier = (token: string) => string | null | Promise<string | null>;
10
+ type NiscRuntime = {
11
+ pool: PgPool;
12
+ db: MutationClient;
13
+ cache?: CacheBackend;
14
+ vexConfig?: QueryEngineConfig['config'];
15
+ session: SessionVerifier | 'sessions' | 'dev-open';
16
+ origins?: readonly string[];
17
+ migrations?: 'apply' | 'verify';
18
+ tables?: readonly Sequence[];
19
+ shellIdleMs?: number;
20
+ anonymousShellMax?: number;
21
+ endpointTimeoutMs?: number;
22
+ sessionRevalidateMs?: number;
23
+ identityMax?: number;
24
+ identityIdleMs?: number;
25
+ shellFrameDelta?: boolean;
26
+ socketCompression?: boolean | Record<string, unknown>;
27
+ socketMaxMessageBytes?: number;
28
+ operatorKey?: string;
29
+ operatorGate?: (c: Context, next: Next) => Response | void | Promise<Response | void>;
30
+ fabric?: Fabric;
31
+ telemetry?: Telemetry;
32
+ };
33
+ type TelemetrySpan = {
34
+ name: string;
35
+ startUnixNano: number;
36
+ endUnixNano: number;
37
+ status: 'ok' | 'error' | 'refused';
38
+ attributes: Record<string, string | number | boolean>;
39
+ traceId?: string;
40
+ spanId?: string;
41
+ parentSpanId?: string;
42
+ };
43
+ type Telemetry = {
44
+ emit: (span: TelemetrySpan) => void;
45
+ };
46
+ declare const FabricMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ origin: z.ZodString;
48
+ kind: z.ZodLiteral<"invalidate-identity">;
49
+ principal: z.ZodString;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ origin: z.ZodString;
52
+ kind: z.ZodLiteral<"invalidate-tenant">;
53
+ tag: z.ZodString;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ origin: z.ZodString;
56
+ kind: z.ZodLiteral<"nudge">;
57
+ principal: z.ZodString;
58
+ channel: z.ZodString;
59
+ }, z.core.$strict>], "kind">;
60
+ type FabricMessage = z.infer<typeof FabricMessageSchema>;
61
+ type Fabric = {
62
+ publish: (message: FabricMessage) => void;
63
+ subscribe: (apply: (message: unknown) => void) => void;
64
+ };
65
+
66
+ type FeatureEnv = {
67
+ Variables: {
68
+ principal: string | null;
69
+ };
70
+ };
71
+ type PrincipalIdentity = {
72
+ roles: readonly string[];
73
+ installed: readonly string[] | undefined;
74
+ };
75
+ type CredentialAnswer = {
76
+ principal: string;
77
+ } | {
78
+ refused: {
79
+ status: 401 | 403;
80
+ error: string;
81
+ message: string;
82
+ };
83
+ };
84
+ type Actions = Readonly<Record<string, ActionDefinition>>;
85
+ type Replay = (fingerprint: string, context: Record<string, unknown>) => Promise<unknown>;
86
+ type FeatureSeams = {
87
+ mountRoutes: (routes: Hono<FeatureEnv>) => void;
88
+ mountOperatorRoutes: (routes: Hono<FeatureEnv>) => void;
89
+ registerCredential: (prefix: string, principalOf: (token: string, request: Request) => Promise<CredentialAnswer>) => void;
90
+ resolveIdentity: (principal: string | null) => Promise<PrincipalIdentity>;
91
+ scopeOf: (principal: string) => Promise<Record<string, unknown>>;
92
+ grantedActionIds: (roles: readonly string[], installed: readonly string[] | undefined) => readonly string[];
93
+ actions: () => Actions;
94
+ replaceActions: (actions: Record<string, ActionDefinition>) => void;
95
+ refusalOf: (actions: Actions) => string | undefined;
96
+ setActionsLoader: (load: () => Promise<Record<string, ActionDefinition>>) => void;
97
+ addCatalogFilter: (filter: (ids: readonly string[], installed: ReadonlySet<string> | undefined) => readonly string[]) => void;
98
+ charter: Charter;
99
+ components: Readonly<Record<string, {
100
+ meta?: {
101
+ description?: string;
102
+ propsSchema?: unknown;
103
+ };
104
+ }>>;
105
+ layoutMisfits: (layout: unknown) => string[];
106
+ endlessChains: (actions: Actions) => {
107
+ path: string;
108
+ through: readonly string[];
109
+ }[];
110
+ ownEntries: (entries: readonly (SeedEntry | SeedMutation)[]) => Promise<Replay>;
111
+ grammars: Upgrader;
112
+ upgradeStore: (store: DocumentStore) => Promise<void>;
113
+ fingerprints: () => Promise<readonly string[]>;
114
+ fingerprintsFor: (principal: string | null) => Promise<readonly string[]>;
115
+ onWrite: (listener: (event: WriteEvent, request: {
116
+ header: (name: string) => string | undefined;
117
+ }) => void) => () => void;
118
+ telemetry: Telemetry | undefined;
119
+ wrapWire: (wrap: (inner: FetchFn) => FetchFn) => void;
120
+ };
121
+ type Feature = {
122
+ name: string;
123
+ tables?: {
124
+ names: readonly string[];
125
+ sequences?: readonly Sequence[];
126
+ };
127
+ start: (seams: FeatureSeams) => void | Promise<void>;
128
+ };
129
+
130
+ export type { Feature as F, NiscRuntime as N, Telemetry as T, TelemetrySpan as a };