@agentrific/server 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @agentrific/server
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 66aa463: Improve task-board navigation and display accumulated run usage. Add clearer Bash
8
+ command details, highlighted read-file previews and better native sheet sizing.
9
+ Server events now preserve complete Bash command inputs and report session usage.
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
package/cli.js CHANGED
@@ -30,7 +30,7 @@ var init_package = __esm({
30
30
  "package.json"() {
31
31
  package_default = {
32
32
  name: "@agentrific/server",
33
- version: "0.2.0",
33
+ version: "0.3.0",
34
34
  description: "Self-hosted control plane for long-running coding agents",
35
35
  keywords: [
36
36
  "agentrific",
@@ -355,6 +355,11 @@ var init_src = __esm({
355
355
  gitFlow: GitFlowSchema.optional(),
356
356
  gitDelivery: GitDeliverySchema.optional(),
357
357
  preparation: RunPreparationSchema.optional(),
358
+ usage: z2.object({
359
+ tokens: z2.number().nonnegative(),
360
+ turns: z2.number().int().nonnegative(),
361
+ tools: z2.number().int().nonnegative()
362
+ }).optional(),
358
363
  createdAt: z2.string().datetime(),
359
364
  updatedAt: z2.string().datetime()
360
365
  });
@@ -418,6 +423,7 @@ var init_src = __esm({
418
423
  }),
419
424
  z2.object({
420
425
  type: z2.literal("message.completed"),
426
+ tokens: z2.number().nonnegative().optional(),
421
427
  model: ModelIdentitySchema.optional(),
422
428
  sessionId: z2.string(),
423
429
  messageId: z2.string().optional(),
@@ -2079,13 +2085,29 @@ var init_runtime = __esm({
2079
2085
  const entry = {
2080
2086
  session,
2081
2087
  agent,
2082
- unsubscribe: agent.subscribe(this.emit),
2088
+ unsubscribe: () => {
2089
+ },
2083
2090
  running: false,
2084
2091
  stopping: false,
2085
2092
  pending: []
2086
2093
  };
2094
+ entry.unsubscribe = agent.subscribe((event) => {
2095
+ this.emit(event);
2096
+ if (event.type !== "message.completed" && event.type !== "tool.started") return;
2097
+ const usage = entry.session.usage ?? { tokens: 0, turns: 0, tools: 0 };
2098
+ entry.session = {
2099
+ ...entry.session,
2100
+ usage: {
2101
+ tokens: usage.tokens + (event.type === "message.completed" ? event.tokens ?? 0 : 0),
2102
+ turns: usage.turns + (event.type === "message.completed" ? 1 : 0),
2103
+ tools: usage.tools + (event.type === "tool.started" ? 1 : 0)
2104
+ },
2105
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2106
+ };
2107
+ this.emit({ type: "session.updated", session: entry.session });
2108
+ });
2087
2109
  if (agent.model) {
2088
- entry.session = { ...session, model: agent.model };
2110
+ entry.session = { ...entry.session, model: agent.model };
2089
2111
  this.emit({ type: "session.updated", session: entry.session });
2090
2112
  }
2091
2113
  this.active.set(session.id, entry);
@@ -3316,6 +3338,7 @@ function createPiFactory(files, models2, delivery2, createSession = createAgentS
3316
3338
  sessionId,
3317
3339
  messageId: assistantMessageId,
3318
3340
  text,
3341
+ tokens: event.message.usage.totalTokens,
3319
3342
  model: models2.identity(event.message.provider, event.message.model)
3320
3343
  });
3321
3344
  assistantMessageId = void 0;
@@ -3339,7 +3362,8 @@ function createPiFactory(files, models2, delivery2, createSession = createAgentS
3339
3362
  sessionId,
3340
3363
  toolCallId: event.toolCallId,
3341
3364
  tool: event.toolName,
3342
- input: boundedJson(event.args, 1200),
3365
+ // Preserve complete Bash arguments so multiline commands can be inspected.
3366
+ input: event.toolName === "bash" ? JSON.stringify(event.args) : boundedJson(event.args, 1200),
3343
3367
  filePath: filePaths.get(event.toolCallId)
3344
3368
  });
3345
3369
  return true;
@@ -4232,6 +4256,7 @@ async function createAndStartSession(input) {
4232
4256
  status: "starting",
4233
4257
  agent: input.agent,
4234
4258
  model: selectedModel,
4259
+ usage: { tokens: 0, turns: 0, tools: 0 },
4235
4260
  gitFlow: input.gitFlow,
4236
4261
  branch: null,
4237
4262
  createdAt: now,