@niscorp/moss 0.9.2 → 0.10.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 (108) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/DESIGN.md +58 -55
  3. package/DOCS.md +280 -170
  4. package/README.md +5 -5
  5. package/dist/{chunk-PVZMCEBX.cjs → chunk-3CKBKTXA.cjs} +2 -2
  6. package/dist/chunk-3CKBKTXA.cjs.map +1 -0
  7. package/dist/{chunk-FUJRIO4N.js → chunk-3PL4AH4I.js} +4 -4
  8. package/dist/{chunk-FUJRIO4N.js.map → chunk-3PL4AH4I.js.map} +1 -1
  9. package/dist/{chunk-QAHDSRPK.js → chunk-4URQHVYG.js} +2 -2
  10. package/dist/chunk-4URQHVYG.js.map +1 -0
  11. package/dist/{chunk-6ZWMC2OV.cjs → chunk-6ACVHHFK.cjs} +33 -30
  12. package/dist/chunk-6ACVHHFK.cjs.map +1 -0
  13. package/dist/{chunk-IUJ2TRNB.cjs → chunk-7MOEKAVC.cjs} +6 -6
  14. package/dist/{chunk-IUJ2TRNB.cjs.map → chunk-7MOEKAVC.cjs.map} +1 -1
  15. package/dist/{chunk-NCQBGK3E.cjs → chunk-BFA76AKR.cjs} +4 -4
  16. package/dist/chunk-BFA76AKR.cjs.map +1 -0
  17. package/dist/{chunk-T5BRTFKP.js → chunk-DSVRFAGX.js} +3 -3
  18. package/dist/{chunk-T5BRTFKP.js.map → chunk-DSVRFAGX.js.map} +1 -1
  19. package/dist/{chunk-IW3A2YIC.js → chunk-EYWD733E.js} +3 -3
  20. package/dist/{chunk-IW3A2YIC.js.map → chunk-EYWD733E.js.map} +1 -1
  21. package/dist/{chunk-IY5BOFLK.cjs → chunk-G4P3XEVM.cjs} +19 -19
  22. package/dist/chunk-G4P3XEVM.cjs.map +1 -0
  23. package/dist/{chunk-6QPTMKRE.cjs → chunk-HUP7CZ7X.cjs} +6 -6
  24. package/dist/{chunk-6QPTMKRE.cjs.map → chunk-HUP7CZ7X.cjs.map} +1 -1
  25. package/dist/{chunk-VKQPOZDJ.cjs → chunk-LTS4AM6T.cjs} +4 -4
  26. package/dist/chunk-LTS4AM6T.cjs.map +1 -0
  27. package/dist/{chunk-UTFOMFCH.js → chunk-MEHCZECW.js} +5 -5
  28. package/dist/chunk-MEHCZECW.js.map +1 -0
  29. package/dist/{chunk-WMIJU6ZZ.js → chunk-MYPK5YZR.js} +297 -206
  30. package/dist/chunk-MYPK5YZR.js.map +1 -0
  31. package/dist/{chunk-TKXYPO2Y.js → chunk-NUX5MH4I.js} +4 -4
  32. package/dist/chunk-NUX5MH4I.js.map +1 -0
  33. package/dist/{chunk-KVXP6OTW.cjs → chunk-UVY5ZPWW.cjs} +373 -282
  34. package/dist/chunk-UVY5ZPWW.cjs.map +1 -0
  35. package/dist/{chunk-5ZB7FZ2J.js → chunk-VYYDLGQ2.js} +29 -26
  36. package/dist/chunk-VYYDLGQ2.js.map +1 -0
  37. package/dist/{chunk-NRZ3Z2FF.js → chunk-WKZWSWOJ.js} +4 -4
  38. package/dist/chunk-WKZWSWOJ.js.map +1 -0
  39. package/dist/{chunk-KMZT6NVL.cjs → chunk-XH6TSWG4.cjs} +7 -7
  40. package/dist/{chunk-KMZT6NVL.cjs.map → chunk-XH6TSWG4.cjs.map} +1 -1
  41. package/dist/client.cjs +5 -5
  42. package/dist/client.js +2 -2
  43. package/dist/{document-deAs7Dre.d.cts → document-DvhT_HaJ.d.cts} +3 -2
  44. package/dist/{document-C3aS9uiW.d.ts → document-iKaRinZE.d.ts} +3 -2
  45. package/dist/{index-CSEo7Tys.d.ts → index-DWj3_0Zg.d.cts} +3 -0
  46. package/dist/{index-CSEo7Tys.d.cts → index-DWj3_0Zg.d.ts} +3 -0
  47. package/dist/index.cjs +16 -16
  48. package/dist/index.d.cts +4 -4
  49. package/dist/index.d.ts +4 -4
  50. package/dist/index.js +4 -4
  51. package/dist/integrations.cjs +27 -18
  52. package/dist/integrations.cjs.map +1 -1
  53. package/dist/integrations.d.cts +1 -1
  54. package/dist/integrations.d.ts +1 -1
  55. package/dist/integrations.js +25 -16
  56. package/dist/integrations.js.map +1 -1
  57. package/dist/node.cjs +9 -9
  58. package/dist/node.d.cts +2 -2
  59. package/dist/node.d.ts +2 -2
  60. package/dist/node.js +5 -5
  61. package/dist/protocol.cjs +5 -5
  62. package/dist/protocol.js +1 -1
  63. package/dist/terminal/dom/index.cjs +3 -3
  64. package/dist/terminal/dom/index.js +1 -1
  65. package/dist/terminal/dom/server.cjs +2 -2
  66. package/dist/terminal/dom/server.js +1 -1
  67. package/dist/terminal/index.cjs +3 -3
  68. package/dist/terminal/index.js +2 -2
  69. package/dist/terminal/ink/index.js.map +1 -1
  70. package/dist/terminal/react/index.cjs +9 -9
  71. package/dist/terminal/react/index.cjs.map +1 -1
  72. package/dist/terminal/react/index.js +4 -4
  73. package/dist/terminal/react/index.js.map +1 -1
  74. package/dist/terminal/react/server.cjs +4 -4
  75. package/dist/terminal/react/server.js +2 -2
  76. package/dist/terminal/tty/index.cjs +12 -12
  77. package/dist/terminal/tty/index.cjs.map +1 -1
  78. package/dist/terminal/tty/index.js +6 -6
  79. package/dist/terminal/tty/index.js.map +1 -1
  80. package/dist/terminal/vue/index.cjs +9 -9
  81. package/dist/terminal/vue/index.cjs.map +1 -1
  82. package/dist/terminal/vue/index.js +4 -4
  83. package/dist/terminal/vue/index.js.map +1 -1
  84. package/dist/terminal/vue/server.cjs +4 -4
  85. package/dist/terminal/vue/server.js +2 -2
  86. package/dist/tide.d.cts +1 -1
  87. package/dist/tide.d.ts +1 -1
  88. package/dist/unverified.cjs +4 -4
  89. package/dist/unverified.js +3 -3
  90. package/dist/vite.cjs +36 -10
  91. package/dist/vite.cjs.map +1 -1
  92. package/dist/vite.d.cts +2 -2
  93. package/dist/vite.d.ts +2 -2
  94. package/dist/vite.js +31 -5
  95. package/dist/vite.js.map +1 -1
  96. package/package.json +13 -13
  97. package/dist/chunk-5ZB7FZ2J.js.map +0 -1
  98. package/dist/chunk-6ZWMC2OV.cjs.map +0 -1
  99. package/dist/chunk-IY5BOFLK.cjs.map +0 -1
  100. package/dist/chunk-KVXP6OTW.cjs.map +0 -1
  101. package/dist/chunk-NCQBGK3E.cjs.map +0 -1
  102. package/dist/chunk-NRZ3Z2FF.js.map +0 -1
  103. package/dist/chunk-PVZMCEBX.cjs.map +0 -1
  104. package/dist/chunk-QAHDSRPK.js.map +0 -1
  105. package/dist/chunk-TKXYPO2Y.js.map +0 -1
  106. package/dist/chunk-UTFOMFCH.js.map +0 -1
  107. package/dist/chunk-VKQPOZDJ.cjs.map +0 -1
  108. package/dist/chunk-WMIJU6ZZ.js.map +0 -1
