@atlasharness/atlascode 0.1.48 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +66 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -55323,6 +55323,9 @@ function createSandboxManager(deps, backend) {
|
|
|
55323
55323
|
const allowedDomains = [
|
|
55324
55324
|
...s?.sandbox?.network?.allowedDomains || []
|
|
55325
55325
|
];
|
|
55326
|
+
const deniedDomains = [
|
|
55327
|
+
...s?.sandbox?.network?.deniedDomains || []
|
|
55328
|
+
];
|
|
55326
55329
|
const allowWrite = [".", deps.getAtlasTempDir()];
|
|
55327
55330
|
const denyWrite = [];
|
|
55328
55331
|
const denyRead = [];
|
|
@@ -55375,7 +55378,7 @@ function createSandboxManager(deps, backend) {
|
|
|
55375
55378
|
return {
|
|
55376
55379
|
network: {
|
|
55377
55380
|
allowedDomains,
|
|
55378
|
-
deniedDomains
|
|
55381
|
+
deniedDomains,
|
|
55379
55382
|
allowUnixSockets: s?.sandbox?.network?.allowUnixSockets,
|
|
55380
55383
|
allowAllUnixSockets: s?.sandbox?.network?.allowAllUnixSockets,
|
|
55381
55384
|
allowLocalBinding: s?.sandbox?.network?.allowLocalBinding,
|
|
@@ -55621,7 +55624,6 @@ var init_createSandboxManager = __esm(() => {
|
|
|
55621
55624
|
init_sandbox_backend();
|
|
55622
55625
|
init_ripgrep();
|
|
55623
55626
|
});
|
|
55624
|
-
|
|
55625
55627
|
// src/sandbox/index.ts
|
|
55626
55628
|
var init_sandbox = __esm(() => {
|
|
55627
55629
|
init_config4();
|
|
@@ -80597,7 +80599,7 @@ var init_autoCompactWindow = __esm(() => {
|
|
|
80597
80599
|
// src/engine/context/autoCompact.ts
|
|
80598
80600
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
80599
80601
|
function resolveModelContextWindow(model) {
|
|
80600
|
-
return getProviderContextWindow(model) ??
|
|
80602
|
+
return getProviderContextWindow(model) ?? HARD_DEFAULT_CONTEXT_WINDOW;
|
|
80601
80603
|
}
|
|
80602
80604
|
function setAutoCompactSettingsSource(next) {
|
|
80603
80605
|
autoCompactSettingsSource = next;
|
|
@@ -80750,7 +80752,7 @@ async function autoCompactIfNeeded(messages, tracking, deps) {
|
|
|
80750
80752
|
};
|
|
80751
80753
|
}
|
|
80752
80754
|
}
|
|
80753
|
-
var AUTOCOMPACT_BUFFER_TOKENS = 13000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3,
|
|
80755
|
+
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
80756
|
var init_autoCompact = __esm(() => {
|
|
80755
80757
|
init_modelprovider2();
|
|
80756
80758
|
init_config();
|
|
@@ -214569,7 +214571,7 @@ function getContextWindowForModel(model, betas) {
|
|
|
214569
214571
|
if (providerCtx !== undefined) {
|
|
214570
214572
|
return providerCtx;
|
|
214571
214573
|
}
|
|
214572
|
-
return
|
|
214574
|
+
return MODEL_CONTEXT_WINDOW_DEFAULT;
|
|
214573
214575
|
}
|
|
214574
214576
|
function calculateContextPercentages(currentUsage, contextWindowSize) {
|
|
214575
214577
|
if (!currentUsage) {
|
|
@@ -214593,9 +214595,10 @@ function getModelMaxOutputTokens(model) {
|
|
|
214593
214595
|
upperLimit: MAX_OUTPUT_TOKENS_UPPER_LIMIT
|
|
214594
214596
|
};
|
|
214595
214597
|
}
|
|
214596
|
-
var
|
|
214598
|
+
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
214599
|
var init_context2 = __esm(() => {
|
|
214598
214600
|
init_modelprovider2();
|
|
214601
|
+
MODEL_CONTEXT_WINDOW_DEFAULT = HARD_DEFAULT_CONTEXT_WINDOW;
|
|
214599
214602
|
});
|
|
214600
214603
|
|
|
214601
214604
|
// src/tui/cost-tracker.ts
|
|
@@ -333891,6 +333894,9 @@ function buildYoloRejectionMessage(reason) {
|
|
|
333891
333894
|
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
333895
|
return `${prefix}${reason}. ` + `If you have other tasks that don't depend on this action, continue working on those. ` + `${DENIAL_WORKAROUND_GUIDANCE2} ` + ruleHint;
|
|
333893
333896
|
}
|
|
333897
|
+
function buildYoloRejectionMessageWithRetry(reason) {
|
|
333898
|
+
return buildYoloRejectionMessage(reason) + " A PermissionDenied hook indicated this action may be retried: you may try the action again.";
|
|
333899
|
+
}
|
|
333894
333900
|
function buildClassifierUnavailableMessage(toolName, classifierModel) {
|
|
333895
333901
|
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
333902
|
}
|
|
@@ -337877,6 +337883,24 @@ async function runPermissionRequestHooksForHeadlessAgent(tool, input, toolUseID,
|
|
|
337877
337883
|
}
|
|
337878
337884
|
return null;
|
|
337879
337885
|
}
|
|
337886
|
+
async function runPermissionDeniedHooks(tool, input, toolUseID, reason, context, permissionMode) {
|
|
337887
|
+
let retry = false;
|
|
337888
|
+
try {
|
|
337889
|
+
for await (const hookResult of executePermissionDeniedHooks(tool.name, toolUseID, input, reason, context, permissionMode, context.abortController.signal)) {
|
|
337890
|
+
if (hookResult.retry) {
|
|
337891
|
+
retry = true;
|
|
337892
|
+
}
|
|
337893
|
+
}
|
|
337894
|
+
} catch (error) {
|
|
337895
|
+
logError3(new Error("PermissionDenied hook failed", {
|
|
337896
|
+
cause: toError2(error)
|
|
337897
|
+
}));
|
|
337898
|
+
}
|
|
337899
|
+
if (retry) {
|
|
337900
|
+
logForDebugging3("PermissionDenied hook set retry=true; rejection carries retry guidance", { level: "info" });
|
|
337901
|
+
}
|
|
337902
|
+
return retry;
|
|
337903
|
+
}
|
|
337880
337904
|
function persistDenialState(context, newState) {
|
|
337881
337905
|
if (context.localDenialTracking) {
|
|
337882
337906
|
Object.assign(context.localDenialTracking, newState);
|
|
@@ -338289,6 +338313,7 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338289
338313
|
if (classifierResult.unavailable) {
|
|
338290
338314
|
if (getFeatureValue_CACHED_WITH_REFRESH("atlas_iron_gate_closed", true, CLASSIFIER_FAIL_CLOSED_REFRESH_MS)) {
|
|
338291
338315
|
logForDebugging3("Auto mode classifier unavailable, denying with retry guidance (fail closed)", { level: "warn" });
|
|
338316
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, "Classifier unavailable", context, appState.toolPermissionContext.mode);
|
|
338292
338317
|
return {
|
|
338293
338318
|
behavior: "deny",
|
|
338294
338319
|
decisionReason: {
|
|
@@ -338307,9 +338332,11 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338307
338332
|
logForDebugging3(`Auto mode classifier blocked action: ${classifierResult.reason}`, { level: "warn" });
|
|
338308
338333
|
const denialLimitResult = handleDenialLimitExceeded(newDenialState, appState, classifierResult.reason, assistantMessage, tool, result, context);
|
|
338309
338334
|
if (denialLimitResult) {
|
|
338335
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338310
338336
|
return denialLimitResult;
|
|
338311
338337
|
}
|
|
338312
338338
|
if (appState.toolPermissionContext.shouldAvoidPermissionPrompts) {
|
|
338339
|
+
const deniedRetry = await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338313
338340
|
return {
|
|
338314
338341
|
behavior: "deny",
|
|
338315
338342
|
decisionReason: {
|
|
@@ -338317,9 +338344,10 @@ var classifierDecisionModule, autoModeStateModule3, CLASSIFIER_FAIL_CLOSED_REFRE
|
|
|
338317
338344
|
classifier: "auto-mode",
|
|
338318
338345
|
reason: classifierResult.reason
|
|
338319
338346
|
},
|
|
338320
|
-
message: buildYoloRejectionMessage(classifierResult.reason)
|
|
338347
|
+
message: deniedRetry ? buildYoloRejectionMessageWithRetry(classifierResult.reason) : buildYoloRejectionMessage(classifierResult.reason)
|
|
338321
338348
|
};
|
|
338322
338349
|
}
|
|
338350
|
+
await runPermissionDeniedHooks(tool, input, toolUseID, classifierResult.reason, context, appState.toolPermissionContext.mode);
|
|
338323
338351
|
return {
|
|
338324
338352
|
...result,
|
|
338325
338353
|
decisionReason: {
|
|
@@ -427784,6 +427812,29 @@ async function executeHooksOutsideREPL({
|
|
|
427784
427812
|
});
|
|
427785
427813
|
return await Promise.all(hookPromises);
|
|
427786
427814
|
}
|
|
427815
|
+
async function* executePermissionDeniedHooks(toolName, toolUseID, toolInput, reason, toolUseContext, permissionMode, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
427816
|
+
const appState = toolUseContext.getAppState();
|
|
427817
|
+
const sessionId = toolUseContext.agentId ?? getSessionId();
|
|
427818
|
+
if (!hasHookForEvent("PermissionDenied", appState, sessionId)) {
|
|
427819
|
+
return;
|
|
427820
|
+
}
|
|
427821
|
+
const hookInput = {
|
|
427822
|
+
...createBaseHookInput2(permissionMode, undefined, toolUseContext),
|
|
427823
|
+
hook_event_name: "PermissionDenied",
|
|
427824
|
+
tool_name: toolName,
|
|
427825
|
+
tool_input: toolInput,
|
|
427826
|
+
tool_use_id: toolUseID,
|
|
427827
|
+
reason
|
|
427828
|
+
};
|
|
427829
|
+
yield* executeHooks({
|
|
427830
|
+
hookInput,
|
|
427831
|
+
toolUseID,
|
|
427832
|
+
matchQuery: toolName,
|
|
427833
|
+
signal,
|
|
427834
|
+
timeoutMs,
|
|
427835
|
+
toolUseContext
|
|
427836
|
+
});
|
|
427837
|
+
}
|
|
427787
427838
|
async function executeNotificationHooks(notificationData, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
427788
427839
|
const { message, title, notificationType } = notificationData;
|
|
427789
427840
|
const hookInput = {
|
|
@@ -457165,7 +457216,14 @@ var jsx_dev_runtime378, ContextBarSegment = ({ input }) => {
|
|
|
457165
457216
|
const used = usedContextTokens(cw);
|
|
457166
457217
|
const total = cw.context_window_size;
|
|
457167
457218
|
if (pct == null) {
|
|
457168
|
-
return
|
|
457219
|
+
return /* @__PURE__ */ jsx_dev_runtime378.jsxDEV(ThemedText, {
|
|
457220
|
+
dimColor: true,
|
|
457221
|
+
children: [
|
|
457222
|
+
"▤ —/",
|
|
457223
|
+
formatK(total),
|
|
457224
|
+
" tok"
|
|
457225
|
+
]
|
|
457226
|
+
}, undefined, true, undefined, this);
|
|
457169
457227
|
}
|
|
457170
457228
|
const color = contextColorForPercentage(pct);
|
|
457171
457229
|
const modelId = input.model?.id;
|
package/package.json
CHANGED