botmancers 0.10.0 → 0.10.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 +14 -0
- package/README.md +5 -5
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/required-server-files.json +2 -2
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/agents/[id]/activity/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/conversations/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/conversations/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/sessions/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/sessions/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/agents/[id]/slack/page.js.nft.json +1 -1
- package/app/.next/server/app/agents/[id]/slack/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/bots/[id]/activity/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/overview/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
- package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
- package/app/.next/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
- package/app/.next/server/app/api/runtime-capacity/route.js.nft.json +1 -1
- package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
- package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
- package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
- package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
- package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/exchanges.html +1 -1
- package/app/.next/server/app/exchanges.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings/page.js.nft.json +1 -1
- package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/settings.html +1 -1
- package/app/.next/server/app/settings.rsc +3 -3
- package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/threads/[id]/route.js.nft.json +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0aincj4._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0anfwiu._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0fku-bw._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__1280ke1._.js +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__13wghn3._.js +4 -4
- package/app/.next/server/chunks/[root-of-the-server]__1jxwu9_._.js +2 -2
- package/app/.next/server/chunks/_0061c2q._.js +1 -1
- package/app/.next/server/chunks/_1-5mthb._.js +1 -1
- package/app/.next/server/chunks/_1a0er16._.js +3 -3
- package/app/.next/server/chunks/_1uxmsh3._.js +3 -3
- package/app/.next/server/chunks/lib_service-api_ts_18eok4w._.js +3 -3
- package/app/.next/server/chunks/ssr/_00qrupp._.js +3 -0
- package/app/.next/server/chunks/ssr/_01ngpwj._.js +1 -1
- package/app/.next/server/chunks/ssr/_0d7gv3q._.js +3 -0
- package/app/.next/server/chunks/ssr/_0iywd5g._.js +1 -1
- package/app/.next/server/chunks/ssr/_0mxifu3._.js +1 -1
- package/app/.next/server/chunks/ssr/_0u7urta._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_0sr4fdg._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_activity_AgentActivityPage_tsx_042-590._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_config_page_tsx_1f_gu1l._.js +1 -1
- package/app/.next/server/chunks/ssr/app_agents_[id]_sessions_page_tsx_0tfup-2._.js +3 -3
- package/app/.next/server/chunks/ssr/app_agents_[id]_slack_AgentSlackPage_tsx_20njhs1._.js +1 -1
- package/app/.next/server/chunks/ssr/app_page_tsx_0pxmutw._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_0pfn9gs._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_agent-registration-ui_ts_1z582mm._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_exchange-view_ts_1a4q9ju._.js +1 -1
- package/app/.next/server/chunks/ssr/lib_share-view_ts_08psw5o._.js +1 -1
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/{2dtkykrnob8wk.js → 00pca1oa16xc5.js} +1 -1
- package/app/.next/static/chunks/{3x56k5qa012au.js → 0apccyvpyjlo7.js} +1 -1
- package/app/.next/static/chunks/{04nfr73lkk7pz.js → 0l9r-x310007w.js} +1 -1
- package/app/.next/static/chunks/{0eqgs3167zj2j.js → 0xo3nwo_nscvf.js} +1 -1
- package/app/.next/static/chunks/{326jto9l-m8vj.js → 0z_bq7h1mwcf3.js} +4 -4
- package/app/.next/static/chunks/18btj4qlun8o7.js +1 -0
- package/app/.next/static/chunks/{2cc4uzbhs_v23.js → 1k8e6j67zksws.js} +1 -1
- package/app/.next/static/chunks/{0h567k13e53r-.js → 1y9hc8qm0hqds.js} +1 -1
- package/app/.next/static/chunks/{2ebpfmg4vni8e.js → 2wbcr5n_vcynr.js} +1 -1
- package/app/.next/static/chunks/3_lwv2zgy_-bw.css +3 -0
- package/app/.next/static/chunks/3a_ffnuma49te.js +1 -0
- package/app/.next/static/chunks/{3whw2-l4a2sli.js → 3fm68xa8a4-es.js} +1 -1
- package/app/.next/static/chunks/{0cjh4u-f7mlwd.js → 3gw1ytgjq4pxu.js} +1 -1
- package/app/.next/static/chunks/3wlqn3gd_jv_r.js +1 -0
- package/app/.next/static/chunks/3xjoca0z2onuc.js +1 -0
- package/app/BUILD_INFO.json +2 -2
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/package.json +1 -1
- package/schemas/botmancers.mcp.v2.tools.json +46 -46
- package/app/.next/server/chunks/ssr/_0g3y1u9._.js +0 -3
- package/app/.next/server/chunks/ssr/app_agents_[id]_conversations_page_tsx_15zl_c8._.js +0 -3
- package/app/.next/static/chunks/10i-rrea371m2.js +0 -1
- package/app/.next/static/chunks/17qi6hcgg0nlz.css +0 -3
- package/app/.next/static/chunks/1ypwptc0fsn4w.js +0 -1
- package/app/.next/static/chunks/2myfan3i8z-jy.js +0 -1
- package/app/.next/static/chunks/34v8aumua0x5n.js +0 -1
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → eBmHBBldHWytVvYPu0zHc}/_buildManifest.js +0 -0
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → eBmHBBldHWytVvYPu0zHc}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{92gsyY5d-nMkxJ7iQxKkY → eBmHBBldHWytVvYPu0zHc}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this Agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)},88204,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(15722),f=a.i(22151),g=a.i(78627),h=a.i(10932);let i=[{id:"cursor",label:"Cursor"},{id:"codex",label:"Codex"},{id:"claude",label:"Claude Code"}];function j(a){return`botmancers setup --client ${a}`}function k(){let[a,d]=(0,c.useState)("cursor"),[e,f]=(0,c.useState)(null),h=j(a);async function k(a){d(a);try{await navigator.clipboard.writeText(j(a)),f(a),window.setTimeout(()=>f(b=>b===a?null:b),1600)}catch{f(null)}}return(0,b.jsxs)("div",{className:"agent-setup-clients",children:[(0,b.jsx)("div",{className:"agent-setup-client-row",role:"group","aria-label":"Copy setup command for a coding client",children:i.map(c=>{let d=a===c.id,f=e===c.id;return(0,b.jsxs)("button",{type:"button",className:`agent-setup-client${d?" is-active":""}${f?" is-copied":""}`,"aria-pressed":d,"aria-label":f?`Copied setup command for ${c.label}`:`Copy setup command for ${c.label}`,onClick:()=>void k(c.id),children:[(0,b.jsx)(g.HarnessIcon,{agent:c.id,size:14,className:"agent-setup-client-mark"}),(0,b.jsx)("span",{children:f?"Copied":c.label})]},c.id)})}),(0,b.jsx)("pre",{className:"agent-setup-command",children:(0,b.jsx)("code",{children:h})})]})}function l({rows:a,empty:c}){return a.length?(0,b.jsx)("ul",{className:"agent-work-list",children:a.map(a=>(0,b.jsx)("li",{children:(0,b.jsxs)("span",{children:[(0,b.jsx)("strong",{children:a.title}),(0,b.jsxs)("small",{children:["active"===a.status?"Active now":"Recent"," · ",new Date(a.last_activity_at).toLocaleString()]})]})},a.ref))}):(0,b.jsx)("p",{className:"agent-empty",children:c})}a.s(["default",0,function(){let{id:a,overview:c,loading:g,error:i,notFound:j}=(0,e.useAgentOverview)();if(g)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent overview…"});if(j)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]});if(i||!c)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Overview unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]});let m=`/agents/${encodeURIComponent(a)}/config`,n=c.conversation?`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(c.conversation.id)}`:`/agents/${encodeURIComponent(a)}/conversations`,o=c.messaging.home_session_ref?"Home session configured":c.messaging.new_sessions_allowed&&c.messaging.default_workspace_set?"Can start a configured session":c.current_work.length>0?"Uses an eligible existing session":"No ready session is known";return(0,b.jsxs)("div",{className:"agent-overview","data-agent-overview":!0,children:[(0,b.jsxs)("div",{className:"agent-overview-grid",children:[(0,b.jsxs)("section",{className:"agent-panel agent-instructions",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Standing instructions"}),(0,b.jsx)("h2",{children:"How this Agent works"})]}),(0,b.jsx)(d.default,{href:m,children:"Config"})]}),(0,b.jsxs)("dl",{children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Rules"}),(0,b.jsx)("dd",{children:c.instructions.rules})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Skill"}),(0,b.jsx)("dd",{children:c.instructions.skill})]})]})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Runtime"}),(0,b.jsx)("h2",{children:c.runtime.available?"Ready to work":"Setup required"})]}),(0,b.jsx)(d.default,{href:m,children:"Config"})]}),(0,b.jsx)("p",{children:c.runtime.available?`${(0,f.agentLabel)(c.runtime.agent)} is connected through ${c.runtime.connection||"the configured runtime"}.`:"This Agent cannot launch with its current registration. Open Config to resolve the connection or session scope."}),(0,b.jsxs)("dl",{className:"agent-runtime-facts",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Heartbeat"}),(0,b.jsx)("dd",{children:c.runtime.last_seen?new Date(c.runtime.last_seen).toLocaleString():"Not reported"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Messaging"}),(0,b.jsx)("dd",{children:o})]})]}),(0,b.jsx)("p",{className:"agent-muted",children:"Messages use the Agent’s configured home session or launch policy. Callers do not choose its runtime, model, or provider session."})]})]}),(0,b.jsxs)("section",{className:"agent-use","aria-labelledby":"open-this-agent",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Open this Agent"}),(0,b.jsx)("h2",{id:"open-this-agent",children:"Make it reachable"}),(0,b.jsxs)("div",{className:"agent-use-grid",children:[(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"01"}),(0,b.jsx)("h3",{children:"Use from a coding agent"}),(0,b.jsxs)("p",{children:["Let another coding agent discover ",c.agent.name," and ask its sessions — so work learned here can travel between agents."]}),(0,b.jsx)("p",{className:"agent-muted",children:"One command connects the client to the bridge and installs the collaboration skill. Click your client to copy it:"}),(0,b.jsx)(k,{})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"02"}),(0,b.jsx)("h3",{children:"Share a session to Slack"}),(0,b.jsx)("p",{children:"Open one of this Agent’s sessions to people in Slack — a time-limited, read-only share so others can ask what the session already knows."}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/slack`,children:"Share through Slack"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"03"}),(0,b.jsx)("h3",{children:"Message in Botmancers"}),(0,b.jsxs)("p",{children:["Talk directly with ",c.agent.name," in a focused conversation when you are the one asking."]}),(0,b.jsx)(d.default,{href:n,children:"Open conversation"})]})]})]}),(0,b.jsxs)("div",{className:"agent-overview-grid agent-work-grid",children:[(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Current work"}),(0,b.jsx)("h2",{children:"Active sessions"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/sessions`,children:"All sessions"})]}),(0,b.jsx)(l,{rows:c.current_work,empty:"No active work right now."})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Recent activity"}),(0,b.jsx)("h2",{children:"Latest work"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/activity`,children:"View activity"})]}),c.recent_activity.length?(0,b.jsx)(h.ActivityList,{items:c.recent_activity,compact:!0}):(0,b.jsx)("p",{className:"agent-empty",children:"No operational activity yet."})]})]})]})}])}];
|
|
1
|
+
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)},88204,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(15722),f=a.i(22151),g=a.i(78627),h=a.i(10932);let i=[{id:"cursor",label:"Cursor"},{id:"codex",label:"Codex"},{id:"claude",label:"Claude Code"}];function j(a){return`botmancers setup --client ${a}`}async function k(a,b){try{let c=b??navigator.clipboard;return await c.writeText(a),!0}catch{return!1}}function l(){let[a,d]=(0,c.useState)("cursor"),[e,f]=(0,c.useState)(null),h=j(a);async function l(a){d(a),await k(j(a))?(f(a),window.setTimeout(()=>f(b=>b===a?null:b),1600)):f(null)}return(0,b.jsxs)("div",{className:"agent-setup-clients",children:[(0,b.jsx)("div",{className:"agent-setup-client-row",role:"group","aria-label":"Copy setup command for a coding client",children:i.map(c=>{let d=a===c.id,f=e===c.id;return(0,b.jsxs)("button",{type:"button",className:`agent-setup-client${d?" is-active":""}${f?" is-copied":""}`,"aria-pressed":d,"aria-label":f?`Copied setup command for ${c.label}`:`Copy setup command for ${c.label}`,onClick:()=>void l(c.id),children:[(0,b.jsx)(g.HarnessIcon,{agent:c.id,size:14,className:"agent-setup-client-mark"}),(0,b.jsx)("span",{children:f?"Copied":c.label})]},c.id)})}),(0,b.jsx)("pre",{className:"agent-setup-command",children:(0,b.jsx)("code",{children:h})})]})}function m({agentName:a}){let[d,e]=(0,c.useState)(!1),f=`Use Botmancers to ask ${a}: <your question>`;async function g(){await k(f)?(e(!0),window.setTimeout(()=>e(!1),1600)):e(!1)}return(0,b.jsxs)("div",{className:"agent-setup-prompt",children:[(0,b.jsx)("pre",{className:"agent-setup-command",children:(0,b.jsx)("code",{children:f})}),(0,b.jsx)("button",{type:"button",className:`agent-setup-client agent-setup-copy${d?" is-copied":""}`,"aria-label":d?`Copied prompt to ask ${a}`:`Copy prompt to ask ${a}`,onClick:()=>void g(),children:d?"Copied":"Copy"})]})}function n({rows:a,empty:c}){return a.length?(0,b.jsx)("ul",{className:"agent-work-list",children:a.map(a=>(0,b.jsx)("li",{children:(0,b.jsxs)("span",{children:[(0,b.jsx)("strong",{children:a.title}),(0,b.jsxs)("small",{children:["active"===a.status?"Active now":"Recent"," · ",new Date(a.last_activity_at).toLocaleString()]})]})},a.ref))}):(0,b.jsx)("p",{className:"agent-empty",children:c})}a.s(["default",0,function(){let{id:a,overview:c,loading:g,error:i,notFound:j}=(0,e.useAgentOverview)();if(g)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading agent overview…"});if(j)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an agent"})]});if(i||!c)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Overview unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this agent. Refresh to try again."})]});let k=`/agents/${encodeURIComponent(a)}/config`,o=c.conversation?`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(c.conversation.id)}`:`/agents/${encodeURIComponent(a)}/conversations`,p=c.messaging.home_session_ref?"Home session configured":c.messaging.new_sessions_allowed&&c.messaging.default_workspace_set?"Can start a configured session":c.current_work.length>0?"Uses an eligible existing session":"No ready session is known";return(0,b.jsxs)("div",{className:"agent-overview","data-agent-overview":!0,children:[(0,b.jsxs)("div",{className:"agent-overview-grid",children:[(0,b.jsxs)("section",{className:"agent-panel agent-instructions",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Standing instructions"}),(0,b.jsx)("h2",{children:"How this agent works"})]}),(0,b.jsx)(d.default,{href:k,children:"Config"})]}),(0,b.jsxs)("dl",{children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Rules"}),(0,b.jsx)("dd",{children:c.instructions.rules})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Skill"}),(0,b.jsx)("dd",{children:c.instructions.skill})]})]})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Runtime"}),(0,b.jsx)("h2",{children:c.runtime.available?"Ready to work":"Setup required"})]}),(0,b.jsx)(d.default,{href:k,children:"Config"})]}),(0,b.jsx)("p",{children:c.runtime.available?`${(0,f.agentLabel)(c.runtime.agent)} is connected through ${c.runtime.connection||"the configured runtime"}.`:"This agent cannot launch with its current registration. Open Config to resolve the connection or session scope."}),(0,b.jsxs)("dl",{className:"agent-runtime-facts",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Heartbeat"}),(0,b.jsx)("dd",{children:c.runtime.last_seen?new Date(c.runtime.last_seen).toLocaleString():"Not reported"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Messaging"}),(0,b.jsx)("dd",{children:p})]})]}),(0,b.jsx)("p",{className:"agent-muted",children:"Messages use the agent’s configured home session or launch policy. Callers do not choose its runtime, model, or provider session."})]})]}),(0,b.jsxs)("section",{className:"agent-use","aria-labelledby":"open-this-agent",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Open this agent"}),(0,b.jsx)("h2",{id:"open-this-agent",children:"Make it reachable"}),(0,b.jsxs)("div",{className:"agent-use-grid",children:[(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"01"}),(0,b.jsx)("h3",{children:"Use from a coding agent"}),(0,b.jsxs)("p",{children:["Let another coding agent discover ",c.agent.name," and ask its sessions — so work learned here can travel between agents."]}),(0,b.jsxs)("ol",{className:"agent-setup-steps",children:[(0,b.jsxs)("li",{children:[(0,b.jsxs)("h4",{children:[(0,b.jsx)("span",{className:"agent-setup-step-label",children:"Step 1"})," Install in your coding agent"]}),(0,b.jsxs)("p",{className:"agent-muted",children:["Run this where your coding agent runs (the one that will ask ",c.agent.name,"), not on this registered agent. Click your client to copy it:"]}),(0,b.jsx)(l,{})]}),(0,b.jsxs)("li",{children:[(0,b.jsxs)("h4",{children:[(0,b.jsx)("span",{className:"agent-setup-step-label",children:"Step 2"})," Ask it to talk to ",c.agent.name]}),(0,b.jsx)(m,{agentName:c.agent.name}),(0,b.jsxs)("p",{className:"agent-muted",children:["Your coding agent sends the question to ",c.agent.name,", waits for the answer, and can read the conversation."]})]})]})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"02"}),(0,b.jsx)("h3",{children:"Share a session to Slack"}),(0,b.jsx)("p",{children:"Open one of this agent’s sessions to people in Slack — a time-limited, read-only share so others can ask what the session already knows."}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/slack`,children:"Share through Slack"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"03"}),(0,b.jsx)("h3",{children:"Message in Botmancers"}),(0,b.jsxs)("p",{children:["Talk directly with ",c.agent.name," in a focused conversation when you are the one asking."]}),(0,b.jsx)(d.default,{href:o,children:"Open conversation"})]})]})]}),(0,b.jsxs)("div",{className:"agent-overview-grid agent-work-grid",children:[(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Current work"}),(0,b.jsx)("h2",{children:"Active sessions"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/sessions`,children:"All sessions"})]}),(0,b.jsx)(n,{rows:c.current_work,empty:"No active work right now."})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Recent activity"}),(0,b.jsx)("h2",{children:"Latest work"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/activity`,children:"View activity"})]}),c.recent_activity.length?(0,b.jsx)(h.ActivityList,{items:c.recent_activity,compact:!0}):(0,b.jsx)("p",{className:"agent-empty",children:"No operational activity yet."})]})]})]})}])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_agents_%5Bid%5D_0sr4fdg._.js.map
|
package/app/.next/server/chunks/ssr/app_agents_[id]_activity_AgentActivityPage_tsx_042-590._.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this
|
|
1
|
+
module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_agents_%5Bid%5D_activity_AgentActivityPage_tsx_042-590._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[48219,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(60193),g=a.i(23464);function h({agentId:a,agentName:d}){let e=(0,c.useId)(),f=(0,c.useId)(),i=(0,c.useId)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),[p,q]=(0,c.useState)("idle"),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)("");(0,c.useEffect)(()=>{let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);b||(a.ok&&c?.policy?(m(""),k(c.policy)):m("Could not load the share policy."))}).catch(()=>{b||m("Could not load the share policy.")}),()=>{b=!0}},[a,n]);let B=()=>{s(""),q("idle"),o(a=>a+1)},C=async(b,c)=>{if(!j)return!1;q("saving"),s(""),u("");try{let d=await fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:j.revision,...b})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.policy)return q("error"),s("string"==typeof e?.error?.message?e.error.message:"The share policy could not be saved."),!1;return k(e.policy),q("idle"),u(c("number"==typeof e.revoked_contexts?e.revoked_contexts:0)),!0}catch{return q("error"),s("The share policy could not be saved."),!1}},D=async a=>{if(a.preventDefault(),!j)return;let b=(0,g.audienceInputError)(v,x,j.audiences);if(A(b??""),b)return;let c={kind:"slack",team_id:v.trim(),channel_id:x.trim()};await C({audiences:[...j.audiences,c]},()=>`Added ${(0,g.audienceLabel)(c)}.`)&&(w(""),y(""))},E="saving"===p,F=!!j&&"invalid"!==j.state;return(0,b.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),E?(0,b.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",d,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),l?(0,b.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[l," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Retry"})]}):null,j||l?null:(0,b.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),j?.state==="invalid"?(0,b.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",j.reason," Fix or remove config/session-shares.json, then"," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"reload"}),"."]}):null,j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"share-policy-toggle",children:[(0,b.jsx)("input",{id:e,type:"checkbox",role:"switch",checked:j.agent.share_from_turn,"aria-checked":j.agent.share_from_turn,disabled:!F||E||!j.agent.share_current.supported&&!j.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:a=>{let b=a.target.checked;C({share_from_turn:b},a=>b?"Share from a turn is on.":`Share from a turn is off.${a?` Revoked ${a} live turn context${1===a?"":"s"}.`:""}`)}}),(0,b.jsxs)("label",{htmlFor:e,className:"text-sm",children:[(0,b.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,b.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,b.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,g.shareFromTurnNote)(j)}),j.agent.live_contexts>0?(0,b.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[j.agent.live_contexts," live turn context",1===j.agent.live_contexts?"":"s"," now."]}):null,(0,b.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,b.jsx)("p",{className:"text-sm cfg-faint",children:"Every Agent’s shares use this list. A share can only go to a channel on it."}),0===j.audiences.length?(0,b.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,b.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:j.audiences.map(a=>(0,b.jsxs)("li",{className:"share-policy-entry",children:[(0,b.jsx)("span",{className:"cfg-code",children:a.channel_id}),(0,b.jsxs)("span",{className:"cfg-faint",children:["workspace ",a.team_id]}),(0,b.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!F||E,"aria-label":`Remove ${(0,g.audienceLabel)(a)}`,onClick:()=>{j&&C({audiences:j.audiences.filter(b=>b.team_id!==a.team_id||b.channel_id!==a.channel_id)},()=>`Removed ${(0,g.audienceLabel)(a)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${a.team_id}:${a.channel_id}`))}),(0,b.jsxs)("form",{className:"share-policy-add",onSubmit:a=>{D(a)},"aria-label":"Add a Slack channel",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:f,className:"text-sm",children:"Workspace ID"}),(0,b.jsx)("input",{id:f,className:"cfg-input",value:v,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{w(a.target.value),A("")}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:i,className:"text-sm",children:"Channel ID"}),(0,b.jsx)("input",{id:i,className:"cfg-input",value:x,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{y(a.target.value),A("")}})]}),(0,b.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!F||E||!v.trim()||!x.trim(),children:"Add channel"})]}),z?(0,b.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:z}):null,"error"===p?(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",r," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,b.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:t})]}):null]})}var i=a.i(35832),j=a.i(20851),k=a.i(1160),l=a.i(22855),m=a.i(79202),n=a.i(36391);function o({attribute:a,label:d,options:e,current:f,onPick:g,className:h}){let i=(0,c.useId)(),j=`avatar-${a}`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{id:i,className:"avatar-group-label",children:d}),(0,b.jsx)("div",{className:h?`avatar-opt-grid ${h}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":i,children:e.map(c=>(0,b.jsxs)("label",{title:c.label,className:"avatar-opt",children:[(0,b.jsx)("input",{type:"radio",name:j,value:c.id,checked:f[a]===c.id,onChange:()=>g({[a]:c.id}),className:"avatar-opt-input"}),(0,b.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,b.jsx)(n.default,{config:{...f,[a]:c.id},size:44})}),(0,b.jsx)("span",{children:c.label})]},c.id))})]})}var p=a.i(80219);function q({phase:a,onImport:c}){let d=(0,p.marketImportView)(a);return(0,b.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,b.jsx)("button",{type:"button",onClick:c,disabled:d.busy,"aria-busy":d.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,b.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===d.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:d.message})]})}var r=a.i(5020);let s="Fix the highlighted fields.",t=[{key:"avatar_accessory",label:"Avatar accessory"},{key:"avatar_color",label:"Avatar color"},{key:"avatar_eyes",label:"Avatar eyes"},{key:"avatar_hands",label:"Avatar hands"},{key:"description",label:"Description (rules)"},{key:"import_operation_id",label:"Import operation ID"},{key:"import_schema_version",label:"Import schema version"},{key:"memories",label:"Remembered facts"},{key:"name",label:"Name"},{key:"skill_content",label:"Skill content"},{key:"skill_path",label:"Skill path"},{key:"skill_present",label:"Skill present"},{key:"source_provider",label:"Source provider"},{key:"template_id",label:"Template ID"},{key:"template_url",label:"Template URL"},{key:"title",label:"Title"}];function u(a){return String(a).padStart(2,"0")}function v(a){let b=new Date(a);return`${b.getFullYear()}-${u(b.getMonth()+1)}-${u(b.getDate())} ${u(b.getHours())}:${u(b.getMinutes())}`}function w(a){let b=new Date(a);return`${u(b.getHours())}:${u(b.getMinutes())}:${u(b.getSeconds())}`}async function x(a){try{return await navigator.clipboard.writeText(a),!0}catch{return!1}}a.s(["default",0,function(){var a;let g=String((0,e.useParams)().id??""),u=(0,e.useRouter)(),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(0),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)("clean"),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)(0),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)("clean"),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(0),[aa,ab]=(0,c.useState)({}),[ac,ad]=(0,c.useState)(""),[ae,af]=(0,c.useState)(!1),[ag,ah]=(0,c.useState)(null),[ai,aj]=(0,c.useState)(!1),ak=(0,m.useRuntimeConnections)(),[al,am]=(0,c.useState)(void 0),[an,ao]=(0,c.useState)("clean"),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(0),[at,au]=(0,c.useState)(null),[av,aw]=(0,c.useState)("clean"),[ax,ay]=(0,c.useState)(""),[az,aA]=(0,c.useState)(0),{phase:aB,startImport:aC}=function(a){let[b,d]=(0,c.useState)("idle");return(0,c.useEffect)(()=>{let b=window.location.search;if(null===(0,p.importedBotId)(b))return;let c=new URL(window.location.href);c.searchParams.delete(p.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",c.pathname+c.search);let e=!1;return(0,p.resolveImportReturn)(b,a,async a=>(await fetch(`/api/bots/${encodeURIComponent(a)}/config`,{cache:"no-store"})).ok).then(a=>{e||("open"===a.kind?window.location.replace(a.path):"missing"===a.kind&&d("missing"))}),()=>{e=!0}},[a]),{phase:b,startImport:async function(){d("checking");try{let a=await fetch(p.HANDOFF_STATUS_PATH,{cache:"no-store"}),b=await a.json().catch(()=>null);if(!a.ok)return void d("failed");if(b?.configured!==!0)return void d("unavailable");d("redirecting"),window.location.href=(0,p.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>d(a=>"redirecting"===a?"idle":a),4e3)}catch{d("failed")}}}}(g);function aD(){D(!0),F(!1),J(a=>a+1)}(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/sessions?status=all`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(b=>{a||am((b?.sessions??[]).map(a=>({ref:a.ref,title:a.title,status:a.status})))}).catch(()=>{a||am([])}),()=>{a=!0}},[g,I]),(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/config`).then(async b=>{if(a)return;if(404===b.status){H(!0),B(null);return}if(!b.ok)throw Error("request failed");let c=await b.json();a||(B(c),L(c.bot.description??""),H(!1),F(!1))}).catch(()=>{a||F(!0)}).finally(()=>{a||D(!1)}),()=>{a=!0}},[g,I]);let aE=A?.bot.description??"",aF=null!==K&&K!==aE,aG=A?.skill.content??"",aH=S&&U!==aG,aI=A?(0,k.registrationFormFromBot)(A.bot):null,aJ=ae&&null!==ag&&JSON.stringify(ag)!==JSON.stringify(aI),aK=A?.bot.avatar_config??(0,r.resolveAvatar)(A?.bot??{}),aL=at??aK,aM=null!==at&&JSON.stringify(at)!==JSON.stringify(aK),aN=aF||aH||aJ||aM;function aO(a,b){x(b).then(b=>{b&&(ad(a),setTimeout(()=>ad(b=>b===a?"":b),2e3))})}async function aP(){if(A&&null!==K){N("saving"),P("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,description:K})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),N("confirmed"),R(Date.now()),setTimeout(()=>{N(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){N("error"),P(a instanceof Error?a.message:"request failed")}}}function aQ(){A&&(ah((0,k.registrationFormFromBot)(A.bot)),af(!0),aj(!1),ao("clean"),aq(""),ak.retry())}function aR(a){ah(b=>b?{...b,...a}:b),aq(""),ao(a=>"error"===a?"clean":a)}function aS(){af(!1),ah(null),ao("clean"),aq("")}function aT(a){au({...at??aK,...a}),aw("clean"),ay("")}async function aU(){if(A&&at){aw("saving"),ay("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,avatar:at})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),au(null),aw("confirmed"),aA(Date.now()),setTimeout(()=>{aw(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){aw("error"),ay(a instanceof Error?a.message:"request failed")}}}async function aV(){if(A&&ag){if((0,k.hasRegistrationErrors)((0,k.registrationFormView)(ag,ak.state))){aj(!0),ao("error"),aq(s);return}ao("saving"),aq("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,k.registrationPatchBody)(A.bot.id,ag))});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),af(!1),ah(null),ao("confirmed"),as(Date.now()),setTimeout(()=>{ao(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){ao("error"),aq(a instanceof Error?a.message:"request failed")}}}function aW(){V(A?.skill.content??""),T(!0),X("clean"),Z("")}async function aX(){if(A&&(U.trim()||window.confirm("Delete this skill file?"))){X("saving"),Z("");try{let a=await fetch(`/api/bots/${encodeURIComponent(g)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:U})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await a.json();B(a=>a?{...a,skill:b.skill,currentHash:b.currentHash}:a),T(!1),X("confirmed"),_(Date.now()),setTimeout(()=>{X(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){X("error"),Z(a instanceof Error?a.message:"request failed")}}}if((0,c.useEffect)(()=>{if(!aN)return;let a=a=>{a.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[aN]),G)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]})});if(C&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,b.jsx)("div",{className:"h-12 rounded-lg animate-pulse cfg-skel"}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"space-y-6",children:[0,1,2].map(a=>(0,b.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},a))}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(E&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Couldn't load agent details"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,b.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:(0,b.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,b.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(a=>(0,b.jsx)("div",{className:"min-w-0 space-y-6",children:a.map(a=>(0,b.jsxs)("div",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-2",children:a}),(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,b.jsx)("button",{onClick:aD,className:"cfg-link",children:"Retry"})]})]},a))},a[0]))})]})});if(!A)return null;let{bot:aY,skill:aZ,currentHash:a$,snapshots:a_}=A,a0=!!(aY.source_provider||aY.template_id||aY.template_url||aY.import_schema_version||aY.import_operation_id),a1="saving"===M?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aF||"error"===M?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===M?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(Q)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a2="saving"===W?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aH||"error"===W?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w($)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a3="saving"===an?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aJ||"error"===an?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===an?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(ar)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a4="saving"===av?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aM||"error"===av?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===av?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(az)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,b.jsxs)("div",{className:"cfg-page cfg-page-framed",children:[(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Standing setup"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,b.jsx)("code",{className:"cfg-code",title:a$,children:a$.slice(0,8)})," ",(0,b.jsx)("button",{onClick:()=>aO("header",a$),className:"cfg-link text-sm",children:"header"===ac?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:aN?(0,b.jsxs)("span",{className:"cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,b.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Skills"}),a2]}),"unsupported"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Skill files need an agent name matching /^[A-Za-z0-9_-]+$/ — this name cannot map to a skill path."})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[aZ.path," · ","present"===aZ.status?"Present":"Not present"]}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("textarea",{value:U,onChange:a=>V(a.target.value),rows:8,className:"cfg-input text-sm"}),"error"===W&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",Y,"."," ",(0,b.jsx)("button",{onClick:aX,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aX,disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){T(!1),X("clean"),Z("")},disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:aZ.content}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,b.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Rules"}),a1]}),(0,b.jsx)("textarea",{value:K??"",onChange:a=>L(a.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,b.jsx)("p",{className:"mt-2 text-xs cfg-faint",children:"Sent verbatim as the standing-rules system message on every turn. This beats the user's request for detail or length."}),"error"===M&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",O,"."," ",(0,b.jsx)("button",{onClick:aP,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aP,disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===M?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){L(aE),N("clean"),P("")},disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Agent"}),a3]}),(()=>{if(!ae||!ag){let a=(0,k.registrationReadView)(aY,al);return(0,b.jsxs)("div",{"data-field":"runtime-read",children:[(0,b.jsx)("dl",{className:"text-sm",children:a.rows.map(a=>(0,b.jsxs)("div",{"data-row":a.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:a.label}),(0,b.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:a.value})]},a.key))}),a.notices.map(a=>(0,b.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:a},a)),(0,b.jsx)("button",{onClick:aQ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let a=(0,k.registrationFormView)(ag,ak.state);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.RegistrationFields,{idPrefix:"cfg",variant:"config",form:ag,onChange:aR,view:a,showErrors:ai,connections:ak.state,onRetryConnections:ak.retry,onAddConnection:ak.add,workspacePlaceholder:(0,j.defaultWorkdirFor)(aY.id),workspaceHint:(0,j.configWorkspaceHint)(aY.id),sessions:al,includeHomeSession:!0}),"error"===an&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ap===s?ap:`Couldn't save: ${ap}.`," ",ap===s?null:(0,b.jsx)("button",{onClick:aV,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aV,disabled:!aJ||"saving"===an||a.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===an?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:aS,disabled:"saving"===an,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:aJ?"Discard":"Cancel"})]})]})})()]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!a0&&(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,b.jsxs)("dl",{className:"text-sm",children:[(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,b.jsx)("dd",{className:"text-right",children:aY.source_provider??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,b.jsx)("dd",{className:"text-right",children:aY.template_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.template_url?(a=aY.template_url).startsWith("http://")||a.startsWith("https://")?(0,b.jsx)("a",{href:aY.template_url,className:"cfg-link",children:aY.template_url}):aY.template_url:"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_schema_version??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.import_operation_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_timestamp?v(aY.import_timestamp):"—"})]})]}),(0,b.jsx)(q,{phase:aB,onImport:()=>{aC()}})]})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===a_.length?(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,b.jsx)("ul",{className:"space-y-3",children:a_.map(a=>{let c=a.hash===a$,d=!!aa[a.id];return(0,b.jsxs)("li",{className:"cfg-row",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsxs)("p",{className:"text-sm",children:[v(a.created_at)," · ",a.id.slice(0,4),a.transport?` \xb7 ${a.transport}`:null]}),(0,b.jsx)("button",{onClick:()=>ab(b=>({...b,[a.id]:!b[a.id]})),"aria-label":d?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:d?"▾":"▸"})]}),(0,b.jsxs)("p",{className:"mt-1 text-sm",children:[(0,b.jsx)("code",{className:"cfg-code",children:a.hash.slice(0,12)})," ",(0,b.jsx)("button",{onClick:()=>aO(a.id,a.hash),className:"cfg-link text-sm",children:ac===a.id?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"mt-1 text-sm",children:c?(0,b.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,b.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),d&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,b.jsxs)("p",{className:"cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",a.id]}),(0,b.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,b.jsx)("code",{className:"cfg-code",children:a.hash})]}),(0,b.jsx)("dl",{className:"mt-2",children:t.map(c=>{let d=a.snapshot[c.key];return(0,b.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:c.label}),(0,b.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==d?(0,b.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(d)?0===d.length?(0,b.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d.map(a=>`- ${a}`).join("\n")}):"boolean"==typeof d?String(d):""===d?(0,b.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d})})]},c.key)})})]})]},a.id)})})]}),(0,b.jsx)(h,{agentId:aY.id,agentName:aY.name}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Avatar"}),a4]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,b.jsx)(n.default,{config:aL,size:96,title:"Avatar live preview"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Outline style: the color is the line color, nothing is filled. Pick an option to preview, then Save."})]}),(0,b.jsx)(o,{attribute:"color",label:"Color",options:r.AVATAR_COLORS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"eyes",label:"Eyes",options:r.AVATAR_EYES,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"hands",label:"Hands",options:r.AVATAR_HANDS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"accessory",label:"Accessory",options:r.AVATAR_ACCESSORIES,current:aL,onPick:aT}),"error"===av&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",ax,"."," ",(0,b.jsx)("button",{onClick:aU,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aU,disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===av?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){au(null),aw("clean"),ay("")},disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,b.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:i.DELETE_REMOVES_COPY}),(0,b.jsx)("p",{className:"text-sm cfg-faint mt-2",children:i.DELETE_KEEPS_COPY}),(0,b.jsx)("button",{type:"button",onClick:()=>z(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),y?(0,b.jsx)(f.default,{ids:[aY.id],onCancel:()=>z(!1),onDeleted:a=>u.push(`/?deleted=${Math.max(a.length,1)}`)}):null]})}],48219)}];
|
|
1
|
+
module.exports=[48219,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(60193),g=a.i(23464);function h({agentId:a,agentName:d}){let e=(0,c.useId)(),f=(0,c.useId)(),i=(0,c.useId)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),[p,q]=(0,c.useState)("idle"),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)("");(0,c.useEffect)(()=>{let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);b||(a.ok&&c?.policy?(m(""),k(c.policy)):m("Could not load the share policy."))}).catch(()=>{b||m("Could not load the share policy.")}),()=>{b=!0}},[a,n]);let B=()=>{s(""),q("idle"),o(a=>a+1)},C=async(b,c)=>{if(!j)return!1;q("saving"),s(""),u("");try{let d=await fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:j.revision,...b})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.policy)return q("error"),s("string"==typeof e?.error?.message?e.error.message:"The share policy could not be saved."),!1;return k(e.policy),q("idle"),u(c("number"==typeof e.revoked_contexts?e.revoked_contexts:0)),!0}catch{return q("error"),s("The share policy could not be saved."),!1}},D=async a=>{if(a.preventDefault(),!j)return;let b=(0,g.audienceInputError)(v,x,j.audiences);if(A(b??""),b)return;let c={kind:"slack",team_id:v.trim(),channel_id:x.trim()};await C({audiences:[...j.audiences,c]},()=>`Added ${(0,g.audienceLabel)(c)}.`)&&(w(""),y(""))},E="saving"===p,F=!!j&&"invalid"!==j.state;return(0,b.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),E?(0,b.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",d,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),l?(0,b.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[l," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Retry"})]}):null,j||l?null:(0,b.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),j?.state==="invalid"?(0,b.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",j.reason," Fix or remove config/session-shares.json, then"," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"reload"}),"."]}):null,j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"share-policy-toggle",children:[(0,b.jsx)("input",{id:e,type:"checkbox",role:"switch",checked:j.agent.share_from_turn,"aria-checked":j.agent.share_from_turn,disabled:!F||E||!j.agent.share_current.supported&&!j.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:a=>{let b=a.target.checked;C({share_from_turn:b},a=>b?"Share from a turn is on.":`Share from a turn is off.${a?` Revoked ${a} live turn context${1===a?"":"s"}.`:""}`)}}),(0,b.jsxs)("label",{htmlFor:e,className:"text-sm",children:[(0,b.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,b.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,b.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,g.shareFromTurnNote)(j)}),j.agent.live_contexts>0?(0,b.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[j.agent.live_contexts," live turn context",1===j.agent.live_contexts?"":"s"," now."]}):null,(0,b.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,b.jsx)("p",{className:"text-sm cfg-faint",children:"Every agent’s shares use this list. A share can only go to a channel on it."}),0===j.audiences.length?(0,b.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,b.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:j.audiences.map(a=>(0,b.jsxs)("li",{className:"share-policy-entry",children:[(0,b.jsx)("span",{className:"cfg-code",children:a.channel_id}),(0,b.jsxs)("span",{className:"cfg-faint",children:["workspace ",a.team_id]}),(0,b.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!F||E,"aria-label":`Remove ${(0,g.audienceLabel)(a)}`,onClick:()=>{j&&C({audiences:j.audiences.filter(b=>b.team_id!==a.team_id||b.channel_id!==a.channel_id)},()=>`Removed ${(0,g.audienceLabel)(a)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${a.team_id}:${a.channel_id}`))}),(0,b.jsxs)("form",{className:"share-policy-add",onSubmit:a=>{D(a)},"aria-label":"Add a Slack channel",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:f,className:"text-sm",children:"Workspace ID"}),(0,b.jsx)("input",{id:f,className:"cfg-input",value:v,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{w(a.target.value),A("")}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:i,className:"text-sm",children:"Channel ID"}),(0,b.jsx)("input",{id:i,className:"cfg-input",value:x,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{y(a.target.value),A("")}})]}),(0,b.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!F||E||!v.trim()||!x.trim(),children:"Add channel"})]}),z?(0,b.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:z}):null,"error"===p?(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",r," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,b.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:t})]}):null]})}var i=a.i(35832),j=a.i(20851),k=a.i(1160),l=a.i(22855),m=a.i(79202),n=a.i(36391);function o({attribute:a,label:d,options:e,current:f,onPick:g,className:h}){let i=(0,c.useId)(),j=`avatar-${a}`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{id:i,className:"avatar-group-label",children:d}),(0,b.jsx)("div",{className:h?`avatar-opt-grid ${h}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":i,children:e.map(c=>(0,b.jsxs)("label",{title:c.label,className:"avatar-opt",children:[(0,b.jsx)("input",{type:"radio",name:j,value:c.id,checked:f[a]===c.id,onChange:()=>g({[a]:c.id}),className:"avatar-opt-input"}),(0,b.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,b.jsx)(n.default,{config:{...f,[a]:c.id},size:44})}),(0,b.jsx)("span",{children:c.label})]},c.id))})]})}var p=a.i(80219);function q({phase:a,onImport:c}){let d=(0,p.marketImportView)(a);return(0,b.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,b.jsx)("button",{type:"button",onClick:c,disabled:d.busy,"aria-busy":d.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,b.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===d.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:d.message})]})}var r=a.i(5020);let s="Fix the highlighted fields.",t=[{key:"avatar_accessory",label:"Avatar accessory"},{key:"avatar_color",label:"Avatar color"},{key:"avatar_eyes",label:"Avatar eyes"},{key:"avatar_hands",label:"Avatar hands"},{key:"description",label:"Description (rules)"},{key:"import_operation_id",label:"Import operation ID"},{key:"import_schema_version",label:"Import schema version"},{key:"memories",label:"Remembered facts"},{key:"name",label:"Name"},{key:"skill_content",label:"Skill content"},{key:"skill_path",label:"Skill path"},{key:"skill_present",label:"Skill present"},{key:"source_provider",label:"Source provider"},{key:"template_id",label:"Template ID"},{key:"template_url",label:"Template URL"},{key:"title",label:"Title"}];function u(a){return String(a).padStart(2,"0")}function v(a){let b=new Date(a);return`${b.getFullYear()}-${u(b.getMonth()+1)}-${u(b.getDate())} ${u(b.getHours())}:${u(b.getMinutes())}`}function w(a){let b=new Date(a);return`${u(b.getHours())}:${u(b.getMinutes())}:${u(b.getSeconds())}`}async function x(a){try{return await navigator.clipboard.writeText(a),!0}catch{return!1}}a.s(["default",0,function(){var a;let g=String((0,e.useParams)().id??""),u=(0,e.useRouter)(),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(0),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)("clean"),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)(0),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)("clean"),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(0),[aa,ab]=(0,c.useState)({}),[ac,ad]=(0,c.useState)(""),[ae,af]=(0,c.useState)(!1),[ag,ah]=(0,c.useState)(null),[ai,aj]=(0,c.useState)(!1),ak=(0,m.useRuntimeConnections)(),[al,am]=(0,c.useState)(void 0),[an,ao]=(0,c.useState)("clean"),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(0),[at,au]=(0,c.useState)(null),[av,aw]=(0,c.useState)("clean"),[ax,ay]=(0,c.useState)(""),[az,aA]=(0,c.useState)(0),{phase:aB,startImport:aC}=function(a){let[b,d]=(0,c.useState)("idle");return(0,c.useEffect)(()=>{let b=window.location.search;if(null===(0,p.importedBotId)(b))return;let c=new URL(window.location.href);c.searchParams.delete(p.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",c.pathname+c.search);let e=!1;return(0,p.resolveImportReturn)(b,a,async a=>(await fetch(`/api/bots/${encodeURIComponent(a)}/config`,{cache:"no-store"})).ok).then(a=>{e||("open"===a.kind?window.location.replace(a.path):"missing"===a.kind&&d("missing"))}),()=>{e=!0}},[a]),{phase:b,startImport:async function(){d("checking");try{let a=await fetch(p.HANDOFF_STATUS_PATH,{cache:"no-store"}),b=await a.json().catch(()=>null);if(!a.ok)return void d("failed");if(b?.configured!==!0)return void d("unavailable");d("redirecting"),window.location.href=(0,p.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>d(a=>"redirecting"===a?"idle":a),4e3)}catch{d("failed")}}}}(g);function aD(){D(!0),F(!1),J(a=>a+1)}(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/sessions?status=all`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(b=>{a||am((b?.sessions??[]).map(a=>({ref:a.ref,title:a.title,status:a.status})))}).catch(()=>{a||am([])}),()=>{a=!0}},[g,I]),(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/config`).then(async b=>{if(a)return;if(404===b.status){H(!0),B(null);return}if(!b.ok)throw Error("request failed");let c=await b.json();a||(B(c),L(c.bot.description??""),H(!1),F(!1))}).catch(()=>{a||F(!0)}).finally(()=>{a||D(!1)}),()=>{a=!0}},[g,I]);let aE=A?.bot.description??"",aF=null!==K&&K!==aE,aG=A?.skill.content??"",aH=S&&U!==aG,aI=A?(0,k.registrationFormFromBot)(A.bot):null,aJ=ae&&null!==ag&&JSON.stringify(ag)!==JSON.stringify(aI),aK=A?.bot.avatar_config??(0,r.resolveAvatar)(A?.bot??{}),aL=at??aK,aM=null!==at&&JSON.stringify(at)!==JSON.stringify(aK),aN=aF||aH||aJ||aM;function aO(a,b){x(b).then(b=>{b&&(ad(a),setTimeout(()=>ad(b=>b===a?"":b),2e3))})}async function aP(){if(A&&null!==K){N("saving"),P("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,description:K})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),N("confirmed"),R(Date.now()),setTimeout(()=>{N(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){N("error"),P(a instanceof Error?a.message:"request failed")}}}function aQ(){A&&(ah((0,k.registrationFormFromBot)(A.bot)),af(!0),aj(!1),ao("clean"),aq(""),ak.retry())}function aR(a){ah(b=>b?{...b,...a}:b),aq(""),ao(a=>"error"===a?"clean":a)}function aS(){af(!1),ah(null),ao("clean"),aq("")}function aT(a){au({...at??aK,...a}),aw("clean"),ay("")}async function aU(){if(A&&at){aw("saving"),ay("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,avatar:at})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),au(null),aw("confirmed"),aA(Date.now()),setTimeout(()=>{aw(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){aw("error"),ay(a instanceof Error?a.message:"request failed")}}}async function aV(){if(A&&ag){if((0,k.hasRegistrationErrors)((0,k.registrationFormView)(ag,ak.state))){aj(!0),ao("error"),aq(s);return}ao("saving"),aq("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,k.registrationPatchBody)(A.bot.id,ag))});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),af(!1),ah(null),ao("confirmed"),as(Date.now()),setTimeout(()=>{ao(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){ao("error"),aq(a instanceof Error?a.message:"request failed")}}}function aW(){V(A?.skill.content??""),T(!0),X("clean"),Z("")}async function aX(){if(A&&(U.trim()||window.confirm("Delete this skill file?"))){X("saving"),Z("");try{let a=await fetch(`/api/bots/${encodeURIComponent(g)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:U})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await a.json();B(a=>a?{...a,skill:b.skill,currentHash:b.currentHash}:a),T(!1),X("confirmed"),_(Date.now()),setTimeout(()=>{X(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){X("error"),Z(a instanceof Error?a.message:"request failed")}}}if((0,c.useEffect)(()=>{if(!aN)return;let a=a=>{a.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[aN]),G)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an agent"})]})});if(C&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,b.jsx)("div",{className:"h-12 rounded-lg animate-pulse cfg-skel"}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"space-y-6",children:[0,1,2].map(a=>(0,b.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},a))}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(E&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Couldn't load agent details"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,b.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:(0,b.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,b.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(a=>(0,b.jsx)("div",{className:"min-w-0 space-y-6",children:a.map(a=>(0,b.jsxs)("div",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-2",children:a}),(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,b.jsx)("button",{onClick:aD,className:"cfg-link",children:"Retry"})]})]},a))},a[0]))})]})});if(!A)return null;let{bot:aY,skill:aZ,currentHash:a$,snapshots:a_}=A,a0=!!(aY.source_provider||aY.template_id||aY.template_url||aY.import_schema_version||aY.import_operation_id),a1="saving"===M?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aF||"error"===M?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===M?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(Q)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a2="saving"===W?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aH||"error"===W?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w($)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a3="saving"===an?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aJ||"error"===an?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===an?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(ar)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a4="saving"===av?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aM||"error"===av?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===av?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(az)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,b.jsxs)("div",{className:"cfg-page cfg-page-framed",children:[(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Standing setup"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,b.jsx)("code",{className:"cfg-code",title:a$,children:a$.slice(0,8)})," ",(0,b.jsx)("button",{onClick:()=>aO("header",a$),className:"cfg-link text-sm",children:"header"===ac?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:aN?(0,b.jsxs)("span",{className:"cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,b.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Skills"}),a2]}),"unsupported"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Skill files need an agent name matching /^[A-Za-z0-9_-]+$/ — this name cannot map to a skill path."})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[aZ.path," · ","present"===aZ.status?"Present":"Not present"]}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("textarea",{value:U,onChange:a=>V(a.target.value),rows:8,className:"cfg-input text-sm"}),"error"===W&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",Y,"."," ",(0,b.jsx)("button",{onClick:aX,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aX,disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){T(!1),X("clean"),Z("")},disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:aZ.content}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,b.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Rules"}),a1]}),(0,b.jsx)("textarea",{value:K??"",onChange:a=>L(a.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,b.jsx)("p",{className:"mt-2 text-xs cfg-faint",children:"Sent verbatim as the standing-rules system message on every turn. This beats the user's request for detail or length."}),"error"===M&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",O,"."," ",(0,b.jsx)("button",{onClick:aP,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aP,disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===M?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){L(aE),N("clean"),P("")},disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Agent"}),a3]}),(()=>{if(!ae||!ag){let a=(0,k.registrationReadView)(aY,al);return(0,b.jsxs)("div",{"data-field":"runtime-read",children:[(0,b.jsx)("dl",{className:"text-sm",children:a.rows.map(a=>(0,b.jsxs)("div",{"data-row":a.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:a.label}),(0,b.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:a.value})]},a.key))}),a.notices.map(a=>(0,b.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:a},a)),(0,b.jsx)("button",{onClick:aQ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let a=(0,k.registrationFormView)(ag,ak.state);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.RegistrationFields,{idPrefix:"cfg",variant:"config",form:ag,onChange:aR,view:a,showErrors:ai,connections:ak.state,onRetryConnections:ak.retry,onAddConnection:ak.add,workspacePlaceholder:(0,j.defaultWorkdirFor)(aY.id),workspaceHint:(0,j.configWorkspaceHint)(aY.id),sessions:al,includeHomeSession:!0}),"error"===an&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ap===s?ap:`Couldn't save: ${ap}.`," ",ap===s?null:(0,b.jsx)("button",{onClick:aV,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aV,disabled:!aJ||"saving"===an||a.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===an?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:aS,disabled:"saving"===an,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:aJ?"Discard":"Cancel"})]})]})})()]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!a0&&(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,b.jsxs)("dl",{className:"text-sm",children:[(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,b.jsx)("dd",{className:"text-right",children:aY.source_provider??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,b.jsx)("dd",{className:"text-right",children:aY.template_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.template_url?(a=aY.template_url).startsWith("http://")||a.startsWith("https://")?(0,b.jsx)("a",{href:aY.template_url,className:"cfg-link",children:aY.template_url}):aY.template_url:"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_schema_version??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.import_operation_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_timestamp?v(aY.import_timestamp):"—"})]})]}),(0,b.jsx)(q,{phase:aB,onImport:()=>{aC()}})]})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===a_.length?(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,b.jsx)("ul",{className:"space-y-3",children:a_.map(a=>{let c=a.hash===a$,d=!!aa[a.id];return(0,b.jsxs)("li",{className:"cfg-row",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsxs)("p",{className:"text-sm",children:[v(a.created_at)," · ",a.id.slice(0,4),a.transport?` \xb7 ${a.transport}`:null]}),(0,b.jsx)("button",{onClick:()=>ab(b=>({...b,[a.id]:!b[a.id]})),"aria-label":d?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:d?"▾":"▸"})]}),(0,b.jsxs)("p",{className:"mt-1 text-sm",children:[(0,b.jsx)("code",{className:"cfg-code",children:a.hash.slice(0,12)})," ",(0,b.jsx)("button",{onClick:()=>aO(a.id,a.hash),className:"cfg-link text-sm",children:ac===a.id?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"mt-1 text-sm",children:c?(0,b.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,b.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),d&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,b.jsxs)("p",{className:"cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",a.id]}),(0,b.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,b.jsx)("code",{className:"cfg-code",children:a.hash})]}),(0,b.jsx)("dl",{className:"mt-2",children:t.map(c=>{let d=a.snapshot[c.key];return(0,b.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:c.label}),(0,b.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==d?(0,b.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(d)?0===d.length?(0,b.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d.map(a=>`- ${a}`).join("\n")}):"boolean"==typeof d?String(d):""===d?(0,b.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d})})]},c.key)})})]})]},a.id)})})]}),(0,b.jsx)(h,{agentId:aY.id,agentName:aY.name}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Avatar"}),a4]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,b.jsx)(n.default,{config:aL,size:96,title:"Avatar live preview"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Outline style: the color is the line color, nothing is filled. Pick an option to preview, then Save."})]}),(0,b.jsx)(o,{attribute:"color",label:"Color",options:r.AVATAR_COLORS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"eyes",label:"Eyes",options:r.AVATAR_EYES,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"hands",label:"Hands",options:r.AVATAR_HANDS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"accessory",label:"Accessory",options:r.AVATAR_ACCESSORIES,current:aL,onPick:aT}),"error"===av&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",ax,"."," ",(0,b.jsx)("button",{onClick:aU,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aU,disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===av?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){au(null),aw("clean"),ay("")},disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,b.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:i.DELETE_REMOVES_COPY}),(0,b.jsx)("p",{className:"text-sm cfg-faint mt-2",children:i.DELETE_KEEPS_COPY}),(0,b.jsx)("button",{type:"button",onClick:()=>z(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),y?(0,b.jsx)(f.default,{ids:[aY.id],onCancel:()=>z(!1),onDeleted:a=>u.push(`/?deleted=${Math.max(a.length,1)}`)}):null]})}],48219)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=app_agents_%5Bid%5D_config_page_tsx_1f_gu1l._.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module.exports=[26847,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(50944),f=a.i(65221),g=a.i(22151),h=a.i(10209),i=a.i(35099);function j({mode:a,session:c,agents:e,origin:g,onClose:k,onStarted:l}){let m=(0,d.useId)(),n=(0,d.useId)(),o=(0,d.useId)(),p=(0,d.useId)(),[q,r]=(0,d.useState)(""),[s,t]=(0,d.useState)(""),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)({}),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(!1),C=(0,d.useRef)(!1),D=(0,d.useRef)(null),E=(0,d.useRef)(null),F=(0,d.useRef)(null),G=(0,d.useRef)(null),H=(0,d.useRef)(null),I=(0,i.sessionDialogUsesPin)(a,c.route),J=e.filter(a=>a.id!==c.agent.id);(0,d.useEffect)(()=>{("continue"===a?G.current:F.current)?.focus()},[a]),(0,d.useEffect)(()=>{let a=a=>{"Escape"===a.key&&(a.stopPropagation(),k())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[k]);let K=async b=>{if(b.preventDefault(),C.current)return;let d={mode:"resume"===a?"ask":a,instruction:q,originConversationId:g.conversationId,destinationAgentId:s},e="resume"===a?(0,i.validateResumeDraft)(q,u):(0,i.validateDraft)(d);if(x(e),Object.keys(e).length>0)return void(e.destination?G.current?.focus():e.instruction?F.current?.focus():H.current?.focus());let f="resume"===a?"resume":"ask",h=a=>I?(0,i.pinRequestBody)(f,q,g.conversationId,u,a):(0,i.exchangeRequestBody)(d,{agentId:c.agent.id,sessionRef:c.ref},a),j=JSON.stringify(h(""));D.current&&D.current.payload===j||(D.current={payload:j,key:crypto.randomUUID()}),C.current=!0,B(!0),z("");try{let a=I?`/api/bots/${encodeURIComponent(c.agent.id)}/sessions/${encodeURIComponent(c.ref)}/pins`:"/api/exchanges",b=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h(D.current.key))}),d=await b.json().catch(()=>null);if(!b.ok){let a="string"==typeof d?.error?.code?d.error.code:null;"idempotency_conflict"===a&&(D.current=null),z((0,i.submitErrorMessage)(a,"string"==typeof d?.error?.message?d.error.message:null));return}let e=I?d?.turn?.exchange_id:d?.exchange?.id;l("string"==typeof e?e:null)}catch{z((0,i.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{C.current=!1,B(!1)}},L=J.find(a=>a.id===s)?.name,M="ask"===a,N="resume"===a;return(0,b.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:a=>{a.target===a.currentTarget&&k()},onKeyDown:a=>{if("Tab"!==a.key||!E.current)return;let b=Array.from(E.current.querySelectorAll(h.DIALOG_FOCUSABLE)),c=(0,h.wrapFocusTarget)(b,document.activeElement,a.shiftKey);c&&(a.preventDefault(),c.focus())},children:(0,b.jsxs)("div",{ref:E,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":m,"data-exchange-mode":a,children:[(0,b.jsx)("h2",{id:m,className:"delete-title",children:(0,i.sessionDialogTitle)(a)}),(0,b.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,b.jsx)("p",{className:"exchange-source-agent",children:c.agent.name}),(0,b.jsx)("p",{className:"exchange-source-title",children:c.title}),(0,b.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,f.formatSessionDate)(c.last_activity_at),c.origin.conversation?` \xb7 from ${c.origin.conversation.label}`:""]})]}),(0,b.jsxs)("form",{onSubmit:K,noValidate:!0,className:"exchange-form",children:[M||N?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("label",{htmlFor:o,children:"Hand off to"}),(0,b.jsxs)("select",{ref:G,id:o,className:"exchange-select",value:s,"aria-invalid":!!w.destination||void 0,"aria-describedby":w.destination?`${o}-error`:void 0,disabled:A,onChange:a=>{t(a.target.value),x(a=>({...a,destination:void 0}))},children:[(0,b.jsx)("option",{value:"",children:"Choose an Agent"}),J.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]}),w.destination?(0,b.jsx)("p",{id:`${o}-error`,className:"exchange-field-error",children:w.destination}):null]}),(0,b.jsx)("label",{htmlFor:n,children:M?"Question":N?"Instruction":"Objective"}),(0,b.jsx)("textarea",{ref:F,id:n,rows:4,maxLength:i.INSTRUCTION_LIMIT,value:q,readOnly:A,"aria-invalid":!!w.instruction||void 0,"aria-describedby":`${n}-hint${w.instruction?` ${n}-error`:""}`,onChange:a=>{r(a.target.value),x(a=>({...a,instruction:void 0}))}}),w.instruction?(0,b.jsx)("p",{id:`${n}-error`,className:"exchange-field-error",children:w.instruction}):null,(0,b.jsx)("p",{id:`${n}-hint`,className:"exchange-hint",children:M?`${c.agent.name} answers from this exact session, read-only. The answer arrives in ${g.label}.`:N?`${c.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${g.label}.`:`${L??"The Agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${c.agent.name}’s session is not shared and is not changed. Progress shows in ${g.label}.`}),N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("label",{className:"exchange-approval",htmlFor:p,children:[(0,b.jsx)("input",{ref:H,id:p,type:"checkbox",checked:u,disabled:A,"aria-invalid":!!w.approval||void 0,"aria-describedby":w.approval?`${p}-error`:void 0,onChange:a=>{v(a.target.checked),x(a=>({...a,approval:void 0}))}})," ","I approve edits by ",c.agent.name," in this session"]}),w.approval?(0,b.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:w.approval}):null]}):null,y?(0,b.jsx)("p",{className:"exchange-server-error",role:"alert",children:y}):null,(0,b.jsx)("p",{className:"exchange-sending",role:"status",children:A?"Sending…":""}),(0,b.jsxs)("div",{className:"form-actions",children:[(0,b.jsx)("button",{type:"button",className:"cancel-btn",onClick:k,children:"Cancel"}),(0,b.jsx)("button",{type:"submit",className:"create-btn",disabled:A,"aria-disabled":A,children:y?"Try again":"Send"})]})]})]})})}var k=a.i(23464);function l(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function m({row:a,shares:e,policy:f,onChanged:g}){let h=(0,d.useId)(),[i,j]=(0,d.useState)(!1),[l,p]=(0,d.useState)(!1),q=e?(0,k.sessionShares)(e,a.ref):[],r=q.filter(k.shareIsLive),s=q.filter(a=>!(0,k.shareIsLive)(a)),t="loading"===f,u="loading"===f?null:f,v=t?null:(0,k.shareCreateAvailability)(a,u),w=l?s:s.slice(0,3*!r.length);return(0,b.jsxs)("section",{className:"session-shares","aria-labelledby":h,"data-session-shares":a.ref,children:[(0,b.jsxs)("div",{className:"session-shares-head",children:[(0,b.jsx)("h3",{id:h,className:"session-shares-title",children:"Slack share"}),v?.available&&!i?(0,b.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>j(!0),children:"Share to Slack"}):null]}),t?(0,b.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,v&&!v.available?(0,b.jsxs)("p",{className:"session-share-unavailable",children:[v.reason," ",v.configHref?(0,b.jsx)(c.default,{className:"session-link",href:v.configHref,children:"Open Config"}):null]}):null,i&&u?(0,b.jsx)(o,{row:a,policy:u,onCancel:()=>j(!1),onCreated:()=>{j(!1),g()}}):null,null===e?(0,b.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===e||0!==q.length||i?null:(0,b.jsx)("p",{className:"session-share-note",children:"Not shared."}),r.length+w.length>0?(0,b.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${a.title}`,children:[...r,...w].map(a=>(0,b.jsx)(n,{share:a,onChanged:g},a.share_ref))}):null,s.length>w.length?(0,b.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>p(!0),children:["Show ",s.length-w.length," ended share",s.length-w.length==1?"":"s"]}):null]})}function n({share:a,onChanged:c}){let[e,f]=(0,d.useState)(!1),[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(""),[l,m]=(0,d.useState)(!1),o=(0,k.shareIsLive)(a),p=async()=>{try{await navigator.clipboard.writeText(a.share_ref),m(!0)}catch{j("Copy failed. Select the reference instead.")}},q=async()=>{h(!0),j("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),d=await b.json().catch(()=>null);b.ok?(f(!1),c()):j("string"==typeof d?.error?.message?d.error.message:"The share could not be revoked.")}catch{j("The share could not be revoked.")}finally{h(!1)}};return(0,b.jsxs)("li",{className:`session-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"session-share-head",children:[(0,b.jsx)("span",{className:`manage-tag session-share-status is-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("span",{className:"session-share-audience",children:(0,k.audienceLabel)(a.audience)})]}),(0,b.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Expiry"}),(0,b.jsx)("dd",{children:(0,k.expiryLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Questions"}),(0,b.jsx)("dd",{children:(0,k.turnsLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{className:"session-share-ref",children:a.share_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsxs)("dd",{children:[(0,k.createdByLabel)(a)," · read-only Ask"]})]})]}),(0,b.jsx)("p",{className:"session-share-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,b.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{p()},children:l?"Copied":"Copy reference"}),o&&!e?(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>f(!0),children:"Revoke"}):null]}),e?(0,b.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:g,onClick:()=>{q()},children:g?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",disabled:g,onClick:()=>f(!1),children:"Keep it"})]})]}):null,i?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:i}):null]})}function o({row:a,policy:c,onCancel:e,onCreated:f}){let g={channel:(0,d.useId)(),duration:(0,d.useId)(),turns:(0,d.useId)()},[h,i]=(0,d.useState)(0),[j,m]=(0,d.useState)(c.limits.ttl_seconds.default),[n,p]=(0,d.useState)(String(c.limits.max_turns.default)),[q]=(0,d.useState)(l),[r,s]=(0,d.useState)(!1),[t,u]=(0,d.useState)(""),v=Number(n),w=Number.isInteger(v)&&v>=c.limits.max_turns.min&&v<=c.limits.max_turns.max,x=async b=>{if(b.preventDefault(),w){s(!0),u("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,k.shareCreateBody)(c.audiences[h],j,v,q))}),d=await b.json().catch(()=>null);b.ok?f():u("string"==typeof d?.error?.message?d.error.message:"The share could not be created.")}catch{u("The share could not be created.")}finally{s(!1)}}};return(0,b.jsxs)("form",{className:"session-share-form",onSubmit:a=>{x(a)},"aria-label":`Share ${a.title} to Slack`,children:[(0,b.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,b.jsx)("strong",{children:a.title})," (",a.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,b.jsx)("label",{htmlFor:g.channel,children:"Slack channel"}),(0,b.jsx)("select",{id:g.channel,value:h,onChange:a=>i(Number(a.target.value)),disabled:r,children:c.audiences.map((a,c)=>(0,b.jsx)("option",{value:c,children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}),(0,b.jsx)("label",{htmlFor:g.duration,children:"Expires after"}),(0,b.jsx)("select",{id:g.duration,value:j,onChange:a=>m(Number(a.target.value)),disabled:r,children:k.SHARE_DURATIONS.map(a=>(0,b.jsx)("option",{value:a.seconds,children:a.label},a.seconds))}),(0,b.jsx)("label",{htmlFor:g.turns,children:"Questions allowed"}),(0,b.jsx)("input",{id:g.turns,type:"number",inputMode:"numeric",min:c.limits.max_turns.min,max:c.limits.max_turns.max,value:n,onChange:a=>p(a.target.value),disabled:r,"aria-invalid":!w}),w?null:(0,b.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",c.limits.max_turns.min," to ",c.limits.max_turns.max,"."]}),t?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:t}):null,(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:r||!w,children:r?"Sharing…":"Create share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:e,disabled:r,children:"Cancel"})]})]})}function p(a,b,c,d,e){let f=new URLSearchParams({status:b}),g=c.trim();return g&&f.set("q",g),d&&f.set("workspace",d),e&&f.set("cursor",e),`/api/bots/${encodeURIComponent(a)}/sessions?${f.toString()}`}function q({agentId:a,agentName:h,agentProvider:k,agents:l,origin:m,onExchangeStarted:n}){let o=(0,e.useRouter)(),t=(0,e.useSearchParams)().get("session"),[u,v]=(0,d.useState)("all"),[w,x]=(0,d.useState)(null),[y,z]=(0,d.useState)(null),[A,B]=(0,d.useState)(!1),[C,D]=(0,d.useState)(""),[E,F]=(0,d.useState)(""),[G,H]=(0,d.useState)(0),[I,J]=(0,d.useState)(""),[K,L]=(0,d.useState)(""),[M,N]=(0,d.useState)([]),[O,P]=(0,d.useState)(null),[Q,R]=(0,d.useState)(!1),[S,T]=(0,d.useState)(""),[U,V]=(0,d.useState)(null),[W,X]=(0,d.useState)(null),[Y,Z]=(0,d.useState)(null),[$,_]=(0,d.useState)(null),[aa,ab]=(0,d.useState)("loading"),[ac,ad]=(0,d.useState)(0),ae=(0,d.useRef)(0),af=(0,d.useRef)(""),ag=(0,d.useRef)(""),ah=(0,d.useRef)(null),ai=(0,d.useRef)(null),aj=(0,d.useRef)(null),ak=(0,d.useRef)(!1),al=(0,d.useRef)(null),am=k&&(0,g.agentLabel)(k)||void 0;(0,d.useEffect)(()=>{ae.current+=1;let b=ae.current,c=`${a}
|
|
1
|
+
module.exports=[26847,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(50944),f=a.i(65221),g=a.i(22151),h=a.i(10209),i=a.i(35099);function j({mode:a,session:c,agents:e,origin:g,onClose:k,onStarted:l}){let m=(0,d.useId)(),n=(0,d.useId)(),o=(0,d.useId)(),p=(0,d.useId)(),[q,r]=(0,d.useState)(""),[s,t]=(0,d.useState)(""),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)({}),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(!1),C=(0,d.useRef)(!1),D=(0,d.useRef)(null),E=(0,d.useRef)(null),F=(0,d.useRef)(null),G=(0,d.useRef)(null),H=(0,d.useRef)(null),I=(0,i.sessionDialogUsesPin)(a,c.route),J=e.filter(a=>a.id!==c.agent.id);(0,d.useEffect)(()=>{("continue"===a?G.current:F.current)?.focus()},[a]),(0,d.useEffect)(()=>{let a=a=>{"Escape"===a.key&&(a.stopPropagation(),k())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[k]);let K=async b=>{if(b.preventDefault(),C.current)return;let d={mode:"resume"===a?"ask":a,instruction:q,originConversationId:g.conversationId,destinationAgentId:s},e="resume"===a?(0,i.validateResumeDraft)(q,u):(0,i.validateDraft)(d);if(x(e),Object.keys(e).length>0)return void(e.destination?G.current?.focus():e.instruction?F.current?.focus():H.current?.focus());let f="resume"===a?"resume":"ask",h=a=>I?(0,i.pinRequestBody)(f,q,g.conversationId,u,a):(0,i.exchangeRequestBody)(d,{agentId:c.agent.id,sessionRef:c.ref},a),j=JSON.stringify(h(""));D.current&&D.current.payload===j||(D.current={payload:j,key:crypto.randomUUID()}),C.current=!0,B(!0),z("");try{let a=I?`/api/bots/${encodeURIComponent(c.agent.id)}/sessions/${encodeURIComponent(c.ref)}/pins`:"/api/exchanges",b=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h(D.current.key))}),d=await b.json().catch(()=>null);if(!b.ok){let a="string"==typeof d?.error?.code?d.error.code:null;"idempotency_conflict"===a&&(D.current=null),z((0,i.submitErrorMessage)(a,"string"==typeof d?.error?.message?d.error.message:null));return}let e=I?d?.turn?.exchange_id:d?.exchange?.id;l("string"==typeof e?e:null)}catch{z((0,i.submitErrorMessage)(null,"Botmancers could not be reached. Your draft is kept; try again."))}finally{C.current=!1,B(!1)}},L=J.find(a=>a.id===s)?.name,M="ask"===a,N="resume"===a;return(0,b.jsx)("div",{className:"modal-scrim exchange-scrim",onMouseDown:a=>{a.target===a.currentTarget&&k()},onKeyDown:a=>{if("Tab"!==a.key||!E.current)return;let b=Array.from(E.current.querySelectorAll(h.DIALOG_FOCUSABLE)),c=(0,h.wrapFocusTarget)(b,document.activeElement,a.shiftKey);c&&(a.preventDefault(),c.focus())},children:(0,b.jsxs)("div",{ref:E,className:"form-card exchange-dialog",role:"dialog","aria-modal":"true","aria-labelledby":m,"data-exchange-mode":a,children:[(0,b.jsx)("h2",{id:m,className:"delete-title",children:(0,i.sessionDialogTitle)(a)}),(0,b.jsxs)("section",{className:"exchange-source","aria-label":"Source session",children:[(0,b.jsx)("p",{className:"exchange-source-agent",children:c.agent.name}),(0,b.jsx)("p",{className:"exchange-source-title",children:c.title}),(0,b.jsxs)("p",{className:"exchange-source-meta",children:["Last activity ",(0,f.formatSessionDate)(c.last_activity_at),c.origin.conversation?` \xb7 from ${c.origin.conversation.label}`:""]})]}),(0,b.jsxs)("form",{onSubmit:K,noValidate:!0,className:"exchange-form",children:[M||N?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("label",{htmlFor:o,children:"Hand off to"}),(0,b.jsxs)("select",{ref:G,id:o,className:"exchange-select",value:s,"aria-invalid":!!w.destination||void 0,"aria-describedby":w.destination?`${o}-error`:void 0,disabled:A,onChange:a=>{t(a.target.value),x(a=>({...a,destination:void 0}))},children:[(0,b.jsx)("option",{value:"",children:"Choose an agent"}),J.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]}),w.destination?(0,b.jsx)("p",{id:`${o}-error`,className:"exchange-field-error",children:w.destination}):null]}),(0,b.jsx)("label",{htmlFor:n,children:M?"Question":N?"Instruction":"Objective"}),(0,b.jsx)("textarea",{ref:F,id:n,rows:4,maxLength:i.INSTRUCTION_LIMIT,value:q,readOnly:A,"aria-invalid":!!w.instruction||void 0,"aria-describedby":`${n}-hint${w.instruction?` ${n}-error`:""}`,onChange:a=>{r(a.target.value),x(a=>({...a,instruction:void 0}))}}),w.instruction?(0,b.jsx)("p",{id:`${n}-error`,className:"exchange-field-error",children:w.instruction}):null,(0,b.jsx)("p",{id:`${n}-hint`,className:"exchange-hint",children:M?`${c.agent.name} answers from this exact session, read-only. The answer arrives in ${g.label}.`:N?`${c.agent.name} resumes work in this exact session and may edit its workspace. The turn never moves to another session. Progress shows in ${g.label}.`:`${L??"The agent you choose"} receives an extracted handoff (objective, decisions, constraints, references, open questions) and starts a new session of its own. ${c.agent.name}’s session is not shared and is not changed. Progress shows in ${g.label}.`}),N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("label",{className:"exchange-approval",htmlFor:p,children:[(0,b.jsx)("input",{ref:H,id:p,type:"checkbox",checked:u,disabled:A,"aria-invalid":!!w.approval||void 0,"aria-describedby":w.approval?`${p}-error`:void 0,onChange:a=>{v(a.target.checked),x(a=>({...a,approval:void 0}))}})," ","I approve edits by ",c.agent.name," in this session"]}),w.approval?(0,b.jsx)("p",{id:`${p}-error`,className:"exchange-field-error",children:w.approval}):null]}):null,y?(0,b.jsx)("p",{className:"exchange-server-error",role:"alert",children:y}):null,(0,b.jsx)("p",{className:"exchange-sending",role:"status",children:A?"Sending…":""}),(0,b.jsxs)("div",{className:"form-actions",children:[(0,b.jsx)("button",{type:"button",className:"cancel-btn",onClick:k,children:"Cancel"}),(0,b.jsx)("button",{type:"submit",className:"create-btn",disabled:A,"aria-disabled":A,children:y?"Try again":"Send"})]})]})]})})}var k=a.i(23464);function l(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`owner-share-${crypto.randomUUID()}`:`owner-share-${Date.now()}-${Math.random().toString(36).slice(2)}`}function m({row:a,shares:e,policy:f,onChanged:g}){let h=(0,d.useId)(),[i,j]=(0,d.useState)(!1),[l,p]=(0,d.useState)(!1),q=e?(0,k.sessionShares)(e,a.ref):[],r=q.filter(k.shareIsLive),s=q.filter(a=>!(0,k.shareIsLive)(a)),t="loading"===f,u="loading"===f?null:f,v=t?null:(0,k.shareCreateAvailability)(a,u),w=l?s:s.slice(0,3*!r.length);return(0,b.jsxs)("section",{className:"session-shares","aria-labelledby":h,"data-session-shares":a.ref,children:[(0,b.jsxs)("div",{className:"session-shares-head",children:[(0,b.jsx)("h3",{id:h,className:"session-shares-title",children:"Slack share"}),v?.available&&!i?(0,b.jsx)("button",{type:"button",className:"session-action","data-share-action":"create",onClick:()=>j(!0),children:"Share to Slack"}):null]}),t?(0,b.jsx)("p",{className:"session-share-note session-share-loading",role:"status",children:"Checking the share policy…"}):null,v&&!v.available?(0,b.jsxs)("p",{className:"session-share-unavailable",children:[v.reason," ",v.configHref?(0,b.jsx)(c.default,{className:"session-link",href:v.configHref,children:"Open Config"}):null]}):null,i&&u?(0,b.jsx)(o,{row:a,policy:u,onCancel:()=>j(!1),onCreated:()=>{j(!1),g()}}):null,null===e?(0,b.jsx)("p",{className:"session-share-note",role:"status",children:"Loading shares…"}):null,null===e||0!==q.length||i?null:(0,b.jsx)("p",{className:"session-share-note",children:"Not shared."}),r.length+w.length>0?(0,b.jsx)("ul",{className:"session-share-list","aria-label":`Slack shares of ${a.title}`,children:[...r,...w].map(a=>(0,b.jsx)(n,{share:a,onChanged:g},a.share_ref))}):null,s.length>w.length?(0,b.jsxs)("button",{type:"button",className:"pin-word",onClick:()=>p(!0),children:["Show ",s.length-w.length," ended share",s.length-w.length==1?"":"s"]}):null]})}function n({share:a,onChanged:c}){let[e,f]=(0,d.useState)(!1),[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(""),[l,m]=(0,d.useState)(!1),o=(0,k.shareIsLive)(a),p=async()=>{try{await navigator.clipboard.writeText(a.share_ref),m(!0)}catch{j("Copy failed. Select the reference instead.")}},q=async()=>{h(!0),j("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),d=await b.json().catch(()=>null);b.ok?(f(!1),c()):j("string"==typeof d?.error?.message?d.error.message:"The share could not be revoked.")}catch{j("The share could not be revoked.")}finally{h(!1)}};return(0,b.jsxs)("li",{className:`session-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"session-share-head",children:[(0,b.jsx)("span",{className:`manage-tag session-share-status is-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("span",{className:"session-share-audience",children:(0,k.audienceLabel)(a.audience)})]}),(0,b.jsxs)("dl",{className:"manage-meta session-share-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Expiry"}),(0,b.jsx)("dd",{children:(0,k.expiryLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Questions"}),(0,b.jsx)("dd",{children:(0,k.turnsLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{className:"session-share-ref",children:a.share_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsxs)("dd",{children:[(0,k.createdByLabel)(a)," · read-only Ask"]})]})]}),(0,b.jsx)("p",{className:"session-share-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("div",{className:"session-actions",role:"group","aria-label":"Share actions",children:[(0,b.jsx)("button",{type:"button",className:"pin-word","data-share-action":"copy",onClick:()=>{p()},children:l?"Copied":"Copy reference"}),o&&!e?(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"revoke",onClick:()=>f(!0),children:"Revoke"}):null]}),e?(0,b.jsxs)("div",{className:"session-share-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"button",className:"session-action session-share-revoke","data-share-action":"confirm-revoke",disabled:g,onClick:()=>{q()},children:g?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",disabled:g,onClick:()=>f(!1),children:"Keep it"})]})]}):null,i?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:i}):null]})}function o({row:a,policy:c,onCancel:e,onCreated:f}){let g={channel:(0,d.useId)(),duration:(0,d.useId)(),turns:(0,d.useId)()},[h,i]=(0,d.useState)(0),[j,m]=(0,d.useState)(c.limits.ttl_seconds.default),[n,p]=(0,d.useState)(String(c.limits.max_turns.default)),[q]=(0,d.useState)(l),[r,s]=(0,d.useState)(!1),[t,u]=(0,d.useState)(""),v=Number(n),w=Number.isInteger(v)&&v>=c.limits.max_turns.min&&v<=c.limits.max_turns.max,x=async b=>{if(b.preventDefault(),w){s(!0),u("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a.agent.id)}/sessions/${encodeURIComponent(a.ref)}/shares`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify((0,k.shareCreateBody)(c.audiences[h],j,v,q))}),d=await b.json().catch(()=>null);b.ok?f():u("string"==typeof d?.error?.message?d.error.message:"The share could not be created.")}catch{u("The share could not be created.")}finally{s(!1)}}};return(0,b.jsxs)("form",{className:"session-share-form",onSubmit:a=>{x(a)},"aria-label":`Share ${a.title} to Slack`,children:[(0,b.jsxs)("p",{className:"session-share-note",children:["Shares ",(0,b.jsx)("strong",{children:a.title})," (",a.agent.name,") as a read-only Ask: Slack replies in the share’s thread ask exactly this session."]}),(0,b.jsx)("label",{htmlFor:g.channel,children:"Slack channel"}),(0,b.jsx)("select",{id:g.channel,value:h,onChange:a=>i(Number(a.target.value)),disabled:r,children:c.audiences.map((a,c)=>(0,b.jsx)("option",{value:c,children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}),(0,b.jsx)("label",{htmlFor:g.duration,children:"Expires after"}),(0,b.jsx)("select",{id:g.duration,value:j,onChange:a=>m(Number(a.target.value)),disabled:r,children:k.SHARE_DURATIONS.map(a=>(0,b.jsx)("option",{value:a.seconds,children:a.label},a.seconds))}),(0,b.jsx)("label",{htmlFor:g.turns,children:"Questions allowed"}),(0,b.jsx)("input",{id:g.turns,type:"number",inputMode:"numeric",min:c.limits.max_turns.min,max:c.limits.max_turns.max,value:n,onChange:a=>p(a.target.value),disabled:r,"aria-invalid":!w}),w?null:(0,b.jsxs)("p",{className:"delete-error",children:["Questions allowed must be a whole number from ",c.limits.max_turns.min," to ",c.limits.max_turns.max,"."]}),t?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:t}):null,(0,b.jsxs)("div",{className:"session-actions",children:[(0,b.jsx)("button",{type:"submit",className:"session-action","data-share-action":"submit",disabled:r||!w,children:r?"Sharing…":"Create share"}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:e,disabled:r,children:"Cancel"})]})]})}function p(a,b,c,d,e){let f=new URLSearchParams({status:b}),g=c.trim();return g&&f.set("q",g),d&&f.set("workspace",d),e&&f.set("cursor",e),`/api/bots/${encodeURIComponent(a)}/sessions?${f.toString()}`}function q({agentId:a,agentName:h,agentProvider:k,agents:l,origin:m,onExchangeStarted:n}){let o=(0,e.useRouter)(),t=(0,e.useSearchParams)().get("session"),[u,v]=(0,d.useState)("all"),[w,x]=(0,d.useState)(null),[y,z]=(0,d.useState)(null),[A,B]=(0,d.useState)(!1),[C,D]=(0,d.useState)(""),[E,F]=(0,d.useState)(""),[G,H]=(0,d.useState)(0),[I,J]=(0,d.useState)(""),[K,L]=(0,d.useState)(""),[M,N]=(0,d.useState)([]),[O,P]=(0,d.useState)(null),[Q,R]=(0,d.useState)(!1),[S,T]=(0,d.useState)(""),[U,V]=(0,d.useState)(null),[W,X]=(0,d.useState)(null),[Y,Z]=(0,d.useState)(null),[$,_]=(0,d.useState)(null),[aa,ab]=(0,d.useState)("loading"),[ac,ad]=(0,d.useState)(0),ae=(0,d.useRef)(0),af=(0,d.useRef)(""),ag=(0,d.useRef)(""),ah=(0,d.useRef)(null),ai=(0,d.useRef)(null),aj=(0,d.useRef)(null),ak=(0,d.useRef)(!1),al=(0,d.useRef)(null),am=k&&(0,g.agentLabel)(k)||void 0;(0,d.useEffect)(()=>{ae.current+=1;let b=ae.current,c=`${a}
|
|
2
2
|
${u}`,d=ag.current!==c;ag.current=c;let e=250*(I!==af.current);af.current=I;let f=!1,g=setTimeout(()=>{fetch(p(a,u,I,K,null),{cache:"no-store"}).then(async c=>{let e=await c.json().catch(()=>null);if(f||ae.current!==b)return;if(!c.ok||!Array.isArray(e?.sessions))return void F("string"==typeof e?.error?e.error:"Could not load sessions.");let g=e.sessions;x(g),z(e?.sync&&"object"==typeof e.sync?e.sync:null),P("string"==typeof e?.next_cursor?e.next_cursor:null),T(`${a}
|
|
3
3
|
${u}
|
|
4
4
|
${I.trim()}
|
|
5
|
-
${K}`),F("");let h=g.map(a=>a.context.workspace).filter(a=>!!a);N(a=>[...new Set([...d?[]:a,...h])])}).catch(()=>{f||ae.current!==b||F("Could not load sessions.")})},e);return()=>{f=!0,clearTimeout(g)}},[a,u,I,K,G]),(0,d.useEffect)(()=>{if(!t||null===w)return;if(w.some(a=>a.ref===t)){al.current!==t&&(al.current=t,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(t)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==u||I.trim()||K)return;let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/sessions/${encodeURIComponent(t)}`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);if(b||!a.ok||!c?.session)return;let d=c.session;x(a=>!a||a.some(a=>a.ref===d.ref)?a:[d,...a])}).catch(()=>{}),()=>{b=!0}},[t,w,a,u,I,K])
|
|
5
|
+
${K}`),F("");let h=g.map(a=>a.context.workspace).filter(a=>!!a);N(a=>[...new Set([...d?[]:a,...h])])}).catch(()=>{f||ae.current!==b||F("Could not load sessions.")})},e);return()=>{f=!0,clearTimeout(g)}},[a,u,I,K,G]),(0,d.useEffect)(()=>{if(!t||null===w)return;if(w.some(a=>a.ref===t)){al.current!==t&&(al.current=t,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(t)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==u||I.trim()||K)return;let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/sessions/${encodeURIComponent(t)}`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);if(b||!a.ok||!c?.session)return;let d=c.session;x(a=>!a||a.some(a=>a.ref===d.ref)?a:[d,...a])}).catch(()=>{}),()=>{b=!0}},[t,w,a,u,I,K]);let an=w?t&&w.some(a=>a.ref===t)?t:null:U;an!==U&&V(an),(0,d.useEffect)(()=>{!w||!t||w.some(a=>a.ref===t)||("all"!==u||I.trim()||K)&&o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},[w,t,u,I,K,a,o]),(0,d.useEffect)(()=>{if(!U){let a=ai.current;if(!a||ak.current)return;ai.current=null,a.isConnected&&a.focus();return}ak.current&&(ak.current=!1,aj.current?.focus())},[U]);let ao=`${a}
|
|
6
6
|
${u}
|
|
7
7
|
${I.trim()}
|
|
8
|
-
${K}`,ao=null!==O&&S===an,ap=(0,d.useCallback)(async()=>{if(Q||!w||!O||S!==an)return;R(!0);let b=ae.current;try{let c=await fetch(p(a,u,I,K,O),{cache:"no-store"}),d=await c.json().catch(()=>null);if(ae.current!==b)return;if(!c.ok||!Array.isArray(d?.sessions))return void F("Could not load more sessions.");let e=d.sessions,f=new Set(w.map(a=>a.ref));x([...w,...e.filter(a=>!f.has(a.ref))]),P("string"==typeof d?.next_cursor?d.next_cursor:null),F("");let g=e.map(a=>a.context.workspace).filter(a=>!!a);g.length&&N(a=>[...new Set([...a,...g])])}catch{ae.current===b&&F("Could not load more sessions.")}finally{R(!1)}},[a,u,I,K,Q,w,O,an,S]),aq=(0,d.useCallback)(async()=>{if(!A){B(!0),D("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a)}/sessions/sync`,{method:"POST"}),c=await b.json().catch(()=>null);if(409===b.status)D("A sync is already running.");else if(b.ok){let a=Array.isArray(c?.imported)?c.imported.length:0,b=Array.isArray(c?.updated)?c.updated.length:0;D(`Synced: ${a} imported, ${b} updated.`)}else D("Could not sync sessions.")}catch{D("Could not sync sessions.")}finally{B(!1),H(a=>a+1)}}},[a,A]);(0,d.useEffect)(()=>{let b=!1,c=encodeURIComponent(a);return fetch(`/api/bots/${c}/share-policy`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||ab(a?.policy??null)}).catch(()=>{b||ab(null)}),fetch(`/api/shares?agent_id=${c}&limit=100`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||_(Array.isArray(a?.shares)?a.shares:[])}).catch(()=>{b||_([])}),()=>{b=!0}},[a,ac]),(0,d.useEffect)(()=>{let a=setInterval(()=>ad(a=>a+1),15e3);return()=>clearInterval(a)},[]),(0,d.useEffect)(()=>{if(W||!ah.current)return;let a=ah.current;ah.current=null,a.isConnected&&a.focus()},[W]);let ar=(a=u)=>{x(null),F(""),v(a),H(a=>a+1)},as=""!==I.trim()||""!==K,at=w?.find(a=>a.ref===U)??null,au=(b,c)=>{ai.current=c,ak.current=!0,o.replace(`/agents/${encodeURIComponent(a)}/sessions?session=${encodeURIComponent(b.ref)}`,{scroll:!1})},av=()=>{ah.current=W?.returnTo??null,X(null)};return(0,b.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,b.jsxs)("header",{className:"agent-sessions-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,b.jsxs)("h2",{children:["Review ",h,"’s work"]}),(0,b.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,b.jsxs)("div",{className:"agent-sessions-sync",children:[(0,b.jsxs)("span",{children:["Last synced ",(0,f.formatSyncRelativeTime)(y?.synced_at??null)]}),(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{aq()},disabled:A,children:A?"Refreshing…":"Refresh"})]})]}),(0,b.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,b.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:f.SESSION_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":u===a.value,onClick:()=>{u!==a.value&&ar(a.value)},children:a.label},a.value))}),(0,b.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:I,onChange:a=>J(a.target.value)}),(0,b.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:K,onChange:a=>L(a.target.value),children:[(0,b.jsx)("option",{value:"",children:"All workspaces"}),(0,f.workspaceOptions)(M).map(a=>(0,b.jsx)("option",{value:a.value,title:a.value,children:a.label},a.value))]}),(0,b.jsx)("span",{className:"manage-count","aria-live":"polite",children:w?`${w.length} shown`:""})]}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:C}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,b.jsxs)(b.Fragment,{children:[Y.text," ",Y.id?(0,b.jsx)(c.default,{className:"session-link",href:(0,i.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,b.jsxs)("div",{className:`sessions-review${at?" has-detail":""}`,inert:!!W,children:[(0,b.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,b.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),E?(0,b.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,b.jsx)("p",{className:"delete-error",children:E}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ar(),children:"Retry"})]}):null,w||E?null:(0,b.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),w?(0,b.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${h}`,children:[0===w.length?(0,b.jsx)("li",{className:"delete-copy sessions-state",children:as?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.noMatchingSessionsCopy)(I,K||null)}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{J(""),L("")},children:"Clear search"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.emptySessionsCopy)(u,h,y,am)}),"all"===u&&y?.last_error_code?(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{aq()},disabled:A,children:A?"Retrying…":"Retry"}):null,"all"===u&&!y?.last_error_code&&(y?.out_of_scope_count??0)>0?(0,b.jsx)(c.default,{className:"session-link",href:`/agents/${encodeURIComponent(a)}/config`,children:"Widen the scope in Config"}):null]})}):null,w.map(a=>(0,b.jsx)(r,{row:a,selected:U===a.ref,onSelect:au},a.ref))]}):null,w&&w.length>0&&ao?(0,b.jsx)("div",{className:"sessions-more",children:(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ap()},disabled:Q,children:Q?"Loading…":"Load more"})}):null]}),(0,b.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:at?(0,b.jsx)(s,{row:at,agentId:a,headingRef:aj,origin:m,agents:l,shares:$,sharePolicy:aa,onClose:()=>{ak.current=!1,o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},onAction:(a,b)=>{Z(null),X({mode:a,row:at,returnTo:b})},onSharesChanged:()=>ad(a=>a+1)},at.ref):(0,b.jsxs)("div",{className:"sessions-detail-empty",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{children:"Select a session"}),(0,b.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&m?(0,b.jsx)(j,{mode:W.mode,session:W.row,agents:l,origin:m,onClose:av,onStarted:a=>{Z({id:a,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${m.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${m.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${m.label}.`}),av(),n?.(a)}}):null]})}function r({row:a,selected:c,onSelect:d}){let e=(0,i.sessionRowActions)(a).filter(a=>a.availability.available).length,g=(0,f.workspaceFolderName)(a.context.workspace),h=(0,f.sessionOriginChips)(a),j=(0,f.sessionStateTags)(a);return(0,b.jsx)("li",{className:`session-scan-row is-${a.status}${c?" is-selected":""}`,"data-session-ref":a.ref,children:(0,b.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":c?"true":void 0,onClick:b=>d(a,b.currentTarget),children:[(0,b.jsxs)("span",{className:"session-scan-title-line",children:[(0,b.jsx)("strong",{className:"session-title",children:a.title}),(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)})]}),(0,b.jsxs)("span",{className:"session-scan-context",children:[(0,b.jsx)("span",{className:"session-activity",children:(0,f.formatSessionDate)(a.last_activity_at)}),g?(0,b.jsx)("span",{className:"session-workspace",title:a.context.workspace??void 0,children:g}):null]}),h.length||j.length?(0,b.jsxs)("span",{className:"session-scan-chips",children:[h.map(a=>(0,b.jsx)("span",{className:"session-origin-chip",children:a},a)),j.map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}):null,(0,b.jsx)("span",{className:`session-attention${e?" is-actionable":""}`,children:e?`${e} action${1===e?"":"s"} available`:"Review details"})]})})}function s({row:a,agentId:e,headingRef:g,origin:h,agents:j,shares:k,sharePolicy:l,onClose:n,onAction:o,onSharesChanged:p}){let q,[r,t]=(0,d.useState)(null),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(null),[B,C]=(0,d.useState)(""),[D,E]=(0,d.useState)(!1),F=`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(a.ref)}`,G=(0,i.sessionRowActions)(a),H=G.filter(a=>a.availability.available),I=G.filter(a=>!a.availability.available),J=a.origin.conversation,K=(q=a.origin.conversation)?q.thread_agent_id?`/agents/${encodeURIComponent(q.thread_agent_id)}/conversations`:"group"===q.kind?`/threads/${encodeURIComponent(q.id)}`:null:null,L=(0,f.workRequestLabel)(a),M=(0,f.sessionUsageLine)(a.usage);(0,d.useEffect)(()=>{let a=!1;return fetch(F,{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);a||(b.ok&&Array.isArray(c?.session?.attempts)?(t(c.session.attempts),w({totals:c.session.usage,samples:Array.isArray(c.session.usage_samples)?c.session.usage_samples:[]})):y("Could not load session details."))}).catch(()=>{a||y("Could not load session details.")}),()=>{a=!0}},[F]);let N=(0,d.useCallback)(async()=>{if(null===z)try{let a=await fetch(`${F}?debug=external_session_id`,{cache:"no-store"}),b=await a.json().catch(()=>null),c=b?.debug?.external_session_id;a.ok&&"string"==typeof c?A(c):C("Not available.")}catch{C("Not available.")}},[F,z]),O=async()=>{if(z)try{await navigator.clipboard.writeText(z),E(!0)}catch{E(!1)}};return(0,b.jsxs)("article",{className:"session-detail","data-session-detail":a.ref,children:[(0,b.jsxs)("div",{className:"session-detail-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{ref:g,tabIndex:-1,children:a.title})]}),(0,b.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:n,children:"Back to session list"})]}),(0,b.jsxs)("div",{className:"session-detail-tags",children:[(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)}),(0,f.sessionStateTags)(a).map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}),(0,b.jsxs)("dl",{className:"session-detail-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Last activity"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.last_activity_at)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Started"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.created_at)})]}),null!==a.ended_at?(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Ended"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.ended_at)})]}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Runtime"}),(0,b.jsx)("dd",{children:(0,f.runtimeLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reported usage"}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${M.quality}`,"aria-hidden":"true",children:M.text}),(0,b.jsx)("span",{className:"session-sr",children:M.label}),M.partial?(0,b.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),a.context.workspace?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Workspace"}),(0,b.jsx)("dd",{children:a.context.workspace})]}):null,(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsx)("dd",{children:K&&J?(0,b.jsx)(c.default,{className:"session-link",href:K,children:J.label}):J?.label??"Not recorded"})]}),L?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Work request"}),(0,b.jsx)("dd",{children:L})]}):null]}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${a.ref}`,children:[(0,b.jsx)("h4",{id:`actions-${a.ref}`,children:"Actions"}),h&&H.length?(0,b.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${a.title}`,children:H.map(a=>(0,b.jsx)("button",{type:"button",className:"session-action","data-session-action":a.action,"aria-haspopup":"dialog",onClick:b=>o((0,i.sessionDialogMode)(a.action),b.currentTarget),children:a.label},a.action))}):null,!h&&H.length?(0,b.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,I.length?(0,b.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${a.title}`,children:I.map(a=>(0,b.jsxs)("li",{children:[(0,b.jsxs)("strong",{children:[a.label,":"]})," ",a.availability.available?"":a.availability.reason]},a.action))}):null]}),(0,b.jsx)("section",{className:"session-detail-section",children:(0,b.jsx)(m,{row:a,shares:k,policy:l,onChanged:p})}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${a.ref}`,children:[(0,b.jsx)("h4",{id:`runs-${a.ref}`,children:"Runs and usage"}),x?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:x}):null,r||x?null:(0,b.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),r?(0,b.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===r.length?(0,b.jsx)("li",{children:"No recorded runs."}):null,r.map(a=>(0,b.jsxs)("li",{children:[(0,f.formatSessionDate)(a.started_at)," · ",(0,f.attemptLabel)(a)]},`${a.request_id}-${a.attempt_number}`))]}):null,v?(0,b.jsx)(u,{totals:v.totals,samples:v.samples}):null]}),(0,b.jsxs)("details",{className:"session-debug session-detail-section",onToggle:a=>{a.currentTarget.open&&N()},children:[(0,b.jsx)("summary",{children:"Local debug: provider session ID"}),(0,b.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),B?(0,b.jsx)("p",{className:"delete-error",children:B}):null,z?(0,b.jsxs)("div",{className:"session-debug-value",children:[(0,b.jsx)("code",{children:z}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O()},children:D?"Copied":"Copy"})]}):null]})]})}let t=["input_tokens","output_tokens","cost_usd"];function u({totals:a,samples:c}){let e=(0,d.useId)();return(0,b.jsxs)("section",{className:"session-usage-detail","aria-labelledby":e,children:[(0,b.jsx)("h5",{id:e,className:"session-usage-head",children:"Reported usage"}),(0,b.jsx)("dl",{className:"session-usage-totals",children:t.map(c=>{let d=(0,f.usageMetricView)(c,a?.[c],!0);return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:d.name}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${d.quality}`,"aria-hidden":"true",children:d.text}),(0,b.jsxs)("span",{className:"session-sr",children:[d.label,"."]}),(0,b.jsx)("span",{className:`session-usage-coverage is-${d.quality}`,children:d.coverage})]})]},c)})}),0===c.length?(0,b.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,b.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:c.map((a,c)=>{let d=(0,f.usageSampleValues)(a);return(0,b.jsxs)("li",{children:[(0,b.jsxs)("span",{className:"session-usage-run",children:[(0,f.formatSessionDate)(a.observed_at)," · ",(0,f.usageSampleLabel)(a,c)]}),(0,b.jsxs)("span",{className:"session-usage-values",children:[(0,b.jsxs)("span",{className:null===a.input_tokens?"is-unavailable":void 0,children:["In ",d.input]}),(0,b.jsxs)("span",{className:null===a.output_tokens?"is-unavailable":void 0,children:["Out ",d.output]}),(0,b.jsxs)("span",{className:null===a.cost_usd?"is-unavailable":void 0,children:["Cost ",d.cost]})]})]},`${a.observed_at}-${c}`)})})]})}var v=a.i(15722);a.s(["default",0,function(){let{id:a,agents:d,overview:e,loading:f,error:g,notFound:h}=(0,v.useAgentOverview)();return f?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):h?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):g||!e?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Sessions unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,b.jsx)(q,{agentId:a,agentName:e.agent.name,agentProvider:e.runtime.agent,agents:d.map(a=>({id:a.id,name:a.name})),origin:e.conversation?{conversationId:e.conversation.id,label:`${e.agent.name} conversation`}:null})}],26847)}];
|
|
8
|
+
${K}`,ap=null!==O&&S===ao,aq=(0,d.useCallback)(async()=>{if(Q||!w||!O||S!==ao)return;R(!0);let b=ae.current;try{let c=await fetch(p(a,u,I,K,O),{cache:"no-store"}),d=await c.json().catch(()=>null);if(ae.current!==b)return;if(!c.ok||!Array.isArray(d?.sessions))return void F("Could not load more sessions.");let e=d.sessions,f=new Set(w.map(a=>a.ref));x([...w,...e.filter(a=>!f.has(a.ref))]),P("string"==typeof d?.next_cursor?d.next_cursor:null),F("");let g=e.map(a=>a.context.workspace).filter(a=>!!a);g.length&&N(a=>[...new Set([...a,...g])])}catch{ae.current===b&&F("Could not load more sessions.")}finally{R(!1)}},[a,u,I,K,Q,w,O,ao,S]),ar=(0,d.useCallback)(async()=>{if(!A){B(!0),D("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a)}/sessions/sync`,{method:"POST"}),c=await b.json().catch(()=>null);if(409===b.status)D("A sync is already running.");else if(b.ok){let a=Array.isArray(c?.imported)?c.imported.length:0,b=Array.isArray(c?.updated)?c.updated.length:0;D(`Synced: ${a} imported, ${b} updated.`)}else D("Could not sync sessions.")}catch{D("Could not sync sessions.")}finally{B(!1),H(a=>a+1)}}},[a,A]);(0,d.useEffect)(()=>{let b=!1,c=encodeURIComponent(a);return fetch(`/api/bots/${c}/share-policy`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||ab(a?.policy??null)}).catch(()=>{b||ab(null)}),fetch(`/api/shares?agent_id=${c}&limit=100`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||_(Array.isArray(a?.shares)?a.shares:[])}).catch(()=>{b||_([])}),()=>{b=!0}},[a,ac]),(0,d.useEffect)(()=>{let a=setInterval(()=>ad(a=>a+1),15e3);return()=>clearInterval(a)},[]),(0,d.useEffect)(()=>{if(W||!ah.current)return;let a=ah.current;ah.current=null,a.isConnected&&a.focus()},[W]);let as=(a=u)=>{x(null),F(""),v(a),H(a=>a+1)},at=""!==I.trim()||""!==K,au=w?.find(a=>a.ref===U)??null,av=(b,c)=>{ai.current=c,ak.current=!0,o.replace(`/agents/${encodeURIComponent(a)}/sessions?session=${encodeURIComponent(b.ref)}`,{scroll:!1})},aw=()=>{ah.current=W?.returnTo??null,X(null)};return(0,b.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,b.jsxs)("header",{className:"agent-sessions-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,b.jsxs)("h2",{children:["Review ",h,"’s work"]}),(0,b.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,b.jsxs)("div",{className:"agent-sessions-sync",children:[(0,b.jsxs)("span",{children:["Last synced ",(0,f.formatSyncRelativeTime)(y?.synced_at??null)]}),(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ar()},disabled:A,children:A?"Refreshing…":"Refresh"})]})]}),(0,b.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,b.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:f.SESSION_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":u===a.value,onClick:()=>{u!==a.value&&as(a.value)},children:a.label},a.value))}),(0,b.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:I,onChange:a=>J(a.target.value)}),(0,b.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:K,onChange:a=>L(a.target.value),children:[(0,b.jsx)("option",{value:"",children:"All workspaces"}),(0,f.workspaceOptions)(M).map(a=>(0,b.jsx)("option",{value:a.value,title:a.value,children:a.label},a.value))]}),(0,b.jsx)("span",{className:"manage-count","aria-live":"polite",children:w?`${w.length} shown`:""})]}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:C}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,b.jsxs)(b.Fragment,{children:[Y.text," ",Y.id?(0,b.jsx)(c.default,{className:"session-link",href:(0,i.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,b.jsxs)("div",{className:`sessions-review${au?" has-detail":""}`,inert:!!W,children:[(0,b.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,b.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),E?(0,b.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,b.jsx)("p",{className:"delete-error",children:E}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>as(),children:"Retry"})]}):null,w||E?null:(0,b.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),w?(0,b.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${h}`,children:[0===w.length?(0,b.jsx)("li",{className:"delete-copy sessions-state",children:at?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.noMatchingSessionsCopy)(I,K||null)}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{J(""),L("")},children:"Clear search"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.emptySessionsCopy)(u,h,y,am)}),"all"===u&&y?.last_error_code?(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{ar()},disabled:A,children:A?"Retrying…":"Retry"}):null,"all"===u&&!y?.last_error_code&&(y?.out_of_scope_count??0)>0?(0,b.jsx)(c.default,{className:"session-link",href:`/agents/${encodeURIComponent(a)}/config`,children:"Widen the scope in Config"}):null]})}):null,w.map(a=>(0,b.jsx)(r,{row:a,selected:U===a.ref,onSelect:av},a.ref))]}):null,w&&w.length>0&&ap?(0,b.jsx)("div",{className:"sessions-more",children:(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{aq()},disabled:Q,children:Q?"Loading…":"Load more"})}):null]}),(0,b.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:au?(0,b.jsx)(s,{row:au,agentId:a,headingRef:aj,origin:m,agents:l,shares:$,sharePolicy:aa,onClose:()=>{ak.current=!1,o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},onAction:(a,b)=>{Z(null),X({mode:a,row:au,returnTo:b})},onSharesChanged:()=>ad(a=>a+1)},au.ref):(0,b.jsxs)("div",{className:"sessions-detail-empty",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{children:"Select a session"}),(0,b.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&m?(0,b.jsx)(j,{mode:W.mode,session:W.row,agents:l,origin:m,onClose:aw,onStarted:a=>{Z({id:a,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${m.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${m.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${m.label}.`}),aw(),n?.(a)}}):null]})}function r({row:a,selected:c,onSelect:d}){let e=(0,i.sessionRowActions)(a).filter(a=>a.availability.available).length,g=(0,f.workspaceFolderName)(a.context.workspace),h=(0,f.sessionOriginChips)(a),j=(0,f.sessionStateTags)(a);return(0,b.jsx)("li",{className:`session-scan-row is-${a.status}${c?" is-selected":""}`,"data-session-ref":a.ref,children:(0,b.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":c?"true":void 0,onClick:b=>d(a,b.currentTarget),children:[(0,b.jsxs)("span",{className:"session-scan-title-line",children:[(0,b.jsx)("strong",{className:"session-title",children:a.title}),(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)})]}),(0,b.jsxs)("span",{className:"session-scan-context",children:[(0,b.jsx)("span",{className:"session-activity",children:(0,f.formatSessionDate)(a.last_activity_at)}),g?(0,b.jsx)("span",{className:"session-workspace",title:a.context.workspace??void 0,children:g}):null]}),h.length||j.length?(0,b.jsxs)("span",{className:"session-scan-chips",children:[h.map(a=>(0,b.jsx)("span",{className:"session-origin-chip",children:a},a)),j.map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}):null,(0,b.jsx)("span",{className:`session-attention${e?" is-actionable":""}`,children:e?`${e} action${1===e?"":"s"} available`:"Review details"})]})})}function s({row:a,agentId:e,headingRef:g,origin:h,agents:j,shares:k,sharePolicy:l,onClose:n,onAction:o,onSharesChanged:p}){let q,[r,t]=(0,d.useState)(null),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(null),[B,C]=(0,d.useState)(""),[D,E]=(0,d.useState)(!1),F=`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(a.ref)}`,G=(0,i.sessionRowActions)(a),H=G.filter(a=>a.availability.available),I=G.filter(a=>!a.availability.available),J=a.origin.conversation,K=(q=a.origin.conversation)?(0,f.sessionConversationHref)(q):null,L=(0,f.workRequestLabel)(a),M=(0,f.sessionUsageLine)(a.usage);(0,d.useEffect)(()=>{let a=!1;return fetch(F,{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);a||(b.ok&&Array.isArray(c?.session?.attempts)?(t(c.session.attempts),w({totals:c.session.usage,samples:Array.isArray(c.session.usage_samples)?c.session.usage_samples:[]})):y("Could not load session details."))}).catch(()=>{a||y("Could not load session details.")}),()=>{a=!0}},[F]);let N=(0,d.useCallback)(async()=>{if(null===z)try{let a=await fetch(`${F}?debug=external_session_id`,{cache:"no-store"}),b=await a.json().catch(()=>null),c=b?.debug?.external_session_id;a.ok&&"string"==typeof c?A(c):C("Not available.")}catch{C("Not available.")}},[F,z]),O=async()=>{if(z)try{await navigator.clipboard.writeText(z),E(!0)}catch{E(!1)}};return(0,b.jsxs)("article",{className:"session-detail","data-session-detail":a.ref,children:[(0,b.jsxs)("div",{className:"session-detail-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{ref:g,tabIndex:-1,children:a.title})]}),(0,b.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:n,children:"Back to session list"})]}),(0,b.jsxs)("div",{className:"session-detail-tags",children:[(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)}),(0,f.sessionStateTags)(a).map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}),(0,b.jsxs)("dl",{className:"session-detail-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Last activity"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.last_activity_at)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Started"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.created_at)})]}),null!==a.ended_at?(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Ended"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.ended_at)})]}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Runtime"}),(0,b.jsx)("dd",{children:(0,f.runtimeLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reported usage"}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${M.quality}`,"aria-hidden":"true",children:M.text}),(0,b.jsx)("span",{className:"session-sr",children:M.label}),M.partial?(0,b.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),a.context.workspace?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Workspace"}),(0,b.jsx)("dd",{children:a.context.workspace})]}):null,(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsx)("dd",{children:K&&J?(0,b.jsx)(c.default,{className:"session-link",href:K,children:J.label}):J?.label??"Not recorded"})]}),L?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Work request"}),(0,b.jsx)("dd",{children:L})]}):null]}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${a.ref}`,children:[(0,b.jsx)("h4",{id:`actions-${a.ref}`,children:"Actions"}),h&&H.length?(0,b.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${a.title}`,children:H.map(a=>(0,b.jsx)("button",{type:"button",className:"session-action","data-session-action":a.action,"aria-haspopup":"dialog",onClick:b=>o((0,i.sessionDialogMode)(a.action),b.currentTarget),children:a.label},a.action))}):null,!h&&H.length?(0,b.jsx)("p",{className:"session-unavailable",children:"Open this agent’s Conversation before starting an action."}):null,I.length?(0,b.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${a.title}`,children:I.map(a=>(0,b.jsxs)("li",{children:[(0,b.jsxs)("strong",{children:[a.label,":"]})," ",a.availability.available?"":a.availability.reason]},a.action))}):null]}),(0,b.jsx)("section",{className:"session-detail-section",children:(0,b.jsx)(m,{row:a,shares:k,policy:l,onChanged:p})}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${a.ref}`,children:[(0,b.jsx)("h4",{id:`runs-${a.ref}`,children:"Runs and usage"}),x?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:x}):null,r||x?null:(0,b.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),r?(0,b.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===r.length?(0,b.jsx)("li",{children:"No recorded runs."}):null,r.map(a=>(0,b.jsxs)("li",{children:[(0,f.formatSessionDate)(a.started_at)," · ",(0,f.attemptLabel)(a)]},`${a.request_id}-${a.attempt_number}`))]}):null,v?(0,b.jsx)(u,{totals:v.totals,samples:v.samples}):null]}),(0,b.jsxs)("details",{className:"session-debug session-detail-section",onToggle:a=>{a.currentTarget.open&&N()},children:[(0,b.jsx)("summary",{children:"Local debug: provider session ID"}),(0,b.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),B?(0,b.jsx)("p",{className:"delete-error",children:B}):null,z?(0,b.jsxs)("div",{className:"session-debug-value",children:[(0,b.jsx)("code",{children:z}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O()},children:D?"Copied":"Copy"})]}):null]})]})}let t=["input_tokens","output_tokens","cost_usd"];function u({totals:a,samples:c}){let e=(0,d.useId)();return(0,b.jsxs)("section",{className:"session-usage-detail","aria-labelledby":e,children:[(0,b.jsx)("h5",{id:e,className:"session-usage-head",children:"Reported usage"}),(0,b.jsx)("dl",{className:"session-usage-totals",children:t.map(c=>{let d=(0,f.usageMetricView)(c,a?.[c],!0);return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:d.name}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${d.quality}`,"aria-hidden":"true",children:d.text}),(0,b.jsxs)("span",{className:"session-sr",children:[d.label,"."]}),(0,b.jsx)("span",{className:`session-usage-coverage is-${d.quality}`,children:d.coverage})]})]},c)})}),0===c.length?(0,b.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,b.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:c.map((a,c)=>{let d=(0,f.usageSampleValues)(a);return(0,b.jsxs)("li",{children:[(0,b.jsxs)("span",{className:"session-usage-run",children:[(0,f.formatSessionDate)(a.observed_at)," · ",(0,f.usageSampleLabel)(a,c)]}),(0,b.jsxs)("span",{className:"session-usage-values",children:[(0,b.jsxs)("span",{className:null===a.input_tokens?"is-unavailable":void 0,children:["In ",d.input]}),(0,b.jsxs)("span",{className:null===a.output_tokens?"is-unavailable":void 0,children:["Out ",d.output]}),(0,b.jsxs)("span",{className:null===a.cost_usd?"is-unavailable":void 0,children:["Cost ",d.cost]})]})]},`${a.observed_at}-${c}`)})})]})}var v=a.i(15722);a.s(["default",0,function(){let{id:a,agents:d,overview:e,loading:f,error:g,notFound:h}=(0,v.useAgentOverview)();return f?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):h?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an agent"})]}):g||!e?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Sessions unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this agent. Refresh to try again."})]}):(0,b.jsx)(q,{agentId:a,agentName:e.agent.name,agentProvider:e.runtime.agent,agents:d.map(a=>({id:a.id,name:a.name})),origin:e.conversation?{conversationId:e.conversation.id,label:`${e.agent.name} conversation`}:null})}],26847)}];
|
|
9
9
|
|
|
10
10
|
//# sourceMappingURL=app_agents_%5Bid%5D_sessions_page_tsx_0tfup-2._.js.map
|