@akshar5/cohall 0.12.2 → 0.12.4

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.12.4](https://github.com/AksharP5/cohall/compare/v0.12.3...v0.12.4) (2026-10-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **relay:** route work using target workspace path rules ([#205](https://github.com/AksharP5/cohall/issues/205)) ([1c5b991](https://github.com/AksharP5/cohall/commit/1c5b991558e0354da07f476df872fae9538d0508))
9
+
10
+ ## [0.12.3](https://github.com/AksharP5/cohall/compare/v0.12.2...v0.12.3) (2026-10-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **providers:** preserve errors when prompt delivery fails ([#203](https://github.com/AksharP5/cohall/issues/203)) ([a56272a](https://github.com/AksharP5/cohall/commit/a56272a8103923ad2099efe3e93775981c675a16))
16
+ * **service:** keep custom pnpm providers available ([#201](https://github.com/AksharP5/cohall/issues/201)) ([b9914a1](https://github.com/AksharP5/cohall/commit/b9914a1152df950c91848694dc712d7b61e39a53))
17
+ * **tasks:** resolve Bot names with retry request IDs ([#204](https://github.com/AksharP5/cohall/issues/204)) ([f481a45](https://github.com/AksharP5/cohall/commit/f481a4519ee65a8be338ae7e2d04b165ed7df31d))
18
+
3
19
  ## [0.12.2](https://github.com/AksharP5/cohall/compare/v0.12.1...v0.12.2) (2026-10-15)
4
20
 
5
21
 
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.2", 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.4", 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);
@@ -2261,6 +2261,7 @@ import { createHash as createHash3, timingSafeEqual } from "node:crypto";
2261
2261
  import { access as access6, chmod as chmod8 } from "node:fs/promises";
2262
2262
  import { createServer } from "node:http";
2263
2263
  import { platform as platform6 } from "node:os";
2264
+ import { posix, win32 } from "node:path";
2264
2265
  import { WebSocketServer } from "ws";
2265
2266
  var RequestError, relayListenOptions = (configuration, environment = process.env, pid = process.pid) => {
2266
2267
  const listenPid = Number(environment.LISTEN_PID);
@@ -2363,7 +2364,13 @@ Content-Length: 0\r
2363
2364
  const prompt = `${input.prompt} ${input.context ?? ""}`.toLowerCase();
2364
2365
  const needsXcode = /\b(xcode|ios|macos|swiftui|app store)\b/.test(prompt);
2365
2366
  const needsBrowser = /\b(browser|chrome|youtube|twitter|logged[- ]?in|signed[- ]?in|x\.com)\b/.test(prompt);
2366
- return (device.status === "offline" ? 0 : 100) + (input.workspace !== undefined && device.workspaces.some((workspace) => input.workspace === workspace.path || input.workspace?.startsWith(`${workspace.path}/`)) ? 80 : 0) + (needsXcode && device.capabilities.some((capability) => capability.id === "xcode") ? 60 : 0) + (needsBrowser && device.capabilities.some((capability) => capability.id === "browser-session") ? 40 : 0) + (sourceDeviceId === device.id ? -5 : 0);
2367
+ const paths2 = device.platform === "windows" ? win32 : posix;
2368
+ const workspace = input.workspace;
2369
+ const matchesWorkspace = workspace !== undefined && paths2.isAbsolute(workspace) && device.workspaces.some(({ path }) => {
2370
+ const child = paths2.relative(path, workspace);
2371
+ return child !== ".." && !child.startsWith(`..${paths2.sep}`) && !paths2.isAbsolute(child);
2372
+ });
2373
+ return (device.status === "offline" ? 0 : 100) + (matchesWorkspace ? 80 : 0) + (needsXcode && device.capabilities.some((capability) => capability.id === "xcode") ? 60 : 0) + (needsBrowser && device.capabilities.some((capability) => capability.id === "browser-session") ? 40 : 0) + (sourceDeviceId === device.id ? -5 : 0);
2367
2374
  }, resolveDelegation = (input, sourceDeviceId) => Effect16.gen(function* () {
2368
2375
  const store = yield* exports_store.Service;
2369
2376
  const ancestors = [];
@@ -3927,22 +3934,28 @@ var run = (options) => Effect3.callback((resume, signal) => {
3927
3934
  child.stdin.once("error", reject);
3928
3935
  child.stdin.end(prepared.input, (cause) => cause === undefined || cause === null ? resolve2() : reject(cause));
3929
3936
  });
3930
- const [output, stderr, exit] = await Promise.all([
3937
+ const [output, stderr, exit, input] = await Promise.all([
3931
3938
  settlePromise(readOutput(options, child.stdout, terminate)),
3932
3939
  captureText(child.stderr, 64 * 1024),
3933
3940
  settlePromise(exited),
3934
- written
3941
+ settlePromise(written.catch((cause) => {
3942
+ terminate();
3943
+ throw cause;
3944
+ }))
3935
3945
  ]);
3936
3946
  if (output._tag === "Failure" && output.error instanceof ProviderRunError)
3937
3947
  throw output.error;
3938
- if (exit._tag === "Failure" && (output._tag === "Success" || child.pid === undefined)) {
3948
+ if (exit._tag === "Failure" && (child.pid === undefined || output._tag === "Success" && input._tag === "Success")) {
3939
3949
  throw exit.error;
3940
3950
  }
3941
3951
  const exitCode = exit._tag === "Success" ? exit.value : undefined;
3942
- if (exitCode !== 0) {
3952
+ if (exitCode !== 0 || input._tag === "Failure") {
3943
3953
  let diagnostic = stderr;
3944
3954
  if (stderr.text.trim().length === 0) {
3945
- const message = output._tag === "Failure" ? output.error instanceof Error ? output.error.message : String(output.error) : typeof output.value === "string" ? claudeFailureMessage(output.value) : undefined;
3955
+ let message = output._tag === "Failure" ? output.error instanceof Error ? output.error.message : String(output.error) : typeof output.value === "string" ? claudeFailureMessage(output.value) : undefined;
3956
+ if (message === undefined && input._tag === "Failure") {
3957
+ message = input.error instanceof Error ? input.error.message : String(input.error);
3958
+ }
3946
3959
  if (message !== undefined)
3947
3960
  diagnostic = { text: message, truncated: false };
3948
3961
  }
@@ -4817,7 +4830,7 @@ var createDelegation = Effect5.fn("Cohall.createDelegation")(function* (client,
4817
4830
  const provider = botId === undefined ? options.provider : "grok-bot";
4818
4831
  const inheritedThread = configuration.mcpThreadId;
4819
4832
  const parentTaskId = options.parentTaskId ?? (configuration.mcpTaskId === undefined ? undefined : yield* Schema5.decodeUnknownEffect(TaskId)(configuration.mcpTaskId));
4820
- return yield* client.createTask({
4833
+ const input = {
4821
4834
  prompt: options.prompt,
4822
4835
  ...options.requestId === undefined ? {} : { requestId: options.requestId },
4823
4836
  ...target === undefined ? {} : { targetDeviceId: target.deviceId },
@@ -4829,7 +4842,16 @@ var createDelegation = Effect5.fn("Cohall.createDelegation")(function* (client,
4829
4842
  ...parentTaskId === undefined ? {} : { parentTaskId },
4830
4843
  ...options.attachments === undefined ? {} : { attachments: options.attachments },
4831
4844
  ...options.expiresAt === undefined ? {} : { expiresAt: options.expiresAt }
4832
- });
4845
+ };
4846
+ return yield* client.createTask(input).pipe(Effect5.catch((cause) => Effect5.gen(function* () {
4847
+ const suppliedTarget = options.target;
4848
+ if (directTarget?.botId === undefined || suppliedTarget === undefined || !(cause instanceof RelayRequestError) || cause.status !== 404 && cause.status !== 409)
4849
+ return yield* Effect5.fail(cause);
4850
+ const resolved = yield* client.devices().pipe(Effect5.flatMap((devices2) => selectTarget(devices2, suppliedTarget)), Effect5.catch((error) => Effect5.fail(cause.status === 409 ? cause : error)));
4851
+ if (resolved.botId === undefined || resolved.botId === directTarget.botId)
4852
+ return yield* Effect5.fail(cause);
4853
+ return yield* client.createTask({ ...input, botId: resolved.botId });
4854
+ })));
4833
4855
  });
4834
4856
  var waitForTask = Effect5.fn("Cohall.waitForTask")(function* (client, initial, timeoutSeconds) {
4835
4857
  const id = typeof initial === "string" ? initial : initial.id;
@@ -6342,7 +6364,7 @@ var pnpmHomeDirectory = (platform4, home) => {
6342
6364
  return process.env.LOCALAPPDATA ? join5(process.env.LOCALAPPDATA, "pnpm") : join5(home, ".pnpm");
6343
6365
  };
6344
6366
  var deviceServicePlan = (options) => {
6345
- const pnpmHome = options.pnpm?.home ?? (options.platform === "darwin" ? join5(options.home, "Library", "pnpm") : join5(options.home, ".local", "share", "pnpm"));
6367
+ const pnpmHome = options.pnpm?.home ?? pnpmHomeDirectory(options.platform, options.home);
6346
6368
  const servicePath = [
6347
6369
  dirname4(options.nodeExecutable),
6348
6370
  ...options.npmPrefix === undefined ? [] : [join5(options.npmPrefix, "bin")],
@@ -9175,4 +9197,4 @@ await main().catch((cause) => {
9175
9197
  process.exitCode = 1;
9176
9198
  });
9177
9199
 
9178
- //# debugId=4B3B01B78A1B929E64756E2164756E21
9200
+ //# debugId=DB1904B0DFF697EC64756E2164756E21