@atlasharness/atlascode 0.1.16 → 0.1.18

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.
Files changed (2) hide show
  1. package/dist/cli.js +750 -534
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -129,6 +129,29 @@ function cliOk(msg) {
129
129
  return;
130
130
  }
131
131
 
132
+ // src/cli/crashBackstop.ts
133
+ function registerGlobalCrashBackstop() {
134
+ if (registered) {
135
+ return;
136
+ }
137
+ registered = true;
138
+ process.on("uncaughtException", (error) => {
139
+ writeCrashDiag("uncaughtException", error);
140
+ });
141
+ process.on("unhandledRejection", (reason) => {
142
+ writeCrashDiag("unhandledRejection", reason);
143
+ });
144
+ }
145
+ function writeCrashDiag(kind, value) {
146
+ const formatted = value instanceof Error ? `${value.name}: ${value.message}
147
+ ${value.stack ?? ""}`.trim() : String(value);
148
+ try {
149
+ process.stderr.write(`[atlas][${kind}] ${formatted}
150
+ `);
151
+ } catch {}
152
+ }
153
+ var registered = false;
154
+
132
155
  // src/shared/feature.ts
133
156
  function feature(name) {
134
157
  const key = "FEATURE_" + name;
@@ -668,266 +691,6 @@ var init_shared = __esm(() => {
668
691
  init_types();
669
692
  });
670
693
 
671
- // src/engine/pipeline/errorClassification.ts
672
- function classifyToolError(error) {
673
- if (error instanceof Error) {
674
- const errnoCode = error.code;
675
- if (typeof errnoCode === "string") {
676
- return `Error:${errnoCode}`;
677
- }
678
- if (error.name && error.name !== "Error" && error.name.length > 3) {
679
- return error.name.slice(0, 60);
680
- }
681
- return "Error";
682
- }
683
- return "UnknownError";
684
- }
685
-
686
- // src/engine/pipeline/schemaValidation.ts
687
- function typeName(v) {
688
- if (v === null)
689
- return "null";
690
- if (Array.isArray(v))
691
- return "array";
692
- return typeof v;
693
- }
694
- function checkBasicType(value, type) {
695
- switch (type) {
696
- case "string":
697
- return typeof value === "string" ? null : `expected string, got ${typeName(value)}`;
698
- case "number":
699
- if (typeof value === "number") {
700
- return Number.isFinite(value) ? null : "expected number, got non-finite number";
701
- }
702
- return `expected number, got ${typeName(value)}`;
703
- case "integer":
704
- if (typeof value === "number") {
705
- return Number.isInteger(value) ? null : "expected integer, got non-integer number";
706
- }
707
- return `expected integer, got ${typeName(value)}`;
708
- case "boolean":
709
- return typeof value === "boolean" ? null : `expected boolean, got ${typeName(value)}`;
710
- case "array":
711
- return Array.isArray(value) ? null : `expected array, got ${typeName(value)}`;
712
- case "object":
713
- return typeof value === "object" && value !== null && !Array.isArray(value) ? null : `expected object, got ${typeName(value)}`;
714
- case "null":
715
- return value === null ? null : `expected null, got ${typeName(value)}`;
716
- default:
717
- return null;
718
- }
719
- }
720
- function validateInputBySchema(input, schema) {
721
- if (!schema) {
722
- return { valid: true };
723
- }
724
- if (input === null || typeof input !== "object" || Array.isArray(input)) {
725
- return { valid: false, message: "expected object input" };
726
- }
727
- const record = input;
728
- const errors = [];
729
- const required = schema.required;
730
- if (Array.isArray(required)) {
731
- for (const rawKey of required) {
732
- const key = String(rawKey);
733
- if (!(key in record) || record[key] === undefined) {
734
- errors.push(`missing required field "${key}"`);
735
- }
736
- }
737
- }
738
- const properties = schema.properties;
739
- if (properties) {
740
- for (const [key, value] of Object.entries(record)) {
741
- if (value === undefined)
742
- continue;
743
- const propSchema = properties[key];
744
- if (!propSchema || typeof propSchema !== "object")
745
- continue;
746
- const type = propSchema.type;
747
- if (typeof type !== "string")
748
- continue;
749
- const err = checkBasicType(value, type);
750
- if (err)
751
- errors.push(`field "${key}": ${err}`);
752
- }
753
- }
754
- return errors.length > 0 ? { valid: false, message: errors.join("; ") } : { valid: true };
755
- }
756
- function buildSchemaNotSentHint(tool, discoveredToolNames) {
757
- if (!tool.shouldDefer)
758
- return null;
759
- if (discoveredToolNames.has(tool.name))
760
- return null;
761
- return `
762
-
763
- This tool's schema was not sent to the API — it was not in the discovered-tool set derived from message history. ` + `Without the schema in your prompt, typed parameters (arrays, numbers, booleans) get emitted as strings and the client-side parser rejects them. ` + `Re-issue the call with correctly-typed parameters (arrays/numbers/booleans, not their string forms).`;
764
- }
765
-
766
- // src/engine/pipeline/toolExecution.ts
767
- function mergeHookPermission(hookBehavior, gate) {
768
- if (hookBehavior === "deny") {
769
- return { allowed: false, reason: "blocked by hook" };
770
- }
771
- if (!gate.allowed)
772
- return gate;
773
- if (hookBehavior === "ask") {
774
- return { allowed: false, ask: true, reason: "hook requested confirmation" };
775
- }
776
- return gate;
777
- }
778
- function findTool(tools, name) {
779
- return tools.find((t) => t.name === name || (t.aliases?.includes(name) ?? false));
780
- }
781
- async function executeToolUse(tu, assistantMsg, deps) {
782
- const tool = findTool(deps.tools, tu.name);
783
- if (!tool) {
784
- return {
785
- block: {
786
- type: "tool_result",
787
- tool_use_id: tu.id,
788
- content: `unknown tool: ${tu.name}`,
789
- is_error: true
790
- },
791
- isError: true
792
- };
793
- }
794
- const toolCallContext = deps.toolContext !== undefined ? { ...deps.toolContext, signal: deps.signal, checkPermission: deps.checkPermission } : { signal: deps.signal, checkPermission: deps.checkPermission };
795
- const schemaResult = validateInputBySchema(tu.input, tool.inputSchema);
796
- if (schemaResult.valid === false) {
797
- const discovered = deps.discoveredToolNames ?? new Set(deps.tools.map((t) => t.name));
798
- const schemaHint = buildSchemaNotSentHint(tool, discovered);
799
- const errorContent = schemaHint ? `${schemaResult.message}${schemaHint}` : schemaResult.message;
800
- return {
801
- block: {
802
- type: "tool_result",
803
- tool_use_id: tu.id,
804
- content: `<tool_use_error>InputValidationError: ${errorContent}</tool_use_error>`,
805
- is_error: true
806
- },
807
- isError: true
808
- };
809
- }
810
- const validation = await tool.validateInput?.(tu.input, toolCallContext);
811
- if (validation && validation.result === false) {
812
- return {
813
- block: {
814
- type: "tool_result",
815
- tool_use_id: tu.id,
816
- content: `<tool_use_error>InputValidationError: ${validation.message}</tool_use_error>`,
817
- is_error: true
818
- },
819
- isError: true
820
- };
821
- }
822
- const preOutcome = await deps.hooks?.preToolUse?.(tool, tu.input, tu.id);
823
- if (preOutcome?.blockingError) {
824
- return {
825
- block: {
826
- type: "tool_result",
827
- tool_use_id: tu.id,
828
- content: `<tool_use_error>hook blocked: ${preOutcome.blockingError}</tool_use_error>`,
829
- is_error: true
830
- },
831
- isError: true
832
- };
833
- }
834
- if (preOutcome?.preventContinuation) {
835
- return {
836
- block: {
837
- type: "tool_result",
838
- tool_use_id: tu.id,
839
- content: `<tool_use_error>Execution stopped by PreToolUse hook${preOutcome.stopReason ? `: ${preOutcome.stopReason}` : ""}</tool_use_error>`,
840
- is_error: true
841
- },
842
- isError: true
843
- };
844
- }
845
- const effectiveInput = preOutcome?.updatedInput ?? tu.input;
846
- const gateVerdict = deps.checkPermission ? await deps.checkPermission(tool, effectiveInput, {
847
- toolUseId: tu.id,
848
- assistantMessage: assistantMsg
849
- }) : { allowed: true };
850
- const verdict = mergeHookPermission(preOutcome?.hookBehavior, gateVerdict);
851
- if (!verdict.allowed) {
852
- const content = verdict.ask ? `<tool_use_error>permission confirmation required (prompt 面残留守): ${verdict.reason ?? tu.name}</tool_use_error>` : `<tool_use_error>permission denied: ${verdict.reason ?? tu.name}</tool_use_error>`;
853
- return {
854
- block: {
855
- type: "tool_result",
856
- tool_use_id: tu.id,
857
- content,
858
- is_error: true
859
- },
860
- isError: true
861
- };
862
- }
863
- const callInput = verdict.updatedInput ?? effectiveInput;
864
- let block;
865
- let isError = false;
866
- let toolUseResult;
867
- try {
868
- const res = await tool.call(callInput, toolCallContext, undefined, assistantMsg);
869
- block = tool.mapToolResultToToolResultBlockParam(res.data, tu.id);
870
- toolUseResult = res.data;
871
- } catch (error) {
872
- const errorText = `tool error [${classifyToolError(error)}]: ${String(error?.message ?? error)}`;
873
- block = {
874
- type: "tool_result",
875
- tool_use_id: tu.id,
876
- content: `<tool_use_error>${errorText}</tool_use_error>`,
877
- is_error: true
878
- };
879
- isError = true;
880
- toolUseResult = errorText;
881
- }
882
- const postOutcome = await deps.hooks?.postToolUse?.(tool, callInput, block, tu.id);
883
- return { block, isError, toolUseResult };
884
- }
885
- var init_toolExecution = () => {};
886
-
887
- // src/engine/pipeline/toolOrchestration.ts
888
- function partitionToolCalls(toolUses, tools) {
889
- return toolUses.reduce((acc, tu) => {
890
- const tool = findTool(tools, tu.name);
891
- let safe = false;
892
- try {
893
- safe = tool ? tool.isConcurrencySafe(tu.input) : false;
894
- } catch {
895
- safe = false;
896
- }
897
- if (safe && acc[acc.length - 1]?.isConcurrencySafe) {
898
- acc[acc.length - 1].blocks.push(tu);
899
- } else {
900
- acc.push({ isConcurrencySafe: safe, blocks: [tu] });
901
- }
902
- return acc;
903
- }, []);
904
- }
905
- async function runToolBatch(toolUses, assistantMsg, deps) {
906
- const outcomes = [];
907
- for (const batch of partitionToolCalls(toolUses, deps.tools)) {
908
- for (const tu of batch.blocks) {
909
- const r = await executeToolUse(tu, assistantMsg, deps);
910
- outcomes.push({
911
- toolUseId: tu.id,
912
- name: tu.name,
913
- block: r.block,
914
- isError: r.isError,
915
- toolUseResult: r.toolUseResult
916
- });
917
- }
918
- }
919
- return outcomes;
920
- }
921
- var init_toolOrchestration = __esm(() => {
922
- init_toolExecution();
923
- });
924
-
925
- // src/engine/pipeline/index.ts
926
- var init_pipeline = __esm(() => {
927
- init_toolExecution();
928
- init_toolOrchestration();
929
- });
930
-
931
694
  // node_modules/openai/internal/tslib.mjs
932
695
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
933
696
  if (kind === "m")
@@ -27094,12 +26857,14 @@ function startLlmWaitHeartbeat(modelId, attempt, totalRetries) {
27094
26857
  class OpenAIProvider {
27095
26858
  maxRetriesPerModel;
27096
26859
  timeoutMs;
27097
- constructor(maxRetriesPerModel = 3, timeoutMs = LLM_TIMEOUT_DEFAULT_MS) {
26860
+ timeoutResolver;
26861
+ constructor(maxRetriesPerModel = 3, timeoutMs = LLM_TIMEOUT_DEFAULT_MS, timeoutResolver) {
27098
26862
  this.maxRetriesPerModel = maxRetriesPerModel;
27099
26863
  this.timeoutMs = timeoutMs;
26864
+ this.timeoutResolver = timeoutResolver;
27100
26865
  }
27101
26866
  getTimeoutMs() {
27102
- return this.timeoutMs;
26867
+ return this.timeoutResolver ? this.timeoutResolver() : this.timeoutMs;
27103
26868
  }
27104
26869
  async chat(args) {
27105
26870
  const refs = getRoleModels(args.role, args.sessionModel, args.fallbackModel);
@@ -27139,7 +26904,7 @@ class OpenAIProvider {
27139
26904
  const stopWait = startLlmWaitHeartbeat(entry.modelId, attempt, this.maxRetriesPerModel);
27140
26905
  let res;
27141
26906
  try {
27142
- res = await client.chat.completions.create(params, { signal: args.signal, timeout: this.timeoutMs });
26907
+ res = await client.chat.completions.create(params, { signal: args.signal, timeout: this.getTimeoutMs() });
27143
26908
  } finally {
27144
26909
  stopWait();
27145
26910
  }
@@ -27256,7 +27021,7 @@ class OpenAIProvider {
27256
27021
  const stopWait = startLlmWaitHeartbeat(entry.modelId, attempt, totalRetries);
27257
27022
  let stream;
27258
27023
  try {
27259
- stream = await client.chat.completions.create({ ...params, stream: true, stream_options: { include_usage: true } }, { signal, timeout: this.timeoutMs });
27024
+ stream = await client.chat.completions.create({ ...params, stream: true, stream_options: { include_usage: true } }, { signal, timeout: this.getTimeoutMs() });
27260
27025
  } finally {
27261
27026
  stopWait();
27262
27027
  }
@@ -27444,7 +27209,7 @@ class OpenAIProvider {
27444
27209
  const wav = Buffer.concat([header, pcm]);
27445
27210
  const file = new File([wav], "audio.wav", { type: "audio/wav" });
27446
27211
  const client = getClientForEntry(entry);
27447
- const resp = await client.audio.transcriptions.create({ file, model, ...language ? { language } : {} }, { timeout: this.timeoutMs });
27212
+ const resp = await client.audio.transcriptions.create({ file, model, ...language ? { language } : {} }, { timeout: this.getTimeoutMs() });
27448
27213
  return resp?.text ?? "";
27449
27214
  }
27450
27215
  async synthesizeSpeech(text, model, voice) {
@@ -27458,7 +27223,7 @@ class OpenAIProvider {
27458
27223
  voice: voice || "alloy",
27459
27224
  input: text,
27460
27225
  response_format: "mp3"
27461
- }, { timeout: this.timeoutMs });
27226
+ }, { timeout: this.getTimeoutMs() });
27462
27227
  const buf = await resp.arrayBuffer();
27463
27228
  return Buffer.from(buf);
27464
27229
  }
@@ -27779,7 +27544,7 @@ var init_queryWithRoleFallback = __esm(() => {
27779
27544
 
27780
27545
  // src/modelprovider/index.ts
27781
27546
  function getModelProvider() {
27782
- return _provider ??= new OpenAIProvider(3, resolveLlmTimeoutMs(process.env.ATLAS_LLM_TIMEOUT, llmTimeoutSettingsSource?.()));
27547
+ return _provider ??= new OpenAIProvider(3, LLM_TIMEOUT_DEFAULT_MS, () => resolveLlmTimeoutMs(process.env.ATLAS_LLM_TIMEOUT, llmTimeoutSettingsSource?.()));
27783
27548
  }
27784
27549
  function setLlmTimeoutSettingsSource(next) {
27785
27550
  llmTimeoutSettingsSource = next;
@@ -27829,6 +27594,345 @@ var init_modelprovider2 = __esm(() => {
27829
27594
  modelProvider = lazyProxy(getModelProvider);
27830
27595
  });
27831
27596
 
27597
+ // src/engine/query/turnRecovery.ts
27598
+ function parseNonNegativeInt(value, fallback) {
27599
+ if (value === undefined || value === "")
27600
+ return fallback;
27601
+ const n = Number.parseInt(value, 10);
27602
+ return Number.isFinite(n) && n >= 0 ? n : fallback;
27603
+ }
27604
+ function resolveTurnRecoveryConfig(env = process.env) {
27605
+ return {
27606
+ enabled: env.ATLAS_TURN_RECOVER_ENABLED !== "0",
27607
+ maxRetries: parseNonNegativeInt(env.ATLAS_TURN_RECOVER_MAX, DEFAULT_MAX_RETRIES),
27608
+ backoffBaseMs: parseNonNegativeInt(env.ATLAS_TURN_RECOVER_BACKOFF_MS, DEFAULT_BACKOFF_BASE_MS),
27609
+ backoffCapMs: parseNonNegativeInt(env.ATLAS_TURN_RECOVER_BACKOFF_CAP_MS, DEFAULT_BACKOFF_CAP_MS)
27610
+ };
27611
+ }
27612
+ function turnRecoveryBackoffMs(attempt, baseMs, capMs) {
27613
+ const base = Math.max(0, baseMs);
27614
+ const cap = Math.max(base, capMs);
27615
+ if (attempt <= 0)
27616
+ return Math.min(base, cap);
27617
+ return Math.min(base * 2 ** attempt, cap);
27618
+ }
27619
+ function sleepSignalAware(ms, signal) {
27620
+ if (ms <= 0)
27621
+ return Promise.resolve();
27622
+ return new Promise((resolve) => {
27623
+ if (signal?.aborted) {
27624
+ resolve();
27625
+ return;
27626
+ }
27627
+ let settled = false;
27628
+ const timer = setTimeout(() => {
27629
+ settled = true;
27630
+ if (signal)
27631
+ signal.removeEventListener("abort", onAbort);
27632
+ resolve();
27633
+ }, ms);
27634
+ function onAbort() {
27635
+ if (settled)
27636
+ return;
27637
+ settled = true;
27638
+ clearTimeout(timer);
27639
+ resolve();
27640
+ }
27641
+ if (signal)
27642
+ signal.addEventListener("abort", onAbort, { once: true });
27643
+ });
27644
+ }
27645
+ async function withTurnRecovery(attempt, options = {}) {
27646
+ const cfg = options.config ?? resolveTurnRecoveryConfig();
27647
+ if (!cfg.enabled) {
27648
+ return attempt();
27649
+ }
27650
+ let lastErr;
27651
+ for (let i = 0;i <= cfg.maxRetries; i++) {
27652
+ if (i > 0 && options.signal?.aborted) {
27653
+ throw options.signal.reason ?? new Error("aborted");
27654
+ }
27655
+ try {
27656
+ return await attempt();
27657
+ } catch (err) {
27658
+ lastErr = err;
27659
+ if (i < cfg.maxRetries && shouldRetryModelError(err, options.signal)) {
27660
+ const backoff = turnRecoveryBackoffMs(i, cfg.backoffBaseMs, cfg.backoffCapMs);
27661
+ if (backoff > 0) {
27662
+ await sleepSignalAware(backoff, options.signal);
27663
+ }
27664
+ continue;
27665
+ }
27666
+ throw err;
27667
+ }
27668
+ }
27669
+ throw lastErr;
27670
+ }
27671
+ var DEFAULT_MAX_RETRIES = 13, DEFAULT_BACKOFF_BASE_MS = 100, DEFAULT_BACKOFF_CAP_MS = 1000;
27672
+ var init_turnRecovery = __esm(() => {
27673
+ init_modelprovider2();
27674
+ });
27675
+
27676
+ // src/engine/pipeline/errorClassification.ts
27677
+ function classifyToolError(error) {
27678
+ if (error instanceof Error) {
27679
+ const errnoCode = error.code;
27680
+ if (typeof errnoCode === "string") {
27681
+ return `Error:${errnoCode}`;
27682
+ }
27683
+ if (error.name && error.name !== "Error" && error.name.length > 3) {
27684
+ return error.name.slice(0, 60);
27685
+ }
27686
+ return "Error";
27687
+ }
27688
+ return "UnknownError";
27689
+ }
27690
+
27691
+ // src/engine/pipeline/schemaValidation.ts
27692
+ function typeName(v) {
27693
+ if (v === null)
27694
+ return "null";
27695
+ if (Array.isArray(v))
27696
+ return "array";
27697
+ return typeof v;
27698
+ }
27699
+ function checkBasicType(value, type) {
27700
+ switch (type) {
27701
+ case "string":
27702
+ return typeof value === "string" ? null : `expected string, got ${typeName(value)}`;
27703
+ case "number":
27704
+ if (typeof value === "number") {
27705
+ return Number.isFinite(value) ? null : "expected number, got non-finite number";
27706
+ }
27707
+ return `expected number, got ${typeName(value)}`;
27708
+ case "integer":
27709
+ if (typeof value === "number") {
27710
+ return Number.isInteger(value) ? null : "expected integer, got non-integer number";
27711
+ }
27712
+ return `expected integer, got ${typeName(value)}`;
27713
+ case "boolean":
27714
+ return typeof value === "boolean" ? null : `expected boolean, got ${typeName(value)}`;
27715
+ case "array":
27716
+ return Array.isArray(value) ? null : `expected array, got ${typeName(value)}`;
27717
+ case "object":
27718
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? null : `expected object, got ${typeName(value)}`;
27719
+ case "null":
27720
+ return value === null ? null : `expected null, got ${typeName(value)}`;
27721
+ default:
27722
+ return null;
27723
+ }
27724
+ }
27725
+ function validateInputBySchema(input, schema) {
27726
+ if (!schema) {
27727
+ return { valid: true };
27728
+ }
27729
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
27730
+ return { valid: false, message: "expected object input" };
27731
+ }
27732
+ const record = input;
27733
+ const errors = [];
27734
+ const required = schema.required;
27735
+ if (Array.isArray(required)) {
27736
+ for (const rawKey of required) {
27737
+ const key = String(rawKey);
27738
+ if (!(key in record) || record[key] === undefined) {
27739
+ errors.push(`missing required field "${key}"`);
27740
+ }
27741
+ }
27742
+ }
27743
+ const properties = schema.properties;
27744
+ if (properties) {
27745
+ for (const [key, value] of Object.entries(record)) {
27746
+ if (value === undefined)
27747
+ continue;
27748
+ const propSchema = properties[key];
27749
+ if (!propSchema || typeof propSchema !== "object")
27750
+ continue;
27751
+ const type = propSchema.type;
27752
+ if (typeof type !== "string")
27753
+ continue;
27754
+ const err = checkBasicType(value, type);
27755
+ if (err)
27756
+ errors.push(`field "${key}": ${err}`);
27757
+ }
27758
+ }
27759
+ return errors.length > 0 ? { valid: false, message: errors.join("; ") } : { valid: true };
27760
+ }
27761
+ function buildSchemaNotSentHint(tool, discoveredToolNames) {
27762
+ if (!tool.shouldDefer)
27763
+ return null;
27764
+ if (discoveredToolNames.has(tool.name))
27765
+ return null;
27766
+ return `
27767
+
27768
+ This tool's schema was not sent to the API — it was not in the discovered-tool set derived from message history. ` + `Without the schema in your prompt, typed parameters (arrays, numbers, booleans) get emitted as strings and the client-side parser rejects them. ` + `Re-issue the call with correctly-typed parameters (arrays/numbers/booleans, not their string forms).`;
27769
+ }
27770
+
27771
+ // src/engine/pipeline/toolExecution.ts
27772
+ function mergeHookPermission(hookBehavior, gate) {
27773
+ if (hookBehavior === "deny") {
27774
+ return { allowed: false, reason: "blocked by hook" };
27775
+ }
27776
+ if (!gate.allowed)
27777
+ return gate;
27778
+ if (hookBehavior === "ask") {
27779
+ return { allowed: false, ask: true, reason: "hook requested confirmation" };
27780
+ }
27781
+ return gate;
27782
+ }
27783
+ function findTool(tools, name) {
27784
+ return tools.find((t) => t.name === name || (t.aliases?.includes(name) ?? false));
27785
+ }
27786
+ async function executeToolUse(tu, assistantMsg, deps) {
27787
+ const tool = findTool(deps.tools, tu.name);
27788
+ if (!tool) {
27789
+ return {
27790
+ block: {
27791
+ type: "tool_result",
27792
+ tool_use_id: tu.id,
27793
+ content: `unknown tool: ${tu.name}`,
27794
+ is_error: true
27795
+ },
27796
+ isError: true
27797
+ };
27798
+ }
27799
+ const toolCallContext = deps.toolContext !== undefined ? { ...deps.toolContext, signal: deps.signal, checkPermission: deps.checkPermission } : { signal: deps.signal, checkPermission: deps.checkPermission };
27800
+ const schemaResult = validateInputBySchema(tu.input, tool.inputSchema);
27801
+ if (schemaResult.valid === false) {
27802
+ const discovered = deps.discoveredToolNames ?? new Set(deps.tools.map((t) => t.name));
27803
+ const schemaHint = buildSchemaNotSentHint(tool, discovered);
27804
+ const errorContent = schemaHint ? `${schemaResult.message}${schemaHint}` : schemaResult.message;
27805
+ return {
27806
+ block: {
27807
+ type: "tool_result",
27808
+ tool_use_id: tu.id,
27809
+ content: `<tool_use_error>InputValidationError: ${errorContent}</tool_use_error>`,
27810
+ is_error: true
27811
+ },
27812
+ isError: true
27813
+ };
27814
+ }
27815
+ const validation = await tool.validateInput?.(tu.input, toolCallContext);
27816
+ if (validation && validation.result === false) {
27817
+ return {
27818
+ block: {
27819
+ type: "tool_result",
27820
+ tool_use_id: tu.id,
27821
+ content: `<tool_use_error>InputValidationError: ${validation.message}</tool_use_error>`,
27822
+ is_error: true
27823
+ },
27824
+ isError: true
27825
+ };
27826
+ }
27827
+ const preOutcome = await deps.hooks?.preToolUse?.(tool, tu.input, tu.id);
27828
+ if (preOutcome?.blockingError) {
27829
+ return {
27830
+ block: {
27831
+ type: "tool_result",
27832
+ tool_use_id: tu.id,
27833
+ content: `<tool_use_error>hook blocked: ${preOutcome.blockingError}</tool_use_error>`,
27834
+ is_error: true
27835
+ },
27836
+ isError: true
27837
+ };
27838
+ }
27839
+ if (preOutcome?.preventContinuation) {
27840
+ return {
27841
+ block: {
27842
+ type: "tool_result",
27843
+ tool_use_id: tu.id,
27844
+ content: `<tool_use_error>Execution stopped by PreToolUse hook${preOutcome.stopReason ? `: ${preOutcome.stopReason}` : ""}</tool_use_error>`,
27845
+ is_error: true
27846
+ },
27847
+ isError: true
27848
+ };
27849
+ }
27850
+ const effectiveInput = preOutcome?.updatedInput ?? tu.input;
27851
+ const gateVerdict = deps.checkPermission ? await deps.checkPermission(tool, effectiveInput, {
27852
+ toolUseId: tu.id,
27853
+ assistantMessage: assistantMsg
27854
+ }) : { allowed: true };
27855
+ const verdict = mergeHookPermission(preOutcome?.hookBehavior, gateVerdict);
27856
+ if (!verdict.allowed) {
27857
+ const content = verdict.ask ? `<tool_use_error>permission confirmation required (prompt 面残留守): ${verdict.reason ?? tu.name}</tool_use_error>` : `<tool_use_error>permission denied: ${verdict.reason ?? tu.name}</tool_use_error>`;
27858
+ return {
27859
+ block: {
27860
+ type: "tool_result",
27861
+ tool_use_id: tu.id,
27862
+ content,
27863
+ is_error: true
27864
+ },
27865
+ isError: true
27866
+ };
27867
+ }
27868
+ const callInput = verdict.updatedInput ?? effectiveInput;
27869
+ let block;
27870
+ let isError = false;
27871
+ let toolUseResult;
27872
+ try {
27873
+ const res = await tool.call(callInput, toolCallContext, undefined, assistantMsg);
27874
+ block = tool.mapToolResultToToolResultBlockParam(res.data, tu.id);
27875
+ toolUseResult = res.data;
27876
+ } catch (error) {
27877
+ const errorText = `tool error [${classifyToolError(error)}]: ${String(error?.message ?? error)}`;
27878
+ block = {
27879
+ type: "tool_result",
27880
+ tool_use_id: tu.id,
27881
+ content: `<tool_use_error>${errorText}</tool_use_error>`,
27882
+ is_error: true
27883
+ };
27884
+ isError = true;
27885
+ toolUseResult = errorText;
27886
+ }
27887
+ const postOutcome = await deps.hooks?.postToolUse?.(tool, callInput, block, tu.id);
27888
+ return { block, isError, toolUseResult };
27889
+ }
27890
+ var init_toolExecution = () => {};
27891
+
27892
+ // src/engine/pipeline/toolOrchestration.ts
27893
+ function partitionToolCalls(toolUses, tools) {
27894
+ return toolUses.reduce((acc, tu) => {
27895
+ const tool = findTool(tools, tu.name);
27896
+ let safe = false;
27897
+ try {
27898
+ safe = tool ? tool.isConcurrencySafe(tu.input) : false;
27899
+ } catch {
27900
+ safe = false;
27901
+ }
27902
+ if (safe && acc[acc.length - 1]?.isConcurrencySafe) {
27903
+ acc[acc.length - 1].blocks.push(tu);
27904
+ } else {
27905
+ acc.push({ isConcurrencySafe: safe, blocks: [tu] });
27906
+ }
27907
+ return acc;
27908
+ }, []);
27909
+ }
27910
+ async function runToolBatch(toolUses, assistantMsg, deps) {
27911
+ const outcomes = [];
27912
+ for (const batch of partitionToolCalls(toolUses, deps.tools)) {
27913
+ for (const tu of batch.blocks) {
27914
+ const r = await executeToolUse(tu, assistantMsg, deps);
27915
+ outcomes.push({
27916
+ toolUseId: tu.id,
27917
+ name: tu.name,
27918
+ block: r.block,
27919
+ isError: r.isError,
27920
+ toolUseResult: r.toolUseResult
27921
+ });
27922
+ }
27923
+ }
27924
+ return outcomes;
27925
+ }
27926
+ var init_toolOrchestration = __esm(() => {
27927
+ init_toolExecution();
27928
+ });
27929
+
27930
+ // src/engine/pipeline/index.ts
27931
+ var init_pipeline = __esm(() => {
27932
+ init_toolExecution();
27933
+ init_toolOrchestration();
27934
+ });
27935
+
27832
27936
  // node_modules/zod/index.js
27833
27937
  var init_zod = __esm(() => {
27834
27938
  init_external();
@@ -80612,7 +80716,9 @@ async function queryOneRound(deps, tools, messages) {
80612
80716
  fallbackModel: deps.fallbackModel,
80613
80717
  options: deps.effortValue !== undefined ? { effortValue: deps.effortValue } : undefined
80614
80718
  };
80615
- let resp = await deps.modelProvider.chat(chatArgs);
80719
+ let resp = await withTurnRecovery(() => deps.modelProvider.chat(chatArgs), {
80720
+ signal: deps.signal
80721
+ });
80616
80722
  let assistantContent = resp.message.content ?? [];
80617
80723
  const isEmptyContent = (content) => {
80618
80724
  if (!Array.isArray(content))
@@ -80627,7 +80733,9 @@ async function queryOneRound(deps, tools, messages) {
80627
80733
  });
80628
80734
  };
80629
80735
  if (isEmptyContent(assistantContent) && !deps.signal?.aborted) {
80630
- const retried = await deps.modelProvider.chat(chatArgs);
80736
+ const retried = await withTurnRecovery(() => deps.modelProvider.chat(chatArgs), {
80737
+ signal: deps.signal
80738
+ });
80631
80739
  const retriedContent = retried.message.content ?? [];
80632
80740
  if (!isEmptyContent(retriedContent)) {
80633
80741
  resp = retried;
@@ -80759,6 +80867,7 @@ async function queryAgentLoop(deps, args) {
80759
80867
  var DEFAULT_AGENT_LOOP_MAX_TURNS = 20;
80760
80868
  var init_loop = __esm(() => {
80761
80869
  init_shared();
80870
+ init_turnRecovery();
80762
80871
  init_pipeline();
80763
80872
  init_context();
80764
80873
  });
@@ -80779,6 +80888,7 @@ var init_QueryEngine = __esm(() => {
80779
80888
  // src/engine/query/index.ts
80780
80889
  var init_query2 = __esm(() => {
80781
80890
  init_loop();
80891
+ init_turnRecovery();
80782
80892
  init_QueryEngine();
80783
80893
  });
80784
80894
 
@@ -130185,7 +130295,7 @@ var init_modelAllowlist = __esm(() => {
130185
130295
  init_aliases();
130186
130296
  init_model();
130187
130297
  init_modelprovider2();
130188
- AUTO_MODE_ROLES = ["premium", "small"];
130298
+ AUTO_MODE_ROLES = ["premium", "fast", "small"];
130189
130299
  });
130190
130300
 
130191
130301
  // src/tui/utils/model/model.ts
@@ -203103,7 +203213,7 @@ var init_drainRunLoop = __esm(() => {
203103
203213
 
203104
203214
  // src/tui/utils/computerUse/escHotkey.ts
203105
203215
  function registerEscHotkey(onEscape) {
203106
- if (registered)
203216
+ if (registered2)
203107
203217
  return true;
203108
203218
  const cu = requireComputerUseSwift();
203109
203219
  if (!cu.hotkey.registerEscape(onEscape)) {
@@ -203111,16 +203221,16 @@ function registerEscHotkey(onEscape) {
203111
203221
  return false;
203112
203222
  }
203113
203223
  retainPump();
203114
- registered = true;
203224
+ registered2 = true;
203115
203225
  logForDebugging3("[cu-esc] registered");
203116
203226
  return true;
203117
203227
  }
203118
203228
  function notifyExpectedEscape() {
203119
- if (!registered)
203229
+ if (!registered2)
203120
203230
  return;
203121
203231
  requireComputerUseSwift().hotkey.notifyExpectedEscape();
203122
203232
  }
203123
- var registered = false;
203233
+ var registered2 = false;
203124
203234
  var init_escHotkey = __esm(() => {
203125
203235
  init_debug();
203126
203236
  init_drainRunLoop();
@@ -272332,9 +272442,9 @@ function getDefaultMaxRetries() {
272332
272442
  if (process.env.ATLAS_MAX_RETRIES) {
272333
272443
  return parseInt(process.env.ATLAS_MAX_RETRIES || "", 10);
272334
272444
  }
272335
- return DEFAULT_MAX_RETRIES;
272445
+ return DEFAULT_MAX_RETRIES2;
272336
272446
  }
272337
- var DEFAULT_MAX_RETRIES = 10, BASE_DELAY_MS = 500, FOREGROUND_529_RETRY_SOURCES, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS;
272447
+ var DEFAULT_MAX_RETRIES2 = 10, BASE_DELAY_MS = 500, FOREGROUND_529_RETRY_SOURCES, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS;
272338
272448
  var init_withRetry = __esm(() => {
272339
272449
  init_shared();
272340
272450
  init_atlas();
@@ -331051,7 +331161,7 @@ async function installPluginFromMarketplace({
331051
331161
  }
331052
331162
  return {
331053
331163
  success: true,
331054
- message: `✓ Installed ${entry.name}${result.depNote}. Run /reload-plugins to activate.`
331164
+ message: `✓ Installed ${entry.name}${result.depNote}.`
331055
331165
  };
331056
331166
  } catch (err) {
331057
331167
  const errorMessage = err instanceof Error ? err.message : String(err);
@@ -399204,6 +399314,139 @@ var init_agents3 = __esm(() => {
399204
399314
  agents_default = agents;
399205
399315
  });
399206
399316
 
399317
+ // src/tui/utils/plugins/refresh.ts
399318
+ async function refreshActivePlugins(setAppState) {
399319
+ logForDebugging3("refreshActivePlugins: clearing all plugin caches");
399320
+ clearAllCaches();
399321
+ clearPluginCacheExclusions();
399322
+ const pluginResult = await loadAllPlugins();
399323
+ const [pluginCommands, agentDefinitions] = await Promise.all([
399324
+ getPluginCommands(),
399325
+ getAgentDefinitionsWithOverrides(getOriginalCwd())
399326
+ ]);
399327
+ const { enabled, disabled, errors } = pluginResult;
399328
+ const [mcpCounts, lspCounts] = await Promise.all([
399329
+ Promise.all(enabled.map(async (p) => {
399330
+ if (p.mcpServers)
399331
+ return Object.keys(p.mcpServers).length;
399332
+ const servers = await loadPluginMcpServers(p, errors);
399333
+ if (servers)
399334
+ p.mcpServers = servers;
399335
+ return servers ? Object.keys(servers).length : 0;
399336
+ })),
399337
+ Promise.all(enabled.map(async (p) => {
399338
+ if (p.lspServers)
399339
+ return Object.keys(p.lspServers).length;
399340
+ const servers = await loadPluginLspServers(p, errors);
399341
+ if (servers)
399342
+ p.lspServers = servers;
399343
+ return servers ? Object.keys(servers).length : 0;
399344
+ }))
399345
+ ]);
399346
+ const mcp_count = mcpCounts.reduce((sum, n) => sum + n, 0);
399347
+ const lsp_count = lspCounts.reduce((sum, n) => sum + n, 0);
399348
+ setAppState((prev) => ({
399349
+ ...prev,
399350
+ plugins: {
399351
+ ...prev.plugins,
399352
+ enabled,
399353
+ disabled,
399354
+ commands: pluginCommands,
399355
+ errors: mergePluginErrors(prev.plugins.errors, errors),
399356
+ needsRefresh: false
399357
+ },
399358
+ agentDefinitions,
399359
+ mcp: {
399360
+ ...prev.mcp,
399361
+ pluginReconnectKey: prev.mcp.pluginReconnectKey + 1
399362
+ }
399363
+ }));
399364
+ reinitializeLspServerManager2();
399365
+ let hook_load_failed = false;
399366
+ try {
399367
+ await loadPluginHooks();
399368
+ } catch (e) {
399369
+ hook_load_failed = true;
399370
+ logError3(e);
399371
+ logForDebugging3(`refreshActivePlugins: loadPluginHooks failed: ${errorMessage2(e)}`);
399372
+ }
399373
+ const hook_count = enabled.reduce((sum, p) => {
399374
+ if (!p.hooksConfig)
399375
+ return sum;
399376
+ return sum + Object.values(p.hooksConfig).reduce((s, matchers) => s + (matchers?.reduce((h, m) => h + m.hooks.length, 0) ?? 0), 0);
399377
+ }, 0);
399378
+ logForDebugging3(`refreshActivePlugins: ${enabled.length} enabled, ${pluginCommands.length} commands, ${agentDefinitions.allAgents.length} agents, ${hook_count} hooks, ${mcp_count} MCP, ${lsp_count} LSP`);
399379
+ return {
399380
+ enabled_count: enabled.length,
399381
+ disabled_count: disabled.length,
399382
+ command_count: pluginCommands.length,
399383
+ agent_count: agentDefinitions.allAgents.length,
399384
+ hook_count,
399385
+ mcp_count,
399386
+ lsp_count,
399387
+ error_count: errors.length + (hook_load_failed ? 1 : 0),
399388
+ agentDefinitions,
399389
+ pluginCommands
399390
+ };
399391
+ }
399392
+ async function refreshActivePluginsLightweight(setAppState) {
399393
+ logForDebugging3("refreshActivePluginsLightweight: clearing all plugin caches");
399394
+ clearAllCaches();
399395
+ clearPluginCacheExclusions();
399396
+ const pluginResult = await loadAllPlugins();
399397
+ const [pluginCommands, agentDefinitions] = await Promise.all([
399398
+ getPluginCommands(),
399399
+ getAgentDefinitionsWithOverrides(getOriginalCwd())
399400
+ ]);
399401
+ const { enabled, disabled, errors } = pluginResult;
399402
+ setAppState((prev) => ({
399403
+ ...prev,
399404
+ plugins: {
399405
+ ...prev.plugins,
399406
+ enabled,
399407
+ disabled,
399408
+ commands: pluginCommands,
399409
+ errors: mergePluginErrors(prev.plugins.errors, errors),
399410
+ needsRefresh: false
399411
+ },
399412
+ agentDefinitions
399413
+ }));
399414
+ logForDebugging3(`refreshActivePluginsLightweight: ${enabled.length} enabled, ${pluginCommands.length} commands, ${agentDefinitions.allAgents.length} agents`);
399415
+ return {
399416
+ enabled_count: enabled.length,
399417
+ disabled_count: disabled.length,
399418
+ command_count: pluginCommands.length,
399419
+ agent_count: agentDefinitions.allAgents.length,
399420
+ error_count: errors.length,
399421
+ agentDefinitions,
399422
+ pluginCommands
399423
+ };
399424
+ }
399425
+ function mergePluginErrors(existing, fresh) {
399426
+ const preserved = existing.filter((e) => e.source === "lsp-manager" || e.source.startsWith("plugin:"));
399427
+ const freshKeys = new Set(fresh.map(errorKey));
399428
+ const deduped = preserved.filter((e) => !freshKeys.has(errorKey(e)));
399429
+ return [...deduped, ...fresh];
399430
+ }
399431
+ function errorKey(e) {
399432
+ return e.type === "generic-error" ? `generic-error:${e.source}:${e.error}` : `${e.type}:${e.source}`;
399433
+ }
399434
+ var init_refresh = __esm(() => {
399435
+ init_bootstrap();
399436
+ init_manager();
399437
+ init_loadAgentsDir2();
399438
+ init_debug();
399439
+ init_errors4();
399440
+ init_log5();
399441
+ init_cacheUtils();
399442
+ init_loadPluginCommands();
399443
+ init_loadPluginHooks();
399444
+ init_lspPluginIntegration();
399445
+ init_mcpPluginIntegration();
399446
+ init_orphanedPluginFilter();
399447
+ init_pluginLoader();
399448
+ });
399449
+
399207
399450
  // src/tui/utils/plugins/parseMarketplaceInput.ts
399208
399451
  import { homedir as homedir37 } from "os";
399209
399452
  import { resolve as resolve48 } from "path";
@@ -400722,12 +400965,12 @@ function BrowseMarketplace({
400722
400965
  setSelectedForInstall(new Set);
400723
400966
  clearAllCaches();
400724
400967
  if (failureCount === 0) {
400725
- const message = `✓ Installed ${successCount_0} ${plural2(successCount_0, "plugin")}. ` + `Run /reload-plugins to activate.`;
400968
+ const message = `✓ Installed ${successCount_0} ${plural2(successCount_0, "plugin")}.`;
400726
400969
  setResult(message);
400727
400970
  } else if (successCount_0 === 0) {
400728
400971
  setError(`Failed to install: ${formatFailureDetails(newFailedPlugins, true)}`);
400729
400972
  } else {
400730
- const message_0 = `✓ Installed ${successCount_0} of ${successCount_0 + failureCount} plugins. ` + `Failed: ${formatFailureDetails(newFailedPlugins, false)}. ` + `Run /reload-plugins to activate successfully installed plugins.`;
400973
+ const message_0 = `✓ Installed ${successCount_0} of ${successCount_0 + failureCount} plugins. ` + `Failed: ${formatFailureDetails(newFailedPlugins, false)}.`;
400731
400974
  setResult(message_0);
400732
400975
  }
400733
400976
  if (successCount_0 > 0) {
@@ -400921,10 +401164,10 @@ function BrowseMarketplace({
400921
401164
  onDone: (outcome, detail) => {
400922
401165
  switch (outcome) {
400923
401166
  case "configured":
400924
- finish(`✓ Installed and configured ${plugin_5.name}. Run /reload-plugins to apply.`);
401167
+ finish(`✓ Installed and configured ${plugin_5.name}.`);
400925
401168
  break;
400926
401169
  case "skipped":
400927
- finish(`✓ Installed ${plugin_5.name}. Run /reload-plugins to apply.`);
401170
+ finish(`✓ Installed ${plugin_5.name}.`);
400928
401171
  break;
400929
401172
  case "error":
400930
401173
  finish(`Installed but failed to save config: ${detail}`);
@@ -401594,12 +401837,12 @@ function DiscoverPlugins({
401594
401837
  setSelectedForInstall(new Set);
401595
401838
  clearAllCaches();
401596
401839
  if (failureCount === 0) {
401597
- const message = `✓ Installed ${successCount_0} ${plural2(successCount_0, "plugin")}. ` + `Run /reload-plugins to activate.`;
401840
+ const message = `✓ Installed ${successCount_0} ${plural2(successCount_0, "plugin")}.`;
401598
401841
  setResult(message);
401599
401842
  } else if (successCount_0 === 0) {
401600
401843
  setError(`Failed to install: ${formatFailureDetails(newFailedPlugins, true)}`);
401601
401844
  } else {
401602
- const message_0 = `✓ Installed ${successCount_0} of ${successCount_0 + failureCount} plugins. ` + `Failed: ${formatFailureDetails(newFailedPlugins, false)}. ` + `Run /reload-plugins to activate successfully installed plugins.`;
401845
+ const message_0 = `✓ Installed ${successCount_0} of ${successCount_0 + failureCount} plugins. ` + `Failed: ${formatFailureDetails(newFailedPlugins, false)}.`;
401603
401846
  setResult(message_0);
401604
401847
  }
401605
401848
  if (successCount_0 > 0) {
@@ -401806,10 +402049,10 @@ function DiscoverPlugins({
401806
402049
  onDone: (outcome, detail) => {
401807
402050
  switch (outcome) {
401808
402051
  case "configured":
401809
- finish(`✓ Installed and configured ${plugin_4.name}. Run /reload-plugins to apply.`);
402052
+ finish(`✓ Installed and configured ${plugin_4.name}.`);
401810
402053
  break;
401811
402054
  case "skipped":
401812
- finish(`✓ Installed ${plugin_4.name}. Run /reload-plugins to apply.`);
402055
+ finish(`✓ Installed ${plugin_4.name}.`);
401813
402056
  break;
401814
402057
  case "error":
401815
402058
  finish(`Installed but failed to save config: ${detail}`);
@@ -405211,7 +405454,7 @@ function ManagePlugins({
405211
405454
  } else if (typeof viewState === "object" && (viewState.type === "plugin-options" || viewState.type === "configuring-options")) {
405212
405455
  setViewState("plugin-list");
405213
405456
  setSelectedPlugin(null);
405214
- setResult("Plugin enabled. Configuration skipped — run /reload-plugins to apply.");
405457
+ setResult("Plugin enabled. Configuration skipped.");
405215
405458
  if (onManageComplete) {
405216
405459
  onManageComplete();
405217
405460
  }
@@ -405721,7 +405964,7 @@ function ManagePlugins({
405721
405964
  }
405722
405965
  const operationName = operation === "enable" ? "Enabled" : operation === "disable" ? "Disabled" : operation === "update" ? "Updated" : "Uninstalled";
405723
405966
  const depWarn = reverseDependents && reverseDependents.length > 0 ? ` · required by ${reverseDependents.join(", ")}` : "";
405724
- const message = `✓ ${operationName} ${selectedPlugin.plugin.name}${depWarn}. Run /reload-plugins to apply.`;
405967
+ const message = `✓ ${operationName} ${selectedPlugin.plugin.name}${depWarn}.`;
405725
405968
  setResult(message);
405726
405969
  if (onManageComplete) {
405727
405970
  await onManageComplete();
@@ -406080,7 +406323,7 @@ function ManagePlugins({
406080
406323
  return;
406081
406324
  }
406082
406325
  clearAllCaches();
406083
- setResult(`✓ Disabled ${selectedPlugin.plugin.name} in .atlas/settings.local.json. Run /reload-plugins to apply.`);
406326
+ setResult(`✓ Disabled ${selectedPlugin.plugin.name} in .atlas/settings.local.json.`);
406084
406327
  if (onManageComplete)
406085
406328
  onManageComplete();
406086
406329
  setParentViewState({
@@ -406199,10 +406442,10 @@ function ManagePlugins({
406199
406442
  onDone: (outcome, detail) => {
406200
406443
  switch (outcome) {
406201
406444
  case "configured":
406202
- finish(`✓ Enabled and configured ${selectedPlugin.plugin.name}. Run /reload-plugins to apply.`);
406445
+ finish(`✓ Enabled and configured ${selectedPlugin.plugin.name}.`);
406203
406446
  break;
406204
406447
  case "skipped":
406205
- finish(`✓ Enabled ${selectedPlugin.plugin.name}. Run /reload-plugins to apply.`);
406448
+ finish(`✓ Enabled ${selectedPlugin.plugin.name}.`);
406206
406449
  break;
406207
406450
  case "error":
406208
406451
  finish(`Failed to save configuration: ${detail}`);
@@ -408775,7 +409018,7 @@ function PluginSettings(t0) {
408775
409018
  let t3;
408776
409019
  if ($[5] !== setAppState) {
408777
409020
  t3 = () => {
408778
- setAppState(_temp134);
409021
+ refreshActivePluginsLightweight(setAppState);
408779
409022
  };
408780
409023
  $[5] = setAppState;
408781
409024
  $[6] = t3;
@@ -409287,15 +409530,6 @@ function PluginSettings(t0) {
409287
409530
  }
409288
409531
  return t27;
409289
409532
  }
409290
- function _temp134(prev) {
409291
- return prev.plugins.needsRefresh ? prev : {
409292
- ...prev,
409293
- plugins: {
409294
- ...prev.plugins,
409295
- needsRefresh: true
409296
- }
409297
- };
409298
- }
409299
409533
  function _temp05(s) {
409300
409534
  let count = s.plugins.errors.length;
409301
409535
  for (const m of s.plugins.installationStatus.marketplaces) {
@@ -409320,6 +409554,7 @@ var init_PluginSettings = __esm(() => {
409320
409554
  init_marketplaceHelpers();
409321
409555
  init_marketplaceManager();
409322
409556
  init_pluginStartupCheck();
409557
+ init_refresh();
409323
409558
  init_settings3();
409324
409559
  init_AddMarketplace();
409325
409560
  init_MarketplaceAdopt();
@@ -409368,106 +409603,6 @@ var init_plugin3 = __esm(() => {
409368
409603
  plugin_default = plugin;
409369
409604
  });
409370
409605
 
409371
- // src/tui/utils/plugins/refresh.ts
409372
- async function refreshActivePlugins(setAppState) {
409373
- logForDebugging3("refreshActivePlugins: clearing all plugin caches");
409374
- clearAllCaches();
409375
- clearPluginCacheExclusions();
409376
- const pluginResult = await loadAllPlugins();
409377
- const [pluginCommands, agentDefinitions] = await Promise.all([
409378
- getPluginCommands(),
409379
- getAgentDefinitionsWithOverrides(getOriginalCwd())
409380
- ]);
409381
- const { enabled, disabled, errors } = pluginResult;
409382
- const [mcpCounts, lspCounts] = await Promise.all([
409383
- Promise.all(enabled.map(async (p) => {
409384
- if (p.mcpServers)
409385
- return Object.keys(p.mcpServers).length;
409386
- const servers = await loadPluginMcpServers(p, errors);
409387
- if (servers)
409388
- p.mcpServers = servers;
409389
- return servers ? Object.keys(servers).length : 0;
409390
- })),
409391
- Promise.all(enabled.map(async (p) => {
409392
- if (p.lspServers)
409393
- return Object.keys(p.lspServers).length;
409394
- const servers = await loadPluginLspServers(p, errors);
409395
- if (servers)
409396
- p.lspServers = servers;
409397
- return servers ? Object.keys(servers).length : 0;
409398
- }))
409399
- ]);
409400
- const mcp_count = mcpCounts.reduce((sum, n) => sum + n, 0);
409401
- const lsp_count = lspCounts.reduce((sum, n) => sum + n, 0);
409402
- setAppState((prev) => ({
409403
- ...prev,
409404
- plugins: {
409405
- ...prev.plugins,
409406
- enabled,
409407
- disabled,
409408
- commands: pluginCommands,
409409
- errors: mergePluginErrors(prev.plugins.errors, errors),
409410
- needsRefresh: false
409411
- },
409412
- agentDefinitions,
409413
- mcp: {
409414
- ...prev.mcp,
409415
- pluginReconnectKey: prev.mcp.pluginReconnectKey + 1
409416
- }
409417
- }));
409418
- reinitializeLspServerManager2();
409419
- let hook_load_failed = false;
409420
- try {
409421
- await loadPluginHooks();
409422
- } catch (e) {
409423
- hook_load_failed = true;
409424
- logError3(e);
409425
- logForDebugging3(`refreshActivePlugins: loadPluginHooks failed: ${errorMessage2(e)}`);
409426
- }
409427
- const hook_count = enabled.reduce((sum, p) => {
409428
- if (!p.hooksConfig)
409429
- return sum;
409430
- return sum + Object.values(p.hooksConfig).reduce((s, matchers) => s + (matchers?.reduce((h, m) => h + m.hooks.length, 0) ?? 0), 0);
409431
- }, 0);
409432
- logForDebugging3(`refreshActivePlugins: ${enabled.length} enabled, ${pluginCommands.length} commands, ${agentDefinitions.allAgents.length} agents, ${hook_count} hooks, ${mcp_count} MCP, ${lsp_count} LSP`);
409433
- return {
409434
- enabled_count: enabled.length,
409435
- disabled_count: disabled.length,
409436
- command_count: pluginCommands.length,
409437
- agent_count: agentDefinitions.allAgents.length,
409438
- hook_count,
409439
- mcp_count,
409440
- lsp_count,
409441
- error_count: errors.length + (hook_load_failed ? 1 : 0),
409442
- agentDefinitions,
409443
- pluginCommands
409444
- };
409445
- }
409446
- function mergePluginErrors(existing, fresh) {
409447
- const preserved = existing.filter((e) => e.source === "lsp-manager" || e.source.startsWith("plugin:"));
409448
- const freshKeys = new Set(fresh.map(errorKey));
409449
- const deduped = preserved.filter((e) => !freshKeys.has(errorKey(e)));
409450
- return [...deduped, ...fresh];
409451
- }
409452
- function errorKey(e) {
409453
- return e.type === "generic-error" ? `generic-error:${e.source}:${e.error}` : `${e.type}:${e.source}`;
409454
- }
409455
- var init_refresh = __esm(() => {
409456
- init_bootstrap();
409457
- init_manager();
409458
- init_loadAgentsDir2();
409459
- init_debug();
409460
- init_errors4();
409461
- init_log5();
409462
- init_cacheUtils();
409463
- init_loadPluginCommands();
409464
- init_loadPluginHooks();
409465
- init_lspPluginIntegration();
409466
- init_mcpPluginIntegration();
409467
- init_orphanedPluginFilter();
409468
- init_pluginLoader();
409469
- });
409470
-
409471
409606
  // src/tui/commands/reload-plugins/reload-plugins.ts
409472
409607
  var exports_reload_plugins = {};
409473
409608
  __export(exports_reload_plugins, {
@@ -409764,7 +409899,7 @@ function SandboxConfigTab() {
409764
409899
  t0 = depCheck.warnings.length > 0 ? /* @__PURE__ */ jsx_dev_runtime296.jsxDEV(ThemedBox_default, {
409765
409900
  marginTop: 1,
409766
409901
  flexDirection: "column",
409767
- children: depCheck.warnings.map(_temp135)
409902
+ children: depCheck.warnings.map(_temp134)
409768
409903
  }, undefined, false, undefined, this) : null;
409769
409904
  $[0] = t0;
409770
409905
  } else {
@@ -409940,7 +410075,7 @@ function SandboxConfigTab() {
409940
410075
  }
409941
410076
  return t1;
409942
410077
  }
409943
- function _temp135(w, i) {
410078
+ function _temp134(w, i) {
409944
410079
  return /* @__PURE__ */ jsx_dev_runtime296.jsxDEV(ThemedText, {
409945
410080
  dimColor: true,
409946
410081
  children: w
@@ -409971,7 +410106,7 @@ function SandboxDependenciesTab(t0) {
409971
410106
  const isMac = platform === "macos";
409972
410107
  let t2;
409973
410108
  if ($[1] !== depCheck.errors) {
409974
- t2 = depCheck.errors.some(_temp136);
410109
+ t2 = depCheck.errors.some(_temp135);
409975
410110
  $[1] = depCheck.errors;
409976
410111
  $[2] = t2;
409977
410112
  } else {
@@ -410185,7 +410320,7 @@ function _temp341(e_1) {
410185
410320
  function _temp262(e_0) {
410186
410321
  return e_0.includes("bwrap");
410187
410322
  }
410188
- function _temp136(e) {
410323
+ function _temp135(e) {
410189
410324
  return e.includes("ripgrep");
410190
410325
  }
410191
410326
  var import_compiler_runtime236, jsx_dev_runtime297;
@@ -411914,11 +412049,8 @@ var init_export2 = __esm(() => {
411914
412049
 
411915
412050
  // src/tui/utils/immediateCommand.ts
411916
412051
  function shouldInferenceConfigCommandBeImmediate() {
411917
- return getFeatureValue_CACHED_MAY_BE_STALE("atlas_immediate_model_command", false);
412052
+ return true;
411918
412053
  }
411919
- var init_immediateCommand = __esm(() => {
411920
- init_growthbook();
411921
- });
411922
412054
 
411923
412055
  // src/tui/commands/model/model.tsx
411924
412056
  var exports_model = {};
@@ -411930,7 +412062,7 @@ function ModelPickerWrapper(t0) {
411930
412062
  const {
411931
412063
  onDone
411932
412064
  } = t0;
411933
- const mainLoopModel = useAppState(_temp137);
412065
+ const mainLoopModel = useAppState(_temp136);
411934
412066
  const mainLoopModelForSession = useAppState(_temp263);
411935
412067
  const setAppState = useSetAppState();
411936
412068
  let t1;
@@ -412006,7 +412138,7 @@ function ModelPickerWrapper(t0) {
412006
412138
  function _temp263(s_0) {
412007
412139
  return s_0.mainLoopModelForSession;
412008
412140
  }
412009
- function _temp137(s) {
412141
+ function _temp136(s) {
412010
412142
  return s.mainLoopModel;
412011
412143
  }
412012
412144
  function SetModelAndClose({
@@ -412140,7 +412272,6 @@ var init_model2 = __esm(() => {
412140
412272
  // src/tui/commands/model/index.ts
412141
412273
  var model_default;
412142
412274
  var init_model3 = __esm(() => {
412143
- init_immediateCommand();
412144
412275
  init_model();
412145
412276
  model_default = {
412146
412277
  type: "local-jsx",
@@ -412598,7 +412729,7 @@ function ShowCurrentEffort(t0) {
412598
412729
  const {
412599
412730
  onDone
412600
412731
  } = t0;
412601
- const effortValue = useAppState(_temp138);
412732
+ const effortValue = useAppState(_temp137);
412602
412733
  const model = useMainLoopModel();
412603
412734
  const {
412604
412735
  message
@@ -412606,7 +412737,7 @@ function ShowCurrentEffort(t0) {
412606
412737
  onDone(message);
412607
412738
  return null;
412608
412739
  }
412609
- function _temp138(s) {
412740
+ function _temp137(s) {
412610
412741
  return s.effortValue;
412611
412742
  }
412612
412743
  function ApplyEffortAndClose(t0) {
@@ -412687,7 +412818,6 @@ var init_effort3 = __esm(() => {
412687
412818
  // src/tui/commands/effort/index.ts
412688
412819
  var effort_default;
412689
412820
  var init_effort4 = __esm(() => {
412690
- init_immediateCommand();
412691
412821
  effort_default = {
412692
412822
  type: "local-jsx",
412693
412823
  name: "effort",
@@ -414360,7 +414490,7 @@ function StatsContent(t0) {
414360
414490
  });
414361
414491
  }
414362
414492
  if (key.tab) {
414363
- setActiveTab(_temp139);
414493
+ setActiveTab(_temp138);
414364
414494
  }
414365
414495
  if (input === "r" && !key.ctrl && !key.meta) {
414366
414496
  setDateRange(getNextDateRange(dateRange));
@@ -414525,7 +414655,7 @@ function StatsContent(t0) {
414525
414655
  }
414526
414656
  return t12;
414527
414657
  }
414528
- function _temp139(prev_0) {
414658
+ function _temp138(prev_0) {
414529
414659
  return prev_0 === "Overview" ? "Models" : "Overview";
414530
414660
  }
414531
414661
  function DateRangeSelector(t0) {
@@ -415143,7 +415273,7 @@ function ModelsTab(t0) {
415143
415273
  children: chartOutput.xAxisLabels
415144
415274
  }, undefined, false, undefined, this),
415145
415275
  /* @__PURE__ */ jsx_dev_runtime310.jsxDEV(ThemedBox_default, {
415146
- children: chartOutput.legend.map(_temp140)
415276
+ children: chartOutput.legend.map(_temp139)
415147
415277
  }, undefined, false, undefined, this)
415148
415278
  ]
415149
415279
  }, undefined, true, undefined, this),
@@ -415171,7 +415301,7 @@ function ModelsTab(t0) {
415171
415301
  ]
415172
415302
  }, undefined, true, undefined, this);
415173
415303
  }
415174
- function _temp140(item, i) {
415304
+ function _temp139(item, i) {
415175
415305
  return /* @__PURE__ */ jsx_dev_runtime310.jsxDEV(ThemedText, {
415176
415306
  children: [
415177
415307
  i > 0 ? " · " : "",
@@ -431949,7 +432079,7 @@ function useKeybindingWarnings(warnings, isReload) {
431949
432079
  removeNotification("keybinding-config-warning");
431950
432080
  return;
431951
432081
  }
431952
- const errorCount = count7(warnings, _temp141);
432082
+ const errorCount = count7(warnings, _temp140);
431953
432083
  const warnCount = count7(warnings, _temp264);
431954
432084
  let message;
431955
432085
  if (errorCount > 0 && warnCount > 0) {
@@ -431993,7 +432123,7 @@ function useKeybindingWarnings(warnings, isReload) {
431993
432123
  function _temp264(w_0) {
431994
432124
  return w_0.severity === "warning";
431995
432125
  }
431996
- function _temp141(w) {
432126
+ function _temp140(w) {
431997
432127
  return w.severity === "error";
431998
432128
  }
431999
432129
  function KeybindingSetup({
@@ -434841,7 +434971,7 @@ function PreviewBoxBody(t0) {
434841
434971
  const effectiveMinHeight = Math.min(minHeight ?? 0, effectiveMaxLines);
434842
434972
  const paddingNeeded = Math.max(0, effectiveMinHeight - truncatedLines.length - (isTruncated ? 1 : 0));
434843
434973
  const lines = paddingNeeded > 0 ? [...truncatedLines, ...Array(paddingNeeded).fill("")] : truncatedLines;
434844
- const contentWidth = Math.max(minWidth, ...lines.map(_temp143));
434974
+ const contentWidth = Math.max(minWidth, ...lines.map(_temp141));
434845
434975
  const boxWidth = Math.min(contentWidth + 4, effectiveMaxWidth);
434846
434976
  const innerWidth = boxWidth - 4;
434847
434977
  let t6;
@@ -434981,7 +435111,7 @@ function PreviewBoxBody(t0) {
434981
435111
  }
434982
435112
  return t8;
434983
435113
  }
434984
- function _temp143(line) {
435114
+ function _temp141(line) {
434985
435115
  return stringWidth2(line);
434986
435116
  }
434987
435117
  var import_compiler_runtime254, import_react179, jsx_dev_runtime322, BOX_CHARS;
@@ -435051,7 +435181,7 @@ function QuestionNavigationBar(t0) {
435051
435181
  t2 = t3;
435052
435182
  break bb0;
435053
435183
  }
435054
- const tabHeaders = questions.map(_temp144);
435184
+ const tabHeaders = questions.map(_temp143);
435055
435185
  const idealWidths = tabHeaders.map(_temp265);
435056
435186
  const totalIdealWidth = idealWidths.reduce(_temp342, 0);
435057
435187
  if (totalIdealWidth <= availableForTabs) {
@@ -435227,7 +435357,7 @@ function _temp342(sum, w) {
435227
435357
  function _temp265(header_0) {
435228
435358
  return 4 + stringWidth2(header_0);
435229
435359
  }
435230
- function _temp144(q_0, index_0) {
435360
+ function _temp143(q_0, index_0) {
435231
435361
  return q_0?.header || `Q${index_0 + 1}`;
435232
435362
  }
435233
435363
  var import_compiler_runtime255, jsx_dev_runtime323;
@@ -435658,7 +435788,7 @@ function QuestionView(t0) {
435658
435788
  onRemoveImage
435659
435789
  } = t0;
435660
435790
  const hideSubmitTab = t1 === undefined ? false : t1;
435661
- const isInPlanMode = useAppState(_temp145) === "plan";
435791
+ const isInPlanMode = useAppState(_temp144) === "plan";
435662
435792
  const [isFooterFocused, setIsFooterFocused] = import_react181.useState(false);
435663
435793
  const [footerIndex, setFooterIndex] = import_react181.useState(0);
435664
435794
  const [isOtherFocused, setIsOtherFocused] = import_react181.useState(false);
@@ -436226,7 +436356,7 @@ function _temp266(opt) {
436226
436356
  description: opt.description
436227
436357
  };
436228
436358
  }
436229
- function _temp145(s) {
436359
+ function _temp144(s) {
436230
436360
  return s.toolPermissionContext.mode;
436231
436361
  }
436232
436362
  var import_compiler_runtime256, import_react181, jsx_dev_runtime325;
@@ -436304,7 +436434,7 @@ function PermissionRuleExplanation(t0) {
436304
436434
  permissionResult,
436305
436435
  toolType
436306
436436
  } = t0;
436307
- const permissionMode = useAppState(_temp146);
436437
+ const permissionMode = useAppState(_temp145);
436308
436438
  const t1 = permissionResult?.decisionReason;
436309
436439
  let t2;
436310
436440
  if ($[0] !== t1 || $[1] !== toolType) {
@@ -436365,7 +436495,7 @@ function PermissionRuleExplanation(t0) {
436365
436495
  }
436366
436496
  return t5;
436367
436497
  }
436368
- function _temp146(s) {
436498
+ function _temp145(s) {
436369
436499
  return s.toolPermissionContext.mode;
436370
436500
  }
436371
436501
  var import_compiler_runtime257, jsx_dev_runtime326;
@@ -436802,7 +436932,7 @@ function AskUserQuestionPermissionRequestBody(t0) {
436802
436932
  const maxAllowedHeight = Math.max(MIN_CONTENT_HEIGHT, terminalRows - CONTENT_CHROME_OVERHEAD);
436803
436933
  if ($[5] !== highlight || $[6] !== maxAllowedHeight || $[7] !== maxHeight || $[8] !== maxWidth || $[9] !== questions || $[10] !== theme) {
436804
436934
  for (const q of questions) {
436805
- const hasPreview = q.options.some(_temp147);
436935
+ const hasPreview = q.options.some(_temp146);
436806
436936
  if (hasPreview) {
436807
436937
  const maxPreviewContentLines = Math.max(1, maxAllowedHeight - 11);
436808
436938
  let maxPreviewBoxHeight = 0;
@@ -437332,7 +437462,7 @@ function _temp344(c) {
437332
437462
  function _temp267(contents) {
437333
437463
  return Object.values(contents);
437334
437464
  }
437335
- function _temp147(opt) {
437465
+ function _temp146(opt) {
437336
437466
  return opt.preview;
437337
437467
  }
437338
437468
  async function convertImagesToBlocks(images) {
@@ -437374,6 +437504,28 @@ var init_AskUserQuestionPermissionRequest = __esm(() => {
437374
437504
  jsx_dev_runtime328 = __toESM(require_jsx_dev_runtime(), 1);
437375
437505
  });
437376
437506
 
437507
+ // src/tui/utils/permissions/autoModePermissionOption.ts
437508
+ function isAutoModeOptionVisible(context) {
437509
+ return isAutoModeGateEnabled() && context.mode !== "auto";
437510
+ }
437511
+ function applyAutoModePermissionOption(context, setAppState, recheckPermission) {
437512
+ let next;
437513
+ try {
437514
+ next = {
437515
+ ...transitionPermissionMode(context.mode, "auto", context),
437516
+ mode: "auto"
437517
+ };
437518
+ } catch {
437519
+ recheckPermission();
437520
+ return;
437521
+ }
437522
+ setAppState((prev) => ({ ...prev, toolPermissionContext: next }));
437523
+ recheckPermission();
437524
+ }
437525
+ var init_autoModePermissionOption = __esm(() => {
437526
+ init_permissionSetup2();
437527
+ });
437528
+
437377
437529
  // src/tui/tools/BashTool/destructiveCommandWarning.ts
437378
437530
  function getDestructiveCommandWarning2(command) {
437379
437531
  for (const { pattern, warning } of DESTRUCTIVE_PATTERNS) {
@@ -438193,7 +438345,7 @@ function SuggestedRules(t0) {
438193
438345
  t3 = "Suggested rules:";
438194
438346
  t4 = " ";
438195
438347
  T0 = Ansi;
438196
- t1 = rules.map(_temp148).join(", ");
438348
+ t1 = rules.map(_temp147).join(", ");
438197
438349
  }
438198
438350
  $[0] = suggestions;
438199
438351
  $[1] = T0;
@@ -438247,7 +438399,7 @@ function SuggestedRules(t0) {
438247
438399
  }
438248
438400
  return t7;
438249
438401
  }
438250
- function _temp148(rule) {
438402
+ function _temp147(rule) {
438251
438403
  return source_default.bold(permissionRuleValueToString2(rule));
438252
438404
  }
438253
438405
  function extractDirectories(updates) {
@@ -439071,7 +439223,7 @@ function usePermissionExplainerUI(props) {
439071
439223
  setPromise(createExplanationPromise(props));
439072
439224
  }
439073
439225
  }
439074
- setVisible(_temp149);
439226
+ setVisible(_temp148);
439075
439227
  };
439076
439228
  $[1] = promise;
439077
439229
  $[2] = props;
@@ -439106,7 +439258,7 @@ function usePermissionExplainerUI(props) {
439106
439258
  }
439107
439259
  return t3;
439108
439260
  }
439109
- function _temp149(v) {
439261
+ function _temp148(v) {
439110
439262
  return !v;
439111
439263
  }
439112
439264
  function ExplanationResult(t0) {
@@ -440038,6 +440190,16 @@ function getFilePermissionOptions({
440038
440190
  }
440039
440191
  });
440040
440192
  }
440193
+ if (isAutoModeOptionVisible(toolPermissionContext)) {
440194
+ options.push({
440195
+ label: "Auto mode",
440196
+ description: "Switch this session to auto mode; this request is re-checked by the auto gate",
440197
+ value: "auto-mode",
440198
+ option: {
440199
+ type: "accept-auto-mode"
440200
+ }
440201
+ });
440202
+ }
440041
440203
  return options;
440042
440204
  }
440043
440205
  var jsx_dev_runtime334;
@@ -440048,6 +440210,7 @@ var init_permissionOptions = __esm(() => {
440048
440210
  init_shortcutFormat();
440049
440211
  init_path3();
440050
440212
  init_filesystem2();
440213
+ init_autoModePermissionOption();
440051
440214
  jsx_dev_runtime334 = __toESM(require_jsx_dev_runtime(), 1);
440052
440215
  });
440053
440216
 
@@ -440119,15 +440282,20 @@ function handleReject(params, options) {
440119
440282
  onReject();
440120
440283
  toolUseConfirm.onReject(options?.feedback);
440121
440284
  }
440285
+ function handleAcceptAutoMode(params, _options) {
440286
+ applyAutoModePermissionOption(params.toolPermissionContext, params.setAppState, () => params.toolUseConfirm.recheckPermission());
440287
+ }
440122
440288
  var PERMISSION_HANDLERS;
440123
440289
  var init_usePermissionHandler = __esm(() => {
440290
+ init_autoModePermissionOption();
440124
440291
  init_constants8();
440125
440292
  init_env2();
440126
440293
  init_filesystem2();
440127
440294
  PERMISSION_HANDLERS = {
440128
440295
  "accept-once": handleAcceptOnce,
440129
440296
  "accept-session": handleAcceptSession,
440130
- reject: handleReject
440297
+ reject: handleReject,
440298
+ "accept-auto-mode": handleAcceptAutoMode
440131
440299
  };
440132
440300
  });
440133
440301
 
@@ -440143,6 +440311,7 @@ function useFilePermissionDialog({
440143
440311
  operationType = "write"
440144
440312
  }) {
440145
440313
  const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
440314
+ const setAppState = useSetAppState();
440146
440315
  const [acceptFeedback, setAcceptFeedback] = import_react188.useState("");
440147
440316
  const [rejectFeedback, setRejectFeedback] = import_react188.useState("");
440148
440317
  const [focusedOption, setFocusedOption] = import_react188.useState("yes");
@@ -440169,7 +440338,8 @@ function useFilePermissionDialog({
440169
440338
  onReject,
440170
440339
  completionType,
440171
440340
  languageName,
440172
- operationType
440341
+ operationType,
440342
+ setAppState
440173
440343
  };
440174
440344
  const originalOnAllow = toolUseConfirm.onAllow;
440175
440345
  toolUseConfirm.onAllow = (_input, permissionUpdates, feedback) => {
@@ -440192,7 +440362,8 @@ function useFilePermissionDialog({
440192
440362
  onReject,
440193
440363
  operationType,
440194
440364
  yesFeedbackModeEntered,
440195
- noFeedbackModeEntered
440365
+ noFeedbackModeEntered,
440366
+ setAppState
440196
440367
  ]);
440197
440368
  const handleCycleMode = import_react188.useCallback(() => {
440198
440369
  const sessionOption = options.find((o) => o.option.type === "accept-session");
@@ -440477,7 +440648,7 @@ function SedEditPermissionRequest(t0) {
440477
440648
  `),
440478
440649
  fileExists: true
440479
440650
  };
440480
- })().catch(_temp150);
440651
+ })().catch(_temp149);
440481
440652
  $[3] = filePath;
440482
440653
  $[4] = t1;
440483
440654
  } else {
@@ -440503,7 +440674,7 @@ function SedEditPermissionRequest(t0) {
440503
440674
  }
440504
440675
  return t2;
440505
440676
  }
440506
- function _temp150(e) {
440677
+ function _temp149(e) {
440507
440678
  if (!isENOENT2(e)) {
440508
440679
  throw e;
440509
440680
  }
@@ -441061,7 +441232,8 @@ function bashToolUseOptions({
441061
441232
  yesInputMode = false,
441062
441233
  noInputMode = false,
441063
441234
  editablePrefix,
441064
- onEditablePrefixChange
441235
+ onEditablePrefixChange,
441236
+ showAutoModeOption = false
441065
441237
  }) {
441066
441238
  const options = [];
441067
441239
  if (yesInputMode) {
@@ -441104,6 +441276,13 @@ function bashToolUseOptions({
441104
441276
  }
441105
441277
  }
441106
441278
  }
441279
+ if (showAutoModeOption) {
441280
+ options.push({
441281
+ label: "Auto mode",
441282
+ description: "Switch this session to auto mode; this request is re-checked by the auto gate",
441283
+ value: "yes-auto-mode"
441284
+ });
441285
+ }
441107
441286
  if (noInputMode) {
441108
441287
  options.push({
441109
441288
  type: "input",
@@ -441261,6 +441440,7 @@ function BashPermissionRequestInner({
441261
441440
  }) {
441262
441441
  const [theme] = useTheme();
441263
441442
  const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
441443
+ const setAppState = useSetAppState();
441264
441444
  const explainerState = usePermissionExplainerUI({
441265
441445
  toolName: toolUseConfirm.tool.name,
441266
441446
  toolInput: toolUseConfirm.input,
@@ -441370,8 +441550,9 @@ function BashPermissionRequestInner({
441370
441550
  yesInputMode,
441371
441551
  noInputMode,
441372
441552
  editablePrefix,
441373
- onEditablePrefixChange
441374
- }), [toolUseConfirm, classifierDescription, initialClassifierDescriptionEmpty, existingAllowDescriptions, yesInputMode, noInputMode, editablePrefix, onEditablePrefixChange]);
441553
+ onEditablePrefixChange,
441554
+ showAutoModeOption: isAutoModeOptionVisible(toolPermissionContext)
441555
+ }), [toolUseConfirm, classifierDescription, initialClassifierDescriptionEmpty, existingAllowDescriptions, yesInputMode, noInputMode, editablePrefix, onEditablePrefixChange, toolPermissionContext]);
441375
441556
  const handleToggleDebug = import_react192.useCallback(() => {
441376
441557
  setShowPermissionDebug((prev) => !prev);
441377
441558
  }, []);
@@ -441426,6 +441607,10 @@ function BashPermissionRequestInner({
441426
441607
  onDone();
441427
441608
  return;
441428
441609
  }
441610
+ if (value_0 === "yes-auto-mode") {
441611
+ applyAutoModePermissionOption(toolPermissionContext, setAppState, () => toolUseConfirm.recheckPermission());
441612
+ return;
441613
+ }
441429
441614
  switch (value_0) {
441430
441615
  case "yes": {
441431
441616
  const trimmedFeedback_0 = acceptFeedback.trim();
@@ -441581,6 +441766,7 @@ var init_BashPermissionRequest = __esm(() => {
441581
441766
  init_useKeybinding();
441582
441767
  init_growthbook();
441583
441768
  init_AppState();
441769
+ init_autoModePermissionOption();
441584
441770
  init_BashTool();
441585
441771
  init_bashPermissions2();
441586
441772
  init_destructiveCommandWarning2();
@@ -441615,7 +441801,7 @@ function EnterPlanModePermissionRequest(t0) {
441615
441801
  onReject,
441616
441802
  workerBadge
441617
441803
  } = t0;
441618
- const toolPermissionContextMode = useAppState(_temp151);
441804
+ const toolPermissionContextMode = useAppState(_temp150);
441619
441805
  let t1;
441620
441806
  if ($[0] !== onDone || $[1] !== onReject || $[2] !== toolPermissionContextMode || $[3] !== toolUseConfirm) {
441621
441807
  t1 = function handleResponse(value) {
@@ -441766,7 +441952,7 @@ function EnterPlanModePermissionRequest(t0) {
441766
441952
  }
441767
441953
  return t9;
441768
441954
  }
441769
- function _temp151(s) {
441955
+ function _temp150(s) {
441770
441956
  return s.toolPermissionContext.mode;
441771
441957
  }
441772
441958
  var import_compiler_runtime267, jsx_dev_runtime339;
@@ -442697,7 +442883,7 @@ function PermissionPrompt(t0) {
442697
442883
  let t7;
442698
442884
  if ($[31] !== onCancel || $[32] !== setAppState) {
442699
442885
  t7 = () => {
442700
- setAppState(_temp153);
442886
+ setAppState(_temp151);
442701
442887
  onCancel?.();
442702
442888
  };
442703
442889
  $[31] = onCancel;
@@ -442794,7 +442980,7 @@ function PermissionPrompt(t0) {
442794
442980
  }
442795
442981
  return t13;
442796
442982
  }
442797
- function _temp153(prev) {
442983
+ function _temp151(prev) {
442798
442984
  return {
442799
442985
  ...prev,
442800
442986
  attribution: {
@@ -443226,7 +443412,7 @@ function createSingleEditDiffConfig(filePath, oldString, newString, replaceAll)
443226
443412
  import { basename as basename57, relative as relative33 } from "path";
443227
443413
  function FileEditPermissionRequest(props) {
443228
443414
  const $ = import_compiler_runtime270.c(51);
443229
- const parseInput = _temp154;
443415
+ const parseInput = _temp153;
443230
443416
  let T0;
443231
443417
  let T1;
443232
443418
  let T2;
@@ -443402,7 +443588,7 @@ function FileEditPermissionRequest(props) {
443402
443588
  }
443403
443589
  return t16;
443404
443590
  }
443405
- function _temp154(input) {
443591
+ function _temp153(input) {
443406
443592
  return FileEditTool.inputSchema.parse(input);
443407
443593
  }
443408
443594
  var import_compiler_runtime270, jsx_dev_runtime343, ideDiffSupport;
@@ -443476,7 +443662,7 @@ function FilesystemPermissionRequest(t0) {
443476
443662
  const isReadOnly = toolUseConfirm.tool.isReadOnly(toolUseConfirm.input);
443477
443663
  const userFacingReadOrEdit = isReadOnly ? "Read" : "Edit";
443478
443664
  const title = `${userFacingReadOrEdit} file`;
443479
- const parseInput = _temp155;
443665
+ const parseInput = _temp154;
443480
443666
  if (!path) {
443481
443667
  let t3;
443482
443668
  if ($[5] !== onDone || $[6] !== onReject || $[7] !== toolUseConfirm || $[8] !== toolUseContext || $[9] !== verbose || $[10] !== workerBadge) {
@@ -443567,7 +443753,7 @@ function FilesystemPermissionRequest(t0) {
443567
443753
  }
443568
443754
  return t6;
443569
443755
  }
443570
- function _temp155(input) {
443756
+ function _temp154(input) {
443571
443757
  return input;
443572
443758
  }
443573
443759
  var import_compiler_runtime271, jsx_dev_runtime344;
@@ -443637,7 +443823,7 @@ function FileWriteToolDiff(t0) {
443637
443823
  firstLine,
443638
443824
  fileContent: oldContent,
443639
443825
  width: columns - 2
443640
- }, _.newStart, false, undefined, this)), _temp156) : /* @__PURE__ */ jsx_dev_runtime345.jsxDEV(HighlightedCode, {
443826
+ }, _.newStart, false, undefined, this)), _temp155) : /* @__PURE__ */ jsx_dev_runtime345.jsxDEV(HighlightedCode, {
443641
443827
  code: content || "(No content)",
443642
443828
  filePath: file_path
443643
443829
  }, undefined, false, undefined, this);
@@ -443672,7 +443858,7 @@ function FileWriteToolDiff(t0) {
443672
443858
  }
443673
443859
  return t4;
443674
443860
  }
443675
- function _temp156(i) {
443861
+ function _temp155(i) {
443676
443862
  return /* @__PURE__ */ jsx_dev_runtime345.jsxDEV(NoSelect, {
443677
443863
  fromLeftEdge: true,
443678
443864
  children: /* @__PURE__ */ jsx_dev_runtime345.jsxDEV(ThemedText, {
@@ -443696,7 +443882,7 @@ var init_FileWriteToolDiff = __esm(() => {
443696
443882
  import { basename as basename58, relative as relative34 } from "path";
443697
443883
  function FileWritePermissionRequest(props) {
443698
443884
  const $ = import_compiler_runtime273.c(30);
443699
- const parseInput = _temp157;
443885
+ const parseInput = _temp156;
443700
443886
  let t0;
443701
443887
  if ($[0] !== props.toolUseConfirm.input) {
443702
443888
  t0 = parseInput(props.toolUseConfirm.input);
@@ -443843,7 +444029,7 @@ function FileWritePermissionRequest(props) {
443843
444029
  }
443844
444030
  return t13;
443845
444031
  }
443846
- function _temp157(input) {
444032
+ function _temp156(input) {
443847
444033
  return FileWriteTool.inputSchema.parse(input);
443848
444034
  }
443849
444035
  var import_compiler_runtime273, jsx_dev_runtime346, ideDiffSupport2;
@@ -443890,7 +444076,7 @@ function NotebookEditToolDiff(props) {
443890
444076
  if ($[0] !== props.notebook_path) {
443891
444077
  t0 = getFsImplementation2().readFile(props.notebook_path, {
443892
444078
  encoding: "utf-8"
443893
- }).then(_temp158).catch(_temp269);
444079
+ }).then(_temp157).catch(_temp269);
443894
444080
  $[0] = props.notebook_path;
443895
444081
  $[1] = t0;
443896
444082
  } else {
@@ -443917,7 +444103,7 @@ function NotebookEditToolDiff(props) {
443917
444103
  function _temp269() {
443918
444104
  return null;
443919
444105
  }
443920
- function _temp158(content) {
444106
+ function _temp157(content) {
443921
444107
  return safeParseJSON3(content);
443922
444108
  }
443923
444109
  function NotebookEditToolDiffInner(t0) {
@@ -444168,7 +444354,7 @@ var init_NotebookEditToolDiff = __esm(() => {
444168
444354
  import { basename as basename59 } from "path";
444169
444355
  function NotebookEditPermissionRequest(props) {
444170
444356
  const $ = import_compiler_runtime275.c(52);
444171
- const parseInput = _temp159;
444357
+ const parseInput = _temp158;
444172
444358
  let T0;
444173
444359
  let T1;
444174
444360
  let T2;
@@ -444340,7 +444526,7 @@ function NotebookEditPermissionRequest(props) {
444340
444526
  }
444341
444527
  return t15;
444342
444528
  }
444343
- function _temp159(input) {
444529
+ function _temp158(input) {
444344
444530
  const result = NotebookEditTool2.inputSchema.safeParse(input);
444345
444531
  if (!result.success) {
444346
444532
  logError3(new Error(`Failed to parse notebook edit input: ${result.error.message}`));
@@ -444578,7 +444764,8 @@ function powershellToolUseOptions({
444578
444764
  yesInputMode = false,
444579
444765
  noInputMode = false,
444580
444766
  editablePrefix,
444581
- onEditablePrefixChange
444767
+ onEditablePrefixChange,
444768
+ showAutoModeOption = false
444582
444769
  }) {
444583
444770
  const options = [];
444584
444771
  if (yesInputMode) {
@@ -444621,6 +444808,13 @@ function powershellToolUseOptions({
444621
444808
  }
444622
444809
  }
444623
444810
  }
444811
+ if (showAutoModeOption) {
444812
+ options.push({
444813
+ label: "Auto mode",
444814
+ description: "Switch this session to auto mode; this request is re-checked by the auto gate",
444815
+ value: "yes-auto-mode"
444816
+ });
444817
+ }
444624
444818
  if (noInputMode) {
444625
444819
  options.push({
444626
444820
  type: "input",
@@ -444657,6 +444851,8 @@ function PowerShellPermissionRequest(props) {
444657
444851
  description
444658
444852
  } = PowerShellTool.inputSchema.parse(toolUseConfirm.input);
444659
444853
  const [theme] = useTheme();
444854
+ const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
444855
+ const setAppState = useSetAppState();
444660
444856
  const explainerState = usePermissionExplainerUI({
444661
444857
  toolName: toolUseConfirm.tool.name,
444662
444858
  toolInput: toolUseConfirm.input,
@@ -444716,8 +444912,9 @@ function PowerShellPermissionRequest(props) {
444716
444912
  yesInputMode,
444717
444913
  noInputMode,
444718
444914
  editablePrefix,
444719
- onEditablePrefixChange
444720
- }), [toolUseConfirm, yesInputMode, noInputMode, editablePrefix, onEditablePrefixChange]);
444915
+ onEditablePrefixChange,
444916
+ showAutoModeOption: isAutoModeOptionVisible(toolPermissionContext)
444917
+ }), [toolUseConfirm, yesInputMode, noInputMode, editablePrefix, onEditablePrefixChange, toolPermissionContext]);
444721
444918
  const handleToggleDebug = import_react196.useCallback(() => {
444722
444919
  setShowPermissionDebug((prev) => !prev);
444723
444920
  }, []);
@@ -444745,6 +444942,10 @@ function PowerShellPermissionRequest(props) {
444745
444942
  onDone();
444746
444943
  return;
444747
444944
  }
444945
+ if (value === "yes-auto-mode") {
444946
+ applyAutoModePermissionOption(toolPermissionContext, setAppState, () => toolUseConfirm.recheckPermission());
444947
+ return;
444948
+ }
444748
444949
  switch (value) {
444749
444950
  case "yes": {
444750
444951
  const trimmedFeedback = acceptFeedback.trim();
@@ -444867,10 +445068,12 @@ var import_react196, jsx_dev_runtime349;
444867
445068
  var init_PowerShellPermissionRequest = __esm(() => {
444868
445069
  init_ink2();
444869
445070
  init_useKeybinding();
445071
+ init_AppState();
444870
445072
  init_growthbook();
444871
445073
  init_destructiveCommandWarning3();
444872
445074
  init_PowerShellTool();
444873
445075
  init_readOnlyValidation2();
445076
+ init_autoModePermissionOption();
444874
445077
  init_staticPrefix();
444875
445078
  init_select();
444876
445079
  init_hooks8();
@@ -444894,7 +445097,7 @@ function SkillPermissionRequest(props) {
444894
445097
  onReject,
444895
445098
  workerBadge
444896
445099
  } = props;
444897
- const parseInput = _temp160;
445100
+ const parseInput = _temp159;
444898
445101
  let t0;
444899
445102
  if ($[0] !== toolUseConfirm.input) {
444900
445103
  t0 = parseInput(toolUseConfirm.input);
@@ -445287,7 +445490,7 @@ function SkillPermissionRequest(props) {
445287
445490
  }
445288
445491
  return t19;
445289
445492
  }
445290
- function _temp160(input) {
445493
+ function _temp159(input) {
445291
445494
  const result = SkillTool2.inputSchema.safeParse(input);
445292
445495
  if (!result.success) {
445293
445496
  logError3(new Error(`Failed to parse skill tool input: ${result.error.message}`));
@@ -447393,7 +447596,7 @@ function PromptDialog(t0) {
447393
447596
  useKeybinding("app:interrupt", onAbort, t1);
447394
447597
  let t2;
447395
447598
  if ($[1] !== request.options) {
447396
- t2 = request.options.map(_temp161);
447599
+ t2 = request.options.map(_temp160);
447397
447600
  $[1] = request.options;
447398
447601
  $[2] = t2;
447399
447602
  } else {
@@ -447455,7 +447658,7 @@ function PromptDialog(t0) {
447455
447658
  }
447456
447659
  return t6;
447457
447660
  }
447458
- function _temp161(opt) {
447661
+ function _temp160(opt) {
447459
447662
  return {
447460
447663
  label: opt.label,
447461
447664
  value: opt.key,
@@ -448755,7 +448958,7 @@ function Notifications(t0) {
448755
448958
  const {
448756
448959
  status: ideStatus
448757
448960
  } = useIdeConnectionStatus(mcpClients);
448758
- const notifications = useAppState(_temp163);
448961
+ const notifications = useAppState(_temp161);
448759
448962
  const {
448760
448963
  addNotification,
448761
448964
  removeNotification
@@ -448902,7 +449105,7 @@ function Notifications(t0) {
448902
449105
  function _temp270() {
448903
449106
  return setEnvHookNotifier2(null);
448904
449107
  }
448905
- function _temp163(s) {
449108
+ function _temp161(s) {
448906
449109
  return s.notifications;
448907
449110
  }
448908
449111
  function NotificationContent({
@@ -453258,7 +453461,7 @@ function AutoModeOptInDialog(t0) {
453258
453461
  } else {
453259
453462
  t1 = $[0];
453260
453463
  }
453261
- import_react215.default.useEffect(_temp164, t1);
453464
+ import_react215.default.useEffect(_temp163, t1);
453262
453465
  let t2;
453263
453466
  if ($[1] !== onAccept || $[2] !== onDecline) {
453264
453467
  t2 = function onChange(value) {
@@ -453391,7 +453594,7 @@ function AutoModeOptInDialog(t0) {
453391
453594
  }
453392
453595
  return t10;
453393
453596
  }
453394
- function _temp164() {}
453597
+ function _temp163() {}
453395
453598
  var import_compiler_runtime288, import_react215, jsx_dev_runtime367, AUTO_MODE_DESCRIPTION = "Auto mode lets Atlas handle permission prompts automatically — Atlas checks each tool call for risky actions and prompt injection before executing. Actions Atlas identifies as safe are executed, while actions Atlas identifies as risky are blocked and Atlas may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Atlas can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.";
453396
453599
  var init_AutoModeOptInDialog = __esm(() => {
453397
453600
  init_ink2();
@@ -453409,12 +453612,12 @@ function getVisibleAgentTasks(tasks) {
453409
453612
  return Object.values(tasks).filter((t) => isPanelAgentTask2(t) && t.evictAfter !== 0).sort((a, b) => a.startTime - b.startTime);
453410
453613
  }
453411
453614
  function useCoordinatorTaskCount() {
453412
- const tasks = useAppState(_temp165);
453615
+ const tasks = useAppState(_temp164);
453413
453616
  let t0;
453414
453617
  t0 = 0;
453415
453618
  return t0;
453416
453619
  }
453417
- function _temp165(s) {
453620
+ function _temp164(s) {
453418
453621
  return s.tasks;
453419
453622
  }
453420
453623
  var import_compiler_runtime289, React115;
@@ -453881,7 +454084,7 @@ function GlobalSearchDialog(t0) {
453881
454084
  }
453882
454085
  abortRef.current?.abort();
453883
454086
  if (!q.trim()) {
453884
- setMatches(_temp166);
454087
+ setMatches(_temp165);
453885
454088
  setIsSearching(false);
453886
454089
  setTruncated(false);
453887
454090
  return;
@@ -454107,7 +454310,7 @@ function _temp347(m_2) {
454107
454310
  return m_2.length ? [] : m_2;
454108
454311
  }
454109
454312
  function _temp271() {}
454110
- function _temp166(m) {
454313
+ function _temp165(m) {
454111
454314
  return m.length ? [] : m;
454112
454315
  }
454113
454316
  function matchKey(m) {
@@ -454344,7 +454547,7 @@ function QuickOpenDialog(t0) {
454344
454547
  if (gen !== queryGenRef.current) {
454345
454548
  return;
454346
454549
  }
454347
- const paths = items.filter(_temp167).map(_temp272).filter(_temp348).map(_temp434);
454550
+ const paths = items.filter(_temp166).map(_temp272).filter(_temp348).map(_temp434);
454348
454551
  setResults(paths);
454349
454552
  });
454350
454553
  };
@@ -454533,7 +454736,7 @@ function _temp348(p) {
454533
454736
  function _temp272(i_0) {
454534
454737
  return i_0.displayText;
454535
454738
  }
454536
- function _temp167(i) {
454739
+ function _temp166(i) {
454537
454740
  return i.id.startsWith("file-");
454538
454741
  }
454539
454742
  var import_compiler_runtime292, import_react219, jsx_dev_runtime372, VISIBLE_RESULTS2 = 8, PREVIEW_LINES = 20;
@@ -454699,7 +454902,7 @@ function ThinkingToggle(t0) {
454699
454902
  defaultFocusValue: currentValue ? "true" : "false",
454700
454903
  options,
454701
454904
  onChange: handleSelectChange,
454702
- onCancel: onCancel ?? _temp168,
454905
+ onCancel: onCancel ?? _temp167,
454703
454906
  visibleOptionCount: 2
454704
454907
  }, undefined, false, undefined, this)
454705
454908
  }, undefined, false, undefined, this)
@@ -454776,7 +454979,7 @@ function ThinkingToggle(t0) {
454776
454979
  }
454777
454980
  return t11;
454778
454981
  }
454779
- function _temp168() {}
454982
+ function _temp167() {}
454780
454983
  var import_compiler_runtime293, import_react220, jsx_dev_runtime373;
454781
454984
  var init_ThinkingToggle = __esm(() => {
454782
454985
  init_useExitOnCtrlCDWithKeybindings();
@@ -455225,7 +455428,7 @@ function TeammateDetailView(t0) {
455225
455428
  if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
455226
455429
  t4 = (input) => {
455227
455430
  if (input === "p") {
455228
- setPromptExpanded(_temp169);
455431
+ setPromptExpanded(_temp168);
455229
455432
  }
455230
455433
  };
455231
455434
  $[6] = t4;
@@ -455419,7 +455622,7 @@ function _temp273(task_0) {
455419
455622
  ]
455420
455623
  }, task_0.id, true, undefined, this);
455421
455624
  }
455422
- function _temp169(prev) {
455625
+ function _temp168(prev) {
455423
455626
  return !prev;
455424
455627
  }
455425
455628
  async function killTeammate(paneId, backendType, teamName, teammateId, teammateName, setAppState) {
@@ -456679,7 +456882,7 @@ function VimTextInput(props) {
456679
456882
  const t11 = props.multiline;
456680
456883
  const t12 = props.showCursor ? " " : "";
456681
456884
  const t13 = props.highlightPastedText;
456682
- const t14 = isTerminalFocused ? source_default.inverse : _temp170;
456885
+ const t14 = isTerminalFocused ? source_default.inverse : _temp169;
456683
456886
  let t15;
456684
456887
  if ($[0] !== theme) {
456685
456888
  t15 = color("text", theme);
@@ -456792,7 +456995,7 @@ function VimTextInput(props) {
456792
456995
  }
456793
456996
  return t19;
456794
456997
  }
456795
- function _temp170(text) {
456998
+ function _temp169(text) {
456796
456999
  return text;
456797
457000
  }
456798
457001
  var import_compiler_runtime295, import_react223, jsx_dev_runtime375;
@@ -458073,7 +458276,7 @@ function BackgroundTaskStatus(t0) {
458073
458276
  const {
458074
458277
  columns
458075
458278
  } = useTerminalSize();
458076
- const tasks = useAppState(_temp173);
458279
+ const tasks = useAppState(_temp171);
458077
458280
  const viewingAgentTaskId = useAppState(_temp274);
458078
458281
  let t3;
458079
458282
  if ($[0] !== tasks) {
@@ -458128,7 +458331,7 @@ function BackgroundTaskStatus(t0) {
458128
458331
  const allPills = t6;
458129
458332
  let t7;
458130
458333
  if ($[10] !== allPills) {
458131
- t7 = allPills.map(_temp171);
458334
+ t7 = allPills.map(_temp170);
458132
458335
  $[10] = allPills;
458133
458336
  $[11] = t7;
458134
458337
  } else {
@@ -458326,7 +458529,7 @@ function BackgroundTaskStatus(t0) {
458326
458529
  }
458327
458530
  return t11;
458328
458531
  }
458329
- function _temp171(pill_0, i_0) {
458532
+ function _temp170(pill_0, i_0) {
458330
458533
  const pillText = `@${pill_0.name}`;
458331
458534
  return stringWidth2(pillText) + (i_0 > 0 ? 1 : 0);
458332
458535
  }
@@ -458368,7 +458571,7 @@ function _temp349(t) {
458368
458571
  function _temp274(s_0) {
458369
458572
  return s_0.viewingAgentTaskId;
458370
458573
  }
458371
- function _temp173(s) {
458574
+ function _temp171(s) {
458372
458575
  return s.tasks;
458373
458576
  }
458374
458577
  function AgentPill(t0) {
@@ -458591,7 +458794,7 @@ function TeamStatus(t0) {
458591
458794
  teamsSelected,
458592
458795
  showHint
458593
458796
  } = t0;
458594
- const teamContext = useAppState(_temp174);
458797
+ const teamContext = useAppState(_temp173);
458595
458798
  let t1;
458596
458799
  if ($[0] !== teamContext) {
458597
458800
  t1 = teamContext ? Object.values(teamContext.teammates).filter(_temp275).length : 0;
@@ -458673,7 +458876,7 @@ function TeamStatus(t0) {
458673
458876
  function _temp275(t) {
458674
458877
  return t.name !== "team-lead";
458675
458878
  }
458676
- function _temp174(s) {
458879
+ function _temp173(s) {
458677
458880
  return s.teamContext;
458678
458881
  }
458679
458882
  var import_compiler_runtime297, jsx_dev_runtime395;
@@ -458711,7 +458914,7 @@ function HistorySearchInput(t0) {
458711
458914
  value,
458712
458915
  onChange,
458713
458916
  cursorOffset: value.length,
458714
- onChangeCursorOffset: _temp175,
458917
+ onChangeCursorOffset: _temp174,
458715
458918
  columns: t3,
458716
458919
  focus: true,
458717
458920
  showCursor: true,
@@ -458742,7 +458945,7 @@ function HistorySearchInput(t0) {
458742
458945
  }
458743
458946
  return t5;
458744
458947
  }
458745
- function _temp175() {}
458948
+ function _temp174() {}
458746
458949
  var import_compiler_runtime298, jsx_dev_runtime396, HistorySearchInput_default;
458747
458950
  var init_HistorySearchInput = __esm(() => {
458748
458951
  init_stringWidth();
@@ -465244,7 +465447,7 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
465244
465447
  if (feature("BASH_CLASSIFIER") && result.pendingClassifierCheck && tool.name === BASH_TOOL_NAME2 && !appState.toolPermissionContext.awaitAutomatedChecksBeforeDialog) {
465245
465448
  const speculativePromise = peekSpeculativeClassifierCheck2(input.command);
465246
465449
  if (speculativePromise) {
465247
- const raceResult = await Promise.race([speculativePromise.then(_temp176), new Promise(_temp276)]);
465450
+ const raceResult = await Promise.race([speculativePromise.then(_temp175), new Promise(_temp276)]);
465248
465451
  if (ctx.resolveIfAborted(resolve)) {
465249
465452
  return;
465250
465453
  }
@@ -465307,7 +465510,7 @@ function _temp276(res) {
465307
465510
  type: "timeout"
465308
465511
  });
465309
465512
  }
465310
- function _temp176(r) {
465513
+ function _temp175(r) {
465311
465514
  return {
465312
465515
  type: "result",
465313
465516
  result: r
@@ -466092,7 +466295,7 @@ async function handlePromptSubmit(params) {
466092
466295
  const spaceIndex = trimmedInput.indexOf(" ");
466093
466296
  const commandName = spaceIndex === -1 ? trimmedInput.slice(1) : trimmedInput.slice(1, spaceIndex);
466094
466297
  const commandArgs = spaceIndex === -1 ? "" : trimmedInput.slice(spaceIndex + 1).trim();
466095
- const immediateCommand = commands.find((cmd) => cmd.immediate && isCommandEnabled2(cmd) && (cmd.name === commandName || cmd.aliases?.includes(commandName) || getCommandName2(cmd) === commandName));
466298
+ const immediateCommand = commands.find((cmd) => (cmd.immediate ?? true) && isCommandEnabled2(cmd) && (cmd.name === commandName || cmd.aliases?.includes(commandName) || getCommandName2(cmd) === commandName));
466096
466299
  if (immediateCommand && immediateCommand.type === "local-jsx" && (queryGuard.isActive || isExternalLoading)) {
466097
466300
  onInputChange("");
466098
466301
  setCursorOffset(0);
@@ -466928,7 +467131,7 @@ var init_useManagePlugins = __esm(() => {
466928
467131
  // src/tui/components/TeammateViewHeader.tsx
466929
467132
  function TeammateViewHeader() {
466930
467133
  const $ = import_compiler_runtime305.c(14);
466931
- const viewedTeammate = useAppState(_temp177);
467134
+ const viewedTeammate = useAppState(_temp176);
466932
467135
  if (!viewedTeammate) {
466933
467136
  return null;
466934
467137
  }
@@ -467027,7 +467230,7 @@ function TeammateViewHeader() {
467027
467230
  }
467028
467231
  return t6;
467029
467232
  }
467030
- function _temp177(s) {
467233
+ function _temp176(s) {
467031
467234
  return getViewedTeammateTask(s);
467032
467235
  }
467033
467236
  var import_compiler_runtime305, jsx_dev_runtime406;
@@ -468377,7 +468580,7 @@ function SessionBackgroundHint(t0) {
468377
468580
  const setAppState = useSetAppState();
468378
468581
  const appStateStore = useAppStateStore();
468379
468582
  const [showSessionHint, setShowSessionHint] = import_react256.useState(false);
468380
- const handleDoublePress = useDoublePress(setShowSessionHint, onBackgroundSession, _temp178);
468583
+ const handleDoublePress = useDoublePress(setShowSessionHint, onBackgroundSession, _temp177);
468381
468584
  let t1;
468382
468585
  if ($[0] !== appStateStore || $[1] !== handleDoublePress || $[2] !== isLoading || $[3] !== setAppState) {
468383
468586
  t1 = () => {
@@ -468457,7 +468660,7 @@ function _temp277(c) {
468457
468660
  hasUsedBackgroundTask: true
468458
468661
  };
468459
468662
  }
468460
- function _temp178() {}
468663
+ function _temp177() {}
468461
468664
  var import_compiler_runtime307, import_react256, jsx_dev_runtime407;
468462
468665
  var init_SessionBackgroundHint = __esm(() => {
468463
468666
  init_useDoublePress();
@@ -468633,9 +468836,9 @@ function useInstallMessages() {
468633
468836
  }
468634
468837
  async function _temp278() {
468635
468838
  const messages = await checkInstall();
468636
- return messages.map(_temp179);
468839
+ return messages.map(_temp178);
468637
468840
  }
468638
- function _temp179(message, index) {
468841
+ function _temp178(message, index) {
468639
468842
  let priority = "low";
468640
468843
  if (message.type === "error" || message.userActionRequired) {
468641
468844
  priority = "high";
@@ -469024,9 +469227,9 @@ var init_officialMarketplaceStartupCheck = __esm(() => {
469024
469227
 
469025
469228
  // src/tui/hooks/useOfficialMarketplaceNotification.tsx
469026
469229
  function useOfficialMarketplaceNotification() {
469027
- useStartupNotification(_temp180);
469230
+ useStartupNotification(_temp179);
469028
469231
  }
469029
- async function _temp180() {
469232
+ async function _temp179() {
469030
469233
  const result = await checkAndInstallOfficialMarketplace();
469031
469234
  const notifs = [];
469032
469235
  if (result.configSaveFailed) {
@@ -469586,7 +469789,7 @@ function SandboxViolationExpandedView() {
469586
469789
  }
469587
469790
  let t5;
469588
469791
  if ($[6] !== violations) {
469589
- t5 = violations.map(_temp181);
469792
+ t5 = violations.map(_temp180);
469590
469793
  $[6] = violations;
469591
469794
  $[7] = t5;
469592
469795
  } else {
@@ -469633,7 +469836,7 @@ function SandboxViolationExpandedView() {
469633
469836
  }
469634
469837
  return t8;
469635
469838
  }
469636
- function _temp181(v, i) {
469839
+ function _temp180(v, i) {
469637
469840
  return /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(ThemedBox_default, {
469638
469841
  paddingLeft: 2,
469639
469842
  children: /* @__PURE__ */ jsx_dev_runtime412.jsxDEV(ThemedText, {
@@ -469674,7 +469877,7 @@ function useMcpConnectivityStatus(t0) {
469674
469877
  if (getIsRemoteMode()) {
469675
469878
  return;
469676
469879
  }
469677
- const failedLocalClients = mcpClients.filter(_temp183);
469880
+ const failedLocalClients = mcpClients.filter(_temp181);
469678
469881
  const failedClaudeAiClients = mcpClients.filter(_temp279);
469679
469882
  const needsAuthLocalServers = mcpClients.filter(_temp350);
469680
469883
  const needsAuthClaudeAiServers = mcpClients.filter(_temp436);
@@ -469801,7 +470004,7 @@ function _temp350(client_1) {
469801
470004
  function _temp279(client_0) {
469802
470005
  return false;
469803
470006
  }
469804
- function _temp183(client) {
470007
+ function _temp181(client) {
469805
470008
  return client.type === "failed" && client.config.type !== "sse-ide" && client.config.type !== "ws-ide" && client.config.type !== "claudeai-proxy";
469806
470009
  }
469807
470010
  var import_compiler_runtime310, import_react262, jsx_dev_runtime413, EMPTY_MCP_CLIENTS;
@@ -469864,7 +470067,7 @@ function useLspInitializationNotification() {
469864
470067
  addNotification
469865
470068
  } = useNotifications();
469866
470069
  const setAppState = useSetAppState();
469867
- const [shouldPoll, setShouldPoll] = React126.useState(_temp184);
470070
+ const [shouldPoll, setShouldPoll] = React126.useState(_temp183);
469868
470071
  let t0;
469869
470072
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
469870
470073
  t0 = new Set;
@@ -469991,7 +470194,7 @@ function _temp280(e) {
469991
470194
  }
469992
470195
  return `${e.type}:${e.source}`;
469993
470196
  }
469994
- function _temp184() {
470197
+ function _temp183() {
469995
470198
  return isEnvTruthy2("true");
469996
470199
  }
469997
470200
  var import_compiler_runtime311, React126, jsx_dev_runtime414, LSP_POLL_INTERVAL_MS = 5000;
@@ -470323,7 +470526,7 @@ var init_usePluginRecommendationBase = __esm(() => {
470323
470526
  import { extname as extname19, join as join173 } from "path";
470324
470527
  function useLspPluginRecommendation() {
470325
470528
  const $ = import_compiler_runtime313.c(12);
470326
- const trackedFiles = useAppState(_temp185);
470529
+ const trackedFiles = useAppState(_temp184);
470327
470530
  const {
470328
470531
  addNotification
470329
470532
  } = useNotifications();
@@ -470467,7 +470670,7 @@ function _temp281(current) {
470467
470670
  lspRecommendationDisabled: true
470468
470671
  };
470469
470672
  }
470470
- function _temp185(s) {
470673
+ function _temp184(s) {
470471
470674
  return s.fileHistory.trackedFiles;
470472
470675
  }
470473
470676
  var import_compiler_runtime313, React128, TIMEOUT_THRESHOLD_MS = 28000;
@@ -470862,7 +471065,7 @@ function usePluginInstallationStatus() {
470862
471065
  const {
470863
471066
  addNotification
470864
471067
  } = useNotifications();
470865
- const installationStatus = useAppState(_temp186);
471068
+ const installationStatus = useAppState(_temp185);
470866
471069
  let t0;
470867
471070
  bb0: {
470868
471071
  if (!installationStatus) {
@@ -470988,7 +471191,7 @@ function _temp351(p) {
470988
471191
  function _temp282(m) {
470989
471192
  return m.status === "failed";
470990
471193
  }
470991
- function _temp186(s) {
471194
+ function _temp185(s) {
470992
471195
  return s.plugins.installationStatus;
470993
471196
  }
470994
471197
  var import_compiler_runtime315, import_react264, jsx_dev_runtime418;
@@ -471049,7 +471252,7 @@ function usePluginAutoupdateNotification() {
471049
471252
  if (updatedPlugins.length === 0) {
471050
471253
  return;
471051
471254
  }
471052
- const pluginNames = updatedPlugins.map(_temp187);
471255
+ const pluginNames = updatedPlugins.map(_temp186);
471053
471256
  const displayNames = pluginNames.length <= 2 ? pluginNames.join(" and ") : `${pluginNames.length} plugins`;
471054
471257
  addNotification({
471055
471258
  key: "plugin-autoupdate-restart",
@@ -471086,7 +471289,7 @@ function usePluginAutoupdateNotification() {
471086
471289
  }
471087
471290
  import_react265.useEffect(t3, t4);
471088
471291
  }
471089
- function _temp187(id) {
471292
+ function _temp186(id) {
471090
471293
  const atIndex = id.indexOf("@");
471091
471294
  return atIndex > 0 ? id.substring(0, atIndex) : id;
471092
471295
  }
@@ -471481,7 +471684,7 @@ function AwsAuthStatusBox() {
471481
471684
  t4 = status.output.length > 0 && /* @__PURE__ */ jsx_dev_runtime420.jsxDEV(ThemedBox_default, {
471482
471685
  flexDirection: "column",
471483
471686
  marginTop: 1,
471484
- children: status.output.slice(-5).map(_temp188)
471687
+ children: status.output.slice(-5).map(_temp187)
471485
471688
  }, undefined, false, undefined, this);
471486
471689
  $[4] = status.output;
471487
471690
  $[5] = t4;
@@ -471524,7 +471727,7 @@ function AwsAuthStatusBox() {
471524
471727
  }
471525
471728
  return t6;
471526
471729
  }
471527
- function _temp188(line, index) {
471730
+ function _temp187(line, index) {
471528
471731
  const m = line.match(URL_RE);
471529
471732
  if (!m) {
471530
471733
  return /* @__PURE__ */ jsx_dev_runtime420.jsxDEV(ThemedText, {
@@ -471607,9 +471810,9 @@ var init_useDeprecationWarningNotification = __esm(() => {
471607
471810
 
471608
471811
  // src/tui/hooks/notifs/useNpmDeprecationNotification.tsx
471609
471812
  function useNpmDeprecationNotification() {
471610
- useStartupNotification(_temp189);
471813
+ useStartupNotification(_temp188);
471611
471814
  }
471612
- async function _temp189() {
471815
+ async function _temp188() {
471613
471816
  if (isInBundledMode2() || isEnvTruthy2(process.env.DISABLE_INSTALLATION_CHECKS)) {
471614
471817
  return null;
471615
471818
  }
@@ -471787,7 +471990,7 @@ function _temp283(hasShownHintRef_0, addNotification_0) {
471787
471990
  const ideName_0 = infos[0]?.name;
471788
471991
  if (ideName_0 && !hasShownHintRef_0.current) {
471789
471992
  hasShownHintRef_0.current = true;
471790
- saveGlobalConfig(_temp190);
471993
+ saveGlobalConfig(_temp189);
471791
471994
  addNotification_0({
471792
471995
  key: "ide-status-hint",
471793
471996
  jsx: /* @__PURE__ */ jsx_dev_runtime421.jsxDEV(ThemedText, {
@@ -471805,7 +472008,7 @@ function _temp283(hasShownHintRef_0, addNotification_0) {
471805
472008
  }
471806
472009
  });
471807
472010
  }
471808
- function _temp190(current) {
472011
+ function _temp189(current) {
471809
472012
  return {
471810
472013
  ...current,
471811
472014
  ideHintShownCount: (current.ideHintShownCount ?? 0) + 1
@@ -472134,7 +472337,7 @@ function DevBar() {
472134
472337
  }
472135
472338
  let t1;
472136
472339
  if ($[1] !== slowOps) {
472137
- t1 = slowOps.slice(-3).map(_temp191).join(" · ");
472340
+ t1 = slowOps.slice(-3).map(_temp190).join(" · ");
472138
472341
  $[1] = slowOps;
472139
472342
  $[2] = t1;
472140
472343
  } else {
@@ -472158,7 +472361,7 @@ function DevBar() {
472158
472361
  }
472159
472362
  return t2;
472160
472363
  }
472161
- function _temp191(op) {
472364
+ function _temp190(op) {
472162
472365
  return `${op.operation} (${Math.round(op.durationMs)}ms)`;
472163
472366
  }
472164
472367
  var import_compiler_runtime321, import_react272, jsx_dev_runtime423;
@@ -474610,9 +474813,9 @@ function AnimatedTerminalTitle(t0) {
474610
474813
  return null;
474611
474814
  }
474612
474815
  function _temp284(setFrame_0) {
474613
- return setFrame_0(_temp192);
474816
+ return setFrame_0(_temp191);
474614
474817
  }
474615
- function _temp192(f) {
474818
+ function _temp191(f) {
474616
474819
  return (f + 1) % TITLE_ANIMATION_FRAMES.length;
474617
474820
  }
474618
474821
  function REPL({
@@ -478144,7 +478347,7 @@ function MCPServerMultiselectDialog(t0) {
478144
478347
  }
478145
478348
  let t5;
478146
478349
  if ($[7] !== serverNames) {
478147
- t5 = serverNames.map(_temp193);
478350
+ t5 = serverNames.map(_temp192);
478148
478351
  $[7] = serverNames;
478149
478352
  $[8] = t5;
478150
478353
  } else {
@@ -478233,7 +478436,7 @@ function MCPServerMultiselectDialog(t0) {
478233
478436
  }
478234
478437
  return t9;
478235
478438
  }
478236
- function _temp193(server_0) {
478439
+ function _temp192(server_0) {
478237
478440
  return {
478238
478441
  label: server_0,
478239
478442
  value: server_0
@@ -478512,7 +478715,7 @@ function PreflightStep(t0) {
478512
478715
  onSuccess();
478513
478716
  } else {
478514
478717
  if (result && !result.success) {
478515
- const timer = setTimeout(_temp194, 100);
478718
+ const timer = setTimeout(_temp193, 100);
478516
478719
  return () => clearTimeout(timer);
478517
478720
  }
478518
478721
  }
@@ -478605,7 +478808,7 @@ function PreflightStep(t0) {
478605
478808
  }
478606
478809
  return t6;
478607
478810
  }
478608
- function _temp194() {
478811
+ function _temp193() {
478609
478812
  return process.exit(1);
478610
478813
  }
478611
478814
  var import_compiler_runtime327, import_react282, jsx_dev_runtime433;
@@ -480904,9 +481107,9 @@ function _temp352(tool_0) {
480904
481107
  return tool_0 === BASH_TOOL_NAME2 || tool_0.startsWith(BASH_TOOL_NAME2 + "(");
480905
481108
  }
480906
481109
  function _temp285(command) {
480907
- return command.type === "prompt" && command.loadedFrom === "commands_DEPRECATED" && (command.source === "projectSettings" || command.source === "localSettings") && command.allowedTools?.some(_temp195);
481110
+ return command.type === "prompt" && command.loadedFrom === "commands_DEPRECATED" && (command.source === "projectSettings" || command.source === "localSettings") && command.allowedTools?.some(_temp194);
480908
481111
  }
480909
- function _temp195(tool) {
481112
+ function _temp194(tool) {
480910
481113
  return tool === BASH_TOOL_NAME2 || tool.startsWith(BASH_TOOL_NAME2 + "(");
480911
481114
  }
480912
481115
  var import_compiler_runtime333, import_react287, jsx_dev_runtime440;
@@ -480942,7 +481145,7 @@ function BypassPermissionsModeDialog(t0) {
480942
481145
  } else {
480943
481146
  t1 = $[0];
480944
481147
  }
480945
- import_react288.default.useEffect(_temp196, t1);
481148
+ import_react288.default.useEffect(_temp195, t1);
480946
481149
  let t2;
480947
481150
  if ($[1] !== onAccept) {
480948
481151
  t2 = function onChange(value) {
@@ -481029,7 +481232,7 @@ function BypassPermissionsModeDialog(t0) {
481029
481232
  function _temp286() {
481030
481233
  gracefulShutdownSync(0);
481031
481234
  }
481032
- function _temp196() {}
481235
+ function _temp195() {}
481033
481236
  var import_compiler_runtime334, import_react288, jsx_dev_runtime441;
481034
481237
  var init_BypassPermissionsModeDialog = __esm(() => {
481035
481238
  init_ink2();
@@ -481643,7 +481846,7 @@ function NoConversationsMessage() {
481643
481846
  } else {
481644
481847
  t0 = $[0];
481645
481848
  }
481646
- useKeybinding("app:interrupt", _temp197, t0);
481849
+ useKeybinding("app:interrupt", _temp196, t0);
481647
481850
  let t1;
481648
481851
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
481649
481852
  t1 = /* @__PURE__ */ jsx_dev_runtime444.jsxDEV(ThemedBox_default, {
@@ -481664,7 +481867,7 @@ function NoConversationsMessage() {
481664
481867
  }
481665
481868
  return t1;
481666
481869
  }
481667
- function _temp197() {
481870
+ function _temp196() {
481668
481871
  process.exit(1);
481669
481872
  }
481670
481873
  function CrossProjectMessage(t0) {
@@ -487359,7 +487562,7 @@ function SetupNotes(t0) {
487359
487562
  }
487360
487563
  let t2;
487361
487564
  if ($[1] !== messages) {
487362
- t2 = messages.map(_temp198);
487565
+ t2 = messages.map(_temp197);
487363
487566
  $[1] = messages;
487364
487567
  $[2] = t2;
487365
487568
  } else {
@@ -487383,7 +487586,7 @@ function SetupNotes(t0) {
487383
487586
  }
487384
487587
  return t3;
487385
487588
  }
487386
- function _temp198(message, index) {
487589
+ function _temp197(message, index) {
487387
487590
  return /* @__PURE__ */ jsx_dev_runtime448.jsxDEV(ThemedBox_default, {
487388
487591
  marginLeft: 2,
487389
487592
  children: /* @__PURE__ */ jsx_dev_runtime448.jsxDEV(ThemedText, {
@@ -490890,6 +491093,14 @@ function createCoreDependencies() {
490890
491093
  return;
490891
491094
  }
490892
491095
  });
491096
+ setLlmTimeoutSettingsSource(() => {
491097
+ try {
491098
+ const v = getInitialSettings().llmTimeoutMs;
491099
+ return typeof v === "number" ? v : undefined;
491100
+ } catch {
491101
+ return;
491102
+ }
491103
+ });
490893
491104
  return {
490894
491105
  sandboxManager,
490895
491106
  modelProvider: getModelProvider(),
@@ -493978,6 +494189,11 @@ async function binMain() {
493978
494189
  await main2();
493979
494190
  return;
493980
494191
  }
494192
+ registerGlobalCrashBackstop();
494193
+ if (process.env.ATLAS_TEST_CRASH_BACKSTOP === "1") {
494194
+ process.emit("uncaughtException", new Error("atlas crash-backstop live probe"));
494195
+ process.exit(0);
494196
+ }
493981
494197
  getCoreDependencies();
493982
494198
  await main();
493983
494199
  }