apps 0.0.1-beta.73 → 0.0.1-beta.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-WCVV4PPS.js";
3
+ } from "./chunk-UCQBJUA5.js";
4
4
  import {
5
5
  bodyUpstreamError,
6
6
  fromPromise
@@ -16,7 +16,7 @@ import {
16
16
  defaultElicitationLimits,
17
17
  defaultMcpClientLimits,
18
18
  mcpSdkTimerCeilingMs
19
- } from "./chunk-JW5LYSER.js";
19
+ } from "./chunk-F2OAC6GE.js";
20
20
  import {
21
21
  jsonSchemaDecoder,
22
22
  nestJsonSchema,
@@ -3,7 +3,7 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "./chunk-G7L5DHQX.js";
6
+ } from "./chunk-2QWOG4UJ.js";
7
7
  import {
8
8
  failOnNetworkRefusal
9
9
  } from "./chunk-MHB7IFG7.js";
@@ -20,7 +20,7 @@ import {
20
20
  McpToolsOptions,
21
21
  defaultMcpClientLimits,
22
22
  mcpHealthReserveMs
23
- } from "./chunk-JW5LYSER.js";
23
+ } from "./chunk-F2OAC6GE.js";
24
24
  import {
25
25
  NetworkRefused,
26
26
  ProviderError
@@ -515,9 +515,9 @@ var Proto = {
515
515
  middlewares: /* @__PURE__ */ new Set([...this.middlewares, middleware])
516
516
  });
517
517
  },
