@wrongstack/core 0.298.0 → 0.298.2

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.
@@ -28279,7 +28279,7 @@ import * as fs11 from "node:fs/promises";
28279
28279
  import * as path33 from "node:path";
28280
28280
  var DEFAULT_URL = "https://models.dev/api.json";
28281
28281
  var ENV_URL_KEY = "WRONGSTACK_MODELS_DEV_URL";
28282
- var DEFAULT_TTL_SECONDS = 24 * 3600;
28282
+ var DEFAULT_TTL_SECONDS = 3 * 3600;
28283
28283
  var DEFAULT_REFRESH_TIMEOUT_MS = 15e3;
28284
28284
  var FAMILY_BY_NPM = {
28285
28285
  "@ai-sdk/anthropic": "anthropic",
@@ -29956,7 +29956,68 @@ function isClearlyDestructiveBashCommand(command, projectRoot) {
29956
29956
  return false;
29957
29957
  }
29958
29958
 
29959
- // src/security/permission-policy.ts
29959
+ // src/security/auto-approve-policy.ts
29960
+ var AutoApprovePermissionPolicy = class _AutoApprovePermissionPolicy {
29961
+ allowedCapabilities;
29962
+ constructor(allowedCapabilities) {
29963
+ this.allowedCapabilities = allowedCapabilities ?? [
29964
+ ToolCapabilities.FS_READ,
29965
+ ToolCapabilities.NET_OUTBOUND
29966
+ ];
29967
+ }
29968
+ static isMcpTool(name) {
29969
+ return name.startsWith("mcp__");
29970
+ }
29971
+ async evaluate(tool) {
29972
+ const caps = tool.capabilities ?? [];
29973
+ const hasAllowedCap = caps.some((c) => this.allowedCapabilities.includes(c));
29974
+ const isMcp = _AutoApprovePermissionPolicy.isMcpTool(tool.name);
29975
+ const mcpProxyAllowed = this.allowedCapabilities.includes(ToolCapabilities.MCP_PROXY);
29976
+ const dangerousNotAllowed = getDangerousCapabilities(tool).filter(
29977
+ (c) => !this.allowedCapabilities.includes(c)
29978
+ );
29979
+ const blocked = tool.permission === "deny" || isMcp && !mcpProxyAllowed || !hasAllowedCap || dangerousNotAllowed.length > 0;
29980
+ if (blocked) {
29981
+ const reason = isMcp && !mcpProxyAllowed ? `MCP tool ${tool.name} is not auto-approved for subagents \u2014 ask the leader to allow mcp.proxy explicitly` : tool.permission === "deny" ? "tool default deny" : dangerousNotAllowed.length > 0 ? `tool requires un-granted dangerous capability (needs: ${dangerousNotAllowed.join(", ")}, allowed: ${this.allowedCapabilities.join(", ")})` : `tool lacks allowed capability (has: ${caps.join(", ") || "none"}, allowed: ${this.allowedCapabilities.join(", ")})`;
29982
+ return {
29983
+ permission: "deny",
29984
+ source: "subagent_guard",
29985
+ reason
29986
+ };
29987
+ }
29988
+ return { permission: "auto", source: "yolo" };
29989
+ }
29990
+ async trust() {
29991
+ }
29992
+ async deny() {
29993
+ }
29994
+ denyOnce() {
29995
+ }
29996
+ allowOnce() {
29997
+ }
29998
+ async explain(tool) {
29999
+ const decision = await this.evaluate(tool);
30000
+ return {
30001
+ toolName: tool.name,
30002
+ subject: null,
30003
+ steps: [
30004
+ {
30005
+ rule: "subagent auto",
30006
+ matched: decision.permission === "auto",
30007
+ decision: decision.permission,
30008
+ source: decision.source,
30009
+ detail: decision.reason ?? `subagent policy: ${decision.permission}`
30010
+ }
30011
+ ],
30012
+ winnerIndex: 0,
30013
+ decision
30014
+ };
30015
+ }
30016
+ async reload() {
30017
+ }
30018
+ };
30019
+
30020
+ // src/security/permission-helpers.ts
29960
30021
  function matchesTrust(patterns, subject) {
29961
30022
  return patterns.includes(subject) || matchAny(patterns, subject);
29962
30023
  }
@@ -30051,6 +30112,8 @@ function shellCommandReadsSensitivePath(command) {
30051
30112
  }
30052
30113
  return false;
30053
30114
  }
30115
+
30116
+ // src/security/permission-policy.ts
30054
30117
  var DefaultPermissionPolicy = class {
30055
30118
  policy = {};
30056
30119
  loaded = false;
@@ -30793,65 +30856,6 @@ var DefaultPermissionPolicy = class {
30793
30856
  return void 0;
30794
30857
  }
30795
30858
  };
