@telepath-computer/television 1.4.29 → 1.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.
@@ -12,7 +12,7 @@ Load this skill when you need to create, update, inspect, focus, delete, or othe
12
12
 
13
13
  Read the [theming guidance](./theming.md) when creating, revising, or bringing an installed theme up to date.
14
14
 
15
- An artifact can keep data in a *JSON store*, a small database that Television keeps on its server, inspired by Firebase's Realtime Database. It keeps the data durably, shares it live with every client viewing the artifact, and lets you read and write it through the `tv` CLI. localStorage is also available to an artifact's page, but it is highly discouraged, because a future version of Television may remove it. A Markdown artifact can also act as shared, synchronized, editable state, but only within Television: through a share link it is read-only, unlike a JSON store, and it lacks the presentational flexibility and interactivity of HTML. An artifact's state can also live in a third-party API or another external service it integrates with. Which fits depends on the artifact's design, its use and the person, so you decide; for a to-do list, the standard choice is a JSON store. Read the [resource guidance](./resources.md) when an artifact needs to keep state, or when the person mentions JSON stores or resources.
15
+ An artifact can keep data in a *JSON store*, a small database that Television keeps on its server, inspired by Firebase's Realtime Database. It keeps the data durably, shares it live with every client viewing the artifact, and lets you read and write it through the `tv` CLI. `localStorage`, cookies and IndexedDB do not work in artifacts, because artifacts run under the CSP sandbox. Touching them, or `sessionStorage`, throws `SecurityError`, so code that cannot avoid touching them, such as a library, has to catch the exception. Television offers no storage that stays in one browser. A Markdown artifact can also act as shared, synchronized, editable state, but only within Television: through a share link it is read-only, unlike a JSON store, and it lacks the presentational flexibility and interactivity of HTML. An artifact's state can also live in a third-party API or another external service it integrates with. Which fits depends on the artifact's design, its use and the person, so you decide; for a to-do list, the standard choice is a JSON store. Read the [resource guidance](./resources.md) when an artifact needs to keep state, or when the person mentions JSON stores or resources.
16
16
 
17
17
  Re-read this skill only if it is not already in your context or you know it changed.
18
18
 
@@ -403,6 +403,8 @@ Replace `<version>` with the target Television app version. For a running server
403
403
 
404
404
  `authoredForAppVersion` is advisory authoring context for a future agent. The server ignores it when serving the stylesheet, so it neither asserts compatibility nor controls whether the artifact loads. Set it when creating an artifact or deliberately re-authoring one against that app surface. Preserve an existing `authoredForAppVersion` value during unrelated maintenance. If you cannot establish the target app version, omit the query parameter; the canonical URL remains valid without it.
405
405
 
406
+ Third-party mapping services such as Google Maps and OpenStreetMap may not work correctly in an artifact, because the CSP sandbox the artifact runs under strips the referrer and other information they expect. For a map, use Leaflet with Esri's street or satellite tiles (World Street Map or World Imagery), which work in a sandboxed artifact.
407
+
406
408
  ### Suggested HTML file set
407
409
 
408
410
  For durable HTML artifacts, write nearby documentation so a future agent can maintain the work:
@@ -2,7 +2,7 @@
2
2
 
3
3
  A *JSON store* is a small database that Television keeps on its server, inspired by Firebase's Realtime Database. It keeps an artifact's data durably, shares it live with every client viewing the artifact, and lets you read and write it through the `tv` CLI while the person uses the page.
4
4
 
