@buildautomaton/cli 0.1.91 → 0.1.93

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
@@ -21125,6 +21125,7 @@ function isCliSqliteLockError(e) {
21125
21125
  var CliSqliteInterrupted;
21126
21126
  var init_sqlite_errors = __esm({
21127
21127
  "../bridge/src/sqlite/sqlite-errors.ts"() {
21128
+ "use strict";
21128
21129
  CliSqliteInterrupted = class extends Error {
21129
21130
  name = "CliSqliteInterrupted";
21130
21131
  constructor() {
@@ -22064,6 +22065,7 @@ async function ensureCodeNavCacheSqliteInitialized() {
22064
22065
  var safeCloseCodeNavCacheSqliteDatabase, openCodeNavCacheSqliteConnection;
22065
22066
  var init_database = __esm({
22066
22067
  "../bridge/src/sqlite/code-nav-cache/database.ts"() {
22068
+ "use strict";
22067
22069
  init_code_nav_cache_availability();
22068
22070
  init_instance();
22069
22071
  init_sqlite_errors();
@@ -26563,6 +26565,7 @@ async function delayMsUnlessShutdownRequested(ms) {
26563
26565
  var cliImmediateShutdownRequested, symbolIndexShutdownPromise;
26564
26566
  var init_cli_process_interrupt = __esm({
26565
26567
  "../bridge/src/cli/teardown/cli-process-interrupt.ts"() {
26568
+ "use strict";
26566
26569
  cliImmediateShutdownRequested = false;
26567
26570
  symbolIndexShutdownPromise = null;
26568
26571
  }
@@ -27576,6 +27579,7 @@ function createWsBridge(options) {
27576
27579
  });
27577
27580
  ws.on("open", () => {
27578
27581
  disposeClientPing();
27582
+ if (isActiveSocket && !isActiveSocket(ws)) return;
27579
27583
  if (clientPingIntervalMs != null && clientPingIntervalMs > 0) {
27580
27584
  clearClientPing = attachWebSocketClientPing(ws, clientPingIntervalMs);
27581
27585
  }
@@ -27595,10 +27599,12 @@ function createWsBridge(options) {
27595
27599
  });
27596
27600
  ws.on("close", (code, reason) => {
27597
27601
  disposeClientPing();
27598
- onClose?.(code, reason.toString());
27602
+ if (isActiveSocket && !isActiveSocket(ws)) return;
27603
+ onClose?.(code, reason.toString(), ws);
27599
27604
  });
27600
27605
  ws.on("error", (err) => {
27601
27606
  disposeClientPing();
27607
+ if (isActiveSocket && !isActiveSocket(ws)) return;
27602
27608
  onError2?.(err);
27603
27609
  });
27604
27610
  return ws;
@@ -32916,6 +32922,24 @@ var RoleLengthWireSchema = external_exports.discriminatedUnion("type", [
32916
32922
  external_exports.object({ type: external_exports.literal("session_count"), max_sessions: MaxSessionsSchema })
32917
32923
  ]);
32918
32924
 
32925
+ // ../types/src/role-access-restrictions.ts
32926
+ var EMPTY_ROLE_ACCESS_RESTRICTIONS = {
32927
+ sessionsOwnAndExplicitOnly: false,
32928
+ bridgesOwnAndExplicitOnly: false,
32929
+ sessionsReadOnlyExceptOwn: false,
32930
+ codeChangesAgentModifiedOnly: false,
32931
+ codeChangesHidden: false
32932
+ };
32933
+ function roleAccessRestrictionsToWire(restrictions) {
32934
+ return {
32935
+ sessions_own_and_explicit_only: restrictions.sessionsOwnAndExplicitOnly,
32936
+ bridges_own_and_explicit_only: restrictions.bridgesOwnAndExplicitOnly,
32937
+ sessions_read_only_except_own: restrictions.sessionsReadOnlyExceptOwn,
32938
+ code_changes_agent_modified_only: restrictions.codeChangesAgentModifiedOnly,
32939
+ code_changes_hidden: restrictions.codeChangesHidden
32940
+ };
32941
+ }
32942
+
32919
32943
  // ../types/src/role-details.ts
32920
32944
  var InitialPeriodDaysSchema = external_exports.number().int().min(ROLE_PERIOD_MIN_DAYS).max(ROLE_PERIOD_MAX_DAYS);
32921
32945
  var AgentSubscriptionIdsSchema = external_exports.array(external_exports.string().min(1)).default([]);
@@ -32925,15 +32949,33 @@ var RoleDetailsSchema = external_exports.object({
32925
32949
  length: RoleLengthSchema.nullable(),
32926
32950
  agentSubscriptionIds: AgentSubscriptionIdsSchema,
32927
32951
  sessionsOwnAndExplicitOnly: BoolFalseSchema,
32928
- bridgesOwnAndExplicitOnly: BoolFalseSchema
32952
+ bridgesOwnAndExplicitOnly: BoolFalseSchema,
32953
+ sessionsReadOnlyExceptOwn: BoolFalseSchema,
32954
+ codeChangesAgentModifiedOnly: BoolFalseSchema,
32955
+ codeChangesHidden: BoolFalseSchema
32929
32956
  });
32930
32957
  var RoleDetailsWireSchema = external_exports.object({
32931
32958
  payment: RolePaymentModelWireSchema.nullable(),
32932
32959
  length: RoleLengthWireSchema.nullable(),
32933
32960
  agent_subscription_ids: AgentSubscriptionIdsSchema,
32934
32961
  sessions_own_and_explicit_only: BoolFalseSchema,
32935
- bridges_own_and_explicit_only: BoolFalseSchema
32936
- });
32962
+ bridges_own_and_explicit_only: BoolFalseSchema,
32963
+ sessions_read_only_except_own: BoolFalseSchema,
32964
+ code_changes_agent_modified_only: BoolFalseSchema,
32965
+ code_changes_hidden: BoolFalseSchema
32966
+ });
32967
+ var EMPTY_ROLE_DETAILS = {
32968
+ payment: null,
32969
+ length: null,
32970
+ agentSubscriptionIds: [],
32971
+ ...EMPTY_ROLE_ACCESS_RESTRICTIONS
32972
+ };
32973
+ var EMPTY_ROLE_DETAILS_WIRE = {
32974
+ payment: null,
32975
+ length: null,
32976
+ agent_subscription_ids: [],
32977
+ ...roleAccessRestrictionsToWire(EMPTY_ROLE_ACCESS_RESTRICTIONS)
32978
+ };
32937
32979
 
32938
32980
  // ../bridge/src/agents/acp/safe-fs-path.ts
32939
32981
  import * as path2 from "node:path";
@@ -35787,15 +35829,31 @@ function queueCursorCreatePlanRequest(method, id, msg, deps) {
35787
35829
  }
35788
35830
 
35789
35831
  // ../bridge/src/agents/providers/cursor/cursor-incoming-cursor-task.ts
35790
- function buildCursorTaskToolCallUpdate(params) {
35832
+ function asRecord2(v) {
35833
+ return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
35834
+ }
35835
+ function flattenCursorTaskParams(params) {
35836
+ const nested = asRecord2(params.task) ?? asRecord2(params.data) ?? asRecord2(params.payload) ?? asRecord2(params.cursorTask);
35837
+ return nested ? { ...nested, ...params } : params;
35838
+ }
35839
+ function stringField(params, ...keys) {
35840
+ for (const key of keys) {
35841
+ const v = params[key];
35842
+ if (typeof v === "string" && v.trim()) return v.trim();
35843
+ }
35844
+ return void 0;
35845
+ }
35846
+ function buildCursorTaskToolCallUpdate(rawParams) {
35847
+ const params = flattenCursorTaskParams(rawParams);
35791
35848
  const toolCallId = params.toolCallId ?? params.tool_call_id;
35792
35849
  if (typeof toolCallId !== "string" || !toolCallId.trim()) return null;
35793
- const description = typeof params.description === "string" ? params.description.trim() : "";
35850
+ const description = stringField(params, "description");
35794
35851
  const prompt = typeof params.prompt === "string" ? params.prompt : void 0;
35795
35852
  const subagentType = params.subagentType ?? params.subagent_type;
35796
35853
  const model = typeof params.model === "string" ? params.model : void 0;
35797
- const agentId = typeof params.agentId === "string" ? params.agentId : typeof params.agent_id === "string" ? params.agent_id : void 0;
35798
- const durationMs = typeof params.durationMs === "number" ? params.durationMs : typeof params.duration_ms === "number" ? params.duration_ms : void 0;
35854
+ const agentId = stringField(params, "agentId", "agent_id");
35855
+ const rawDuration = params.durationMs ?? params.duration_ms;
35856
+ const durationMs = typeof rawDuration === "number" && Number.isFinite(rawDuration) && rawDuration > 0 ? rawDuration : void 0;
35799
35857
  const isBackground = typeof params.isBackground === "boolean" ? params.isBackground : typeof params.is_background === "boolean" ? params.is_background : typeof params.runInBackground === "boolean" ? params.runInBackground : typeof params.run_in_background === "boolean" ? params.run_in_background : void 0;
35800
35858
  return {
35801
35859
  sessionUpdate: "tool_call_update",
@@ -35964,7 +36022,7 @@ function writeCreatePlanFile(params) {
35964
36022
  }
35965
36023
 
35966
36024
  // ../bridge/src/agents/providers/cursor/enrich-create-plan-rpc-result.ts
35967
- function asRecord2(v) {
36025
+ function asRecord3(v) {
35968
36026
  return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
35969
36027
  }
35970
36028
  function resolveAcceptedPlanMarkdown(outcome, pendingParams) {
@@ -35973,8 +36031,8 @@ function resolveAcceptedPlanMarkdown(outcome, pendingParams) {
35973
36031
  return "";
35974
36032
  }
35975
36033
  function enrichCreatePlanRpcResult(result, pendingParams, cloudSessionId) {
35976
- const root = asRecord2(result);
35977
- const outcome = asRecord2(root?.outcome);
36034
+ const root = asRecord3(result);
36035
+ const outcome = asRecord3(root?.outcome);
35978
36036
  if (!outcome) return result;
35979
36037
  const kind = typeof outcome.outcome === "string" ? outcome.outcome : "";
35980
36038
  if (kind !== "accepted") {
@@ -40533,7 +40591,7 @@ function createBridgeHeartbeatController(params) {
40533
40591
  }
40534
40592
 
40535
40593
  // ../bridge/src/cli/cli-version.ts
40536
- var CLI_VERSION = "0.1.91".length > 0 ? "0.1.91" : "0.0.0-dev";
40594
+ var CLI_VERSION = "0.1.93".length > 0 ? "0.1.93" : "0.0.0-dev";
40537
40595
 
40538
40596
  // ../bridge/src/connection/identify/send-bridge-identify.ts
40539
40597
  function sendBridgeIdentify(ws, params) {
@@ -52332,12 +52390,12 @@ function createMainBridgeAuthRefreshHandler(params, connect) {
52332
52390
  // ../bridge/src/connection/ws/main-bridge-ws-close-handler.ts
52333
52391
  function createMainBridgeCloseHandler(params, connect) {
52334
52392
  const { state, logFn, bridgeHeartbeat } = params;
52335
- return (code, reason) => {
52393
+ return (code, reason, closedWs) => {
52394
+ if (state.currentWs !== closedWs) return;
52336
52395
  bridgeHeartbeat?.stop();
52337
52396
  try {
52338
- const was = state.currentWs;
52339
52397
  state.currentWs = null;
52340
- if (was) was.removeAllListeners();
52398
+ closedWs.removeAllListeners();
52341
52399
  const willReconnect = !state.closedByUser;
52342
52400
  if (willReconnect) {
52343
52401
  const duplicateResult = evaluateDuplicateBridgeDisconnect(
@@ -53458,7 +53516,7 @@ function createPendingAuthOnMessage(params) {
53458
53516
  }
53459
53517
 
53460
53518
  // src/cli-version.ts
53461
- var CLI_VERSION2 = "0.1.91".length > 0 ? "0.1.91" : "0.0.0-dev";
53519
+ var CLI_VERSION2 = "0.1.93".length > 0 ? "0.1.93" : "0.0.0-dev";
53462
53520
 
53463
53521
  // src/auth/pending/pending-auth-on-open.ts
53464
53522
  function createPendingAuthOnOpen(params) {