apps 0.0.1-beta.91 → 0.0.1-beta.93

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 (57) hide show
  1. package/README.md +4 -4
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-YRGL4QEF.js → chunk-2GPX2E57.js} +3 -3
  4. package/js/{chunk-H72MEDMN.js → chunk-4PIQKACY.js} +2 -2
  5. package/js/{chunk-JPEUKEV4.js → chunk-4X2UI4R2.js} +1 -1
  6. package/js/{chunk-KLYSEHUD.js → chunk-62NVUKED.js} +2 -2
  7. package/js/{chunk-KUCCHNVY.js → chunk-6C2I6JLA.js} +6 -6
  8. package/js/{chunk-YWFUWTUJ.js → chunk-6F3WAXVN.js} +4 -4
  9. package/js/{chunk-6XQLA5NC.js → chunk-6WC2OWHV.js} +15 -10
  10. package/js/{chunk-YNJ5CZMJ.js → chunk-74H25C4X.js} +13 -11
  11. package/js/{chunk-DDHBUKXX.js → chunk-7HG422GB.js} +42 -2
  12. package/js/{chunk-EOPQ727L.js → chunk-ACQXVKVQ.js} +1 -1
  13. package/js/{chunk-PYQLOLOC.js → chunk-ATBBIJ5O.js} +2 -2
  14. package/js/{chunk-TUMGL2OC.js → chunk-DILSCQPJ.js} +2 -2
  15. package/js/{chunk-5MDA7MKL.js → chunk-DYE2CKHG.js} +8 -8
  16. package/js/{chunk-XPRZTLHD.js → chunk-FA5MLNYL.js} +15 -15
  17. package/js/{chunk-7PHHWYV4.js → chunk-JJZZLNJY.js} +6 -6
  18. package/js/{chunk-74YVXBKY.js → chunk-KLSEU35Y.js} +1 -1
  19. package/js/{chunk-3LEVTFD4.js → chunk-MBCUKNUA.js} +10 -10
  20. package/js/{chunk-I5C7FD5Z.js → chunk-MN5XVRKW.js} +4 -4
  21. package/js/{chunk-5FHWNLCI.js → chunk-OWN3DP2W.js} +1 -1
  22. package/js/{chunk-XBG7HHXC.js → chunk-PBGPES67.js} +2 -2
  23. package/js/{chunk-GQ33QSNB.js → chunk-RKFLB36H.js} +2 -2
  24. package/js/{chunk-DADXWWRZ.js → chunk-TNVB3KLB.js} +6 -6
  25. package/js/{chunk-QWQM3CLH.js → chunk-URKOTNDA.js} +4 -4
  26. package/js/{chunk-PD6I2SDG.js → chunk-YDW7DX3A.js} +2 -2
  27. package/js/{chunk-IFJU5SYQ.js → chunk-ZKDXML77.js} +178 -23
  28. package/js/client.js +16 -16
  29. package/js/contracts.js +7 -7
  30. package/js/effect.js +18 -18
  31. package/js/graphql.js +20 -20
  32. package/js/host.js +18 -18
  33. package/js/index.js +13 -13
  34. package/js/mcp/effect.js +19 -19
  35. package/js/mcp.js +21 -21
  36. package/js/openapi.js +16 -16
  37. package/js/react.js +2 -2
  38. package/js/skills/effect.js +6 -6
  39. package/js/skills.js +15 -15
  40. package/js/ui/auth/contracts.js +2 -2
  41. package/js/ui/auth.js +5 -5
  42. package/js/ui/contracts.js +9 -9
  43. package/js/ui/serving.js +19 -18
  44. package/package.json +1 -1
  45. package/runtime.json +1 -1
  46. package/types/apps/src/contracts/app.d.ts +1 -1
  47. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  48. package/types/apps/src/contracts/ui.d.ts +31 -21
  49. package/types/apps/src/contracts/workflows.d.ts +37 -17
  50. package/types/apps/src/implementation/browser-scripts.gen.d.ts +1 -1
  51. package/types/apps/src/implementation/openapi-source.d.ts +1 -1
  52. package/types/apps/src/implementation/sql.d.ts +1 -1
  53. package/types/apps/src/implementation/ui-client.d.ts +1 -1
  54. package/types/apps/src/implementation/ui-document.d.ts +2 -2
  55. package/types/apps/src/implementation/ui-serving.d.ts +4 -4
  56. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  57. package/types/utils/src/legacy-keys.d.ts +20 -0
