comisai 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/node_modules/@comis/agent/package.json +1 -1
  2. package/node_modules/@comis/channels/package.json +1 -1
  3. package/node_modules/@comis/cli/dist/wizard/non-interactive.js +1 -0
  4. package/node_modules/@comis/cli/dist/wizard/steps/01-detect-existing.js +2 -0
  5. package/node_modules/@comis/cli/dist/wizard/steps/07-gateway.js +9 -0
  6. package/node_modules/@comis/cli/dist/wizard/steps/10-write-config.js +2 -0
  7. package/node_modules/@comis/cli/dist/wizard/steps/12-finish.js +5 -2
  8. package/node_modules/@comis/cli/dist/wizard/types.d.ts +1 -0
  9. package/node_modules/@comis/cli/package.json +1 -1
  10. package/node_modules/@comis/core/dist/config/schema-gateway.d.ts +17 -2
  11. package/node_modules/@comis/core/dist/config/schema-gateway.js +11 -0
  12. package/node_modules/@comis/core/dist/config/schema.d.ts +60 -57
  13. package/node_modules/@comis/core/package.json +1 -1
  14. package/node_modules/@comis/daemon/dist/wiring/setup-gateway.js +34 -6
  15. package/node_modules/@comis/daemon/package.json +1 -1
  16. package/node_modules/@comis/gateway/package.json +1 -1
  17. package/node_modules/@comis/infra/package.json +1 -1
  18. package/node_modules/@comis/memory/package.json +1 -1
  19. package/node_modules/@comis/scheduler/package.json +1 -1
  20. package/node_modules/@comis/shared/package.json +1 -1
  21. package/node_modules/@comis/skills/package.json +1 -1
  22. package/node_modules/@comis/web/dist/android-chrome-192x192.png +0 -0
  23. package/node_modules/@comis/web/dist/android-chrome-512x512.png +0 -0
  24. package/node_modules/@comis/web/dist/apple-touch-icon.png +0 -0
  25. package/node_modules/@comis/web/dist/assets/agent-detail-BG9MGWWj.js +615 -0
  26. package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +2173 -0
  27. package/node_modules/@comis/web/dist/assets/agent-list-LHCJ4rw2.js +504 -0
  28. package/node_modules/@comis/web/dist/assets/approvals-q9VH_IKr.js +54 -0
  29. package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +375 -0
  30. package/node_modules/@comis/web/dist/assets/channel-detail-CaInesJM.js +681 -0
  31. package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +323 -0
  32. package/node_modules/@comis/web/dist/assets/chat-console-CNmzl0JW.js +943 -0
  33. package/node_modules/@comis/web/dist/assets/config-editor-DX4ITw6y.js +1374 -0
  34. package/node_modules/@comis/web/dist/assets/context-dag-browser-BwiaF5tf.js +393 -0
  35. package/node_modules/@comis/web/dist/assets/context-engine-BZ5Am6hA.js +393 -0
  36. package/node_modules/@comis/web/dist/assets/delivery-view-OfBZof-m.js +392 -0
  37. package/node_modules/@comis/web/dist/assets/diagnostics-view-YFwCxgr2.js +231 -0
  38. package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +1 -0
  39. package/node_modules/@comis/web/dist/assets/extract-variables-BM5qyK-s.js +149 -0
  40. package/node_modules/@comis/web/dist/assets/ic-array-editor-B7m6x7-S.js +118 -0
  41. package/node_modules/@comis/web/dist/assets/ic-breadcrumb-CUMpp3BL.js +75 -0
  42. package/node_modules/@comis/web/dist/assets/ic-budget-segment-bar-BtJ6x5mN.js +64 -0
  43. package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +352 -0
  44. package/node_modules/@comis/web/dist/assets/ic-confirm-dialog-CCDbB04e.js +110 -0
  45. package/node_modules/@comis/web/dist/assets/ic-connection-dot-CnT1b8xr.js +54 -0
  46. package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +277 -0
  47. package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +67 -0
  48. package/node_modules/@comis/web/dist/assets/ic-detail-panel-BF83r-if.js +116 -0
  49. package/node_modules/@comis/web/dist/assets/ic-empty-state-60l2ePhd.js +52 -0
  50. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +359 -0
  51. package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +33 -0
  52. package/node_modules/@comis/web/dist/assets/ic-layer-waterfall-COvEYMg5.js +69 -0
  53. package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +12 -0
  54. package/node_modules/@comis/web/dist/assets/ic-search-input-CSOxY9g7.js +92 -0
  55. package/node_modules/@comis/web/dist/assets/ic-select-Ce-Raudx.js +127 -0
  56. package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +95 -0
  57. package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +33 -0
  58. package/node_modules/@comis/web/dist/assets/ic-time-range-picker-CypCT68y.js +93 -0
  59. package/node_modules/@comis/web/dist/assets/ic-tool-call-7MaXSsCW.js +146 -0
  60. package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +2830 -0
  61. package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +1 -0
  62. package/node_modules/@comis/web/dist/assets/mcp-management-BNZPnpDn.js +582 -0
  63. package/node_modules/@comis/web/dist/assets/media-config-BBvTYxOX.js +314 -0
  64. package/node_modules/@comis/web/dist/assets/media-test-BkK3RCRK.js +496 -0
  65. package/node_modules/@comis/web/dist/assets/memory-inspector-1hDGCGat.js +1139 -0
  66. package/node_modules/@comis/web/dist/assets/message-center-CXefwsUu.js +785 -0
  67. package/node_modules/@comis/web/dist/assets/models-C1qcU_j3.js +894 -0
  68. package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +1 -0
  69. package/node_modules/@comis/web/dist/assets/observe-view-C0VBhX4C.js +814 -0
  70. package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +1496 -0
  71. package/node_modules/@comis/web/dist/assets/pipeline-history-DkfOQ6SW.js +317 -0
  72. package/node_modules/@comis/web/dist/assets/pipeline-history-detail-hyHgD0ai.js +287 -0
  73. package/node_modules/@comis/web/dist/assets/pipeline-list-BPW8hV-q.js +518 -0
  74. package/node_modules/@comis/web/dist/assets/pipeline-monitor-Bip16T7e.js +972 -0
  75. package/node_modules/@comis/web/dist/assets/scheduler-BGgwKd06.js +1182 -0
  76. package/node_modules/@comis/web/dist/assets/security-D15st4xx.js +1224 -0
  77. package/node_modules/@comis/web/dist/assets/session-detail-SGEYNJ0M.js +632 -0
  78. package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +1 -0
  79. package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +231 -0
  80. package/node_modules/@comis/web/dist/assets/setup-wizard-nT0tz9QP.js +853 -0
  81. package/node_modules/@comis/web/dist/assets/skills-D8yVfSUy.js +1051 -0
  82. package/node_modules/@comis/web/dist/assets/subagents-HHXMeHYo.js +193 -0
  83. package/node_modules/@comis/web/dist/assets/workspace-manager-BQlr10iH.js +785 -0
  84. package/node_modules/@comis/web/dist/comis-logo.png +0 -0
  85. package/node_modules/@comis/web/dist/favicon-16x16.png +0 -0
  86. package/node_modules/@comis/web/dist/favicon-32x32.png +0 -0
  87. package/node_modules/@comis/web/dist/favicon.ico +0 -0
  88. package/node_modules/@comis/web/dist/index.html +17 -0
  89. package/node_modules/@comis/web/package.json +29 -0
  90. package/package.json +15 -13
