@integrity-labs/agt-cli 0.10.2 → 0.10.3

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.
@@ -1859,7 +1859,7 @@ function extractAllowedDomains(input) {
1859
1859
  registerFramework(nemoClawAdapter);
1860
1860
 
1861
1861
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
1862
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync3, chmodSync as chmodSync3 } from "fs";
1862
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync3, chmodSync as chmodSync3, readdirSync, rmSync } from "fs";
1863
1863
  import { join as join3, relative } from "path";
1864
1864
  import { homedir as homedir2 } from "os";
1865
1865
  import { execFile as execFile3 } from "child_process";
@@ -1931,7 +1931,7 @@ function buildKnowledgeSection2(knowledge) {
1931
1931
  return "";
1932
1932
  const orgEntries = knowledge.filter((k) => k.scope === "org");
1933
1933
  const teamEntries = knowledge.filter((k) => k.scope === "team");
1934
- const formatEntry = (k) => `- **${k.title}** (skill: \`knowledge-${k.slug}\`)`;
1934
+ const formatEntry = (k) => `- **${k.title}**`;
1935
1935
  let body = "";
1936
1936
  if (orgEntries.length) {
1937
1937
  body += `### Organization
@@ -1950,9 +1950,9 @@ ${teamEntries.map(formatEntry).join("\n")}
1950
1950
  }
1951
1951
  return `## Core Knowledge
1952
1952
 
1953
- Your team has provided the following core knowledge as skills. These are
1954
- automatically available \u2014 Claude Code will surface the relevant skill when
1955
- you need context. You do not need to read files manually.
1953
+ Your team has provided core knowledge via the \`core-knowledge\` skill.
1954
+ It is automatically available \u2014 Claude Code will surface it when you need
1955
+ context. You do not need to read files manually.
1956
1956
 
1957
1957
  ${body}
1958
1958
  `;
@@ -2158,6 +2158,32 @@ function deployArtifactsToProject(codeName, provisionDir) {
2158
2158
  } catch {
2159
2159
  }
2160
2160
  }
2161
+ const skillsDir = join3(provisionDir, ".claude", "skills");
2162
+ const destSkillsDir = join3(projectDir, ".claude", "skills");
2163
+ try {
2164
+ if (existsSync3(destSkillsDir)) {
2165
+ const srcFolders = existsSync3(skillsDir) ? new Set(readdirSync(skillsDir)) : /* @__PURE__ */ new Set();
2166
+ for (const folder of readdirSync(destSkillsDir)) {
2167
+ if (folder.startsWith("knowledge-") || folder === "core-knowledge" && !srcFolders.has(folder)) {
2168
+ try {
2169
+ rmSync(join3(destSkillsDir, folder), { recursive: true });
2170
+ } catch {
2171
+ }
2172
+ }
2173
+ }
2174
+ }
2175
+ if (existsSync3(skillsDir)) {
2176
+ for (const skillFolder of readdirSync(skillsDir)) {
2177
+ const srcSkillFile = join3(skillsDir, skillFolder, "SKILL.md");
2178
+ if (!existsSync3(srcSkillFile))
2179
+ continue;
2180
+ const destFolder = join3(destSkillsDir, skillFolder);
2181
+ mkdirSync3(destFolder, { recursive: true });
2182
+ writeFileSync3(join3(destFolder, "SKILL.md"), readFileSync3(srcSkillFile, "utf-8"));
2183
+ }
2184
+ }
2185
+ } catch {
2186
+ }
2161
2187
  const agentMcpPath = join3(getAgentDir(codeName), "provision", ".mcp.json");
2162
2188
  const projectMcpPath = join3(projectDir, ".mcp.json");
2163
2189
  try {
@@ -2474,20 +2500,28 @@ var claudeCodeAdapter = {
2474
2500
  { relativePath: "CHARTER.md", content: input.charterContent },
2475
2501
  { relativePath: "TOOLS.md", content: input.toolsContent }
2476
2502
  ];
2477
- for (const entry of input.knowledge ?? []) {
2478
- const skillPath = `.claude/skills/knowledge-${entry.slug}/SKILL.md`;
2479
- assertSafeRelativePath(skillPath);
2480
- const scopeLabel = entry.scope === "org" ? "organization" : "team";
2503
+ const knowledgeEntries = input.knowledge ?? [];
2504
+ if (knowledgeEntries.length > 0) {
2505
+ const safeTitles = knowledgeEntries.map((k) => k.title.replace(/[\n\r"\\]/g, " ").trim().toLowerCase()).filter(Boolean);
2506
+ const sections = knowledgeEntries.map((entry) => {
2507
+ const scopeLabel = entry.scope === "org" ? "Organization" : "Team";
2508
+ const safeTitle = entry.title.replace(/[\n\r]/g, " ").trim();
2509
+ return `## ${safeTitle}
2510
+ *${scopeLabel} knowledge*
2511
+
2512
+ ${entry.content}`;
2513
+ }).join("\n\n---\n\n");
2514
+ const description = `Use this skill when the user asks about the company, organization, team, products, or any of: ${safeTitles.join(", ")}. Provides core reference material from the knowledge base.`;
2481
2515
  artifacts.push({
2482
- relativePath: skillPath,
2516
+ relativePath: ".claude/skills/core-knowledge/SKILL.md",
2483
2517
  content: `---
2484
- name: knowledge-${entry.slug}
2485
- description: "${entry.title} \u2014 ${scopeLabel}-level core knowledge. Use when you need context about ${entry.title.toLowerCase()}."
2518
+ name: core-knowledge
2519
+ description: ${JSON.stringify(description)}
2486
2520
  ---
2487
2521
 
2488
- # ${entry.title}
2522
+ # Core Knowledge
2489
2523
 
2490
- ${entry.content}`
2524
+ ${sections}`
2491
2525
  });
2492
2526
  }
2493
2527
  return artifacts;
@@ -2503,8 +2537,8 @@ ${entry.content}`
2503
2537
  const augDir = join3(homeDir, ".augmented");
2504
2538
  const agents = /* @__PURE__ */ new Set();
2505
2539
  try {
2506
- const { readdirSync, statSync } = await import("fs");
2507
- const entries = readdirSync(augDir);
2540
+ const { readdirSync: readdirSync2, statSync } = await import("fs");
2541
+ const entries = readdirSync2(augDir);
2508
2542
  for (const entry of entries) {
2509
2543
  const ccDir = join3(augDir, entry, "claudecode");
2510
2544
  try {
@@ -2874,6 +2908,9 @@ ${entry.content}`
2874
2908
  },
2875
2909
  installSkillFiles(codeName, skillId, files) {
2876
2910
  assertValidCodeName(skillId);
2911
+ const isPluginManaged = skillId.startsWith("plugin-");
2912
+ const READ_ONLY_MODE = 292;
2913
+ const READ_WRITE_MODE = 420;
2877
2914
  const agentDir = getAgentDir(codeName);
2878
2915
  const projectDir = getProjectDir(codeName);
2879
2916
  for (const baseDir of [join3(agentDir, "skills"), join3(projectDir, ".claude", "skills")]) {
@@ -2887,7 +2924,19 @@ ${entry.content}`
2887
2924
  throw new Error(`Path traversal detected: ${file.relativePath} resolves outside ${skillDir}`);
2888
2925
  }
2889
2926
  mkdirSync3(join3(filePath, ".."), { recursive: true });
2927
+ if (isPluginManaged && existsSync3(filePath)) {
2928
+ try {
2929
+ chmodSync3(filePath, READ_WRITE_MODE);
2930
+ } catch {
2931
+ }
2932
+ }
2890
2933
  writeFileSync3(filePath, file.content);
2934
+ if (isPluginManaged) {
2935
+ try {
2936
+ chmodSync3(filePath, READ_ONLY_MODE);
2937
+ } catch {
2938
+ }
2939
+ }
2891
2940
  }
2892
2941
  }
2893
2942
  },
@@ -2971,6 +3020,250 @@ ${entry.content}`
2971
3020
  };
2972
3021
  registerFramework(claudeCodeAdapter);
2973
3022
 
3023
+ // ../../packages/core/dist/provisioning/frameworks/managed-agents/system-prompt.js
3024
+ function generateSystemPrompt(input) {
3025
+ const { agent, charterFrontmatter, charterContent, resolvedChannels, integrations } = input;
3026
+ const sections = [];
3027
+ sections.push(`# Agent Identity
3028
+
3029
+ **Name**: ${agent.display_name} (\`${agent.code_name}\`)
3030
+ **Environment**: ${agent.environment}
3031
+ **Risk Tier**: ${agent.risk_tier}
3032
+ **Owner**: ${charterFrontmatter.owner.name}${charterFrontmatter.owner.email ? ` <${charterFrontmatter.owner.email}>` : ""}
3033
+ **Augmented Agent ID**: ${agent.agent_id}`);
3034
+ const bodyContent = stripFrontmatter(charterContent).trim();
3035
+ if (bodyContent) {
3036
+ sections.push(bodyContent);
3037
+ }
3038
+ if (resolvedChannels.length > 0) {
3039
+ sections.push(`## Allowed Channels
3040
+
3041
+ This agent is permitted to communicate via the following channels:
3042
+ ${resolvedChannels.map((ch) => `- ${ch}`).join("\n")}`);
3043
+ }
3044
+ const budget = charterFrontmatter.budget;
3045
+ const limits = charterFrontmatter.limits;
3046
+ if (budget || limits) {
3047
+ const budgetLines = [];
3048
+ if (budget) {
3049
+ const window = budget.window;
3050
+ if (budget.type === "tokens" || budget.type === "both") {
3051
+ budgetLines.push(`- Token budget: ${(budget.limit_tokens ?? budget.limit).toLocaleString()} tokens per ${window}`);
3052
+ }
3053
+ if (budget.type === "dollars" || budget.type === "both") {
3054
+ budgetLines.push(`- Cost budget: $${(budget.limit_dollars ?? budget.limit).toFixed(2)} per ${window}`);
3055
+ }
3056
+ if (budget.enforcement) {
3057
+ budgetLines.push(`- Enforcement: ${budget.enforcement}`);
3058
+ }
3059
+ }
3060
+ if (limits) {
3061
+ budgetLines.push(`- Max tokens per request: ${limits.max_tokens_per_request.toLocaleString()}`);
3062
+ budgetLines.push(`- Max tokens per run: ${limits.max_tokens_per_run.toLocaleString()}`);
3063
+ }
3064
+ sections.push(`## Budget Constraints
3065
+
3066
+ ${budgetLines.join("\n")}`);
3067
+ }
3068
+ const apiKeyIntegrations = (integrations ?? []).filter((i) => i.auth_type === "api_key" && i.credentials.api_key);
3069
+ if (apiKeyIntegrations.length > 0) {
3070
+ const credLines = apiKeyIntegrations.map((i) => {
3071
+ const envKey = `${i.definition_id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_API_KEY`;
3072
+ return `- **${i.display_name}**: API key available as \`${envKey}\``;
3073
+ });
3074
+ sections.push(`## Available Integrations (API Keys)
3075
+
3076
+ The following integration credentials are available for use in this session:
3077
+ ${credLines.join("\n")}
3078
+
3079
+ These credentials are pre-loaded. Reference them by their environment variable names when invoking tools.`);
3080
+ }
3081
+ return sections.join("\n\n");
3082
+ }
3083
+ function stripFrontmatter(content) {
3084
+ if (!content.startsWith("---"))
3085
+ return content;
3086
+ const secondDelimiter = content.indexOf("\n---", 3);
3087
+ if (secondDelimiter === -1)
3088
+ return content;
3089
+ return content.slice(secondDelimiter + 4);
3090
+ }
3091
+
3092
+ // ../../packages/core/dist/provisioning/frameworks/managed-agents/tools-mapper.js
3093
+ var TOOL_ID_TO_ANTHROPIC = [
3094
+ ["bash", "bash"],
3095
+ ["shell", "bash"],
3096
+ ["exec", "bash"],
3097
+ ["read", "read"],
3098
+ ["fs_read", "read"],
3099
+ ["file_read", "read"],
3100
+ ["write", "write"],
3101
+ ["fs_write", "write"],
3102
+ ["file_write", "write"],
3103
+ ["edit", "edit"],
3104
+ ["fs_edit", "edit"],
3105
+ ["file_edit", "edit"],
3106
+ ["glob", "glob"],
3107
+ ["fs_glob", "glob"],
3108
+ ["grep", "grep"],
3109
+ ["fs_grep", "grep"],
3110
+ ["web_fetch", "web_fetch"],
3111
+ ["fetch", "web_fetch"],
3112
+ ["http", "web_fetch"],
3113
+ ["web_search", "web_search"],
3114
+ ["search", "web_search"]
3115
+ ];
3116
+ function mapToolsToAgentToolset(toolsFrontmatter) {
3117
+ const enabledTools = /* @__PURE__ */ new Set();
3118
+ for (const tool of toolsFrontmatter.tools) {
3119
+ const id = tool.id.toLowerCase();
3120
+ for (const [prefix, anthropicTool] of TOOL_ID_TO_ANTHROPIC) {
3121
+ if (id === prefix || id.startsWith(`${prefix}_`) || id.startsWith(`${prefix}-`)) {
3122
+ enabledTools.add(anthropicTool);
3123
+ break;
3124
+ }
3125
+ }
3126
+ }
3127
+ const allTools = [
3128
+ "bash",
3129
+ "read",
3130
+ "write",
3131
+ "edit",
3132
+ "glob",
3133
+ "grep",
3134
+ "web_fetch",
3135
+ "web_search"
3136
+ ];
3137
+ return {
3138
+ type: "agent_toolset_20260401",
3139
+ default_config: { enabled: false },
3140
+ configs: allTools.map((name) => ({ name, enabled: enabledTools.has(name) }))
3141
+ };
3142
+ }
3143
+ function extractAllowedHosts(toolsFrontmatter) {
3144
+ const hosts = /* @__PURE__ */ new Set();
3145
+ for (const tool of toolsFrontmatter.tools) {
3146
+ for (const domain of tool.network?.allowlist_domains ?? []) {
3147
+ hosts.add(domain);
3148
+ }
3149
+ }
3150
+ return [...hosts];
3151
+ }
3152
+
3153
+ // ../../packages/core/dist/provisioning/frameworks/managed-agents/environment-config.js
3154
+ function buildEnvironmentConfig(riskTier, allowedHosts) {
3155
+ switch (riskTier) {
3156
+ case "Low":
3157
+ return {
3158
+ type: "cloud",
3159
+ networking: { type: "unrestricted" }
3160
+ };
3161
+ case "Medium":
3162
+ return {
3163
+ type: "cloud",
3164
+ networking: {
3165
+ type: "limited",
3166
+ allowed_hosts: allowedHosts,
3167
+ allow_mcp_servers: true,
3168
+ allow_package_managers: true
3169
+ }
3170
+ };
3171
+ case "High":
3172
+ return {
3173
+ type: "cloud",
3174
+ networking: {
3175
+ type: "limited",
3176
+ allowed_hosts: [],
3177
+ allow_mcp_servers: true,
3178
+ allow_package_managers: false
3179
+ }
3180
+ };
3181
+ }
3182
+ }
3183
+
3184
+ // ../../packages/core/dist/provisioning/frameworks/managed-agents/index.js
3185
+ function buildMcpServers(input) {
3186
+ const servers = [];
3187
+ for (const integration of input.integrations ?? []) {
3188
+ if (integration.auth_type !== "managed")
3189
+ continue;
3190
+ const config = integration.config;
3191
+ const mcpUrl = config["mcp_server_url"];
3192
+ if (!mcpUrl)
3193
+ continue;
3194
+ const connectedAccountId = integration.credentials["connected_account_id"];
3195
+ const apiKey = integration.credentials["api_key"];
3196
+ const headers = {};
3197
+ if (apiKey)
3198
+ headers["Authorization"] = `secret_ref://${integration.definition_id}/api_key`;
3199
+ if (connectedAccountId)
3200
+ headers["X-Connected-Account-Id"] = String(connectedAccountId);
3201
+ servers.push({
3202
+ type: "url",
3203
+ name: integration.definition_id.replace(/[^a-z0-9-]/gi, "-").toLowerCase(),
3204
+ url: mcpUrl,
3205
+ ...Object.keys(headers).length > 0 ? { headers } : {}
3206
+ });
3207
+ }
3208
+ return servers;
3209
+ }
3210
+ var ManagedAgentsAdapter = {
3211
+ id: "managed-agents",
3212
+ label: "Managed Agents (Anthropic Cloud)",
3213
+ buildArtifacts(input) {
3214
+ const { agent, toolsFrontmatter } = input;
3215
+ const toolset = mapToolsToAgentToolset(toolsFrontmatter);
3216
+ const allowedHosts = extractAllowedHosts(toolsFrontmatter);
3217
+ const environmentConfig = buildEnvironmentConfig(agent.risk_tier, allowedHosts);
3218
+ const mcpServers = buildMcpServers(input);
3219
+ const tools = [toolset];
3220
+ for (const server of mcpServers) {
3221
+ tools.push({ type: "mcp_toolset", mcp_server_name: server.name });
3222
+ }
3223
+ const config = {
3224
+ name: agent.display_name,
3225
+ model: agent.primary_model ?? "claude-sonnet-4-6",
3226
+ system: generateSystemPrompt(input),
3227
+ tools,
3228
+ mcp_servers: mcpServers,
3229
+ description: agent.description,
3230
+ metadata: {
3231
+ augmented_agent_id: agent.agent_id,
3232
+ augmented_code_name: agent.code_name,
3233
+ augmented_environment: agent.environment,
3234
+ augmented_risk_tier: agent.risk_tier,
3235
+ augmented_framework: "managed-agents"
3236
+ },
3237
+ _environment_config: environmentConfig
3238
+ };
3239
+ return [
3240
+ {
3241
+ relativePath: "managed-agent.json",
3242
+ content: JSON.stringify(config, null, 2)
3243
+ }
3244
+ ];
3245
+ },
3246
+ driftTrackedFiles() {
3247
+ return ["managed-agent.json"];
3248
+ },
3249
+ // -------------------------------------------------------------------------
3250
+ // No local runtime — all execution is in Anthropic's cloud.
3251
+ // These methods are intentional no-ops.
3252
+ // -------------------------------------------------------------------------
3253
+ async getRegisteredAgents() {
3254
+ return /* @__PURE__ */ new Set();
3255
+ },
3256
+ async registerAgent(_codeName, _teamDir) {
3257
+ return true;
3258
+ },
3259
+ async deregisterAgent(_codeName) {
3260
+ return true;
3261
+ },
3262
+ writeAuthProfiles(_codeName, _profiles) {
3263
+ }
3264
+ };
3265
+ registerFramework(ManagedAgentsAdapter);
3266
+
2974
3267
  // src/lib/config.ts
2975
3268
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, existsSync as existsSync4 } from "fs";
2976
3269
  import { join as join4 } from "path";
@@ -4780,8 +5073,10 @@ var ROLE_PERMISSIONS = {
4780
5073
  "agent.view",
4781
5074
  "audit_log.view",
4782
5075
  "host.view",
5076
+ "plugin.view",
4783
5077
  "plugin.install",
4784
- "plugin.view"
5078
+ "plugin.configure",
5079
+ "plugin.manage_scopes"
4785
5080
  ],
4786
5081
  viewer: [
4787
5082
  "agent.view",
@@ -5244,4 +5539,4 @@ export {
5244
5539
  detectDrift,
5245
5540
  provision
5246
5541
  };
5247
- //# sourceMappingURL=chunk-VCKY6MN2.js.map
5542
+ //# sourceMappingURL=chunk-6YGOQRAR.js.map