package/dist/client.cjs CHANGED
@@ -1,21 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkIY5BOFLK_cjs = require('./chunk-IY5BOFLK.cjs');
4
- require('./chunk-NCQBGK3E.cjs');
3
+ var chunkG4P3XEVM_cjs = require('./chunk-G4P3XEVM.cjs');
4
+ require('./chunk-BFA76AKR.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "browserEnv", {
9
9
  enumerable: true,
10
- get: function () { return chunkIY5BOFLK_cjs.browserEnv; }
10
+ get: function () { return chunkG4P3XEVM_cjs.browserEnv; }
11
11
  });
12
12
  Object.defineProperty(exports, "createWire", {
13
13
  enumerable: true,
14
- get: function () { return chunkIY5BOFLK_cjs.createWire; }
14
+ get: function () { return chunkG4P3XEVM_cjs.createWire; }
15
15
  });
16
16
  Object.defineProperty(exports, "readDocumentSnapshot", {
17
17
  enumerable: true,
18
- get: function () { return chunkIY5BOFLK_cjs.readDocumentSnapshot; }
18
+ get: function () { return chunkG4P3XEVM_cjs.readDocumentSnapshot; }
19
19
  });
20
20
  //# sourceMappingURL=client.cjs.map
21
21
  //# sourceMappingURL=client.cjs.map
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- export { browserEnv, createWire, readDocumentSnapshot } from './chunk-UTFOMFCH.js';
2
- import './chunk-TKXYPO2Y.js';
1
+ export { browserEnv, createWire, readDocumentSnapshot } from './chunk-MEHCZECW.js';
2
+ import './chunk-NUX5MH4I.js';
3
3
  //# sourceMappingURL=client.js.map
