comisai 1.0.16 → 1.0.18

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.
Files changed (90) hide show
  1. package/node_modules/@comis/agent/package.json +1 -1
  2. package/node_modules/@comis/channels/package.json +1 -1
  3. package/node_modules/@comis/cli/dist/wizard/non-interactive.js +1 -0
  4. package/node_modules/@comis/cli/dist/wizard/steps/01-detect-existing.js +2 -0
  5. package/node_modules/@comis/cli/dist/wizard/steps/07-gateway.js +9 -0
  6. package/node_modules/@comis/cli/dist/wizard/steps/10-write-config.js +2 -0
  7. package/node_modules/@comis/cli/dist/wizard/steps/12-finish.js +5 -2
  8. package/node_modules/@comis/cli/dist/wizard/types.d.ts +1 -0
  9. package/node_modules/@comis/cli/package.json +1 -1
  10. package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +17 -2
  11. package/node_modules/@comis/core/dist/config/schema-gateway.js +11 -0
  12. package/node_modules/@comis/core/dist/config/schema.d.ts +60 -57
  13. package/node_modules/@comis/core/package.json +1 -1
  14. package/node_modules/@comis/daemon/dist/wiring/setup-gateway.js +34 -6
  15. package/node_modules/@comis/daemon/package.json +1 -1
  16. package/node_modules/@comis/gateway/package.json +1 -1
  17. package/node_modules/@comis/infra/package.json +1 -1
  18. package/node_modules/@comis/memory/package.json +1 -1
  19. package/node_modules/@comis/scheduler/package.json +1 -1
  20. package/node_modules/@comis/shared/package.json +1 -1
  21. package/node_modules/@comis/skills/package.json +1 -1
  22. package/node_modules/@comis/web/dist/android-chrome-192x192.png +0 -0
  23. package/node_modules/@comis/web/dist/android-chrome-512x512.png +0 -0
  24. package/node_modules/@comis/web/dist/apple-touch-icon.png +0 -0
  25. package/node_modules/@comis/web/dist/assets/agent-detail-BG9MGWWj.js +615 -0
  26. package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +2173 -0
  27. package/node_modules/@comis/web/dist/assets/agent-list-LHCJ4rw2.js +504 -0
  28. package/node_modules/@comis/web/dist/assets/approvals-q9VH_IKr.js +54 -0
  29. package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +375 -0
  30. package/node_modules/@comis/web/dist/assets/channel-detail-CaInesJM.js +681 -0
  31. package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +323 -0
  32. package/node_modules/@comis/web/dist/assets/chat-console-CNmzl0JW.js +943 -0
  33. package/node_modules/@comis/web/dist/assets/config-editor-DX4ITw6y.js +1374 -0
  34. package/node_modules/@comis/web/dist/assets/context-dag-browser-BwiaF5tf.js +393 -0
  35. package/node_modules/@comis/web/dist/assets/context-engine-BZ5Am6hA.js +393 -0
  36. package/node_modules/@comis/web/dist/assets/delivery-view-OfBZof-m.js +392 -0
  37. package/node_modules/@comis/web/dist/assets/diagnostics-view-YFwCxgr2.js +231 -0
  38. package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +1 -0
  39. package/node_modules/@comis/web/dist/assets/extract-variables-BM5qyK-s.js +149 -0
  40. package/node_modules/@comis/web/dist/assets/ic-array-editor-B7m6x7-S.js +118 -0
  41. package/node_modules/@comis/web/dist/assets/ic-breadcrumb-CUMpp3BL.js +75 -0
  42. package/node_modules/@comis/web/dist/assets/ic-budget-segment-bar-BtJ6x5mN.js +64 -0
  43. package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +352 -0
  44. package/node_modules/@comis/web/dist/assets/ic-confirm-dialog-CCDbB04e.js +110 -0
  45. package/node_modules/@comis/web/dist/assets/ic-connection-dot-CnT1b8xr.js +54 -0
  46. package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +277 -0
  47. package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +67 -0
  48. package/node_modules/@comis/web/dist/assets/ic-detail-panel-BF83r-if.js +116 -0
  49. package/node_modules/@comis/web/dist/assets/ic-empty-state-60l2ePhd.js +52 -0
  50. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +359 -0
  51. package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +33 -0
  52. package/node_modules/@comis/web/dist/assets/ic-layer-waterfall-COvEYMg5.js +69 -0
  53. package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +12 -0
  54. package/node_modules/@comis/web/dist/assets/ic-search-input-CSOxY9g7.js +92 -0
  55. package/node_modules/@comis/web/dist/assets/ic-select-Ce-Raudx.js +127 -0
  56. package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +95 -0
  57. package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +33 -0
  58. package/node_modules/@comis/web/dist/assets/ic-time-range-picker-CypCT68y.js +93 -0
  59. package/node_modules/@comis/web/dist/assets/ic-tool-call-7MaXSsCW.js +146 -0
  60. package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +2830 -0
  61. package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +1 -0
  62. package/node_modules/@comis/web/dist/assets/mcp-management-BNZPnpDn.js +582 -0
  63. package/node_modules/@comis/web/dist/assets/media-config-BBvTYxOX.js +314 -0
  64. package/node_modules/@comis/web/dist/assets/media-test-BkK3RCRK.js +496 -0
  65. package/node_modules/@comis/web/dist/assets/memory-inspector-1hDGCGat.js +1139 -0
  66. package/node_modules/@comis/web/dist/assets/message-center-CXefwsUu.js +785 -0
  67. package/node_modules/@comis/web/dist/assets/models-C1qcU_j3.js +894 -0
  68. package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +1 -0
  69. package/node_modules/@comis/web/dist/assets/observe-view-C0VBhX4C.js +814 -0
  70. package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +1496 -0
  71. package/node_modules/@comis/web/dist/assets/pipeline-history-DkfOQ6SW.js +317 -0
  72. package/node_modules/@comis/web/dist/assets/pipeline-history-detail-hyHgD0ai.js +287 -0
  73. package/node_modules/@comis/web/dist/assets/pipeline-list-BPW8hV-q.js +518 -0
  74. package/node_modules/@comis/web/dist/assets/pipeline-monitor-Bip16T7e.js +972 -0
  75. package/node_modules/@comis/web/dist/assets/scheduler-BGgwKd06.js +1182 -0
  76. package/node_modules/@comis/web/dist/assets/security-D15st4xx.js +1224 -0
  77. package/node_modules/@comis/web/dist/assets/session-detail-SGEYNJ0M.js +632 -0
  78. package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +1 -0
  79. package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +231 -0
  80. package/node_modules/@comis/web/dist/assets/setup-wizard-nT0tz9QP.js +853 -0
  81. package/node_modules/@comis/web/dist/assets/skills-D8yVfSUy.js +1051 -0
  82. package/node_modules/@comis/web/dist/assets/subagents-HHXMeHYo.js +193 -0
  83. package/node_modules/@comis/web/dist/assets/workspace-manager-BQlr10iH.js +785 -0
  84. package/node_modules/@comis/web/dist/comis-logo.png +0 -0
  85. package/node_modules/@comis/web/dist/favicon-16x16.png +0 -0
  86. package/node_modules/@comis/web/dist/favicon-32x32.png +0 -0
  87. package/node_modules/@comis/web/dist/favicon.ico +0 -0
  88. package/node_modules/@comis/web/dist/index.html +17 -0
  89. package/node_modules/@comis/web/package.json +29 -0
  90. package/package.json +15 -13
