comisai 1.0.24 → 1.0.26

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