4
4
  //# sourceMappingURL=client.js.map
@@ -1,10 +1,10 @@
1
1
  import { Hono } from 'hono';
2
2
  import { Charter, VerifyReport } from '@niscorp/charter';
3
3
  import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, Reconciler, RenderNode } from '@niscorp/nova';
4
- import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, ScopePolicy } from '@niscorp/vex';
4
+ import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, UpgradedColumns, ScopePolicy } from '@niscorp/vex';
5
5
  import { Sequence } from '@niscorp/strata';
6
6
  import { Phrasebook, PhraseKeys } from '@niscorp/nova/i18n';
7
- import { F as Feature } from './index-CSEo7Tys.cjs';
7
+ import { F as Feature } from './index-DWj3_0Zg.cjs';
8
8
  import { S as SocketAccept } from './socket-D90h1xSV.cjs';
9
9
  import { ScreenHead } from '@niscorp/nova/document';
10
10
 
@@ -60,6 +60,7 @@ type NiscApp = {
60
60
  shell?: ShellManifest;
61
61
  pages?: Record<string, PageManifest>;
62
62
  grammars?: readonly Sequence[];
63
+ upgradedColumns?: UpgradedColumns;
63
64
  functions?: (session: FunctionSession) => WrittenFunctions;
64
65
  onSession?: (session: FunctionSession) => void;
65
66
  runs?: RunSink;
@@ -1,10 +1,10 @@
1
1
  import { Hono } from 'hono';
2
2
  import { Charter, VerifyReport } from '@niscorp/charter';
3
3
  import { Shell, FetchFn, LayoutNode, ActionDefinition, CanvasConfig, ActionFragment, FunctionDefinition, FunctionHandler, Reconciler, RenderNode } from '@niscorp/nova';
4
- import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, ScopePolicy } from '@niscorp/vex';
4
+ import { GenerateDsl, MapToShape, QueryResponse, ScopeBehaviors, SeedEntry, SeedMutation, UpgradedColumns, ScopePolicy } from '@niscorp/vex';
5
5
  import { Sequence } from '@niscorp/strata';
