@hasna/assistants 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.js +2492 -331
  2. package/dist/lib.js +58 -18
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -123610,8 +123610,12 @@ To enable:
123610
123610
  return { handled: true };
123611
123611
  }
123612
123612
  const parts = splitArgs(args);
123613
- const subcommand = parts[0]?.toLowerCase() || "list";
123614
- if (subcommand === "list" || !parts[0] && !args.trim()) {
123613
+ const subcommand = parts[0]?.toLowerCase() || "";
123614
+ if (!subcommand || subcommand === "ui") {
123615
+ context.emit("done");
123616
+ return { handled: true, showPanel: "wallet" };
123617
+ }
123618
+ if (subcommand === "list") {
123615
123619
  try {
123616
123620
  const cards = await manager.list();
123617
123621
  if (cards.length === 0) {
@@ -123771,7 +123775,7 @@ Rate limit: ${status.readsUsed}/${status.maxReads} reads this hour
123771
123775
  ## Wallet Commands
123772
123776
 
123773
123777
  `);
123774
- context.emit("text", `/wallet List stored cards
123778
+ context.emit("text", `/wallet Interactive wallet manager
123775
123779
  `);
123776
123780
  context.emit("text", `/wallet list List stored cards
123777
123781
  `);
@@ -123846,8 +123850,12 @@ To enable:
123846
123850
  return { handled: true };
123847
123851
  }
123848
123852
  const parts = args.trim().split(/\s+/);
123849
- const subcommand = parts[0]?.toLowerCase() || "list";
123850
- if (subcommand === "list" || !parts[0] && !args.trim()) {
123853
+ const subcommand = parts[0]?.toLowerCase() || "";
123854
+ if (!subcommand || subcommand === "ui") {
123855
+ context.emit("done");
123856
+ return { handled: true, showPanel: "secrets" };
123857
+ }
123858
+ if (subcommand === "list") {
123851
123859
  try {
123852
123860
  const scope = parts[1]?.toLowerCase() || "all";
123853
123861
  const secrets = await manager.list(scope);
@@ -124031,7 +124039,7 @@ Copy these to your shell or .env file.
124031
124039
  ## Secrets Commands
124032
124040
 
124033
124041
  `);
124034
- context.emit("text", `/secrets List all secrets (names only)
124042
+ context.emit("text", `/secrets Interactive secrets manager
124035
124043
  `);
124036
124044
  context.emit("text", `/secrets list [scope] List secrets, optionally filtered by scope
124037
124045
  `);
@@ -124660,7 +124668,11 @@ To enable:
124660
124668
  handler: async (args, context) => {
124661
124669
  const parts = splitArgs(args);
124662
124670
  const sub = parts[0] || "";
124663
- if (!sub || sub === "help") {
124671
+ if (!sub || sub === "ui") {
124672
+ context.emit("done");
124673
+ return { handled: true, showPanel: "tasks" };
124674
+ }
124675
+ if (sub === "help") {
124664
124676
  const tasks = await getTasks(context.cwd);
124665
124677
  const counts = await getTaskCounts(context.cwd);
124666
124678
  const paused = await isPaused(context.cwd);
@@ -124698,12 +124710,9 @@ To enable:
124698
124710
 
124699
124711
  `;
124700
124712
  }
124701
- output += `**Interactive Mode:**
124702
- `;
124703
- output += ` /tasks ui Open interactive task panel
124704
-
124705
- `;
124706
124713
  output += `**Commands:**
124714
+ `;
124715
+ output += ` /tasks Open interactive task panel
124707
124716
  `;
124708
124717
  output += ` /tasks list List all tasks
124709
124718
  `;
@@ -124735,10 +124744,6 @@ To enable:
124735
124744
  context.emit("done");
124736
124745
  return { handled: true };
124737
124746
  }
124738
- if (sub === "ui") {
124739
- context.emit("done");
124740
- return { handled: true, showPanel: "tasks" };
124741
- }
124742
124747
  if (sub === "list") {
124743
124748
  const tasks = await getTasks(context.cwd);
124744
124749
  if (tasks.length === 0) {
@@ -125236,7 +125241,11 @@ No context entries for project "${project.name}".
125236
125241
  handler: async (args, context) => {
125237
125242
  const parts = splitArgs(args);
125238
125243
  const sub = parts[0] || "";
125239
- if (!sub || sub === "help") {
125244
+ if (!sub || sub === "ui") {
125245
+ context.emit("done");
125246
+ return { handled: true, showPanel: "projects" };
125247
+ }
125248
+ if (sub === "help") {
125240
125249
  const projects = await listProjects(context.cwd);
125241
125250
  const activeId = context.getActiveProjectId?.();
125242
125251
  const activeProject = activeId ? projects.find((p) => p.id === activeId) : null;
@@ -125245,6 +125254,8 @@ No context entries for project "${project.name}".
125245
125254
 
125246
125255
  `;
125247
125256
  output += `**Commands:**
125257
+ `;
125258
+ output += ` /projects Interactive project manager
125248
125259
  `;
125249
125260
  output += ` /projects list List all projects
125250
125261
  `;
@@ -125449,13 +125460,19 @@ No projects found. Use /projects new <name>.
125449
125460
  handler: async (args, context) => {
125450
125461
  const parts = splitArgs(args);
125451
125462
  const sub = parts[0] || "";
125452
- if (!sub || sub === "help") {
125463
+ if (!sub || sub === "ui") {
125464
+ context.emit("done");
125465
+ return { handled: true, showPanel: "plans" };
125466
+ }
125467
+ if (sub === "help") {
125453
125468
  const project2 = await this.ensureActiveProject(context, false);
125454
125469
  let output = `
125455
125470
  \uD83D\uDCCB **Plans** - Manage plans for the active project
125456
125471
 
125457
125472
  `;
125458
125473
  output += `**Commands:**
125474
+ `;
125475
+ output += ` /plans Interactive plan manager
125459
125476
  `;
125460
125477
  output += ` /plans list List all plans
125461
125478
  `;
@@ -154110,6 +154127,29 @@ class EmbeddedClient {
154110
154127
  }
154111
154128
  return null;
154112
154129
  }
154130
+ getWalletManager() {
154131
+ if (typeof this.agent.getWalletManager === "function") {
154132
+ return this.agent.getWalletManager();
154133
+ }
154134
+ return null;
154135
+ }
154136
+ getSecretsManager() {
154137
+ if (typeof this.agent.getSecretsManager === "function") {
154138
+ return this.agent.getSecretsManager();
154139
+ }
154140
+ return null;
154141
+ }
154142
+ getActiveProjectId() {
154143
+ if (typeof this.agent.getActiveProjectId === "function") {
154144
+ return this.agent.getActiveProjectId();
154145
+ }
154146
+ return null;
154147
+ }
154148
+ setActiveProjectId(projectId) {
154149
+ if (typeof this.agent.setActiveProjectId === "function") {
154150
+ this.agent.setActiveProjectId(projectId);
154151
+ }
154152
+ }
154113
154153
  addSystemMessage(content) {
154114
154154
  if (typeof this.agent.addSystemMessage === "function") {
154115
154155
  this.agent.addSystemMessage(content);
@@ -154469,8 +154509,8 @@ init_src();
154469
154509
  import { render as render3 } from "ink";
154470
154510
 
154471
154511
  // src/components/App.tsx
154472
- import { useState as useState18, useEffect as useEffect12, useCallback as useCallback5, useRef as useRef2, useMemo as useMemo11 } from "react";
154473
- import { Box as Box23, Text as Text26, useApp, useInput as useInput15, useStdout as useStdout4, Static } from "ink";
154512
+ import { useState as useState22, useEffect as useEffect14, useCallback as useCallback5, useRef as useRef2, useMemo as useMemo13 } from "react";
154513
+ import { Box as Box27, Text as Text30, useApp, useInput as useInput19, useStdout as useStdout4, Static } from "ink";
154474
154514
  init_src2();
154475
154515
 
154476
154516
  // src/components/Input.tsx
@@ -166269,268 +166309,2154 @@ function SchedulesPanel({
166269
166309
  }, undefined, true, undefined, this);
166270
166310
  }
166271
166311
 
166272
- // src/components/App.tsx
166273
- import { jsxDEV as jsxDEV24, Fragment as Fragment7 } from "react/jsx-dev-runtime";
166274
- var SHOW_ERROR_CODES = process.env.ASSISTANTS_DEBUG === "1";
166275
- function formatElapsedDuration(ms2) {
166276
- const totalSeconds = Math.max(0, Math.floor(ms2 / 1000));
166277
- if (totalSeconds === 0)
166278
- return "<1s";
166279
- if (totalSeconds < 60)
166280
- return `${totalSeconds}s`;
166281
- const mins = Math.floor(totalSeconds / 60);
166282
- const secs = totalSeconds % 60;
166283
- return `${mins}m ${secs}s`;
166284
- }
166285
- function deepMerge(target, source) {
166286
- const output = { ...target };
166287
- for (const key of Object.keys(source)) {
166288
- const sourceValue = source[key];
166289
- const targetValue = target[key];
166290
- if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
166291
- output[key] = deepMerge(targetValue, sourceValue);
166292
- } else if (sourceValue !== undefined) {
166293
- output[key] = sourceValue;
166294
- }
166312
+ // src/components/ProjectsPanel.tsx
166313
+ import { useEffect as useEffect12, useState as useState18 } from "react";
166314
+ import { Box as Box23, Text as Text26, useInput as useInput15 } from "ink";
166315
+ import TextInput6 from "ink-text-input";
166316
+ import { jsxDEV as jsxDEV24 } from "react/jsx-dev-runtime";
166317
+ function formatProjectTime(timestamp) {
166318
+ const date = new Date(timestamp);
166319
+ const now2 = new Date;
166320
+ const isToday = date.toDateString() === now2.toDateString();
166321
+ if (isToday) {
166322
+ return date.toLocaleTimeString("en-US", {
166323
+ hour: "numeric",
166324
+ minute: "2-digit",
166325
+ hour12: true
166326
+ }).toLowerCase();
166295
166327
  }
166296
- return output;
166328
+ return date.toLocaleDateString("en-US", {
166329
+ month: "short",
166330
+ day: "numeric"
166331
+ }).toLowerCase();
166297
166332
  }
166298
- var MESSAGE_CHUNK_LINES = 12;
166299
- var MESSAGE_WRAP_CHARS = 120;
166300
- function App({ cwd, version: version3 }) {
166301
- const { exit } = useApp();
166302
- const { stdout } = useStdout4();
166303
- const rows = stdout?.rows ?? 24;
166304
- const columns = stdout?.columns ?? 80;
166305
- const [registry3] = useState18(() => new SessionRegistry);
166306
- const registryRef = useRef2(registry3);
166307
- const [activeSessionId, setActiveSessionId] = useState18(null);
166308
- const [isInitializing, setIsInitializing] = useState18(true);
166309
- const [showSessionSelector, setShowSessionSelector] = useState18(false);
166310
- const [recoverableSessions, setRecoverableSessions] = useState18([]);
166311
- const [showRecoveryPanel, setShowRecoveryPanel] = useState18(false);
166312
- const [showConnectorsPanel, setShowConnectorsPanel] = useState18(false);
166313
- const [connectorsPanelInitial, setConnectorsPanelInitial] = useState18();
166314
- const [connectors, setConnectors] = useState18([]);
166315
- const connectorBridgeRef = useRef2(null);
166316
- const [showTasksPanel, setShowTasksPanel] = useState18(false);
166317
- const [tasksList, setTasksList] = useState18([]);
166318
- const [tasksPaused, setTasksPaused] = useState18(false);
166319
- const [showSchedulesPanel, setShowSchedulesPanel] = useState18(false);
166320
- const [schedulesList, setSchedulesList] = useState18([]);
166321
- const [showAssistantsPanel, setShowAssistantsPanel] = useState18(false);
166322
- const [assistantsRefreshKey, setAssistantsRefreshKey] = useState18(0);
166323
- const [assistantError, setAssistantError] = useState18(null);
166324
- const [showHooksPanel, setShowHooksPanel] = useState18(false);
166325
- const [hooksConfig, setHooksConfig] = useState18({});
166326
- const hookStoreRef = useRef2(null);
166327
- const [showGuardrailsPanel, setShowGuardrailsPanel] = useState18(false);
166328
- const [guardrailsConfig, setGuardrailsConfig] = useState18(null);
166329
- const [guardrailsPolicies, setGuardrailsPolicies] = useState18([]);
166330
- const guardrailsStoreRef = useRef2(null);
166331
- const [showBudgetPanel, setShowBudgetPanel] = useState18(false);
166332
- const [budgetConfig, setBudgetConfig] = useState18(null);
166333
- const [sessionBudgetStatus, setSessionBudgetStatus] = useState18(null);
166334
- const [swarmBudgetStatus, setSwarmBudgetStatus] = useState18(null);
166335
- const budgetTrackerRef = useRef2(null);
166336
- const [showAgentsPanel, setShowAgentsPanel] = useState18(false);
166337
- const [agentsList, setAgentsList] = useState18([]);
166338
- const [registryStats, setRegistryStats] = useState18(null);
166339
- const [showConfigPanel, setShowConfigPanel] = useState18(false);
166340
- const [currentConfig, setCurrentConfig] = useState18(null);
166341
- const [userConfig, setUserConfig] = useState18(null);
166342
- const [projectConfig, setProjectConfig] = useState18(null);
166343
- const [localConfig, setLocalConfig] = useState18(null);
166344
- const [showMessagesPanel, setShowMessagesPanel] = useState18(false);
166345
- const [messagesPanelError, setMessagesPanelError] = useState18(null);
166346
- const [messagesList, setMessagesList] = useState18([]);
166347
- const sessionUIStates = useRef2(new Map);
166348
- const [messages2, setMessages] = useState18([]);
166349
- const [currentResponse, setCurrentResponse] = useState18("");
166350
- const [currentToolCall, setCurrentToolCall] = useState18();
166351
- const [isProcessing, setIsProcessing] = useState18(false);
166352
- const [error2, setError] = useState18(null);
166353
- const [messageQueue, setMessageQueue] = useState18([]);
166354
- const [inlinePending, setInlinePending] = useState18([]);
166355
- const [activityLog, setActivityLog] = useState18([]);
166356
- const [tokenUsage, setTokenUsage] = useState18();
166357
- const [energyState, setEnergyState] = useState18();
166358
- const [voiceState, setVoiceState] = useState18();
166359
- const [heartbeatState, setHeartbeatState] = useState18();
166360
- const [identityInfo, setIdentityInfo] = useState18();
166361
- const [verboseTools, setVerboseTools] = useState18(false);
166362
- const [askUserState, setAskUserState] = useState18(null);
166363
- const [processingStartTime, setProcessingStartTime] = useState18();
166364
- const [currentTurnTokens, setCurrentTurnTokens] = useState18(0);
166365
- const [lastWorkedFor, setLastWorkedFor] = useState18();
166366
- const [skills, setSkills] = useState18([]);
166367
- const [commands3, setCommands] = useState18([]);
166368
- const lastCtrlCRef = useRef2(0);
166369
- const [showExitHint, setShowExitHint] = useState18(false);
166370
- const responseRef = useRef2("");
166371
- const toolCallsRef = useRef2([]);
166372
- const toolResultsRef = useRef2([]);
166373
- const activityLogRef = useRef2([]);
166374
- const skipNextDoneRef = useRef2(false);
166375
- const isProcessingRef = useRef2(isProcessing);
166376
- const processingStartTimeRef = useRef2(processingStartTime);
166377
- const pendingSendsRef = useRef2([]);
166378
- const askUserStateRef = useRef2(new Map);
166379
- const [queueFlushTrigger, setQueueFlushTrigger] = useState18(0);
166380
- const clearPendingSend = useCallback5((id, sessionId) => {
166381
- pendingSendsRef.current = pendingSendsRef.current.filter((entry) => entry.id !== id || entry.sessionId !== sessionId);
166382
- setInlinePending((prev) => prev.filter((msg) => msg.id !== id));
166383
- }, []);
166384
- const beginAskUser = useCallback5((sessionId, request2) => {
166385
- return new Promise((resolve5, reject) => {
166386
- if (askUserStateRef.current.has(sessionId)) {
166387
- reject(new Error("Another interview is already in progress for this session."));
166333
+ function ProjectsPanel({
166334
+ projects: projects2,
166335
+ activeProjectId,
166336
+ onSelect,
166337
+ onCreate,
166338
+ onDelete,
166339
+ onViewPlans,
166340
+ onCancel
166341
+ }) {
166342
+ const [selectedIndex, setSelectedIndex] = useState18(0);
166343
+ const [mode, setMode] = useState18("list");
166344
+ const [newName, setNewName] = useState18("");
166345
+ const [newDescription, setNewDescription] = useState18("");
166346
+ const [createStep, setCreateStep] = useState18("name");
166347
+ const [isSubmitting, setIsSubmitting] = useState18(false);
166348
+ useEffect12(() => {
166349
+ setSelectedIndex((prev) => Math.min(prev, projects2.length));
166350
+ }, [projects2.length]);
166351
+ useInput15((input, key) => {
166352
+ if (mode === "create") {
166353
+ if (key.escape) {
166354
+ setMode("list");
166355
+ setNewName("");
166356
+ setNewDescription("");
166357
+ setCreateStep("name");
166388
166358
  return;
166389
166359
  }
166390
- const state = {
166391
- sessionId,
166392
- request: request2,
166393
- index: 0,
166394
- answers: {},
166395
- resolve: resolve5,
166396
- reject
166397
- };
166398
- askUserStateRef.current.set(sessionId, state);
166399
- if (sessionId === activeSessionId) {
166400
- setAskUserState(state);
166360
+ return;
166361
+ }
166362
+ if (mode === "delete-confirm") {
166363
+ if (input === "y" || input === "Y") {
166364
+ const project = projects2[selectedIndex];
166365
+ if (project) {
166366
+ setIsSubmitting(true);
166367
+ onDelete(project.id).finally(() => {
166368
+ setIsSubmitting(false);
166369
+ setMode("list");
166370
+ });
166371
+ }
166372
+ return;
166373
+ }
166374
+ if (input === "n" || input === "N" || key.escape) {
166375
+ setMode("list");
166376
+ return;
166401
166377
  }
166402
- });
166403
- }, [activeSessionId]);
166404
- const cancelAskUser = useCallback5((reason, sessionId) => {
166405
- const activeId = sessionId ?? activeSessionId;
166406
- if (!activeId)
166407
166378
  return;
166408
- const current = askUserStateRef.current.get(activeId);
166409
- if (!current)
166379
+ }
166380
+ if (input === "n" || input === "N") {
166381
+ setMode("create");
166382
+ setCreateStep("name");
166410
166383
  return;
166411
- askUserStateRef.current.delete(activeId);
166412
- if (activeId === activeSessionId) {
166413
- setAskUserState(null);
166414
166384
  }
166415
- current.reject(new Error(reason));
166416
- }, [activeSessionId]);
166417
- const submitAskAnswer = useCallback5((answer) => {
166418
- setAskUserState((prev) => {
166419
- if (!prev)
166420
- return prev;
166421
- const question = prev.request.questions[prev.index];
166422
- const answers = { ...prev.answers, [question.id]: answer };
166423
- const nextIndex = prev.index + 1;
166424
- if (nextIndex >= prev.request.questions.length) {
166425
- askUserStateRef.current.delete(prev.sessionId);
166426
- prev.resolve({ answers });
166427
- return null;
166385
+ if (input === "d" || input === "D") {
166386
+ if (projects2.length > 0 && selectedIndex < projects2.length) {
166387
+ setMode("delete-confirm");
166428
166388
  }
166429
- const nextState = {
166430
- ...prev,
166431
- index: nextIndex,
166432
- answers
166433
- };
166434
- askUserStateRef.current.set(prev.sessionId, nextState);
166435
- return nextState;
166436
- });
166437
- }, []);
166438
- const turnIdRef = useRef2(0);
166439
- const initStateRef = useRef2("idle");
166440
- const isMountedRef = useRef2(true);
166441
- const handlersRegisteredRef = useRef2(false);
166442
- useEffect12(() => {
166443
- isProcessingRef.current = isProcessing;
166444
- }, [isProcessing]);
166445
- useEffect12(() => {
166446
- processingStartTimeRef.current = processingStartTime;
166447
- }, [processingStartTime]);
166448
- useEffect12(() => {
166449
- if (isProcessing && !processingStartTime) {
166450
- const now2 = Date.now();
166451
- setProcessingStartTime(now2);
166452
- processingStartTimeRef.current = now2;
166389
+ return;
166453
166390
  }
166454
- }, [isProcessing, processingStartTime]);
166455
- const buildFullResponse = useCallback5(() => {
166456
- const parts = activityLogRef.current.filter((entry) => entry.type === "text" && entry.content).map((entry) => entry.content);
166457
- if (responseRef.current.trim()) {
166458
- parts.push(responseRef.current);
166391
+ if (input === "p" || input === "P") {
166392
+ if (projects2.length > 0 && selectedIndex < projects2.length) {
166393
+ onViewPlans(projects2[selectedIndex].id);
166394
+ }
166395
+ return;
166459
166396
  }
166460
- return parts.join(`
166461
- `).trim();
166462
- }, []);
166463
- const loadSessionMetadata = useCallback5(async (session) => {
166464
- try {
166465
- const [loadedSkills, loadedCommands] = await Promise.all([
166466
- session.client.getSkills(),
166467
- session.client.getCommands()
166468
- ]);
166469
- setSkills(loadedSkills.map((s6) => ({
166470
- name: s6.name,
166471
- description: s6.description || "",
166472
- argumentHint: s6.argumentHint
166473
- })));
166474
- setCommands(loadedCommands.map((cmd) => ({
166475
- name: cmd.name.startsWith("/") ? cmd.name : `/${cmd.name}`,
166476
- description: cmd.description || ""
166477
- })));
166478
- } catch (err) {
166479
- setError(err instanceof Error ? err.message : String(err));
166397
+ if (key.escape) {
166398
+ onCancel();
166399
+ return;
166480
166400
  }
166481
- }, []);
166482
- const finalizeResponse2 = useCallback5((status) => {
166483
- const baseContent = buildFullResponse();
166484
- const hasContent = baseContent.length > 0;
166485
- const activityToolCalls = activityLogRef.current.filter((entry) => entry.type === "tool_call" && entry.toolCall).map((entry) => entry.toolCall);
166486
- const activityToolResults = activityLogRef.current.filter((entry) => entry.type === "tool_result" && entry.toolResult).map((entry) => entry.toolResult);
166487
- const toolCallMap = new Map;
166488
- for (const toolCall of activityToolCalls) {
166489
- toolCallMap.set(toolCall.id, toolCall);
166401
+ if (key.return) {
166402
+ if (selectedIndex === projects2.length) {
166403
+ setMode("create");
166404
+ setCreateStep("name");
166405
+ } else {
166406
+ onSelect(projects2[selectedIndex].id);
166407
+ }
166408
+ return;
166490
166409
  }
166491
- for (const toolCall of toolCallsRef.current) {
166492
- toolCallMap.set(toolCall.id, toolCall);
166410
+ if (key.upArrow) {
166411
+ setSelectedIndex((prev) => prev === 0 ? projects2.length : prev - 1);
166412
+ return;
166493
166413
  }
166494
- const mergedToolCalls = Array.from(toolCallMap.values());
166495
- const toolResultMap = new Map;
166496
- for (const toolResult of activityToolResults) {
166497
- toolResultMap.set(toolResult.toolCallId, toolResult);
166414
+ if (key.downArrow) {
166415
+ setSelectedIndex((prev) => prev === projects2.length ? 0 : prev + 1);
166416
+ return;
166498
166417
  }
166499
- for (const toolResult of toolResultsRef.current) {
166500
- toolResultMap.set(toolResult.toolCallId, toolResult);
166418
+ const num = parseInt(input, 10);
166419
+ if (!isNaN(num) && num >= 1 && num <= projects2.length) {
166420
+ setSelectedIndex(num - 1);
166421
+ return;
166501
166422
  }
166502
- const mergedToolResults = Array.from(toolResultMap.values());
166503
- const hasTools = mergedToolCalls.length > 0;
166504
- if (!hasContent && !hasTools) {
166505
- return false;
166423
+ }, { isActive: mode === "list" || mode === "delete-confirm" });
166424
+ const handleNameSubmit = () => {
166425
+ if (!newName.trim())
166426
+ return;
166427
+ setCreateStep("description");
166428
+ };
166429
+ const handleDescriptionSubmit = async () => {
166430
+ if (!newName.trim())
166431
+ return;
166432
+ setIsSubmitting(true);
166433
+ try {
166434
+ await onCreate(newName.trim(), newDescription.trim() || undefined);
166435
+ setNewName("");
166436
+ setNewDescription("");
166437
+ setCreateStep("name");
166438
+ setMode("list");
166439
+ } finally {
166440
+ setIsSubmitting(false);
166506
166441
  }
166507
- let content = baseContent;
166508
- if (status === "stopped") {
166509
- content = content ? `${content}
166510
-
166511
- [stopped]` : "[stopped]";
166512
- } else if (status === "interrupted") {
166513
- content = content ? `${content}
166514
-
166515
- [interrupted]` : "[interrupted]";
166516
- } else if (status === "error") {
166517
- content = content ? `${content}
166518
-
166519
- [error]` : "[error]";
166442
+ };
166443
+ const handleSkipDescription = async () => {
166444
+ if (!newName.trim())
166445
+ return;
166446
+ setIsSubmitting(true);
166447
+ try {
166448
+ await onCreate(newName.trim());
166449
+ setNewName("");
166450
+ setNewDescription("");
166451
+ setCreateStep("name");
166452
+ setMode("list");
166453
+ } finally {
166454
+ setIsSubmitting(false);
166520
166455
  }
166521
- if (processingStartTimeRef.current) {
166522
- const workedFor = formatElapsedDuration(Date.now() - processingStartTimeRef.current);
166523
- setLastWorkedFor(workedFor);
166456
+ };
166457
+ if (mode === "create") {
166458
+ return /* @__PURE__ */ jsxDEV24(Box23, {
166459
+ flexDirection: "column",
166460
+ paddingY: 1,
166461
+ children: [
166462
+ /* @__PURE__ */ jsxDEV24(Box23, {
166463
+ marginBottom: 1,
166464
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166465
+ bold: true,
166466
+ color: "cyan",
166467
+ children: "Create New Project"
166468
+ }, undefined, false, undefined, this)
166469
+ }, undefined, false, undefined, this),
166470
+ createStep === "name" && /* @__PURE__ */ jsxDEV24(Box23, {
166471
+ flexDirection: "column",
166472
+ children: [
166473
+ /* @__PURE__ */ jsxDEV24(Box23, {
166474
+ children: [
166475
+ /* @__PURE__ */ jsxDEV24(Text26, {
166476
+ children: "Name: "
166477
+ }, undefined, false, undefined, this),
166478
+ /* @__PURE__ */ jsxDEV24(TextInput6, {
166479
+ value: newName,
166480
+ onChange: setNewName,
166481
+ onSubmit: handleNameSubmit,
166482
+ placeholder: "Enter project name..."
166483
+ }, undefined, false, undefined, this)
166484
+ ]
166485
+ }, undefined, true, undefined, this),
166486
+ /* @__PURE__ */ jsxDEV24(Box23, {
166487
+ marginTop: 1,
166488
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166489
+ dimColor: true,
166490
+ children: "Enter to continue | Esc to cancel"
166491
+ }, undefined, false, undefined, this)
166492
+ }, undefined, false, undefined, this)
166493
+ ]
166494
+ }, undefined, true, undefined, this),
166495
+ createStep === "description" && /* @__PURE__ */ jsxDEV24(Box23, {
166496
+ flexDirection: "column",
166497
+ children: [
166498
+ /* @__PURE__ */ jsxDEV24(Box23, {
166499
+ children: [
166500
+ /* @__PURE__ */ jsxDEV24(Text26, {
166501
+ dimColor: true,
166502
+ children: "Name: "
166503
+ }, undefined, false, undefined, this),
166504
+ /* @__PURE__ */ jsxDEV24(Text26, {
166505
+ children: newName
166506
+ }, undefined, false, undefined, this)
166507
+ ]
166508
+ }, undefined, true, undefined, this),
166509
+ /* @__PURE__ */ jsxDEV24(Box23, {
166510
+ marginTop: 1,
166511
+ children: [
166512
+ /* @__PURE__ */ jsxDEV24(Text26, {
166513
+ children: "Description: "
166514
+ }, undefined, false, undefined, this),
166515
+ /* @__PURE__ */ jsxDEV24(TextInput6, {
166516
+ value: newDescription,
166517
+ onChange: setNewDescription,
166518
+ onSubmit: handleDescriptionSubmit,
166519
+ placeholder: "Enter description (optional)..."
166520
+ }, undefined, false, undefined, this)
166521
+ ]
166522
+ }, undefined, true, undefined, this),
166523
+ /* @__PURE__ */ jsxDEV24(Box23, {
166524
+ marginTop: 1,
166525
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166526
+ dimColor: true,
166527
+ children: "Enter to create | Tab to skip | Esc to cancel"
166528
+ }, undefined, false, undefined, this)
166529
+ }, undefined, false, undefined, this)
166530
+ ]
166531
+ }, undefined, true, undefined, this),
166532
+ isSubmitting && /* @__PURE__ */ jsxDEV24(Box23, {
166533
+ marginTop: 1,
166534
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166535
+ color: "yellow",
166536
+ children: "Creating project..."
166537
+ }, undefined, false, undefined, this)
166538
+ }, undefined, false, undefined, this)
166539
+ ]
166540
+ }, undefined, true, undefined, this);
166541
+ }
166542
+ if (mode === "delete-confirm") {
166543
+ const project = projects2[selectedIndex];
166544
+ return /* @__PURE__ */ jsxDEV24(Box23, {
166545
+ flexDirection: "column",
166546
+ paddingY: 1,
166547
+ children: [
166548
+ /* @__PURE__ */ jsxDEV24(Box23, {
166549
+ marginBottom: 1,
166550
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166551
+ bold: true,
166552
+ color: "red",
166553
+ children: "Delete Project"
166554
+ }, undefined, false, undefined, this)
166555
+ }, undefined, false, undefined, this),
166556
+ /* @__PURE__ */ jsxDEV24(Box23, {
166557
+ marginBottom: 1,
166558
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166559
+ children: [
166560
+ 'Are you sure you want to delete "',
166561
+ project?.name,
166562
+ '"?'
166563
+ ]
166564
+ }, undefined, true, undefined, this)
166565
+ }, undefined, false, undefined, this),
166566
+ /* @__PURE__ */ jsxDEV24(Box23, {
166567
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166568
+ dimColor: true,
166569
+ children: "This will delete all plans in this project."
166570
+ }, undefined, false, undefined, this)
166571
+ }, undefined, false, undefined, this),
166572
+ /* @__PURE__ */ jsxDEV24(Box23, {
166573
+ marginTop: 1,
166574
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166575
+ children: [
166576
+ "Press ",
166577
+ /* @__PURE__ */ jsxDEV24(Text26, {
166578
+ color: "green",
166579
+ bold: true,
166580
+ children: "y"
166581
+ }, undefined, false, undefined, this),
166582
+ " to confirm or",
166583
+ " ",
166584
+ /* @__PURE__ */ jsxDEV24(Text26, {
166585
+ color: "red",
166586
+ bold: true,
166587
+ children: "n"
166588
+ }, undefined, false, undefined, this),
166589
+ " to cancel"
166590
+ ]
166591
+ }, undefined, true, undefined, this)
166592
+ }, undefined, false, undefined, this)
166593
+ ]
166594
+ }, undefined, true, undefined, this);
166595
+ }
166596
+ return /* @__PURE__ */ jsxDEV24(Box23, {
166597
+ flexDirection: "column",
166598
+ paddingY: 1,
166599
+ children: [
166600
+ /* @__PURE__ */ jsxDEV24(Box23, {
166601
+ marginBottom: 1,
166602
+ justifyContent: "space-between",
166603
+ children: [
166604
+ /* @__PURE__ */ jsxDEV24(Text26, {
166605
+ bold: true,
166606
+ children: "Projects"
166607
+ }, undefined, false, undefined, this),
166608
+ /* @__PURE__ */ jsxDEV24(Text26, {
166609
+ dimColor: true,
166610
+ children: "[n]ew"
166611
+ }, undefined, false, undefined, this)
166612
+ ]
166613
+ }, undefined, true, undefined, this),
166614
+ /* @__PURE__ */ jsxDEV24(Box23, {
166615
+ flexDirection: "column",
166616
+ borderStyle: "round",
166617
+ borderColor: "gray",
166618
+ paddingX: 1,
166619
+ children: [
166620
+ projects2.length === 0 ? /* @__PURE__ */ jsxDEV24(Box23, {
166621
+ paddingY: 1,
166622
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166623
+ dimColor: true,
166624
+ children: "No projects yet. Press n to create one."
166625
+ }, undefined, false, undefined, this)
166626
+ }, undefined, false, undefined, this) : projects2.map((project, index) => {
166627
+ const isActive = project.id === activeProjectId;
166628
+ const isSelected = index === selectedIndex;
166629
+ const planCount = project.plans.length;
166630
+ const contextCount = project.context.length;
166631
+ const time = formatProjectTime(project.updatedAt);
166632
+ return /* @__PURE__ */ jsxDEV24(Box23, {
166633
+ paddingY: 0,
166634
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166635
+ inverse: isSelected,
166636
+ color: isActive ? "green" : undefined,
166637
+ dimColor: !isSelected && !isActive,
166638
+ children: [
166639
+ isActive ? "*" : " ",
166640
+ " ",
166641
+ index + 1,
166642
+ ". ",
166643
+ project.name.padEnd(20),
166644
+ " ",
166645
+ planCount,
166646
+ " plan",
166647
+ planCount !== 1 ? "s" : "",
166648
+ " ",
166649
+ contextCount > 0 ? `${contextCount} ctx` : "",
166650
+ " ",
166651
+ time
166652
+ ]
166653
+ }, undefined, true, undefined, this)
166654
+ }, project.id, false, undefined, this);
166655
+ }),
166656
+ /* @__PURE__ */ jsxDEV24(Box23, {
166657
+ marginTop: 1,
166658
+ paddingY: 0,
166659
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166660
+ inverse: selectedIndex === projects2.length,
166661
+ dimColor: selectedIndex !== projects2.length,
166662
+ color: selectedIndex === projects2.length ? "cyan" : undefined,
166663
+ children: "+ New project (n)"
166664
+ }, undefined, false, undefined, this)
166665
+ }, undefined, false, undefined, this)
166666
+ ]
166667
+ }, undefined, true, undefined, this),
166668
+ projects2.length > 0 && selectedIndex < projects2.length && /* @__PURE__ */ jsxDEV24(Box23, {
166669
+ marginTop: 1,
166670
+ flexDirection: "column",
166671
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166672
+ dimColor: true,
166673
+ children: projects2[selectedIndex].description || "No description"
166674
+ }, undefined, false, undefined, this)
166675
+ }, undefined, false, undefined, this),
166676
+ /* @__PURE__ */ jsxDEV24(Box23, {
166677
+ marginTop: 1,
166678
+ children: /* @__PURE__ */ jsxDEV24(Text26, {
166679
+ dimColor: true,
166680
+ children: [
166681
+ "Enter select | p plans | d delete | Esc close | 1-",
166682
+ Math.max(1, projects2.length),
166683
+ " jump"
166684
+ ]
166685
+ }, undefined, true, undefined, this)
166686
+ }, undefined, false, undefined, this)
166687
+ ]
166688
+ }, undefined, true, undefined, this);
166689
+ }
166690
+
166691
+ // src/components/PlansPanel.tsx
166692
+ import { useEffect as useEffect13, useState as useState19 } from "react";
166693
+ import { Box as Box24, Text as Text27, useInput as useInput16 } from "ink";
166694
+ import TextInput7 from "ink-text-input";
166695
+ import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
166696
+ var STATUS_ICONS3 = {
166697
+ todo: " ",
166698
+ doing: "~",
166699
+ done: "*",
166700
+ blocked: "!"
166701
+ };
166702
+ var STATUS_COLORS3 = {
166703
+ todo: undefined,
166704
+ doing: "yellow",
166705
+ done: "green",
166706
+ blocked: "red"
166707
+ };
166708
+ var STATUS_CYCLE = ["todo", "doing", "done", "blocked"];
166709
+ function getNextStatus(current) {
166710
+ const index = STATUS_CYCLE.indexOf(current);
166711
+ return STATUS_CYCLE[(index + 1) % STATUS_CYCLE.length];
166712
+ }
166713
+ function formatPlanTime(timestamp) {
166714
+ const date = new Date(timestamp);
166715
+ const now2 = new Date;
166716
+ const isToday = date.toDateString() === now2.toDateString();
166717
+ if (isToday) {
166718
+ return date.toLocaleTimeString("en-US", {
166719
+ hour: "numeric",
166720
+ minute: "2-digit",
166721
+ hour12: true
166722
+ }).toLowerCase();
166723
+ }
166724
+ return date.toLocaleDateString("en-US", {
166725
+ month: "short",
166726
+ day: "numeric"
166727
+ }).toLowerCase();
166728
+ }
166729
+ function PlansPanel({
166730
+ project,
166731
+ onCreatePlan,
166732
+ onDeletePlan,
166733
+ onAddStep,
166734
+ onUpdateStep,
166735
+ onRemoveStep,
166736
+ onBack,
166737
+ onClose
166738
+ }) {
166739
+ const [planIndex, setPlanIndex] = useState19(0);
166740
+ const [stepIndex, setStepIndex] = useState19(0);
166741
+ const [mode, setMode] = useState19("plans");
166742
+ const [newPlanTitle, setNewPlanTitle] = useState19("");
166743
+ const [newStepText, setNewStepText] = useState19("");
166744
+ const [isSubmitting, setIsSubmitting] = useState19(false);
166745
+ const plans = project.plans;
166746
+ const currentPlan = plans[planIndex];
166747
+ const currentSteps = currentPlan?.steps || [];
166748
+ useEffect13(() => {
166749
+ setPlanIndex((prev) => Math.min(prev, Math.max(0, plans.length - 1)));
166750
+ }, [plans.length]);
166751
+ useEffect13(() => {
166752
+ setStepIndex((prev) => Math.min(prev, Math.max(0, currentSteps.length)));
166753
+ }, [currentSteps.length]);
166754
+ useInput16((input, key) => {
166755
+ if (mode === "create-plan" || mode === "add-step") {
166756
+ if (key.escape) {
166757
+ setMode(mode === "add-step" ? "steps" : "plans");
166758
+ setNewPlanTitle("");
166759
+ setNewStepText("");
166760
+ }
166761
+ return;
166524
166762
  }
166525
- setMessages((prev) => [
166526
- ...prev,
166527
- {
166528
- id: generateId(),
166529
- role: "assistant",
166530
- content,
166531
- timestamp: now(),
166532
- toolCalls: hasTools ? mergedToolCalls : undefined,
166533
- toolResults: mergedToolResults.length > 0 ? mergedToolResults : undefined
166763
+ if (mode === "delete-plan-confirm") {
166764
+ if (input === "y" || input === "Y") {
166765
+ if (currentPlan) {
166766
+ setIsSubmitting(true);
166767
+ onDeletePlan(currentPlan.id).finally(() => {
166768
+ setIsSubmitting(false);
166769
+ setMode("plans");
166770
+ });
166771
+ }
166772
+ return;
166773
+ }
166774
+ if (input === "n" || input === "N" || key.escape) {
166775
+ setMode("plans");
166776
+ return;
166777
+ }
166778
+ return;
166779
+ }
166780
+ if (mode === "delete-step-confirm") {
166781
+ if (input === "y" || input === "Y") {
166782
+ const step = currentSteps[stepIndex];
166783
+ if (currentPlan && step) {
166784
+ setIsSubmitting(true);
166785
+ onRemoveStep(currentPlan.id, step.id).finally(() => {
166786
+ setIsSubmitting(false);
166787
+ setMode("steps");
166788
+ });
166789
+ }
166790
+ return;
166791
+ }
166792
+ if (input === "n" || input === "N" || key.escape) {
166793
+ setMode("steps");
166794
+ return;
166795
+ }
166796
+ return;
166797
+ }
166798
+ if (mode === "plans") {
166799
+ if (input === "n" || input === "N") {
166800
+ setMode("create-plan");
166801
+ return;
166802
+ }
166803
+ if (input === "d" || input === "D") {
166804
+ if (plans.length > 0) {
166805
+ setMode("delete-plan-confirm");
166806
+ }
166807
+ return;
166808
+ }
166809
+ if (key.escape) {
166810
+ onBack();
166811
+ return;
166812
+ }
166813
+ if (key.return) {
166814
+ if (planIndex === plans.length) {
166815
+ setMode("create-plan");
166816
+ } else if (currentPlan) {
166817
+ setMode("steps");
166818
+ setStepIndex(0);
166819
+ }
166820
+ return;
166821
+ }
166822
+ if (key.upArrow) {
166823
+ setPlanIndex((prev) => prev === 0 ? plans.length : prev - 1);
166824
+ return;
166825
+ }
166826
+ if (key.downArrow) {
166827
+ setPlanIndex((prev) => prev === plans.length ? 0 : prev + 1);
166828
+ return;
166829
+ }
166830
+ const num = parseInt(input, 10);
166831
+ if (!isNaN(num) && num >= 1 && num <= plans.length) {
166832
+ setPlanIndex(num - 1);
166833
+ return;
166834
+ }
166835
+ }
166836
+ if (mode === "steps") {
166837
+ if (input === "a" || input === "A") {
166838
+ setMode("add-step");
166839
+ return;
166840
+ }
166841
+ if (input === "d" || input === "D") {
166842
+ if (currentSteps.length > 0 && stepIndex < currentSteps.length) {
166843
+ setMode("delete-step-confirm");
166844
+ }
166845
+ return;
166846
+ }
166847
+ if ((input === " " || key.return) && stepIndex < currentSteps.length) {
166848
+ const step = currentSteps[stepIndex];
166849
+ if (currentPlan && step) {
166850
+ const nextStatus = getNextStatus(step.status);
166851
+ onUpdateStep(currentPlan.id, step.id, nextStatus);
166852
+ }
166853
+ return;
166854
+ }
166855
+ if (key.escape) {
166856
+ setMode("plans");
166857
+ return;
166858
+ }
166859
+ if (key.upArrow) {
166860
+ setStepIndex((prev) => prev === 0 ? currentSteps.length : prev - 1);
166861
+ return;
166862
+ }
166863
+ if (key.downArrow) {
166864
+ setStepIndex((prev) => prev === currentSteps.length ? 0 : prev + 1);
166865
+ return;
166866
+ }
166867
+ const num = parseInt(input, 10);
166868
+ if (!isNaN(num) && num >= 1 && num <= currentSteps.length) {
166869
+ setStepIndex(num - 1);
166870
+ return;
166871
+ }
166872
+ }
166873
+ }, { isActive: mode !== "create-plan" && mode !== "add-step" });
166874
+ const handleCreatePlan = async () => {
166875
+ if (!newPlanTitle.trim())
166876
+ return;
166877
+ setIsSubmitting(true);
166878
+ try {
166879
+ await onCreatePlan(newPlanTitle.trim());
166880
+ setNewPlanTitle("");
166881
+ setMode("plans");
166882
+ } finally {
166883
+ setIsSubmitting(false);
166884
+ }
166885
+ };
166886
+ const handleAddStep = async () => {
166887
+ if (!newStepText.trim() || !currentPlan)
166888
+ return;
166889
+ setIsSubmitting(true);
166890
+ try {
166891
+ await onAddStep(currentPlan.id, newStepText.trim());
166892
+ setNewStepText("");
166893
+ setMode("steps");
166894
+ } finally {
166895
+ setIsSubmitting(false);
166896
+ }
166897
+ };
166898
+ if (mode === "create-plan") {
166899
+ return /* @__PURE__ */ jsxDEV25(Box24, {
166900
+ flexDirection: "column",
166901
+ paddingY: 1,
166902
+ children: [
166903
+ /* @__PURE__ */ jsxDEV25(Box24, {
166904
+ marginBottom: 1,
166905
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166906
+ bold: true,
166907
+ color: "cyan",
166908
+ children: "Create New Plan"
166909
+ }, undefined, false, undefined, this)
166910
+ }, undefined, false, undefined, this),
166911
+ /* @__PURE__ */ jsxDEV25(Box24, {
166912
+ children: [
166913
+ /* @__PURE__ */ jsxDEV25(Text27, {
166914
+ children: "Title: "
166915
+ }, undefined, false, undefined, this),
166916
+ /* @__PURE__ */ jsxDEV25(TextInput7, {
166917
+ value: newPlanTitle,
166918
+ onChange: setNewPlanTitle,
166919
+ onSubmit: handleCreatePlan,
166920
+ placeholder: "Enter plan title..."
166921
+ }, undefined, false, undefined, this)
166922
+ ]
166923
+ }, undefined, true, undefined, this),
166924
+ isSubmitting && /* @__PURE__ */ jsxDEV25(Box24, {
166925
+ marginTop: 1,
166926
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166927
+ color: "yellow",
166928
+ children: "Creating plan..."
166929
+ }, undefined, false, undefined, this)
166930
+ }, undefined, false, undefined, this),
166931
+ /* @__PURE__ */ jsxDEV25(Box24, {
166932
+ marginTop: 1,
166933
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166934
+ dimColor: true,
166935
+ children: "Enter to create | Esc to cancel"
166936
+ }, undefined, false, undefined, this)
166937
+ }, undefined, false, undefined, this)
166938
+ ]
166939
+ }, undefined, true, undefined, this);
166940
+ }
166941
+ if (mode === "delete-plan-confirm") {
166942
+ return /* @__PURE__ */ jsxDEV25(Box24, {
166943
+ flexDirection: "column",
166944
+ paddingY: 1,
166945
+ children: [
166946
+ /* @__PURE__ */ jsxDEV25(Box24, {
166947
+ marginBottom: 1,
166948
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166949
+ bold: true,
166950
+ color: "red",
166951
+ children: "Delete Plan"
166952
+ }, undefined, false, undefined, this)
166953
+ }, undefined, false, undefined, this),
166954
+ /* @__PURE__ */ jsxDEV25(Box24, {
166955
+ marginBottom: 1,
166956
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166957
+ children: [
166958
+ 'Are you sure you want to delete "',
166959
+ currentPlan?.title,
166960
+ '"?'
166961
+ ]
166962
+ }, undefined, true, undefined, this)
166963
+ }, undefined, false, undefined, this),
166964
+ /* @__PURE__ */ jsxDEV25(Box24, {
166965
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166966
+ dimColor: true,
166967
+ children: [
166968
+ "This will delete all ",
166969
+ currentSteps.length,
166970
+ " steps."
166971
+ ]
166972
+ }, undefined, true, undefined, this)
166973
+ }, undefined, false, undefined, this),
166974
+ /* @__PURE__ */ jsxDEV25(Box24, {
166975
+ marginTop: 1,
166976
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
166977
+ children: [
166978
+ "Press ",
166979
+ /* @__PURE__ */ jsxDEV25(Text27, {
166980
+ color: "green",
166981
+ bold: true,
166982
+ children: "y"
166983
+ }, undefined, false, undefined, this),
166984
+ " to confirm or",
166985
+ " ",
166986
+ /* @__PURE__ */ jsxDEV25(Text27, {
166987
+ color: "red",
166988
+ bold: true,
166989
+ children: "n"
166990
+ }, undefined, false, undefined, this),
166991
+ " to cancel"
166992
+ ]
166993
+ }, undefined, true, undefined, this)
166994
+ }, undefined, false, undefined, this)
166995
+ ]
166996
+ }, undefined, true, undefined, this);
166997
+ }
166998
+ if (mode === "add-step") {
166999
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167000
+ flexDirection: "column",
167001
+ paddingY: 1,
167002
+ children: [
167003
+ /* @__PURE__ */ jsxDEV25(Box24, {
167004
+ marginBottom: 1,
167005
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167006
+ bold: true,
167007
+ color: "cyan",
167008
+ children: [
167009
+ 'Add Step to "',
167010
+ currentPlan?.title,
167011
+ '"'
167012
+ ]
167013
+ }, undefined, true, undefined, this)
167014
+ }, undefined, false, undefined, this),
167015
+ /* @__PURE__ */ jsxDEV25(Box24, {
167016
+ children: [
167017
+ /* @__PURE__ */ jsxDEV25(Text27, {
167018
+ children: "Step: "
167019
+ }, undefined, false, undefined, this),
167020
+ /* @__PURE__ */ jsxDEV25(TextInput7, {
167021
+ value: newStepText,
167022
+ onChange: setNewStepText,
167023
+ onSubmit: handleAddStep,
167024
+ placeholder: "Enter step description..."
167025
+ }, undefined, false, undefined, this)
167026
+ ]
167027
+ }, undefined, true, undefined, this),
167028
+ isSubmitting && /* @__PURE__ */ jsxDEV25(Box24, {
167029
+ marginTop: 1,
167030
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167031
+ color: "yellow",
167032
+ children: "Adding step..."
167033
+ }, undefined, false, undefined, this)
167034
+ }, undefined, false, undefined, this),
167035
+ /* @__PURE__ */ jsxDEV25(Box24, {
167036
+ marginTop: 1,
167037
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167038
+ dimColor: true,
167039
+ children: "Enter to add | Esc to cancel"
167040
+ }, undefined, false, undefined, this)
167041
+ }, undefined, false, undefined, this)
167042
+ ]
167043
+ }, undefined, true, undefined, this);
167044
+ }
167045
+ if (mode === "delete-step-confirm") {
167046
+ const step = currentSteps[stepIndex];
167047
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167048
+ flexDirection: "column",
167049
+ paddingY: 1,
167050
+ children: [
167051
+ /* @__PURE__ */ jsxDEV25(Box24, {
167052
+ marginBottom: 1,
167053
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167054
+ bold: true,
167055
+ color: "red",
167056
+ children: "Delete Step"
167057
+ }, undefined, false, undefined, this)
167058
+ }, undefined, false, undefined, this),
167059
+ /* @__PURE__ */ jsxDEV25(Box24, {
167060
+ marginBottom: 1,
167061
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167062
+ children: [
167063
+ 'Remove: "',
167064
+ step?.text,
167065
+ '"?'
167066
+ ]
167067
+ }, undefined, true, undefined, this)
167068
+ }, undefined, false, undefined, this),
167069
+ /* @__PURE__ */ jsxDEV25(Box24, {
167070
+ marginTop: 1,
167071
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167072
+ children: [
167073
+ "Press ",
167074
+ /* @__PURE__ */ jsxDEV25(Text27, {
167075
+ color: "green",
167076
+ bold: true,
167077
+ children: "y"
167078
+ }, undefined, false, undefined, this),
167079
+ " to confirm or",
167080
+ " ",
167081
+ /* @__PURE__ */ jsxDEV25(Text27, {
167082
+ color: "red",
167083
+ bold: true,
167084
+ children: "n"
167085
+ }, undefined, false, undefined, this),
167086
+ " to cancel"
167087
+ ]
167088
+ }, undefined, true, undefined, this)
167089
+ }, undefined, false, undefined, this)
167090
+ ]
167091
+ }, undefined, true, undefined, this);
167092
+ }
167093
+ if (mode === "steps" && currentPlan) {
167094
+ const doneCount = currentSteps.filter((s6) => s6.status === "done").length;
167095
+ const totalCount = currentSteps.length;
167096
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167097
+ flexDirection: "column",
167098
+ paddingY: 1,
167099
+ children: [
167100
+ /* @__PURE__ */ jsxDEV25(Box24, {
167101
+ marginBottom: 1,
167102
+ justifyContent: "space-between",
167103
+ children: [
167104
+ /* @__PURE__ */ jsxDEV25(Text27, {
167105
+ bold: true,
167106
+ children: currentPlan.title
167107
+ }, undefined, false, undefined, this),
167108
+ /* @__PURE__ */ jsxDEV25(Text27, {
167109
+ dimColor: true,
167110
+ children: "[a]dd [d]elete"
167111
+ }, undefined, false, undefined, this)
167112
+ ]
167113
+ }, undefined, true, undefined, this),
167114
+ /* @__PURE__ */ jsxDEV25(Box24, {
167115
+ flexDirection: "column",
167116
+ borderStyle: "round",
167117
+ borderColor: "gray",
167118
+ paddingX: 1,
167119
+ children: [
167120
+ currentSteps.length === 0 ? /* @__PURE__ */ jsxDEV25(Box24, {
167121
+ paddingY: 1,
167122
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167123
+ dimColor: true,
167124
+ children: "No steps yet. Press a to add one."
167125
+ }, undefined, false, undefined, this)
167126
+ }, undefined, false, undefined, this) : currentSteps.map((step, index) => {
167127
+ const isSelected = index === stepIndex;
167128
+ const icon = STATUS_ICONS3[step.status];
167129
+ const color = STATUS_COLORS3[step.status];
167130
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167131
+ paddingY: 0,
167132
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167133
+ inverse: isSelected,
167134
+ color,
167135
+ dimColor: !isSelected && step.status === "done",
167136
+ children: [
167137
+ "[",
167138
+ icon,
167139
+ "] ",
167140
+ index + 1,
167141
+ ". ",
167142
+ step.text
167143
+ ]
167144
+ }, undefined, true, undefined, this)
167145
+ }, step.id, false, undefined, this);
167146
+ }),
167147
+ /* @__PURE__ */ jsxDEV25(Box24, {
167148
+ marginTop: 1,
167149
+ paddingY: 0,
167150
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167151
+ inverse: stepIndex === currentSteps.length,
167152
+ dimColor: stepIndex !== currentSteps.length,
167153
+ color: stepIndex === currentSteps.length ? "cyan" : undefined,
167154
+ children: "+ Add step (a)"
167155
+ }, undefined, false, undefined, this)
167156
+ }, undefined, false, undefined, this)
167157
+ ]
167158
+ }, undefined, true, undefined, this),
167159
+ /* @__PURE__ */ jsxDEV25(Box24, {
167160
+ marginTop: 1,
167161
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167162
+ dimColor: true,
167163
+ children: [
167164
+ "Progress: ",
167165
+ doneCount,
167166
+ "/",
167167
+ totalCount,
167168
+ " (",
167169
+ totalCount > 0 ? Math.round(doneCount / totalCount * 100) : 0,
167170
+ "%)"
167171
+ ]
167172
+ }, undefined, true, undefined, this)
167173
+ }, undefined, false, undefined, this),
167174
+ /* @__PURE__ */ jsxDEV25(Box24, {
167175
+ marginTop: 1,
167176
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167177
+ dimColor: true,
167178
+ children: [
167179
+ "Space/Enter toggle | Esc back | 1-",
167180
+ Math.max(1, currentSteps.length),
167181
+ " jump"
167182
+ ]
167183
+ }, undefined, true, undefined, this)
167184
+ }, undefined, false, undefined, this)
167185
+ ]
167186
+ }, undefined, true, undefined, this);
167187
+ }
167188
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167189
+ flexDirection: "column",
167190
+ paddingY: 1,
167191
+ children: [
167192
+ /* @__PURE__ */ jsxDEV25(Box24, {
167193
+ marginBottom: 1,
167194
+ justifyContent: "space-between",
167195
+ children: [
167196
+ /* @__PURE__ */ jsxDEV25(Text27, {
167197
+ bold: true,
167198
+ children: [
167199
+ 'Plans for "',
167200
+ project.name,
167201
+ '"'
167202
+ ]
167203
+ }, undefined, true, undefined, this),
167204
+ /* @__PURE__ */ jsxDEV25(Text27, {
167205
+ dimColor: true,
167206
+ children: "[n]ew"
167207
+ }, undefined, false, undefined, this)
167208
+ ]
167209
+ }, undefined, true, undefined, this),
167210
+ /* @__PURE__ */ jsxDEV25(Box24, {
167211
+ flexDirection: "column",
167212
+ borderStyle: "round",
167213
+ borderColor: "gray",
167214
+ paddingX: 1,
167215
+ children: [
167216
+ plans.length === 0 ? /* @__PURE__ */ jsxDEV25(Box24, {
167217
+ paddingY: 1,
167218
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167219
+ dimColor: true,
167220
+ children: "No plans yet. Press n to create one."
167221
+ }, undefined, false, undefined, this)
167222
+ }, undefined, false, undefined, this) : plans.map((plan, index) => {
167223
+ const isSelected = index === planIndex;
167224
+ const doneCount = plan.steps.filter((s6) => s6.status === "done").length;
167225
+ const totalCount = plan.steps.length;
167226
+ const time = formatPlanTime(plan.updatedAt);
167227
+ return /* @__PURE__ */ jsxDEV25(Box24, {
167228
+ paddingY: 0,
167229
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167230
+ inverse: isSelected,
167231
+ dimColor: !isSelected,
167232
+ children: [
167233
+ index + 1,
167234
+ ". ",
167235
+ plan.title.padEnd(25),
167236
+ " [",
167237
+ doneCount,
167238
+ "/",
167239
+ totalCount,
167240
+ "] ",
167241
+ time
167242
+ ]
167243
+ }, undefined, true, undefined, this)
167244
+ }, plan.id, false, undefined, this);
167245
+ }),
167246
+ /* @__PURE__ */ jsxDEV25(Box24, {
167247
+ marginTop: 1,
167248
+ paddingY: 0,
167249
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167250
+ inverse: planIndex === plans.length,
167251
+ dimColor: planIndex !== plans.length,
167252
+ color: planIndex === plans.length ? "cyan" : undefined,
167253
+ children: "+ New plan (n)"
167254
+ }, undefined, false, undefined, this)
167255
+ }, undefined, false, undefined, this)
167256
+ ]
167257
+ }, undefined, true, undefined, this),
167258
+ /* @__PURE__ */ jsxDEV25(Box24, {
167259
+ marginTop: 1,
167260
+ children: /* @__PURE__ */ jsxDEV25(Text27, {
167261
+ dimColor: true,
167262
+ children: [
167263
+ "Enter view | d delete | Esc back | 1-",
167264
+ Math.max(1, plans.length),
167265
+ " jump"
167266
+ ]
167267
+ }, undefined, true, undefined, this)
167268
+ }, undefined, false, undefined, this)
167269
+ ]
167270
+ }, undefined, true, undefined, this);
167271
+ }
167272
+
167273
+ // src/components/WalletPanel.tsx
167274
+ import { useState as useState20, useMemo as useMemo11 } from "react";
167275
+ import { Box as Box25, Text as Text28, useInput as useInput17 } from "ink";
167276
+ import { jsxDEV as jsxDEV26 } from "react/jsx-dev-runtime";
167277
+ var MAX_VISIBLE_ITEMS3 = 5;
167278
+ function getVisibleRange3(selectedIndex, totalItems, maxVisible = MAX_VISIBLE_ITEMS3) {
167279
+ if (totalItems <= maxVisible) {
167280
+ return {
167281
+ start: 0,
167282
+ end: totalItems,
167283
+ hasMore: { above: 0, below: 0 }
167284
+ };
167285
+ }
167286
+ const halfWindow = Math.floor(maxVisible / 2);
167287
+ let start = selectedIndex - halfWindow;
167288
+ let end = selectedIndex + (maxVisible - halfWindow);
167289
+ if (start < 0) {
167290
+ start = 0;
167291
+ end = maxVisible;
167292
+ }
167293
+ if (end > totalItems) {
167294
+ end = totalItems;
167295
+ start = Math.max(0, totalItems - maxVisible);
167296
+ }
167297
+ return {
167298
+ start,
167299
+ end,
167300
+ hasMore: {
167301
+ above: start,
167302
+ below: totalItems - end
167303
+ }
167304
+ };
167305
+ }
167306
+ function formatExpiry(month, year) {
167307
+ if (!month || !year)
167308
+ return "N/A";
167309
+ return `${month.toString().padStart(2, "0")}/${year.toString().slice(-2)}`;
167310
+ }
167311
+ function WalletPanel({
167312
+ cards,
167313
+ onGet,
167314
+ onRemove,
167315
+ onClose,
167316
+ error: error2
167317
+ }) {
167318
+ const [mode, setMode] = useState20("list");
167319
+ const [cardIndex, setCardIndex] = useState20(0);
167320
+ const [deleteTarget, setDeleteTarget] = useState20(null);
167321
+ const [isProcessing, setIsProcessing] = useState20(false);
167322
+ const [detailCard, setDetailCard] = useState20(null);
167323
+ const cardRange = useMemo11(() => getVisibleRange3(cardIndex, cards.length), [cardIndex, cards.length]);
167324
+ const currentCard = cards[cardIndex];
167325
+ const handleViewDetails = async () => {
167326
+ if (!currentCard)
167327
+ return;
167328
+ setIsProcessing(true);
167329
+ try {
167330
+ const details = await onGet(currentCard.id);
167331
+ setDetailCard(details);
167332
+ setMode("detail");
167333
+ } finally {
167334
+ setIsProcessing(false);
167335
+ }
167336
+ };
167337
+ const handleDelete = async () => {
167338
+ if (!deleteTarget)
167339
+ return;
167340
+ setIsProcessing(true);
167341
+ try {
167342
+ await onRemove(deleteTarget.id);
167343
+ setMode("list");
167344
+ setDeleteTarget(null);
167345
+ setDetailCard(null);
167346
+ if (cardIndex >= cards.length - 1 && cardIndex > 0) {
167347
+ setCardIndex(cardIndex - 1);
167348
+ }
167349
+ } finally {
167350
+ setIsProcessing(false);
167351
+ }
167352
+ };
167353
+ useInput17((input, key) => {
167354
+ if (isProcessing)
167355
+ return;
167356
+ if (input === "q" || key.escape && mode === "list") {
167357
+ onClose();
167358
+ return;
167359
+ }
167360
+ if (key.escape) {
167361
+ if (mode === "detail") {
167362
+ setMode("list");
167363
+ setDetailCard(null);
167364
+ } else if (mode === "delete-confirm") {
167365
+ setMode("detail");
167366
+ setDeleteTarget(null);
167367
+ }
167368
+ return;
167369
+ }
167370
+ if (mode === "list") {
167371
+ if (key.upArrow) {
167372
+ setCardIndex((prev) => prev === 0 ? cards.length - 1 : prev - 1);
167373
+ return;
167374
+ }
167375
+ if (key.downArrow) {
167376
+ setCardIndex((prev) => prev === cards.length - 1 ? 0 : prev + 1);
167377
+ return;
167378
+ }
167379
+ if (key.return && currentCard) {
167380
+ handleViewDetails();
167381
+ return;
167382
+ }
167383
+ const num = parseInt(input, 10);
167384
+ if (!isNaN(num) && num >= 1 && num <= cards.length) {
167385
+ setCardIndex(num - 1);
167386
+ }
167387
+ return;
167388
+ }
167389
+ if (mode === "detail") {
167390
+ if (input === "x" || key.delete) {
167391
+ if (detailCard) {
167392
+ setDeleteTarget(detailCard);
167393
+ setMode("delete-confirm");
167394
+ }
167395
+ return;
167396
+ }
167397
+ return;
167398
+ }
167399
+ if (mode === "delete-confirm") {
167400
+ if (input === "y") {
167401
+ handleDelete();
167402
+ return;
167403
+ }
167404
+ if (input === "n") {
167405
+ setMode("detail");
167406
+ setDeleteTarget(null);
167407
+ return;
167408
+ }
167409
+ }
167410
+ });
167411
+ if (cards.length === 0) {
167412
+ return /* @__PURE__ */ jsxDEV26(Box25, {
167413
+ flexDirection: "column",
167414
+ paddingY: 1,
167415
+ children: [
167416
+ /* @__PURE__ */ jsxDEV26(Box25, {
167417
+ marginBottom: 1,
167418
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167419
+ bold: true,
167420
+ color: "cyan",
167421
+ children: "Wallet"
167422
+ }, undefined, false, undefined, this)
167423
+ }, undefined, false, undefined, this),
167424
+ /* @__PURE__ */ jsxDEV26(Box25, {
167425
+ flexDirection: "column",
167426
+ borderStyle: "round",
167427
+ borderColor: "gray",
167428
+ paddingX: 1,
167429
+ paddingY: 1,
167430
+ children: [
167431
+ /* @__PURE__ */ jsxDEV26(Text28, {
167432
+ dimColor: true,
167433
+ children: "No cards stored in wallet."
167434
+ }, undefined, false, undefined, this),
167435
+ /* @__PURE__ */ jsxDEV26(Text28, {
167436
+ dimColor: true,
167437
+ children: "Use the wallet_add tool to add a card."
167438
+ }, undefined, false, undefined, this),
167439
+ /* @__PURE__ */ jsxDEV26(Box25, {
167440
+ marginTop: 1,
167441
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167442
+ color: "yellow",
167443
+ children: "\u26A0\uFE0F PCI DSS Warning:"
167444
+ }, undefined, false, undefined, this)
167445
+ }, undefined, false, undefined, this),
167446
+ /* @__PURE__ */ jsxDEV26(Text28, {
167447
+ dimColor: true,
167448
+ children: "Storing payment cards requires PCI compliance."
167449
+ }, undefined, false, undefined, this)
167450
+ ]
167451
+ }, undefined, true, undefined, this),
167452
+ /* @__PURE__ */ jsxDEV26(Box25, {
167453
+ marginTop: 1,
167454
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167455
+ dimColor: true,
167456
+ children: "q quit"
167457
+ }, undefined, false, undefined, this)
167458
+ }, undefined, false, undefined, this)
167459
+ ]
167460
+ }, undefined, true, undefined, this);
167461
+ }
167462
+ if (mode === "delete-confirm" && deleteTarget) {
167463
+ return /* @__PURE__ */ jsxDEV26(Box25, {
167464
+ flexDirection: "column",
167465
+ paddingY: 1,
167466
+ children: [
167467
+ /* @__PURE__ */ jsxDEV26(Box25, {
167468
+ marginBottom: 1,
167469
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167470
+ bold: true,
167471
+ color: "red",
167472
+ children: "Remove Card"
167473
+ }, undefined, false, undefined, this)
167474
+ }, undefined, false, undefined, this),
167475
+ /* @__PURE__ */ jsxDEV26(Box25, {
167476
+ flexDirection: "column",
167477
+ borderStyle: "round",
167478
+ borderColor: "red",
167479
+ paddingX: 1,
167480
+ paddingY: 1,
167481
+ children: [
167482
+ /* @__PURE__ */ jsxDEV26(Text28, {
167483
+ children: [
167484
+ 'Are you sure you want to remove "',
167485
+ deleteTarget.name,
167486
+ '"?'
167487
+ ]
167488
+ }, undefined, true, undefined, this),
167489
+ /* @__PURE__ */ jsxDEV26(Text28, {
167490
+ dimColor: true,
167491
+ children: [
167492
+ "Card ending in ",
167493
+ deleteTarget.last4
167494
+ ]
167495
+ }, undefined, true, undefined, this),
167496
+ /* @__PURE__ */ jsxDEV26(Text28, {
167497
+ dimColor: true,
167498
+ children: "This action cannot be undone."
167499
+ }, undefined, false, undefined, this)
167500
+ ]
167501
+ }, undefined, true, undefined, this),
167502
+ /* @__PURE__ */ jsxDEV26(Box25, {
167503
+ marginTop: 1,
167504
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167505
+ dimColor: true,
167506
+ children: "y confirm | n cancel"
167507
+ }, undefined, false, undefined, this)
167508
+ }, undefined, false, undefined, this)
167509
+ ]
167510
+ }, undefined, true, undefined, this);
167511
+ }
167512
+ if (mode === "detail" && detailCard) {
167513
+ return /* @__PURE__ */ jsxDEV26(Box25, {
167514
+ flexDirection: "column",
167515
+ paddingY: 1,
167516
+ children: [
167517
+ /* @__PURE__ */ jsxDEV26(Box25, {
167518
+ marginBottom: 1,
167519
+ children: [
167520
+ /* @__PURE__ */ jsxDEV26(Text28, {
167521
+ bold: true,
167522
+ color: "cyan",
167523
+ children: [
167524
+ "\uD83D\uDCB3 ",
167525
+ detailCard.name
167526
+ ]
167527
+ }, undefined, true, undefined, this),
167528
+ detailCard.isDefault && /* @__PURE__ */ jsxDEV26(Text28, {
167529
+ color: "yellow",
167530
+ children: " (default)"
167531
+ }, undefined, false, undefined, this)
167532
+ ]
167533
+ }, undefined, true, undefined, this),
167534
+ /* @__PURE__ */ jsxDEV26(Box25, {
167535
+ flexDirection: "column",
167536
+ borderStyle: "round",
167537
+ borderColor: "gray",
167538
+ paddingX: 1,
167539
+ paddingY: 1,
167540
+ children: [
167541
+ /* @__PURE__ */ jsxDEV26(Box25, {
167542
+ children: [
167543
+ /* @__PURE__ */ jsxDEV26(Text28, {
167544
+ dimColor: true,
167545
+ children: "Card Number: "
167546
+ }, undefined, false, undefined, this),
167547
+ /* @__PURE__ */ jsxDEV26(Text28, {
167548
+ children: [
167549
+ "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ",
167550
+ detailCard.last4
167551
+ ]
167552
+ }, undefined, true, undefined, this)
167553
+ ]
167554
+ }, undefined, true, undefined, this),
167555
+ detailCard.brand && /* @__PURE__ */ jsxDEV26(Box25, {
167556
+ children: [
167557
+ /* @__PURE__ */ jsxDEV26(Text28, {
167558
+ dimColor: true,
167559
+ children: "Brand: "
167560
+ }, undefined, false, undefined, this),
167561
+ /* @__PURE__ */ jsxDEV26(Text28, {
167562
+ children: detailCard.brand
167563
+ }, undefined, false, undefined, this)
167564
+ ]
167565
+ }, undefined, true, undefined, this),
167566
+ /* @__PURE__ */ jsxDEV26(Box25, {
167567
+ children: [
167568
+ /* @__PURE__ */ jsxDEV26(Text28, {
167569
+ dimColor: true,
167570
+ children: "Expires: "
167571
+ }, undefined, false, undefined, this),
167572
+ /* @__PURE__ */ jsxDEV26(Text28, {
167573
+ children: formatExpiry(detailCard.expiryMonth, detailCard.expiryYear)
167574
+ }, undefined, false, undefined, this)
167575
+ ]
167576
+ }, undefined, true, undefined, this),
167577
+ detailCard.createdAt && /* @__PURE__ */ jsxDEV26(Box25, {
167578
+ children: [
167579
+ /* @__PURE__ */ jsxDEV26(Text28, {
167580
+ dimColor: true,
167581
+ children: "Added: "
167582
+ }, undefined, false, undefined, this),
167583
+ /* @__PURE__ */ jsxDEV26(Text28, {
167584
+ children: new Date(detailCard.createdAt).toLocaleString()
167585
+ }, undefined, false, undefined, this)
167586
+ ]
167587
+ }, undefined, true, undefined, this)
167588
+ ]
167589
+ }, undefined, true, undefined, this),
167590
+ error2 && /* @__PURE__ */ jsxDEV26(Box25, {
167591
+ marginTop: 1,
167592
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167593
+ color: "red",
167594
+ children: error2
167595
+ }, undefined, false, undefined, this)
167596
+ }, undefined, false, undefined, this),
167597
+ /* @__PURE__ */ jsxDEV26(Box25, {
167598
+ marginTop: 1,
167599
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167600
+ dimColor: true,
167601
+ children: "x remove | Esc back"
167602
+ }, undefined, false, undefined, this)
167603
+ }, undefined, false, undefined, this)
167604
+ ]
167605
+ }, undefined, true, undefined, this);
167606
+ }
167607
+ const visibleCards = cards.slice(cardRange.start, cardRange.end);
167608
+ return /* @__PURE__ */ jsxDEV26(Box25, {
167609
+ flexDirection: "column",
167610
+ paddingY: 1,
167611
+ children: [
167612
+ /* @__PURE__ */ jsxDEV26(Box25, {
167613
+ marginBottom: 1,
167614
+ children: [
167615
+ /* @__PURE__ */ jsxDEV26(Text28, {
167616
+ bold: true,
167617
+ color: "cyan",
167618
+ children: "Wallet"
167619
+ }, undefined, false, undefined, this),
167620
+ cards.length > MAX_VISIBLE_ITEMS3 && /* @__PURE__ */ jsxDEV26(Text28, {
167621
+ dimColor: true,
167622
+ children: [
167623
+ " (",
167624
+ cardIndex + 1,
167625
+ "/",
167626
+ cards.length,
167627
+ ")"
167628
+ ]
167629
+ }, undefined, true, undefined, this)
167630
+ ]
167631
+ }, undefined, true, undefined, this),
167632
+ /* @__PURE__ */ jsxDEV26(Box25, {
167633
+ flexDirection: "column",
167634
+ borderStyle: "round",
167635
+ borderColor: "gray",
167636
+ paddingX: 1,
167637
+ children: [
167638
+ cardRange.hasMore.above > 0 && /* @__PURE__ */ jsxDEV26(Box25, {
167639
+ paddingY: 0,
167640
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167641
+ dimColor: true,
167642
+ children: [
167643
+ " \u2191 ",
167644
+ cardRange.hasMore.above,
167645
+ " more above"
167646
+ ]
167647
+ }, undefined, true, undefined, this)
167648
+ }, undefined, false, undefined, this),
167649
+ visibleCards.map((card, visibleIdx) => {
167650
+ const actualIdx = cardRange.start + visibleIdx;
167651
+ const isSelected = actualIdx === cardIndex;
167652
+ const prefix2 = isSelected ? "> " : " ";
167653
+ const nameDisplay = card.name.padEnd(20);
167654
+ const statusIcon = card.isDefault ? "\u2605" : "\u25CB";
167655
+ const statusColor = card.isDefault ? "yellow" : "gray";
167656
+ return /* @__PURE__ */ jsxDEV26(Box25, {
167657
+ paddingY: 0,
167658
+ children: [
167659
+ /* @__PURE__ */ jsxDEV26(Text28, {
167660
+ inverse: isSelected,
167661
+ dimColor: !isSelected,
167662
+ children: [
167663
+ prefix2,
167664
+ "\uD83D\uDCB3",
167665
+ " "
167666
+ ]
167667
+ }, undefined, true, undefined, this),
167668
+ /* @__PURE__ */ jsxDEV26(Text28, {
167669
+ color: statusColor,
167670
+ inverse: isSelected,
167671
+ children: statusIcon
167672
+ }, undefined, false, undefined, this),
167673
+ /* @__PURE__ */ jsxDEV26(Text28, {
167674
+ inverse: isSelected,
167675
+ dimColor: !isSelected,
167676
+ children: [
167677
+ " ",
167678
+ nameDisplay
167679
+ ]
167680
+ }, undefined, true, undefined, this),
167681
+ /* @__PURE__ */ jsxDEV26(Text28, {
167682
+ inverse: isSelected,
167683
+ dimColor: true,
167684
+ children: [
167685
+ " ",
167686
+ "\u2022\u2022\u2022\u2022 ",
167687
+ card.last4
167688
+ ]
167689
+ }, undefined, true, undefined, this),
167690
+ card.brand && /* @__PURE__ */ jsxDEV26(Text28, {
167691
+ inverse: isSelected,
167692
+ dimColor: true,
167693
+ children: [
167694
+ " ",
167695
+ "(",
167696
+ card.brand,
167697
+ ")"
167698
+ ]
167699
+ }, undefined, true, undefined, this)
167700
+ ]
167701
+ }, card.id, true, undefined, this);
167702
+ }),
167703
+ cardRange.hasMore.below > 0 && /* @__PURE__ */ jsxDEV26(Box25, {
167704
+ paddingY: 0,
167705
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167706
+ dimColor: true,
167707
+ children: [
167708
+ " \u2193 ",
167709
+ cardRange.hasMore.below,
167710
+ " more below"
167711
+ ]
167712
+ }, undefined, true, undefined, this)
167713
+ }, undefined, false, undefined, this)
167714
+ ]
167715
+ }, undefined, true, undefined, this),
167716
+ /* @__PURE__ */ jsxDEV26(Box25, {
167717
+ marginTop: 1,
167718
+ children: [
167719
+ /* @__PURE__ */ jsxDEV26(Text28, {
167720
+ dimColor: true,
167721
+ children: "Legend: "
167722
+ }, undefined, false, undefined, this),
167723
+ /* @__PURE__ */ jsxDEV26(Text28, {
167724
+ color: "yellow",
167725
+ children: "\u2605"
167726
+ }, undefined, false, undefined, this),
167727
+ /* @__PURE__ */ jsxDEV26(Text28, {
167728
+ dimColor: true,
167729
+ children: " default | "
167730
+ }, undefined, false, undefined, this),
167731
+ /* @__PURE__ */ jsxDEV26(Text28, {
167732
+ color: "gray",
167733
+ children: "\u25CB"
167734
+ }, undefined, false, undefined, this),
167735
+ /* @__PURE__ */ jsxDEV26(Text28, {
167736
+ dimColor: true,
167737
+ children: " standard"
167738
+ }, undefined, false, undefined, this)
167739
+ ]
167740
+ }, undefined, true, undefined, this),
167741
+ /* @__PURE__ */ jsxDEV26(Box25, {
167742
+ marginTop: 1,
167743
+ children: /* @__PURE__ */ jsxDEV26(Text28, {
167744
+ dimColor: true,
167745
+ children: "\u2191\u2193 select | Enter view | q quit"
167746
+ }, undefined, false, undefined, this)
167747
+ }, undefined, false, undefined, this)
167748
+ ]
167749
+ }, undefined, true, undefined, this);
167750
+ }
167751
+
167752
+ // src/components/SecretsPanel.tsx
167753
+ import { useState as useState21, useMemo as useMemo12 } from "react";
167754
+ import { Box as Box26, Text as Text29, useInput as useInput18 } from "ink";
167755
+ import { jsxDEV as jsxDEV27 } from "react/jsx-dev-runtime";
167756
+ var MAX_VISIBLE_ITEMS4 = 5;
167757
+ function getVisibleRange4(selectedIndex, totalItems, maxVisible = MAX_VISIBLE_ITEMS4) {
167758
+ if (totalItems <= maxVisible) {
167759
+ return {
167760
+ start: 0,
167761
+ end: totalItems,
167762
+ hasMore: { above: 0, below: 0 }
167763
+ };
167764
+ }
167765
+ const halfWindow = Math.floor(maxVisible / 2);
167766
+ let start = selectedIndex - halfWindow;
167767
+ let end = selectedIndex + (maxVisible - halfWindow);
167768
+ if (start < 0) {
167769
+ start = 0;
167770
+ end = maxVisible;
167771
+ }
167772
+ if (end > totalItems) {
167773
+ end = totalItems;
167774
+ start = Math.max(0, totalItems - maxVisible);
167775
+ }
167776
+ return {
167777
+ start,
167778
+ end,
167779
+ hasMore: {
167780
+ above: start,
167781
+ below: totalItems - end
167782
+ }
167783
+ };
167784
+ }
167785
+ function SecretsPanel({
167786
+ secrets: secrets2,
167787
+ onGet,
167788
+ onDelete,
167789
+ onClose,
167790
+ error: error2
167791
+ }) {
167792
+ const [mode, setMode] = useState21("list");
167793
+ const [secretIndex, setSecretIndex] = useState21(0);
167794
+ const [deleteTarget, setDeleteTarget] = useState21(null);
167795
+ const [isProcessing, setIsProcessing] = useState21(false);
167796
+ const [revealedValue, setRevealedValue] = useState21(null);
167797
+ const secretRange = useMemo12(() => getVisibleRange4(secretIndex, secrets2.length), [secretIndex, secrets2.length]);
167798
+ const currentSecret = secrets2[secretIndex];
167799
+ const handleReveal = async () => {
167800
+ if (!currentSecret || revealedValue !== null)
167801
+ return;
167802
+ setIsProcessing(true);
167803
+ try {
167804
+ const value = await onGet(currentSecret.name, currentSecret.scope);
167805
+ setRevealedValue(value);
167806
+ } finally {
167807
+ setIsProcessing(false);
167808
+ }
167809
+ };
167810
+ const handleDelete = async () => {
167811
+ if (!deleteTarget)
167812
+ return;
167813
+ setIsProcessing(true);
167814
+ try {
167815
+ await onDelete(deleteTarget.name, deleteTarget.scope);
167816
+ setMode("list");
167817
+ setDeleteTarget(null);
167818
+ if (secretIndex >= secrets2.length - 1 && secretIndex > 0) {
167819
+ setSecretIndex(secretIndex - 1);
167820
+ }
167821
+ } finally {
167822
+ setIsProcessing(false);
167823
+ }
167824
+ };
167825
+ useInput18((input, key) => {
167826
+ if (isProcessing)
167827
+ return;
167828
+ if (input === "q" || key.escape && mode === "list") {
167829
+ onClose();
167830
+ return;
167831
+ }
167832
+ if (key.escape) {
167833
+ if (mode === "detail") {
167834
+ setMode("list");
167835
+ setRevealedValue(null);
167836
+ } else if (mode === "delete-confirm") {
167837
+ setMode("detail");
167838
+ setDeleteTarget(null);
167839
+ }
167840
+ return;
167841
+ }
167842
+ if (mode === "list") {
167843
+ if (key.upArrow) {
167844
+ setSecretIndex((prev) => prev === 0 ? secrets2.length - 1 : prev - 1);
167845
+ return;
167846
+ }
167847
+ if (key.downArrow) {
167848
+ setSecretIndex((prev) => prev === secrets2.length - 1 ? 0 : prev + 1);
167849
+ return;
167850
+ }
167851
+ if (key.return && currentSecret) {
167852
+ setMode("detail");
167853
+ setRevealedValue(null);
167854
+ return;
167855
+ }
167856
+ const num = parseInt(input, 10);
167857
+ if (!isNaN(num) && num >= 1 && num <= secrets2.length) {
167858
+ setSecretIndex(num - 1);
167859
+ }
167860
+ return;
167861
+ }
167862
+ if (mode === "detail") {
167863
+ if (input === "r") {
167864
+ handleReveal();
167865
+ return;
167866
+ }
167867
+ if (input === "x" || key.delete) {
167868
+ if (currentSecret) {
167869
+ setDeleteTarget(currentSecret);
167870
+ setMode("delete-confirm");
167871
+ }
167872
+ return;
167873
+ }
167874
+ return;
167875
+ }
167876
+ if (mode === "delete-confirm") {
167877
+ if (input === "y") {
167878
+ handleDelete();
167879
+ return;
167880
+ }
167881
+ if (input === "n") {
167882
+ setMode("detail");
167883
+ setDeleteTarget(null);
167884
+ return;
167885
+ }
167886
+ }
167887
+ });
167888
+ if (secrets2.length === 0) {
167889
+ return /* @__PURE__ */ jsxDEV27(Box26, {
167890
+ flexDirection: "column",
167891
+ paddingY: 1,
167892
+ children: [
167893
+ /* @__PURE__ */ jsxDEV27(Box26, {
167894
+ marginBottom: 1,
167895
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
167896
+ bold: true,
167897
+ color: "cyan",
167898
+ children: "Secrets"
167899
+ }, undefined, false, undefined, this)
167900
+ }, undefined, false, undefined, this),
167901
+ /* @__PURE__ */ jsxDEV27(Box26, {
167902
+ flexDirection: "column",
167903
+ borderStyle: "round",
167904
+ borderColor: "gray",
167905
+ paddingX: 1,
167906
+ paddingY: 1,
167907
+ children: [
167908
+ /* @__PURE__ */ jsxDEV27(Text29, {
167909
+ dimColor: true,
167910
+ children: "No secrets stored."
167911
+ }, undefined, false, undefined, this),
167912
+ /* @__PURE__ */ jsxDEV27(Text29, {
167913
+ dimColor: true,
167914
+ children: "Use the secrets_set tool to add secrets."
167915
+ }, undefined, false, undefined, this)
167916
+ ]
167917
+ }, undefined, true, undefined, this),
167918
+ /* @__PURE__ */ jsxDEV27(Box26, {
167919
+ marginTop: 1,
167920
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
167921
+ dimColor: true,
167922
+ children: "q quit"
167923
+ }, undefined, false, undefined, this)
167924
+ }, undefined, false, undefined, this)
167925
+ ]
167926
+ }, undefined, true, undefined, this);
167927
+ }
167928
+ if (mode === "delete-confirm" && deleteTarget) {
167929
+ return /* @__PURE__ */ jsxDEV27(Box26, {
167930
+ flexDirection: "column",
167931
+ paddingY: 1,
167932
+ children: [
167933
+ /* @__PURE__ */ jsxDEV27(Box26, {
167934
+ marginBottom: 1,
167935
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
167936
+ bold: true,
167937
+ color: "red",
167938
+ children: "Delete Secret"
167939
+ }, undefined, false, undefined, this)
167940
+ }, undefined, false, undefined, this),
167941
+ /* @__PURE__ */ jsxDEV27(Box26, {
167942
+ flexDirection: "column",
167943
+ borderStyle: "round",
167944
+ borderColor: "red",
167945
+ paddingX: 1,
167946
+ paddingY: 1,
167947
+ children: [
167948
+ /* @__PURE__ */ jsxDEV27(Text29, {
167949
+ children: [
167950
+ 'Are you sure you want to delete "',
167951
+ deleteTarget.name,
167952
+ '"?'
167953
+ ]
167954
+ }, undefined, true, undefined, this),
167955
+ /* @__PURE__ */ jsxDEV27(Text29, {
167956
+ dimColor: true,
167957
+ children: [
167958
+ "Scope: ",
167959
+ deleteTarget.scope
167960
+ ]
167961
+ }, undefined, true, undefined, this),
167962
+ /* @__PURE__ */ jsxDEV27(Text29, {
167963
+ dimColor: true,
167964
+ children: "This action cannot be undone."
167965
+ }, undefined, false, undefined, this)
167966
+ ]
167967
+ }, undefined, true, undefined, this),
167968
+ /* @__PURE__ */ jsxDEV27(Box26, {
167969
+ marginTop: 1,
167970
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
167971
+ dimColor: true,
167972
+ children: "y confirm | n cancel"
167973
+ }, undefined, false, undefined, this)
167974
+ }, undefined, false, undefined, this)
167975
+ ]
167976
+ }, undefined, true, undefined, this);
167977
+ }
167978
+ if (mode === "detail" && currentSecret) {
167979
+ return /* @__PURE__ */ jsxDEV27(Box26, {
167980
+ flexDirection: "column",
167981
+ paddingY: 1,
167982
+ children: [
167983
+ /* @__PURE__ */ jsxDEV27(Box26, {
167984
+ marginBottom: 1,
167985
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
167986
+ bold: true,
167987
+ color: "cyan",
167988
+ children: currentSecret.name
167989
+ }, undefined, false, undefined, this)
167990
+ }, undefined, false, undefined, this),
167991
+ /* @__PURE__ */ jsxDEV27(Box26, {
167992
+ flexDirection: "column",
167993
+ borderStyle: "round",
167994
+ borderColor: "gray",
167995
+ paddingX: 1,
167996
+ paddingY: 1,
167997
+ children: [
167998
+ /* @__PURE__ */ jsxDEV27(Box26, {
167999
+ children: [
168000
+ /* @__PURE__ */ jsxDEV27(Text29, {
168001
+ dimColor: true,
168002
+ children: "Scope: "
168003
+ }, undefined, false, undefined, this),
168004
+ /* @__PURE__ */ jsxDEV27(Text29, {
168005
+ color: currentSecret.scope === "global" ? "yellow" : "blue",
168006
+ children: currentSecret.scope
168007
+ }, undefined, false, undefined, this)
168008
+ ]
168009
+ }, undefined, true, undefined, this),
168010
+ currentSecret.createdAt && /* @__PURE__ */ jsxDEV27(Box26, {
168011
+ children: [
168012
+ /* @__PURE__ */ jsxDEV27(Text29, {
168013
+ dimColor: true,
168014
+ children: "Created: "
168015
+ }, undefined, false, undefined, this),
168016
+ /* @__PURE__ */ jsxDEV27(Text29, {
168017
+ children: new Date(currentSecret.createdAt).toLocaleString()
168018
+ }, undefined, false, undefined, this)
168019
+ ]
168020
+ }, undefined, true, undefined, this),
168021
+ currentSecret.updatedAt && /* @__PURE__ */ jsxDEV27(Box26, {
168022
+ children: [
168023
+ /* @__PURE__ */ jsxDEV27(Text29, {
168024
+ dimColor: true,
168025
+ children: "Updated: "
168026
+ }, undefined, false, undefined, this),
168027
+ /* @__PURE__ */ jsxDEV27(Text29, {
168028
+ children: new Date(currentSecret.updatedAt).toLocaleString()
168029
+ }, undefined, false, undefined, this)
168030
+ ]
168031
+ }, undefined, true, undefined, this),
168032
+ /* @__PURE__ */ jsxDEV27(Box26, {
168033
+ marginTop: 1,
168034
+ children: [
168035
+ /* @__PURE__ */ jsxDEV27(Text29, {
168036
+ dimColor: true,
168037
+ children: "Value: "
168038
+ }, undefined, false, undefined, this),
168039
+ revealedValue !== null ? /* @__PURE__ */ jsxDEV27(Text29, {
168040
+ color: "green",
168041
+ children: revealedValue
168042
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV27(Text29, {
168043
+ dimColor: true,
168044
+ children: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
168045
+ }, undefined, false, undefined, this)
168046
+ ]
168047
+ }, undefined, true, undefined, this)
168048
+ ]
168049
+ }, undefined, true, undefined, this),
168050
+ error2 && /* @__PURE__ */ jsxDEV27(Box26, {
168051
+ marginTop: 1,
168052
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
168053
+ color: "red",
168054
+ children: error2
168055
+ }, undefined, false, undefined, this)
168056
+ }, undefined, false, undefined, this),
168057
+ /* @__PURE__ */ jsxDEV27(Box26, {
168058
+ marginTop: 1,
168059
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
168060
+ dimColor: true,
168061
+ children: [
168062
+ revealedValue === null && "r reveal | ",
168063
+ "x delete | Esc back"
168064
+ ]
168065
+ }, undefined, true, undefined, this)
168066
+ }, undefined, false, undefined, this)
168067
+ ]
168068
+ }, undefined, true, undefined, this);
168069
+ }
168070
+ const visibleSecrets = secrets2.slice(secretRange.start, secretRange.end);
168071
+ return /* @__PURE__ */ jsxDEV27(Box26, {
168072
+ flexDirection: "column",
168073
+ paddingY: 1,
168074
+ children: [
168075
+ /* @__PURE__ */ jsxDEV27(Box26, {
168076
+ marginBottom: 1,
168077
+ children: [
168078
+ /* @__PURE__ */ jsxDEV27(Text29, {
168079
+ bold: true,
168080
+ color: "cyan",
168081
+ children: "Secrets"
168082
+ }, undefined, false, undefined, this),
168083
+ secrets2.length > MAX_VISIBLE_ITEMS4 && /* @__PURE__ */ jsxDEV27(Text29, {
168084
+ dimColor: true,
168085
+ children: [
168086
+ " (",
168087
+ secretIndex + 1,
168088
+ "/",
168089
+ secrets2.length,
168090
+ ")"
168091
+ ]
168092
+ }, undefined, true, undefined, this)
168093
+ ]
168094
+ }, undefined, true, undefined, this),
168095
+ /* @__PURE__ */ jsxDEV27(Box26, {
168096
+ flexDirection: "column",
168097
+ borderStyle: "round",
168098
+ borderColor: "gray",
168099
+ paddingX: 1,
168100
+ children: [
168101
+ secretRange.hasMore.above > 0 && /* @__PURE__ */ jsxDEV27(Box26, {
168102
+ paddingY: 0,
168103
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
168104
+ dimColor: true,
168105
+ children: [
168106
+ " \u2191 ",
168107
+ secretRange.hasMore.above,
168108
+ " more above"
168109
+ ]
168110
+ }, undefined, true, undefined, this)
168111
+ }, undefined, false, undefined, this),
168112
+ visibleSecrets.map((secret, visibleIdx) => {
168113
+ const actualIdx = secretRange.start + visibleIdx;
168114
+ const isSelected = actualIdx === secretIndex;
168115
+ const prefix2 = isSelected ? "> " : " ";
168116
+ const nameDisplay = secret.name.padEnd(25);
168117
+ const scopeColor = secret.scope === "global" ? "yellow" : "blue";
168118
+ return /* @__PURE__ */ jsxDEV27(Box26, {
168119
+ paddingY: 0,
168120
+ children: [
168121
+ /* @__PURE__ */ jsxDEV27(Text29, {
168122
+ inverse: isSelected,
168123
+ dimColor: !isSelected,
168124
+ children: [
168125
+ prefix2,
168126
+ "\uD83D\uDD11 ",
168127
+ nameDisplay
168128
+ ]
168129
+ }, undefined, true, undefined, this),
168130
+ /* @__PURE__ */ jsxDEV27(Text29, {
168131
+ color: scopeColor,
168132
+ inverse: isSelected,
168133
+ children: secret.scope.padEnd(8)
168134
+ }, undefined, false, undefined, this)
168135
+ ]
168136
+ }, `${secret.name}-${secret.scope}`, true, undefined, this);
168137
+ }),
168138
+ secretRange.hasMore.below > 0 && /* @__PURE__ */ jsxDEV27(Box26, {
168139
+ paddingY: 0,
168140
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
168141
+ dimColor: true,
168142
+ children: [
168143
+ " \u2193 ",
168144
+ secretRange.hasMore.below,
168145
+ " more below"
168146
+ ]
168147
+ }, undefined, true, undefined, this)
168148
+ }, undefined, false, undefined, this)
168149
+ ]
168150
+ }, undefined, true, undefined, this),
168151
+ /* @__PURE__ */ jsxDEV27(Box26, {
168152
+ marginTop: 1,
168153
+ children: [
168154
+ /* @__PURE__ */ jsxDEV27(Text29, {
168155
+ dimColor: true,
168156
+ children: "Legend: "
168157
+ }, undefined, false, undefined, this),
168158
+ /* @__PURE__ */ jsxDEV27(Text29, {
168159
+ color: "yellow",
168160
+ children: "global"
168161
+ }, undefined, false, undefined, this),
168162
+ /* @__PURE__ */ jsxDEV27(Text29, {
168163
+ dimColor: true,
168164
+ children: " = shared | "
168165
+ }, undefined, false, undefined, this),
168166
+ /* @__PURE__ */ jsxDEV27(Text29, {
168167
+ color: "blue",
168168
+ children: "agent"
168169
+ }, undefined, false, undefined, this),
168170
+ /* @__PURE__ */ jsxDEV27(Text29, {
168171
+ dimColor: true,
168172
+ children: " = agent-specific"
168173
+ }, undefined, false, undefined, this)
168174
+ ]
168175
+ }, undefined, true, undefined, this),
168176
+ /* @__PURE__ */ jsxDEV27(Box26, {
168177
+ marginTop: 1,
168178
+ children: /* @__PURE__ */ jsxDEV27(Text29, {
168179
+ dimColor: true,
168180
+ children: "\u2191\u2193 select | Enter view | q quit"
168181
+ }, undefined, false, undefined, this)
168182
+ }, undefined, false, undefined, this)
168183
+ ]
168184
+ }, undefined, true, undefined, this);
168185
+ }
168186
+
168187
+ // src/components/App.tsx
168188
+ import { jsxDEV as jsxDEV28, Fragment as Fragment7 } from "react/jsx-dev-runtime";
168189
+ var SHOW_ERROR_CODES = process.env.ASSISTANTS_DEBUG === "1";
168190
+ function formatElapsedDuration(ms2) {
168191
+ const totalSeconds = Math.max(0, Math.floor(ms2 / 1000));
168192
+ if (totalSeconds === 0)
168193
+ return "<1s";
168194
+ if (totalSeconds < 60)
168195
+ return `${totalSeconds}s`;
168196
+ const mins = Math.floor(totalSeconds / 60);
168197
+ const secs = totalSeconds % 60;
168198
+ return `${mins}m ${secs}s`;
168199
+ }
168200
+ function deepMerge(target, source) {
168201
+ const output = { ...target };
168202
+ for (const key of Object.keys(source)) {
168203
+ const sourceValue = source[key];
168204
+ const targetValue = target[key];
168205
+ if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) {
168206
+ output[key] = deepMerge(targetValue, sourceValue);
168207
+ } else if (sourceValue !== undefined) {
168208
+ output[key] = sourceValue;
168209
+ }
168210
+ }
168211
+ return output;
168212
+ }
168213
+ var MESSAGE_CHUNK_LINES = 12;
168214
+ var MESSAGE_WRAP_CHARS = 120;
168215
+ function App({ cwd, version: version3 }) {
168216
+ const { exit } = useApp();
168217
+ const { stdout } = useStdout4();
168218
+ const rows = stdout?.rows ?? 24;
168219
+ const columns = stdout?.columns ?? 80;
168220
+ const [registry3] = useState22(() => new SessionRegistry);
168221
+ const registryRef = useRef2(registry3);
168222
+ const [activeSessionId, setActiveSessionId] = useState22(null);
168223
+ const [isInitializing, setIsInitializing] = useState22(true);
168224
+ const [showSessionSelector, setShowSessionSelector] = useState22(false);
168225
+ const [recoverableSessions, setRecoverableSessions] = useState22([]);
168226
+ const [showRecoveryPanel, setShowRecoveryPanel] = useState22(false);
168227
+ const [showConnectorsPanel, setShowConnectorsPanel] = useState22(false);
168228
+ const [connectorsPanelInitial, setConnectorsPanelInitial] = useState22();
168229
+ const [connectors, setConnectors] = useState22([]);
168230
+ const connectorBridgeRef = useRef2(null);
168231
+ const [showTasksPanel, setShowTasksPanel] = useState22(false);
168232
+ const [tasksList, setTasksList] = useState22([]);
168233
+ const [tasksPaused, setTasksPaused] = useState22(false);
168234
+ const [showSchedulesPanel, setShowSchedulesPanel] = useState22(false);
168235
+ const [schedulesList, setSchedulesList] = useState22([]);
168236
+ const [showAssistantsPanel, setShowAssistantsPanel] = useState22(false);
168237
+ const [assistantsRefreshKey, setAssistantsRefreshKey] = useState22(0);
168238
+ const [assistantError, setAssistantError] = useState22(null);
168239
+ const [showHooksPanel, setShowHooksPanel] = useState22(false);
168240
+ const [hooksConfig, setHooksConfig] = useState22({});
168241
+ const hookStoreRef = useRef2(null);
168242
+ const [showGuardrailsPanel, setShowGuardrailsPanel] = useState22(false);
168243
+ const [guardrailsConfig, setGuardrailsConfig] = useState22(null);
168244
+ const [guardrailsPolicies, setGuardrailsPolicies] = useState22([]);
168245
+ const guardrailsStoreRef = useRef2(null);
168246
+ const [showBudgetPanel, setShowBudgetPanel] = useState22(false);
168247
+ const [budgetConfig, setBudgetConfig] = useState22(null);
168248
+ const [sessionBudgetStatus, setSessionBudgetStatus] = useState22(null);
168249
+ const [swarmBudgetStatus, setSwarmBudgetStatus] = useState22(null);
168250
+ const budgetTrackerRef = useRef2(null);
168251
+ const [showAgentsPanel, setShowAgentsPanel] = useState22(false);
168252
+ const [agentsList, setAgentsList] = useState22([]);
168253
+ const [registryStats, setRegistryStats] = useState22(null);
168254
+ const [showConfigPanel, setShowConfigPanel] = useState22(false);
168255
+ const [currentConfig, setCurrentConfig] = useState22(null);
168256
+ const [userConfig, setUserConfig] = useState22(null);
168257
+ const [projectConfig, setProjectConfig] = useState22(null);
168258
+ const [localConfig, setLocalConfig] = useState22(null);
168259
+ const [showMessagesPanel, setShowMessagesPanel] = useState22(false);
168260
+ const [messagesPanelError, setMessagesPanelError] = useState22(null);
168261
+ const [messagesList, setMessagesList] = useState22([]);
168262
+ const [showProjectsPanel, setShowProjectsPanel] = useState22(false);
168263
+ const [projectsList, setProjectsList] = useState22([]);
168264
+ const [activeProjectId, setActiveProjectId] = useState22();
168265
+ const [showPlansPanel, setShowPlansPanel] = useState22(false);
168266
+ const [plansProject, setPlansProject] = useState22(null);
168267
+ const [showWalletPanel, setShowWalletPanel] = useState22(false);
168268
+ const [walletCards, setWalletCards] = useState22([]);
168269
+ const [walletError, setWalletError] = useState22(null);
168270
+ const [showSecretsPanel, setShowSecretsPanel] = useState22(false);
168271
+ const [secretsList, setSecretsList] = useState22([]);
168272
+ const [secretsError, setSecretsError] = useState22(null);
168273
+ const sessionUIStates = useRef2(new Map);
168274
+ const [messages2, setMessages] = useState22([]);
168275
+ const [currentResponse, setCurrentResponse] = useState22("");
168276
+ const [currentToolCall, setCurrentToolCall] = useState22();
168277
+ const [isProcessing, setIsProcessing] = useState22(false);
168278
+ const [error2, setError] = useState22(null);
168279
+ const [messageQueue, setMessageQueue] = useState22([]);
168280
+ const [inlinePending, setInlinePending] = useState22([]);
168281
+ const [activityLog, setActivityLog] = useState22([]);
168282
+ const [tokenUsage, setTokenUsage] = useState22();
168283
+ const [energyState, setEnergyState] = useState22();
168284
+ const [voiceState, setVoiceState] = useState22();
168285
+ const [heartbeatState, setHeartbeatState] = useState22();
168286
+ const [identityInfo, setIdentityInfo] = useState22();
168287
+ const [verboseTools, setVerboseTools] = useState22(false);
168288
+ const [askUserState, setAskUserState] = useState22(null);
168289
+ const [processingStartTime, setProcessingStartTime] = useState22();
168290
+ const [currentTurnTokens, setCurrentTurnTokens] = useState22(0);
168291
+ const [lastWorkedFor, setLastWorkedFor] = useState22();
168292
+ const [skills, setSkills] = useState22([]);
168293
+ const [commands3, setCommands] = useState22([]);
168294
+ const lastCtrlCRef = useRef2(0);
168295
+ const [showExitHint, setShowExitHint] = useState22(false);
168296
+ const responseRef = useRef2("");
168297
+ const toolCallsRef = useRef2([]);
168298
+ const toolResultsRef = useRef2([]);
168299
+ const activityLogRef = useRef2([]);
168300
+ const skipNextDoneRef = useRef2(false);
168301
+ const isProcessingRef = useRef2(isProcessing);
168302
+ const processingStartTimeRef = useRef2(processingStartTime);
168303
+ const pendingSendsRef = useRef2([]);
168304
+ const askUserStateRef = useRef2(new Map);
168305
+ const [queueFlushTrigger, setQueueFlushTrigger] = useState22(0);
168306
+ const clearPendingSend = useCallback5((id, sessionId) => {
168307
+ pendingSendsRef.current = pendingSendsRef.current.filter((entry) => entry.id !== id || entry.sessionId !== sessionId);
168308
+ setInlinePending((prev) => prev.filter((msg) => msg.id !== id));
168309
+ }, []);
168310
+ const beginAskUser = useCallback5((sessionId, request2) => {
168311
+ return new Promise((resolve5, reject) => {
168312
+ if (askUserStateRef.current.has(sessionId)) {
168313
+ reject(new Error("Another interview is already in progress for this session."));
168314
+ return;
168315
+ }
168316
+ const state = {
168317
+ sessionId,
168318
+ request: request2,
168319
+ index: 0,
168320
+ answers: {},
168321
+ resolve: resolve5,
168322
+ reject
168323
+ };
168324
+ askUserStateRef.current.set(sessionId, state);
168325
+ if (sessionId === activeSessionId) {
168326
+ setAskUserState(state);
168327
+ }
168328
+ });
168329
+ }, [activeSessionId]);
168330
+ const cancelAskUser = useCallback5((reason, sessionId) => {
168331
+ const activeId = sessionId ?? activeSessionId;
168332
+ if (!activeId)
168333
+ return;
168334
+ const current = askUserStateRef.current.get(activeId);
168335
+ if (!current)
168336
+ return;
168337
+ askUserStateRef.current.delete(activeId);
168338
+ if (activeId === activeSessionId) {
168339
+ setAskUserState(null);
168340
+ }
168341
+ current.reject(new Error(reason));
168342
+ }, [activeSessionId]);
168343
+ const submitAskAnswer = useCallback5((answer) => {
168344
+ setAskUserState((prev) => {
168345
+ if (!prev)
168346
+ return prev;
168347
+ const question = prev.request.questions[prev.index];
168348
+ const answers = { ...prev.answers, [question.id]: answer };
168349
+ const nextIndex = prev.index + 1;
168350
+ if (nextIndex >= prev.request.questions.length) {
168351
+ askUserStateRef.current.delete(prev.sessionId);
168352
+ prev.resolve({ answers });
168353
+ return null;
168354
+ }
168355
+ const nextState = {
168356
+ ...prev,
168357
+ index: nextIndex,
168358
+ answers
168359
+ };
168360
+ askUserStateRef.current.set(prev.sessionId, nextState);
168361
+ return nextState;
168362
+ });
168363
+ }, []);
168364
+ const turnIdRef = useRef2(0);
168365
+ const initStateRef = useRef2("idle");
168366
+ const isMountedRef = useRef2(true);
168367
+ const handlersRegisteredRef = useRef2(false);
168368
+ useEffect14(() => {
168369
+ isProcessingRef.current = isProcessing;
168370
+ }, [isProcessing]);
168371
+ useEffect14(() => {
168372
+ processingStartTimeRef.current = processingStartTime;
168373
+ }, [processingStartTime]);
168374
+ useEffect14(() => {
168375
+ if (isProcessing && !processingStartTime) {
168376
+ const now2 = Date.now();
168377
+ setProcessingStartTime(now2);
168378
+ processingStartTimeRef.current = now2;
168379
+ }
168380
+ }, [isProcessing, processingStartTime]);
168381
+ const buildFullResponse = useCallback5(() => {
168382
+ const parts = activityLogRef.current.filter((entry) => entry.type === "text" && entry.content).map((entry) => entry.content);
168383
+ if (responseRef.current.trim()) {
168384
+ parts.push(responseRef.current);
168385
+ }
168386
+ return parts.join(`
168387
+ `).trim();
168388
+ }, []);
168389
+ const loadSessionMetadata = useCallback5(async (session) => {
168390
+ try {
168391
+ const [loadedSkills, loadedCommands] = await Promise.all([
168392
+ session.client.getSkills(),
168393
+ session.client.getCommands()
168394
+ ]);
168395
+ setSkills(loadedSkills.map((s6) => ({
168396
+ name: s6.name,
168397
+ description: s6.description || "",
168398
+ argumentHint: s6.argumentHint
168399
+ })));
168400
+ setCommands(loadedCommands.map((cmd) => ({
168401
+ name: cmd.name.startsWith("/") ? cmd.name : `/${cmd.name}`,
168402
+ description: cmd.description || ""
168403
+ })));
168404
+ } catch (err) {
168405
+ setError(err instanceof Error ? err.message : String(err));
168406
+ }
168407
+ }, []);
168408
+ const finalizeResponse2 = useCallback5((status) => {
168409
+ const baseContent = buildFullResponse();
168410
+ const hasContent = baseContent.length > 0;
168411
+ const activityToolCalls = activityLogRef.current.filter((entry) => entry.type === "tool_call" && entry.toolCall).map((entry) => entry.toolCall);
168412
+ const activityToolResults = activityLogRef.current.filter((entry) => entry.type === "tool_result" && entry.toolResult).map((entry) => entry.toolResult);
168413
+ const toolCallMap = new Map;
168414
+ for (const toolCall of activityToolCalls) {
168415
+ toolCallMap.set(toolCall.id, toolCall);
168416
+ }
168417
+ for (const toolCall of toolCallsRef.current) {
168418
+ toolCallMap.set(toolCall.id, toolCall);
168419
+ }
168420
+ const mergedToolCalls = Array.from(toolCallMap.values());
168421
+ const toolResultMap = new Map;
168422
+ for (const toolResult of activityToolResults) {
168423
+ toolResultMap.set(toolResult.toolCallId, toolResult);
168424
+ }
168425
+ for (const toolResult of toolResultsRef.current) {
168426
+ toolResultMap.set(toolResult.toolCallId, toolResult);
168427
+ }
168428
+ const mergedToolResults = Array.from(toolResultMap.values());
168429
+ const hasTools = mergedToolCalls.length > 0;
168430
+ if (!hasContent && !hasTools) {
168431
+ return false;
168432
+ }
168433
+ let content = baseContent;
168434
+ if (status === "stopped") {
168435
+ content = content ? `${content}
168436
+
168437
+ [stopped]` : "[stopped]";
168438
+ } else if (status === "interrupted") {
168439
+ content = content ? `${content}
168440
+
168441
+ [interrupted]` : "[interrupted]";
168442
+ } else if (status === "error") {
168443
+ content = content ? `${content}
168444
+
168445
+ [error]` : "[error]";
168446
+ }
168447
+ if (processingStartTimeRef.current) {
168448
+ const workedFor = formatElapsedDuration(Date.now() - processingStartTimeRef.current);
168449
+ setLastWorkedFor(workedFor);
168450
+ }
168451
+ setMessages((prev) => [
168452
+ ...prev,
168453
+ {
168454
+ id: generateId(),
168455
+ role: "assistant",
168456
+ content,
168457
+ timestamp: now(),
168458
+ toolCalls: hasTools ? mergedToolCalls : undefined,
168459
+ toolResults: mergedToolResults.length > 0 ? mergedToolResults : undefined
166534
168460
  }
166535
168461
  ]);
166536
168462
  return true;
@@ -166825,6 +168751,59 @@ function App({ cwd, version: version3 }) {
166825
168751
  setAgentsList(agents);
166826
168752
  setRegistryStats(stats);
166827
168753
  setShowAgentsPanel(true);
168754
+ } else if (chunk.panel === "projects") {
168755
+ listProjects(cwd).then((projects2) => {
168756
+ const activeId = registry3.getActiveSession()?.client.getActiveProjectId?.();
168757
+ setProjectsList(projects2);
168758
+ setActiveProjectId(activeId || undefined);
168759
+ setShowProjectsPanel(true);
168760
+ });
168761
+ } else if (chunk.panel === "plans") {
168762
+ const activeId = registry3.getActiveSession()?.client.getActiveProjectId?.();
168763
+ if (activeId) {
168764
+ readProject(cwd, activeId).then((project) => {
168765
+ if (project) {
168766
+ setPlansProject(project);
168767
+ setShowPlansPanel(true);
168768
+ }
168769
+ });
168770
+ } else {
168771
+ listProjects(cwd).then((projects2) => {
168772
+ setProjectsList(projects2);
168773
+ setActiveProjectId(undefined);
168774
+ setShowProjectsPanel(true);
168775
+ });
168776
+ }
168777
+ } else if (chunk.panel === "wallet") {
168778
+ const walletManager = registry3.getActiveSession()?.client.getWalletManager?.();
168779
+ if (walletManager) {
168780
+ walletManager.list().then((cards) => {
168781
+ setWalletCards(cards);
168782
+ setWalletError(null);
168783
+ setShowWalletPanel(true);
168784
+ }).catch((err) => {
168785
+ setWalletError(err instanceof Error ? err.message : String(err));
168786
+ setShowWalletPanel(true);
168787
+ });
168788
+ } else {
168789
+ setWalletError("Wallet not enabled. Configure wallet in config.json.");
168790
+ setShowWalletPanel(true);
168791
+ }
168792
+ } else if (chunk.panel === "secrets") {
168793
+ const secretsManager = registry3.getActiveSession()?.client.getSecretsManager?.();
168794
+ if (secretsManager) {
168795
+ secretsManager.list("all").then((secrets2) => {
168796
+ setSecretsList(secrets2);
168797
+ setSecretsError(null);
168798
+ setShowSecretsPanel(true);
168799
+ }).catch((err) => {
168800
+ setSecretsError(err instanceof Error ? err.message : String(err));
168801
+ setShowSecretsPanel(true);
168802
+ });
168803
+ } else {
168804
+ setSecretsError("Secrets not enabled. Configure secrets in config.json.");
168805
+ setShowSecretsPanel(true);
168806
+ }
166828
168807
  }
166829
168808
  }
166830
168809
  }, [registry3, exit, finalizeResponse2, resetTurnState, cwd, activeSessionId]);