5
- An artifact's state can live elsewhere too. localStorage is also available to an artifact's page, but it is highly discouraged, because a future version of Television may remove it. A Markdown artifact can also act as shared, synchronized, editable state, which the person edits in Television and you edit on disk, but it is editable only within Television: shared through a share link, it is read-only, unlike a JSON store. It also lacks the presentational flexibility and interactivity of an HTML page. State can also live in a third-party API or another external service the artifact integrates with. Which fits depends on the artifact's design, its use and the person, so you decide; for a to-do list, the standard choice is a JSON store.
5
+ An artifact's state can live elsewhere too. `localStorage`, cookies and IndexedDB do not work in artifacts, because artifacts run under the CSP sandbox. Touching them, or `sessionStorage`, throws `SecurityError`, so code that cannot avoid touching them, such as a library, has to catch the exception. Television offers no storage that stays in one browser. A Markdown artifact can also act as shared, synchronized, editable state, which the person edits in Television and you edit on disk, but it is editable only within Television: shared through a share link, it is read-only, unlike a JSON store. It also lacks the presentational flexibility and interactivity of an HTML page. State can also live in a third-party API or another external service the artifact integrates with. Which fits depends on the artifact's design, its use and the person, so you decide; for a to-do list, the standard choice is a JSON store.
6
6
 
7
7
  A JSON store is Television's first type of *resource*: data the server keeps for artifacts. Every HTML artifact has its own JSON store, which its page uses from the resource SDK and you use from the shell with `tv resource json`.
8
8
 
@@ -206,9 +206,9 @@ third-party API such as the person's productivity app when it has an HTTP API,
206
206
  or from the HTML itself, written into the artifact. A JSON store keeps a list's
207
207
  data durably, shares it live with every client viewing the artifact and lets
208
208
  you read and write it; it is the standard choice for a to-do list's data, and
209
- the `television` skill's `resources.md` describes it. localStorage is also
210
- available, but it is highly discouraged, because a future version of
211
- Television may remove it.
209
+ the `television` skill's `resources.md` describes it. `localStorage`, cookies
210
+ and IndexedDB do not work in artifacts, because artifacts run under the CSP
211
+ sandbox.
212
212
 
213
213
  When the tasks arrive or change while the page is open, as when you render
214
214
  them from a JSON store, put the list's status or error message in the page