6
6
  import { Phrasebook, PhraseKeys } from '@niscorp/nova/i18n';
7
- import { F as Feature } from './index-CSEo7Tys.js';
7
+ import { F as Feature } from './index-DWj3_0Zg.js';
8
8
  import { S as SocketAccept } from './socket-D90h1xSV.js';
9
9
  import { ScreenHead } from '@niscorp/nova/document';
10
10
 
@@ -60,6 +60,7 @@ type NiscApp = {
60
60
  shell?: ShellManifest;
61
61
  pages?: Record<string, PageManifest>;
62
62
  grammars?: readonly Sequence[];
63
+ upgradedColumns?: UpgradedColumns;
63
64
  functions?: (session: FunctionSession) => WrittenFunctions;
64
65
  onSession?: (session: FunctionSession) => void;
65
66
  runs?: RunSink;
@@ -12,12 +12,15 @@ type NiscRuntime = {
12
12
  db: MutationClient;
13
13
  cache?: CacheBackend;
14
14
  vexConfig?: QueryEngineConfig['config'];
15
+ answerReadableRows?: boolean;
16
+ checkMovedRows?: boolean;
15
17
  session: SessionVerifier | 'sessions' | 'dev-open';
16
18
  origins?: readonly string[];
17
19
  migrations?: 'apply' | 'verify';
18
20
  tables?: readonly Sequence[];
19
21
  shellIdleMs?: number;
20
22
  artifactsUnusedMs?: number;
23
+ artifactsUnusedSinceStart?: boolean;
21
24
  anonymousShellMax?: number;
22
25
  endpointTimeoutMs?: number;
23
26
  sessionRevalidateMs?: number;
@@ -12,12 +12,15 @@ type NiscRuntime = {
12
12
  db: MutationClient;
13
13
  cache?: CacheBackend;
14
14
  vexConfig?: QueryEngineConfig['config'];
15
+ answerReadableRows?: boolean;
16
+ checkMovedRows?: boolean;
15
17
  session: SessionVerifier | 'sessions' | 'dev-open';
16
18
  origins?: readonly string[];
17
19
  migrations?: 'apply' | 'verify';
18
20
  tables?: readonly Sequence[];
19
21
  shellIdleMs?: number;
20
22
  artifactsUnusedMs?: number;
23
+ artifactsUnusedSinceStart?: boolean;
21
24
  anonymousShellMax?: number;
22
25
  endpointTimeoutMs?: number;
23
26
  sessionRevalidateMs?: number;
package/dist/index.cjs CHANGED
@@ -1,59 +1,59 @@
1
1
  'use strict';
2
2
 
3
- var chunkKVXP6OTW_cjs = require('./chunk-KVXP6OTW.cjs');
4
- var chunk6ZWMC2OV_cjs = require('./chunk-6ZWMC2OV.cjs');
5
- require('./chunk-PVZMCEBX.cjs');
6
- require('./chunk-NCQBGK3E.cjs');
3
+ var chunkUVY5ZPWW_cjs = require('./chunk-UVY5ZPWW.cjs');
4
+ var chunk6ACVHHFK_cjs = require('./chunk-6ACVHHFK.cjs');
5
+ require('./chunk-3CKBKTXA.cjs');
6
+ require('./chunk-BFA76AKR.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MOSS_SEQUENCE", {
11
11
  enumerable: true,
12
- get: function () { return chunkKVXP6OTW_cjs.MOSS_SEQUENCE; }
12
+ get: function () { return chunkUVY5ZPWW_cjs.MOSS_SEQUENCE; }
13
13
  });
14
14
  Object.defineProperty(exports, "createServer", {
15
15
  enumerable: true,
16
- get: function () { return chunkKVXP6OTW_cjs.createServer; }
16
+ get: function () { return chunkUVY5ZPWW_cjs.createServer; }
17
17
  });
18
18
  Object.defineProperty(exports, "exportDocuments", {
19
19
  enumerable: true,
20
- get: function () { return chunkKVXP6OTW_cjs.exportDocuments; }
20
+ get: function () { return chunkUVY5ZPWW_cjs.exportDocuments; }
21
21
  });
22
22
  Object.defineProperty(exports, "migrateTables", {
23
23
  enumerable: true,
24
- get: function () { return chunkKVXP6OTW_cjs.migrateTables; }
24
+ get: function () { return chunkUVY5ZPWW_cjs.migrateTables; }
25
25
  });
26
26
  Object.defineProperty(exports, "mintDevToken", {
27
27
  enumerable: true,
28
- get: function () { return chunkKVXP6OTW_cjs.mintDevToken; }
28
+ get: function () { return chunkUVY5ZPWW_cjs.mintDevToken; }
29
29
  });
30
30
  Object.defineProperty(exports, "mintSession", {
31
31
  enumerable: true,
32
- get: function () { return chunkKVXP6OTW_cjs.mintSession; }
32
+ get: function () { return chunkUVY5ZPWW_cjs.mintSession; }
33
33
  });
34
34
  Object.defineProperty(exports, "renderDocument", {
35
35
  enumerable: true,
36
- get: function () { return chunkKVXP6OTW_cjs.renderDocument; }
36
+ get: function () { return chunkUVY5ZPWW_cjs.renderDocument; }
37
37
  });
38
38
  Object.defineProperty(exports, "revokeAllFor", {
39
39
  enumerable: true,
40
- get: function () { return chunkKVXP6OTW_cjs.revokeAllFor; }
40
+ get: function () { return chunkUVY5ZPWW_cjs.revokeAllFor; }
41
41
  });
42
42
  Object.defineProperty(exports, "sessionCookies", {
43
43
  enumerable: true,
44
- get: function () { return chunkKVXP6OTW_cjs.sessionCookies; }
44
+ get: function () { return chunkUVY5ZPWW_cjs.sessionCookies; }
45
45
  });
46
46
  Object.defineProperty(exports, "tableStatus", {
47
47
  enumerable: true,
48
- get: function () { return chunkKVXP6OTW_cjs.tableStatus; }
48
+ get: function () { return chunkUVY5ZPWW_cjs.tableStatus; }
49
49
  });
50
50
  Object.defineProperty(exports, "defineApp", {
51
51
  enumerable: true,
52
- get: function () { return chunk6ZWMC2OV_cjs.defineApp; }
52
+ get: function () { return chunk6ACVHHFK_cjs.defineApp; }
53
53
  });
54
54
  Object.defineProperty(exports, "verifyApp", {
55
55
  enumerable: true,
56
- get: function () { return chunk6ZWMC2OV_cjs.verifyApp; }
56
+ get: function () { return chunk6ACVHHFK_cjs.verifyApp; }
57
57
  });
58
58
  //# sourceMappingURL=index.cjs.map
59
59
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-deAs7Dre.cjs';
2
- export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-deAs7Dre.cjs';
1
+ import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-DvhT_HaJ.cjs';
2
+ export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-DvhT_HaJ.cjs';
3
3
  import { VerifyReport } from '@niscorp/charter';
4
4
  import { PgPool } from '@niscorp/vex';
5
- import { N as NiscRuntime } from './index-CSEo7Tys.cjs';
6
- export { T as Telemetry, a as TelemetrySpan } from './index-CSEo7Tys.cjs';
5
+ import { N as NiscRuntime } from './index-DWj3_0Zg.cjs';
6
+ export { T as Telemetry, a as TelemetrySpan } from './index-DWj3_0Zg.cjs';
7
7
  import { MigrateReport } from '@niscorp/strata/postgres';
8
8
  import { Plan, Sequence } from '@niscorp/strata';
9
9
  export { FunctionDefinition } from '@niscorp/nova';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-C3aS9uiW.js';
2
- export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-C3aS9uiW.js';
1
+ import { N as NiscApp, M as MossServer, D as DocumentConfig } from './document-iKaRinZE.js';
2
+ export { a as DrawnDocument, E as ExecuteAs, F as FunctionSession, I as IdentityRecord, L as LayoutVariant, P as PageManifest, R as RunRecord, b as RunSink, c as RunTurn, S as ShellHost, d as ShellManifest, e as ShellSnapshot, f as defineApp, r as renderDocument } from './document-iKaRinZE.js';
3
3
  import { VerifyReport } from '@niscorp/charter';
4
4
  import { PgPool } from '@niscorp/vex';
5
- import { N as NiscRuntime } from './index-CSEo7Tys.js';
6
- export { T as Telemetry, a as TelemetrySpan } from './index-CSEo7Tys.js';
5
+ import { N as NiscRuntime } from './index-DWj3_0Zg.js';
6
+ export { T as Telemetry, a as TelemetrySpan } from './index-DWj3_0Zg.js';
7
7
  import { MigrateReport } from '@niscorp/strata/postgres';
8
8
  import { Plan, Sequence } from '@niscorp/strata';
9
9
  export { FunctionDefinition } from '@niscorp/nova';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { MOSS_SEQUENCE, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, renderDocument, revokeAllFor, sessionCookies, tableStatus } from './chunk-WMIJU6ZZ.js';
2
- export { defineApp, verifyApp } from './chunk-5ZB7FZ2J.js';
3
- import './chunk-QAHDSRPK.js';
4
- import './chunk-TKXYPO2Y.js';
1
+ export { MOSS_SEQUENCE, createServer, exportDocuments, migrateTables, mintDevToken, mintSession, renderDocument, revokeAllFor, sessionCookies, tableStatus } from './chunk-MYPK5YZR.js';
2
+ export { defineApp, verifyApp } from './chunk-VYYDLGQ2.js';
3
+ import './chunk-4URQHVYG.js';
4
+ import './chunk-NUX5MH4I.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkPVZMCEBX_cjs = require('./chunk-PVZMCEBX.cjs');
3
+ var chunk3CKBKTXA_cjs = require('./chunk-3CKBKTXA.cjs');
4
4
  var crypto = require('crypto');
5
5
  var zod = require('zod');
6
6
  var hono = require('hono');
7
+ var charter = require('@niscorp/charter');
7
8
  var nova = require('@niscorp/nova');
8
9
  var reflect = require('@niscorp/nova/reflect');
9
10
  var strata = require('@niscorp/strata');
@@ -224,8 +225,8 @@ var reachOf = (bundle, integrationId) => {
224
225
  const admit = (url, actionId) => {
225
226
  if (!url.startsWith(own)) return;
226
227
  const key = normalizePath(url);
227
- const held = reach[key] ??= [];
228
- if (!held.includes(actionId)) held.push(actionId);
228
+ const declaring = reach[key] ??= [];
229
+ if (!declaring.includes(actionId)) declaring.push(actionId);
229
230
  };
230
231
  for (const [actionId, action] of Object.entries(bundle.actions)) {
231
232
  for (const endpoint of Object.values(action.endpoints ?? {})) {
@@ -234,7 +235,7 @@ var reachOf = (bundle, integrationId) => {
234
235
  }
235
236
  return Object.fromEntries(Object.entries(reach).sort(([a], [b]) => a.localeCompare(b)));
236
237
  };
237
- var reachAdmits = (reach, path, held) => (reach[normalizePath(path)] ?? []).some((actionId) => held.has(actionId));
238
+ var reachAdmits = (reach, path, granted) => (reach[normalizePath(path)] ?? []).some((actionId) => granted.has(actionId));
238
239
  var reachDeclares = (reach, path) => reach[normalizePath(path)] !== void 0;
239
240
 
240
241
  // src/integrations/forward.ts
@@ -265,7 +266,16 @@ var createForwarder = (deps) => {
265
266
  return sent(url, () => call.request(assertion));
266
267
  };
267
268
  };
268
- var relayed = (response, otherwise, more = {}) => new Response(response.body, { status: response.status, headers: { "content-type": response.headers.get("content-type") ?? otherwise, ...more } });
269
+ var SANDBOX = "sandbox allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals allow-downloads allow-top-navigation";
270
+ var relayed = (response, otherwise, more = {}) => new Response(response.body, {
271
+ status: response.status,
272
+ headers: {
273
+ "content-type": response.headers.get("content-type") ?? otherwise,
274
+ "content-security-policy": SANDBOX,
275
+ "x-content-type-options": "nosniff",
276
+ ...more
277
+ }
278
+ });
269
279
  var HOOK_LIMIT = 240;
270
280
  var HOOK_WINDOW_MS = 6e4;
271
281
  var createHookLimit = () => {
@@ -286,8 +296,9 @@ var webhook = (deps, routes) => {
286
296
  const id = c.req.param("id");
287
297
  const here = new URL(c.req.url);
288
298
  const headers = new Headers(c.req.raw.headers);
289
- headers.delete("authorization");
299
+ for (const name of ["authorization", "cookie", "proxy-authorization", "x-operator-key"]) headers.delete(name);
290
300
  headers.delete("host");
301
+ for (const name of ["transfer-encoding", "keep-alive", "expect", "upgrade"]) headers.delete(name);
291
302
  const ended = await deps.forward({
292
303
  integration: id,
293
304
  admits: () => hookAllows(id, Date.now()),
@@ -316,7 +327,7 @@ var proxy = (deps, routes) => {
316
327
  request: async (assertion) => ({
317
328
  method: c.req.method,
318
329
  headers: { "content-type": "application/json", authorization: `Bearer ${assertion}` },
319
- ...c.req.method === "GET" ? {} : { body: await c.req.text() }
330
+ ...c.req.method === "GET" || c.req.method === "HEAD" ? {} : { body: await c.req.text() }
320
331
  })
321
332
  });
322
333
  if (ended.kind === "refused") return c.json({ message: ended.why === "uninstalled" ? "Not installed here." : "No such integration." }, 404);
@@ -331,9 +342,9 @@ var proxyRoutes = (deps) => {
331
342
  return routes;
332
343
  };
333
344
  var callIntegrationWith = (deps) => {
334
- const emit = chunkPVZMCEBX_cjs.emitterOf(deps.telemetry);
345
+ const emit = chunk3CKBKTXA_cjs.emitterOf(deps.telemetry);
335
346
  return async (id, path, init) => {
336
- const clock = emit === void 0 ? void 0 : chunkPVZMCEBX_cjs.spanClock();
347
+ const clock = emit === void 0 ? void 0 : chunk3CKBKTXA_cjs.spanClock();
337
348
  const done = (status, httpStatus) => {
338
349
  if (emit === void 0 || clock === void 0) return;
339
350
  emit({
@@ -522,7 +533,7 @@ var RegistrationRowSchema = zod.z.object({ status: zod.z.string(), key_hash: zod
522
533
  var WrittenRowSchema = zod.z.looseObject({ key_hash: zod.z.string().nullish() });
523
534
  var WrittenSchema = zod.z.union([zod.z.array(WrittenRowSchema), WrittenRowSchema.transform((row) => [row]), zod.z.undefined().transform(() => [])]);
524
535
  var RequestedRowSchema = zod.z.object({ requested_data: strings });
525
- var KeyHolderRowSchema = zod.z.object({ id: zod.z.string() });
536
+ var KeyOwnerRowSchema = zod.z.object({ id: zod.z.string() });
526
537
  var actionKey = { integration_id: zod.z.string(), action_id: zod.z.string() };
527
538
  var afterAction2 = (last) => ({
528
539
  after_integration: last?.integration_id ?? "",
@@ -558,7 +569,7 @@ var recordFailedImport2 = async (replay, id, url, error) => {
558
569
  };
559
570
  var registrationOf = async (replay, id) => {
560
571
  const row = RegistrationRowSchema.optional().parse(rowsOf(await replay("integrations/registration", { id }))[0]);
561
- return { approved: row?.status === "approved", holdsKey: typeof row?.key_hash === "string" && row.key_hash !== "" };
572
+ return { approved: row?.status === "approved", hasKey: typeof row?.key_hash === "string" && row.key_hash !== "" };
562
573
  };
563
574
  var importedRow = ({ id, url, bundle, extension }) => ({
564
575
  id,
@@ -594,7 +605,7 @@ var setBackToPending2 = async (replay, id, why) => {
594
605
  var removeIntegration = async (replay, id) => {
595
606
  await replay("integrations/remove", { id });
596
607
  };
597
- var integrationByKey = async (replay, key) => KeyHolderRowSchema.optional().parse(rowsOf(await replay("integrations/by-key", { key_hash: hashIntegrationKey(key) }))[0])?.id;
608
+ var integrationByKey = async (replay, key) => KeyOwnerRowSchema.optional().parse(rowsOf(await replay("integrations/by-key", { key_hash: hashIntegrationKey(key) }))[0])?.id;
598
609
  var listIntegrations = async (replay) => {
599
610
  const listed = await everyRow(ListedRowSchema, (after) => replay("integrations/list", { after: after?.id ?? "" }));
600
611
  const counted = await everyRow(ActionCountRowSchema, (after) => replay("integrations/action-counts", { after: after?.integration_id ?? "" }));
@@ -710,12 +721,12 @@ var register = (deps, routes) => {
710
721
  await recordFailedImport2(deps.replay, id, url, taken.error);
711
722
  return c.json(taken.answer, taken.status);
712
723
  }
713
- const { approved: wasApproved, holdsKey } = await registrationOf(deps.replay, id);
724
+ const { approved: wasApproved, hasKey } = await registrationOf(deps.replay, id);
714
725
  if (wasApproved) {
715
726
  const refusal = deps.refusalOf({ ...deps.actions(), ...taken.bundle.actions });
716
727
  if (refusal !== void 0) return c.json({ message: "Refused \u2014 the app would not serve this.", reasons: [`Error: ${refusal}`] }, 422);
717
728
  }
718
- const key = holdsKey ? void 0 : mintIntegrationKey();
729
+ const key = hasKey ? void 0 : mintIntegrationKey();
719
730
  const { keptKey } = await writeBundle2(deps.replay, {
720
731
  id,
721
732
  url,
@@ -800,10 +811,8 @@ var buildContract = (host, integrationId) => {
800
811
  const components = Object.keys(registered).sort().map((name) => nova.paletteEntryOf(name, componentMetaOf(registered[name]?.meta)));
801
812
  const audiences = /* @__PURE__ */ new Set();
802
813
  for (const def of Object.values(host.charter)) {
803
- if (def === void 0 || Array.isArray(def)) continue;
804
- const selection = def.actions;
805
- const list2 = Array.isArray(selection) ? selection : selection?.allow ?? [];
806
- for (const entry of list2) {
814
+ if (Array.isArray(def) || def?.actions === void 0) continue;
815
+ for (const entry of charter.normalizeRole(def, "actions").allow) {
807
816
  const parts = entry.split(".");
808
817
  if (parts[0] === "ext" && parts[1] !== void 0 && parts[1] !== "*") audiences.add(parts[1]);
809
818
  }