@integrity-labs/agt-cli 0.28.433 → 0.28.434

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.
@@ -50,103 +50,6 @@ function sanitizeMcpJson(mcpConfigPath, apiHost) {
50
50
  }
51
51
  }
52
52
 
53
- // src/lib/claude-tools.ts
54
- var BASE_TOOLS = ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "Agent", "Skill", "ToolSearch"];
55
- function buildAllowedTools(mcpServerNames) {
56
- const mcpPatterns = mcpServerNames.map((name) => `mcp__${name.replace(/-/g, "_")}__*`);
57
- return [...mcpPatterns, ...BASE_TOOLS].join(",");
58
- }
59
-
60
- // src/lib/mcp-env-probe.ts
61
- import { existsSync, readFileSync as readFileSync2 } from "fs";
62
- var LATE_BOUND_VARS = /* @__PURE__ */ new Set([
63
- "AGT_RUN_ID",
64
- "AGT_TOKEN",
65
- "ANCHOR_BROWSER_SESSION_ID"
66
- ]);
67
- var TEMPLATE_VAR_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
68
- function collectVarsFromValue(value, into) {
69
- if (typeof value === "string") {
70
- for (const m of value.matchAll(TEMPLATE_VAR_RE)) into.add(m[1]);
71
- } else if (Array.isArray(value)) {
72
- for (const v of value) collectVarsFromValue(v, into);
73
- }
74
- }
75
- function findMissingSubstitutionVars(mcpConfig, env2) {
76
- const findings = [];
77
- if (typeof mcpConfig !== "object" || mcpConfig === null) return findings;
78
- const servers = mcpConfig.mcpServers;
79
- if (typeof servers !== "object" || servers === null) return findings;
80
- for (const [server, raw] of Object.entries(servers)) {
81
- if (typeof raw !== "object" || raw === null) continue;
82
- const entry = raw;
83
- const vars = /* @__PURE__ */ new Set();
84
- collectVarsFromValue(entry["command"], vars);
85
- collectVarsFromValue(entry["args"], vars);
86
- collectVarsFromValue(entry["url"], vars);
87
- for (const block of [entry["env"], entry["headers"]]) {
88
- if (typeof block !== "object" || block === null) continue;
89
- for (const v of Object.values(block)) collectVarsFromValue(v, vars);
90
- }
91
- for (const varName of vars) {
92
- if (LATE_BOUND_VARS.has(varName)) continue;
93
- const value = env2[varName];
94
- if (value === void 0) {
95
- findings.push({ varName, server, state: "unset" });
96
- } else if (value.trim() === "") {
97
- findings.push({ varName, server, state: "empty" });
98
- }
99
- }
100
- }
101
- return findings;
102
- }
103
- function formatMissingVar(f) {
104
- return `[mcp-env-substitution] missing var=${f.varName} server=${f.server} state=${f.state}`;
105
- }
106
- function expandTemplateVars(value, env2) {
107
- const unresolved = /* @__PURE__ */ new Set();
108
- const expanded = value.replace(TEMPLATE_VAR_RE, (literal, name) => {
109
- if (LATE_BOUND_VARS.has(name)) {
110
- unresolved.add(name);
111
- return literal;
112
- }
113
- const resolved = env2[name];
114
- if (resolved !== void 0 && resolved.trim() !== "") return resolved;
115
- unresolved.add(name);
116
- return literal;
117
- });
118
- return { value: expanded, unresolved: [...unresolved] };
119
- }
120
- function parseEnvIntegrations(content) {
121
- const out = {};
122
- for (const line2 of content.split("\n")) {
123
- if (!line2 || line2.startsWith("#") || !line2.includes("=")) continue;
124
- const eqIdx = line2.indexOf("=");
125
- const key = line2.slice(0, eqIdx);
126
- let value = line2.slice(eqIdx + 1);
127
- if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
128
- value = value.slice(1, -1).replaceAll("'\\''", "'");
129
- }
130
- out[key] = value;
131
- }
132
- return out;
133
- }
134
- function probeMcpEnvSubstitution(args) {
135
- try {
136
- const config = JSON.parse(readFileSync2(args.mcpConfigPath, "utf-8"));
137
- let env2 = args.baseEnv;
138
- if (args.envIntegrationsPath && existsSync(args.envIntegrationsPath)) {
139
- env2 = {
140
- ...args.baseEnv,
141
- ...parseEnvIntegrations(readFileSync2(args.envIntegrationsPath, "utf-8"))
142
- };
143
- }
144
- return findMissingSubstitutionVars(config, env2);
145
- } catch {
146
- return [];
147
- }
148
- }
149
-
150
53
  // ../../packages/core/dist/types/agent.js
