dsh-open-artifact 0.21.0 → 0.21.1
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.
- package/CHANGELOG.md +24 -0
- package/lib/client.js +1 -1
- package/lib/index.js +3 -3
- package/package.json +1 -1
- package/skills/open-artifact/SKILL.md +1 -1
- package/vendor/artifact-types/design/SKILL.md +2 -1
- package/vendor/frame-host/frame-host.mjs +11 -2
- package/vendor/harnesses/devin.json +35 -0
- package/vendor/harnesses/grok.json +40 -0
- package/vendor/home/assets/{RuntimeUpdate-CmBVgpKd.js → RuntimeUpdate-BOIlWFfI.js} +1 -1
- package/vendor/home/assets/{browser-models-BJUjRwnz.js → browser-models-3aVE6rn4.js} +4 -4
- package/vendor/home/assets/{library-Bfi8A7fd.js → library-BhLQr6kZ.js} +1 -1
- package/vendor/home/assets/{main-CYBhroAD.js → main-o7SEvnd_.js} +2 -2
- package/vendor/home/assets/{node.browser-CLjqH8aC.js → node.browser-CizCFjUG.js} +1 -1
- package/vendor/home/assets/{node.browser-CdnMipDo.js → node.browser-KUQJs3z3.js} +1 -1
- package/vendor/home/index.html +2 -2
- package/vendor/home/library/index.html +2 -2
- package/vendor/open-artifact.mjs +652 -117
- package/vendor/runtime.json +1 -1
- package/vendor/{type-server/shell/assets/browser-models-lVIONCZ2.js → shell/assets/browser-models-DopeDmMn.js} +4 -4
- package/vendor/{type-server/shell/assets/index-DYxWC7kd.js → shell/assets/index-iHIB9nV3.js} +20 -20
- package/vendor/shell/assets/{node.browser-Fn3j26dA.js → node.browser-CPAwDm0e.js} +1 -1
- package/vendor/shell/assets/{node.browser-CYQRVS5J.js → node.browser-DHzU1njp.js} +1 -1
- package/vendor/shell/index.html +1 -1
- package/vendor/type-server/cli.mjs +168 -35
- package/vendor/type-server/editors/design/assets/index-CxAdfVEh.css +1 -0
- package/vendor/type-server/editors/design/assets/index-DzjY9u2e.js +319 -0
- package/vendor/type-server/editors/design/index.html +2 -2
- package/vendor/type-server/editors/whiteboard/assets/{gif-jobs-CSXWfYAh.js → gif-jobs-DotLwPR1.js} +1 -1
- package/vendor/type-server/editors/whiteboard/assets/{index-DR1eaICq.js → index-DJZnsHFP.js} +2 -2
- package/vendor/type-server/editors/whiteboard/assets/{index-D-xQam4e.js → index-DZuwdE-7.js} +82 -82
- package/vendor/type-server/editors/whiteboard/index.html +1 -1
- package/vendor/{shell/assets/browser-models-lVIONCZ2.js → type-server/shell/assets/browser-models-DopeDmMn.js} +4 -4
- package/vendor/{shell/assets/index-DYxWC7kd.js → type-server/shell/assets/index-iHIB9nV3.js} +20 -20
- package/vendor/type-server/shell/assets/{node.browser-Fn3j26dA.js → node.browser-CPAwDm0e.js} +1 -1
- package/vendor/type-server/shell/assets/{node.browser-CYQRVS5J.js → node.browser-DHzU1njp.js} +1 -1
- package/vendor/type-server/shell/index.html +1 -1
- package/vendor/type-server/editors/design/assets/index-8neGOVT0.css +0 -1
- package/vendor/type-server/editors/design/assets/index-IlyUOyF7.js +0 -319
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@ Every release of Open Artifact: the `@open-artifact/*` libraries, `@open-artifac
|
|
|
6
6
|
Each entry is written from the commits since the previous tag (`node scripts/changelog.mjs` lists them); see
|
|
7
7
|
[Releasing](README.md#releasing).
|
|
8
8
|
|
|
9
|
+
## [0.21.1] - 2026-12-03
|
|
10
|
+
|
|
11
|
+
Follow individual agent requests through completion, play Design prototypes one screen at a time, and use Open Artifact from Grok Build or local Devin sessions.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Design's Prototype view opens one screen at a time. Follow links between screens, fill the canvas with the current screen, or return to the previous canvas position.
|
|
16
|
+
- The Grok Build CLI and local Devin agents (CLI and Desktop) can open artifacts and receive comments through their plugins.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Design's tools now sit at the bottom of the canvas. Artboard titles offer playback on the canvas or in full screen, export of individual artboards, and export of selected artboards together as a PDF.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Whiteboard and the Shell's Ask pane track each request by ID, so another request finishing cannot mark yours done. Requests and comments waiting for an agent follow the artifact when it changes owners. Hosted pages receive status updates when the owner's agent takes or finishes a request.
|
|
25
|
+
- The type server's command-line entry point is executable again.
|
|
26
|
+
|
|
27
|
+
### Integrators
|
|
28
|
+
|
|
29
|
+
- `artifacts.ask` and `agent.send` return a request ID. Clients can subscribe to `request/state` and read per-request states from artifact presence after reconnecting. Hosts can negotiate `features.requests` to receive updates over `link.requests`.
|
|
30
|
+
- The new `grok` and `devin` harness profiles support their respective hook formats. The Devin integration uses `DEVIN_PROJECT_DIR` to locate the workspace.
|
|
31
|
+
|
|
9
32
|
## [0.21.0] - 2026-12-03
|
|
10
33
|
|
|
11
34
|
Edit Motion films on a timeline, follow an agent around a canvas, and open artifacts directly from Orca terminals.
|
|
@@ -917,6 +940,7 @@ One version for every package, with Docs and Sheets in every plugin.
|
|
|
917
940
|
- Plugins for Claude Code, Codex, Cursor, Copilot, ChatGPT and DeepSeek Harness.
|
|
918
941
|
- English and Chinese READMEs, under Apache-2.0.
|
|
919
942
|
|
|
943
|
+
[0.21.1]: https://github.com/JimLiu/open-artifact/compare/v0.21.0...v0.21.1
|
|
920
944
|
[0.21.0]: https://github.com/JimLiu/open-artifact/compare/v0.20.0...v0.21.0
|
|
921
945
|
[0.20.0]: https://github.com/JimLiu/open-artifact/compare/v0.19.3...v0.20.0
|
|
922
946
|
[0.19.3]: https://github.com/JimLiu/open-artifact/compare/v0.19.2...v0.19.3
|
package/lib/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-open-artifact 0.21.
|
|
1
|
+
// dsh-open-artifact 0.21.1: the DSH plugin (browser half). Built by scripts/build.mjs; do not edit.
|
|
2
2
|
window.__ModuleLoader__.load({
|
|
3
3
|
id: "dsh-open-artifact",
|
|
4
4
|
factory: (require) => {
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-open-artifact 0.21.
|
|
1
|
+
// dsh-open-artifact 0.21.1: the DSH plugin (server half). Built by scripts/build.mjs; do not edit.
|
|
2
2
|
|
|
3
3
|
// packages/harness-kit/src/daemon.ts
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
@@ -1973,7 +1973,7 @@ import { join as join3, resolve as resolve3 } from "node:path";
|
|
|
1973
1973
|
// packages/harness-kit/package.json
|
|
1974
1974
|
var package_default = {
|
|
1975
1975
|
name: "@open-artifact/harness-kit",
|
|
1976
|
-
version: "0.21.
|
|
1976
|
+
version: "0.21.1",
|
|
1977
1977
|
private: true,
|
|
1978
1978
|
type: "module",
|
|
1979
1979
|
description: "The SDK an agent app uses to integrate Open Artifact: find or start the local daemon, hold a Harness API connection that reconnects, register the tools, take comment wakes and page opens, and follow the artifacts its sessions make.",
|
|
@@ -1983,7 +1983,7 @@ var package_default = {
|
|
|
1983
1983
|
"./embed": "./src/embed/index.ts"
|
|
1984
1984
|
},
|
|
1985
1985
|
dependencies: {
|
|
1986
|
-
"@open-artifact/protocol": "0.21.
|
|
1986
|
+
"@open-artifact/protocol": "0.21.1"
|
|
1987
1987
|
},
|
|
1988
1988
|
sideEffects: false,
|
|
1989
1989
|
engines: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-open-artifact",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "Open Artifact in DeepSeek Harness: the Artifact, ArtifactData and ArtifactComments tools, comments on artifact pages waking the session that owns them, the Open Artifact page in the sidebar listing the open-artifact library, artifacts the agent opens shown in the session's Browser, and /open-artifact <type> to make a new one.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: open-artifact
|
|
3
3
|
description: Make an Open Artifact (a slide deck, a design canvas, a whiteboard, a data dashboard, a doc, a short animated motion piece, …) as a folder of files that opens as a live local page where the person views, edits, comments and exports, with their comments coming back to you. Use when the person types `/open-artifact <type> <what to make>`, or asks for something they will look at closely, keep, change, comment on or present - a presentation, pitch or talk deck; app screens, a mockup, a landing page, a poster, flyer or graphic, or "a few options" to look at; a brainstorm or retro board, a flowchart or an architecture sketch; a dashboard, metrics page, KPI tracker or recurring report from their data; a document, report, proposal, plan, spec, memo, notes or other writing to keep, share or comment on; a short animated video, an explainer, a promo, motion graphics or a GIF; a widget or mini game - or asks to keep or share a diagram you drew. Not for answers read once, code, or a file in a format they named.
|
|
4
4
|
argument-hint: <type> <what to make>
|
|
5
|
-
generated-by: open-artifact 0.21.
|
|
5
|
+
generated-by: open-artifact 0.21.1
|
|
6
6
|
etag: 8c07c13872fe8f42
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -41,7 +41,8 @@ Read `<root>/project/canvas.json`: none, or `boards` empty: if just made, see Cr
|
|
|
41
41
|
|
|
42
42
|
Tell the person what happens on the canvas, never the mechanism.
|
|
43
43
|
When your reply mentions an artboard or a canvas page, give its link: the editor's `url` followed by `#artboard-<name>` (the
|
|
44
|
-
artboard selected and in view), `#play-<name>` (running
|
|
44
|
+
artboard selected and in view), `#play-<name>` (running: an interactive artboard as a screen of Prototype view, any other
|
|
45
|
+
on the canvas) or `#page-<id>` (a page id from the index).
|
|
45
46
|
`<name>` is its path under `project/` without `.dc.html`, in lower case, each run of other characters one `-`
|
|
46
47
|
(`screens/Sign In.dc.html` → `screens-sign-in`). A name that fits two artboards opens nothing.
|
|
47
48
|
Asked to send it to apps like Canva: there is no Send to here; point the person to **Share → Export** in the global frame shell to
|
|
@@ -383,6 +383,11 @@ var TYPE_API_ROUTES = {
|
|
|
383
383
|
task: "task",
|
|
384
384
|
/** `POST { id, at }`: the owner's view context of the artifact changed (the daemon tells adapters, throttled). */
|
|
385
385
|
context: "context",
|
|
386
|
+
/**
|
|
387
|
+
* `POST { id }`: the agent's work on the artifact stopped (nothing was written to it for a while). What a session
|
|
388
|
+
* took of the artifact's requests is done then, when the daemon hears no turn ends of that session.
|
|
389
|
+
*/
|
|
390
|
+
quiet: "quiet",
|
|
386
391
|
/**
|
|
387
392
|
* `POST` `TypeApiSampleRequest` (sample.ts, with every `sample` body): a page's `sample` call, streamed. The one Type API route whose answer is a
|
|
388
393
|
* stream: NDJSON (`SAMPLE_STREAM_CONTENT_TYPE`) of `SampleStreamEvent`s, kept open until `done` or
|
|
@@ -5492,10 +5497,14 @@ var TypeApi = class {
|
|
|
5492
5497
|
return this.call(TYPE_API_ROUTES.artifact, { query: { id } });
|
|
5493
5498
|
}
|
|
5494
5499
|
/** Hands comment threads and page requests to the owner's session. */
|
|
5495
|
-
wake(id, { threads, requests } = {}) {
|
|
5496
|
-
const body = { id, ...threads ? { threads } : {}, ...requests ? { requests } : {} };
|
|
5500
|
+
wake(id, { threads, requests, stage } = {}) {
|
|
5501
|
+
const body = { id, ...threads ? { threads } : {}, ...requests ? { requests } : {}, ...stage ? { stage: true } : {} };
|
|
5497
5502
|
return this.call(TYPE_API_ROUTES.wake, { body });
|
|
5498
5503
|
}
|
|
5504
|
+
/** Reports that the agent's work on the artifact stopped: nothing was written to it for a while. */
|
|
5505
|
+
quiet(id) {
|
|
5506
|
+
return this.call(TYPE_API_ROUTES.quiet, { body: { id } });
|
|
5507
|
+
}
|
|
5499
5508
|
/** Whether an agent is there to receive, and whether it is busy. */
|
|
5500
5509
|
presence(id) {
|
|
5501
5510
|
return this.call(TYPE_API_ROUTES.presence, { query: { id } });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "devin",
|
|
3
|
+
"title": "Devin",
|
|
4
|
+
"agentName": "Devin",
|
|
5
|
+
"level": "L2",
|
|
6
|
+
"entry": "mcp",
|
|
7
|
+
"plugin": "open-artifact",
|
|
8
|
+
"mcp": {
|
|
9
|
+
"command": "node",
|
|
10
|
+
"args": [
|
|
11
|
+
"${PLUGIN_ROOT}/skills/open-artifact/scripts/open-artifact.mjs",
|
|
12
|
+
"mcp",
|
|
13
|
+
"--harness",
|
|
14
|
+
"devin"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"skillsDir": "~/.config/devin/skills",
|
|
18
|
+
"wake": [
|
|
19
|
+
"inbox"
|
|
20
|
+
],
|
|
21
|
+
"open": "browser",
|
|
22
|
+
"wakesIdle": false,
|
|
23
|
+
"hookDialect": "claude-code",
|
|
24
|
+
"caps": {
|
|
25
|
+
"tools": "mcp",
|
|
26
|
+
"commands": {
|
|
27
|
+
"names": [
|
|
28
|
+
"open-artifact"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"policy": {
|
|
33
|
+
"artifacts": "workspace"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "grok",
|
|
3
|
+
"title": "Grok Build",
|
|
4
|
+
"agentName": "Grok",
|
|
5
|
+
"level": "L2",
|
|
6
|
+
"entry": "mcp",
|
|
7
|
+
"plugin": "open-artifact",
|
|
8
|
+
"mcp": {
|
|
9
|
+
"command": "node",
|
|
10
|
+
"args": [
|
|
11
|
+
"${GROK_PLUGIN_ROOT}/skills/open-artifact/scripts/open-artifact.mjs",
|
|
12
|
+
"mcp",
|
|
13
|
+
"--harness",
|
|
14
|
+
"grok"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"sessionEnv": "GROK_SESSION_ID",
|
|
18
|
+
"skillsDir": "~/.grok/skills",
|
|
19
|
+
"wake": [
|
|
20
|
+
"inbox"
|
|
21
|
+
],
|
|
22
|
+
"open": "browser",
|
|
23
|
+
"wakesIdle": false,
|
|
24
|
+
"markers": [
|
|
25
|
+
"GROK_AGENT",
|
|
26
|
+
"GROK_SESSION_ID"
|
|
27
|
+
],
|
|
28
|
+
"hookDialect": "grok",
|
|
29
|
+
"caps": {
|
|
30
|
+
"tools": "mcp",
|
|
31
|
+
"commands": {
|
|
32
|
+
"names": [
|
|
33
|
+
"open-artifact"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"policy": {
|
|
38
|
+
"artifacts": "workspace"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -40,4 +40,4 @@ Messages that start with "${nM}" or "${oM}" carry what a person typed into an ar
|
|
|
40
40
|
`)}function DM(n){const a=[...n].filter(l=>ha(l.offer)).sort((l,s)=>l.id.localeCompare(s.id));return a.length?["<offers>","You may end a reply with one short offer to put the work into an artifact, at most once per conversation, and never in a reply that already made or changed one:",...a.map(l=>`- ${l.id}: ${ha(l.offer)}`),"</offers>"].join(`
|
|
41
41
|
`):null}function _M(n={}){const a=n.types&&n.offer!==!1?DM(n.types):null;return["<open_artifact>",[xM,NM(n.toolNames)].filter(Boolean).join(`
|
|
42
42
|
`),"",CM,"",RM,"",OM,"",MM,"",n.types?kM(n.types):'Call Artifact {action: "quickstart"} to see the installed artifact types.',...a?["",a]:[],"</open_artifact>"].filter(s=>s!==null).join(`
|
|
43
|
-
`)}_M();const LM=3e4;function HM(){const n=typeof navigator>"u"?void 0:navigator.locks;return!n||typeof BroadcastChannel>"u"||typeof EventSource>"u"?null:{openSource:a=>new EventSource(a),openChannel:a=>new BroadcastChannel(a),locks:n}}function UM(n,a){const l=`open-artifact.events ${n}`,s=new Set;let u=null,f=null,d=null;const m=b=>{for(const v of[...s])try{v(b)}catch{}},p=()=>{u=a.openChannel(l),u.onmessage=v=>{typeof v.data=="string"&&m(v.data)};const b=new AbortController;f=b,a.locks.request(l,{signal:b.signal},async()=>{if(b.signal.aborted)return;const v=a.openSource(n);v.onmessage=S=>{m(S.data),u?.postMessage(S.data)},await new Promise(S=>d=S),v.close()}).catch(()=>{})},h=()=>{f?.abort(),f=null,d?.(),d=null,u?.close(),u=null};return{listen(b){return s.add(b),s.size===1&&p(),()=>{s.delete(b)&&(s.size||h())}}}}const Hb=new Map;function zM(n,a){let l=Hb.get(n);return l||(l=UM(n,a),Hb.set(n,l)),l}class b0 extends Error{code;status;fix;constructor(a,l,s,u){super(l),this.name="ApiError",this.code=a,this.status=s,this.fix=u}}async function IM(n){try{const a=await n.json();return a&&typeof a=="object"?a:{}}catch{return{}}}const BM=15e3;async function PM(n){const a=await IM(n);if(!n.ok){const l=typeof a.code=="string"?a.code:"error",s=typeof a.message=="string"?a.message:`HTTP ${n.status}`;throw new b0(l,s,n.status,typeof a.fix=="string"?a.fix:void 0)}return a}function jM(n={}){const a=(n.base??"").replace(/\/$/,""),l=n.fetch??((f,d)=>fetch(f,d)),s=(f,d)=>`${a}/api/open-artifact.${f}${d?`?${new URLSearchParams(d)}`:""}`;async function u(f,d={}){const m=d.body===void 0?{cache:"no-store"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d.body)};d.body===void 0&&typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"&&(m.signal=AbortSignal.timeout(d.timeoutMs??BM));let p;try{p=await l(s(f,d.query),m)}catch(h){throw new b0("connect_failed",h instanceof Error?h.message:String(h),0)}return PM(p)}return{async artifacts(){const f=await u(at.artifacts);return Array.isArray(f.artifacts)?f.artifacts:[]},artifact:f=>u(at.artifact,{query:{id:f}}),async types(){const f=await u(at.types);return{roots:Array.isArray(f.roots)?f.roots:[],types:Array.isArray(f.types)?f.types:[],...Array.isArray(f.projects)?{projects:f.projects}:{}}},typesNew:f=>u(at.typesNew,{body:f}),typesEnable:(f,d)=>u(d?at.typesEnable:at.typesDisable,{body:{id:f}}),typesTrust:(f,d)=>u(at.typesTrust,{body:{dir:f,trusted:d}}),typesPreview:f=>u(at.typesPreview,{body:f}),typesInstall:(f,d)=>u(at.typesInstall,{body:{sha256:f,...d?{as:d}:{}}}),typesUninstall:f=>u(at.typesUninstall,{body:{id:f}}),typesUpdate:(f,d)=>u(at.typesUpdate,{body:{id:f,...d?{sha256:d}:{}}}),typesSites:f=>u(at.typesSites,f?{query:{remote:f}}:{}),share:f=>u(at.share,{query:{id:f}}),setShare:f=>u(at.share,{body:f}),create:f=>u(at.create,{body:f}),blank:f=>u(at.blank,{body:{id:f}}),update:f=>u(at.update,{body:f}),duplicate:(f,d)=>u(at.duplicate,{body:{id:f,...d&&{name:d}}}),remove:f=>u(at.delete,{body:{id:f}}),restore:f=>u(at.restore,{body:{id:f}}),async trashed(){const f=await u(at.artifacts,{query:{trashed:"1"}});return Array.isArray(f.artifacts)?f.artifacts:[]},purge:f=>u("artifacts.purge",{body:{id:f}}),ask:f=>u(at.ask,{body:f}),async harnesses(){const f=await u(at.harnesses);return{harnesses:Array.isArray(f.harnesses)?f.harnesses:[],adapters:Array.isArray(f.adapters)?f.adapters:[],sessions:Array.isArray(f.sessions)?f.sessions:[]}},assign:(f,d)=>u(at.assign,{body:{id:f,session:d}}),open:f=>u(at.open,{body:{id:f,host:!1}}),boot:(f,d)=>u(at.boot,{query:d?.fresh?{id:f,fresh:"1"}:{id:f},timeoutMs:LM}),async remotes(){const f=await u("remotes"),d=f.cloud&&typeof f.cloud=="object"&&Array.isArray(f.cloud.pending)?f.cloud:null;return{remotes:Array.isArray(f.remotes)?f.remotes:[],cloud:d}},cloudSettings:f=>u("cloud.settings",{body:f}),connect:(f,d)=>u("remotes.add",{body:{name:f,host:d,browse:!1}}),connectCancel:f=>u("remotes.add.cancel",{body:{name:f}}),connectWait:(f,d)=>u("remotes.add.wait",{body:{name:f,ms:d}}),publish:(f,d,m={})=>u("artifacts.publish",{body:{id:f,remote:d,...m.data?{data:!0}:{}}}),unpublish:f=>u("artifacts.unpublish",{body:{id:f}}),dataPublish:(f,d={})=>u("artifacts.data",{body:{id:f,...d}}),modelsList:()=>u(ao.modelsList),modelsSet:f=>u(ao.modelsSet,{body:f}),modelsRemove:f=>u(ao.modelsRemove,{body:{name:f}}),modelsCatalog:(f,d)=>u(ao.modelsCatalog,{query:d?{provider:f,refresh:"1"}:{provider:f}}),modelsTest:f=>u(ao.modelsTest,{body:f}),grantsList:f=>u(ao.grantsList,f?{query:{id:f}}:{}),grantsAnswer:f=>u(ao.grantsAnswer,{body:f}),grantsRevoke:f=>u(ao.grantsRevoke,{body:f}),usageSummary:f=>u(ao.usageSummary,f?{query:{id:f}}:{}),eventsUrl:s(at.events),runtimeStatus:()=>u(at.runtimeStatus),runtimeCheck:()=>u(at.runtimeCheck,{body:{}}),runtimeUpdate:f=>u(at.runtimeUpdate,{body:f?{version:f}:{}}),archiveUrl:f=>s(at.archive,{id:f}),typeIconUrl:f=>s("type.icon",{id:f})}}const os=jM();function v0(n){return n instanceof Error?n.message:String(n)}const VM=new Set(["artifacts/changed","types/changed","harness/changed","wake/state","grant/ask","grant/answered","sample/used","mcp/ask","mcp/answered","mcp/used"]);function YM(n){try{const a=JSON.parse(n);if(!a||typeof a!="object")return null;const l=a.type;return typeof l=="string"&&VM.has(l)?a:null}catch{return null}}function sk(n,a={}){const l=a.url??os.eventsUrl,s=m=>{const p=YM(m);p&&n(p)},u=a.shared!==void 0?a.shared:a.EventSource?null:HM();if(u)return zM(l,u).listen(s);const f=a.EventSource??(typeof EventSource>"u"?null:EventSource);if(!f)return()=>{};let d;try{d=new f(l)}catch{return()=>{}}return d.onmessage=m=>s(m.data),()=>d.close()}function qM(n,a=Date.now(),l=g0){if(!n)return"";const s=Date.parse(n);if(!Number.isFinite(s))return"";const u=Math.max(0,(a-s)/1e3);if(u<60)return m0(h0(l),"justNow");const f=new Intl.RelativeTimeFormat(l,{numeric:"auto"});return u<3600?f.format(-Math.round(u/60),"minute"):u<86400?f.format(-Math.round(u/3600),"hour"):u<86400*30?f.format(-Math.round(u/86400),"day"):new Date(s).toLocaleDateString(l)}function rk(n){const a=String(n??"").trim();if(!a)return"?";if(/^[-ヿ㐀-鿿가-]/.test(a))return[...a][0];const l=a.split(/\s+/);return((l[0]?.[0]??"")+(l[1]?.[0]??"")).toUpperCase()||"?"}const Ub=["#0f766e","#4f46e5","#b45309","#7c3aed","#be185d","#0369a1","#4d7c0f","#9f1239"];function uk(n){let a=0;for(const l of n)a=a*31+l.charCodeAt(0)|0;return Ub[Math.abs(a)%Ub.length]}async function ck(n){try{await navigator.clipboard.writeText(n)}catch{const a=document.createElement("textarea");a.value=n,a.style.position="fixed",a.style.opacity="0",document.body.append(a),a.select(),document.execCommand("copy"),a.remove()}}async function GM(){try{const n=await fetch(`/api/open-artifact.${at.embed}`,{cache:"no-store",signal:AbortSignal.timeout(3e3)});if(!n.ok)return null;const a=await n.json();return Array.isArray(a.hosts)?a.hosts.filter(l=>typeof l=="string"):null}catch{return null}}function fk(n=GM){let a=0,l=null;return async()=>{const s=++a,u=await n();return u&&(!l||s>l.at)&&(l={at:s,hosts:u}),{hosts:u??l?.hosts??null,latest:s===a}}}const zb=n=>{let a;const l=new Set,s=(h,b)=>{const v=typeof h=="function"?h(a):h;if(!Object.is(v,a)){const S=a;a=b??(typeof v!="object"||v===null)?v:Object.assign({},a,v),l.forEach(w=>w(a,S))}},u=()=>a,m={setState:s,getState:u,getInitialState:()=>p,subscribe:h=>(l.add(h),()=>l.delete(h))},p=a=n(s,u,m);return m},KM=(n=>n?zb(n):zb),FM=n=>n;function XM(n,a=FM){const l=Il.useSyncExternalStore(n.subscribe,Il.useCallback(()=>a(n.getState()),[n,a]),Il.useCallback(()=>a(n.getInitialState()),[n,a]));return Il.useDebugValue(l),l}const QM=n=>{const a=KM(n),l=s=>XM(a,s);return Object.assign(l,a),l},ZM=(n=>QM),Tp="open-artifact.update.dismissed";function WM(){try{return localStorage.getItem(Tp)??""}catch{return""}}const nn=ZM()(()=>({status:null,checking:!1,phase:"idle",to:"",pending:!1,error:"",dismissed:WM()}));async function dk(){try{const n=await os.runtimeStatus();nn.setState({status:n});const a=n.policy.update;!n.check&&a!=="off"&&a!=="bundled"&&S0()}catch{}}async function S0(){if(!nn.getState().checking){nn.setState({checking:!0});try{const n=await os.runtimeCheck(),a=n.check?.available??"",l=nn.getState().dismissed;nn.setState({status:n,checking:!1,...a&&a!==l?{dismissed:""}:{}})}catch(n){nn.setState({checking:!1,error:v0(n)})}}}async function xd(){const{status:n,phase:a}=nn.getState();if(a==="running")return;const l=n?.check?.available??void 0;nn.setState({phase:"running",error:""});try{const s=await os.runtimeUpdate(l),u=await os.runtimeStatus().catch(()=>nn.getState().status);nn.setState({status:u,phase:"done",to:s.installed??l??u?.running??"",pending:s.pending,error:""})}catch(s){nn.setState({phase:"failed",error:v0(s)})}}function JM(){const n=nn.getState().status?.check?.available??"";if(n){try{localStorage.setItem(Tp,n)}catch{}nn.setState({dismissed:n})}}function $M(){try{localStorage.removeItem(Tp)}catch{}nn.setState({dismissed:""})}function Ib(){nn.setState({phase:"idle",error:""})}function pk(){const{status:n,phase:a,to:l,pending:s,error:u,dismissed:f}=nn(),d=n?.check?.available??"",m=n?.running??"",p=n?.policy.update==="off"||n?.policy.update==="bundled";if(a==="idle"&&(!d||p))return null;if(a==="idle"&&d===f)return K.jsxs("div",{"data-testid":"open-artifact-update-line",className:"mb-4 flex items-center justify-between gap-2 rounded-lg border border-border bg-surface px-3 py-1.5 text-xs text-fg-muted",children:[K.jsx("span",{children:ht("updateAvailable",{version:d})}),K.jsx("button",{type:"button",className:"cursor-pointer border-0 bg-transparent p-0 text-xs font-medium text-accent hover:underline",onClick:$M,children:ht("updateShow")})]});let h,b=null,v=null;return a==="running"?h=ht("updateBusy"):a==="done"?(h=ht("updateDone",{version:l}),b=ht(s?"updateDonePending":"updateDoneCurrent"),v=K.jsx(Ia,{size:"sm",variant:"ghost",onClick:Ib,children:ht("updateClose")})):a==="failed"?(h=ht("updateFailed"),b=u?`${u} ${ht("updateFailedKept")}`:ht("updateFailedKept"),v=K.jsxs(K.Fragment,{children:[K.jsx(Ia,{size:"sm",variant:"ghost",onClick:Ib,children:ht("updateClose")}),d?K.jsx(Ia,{size:"sm",variant:"primary",onClick:()=>{xd()},children:ht("updateRetry")}):null]})):(h=ht("updateAvailable",{version:d}),b=m?ht("updateCurrent",{version:m}):null,v=K.jsxs(K.Fragment,{children:[K.jsx(Ia,{size:"sm",variant:"ghost",onClick:JM,children:ht("updateLater")}),K.jsx(Ia,{size:"sm",variant:"primary",onClick:()=>{xd()},children:ht("updateNow")})]})),K.jsx("section",{role:a==="failed"?"alert":"status","data-testid":"open-artifact-update","data-phase":a,className:cn("mb-4 rounded-xl border px-4 py-3",a==="failed"?"border-danger/40 bg-danger/5":"border-border bg-surface"),children:K.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[K.jsxs("div",{className:"min-w-0",children:[K.jsx("div",{className:"text-sm font-semibold text-fg",children:h}),b?K.jsx("div",{className:"mt-0.5 text-xs text-fg-muted",children:b}):null]}),v?K.jsx("div",{className:"flex shrink-0 items-center gap-2",children:v}):null]})})}function hk(){const{status:n,checking:a,phase:l}=nn();if(!n)return null;const s=n.check?.available??"",u=n.policy.update,f=u!=="off"&&u!=="bundled";return K.jsxs("section",{"data-testid":"runtime-version",className:"mt-6 border-t border-border pt-5",children:[K.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[K.jsxs("div",{className:"min-w-0",children:[K.jsx("h2",{className:"m-0 text-base font-semibold",children:ht("versionHeading")}),K.jsx("p",{className:"mb-0 mt-0.5 text-fg-muted",children:ht("versionSub")})]}),K.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f&&s?K.jsx(Ia,{size:"sm",variant:"primary",disabled:l==="running",onClick:()=>{xd()},children:ht(l==="running"?"updateBusy":"updateNow")}):null,K.jsx(Ia,{size:"sm",variant:"ghost",disabled:a||u==="off",icon:K.jsx(KR,{className:cn("size-3",a&&"animate-spin motion-reduce:animate-none")}),onClick:()=>{S0()},children:ht(a?"versionChecking":"versionCheck")})]})]}),K.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 rounded-xl border border-border bg-surface px-4 py-3 text-sm",children:[K.jsxs("span",{className:"font-medium text-fg",children:[ht("versionRunning"),": ",K.jsxs("code",{className:"font-mono text-xs",children:["v",n.running??"—"]})]}),n.pending?K.jsx("span",{className:"text-xs text-accent",children:ht("versionPending",{version:n.pending})}):s&&f?K.jsx("span",{className:"text-xs font-medium text-accent",children:ht("updateAvailable",{version:s})}):u==="off"?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionPolicyOff")}):u==="bundled"?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionPolicyBundled")}):n.check?.error?K.jsx("span",{className:"text-xs text-danger",children:n.check.error}):n.check?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionUpToDate")}):null,n.check?.at?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionChecked",{when:qM(n.check.at)})}):null]})]})}export{yR as $,Mx as A,sN as B,gp as C,Qv as D,Zv as E,tp as F,Jb as G,Gv as H,CS as I,Cd as J,qt as K,Ii as L,su as M,Fv as N,bA as O,np as P,Wn as Q,cu as R,Pa as S,Zn as T,CA as U,jb as V,tS as W,Xv as X,iS as Y,rS as Z,_v as _,ji as a,fk as a$,OR as a0,SA as a1,Hi as a2,id as a3,Xb as a4,Ev as a5,kv as a6,ep as a7,lp as a8,RS as a9,Uo as aA,St as aB,pp as aC,$d as aD,y1 as aE,Qn as aF,TE as aG,Gt as aH,Rd as aI,Xt as aJ,so as aK,qe as aL,Id as aM,aN,iN as aO,ja as aP,$x as aQ,bN as aR,b0 as aS,PM as aT,os as aU,Ul as aV,nk as aW,ik as aX,at as aY,ZM as aZ,lk as a_,sp as aa,xA as ab,Re as ac,hp as ad,aS as ae,pu as af,gt as ag,dN as ah,uN as ai,JR as aj,cn as ak,pN as al,Ia as am,fN as an,vN as ao,cN as ap,ns as aq,oN as ar,nN as as,mp as at,AE as au,dp as av,RR as aw,bn as ax,tt as ay,c0 as az,Pe as b,ON as b$,tk as b0,ht as b1,v0 as b2,sk as b3,ck as b4,ok as b5,g0 as b6,Lr as b7,qM as b8,hN as b9,hk as bA,yS as bB,eN as bC,rN as bD,KM as bE,XM as bF,ak as bG,$M as bH,Ib as bI,JM as bJ,xd as bK,nn as bL,PN as bM,AN as bN,RN as bO,CN as bP,xN as bQ,Eb as bR,_N as bS,LN as bT,HN as bU,UN as bV,Ob as bW,MN as bX,NN as bY,kN as bZ,DN as b_,gN as ba,GR as bb,mN as bc,BC as bd,wN as be,ts as bf,qR as bg,VS as bh,KR as bi,HS as bj,cp as bk,YN as bl,qN as bm,Mb as bn,GN as bo,TN as bp,SN as bq,jN as br,KN as bs,EN as bt,d0 as bu,yN as bv,rk as bw,uk as bx,dk as by,pk as bz,mu as c,zN as c0,WN as c1,JN as c2,$N as c3,ZN as c4,ek as c5,VN as c6,XN as c7,QN as c8,IN as c9,BN as ca,FN as cb,tN as d,qa as e,Qt as f,Ud as g,Bi as h,lN as i,K as j,Dv as k,Rv as l,hS as m,Qd as n,sn as o,Qb as p,De as q,y as r,dR as s,Hd as t,_t as u,Se as v,Wv as w,eS as x,Kv as y,Jv as z};
|
|
43
|
+
`)}_M();const LM=3e4;function HM(){const n=typeof navigator>"u"?void 0:navigator.locks;return!n||typeof BroadcastChannel>"u"||typeof EventSource>"u"?null:{openSource:a=>new EventSource(a),openChannel:a=>new BroadcastChannel(a),locks:n}}function UM(n,a){const l=`open-artifact.events ${n}`,s=new Set;let u=null,f=null,d=null;const m=b=>{for(const v of[...s])try{v(b)}catch{}},p=()=>{u=a.openChannel(l),u.onmessage=v=>{typeof v.data=="string"&&m(v.data)};const b=new AbortController;f=b,a.locks.request(l,{signal:b.signal},async()=>{if(b.signal.aborted)return;const v=a.openSource(n);v.onmessage=S=>{m(S.data),u?.postMessage(S.data)},await new Promise(S=>d=S),v.close()}).catch(()=>{})},h=()=>{f?.abort(),f=null,d?.(),d=null,u?.close(),u=null};return{listen(b){return s.add(b),s.size===1&&p(),()=>{s.delete(b)&&(s.size||h())}}}}const Hb=new Map;function zM(n,a){let l=Hb.get(n);return l||(l=UM(n,a),Hb.set(n,l)),l}class b0 extends Error{code;status;fix;constructor(a,l,s,u){super(l),this.name="ApiError",this.code=a,this.status=s,this.fix=u}}async function IM(n){try{const a=await n.json();return a&&typeof a=="object"?a:{}}catch{return{}}}const BM=15e3;async function PM(n){const a=await IM(n);if(!n.ok){const l=typeof a.code=="string"?a.code:"error",s=typeof a.message=="string"?a.message:`HTTP ${n.status}`;throw new b0(l,s,n.status,typeof a.fix=="string"?a.fix:void 0)}return a}function jM(n={}){const a=(n.base??"").replace(/\/$/,""),l=n.fetch??((f,d)=>fetch(f,d)),s=(f,d)=>`${a}/api/open-artifact.${f}${d?`?${new URLSearchParams(d)}`:""}`;async function u(f,d={}){const m=d.body===void 0?{cache:"no-store"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d.body)};d.body===void 0&&typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"&&(m.signal=AbortSignal.timeout(d.timeoutMs??BM));let p;try{p=await l(s(f,d.query),m)}catch(h){throw new b0("connect_failed",h instanceof Error?h.message:String(h),0)}return PM(p)}return{async artifacts(){const f=await u(at.artifacts);return Array.isArray(f.artifacts)?f.artifacts:[]},artifact:f=>u(at.artifact,{query:{id:f}}),async types(){const f=await u(at.types);return{roots:Array.isArray(f.roots)?f.roots:[],types:Array.isArray(f.types)?f.types:[],...Array.isArray(f.projects)?{projects:f.projects}:{}}},typesNew:f=>u(at.typesNew,{body:f}),typesEnable:(f,d)=>u(d?at.typesEnable:at.typesDisable,{body:{id:f}}),typesTrust:(f,d)=>u(at.typesTrust,{body:{dir:f,trusted:d}}),typesPreview:f=>u(at.typesPreview,{body:f}),typesInstall:(f,d)=>u(at.typesInstall,{body:{sha256:f,...d?{as:d}:{}}}),typesUninstall:f=>u(at.typesUninstall,{body:{id:f}}),typesUpdate:(f,d)=>u(at.typesUpdate,{body:{id:f,...d?{sha256:d}:{}}}),typesSites:f=>u(at.typesSites,f?{query:{remote:f}}:{}),share:f=>u(at.share,{query:{id:f}}),setShare:f=>u(at.share,{body:f}),create:f=>u(at.create,{body:f}),blank:f=>u(at.blank,{body:{id:f}}),update:f=>u(at.update,{body:f}),duplicate:(f,d)=>u(at.duplicate,{body:{id:f,...d&&{name:d}}}),remove:f=>u(at.delete,{body:{id:f}}),restore:f=>u(at.restore,{body:{id:f}}),async trashed(){const f=await u(at.artifacts,{query:{trashed:"1"}});return Array.isArray(f.artifacts)?f.artifacts:[]},purge:f=>u("artifacts.purge",{body:{id:f}}),ask:f=>u(at.ask,{body:f}),async harnesses(){const f=await u(at.harnesses);return{harnesses:Array.isArray(f.harnesses)?f.harnesses:[],adapters:Array.isArray(f.adapters)?f.adapters:[],sessions:Array.isArray(f.sessions)?f.sessions:[]}},assign:(f,d)=>u(at.assign,{body:{id:f,session:d}}),open:f=>u(at.open,{body:{id:f,host:!1}}),boot:(f,d)=>u(at.boot,{query:d?.fresh?{id:f,fresh:"1"}:{id:f},timeoutMs:LM}),async remotes(){const f=await u("remotes"),d=f.cloud&&typeof f.cloud=="object"&&Array.isArray(f.cloud.pending)?f.cloud:null;return{remotes:Array.isArray(f.remotes)?f.remotes:[],cloud:d}},cloudSettings:f=>u("cloud.settings",{body:f}),connect:(f,d)=>u("remotes.add",{body:{name:f,host:d,browse:!1}}),connectCancel:f=>u("remotes.add.cancel",{body:{name:f}}),connectWait:(f,d)=>u("remotes.add.wait",{body:{name:f,ms:d}}),publish:(f,d,m={})=>u("artifacts.publish",{body:{id:f,remote:d,...m.data?{data:!0}:{}}}),unpublish:f=>u("artifacts.unpublish",{body:{id:f}}),dataPublish:(f,d={})=>u("artifacts.data",{body:{id:f,...d}}),modelsList:()=>u(ao.modelsList),modelsSet:f=>u(ao.modelsSet,{body:f}),modelsRemove:f=>u(ao.modelsRemove,{body:{name:f}}),modelsCatalog:(f,d)=>u(ao.modelsCatalog,{query:d?{provider:f,refresh:"1"}:{provider:f}}),modelsTest:f=>u(ao.modelsTest,{body:f}),grantsList:f=>u(ao.grantsList,f?{query:{id:f}}:{}),grantsAnswer:f=>u(ao.grantsAnswer,{body:f}),grantsRevoke:f=>u(ao.grantsRevoke,{body:f}),usageSummary:f=>u(ao.usageSummary,f?{query:{id:f}}:{}),eventsUrl:s(at.events),runtimeStatus:()=>u(at.runtimeStatus),runtimeCheck:()=>u(at.runtimeCheck,{body:{}}),runtimeUpdate:f=>u(at.runtimeUpdate,{body:f?{version:f}:{}}),archiveUrl:f=>s(at.archive,{id:f}),typeIconUrl:f=>s("type.icon",{id:f})}}const os=jM();function v0(n){return n instanceof Error?n.message:String(n)}const VM=new Set(["artifacts/changed","types/changed","harness/changed","wake/state","request/state","grant/ask","grant/answered","sample/used","mcp/ask","mcp/answered","mcp/used"]);function YM(n){try{const a=JSON.parse(n);if(!a||typeof a!="object")return null;const l=a.type;return typeof l=="string"&&VM.has(l)?a:null}catch{return null}}function sk(n,a={}){const l=a.url??os.eventsUrl,s=m=>{const p=YM(m);p&&n(p)},u=a.shared!==void 0?a.shared:a.EventSource?null:HM();if(u)return zM(l,u).listen(s);const f=a.EventSource??(typeof EventSource>"u"?null:EventSource);if(!f)return()=>{};let d;try{d=new f(l)}catch{return()=>{}}return d.onmessage=m=>s(m.data),()=>d.close()}function qM(n,a=Date.now(),l=g0){if(!n)return"";const s=Date.parse(n);if(!Number.isFinite(s))return"";const u=Math.max(0,(a-s)/1e3);if(u<60)return m0(h0(l),"justNow");const f=new Intl.RelativeTimeFormat(l,{numeric:"auto"});return u<3600?f.format(-Math.round(u/60),"minute"):u<86400?f.format(-Math.round(u/3600),"hour"):u<86400*30?f.format(-Math.round(u/86400),"day"):new Date(s).toLocaleDateString(l)}function rk(n){const a=String(n??"").trim();if(!a)return"?";if(/^[-ヿ㐀-鿿가-]/.test(a))return[...a][0];const l=a.split(/\s+/);return((l[0]?.[0]??"")+(l[1]?.[0]??"")).toUpperCase()||"?"}const Ub=["#0f766e","#4f46e5","#b45309","#7c3aed","#be185d","#0369a1","#4d7c0f","#9f1239"];function uk(n){let a=0;for(const l of n)a=a*31+l.charCodeAt(0)|0;return Ub[Math.abs(a)%Ub.length]}async function ck(n){try{await navigator.clipboard.writeText(n)}catch{const a=document.createElement("textarea");a.value=n,a.style.position="fixed",a.style.opacity="0",document.body.append(a),a.select(),document.execCommand("copy"),a.remove()}}async function GM(){try{const n=await fetch(`/api/open-artifact.${at.embed}`,{cache:"no-store",signal:AbortSignal.timeout(3e3)});if(!n.ok)return null;const a=await n.json();return Array.isArray(a.hosts)?a.hosts.filter(l=>typeof l=="string"):null}catch{return null}}function fk(n=GM){let a=0,l=null;return async()=>{const s=++a,u=await n();return u&&(!l||s>l.at)&&(l={at:s,hosts:u}),{hosts:u??l?.hosts??null,latest:s===a}}}const zb=n=>{let a;const l=new Set,s=(h,b)=>{const v=typeof h=="function"?h(a):h;if(!Object.is(v,a)){const S=a;a=b??(typeof v!="object"||v===null)?v:Object.assign({},a,v),l.forEach(w=>w(a,S))}},u=()=>a,m={setState:s,getState:u,getInitialState:()=>p,subscribe:h=>(l.add(h),()=>l.delete(h))},p=a=n(s,u,m);return m},KM=(n=>n?zb(n):zb),FM=n=>n;function XM(n,a=FM){const l=Il.useSyncExternalStore(n.subscribe,Il.useCallback(()=>a(n.getState()),[n,a]),Il.useCallback(()=>a(n.getInitialState()),[n,a]));return Il.useDebugValue(l),l}const QM=n=>{const a=KM(n),l=s=>XM(a,s);return Object.assign(l,a),l},ZM=(n=>QM),Tp="open-artifact.update.dismissed";function WM(){try{return localStorage.getItem(Tp)??""}catch{return""}}const nn=ZM()(()=>({status:null,checking:!1,phase:"idle",to:"",pending:!1,error:"",dismissed:WM()}));async function dk(){try{const n=await os.runtimeStatus();nn.setState({status:n});const a=n.policy.update;!n.check&&a!=="off"&&a!=="bundled"&&S0()}catch{}}async function S0(){if(!nn.getState().checking){nn.setState({checking:!0});try{const n=await os.runtimeCheck(),a=n.check?.available??"",l=nn.getState().dismissed;nn.setState({status:n,checking:!1,...a&&a!==l?{dismissed:""}:{}})}catch(n){nn.setState({checking:!1,error:v0(n)})}}}async function xd(){const{status:n,phase:a}=nn.getState();if(a==="running")return;const l=n?.check?.available??void 0;nn.setState({phase:"running",error:""});try{const s=await os.runtimeUpdate(l),u=await os.runtimeStatus().catch(()=>nn.getState().status);nn.setState({status:u,phase:"done",to:s.installed??l??u?.running??"",pending:s.pending,error:""})}catch(s){nn.setState({phase:"failed",error:v0(s)})}}function JM(){const n=nn.getState().status?.check?.available??"";if(n){try{localStorage.setItem(Tp,n)}catch{}nn.setState({dismissed:n})}}function $M(){try{localStorage.removeItem(Tp)}catch{}nn.setState({dismissed:""})}function Ib(){nn.setState({phase:"idle",error:""})}function pk(){const{status:n,phase:a,to:l,pending:s,error:u,dismissed:f}=nn(),d=n?.check?.available??"",m=n?.running??"",p=n?.policy.update==="off"||n?.policy.update==="bundled";if(a==="idle"&&(!d||p))return null;if(a==="idle"&&d===f)return K.jsxs("div",{"data-testid":"open-artifact-update-line",className:"mb-4 flex items-center justify-between gap-2 rounded-lg border border-border bg-surface px-3 py-1.5 text-xs text-fg-muted",children:[K.jsx("span",{children:ht("updateAvailable",{version:d})}),K.jsx("button",{type:"button",className:"cursor-pointer border-0 bg-transparent p-0 text-xs font-medium text-accent hover:underline",onClick:$M,children:ht("updateShow")})]});let h,b=null,v=null;return a==="running"?h=ht("updateBusy"):a==="done"?(h=ht("updateDone",{version:l}),b=ht(s?"updateDonePending":"updateDoneCurrent"),v=K.jsx(Ia,{size:"sm",variant:"ghost",onClick:Ib,children:ht("updateClose")})):a==="failed"?(h=ht("updateFailed"),b=u?`${u} ${ht("updateFailedKept")}`:ht("updateFailedKept"),v=K.jsxs(K.Fragment,{children:[K.jsx(Ia,{size:"sm",variant:"ghost",onClick:Ib,children:ht("updateClose")}),d?K.jsx(Ia,{size:"sm",variant:"primary",onClick:()=>{xd()},children:ht("updateRetry")}):null]})):(h=ht("updateAvailable",{version:d}),b=m?ht("updateCurrent",{version:m}):null,v=K.jsxs(K.Fragment,{children:[K.jsx(Ia,{size:"sm",variant:"ghost",onClick:JM,children:ht("updateLater")}),K.jsx(Ia,{size:"sm",variant:"primary",onClick:()=>{xd()},children:ht("updateNow")})]})),K.jsx("section",{role:a==="failed"?"alert":"status","data-testid":"open-artifact-update","data-phase":a,className:cn("mb-4 rounded-xl border px-4 py-3",a==="failed"?"border-danger/40 bg-danger/5":"border-border bg-surface"),children:K.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[K.jsxs("div",{className:"min-w-0",children:[K.jsx("div",{className:"text-sm font-semibold text-fg",children:h}),b?K.jsx("div",{className:"mt-0.5 text-xs text-fg-muted",children:b}):null]}),v?K.jsx("div",{className:"flex shrink-0 items-center gap-2",children:v}):null]})})}function hk(){const{status:n,checking:a,phase:l}=nn();if(!n)return null;const s=n.check?.available??"",u=n.policy.update,f=u!=="off"&&u!=="bundled";return K.jsxs("section",{"data-testid":"runtime-version",className:"mt-6 border-t border-border pt-5",children:[K.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[K.jsxs("div",{className:"min-w-0",children:[K.jsx("h2",{className:"m-0 text-base font-semibold",children:ht("versionHeading")}),K.jsx("p",{className:"mb-0 mt-0.5 text-fg-muted",children:ht("versionSub")})]}),K.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f&&s?K.jsx(Ia,{size:"sm",variant:"primary",disabled:l==="running",onClick:()=>{xd()},children:ht(l==="running"?"updateBusy":"updateNow")}):null,K.jsx(Ia,{size:"sm",variant:"ghost",disabled:a||u==="off",icon:K.jsx(KR,{className:cn("size-3",a&&"animate-spin motion-reduce:animate-none")}),onClick:()=>{S0()},children:ht(a?"versionChecking":"versionCheck")})]})]}),K.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 rounded-xl border border-border bg-surface px-4 py-3 text-sm",children:[K.jsxs("span",{className:"font-medium text-fg",children:[ht("versionRunning"),": ",K.jsxs("code",{className:"font-mono text-xs",children:["v",n.running??"—"]})]}),n.pending?K.jsx("span",{className:"text-xs text-accent",children:ht("versionPending",{version:n.pending})}):s&&f?K.jsx("span",{className:"text-xs font-medium text-accent",children:ht("updateAvailable",{version:s})}):u==="off"?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionPolicyOff")}):u==="bundled"?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionPolicyBundled")}):n.check?.error?K.jsx("span",{className:"text-xs text-danger",children:n.check.error}):n.check?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionUpToDate")}):null,n.check?.at?K.jsx("span",{className:"text-xs text-fg-muted",children:ht("versionChecked",{when:qM(n.check.at)})}):null]})]})}export{yR as $,Mx as A,sN as B,gp as C,Qv as D,Zv as E,tp as F,Jb as G,Gv as H,CS as I,Cd as J,qt as K,Ii as L,su as M,Fv as N,bA as O,np as P,Wn as Q,cu as R,Pa as S,Zn as T,CA as U,jb as V,tS as W,Xv as X,iS as Y,rS as Z,_v as _,ji as a,fk as a$,OR as a0,SA as a1,Hi as a2,id as a3,Xb as a4,Ev as a5,kv as a6,ep as a7,lp as a8,RS as a9,Uo as aA,St as aB,pp as aC,$d as aD,y1 as aE,Qn as aF,TE as aG,Gt as aH,Rd as aI,Xt as aJ,so as aK,qe as aL,Id as aM,aN,iN as aO,ja as aP,$x as aQ,bN as aR,b0 as aS,PM as aT,os as aU,Ul as aV,nk as aW,ik as aX,at as aY,ZM as aZ,lk as a_,sp as aa,xA as ab,Re as ac,hp as ad,aS as ae,pu as af,gt as ag,dN as ah,uN as ai,JR as aj,cn as ak,pN as al,Ia as am,fN as an,vN as ao,cN as ap,ns as aq,oN as ar,nN as as,mp as at,AE as au,dp as av,RR as aw,bn as ax,tt as ay,c0 as az,Pe as b,ON as b$,tk as b0,ht as b1,v0 as b2,sk as b3,ck as b4,ok as b5,g0 as b6,Lr as b7,qM as b8,hN as b9,hk as bA,yS as bB,eN as bC,rN as bD,KM as bE,XM as bF,ak as bG,$M as bH,Ib as bI,JM as bJ,xd as bK,nn as bL,PN as bM,AN as bN,RN as bO,CN as bP,xN as bQ,Eb as bR,_N as bS,LN as bT,HN as bU,UN as bV,Ob as bW,MN as bX,NN as bY,kN as bZ,DN as b_,gN as ba,GR as bb,mN as bc,BC as bd,wN as be,ts as bf,qR as bg,VS as bh,KR as bi,HS as bj,cp as bk,YN as bl,qN as bm,Mb as bn,GN as bo,TN as bp,SN as bq,jN as br,KN as bs,EN as bt,d0 as bu,yN as bv,rk as bw,uk as bx,dk as by,pk as bz,mu as c,zN as c0,WN as c1,JN as c2,$N as c3,ZN as c4,ek as c5,VN as c6,XN as c7,QN as c8,IN as c9,BN as ca,FN as cb,tN as d,qa as e,Qt as f,Ud as g,Bi as h,lN as i,K as j,Dv as k,Rv as l,hS as m,Qd as n,sn as o,Qb as p,De as q,y as r,dR as s,Hd as t,_t as u,Se as v,Wv as w,eS as x,Kv as y,Jv as z};
|