@companyhelm/runner 0.0.18 → 0.0.19

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.
@@ -42,7 +42,6 @@ exports.isNoActiveTurnSteerError = isNoActiveTurnSteerError;
42
42
  exports.isNoRunningTurnInterruptError = isNoRunningTurnInterruptError;
43
43
  exports.normalizeThreadAgentApiUrlForRuntime = normalizeThreadAgentApiUrlForRuntime;
44
44
  exports.extractThreadNameUpdateFromNotification = extractThreadNameUpdateFromNotification;
45
- exports.extractServerMessageRequestId = extractServerMessageRequestId;
46
45
  exports.runCommandLoop = runCommandLoop;
47
46
  exports.isInternalDaemonChildProcess = isInternalDaemonChildProcess;
48
47
  exports.runDetachedDaemonProcess = runDetachedDaemonProcess;
@@ -445,80 +444,6 @@ function extractThreadNameUpdateFromNotification(notification) {
445
444
  normalizeNonEmptyString(params.thread_name);
446
445
  return { sdkThreadId, threadName };
447
446
  }
448
- function isByte(value) {
449
- return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 255;
450
- }
451
- function decodeLengthDelimitedPayload(bytes) {
452
- let index = 0;
453
- let shift = 0;
454
- let length = 0;
455
- while (index < bytes.length) {
456
- const current = bytes[index];
457
- length |= (current & 0x7f) << shift;
458
- index += 1;
459
- if ((current & 0x80) === 0) {
460
- break;
461
- }
462
- shift += 7;
463
- if (shift > 28) {
464
- return null;
465
- }
466
- }
467
- if (index === 0) {
468
- return null;
469
- }
470
- if (index + length !== bytes.length) {
471
- return null;
472
- }
473
- return bytes.subarray(index);
474
- }
475
- function toUint8Array(data) {
476
- if (data instanceof Uint8Array) {
477
- return data;
478
- }
479
- if (Buffer.isBuffer(data)) {
480
- return new Uint8Array(data);
481
- }
482
- if (Array.isArray(data) && data.every(isByte)) {
483
- return Uint8Array.from(data);
484
- }
485
- if (data &&
486
- typeof data === "object" &&
487
- "type" in data &&
488
- data.type === "Buffer" &&
489
- "data" in data &&
490
- Array.isArray(data.data)) {
491
- const values = data.data;
492
- if (values.every(isByte)) {
493
- return Uint8Array.from(values);
494
- }
495
- }
496
- return null;
497
- }
498
- function extractServerMessageRequestId(serverMessage) {
499
- if (!serverMessage || typeof serverMessage !== "object") {
500
- return undefined;
501
- }
502
- const typedMessage = serverMessage;
503
- if (typeof typedMessage.requestId === "string" && typedMessage.requestId.length > 0) {
504
- return typedMessage.requestId;
505
- }
506
- if (!Array.isArray(typedMessage.$unknown)) {
507
- return undefined;
508
- }
509
- for (const field of typedMessage.$unknown) {
510
- if (field?.no !== 1 || field.wireType !== 2) {
511
- continue;
512
- }
513
- const bytes = toUint8Array(field.data);
514
- if (!bytes || bytes.length === 0) {
515
- continue;
516
- }
517
- const payload = decodeLengthDelimitedPayload(bytes) ?? bytes;
518
- return Buffer.from(payload).toString("utf8");
519
- }
520
- return undefined;
521
- }
522
447
  function isGrpcServiceError(error) {
523
448
  return Boolean(error && typeof error === "object" && "code" in error);
524
449
  }
@@ -2415,7 +2340,7 @@ async function handleCodexConfigurationRequest(cfg, commandChannel, request, req
2415
2340
  }
2416
2341
  async function runCommandLoop(cfg, commandChannel, commandMessageSink, apiClient, apiCallOptions, logger) {
2417
2342
  for await (const serverMessage of commandChannel) {
2418
- const requestId = extractServerMessageRequestId(serverMessage);
2343
+ const requestId = serverMessage.requestId ?? undefined;
2419
2344
  switch (serverMessage.request.case) {
2420
2345
  case "createThreadRequest":
2421
2346
  await handleCreateThreadRequest(cfg, commandMessageSink, serverMessage.request.value, requestId, apiClient, apiCallOptions, logger);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companyhelm/runner",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Run the CompanyHelm runner in fully isolated Docker sandboxes.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@bufbuild/protobuf": "^2.11.0",
34
34
  "@clack/prompts": "^1.0.1",
35
- "@companyhelm/protos": "^0.5.19",
35
+ "@companyhelm/protos": "^0.5.20",
36
36
  "@grpc/grpc-js": "^1.14.3",
37
37
  "@libsql/client": "^0.17.0",
38
38
  "commander": "^14.0.0",