@artyfacts/openclaw 0.1.0 → 0.1.1

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/cli.js CHANGED
@@ -999,136 +999,6 @@ function createMcpHandler(config) {
999
999
  return new McpHandler(config);
1000
1000
  }
1001
1001
 
1002
- // src/introspect.ts
1003
- var import_promises = require("fs/promises");
1004
- var import_path = require("path");
1005
- var import_os = require("os");
1006
- var import_child_process3 = require("child_process");
1007
- var OPENCLAW_DIR = (0, import_path.join)((0, import_os.homedir)(), ".openclaw");
1008
- var CONFIG_FILE = (0, import_path.join)(OPENCLAW_DIR, "openclaw.json");
1009
- var CRON_FILE = (0, import_path.join)(OPENCLAW_DIR, "cron", "jobs.json");
1010
- var SKILLS_DIR = (0, import_path.join)(OPENCLAW_DIR, "skills");
1011
- function parseJson5(content) {
1012
- const stripped = content.split("\n").map((line) => {
1013
- const commentIndex = line.indexOf("//");
1014
- if (commentIndex === -1) return line;
1015
- const beforeComment = line.slice(0, commentIndex);
1016
- const quotes = (beforeComment.match(/"/g) || []).length;
1017
- if (quotes % 2 === 0) {
1018
- return beforeComment;
1019
- }
1020
- return line;
1021
- }).join("\n");
1022
- const noTrailing = stripped.replace(/,(\s*[}\]])/g, "$1");
1023
- return JSON.parse(noTrailing);
1024
- }
1025
- async function readCronJobs() {
1026
- try {
1027
- const content = await (0, import_promises.readFile)(CRON_FILE, "utf-8");
1028
- const jobs = JSON.parse(content);
1029
- return Array.isArray(jobs) ? jobs : [];
1030
- } catch (err) {
1031
- return [];
1032
- }
1033
- }
1034
- async function readMainConfig() {
1035
- try {
1036
- const content = await (0, import_promises.readFile)(CONFIG_FILE, "utf-8");
1037
- const config = parseJson5(content);
1038
- const agentsConfig = config.agents;
1039
- const defaults = agentsConfig?.defaults;
1040
- const heartbeat = defaults?.heartbeat;
1041
- const agentsList = agentsConfig?.list || [];
1042
- const channelsConfig = config.channels;
1043
- const channelNames = channelsConfig ? Object.keys(channelsConfig).filter((k) => k !== "defaults") : [];
1044
- return {
1045
- heartbeat: heartbeat || null,
1046
- agents: agentsList,
1047
- channels: channelNames
1048
- };
1049
- } catch (err) {
1050
- return { heartbeat: null, agents: [], channels: [] };
1051
- }
1052
- }
1053
- async function readMcpServers() {
1054
- try {
1055
- const output = (0, import_child_process3.execSync)("openclaw mcp list --json 2>/dev/null", {
1056
- encoding: "utf-8",
1057
- timeout: 5e3
1058
- });
1059
- const servers = JSON.parse(output);
1060
- return Array.isArray(servers) ? servers : [];
1061
- } catch (err) {
1062
- return [];
1063
- }
1064
- }
1065
- async function readSkills() {
1066
- const skills = [];
1067
- async function scanDir(dir, prefix = "") {
1068
- try {
1069
- const entries = await (0, import_promises.readdir)(dir, { withFileTypes: true });
1070
- for (const entry of entries) {
1071
- const fullPath = (0, import_path.join)(dir, entry.name);
1072
- if (entry.isDirectory()) {
1073
- await scanDir(fullPath, prefix ? `${prefix}/${entry.name}` : entry.name);
1074
- } else if (entry.name === "SKILL.md") {
1075
- const skillName = prefix || "root";
1076
- const content = await (0, import_promises.readFile)(fullPath, "utf-8");
1077
- const lines = content.split("\n");
1078
- const descLine = lines.find((l) => l.trim() && !l.startsWith("#"));
1079
- skills.push({
1080
- name: skillName,
1081
- path: fullPath,
1082
- description: descLine?.trim().slice(0, 200),
1083
- content
1084
- });
1085
- }
1086
- }
1087
- } catch (err) {
1088
- }
1089
- }
1090
- await scanDir(SKILLS_DIR);
1091
- return skills;
1092
- }
1093
- async function introspect() {
1094
- const [crons, mainConfig, mcpServers, skills] = await Promise.all([
1095
- readCronJobs(),
1096
- readMainConfig(),
1097
- readMcpServers(),
1098
- readSkills()
1099
- ]);
1100
- return {
1101
- crons,
1102
- heartbeat: mainConfig.heartbeat,
1103
- agents: mainConfig.agents,
1104
- mcpServers,
1105
- skills,
1106
- channels: mainConfig.channels
1107
- };
1108
- }
1109
- function summarize(config) {
1110
- const parts = [];
1111
- if (config.crons.length > 0) {
1112
- parts.push(`${config.crons.length} cron job(s)`);
1113
- }
1114
- if (config.heartbeat) {
1115
- parts.push(`heartbeat: ${config.heartbeat.every || "30m"}`);
1116
- }
1117
- if (config.agents.length > 0) {
1118
- parts.push(`${config.agents.length} agent(s)`);
1119
- }
1120
- if (config.mcpServers.length > 0) {
1121
- parts.push(`${config.mcpServers.length} MCP server(s)`);
1122
- }
1123
- if (config.skills.length > 0) {
1124
- parts.push(`${config.skills.length} skill(s)`);
1125
- }
1126
- if (config.channels.length > 0) {
1127
- parts.push(`channels: ${config.channels.join(", ")}`);
1128
- }
1129
- return parts.length > 0 ? parts.join(" | ") : "No configuration found";
1130
- }
1131
-
1132
1002
  // src/cli.ts
