@atlasharness/atlascode 0.1.24 → 0.1.26
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 +90 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -45912,7 +45912,7 @@ var init_bashCommandHelpers = __esm(() => {
|
|
|
45912
45912
|
// src/engine/tools/bash/bashReadOnly.ts
|
|
45913
45913
|
function isReadOnlyCommand(command) {
|
|
45914
45914
|
const trimmed = command.trim();
|
|
45915
|
-
if (trimmed.includes("&&") || trimmed.includes("||") || trimmed.includes(";") || trimmed.includes("|") || trimmed.includes("`") || trimmed.includes("$(")) {
|
|
45915
|
+
if (trimmed.includes("&&") || trimmed.includes("||") || trimmed.includes(";") || trimmed.includes("|") || trimmed.includes("`") || trimmed.includes("$(") || trimmed.includes(">")) {
|
|
45916
45916
|
return false;
|
|
45917
45917
|
}
|
|
45918
45918
|
return READ_ONLY_PREFIXES.some((p) => trimmed === p || trimmed.startsWith(p + " "));
|
|
@@ -46479,11 +46479,15 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
46479
46479
|
decisionReason
|
|
46480
46480
|
};
|
|
46481
46481
|
}
|
|
46482
|
+
const effectiveDecisionReason = decisionReason ?? {
|
|
46483
|
+
type: "other",
|
|
46484
|
+
reason: `${command} target '${resolvedPath}' requires manual approval`
|
|
46485
|
+
};
|
|
46482
46486
|
return {
|
|
46483
46487
|
behavior: "ask",
|
|
46484
46488
|
message,
|
|
46485
46489
|
blockedPath: resolvedPath,
|
|
46486
|
-
decisionReason
|
|
46490
|
+
decisionReason: effectiveDecisionReason
|
|
46487
46491
|
};
|
|
46488
46492
|
}
|
|
46489
46493
|
}
|
|
@@ -46619,11 +46623,15 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
46619
46623
|
decisionReason
|
|
46620
46624
|
};
|
|
46621
46625
|
}
|
|
46626
|
+
const effectiveDecisionReason = decisionReason ?? {
|
|
46627
|
+
type: "other",
|
|
46628
|
+
reason: `Output redirection target '${resolvedPath}' requires manual approval`
|
|
46629
|
+
};
|
|
46622
46630
|
return {
|
|
46623
46631
|
behavior: "ask",
|
|
46624
46632
|
message,
|
|
46625
46633
|
blockedPath: resolvedPath,
|
|
46626
|
-
decisionReason,
|
|
46634
|
+
decisionReason: effectiveDecisionReason,
|
|
46627
46635
|
suggestions: [
|
|
46628
46636
|
{
|
|
46629
46637
|
type: "addDirectories",
|
|
@@ -51973,7 +51981,11 @@ function createPermissionGate(context, opts = {}) {
|
|
|
51973
51981
|
return async (tool, input) => {
|
|
51974
51982
|
const decision = await hasPermissionsToUseTool(tool, input ?? {}, { getToolPermissionContext: () => context, getAppState: opts.getAppState });
|
|
51975
51983
|
if (decision.behavior === "allow") {
|
|
51976
|
-
return {
|
|
51984
|
+
return {
|
|
51985
|
+
allowed: true,
|
|
51986
|
+
updatedInput: decision.updatedInput,
|
|
51987
|
+
decisionReason: decision.decisionReason
|
|
51988
|
+
};
|
|
51977
51989
|
}
|
|
51978
51990
|
if (decision.behavior === "deny") {
|
|
51979
51991
|
return { allowed: false, reason: decision.message };
|
|
@@ -178701,6 +178713,7 @@ __export(exports_engineCompat, {
|
|
|
178701
178713
|
backgroundAgentTask: () => backgroundAgentTask,
|
|
178702
178714
|
backgroundAll: () => backgroundAll,
|
|
178703
178715
|
backgroundExistingForegroundTask: () => backgroundExistingForegroundTask,
|
|
178716
|
+
bashToolHasPermission: () => bashToolHasPermission,
|
|
178704
178717
|
blockTask: () => blockTask,
|
|
178705
178718
|
buildChildMessage: () => buildChildMessage,
|
|
178706
178719
|
buildConversationChain: () => buildConversationChain,
|
|
@@ -269654,8 +269667,12 @@ function successCardRenderMode(renderedMessage, userApproved) {
|
|
|
269654
269667
|
return "full";
|
|
269655
269668
|
return userApproved ? "marker" : "skip";
|
|
269656
269669
|
}
|
|
269670
|
+
function hasSuccessCardMarker(allowVerdictLine, yoloReason, classifierRule) {
|
|
269671
|
+
return allowVerdictLine !== null || feature("TRANSCRIPT_CLASSIFIER") && yoloReason !== undefined || feature("BASH_CLASSIFIER") && classifierRule !== undefined;
|
|
269672
|
+
}
|
|
269657
269673
|
var VERDICT_PREFIX = "Verdict";
|
|
269658
269674
|
var init_permissionVerdict = __esm(() => {
|
|
269675
|
+
init_shared();
|
|
269659
269676
|
init_constants5();
|
|
269660
269677
|
init_permissionRuleParser2();
|
|
269661
269678
|
init_PermissionMode();
|
|
@@ -269676,6 +269693,21 @@ var init_userApprovals = __esm(() => {
|
|
|
269676
269693
|
USER_APPROVALS = new Map;
|
|
269677
269694
|
});
|
|
269678
269695
|
|
|
269696
|
+
// src/tui/utils/allowVerdicts.ts
|
|
269697
|
+
function setAllowVerdict(toolUseID, verdict) {
|
|
269698
|
+
ALLOW_VERDICTS.set(toolUseID, verdict);
|
|
269699
|
+
}
|
|
269700
|
+
function getAllowVerdict(toolUseID) {
|
|
269701
|
+
return ALLOW_VERDICTS.get(toolUseID);
|
|
269702
|
+
}
|
|
269703
|
+
function deleteAllowVerdict(toolUseID) {
|
|
269704
|
+
ALLOW_VERDICTS.delete(toolUseID);
|
|
269705
|
+
}
|
|
269706
|
+
var ALLOW_VERDICTS;
|
|
269707
|
+
var init_allowVerdicts = __esm(() => {
|
|
269708
|
+
ALLOW_VERDICTS = new Map;
|
|
269709
|
+
});
|
|
269710
|
+
|
|
269679
269711
|
// src/tui/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx
|
|
269680
269712
|
function UserToolSuccessMessage({
|
|
269681
269713
|
message,
|
|
@@ -269693,9 +269725,11 @@ function UserToolSuccessMessage({
|
|
|
269693
269725
|
const [classifierRule] = React32.useState(() => getClassifierApproval2(toolUseID));
|
|
269694
269726
|
const [yoloReason] = React32.useState(() => getYoloClassifierApproval2(toolUseID));
|
|
269695
269727
|
const [userApproved] = React32.useState(() => getUserApproval(toolUseID));
|
|
269728
|
+
const [allowVerdict] = React32.useState(() => getAllowVerdict(toolUseID));
|
|
269696
269729
|
React32.useEffect(() => {
|
|
269697
269730
|
deleteClassifierApproval2(toolUseID);
|
|
269698
269731
|
deleteUserApproval(toolUseID);
|
|
269732
|
+
deleteAllowVerdict(toolUseID);
|
|
269699
269733
|
}, [toolUseID]);
|
|
269700
269734
|
if (!message.toolUseResult || !tool) {
|
|
269701
269735
|
return null;
|
|
@@ -269713,8 +269747,19 @@ function UserToolSuccessMessage({
|
|
|
269713
269747
|
isTranscriptMode,
|
|
269714
269748
|
input: lookups.toolUseByToolUseID.get(toolUseID)?.input
|
|
269715
269749
|
}) ?? null;
|
|
269750
|
+
let allowVerdictLine = null;
|
|
269751
|
+
if (allowVerdict) {
|
|
269752
|
+
const vReason = allowVerdict.reason;
|
|
269753
|
+
const vMode = allowVerdict.mode;
|
|
269754
|
+
if (vMode === "bypassPermissions") {
|
|
269755
|
+
allowVerdictLine = verdictLine({ type: "other", reason: "" }, "bypassPermissions", tool.name);
|
|
269756
|
+
} else if (vReason?.type === "rule" && vReason.rule.ruleBehavior === "allow") {
|
|
269757
|
+
allowVerdictLine = verdictLine(vReason, vMode, tool.name);
|
|
269758
|
+
}
|
|
269759
|
+
}
|
|
269760
|
+
const hasMarkerLine = hasSuccessCardMarker(allowVerdictLine, yoloReason, classifierRule);
|
|
269716
269761
|
const renderMode = successCardRenderMode(renderedMessage, userApproved);
|
|
269717
|
-
if (renderMode === "skip") {
|
|
269762
|
+
if (renderMode === "skip" && !hasMarkerLine) {
|
|
269718
269763
|
return null;
|
|
269719
269764
|
}
|
|
269720
269765
|
const rendersAsAssistantText = tool.userFacingName(undefined) === "";
|
|
@@ -269745,8 +269790,9 @@ function UserToolSuccessMessage({
|
|
|
269745
269790
|
children: /* @__PURE__ */ jsx_dev_runtime103.jsxDEV(ThemedText, {
|
|
269746
269791
|
dimColor: true,
|
|
269747
269792
|
children: [
|
|
269748
|
-
"
|
|
269749
|
-
yoloReason
|
|
269793
|
+
"Auto-approved by classifier: ",
|
|
269794
|
+
yoloReason,
|
|
269795
|
+
"."
|
|
269750
269796
|
]
|
|
269751
269797
|
}, undefined, true, undefined, this)
|
|
269752
269798
|
}, undefined, false, undefined, this) : null,
|
|
@@ -269762,6 +269808,13 @@ function UserToolSuccessMessage({
|
|
|
269762
269808
|
" Allowed · your decision"
|
|
269763
269809
|
]
|
|
269764
269810
|
}, undefined, true, undefined, this)
|
|
269811
|
+
}, undefined, false, undefined, this),
|
|
269812
|
+
allowVerdictLine && /* @__PURE__ */ jsx_dev_runtime103.jsxDEV(MessageResponse, {
|
|
269813
|
+
height: 1,
|
|
269814
|
+
children: /* @__PURE__ */ jsx_dev_runtime103.jsxDEV(ThemedText, {
|
|
269815
|
+
dimColor: true,
|
|
269816
|
+
children: allowVerdictLine
|
|
269817
|
+
}, undefined, false, undefined, this)
|
|
269765
269818
|
}, undefined, false, undefined, this)
|
|
269766
269819
|
]
|
|
269767
269820
|
}, undefined, true, undefined, this),
|
|
@@ -269787,6 +269840,7 @@ var init_UserToolSuccessMessage = __esm(() => {
|
|
|
269787
269840
|
init_classifierApprovals();
|
|
269788
269841
|
init_permissionVerdict();
|
|
269789
269842
|
init_userApprovals();
|
|
269843
|
+
init_allowVerdicts();
|
|
269790
269844
|
init_MessageResponse();
|
|
269791
269845
|
init_HookProgressMessage();
|
|
269792
269846
|
React32 = __toESM(require_react(), 1);
|
|
@@ -319339,8 +319393,19 @@ function buildInteractiveGate(params) {
|
|
|
319339
319393
|
});
|
|
319340
319394
|
return async (tool, input, callContext) => {
|
|
319341
319395
|
const verdict = await engineGate(tool, input);
|
|
319342
|
-
if (!verdict.ask)
|
|
319396
|
+
if (!verdict.ask) {
|
|
319397
|
+
if (verdict.allowed && verdict.decisionReason) {
|
|
319398
|
+
const tpc = (params.getAppState?.() ?? {
|
|
319399
|
+
toolPermissionContext: params.toolPermissionContext
|
|
319400
|
+
}).toolPermissionContext;
|
|
319401
|
+
const tpcMode = tpc?.mode ?? "default";
|
|
319402
|
+
setAllowVerdict(callContext?.toolUseId ?? "", {
|
|
319403
|
+
reason: verdict.decisionReason,
|
|
319404
|
+
mode: tpcMode
|
|
319405
|
+
});
|
|
319406
|
+
}
|
|
319343
319407
|
return verdict;
|
|
319408
|
+
}
|
|
319344
319409
|
const decision = await params.canUseTool(tool, input ?? {}, params.toolUseContext, callContext?.assistantMessage, callContext?.toolUseId ?? "");
|
|
319345
319410
|
if (decision.behavior === "allow") {
|
|
319346
319411
|
return { allowed: true, updatedInput: decision.updatedInput };
|
|
@@ -319350,6 +319415,7 @@ function buildInteractiveGate(params) {
|
|
|
319350
319415
|
}
|
|
319351
319416
|
var init_loopPermissionBridge = __esm(() => {
|
|
319352
319417
|
init_engine();
|
|
319418
|
+
init_allowVerdicts();
|
|
319353
319419
|
});
|
|
319354
319420
|
|
|
319355
319421
|
// src/tui/agentLoopDeps.ts
|
|
@@ -322691,8 +322757,16 @@ var init_BashTool = __esm(() => {
|
|
|
322691
322757
|
async prompt() {
|
|
322692
322758
|
return getSimplePrompt2();
|
|
322693
322759
|
},
|
|
322694
|
-
async checkPermissions(input) {
|
|
322695
|
-
|
|
322760
|
+
async checkPermissions(input, context) {
|
|
322761
|
+
const ctx = context;
|
|
322762
|
+
const mode = ctx?.getAppState?.()?.toolPermissionContext?.mode ?? ctx?.getToolPermissionContext?.()?.mode;
|
|
322763
|
+
if (mode === "auto") {
|
|
322764
|
+
return {
|
|
322765
|
+
behavior: "passthrough",
|
|
322766
|
+
message: "Bash command in auto mode requires confirmation"
|
|
322767
|
+
};
|
|
322768
|
+
}
|
|
322769
|
+
return bashToolHasPermission(input, context);
|
|
322696
322770
|
},
|
|
322697
322771
|
renderToolUseMessage: renderToolUseMessage25,
|
|
322698
322772
|
mapToolResultToToolResultBlockParam: BashTool.mapToolResultToToolResultBlockParam,
|
|
@@ -465848,6 +465922,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
|
|
|
465848
465922
|
if (feature("TRANSCRIPT_CLASSIFIER") && result.decisionReason?.type === "classifier" && result.decisionReason.classifier === "auto-mode") {
|
|
465849
465923
|
setYoloClassifierApproval2(toolUseID, result.decisionReason.reason);
|
|
465850
465924
|
}
|
|
465925
|
+
const allowAppState = toolUseContext.getAppState();
|
|
465926
|
+
setAllowVerdict(toolUseID, {
|
|
465927
|
+
reason: result.decisionReason,
|
|
465928
|
+
mode: allowAppState.toolPermissionContext?.mode ?? "default"
|
|
465929
|
+
});
|
|
465851
465930
|
ctx.logDecision({
|
|
465852
465931
|
decision: "accept",
|
|
465853
465932
|
source: "config"
|
|
@@ -466031,6 +466110,7 @@ var init_useCanUseTool = __esm(() => {
|
|
|
466031
466110
|
init_PermissionContext();
|
|
466032
466111
|
init_permissionLogging();
|
|
466033
466112
|
init_decisionLog();
|
|
466113
|
+
init_allowVerdicts();
|
|
466034
466114
|
import_compiler_runtime303 = __toESM(require_compiler_runtime(), 1);
|
|
466035
466115
|
jsx_dev_runtime404 = __toESM(require_jsx_dev_runtime(), 1);
|
|
466036
466116
|
useCanUseTool_default = useCanUseTool;
|
package/package.json
CHANGED