@atlasharness/atlascode 0.1.48 → 0.1.50

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 +172 -18
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -26883,6 +26883,9 @@ function isClientRequestTimeout(err) {
26883
26883
  return true;
26884
26884
  if (e.name === "APIConnectionTimeoutError" || e.name === "APITimeoutError")
26885
26885
  return true;
26886
+ const ctorName = e.constructor?.name;
26887
+ if (ctorName === "APIConnectionTimeoutError" || ctorName === "APITimeoutError")
26888
+ return true;
26886
26889
  return false;
26887
26890
  }
26888
26891
  function shouldRetryModelError(err, signal) {
@@ -27084,7 +27087,7 @@ class OpenAIProvider {
27084
27087
  }
27085
27088
  if (lastErr) {
27086
27089
  const message = lastErr instanceof Error ? lastErr.message || lastErr.name : String(lastErr);
27087
- const code = lastErr?.name === "TimeoutError" ? "TIMEOUT" : "API_ERROR";
27090
+ const code = isClientRequestTimeout(lastErr) ? "TIMEOUT" : "API_ERROR";
27088
27091
  yield { type: "error", code, message, retryable: shouldRetryModelError(lastErr, args.signal) };
27089
27092
  return;
27090
27093
  }
@@ -33081,10 +33084,15 @@ class Project {
33081
33084
  }
33082
33085
  async appendToFile(filePath, data) {
33083
33086
  try {
33084
- await fsAppendFile(filePath, data, { mode: 384 });
33085
- } catch {
33086
- await mkdir(dirname6(filePath), { recursive: true, mode: 448 });
33087
- await fsAppendFile(filePath, data, { mode: 384 });
33087
+ try {
33088
+ await fsAppendFile(filePath, data, { mode: 384 });
33089
+ } catch {
33090
+ await mkdir(dirname6(filePath), { recursive: true, mode: 448 });
33091
+ await fsAppendFile(filePath, data, { mode: 384 });
33092
+ }
33093
+ } catch (err) {
33094
+ const code = err?.code;
33095
+ logForDebugging(`transcript write failed: ${filePath} — ${code ?? String(err)}`, { level: "error" });
33088
33096
  }
33089
33097
  }
33090
33098
  async drainWriteQueue() {
@@ -55323,6 +55331,9 @@ function createSandboxManager(deps, backend) {
55323
55331
  const allowedDomains = [
55324
55332
  ...s?.sandbox?.network?.allowedDomains || []
55325
55333
  ];
55334
+ const deniedDomains = [
55335
+ ...s?.sandbox?.network?.deniedDomains || []
55336
+ ];
55326
55337
  const allowWrite = [".", deps.getAtlasTempDir()];
55327
55338
  const denyWrite = [];
55328
55339
  const denyRead = [];
@@ -55375,7 +55386,7 @@ function createSandboxManager(deps, backend) {
55375
55386
  return {
55376
55387
  network: {
55377
55388
  allowedDomains,
55378
- deniedDomains: [],
55389
+ deniedDomains,
55379
55390
  allowUnixSockets: s?.sandbox?.network?.allowUnixSockets,
55380
55391
  allowAllUnixSockets: s?.sandbox?.network?.allowAllUnixSockets,
55381
55392
  allowLocalBinding: s?.sandbox?.network?.allowLocalBinding,
@@ -55621,7 +55632,6 @@ var init_createSandboxManager = __esm(() => {
55621
55632
  init_sandbox_backend();
55622
55633
  init_ripgrep();
55623
55634
  });
55624
-
55625
55635
  // src/sandbox/index.ts
55626
55636
  var init_sandbox = __esm(() => {
55627
55637
  init_config4();
@@ -80220,6 +80230,22 @@ async function richCompactConversation(messages, context, cacheSafeParams, suppr
80220
80230
  trigger: isAutoCompact ? "auto" : "manual",
80221
80231
  customInstructions: customInstructions ?? null
80222
80232
  }, context.abortController.signal);
80233
+ if (hookResult.blocked) {
80234
+ const skipReason = hookResult.blockingReason ?? "PreCompact hook blocked compaction";
80235
+ logForDebugging(`Compact skipped: PreCompact hook blocked (${skipReason})`, { level: "warn" });
80236
+ context.setSDKStatus?.(null);
80237
+ context.onCompactProgress?.({ type: "compact_end" });
80238
+ return {
80239
+ boundaryMarker: createCompactBoundaryMessage(preCompactTokenCount, messages.length),
80240
+ summaryMessages: [],
80241
+ attachments: [],
80242
+ hookResults: [],
80243
+ userDisplayMessage: `Compaction skipped: PreCompact hook blocked (${skipReason})`,
80244
+ preCompactTokenCount,
80245
+ compactionSkipped: true,
80246
+ compactSkipReason: skipReason
80247
+ };
80248
+ }
80223
80249
  customInstructions = mergeHookInstructions(customInstructions, hookResult.newCustomInstructions);
80224
80250
  const userDisplayMessage = hookResult.userDisplayMessage;
80225
80251
  context.setStreamMode?.("requesting");
@@ -80597,7 +80623,7 @@ var init_autoCompactWindow = __esm(() => {
80597
80623
  // src/engine/context/autoCompact.ts
80598
80624
  import { randomUUID as randomUUID17 } from "crypto";
80599
80625
  function resolveModelContextWindow(model) {
80600
- return getProviderContextWindow(model) ?? MODEL_CONTEXT_WINDOW_DEFAULT;
80626
+ return getProviderContextWindow(model) ?? HARD_DEFAULT_CONTEXT_WINDOW;
80601
80627
  }
80602
80628
  function setAutoCompactSettingsSource(next) {
80603
80629
  autoCompactSettingsSource = next;
@@ -80750,7 +80776,7 @@ async function autoCompactIfNeeded(messages, tracking, deps) {
80750
80776
  };
80751
80777
  }
80752
80778
  }
80753
- var AUTOCOMPACT_BUFFER_TOKENS = 13000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3, MODEL_CONTEXT_WINDOW_DEFAULT = 150000, autoCompactSettingsSource = null, autoCompactWindowSettingsSource = null, WARNING_THRESHOLD_BUFFER_TOKENS = 20000, ERROR_THRESHOLD_BUFFER_TOKENS = 20000, MANUAL_COMPACT_BUFFER_TOKENS = 3000;
80779
+ var AUTOCOMPACT_BUFFER_TOKENS = 13000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3, autoCompactSettingsSource = null, autoCompactWindowSettingsSource = null, WARNING_THRESHOLD_BUFFER_TOKENS = 20000, ERROR_THRESHOLD_BUFFER_TOKENS = 20000, MANUAL_COMPACT_BUFFER_TOKENS = 3000;
80754
80780
  var init_autoCompact = __esm(() => {
80755
80781
  init_modelprovider2();
80756
80782
  init_config();
@@ -81396,8 +81422,9 @@ async function queryAgentLoop(deps, args) {
81396
81422
  let recovered;
81397
81423
  try {
81398
81424
  const result = await deps.reactiveCompact({ messages, turn: turns });
81399
- if (result)
81425
+ if (result && !result.compactionSkipped) {
81400
81426
  recovered = buildPostCompactMessages(result);
81427
+ }
81401
81428
  } catch (compactErr) {
81402
81429
  logForDebugging(`[reactive-compact] consumer failed: ${errorMessage(compactErr)}`);
81403
81430
  }
@@ -124056,11 +124083,31 @@ var init_settings3 = __esm(() => {
124056
124083
  });
124057
124084
 
124058
124085
  // src/tui/bootstrapState.ts
124059
- var _spSectionCache, _agentColorMap, addInvokedSkill = () => ({}), addSlowOperation = () => ({}), clearInvokedSkillsForAgent = () => ({}), flushInteractionTime = () => ({}), _activeTimeCounter, getActiveTimeCounter = () => _activeTimeCounter, getAdditionalDirectoriesForClaudeMd = () => [], getAgentColorMap = () => _agentColorMap, getAllowedSettingSources = () => ["userSettings"], getBudgetContinuationCount = () => ({}), getCodeEditToolDecisionCounter = () => ({}), getCommitCounter = () => ({}), getCurrentTurnTokenBudget = () => ({}), getDirectConnectServerUrl = () => null, getInitialMainLoopModel = () => {
124086
+ function addInvokedSkill(skillName, skillPath, content, agentId) {
124087
+ const key = _invokedSkillAgentKey(agentId);
124088
+ let bySkill = _invokedSkillsByAgent.get(key);
124089
+ if (!bySkill) {
124090
+ bySkill = new Map;
124091
+ _invokedSkillsByAgent.set(key, bySkill);
124092
+ }
124093
+ bySkill.set(skillName, {
124094
+ skillName,
124095
+ skillPath,
124096
+ content,
124097
+ invokedAt: Date.now()
124098
+ });
124099
+ }
124100
+ function clearInvokedSkillsForAgent(agentId) {
124101
+ _invokedSkillsByAgent.delete(_invokedSkillAgentKey(agentId));
124102
+ }
124103
+ function getInvokedSkillsForAgent(agentId) {
124104
+ return _invokedSkillsByAgent.get(_invokedSkillAgentKey(agentId)) ?? new Map;
124105
+ }
124106
+ var _spSectionCache, _agentColorMap, _invokedSkillsByAgent, _invokedSkillAgentKey = (agentId) => agentId ?? "__main__", addSlowOperation = () => ({}), flushInteractionTime = () => ({}), _activeTimeCounter, getActiveTimeCounter = () => _activeTimeCounter, getAdditionalDirectoriesForClaudeMd = () => [], getAgentColorMap = () => _agentColorMap, getAllowedSettingSources = () => ["userSettings"], getBudgetContinuationCount = () => ({}), getCodeEditToolDecisionCounter = () => ({}), getCommitCounter = () => ({}), getCurrentTurnTokenBudget = () => ({}), getDirectConnectServerUrl = () => null, getInitialMainLoopModel = () => {
124060
124107
  const settings = getSettings_DEPRECATED() || {};
124061
124108
  const defaultRole = settings.defaultRole || "small";
124062
124109
  return getRoleModel(defaultRole) ?? null;
124063
- }, getInlinePlugins = () => ({}), getInvokedSkillsForAgent = () => new Map, _isRemoteMode = false, getIsRemoteMode = () => _isRemoteMode, getIsScrollDraining = () => ({}), getLastAPIRequest = () => ({}), getLastInteractionTime = () => ({}), _locCounter, getLocCounter = () => _locCounter, _mainLoopModelOverride = undefined, getMainLoopModelOverride = () => _mainLoopModelOverride, getPlanSlugCache = () => new Map, getPrCounter = () => ({}), getPromptId = () => ({}), getRegisteredHooks = () => [], getSdkAgentProgressSummariesEnabled = () => ({}), getSdkBetas = () => [], getSlowOperations = () => [], getTurnOutputTokens = () => 0, getUseCoworkPlugins = () => false, handlePlanModeTransition = () => ({}), hasShownLspRecommendationThisSession = () => ({}), isReplBridgeActive2 = () => ({}), markPostCompaction = () => ({}), markScrollActivity = () => ({}), registerHookCallbacks = () => ({}), resetTurnClassifierDuration = () => {
124110
+ }, getInlinePlugins = () => ({}), _isRemoteMode = false, getIsRemoteMode = () => _isRemoteMode, getIsScrollDraining = () => ({}), getLastAPIRequest = () => ({}), getLastInteractionTime = () => ({}), _locCounter, getLocCounter = () => _locCounter, _mainLoopModelOverride = undefined, getMainLoopModelOverride = () => _mainLoopModelOverride, getPlanSlugCache = () => new Map, getPrCounter = () => ({}), getPromptId = () => ({}), getRegisteredHooks = () => [], getSdkAgentProgressSummariesEnabled = () => ({}), getSdkBetas = () => [], getSlowOperations = () => [], getTurnOutputTokens = () => 0, getUseCoworkPlugins = () => false, handlePlanModeTransition = () => ({}), hasShownLspRecommendationThisSession = () => ({}), isReplBridgeActive2 = () => ({}), markPostCompaction = () => ({}), markScrollActivity = () => ({}), registerHookCallbacks = () => ({}), resetTurnClassifierDuration = () => {
124064
124111
  _turnClassifierDurationMs = 0;
124065
124112
  _turnClassifierCount = 0;
124066
124113
  }, resetTurnHookDuration = () => {
@@ -124087,6 +124134,7 @@ var init_bootstrapState = __esm(() => {
124087
124134
  init_modelprovider2();
124088
124135
  _spSectionCache = new Map;
124089
124136
  _agentColorMap = new Map;
124137
+ _invokedSkillsByAgent = new Map;
124090
124138
  _activeTimeCounter = {
124091
124139
  add: (_v, _tags) => {},
124092
124140
  observe: (_v, _tags) => {},
@@ -214569,7 +214617,7 @@ function getContextWindowForModel(model, betas) {
214569
214617
  if (providerCtx !== undefined) {
214570
214618
  return providerCtx;
214571
214619
  }
214572
- return MODEL_CONTEXT_WINDOW_DEFAULT2;
214620
+ return MODEL_CONTEXT_WINDOW_DEFAULT;
214573
214621
  }
214574
214622
  function calculateContextPercentages(currentUsage, contextWindowSize) {
214575
214623
  if (!currentUsage) {
@@ -214593,9 +214641,10 @@ function getModelMaxOutputTokens(model) {
214593
214641
  upperLimit: MAX_OUTPUT_TOKENS_UPPER_LIMIT
214594
214642
  };
214595
214643
  }
214596
- var MODEL_CONTEXT_WINDOW_DEFAULT2 = 150000, COMPACT_MAX_OUTPUT_TOKENS2 = 20000, MAX_OUTPUT_TOKENS_DEFAULT = 32000, MAX_OUTPUT_TOKENS_UPPER_LIMIT = 64000, CAPPED_DEFAULT_MAX_TOKENS = 8000;
214644
+ var MODEL_CONTEXT_WINDOW_DEFAULT, COMPACT_MAX_OUTPUT_TOKENS2 = 20000, MAX_OUTPUT_TOKENS_DEFAULT = 32000, MAX_OUTPUT_TOKENS_UPPER_LIMIT = 64000, CAPPED_DEFAULT_MAX_TOKENS = 8000;
214597
214645
  var init_context2 = __esm(() => {
214598
214646
  init_modelprovider2();
214647
+ MODEL_CONTEXT_WINDOW_DEFAULT = HARD_DEFAULT_CONTEXT_WINDOW;
214599
214648
  });
214600
214649
 
214601
214650
  // src/tui/cost-tracker.ts
@@ -333891,6 +333940,9 @@ function buildYoloRejectionMessage(reason) {
333891
333940
  const ruleHint = feature("BASH_CLASSIFIER") ? `To allow this type of action in the future, the user can add a permission rule like ` + `Bash(prompt: <description of allowed action>) to their settings. ` + `At the end of your session, recommend what permission rules to add so you don't get blocked again.` : `To allow this type of action in the future, the user can add a Bash permission rule to their settings.`;
333892
333941
  return `${prefix}${reason}. ` + `If you have other tasks that don't depend on this action, continue working on those. ` + `${DENIAL_WORKAROUND_GUIDANCE2} ` + ruleHint;
333893
333942
  }
333943
+ function buildYoloRejectionMessageWithRetry(reason) {
333944
+ return buildYoloRejectionMessage(reason) + " A PermissionDenied hook indicated this action may be retried: you may try the action again.";
333945
+ }
333894
333946
  function buildClassifierUnavailableMessage(toolName, classifierModel) {
333895
333947
  return `${classifierModel} is temporarily unavailable, so auto mode cannot determine the safety of ${toolName} right now. ` + `Wait briefly and then try this action again. ` + `If it keeps failing, continue with other tasks that don't require this action and come back to it later. ` + `Note: reading files, searching code, and other read-only operations do not require the classifier and can still be used.`;
333896
333948
  }
@@ -335809,7 +335861,7 @@ ${skill.content}`).join(`
335809
335861
  `);
335810
335862
  return wrapMessagesInSystemReminder([
335811
335863
  createUserMessage2({
335812
- content: `The following skills were invoked in this session. Continue to follow these guidelines:
335864
+ content: `The following skills were previously invoked in this session (their content is re-surfaced here after compaction). They are provided for context only — do not re-execute these skills or perform their one-time setup actions (e.g., scheduling, creating files) again. Continue to apply their ongoing guidelines where still relevant:
335813
335865
 
335814
335866
  ${skillsContent}`,
335815
335867
  isMeta: true
@@ -337877,6 +337929,24 @@ async function runPermissionRequestHooksForHeadlessAgent(tool, input, toolUseID,
337877
337929
  }
337878
337930
  return null;
337879
337931
  }
337932
+ async function runPermissionDeniedHooks(tool, input, toolUseID, reason, context, permissionMode) {
337933
+ let retry = false;
337934
+ try {
337935
+ for await (const hookResult of executePermissionDeniedHooks(tool.name, toolUseID, input, reason, context, permissionMode, context.abortController.signal)) {
337936
+ if (hookResult.retry) {
337937
+ retry = true;
337938
+ }
337939
+ }
337940
+ } catch (error) {
337941
+ logError3(new Error("PermissionDenied hook failed", {
337942
+ cause: toError2(error)
337943
+ }));
337944
+ }
337945
+ if (retry) {
337946
+ logForDebugging3("PermissionDenied hook set retry=true; rejection carries retry guidance", { level: "info" });
337947
+ }
337948
+ return retry;
337949
+ }
337880
337950
  function persistDenialState(context, newState) {
337881
337951
  if (context.localDenialTracking) {
337882
337952
  Object.assign(context.localDenialTracking, newState);
@@ -338289,6 +338359,7 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
338289
338359
  if (classifierResult.unavailable) {
338290
338360
  if (getFeatureValue_CACHED_WITH_REFRESH("atlas_iron_gate_closed", true, CLASSIFIER_FAIL_CLOSED_REFRESH_MS)) {
338291
338361
  logForDebugging3("Auto mode classifier unavailable, denying with retry guidance (fail closed)", { level: "warn" });
338362
+ await runPermissionDeniedHooks(tool, input, toolUseID, "Classifier unavailable", context, appState.toolPermissionContext.mode);
338292
338363
  return {
338293
338364
  behavior: "deny",
338294
338365
  decisionReason: {
@@ -338307,9 +338378,11 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
338307
338378
  logForDebugging3(`Auto mode classifier blocked action: ${classifierResult.reason}`, { level: "warn" });
338308
338379
  const denialLimitResult = handleDenialLimitExceeded(newDenialState, appState, classifierResult.reason, assistantMessage, tool, result, context);
338309
338380
  if (denialLimitResult) {
338381
+ await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
338310
338382
  return denialLimitResult;
338311
338383
  }
338312
338384
  if (appState.toolPermissionContext.shouldAvoidPermissionPrompts) {
338385
+ const deniedRetry = await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
338313
338386
  return {
338314
338387
  behavior: "deny",
338315
338388
  decisionReason: {
@@ -338317,9 +338390,10 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
338317
338390
  classifier: "auto-mode",
338318
338391
  reason: classifierResult.reason
338319
338392
  },
338320
- message: buildYoloRejectionMessage(classifierResult.reason)
338393
+ message: deniedRetry ? buildYoloRejectionMessageWithRetry(classifierResult.reason) : buildYoloRejectionMessage(classifierResult.reason)
338321
338394
  };
338322
338395
  }
338396
+ await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
338323
338397
  return {
338324
338398
  ...result,
338325
338399
  decisionReason: {
@@ -347650,6 +347724,13 @@ async function compactViaReactive(messages, context, customInstructions, reactiv
347650
347724
  executePreCompactHooks({ trigger: "manual", customInstructions: customInstructions || null }, context.abortController.signal),
347651
347725
  getCacheSharingParams(context, messages)
347652
347726
  ]);
347727
+ if (hookResult.blocked) {
347728
+ const skipReason = hookResult.blockingReason ?? "PreCompact hook blocked compaction";
347729
+ return {
347730
+ type: "text",
347731
+ value: source_default.dim(`Compaction skipped: PreCompact hook blocked (${skipReason})`)
347732
+ };
347733
+ }
347653
347734
  const mergedInstructions = mergeHookInstructions(customInstructions, hookResult.newCustomInstructions);
347654
347735
  context.setStreamMode?.("requesting");
347655
347736
  context.setResponseLength?.(() => 0);
@@ -347753,6 +347834,12 @@ var reactiveCompact, call9 = async (args, context) => {
347753
347834
  const microcompactResult = await microcompactMessages(messages, context);
347754
347835
  const messagesForCompact = microcompactResult.messages;
347755
347836
  const result = await compactConversation(messagesForCompact, context, await getCacheSharingParams(context, messagesForCompact), false, customInstructions, false);
347837
+ if (result.compactionSkipped) {
347838
+ return {
347839
+ type: "text",
347840
+ value: source_default.dim(`Compaction skipped: PreCompact hook blocked (${result.compactSkipReason ?? "unknown"})`)
347841
+ };
347842
+ }
347756
347843
  setLastSummarizedMessageId2(undefined);
347757
347844
  suppressCompactWarning();
347758
347845
  getUserContext.cache.clear?.();
@@ -427784,6 +427871,29 @@ async function executeHooksOutsideREPL({
427784
427871
  });
427785
427872
  return await Promise.all(hookPromises);
427786
427873
  }
427874
+ async function* executePermissionDeniedHooks(toolName, toolUseID, toolInput, reason, toolUseContext, permissionMode, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
427875
+ const appState = toolUseContext.getAppState();
427876
+ const sessionId = toolUseContext.agentId ?? getSessionId();
427877
+ if (!hasHookForEvent("PermissionDenied", appState, sessionId)) {
427878
+ return;
427879
+ }
427880
+ const hookInput = {
427881
+ ...createBaseHookInput2(permissionMode, undefined, toolUseContext),
427882
+ hook_event_name: "PermissionDenied",
427883
+ tool_name: toolName,
427884
+ tool_input: toolInput,
427885
+ tool_use_id: toolUseID,
427886
+ reason
427887
+ };
427888
+ yield* executeHooks({
427889
+ hookInput,
427890
+ toolUseID,
427891
+ matchQuery: toolName,
427892
+ signal,
427893
+ timeoutMs,
427894
+ toolUseContext
427895
+ });
427896
+ }
427787
427897
  async function executeNotificationHooks(notificationData, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
427788
427898
  const { message, title, notificationType } = notificationData;
427789
427899
  const hookInput = {
@@ -427935,12 +428045,17 @@ async function executePreCompactHooks(compactData, signal, timeoutMs = TOOL_HOOK
427935
428045
  }
427936
428046
  }
427937
428047
  }
428048
+ const blockedResults = results.filter((r) => r.blocked);
427938
428049
  return {
427939
428050
  newCustomInstructions: successfulOutputs.length > 0 ? successfulOutputs.join(`
427940
428051
 
427941
428052
  `) : undefined,
427942
428053
  userDisplayMessage: displayMessages.length > 0 ? displayMessages.join(`
427943
- `) : undefined
428054
+ `) : undefined,
428055
+ ...blockedResults.length > 0 ? {
428056
+ blocked: true,
428057
+ blockingReason: blockedResults.map((r) => r.systemMessage?.trim() || r.output.trim() || `PreCompact hook '${r.command}' blocked compaction`).join("; ")
428058
+ } : {}
427944
428059
  };
427945
428060
  }
427946
428061
  async function executePostCompactHooks(compactData, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
@@ -429054,6 +429169,22 @@ async function compactConversation2(messages, context, cacheSafeParams, suppress
429054
429169
  trigger: isAutoCompact ? "auto" : "manual",
429055
429170
  customInstructions: customInstructions ?? null
429056
429171
  }, context.abortController.signal);
429172
+ if (hookResult.blocked) {
429173
+ const skipReason = hookResult.blockingReason ?? "PreCompact hook blocked compaction";
429174
+ logForDebugging3(`Compact skipped: PreCompact hook blocked (${skipReason})`, { level: "warn" });
429175
+ context.setSDKStatus?.(null);
429176
+ context.onCompactProgress?.({ type: "compact_end" });
429177
+ return {
429178
+ boundaryMarker: createCompactBoundaryMessage2(isAutoCompact ? "auto" : "manual", preCompactTokenCount ?? 0, messages.at(-1)?.uuid),
429179
+ summaryMessages: [],
429180
+ attachments: [],
429181
+ hookResults: [],
429182
+ userDisplayMessage: `Compaction skipped: PreCompact hook blocked (${skipReason})`,
429183
+ preCompactTokenCount,
429184
+ compactionSkipped: true,
429185
+ compactSkipReason: skipReason
429186
+ };
429187
+ }
429057
429188
  customInstructions = mergeHookInstructions2(customInstructions, hookResult.newCustomInstructions);
429058
429189
  const userDisplayMessage = hookResult.userDisplayMessage;
429059
429190
  context.setStreamMode?.("requesting");
@@ -429221,6 +429352,22 @@ async function partialCompactConversation2(allMessages, pivotIndex, context, cac
429221
429352
  trigger: "manual",
429222
429353
  customInstructions: null
429223
429354
  }, context.abortController.signal);
429355
+ if (hookResult.blocked) {
429356
+ const skipReason = hookResult.blockingReason ?? "PreCompact hook blocked compaction";
429357
+ logForDebugging3(`Partial compact skipped: PreCompact hook blocked (${skipReason})`, { level: "warn" });
429358
+ context.setSDKStatus?.(null);
429359
+ context.onCompactProgress?.({ type: "compact_end" });
429360
+ return {
429361
+ boundaryMarker: createCompactBoundaryMessage2("manual", preCompactTokenCount ?? 0, allMessages.at(-1)?.uuid),
429362
+ summaryMessages: [],
429363
+ attachments: [],
429364
+ hookResults: [],
429365
+ userDisplayMessage: `Compaction skipped: PreCompact hook blocked (${skipReason})`,
429366
+ preCompactTokenCount,
429367
+ compactionSkipped: true,
429368
+ compactSkipReason: skipReason
429369
+ };
429370
+ }
429224
429371
  let customInstructions;
429225
429372
  if (hookResult.newCustomInstructions && userFeedback) {
429226
429373
  customInstructions = `${hookResult.newCustomInstructions}
@@ -457165,7 +457312,14 @@ var jsx_dev_runtime378, ContextBarSegment = ({ input }) => {
457165
457312
  const used = usedContextTokens(cw);
457166
457313
  const total = cw.context_window_size;
457167
457314
  if (pct == null) {
457168
- return null;
457315
+ return /* @__PURE__ */ jsx_dev_runtime378.jsxDEV(ThemedText, {
457316
+ dimColor: true,
457317
+ children: [
457318
+ "▤ —/",
457319
+ formatK(total),
457320
+ " tok"
457321
+ ]
457322
+ }, undefined, true, undefined, this);
457169
457323
  }
457170
457324
  const color = contextColorForPercentage(pct);
457171
457325
  const modelId = input.model?.id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasharness/atlascode",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "AtlasCode \u2014 Coding Agent for the domestic computing ecosystem (Ascend NPU + domestic LLM backends)",
5
5
  "bin": {
6
6
  "atlas": "dist/cli.js",