@autohq/cli 0.1.361 → 0.1.363

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.
@@ -23492,7 +23492,7 @@ Object.assign(lookup, {
23492
23492
  // package.json
23493
23493
  var package_default = {
23494
23494
  name: "@autohq/cli",
23495
- version: "0.1.361",
23495
+ version: "0.1.363",
23496
23496
  license: "SEE LICENSE IN README.md",
23497
23497
  publishConfig: {
23498
23498
  access: "public"
@@ -27879,6 +27879,12 @@ var SessionListItemSchema = external_exports.object({
27879
27879
  // Additive and optional so older live frames/list payloads that predate the
27880
27880
  // projection keep parsing; new projections include null when no reason exists.
27881
27881
  failureReason: external_exports.string().nullable().optional(),
27882
+ // Additive and optional so older live frames/list payloads that predate the
27883
+ // projection keep parsing; new projections include null when no selection
27884
+ // exists. Carried so a session-upsert after a selection change keeps the
27885
+ // open-session React Query record in sync without a full refetch.
27886
+ model: ResolvedAgentModelSelectionSchema.nullable().optional(),
27887
+ reasoningEffort: external_exports.string().trim().min(1).nullable().optional(),
27882
27888
  agent: SessionListItemAgentSchema,
27883
27889
  createdAt: external_exports.string().datetime(),
27884
27890
  updatedAt: external_exports.string().datetime(),
@@ -27972,20 +27978,16 @@ var CreditEventRecordSchema = external_exports.object({
27972
27978
  createdByUserId: external_exports.string().trim().min(1).nullable(),
27973
27979
  createdAt: external_exports.string().datetime()
27974
27980
  });
27975
- var SPENDING_LIMIT_WINDOWS = ["hour", "day", "week", "month"];
27981
+ var SPENDING_LIMIT_WINDOWS = ["day", "month"];
27976
27982
  var SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
27977
27983
  var BilledSpendWindowsSchema = external_exports.object({
27978
- hourUsd: NonNegativeUsdSchema,
27979
27984
  dayUsd: NonNegativeUsdSchema,
27980
- weekUsd: NonNegativeUsdSchema,
27981
27985
  monthUsd: NonNegativeUsdSchema
27982
27986
  });
27983
27987
  var OrganizationBillingSettingsSchema = external_exports.object({
27984
27988
  organizationId: OrganizationIdSchema,
27985
27989
  // Null means no limit for that window.
27986
- spendLimitHourUsd: PositiveUsdSchema.nullable(),
27987
27990
  spendLimitDayUsd: PositiveUsdSchema.nullable(),
27988
- spendLimitWeekUsd: PositiveUsdSchema.nullable(),
27989
27991
  spendLimitMonthUsd: PositiveUsdSchema.nullable(),
27990
27992
  autoTopUpEnabled: external_exports.boolean(),
27991
27993
  // Balance at or below the threshold triggers a top-up of the configured
@@ -27994,9 +27996,7 @@ var OrganizationBillingSettingsSchema = external_exports.object({
27994
27996
  autoTopUpAmountUsd: PositiveUsdSchema.nullable()
27995
27997
  });
27996
27998
  var UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
27997
- spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
27998
27999
  spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
27999
- spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
28000
28000
  spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
28001
28001
  autoTopUpEnabled: external_exports.boolean().optional(),
28002
28002
  autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
@@ -66926,7 +66926,7 @@ var ClaudeAgentBridgeSessionImpl = class {
66926
66926
  this.input.writeOutput?.(
66927
66927
  `agent_bridge_claude_startup_failed duration_ms=${Date.now() - startedAt} error=${error51 instanceof Error ? error51.message : String(error51)}`
66928
66928
  );
66929
- if (this.options.resume !== void 0 && this.state.kind !== "closed") {
66929
+ if (this.options.resume !== void 0 && this.input.allowResumeFallback !== false && this.state.kind !== "closed") {
66930
66930
  const { resume, ...optionsWithoutResume } = this.options;
66931
66931
  this.options = optionsWithoutResume;
66932
66932
  this.input.writeOutput?.(
@@ -67588,7 +67588,11 @@ var ClaudeCodeCommandHandler = class {
67588
67588
  context = null;
67589
67589
  agentSession = null;
67590
67590
  claudeConfig;
67591
+ // Selection-change restarts happen in-process, so prefer the live SDK id even
67592
+ // when the file resume store is stale or temporarily unreadable.
67593
+ lastObservedAgentId = null;
67591
67594
  persistedAgentId = null;
67595
+ requireResumeForNextAgentSession = false;
67592
67596
  injectedCommands = /* @__PURE__ */ new Set();
67593
67597
  // Message commands whose injection has started but not settled. A fresh SDK
67594
67598
  // warm inside sendMessage can outlast the bridge's command-ack window, so a
@@ -68012,14 +68016,19 @@ var ClaudeCodeCommandHandler = class {
68012
68016
  );
68013
68017
  }
68014
68018
  persistAgentId(activeContext, message) {
68015
- const store = this.input.sessionResume;
68016
- if (!store) {
68019
+ if (!("session_id" in message) || typeof message.session_id !== "string") {
68017
68020
  return;
68018
68021
  }
68019
- if (!("session_id" in message) || typeof message.session_id !== "string") {
68022
+ if (!message.session_id) {
68020
68023
  return;
68021
68024
  }
68022
- if (!message.session_id || message.session_id === this.persistedAgentId) {
68025
+ this.lastObservedAgentId = message.session_id;
68026
+ this.requireResumeForNextAgentSession = false;
68027
+ const store = this.input.sessionResume;
68028
+ if (!store) {
68029
+ return;
68030
+ }
68031
+ if (message.session_id === this.persistedAgentId) {
68023
68032
  return;
68024
68033
  }
68025
68034
  try {
@@ -68049,13 +68058,24 @@ var ClaudeCodeCommandHandler = class {
68049
68058
  return void 0;
68050
68059
  }
68051
68060
  }
68061
+ resumeAgentIdForNextSession() {
68062
+ return this.lastObservedAgentId ?? this.storedResumeAgentId();
68063
+ }
68052
68064
  ensureAgentSession() {
68053
68065
  if (this.agentSession) {
68054
68066
  return this.agentSession;
68055
68067
  }
68068
+ const resumeRequired = this.requireResumeForNextAgentSession;
68069
+ const resumeAgentId = this.resumeAgentIdForNextSession();
68070
+ if (resumeRequired && !resumeAgentId) {
68071
+ throw new Error(
68072
+ "Cannot restart Claude Code for a model/effort selection change without a session id to resume"
68073
+ );
68074
+ }
68056
68075
  const session = claudeAgentBridgeRuntime.start({
68057
68076
  claude: this.claudeConfig,
68058
- resumeAgentId: this.storedResumeAgentId(),
68077
+ resumeAgentId,
68078
+ ...resumeRequired ? { allowResumeFallback: false } : {},
68059
68079
  canUseTool: this.canUseTool,
68060
68080
  onMessage: (message, meta3) => this.handleAgentMessage(message, meta3),
68061
68081
  onError: (error51) => this.handleAgentError(error51),
@@ -68085,6 +68105,7 @@ var ClaudeCodeCommandHandler = class {
68085
68105
  return;
68086
68106
  }
68087
68107
  this.claudeConfig = next;
68108
+ this.requireResumeForNextAgentSession = this.lastObservedAgentId !== null;
68088
68109
  this.agentSession?.close();
68089
68110
  this.agentSession = null;
68090
68111
  this.settlePendingQuestions("The runtime restarted to change model");
package/dist/index.js CHANGED
@@ -19479,6 +19479,12 @@ var init_sessions = __esm({
19479
19479
  // Additive and optional so older live frames/list payloads that predate the
19480
19480
  // projection keep parsing; new projections include null when no reason exists.
19481
19481
  failureReason: external_exports.string().nullable().optional(),
19482
+ // Additive and optional so older live frames/list payloads that predate the
19483
+ // projection keep parsing; new projections include null when no selection
19484
+ // exists. Carried so a session-upsert after a selection change keeps the
19485
+ // open-session React Query record in sync without a full refetch.
19486
+ model: ResolvedAgentModelSelectionSchema.nullable().optional(),
19487
+ reasoningEffort: external_exports.string().trim().min(1).nullable().optional(),
19482
19488
  agent: SessionListItemAgentSchema,
19483
19489
  createdAt: external_exports.string().datetime(),
19484
19490
  updatedAt: external_exports.string().datetime(),
@@ -19603,20 +19609,16 @@ var init_billing = __esm({
19603
19609
  createdByUserId: external_exports.string().trim().min(1).nullable(),
19604
19610
  createdAt: external_exports.string().datetime()
19605
19611
  });
19606
- SPENDING_LIMIT_WINDOWS = ["hour", "day", "week", "month"];
19612
+ SPENDING_LIMIT_WINDOWS = ["day", "month"];
19607
19613
  SpendingLimitWindowSchema = external_exports.enum(SPENDING_LIMIT_WINDOWS);
19608
19614
  BilledSpendWindowsSchema = external_exports.object({
19609
- hourUsd: NonNegativeUsdSchema,
19610
19615
  dayUsd: NonNegativeUsdSchema,
19611
- weekUsd: NonNegativeUsdSchema,
19612
19616
  monthUsd: NonNegativeUsdSchema
19613
19617
  });
19614
19618
  OrganizationBillingSettingsSchema = external_exports.object({
19615
19619
  organizationId: OrganizationIdSchema,
19616
19620
  // Null means no limit for that window.
19617
- spendLimitHourUsd: PositiveUsdSchema.nullable(),
19618
19621
  spendLimitDayUsd: PositiveUsdSchema.nullable(),
19619
- spendLimitWeekUsd: PositiveUsdSchema.nullable(),
19620
19622
  spendLimitMonthUsd: PositiveUsdSchema.nullable(),
19621
19623
  autoTopUpEnabled: external_exports.boolean(),
19622
19624
  // Balance at or below the threshold triggers a top-up of the configured
@@ -19625,9 +19627,7 @@ var init_billing = __esm({
19625
19627
  autoTopUpAmountUsd: PositiveUsdSchema.nullable()
19626
19628
  });
19627
19629
  UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
19628
- spendLimitHourUsd: PositiveUsdSchema.nullable().optional(),
19629
19630
  spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
19630
- spendLimitWeekUsd: PositiveUsdSchema.nullable().optional(),
19631
19631
  spendLimitMonthUsd: PositiveUsdSchema.nullable().optional(),
19632
19632
  autoTopUpEnabled: external_exports.boolean().optional(),
19633
19633
  autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable().optional(),
@@ -31549,7 +31549,7 @@ var init_package = __esm({
31549
31549
  "package.json"() {
31550
31550
  package_default = {
31551
31551
  name: "@autohq/cli",
31552
- version: "0.1.361",
31552
+ version: "0.1.363",
31553
31553
  license: "SEE LICENSE IN README.md",
31554
31554
  publishConfig: {
31555
31555
  access: "public"
@@ -44597,7 +44597,7 @@ var ClaudeAgentBridgeSessionImpl = class {
44597
44597
  this.input.writeOutput?.(
44598
44598
  `agent_bridge_claude_startup_failed duration_ms=${Date.now() - startedAt} error=${error51 instanceof Error ? error51.message : String(error51)}`
44599
44599
  );
44600
- if (this.options.resume !== void 0 && this.state.kind !== "closed") {
44600
+ if (this.options.resume !== void 0 && this.input.allowResumeFallback !== false && this.state.kind !== "closed") {
44601
44601
  const { resume, ...optionsWithoutResume } = this.options;
44602
44602
  this.options = optionsWithoutResume;
44603
44603
  this.input.writeOutput?.(
@@ -45259,7 +45259,11 @@ var ClaudeCodeCommandHandler = class {
45259
45259
  context = null;
45260
45260
  agentSession = null;
45261
45261
  claudeConfig;
45262
+ // Selection-change restarts happen in-process, so prefer the live SDK id even
45263
+ // when the file resume store is stale or temporarily unreadable.
45264
+ lastObservedAgentId = null;
45262
45265
  persistedAgentId = null;
45266
+ requireResumeForNextAgentSession = false;
45263
45267
  injectedCommands = /* @__PURE__ */ new Set();
45264
45268
  // Message commands whose injection has started but not settled. A fresh SDK
45265
45269
  // warm inside sendMessage can outlast the bridge's command-ack window, so a
@@ -45683,14 +45687,19 @@ var ClaudeCodeCommandHandler = class {
45683
45687
  );
45684
45688
  }
45685
45689
  persistAgentId(activeContext, message) {
45686
- const store = this.input.sessionResume;
45687
- if (!store) {
45690
+ if (!("session_id" in message) || typeof message.session_id !== "string") {
45688
45691
  return;
45689
45692
  }
45690
- if (!("session_id" in message) || typeof message.session_id !== "string") {
45693
+ if (!message.session_id) {
45691
45694
  return;
45692
45695
  }
45693
- if (!message.session_id || message.session_id === this.persistedAgentId) {
45696
+ this.lastObservedAgentId = message.session_id;
45697
+ this.requireResumeForNextAgentSession = false;
45698
+ const store = this.input.sessionResume;
45699
+ if (!store) {
45700
+ return;
45701
+ }
45702
+ if (message.session_id === this.persistedAgentId) {
45694
45703
  return;
45695
45704
  }
45696
45705
  try {
@@ -45720,13 +45729,24 @@ var ClaudeCodeCommandHandler = class {
45720
45729
  return void 0;
45721
45730
  }
45722
45731
  }
45732
+ resumeAgentIdForNextSession() {
45733
+ return this.lastObservedAgentId ?? this.storedResumeAgentId();
45734
+ }
45723
45735
  ensureAgentSession() {
45724
45736
  if (this.agentSession) {
45725
45737
  return this.agentSession;
45726
45738
  }
45739
+ const resumeRequired = this.requireResumeForNextAgentSession;
45740
+ const resumeAgentId = this.resumeAgentIdForNextSession();
45741
+ if (resumeRequired && !resumeAgentId) {
45742
+ throw new Error(
45743
+ "Cannot restart Claude Code for a model/effort selection change without a session id to resume"
45744
+ );
45745
+ }
45727
45746
  const session = claudeAgentBridgeRuntime.start({
45728
45747
  claude: this.claudeConfig,
45729
- resumeAgentId: this.storedResumeAgentId(),
45748
+ resumeAgentId,
45749
+ ...resumeRequired ? { allowResumeFallback: false } : {},
45730
45750
  canUseTool: this.canUseTool,
45731
45751
  onMessage: (message, meta3) => this.handleAgentMessage(message, meta3),
45732
45752
  onError: (error51) => this.handleAgentError(error51),
@@ -45756,6 +45776,7 @@ var ClaudeCodeCommandHandler = class {
45756
45776
  return;
45757
45777
  }
45758
45778
  this.claudeConfig = next;
45779
+ this.requireResumeForNextAgentSession = this.lastObservedAgentId !== null;
45759
45780
  this.agentSession?.close();
45760
45781
  this.agentSession = null;
45761
45782
  this.settlePendingQuestions("The runtime restarted to change model");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.361",
3
+ "version": "0.1.363",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"