@atlasharness/atlascode 0.1.49 → 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 +106 -10
  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() {
@@ -80222,6 +80230,22 @@ async function richCompactConversation(messages, context, cacheSafeParams, suppr
80222
80230
  trigger: isAutoCompact ? "auto" : "manual",
80223
80231
  customInstructions: customInstructions ?? null
80224
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
+ }
80225
80249
  customInstructions = mergeHookInstructions(customInstructions, hookResult.newCustomInstructions);
80226
80250
  const userDisplayMessage = hookResult.userDisplayMessage;
80227
80251
  context.setStreamMode?.("requesting");
@@ -81398,8 +81422,9 @@ async function queryAgentLoop(deps, args) {
81398
81422
  let recovered;
81399
81423
  try {
81400
81424
  const result = await deps.reactiveCompact({ messages, turn: turns });
81401
- if (result)
81425
+ if (result && !result.compactionSkipped) {
81402
81426
  recovered = buildPostCompactMessages(result);
81427
+ }
81403
81428
  } catch (compactErr) {
81404
81429
  logForDebugging(`[reactive-compact] consumer failed: ${errorMessage(compactErr)}`);
81405
81430
  }
@@ -124058,11 +124083,31 @@ var init_settings3 = __esm(() => {
124058
124083
  });
124059
124084
 
124060
124085
  // src/tui/bootstrapState.ts
124061
- 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 = () => {
124062
124107
  const settings = getSettings_DEPRECATED() || {};
124063
124108
  const defaultRole = settings.defaultRole || "small";
124064
124109
  return getRoleModel(defaultRole) ?? null;
124065
- }, 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 = () => {
124066
124111
  _turnClassifierDurationMs = 0;
124067
124112
  _turnClassifierCount = 0;
124068
124113
  }, resetTurnHookDuration = () => {
@@ -124089,6 +124134,7 @@ var init_bootstrapState = __esm(() => {
124089
124134
  init_modelprovider2();
124090
124135
  _spSectionCache = new Map;
124091
124136
  _agentColorMap = new Map;
124137
+ _invokedSkillsByAgent = new Map;
124092
124138
  _activeTimeCounter = {
124093
124139
  add: (_v, _tags) => {},
124094
124140
  observe: (_v, _tags) => {},
@@ -335815,7 +335861,7 @@ ${skill.content}`).join(`
335815
335861
  `);
335816
335862
  return wrapMessagesInSystemReminder([
335817
335863
  createUserMessage2({
335818
- 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:
335819
335865
 
335820
335866
  ${skillsContent}`,
335821
335867
  isMeta: true
@@ -347678,6 +347724,13 @@ async function compactViaReactive(messages, context, customInstructions, reactiv
347678
347724
  executePreCompactHooks({ trigger: "manual", customInstructions: customInstructions || null }, context.abortController.signal),
347679
347725
  getCacheSharingParams(context, messages)
347680
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
+ }
347681
347734
  const mergedInstructions = mergeHookInstructions(customInstructions, hookResult.newCustomInstructions);
347682
347735
  context.setStreamMode?.("requesting");
347683
347736
  context.setResponseLength?.(() => 0);
@@ -347781,6 +347834,12 @@ var reactiveCompact, call9 = async (args, context) => {
347781
347834
  const microcompactResult = await microcompactMessages(messages, context);
347782
347835
  const messagesForCompact = microcompactResult.messages;
347783
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
+ }
347784
347843
  setLastSummarizedMessageId2(undefined);
347785
347844
  suppressCompactWarning();
347786
347845
  getUserContext.cache.clear?.();
@@ -427986,12 +428045,17 @@ async function executePreCompactHooks(compactData, signal, timeoutMs = TOOL_HOOK
427986
428045
  }
427987
428046
  }
427988
428047
  }
428048
+ const blockedResults = results.filter((r) => r.blocked);
427989
428049
  return {
427990
428050
  newCustomInstructions: successfulOutputs.length > 0 ? successfulOutputs.join(`
427991
428051
 
427992
428052
  `) : undefined,
427993
428053
  userDisplayMessage: displayMessages.length > 0 ? displayMessages.join(`
427994
- `) : 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
+ } : {}
427995
428059
  };
427996
428060
  }
427997
428061
  async function executePostCompactHooks(compactData, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
@@ -429105,6 +429169,22 @@ async function compactConversation2(messages, context, cacheSafeParams, suppress
429105
429169
  trigger: isAutoCompact ? "auto" : "manual",
429106
429170
  customInstructions: customInstructions ?? null
429107
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
+ }
429108
429188
  customInstructions = mergeHookInstructions2(customInstructions, hookResult.newCustomInstructions);
429109
429189
  const userDisplayMessage = hookResult.userDisplayMessage;
429110
429190
  context.setStreamMode?.("requesting");
@@ -429272,6 +429352,22 @@ async function partialCompactConversation2(allMessages, pivotIndex, context, cac
429272
429352
  trigger: "manual",
429273
429353
  customInstructions: null
429274
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
+ }
429275
429371
  let customInstructions;
429276
429372
  if (hookResult.newCustomInstructions && userFeedback) {
429277
429373
  customInstructions = `${hookResult.newCustomInstructions}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasharness/atlascode",
3
- "version": "0.1.49",
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",