@atlasharness/atlascode 0.1.25 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +78 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -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 { allowed: true, updatedInput: decision.updatedInput };
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 };
@@ -269655,8 +269667,12 @@ function successCardRenderMode(renderedMessage, userApproved) {
269655
269667
  return "full";
269656
269668
  return userApproved ? "marker" : "skip";
269657
269669
  }
269670
+ function hasSuccessCardMarker(allowVerdictLine, yoloReason, classifierRule) {
269671
+ return allowVerdictLine !== null || feature("TRANSCRIPT_CLASSIFIER") && yoloReason !== undefined || feature("BASH_CLASSIFIER") && classifierRule !== undefined;
269672
+ }
269658
269673
  var VERDICT_PREFIX = "Verdict";
269659
269674
  var init_permissionVerdict = __esm(() => {
269675
+ init_shared();
269660
269676
  init_constants5();
269661
269677
  init_permissionRuleParser2();
269662
269678
  init_PermissionMode();
@@ -269677,6 +269693,21 @@ var init_userApprovals = __esm(() => {
269677
269693
  USER_APPROVALS = new Map;
269678
269694
  });
269679
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
+
269680
269711
  // src/tui/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx
269681
269712
  function UserToolSuccessMessage({
269682
269713
  message,
@@ -269694,9 +269725,11 @@ function UserToolSuccessMessage({
269694
269725
  const [classifierRule] = React32.useState(() => getClassifierApproval2(toolUseID));
269695
269726
  const [yoloReason] = React32.useState(() => getYoloClassifierApproval2(toolUseID));
269696
269727
  const [userApproved] = React32.useState(() => getUserApproval(toolUseID));
269728
+ const [allowVerdict] = React32.useState(() => getAllowVerdict(toolUseID));
269697
269729
  React32.useEffect(() => {
269698
269730
  deleteClassifierApproval2(toolUseID);
269699
269731
  deleteUserApproval(toolUseID);
269732
+ deleteAllowVerdict(toolUseID);
269700
269733
  }, [toolUseID]);
269701
269734
  if (!message.toolUseResult || !tool) {
269702
269735
  return null;
@@ -269714,8 +269747,19 @@ function UserToolSuccessMessage({
269714
269747
  isTranscriptMode,
269715
269748
  input: lookups.toolUseByToolUseID.get(toolUseID)?.input
269716
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);
269717
269761
  const renderMode = successCardRenderMode(renderedMessage, userApproved);
269718
- if (renderMode === "skip") {
269762
+ if (renderMode === "skip" && !hasMarkerLine) {
269719
269763
  return null;
269720
269764
  }
269721
269765
  const rendersAsAssistantText = tool.userFacingName(undefined) === "";
@@ -269746,8 +269790,9 @@ function UserToolSuccessMessage({
269746
269790
  children: /* @__PURE__ */ jsx_dev_runtime103.jsxDEV(ThemedText, {
269747
269791
  dimColor: true,
269748
269792
  children: [
269749
- "Allowed by auto mode classifier: ",
269750
- yoloReason
269793
+ "Auto-approved by classifier: ",
269794
+ yoloReason,
269795
+ "."
269751
269796
  ]
269752
269797
  }, undefined, true, undefined, this)
269753
269798
  }, undefined, false, undefined, this) : null,
@@ -269763,6 +269808,13 @@ function UserToolSuccessMessage({
269763
269808
  " Allowed · your decision"
269764
269809
  ]
269765
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)
269766
269818
  }, undefined, false, undefined, this)
269767
269819
  ]
269768
269820
  }, undefined, true, undefined, this),
@@ -269788,6 +269840,7 @@ var init_UserToolSuccessMessage = __esm(() => {
269788
269840
  init_classifierApprovals();
269789
269841
  init_permissionVerdict();
269790
269842
  init_userApprovals();
269843
+ init_allowVerdicts();
269791
269844
  init_MessageResponse();
269792
269845
  init_HookProgressMessage();
269793
269846
  React32 = __toESM(require_react(), 1);
@@ -319340,8 +319393,19 @@ function buildInteractiveGate(params) {
319340
319393
  });
319341
319394
  return async (tool, input, callContext) => {
319342
319395
  const verdict = await engineGate(tool, input);
319343
- 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
+ }
319344
319407
  return verdict;
319408
+ }
319345
319409
  const decision = await params.canUseTool(tool, input ?? {}, params.toolUseContext, callContext?.assistantMessage, callContext?.toolUseId ?? "");
319346
319410
  if (decision.behavior === "allow") {
319347
319411
  return { allowed: true, updatedInput: decision.updatedInput };
@@ -319351,6 +319415,7 @@ function buildInteractiveGate(params) {
319351
319415
  }
319352
319416
  var init_loopPermissionBridge = __esm(() => {
319353
319417
  init_engine();
319418
+ init_allowVerdicts();
319354
319419
  });
319355
319420
 
319356
319421
  // src/tui/agentLoopDeps.ts
@@ -465857,6 +465922,11 @@ function useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext) {
465857
465922
  if (feature("TRANSCRIPT_CLASSIFIER") && result.decisionReason?.type === "classifier" && result.decisionReason.classifier === "auto-mode") {
465858
465923
  setYoloClassifierApproval2(toolUseID, result.decisionReason.reason);
465859
465924
  }
465925
+ const allowAppState = toolUseContext.getAppState();
465926
+ setAllowVerdict(toolUseID, {
465927
+ reason: result.decisionReason,
465928
+ mode: allowAppState.toolPermissionContext?.mode ?? "default"
465929
+ });
465860
465930
  ctx.logDecision({
465861
465931
  decision: "accept",
465862
465932
  source: "config"
@@ -466040,6 +466110,7 @@ var init_useCanUseTool = __esm(() => {
466040
466110
  init_PermissionContext();
466041
466111
  init_permissionLogging();
466042
466112
  init_decisionLog();
466113
+ init_allowVerdicts();
466043
466114
  import_compiler_runtime303 = __toESM(require_compiler_runtime(), 1);
466044
466115
  jsx_dev_runtime404 = __toESM(require_jsx_dev_runtime(), 1);
466045
466116
  useCanUseTool_default = useCanUseTool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasharness/atlascode",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
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",