agent-afk 5.319.4 → 5.319.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/dist/agent/content/user-authored.d.ts +11 -0
- package/dist/agent/facets/derive.trace.d.ts +2 -0
- package/dist/agent/facets/schema.d.ts +5 -1
- package/dist/agent/trace/cost.d.ts +30 -0
- package/dist/agent/trace/receipt.d.ts +7 -6
- package/dist/cli.mjs +387 -387
- package/dist/index.mjs +190 -190
- package/dist/telegram.mjs +203 -203
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BlockLike {
|
|
2
|
+
readonly type: string;
|
|
3
|
+
readonly text?: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface MessageLike {
|
|
6
|
+
readonly role: string;
|
|
7
|
+
readonly content: string | readonly BlockLike[] | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function hasToolResultBlock(content: MessageLike['content']): boolean;
|
|
10
|
+
export declare function messageText(content: MessageLike['content'], separator?: string): string;
|
|
11
|
+
export declare function isUserAuthoredTurn(message: MessageLike): boolean;
|
|
@@ -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 =
|
|
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,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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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;
|