@cotal-ai/web 0.165.4 → 0.166.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/dist/service-adapter.d.ts +1 -4
- package/dist/service-adapter.d.ts.map +1 -1
- package/dist/service-adapter.js +18 -14
- package/dist/service-adapter.js.map +1 -1
- package/dist/web/assets/AgentPage-DaXvMTTg.js +1 -0
- package/dist/web/assets/controller-BghUQrbm.js +110 -0
- package/dist/web/assets/index-CRfccAOF.js +14 -0
- package/dist/web/assets/index-DyfxWNjc.css +1 -0
- package/dist/web/index.html +3 -3
- package/dist/web.d.ts +12 -17
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +18 -10
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
- package/dist/web/assets/AgentPage-DND_rpGY.js +0 -1
- package/dist/web/assets/controller-21WQbPde.js +0 -110
- package/dist/web/assets/index-B5afScGX.css +0 -1
- package/dist/web/assets/index-CWg0jnkS.js +0 -14
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type LocalProcess, type ServicePreset } from "@cotal-ai/workspace";
|
|
3
|
-
export declare const webServicePreset: ServicePreset;
|
|
1
|
+
import { type LocalProcess } from "@cotal-ai/workspace";
|
|
4
2
|
export declare const webService: LocalProcess;
|
|
5
|
-
export declare const nativeWebServiceCommand: Command;
|
|
6
3
|
//# sourceMappingURL=service-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-adapter.d.ts","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-adapter.d.ts","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAqB7B,eAAO,MAAM,UAAU,EAAE,YA0BxB,CAAC"}
|
package/dist/service-adapter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rmSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute } from "node:path";
|
|
3
3
|
import { registry, writeSecretFileCreateOnly } from "@cotal-ai/core";
|
|
4
|
-
import { CommandFailure, WEB_CREDS_KIND, WEB_PIDFILE, WEB_SERVICE_ADAPTER, claimServicePid, colorEnabled, identityRecord, observeServiceStartup, oneLine, publishServiceStartup, readLocalRecordSource, readPinnedStaticCredential, resolveNativeServiceTarget, serviceOperationId, serviceStartupPath, serviceWebSessionPath, validateServiceStartupPath, } from "@cotal-ai/workspace";
|
|
4
|
+
import { CommandFailure, WEB_CREDS_KIND, WEB_PIDFILE, WEB_SERVICE_ADAPTER, claimServicePid, colorEnabled, identityRecord, observeServiceStartup, oneLine, publishServiceStartup, readLocalRecordSource, readPinnedStaticCredential, readDashboardPostingCredential, resolveNativeServiceTarget, serviceOperationId, serviceStartupPath, serviceWebSessionPath, validateServiceStartupPath, } from "@cotal-ai/workspace";
|
|
5
5
|
import { normalizeWebHost, web, WEB_HOST, WEB_PORT } from "./web.js";
|
|
6
6
|
function exposure(host, port) {
|
|
7
7
|
if (host !== undefined && typeof host !== "string" || port !== undefined && (typeof port !== "number" || !Number.isSafeInteger(port) || port < 1 || port > 65535))
|
|
@@ -19,9 +19,9 @@ function target(root, space, server) {
|
|
|
19
19
|
throw new CommandFailure("refused", "UNSUPPORTED", "this dashboard service requires a registered static-auth target and an explicit protected credential file; no user login, operator identity or open connection was substituted");
|
|
20
20
|
return selected;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const webServicePreset = {
|
|
23
23
|
kind: "service-preset", name: "web", adapter: "web-service", timeoutMs: 40000,
|
|
24
|
-
summary: "the
|
|
24
|
+
summary: "the web dashboard, read-only unless separately authorized to post",
|
|
25
25
|
defaults: { root: { space: "root" }, creds: { space: "material", kind: WEB_CREDS_KIND }, "read-only": { value: true } },
|
|
26
26
|
};
|
|
27
27
|
export const webService = {
|
|
@@ -30,11 +30,12 @@ export const webService = {
|
|
|
30
30
|
service: {
|
|
31
31
|
abiVersion: 1, requiresCli: true, readiness: "process",
|
|
32
32
|
capabilities: { multiInstance: false, foreground: true, logs: true },
|
|
33
|
-
paths: { root: "directory", creds: "private-file" },
|
|
33
|
+
paths: { root: "directory", creds: "private-file", "posting-creds": "private-file" },
|
|
34
34
|
optionsSchema: { type: "object", additionalProperties: false, required: ["root", "creds", "read-only"], properties: {
|
|
35
35
|
root: { type: "string", minLength: 1, maxLength: 4096, description: "existing registered static-auth root; no signer is minted or handed to HTTP handlers" },
|
|
36
36
|
creds: { type: "string", minLength: 1, maxLength: 4096, description: `protected credential file for the dashboard (default: this space's ${WEB_CREDS_KIND}); no cached operator or seat identity fallback` },
|
|
37
|
-
"read-only": { type: "boolean",
|
|
37
|
+
"read-only": { type: "boolean", description: "read-only by default; disabling requires a separate posting credential" },
|
|
38
|
+
"posting-creds": { type: "string", minLength: 1, maxLength: 4096, description: "separate protected posting credential; requires --no-read-only and uses only this file's grants" },
|
|
38
39
|
host: { type: "string", minLength: 1, maxLength: 253, description: `HTTP bind/browser host (default ${WEB_HOST}); remote exposure is explicit` },
|
|
39
40
|
port: { type: "integer", minimum: 1, maximum: 65535, description: `HTTP port (default ${WEB_PORT}); no implicit port substitution` },
|
|
40
41
|
server: { type: "string", minLength: 1, maxLength: 4096, description: "optional repeat of the registered broker; its TLS requirement is retained" },
|
|
@@ -44,18 +45,18 @@ export const webService = {
|
|
|
44
45
|
if (!context.cliInvocation?.length)
|
|
45
46
|
throw new CommandFailure("refused", "UNSUPPORTED", "the dashboard service needs the verified cotal entry; no PATH executable was substituted");
|
|
46
47
|
const root = String(context.options.root), creds = String(context.options.creds);
|
|
47
|
-
if (context.options["read-only"] !==
|
|
48
|
-
throw new CommandFailure("refused", "CONFLICT", "the dashboard requires
|
|
48
|
+
if (typeof context.options["read-only"] !== "boolean" || (context.options["read-only"] === false) !== (typeof context.options["posting-creds"] === "string") || context.credentialRef && context.credentialRef.path !== creds)
|
|
49
|
+
throw new CommandFailure("refused", "CONFLICT", "the dashboard requires --read-only, or --no-read-only with a separate --posting-creds file, and one unambiguous observer credential reference");
|
|
49
50
|
const selected = target(root, context.space, context.options.server), bind = exposure(context.options.host, context.options.port);
|
|
50
51
|
const [executable, ...self] = context.cliInvocation;
|
|
51
|
-
return { executable: executable, cwd: selected.root, args: [...self, ...(colorEnabled() ? [] : ["--no-color"]), "__service-web", "--root", selected.root, "--space", selected.space, "--server", selected.server, "--creds", creds, "--read-only", "--host", bind.host, "--port", String(bind.port), "--service-instance", context.instanceId, "--launch-request", context.launchRequestId, "--ready-file", serviceStartupPath(context)] };
|
|
52
|
+
return { executable: executable, cwd: selected.root, args: [...self, ...(colorEnabled() ? [] : ["--no-color"]), "__service-web", "--root", selected.root, "--space", selected.space, "--server", selected.server, "--creds", creds, ...(context.options["read-only"] ? ["--read-only"] : ["--posting-creds", String(context.options["posting-creds"])]), "--host", bind.host, "--port", String(bind.port), "--service-instance", context.instanceId, "--launch-request", context.launchRequestId, "--ready-file", serviceStartupPath(context)] };
|
|
52
53
|
},
|
|
53
54
|
async checkServiceReadiness(context) { return observeServiceStartup(context, "web-listening"); },
|
|
54
55
|
};
|
|
55
56
|
function validateChild(args) {
|
|
56
|
-
if (args.positionals.length || ["root", "space", "server", "creds", "host", "port", "service-instance", "launch-request", "ready-file"].some((name) => typeof args.values[name] !== "string" || !args.values[name]) || args.values["read-only"]
|
|
57
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "the dashboard child requires a complete
|
|
58
|
-
for (const name of ["root", "creds", "ready-file"])
|
|
57
|
+
if (args.positionals.length || ["root", "space", "server", "creds", "host", "port", "service-instance", "launch-request", "ready-file"].some((name) => typeof args.values[name] !== "string" || !args.values[name]) || (args.values["read-only"] === true) === (typeof args.values["posting-creds"] === "string"))
|
|
58
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "the dashboard child requires a complete controller launch with either read-only intent or a separate posting credential");
|
|
59
|
+
for (const name of ["root", "creds", "ready-file", ...(args.values["posting-creds"] ? ["posting-creds"] : [])])
|
|
59
60
|
if (!isAbsolute(String(args.values[name])) || /[\u0000-\u001f\u007f]/u.test(String(args.values[name])))
|
|
60
61
|
throw new CommandFailure("refused", "USAGE_INVALID", "native dashboard references must be absolute protected paths without terminal controls");
|
|
61
62
|
if (!/^[0-9]+$/.test(String(args.values.port)))
|
|
@@ -64,12 +65,13 @@ function validateChild(args) {
|
|
|
64
65
|
serviceOperationId(args.values["service-instance"]);
|
|
65
66
|
serviceOperationId(args.values["launch-request"]);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
const nativeWebServiceCommand = {
|
|
68
69
|
kind: "command", name: "__service-web", hidden: true, prepareMeshTarget: false,
|
|
69
|
-
summary: "native
|
|
70
|
+
summary: "native dashboard child with private session and startup records",
|
|
70
71
|
flags: [
|
|
71
72
|
...["root", "space", "server", "creds", "host", "port", "service-instance", "launch-request", "ready-file"].map((name) => ({ name, type: "string" })),
|
|
72
73
|
{ name: "read-only", type: "boolean" },
|
|
74
|
+
{ name: "posting-creds", type: "string" },
|
|
73
75
|
], validate: validateChild,
|
|
74
76
|
async run(args) {
|
|
75
77
|
validateChild(args);
|
|
@@ -78,16 +80,18 @@ export const nativeWebServiceCommand = {
|
|
|
78
80
|
const instanceId = serviceOperationId(args.values["service-instance"]), launchRequestId = serviceOperationId(args.values["launch-request"]);
|
|
79
81
|
validateServiceStartupPath(readyPath, instanceId, launchRequestId);
|
|
80
82
|
const { creds } = await readPinnedStaticCredential(selected, credsPath);
|
|
83
|
+
const posting = args.values["posting-creds"] ? await readDashboardPostingCredential(selected, String(args.values["posting-creds"]), credsPath) : undefined;
|
|
81
84
|
const releasePid = claimServicePid({ root: selected.root, space: selected.space }, WEB_PIDFILE);
|
|
82
85
|
const sessionPath = serviceWebSessionPath({ space: selected.space, instanceId, launchRequestId, stateDirectory: dirname(readyPath) });
|
|
83
86
|
let sessionBytes;
|
|
84
87
|
try {
|
|
85
88
|
await web({ positionals: [], raw: [], values: { space: selected.space, server: selected.server, host: args.values.host, port: args.values.port, "no-open": true } }, {
|
|
89
|
+
posting,
|
|
86
90
|
connection: { root: selected.root, space: selected.space, server: selected.server, tls: selected.tlsRequired, mode: selected.mode, creds },
|
|
87
91
|
onSession(session) {
|
|
88
92
|
sessionBytes = JSON.stringify({ schemaVersion: 1, space: selected.space, instanceId, launchRequestId, process: identityRecord(process.pid), ...session }) + "\n";
|
|
89
93
|
writeSecretFileCreateOnly(sessionPath, sessionBytes);
|
|
90
|
-
process.stdout.write(
|
|
94
|
+
process.stdout.write(`${posting ? "Posting-enabled" : "Read-only"} dashboard. Private browser bootstrap file: ${oneLine(sessionPath)}\n`);
|
|
91
95
|
},
|
|
92
96
|
onReady() { publishServiceStartup(readyPath, { phase: "web-listening", space: selected.space, instanceId, launchRequestId }); },
|
|
93
97
|
onClosed() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-adapter.js","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAiC,MAAM,gBAAgB,CAAC;AACpG,OAAO,EACL,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EACtI,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,0BAA0B,EACjF,0BAA0B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"service-adapter.js","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA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AY;4BAAE,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,mBAAmB,EAAE,4FAA4F,CAAC,CAAC;wBACjN,IAAI,OAAO;4BAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBACnC,CAAC;oBACD,UAAU,EAAE,CAAC;gBACf,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YAAC,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,mBAAmB,EAAE,0JAA0J,CAAC,CAAC;QAAC,CAAC;IACnO,CAAC;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,EAAE,UAAU,EAAE,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,Ar as n,B as r,C as i,Cr as a,Fr as o,G as s,Gt as c,Ht as l,I as u,J as d,K as f,L as p,M as ee,Nr as m,Qt as h,S as g,T as _,U as te,Vt as v,W as y,Wt as b,Xt as ne,Y as x,Yn as re,_ as S,a as C,at as w,b as T,bt as E,c as ie,cn as D,d as O,dn as k,dt as ae,en as oe,er as A,ft as se,g as ce,h as le,hr as j,i as ue,it as de,l as M,ln as N,lr as fe,lt as pe,m as me,mt as he,nn as ge,nt as _e,o as ve,pt as P,q as F,r as ye,rn as I,rr as be,s as xe,sn as L,st as Se,u as Ce,ur as we,v as R,vr as Te,w as Ee,x as z,xr as De,xt as B,y as V,yr as Oe}from"./controller-BghUQrbm.js";var ke=[[`path`,{d:`M15 6C15 6 9.00001 10.4189 9 12C8.99999 13.5812 15 18 15 18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],H=[[`path`,{d:`M7.5 7.5L8.72654 8.55719C9.24218 9.00163 9.5 9.22386 9.5 9.5C9.5 9.77614 9.24218 9.99836 8.72654 10.4428L7.5 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.5 12.5H15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 21C15.7497 21 17.6246 21 18.9389 20.0451C19.3634 19.7367 19.7367 19.3634 20.0451 18.9389C21 17.6246 21 15.7497 21 12C21 8.25027 21 6.3754 20.0451 5.06107C19.7367 4.6366 19.3634 4.26331 18.9389 3.95491C17.6246 3 15.7497 3 12 3C8.25027 3 6.3754 3 5.06107 3.95491C4.6366 4.26331 4.26331 4.6366 3.95491 5.06107C3 6.3754 3 8.25027 3 12C3 15.7497 3 17.6246 3.95491 18.9389C4.26331 19.3634 4.6366 19.7367 5.06107 20.0451C6.3754 21 8.25027 21 12 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],U=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M9.38886 15.1629C9.89331 15.5 10.5955 15.5 12 15.5C13.4045 15.5 14.1067 15.5 14.6111 15.1629C14.8295 15.017 15.017 14.8295 15.1629 14.6111C15.5 14.1067 15.5 13.4045 15.5 12C15.5 10.5955 15.5 9.89331 15.1629 9.38886C15.017 9.17048 14.8295 8.98298 14.6111 8.83706C14.1067 8.5 13.4045 8.5 12 8.5C10.5955 8.5 9.89331 8.5 9.38886 8.83706C9.17048 8.98298 8.98298 9.17048 8.83706 9.38886C8.5 9.89331 8.5 10.5955 8.5 12C8.5 13.4045 8.5 14.1067 8.83706 14.6111C8.98298 14.8295 9.17048 15.017 9.38886 15.1629Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],W=e(o(),1),G=re();function K({icon:e,title:t,children:n,action:r}){return(0,G.jsxs)(te,{children:[(0,G.jsxs)(f,{children:[(0,G.jsx)(F,{variant:`icon`,children:(0,G.jsx)(B,{icon:e})}),(0,G.jsx)(d,{children:t}),n&&(0,G.jsx)(s,{children:n})]}),r&&(0,G.jsx)(y,{children:r})]})}var q=e=>Number.isFinite(e.ts)?e.ts:-1/0;function Ae(e){let t=new Map;for(let{msg:n}of e){let e=typeof n.channel==`string`?n.channel:void 0,r=e===void 0&&typeof n.to==`string`?n.to:void 0;if(e===void 0&&r===void 0)continue;let i=e===void 0?`dm:${r}`:`channel:${e}`,a=t.get(i);a||t.set(i,a={key:i,...e===void 0?{to:r}:{channel:e},rows:[]}),a.rows.push(n)}let n=[...t.values()];for(let e of n)e.rows.sort((e,t)=>q(t)-q(e));return n.sort((e,t)=>q(t.rows[0])-q(e.rows[0]))}function J({msg:e,row:t,place:n,href:r,label:i}){let o=u();return(0,G.jsxs)(`div`,{className:`ui-msg ox-msg`,"data-post":e.id,children:[(0,G.jsx)(`div`,{className:`ui-gut`,children:(0,G.jsx)(p,{vendor:t.harness,status:t.status,size:34,dot:!1,badge:o(t.id)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`ui-mh`,children:[(0,G.jsx)(`b`,{children:t.name}),(0,G.jsx)(E,{variant:`secondary`,children:n}),(0,G.jsx)(C,{ts:e.ts}),(0,G.jsx)(`span`,{className:`ui-sp`}),(0,G.jsxs)(`a`,{className:`ox-act`,href:r,children:[i,(0,G.jsx)(B,{icon:D,size:16})]})]}),(0,G.jsx)(ve,{className:`ui-tx`,src:a(e.parts)})]})]})}function je({groups:e,row:t,nameOf:n}){return(0,G.jsxs)(`div`,{className:`ox-msgs`,children:[e.length===0&&(0,G.jsx)(K,{icon:L,title:`No messages from ${t.name} on this page yet`}),e.map(e=>{let r=e.rows.length;if(e.channel!==void 0){let n=e.channel,a=j({view:`channel`,channel:n});return(0,G.jsxs)(`section`,{className:`ox-msg-group`,children:[(0,G.jsxs)(z,{className:`ox-marker`,children:[(0,G.jsx)(i,{children:(0,G.jsx)(B,{icon:I,size:16})}),(0,G.jsxs)(g,{children:[(0,G.jsx)(`b`,{children:`#${n}`}),` · ${r===1?`1 post`:`${r} posts`}`]})]}),e.rows.map(e=>(0,G.jsx)(J,{msg:e,row:t,place:`in #${n}`,href:a,label:`Open in #${n}`},e.id))]},e.key)}let a=e.to??``,o=n(a),s=j({view:`dm`,peer:t.id,with:a});return(0,G.jsxs)(`section`,{className:`ox-msg-group`,children:[(0,G.jsxs)(z,{className:`ox-marker`,children:[(0,G.jsx)(i,{children:(0,G.jsx)(B,{icon:L,size:16})}),(0,G.jsxs)(g,{children:[(0,G.jsx)(`b`,{children:`Direct messages`}),` · ${r} with ${o}`]})]}),e.rows.map(e=>(0,G.jsx)(J,{msg:e,row:t,place:`to ${o}`,href:s,label:`Open conversation`},e.id))]},e.key)}),(0,G.jsx)(`p`,{className:`ox-msgs-more`,children:`Older messages are in each channel's history.`})]})}var Y=1e3,X={on:`Published. Tool inputs and results appear when payload access is permitted.`,off:`Not published`};function Me({store:e,id:t,clock:n=Date.now}){let i=A(e,e=>e.roster),a=A(e,e=>e.channels),o=A(e,e=>e.membership),s=A(e,e=>e.activity),[,c]=(0,W.useReducer)(e=>e+1,0);(0,W.useEffect)(()=>{let e=setInterval(c,Y);return()=>clearInterval(e)},[]);let l=u(),d=i.find(e=>e.card.id===t),f=(0,W.useMemo)(()=>d?x(t,o,a.map(e=>e.channel),s,d.channelModes):{channels:[],wide:!1},[d,t,o,a,s]);if(!d)return(0,G.jsx)(`p`,{className:`ui-nr`,children:`Not on the roster`});let h=be([d],{includeOffline:!0})[0],g=typeof h.statusSince==`number`&&Number.isFinite(h.statusSince)?`Reported ${De(new Date(h.statusSince))}`:void 0,_=(d.card.skills??[]).map(e=>e.name).filter(e=>typeof e==`string`&&e!==``);return(0,G.jsxs)(`div`,{className:`ox-profile`,children:[(0,G.jsx)(`div`,{className:`ui-big`,children:(0,G.jsx)(p,{vendor:h.harness,status:h.status,size:88,dot:!1,badge:l(h.id)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`ui-sline`,children:[(0,G.jsx)(r,{row:h}),(0,G.jsx)(`span`,{style:{color:`var(--ink)`},children:h.activity||`No current activity`}),g&&(0,G.jsx)(`small`,{children:g}),V(h,n())&&(0,G.jsx)(`small`,{className:`ui-facts`,children:V(h,n())})]}),(0,G.jsxs)(`div`,{className:`ui-actions`,children:[(0,G.jsx)(w,{icon:H,command:`cotal attach --name ${m(h.name)}`}),(0,G.jsx)(w,{icon:U,command:`cotal stop --name ${m(h.name)}`})]}),(0,G.jsxs)(`dl`,{className:`ui-kv`,children:[h.harness&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Harness`}),(0,G.jsx)(`dd`,{children:ee(h.harness)})]}),(0,G.jsx)(`dt`,{children:`Model`}),h.model?(0,G.jsx)(`dd`,{className:`ui-mono`,style:{fontSize:12.5},children:h.model}):(0,G.jsx)(`dd`,{className:`ui-nr`,children:`not reported`}),h.host&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Host`}),(0,G.jsx)(`dd`,{children:h.host})]}),(h.attention===`dnd`||h.attention===`focus`)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:`Attention`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(S,{attention:h.attention})})]}),(0,G.jsx)(`dt`,{children:`Heartbeat`}),Number.isFinite(h.ts)?(0,G.jsxs)(`dd`,{className:`ui-num`,children:[T(n()-h.ts),` ago`]}):(0,G.jsx)(`dd`,{className:`ui-nr`,children:`not reported`}),(0,G.jsx)(`dt`,{children:`Work events`}),h.events?(0,G.jsx)(`dd`,{children:X[h.events]}):(0,G.jsx)(`dd`,{className:`ui-nr`,children:`not reported`})]}),(f.wide||f.channels.length>0)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h5`,{children:`Channels`}),f.wide&&(0,G.jsxs)(`div`,{className:`ui-chrow`,children:[(0,G.jsx)(`span`,{children:`Reads every channel`}),(0,G.jsx)(`span`,{})]}),f.channels.map(e=>(0,G.jsxs)(`div`,{className:`ui-chrow`,children:[(0,G.jsx)(`span`,{children:`#${e.channel}`}),(0,G.jsx)(`span`,{children:e.mode??``})]},e.channel))]}),_.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h5`,{style:{marginTop:10},children:`Skills`}),(0,G.jsx)(`div`,{className:`ui-tags`,children:_.map(e=>(0,G.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}var Ne=24,Pe=[];function Fe(e){return e.items.flatMap(e=>e.kind===`turn`?[e,...e.steps]:[e]).flatMap(e=>[{key:e.key,live:e.live,...e.kind===`post`?{post:e.msg.id}:{}},...e.kind===`tools`?e.calls.slice(1).map(e=>({key:e.key,live:e.live})):[]])}function Ie(){let e=e=>(0,G.jsx)(c,{className:`h-2.5`,style:{width:e}});return(0,G.jsx)(`div`,{className:`ox-col`,"aria-busy":`true`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-hidden":`true`,children:[e(`36%`),e(`88%`),e(`64%`),e(`42%`),e(`30%`),e(`76%`)]})})}function Le({steps:e,away:t}){let{end:n}=he(),{scrollToEnd:r}=P(),[i,a]=(0,W.useState)(null),o=n||t;o&&i===null&&a(new Set(e.map(e=>e.key))),!o&&i!==null&&a(null);let s=i?e.filter(e=>e.live&&!i.has(e.key)).length:0;return s===0?null:(0,G.jsxs)(k,{type:`button`,variant:`outline`,size:`sm`,className:`ox-newsteps`,"data-active":`true`,onClick:()=>r({behavior:R()?`auto`:`smooth`}),children:[(0,G.jsx)(B,{icon:N,"data-icon":`inline-start`}),s===1?`1 new step`:`${s} new steps`]})}function Z({store:e,controller:i,id:a,tab:o,at:s,back:c,phone:d=!1,panelOpen:f=!1,onTogglePanel:m}){ce(i,a);let te=(0,W.useContext)(ye),y=A(e,e=>e.roster),x=A(e,e=>e.operatorId),re=A(e,e=>e.post),S=A(e,e=>e.sessions[a]),C=(0,W.useMemo)(()=>we(y),[y]),T=y.find(e=>e.card.id===a),E=(0,W.useMemo)(()=>T?be([T],{includeOffline:!0})[0]:void 0,[T]),D=E?.name??fe(a,C,x),N=E??{id:a,name:D,status:`offline`,ts:NaN},he=(0,W.useMemo)(()=>me(T),[T]),ve=u(),P=S?.frames??Pe,F=le(e,a),I=(0,W.useMemo)(()=>Oe(P,F),[P,F]),L=(0,W.useMemo)(()=>Fe(I),[I]),R=(0,W.useMemo)(()=>Ae(F),[F]),De=R.reduce((e,t)=>e+t.rows.length,0),V=(0,W.useMemo)(()=>e=>fe(e,C,x),[C,x]),H=(0,W.useMemo)(()=>({kind:`dm`,to:a}),[a]),U=[E?.role,E?.harness&&ee(E.harness)].filter(Boolean).join(` · `),q=E?.events,J=S?.load??`loading`,[Y,X]=(0,W.useState)(!0);o!==`work`&&!Y&&X(!0);let Z=(0,W.useRef)(null),Re=()=>Z.current,ze=()=>{let e=Re();!Y&&e&&e.scrollHeight-e.scrollTop-e.clientHeight<=Ne&&X(!0)},Be=(0,W.useRef)(void 0),Ve=s!==void 0&&L.some(e=>e.post===s);(0,W.useLayoutEffect)(()=>{if(!Ve||s===void 0||Be.current===s||J===`loading`)return;let e=Re();if(!e)return;let t=Array.from(e.querySelectorAll(`[data-post]`)).find(e=>e.getAttribute(`data-post`)===s);t&&(Be.current=s,X(!1),t.scrollIntoView?.({block:`center`}))});let He=Te(P)>=2e3||(S?.limit??0)>=2e3,Ue=S?.more===!0&&q!==`off`,We=f?`Close panel`:`Open panel`,Q=`Back to ${c.label}`,Ge=j(n(a,x)),Ke=()=>de(H),$=(0,G.jsx)(ue,{payloadRead:S?.payloadRead,work:I,row:N,condition:he,highlight:s,nameOf:V}),qe;return qe=J===`loading`&&L.length===0?(0,G.jsx)(Ie,{}):J===`refused`?(0,G.jsxs)(`div`,{className:`ox-col`,children:[(0,G.jsxs)(K,{icon:h,title:`This dashboard can't read ${D}'s work`,action:S?.grant&&(0,G.jsx)(w,{command:S.grant}),children:[(0,G.jsx)(`p`,{children:`The broker refused it: ${S?.reason??``}.`}),S?.grant&&(0,G.jsx)(`p`,{children:`The mesh owner can grant a read on that channel:`})]}),L.length>0&&$]}):J===`failed`&&L.length===0?(0,G.jsx)(`div`,{className:`ox-col`,children:(0,G.jsx)(K,{icon:ge,title:`${D}'s work didn't load`,action:(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void i?.reloadSession(a),children:`Try again`}),children:(0,G.jsx)(`p`,{children:S?.reason??``})})}):q===`off`&&J!==`failed`?(0,G.jsxs)(`div`,{className:`ox-col`,children:[(0,G.jsxs)(xe,{children:[`${D} publishes no work events, so Work shows only what ${D} posted. Agents started with `,(0,G.jsx)(`code`,{children:`cotal spawn`}),` publish them unless started with `,(0,G.jsx)(`code`,{children:`--no-events`}),`.`]}),$]}):L.length===0&&q===`on`?(0,G.jsx)(`div`,{className:`ox-col`,children:(0,G.jsx)(K,{icon:ne,title:`${D} hasn't started a turn yet`,children:(0,G.jsx)(`p`,{children:`Its first turn shows here as soon as it starts.`})})}):L.length===0?(0,G.jsx)(`div`,{className:`ox-col`,children:(0,G.jsx)(K,{icon:ge,title:`Nothing has arrived from ${D} yet`,children:(0,G.jsxs)(`p`,{children:[`Agents started with `,(0,G.jsx)(`code`,{children:`cotal spawn`}),` publish one unless started with `,(0,G.jsx)(`code`,{children:`--no-events`}),`. An agent you started yourself may not publish one at all.`]})})}):(0,G.jsxs)(`div`,{className:`ox-col`,children:[J===`failed`&&(0,G.jsx)(xe,{action:(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void i?.reloadSession(a),children:`Try again`}),children:`${D}'s work didn't load. ${S?.reason??``}`}),Ue&&!He&&(0,G.jsx)(z,{variant:`separator`,className:`mb-3`,children:(0,G.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:J===`loading`,onClick:()=>void i?.loadEarlier(a),children:`Load earlier`})}),Ue&&He&&(0,G.jsx)(z,{className:`mb-3`,children:(0,G.jsx)(g,{children:`Showing the newest 2,000 events`})}),J===`loading`&&(0,G.jsx)(z,{className:`mb-3`,role:`status`,children:(0,G.jsx)(g,{children:`Loading`})}),$]}),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`header`,{className:`ox-head`,children:[(0,G.jsx)(Ee,{}),d?(0,G.jsxs)(v,{children:[(0,G.jsx)(b,{asChild:!0,children:(0,G.jsx)(k,{asChild:!0,variant:`ghost`,size:`icon`,children:(0,G.jsx)(`a`,{href:j(c.route),"aria-label":Q,children:(0,G.jsx)(B,{icon:ke})})})}),(0,G.jsx)(l,{children:Q})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v,{children:[(0,G.jsx)(b,{asChild:!0,children:(0,G.jsxs)(`a`,{className:`ui-crumb`,href:j(c.route),"aria-label":Q,children:[(0,G.jsx)(B,{icon:ke,size:16,className:`ui-ic`}),c.label]})}),(0,G.jsx)(l,{children:Q})]}),(0,G.jsx)(`span`,{className:`ox-sep`})]}),(0,G.jsx)(p,{vendor:E?.harness,status:N.status,size:30,badge:E?ve(a):void 0}),(0,G.jsx)(`h1`,{children:D}),!d&&U&&(0,G.jsx)(`span`,{className:`ui-topic`,children:U}),E&&(0,G.jsx)(r,{row:E}),(0,G.jsx)(`span`,{className:`ui-sp`}),d?(0,G.jsxs)(v,{children:[(0,G.jsx)(b,{asChild:!0,children:(0,G.jsx)(k,{asChild:!0,variant:`ghost`,size:`icon`,children:(0,G.jsx)(`a`,{href:Ge,"aria-label":`Message ${D}`,onClick:Ke,children:(0,G.jsx)(B,{icon:oe})})})}),(0,G.jsx)(l,{children:`Message ${D}`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(k,{asChild:!0,variant:`outline`,size:`sm`,children:(0,G.jsxs)(`a`,{href:Ge,onClick:Ke,children:[(0,G.jsx)(B,{icon:oe,"data-icon":`inline-start`}),`Message`]})}),m&&(0,G.jsxs)(v,{children:[(0,G.jsx)(b,{asChild:!0,children:(0,G.jsx)(_,{"aria-label":We,pressed:f,onPressedChange:m,children:(0,G.jsx)(B,{icon:t})})}),(0,G.jsx)(l,{children:We})]})]})]}),(0,G.jsxs)(ie,{value:o,activationMode:`manual`,onValueChange:e=>(e===`work`||e===`messages`||e===`profile`)&&te({view:`agent`,id:a,tab:e}),className:`ox-tabs`,children:[(0,G.jsx)(`div`,{className:`ox-tablist`,children:(0,G.jsxs)(Ce,{"aria-label":D,children:[(0,G.jsx)(O,{value:`work`,children:`Work`}),(0,G.jsxs)(O,{value:`messages`,children:[`Messages `,(0,G.jsx)(`span`,{className:`ox-n`,children:De})]}),(0,G.jsx)(O,{value:`profile`,children:`Profile`})]})}),(0,G.jsx)(M,{value:`work`,className:`ox-tabc`,children:(0,G.jsx)(ae,{autoScroll:Y,children:(0,G.jsxs)(Se,{className:`ox-scroller`,children:[(0,G.jsx)(se,{ref:Z,"aria-label":`Work`,onScroll:ze,children:(0,G.jsx)(pe,{className:`ox-scrollc`,children:qe})}),(0,G.jsx)(Le,{steps:L,away:!Y})]})})}),(0,G.jsx)(M,{value:`messages`,className:`ox-tabc`,children:(0,G.jsx)(`div`,{className:`ui-scroll`,children:(0,G.jsx)(`div`,{className:`ox-col`,children:(0,G.jsx)(je,{groups:R,row:N,nameOf:V})})})}),(0,G.jsx)(M,{value:`profile`,className:`ox-tabc`,children:(0,G.jsx)(`div`,{className:`ui-scroll`,children:(0,G.jsx)(`div`,{className:`ox-col`,children:(0,G.jsx)(Me,{store:e,id:a})})})})]}),re&&(0,G.jsx)(`div`,{className:`ui-dock`,children:(0,G.jsx)(`div`,{className:`ui-dock-in`,children:(0,G.jsx)(_e,{store:e,target:H,where:D,to:`to ${D} · direct message`})})})]})}export{Z as AgentPage};
|