package/js/ui/serving.js CHANGED
@@ -1,31 +1,33 @@
1
1
  import {
2
2
  appPrivateHeaders
3
- } from "../chunk-KLYSEHUD.js";
4
- import "../chunk-JPEUKEV4.js";
3
+ } from "../chunk-62NVUKED.js";
4
+ import "../chunk-4X2UI4R2.js";
5
5
  import {
6
+ UiContext,
6
7
  UiFailed,
7
8
  UiForbidden
8
- } from "../chunk-YNJ5CZMJ.js";
9
+ } from "../chunk-74H25C4X.js";
9
10
  import {
10
11
  CurrentTelemetryConfig
11
- } from "../chunk-QWQM3CLH.js";
12
- import "../chunk-PD6I2SDG.js";
13
- import "../chunk-5FHWNLCI.js";
14
- import "../chunk-DDHBUKXX.js";
15
- import "../chunk-TUMGL2OC.js";
12
+ } from "../chunk-URKOTNDA.js";
13
+ import "../chunk-YDW7DX3A.js";
14
+ import "../chunk-OWN3DP2W.js";
15
+ import "../chunk-7HG422GB.js";
16
+ import "../chunk-DILSCQPJ.js";
16
17
  import {
17
18
  HttpServerRequest_exports,
18
19
  HttpServerResponse_exports
19
- } from "../chunk-EOPQ727L.js";
20
+ } from "../chunk-ACQXVKVQ.js";
20
21
  import {
21
22
  Effect_exports,
22
23
  Option_exports,
24
+ Schema_exports,
23
25
  Stream_exports
24
- } from "../chunk-IFJU5SYQ.js";
26
+ } from "../chunk-ZKDXML77.js";
25
27
  import "../chunk-CZ7CSFO4.js";
26
28
 
27
29
  // src/implementation/browser-scripts.gen.ts
28
- 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();})();';
30
+ var appWatchSource = '"use strict";(()=>{var c=()=>{let s=document.getElementById("executor-context")?.textContent;if(!s)return;let n=JSON.parse(s);if(typeof n!="object"||n===null||!("version"in n))return;let r=n.version;if(typeof r!="string"||r.length===0)return;let t=new EventSource("/_executor/version"),d=!1,o=()=>{d||(d=!0,t.close(),location.reload())};t.addEventListener("version",i=>{let e=JSON.parse(i.data);typeof e=="object"&&e!==null&&"version"in e&&(e.version===null||typeof e.version=="string")&&e.version!==r&&o()}),t.addEventListener("revoked",o),window.addEventListener("executor:deployment-changed",o),window.addEventListener("pagehide",()=>t.close(),{once:!0}),window.addEventListener("pageshow",i=>{i.persisted&&o()})};c();})();';
29
31
  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();})();';
30
32
  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();})();';
31
33
 
@@ -8495,8 +8497,8 @@ var rewriteCss = (css, resolve) => {
8495
8497
  }
8496
8498
  return output;
8497
8499
  };
8498
- var deploymentDocument = (html, deployment) => {
8499
- const root = `/_executor/assets/${encodeURIComponent(deployment)}/`;
8500
+ var versionDocument = (html, version) => {
8501
+ const root = `/_executor/assets/${encodeURIComponent(version)}/`;
8500
8502
  const resolve = (url) => {
8501
8503
  if (!retained(url) || !URL.canParse(url, "https://deployment.invalid/")) return url;
8502
8504
  const resolved = new URL(url, "https://deployment.invalid/");
@@ -8552,16 +8554,15 @@ var appDocument = (options) => Effect_exports.gen(function* () {
8552
8554
  status: 404,
8553
8555
  headers: appPrivateHeaders
8554
8556
  });
8555
- const context = JSON.stringify({
8556
- deployment: options.deployment,
8557
- accounts: options.accountIds
8558
- }).replaceAll("<", "\\u003c");
8557
+ const context = JSON.stringify(
8558
+ Schema_exports.encodeSync(UiContext)({ version: options.version, accounts: options.accountIds })
8559
+ ).replaceAll("<", "\\u003c");
8559
8560
  const telemetry = yield* CurrentTelemetryConfig;
8560
8561
  const attribute = (text) => text.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;");
8561
8562
  const metadata = telemetry === void 0 ? "" : `<meta name="executor-build" content="${attribute(telemetry.version)}"><meta name="executor-environment" content="${attribute(telemetry.environment)}">`;
8562
8563
  const boot = `${metadata}<script type="application/json" id="executor-context">${context}</script>${appFailureBootstrap}${notice === void 0 || notice.problems.length === 0 ? "" : accountNoticeBootstrap(notice)}<script src="/_executor/watch.js" defer></script>`;
8563
8564
  return HttpServerResponse_exports.text(
8564
- deploymentDocument(new TextDecoder().decode(document.body), options.deployment).replace(
8565
+ versionDocument(new TextDecoder().decode(document.body), options.version).replace(
8565
8566
  "<!--executor-ui-->",
8566
8567
  boot
8567
8568
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.91",
3
+ "version": "0.0.1-beta.93",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,