agent-afk 5.319.5 → 5.320.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.
@@ -2,5 +2,7 @@ export type DowngradableClosureReason = 'budget_exceeded' | 'iteration_cap' | 't
2
2
  export interface TraceSignals {
3
3
  traceClosureReason: DowngradableClosureReason | undefined;
4
4
  hasSubagentBudgetExhaustion: boolean;
5
+ totalCostUsd?: number;
6
+ subagentCostUsd?: number;
5
7
  }
6
8
  export declare function parseTraceSignals(content: string): TraceSignals;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const FACET_VERSION = 12;
2
+ export declare const FACET_VERSION = 13;
3
3
  export declare const ToolEventInputSchema: z.ZodObject<{
4
4
  toolName: z.ZodString;
5
5
  toolUseId: z.ZodOptional<z.ZodString>;
@@ -116,6 +116,8 @@ export declare const TokenBreakdownSchema: z.ZodObject<{
116
116
  cache_read: z.ZodOptional<z.ZodNumber>;
117
117
  cache_creation: z.ZodOptional<z.ZodNumber>;
118
118
  cost_usd: z.ZodNumber;
119
+ total_cost_usd: z.ZodOptional<z.ZodNumber>;
120
+ subagent_cost_usd: z.ZodOptional<z.ZodNumber>;
119
121
  }, z.core.$strip>;
120
122
  export type TokenBreakdown = z.infer<typeof TokenBreakdownSchema>;
121
123
  export declare const ParallelDispatchStatsSchema: z.ZodObject<{
@@ -221,6 +223,8 @@ export declare const SessionFacetSchema: z.ZodObject<{
221
223
  cache_read: z.ZodOptional<z.ZodNumber>;
222
224
  cache_creation: z.ZodOptional<z.ZodNumber>;
223
225
  cost_usd: z.ZodNumber;
226
+ total_cost_usd: z.ZodOptional<z.ZodNumber>;
227
+ subagent_cost_usd: z.ZodOptional<z.ZodNumber>;
224
228
  }, z.core.$strip>>;
225
229
  parallel_dispatch: z.ZodObject<{
226
230
  total_tool_calls: z.ZodNumber;
@@ -0,0 +1,3 @@
1
+ import type { SlotProvider } from './model-slots.js';
2
+ export type SlotEndpointRoute = 'anthropic-direct' | 'openai-compatible' | 'xai';
3
+ export declare function explicitSlotRoute(provider: SlotProvider | undefined): SlotEndpointRoute | undefined;
@@ -0,0 +1,30 @@
1
+ export type SessionCostSource = 'closures+seal' | 'closures' | 'seal' | 'none';
2
+ export interface CostTokens {
3
+ input?: number;
4
+ output?: number;
5
+ cacheRead?: number;
6
+ cacheCreation?: number;
7
+ }
8
+ export interface SessionCostBreakdown {
9
+ rootCostUsd?: number;
10
+ subagentCostUsd?: number;
11
+ totalCostUsd?: number;
12
+ totalTokens?: CostTokens;
13
+ closureCount: number;
14
+ source: SessionCostSource;
15
+ }
16
+ export interface CostEventLike {
17
+ kind: unknown;
18
+ payload?: unknown;
19
+ }
20
+ export declare class SessionCostAccumulator {
21
+ private closureSum;
22
+ private closureCount;
23
+ private lastClosureCost;
24
+ private readonly tokens;
25
+ private sealRoot;
26
+ private sealSubagent;
27
+ add(event: CostEventLike): void;
28
+ result(): SessionCostBreakdown;
29
+ }
30
+ export declare function computeSessionCost(events: Iterable<CostEventLike>): SessionCostBreakdown;
@@ -1,5 +1,6 @@
1
1
  import { renderReceiptMarkdown } from './receipt.render.js';
2
2
  import type { HookHandler } from '../hooks.js';
3
+ import { type CostTokens, type SessionCostSource } from './cost.js';
3
4
  import { type ClosureReason, type ToolFailureClass, type TraceEvent, type TraceEventKind } from './types.js';
4
5
  export { renderReceiptMarkdown };
5
6
  export declare const RECEIPT_SCHEMA_VERSION: 1;
@@ -54,12 +55,12 @@ export interface RunReceipt {
54
55
  cost: {
55
56
  finalCostUsd?: number;
56
57
  turnCount?: number;
57
- tokens?: {
58
- input?: number;
59
- output?: number;
60
- cacheRead?: number;
61
- cacheCreation?: number;
62
- };
58
+ tokens?: CostTokens;
59
+ rootCostUsd?: number;
60
+ subagentCostUsd?: number;
61
+ totalCostUsd?: number;
62
+ totalTokens?: CostTokens;
63
+ costSource?: SessionCostSource;
63
64
  };
64
65
  failures: ReceiptToolFailure[];
65
66
  humanReviewRequired: boolean;
@@ -0,0 +1,23 @@
1
+ import { type ModelSlots, type SlotName } from '../../agent/session/model-slots.js';
2
+ import type { Check } from './doctor-checks.js';
3
+ export declare const SLOT_PROBE_TIMEOUT_MS = 3000;
4
+ export interface SlotEndpointDeps {
5
+ bindings?: ModelSlots;
6
+ timeoutMs?: number;
7
+ fetchImpl?: typeof fetch;
8
+ isAnthropicRouted?: (slot: SlotName, bindings: ModelSlots) => Promise<boolean>;
9
+ routeOf?: (slot: SlotName, bindings: ModelSlots) => Promise<string>;
10
+ }
11
+ export declare function sanitizeUrl(raw: string): string;
12
+ export declare function modelsUrl(baseUrl: string): string;
13
+ export type ProbeAuth = {
14
+ kind: 'slot-key';
15
+ key: string;
16
+ } | {
17
+ kind: 'no-slot-key';
18
+ } | {
19
+ kind: 'unverified';
20
+ reason: string;
21
+ };
22
+ export declare function planProbeAuth(binding: ModelSlots[SlotName], wireRoute: string): ProbeAuth;
23
+ export declare function checkSlotEndpoints(deps?: SlotEndpointDeps): Promise<Check[]>;