@@ -0,0 +1,1182 @@
1
+ import{s as C,f as E,i as A,n as f,r as o,a as M,A as p,b as r,t as S,S as H,I}from"./index-CEcM1R_C.js";import"./ic-tabs-B7QtM_v8.js";import"./ic-empty-state-60l2ePhd.js";import"./ic-relative-time-3FqpjeAI.js";import"./ic-icon-xeGTVhVG.js";import"./ic-tag-CPPUnDLF.js";var L=Object.defineProperty,U=Object.getOwnPropertyDescriptor,u=(e,t,i,a)=>{for(var s=a>1?void 0:a?U(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(s=(a?l(t,i,s):l(s))||s);return a&&s&&L(t,i,s),s};function y(e,t,i){const a=new Set;for(const s of e.split(",")){const n=s.trim(),l=n.match(/^(\*|(\d+)-(\d+))\/(\d+)$/);if(l){const v=parseInt(l[4],10);if(v<=0)return null;let b=t,m=i;if(l[2]!==void 0&&l[3]!==void 0&&(b=parseInt(l[2],10),m=parseInt(l[3],10)),b<t||m>i||b>m)return null;for(let x=b;x<=m;x+=v)a.add(x);continue}if(n==="*"){for(let v=t;v<=i;v++)a.add(v);continue}const _=n.match(/^(\d+)-(\d+)$/);if(_){const v=parseInt(_[1],10),b=parseInt(_[2],10);if(v<t||b>i||v>b)return null;for(let m=v;m<=b;m++)a.add(m);continue}if(/^\d+$/.test(n)){const v=parseInt(n,10);if(v<t||v>i)return null;a.add(v);continue}return null}return a.size>0?Array.from(a).sort((s,n)=>s-n):null}function B(e,t,i,a){const s=e.trim().split(/\s+/);if(s.length!==5)return[];const n=y(s[0],0,59),l=y(s[1],0,23),_=y(s[2],1,31),v=y(s[3],1,12),b=y(s[4],0,6);if(!n||!l||!_||!v||!b)return[];const m=new Set(n),x=new Set(l),D=new Set(_),j=new Set(v),z=new Set(b),$=[],J=366*24*60*60*1e3,R=a.getTime()+J,g=new Date(a);for(g.setSeconds(0,0),g.setTime(g.getTime()+6e4);g.getTime()<=R&&$.length<i;){const N=g.getMinutes(),O=g.getHours(),P=g.getDate(),K=g.getMonth()+1,F=g.getDay();m.has(N)&&x.has(O)&&D.has(P)&&j.has(K)&&z.has(F)&&$.push(new Date(g)),g.setTime(g.getTime()+6e4)}return $}function V(e,t,i){if(e<=0||!Number.isFinite(e))return[];const a=[];let s=i.getTime();for(let n=0;n<t;n++)s+=e,a.push(new Date(s));return a}function Z(e,t){const i=new Date(e);if(isNaN(i.getTime()))return[];const a=t??new Date;return i.getTime()>a.getTime()?[i]:[]}function G(e,t){try{return new Intl.DateTimeFormat("en-US",{weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",timeZone:t||void 0,timeZoneName:"short",hour12:!1}).format(e)}catch{return e.toISOString()}}const Y=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"];let h=class extends M{constructor(){super(...arguments),this.job=null,this.mode="create",this.agents=[],this._id="",this._name="",this._scheduleKind="cron",this._cronExpr="",this._timezone="UTC",this._everyMs=6e4,this._atDateTime="",this._enabled=!0,this._agentId="",this._message="",this._maxConcurrent=1,this._sessionTarget="main",this._deliveryMode="none",this._deliveryChannelType="",this._deliveryChannelId="",this._nextRuns=[],this._previewTimer=null}willUpdate(e){e.has("job")&&this.job&&this._populateFromJob(this.job),e.has("agents")&&this.agents.length>0&&!this._agentId&&(this._agentId=this.agents[0])}updated(e){["_scheduleKind","_cronExpr","_timezone","_everyMs","_atDateTime"].some(a=>e.has(a))&&this._schedulePreviewDebounced()}disconnectedCallback(){super.disconnectedCallback(),this._previewTimer!==null&&(clearTimeout(this._previewTimer),this._previewTimer=null)}_populateFromJob(e){this._id=e.id,this._name=e.name,this._agentId=e.agentId,this._message=e.message,this._enabled=e.enabled,this._maxConcurrent=e.maxConcurrent,this._sessionTarget=e.sessionTarget,this._scheduleKind=e.schedule.kind,this._cronExpr=e.schedule.expr??"",this._timezone=e.schedule.tz??"UTC",this._everyMs=e.schedule.everyMs??6e4,this._atDateTime=e.schedule.at??"",e.deliveryTarget?(this._deliveryMode="origin",this._deliveryChannelType=e.deliveryTarget.channelType??"",this._deliveryChannelId=e.deliveryTarget.channelId??""):(this._deliveryMode="none",this._deliveryChannelType="",this._deliveryChannelId="")}_schedulePreviewDebounced(){this._previewTimer!==null&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._computePreview()},500)}_computePreview(){const e=new Date;let t=[];switch(this._scheduleKind){case"cron":t=B(this._cronExpr,this._timezone,5,e);break;case"every":t=V(this._everyMs,5,e);break;case"at":t=Z(this._atDateTime,e);break}this._nextRuns=t.map(i=>G(i,this._scheduleKind==="cron"?this._timezone:void 0))}_assembleJob(){const e={kind:this._scheduleKind};switch(this._scheduleKind){case"cron":e.expr=this._cronExpr,e.tz=this._timezone;break;case"every":e.everyMs=this._everyMs;break;case"at":e.at=this._atDateTime;break}let t;return this._deliveryMode==="origin"&&this.job?.deliveryTarget?t=this.job.deliveryTarget:this._deliveryMode==="custom"&&(t={channelId:this._deliveryChannelId,channelType:this._deliveryChannelType,userId:"system",tenantId:"default"}),{id:this._id,name:this._name,agentId:this._agentId,schedule:e,message:this._message,enabled:this._enabled,maxConcurrent:this._maxConcurrent,sessionTarget:this._sessionTarget,deliveryTarget:t}}_onSave(){this.dispatchEvent(new CustomEvent("save",{detail:this._assembleJob()}))}_onCancel(){this.dispatchEvent(new CustomEvent("cancel"))}render(){const e=this.mode==="edit"?"Edit Cron Job":"New Cron Job";return r`
2
+ <div class="editor-card">
3
+ <h2>${e}</h2>
4
+
5
+ <div class="form-grid">
6
+ <!-- ID -->
7
+ <div class="field">
8
+ <label for="cron-id">ID</label>
9
+ <input
10
+ id="cron-id"
11
+ type="text"
12
+ .value=${this._id}
13
+ ?disabled=${this.mode==="edit"}
14
+ placeholder="e.g. daily-report"
15
+ @input=${t=>{this._id=t.target.value}}
16
+ />
17
+ </div>
18
+
19
+ <!-- Name -->
20
+ <div class="field">
21
+ <label for="cron-name">Name</label>
22
+ <input
23
+ id="cron-name"
24
+ type="text"
25
+ .value=${this._name}
26
+ placeholder="Human-readable name"
27
+ @input=${t=>{this._name=t.target.value}}
28
+ />
29
+ </div>
30
+
31
+ <!-- Schedule Kind -->
32
+ <div class="field">
33
+ <label>Schedule Kind</label>
34
+ <div class="kind-group">
35
+ <label class="kind-option">
36
+ <input
37
+ type="radio"
38
+ name="schedule-kind"
39
+ value="cron"
40
+ .checked=${this._scheduleKind==="cron"}
41
+ @change=${()=>{this._scheduleKind="cron"}}
42
+ />
43
+ <span>Cron</span>
44
+ </label>
45
+ <label class="kind-option">
46
+ <input
47
+ type="radio"
48
+ name="schedule-kind"
49
+ value="every"
50
+ .checked=${this._scheduleKind==="every"}
51
+ @change=${()=>{this._scheduleKind="every"}}
52
+ />
53
+ <span>Interval</span>
54
+ </label>
55
+ <label class="kind-option">
56
+ <input
57
+ type="radio"
58
+ name="schedule-kind"
59
+ value="at"
60
+ .checked=${this._scheduleKind==="at"}
61
+ @change=${()=>{this._scheduleKind="at"}}
62
+ />
63
+ <span>One-shot</span>
64
+ </label>
65
+ </div>
66
+ </div>
67
+
68
+ <!-- Cron fields -->
69
+ ${this._scheduleKind==="cron"?r`
70
+ <div class="field">
71
+ <label for="cron-expr">Schedule Expression</label>
72
+ <input
73
+ id="cron-expr"
74
+ type="text"
75
+ .value=${this._cronExpr}
76
+ placeholder="0 9 * * *"
77
+ @input=${t=>{this._cronExpr=t.target.value}}
78
+ />
79
+ </div>
80
+ <div class="field">
81
+ <label for="cron-tz">Timezone</label>
82
+ <select
83
+ id="cron-tz"
84
+ .value=${this._timezone}
85
+ @change=${t=>{this._timezone=t.target.value}}
86
+ >
87
+ ${Y.map(t=>r`<option value=${t} ?selected=${t===this._timezone}>${t}</option>`)}
88
+ </select>
89
+ </div>
90
+ `:p}
91
+
92
+ <!-- Interval field -->
93
+ ${this._scheduleKind==="every"?r`
94
+ <div class="field">
95
+ <label for="cron-interval">Interval (minutes)</label>
96
+ <input
97
+ id="cron-interval"
98
+ type="number"
99
+ min="1"
100
+ .value=${String(Math.round(this._everyMs/6e4))}
101
+ @input=${t=>{const i=parseInt(t.target.value,10);!isNaN(i)&&i>0&&(this._everyMs=i*6e4)}}
102
+ />
103
+ </div>
104
+ `:p}
105
+
106
+ <!-- One-shot field -->
107
+ ${this._scheduleKind==="at"?r`
108
+ <div class="field">
109
+ <label for="cron-at">Run At</label>
110
+ <input
111
+ id="cron-at"
112
+ type="datetime-local"
113
+ .value=${this._atDateTime}
114
+ @input=${t=>{this._atDateTime=t.target.value}}
115
+ />
116
+ </div>
117
+ `:p}
118
+
119
+ <!-- Enabled -->
120
+ <div class="field checkbox-field">
121
+ <input
122
+ id="cron-enabled"
123
+ type="checkbox"
124
+ .checked=${this._enabled}
125
+ @change=${t=>{this._enabled=t.target.checked}}
126
+ />
127
+ <label for="cron-enabled">Enabled</label>
128
+ </div>
129
+
130
+ <!-- Agent -->
131
+ <div class="field">
132
+ <label for="cron-agent">Agent</label>
133
+ <select
134
+ id="cron-agent"
135
+ .value=${this._agentId}
136
+ @change=${t=>{this._agentId=t.target.value}}
137
+ >
138
+ ${this.agents.length===0?r`<option value="">No agents available</option>`:this.agents.map(t=>r`<option value=${t} ?selected=${t===this._agentId}>${t}</option>`)}
139
+ </select>
140
+ </div>
141
+
142
+ <!-- Message -->
143
+ <div class="field">
144
+ <label for="cron-message">Message</label>
145
+ <textarea
146
+ id="cron-message"
147
+ rows="3"
148
+ .value=${this._message}
149
+ placeholder="Message to send to the agent..."
150
+ @input=${t=>{this._message=t.target.value}}
151
+ ></textarea>
152
+ </div>
153
+
154
+ <!-- Session Target -->
155
+ <div class="field">
156
+ <label for="cron-session">Session Target</label>
157
+ <select
158
+ id="cron-session"
159
+ .value=${this._sessionTarget}
160
+ @change=${t=>{this._sessionTarget=t.target.value}}
161
+ >
162
+ <option value="main" ?selected=${this._sessionTarget==="main"}>Main</option>
163
+ <option value="isolated" ?selected=${this._sessionTarget==="isolated"}>Isolated</option>
164
+ </select>
165
+ </div>
166
+
167
+ <!-- Delivery Target -->
168
+ <div class="field">
169
+ <label for="cron-delivery">Delivery</label>
170
+ <select
171
+ id="cron-delivery"
172
+ .value=${this._deliveryMode}
173
+ @change=${t=>{this._deliveryMode=t.target.value}}
174
+ >
175
+ <option value="none" ?selected=${this._deliveryMode==="none"}>None (local only)</option>
176
+ <option value="origin" ?selected=${this._deliveryMode==="origin"}>Origin (captured channel)</option>
177
+ <option value="custom" ?selected=${this._deliveryMode==="custom"}>Custom channel</option>
178
+ </select>
179
+ </div>
180
+ ${this._deliveryMode==="origin"&&this.job?.deliveryTarget?r`
181
+ <div class="field">
182
+ <label>Current target</label>
183
+ <span style="font-size:var(--ic-text-sm);color:var(--ic-text-dim)">${this.job.deliveryTarget.channelType??"unknown"}:${this.job.deliveryTarget.channelId}</span>
184
+ </div>
185
+ `:p}
186
+ ${this._deliveryMode==="custom"?r`
187
+ <div class="field">
188
+ <label for="cron-delivery-type">Channel Type</label>
189
+ <input
190
+ id="cron-delivery-type"
191
+ type="text"
192
+ .value=${this._deliveryChannelType}
193
+ placeholder="telegram"
194
+ @input=${t=>{this._deliveryChannelType=t.target.value}}
195
+ />
196
+ </div>
197
+ <div class="field">
198
+ <label for="cron-delivery-id">Channel ID</label>
199
+ <input
200
+ id="cron-delivery-id"
201
+ type="text"
202
+ .value=${this._deliveryChannelId}
203
+ placeholder="-100372..."
204
+ @input=${t=>{this._deliveryChannelId=t.target.value}}
205
+ />
206
+ </div>
207
+ `:p}
208
+
209
+ <!-- Max Concurrent -->
210
+ <div class="field">
211
+ <label for="cron-max">Max Concurrent</label>
212
+ <input
213
+ id="cron-max"
214
+ type="number"
215
+ min="1"
216
+ .value=${String(this._maxConcurrent)}
217
+ @input=${t=>{const i=parseInt(t.target.value,10);!isNaN(i)&&i>=1&&(this._maxConcurrent=i)}}
218
+ />
219
+ </div>
220
+
221
+ <!-- Next 5 runs preview -->
222
+ <div class="next-runs">
223
+ <h3>Next 5 runs</h3>
224
+ ${this._nextRuns.length>0?r`
225
+ <ul>
226
+ ${this._nextRuns.map(t=>r`<li>${t}</li>`)}
227
+ </ul>
228
+ `:r`<p class="empty-msg">Enter a valid schedule</p>`}
229
+ </div>
230
+ </div>
231
+
232
+ <!-- Buttons -->
233
+ <div class="button-row">
234
+ <button class="btn btn-cancel" @click=${this._onCancel}>Cancel</button>
235
+ <button class="btn btn-save" @click=${this._onSave}>Save</button>
236
+ </div>
237
+ </div>
238
+ `}};h.styles=[C,E,A`
239
+ :host {
240
+ display: block;
241
+ }
242
+
243
+ .editor-card {
244
+ background: var(--ic-surface);
245
+ border: 1px solid var(--ic-border);
246
+ border-radius: var(--ic-radius-lg);
247
+ padding: var(--ic-space-lg);
248
+ }
249
+
250
+ h2 {
251
+ margin: 0 0 var(--ic-space-lg);
252
+ font-size: var(--ic-text-lg);
253
+ font-weight: 600;
254
+ color: var(--ic-text);
255
+ }
256
+
257
+ .form-grid {
258
+ display: flex;
259
+ flex-direction: column;
260
+ gap: var(--ic-space-md);
261
+ }
262
+
263
+ .field {
264
+ display: flex;
265
+ flex-direction: column;
266
+ gap: var(--ic-space-xs);
267
+ }
268
+
269
+ label {
270
+ font-size: var(--ic-text-sm);
271
+ color: var(--ic-text-muted);
272
+ font-weight: 500;
273
+ }
274
+
275
+ input,
276
+ select,
277
+ textarea {
278
+ background: var(--ic-surface-2);
279
+ border: 1px solid var(--ic-border);
280
+ border-radius: var(--ic-radius-md);
281
+ padding: var(--ic-space-sm) var(--ic-space-md);
282
+ color: var(--ic-text);
283
+ font-size: var(--ic-text-sm);
284
+ font-family: inherit;
285
+ transition: border-color var(--ic-transition);
286
+ width: 100%;
287
+ }
288
+
289
+ input::placeholder,
290
+ textarea::placeholder {
291
+ color: var(--ic-text-dim);
292
+ }
293
+
294
+ input:focus,
295
+ select:focus,
296
+ textarea:focus {
297
+ border-color: var(--ic-accent);
298
+ outline: none;
299
+ }
300
+
301
+ input:disabled {
302
+ opacity: 0.5;
303
+ cursor: not-allowed;
304
+ }
305
+
306
+ select {
307
+ appearance: auto;
308
+ cursor: pointer;
309
+ }
310
+
311
+ textarea {
312
+ resize: vertical;
313
+ min-height: 4rem;
314
+ }
315
+
316
+ .checkbox-field {
317
+ flex-direction: row;
318
+ align-items: center;
319
+ gap: var(--ic-space-sm);
320
+ }
321
+
322
+ .checkbox-field input[type="checkbox"] {
323
+ width: auto;
324
+ accent-color: var(--ic-accent);
325
+ }
326
+
327
+ .kind-group {
328
+ display: flex;
329
+ gap: var(--ic-space-md);
330
+ }
331
+
332
+ .kind-option {
333
+ display: flex;
334
+ align-items: center;
335
+ gap: var(--ic-space-xs);
336
+ cursor: pointer;
337
+ }
338
+
339
+ .kind-option input[type="radio"] {
340
+ width: auto;
341
+ accent-color: var(--ic-accent);
342
+ }
343
+
344
+ .kind-option label {
345
+ cursor: pointer;
346
+ }
347
+
348
+ .next-runs {
349
+ margin-top: var(--ic-space-sm);
350
+ }
351
+
352
+ .next-runs h3 {
353
+ margin: 0 0 var(--ic-space-xs);
354
+ font-size: var(--ic-text-sm);
355
+ font-weight: 500;
356
+ color: var(--ic-text-muted);
357
+ }
358
+
359
+ .next-runs ul {
360
+ list-style: disc;
361
+ margin: 0;
362
+ padding-left: var(--ic-space-lg);
363
+ }
364
+
365
+ .next-runs li {
366
+ font-size: var(--ic-text-xs);
367
+ color: var(--ic-text-dim);
368
+ line-height: 1.6;
369
+ }
370
+
371
+ .next-runs .empty-msg {
372
+ font-size: var(--ic-text-xs);
373
+ color: var(--ic-text-dim);
374
+ font-style: italic;
375
+ }
376
+
377
+ .button-row {
378
+ display: flex;
379
+ justify-content: flex-end;
380
+ gap: var(--ic-space-sm);
381
+ margin-top: var(--ic-space-lg);
382
+ }
383
+
384
+ .btn {
385
+ padding: var(--ic-space-sm) var(--ic-space-lg);
386
+ border-radius: var(--ic-radius-md);
387
+ font-size: var(--ic-text-sm);
388
+ font-family: inherit;
389
+ font-weight: 500;
390
+ cursor: pointer;
391
+ transition:
392
+ background var(--ic-transition),
393
+ border-color var(--ic-transition);
394
+ }
395
+
396
+ .btn-cancel {
397
+ background: transparent;
398
+ border: 1px solid var(--ic-border);
399
+ color: var(--ic-text-muted);
400
+ }
401
+
402
+ .btn-cancel:hover {
403
+ border-color: var(--ic-text-muted);
404
+ color: var(--ic-text);
405
+ }
406
+
407
+ .btn-save {
408
+ background: var(--ic-accent);
409
+ border: 1px solid var(--ic-accent);
410
+ color: #fff;
411
+ }
412
+
413
+ .btn-save:hover {
414
+ filter: brightness(1.1);
415
+ }
416
+ `];u([f({type:Object})],h.prototype,"job",2);u([f()],h.prototype,"mode",2);u([f({type:Array})],h.prototype,"agents",2);u([o()],h.prototype,"_id",2);u([o()],h.prototype,"_name",2);u([o()],h.prototype,"_scheduleKind",2);u([o()],h.prototype,"_cronExpr",2);u([o()],h.prototype,"_timezone",2);u([o()],h.prototype,"_everyMs",2);u([o()],h.prototype,"_atDateTime",2);u([o()],h.prototype,"_enabled",2);u([o()],h.prototype,"_agentId",2);u([o()],h.prototype,"_message",2);u([o()],h.prototype,"_maxConcurrent",2);u([o()],h.prototype,"_sessionTarget",2);u([o()],h.prototype,"_deliveryMode",2);u([o()],h.prototype,"_deliveryChannelType",2);u([o()],h.prototype,"_deliveryChannelId",2);u([o()],h.prototype,"_nextRuns",2);h=u([S("ic-cron-editor")],h);var q=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,d=(e,t,i,a)=>{for(var s=a>1?void 0:a?Q(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(s=(a?l(t,i,s):l(s))||s);return a&&s&&q(t,i,s),s};const W=[{id:"cron-jobs",label:"Cron Jobs"},{id:"heartbeat",label:"Heartbeat"},{id:"extracted-tasks",label:"Extracted Tasks"}];function X(e){switch(e.kind){case"cron":return e.expr??"cron";case"every":{const t=e.everyMs??0;return t>=36e5?`Every ${Math.round(t/36e5)}h`:t>=6e4?`Every ${Math.round(t/6e4)}m`:`Every ${Math.round(t/1e3)}s`}case"at":return e.at?new Date(e.at).toLocaleString():"one-shot";default:return e.kind}}function T(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function w(e){return e<=0?"--":new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function k(e){return e>=36e5?`Every ${Math.round(e/36e5)}h`:e>=6e4?`Every ${Math.round(e/6e4)}m`:`Every ${Math.round(e/1e3)}s`}function ee(e){return{id:e.id,name:e.name,agentId:e.agentId,schedule:{kind:e.schedule.kind,expr:e.schedule.expr,tz:e.schedule.tz,everyMs:e.schedule.everyMs,at:e.schedule.at},message:e.payload?.message??e.payload?.text??"",enabled:e.enabled,maxConcurrent:1,sessionTarget:e.sessionTarget??"main",deliveryTarget:e.deliveryTarget}}let c=class extends M{constructor(){super(...arguments),this.rpcClient=null,this.routeParams={},this.eventDispatcher=null,this._jobs=[],this._loading=!0,this._error="",this._activeTab="cron-jobs",this._executions=[],this._heartbeats=[],this._heartbeatEnabled=!1,this._heartbeatIntervalMs=3e5,this._extractedTasks=[],this._editorOpen=!1,this._editingJob=null,this._editorError="",this._configAgentIds=[],this._selectedAgentId="",this._cronEnabled=null,this._cronJobCount=0,this._heartbeatAgents=[],this._heartbeatAlerts=[],this._heartbeatDeliveries=[],this._rpcStatusUnsubs=[],this._sse=null,this._jobsLoaded=!1}connectedCallback(){super.connectedCallback(),this._initSse()}disconnectedCallback(){super.disconnectedCallback();for(const e of this._rpcStatusUnsubs)e();this._rpcStatusUnsubs=[]}updated(e){if(e.has("rpcClient")&&this.rpcClient&&!this._jobsLoaded){this._loadAll();const t=this.rpcClient.onStatusChange(i=>{i==="connected"&&!this._jobsLoaded&&(this._error="",this._loadAll())});this._rpcStatusUnsubs.push(t)}if((e.has("routeParams")||e.has("_jobs"))&&this.routeParams.jobId&&this._jobsLoaded){const t=this._jobs.find(i=>i.id===this.routeParams.jobId);t&&!this._editorOpen&&(this._editingJob=t,this._editorOpen=!0,this._editorError="")}e.has("eventDispatcher")&&this.eventDispatcher&&!this._sse&&this._initSse()}_initSse(){!this.eventDispatcher||this._sse||(this._sse=new H(this,this.eventDispatcher,{"scheduler:job_started":e=>{const t=e,i={jobId:t.jobId,jobName:t.jobName??t.jobId,agentId:t.agentId??"",timestamp:t.timestamp??Date.now(),success:"pending"};this._executions=[i,...this._executions].slice(0,50)},"scheduler:job_completed":e=>{const t=e,i=this._executions.findIndex(a=>a.jobId===t.jobId&&a.success==="pending");if(i>=0){const a=[...this._executions];a[i]={...a[i],success:t.success??!0,durationMs:t.durationMs,error:t.error,timestamp:t.timestamp??a[i].timestamp},this._executions=a}else{const a={jobId:t.jobId,jobName:t.jobName??t.jobId,agentId:t.agentId??"",timestamp:t.timestamp??Date.now(),success:t.success??!0,durationMs:t.durationMs,error:t.error};this._executions=[a,...this._executions].slice(0,50)}},"scheduler:heartbeat_delivered":e=>{const t=e,i={agentId:t.agentId??"",channelType:t.channelType??"",outcome:t.outcome??"delivered",level:t.level??"ok",reason:t.reason,durationMs:t.durationMs??0,timestamp:t.timestamp??Date.now()};this._heartbeatDeliveries=[i,...this._heartbeatDeliveries].slice(0,50)},"scheduler:heartbeat_alert":e=>{const t=e,i={agentId:t.agentId??"",classification:t.classification??"transient",reason:t.reason??"",consecutiveErrors:t.consecutiveErrors??0,backoffMs:t.backoffMs??0,timestamp:t.timestamp??Date.now()};this._heartbeatAlerts=[i,...this._heartbeatAlerts].slice(0,50),this._updateAgentFromAlert(i)},"scheduler:task_extracted":e=>{const t=e,i={taskId:t.taskId??`task-${Date.now()}`,title:t.title??"Untitled task",priority:t.priority??"medium",confidence:t.confidence??0,sessionKey:t.sessionKey??"",timestamp:t.timestamp??Date.now(),status:"pending"};this._extractedTasks=[i,...this._extractedTasks]}}))}_loadAll(){this._loadAgentIds().then(()=>{Promise.allSettled([this._loadJobs(),this._loadCronStatus()])}),Promise.allSettled([this._loadHeartbeatConfig(),this._loadHeartbeatStates()])}async _loadJobs(){if(!this.rpcClient){this._loading=!1;return}try{const e=await this.rpcClient.call("cron.list",{_agentId:this._selectedAgentId||void 0});this._jobs=Array.isArray(e)?e:e.jobs??[],this._jobsLoaded=!0}catch(e){const t=e instanceof Error?e.message:"Failed to load jobs";t.includes("not enabled")?(this._cronEnabled=!1,this._error=""):this._error=t}finally{this._loading=!1}}async _loadHeartbeatConfig(){if(this.rpcClient)try{const t=(await this.rpcClient.call("config.read",{section:"scheduler"}))?.heartbeat;t&&(this._heartbeatEnabled=t.enabled??!1,this._heartbeatIntervalMs=t.intervalMs??3e5)}catch{}}async _loadAgentIds(){if(this.rpcClient){try{const e=await this.rpcClient.call("config.read",{section:"agents"});e&&typeof e=="object"&&(this._configAgentIds=Object.keys(e))}catch{}this._configAgentIds.length>0&&!this._selectedAgentId&&(this._selectedAgentId=this._configAgentIds[0])}}async _loadCronStatus(){if(!(!this.rpcClient||!this._selectedAgentId))try{const e=await this.rpcClient.call("cron.status",{_agentId:this._selectedAgentId});this._cronEnabled=e?.running??null,this._cronJobCount=e?.jobCount??0}catch{this._cronEnabled=null}}async _loadHeartbeatStates(){if(this.rpcClient)try{const e=await this.rpcClient.call("heartbeat.states",{});this._heartbeatAgents=e?.agents??[]}catch{}}_updateAgentFromAlert(e){const t=this._heartbeatAgents.findIndex(a=>a.agentId===e.agentId);if(t<0)return;const i=[...this._heartbeatAgents];i[t]={...i[t],consecutiveErrors:e.consecutiveErrors,lastAlertMs:e.timestamp,lastErrorKind:e.classification},this._heartbeatAgents=i}_onAgentSelect(e){e!==this._selectedAgentId&&(this._selectedAgentId=e,this._jobs=[],this._executions=[],this._error="",this._loading=!0,this._jobsLoaded=!1,this._loadJobs(),this._loadCronStatus())}async _handleEditorSave(e){if(!this.rpcClient)return;const t=e.detail;if(this._editorError="",this._editingJob){const i=[...this._jobs],a=this._jobs.findIndex(s=>s.id===this._editingJob.id);if(a>=0){const s={...this._jobs[a],name:t.name,agentId:t.agentId,schedule:t.schedule,payload:{kind:"agent_turn",message:t.message},sessionTarget:t.sessionTarget,enabled:t.enabled,deliveryTarget:t.deliveryTarget},n=[...this._jobs];n[a]=s,this._jobs=n}try{await this.rpcClient.call("cron.update",{jobId:this._editingJob.id,_agentId:this._selectedAgentId,...t}),this._editorOpen=!1,this._editingJob=null}catch(s){this._jobs=i,this._editorError=s instanceof Error?s.message:"Failed to update job"}}else{const i={id:t.id,name:t.name,agentId:t.agentId,schedule:t.schedule,payload:{kind:"agent_turn",message:t.message},sessionTarget:t.sessionTarget,enabled:t.enabled,consecutiveErrors:0,createdAtMs:Date.now(),deliveryTarget:t.deliveryTarget};this._jobs=[...this._jobs,i];try{const a=await this.rpcClient.call("cron.add",{...t,_agentId:this._selectedAgentId,_deliveryTarget:t.deliveryTarget});if(a?.jobId&&a.jobId!==i.id){const s=this._jobs.findIndex(n=>n.id===i.id);if(s>=0){const n=[...this._jobs];n[s]={...n[s],id:a.jobId},this._jobs=n}}this._editorOpen=!1,this._editingJob=null}catch(a){this._jobs=this._jobs.filter(s=>s.id!==i.id),this._editorError=a instanceof Error?a.message:"Failed to create job"}}}async _handleDeleteJob(e){if(!this.rpcClient||!window.confirm("Delete this job?"))return;const t=[...this._jobs];this._jobs=this._jobs.filter(i=>i.id!==e);try{await this.rpcClient.call("cron.remove",{jobId:e,_agentId:this._selectedAgentId})}catch(i){this._jobs=t,this._error=i instanceof Error?i.message:"Failed to delete job"}}async _handleToggleHeartbeat(){if(!this.rpcClient)return;const e=!this._heartbeatEnabled;this._heartbeatEnabled=e;try{await this.rpcClient.call("config.set",{section:"scheduler",path:"heartbeat.enabled",value:e})}catch(t){this._heartbeatEnabled=!e,this._error=t instanceof Error?t.message:"Failed to toggle heartbeat"}}_handleCompleteTask(e){this._extractedTasks=this._extractedTasks.map(t=>t.taskId===e?{...t,status:"completed"}:t)}_handleDismissTask(e){this._extractedTasks=this._extractedTasks.map(t=>t.taskId===e?{...t,status:"dismissed"}:t)}async _handleRunJob(e){if(this.rpcClient)try{await this.rpcClient.call("cron.run",{jobName:e,_agentId:this._selectedAgentId}),I.show("Job triggered","success")}catch(t){this._error=t instanceof Error?t.message:"Failed to run job"}}async _handleTriggerHeartbeat(e){if(this.rpcClient)try{await this.rpcClient.call("heartbeat.trigger",{agentId:e}),I.show("Heartbeat triggered for "+e,"success")}catch(t){this._error=t instanceof Error?t.message:"Failed to trigger heartbeat"}}_openCreateEditor(){this._editingJob=null,this._editorOpen=!0,this._editorError=""}_openEditEditor(e){this._editingJob=e,this._editorOpen=!0,this._editorError=""}_closeEditor(){this._editorOpen=!1,this._editingJob=null,this._editorError=""}_closeEditorOnBackdrop(e){e.target===e.currentTarget&&this._closeEditor()}_onTabChange(e){this._activeTab=e.detail}get _editingJobInput(){return this._editingJob?ee(this._editingJob):null}get _agentIds(){const e=new Set([...this._configAgentIds,...this._jobs.map(i=>i.agentId)]),t=Array.from(e);if(this._selectedAgentId){const i=t.indexOf(this._selectedAgentId);i>0&&(t.splice(i,1),t.unshift(this._selectedAgentId))}return t}_renderAgentSelector(){return this._configAgentIds.length<=1&&this._jobs.length===0?p:r`
417
+ <div class="agent-selector" role="radiogroup" aria-label="Select agent">
418
+ <span class="agent-selector-label">Agent:</span>
419
+ ${this._configAgentIds.map(e=>r`
420
+ <button
421
+ class="agent-pill ${e===this._selectedAgentId?"agent-pill--active":""}"
422
+ role="radio"
423
+ aria-checked=${e===this._selectedAgentId?"true":"false"}
424
+ @click=${()=>this._onAgentSelect(e)}
425
+ >${e}</button>
426
+ `)}
427
+ </div>
428
+ `}_renderAgentStatus(){if(this._cronEnabled===null)return p;const e=this._cronEnabled?"status-dot status-dot--active":"status-dot status-dot--inactive",t=this._cronEnabled?`Cron scheduler running (${this._cronJobCount} job${this._cronJobCount!==1?"s":""})`:`Cron scheduler not enabled for '${this._selectedAgentId}'`;return r`
429
+ <div class="agent-status">
430
+ <span class=${e}></span>
431
+ <span>${t}</span>
432
+ </div>
433
+ `}_renderJobRow(e){const t=e.enabled?e.consecutiveErrors>0?"status-dot status-dot--error":"status-dot status-dot--active":"status-dot status-dot--inactive";return r`
434
+ <div class="grid-row" role="row" @click=${()=>this._openEditEditor(e)}>
435
+ <div class="cell" role="cell">${e.name||e.id}</div>
436
+ <div class="cell" role="cell">${X(e.schedule)}</div>
437
+ <div class="cell" role="cell">
438
+ ${e.lastRunAtMs&&e.lastRunAtMs>0?r`<ic-relative-time .timestamp=${e.lastRunAtMs}></ic-relative-time>`:"Never"}
439
+ </div>
440
+ <div class="cell" role="cell">
441
+ ${e.enabled&&e.nextRunAtMs&&e.nextRunAtMs>0?r`<ic-relative-time .timestamp=${e.nextRunAtMs}></ic-relative-time>`:"(off)"}
442
+ </div>
443
+ <div class="cell" role="cell">
444
+ <span class="status-info">
445
+ <span class=${t}></span>
446
+ ${e.consecutiveErrors>0?r`<span class="error-count">${e.consecutiveErrors} errors</span>`:p}
447
+ </span>
448
+ </div>
449
+ <div class="cell" role="cell">
450
+ ${e.deliveryTarget?r`<ic-tag variant="info">${e.deliveryTarget.channelType??"channel"}</ic-tag>`:r`<span style="color:var(--ic-text-dim)">local</span>`}
451
+ </div>
452
+ <div class="cell" role="cell">
453
+ <div class="action-group">
454
+ <button
455
+ class="btn-run"
456
+ ?disabled=${!e.enabled}
457
+ title=${e.enabled?"Execute this job now":"Enable job to run"}
458
+ @click=${i=>{i.stopPropagation(),this._handleRunJob(e.name||e.id)}}
459
+ >Run</button>
460
+ <button
461
+ class="btn-edit"
462
+ title="Edit this job"
463
+ @click=${i=>{i.stopPropagation(),this._openEditEditor(e)}}
464
+ >Edit</button>
465
+ <button
466
+ class="btn-delete"
467
+ @click=${i=>{i.stopPropagation(),this._handleDeleteJob(e.id)}}
468
+ >Delete</button>
469
+ </div>
470
+ </div>
471
+ </div>
472
+ `}_renderCronJobsTab(){return r`
473
+ ${this._renderAgentSelector()}
474
+ ${this._renderAgentStatus()}
475
+ ${this._loading?r`<ic-skeleton-view variant="list"></ic-skeleton-view>`:this._jobs.length===0?r`
476
+ <ic-empty-state
477
+ icon="clock"
478
+ message="No scheduled jobs"
479
+ description="Configure cron jobs or heartbeat checks for your agents."
480
+ >
481
+ <button class="cta-btn" style="background:var(--ic-accent);color:#fff;border:none;border-radius:var(--ic-radius-md);padding:0.5rem 1rem;cursor:pointer;font-family:inherit;font-size:var(--ic-text-sm)" @click=${()=>{window.location.hash="#/config"}}>Open Settings</button>
482
+ </ic-empty-state>
483
+ `:r`
484
+ <div class="job-grid" role="table">
485
+ <div class="grid-header" role="row">
486
+ <div class="cell" role="columnheader">Name</div>
487
+ <div class="cell" role="columnheader">Schedule</div>
488
+ <div class="cell" role="columnheader">Last Run</div>
489
+ <div class="cell" role="columnheader">Next Run</div>
490
+ <div class="cell" role="columnheader">Status</div>
491
+ <div class="cell" role="columnheader">Deliver</div>
492
+ <div class="cell" role="columnheader">Actions</div>
493
+ </div>
494
+ ${this._jobs.map(e=>this._renderJobRow(e))}
495
+ </div>
496
+
497
+ ${this._renderRecentExecutions()}
498
+ `}
499
+ `}_renderRecentExecutions(){return r`
500
+ <div class="executions-section">
501
+ <h3>Recent Executions</h3>
502
+ ${this._executions.length===0?r`<div class="no-data">No recent executions</div>`:r`
503
+ <div class="execution-list">
504
+ ${this._executions.map(e=>r`
505
+ <div class="execution-entry">
506
+ <span class="exec-timestamp">${w(e.timestamp)}</span>
507
+ <span class="exec-job">${e.jobName||e.jobId}</span>
508
+ <span class=${e.success==="pending"?"exec-result--pending":e.success?"exec-result--success":"exec-result--fail"}>${e.success==="pending"?"...":e.success?"OK":"FAIL"}</span>
509
+ ${e.durationMs!=null?r`<span class="exec-duration">(${T(e.durationMs)})</span>`:p}
510
+ ${e.error?r`<span class="exec-error">${e.error}</span>`:p}
511
+ </div>
512
+ `)}
513
+ </div>
514
+ `}
515
+ </div>
516
+ `}_renderHeartbeatTab(){if(this._heartbeatAgents.length===0)return this._heartbeatEnabled||this._heartbeats.length>0?r`
517
+ <div class="hb-summary-bar">
518
+ <span>Global heartbeat: ${this._heartbeatEnabled?"enabled":"disabled"}</span>
519
+ <span>Interval: ${k(this._heartbeatIntervalMs)}</span>
520
+ </div>
521
+ <ic-empty-state
522
+ icon="scheduler"
523
+ message="No heartbeat agents"
524
+ description="Configure heartbeat in agent settings to see per-agent status."
525
+ ></ic-empty-state>
526
+ `:r`
527
+ <ic-empty-state
528
+ icon="scheduler"
529
+ message="No heartbeat agents"
530
+ description="Configure heartbeat in agent settings to see per-agent status."
531
+ ></ic-empty-state>
532
+ `;const e=Date.now(),t=this._heartbeatAgents.filter(s=>s.enabled).length,i=this._heartbeatAgents.filter(s=>s.backoffUntilMs>e).length,a=this._heartbeatAgents.filter(s=>s.consecutiveErrors>0).length;return r`
533
+ <div class="hb-summary-bar">
534
+ <span>${t} agent${t!==1?"s":""} enabled</span>
535
+ ${i>0?r`<span class="alerts-highlight">${i} in backoff</span>`:p}
536
+ ${a>0?r`<span class="alerts-highlight">${a} with errors</span>`:p}
537
+ </div>
538
+
539
+ <div class="hb-card-grid">
540
+ ${this._heartbeatAgents.map(s=>this._renderHeartbeatCard(s,e))}
541
+ </div>
542
+
543
+ ${this._heartbeatAlerts.length>0?r`
544
+ <div class="hb-recent-section">
545
+ <h3>Recent Alerts</h3>
546
+ <div class="hb-event-list">
547
+ ${this._heartbeatAlerts.slice(0,20).map(s=>r`
548
+ <div class="hb-event-entry">
549
+ <span class="hb-event-ts">${w(s.timestamp)}</span>
550
+ <span class="hb-event-agent">${s.agentId}</span>
551
+ <ic-tag variant=${s.classification==="permanent"?"error":"warning"}>${s.classification}</ic-tag>
552
+ <span class="hb-event-reason">${s.reason}</span>
553
+ ${s.backoffMs>0?r`<span class="hb-event-duration">(backoff ${k(s.backoffMs)})</span>`:p}
554
+ </div>
555
+ `)}
556
+ </div>
557
+ </div>
558
+ `:p}
559
+
560
+ ${this._heartbeatDeliveries.length>0?r`
561
+ <div class="hb-recent-section">
562
+ <h3>Recent Deliveries</h3>
563
+ <div class="hb-event-list">
564
+ ${this._heartbeatDeliveries.slice(0,20).map(s=>r`
565
+ <div class="hb-event-entry">
566
+ <span class="hb-event-ts">${w(s.timestamp)}</span>
567
+ <span class="hb-event-agent">${s.agentId}</span>
568
+ <ic-tag variant=${s.outcome==="delivered"?"success":s.outcome==="failed"?"error":"warning"}>${s.outcome}</ic-tag>
569
+ <span>${s.channelType}</span>
570
+ <span class="hb-event-duration">(${T(s.durationMs)})</span>
571
+ </div>
572
+ `)}
573
+ </div>
574
+ </div>
575
+ `:p}
576
+ `}_renderHeartbeatCard(e,t){const i=e.backoffUntilMs>t,a=e.consecutiveErrors>0,s=e.tickStartedAtMs>0;let n,l;return e.enabled?i?(n="backoff",l="warning"):a?(n="error",l="error"):(n="healthy",l="success"):(n="disabled",l="default"),r`
577
+ <div class="hb-card">
578
+ <div class="hb-card-header">
579
+ <span class="hb-card-agent">${e.agentId}</span>
580
+ <ic-tag variant=${l}>${n}</ic-tag>
581
+ </div>
582
+ <div class="hb-card-row">
583
+ <span class="hb-card-label">Interval:</span>
584
+ <span>${k(e.intervalMs)}</span>
585
+ </div>
586
+ <div class="hb-card-row">
587
+ <span class="hb-card-label">Last run:</span>
588
+ ${e.lastRunMs>0?r`<ic-relative-time .timestamp=${e.lastRunMs}></ic-relative-time>`:r`<span>--</span>`}
589
+ </div>
590
+ <div class="hb-card-row">
591
+ <span class="hb-card-label">Next due:</span>
592
+ ${e.nextDueMs>0?r`<ic-relative-time .timestamp=${e.nextDueMs}></ic-relative-time>`:r`<span>--</span>`}
593
+ </div>
594
+ ${a?r`
595
+ <div class="hb-card-row">
596
+ <span class="hb-card-label">Errors:</span>
597
+ <span class="alerts-highlight">${e.consecutiveErrors}${e.lastErrorKind?` (${e.lastErrorKind})`:""}</span>
598
+ </div>
599
+ `:p}
600
+ ${s?r`<span class="hb-running-indicator">running...</span>`:p}
601
+ <button
602
+ class="btn-run"
603
+ ?disabled=${!e.enabled}
604
+ title=${e.enabled?"Trigger heartbeat check now":"Enable heartbeat to trigger"}
605
+ @click=${()=>this._handleTriggerHeartbeat(e.agentId)}
606
+ style="margin-top:var(--ic-space-xs);align-self:flex-start"
607
+ >Trigger</button>
608
+ </div>
609
+ `}_renderExtractedTasksTab(){return this._extractedTasks.length===0?r`
610
+ <ic-empty-state
611
+ icon="scheduler"
612
+ message="No extracted tasks"
613
+ description="Tasks will appear when agents extract them from conversations."
614
+ ></ic-empty-state>
615
+ `:r`
616
+ <div class="task-grid" role="table">
617
+ <div class="grid-header" role="row">
618
+ <div class="cell" role="columnheader">Title</div>
619
+ <div class="cell" role="columnheader">Priority</div>
620
+ <div class="cell" role="columnheader">Status</div>
621
+ <div class="cell" role="columnheader">Actions</div>
622
+ </div>
623
+ ${this._extractedTasks.map(e=>this._renderTaskRow(e))}
624
+ </div>
625
+ `}_renderTaskRow(e){const t=`priority-tag priority-tag--${e.priority}`;return r`
626
+ <div class="grid-row" role="row">
627
+ <div class="cell" role="cell">${e.title}</div>
628
+ <div class="cell" role="cell">
629
+ <span class=${t}>${e.priority}</span>
630
+ </div>
631
+ <div class="cell" role="cell">${e.status}</div>
632
+ <div class="cell" role="cell">
633
+ ${e.status==="pending"?r`
634
+ <div class="task-actions">
635
+ <button class="btn-sm btn-complete" @click=${()=>this._handleCompleteTask(e.taskId)}>Complete</button>
636
+ <button class="btn-sm btn-dismiss" @click=${()=>this._handleDismissTask(e.taskId)}>Dismiss</button>
637
+ </div>
638
+ `:p}
639
+ </div>
640
+ </div>
641
+ `}_renderEditorOverlay(){return this._editorOpen?r`
642
+ <div class="editor-overlay" @click=${this._closeEditorOnBackdrop}>
643
+ <div class="editor-panel" @click=${e=>e.stopPropagation()}>
644
+ <ic-cron-editor
645
+ .job=${this._editingJobInput}
646
+ .mode=${this._editingJob?"edit":"create"}
647
+ .agents=${this._agentIds}
648
+ @save=${this._handleEditorSave}
649
+ @cancel=${()=>this._closeEditor()}
650
+ ></ic-cron-editor>
651
+ ${this._editorError?r`<div class="editor-error">${this._editorError}</div>`:p}
652
+ </div>
653
+ </div>
654
+ `:p}render(){return r`
655
+ <div class="scheduler-header">
656
+ <h2>Scheduler</h2>
657
+ <button class="btn-primary" @click=${()=>this._openCreateEditor()}>+ New Job</button>
658
+ </div>
659
+
660
+ ${this._error?r`<div class="error-message">${this._error}</div>`:p}
661
+
662
+ <ic-tabs
663
+ .tabs=${W}
664
+ .activeTab=${this._activeTab}
665
+ @tab-change=${this._onTabChange}
666
+ >
667
+ <div slot="cron-jobs">${this._renderCronJobsTab()}</div>
668
+ <div slot="heartbeat">${this._renderHeartbeatTab()}</div>
669
+ <div slot="extracted-tasks">${this._renderExtractedTasksTab()}</div>
670
+ </ic-tabs>
671
+
672
+ ${this._renderEditorOverlay()}
673
+ `}};c.styles=[C,E,A`
674
+ :host {
675
+ display: block;
676
+ }
677
+
678
+ .scheduler-header {
679
+ display: flex;
680
+ align-items: center;
681
+ justify-content: space-between;
682
+ margin-bottom: var(--ic-space-lg);
683
+ }
684
+
685
+ .scheduler-header h2 {
686
+ margin: 0;
687
+ font-size: var(--ic-text-lg);
688
+ font-weight: 600;
689
+ color: var(--ic-text);
690
+ }
691
+
692
+ .btn-primary {
693
+ background: var(--ic-accent);
694
+ color: #fff;
695
+ border: none;
696
+ border-radius: var(--ic-radius-md);
697
+ padding: var(--ic-space-sm) var(--ic-space-lg);
698
+ font-size: var(--ic-text-sm);
699
+ font-family: inherit;
700
+ font-weight: 500;
701
+ cursor: pointer;
702
+ transition: background var(--ic-transition);
703
+ }
704
+
705
+ .btn-primary:hover {
706
+ filter: brightness(1.1);
707
+ }
708
+
709
+ /* Error message */
710
+ .error-message {
711
+ color: var(--ic-error, #f87171);
712
+ font-size: var(--ic-text-sm);
713
+ padding: var(--ic-space-sm) var(--ic-space-md);
714
+ background: rgba(127, 29, 29, 0.12);
715
+ border: 1px solid #7f1d1d;
716
+ border-radius: var(--ic-radius-md);
717
+ margin-bottom: var(--ic-space-md);
718
+ }
719
+
720
+ /* Job grid table (div-based for happy-dom compat) */
721
+ .job-grid {
722
+ display: grid;
723
+ grid-template-columns: minmax(100px, 2fr) minmax(80px, 1fr) minmax(80px, 1fr) minmax(80px, 1fr) 80px minmax(60px, 1fr) auto;
724
+ width: 100%;
725
+ }
726
+
727
+ .grid-header {
728
+ display: contents;
729
+ }
730
+
731
+ .grid-header .cell {
732
+ background: var(--ic-surface);
733
+ padding: var(--ic-space-sm) var(--ic-space-md);
734
+ font-size: var(--ic-text-xs);
735
+ font-weight: 600;
736
+ color: var(--ic-text-muted);
737
+ text-transform: uppercase;
738
+ letter-spacing: 0.05em;
739
+ border-bottom: 1px solid var(--ic-border);
740
+ }
741
+
742
+ .grid-row {
743
+ display: contents;
744
+ cursor: pointer;
745
+ }
746
+
747
+ .grid-row .cell {
748
+ padding: var(--ic-space-sm) var(--ic-space-md);
749
+ font-size: var(--ic-text-sm);
750
+ border-bottom: 1px solid var(--ic-border);
751
+ color: var(--ic-text);
752
+ display: flex;
753
+ align-items: center;
754
+ transition: background var(--ic-transition);
755
+ }
756
+
757
+ .grid-row:hover .cell {
758
+ background: var(--ic-surface-2);
759
+ }
760
+
761
+ /* Status dot */
762
+ .status-dot {
763
+ display: inline-block;
764
+ width: 8px;
765
+ height: 8px;
766
+ border-radius: 50%;
767
+ }
768
+
769
+ .status-dot--active {
770
+ background: #22c55e;
771
+ }
772
+
773
+ .status-dot--inactive {
774
+ background: var(--ic-text-dim, #6b7280);
775
+ }
776
+
777
+ .status-dot--error {
778
+ background: #ef4444;
779
+ }
780
+
781
+ .status-info {
782
+ display: inline-flex;
783
+ align-items: center;
784
+ gap: var(--ic-space-xs);
785
+ }
786
+
787
+ .error-count {
788
+ font-size: var(--ic-text-xs);
789
+ color: #ef4444;
790
+ }
791
+
792
+ /* Delete button */
793
+ .btn-delete {
794
+ background: transparent;
795
+ border: none;
796
+ color: var(--ic-text-dim);
797
+ font-size: var(--ic-text-xs);
798
+ cursor: pointer;
799
+ padding: 4px 8px;
800
+ border-radius: var(--ic-radius-sm, 0.25rem);
801
+ transition: color var(--ic-transition), background var(--ic-transition);
802
+ font-family: inherit;
803
+ }
804
+
805
+ .btn-delete:hover {
806
+ color: #ef4444;
807
+ background: rgba(239, 68, 68, 0.1);
808
+ }
809
+
810
+ /* Run / Trigger action buttons */
811
+ .btn-run {
812
+ background: transparent;
813
+ border: 1px solid var(--ic-accent);
814
+ color: var(--ic-accent);
815
+ font-size: var(--ic-text-xs);
816
+ cursor: pointer;
817
+ padding: 4px 8px;
818
+ border-radius: var(--ic-radius-sm, 0.25rem);
819
+ transition: color var(--ic-transition), background var(--ic-transition);
820
+ font-family: inherit;
821
+ }
822
+
823
+ .btn-run:hover {
824
+ background: var(--ic-accent);
825
+ color: #fff;
826
+ }
827
+
828
+ .btn-run:disabled {
829
+ opacity: 0.4;
830
+ cursor: not-allowed;
831
+ }
832
+
833
+ .btn-run:disabled:hover {
834
+ background: transparent;
835
+ color: var(--ic-accent);
836
+ }
837
+
838
+ .action-group {
839
+ display: flex;
840
+ gap: var(--ic-space-xs);
841
+ }
842
+
843
+ /* Recent executions */
844
+ .executions-section {
845
+ margin-top: var(--ic-space-xl, 2rem);
846
+ }
847
+
848
+ .executions-section h3 {
849
+ font-size: var(--ic-text-sm);
850
+ font-weight: 600;
851
+ color: var(--ic-text-muted);
852
+ margin: 0 0 var(--ic-space-sm);
853
+ }
854
+
855
+ .execution-list {
856
+ display: flex;
857
+ flex-direction: column;
858
+ gap: 2px;
859
+ }
860
+
861
+ .execution-entry {
862
+ display: flex;
863
+ align-items: center;
864
+ gap: var(--ic-space-sm);
865
+ padding: var(--ic-space-xs) var(--ic-space-sm);
866
+ font-size: var(--ic-text-xs);
867
+ border-radius: var(--ic-radius-sm, 0.25rem);
868
+ }
869
+
870
+ .execution-entry:hover {
871
+ background: var(--ic-surface);
872
+ }
873
+
874
+ .exec-timestamp {
875
+ font-family: var(--ic-font-mono, ui-monospace, monospace);
876
+ color: var(--ic-text-dim);
877
+ min-width: 5rem;
878
+ }
879
+
880
+ .exec-job {
881
+ color: var(--ic-text);
882
+ font-weight: 500;
883
+ }
884
+
885
+ .exec-result--success {
886
+ color: #22c55e;
887
+ }
888
+
889
+ .exec-result--fail {
890
+ color: #ef4444;
891
+ }
892
+
893
+ .exec-result--pending {
894
+ color: var(--ic-text-dim);
895
+ }
896
+
897
+ .exec-duration {
898
+ color: var(--ic-text-dim);
899
+ }
900
+
901
+ .exec-error {
902
+ color: var(--ic-text-dim);
903
+ font-style: italic;
904
+ }
905
+
906
+ .no-data {
907
+ color: var(--ic-text-dim);
908
+ font-size: var(--ic-text-sm);
909
+ padding: var(--ic-space-md) 0;
910
+ }
911
+
912
+ /* Heartbeat tab -- per-agent cards */
913
+ .hb-summary-bar {
914
+ display: flex;
915
+ align-items: center;
916
+ gap: var(--ic-space-md);
917
+ padding: var(--ic-space-sm) 0 var(--ic-space-md);
918
+ font-size: var(--ic-text-sm);
919
+ color: var(--ic-text-dim);
920
+ }
921
+
922
+ .hb-summary-bar span {
923
+ display: flex;
924
+ align-items: center;
925
+ gap: var(--ic-space-xs);
926
+ }
927
+
928
+ .hb-card-grid {
929
+ display: grid;
930
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
931
+ gap: var(--ic-space-md);
932
+ }
933
+
934
+ .hb-card {
935
+ background: var(--ic-surface);
936
+ border: 1px solid var(--ic-border);
937
+ border-radius: var(--ic-radius-md);
938
+ padding: var(--ic-space-md);
939
+ display: flex;
940
+ flex-direction: column;
941
+ gap: var(--ic-space-xs);
942
+ }
943
+
944
+ .hb-card-header {
945
+ display: flex;
946
+ align-items: center;
947
+ justify-content: space-between;
948
+ gap: var(--ic-space-sm);
949
+ }
950
+
951
+ .hb-card-agent {
952
+ font-weight: 600;
953
+ font-size: var(--ic-text-sm);
954
+ color: var(--ic-text);
955
+ overflow: hidden;
956
+ text-overflow: ellipsis;
957
+ white-space: nowrap;
958
+ }
959
+
960
+ .hb-card-row {
961
+ display: flex;
962
+ align-items: center;
963
+ gap: var(--ic-space-sm);
964
+ font-size: var(--ic-text-xs);
965
+ color: var(--ic-text-dim);
966
+ }
967
+
968
+ .hb-card-label {
969
+ min-width: 70px;
970
+ color: var(--ic-text-muted);
971
+ }
972
+
973
+ .hb-running-indicator {
974
+ color: var(--ic-accent);
975
+ font-size: var(--ic-text-xs);
976
+ font-style: italic;
977
+ }
978
+
979
+ /* Recent alerts / deliveries */
980
+ .hb-recent-section {
981
+ margin-top: var(--ic-space-lg);
982
+ }
983
+
984
+ .hb-recent-section h3 {
985
+ font-size: var(--ic-text-sm);
986
+ font-weight: 600;
987
+ color: var(--ic-text-muted);
988
+ margin: 0 0 var(--ic-space-sm);
989
+ }
990
+
991
+ .hb-event-list {
992
+ display: flex;
993
+ flex-direction: column;
994
+ gap: 2px;
995
+ }
996
+
997
+ .hb-event-entry {
998
+ display: flex;
999
+ align-items: center;
1000
+ gap: var(--ic-space-sm);
1001
+ padding: var(--ic-space-xs) var(--ic-space-sm);
1002
+ font-size: var(--ic-text-xs);
1003
+ border-radius: var(--ic-radius-sm, 0.25rem);
1004
+ }
1005
+
1006
+ .hb-event-entry:hover {
1007
+ background: var(--ic-surface);
1008
+ }
1009
+
1010
+ .hb-event-ts {
1011
+ font-family: var(--ic-font-mono, ui-monospace, monospace);
1012
+ color: var(--ic-text-dim);
1013
+ min-width: 5rem;
1014
+ }
1015
+
1016
+ .hb-event-agent {
1017
+ font-weight: 500;
1018
+ color: var(--ic-text);
1019
+ }
1020
+
1021
+ .hb-event-reason {
1022
+ color: var(--ic-text-dim);
1023
+ font-style: italic;
1024
+ overflow: hidden;
1025
+ text-overflow: ellipsis;
1026
+ white-space: nowrap;
1027
+ max-width: 20rem;
1028
+ }
1029
+
1030
+ .hb-event-duration {
1031
+ color: var(--ic-text-dim);
1032
+ }
1033
+
1034
+ .alerts-highlight {
1035
+ color: #ef4444;
1036
+ font-weight: 600;
1037
+ }
1038
+
1039
+ /* Extracted tasks grid table */
1040
+ .task-grid {
1041
+ display: grid;
1042
+ grid-template-columns: minmax(150px, 3fr) 100px 100px auto;
1043
+ width: 100%;
1044
+ }
1045
+
1046
+ .task-grid .grid-header .cell,
1047
+ .task-grid .grid-row .cell {
1048
+ /* Inherit from .grid-header/.grid-row above */
1049
+ }
1050
+
1051
+ .priority-tag {
1052
+ display: inline-block;
1053
+ padding: 2px 8px;
1054
+ border-radius: 9999px;
1055
+ font-size: var(--ic-text-xs);
1056
+ font-weight: 500;
1057
+ }
1058
+
1059
+ .priority-tag--high {
1060
+ background: rgba(239, 68, 68, 0.15);
1061
+ color: #ef4444;
1062
+ }
1063
+
1064
+ .priority-tag--medium {
1065
+ background: rgba(234, 179, 8, 0.15);
1066
+ color: #eab308;
1067
+ }
1068
+
1069
+ .priority-tag--low {
1070
+ background: rgba(34, 197, 94, 0.15);
1071
+ color: #22c55e;
1072
+ }
1073
+
1074
+ .btn-sm {
1075
+ background: transparent;
1076
+ border: 1px solid var(--ic-border);
1077
+ color: var(--ic-text-muted);
1078
+ font-size: var(--ic-text-xs);
1079
+ cursor: pointer;
1080
+ padding: 2px 8px;
1081
+ border-radius: var(--ic-radius-sm, 0.25rem);
1082
+ font-family: inherit;
1083
+ transition: color var(--ic-transition), border-color var(--ic-transition);
1084
+ }
1085
+
1086
+ .btn-sm:hover {
1087
+ color: var(--ic-text);
1088
+ border-color: var(--ic-text-muted);
1089
+ }
1090
+
1091
+ .task-actions {
1092
+ display: flex;
1093
+ gap: var(--ic-space-xs);
1094
+ }
1095
+
1096
+ /* Editor overlay */
1097
+ .editor-overlay {
1098
+ position: fixed;
1099
+ top: 0;
1100
+ left: 0;
1101
+ right: 0;
1102
+ bottom: 0;
1103
+ background: rgba(0, 0, 0, 0.5);
1104
+ display: flex;
1105
+ align-items: center;
1106
+ justify-content: center;
1107
+ z-index: 100;
1108
+ }
1109
+
1110
+ .editor-panel {
1111
+ max-width: 32rem;
1112
+ width: 100%;
1113
+ max-height: 90vh;
1114
+ overflow-y: auto;
1115
+ margin: var(--ic-space-md);
1116
+ }
1117
+
1118
+ .editor-error {
1119
+ color: #ef4444;
1120
+ font-size: var(--ic-text-sm);
1121
+ padding: var(--ic-space-sm);
1122
+ text-align: center;
1123
+ }
1124
+
1125
+ /* Agent selector pills */
1126
+ .agent-selector {
1127
+ display: flex;
1128
+ align-items: center;
1129
+ gap: var(--ic-space-sm);
1130
+ margin-bottom: var(--ic-space-md);
1131
+ flex-wrap: wrap;
1132
+ }
1133
+
1134
+ .agent-selector-label {
1135
+ font-size: var(--ic-text-sm);
1136
+ color: var(--ic-text-muted);
1137
+ font-weight: 500;
1138
+ }
1139
+
1140
+ .agent-pill {
1141
+ background: transparent;
1142
+ border: 1px solid var(--ic-border);
1143
+ border-radius: 9999px;
1144
+ padding: var(--ic-space-xs) var(--ic-space-md);
1145
+ font-size: var(--ic-text-sm);
1146
+ font-family: inherit;
1147
+ color: var(--ic-text-muted);
1148
+ cursor: pointer;
1149
+ transition: background var(--ic-transition), border-color var(--ic-transition), color var(--ic-transition);
1150
+ }
1151
+
1152
+ .agent-pill:hover {
1153
+ border-color: var(--ic-text-muted);
1154
+ color: var(--ic-text);
1155
+ }
1156
+
1157
+ .agent-pill--active {
1158
+ background: var(--ic-accent);
1159
+ border-color: var(--ic-accent);
1160
+ color: #fff;
1161
+ }
1162
+
1163
+ .agent-pill--active:hover {
1164
+ filter: brightness(1.1);
1165
+ }
1166
+
1167
+ .agent-status {
1168
+ display: flex;
1169
+ align-items: center;
1170
+ gap: var(--ic-space-xs);
1171
+ font-size: var(--ic-text-xs);
1172
+ color: var(--ic-text-dim);
1173
+ margin-bottom: var(--ic-space-sm);
1174
+ }
1175
+
1176
+ .agent-status .status-dot {
1177
+ display: inline-block;
1178
+ width: 8px;
1179
+ height: 8px;
1180
+ border-radius: 50%;
1181
+ }
1182
+ `];d([f({attribute:!1})],c.prototype,"rpcClient",2);d([f({attribute:!1})],c.prototype,"routeParams",2);d([f({attribute:!1})],c.prototype,"eventDispatcher",2);d([o()],c.prototype,"_jobs",2);d([o()],c.prototype,"_loading",2);d([o()],c.prototype,"_error",2);d([o()],c.prototype,"_activeTab",2);d([o()],c.prototype,"_executions",2);d([o()],c.prototype,"_heartbeats",2);d([o()],c.prototype,"_heartbeatEnabled",2);d([o()],c.prototype,"_heartbeatIntervalMs",2);d([o()],c.prototype,"_extractedTasks",2);d([o()],c.prototype,"_editorOpen",2);d([o()],c.prototype,"_editingJob",2);d([o()],c.prototype,"_editorError",2);d([o()],c.prototype,"_configAgentIds",2);d([o()],c.prototype,"_selectedAgentId",2);d([o()],c.prototype,"_cronEnabled",2);d([o()],c.prototype,"_cronJobCount",2);d([o()],c.prototype,"_heartbeatAgents",2);d([o()],c.prototype,"_heartbeatAlerts",2);d([o()],c.prototype,"_heartbeatDeliveries",2);c=d([S("ic-scheduler-view")],c);export{c as IcSchedulerView};