@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 CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="https://pub-0bb49aa929f242d49c89ed8c297932b5.r2.dev/plain-agent/plain-agent-logo.png" alt="plain-agent logo" width="320">
3
+ </p>
4
+
1
5
  # Plain Agent
2
6
 
3
7
  A lightweight CLI-based coding agent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iinm/plain-agent",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "A lightweight CLI-based coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",
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);
@@ -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
@@ -248,6 +248,7 @@ if (cliArgs.subcommand.type === "cost") {
248
248
  sessionId,
249
249
  modelName: modelNameWithVariant,
250
250
  sandbox: Boolean(appConfig.sandbox),
251
+ startTime,
251
252
  onStop: async () => {
252
253
  for (const cleanup of mcpCleanups) {
253
254
  await cleanup();