@@ -0,0 +1,2173 @@
1
+ import{b as l,i as x,n as v,a as y,A as $,t as _,s as se,f as le,r as p,I as S}from"./index-CEcM1R_C.js";import"./ic-breadcrumb-CUMpp3BL.js";import"./ic-tag-CPPUnDLF.js";import"./ic-array-editor-B7m6x7-S.js";function X(e,t=0){const i=[],a=" ".repeat(t);for(const[r,o]of Object.entries(e))if(!(o==null||o===""))if(Array.isArray(o)){if(o.length===0)continue;i.push(`${a}${r}:`);for(const n of o)if(n!==null&&typeof n=="object"&&!Array.isArray(n)){const m=X(n,t+2).split(`
2
+ `).filter(Boolean);if(m.length>0){i.push(`${a} - ${m[0].trimStart()}`);for(let w=1;w<m.length;w++)i.push(`${a} ${m[w].trimStart()}`)}}else i.push(`${a} - ${re(n)}`)}else if(typeof o=="object"){const n=X(o,t+1);n.trim()&&(i.push(`${a}${r}:`),i.push(n))}else i.push(`${a}${r}: ${re(o)}`);return i.join(`
3
+ `)}function re(e){return typeof e=="string"?/[:#{}[\],&*?|>!%@`'"]/.test(e)||e.includes(`
4
+ `)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e:typeof e=="boolean"?e?"true":"false":String(e)}function xe(){const e=new Set,t=i=>{e.size>0&&i.preventDefault()};return{get isDirty(){return e.size>0},markDirty(i="_default"){e.add(i)},markClean(){e.clear()},confirmNavigation(){return e.size===0?!0:window.confirm("You have unsaved changes. Discard and leave?")},attach(){window.addEventListener("beforeunload",t)},detach(){window.removeEventListener("beforeunload",t)},dirtyFields(){return[...e]}}}function E(e,t,i){const a=e[t];return a??i}function s(e,t,i,a,r){const o=E(e,t,void 0),n=r?.step??"1",C=n.includes(".")?n.split(".")[1].length:0,m=o!==void 0?(C>0?Number(Number(o).toFixed(C)):o).toString():"",w=r?.id??`field-${t.replace(/\./g,"-")}`;return l`
5
+ <div class="field">
6
+ <label for=${w}>${i}</label>
7
+ <input
8
+ id=${w}
9
+ type="number"
10
+ .value=${m}
11
+ step=${n}
12
+ min=${r?.min??""}
13
+ max=${r?.max??""}
14
+ placeholder=${r?.placeholder??""}
15
+ @input=${D=>{const A=D.target.value;a(t,A===""?void 0:Number(A))}}
16
+ />
17
+ </div>
18
+ `}function k(e,t,i,a,r){const o=r?.id??`field-${t.replace(/\./g,"-")}`;return l`
19
+ <div class="field">
20
+ <label for=${o}>${i}</label>
21
+ <input
22
+ id=${o}
23
+ type="text"
24
+ .value=${E(e,t,"")}
25
+ ?readonly=${r?.readonly}
26
+ placeholder=${r?.placeholder??""}
27
+ @input=${n=>a(t,n.target.value)}
28
+ />
29
+ </div>
30
+ `}function P(e,t,i,a,r){const o=r?.id??`field-${t.replace(/\./g,"-")}`;return l`
31
+ <div class="field">
32
+ <label for=${o}>${i}</label>
33
+ <textarea
34
+ id=${o}
35
+ .value=${E(e,t,"")}
36
+ placeholder=${r?.placeholder??""}
37
+ @input=${n=>a(t,n.target.value)}
38
+ ></textarea>
39
+ </div>
40
+ `}function b(e,t,i,a,r,o){const n=E(e,t,a[0]?.value??""),C=o?.id??`field-${t.replace(/\./g,"-")}`;return l`
41
+ <div class="field">
42
+ <label for=${C}>${i}</label>
43
+ <select
44
+ id=${C}
45
+ @change=${m=>r(t,m.target.value)}
46
+ >
47
+ ${a.map(m=>l`<option value=${m.value} ?selected=${n===m.value}>${m.label}</option>`)}
48
+ </select>
49
+ </div>
50
+ `}function h(e,t,i,a,r){const o=r?.id??`field-${t.replace(/\./g,"-")}`;return l`
51
+ <div class="checkbox-field">
52
+ <input
53
+ id=${o}
54
+ type="checkbox"
55
+ .checked=${!!E(e,t,!1)}
56
+ @change=${n=>a(t,n.target.checked)}
57
+ />
58
+ <label for=${o}>${i}</label>
59
+ </div>
60
+ `}var ye=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,B=(e,t,i,a)=>{for(var r=a>1?void 0:a?_e(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&ye(t,i,r),r};let N=class extends y{constructor(){super(...arguments),this.form={},this.isNew=!1,this.agentId="",this.catalogProviders=[],this._onChange=(e,t)=>{this._emit(e,t)}}_emit(e,t){this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}_renderProviderModelFields(){const e=this.catalogProviders.length>0?this.catalogProviders.map(n=>({value:n.name,label:n.name.charAt(0).toUpperCase()+n.name.slice(1)})):[{value:"anthropic",label:"Anthropic"}],t=E(this.form,"provider","anthropic"),i=E(this.form,"model",""),r=(this.catalogProviders.find(n=>n.name===t)?.models??[]).map(n=>({id:n.modelId,label:n.displayName||n.modelId})),o=!i||r.some(n=>n.id===i);return t&&!e.some(n=>n.value===t)&&e.unshift({value:t,label:t}),l`
61
+ <div class="field">
62
+ <label for="field-provider">Provider</label>
63
+ <select
64
+ id="field-provider"
65
+ @change=${n=>{const C=n.target.value;this._emit("provider",C),this._emit("model","")}}
66
+ >
67
+ ${e.map(n=>l`<option value=${n.value} ?selected=${n.value===t}>${n.label}</option>`)}
68
+ </select>
69
+ </div>
70
+ <div class="field">
71
+ <label for="field-model">Model</label>
72
+ <select
73
+ id="field-model"
74
+ @change=${n=>this._emit("model",n.target.value)}
75
+ >
76
+ <option value="" ?selected=${!i}>-- Select model --</option>
77
+ ${!o&&i?l`<option value=${i} selected>${i}</option>`:$}
78
+ ${r.map(n=>l`<option value=${n.id} ?selected=${n.id===i}>${n.label}</option>`)}
79
+ </select>
80
+ </div>
81
+ `}_getSelectedModel(){const e=E(this.form,"provider","anthropic"),t=E(this.form,"model","");return this.catalogProviders.find(a=>a.name===e)?.models?.find(a=>a.modelId===t)}render(){const e=this._getSelectedModel(),t=e?.maxTokens?`Default: ${e.maxTokens.toLocaleString()}`:"Provider default";return l`
82
+ ${this.isNew?k(this.form,"id","Agent ID",this._onChange,{id:"field-id",placeholder:"unique-agent-id"}):l`
83
+ <div class="field">
84
+ <label for="field-id">Agent ID</label>
85
+ <input id="field-id" type="text" .value=${this.agentId} readonly />
86
+ </div>
87
+ `}
88
+ ${k(this.form,"name","Display Name",this._onChange,{id:"field-name",placeholder:"My Agent"})}
89
+ <div class="field-row">
90
+ ${this._renderProviderModelFields()}
91
+ </div>
92
+ <div class="field-row">
93
+ ${s(this.form,"temperature","Temperature",this._onChange,{id:"field-temperature",step:"0.1",min:"0",max:"2",placeholder:"Default: 1.0"})}
94
+ ${b(this.form,"thinkingLevel","Thinking Level",[{value:"none",label:"None"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],this._onChange,{id:"field-thinkingLevel"})}
95
+ </div>
96
+ <div class="field-row">
97
+ ${s(this.form,"maxSteps","Max Steps",this._onChange,{id:"field-maxSteps",min:"1"})}
98
+ ${s(this.form,"maxTokens","Max Tokens",this._onChange,{id:"field-maxTokens",placeholder:t})}
99
+ </div>
100
+ `}};N.styles=x`
101
+ :host { display: block; }
102
+
103
+ .field {
104
+ display: flex;
105
+ flex-direction: column;
106
+ gap: 4px;
107
+ margin-bottom: var(--ic-space-md);
108
+ }
109
+
110
+ .field label {
111
+ font-size: var(--ic-text-xs);
112
+ color: var(--ic-text-dim);
113
+ text-transform: uppercase;
114
+ letter-spacing: 0.05em;
115
+ }
116
+
117
+ .field input,
118
+ .field select {
119
+ background: var(--ic-surface-2);
120
+ border: 1px solid var(--ic-border);
121
+ border-radius: var(--ic-radius-md);
122
+ padding: var(--ic-space-sm) var(--ic-space-md);
123
+ color: var(--ic-text);
124
+ font-family: inherit;
125
+ font-size: var(--ic-text-sm);
126
+ outline: none;
127
+ transition: border-color var(--ic-transition);
128
+ }
129
+
130
+ .field input:focus,
131
+ .field select:focus {
132
+ border-color: var(--ic-accent);
133
+ }
134
+
135
+ .field-row {
136
+ display: grid;
137
+ grid-template-columns: 1fr 1fr;
138
+ gap: var(--ic-space-md);
139
+ }
140
+
141
+ @media (max-width: 767px) {
142
+ .field-row {
143
+ grid-template-columns: 1fr;
144
+ }
145
+ }
146
+ `;B([v({attribute:!1})],N.prototype,"form",2);B([v({type:Boolean})],N.prototype,"isNew",2);B([v()],N.prototype,"agentId",2);B([v({attribute:!1})],N.prototype,"catalogProviders",2);N=B([_("ic-agent-essential-editor")],N);var Ce=Object.defineProperty,we=Object.getOwnPropertyDescriptor,ce=(e,t,i,a)=>{for(var r=a>1?void 0:a?we(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ce(t,i,r),r};let K=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}}render(){return l`
147
+ <div class="field-row">
148
+ ${s(this.form,"budgets.perExecution","Per Execution (tokens)",this._onChange,{id:"field-budgets-perExecution",placeholder:"2000000"})}
149
+ ${s(this.form,"budgets.perHour","Per Hour (tokens)",this._onChange,{id:"field-budgets-perHour",placeholder:"10000000"})}
150
+ </div>
151
+ ${s(this.form,"budgets.perDay","Per Day (tokens)",this._onChange,{id:"field-budgets-perDay",placeholder:"100000000"})}
152
+ `}};K.styles=x`
153
+ :host { display: block; }
154
+
155
+ .field {
156
+ display: flex;
157
+ flex-direction: column;
158
+ gap: 4px;
159
+ margin-bottom: var(--ic-space-md);
160
+ }
161
+
162
+ .field label {
163
+ font-size: var(--ic-text-xs);
164
+ color: var(--ic-text-dim);
165
+ text-transform: uppercase;
166
+ letter-spacing: 0.05em;
167
+ }
168
+
169
+ .field input {
170
+ background: var(--ic-surface-2);
171
+ border: 1px solid var(--ic-border);
172
+ border-radius: var(--ic-radius-md);
173
+ padding: var(--ic-space-sm) var(--ic-space-md);
174
+ color: var(--ic-text);
175
+ font-family: inherit;
176
+ font-size: var(--ic-text-sm);
177
+ outline: none;
178
+ transition: border-color var(--ic-transition);
179
+ }
180
+
181
+ .field input:focus {
182
+ border-color: var(--ic-accent);
183
+ }
184
+
185
+ .field-row {
186
+ display: grid;
187
+ grid-template-columns: 1fr 1fr;
188
+ gap: var(--ic-space-md);
189
+ }
190
+
191
+ @media (max-width: 767px) {
192
+ .field-row {
193
+ grid-template-columns: 1fr;
194
+ }
195
+ }
196
+ `;ce([v({attribute:!1})],K.prototype,"form",2);K=ce([_("ic-agent-budget-editor")],K);var $e=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,de=(e,t,i,a)=>{for(var r=a>1?void 0:a?Te(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&$e(t,i,r),r};let G=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}}render(){const e=E(this.form,"session.resetMode","none"),t=Array.from({length:24},(i,a)=>({value:String(a),label:`${String(a).padStart(2,"0")}:00`}));return l`
197
+ <div class="field-row">
198
+ ${b(this.form,"session.resetMode","Reset Mode",[{value:"none",label:"None (manual only)"},{value:"daily",label:"Daily"},{value:"idle",label:"Idle Timeout"},{value:"hybrid",label:"Hybrid (first to expire)"}],this._onChange,{id:"field-sess-resetMode"})}
199
+ ${e==="idle"||e==="hybrid"?s(this.form,"session.idleTimeoutMs","Idle Timeout (ms)",this._onChange,{id:"field-sess-idleTimeout",placeholder:"14400000"}):$}
200
+ </div>
201
+ ${e==="daily"||e==="hybrid"?l`
202
+ <div class="field-row">
203
+ ${b(this.form,"session.dailyResetHour","Daily Reset Hour",t,this._onChange,{id:"field-sess-dailyResetHour"})}
204
+ ${b(this.form,"session.timezone","Timezone",[{value:"UTC",label:"UTC"},{value:"America/New_York",label:"US Eastern"},{value:"America/Chicago",label:"US Central"},{value:"America/Denver",label:"US Mountain"},{value:"America/Los_Angeles",label:"US Pacific"},{value:"Europe/London",label:"Europe/London"},{value:"Europe/Berlin",label:"Europe/Berlin"},{value:"Europe/Paris",label:"Europe/Paris"},{value:"Europe/Moscow",label:"Europe/Moscow"},{value:"Asia/Dubai",label:"Asia/Dubai"},{value:"Asia/Kolkata",label:"Asia/Kolkata"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Tokyo",label:"Asia/Tokyo"},{value:"Asia/Seoul",label:"Asia/Seoul"},{value:"Asia/Jerusalem",label:"Asia/Jerusalem"},{value:"Australia/Sydney",label:"Australia/Sydney"},{value:"Pacific/Auckland",label:"Pacific/Auckland"}],this._onChange,{id:"field-sess-timezone"})}
205
+ </div>
206
+ `:$}
207
+
208
+ <hr class="divider" />
209
+ <div class="section-title">DM Scope</div>
210
+ ${b(this.form,"session.dmScopeMode","DM Scope Mode",[{value:"",label:"Default (main)"},{value:"main",label:"Main (single session)"},{value:"per-peer",label:"Per Peer"},{value:"per-channel-peer",label:"Per Channel+Peer"},{value:"per-account-channel-peer",label:"Per Account+Channel+Peer"}],this._onChange,{id:"field-sess-dmScope"})}
211
+
212
+ <hr class="divider" />
213
+ <div class="section-title">Pruning</div>
214
+ ${h(this.form,"session.pruning.enabled","Enable Pruning",this._onChange,{id:"field-sess-pruning"})}
215
+ ${s(this.form,"session.pruning.maxEntries","Max Entries",this._onChange,{id:"field-sess-pruning-max",min:"1"})}
216
+
217
+ <div class="section-title">Compaction</div>
218
+ ${h(this.form,"session.compaction.enabled","Enable Compaction",this._onChange,{id:"field-sess-compaction"})}
219
+ ${s(this.form,"session.compaction.threshold","Threshold (messages)",this._onChange,{id:"field-sess-compaction-threshold",min:"1"})}
220
+ `}};G.styles=x`
221
+ :host { display: block; }
222
+
223
+ .field {
224
+ display: flex;
225
+ flex-direction: column;
226
+ gap: 4px;
227
+ margin-bottom: var(--ic-space-md);
228
+ }
229
+
230
+ .field label {
231
+ font-size: var(--ic-text-xs);
232
+ color: var(--ic-text-dim);
233
+ text-transform: uppercase;
234
+ letter-spacing: 0.05em;
235
+ }
236
+
237
+ .field input,
238
+ .field select {
239
+ background: var(--ic-surface-2);
240
+ border: 1px solid var(--ic-border);
241
+ border-radius: var(--ic-radius-md);
242
+ padding: var(--ic-space-sm) var(--ic-space-md);
243
+ color: var(--ic-text);
244
+ font-family: inherit;
245
+ font-size: var(--ic-text-sm);
246
+ outline: none;
247
+ transition: border-color var(--ic-transition);
248
+ }
249
+
250
+ .field input:focus,
251
+ .field select:focus {
252
+ border-color: var(--ic-accent);
253
+ }
254
+
255
+ .field-row {
256
+ display: grid;
257
+ grid-template-columns: 1fr 1fr;
258
+ gap: var(--ic-space-md);
259
+ }
260
+
261
+ .checkbox-field {
262
+ display: flex;
263
+ flex-direction: row;
264
+ align-items: center;
265
+ gap: var(--ic-space-sm);
266
+ margin-bottom: var(--ic-space-md);
267
+ }
268
+
269
+ .checkbox-field label {
270
+ font-size: var(--ic-text-sm);
271
+ color: var(--ic-text);
272
+ text-transform: none;
273
+ letter-spacing: normal;
274
+ cursor: pointer;
275
+ }
276
+
277
+ .checkbox-field input[type="checkbox"] {
278
+ width: 1rem;
279
+ height: 1rem;
280
+ accent-color: var(--ic-accent);
281
+ cursor: pointer;
282
+ }
283
+
284
+ .divider {
285
+ border: none;
286
+ border-top: 1px solid var(--ic-border);
287
+ margin: var(--ic-space-md) 0;
288
+ }
289
+
290
+ .section-title {
291
+ font-weight: 600;
292
+ margin-bottom: var(--ic-space-sm);
293
+ font-size: var(--ic-text-sm);
294
+ color: var(--ic-text);
295
+ }
296
+
297
+ @media (max-width: 767px) {
298
+ .field-row {
299
+ grid-template-columns: 1fr;
300
+ }
301
+ }
302
+ `;de([v({attribute:!1})],G.prototype,"form",2);G=de([_("ic-agent-session-editor")],G);const Z=["read","write","edit","grep","find","ls","exec","process","webSearch","webFetch","browser"],ke={minimal:{read:!0,write:!0,edit:!1,grep:!1,find:!1,ls:!1,exec:!1,process:!1,webSearch:!1,webFetch:!1,browser:!1},coding:{read:!0,write:!0,edit:!0,grep:!0,find:!0,ls:!0,exec:!0,process:!0,webSearch:!1,webFetch:!1,browser:!1},messaging:{read:!1,write:!1,edit:!1,grep:!1,find:!1,ls:!1,exec:!1,process:!1,webSearch:!1,webFetch:!1,browser:!1},supervisor:{read:!1,write:!1,edit:!1,grep:!1,find:!1,ls:!1,exec:!1,process:!1,webSearch:!1,webFetch:!1,browser:!1},full:{read:!0,write:!0,edit:!0,grep:!0,find:!0,ls:!0,exec:!0,process:!0,webSearch:!0,webFetch:!0,browser:!1}};var Ee=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,he=(e,t,i,a)=>{for(var r=a>1?void 0:a?Me(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ee(t,i,r),r};let Q=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this._emit(e,t)}}_emit(e,t){this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}_applyProfileToBuiltinTools(e){const t=ke[e];if(t)for(const[i,a]of Object.entries(t))this._emit(`skills.builtin.${i}`,a)}render(){const e=[{value:"minimal",label:"Minimal"},{value:"coding",label:"Coding"},{value:"messaging",label:"Messaging"},{value:"supervisor",label:"Supervisor"},{value:"full",label:"Full"}],t=E(this.form,"skills.toolPolicyProfile","full");return l`
303
+ <div class="field">
304
+ <label for="field-skills-profile">Tool Policy Profile</label>
305
+ <select
306
+ id="field-skills-profile"
307
+ @change=${i=>{const a=i.target.value;this._emit("skills.toolPolicyProfile",a),this._applyProfileToBuiltinTools(a)}}
308
+ >
309
+ ${e.map(i=>l`<option value=${i.value} ?selected=${t===i.value}>${i.label}</option>`)}
310
+ </select>
311
+ </div>
312
+ ${P(this.form,"skills.discoveryPaths","Discovery Paths (one per line)",this._onChange,{id:"field-skills-discovery",placeholder:`/skills
313
+ /custom-skills`})}
314
+ ${P(this.form,"skills.allowList","Allow List (one per line)",this._onChange,{id:"field-skills-allow",placeholder:`bash
315
+ file_ops`})}
316
+ ${P(this.form,"skills.denyList","Deny List (one per line)",this._onChange,{id:"field-skills-deny"})}
317
+
318
+ <div class="section-title">Built-in Tools</div>
319
+ <div class="checkbox-grid">
320
+ ${Z.map(i=>h(this.form,`skills.builtin.${i}`,i,this._onChange,{id:`field-skills-builtin-${i}`}))}
321
+ </div>
322
+ `}};Q.styles=x`
323
+ :host { display: block; }
324
+
325
+ .field {
326
+ display: flex;
327
+ flex-direction: column;
328
+ gap: 4px;
329
+ margin-bottom: var(--ic-space-md);
330
+ }
331
+
332
+ .field label {
333
+ font-size: var(--ic-text-xs);
334
+ color: var(--ic-text-dim);
335
+ text-transform: uppercase;
336
+ letter-spacing: 0.05em;
337
+ }
338
+
339
+ .field select,
340
+ .field textarea {
341
+ background: var(--ic-surface-2);
342
+ border: 1px solid var(--ic-border);
343
+ border-radius: var(--ic-radius-md);
344
+ padding: var(--ic-space-sm) var(--ic-space-md);
345
+ color: var(--ic-text);
346
+ font-family: inherit;
347
+ font-size: var(--ic-text-sm);
348
+ outline: none;
349
+ transition: border-color var(--ic-transition);
350
+ }
351
+
352
+ .field select:focus,
353
+ .field textarea:focus {
354
+ border-color: var(--ic-accent);
355
+ }
356
+
357
+ .field textarea {
358
+ min-height: 4rem;
359
+ resize: vertical;
360
+ }
361
+
362
+ .checkbox-field {
363
+ display: flex;
364
+ flex-direction: row;
365
+ align-items: center;
366
+ gap: var(--ic-space-sm);
367
+ margin-bottom: var(--ic-space-md);
368
+ }
369
+
370
+ .checkbox-field label {
371
+ font-size: var(--ic-text-sm);
372
+ color: var(--ic-text);
373
+ text-transform: none;
374
+ letter-spacing: normal;
375
+ cursor: pointer;
376
+ }
377
+
378
+ .checkbox-field input[type="checkbox"] {
379
+ width: 1rem;
380
+ height: 1rem;
381
+ accent-color: var(--ic-accent);
382
+ cursor: pointer;
383
+ }
384
+
385
+ .checkbox-grid {
386
+ display: grid;
387
+ grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
388
+ gap: var(--ic-space-sm);
389
+ }
390
+
391
+ .section-title {
392
+ font-weight: 600;
393
+ margin-bottom: var(--ic-space-sm);
394
+ font-size: var(--ic-text-sm);
395
+ color: var(--ic-text);
396
+ }
397
+ `;he([v({attribute:!1})],Q.prototype,"form",2);Q=he([_("ic-agent-skills-editor")],Q);var Pe=Object.defineProperty,De=Object.getOwnPropertyDescriptor,ue=(e,t,i,a)=>{for(var r=a>1?void 0:a?De(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Pe(t,i,r),r};let W=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}}render(){return l`
398
+ ${h(this.form,"heartbeat.enabled","Enabled",this._onChange,{id:"field-hb-enabled"})}
399
+ ${s(this.form,"heartbeat.intervalMs","Interval (ms)",this._onChange,{id:"field-hb-intervalMs",placeholder:"900000"})}
400
+ <div class="section-title">Delivery Target</div>
401
+ <div class="field-row">
402
+ ${k(this.form,"heartbeat.target.channelType","Channel Type",this._onChange,{id:"field-hb-channelType",placeholder:"telegram"})}
403
+ ${k(this.form,"heartbeat.target.channelId","Channel ID",this._onChange,{id:"field-hb-channelId"})}
404
+ </div>
405
+ ${k(this.form,"heartbeat.target.chatId","Chat ID",this._onChange,{id:"field-hb-chatId",placeholder:"Chat/conversation ID"})}
406
+ ${P(this.form,"heartbeat.prompt","Prompt",this._onChange,{id:"field-hb-prompt",placeholder:"Check system health"})}
407
+ <div class="field-row">
408
+ ${h(this.form,"heartbeat.showOk","Show OK",this._onChange,{id:"field-hb-showOk"})}
409
+ ${h(this.form,"heartbeat.showAlerts","Show Alerts",this._onChange,{id:"field-hb-showAlerts"})}
410
+ </div>
411
+
412
+ <hr class="divider" />
413
+ <div class="section-title">Advanced Heartbeat</div>
414
+ <div class="field-row">
415
+ ${k(this.form,"heartbeat.model","Model Override",this._onChange,{id:"field-hb-model",placeholder:"e.g. claude-sonnet-4-5-20250929"})}
416
+ ${k(this.form,"heartbeat.session","Session Key",this._onChange,{id:"field-hb-session"})}
417
+ </div>
418
+ <div class="field-row">
419
+ ${h(this.form,"heartbeat.allowDm","Allow DM",this._onChange,{id:"field-hb-allowDm"})}
420
+ ${h(this.form,"heartbeat.lightContext","Light Context",this._onChange,{id:"field-hb-lightContext"})}
421
+ ${h(this.form,"heartbeat.skipHeartbeatOnlyDelivery","Skip HB-Only Delivery",this._onChange,{id:"field-hb-skipDelivery"})}
422
+ </div>
423
+ <div class="field-row">
424
+ ${s(this.form,"heartbeat.ackMaxChars","Ack Max Chars",this._onChange,{id:"field-hb-ackMaxChars"})}
425
+ ${k(this.form,"heartbeat.responsePrefix","Response Prefix",this._onChange,{id:"field-hb-responsePrefix"})}
426
+ </div>
427
+ <div class="field-row">
428
+ ${s(this.form,"heartbeat.alertThreshold","Alert Threshold",this._onChange,{id:"field-hb-alertThreshold"})}
429
+ ${s(this.form,"heartbeat.alertCooldownMs","Alert Cooldown (ms)",this._onChange,{id:"field-hb-alertCooldownMs"})}
430
+ </div>
431
+ ${s(this.form,"heartbeat.staleMs","Stale Timeout (ms)",this._onChange,{id:"field-hb-staleMs"})}
432
+ `}};W.styles=x`
433
+ :host { display: block; }
434
+
435
+ .field {
436
+ display: flex;
437
+ flex-direction: column;
438
+ gap: 4px;
439
+ margin-bottom: var(--ic-space-md);
440
+ }
441
+
442
+ .field label {
443
+ font-size: var(--ic-text-xs);
444
+ color: var(--ic-text-dim);
445
+ text-transform: uppercase;
446
+ letter-spacing: 0.05em;
447
+ }
448
+
449
+ .field input,
450
+ .field textarea {
451
+ background: var(--ic-surface-2);
452
+ border: 1px solid var(--ic-border);
453
+ border-radius: var(--ic-radius-md);
454
+ padding: var(--ic-space-sm) var(--ic-space-md);
455
+ color: var(--ic-text);
456
+ font-family: inherit;
457
+ font-size: var(--ic-text-sm);
458
+ outline: none;
459
+ transition: border-color var(--ic-transition);
460
+ }
461
+
462
+ .field input:focus,
463
+ .field textarea:focus {
464
+ border-color: var(--ic-accent);
465
+ }
466
+
467
+ .field textarea {
468
+ min-height: 4rem;
469
+ resize: vertical;
470
+ }
471
+
472
+ .field-row {
473
+ display: grid;
474
+ grid-template-columns: 1fr 1fr;
475
+ gap: var(--ic-space-md);
476
+ }
477
+
478
+ .checkbox-field {
479
+ display: flex;
480
+ flex-direction: row;
481
+ align-items: center;
482
+ gap: var(--ic-space-sm);
483
+ margin-bottom: var(--ic-space-md);
484
+ }
485
+
486
+ .checkbox-field label {
487
+ font-size: var(--ic-text-sm);
488
+ color: var(--ic-text);
489
+ text-transform: none;
490
+ letter-spacing: normal;
491
+ cursor: pointer;
492
+ }
493
+
494
+ .checkbox-field input[type="checkbox"] {
495
+ width: 1rem;
496
+ height: 1rem;
497
+ accent-color: var(--ic-accent);
498
+ cursor: pointer;
499
+ }
500
+
501
+ .divider {
502
+ border: none;
503
+ border-top: 1px solid var(--ic-border);
504
+ margin: var(--ic-space-md) 0;
505
+ }
506
+
507
+ .section-title {
508
+ font-weight: 600;
509
+ margin-bottom: var(--ic-space-sm);
510
+ font-size: var(--ic-text-sm);
511
+ color: var(--ic-text);
512
+ }
513
+
514
+ @media (max-width: 767px) {
515
+ .field-row {
516
+ grid-template-columns: 1fr;
517
+ }
518
+ }
519
+ `;ue([v({attribute:!1})],W.prototype,"form",2);W=ue([_("ic-agent-heartbeat-editor")],W);var Ae=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,pe=(e,t,i,a)=>{for(var r=a>1?void 0:a?Se(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ae(t,i,r),r};let q=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}}render(){return l`
520
+ <div class="field-row">
521
+ ${b(this.form,"cacheRetention","Cache Retention",[{value:"",label:"Default (long)"},{value:"none",label:"None"},{value:"short",label:"Short (5 min)"},{value:"long",label:"Long (1 hr)"}],this._onChange,{id:"field-adv-cacheRetention"})}
522
+ ${s(this.form,"maxContextChars","Max Context Chars",this._onChange,{id:"field-adv-maxContextChars"})}
523
+ </div>
524
+
525
+ <hr class="divider" />
526
+ <div class="section-title">RAG</div>
527
+ ${h(this.form,"advanced.rag.enabled","Enabled",this._onChange,{id:"field-rag-enabled"})}
528
+ <div class="field-row">
529
+ ${s(this.form,"advanced.rag.maxResults","Max Results",this._onChange,{id:"field-rag-maxResults",min:"1"})}
530
+ ${s(this.form,"advanced.rag.minScore","Min Score",this._onChange,{id:"field-rag-minScore",step:"0.01",min:"0",max:"1"})}
531
+ </div>
532
+ <div class="section-title">Trust Levels</div>
533
+ <div class="checkbox-grid">
534
+ ${h(this.form,"rag.trustLevels.system","System",this._onChange,{id:"field-rag-trust-system"})}
535
+ ${h(this.form,"rag.trustLevels.learned","Learned",this._onChange,{id:"field-rag-trust-learned"})}
536
+ ${h(this.form,"rag.trustLevels.external","External",this._onChange,{id:"field-rag-trust-external"})}
537
+ </div>
538
+
539
+ <hr class="divider" />
540
+ <div class="section-title">Concurrency</div>
541
+ <div class="field-row">
542
+ ${s(this.form,"advanced.concurrency.maxConcurrent","Max Concurrent Runs",this._onChange,{id:"field-conc-max",min:"1"})}
543
+ ${s(this.form,"advanced.concurrency.maxQueued","Max Queued Per Session",this._onChange,{id:"field-conc-queued",min:"0"})}
544
+ </div>
545
+
546
+ <hr class="divider" />
547
+ <div class="section-title">Safety</div>
548
+ ${h(this.form,"safety.contextGuard.enabled","Context Guard",this._onChange,{id:"field-safety-cg-enabled"})}
549
+ <div class="field-row">
550
+ ${s(this.form,"safety.contextGuard.warnPct","Warn at %",this._onChange,{id:"field-safety-cg-warn",min:"0",max:"100"})}
551
+ ${s(this.form,"safety.contextGuard.blockPct","Block at %",this._onChange,{id:"field-safety-cg-block",min:"0",max:"100"})}
552
+ </div>
553
+ ${h(this.form,"safety.sdkRetry.enabled","SDK Retry",this._onChange,{id:"field-safety-sdk-enabled"})}
554
+ <div class="field-row">
555
+ ${s(this.form,"safety.sdkRetry.maxRetries","Max Retries",this._onChange,{id:"field-safety-sdk-retries",min:"0"})}
556
+ ${s(this.form,"safety.sdkRetry.baseDelayMs","Base Delay (ms)",this._onChange,{id:"field-safety-sdk-delay"})}
557
+ </div>
558
+
559
+ <hr class="divider" />
560
+ <div class="section-title">Circuit Breaker</div>
561
+ <div class="field-row">
562
+ ${s(this.form,"circuitBreaker.threshold","Failure Threshold",this._onChange,{id:"field-cb-threshold",min:"1"})}
563
+ ${s(this.form,"circuitBreaker.resetTimeoutMs","Reset Timeout (ms)",this._onChange,{id:"field-cb-resetMs"})}
564
+ </div>
565
+
566
+ <hr class="divider" />
567
+ <div class="section-title">Model Failover</div>
568
+ ${P(this.form,"failover.fallbackModels","Fallback Models (provider:model, one per line)",this._onChange,{id:"field-fo-fallback",placeholder:`openai:gpt-4o
569
+ anthropic:claude-sonnet-4-5-20250929`})}
570
+ ${P(this.form,"failover.allowedModels","Allowed Models (one per line)",this._onChange,{id:"field-fo-allowed"})}
571
+ <div class="field-row">
572
+ ${s(this.form,"failover.maxAttempts","Max Attempts",this._onChange,{id:"field-fo-maxAttempts",min:"1"})}
573
+ ${s(this.form,"failover.cooldownMs","Cooldown (ms)",this._onChange,{id:"field-fo-cooldown"})}
574
+ </div>
575
+ ${P(this.form,"failover.authProfiles","Auth Profiles (JSON)",this._onChange,{id:"field-fo-auth"})}
576
+
577
+ <hr class="divider" />
578
+ <div class="section-title">Elevated Reply</div>
579
+ ${h(this.form,"advanced.elevatedReply.enabled","Enabled",this._onChange,{id:"field-adv-elevated"})}
580
+ ${P(this.form,"advanced.elevatedReply.recipients","Recipients (one per line)",this._onChange,{id:"field-adv-elevated-recipients"})}
581
+
582
+ <hr class="divider" />
583
+ <div class="section-title">Tracing</div>
584
+ ${h(this.form,"advanced.tracing.enabled","Enabled",this._onChange,{id:"field-adv-tracing"})}
585
+ ${k(this.form,"advanced.tracing.outputDir","Output Dir",this._onChange,{id:"field-adv-tracing-dir",placeholder:"~/.comis/traces"})}
586
+
587
+ <hr class="divider" />
588
+ <div class="section-title">Secrets & Routing</div>
589
+ ${P(this.form,"advanced.secretsAccess","Secrets Access (JSON)",this._onChange,{id:"field-adv-secrets"})}
590
+ ${P(this.form,"advanced.bootstrap","Bootstrap (JSON)",this._onChange,{id:"field-adv-bootstrap"})}
591
+ ${P(this.form,"advanced.modelRoutes","Model Routes (JSON)",this._onChange,{id:"field-adv-modelRoutes"})}
592
+ ${k(this.form,"advanced.workspacePath","Workspace Path",this._onChange,{id:"field-adv-workspace"})}
593
+ `}};q.styles=x`
594
+ :host { display: block; }
595
+
596
+ .field {
597
+ display: flex;
598
+ flex-direction: column;
599
+ gap: 4px;
600
+ margin-bottom: var(--ic-space-md);
601
+ }
602
+
603
+ .field label {
604
+ font-size: var(--ic-text-xs);
605
+ color: var(--ic-text-dim);
606
+ text-transform: uppercase;
607
+ letter-spacing: 0.05em;
608
+ }
609
+
610
+ .field input,
611
+ .field select,
612
+ .field textarea {
613
+ background: var(--ic-surface-2);
614
+ border: 1px solid var(--ic-border);
615
+ border-radius: var(--ic-radius-md);
616
+ padding: var(--ic-space-sm) var(--ic-space-md);
617
+ color: var(--ic-text);
618
+ font-family: inherit;
619
+ font-size: var(--ic-text-sm);
620
+ outline: none;
621
+ transition: border-color var(--ic-transition);
622
+ }
623
+
624
+ .field input:focus,
625
+ .field select:focus,
626
+ .field textarea:focus {
627
+ border-color: var(--ic-accent);
628
+ }
629
+
630
+ .field textarea {
631
+ min-height: 4rem;
632
+ resize: vertical;
633
+ }
634
+
635
+ .field-row {
636
+ display: grid;
637
+ grid-template-columns: 1fr 1fr;
638
+ gap: var(--ic-space-md);
639
+ }
640
+
641
+ .checkbox-field {
642
+ display: flex;
643
+ flex-direction: row;
644
+ align-items: center;
645
+ gap: var(--ic-space-sm);
646
+ margin-bottom: var(--ic-space-md);
647
+ }
648
+
649
+ .checkbox-field label {
650
+ font-size: var(--ic-text-sm);
651
+ color: var(--ic-text);
652
+ text-transform: none;
653
+ letter-spacing: normal;
654
+ cursor: pointer;
655
+ }
656
+
657
+ .checkbox-field input[type="checkbox"] {
658
+ width: 1rem;
659
+ height: 1rem;
660
+ accent-color: var(--ic-accent);
661
+ cursor: pointer;
662
+ }
663
+
664
+ .checkbox-grid {
665
+ display: grid;
666
+ grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
667
+ gap: var(--ic-space-sm);
668
+ }
669
+
670
+ .divider {
671
+ border: none;
672
+ border-top: 1px solid var(--ic-border);
673
+ margin: var(--ic-space-md) 0;
674
+ }
675
+
676
+ .section-title {
677
+ font-weight: 600;
678
+ margin-bottom: var(--ic-space-sm);
679
+ font-size: var(--ic-text-sm);
680
+ color: var(--ic-text);
681
+ }
682
+
683
+ @media (max-width: 767px) {
684
+ .field-row {
685
+ grid-template-columns: 1fr;
686
+ }
687
+ }
688
+ `;pe([v({attribute:!1})],q.prototype,"form",2);q=pe([_("ic-agent-advanced-editor")],q);var Re=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,ve=(e,t,i,a)=>{for(var r=a>1?void 0:a?Oe(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Re(t,i,r),r};let J=class extends y{constructor(){super(...arguments),this.form={},this._onChange=(e,t)=>{this.dispatchEvent(new CustomEvent("field-change",{detail:{key:e,value:t},bubbles:!0,composed:!0}))}}render(){const e=E(this.form,"contextEngine.version","pipeline");return l`
689
+ <!-- Core fields (always visible) -->
690
+ ${h(this.form,"contextEngine.enabled","Enabled",this._onChange)}
691
+ ${b(this.form,"contextEngine.version","Mode",[{value:"pipeline",label:"Pipeline"},{value:"dag",label:"DAG"}],this._onChange)}
692
+
693
+ <hr class="divider" />
694
+
695
+ <!-- Shared fields (always visible) -->
696
+ <div class="section-title">Shared Settings</div>
697
+ ${s(this.form,"contextEngine.thinkingKeepTurns","Thinking Keep Turns",this._onChange,{min:"1",max:"50",placeholder:"10"})}
698
+ ${k(this.form,"contextEngine.compactionModel","Compaction Model",this._onChange,{placeholder:"anthropic:claude-haiku-4-5-20250929"})}
699
+ ${s(this.form,"contextEngine.evictionMinAge","Eviction Min Age (turns)",this._onChange,{min:"3",max:"50",placeholder:"15"})}
700
+
701
+ ${e==="pipeline"?this._renderPipelineFields():$}
702
+ ${e==="dag"?this._renderDagFields():$}
703
+ `}_renderPipelineFields(){return l`
704
+ <hr class="divider" />
705
+ <div class="section-title">Pipeline Settings</div>
706
+ ${s(this.form,"contextEngine.historyTurns","History Turns",this._onChange,{min:"3",max:"100",placeholder:"15"})}
707
+ ${s(this.form,"contextEngine.observationKeepWindow","Observation Keep Window",this._onChange,{min:"1",max:"50",placeholder:"25"})}
708
+ ${s(this.form,"contextEngine.observationTriggerChars","Observation Trigger Chars",this._onChange,{min:"50000",max:"1000000",placeholder:"120000"})}
709
+ ${s(this.form,"contextEngine.observationDeactivationChars","Observation Deactivation Chars",this._onChange,{min:"20000",max:"500000",placeholder:"80000"})}
710
+ ${s(this.form,"contextEngine.compactionCooldownTurns","Compaction Cooldown Turns",this._onChange,{min:"1",max:"50",placeholder:"5"})}
711
+ ${P(this.form,"contextEngine.historyTurnOverrides","History Turn Overrides (JSON)",this._onChange,{placeholder:'{"agentId": 20}'})}
712
+ `}_renderDagFields(){return l`
713
+ <hr class="divider" />
714
+ <div class="section-title">DAG Settings</div>
715
+ <div class="field-row">
716
+ ${s(this.form,"contextEngine.freshTailTurns","Fresh Tail Turns",this._onChange,{min:"1",max:"50",placeholder:"8"})}
717
+ ${s(this.form,"contextEngine.contextThreshold","Context Threshold",this._onChange,{step:"0.01",min:"0.1",max:"0.95",placeholder:"0.75"})}
718
+ </div>
719
+ <div class="field-row">
720
+ ${s(this.form,"contextEngine.leafMinFanout","Leaf Min Fanout",this._onChange,{min:"2",max:"20",placeholder:"8"})}
721
+ ${s(this.form,"contextEngine.condensedMinFanout","Condensed Min Fanout",this._onChange,{min:"2",max:"20",placeholder:"4"})}
722
+ </div>
723
+ <div class="field-row">
724
+ ${s(this.form,"contextEngine.condensedMinFanoutHard","Condensed Min Fanout Hard",this._onChange,{min:"2",max:"10",placeholder:"2"})}
725
+ ${s(this.form,"contextEngine.incrementalMaxDepth","Incremental Max Depth",this._onChange,{min:"-1",max:"10",placeholder:"0"})}
726
+ </div>
727
+ <div class="field-row">
728
+ ${s(this.form,"contextEngine.leafChunkTokens","Leaf Chunk Tokens",this._onChange,{min:"1000",max:"100000",placeholder:"20000"})}
729
+ ${s(this.form,"contextEngine.leafTargetTokens","Leaf Target Tokens",this._onChange,{min:"96",max:"5000",placeholder:"1200"})}
730
+ </div>
731
+ <div class="field-row">
732
+ ${s(this.form,"contextEngine.condensedTargetTokens","Condensed Target Tokens",this._onChange,{min:"256",max:"10000",placeholder:"2000"})}
733
+ ${s(this.form,"contextEngine.maxExpandTokens","Max Expand Tokens",this._onChange,{min:"500",max:"50000",placeholder:"4000"})}
734
+ </div>
735
+ <div class="field-row">
736
+ ${s(this.form,"contextEngine.maxRecallsPerDay","Max Recalls Per Day",this._onChange,{min:"1",max:"100",placeholder:"10"})}
737
+ ${s(this.form,"contextEngine.recallTimeoutMs","Recall Timeout (ms)",this._onChange,{min:"10000",max:"600000",placeholder:"120000"})}
738
+ </div>
739
+ ${s(this.form,"contextEngine.largeFileTokenThreshold","Large File Token Threshold",this._onChange,{min:"1000",max:"200000",placeholder:"25000"})}
740
+ <div class="field-row">
741
+ ${s(this.form,"contextEngine.annotationKeepWindow","Annotation Keep Window",this._onChange,{min:"1",max:"50",placeholder:"15"})}
742
+ ${s(this.form,"contextEngine.annotationTriggerChars","Annotation Trigger Chars",this._onChange,{min:"10000",max:"1000000",placeholder:"200000"})}
743
+ </div>
744
+ ${k(this.form,"contextEngine.summaryModel","Summary Model",this._onChange,{placeholder:"Override model for DAG summaries"})}
745
+ ${k(this.form,"contextEngine.summaryProvider","Summary Provider",this._onChange,{placeholder:"Override provider for DAG summaries"})}
746
+ `}};J.styles=x`
747
+ :host {
748
+ display: block;
749
+ }
750
+
751
+ .field {
752
+ display: flex;
753
+ flex-direction: column;
754
+ gap: 4px;
755
+ margin-bottom: var(--ic-space-md);
756
+ }
757
+
758
+ .field label {
759
+ font-size: var(--ic-text-xs);
760
+ color: var(--ic-text-dim);
761
+ text-transform: uppercase;
762
+ letter-spacing: 0.05em;
763
+ }
764
+
765
+ .field input,
766
+ .field select,
767
+ .field textarea {
768
+ background: var(--ic-surface-2);
769
+ border: 1px solid var(--ic-border);
770
+ border-radius: var(--ic-radius-md);
771
+ padding: var(--ic-space-sm) var(--ic-space-md);
772
+ color: var(--ic-text);
773
+ font-family: inherit;
774
+ font-size: var(--ic-text-sm);
775
+ outline: none;
776
+ transition: border-color var(--ic-transition);
777
+ }
778
+
779
+ .field input:focus,
780
+ .field select:focus,
781
+ .field textarea:focus {
782
+ border-color: var(--ic-accent);
783
+ }
784
+
785
+ .field textarea {
786
+ min-height: 60px;
787
+ resize: vertical;
788
+ }
789
+
790
+ .checkbox-field {
791
+ display: flex;
792
+ align-items: center;
793
+ gap: var(--ic-space-sm);
794
+ margin-bottom: var(--ic-space-md);
795
+ }
796
+
797
+ .checkbox-field label {
798
+ font-size: var(--ic-text-sm);
799
+ color: var(--ic-text);
800
+ cursor: pointer;
801
+ }
802
+
803
+ .checkbox-field input[type="checkbox"] {
804
+ width: 16px;
805
+ height: 16px;
806
+ cursor: pointer;
807
+ }
808
+
809
+ .field-row {
810
+ display: grid;
811
+ grid-template-columns: 1fr 1fr;
812
+ gap: var(--ic-space-md);
813
+ }
814
+
815
+ .section-title {
816
+ font-size: var(--ic-text-sm);
817
+ font-weight: 600;
818
+ color: var(--ic-text);
819
+ margin-top: var(--ic-space-md);
820
+ margin-bottom: var(--ic-space-sm);
821
+ }
822
+
823
+ .divider {
824
+ border: none;
825
+ border-top: 1px solid var(--ic-border);
826
+ margin: var(--ic-space-md) 0;
827
+ }
828
+
829
+ @media (max-width: 767px) {
830
+ .field-row {
831
+ grid-template-columns: 1fr;
832
+ }
833
+ }
834
+ `;ve([v({attribute:!1})],J.prototype,"form",2);J=ve([_("ic-agent-context-engine-editor")],J);var Ne=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,me=(e,t,i,a)=>{for(var r=a>1?void 0:a?Fe(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ne(t,i,r),r};let U=class extends y{constructor(){super(...arguments),this.config={},this._onRootChange=(e,t)=>{this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"streaming",key:e,value:t},bubbles:!0,composed:!0}))},this._onTimingChange=(e,t)=>{const i=this.config.defaultDeliveryTiming??{};this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"streaming",key:"defaultDeliveryTiming",value:{...i,[e]:t}},bubbles:!0,composed:!0}))},this._onCoalescerChange=(e,t)=>{const i=this.config.defaultCoalescer??{};this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"streaming",key:"defaultCoalescer",value:{...i,[e]:t}},bubbles:!0,composed:!0}))}}_getConfig(e,t){const i=this.config[e];return i??t}_getTimingField(e,t){const a=this.config.defaultDeliveryTiming?.[e];return a??t}_getCoalescerField(e,t){const a=this.config.defaultCoalescer?.[e];return a??t}_rootForm(){return new Proxy({},{get:(e,t)=>this._getConfig(t,void 0)})}_timingForm(){return new Proxy({},{get:(e,t)=>this._getTimingField(t,void 0)})}_coalescerForm(){return new Proxy({},{get:(e,t)=>this._getCoalescerField(t,void 0)})}render(){const e=this._rootForm(),t=this._timingForm(),i=this._coalescerForm();return l`
835
+ <!-- Defaults -->
836
+ ${h(e,"enabled","Enabled",this._onRootChange)}
837
+
838
+ <div class="field-row">
839
+ ${b(e,"defaultChunkMode","Default Chunk Mode",[{value:"paragraph",label:"Paragraph"},{value:"newline",label:"Newline"},{value:"sentence",label:"Sentence"},{value:"length",label:"Length"}],this._onRootChange)}
840
+ ${b(e,"defaultTypingMode","Default Typing Mode",[{value:"never",label:"Never"},{value:"instant",label:"Instant"},{value:"thinking",label:"Thinking"},{value:"message",label:"Message"}],this._onRootChange)}
841
+ </div>
842
+
843
+ <div class="field-row">
844
+ ${s(e,"defaultTypingRefreshMs","Default Typing Refresh (ms)",this._onRootChange,{placeholder:"6000"})}
845
+ ${b(e,"defaultTableMode","Default Table Mode",[{value:"code",label:"Code"},{value:"bullets",label:"Bullets"},{value:"off",label:"Off"}],this._onRootChange)}
846
+ </div>
847
+
848
+ <div class="field-row">
849
+ ${h(e,"defaultUseMarkdownIR","Use Markdown IR",this._onRootChange)}
850
+ ${b(e,"defaultReplyMode","Default Reply Mode",[{value:"off",label:"Off"},{value:"first",label:"First"},{value:"all",label:"All"}],this._onRootChange)}
851
+ </div>
852
+
853
+ <!-- Delivery Timing -->
854
+ <div class="section-divider">Delivery Timing</div>
855
+
856
+ ${b(t,"mode","Mode",[{value:"off",label:"Off"},{value:"natural",label:"Natural"},{value:"custom",label:"Custom"},{value:"adaptive",label:"Adaptive"}],this._onTimingChange)}
857
+
858
+ <div class="field-row">
859
+ ${s(t,"minMs","Min (ms)",this._onTimingChange,{placeholder:"800"})}
860
+ ${s(t,"maxMs","Max (ms)",this._onTimingChange,{placeholder:"2500"})}
861
+ </div>
862
+
863
+ <div class="field-row">
864
+ ${s(t,"jitterMs","Jitter (ms)",this._onTimingChange,{placeholder:"200"})}
865
+ ${s(t,"firstBlockDelayMs","First Block Delay (ms)",this._onTimingChange,{placeholder:"0"})}
866
+ </div>
867
+
868
+ <!-- Block Coalescer -->
869
+ <div class="section-divider">Block Coalescer</div>
870
+
871
+ <div class="field-row">
872
+ ${s(i,"minChars","Min Chars",this._onCoalescerChange,{placeholder:"0"})}
873
+ ${s(i,"maxChars","Max Chars",this._onCoalescerChange,{placeholder:"500"})}
874
+ </div>
875
+
876
+ <div class="field-row">
877
+ ${s(i,"idleMs","Idle (ms)",this._onCoalescerChange,{placeholder:"1500"})}
878
+ ${b(i,"codeBlockPolicy","Code Block Policy",[{value:"standalone",label:"Standalone"},{value:"coalesce",label:"Coalesce"}],this._onCoalescerChange)}
879
+ </div>
880
+
881
+ ${h(i,"adaptiveIdle","Adaptive Idle",this._onCoalescerChange)}
882
+ `}};U.styles=x`
883
+ :host { display: block; }
884
+
885
+ .field {
886
+ display: flex;
887
+ flex-direction: column;
888
+ gap: 4px;
889
+ margin-bottom: var(--ic-space-md);
890
+ }
891
+
892
+ .field label {
893
+ font-size: var(--ic-text-xs);
894
+ color: var(--ic-text-dim);
895
+ text-transform: uppercase;
896
+ letter-spacing: 0.05em;
897
+ }
898
+
899
+ .field input,
900
+ .field select {
901
+ background: var(--ic-surface-2);
902
+ border: 1px solid var(--ic-border);
903
+ border-radius: var(--ic-radius-md);
904
+ padding: var(--ic-space-sm) var(--ic-space-md);
905
+ color: var(--ic-text);
906
+ font-family: inherit;
907
+ font-size: var(--ic-text-sm);
908
+ outline: none;
909
+ transition: border-color var(--ic-transition);
910
+ }
911
+
912
+ .field input:focus,
913
+ .field select:focus {
914
+ border-color: var(--ic-accent);
915
+ }
916
+
917
+ .checkbox-field {
918
+ display: flex;
919
+ align-items: center;
920
+ gap: var(--ic-space-sm);
921
+ margin-bottom: var(--ic-space-md);
922
+ }
923
+
924
+ .checkbox-field label {
925
+ font-size: var(--ic-text-sm);
926
+ color: var(--ic-text);
927
+ cursor: pointer;
928
+ }
929
+
930
+ .checkbox-field input[type="checkbox"] {
931
+ accent-color: var(--ic-accent);
932
+ }
933
+
934
+ .field-row {
935
+ display: grid;
936
+ grid-template-columns: 1fr 1fr;
937
+ gap: var(--ic-space-md);
938
+ }
939
+
940
+ .section-divider {
941
+ margin: var(--ic-space-lg) 0 var(--ic-space-md);
942
+ padding-bottom: var(--ic-space-sm);
943
+ border-bottom: 1px solid var(--ic-border);
944
+ font-size: var(--ic-text-xs);
945
+ font-weight: 600;
946
+ color: var(--ic-text-dim);
947
+ text-transform: uppercase;
948
+ letter-spacing: 0.05em;
949
+ }
950
+
951
+ @media (max-width: 767px) {
952
+ .field-row {
953
+ grid-template-columns: 1fr;
954
+ }
955
+ }
956
+ `;me([v({attribute:!1})],U.prototype,"config",2);U=me([_("ic-agent-streaming-editor")],U);var Le=Object.defineProperty,Ie=Object.getOwnPropertyDescriptor,ee=(e,t,i,a)=>{for(var r=a>1?void 0:a?Ie(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Le(t,i,r),r};let z=class extends y{constructor(){super(...arguments),this.deliveryQueueConfig={},this.deliveryMirrorConfig={},this._onQueueChange=(e,t)=>{this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"deliveryQueue",key:e,value:t},bubbles:!0,composed:!0}))},this._onMirrorChange=(e,t)=>{this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"deliveryMirror",key:e,value:t},bubbles:!0,composed:!0}))}}_queueForm(){const e=this.deliveryQueueConfig;return new Proxy({},{get:(t,i)=>{const a=e[i];return a??void 0}})}_mirrorForm(){const e=this.deliveryMirrorConfig;return new Proxy({},{get:(t,i)=>{const a=e[i];return a??void 0}})}render(){const e=this._queueForm(),t=this._mirrorForm();return l`
957
+ <!-- Delivery Queue -->
958
+ ${h(e,"enabled","Enabled",this._onQueueChange)}
959
+
960
+ <div class="field-row">
961
+ ${s(e,"maxQueueDepth","Max Queue Depth",this._onQueueChange,{placeholder:"10000"})}
962
+ ${s(e,"defaultMaxAttempts","Default Max Attempts",this._onQueueChange,{placeholder:"5"})}
963
+ </div>
964
+
965
+ <div class="field-row">
966
+ ${s(e,"defaultExpireMs","Default Expire (ms)",this._onQueueChange,{placeholder:"3600000"})}
967
+ ${h(e,"drainOnStartup","Drain on Startup",this._onQueueChange)}
968
+ </div>
969
+
970
+ <div class="field-row">
971
+ ${s(e,"drainBudgetMs","Drain Budget (ms)",this._onQueueChange,{placeholder:"60000"})}
972
+ ${s(e,"pruneIntervalMs","Prune Interval (ms)",this._onQueueChange,{placeholder:"300000"})}
973
+ </div>
974
+
975
+ <!-- Delivery Mirror -->
976
+ <div class="section-divider">Delivery Mirror</div>
977
+
978
+ ${h(t,"enabled","Enabled",this._onMirrorChange)}
979
+
980
+ <div class="field-row">
981
+ ${s(t,"retentionMs","Retention (ms)",this._onMirrorChange,{placeholder:"86400000"})}
982
+ ${s(t,"pruneIntervalMs","Prune Interval (ms)",this._onMirrorChange,{placeholder:"300000"})}
983
+ </div>
984
+
985
+ <div class="field-row">
986
+ ${s(t,"maxEntriesPerInjection","Max Entries per Injection",this._onMirrorChange,{placeholder:"10"})}
987
+ ${s(t,"maxCharsPerInjection","Max Chars per Injection",this._onMirrorChange,{placeholder:"4000"})}
988
+ </div>
989
+ `}};z.styles=x`
990
+ :host { display: block; }
991
+
992
+ .field {
993
+ display: flex;
994
+ flex-direction: column;
995
+ gap: 4px;
996
+ margin-bottom: var(--ic-space-md);
997
+ }
998
+
999
+ .field label {
1000
+ font-size: var(--ic-text-xs);
1001
+ color: var(--ic-text-dim);
1002
+ text-transform: uppercase;
1003
+ letter-spacing: 0.05em;
1004
+ }
1005
+
1006
+ .field input {
1007
+ background: var(--ic-surface-2);
1008
+ border: 1px solid var(--ic-border);
1009
+ border-radius: var(--ic-radius-md);
1010
+ padding: var(--ic-space-sm) var(--ic-space-md);
1011
+ color: var(--ic-text);
1012
+ font-family: inherit;
1013
+ font-size: var(--ic-text-sm);
1014
+ outline: none;
1015
+ transition: border-color var(--ic-transition);
1016
+ }
1017
+
1018
+ .field input:focus {
1019
+ border-color: var(--ic-accent);
1020
+ }
1021
+
1022
+ .checkbox-field {
1023
+ display: flex;
1024
+ align-items: center;
1025
+ gap: var(--ic-space-sm);
1026
+ margin-bottom: var(--ic-space-md);
1027
+ }
1028
+
1029
+ .checkbox-field label {
1030
+ font-size: var(--ic-text-sm);
1031
+ color: var(--ic-text);
1032
+ cursor: pointer;
1033
+ }
1034
+
1035
+ .checkbox-field input[type="checkbox"] {
1036
+ accent-color: var(--ic-accent);
1037
+ }
1038
+
1039
+ .field-row {
1040
+ display: grid;
1041
+ grid-template-columns: 1fr 1fr;
1042
+ gap: var(--ic-space-md);
1043
+ }
1044
+
1045
+ .section-divider {
1046
+ margin: var(--ic-space-lg) 0 var(--ic-space-md);
1047
+ padding-bottom: var(--ic-space-sm);
1048
+ border-bottom: 1px solid var(--ic-border);
1049
+ font-size: var(--ic-text-xs);
1050
+ font-weight: 600;
1051
+ color: var(--ic-text-dim);
1052
+ text-transform: uppercase;
1053
+ letter-spacing: 0.05em;
1054
+ }
1055
+
1056
+ @media (max-width: 767px) {
1057
+ .field-row {
1058
+ grid-template-columns: 1fr;
1059
+ }
1060
+ }
1061
+ `;ee([v({attribute:!1})],z.prototype,"deliveryQueueConfig",2);ee([v({attribute:!1})],z.prototype,"deliveryMirrorConfig",2);z=ee([_("ic-agent-delivery-editor")],z);var ze=Object.defineProperty,je=Object.getOwnPropertyDescriptor,L=(e,t,i,a)=>{for(var r=a>1?void 0:a?je(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&ze(t,i,r),r};let R=class extends y{constructor(){super(...arguments),this.label="",this.value={},this._newKey="",this._newValue="",this._error=""}_addPair(){const e=this._newKey.trim(),t=this._newValue.trim();if(!e){this._error="Key cannot be empty";return}if(e in this.value){this._error=`Key "${e}" already exists`;return}this._error="";const i={...this.value,[e]:t};this._newKey="",this._newValue="",this.dispatchEvent(new CustomEvent("change",{detail:i,bubbles:!0,composed:!0}))}_removePair(e){const t={...this.value};delete t[e],this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))}_onKeyDown(e){e.key==="Enter"&&(e.preventDefault(),this._addPair())}render(){const e=Object.entries(this.value);return l`
1062
+ ${this.label?l`<div class="editor-label">${this.label}</div>`:$}
1063
+ ${e.length>0?l`
1064
+ <div class="pair-list">
1065
+ ${e.map(([t,i])=>l`
1066
+ <div class="pair-row">
1067
+ <span class="pair-key">${t}</span>
1068
+ <span class="pair-value">${i}</span>
1069
+ <button
1070
+ class="remove-btn"
1071
+ aria-label="Remove ${t}"
1072
+ @click=${()=>this._removePair(t)}
1073
+ >\u2715</button>
1074
+ </div>
1075
+ `)}
1076
+ </div>
1077
+ `:$}
1078
+ <div class="add-row">
1079
+ <input
1080
+ class="add-input"
1081
+ type="text"
1082
+ placeholder="Key"
1083
+ .value=${this._newKey}
1084
+ @input=${t=>{this._newKey=t.target.value}}
1085
+ @keydown=${this._onKeyDown}
1086
+ />
1087
+ <input
1088
+ class="add-input"
1089
+ type="text"
1090
+ placeholder="Value"
1091
+ .value=${this._newValue}
1092
+ @input=${t=>{this._newValue=t.target.value}}
1093
+ @keydown=${this._onKeyDown}
1094
+ />
1095
+ <button class="add-btn" @click=${()=>this._addPair()}>Add</button>
1096
+ </div>
1097
+ ${this._error?l`<div class="error-text">${this._error}</div>`:$}
1098
+ `}};R.styles=[se,le,x`
1099
+ :host {
1100
+ display: block;
1101
+ }
1102
+
1103
+ .editor-label {
1104
+ font-size: var(--ic-text-sm);
1105
+ font-weight: 600;
1106
+ color: var(--ic-text-muted);
1107
+ margin-bottom: var(--ic-space-sm);
1108
+ }
1109
+
1110
+ .pair-list {
1111
+ display: flex;
1112
+ flex-direction: column;
1113
+ gap: var(--ic-space-xs);
1114
+ margin-bottom: var(--ic-space-sm);
1115
+ }
1116
+
1117
+ .pair-row {
1118
+ display: grid;
1119
+ grid-template-columns: 1fr 1fr auto;
1120
+ gap: var(--ic-space-xs);
1121
+ align-items: center;
1122
+ background: var(--ic-surface);
1123
+ border: 1px solid var(--ic-border);
1124
+ border-radius: var(--ic-radius-md);
1125
+ padding: var(--ic-space-xs) var(--ic-space-sm);
1126
+ }
1127
+
1128
+ .pair-key,
1129
+ .pair-value {
1130
+ font-size: var(--ic-text-sm);
1131
+ color: var(--ic-text);
1132
+ word-break: break-all;
1133
+ }
1134
+
1135
+ .pair-key {
1136
+ font-weight: 500;
1137
+ }
1138
+
1139
+ .pair-value {
1140
+ color: var(--ic-text-muted);
1141
+ }
1142
+
1143
+ .remove-btn {
1144
+ background: none;
1145
+ border: none;
1146
+ color: var(--ic-text-dim);
1147
+ cursor: pointer;
1148
+ padding: 2px 4px;
1149
+ font-size: var(--ic-text-xs);
1150
+ line-height: 1;
1151
+ border-radius: var(--ic-radius-sm);
1152
+ }
1153
+
1154
+ .remove-btn:hover {
1155
+ color: var(--ic-error);
1156
+ }
1157
+
1158
+ .add-row {
1159
+ display: grid;
1160
+ grid-template-columns: 1fr 1fr auto;
1161
+ gap: var(--ic-space-xs);
1162
+ align-items: center;
1163
+ }
1164
+
1165
+ .add-input {
1166
+ padding: 0.375rem 0.5rem;
1167
+ background: var(--ic-surface-2);
1168
+ border: 1px solid var(--ic-border);
1169
+ border-radius: var(--ic-radius-md);
1170
+ color: var(--ic-text);
1171
+ font-family: inherit;
1172
+ font-size: var(--ic-text-sm);
1173
+ }
1174
+
1175
+ .add-input:focus {
1176
+ outline: none;
1177
+ border-color: var(--ic-accent);
1178
+ }
1179
+
1180
+ .add-input::placeholder {
1181
+ color: var(--ic-text-dim);
1182
+ }
1183
+
1184
+ .add-btn {
1185
+ padding: 0.375rem 0.75rem;
1186
+ background: var(--ic-accent);
1187
+ color: white;
1188
+ border: none;
1189
+ border-radius: var(--ic-radius-md);
1190
+ font-size: var(--ic-text-sm);
1191
+ cursor: pointer;
1192
+ white-space: nowrap;
1193
+ }
1194
+
1195
+ .add-btn:hover {
1196
+ opacity: 0.9;
1197
+ }
1198
+
1199
+ .error-text {
1200
+ color: var(--ic-error);
1201
+ font-size: var(--ic-text-xs);
1202
+ margin-top: var(--ic-space-xs);
1203
+ }
1204
+ `];L([v()],R.prototype,"label",2);L([v({type:Object})],R.prototype,"value",2);L([p()],R.prototype,"_newKey",2);L([p()],R.prototype,"_newValue",2);L([p()],R.prototype,"_error",2);R=L([_("ic-json-editor")],R);var Be=Object.defineProperty,He=Object.getOwnPropertyDescriptor,fe=(e,t,i,a)=>{for(var r=a>1?void 0:a?He(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Be(t,i,r),r};let V=class extends y{constructor(){super(...arguments),this.config={},this._onChange=(e,t)=>{this._emit(e,t)},this._handleLanesChange=e=>{const t=e.detail,i=[];for(const[,a]of Object.entries(t))try{i.push(JSON.parse(a))}catch{}this._emit("priorityLanes",i)}}_emit(e,t){this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"queue",key:e,value:t},bubbles:!0,composed:!0}))}_onNestedChange(e,t,i){const a=this.config[e]??{};this._emit(e,{...a,[t]:i})}render(){const e=this.config,t=this.config.defaultOverflow??{},i=this.config.defaultDebounceBuffer??{},a=this.config.followup??{};return l`
1205
+ <div class="section-title">Basic</div>
1206
+ ${h(e,"enabled","Enabled",this._onChange)}
1207
+ <div class="field-row">
1208
+ ${s(e,"maxConcurrentSessions","Max Concurrent Sessions",this._onChange,{placeholder:"10"})}
1209
+ ${s(e,"cleanupIdleMs","Cleanup Idle (ms)",this._onChange,{placeholder:"600000"})}
1210
+ </div>
1211
+ ${b(e,"defaultMode","Default Mode",[{value:"followup",label:"Follow-up"},{value:"collect",label:"Collect"},{value:"steer",label:"Steer"},{value:"steer+followup",label:"Steer + Follow-up"}],this._onChange)}
1212
+
1213
+ <hr class="divider" />
1214
+ <div class="section-title">Overflow</div>
1215
+ <div class="field-row">
1216
+ ${s(t,"maxDepth","Max Depth",(r,o)=>this._onNestedChange("defaultOverflow","maxDepth",o),{placeholder:"100"})}
1217
+ ${b(t,"policy","Policy",[{value:"drop-old",label:"Drop Old"},{value:"drop-new",label:"Drop New"},{value:"summarize",label:"Summarize"}],(r,o)=>this._onNestedChange("defaultOverflow","policy",o))}
1218
+ </div>
1219
+
1220
+ <hr class="divider" />
1221
+ <div class="section-title">Debounce Buffer</div>
1222
+ <div class="field-row">
1223
+ ${s(i,"windowMs","Window (ms)",(r,o)=>this._onNestedChange("defaultDebounceBuffer","windowMs",o),{placeholder:"0"})}
1224
+ ${s(i,"maxBufferedMessages","Max Buffered Messages",(r,o)=>this._onNestedChange("defaultDebounceBuffer","maxBufferedMessages",o),{placeholder:"10"})}
1225
+ </div>
1226
+ ${h(i,"firstMessageImmediate","First Message Immediate",(r,o)=>this._onNestedChange("defaultDebounceBuffer","firstMessageImmediate",o))}
1227
+
1228
+ <hr class="divider" />
1229
+ <div class="section-title">Follow-up</div>
1230
+ <div class="field-row">
1231
+ ${s(a,"maxFollowupRuns","Max Follow-up Runs",(r,o)=>this._onNestedChange("followup","maxFollowupRuns",o),{placeholder:"3"})}
1232
+ </div>
1233
+ ${h(a,"followupOnCompaction","Follow-up on Compaction",(r,o)=>this._onNestedChange("followup","followupOnCompaction",o))}
1234
+
1235
+ <hr class="divider" />
1236
+ <div class="section-title">Priority Lanes</div>
1237
+ ${h(e,"priorityEnabled","Priority Enabled",this._onChange)}
1238
+ <div class="json-section">
1239
+ <ic-json-editor
1240
+ label="Priority Lanes (key-value)"
1241
+ .value=${this._lanesToRecord()}
1242
+ @change=${this._handleLanesChange}
1243
+ ></ic-json-editor>
1244
+ </div>
1245
+ `}_lanesToRecord(){const e=this.config.priorityLanes;if(!Array.isArray(e))return{};const t={};for(const i of e)if(i&&typeof i=="object"){const a=i,r=String(a.name??a.label??`lane-${Object.keys(t).length}`);t[r]=JSON.stringify(a)}return t}};V.styles=x`
1246
+ :host { display: block; }
1247
+
1248
+ .field {
1249
+ display: flex;
1250
+ flex-direction: column;
1251
+ gap: 4px;
1252
+ margin-bottom: var(--ic-space-md);
1253
+ }
1254
+
1255
+ .field label {
1256
+ font-size: var(--ic-text-xs);
1257
+ color: var(--ic-text-dim);
1258
+ text-transform: uppercase;
1259
+ letter-spacing: 0.05em;
1260
+ }
1261
+
1262
+ .field input,
1263
+ .field select {
1264
+ background: var(--ic-surface-2);
1265
+ border: 1px solid var(--ic-border);
1266
+ border-radius: var(--ic-radius-md);
1267
+ padding: var(--ic-space-sm) var(--ic-space-md);
1268
+ color: var(--ic-text);
1269
+ font-family: inherit;
1270
+ font-size: var(--ic-text-sm);
1271
+ outline: none;
1272
+ transition: border-color var(--ic-transition);
1273
+ }
1274
+
1275
+ .field input:focus,
1276
+ .field select:focus {
1277
+ border-color: var(--ic-accent);
1278
+ }
1279
+
1280
+ .checkbox-field {
1281
+ display: flex;
1282
+ align-items: center;
1283
+ gap: var(--ic-space-sm);
1284
+ margin-bottom: var(--ic-space-md);
1285
+ }
1286
+
1287
+ .checkbox-field label {
1288
+ font-size: var(--ic-text-sm);
1289
+ color: var(--ic-text);
1290
+ cursor: pointer;
1291
+ }
1292
+
1293
+ .checkbox-field input[type="checkbox"] {
1294
+ accent-color: var(--ic-accent);
1295
+ }
1296
+
1297
+ .field-row {
1298
+ display: grid;
1299
+ grid-template-columns: 1fr 1fr;
1300
+ gap: var(--ic-space-md);
1301
+ }
1302
+
1303
+ .section-title {
1304
+ font-size: var(--ic-text-sm);
1305
+ font-weight: 600;
1306
+ color: var(--ic-text);
1307
+ margin-top: var(--ic-space-lg);
1308
+ margin-bottom: var(--ic-space-sm);
1309
+ }
1310
+
1311
+ .divider {
1312
+ border: none;
1313
+ border-top: 1px solid var(--ic-border);
1314
+ margin: var(--ic-space-md) 0 var(--ic-space-xs);
1315
+ }
1316
+
1317
+ .json-section {
1318
+ margin-top: var(--ic-space-sm);
1319
+ }
1320
+
1321
+ @media (max-width: 767px) {
1322
+ .field-row {
1323
+ grid-template-columns: 1fr;
1324
+ }
1325
+ }
1326
+ `;fe([v({attribute:!1})],V.prototype,"config",2);V=fe([_("ic-agent-queue-editor")],V);var Ke=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,ge=(e,t,i,a)=>{for(var r=a>1?void 0:a?Ge(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ke(t,i,r),r};let Y=class extends y{constructor(){super(...arguments),this.config={},this._onChange=(e,t)=>{this._emit(e,t)}}_emit(e,t){this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"autoReplyEngine",key:e,value:t},bubbles:!0,composed:!0}))}render(){const e=this.config,t=E(e,"customPatterns",[]);return l`
1327
+ ${h(e,"enabled","Enabled",this._onChange)}
1328
+ ${b(e,"groupActivation","Group Activation",[{value:"always",label:"Always"},{value:"mention-gated",label:"Mention-Gated"},{value:"custom",label:"Custom"}],this._onChange)}
1329
+
1330
+ <div class="patterns-section">
1331
+ <ic-array-editor
1332
+ label="Custom Patterns"
1333
+ .items=${Array.isArray(t)?t:[]}
1334
+ placeholder="Add regex pattern..."
1335
+ @change=${i=>this._emit("customPatterns",i.detail)}
1336
+ ></ic-array-editor>
1337
+ </div>
1338
+
1339
+ ${h(e,"historyInjection","History Injection",this._onChange)}
1340
+ <div class="field-row">
1341
+ ${s(e,"maxHistoryInjections","Max History Injections",this._onChange,{placeholder:"50"})}
1342
+ ${s(e,"maxGroupHistoryMessages","Max Group History Messages",this._onChange,{placeholder:"20"})}
1343
+ </div>
1344
+ `}};Y.styles=x`
1345
+ :host { display: block; }
1346
+
1347
+ .field {
1348
+ display: flex;
1349
+ flex-direction: column;
1350
+ gap: 4px;
1351
+ margin-bottom: var(--ic-space-md);
1352
+ }
1353
+
1354
+ .field label {
1355
+ font-size: var(--ic-text-xs);
1356
+ color: var(--ic-text-dim);
1357
+ text-transform: uppercase;
1358
+ letter-spacing: 0.05em;
1359
+ }
1360
+
1361
+ .field input,
1362
+ .field select {
1363
+ background: var(--ic-surface-2);
1364
+ border: 1px solid var(--ic-border);
1365
+ border-radius: var(--ic-radius-md);
1366
+ padding: var(--ic-space-sm) var(--ic-space-md);
1367
+ color: var(--ic-text);
1368
+ font-family: inherit;
1369
+ font-size: var(--ic-text-sm);
1370
+ outline: none;
1371
+ transition: border-color var(--ic-transition);
1372
+ }
1373
+
1374
+ .field input:focus,
1375
+ .field select:focus {
1376
+ border-color: var(--ic-accent);
1377
+ }
1378
+
1379
+ .checkbox-field {
1380
+ display: flex;
1381
+ align-items: center;
1382
+ gap: var(--ic-space-sm);
1383
+ margin-bottom: var(--ic-space-md);
1384
+ }
1385
+
1386
+ .checkbox-field label {
1387
+ font-size: var(--ic-text-sm);
1388
+ color: var(--ic-text);
1389
+ cursor: pointer;
1390
+ }
1391
+
1392
+ .checkbox-field input[type="checkbox"] {
1393
+ accent-color: var(--ic-accent);
1394
+ }
1395
+
1396
+ .field-row {
1397
+ display: grid;
1398
+ grid-template-columns: 1fr 1fr;
1399
+ gap: var(--ic-space-md);
1400
+ }
1401
+
1402
+ .patterns-section {
1403
+ margin-bottom: var(--ic-space-md);
1404
+ }
1405
+
1406
+ @media (max-width: 767px) {
1407
+ .field-row {
1408
+ grid-template-columns: 1fr;
1409
+ }
1410
+ }
1411
+ `;ge([v({attribute:!1})],Y.prototype,"config",2);Y=ge([_("ic-agent-auto-reply-editor")],Y);var Qe=Object.defineProperty,We=Object.getOwnPropertyDescriptor,te=(e,t,i,a)=>{for(var r=a>1?void 0:a?We(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Qe(t,i,r),r};let j=class extends y{constructor(){super(...arguments),this.config={},this._rules=[],this._onChange=(e,t)=>{this._emit(e,t)}}willUpdate(e){if(e.has("config")&&this.config.rules){const t=this.config.rules;Array.isArray(t)&&(this._rules=t.map(i=>{const a=i;return{channelType:a.channelType??"any",chatType:a.chatType??"any",channelId:a.channelId??"",action:a.action??"allow",description:a.description??""}}))}}_emit(e,t){this.dispatchEvent(new CustomEvent("config-change",{detail:{section:"sendPolicy",key:e,value:t},bubbles:!0,composed:!0}))}_addRule(){this._rules=[...this._rules,{channelType:"any",chatType:"any",channelId:"",action:"allow",description:""}],this._emitRules()}_removeRule(e){this._rules=this._rules.filter((t,i)=>i!==e),this._emitRules()}_updateRule(e,t,i){this._rules=this._rules.map((a,r)=>r===e?{...a,[t]:i}:a),this._emitRules()}_emitRules(){this._emit("rules",this._rules)}render(){const e=this.config;return l`
1412
+ ${h(e,"enabled","Enabled",this._onChange)}
1413
+ ${b(e,"defaultAction","Default Action",[{value:"allow",label:"Allow"},{value:"deny",label:"Deny"}],this._onChange)}
1414
+
1415
+ <hr class="divider" />
1416
+ <div class="section-title">Rules</div>
1417
+
1418
+ ${this._rules.length>0?l`
1419
+ <div class="rules-list">
1420
+ ${this._rules.map((t,i)=>l`
1421
+ <div class="rule-row">
1422
+ <select
1423
+ .value=${t.channelType??"any"}
1424
+ @change=${a=>this._updateRule(i,"channelType",a.target.value)}
1425
+ >
1426
+ <option value="any">Any Channel</option>
1427
+ <option value="telegram">Telegram</option>
1428
+ <option value="discord">Discord</option>
1429
+ <option value="slack">Slack</option>
1430
+ <option value="whatsapp">WhatsApp</option>
1431
+ <option value="signal">Signal</option>
1432
+ <option value="irc">IRC</option>
1433
+ <option value="line">LINE</option>
1434
+ </select>
1435
+ <select
1436
+ .value=${t.chatType??"any"}
1437
+ @change=${a=>this._updateRule(i,"chatType",a.target.value)}
1438
+ >
1439
+ <option value="any">Any Chat</option>
1440
+ <option value="dm">DM</option>
1441
+ <option value="group">Group</option>
1442
+ <option value="thread">Thread</option>
1443
+ </select>
1444
+ <input
1445
+ type="text"
1446
+ placeholder="channelId (optional)"
1447
+ .value=${t.channelId??""}
1448
+ @input=${a=>this._updateRule(i,"channelId",a.target.value)}
1449
+ />
1450
+ <select
1451
+ .value=${t.action??"allow"}
1452
+ @change=${a=>this._updateRule(i,"action",a.target.value)}
1453
+ >
1454
+ <option value="allow">Allow</option>
1455
+ <option value="deny">Deny</option>
1456
+ </select>
1457
+ <input
1458
+ type="text"
1459
+ placeholder="description (optional)"
1460
+ .value=${t.description??""}
1461
+ @input=${a=>this._updateRule(i,"description",a.target.value)}
1462
+ />
1463
+ <button class="btn-icon" @click=${()=>this._removeRule(i)} aria-label="Remove rule">\u2715</button>
1464
+ </div>
1465
+ `)}
1466
+ </div>
1467
+ `:l`<div class="empty-hint">No rules defined. Default action applies to all messages.</div>`}
1468
+
1469
+ <button class="btn-add" @click=${()=>this._addRule()}>Add Rule</button>
1470
+ `}};j.styles=x`
1471
+ :host { display: block; }
1472
+
1473
+ .field {
1474
+ display: flex;
1475
+ flex-direction: column;
1476
+ gap: 4px;
1477
+ margin-bottom: var(--ic-space-md);
1478
+ }
1479
+
1480
+ .field label {
1481
+ font-size: var(--ic-text-xs);
1482
+ color: var(--ic-text-dim);
1483
+ text-transform: uppercase;
1484
+ letter-spacing: 0.05em;
1485
+ }
1486
+
1487
+ .field select {
1488
+ background: var(--ic-surface-2);
1489
+ border: 1px solid var(--ic-border);
1490
+ border-radius: var(--ic-radius-md);
1491
+ padding: var(--ic-space-sm) var(--ic-space-md);
1492
+ color: var(--ic-text);
1493
+ font-family: inherit;
1494
+ font-size: var(--ic-text-sm);
1495
+ outline: none;
1496
+ transition: border-color var(--ic-transition);
1497
+ }
1498
+
1499
+ .field select:focus {
1500
+ border-color: var(--ic-accent);
1501
+ }
1502
+
1503
+ .checkbox-field {
1504
+ display: flex;
1505
+ align-items: center;
1506
+ gap: var(--ic-space-sm);
1507
+ margin-bottom: var(--ic-space-md);
1508
+ }
1509
+
1510
+ .checkbox-field label {
1511
+ font-size: var(--ic-text-sm);
1512
+ color: var(--ic-text);
1513
+ cursor: pointer;
1514
+ }
1515
+
1516
+ .checkbox-field input[type="checkbox"] {
1517
+ accent-color: var(--ic-accent);
1518
+ }
1519
+
1520
+ .section-title {
1521
+ font-size: var(--ic-text-sm);
1522
+ font-weight: 600;
1523
+ color: var(--ic-text);
1524
+ margin-top: var(--ic-space-lg);
1525
+ margin-bottom: var(--ic-space-sm);
1526
+ }
1527
+
1528
+ .divider {
1529
+ border: none;
1530
+ border-top: 1px solid var(--ic-border);
1531
+ margin: var(--ic-space-md) 0 var(--ic-space-xs);
1532
+ }
1533
+
1534
+ .rules-list {
1535
+ display: flex;
1536
+ flex-direction: column;
1537
+ gap: var(--ic-space-sm);
1538
+ }
1539
+
1540
+ .rule-row {
1541
+ display: grid;
1542
+ grid-template-columns: 1fr 1fr 1.5fr 0.8fr 1.5fr auto;
1543
+ gap: var(--ic-space-xs);
1544
+ align-items: center;
1545
+ background: var(--ic-surface);
1546
+ border: 1px solid var(--ic-border);
1547
+ border-radius: var(--ic-radius-md);
1548
+ padding: var(--ic-space-sm);
1549
+ }
1550
+
1551
+ .rule-row select,
1552
+ .rule-row input {
1553
+ background: var(--ic-surface-2);
1554
+ border: 1px solid var(--ic-border);
1555
+ border-radius: var(--ic-radius-sm);
1556
+ padding: 4px 6px;
1557
+ color: var(--ic-text);
1558
+ font-family: inherit;
1559
+ font-size: var(--ic-text-xs);
1560
+ outline: none;
1561
+ }
1562
+
1563
+ .rule-row select:focus,
1564
+ .rule-row input:focus {
1565
+ border-color: var(--ic-accent);
1566
+ }
1567
+
1568
+ .btn-icon {
1569
+ background: none;
1570
+ border: none;
1571
+ color: var(--ic-text-dim);
1572
+ cursor: pointer;
1573
+ padding: 2px 6px;
1574
+ font-size: var(--ic-text-sm);
1575
+ line-height: 1;
1576
+ border-radius: var(--ic-radius-sm);
1577
+ }
1578
+
1579
+ .btn-icon:hover {
1580
+ color: var(--ic-error);
1581
+ }
1582
+
1583
+ .btn-add {
1584
+ padding: var(--ic-space-xs) var(--ic-space-md);
1585
+ background: var(--ic-accent);
1586
+ color: white;
1587
+ border: none;
1588
+ border-radius: var(--ic-radius-md);
1589
+ font-size: var(--ic-text-sm);
1590
+ cursor: pointer;
1591
+ margin-top: var(--ic-space-sm);
1592
+ width: fit-content;
1593
+ }
1594
+
1595
+ .btn-add:hover {
1596
+ opacity: 0.9;
1597
+ }
1598
+
1599
+ .empty-hint {
1600
+ font-size: var(--ic-text-xs);
1601
+ color: var(--ic-text-dim);
1602
+ font-style: italic;
1603
+ }
1604
+
1605
+ @media (max-width: 767px) {
1606
+ .rule-row {
1607
+ grid-template-columns: 1fr 1fr;
1608
+ }
1609
+ }
1610
+ `;te([v({attribute:!1})],j.prototype,"config",2);te([p()],j.prototype,"_rules",2);j=te([_("ic-agent-send-policy-editor")],j);var qe=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,I=(e,t,i,a)=>{for(var r=a>1?void 0:a?Je(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&qe(t,i,r),r};const oe=["fatal","error","warn","info","debug","trace"],Ue=["agent","gateway","channels","memory","scheduler","daemon","skills","queue","streaming"];let O=class extends y{constructor(){super(...arguments),this.rpcClient=null,this.applied="",this._levels={},this._globalLevel="info",this._applied={}}willUpdate(e){e.has("applied")&&this.applied&&(this._applied={...this._applied,[this.applied]:!0},setTimeout(()=>{this._applied={...this._applied,[this.applied]:!1}},3e3))}_emitLogLevel(e,t){const i={level:t};e&&(i.module=e),this.dispatchEvent(new CustomEvent("log-level-change",{detail:i,bubbles:!0,composed:!0}))}_setGlobalLevel(){this._emitLogLevel(void 0,this._globalLevel)}_setModuleLevel(e){const t=this._levels[e]??"info";this._emitLogLevel(e,t)}render(){return l`
1611
+ <div class="info-banner">
1612
+ Log level changes are runtime only and reset on daemon restart.
1613
+ </div>
1614
+
1615
+ <div class="global-section">
1616
+ <span class="global-label">Global Level</span>
1617
+ <select
1618
+ class="level-select"
1619
+ .value=${this._globalLevel}
1620
+ @change=${e=>{this._globalLevel=e.target.value}}
1621
+ >
1622
+ ${oe.map(e=>l`
1623
+ <option value=${e} ?selected=${this._globalLevel===e}>${e}</option>
1624
+ `)}
1625
+ </select>
1626
+ <button class="btn-set" @click=${()=>this._setGlobalLevel()}>Set Global</button>
1627
+ ${this._applied.__global__?l`<span class="applied-indicator">Applied</span>`:$}
1628
+ </div>
1629
+
1630
+ <hr class="divider" />
1631
+ <div class="section-title">Per-Module Levels</div>
1632
+
1633
+ <div class="module-list">
1634
+ ${Ue.map(e=>{const t=this._levels[e]??"info";return l`
1635
+ <div class="module-row">
1636
+ <span class="module-name">${e}</span>
1637
+ <select
1638
+ class="level-select"
1639
+ .value=${t}
1640
+ @change=${i=>{this._levels={...this._levels,[e]:i.target.value}}}
1641
+ >
1642
+ ${oe.map(i=>l`
1643
+ <option value=${i} ?selected=${t===i}>${i}</option>
1644
+ `)}
1645
+ </select>
1646
+ <button class="btn-set" @click=${()=>this._setModuleLevel(e)}>Set</button>
1647
+ ${this._applied[e]?l`<span class="applied-indicator">Applied</span>`:$}
1648
+ </div>
1649
+ `})}
1650
+ </div>
1651
+ `}};O.styles=x`
1652
+ :host { display: block; }
1653
+
1654
+ .info-banner {
1655
+ background: color-mix(in srgb, var(--ic-info, #3b82f6) 10%, transparent);
1656
+ border: 1px solid color-mix(in srgb, var(--ic-info, #3b82f6) 30%, transparent);
1657
+ border-radius: var(--ic-radius-md);
1658
+ padding: var(--ic-space-sm) var(--ic-space-md);
1659
+ font-size: var(--ic-text-xs);
1660
+ color: var(--ic-text-muted, var(--ic-text-dim));
1661
+ margin-bottom: var(--ic-space-lg);
1662
+ line-height: 1.5;
1663
+ }
1664
+
1665
+ .global-section {
1666
+ display: flex;
1667
+ align-items: center;
1668
+ gap: var(--ic-space-sm);
1669
+ margin-bottom: var(--ic-space-md);
1670
+ }
1671
+
1672
+ .global-label {
1673
+ font-size: var(--ic-text-sm);
1674
+ font-weight: 600;
1675
+ color: var(--ic-text);
1676
+ min-width: 90px;
1677
+ }
1678
+
1679
+ .level-select {
1680
+ background: var(--ic-surface-2);
1681
+ border: 1px solid var(--ic-border);
1682
+ border-radius: var(--ic-radius-md);
1683
+ padding: var(--ic-space-xs) var(--ic-space-sm);
1684
+ color: var(--ic-text);
1685
+ font-family: inherit;
1686
+ font-size: var(--ic-text-sm);
1687
+ outline: none;
1688
+ transition: border-color var(--ic-transition);
1689
+ }
1690
+
1691
+ .level-select:focus {
1692
+ border-color: var(--ic-accent);
1693
+ }
1694
+
1695
+ .btn-set {
1696
+ padding: var(--ic-space-xs) var(--ic-space-md);
1697
+ background: var(--ic-accent);
1698
+ color: white;
1699
+ border: none;
1700
+ border-radius: var(--ic-radius-md);
1701
+ font-size: var(--ic-text-xs);
1702
+ cursor: pointer;
1703
+ white-space: nowrap;
1704
+ }
1705
+
1706
+ .btn-set:hover {
1707
+ opacity: 0.9;
1708
+ }
1709
+
1710
+ .section-title {
1711
+ font-size: var(--ic-text-sm);
1712
+ font-weight: 600;
1713
+ color: var(--ic-text);
1714
+ margin-top: var(--ic-space-lg);
1715
+ margin-bottom: var(--ic-space-sm);
1716
+ }
1717
+
1718
+ .divider {
1719
+ border: none;
1720
+ border-top: 1px solid var(--ic-border);
1721
+ margin: var(--ic-space-md) 0 var(--ic-space-xs);
1722
+ }
1723
+
1724
+ .module-list {
1725
+ display: flex;
1726
+ flex-direction: column;
1727
+ gap: var(--ic-space-xs);
1728
+ }
1729
+
1730
+ .module-row {
1731
+ display: flex;
1732
+ align-items: center;
1733
+ gap: var(--ic-space-sm);
1734
+ padding: var(--ic-space-xs) 0;
1735
+ }
1736
+
1737
+ .module-name {
1738
+ font-size: var(--ic-text-sm);
1739
+ color: var(--ic-text);
1740
+ min-width: 90px;
1741
+ font-family: var(--ic-font-mono, monospace);
1742
+ }
1743
+
1744
+ .applied-indicator {
1745
+ font-size: var(--ic-text-xs);
1746
+ color: var(--ic-success, #22c55e);
1747
+ margin-left: var(--ic-space-xs);
1748
+ opacity: 1;
1749
+ transition: opacity 0.3s ease;
1750
+ }
1751
+ `;I([v({attribute:!1})],O.prototype,"rpcClient",2);I([v()],O.prototype,"applied",2);I([p()],O.prototype,"_levels",2);I([p()],O.prototype,"_globalLevel",2);I([p()],O.prototype,"_applied",2);O=I([_("ic-agent-log-level-editor")],O);var Ve=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,g=(e,t,i,a)=>{for(var r=a>1?void 0:a?Ye(t,i):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(a?n(t,i,r):n(r))||r);return a&&r&&Ve(t,i,r),r};function ne(){return{id:"",name:"",model:"",provider:"anthropic",maxSteps:25,temperature:void 0,thinkingLevel:"medium",maxTokens:void 0,cacheRetention:void 0,maxContextChars:void 0,"budgets.perExecution":void 0,"budgets.perHour":void 0,"budgets.perDay":void 0,"session.resetMode":"daily","session.dailyResetHour":0,"session.timezone":"UTC","session.idleTimeoutMs":void 0,"skills.discoveryPaths":"","skills.toolPolicyProfile":"full","skills.allowList":"","skills.denyList":"","heartbeat.enabled":void 0,"heartbeat.intervalMs":void 0,"heartbeat.target.channelType":"","heartbeat.target.channelId":"","heartbeat.prompt":"","heartbeat.showOk":void 0,"heartbeat.showAlerts":void 0,"advanced.maxSteps":void 0,"advanced.cacheRetention":void 0,"advanced.maxContextChars":void 0,"advanced.rag.enabled":!1,"advanced.rag.maxResults":10,"advanced.rag.minScore":.5,"advanced.concurrency.maxConcurrent":5,"advanced.concurrency.maxQueued":10,"circuitBreaker.threshold":5,"circuitBreaker.resetTimeoutMs":6e4,"safety.contextGuard.enabled":!0,"safety.contextGuard.warnPct":80,"safety.contextGuard.blockPct":95,"safety.sdkRetry.enabled":!0,"safety.sdkRetry.maxRetries":3,"safety.sdkRetry.baseDelayMs":2e3,"failover.fallbackModels":"","failover.authProfiles":"","failover.allowedModels":"","failover.maxAttempts":6,"failover.cooldownMs":6e4,"rag.trustLevels.system":!0,"rag.trustLevels.learned":!0,"rag.trustLevels.external":!1,"broadcast.groups":"[]","heartbeat.target.chatId":"","heartbeat.target.isDm":void 0,"heartbeat.model":"","heartbeat.session":"","heartbeat.allowDm":void 0,"heartbeat.lightContext":void 0,"heartbeat.ackMaxChars":void 0,"heartbeat.responsePrefix":"","heartbeat.skipHeartbeatOnlyDelivery":void 0,"heartbeat.alertThreshold":void 0,"heartbeat.alertCooldownMs":void 0,"heartbeat.staleMs":void 0,"advanced.elevatedReply.enabled":!1,"advanced.elevatedReply.recipients":"","advanced.tracing.enabled":!1,"advanced.tracing.outputDir":"","advanced.workspacePath":"","advanced.bootstrap":"","advanced.modelRoutes":"","advanced.secretsAccess":"","session.overrides.dm":"","session.overrides.group":"","session.overrides.thread":"","session.dmScopeMode":"","session.pruning.enabled":!1,"session.pruning.maxEntries":100,"session.compaction.enabled":!1,"session.compaction.threshold":50,"contextEngine.enabled":!0,"contextEngine.version":"pipeline","contextEngine.thinkingKeepTurns":void 0,"contextEngine.compactionModel":"","contextEngine.evictionMinAge":void 0,"contextEngine.historyTurns":void 0,"contextEngine.observationKeepWindow":void 0,"contextEngine.observationTriggerChars":void 0,"contextEngine.observationDeactivationChars":void 0,"contextEngine.compactionCooldownTurns":void 0,"contextEngine.historyTurnOverrides":"","contextEngine.freshTailTurns":void 0,"contextEngine.contextThreshold":void 0,"contextEngine.leafMinFanout":void 0,"contextEngine.condensedMinFanout":void 0,"contextEngine.condensedMinFanoutHard":void 0,"contextEngine.incrementalMaxDepth":void 0,"contextEngine.leafChunkTokens":void 0,"contextEngine.leafTargetTokens":void 0,"contextEngine.condensedTargetTokens":void 0,"contextEngine.maxExpandTokens":void 0,"contextEngine.maxRecallsPerDay":void 0,"contextEngine.recallTimeoutMs":void 0,"contextEngine.largeFileTokenThreshold":void 0,"contextEngine.annotationKeepWindow":void 0,"contextEngine.annotationTriggerChars":void 0,"contextEngine.summaryModel":"","contextEngine.summaryProvider":""}}let f=class extends y{constructor(){super(...arguments),this.rpcClient=null,this.agentId="",this._loadState="loading",this._saving=!1,this._validating=!1,this._error="",this._validationErrors=[],this._validationSuccess=!1,this._form=ne(),this._expanded=new Set(["budget"]),this._catalogProviders=[],this._streamingConfig={},this._deliveryQueueConfig={},this._deliveryMirrorConfig={},this._queueConfig={},this._autoReplyConfig={},this._sendPolicyConfig={},this._logLevelApplied="",this._dirtyTracker=xe(),this._boundHashChangeGuard=()=>{if(this._dirtyTracker.isDirty&&!this._navigatingAfterSave&&!this._dirtyTracker.confirmNavigation()){const e=this._isNew?"agents/new/edit":`agents/${this.agentId}/edit`;history.replaceState(null,"",`#/${e}`)}this._navigatingAfterSave=!1},this._navigatingAfterSave=!1}get _isNew(){return!this.agentId||this.agentId==="new"}connectedCallback(){super.connectedCallback(),this._dirtyTracker.attach(),window.addEventListener("hashchange",this._boundHashChangeGuard),this.rpcClient&&(this._loadModelCatalog(),this._loadTopLevelConfig()),this._isNew?this._loadState="loaded":this.rpcClient&&this._loadAgent()}disconnectedCallback(){super.disconnectedCallback(),this._dirtyTracker.detach(),window.removeEventListener("hashchange",this._boundHashChangeGuard)}updated(e){e.has("rpcClient")&&this.rpcClient&&(this._catalogProviders.length===0&&this._loadModelCatalog(),this._loadTopLevelConfig(),!this._isNew&&this._loadState==="loading"&&this._loadAgent())}async _loadModelCatalog(){if(this.rpcClient)try{const e=await this.rpcClient.call("models.list");e.providers&&(this._catalogProviders=e.providers)}catch{}}async _loadTopLevelConfig(){if(this.rpcClient)try{const t=(await this.rpcClient.call("config.read")).config;this._streamingConfig=t.streaming??{},this._deliveryQueueConfig=t.deliveryQueue??{},this._deliveryMirrorConfig=t.deliveryMirror??{},this._queueConfig=t.queue??{},this._autoReplyConfig=t.autoReplyEngine??{},this._sendPolicyConfig=t.sendPolicy??{}}catch{}}async _handleConfigChange(e){const{section:t,key:i,value:a}=e.detail;try{await this.rpcClient.call("config.patch",{section:t,key:i,value:a}),t==="streaming"?this._streamingConfig={...this._streamingConfig,[i]:a}:t==="deliveryQueue"?this._deliveryQueueConfig={...this._deliveryQueueConfig,[i]:a}:t==="deliveryMirror"?this._deliveryMirrorConfig={...this._deliveryMirrorConfig,[i]:a}:t==="queue"?this._queueConfig={...this._queueConfig,[i]:a}:t==="autoReplyEngine"?this._autoReplyConfig={...this._autoReplyConfig,[i]:a}:t==="sendPolicy"&&(this._sendPolicyConfig={...this._sendPolicyConfig,[i]:a}),S.show("Saved","success")}catch(r){S.show(r instanceof Error?r.message:"Failed to save","error")}}async _handleLogLevelChange(e){const{module:t,level:i}=e.detail;try{const a={level:i};t&&(a.module=t),await this.rpcClient.call("daemon.setLogLevel",a),this._logLevelApplied=t??"__global__",S.show(`Log level ${t?`${t}: `:""}${i}`,"success"),setTimeout(()=>{this._logLevelApplied=""},3e3)}catch(a){S.show(a instanceof Error?a.message:"Failed to set log level","error")}}async _loadAgent(){if(!this.rpcClient){this._loadState="error",this._error="Not connected";return}this._loadState="loading";try{const e=await this.rpcClient.call("agents.get",{agentId:this.agentId}),t=this._mapConfigToDetail(e.agentId,e.config);this._populateForm(t),this._loadState="loaded"}catch(e){this._loadState="error",this._error=e instanceof Error?e.message:"Failed to load agent"}}_mapConfigToDetail(e,t){const i=t.circuitBreaker,a=t.contextGuard,r=t.sdkRetry,o=t.rag,n=t.modelFailover,m=t.session?.resetPolicy,w=t.concurrency,D=t.skills,A=D?.toolPolicy,d=t.contextEngine;return{id:e,name:t.name,provider:t.provider??"anthropic",model:t.model??"",status:"active",maxSteps:t.maxSteps,temperature:t.temperature,thinkingLevel:t.thinkingLevel,maxTokens:t.maxTokens,cacheRetention:t.cacheRetention,maxContextChars:t.maxContextChars,budgets:t.budgets,circuitBreaker:i?{state:"closed",failures:0,threshold:i.failureThreshold??5,resetTimeoutMs:i.resetTimeoutMs??6e4}:void 0,safety:{contextGuard:a?{enabled:a.enabled??!0,warnPct:a.warnPercent??80,blockPct:a.blockPercent??95}:void 0,sdkRetry:r?{enabled:r.enabled??!0,maxRetries:r.maxRetries??3,baseDelayMs:r.baseDelayMs??2e3}:void 0},rag:o?{enabled:o.enabled??!1,maxResults:o.maxResults,maxContextChars:o.maxContextChars,minScore:o.minScore,trustLevels:o.includeTrustLevels}:void 0,modelFailover:n?{fallbackModels:n.fallbackModels?.map(F=>`${F.provider}:${F.modelId}`),authProfiles:n.authProfiles,allowedModels:n.allowedModels,maxAttempts:n.maxAttempts,cooldownInitialMs:n.cooldownInitialMs,cooldownMultiplier:n.cooldownMultiplier,cooldownCapMs:n.cooldownCapMs}:void 0,sessionPolicy:m?{resetMode:m.mode,dailyResetHour:m.dailyResetHour,timezone:m.dailyResetTimezone??"UTC",idleTimeoutMs:m.idleTimeoutMs}:void 0,concurrency:w?{maxConcurrent:w.maxConcurrentRuns??5,maxQueued:w.maxQueuedPerSession??10}:void 0,skills:D?{discoveryPaths:D.discoveryPaths,toolPolicyProfile:A?.profile,allowList:A?.allow,denyList:A?.deny,builtinTools:D.builtinTools}:void 0,broadcastGroups:t.broadcastGroups,heartbeat:(()=>{const c=t.scheduler?.heartbeat;if(!c)return;const M=c.target;return{enabled:c.enabled,intervalMs:c.intervalMs,showOk:c.showOk,showAlerts:c.showAlerts,target:M?{channelType:M.channelType,channelId:M.channelId,chatId:M.chatId,isDm:M.isDm}:void 0,prompt:c.prompt,model:c.model,session:c.session,allowDm:c.allowDm,lightContext:c.lightContext,ackMaxChars:c.ackMaxChars,responsePrefix:c.responsePrefix,skipHeartbeatOnlyDelivery:c.skipHeartbeatOnlyDelivery,alertThreshold:c.alertThreshold,alertCooldownMs:c.alertCooldownMs,staleMs:c.staleMs}})(),advanced:{elevatedReply:t.elevatedReply,tracing:t.tracing,workspacePath:t.workspacePath,bootstrap:t.bootstrap,modelRoutes:t.modelRoutes,secretsAccess:t.secrets?.allowedPatterns},contextEngine:d?{enabled:d.enabled,version:d.version,thinkingKeepTurns:d.thinkingKeepTurns,compactionModel:d.compactionModel,evictionMinAge:d.evictionMinAge,historyTurns:d.historyTurns,observationKeepWindow:d.observationKeepWindow,observationTriggerChars:d.observationTriggerChars,observationDeactivationChars:d.observationDeactivationChars,compactionCooldownTurns:d.compactionCooldownTurns,historyTurnOverrides:d.historyTurnOverrides,freshTailTurns:d.freshTailTurns,contextThreshold:d.contextThreshold,leafMinFanout:d.leafMinFanout,condensedMinFanout:d.condensedMinFanout,condensedMinFanoutHard:d.condensedMinFanoutHard,incrementalMaxDepth:d.incrementalMaxDepth,leafChunkTokens:d.leafChunkTokens,leafTargetTokens:d.leafTargetTokens,condensedTargetTokens:d.condensedTargetTokens,maxExpandTokens:d.maxExpandTokens,maxRecallsPerDay:d.maxRecallsPerDay,recallTimeoutMs:d.recallTimeoutMs,largeFileTokenThreshold:d.largeFileTokenThreshold,annotationKeepWindow:d.annotationKeepWindow,annotationTriggerChars:d.annotationTriggerChars,summaryModel:d.summaryModel,summaryProvider:d.summaryProvider}:void 0}}_populateForm(e){const t=ne();t.id=e.id,t.name=e.name??"",t.model=e.model??"",t.provider=e.provider??"anthropic",t.maxSteps=e.maxSteps??25,t.temperature=e.temperature,t.thinkingLevel=e.thinkingLevel??"medium",t.maxTokens=e.maxTokens,t.cacheRetention=e.cacheRetention,t.maxContextChars=e.maxContextChars,e.budgets&&(t["budgets.perExecution"]=e.budgets.perExecution,t["budgets.perHour"]=e.budgets.perHour,t["budgets.perDay"]=e.budgets.perDay),e.circuitBreaker&&(t["circuitBreaker.threshold"]=e.circuitBreaker.threshold??5,t["circuitBreaker.resetTimeoutMs"]=e.circuitBreaker.resetTimeoutMs??6e4),e.safety?.contextGuard&&(t["safety.contextGuard.enabled"]=e.safety.contextGuard.enabled,t["safety.contextGuard.warnPct"]=e.safety.contextGuard.warnPct,t["safety.contextGuard.blockPct"]=e.safety.contextGuard.blockPct),e.safety?.sdkRetry&&(t["safety.sdkRetry.enabled"]=e.safety.sdkRetry.enabled,t["safety.sdkRetry.maxRetries"]=e.safety.sdkRetry.maxRetries,t["safety.sdkRetry.baseDelayMs"]=e.safety.sdkRetry.baseDelayMs),e.modelFailover&&(t["failover.fallbackModels"]=(e.modelFailover.fallbackModels??[]).join(`
1752
+ `),t["failover.authProfiles"]=e.modelFailover.authProfiles?.length?JSON.stringify(e.modelFailover.authProfiles,null,2):"",t["failover.allowedModels"]=(e.modelFailover.allowedModels??[]).join(`
1753
+ `),t["failover.maxAttempts"]=e.modelFailover.maxAttempts??6,t["failover.cooldownMs"]=e.modelFailover.cooldownInitialMs??6e4),e.rag&&(t["advanced.rag.enabled"]=e.rag.enabled,t["advanced.rag.maxResults"]=e.rag.maxResults??10,t["advanced.rag.minScore"]=e.rag.minScore??.5,e.rag.trustLevels&&(t["rag.trustLevels.system"]=e.rag.trustLevels.includes("system"),t["rag.trustLevels.learned"]=e.rag.trustLevels.includes("learned"),t["rag.trustLevels.external"]=e.rag.trustLevels.includes("external"))),e.sessionPolicy&&(t["session.resetMode"]=e.sessionPolicy.resetMode??"daily",t["session.dailyResetHour"]=e.sessionPolicy.dailyResetHour??0,t["session.timezone"]=e.sessionPolicy.timezone??"UTC",t["session.idleTimeoutMs"]=e.sessionPolicy.idleTimeoutMs),e.concurrency&&(t["advanced.concurrency.maxConcurrent"]=e.concurrency.maxConcurrent??5,t["advanced.concurrency.maxQueued"]=e.concurrency.maxQueued??10);{const r=e.skills;t["skills.discoveryPaths"]=(r?.discoveryPaths??[]).join(`
1754
+ `),t["skills.toolPolicyProfile"]=r?.toolPolicyProfile??"full",t["skills.allowList"]=(r?.allowList??[]).join(`
1755
+ `),t["skills.denyList"]=(r?.denyList??[]).join(`
1756
+ `);const o=r?.builtinTools;for(const n of Z)t[`skills.builtin.${n}`]=o?o[n]??!1:n!=="browser"}e.broadcastGroups&&(t["broadcast.groups"]=JSON.stringify(e.broadcastGroups,null,2));const i=e.heartbeat;if(t["heartbeat.enabled"]=i?.enabled??!0,t["heartbeat.intervalMs"]=i?.intervalMs,t["heartbeat.showOk"]=i?.showOk,t["heartbeat.showAlerts"]=i?.showAlerts,i?.target&&(t["heartbeat.target.channelType"]=i.target.channelType??"",t["heartbeat.target.channelId"]=i.target.channelId??"",t["heartbeat.target.chatId"]=i.target.chatId??"",t["heartbeat.target.isDm"]=i.target.isDm),t["heartbeat.prompt"]=i?.prompt??"",t["heartbeat.model"]=i?.model??"",t["heartbeat.session"]=i?.session??"",t["heartbeat.allowDm"]=i?.allowDm,t["heartbeat.lightContext"]=i?.lightContext,t["heartbeat.ackMaxChars"]=i?.ackMaxChars,t["heartbeat.responsePrefix"]=i?.responsePrefix??"",t["heartbeat.skipHeartbeatOnlyDelivery"]=i?.skipHeartbeatOnlyDelivery,t["heartbeat.alertThreshold"]=i?.alertThreshold,t["heartbeat.alertCooldownMs"]=i?.alertCooldownMs,t["heartbeat.staleMs"]=i?.staleMs,e.advanced){const r=e.advanced;if(r.elevatedReply&&typeof r.elevatedReply=="object"){const o=r.elevatedReply;t["advanced.elevatedReply.enabled"]=o.enabled??!1,t["advanced.elevatedReply.recipients"]=Array.isArray(o.recipients)?o.recipients.join(`
1757
+ `):""}if(r.tracing&&typeof r.tracing=="object"){const o=r.tracing;t["advanced.tracing.enabled"]=o.enabled??!1,t["advanced.tracing.outputDir"]=o.outputDir??""}t["advanced.workspacePath"]=r.workspacePath??"",r.bootstrap!==void 0&&(t["advanced.bootstrap"]=typeof r.bootstrap=="string"?r.bootstrap:JSON.stringify(r.bootstrap,null,2)),r.modelRoutes!==void 0&&(t["advanced.modelRoutes"]=typeof r.modelRoutes=="string"?r.modelRoutes:JSON.stringify(r.modelRoutes,null,2)),r.secretsAccess!==void 0&&(t["advanced.secretsAccess"]=Array.isArray(r.secretsAccess)?r.secretsAccess.join(`
1758
+ `):String(r.secretsAccess))}const a=e.contextEngine;a&&(t["contextEngine.enabled"]=a.enabled??!0,t["contextEngine.version"]=a.version??"pipeline",t["contextEngine.thinkingKeepTurns"]=a.thinkingKeepTurns,t["contextEngine.compactionModel"]=a.compactionModel??"",t["contextEngine.evictionMinAge"]=a.evictionMinAge,t["contextEngine.historyTurns"]=a.historyTurns,t["contextEngine.observationKeepWindow"]=a.observationKeepWindow,t["contextEngine.observationTriggerChars"]=a.observationTriggerChars,t["contextEngine.observationDeactivationChars"]=a.observationDeactivationChars,t["contextEngine.compactionCooldownTurns"]=a.compactionCooldownTurns,t["contextEngine.historyTurnOverrides"]=a.historyTurnOverrides?JSON.stringify(a.historyTurnOverrides,null,2):"",t["contextEngine.freshTailTurns"]=a.freshTailTurns,t["contextEngine.contextThreshold"]=a.contextThreshold,t["contextEngine.leafMinFanout"]=a.leafMinFanout,t["contextEngine.condensedMinFanout"]=a.condensedMinFanout,t["contextEngine.condensedMinFanoutHard"]=a.condensedMinFanoutHard,t["contextEngine.incrementalMaxDepth"]=a.incrementalMaxDepth,t["contextEngine.leafChunkTokens"]=a.leafChunkTokens,t["contextEngine.leafTargetTokens"]=a.leafTargetTokens,t["contextEngine.condensedTargetTokens"]=a.condensedTargetTokens,t["contextEngine.maxExpandTokens"]=a.maxExpandTokens,t["contextEngine.maxRecallsPerDay"]=a.maxRecallsPerDay,t["contextEngine.recallTimeoutMs"]=a.recallTimeoutMs,t["contextEngine.largeFileTokenThreshold"]=a.largeFileTokenThreshold,t["contextEngine.annotationKeepWindow"]=a.annotationKeepWindow,t["contextEngine.annotationTriggerChars"]=a.annotationTriggerChars,t["contextEngine.summaryModel"]=a.summaryModel??"",t["contextEngine.summaryProvider"]=a.summaryProvider??""),this._form=t}_updateField(e,t){this._form={...this._form,[e]:t},this._dirtyTracker.markDirty(e),this._validationSuccess=!1,this._validationErrors=[]}_getField(e,t){const i=this._form[e];return i??t}_handleFieldChange(e){this._updateField(e.detail.key,e.detail.value)}_buildPayload(){const e=this._form,t={name:e.name||void 0,model:e.model||void 0,provider:e.provider||void 0,maxSteps:e.maxSteps!==void 0?Number(e.maxSteps):void 0,temperature:e.temperature!==void 0&&e.temperature!==""?Number(e.temperature):void 0,thinkingLevel:e.thinkingLevel||void 0,maxTokens:e.maxTokens!==void 0&&e.maxTokens!==""?Number(e.maxTokens):void 0,cacheRetention:e.cacheRetention!==void 0&&e.cacheRetention!==""?e.cacheRetention:void 0,maxContextChars:e.maxContextChars!==void 0&&e.maxContextChars!==""?Number(e.maxContextChars):void 0},i={};e["budgets.perExecution"]!==void 0&&e["budgets.perExecution"]!==""&&(i.perExecution=Number(e["budgets.perExecution"])),e["budgets.perHour"]!==void 0&&e["budgets.perHour"]!==""&&(i.perHour=Number(e["budgets.perHour"])),e["budgets.perDay"]!==void 0&&e["budgets.perDay"]!==""&&(i.perDay=Number(e["budgets.perDay"])),Object.keys(i).length>0&&(t.budgets=i),t.circuitBreaker={failureThreshold:Number(e["circuitBreaker.threshold"])||5,resetTimeoutMs:Number(e["circuitBreaker.resetTimeoutMs"])||6e4},t.contextGuard={enabled:!!e["safety.contextGuard.enabled"],warnPercent:Number(e["safety.contextGuard.warnPct"])||80,blockPercent:Number(e["safety.contextGuard.blockPct"])||95},t.sdkRetry={enabled:!!e["safety.sdkRetry.enabled"],maxRetries:Number(e["safety.sdkRetry.maxRetries"])||3,baseDelayMs:Number(e["safety.sdkRetry.baseDelayMs"])||2e3};const a=this._textareaToArray(e["failover.fallbackModels"]),r=this._textareaToArray(e["failover.allowedModels"]),o=e["failover.authProfiles"]||"",n={fallbackModels:a.map(T=>{const[ae,...be]=T.split(":");return{provider:ae,modelId:be.join(":")||ae}}).filter(T=>T.modelId),allowedModels:r,maxAttempts:Number(e["failover.maxAttempts"])||6,cooldownInitialMs:Number(e["failover.cooldownMs"])||6e4};if(o)try{n.authProfiles=JSON.parse(o)}catch{}(a.length>0||r.length>0||o)&&(t.modelFailover=n);const C={enabled:!!e["advanced.rag.enabled"],maxResults:Number(e["advanced.rag.maxResults"])||10,minScore:Number(e["advanced.rag.minScore"])||.5,includeTrustLevels:[...e["rag.trustLevels.system"]?["system"]:[],...e["rag.trustLevels.learned"]?["learned"]:[],...e["rag.trustLevels.external"]?["external"]:[]]};t.rag=C;const m={mode:e["session.resetMode"]||"daily",dailyResetHour:Number(e["session.dailyResetHour"])||0,dailyResetTimezone:e["session.timezone"]||"UTC"};e["session.idleTimeoutMs"]!==void 0&&e["session.idleTimeoutMs"]!==""&&(m.idleTimeoutMs=Number(e["session.idleTimeoutMs"]));const w={resetPolicy:m};e["session.pruning.enabled"]&&(w.pruning={enabled:!0,maxEntries:Number(e["session.pruning.maxEntries"])||100}),e["session.compaction.enabled"]&&(w.compaction={enabled:!0,threshold:Number(e["session.compaction.threshold"])||50}),t.session=w,t.concurrency={maxConcurrentRuns:Number(e["advanced.concurrency.maxConcurrent"])||1,maxQueuedPerSession:Number(e["advanced.concurrency.maxQueued"])||50};const D=this._textareaToArray(e["skills.discoveryPaths"]),A=this._textareaToArray(e["skills.allowList"]),d=this._textareaToArray(e["skills.denyList"]),F={};for(const T of Z)F[T]=!!e[`skills.builtin.${T}`];t.skills={discoveryPaths:D.length>0?D:void 0,builtinTools:F,toolPolicy:{profile:e["skills.toolPolicyProfile"]||"full",allow:A.length>0?A:[],deny:d.length>0?d:[]}};const c={};e["heartbeat.enabled"]!==void 0&&e["heartbeat.enabled"]!==""&&(c.enabled=!!e["heartbeat.enabled"]),e["heartbeat.intervalMs"]!==void 0&&e["heartbeat.intervalMs"]!==""&&(c.intervalMs=Number(e["heartbeat.intervalMs"])),e["heartbeat.showOk"]!==void 0&&e["heartbeat.showOk"]!==""&&(c.showOk=!!e["heartbeat.showOk"]),e["heartbeat.showAlerts"]!==void 0&&e["heartbeat.showAlerts"]!==""&&(c.showAlerts=!!e["heartbeat.showAlerts"]);const M={};e["heartbeat.target.channelType"]&&(M.channelType=e["heartbeat.target.channelType"]),e["heartbeat.target.channelId"]&&(M.channelId=e["heartbeat.target.channelId"]),e["heartbeat.target.chatId"]&&(M.chatId=e["heartbeat.target.chatId"]),e["heartbeat.target.isDm"]!==void 0&&e["heartbeat.target.isDm"]!==""&&(M.isDm=!!e["heartbeat.target.isDm"]),Object.keys(M).length>0&&(c.target=M),e["heartbeat.prompt"]&&(c.prompt=e["heartbeat.prompt"]),e["heartbeat.model"]&&(c.model=e["heartbeat.model"]),e["heartbeat.session"]&&(c.session=e["heartbeat.session"]),e["heartbeat.allowDm"]!==void 0&&e["heartbeat.allowDm"]!==""&&(c.allowDm=!!e["heartbeat.allowDm"]),e["heartbeat.lightContext"]!==void 0&&e["heartbeat.lightContext"]!==""&&(c.lightContext=!!e["heartbeat.lightContext"]),e["heartbeat.ackMaxChars"]!==void 0&&e["heartbeat.ackMaxChars"]!==""&&(c.ackMaxChars=Number(e["heartbeat.ackMaxChars"])),e["heartbeat.responsePrefix"]&&(c.responsePrefix=e["heartbeat.responsePrefix"]),e["heartbeat.skipHeartbeatOnlyDelivery"]!==void 0&&e["heartbeat.skipHeartbeatOnlyDelivery"]!==""&&(c.skipHeartbeatOnlyDelivery=!!e["heartbeat.skipHeartbeatOnlyDelivery"]),e["heartbeat.alertThreshold"]!==void 0&&e["heartbeat.alertThreshold"]!==""&&(c.alertThreshold=Number(e["heartbeat.alertThreshold"])),e["heartbeat.alertCooldownMs"]!==void 0&&e["heartbeat.alertCooldownMs"]!==""&&(c.alertCooldownMs=Number(e["heartbeat.alertCooldownMs"])),e["heartbeat.staleMs"]!==void 0&&e["heartbeat.staleMs"]!==""&&(c.staleMs=Number(e["heartbeat.staleMs"])),Object.keys(c).length>0&&(t.scheduler={heartbeat:c});try{const T=JSON.parse(e["broadcast.groups"]||"[]");Array.isArray(T)&&T.length>0&&(t.broadcastGroups=T)}catch{}if(e["advanced.elevatedReply.enabled"]&&(t.elevatedReply={enabled:!0}),e["advanced.tracing.enabled"]&&(t.tracing={enabled:!0,outputDir:e["advanced.tracing.outputDir"]||"~/.comis/traces"}),e["advanced.workspacePath"]&&(t.workspacePath=e["advanced.workspacePath"]),e["advanced.bootstrap"])try{t.bootstrap=JSON.parse(e["advanced.bootstrap"])}catch{}if(e["advanced.modelRoutes"])try{t.modelRoutes=JSON.parse(e["advanced.modelRoutes"])}catch{}const ie=this._textareaToArray(e["advanced.secretsAccess"]);ie.length>0&&(t.secrets={allowedPatterns:ie});const u={};e["contextEngine.enabled"]!==void 0&&(u.enabled=!!e["contextEngine.enabled"]);const H=e["contextEngine.version"];if(H&&(u.version=H),e["contextEngine.thinkingKeepTurns"]!==void 0&&e["contextEngine.thinkingKeepTurns"]!==""&&(u.thinkingKeepTurns=Number(e["contextEngine.thinkingKeepTurns"])),e["contextEngine.compactionModel"]&&(u.compactionModel=e["contextEngine.compactionModel"]),e["contextEngine.evictionMinAge"]!==void 0&&e["contextEngine.evictionMinAge"]!==""&&(u.evictionMinAge=Number(e["contextEngine.evictionMinAge"])),H==="pipeline"){e["contextEngine.historyTurns"]!==void 0&&e["contextEngine.historyTurns"]!==""&&(u.historyTurns=Number(e["contextEngine.historyTurns"])),e["contextEngine.observationKeepWindow"]!==void 0&&e["contextEngine.observationKeepWindow"]!==""&&(u.observationKeepWindow=Number(e["contextEngine.observationKeepWindow"])),e["contextEngine.observationTriggerChars"]!==void 0&&e["contextEngine.observationTriggerChars"]!==""&&(u.observationTriggerChars=Number(e["contextEngine.observationTriggerChars"])),e["contextEngine.observationDeactivationChars"]!==void 0&&e["contextEngine.observationDeactivationChars"]!==""&&(u.observationDeactivationChars=Number(e["contextEngine.observationDeactivationChars"])),e["contextEngine.compactionCooldownTurns"]!==void 0&&e["contextEngine.compactionCooldownTurns"]!==""&&(u.compactionCooldownTurns=Number(e["contextEngine.compactionCooldownTurns"]));const T=e["contextEngine.historyTurnOverrides"]||"";if(T)try{u.historyTurnOverrides=JSON.parse(T)}catch{}}return H==="dag"&&(e["contextEngine.freshTailTurns"]!==void 0&&e["contextEngine.freshTailTurns"]!==""&&(u.freshTailTurns=Number(e["contextEngine.freshTailTurns"])),e["contextEngine.contextThreshold"]!==void 0&&e["contextEngine.contextThreshold"]!==""&&(u.contextThreshold=Number(e["contextEngine.contextThreshold"])),e["contextEngine.leafMinFanout"]!==void 0&&e["contextEngine.leafMinFanout"]!==""&&(u.leafMinFanout=Number(e["contextEngine.leafMinFanout"])),e["contextEngine.condensedMinFanout"]!==void 0&&e["contextEngine.condensedMinFanout"]!==""&&(u.condensedMinFanout=Number(e["contextEngine.condensedMinFanout"])),e["contextEngine.condensedMinFanoutHard"]!==void 0&&e["contextEngine.condensedMinFanoutHard"]!==""&&(u.condensedMinFanoutHard=Number(e["contextEngine.condensedMinFanoutHard"])),e["contextEngine.incrementalMaxDepth"]!==void 0&&e["contextEngine.incrementalMaxDepth"]!==""&&(u.incrementalMaxDepth=Number(e["contextEngine.incrementalMaxDepth"])),e["contextEngine.leafChunkTokens"]!==void 0&&e["contextEngine.leafChunkTokens"]!==""&&(u.leafChunkTokens=Number(e["contextEngine.leafChunkTokens"])),e["contextEngine.leafTargetTokens"]!==void 0&&e["contextEngine.leafTargetTokens"]!==""&&(u.leafTargetTokens=Number(e["contextEngine.leafTargetTokens"])),e["contextEngine.condensedTargetTokens"]!==void 0&&e["contextEngine.condensedTargetTokens"]!==""&&(u.condensedTargetTokens=Number(e["contextEngine.condensedTargetTokens"])),e["contextEngine.maxExpandTokens"]!==void 0&&e["contextEngine.maxExpandTokens"]!==""&&(u.maxExpandTokens=Number(e["contextEngine.maxExpandTokens"])),e["contextEngine.maxRecallsPerDay"]!==void 0&&e["contextEngine.maxRecallsPerDay"]!==""&&(u.maxRecallsPerDay=Number(e["contextEngine.maxRecallsPerDay"])),e["contextEngine.recallTimeoutMs"]!==void 0&&e["contextEngine.recallTimeoutMs"]!==""&&(u.recallTimeoutMs=Number(e["contextEngine.recallTimeoutMs"])),e["contextEngine.largeFileTokenThreshold"]!==void 0&&e["contextEngine.largeFileTokenThreshold"]!==""&&(u.largeFileTokenThreshold=Number(e["contextEngine.largeFileTokenThreshold"])),e["contextEngine.annotationKeepWindow"]!==void 0&&e["contextEngine.annotationKeepWindow"]!==""&&(u.annotationKeepWindow=Number(e["contextEngine.annotationKeepWindow"])),e["contextEngine.annotationTriggerChars"]!==void 0&&e["contextEngine.annotationTriggerChars"]!==""&&(u.annotationTriggerChars=Number(e["contextEngine.annotationTriggerChars"])),e["contextEngine.summaryModel"]&&(u.summaryModel=e["contextEngine.summaryModel"]),e["contextEngine.summaryProvider"]&&(u.summaryProvider=e["contextEngine.summaryProvider"])),Object.keys(u).length>0&&(t.contextEngine=u),t}_textareaToArray(e){return e?e.split(`
1759
+ `).map(t=>t.trim()).filter(Boolean):[]}async _handleValidate(){this._validating=!0,this._validationErrors=[],this._validationSuccess=!1;const e=[];this._isNew&&!this._form.id&&e.push("Agent ID is required"),this._form.provider||e.push("Provider is required"),this._form.model||e.push("Model is required");const t=Number(this._form.maxSteps);this._form.maxSteps!==void 0&&this._form.maxSteps!==""&&(isNaN(t)||t<1)&&e.push("Max Steps must be a positive integer");const i=this._form.temperature;if(i!==void 0&&i!==""){const a=Number(i);(isNaN(a)||a<0||a>2)&&e.push("Temperature must be between 0 and 2")}if(e.length>0){this._validationErrors=e,this._validating=!1;return}if(this.rpcClient&&!this._isNew)try{const a=this._buildPayload();await this.rpcClient.call("agents.update",{agentId:this.agentId,config:a,dryRun:!0})}catch(a){const r=a instanceof Error?a.message:String(a);try{const o=JSON.parse(r.replace(/^RPC error \(\d+\): /,""));if(Array.isArray(o))for(const n of o){const C=Array.isArray(n.path)?n.path.join("."):"";e.push(C?`${C}: ${n.message}`:n.message)}else e.push(r)}catch{e.push(r)}}this._validationErrors=e,this._validationSuccess=e.length===0,this._validating=!1,e.length===0&&S.show("Configuration is valid","success")}async _handleSave(){if(!this.rpcClient){this._error="Not connected";return}if(this._isNew&&!this._form.id){this._error="Agent ID is required";return}this._saving=!0,this._error="";try{const e=this._buildPayload();if(this._isNew){const t=await this.rpcClient.call("agents.create",{agentId:this._form.id,config:e});this._dirtyTracker.markClean(),this._navigatingAfterSave=!0,S.show("Agent created successfully","success"),this.dispatchEvent(new CustomEvent("navigate",{detail:`agents/${t?.agentId??this._form.id}`,bubbles:!0,composed:!0}))}else await this.rpcClient.call("agents.update",{agentId:this.agentId,config:e}),this._dirtyTracker.markClean(),this._navigatingAfterSave=!0,S.show("Agent updated successfully","success"),this.dispatchEvent(new CustomEvent("navigate",{detail:`agents/${this.agentId}`,bubbles:!0,composed:!0}))}catch(e){this._error=e instanceof Error?e.message:"Save failed",S.show(this._error,"error")}finally{this._saving=!1}}_handleCancel(){if(!this._dirtyTracker.confirmNavigation())return;this._dirtyTracker.markClean(),this._navigatingAfterSave=!0;const e=this._isNew?"agents":`agents/${this.agentId}`;this.dispatchEvent(new CustomEvent("navigate",{detail:e,bubbles:!0,composed:!0}))}_buildYamlPreview(){const e=this._form,t={};e.id&&(t.agentId=e.id),e.name&&(t.name=e.name),e.provider&&(t.provider=e.provider),e.model&&(t.model=e.model),e.temperature!==void 0&&e.temperature!==""&&(t.temperature=Number(e.temperature)),e.maxSteps!==void 0&&e.maxSteps!==""&&(t.maxSteps=Number(e.maxSteps)),e.thinkingLevel&&e.thinkingLevel!=="none"&&(t.thinkingLevel=e.thinkingLevel),e.maxTokens!==void 0&&e.maxTokens!==""&&(t.maxTokens=Number(e.maxTokens));const i={};if(e["budgets.perExecution"]!==void 0&&e["budgets.perExecution"]!==""&&(i.perExecution=Number(e["budgets.perExecution"])),e["budgets.perHour"]!==void 0&&e["budgets.perHour"]!==""&&(i.perHour=Number(e["budgets.perHour"])),e["budgets.perDay"]!==void 0&&e["budgets.perDay"]!==""&&(i.perDay=Number(e["budgets.perDay"])),Object.keys(i).length>0&&(t.budgets=i),e["session.resetMode"]&&e["session.resetMode"]!=="daily"&&(t.session={resetMode:e["session.resetMode"]}),e["skills.toolPolicyProfile"]&&e["skills.toolPolicyProfile"]!=="minimal"&&(t.skills={toolPolicy:e["skills.toolPolicyProfile"]}),e["heartbeat.enabled"]){const o={enabled:!0};e["heartbeat.intervalMs"]&&(o.intervalMs=Number(e["heartbeat.intervalMs"])),e["heartbeat.target.channelType"]&&(o.targetChannel=e["heartbeat.target.channelType"]),t.heartbeat=o}const a=e["contextEngine.enabled"],r=e["contextEngine.version"];if(a!==void 0){const o={enabled:!!a,version:r||"pipeline"};e["contextEngine.thinkingKeepTurns"]!==void 0&&e["contextEngine.thinkingKeepTurns"]!==""&&(o.thinkingKeepTurns=Number(e["contextEngine.thinkingKeepTurns"])),e["contextEngine.compactionModel"]&&(o.compactionModel=e["contextEngine.compactionModel"]),e["contextEngine.evictionMinAge"]!==void 0&&e["contextEngine.evictionMinAge"]!==""&&(o.evictionMinAge=Number(e["contextEngine.evictionMinAge"])),r==="dag"&&e["contextEngine.freshTailTurns"]!==void 0&&e["contextEngine.freshTailTurns"]!==""&&(o.freshTailTurns=Number(e["contextEngine.freshTailTurns"])),r==="pipeline"&&e["contextEngine.historyTurns"]!==void 0&&e["contextEngine.historyTurns"]!==""&&(o.historyTurns=Number(e["contextEngine.historyTurns"])),t.contextEngine=o}return t}render(){if(this._loadState==="loading")return l`<ic-loading mode="skeleton" lines="8"></ic-loading>`;if(this._loadState==="error")return l`
1760
+ <div class="error-bar">${this._error}</div>
1761
+ <button class="btn btn--secondary" @click=${()=>this._loadAgent()}>Retry</button>
1762
+ `;const e=this._isNew?"Create Agent":`Edit Agent: ${this.agentId}`;return l`
1763
+ <div class="header">
1764
+ <div class="header-left">
1765
+ <ic-breadcrumb
1766
+ .items=${[{label:"Agents",route:"agents"},...this._isNew?[{label:"Create"}]:[{label:this.agentId,route:`agents/${this.agentId}`},{label:"Edit"}]]}
1767
+ @navigate=${t=>this._navigate(t.detail)}
1768
+ ></ic-breadcrumb>
1769
+ <h1 class="title">${e}</h1>
1770
+ </div>
1771
+ </div>
1772
+
1773
+ ${this._error?l`<div class="error-bar">${this._error}</div>`:$}
1774
+
1775
+ <div class="editor-layout">
1776
+ <div class="form-panel">
1777
+ <!-- Essential section (always visible, no accordion) -->
1778
+ <div class="section-card">
1779
+ <div class="essential-header">Essential</div>
1780
+ <div class="essential-content">
1781
+ <ic-agent-essential-editor
1782
+ .form=${this._form}
1783
+ .isNew=${this._isNew}
1784
+ .agentId=${this.agentId}
1785
+ .catalogProviders=${this._catalogProviders}
1786
+ @field-change=${this._handleFieldChange}
1787
+ ></ic-agent-essential-editor>
1788
+ </div>
1789
+ </div>
1790
+
1791
+ ${this._renderAccordionSection("budget","Budget",l`
1792
+ <ic-agent-budget-editor
1793
+ .form=${this._form}
1794
+ @field-change=${this._handleFieldChange}
1795
+ ></ic-agent-budget-editor>
1796
+ `)}
1797
+ ${this._renderAccordionSection("session","Session Policy",l`
1798
+ <ic-agent-session-editor
1799
+ .form=${this._form}
1800
+ @field-change=${this._handleFieldChange}
1801
+ ></ic-agent-session-editor>
1802
+ `)}
1803
+ ${this._renderAccordionSection("skills","Skills",l`
1804
+ <ic-agent-skills-editor
1805
+ .form=${this._form}
1806
+ @field-change=${this._handleFieldChange}
1807
+ ></ic-agent-skills-editor>
1808
+ `)}
1809
+ ${this._renderAccordionSection("heartbeat","Heartbeat",l`
1810
+ <ic-agent-heartbeat-editor
1811
+ .form=${this._form}
1812
+ @field-change=${this._handleFieldChange}
1813
+ ></ic-agent-heartbeat-editor>
1814
+ `)}
1815
+ ${this._renderAccordionSection("advanced","Advanced",l`
1816
+ <ic-agent-advanced-editor
1817
+ .form=${this._form}
1818
+ @field-change=${this._handleFieldChange}
1819
+ ></ic-agent-advanced-editor>
1820
+ `)}
1821
+ ${this._renderAccordionSection("contextEngine","Context Engine",l`
1822
+ <ic-agent-context-engine-editor
1823
+ .form=${this._form}
1824
+ @field-change=${this._handleFieldChange}
1825
+ ></ic-agent-context-engine-editor>
1826
+ `)}
1827
+ ${this._renderAccordionSection("streaming","Streaming (System-Wide)",l`
1828
+ <ic-agent-streaming-editor
1829
+ .config=${this._streamingConfig}
1830
+ @config-change=${this._handleConfigChange}
1831
+ ></ic-agent-streaming-editor>
1832
+ `)}
1833
+ ${this._renderAccordionSection("delivery","Delivery (System-Wide)",l`
1834
+ <ic-agent-delivery-editor
1835
+ .deliveryQueueConfig=${this._deliveryQueueConfig}
1836
+ .deliveryMirrorConfig=${this._deliveryMirrorConfig}
1837
+ @config-change=${this._handleConfigChange}
1838
+ ></ic-agent-delivery-editor>
1839
+ `)}
1840
+ ${this._renderAccordionSection("queue","Queue / Overflow (System-Wide)",l`
1841
+ <ic-agent-queue-editor
1842
+ .config=${this._queueConfig}
1843
+ @config-change=${this._handleConfigChange}
1844
+ ></ic-agent-queue-editor>
1845
+ `)}
1846
+ ${this._renderAccordionSection("autoReply","Auto-Reply (System-Wide)",l`
1847
+ <ic-agent-auto-reply-editor
1848
+ .config=${this._autoReplyConfig}
1849
+ @config-change=${this._handleConfigChange}
1850
+ ></ic-agent-auto-reply-editor>
1851
+ `)}
1852
+ ${this._renderAccordionSection("sendPolicy","Send Policy (System-Wide)",l`
1853
+ <ic-agent-send-policy-editor
1854
+ .config=${this._sendPolicyConfig}
1855
+ @config-change=${this._handleConfigChange}
1856
+ ></ic-agent-send-policy-editor>
1857
+ `)}
1858
+ ${this._renderAccordionSection("logLevel","Log Levels (Runtime)",l`
1859
+ <ic-agent-log-level-editor
1860
+ .rpcClient=${this.rpcClient}
1861
+ .applied=${this._logLevelApplied}
1862
+ @log-level-change=${this._handleLogLevelChange}
1863
+ ></ic-agent-log-level-editor>
1864
+ `)}
1865
+ </div>
1866
+ <div class="yaml-panel">
1867
+ <div class="yaml-header">YAML Preview</div>
1868
+ <pre class="yaml-preview">${X(this._buildYamlPreview())}</pre>
1869
+ </div>
1870
+ </div>
1871
+
1872
+ <div class="save-bar">
1873
+ <div class="save-bar-left">
1874
+ <button
1875
+ class="btn btn--secondary"
1876
+ ?disabled=${this._validating}
1877
+ @click=${()=>this._handleValidate()}
1878
+ >Validate</button>
1879
+ ${this._validationErrors.length>0?l`
1880
+ <div class="validation-errors">
1881
+ ${this._validationErrors.map(t=>l`<span class="validation-error">${t}</span>`)}
1882
+ </div>
1883
+ `:$}
1884
+ ${this._validationSuccess?l`
1885
+ <span class="validation-success">Valid</span>
1886
+ `:$}
1887
+ </div>
1888
+ <div class="save-bar-right">
1889
+ ${this._dirtyTracker.isDirty?l`<span class="dirty-indicator">unsaved changes</span>`:$}
1890
+ <button
1891
+ class="btn btn--cancel"
1892
+ @click=${()=>this._handleCancel()}
1893
+ >Cancel</button>
1894
+ <button
1895
+ class="btn btn--primary"
1896
+ ?disabled=${this._saving}
1897
+ @click=${()=>this._handleSave()}
1898
+ >Save</button>
1899
+ </div>
1900
+ </div>
1901
+ `}_navigate(e){this.dispatchEvent(new CustomEvent("navigate",{detail:e,bubbles:!0,composed:!0}))}_renderAccordionSection(e,t,i){return l`
1902
+ <div class="section-card">
1903
+ <details ?open=${this._expanded.has(e)} @toggle=${a=>this._handleToggle(e,a)}>
1904
+ <summary><span class="section-label">${t}</span></summary>
1905
+ <div class="section-content">
1906
+ ${i}
1907
+ </div>
1908
+ </details>
1909
+ </div>
1910
+ `}_handleToggle(e,t){const i=t.target,a=new Set(this._expanded);i.open?a.add(e):a.delete(e),this._expanded=a}};f.styles=[se,le,x`
1911
+ :host {
1912
+ display: block;
1913
+ }
1914
+
1915
+ .header {
1916
+ display: flex;
1917
+ align-items: center;
1918
+ justify-content: space-between;
1919
+ margin-bottom: var(--ic-space-lg);
1920
+ flex-wrap: wrap;
1921
+ gap: var(--ic-space-sm);
1922
+ }
1923
+
1924
+ .header-left {
1925
+ display: flex;
1926
+ flex-direction: column;
1927
+ gap: var(--ic-space-xs);
1928
+ }
1929
+
1930
+ .title {
1931
+ font-size: 1.5rem;
1932
+ font-weight: 700;
1933
+ margin: 0;
1934
+ }
1935
+
1936
+ /* Two-panel layout */
1937
+ .editor-layout {
1938
+ display: grid;
1939
+ grid-template-columns: 3fr 2fr;
1940
+ gap: var(--ic-space-lg);
1941
+ margin-bottom: 4rem; /* Space for sticky bar */
1942
+ }
1943
+
1944
+ .form-panel {
1945
+ display: flex;
1946
+ flex-direction: column;
1947
+ gap: var(--ic-space-md);
1948
+ }
1949
+
1950
+ .yaml-panel {
1951
+ position: sticky;
1952
+ top: var(--ic-space-md);
1953
+ align-self: start;
1954
+ }
1955
+
1956
+ .yaml-header {
1957
+ font-size: var(--ic-text-sm);
1958
+ font-weight: 600;
1959
+ color: var(--ic-text-dim);
1960
+ text-transform: uppercase;
1961
+ letter-spacing: 0.05em;
1962
+ margin-bottom: var(--ic-space-sm);
1963
+ }
1964
+
1965
+ .yaml-preview {
1966
+ background: var(--ic-bg, #0d1117);
1967
+ border: 1px solid var(--ic-border);
1968
+ border-radius: var(--ic-radius-md);
1969
+ padding: var(--ic-space-md);
1970
+ font-family: var(--ic-font-mono, monospace);
1971
+ font-size: var(--ic-text-xs);
1972
+ color: var(--ic-text);
1973
+ white-space: pre-wrap;
1974
+ word-break: break-word;
1975
+ overflow-y: auto;
1976
+ max-height: 80vh;
1977
+ line-height: 1.5;
1978
+ }
1979
+
1980
+ /* Accordion sections */
1981
+ .section-card {
1982
+ background: var(--ic-surface);
1983
+ border: 1px solid var(--ic-border);
1984
+ border-radius: var(--ic-radius-md);
1985
+ overflow: hidden;
1986
+ }
1987
+
1988
+ .section-card details {
1989
+ border: none;
1990
+ }
1991
+
1992
+ .section-card details summary {
1993
+ display: flex;
1994
+ align-items: center;
1995
+ gap: var(--ic-space-sm);
1996
+ padding: var(--ic-space-md) var(--ic-space-lg);
1997
+ font-size: var(--ic-text-sm);
1998
+ font-weight: 600;
1999
+ cursor: pointer;
2000
+ user-select: none;
2001
+ transition: background var(--ic-transition);
2002
+ list-style: none;
2003
+ }
2004
+
2005
+ .section-card details summary::-webkit-details-marker {
2006
+ display: none;
2007
+ }
2008
+
2009
+ .section-card details summary::before {
2010
+ content: "";
2011
+ display: inline-block;
2012
+ width: 0;
2013
+ height: 0;
2014
+ border-left: 5px solid var(--ic-text-dim);
2015
+ border-top: 4px solid transparent;
2016
+ border-bottom: 4px solid transparent;
2017
+ transition: transform var(--ic-transition);
2018
+ flex-shrink: 0;
2019
+ }
2020
+
2021
+ .section-card details[open] summary::before {
2022
+ transform: rotate(90deg);
2023
+ }
2024
+
2025
+ .section-card details summary:hover {
2026
+ background: var(--ic-surface-2);
2027
+ }
2028
+
2029
+ .section-content {
2030
+ padding: 0 var(--ic-space-lg) var(--ic-space-lg);
2031
+ }
2032
+
2033
+ .section-label {
2034
+ font-size: var(--ic-text-sm);
2035
+ font-weight: 600;
2036
+ }
2037
+
2038
+ /* Essential section (no toggle) */
2039
+ .essential-header {
2040
+ padding: var(--ic-space-md) var(--ic-space-lg);
2041
+ font-size: var(--ic-text-sm);
2042
+ font-weight: 600;
2043
+ border-bottom: 1px solid var(--ic-border);
2044
+ }
2045
+
2046
+ .essential-content {
2047
+ padding: var(--ic-space-lg);
2048
+ }
2049
+
2050
+ /* Sticky save bar */
2051
+ .save-bar {
2052
+ position: sticky;
2053
+ bottom: 0;
2054
+ z-index: 10;
2055
+ background: var(--ic-surface);
2056
+ border-top: 1px solid var(--ic-border);
2057
+ padding: var(--ic-space-md) var(--ic-space-lg);
2058
+ display: flex;
2059
+ justify-content: space-between;
2060
+ align-items: center;
2061
+ margin: 0 calc(-1 * var(--ic-space-lg, 1.5rem));
2062
+ padding-left: var(--ic-space-lg, 1.5rem);
2063
+ padding-right: var(--ic-space-lg, 1.5rem);
2064
+ }
2065
+
2066
+ .save-bar-left {
2067
+ display: flex;
2068
+ gap: var(--ic-space-sm);
2069
+ align-items: center;
2070
+ }
2071
+
2072
+ .save-bar-right {
2073
+ display: flex;
2074
+ gap: var(--ic-space-sm);
2075
+ align-items: center;
2076
+ }
2077
+
2078
+ .btn {
2079
+ padding: var(--ic-space-sm) var(--ic-space-lg);
2080
+ border-radius: var(--ic-radius-md);
2081
+ font-size: var(--ic-text-sm);
2082
+ font-weight: 500;
2083
+ font-family: inherit;
2084
+ cursor: pointer;
2085
+ border: 1px solid var(--ic-border);
2086
+ transition: background var(--ic-transition), border-color var(--ic-transition);
2087
+ }
2088
+
2089
+ .btn--cancel {
2090
+ background: transparent;
2091
+ color: var(--ic-text);
2092
+ }
2093
+
2094
+ .btn--cancel:hover {
2095
+ background: var(--ic-surface-2);
2096
+ }
2097
+
2098
+ .btn--secondary {
2099
+ background: transparent;
2100
+ color: var(--ic-text);
2101
+ border-color: var(--ic-border);
2102
+ }
2103
+
2104
+ .btn--secondary:hover {
2105
+ background: var(--ic-surface-2);
2106
+ border-color: var(--ic-accent);
2107
+ }
2108
+
2109
+ .btn--primary {
2110
+ background: var(--ic-accent);
2111
+ color: #fff;
2112
+ border-color: var(--ic-accent);
2113
+ }
2114
+
2115
+ .btn--primary:hover {
2116
+ background: var(--ic-accent-hover);
2117
+ }
2118
+
2119
+ .btn:disabled {
2120
+ opacity: 0.5;
2121
+ cursor: not-allowed;
2122
+ }
2123
+
2124
+ .error-bar {
2125
+ background: color-mix(in srgb, var(--ic-error) 15%, transparent);
2126
+ border: 1px solid var(--ic-error);
2127
+ border-radius: var(--ic-radius-md);
2128
+ padding: var(--ic-space-sm) var(--ic-space-md);
2129
+ color: var(--ic-error);
2130
+ font-size: var(--ic-text-sm);
2131
+ margin-bottom: var(--ic-space-md);
2132
+ }
2133
+
2134
+ .validation-errors {
2135
+ display: flex;
2136
+ flex-direction: column;
2137
+ gap: var(--ic-space-xs);
2138
+ }
2139
+
2140
+ .validation-error {
2141
+ color: var(--ic-error);
2142
+ font-size: var(--ic-text-xs);
2143
+ }
2144
+
2145
+ .validation-success {
2146
+ color: var(--ic-success, #22c55e);
2147
+ font-size: var(--ic-text-sm);
2148
+ }
2149
+
2150
+ .dirty-indicator {
2151
+ font-size: var(--ic-text-xs);
2152
+ color: var(--ic-warning, #f59e0b);
2153
+ font-style: italic;
2154
+ }
2155
+
2156
+ /* Responsive */
2157
+ @media (max-width: 1023px) {
2158
+ .editor-layout {
2159
+ grid-template-columns: 1fr;
2160
+ }
2161
+
2162
+ .yaml-panel {
2163
+ position: static;
2164
+ }
2165
+ }
2166
+
2167
+ @media (max-width: 767px) {
2168
+ .header {
2169
+ flex-direction: column;
2170
+ align-items: flex-start;
2171
+ }
2172
+ }
2173
+ `];g([v({attribute:!1})],f.prototype,"rpcClient",2);g([v()],f.prototype,"agentId",2);g([p()],f.prototype,"_loadState",2);g([p()],f.prototype,"_saving",2);g([p()],f.prototype,"_validating",2);g([p()],f.prototype,"_error",2);g([p()],f.prototype,"_validationErrors",2);g([p()],f.prototype,"_validationSuccess",2);g([p()],f.prototype,"_form",2);g([p()],f.prototype,"_expanded",2);g([p()],f.prototype,"_catalogProviders",2);g([p()],f.prototype,"_streamingConfig",2);g([p()],f.prototype,"_deliveryQueueConfig",2);g([p()],f.prototype,"_deliveryMirrorConfig",2);g([p()],f.prototype,"_queueConfig",2);g([p()],f.prototype,"_autoReplyConfig",2);g([p()],f.prototype,"_sendPolicyConfig",2);g([p()],f.prototype,"_logLevelApplied",2);f=g([_("ic-agent-editor")],f);export{f as IcAgentEditor};