comisai 1.0.15 → 1.0.17

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 (124) hide show
  1. package/node_modules/@comis/agent/dist/bootstrap/types.d.ts +1 -1
  2. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +12 -11
  3. package/node_modules/@comis/agent/dist/context-engine/constants.d.ts +11 -0
  4. package/node_modules/@comis/agent/dist/context-engine/constants.js +11 -0
  5. package/node_modules/@comis/agent/dist/context-engine/index.d.ts +1 -1
  6. package/node_modules/@comis/agent/dist/context-engine/index.js +1 -1
  7. package/node_modules/@comis/agent/dist/context-engine/llm-compaction.js +32 -18
  8. package/node_modules/@comis/agent/dist/executor/cache-break-diff-writer.d.ts +2 -0
  9. package/node_modules/@comis/agent/dist/executor/cache-break-diff-writer.js +36 -0
  10. package/node_modules/@comis/agent/dist/executor/executor-post-execution.d.ts +12 -0
  11. package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +117 -27
  12. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +1 -0
  13. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +16 -4
  14. package/node_modules/@comis/agent/dist/executor/executor-stream-setup.js +17 -1
  15. package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +27 -1
  16. package/node_modules/@comis/agent/dist/executor/session-snapshot-cleanup.js +3 -1
  17. package/node_modules/@comis/agent/dist/executor/stream-wrappers/index.d.ts +2 -0
  18. package/node_modules/@comis/agent/dist/executor/stream-wrappers/index.js +2 -0
  19. package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.d.ts +9 -0
  20. package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +65 -3
  21. package/node_modules/@comis/agent/dist/executor/stream-wrappers/stub-filter-injector.d.ts +28 -0
  22. package/node_modules/@comis/agent/dist/executor/stream-wrappers/stub-filter-injector.js +63 -0
  23. package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +18 -1
  24. package/node_modules/@comis/agent/dist/executor/tool-deferral.js +275 -133
  25. package/node_modules/@comis/agent/dist/executor/ttl-guard.d.ts +6 -0
  26. package/node_modules/@comis/agent/dist/executor/ttl-guard.js +8 -0
  27. package/node_modules/@comis/agent/package.json +1 -1
  28. package/node_modules/@comis/channels/dist/shared/typing-controller.d.ts +7 -0
  29. package/node_modules/@comis/channels/dist/shared/typing-controller.js +33 -0
  30. package/node_modules/@comis/channels/package.json +1 -1
  31. package/node_modules/@comis/cli/dist/commands/daemon.js +116 -28
  32. package/node_modules/@comis/cli/dist/wizard/non-interactive.js +1 -0
  33. package/node_modules/@comis/cli/dist/wizard/steps/01-detect-existing.js +4 -0
  34. package/node_modules/@comis/cli/dist/wizard/steps/07-gateway.js +9 -0
  35. package/node_modules/@comis/cli/dist/wizard/steps/10-write-config.js +2 -0
  36. package/node_modules/@comis/cli/dist/wizard/steps/12-finish.js +5 -2
  37. package/node_modules/@comis/cli/dist/wizard/types.d.ts +1 -0
  38. package/node_modules/@comis/cli/package.json +1 -1
  39. package/node_modules/@comis/core/dist/config/schema-agent.d.ts +10 -0
  40. package/node_modules/@comis/core/dist/config/schema-agent.js +8 -0
  41. package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +17 -2
  42. package/node_modules/@comis/core/dist/config/schema-gateway.js +11 -0
  43. package/node_modules/@comis/core/dist/config/schema-skills.d.ts +16 -2
  44. package/node_modules/@comis/core/dist/config/schema-skills.js +9 -2
  45. package/node_modules/@comis/core/dist/config/schema.d.ts +66 -60
  46. package/node_modules/@comis/core/package.json +1 -1
  47. package/node_modules/@comis/daemon/dist/wiring/setup-gateway.js +34 -6
  48. package/node_modules/@comis/daemon/package.json +1 -1
  49. package/node_modules/@comis/gateway/package.json +1 -1
  50. package/node_modules/@comis/infra/package.json +1 -1
  51. package/node_modules/@comis/memory/package.json +1 -1
  52. package/node_modules/@comis/scheduler/package.json +1 -1
  53. package/node_modules/@comis/shared/package.json +1 -1
  54. package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +1 -1
  55. package/node_modules/@comis/skills/package.json +1 -1
  56. package/node_modules/@comis/web/dist/android-chrome-192x192.png +0 -0
  57. package/node_modules/@comis/web/dist/android-chrome-512x512.png +0 -0
  58. package/node_modules/@comis/web/dist/apple-touch-icon.png +0 -0
  59. package/node_modules/@comis/web/dist/assets/agent-detail-BG9MGWWj.js +615 -0
  60. package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +2173 -0
  61. package/node_modules/@comis/web/dist/assets/agent-list-LHCJ4rw2.js +504 -0
  62. package/node_modules/@comis/web/dist/assets/approvals-q9VH_IKr.js +54 -0
  63. package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +375 -0
  64. package/node_modules/@comis/web/dist/assets/channel-detail-CaInesJM.js +681 -0
  65. package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +323 -0
  66. package/node_modules/@comis/web/dist/assets/chat-console-CNmzl0JW.js +943 -0
  67. package/node_modules/@comis/web/dist/assets/config-editor-DX4ITw6y.js +1374 -0
  68. package/node_modules/@comis/web/dist/assets/context-dag-browser-BwiaF5tf.js +393 -0
  69. package/node_modules/@comis/web/dist/assets/context-engine-BZ5Am6hA.js +393 -0
  70. package/node_modules/@comis/web/dist/assets/delivery-view-OfBZof-m.js +392 -0
  71. package/node_modules/@comis/web/dist/assets/diagnostics-view-YFwCxgr2.js +231 -0
  72. package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +1 -0
  73. package/node_modules/@comis/web/dist/assets/extract-variables-BM5qyK-s.js +149 -0
  74. package/node_modules/@comis/web/dist/assets/ic-array-editor-B7m6x7-S.js +118 -0
  75. package/node_modules/@comis/web/dist/assets/ic-breadcrumb-CUMpp3BL.js +75 -0
  76. package/node_modules/@comis/web/dist/assets/ic-budget-segment-bar-BtJ6x5mN.js +64 -0
  77. package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +352 -0
  78. package/node_modules/@comis/web/dist/assets/ic-confirm-dialog-CCDbB04e.js +110 -0
  79. package/node_modules/@comis/web/dist/assets/ic-connection-dot-CnT1b8xr.js +54 -0
  80. package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +277 -0
  81. package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +67 -0
  82. package/node_modules/@comis/web/dist/assets/ic-detail-panel-BF83r-if.js +116 -0
  83. package/node_modules/@comis/web/dist/assets/ic-empty-state-60l2ePhd.js +52 -0
  84. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +359 -0
  85. package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +33 -0
  86. package/node_modules/@comis/web/dist/assets/ic-layer-waterfall-COvEYMg5.js +69 -0
  87. package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +12 -0
  88. package/node_modules/@comis/web/dist/assets/ic-search-input-CSOxY9g7.js +92 -0
  89. package/node_modules/@comis/web/dist/assets/ic-select-Ce-Raudx.js +127 -0
  90. package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +95 -0
  91. package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +33 -0
  92. package/node_modules/@comis/web/dist/assets/ic-time-range-picker-CypCT68y.js +93 -0
  93. package/node_modules/@comis/web/dist/assets/ic-tool-call-7MaXSsCW.js +146 -0
  94. package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +2830 -0
  95. package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +1 -0
  96. package/node_modules/@comis/web/dist/assets/mcp-management-BNZPnpDn.js +582 -0
  97. package/node_modules/@comis/web/dist/assets/media-config-BBvTYxOX.js +314 -0
  98. package/node_modules/@comis/web/dist/assets/media-test-BkK3RCRK.js +496 -0
  99. package/node_modules/@comis/web/dist/assets/memory-inspector-1hDGCGat.js +1139 -0
  100. package/node_modules/@comis/web/dist/assets/message-center-CXefwsUu.js +785 -0
  101. package/node_modules/@comis/web/dist/assets/models-C1qcU_j3.js +894 -0
  102. package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +1 -0
  103. package/node_modules/@comis/web/dist/assets/observe-view-C0VBhX4C.js +814 -0
  104. package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +1496 -0
  105. package/node_modules/@comis/web/dist/assets/pipeline-history-DkfOQ6SW.js +317 -0
  106. package/node_modules/@comis/web/dist/assets/pipeline-history-detail-hyHgD0ai.js +287 -0
  107. package/node_modules/@comis/web/dist/assets/pipeline-list-BPW8hV-q.js +518 -0
  108. package/node_modules/@comis/web/dist/assets/pipeline-monitor-Bip16T7e.js +972 -0
  109. package/node_modules/@comis/web/dist/assets/scheduler-BGgwKd06.js +1182 -0
  110. package/node_modules/@comis/web/dist/assets/security-D15st4xx.js +1224 -0
  111. package/node_modules/@comis/web/dist/assets/session-detail-SGEYNJ0M.js +632 -0
  112. package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +1 -0
  113. package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +231 -0
  114. package/node_modules/@comis/web/dist/assets/setup-wizard-nT0tz9QP.js +853 -0
  115. package/node_modules/@comis/web/dist/assets/skills-D8yVfSUy.js +1051 -0
  116. package/node_modules/@comis/web/dist/assets/subagents-HHXMeHYo.js +193 -0
  117. package/node_modules/@comis/web/dist/assets/workspace-manager-BQlr10iH.js +785 -0
  118. package/node_modules/@comis/web/dist/comis-logo.png +0 -0
  119. package/node_modules/@comis/web/dist/favicon-16x16.png +0 -0
  120. package/node_modules/@comis/web/dist/favicon-32x32.png +0 -0
  121. package/node_modules/@comis/web/dist/favicon.ico +0 -0
  122. package/node_modules/@comis/web/dist/index.html +17 -0
  123. package/node_modules/@comis/web/package.json +29 -0
  124. package/package.json +15 -13
