@godmode-team/godmode 1.8.1 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,21 +1,45 @@
1
- # GodMode — Personal AI Operating System
1
+ # GodMode
2
2
 
3
- GodMode turns your self-hosted AI into a personal operating system. It runs on top of [OpenClaw](https://github.com/nichochar/openclaw) and gives your AI deep context about you — your schedule, tasks, memory, skills, and preferences — so it actually works *for* you instead of starting from scratch every conversation.
3
+ ### Personal AI OS for Entrepreneurs The Ultimate OpenClaw Setup
4
4
 
5
- **Open source. Self-hosted. Yours.**
5
+ [![npm version](https://img.shields.io/npm/v/@godmode-team/godmode)](https://www.npmjs.com/package/@godmode-team/godmode)
6
+ [![License: FSL-1.1-MIT](https://img.shields.io/badge/License-FSL--1.1--MIT-blue.svg)](./LICENSE)
7
+ [![GitHub release](https://img.shields.io/github/v/release/GodMode-Team/godmode)](https://github.com/GodMode-Team/godmode/releases)
8
+ [![Node.js 22+](https://img.shields.io/badge/node-22%2B-brightgreen)](https://nodejs.org)
9
+
10
+ Experience frictionless flow states in your daily workspace — your AI Ally wielding 5-layer memory, commanding your agent army across every tool in your stack. Self-evolving. Sovereign. Modular.
11
+
12
+ **We distilled the best open source has to offer.**
13
+
14
+ ---
15
+
16
+ We obsessively studied every memory framework, every agent architecture, every open source AI tool worth knowing. We read the papers. We tested the repos. We broke things in production so you don't have to.
17
+
18
+ Then we wired the best of it all into one setup — and made it run in minutes.
19
+
20
+ ---
6
21
 
7
22
  ## What You Get
8
23
 
9
- - **Persistent Memory** — Your AI remembers conversations, facts, and preferences across sessions (powered by [Honcho](https://honcho.dev))
10
- - **Daily Operating Rhythm** Morning briefs with calendar + intelligence, task tracking, evening capture
11
- - **Agent Queue** — Delegate tasks to background agents that run overnight and deliver results to your inbox
12
- - **Second Brain** — Markdown-based knowledge management with semantic search across your Obsidian vault
13
- - **Skill Cards** — Teach your AI new capabilities by dropping markdown files into a folder
14
- - **Persona System** — Customizable agent personas for different task types (research, writing, code, etc.)
15
- - **Safety Gates** — Built-in guardrails that prevent prompt injection, credential leaks, and runaway loops
16
- - **Self-Healing** — Automatic health monitoring and recovery for all subsystems
24
+ **🧠 5-Layer Persistent Memory**
25
+ Your AI Ally never forgets a name, a decision, a preference. Conversational memory, working memory, long-term vault, episodic daily notes, and self-healing rules — all working together. Context that compounds, not decays.
17
26
 
18
- ## Quick Start
27
+ **🤖 Agent Army at Your Command**
28
+ 35 specialist agents — researchers, writers, engineers, analysts — orchestrated by your AI Ally. You give the order. They ship the work. You review the output.
29
+
30
+ **🔌 Every Tool in Your Stack, Connected**
31
+ Email, calendar, Slack, GitHub, CRM, task managers — all wired into one workspace. No more tab-switching. No more copy-pasting between apps. One conversation runs your entire operation.
32
+
33
+ **🔄 Self-Evolving**
34
+ Every mistake becomes a rule. Every rule becomes an automated check. The system literally rewrites itself to get smarter — without you lifting a finger.
35
+
36
+ **🧩 Completely Modular**
37
+ Don't like a piece? Swap it. Want to add a skill? Drop it in. GodMode is a framework, not a prison. Every component is replaceable.
38
+
39
+ **🔐 Sovereign**
40
+ Your machine. Your data. Your rules. Nothing leaves your stack unless you say so. No vendor lock-in. No mysterious cloud calls. You own every byte.
41
+
42
+ ## Skip Months. Start in Minutes.
19
43
 
20
44
  ### Prerequisites
21
45
 
@@ -239,4 +263,6 @@ Without it, GodMode still works but conversations won't persist across sessions.
239
263
 
240
264
  [FSL-1.1-MIT](./LICENSE) — Free to use, modify, and self-host. Cannot be used to build a competing commercial product. Each version converts to MIT after 2 years.
241
265
 
266
+ *Built by entrepreneurs, for entrepreneurs. We use GodMode to build GodMode.*
267
+
242
268
  Made with conviction by the [GodMode Team](https://lifeongodmode.com).
@@ -1,4 +1,4 @@
1
- import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";import{a as h,w}from"./index-Covj4w7X.js";import{a as k}from"./views-settings-nvLQdpIB.js";import{f as _}from"./ctrl-settings-niym-WgY.js";import"./markdown-i_gIkIP3.js";var S=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(e,t,i,d)=>{for(var o=d>1?void 0:d?x(t,i):t,s=e.length-1,p;s>=0;s--)(p=e[s])&&(o=(d?p(t,i,o):p(o))||o);return d&&o&&S(t,i,o),o};function b(e){if(!e)return"";try{return _(new Date(e).getTime())}catch{return""}}function C(e){return a`<div class="brain-md-body">${$(k(e))}</div>`}const v={ready:"brain-dot--ready",degraded:"brain-dot--degraded",offline:"brain-dot--offline"},P={"vault-capture":"📝","identity-update":"👤","calendar-enrichment":"📅","thought-captured":"💭",search:"🔍","file-modified":"📄"},F={honcho:"🟣",vault:"📓",session:"💬",screenpipe:"📺"};function m(e){return!e||e==="personal"?n:a`<span class="brain-scope-badge brain-scope-badge--shared" title="Shared to ${e}">\u{2197}\u{FE0F} ${e}</span>`}let r=class extends y{constructor(){super(...arguments),this.identityCard=null,this.loading=!1,this.error=null,this.pulse=null,this.activity=null,this.memoryBank=null,this.fileTree=null,this.vaultHealth=null,this.recentPeople=null,this.peopleTotalCount=0,this.peopleSearch="",this.screenpipeStatus=null,this.ingestionStatus=null,this.mcpStatusData=null,this.integrationsData=null,this.searchQuery="",this.searchResults=null,this.searching=!1,this.expandedPulseSystem=null,this.browsingFolder=null,this.folderEntries=null,this.folderName=null,this._unsubs=[],this._searchTimer=null,this._activityTimer=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._unsubs.push(h.on("refresh-requested",e=>{(e.target==="memory"||e.target==="brain"||e.target==="second-brain")&&this._loadAll()})),this._loadAll(),this._activityTimer=setInterval(()=>{this._refreshActivity()},6e4)}disconnectedCallback(){for(const e of this._unsubs)e();this._unsubs=[],this._searchTimer&&clearTimeout(this._searchTimer),this._activityTimer&&clearInterval(this._activityTimer),super.disconnectedCallback()}async _loadAll(){if(!(!this.ctx.gateway||!this.ctx.connected)){this.loading=!0,this.error=null;try{const e=this.ctx.gateway,[t,i,d]=await Promise.all([e.request("secondBrain.memoryPulse",{}),e.request("secondBrain.identityCard",{}).catch(()=>null),e.request("secondBrain.recentPeople",{limit:8}).catch(()=>null)]);this.pulse=t,this.identityCard=i,this.recentPeople=d?.people??null,this.peopleTotalCount=d?.total??0,this.loading=!1,Promise.all([e.request("secondBrain.activity",{limit:20}).catch(()=>null),e.request("secondBrain.memoryBank",{}).catch(()=>null),e.request("secondBrain.fileTree",{depth:3}).catch(()=>({tree:[]})),e.request("secondBrain.vaultHealth",{}).catch(()=>null)]).then(([o,s,p,u])=>{this.activity=o,this.memoryBank=s,this.fileTree=p?.tree??[],this.vaultHealth=u}),Promise.all([e.request("ingestion.screenpipeStatus",{}).catch(()=>null),e.request("ingestion.status",{}).catch(()=>null),e.request("secondBrain.mcpStatus",{}).catch(()=>null),e.request("integrations.status",{}).catch(()=>null)]).then(([o,s,p,u])=>{this.screenpipeStatus=o,this.ingestionStatus=s,this.mcpStatusData=p,this.integrationsData=u})}catch(e){console.error("[Brain] Load failed:",e),this.error=e instanceof Error?e.message:"Failed to load",this.loading=!1}}}async _refreshActivity(){if(!(!this.ctx.gateway||!this.ctx.connected))try{const e=await this.ctx.gateway.request("secondBrain.activity",{limit:20});this.activity=e}catch{}}async _doSearch(e){if(!this.ctx.gateway||!this.ctx.connected||!e.trim()){this.searchResults=null,this.searching=!1;return}this.searching=!0;try{const t=await this.ctx.gateway.request("secondBrain.search",{query:e,limit:30});this.searchQuery===e&&(this.searchResults=t.results??[])}catch(t){console.error("[Brain] Search failed:",t)}finally{this.searching=!1}}_onSearchInput(e){const t=e.target.value;if(this.searchQuery=t,this._searchTimer&&clearTimeout(this._searchTimer),!t.trim()){this.searchResults=null;return}this._searchTimer=setTimeout(()=>{this._doSearch(t)},300)}async _openFile(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{const t=await this.ctx.gateway.request("secondBrain.memoryBankEntry",{path:e});if(t?.content){const i=e.endsWith(".html")||e.endsWith(".htm");this.ctx.openSidebar({content:t.content,mimeType:i?"text/html":"text/markdown",filePath:e,title:t.name||e.split("/").pop()||"File"})}}catch(t){console.error("[Brain] Open file failed:",t),this.ctx.addToast("Failed to open file","error")}}async _browseFolder(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{const t=await this.ctx.gateway.request("secondBrain.memoryBank",{folder:e});this.browsingFolder=t.folder,this.folderName=t.folderName,this.folderEntries=t.entries}catch(t){console.error("[Brain] Browse folder failed:",t)}}_exitFolder(){this.browsingFolder=null,this.folderEntries=null,this.folderName=null}_chatNavigate(e){h.emit("chat-navigate",{sessionKey:"new",tab:"chat",message:e})}async _toggleScreenpipe(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{await this.ctx.gateway.request("ingestion.screenpipeToggle",{enabled:e}),this.screenpipeStatus&&(this.screenpipeStatus={...this.screenpipeStatus,enabled:e}),this.ctx.addToast(e?"Ambient memory enabled":"Ambient memory paused","success")}catch{this.ctx.addToast("Failed to update Screenpipe config","error")}}async _runPipeline(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{await this.ctx.gateway.request("ingestion.runPipeline",{pipeline:e}),this.ctx.addToast(`Pipeline "${e}" triggered`,"success")}catch{this.ctx.addToast(`Failed to run pipeline "${e}"`,"error")}}render(){return this.loading&&!this.pulse&&!this.identityCard?a`
1
+ import{d as m,b as a,A as n,o as $,g,r as o,t as f}from"./lit-core-CTInmNPB.js";import{a as h,b as w}from"./index-DzcGsUUC.js";import{a as S}from"./views-settings-TQFJxfo9.js";import{f as _}from"./ctrl-settings-nG144v_G.js";import"./markdown-i_gIkIP3.js";var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(e,t,i,d)=>{for(var c=d>1?void 0:d?x(t,i):t,s=e.length-1,p;s>=0;s--)(p=e[s])&&(c=(d?p(t,i,c):p(c))||c);return d&&c&&k(t,i,c),c};function u(e){if(!e)return"";try{return _(new Date(e).getTime())}catch{return""}}function C(e){return a`<div class="brain-md-body">${$(S(e))}</div>`}const v={ready:"brain-dot--ready",degraded:"brain-dot--degraded",offline:"brain-dot--offline"},T={"vault-capture":"📝","identity-update":"👤","calendar-enrichment":"📅","thought-captured":"💭",search:"🔍","file-modified":"📄"},F={honcho:"🟣",vault:"📓",session:"💬",screenpipe:"📺"};function y(e){return!e||e==="personal"?n:a`<span class="brain-scope-badge brain-scope-badge--shared" title="Shared to ${e}">\u{2197}\u{FE0F} ${e}</span>`}let r=class extends m{constructor(){super(...arguments),this.identityCard=null,this.loading=!1,this.error=null,this.pulse=null,this.activity=null,this.memoryBank=null,this.fileTree=null,this.vaultHealth=null,this.recentPeople=null,this.peopleTotalCount=0,this.peopleSearch="",this.screenpipeStatus=null,this.screenpipeSetupBusy=!1,this.ingestionStatus=null,this.mcpStatusData=null,this.integrationsData=null,this.searchQuery="",this.searchResults=null,this.searching=!1,this.expandedPulseSystem=null,this.browsingFolder=null,this.folderEntries=null,this.folderName=null,this._unsubs=[],this._searchTimer=null,this._activityTimer=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._unsubs.push(h.on("refresh-requested",e=>{(e.target==="memory"||e.target==="brain"||e.target==="second-brain")&&this._loadAll()})),this._loadAll(),this._activityTimer=setInterval(()=>{this._refreshActivity()},6e4)}disconnectedCallback(){for(const e of this._unsubs)e();this._unsubs=[],this._searchTimer&&clearTimeout(this._searchTimer),this._activityTimer&&clearInterval(this._activityTimer),super.disconnectedCallback()}async _loadAll(){if(!(!this.ctx.gateway||!this.ctx.connected)){this.loading=!0,this.error=null;try{const e=this.ctx.gateway,[t,i,d]=await Promise.all([e.request("secondBrain.memoryPulse",{}),e.request("secondBrain.identityCard",{}).catch(()=>null),e.request("secondBrain.recentPeople",{limit:8}).catch(()=>null)]);this.pulse=t,this.identityCard=i,this.recentPeople=d?.people??null,this.peopleTotalCount=d?.total??0,this.loading=!1,Promise.all([e.request("secondBrain.activity",{limit:20}).catch(()=>null),e.request("secondBrain.memoryBank",{}).catch(()=>null),e.request("secondBrain.fileTree",{depth:3}).catch(()=>({tree:[]})),e.request("secondBrain.vaultHealth",{}).catch(()=>null)]).then(([c,s,p,b])=>{this.activity=c,this.memoryBank=s,this.fileTree=p?.tree??[],this.vaultHealth=b}),Promise.all([e.request("ingestion.screenpipeStatus",{}).catch(()=>null),e.request("ingestion.status",{}).catch(()=>null),e.request("secondBrain.mcpStatus",{}).catch(()=>null),e.request("integrations.status",{}).catch(()=>null)]).then(([c,s,p,b])=>{this.screenpipeStatus=c,this.ingestionStatus=s,this.mcpStatusData=p,this.integrationsData=b})}catch(e){console.error("[Brain] Load failed:",e),this.error=e instanceof Error?e.message:"Failed to load",this.loading=!1}}}async _refreshActivity(){if(!(!this.ctx.gateway||!this.ctx.connected))try{const e=await this.ctx.gateway.request("secondBrain.activity",{limit:20});this.activity=e}catch{}}async _doSearch(e){if(!this.ctx.gateway||!this.ctx.connected||!e.trim()){this.searchResults=null,this.searching=!1;return}this.searching=!0;try{const t=await this.ctx.gateway.request("secondBrain.search",{query:e,limit:30});this.searchQuery===e&&(this.searchResults=t.results??[])}catch(t){console.error("[Brain] Search failed:",t)}finally{this.searching=!1}}_onSearchInput(e){const t=e.target.value;if(this.searchQuery=t,this._searchTimer&&clearTimeout(this._searchTimer),!t.trim()){this.searchResults=null;return}this._searchTimer=setTimeout(()=>{this._doSearch(t)},300)}async _openFile(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{const t=await this.ctx.gateway.request("secondBrain.memoryBankEntry",{path:e});if(t?.content){const i=e.endsWith(".html")||e.endsWith(".htm");this.ctx.openSidebar({content:t.content,mimeType:i?"text/html":"text/markdown",filePath:e,title:t.name||e.split("/").pop()||"File"})}}catch(t){console.error("[Brain] Open file failed:",t),this.ctx.addToast("Failed to open file","error")}}async _browseFolder(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{const t=await this.ctx.gateway.request("secondBrain.memoryBank",{folder:e});this.browsingFolder=t.folder,this.folderName=t.folderName,this.folderEntries=t.entries}catch(t){console.error("[Brain] Browse folder failed:",t)}}_exitFolder(){this.browsingFolder=null,this.folderEntries=null,this.folderName=null}_chatNavigate(e){h.emit("chat-navigate",{sessionKey:"new",tab:"chat",message:e})}async _toggleScreenpipe(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{await this.ctx.gateway.request("ingestion.screenpipeToggle",{enabled:e}),this.screenpipeStatus&&(this.screenpipeStatus={...this.screenpipeStatus,enabled:e}),this.ctx.addToast(e?"Ambient memory enabled":"Ambient memory paused","success")}catch{this.ctx.addToast("Failed to update Screenpipe config","error")}}async _setupScreenpipe(){if(!(!this.ctx.gateway||!this.ctx.connected)){this.screenpipeSetupBusy=!0;try{const e=await this.ctx.gateway.request("ingestion.screenpipeSetup",{},3e5);if(e.success){this.ctx.addToast("Ambient Memory enabled!","success");const t=await this.ctx.gateway.request("ingestion.screenpipeStatus",{});this.screenpipeStatus=t}else this.ctx.addToast(e.error??"Setup failed","error")}catch{this.ctx.addToast("Screenpipe setup failed","error")}finally{this.screenpipeSetupBusy=!1}}}async _startScreenpipe(){if(!(!this.ctx.gateway||!this.ctx.connected)){this.screenpipeSetupBusy=!0;try{const e=await this.ctx.gateway.request("ingestion.screenpipeStart",{},3e4);if(e.success){this.ctx.addToast("Screenpipe started","success");const t=await this.ctx.gateway.request("ingestion.screenpipeStatus",{});this.screenpipeStatus=t}else this.ctx.addToast(e.error??"Failed to start","error")}catch{this.ctx.addToast("Failed to start Screenpipe","error")}finally{this.screenpipeSetupBusy=!1}}}async _runPipeline(e){if(!(!this.ctx.gateway||!this.ctx.connected))try{await this.ctx.gateway.request("ingestion.runPipeline",{pipeline:e}),this.ctx.addToast(`Pipeline "${e}" triggered`,"success")}catch{this.ctx.addToast(`Failed to run pipeline "${e}"`,"error")}}render(){return this.loading&&!this.pulse&&!this.identityCard?a`
2
2
  <div class="brain-loading" role="status" aria-label="Loading your Second Brain">
3
3
  <div class="brain-skeleton brain-skeleton--card"></div>
4
4
  <div class="brain-skeleton-row">
@@ -98,7 +98,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
98
98
  <div class="brain-id-footer">
99
99
  <button class="brain-id-correct-btn" aria-label="Edit your identity card via chat" @click=${()=>this._chatNavigate("I want to correct something in my identity card. Here's what needs updating:")}>Edit via Chat</button>
100
100
  ${e.lastUpdated?a`
101
- <span class="brain-id-updated">Updated ${b(e.lastUpdated)}</span>
101
+ <span class="brain-id-updated">Updated ${u(e.lastUpdated)}</span>
102
102
  `:n}
103
103
  </div>
104
104
  </div>
@@ -116,7 +116,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
116
116
  <input
117
117
  class="brain-search-input"
118
118
  type="text"
119
- placeholder="Search your memory \u2014 Honcho, Vault, Sessions, Screenpipe..."
119
+ placeholder="Search your memory \u2014 conversations, vault, sessions, screen recall..."
120
120
  .value=${this.searchQuery}
121
121
  @input=${e=>this._onSearchInput(e)}
122
122
  aria-label="Search your Second Brain"
@@ -140,7 +140,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
140
140
  <div class="brain-entry-name">
141
141
  ${e.name}
142
142
  ${e.source?a`<span class="brain-source-tag">${F[e.source]??""} ${e.source}</span>`:n}
143
- ${e.scope?m(e.scope):n}
143
+ ${e.scope?y(e.scope):n}
144
144
  </div>
145
145
  ${e.matchContext??e.excerpt?a`<div class="brain-entry-excerpt">${e.matchContext??e.excerpt}</div>`:n}
146
146
  </div>
@@ -173,13 +173,13 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
173
173
  <div class="brain-activity-feed" role="log" aria-label="Memory activity feed">
174
174
  ${this.activity.events.slice(0,12).map(e=>a`
175
175
  <div class="brain-activity-item">
176
- <span class="brain-activity-icon">${P[e.type]??"•"}</span>
176
+ <span class="brain-activity-icon">${T[e.type]??"•"}</span>
177
177
  <div class="brain-activity-body">
178
178
  <span class="brain-activity-title">${e.title}</span>
179
179
  ${e.detail?a`<span class="brain-activity-detail">${e.detail}</span>`:n}
180
180
  </div>
181
- ${e.scope?m(e.scope):n}
182
- <span class="brain-activity-time">${b(e.timestamp)}</span>
181
+ ${e.scope?y(e.scope):n}
182
+ <span class="brain-activity-time">${u(e.timestamp)}</span>
183
183
  </div>
184
184
  `)}
185
185
  </div>
@@ -189,7 +189,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
189
189
  <div class="brain-empty-hint">People you interact with will appear here. Connect your calendar to start.</div>
190
190
  <button class="brain-action-btn brain-action-btn--sm" aria-label="Connect your calendar to track people" @click=${()=>this._chatNavigate("Help me connect my calendar so my Brain can track the people I interact with.")}>Connect Calendar \u{2192}</button>
191
191
  </div>
192
- `;const o=this.peopleSearch?i.filter(s=>s.name.toLowerCase().includes(this.peopleSearch.toLowerCase())):i;return a`
192
+ `;const c=this.peopleSearch?i.filter(s=>s.name.toLowerCase().includes(this.peopleSearch.toLowerCase())):i;return a`
193
193
  <h2 class="brain-panel-title">People
194
194
  <span class="brain-section-count">${d} tracked</span>
195
195
  </h2>
@@ -202,7 +202,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
202
202
  aria-label="Filter people"
203
203
  />
204
204
  <div class="brain-people-list" role="list" aria-label="People in your brain">
205
- ${o.slice(0,8).map(s=>a`
205
+ ${c.slice(0,8).map(s=>a`
206
206
  <div class="brain-person-card" role="listitem" tabindex="0" aria-label="Open profile for ${s.name}" @click=${()=>this._openFile(s.path)} @keydown=${p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),this._openFile(s.path))}}>
207
207
  <div class="brain-person-icon" aria-hidden="true">\u{1F464}</div>
208
208
  <div class="brain-person-body">
@@ -210,7 +210,7 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
210
210
  ${s.role?a`<div class="brain-person-role">${s.role}</div>`:n}
211
211
  ${!s.role&&s.excerpt?a`<div class="brain-person-excerpt">${s.excerpt}</div>`:n}
212
212
  </div>
213
- ${s.updatedAt?a`<div class="brain-person-time">${b(s.updatedAt)}</div>`:n}
213
+ ${s.updatedAt?a`<div class="brain-person-time">${u(s.updatedAt)}</div>`:n}
214
214
  </div>
215
215
  `)}
216
216
  </div>
@@ -235,11 +235,11 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
235
235
  ${d.length>0?a`
236
236
  <div class="brain-knowledge-recent" role="list" aria-label="Recently modified files">
237
237
  <h3 class="brain-subsection-title">Recent</h3>
238
- ${d.slice(0,5).map(o=>a`
239
- <div class="brain-entry brain-entry--compact" role="listitem" tabindex="0" aria-label="Open ${o.name}" @click=${()=>this._openFile(o.path)} @keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._openFile(o.path))}}>
238
+ ${d.slice(0,5).map(c=>a`
239
+ <div class="brain-entry brain-entry--compact" role="listitem" tabindex="0" aria-label="Open ${c.name}" @click=${()=>this._openFile(c.path)} @keydown=${s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._openFile(c.path))}}>
240
240
  <span class="brain-entry-icon" aria-hidden="true">\u{1F4C4}</span>
241
- <span class="brain-entry-name">${o.name}</span>
242
- <span class="brain-entry-meta">${b(o.updatedAt)}</span>
241
+ <span class="brain-entry-name">${c.name}</span>
242
+ <span class="brain-entry-meta">${u(c.updatedAt)}</span>
243
243
  </div>
244
244
  `)}
245
245
  </div>
@@ -356,29 +356,41 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
356
356
  `}
357
357
  </div>
358
358
  </div>
359
- `}_renderScreenpipeRow(){const e=this.screenpipeStatus;return a`
359
+ `}_renderScreenpipeRow(){const e=this.screenpipeStatus,t=this.screenpipeSetupBusy,i=e?e.installed?e.available?e.enabled?"Active":"Paused":"Installed — not running":"Not installed":"Loading...",d=e?.available?e.enabled?"brain-dot--ready":"brain-dot--degraded":e?.installed?"brain-dot--degraded":"brain-dot--offline";return a`
360
360
  <div class="brain-engine-section">
361
361
  <h3 class="brain-subsection-title">Screenpipe (Ambient Memory)</h3>
362
362
  <div class="brain-screenpipe-row">
363
- <span class="brain-dot ${e?.available?e.enabled?"brain-dot--ready":"brain-dot--degraded":"brain-dot--offline"}"></span>
364
- <span>${e?e.available?e.enabled?"Active":"Paused":"Not installed":"Loading..."}</span>
363
+ <span class="brain-dot ${d}"></span>
364
+ <span>${i}${e?.version?` (${e.version})`:""}</span>
365
365
  ${e?.available?a`
366
- <button class="brain-action-btn brain-action-btn--xs" aria-label="${e.enabled?"Pause ambient memory":"Enable ambient memory"}" @click=${()=>this._toggleScreenpipe(!e.enabled)}>
366
+ <button class="brain-action-btn brain-action-btn--xs"
367
+ aria-label="${e.enabled?"Pause ambient memory":"Enable ambient memory"}"
368
+ @click=${()=>this._toggleScreenpipe(!e.enabled)}>
367
369
  ${e.enabled?"Pause":"Enable"}
368
370
  </button>
369
- `:!e?.available&&e!==null?a`
370
- <button class="brain-action-btn brain-action-btn--xs" @click=${()=>this._chatNavigate("Help me set up Screenpipe for ambient memory capture. Walk me through installation and configuration step by step.")}>Set up</button>
371
+ `:e&&!e.installed?a`
372
+ <button class="brain-action-btn brain-action-btn--xs"
373
+ ?disabled=${t}
374
+ @click=${()=>this._setupScreenpipe()}>
375
+ ${t?"Installing...":"Install & Enable"}
376
+ </button>
377
+ `:e&&e.installed&&!e.available?a`
378
+ <button class="brain-action-btn brain-action-btn--xs"
379
+ ?disabled=${t}
380
+ @click=${()=>this._startScreenpipe()}>
381
+ ${t?"Starting...":"Start"}
382
+ </button>
371
383
  `:n}
372
384
  </div>
373
385
  </div>
374
386
  `}_renderEntry(e){const t=e.isDirectory,i=t?"📁":"📄",d=()=>{t?this._browseFolder(e.path):this._openFile(e.path)};return a`
375
- <div class="brain-entry" role="listitem" tabindex="0" aria-label="${t?"Open folder":"Open file"}: ${e.name}" @click=${d} @keydown=${o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),d())}}>
387
+ <div class="brain-entry" role="listitem" tabindex="0" aria-label="${t?"Open folder":"Open file"}: ${e.name}" @click=${d} @keydown=${c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d())}}>
376
388
  <div class="brain-entry-icon ${t?"brain-entry-icon--folder":""}" aria-hidden="true">${i}</div>
377
389
  <div class="brain-entry-body">
378
390
  <div class="brain-entry-name">${e.name}${t?"/":""}</div>
379
391
  ${e.excerpt?a`<div class="brain-entry-excerpt">${e.excerpt}</div>`:n}
380
392
  </div>
381
- ${e.updatedAt?a`<div class="brain-entry-meta">${b(e.updatedAt)}</div>`:n}
393
+ ${e.updatedAt?a`<div class="brain-entry-meta">${u(e.updatedAt)}</div>`:n}
382
394
  </div>
383
395
  `}_renderFileTree(e,t){return a`
384
396
  <div class="brain-file-tree" role="tree" aria-label="${t===0?"Vault file browser":""}" style="padding-left: ${t*16}px">
@@ -399,4 +411,4 @@ import{d as y,b as a,A as n,o as $,g,r as c,t as f}from"./lit-core-CTInmNPB.js";
399
411
  </button>
400
412
  `)}
401
413
  </div>
402
- `}};l([g({context:w,subscribe:!0})],r.prototype,"ctx",2);l([c()],r.prototype,"identityCard",2);l([c()],r.prototype,"loading",2);l([c()],r.prototype,"error",2);l([c()],r.prototype,"pulse",2);l([c()],r.prototype,"activity",2);l([c()],r.prototype,"memoryBank",2);l([c()],r.prototype,"fileTree",2);l([c()],r.prototype,"vaultHealth",2);l([c()],r.prototype,"recentPeople",2);l([c()],r.prototype,"peopleTotalCount",2);l([c()],r.prototype,"peopleSearch",2);l([c()],r.prototype,"screenpipeStatus",2);l([c()],r.prototype,"ingestionStatus",2);l([c()],r.prototype,"mcpStatusData",2);l([c()],r.prototype,"integrationsData",2);l([c()],r.prototype,"searchQuery",2);l([c()],r.prototype,"searchResults",2);l([c()],r.prototype,"searching",2);l([c()],r.prototype,"expandedPulseSystem",2);l([c()],r.prototype,"browsingFolder",2);l([c()],r.prototype,"folderEntries",2);l([c()],r.prototype,"folderName",2);r=l([f("gm-brain")],r);export{r as GmBrain};
414
+ `}};l([g({context:w,subscribe:!0})],r.prototype,"ctx",2);l([o()],r.prototype,"identityCard",2);l([o()],r.prototype,"loading",2);l([o()],r.prototype,"error",2);l([o()],r.prototype,"pulse",2);l([o()],r.prototype,"activity",2);l([o()],r.prototype,"memoryBank",2);l([o()],r.prototype,"fileTree",2);l([o()],r.prototype,"vaultHealth",2);l([o()],r.prototype,"recentPeople",2);l([o()],r.prototype,"peopleTotalCount",2);l([o()],r.prototype,"peopleSearch",2);l([o()],r.prototype,"screenpipeStatus",2);l([o()],r.prototype,"screenpipeSetupBusy",2);l([o()],r.prototype,"ingestionStatus",2);l([o()],r.prototype,"mcpStatusData",2);l([o()],r.prototype,"integrationsData",2);l([o()],r.prototype,"searchQuery",2);l([o()],r.prototype,"searchResults",2);l([o()],r.prototype,"searching",2);l([o()],r.prototype,"expandedPulseSystem",2);l([o()],r.prototype,"browsingFolder",2);l([o()],r.prototype,"folderEntries",2);l([o()],r.prototype,"folderName",2);r=l([f("gm-brain")],r);export{r as GmBrain};
@@ -1,4 +1,4 @@
1
- import{d as h,b as e,A as p,g as m,r as l,t as v}from"./lit-core-CTInmNPB.js";import{a as u,w as f}from"./index-Covj4w7X.js";import{f as b}from"./ctrl-settings-niym-WgY.js";import"./views-settings-nvLQdpIB.js";import"./markdown-i_gIkIP3.js";var C=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(n,t,o,c)=>{for(var i=c>1?void 0:c?g(t,o):t,s=n.length-1,d;s>=0;s--)(d=n[s])&&(i=(c?d(t,o,i):d(i))||i);return c&&i&&C(t,o,i),i};let a=class extends h{constructor(){super(...arguments),this._sources=[],this._composioConnections=[],this._composioConfigured=!1,this._loading=!0,this._error=null,this._filter="all",this._connectingApp=null,this._unsubs=[]}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._unsubs.push(u.on("refresh-requested",n=>{n.target==="connections"&&this._load()})),this._load()}disconnectedCallback(){for(const n of this._unsubs)n();this._unsubs=[],super.disconnectedCallback()}async _load(){this._loading=!0,this._error=null;const n=this.ctx?.gateway;if(!n||!this.ctx.connected){this._loading=!1,this._error="Not connected to gateway.";return}try{const[t,o]=await Promise.allSettled([n.request("secondBrain.sources",{}),n.request("composio.status",{})]);if(t.status==="fulfilled"&&(this._sources=t.value.sources??[]),o.status==="fulfilled"){const c=o.value;this._composioConfigured=c.configured??!1,this._composioConnections=c.connections??[]}}catch(t){this._error=t instanceof Error?t.message:String(t)}finally{this._loading=!1}}async _connectViaComposio(n){const t=this.ctx?.gateway;if(t){this._connectingApp=n;try{const o=await t.request("composio.connect",{appName:n});o.redirectUrl?window.open(o.redirectUrl,"_blank"):o.error?this.ctx.addToast(`Connection failed: ${o.error}`,"error"):this.ctx.addToast(`Connection initiated for ${n}`,"info")}catch(o){this.ctx.addToast(`Error: ${o instanceof Error?o.message:String(o)}`,"error")}finally{this._connectingApp=null,setTimeout(()=>{this._load()},2e3)}}}_askAllyToConnect(n){u.emit("chat-navigate",{tab:"chat",draft:`Help me set up the ${n} integration`})}render(){if(this._loading)return e`
1
+ import{d as h,b as e,A as p,g as m,r as l,t as v}from"./lit-core-CTInmNPB.js";import{a as u,b}from"./index-DzcGsUUC.js";import{f}from"./ctrl-settings-nG144v_G.js";import"./views-settings-TQFJxfo9.js";import"./markdown-i_gIkIP3.js";var C=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(n,t,o,c)=>{for(var i=c>1?void 0:c?g(t,o):t,s=n.length-1,d;s>=0;s--)(d=n[s])&&(i=(c?d(t,o,i):d(i))||i);return c&&i&&C(t,o,i),i};let a=class extends h{constructor(){super(...arguments),this._sources=[],this._composioConnections=[],this._composioConfigured=!1,this._loading=!0,this._error=null,this._filter="all",this._connectingApp=null,this._unsubs=[]}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._unsubs.push(u.on("refresh-requested",n=>{n.target==="connections"&&this._load()})),this._load()}disconnectedCallback(){for(const n of this._unsubs)n();this._unsubs=[],super.disconnectedCallback()}async _load(){this._loading=!0,this._error=null;const n=this.ctx?.gateway;if(!n||!this.ctx.connected){this._loading=!1,this._error="Not connected to gateway.";return}try{const[t,o]=await Promise.allSettled([n.request("secondBrain.sources",{}),n.request("composio.status",{})]);if(t.status==="fulfilled"&&(this._sources=t.value.sources??[]),o.status==="fulfilled"){const c=o.value;this._composioConfigured=c.configured??!1,this._composioConnections=c.connections??[]}}catch(t){this._error=t instanceof Error?t.message:String(t)}finally{this._loading=!1}}async _connectViaComposio(n){const t=this.ctx?.gateway;if(t){this._connectingApp=n;try{const o=await t.request("composio.connect",{appName:n});o.redirectUrl?window.open(o.redirectUrl,"_blank"):o.error?this.ctx.addToast(`Connection failed: ${o.error}`,"error"):this.ctx.addToast(`Connection initiated for ${n}`,"info")}catch(o){this.ctx.addToast(`Error: ${o instanceof Error?o.message:String(o)}`,"error")}finally{this._connectingApp=null,setTimeout(()=>{this._load()},2e3)}}}_askAllyToConnect(n){u.emit("chat-navigate",{tab:"chat",draft:`Help me set up the ${n} integration`})}render(){if(this._loading)return e`
2
2
  <div class="connections-tab">
3
3
  <div class="connections-loading">
4
4
  <div class="spinner"></div>
@@ -70,7 +70,7 @@ import{d as h,b as e,A as p,g as m,r as l,t as v}from"./lit-core-CTInmNPB.js";im
70
70
  <div class="connection-card__body">
71
71
  <span class="connection-card__desc">${n.description}</span>
72
72
  ${n.stats?e`<span class="connection-card__stats">${n.stats}</span>`:p}
73
- ${n.lastSync?e`<span class="connection-card__sync">Last sync: ${b(new Date(n.lastSync))}</span>`:p}
73
+ ${n.lastSync?e`<span class="connection-card__sync">Last sync: ${f(new Date(n.lastSync))}</span>`:p}
74
74
  </div>
75
75
  ${o?c?e`<div class="connection-card__actions">
76
76
  <span class="connection-card__managed">Managed by Composio</span>
@@ -88,4 +88,4 @@ import{d as h,b as e,A as p,g as m,r as l,t as v}from"./lit-core-CTInmNPB.js";im
88
88
  </div>
89
89
  `}
90
90
  </div>
91
- `}};r([m({context:f,subscribe:!0})],a.prototype,"ctx",2);r([l()],a.prototype,"_sources",2);r([l()],a.prototype,"_composioConnections",2);r([l()],a.prototype,"_composioConfigured",2);r([l()],a.prototype,"_loading",2);r([l()],a.prototype,"_error",2);r([l()],a.prototype,"_filter",2);r([l()],a.prototype,"_connectingApp",2);a=r([v("gm-connections")],a);export{a as GmConnections};
91
+ `}};r([m({context:b,subscribe:!0})],a.prototype,"ctx",2);r([l()],a.prototype,"_sources",2);r([l()],a.prototype,"_composioConnections",2);r([l()],a.prototype,"_composioConfigured",2);r([l()],a.prototype,"_loading",2);r([l()],a.prototype,"_error",2);r([l()],a.prototype,"_filter",2);r([l()],a.prototype,"_connectingApp",2);a=r([v("gm-connections")],a);export{a as GmConnections};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DzcGsUUC.js","./lit-core-CTInmNPB.js","./views-settings-TQFJxfo9.js","./markdown-i_gIkIP3.js","./index-Btlae9Mn.css"])))=>i.map(i=>d[i]);
2
+ const Zn="modulepreload",Jn=function(n,e){return new URL(n,e).href},fn={},Yn=function(e,r,o){let i=Promise.resolve();if(r&&r.length>0){let u=function(f){return Promise.all(f.map(d=>Promise.resolve(d).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};const c=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");i=u(r.map(f=>{if(f=Jn(f,o),f in fn)return;fn[f]=!0;const d=f.endsWith(".css"),g=d?'[rel="stylesheet"]':"";if(o)for(let p=c.length-1;p>=0;p--){const v=c[p];if(v.href===f&&(!d||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${g}`))return;const y=document.createElement("link");if(y.rel=d?"stylesheet":Zn,d||(y.as="script"),y.crossOrigin="",y.href=f,a&&y.setAttribute("nonce",a),document.head.appendChild(y),d)return new Promise((p,v)=>{y.addEventListener("load",p),y.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function t(c){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=c,window.dispatchEvent(l),!l.defaultPrevented)throw c}return i.then(c=>{for(const l of c||[])l.status==="rejected"&&t(l.reason);return e().catch(t)})};async function nr(n,e){if(!(!n.client||!n.connected)&&!n.channelsLoading){n.channelsLoading=!0,n.channelsError=null;try{const r=await n.client.request("channels.status",{probe:e,timeoutMs:8e3});n.channelsSnapshot=r,n.channelsLastSuccess=Date.now()}catch(r){n.channelsError=String(r)}finally{n.channelsLoading=!1}}}async function er(n,e){if(!(!n.client||!n.connected||n.whatsappBusy)){n.whatsappBusy=!0;try{const r=await n.client.request("web.login.start",{force:e,timeoutMs:3e4});n.whatsappLoginMessage=r.message??null,n.whatsappLoginQrDataUrl=r.qrDataUrl??null,n.whatsappLoginConnected=null}catch(r){n.whatsappLoginMessage=String(r),n.whatsappLoginQrDataUrl=null,n.whatsappLoginConnected=null}finally{n.whatsappBusy=!1}}}async function rr(n){if(!(!n.client||!n.connected||n.whatsappBusy)){n.whatsappBusy=!0;try{const e=await n.client.request("web.login.wait",{timeoutMs:12e4});n.whatsappLoginMessage=e.message??null,n.whatsappLoginConnected=e.connected??null,e.connected&&(n.whatsappLoginQrDataUrl=null)}catch(e){n.whatsappLoginMessage=String(e),n.whatsappLoginConnected=null}finally{n.whatsappBusy=!1}}}async function or(n){if(!(!n.client||!n.connected||n.whatsappBusy)){n.whatsappBusy=!0;try{await n.client.request("channels.logout",{channel:"whatsapp"}),n.whatsappLoginMessage="Logged out.",n.whatsappLoginQrDataUrl=null,n.whatsappLoginConnected=null}catch(e){n.whatsappLoginMessage=String(e)}finally{n.whatsappBusy=!1}}}function k(n){return typeof structuredClone=="function"?structuredClone(n):JSON.parse(JSON.stringify(n))}function q(n){return`${JSON.stringify(n,null,2).trimEnd()}
3
+ `}function bn(n,e,r){if(e.length===0)return;let o=n;for(let t=0;t<e.length-1;t+=1){const c=e[t],l=e[t+1];if(typeof c=="number"){if(!Array.isArray(o))return;o[c]==null&&(o[c]=typeof l=="number"?[]:{}),o=o[c]}else{if(typeof o!="object"||o==null)return;const a=o;a[c]==null&&(a[c]=typeof l=="number"?[]:{}),o=a[c]}}const i=e[e.length-1];if(typeof i=="number"){Array.isArray(o)&&(o[i]=r);return}typeof o=="object"&&o!=null&&(o[i]=r)}function Sn(n,e){if(e.length===0)return;let r=n;for(let i=0;i<e.length-1;i+=1){const t=e[i];if(typeof t=="number"){if(!Array.isArray(r))return;r=r[t]}else{if(typeof r!="object"||r==null)return;r=r[t]}if(r==null)return}const o=e[e.length-1];if(typeof o=="number"){Array.isArray(r)&&r.splice(o,1);return}typeof r=="object"&&r!=null&&delete r[o]}async function En(n){if(!(!n.client||!n.connected)){n.configLoading=!0,n.lastError=null;try{const e=await n.client.request("config.get",{});Hn(n,e)}catch(e){n.lastError=String(e)}finally{n.configLoading=!1}}}async function ir(n){if(!(!n.client||!n.connected)&&!n.configSchemaLoading){n.configSchemaLoading=!0;try{const e=await n.client.request("config.schema",{});Xn(n,e)}catch(e){n.lastError=String(e)}finally{n.configSchemaLoading=!1}}}function Xn(n,e){n.configSchema=e.schema??null,n.configUiHints=e.uiHints??{},n.configSchemaVersion=e.version??null}function Hn(n,e){n.configSnapshot=e;const r=typeof e.raw=="string"?e.raw:e.config&&typeof e.config=="object"?q(e.config):n.configRaw;!n.configFormDirty||n.configFormMode==="raw"?n.configRaw=r:n.configForm?n.configRaw=q(n.configForm):n.configRaw=r,n.configValid=typeof e.valid=="boolean"?e.valid:null,n.configIssues=Array.isArray(e.issues)?e.issues:[],n.configFormDirty||(n.configForm=k(e.config??{}),n.configFormOriginal=k(e.config??{}),n.configRawOriginal=r)}async function Vn(n){if(!(!n.client||!n.connected)){n.configSaving=!0,n.lastError=null;try{const e=n.configFormMode==="form"&&n.configForm?q(n.configForm):n.configRaw,r=n.configSnapshot?.hash;if(!r){n.lastError="Config hash missing; reload and retry.";return}await n.client.request("config.set",{raw:e,baseHash:r}),n.configFormDirty=!1,await En(n)}catch(e){n.lastError=String(e)}finally{n.configSaving=!1}}}async function zn(n){if(!(!n.client||!n.connected)){n.configApplying=!0,n.lastError=null;try{const e=n.configFormMode==="form"&&n.configForm?q(n.configForm):n.configRaw,r=n.configSnapshot?.hash;if(!r){n.lastError="Config hash missing; reload and retry.";return}await n.client.request("config.apply",{raw:e,baseHash:r,sessionKey:n.applySessionKey}),n.configFormDirty=!1,await En(n)}catch(e){n.lastError=String(e)}finally{n.configApplying=!1}}}async function tr(n){if(!(!n.client||!n.connected)&&confirm("Update OpenClaw? The gateway will restart and briefly disconnect.")){n.updateRunning=!0,n.lastError=null;try{await n.client.request("godmode.update.run",{})}catch(e){n.connected&&(n.lastError=String(e))}finally{n.updateRunning=!1}}}async function cr(n){if(!(!n.client||!n.connected)&&confirm("Update GodMode plugin? The gateway will restart and briefly disconnect.")){n.pluginUpdateRunning=!0,n.lastError=null;try{await n.client.request("godmode.update.pluginRun",{})}catch(e){n.connected&&(n.lastError=String(e))}finally{n.pluginUpdateRunning=!1}}}function dn(n,e,r){const o=k(n.configForm??n.configSnapshot?.config??{});bn(o,e,r),n.configForm=o,n.configFormDirty=!0,n.configFormMode==="form"&&(n.configRaw=q(o))}function sr(n,e){const r=k(n.configForm??n.configSnapshot?.config??{});Sn(r,e),n.configForm=r,n.configFormDirty=!0,n.configFormMode==="form"&&(n.configRaw=q(r))}async function lr(n,e,r){dn(n,["agents","defaults","model","primary"],e),dn(n,["agents","defaults","model","fallbacks"],r),await Vn(n),await zn(n)}const Wn=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,_=/<\s*\/?\s*final\b[^>]*>/gi,gn=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function Qn(n,e){return n.trimStart()}function ne(n,e){if(!n||!Wn.test(n))return n;let r=n;_.test(r)?(_.lastIndex=0,r=r.replace(_,"")):_.lastIndex=0,gn.lastIndex=0;let o="",i=0,t=!1;for(const c of r.matchAll(gn)){const l=c.index??0,a=c[1]==="/";t?a&&(t=!1):(o+=r.slice(i,l),a||(t=!0)),i=l+c[0].length}return o+=r.slice(i),Qn(o)}function ar(n){return!n&&n!==0?"n/a":new Date(n).toLocaleString()}function ur(n){if(!n&&n!==0)return"n/a";const e=Date.now()-n;if(e<0)return"just now";const r=Math.round(e/1e3);if(r<60)return`${r}s ago`;const o=Math.round(r/60);if(o<60)return`${o}m ago`;const i=Math.round(o/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}function fr(n){if(!n&&n!==0)return"";const e=Date.now()-n;if(e<0)return"now";const r=Math.round(e/1e3);if(r<60)return"now";const o=Math.round(r/60);if(o<60)return`${o}m`;const i=Math.round(o/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function dr(n){if(!n&&n!==0)return"n/a";if(n<1e3)return`${n}ms`;const e=Math.round(n/1e3);if(e<60)return`${e}s`;const r=Math.round(e/60);if(r<60)return`${r}m`;const o=Math.round(r/60);return o<48?`${o}h`:`${Math.round(o/24)}d`}function gr(n){return!n||n.length===0?"none":n.filter(e=>!!(e&&e.trim())).join(", ")}function yr(n,e=120){return n.length<=e?n:`${n.slice(0,Math.max(0,e-1))}…`}function pr(n,e){return n.length<=e?{text:n,truncated:!1,total:n.length}:{text:n.slice(0,Math.max(0,e)),truncated:!0,total:n.length}}function N(n,e){const r=Number(n);return Number.isFinite(r)?r:e}function hr(n){const e=n??new Date,r=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${r}-${o}-${i}`}function mr(n){return ne(n)}async function ee(n){if(!(!n.client||!n.connected)&&!n.agentsLoading){n.agentsLoading=!0,n.agentsError=null;try{const e=await n.client.request("agents.list",{});e&&(n.agentsList=e)}catch(e){n.agentsError=String(e)}finally{n.agentsLoading=!1}}}async function re(n){if(!(!n.client||!n.connected)&&!n.rosterLoading){n.rosterLoading=!0,n.rosterError=null;try{const e=await n.client.request("queue.roster",{});e?.roster&&(n.rosterData=e.roster)}catch(e){n.rosterError=String(e)}finally{n.rosterLoading=!1}}}const wr=Object.freeze(Object.defineProperty({__proto__:null,loadAgents:ee,loadRoster:re},Symbol.toStringTag,{value:"Module"})),An="godmode.device.auth.v1";function nn(n){return n.trim()}function oe(n){if(!Array.isArray(n))return[];const e=new Set;for(const r of n){const o=r.trim();o&&e.add(o)}return[...e].sort()}function en(){try{const n=window.localStorage.getItem(An);if(!n)return null;const e=JSON.parse(n);return!e||e.version!==1||!e.deviceId||typeof e.deviceId!="string"||!e.tokens||typeof e.tokens!="object"?null:e}catch{return null}}function kn(n){try{window.localStorage.setItem(An,JSON.stringify(n))}catch{}}function vr(n){const e=en();if(!e||e.deviceId!==n.deviceId)return null;const r=nn(n.role),o=e.tokens[r];return!o||typeof o.token!="string"?null:o}function ie(n){const e=nn(n.role),r={version:1,deviceId:n.deviceId,tokens:{}},o=en();o&&o.deviceId===n.deviceId&&(r.tokens={...o.tokens});const i={token:n.token,role:e,scopes:oe(n.scopes),updatedAtMs:Date.now()};return r.tokens[e]=i,kn(r),i}function te(n){const e=en();if(!e||e.deviceId!==n.deviceId)return;const r=nn(n.role);if(!e.tokens[r])return;const o={...e,tokens:{...e.tokens}};delete o.tokens[r],kn(o)}const Ln={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:m,n:D,Gx:yn,Gy:pn,a:j,d:Z,h:ce}=Ln,L=32,rn=64,se=(...n)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...n)},h=(n="")=>{const e=new Error(n);throw se(e,h),e},le=n=>typeof n=="bigint",ae=n=>typeof n=="string",ue=n=>n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array",E=(n,e,r="")=>{const o=ue(n),i=n?.length,t=e!==void 0;if(!o||t&&i!==e){const c=r&&`"${r}" `,l=t?` of length ${e}`:"",a=o?`length=${i}`:`type=${typeof n}`;h(c+"expected Uint8Array"+l+", got "+a)}return n},$=n=>new Uint8Array(n),xn=n=>Uint8Array.from(n),Tn=(n,e)=>n.toString(16).padStart(e,"0"),Cn=n=>Array.from(E(n)).map(e=>Tn(e,2)).join(""),S={_0:48,_9:57,A:65,F:70,a:97,f:102},hn=n=>{if(n>=S._0&&n<=S._9)return n-S._0;if(n>=S.A&&n<=S.F)return n-(S.A-10);if(n>=S.a&&n<=S.f)return n-(S.a-10)},qn=n=>{const e="hex invalid";if(!ae(n))return h(e);const r=n.length,o=r/2;if(r%2)return h(e);const i=$(o);for(let t=0,c=0;t<o;t++,c+=2){const l=hn(n.charCodeAt(c)),a=hn(n.charCodeAt(c+1));if(l===void 0||a===void 0)return h(e);i[t]=l*16+a}return i},Fn=()=>globalThis?.crypto,fe=()=>Fn()?.subtle??h("crypto.subtle must be defined, consider polyfill"),I=(...n)=>{const e=$(n.reduce((o,i)=>o+E(i).length,0));let r=0;return n.forEach(o=>{e.set(o,r),r+=o.length}),e},de=(n=L)=>Fn().getRandomValues($(n)),K=BigInt,A=(n,e,r,o="bad number: out of range")=>le(n)&&e<=n&&n<r?n:h(o),s=(n,e=m)=>{const r=n%e;return r>=0n?r:e+r},Mn=n=>s(n,D),ge=(n,e)=>{(n===0n||e<=0n)&&h("no inverse n="+n+" mod="+e);let r=s(n,e),o=e,i=0n,t=1n;for(;r!==0n;){const c=o/r,l=o%r,a=i-t*c;o=r,r=l,i=t,t=a}return o===1n?s(i,e):h("no inverse")},ye=n=>{const e=_n[n];return typeof e!="function"&&h("hashes."+n+" not set"),e},J=n=>n instanceof w?n:h("Point expected"),H=2n**256n;class w{static BASE;static ZERO;X;Y;Z;T;constructor(e,r,o,i){const t=H;this.X=A(e,0n,t),this.Y=A(r,0n,t),this.Z=A(o,1n,t),this.T=A(i,0n,t),Object.freeze(this)}static CURVE(){return Ln}static fromAffine(e){return new w(e.x,e.y,1n,s(e.x*e.y))}static fromBytes(e,r=!1){const o=Z,i=xn(E(e,L)),t=e[31];i[31]=t&-129;const c=Bn(i);A(c,0n,r?H:m);const a=s(c*c),u=s(a-1n),f=s(o*a+1n);let{isValid:d,value:g}=he(u,f);d||h("bad point: y not sqrt");const y=(g&1n)===1n,p=(t&128)!==0;return!r&&g===0n&&p&&h("bad point: x==0, isLastByteOdd"),p!==y&&(g=s(-g)),new w(g,c,1n,s(g*c))}static fromHex(e,r){return w.fromBytes(qn(e),r)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const e=j,r=Z,o=this;if(o.is0())return h("bad point: ZERO");const{X:i,Y:t,Z:c,T:l}=o,a=s(i*i),u=s(t*t),f=s(c*c),d=s(f*f),g=s(a*e),y=s(f*s(g+u)),p=s(d+s(r*s(a*u)));if(y!==p)return h("bad point: equation left != right (1)");const v=s(i*t),T=s(c*l);return v!==T?h("bad point: equation left != right (2)"):this}equals(e){const{X:r,Y:o,Z:i}=this,{X:t,Y:c,Z:l}=J(e),a=s(r*l),u=s(t*i),f=s(o*l),d=s(c*i);return a===u&&f===d}is0(){return this.equals(C)}negate(){return new w(s(-this.X),this.Y,this.Z,s(-this.T))}double(){const{X:e,Y:r,Z:o}=this,i=j,t=s(e*e),c=s(r*r),l=s(2n*s(o*o)),a=s(i*t),u=e+r,f=s(s(u*u)-t-c),d=a+c,g=d-l,y=a-c,p=s(f*g),v=s(d*y),T=s(f*y),R=s(g*d);return new w(p,v,R,T)}add(e){const{X:r,Y:o,Z:i,T:t}=this,{X:c,Y:l,Z:a,T:u}=J(e),f=j,d=Z,g=s(r*c),y=s(o*l),p=s(t*d*u),v=s(i*a),T=s((r+o)*(c+l)-g-y),R=s(v-p),an=s(v+p),un=s(y-f*g),Pn=s(T*R),Un=s(an*un),Gn=s(T*un),jn=s(R*an);return new w(Pn,Un,jn,Gn)}subtract(e){return this.add(J(e).negate())}multiply(e,r=!0){if(!r&&(e===0n||this.is0()))return C;if(A(e,1n,D),e===1n)return this;if(this.equals(x))return Te(e).p;let o=C,i=x;for(let t=this;e>0n;t=t.double(),e>>=1n)e&1n?o=o.add(t):r&&(i=i.add(t));return o}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){const{X:e,Y:r,Z:o}=this;if(this.equals(C))return{x:0n,y:1n};const i=ge(o,m);s(o*i)!==1n&&h("invalid inverse");const t=s(e*i),c=s(r*i);return{x:t,y:c}}toBytes(){const{x:e,y:r}=this.assertValidity().toAffine(),o=In(r);return o[31]|=e&1n?128:0,o}toHex(){return Cn(this.toBytes())}clearCofactor(){return this.multiply(K(ce),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.multiply(D/2n,!1).double();return D%2n&&(e=e.add(this)),e.is0()}}const x=new w(yn,pn,1n,s(yn*pn)),C=new w(0n,1n,1n,0n);w.BASE=x;w.ZERO=C;const In=n=>qn(Tn(A(n,0n,H),rn)).reverse(),Bn=n=>K("0x"+Cn(xn(E(n)).reverse())),b=(n,e)=>{let r=n;for(;e-- >0n;)r*=r,r%=m;return r},pe=n=>{const r=n*n%m*n%m,o=b(r,2n)*r%m,i=b(o,1n)*n%m,t=b(i,5n)*i%m,c=b(t,10n)*t%m,l=b(c,20n)*c%m,a=b(l,40n)*l%m,u=b(a,80n)*a%m,f=b(u,80n)*a%m,d=b(f,10n)*t%m;return{pow_p_5_8:b(d,2n)*n%m,b2:r}},mn=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,he=(n,e)=>{const r=s(e*e*e),o=s(r*r*e),i=pe(n*o).pow_p_5_8;let t=s(n*r*i);const c=s(e*t*t),l=t,a=s(t*mn),u=c===n,f=c===s(-n),d=c===s(-n*mn);return u&&(t=l),(f||d)&&(t=a),(s(t)&1n)===1n&&(t=s(-t)),{isValid:u||f,value:t}},V=n=>Mn(Bn(n)),on=(...n)=>_n.sha512Async(I(...n)),me=(...n)=>ye("sha512")(I(...n)),Rn=n=>{const e=n.slice(0,L);e[0]&=248,e[31]&=127,e[31]|=64;const r=n.slice(L,rn),o=V(e),i=x.multiply(o),t=i.toBytes();return{head:e,prefix:r,scalar:o,point:i,pointBytes:t}},tn=n=>on(E(n,L)).then(Rn),we=n=>Rn(me(E(n,L))),ve=n=>tn(n).then(e=>e.pointBytes),be=n=>on(n.hashable).then(n.finish),Se=(n,e,r)=>{const{pointBytes:o,scalar:i}=n,t=V(e),c=x.multiply(t).toBytes();return{hashable:I(c,o,r),finish:u=>{const f=Mn(t+V(u)*i);return E(I(c,In(f)),rn)}}},Ee=async(n,e)=>{const r=E(n),o=await tn(e),i=await on(o.prefix,r);return be(Se(o,i,r))},_n={sha512Async:async n=>{const e=fe(),r=I(n);return $(await e.digest("SHA-512",r.buffer))},sha512:void 0},Ae=(n=de(L))=>n,ke={getExtendedPublicKeyAsync:tn,getExtendedPublicKey:we,randomSecretKey:Ae},O=8,Le=256,Dn=Math.ceil(Le/O)+1,z=2**(O-1),xe=()=>{const n=[];let e=x,r=e;for(let o=0;o<Dn;o++){r=e,n.push(r);for(let i=1;i<z;i++)r=r.add(e),n.push(r);e=r.double()}return n};let wn;const vn=(n,e)=>{const r=e.negate();return n?r:e},Te=n=>{const e=wn||(wn=xe());let r=C,o=x;const i=2**O,t=i,c=K(i-1),l=K(O);for(let a=0;a<Dn;a++){let u=Number(n&c);n>>=l,u>z&&(u-=t,n+=1n);const f=a*z,d=f,g=f+Math.abs(u)-1,y=a%2!==0,p=u<0;u===0?o=o.add(vn(y,e[d])):r=r.add(vn(p,e[g]))}return n!==0n&&h("invalid wnaf"),{p:r,f:o}},Y="godmode-device-identity-v1";function W(n){let e="";for(const r of n)e+=String.fromCharCode(r);return btoa(e).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Nn(n){const e=n.replaceAll("-","+").replaceAll("_","/"),r=e+"=".repeat((4-e.length%4)%4),o=atob(r),i=new Uint8Array(o.length);for(let t=0;t<o.length;t+=1)i[t]=o.charCodeAt(t);return i}function Ce(n){return Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}async function Kn(n){const e=await crypto.subtle.digest("SHA-256",n);return Ce(new Uint8Array(e))}async function qe(){const n=ke.randomSecretKey(),e=await ve(n);return{deviceId:await Kn(e),publicKey:W(e),privateKey:W(n)}}async function On(){try{const r=localStorage.getItem(Y);if(r){const o=JSON.parse(r);if(o?.version===1&&typeof o.deviceId=="string"&&typeof o.publicKey=="string"&&typeof o.privateKey=="string"){const i=await Kn(Nn(o.publicKey));if(i!==o.deviceId){const t={...o,deviceId:i};return localStorage.setItem(Y,JSON.stringify(t)),{deviceId:i,publicKey:o.publicKey,privateKey:o.privateKey}}return{deviceId:o.deviceId,publicKey:o.publicKey,privateKey:o.privateKey}}}}catch{}const n=await qe(),e={version:1,deviceId:n.deviceId,publicKey:n.publicKey,privateKey:n.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Y,JSON.stringify(e)),n}async function br(n,e){const r=Nn(n),o=new TextEncoder().encode(e),i=await Ee(o,r);return W(i)}async function P(n,e){if(!(!n.client||!n.connected)&&!n.devicesLoading){n.devicesLoading=!0,e?.quiet||(n.devicesError=null);try{const r=await n.client.request("device.pair.list",{});n.devicesList={pending:Array.isArray(r?.pending)?r.pending:[],paired:Array.isArray(r?.paired)?r.paired:[]}}catch(r){e?.quiet||(n.devicesError=String(r))}finally{n.devicesLoading=!1}}}async function Sr(n,e){if(!(!n.client||!n.connected))try{await n.client.request("device.pair.approve",{requestId:e}),await P(n)}catch(r){n.devicesError=String(r)}}async function Er(n,e){if(!(!n.client||!n.connected||!window.confirm("Reject this device pairing request?")))try{await n.client.request("device.pair.reject",{requestId:e}),await P(n)}catch(o){n.devicesError=String(o)}}async function Ar(n,e){if(!(!n.client||!n.connected))try{const r=await n.client.request("device.token.rotate",e);if(r?.token){const o=await On(),i=r.role??e.role;(r.deviceId===o.deviceId||e.deviceId===o.deviceId)&&ie({deviceId:o.deviceId,role:i,token:r.token,scopes:r.scopes??e.scopes??[]}),window.prompt("New device token (copy and store securely):",r.token)}await P(n)}catch(r){n.devicesError=String(r)}}async function kr(n,e){if(!(!n.client||!n.connected||!window.confirm(`Revoke token for ${e.deviceId} (${e.role})?`)))try{await n.client.request("device.token.revoke",e);const o=await On();e.deviceId===o.deviceId&&te({deviceId:o.deviceId,role:e.role}),await P(n)}catch(o){n.devicesError=String(o)}}async function Lr(n,e){if(!(!n.client||!n.connected)&&!n.nodesLoading){n.nodesLoading=!0,e?.quiet||(n.lastError=null);try{const r=await n.client.request("node.list",{}),o=Array.isArray(r.nodes)?r.nodes:[];JSON.stringify(o)!==JSON.stringify(n.nodes)&&(n.nodes=o)}catch(r){e?.quiet||(n.lastError=String(r))}finally{n.nodesLoading=!1}}}const $n="godmode:autoTitleCache";function Fe(){try{const n=localStorage.getItem($n);if(n){const e=JSON.parse(n);return new Map(e)}}catch{}return new Map}function X(n){try{const e=[...n.entries()],r=e.length>200?e.slice(-200):e;localStorage.setItem($n,JSON.stringify(r))}catch{}}class Me extends Map{set(e,r){return super.set(e,r),X(this),this}delete(e){const r=super.delete(e);return r&&X(this),r}clear(){super.clear(),X(this)}}const Q=new Me(Fe());async function B(n,e){if(!(!n.client||!n.connected)&&!n.sessionsLoading){n.sessionsLoading=!0,n.sessionsError=null;try{const r=e?.includeGlobal??n.sessionsIncludeGlobal,o=e?.includeUnknown??n.sessionsIncludeUnknown,i=e?.activeMinutes??N(n.sessionsFilterActive,0),t=e?.limit??N(n.sessionsFilterLimit,50),c={includeGlobal:r,includeUnknown:o};i>0&&(c.activeMinutes=i),t>0&&(c.limit=t);const l=await n.client.request("sessions.list",c);if(l){if(l.sessions){const a=new Map;if(n.sessionsResult?.sessions)for(const u of n.sessionsResult.sessions)u.displayName&&a.set(u.key,u.displayName);l.sessions=l.sessions.map(u=>{if(u.label||u.displayName)return u;let f=Q.get(u.key);if(!f){const g=u.key.split(":").pop();if(g&&g.length>=4){for(const[y,p]of Q)if(y===u.key||y.endsWith(`:${g}`)||u.key.endsWith(`:${y.split(":").pop()}`)){f=p;break}}}if(f)return{...u,displayName:f};const d=a.get(u.key);return d?{...u,displayName:d}:u})}n.sessionsResult=l}}catch(r){n.sessionsError=String(r)}finally{n.sessionsLoading=!1}}}async function Ie(n,e,r){if(!n.client||!n.connected)return{ok:!1};const o={key:e};"label"in r&&(o.label=r.label),"displayName"in r&&(o.displayName=r.displayName),"thinkingLevel"in r&&(o.thinkingLevel=r.thinkingLevel),"verboseLevel"in r&&(o.verboseLevel=r.verboseLevel),"reasoningLevel"in r&&(o.reasoningLevel=r.reasoningLevel);try{const{safeRequest:i}=await Yn(async()=>{const{safeRequest:c}=await import("./index-DzcGsUUC.js").then(l=>l.s);return{safeRequest:c}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),t=await i(n.client,"sessions.patch",o);return t.ok?{ok:!0,canonicalKey:t.data?.key??e}:(n.sessionsError=t.error,{ok:!1})}catch(i){return n.sessionsError=String(i),{ok:!1}}}async function Be(n,e){if(!(!n.client||!n.connected||n.sessionsLoading||!window.confirm(`Delete session "${e}"?
4
+
5
+ Deletes the session entry and archives its transcript.`))){n.sessionsLoading=!0,n.sessionsError=null;try{await n.client.request("sessions.delete",{key:e,deleteTranscript:!0}),await B(n)}catch(o){n.sessionsError=String(o)}finally{n.sessionsLoading=!1}}}async function U(n){if(!(!n.client||!n.connected)){n.archivedSessionsLoading=!0;try{const e=await n.client.request("sessions.archived",{});e?.archived&&(n.archivedSessions=e.archived)}catch{}finally{n.archivedSessionsLoading=!1}}}async function Re(n,e){if(!(!n.client||!n.connected))try{await n.client.request("sessions.archive",{sessionKey:e}),await U(n),await B(n)}catch(r){n.sessionsError=`Archive failed: ${String(r)}`}}async function _e(n,e){if(!(!n.client||!n.connected))try{await n.client.request("sessions.unarchive",{sessionKey:e}),await U(n),await B(n)}catch(r){n.sessionsError=`Unarchive failed: ${String(r)}`}}async function De(n){if(!n.client||!n.connected)return 0;try{const r=(await n.client.request("sessions.autoArchive",{}))?.archivedCount??0;return await U(n),await B(n),r}catch(e){return n.sessionsError=`Auto-archive failed: ${String(e)}`,0}}const xr=Object.freeze(Object.defineProperty({__proto__:null,archiveSession:Re,autoTitleCache:Q,deleteSession:Be,loadArchivedSessions:U,loadSessions:B,patchSession:Ie,triggerAutoArchive:De,unarchiveSession:_e},Symbol.toStringTag,{value:"Module"}));async function Tr(n){if(!(!n.client||!n.connected)&&!n.debugLoading){n.debugLoading=!0;try{const[e,r,o,i]=await Promise.all([n.client.request("status",{}),n.client.request("health",{}),n.client.request("models.list",{}),n.client.request("last-heartbeat",{})]);n.debugStatus=e,n.debugHealth=r;const t=o;n.debugModels=Array.isArray(t?.models)?t?.models:[],n.debugHeartbeat=i}catch(e){n.debugCallError=String(e)}finally{n.debugLoading=!1}}}async function Cr(n){if(!(!n.client||!n.connected)){n.debugCallError=null,n.debugCallResult=null;try{const e=n.debugCallParams.trim()?JSON.parse(n.debugCallParams):{},r=await n.client.request(n.debugCallMethod.trim(),e);n.debugCallResult=JSON.stringify(r,null,2)}catch(e){n.debugCallError=String(e)}}}const Ne=2e3,Ke=new Set(["trace","debug","info","warn","error","fatal"]);function Oe(n){if(typeof n!="string")return null;const e=n.trim();if(!e.startsWith("{")||!e.endsWith("}"))return null;try{const r=JSON.parse(e);return!r||typeof r!="object"?null:r}catch{return null}}function $e(n){if(typeof n!="string")return null;const e=n.toLowerCase();return Ke.has(e)?e:null}function Pe(n){if(!n.trim())return{raw:n,message:n};try{const e=JSON.parse(n),r=e&&typeof e._meta=="object"&&e._meta!==null?e._meta:null,o=typeof e.time=="string"?e.time:typeof r?.date=="string"?r?.date:null,i=$e(r?.logLevelName??r?.level),t=typeof e[0]=="string"?e[0]:typeof r?.name=="string"?r?.name:null,c=Oe(t);let l=null;c&&(typeof c.subsystem=="string"?l=c.subsystem:typeof c.module=="string"&&(l=c.module)),!l&&t&&t.length<120&&(l=t);let a=null;return typeof e[1]=="string"?a=e[1]:!c&&typeof e[0]=="string"?a=e[0]:typeof e.message=="string"&&(a=e.message),{raw:n,time:o,level:i,subsystem:l,message:a??n,meta:r??void 0}}catch{return{raw:n,message:n}}}async function qr(n,e){if(!(!n.client||!n.connected)&&!(n.logsLoading&&!e?.quiet)){e?.quiet||(n.logsLoading=!0),n.logsError=null;try{const o=await n.client.request("logs.tail",{cursor:e?.reset?void 0:n.logsCursor??void 0,limit:n.logsLimit,maxBytes:n.logsMaxBytes}),t=(Array.isArray(o.lines)?o.lines.filter(l=>typeof l=="string"):[]).map(Pe),c=!!(e?.reset||o.reset||n.logsCursor==null);n.logsEntries=c?t:[...n.logsEntries,...t].slice(-Ne),typeof o.cursor=="number"&&(n.logsCursor=o.cursor),typeof o.file=="string"&&(n.logsFile=o.file),n.logsTruncated=!!o.truncated,n.logsLastFetchAt=Date.now()}catch(r){n.logsError=String(r)}finally{e?.quiet||(n.logsLoading=!1)}}}async function cn(n){if(!(!n.client||!n.connected))try{const e=await n.client.request("cron.status",{});n.cronStatus=e}catch(e){n.cronError=String(e)}}async function sn(n){if(!(!n.client||!n.connected)&&!n.cronLoading){n.cronLoading=!0,n.cronError=null;try{const e=await n.client.request("cron.list",{includeDisabled:!0});n.cronJobs=Array.isArray(e.jobs)?e.jobs:[]}catch(e){n.cronError=String(e)}finally{n.cronLoading=!1}}}function Ue(n){if(n.scheduleKind==="at"){const r=Date.parse(n.scheduleAt);if(!Number.isFinite(r))throw new Error("Invalid run time.");return{kind:"at",atMs:r}}if(n.scheduleKind==="every"){const r=N(n.everyAmount,0);if(r<=0)throw new Error("Invalid interval amount.");const o=n.everyUnit;return{kind:"every",everyMs:r*(o==="minutes"?6e4:o==="hours"?36e5:864e5)}}const e=n.cronExpr.trim();if(!e)throw new Error("Cron expression required.");return{kind:"cron",expr:e,tz:n.cronTz.trim()||void 0}}function Ge(n){if(n.payloadKind==="systemEvent"){const i=n.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const e=n.payloadText.trim();if(!e)throw new Error("Agent message required.");const r={kind:"agentTurn",message:e};n.deliver&&(r.deliver=!0),n.channel&&(r.channel=n.channel),n.to.trim()&&(r.to=n.to.trim());const o=N(n.timeoutSeconds,0);return o>0&&(r.timeoutSeconds=o),r}async function Fr(n){if(!(!n.client||!n.connected||n.cronBusy)){n.cronBusy=!0,n.cronError=null;try{const e=Ue(n.cronForm),r=Ge(n.cronForm),o=n.cronForm.agentId.trim(),i={name:n.cronForm.name.trim(),description:n.cronForm.description.trim()||void 0,agentId:o||void 0,enabled:n.cronForm.enabled,schedule:e,sessionTarget:n.cronForm.sessionTarget,wakeMode:n.cronForm.wakeMode,payload:r,isolation:n.cronForm.postToMainPrefix.trim()&&n.cronForm.sessionTarget==="isolated"?{postToMainPrefix:n.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await n.client.request("cron.add",i),n.cronForm={...n.cronForm,name:"",description:"",payloadText:""},await sn(n),await cn(n)}catch(e){n.cronError=String(e)}finally{n.cronBusy=!1}}}async function Mr(n,e,r){if(!(!n.client||!n.connected||n.cronBusy)){n.cronBusy=!0,n.cronError=null;try{await n.client.request("cron.update",{id:e.id,patch:{enabled:r}}),await sn(n),await cn(n)}catch(o){n.cronError=String(o)}finally{n.cronBusy=!1}}}async function Ir(n,e){if(!(!n.client||!n.connected||n.cronBusy)){n.cronBusy=!0,n.cronError=null;try{await n.client.request("cron.run",{id:e.id,mode:"force"}),await je(n,e.id)}catch(r){n.cronError=String(r)}finally{n.cronBusy=!1}}}async function Br(n,e){if(!(!n.client||!n.connected||n.cronBusy)){n.cronBusy=!0,n.cronError=null;try{await n.client.request("cron.remove",{id:e.id}),n.cronRunsJobId===e.id&&(n.cronRunsJobId=null,n.cronRuns=[]),await sn(n),await cn(n)}catch(r){n.cronError=String(r)}finally{n.cronBusy=!1}}}async function je(n,e){if(!(!n.client||!n.connected))try{const r=await n.client.request("cron.runs",{id:e,limit:50});n.cronRunsJobId=e,n.cronRuns=Array.isArray(r.entries)?r.entries:[]}catch(r){n.cronError=String(r)}}async function M(n){if(!(!n.client||!n.connected)){n.guardrailsLoading=!0;try{const[e,r]=await Promise.all([n.client.request("guardrails.list",{}),n.client.request("guardrails.history",{limit:50})]);n.guardrailsData={gates:e.gates,activity:r.activity,custom:e.custom??[]}}catch(e){console.error("[Guardrails] load error:",e),n.guardrailsData=null}finally{n.guardrailsLoading=!1}}}async function Ze(n,e,r){if(!(!n.client||!n.connected))try{await n.client.request("guardrails.set",{gateId:e,enabled:r});const i=n.guardrailsData?.gates.find(t=>t.id===e)?.name??e;n.showToast(`${i} ${r?"enabled":"disabled"}`,"success",2e3),await M(n)}catch(o){n.showToast("Failed to update guardrail","error"),console.error("[Guardrails] toggle error:",o)}}async function Je(n,e,r,o){if(!(!n.client||!n.connected))try{await n.client.request("guardrails.set",{gateId:e,thresholds:{[r]:o}}),n.showToast("Threshold updated","success",2e3),await M(n)}catch(i){n.showToast("Failed to update threshold","error"),console.error("[Guardrails] threshold error:",i)}}async function Ye(n,e,r){if(!(!n.client||!n.connected))try{await n.client.request("guardrails.setCustom",{id:e,enabled:r}),n.showToast(`Custom rule ${r?"enabled":"disabled"}`,"success",2e3),await M(n)}catch(o){n.showToast("Failed to update custom rule","error"),console.error("[Guardrails] toggleCustom error:",o)}}async function Xe(n,e){if(!(!n.client||!n.connected))try{await n.client.request("guardrails.removeCustom",{id:e}),n.showToast("Custom rule removed","success",2e3),await M(n)}catch(r){n.showToast("Failed to remove custom rule","error"),console.error("[Guardrails] deleteCustom error:",r)}}async function He(n,e){if(!(!n.client||!n.connected))try{await n.client.request("guardrails.addCustom",{guardrail:{name:e.name,description:"",enabled:!0,trigger:{tool:e.tool,patterns:e.patterns},action:e.action,message:e.message,...e.redirectTo?{redirectTo:e.redirectTo}:{}}}),n.showToast("Custom rule created","success",2e3),await M(n)}catch(r){n.showToast("Failed to create custom rule","error"),console.error("[Guardrails] addCustom error:",r)}}const Rr=Object.freeze(Object.defineProperty({__proto__:null,addCustomGuardrailFromUI:He,deleteCustomGuardrail:Xe,loadGuardrails:M,toggleCustomGuardrail:Ye,toggleGuardrail:Ze,updateGuardrailThreshold:Je},Symbol.toStringTag,{value:"Module"}));function Ve(n){if(!n||n.kind==="gateway")return{method:"exec.approvals.get",params:{}};const e=n.nodeId.trim();return e?{method:"exec.approvals.node.get",params:{nodeId:e}}:null}function ze(n,e){if(!n||n.kind==="gateway")return{method:"exec.approvals.set",params:e};const r=n.nodeId.trim();return r?{method:"exec.approvals.node.set",params:{...e,nodeId:r}}:null}async function We(n,e){if(!(!n.client||!n.connected)&&!n.execApprovalsLoading){n.execApprovalsLoading=!0,n.lastError=null;try{const r=Ve(e);if(!r){n.lastError="Select a node before loading exec approvals.";return}const o=await n.client.request(r.method,r.params);Qe(n,o)}catch(r){n.lastError=String(r)}finally{n.execApprovalsLoading=!1}}}function Qe(n,e){n.execApprovalsSnapshot=e,n.execApprovalsDirty||(n.execApprovalsForm=k(e.file??{}))}async function _r(n,e){if(!(!n.client||!n.connected)){n.execApprovalsSaving=!0,n.lastError=null;try{const r=n.execApprovalsSnapshot?.hash;if(!r){n.lastError="Exec approvals hash missing; reload and retry.";return}const o=n.execApprovalsForm??n.execApprovalsSnapshot?.file??{},i=ze(e,{file:o,baseHash:r});if(!i){n.lastError="Select a node before saving exec approvals.";return}await n.client.request(i.method,i.params),n.execApprovalsDirty=!1,await We(n,e)}catch(r){n.lastError=String(r)}finally{n.execApprovalsSaving=!1}}}function Dr(n,e,r){const o=k(n.execApprovalsForm??n.execApprovalsSnapshot?.file??{});bn(o,e,r),n.execApprovalsForm=o,n.execApprovalsDirty=!0}function Nr(n,e){const r=k(n.execApprovalsForm??n.execApprovalsSnapshot?.file??{});Sn(r,e),n.execApprovalsForm=r,n.execApprovalsDirty=!0}async function Kr(n){if(!(!n.client||!n.connected)&&!n.presenceLoading){n.presenceLoading=!0,n.presenceError=null,n.presenceStatus=null;try{const e=await n.client.request("system-presence",{});Array.isArray(e)?(n.presenceEntries=e,n.presenceStatus=e.length===0?"No instances yet.":null):(n.presenceEntries=[],n.presenceStatus="No presence payload.")}catch(e){n.presenceError=String(e)}finally{n.presenceLoading=!1}}}function F(n,e,r){if(!e.trim())return;const o={...n.skillMessages};r?o[e]=r:delete o[e],n.skillMessages=o}function G(n){return n instanceof Error?n.message:String(n)}async function ln(n,e){if(e?.clearMessages&&Object.keys(n.skillMessages).length>0&&(n.skillMessages={}),!(!n.client||!n.connected)&&!n.skillsLoading){n.skillsLoading=!0,n.skillsError=null;try{const r=await n.client.request("skills.status",{});r&&(n.skillsReport=r)}catch(r){n.skillsError=G(r)}finally{n.skillsLoading=!1}}}async function Or(n){if(!(!n.client||!n.connected)){n.godmodeSkillsLoading=!0;try{const e=await n.client.request("godmode.skills.list",{});n.godmodeSkills=e??null}catch(e){console.error("[Skills] Failed to load GodMode skills:",e),n.godmodeSkills=null}finally{n.godmodeSkillsLoading=!1}}}function $r(n,e,r){n.skillEdits={...n.skillEdits,[e]:r}}async function Pr(n,e,r){if(!(!n.client||!n.connected)){n.skillsBusyKey=e,n.skillsError=null;try{await n.client.request("skills.update",{skillKey:e,enabled:r}),await ln(n),F(n,e,{kind:"success",message:r?"Skill enabled":"Skill disabled"})}catch(o){const i=G(o);n.skillsError=i,F(n,e,{kind:"error",message:i})}finally{n.skillsBusyKey=null}}}async function Ur(n,e){if(!(!n.client||!n.connected)){n.skillsBusyKey=e,n.skillsError=null;try{const r=n.skillEdits[e]??"";await n.client.request("skills.update",{skillKey:e,apiKey:r}),await ln(n),F(n,e,{kind:"success",message:"API key saved"})}catch(r){const o=G(r);n.skillsError=o,F(n,e,{kind:"error",message:o})}finally{n.skillsBusyKey=null}}}async function Gr(n,e,r,o){if(!(!n.client||!n.connected)){n.skillsBusyKey=e,n.skillsError=null;try{const i=await n.client.request("skills.install",{name:r,installId:o,timeoutMs:12e4});await ln(n),F(n,e,{kind:"success",message:i?.message??"Installed"})}catch(i){const t=G(i);n.skillsError=t,F(n,e,{kind:"error",message:t})}finally{n.skillsBusyKey=null}}}export{Dr as $,cn as A,sn as B,U as C,ln as D,Or as E,We as F,M as G,ir as H,fr as I,Ie as J,De as K,_e as L,Re as M,Be as N,je as O,Br as P,Ir as Q,Mr as R,Fr as S,Gr as T,Ur as U,$r as V,Pr as W,re as X,_r as Y,Nr as Z,Yn as _,ar as a,dn as a0,sr as a1,cr as a2,tr as a3,lr as a4,zn as a5,Cr as a6,kr as a7,Ar as a8,Er as a9,Sr as aa,hr as ab,wr as ac,xr as ad,Rr as ae,dr as b,gr as c,yr as d,or as e,ur as f,Vn as g,En as h,mr as i,On as j,vr as k,nr as l,br as m,ie as n,te as o,ee as p,Lr as q,P as r,er as s,pr as t,B as u,Q as v,rr as w,qr as x,Tr as y,Kr as z};
@@ -1,4 +1,4 @@
1
- import{d as $,b as i,A as l,o as C,g as k,r as h,t as _}from"./lit-core-CTInmNPB.js";import{a as u,w as I}from"./index-Covj4w7X.js";import{H as S}from"./views-settings-nvLQdpIB.js";import{f as y}from"./ctrl-settings-niym-WgY.js";import"./markdown-i_gIkIP3.js";async function E(a,s){if(!a.client||!a.connected){a.dashboardsError="Not connected to gateway";return}a.dashboardsLoading=!0,a.dashboardsError=null;try{const e=await a.client.request("dashboards.list",s?{scope:s}:{});a.dashboardsList=e.dashboards,a.activeDashboardId=e.activeDashboard}catch(e){a.dashboardsError=e instanceof Error?e.message:"Failed to load dashboards"}finally{a.dashboardsLoading=!1}}async function F(a,s){if(!a.client||!a.connected){a.dashboardsError="Not connected to gateway";return}a.dashboardsLoading=!0,a.dashboardsError=null;try{const e=await a.client.request("dashboards.get",{id:s});a.activeDashboardId=s,a.activeDashboardManifest=e.manifest,a.activeDashboardHtml=e.html}catch(e){a.dashboardsError=e instanceof Error?e.message:"Failed to load dashboard"}finally{a.dashboardsLoading=!1}}async function A(a,s){if(!a.client||!a.connected)return;const e=(a.dashboardsList??[]).find(t=>t.id===s);if(!e)return;const r=!e.pinned;try{await a.client.request("dashboards.save",{id:e.id,title:e.title,description:e.description,scope:e.scope,pinned:r}),e.pinned=r,a.dashboardsList=[...a.dashboardsList??[]]}catch(t){a.dashboardsError=t instanceof Error?t.message:"Failed to toggle pin"}}async function L(a,s){if(!a.client||!a.connected)return!1;try{return await a.client.request("dashboards.remove",{id:s}),a.dashboardsList=(a.dashboardsList??[]).filter(e=>e.id!==s),a.activeDashboardId===s&&(a.activeDashboardId=null,a.activeDashboardHtml=null,a.activeDashboardManifest=null),!0}catch(e){return a.dashboardsError=e instanceof Error?e.message:"Failed to delete dashboard",!1}}var q=Object.defineProperty,T=Object.getOwnPropertyDescriptor,c=(a,s,e,r)=>{for(var t=r>1?void 0:r?T(s,e):s,o=a.length-1,b;o>=0;o--)(b=a[o])&&(t=(r?b(s,e,t):b(t))||t);return r&&t&&q(s,e,t),t};const p={all:{icon:"📊",label:"All"},productivity:{icon:"📋",label:"Productivity"},personal:{icon:"🧑",label:"Personal"},business:{icon:"💼",label:"Business"},system:{icon:"⚙️",label:"System"},custom:{icon:"✨",label:"Custom"}},M=[{id:"weekly-impact",name:"Weekly Impact",category:"productivity",description:"Tasks completed, agent outcomes, and trust trends this week",prompt:"Create a weekly impact dashboard. Use these widgets: tasks-summary, queue-status, trust-scores, streak-stats, brief-summary. Show tasks completed vs created, agent queue throughput, trust score trends, and daily streak. Use clean CSS grid with bar charts."},{id:"agent-activity",name:"Agent Activity",category:"system",description:"Queue pipeline, active personas, and trust scores",prompt:"Create an agent activity dashboard. Use these widgets: queue-status, trust-scores, agent-activity. Show queue stats (pending, processing, completed, failed), most active personas, and trust scores by workflow. Use CSS grid layout."},{id:"morning-overview",name:"Morning Overview",category:"productivity",description:"Today's tasks, brief highlights, and queue status",prompt:"Create a morning overview dashboard. Use these widgets: tasks-summary, brief-summary, queue-status, streak-stats. Show today's priorities, daily brief highlights, pending queue items, and your current streak. Use clean CSS grid layout."}];function P(a){return a==="global"?i`<span class="dashboard-card-scope">Global</span>`:i`<span class="dashboard-card-scope">${a}</span>`}function D(a){return Date.now()-new Date(a).getTime()>1440*60*1e3}function w(a){const s=(a.title+" "+(a.description??"")).toLowerCase();return s.includes("health")||s.includes("sleep")||s.includes("oura")||s.includes("energy")||s.includes("goal")?"personal":s.includes("agent")||s.includes("queue")||s.includes("trust")||s.includes("skill")?"system":s.includes("revenue")||s.includes("business")||s.includes("content")||s.includes("metric")?"business":s.includes("task")||s.includes("calendar")||s.includes("morning")||s.includes("impact")||s.includes("weekly")?"productivity":"custom"}function m(a,s){const e=p[a.category]??p.custom;return i`
1
+ import{d as $,b as i,A as l,o as C,g as k,r as h,t as _}from"./lit-core-CTInmNPB.js";import{a as u,b as I}from"./index-DzcGsUUC.js";import{H as S}from"./views-settings-TQFJxfo9.js";import{f as y}from"./ctrl-settings-nG144v_G.js";import"./markdown-i_gIkIP3.js";async function E(a,s){if(!a.client||!a.connected){a.dashboardsError="Not connected to gateway";return}a.dashboardsLoading=!0,a.dashboardsError=null;try{const e=await a.client.request("dashboards.list",s?{scope:s}:{});a.dashboardsList=e.dashboards,a.activeDashboardId=e.activeDashboard}catch(e){a.dashboardsError=e instanceof Error?e.message:"Failed to load dashboards"}finally{a.dashboardsLoading=!1}}async function F(a,s){if(!a.client||!a.connected){a.dashboardsError="Not connected to gateway";return}a.dashboardsLoading=!0,a.dashboardsError=null;try{const e=await a.client.request("dashboards.get",{id:s});a.activeDashboardId=s,a.activeDashboardManifest=e.manifest,a.activeDashboardHtml=e.html}catch(e){a.dashboardsError=e instanceof Error?e.message:"Failed to load dashboard"}finally{a.dashboardsLoading=!1}}async function A(a,s){if(!a.client||!a.connected)return;const e=(a.dashboardsList??[]).find(t=>t.id===s);if(!e)return;const r=!e.pinned;try{await a.client.request("dashboards.save",{id:e.id,title:e.title,description:e.description,scope:e.scope,pinned:r}),e.pinned=r,a.dashboardsList=[...a.dashboardsList??[]]}catch(t){a.dashboardsError=t instanceof Error?t.message:"Failed to toggle pin"}}async function L(a,s){if(!a.client||!a.connected)return!1;try{return await a.client.request("dashboards.remove",{id:s}),a.dashboardsList=(a.dashboardsList??[]).filter(e=>e.id!==s),a.activeDashboardId===s&&(a.activeDashboardId=null,a.activeDashboardHtml=null,a.activeDashboardManifest=null),!0}catch(e){return a.dashboardsError=e instanceof Error?e.message:"Failed to delete dashboard",!1}}var q=Object.defineProperty,T=Object.getOwnPropertyDescriptor,c=(a,s,e,r)=>{for(var t=r>1?void 0:r?T(s,e):s,o=a.length-1,b;o>=0;o--)(b=a[o])&&(t=(r?b(s,e,t):b(t))||t);return r&&t&&q(s,e,t),t};const p={all:{icon:"📊",label:"All"},productivity:{icon:"📋",label:"Productivity"},personal:{icon:"🧑",label:"Personal"},business:{icon:"💼",label:"Business"},system:{icon:"⚙️",label:"System"},custom:{icon:"✨",label:"Custom"}},M=[{id:"weekly-impact",name:"Weekly Impact",category:"productivity",description:"Tasks completed, agent outcomes, and trust trends this week",prompt:"Create a weekly impact dashboard. Use these widgets: tasks-summary, queue-status, trust-scores, streak-stats, brief-summary. Show tasks completed vs created, agent queue throughput, trust score trends, and daily streak. Use clean CSS grid with bar charts."},{id:"agent-activity",name:"Agent Activity",category:"system",description:"Queue pipeline, active personas, and trust scores",prompt:"Create an agent activity dashboard. Use these widgets: queue-status, trust-scores, agent-activity. Show queue stats (pending, processing, completed, failed), most active personas, and trust scores by workflow. Use CSS grid layout."},{id:"morning-overview",name:"Morning Overview",category:"productivity",description:"Today's tasks, brief highlights, and queue status",prompt:"Create a morning overview dashboard. Use these widgets: tasks-summary, brief-summary, queue-status, streak-stats. Show today's priorities, daily brief highlights, pending queue items, and your current streak. Use clean CSS grid layout."}];function P(a){return a==="global"?i`<span class="dashboard-card-scope">Global</span>`:i`<span class="dashboard-card-scope">${a}</span>`}function D(a){return Date.now()-new Date(a).getTime()>1440*60*1e3}function w(a){const s=(a.title+" "+(a.description??"")).toLowerCase();return s.includes("health")||s.includes("sleep")||s.includes("oura")||s.includes("energy")||s.includes("goal")?"personal":s.includes("agent")||s.includes("queue")||s.includes("trust")||s.includes("skill")?"system":s.includes("revenue")||s.includes("business")||s.includes("content")||s.includes("metric")?"business":s.includes("task")||s.includes("calendar")||s.includes("morning")||s.includes("impact")||s.includes("weekly")?"productivity":"custom"}function m(a,s){const e=p[a.category]??p.custom;return i`
2
2
  <div class="dashboard-card dashboard-card--template">
3
3
  <button
4
4
  class="dashboard-card-main"