@dot-agent/cli 1.0.0 → 1.0.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/.githooks/pre-commit +2 -0
- package/AGENTS.md +9 -0
- package/LICENSE +185 -0
- package/package.json +25 -1
- package/scripts/ensure-license-headers.sh +54 -0
- package/src/cli.ts +14 -0
- package/src/commands/init.ts +14 -0
- package/src/commands/pack.ts +14 -0
- package/src/commands/run.ts +14 -0
- package/src/commands/unpack.ts +14 -0
- package/src/core/envelope.ts +14 -0
- package/src/core/id.ts +14 -0
- package/src/core/lint.ts +14 -0
- package/src/core/types.ts +14 -0
- package/src/core/zip.ts +14 -0
- package/src/index.ts +14 -0
- package/src/types.kernel-dsl.d.ts +14 -0
- package/src/types.ts +14 -0
- package/src/types.wts.d.ts +14 -0
- package/tests/envelope.test.ts +14 -0
- package/tests/id.test.ts +14 -0
- package/tsup.config.ts +14 -0
- package/vitest.config.ts +14 -0
- package/dist/chunk-PSDRJRNL.js +0 -756
- package/dist/chunk-PSDRJRNL.js.map +0 -1
- package/dist/cli.cjs +0 -863
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -93
- package/dist/cli.js.map +0 -1
- package/dist/index.cjs +0 -799
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -110
- package/dist/index.d.ts +0 -110
- package/dist/index.js +0 -13
- package/dist/index.js.map +0 -1
package/dist/cli.cjs
DELETED
|
@@ -1,863 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
27
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
28
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
29
|
-
|
|
30
|
-
// src/commands/init.ts
|
|
31
|
-
var import_promises = require("fs/promises");
|
|
32
|
-
var import_path = require("path");
|
|
33
|
-
var AGENT_DESCRIPTION_TEMPLATE = (name, domain) => `agent ${name}
|
|
34
|
-
domain ${domain}
|
|
35
|
-
license Apache-2.0
|
|
36
|
-
|
|
37
|
-
description
|
|
38
|
-
Describe what this agent does.
|
|
39
|
-
|
|
40
|
-
behavior agent.behavior
|
|
41
|
-
|
|
42
|
-
capabilities
|
|
43
|
-
ActionName "Describe this capability"
|
|
44
|
-
`;
|
|
45
|
-
var AGENT_BEHAVIOR_TEMPLATE = `state init
|
|
46
|
-
transition to responsive
|
|
47
|
-
|
|
48
|
-
state responsive
|
|
49
|
-
goal "Help the user with their task."
|
|
50
|
-
interact
|
|
51
|
-
on intent "start" transition to responsive
|
|
52
|
-
`;
|
|
53
|
-
var SOUL_TEMPLATE = (name) => `# ${name} \u2014 Persona
|
|
54
|
-
|
|
55
|
-
## Voice and Tone
|
|
56
|
-
|
|
57
|
-
Describe the agent's voice, personality, and communication style.
|
|
58
|
-
`;
|
|
59
|
-
var README_TEMPLATE = (name) => `# ${name}
|
|
60
|
-
|
|
61
|
-
Brief description of what this agent does.
|
|
62
|
-
|
|
63
|
-
## Usage
|
|
64
|
-
|
|
65
|
-
Example of how to use this agent.
|
|
66
|
-
`;
|
|
67
|
-
var LICENSE = `Apache License
|
|
68
|
-
Version 2.0, January 2004
|
|
69
|
-
|
|
70
|
-
http://www.apache.org/licenses/
|
|
71
|
-
|
|
72
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
73
|
-
`;
|
|
74
|
-
async function init(options = {}) {
|
|
75
|
-
const dir = options.dir || process.cwd();
|
|
76
|
-
const name = options.name || (0, import_path.basename)(dir);
|
|
77
|
-
const domain = options.domain || "example.com";
|
|
78
|
-
try {
|
|
79
|
-
await (0, import_promises.stat)(dir);
|
|
80
|
-
} catch {
|
|
81
|
-
await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
82
|
-
}
|
|
83
|
-
const agentDescriptionPath = (0, import_path.join)(dir, "agent.description");
|
|
84
|
-
try {
|
|
85
|
-
await (0, import_promises.stat)(agentDescriptionPath);
|
|
86
|
-
throw new Error(`agent.description already exists at ${agentDescriptionPath}`);
|
|
87
|
-
} catch (err) {
|
|
88
|
-
if (err.code !== "ENOENT") throw err;
|
|
89
|
-
}
|
|
90
|
-
const files = [];
|
|
91
|
-
await (0, import_promises.writeFile)(agentDescriptionPath, AGENT_DESCRIPTION_TEMPLATE(name, domain));
|
|
92
|
-
files.push("agent.description");
|
|
93
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "agent.behavior"), AGENT_BEHAVIOR_TEMPLATE);
|
|
94
|
-
files.push("agent.behavior");
|
|
95
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "SOUL.md"), SOUL_TEMPLATE(name));
|
|
96
|
-
files.push("SOUL.md");
|
|
97
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "README.md"), README_TEMPLATE(name));
|
|
98
|
-
files.push("README.md");
|
|
99
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "LICENSE"), LICENSE);
|
|
100
|
-
files.push("LICENSE");
|
|
101
|
-
await (0, import_promises.mkdir)((0, import_path.join)(dir, "behaviors"), { recursive: true });
|
|
102
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "behaviors", ".gitkeep"), "");
|
|
103
|
-
files.push("behaviors/.gitkeep");
|
|
104
|
-
await (0, import_promises.mkdir)((0, import_path.join)(dir, "guides"), { recursive: true });
|
|
105
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "guides", ".gitkeep"), "");
|
|
106
|
-
files.push("guides/.gitkeep");
|
|
107
|
-
await (0, import_promises.mkdir)((0, import_path.join)(dir, "knowledge"), { recursive: true });
|
|
108
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "knowledge", ".gitkeep"), "");
|
|
109
|
-
files.push("knowledge/.gitkeep");
|
|
110
|
-
await (0, import_promises.writeFile)((0, import_path.join)(dir, "AGENTS.md"), "");
|
|
111
|
-
files.push("AGENTS.md");
|
|
112
|
-
return { dir, files };
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/commands/pack.ts
|
|
116
|
-
var import_promises3 = require("fs/promises");
|
|
117
|
-
var import_path2 = require("path");
|
|
118
|
-
var import_child_process = require("child_process");
|
|
119
|
-
var import_crypto = require("crypto");
|
|
120
|
-
var import_jszip2 = __toESM(require("jszip"), 1);
|
|
121
|
-
|
|
122
|
-
// src/core/lint.ts
|
|
123
|
-
var import_module = require("module");
|
|
124
|
-
var import_web_tree_sitter = require("web-tree-sitter");
|
|
125
|
-
var import_kernel_dsl = require("@dot-agent/kernel-dsl");
|
|
126
|
-
var require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
127
|
-
var { agentWasmPath, behaviorWasmPath } = require2("@dot-agent/tree-sitter");
|
|
128
|
-
var _initialized = false;
|
|
129
|
-
var _agentParser;
|
|
130
|
-
var _behaviorParser;
|
|
131
|
-
var _agentLang;
|
|
132
|
-
var _behaviorLang;
|
|
133
|
-
async function ensureWasmInit() {
|
|
134
|
-
if (_initialized) return;
|
|
135
|
-
try {
|
|
136
|
-
await import_web_tree_sitter.Parser.init();
|
|
137
|
-
} catch (err) {
|
|
138
|
-
throw err;
|
|
139
|
-
}
|
|
140
|
-
_agentParser = new import_web_tree_sitter.Parser();
|
|
141
|
-
_behaviorParser = new import_web_tree_sitter.Parser();
|
|
142
|
-
try {
|
|
143
|
-
_agentLang = await import_web_tree_sitter.Language.load(agentWasmPath);
|
|
144
|
-
_behaviorLang = await import_web_tree_sitter.Language.load(behaviorWasmPath);
|
|
145
|
-
} catch (err) {
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
await (0, import_kernel_dsl.init)();
|
|
150
|
-
} catch (err) {
|
|
151
|
-
}
|
|
152
|
-
_initialized = true;
|
|
153
|
-
}
|
|
154
|
-
function collectSyntaxErrors(node) {
|
|
155
|
-
const errors = [];
|
|
156
|
-
if (node.isError || node.isMissing) errors.push(node);
|
|
157
|
-
for (const child of node.children) {
|
|
158
|
-
errors.push(...collectSyntaxErrors(child));
|
|
159
|
-
}
|
|
160
|
-
return errors;
|
|
161
|
-
}
|
|
162
|
-
function getLineCol(node) {
|
|
163
|
-
return { line: node.startPosition.row + 1, col: node.startPosition.column + 1 };
|
|
164
|
-
}
|
|
165
|
-
async function lintDescription(text) {
|
|
166
|
-
await ensureWasmInit();
|
|
167
|
-
_agentParser.setLanguage(_agentLang);
|
|
168
|
-
const tree = _agentParser.parse(text);
|
|
169
|
-
const messages = [];
|
|
170
|
-
const syntaxErrors = collectSyntaxErrors(tree.rootNode);
|
|
171
|
-
if (syntaxErrors.length > 0) {
|
|
172
|
-
for (const error of syntaxErrors) {
|
|
173
|
-
const { line, col } = getLineCol(error);
|
|
174
|
-
messages.push({
|
|
175
|
-
file: "agent.description",
|
|
176
|
-
line,
|
|
177
|
-
col,
|
|
178
|
-
severity: "error",
|
|
179
|
-
code: "E004",
|
|
180
|
-
message: "Syntax error in description"
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const walk = (node) => {
|
|
185
|
-
if (node.type === "domain_declaration" && node.childCount > 0) {
|
|
186
|
-
const valueNode = node.child(node.childCount - 1);
|
|
187
|
-
if (valueNode && valueNode.text === "example.com") {
|
|
188
|
-
const { line, col } = getLineCol(valueNode);
|
|
189
|
-
messages.push({
|
|
190
|
-
file: "agent.description",
|
|
191
|
-
line,
|
|
192
|
-
col,
|
|
193
|
-
severity: "warning",
|
|
194
|
-
code: "W003",
|
|
195
|
-
message: 'domain still has default value "example.com"'
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
for (const child of node.children) walk(child);
|
|
200
|
-
};
|
|
201
|
-
walk(tree.rootNode);
|
|
202
|
-
return messages;
|
|
203
|
-
}
|
|
204
|
-
async function lintBehavior(text) {
|
|
205
|
-
await ensureWasmInit();
|
|
206
|
-
_behaviorParser.setLanguage(_behaviorLang);
|
|
207
|
-
const tree = _behaviorParser.parse(text);
|
|
208
|
-
const messages = [];
|
|
209
|
-
const syntaxErrors = collectSyntaxErrors(tree.rootNode);
|
|
210
|
-
if (syntaxErrors.length > 0) {
|
|
211
|
-
for (const error of syntaxErrors) {
|
|
212
|
-
const { line, col } = getLineCol(error);
|
|
213
|
-
messages.push({
|
|
214
|
-
file: "agent.behavior",
|
|
215
|
-
line,
|
|
216
|
-
col,
|
|
217
|
-
severity: "error",
|
|
218
|
-
code: "E004",
|
|
219
|
-
message: "Syntax error in behavior DSL"
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
const walk = (node) => {
|
|
224
|
-
if (node.type === "text_block") {
|
|
225
|
-
if (node.text.length > 280) {
|
|
226
|
-
const { line, col } = getLineCol(node);
|
|
227
|
-
messages.push({
|
|
228
|
-
file: "agent.behavior",
|
|
229
|
-
line,
|
|
230
|
-
col,
|
|
231
|
-
severity: "warning",
|
|
232
|
-
code: "W002",
|
|
233
|
-
message: `Text block exceeds 280 characters (${node.text.length})`
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (const child of node.children) walk(child);
|
|
238
|
-
};
|
|
239
|
-
walk(tree.rootNode);
|
|
240
|
-
try {
|
|
241
|
-
const kernel = new import_kernel_dsl.AgentDSLKernel();
|
|
242
|
-
try {
|
|
243
|
-
const effects = kernel.load_behavior(text);
|
|
244
|
-
if (Array.isArray(effects)) {
|
|
245
|
-
for (const effect of effects) {
|
|
246
|
-
if (effect.type === "parse_error") {
|
|
247
|
-
messages.push({
|
|
248
|
-
file: "agent.behavior",
|
|
249
|
-
line: 1,
|
|
250
|
-
col: 1,
|
|
251
|
-
severity: "error",
|
|
252
|
-
code: "E006",
|
|
253
|
-
message: `Parse error: ${effect.message}`
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const graph = kernel.get_graph();
|
|
259
|
-
if (graph?.states) {
|
|
260
|
-
for (const stateName of Object.keys(graph.states)) {
|
|
261
|
-
const state = graph.states[stateName];
|
|
262
|
-
const hasIncoming = graph.transitions?.some((t) => t.to === stateName);
|
|
263
|
-
const hasOutgoing = graph.transitions?.some((t) => t.from === stateName);
|
|
264
|
-
if (!hasIncoming && !hasOutgoing && stateName !== graph.current) {
|
|
265
|
-
messages.push({
|
|
266
|
-
file: "agent.behavior",
|
|
267
|
-
line: 1,
|
|
268
|
-
col: 1,
|
|
269
|
-
severity: "warning",
|
|
270
|
-
code: "W001",
|
|
271
|
-
message: `state "${stateName}" has no transitions`
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} catch (kernelErr) {
|
|
277
|
-
}
|
|
278
|
-
} catch (err) {
|
|
279
|
-
}
|
|
280
|
-
return messages;
|
|
281
|
-
}
|
|
282
|
-
async function createLinter() {
|
|
283
|
-
await ensureWasmInit();
|
|
284
|
-
return {
|
|
285
|
-
lintDescription,
|
|
286
|
-
lintBehavior
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// src/core/id.ts
|
|
291
|
-
function buildId(parts) {
|
|
292
|
-
const { namespace, name, version, digest } = parts;
|
|
293
|
-
if (!namespace || !name || !version || !digest) {
|
|
294
|
-
throw new Error("Missing required ID parts: namespace, name, version, digest");
|
|
295
|
-
}
|
|
296
|
-
return `${namespace}/${name}:${version}~${digest}`;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// src/core/envelope.ts
|
|
300
|
-
function parseAboutme(json) {
|
|
301
|
-
if (!json.schemaVersion) throw new Error("Missing schemaVersion in aboutme.json");
|
|
302
|
-
if (!json.id) throw new Error("Missing id in aboutme.json");
|
|
303
|
-
if (!json.name) throw new Error("Missing name in aboutme.json");
|
|
304
|
-
if (!json.description) throw new Error("Missing description in aboutme.json");
|
|
305
|
-
if (!json.version) throw new Error("Missing version in aboutme.json");
|
|
306
|
-
if (!json.domain) throw new Error("Missing domain in aboutme.json");
|
|
307
|
-
if (!json.license) throw new Error("Missing license in aboutme.json");
|
|
308
|
-
if (!json.persona) throw new Error("Missing persona in aboutme.json");
|
|
309
|
-
if (!json.compiler) throw new Error("Missing compiler in aboutme.json");
|
|
310
|
-
if (!Array.isArray(json.skills)) throw new Error("Missing skills array in aboutme.json");
|
|
311
|
-
if (!Array.isArray(json.requires)) throw new Error("Missing requires array in aboutme.json");
|
|
312
|
-
if (!json.integrity) throw new Error("Missing integrity in aboutme.json");
|
|
313
|
-
return {
|
|
314
|
-
schemaVersion: json.schemaVersion,
|
|
315
|
-
id: json.id,
|
|
316
|
-
name: json.name,
|
|
317
|
-
description: json.description,
|
|
318
|
-
version: json.version,
|
|
319
|
-
domain: json.domain,
|
|
320
|
-
license: json.license,
|
|
321
|
-
persona: json.persona,
|
|
322
|
-
compiler: json.compiler,
|
|
323
|
-
commit: json.commit,
|
|
324
|
-
skills: json.skills,
|
|
325
|
-
requires: json.requires,
|
|
326
|
-
integrity: json.integrity
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function buildAboutme(opts) {
|
|
330
|
-
return {
|
|
331
|
-
schemaVersion: "dot-agent/1.0",
|
|
332
|
-
id: opts.id,
|
|
333
|
-
name: opts.name,
|
|
334
|
-
description: opts.description,
|
|
335
|
-
version: opts.version,
|
|
336
|
-
domain: opts.domain,
|
|
337
|
-
license: opts.license || "Apache-2.0",
|
|
338
|
-
persona: opts.persona,
|
|
339
|
-
compiler: opts.compiler,
|
|
340
|
-
commit: opts.commit,
|
|
341
|
-
skills: opts.skills || [],
|
|
342
|
-
requires: opts.requires || [],
|
|
343
|
-
integrity: opts.integrity
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
function aboutmeToJson(aboutme) {
|
|
347
|
-
return JSON.stringify(aboutme, null, 2);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// src/core/zip.ts
|
|
351
|
-
var import_jszip = __toESM(require("jszip"), 1);
|
|
352
|
-
var import_promises2 = require("fs/promises");
|
|
353
|
-
var MAX_ZIP_SIZE = 500 * 1024 * 1024;
|
|
354
|
-
var MAX_COMPRESSION_RATIO = 100;
|
|
355
|
-
async function readZip(filePath) {
|
|
356
|
-
const data = await (0, import_promises2.readFile)(filePath);
|
|
357
|
-
return import_jszip.default.loadAsync(data);
|
|
358
|
-
}
|
|
359
|
-
async function validateZipBomb(filePath) {
|
|
360
|
-
const data = await (0, import_promises2.readFile)(filePath);
|
|
361
|
-
const zip = await import_jszip.default.loadAsync(data);
|
|
362
|
-
let totalUncompressed = 0;
|
|
363
|
-
zip.forEach((relativePath, file) => {
|
|
364
|
-
if (!file.dir) {
|
|
365
|
-
totalUncompressed += file._data?.uncompressedSize || 0;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
const compressedSize = data.length;
|
|
369
|
-
const ratio = totalUncompressed / compressedSize;
|
|
370
|
-
if (totalUncompressed > MAX_ZIP_SIZE) {
|
|
371
|
-
throw new Error(`ZIP uncompressed size exceeds 500MB limit: ${totalUncompressed}`);
|
|
372
|
-
}
|
|
373
|
-
if (ratio > MAX_COMPRESSION_RATIO) {
|
|
374
|
-
throw new Error(`ZIP compression ratio exceeds 100x limit: ${ratio.toFixed(1)}x`);
|
|
375
|
-
}
|
|
376
|
-
return true;
|
|
377
|
-
}
|
|
378
|
-
async function extractFiles(zip, filter) {
|
|
379
|
-
const files = /* @__PURE__ */ new Map();
|
|
380
|
-
const promises = [];
|
|
381
|
-
zip.forEach((relativePath, file) => {
|
|
382
|
-
if (file.dir) return;
|
|
383
|
-
if (filter && !filter.some((f) => relativePath.startsWith(f))) return;
|
|
384
|
-
promises.push(
|
|
385
|
-
file.async("text").then((content) => {
|
|
386
|
-
files.set(relativePath, content);
|
|
387
|
-
})
|
|
388
|
-
);
|
|
389
|
-
});
|
|
390
|
-
await Promise.all(promises);
|
|
391
|
-
return files;
|
|
392
|
-
}
|
|
393
|
-
async function writeZip(zip, outPath) {
|
|
394
|
-
const data = await zip.generateAsync({ type: "arraybuffer" });
|
|
395
|
-
await (0, import_promises2.writeFile)(outPath, Buffer.from(data));
|
|
396
|
-
}
|
|
397
|
-
async function validateMagicBytes(filePath) {
|
|
398
|
-
const data = await (0, import_promises2.readFile)(filePath);
|
|
399
|
-
const magicBytes = data.subarray(0, 4);
|
|
400
|
-
const isZip = magicBytes[0] === 80 && magicBytes[1] === 75 && magicBytes[2] === 3 && magicBytes[3] === 4;
|
|
401
|
-
if (!isZip) {
|
|
402
|
-
throw new Error("File is not a valid ZIP (invalid magic bytes)");
|
|
403
|
-
}
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// src/commands/pack.ts
|
|
408
|
-
function gitDescribeTags() {
|
|
409
|
-
try {
|
|
410
|
-
return (0, import_child_process.execSync)("git describe --tags --abbrev=0", {
|
|
411
|
-
stdio: "pipe",
|
|
412
|
-
encoding: "utf-8"
|
|
413
|
-
}).trim();
|
|
414
|
-
} catch {
|
|
415
|
-
return null;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function gitRevParseShort() {
|
|
419
|
-
try {
|
|
420
|
-
return (0, import_child_process.execSync)("git rev-parse --short HEAD", {
|
|
421
|
-
stdio: "pipe",
|
|
422
|
-
encoding: "utf-8"
|
|
423
|
-
}).trim();
|
|
424
|
-
} catch {
|
|
425
|
-
return null;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
async function resolveVersion(explicit) {
|
|
429
|
-
if (explicit) return explicit;
|
|
430
|
-
const gitTag = gitDescribeTags();
|
|
431
|
-
if (gitTag) return gitTag;
|
|
432
|
-
return "v1.0.0";
|
|
433
|
-
}
|
|
434
|
-
async function resolveCommit(explicit) {
|
|
435
|
-
if (explicit) return explicit;
|
|
436
|
-
return gitRevParseShort() || void 0;
|
|
437
|
-
}
|
|
438
|
-
async function collectFiles(dir) {
|
|
439
|
-
const files = /* @__PURE__ */ new Map();
|
|
440
|
-
async function walk(subdir, prefix = "") {
|
|
441
|
-
try {
|
|
442
|
-
const entries = await (0, import_promises3.readdir)(subdir);
|
|
443
|
-
for (const entry of entries) {
|
|
444
|
-
if (entry === ".gitkeep" || entry.startsWith(".")) continue;
|
|
445
|
-
const fullPath = (0, import_path2.join)(subdir, entry);
|
|
446
|
-
const stats = await (0, import_promises3.stat)(fullPath);
|
|
447
|
-
const relativePath = prefix ? `${prefix}/${entry}` : entry;
|
|
448
|
-
if (stats.isDirectory()) {
|
|
449
|
-
await walk(fullPath, relativePath);
|
|
450
|
-
} else {
|
|
451
|
-
const content = await (0, import_promises3.readFile)(fullPath, "utf-8");
|
|
452
|
-
files.set(relativePath, content);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
} catch {
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
const description = await (0, import_promises3.readFile)((0, import_path2.join)(dir, "agent.description"), "utf-8");
|
|
459
|
-
files.set("agent.description", description);
|
|
460
|
-
const behavior = await (0, import_promises3.readFile)((0, import_path2.join)(dir, "agent.behavior"), "utf-8");
|
|
461
|
-
files.set("agent.behavior", behavior);
|
|
462
|
-
try {
|
|
463
|
-
const soul = await (0, import_promises3.readFile)((0, import_path2.join)(dir, "SOUL.md"), "utf-8");
|
|
464
|
-
files.set("SOUL.md", soul);
|
|
465
|
-
} catch {
|
|
466
|
-
}
|
|
467
|
-
await walk((0, import_path2.join)(dir, "behaviors"), "behaviors");
|
|
468
|
-
await walk((0, import_path2.join)(dir, "guides"), "guides");
|
|
469
|
-
await walk((0, import_path2.join)(dir, "knowledge"), "knowledge");
|
|
470
|
-
return files;
|
|
471
|
-
}
|
|
472
|
-
function parseDescription(text) {
|
|
473
|
-
const domain = text.match(/domain\s+([^\n]+)/)?.[1] || "";
|
|
474
|
-
const name = text.match(/agent\s+([^\n]+)/)?.[1] || "";
|
|
475
|
-
const description = text.match(/description\s+(.+?)(?=\n\n|\n[a-z])/s)?.[1] || "";
|
|
476
|
-
return {
|
|
477
|
-
domain: domain.trim(),
|
|
478
|
-
name: name.trim(),
|
|
479
|
-
description: description.trim(),
|
|
480
|
-
capabilities: []
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
async function pack(options = {}) {
|
|
484
|
-
const dir = options.dir || process.cwd();
|
|
485
|
-
const outPath = options.out || (0, import_path2.join)(dir, `${(0, import_path2.basename)(dir)}.agent`);
|
|
486
|
-
let descriptionText;
|
|
487
|
-
let behaviorText;
|
|
488
|
-
try {
|
|
489
|
-
descriptionText = await (0, import_promises3.readFile)((0, import_path2.join)(dir, "agent.description"), "utf-8");
|
|
490
|
-
} catch {
|
|
491
|
-
throw new Error("E003: File agent.description not found");
|
|
492
|
-
}
|
|
493
|
-
try {
|
|
494
|
-
behaviorText = await (0, import_promises3.readFile)((0, import_path2.join)(dir, "agent.behavior"), "utf-8");
|
|
495
|
-
} catch {
|
|
496
|
-
throw new Error("E007: File agent.behavior not found");
|
|
497
|
-
}
|
|
498
|
-
const linter = await createLinter();
|
|
499
|
-
const descriptionMessages = await linter.lintDescription(descriptionText);
|
|
500
|
-
const behaviorMessages = await linter.lintBehavior(behaviorText);
|
|
501
|
-
const allMessages = [...descriptionMessages, ...behaviorMessages];
|
|
502
|
-
const errors = allMessages.filter((m) => m.severity === "error");
|
|
503
|
-
const warnings = allMessages.filter((m) => m.severity === "warning");
|
|
504
|
-
if (errors.length > 0) {
|
|
505
|
-
throw new Error(`Lint failed: ${errors.map((e) => `${e.file}:${e.line}:${e.col} ${e.code} ${e.message}`).join("\n")}`);
|
|
506
|
-
}
|
|
507
|
-
const description = parseDescription(descriptionText);
|
|
508
|
-
const version = await resolveVersion(options.version);
|
|
509
|
-
const commit = await resolveCommit(options.commit);
|
|
510
|
-
const allFiles = await collectFiles(dir);
|
|
511
|
-
const contentForHash = Array.from(allFiles.values()).join("");
|
|
512
|
-
const digest = (0, import_crypto.createHash)("sha256").update(contentForHash).digest("hex").substring(0, 8);
|
|
513
|
-
const id = buildId({
|
|
514
|
-
namespace: description.domain,
|
|
515
|
-
name: description.name,
|
|
516
|
-
version,
|
|
517
|
-
digest
|
|
518
|
-
});
|
|
519
|
-
const aboutme = buildAboutme({
|
|
520
|
-
id,
|
|
521
|
-
name: description.name,
|
|
522
|
-
description: description.description,
|
|
523
|
-
version,
|
|
524
|
-
domain: description.domain,
|
|
525
|
-
license: "Apache-2.0",
|
|
526
|
-
persona: "SOUL.md",
|
|
527
|
-
compiler: "dot-agent/1.0.0",
|
|
528
|
-
commit,
|
|
529
|
-
skills: [],
|
|
530
|
-
requires: [],
|
|
531
|
-
integrity: {
|
|
532
|
-
sha256: (0, import_crypto.createHash)("sha256").update(contentForHash).digest("hex"),
|
|
533
|
-
files: ".agent/files.json"
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
const zip = new import_jszip2.default();
|
|
537
|
-
zip.folder(".agent").file("aboutme.json", aboutmeToJson(aboutme));
|
|
538
|
-
const filesJson = {
|
|
539
|
-
description: "agent.description",
|
|
540
|
-
behavior: "agent.behavior",
|
|
541
|
-
behaviors: Array.from(allFiles.keys()).filter((f) => f.startsWith("behaviors/") && f !== "behaviors/.gitkeep").map((f) => f),
|
|
542
|
-
guides: Array.from(allFiles.keys()).filter((f) => f.startsWith("guides/") && f !== "guides/.gitkeep").map((f) => f),
|
|
543
|
-
knowledge: Array.from(allFiles.keys()).filter((f) => f.startsWith("knowledge/") && f !== "knowledge/.gitkeep").map((f) => f)
|
|
544
|
-
};
|
|
545
|
-
zip.folder(".agent").file("files.json", JSON.stringify(filesJson, null, 2));
|
|
546
|
-
for (const [path, content] of allFiles) {
|
|
547
|
-
if (path !== "behaviors/.gitkeep" && path !== "guides/.gitkeep" && path !== "knowledge/.gitkeep") {
|
|
548
|
-
zip.file(path, content);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
await writeZip(zip, outPath);
|
|
552
|
-
return {
|
|
553
|
-
path: outPath,
|
|
554
|
-
id,
|
|
555
|
-
warnings
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// src/commands/unpack.ts
|
|
560
|
-
var import_promises4 = require("fs/promises");
|
|
561
|
-
var import_path3 = require("path");
|
|
562
|
-
async function unpack(options) {
|
|
563
|
-
const { file, out, force = false } = options;
|
|
564
|
-
await validateMagicBytes(file);
|
|
565
|
-
await validateZipBomb(file);
|
|
566
|
-
const zip = await readZip(file);
|
|
567
|
-
const aboutmeFile = zip.file(".agent/aboutme.json");
|
|
568
|
-
if (!aboutmeFile) {
|
|
569
|
-
throw new Error("Missing .agent/aboutme.json in ZIP");
|
|
570
|
-
}
|
|
571
|
-
const aboutmeText = await aboutmeFile.async("text");
|
|
572
|
-
const aboutme = parseAboutme(JSON.parse(aboutmeText));
|
|
573
|
-
const outDir = out || `./${aboutme.name}`;
|
|
574
|
-
try {
|
|
575
|
-
await (0, import_promises4.stat)(outDir);
|
|
576
|
-
if (!force) {
|
|
577
|
-
throw new Error(`Output directory already exists: ${outDir}. Use --force to overwrite.`);
|
|
578
|
-
}
|
|
579
|
-
} catch (err) {
|
|
580
|
-
if (err.code !== "ENOENT") throw err;
|
|
581
|
-
}
|
|
582
|
-
const files = await extractFiles(zip);
|
|
583
|
-
await (0, import_promises4.mkdir)(outDir, { recursive: true });
|
|
584
|
-
const extractedFiles = [];
|
|
585
|
-
for (const [path, content] of files) {
|
|
586
|
-
if (path.startsWith(".agent/")) continue;
|
|
587
|
-
const fullPath = (0, import_path3.join)(outDir, path);
|
|
588
|
-
const dir = fullPath.substring(0, fullPath.lastIndexOf("/"));
|
|
589
|
-
await (0, import_promises4.mkdir)(dir, { recursive: true });
|
|
590
|
-
await (0, import_promises4.writeFile)(fullPath, content);
|
|
591
|
-
extractedFiles.push(path);
|
|
592
|
-
}
|
|
593
|
-
return {
|
|
594
|
-
dir: outDir,
|
|
595
|
-
id: aboutme.id,
|
|
596
|
-
files: extractedFiles,
|
|
597
|
-
aboutme
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// src/commands/run.ts
|
|
602
|
-
var import_events = require("events");
|
|
603
|
-
var import_promises5 = require("fs/promises");
|
|
604
|
-
var import_kernel_dsl2 = require("@dot-agent/kernel-dsl");
|
|
605
|
-
function isZipFile(source) {
|
|
606
|
-
return source.endsWith(".agent");
|
|
607
|
-
}
|
|
608
|
-
async function run(options) {
|
|
609
|
-
const { source } = options;
|
|
610
|
-
const context = new import_events.EventEmitter();
|
|
611
|
-
try {
|
|
612
|
-
context.emit("progress", { step: "opening", pct: 0 });
|
|
613
|
-
let descriptionText;
|
|
614
|
-
let behaviorText;
|
|
615
|
-
let aboutme = null;
|
|
616
|
-
let id;
|
|
617
|
-
if (isZipFile(source)) {
|
|
618
|
-
await validateMagicBytes(source);
|
|
619
|
-
await validateZipBomb(source);
|
|
620
|
-
const zip = await readZip(source);
|
|
621
|
-
const aboutmeFile = zip.file(".agent/aboutme.json");
|
|
622
|
-
if (!aboutmeFile) {
|
|
623
|
-
throw new Error("Missing .agent/aboutme.json");
|
|
624
|
-
}
|
|
625
|
-
const aboutmeText = await aboutmeFile.async("text");
|
|
626
|
-
aboutme = parseAboutme(JSON.parse(aboutmeText));
|
|
627
|
-
id = aboutme.id;
|
|
628
|
-
const descFile = zip.file("agent.description");
|
|
629
|
-
if (!descFile) throw new Error("Missing agent.description");
|
|
630
|
-
descriptionText = await descFile.async("text");
|
|
631
|
-
const behavFile = zip.file("agent.behavior");
|
|
632
|
-
if (!behavFile) throw new Error("Missing agent.behavior");
|
|
633
|
-
behaviorText = await behavFile.async("text");
|
|
634
|
-
context.emit("progress", { step: "parsing", pct: 30 });
|
|
635
|
-
let kernel;
|
|
636
|
-
try {
|
|
637
|
-
await (0, import_kernel_dsl2.init)();
|
|
638
|
-
kernel = new import_kernel_dsl2.AgentDSLKernel();
|
|
639
|
-
kernel.load_behavior(behaviorText);
|
|
640
|
-
} catch (err) {
|
|
641
|
-
kernel = {
|
|
642
|
-
get_current_state: () => "init",
|
|
643
|
-
get_graph: () => ({}),
|
|
644
|
-
get_memory: () => [],
|
|
645
|
-
get_valid_intents: () => [],
|
|
646
|
-
load_behavior: () => {
|
|
647
|
-
},
|
|
648
|
-
observe: () => {
|
|
649
|
-
},
|
|
650
|
-
send_complete: () => {
|
|
651
|
-
},
|
|
652
|
-
send_event: () => {
|
|
653
|
-
},
|
|
654
|
-
send_failed: () => {
|
|
655
|
-
},
|
|
656
|
-
send_fallback: () => {
|
|
657
|
-
},
|
|
658
|
-
send_intent: () => {
|
|
659
|
-
},
|
|
660
|
-
send_offtopic: () => {
|
|
661
|
-
},
|
|
662
|
-
tick_prompt: () => {
|
|
663
|
-
},
|
|
664
|
-
free: () => {
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
context.emit("progress", { step: "loading-files", pct: 60 });
|
|
669
|
-
const soulFile = zip.file("SOUL.md");
|
|
670
|
-
const soul = soulFile ? await soulFile.async("text") : void 0;
|
|
671
|
-
const allFiles = await extractFiles(zip);
|
|
672
|
-
const guides = [];
|
|
673
|
-
const knowledge = [];
|
|
674
|
-
const behaviors = [];
|
|
675
|
-
for (const [path, content] of allFiles) {
|
|
676
|
-
if (path.startsWith("guides/") && path !== "guides/.gitkeep") {
|
|
677
|
-
guides.push({ path, content });
|
|
678
|
-
} else if (path.startsWith("knowledge/") && path !== "knowledge/.gitkeep") {
|
|
679
|
-
knowledge.push({ path, content });
|
|
680
|
-
} else if (path.startsWith("behaviors/") && path !== "behaviors/.gitkeep") {
|
|
681
|
-
behaviors.push({ path, content });
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
context.id = id;
|
|
685
|
-
context.description = { domain: "example.com", name: "Agent" };
|
|
686
|
-
context.behavior = {};
|
|
687
|
-
context.kernel = kernel;
|
|
688
|
-
context.files = { soul, guides, knowledge, behaviors };
|
|
689
|
-
context.aboutme = aboutme;
|
|
690
|
-
} else {
|
|
691
|
-
const descPath = `${source}/agent.description`;
|
|
692
|
-
const behavPath = `${source}/agent.behavior`;
|
|
693
|
-
try {
|
|
694
|
-
descriptionText = await (0, import_promises5.readFile)(descPath, "utf-8");
|
|
695
|
-
} catch {
|
|
696
|
-
throw new Error(`Missing agent.description at ${descPath}`);
|
|
697
|
-
}
|
|
698
|
-
try {
|
|
699
|
-
behaviorText = await (0, import_promises5.readFile)(behavPath, "utf-8");
|
|
700
|
-
} catch {
|
|
701
|
-
throw new Error(`Missing agent.behavior at ${behavPath}`);
|
|
702
|
-
}
|
|
703
|
-
context.emit("progress", { step: "parsing", pct: 30 });
|
|
704
|
-
let kernel;
|
|
705
|
-
try {
|
|
706
|
-
await (0, import_kernel_dsl2.init)();
|
|
707
|
-
kernel = new import_kernel_dsl2.AgentDSLKernel();
|
|
708
|
-
kernel.load_behavior(behaviorText);
|
|
709
|
-
} catch (err) {
|
|
710
|
-
kernel = {
|
|
711
|
-
get_current_state: () => "init",
|
|
712
|
-
get_graph: () => ({}),
|
|
713
|
-
get_memory: () => [],
|
|
714
|
-
get_valid_intents: () => [],
|
|
715
|
-
load_behavior: () => {
|
|
716
|
-
},
|
|
717
|
-
observe: () => {
|
|
718
|
-
},
|
|
719
|
-
send_complete: () => {
|
|
720
|
-
},
|
|
721
|
-
send_event: () => {
|
|
722
|
-
},
|
|
723
|
-
send_failed: () => {
|
|
724
|
-
},
|
|
725
|
-
send_fallback: () => {
|
|
726
|
-
},
|
|
727
|
-
send_intent: () => {
|
|
728
|
-
},
|
|
729
|
-
send_offtopic: () => {
|
|
730
|
-
},
|
|
731
|
-
tick_prompt: () => {
|
|
732
|
-
},
|
|
733
|
-
free: () => {
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
context.emit("progress", { step: "loading-files", pct: 60 });
|
|
738
|
-
id = "local/agent:v1.0~unknown";
|
|
739
|
-
try {
|
|
740
|
-
const soul = await (0, import_promises5.readFile)(`${source}/SOUL.md`, "utf-8");
|
|
741
|
-
context.files = {
|
|
742
|
-
soul,
|
|
743
|
-
guides: [],
|
|
744
|
-
knowledge: [],
|
|
745
|
-
behaviors: []
|
|
746
|
-
};
|
|
747
|
-
} catch {
|
|
748
|
-
context.files = { guides: [], knowledge: [], behaviors: [] };
|
|
749
|
-
}
|
|
750
|
-
const defaultAboutme = {
|
|
751
|
-
schemaVersion: "dot-agent/1.0",
|
|
752
|
-
id,
|
|
753
|
-
name: "Agent",
|
|
754
|
-
description: "",
|
|
755
|
-
version: "v1.0",
|
|
756
|
-
domain: "local",
|
|
757
|
-
license: "Apache-2.0",
|
|
758
|
-
persona: "SOUL.md",
|
|
759
|
-
compiler: "dot-agent/1.0.0",
|
|
760
|
-
skills: [],
|
|
761
|
-
requires: [],
|
|
762
|
-
integrity: { sha256: "", files: "" }
|
|
763
|
-
};
|
|
764
|
-
context.id = id;
|
|
765
|
-
context.description = { domain: "example.com", name: "Agent" };
|
|
766
|
-
context.behavior = {};
|
|
767
|
-
context.kernel = kernel;
|
|
768
|
-
context.aboutme = defaultAboutme;
|
|
769
|
-
}
|
|
770
|
-
context.emit("progress", { step: "ready", pct: 100 });
|
|
771
|
-
context.emit("ready", context);
|
|
772
|
-
return context;
|
|
773
|
-
} catch (err) {
|
|
774
|
-
context.emit("error", err);
|
|
775
|
-
throw err;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
// src/cli.ts
|
|
780
|
-
var args = process.argv.slice(2);
|
|
781
|
-
var command = args[0];
|
|
782
|
-
function formatError(msg) {
|
|
783
|
-
const lines = msg.split("\n");
|
|
784
|
-
console.error(`\x1B[31m\u2717\x1B[0m ${lines[0]}`);
|
|
785
|
-
if (lines.length > 1) {
|
|
786
|
-
lines.slice(1).forEach((line) => console.error(` ${line}`));
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
function formatSuccess(msg) {
|
|
790
|
-
console.log(`\x1B[32m\u2713\x1B[0m ${msg}`);
|
|
791
|
-
}
|
|
792
|
-
function formatWarning(msg) {
|
|
793
|
-
console.warn(`\x1B[33m\u26A0\x1B[0m ${msg}`);
|
|
794
|
-
}
|
|
795
|
-
async function main() {
|
|
796
|
-
try {
|
|
797
|
-
if (command === "init") {
|
|
798
|
-
const options = {};
|
|
799
|
-
for (let i = 1; i < args.length; i++) {
|
|
800
|
-
if (args[i] === "--name" && i + 1 < args.length) options.name = args[++i];
|
|
801
|
-
if (args[i] === "--domain" && i + 1 < args.length) options.domain = args[++i];
|
|
802
|
-
if (args[i] === "--dir" && i + 1 < args.length) options.dir = args[++i];
|
|
803
|
-
}
|
|
804
|
-
const result = await init(options);
|
|
805
|
-
formatSuccess(`Scaffolded agent project in ${result.dir}`);
|
|
806
|
-
console.log(` Files: ${result.files.join(", ")}`);
|
|
807
|
-
} else if (command === "pack") {
|
|
808
|
-
const options = {};
|
|
809
|
-
for (let i = 1; i < args.length; i++) {
|
|
810
|
-
if (args[i] === "--dir" && i + 1 < args.length) options.dir = args[++i];
|
|
811
|
-
if (args[i] === "--out" && i + 1 < args.length) options.out = args[++i];
|
|
812
|
-
if (args[i] === "--commit" && i + 1 < args.length) options.commit = args[++i];
|
|
813
|
-
if (args[i] === "--version" && i + 1 < args.length) options.version = args[++i];
|
|
814
|
-
}
|
|
815
|
-
const result = await pack(options);
|
|
816
|
-
formatSuccess(`Packed \u2192 ${result.path}`);
|
|
817
|
-
console.log(` ID: ${result.id}`);
|
|
818
|
-
if (result.warnings.length > 0) {
|
|
819
|
-
console.log(` Warnings: ${result.warnings.length}`);
|
|
820
|
-
result.warnings.forEach((w) => {
|
|
821
|
-
formatWarning(`${w.file}:${w.line}:${w.col} ${w.code} ${w.message}`);
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
} else if (command === "unpack") {
|
|
825
|
-
const file = args[1];
|
|
826
|
-
if (!file) {
|
|
827
|
-
formatError("Usage: dot-agent unpack <file.agent> [--out <dir>] [--force]");
|
|
828
|
-
process.exit(1);
|
|
829
|
-
}
|
|
830
|
-
const options = { file };
|
|
831
|
-
for (let i = 2; i < args.length; i++) {
|
|
832
|
-
if (args[i] === "--out" && i + 1 < args.length) options.out = args[++i];
|
|
833
|
-
if (args[i] === "--force") options.force = true;
|
|
834
|
-
}
|
|
835
|
-
const result = await unpack(options);
|
|
836
|
-
formatSuccess(`Unpacked to ${result.dir}`);
|
|
837
|
-
console.log(` ID: ${result.id}`);
|
|
838
|
-
console.log(` Files: ${result.files.length}`);
|
|
839
|
-
} else if (command === "run") {
|
|
840
|
-
const source = args[1];
|
|
841
|
-
if (!source) {
|
|
842
|
-
formatError("Usage: dot-agent run <file.agent | dir>");
|
|
843
|
-
process.exit(1);
|
|
844
|
-
}
|
|
845
|
-
const context = await run({ source });
|
|
846
|
-
formatSuccess(`Agent loaded: ${context.id}`);
|
|
847
|
-
} else {
|
|
848
|
-
console.log(`dot-agent CLI v1.0.0
|
|
849
|
-
|
|
850
|
-
Usage:
|
|
851
|
-
dot-agent init [--name <name>] [--domain <domain>] [--dir <dir>]
|
|
852
|
-
dot-agent pack [--dir <dir>] [--out <file>] [--commit <hash>] [--version <tag>]
|
|
853
|
-
dot-agent unpack <file.agent> [--out <dir>] [--force]
|
|
854
|
-
dot-agent run <file.agent | dir>
|
|
855
|
-
`);
|
|
856
|
-
}
|
|
857
|
-
} catch (err) {
|
|
858
|
-
formatError(err.message);
|
|
859
|
-
process.exit(1);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
main();
|
|
863
|
-
//# sourceMappingURL=cli.cjs.map
|