tide-commander 1.70.0 → 1.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BossLogsModal-BsOGAk9j.js → BossLogsModal-DoW-oomk.js} +1 -1
- package/dist/assets/BossSpawnModal-Boc6sIfS.js +1 -0
- package/dist/assets/{ControlsModal-rRm2EyLt.js → ControlsModal-C6o3uZcq.js} +1 -1
- package/dist/assets/{DockerLogsModal-DOJuVWO5.js → DockerLogsModal-D0Qo_MwC.js} +1 -1
- package/dist/assets/{EmbeddedEditor-DSMa-_pv.js → EmbeddedEditor-CekqD_9x.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-BcXXMAz0.js → GmailOAuthSetup-9-5bh2P-.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-Dz6GJobg.js → GoogleOAuthSetup-3dJ_OKsM.js} +1 -1
- package/dist/assets/{IframeModal-JzopEsaR.js → IframeModal-DbXb7CwV.js} +1 -1
- package/dist/assets/{IntegrationsPanel-Csc5cKbJ.js → IntegrationsPanel-Bbu-YttD.js} +2 -2
- package/dist/assets/{LogViewerModal-nLCP_OiC.js → LogViewerModal-Bz-phlyW.js} +1 -1
- package/dist/assets/{MonitoringModal-DWAF5qrY.js → MonitoringModal-DPufvsx3.js} +1 -1
- package/dist/assets/{PM2LogsModal-CMjRymzO.js → PM2LogsModal-BRJEoIGZ.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-CE6qum43.js → RestoreArchivedAreaModal-DcsT_-25.js} +1 -1
- package/dist/assets/{Scene2DCanvas-C_jzVCus.js → Scene2DCanvas-DNsc8p5F.js} +1 -1
- package/dist/assets/{SceneManager-DJi4cg4u.js → SceneManager-DPvh-m5A.js} +1 -1
- package/dist/assets/{SkillsPanel-CICFRA3e.js → SkillsPanel-B_xQv-7n.js} +2 -2
- package/dist/assets/{SpawnModal-DbMA6ZCI.js → SpawnModal-B9jRwDuS.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-S5pOdh3o.js → SubordinateAssignmentModal-nNA0eQY3.js} +1 -1
- package/dist/assets/TriggerManagerPanel-CRYqCuDW.js +3 -0
- package/dist/assets/{WorkflowEditorPanel-CG_rbU3P.js → WorkflowEditorPanel-DMj6QkhB.js} +1 -1
- package/dist/assets/{index-LOZw5AOm.js → index-B0Bgs8A9.js} +1 -1
- package/dist/assets/{index-AbUJ8e_m.js → index-BKI7mhTU.js} +3 -3
- package/dist/assets/{index-BjRsxWRo.js → index-BSDP6H43.js} +6 -6
- package/dist/assets/index-BXuHHEGh.css +1 -0
- package/dist/assets/{index-CG9ZWXHv.js → index-BwN_ChZo.js} +1 -1
- package/dist/assets/index-CAYhCfSA.js +2 -0
- package/dist/assets/{index-DL5oZ7JS.js → index-CIDXn3G0.js} +1 -1
- package/dist/assets/{index-XfOLLSJr.js → index-QhVjGjw2.js} +1 -1
- package/dist/assets/{index-BTg-aafr.js → index-VvpWwviS.js} +1 -1
- package/dist/assets/{index-COtpp3Go.js → index-fFQ_bGrk.js} +2 -2
- package/dist/assets/main-C2_Gs1Uu.css +1 -0
- package/dist/assets/{main-C-iXDssE.js → main-DchkmHia.js} +89 -89
- package/dist/assets/{web-xu-du3ss.js → web-BYNdUdPc.js} +1 -1
- package/dist/assets/{web-C_fa0QQi.js → web-DPcQ0gLD.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/locales/en/config.json +6 -1
- package/dist/locales/en/terminal.json +4 -1
- package/dist/src/packages/server/codex/backend.js +12 -8
- package/dist/src/packages/server/services/cron-service.js +49 -0
- package/dist/src/packages/server/services/trigger-service.js +65 -0
- package/package.json +1 -1
- package/dist/assets/BossSpawnModal-BiQgeh5g.js +0 -1
- package/dist/assets/TriggerManagerPanel-_2o_eFr0.js +0 -3
- package/dist/assets/index-4VITMkmG.css +0 -1
- package/dist/assets/index-BM1t8tTI.js +0 -2
- package/dist/assets/main-BXDdkAuE.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c1 as a}from"./main-DchkmHia.js";import{ImpactStyle as i,NotificationType as r}from"./index-fFQ_bGrk.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class h extends a{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const e=this.patternForImpact(t==null?void 0:t.style);this.vibrateWithPattern(e)}async notification(t){const e=this.patternForNotification(t==null?void 0:t.type);this.vibrateWithPattern(e)}async vibrate(t){const e=(t==null?void 0:t.duration)||300;this.vibrateWithPattern([e])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=i.Heavy){return t===i.Medium?[43]:t===i.Light?[20]:[61]}patternForNotification(t=r.Success){return t===r.Warning?[30,40,30,50,60]:t===r.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}export{h as HapticsWeb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c1 as s}from"./main-DchkmHia.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";class l extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{l as LocalNotificationsWeb};
|
package/dist/index.html
CHANGED
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />
|
|
23
23
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png" />
|
|
24
24
|
<title>Tide Commander</title>
|
|
25
|
-
<script type="module" crossorigin src="/assets/main-
|
|
25
|
+
<script type="module" crossorigin src="/assets/main-DchkmHia.js"></script>
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react--Eh9ivFN.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/vendor-three-Chj50gSY.js">
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
28
|
+
<link rel="stylesheet" crossorigin href="/assets/main-C2_Gs1Uu.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
|
31
31
|
<div id="app"></div>
|
|
@@ -68,7 +68,12 @@
|
|
|
68
68
|
"hideToken": "Hide token",
|
|
69
69
|
"codexBinaryPath": "Codex Binary Path",
|
|
70
70
|
"codexBinaryPathPlaceholder": "Leave empty for auto-detect",
|
|
71
|
-
"codexBinaryPathHint": "Path to the native Codex binary. Bypasses the Node.js wrapper for better session persistence."
|
|
71
|
+
"codexBinaryPathHint": "Path to the native Codex binary. Bypasses the Node.js wrapper for better session persistence.",
|
|
72
|
+
"connectScreen": {
|
|
73
|
+
"authTokenLabel": "Auth Token",
|
|
74
|
+
"authTokenPlaceholder": "X-Auth-Token (optional)",
|
|
75
|
+
"authTokenHint": "Optional. Required if your server enforces auth."
|
|
76
|
+
}
|
|
72
77
|
},
|
|
73
78
|
"scene": {
|
|
74
79
|
"characterSize": "Character Size",
|
|
@@ -220,7 +220,9 @@
|
|
|
220
220
|
"approvalsUntrusted": "Approvals: untrusted",
|
|
221
221
|
"approvalsOnFailure": "Approvals: on-failure",
|
|
222
222
|
"approvalsOnRequest": "Approvals: on-request",
|
|
223
|
-
"approvalsNever": "Approvals: never"
|
|
223
|
+
"approvalsNever": "Approvals: never",
|
|
224
|
+
"reasoningEffort": "Reasoning Effort",
|
|
225
|
+
"reasoningEffortDefault": "Reasoning Effort: default"
|
|
224
226
|
}
|
|
225
227
|
},
|
|
226
228
|
"overview": {
|
|
@@ -247,6 +249,7 @@
|
|
|
247
249
|
"clickToSwitch": "Click to switch to this agent",
|
|
248
250
|
"sameAreaOnly": "Same Area",
|
|
249
251
|
"subagentsCompleted": "{{count}} subagents (all completed)",
|
|
252
|
+
"hasDraft": "Has unsent draft",
|
|
250
253
|
"statusLabels": {
|
|
251
254
|
"working": "Working",
|
|
252
255
|
"idle": "Idle",
|
|
@@ -120,15 +120,18 @@ export class CodexBackend {
|
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
getExecutablePath() {
|
|
123
|
-
// Priority: 1)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
123
|
+
// Priority: 1) Settings UI 2) CODEX_BINARY env var 3) auto-detect
|
|
124
|
+
// The Settings UI value is an explicit user override and must win over
|
|
125
|
+
// the env var default so the user can point Tide Commander at a specific
|
|
126
|
+
// codex install without clearing their shell environment.
|
|
128
127
|
const settingsBinary = getCodexBinaryPath();
|
|
129
128
|
if (settingsBinary && fs.existsSync(settingsBinary)) {
|
|
130
129
|
return settingsBinary;
|
|
131
130
|
}
|
|
131
|
+
const envBinary = process.env.CODEX_BINARY;
|
|
132
|
+
if (envBinary && fs.existsSync(envBinary)) {
|
|
133
|
+
return envBinary;
|
|
134
|
+
}
|
|
132
135
|
return this.detectInstallation() || 'codex';
|
|
133
136
|
}
|
|
134
137
|
detectInstallation() {
|
|
@@ -154,10 +157,11 @@ export class CodexBackend {
|
|
|
154
157
|
getExtraEnv() {
|
|
155
158
|
// When using the native binary directly, we need to add
|
|
156
159
|
// the vendor path directory to PATH so codex can find bundled tools like rg.
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
// Match the precedence used by getExecutablePath(): Settings UI wins over env var.
|
|
161
|
+
const binary = getCodexBinaryPath() || process.env.CODEX_BINARY;
|
|
162
|
+
if (!binary)
|
|
159
163
|
return {};
|
|
160
|
-
const codexDir = path.dirname(
|
|
164
|
+
const codexDir = path.dirname(binary); // .../codex/
|
|
161
165
|
const archRoot = path.dirname(codexDir); // .../x86_64-unknown-linux-musl/
|
|
162
166
|
const pathDir = path.join(archRoot, 'path');
|
|
163
167
|
if (fs.existsSync(pathDir)) {
|
|
@@ -132,6 +132,55 @@ function getDateInTimezone(timezone) {
|
|
|
132
132
|
}
|
|
133
133
|
// ─── Public API ───
|
|
134
134
|
const CHECK_INTERVAL_MS = 30_000; // Check every 30 seconds
|
|
135
|
+
// Max safe setTimeout delay (2^31-1 ms ≈ 24.8 days). Longer waits are chained.
|
|
136
|
+
const MAX_SETTIMEOUT_MS = 2_147_483_647;
|
|
137
|
+
/**
|
|
138
|
+
* Schedule a callback to fire exactly once at the given absolute datetime.
|
|
139
|
+
* If the time is already in the past, the callback is fired immediately (next tick).
|
|
140
|
+
* Returns a CronJob-compatible handle that can be stopped via `stop(job)`.
|
|
141
|
+
*/
|
|
142
|
+
export function scheduleOnce(runAtIso, callback) {
|
|
143
|
+
const id = `once_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
144
|
+
const runAtMs = new Date(runAtIso).getTime();
|
|
145
|
+
const job = {
|
|
146
|
+
id,
|
|
147
|
+
expression: `@once ${runAtIso}`,
|
|
148
|
+
timezone: 'UTC',
|
|
149
|
+
callback,
|
|
150
|
+
timer: null,
|
|
151
|
+
lastFired: null,
|
|
152
|
+
};
|
|
153
|
+
const fire = (reason) => {
|
|
154
|
+
job.lastFired = Date.now();
|
|
155
|
+
log.log(`One-shot cron ${id} fired (runAt=${runAtIso}, ${reason})`);
|
|
156
|
+
activeJobs.delete(id);
|
|
157
|
+
try {
|
|
158
|
+
callback();
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
log.error(`One-shot cron ${id} callback error:`, err);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const armTimer = () => {
|
|
165
|
+
const remaining = runAtMs - Date.now();
|
|
166
|
+
// Always schedule via setTimeout (delay clamped to >= 0) so the callback
|
|
167
|
+
// never runs synchronously within scheduleOnce — callers often update state
|
|
168
|
+
// after this returns, and a sync callback would race that.
|
|
169
|
+
const delay = Math.max(0, Math.min(remaining, MAX_SETTIMEOUT_MS));
|
|
170
|
+
job.timer = setTimeout(() => {
|
|
171
|
+
if (remaining > MAX_SETTIMEOUT_MS) {
|
|
172
|
+
// Chained wait: re-arm for the remaining interval
|
|
173
|
+
armTimer();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
fire('scheduled');
|
|
177
|
+
}, delay);
|
|
178
|
+
};
|
|
179
|
+
armTimer();
|
|
180
|
+
activeJobs.set(id, job);
|
|
181
|
+
log.log(`Scheduled one-shot cron ${id} for ${runAtIso}`);
|
|
182
|
+
return job;
|
|
183
|
+
}
|
|
135
184
|
export function schedule(expression, timezone, callback) {
|
|
136
185
|
const id = `cron_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
137
186
|
const job = {
|
|
@@ -615,9 +615,15 @@ function interpolateTemplate(template, variables) {
|
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
// ─── Cron Management ───
|
|
618
|
+
// Grace window for firing a one-shot whose runAt slipped past while the server was down.
|
|
619
|
+
const ONE_SHOT_MISS_GRACE_MS = 5 * 60 * 1000;
|
|
618
620
|
function startCronJob(trigger) {
|
|
619
621
|
// Stop existing job if any
|
|
620
622
|
stopCronJob(trigger.id);
|
|
623
|
+
if (trigger.config.runOnce) {
|
|
624
|
+
startOneShotJob(trigger);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
621
627
|
const job = cronService.schedule(trigger.config.expression, trigger.config.timezone, () => {
|
|
622
628
|
const variables = {
|
|
623
629
|
'cron.expression': trigger.config.expression,
|
|
@@ -629,6 +635,65 @@ function startCronJob(trigger) {
|
|
|
629
635
|
cronJobs.set(trigger.id, job);
|
|
630
636
|
log.log(`Started cron job for trigger ${trigger.name}: ${trigger.config.expression}`);
|
|
631
637
|
}
|
|
638
|
+
function startOneShotJob(trigger) {
|
|
639
|
+
const runAt = trigger.config.runAt;
|
|
640
|
+
if (!runAt) {
|
|
641
|
+
log.warn(`One-shot trigger ${trigger.name} has no runAt; skipping schedule`);
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
// Already completed — do not re-arm.
|
|
645
|
+
if (trigger.config.completedAt) {
|
|
646
|
+
log.log(`One-shot trigger ${trigger.name} already completed at ${new Date(trigger.config.completedAt).toISOString()}`);
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const runAtMs = new Date(runAt).getTime();
|
|
650
|
+
if (Number.isNaN(runAtMs)) {
|
|
651
|
+
log.error(`One-shot trigger ${trigger.name} has invalid runAt: ${runAt}`);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const now = Date.now();
|
|
655
|
+
const overdueMs = now - runAtMs;
|
|
656
|
+
if (overdueMs > ONE_SHOT_MISS_GRACE_MS) {
|
|
657
|
+
// Missed by more than the grace window — mark missed and disable.
|
|
658
|
+
log.warn(`One-shot trigger ${trigger.name} missed (overdue by ${Math.round(overdueMs / 1000)}s); marking as missed`);
|
|
659
|
+
const updatedConfig = { ...trigger.config, missedAt: now };
|
|
660
|
+
updateTrigger(trigger.id, {
|
|
661
|
+
enabled: false,
|
|
662
|
+
status: 'error',
|
|
663
|
+
lastError: 'missed: server was down at runAt',
|
|
664
|
+
config: updatedConfig,
|
|
665
|
+
});
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const job = cronService.scheduleOnce(runAt, () => {
|
|
669
|
+
const variables = {
|
|
670
|
+
'cron.runAt': runAt,
|
|
671
|
+
'cron.scheduledAt': new Date().toISOString(),
|
|
672
|
+
...(trigger.config.payload || {}),
|
|
673
|
+
};
|
|
674
|
+
void handleOneShotFire(trigger.id, variables);
|
|
675
|
+
});
|
|
676
|
+
cronJobs.set(trigger.id, job);
|
|
677
|
+
log.log(`Armed one-shot trigger ${trigger.name} for ${runAt}${overdueMs > 0 ? ' (within grace window, firing immediately)' : ''}`);
|
|
678
|
+
}
|
|
679
|
+
async function handleOneShotFire(triggerId, variables) {
|
|
680
|
+
const trigger = triggers.get(triggerId);
|
|
681
|
+
if (!trigger || trigger.type !== 'cron')
|
|
682
|
+
return;
|
|
683
|
+
const cronTrigger = trigger;
|
|
684
|
+
if (!cronTrigger.config.runOnce)
|
|
685
|
+
return;
|
|
686
|
+
// Mark completed + disabled BEFORE firing. fireTrigger internally calls
|
|
687
|
+
// updateTrigger which would otherwise re-enter startCronJob and re-arm the
|
|
688
|
+
// one-shot. The completedAt guard in startOneShotJob short-circuits that.
|
|
689
|
+
const updatedConfig = { ...cronTrigger.config, completedAt: Date.now() };
|
|
690
|
+
updateTrigger(triggerId, {
|
|
691
|
+
enabled: false,
|
|
692
|
+
config: updatedConfig,
|
|
693
|
+
});
|
|
694
|
+
cronJobs.delete(triggerId);
|
|
695
|
+
await fireTrigger(triggerId, variables);
|
|
696
|
+
}
|
|
632
697
|
function stopCronJob(triggerId) {
|
|
633
698
|
const job = cronJobs.get(triggerId);
|
|
634
699
|
if (job) {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Ee,a4 as Ie,as as De,ar as _e,r as t,C as Be,S as ae,l as Re,av as z,A as ne,aE as O,s as T,aF as j,j as s,N as S,ax as ze,az as Oe,I as L,aA as F,ac as g,aa as E,E as Te}from"./main-C-iXDssE.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function le(u){const h=j.filter(C=>!u.has(`Boss ${C}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function Ue({isOpen:u,onClose:h,onSpawnStart:C,onSpawnEnd:I,spawnPosition:te}){const{t:n}=Ee(["terminal","common"]),P=Ie(),o=De(),k=_e(),[r,p]=t.useState(""),[M,ie]=t.useState(()=>Be(ae.LAST_CWD)),[c,D]=t.useState("boss"),[q,U]=t.useState(!1),[ce,y]=t.useState(!1),[W,oe]=t.useState(!0),[G,re]=t.useState("bypass"),[d,_]=t.useState("claude"),[b,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[K,de]=t.useState("opus[1m]"),[H,pe]=t.useState("gpt-5.3-codex"),[v,A]=t.useState(new Set),[J,B]=t.useState(new Set),[m,me]=t.useState(""),[f,ue]=t.useState(""),[V,he]=t.useState(""),$=t.useRef(null),R=t.useRef(!1),X=t.useRef(!1),w=t.useMemo(()=>k.filter(e=>e.enabled),[k]),Y=t.useMemo(()=>{if(!f.trim())return w;const e=f.toLowerCase();return w.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[w,f]),xe=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?k.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,k]),we=["full-notifications","streaming-exec","task-label","report-task-to-boss","send-message-to-agent"];t.useEffect(()=>{if(u&&!X.current&&w.length>0){const a=w.filter(l=>we.includes(l.slug)).map(l=>l.id);a.length>0&&B(new Set(a))}X.current=u},[u,w]);const be=t.useCallback(e=>{B(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),fe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),je=t.useMemo(()=>{if(i!=null&&i.customModelPath)return Re(`/api/custom-models/${i.id}`)},[i]),Ne=i==null?void 0:i.modelScale,ve=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),Q=t.useMemo(()=>Array.from(P.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),[P]),Z=t.useMemo(()=>{if(!m.trim())return o;const e=m.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,m]),ee=t.useMemo(()=>{if(!m.trim())return z;const e=m.toLowerCase();return z.filter(a=>{const l=ne[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[m]),se=t.useMemo(()=>{if(!m.trim())return!0;const e=m.toLowerCase(),a=O.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[m]);t.useEffect(()=>{if(u&&!R.current){R.current=!0;const e=new Set(Array.from(T.getState().agents.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(x=>!e.has(`${a.name} ${x}`));if(l.length===0){const x=j[Math.floor(Math.random()*j.length)];p(`${a.name} ${x}-${Date.now()%1e3}`)}else p(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else p(le(e));A(new Set),$.current&&($.current.focus(),$.current.select())}else u||(R.current=!1)},[u]),t.useEffect(()=>{if(!u)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);p(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`${e.name} ${l}`)}else p(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`Boss ${l}`)}else r.startsWith("Boss ")||p(`Boss ${r}`)}},[c]);const Se=()=>{if(y(!1),!M.trim()){y(!0);return}if(!r.trim()){const l=new Set(Array.from(T.getState().agents.values()).map(x=>x.name));p(le(l));return}Te(ae.LAST_CWD,M),C();const e=V.trim()||void 0,a=Array.from(J);T.spawnBossAgent(r.trim(),c,M.trim(),te||void 0,Array.from(v),d==="claude"?W:!1,G,d,d==="codex"?b:void 0,d==="codex"?H:void 0,d==="claude"?K:void 0,e,a),p(""),A(new Set),B(new Set),I(),h()},ge=()=>{U(!1),p(""),A(new Set),I(),h()},Ce=()=>{U(!1),y(!0),I()};t.useEffect(()=>(window.__bossSpawnModalSuccess=ge,window.__bossSpawnModalError=Ce,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const ke=e=>{e.target===e.currentTarget&&h()},Me=e=>{e.key==="Escape"&&h()},ye=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),A(a)};if(!u)return null;const Ae=O.boss;return s.jsx("div",{className:`modal-overlay ${u?"visible":""}`,onClick:ke,onKeyDown:Me,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(S,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(ze,{agentClass:ve,modelFile:fe,customModelUrl:je,modelScale:Ne,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+z.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:m,onChange:e=>me(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Z.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:e.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),se&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>D("boss"),title:Ae.description,children:[s.jsx(S,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),ee.map(e=>{const a=ne[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:a.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),m&&Z.length===0&&!se&&ee.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:m})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:$,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>p(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Oe,{value:M,onChange:e=>{ie(e),y(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:ce,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${d==="claude"?"selected":""}`,onClick:()=>_("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${d==="codex"?"selected":""}`,onClick:()=>_("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${d==="opencode"?"selected":""}`,onClick:()=>_("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:s.jsx(L,{name:"status-pending",size:14,weight:"fill",color:"#4ade80"})}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(F).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:F[e].description,children:[s.jsx("span",{children:s.jsx(L,{name:e==="bypass"?"bolt":"lock",size:14})}),s.jsx("span",{children:F[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),d==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(g).filter(e=>!g[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${K===e?"selected":""}`,onClick:()=>de(e),title:g[e].description,children:[s.jsx("span",{children:g[e].icon}),s.jsx("span",{children:g[e].label})]},e))}):d==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(E).map(e=>s.jsxs("button",{className:`spawn-select-btn ${H===e?"selected":""}`,onClick:()=>pe(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):d==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:W,onChange:e=>oe(e.target.checked),disabled:d!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),d==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:b.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!b.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),b.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:b.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:b.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:b.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),w.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),w.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:f,onChange:e=>ue(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[Y.map(e=>{const a=J.has(e.id);return xe.some(x=>x.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>be(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:s.jsx(L,{name:"check",size:12})}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),f&&Y.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:f})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:V,onChange:e=>he(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:Q.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):Q.map(e=>{const a=v.has(e.id),l=O[e.class],x=o.find(Le=>Le.id===e.class),$e=l||x||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>ye(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:s.jsx(L,{name:"check",size:12})}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:$e.color},children:s.jsx(S,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:Se,disabled:q,children:n(q?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{Ue as BossSpawnModal};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a4 as ce,r as n,aw as h,l as p,j as e}from"./main-C-iXDssE.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const pe=[{value:"webhook",label:"Webhook"},{value:"cron",label:"Cron"},{value:"slack",label:"Slack"},{value:"email",label:"Email"},{value:"jira",label:"Jira"}],xe=[{value:"structural",label:"Structural",desc:"Field-based matching (fast, free)"},{value:"llm",label:"LLM",desc:"Semantic matching via LLM (flexible, costs tokens)"},{value:"hybrid",label:"Hybrid",desc:"Structural pre-filter + LLM (recommended)"}],he=[{value:"structural",label:"Structural"},{value:"llm",label:"LLM"}],w=()=>({name:"",description:"",type:"webhook",agentId:"",promptTemplate:"",enabled:!0,matchMode:"structural",extractionMode:"structural",config:{method:"POST"}});function fe({isOpen:C,onClose:E}){var H,U,_,W,J,$,V,G,X,q,Y,K;const T=ce(),[R,Q]=n.useState([]),[y,j]=n.useState("list"),[s,u]=n.useState(w()),[d,S]=n.useState(!1),[F,z]=n.useState(!1),[L,c]=n.useState(null),[O,Z]=n.useState([]),[g,ee]=n.useState(null),[k,te]=n.useState(`{
|
|
2
|
-
|
|
3
|
-
}`),[r,f]=n.useState(null),[B,I]=n.useState(!1),[N,P]=n.useState([]),x=n.useCallback(async()=>{try{const t=await h(p("/api/triggers"));if(t.ok){const a=await t.json();Q(a)}}catch(t){console.error("Failed to load triggers:",t)}},[]),v=n.useCallback(async t=>{try{const a=await h(p(`/api/triggers/${t}/events?limit=20`));if(a.ok){const i=await a.json();Z(i)}}catch(a){console.error("Failed to load trigger history:",a)}},[]);n.useEffect(()=>{C&&x()},[C,x]),n.useEffect(()=>{g&&v(g)},[g,v]);const le=n.useCallback(async()=>{z(!0),c(null);try{const t=d?p(`/api/triggers/${s.id}`):p("/api/triggers"),m=await h(t,{method:d?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!m.ok){const de=await m.json();throw new Error(de.error||"Failed to save trigger")}await x(),j("list"),u(w()),S(!1)}catch(t){c(t instanceof Error?t.message:"Save failed")}finally{z(!1)}},[s,d,x]),ae=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t}`),{method:"DELETE"}),await x()}catch(a){console.error("Failed to delete trigger:",a)}},[x]),se=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!t.enabled})}),await x()}catch(a){console.error("Failed to toggle trigger:",a)}},[x]),ie=n.useCallback(async t=>{try{await h(p(`/api/triggers/${t}/fire`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({variables:{}})}),g===t&&await v(t)}catch(a){console.error("Failed to test fire trigger:",a)}},[g,v]),ne=n.useCallback(async()=>{if(s.id){I(!0),f(null);try{let t;try{t=JSON.parse(k)}catch{f({structuralMatch:void 0,extractedVariables:{},wouldFire:!1}),c("Invalid JSON payload");return}const a=await h(p(`/api/triggers/${s.id}/test-match`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:t})});if(a.ok){const i=await a.json();f(i),c(null)}else{const i=await a.json();c(i.error||"Test match failed")}}catch(t){c(t instanceof Error?t.message:"Test match failed")}finally{I(!1)}}},[s.id,k]),re=n.useCallback(async t=>{var a;try{const i=await h(p("/api/triggers/validate-cron"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expression:t,timezone:((a=s.config)==null?void 0:a.timezone)||"UTC"})});if(i.ok){const m=await i.json();P(m.valid?m.nextFires:[])}}catch{P([])}},[s]),D=n.useCallback(t=>{t?(u({...t}),S(!0)):(u(w()),S(!1)),f(null),c(null),j("edit")},[]),o=n.useCallback((t,a)=>{u(i=>({...i,[t]:a}))},[]),b=n.useCallback((t,a)=>{u(i=>({...i,config:{...i.config,[t]:a}}))},[]),M=n.useCallback((t,a)=>{u(i=>({...i,llmMatch:{...i.llmMatch||{prompt:""},[t]:a}}))},[]),A=n.useCallback((t,a)=>{u(i=>({...i,llmExtract:{...i.llmExtract||{prompt:"",variables:[]},[t]:a}}))},[]),oe=n.useMemo(()=>Array.from(T.values()).map(t=>({id:t.id,name:t.name})),[T]);return C?e.jsx("div",{style:l.overlay,onClick:E,children:e.jsxs("div",{style:l.panel,onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{style:l.header,children:[e.jsx("h2",{style:l.title,children:y==="list"?"Triggers":d?"Edit Trigger":"New Trigger"}),e.jsxs("div",{style:l.headerActions,children:[y==="list"&&e.jsx("button",{style:l.addBtn,onClick:()=>D(),children:"+ New Trigger"}),y==="edit"&&e.jsx("button",{style:l.backBtn,onClick:()=>{j("list"),f(null),c(null)},children:"Back"}),e.jsx("button",{style:l.closeBtn,onClick:E,children:"X"})]})]}),L&&e.jsx("div",{style:l.error,children:L}),y==="list"&&e.jsx("div",{style:l.content,children:R.length===0?e.jsx("div",{style:l.empty,children:"No triggers configured. Create one to get started."}):R.map(t=>{var a;return e.jsxs("div",{style:{...l.triggerCard,borderLeftColor:t.status==="error"?"#e74c3c":t.enabled?"#2ecc71":"#95a5a6"},onClick:()=>{ee(t.id),D(t)},children:[e.jsxs("div",{style:l.cardHeader,children:[e.jsxs("div",{style:l.cardTitle,children:[e.jsx("span",{style:l.typeTag,children:t.type}),e.jsx("span",{children:t.name}),t.matchMode!=="structural"&&e.jsx("span",{style:l.matchTag,children:t.matchMode})]}),e.jsxs("div",{style:l.cardActions,children:[e.jsx("button",{style:l.smallBtn,onClick:i=>{i.stopPropagation(),se(t)},children:t.enabled?"Disable":"Enable"}),e.jsx("button",{style:l.smallBtn,onClick:i=>{i.stopPropagation(),ie(t.id)},children:"Test Fire"}),e.jsx("button",{style:{...l.smallBtn,color:"#e74c3c"},onClick:i=>{i.stopPropagation(),ae(t.id)},children:"Delete"})]})]}),e.jsxs("div",{style:l.cardMeta,children:[e.jsxs("span",{children:["Agent: ",((a=T.get(t.agentId))==null?void 0:a.name)||t.agentId]}),e.jsxs("span",{children:["Fires: ",t.fireCount]}),t.lastFiredAt&&e.jsxs("span",{children:["Last: ",new Date(t.lastFiredAt).toLocaleString()]}),t.status==="error"&&t.lastError&&e.jsxs("span",{style:{color:"#e74c3c"},children:["Error: ",t.lastError]})]})]},t.id)})}),y==="edit"&&e.jsx("div",{style:l.content,children:e.jsxs("div",{style:l.form,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Name"}),e.jsx("input",{style:l.input,value:s.name||"",onChange:t=>o("name",t.target.value),placeholder:"My Trigger"})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Description"}),e.jsx("input",{style:l.input,value:s.description||"",onChange:t=>o("description",t.target.value),placeholder:"Optional description"})]}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Type"}),e.jsx("select",{style:l.select,value:s.type||"webhook",onChange:t=>{const a=t.target.value;o("type",a),a==="webhook"?o("config",{method:"POST"}):a==="cron"?o("config",{expression:"0 9 * * MON-FRI",timezone:"UTC"}):o("config",{})},children:pe.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Agent"}),e.jsxs("select",{style:l.select,value:s.agentId||"",onChange:t=>o("agentId",t.target.value),children:[e.jsx("option",{value:"",children:"Select agent..."}),oe.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Prompt Template"}),e.jsx("textarea",{style:l.textarea,value:s.promptTemplate||"",onChange:t=>o("promptTemplate",t.target.value),placeholder:"Message sent to agent. Use {{variable}} for interpolation.",rows:4})]}),s.type==="webhook"&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Webhook Config"}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Method"}),e.jsxs("select",{style:l.select,value:((H=s.config)==null?void 0:H.method)||"POST",onChange:t=>b("method",t.target.value),children:[e.jsx("option",{value:"POST",children:"POST"}),e.jsx("option",{value:"PUT",children:"PUT"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Secret (HMAC)"}),e.jsx("input",{style:l.input,type:"password",value:((U=s.config)==null?void 0:U.secret)||"",onChange:t=>b("secret",t.target.value||void 0),placeholder:"Optional HMAC secret"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Extract Fields (comma-separated JSON paths)"}),e.jsx("input",{style:l.input,value:((W=(_=s.config)==null?void 0:_.extractFields)==null?void 0:W.join(", "))||"",onChange:t=>b("extractFields",t.target.value.split(",").map(a=>a.trim()).filter(Boolean)),placeholder:"body.release_name, body.version"})]}),d&&s.id&&e.jsxs("div",{style:l.webhookUrl,children:[e.jsx("label",{style:l.label,children:"Webhook URL"}),e.jsx("code",{style:l.code,children:`${window.location.origin}/api/triggers/webhook/${s.id}`})]})]}),s.type==="cron"&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Cron Config"}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Expression"}),e.jsx("input",{style:l.input,value:((J=s.config)==null?void 0:J.expression)||"",onChange:t=>{b("expression",t.target.value),t.target.value&&re(t.target.value)},placeholder:"0 9 * * MON-FRI"})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Timezone"}),e.jsx("input",{style:l.input,value:(($=s.config)==null?void 0:$.timezone)||"UTC",onChange:t=>b("timezone",t.target.value),placeholder:"America/Mexico_City"})]})]}),N.length>0&&e.jsxs("div",{style:l.nextFires,children:[e.jsx("label",{style:l.label,children:"Next fires:"}),N.map((t,a)=>e.jsx("div",{style:l.nextFireItem,children:new Date(t).toLocaleString()},a))]})]}),e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Match Mode"}),e.jsx("div",{style:l.modeSelector,children:xe.map(t=>e.jsxs("button",{style:{...l.modeBtn,...s.matchMode===t.value?l.modeBtnActive:{}},onClick:()=>o("matchMode",t.value),children:[e.jsx("strong",{children:t.label}),e.jsx("span",{style:l.modeDesc,children:t.desc})]},t.value))}),(s.matchMode==="llm"||s.matchMode==="hybrid")&&e.jsxs("div",{style:l.llmConfig,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"LLM Match Prompt"}),e.jsx("textarea",{style:l.textarea,value:((V=s.llmMatch)==null?void 0:V.prompt)||"",onChange:t=>M("prompt",t.target.value),placeholder:"Does this message request a release deployment?",rows:3})]}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Model"}),e.jsxs("select",{style:l.select,value:((G=s.llmMatch)==null?void 0:G.model)||"haiku",onChange:t=>M("model",t.target.value),children:[e.jsx("option",{value:"haiku",children:"Haiku (fast, cheap)"}),e.jsx("option",{value:"sonnet",children:"Sonnet (balanced)"}),e.jsx("option",{value:"opus",children:"Opus (powerful)"})]})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Min Confidence"}),e.jsx("input",{style:l.input,type:"number",min:"0",max:"1",step:"0.1",value:((X=s.llmMatch)==null?void 0:X.minConfidence)??0,onChange:t=>M("minConfidence",parseFloat(t.target.value))})]})]})]})]}),e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Extraction Mode"}),e.jsx("div",{style:l.row,children:he.map(t=>e.jsx("button",{style:{...l.modeBtn,...s.extractionMode===t.value?l.modeBtnActive:{}},onClick:()=>o("extractionMode",t.value),children:t.label},t.value))}),s.extractionMode==="llm"&&e.jsxs("div",{style:l.llmConfig,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Extraction Instructions"}),e.jsx("textarea",{style:l.textarea,value:((q=s.llmExtract)==null?void 0:q.prompt)||"",onChange:t=>A("prompt",t.target.value),placeholder:"Extract: release version, affected systems, urgency",rows:3})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Variable Names (comma-separated)"}),e.jsx("input",{style:l.input,value:((K=(Y=s.llmExtract)==null?void 0:Y.variables)==null?void 0:K.join(", "))||"",onChange:t=>A("variables",t.target.value.split(",").map(a=>a.trim()).filter(Boolean)),placeholder:"release_name, affected_systems, urgency"})]})]})]}),d&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Test Match"}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Sample Event Payload (JSON)"}),e.jsx("textarea",{style:l.textarea,value:k,onChange:t=>te(t.target.value),rows:4})]}),e.jsx("button",{style:l.testBtn,onClick:ne,disabled:B,children:B?"Testing...":"Test Match"}),r&&e.jsxs("div",{style:l.testResult,children:[e.jsx("div",{style:{...l.testResultHeader,color:r.wouldFire?"#2ecc71":"#e74c3c"},children:r.wouldFire?"WOULD FIRE":"WOULD NOT FIRE"}),r.structuralMatch!==void 0&&e.jsxs("div",{children:["Structural: ",r.structuralMatch?"Match":"No match"]}),r.llmMatch&&e.jsxs("div",{style:l.llmResult,children:[e.jsxs("div",{children:["LLM: ",r.llmMatch.match?"Match":"No match"]}),e.jsxs("div",{children:["Confidence: ",(r.llmMatch.confidence*100).toFixed(0),"%"]}),e.jsxs("div",{children:["Reason: ",r.llmMatch.reason]}),e.jsxs("div",{style:l.llmMeta,children:["Model: ",r.llmMatch.model," | Tokens: ",r.llmMatch.tokensUsed," | Latency: ",r.llmMatch.durationMs,"ms"]})]}),Object.keys(r.extractedVariables).length>0&&e.jsxs("div",{children:[e.jsx("div",{style:l.label,children:"Extracted Variables:"}),Object.entries(r.extractedVariables).map(([t,a])=>e.jsxs("div",{style:l.varRow,children:[e.jsx("code",{children:t}),": ",a]},t))]})]})]}),d&&O.length>0&&e.jsxs("div",{style:l.section,children:[e.jsx("h4",{style:l.sectionTitle,children:"Recent Fires"}),e.jsx("div",{style:l.historyList,children:O.map((t,a)=>{const i=t.llm_match_result?JSON.parse(t.llm_match_result):null;return e.jsxs("div",{style:l.historyItem,children:[e.jsxs("div",{style:l.historyHeader,children:[e.jsx("span",{style:{color:t.status==="delivered"?"#2ecc71":t.status==="failed"?"#e74c3c":"#f39c12"},children:t.status}),e.jsx("span",{children:new Date(t.fired_at).toLocaleString()}),t.duration_ms&&e.jsxs("span",{children:[t.duration_ms,"ms"]})]}),t.error&&e.jsx("div",{style:{color:"#e74c3c",fontSize:"12px"},children:t.error}),i&&e.jsxs("div",{style:l.llmMeta,children:["LLM: ",i.match?"match":"no match"," (",(i.confidence*100).toFixed(0),"%) - ",i.reason]})]},t.id||a)})})]}),e.jsxs("div",{style:l.actions,children:[e.jsx("button",{style:l.cancelBtn,onClick:()=>{j("list"),c(null)},children:"Cancel"}),e.jsx("button",{style:l.saveBtn,onClick:le,disabled:F||!s.name||!s.agentId,children:F?"Saving...":d?"Update":"Create"})]})]})})]})}):null}const l={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},panel:{background:"#1e1e2e",borderRadius:"12px",width:"680px",maxHeight:"85vh",display:"flex",flexDirection:"column",color:"#cdd6f4",boxShadow:"0 8px 32px rgba(0,0,0,0.4)"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid #313244"},title:{margin:0,fontSize:"18px",fontWeight:600},headerActions:{display:"flex",gap:"8px"},content:{overflow:"auto",padding:"16px 20px",flex:1},empty:{textAlign:"center",padding:"40px",color:"#6c7086"},error:{background:"#45252a",color:"#f38ba8",padding:"8px 20px",fontSize:"13px"},triggerCard:{background:"#181825",borderRadius:"8px",padding:"12px 16px",marginBottom:"8px",borderLeft:"3px solid",cursor:"pointer",transition:"background 0.15s"},cardHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},cardTitle:{display:"flex",alignItems:"center",gap:"8px",fontWeight:500},typeTag:{background:"#313244",padding:"2px 6px",borderRadius:"4px",fontSize:"11px",textTransform:"uppercase"},matchTag:{background:"#45475a",padding:"2px 6px",borderRadius:"4px",fontSize:"10px",color:"#a6e3a1"},cardActions:{display:"flex",gap:"6px"},cardMeta:{display:"flex",gap:"16px",marginTop:"8px",fontSize:"12px",color:"#6c7086"},form:{display:"flex",flexDirection:"column",gap:"12px"},field:{display:"flex",flexDirection:"column",gap:"4px",flex:1},row:{display:"flex",gap:"12px"},label:{fontSize:"12px",color:"#a6adc8",fontWeight:500},input:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none"},select:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none"},textarea:{background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 10px",color:"#cdd6f4",fontSize:"13px",outline:"none",fontFamily:"monospace",resize:"vertical"},section:{borderTop:"1px solid #313244",paddingTop:"12px"},sectionTitle:{margin:"0 0 8px",fontSize:"14px",fontWeight:600,color:"#a6adc8"},modeSelector:{display:"flex",gap:"8px",marginBottom:"8px"},modeBtn:{flex:1,background:"#313244",border:"1px solid #45475a",borderRadius:"6px",padding:"8px",color:"#cdd6f4",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"2px",fontSize:"12px"},modeBtnActive:{borderColor:"#89b4fa",background:"#1e3a5f"},modeDesc:{fontSize:"10px",color:"#6c7086"},llmConfig:{background:"#181825",borderRadius:"6px",padding:"12px",display:"flex",flexDirection:"column",gap:"8px"},webhookUrl:{marginTop:"8px"},code:{background:"#313244",padding:"6px 10px",borderRadius:"4px",fontSize:"12px",display:"block",wordBreak:"break-all",color:"#89b4fa"},nextFires:{marginTop:"8px"},nextFireItem:{fontSize:"12px",color:"#a6e3a1",padding:"2px 0"},testBtn:{background:"#89b4fa",border:"none",borderRadius:"6px",padding:"8px 16px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},testResult:{background:"#181825",borderRadius:"6px",padding:"12px",marginTop:"8px",fontSize:"13px",display:"flex",flexDirection:"column",gap:"6px"},testResultHeader:{fontWeight:700,fontSize:"14px"},llmResult:{display:"flex",flexDirection:"column",gap:"2px"},llmMeta:{fontSize:"11px",color:"#6c7086",marginTop:"2px"},varRow:{fontSize:"12px",padding:"2px 0"},historyList:{display:"flex",flexDirection:"column",gap:"6px",maxHeight:"200px",overflow:"auto"},historyItem:{background:"#181825",borderRadius:"4px",padding:"8px 10px",fontSize:"12px"},historyHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},actions:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid #313244"},addBtn:{background:"#89b4fa",border:"none",borderRadius:"6px",padding:"6px 14px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},backBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"6px",padding:"6px 14px",color:"#cdd6f4",cursor:"pointer",fontSize:"13px"},closeBtn:{background:"transparent",border:"none",color:"#6c7086",cursor:"pointer",fontSize:"16px",padding:"4px 8px"},smallBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"4px",padding:"3px 8px",color:"#cdd6f4",cursor:"pointer",fontSize:"11px"},saveBtn:{background:"#a6e3a1",border:"none",borderRadius:"6px",padding:"8px 20px",color:"#1e1e2e",fontWeight:600,cursor:"pointer",fontSize:"13px"},cancelBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:"6px",padding:"8px 20px",color:"#cdd6f4",cursor:"pointer",fontSize:"13px"}};export{fe as TriggerManagerPanel,fe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.app.view-mode-flat .guake-terminal{display:none}.flat-view{display:grid;grid-template-columns:1fr 1fr;height:100%;width:100%;background:#282a36;overflow:hidden;padding-left:64px;box-sizing:border-box;transition:grid-template-columns .25s ease}.flat-view--with-inspector{grid-template-columns:1fr 1fr 320px}.flat-middle{display:flex;flex-direction:column;background:#282a36;border-right:1px solid rgba(255,255,255,.06);overflow:hidden;min-width:280px}.flat-middle__header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;gap:12px}.flat-middle__title{font-size:14px;font-weight:600;color:#f8f8f2;margin:0}.flat-middle__actions{display:flex;gap:6px;flex-shrink:0}.flat-middle__content{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px}.flat-middle__content::-webkit-scrollbar{width:6px}.flat-middle__content::-webkit-scrollbar-track{background:transparent}.flat-middle__content::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-middle__content::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-cta-btn{padding:4px 10px;font-size:11px;font-weight:500;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.flat-cta-btn--agent{background:#50fa7b26;color:#50fa7b}.flat-cta-btn--agent:hover{background:#50fa7b40}.flat-cta-btn--boss{background:#ffd70026;color:gold}.flat-cta-btn--boss:hover{background:#ffd70040}.flat-cta-btn--building{background:#8be9fd26;color:#8be9fd}.flat-cta-btn--building:hover{background:#8be9fd40}.flat-cta-btn--area{background:#bd93f926;color:#bd93f9}.flat-cta-btn--area:hover{background:#bd93f940}.flat-middle .agent-overview-panel{position:relative;inset:auto;width:100%;height:100%;border-right:none;flex:1;min-height:0;z-index:auto}.flat-middle .agent-overview-panel .aop-row-controls .close-btn{display:none}.flat-middle__content:has(>.agent-overview-panel){padding:0;overflow:hidden}.flat-right{display:flex;flex-direction:column;background:#21222c;overflow:hidden}.flat-chat{display:flex;flex-direction:column;height:100%}.flat-chat--empty{align-items:center;justify-content:center}.flat-chat__placeholder{display:flex;flex-direction:column;align-items:center;gap:12px;color:#6272a4}.flat-chat__placeholder-icon{font-size:48px;opacity:.5}.flat-chat__placeholder-text{font-size:14px}.flat-map{display:flex;flex-direction:column;height:100%;padding:12px 16px;gap:10px;overflow-y:auto}.flat-map::-webkit-scrollbar{width:6px}.flat-map::-webkit-scrollbar-track{background:transparent}.flat-map::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-map::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-map__header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-shrink:0}.flat-map__title{font-size:13px;font-weight:600;color:#f8f8f2}.flat-map__hint{font-size:11px;color:#6272a4}.flat-map__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;align-content:start}@media(max-width:768px){.flat-map__grid{grid-template-columns:1fr}}.flat-map__empty{grid-column:1/-1;display:flex;align-items:center;justify-content:center;padding:40px;color:#6272a4;font-size:13px}.flat-map-area-card{display:flex;flex-direction:column;background:#363848;border:1px solid rgba(255,255,255,.06);border-radius:8px;overflow:hidden;transition:border-color .15s ease,box-shadow .15s ease}.flat-map-area-card:hover{border-color:#ffffff1a;box-shadow:0 2px 8px #00000040}.flat-map-area-card__header{display:flex;align-items:center;gap:6px;padding:6px 8px;background:transparent;border:none;cursor:pointer;width:100%;text-align:left;color:#f8f8f2;font-size:12px;font-weight:600;transition:background .15s ease}.flat-map-area-card__header:hover{background:#ffffff0a}.flat-map-area-card__color{width:8px;height:8px;border-radius:50%;flex-shrink:0}.flat-map-area-card__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flat-map-area-card__count{font-size:10px;font-weight:500;color:#6272a4;background:#ffffff0f;padding:1px 5px;border-radius:8px;flex-shrink:0}.flat-map-area-card__caret{font-size:10px;color:#6272a4;flex-shrink:0;width:12px;text-align:center}.flat-map-area-card__agents{display:flex;flex-wrap:wrap;gap:4px;padding:0 8px 8px}.flat-map-agent-chip{position:relative;display:inline-flex;align-items:center;gap:5px;padding:3px 7px 6px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;overflow:hidden}.flat-map-agent-chip:hover{background:#ffffff14;border-color:#ffffff1f;color:#f8f8f2}.flat-map-agent-chip.working{background-color:#4a9eff24;background-image:linear-gradient(110deg,transparent 35%,rgba(139,233,253,.55) 50%,transparent 65%);background-size:250% 100%;background-repeat:no-repeat;background-position:150% 0;border-color:#4a9eff8c;color:#f8f8f2;box-shadow:0 0 8px #4a9eff59;animation:flat-map-agent-working-shimmer 1.6s linear infinite}.flat-map-agent-chip.working .flat-map-agent-chip__dot{box-shadow:0 0 6px #4a9effb3}@keyframes flat-map-agent-working-shimmer{0%{background-position:150% 0}to{background-position:-50% 0}}@media(prefers-reduced-motion:reduce){.flat-map-agent-chip.working{animation-duration:5s;background-image:linear-gradient(110deg,transparent 40%,rgba(139,233,253,.3) 50%,transparent 60%)}}.flat-map-agent-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-agent-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-map-agent-chip__provider-icon{width:12px;height:12px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-map-agent-chip__crown{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.flat-map-agent-chip__context-bar{position:absolute;left:0;right:0;bottom:0;height:2px;background:#ffffff0f;pointer-events:none}.flat-map-agent-chip__context-bar-fill{display:block;height:100%;transition:width .2s ease,background-color .2s ease}.flat-terminal-wrapper{display:flex;flex-direction:column;height:100%;min-height:0;position:relative;background:#21222c;overflow:hidden;--guake-side-panel-width: 380px}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel){margin-right:var(--guake-side-panel-width);transition:margin-right .2s ease}.flat-terminal-wrapper__header{display:flex;flex-direction:row;align-items:center;gap:12px;padding:6px 12px;border-bottom:1px solid rgba(255,255,255,.06);background:#1e1f29;flex-shrink:0;min-height:40px}.flat-terminal-wrapper__header-main{display:flex;align-items:center;gap:10px;min-width:0;flex:1 1 auto;overflow:hidden;padding:4px 6px;margin:0;background:transparent;border:1px solid transparent;border-radius:8px;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__header-main:hover{background:#ffffff0a;border-color:#ffffff0f}.flat-terminal-wrapper__header-main--active{background:#bd93f92e;border-color:#bd93f973}.flat-terminal-wrapper__header-main--active:hover{background:#bd93f942}.flat-terminal-wrapper__header-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex:0 0 auto;flex-wrap:nowrap}.flat-terminal-wrapper__statusbar{display:flex;align-items:center;gap:10px;padding:6px 12px;flex-shrink:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.06);min-height:32px;box-sizing:border-box}.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__cwd,.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__context{background:transparent;border-color:#ffffff0a}.flat-terminal-wrapper__statusbar-spacer{flex:1 1 auto}.flat-terminal-wrapper__buildings{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__building-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__building-btn:hover{color:#f8f8f2;background:#ffffff14}.flat-terminal-wrapper__building-btn--offline{color:#ffb86cbf}.flat-terminal-wrapper__building-btn--offline:hover{color:#ffb86c}.flat-terminal-wrapper__building-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__building-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__detached{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;font-size:11px;font-weight:500;color:#ffb86c;background:#ffb86c1f;border:1px solid rgba(255,184,108,.35);border-radius:10px;animation:blink 1.6s ease-in-out infinite}.flat-terminal-wrapper__area-dir{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:11px;font-family:SF Mono,Menlo,Consolas,monospace;color:#9a9caa;background:#ffffff08;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;max-width:240px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__area-dir:hover{background:#ffffff14;color:#f8f8f2;border-color:#ffffff24}.flat-terminal-wrapper__area-dir-name{overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__area-dir-branch{display:inline-flex;align-items:center;gap:3px;color:#8be9fd;opacity:.85}.flat-terminal-wrapper__branch-ahead{display:inline-flex;align-items:center;color:#50fa7b}.flat-terminal-wrapper__branch-behind{display:inline-flex;align-items:center;color:#ffb86c}.flat-terminal-wrapper__area-fetch{display:inline-flex;align-items:center;padding:1px 3px;border-radius:4px;color:#6272a4;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__area-fetch:hover{background:#ffffff14;color:#f8f8f2}.flat-terminal-wrapper__area-fetch--fetching{animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__context-label{color:#6272a4;margin-right:2px}.flat-terminal-wrapper__context-free{color:#6272a4;font-size:10px}.flat-terminal-wrapper__actions{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__action-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:24px;padding:0;font-size:12px;line-height:1;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__action-btn:hover:not(:disabled){color:#f8f8f2;background:#ffffff0f}.flat-terminal-wrapper__action-btn:disabled{opacity:.35;cursor:not-allowed}.flat-terminal-wrapper__action-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__action-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__action-btn--danger{color:#ff5555d9}.flat-terminal-wrapper__action-btn--danger:hover{color:#f55;background:#ff55551f}.flat-terminal-wrapper__action-btn--confirm{color:#f55;background:#ff55552e;box-shadow:0 0 0 1px #ff555580;animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__more{position:relative;display:inline-flex}.flat-terminal-wrapper__more-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:220px;padding:4px;background:#363848;border:1px solid rgba(255,255,255,.08);border-radius:8px;box-shadow:0 8px 28px #00000073;z-index:100}.flat-terminal-wrapper__more-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 10px;font-size:12px;color:#f8f8f2;background:transparent;border:none;border-radius:6px;cursor:pointer;text-align:left;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__more-item:hover:not(:disabled){background:#ffffff0f}.flat-terminal-wrapper__more-item:disabled{opacity:.45;cursor:not-allowed}.flat-terminal-wrapper__more-item--danger{color:#ff5555e6}.flat-terminal-wrapper__more-item--danger:hover:not(:disabled){color:#f55;background:#ff55551f}.flat-terminal-wrapper__more-divider{height:1px;margin:4px 2px;background:#ffffff0f}.flat-terminal-wrapper__header-info{display:flex;flex-direction:row;align-items:baseline;gap:8px;min-width:0;overflow:hidden}.flat-terminal-wrapper__header-name{font-size:13px;font-weight:600;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-status{font-size:10px;text-transform:capitalize;flex-shrink:0}.flat-terminal-wrapper__header-task{font-size:11px;color:#6272a4;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:2px 8px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);flex-shrink:1}.flat-terminal-wrapper__header-model{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-width:0}.flat-terminal-wrapper__header-provider-icon{width:16px;height:16px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-terminal-wrapper__header-model-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:10px;font-family:SF Mono,Menlo,Consolas,monospace;font-weight:600;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:999px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;line-height:1.4}.flat-terminal-wrapper__header-model-name{color:#f8f8f2;text-transform:lowercase;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-model-sep{opacity:.6}.flat-terminal-wrapper__header-model-effort{color:#bd93f9;text-transform:lowercase}.flat-terminal-wrapper__cwd{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;max-width:240px;transition:background .15s ease,border-color .15s ease,color .15s ease}.flat-terminal-wrapper__cwd:hover{background:#ffffff14;border-color:#ffffff24;color:#f8f8f2}.flat-terminal-wrapper__cwd-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__cwd-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:SF Mono,Menlo,Consolas,monospace}.flat-terminal-wrapper__context{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__context:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__context-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__context-bar{position:relative;width:56px;height:5px;border-radius:3px;background:#ffffff14;overflow:hidden}.flat-terminal-wrapper__context-bar-fill{position:absolute;left:0;top:0;height:100%;border-radius:3px;transition:width .2s ease,background-color .2s ease}.flat-terminal-wrapper__context-tokens{font-family:SF Mono,Menlo,Consolas,monospace;font-size:11px;font-weight:600;font-variant-numeric:tabular-nums}.flat-terminal-wrapper__context-warning{font-size:11px;opacity:.8}.flat-terminal-wrapper__view-mode{display:inline-flex;align-items:center;padding:2px;gap:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__view-mode-btn{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:8px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__view-mode-btn:hover{color:#f8f8f2;background:#ffffff0a}.flat-terminal-wrapper__view-mode-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f980,0 1px 3px #00000040}.flat-terminal-wrapper__view-mode-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__view-mode-icon{font-size:13px;line-height:1}.flat-terminal-wrapper__view-mode-label{line-height:1}.flat-terminal-wrapper__theme{display:inline-flex;align-items:center}.flat-terminal-wrapper__theme .theme-selector-trigger{padding:4px 9px;font-size:11px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06)}.flat-terminal-wrapper__theme .theme-selector-trigger:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__inspector-toggle:hover{color:#f8f8f2;background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle--active{color:#f8f8f2;background:#bd93f938;border-color:#bd93f98c;box-shadow:0 0 0 1px #bd93f959,0 1px 3px #00000040}.flat-terminal-wrapper__inspector-toggle--active:hover{background:#bd93f952}.flat-terminal-wrapper__inspector-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}.flat-terminal-wrapper__inspector-label{line-height:1}.flat-terminal-wrapper__close{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;color:#6272a4;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__close:hover{color:#f55;background:#ff55551f;border-color:#f556}@media(max-width:1100px){.flat-terminal-wrapper__view-mode-label,.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__cwd{max-width:160px}}.flat-terminal-wrapper .guake-output{flex:1 1 auto;min-height:0;overflow-y:auto;padding:14px 18px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar{width:6px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-track{background:transparent}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-terminal-wrapper .guake-input-container{position:relative;flex-shrink:0;border-top:1px solid rgba(255,255,255,.06);background:#1e1f29}.flat-terminal-wrapper .guake-search-bar,.flat-terminal-wrapper .atp-search-bar{position:sticky;top:0;z-index:10;background:#1e1f29}.flat-terminal-wrapper .guake-handle,.flat-terminal-wrapper .guake-side-panel-resize,.flat-terminal-wrapper .atp-resize-handle{display:none}.flat-terminal-wrapper .compacting-indicator{padding:12px;margin:8px}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}.flat-inspector{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:#1e1f29;border-left:1px solid rgba(255,255,255,.06);overflow:hidden;animation:flat-inspector-slide-in .22s ease}.flat-inspector__header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.06);background:#21222c;flex-shrink:0}.flat-inspector__tabs{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#00000040;border:1px solid rgba(255,255,255,.06);border-radius:6px}.flat-inspector__tab{padding:4px 10px;font-size:12px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:4px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-inspector__tab:hover{color:#f8f8f2}.flat-inspector__tab--active{color:#f8f8f2;background:#ffffff14}.flat-inspector__close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:13px;color:#6272a4;background:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-inspector__close:hover{color:#f8f8f2;background:#ffffff0f;border-color:#ffffff1a}.flat-inspector__body{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column}.flat-inspector__body .unit-panel{flex:1 1 auto;min-height:0;min-width:0;padding:10px}.flat-inspector__empty{display:flex;align-items:center;justify-content:center;flex:1;color:#6272a4;font-size:13px}@keyframes flat-inspector-slide-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media(max-width:1024px){.flat-view,.flat-view--with-inspector{grid-template-columns:1fr}.flat-right,.flat-inspector{display:none}}@media(min-width:1400px){.flat-view{grid-template-columns:minmax(280px,400px) 1fr}.flat-view--with-inspector{grid-template-columns:minmax(280px,400px) 1fr 360px}}.flat-bottom-panel{display:flex;flex-direction:column;flex-shrink:0;height:250px;min-height:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.08);overflow:hidden}.flat-bottom-panel__header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 10px;background:#21222c;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;min-height:28px}.flat-bottom-panel__title{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-bottom-panel__muted{color:#6272a4;font-weight:400;font-size:10px}.flat-bottom-panel__close{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-bottom-panel__close:hover{color:#f8f8f2;background:#ffffff14}.flat-bottom-panel__body{flex:1 1 auto;min-height:0;display:flex;background:#282a36}.flat-bottom-panel__body>*{flex:1 1 auto;min-height:0}.flat-bottom-panel__placeholder{flex:1 1 auto;display:flex;align-items:center;justify-content:center;color:#6272a4;font-size:12px}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{z as et,B as tt,r as s,C as We,S as C,E as Ue,G as De,H as ae,J as at,s as _,K as Ke,L as nt,v as st,w as rt,j as e,I as m,M as lt,m as it,N as qe,O as Ye,P as ot,U as ct,V as dt,W as pt,X as mt,Y as ut,Z as ht,_ as ft,$ as gt,a0 as xt,a1 as _t,a2 as bt,a3 as wt,a4 as jt,a5 as Nt,a6 as Ct,a7 as vt,a8 as kt,a9 as At,aa as St,ab as Et,ac as Mt}from"./main-C-iXDssE.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const It=["simple","chat","advanced"],yt={simple:"Simple",chat:"Chat",advanced:"Advanced"},$t={simple:"○",chat:"◐",advanced:"◉"},zt={simple:"Simple view — clean messages only",chat:"Chat view — assistant replies (no tool calls)",advanced:"Advanced view — everything including tools"},Xe="flat-clear-context";function Pt(u){const d=u.split("/").filter(Boolean);return d.length===0?u:d.slice(-2).join("/")}function Rt(u){if(u.provider==="codex"){const X=u.codexModel||"gpt-5.3-codex",w=St[X];return{model:(w==null?void 0:w.label)||X}}if(u.provider==="opencode")return{model:u.opencodeModel||"opencode"};const d=u.model||"sonnet",b=Mt[d],k=u.effort,E=k?Et[k]:void 0;return{model:(b==null?void 0:b.label)||d,effort:E==null?void 0:E.label}}function Tt(u,d){if(d.type==="rectangle"&&d.width&&d.height){const b=d.width/2,k=d.height/2;return u.x>=d.center.x-b&&u.x<=d.center.x+b&&u.z>=d.center.z-k&&u.z<=d.center.z+k}if(d.type==="circle"&&d.radius){const b=u.x-d.center.x,k=u.z-d.center.z;return b*b+k*k<=d.radius*d.radius}return!1}const Ot=ft.memo(function({agentId:d,terminalViewMode:b,onTerminalViewModeChange:k,inspectorOpen:E,onToggleInspector:X,onImageClick:w,onFileClick:ne,onBashClick:se,onViewMarkdown:he,onRequestClearSubordinates:fe,onOpenBuilding:re,keyboard:le,canNavigateBack:ge,canNavigateForward:I,onNavigateBack:K,onNavigateForward:q,agentInfoOpen:G,onToggleAgentInfo:Ie}){var l,o,M,g;const p=gt(d),y=xt(),V=s.useRef(null),xe=s.useRef(null);s.useEffect(()=>{const a=xe.current;if(!a)return;const c=n=>{n.button===3?(n.preventDefault(),n.stopPropagation(),K()):n.button===4&&(n.preventDefault(),n.stopPropagation(),q())},i=n=>{(n.button===3||n.button===4)&&n.preventDefault()};return a.addEventListener("mouseup",c),a.addEventListener("mousedown",i),()=>{a.removeEventListener("mouseup",c),a.removeEventListener("mousedown",i)}},[K,q]);const Y=Ke(),Z=s.useMemo(()=>{if(!p)return null;const a=new Set,c=[];for(const i of Y.values())i.archived||i.directories.length===0||i.assignedAgentIds.includes(d)&&(a.add(i.id),c.push(i));for(const i of Y.values())i.archived||i.directories.length===0||a.has(i.id)||Tt({x:p.position.x,z:p.position.z},i)&&(a.add(i.id),c.push(i));return c.length===0?null:c.flatMap(i=>i.directories.filter(n=>n&&n.trim().length>0).map(n=>({areaId:i.id,areaName:i.name,dir:n})))},[p,d,Y]),{branches:T,fetchRemote:_e,fetchingDirs:ie}=_t(Z),J=s.useMemo(()=>{var i;const a=_.getAreaForAgent(d);if(!a)return[];const c=[];for(const n of y.values())n.type==="terminal"&&_.isPositionInArea(n.position,a)&&c.push({id:n.id,name:n.name,hasUrl:!!((i=n.terminalStatus)!=null&&i.url)});return c},[d,y]),be=s.useMemo(()=>{var i;const a=_.getAreaForAgent(d);if(!a)return[];const c=[];for(const n of y.values())n.type==="server"&&((i=n.pm2)!=null&&i.enabled)&&_.isPositionInArea(n.position,a)&&c.push({id:n.id,name:n.name});return c},[d,y]),we=s.useMemo(()=>{const a=_.getAreaForAgent(d);if(!a)return[];const c=[];for(const i of y.values())i.type==="database"&&i.database&&_.isPositionInArea(i.position,a)&&c.push({id:i.id,name:i.name});return c},[d,y]),[,ye]=s.useReducer(a=>a+1,0),Q=((l=V.current)==null?void 0:l.search.searchMode)??!1,$e=s.useCallback(()=>{var a;(a=V.current)==null||a.search.toggleSearch(),ye()},[]),je=bt(),oe=je.isPending(Xe),[O,f]=s.useState(null),A=O?y.get(O):null,{height:L,onResizeStart:ce}=wt(),[B,Ne]=s.useState(()=>De(C.GIT_PANEL_OPEN,!1)),[H,Ce]=s.useState(()=>De(C.BUILDINGS_PANEL_OPEN,!1)),ze=s.useCallback(()=>{Ne(a=>{const c=!a;return ae(C.GIT_PANEL_OPEN,c),c})},[]),ee=s.useCallback(()=>{Ce(a=>{const c=!a;return ae(C.BUILDINGS_PANEL_OPEN,c),c})},[]),$=s.useCallback(()=>{Ne(!1),ae(C.GIT_PANEL_OPEN,!1)},[]),te=s.useCallback(()=>{Ce(!1),ae(C.BUILDINGS_PANEL_OPEN,!1)},[]),Pe=jt();s.useEffect(()=>{if(!O)return;J.some(c=>c.id===O)||f(null)},[O,J]);const[W,F]=s.useState(!1),de=s.useRef(null);if(s.useEffect(()=>{if(!W)return;const a=c=>{de.current&&!de.current.contains(c.target)&&F(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[W]),!p)return e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-chat__placeholder",children:[e.jsx("span",{className:"flat-chat__placeholder-icon",children:"💬"}),e.jsx("span",{className:"flat-chat__placeholder-text",children:"Select an agent to start chatting"})]})});const z=p.contextStats,ve=!!z,pe=z?z.totalTokens:p.contextUsed||0,me=z?z.contextWindow:p.contextLimit||2e5,Re=z?z.usedPercent:Math.round(pe/me*100),P=Math.max(0,Math.min(100,Re)),Te=Math.max(0,100-P),ue=P>=80?"#ff4a4a":P>=60?"#ff9e4a":P>=40?"#ffd700":"#4aff9e",ke=(pe/1e3).toFixed(1),R=(me/1e3).toFixed(1),U=p.cwd,Ae=U?Pt(U):null,t=((o=p.subordinateIds)==null?void 0:o.length)||0,r=t>0;return e.jsxs("div",{ref:xe,className:`flat-terminal-wrapper ${B||H?"flat-terminal-wrapper--with-side-panel":""}`,children:[e.jsxs("div",{className:"flat-terminal-wrapper__header",children:[e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__header-main ${G?"flat-terminal-wrapper__header-main--active":""}`,onClick:Ie,title:G?"Hide agent info":"Show agent info","aria-pressed":G,children:[e.jsx(qe,{agent:p,size:28}),e.jsxs("span",{className:"flat-terminal-wrapper__header-info",children:[e.jsx("span",{className:"flat-terminal-wrapper__header-name",children:p.name}),e.jsx("span",{className:"flat-terminal-wrapper__header-status",style:{color:Ye(p.status)},children:p.status})]}),p.taskLabel&&e.jsxs("span",{className:"flat-terminal-wrapper__header-task",title:p.taskLabel,children:["📋 ",p.taskLabel]}),e.jsxs("span",{className:"flat-terminal-wrapper__header-model",children:[e.jsx("img",{src:p.provider==="codex"?"/assets/codex.png":p.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:p.provider,className:"flat-terminal-wrapper__header-provider-icon",title:p.provider==="codex"?"Codex Agent":p.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),(()=>{const{model:a,effort:c}=Rt(p);return e.jsxs("span",{className:"flat-terminal-wrapper__header-model-chip",title:c?`Model: ${a} · Effort: ${c}`:`Model: ${a}`,children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-name",children:a}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flat-terminal-wrapper__header-model-sep","aria-hidden":"true",children:"·"}),e.jsx("span",{className:"flat-terminal-wrapper__header-model-effort",children:c})]})]})})()]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__header-meta",children:[e.jsx("div",{className:"flat-terminal-wrapper__view-mode",role:"group","aria-label":"Message view mode",children:It.map(a=>e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__view-mode-btn ${b===a?"flat-terminal-wrapper__view-mode-btn--active":""}`,onClick:()=>k(a),title:zt[a],"aria-pressed":b===a,children:[e.jsx("span",{className:"flat-terminal-wrapper__view-mode-icon","aria-hidden":"true",children:$t[a]}),e.jsx("span",{className:"flat-terminal-wrapper__view-mode-label",children:yt[a]})]},a))}),e.jsxs("div",{className:"flat-terminal-wrapper__actions",role:"group","aria-label":"Terminal actions",children:[e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:K,disabled:!ge,title:"Back to previous agent","aria-label":"Back to previous agent",children:e.jsx(m,{name:"arrow-left",size:14})}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__action-btn",onClick:q,disabled:!I,title:"Forward to next agent","aria-label":"Forward to next agent",children:e.jsx(m,{name:"arrow-right",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${Q?"flat-terminal-wrapper__action-btn--active":""}`,onClick:$e,title:Q?"Close search":"Search messages","aria-pressed":Q,children:e.jsx(m,{name:Q?"cross":"search",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn flat-terminal-wrapper__action-btn--danger ${oe?"flat-terminal-wrapper__action-btn--confirm":""}`,onClick:()=>je.handleClick(Xe,()=>{var a;_.clearContext(d),(a=V.current)==null||a.historyLoader.clearHistory()}),title:oe?"Click again to confirm clear context":"Clear context",children:e.jsx(m,{name:oe?"question":"clear",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${B?"flat-terminal-wrapper__action-btn--active":""}`,onClick:ze,title:B?"Hide git panel":"Show git changes","aria-pressed":B,children:e.jsx(m,{name:"git-branch",size:14})}),e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${H?"flat-terminal-wrapper__action-btn--active":""}`,onClick:ee,title:H?"Hide buildings panel":"Show area buildings","aria-pressed":H,children:e.jsx(m,{name:"buildings",size:14})}),e.jsxs("div",{className:"flat-terminal-wrapper__more",ref:de,children:[e.jsx("button",{type:"button",className:`flat-terminal-wrapper__action-btn ${W?"flat-terminal-wrapper__action-btn--active":""}`,onClick:()=>F(a=>!a),title:"More actions","aria-expanded":W,children:"⋮"}),W&&e.jsxs("div",{className:"flat-terminal-wrapper__more-menu",role:"menu",children:[e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item",onClick:()=>{_.collapseContext(d),F(!1)},disabled:p.status!=="idle",title:p.status!=="idle"?"Agent must be idle to collapse context":"Collapse context",children:[e.jsx(m,{name:"package",size:14}),e.jsx("span",{children:"Collapse context"})]}),r&&e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{fe(d,t),F(!1)},children:[e.jsx(m,{name:"crown",size:14}),e.jsxs("span",{children:["Clear ",t," subordinate",t===1?"":"s"]})]}),e.jsx("div",{className:"flat-terminal-wrapper__more-divider"}),e.jsxs("button",{type:"button",role:"menuitem",className:"flat-terminal-wrapper__more-item flat-terminal-wrapper__more-item--danger",onClick:()=>{_.killAgent(d),F(!1)},children:[e.jsx(m,{name:"cross",size:14}),e.jsx("span",{children:"Remove agent"})]})]})]})]}),e.jsxs("button",{type:"button",className:`flat-terminal-wrapper__inspector-toggle ${E?"flat-terminal-wrapper__inspector-toggle--active":""}`,onClick:X,title:E?"Hide inspector panel":"Show inspector panel","aria-label":E?"Hide inspector panel":"Show inspector panel","aria-pressed":E,children:[e.jsx("span",{className:"flat-terminal-wrapper__inspector-icon","aria-hidden":"true",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"}),e.jsx("line",{x1:"10",y1:"2.5",x2:"10",y2:"13.5"})]})}),e.jsx("span",{className:"flat-terminal-wrapper__inspector-label",children:"Inspector"})]}),e.jsx("button",{type:"button",className:"flat-terminal-wrapper__close",onClick:()=>_.deselectAll(),title:"Close chat","aria-label":"Close chat",children:e.jsx(m,{name:"cross",size:14})})]})]}),e.jsx(Nt,{ref:V,agentId:d,agent:p,viewMode:b,isOpen:!0,onImageClick:w,onFileClick:ne,onBashClick:se,onViewMarkdown:he,keyboard:le,hasModalOpen:!1}),A&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:ce,role:"separator","aria-orientation":"horizontal","aria-label":"Resize embedded terminal"}),e.jsxs("div",{className:"flat-bottom-panel",role:"region","aria-label":`Embedded terminal: ${A.name}`,style:{height:L},children:[e.jsxs("div",{className:"flat-bottom-panel__header",children:[e.jsxs("span",{className:"flat-bottom-panel__title",children:[e.jsx(m,{name:"terminal",size:12}),e.jsx("span",{children:A.name}),!((M=A.terminalStatus)!=null&&M.url)&&e.jsx("span",{className:"flat-bottom-panel__muted",children:"(starting...)"})]}),e.jsx("button",{type:"button",className:"flat-bottom-panel__close",onClick:()=>f(null),title:"Close embedded terminal","aria-label":"Close embedded terminal",children:e.jsx(m,{name:"cross",size:12})})]}),e.jsx("div",{className:"flat-bottom-panel__body",children:(g=A.terminalStatus)!=null&&g.url?e.jsx(Ct,{terminalUrl:A.terminalStatus.url,visible:!0}):e.jsx("div",{className:"flat-bottom-panel__placeholder",children:"Starting terminal..."})})]})]}),e.jsxs("div",{className:"flat-terminal-wrapper__statusbar",role:"contentinfo",children:[p.isDetached&&e.jsxs("span",{className:"flat-terminal-wrapper__detached",title:"Reattaching session...",children:[e.jsx(m,{name:"refresh",size:12}),e.jsx("span",{children:"Reattaching"})]}),U&&Ae&&e.jsxs("span",{className:"flat-terminal-wrapper__cwd",title:U,onClick:()=>_.setFileViewerPath(U),children:[e.jsx("span",{className:"flat-terminal-wrapper__cwd-icon",children:e.jsx(m,{name:"folder",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__cwd-text",children:Ae})]}),Z&&Z.map(({areaId:a,areaName:c,dir:i})=>{const n=T.get(i),x=ie.has(i),S=i.split("/").filter(Boolean).pop()||i;return e.jsxs("span",{className:"flat-terminal-wrapper__area-dir",title:`${c}: ${i}${n?` (${n.branch}${n.ahead?` ↑${n.ahead}`:""}${n.behind?` ↓${n.behind}`:""})`:""}`,onClick:()=>_.openFileExplorerForAreaFolder(a,i),children:[e.jsx(m,{name:"folder-open",size:12}),e.jsx("span",{className:"flat-terminal-wrapper__area-dir-name",children:S}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flat-terminal-wrapper__area-dir-branch",children:[e.jsx(m,{name:"git-branch",size:10})," ",n.branch]}),n.ahead>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-ahead",title:`${n.ahead} ahead`,children:[e.jsx(m,{name:"arrow-up",size:9}),n.ahead]}),n.behind>0&&e.jsxs("span",{className:"flat-terminal-wrapper__branch-behind",title:`${n.behind} behind`,children:[e.jsx(m,{name:"arrow-down",size:9}),n.behind]}),e.jsx("span",{className:`flat-terminal-wrapper__area-fetch ${x?"flat-terminal-wrapper__area-fetch--fetching":""}`,title:"Git fetch",onClick:D=>{D.stopPropagation(),_e(i)},children:e.jsx(m,{name:x?"hourglass":"download",size:12})})]})]},`${a}:${i}`)}),e.jsxs("span",{className:"flat-terminal-wrapper__context",onClick:()=>_.setContextModalAgentId(d),title:ve?`Context usage: ${ke}k / ${R}k tokens (${P}% used). Click to view stats.`:"Click to fetch context stats",children:[e.jsx("span",{className:"flat-terminal-wrapper__context-icon",children:e.jsx(m,{name:"dashboard",size:12})}),e.jsx("span",{className:"flat-terminal-wrapper__context-label",children:"Ctx:"}),e.jsx("span",{className:"flat-terminal-wrapper__context-bar",children:e.jsx("span",{className:"flat-terminal-wrapper__context-bar-fill",style:{width:`${P}%`,backgroundColor:ue}})}),e.jsxs("span",{className:"flat-terminal-wrapper__context-tokens",style:{color:ue},children:[ke,"k/",R,"k"]}),e.jsxs("span",{className:"flat-terminal-wrapper__context-free",children:["(",Te,"% free)"]}),!ve&&e.jsx("span",{className:"flat-terminal-wrapper__context-warning",title:"No context stats yet",children:e.jsx(m,{name:"warn",size:12})})]}),e.jsx("div",{className:"flat-terminal-wrapper__statusbar-spacer","aria-hidden":"true"}),J.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area terminals",children:J.map(a=>{const c=O===a.id;return e.jsx("button",{type:"button",className:`flat-terminal-wrapper__building-btn ${c?"flat-terminal-wrapper__building-btn--active":""} ${a.hasUrl?"":"flat-terminal-wrapper__building-btn--offline"}`,title:`${c?"Hide":"Show"} terminal: ${a.name}${a.hasUrl?"":" (starting...)"}`,onClick:()=>{if(c){f(null);return}a.hasUrl||_.sendBuildingCommand(a.id,"start"),f(a.id)},children:e.jsx(m,{name:"terminal",size:14})},a.id)})}),be.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area PM2 logs",children:be.map(a=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open logs: ${a.name}`,onClick:()=>re(a.id),children:e.jsx(m,{name:"scroll",size:14})},a.id))}),we.length>0&&e.jsx("span",{className:"flat-terminal-wrapper__buildings",role:"group","aria-label":"Area databases",children:we.map(a=>e.jsx("button",{type:"button",className:"flat-terminal-wrapper__building-btn",title:`Open database: ${a.name}`,onClick:()=>re(a.id),children:e.jsx(m,{name:"hard-drives",size:14})},a.id))}),e.jsx("div",{className:"flat-terminal-wrapper__theme",children:e.jsx(vt,{})})]}),B&&e.jsx(kt,{agentId:d,agents:Pe,onClose:$,branchInfoMap:T,fetchRemote:_e,fetchingDirs:ie}),H&&e.jsx(At,{agentId:d,onClose:te})]})});function Dt({onAgentClick:u,onBuildingClick:d,onBuildingDoubleClick:b,onOpenSpawnModal:k,onOpenBossSpawnModal:E,onOpenAreaModal:X}){const w=et(),ne=tt(),[se,he]=s.useState(null),[fe,re]=s.useState(null),[le,ge]=s.useState(null),[I,K]=s.useState(null),[q,G]=s.useState(!1),Ie=s.useCallback(()=>{G(t=>!t)},[]),p=s.useCallback(()=>{G(!1)},[]),[y,V]=s.useState(()=>{const t=We(C.VIEW_MODE);return t==="simple"||t==="chat"||t==="advanced"?t:"simple"}),xe=s.useCallback(t=>{V(t),Ue(C.VIEW_MODE,t)},[]);s.useEffect(()=>{const t=r=>{if(r.key!==C.VIEW_MODE)return;const l=r.newValue;(l==="simple"||l==="chat"||l==="advanced")&&V(l)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const[Y,Z]=s.useState(()=>De(C.FLAT_INSPECTOR_OPEN,!1)),[T,_e]=s.useState(()=>We(C.FLAT_INSPECTOR_VIEW)==="tracking"?"tracking":"agent"),ie=s.useCallback(t=>{_e(t),Ue(C.FLAT_INSPECTOR_VIEW,t)},[]),J=s.useCallback(()=>{Z(t=>{const r=!t;return ae(C.FLAT_INSPECTOR_OPEN,r),r})},[]),be=s.useCallback(()=>{Z(!1),ae(C.FLAT_INSPECTOR_OPEN,!1)},[]),we=at(),ye=s.useCallback((t,r)=>{he({url:t,name:r})},[]),Q=s.useCallback((t,r)=>{re({command:t,output:r,isLive:!1})},[]),$e=s.useCallback((t,r)=>{_.setFileViewerPath(t,r)},[]),je=s.useCallback(t=>{},[]),oe=s.useCallback((t,r)=>{ge({agentId:t,count:r})},[]),O=s.useCallback(t=>{b?b(t):d(t)},[d,b]),f=s.useMemo(()=>ne.size>0?Array.from(ne)[0]:null,[ne]);s.useEffect(()=>{G(!1)},[f]);const A=s.useRef([]),L=s.useRef(-1),ce=s.useRef(!1),B=s.useRef(null),[Ne,H]=s.useState(!1),[Ce,ze]=s.useState(!1),ee=s.useMemo(()=>new Set(w.map(t=>t.id)),[w]),$=s.useCallback(()=>{const t=A.current,r=L.current;H(r>0),ze(r>=0&&r<t.length-1)},[]),te=s.useCallback(t=>{const r=A.current;if(r.length===0)return;let l=L.current+t;for(;l>=0&&l<r.length;){const o=r[l];if(ee.has(o)){ce.current=!0,L.current=l,$(),_.selectAgent(o);return}l+=t}},[ee,$]),Pe=s.useCallback(()=>te(-1),[te]),W=s.useCallback(()=>te(1),[te]);s.useEffect(()=>{if(!f){A.current=[],L.current=-1,$();return}if(B.current=f,ce.current){ce.current=!1,$();return}const t=A.current,r=L.current;if(r>=0&&t[r]===f){$();return}const l=r<t.length-1?t.slice(0,r+1):t.slice();l.push(f),l.length>100&&l.shift(),A.current=l,L.current=l.length-1,$()},[f,$]);const F=s.useCallback(t=>{u(t)},[u]),de=f??"",z=s.useCallback(()=>{},[]),ve=s.useCallback(t=>{F(t)},[F]),pe=Y&&!!f,me=s.useRef(null);s.useEffect(()=>{if(f)return;const t=r=>{if(r.key!==" "&&r.key!=="Backspace")return;const l=r.target;if(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)return;const o=B.current;!o||!ee.has(o)||(r.preventDefault(),_.selectAgent(o))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[f,ee]);const[Re,P]=s.useState(new Set),Te=s.useCallback(t=>{P(r=>{const l=new Set(r);return l.has(t)?l.delete(t):l.add(t),l})},[]),ue=Ke(),[ke]=nt(),R=s.useMemo(()=>{const t=new Map,r=[];for(const n of w){const x=_.getAreaForAgent(n.id);if(!st((x==null?void 0:x.id)??null))continue;if(!x||x.archived){r.push(n);continue}const S=t.get(x.id);S?S.push(n):t.set(x.id,[n])}const l=[];for(const[,n]of ue){if(n.archived||!rt(n.id))continue;const x=t.get(n.id);x&&x.length>0&&l.push({area:n,agents:x})}r.length>0&&l.push({area:{id:"__unassigned__",name:"Unassigned",color:"#6272a4",center:{x:0,z:0},type:"circle",radius:0,directories:[],archived:!1,assignedAgentIds:[],zIndex:0},agents:r});const o=l.filter(n=>n.area.id!=="__unassigned__"),M=l.filter(n=>n.area.id==="__unassigned__");let g=1,a=1;const c=new Map;if(o.length>1){let n=1/0,x=-1/0,S=1/0,D=-1/0;for(const j of o)n=Math.min(n,j.area.center.x),x=Math.max(x,j.area.center.x),S=Math.min(S,j.area.center.z),D=Math.max(D,j.area.center.z);const Se=x-n||1,Ee=D-S||1;if(o.length<=4){g=o.length,a=1;const j=[...o].sort((N,Oe)=>N.area.center.x-Oe.area.center.x);for(let N=0;N<j.length;N++)c.set(j[N].area.id,{row:1,col:N+1})}else{const j=[...o].sort((h,v)=>h.area.center.x-v.area.center.x),N=[];for(let h=1;h<j.length;h++)N.push(j[h].area.center.x-j[h-1].area.center.x);const Oe=N.reduce((h,v)=>h+v,0)/N.length||1;let Ge=1;for(const h of N)h>Oe*1.3&&Ge++;g=Math.max(2,Math.min(Ge,o.length));const Le=[...o].sort((h,v)=>h.area.center.z-v.area.center.z),Me=[];for(let h=1;h<Le.length;h++)Me.push(Le[h].area.center.z-Le[h-1].area.center.z);const Ze=Me.reduce((h,v)=>h+v,0)/Me.length||1;let Ve=1;for(const h of Me)h>Ze*1.3&&Ve++;a=Math.max(2,Math.min(Ve,o.length)),g=Math.max(g,Math.ceil(o.length/a)),a=Math.max(a,Math.ceil(o.length/g));const Je=Se/g,Qe=Ee/a,He=new Set;for(const h of o){let v=Math.min(g-1,Math.max(0,Math.floor((h.area.center.x-n)/Je))),Be=Math.min(a-1,Math.max(0,Math.floor((h.area.center.z-S)/Qe))),Fe=`${Be},${v}`;for(;He.has(Fe)&&v<g-1;)v++,Fe=`${Be},${v}`;He.add(Fe),c.set(h.area.id,{row:Be+1,col:v+1})}}}const i=n=>{n.sort((x,S)=>{var Se,Ee,j,N;const D=(((Se=x.position)==null?void 0:Se.z)??0)-(((Ee=S.position)==null?void 0:Ee.z)??0);return D!==0?D:(((j=x.position)==null?void 0:j.x)??0)-(((N=S.position)==null?void 0:N.x)??0)})};for(const n of o)i(n.agents);for(const n of M)i(n.agents);return{groups:[...o,...M],gridCols:g,gridRows:a,positions:c}},[w,ue,ke]),U=s.useMemo(()=>{if(!I)return[];const t=w.find(r=>r.id===I.agentId);return t?[{id:"edit-agent",label:"Edit Agent",icon:e.jsx(m,{name:"edit",size:14}),onClick:()=>{window.dispatchEvent(new CustomEvent("tide:open-agent-edit",{detail:{agentId:t.id}}))}},{id:"open-chat",label:"Open Chat",icon:e.jsx(m,{name:"chat",size:14}),onClick:()=>u(t.id)},{id:"delete-agent",label:"Delete Agent",icon:e.jsx(m,{name:"trash",size:14}),danger:!0,onClick:()=>{window.confirm(`Remove ${t.name} from view?`)&&_.removeAgentFromServer(t.id)}}]:[]},[I,w,u]),Ae=s.useCallback(t=>{const r=new Set(R.groups.map(l=>l.area.id));r.delete(t),P(r),requestAnimationFrame(()=>{const l=me.current;if(!l)return;const o=l.querySelector(`[data-area-id="${t}"]`);if(!o)return;const M=l.getBoundingClientRect(),a=o.getBoundingClientRect().top-M.top+l.scrollTop-8;l.scrollTo({top:Math.max(0,a),behavior:"smooth"})})},[R]);return e.jsxs("div",{className:`flat-view ${pe?"flat-view--with-inspector":""}`,children:[e.jsxs("div",{className:"flat-middle",children:[e.jsxs("div",{className:"flat-middle__header",children:[e.jsx("h2",{className:"flat-middle__title",children:"👥 Agents"}),e.jsxs("div",{className:"flat-middle__actions",children:[e.jsx("button",{className:"flat-cta-btn flat-cta-btn--agent",onClick:k,title:"Create new agent",children:"+ Agent"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--boss",onClick:E,title:"Create new boss agent",children:"+ Boss"}),e.jsx("button",{className:"flat-cta-btn flat-cta-btn--area",onClick:X,title:"Create new area",children:"+ Area"})]})]}),e.jsx("div",{className:"flat-middle__content",children:e.jsx(lt,{activeAgentId:de,onClose:z,onSelectAgent:ve,collapsedAreas:Re,onToggleArea:Te,agentListRef:me})})]}),e.jsx("div",{className:"flat-right",children:f?e.jsx(Ot,{agentId:f,terminalViewMode:y,onTerminalViewModeChange:xe,inspectorOpen:Y,onToggleInspector:J,onImageClick:ye,onFileClick:$e,onBashClick:Q,onViewMarkdown:je,onRequestClearSubordinates:oe,onOpenBuilding:O,keyboard:we,canNavigateBack:Ne,canNavigateForward:Ce,onNavigateBack:Pe,onNavigateForward:W,agentInfoOpen:q,onToggleAgentInfo:Ie}):e.jsx("div",{className:"flat-chat flat-chat--empty",children:e.jsxs("div",{className:"flat-map",children:[e.jsxs("div",{className:"flat-map__header",children:[e.jsx("span",{className:"flat-map__title",children:"🗺️ Areas"}),e.jsx("span",{className:"flat-map__hint",children:"Click an area to focus it, or an agent to chat"})]}),e.jsx("div",{className:"flat-map__grid",style:{gridTemplateColumns:`repeat(${R.gridCols}, 1fr)`},children:R.groups.length===0?e.jsx("div",{className:"flat-map__empty",children:e.jsx("span",{children:"No areas or agents yet"})}):R.groups.map(t=>{const r=t.area.id,l=R.positions.get(r);return e.jsxs("div",{className:"flat-map-area-card",style:{"--area-color":t.area.color,gridRow:l==null?void 0:l.row,gridColumn:l==null?void 0:l.col},children:[e.jsxs("button",{type:"button",className:"flat-map-area-card__header",onClick:()=>Ae(r),title:`Focus ${t.area.name} in left panel`,children:[e.jsx("span",{className:"flat-map-area-card__color",style:{background:t.area.color}}),e.jsx("span",{className:"flat-map-area-card__name",children:t.area.name}),e.jsx("span",{className:"flat-map-area-card__count",children:t.agents.length})]}),e.jsx("div",{className:"flat-map-area-card__agents",children:t.agents.map(o=>{const M=o.isBoss||o.class==="boss",g=it(o),a=g.usedPercent>=80?"#ff4a4a":g.usedPercent>=60?"#ff9e4a":g.usedPercent>=40?"#ffd700":"#4aff9e",c=`Context: ${(g.totalTokens/1e3).toFixed(1)}k / ${(g.contextWindow/1e3).toFixed(1)}k (${g.usedPercent}% used, ${g.freePercent}% free)`;return e.jsxs("button",{type:"button",className:`flat-map-agent-chip ${o.status}`,onClick:()=>u(o.id),onContextMenu:i=>{i.preventDefault(),i.stopPropagation(),K({agentId:o.id,position:{x:i.clientX,y:i.clientY}})},title:`${M?"Boss · ":""}Open chat with ${o.name}
|
|
2
|
-
${c}`,children:[e.jsx(qe,{agent:o,size:16}),M&&e.jsx("span",{className:"flat-map-agent-chip__crown","aria-hidden":"true",children:e.jsx(m,{name:"crown",size:11,color:"#ffd700",weight:"fill"})}),e.jsx("span",{className:"flat-map-agent-chip__name",children:o.name}),e.jsx("img",{src:o.provider==="codex"?"/assets/codex.png":o.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:o.provider,className:"flat-map-agent-chip__provider-icon",title:o.provider==="codex"?"Codex Agent":o.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),e.jsx("span",{className:"flat-map-agent-chip__dot",style:{backgroundColor:Ye(o.status)}}),e.jsx("span",{className:"flat-map-agent-chip__context-bar","aria-hidden":"true",children:e.jsx("span",{className:"flat-map-agent-chip__context-bar-fill",style:{width:`${g.usedPercent}%`,backgroundColor:a}})})]},o.id)})})]},r)})})]})})}),pe&&f&&e.jsxs("aside",{className:"flat-inspector","aria-label":"Inspector panel",children:[e.jsxs("div",{className:"flat-inspector__header",children:[e.jsxs("div",{className:"flat-inspector__tabs",role:"tablist","aria-label":"Inspector view",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":T==="agent",className:`flat-inspector__tab ${T==="agent"?"flat-inspector__tab--active":""}`,onClick:()=>ie("agent"),children:"Agent"}),e.jsx("button",{type:"button",role:"tab","aria-selected":T==="tracking",className:`flat-inspector__tab ${T==="tracking"?"flat-inspector__tab--active":""}`,onClick:()=>ie("tracking"),children:"Tracking"})]}),e.jsx("button",{type:"button",className:"flat-inspector__close",onClick:be,title:"Close inspector","aria-label":"Close inspector",children:"✕"})]}),e.jsx("div",{className:"flat-inspector__body",children:T==="tracking"?e.jsx(ot,{activeAgentId:f??"",onSelectAgent:t=>u(t)}):(()=>{const t=w.find(r=>r.id===f);return t?e.jsx(ct,{agent:t,onFocusAgent:r=>u(r),onKillAgent:r=>_.killAgent(r)}):e.jsx("div",{className:"flat-inspector__empty",children:e.jsx("span",{children:"Agent not found"})})})()})]}),se&&e.jsx(dt,{url:se.url,name:se.name,onClose:()=>he(null)}),fe&&e.jsx(pt,{state:fe,onClose:()=>re(null)}),le&&e.jsx(mt,{action:"clear-subordinates",selectedAgentId:le.agentId,subordinateCount:le.count,onClose:()=>ge(null),onClearHistory:()=>{}}),e.jsx(ut,{agent:f?w.find(t=>t.id===f)??null:null,isOpen:q&&!!f,onClose:p}),e.jsx(ht,{isOpen:I!==null,position:(I==null?void 0:I.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:U,onClose:()=>K(null)})]})}export{Dt as FlatView};
|