@akshar5/cohall 0.12.0 → 0.12.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.12.1](https://github.com/AksharP5/cohall/compare/v0.12.0...v0.12.1) (2026-10-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **providers:** preserve the real error when a command fails ([#194](https://github.com/AksharP5/cohall/issues/194)) ([a58c44e](https://github.com/AksharP5/cohall/commit/a58c44e5a5f4185f75201242fb1f11732e4151bb))
9
+ * **tasks:** keep simultaneous follow-ups in submission order ([#195](https://github.com/AksharP5/cohall/issues/195)) ([5f6c487](https://github.com/AksharP5/cohall/commit/5f6c4875fa598ee3e8b2e632e84dab11d5387015))
10
+ * **upgrade:** resolve runnable commands and preserve root prefixes ([#196](https://github.com/AksharP5/cohall/issues/196)) ([cefbe66](https://github.com/AksharP5/cohall/commit/cefbe66b885fccdd86441ec57f4e1dc82112437a))
11
+
3
12
  ## [0.12.0](https://github.com/AksharP5/cohall/compare/v0.11.3...v0.12.0) (2026-10-08)
4
13
 
5
14
 
package/bin/cohall.js CHANGED
@@ -17,7 +17,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
17
 
18
18
  // packages/protocol/src/index.ts
19
19
  import { Effect, Schema } from "effect";
20
- var version = "0.12.0", maxSocketPayloadBytes, maxAttachmentBytes, maxTaskAttachments = 2, maxProgressNoteBytes = 1024, bounded = (maxLength) => Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(maxLength)), optionalText = (maxLength) => Schema.String.check(Schema.isMaxLength(maxLength)), boundedArray = (schema, maxLength) => Schema.Array(schema).check(Schema.isMaxLength(maxLength)), count, uuid = (name) => Schema.String.check(Schema.isUUID(4)).pipe(Schema.brand(name)), isoTimestamp = (name) => Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/, {
20
+ var version = "0.12.1", maxSocketPayloadBytes, maxAttachmentBytes, maxTaskAttachments = 2, maxProgressNoteBytes = 1024, bounded = (maxLength) => Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(maxLength)), optionalText = (maxLength) => Schema.String.check(Schema.isMaxLength(maxLength)), boundedArray = (schema, maxLength) => Schema.Array(schema).check(Schema.isMaxLength(maxLength)), count, uuid = (name) => Schema.String.check(Schema.isUUID(4)).pipe(Schema.brand(name)), isoTimestamp = (name) => Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/, {
21
21
  expected: "an ISO-8601 UTC timestamp"
22
22
  })).pipe(Schema.brand(name)), BotId, Bot, DeviceId, ThreadId, MessageId, TaskId, TaskRequestId, TaskRunId, ClarificationId, AuthSessionId, OperationId, Timestamp, TaskDeadline, taskDeadlineError = "Task deadline exceeded", taskDeadlinePassed = (task, time = Date.now()) => task.expiresAt !== undefined && Date.parse(task.expiresAt) <= time, Platform, Provider, DeviceStatus, TaskStatus, OperationStatus, TaskTraceEventKind, MessageRole, ConnectionRole, AuthSession, CreatePairingInput, PairingCredential, ExchangePairingInput, SessionCredential, PairingResult, Capability, Workspace, Device, DeviceOverview, maxDevicePageDevices = 16, maxDevicePageResponseBytes, DevicePage, minimumDeviceOperationVersion = "0.5.0", parsedVersion = (value) => {
23
23
  const match = /^v?(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.exec(value);
@@ -1519,13 +1519,13 @@ var PersistenceError, TaskProgressError, TaskInputError, TaskDeadlineError, Task
1519
1519
  const [messageRows, taskRows] = yield* Effect15.try({
1520
1520
  try: () => [
1521
1521
  db.query(`SELECT * FROM (
1522
- SELECT * FROM messages WHERE thread_id = ?
1523
- ORDER BY created_at DESC, id DESC LIMIT 21
1524
- ) ORDER BY created_at, id`).all(threadId),
1522
+ SELECT *, rowid AS sequence FROM messages WHERE thread_id = ?
1523
+ ORDER BY created_at DESC, rowid DESC LIMIT 21
1524
+ ) ORDER BY created_at, sequence`).all(threadId),
1525
1525
  db.query(`SELECT * FROM (
1526
- SELECT * FROM tasks WHERE thread_id = ?
1527
- ORDER BY created_at DESC, id DESC LIMIT 21
1528
- ) ORDER BY created_at, id`).all(threadId)
1526
+ SELECT *, rowid AS sequence FROM tasks WHERE thread_id = ?
1527
+ ORDER BY created_at DESC, rowid DESC LIMIT 21
1528
+ ) ORDER BY created_at, sequence`).all(threadId)
1529
1529
  ],
1530
1530
  catch: operationError("RelayStore.threadContext.items")
1531
1531
  });
@@ -1547,7 +1547,7 @@ var PersistenceError, TaskProgressError, TaskInputError, TaskDeadlineError, Task
1547
1547
  const rows = yield* Effect15.try({
1548
1548
  try: () => db.query(`SELECT * FROM tasks WHERE target_device_id = ?
1549
1549
  AND status IN ('queued', 'cancelling')
1550
- ORDER BY dispatched_at IS NULL, created_at, id LIMIT 100`).all(deviceId),
1550
+ ORDER BY dispatched_at IS NULL, created_at, rowid LIMIT 100`).all(deviceId),
1551
1551
  catch: operationError("RelayStore.pendingTasksFor")
1552
1552
  });
1553
1553
  return yield* Effect15.forEach(rows, (row) => taskFromRow(db, row));
@@ -3536,7 +3536,7 @@ var captureText = (stream, limit) => new Promise((resolve2, reject) => {
3536
3536
  stream.once("error", reject);
3537
3537
  });
3538
3538
  var failureMessage = (command, stderr, exitCode) => {
3539
- const fallback = `${command} exited with status ${exitCode}`;
3539
+ const fallback = exitCode === undefined ? `${command} failed` : `${command} exited with status ${exitCode}`;
3540
3540
  const suffix = stderr.truncated ? `
3541
3541
  [stderr truncated after 64 KiB]` : "";
3542
3542
  const available2 = 16384 - suffix.length;
@@ -3695,6 +3695,19 @@ var parseClaude = (stdout, existingSession) => {
3695
3695
  const sessionId = text(value?.session_id) ?? text(value?.sessionId) ?? existingSession;
3696
3696
  return { result, ...sessionId === undefined ? {} : { sessionId } };
3697
3697
  };
3698
+ var claudeFailureMessage = (stdout) => {
3699
+ try {
3700
+ const value = record(JSON.parse(stdout));
3701
+ const result = text(value?.result) ?? text(value?.content);
3702
+ if (result?.trim())
3703
+ return result;
3704
+ const errors = value?.errors;
3705
+ return Array.isArray(errors) ? errors.map(text).filter((error) => error !== undefined).join(`
3706
+ `) || undefined : text(errors);
3707
+ } catch {
3708
+ return;
3709
+ }
3710
+ };
3698
3711
  var textFromPart = (value) => {
3699
3712
  const part = record(value);
3700
3713
  if (part === undefined) {
@@ -3732,7 +3745,7 @@ var parseOpenCode = async (stdout, existingSession) => {
3732
3745
  await forEachJsonEvent(stdout, (event) => {
3733
3746
  const failure = openCodeError(event);
3734
3747
  if (failure !== undefined) {
3735
- throw new Error(failure);
3748
+ throw new ProviderRunError({ provider: "opencode", message: failure });
3736
3749
  }
3737
3750
  sessionId = text(event.sessionID) ?? text(event.sessionId) ?? text(event.session_id) ?? text(record(event.info)?.sessionID) ?? sessionId;
3738
3751
  const part = record(event.part);
@@ -3786,13 +3799,13 @@ var parseOpenCode = async (stdout, existingSession) => {
3786
3799
  }
3787
3800
  return { result, ...sessionId === undefined ? {} : { sessionId } };
3788
3801
  };
3789
- var parse = async (options, stdout, onFailure) => {
3802
+ var readOutput = async (options, stdout, onFailure) => {
3790
3803
  try {
3791
3804
  switch (options.provider) {
3792
3805
  case "codex":
3793
3806
  return await parseCodex(stdout, options.sessionId);
3794
3807
  case "claude-code":
3795
- return parseClaude(await boundedText(stdout, maxJsonBytes, onFailure), options.sessionId);
3808
+ return await boundedText(stdout, maxJsonBytes, onFailure);
3796
3809
  case "opencode":
3797
3810
  return await parseOpenCode(stdout, options.sessionId);
3798
3811
  }
@@ -3846,6 +3859,7 @@ var terminateProcessTree = async (pid) => {
3846
3859
  process.kill(-pid, "SIGKILL");
3847
3860
  await waitForProcessGroup(pid, 1000);
3848
3861
  };
3862
+ var settlePromise = (promise) => promise.then((value) => ({ _tag: "Success", value }), (error) => ({ _tag: "Failure", error }));
3849
3863
  var run = (options) => Effect3.callback((resume, signal) => {
3850
3864
  const running = (async () => {
3851
3865
  const executable = findExecutable(executables[options.provider]);
@@ -3904,19 +3918,34 @@ var run = (options) => Effect3.callback((resume, signal) => {
3904
3918
  child.stdin.once("error", reject);
3905
3919
  child.stdin.end(prepared.input, (cause) => cause === undefined || cause === null ? resolve2() : reject(cause));
3906
3920
  });
3907
- const [result, stderr, exitCode] = await Promise.all([
3908
- parse(options, child.stdout, terminate),
3921
+ const [output, stderr, exit] = await Promise.all([
3922
+ settlePromise(readOutput(options, child.stdout, terminate)),
3909
3923
  captureText(child.stderr, 64 * 1024),
3910
- exited,
3924
+ settlePromise(exited),
3911
3925
  written
3912
3926
  ]);
3927
+ if (output._tag === "Failure" && output.error instanceof ProviderRunError)
3928
+ throw output.error;
3929
+ if (exit._tag === "Failure" && (output._tag === "Success" || child.pid === undefined)) {
3930
+ throw exit.error;
3931
+ }
3932
+ const exitCode = exit._tag === "Success" ? exit.value : undefined;
3913
3933
  if (exitCode !== 0) {
3934
+ let diagnostic = stderr;
3935
+ if (stderr.text.trim().length === 0) {
3936
+ const message = output._tag === "Failure" ? output.error instanceof Error ? output.error.message : String(output.error) : typeof output.value === "string" ? claudeFailureMessage(output.value) : undefined;
3937
+ if (message !== undefined)
3938
+ diagnostic = { text: message, truncated: false };
3939
+ }
3914
3940
  throw new ProviderRunError({
3915
3941
  provider: options.provider,
3916
- message: failureMessage(executables[options.provider], stderr, exitCode),
3917
- exitCode
3942
+ message: failureMessage(executables[options.provider], diagnostic, exitCode),
3943
+ ...exitCode === undefined ? {} : { exitCode }
3918
3944
  });
3919
3945
  }
3946
+ if (output._tag === "Failure")
3947
+ throw output.error;
3948
+ const result = typeof output.value === "string" ? parseClaude(output.value, options.sessionId) : output.value;
3920
3949
  if (byteLength(result.result) > maxResultBytes) {
3921
3950
  throw new ProviderRunError({
3922
3951
  provider: options.provider,
@@ -5527,7 +5556,7 @@ import {
5527
5556
  stat as stat2,
5528
5557
  writeFile as writeFile3
5529
5558
  } from "node:fs/promises";
5530
- import { delimiter as delimiter2, dirname as dirname3, extname as extname2, isAbsolute as isAbsolute3, join as join4, relative, resolve as resolve3 } from "node:path";
5559
+ import { delimiter as delimiter2, dirname as dirname3, extname as extname2, isAbsolute as isAbsolute3, join as join4, relative, resolve as resolve3, sep } from "node:path";
5531
5560
  import { platform as operatingSystem } from "node:os";
5532
5561
  var packageName = "@akshar5/cohall";
5533
5562
  var minimumBunLookupVersion = "1.2.15";
@@ -5624,7 +5653,7 @@ var packageInstallation = (canonicalEntrypoint, entrypoint = canonicalEntrypoint
5624
5653
  return { manager: "pnpm", entrypoint };
5625
5654
  }
5626
5655
  const nodeModulesParent = path.slice(0, packageIndex);
5627
- const prefix = runtimePlatform !== "win32" && nodeModulesParent.endsWith("/lib") ? nodeModulesParent.slice(0, -"/lib".length) : nodeModulesParent;
5656
+ const prefix = runtimePlatform !== "win32" && nodeModulesParent.endsWith("/lib") ? nodeModulesParent.slice(0, -"/lib".length) || "/" : runtimePlatform === "win32" && nodeModulesParent.endsWith(":") ? `${nodeModulesParent}/` : nodeModulesParent;
5628
5657
  return { manager: "npm", prefix, entrypoint };
5629
5658
  };
5630
5659
  var resolvePackageInstallation = async (entrypoint, options = {}) => {
@@ -5763,7 +5792,7 @@ var executableNames = (command) => {
5763
5792
  };
5764
5793
  var containsPath = (root, path) => {
5765
5794
  const child = relative(root, path);
5766
- return child === "" || !child.startsWith("..") && !isAbsolute3(child);
5795
+ return child !== ".." && !child.startsWith(`..${sep}`) && !isAbsolute3(child);
5767
5796
  };
5768
5797
  var linuxSystemExecutableRoots = [
5769
5798
  "/bin",
@@ -5822,6 +5851,8 @@ var trustedExecutable = async (command, options = {}) => {
5822
5851
  if (!available2)
5823
5852
  continue;
5824
5853
  try {
5854
+ if (!(await stat2(path)).isFile())
5855
+ continue;
5825
5856
  return await validateExecutable(path, options.writableRoot, options.preserveSymlink);
5826
5857
  } catch (cause) {
5827
5858
  failure ??= cause;
@@ -8237,7 +8268,7 @@ import { Effect as Effect12, Schedule as Schedule4, Schema as Schema14 } from "e
8237
8268
  import { constants as constants6 } from "node:fs";
8238
8269
  import { open as open6, realpath as realpath4, stat as stat5 } from "node:fs/promises";
8239
8270
  import { arch, hostname as hostname3, platform as platform4 } from "node:os";
8240
- import { basename as basename3, isAbsolute as isAbsolute5, relative as relative2, sep } from "node:path";
8271
+ import { basename as basename3, isAbsolute as isAbsolute5, relative as relative2, sep as sep2 } from "node:path";
8241
8272
  import { WebSocket as WebSocket2 } from "ws";
8242
8273
  var maxQueuedRelayMessages = 8;
8243
8274
 
@@ -8319,7 +8350,7 @@ var allowedWorkspace = async (configuration, requested) => {
8319
8350
  const candidate = await realpath4(selected);
8320
8351
  const allowed = configuration.workspaces.some((root) => {
8321
8352
  const child = relative2(root, candidate);
8322
- return child !== ".." && !child.startsWith(`..${sep}`) && !isAbsolute5(child);
8353
+ return child !== ".." && !child.startsWith(`..${sep2}`) && !isAbsolute5(child);
8323
8354
  });
8324
8355
  if (!allowed) {
8325
8356
  throw new Error(`Workspace ${candidate} is outside this device's configured workspace roots`);
@@ -9135,4 +9166,4 @@ await main().catch((cause) => {
9135
9166
  process.exitCode = 1;
9136
9167
  });
9137
9168
 
9138
- //# debugId=FBAE2BAE92FD7FC964756E2164756E21
9169
+ //# debugId=72424FF151CC8BDE64756E2164756E21