@integrity-labs/agt-cli 0.7.7 → 0.7.9
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.
package/dist/bin/agt.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
resolveChannels,
|
|
33
33
|
serializeManifestForSlackCli,
|
|
34
34
|
setActiveTeam
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-X3FLX6EO.js";
|
|
36
36
|
|
|
37
37
|
// src/bin/agt.ts
|
|
38
38
|
import { join as join11 } from "path";
|
|
@@ -3411,7 +3411,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
3411
3411
|
import { execSync } from "child_process";
|
|
3412
3412
|
import chalk19 from "chalk";
|
|
3413
3413
|
import ora15 from "ora";
|
|
3414
|
-
var cliVersion = true ? "0.7.
|
|
3414
|
+
var cliVersion = true ? "0.7.9" : "dev";
|
|
3415
3415
|
async function fetchLatestVersion() {
|
|
3416
3416
|
const host2 = AGT_HOST;
|
|
3417
3417
|
if (!host2) return null;
|
|
@@ -3527,7 +3527,7 @@ async function checkForUpdateOnStartup() {
|
|
|
3527
3527
|
}
|
|
3528
3528
|
|
|
3529
3529
|
// src/bin/agt.ts
|
|
3530
|
-
var cliVersion2 = true ? "0.7.
|
|
3530
|
+
var cliVersion2 = true ? "0.7.9" : "dev";
|
|
3531
3531
|
var program = new Command();
|
|
3532
3532
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
3533
3533
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -1866,13 +1866,35 @@ Two types of memory files, both plain Markdown:
|
|
|
1866
1866
|
|
|
1867
1867
|
${recall}`;
|
|
1868
1868
|
}
|
|
1869
|
+
function buildIntegrationsSection(integrations) {
|
|
1870
|
+
if (!integrations?.length)
|
|
1871
|
+
return "";
|
|
1872
|
+
const lines = integrations.map((i) => {
|
|
1873
|
+
const cli = i.cliBinary ? ` \u2014 use the \`${i.cliBinary}\` CLI` : "";
|
|
1874
|
+
return `- **${i.name}**${cli}${i.description ? `. ${i.description}` : ""}`;
|
|
1875
|
+
});
|
|
1876
|
+
const hasAnyCli = integrations.some((i) => i.cliBinary);
|
|
1877
|
+
const intro = hasAnyCli ? `You have the following integrations configured. Where a CLI is listed,
|
|
1878
|
+
use it instead of web fetch, curl, or MCP \u2014 the CLI handles auth
|
|
1879
|
+
automatically via pre-configured environment variables.` : "You have the following integrations configured.";
|
|
1880
|
+
return `## Integrations
|
|
1881
|
+
|
|
1882
|
+
${intro}
|
|
1883
|
+
|
|
1884
|
+
${lines.join("\n")}
|
|
1885
|
+
|
|
1886
|
+
Check \`.claude/skills/\` for detailed usage instructions for each integration.
|
|
1887
|
+
|
|
1888
|
+
`;
|
|
1889
|
+
}
|
|
1869
1890
|
function generateClaudeMd(input) {
|
|
1870
|
-
const { frontmatter, role, description, resolvedChannels, team, consoleUrl, hasQmd } = input;
|
|
1891
|
+
const { frontmatter, role, description, resolvedChannels, team, consoleUrl, hasQmd, integrations } = input;
|
|
1871
1892
|
const channelList = resolvedChannels?.length ? resolvedChannels.join(", ") : "none";
|
|
1872
1893
|
const roleDisplay = role ?? "Agent";
|
|
1873
1894
|
const desc = description?.trim();
|
|
1874
1895
|
const kanbanUrl = consoleUrl ? `${consoleUrl}/agents/${frontmatter.agent_id}?tab=kanban` : null;
|
|
1875
1896
|
const memorySection = buildMemorySection(hasQmd);
|
|
1897
|
+
const integrationsSection = buildIntegrationsSection(integrations);
|
|
1876
1898
|
return `# ${frontmatter.display_name}
|
|
1877
1899
|
|
|
1878
1900
|
You are **${frontmatter.display_name}**, **${roleDisplay}**${team ? ` at **${team.name}**` : ""}.
|
|
@@ -1890,11 +1912,12 @@ ${desc}
|
|
|
1890
1912
|
## Governance
|
|
1891
1913
|
|
|
1892
1914
|
This agent is governed by Augmented (ARIS). Policy, budget, and channel rules
|
|
1893
|
-
are defined in \`CHARTER.md\`.
|
|
1915
|
+
are defined in \`CHARTER.md\`.
|
|
1894
1916
|
|
|
1895
1917
|
- Budget: ${frontmatter.budget?.limit_tokens ? `${frontmatter.budget.limit_tokens} tokens/${frontmatter.budget.window}` : frontmatter.budget?.limit_dollars ? `$${frontmatter.budget.limit_dollars}/${frontmatter.budget.window}` : "unlimited"}
|
|
1896
1918
|
- Logging: ${frontmatter.logging_mode}
|
|
1897
|
-
- Enforcement: Follow CHARTER.md
|
|
1919
|
+
- Enforcement: Follow CHARTER.md constraints strictly.
|
|
1920
|
+
- Tools: MCP tools available in your session are authorized. Use only tools that succeed when called \u2014 if a tool call is denied, do not retry it.
|
|
1898
1921
|
|
|
1899
1922
|
## Work Management
|
|
1900
1923
|
|
|
@@ -1915,7 +1938,7 @@ first to load your recent board state. This gives you context about completed an
|
|
|
1915
1938
|
in-progress items so you can answer accurately.
|
|
1916
1939
|
|
|
1917
1940
|
${memorySection}
|
|
1918
|
-
## Rules
|
|
1941
|
+
${integrationsSection}## Rules
|
|
1919
1942
|
|
|
1920
1943
|
- Never expose secrets or API keys in output.
|
|
1921
1944
|
- Respect channel restrictions \u2014 only operate on allowed channels.
|
|
@@ -1985,7 +2008,11 @@ function deployArtifactsToProject(codeName, provisionDir) {
|
|
|
1985
2008
|
}
|
|
1986
2009
|
const projectServers = projectMcp["mcpServers"] ?? {};
|
|
1987
2010
|
const agentServers = agentMcp["mcpServers"] ?? {};
|
|
1988
|
-
|
|
2011
|
+
const stripRelativeUrls = (servers) => Object.fromEntries(Object.entries(servers).filter(([, val]) => {
|
|
2012
|
+
const entry = val;
|
|
2013
|
+
return !(entry && typeof entry["url"] === "string" && entry["url"].startsWith("/"));
|
|
2014
|
+
}));
|
|
2015
|
+
projectMcp["mcpServers"] = { ...stripRelativeUrls(projectServers), ...stripRelativeUrls(agentServers) };
|
|
1989
2016
|
writeFileSync3(projectMcpPath, JSON.stringify(projectMcp, null, 2));
|
|
1990
2017
|
} catch {
|
|
1991
2018
|
}
|
|
@@ -1998,6 +2025,61 @@ function deployArtifactsToProject(codeName, provisionDir) {
|
|
|
1998
2025
|
}
|
|
1999
2026
|
}
|
|
2000
2027
|
}
|
|
2028
|
+
function provisionStopHook(codeName) {
|
|
2029
|
+
const projectDir = getProjectDir(codeName);
|
|
2030
|
+
const claudeDir = join3(projectDir, ".claude");
|
|
2031
|
+
mkdirSync3(claudeDir, { recursive: true });
|
|
2032
|
+
const hookScriptPath = join3(claudeDir, "agt-stop-hook.sh");
|
|
2033
|
+
const hookScript = [
|
|
2034
|
+
"#!/bin/bash",
|
|
2035
|
+
"# Auto-generated by Augmented \u2014 captures persistent session task results.",
|
|
2036
|
+
"set -euo pipefail",
|
|
2037
|
+
"INPUT=$(cat)",
|
|
2038
|
+
`TRANSCRIPT_PATH=$(echo "$INPUT" | jq -r '.transcript_path // empty')`,
|
|
2039
|
+
'[ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ] && exit 0',
|
|
2040
|
+
`CWD=$(echo "$INPUT" | jq -r '.cwd // empty')`,
|
|
2041
|
+
'MARKER="${CWD}/.claude/.agt-pending-task.json"',
|
|
2042
|
+
'[ ! -f "$MARKER" ] && exit 0',
|
|
2043
|
+
`AGENT_ID=$(jq -r '.agent_id // empty' "$MARKER")`,
|
|
2044
|
+
`TEMPLATE_ID=$(jq -r '.template_id // empty' "$MARKER")`,
|
|
2045
|
+
'[ -z "$AGENT_ID" ] && { rm -f "$MARKER"; exit 0; }',
|
|
2046
|
+
`RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null)`,
|
|
2047
|
+
`[ -z "$RESP" ] && RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.role == "assistant") | .content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null)`,
|
|
2048
|
+
'[ -z "$RESP" ] && { rm -f "$MARKER"; exit 0; }',
|
|
2049
|
+
'rm -f "$MARKER"',
|
|
2050
|
+
'AGT_HOST="${AGT_HOST:-}"; AGT_API_KEY="${AGT_API_KEY:-}"',
|
|
2051
|
+
'[ -z "$AGT_HOST" ] || [ -z "$AGT_API_KEY" ] && exit 0',
|
|
2052
|
+
'JWT=$(curl -sf -X POST "${AGT_HOST}/host/exchange" -H "Content-Type: application/json" -d "{\\"api_key\\": \\"${AGT_API_KEY}\\"}" | jq -r \'.token // empty\' 2>/dev/null)',
|
|
2053
|
+
'[ -z "$JWT" ] && exit 0',
|
|
2054
|
+
'case "$TEMPLATE_ID" in',
|
|
2055
|
+
" daily-standup|standup|weekly-standup)",
|
|
2056
|
+
` curl -sf -X POST "\${AGT_HOST}/host/agent-status" -H "Content-Type: application/json" -H "Authorization: Bearer $JWT" -d "$(jq -n --arg a \\"$AGENT_ID\\" --arg s \\"$RESP\\" '{agent_id:$a,standup:$s,current_status:"idle"}')" >/dev/null 2>&1 & ;;`,
|
|
2057
|
+
" *)",
|
|
2058
|
+
` curl -sf -X POST "\${AGT_HOST}/host/agent-status" -H "Content-Type: application/json" -H "Authorization: Bearer $JWT" -d "$(jq -n --arg a \\"$AGENT_ID\\" --arg t \\"$RESP\\" '{agent_id:$a,current_tasks:$t}')" >/dev/null 2>&1 & ;;`,
|
|
2059
|
+
"esac",
|
|
2060
|
+
"exit 0"
|
|
2061
|
+
].join("\n") + "\n";
|
|
2062
|
+
writeFileSync3(hookScriptPath, hookScript, { mode: 493 });
|
|
2063
|
+
const settingsPath = join3(claudeDir, "settings.local.json");
|
|
2064
|
+
let settings = {};
|
|
2065
|
+
try {
|
|
2066
|
+
settings = JSON.parse(readFileSync3(settingsPath, "utf-8"));
|
|
2067
|
+
} catch {
|
|
2068
|
+
}
|
|
2069
|
+
const hooks = settings["hooks"] ?? {};
|
|
2070
|
+
hooks["Stop"] = [
|
|
2071
|
+
{
|
|
2072
|
+
hooks: [
|
|
2073
|
+
{
|
|
2074
|
+
type: "command",
|
|
2075
|
+
command: hookScriptPath
|
|
2076
|
+
}
|
|
2077
|
+
]
|
|
2078
|
+
}
|
|
2079
|
+
];
|
|
2080
|
+
settings["hooks"] = hooks;
|
|
2081
|
+
writeFileSync3(settingsPath, JSON.stringify(settings, null, 2));
|
|
2082
|
+
}
|
|
2001
2083
|
function modifyJsonConfig(filePath, fn) {
|
|
2002
2084
|
let originalContent;
|
|
2003
2085
|
let config;
|
|
@@ -2106,6 +2188,15 @@ var claudeCodeAdapter = {
|
|
|
2106
2188
|
label: "Claude Code",
|
|
2107
2189
|
cliBinary: "claude",
|
|
2108
2190
|
buildArtifacts(input) {
|
|
2191
|
+
const integrationSummaries = (input.integrations ?? []).map((i) => {
|
|
2192
|
+
const def = INTEGRATION_REGISTRY.find((d) => d.id === i.definition_id);
|
|
2193
|
+
return {
|
|
2194
|
+
id: i.definition_id,
|
|
2195
|
+
name: i.display_name || def?.name || i.definition_id,
|
|
2196
|
+
cliBinary: def?.cli_tool?.binary,
|
|
2197
|
+
description: def?.description
|
|
2198
|
+
};
|
|
2199
|
+
});
|
|
2109
2200
|
const claudeMdInput = {
|
|
2110
2201
|
frontmatter: input.charterFrontmatter,
|
|
2111
2202
|
role: input.agent.role,
|
|
@@ -2113,7 +2204,8 @@ var claudeCodeAdapter = {
|
|
|
2113
2204
|
resolvedChannels: input.resolvedChannels,
|
|
2114
2205
|
team: input.team,
|
|
2115
2206
|
consoleUrl: process.env["NEXT_PUBLIC_APP_URL"] || process.env["AGT_CONSOLE_URL"] || void 0,
|
|
2116
|
-
hasQmd: input.integrations?.some((i) => i.definition_id === "qmd") ?? false
|
|
2207
|
+
hasQmd: input.integrations?.some((i) => i.definition_id === "qmd") ?? false,
|
|
2208
|
+
integrations: integrationSummaries
|
|
2117
2209
|
};
|
|
2118
2210
|
return [
|
|
2119
2211
|
{ relativePath: "CLAUDE.md", content: generateClaudeMd(claudeMdInput) },
|
|
@@ -2400,6 +2492,36 @@ var claudeCodeAdapter = {
|
|
|
2400
2492
|
if (hasQmd) {
|
|
2401
2493
|
this.writeMcpServer(codeName, "qmd", { command: "qmd", args: ["mcp"] });
|
|
2402
2494
|
}
|
|
2495
|
+
const projectDir = getProjectDir(codeName);
|
|
2496
|
+
const claudeMdPath = join3(projectDir, "CLAUDE.md");
|
|
2497
|
+
try {
|
|
2498
|
+
const existing = readFileSync3(claudeMdPath, "utf-8");
|
|
2499
|
+
const summaries = integrations.map((i) => {
|
|
2500
|
+
const def = INTEGRATION_REGISTRY.find((d) => d.id === i.definition_id);
|
|
2501
|
+
return {
|
|
2502
|
+
id: i.definition_id,
|
|
2503
|
+
name: def?.name || i.definition_id,
|
|
2504
|
+
cliBinary: def?.cli_tool?.binary,
|
|
2505
|
+
description: def?.description
|
|
2506
|
+
};
|
|
2507
|
+
});
|
|
2508
|
+
const newSection = buildIntegrationsSection(summaries);
|
|
2509
|
+
let updated;
|
|
2510
|
+
if (existing.includes("## Integrations")) {
|
|
2511
|
+
updated = existing.replace(/## Integrations[\s\S]*?(?=## Rules)/, newSection);
|
|
2512
|
+
} else {
|
|
2513
|
+
updated = existing.replace("## Rules", `${newSection}## Rules`);
|
|
2514
|
+
}
|
|
2515
|
+
writeFileSync3(claudeMdPath, updated);
|
|
2516
|
+
const agentDir2 = getAgentDir(codeName);
|
|
2517
|
+
const envSrc = join3(agentDir2, ".env.integrations");
|
|
2518
|
+
try {
|
|
2519
|
+
const envContent = readFileSync3(envSrc, "utf-8");
|
|
2520
|
+
writeFileSync3(join3(projectDir, ".env.integrations"), envContent);
|
|
2521
|
+
} catch {
|
|
2522
|
+
}
|
|
2523
|
+
} catch {
|
|
2524
|
+
}
|
|
2403
2525
|
},
|
|
2404
2526
|
writeMcpServer(codeName, serverId, config) {
|
|
2405
2527
|
const agentDir = getAgentDir(codeName);
|
|
@@ -2415,15 +2537,38 @@ var claudeCodeAdapter = {
|
|
|
2415
2537
|
mcpConfig["mcpServers"] = {};
|
|
2416
2538
|
}
|
|
2417
2539
|
const mcpServers = mcpConfig["mcpServers"];
|
|
2418
|
-
|
|
2419
|
-
if (config
|
|
2420
|
-
serverEntry
|
|
2421
|
-
|
|
2422
|
-
|
|
2540
|
+
let serverEntry;
|
|
2541
|
+
if ("url" in config) {
|
|
2542
|
+
serverEntry = { type: "sse", url: config.url };
|
|
2543
|
+
if (config.headers && Object.keys(config.headers).length)
|
|
2544
|
+
serverEntry["headers"] = config.headers;
|
|
2545
|
+
} else {
|
|
2546
|
+
serverEntry = { command: config.command };
|
|
2547
|
+
if (config.args?.length)
|
|
2548
|
+
serverEntry["args"] = config.args;
|
|
2549
|
+
if (config.env && Object.keys(config.env).length)
|
|
2550
|
+
serverEntry["env"] = config.env;
|
|
2551
|
+
}
|
|
2423
2552
|
mcpServers[serverId] = serverEntry;
|
|
2424
2553
|
writeFileSync3(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
2425
2554
|
syncMcpToProject(codeName);
|
|
2426
2555
|
},
|
|
2556
|
+
removeMcpServer(codeName, serverId) {
|
|
2557
|
+
const agentDir = getAgentDir(codeName);
|
|
2558
|
+
const mcpJsonPath = join3(agentDir, "provision", ".mcp.json");
|
|
2559
|
+
let mcpConfig;
|
|
2560
|
+
try {
|
|
2561
|
+
mcpConfig = JSON.parse(readFileSync3(mcpJsonPath, "utf-8"));
|
|
2562
|
+
} catch {
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
const mcpServers = mcpConfig["mcpServers"];
|
|
2566
|
+
if (!mcpServers || !(serverId in mcpServers))
|
|
2567
|
+
return;
|
|
2568
|
+
delete mcpServers[serverId];
|
|
2569
|
+
writeFileSync3(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
2570
|
+
syncMcpToProject(codeName);
|
|
2571
|
+
},
|
|
2427
2572
|
installSkillFiles(codeName, skillId, files) {
|
|
2428
2573
|
assertValidCodeName(skillId);
|
|
2429
2574
|
const agentDir = getAgentDir(codeName);
|
|
@@ -4568,6 +4713,7 @@ export {
|
|
|
4568
4713
|
CHANNEL_REGISTRY,
|
|
4569
4714
|
getChannel,
|
|
4570
4715
|
getAllChannelIds,
|
|
4716
|
+
provisionStopHook,
|
|
4571
4717
|
getApiKey,
|
|
4572
4718
|
getActiveTeam,
|
|
4573
4719
|
setActiveTeam,
|
|
@@ -4598,4 +4744,4 @@ export {
|
|
|
4598
4744
|
detectDrift,
|
|
4599
4745
|
provision
|
|
4600
4746
|
};
|
|
4601
|
-
//# sourceMappingURL=chunk-
|
|
4747
|
+
//# sourceMappingURL=chunk-X3FLX6EO.js.map
|