518
- prefix(prefix) {
518
+ prefix(prefix2) {
519
519
  return makeProto({
520
- _tag: `${prefix}${this._tag}`,
520
+ _tag: `${prefix2}${this._tag}`,
521
521
  payloadSchema: this.payloadSchema,
522
522
  successSchema: this.successSchema,
523
523
  errorSchema: this.errorSchema,
@@ -1799,14 +1799,94 @@ var ApprovalResponse = ElicitationResponse.check(
1799
1799
  (response) => response.action !== "accept" || response.content === void 0 || Object.keys(response.content).length === 0
1800
1800
  )
1801
1801
  );
1802
- var approvalElicitation = (toolName, input) => ({
1802
+ var approvalPreviewChars = 4e3;
1803
+ var shortestKept = 32;
1804
+ var isHigh = (unit) => unit >= 55296 && unit <= 56319;
1805
+ var isLow = (unit) => unit >= 56320 && unit <= 57343;
1806
+ var prefix = (text, length) => text.slice(0, isHigh(text.charCodeAt(length - 1)) ? length - 1 : length);
1807
+ var isArray = (value) => Array.isArray(value);
1808
+ var characters = (text) => {
1809
+ let pairs = 0;
1810
+ for (let index = 1; index < text.length; index += 1)
1811
+ if (isLow(text.charCodeAt(index)) && isHigh(text.charCodeAt(index - 1))) pairs += 1;
1812
+ return text.length - pairs;
1813
+ };
1814
+ var emit = (output, text) => {
1815
+ output.parts.push(text);
1816
+ output.room -= text.length;
1817
+ };
1818
+ var write = (value, keep, indent, output) => {
1819
+ if (typeof value === "string") {
1820
+ if (value.length > keep)
1821
+ emit(output, `${JSON.stringify(prefix(value, keep))}\u2026 (${characters(value)} characters)`);
1822
+ else
1823
+ emit(
1824
+ output,
1825
+ JSON.stringify(value.length > output.room ? prefix(value, output.room + 1) : value)
1826
+ );
1827
+ return;
1828
+ }
1829
+ if (typeof value !== "object" || value === null) return emit(output, JSON.stringify(value));
1830
+ const inner = `${indent} `;
1831
+ const member = (index, key, entry) => {
1832
+ emit(
1833
+ output,
1834
+ `${index === 0 ? "" : ","}
1835
+ ${inner}${key === void 0 ? "" : `${JSON.stringify(key)}: `}`
1836
+ );
1837
+ if (output.room >= 0) write(entry, keep, inner, output);
1838
+ return output.room >= 0;
1839
+ };
1840
+ if (isArray(value)) {
1841
+ if (value.length === 0) return emit(output, "[]");
1842
+ emit(output, "[");
1843
+ value.every((entry, index) => member(index, void 0, entry));
1844
+ return emit(output, `
1845
+ ${indent}]`);
1846
+ }
1847
+ const entries = Object.entries(value);
1848
+ if (entries.length === 0) return emit(output, "{}");
1849
+ emit(output, "{");
1850
+ entries.every(([key, entry], index) => member(index, key, entry));
1851
+ emit(output, `
1852
+ ${indent}}`);
1853
+ };
1854
+ var printed = (value, keep, room) => {
1855
+ const output = { parts: [], room };
1856
+ write(value, keep, "", output);
1857
+ return { text: output.parts.join(""), fits: output.room >= 0 };
1858
+ };
1859
+ var shortened = (input) => {
1860
+ let keep = approvalPreviewChars / 2;
1861
+ let shown = printed(input, keep, approvalPreviewChars);
1862
+ while (!shown.fits && keep > shortestKept) {
1863
+ keep = Math.max(shortestKept, Math.floor(keep / 2));
1864
+ shown = printed(input, keep, approvalPreviewChars);
1865
+ }
1866
+ return shown.fits ? shown.text : `${prefix(shown.text, approvalPreviewChars)}
1867
+ \u2026 (the rest is not shown)`;
1868
+ };
1869
+ var consent = (toolName, shown) => ({
1803
1870
  mode: "form",
1804
1871
  message: `Approve ${toolName}?
1805
1872
 
1806
- Arguments:
1807
- ${JSON.stringify(input, null, 2)}`,
1873
+ ${shown}`,
1808
1874
  requestedSchema: { type: "object", properties: {} }
1809
1875
  });
1876
+ var exactApprovalElicitation = (toolName, input, maxChars) => {
1877
+ const exact = printed(input, Number.POSITIVE_INFINITY, maxChars);
1878
+ return exact.fits ? consent(toolName, `Arguments:
1879
+ ${exact.text}`) : void 0;
1880
+ };
1881
+ var approvalElicitation = (toolName, input) => {
1882
+ const exact = exactApprovalElicitation(toolName, input, approvalPreviewChars);
1883
+ if (exact !== void 0) return exact;
1884
+ return consent(
1885
+ toolName,
1886
+ `Arguments, shortened for review. Approving runs the call with the complete arguments:
1887
+ ${shortened(input)}`
1888
+ );
1889
+ };
1810
1890
 
1811
1891
  // src/contracts/router.ts
1812
1892
  var reservedRouterKeys = /* @__PURE__ */ new Set([
@@ -4324,6 +4404,7 @@ export {
4324
4404
  ElicitationReply,
4325
4405
  ApprovalElicitation,
4326
4406
  ApprovalResponse,
4407
+ exactApprovalElicitation,
4327
4408
  approvalElicitation,
4328
4409
  reservedRouterKeys,
4329
4410
  RouterKey,
@@ -2,7 +2,7 @@ import {
2
2
  declaredOperations,
3
3
  nativeOperation,
4
4
  nativeRouter
5
- } from "./chunk-ZEJ3IKEC.js";
5
+ } from "./chunk-OABWTKGG.js";
6
6
  import {
7
7
  fromPromise,
8
8
  method
@@ -16,7 +16,7 @@ import {
16
16
  normalizePlacements,
17
17
  placementFields,
18
18
  renderPlacement
19
- } from "./chunk-JW5LYSER.js";
19
+ } from "./chunk-F2OAC6GE.js";
20
20
  import {
21
21
  decoderOf,
22
22
  isSchema,
@@ -6,7 +6,7 @@ import {
6
6
  RouterKey,
7
7
  RouterMeta,
8
8
  reservedRouterKeys
9
- } from "./chunk-JW5LYSER.js";
9
+ } from "./chunk-F2OAC6GE.js";
10
10
  import {
11
11
  decoderOf,
12
12
  schemaArgument
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-OBYMFSWA.js";
3
+ } from "./chunk-TSPJFGA6.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
7
7
  routerDeclaration
8
- } from "./chunk-ZEJ3IKEC.js";
8
+ } from "./chunk-OABWTKGG.js";
9
9
 
10
10
  // src/implementation/protocol-operations.ts
11
11
  var protocolOperations = (operations, kinds = {}) => {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  joinPath,
6
6
  mergeMeta
7
- } from "./chunk-ZEJ3IKEC.js";
7
+ } from "./chunk-OABWTKGG.js";
8
8
  import {
9
9
  isShortenedUpstream,
10
10
  parseProviderError,
@@ -21,7 +21,7 @@ import {
21
21
  McpError,
22
22
  McpError2,
23
23
  SkillLoadFailed as SkillLoadFailed2
24
- } from "./chunk-JW5LYSER.js";
24
+ } from "./chunk-F2OAC6GE.js";
25
25
  import {
26
26
  CacheError,
27
27
  FailureCode,
@@ -11,7 +11,7 @@ import {
11
11
  parseSkillLoadFailed,
12
12
  readCatalog,
13
13
  routerSkills
14
- } from "./chunk-OBYMFSWA.js";
14
+ } from "./chunk-TSPJFGA6.js";
15
15
  import {
16
16
  appInvocationFetch
17
17
  } from "./chunk-MHB7IFG7.js";
@@ -25,12 +25,12 @@ import {
25
25
  makeEmitter,
26
26
  toEffectApp,
27
27
  withPlacements
28
- } from "./chunk-3R3KFCDU.js";
28
+ } from "./chunk-JSWN4D6V.js";
29
29
  import {
30
30
  declaredOperations,
31
31
  locate,
32
32
  nativeOperation
33
- } from "./chunk-ZEJ3IKEC.js";
33
+ } from "./chunk-OABWTKGG.js";
34
34
  import {
35
35
  accountProviderError,
36
36
  appCode,
@@ -91,7 +91,7 @@ import {
91
91
  reservedTablePrefix,
92
92
  sqlBindingsLimit,
93
93
  workflowDurationMillis
94
- } from "./chunk-JW5LYSER.js";
94
+ } from "./chunk-F2OAC6GE.js";
95
95
  import {
96
96
  CacheError
97
97
  } from "./chunk-7LMU3ER3.js";
package/js/contracts.js CHANGED
@@ -119,6 +119,7 @@ import {
119
119
  defaultEventLimits,
120
120
  defaultMcpClientLimits,
121
121
  defaultWebhookTransportLimits,
122
+ exactApprovalElicitation,
122
123
  frameworkProtocol,
123
124
  indexCommand,
124
125
  inspectCommand,
@@ -145,7 +146,7 @@ import {
145
146
  skillCatalog,
146
147
  skillsCommand,
147
148
  workflowDurationMillis
148
- } from "./chunk-JW5LYSER.js";
149
+ } from "./chunk-F2OAC6GE.js";
149
150
  import {
150
151
  FailureCode,
151
152
  FailureDetail,
@@ -334,6 +335,7 @@ export {
334
335
  defaultEventLimits,
335
336
  defaultMcpClientLimits,
336
337
  defaultWebhookTransportLimits,
338
+ exactApprovalElicitation,
337
339
  frameworkProtocol,
338
340
  indexCommand,
339
341
  inspectCommand,
package/js/effect.js CHANGED
@@ -3,17 +3,17 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-WCVV4PPS.js";
6
+ } from "./chunk-UCQBJUA5.js";
7
7
  import "./chunk-RUP4JMKO.js";
8
- import "./chunk-OBYMFSWA.js";
8
+ import "./chunk-TSPJFGA6.js";
9
9
  import "./chunk-MHB7IFG7.js";
10
10
  import "./chunk-XBG7HHXC.js";
11
- import "./chunk-3R3KFCDU.js";
12
- import "./chunk-ZEJ3IKEC.js";
11
+ import "./chunk-JSWN4D6V.js";
12
+ import "./chunk-OABWTKGG.js";
13
13
  import "./chunk-ZR7QAG67.js";
14
14
  import {
15
15
  ToolAnnotations
16
- } from "./chunk-JW5LYSER.js";
16
+ } from "./chunk-F2OAC6GE.js";
17
17
  import "./chunk-7LMU3ER3.js";
18
18
  import "./chunk-H72MEDMN.js";
19
19
  import {
package/js/graphql.js CHANGED
@@ -4,28 +4,28 @@ import {
4
4
  } from "./chunk-ECCWT5GJ.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-QGHGYH5V.js";
7
+ } from "./chunk-PZ535RJX.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-WCVV4PPS.js";
9
+ import "./chunk-UCQBJUA5.js";
10
10
  import {
11
11
  cacheKey
12
12
  } from "./chunk-RUP4JMKO.js";
13
- import "./chunk-OBYMFSWA.js";
13
+ import "./chunk-TSPJFGA6.js";
14
14
  import {
15
15
  failOnNetworkRefusal
16
16
  } from "./chunk-MHB7IFG7.js";
17
17
  import "./chunk-XBG7HHXC.js";
18
- import "./chunk-3R3KFCDU.js";
18
+ import "./chunk-JSWN4D6V.js";
19
19
  import {
20
20
  nativeOperation,
21
21
  routerDeclaration
22
- } from "./chunk-ZEJ3IKEC.js";
22
+ } from "./chunk-OABWTKGG.js";
23
23
  import {
24
24
  accountProviderError,
25
25
  graphqlProviderError,
26
26
  httpProviderError
27
27
  } from "./chunk-ZR7QAG67.js";
28
- import "./chunk-JW5LYSER.js";
28
+ import "./chunk-F2OAC6GE.js";
29
29
  import {
30
30
  NetworkRefused,
31
31
  ProviderError
package/js/host.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-WCVV4PPS.js";
3
+ } from "./chunk-UCQBJUA5.js";
4
4
  import "./chunk-RUP4JMKO.js";
5
- import "./chunk-OBYMFSWA.js";
5
+ import "./chunk-TSPJFGA6.js";
6
6
  import "./chunk-MHB7IFG7.js";
7
7
  import "./chunk-XBG7HHXC.js";
8
- import "./chunk-3R3KFCDU.js";
9
- import "./chunk-ZEJ3IKEC.js";
8
+ import "./chunk-JSWN4D6V.js";
9
+ import "./chunk-OABWTKGG.js";
10
10
  import "./chunk-ZR7QAG67.js";
11
11
  import {
12
12
  ElicitationFailed,
@@ -22,7 +22,7 @@ import {
22
22
  WorkflowRun,
23
23
  WorkflowRunId,
24
24
  WorkflowRunPage
25
- } from "./chunk-JW5LYSER.js";
25
+ } from "./chunk-F2OAC6GE.js";
26
26
  import {
27
27
  CacheCommand,
28
28
  CacheError,
package/js/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  query,
12
12
  t,
13
13
  workflow
14
- } from "./chunk-3R3KFCDU.js";
14
+ } from "./chunk-JSWN4D6V.js";
15
15
  import {
16
16
  dynamicRouter,
17
17
  mutation,
@@ -24,7 +24,7 @@ import {
24
24
  toolAnnotations,
25
25
  withApproval,
26
26
  withApprovals
27
- } from "./chunk-ZEJ3IKEC.js";
27
+ } from "./chunk-OABWTKGG.js";
28
28
  import {
29
29
  accountProviderError,
30
30
  fromPromise
@@ -43,7 +43,7 @@ import {
43
43
  ScheduleTiming,
44
44
  SecretsMethod,
45
45
  WorkflowFailure
46
- } from "./chunk-JW5LYSER.js";
46
+ } from "./chunk-F2OAC6GE.js";
47
47
  import {
48
48
  CacheError,
49
49
  FetchOptionUnsupported,
package/js/mcp/effect.js CHANGED
@@ -2,18 +2,18 @@ import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect,
4
4
  mcpToolsEffect
5
- } from "../chunk-LTF4TLMO.js";
6
- import "../chunk-G7L5DHQX.js";
5
+ } from "../chunk-AE45SVBH.js";
6
+ import "../chunk-2QWOG4UJ.js";
7
7
  import "../chunk-BCSNKUAC.js";
8
- import "../chunk-WCVV4PPS.js";
8
+ import "../chunk-UCQBJUA5.js";
9
9
  import "../chunk-RUP4JMKO.js";
10
- import "../chunk-OBYMFSWA.js";
10
+ import "../chunk-TSPJFGA6.js";
11
11
  import "../chunk-MHB7IFG7.js";
12
12
  import "../chunk-XBG7HHXC.js";
13
- import "../chunk-3R3KFCDU.js";
14
- import "../chunk-ZEJ3IKEC.js";
13
+ import "../chunk-JSWN4D6V.js";
14
+ import "../chunk-OABWTKGG.js";
15
15
  import "../chunk-ZR7QAG67.js";
16
- import "../chunk-JW5LYSER.js";
16
+ import "../chunk-F2OAC6GE.js";
17
17
  import "../chunk-7LMU3ER3.js";
18
18
  import "../chunk-H72MEDMN.js";
19
19
  import "../chunk-KGCTYL2S.js";
package/js/mcp/stdio.js CHANGED
@@ -3,23 +3,23 @@ import {
3
3
  answeredError,
4
4
  mcpClient,
5
5
  mcpJsonSchemaValidator
6
- } from "../chunk-G7L5DHQX.js";
6
+ } from "../chunk-2QWOG4UJ.js";
7
7
  import {
8
8
  protocolRouter
9
- } from "../chunk-QGHGYH5V.js";
9
+ } from "../chunk-PZ535RJX.js";
10
10
  import "../chunk-BCSNKUAC.js";
11
- import "../chunk-WCVV4PPS.js";
11
+ import "../chunk-UCQBJUA5.js";
12
12
  import "../chunk-RUP4JMKO.js";
13
- import "../chunk-OBYMFSWA.js";
13
+ import "../chunk-TSPJFGA6.js";
14
14
  import "../chunk-MHB7IFG7.js";
15
15
  import "../chunk-XBG7HHXC.js";
16
- import "../chunk-3R3KFCDU.js";
17
- import "../chunk-ZEJ3IKEC.js";
16
+ import "../chunk-JSWN4D6V.js";
17
+ import "../chunk-OABWTKGG.js";
18
18
  import "../chunk-ZR7QAG67.js";
19
19
  import {
20
20
  McpError,
21
21
  ProcessConfig
22
- } from "../chunk-JW5LYSER.js";
22
+ } from "../chunk-F2OAC6GE.js";
23
23
  import "../chunk-7LMU3ER3.js";
24
24
  import "../chunk-H72MEDMN.js";
25
25
  import "../chunk-KGCTYL2S.js";
package/js/mcp.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect
4
- } from "./chunk-LTF4TLMO.js";
4
+ } from "./chunk-AE45SVBH.js";
5
5
  import {
6
6
  catalogCache,
7
7
  catalogScope
8
8
  } from "./chunk-ECCWT5GJ.js";
9
9
  import {
10
10
  adaptMcpTool
11
- } from "./chunk-G7L5DHQX.js";
11
+ } from "./chunk-2QWOG4UJ.js";
12
12
  import {
13
13
  protocolOperations
14
- } from "./chunk-QGHGYH5V.js";
14
+ } from "./chunk-PZ535RJX.js";
15
15
  import "./chunk-BCSNKUAC.js";
16
- import "./chunk-WCVV4PPS.js";
16
+ import "./chunk-UCQBJUA5.js";
17
17
  import {
18
18
  cacheKey
19
19
  } from "./chunk-RUP4JMKO.js";
20
20
  import {
21
21
  operationDescription
22
- } from "./chunk-OBYMFSWA.js";
22
+ } from "./chunk-TSPJFGA6.js";
23
23
  import "./chunk-MHB7IFG7.js";
24
24
  import "./chunk-XBG7HHXC.js";
25
- import "./chunk-3R3KFCDU.js";
25
+ import "./chunk-JSWN4D6V.js";
26
26
  import {
27
27
  nativeOperation,
28
28
  routerDeclaration
29
- } from "./chunk-ZEJ3IKEC.js";
29
+ } from "./chunk-OABWTKGG.js";
30
30
  import {
31
31
  fromPromise,
32
32
  method
@@ -37,7 +37,7 @@ import {
37
37
  McpServerHeader,
38
38
  McpToolMetadata,
39
39
  McpToolsOptions
40
- } from "./chunk-JW5LYSER.js";
40
+ } from "./chunk-F2OAC6GE.js";
41
41
  import "./chunk-7LMU3ER3.js";
42
42
  import "./chunk-H72MEDMN.js";
43
43
  import "./chunk-KGCTYL2S.js";
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-QGHGYH5V.js";
11
+ } from "./chunk-PZ535RJX.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -29,7 +29,7 @@ import {
29
29
  isOpenapiTextMedia,
30
30
  openapiBinaryResultSchema,
31
31
  openapiMediaKind
32
- } from "./chunk-OBYMFSWA.js";
32
+ } from "./chunk-TSPJFGA6.js";
33
33
  import {
34
34
  failOnNetworkRefusal
35
35
  } from "./chunk-MHB7IFG7.js";
@@ -37,7 +37,7 @@ import "./chunk-XBG7HHXC.js";
37
37
  import {
38
38
  nativeOperation,
39
39
  routerDeclaration
40
- } from "./chunk-ZEJ3IKEC.js";
40
+ } from "./chunk-OABWTKGG.js";
41
41
  import {
42
42
  accountProviderError,
43
43
  bodyUpstreamError,
@@ -53,7 +53,7 @@ import {
53
53
  OpenapiResponseError,
54
54
  RouterMeta,
55
55
  defaultOpenapiErrorLimits
56
- } from "./chunk-JW5LYSER.js";
56
+ } from "./chunk-F2OAC6GE.js";
57
57
  import {
58
58
  NetworkRefused,
59
59
  ProviderError,
package/js/ui/serving.js CHANGED
@@ -23,7 +23,7 @@ import "../chunk-CZ7CSFO4.js";
23
23
 
24
24
  // src/implementation/browser-scripts.gen.ts
25
25
  var appWatchSource = '"use strict";(()=>{var s=()=>{let i=document.getElementById("executor-context")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!="object"||n===null||!("deployment"in n))return;let r=n.deployment;if(typeof r!="string"||r.length===0)return;let t=new EventSource("/_executor/version"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener("version",d=>{let e=JSON.parse(d.data);typeof e=="object"&&e!==null&&"deployment"in e&&(e.deployment===null||typeof e.deployment=="string")&&e.deployment!==r&&o()}),t.addEventListener("revoked",o),window.addEventListener("executor:deployment-changed",o),window.addEventListener("pagehide",()=>t.close(),{once:!0}),window.addEventListener("pageshow",d=>{d.persisted&&o()})};s();})();';
26
- var appFailureSource = '"use strict";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set(["Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","AggregateError"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith("/_executor/assets/")||!a.pathname.endsWith(".js")||(r.push({key:"code.file.path",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:"code.line.number",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:"code.column.number",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:"executor.ui.failure.suppressed",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,"0")).join(""),S=`${Date.now()}000000`,n,u="Sending error report\\u2026",k=()=>{if(d?.open)return;let s=document.createElement("div"),V=s.attachShadow({mode:"open"}),o=document.createElement("dialog");d=o,o.setAttribute("aria-labelledby","executor-failure-title");let y=document.createElement("h2");y.id="executor-failure-title",y.textContent=e==="script"?"This app could not load":"This app stopped working";let C=document.createElement("p");C.textContent=e==="script"?"A file needed by this page did not load. Reload the page to try again.":"The app encountered an unexpected error. Reload the page to try again.";let L=document.createElement("p");L.textContent="Copy any unsaved work before reloading.";let T=document.createElement("details"),v=document.createElement("summary");v.textContent="Error details";let c=document.createElement("textarea");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute("aria-label","Error details"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement("p"),n.setAttribute("role","status"),n.textContent=u;let l=document.createElement("button");l.type="button",l.textContent="Reload page",l.addEventListener("click",()=>location.reload());let p=document.createElement("button");p.type="button",p.textContent="Close",p.addEventListener("click",()=>o.close()),o.addEventListener("close",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k,{once:!0}):k(),fetch("/_executor/api/telemetry/traces",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:"ui.app.failure",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:"executor.ui.failure.kind",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?"Error report sent.":"Could not send the error report. You can copy the error details.",n&&(n.textContent=u)},()=>{u="Could not send the error report. You can copy the error details.",n&&(n.textContent=u)})};window.addEventListener("error",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:"exception.type",value:{stringValue:e.error.name}}),E("runtime",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E("script",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener("unhandledrejection",e=>{let t=e.reason;E("rejection",t instanceof Error?t.stack??t.message:"An app operation failed without handling its error.")})};D();})();';
26
+ var appFailureSource = '"use strict";(()=>{var M=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,v=/^(?:chrome|moz|safari-web)-extension:/,A=new Set(["ResizeObserver loop completed with undelivered notifications.","ResizeObserver loop limit exceeded"]),V=new Set(["Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","AggregateError"]),b=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith("/_executor/assets/")||!a.pathname.endsWith(".js")||(r.push({key:"code.file.path",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:"code.line.number",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:"code.column.number",value:{intValue:String(i)}})),r},h=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,x=f.get(a);if(x!==void 0&&r-x<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:"executor.ui.failure.suppressed",value:{intValue:String(g)}}),g=0;let E=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,"0")).join(""),S=`${Date.now()}000000`,n,l="Sending error report\\u2026",k=()=>{if(d?.open)return;let s=document.createElement("div"),D=s.attachShadow({mode:"open"}),o=document.createElement("dialog");d=o,o.setAttribute("aria-labelledby","executor-failure-title");let y=document.createElement("h2");y.id="executor-failure-title",y.textContent=e==="script"?"This app could not load":"This app stopped working";let C=document.createElement("p");C.textContent=e==="script"?"A file needed by this page did not load. Reload the page to try again.":"The app encountered an unexpected error. Reload the page to try again.";let L=document.createElement("p");L.textContent="Copy any unsaved work before reloading.";let R=document.createElement("details"),T=document.createElement("summary");T.textContent="Error details";let c=document.createElement("textarea");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute("aria-label","Error details"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${E}`,R.append(T,c),n=document.createElement("p"),n.setAttribute("role","status"),n.textContent=l;let u=document.createElement("button");u.type="button",u.textContent="Reload page",u.addEventListener("click",()=>location.reload());let p=document.createElement("button");p.type="button",p.textContent="Close",p.addEventListener("click",()=>o.close()),o.addEventListener("close",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,R,n,u,p),D.append(o),document.documentElement.append(s),o.showModal()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k,{once:!0}):k(),fetch("/_executor/api/telemetry/traces",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:E,spanId:E.slice(0,16),name:"ui.app.failure",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:"executor.ui.failure.kind",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{l=s.ok?"Error report sent.":"Could not send the error report. You can copy the error details.",n&&(n.textContent=l)},()=>{l="Could not send the error report. You can copy the error details.",n&&(n.textContent=l)})};window.addEventListener("error",e=>{if(e instanceof ErrorEvent){if(v.test(e.filename)||e.error===null&&e.lineno===0&&A.has(e.message))return;let t=b(e.filename,e.lineno,e.colno);e.error instanceof Error&&V.has(e.error.name)&&t.push({key:"exception.type",value:{stringValue:e.error.name}}),h("runtime",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&h("script",`Could not load script: ${e.target.src}`,b(e.target.src))},!0),window.addEventListener("unhandledrejection",e=>{let t=e.reason;h("rejection",t instanceof Error?t.stack??t.message:"An app operation failed without handling its error.")})};M();})();';
27
27
  var accountNoticeSource = '"use strict";(()=>{var g=()=>{let r=document.getElementById("executor-account-notice")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!="object"||t===null||!("items"in t)||!("fix"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!="string")return;let a=()=>{let i=document.createElement("div"),x=i.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent="aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}";let e=document.createElement("aside");e.setAttribute("role","status"),e.setAttribute("aria-label","Account warning");let l=document.createElement("strong");l.textContent="Some things might not work";let m=document.createElement("ul");for(let f of c){let p=document.createElement("li");p.textContent=String(f),m.append(p)}let u=document.createElement("div"),n=document.createElement("a");n.href=s,n.target="_top",n.textContent="Review accounts";let o=document.createElement("button");o.type="button",o.textContent="Dismiss",o.addEventListener("click",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a,{once:!0}):a()};g();})();';
28
28
 
29
29
  // src/implementation/ui-account-notice.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.73",
3
+ "version": "0.0.1-beta.75",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,