@halcyonlabs/app 0.47.0-halcyon.163 → 0.47.0-halcyon.166

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/bb.js CHANGED
@@ -15863,6 +15863,7 @@ var appSourceOriginSchema = external_exports.enum(["official", "fork", "none"]);
15863
15863
 
15864
15864
  // ../config/src/cli-command.ts
15865
15865
  var CLI_LAUNCHER_ENV_NAME = "BB_CLI_LAUNCHER";
15866
+ var CLI_REEXEC_ENV_NAME = "BB_CLI_REEXEC";
15866
15867
 
15867
15868
  // ../config/src/strings.ts
15868
15869
  function toOptionalString(value) {
@@ -16861,16 +16862,21 @@ function resolveBundledCliLaunch(args) {
16861
16862
  return args.platform === "win32" && win32.extname(args.cliOverride) === "" ? { command: args.nodePath, args: [args.cliOverride, ...args.args] } : { command: args.cliOverride, args: args.args };
16862
16863
  }
16863
16864
  async function runBundledCliCommand(args) {
16865
+ const cliOverride = args.env[CLI_REEXEC_ENV_NAME] === "1" ? null : toOptionalString(args.env.BB_CLI) ?? null;
16864
16866
  const launch = resolveBundledCliLaunch({
16865
16867
  args: args.args,
16866
16868
  bundledCliPath: join4(args.context.daemonBundleDir, "bb"),
16867
- cliOverride: toOptionalString(args.env.BB_CLI) ?? null,
16869
+ cliOverride,
16868
16870
  nodePath: process.execPath,
16869
16871
  platform: process.platform
16870
16872
  });
16873
+ const env = createCliEnv({ context: args.context, env: args.env });
16874
+ if (cliOverride !== null) {
16875
+ env[CLI_REEXEC_ENV_NAME] = "1";
16876
+ }
16871
16877
  const childProcess = spawn(launch.command, launch.args, {
16872
16878
  cwd: process.cwd(),
16873
- env: createCliEnv({ context: args.context, env: args.env }),
16879
+ env,
16874
16880
  stdio: "inherit"
16875
16881
  });
16876
16882
  return toExitCode(await waitForProcessExit(childProcess));
package/dist/index.d.ts CHANGED
@@ -7456,8 +7456,8 @@ declare const hostDaemonCommandRegistry: {
7456
7456
  skillFilePath: z$1.ZodString;
7457
7457
  }, z$1.core.$strict>], "kind">>;
7458
7458
  instructionMode: z$1.ZodEnum<{
7459
- append: "append";
7460
7459
  replace: "replace";
7460
+ append: "append";
7461
7461
  }>;
7462
7462
  type: z$1.ZodLiteral<"thread.rewind.prepare">;
7463
7463
  leaseId: z$1.ZodString;
@@ -7605,8 +7605,8 @@ declare const hostDaemonCommandRegistry: {
7605
7605
  skillFilePath: z$1.ZodString;
7606
7606
  }, z$1.core.$strict>], "kind">>;
7607
7607
  instructionMode: z$1.ZodEnum<{
7608
- append: "append";
7609
7608
  replace: "replace";
7609
+ append: "append";
7610
7610
  }>;
7611
7611
  type: z$1.ZodLiteral<"thread.start">;
7612
7612
  requestId: z$1.ZodString;
@@ -8069,8 +8069,8 @@ declare const hostDaemonCommandRegistry: {
8069
8069
  envPassthrough: z$1.ZodArray<z$1.ZodString>;
8070
8070
  }, z$1.core.$strict>;
8071
8071
  instructionMode: z$1.ZodEnum<{
8072
- append: "append";
8073
8072
  replace: "replace";
8073
+ append: "append";
8074
8074
  }>;
8075
8075
  projectId: z$1.ZodString;
8076
8076
  providerId: z$1.ZodString;
@@ -8285,8 +8285,8 @@ declare const hostDaemonCommandRegistry: {
8285
8285
  envPassthrough: z$1.ZodArray<z$1.ZodString>;
8286
8286
  }, z$1.core.$strict>;
