@botiverse/oar-cli 0.0.4 → 0.0.6
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/README.md +67 -0
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/progress.d.ts +4 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +46 -0
- package/dist/progress.js.map +1 -0
- package/dist/voyage.d.ts +22 -0
- package/dist/voyage.d.ts.map +1 -0
- package/dist/voyage.js +51 -0
- package/dist/voyage.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,4 +6,71 @@ Command-line interface for `@botiverse/oar`. It installs the `oar` executable wi
|
|
|
6
6
|
npx @botiverse/oar-cli list
|
|
7
7
|
oar installation codex
|
|
8
8
|
oar usage claude
|
|
9
|
+
oar run claude "What does this repo do?"
|
|
9
10
|
```
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
- `oar list` — registered runtimes and their capabilities.
|
|
15
|
+
- `oar installation [runtime]` — probe local installation and version, no
|
|
16
|
+
account or usage I/O.
|
|
17
|
+
- `oar usage [runtime]` — account usage for each available installation.
|
|
18
|
+
- `oar run <runtime> <prompt>` — run one turn in a fresh session and show
|
|
19
|
+
its progress; the exit code is 0 only when the turn completed.
|
|
20
|
+
|
|
21
|
+
## `oar run` — the run-and-verify entrypoint
|
|
22
|
+
|
|
23
|
+
By default `run` prints readable progress: assistant text verbatim, and
|
|
24
|
+
everything else as a bracketed meta line —
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
[thinking] The user wants...
|
|
28
|
+
[Running command] cat package.json
|
|
29
|
+
[Ran command] (0.4s)
|
|
30
|
+
The repo is a pnpm workspace...
|
|
31
|
+
[turn completed]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Flags:
|
|
35
|
+
|
|
36
|
+
- `--model <model>` — runtime-native model identifier.
|
|
37
|
+
- `--json` — print the raw session events as JSON lines instead of
|
|
38
|
+
progress, plus a final `{"outcome": ...}` line.
|
|
39
|
+
- `--record <file>` — additionally write the run as an `oar-voyage/1` JSONL
|
|
40
|
+
log (works in both output modes; the log always carries the raw events).
|
|
41
|
+
|
|
42
|
+
A run without a record is an anecdote. When a run is meant to be evidence —
|
|
43
|
+
verifying a doc claim, reproducing a bug, checking a runtime's live
|
|
44
|
+
behavior — pass `--record` so the claim points at a log anyone can read:
|
|
45
|
+
|
|
46
|
+
1. **Run live, don't infer.** A claim about runtime behavior is verified by
|
|
47
|
+
actually running it, not by reading code or remembering last time.
|
|
48
|
+
2. **Record the evidence.** Keep the voyage log and reference it in the
|
|
49
|
+
conclusion, so "it works" is checkable later.
|
|
50
|
+
3. **Triage what you see.** If reality differs from the docs, decide which
|
|
51
|
+
moved: the runtime changed → fix the doc; oar regressed → file the bug
|
|
52
|
+
and pin it with a test (`docs/development.md` has the test ladder).
|
|
53
|
+
4. **Report honest outcomes.** A turn that failed or aborted is a finding,
|
|
54
|
+
not something to retry until it looks clean — the exit code and the
|
|
55
|
+
`turn_ended` outcome in the log say what actually happened.
|
|
56
|
+
|
|
57
|
+
## The `oar-voyage/1` format
|
|
58
|
+
|
|
59
|
+
`--record` writes one JSON object per line, discriminated by `kind`. The
|
|
60
|
+
format is defined and owned here; other tools (such as the coxswain
|
|
61
|
+
cockpit) may write or read the same format as consumers.
|
|
62
|
+
|
|
63
|
+
- Line 1 is always the header:
|
|
64
|
+
`{"kind":"header","format":"oar-voyage/1","runtime","model?","cwd","sessionId","startedAt","recorder"}`
|
|
65
|
+
(`model` is omitted when none was requested; `recorder` names the writer,
|
|
66
|
+
e.g. `oar-cli/0.0.5`).
|
|
67
|
+
- `{"kind":"submission","at","via","text"}` — one per human input; `via` is
|
|
68
|
+
`"prompt"`, `"steer"`, or `"queue"` (the CLI only writes `"prompt"`).
|
|
69
|
+
- `{"kind":"event","event":{...}}` — one raw `SessionEvent` verbatim, no
|
|
70
|
+
filtering or re-timestamping.
|
|
71
|
+
- `{"kind":"end","at","reason"}` — always the last line; a log without it
|
|
72
|
+
is a truncated capture.
|
|
73
|
+
|
|
74
|
+
All timestamps are Unix epoch milliseconds on the same clock as each
|
|
75
|
+
event's `receivedAt`. Lines are written synchronously in arrival order, so
|
|
76
|
+
a crashed run still leaves a readable prefix.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
-
import { runtimes } from "@botiverse/oar";
|
|
4
|
+
import { aggregateDeltas, runtimes, } from "@botiverse/oar";
|
|
5
|
+
import { createProgressRenderer } from "./progress.js";
|
|
6
|
+
import { openVoyage } from "./voyage.js";
|
|
5
7
|
// Read the version from this package's own manifest so `--version` can never
|
|
6
8
|
// drift from package.json. `../package.json` resolves to the package root in
|
|
7
9
|
// both src (packages/cli) and the published tarball (package/dist -> package).
|
|
@@ -59,10 +61,25 @@ program
|
|
|
59
61
|
}));
|
|
60
62
|
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
61
63
|
});
|
|
64
|
+
const jsonObserver = (event) => {
|
|
65
|
+
process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
66
|
+
};
|
|
67
|
+
function progressObserver(runtimeId) {
|
|
68
|
+
const render = createProgressRenderer(runtimeId);
|
|
69
|
+
const renderTo = (event) => {
|
|
70
|
+
const line = render(event);
|
|
71
|
+
if (line !== null) {
|
|
72
|
+
process.stdout.write(`${line}\n`);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return aggregateDeltas(renderTo, { maxHoldMs: 250 });
|
|
76
|
+
}
|
|
62
77
|
program
|
|
63
78
|
.command("run <runtime> <prompt>")
|
|
64
|
-
.description("Run one turn in a fresh session and
|
|
79
|
+
.description("Run one turn in a fresh session and show its progress")
|
|
65
80
|
.option("--model <model>", "runtime-native model identifier")
|
|
81
|
+
.option("--json", "print raw session events as JSON lines instead of progress")
|
|
82
|
+
.option("--record <file>", "write the run as an oar-voyage/1 JSONL log")
|
|
66
83
|
.action(async (id, prompt, flags) => {
|
|
67
84
|
const runtime = runtimes.require(id);
|
|
68
85
|
if (runtime.installation === undefined) {
|
|
@@ -80,18 +97,36 @@ program
|
|
|
80
97
|
cwd: process.cwd(),
|
|
81
98
|
...(flags.model === undefined ? {} : { model: flags.model }),
|
|
82
99
|
});
|
|
100
|
+
const recorder = flags.record === undefined
|
|
101
|
+
? undefined
|
|
102
|
+
: openVoyage(flags.record, {
|
|
103
|
+
runtime: id,
|
|
104
|
+
...(flags.model === undefined ? {} : { model: flags.model }),
|
|
105
|
+
cwd: process.cwd(),
|
|
106
|
+
sessionId: session.id,
|
|
107
|
+
startedAt: Date.now(),
|
|
108
|
+
recorder: `oar-cli/${packageVersion()}`,
|
|
109
|
+
});
|
|
110
|
+
const print = flags.json === true ? jsonObserver : progressObserver(id);
|
|
83
111
|
session.subscribe((event) => {
|
|
84
|
-
|
|
112
|
+
recorder?.event(event);
|
|
113
|
+
print(event);
|
|
85
114
|
});
|
|
115
|
+
recorder?.submission("prompt", prompt);
|
|
86
116
|
const result = session.prompt(prompt);
|
|
87
117
|
if (result.kind !== "turn") {
|
|
88
118
|
process.stderr.write("session is busy\n");
|
|
119
|
+
await session.dispose();
|
|
120
|
+
recorder?.end("disposed");
|
|
89
121
|
process.exitCode = 1;
|
|
90
122
|
return;
|
|
91
123
|
}
|
|
92
124
|
const outcome = await result.turn.outcome;
|
|
93
125
|
await session.dispose();
|
|
94
|
-
|
|
126
|
+
recorder?.end("disposed");
|
|
127
|
+
if (flags.json === true) {
|
|
128
|
+
process.stdout.write(`${JSON.stringify({ outcome })}\n`);
|
|
129
|
+
}
|
|
95
130
|
process.exitCode = outcome.kind === "completed" ? 0 : 1;
|
|
96
131
|
});
|
|
97
132
|
await program.parseAsync();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,eAAe,EACf,QAAQ,GAGT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,SAAS,cAAc;IACrB,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAChC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAClE,CAAC;IACF,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,SAAS,IAAI,MAAM;WACtE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;QACrC,CAAC,CAAC,MAAM,CAAC,OAAO;QAChB,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KAC1B,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,oDAAoD,CAAC;KACjE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAE7B,SAAS,QAAQ,CAAC,EAAsB;IACtC,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAA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AAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IAC1C,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SessionEvent, type TurnOutcome } from "@botiverse/oar";
|
|
2
|
+
export declare function renderOutcome(outcome: TurnOutcome): string;
|
|
3
|
+
export declare function createProgressRenderer(runtimeId: string): (event: SessionEvent) => string | null;
|
|
4
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../src/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAYxB,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAQ1D;AAID,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAChB,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,IAAI,CAgCxC"}
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { classifyTool, toolActionLabel, } from "@botiverse/oar";
|
|
2
|
+
export function renderOutcome(outcome) {
|
|
3
|
+
if (outcome.kind === "completed") {
|
|
4
|
+
return "[turn completed]";
|
|
5
|
+
}
|
|
6
|
+
if (outcome.kind === "aborted") {
|
|
7
|
+
return "[turn aborted]";
|
|
8
|
+
}
|
|
9
|
+
return `[turn failed: ${outcome.failure}] ${outcome.reason}`;
|
|
10
|
+
}
|
|
11
|
+
// Returns one printable line per event, or null when there is nothing worth
|
|
12
|
+
// showing (turn_started, redacted/empty reasoning, empty text).
|
|
13
|
+
export function createProgressRenderer(runtimeId) {
|
|
14
|
+
const started = new Map();
|
|
15
|
+
return (event) => {
|
|
16
|
+
switch (event.kind) {
|
|
17
|
+
case "turn_started":
|
|
18
|
+
return null;
|
|
19
|
+
case "text_delta":
|
|
20
|
+
return event.text === "" ? null : event.text;
|
|
21
|
+
case "reasoning":
|
|
22
|
+
return event.content.kind === "text" && event.content.text !== ""
|
|
23
|
+
? `[thinking] ${event.content.text}`
|
|
24
|
+
: null;
|
|
25
|
+
case "tool_call_started": {
|
|
26
|
+
const action = classifyTool(runtimeId, event.tool, event.input);
|
|
27
|
+
started.set(event.callId, { kind: action.kind, receivedAt: event.receivedAt });
|
|
28
|
+
const label = toolActionLabel(action.kind, "running");
|
|
29
|
+
return action.detail === undefined ? `[${label}]` : `[${label}] ${action.detail}`;
|
|
30
|
+
}
|
|
31
|
+
case "tool_call_ended": {
|
|
32
|
+
const call = started.get(event.callId);
|
|
33
|
+
started.delete(event.callId);
|
|
34
|
+
if (call === undefined) {
|
|
35
|
+
return `[${toolActionLabel("other", "done")}]`;
|
|
36
|
+
}
|
|
37
|
+
const seconds = ((event.receivedAt - call.receivedAt) / 1000).toFixed(1);
|
|
38
|
+
return `[${toolActionLabel(call.kind, "done")}] (${seconds}s)`;
|
|
39
|
+
}
|
|
40
|
+
case "turn_ended":
|
|
41
|
+
return renderOutcome(event.outcome);
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../src/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,GAIhB,MAAM,gBAAgB,CAAC;AAYxB,MAAM,UAAU,aAAa,CAAC,OAAoB;IAChD,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,iBAAiB,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;AAC/D,CAAC;AAED,4EAA4E;AAC5E,gEAAgE;AAChE,MAAM,UAAU,sBAAsB,CACpC,SAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC;YACd,KAAK,YAAY;gBACf,OAAO,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;YAC/C,KAAK,WAAW;gBACd,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,EAAE;oBAC/D,CAAC,CAAC,cAAc,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;oBACpC,CAAC,CAAC,IAAI,CAAC;YACX,KAAK,mBAAmB,CAAC,CAAC,CAAC;gBACzB,MAA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from "@botiverse/oar";
|
|
2
|
+
export declare const VOYAGE_FORMAT = "oar-voyage/1";
|
|
3
|
+
export type SubmissionVia = "prompt" | "steer" | "queue";
|
|
4
|
+
export interface VoyageHeader {
|
|
5
|
+
readonly runtime: string;
|
|
6
|
+
readonly model?: string;
|
|
7
|
+
readonly cwd: string;
|
|
8
|
+
readonly sessionId: string;
|
|
9
|
+
readonly startedAt: number;
|
|
10
|
+
readonly recorder: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function headerLine(header: VoyageHeader): string;
|
|
13
|
+
export declare function submissionLine(at: number, via: SubmissionVia, text: string): string;
|
|
14
|
+
export declare function eventLine(event: SessionEvent): string;
|
|
15
|
+
export declare function endLine(at: number, reason: string): string;
|
|
16
|
+
export interface VoyageRecorder {
|
|
17
|
+
submission(via: SubmissionVia, text: string): void;
|
|
18
|
+
event(event: SessionEvent): void;
|
|
19
|
+
end(reason: string): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function openVoyage(path: string, header: VoyageHeader): VoyageRecorder;
|
|
22
|
+
//# sourceMappingURL=voyage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voyage.d.ts","sourceRoot":"","sources":["../src/voyage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AASnD,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAWvD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAErD;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACjC,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,cAAc,CAkB7E"}
|
package/dist/voyage.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { closeSync, openSync, writeSync } from "node:fs";
|
|
2
|
+
// The oar-voyage/1 JSONL format: one JSON object per line, discriminated by
|
|
3
|
+
// `kind`. Line 1 is `header`; `submission` marks each human input; `event`
|
|
4
|
+
// wraps one raw SessionEvent verbatim (no filtering or re-timestamping);
|
|
5
|
+
// `end` is the last line — a log without it is a truncated capture. All
|
|
6
|
+
// timestamps are Unix epoch milliseconds on the same clock as `receivedAt`.
|
|
7
|
+
// The format is defined and owned by oar; other tools may consume it.
|
|
8
|
+
export const VOYAGE_FORMAT = "oar-voyage/1";
|
|
9
|
+
export function headerLine(header) {
|
|
10
|
+
return JSON.stringify({
|
|
11
|
+
kind: "header",
|
|
12
|
+
format: VOYAGE_FORMAT,
|
|
13
|
+
runtime: header.runtime,
|
|
14
|
+
...(header.model === undefined ? {} : { model: header.model }),
|
|
15
|
+
cwd: header.cwd,
|
|
16
|
+
sessionId: header.sessionId,
|
|
17
|
+
startedAt: header.startedAt,
|
|
18
|
+
recorder: header.recorder,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function submissionLine(at, via, text) {
|
|
22
|
+
return JSON.stringify({ kind: "submission", at, via, text });
|
|
23
|
+
}
|
|
24
|
+
export function eventLine(event) {
|
|
25
|
+
return JSON.stringify({ kind: "event", event });
|
|
26
|
+
}
|
|
27
|
+
export function endLine(at, reason) {
|
|
28
|
+
return JSON.stringify({ kind: "end", at, reason });
|
|
29
|
+
}
|
|
30
|
+
// Lines go through synchronous fd writes so their order — and everything
|
|
31
|
+
// written so far — survives a crashing process; `end` closes the file.
|
|
32
|
+
export function openVoyage(path, header) {
|
|
33
|
+
const fd = openSync(path, "w");
|
|
34
|
+
const write = (line) => {
|
|
35
|
+
writeSync(fd, `${line}\n`);
|
|
36
|
+
};
|
|
37
|
+
write(headerLine(header));
|
|
38
|
+
return {
|
|
39
|
+
submission(via, text) {
|
|
40
|
+
write(submissionLine(Date.now(), via, text));
|
|
41
|
+
},
|
|
42
|
+
event(event) {
|
|
43
|
+
write(eventLine(event));
|
|
44
|
+
},
|
|
45
|
+
end(reason) {
|
|
46
|
+
write(endLine(Date.now(), reason));
|
|
47
|
+
closeSync(fd);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=voyage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voyage.js","sourceRoot":"","sources":["../src/voyage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzD,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,sEAAsE;AAEtE,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAa5C,MAAM,UAAU,UAAU,CAAC,MAAoB;I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MAAM,CAAC,CAAC,CAAC;IAC1B,OAAO;QACL,UAAU,CAAC,GAAG,EAAE,IAAI;YAClB,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC;QACD,GAAG,CAAC,MAAM;YACR,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YACnC,SAAS,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/oar-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Command-line interface for observing agent runtimes with OAR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"commander": "^12.1.0",
|
|
15
|
-
"@botiverse/oar": "0.0.
|
|
15
|
+
"@botiverse/oar": "0.0.6"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|