tmux-weblink 2.2.44 → 2.2.46
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/dist/assets/shell-client.js +35 -36
- package/dist/browser/bots-client.js +6 -6
- package/dist/browser/shell-client.js +24 -25
- package/dist/lib/bots/manager.js +4 -1
- package/dist/lib/bots/materialize.js +23 -9
- package/dist/lib/bots/routes.js +1 -1
- package/dist/lib/pages/shell.js +22 -3
- package/package.json +1 -1
package/dist/lib/bots/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exportBots as m,importBots as
|
|
1
|
+
import{exportBots as m,importBots as j}from"./transfer.js";function f(s,l){const{manager:o,userAuth:u}=l,a=async(r,t)=>{const e=r.req.header("x-bots-token");return e&&e===o.token?t():u()(r,t)},c=()=>a,n=()=>u();s.get("/api/bots/catalog",n(),async r=>r.json(await o.catalog())),s.get("/api/bots/templates",n(),r=>r.json(o.listTemplates())),s.post("/api/bots/templates",n(),async r=>{const t=await r.req.json().catch(()=>null);if(!t||!t.manifest||typeof t.manifest.name!="string")return r.json({error:"manifest.name is required"},400);try{const e=o.saveTemplate({id:typeof t.id=="string"?t.id:void 0,manifest:t.manifest});return r.json(e,200)}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.get("/api/bots/export",n(),r=>{const t=m(o.store);return r.json(t,200,{"content-disposition":`attachment; filename="tmux-weblink-bots-${t.exportedAt.slice(0,10)}.json"`})}),s.post("/api/bots/import",n(),async r=>{const t=await r.req.json().catch(()=>null);if(!t)return r.json({error:"invalid bundle"},400);try{return r.json(j(o.store,t,{overwriteLibrary:t.overwriteLibrary===!0}))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.delete("/api/bots/templates/:id",n(),r=>o.deleteTemplate(r.req.param("id"))?r.json({ok:!0}):r.json({error:"not found"},404)),s.get("/api/bots",a,r=>{const t=r.req.query("project")||void 0,e=r.req.query("parent")||void 0,i=r.req.query("status")||void 0;return r.json(o.listBots({project:t,parentBotId:e,parentOnly:!!e,status:i}))});const p=async r=>{const t=await r.req.json().catch(()=>null);if(!t||typeof t.templateId!="string")return r.json({error:"templateId is required"},400);try{const e=o.createInstance({templateId:t.templateId,title:typeof t.title=="string"?t.title:void 0,projectPath:typeof t.projectPath=="string"?t.projectPath:void 0,isolation:t.isolation==="worktree"?"worktree":"shared",parentBotId:typeof t.parentBotId=="string"?t.parentBotId:void 0,runtimeMode:t.runtimeMode});return r.json(e,201)}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}};s.post("/api/bots",n(),p),s.post("/api/bots/create",c(),p),s.post("/api/bots/list_templates",a,r=>r.json(o.listTemplates().map(t=>({id:t.id,name:t.manifest.name,description:t.manifest.description,orchestrator:!!t.manifest.orchestrator})))),s.post("/api/bots/list",a,async r=>{const t=await r.req.json().catch(()=>({})),e=t.parentBotId,i=o.listBots({parentBotId:t.parentOnly&&e?e:void 0,status:t.status});return r.json(i.map(d=>({id:d.id,title:d.title,status:d.status,projectPath:d.projectPath,parentBotId:d.parentBotId,depth:d.depth,lastText:d.lastText?.slice(0,400),updatedAt:d.updatedAt})))}),s.post("/api/bots/status",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return r.json(o.status(t.botId))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},404)}}),s.post("/api/bots/message",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId||typeof t.text!="string")return r.json({error:"botId and text are required"},400);try{return await o.input(t.botId,t.text,t.mode==="follow_up"?"follow_up":t.mode==="steer"?"steer":void 0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/wait",a,async r=>{const t=await r.req.json().catch(()=>({}));return!Array.isArray(t.botIds)||t.botIds.length===0?r.json({error:"botIds is required"},400):r.json(await o.waitFor(t.botIds,typeof t.timeoutMs=="number"?t.timeoutMs:void 0))}),s.post("/api/bots/result",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return r.json(o.result(t.botId))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},404)}}),s.post("/api/bots/stop",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return o.stop(t.botId,t.cascade!==!1),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/approvals",a,r=>r.json(o.listApprovals())),s.post("/api/bots/approve",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId||!t.requestId)return r.json({error:"botId and requestId are required"},400);const e=r.req.header("x-bots-token")===o.token?"parent-bot":"human";if(e==="parent-bot"&&!t.reason)return r.json({error:"a reason is required when a bot approves"},400);try{return r.json(o.respondApproval(t.botId,t.requestId,t.allow===!0,t.reason,e,t.always===!0))}catch(i){return r.json({error:i instanceof Error?i.message:String(i)},400)}}),s.get("/api/bots/approvals",n(),r=>r.json(o.listApprovals())),s.get("/api/bots/:id",n(),r=>{const t=o.getBot(r.req.param("id"));return t?r.json(t):r.json({error:"not found"},404)}),s.get("/api/bots/:id/events",n(),r=>{const t=Number(r.req.query("limit"))||400;return r.json(o.store.readEvents(r.req.param("id"),t))}),s.post("/api/bots/:id/input",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(typeof t.text!="string"||!t.text.trim())return r.json({error:"text is required"},400);try{return await o.input(r.req.param("id"),t.text,t.mode==="follow_up"?"follow_up":t.mode==="steer"?"steer":void 0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/:id/stop",n(),r=>{try{return o.stop(r.req.param("id"),!0),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),s.post("/api/bots/:id/resume",n(),r=>{try{return o.resume(r.req.param("id")),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),s.post("/api/bots/:id/approve",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(!t.requestId)return r.json({error:"requestId is required"},400);try{return r.json(o.respondApproval(r.req.param("id"),t.requestId,t.allow===!0,t.reason,"human",t.always===!0))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/:id/mode",n(),async r=>{const e=(await r.req.json().catch(()=>({}))).mode;if(e!=="supervised"&&e!=="parent-supervised"&&e!=="full-access")return r.json({error:"mode must be supervised, parent-supervised or full-access"},400);try{return o.setRuntimeMode(r.req.param("id"),e),r.json({ok:!0,mode:e})}catch(i){return r.json({error:i instanceof Error?i.message:String(i)},400)}}),s.post("/api/bots/:id/allowed-tools",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(!t.tool)return r.json({error:"tool is required"},400);try{return r.json({tools:o.allowTool(r.req.param("id"),t.tool)})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.delete("/api/bots/:id",n(),r=>{try{return o.deleteBot(r.req.param("id"),!0),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}})}export{f as registerBotRoutes};
|
package/dist/lib/pages/shell.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSessionModalHTML as
|
|
1
|
+
import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSessionModalHTML as x,newSessionModalScript as f,reducedMotion as g}from"../shared-layout.js";import{icon as a}from"../icons.js";function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function o(e="var(--panel-accent)"){return`box-shadow: 0 0 0 2px ${e}; outline: none;`}function w(e){const{theme:t,fsRoots:n,terminalCfg:i,scrollback:l,wsBase:p}=e,r=e.version?m(e.version):"",s=`
|
|
2
2
|
*, *::before, *::after { box-sizing: border-box; }
|
|
3
3
|
html, body {
|
|
4
4
|
background: var(--page-bg); color: var(--page-fg);
|
|
@@ -197,6 +197,25 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
|
|
|
197
197
|
.file-tree-create-bot { color: var(--panel-accent); font-size: var(--text-xs); gap: 6px; }
|
|
198
198
|
.file-tree-bot-plus { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 5px; font-size: 12px; line-height: 1; }
|
|
199
199
|
|
|
200
|
+
/* Bots merged into session groups */
|
|
201
|
+
.session-item.bot-item .bot-icon { width: 15px; height: 15px; flex-shrink: 0; fill: var(--panel-accent); opacity: 0.85; }
|
|
202
|
+
.session-item.bot-item { border-left: 2px solid color-mix(in srgb, var(--panel-accent) 45%, transparent); }
|
|
203
|
+
.session-item.bot-item .bot-status-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
|
|
204
|
+
.session-group-header .sg-add-bot {
|
|
205
|
+
margin-left: auto; width: 18px; height: 18px; line-height: 1;
|
|
206
|
+
border: 1px solid var(--panel-border); border-radius: 5px;
|
|
207
|
+
background: transparent; color: var(--panel-muted); font-size: 12px; cursor: pointer;
|
|
208
|
+
opacity: 0.5;
|
|
209
|
+
}
|
|
210
|
+
.session-group-header:hover .sg-add-bot { opacity: 1; color: var(--panel-accent); border-color: var(--panel-accent); }
|
|
211
|
+
@media (hover: none) { .session-group-header .sg-add-bot { opacity: 0.85; } }
|
|
212
|
+
.bv-actions .bv-mode-select {
|
|
213
|
+
background: var(--page-bg); color: var(--page-fg);
|
|
214
|
+
border: 1px solid var(--panel-border); border-radius: 7px;
|
|
215
|
+
font-size: 11px; padding: 4px 6px; max-width: 160px;
|
|
216
|
+
}
|
|
217
|
+
.bv-actions .btn[hidden] { display: none; }
|
|
218
|
+
|
|
200
219
|
/* \u2500\u2500 Git status indicators \u2500\u2500 */
|
|
201
220
|
.git-branch-badge {
|
|
202
221
|
display: flex; align-items: center; gap: 6px;
|
|
@@ -950,7 +969,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
|
|
|
950
969
|
})();
|
|
951
970
|
</script>
|
|
952
971
|
|
|
953
|
-
${
|
|
972
|
+
${x()}
|
|
954
973
|
|
|
955
974
|
<script>
|
|
956
975
|
window.__TMUX_WEB_SHELL__ = ${d};
|
|
@@ -962,7 +981,7 @@ window.__onSessionCreated = async function(name, agentId) {
|
|
|
962
981
|
await window.__refreshSidebar();
|
|
963
982
|
window.__openSession(name, agentId || undefined);
|
|
964
983
|
};
|
|
965
|
-
${
|
|
984
|
+
${f("__onSessionCreated")}
|
|
966
985
|
</script>
|
|
967
986
|
<script>
|
|
968
987
|
// Sync app-layout height to visual viewport so mobile keyboard doesn't overlap
|