@integrity-labs/agt-cli 0.10.28 → 0.11.0
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 +3 -3
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-G44TMA6G.js → chunk-WTMVQND4.js} +455 -269
- package/dist/chunk-WTMVQND4.js.map +1 -0
- package/dist/lib/manager-worker.js +10 -4
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/slack-channel.js +161 -13
- package/package.json +1 -1
- package/dist/chunk-G44TMA6G.js.map +0 -1
|
@@ -12,8 +12,8 @@ function getFramework(id) {
|
|
|
12
12
|
|
|
13
13
|
// ../../packages/core/dist/provisioning/frameworks/openclaw/index.js
|
|
14
14
|
import { execFile, spawn } from "child_process";
|
|
15
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync, chmodSync, renameSync, symlinkSync } from "fs";
|
|
16
|
-
import { join, dirname, resolve } from "path";
|
|
15
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync2, unlinkSync as unlinkSync2, chmodSync as chmodSync2, renameSync as renameSync2, symlinkSync } from "fs";
|
|
16
|
+
import { join as join2, dirname as dirname2, resolve } from "path";
|
|
17
17
|
|
|
18
18
|
// ../../packages/core/dist/scheduled-tasks/prompt-wrapper.js
|
|
19
19
|
var EXECUTION_PREAMBLE = [
|
|
@@ -50,6 +50,168 @@ var DEFAULT_MODELS = {
|
|
|
50
50
|
tertiary: "openrouter/openai/gpt-5.4-nano"
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
// ../../packages/core/dist/integrations/xurl-config.js
|
|
54
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
55
|
+
import { homedir } from "os";
|
|
56
|
+
import { dirname, join } from "path";
|
|
57
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
58
|
+
var XURL_FILE_MODE = 384;
|
|
59
|
+
var XURL_AGT_APP_PREFIX = "agt-";
|
|
60
|
+
function asString(v) {
|
|
61
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
62
|
+
}
|
|
63
|
+
function xurlAppNameFor(integration) {
|
|
64
|
+
const username = asString(integration.config?.["x_username"]);
|
|
65
|
+
const base = `${XURL_AGT_APP_PREFIX}${integration.definition_id}`;
|
|
66
|
+
return username ? `${base}-${username.toLowerCase()}` : base;
|
|
67
|
+
}
|
|
68
|
+
function buildXurlAppFromIntegration(integration) {
|
|
69
|
+
const cfg = integration.config ?? {};
|
|
70
|
+
const creds = integration.credentials ?? {};
|
|
71
|
+
const app = {
|
|
72
|
+
client_id: asString(cfg["client_id"]) ?? "",
|
|
73
|
+
client_secret: asString(cfg["client_secret"]) ?? ""
|
|
74
|
+
};
|
|
75
|
+
const apiKey = asString(creds["api_key"]);
|
|
76
|
+
if (integration.auth_type === "api_key" && apiKey) {
|
|
77
|
+
app.bearer_token = { type: "bearer", bearer: apiKey };
|
|
78
|
+
}
|
|
79
|
+
const accessToken = asString(creds["access_token"]);
|
|
80
|
+
if (integration.auth_type === "oauth2" && accessToken) {
|
|
81
|
+
const username = asString(cfg["x_username"]) ?? "default";
|
|
82
|
+
const expiresAt = asString(creds["token_expires_at"]);
|
|
83
|
+
const expirationTime = expiresAt ? Math.floor(Date.parse(expiresAt) / 1e3) : 0;
|
|
84
|
+
app.oauth2_tokens = {
|
|
85
|
+
[username]: {
|
|
86
|
+
type: "oauth2",
|
|
87
|
+
oauth2: {
|
|
88
|
+
access_token: accessToken,
|
|
89
|
+
refresh_token: asString(creds["refresh_token"]) ?? "",
|
|
90
|
+
expiration_time: Number.isFinite(expirationTime) ? expirationTime : 0
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
app.default_user = username;
|
|
95
|
+
}
|
|
96
|
+
const ck = asString(cfg["oauth1_consumer_key"]);
|
|
97
|
+
const cs = asString(cfg["oauth1_consumer_secret"]);
|
|
98
|
+
const at = asString(cfg["oauth1_access_token"]);
|
|
99
|
+
const ts = asString(cfg["oauth1_token_secret"]);
|
|
100
|
+
if (ck && cs && at && ts) {
|
|
101
|
+
app.oauth1_token = {
|
|
102
|
+
type: "oauth1",
|
|
103
|
+
oauth1: { access_token: at, token_secret: ts, consumer_key: ck, consumer_secret: cs }
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (!app.bearer_token && !app.oauth2_tokens && !app.oauth1_token) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return app;
|
|
110
|
+
}
|
|
111
|
+
function mergeXurlStore(existing, agtApps) {
|
|
112
|
+
const apps = {};
|
|
113
|
+
for (const [name, app] of Object.entries(existing?.apps ?? {})) {
|
|
114
|
+
if (!name.startsWith(XURL_AGT_APP_PREFIX))
|
|
115
|
+
apps[name] = app;
|
|
116
|
+
}
|
|
117
|
+
for (const [name, app] of Object.entries(agtApps)) {
|
|
118
|
+
apps[name] = app;
|
|
119
|
+
}
|
|
120
|
+
let default_app = existing?.default_app;
|
|
121
|
+
if (default_app && !apps[default_app]) {
|
|
122
|
+
default_app = void 0;
|
|
123
|
+
}
|
|
124
|
+
if (!default_app) {
|
|
125
|
+
default_app = Object.keys(apps).find((n) => n.startsWith(XURL_AGT_APP_PREFIX));
|
|
126
|
+
}
|
|
127
|
+
const result = { apps };
|
|
128
|
+
if (default_app)
|
|
129
|
+
result.default_app = default_app;
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
function parseXurlStore(yaml) {
|
|
133
|
+
if (!yaml)
|
|
134
|
+
return null;
|
|
135
|
+
try {
|
|
136
|
+
const parsed = parseYaml(yaml);
|
|
137
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
138
|
+
return null;
|
|
139
|
+
const obj = parsed;
|
|
140
|
+
const hasApps = "apps" in obj;
|
|
141
|
+
const hasDefault = "default_app" in obj;
|
|
142
|
+
if (!hasApps && !hasDefault)
|
|
143
|
+
return null;
|
|
144
|
+
if (hasApps && obj["apps"] != null && (typeof obj["apps"] !== "object" || Array.isArray(obj["apps"]))) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (hasDefault && obj["default_app"] != null && typeof obj["default_app"] !== "string") {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
apps: obj["apps"] ?? {},
|
|
152
|
+
...typeof obj["default_app"] === "string" && obj["default_app"] ? { default_app: obj["default_app"] } : {}
|
|
153
|
+
};
|
|
154
|
+
} catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function serializeXurlStore(store) {
|
|
159
|
+
return stringifyYaml(store);
|
|
160
|
+
}
|
|
161
|
+
function buildAgtXurlApps(integrations) {
|
|
162
|
+
const result = {};
|
|
163
|
+
for (const integration of integrations) {
|
|
164
|
+
if (integration.definition_id !== "xurl")
|
|
165
|
+
continue;
|
|
166
|
+
const app = buildXurlAppFromIntegration(integration);
|
|
167
|
+
if (app) {
|
|
168
|
+
result[xurlAppNameFor(integration)] = app;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
function getXurlStorePath() {
|
|
174
|
+
const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? homedir();
|
|
175
|
+
return join(home, ".xurl");
|
|
176
|
+
}
|
|
177
|
+
function writeXurlStoreForIntegrations(integrations, filePath = getXurlStorePath()) {
|
|
178
|
+
const agtApps = buildAgtXurlApps(integrations);
|
|
179
|
+
if (Object.keys(agtApps).length === 0)
|
|
180
|
+
return null;
|
|
181
|
+
let existing = null;
|
|
182
|
+
if (existsSync(filePath)) {
|
|
183
|
+
let raw;
|
|
184
|
+
try {
|
|
185
|
+
raw = readFileSync(filePath, "utf-8");
|
|
186
|
+
} catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
const parsed = parseXurlStore(raw);
|
|
190
|
+
if (!parsed && raw.trim().length > 0) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
existing = parsed;
|
|
194
|
+
}
|
|
195
|
+
const merged = mergeXurlStore(existing, agtApps);
|
|
196
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
197
|
+
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
198
|
+
writeFileSync(tmpPath, serializeXurlStore(merged), { mode: XURL_FILE_MODE });
|
|
199
|
+
try {
|
|
200
|
+
renameSync(tmpPath, filePath);
|
|
201
|
+
} catch (err) {
|
|
202
|
+
try {
|
|
203
|
+
unlinkSync(tmpPath);
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
throw err;
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
chmodSync(filePath, XURL_FILE_MODE);
|
|
210
|
+
} catch {
|
|
211
|
+
}
|
|
212
|
+
return filePath;
|
|
213
|
+
}
|
|
214
|
+
|
|
53
215
|
// ../../packages/core/dist/channels/registry.js
|
|
54
216
|
var CHANNEL_REGISTRY = [
|
|
55
217
|
{ id: "slack", name: "Slack", securityTier: "standard", e2eEncrypted: false, auditTrail: true, publicExposureRisk: "Low" },
|
|
@@ -262,6 +424,26 @@ var INTEGRATION_REGISTRY = [
|
|
|
262
424
|
},
|
|
263
425
|
docs_url: "https://docs.anthropic.com/en/docs/claude-code"
|
|
264
426
|
},
|
|
427
|
+
{
|
|
428
|
+
id: "xurl",
|
|
429
|
+
name: "xurl (X API)",
|
|
430
|
+
category: "social",
|
|
431
|
+
description: "Official X (Twitter) API CLI \u2014 a curl-like tool for X's REST and streaming endpoints with OAuth 2.0 PKCE, OAuth 1.0a, and bearer-token auth",
|
|
432
|
+
supported_auth_types: ["api_key"],
|
|
433
|
+
capabilities: [
|
|
434
|
+
{ id: "xurl:read", name: "Read X API", description: "Call GET endpoints (users, tweets, timelines, search)", access: "read" },
|
|
435
|
+
{ id: "xurl:write", name: "Write X API", description: "Post tweets, reply, like, and retweet", access: "write" },
|
|
436
|
+
{ id: "xurl:stream", name: "Stream X API", description: "Consume filtered and sampled stream endpoints", access: "read" },
|
|
437
|
+
{ id: "xurl:media", name: "Upload Media", description: "Chunked upload of images and video to the X media endpoints", access: "write" }
|
|
438
|
+
],
|
|
439
|
+
cli_tool: {
|
|
440
|
+
package: "@xdevplatform/xurl",
|
|
441
|
+
binary: "xurl",
|
|
442
|
+
env_key: "X_BEARER_TOKEN",
|
|
443
|
+
skill_id: "xurl-cli"
|
|
444
|
+
},
|
|
445
|
+
docs_url: "https://github.com/xdevplatform/xurl"
|
|
446
|
+
},
|
|
265
447
|
{
|
|
266
448
|
id: "custom",
|
|
267
449
|
name: "Custom Integration",
|
|
@@ -379,7 +561,7 @@ function mapIntegrationsToOpenClaw(integrations) {
|
|
|
379
561
|
}
|
|
380
562
|
var QMD_SEARCH_MODES = /* @__PURE__ */ new Set(["search", "vsearch", "query"]);
|
|
381
563
|
var QMD_CITATIONS = /* @__PURE__ */ new Set(["auto", "on", "off"]);
|
|
382
|
-
function
|
|
564
|
+
function asString2(v) {
|
|
383
565
|
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
384
566
|
}
|
|
385
567
|
function asBoolean(v) {
|
|
@@ -390,11 +572,11 @@ function asPositiveInt(v) {
|
|
|
390
572
|
}
|
|
391
573
|
function mapQmdConfig(cfg) {
|
|
392
574
|
const qmd = {};
|
|
393
|
-
const command =
|
|
575
|
+
const command = asString2(cfg.command);
|
|
394
576
|
if (command)
|
|
395
577
|
qmd.command = command;
|
|
396
578
|
if (cfg.searchMode !== void 0) {
|
|
397
|
-
const mode =
|
|
579
|
+
const mode = asString2(cfg.searchMode);
|
|
398
580
|
if (mode && QMD_SEARCH_MODES.has(mode)) {
|
|
399
581
|
qmd.searchMode = mode;
|
|
400
582
|
}
|
|
@@ -402,7 +584,7 @@ function mapQmdConfig(cfg) {
|
|
|
402
584
|
const includeDefaultMemory = asBoolean(cfg.includeDefaultMemory);
|
|
403
585
|
if (includeDefaultMemory !== void 0)
|
|
404
586
|
qmd.includeDefaultMemory = includeDefaultMemory;
|
|
405
|
-
const updateInterval =
|
|
587
|
+
const updateInterval = asString2(cfg.updateInterval);
|
|
406
588
|
const updateDebounceMs = asPositiveInt(cfg.updateDebounceMs);
|
|
407
589
|
if (updateInterval || updateDebounceMs !== void 0) {
|
|
408
590
|
qmd.update = {};
|
|
@@ -437,7 +619,7 @@ function mapQmdConfig(cfg) {
|
|
|
437
619
|
qmd
|
|
438
620
|
};
|
|
439
621
|
if (cfg.citations !== void 0) {
|
|
440
|
-
const citations =
|
|
622
|
+
const citations = asString2(cfg.citations);
|
|
441
623
|
if (citations && QMD_CITATIONS.has(citations)) {
|
|
442
624
|
result.citations = citations;
|
|
443
625
|
}
|
|
@@ -622,9 +804,9 @@ function getHomeDir() {
|
|
|
622
804
|
}
|
|
623
805
|
function writeIntegrationTokenFile(codeName, integrations) {
|
|
624
806
|
const homeDir = getHomeDir();
|
|
625
|
-
const dir =
|
|
626
|
-
const tokenFilePath =
|
|
627
|
-
const tmpFilePath =
|
|
807
|
+
const dir = join2(homeDir, `.openclaw-${codeName}`);
|
|
808
|
+
const tokenFilePath = join2(dir, ".tokens.json");
|
|
809
|
+
const tmpFilePath = join2(dir, ".tokens.json.tmp");
|
|
628
810
|
const tokens = {};
|
|
629
811
|
for (const integration of integrations) {
|
|
630
812
|
if (integration.auth_type !== "oauth2")
|
|
@@ -640,24 +822,24 @@ function writeIntegrationTokenFile(codeName, integrations) {
|
|
|
640
822
|
}
|
|
641
823
|
if (Object.keys(tokens).length === 0)
|
|
642
824
|
return;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
825
|
+
mkdirSync2(dir, { recursive: true });
|
|
826
|
+
writeFileSync2(tmpFilePath, JSON.stringify(tokens, null, 2));
|
|
827
|
+
chmodSync2(tmpFilePath, 384);
|
|
828
|
+
renameSync2(tmpFilePath, tokenFilePath);
|
|
647
829
|
}
|
|
648
830
|
function getOpenClawConfigPath(profile) {
|
|
649
831
|
const homeDir = getHomeDir();
|
|
650
832
|
if (profile) {
|
|
651
|
-
return
|
|
833
|
+
return join2(homeDir, `.openclaw-${profile}`, "openclaw.json");
|
|
652
834
|
}
|
|
653
|
-
return
|
|
835
|
+
return join2(homeDir, ".openclaw", "openclaw.json");
|
|
654
836
|
}
|
|
655
837
|
function modifyOpenClawConfig(fn, profile) {
|
|
656
838
|
const configFile = getOpenClawConfigPath(profile);
|
|
657
839
|
let originalContent;
|
|
658
840
|
let config;
|
|
659
841
|
try {
|
|
660
|
-
originalContent =
|
|
842
|
+
originalContent = readFileSync2(configFile, "utf-8");
|
|
661
843
|
config = JSON.parse(originalContent);
|
|
662
844
|
} catch {
|
|
663
845
|
return;
|
|
@@ -668,21 +850,21 @@ function modifyOpenClawConfig(fn, profile) {
|
|
|
668
850
|
const newContent = JSON.stringify(config, null, 2);
|
|
669
851
|
if (newContent === originalContent)
|
|
670
852
|
return;
|
|
671
|
-
|
|
853
|
+
writeFileSync2(configFile, newContent);
|
|
672
854
|
}
|
|
673
|
-
var AUGMENTED_DIR =
|
|
855
|
+
var AUGMENTED_DIR = join2(getHomeDir(), ".augmented");
|
|
674
856
|
function getGatewayPidPath(codeName) {
|
|
675
|
-
return
|
|
857
|
+
return join2(AUGMENTED_DIR, codeName, "gateway.pid");
|
|
676
858
|
}
|
|
677
859
|
function getGatewayLogPath(codeName) {
|
|
678
|
-
return
|
|
860
|
+
return join2(AUGMENTED_DIR, codeName, "gateway.log");
|
|
679
861
|
}
|
|
680
862
|
function getGatewayPortsPath() {
|
|
681
|
-
return
|
|
863
|
+
return join2(AUGMENTED_DIR, "gateway-ports.json");
|
|
682
864
|
}
|
|
683
865
|
function readGatewayPid(codeName) {
|
|
684
866
|
try {
|
|
685
|
-
const raw =
|
|
867
|
+
const raw = readFileSync2(getGatewayPidPath(codeName), "utf-8").trim();
|
|
686
868
|
const pid = parseInt(raw, 10);
|
|
687
869
|
return isNaN(pid) ? null : pid;
|
|
688
870
|
} catch {
|
|
@@ -730,14 +912,14 @@ function execPromise(cmd, args) {
|
|
|
730
912
|
}
|
|
731
913
|
function readGatewayPorts() {
|
|
732
914
|
try {
|
|
733
|
-
return JSON.parse(
|
|
915
|
+
return JSON.parse(readFileSync2(getGatewayPortsPath(), "utf-8"));
|
|
734
916
|
} catch {
|
|
735
917
|
return {};
|
|
736
918
|
}
|
|
737
919
|
}
|
|
738
920
|
function ensureCronEnabled(codeName) {
|
|
739
921
|
const homeDir = getHomeDir();
|
|
740
|
-
const profileDir =
|
|
922
|
+
const profileDir = join2(homeDir, `.openclaw-${codeName}`);
|
|
741
923
|
modifyOpenClawConfig((config) => {
|
|
742
924
|
const cron = config["cron"];
|
|
743
925
|
if (cron?.["enabled"] === true)
|
|
@@ -745,7 +927,7 @@ function ensureCronEnabled(codeName) {
|
|
|
745
927
|
config["cron"] = {
|
|
746
928
|
...cron ?? {},
|
|
747
929
|
enabled: true,
|
|
748
|
-
store:
|
|
930
|
+
store: join2(profileDir, "cron", "jobs.json"),
|
|
749
931
|
maxConcurrentRuns: cron?.["maxConcurrentRuns"] ?? 1,
|
|
750
932
|
retry: cron?.["retry"] ?? {
|
|
751
933
|
maxAttempts: 3,
|
|
@@ -998,11 +1180,11 @@ ${entry.content}`
|
|
|
998
1180
|
},
|
|
999
1181
|
writeAuthProfiles(codeName, profiles) {
|
|
1000
1182
|
const homeDir = getHomeDir();
|
|
1001
|
-
const authDir =
|
|
1002
|
-
const authFile =
|
|
1183
|
+
const authDir = join2(homeDir, `.openclaw-${codeName}`, "agents", codeName, "agent");
|
|
1184
|
+
const authFile = join2(authDir, "auth-profiles.json");
|
|
1003
1185
|
let existing = {};
|
|
1004
1186
|
try {
|
|
1005
|
-
existing = JSON.parse(
|
|
1187
|
+
existing = JSON.parse(readFileSync2(authFile, "utf-8"));
|
|
1006
1188
|
} catch {
|
|
1007
1189
|
}
|
|
1008
1190
|
const existingProfiles = existing["profiles"] ?? {};
|
|
@@ -1023,12 +1205,12 @@ ${entry.content}`
|
|
|
1023
1205
|
lastGood: existing["lastGood"] ?? {},
|
|
1024
1206
|
usageStats: existing["usageStats"] ?? {}
|
|
1025
1207
|
};
|
|
1026
|
-
|
|
1027
|
-
|
|
1208
|
+
mkdirSync2(authDir, { recursive: true });
|
|
1209
|
+
writeFileSync2(authFile, JSON.stringify(output, null, 2));
|
|
1028
1210
|
},
|
|
1029
1211
|
async startGateway(codeName, port) {
|
|
1030
|
-
const agentAugDir =
|
|
1031
|
-
|
|
1212
|
+
const agentAugDir = join2(AUGMENTED_DIR, codeName);
|
|
1213
|
+
mkdirSync2(agentAugDir, { recursive: true });
|
|
1032
1214
|
const logPath = getGatewayLogPath(codeName);
|
|
1033
1215
|
const pidPath = getGatewayPidPath(codeName);
|
|
1034
1216
|
const child = spawn("openclaw", ["--profile", codeName, "gateway", "--port", String(port)], {
|
|
@@ -1061,7 +1243,7 @@ ${entry.content}`
|
|
|
1061
1243
|
}
|
|
1062
1244
|
}
|
|
1063
1245
|
}
|
|
1064
|
-
|
|
1246
|
+
writeFileSync2(pidPath, String(gatewayPid));
|
|
1065
1247
|
return { pid: gatewayPid, port };
|
|
1066
1248
|
},
|
|
1067
1249
|
async stopGateway(codeName) {
|
|
@@ -1070,7 +1252,7 @@ ${entry.content}`
|
|
|
1070
1252
|
return false;
|
|
1071
1253
|
if (!isProcessAlive(pid)) {
|
|
1072
1254
|
try {
|
|
1073
|
-
|
|
1255
|
+
unlinkSync2(getGatewayPidPath(codeName));
|
|
1074
1256
|
} catch {
|
|
1075
1257
|
}
|
|
1076
1258
|
return false;
|
|
@@ -1085,7 +1267,7 @@ ${entry.content}`
|
|
|
1085
1267
|
await new Promise((r) => setTimeout(r, 200));
|
|
1086
1268
|
if (!isProcessAlive(pid)) {
|
|
1087
1269
|
try {
|
|
1088
|
-
|
|
1270
|
+
unlinkSync2(getGatewayPidPath(codeName));
|
|
1089
1271
|
} catch {
|
|
1090
1272
|
}
|
|
1091
1273
|
return true;
|
|
@@ -1096,7 +1278,7 @@ ${entry.content}`
|
|
|
1096
1278
|
} catch {
|
|
1097
1279
|
}
|
|
1098
1280
|
try {
|
|
1099
|
-
|
|
1281
|
+
unlinkSync2(getGatewayPidPath(codeName));
|
|
1100
1282
|
} catch {
|
|
1101
1283
|
}
|
|
1102
1284
|
return true;
|
|
@@ -1113,7 +1295,7 @@ ${entry.content}`
|
|
|
1113
1295
|
if (portPid) {
|
|
1114
1296
|
try {
|
|
1115
1297
|
const pidPath = getGatewayPidPath(codeName);
|
|
1116
|
-
|
|
1298
|
+
writeFileSync2(pidPath, String(portPid));
|
|
1117
1299
|
} catch {
|
|
1118
1300
|
}
|
|
1119
1301
|
return { running: true, pid: portPid, port };
|
|
@@ -1121,7 +1303,7 @@ ${entry.content}`
|
|
|
1121
1303
|
}
|
|
1122
1304
|
if (pid) {
|
|
1123
1305
|
try {
|
|
1124
|
-
|
|
1306
|
+
unlinkSync2(getGatewayPidPath(codeName));
|
|
1125
1307
|
} catch {
|
|
1126
1308
|
}
|
|
1127
1309
|
}
|
|
@@ -1129,18 +1311,18 @@ ${entry.content}`
|
|
|
1129
1311
|
},
|
|
1130
1312
|
seedProfileConfig(codeName) {
|
|
1131
1313
|
const homeDir = getHomeDir();
|
|
1132
|
-
const sharedConfigPath =
|
|
1133
|
-
const profileDir =
|
|
1134
|
-
const profileConfigPath =
|
|
1314
|
+
const sharedConfigPath = join2(homeDir, ".openclaw", "openclaw.json");
|
|
1315
|
+
const profileDir = join2(homeDir, `.openclaw-${codeName}`);
|
|
1316
|
+
const profileConfigPath = join2(profileDir, "openclaw.json");
|
|
1135
1317
|
let sharedConfig;
|
|
1136
1318
|
try {
|
|
1137
|
-
sharedConfig = JSON.parse(
|
|
1319
|
+
sharedConfig = JSON.parse(readFileSync2(sharedConfigPath, "utf-8"));
|
|
1138
1320
|
} catch {
|
|
1139
1321
|
sharedConfig = {};
|
|
1140
1322
|
}
|
|
1141
|
-
if (
|
|
1323
|
+
if (existsSync2(profileConfigPath)) {
|
|
1142
1324
|
try {
|
|
1143
|
-
const existing = JSON.parse(
|
|
1325
|
+
const existing = JSON.parse(readFileSync2(profileConfigPath, "utf-8"));
|
|
1144
1326
|
let changed = false;
|
|
1145
1327
|
if (!existing["gateway"]) {
|
|
1146
1328
|
if (sharedConfig["gateway"]) {
|
|
@@ -1158,7 +1340,7 @@ ${entry.content}`
|
|
|
1158
1340
|
changed = true;
|
|
1159
1341
|
}
|
|
1160
1342
|
if (changed) {
|
|
1161
|
-
|
|
1343
|
+
writeFileSync2(profileConfigPath, JSON.stringify(existing, null, 2));
|
|
1162
1344
|
}
|
|
1163
1345
|
} catch {
|
|
1164
1346
|
}
|
|
@@ -1173,7 +1355,7 @@ ${entry.content}`
|
|
|
1173
1355
|
const seedAgents = {};
|
|
1174
1356
|
if (agents["defaults"]) {
|
|
1175
1357
|
const defaults = JSON.parse(JSON.stringify(agents["defaults"]));
|
|
1176
|
-
const augmentedDir =
|
|
1358
|
+
const augmentedDir = join2(getHomeDir(), ".augmented", codeName, "provision");
|
|
1177
1359
|
defaults["workspace"] = augmentedDir;
|
|
1178
1360
|
seedAgents["defaults"] = defaults;
|
|
1179
1361
|
}
|
|
@@ -1197,21 +1379,21 @@ ${entry.content}`
|
|
|
1197
1379
|
profileConfig["bindings"] = [];
|
|
1198
1380
|
profileConfig["cron"] = {
|
|
1199
1381
|
enabled: true,
|
|
1200
|
-
store:
|
|
1382
|
+
store: join2(profileDir, "cron", "jobs.json"),
|
|
1201
1383
|
maxConcurrentRuns: 1,
|
|
1202
1384
|
retry: {
|
|
1203
1385
|
maxAttempts: 3,
|
|
1204
1386
|
backoffMs: [6e4, 12e4, 3e5]
|
|
1205
1387
|
}
|
|
1206
1388
|
};
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
const agentAuthDir =
|
|
1210
|
-
const mainAgentDir =
|
|
1389
|
+
mkdirSync2(profileDir, { recursive: true });
|
|
1390
|
+
writeFileSync2(profileConfigPath, JSON.stringify(profileConfig, null, 2));
|
|
1391
|
+
const agentAuthDir = join2(profileDir, "agents", codeName, "agent");
|
|
1392
|
+
const mainAgentDir = join2(profileDir, "agents", "main", "agent");
|
|
1211
1393
|
try {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
if (!
|
|
1394
|
+
mkdirSync2(agentAuthDir, { recursive: true });
|
|
1395
|
+
mkdirSync2(join2(profileDir, "agents", "main"), { recursive: true });
|
|
1396
|
+
if (!existsSync2(mainAgentDir)) {
|
|
1215
1397
|
symlinkSync(agentAuthDir, mainAgentDir, "dir");
|
|
1216
1398
|
}
|
|
1217
1399
|
} catch {
|
|
@@ -1221,11 +1403,11 @@ ${entry.content}`
|
|
|
1221
1403
|
const integrationConfig = mapIntegrationsToOpenClaw(integrations);
|
|
1222
1404
|
if (Object.keys(integrationConfig.authProfiles).length > 0) {
|
|
1223
1405
|
const homeDir = getHomeDir();
|
|
1224
|
-
const authDir =
|
|
1225
|
-
const authFile =
|
|
1406
|
+
const authDir = join2(homeDir, `.openclaw-${codeName}`, "agents", codeName, "agent");
|
|
1407
|
+
const authFile = join2(authDir, "auth-profiles.json");
|
|
1226
1408
|
let existing = {};
|
|
1227
1409
|
try {
|
|
1228
|
-
existing = JSON.parse(
|
|
1410
|
+
existing = JSON.parse(readFileSync2(authFile, "utf-8"));
|
|
1229
1411
|
} catch {
|
|
1230
1412
|
}
|
|
1231
1413
|
const existingProfiles = existing["profiles"] ?? {};
|
|
@@ -1236,8 +1418,8 @@ ${entry.content}`
|
|
|
1236
1418
|
lastGood: existing["lastGood"] ?? {},
|
|
1237
1419
|
usageStats: existing["usageStats"] ?? {}
|
|
1238
1420
|
};
|
|
1239
|
-
|
|
1240
|
-
|
|
1421
|
+
mkdirSync2(authDir, { recursive: true });
|
|
1422
|
+
writeFileSync2(authFile, JSON.stringify(output, null, 2));
|
|
1241
1423
|
}
|
|
1242
1424
|
if (integrationConfig.toolAllow.length > 0) {
|
|
1243
1425
|
modifyOpenClawConfig((config) => {
|
|
@@ -1320,12 +1502,12 @@ ${entry.content}`
|
|
|
1320
1502
|
if (integrationConfig.memory) {
|
|
1321
1503
|
modifyOpenClawConfig((config) => {
|
|
1322
1504
|
const homeDir = getHomeDir();
|
|
1323
|
-
const qmdHome =
|
|
1505
|
+
const qmdHome = join2(homeDir, ".openclaw", "agents", codeName, "qmd");
|
|
1324
1506
|
const topEnv = config["env"] ?? {};
|
|
1325
1507
|
topEnv["QMD_HOME"] = qmdHome;
|
|
1326
1508
|
config["env"] = topEnv;
|
|
1327
1509
|
config["memory"] = integrationConfig.memory;
|
|
1328
|
-
|
|
1510
|
+
mkdirSync2(qmdHome, { recursive: true });
|
|
1329
1511
|
return true;
|
|
1330
1512
|
}, codeName);
|
|
1331
1513
|
} else {
|
|
@@ -1348,6 +1530,7 @@ ${entry.content}`
|
|
|
1348
1530
|
return changed;
|
|
1349
1531
|
}, codeName);
|
|
1350
1532
|
}
|
|
1533
|
+
writeXurlStoreForIntegrations(integrations);
|
|
1351
1534
|
writeIntegrationTokenFile(codeName, integrations);
|
|
1352
1535
|
},
|
|
1353
1536
|
writeTokenFile(codeName, integrations) {
|
|
@@ -1355,11 +1538,11 @@ ${entry.content}`
|
|
|
1355
1538
|
},
|
|
1356
1539
|
installSkillFiles(codeName, skillId, files) {
|
|
1357
1540
|
const homeDir = getHomeDir();
|
|
1358
|
-
const skillDir =
|
|
1541
|
+
const skillDir = join2(homeDir, `.openclaw-${codeName}`, "skills", skillId);
|
|
1359
1542
|
for (const file of files) {
|
|
1360
|
-
const filePath =
|
|
1361
|
-
|
|
1362
|
-
|
|
1543
|
+
const filePath = join2(skillDir, file.relativePath);
|
|
1544
|
+
mkdirSync2(dirname2(filePath), { recursive: true });
|
|
1545
|
+
writeFileSync2(filePath, file.content);
|
|
1363
1546
|
}
|
|
1364
1547
|
},
|
|
1365
1548
|
writeMcpServer(codeName, serverId, config) {
|
|
@@ -1401,9 +1584,9 @@ ${entry.content}`
|
|
|
1401
1584
|
}, codeName);
|
|
1402
1585
|
},
|
|
1403
1586
|
executePluginHook(ctx) {
|
|
1404
|
-
const agentDir =
|
|
1405
|
-
const projectDir =
|
|
1406
|
-
|
|
1587
|
+
const agentDir = join2(AUGMENTED_DIR, ctx.codeName);
|
|
1588
|
+
const projectDir = join2(agentDir, "project");
|
|
1589
|
+
mkdirSync2(agentDir, { recursive: true });
|
|
1407
1590
|
const startedAt = Date.now();
|
|
1408
1591
|
return new Promise((resolve3) => {
|
|
1409
1592
|
const child = execFile("bash", ["-c", ctx.script], {
|
|
@@ -1435,7 +1618,7 @@ ${entry.content}`
|
|
|
1435
1618
|
readGatewayToken(codeName) {
|
|
1436
1619
|
const homeDir = getHomeDir();
|
|
1437
1620
|
try {
|
|
1438
|
-
const config = JSON.parse(
|
|
1621
|
+
const config = JSON.parse(readFileSync2(join2(homeDir, `.openclaw-${codeName}`, "openclaw.json"), "utf-8"));
|
|
1439
1622
|
return config?.gateway?.auth?.token;
|
|
1440
1623
|
} catch {
|
|
1441
1624
|
return void 0;
|
|
@@ -1565,14 +1748,14 @@ ${entry.content}`
|
|
|
1565
1748
|
registerFramework(openclawAdapter);
|
|
1566
1749
|
|
|
1567
1750
|
// ../../packages/core/dist/provisioning/frameworks/nemoclaw/index.js
|
|
1568
|
-
import { readFileSync as
|
|
1569
|
-
import { join as
|
|
1570
|
-
import { homedir } from "os";
|
|
1751
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync3, chmodSync as chmodSync3 } from "fs";
|
|
1752
|
+
import { join as join3, dirname as dirname3, resolve as resolve2, sep } from "path";
|
|
1753
|
+
import { homedir as homedir2 } from "os";
|
|
1571
1754
|
import { execFile as execFile2 } from "child_process";
|
|
1572
1755
|
import { promisify } from "util";
|
|
1573
1756
|
var execAsync = promisify(execFile2);
|
|
1574
1757
|
function getHomeDir2() {
|
|
1575
|
-
return
|
|
1758
|
+
return homedir2();
|
|
1576
1759
|
}
|
|
1577
1760
|
function validateCodeName(codeName) {
|
|
1578
1761
|
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(codeName)) {
|
|
@@ -1581,16 +1764,16 @@ function validateCodeName(codeName) {
|
|
|
1581
1764
|
}
|
|
1582
1765
|
function getConfigDir(codeName) {
|
|
1583
1766
|
validateCodeName(codeName);
|
|
1584
|
-
return
|
|
1767
|
+
return join3(getHomeDir2(), ".augmented", codeName, "nemoclaw");
|
|
1585
1768
|
}
|
|
1586
1769
|
function ensureDir(dir) {
|
|
1587
|
-
|
|
1770
|
+
mkdirSync3(dir, { recursive: true });
|
|
1588
1771
|
}
|
|
1589
1772
|
function readDeploymentTarget(codeName) {
|
|
1590
|
-
const targetFile =
|
|
1591
|
-
if (!
|
|
1773
|
+
const targetFile = join3(getConfigDir(codeName), "target.json");
|
|
1774
|
+
if (!existsSync3(targetFile))
|
|
1592
1775
|
return null;
|
|
1593
|
-
return JSON.parse(
|
|
1776
|
+
return JSON.parse(readFileSync3(targetFile, "utf-8"));
|
|
1594
1777
|
}
|
|
1595
1778
|
async function sshExec(target, command, options) {
|
|
1596
1779
|
const sshArgs = [
|
|
@@ -1628,7 +1811,7 @@ async function syncLocalAssetsToRemote(codeName) {
|
|
|
1628
1811
|
if (!target)
|
|
1629
1812
|
return;
|
|
1630
1813
|
const localAssetsDir = getConfigDir(codeName);
|
|
1631
|
-
if (!
|
|
1814
|
+
if (!existsSync3(localAssetsDir))
|
|
1632
1815
|
return;
|
|
1633
1816
|
const remoteDir = `/opt/augmented/${codeName}`;
|
|
1634
1817
|
const remoteAssetsDir = `${remoteDir}/assets`;
|
|
@@ -1722,13 +1905,13 @@ var nemoClawAdapter = {
|
|
|
1722
1905
|
if (!target)
|
|
1723
1906
|
return false;
|
|
1724
1907
|
try {
|
|
1725
|
-
const blueprintPath =
|
|
1908
|
+
const blueprintPath = join3(teamDir, "blueprint.json");
|
|
1726
1909
|
const remoteDir = `/opt/augmented/${codeName}`;
|
|
1727
1910
|
await sshExec(target, `mkdir -p ${remoteDir}`);
|
|
1728
1911
|
await scpPush(target, blueprintPath, `${remoteDir}/blueprint.json`);
|
|
1729
1912
|
for (const file of ["CHARTER.md", "TOOLS.md"]) {
|
|
1730
|
-
const localPath =
|
|
1731
|
-
if (
|
|
1913
|
+
const localPath = join3(teamDir, file);
|
|
1914
|
+
if (existsSync3(localPath)) {
|
|
1732
1915
|
await scpPush(target, localPath, `${remoteDir}/${file}`);
|
|
1733
1916
|
}
|
|
1734
1917
|
}
|
|
@@ -1756,8 +1939,8 @@ var nemoClawAdapter = {
|
|
|
1756
1939
|
writeAuthProfiles(codeName, profiles) {
|
|
1757
1940
|
const configDir = getConfigDir(codeName);
|
|
1758
1941
|
ensureDir(configDir);
|
|
1759
|
-
const authFile =
|
|
1760
|
-
const existing =
|
|
1942
|
+
const authFile = join3(configDir, "auth-profiles.json");
|
|
1943
|
+
const existing = existsSync3(authFile) ? JSON.parse(readFileSync3(authFile, "utf-8")) : {};
|
|
1761
1944
|
for (const profile of profiles) {
|
|
1762
1945
|
const previous = existing[profile.profile_name];
|
|
1763
1946
|
existing[profile.profile_name] = {
|
|
@@ -1768,7 +1951,7 @@ var nemoClawAdapter = {
|
|
|
1768
1951
|
...profile.metadata
|
|
1769
1952
|
};
|
|
1770
1953
|
}
|
|
1771
|
-
|
|
1954
|
+
writeFileSync3(authFile, JSON.stringify(existing, null, 2), { mode: 384 });
|
|
1772
1955
|
syncLocalAssetsToRemote(codeName).catch(() => {
|
|
1773
1956
|
});
|
|
1774
1957
|
},
|
|
@@ -1790,7 +1973,7 @@ var nemoClawAdapter = {
|
|
|
1790
1973
|
}
|
|
1791
1974
|
const configDir = getConfigDir(codeName);
|
|
1792
1975
|
ensureDir(configDir);
|
|
1793
|
-
|
|
1976
|
+
writeFileSync3(join3(configDir, "gateway.json"), JSON.stringify({
|
|
1794
1977
|
pid: result.pid,
|
|
1795
1978
|
port: result.port,
|
|
1796
1979
|
host: target.host,
|
|
@@ -1826,8 +2009,8 @@ var nemoClawAdapter = {
|
|
|
1826
2009
|
},
|
|
1827
2010
|
readGatewayToken(codeName) {
|
|
1828
2011
|
try {
|
|
1829
|
-
const gatewayFile =
|
|
1830
|
-
const config = JSON.parse(
|
|
2012
|
+
const gatewayFile = join3(getConfigDir(codeName), "gateway.json");
|
|
2013
|
+
const config = JSON.parse(readFileSync3(gatewayFile, "utf-8"));
|
|
1831
2014
|
return config?.token;
|
|
1832
2015
|
} catch {
|
|
1833
2016
|
return void 0;
|
|
@@ -1836,7 +2019,7 @@ var nemoClawAdapter = {
|
|
|
1836
2019
|
writeIntegrations(codeName, integrations) {
|
|
1837
2020
|
const configDir = getConfigDir(codeName);
|
|
1838
2021
|
ensureDir(configDir);
|
|
1839
|
-
const envFile =
|
|
2022
|
+
const envFile = join3(configDir, "integration-env.json");
|
|
1840
2023
|
const env2 = {};
|
|
1841
2024
|
for (const integration of integrations) {
|
|
1842
2025
|
const apiKey = integration.credentials.api_key ?? integration.credentials.access_token;
|
|
@@ -1845,7 +2028,7 @@ var nemoClawAdapter = {
|
|
|
1845
2028
|
env2[envKey] = apiKey;
|
|
1846
2029
|
}
|
|
1847
2030
|
}
|
|
1848
|
-
|
|
2031
|
+
writeFileSync3(envFile, JSON.stringify(env2, null, 2), { mode: 384 });
|
|
1849
2032
|
syncLocalAssetsToRemote(codeName).catch(() => {
|
|
1850
2033
|
});
|
|
1851
2034
|
},
|
|
@@ -1859,8 +2042,8 @@ var nemoClawAdapter = {
|
|
|
1859
2042
|
if (!filePath.startsWith(`${skillDir}${sep}`)) {
|
|
1860
2043
|
throw new Error(`Invalid skill path: ${file.relativePath}`);
|
|
1861
2044
|
}
|
|
1862
|
-
|
|
1863
|
-
|
|
2045
|
+
mkdirSync3(dirname3(filePath), { recursive: true });
|
|
2046
|
+
writeFileSync3(filePath, file.content);
|
|
1864
2047
|
}
|
|
1865
2048
|
syncLocalAssetsToRemote(codeName).catch(() => {
|
|
1866
2049
|
});
|
|
@@ -1868,11 +2051,11 @@ var nemoClawAdapter = {
|
|
|
1868
2051
|
writeMcpServer(codeName, serverId, config) {
|
|
1869
2052
|
const configDir = getConfigDir(codeName);
|
|
1870
2053
|
ensureDir(configDir);
|
|
1871
|
-
const mcpFile =
|
|
1872
|
-
const existing =
|
|
2054
|
+
const mcpFile = join3(configDir, "mcp-servers.json");
|
|
2055
|
+
const existing = existsSync3(mcpFile) ? JSON.parse(readFileSync3(mcpFile, "utf-8")) : {};
|
|
1873
2056
|
existing[serverId] = config;
|
|
1874
|
-
|
|
1875
|
-
|
|
2057
|
+
writeFileSync3(mcpFile, JSON.stringify(existing, null, 2), { mode: 384 });
|
|
2058
|
+
chmodSync3(mcpFile, 384);
|
|
1876
2059
|
syncLocalAssetsToRemote(codeName).catch(() => {
|
|
1877
2060
|
});
|
|
1878
2061
|
},
|
|
@@ -1882,8 +2065,8 @@ var nemoClawAdapter = {
|
|
|
1882
2065
|
return;
|
|
1883
2066
|
const configDir = getConfigDir(codeName);
|
|
1884
2067
|
ensureDir(configDir);
|
|
1885
|
-
const tasksFile =
|
|
1886
|
-
|
|
2068
|
+
const tasksFile = join3(configDir, "scheduled-tasks.json");
|
|
2069
|
+
writeFileSync3(tasksFile, JSON.stringify(tasks, null, 2));
|
|
1887
2070
|
try {
|
|
1888
2071
|
const remoteDir = `/opt/augmented/${codeName}`;
|
|
1889
2072
|
await scpPush(target, tasksFile, `${remoteDir}/scheduled-tasks.json`);
|
|
@@ -1908,9 +2091,9 @@ function extractAllowedDomains(input) {
|
|
|
1908
2091
|
registerFramework(nemoClawAdapter);
|
|
1909
2092
|
|
|
1910
2093
|
// ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
|
|
1911
|
-
import { readFileSync as
|
|
1912
|
-
import { join as
|
|
1913
|
-
import { homedir as
|
|
2094
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, existsSync as existsSync4, chmodSync as chmodSync4, readdirSync, rmSync } from "fs";
|
|
2095
|
+
import { join as join4, relative, dirname as dirname4 } from "path";
|
|
2096
|
+
import { homedir as homedir3 } from "os";
|
|
1914
2097
|
import { execFile as execFile3 } from "child_process";
|
|
1915
2098
|
|
|
1916
2099
|
// ../../packages/core/dist/provisioning/frameworks/claudecode/identity.js
|
|
@@ -2234,94 +2417,94 @@ function assertSafeRelativePath(relativePath) {
|
|
|
2234
2417
|
}
|
|
2235
2418
|
}
|
|
2236
2419
|
function getHomeDir3() {
|
|
2237
|
-
return process.env["HOME"] ?? process.env["USERPROFILE"] ??
|
|
2420
|
+
return process.env["HOME"] ?? process.env["USERPROFILE"] ?? homedir3();
|
|
2238
2421
|
}
|
|
2239
2422
|
function getAgentDir(codeName) {
|
|
2240
2423
|
assertValidCodeName(codeName);
|
|
2241
|
-
return
|
|
2424
|
+
return join4(getHomeDir3(), ".augmented", codeName, "claudecode");
|
|
2242
2425
|
}
|
|
2243
2426
|
function getProjectDir(codeName) {
|
|
2244
2427
|
assertValidCodeName(codeName);
|
|
2245
|
-
return
|
|
2428
|
+
return join4(getHomeDir3(), ".augmented", codeName, "project");
|
|
2246
2429
|
}
|
|
2247
2430
|
function syncMcpToProject(codeName) {
|
|
2248
2431
|
const agentDir = getAgentDir(codeName);
|
|
2249
2432
|
const projectDir = getProjectDir(codeName);
|
|
2250
|
-
const provisionMcpPath =
|
|
2251
|
-
const projectMcpPath =
|
|
2433
|
+
const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
|
|
2434
|
+
const projectMcpPath = join4(projectDir, ".mcp.json");
|
|
2252
2435
|
try {
|
|
2253
|
-
const content =
|
|
2254
|
-
|
|
2255
|
-
|
|
2436
|
+
const content = readFileSync4(provisionMcpPath, "utf-8");
|
|
2437
|
+
mkdirSync4(projectDir, { recursive: true });
|
|
2438
|
+
writeFileSync4(projectMcpPath, content);
|
|
2256
2439
|
} catch {
|
|
2257
2440
|
}
|
|
2258
2441
|
}
|
|
2259
2442
|
function deployArtifactsToProject(codeName, provisionDir) {
|
|
2260
2443
|
const projectDir = getProjectDir(codeName);
|
|
2261
|
-
|
|
2444
|
+
mkdirSync4(projectDir, { recursive: true });
|
|
2262
2445
|
const artifactFiles = ["CLAUDE.md", "settings.json", ".mcp.json", "CHARTER.md", "TOOLS.md"];
|
|
2263
2446
|
const SKILLS_START = "<!-- AGT:SKILLS_INDEX_START -->";
|
|
2264
2447
|
const SKILLS_END = "<!-- AGT:SKILLS_INDEX_END -->";
|
|
2265
2448
|
for (const file of artifactFiles) {
|
|
2266
|
-
const src =
|
|
2267
|
-
const dest =
|
|
2449
|
+
const src = join4(provisionDir, file);
|
|
2450
|
+
const dest = join4(projectDir, file);
|
|
2268
2451
|
try {
|
|
2269
|
-
const srcContent =
|
|
2270
|
-
if (file === "CLAUDE.md" &&
|
|
2271
|
-
const destContent =
|
|
2452
|
+
const srcContent = readFileSync4(src, "utf-8");
|
|
2453
|
+
if (file === "CLAUDE.md" && existsSync4(dest)) {
|
|
2454
|
+
const destContent = readFileSync4(dest, "utf-8");
|
|
2272
2455
|
const stripIndex = (s) => s.replace(new RegExp(`${SKILLS_START}[\\s\\S]*?${SKILLS_END}`), "").trimEnd();
|
|
2273
2456
|
if (stripIndex(srcContent) === stripIndex(destContent))
|
|
2274
2457
|
continue;
|
|
2275
2458
|
const indexMatch = destContent.match(new RegExp(`${SKILLS_START}[\\s\\S]*?${SKILLS_END}`));
|
|
2276
2459
|
if (indexMatch) {
|
|
2277
|
-
|
|
2460
|
+
writeFileSync4(dest, srcContent.trimEnd() + "\n\n" + indexMatch[0] + "\n");
|
|
2278
2461
|
continue;
|
|
2279
2462
|
}
|
|
2280
2463
|
}
|
|
2281
|
-
|
|
2464
|
+
writeFileSync4(dest, srcContent);
|
|
2282
2465
|
} catch {
|
|
2283
2466
|
}
|
|
2284
2467
|
}
|
|
2285
|
-
const skillsDir =
|
|
2286
|
-
const destSkillsDir =
|
|
2468
|
+
const skillsDir = join4(provisionDir, ".claude", "skills");
|
|
2469
|
+
const destSkillsDir = join4(projectDir, ".claude", "skills");
|
|
2287
2470
|
try {
|
|
2288
|
-
if (
|
|
2289
|
-
const srcFolders =
|
|
2471
|
+
if (existsSync4(destSkillsDir)) {
|
|
2472
|
+
const srcFolders = existsSync4(skillsDir) ? new Set(readdirSync(skillsDir)) : /* @__PURE__ */ new Set();
|
|
2290
2473
|
for (const folder of readdirSync(destSkillsDir)) {
|
|
2291
2474
|
if (folder.startsWith("knowledge-") || folder === "core-knowledge" && !srcFolders.has(folder)) {
|
|
2292
2475
|
try {
|
|
2293
|
-
rmSync(
|
|
2476
|
+
rmSync(join4(destSkillsDir, folder), { recursive: true });
|
|
2294
2477
|
} catch {
|
|
2295
2478
|
}
|
|
2296
2479
|
}
|
|
2297
2480
|
}
|
|
2298
2481
|
}
|
|
2299
|
-
if (
|
|
2482
|
+
if (existsSync4(skillsDir)) {
|
|
2300
2483
|
for (const skillFolder of readdirSync(skillsDir)) {
|
|
2301
|
-
const srcSkillFile =
|
|
2302
|
-
if (!
|
|
2484
|
+
const srcSkillFile = join4(skillsDir, skillFolder, "SKILL.md");
|
|
2485
|
+
if (!existsSync4(srcSkillFile))
|
|
2303
2486
|
continue;
|
|
2304
|
-
const destFolder =
|
|
2305
|
-
const destFile =
|
|
2306
|
-
const srcContent =
|
|
2487
|
+
const destFolder = join4(destSkillsDir, skillFolder);
|
|
2488
|
+
const destFile = join4(destFolder, "SKILL.md");
|
|
2489
|
+
const srcContent = readFileSync4(srcSkillFile, "utf-8");
|
|
2307
2490
|
try {
|
|
2308
|
-
if (
|
|
2491
|
+
if (existsSync4(destFile) && readFileSync4(destFile, "utf-8") === srcContent)
|
|
2309
2492
|
continue;
|
|
2310
2493
|
} catch {
|
|
2311
2494
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2495
|
+
mkdirSync4(destFolder, { recursive: true });
|
|
2496
|
+
writeFileSync4(destFile, srcContent);
|
|
2314
2497
|
}
|
|
2315
2498
|
}
|
|
2316
2499
|
} catch {
|
|
2317
2500
|
}
|
|
2318
|
-
const agentMcpPath =
|
|
2319
|
-
const projectMcpPath =
|
|
2501
|
+
const agentMcpPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
|
|
2502
|
+
const projectMcpPath = join4(projectDir, ".mcp.json");
|
|
2320
2503
|
try {
|
|
2321
|
-
const agentMcp = JSON.parse(
|
|
2504
|
+
const agentMcp = JSON.parse(readFileSync4(agentMcpPath, "utf-8"));
|
|
2322
2505
|
let projectMcp;
|
|
2323
2506
|
try {
|
|
2324
|
-
projectMcp = JSON.parse(
|
|
2507
|
+
projectMcp = JSON.parse(readFileSync4(projectMcpPath, "utf-8"));
|
|
2325
2508
|
} catch {
|
|
2326
2509
|
projectMcp = { mcpServers: {} };
|
|
2327
2510
|
}
|
|
@@ -2332,23 +2515,23 @@ function deployArtifactsToProject(codeName, provisionDir) {
|
|
|
2332
2515
|
return !(entry && typeof entry["url"] === "string" && entry["url"].startsWith("/"));
|
|
2333
2516
|
}));
|
|
2334
2517
|
projectMcp["mcpServers"] = { ...stripRelativeUrls(projectServers), ...stripRelativeUrls(agentServers) };
|
|
2335
|
-
|
|
2518
|
+
writeFileSync4(projectMcpPath, JSON.stringify(projectMcp, null, 2));
|
|
2336
2519
|
} catch {
|
|
2337
2520
|
}
|
|
2338
2521
|
const agentDir = getAgentDir(codeName);
|
|
2339
2522
|
for (const envFile of [".env", ".env.integrations"]) {
|
|
2340
2523
|
try {
|
|
2341
|
-
const content =
|
|
2342
|
-
|
|
2524
|
+
const content = readFileSync4(join4(agentDir, envFile), "utf-8");
|
|
2525
|
+
writeFileSync4(join4(projectDir, envFile), content);
|
|
2343
2526
|
} catch {
|
|
2344
2527
|
}
|
|
2345
2528
|
}
|
|
2346
2529
|
}
|
|
2347
2530
|
function provisionStopHook(codeName) {
|
|
2348
2531
|
const projectDir = getProjectDir(codeName);
|
|
2349
|
-
const claudeDir =
|
|
2350
|
-
|
|
2351
|
-
const hookScriptPath =
|
|
2532
|
+
const claudeDir = join4(projectDir, ".claude");
|
|
2533
|
+
mkdirSync4(claudeDir, { recursive: true });
|
|
2534
|
+
const hookScriptPath = join4(claudeDir, "agt-stop-hook.sh");
|
|
2352
2535
|
const hookScript = [
|
|
2353
2536
|
"#!/bin/bash",
|
|
2354
2537
|
"# Auto-generated by Augmented \u2014 captures persistent session task results.",
|
|
@@ -2378,11 +2561,11 @@ function provisionStopHook(codeName) {
|
|
|
2378
2561
|
"esac",
|
|
2379
2562
|
"exit 0"
|
|
2380
2563
|
].join("\n") + "\n";
|
|
2381
|
-
|
|
2382
|
-
const settingsPath =
|
|
2564
|
+
writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
|
|
2565
|
+
const settingsPath = join4(claudeDir, "settings.local.json");
|
|
2383
2566
|
let settings = {};
|
|
2384
2567
|
try {
|
|
2385
|
-
settings = JSON.parse(
|
|
2568
|
+
settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
2386
2569
|
} catch {
|
|
2387
2570
|
}
|
|
2388
2571
|
const hooks = settings["hooks"] ?? {};
|
|
@@ -2397,17 +2580,17 @@ function provisionStopHook(codeName) {
|
|
|
2397
2580
|
}
|
|
2398
2581
|
];
|
|
2399
2582
|
settings["hooks"] = hooks;
|
|
2400
|
-
|
|
2583
|
+
writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
|
|
2401
2584
|
}
|
|
2402
2585
|
function provisionIsolationHook(codeName) {
|
|
2403
2586
|
const projectDir = getProjectDir(codeName);
|
|
2404
|
-
const claudeDir =
|
|
2405
|
-
|
|
2587
|
+
const claudeDir = join4(projectDir, ".claude");
|
|
2588
|
+
mkdirSync4(claudeDir, { recursive: true });
|
|
2406
2589
|
const homeDir = getHomeDir3();
|
|
2407
|
-
const augmentedBase =
|
|
2408
|
-
const ownAgentDir =
|
|
2409
|
-
const logFile =
|
|
2410
|
-
const hookScriptPath =
|
|
2590
|
+
const augmentedBase = join4(homeDir, ".augmented");
|
|
2591
|
+
const ownAgentDir = join4(augmentedBase, codeName);
|
|
2592
|
+
const logFile = join4(ownAgentDir, "isolation.log");
|
|
2593
|
+
const hookScriptPath = join4(claudeDir, "agt-isolation-hook.sh");
|
|
2411
2594
|
const hookScript = [
|
|
2412
2595
|
"#!/bin/bash",
|
|
2413
2596
|
"# Auto-generated by Augmented \u2014 prevents cross-agent file access.",
|
|
@@ -2460,11 +2643,11 @@ function provisionIsolationHook(codeName) {
|
|
|
2460
2643
|
"",
|
|
2461
2644
|
"exit 0"
|
|
2462
2645
|
].join("\n") + "\n";
|
|
2463
|
-
|
|
2464
|
-
const settingsPath =
|
|
2646
|
+
writeFileSync4(hookScriptPath, hookScript, { mode: 493 });
|
|
2647
|
+
const settingsPath = join4(claudeDir, "settings.local.json");
|
|
2465
2648
|
let settings = {};
|
|
2466
2649
|
try {
|
|
2467
|
-
settings = JSON.parse(
|
|
2650
|
+
settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
2468
2651
|
} catch {
|
|
2469
2652
|
}
|
|
2470
2653
|
const hooks = settings["hooks"] ?? {};
|
|
@@ -2479,13 +2662,13 @@ function provisionIsolationHook(codeName) {
|
|
|
2479
2662
|
}
|
|
2480
2663
|
];
|
|
2481
2664
|
settings["hooks"] = hooks;
|
|
2482
|
-
|
|
2665
|
+
writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
|
|
2483
2666
|
}
|
|
2484
2667
|
function modifyJsonConfig(filePath, fn) {
|
|
2485
2668
|
let originalContent;
|
|
2486
2669
|
let config;
|
|
2487
2670
|
try {
|
|
2488
|
-
originalContent =
|
|
2671
|
+
originalContent = readFileSync4(filePath, "utf-8");
|
|
2489
2672
|
config = JSON.parse(originalContent);
|
|
2490
2673
|
} catch {
|
|
2491
2674
|
return;
|
|
@@ -2496,7 +2679,7 @@ function modifyJsonConfig(filePath, fn) {
|
|
|
2496
2679
|
const newContent = JSON.stringify(config, null, 2);
|
|
2497
2680
|
if (newContent === originalContent)
|
|
2498
2681
|
return;
|
|
2499
|
-
|
|
2682
|
+
writeFileSync4(filePath, newContent);
|
|
2500
2683
|
}
|
|
2501
2684
|
function buildSettingsJson(input) {
|
|
2502
2685
|
const { agent, charterFrontmatter, toolsFrontmatter } = input;
|
|
@@ -2524,7 +2707,7 @@ function buildSettingsJson(input) {
|
|
|
2524
2707
|
// Agent's project dir (CLAUDE.md, settings.json, etc.)
|
|
2525
2708
|
agentDir,
|
|
2526
2709
|
// Agent's config dir (.env, schedules, registration)
|
|
2527
|
-
|
|
2710
|
+
join4(homeDir, ".augmented", "_mcp"),
|
|
2528
2711
|
// Shared MCP binaries
|
|
2529
2712
|
"/tmp"
|
|
2530
2713
|
// Temp files
|
|
@@ -2533,7 +2716,7 @@ function buildSettingsJson(input) {
|
|
|
2533
2716
|
}
|
|
2534
2717
|
function buildMcpJson(input) {
|
|
2535
2718
|
const mcpServers = {};
|
|
2536
|
-
const localMcpPath =
|
|
2719
|
+
const localMcpPath = join4(getHomeDir3(), ".augmented", "_mcp", "index.js");
|
|
2537
2720
|
mcpServers["augmented"] = {
|
|
2538
2721
|
command: "node",
|
|
2539
2722
|
args: [localMcpPath],
|
|
@@ -2667,13 +2850,13 @@ ${sections}`
|
|
|
2667
2850
|
},
|
|
2668
2851
|
async getRegisteredAgents(_profile) {
|
|
2669
2852
|
const homeDir = getHomeDir3();
|
|
2670
|
-
const augDir =
|
|
2853
|
+
const augDir = join4(homeDir, ".augmented");
|
|
2671
2854
|
const agents = /* @__PURE__ */ new Set();
|
|
2672
2855
|
try {
|
|
2673
2856
|
const { readdirSync: readdirSync2, statSync } = await import("fs");
|
|
2674
2857
|
const entries = readdirSync2(augDir);
|
|
2675
2858
|
for (const entry of entries) {
|
|
2676
|
-
const ccDir =
|
|
2859
|
+
const ccDir = join4(augDir, entry, "claudecode");
|
|
2677
2860
|
try {
|
|
2678
2861
|
if (statSync(ccDir).isDirectory()) {
|
|
2679
2862
|
agents.add(entry);
|
|
@@ -2689,16 +2872,16 @@ ${sections}`
|
|
|
2689
2872
|
try {
|
|
2690
2873
|
const agentDir = getAgentDir(codeName);
|
|
2691
2874
|
const projectDir = getProjectDir(codeName);
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2875
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
2876
|
+
mkdirSync4(projectDir, { recursive: true });
|
|
2877
|
+
writeFileSync4(join4(agentDir, "registration.json"), JSON.stringify({
|
|
2695
2878
|
code_name: codeName,
|
|
2696
2879
|
team_dir: teamDir,
|
|
2697
2880
|
project_dir: projectDir,
|
|
2698
2881
|
framework: "claude-code",
|
|
2699
2882
|
registered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2700
2883
|
}, null, 2));
|
|
2701
|
-
if (
|
|
2884
|
+
if (existsSync4(teamDir)) {
|
|
2702
2885
|
deployArtifactsToProject(codeName, teamDir);
|
|
2703
2886
|
}
|
|
2704
2887
|
return true;
|
|
@@ -2709,10 +2892,10 @@ ${sections}`
|
|
|
2709
2892
|
async deregisterAgent(codeName) {
|
|
2710
2893
|
try {
|
|
2711
2894
|
const agentDir = getAgentDir(codeName);
|
|
2712
|
-
const regFile =
|
|
2713
|
-
if (
|
|
2714
|
-
const { unlinkSync:
|
|
2715
|
-
|
|
2895
|
+
const regFile = join4(agentDir, "registration.json");
|
|
2896
|
+
if (existsSync4(regFile)) {
|
|
2897
|
+
const { unlinkSync: unlinkSync3 } = await import("fs");
|
|
2898
|
+
unlinkSync3(regFile);
|
|
2716
2899
|
}
|
|
2717
2900
|
return true;
|
|
2718
2901
|
} catch {
|
|
@@ -2721,7 +2904,7 @@ ${sections}`
|
|
|
2721
2904
|
},
|
|
2722
2905
|
writeAuthProfiles(codeName, profiles) {
|
|
2723
2906
|
const agentDir = getAgentDir(codeName);
|
|
2724
|
-
|
|
2907
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
2725
2908
|
const envLines = ["# Augmented auth profiles \u2014 auto-generated, do not edit"];
|
|
2726
2909
|
for (const p of profiles) {
|
|
2727
2910
|
if (!p.api_key)
|
|
@@ -2730,9 +2913,9 @@ ${sections}`
|
|
|
2730
2913
|
envLines.push(`${envKey}=${p.api_key}`);
|
|
2731
2914
|
}
|
|
2732
2915
|
if (envLines.length > 1) {
|
|
2733
|
-
const envPath =
|
|
2734
|
-
|
|
2735
|
-
|
|
2916
|
+
const envPath = join4(agentDir, ".env");
|
|
2917
|
+
writeFileSync4(envPath, envLines.join("\n") + "\n");
|
|
2918
|
+
chmodSync4(envPath, SECRET_FILE_MODE);
|
|
2736
2919
|
}
|
|
2737
2920
|
},
|
|
2738
2921
|
// Claude Code has no gateway process — methods intentionally omitted
|
|
@@ -2756,21 +2939,21 @@ ${sections}`
|
|
|
2756
2939
|
},
|
|
2757
2940
|
writeChannelCredentials(codeName, channelId, config, options) {
|
|
2758
2941
|
const agentDir = getAgentDir(codeName);
|
|
2759
|
-
|
|
2942
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
2760
2943
|
const isPersistent = options?.sessionMode === "persistent";
|
|
2761
2944
|
if (isPersistent && (channelId === "telegram" || channelId === "discord" || channelId === "slack")) {
|
|
2762
|
-
const channelDir =
|
|
2763
|
-
|
|
2945
|
+
const channelDir = join4(getHomeDir3(), ".claude", "channels", channelId);
|
|
2946
|
+
mkdirSync4(channelDir, { recursive: true });
|
|
2764
2947
|
if (channelId === "telegram") {
|
|
2765
2948
|
const botToken = config["bot_token"];
|
|
2766
2949
|
if (botToken) {
|
|
2767
|
-
|
|
2950
|
+
writeFileSync4(join4(channelDir, ".env"), `TELEGRAM_BOT_TOKEN=${botToken}
|
|
2768
2951
|
`);
|
|
2769
2952
|
}
|
|
2770
2953
|
} else if (channelId === "discord") {
|
|
2771
2954
|
const botToken = config["bot_token"];
|
|
2772
2955
|
if (botToken) {
|
|
2773
|
-
|
|
2956
|
+
writeFileSync4(join4(channelDir, ".env"), `DISCORD_BOT_TOKEN=${botToken}
|
|
2774
2957
|
`);
|
|
2775
2958
|
}
|
|
2776
2959
|
} else if (channelId === "slack") {
|
|
@@ -2778,30 +2961,32 @@ ${sections}`
|
|
|
2778
2961
|
const appToken = config["app_token"];
|
|
2779
2962
|
const threadAutoFollow = config["thread_auto_follow"];
|
|
2780
2963
|
if (botToken) {
|
|
2781
|
-
const localSlackChannel =
|
|
2964
|
+
const localSlackChannel = join4(getHomeDir3(), ".augmented", "_mcp", "slack-channel.js");
|
|
2782
2965
|
const slackEntry = {
|
|
2783
|
-
command:
|
|
2784
|
-
args:
|
|
2966
|
+
command: existsSync4(localSlackChannel) ? "node" : "npx",
|
|
2967
|
+
args: existsSync4(localSlackChannel) ? [localSlackChannel] : ["-y", "@augmented/claude-code-channel-slack"],
|
|
2785
2968
|
env: {
|
|
2786
2969
|
SLACK_BOT_TOKEN: botToken,
|
|
2787
2970
|
...appToken ? { SLACK_APP_TOKEN: appToken } : {},
|
|
2788
|
-
...threadAutoFollow && threadAutoFollow !== "off" ? { SLACK_THREAD_AUTO_FOLLOW: threadAutoFollow } : {}
|
|
2971
|
+
...threadAutoFollow && threadAutoFollow !== "off" ? { SLACK_THREAD_AUTO_FOLLOW: threadAutoFollow } : {},
|
|
2972
|
+
// Scopes slack.upload_file uploads to the agent's project dir.
|
|
2973
|
+
AGT_AGENT_CODE_NAME: codeName
|
|
2789
2974
|
}
|
|
2790
2975
|
};
|
|
2791
|
-
const provisionMcpPath =
|
|
2792
|
-
|
|
2976
|
+
const provisionMcpPath = join4(agentDir, "provision", ".mcp.json");
|
|
2977
|
+
mkdirSync4(dirname4(provisionMcpPath), { recursive: true });
|
|
2793
2978
|
let mcpConfig2 = { mcpServers: {} };
|
|
2794
2979
|
try {
|
|
2795
|
-
mcpConfig2 = JSON.parse(
|
|
2980
|
+
mcpConfig2 = JSON.parse(readFileSync4(provisionMcpPath, "utf-8"));
|
|
2796
2981
|
if (!mcpConfig2.mcpServers)
|
|
2797
2982
|
mcpConfig2.mcpServers = {};
|
|
2798
2983
|
} catch {
|
|
2799
2984
|
}
|
|
2800
2985
|
mcpConfig2.mcpServers["slack"] = slackEntry;
|
|
2801
|
-
|
|
2986
|
+
writeFileSync4(provisionMcpPath, JSON.stringify(mcpConfig2, null, 2));
|
|
2802
2987
|
syncMcpToProject(codeName);
|
|
2803
|
-
const staleChannelsPath =
|
|
2804
|
-
if (
|
|
2988
|
+
const staleChannelsPath = join4(getProjectDir(codeName), ".mcp-channels.json");
|
|
2989
|
+
if (existsSync4(staleChannelsPath)) {
|
|
2805
2990
|
try {
|
|
2806
2991
|
rmSync(staleChannelsPath, { force: true });
|
|
2807
2992
|
} catch {
|
|
@@ -2811,10 +2996,10 @@ ${sections}`
|
|
|
2811
2996
|
}
|
|
2812
2997
|
return;
|
|
2813
2998
|
}
|
|
2814
|
-
const mcpJsonPath =
|
|
2999
|
+
const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
|
|
2815
3000
|
let mcpConfig;
|
|
2816
3001
|
try {
|
|
2817
|
-
mcpConfig = JSON.parse(
|
|
3002
|
+
mcpConfig = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
|
|
2818
3003
|
} catch {
|
|
2819
3004
|
mcpConfig = { mcpServers: {} };
|
|
2820
3005
|
}
|
|
@@ -2842,10 +3027,10 @@ ${sections}`
|
|
|
2842
3027
|
const appToken = config["app_token"];
|
|
2843
3028
|
if (!botToken)
|
|
2844
3029
|
return;
|
|
2845
|
-
const localSlackChannel =
|
|
3030
|
+
const localSlackChannel = join4(getHomeDir3(), ".augmented", "_mcp", "slack-channel.js");
|
|
2846
3031
|
const slackThreadAutoFollow = config["thread_auto_follow"];
|
|
2847
3032
|
const slackAutoFollowEnv = slackThreadAutoFollow && slackThreadAutoFollow !== "off" ? { SLACK_THREAD_AUTO_FOLLOW: slackThreadAutoFollow } : {};
|
|
2848
|
-
if (isPersistent &&
|
|
3033
|
+
if (isPersistent && existsSync4(localSlackChannel)) {
|
|
2849
3034
|
mcpServers["slack"] = {
|
|
2850
3035
|
command: "node",
|
|
2851
3036
|
args: [localSlackChannel],
|
|
@@ -2867,12 +3052,12 @@ ${sections}`
|
|
|
2867
3052
|
};
|
|
2868
3053
|
}
|
|
2869
3054
|
}
|
|
2870
|
-
|
|
3055
|
+
writeFileSync4(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
2871
3056
|
syncMcpToProject(codeName);
|
|
2872
3057
|
},
|
|
2873
3058
|
removeChannelCredentials(codeName, channelId) {
|
|
2874
3059
|
const agentDir = getAgentDir(codeName);
|
|
2875
|
-
const mcpJsonPath =
|
|
3060
|
+
const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
|
|
2876
3061
|
modifyJsonConfig(mcpJsonPath, (config) => {
|
|
2877
3062
|
const mcpServers = config["mcpServers"];
|
|
2878
3063
|
if (!mcpServers || !(channelId in mcpServers))
|
|
@@ -2884,7 +3069,7 @@ ${sections}`
|
|
|
2884
3069
|
},
|
|
2885
3070
|
async updateAgentModel(codeName, model) {
|
|
2886
3071
|
const agentDir = getAgentDir(codeName);
|
|
2887
|
-
const settingsPath =
|
|
3072
|
+
const settingsPath = join4(agentDir, "provision", "settings.json");
|
|
2888
3073
|
let changed = false;
|
|
2889
3074
|
modifyJsonConfig(settingsPath, (config) => {
|
|
2890
3075
|
config["model"] = model;
|
|
@@ -2896,20 +3081,20 @@ ${sections}`
|
|
|
2896
3081
|
seedProfileConfig(codeName) {
|
|
2897
3082
|
const agentDir = getAgentDir(codeName);
|
|
2898
3083
|
const projectDir = getProjectDir(codeName);
|
|
2899
|
-
|
|
2900
|
-
|
|
3084
|
+
mkdirSync4(join4(agentDir, "provision"), { recursive: true });
|
|
3085
|
+
mkdirSync4(projectDir, { recursive: true });
|
|
2901
3086
|
},
|
|
2902
3087
|
syncScheduledTasks(codeName, tasks) {
|
|
2903
3088
|
const agentDir = getAgentDir(codeName);
|
|
2904
|
-
const schedulesPath =
|
|
3089
|
+
const schedulesPath = join4(agentDir, "schedules.json");
|
|
2905
3090
|
const mapped = mapScheduledTasks(tasks);
|
|
2906
|
-
|
|
2907
|
-
|
|
3091
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
3092
|
+
writeFileSync4(schedulesPath, JSON.stringify({ schedules: mapped }, null, 2));
|
|
2908
3093
|
return Promise.resolve();
|
|
2909
3094
|
},
|
|
2910
3095
|
writeIntegrations(codeName, integrations) {
|
|
2911
3096
|
const agentDir = getAgentDir(codeName);
|
|
2912
|
-
|
|
3097
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
2913
3098
|
const envLines = ["# Augmented integrations \u2014 auto-generated, do not edit"];
|
|
2914
3099
|
for (const integration of integrations) {
|
|
2915
3100
|
const prefix = integration.definition_id.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
@@ -2936,18 +3121,19 @@ ${sections}`
|
|
|
2936
3121
|
}
|
|
2937
3122
|
}
|
|
2938
3123
|
if (envLines.length > 1) {
|
|
2939
|
-
const envPath =
|
|
2940
|
-
|
|
2941
|
-
|
|
3124
|
+
const envPath = join4(agentDir, ".env.integrations");
|
|
3125
|
+
writeFileSync4(envPath, envLines.join("\n") + "\n");
|
|
3126
|
+
chmodSync4(envPath, SECRET_FILE_MODE);
|
|
2942
3127
|
}
|
|
3128
|
+
writeXurlStoreForIntegrations(integrations);
|
|
2943
3129
|
const hasQmd = integrations.some((i) => i.definition_id === "qmd");
|
|
2944
3130
|
if (hasQmd) {
|
|
2945
3131
|
this.writeMcpServer(codeName, "qmd", { command: "qmd", args: ["mcp"] });
|
|
2946
3132
|
}
|
|
2947
3133
|
const projectDir = getProjectDir(codeName);
|
|
2948
|
-
const claudeMdPath =
|
|
3134
|
+
const claudeMdPath = join4(projectDir, "CLAUDE.md");
|
|
2949
3135
|
try {
|
|
2950
|
-
const existing =
|
|
3136
|
+
const existing = readFileSync4(claudeMdPath, "utf-8");
|
|
2951
3137
|
const summaries = integrations.map((i) => {
|
|
2952
3138
|
const def = INTEGRATION_REGISTRY.find((d) => d.id === i.definition_id);
|
|
2953
3139
|
return {
|
|
@@ -2964,12 +3150,12 @@ ${sections}`
|
|
|
2964
3150
|
} else {
|
|
2965
3151
|
updated = existing.replace("## Rules", `${newSection}## Rules`);
|
|
2966
3152
|
}
|
|
2967
|
-
|
|
3153
|
+
writeFileSync4(claudeMdPath, updated);
|
|
2968
3154
|
const agentDir2 = getAgentDir(codeName);
|
|
2969
|
-
const envSrc =
|
|
3155
|
+
const envSrc = join4(agentDir2, ".env.integrations");
|
|
2970
3156
|
try {
|
|
2971
|
-
const envContent =
|
|
2972
|
-
|
|
3157
|
+
const envContent = readFileSync4(envSrc, "utf-8");
|
|
3158
|
+
writeFileSync4(join4(projectDir, ".env.integrations"), envContent);
|
|
2973
3159
|
} catch {
|
|
2974
3160
|
}
|
|
2975
3161
|
} catch {
|
|
@@ -2977,11 +3163,11 @@ ${sections}`
|
|
|
2977
3163
|
},
|
|
2978
3164
|
writeMcpServer(codeName, serverId, config) {
|
|
2979
3165
|
const agentDir = getAgentDir(codeName);
|
|
2980
|
-
const mcpJsonPath =
|
|
2981
|
-
|
|
3166
|
+
const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
|
|
3167
|
+
mkdirSync4(join4(agentDir, "provision"), { recursive: true });
|
|
2982
3168
|
let mcpConfig;
|
|
2983
3169
|
try {
|
|
2984
|
-
mcpConfig = JSON.parse(
|
|
3170
|
+
mcpConfig = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
|
|
2985
3171
|
} catch {
|
|
2986
3172
|
mcpConfig = { mcpServers: {} };
|
|
2987
3173
|
}
|
|
@@ -3028,15 +3214,15 @@ ${sections}`
|
|
|
3028
3214
|
serverEntry["env"] = config.env;
|
|
3029
3215
|
}
|
|
3030
3216
|
mcpServers[serverId] = serverEntry;
|
|
3031
|
-
|
|
3217
|
+
writeFileSync4(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
3032
3218
|
syncMcpToProject(codeName);
|
|
3033
3219
|
},
|
|
3034
3220
|
removeMcpServer(codeName, serverId) {
|
|
3035
3221
|
const agentDir = getAgentDir(codeName);
|
|
3036
|
-
const mcpJsonPath =
|
|
3222
|
+
const mcpJsonPath = join4(agentDir, "provision", ".mcp.json");
|
|
3037
3223
|
let mcpConfig;
|
|
3038
3224
|
try {
|
|
3039
|
-
mcpConfig = JSON.parse(
|
|
3225
|
+
mcpConfig = JSON.parse(readFileSync4(mcpJsonPath, "utf-8"));
|
|
3040
3226
|
} catch {
|
|
3041
3227
|
return;
|
|
3042
3228
|
}
|
|
@@ -3044,7 +3230,7 @@ ${sections}`
|
|
|
3044
3230
|
if (!mcpServers || !(serverId in mcpServers))
|
|
3045
3231
|
return;
|
|
3046
3232
|
delete mcpServers[serverId];
|
|
3047
|
-
|
|
3233
|
+
writeFileSync4(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
3048
3234
|
syncMcpToProject(codeName);
|
|
3049
3235
|
},
|
|
3050
3236
|
installSkillFiles(codeName, skillId, files) {
|
|
@@ -3054,27 +3240,27 @@ ${sections}`
|
|
|
3054
3240
|
const READ_WRITE_MODE = 420;
|
|
3055
3241
|
const agentDir = getAgentDir(codeName);
|
|
3056
3242
|
const projectDir = getProjectDir(codeName);
|
|
3057
|
-
for (const baseDir of [
|
|
3058
|
-
const skillDir =
|
|
3059
|
-
|
|
3243
|
+
for (const baseDir of [join4(agentDir, "skills"), join4(projectDir, ".claude", "skills")]) {
|
|
3244
|
+
const skillDir = join4(baseDir, skillId);
|
|
3245
|
+
mkdirSync4(skillDir, { recursive: true });
|
|
3060
3246
|
for (const file of files) {
|
|
3061
3247
|
assertSafeRelativePath(file.relativePath);
|
|
3062
|
-
const filePath =
|
|
3248
|
+
const filePath = join4(skillDir, file.relativePath);
|
|
3063
3249
|
const rel = relative(skillDir, filePath);
|
|
3064
3250
|
if (rel.startsWith("..") || rel === "") {
|
|
3065
3251
|
throw new Error(`Path traversal detected: ${file.relativePath} resolves outside ${skillDir}`);
|
|
3066
3252
|
}
|
|
3067
|
-
|
|
3068
|
-
if (isPluginManaged &&
|
|
3253
|
+
mkdirSync4(join4(filePath, ".."), { recursive: true });
|
|
3254
|
+
if (isPluginManaged && existsSync4(filePath)) {
|
|
3069
3255
|
try {
|
|
3070
|
-
|
|
3256
|
+
chmodSync4(filePath, READ_WRITE_MODE);
|
|
3071
3257
|
} catch {
|
|
3072
3258
|
}
|
|
3073
3259
|
}
|
|
3074
|
-
|
|
3260
|
+
writeFileSync4(filePath, file.content);
|
|
3075
3261
|
if (isPluginManaged) {
|
|
3076
3262
|
try {
|
|
3077
|
-
|
|
3263
|
+
chmodSync4(filePath, READ_ONLY_MODE);
|
|
3078
3264
|
} catch {
|
|
3079
3265
|
}
|
|
3080
3266
|
}
|
|
@@ -3083,11 +3269,11 @@ ${sections}`
|
|
|
3083
3269
|
},
|
|
3084
3270
|
installPlugin(codeName, pluginId, pluginPath, pluginConfig) {
|
|
3085
3271
|
const agentDir = getAgentDir(codeName);
|
|
3086
|
-
const pluginsJsonPath =
|
|
3087
|
-
|
|
3272
|
+
const pluginsJsonPath = join4(agentDir, "plugins.json");
|
|
3273
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
3088
3274
|
let pluginsConfig;
|
|
3089
3275
|
try {
|
|
3090
|
-
pluginsConfig = JSON.parse(
|
|
3276
|
+
pluginsConfig = JSON.parse(readFileSync4(pluginsJsonPath, "utf-8"));
|
|
3091
3277
|
} catch {
|
|
3092
3278
|
pluginsConfig = { plugins: {} };
|
|
3093
3279
|
}
|
|
@@ -3100,7 +3286,7 @@ ${sections}`
|
|
|
3100
3286
|
installed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3101
3287
|
...pluginConfig ? { config: pluginConfig } : {}
|
|
3102
3288
|
};
|
|
3103
|
-
|
|
3289
|
+
writeFileSync4(pluginsJsonPath, JSON.stringify(pluginsConfig, null, 2));
|
|
3104
3290
|
},
|
|
3105
3291
|
/**
|
|
3106
3292
|
* Full plugin provisioning: install scripts, register hooks, apply permissions,
|
|
@@ -3116,11 +3302,11 @@ ${sections}`
|
|
|
3116
3302
|
assertValidCodeName(codeName);
|
|
3117
3303
|
assertValidCodeName(plugin.slug);
|
|
3118
3304
|
const projectDir = getProjectDir(codeName);
|
|
3119
|
-
const claudeDir =
|
|
3120
|
-
|
|
3305
|
+
const claudeDir = join4(projectDir, ".claude");
|
|
3306
|
+
mkdirSync4(claudeDir, { recursive: true });
|
|
3121
3307
|
const sourceSpec = options?.scriptSource ?? `augmented-plugin:${plugin.slug}`;
|
|
3122
3308
|
this.installPlugin(codeName, plugin.slug, sourceSpec, contextValues);
|
|
3123
|
-
const installedDir =
|
|
3309
|
+
const installedDir = join4(projectDir, ".claude", "plugins", plugin.slug);
|
|
3124
3310
|
for (const skill of plugin.skills) {
|
|
3125
3311
|
const skillId = skill.id;
|
|
3126
3312
|
assertValidCodeName(skillId);
|
|
@@ -3132,10 +3318,10 @@ ${sections}`
|
|
|
3132
3318
|
}
|
|
3133
3319
|
const scriptsConfig = plugin.scripts;
|
|
3134
3320
|
if (scriptsConfig?.hooks) {
|
|
3135
|
-
const settingsPath =
|
|
3321
|
+
const settingsPath = join4(claudeDir, "settings.local.json");
|
|
3136
3322
|
let settings = {};
|
|
3137
3323
|
try {
|
|
3138
|
-
settings = JSON.parse(
|
|
3324
|
+
settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
3139
3325
|
} catch {
|
|
3140
3326
|
}
|
|
3141
3327
|
const existingHooks = settings["hooks"] ?? {};
|
|
@@ -3169,13 +3355,13 @@ ${sections}`
|
|
|
3169
3355
|
}
|
|
3170
3356
|
}
|
|
3171
3357
|
settings["hooks"] = existingHooks;
|
|
3172
|
-
|
|
3358
|
+
writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
|
|
3173
3359
|
}
|
|
3174
3360
|
if (plugin.allowed_tools.length > 0) {
|
|
3175
|
-
const settingsPath =
|
|
3361
|
+
const settingsPath = join4(claudeDir, "settings.local.json");
|
|
3176
3362
|
let settings = {};
|
|
3177
3363
|
try {
|
|
3178
|
-
settings = JSON.parse(
|
|
3364
|
+
settings = JSON.parse(readFileSync4(settingsPath, "utf-8"));
|
|
3179
3365
|
} catch {
|
|
3180
3366
|
}
|
|
3181
3367
|
const existingPerms = settings["permissions"] ?? {};
|
|
@@ -3187,20 +3373,20 @@ ${sections}`
|
|
|
3187
3373
|
}
|
|
3188
3374
|
existingPerms["allow"] = allowList;
|
|
3189
3375
|
settings["permissions"] = existingPerms;
|
|
3190
|
-
|
|
3376
|
+
writeFileSync4(settingsPath, JSON.stringify(settings, null, 2));
|
|
3191
3377
|
}
|
|
3192
3378
|
if (contextValues && Object.keys(contextValues).length > 0) {
|
|
3193
|
-
const configDir =
|
|
3194
|
-
|
|
3195
|
-
|
|
3379
|
+
const configDir = join4(projectDir, `.${plugin.slug}`);
|
|
3380
|
+
mkdirSync4(configDir, { recursive: true });
|
|
3381
|
+
writeFileSync4(join4(configDir, "config.json"), JSON.stringify(contextValues, null, 2));
|
|
3196
3382
|
}
|
|
3197
3383
|
},
|
|
3198
3384
|
executePluginHook(ctx) {
|
|
3199
3385
|
assertValidCodeName(ctx.codeName);
|
|
3200
|
-
const agentRootDir =
|
|
3386
|
+
const agentRootDir = join4(getHomeDir3(), ".augmented", ctx.codeName);
|
|
3201
3387
|
const projectDir = getProjectDir(ctx.codeName);
|
|
3202
|
-
|
|
3203
|
-
|
|
3388
|
+
mkdirSync4(agentRootDir, { recursive: true });
|
|
3389
|
+
mkdirSync4(projectDir, { recursive: true });
|
|
3204
3390
|
const startedAt = Date.now();
|
|
3205
3391
|
return new Promise((resolve3) => {
|
|
3206
3392
|
const child = execFile3("bash", ["-c", ctx.script], {
|
|
@@ -3231,7 +3417,7 @@ ${sections}`
|
|
|
3231
3417
|
},
|
|
3232
3418
|
writeTokenFile(codeName, integrations) {
|
|
3233
3419
|
const agentDir = getAgentDir(codeName);
|
|
3234
|
-
|
|
3420
|
+
mkdirSync4(agentDir, { recursive: true });
|
|
3235
3421
|
const tokens = {};
|
|
3236
3422
|
for (const integration of integrations) {
|
|
3237
3423
|
if (integration.auth_type !== "oauth2")
|
|
@@ -3247,9 +3433,9 @@ ${sections}`
|
|
|
3247
3433
|
}
|
|
3248
3434
|
if (Object.keys(tokens).length === 0)
|
|
3249
3435
|
return;
|
|
3250
|
-
const tokenPath =
|
|
3251
|
-
|
|
3252
|
-
|
|
3436
|
+
const tokenPath = join4(agentDir, ".tokens.json");
|
|
3437
|
+
writeFileSync4(tokenPath, JSON.stringify(tokens, null, 2));
|
|
3438
|
+
chmodSync4(tokenPath, SECRET_FILE_MODE);
|
|
3253
3439
|
}
|
|
3254
3440
|
};
|
|
3255
3441
|
registerFramework(claudeCodeAdapter);
|
|
@@ -3506,14 +3692,14 @@ var ManagedAgentsAdapter = {
|
|
|
3506
3692
|
registerFramework(ManagedAgentsAdapter);
|
|
3507
3693
|
|
|
3508
3694
|
// src/lib/config.ts
|
|
3509
|
-
import { readFileSync as
|
|
3510
|
-
import { join as
|
|
3511
|
-
import { homedir as
|
|
3512
|
-
var AUGMENTED_DIR2 =
|
|
3513
|
-
var CONFIG_PATH =
|
|
3695
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, existsSync as existsSync5 } from "fs";
|
|
3696
|
+
import { join as join5 } from "path";
|
|
3697
|
+
import { homedir as homedir4 } from "os";
|
|
3698
|
+
var AUGMENTED_DIR2 = join5(homedir4(), ".augmented");
|
|
3699
|
+
var CONFIG_PATH = join5(AUGMENTED_DIR2, "config.json");
|
|
3514
3700
|
function ensureAugmentedDir() {
|
|
3515
|
-
if (!
|
|
3516
|
-
|
|
3701
|
+
if (!existsSync5(AUGMENTED_DIR2)) {
|
|
3702
|
+
mkdirSync5(AUGMENTED_DIR2, { recursive: true });
|
|
3517
3703
|
}
|
|
3518
3704
|
}
|
|
3519
3705
|
function reloadFromShellProfile() {
|
|
@@ -3522,11 +3708,11 @@ function reloadFromShellProfile() {
|
|
|
3522
3708
|
function loadFromShellProfile(force = false) {
|
|
3523
3709
|
if (!force && process.env["AGT_HOST"] && process.env["AGT_API_KEY"]) return;
|
|
3524
3710
|
const shell = process.env["SHELL"] ?? "";
|
|
3525
|
-
const home =
|
|
3526
|
-
const candidates = shell.includes("zsh") ? [
|
|
3711
|
+
const home = homedir4();
|
|
3712
|
+
const candidates = shell.includes("zsh") ? [join5(home, ".zshrc"), join5(home, ".zprofile")] : shell.includes("fish") ? [join5(home, ".config", "fish", "config.fish")] : [join5(home, ".bashrc"), join5(home, ".bash_profile")];
|
|
3527
3713
|
for (const profile of candidates) {
|
|
3528
3714
|
try {
|
|
3529
|
-
const content =
|
|
3715
|
+
const content = readFileSync5(profile, "utf-8");
|
|
3530
3716
|
for (const key of ["AGT_HOST", "AGT_API_KEY", "AGT_TEAM"]) {
|
|
3531
3717
|
if (!force && process.env[key]) continue;
|
|
3532
3718
|
const match = content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).map(
|
|
@@ -3551,7 +3737,7 @@ function getApiKey() {
|
|
|
3551
3737
|
}
|
|
3552
3738
|
function getConfig() {
|
|
3553
3739
|
try {
|
|
3554
|
-
const raw =
|
|
3740
|
+
const raw = readFileSync5(CONFIG_PATH, "utf-8");
|
|
3555
3741
|
return JSON.parse(raw);
|
|
3556
3742
|
} catch {
|
|
3557
3743
|
return {};
|
|
@@ -3559,7 +3745,7 @@ function getConfig() {
|
|
|
3559
3745
|
}
|
|
3560
3746
|
function saveConfig(config) {
|
|
3561
3747
|
ensureAugmentedDir();
|
|
3562
|
-
|
|
3748
|
+
writeFileSync5(CONFIG_PATH, JSON.stringify(config, null, 2));
|
|
3563
3749
|
}
|
|
3564
3750
|
function getActiveTeam() {
|
|
3565
3751
|
const envTeam = process.env["AGT_TEAM"];
|
|
@@ -4157,7 +4343,7 @@ async function createSlackApp(configToken, manifest) {
|
|
|
4157
4343
|
}
|
|
4158
4344
|
|
|
4159
4345
|
// ../../packages/core/dist/parser/frontmatter.js
|
|
4160
|
-
import { parse as
|
|
4346
|
+
import { parse as parseYaml2 } from "yaml";
|
|
4161
4347
|
function extractFrontmatter(content) {
|
|
4162
4348
|
const lines = content.split("\n");
|
|
4163
4349
|
let startLine = -1;
|
|
@@ -4187,7 +4373,7 @@ function extractFrontmatter(content) {
|
|
|
4187
4373
|
return { frontmatter: null, body, preamble, error: "Empty frontmatter block" };
|
|
4188
4374
|
}
|
|
4189
4375
|
try {
|
|
4190
|
-
const parsed =
|
|
4376
|
+
const parsed = parseYaml2(yamlStr);
|
|
4191
4377
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
4192
4378
|
return { frontmatter: null, body, preamble, error: "Frontmatter must be a YAML mapping (object)" };
|
|
4193
4379
|
}
|
|
@@ -4840,7 +5026,7 @@ function validateToolsFrontmatter(data) {
|
|
|
4840
5026
|
}
|
|
4841
5027
|
|
|
4842
5028
|
// ../../packages/core/dist/generation/charter-generator.js
|
|
4843
|
-
import { stringify as
|
|
5029
|
+
import { stringify as stringifyYaml2 } from "yaml";
|
|
4844
5030
|
function generateCharterMd(input) {
|
|
4845
5031
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
4846
5032
|
const frontmatter = {
|
|
@@ -4855,7 +5041,7 @@ function generateCharterMd(input) {
|
|
|
4855
5041
|
created: today,
|
|
4856
5042
|
last_updated: today
|
|
4857
5043
|
};
|
|
4858
|
-
const yaml =
|
|
5044
|
+
const yaml = stringifyYaml2(frontmatter, { lineWidth: 0 });
|
|
4859
5045
|
const desc = input.description ?? "";
|
|
4860
5046
|
const roleDisplay = input.role ?? "";
|
|
4861
5047
|
const reportsTo = input.reports_to ? `
|
|
@@ -4885,7 +5071,7 @@ ${desc}
|
|
|
4885
5071
|
}
|
|
4886
5072
|
|
|
4887
5073
|
// ../../packages/core/dist/generation/tools-generator.js
|
|
4888
|
-
import { stringify as
|
|
5074
|
+
import { stringify as stringifyYaml3 } from "yaml";
|
|
4889
5075
|
function generateToolsMd(input) {
|
|
4890
5076
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
4891
5077
|
const globalControls = {
|
|
@@ -4906,7 +5092,7 @@ function generateToolsMd(input) {
|
|
|
4906
5092
|
global_controls: globalControls,
|
|
4907
5093
|
tools: input.tools ?? []
|
|
4908
5094
|
};
|
|
4909
|
-
const yaml =
|
|
5095
|
+
const yaml = stringifyYaml3(frontmatter, { lineWidth: 0 });
|
|
4910
5096
|
const toolsList = frontmatter.tools.length > 0 ? frontmatter.tools.map((t) => `- **${t.name}** (\`${t.id}\`): ${t.description} [${t.access}, ${t.limits.timeout_ms}ms, ${t.limits.rate_limit_rpm}rpm]`).join("\n") : "No tools configured.";
|
|
4911
5097
|
return `# TOOLS \u2014 ${input.display_name}
|
|
4912
5098
|
|
|
@@ -5791,4 +5977,4 @@ export {
|
|
|
5791
5977
|
detectDrift,
|
|
5792
5978
|
provision
|
|
5793
5979
|
};
|
|
5794
|
-
//# sourceMappingURL=chunk-
|
|
5980
|
+
//# sourceMappingURL=chunk-WTMVQND4.js.map
|