@hasna/assistants 1.1.67 → 1.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11235,8 +11235,35 @@ var init_connector = __esm(async () => {
11235
11235
  }
11236
11236
  } catch {}
11237
11237
  }
11238
+ const connectorsDir = join7(baseCwd, ".connectors");
11239
+ try {
11240
+ const entries = readdirSync3(connectorsDir);
11241
+ for (const entry of entries) {
11242
+ if (!entry.startsWith("connect-"))
11243
+ continue;
11244
+ const name = entry.replace("connect-", "");
11245
+ if (name && !name.includes(".")) {
11246
+ connectorNames.add(name);
11247
+ }
11248
+ }
11249
+ } catch {}
11238
11250
  return Array.from(connectorNames);
11239
11251
  }
11252
+ async ensureConnectorBuilt(connectorDir) {
11253
+ const binPath = join7(connectorDir, "bin", "index.js");
11254
+ if (existsSync6(binPath))
11255
+ return true;
11256
+ const pkgPath = join7(connectorDir, "package.json");
11257
+ if (!existsSync6(pkgPath))
11258
+ return false;
11259
+ try {
11260
+ const runtime = getRuntime();
11261
+ await runtime.shell`cd ${connectorDir} && bun install --silent && bun run build`.quiet().nothrow();
11262
+ return existsSync6(binPath);
11263
+ } catch {
11264
+ return false;
11265
+ }
11266
+ }
11240
11267
  fastDiscover(connectorNames) {
11241
11268
  this.connectors.clear();
11242
11269
  if (ConnectorBridge.cache.size > 0) {
@@ -11367,6 +11394,15 @@ var init_connector = __esm(async () => {
11367
11394
  }
11368
11395
  }
11369
11396
  async resolveConnectorCli(name) {
11397
+ const baseCwd = this.cwd || process.cwd();
11398
+ const connectorDir = join7(baseCwd, ".connectors", `connect-${name}`);
11399
+ const connectorBin = join7(connectorDir, "bin", "index.js");
11400
+ if (existsSync6(join7(connectorDir, "package.json"))) {
11401
+ const built = await this.ensureConnectorBuilt(connectorDir);
11402
+ if (built && existsSync6(connectorBin)) {
11403
+ return connectorBin;
11404
+ }
11405
+ }
11370
11406
  const base = `connect-${name}`;
11371
11407
  const candidates = [base];
11372
11408
  const extCandidates = [".exe", ".cmd", ".bat", ".ps1"];
@@ -89205,7 +89241,7 @@ Not a git repository or git not available.
89205
89241
  context.setProjectContext(projectContext);
89206
89242
  }
89207
89243
  }
89208
- var VERSION2 = "1.1.67";
89244
+ var VERSION2 = "1.1.69";
89209
89245
  var init_builtin = __esm(async () => {
89210
89246
  init_src2();
89211
89247
  init_context3();
@@ -233829,6 +233865,11 @@ var Input = import_react30.default.forwardRef(function Input2({
233829
233865
  }
233830
233866
  if (!isAskingUser) {
233831
233867
  if (key.tab) {
233868
+ if (isProcessing && value.trim()) {
233869
+ onSubmit(value, "queue");
233870
+ setValueAndCursor("");
233871
+ return;
233872
+ }
233832
233873
  if (autocompleteItems.length > 0) {
233833
233874
  const selected = autocompleteItems[selectedIndex] || autocompleteItems[0];
233834
233875
  if (autocompleteMode === "file") {
@@ -233842,11 +233883,6 @@ var Input = import_react30.default.forwardRef(function Input2({
233842
233883
  }
233843
233884
  return;
233844
233885
  }
233845
- if (isProcessing && value.trim()) {
233846
- onSubmit(value, "queue");
233847
- setValueAndCursor("");
233848
- return;
233849
- }
233850
233886
  }
233851
233887
  if (autocompleteItems.length > 0 && !value.includes(`
233852
233888
  `)) {
@@ -256431,7 +256467,7 @@ function ModelPanel({
256431
256467
  }
256432
256468
  setIsSwitching(true);
256433
256469
  onSelectModel(row.model.id).then(() => {
256434
- setStatus({ type: "success", text: `Switched to ${row.model.name}.` });
256470
+ onCancel();
256435
256471
  }).catch((err) => {
256436
256472
  const message = err instanceof Error ? err.message : String(err);
256437
256473
  setStatus({ type: "error", text: message });
@@ -264798,6 +264834,7 @@ function App2({ cwd: cwd3, version: version4 }) {
264798
264834
  const [isProcessing, setIsProcessing] = import_react86.useState(false);
264799
264835
  const [error4, setError] = import_react86.useState(null);
264800
264836
  const [messageQueue, setMessageQueue] = import_react86.useState([]);
264837
+ const messageQueueRef = import_react86.useRef([]);
264801
264838
  const [inlinePending, setInlinePending] = import_react86.useState([]);
264802
264839
  const [activityLog, setActivityLog] = import_react86.useState([]);
264803
264840
  const [tokenUsage, setTokenUsage] = import_react86.useState();
@@ -266295,12 +266332,15 @@ function App2({ cwd: cwd3, version: version4 }) {
266295
266332
  }, [registry3]);
266296
266333
  const processQueue = import_react86.useCallback(async () => {
266297
266334
  const activeSession2 = registryRef.current.getActiveSession();
266298
- if (!activeSession2 || !activeSessionId)
266335
+ if (!activeSessionId || !activeSession2)
266299
266336
  return;
266300
- const { next: nextMessage, remaining } = takeNextQueuedMessage(messageQueue, activeSessionId);
266337
+ const currentQueue = messageQueueRef.current;
266338
+ const { next: nextMessage } = takeNextQueuedMessage(currentQueue, activeSessionId);
266301
266339
  if (!nextMessage)
266302
266340
  return;
266303
- setMessageQueue(remaining);
266341
+ setMessageQueue((prev) => prev.filter((msg) => msg.id !== nextMessage.id));
266342
+ setInlinePending((prev) => prev.filter((msg) => msg.sessionId !== activeSessionId));
266343
+ pendingSendsRef.current = pendingSendsRef.current.filter((entry) => entry.sessionId !== activeSessionId);
266304
266344
  const userMessage = {
266305
266345
  id: nextMessage.id,
266306
266346
  role: "user",
@@ -266339,7 +266379,7 @@ function App2({ cwd: cwd3, version: version4 }) {
266339
266379
  registryRef.current.setProcessing(activeSession2.id, false);
266340
266380
  setQueueFlushTrigger((prev) => prev + 1);
266341
266381
  }
266342
- }, [activeSessionId, clearPendingSend, messageQueue]);
266382
+ }, [activeSessionId, clearPendingSend]);
266343
266383
  const activeQueue = activeSessionId ? messageQueue.filter((msg) => msg.sessionId === activeSessionId) : [];
266344
266384
  const activeInline = activeSessionId ? inlinePending.filter((msg) => msg.sessionId === activeSessionId) : [];
266345
266385
  const queuedMessageIds = import_react86.useMemo(() => new Set(activeQueue.filter((msg) => msg.mode === "queued").map((msg) => msg.id)), [activeQueue]);
@@ -266402,6 +266442,9 @@ function App2({ cwd: cwd3, version: version4 }) {
266402
266442
  import_react86.useEffect(() => {
266403
266443
  hasPendingToolsRef.current = hasPendingTools;
266404
266444
  }, [hasPendingTools]);
266445
+ import_react86.useEffect(() => {
266446
+ messageQueueRef.current = messageQueue;
266447
+ }, [messageQueue]);
266405
266448
  const isBusy = isProcessing || hasPendingTools;
266406
266449
  const stopHint = isBusy && !activeAskQuestion ? "[esc] to stop" : null;
266407
266450
  const pttStatus = voiceState?.isTalking ? "talking" : pttTranscribing ? "transcribing" : pttRecording ? "recording" : null;
@@ -268022,9 +268065,20 @@ When done, report the result.`);
268022
268065
  const loop = activeSession.client.getAssistantLoop?.();
268023
268066
  if (loop && typeof loop.switchModel === "function") {
268024
268067
  await loop.switchModel(modelId);
268025
- return;
268068
+ } else {
268069
+ await activeSession.client.send(`/model ${modelId}`);
268026
268070
  }
268027
- await activeSession.client.send(`/model ${modelId}`);
268071
+ const displayName = getModelDisplayName(modelId);
268072
+ setShowModelPanel(false);
268073
+ setMessages((prev) => [
268074
+ ...prev,
268075
+ {
268076
+ id: generateId(),
268077
+ role: "assistant",
268078
+ content: `Switched model to **${displayName}** (\`${modelId}\`).`,
268079
+ timestamp: now()
268080
+ }
268081
+ ]);
268028
268082
  };
268029
268083
  return /* @__PURE__ */ jsx_dev_runtime51.jsxDEV(Box_default, {
268030
268084
  flexDirection: "column",
@@ -269393,7 +269447,7 @@ process.on("unhandledRejection", (reason) => {
269393
269447
  cleanup();
269394
269448
  process.exit(1);
269395
269449
  });
269396
- var VERSION4 = "1.1.67";
269450
+ var VERSION4 = "1.1.69";
269397
269451
  var SYNC_START = "\x1B[?2026h";
269398
269452
  var SYNC_END = "\x1B[?2026l";
269399
269453
  function enableSynchronizedOutput() {
@@ -269534,4 +269588,4 @@ export {
269534
269588
  main
269535
269589
  };
269536
269590
 
269537
- //# debugId=A5FDCCEC1934D13964756E2164756E21
269591
+ //# debugId=1C9BBD6FD909EAE064756E2164756E21