@@ -166937,7 +168916,7 @@ function App({ cwd, version: version3 }) {
166937
168916
  setIsInitializing(false);
166938
168917
  });
166939
168918
  }, [recoverableSessions, createSessionFromRecovery]);
166940
- useEffect12(() => {
168919
+ useEffect14(() => {
166941
168920
  if (initStateRef.current === "done")
166942
168921
  return;
166943
168922
  if (initStateRef.current === "pending")
@@ -166969,7 +168948,7 @@ function App({ cwd, version: version3 }) {
166969
168948
  cancelled = true;
166970
168949
  };
166971
168950
  }, [cwd, registry3, showRecoveryPanel, recoverableSessions, createSessionFromRecovery]);
166972
- useEffect12(() => {
168951
+ useEffect14(() => {
166973
168952
  isMountedRef.current = true;
166974
168953
  return () => {
166975
168954
  isMountedRef.current = false;
@@ -167036,7 +169015,7 @@ function App({ cwd, version: version3 }) {
167036
169015
  }, [activeSessionId, clearPendingSend]);
167037
169016
  const activeQueue = activeSessionId ? messageQueue.filter((msg) => msg.sessionId === activeSessionId) : [];
167038
169017
  const activeInline = activeSessionId ? inlinePending.filter((msg) => msg.sessionId === activeSessionId) : [];
167039
- const queuedMessageIds = useMemo11(() => new Set(activeQueue.filter((msg) => msg.mode === "queued").map((msg) => msg.id)), [activeQueue]);
169018
+ const queuedMessageIds = useMemo13(() => new Set(activeQueue.filter((msg) => msg.mode === "queued").map((msg) => msg.id)), [activeQueue]);
167040
169019
  const sessions = registry3.listSessions();
167041
169020
  const activeSession = registry3.getActiveSession();
167042
169021
  const sessionIndex = activeSessionId ? registry3.getSessionIndex(activeSessionId) : 0;
@@ -167046,7 +169025,7 @@ function App({ cwd, version: version3 }) {
167046
169025
  const inlineCount = activeInline.length;
167047
169026
  const activeAskQuestion = askUserState && askUserState.sessionId === activeSessionId ? askUserState.request.questions[askUserState.index] : undefined;
167048
169027
  const askPlaceholder = activeAskQuestion?.placeholder || activeAskQuestion?.question || "Answer the question...";
167049
- const hasPendingTools = useMemo11(() => {
169028
+ const hasPendingTools = useMemo13(() => {
167050
169029
  const toolResultIds = new Set;
167051
169030
  for (const entry of activityLog) {
167052
169031
  if (entry.type === "tool_result" && entry.toolResult) {
@@ -167066,10 +169045,10 @@ function App({ cwd, version: version3 }) {
167066
169045
  const showWelcome = messages2.length === 0 && !isProcessing;
167067
169046
  const renderWidth = columns ? Math.max(1, columns - 2) : undefined;
167068
169047
  const wrapChars = renderWidth ?? MESSAGE_WRAP_CHARS;
167069
- const displayMessages = useMemo11(() => buildDisplayMessages(messages2, MESSAGE_CHUNK_LINES, wrapChars, { maxWidth: renderWidth }), [messages2, wrapChars, renderWidth]);
169048
+ const displayMessages = useMemo13(() => buildDisplayMessages(messages2, MESSAGE_CHUNK_LINES, wrapChars, { maxWidth: renderWidth }), [messages2, wrapChars, renderWidth]);
167070
169049
  const reservedLines = 12;
167071
169050
  const dynamicBudget = Math.max(6, rows - reservedLines);
167072
- const streamingTrim = useMemo11(() => {
169051
+ const streamingTrim = useMemo13(() => {
167073
169052
  if (!isProcessing || !currentResponse.trim()) {
167074
169053
  return { messages: [], trimmed: false };
167075
169054
  }
@@ -167084,12 +169063,12 @@ function App({ cwd, version: version3 }) {
167084
169063
  }, [currentResponse, isProcessing, wrapChars, renderWidth, dynamicBudget]);
167085
169064
  const streamingMessages = streamingTrim.messages;
167086
169065
  const streamingTrimmed = streamingTrim.trimmed;
167087
- const streamingLineCount = useMemo11(() => estimateDisplayMessagesLines(streamingMessages, renderWidth), [streamingMessages, renderWidth]);
167088
- const activityTrim = useMemo11(() => {
169066
+ const streamingLineCount = useMemo13(() => estimateDisplayMessagesLines(streamingMessages, renderWidth), [streamingMessages, renderWidth]);
169067
+ const activityTrim = useMemo13(() => {
167089
169068
  const activityBudget = Math.max(4, dynamicBudget - streamingLineCount);
167090
169069
  return trimActivityLogByLines(activityLog, wrapChars, renderWidth, activityBudget);
167091
169070
  }, [activityLog, wrapChars, renderWidth, dynamicBudget, streamingLineCount]);
167092
- useEffect12(() => {
169071
+ useEffect14(() => {
167093
169072
  if (!isBusy && activeQueue.length > 0 && activeInline.length === 0) {
167094
169073
  processQueue();
167095
169074
  }
@@ -167134,7 +169113,7 @@ function App({ cwd, version: version3 }) {
167134
169113
  setError(err instanceof Error ? err.message : "Failed to create session");
167135
169114
  }
167136
169115
  }, [cwd, registry3, saveCurrentSessionState, loadSessionState, beginAskUser]);
167137
- useInput15((input, key) => {
169116
+ useInput19((input, key) => {
167138
169117
  if (key.ctrl && input === "]") {
167139
169118
  if (sessions.length > 0) {
167140
169119
  setShowSessionSelector(true);
@@ -167392,19 +169371,19 @@ function App({ cwd, version: version3 }) {
167392
169371
  clearPendingSend
167393
169372
  ]);
167394
169373
  if (isInitializing && !showRecoveryPanel) {
167395
- return /* @__PURE__ */ jsxDEV24(Box23, {
169374
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167396
169375
  flexDirection: "column",
167397
169376
  padding: 1,
167398
- children: /* @__PURE__ */ jsxDEV24(Spinner, {
169377
+ children: /* @__PURE__ */ jsxDEV28(Spinner, {
167399
169378
  label: "Initializing..."
167400
169379
  }, undefined, false, undefined, this)
167401
169380
  }, undefined, false, undefined, this);
167402
169381
  }
167403
169382
  if (showRecoveryPanel && recoverableSessions.length > 0) {
167404
- return /* @__PURE__ */ jsxDEV24(Box23, {
169383
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167405
169384
  flexDirection: "column",
167406
169385
  padding: 1,
167407
- children: /* @__PURE__ */ jsxDEV24(RecoveryPanel, {
169386
+ children: /* @__PURE__ */ jsxDEV28(RecoveryPanel, {
167408
169387
  sessions: recoverableSessions,
167409
169388
  onRecover: handleRecover,
167410
169389
  onStartFresh: handleStartFresh
@@ -167412,10 +169391,10 @@ function App({ cwd, version: version3 }) {
167412
169391
  }, undefined, false, undefined, this);
167413
169392
  }
167414
169393
  if (showSessionSelector) {
167415
- return /* @__PURE__ */ jsxDEV24(Box23, {
169394
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167416
169395
  flexDirection: "column",
167417
169396
  padding: 1,
167418
- children: /* @__PURE__ */ jsxDEV24(SessionSelector, {
169397
+ children: /* @__PURE__ */ jsxDEV28(SessionSelector, {
167419
169398
  sessions,
167420
169399
  activeSessionId,
167421
169400
  onSelect: handleSessionSwitch,
@@ -167437,10 +169416,10 @@ function App({ cwd, version: version3 }) {
167437
169416
  }
167438
169417
  return connectorBridgeRef.current.getCommandHelp(connector, command);
167439
169418
  };
167440
- return /* @__PURE__ */ jsxDEV24(Box23, {
169419
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167441
169420
  flexDirection: "column",
167442
169421
  padding: 1,
167443
- children: /* @__PURE__ */ jsxDEV24(ConnectorsPanel, {
169422
+ children: /* @__PURE__ */ jsxDEV28(ConnectorsPanel, {
167444
169423
  connectors,
167445
169424
  initialConnector: connectorsPanelInitial,
167446
169425
  onCheckAuth: handleCheckAuth,
@@ -167489,10 +169468,10 @@ When done, report the result.`);
167489
169468
  await updateTask(cwd, id, { priority });
167490
169469
  setTasksList(await getTasks(cwd));
167491
169470
  };
167492
- return /* @__PURE__ */ jsxDEV24(Box23, {
169471
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167493
169472
  flexDirection: "column",
167494
169473
  padding: 1,
167495
- children: /* @__PURE__ */ jsxDEV24(TasksPanel, {
169474
+ children: /* @__PURE__ */ jsxDEV28(TasksPanel, {
167496
169475
  tasks: tasksList,
167497
169476
  paused: tasksPaused,
167498
169477
  onAdd: handleTasksAdd,
@@ -167540,10 +169519,10 @@ When done, report the result.`);
167540
169519
  const handleScheduleRefresh = async () => {
167541
169520
  setSchedulesList(await listSchedules(cwd));
167542
169521
  };
167543
- return /* @__PURE__ */ jsxDEV24(Box23, {
169522
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167544
169523
  flexDirection: "column",
167545
169524
  padding: 1,
167546
- children: /* @__PURE__ */ jsxDEV24(SchedulesPanel, {
169525
+ children: /* @__PURE__ */ jsxDEV28(SchedulesPanel, {
167547
169526
  schedules: schedulesList,
167548
169527
  onPause: handleSchedulePause,
167549
169528
  onResume: handleScheduleResume,
@@ -167614,10 +169593,10 @@ When done, report the result.`);
167614
169593
  throw err;
167615
169594
  }
167616
169595
  };
167617
- return /* @__PURE__ */ jsxDEV24(Box23, {
169596
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167618
169597
  flexDirection: "column",
167619
169598
  padding: 1,
167620
- children: /* @__PURE__ */ jsxDEV24(AssistantsPanel, {
169599
+ children: /* @__PURE__ */ jsxDEV28(AssistantsPanel, {
167621
169600
  assistants: assistantsList,
167622
169601
  activeAssistantId,
167623
169602
  onSelect: handleAssistantSelect,
@@ -167662,10 +169641,10 @@ When done, report the result.`);
167662
169641
  nativeHookRegistry.setEnabled(hookId, enabled);
167663
169642
  };
167664
169643
  const nativeHooks = nativeHookRegistry.listFlat();
167665
- return /* @__PURE__ */ jsxDEV24(Box23, {
169644
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167666
169645
  flexDirection: "column",
167667
169646
  padding: 1,
167668
- children: /* @__PURE__ */ jsxDEV24(HooksPanel, {
169647
+ children: /* @__PURE__ */ jsxDEV28(HooksPanel, {
167669
169648
  hooks: hooksConfig,
167670
169649
  nativeHooks,
167671
169650
  onToggle: handleHookToggle,
@@ -167709,10 +169688,10 @@ When done, report the result.`);
167709
169688
  setGuardrailsConfig(config);
167710
169689
  setGuardrailsPolicies(policies);
167711
169690
  };
167712
- return /* @__PURE__ */ jsxDEV24(Box23, {
169691
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167713
169692
  flexDirection: "column",
167714
169693
  padding: 1,
167715
- children: /* @__PURE__ */ jsxDEV24(GuardrailsPanel, {
169694
+ children: /* @__PURE__ */ jsxDEV28(GuardrailsPanel, {
167716
169695
  config: guardrailsConfig,
167717
169696
  policies: guardrailsPolicies,
167718
169697
  onToggleEnabled: handleToggleEnabled,
@@ -167761,10 +169740,10 @@ When done, report the result.`);
167761
169740
  setSessionBudgetStatus(sessionStatus);
167762
169741
  setSwarmBudgetStatus(swarmStatus);
167763
169742
  };
167764
- return /* @__PURE__ */ jsxDEV24(Box23, {
169743
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167765
169744
  flexDirection: "column",
167766
169745
  padding: 1,
167767
- children: /* @__PURE__ */ jsxDEV24(BudgetPanel, {
169746
+ children: /* @__PURE__ */ jsxDEV28(BudgetPanel, {
167768
169747
  config: budgetConfig,
167769
169748
  sessionStatus: sessionBudgetStatus,
167770
169749
  swarmStatus: swarmBudgetStatus,
@@ -167783,10 +169762,10 @@ When done, report the result.`);
167783
169762
  setAgentsList(agents);
167784
169763
  setRegistryStats(stats);
167785
169764
  };
167786
- return /* @__PURE__ */ jsxDEV24(Box23, {
169765
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167787
169766
  flexDirection: "column",
167788
169767
  padding: 1,
167789
- children: /* @__PURE__ */ jsxDEV24(AgentsPanel, {
169768
+ children: /* @__PURE__ */ jsxDEV28(AgentsPanel, {
167790
169769
  agents: agentsList,
167791
169770
  stats: registryStats,
167792
169771
  onRefresh: handleAgentsRefresh,
@@ -167794,6 +169773,188 @@ When done, report the result.`);
167794
169773
  }, undefined, false, undefined, this)
167795
169774
  }, undefined, false, undefined, this);
167796
169775
  }
169776
+ if (showProjectsPanel) {
169777
+ const handleProjectSelect = (projectId) => {
169778
+ const activeSession2 = registry3.getActiveSession();
169779
+ activeSession2?.client.setActiveProjectId?.(projectId);
169780
+ setActiveProjectId(projectId);
169781
+ setShowProjectsPanel(false);
169782
+ };
169783
+ const handleProjectCreate = async (name2, description) => {
169784
+ const project = await createProject(cwd, name2, description);
169785
+ const projects2 = await listProjects(cwd);
169786
+ setProjectsList(projects2);
169787
+ const activeSession2 = registry3.getActiveSession();
169788
+ activeSession2?.client.setActiveProjectId?.(project.id);
169789
+ setActiveProjectId(project.id);
169790
+ };
169791
+ const handleProjectDelete = async (projectId) => {
169792
+ await deleteProject(cwd, projectId);
169793
+ const projects2 = await listProjects(cwd);
169794
+ setProjectsList(projects2);
169795
+ if (activeProjectId === projectId) {
169796
+ const activeSession2 = registry3.getActiveSession();
169797
+ activeSession2?.client.setActiveProjectId?.(null);
169798
+ setActiveProjectId(undefined);
169799
+ }
169800
+ };
169801
+ const handleViewPlans = (projectId) => {
169802
+ readProject(cwd, projectId).then((project) => {
169803
+ if (project) {
169804
+ setPlansProject(project);
169805
+ setShowProjectsPanel(false);
169806
+ setShowPlansPanel(true);
169807
+ }
169808
+ });
169809
+ };
169810
+ return /* @__PURE__ */ jsxDEV28(Box27, {
169811
+ flexDirection: "column",
169812
+ padding: 1,
169813
+ children: /* @__PURE__ */ jsxDEV28(ProjectsPanel, {
169814
+ projects: projectsList,
169815
+ activeProjectId,
169816
+ onSelect: handleProjectSelect,
169817
+ onCreate: handleProjectCreate,
169818
+ onDelete: handleProjectDelete,
169819
+ onViewPlans: handleViewPlans,
169820
+ onCancel: () => setShowProjectsPanel(false)
169821
+ }, undefined, false, undefined, this)
169822
+ }, undefined, false, undefined, this);
169823
+ }
169824
+ if (showPlansPanel && plansProject) {
169825
+ const handleCreatePlan = async (title) => {
169826
+ const now2 = Date.now();
169827
+ const plan = {
169828
+ id: `plan-${now2}`,
169829
+ title,
169830
+ createdAt: now2,
169831
+ updatedAt: now2,
169832
+ steps: []
169833
+ };
169834
+ const updated = await updateProject(cwd, plansProject.id, (current) => ({
169835
+ ...current,
169836
+ plans: [...current.plans, plan],
169837
+ updatedAt: now2
169838
+ }));
169839
+ if (updated)
169840
+ setPlansProject(updated);
169841
+ };
169842
+ const handleDeletePlan = async (planId) => {
169843
+ const now2 = Date.now();
169844
+ const updated = await updateProject(cwd, plansProject.id, (current) => ({
169845
+ ...current,
169846
+ plans: current.plans.filter((p5) => p5.id !== planId),
169847
+ updatedAt: now2
169848
+ }));
169849
+ if (updated)
169850
+ setPlansProject(updated);
169851
+ };
169852
+ const handleAddStep = async (planId, text) => {
169853
+ const now2 = Date.now();
169854
+ const updated = await updateProject(cwd, plansProject.id, (current) => ({
169855
+ ...current,
169856
+ plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: [...p5.steps, { id: `step-${now2}`, text, status: "todo", createdAt: now2, updatedAt: now2 }], updatedAt: now2 } : p5),
169857
+ updatedAt: now2
169858
+ }));
169859
+ if (updated)
169860
+ setPlansProject(updated);
169861
+ };
169862
+ const handleUpdateStep = async (planId, stepId, status) => {
169863
+ const now2 = Date.now();
169864
+ const updated = await updateProject(cwd, plansProject.id, (current) => ({
169865
+ ...current,
169866
+ plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.map((s6) => s6.id === stepId ? { ...s6, status, updatedAt: now2 } : s6), updatedAt: now2 } : p5),
169867
+ updatedAt: now2
169868
+ }));
169869
+ if (updated)
169870
+ setPlansProject(updated);
169871
+ };
169872
+ const handleRemoveStep = async (planId, stepId) => {
169873
+ const now2 = Date.now();
169874
+ const updated = await updateProject(cwd, plansProject.id, (current) => ({
169875
+ ...current,
169876
+ plans: current.plans.map((p5) => p5.id === planId ? { ...p5, steps: p5.steps.filter((s6) => s6.id !== stepId), updatedAt: now2 } : p5),
169877
+ updatedAt: now2
169878
+ }));
169879
+ if (updated)
169880
+ setPlansProject(updated);
169881
+ };
169882
+ const handleBack = () => {
169883
+ setShowPlansPanel(false);
169884
+ listProjects(cwd).then((projects2) => {
169885
+ setProjectsList(projects2);
169886
+ setShowProjectsPanel(true);
169887
+ });
169888
+ };
169889
+ return /* @__PURE__ */ jsxDEV28(Box27, {
169890
+ flexDirection: "column",
169891
+ padding: 1,
169892
+ children: /* @__PURE__ */ jsxDEV28(PlansPanel, {
169893
+ project: plansProject,
169894
+ onCreatePlan: handleCreatePlan,
169895
+ onDeletePlan: handleDeletePlan,
169896
+ onAddStep: handleAddStep,
169897
+ onUpdateStep: handleUpdateStep,
169898
+ onRemoveStep: handleRemoveStep,
169899
+ onBack: handleBack,
169900
+ onClose: () => setShowPlansPanel(false)
169901
+ }, undefined, false, undefined, this)
169902
+ }, undefined, false, undefined, this);
169903
+ }
169904
+ if (showWalletPanel) {
169905
+ const walletManager = activeSession?.client.getWalletManager?.();
169906
+ const handleWalletGet = async (cardId) => {
169907
+ if (!walletManager)
169908
+ throw new Error("Wallet not available");
169909
+ const card = await walletManager.get(cardId);
169910
+ return card;
169911
+ };
169912
+ const handleWalletRemove = async (cardId) => {
169913
+ if (!walletManager)
169914
+ throw new Error("Wallet not available");
169915
+ await walletManager.remove(cardId);
169916
+ const cards = await walletManager.list();
169917
+ setWalletCards(cards);
169918
+ };
169919
+ return /* @__PURE__ */ jsxDEV28(Box27, {
169920
+ flexDirection: "column",
169921
+ padding: 1,
169922
+ children: /* @__PURE__ */ jsxDEV28(WalletPanel, {
169923
+ cards: walletCards,
169924
+ onGet: handleWalletGet,
169925
+ onRemove: handleWalletRemove,
169926
+ onClose: () => setShowWalletPanel(false),
169927
+ error: walletError
169928
+ }, undefined, false, undefined, this)
169929
+ }, undefined, false, undefined, this);
169930
+ }
169931
+ if (showSecretsPanel) {
169932
+ const secretsManager = activeSession?.client.getSecretsManager?.();
169933
+ const handleSecretsGet = async (name2, scope) => {
169934
+ if (!secretsManager)
169935
+ throw new Error("Secrets not available");
169936
+ const value = await secretsManager.get(name2, scope, "plain");
169937
+ return value || "";
169938
+ };
169939
+ const handleSecretsDelete = async (name2, scope) => {
169940
+ if (!secretsManager)
169941
+ throw new Error("Secrets not available");
169942
+ await secretsManager.delete(name2, scope);
169943
+ const secrets2 = await secretsManager.list("all");
169944
+ setSecretsList(secrets2);
169945
+ };
169946
+ return /* @__PURE__ */ jsxDEV28(Box27, {
169947
+ flexDirection: "column",
169948
+ padding: 1,
169949
+ children: /* @__PURE__ */ jsxDEV28(SecretsPanel, {
169950
+ secrets: secretsList,
169951
+ onGet: handleSecretsGet,
169952
+ onDelete: handleSecretsDelete,
169953
+ onClose: () => setShowSecretsPanel(false),
169954
+ error: secretsError
169955
+ }, undefined, false, undefined, this)
169956
+ }, undefined, false, undefined, this);
169957
+ }
167797
169958
  if (showConfigPanel && currentConfig) {
167798
169959
  const handleConfigSave = async (location, updates) => {
167799
169960
  const { writeFile: writeFile13, mkdir: mkdir13 } = await import("fs/promises");
@@ -167819,10 +169980,10 @@ When done, report the result.`);
167819
169980
  await writeFile13(configPath, JSON.stringify(newConfig, null, 2));
167820
169981
  await loadConfigFiles();
167821
169982
  };
167822
- return /* @__PURE__ */ jsxDEV24(Box23, {
169983
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167823
169984
  flexDirection: "column",
167824
169985
  padding: 1,
167825
- children: /* @__PURE__ */ jsxDEV24(ConfigPanel, {
169986
+ children: /* @__PURE__ */ jsxDEV28(ConfigPanel, {
167826
169987
  config: currentConfig,
167827
169988
  userConfig,
167828
169989
  projectConfig,
@@ -167907,37 +170068,37 @@ ${msg.body || msg.preview}`);
167907
170068
  });
167908
170069
  };
167909
170070
  if (!messagesManager) {
167910
- return /* @__PURE__ */ jsxDEV24(Box23, {
170071
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167911
170072
  flexDirection: "column",
167912
170073
  padding: 1,
167913
170074
  children: [
167914
- /* @__PURE__ */ jsxDEV24(Box23, {
170075
+ /* @__PURE__ */ jsxDEV28(Box27, {
167915
170076
  marginBottom: 1,
167916
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170077
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
167917
170078
  bold: true,
167918
170079
  color: "cyan",
167919
170080
  children: "Messages"
167920
170081
  }, undefined, false, undefined, this)
167921
170082
  }, undefined, false, undefined, this),
167922
- /* @__PURE__ */ jsxDEV24(Box23, {
170083
+ /* @__PURE__ */ jsxDEV28(Box27, {
167923
170084
  flexDirection: "column",
167924
170085
  borderStyle: "round",
167925
170086
  borderColor: "gray",
167926
170087
  paddingX: 1,
167927
170088
  paddingY: 1,
167928
170089
  children: [
167929
- /* @__PURE__ */ jsxDEV24(Text26, {
170090
+ /* @__PURE__ */ jsxDEV28(Text30, {
167930
170091
  children: "Messages are not enabled."
167931
170092
  }, undefined, false, undefined, this),
167932
- /* @__PURE__ */ jsxDEV24(Text26, {
170093
+ /* @__PURE__ */ jsxDEV28(Text30, {
167933
170094
  dimColor: true,
167934
170095
  children: "Configure messages in config.json to enable."
167935
170096
  }, undefined, false, undefined, this)
167936
170097
  ]
167937
170098
  }, undefined, true, undefined, this),
167938
- /* @__PURE__ */ jsxDEV24(Box23, {
170099
+ /* @__PURE__ */ jsxDEV28(Box27, {
167939
170100
  marginTop: 1,
167940
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170101
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
167941
170102
  dimColor: true,
167942
170103
  children: "q quit"
167943
170104
  }, undefined, false, undefined, this)
@@ -167945,10 +170106,10 @@ ${msg.body || msg.preview}`);
167945
170106
  ]
167946
170107
  }, undefined, true, undefined, this);
167947
170108
  }
167948
- return /* @__PURE__ */ jsxDEV24(Box23, {
170109
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167949
170110
  flexDirection: "column",
167950
170111
  padding: 1,
167951
- children: /* @__PURE__ */ jsxDEV24(MessagesPanel, {
170112
+ children: /* @__PURE__ */ jsxDEV28(MessagesPanel, {
167952
170113
  messages: messagesList,
167953
170114
  onRead: handleMessagesRead,
167954
170115
  onDelete: handleMessagesDelete,
@@ -167964,18 +170125,18 @@ ${msg.body || msg.preview}`);
167964
170125
  return { toolCall: e6.toolCall, result };
167965
170126
  });
167966
170127
  const isThinking = isProcessing && !currentResponse && !currentToolCall && toolCallEntries.length === 0;
167967
- return /* @__PURE__ */ jsxDEV24(Box23, {
170128
+ return /* @__PURE__ */ jsxDEV28(Box27, {
167968
170129
  flexDirection: "column",
167969
170130
  padding: 1,
167970
170131
  children: [
167971
- showWelcome && /* @__PURE__ */ jsxDEV24(WelcomeBanner, {
170132
+ showWelcome && /* @__PURE__ */ jsxDEV28(WelcomeBanner, {
167972
170133
  version: version3 ?? "unknown",
167973
170134
  model: activeSession?.client.getModel() ?? "unknown",
167974
170135
  directory: activeSession?.cwd || cwd
167975
170136
  }, undefined, false, undefined, this),
167976
- backgroundProcessingCount > 0 && /* @__PURE__ */ jsxDEV24(Box23, {
170137
+ backgroundProcessingCount > 0 && /* @__PURE__ */ jsxDEV28(Box27, {
167977
170138
  marginBottom: 1,
167978
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170139
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
167979
170140
  color: "yellow",
167980
170141
  children: [
167981
170142
  backgroundProcessingCount,
@@ -167985,9 +170146,9 @@ ${msg.body || msg.preview}`);
167985
170146
  ]
167986
170147
  }, undefined, true, undefined, this)
167987
170148
  }, undefined, false, undefined, this),
167988
- /* @__PURE__ */ jsxDEV24(Static, {
170149
+ /* @__PURE__ */ jsxDEV28(Static, {
167989
170150
  items: displayMessages,
167990
- children: (message) => /* @__PURE__ */ jsxDEV24(Messages5, {
170151
+ children: (message) => /* @__PURE__ */ jsxDEV28(Messages5, {
167991
170152
  messages: [message],
167992
170153
  currentResponse: undefined,
167993
170154
  streamingMessages: [],
@@ -167998,23 +170159,23 @@ ${msg.body || msg.preview}`);
167998
170159
  verboseTools
167999
170160
  }, message.id, false, undefined, this)
168000
170161
  }, undefined, false, undefined, this),
168001
- isProcessing && /* @__PURE__ */ jsxDEV24(Fragment7, {
170162
+ isProcessing && /* @__PURE__ */ jsxDEV28(Fragment7, {
168002
170163
  children: [
168003
- streamingTrimmed && /* @__PURE__ */ jsxDEV24(Box23, {
170164
+ streamingTrimmed && /* @__PURE__ */ jsxDEV28(Box27, {
168004
170165
  marginBottom: 1,
168005
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170166
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
168006
170167
  dimColor: true,
168007
170168
  children: "\u22EF showing latest output"
168008
170169
  }, undefined, false, undefined, this)
168009
170170
  }, undefined, false, undefined, this),
168010
- activityTrim.trimmed && /* @__PURE__ */ jsxDEV24(Box23, {
170171
+ activityTrim.trimmed && /* @__PURE__ */ jsxDEV28(Box27, {
168011
170172
  marginBottom: 1,
168012
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170173
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
168013
170174
  dimColor: true,
168014
170175
  children: "\u22EF showing latest activity"
168015
170176
  }, undefined, false, undefined, this)
168016
170177
  }, undefined, false, undefined, this),
168017
- /* @__PURE__ */ jsxDEV24(Messages5, {
170178
+ /* @__PURE__ */ jsxDEV28(Messages5, {
168018
170179
  messages: [],
168019
170180
  currentResponse: undefined,
168020
170181
  streamingMessages,
@@ -168026,31 +170187,31 @@ ${msg.body || msg.preview}`);
168026
170187
  }, "streaming", false, undefined, this)
168027
170188
  ]
168028
170189
  }, undefined, true, undefined, this),
168029
- /* @__PURE__ */ jsxDEV24(QueueIndicator, {
170190
+ /* @__PURE__ */ jsxDEV28(QueueIndicator, {
168030
170191
  messages: [...activeInline, ...activeQueue],
168031
170192
  maxPreview: MAX_QUEUED_PREVIEW
168032
170193
  }, undefined, false, undefined, this),
168033
- askUserState && activeAskQuestion && /* @__PURE__ */ jsxDEV24(AskUserPanel, {
170194
+ askUserState && activeAskQuestion && /* @__PURE__ */ jsxDEV28(AskUserPanel, {
168034
170195
  sessionId: askUserState.sessionId,
168035
170196
  request: askUserState.request,
168036
170197
  question: activeAskQuestion,
168037
170198
  index: askUserState.index,
168038
170199
  total: askUserState.request.questions.length
168039
170200
  }, undefined, false, undefined, this),
168040
- error2 && /* @__PURE__ */ jsxDEV24(ErrorBanner, {
170201
+ error2 && /* @__PURE__ */ jsxDEV28(ErrorBanner, {
168041
170202
  error: error2,
168042
170203
  showErrorCodes: SHOW_ERROR_CODES
168043
170204
  }, undefined, false, undefined, this),
168044
- /* @__PURE__ */ jsxDEV24(ProcessingIndicator, {
170205
+ /* @__PURE__ */ jsxDEV28(ProcessingIndicator, {
168045
170206
  isProcessing,
168046
170207
  startTime: processingStartTime,
168047
170208
  tokenCount: currentTurnTokens,
168048
170209
  isThinking
168049
170210
  }, undefined, false, undefined, this),
168050
- !isProcessing && lastWorkedFor && /* @__PURE__ */ jsxDEV24(Box23, {
170211
+ !isProcessing && lastWorkedFor && /* @__PURE__ */ jsxDEV28(Box27, {
168051
170212
  marginBottom: 0,
168052
170213
  marginLeft: 2,
168053
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170214
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
168054
170215
  color: "gray",
168055
170216
  children: [
168056
170217
  "\u273B Worked for ",
@@ -168058,15 +170219,15 @@ ${msg.body || msg.preview}`);
168058
170219
  ]
168059
170220
  }, undefined, true, undefined, this)
168060
170221
  }, undefined, false, undefined, this),
168061
- showExitHint && /* @__PURE__ */ jsxDEV24(Box23, {
170222
+ showExitHint && /* @__PURE__ */ jsxDEV28(Box27, {
168062
170223
  marginLeft: 2,
168063
170224
  marginBottom: 0,
168064
- children: /* @__PURE__ */ jsxDEV24(Text26, {
170225
+ children: /* @__PURE__ */ jsxDEV28(Text30, {
168065
170226
  color: "yellow",
168066
170227
  children: "(Press Ctrl+C again to exit)"
168067
170228
  }, undefined, false, undefined, this)
168068
170229
  }, undefined, false, undefined, this),
168069
- /* @__PURE__ */ jsxDEV24(Input, {
170230
+ /* @__PURE__ */ jsxDEV28(Input, {
168070
170231
  onSubmit: handleSubmit,
168071
170232
  isProcessing: isBusy,
168072
170233
  queueLength: activeQueue.length + inlineCount,
@@ -168076,7 +170237,7 @@ ${msg.body || msg.preview}`);
168076
170237
  askPlaceholder,
168077
170238
  allowBlankAnswer: activeAskQuestion?.required === false
168078
170239
  }, undefined, false, undefined, this),
168079
- /* @__PURE__ */ jsxDEV24(Status, {
170240
+ /* @__PURE__ */ jsxDEV28(Status, {
168080
170241
  isProcessing: isBusy,
168081
170242
  cwd: activeSession?.cwd || cwd,
168082
170243
  queueLength: activeQueue.length + inlineCount,
@@ -168432,7 +170593,7 @@ function parseArgs(argv) {
168432
170593
  }
168433
170594
 
168434
170595
  // src/cli.tsx
168435
- import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
170596
+ import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
168436
170597
  setRuntime(bunRuntime);
168437
170598
  var VERSION4 = "dev";
168438
170599
  var SYNC_START = "\x1B[?2026h";
@@ -168557,7 +170718,7 @@ if (options.print !== null) {
168557
170718
  } else {
168558
170719
  const useSyncOutput = process.env.ASSISTANTS_NO_SYNC !== "1";
168559
170720
  const disableSyncOutput = useSyncOutput ? enableSynchronizedOutput() : () => {};
168560
- const { waitUntilExit } = render3(/* @__PURE__ */ jsxDEV25(App, {
170721
+ const { waitUntilExit } = render3(/* @__PURE__ */ jsxDEV29(App, {
168561
170722
  cwd: options.cwd,
168562
170723
  version: VERSION4
168563
170724
  }, undefined, false, undefined, this), {