@agntk/cli 0.1.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/args.d.ts +40 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +90 -0
- package/dist/args.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +126 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +63 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +96 -0
- package/dist/config.js.map +1 -0
- package/dist/environment.d.ts +37 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +164 -0
- package/dist/environment.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +11 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +81 -0
- package/dist/init.js.map +1 -0
- package/dist/repl.d.ts +31 -0
- package/dist/repl.d.ts.map +1 -0
- package/dist/repl.js +213 -0
- package/dist/repl.js.map +1 -0
- package/dist/runner.d.ts +38 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +214 -0
- package/dist/runner.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/package.json +59 -0
package/dist/runner.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview One-shot execution runner for agntk CLI.
|
|
3
|
+
* Takes a resolved config + prompt, creates an agent, and streams output progressively to stdout.
|
|
4
|
+
*
|
|
5
|
+
* This is the "happy path": npx agntk "organize this folder by date"
|
|
6
|
+
*/
|
|
7
|
+
import { createAgent } from '@agntk/core';
|
|
8
|
+
import { formatEnvironmentPrompt } from './environment.js';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Config → AgentOptions mapping
|
|
11
|
+
// ============================================================================
|
|
12
|
+
function buildAgentOptions(config, environment) {
|
|
13
|
+
const agentOptions = {
|
|
14
|
+
role: config.role,
|
|
15
|
+
maxSteps: config.maxSteps,
|
|
16
|
+
toolPreset: config.toolPreset,
|
|
17
|
+
workspaceRoot: config.workspace,
|
|
18
|
+
enableMemory: config.memory,
|
|
19
|
+
systemPromptPrefix: formatEnvironmentPrompt(environment),
|
|
20
|
+
};
|
|
21
|
+
// If user provided a model string, pass it through
|
|
22
|
+
if (config.model && config.provider) {
|
|
23
|
+
agentOptions.modelProvider = config.provider;
|
|
24
|
+
agentOptions.modelName = config.model;
|
|
25
|
+
}
|
|
26
|
+
return agentOptions;
|
|
27
|
+
}
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// One-Shot Runner
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Run the agent in one-shot mode.
|
|
33
|
+
* Creates an agent, sends the prompt, streams output to stdout.
|
|
34
|
+
*/
|
|
35
|
+
export async function runOneShot(prompt, options) {
|
|
36
|
+
const { config, environment } = options;
|
|
37
|
+
const output = options.output ?? process.stdout;
|
|
38
|
+
const statusOutput = options.statusOutput ?? process.stderr;
|
|
39
|
+
// Validate
|
|
40
|
+
if (!prompt || prompt.trim().length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
text: '',
|
|
43
|
+
steps: 0,
|
|
44
|
+
success: false,
|
|
45
|
+
error: 'No prompt provided. Use: agntk "your prompt here" or agntk -i for interactive mode.',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (config.verbose) {
|
|
49
|
+
statusOutput.write(`[agntk] Role: ${config.role}\n`);
|
|
50
|
+
statusOutput.write(`[agntk] Provider: ${config.provider ?? 'auto-detect'}\n`);
|
|
51
|
+
statusOutput.write(`[agntk] Model: ${config.model ?? 'default'}\n`);
|
|
52
|
+
statusOutput.write(`[agntk] Workspace: ${config.workspace}\n`);
|
|
53
|
+
statusOutput.write(`[agntk] Max steps: ${config.maxSteps}\n`);
|
|
54
|
+
statusOutput.write(`[agntk] Tool preset: ${config.toolPreset}\n`);
|
|
55
|
+
statusOutput.write(`[agntk] Memory: ${config.memory ? 'enabled' : 'disabled'}\n`);
|
|
56
|
+
}
|
|
57
|
+
// Dry run — show what would happen without executing (no API key needed)
|
|
58
|
+
if (config.dryRun) {
|
|
59
|
+
const dryOutput = [
|
|
60
|
+
`[dry-run] Would create agent:`,
|
|
61
|
+
` Role: ${config.role}`,
|
|
62
|
+
` Provider: ${config.provider}`,
|
|
63
|
+
` Model: ${config.model ?? 'default'}`,
|
|
64
|
+
` Workspace: ${config.workspace}`,
|
|
65
|
+
` Max steps: ${config.maxSteps}`,
|
|
66
|
+
` Tool preset: ${config.toolPreset}`,
|
|
67
|
+
` Memory: ${config.memory ? 'enabled' : 'disabled'}`,
|
|
68
|
+
` Prompt: "${prompt}"`,
|
|
69
|
+
``,
|
|
70
|
+
].join('\n');
|
|
71
|
+
output.write(dryOutput);
|
|
72
|
+
return {
|
|
73
|
+
text: dryOutput,
|
|
74
|
+
steps: 0,
|
|
75
|
+
success: true,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// API key required for actual execution
|
|
79
|
+
if (!config.apiKey) {
|
|
80
|
+
return {
|
|
81
|
+
text: '',
|
|
82
|
+
steps: 0,
|
|
83
|
+
success: false,
|
|
84
|
+
error: 'No API key found. Set OPENROUTER_API_KEY or OPENAI_API_KEY.',
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// Build agent options
|
|
88
|
+
const agentOptions = buildAgentOptions(config, environment);
|
|
89
|
+
try {
|
|
90
|
+
// Create the agent
|
|
91
|
+
const agent = createAgent(agentOptions);
|
|
92
|
+
if (config.verbose) {
|
|
93
|
+
statusOutput.write(`[agntk] Agent created (${agent.agentId})\n`);
|
|
94
|
+
statusOutput.write(`[agntk] Sending prompt...\n`);
|
|
95
|
+
}
|
|
96
|
+
// Stream output progressively so text appears as the model generates it
|
|
97
|
+
const streamResult = await agent.stream({ prompt });
|
|
98
|
+
// Track whether we need a leading newline before text (after tool output)
|
|
99
|
+
let afterToolResult = false;
|
|
100
|
+
// Write text chunks and tool activity as they arrive
|
|
101
|
+
for await (const chunk of streamResult.fullStream) {
|
|
102
|
+
if (chunk.type === 'tool-call') {
|
|
103
|
+
const toolChunk = chunk;
|
|
104
|
+
const argsStr = toolChunk.input ? JSON.stringify(toolChunk.input) : '';
|
|
105
|
+
statusOutput.write(`\n⚡ ${toolChunk.toolName}(${argsStr})\n`);
|
|
106
|
+
afterToolResult = false;
|
|
107
|
+
}
|
|
108
|
+
else if (chunk.type === 'tool-result') {
|
|
109
|
+
const resultChunk = chunk;
|
|
110
|
+
const raw = typeof resultChunk.output === 'string'
|
|
111
|
+
? resultChunk.output
|
|
112
|
+
: JSON.stringify(resultChunk.output);
|
|
113
|
+
// Parse tool output — tools return JSON with { success, output }
|
|
114
|
+
let displayOutput = raw;
|
|
115
|
+
try {
|
|
116
|
+
const parsed = JSON.parse(raw);
|
|
117
|
+
if (parsed && typeof parsed.output === 'string') {
|
|
118
|
+
displayOutput = parsed.output;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Use raw output as-is
|
|
123
|
+
}
|
|
124
|
+
// Truncate very long output for display
|
|
125
|
+
const maxLen = 2000;
|
|
126
|
+
if (displayOutput.length > maxLen) {
|
|
127
|
+
displayOutput = displayOutput.slice(0, maxLen) + `\n... (${displayOutput.length} chars total)`;
|
|
128
|
+
}
|
|
129
|
+
statusOutput.write(`${displayOutput}\n`);
|
|
130
|
+
afterToolResult = true;
|
|
131
|
+
}
|
|
132
|
+
else if (chunk.type === 'text-delta') {
|
|
133
|
+
const textChunk = chunk;
|
|
134
|
+
if (afterToolResult) {
|
|
135
|
+
output.write('\n');
|
|
136
|
+
afterToolResult = false;
|
|
137
|
+
}
|
|
138
|
+
output.write(textChunk.text);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Get final results (already resolved since we consumed the full stream)
|
|
142
|
+
const finalText = await streamResult.text;
|
|
143
|
+
const steps = await streamResult.steps;
|
|
144
|
+
const stepCount = steps?.length ?? 0;
|
|
145
|
+
// Ensure trailing newline
|
|
146
|
+
if (finalText && !finalText.endsWith('\n')) {
|
|
147
|
+
output.write('\n');
|
|
148
|
+
}
|
|
149
|
+
if (config.verbose) {
|
|
150
|
+
statusOutput.write(`[agntk] Completed in ${stepCount} step(s)\n`);
|
|
151
|
+
const totalUsage = await streamResult.totalUsage;
|
|
152
|
+
if (totalUsage) {
|
|
153
|
+
const usage = totalUsage;
|
|
154
|
+
statusOutput.write(`[agntk] Tokens: ${usage.inputTokens ?? 0} in / ${usage.outputTokens ?? 0} out\n`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
text: finalText ?? '',
|
|
159
|
+
steps: stepCount,
|
|
160
|
+
success: true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
165
|
+
if (config.verbose) {
|
|
166
|
+
statusOutput.write(`[agntk] Error: ${message}\n`);
|
|
167
|
+
if (error instanceof Error && error.stack) {
|
|
168
|
+
statusOutput.write(`[agntk] ${error.stack}\n`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
text: '',
|
|
173
|
+
steps: 0,
|
|
174
|
+
success: false,
|
|
175
|
+
error: message,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Piped Input Handler
|
|
181
|
+
// ============================================================================
|
|
182
|
+
/**
|
|
183
|
+
* Read piped stdin (e.g., `cat file.log | agntk "explain this"`)
|
|
184
|
+
*/
|
|
185
|
+
export async function readStdin(timeoutMs = 100) {
|
|
186
|
+
// If stdin is a TTY (interactive terminal), there's no piped input
|
|
187
|
+
if (process.stdin.isTTY) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return new Promise((resolve) => {
|
|
191
|
+
const chunks = [];
|
|
192
|
+
let resolved = false;
|
|
193
|
+
const finish = () => {
|
|
194
|
+
if (resolved)
|
|
195
|
+
return;
|
|
196
|
+
resolved = true;
|
|
197
|
+
if (chunks.length === 0) {
|
|
198
|
+
resolve(null);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
resolve(Buffer.concat(chunks).toString('utf-8'));
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
process.stdin.on('data', (chunk) => {
|
|
205
|
+
chunks.push(chunk);
|
|
206
|
+
});
|
|
207
|
+
process.stdin.on('end', finish);
|
|
208
|
+
process.stdin.on('error', () => finish());
|
|
209
|
+
// Safety timeout for edge cases
|
|
210
|
+
setTimeout(finish, timeoutMs);
|
|
211
|
+
process.stdin.resume();
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AA4B3D,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAE/E,SAAS,iBAAiB,CACxB,MAAyB,EACzB,WAA+B;IAE/B,MAAM,YAAY,GAAiB;QACjC,IAAI,EAAE,MAAM,CAAC,IAA4B;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,MAAM,CAAC,UAA6B;QAChD,aAAa,EAAE,MAAM,CAAC,SAAS;QAC/B,YAAY,EAAE,MAAM,CAAC,MAAM;QAC3B,kBAAkB,EAAE,uBAAuB,CAAC,WAAW,CAAC;KACzD,CAAC;IAEF,mDAAmD;IACnD,IAAI,MAAM,CAAC,KAAK,IAAI,MAA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AM,MAAM,GAAG,GAAG,EAAE;YAClB,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC;QAEF,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAE1C,gCAAgC;QAChC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE9B,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAOA,wBAAgB,UAAU,IAAI,MAAM,CAOnC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = dirname(__filename);
|
|
6
|
+
export function getVersion() {
|
|
7
|
+
try {
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
9
|
+
return pkg.version ?? '0.0.0';
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return '0.0.0';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACrF,OAAO,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agntk/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "CLI for agntk — portable AI agent you install and point at problems",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agntk": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc && node ../../scripts/fix-esm-imports.mjs ./dist",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@agntk/core": "workspace:*",
|
|
26
|
+
"dotenv": "^17.2.3"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@agntk/config-typescript": "workspace:*",
|
|
30
|
+
"@types/node": "^20.17.19",
|
|
31
|
+
"typescript": "^5.7.3",
|
|
32
|
+
"vitest": "^3.2.3"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/agntk/agntk.git",
|
|
42
|
+
"directory": "packages/cli"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/agntk/agntk#readme",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/agntk/agntk/issues"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20.0.0"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"ai",
|
|
53
|
+
"agent",
|
|
54
|
+
"cli",
|
|
55
|
+
"agntk",
|
|
56
|
+
"npx"
|
|
57
|
+
],
|
|
58
|
+
"license": "MIT"
|
|
59
|
+
}
|