30796
- var AutoApprovePermissionPolicy = class _AutoApprovePermissionPolicy {
30797
- allowedCapabilities;
30798
- constructor(allowedCapabilities) {
30799
- this.allowedCapabilities = allowedCapabilities ?? [
30800
- ToolCapabilities.FS_READ,
30801
- ToolCapabilities.NET_OUTBOUND
30802
- ];
30803
- }
30804
- static isMcpTool(name) {
30805
- return name.startsWith("mcp__");
30806
- }
30807
- async evaluate(tool) {
30808
- const caps = tool.capabilities ?? [];
30809
- const hasAllowedCap = caps.some((c) => this.allowedCapabilities.includes(c));
30810
- const isMcp = _AutoApprovePermissionPolicy.isMcpTool(tool.name);
30811
- const mcpProxyAllowed = this.allowedCapabilities.includes(ToolCapabilities.MCP_PROXY);
30812
- const dangerousNotAllowed = getDangerousCapabilities(tool).filter(
30813
- (c) => !this.allowedCapabilities.includes(c)
30814
- );
30815
- const blocked = tool.permission === "deny" || isMcp && !mcpProxyAllowed || !hasAllowedCap || dangerousNotAllowed.length > 0;
30816
- if (blocked) {
30817
- const reason = isMcp && !mcpProxyAllowed ? `MCP tool ${tool.name} is not auto-approved for subagents \u2014 ask the leader to allow mcp.proxy explicitly` : tool.permission === "deny" ? "tool default deny" : dangerousNotAllowed.length > 0 ? `tool requires un-granted dangerous capability (needs: ${dangerousNotAllowed.join(", ")}, allowed: ${this.allowedCapabilities.join(", ")})` : `tool lacks allowed capability (has: ${caps.join(", ") || "none"}, allowed: ${this.allowedCapabilities.join(", ")})`;
30818
- return {
30819
- permission: "deny",
30820
- source: "subagent_guard",
30821
- reason
30822
- };
30823
- }
30824
- return { permission: "auto", source: "yolo" };
30825
- }
30826
- async trust() {
30827
- }
30828
- async deny() {
30829
- }
30830
- denyOnce() {
30831
- }
30832
- allowOnce() {
30833
- }
30834
- async explain(tool) {
30835
- const decision = await this.evaluate(tool);
30836
- return {
30837
- toolName: tool.name,
30838
- subject: null,
30839
- steps: [
30840
- {
30841
- rule: "subagent auto",
30842
- matched: decision.permission === "auto",
30843
- decision: decision.permission,
30844
- source: decision.source,
30845
- detail: decision.reason ?? `subagent policy: ${decision.permission}`
30846
- }
30847
- ],
30848
- winnerIndex: 0,
30849
- decision
30850
- };
30851
- }
30852
- async reload() {
30853
- }
30854
- };
30855
30859
 
30856
30860
  // src/security/secret-vault.ts
30857
30861
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes3, scryptSync } from "node:crypto";
@@ -31631,7 +31635,7 @@ var CONFIG_BEHAVIOR_DEFAULTS = {
31631
31635
  // DEFAULT_STATUSLINE_MODE (packages/tui/src/components/settings-picker-model.ts).
31632
31636
  statuslineMode: "minimum",
31633
31637
  thinkingWord: DEFAULT_TUI_THINKING_WORD,
31634
- showAgentSwarmPanel: true
31638
+ showAgentSwarmPanel: "bottom"
31635
31639
  },
31636
31640
  circuitBreaker: { ...DEFAULT_CIRCUIT_BREAKER_CONFIG },
31637
31641
  modelRuntime: {
@@ -32081,13 +32085,32 @@ function inlineDefinition(model) {
32081
32085
  if (maxOutput !== void 0) definition.maxOutput = maxOutput;
32082
32086
  const capabilities = readCapabilities(model);
32083
32087
  if (capabilities) definition.capabilities = capabilities;
32088
+ const { id: _id, ...rest } = model;
32089
+ if (Object.keys(rest).length > 0) {
32090
+ definition.modelsDev = rest;
32091
+ }
32084
32092
  return definition;
32085
32093
  }
32086
32094
  function mergeDefinitions(base, patch) {
32095
+ const mergedModelsDev = (() => {
32096
+ if (!base?.modelsDev && !patch.modelsDev) return void 0;
32097
+ const baseMd = base?.modelsDev ?? {};
32098
+ const patchMd = patch.modelsDev ?? {};
32099
+ const result = { ...baseMd, ...patchMd };
32100
+ for (const nestedKey of ["limit", "cost", "modalities"]) {
32101
+ const bn = baseMd?.[nestedKey];
32102
+ const pn = patchMd?.[nestedKey];
32103
+ if (bn || pn) {
32104
+ result[nestedKey] = { ...bn ?? {}, ...pn ?? {} };
32105
+ }
32106
+ }
32107
+ return result;
32108
+ })();
32087
32109
  return {
32088
32110
  ...base,
32089
32111
  ...patch,
32090
- ...base?.capabilities || patch.capabilities ? { capabilities: { ...base?.capabilities, ...patch.capabilities } } : {}
32112
+ ...base?.capabilities || patch.capabilities ? { capabilities: { ...base?.capabilities, ...patch.capabilities } } : {},
32113
+ ...mergedModelsDev ? { modelsDev: mergedModelsDev } : {}
32091
32114
  };
32092
32115
  }
32093
32116
  function normalizeInlineProviderModels(config, warn) {