@@ -0,0 +1 @@
1
+ (function(){const A=document.createElement("link").relList;if(A&&A.supports&&A.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))M(f);new MutationObserver(f=>{for(const y of f)if(y.type==="childList")for(const S of y.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&M(S)}).observe(document,{childList:!0,subtree:!0});function R(f){const y={};return f.integrity&&(y.integrity=f.integrity),f.referrerPolicy&&(y.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?y.credentials="include":f.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function M(f){if(f.ep)return;f.ep=!0;const y=R(f);fetch(f.href,y)}})();const k="url-target-request",G="url-target",K="artifact-missing-request",Y="artifact-missing",q="proxy-content-changed",F="bridge-ready",B="leaving",X="artifact-pointer";function v(t,A){return!(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="ArrowUp"||t.key==="ArrowDown")||t.isComposing||t.metaKey||t.shiftKey?!1:A==="darwin"||/^(Mac|iPhone|iPad|iPod)/i.test(A)?t.altKey&&!t.ctrlKey:t.ctrlKey&&!t.altKey}function h(t){return typeof t=="object"&&t!==null}function V(t){return!h(t)||t.type!==k?!1:!("id"in t)}function W(t){return!h(t)||t.type!==G||typeof t.url!="string"&&t.url!==null?!1:!("id"in t)}function $(t){return!h(t)||t.type!==K?!1:!("id"in t)}function j(t){return!h(t)||t.type!==Y||typeof t.title!="string"||typeof t.path!="string"?!1:!("id"in t)}function w(t){return!h(t)||t.type!==q?!1:!("id"in t)}function H(t){return!h(t)||t.type!==F||typeof t.guid!="string"?!1:!("id"in t)}function Q(t){return!h(t)||t.type!==B||typeof t.guid!="string"?!1:!("id"in t)}function z(t){return!h(t)||t.type!=="navigation-request"||typeof t.url!="string"||"replace"in t&&typeof t.replace!="boolean"||"sameDocument"in t&&typeof t.sameDocument!="boolean"||"native"in t&&typeof t.native!="boolean"?!1:!("id"in t)}function Z(t){return!h(t)||t.type!=="navigation-key"||t.key!=="ArrowLeft"&&t.key!=="ArrowRight"&&t.key!=="ArrowUp"&&t.key!=="ArrowDown"?!1:!("id"in t)}function J(t){return!h(t)||t.type!==X||t.eventType!=="pointermove"&&t.eventType!=="pointerdown"&&t.eventType!=="pointerup"&&t.eventType!=="pointercancel"&&t.eventType!=="click"||typeof t.clientX!="number"||!Number.isFinite(t.clientX)||typeof t.clientY!="number"||!Number.isFinite(t.clientY)||typeof t.button!="number"||!Number.isFinite(t.button)||typeof t.buttons!="number"||!Number.isFinite(t.buttons)?!1:!("id"in t)}function tt(t=window,A={}){const R=t;if(t.parent===t||R.__televisionArtifactBridgeInstalled===!0)return;R.__televisionArtifactBridgeInstalled=!0;const f=(()=>{const c=Date.now().toString(36);try{const g=t.crypto;if(g&&typeof g.getRandomValues=="function"){const u=new Uint32Array(4);return g.getRandomValues(u),`tvb-${c}-${Array.from(u,L=>L.toString(36)).join("-")}`}}catch{}return`tvb-${c}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})(),y=()=>{t.parent.postMessage({type:"bridge-ready",guid:f},"*")};t.addEventListener("pagehide",()=>{t.parent.postMessage({type:"leaving",guid:f},"*")}),t.addEventListener("pageshow",m=>{m.persisted===!0&&y()}),t.addEventListener("keydown",m=>{const a=m,c=a.key==="ArrowLeft"||a.key==="ArrowRight"||a.key==="ArrowUp"||a.key==="ArrowDown",g=t.navigator.platform,L=g==="darwin"||/^(Mac|iPhone|iPad|iPod)/i.test(g)?a.altKey&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey:a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey;!c||a.isComposing||!L||(a.preventDefault(),t.parent.postMessage({type:"navigation-key",key:a.key},"*"))},!0);const S=["pointermove","pointerdown","pointerup","pointercancel","click"];for(const m of S)t.addEventListener(m,a=>{const c=a;c.isTrusted&&t.parent.postMessage({type:"artifact-pointer",eventType:m,clientX:c.clientX,clientY:c.clientY,button:c.button,buttons:c.buttons},"*")},!0);const O=t.location.href;if((m=>{try{const a=new URL(m);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(a.pathname)}catch{return!1}})(O)&&typeof t.fetch=="function"){const c=A.pollCadence,g=c!==void 0&&Number.isFinite(c.normalMs)&&c.normalMs>0&&Number.isFinite(c.slowMs)&&c.slowMs>=c.normalMs?c:null,u=(g==null?void 0:g.normalMs)??5e3,L=(g==null?void 0:g.slowMs)??15e3;let o=null,l=u,s=0,i=!1,e=null,r=null;const d=()=>{i&&(i=!1,s+=1,e!==null&&(t.clearTimeout(e),e=null),r==null||r.abort(),r=null)},p=()=>{if(i)return;i=!0;const n=++s,E=()=>{if(!i||n!==s)return;e=null;const T=t.AbortController,_=typeof T=="function"?new T:null;r=_,(async()=>{try{const D=await t.fetch(O,{method:"HEAD",..._?{signal:_.signal}:{}});if(!i||n!==s)return;if(!D.ok)throw new Error("Artifact poll failed");const b=D.headers.get("ETag");if(!b)throw new Error("Artifact poll missing ETag");l=u,o===null?o=b:b!==o&&(o=b,t.parent.postMessage({type:"proxy-content-changed"},"*"))}catch{i&&n===s&&(l=Math.min(L,l*2))}finally{r===_&&(r=null),i&&n===s&&(e=t.setTimeout(E,l))}})()};E()};t.addEventListener("pagehide",d),t.addEventListener("pageshow",n=>{n.persisted===!0&&p()}),p()}if(A.reportNavigation!==!1){const m=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]),a=(o,l)=>{try{const s=new URL(o,l);return s.protocol==="http:"||s.protocol==="https:"||m.has(s.protocol)?null:s}catch{return null}},c=(o,l)=>{try{const s=new URL(o,l);return s.protocol==="http:"||s.protocol==="https:"?s:null}catch{return null}},g=o=>{var n;const l=o.type==="click"&&o.button===0,s=o.type==="auxclick"&&o.button===1;if(!l&&!s)return;const i=(n=t.document.defaultView)==null?void 0:n.Element;if(!i||!(o.target instanceof i))return;const e=o.target.closest("a[href]");if(!e)return;const r=a(e.href,t.document.baseURI);if(!r)return;const d=e.target.toLowerCase();!(s||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||d!==""&&d!=="_self")&&!e.hasAttribute("download")||(o.preventDefault(),t.location.href=r.href)};t.document.addEventListener("click",g,!0),t.document.addEventListener("auxclick",g,!0);const u=o=>{t.parent.postMessage({type:"navigation-request",...o},"*")};u({url:t.location.href});const L=t.navigation;if(L&&L.currentEntry!==null)L.addEventListener("navigate",o=>{var p,n;const l=o,s=(p=l.destination)==null?void 0:p.url;if(typeof s!="string")return;const i=c(s,t.location.href);if(!i)return;const e=((n=l.destination)==null?void 0:n.sameDocument)===!0,r={url:s,...l.navigationType==="replace"?{replace:!0}:{},...e?{sameDocument:!0}:{}};if(e){u(r);return}if(i.origin===t.location.origin){u({...r,native:!0});return}l.canIntercept!==!1&&l.preventDefault(),u(r)});else{const o=(i,e)=>{let r=null;t.addEventListener(i,d=>{r&&t.removeEventListener(i,r);const p=n=>{n===d&&(t.removeEventListener(i,p),r=null,n.defaultPrevented||e(n))};r=p,t.addEventListener(i,p)},!0)};o("click",i=>{var E;const e=i;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const r=(E=t.document.defaultView)==null?void 0:E.Element;if(!r||!(e.target instanceof r))return;const d=e.target.closest("a[href]");if(!d||d.target&&d.target.toLowerCase()!=="_self"||d.hasAttribute("download")||!d.getAttribute("href"))return;const n=c(d.href,t.document.baseURI);if(n){if(n.origin===t.location.origin&&n.pathname===t.location.pathname&&n.search===t.location.search&&n.hash!==""){u({url:n.href,sameDocument:!0});return}e.preventDefault(),u({url:n.href})}});const l=t.history.pushState.bind(t.history),s=t.history.replaceState.bind(t.history);t.history.pushState=function(...e){l(...e),u({url:t.location.href,sameDocument:!0})},t.history.replaceState=function(...e){s(...e),u({url:t.location.href,replace:!0,sameDocument:!0})},t.addEventListener("popstate",()=>{u({url:t.location.href,sameDocument:!0})}),t.addEventListener("hashchange",()=>{u({url:t.location.href,sameDocument:!0})}),o("submit",i=>{var U,I,C;const e=i,r=e.target,d=(U=t.document.defaultView)==null?void 0:U.HTMLFormElement;if(!d||!(r instanceof d))return;const p=e.submitter??null,n=N=>p!=null&&p.hasAttribute(N)?p.getAttribute(N)??"":null,E=n("formtarget")??r.getAttribute("target");if(E&&E.toLowerCase()!=="_self")return;const T=(I=n("formmethod")??r.getAttribute("method"))==null?void 0:I.toLowerCase();if(T==="post"||T==="dialog")return;const _=c((n("formaction")??r.getAttribute("action"))||t.location.href,t.document.baseURI);if(!_)return;const D=(C=t.document.defaultView)==null?void 0:C.FormData;if(!D)return;const b=new URLSearchParams;for(const[N,P]of new D(r,p))b.append(N,typeof P=="string"?P:P.name);_.search=b.toString(),e.preventDefault(),u({url:_.href})})}}y()}export{Y as A,G as U,J as a,Q as b,H as c,Z as d,z as e,w as f,V as g,v as h,$ as i,tt as j,j as k,K as l,W as m,k as n};
@@ -1 +1 @@
1
- import{j as d,k as m,l as p}from"./artifact-bridge-BEUWXKq7.js";import{m as l,a as E,b as f}from"./missing-artifact-page-DVzJ41AE.js";d(window,{reportNavigation:!1});document.getElementById("missing-title")!==null&&i(null);window.addEventListener("message",t=>{t.source===window.parent&&m(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{m(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var g;(g=window.__televisionContentBridge)==null||g.postToHost(c);function i(t,n=document){const e=w(n);if(e.title.textContent=l(),e.description.textContent=E(),e.recovery.textContent=f(),n.title=(t==null?void 0:t.title)||l(),t===null){e.path.textContent="",e.pathBlock.hidden=!0;return}e.path.textContent=t.path,e.pathBlock.hidden=!1}function w(t){const n=t.getElementById("missing-title"),e=t.getElementById("missing-description"),s=t.getElementById("path-block"),o=t.getElementById("missing-path"),r=t.getElementById("missing-recovery");if(!(n instanceof HTMLElement))throw new Error("Missing #missing-title");if(!(e instanceof HTMLElement))throw new Error("Missing #missing-description");if(!(s instanceof HTMLElement))throw new Error("Missing #path-block");if(!(o instanceof HTMLElement))throw new Error("Missing #missing-path");if(!(r instanceof HTMLElement))throw new Error("Missing #missing-recovery");return{title:n,description:e,pathBlock:s,path:o,recovery:r}}
1
+ import{j as d,k as m,l as p}from"./artifact-bridge-DTPacxDw.js";import{m as l,a as E,b as f}from"./missing-artifact-page-DVzJ41AE.js";d(window,{reportNavigation:!1});document.getElementById("missing-title")!==null&&i(null);window.addEventListener("message",t=>{t.source===window.parent&&m(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{m(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var g;(g=window.__televisionContentBridge)==null||g.postToHost(c);function i(t,n=document){const e=w(n);if(e.title.textContent=l(),e.description.textContent=E(),e.recovery.textContent=f(),n.title=(t==null?void 0:t.title)||l(),t===null){e.path.textContent="",e.pathBlock.hidden=!0;return}e.path.textContent=t.path,e.pathBlock.hidden=!1}function w(t){const n=t.getElementById("missing-title"),e=t.getElementById("missing-description"),s=t.getElementById("path-block"),o=t.getElementById("missing-path"),r=t.getElementById("missing-recovery");if(!(n instanceof HTMLElement))throw new Error("Missing #missing-title");if(!(e instanceof HTMLElement))throw new Error("Missing #missing-description");if(!(s instanceof HTMLElement))throw new Error("Missing #path-block");if(!(o instanceof HTMLElement))throw new Error("Missing #missing-path");if(!(r instanceof HTMLElement))throw new Error("Missing #missing-recovery");return{title:n,description:e,pathBlock:s,path:o,recovery:r}}
@@ -0,0 +1 @@
1
+ function t(){return"Artifact file not found"}function i(){return"This artifact is still registered, but the file or directory it points at is missing."}function e(){return"Recreate the file at this path, update the artifact path, or remove the artifact."}export{i as a,e as b,t as m};
@@ -95,9 +95,9 @@
95
95
  display: none !important;
96
96
  }
97
97
  </style>
98
- <script type="module" crossorigin src="../../assets/artifactMissing-CUs1ZwDx.js"></script>
99
- <link rel="modulepreload" crossorigin href="../../assets/artifact-bridge-BEUWXKq7.js">
100
- <link rel="modulepreload" crossorigin href="../../assets/missing-artifact-page-DVzJ41AE.js">
98
+ <script type="module" crossorigin src="../../views/artifact-missing/assets/artifactMissing-CpOfWSs9.js"></script>
99
+ <link rel="modulepreload" crossorigin href="../../views/artifact-missing/assets/artifact-bridge-DTPacxDw.js">
100
+ <link rel="modulepreload" crossorigin href="../../views/artifact-missing/assets/missing-artifact-page-DVzJ41AE.js">
101
101
  </head>
102
102
  <body>
103
103
  <main class="artifact-error">