@trops/dash-core 0.1.789 → 0.1.790

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.
@@ -76620,6 +76620,29 @@ function* _fromUser(message) {
76620
76620
  // look at files, never change them or run anything.
76621
76621
  const READ_ONLY_BUILTINS = ["Read", "Glob", "Grep"];
76622
76622
 
76623
+ // Built-ins every other bot gets, named explicitly so the CLI's other
76624
+ // built-ins (Skill, RemoteTrigger, Cron*, ToolSearch, Agent, …) — and any a
76625
+ // newer CLI adds — never reach a bot. Skills could pre-approve tools and
76626
+ // RemoteTrigger made real cloud routines without asking.
76627
+ const DEFAULT_BUILTINS = [
76628
+ "Read",
76629
+ "Write",
76630
+ "Edit",
76631
+ "Glob",
76632
+ "Grep",
76633
+ "Bash",
76634
+ "WebFetch",
76635
+ "WebSearch",
76636
+ "TodoWrite",
76637
+ "NotebookEdit",
76638
+ ];
76639
+
76640
+ function _allowedBuiltins(ctx) {
76641
+ if (ctx.builtinTools === "none") return [];
76642
+ if (ctx.builtinTools === "read-only") return READ_ONLY_BUILTINS;
76643
+ return DEFAULT_BUILTINS;
76644
+ }
76645
+
76623
76646
  /** Build the SDK canUseTool hook from the run context. */
76624
76647
  function _makeCanUseTool(ctx) {
76625
76648
  return async function canUseTool(toolName, input) {
@@ -76648,6 +76671,14 @@ function _makeCanUseTool(ctx) {
76648
76671
  "This bot can only read files; make changes with its Dash tools.",
76649
76672
  };
76650
76673
  }
76674
+ // Anything else outside this bot's built-ins — denied, never asked, even
76675
+ // under "allow".
76676
+ if (!bridged && !_allowedBuiltins(ctx).includes(toolName)) {
76677
+ return {
76678
+ behavior: "deny",
76679
+ message: `${toolName} isn't available to bots.`,
76680
+ };
76681
+ }
76651
76682
  // Trusted bot → run tools without prompting.
76652
76683
  if (ctx.approvalPolicy === "allow") {
76653
76684
  return { behavior: "allow", updatedInput: input };
@@ -76730,12 +76761,9 @@ async function _runAgent(ctx, stream) {
76730
76761
  cliPath = null;
76731
76762
  }
76732
76763
  if (cliPath) options.pathToClaudeCodeExecutable = cliPath;
76733
- // Read-only bots (team leads) get none of the SDK's built-ins — no shell,
76734
- // files, or web; only their bridged team tools.
76735
- if (ctx.builtinTools === "none") options.tools = [];
76736
- else if (ctx.builtinTools === "read-only") {
76737
- options.tools = READ_ONLY_BUILTINS.slice();
76738
- }
76764
+ // Team leads get no built-ins, read-only bots only reads, every other bot
76765
+ // the default list — never the CLI's full set.
76766
+ options.tools = _allowedBuiltins(ctx).slice();
76739
76767
  if (ctx.maxTurns) options.maxTurns = ctx.maxTurns;
76740
76768
  if (ctx.workingDir) options.cwd = ctx.workingDir;
76741
76769
  if (ctx.session && ctx.session.id) options.resume = ctx.session.id;