8287
8287
  instructionMode: z$1.ZodEnum<{
8288
- append: "append";
8289
8288
  replace: "replace";
8289
+ append: "append";
8290
8290
  }>;
8291
8291
  projectId: z$1.ZodString;
8292
8292
  providerId: z$1.ZodString;
@@ -9192,9 +9192,9 @@ declare const hostDaemonCommandRegistry: {
9192
9192
  base64: "base64";
9193
9193
  utf8: "utf8";
9194
9194
  }>;
9195
- mimeType: z$1.ZodOptional<z$1.ZodString>;
9196
- sizeBytes: z$1.ZodNumber;
9197
9195
  sha256: z$1.ZodString;
9196
+ sizeBytes: z$1.ZodNumber;
9197
+ mimeType: z$1.ZodOptional<z$1.ZodString>;
9198
9198
  modifiedAtMs: z$1.ZodOptional<z$1.ZodNumber>;
9199
9199
  notModified: z$1.ZodLiteral<true>;
9200
9200
  }, z$1.core.$strip>]>, "onlineRpc", true>;
@@ -9459,10 +9459,10 @@ declare const hostDaemonCommandRegistry: {
9459
9459
  health: z$1.ZodObject<{
9460
9460
  status: z$1.ZodEnum<{
9461
9461
  unknown: "unknown";
9462
+ ready: "ready";
9462
9463
  not_installed: "not_installed";
9463
9464
  unauthenticated: "unauthenticated";
9464
9465
  expired: "expired";
9465
- ready: "ready";
9466
9466
  unsupported_version: "unsupported_version";
9467
9467
  }>;
9468
9468
  statusMessage: z$1.ZodNullable<z$1.ZodString>;
@@ -9510,9 +9510,9 @@ declare const hostDaemonCommandRegistry: {
9510
9510
  executablePath: z$1.ZodNullable<z$1.ZodString>;
9511
9511
  installed: z$1.ZodBoolean;
9512
9512
  installSource: z$1.ZodEnum<{
9513
- external: "external";
9514
9513
  notInstalled: "notInstalled";
9515
9514
  npmGlobal: "npmGlobal";
9515
+ external: "external";
9516
9516
  }>;
9517
9517
  currentVersion: z$1.ZodNullable<z$1.ZodString>;
9518
9518
  latestVersion: z$1.ZodNullable<z$1.ZodString>;
@@ -9958,8 +9958,8 @@ declare const hostDaemonCommandRegistry: {
9958
9958
  message: z$1.ZodNullable<z$1.ZodString>;
9959
9959
  state: z$1.ZodNullable<z$1.ZodEnum<{
9960
9960
  pending: "pending";
9961
- ready: "ready";
9962
9961
  activating: "activating";
9962
+ ready: "ready";
9963
9963
  }>>;
9964
9964
  }, z$1.core.$strict>, "onlineRpc", true>;
9965
9965
  "server_move.prepare": HostDaemonCommandDescriptor<"server_move.prepare", z$1.ZodObject<{
@@ -10061,9 +10061,9 @@ declare const providerCliStatusResponseSchema: z$1.ZodRecord<z$1.ZodString, z$1.
10061
10061
  executablePath: z$1.ZodNullable<z$1.ZodString>;
10062
10062
  installed: z$1.ZodBoolean;
10063
10063
  installSource: z$1.ZodEnum<{
10064
- external: "external";
10065
10064
  notInstalled: "notInstalled";
10066
10065
  npmGlobal: "npmGlobal";
10066
+ external: "external";
10067
10067
  }>;
10068
10068
  currentVersion: z$1.ZodNullable<z$1.ZodString>;
10069
10069
  latestVersion: z$1.ZodNullable<z$1.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyonlabs/app",
3
- "version": "0.47.0-halcyon.163",
3
+ "version": "0.47.0-halcyon.166",
4
4
  "description": "bb app launcher for npx",
5
5
  "keywords": [
6
6
  "bb",
@@ -1 +1 @@
1
- deb1a3339c40878606aca3b727de9264ca25b503
1
+ bc333d0047f776cc8e4ce4a8c75d7c3d04d41d6c
@@ -48563,6 +48563,9 @@ function claimQueuedThreadMessageGroup(db, notifier, id3, policy) {
48563
48563
  if (!existing || isQueuedThreadMessageClaimed(existing)) {
48564
48564
  return null;
48565
48565
  }
48566
+ if (policy.kind === "automatic" && hasClaimedQueuedThreadMessages(tx, existing.threadId)) {
48567
+ return null;
48568
+ }
48566
48569
  const queuedMessages = listQueuedThreadMessages(tx, existing.threadId);
48567
48570
  const group = partitionQueuedMessageGroups(queuedMessages).find(
48568
48571
  (rows) => rows.some((row) => row.id === id3)
@@ -48598,6 +48601,9 @@ function claimQueuedThreadMessageGroup(db, notifier, id3, policy) {
48598
48601
  function claimNextQueuedThreadMessageGroup(db, notifier, threadId, isGroupEligible) {
48599
48602
  const claimedQueuedMessages = db.transaction(
48600
48603
  (tx) => {
48604
+ if (hasClaimedQueuedThreadMessages(tx, threadId)) {
48605
+ return null;
48606
+ }
48601
48607
  const queuedMessages = listQueuedThreadMessages(tx, threadId);
48602
48608
  const pauseOrdinaryMessages = isThreadQueueAutoSendPaused(tx, threadId);
48603
48609
  const now2 = Date.now();
@@ -58881,7 +58887,10 @@ function registerSettingDescriptors(target2, added) {
58881
58887
  `invalid setting key "${key}" \u2014 use letters, digits, "-" and "_"`
58882
58888
  );
58883
58889
  }
58884
- if (key in target2) {
58890
+ if (key === "__proto__") {
58891
+ throw new Error(`setting key "${key}" is reserved`);
58892
+ }
58893
+ if (Object.hasOwn(target2, key)) {
58885
58894
  throw new Error(`setting "${key}" is already defined`);
58886
58895
  }
58887
58896
  const parsed = settingDescriptorSchema.safeParse(raw2);
@@ -58944,7 +58953,10 @@ function settingSchemaError(key, schema2, value) {
58944
58953
  function validateSettingsUpdate(descriptors, values) {
58945
58954
  const errors = [];
58946
58955
  for (const [key, value] of Object.entries(values)) {
58947
- const descriptor = descriptors[key];
58956
+ const descriptor = Object.hasOwn(
58957
+ descriptors,
58958
+ key
58959
+ ) ? descriptors[key] : void 0;
58948
58960
  if (!descriptor) {
58949
58961
  errors.push(`unknown setting "${key}"`);
58950
58962
  continue;
@@ -70713,6 +70725,7 @@ var init_src10 = __esm({
70713
70725
  "use strict";
70714
70726
  init_rejected_assistant_reply();
70715
70727
  init_timeline_noise_events();
70728
+ init_tool_call_parsing();
70716
70729
  init_build_thread_timeline();
70717
70730
  init_active_prompt_mode_extraction();
70718
70731
  init_goal_snapshot_extraction();
@@ -71437,7 +71450,7 @@ function deferRowContent(row) {
71437
71450
  }
71438
71451
  switch (row.workKind) {
71439
71452
  case "command": {
71440
- if (row.output.length + row.command.length <= TIMELINE_DEFERRED_CONTENT_MIN_CHARS) {
71453
+ if (row.output.length + row.command.length <= TIMELINE_DEFERRED_CONTENT_MIN_CHARS || parseSentThreadMessage(row) !== null) {
71441
71454
  return row;
71442
71455
  }
71443
71456
  const { outputPreview: _outputPreview, ...rest } = row;
@@ -71491,6 +71504,7 @@ var init_timeline_deferred_content = __esm({
71491
71504
  "src/services/threads/timeline-deferred-content.ts"() {
71492
71505
  "use strict";
71493
71506
  init_src6();
71507
+ init_src10();
71494
71508
  TIMELINE_DEFERRED_CONTENT_MIN_CHARS = 1e3;
71495
71509
  TIMELINE_DEFERRED_COMMAND_PREFIX_CHARS = 300;
71496
71510
  }
@@ -89050,9 +89064,15 @@ function buildParentSystemThreadMention(args) {
89050
89064
  }
89051
89065
  function queueActiveParentSystemMessageInTransaction(tx, args) {
89052
89066
  const currentThread = getThread(tx, args.thread.id);
89053
- if (!currentThread || currentThread.environmentId !== args.environment.id || currentThread.status !== "active" || currentThread.archivedAt !== null || currentThread.deletedAt !== null) {
89067
+ if (!currentThread || currentThread.environmentId !== args.environment.id || currentThread.archivedAt !== null || currentThread.deletedAt !== null) {
89054
89068
  return null;
89055
89069
  }
89070
+ if (currentThread.status !== "active") {
89071
+ throw new ParentSystemMessageStateChangedError();
89072
+ }
89073
+ if (isManualCompactionActive({ db: tx }, currentThread)) {
89074
+ throw new ParentSystemMessageCompactionActiveError();
89075
+ }
89056
89076
  const expectedSteerTurnId2 = getActiveTurnId({ db: tx }, args.thread.id);
89057
89077
  const request2 = appendClientTurnEventInTransaction(tx, {
89058
89078
  ...parentSystemTurnRequestFields(args),
@@ -89183,7 +89203,11 @@ async function queueReadyParentSystemMessage(deps, args) {
89183
89203
  });
89184
89204
  const activeThread = deps.db.transaction(
89185
89205
  (tx) => {
89186
- ensureThreadCanStartRequest(args.thread);
89206
+ const currentThread = getThread(tx, args.thread.id);
89207
+ if (!currentThread || currentThread.environmentId !== args.environment.id || currentThread.status !== args.thread.status || currentThread.archivedAt !== null || currentThread.deletedAt !== null) {
89208
+ throw new ParentSystemMessageStateChangedError();
89209
+ }
89210
+ ensureThreadCanStartRequest(currentThread);
89187
89211
  appendPreparedClientTurnRequestedEventWithNotificationInTransaction(tx, {
89188
89212
  ...parentSystemTurnRequestFields(args),
89189
89213
  target: { kind: "new-turn" },
@@ -89247,7 +89271,7 @@ async function queueParentSystemMessage(deps, args) {
89247
89271
  });
89248
89272
  } catch (error3) {
89249
89273
  hostUnavailable = isHostUnavailableApiError(error3);
89250
- if (!(error3 instanceof ThreadContextClearInProgressError) && !hostUnavailable) {
89274
+ if (!(error3 instanceof ThreadContextClearInProgressError) && !(error3 instanceof ParentSystemMessageCompactionActiveError) && !hostUnavailable) {
89251
89275
  throw error3;
89252
89276
  }
89253
89277
  }
@@ -89299,6 +89323,24 @@ async function deliverParentSystemMessage(deps, args) {
89299
89323
  );
89300
89324
  }
89301
89325
  async function deliverParentSystemMessageWithContextGuard(deps, args) {
89326
+ while (true) {
89327
+ const parentThread = getThread(deps.db, args.parentThread.id);
89328
+ if (!parentThread || parentThread.archivedAt !== null || parentThread.deletedAt !== null) {
89329
+ return false;
89330
+ }
89331
+ try {
89332
+ return await attemptParentSystemMessageDelivery(deps, {
89333
+ ...args,
89334
+ parentThread
89335
+ });
89336
+ } catch (error3) {
89337
+ if (!(error3 instanceof ParentSystemMessageStateChangedError)) {
89338
+ throw error3;
89339
+ }
89340
+ }
89341
+ }
89342
+ }
89343
+ async function attemptParentSystemMessageDelivery(deps, args) {
89302
89344
  const { parentThread } = args;
89303
89345
  const { environment } = requireThreadEnvironment(deps.db, parentThread.id);
89304
89346
  const execution = await buildExecutionOptions(
@@ -89333,7 +89375,7 @@ async function deliverParentSystemMessageWithContextGuard(deps, args) {
89333
89375
  systemMessageSubject: args.systemMessageSubject
89334
89376
  });
89335
89377
  }
89336
- var PARENT_SYSTEM_MESSAGE_SOURCE;
89378
+ var PARENT_SYSTEM_MESSAGE_SOURCE, ParentSystemMessageStateChangedError, ParentSystemMessageCompactionActiveError;
89337
89379
  var init_parent_system_messages = __esm({
89338
89380
  "src/services/threads/parent-system-messages.ts"() {
89339
89381
  "use strict";
@@ -89354,6 +89396,10 @@ var init_parent_system_messages = __esm({
89354
89396
  init_thread_context_mutation_guard();
89355
89397
  init_queued_message_dispatch();
89356
89398
  PARENT_SYSTEM_MESSAGE_SOURCE = "tell";
89399
+ ParentSystemMessageStateChangedError = class extends Error {
89400
+ };
89401
+ ParentSystemMessageCompactionActiveError = class extends Error {
89402
+ };
89357
89403
  }
89358
89404
  });
89359
89405
 
@@ -104599,7 +104645,7 @@ async function sendQueuedMessage(deps, args) {
104599
104645
  );
104600
104646
  } catch (error3) {
104601
104647
  releaseQueuedMessageClaims(deps, queuedMessages);
104602
- if (isQueuedMessageAutoSendPausedError(error3) || error3 instanceof ThreadContextClearInProgressError) {
104648
+ if (isQueuedMessageAutoSendPausedError(error3) || error3 instanceof ThreadContextClearInProgressError || error3 instanceof ParentSystemMessageCompactionActiveError) {
104603
104649
  return toThreadQueuedMessage(queuedMessages[0]);
104604
104650
  }
104605
104651
  throw error3;
@@ -104656,7 +104702,7 @@ async function sendNextQueuedMessageIfPresent(deps, args) {
104656
104702
  );
104657
104703
  } catch (error3) {
104658
104704
  releaseQueuedMessageClaims(deps, nextQueuedMessages);
104659
- if (isQueuedMessageClaimLostError(error3) || isQueuedMessageAutoSendPausedError(error3) || error3 instanceof ThreadContextClearInProgressError) {
104705
+ if (isQueuedMessageClaimLostError(error3) || isQueuedMessageAutoSendPausedError(error3) || error3 instanceof ThreadContextClearInProgressError || error3 instanceof ParentSystemMessageCompactionActiveError) {
104660
104706
  return false;
104661
104707
  }
104662
104708
  if (!isCommandTimeoutError(error3)) {
@@ -194316,7 +194362,10 @@ function readPluginSettingsValuesSync(args) {
194316
194362
  const values = {};
194317
194363
  for (const [key, descriptor] of Object.entries(args.descriptors)) {
194318
194364
  if (isSecret(descriptor)) continue;
194319
- values[key] = parseStoredSettingValue(descriptor, stored[key]);
194365
+ values[key] = parseStoredSettingValue(
194366
+ descriptor,
194367
+ Object.hasOwn(stored, key) ? stored[key] : void 0
194368
+ );
194320
194369
  }
194321
194370
  return values;
194322
194371
  }
@@ -194331,7 +194380,7 @@ async function readPluginSettingsValues(args) {
194331
194380
  async function writePluginSettingsUpdate(args) {
194332
194381
  const rowUpdates = {};
194333
194382
  for (const [key, value] of Object.entries(args.values)) {
194334
- const descriptor = args.descriptors[key];
194383
+ const descriptor = Object.hasOwn(args.descriptors, key) ? args.descriptors[key] : void 0;
194335
194384
  if (!descriptor) continue;
194336
194385
  if (isSecret(descriptor)) {
194337
194386
  const path16 = secretFilePath(args.dataDir, args.pluginId, key);