151
54
  var DEFAULT_FRAMEWORK = "claude-code";
152
55
  var FRAMEWORK_DEPRECATION = {
@@ -4075,6 +3978,22 @@ ${frontmatter.environment === "prod" ? "- Production environment: exercise extra
4075
3978
  return body;
4076
3979
  }
4077
3980
 
3981
+ // ../../packages/core/dist/provisioning/mcp-tool-patterns.js
3982
+ function sanitizeMcpName(name) {
3983
+ return name.replace(/-/g, "_");
3984
+ }
3985
+ function mcpWildcardsForServer(serverKey) {
3986
+ const raw = `mcp__${serverKey}__*`;
3987
+ const sanitized = `mcp__${sanitizeMcpName(serverKey)}__*`;
3988
+ return sanitized === raw ? [raw] : [raw, sanitized];
3989
+ }
3990
+ function mcpWildcardsForServers(serverKeys) {
3991
+ return Array.from(new Set(serverKeys.flatMap((k) => mcpWildcardsForServer(k))));
3992
+ }
3993
+ function requiredMcpWildcard(serverKey) {
3994
+ return `mcp__${serverKey}__*`;
3995
+ }
3996
+
4078
3997
  // ../../packages/core/dist/integrations/context-validator.js
4079
3998
  import Ajv20202 from "ajv/dist/2020.js";
4080
3999
  import addFormats2 from "ajv-formats";
@@ -9919,6 +9838,102 @@ function computeFlagsSchemaVersion() {
9919
9838
  }
9920
9839
  var FLAGS_SCHEMA_VERSION = computeFlagsSchemaVersion();
9921
9840
 
9841
+ // src/lib/claude-tools.ts
9842
+ var BASE_TOOLS = ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "Agent", "Skill", "ToolSearch"];
9843
+ function buildAllowedTools(mcpServerNames) {
9844
+ return [...mcpWildcardsForServers(mcpServerNames), ...BASE_TOOLS].join(",");
9845
+ }
9846
+
9847
+ // src/lib/mcp-env-probe.ts
9848
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
9849
+ var LATE_BOUND_VARS = /* @__PURE__ */ new Set([
9850
+ "AGT_RUN_ID",
9851
+ "AGT_TOKEN",
9852
+ "ANCHOR_BROWSER_SESSION_ID"
9853
+ ]);
9854
+ var TEMPLATE_VAR_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
9855
+ function collectVarsFromValue(value, into) {
9856
+ if (typeof value === "string") {
9857
+ for (const m of value.matchAll(TEMPLATE_VAR_RE)) into.add(m[1]);
9858
+ } else if (Array.isArray(value)) {
9859
+ for (const v of value) collectVarsFromValue(v, into);
9860
+ }
9861
+ }
9862
+ function findMissingSubstitutionVars(mcpConfig, env2) {
9863
+ const findings = [];
9864
+ if (typeof mcpConfig !== "object" || mcpConfig === null) return findings;
9865
+ const servers = mcpConfig.mcpServers;
9866
+ if (typeof servers !== "object" || servers === null) return findings;
9867
+ for (const [server, raw] of Object.entries(servers)) {
9868
+ if (typeof raw !== "object" || raw === null) continue;
9869
+ const entry = raw;
9870
+ const vars = /* @__PURE__ */ new Set();
9871
+ collectVarsFromValue(entry["command"], vars);
9872
+ collectVarsFromValue(entry["args"], vars);
9873
+ collectVarsFromValue(entry["url"], vars);
9874
+ for (const block of [entry["env"], entry["headers"]]) {
9875
+ if (typeof block !== "object" || block === null) continue;
9876
+ for (const v of Object.values(block)) collectVarsFromValue(v, vars);
9877
+ }
9878
+ for (const varName of vars) {
9879
+ if (LATE_BOUND_VARS.has(varName)) continue;
9880
+ const value = env2[varName];
9881
+ if (value === void 0) {
9882
+ findings.push({ varName, server, state: "unset" });
9883
+ } else if (value.trim() === "") {
9884
+ findings.push({ varName, server, state: "empty" });
9885
+ }
9886
+ }
9887
+ }
9888
+ return findings;
9889
+ }
9890
+ function formatMissingVar(f) {
9891
+ return `[mcp-env-substitution] missing var=${f.varName} server=${f.server} state=${f.state}`;
9892
+ }
9893
+ function expandTemplateVars(value, env2) {
9894
+ const unresolved = /* @__PURE__ */ new Set();
9895
+ const expanded = value.replace(TEMPLATE_VAR_RE, (literal, name) => {
9896
+ if (LATE_BOUND_VARS.has(name)) {
9897
+ unresolved.add(name);
9898
+ return literal;
9899
+ }
9900
+ const resolved = env2[name];
9901
+ if (resolved !== void 0 && resolved.trim() !== "") return resolved;
9902
+ unresolved.add(name);
9903
+ return literal;
9904
+ });
9905
+ return { value: expanded, unresolved: [...unresolved] };
9906
+ }
9907
+ function parseEnvIntegrations(content) {
9908
+ const out = {};
9909
+ for (const line2 of content.split("\n")) {
9910
+ if (!line2 || line2.startsWith("#") || !line2.includes("=")) continue;
9911
+ const eqIdx = line2.indexOf("=");
9912
+ const key = line2.slice(0, eqIdx);
9913
+ let value = line2.slice(eqIdx + 1);
9914
+ if (value.length >= 2 && value.startsWith("'") && value.endsWith("'")) {
9915
+ value = value.slice(1, -1).replaceAll("'\\''", "'");
9916
+ }
9917
+ out[key] = value;
9918
+ }
9919
+ return out;
9920
+ }
9921
+ function probeMcpEnvSubstitution(args) {
9922
+ try {
9923
+ const config = JSON.parse(readFileSync2(args.mcpConfigPath, "utf-8"));
9924
+ let env2 = args.baseEnv;
9925
+ if (args.envIntegrationsPath && existsSync(args.envIntegrationsPath)) {
9926
+ env2 = {
9927
+ ...args.baseEnv,
9928
+ ...parseEnvIntegrations(readFileSync2(args.envIntegrationsPath, "utf-8"))
9929
+ };
9930
+ }
9931
+ return findMissingSubstitutionVars(config, env2);
9932
+ } catch {
9933
+ return [];
9934
+ }
9935
+ }
9936
+
9922
9937
  // src/lib/opencode-session.ts
9923
9938
  import { spawn, execSync } from "child_process";
9924
9939
  import { createServer } from "net";
@@ -13909,6 +13924,8 @@ export {
13909
13924
  DEFAULT_FRAMEWORK,
13910
13925
  registerFramework,
13911
13926
  getFramework,
13927
+ mcpWildcardsForServers,
13928
+ requiredMcpWildcard,
13912
13929
  MAX_AVATAR_ENV_URL_BYTES,
13913
13930
  resolveAvatarEnvUrl,
13914
13931
  CLAUDE_MD_MAX_CHARS,
@@ -14064,4 +14081,4 @@ export {
14064
14081
  stopAllSessionsAndWait,
14065
14082
  getProjectDir
14066
14083
  };
14067
- //# sourceMappingURL=chunk-NUKNLJNJ.js.map
14084
+ //# sourceMappingURL=chunk-TTEKDLQ7.js.map