1133
1003
  var VERSION = "0.1.0";
1134
1004
  var DEFAULT_BASE_URL4 = "https://artyfacts.dev/api/v1";
@@ -1195,178 +1065,6 @@ program.command("status").description("Check authentication and connection statu
1195
1065
  console.log("\u26A0\uFE0F Artyfacts MCP tools not configured");
1196
1066
  console.log(" Will configure automatically on first run");
1197
1067
  }
1198
- console.log("");
1199
- console.log("\u{1F4C2} Local Configuration:");
1200
- try {
1201
- const config = await introspect();
1202
- const summary = summarize(config);
1203
- console.log(` ${summary}`);
1204
- if (config.crons.length > 0 || config.skills.length > 0 || config.mcpServers.length > 0) {
1205
- console.log("");
1206
- console.log(" Run `npx @artyfacts/openclaw introspect` for details");
1207
- console.log(" Run `npx @artyfacts/openclaw import` to sync to Artyfacts");
1208
- }
1209
- } catch (err) {
1210
- console.log(" (Could not read local config)");
1211
- }
1212
- });
1213
- program.command("introspect").description("Show detailed local OpenClaw configuration").option("--json", "Output as JSON").action(async (options) => {
1214
- try {
1215
- const config = await introspect();
1216
- if (options.json) {
1217
- console.log(JSON.stringify(config, null, 2));
1218
- return;
1219
- }
1220
- console.log("");
1221
- console.log("\u{1F4C2} OpenClaw Configuration");
1222
- console.log("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
1223
- console.log("");
1224
- console.log(`\u{1F4C5} Cron Jobs (${config.crons.length})`);
1225
- if (config.crons.length === 0) {
1226
- console.log(" (none)");
1227
- } else {
1228
- for (const job of config.crons) {
1229
- const schedule = job.schedule.cron || job.schedule.every || job.schedule.at;
1230
- const status = job.enabled === false ? " [disabled]" : "";
1231
- console.log(` \u2022 ${job.name || job.jobId}: ${schedule}${status}`);
1232
- }
1233
- }
1234
- console.log("");
1235
- console.log("\u{1F493} Heartbeat");
1236
- if (config.heartbeat) {
1237
- console.log(` Interval: ${config.heartbeat.every || "30m"}`);
1238
- if (config.heartbeat.target) {
1239
- console.log(` Target: ${config.heartbeat.target}${config.heartbeat.to ? ` \u2192 ${config.heartbeat.to}` : ""}`);
1240
- }
1241
- if (config.heartbeat.activeHours) {
1242
- console.log(` Active: ${config.heartbeat.activeHours.start} - ${config.heartbeat.activeHours.end}`);
1243
- }
1244
- } else {
1245
- console.log(" (using defaults or disabled)");
1246
- }
1247
- console.log("");
1248
- console.log(`\u{1F916} Agents (${config.agents.length})`);
1249
- if (config.agents.length === 0) {
1250
- console.log(" (using default agent)");
1251
- } else {
1252
- for (const agent of config.agents) {
1253
- const def = agent.default ? " [default]" : "";
1254
- console.log(` \u2022 ${agent.id}${agent.name ? ` (${agent.name})` : ""}${def}`);
1255
- }
1256
- }
1257
- console.log("");
1258
- console.log(`\u{1F50C} MCP Servers (${config.mcpServers.length})`);
1259
- if (config.mcpServers.length === 0) {
1260
- console.log(" (none)");
1261
- } else {
1262
- for (const server of config.mcpServers) {
1263
- console.log(` \u2022 ${server.name}: ${server.url || server.command}`);
1264
- }
1265
- }
1266
- console.log("");
1267
- console.log(`\u{1F4DA} Skills (${config.skills.length})`);
1268
- if (config.skills.length === 0) {
1269
- console.log(" (none in ~/.openclaw/skills/)");
1270
- } else {
1271
- for (const skill of config.skills) {
1272
- const desc = skill.description ? ` - ${skill.description.slice(0, 50)}...` : "";
1273
- console.log(` \u2022 ${skill.name}${desc}`);
1274
- }
1275
- }
1276
- console.log("");
1277
- console.log(`\u{1F4F1} Channels (${config.channels.length})`);
1278
- if (config.channels.length === 0) {
1279
- console.log(" (none configured)");
1280
- } else {
1281
- console.log(` ${config.channels.join(", ")}`);
1282
- }
1283
- console.log("");
1284
- } catch (err) {
1285
- console.error("\u274C Failed to read configuration:", err instanceof Error ? err.message : err);
1286
- process.exit(1);
1287
- }
1288
- });
1289
- program.command("import").description("Import local OpenClaw configuration to Artyfacts").option("--base-url <url>", "Artyfacts API base URL", DEFAULT_BASE_URL4).option("--dry-run", "Show what would be imported without importing").option("--crons", "Import only cron jobs").option("--skills", "Import only skills").option("--mcp", "Import only MCP servers").option("--agents", "Import only agents").action(async (options) => {
1290
- const credentials = loadCredentials();
1291
- if (!credentials) {
1292
- console.log("\u274C Not authenticated. Run login first:");
1293
- console.log(" npx @artyfacts/openclaw login");
1294
- process.exit(1);
1295
- }
1296
- try {
1297
- const config = await introspect();
1298
- const importAll = !options.crons && !options.skills && !options.mcp && !options.agents;
1299
- const toImport = {
1300
- crons: importAll || options.crons,
1301
- skills: importAll || options.skills,
1302
- mcp: importAll || options.mcp,
1303
- agents: importAll || options.agents
1304
- };
1305
- console.log("");
1306
- console.log("\u{1F4E4} Importing to Artyfacts");
1307
- console.log("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
1308
- console.log("");
1309
- const payload = {
1310
- source: "openclaw",
1311
- agentId: credentials.agentId
1312
- };
1313
- if (toImport.crons && config.crons.length > 0) {
1314
- console.log(`\u{1F4C5} Cron jobs: ${config.crons.length}`);
1315
- payload.crons = config.crons;
1316
- }
1317
- if (toImport.skills && config.skills.length > 0) {
1318
- console.log(`\u{1F4DA} Skills: ${config.skills.length}`);
1319
- payload.skills = config.skills.map((s) => ({
1320
- name: s.name,
1321
- description: s.description,
1322
- content: s.content
1323
- }));
1324
- }
1325
- if (toImport.mcp && config.mcpServers.length > 0) {
1326
- console.log(`\u{1F50C} MCP servers: ${config.mcpServers.length}`);
1327
- payload.mcpServers = config.mcpServers;
1328
- }
1329
- if (toImport.agents && config.agents.length > 0) {
1330
- console.log(`\u{1F916} Agents: ${config.agents.length}`);
1331
- payload.agents = config.agents;
1332
- }
1333
- if (config.heartbeat && (importAll || options.agents)) {
1334
- console.log("\u{1F493} Heartbeat config");
1335
- payload.heartbeat = config.heartbeat;
1336
- }
1337
- if (config.channels.length > 0 && importAll) {
1338
- payload.channels = config.channels;
1339
- }
1340
- console.log("");
1341
- if (options.dryRun) {
1342
- console.log("[DRY RUN] Would import:");
1343
- console.log(JSON.stringify(payload, null, 2));
1344
- return;
1345
- }
1346
- const response = await fetch(`${options.baseUrl}/agents/${credentials.agentId}/config/import`, {
1347
- method: "POST",
1348
- headers: {
1349
- "Content-Type": "application/json",
1350
- "Authorization": `Bearer ${credentials.apiKey}`
1351
- },
1352
- body: JSON.stringify(payload)
1353
- });
1354
- if (!response.ok) {
1355
- const errorText = await response.text();
1356
- throw new Error(`Import failed: ${errorText}`);
1357
- }
1358
- const result = await response.json();
1359
- console.log("\u2705 Import successful!");
1360
- if (result.imported) {
1361
- console.log(` Imported: ${Object.entries(result.imported).map(([k, v]) => `${v} ${k}`).join(", ")}`);
1362
- }
1363
- console.log("");
1364
- console.log(" View in Artyfacts: https://artyfacts.dev/agents/" + credentials.agentId);
1365
- console.log("");
1366
- } catch (err) {
1367
- console.error("\u274C Import failed:", err instanceof Error ? err.message : err);
1368
- process.exit(1);
1369
- }
1370
1068
  });
1371
1069
  program.command("configure").description("Configure Artyfacts MCP tools for OpenClaw").option("--base-url <url>", "Artyfacts API base URL", DEFAULT_BASE_URL4).option("--openclaw-path <path>", "Path to openclaw CLI", "openclaw").action(async (options) => {
1372
1070
  const credentials = loadCredentials();
package/dist/cli.mjs CHANGED
@@ -5,11 +5,9 @@ import {
5
5
  createListener,
6
6
  createMcpHandler,
7
7
  getCredentials,
8
- introspect,
9
8
  loadCredentials,
10
- promptForApiKey,
11
- summarize
12
- } from "./chunk-CTWVGZRX.mjs";
9
+ promptForApiKey
10
+ } from "./chunk-TT3SG5BN.mjs";
13
11
 
14
12
  // src/cli.ts
15
13
  import { Command } from "commander";
@@ -78,178 +76,6 @@ program.command("status").description("Check authentication and connection statu
78
76
  console.log("\u26A0\uFE0F Artyfacts MCP tools not configured");
79
77
  console.log(" Will configure automatically on first run");
80
78
  }
81
- console.log("");
82
- console.log("\u{1F4C2} Local Configuration:");
83
- try {
84
- const config = await introspect();
85
- const summary = summarize(config);
86
- console.log(` ${summary}`);
87
- if (config.crons.length > 0 || config.skills.length > 0 || config.mcpServers.length > 0) {
88
- console.log("");
89
- console.log(" Run `npx @artyfacts/openclaw introspect` for details");
90
- console.log(" Run `npx @artyfacts/openclaw import` to sync to Artyfacts");
91
- }
92
- } catch (err) {
93
- console.log(" (Could not read local config)");
94
- }
95
- });
96
- program.command("introspect").description("Show detailed local OpenClaw configuration").option("--json", "Output as JSON").action(async (options) => {
97
- try {
98
- const config = await introspect();
99
- if (options.json) {
100
- console.log(JSON.stringify(config, null, 2));
101
- return;
102
- }
103
- console.log("");
104
- console.log("\u{1F4C2} OpenClaw Configuration");
105
- console.log("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
106
- console.log("");
107
- console.log(`\u{1F4C5} Cron Jobs (${config.crons.length})`);
108
- if (config.crons.length === 0) {
109
- console.log(" (none)");
110
- } else {
111
- for (const job of config.crons) {
112
- const schedule = job.schedule.cron || job.schedule.every || job.schedule.at;
113
- const status = job.enabled === false ? " [disabled]" : "";
114
- console.log(` \u2022 ${job.name || job.jobId}: ${schedule}${status}`);
115
- }
116
- }
117
- console.log("");
118
- console.log("\u{1F493} Heartbeat");
119
- if (config.heartbeat) {
120
- console.log(` Interval: ${config.heartbeat.every || "30m"}`);
121
- if (config.heartbeat.target) {
122
- console.log(` Target: ${config.heartbeat.target}${config.heartbeat.to ? ` \u2192 ${config.heartbeat.to}` : ""}`);
123
- }
124
- if (config.heartbeat.activeHours) {
125
- console.log(` Active: ${config.heartbeat.activeHours.start} - ${config.heartbeat.activeHours.end}`);
126
- }
127
- } else {
128
- console.log(" (using defaults or disabled)");
129
- }
130
- console.log("");
131
- console.log(`\u{1F916} Agents (${config.agents.length})`);
132
- if (config.agents.length === 0) {
133
- console.log(" (using default agent)");
134
- } else {
135
- for (const agent of config.agents) {
136
- const def = agent.default ? " [default]" : "";
137
- console.log(` \u2022 ${agent.id}${agent.name ? ` (${agent.name})` : ""}${def}`);
138
- }
139
- }
140
- console.log("");
141
- console.log(`\u{1F50C} MCP Servers (${config.mcpServers.length})`);
142
- if (config.mcpServers.length === 0) {
143
- console.log(" (none)");
144
- } else {
145
- for (const server of config.mcpServers) {
146
- console.log(` \u2022 ${server.name}: ${server.url || server.command}`);
147
- }
148
- }
149
- console.log("");
150
- console.log(`\u{1F4DA} Skills (${config.skills.length})`);
151
- if (config.skills.length === 0) {
152
- console.log(" (none in ~/.openclaw/skills/)");
153
- } else {
154
- for (const skill of config.skills) {
155
- const desc = skill.description ? ` - ${skill.description.slice(0, 50)}...` : "";
156
- console.log(` \u2022 ${skill.name}${desc}`);
157
- }
158
- }
159
- console.log("");
160
- console.log(`\u{1F4F1} Channels (${config.channels.length})`);
161
- if (config.channels.length === 0) {
162
- console.log(" (none configured)");
163
- } else {
164
- console.log(` ${config.channels.join(", ")}`);
165
- }
166
- console.log("");
167
- } catch (err) {
168
- console.error("\u274C Failed to read configuration:", err instanceof Error ? err.message : err);
169
- process.exit(1);
170
- }
171
- });
172
- program.command("import").description("Import local OpenClaw configuration to Artyfacts").option("--base-url <url>", "Artyfacts API base URL", DEFAULT_BASE_URL).option("--dry-run", "Show what would be imported without importing").option("--crons", "Import only cron jobs").option("--skills", "Import only skills").option("--mcp", "Import only MCP servers").option("--agents", "Import only agents").action(async (options) => {
173
- const credentials = loadCredentials();
174
- if (!credentials) {
175
- console.log("\u274C Not authenticated. Run login first:");
176
- console.log(" npx @artyfacts/openclaw login");
177
- process.exit(1);
178
- }
179
- try {
180
- const config = await introspect();
181
- const importAll = !options.crons && !options.skills && !options.mcp && !options.agents;
182
- const toImport = {
183
- crons: importAll || options.crons,
184
- skills: importAll || options.skills,
185
- mcp: importAll || options.mcp,
186
- agents: importAll || options.agents
187
- };
188
- console.log("");
189
- console.log("\u{1F4E4} Importing to Artyfacts");
190
- console.log("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
191
- console.log("");
192
- const payload = {
193
- source: "openclaw",
194
- agentId: credentials.agentId
195
- };
196
- if (toImport.crons && config.crons.length > 0) {
197
- console.log(`\u{1F4C5} Cron jobs: ${config.crons.length}`);
198
- payload.crons = config.crons;
199
- }
200
- if (toImport.skills && config.skills.length > 0) {
201
- console.log(`\u{1F4DA} Skills: ${config.skills.length}`);
202
- payload.skills = config.skills.map((s) => ({
203
- name: s.name,
204
- description: s.description,
205
- content: s.content
206
- }));
207
- }
208
- if (toImport.mcp && config.mcpServers.length > 0) {
209
- console.log(`\u{1F50C} MCP servers: ${config.mcpServers.length}`);
210
- payload.mcpServers = config.mcpServers;
211
- }
212
- if (toImport.agents && config.agents.length > 0) {
213
- console.log(`\u{1F916} Agents: ${config.agents.length}`);
214
- payload.agents = config.agents;
215
- }
216
- if (config.heartbeat && (importAll || options.agents)) {
217
- console.log("\u{1F493} Heartbeat config");
218
- payload.heartbeat = config.heartbeat;
219
- }
220
- if (config.channels.length > 0 && importAll) {
221
- payload.channels = config.channels;
222
- }
223
- console.log("");
224
- if (options.dryRun) {
225
- console.log("[DRY RUN] Would import:");
226
- console.log(JSON.stringify(payload, null, 2));
227
- return;
228
- }
229
- const response = await fetch(`${options.baseUrl}/agents/${credentials.agentId}/config/import`, {
230
- method: "POST",
231
- headers: {
232
- "Content-Type": "application/json",
233
- "Authorization": `Bearer ${credentials.apiKey}`
234
- },
235
- body: JSON.stringify(payload)
236
- });
237
- if (!response.ok) {
238
- const errorText = await response.text();
239
- throw new Error(`Import failed: ${errorText}`);
240
- }
241
- const result = await response.json();
242
- console.log("\u2705 Import successful!");
243
- if (result.imported) {
244
- console.log(` Imported: ${Object.entries(result.imported).map(([k, v]) => `${v} ${k}`).join(", ")}`);
245
- }
246
- console.log("");
247
- console.log(" View in Artyfacts: https://artyfacts.dev/agents/" + credentials.agentId);
248
- console.log("");
249
- } catch (err) {
250
- console.error("\u274C Import failed:", err instanceof Error ? err.message : err);
251
- process.exit(1);
252
- }
253
79
  });
254
80
  program.command("configure").description("Configure Artyfacts MCP tools for OpenClaw").option("--base-url <url>", "Artyfacts API base URL", DEFAULT_BASE_URL).option("--openclaw-path <path>", "Path to openclaw CLI", "openclaw").action(async (options) => {
255
81
  const credentials = loadCredentials();
package/dist/index.d.mts CHANGED
@@ -366,81 +366,4 @@ declare class McpHandler {
366
366
  }
367
367
  declare function createMcpHandler(config: McpConfig): McpHandler;
368
368
 
369
- /**
370
- * Introspect OpenClaw local configuration
371
- * Reads config files and returns structured data for Artyfacts import
372
- */
373
- interface CronJob {
374
- jobId: string;
375
- name?: string;
376
- schedule: {
377
- kind: 'at' | 'every' | 'cron';
378
- at?: string;
379
- every?: number;
380
- cron?: string;
381
- timezone?: string;
382
- };
383
- payload: {
384
- kind: 'systemEvent' | 'agentTurn';
385
- message?: string;
386
- };
387
- delivery?: {
388
- mode: 'none' | 'announce' | 'webhook';
389
- channel?: string;
390
- to?: string;
391
- };
392
- enabled?: boolean;
393
- }
394
- interface HeartbeatConfig {
395
- every?: string;
396
- model?: string;
397
- prompt?: string;
398
- target?: string;
399
- to?: string;
400
- lightContext?: boolean;
401
- isolatedSession?: boolean;
402
- activeHours?: {
403
- start: string;
404
- end: string;
405
- };
406
- }
407
- interface AgentConfig {
408
- id: string;
409
- name?: string;
410
- default?: boolean;
411
- heartbeat?: HeartbeatConfig;
412
- model?: string;
413
- systemPrompt?: string;
414
- }
415
- interface McpServer {
416
- name: string;
417
- command?: string;
418
- args?: string[];
419
- url?: string;
420
- transport?: 'stdio' | 'http' | 'sse';
421
- env?: Record<string, string>;
422
- }
423
- interface Skill {
424
- name: string;
425
- path: string;
426
- description?: string;
427
- content?: string;
428
- }
429
- interface OpenClawConfig {
430
- crons: CronJob[];
431
- heartbeat: HeartbeatConfig | null;
432
- agents: AgentConfig[];
433
- mcpServers: McpServer[];
434
- skills: Skill[];
435
- channels: string[];
436
- }
437
- /**
438
- * Introspect all OpenClaw configuration
439
- */
440
- declare function introspect(): Promise<OpenClawConfig>;
441
- /**
442
- * Get a summary of the configuration for display
443
- */
444
- declare function summarize(config: OpenClawConfig): string;
445
-
446
- export { type AgentConfig, ArtyfactsListener, ContextFetcher, type Credentials, type CronJob, type ExecutionResult, type ExecutorConfig, type HeartbeatConfig, type ListenerConfig, type McpConfig, type McpConnectRequestEvent, McpHandler, type McpServer, type McpStatus, type OpenClawConfig, OpenClawExecutor, type Skill, type TaskAssignedEvent, type TaskContext, type TaskFullContext, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, createMcpHandler, getCredentials, introspect, loadCredentials, promptForApiKey, saveCredentials, summarize };
369
+ export { ArtyfactsListener, ContextFetcher, type Credentials, type ExecutionResult, type ExecutorConfig, type ListenerConfig, type McpConfig, type McpConnectRequestEvent, McpHandler, type McpStatus, OpenClawExecutor, type TaskAssignedEvent, type TaskContext, type TaskFullContext, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, createMcpHandler, getCredentials, loadCredentials, promptForApiKey, saveCredentials };
package/dist/index.d.ts CHANGED
@@ -366,81 +366,4 @@ declare class McpHandler {
366
366
  }
367
367
  declare function createMcpHandler(config: McpConfig): McpHandler;
368
368
 
369
- /**
370
- * Introspect OpenClaw local configuration
371
- * Reads config files and returns structured data for Artyfacts import
372
- */
373
- interface CronJob {
374
- jobId: string;
375
- name?: string;
376
- schedule: {
377
- kind: 'at' | 'every' | 'cron';
378
- at?: string;
379
- every?: number;
380
- cron?: string;
381
- timezone?: string;
382
- };
383
- payload: {
384
- kind: 'systemEvent' | 'agentTurn';
385
- message?: string;
386
- };
387
- delivery?: {
388
- mode: 'none' | 'announce' | 'webhook';
389
- channel?: string;
390
- to?: string;
391
- };
392
- enabled?: boolean;
393
- }
394
- interface HeartbeatConfig {
395
- every?: string;
396
- model?: string;
397
- prompt?: string;
398
- target?: string;
399
- to?: string;
400
- lightContext?: boolean;
401
- isolatedSession?: boolean;
402
- activeHours?: {
403
- start: string;
404
- end: string;
405
- };
406
- }
407
- interface AgentConfig {
408
- id: string;
409
- name?: string;
410
- default?: boolean;
411
- heartbeat?: HeartbeatConfig;
412
- model?: string;
413
- systemPrompt?: string;
414
- }
415
- interface McpServer {
416
- name: string;
417
- command?: string;
418
- args?: string[];
419
- url?: string;
420
- transport?: 'stdio' | 'http' | 'sse';
421
- env?: Record<string, string>;
422
- }
423
- interface Skill {
424
- name: string;
425
- path: string;
426
- description?: string;
427
- content?: string;
428
- }
429
- interface OpenClawConfig {
430
- crons: CronJob[];
431
- heartbeat: HeartbeatConfig | null;
432
- agents: AgentConfig[];
433
- mcpServers: McpServer[];
434
- skills: Skill[];
435
- channels: string[];
436
- }
437
- /**
438
- * Introspect all OpenClaw configuration
439
- */
440
- declare function introspect(): Promise<OpenClawConfig>;
441
- /**
442
- * Get a summary of the configuration for display
443
- */
444
- declare function summarize(config: OpenClawConfig): string;
445
-
446
- export { type AgentConfig, ArtyfactsListener, ContextFetcher, type Credentials, type CronJob, type ExecutionResult, type ExecutorConfig, type HeartbeatConfig, type ListenerConfig, type McpConfig, type McpConnectRequestEvent, McpHandler, type McpServer, type McpStatus, type OpenClawConfig, OpenClawExecutor, type Skill, type TaskAssignedEvent, type TaskContext, type TaskFullContext, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, createMcpHandler, getCredentials, introspect, loadCredentials, promptForApiKey, saveCredentials, summarize };
369
+ export { ArtyfactsListener, ContextFetcher, type Credentials, type ExecutionResult, type ExecutorConfig, type ListenerConfig, type McpConfig, type McpConnectRequestEvent, McpHandler, type McpStatus, OpenClawExecutor, type TaskAssignedEvent, type TaskContext, type TaskFullContext, buildPromptWithContext, clearCredentials, createContextFetcher, createExecutor, createListener, createMcpHandler, getCredentials, loadCredentials, promptForApiKey, saveCredentials };
package/dist/index.js CHANGED
@@ -41,11 +41,9 @@ __export(index_exports, {
41
41
  createListener: () => createListener,
42
42
  createMcpHandler: () => createMcpHandler,
43
43
  getCredentials: () => getCredentials,
44
- introspect: () => introspect,
45
44
  loadCredentials: () => loadCredentials,
46
45
  promptForApiKey: () => promptForApiKey,
47
- saveCredentials: () => saveCredentials,
48
- summarize: () => summarize
46
+ saveCredentials: () => saveCredentials
49
47
  });
50
48
  module.exports = __toCommonJS(index_exports);
51
49
 
@@ -1021,136 +1019,6 @@ var McpHandler = class {
1021
1019
  function createMcpHandler(config) {
1022
1020
  return new McpHandler(config);
1023
1021
  }
1024
-
1025
- // src/introspect.ts
1026
- var import_promises = require("fs/promises");
1027
- var import_path = require("path");
1028
- var import_os = require("os");
1029
- var import_child_process3 = require("child_process");
1030
- var OPENCLAW_DIR = (0, import_path.join)((0, import_os.homedir)(), ".openclaw");
1031
- var CONFIG_FILE = (0, import_path.join)(OPENCLAW_DIR, "openclaw.json");
1032
- var CRON_FILE = (0, import_path.join)(OPENCLAW_DIR, "cron", "jobs.json");
1033
- var SKILLS_DIR = (0, import_path.join)(OPENCLAW_DIR, "skills");
1034
- function parseJson5(content) {
1035
- const stripped = content.split("\n").map((line) => {
1036
- const commentIndex = line.indexOf("//");
1037
- if (commentIndex === -1) return line;
1038
- const beforeComment = line.slice(0, commentIndex);
1039
- const quotes = (beforeComment.match(/"/g) || []).length;
1040
- if (quotes % 2 === 0) {
1041
- return beforeComment;
1042
- }
1043
- return line;
1044
- }).join("\n");
1045
- const noTrailing = stripped.replace(/,(\s*[}\]])/g, "$1");
1046
- return JSON.parse(noTrailing);
1047
- }
1048
- async function readCronJobs() {
1049
- try {
1050
- const content = await (0, import_promises.readFile)(CRON_FILE, "utf-8");
1051
- const jobs = JSON.parse(content);
1052
- return Array.isArray(jobs) ? jobs : [];
1053
- } catch (err) {
1054
- return [];
1055
- }
1056
- }
1057
- async function readMainConfig() {
1058
- try {
1059
- const content = await (0, import_promises.readFile)(CONFIG_FILE, "utf-8");
1060
- const config = parseJson5(content);
1061
- const agentsConfig = config.agents;
1062
- const defaults = agentsConfig?.defaults;
1063
- const heartbeat = defaults?.heartbeat;
1064
- const agentsList = agentsConfig?.list || [];
1065
- const channelsConfig = config.channels;
1066
- const channelNames = channelsConfig ? Object.keys(channelsConfig).filter((k) => k !== "defaults") : [];
1067
- return {
1068
- heartbeat: heartbeat || null,
1069
- agents: agentsList,
1070
- channels: channelNames
1071
- };
1072
- } catch (err) {
1073
- return { heartbeat: null, agents: [], channels: [] };
1074
- }
1075
- }
1076
- async function readMcpServers() {
1077
- try {
1078
- const output = (0, import_child_process3.execSync)("openclaw mcp list --json 2>/dev/null", {
1079
- encoding: "utf-8",
1080
- timeout: 5e3
1081
- });
1082
- const servers = JSON.parse(output);
1083
- return Array.isArray(servers) ? servers : [];
1084
- } catch (err) {
1085
- return [];
1086
- }
1087
- }
1088
- async function readSkills() {
1089
- const skills = [];
1090
- async function scanDir(dir, prefix = "") {
1091
- try {
1092
- const entries = await (0, import_promises.readdir)(dir, { withFileTypes: true });
1093
- for (const entry of entries) {
1094
- const fullPath = (0, import_path.join)(dir, entry.name);
1095
- if (entry.isDirectory()) {
1096
- await scanDir(fullPath, prefix ? `${prefix}/${entry.name}` : entry.name);
1097
- } else if (entry.name === "SKILL.md") {
1098
- const skillName = prefix || "root";
1099
- const content = await (0, import_promises.readFile)(fullPath, "utf-8");
1100
- const lines = content.split("\n");
1101
- const descLine = lines.find((l) => l.trim() && !l.startsWith("#"));
1102
- skills.push({
1103
- name: skillName,
1104
- path: fullPath,
1105
- description: descLine?.trim().slice(0, 200),
1106
- content
1107
- });
1108
- }
1109
- }
1110
- } catch (err) {
1111
- }
1112
- }
1113
- await scanDir(SKILLS_DIR);
1114
- return skills;
1115
- }
1116
- async function introspect() {
1117
- const [crons, mainConfig, mcpServers, skills] = await Promise.all([
1118
- readCronJobs(),
1119
- readMainConfig(),
1120
- readMcpServers(),
1121
- readSkills()
1122
- ]);
1123
- return {
1124
- crons,
1125
- heartbeat: mainConfig.heartbeat,
1126
- agents: mainConfig.agents,
1127
- mcpServers,
1128
- skills,
1129
- channels: mainConfig.channels
1130
- };
1131
- }
1132
- function summarize(config) {
1133
- const parts = [];
1134
- if (config.crons.length > 0) {
1135
- parts.push(`${config.crons.length} cron job(s)`);
1136
- }
1137
- if (config.heartbeat) {
1138
- parts.push(`heartbeat: ${config.heartbeat.every || "30m"}`);
1139
- }
1140
- if (config.agents.length > 0) {
1141
- parts.push(`${config.agents.length} agent(s)`);
1142
- }
1143
- if (config.mcpServers.length > 0) {
1144
- parts.push(`${config.mcpServers.length} MCP server(s)`);
1145
- }
1146
- if (config.skills.length > 0) {
1147
- parts.push(`${config.skills.length} skill(s)`);
1148
- }
1149
- if (config.channels.length > 0) {
1150
- parts.push(`channels: ${config.channels.join(", ")}`);
1151
- }
1152
- return parts.length > 0 ? parts.join(" | ") : "No configuration found";
1153
- }
1154
1022
  // Annotate the CommonJS export names for ESM import in node:
1155
1023
  0 && (module.exports = {
1156
1024
  ArtyfactsListener,
@@ -1164,9 +1032,7 @@ function summarize(config) {
1164
1032
  createListener,
1165
1033
  createMcpHandler,
1166
1034
  getCredentials,
1167
- introspect,
1168
1035
  loadCredentials,
1169
1036
  promptForApiKey,
1170
- saveCredentials,
1171
- summarize
1037
+ saveCredentials
1172
1038
  });
package/dist/index.mjs CHANGED
@@ -10,12 +10,10 @@ import {
10
10
  createListener,
11
11
  createMcpHandler,
12
12
  getCredentials,
13
- introspect,
14
13
  loadCredentials,
15
14
  promptForApiKey,
16
- saveCredentials,
17
- summarize
18
- } from "./chunk-CTWVGZRX.mjs";
15
+ saveCredentials
16
+ } from "./chunk-TT3SG5BN.mjs";
19
17
  export {
20
18
  ArtyfactsListener,
21
19
  ContextFetcher,
@@ -28,9 +26,7 @@ export {
28
26
  createListener,
29
27
  createMcpHandler,
30
28
  getCredentials,
31
- introspect,
32
29
  loadCredentials,
33
30
  promptForApiKey,
34
- saveCredentials,
35
- summarize
31
+ saveCredentials
36
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artyfacts/openclaw",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenClaw adapter for Artyfacts - Execute tasks using OpenClaw CLI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",