@@ -0,0 +1,681 @@
1
+ import{a as b,S as y,I as h,b as t,A as u,s as _,f as x,i as k,n as m,r as c,t as $}from"./index-CEcM1R_C.js";import"./ic-breadcrumb-CUMpp3BL.js";import"./ic-tabs-B7QtM_v8.js";import"./ic-icon-xeGTVhVG.js";import"./ic-connection-dot-CnT1b8xr.js";import"./ic-relative-time-3FqpjeAI.js";import"./ic-tag-CPPUnDLF.js";import"./ic-empty-state-60l2ePhd.js";var w=Object.defineProperty,T=Object.getOwnPropertyDescriptor,r=(e,i,a,n)=>{for(var l=n>1?void 0:n?T(i,a):i,o=e.length-1,d;o>=0;o--)(d=e[o])&&(l=(n?d(i,a,l):d(l))||l);return n&&l&&w(i,a,l),l};const f=[{key:"transcribeAudio",label:"Voice Transcription",description:"Transcribe inbound audio/voice attachments to text (STT)"},{key:"analyzeImages",label:"Image Analysis",description:"Analyze inbound images using vision AI"},{key:"describeVideos",label:"Video Description",description:"Generate text descriptions of inbound video attachments"},{key:"extractDocuments",label:"Document Extraction",description:"Extract text from PDF, CSV, and other document attachments"},{key:"understandLinks",label:"Link Understanding",description:"Fetch and inject content from URLs in message text"}],A={telegram:[{key:"botToken",label:"Bot Token",type:"secret"},{key:"webhookUrl",label:"Webhook URL",type:"text",placeholder:"https://..."},{key:"ackReaction.enabled",label:"Ack Reaction",type:"toggle"},{key:"ackReaction.emoji",label:"Ack Emoji",type:"text",placeholder:"👀"}],discord:[{key:"botToken",label:"Bot Token",type:"secret"},{key:"guildId",label:"Guild ID",type:"text"}],slack:[{key:"botToken",label:"Bot Token",type:"secret"},{key:"appToken",label:"App Token",type:"secret"},{key:"signingSecret",label:"Signing Secret",type:"secret"},{key:"mode",label:"Mode",type:"select",options:["socket","http"]}],whatsapp:[{key:"authDir",label:"Auth Directory",type:"text"},{key:"printQR",label:"Print QR Code",type:"toggle"}],line:[{key:"channelSecret",label:"Channel Secret",type:"secret"},{key:"webhookPath",label:"Webhook Path",type:"text",placeholder:"/webhooks/line"}],signal:[{key:"baseUrl",label:"Base URL",type:"text",placeholder:"http://127.0.0.1:8080"},{key:"account",label:"Account",type:"text"},{key:"cliPath",label:"CLI Path",type:"text"}],irc:[{key:"host",label:"Host",type:"text"},{key:"port",label:"Port",type:"text"},{key:"nick",label:"Nick",type:"text"},{key:"tls",label:"TLS",type:"toggle"},{key:"nickservPassword",label:"NickServ Password",type:"secret"},{key:"channels",label:"Channels",type:"list"}],imessage:[{key:"binaryPath",label:"Binary Path",type:"text"},{key:"account",label:"Account",type:"text"}]};function g(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}function D(e,i){return i.split(".").reduce((a,n)=>a!=null&&typeof a=="object"?a[n]:void 0,e)}let s=class extends b{constructor(){super(...arguments),this.apiClient=null,this.rpcClient=null,this.eventDispatcher=null,this.channelType="",this._loadState="loading",this._error="",this._config={},this._enabled=!1,this._status="disconnected",this._deliveryTrace=[],this._activityData=[],this._channelLastActiveAt=0,this._channelMessagesSent=0,this._channelMessagesReceived=0,this._connectionMode="",this._lastError="",this._actionPending=!1,this._queueStatus=null,this._capabilities=null,this._mediaProcessing={transcribeAudio:!0,analyzeImages:!0,describeVideos:!0,extractDocuments:!0,understandLinks:!0},this._sse=null,this._reloadDebounce=null,this._hasLoaded=!1,this._previousChannelType=""}connectedCallback(){super.connectedCallback(),this._initSse()}disconnectedCallback(){super.disconnectedCallback(),this._reloadDebounce!==null&&(clearTimeout(this._reloadDebounce),this._reloadDebounce=null)}updated(e){e.has("channelType")&&this.channelType&&this.channelType!==this._previousChannelType?(this._previousChannelType=this.channelType,this._hasLoaded=!1,this._loadData()):(e.has("rpcClient")||e.has("apiClient"))&&this.rpcClient&&this.channelType&&!this._hasLoaded&&this._loadData(),e.has("eventDispatcher")&&this.eventDispatcher&&!this._sse&&this._initSse()}_initSse(){!this.eventDispatcher||this._sse||(this._sse=new y(this,this.eventDispatcher,{"diagnostic:channel_health":()=>{this._scheduleReload(500)}}))}_scheduleReload(e=300){this._reloadDebounce!==null&&clearTimeout(this._reloadDebounce),this._reloadDebounce=setTimeout(()=>{this._reloadDebounce=null,this._loadData()},e)}async _loadData(){if(!(!this.rpcClient||!this.channelType)){this._loadState="loading",this._error="";try{const e=await this.rpcClient.call("channels.get",{channel_type:this.channelType});this._config=e??{};const i=this._config.status??"";this._enabled=this._config.enabled??(i==="running"||i==="connected"),this._status=this._config.status??"disconnected",this._connectionMode=this._config.connectionMode??"",this._lastError=this._config.lastError??"";const[a,n,l,o,d]=await Promise.allSettled([this.rpcClient.call("config.read",{section:"channels"}),this.rpcClient.call("obs.delivery.recent",{type:this.channelType,limit:10}),this.rpcClient.call("obs.channels.get",{channelId:this.channelType}),this.rpcClient.call("delivery.queue.status",{channel_type:this.channelType}),this.rpcClient.call("channels.capabilities",{channel_type:this.channelType})]);if(a.status==="fulfilled"){const v=a.value?.[this.channelType]?.mediaProcessing;v&&(this._mediaProcessing={transcribeAudio:v.transcribeAudio!==!1,analyzeImages:v.analyzeImages!==!1,describeVideos:v.describeVideos!==!1,extractDocuments:v.extractDocuments!==!1,understandLinks:v.understandLinks!==!1})}if(n.status==="fulfilled"){const p=n.value;this._deliveryTrace=p?.deliveries??p?.entries??[]}else this._deliveryTrace=[];if(l.status==="fulfilled"&&l.value?.channel){const p=l.value.channel;this._channelLastActiveAt=p.lastActiveAt??0,this._channelMessagesSent=p.messagesSent??0,this._channelMessagesReceived=p.messagesReceived??0}o.status==="fulfilled"&&o.value?this._queueStatus=o.value:this._queueStatus=null,d.status==="fulfilled"&&d.value?.features?this._capabilities=d.value.features:this._capabilities=null,this._activityData=this._deriveActivityFromTraces(this._deliveryTrace),this._loadState="loaded",this._hasLoaded=!0}catch(e){this._error=e instanceof Error?e.message:"Failed to load channel configuration",this._loadState="error"}}}async _handleRestart(){if(this.rpcClient){this._actionPending=!0;try{await this.rpcClient.call("channels.restart",{channel_type:this.channelType}),h.show(`${g(this.channelType)} restarted`,"success"),await this._loadData()}catch{h.show(`Failed to restart ${this.channelType}`,"error")}finally{this._actionPending=!1}}}async _handleToggleEnabled(){if(this.rpcClient){this._actionPending=!0;try{this._enabled?(await this.rpcClient.call("channels.disable",{channel_type:this.channelType}),this._enabled=!1,h.show(`${g(this.channelType)} disabled`,"success")):(await this.rpcClient.call("channels.enable",{channel_type:this.channelType}),this._enabled=!0,h.show(`${g(this.channelType)} enabled`,"success")),await this._loadData()}catch{h.show(`Failed to ${this._enabled?"disable":"enable"} ${this.channelType}`,"error")}finally{this._actionPending=!1}}}async _handleMediaToggle(e,i){if(this.rpcClient){this._mediaProcessing={...this._mediaProcessing,[e]:i};try{await this.rpcClient.call("config.patch",{section:"channels",key:`${this.channelType}.mediaProcessing.${e}`,value:i});const a=f.find(n=>n.key===e)?.label??e;h.show(`${a} ${i?"enabled":"disabled"}`,"success")}catch{this._mediaProcessing={...this._mediaProcessing,[e]:!i},h.show("Failed to update media processing","error")}}}_renderMediaProcessing(){return t`
2
+ <div class="section">
3
+ <h3 class="section-title">Media Processing</h3>
4
+ <div class="media-toggle-list">
5
+ ${f.map(e=>t`
6
+ <div class="media-toggle-item">
7
+ <div class="media-toggle-info">
8
+ <span class="media-toggle-label">${e.label}</span>
9
+ <span class="media-toggle-desc">${e.description}</span>
10
+ </div>
11
+ <label class="toggle-switch">
12
+ <input
13
+ type="checkbox"
14
+ .checked=${this._mediaProcessing[e.key]??!0}
15
+ ?disabled=${this._actionPending}
16
+ @change=${i=>{const a=i.target.checked;this._handleMediaToggle(e.key,a)}}
17
+ />
18
+ <span class="toggle-slider"></span>
19
+ </label>
20
+ </div>
21
+ `)}
22
+ </div>
23
+ </div>
24
+ `}_renderField(e){const i=D(this._config,e.key);switch(e.type){case"secret":return t`
25
+ <div class="field">
26
+ <label>${e.label}</label>
27
+ <div class="field-value secret">${i?"••••••••":"Not set"}</div>
28
+ </div>
29
+ `;case"toggle":return t`
30
+ <div class="field">
31
+ <label>${e.label}</label>
32
+ <div class="field-value">${i?"Enabled":"Disabled"}</div>
33
+ </div>
34
+ `;case"list":{const a=Array.isArray(i)?i:[];return t`
35
+ <div class="field">
36
+ <label>${e.label}</label>
37
+ <div class="field-value list">${a.length>0?a.join(", "):"None"}</div>
38
+ </div>
39
+ `}default:return t`
40
+ <div class="field">
41
+ <label>${e.label}</label>
42
+ <div class="field-value">${i!=null&&i!==""?String(i):"—"}</div>
43
+ </div>
44
+ `}}_renderPlatformFields(){const e=A[this.channelType];return!e||e.length===0?t`
45
+ <div class="section">
46
+ <h3 class="section-title">Platform Configuration</h3>
47
+ <p class="section-hint">No platform-specific fields defined for ${g(this.channelType)}</p>
48
+ </div>
49
+ `:t`
50
+ <div class="section">
51
+ <h3 class="section-title">${g(this.channelType)} Configuration</h3>
52
+ <div class="fields-grid">
53
+ ${e.map(i=>this._renderField(i))}
54
+ </div>
55
+ </div>
56
+ `}_renderAllowFrom(){const e=Array.isArray(this._config.allowFrom)?this._config.allowFrom:[];return t`
57
+ <div class="section">
58
+ <h3 class="section-title">Allow From</h3>
59
+ ${e.length===0?t`<p class="section-hint">No restrictions \u2014 all senders allowed</p>`:t`
60
+ <ul class="allow-list">
61
+ ${e.map(i=>t`
62
+ <li class="allow-item">
63
+ <ic-icon name="user" size="14px"></ic-icon>
64
+ ${i}
65
+ </li>
66
+ `)}
67
+ </ul>
68
+ `}
69
+ </div>
70
+ `}_renderStreamingConfig(){const e=this._config.streaming;return t`
71
+ <div class="section">
72
+ <h3 class="section-title">Streaming</h3>
73
+ ${e?t`
74
+ <div class="config-grid">
75
+ <div class="config-item">
76
+ <span class="config-label">Chunk Mode</span>
77
+ <span class="config-value">${e.chunkMode||"—"}</span>
78
+ </div>
79
+ <div class="config-item">
80
+ <span class="config-label">Pacing</span>
81
+ <span class="config-value">${e.pacingMs?`${e.pacingMs}ms`:"—"}</span>
82
+ </div>
83
+ <div class="config-item">
84
+ <span class="config-label">Typing Indicator</span>
85
+ <span class="config-value">${e.typingMode||"—"}</span>
86
+ </div>
87
+ </div>
88
+ `:t`<p class="section-hint">Default settings</p>`}
89
+ </div>
90
+ `}_renderAutoReply(){const e=this._config.autoReply;return t`
91
+ <div class="section">
92
+ <h3 class="section-title">Auto-Reply</h3>
93
+ ${e?t`
94
+ <div class="config-grid">
95
+ <div class="config-item">
96
+ <span class="config-label">Group Activation</span>
97
+ <span class="config-value">${e.groupActivation||"—"}</span>
98
+ </div>
99
+ <div class="config-item">
100
+ <span class="config-label">Cooldown</span>
101
+ <span class="config-value">${e.cooldownMs?`${e.cooldownMs}ms`:"—"}</span>
102
+ </div>
103
+ </div>
104
+ `:t`<p class="section-hint">Not configured</p>`}
105
+ </div>
106
+ `}_renderSendPolicy(){const e=this._config.sendPolicy,i=Array.isArray(e?.rules)?e.rules:[];return t`
107
+ <div class="section">
108
+ <h3 class="section-title">Send Policy</h3>
109
+ ${i.length===0?t`<p class="section-hint">No send policy rules</p>`:t`
110
+ <ul class="policy-list">
111
+ ${i.map(a=>t`<li class="policy-item">${String(a)}</li>`)}
112
+ </ul>
113
+ `}
114
+ </div>
115
+ `}_formatTimeAgo(e){if(e<=0)return"unknown";const i=Date.now()-e,a=Math.floor(i/1e3);if(a<60)return"just now";const n=Math.floor(a/60);if(n<60)return`${n}m ago`;const l=Math.floor(n/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}_deriveActivityFromTraces(e){if(e.length===0)return[];const i=Date.now(),a=new Array(24).fill(0);for(const n of e){const l=n.timestamp??n.deliveredAt??0,o=Math.floor((i-l)/36e5);o>=0&&o<24&&a[23-o]++}return a}_renderDeliveryQueuePanel(){if(!this._queueStatus)return u;const e=this._queueStatus;return t`
116
+ <div class="section">
117
+ <h3 class="section-title">Delivery Queue</h3>
118
+ <div class="config-grid">
119
+ <div class="config-item">
120
+ <span class="config-label">Pending</span>
121
+ <span class="config-value" style="${e.pending>0?"color: var(--ic-warning)":""}">${e.pending}</span>
122
+ </div>
123
+ <div class="config-item">
124
+ <span class="config-label">In Flight</span>
125
+ <span class="config-value">${e.inFlight}</span>
126
+ </div>
127
+ <div class="config-item">
128
+ <span class="config-label">Failed</span>
129
+ <span class="config-value" style="${e.failed>0?"color: var(--ic-error)":""}">${e.failed}</span>
130
+ </div>
131
+ <div class="config-item">
132
+ <span class="config-label">Delivered</span>
133
+ <span class="config-value">${e.delivered}</span>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ `}_renderCapabilitiesMatrix(){if(!this._capabilities)return u;const e=this._capabilities,i=[{label:"Reactions",supported:e.reactions},{label:"Edit Messages",supported:e.editMessages},{label:"Delete Messages",supported:e.deleteMessages},{label:"Fetch History",supported:e.fetchHistory},{label:"Attachments",supported:e.attachments},{label:"Threads",supported:e.threads},{label:"Mentions",supported:e.mentions},{label:"Buttons",supported:e.buttons},{label:"Cards",supported:e.cards},{label:"Effects",supported:e.effects}];return t`
138
+ <div class="section">
139
+ <h3 class="section-title">Platform Capabilities</h3>
140
+ <div class="config-grid">
141
+ ${i.map(a=>t`
142
+ <div class="capability-row">
143
+ <span class="config-label">${a.label}</span>
144
+ <ic-icon
145
+ name=${a.supported?"check":"x"}
146
+ size="16px"
147
+ color=${a.supported?"var(--ic-success)":"var(--ic-text-dim)"}
148
+ ></ic-icon>
149
+ </div>
150
+ `)}
151
+ </div>
152
+ </div>
153
+ `}_renderDeliveryTrace(){return t`
154
+ <div class="section">
155
+ <h3 class="section-title">Recent Deliveries</h3>
156
+ ${this._deliveryTrace.length===0?t`<p class="section-hint">No recent deliveries</p>`:t`
157
+ <div class="trace-grid" role="table" aria-label="Recent deliveries">
158
+ <div role="row" style="display:contents">
159
+ <div role="columnheader">Time</div>
160
+ <div role="columnheader">Status</div>
161
+ <div role="columnheader">Latency</div>
162
+ </div>
163
+ ${this._deliveryTrace.map((e,i)=>t`
164
+ <div role="row" class="${i%2===1?"trace-row-even":""}" style="display:contents">
165
+ <div role="cell"><ic-relative-time .timestamp=${e.timestamp??e.deliveredAt??0}></ic-relative-time></div>
166
+ <div role="cell"><ic-tag variant=${e.success??e.status==="delivered"?"success":"error"}>${e.success!==void 0?e.success?"delivered":"failed":e.status??"unknown"}</ic-tag></div>
167
+ <div role="cell">${e.latencyMs}ms</div>
168
+ </div>
169
+ `)}
170
+ </div>
171
+ `}
172
+ </div>
173
+ `}_renderActivitySparkline(){const e=Math.max(...this._activityData,1);return t`
174
+ <div class="section">
175
+ <h3 class="section-title">Message Activity (24h)</h3>
176
+ ${this._activityData.length===0?t`<p class="section-hint">No activity data available</p>`:t`
177
+ <div class="sparkline">
178
+ ${this._activityData.map(i=>t`
179
+ <div
180
+ class="spark-bar"
181
+ style="height: ${i/e*100}%"
182
+ title="${i} messages"
183
+ ></div>
184
+ `)}
185
+ </div>
186
+ `}
187
+ </div>
188
+ `}render(){return this._loadState==="loading"?t`
189
+ <div class="loading-container">
190
+ <ic-loading size="lg"></ic-loading>
191
+ </div>
192
+ `:this._loadState==="error"?t`
193
+ <div class="error-container">
194
+ <div class="error-message">${this._error}</div>
195
+ <button class="retry-btn" @click=${()=>{this._loadData()}}>Retry</button>
196
+ </div>
197
+ `:t`
198
+ <div class="channel-detail">
199
+ <ic-breadcrumb
200
+ .items=${[{label:"Channels",route:"channels"},{label:g(this.channelType)}]}
201
+ @navigate=${e=>{this.dispatchEvent(new CustomEvent("navigate",{detail:e.detail,bubbles:!1,composed:!1}))}}
202
+ ></ic-breadcrumb>
203
+
204
+ <div class="header-row">
205
+ <div class="header-left">
206
+ <ic-icon name=${this.channelType} size="32px"></ic-icon>
207
+ <h1 class="page-title">${g(this.channelType)}</h1>
208
+ <ic-connection-dot status=${this._status} size="10px" showLabel></ic-connection-dot>
209
+ ${this._connectionMode?t`<span class="connection-mode-badge">${this._connectionMode}</span>`:u}
210
+ </div>
211
+ <div class="header-actions">
212
+ <button class="btn btn-warning" @click=${()=>{this._handleRestart()}} ?disabled=${this._actionPending}>
213
+ Restart
214
+ </button>
215
+ <button
216
+ class="btn ${this._enabled?"btn-danger":"btn-primary"}"
217
+ @click=${()=>{this._handleToggleEnabled()}}
218
+ ?disabled=${this._actionPending}
219
+ >
220
+ ${this._enabled?"Disable":"Enable"}
221
+ </button>
222
+ </div>
223
+ </div>
224
+
225
+ ${this._lastError?t`
226
+ <div class="error-banner">
227
+ <ic-icon name="alert-circle" size="16px" color="var(--ic-error)"></ic-icon>
228
+ <span>${this._lastError}</span>
229
+ </div>
230
+ `:u}
231
+
232
+ ${this._channelLastActiveAt>0?t`
233
+ <div class="last-message-row">
234
+ <ic-icon name="message-circle" size="14px"></ic-icon>
235
+ <span>Last message:</span>
236
+ <span
237
+ class="last-message-time"
238
+ title=${new Date(this._channelLastActiveAt).toISOString()}
239
+ >${this._formatTimeAgo(this._channelLastActiveAt)}</span>
240
+ </div>
241
+ `:u}
242
+
243
+ <ic-tabs
244
+ .tabs=${[{id:"config",label:"Configuration"},{id:"streaming",label:"Streaming"},{id:"activity",label:"Activity"}]}
245
+ >
246
+ <div data-tab="config">
247
+ ${this._renderPlatformFields()}
248
+ ${this._renderAllowFrom()}
249
+ ${this._renderMediaProcessing()}
250
+ </div>
251
+ <div data-tab="streaming">
252
+ ${this._renderStreamingConfig()}
253
+ ${this._renderAutoReply()}
254
+ ${this._renderSendPolicy()}
255
+ </div>
256
+ <div data-tab="activity">
257
+ ${this._renderDeliveryQueuePanel()}
258
+ ${this._renderCapabilitiesMatrix()}
259
+ ${this._renderDeliveryTrace()}
260
+ ${this._renderActivitySparkline()}
261
+ </div>
262
+ </ic-tabs>
263
+ </div>
264
+ `}};s.styles=[_,x,k`
265
+ :host {
266
+ display: block;
267
+ }
268
+
269
+ .channel-detail {
270
+ display: flex;
271
+ flex-direction: column;
272
+ gap: var(--ic-space-md, 1rem);
273
+ }
274
+
275
+ /* Header */
276
+ .header-row {
277
+ display: flex;
278
+ align-items: center;
279
+ justify-content: space-between;
280
+ gap: var(--ic-space-md, 1rem);
281
+ flex-wrap: wrap;
282
+ }
283
+
284
+ .header-left {
285
+ display: flex;
286
+ align-items: center;
287
+ gap: var(--ic-space-sm, 0.5rem);
288
+ }
289
+
290
+ .page-title {
291
+ font-size: 1.5rem;
292
+ font-weight: 700;
293
+ margin: 0;
294
+ }
295
+
296
+ .header-actions {
297
+ display: flex;
298
+ gap: var(--ic-space-sm, 0.5rem);
299
+ }
300
+
301
+ /* Buttons */
302
+ .btn {
303
+ padding: 0.5rem 1rem;
304
+ font-size: var(--ic-text-sm, 0.875rem);
305
+ font-weight: 500;
306
+ border-radius: var(--ic-radius-md, 0.5rem);
307
+ border: 1px solid transparent;
308
+ cursor: pointer;
309
+ transition: background var(--ic-transition, 150ms), border-color var(--ic-transition, 150ms);
310
+ }
311
+
312
+ .btn:disabled {
313
+ opacity: 0.5;
314
+ cursor: not-allowed;
315
+ }
316
+
317
+ .btn-primary {
318
+ background: var(--ic-accent, #3b82f6);
319
+ color: white;
320
+ }
321
+
322
+ .btn-primary:hover:not(:disabled) {
323
+ background: var(--ic-accent-hover, #2563eb);
324
+ }
325
+
326
+ .btn-warning {
327
+ background: var(--ic-warning, #f59e0b);
328
+ color: #000;
329
+ }
330
+
331
+ .btn-warning:hover:not(:disabled) {
332
+ background: #d97706;
333
+ }
334
+
335
+ .btn-danger {
336
+ background: var(--ic-error, #f87171);
337
+ color: #000;
338
+ }
339
+
340
+ .btn-danger:hover:not(:disabled) {
341
+ background: #ef4444;
342
+ }
343
+
344
+ /* Section cards */
345
+ .section {
346
+ background: var(--ic-surface, #111827);
347
+ border: 1px solid var(--ic-border, #374151);
348
+ border-radius: var(--ic-radius-md, 0.5rem);
349
+ padding: var(--ic-space-md, 1rem);
350
+ }
351
+
352
+ .section-title {
353
+ font-size: var(--ic-text-sm, 0.875rem);
354
+ font-weight: 600;
355
+ color: var(--ic-text-muted, #9ca3af);
356
+ margin: 0 0 var(--ic-space-sm, 0.5rem) 0;
357
+ }
358
+
359
+ .section-hint {
360
+ color: var(--ic-text-dim, #6b7280);
361
+ font-size: var(--ic-text-sm, 0.875rem);
362
+ margin: 0;
363
+ }
364
+
365
+ /* Config grid */
366
+ .config-grid {
367
+ display: grid;
368
+ grid-template-columns: 1fr 1fr;
369
+ gap: var(--ic-space-sm, 0.5rem);
370
+ }
371
+
372
+ .config-item {
373
+ display: flex;
374
+ flex-direction: column;
375
+ gap: var(--ic-space-2xs, 0.125rem);
376
+ }
377
+
378
+ .config-label {
379
+ font-size: var(--ic-text-xs, 0.75rem);
380
+ color: var(--ic-text-dim, #6b7280);
381
+ }
382
+
383
+ .config-value {
384
+ font-size: var(--ic-text-sm, 0.875rem);
385
+ color: var(--ic-text, #f3f4f6);
386
+ }
387
+
388
+ /* Field layout */
389
+ .fields-grid {
390
+ display: grid;
391
+ grid-template-columns: 1fr 1fr;
392
+ gap: var(--ic-space-sm, 0.5rem);
393
+ }
394
+
395
+ .field {
396
+ display: flex;
397
+ flex-direction: column;
398
+ gap: var(--ic-space-2xs, 0.125rem);
399
+ }
400
+
401
+ .field label {
402
+ font-size: var(--ic-text-xs, 0.75rem);
403
+ color: var(--ic-text-dim, #6b7280);
404
+ }
405
+
406
+ .field-value {
407
+ font-size: var(--ic-text-sm, 0.875rem);
408
+ color: var(--ic-text, #f3f4f6);
409
+ background: var(--ic-surface-2, #1f2937);
410
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
411
+ border-radius: var(--ic-radius-sm, 0.25rem);
412
+ min-height: 1.75rem;
413
+ display: flex;
414
+ align-items: center;
415
+ }
416
+
417
+ .field-value.secret {
418
+ font-family: var(--ic-font-mono, ui-monospace, monospace);
419
+ color: var(--ic-text-dim, #6b7280);
420
+ }
421
+
422
+ .field-value.list {
423
+ flex-wrap: wrap;
424
+ gap: var(--ic-space-xs, 0.25rem);
425
+ }
426
+
427
+ /* Allow-from list */
428
+ .allow-list {
429
+ list-style: none;
430
+ margin: 0;
431
+ padding: 0;
432
+ display: flex;
433
+ flex-direction: column;
434
+ gap: var(--ic-space-xs, 0.25rem);
435
+ }
436
+
437
+ .allow-item {
438
+ display: flex;
439
+ align-items: center;
440
+ gap: var(--ic-space-xs, 0.25rem);
441
+ font-size: var(--ic-text-sm, 0.875rem);
442
+ color: var(--ic-text, #f3f4f6);
443
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
444
+ background: var(--ic-surface-2, #1f2937);
445
+ border-radius: var(--ic-radius-sm, 0.25rem);
446
+ }
447
+
448
+ /* Delivery trace grid (CSS grid + ARIA roles for happy-dom compat) */
449
+ .trace-grid {
450
+ display: grid;
451
+ grid-template-columns: 1fr auto auto;
452
+ font-size: var(--ic-text-sm, 0.875rem);
453
+ }
454
+
455
+ .trace-grid [role="columnheader"] {
456
+ text-align: left;
457
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
458
+ color: var(--ic-text-dim, #6b7280);
459
+ font-weight: 500;
460
+ font-size: var(--ic-text-xs, 0.75rem);
461
+ border-bottom: 1px solid var(--ic-border, #374151);
462
+ }
463
+
464
+ .trace-grid [role="cell"] {
465
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
466
+ border-bottom: 1px solid var(--ic-border, #374151);
467
+ }
468
+
469
+ .trace-row-even [role="cell"] {
470
+ background: color-mix(in srgb, var(--ic-surface-2, #1f2937) 30%, transparent);
471
+ }
472
+
473
+ /* Sparkline */
474
+ .sparkline {
475
+ display: flex;
476
+ align-items: flex-end;
477
+ gap: 2px;
478
+ height: 60px;
479
+ padding: var(--ic-space-xs, 0.25rem) 0;
480
+ }
481
+
482
+ .spark-bar {
483
+ width: 4px;
484
+ min-height: 1px;
485
+ background: var(--ic-accent, #3b82f6);
486
+ border-radius: 1px 1px 0 0;
487
+ transition: opacity var(--ic-transition, 150ms);
488
+ flex-shrink: 0;
489
+ }
490
+
491
+ .spark-bar:hover {
492
+ opacity: 0.7;
493
+ }
494
+
495
+ /* Capability rows */
496
+ .capability-row {
497
+ display: flex;
498
+ align-items: center;
499
+ justify-content: space-between;
500
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
501
+ border-bottom: 1px solid var(--ic-border, #374151);
502
+ }
503
+
504
+ .capability-row:last-child {
505
+ border-bottom: none;
506
+ }
507
+
508
+ /* Send policy list */
509
+ .policy-list {
510
+ list-style: none;
511
+ margin: 0;
512
+ padding: 0;
513
+ display: flex;
514
+ flex-direction: column;
515
+ gap: var(--ic-space-xs, 0.25rem);
516
+ }
517
+
518
+ .policy-item {
519
+ font-size: var(--ic-text-sm, 0.875rem);
520
+ color: var(--ic-text, #f3f4f6);
521
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
522
+ background: var(--ic-surface-2, #1f2937);
523
+ border-radius: var(--ic-radius-sm, 0.25rem);
524
+ }
525
+
526
+ /* Error / loading */
527
+ .error-container {
528
+ padding: var(--ic-space-xl, 2rem);
529
+ text-align: center;
530
+ }
531
+
532
+ .error-message {
533
+ color: var(--ic-error, #f87171);
534
+ margin-bottom: var(--ic-space-md, 1rem);
535
+ }
536
+
537
+ .retry-btn {
538
+ padding: 0.5rem 1rem;
539
+ background: var(--ic-accent, #3b82f6);
540
+ color: white;
541
+ border: none;
542
+ border-radius: var(--ic-radius-md, 0.5rem);
543
+ cursor: pointer;
544
+ font-size: var(--ic-text-sm, 0.875rem);
545
+ }
546
+
547
+ .retry-btn:hover {
548
+ background: var(--ic-accent-hover, #2563eb);
549
+ }
550
+
551
+ /* Error banner */
552
+ .error-banner {
553
+ display: flex;
554
+ align-items: flex-start;
555
+ gap: var(--ic-space-sm, 0.5rem);
556
+ padding: var(--ic-space-sm, 0.5rem) var(--ic-space-md, 1rem);
557
+ background: color-mix(in srgb, var(--ic-error, #f87171) 10%, transparent);
558
+ border-left: 3px solid var(--ic-error, #f87171);
559
+ border-radius: var(--ic-radius-sm, 0.25rem);
560
+ color: var(--ic-error, #f87171);
561
+ font-size: var(--ic-text-sm, 0.875rem);
562
+ line-height: 1.4;
563
+ }
564
+
565
+ .error-banner ic-icon {
566
+ flex-shrink: 0;
567
+ margin-top: 2px;
568
+ }
569
+
570
+ /* Connection mode badge */
571
+ .connection-mode-badge {
572
+ display: inline-flex;
573
+ align-items: center;
574
+ padding: 0.125rem 0.5rem;
575
+ background: var(--ic-surface-2, #1f2937);
576
+ border: 1px solid var(--ic-border, #374151);
577
+ border-radius: var(--ic-radius-sm, 0.25rem);
578
+ font-size: var(--ic-text-xs, 0.75rem);
579
+ color: var(--ic-text-dim, #6b7280);
580
+ text-transform: lowercase;
581
+ }
582
+
583
+ /* Last message time in stats section */
584
+ .last-message-row {
585
+ display: flex;
586
+ align-items: center;
587
+ gap: var(--ic-space-xs, 0.25rem);
588
+ font-size: var(--ic-text-sm, 0.875rem);
589
+ color: var(--ic-text-muted, #9ca3af);
590
+ }
591
+
592
+ .last-message-time {
593
+ color: var(--ic-text, #f3f4f6);
594
+ }
595
+
596
+ .loading-container {
597
+ display: flex;
598
+ justify-content: center;
599
+ padding: var(--ic-space-2xl, 3rem);
600
+ }
601
+
602
+ /* Media processing toggles */
603
+ .media-toggle-list {
604
+ display: flex;
605
+ flex-direction: column;
606
+ gap: var(--ic-space-xs, 0.25rem);
607
+ }
608
+
609
+ .media-toggle-item {
610
+ display: flex;
611
+ align-items: center;
612
+ justify-content: space-between;
613
+ padding: var(--ic-space-xs, 0.25rem) var(--ic-space-sm, 0.5rem);
614
+ background: var(--ic-surface-2, #1f2937);
615
+ border-radius: var(--ic-radius-sm, 0.25rem);
616
+ }
617
+
618
+ .media-toggle-info {
619
+ display: flex;
620
+ flex-direction: column;
621
+ gap: 2px;
622
+ }
623
+
624
+ .media-toggle-label {
625
+ font-size: var(--ic-text-sm, 0.875rem);
626
+ color: var(--ic-text, #f3f4f6);
627
+ font-weight: 500;
628
+ }
629
+
630
+ .media-toggle-desc {
631
+ font-size: var(--ic-text-xs, 0.75rem);
632
+ color: var(--ic-text-dim, #6b7280);
633
+ }
634
+
635
+ .toggle-switch {
636
+ position: relative;
637
+ width: 36px;
638
+ height: 20px;
639
+ flex-shrink: 0;
640
+ }
641
+
642
+ .toggle-switch input {
643
+ opacity: 0;
644
+ width: 0;
645
+ height: 0;
646
+ }
647
+
648
+ .toggle-slider {
649
+ position: absolute;
650
+ cursor: pointer;
651
+ inset: 0;
652
+ background: var(--ic-border, #374151);
653
+ border-radius: 10px;
654
+ transition: background var(--ic-transition, 150ms);
655
+ }
656
+
657
+ .toggle-slider::before {
658
+ content: "";
659
+ position: absolute;
660
+ width: 16px;
661
+ height: 16px;
662
+ left: 2px;
663
+ bottom: 2px;
664
+ background: white;
665
+ border-radius: 50%;
666
+ transition: transform var(--ic-transition, 150ms);
667
+ }
668
+
669
+ .toggle-switch input:checked + .toggle-slider {
670
+ background: var(--ic-accent, #3b82f6);
671
+ }
672
+
673
+ .toggle-switch input:checked + .toggle-slider::before {
674
+ transform: translateX(16px);
675
+ }
676
+
677
+ .toggle-switch input:disabled + .toggle-slider {
678
+ opacity: 0.5;
679
+ cursor: not-allowed;
680
+ }
681
+ `];r([m({attribute:!1})],s.prototype,"apiClient",2);r([m({attribute:!1})],s.prototype,"rpcClient",2);r([m({attribute:!1})],s.prototype,"eventDispatcher",2);r([m()],s.prototype,"channelType",2);r([c()],s.prototype,"_loadState",2);r([c()],s.prototype,"_error",2);r([c()],s.prototype,"_config",2);r([c()],s.prototype,"_enabled",2);r([c()],s.prototype,"_status",2);r([c()],s.prototype,"_deliveryTrace",2);r([c()],s.prototype,"_activityData",2);r([c()],s.prototype,"_channelLastActiveAt",2);r([c()],s.prototype,"_channelMessagesSent",2);r([c()],s.prototype,"_channelMessagesReceived",2);r([c()],s.prototype,"_connectionMode",2);r([c()],s.prototype,"_lastError",2);r([c()],s.prototype,"_actionPending",2);r([c()],s.prototype,"_queueStatus",2);r([c()],s.prototype,"_capabilities",2);r([c()],s.prototype,"_mediaProcessing",2);s=r([$("ic-channel-detail")],s);export{s as IcChannelDetail};