@iinm/plain-agent 1.8.2 → 1.8.3
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 +4 -0
- package/package.json +1 -1
- package/src/cliBatch.mjs +3 -0
- package/src/cliInteractive.mjs +6 -3
- package/src/main.mjs +1 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/cliBatch.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { appendUsageRecord, buildUsageRecord } from "./usageStore.mjs";
|
|
|
14
14
|
* @property {string} sessionId
|
|
15
15
|
* @property {string} modelName
|
|
16
16
|
* @property {boolean} sandbox
|
|
17
|
+
* @property {Date} startTime
|
|
17
18
|
* @property {() => Promise<void>} onStop
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -32,6 +33,7 @@ export async function startBatchSession({
|
|
|
32
33
|
sessionId,
|
|
33
34
|
modelName,
|
|
34
35
|
sandbox,
|
|
36
|
+
startTime,
|
|
35
37
|
onStop,
|
|
36
38
|
}) {
|
|
37
39
|
setupEventHandlers(agentEventEmitter, { sessionId, modelName, sandbox });
|
|
@@ -55,6 +57,7 @@ export async function startBatchSession({
|
|
|
55
57
|
modelName,
|
|
56
58
|
workingDir: process.cwd(),
|
|
57
59
|
costSummary,
|
|
60
|
+
now: startTime,
|
|
58
61
|
});
|
|
59
62
|
if (record) {
|
|
60
63
|
await appendUsageRecord(record);
|
package/src/cliInteractive.mjs
CHANGED
|
@@ -57,6 +57,7 @@ const HELP_MESSAGE = [
|
|
|
57
57
|
* @property {AgentCommands} agentCommands
|
|
58
58
|
* @property {string} sessionId
|
|
59
59
|
* @property {string} modelName
|
|
60
|
+
* @property {Date} startTime
|
|
60
61
|
* @property {{ command: string; args?: string[] } | undefined} notifyCmd
|
|
61
62
|
* @property {boolean} sandbox
|
|
62
63
|
* @property {() => Promise<void>} onStop
|
|
@@ -69,9 +70,9 @@ const HELP_MESSAGE = [
|
|
|
69
70
|
* Failures are logged but never thrown so exit is not blocked.
|
|
70
71
|
*
|
|
71
72
|
* @param {import("./costTracker.mjs").CostSummary} summary
|
|
72
|
-
* @param {{ sessionId: string, modelName: string }} meta
|
|
73
|
+
* @param {{ sessionId: string, modelName: string, startTime: Date }} meta
|
|
73
74
|
*/
|
|
74
|
-
async function persistUsage(summary, { sessionId, modelName }) {
|
|
75
|
+
async function persistUsage(summary, { sessionId, modelName, startTime }) {
|
|
75
76
|
try {
|
|
76
77
|
const record = buildUsageRecord({
|
|
77
78
|
sessionId,
|
|
@@ -79,6 +80,7 @@ async function persistUsage(summary, { sessionId, modelName }) {
|
|
|
79
80
|
modelName,
|
|
80
81
|
workingDir: process.cwd(),
|
|
81
82
|
costSummary: summary,
|
|
83
|
+
now: startTime,
|
|
82
84
|
});
|
|
83
85
|
if (!record) return;
|
|
84
86
|
await appendUsageRecord(record);
|
|
@@ -99,6 +101,7 @@ export function startInteractiveSession({
|
|
|
99
101
|
agentCommands,
|
|
100
102
|
sessionId,
|
|
101
103
|
modelName,
|
|
104
|
+
startTime,
|
|
102
105
|
notifyCmd,
|
|
103
106
|
sandbox,
|
|
104
107
|
onStop,
|
|
@@ -153,7 +156,7 @@ export function startInteractiveSession({
|
|
|
153
156
|
const summary = agentCommands.getCostSummary();
|
|
154
157
|
console.log();
|
|
155
158
|
console.log(formatCostSummary(summary));
|
|
156
|
-
await persistUsage(summary, { sessionId, modelName });
|
|
159
|
+
await persistUsage(summary, { sessionId, modelName, startTime });
|
|
157
160
|
await onStop();
|
|
158
161
|
process.exit(0);
|
|
159
162
|
};
|
package/src/main.mjs
CHANGED