@hasna/assistants 1.1.68 → 1.1.70

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) {
@@ -11269,7 +11296,10 @@ var init_connector = __esm(async () => {
11269
11296
  if (cached === null) {
11270
11297
  continue;
11271
11298
  }
11272
- const connector = this.createMinimalConnector(name, `connect-${name}`);
11299
+ const cwdForResolve = this.cwd || process.cwd();
11300
+ const localBin = join7(cwdForResolve, ".connectors", `connect-${name}`, "bin", "index.js");
11301
+ const cli = existsSync6(localBin) ? localBin : `connect-${name}`;
11302
+ const connector = this.createMinimalConnector(name, cli);
11273
11303
  ConnectorBridge.cache.set(name, connector);
11274
11304
  this.connectors.set(connector.name, connector);
11275
11305
  connectors.push(connector);
@@ -11367,6 +11397,15 @@ var init_connector = __esm(async () => {
11367
11397
  }
11368
11398
  }
11369
11399
  async resolveConnectorCli(name) {
11400
+ const baseCwd = this.cwd || process.cwd();
11401
+ const connectorDir = join7(baseCwd, ".connectors", `connect-${name}`);
11402
+ const connectorBin = join7(connectorDir, "bin", "index.js");
11403
+ if (existsSync6(join7(connectorDir, "package.json"))) {
11404
+ const built = await this.ensureConnectorBuilt(connectorDir);
11405
+ if (built && existsSync6(connectorBin)) {
11406
+ return connectorBin;
11407
+ }
11408
+ }
11370
11409
  const base = `connect-${name}`;
11371
11410
  const candidates = [base];
11372
11411
  const extCandidates = [".exe", ".cmd", ".bat", ".ps1"];
@@ -24282,6 +24321,7 @@ var init_bash = __esm(async () => {
24282
24321
  "git tag",
24283
24322
  "connect-",
24284
24323
  "connect_",
24324
+ "connectors",
24285
24325
  "node --version",
24286
24326
  "bun --version",
24287
24327
  "npm --version",
@@ -24502,7 +24542,7 @@ var init_bash = __esm(async () => {
24502
24542
  }
24503
24543
  const baseCommand = command.replace(/\s*2>&1\s*/g, " ").trim();
24504
24544
  const baseTrimmed = baseCommand.toLowerCase();
24505
- const allowConnectorNewlines = baseTrimmed.startsWith("connect-") || baseTrimmed.startsWith("connect_");
24545
+ const allowConnectorNewlines = baseTrimmed.startsWith("connect-") || baseTrimmed.startsWith("connect_") || baseTrimmed.startsWith("connectors");
24506
24546
  const commandForExec = allowConnectorNewlines ? normalizeNewlinesOutsideQuotes(baseCommand).trim() : baseCommand;
24507
24547
  const commandForChecks = commandForExec;
24508
24548
  const commandSansQuotes = stripQuotedSegments(commandForChecks);
@@ -88784,9 +88824,9 @@ Connector "${connectorName}" not found.
88784
88824
  message += `No connectors found.
88785
88825
 
88786
88826
  `;
88787
- message += "Connectors are auto-discovered from installed `connect-*` CLIs on your PATH.\n";
88788
- message += `Install a connector with:
88789
- `;
88827
+ message += "Install connectors using the `connectors` CLI:\n";
88828
+ message += " `connectors install <name>` (e.g. `connectors install gmail`)\n\n";
88829
+ message += "Or install standalone `connect-*` CLIs:\n";
88790
88830
  message += " `bun add -g connect-<name>`\n\n";
88791
88831
  message += "Then run `/connectors` again to verify it is detected.\n";
88792
88832
  } else {
@@ -89205,7 +89245,7 @@ Not a git repository or git not available.
89205
89245
  context.setProjectContext(projectContext);
89206
89246
  }
89207
89247
  }
89208
- var VERSION2 = "1.1.68";
89248
+ var VERSION2 = "1.1.70";
89209
89249
  var init_builtin = __esm(async () => {
89210
89250
  init_src2();
89211
89251
  init_context3();
@@ -93706,7 +93746,7 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
93706
93746
  return `You are a helpful personal AI assistant running in the terminal.
93707
93747
 
93708
93748
  You have access to various tools and connectors:
93709
- - Connectors discovered from installed connect-* CLIs
93749
+ - Connectors installed via \`connectors install <name>\` or standalone connect-* CLIs. To install a new connector, use the bash tool to run \`connectors install <name>\`.
93710
93750
  - Filesystem operations (read, write, search files)
93711
93751
  - Shell command execution
93712
93752
  - Scheduling tools for recurring or delayed commands
@@ -94043,7 +94083,7 @@ ${systemPrompt}` : this.getDefaultSystemPrompt();
94043
94083
  return `You are a helpful personal AI assistant running in the terminal.
94044
94084
 
94045
94085
  You have access to various tools and connectors:
94046
- - Connectors discovered from installed connect-* CLIs
94086
+ - Connectors installed via \`connectors install <name>\` or standalone connect-* CLIs. To install a new connector, use the bash tool to run \`connectors install <name>\`.
94047
94087
  - Filesystem operations (read, write, search files)
94048
94088
  - Shell command execution
94049
94089
  - Scheduling tools for recurring or delayed commands
@@ -233829,6 +233869,11 @@ var Input = import_react30.default.forwardRef(function Input2({
233829
233869
  }
233830
233870
  if (!isAskingUser) {
233831
233871
  if (key.tab) {
233872
+ if (isProcessing && value.trim()) {
233873
+ onSubmit(value, "queue");
233874
+ setValueAndCursor("");
233875
+ return;
233876
+ }
233832
233877
  if (autocompleteItems.length > 0) {
233833
233878
  const selected = autocompleteItems[selectedIndex] || autocompleteItems[0];
233834
233879
  if (autocompleteMode === "file") {
@@ -233842,11 +233887,6 @@ var Input = import_react30.default.forwardRef(function Input2({
233842
233887
  }
233843
233888
  return;
233844
233889
  }
233845
- if (isProcessing && value.trim()) {
233846
- onSubmit(value, "queue");
233847
- setValueAndCursor("");
233848
- return;
233849
- }
233850
233890
  }
233851
233891
  if (autocompleteItems.length > 0 && !value.includes(`
233852
233892
  `)) {
@@ -264798,6 +264838,7 @@ function App2({ cwd: cwd3, version: version4 }) {
264798
264838
  const [isProcessing, setIsProcessing] = import_react86.useState(false);
264799
264839
  const [error4, setError] = import_react86.useState(null);
264800
264840
  const [messageQueue, setMessageQueue] = import_react86.useState([]);
264841
+ const messageQueueRef = import_react86.useRef([]);
264801
264842
  const [inlinePending, setInlinePending] = import_react86.useState([]);
264802
264843
  const [activityLog, setActivityLog] = import_react86.useState([]);
264803
264844
  const [tokenUsage, setTokenUsage] = import_react86.useState();
@@ -265375,6 +265416,8 @@ function App2({ cwd: cwd3, version: version4 }) {
265375
265416
  return false;
265376
265417
  const trimmed = command.trim();
265377
265418
  const lower = trimmed.toLowerCase();
265419
+ if (/^\s*connectors\s+(install|add)\b/.test(lower))
265420
+ return true;
265378
265421
  if (!lower.startsWith("bun "))
265379
265422
  return false;
265380
265423
  if (!/\bbun\s+(add|install|i)\b/.test(lower))
@@ -266295,12 +266338,15 @@ function App2({ cwd: cwd3, version: version4 }) {
266295
266338
  }, [registry3]);
266296
266339
  const processQueue = import_react86.useCallback(async () => {
266297
266340
  const activeSession2 = registryRef.current.getActiveSession();
266298
- if (!activeSession2 || !activeSessionId)
266341
+ if (!activeSessionId || !activeSession2)
266299
266342
  return;
266300
- const { next: nextMessage, remaining } = takeNextQueuedMessage(messageQueue, activeSessionId);
266343
+ const currentQueue = messageQueueRef.current;
266344
+ const { next: nextMessage } = takeNextQueuedMessage(currentQueue, activeSessionId);
266301
266345
  if (!nextMessage)
266302
266346
  return;
266303
- setMessageQueue(remaining);
266347
+ setMessageQueue((prev) => prev.filter((msg) => msg.id !== nextMessage.id));
266348
+ setInlinePending((prev) => prev.filter((msg) => msg.sessionId !== activeSessionId));
266349
+ pendingSendsRef.current = pendingSendsRef.current.filter((entry) => entry.sessionId !== activeSessionId);
266304
266350
  const userMessage = {
266305
266351
  id: nextMessage.id,
266306
266352
  role: "user",
@@ -266339,7 +266385,7 @@ function App2({ cwd: cwd3, version: version4 }) {
266339
266385
  registryRef.current.setProcessing(activeSession2.id, false);
266340
266386
  setQueueFlushTrigger((prev) => prev + 1);
266341
266387
  }
266342
- }, [activeSessionId, clearPendingSend, messageQueue]);
266388
+ }, [activeSessionId, clearPendingSend]);
266343
266389
  const activeQueue = activeSessionId ? messageQueue.filter((msg) => msg.sessionId === activeSessionId) : [];
266344
266390
  const activeInline = activeSessionId ? inlinePending.filter((msg) => msg.sessionId === activeSessionId) : [];
266345
266391
  const queuedMessageIds = import_react86.useMemo(() => new Set(activeQueue.filter((msg) => msg.mode === "queued").map((msg) => msg.id)), [activeQueue]);
@@ -266402,6 +266448,9 @@ function App2({ cwd: cwd3, version: version4 }) {
266402
266448
  import_react86.useEffect(() => {
266403
266449
  hasPendingToolsRef.current = hasPendingTools;
266404
266450
  }, [hasPendingTools]);
266451
+ import_react86.useEffect(() => {
266452
+ messageQueueRef.current = messageQueue;
266453
+ }, [messageQueue]);
266405
266454
  const isBusy = isProcessing || hasPendingTools;
266406
266455
  const stopHint = isBusy && !activeAskQuestion ? "[esc] to stop" : null;
266407
266456
  const pttStatus = voiceState?.isTalking ? "talking" : pttTranscribing ? "transcribing" : pttRecording ? "recording" : null;
@@ -269404,7 +269453,7 @@ process.on("unhandledRejection", (reason) => {
269404
269453
  cleanup();
269405
269454
  process.exit(1);
269406
269455
  });
269407
- var VERSION4 = "1.1.68";
269456
+ var VERSION4 = "1.1.70";
269408
269457
  var SYNC_START = "\x1B[?2026h";
269409
269458
  var SYNC_END = "\x1B[?2026l";
269410
269459
  function enableSynchronizedOutput() {
@@ -269545,4 +269594,4 @@ export {
269545
269594
  main
269546
269595
  };
269547
269596
 
269548
- //# debugId=185AA4EF92CD31F064756E2164756E21
269597
+ //# debugId=AE764416B0B6B38664756E2164756E21