opencode-background-jobs 0.0.0-stage → 0.1.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/README.md +62 -2
- package/dist/gui-experimental.cjs +1 -0
- package/package.json +34 -4
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenCode Background Jobs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-background-jobs)
|
|
4
|
+
|
|
5
|
+
An experimental OpenCode Desktop plugin for viewing running background jobs across sessions, including sessions whose tabs are closed.
|
|
6
|
+
|
|
7
|
+
## Demo
|
|
8
|
+
|
|
9
|
+
Captured in OpenCode Desktop using sample projects and sessions.
|
|
10
|
+
|
|
11
|
+
### Browse jobs and follow shell output
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
### Stop a background job
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Requires OpenCode Desktop 2.4.3.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
opencode plugin add opencode-background-jobs
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You can also add `"opencode-background-jobs"` to the global `plugins` list in `~/.config/opencode/opencode.jsonc`.
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
Requires OpenCode Desktop 2.4.3 and Bun.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bun install
|
|
35
|
+
bun run typecheck
|
|
36
|
+
bun test
|
|
37
|
+
bun run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To load a development checkout, add its absolute directory to the global `plugins` list instead of the npm package name.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Open **Background jobs** from the Desktop title bar or **Open background jobs** from the command palette. Running jobs are grouped by project, including jobs in different worktrees of the same project. Standalone sessions are grouped by working folder. Select a session to switch to its tab or open it if it was closed.
|
|
45
|
+
|
|
46
|
+
Elapsed time updates every second. The list shows a one-line shell command preview. **View output** shows the full command and up to 32 KiB of recent captured output in the same dialog, refreshed every two seconds while visible. **Back to jobs** returns to the list. For subagent jobs, **Open agent session** opens the child conversation.
|
|
47
|
+
|
|
48
|
+
**Stop** offers two choices: **Stop job only** cancels the selected job. **Stop job and agent** cancels the job and then interrupts the owning session's agent, including a turn started by the cancellation notice. Both preserve the session and its history.
|
|
49
|
+
|
|
50
|
+
The view reads the desktop application's own server. Jobs from other connected servers and OS processes that aren't registered OpenCode jobs are not included. The OpenCode GUI plugin API and job API are experimental.
|
|
51
|
+
|
|
52
|
+
## Release
|
|
53
|
+
|
|
54
|
+
Set the intended stable `x.y.z` version in `package.json`. With dependencies installed and an npm account signed in:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
bun run release # Check version and login, run tests, build, and dry-run
|
|
58
|
+
bun run release --publish # Run the same checks, then publish to npm as latest
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The script rejects an already-published or older version and never bumps the version itself. It uses Bun for tests and builds, and the npm CLI to check the registry and credentials, pack, and publish. npm may still ask for two-factor approval when publishing.
|
|
62
|
+
|
|
63
|
+
For a future GitHub Actions release job, use a GitHub-hosted runner with Bun, Node 22.14+, npm 11.5.1+, and `id-token: write`. Configure the repository URL in `package.json` and authorize the workflow for `npm publish` in [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/). Run `bun install --frozen-lockfile` followed by `bun run release --publish`. If it runs from a tag, the tag must match `v` plus the package version. The script detects GitHub OIDC availability; npm checks the workflow's publishing permission when it publishes.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),O=require("@opencode/plugin/gui"),n=require("solid-js"),N=require("solid-js/store");function ne(r,t,s){const d=new Map;for(const v of r){const C=t.get(v.sessionID),S=C?.location.directory,w=C?.projectID,x=w&&w!=="global"?s.get(w):void 0,_=w&&w!=="global"?`project:${w}`:S?`directory:${S}`:"unknown";let m=d.get(_);m||(m={label:S?ee(x?.name,x?.canonical||S):void 0,jobs:[]},d.set(_,m)),m.jobs.push(v)}return d}function ee(r,t){return r?.trim()||t.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||t}function Q(r){return r.title?.trim()?r.title:r.kind==="shell"?r.command:r.kind==="subagent"?r.description||r.agent:r.kind}function re(r){return r.replace(/(^|[\s<>])((?:\/|[A-Za-z]:[\\/])[^\s"';&|<>()]+)/g,(t,s,d)=>{if(d.length<=32)return t;const v=d.includes("/")?"/":"\\",C=d.startsWith("/")?"":d.slice(0,2);return`${s}${C}${v}…${v}${ee(void 0,d)}`})}function se(r,t){const s=Math.max(0,Math.floor((t-r)/1e3));if(s<60)return`${s}s`;if(s<3600)return`${Math.floor(s/60)}m ${s%60}s`;const d=`${Math.floor(s%3600/60)}m ${s%60}s`;return s<86400?`${Math.floor(s/3600)}h ${d}`:`${Math.floor(s/86400)}d ${Math.floor(s%86400/3600)}h ${d}`}var ie=e.template("<p class=background-jobs-message role=alert>"),ae=e.template("<p class=background-jobs-output-note>"),le=e.template("<pre class=background-jobs-output tabindex=0>"),ce=e.template("<p class=background-jobs-message role=status>");const X=32*1024;function ue(r){const t=O.usePlugin(),[s,d]=n.createSignal(""),[v,C]=n.createSignal(!1),[S,w]=n.createSignal(!0),[x,_]=n.createSignal(!1),m=new AbortController;let M=!1,h;async function J(){if(!(M||m.signal.aborted)){M=!0;try{const c=t.client,f={id:r.id,location:r.directory?{directory:r.directory}:void 0,limit:X},z={signal:AbortSignal.any([m.signal,AbortSignal.timeout(8e3)])},j=(await c.shell.output(f,z)).data,D=Math.max(0,j.size-X),E=D>0?(await c.shell.output({...f,cursor:D},z)).data:j;if(m.signal.aborted)return;const A=!h||h.scrollHeight-h.scrollTop-h.clientHeight<=4;d(E.output),C(D>0||E.truncated),A&&h&&(h.scrollTop=h.scrollHeight),_(!1)}catch{m.signal.aborted||_(!0)}finally{M=!1,m.signal.aborted||w(!1)}}}return n.onMount(()=>{J();const c=setInterval(()=>{J()},2e3);n.onCleanup(()=>{clearInterval(c),m.abort()})}),[e.createComponent(n.Show,{get when(){return x()},get children(){var c=ie();return e.insert(c,()=>t.t("outputError")),c}}),e.createComponent(n.Show,{get when(){return v()},get children(){var c=ae();return e.insert(c,()=>t.t("outputTail")),c}}),e.createComponent(n.Show,{get when(){return s()},get fallback(){return e.createComponent(n.Show,{get when(){return!x()},get children(){var c=ce();return e.insert(c,()=>t.t(S()?"outputLoading":"outputEmpty")),c}})},get children(){var c=le(),f=h;return typeof f=="function"?e.use(f,c):h=c,e.insert(c,s),e.effect(()=>e.setAttribute(c,"aria-label",t.t("shellOutput"))),c}})]}async function de(r,t,s){if(s!=="agent-only")try{await r.experimental.job.cancel({id:t.id})}catch{return"stopError"}if(s!=="job")try{await r.session.interrupt({sessionID:t.sessionID,resume:!1})}catch{return"interruptError"}return"stopped"}const pe="[data-component=dialog-v2][data-fit] [data-slot=dialog-container]:has(.opencode-background-jobs){width:min(calc(100vw - 32px),680px)}[data-slot=dialog-content]:has(.background-jobs-list-view:not([hidden]))>[data-slot=dialog-header]{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%)}.opencode-background-jobs{--jobs-text: var(--v2-text-text-base, var(--text-base));--jobs-muted: color-mix(in srgb, var(--jobs-text) 64%, var(--text-weak));--jobs-tint: color-mix(in srgb, var(--jobs-text) 5%, transparent);color:var(--jobs-text);font-size:13px}.opencode-background-jobs .background-jobs-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.opencode-background-jobs .background-jobs-detail-title{margin:0;font-size:15px;font-weight:600}.opencode-background-jobs .background-jobs-detail-task{margin:0 0 12px;color:var(--jobs-muted);overflow-wrap:anywhere}.opencode-background-jobs .background-jobs-detail-task code{font-family:ui-monospace,monospace;white-space:pre-wrap}.opencode-background-jobs .background-jobs-header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;margin-bottom:12px;padding:12px 0 8px;border-bottom:1px solid var(--border-weak-base)}.opencode-background-jobs .background-jobs-header-title{min-width:0;font-size:15px;font-weight:600;overflow-wrap:anywhere}.opencode-background-jobs .background-jobs-header-status{margin-inline-start:6px;color:var(--jobs-muted);font-size:12px;font-weight:500;font-variant-numeric:tabular-nums}.opencode-background-jobs .background-jobs-header-actions{display:flex;align-items:center;gap:4px}.opencode-background-jobs .background-jobs-count{min-width:24px;padding:2px 6px;border-radius:99px;background:var(--jobs-tint);color:var(--jobs-text);font-variant-numeric:tabular-nums;text-align:center}.opencode-background-jobs .background-jobs-groups{container-type:inline-size;display:grid;gap:16px}.opencode-background-jobs .background-jobs-group-title{display:flex;align-items:center;gap:8px;margin:0 0 6px;font-size:13px;font-weight:600;overflow-wrap:anywhere}.opencode-background-jobs .background-jobs-group-title .background-jobs-count{min-width:20px;padding:1px 5px;color:var(--jobs-muted);font-size:11px}.opencode-background-jobs .background-jobs-list{margin:0;padding:0;list-style:none;border:1px solid var(--border-weak-base);border-radius:8px}.opencode-background-jobs .background-jobs-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 12px;padding:8px 12px}.opencode-background-jobs .background-jobs-row+.background-jobs-row{border-top:1px solid var(--border-weak-base)}.opencode-background-jobs .background-jobs-row-main{min-width:0}.opencode-background-jobs .background-jobs-session{display:flex;align-items:center;gap:6px;min-height:28px;max-width:100%;padding:0 4px;margin-inline-start:-4px;border:0;border-radius:4px;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}.opencode-background-jobs .background-jobs-session:hover:not(:disabled),.opencode-background-jobs .background-jobs-session:focus-visible{background:var(--jobs-tint)}.opencode-background-jobs .background-jobs-session:focus-visible{outline:2px solid var(--jobs-text);outline-offset:-2px}.opencode-background-jobs .background-jobs-session:disabled{cursor:default}.opencode-background-jobs .background-jobs-session:disabled .background-jobs-arrow{visibility:hidden}.opencode-background-jobs .background-jobs-session-title{font-size:14px;font-weight:600;line-height:1.35;overflow-wrap:anywhere}.opencode-background-jobs .background-jobs-arrow{flex:none;color:var(--jobs-muted)}.opencode-background-jobs .background-jobs-command{display:flex;align-items:center;gap:6px;color:var(--jobs-muted);font-size:12px;line-height:1.5}.opencode-background-jobs .background-jobs-command>[aria-hidden]{display:flex;flex:none}.opencode-background-jobs .background-jobs-kind{flex:none;font-size:10px;font-weight:600;letter-spacing:.05em;text-transform:uppercase}.opencode-background-jobs .background-jobs-elapsed{color:var(--jobs-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}.opencode-background-jobs .background-jobs-task{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.opencode-background-jobs .background-jobs-shell{font-family:ui-monospace,monospace}.opencode-background-jobs .background-jobs-row-controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px}.opencode-background-jobs .background-jobs-row-controls .background-jobs-elapsed{margin-inline-end:4px}@container (max-width: 500px){.opencode-background-jobs .background-jobs-row{grid-template-columns:minmax(0,1fr)}}.opencode-background-jobs .background-jobs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:6px 12px;border-top:1px solid var(--border-weak-base)}.opencode-background-jobs .background-jobs-output-note{margin:0 0 8px;color:var(--jobs-muted)}.opencode-background-jobs.background-jobs-output-view{display:flex;flex-direction:column;height:100%;min-height:0}.opencode-background-jobs .background-jobs-output{flex:1;min-height:0;margin:0;padding:12px;overflow:auto;border:1px solid var(--border-weak-base);border-radius:8px;background:var(--jobs-tint);font:12px/1.5 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere}.opencode-background-jobs .background-jobs-output:focus-visible{outline:2px solid var(--jobs-text);outline-offset:-2px}.opencode-background-jobs .background-jobs-message{margin:0 0 12px;padding:12px;border:1px solid var(--border-weak-base);border-radius:8px}";var ge=e.template("<span aria-hidden=true>·"),Y=e.template("<p class=background-jobs-message role=alert>"),be=e.template("<div class=background-jobs-groups>"),me=e.template('<div class="opencode-background-jobs background-jobs-list-view"tabindex=-1><div class=background-jobs-header><div class=background-jobs-header-title><span aria-hidden=true></span><span class=background-jobs-header-status role=status></span></div><div class=background-jobs-header-actions>'),he=e.template("<p class=background-jobs-message>"),fe=e.template("<section><h2 class=background-jobs-group-title><span class=background-jobs-count></span></h2><ul class=background-jobs-list role=list>"),ke=e.template("<div class=opencode-background-jobs><div class=background-jobs-toolbar><h2 class=background-jobs-detail-title tabindex=-1></h2></div><p class=background-jobs-detail-task>"),je=e.template("<code>"),ve=e.template("<p>"),we=e.template("<div class=background-jobs-actions>"),xe=e.template("<span aria-hidden=true>"),ye=e.template('<li class=background-jobs-row><div class=background-jobs-row-main><button type=button class=background-jobs-session><span class=background-jobs-session-title></span><svg class=background-jobs-arrow aria-hidden=true viewBox="0 0 16 16"width=14 height=14 fill=none stroke=currentColor stroke-width=1.5><path d="M4 12l8-8M6 4h6v6"stroke-linecap=round stroke-linejoin=round></path></svg></button><div class=background-jobs-command><span class=background-jobs-kind></span><span class=background-jobs-task></span></div></div><div class=background-jobs-row-controls><span class=background-jobs-elapsed>');const $e={refresh:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M13 7A5 5 0 1 0 12 11M13 3v4H9" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m4 4 8 8m0-8-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>'},Ce={en:{title:"Background jobs",open:"Open background jobs",loading:"Looking for running jobs…",empty:"No background jobs are running.",refresh:"Refresh",close:"Close",error:"Couldn't load background jobs. Try again.",openSession:"Open session",projectUnknown:"Unknown project",running:"{{count}} running",viewOutput:"View output",backToJobs:"Back to jobs",shellOutput:"Shell output",outputLoading:"Loading output…",outputEmpty:"No output yet.",outputError:"Couldn’t read shell output. Retrying…",outputTail:"Showing recent output.",openAgent:"Open agent session",stop:"Stop",stopOnly:"Stop job only",stopWithAgent:"Stop job and agent",stopping:"Stopping…",stopConfirm:"Stop this background job?",stopDescription:"The session’s agent may start the job again. To prevent that, you can also interrupt the agent’s current turn. The session and its history are kept.",interruptError:"The job was stopped, but the session’s agent couldn’t be interrupted. Try again.",stopError:"Couldn’t stop the job. Try again.",retryInterrupt:"Interrupt agent again"},ko:{title:"백그라운드 작업",open:"백그라운드 작업 열기",loading:"실행 중인 작업을 확인하는 중…",empty:"실행 중인 백그라운드 작업이 없습니다.",refresh:"새로고침",close:"닫기",error:"작업 목록을 불러오지 못했습니다. 다시 시도해 주세요.",openSession:"세션 열기",projectUnknown:"알 수 없는 프로젝트",running:"{{count}}개 실행 중",viewOutput:"로그 보기",backToJobs:"작업 목록으로",shellOutput:"셸 출력",outputLoading:"출력을 불러오는 중…",outputEmpty:"아직 출력이 없습니다.",outputError:"셸 출력을 읽지 못했습니다. 다시 시도하는 중…",outputTail:"최근 출력만 표시합니다.",openAgent:"에이전트 세션 열기",stop:"중지",stopOnly:"작업만 중지",stopWithAgent:"작업과 에이전트 중지",stopping:"중지 중…",stopConfirm:"이 백그라운드 작업을 중지할까요?",stopDescription:"세션 에이전트가 작업을 다시 시작할 수 있습니다. 이를 막으려면 에이전트의 현재 응답도 함께 중단할 수 있습니다. 세션과 기록은 그대로 남습니다.",interruptError:"작업은 중지했지만 세션 에이전트를 중단하지 못했습니다. 다시 시도해 주세요.",stopError:"작업을 중지하지 못했습니다. 다시 시도해 주세요.",retryInterrupt:"에이전트 중단 재시도"}};function Se(r){const t=O.usePlugin(),[s,d]=N.createStore([]),[v,C]=n.createSignal(new Map),[S,w]=n.createSignal(new Map),x=n.createMemo(()=>ne(s,v(),S())),[_,m]=n.createSignal(!0),[M,h]=n.createSignal(!1),[J,c]=n.createSignal(Date.now()),[f,z]=n.createSignal(),[j,D]=n.createSignal(),[E,A]=n.createSignal(),q=()=>t.servers.list().find(o=>t.servers.get(o)?.builtin);let $=!1,H=!1,F=!1,B=0,U;function R(o){const l=q();l&&(r.close(),t.tabs.open({server:l,id:o},{focus:!0}))}async function L(){if($)return;if(H){F=!0;return}H=!0;const o=B;try{const l=t.client,p=await l.experimental.job.list({status:"running"});if($||o!==B)return;const b=[...new Set(p.map(i=>i.sessionID))],[y,g]=await Promise.all([Promise.all(b.map(async i=>[i,await l.session.get({sessionID:i}).catch(()=>{})])),b.length?l.project.list({}).catch(()=>{}):[]]);if($||o!==B)return;n.batch(()=>{C(i=>new Map(y.map(([a,k])=>[a,k??i.get(a)]))),g&&w(new Map(g.map(i=>[i.id,i]))),d(N.reconcile(p.sort((i,a)=>a.time.started-i.time.started))),h(!1)})}catch{!$&&o===B&&h(!0)}finally{H=!1,$||m(!1),F&&(F=!1,L())}}function W(){const o=f()?.trigger;z(void 0),A(void 0),queueMicrotask(()=>{$||f()||(o instanceof HTMLElement&&o.isConnected?o.focus():U?.focus())})}async function V(o,l){if(j())return;const p=E()==="interruptError";if(!p&&!s.some(b=>b.id===o.id)){W();return}D(l),p||A(void 0);try{const b=await de(t.client,o,p?"agent-only":l);if($)return;b!=="stopError"&&!p&&(B++,d(N.reconcile(s.filter(y=>y.id!==o.id))),L()),b==="stopped"?W():A(b)}finally{$||D(void 0)}}function te(o,l,p){o.kind==="shell"&&z({kind:"output",id:o.shellID,title:o.command,directory:l,trigger:p})}return n.onMount(()=>{L();const o=setInterval(()=>{L()},5e3),l=setInterval(()=>c(Date.now()),1e3);n.onCleanup(()=>{$=!0,clearInterval(o),clearInterval(l)})}),e.createComponent(t.ui.Dialog,{get title(){return t.t("title")},get size(){return f()?.kind==="output"?"x-large":"fit"},get closable(){return!!f()},get children(){return[(()=>{var o=me(),l=o.firstChild,p=l.firstChild,b=p.firstChild,y=b.nextSibling,g=p.nextSibling,i=U;return typeof i=="function"?e.use(i,o):U=o,e.insert(b,()=>t.t("title")),e.insert(y,e.createComponent(n.Show,{get when(){return!M()},get children(){return[ge()," ",e.memo(()=>e.memo(()=>!!_())()?t.t("loading"):t.t("running",{count:s.length}))]}})),e.insert(g,e.createComponent(t.ui.Tooltip,{get value(){return t.t("refresh")},get children(){return e.createComponent(t.ui.IconButton,{get icon(){return t.icons.refresh},get label(){return t.t("refresh")},size:"small",onClick:()=>{L()}})}}),null),e.insert(g,e.createComponent(t.ui.IconButton,{get icon(){return t.icons.close},get label(){return t.t("close")},size:"small",get onClick(){return r.close}}),null),e.insert(o,e.createComponent(n.Show,{get when(){return M()},get children(){var a=Y();return e.insert(a,()=>t.t("error")),a}}),null),e.insert(o,e.createComponent(n.Show,{get when(){return s.length>0},get fallback(){return e.createComponent(n.Show,{get when(){return e.memo(()=>!_())()&&!M()},get children(){var a=he();return e.insert(a,()=>t.t("empty")),a}})},get children(){var a=be();return e.insert(a,e.createComponent(n.For,{get each(){return[...x().keys()]},children:k=>(()=>{var I=fe(),T=I.firstChild,P=T.firstChild,u=T.nextSibling;return e.insert(T,()=>x().get(k)?.label||t.t("projectUnknown"),P),e.insert(P,()=>x().get(k)?.jobs.length),e.insert(u,e.createComponent(n.For,{get each(){return x().get(k)?.jobs},children:oe})),I})()})),a}}),null),e.effect(a=>{var k=!!f(),I=t.t("title");return k!==a.e&&(o.hidden=a.e=k),I!==a.t&&e.setAttribute(o,"aria-label",a.t=I),a},{e:void 0,t:void 0}),o})(),e.createComponent(n.Show,{get when(){return f()},keyed:!0,children:o=>(()=>{var l=ke(),p=l.firstChild,b=p.firstChild,y=p.nextSibling;return e.use(g=>queueMicrotask(()=>{g.isConnected&&g.focus()}),b),e.insert(b,()=>t.t(o.kind==="output"?"shellOutput":"stopConfirm")),e.insert(p,e.createComponent(t.ui.Button,{size:"small",onClick:W,get disabled(){return!!j()},get children(){return t.t("backToJobs")}}),null),e.insert(y,(()=>{var g=e.memo(()=>o.kind==="output");return()=>g()?(()=>{var i=je();return e.insert(i,()=>o.title),i})():o.title})()),e.insert(l,(()=>{var g=e.memo(()=>o.kind==="output");return()=>g()?e.createComponent(ue,{get id(){return o.id},get directory(){return o.directory}}):[(()=>{var i=ve();return e.insert(i,()=>t.t("stopDescription")),i})(),e.createComponent(n.Show,{get when(){return E()},children:i=>(()=>{var a=Y();return e.insert(a,()=>t.t(i())),a})()}),(()=>{var i=we();return e.insert(i,e.createComponent(n.Show,{get when(){return E()!=="interruptError"},get children(){return e.createComponent(t.ui.Button,{get disabled(){return!!j()},get busy(){return j()==="job"},onClick:()=>{V(o,"job")},get children(){return t.t(j()==="job"?"stopping":"stopOnly")}})}}),null),e.insert(i,e.createComponent(t.ui.Button,{variant:"danger",get disabled(){return!!j()},get busy(){return j()==="agent"},onClick:()=>{V(o,"agent")},get children(){return t.t(j()==="agent"?"stopping":E()==="interruptError"?"retryInterrupt":"stopWithAgent")}}),null),i})()]})(),null),e.effect(()=>l.classList.toggle("background-jobs-output-view",o.kind==="output")),l})()})]}});function oe(o){const l=()=>v().get(o.sessionID),p=()=>l()?.title?.trim()||o.sessionID;return(()=>{var b=ye(),y=b.firstChild,g=y.firstChild,i=g.firstChild,a=g.nextSibling,k=a.firstChild,I=k.nextSibling,T=y.nextSibling,P=T.firstChild;return g.$$click=()=>R(o.sessionID),e.insert(i,p),e.insert(a,e.createComponent(n.Show,{get when(){return o.kind==="shell"},get children(){var u=xe();return e.insert(u,e.createComponent(t.ui.Icon,{name:"terminal",size:"small"})),u}}),k),e.insert(k,()=>o.kind),e.insert(I,(()=>{var u=e.memo(()=>o.kind==="shell");return()=>u()?re(o.command):Q(o)})()),e.insert(P,()=>se(o.time.started,J())),e.insert(T,e.createComponent(n.Show,{get when(){return o.kind==="shell"},get children(){return e.createComponent(t.ui.Button,{size:"small",variant:"ghost",onClick:u=>te(o,l()?.location.directory,u.currentTarget),get children(){return t.t("viewOutput")}})}}),null),e.insert(T,e.createComponent(n.Show,{get when(){return e.memo(()=>o.kind==="subagent")()&&o.childSessionID},children:u=>e.createComponent(t.ui.Button,{size:"small",variant:"ghost",get disabled(){return!q()},onClick:()=>R(u()),get children(){return t.t("openAgent")}})}),null),e.insert(T,e.createComponent(t.ui.Button,{size:"small",variant:"ghost-muted",onClick:u=>z({kind:"stop",id:o.id,sessionID:o.sessionID,title:Q(o),trigger:u.currentTarget}),get children(){return t.t("stop")}}),null),e.effect(u=>{var Z=`${t.t("openSession")}: ${p()}`,G=!q(),K=o.kind==="shell";return Z!==u.e&&e.setAttribute(g,"aria-label",u.e=Z),G!==u.t&&(g.disabled=u.t=G),K!==u.a&&I.classList.toggle("background-jobs-shell",u.a=K),u},{e:void 0,t:void 0,a:void 0}),b})()}}const _e=O.Plugin.define({icons:$e,i18n:Ce,setup(r){r.add(O.Style,pe);let t;const s=()=>{t?.close(),t=r.dialogs.open(d=>e.createComponent(Se,{close:()=>d.close()}))};r.add(O.TitlebarItem,()=>({id:"open",label:r.t("title"),icon:"terminal",run:s})),r.add(O.Command,()=>({id:"open",title:r.t("open"),keywords:"background jobs shell subagent",run:s}))}});e.delegateEvents(["click"]);exports.default=_e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-background-jobs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "View and manage running background jobs across OpenCode Desktop sessions.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/colus001/opencode-background-jobs.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/gui-experimental.cjs"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
"./gui-experimental": "./dist/gui-experimental.cjs"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "vite build",
|
|
18
|
+
"prepack": "bun run build",
|
|
19
|
+
"release": "bun scripts/release.mjs",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"test": "bun test"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@opencode/plugin": "2.4.3"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"solid-js": "^1.9.0",
|
|
28
|
+
"typescript": "^5.9.0",
|
|
29
|
+
"vite": "^7.0.0",
|
|
30
|
+
"vite-plugin-solid": "^2.11.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
}
|
|
36
|
+
}
|