@klars/agentobs 0.1.3 → 0.1.4
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/adapters/process-wrap.js +23 -1
- package/dist/cli.js +14 -0
- package/package.json +1 -1
|
@@ -82,7 +82,19 @@ export async function runWrapped(command, opts = {}) {
|
|
|
82
82
|
child.on('error', (err) => {
|
|
83
83
|
// Spawn failure (command not found) - record it as a failed session
|
|
84
84
|
// rather than losing the attempt entirely.
|
|
85
|
-
|
|
85
|
+
// A shell builtin (dir, echo, cd, type) is not a program on disk, so
|
|
86
|
+
// there is nothing to spawn. Saying only "ENOENT" sends the user
|
|
87
|
+
// hunting for a broken install; naming the actual cause and the
|
|
88
|
+
// workaround is the difference between a dead end and a fix.
|
|
89
|
+
if (process.platform === 'win32' && WINDOWS_BUILTINS.has(command[0].toLowerCase())) {
|
|
90
|
+
console.error(`[agentobs] "${command[0]}" is a cmd.exe builtin, not a program, so there is ` +
|
|
91
|
+
`nothing to wrap.\n` +
|
|
92
|
+
` Try: agentobs run -- cmd /c ${command.join(' ')}`);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.error(`[agentobs] failed to start ${command[0]}: ${err.message}\n` +
|
|
96
|
+
` Check the command exists and is on your PATH.`);
|
|
97
|
+
}
|
|
86
98
|
finish(127);
|
|
87
99
|
});
|
|
88
100
|
child.on('close', (code, signal) => {
|
|
@@ -105,6 +117,16 @@ export async function runWrapped(command, opts = {}) {
|
|
|
105
117
|
}
|
|
106
118
|
});
|
|
107
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* cmd.exe builtins - commands that exist only inside the shell, with no
|
|
122
|
+
* executable on disk. Spawning them always fails with ENOENT, so they get a
|
|
123
|
+
* message that explains why rather than one that looks like a broken install.
|
|
124
|
+
*/
|
|
125
|
+
const WINDOWS_BUILTINS = new Set([
|
|
126
|
+
'dir', 'echo', 'cd', 'chdir', 'type', 'copy', 'move', 'del', 'erase', 'md',
|
|
127
|
+
'mkdir', 'rd', 'rmdir', 'ren', 'rename', 'cls', 'set', 'ver', 'vol', 'path',
|
|
128
|
+
'pause', 'title', 'prompt', 'assoc', 'ftype', 'exit', 'call', 'start',
|
|
129
|
+
]);
|
|
108
130
|
/**
|
|
109
131
|
* Builds a cmd.exe command line, quoting each part that needs it.
|
|
110
132
|
*
|
package/dist/cli.js
CHANGED
|
@@ -48,6 +48,12 @@ export function buildProgram() {
|
|
|
48
48
|
.command('watch')
|
|
49
49
|
.argument('<file>', 'JSONL file to tail')
|
|
50
50
|
.description('Ingest a newline-delimited JSON agent log')
|
|
51
|
+
.addHelpText('after', `
|
|
52
|
+
Example:
|
|
53
|
+
agentobs watch ./agent-log.jsonl --agent my-agent
|
|
54
|
+
|
|
55
|
+
The file should contain one JSON object per line with a "type" field
|
|
56
|
+
(session_start, tool_call_start, tool_call_end, session_end).`)
|
|
51
57
|
.option('--agent <name>', 'agent name to record', 'generic')
|
|
52
58
|
.option('--no-follow', 'process existing lines then exit')
|
|
53
59
|
.action(async (file, opts) => {
|
|
@@ -57,6 +63,14 @@ export function buildProgram() {
|
|
|
57
63
|
program
|
|
58
64
|
.command('run')
|
|
59
65
|
.description('Run a command under observation (coarse: duration and exit code)')
|
|
66
|
+
.addHelpText('after', `
|
|
67
|
+
Examples:
|
|
68
|
+
agentobs run -- npm test
|
|
69
|
+
agentobs run -- claude
|
|
70
|
+
agentobs run -- git status
|
|
71
|
+
|
|
72
|
+
Note the "--": everything after it is the command to observe.
|
|
73
|
+
On Windows, cmd.exe builtins (dir, echo, type) need: agentobs run -- cmd /c dir`)
|
|
60
74
|
.argument('<command...>', 'command to run, after --')
|
|
61
75
|
.option('--agent <name>', 'agent name to record')
|
|
62
76
|
.allowUnknownOption()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klars/agentobs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Observability and control layer for AI coding agents - see every tool call, token, and dollar your agents spend, and stop them before they do something risky.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Klars AI",
|