agent-afk 5.320.5 → 5.321.1
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/provider.d.ts +8 -0
- package/dist/agent/session/accounting-accumulator.d.ts +6 -6
- package/dist/agent/session/agent-session.d.ts +1 -6
- package/dist/agent/session/agent-session.executors.d.ts +1 -0
- package/dist/agent/session/billing-rollup.d.ts +18 -0
- package/dist/agent/session/closure-emitter.d.ts +3 -0
- package/dist/agent/session/manager-shutdown-config.d.ts +7 -0
- package/dist/agent/session/session-executors.d.ts +2 -6
- package/dist/agent/subagent/capped-handoff.d.ts +2 -1
- package/dist/agent/subagent/handle.billing.d.ts +13 -0
- package/dist/agent/subagent/handle.d.ts +8 -0
- package/dist/agent/subagent/handle.run-success.d.ts +2 -1
- package/dist/agent/subagent/handle.streaming.d.ts +2 -1
- package/dist/agent/subagent/result.d.ts +3 -0
- package/dist/agent/subagent.d.ts +3 -0
- package/dist/agent/tools/compose-executor.d.ts +5 -0
- package/dist/agent/trace/cost.d.ts +3 -1
- package/dist/agent/trace/events.billing.d.ts +66 -0
- package/dist/agent/trace/events.browser.d.ts +1 -1
- package/dist/agent/trace/events.d.ts +110 -8
- package/dist/agent/trace/events.subagent-lifecycle.d.ts +45 -3
- package/dist/agent/trace/pending-writes.d.ts +1 -1
- package/dist/agent/trace/types.d.ts +9 -3
- package/dist/agent/types/config-types.d.ts +1 -0
- package/dist/agent/usage.billing.d.ts +27 -0
- package/dist/cli/commands/doctor-slot-endpoints.d.ts +0 -1
- package/dist/cli/commands/interactive/bootstrap-session-builder.d.ts +2 -0
- package/dist/cli/commands/trace-lifecycle-render.d.ts +2 -0
- package/dist/cli.mjs +399 -399
- package/dist/index.mjs +193 -193
- package/dist/telegram/wire-telegram-executors.d.ts +1 -0
- package/dist/telegram.mjs +209 -209
- package/dist/web-server/session-owner.wiring.d.ts +1 -0
- package/package.json +1 -1
package/dist/agent/provider.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface ProviderUsage {
|
|
|
29
29
|
outputTokens?: number;
|
|
30
30
|
totalTokens?: number;
|
|
31
31
|
contextWindowTokens?: number;
|
|
32
|
+
billing?: BillingUsage;
|
|
32
33
|
totalCostUsd?: number;
|
|
33
34
|
stopReason?: string | null;
|
|
34
35
|
durationMs?: number;
|
|
@@ -40,6 +41,13 @@ export interface ProviderUsage {
|
|
|
40
41
|
errors?: string[];
|
|
41
42
|
raw?: Record<string, unknown>;
|
|
42
43
|
}
|
|
44
|
+
export interface BillingUsage {
|
|
45
|
+
provider: string;
|
|
46
|
+
uncachedInput: number;
|
|
47
|
+
cacheRead: number;
|
|
48
|
+
cacheWrite: number;
|
|
49
|
+
output: number;
|
|
50
|
+
}
|
|
43
51
|
export interface ProviderProgress {
|
|
44
52
|
taskId: string;
|
|
45
53
|
description: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClosureSignals } from './closure-emitter.js';
|
|
2
2
|
import type { ResponseMetadata } from '../types.js';
|
|
3
|
+
import { type BillingRollupSnapshot } from './billing-rollup.js';
|
|
3
4
|
interface TokenCounters {
|
|
4
5
|
input: number;
|
|
5
6
|
output: number;
|
|
@@ -12,6 +13,8 @@ export interface AccountingSnapshot {
|
|
|
12
13
|
subagentCompletedCount: number;
|
|
13
14
|
subagentRunningTokens: Readonly<TokenCounters>;
|
|
14
15
|
subagentRunningCostUsd: number;
|
|
16
|
+
sessionBilling?: BillingRollupSnapshot;
|
|
17
|
+
subagentBilling?: BillingRollupSnapshot;
|
|
15
18
|
}
|
|
16
19
|
export declare class AccountingAccumulator {
|
|
17
20
|
private sessionRunningCostUsd;
|
|
@@ -24,18 +27,15 @@ export declare class AccountingAccumulator {
|
|
|
24
27
|
private subagentCompletedCount;
|
|
25
28
|
private subagentRunningTokens;
|
|
26
29
|
private subagentRunningCostUsd;
|
|
30
|
+
private readonly sessionBilling;
|
|
31
|
+
private readonly subagentBilling;
|
|
27
32
|
reset(): void;
|
|
28
33
|
recordTurnMetadata(m: ResponseMetadata): void;
|
|
29
34
|
markHookBlocked(): void;
|
|
30
35
|
markMaxTurnsHit(): void;
|
|
31
36
|
markProviderError(): void;
|
|
32
37
|
clearProviderError(): void;
|
|
33
|
-
recordSubagentCompletion(usage?:
|
|
34
|
-
inputTokens?: number;
|
|
35
|
-
outputTokens?: number;
|
|
36
|
-
cacheReadTokens?: number;
|
|
37
|
-
cacheCreationTokens?: number;
|
|
38
|
-
}, costUsd?: number): void;
|
|
38
|
+
recordSubagentCompletion(usage?: import('../subagent/result.js').SubagentTrace['usage'], costUsd?: number): void;
|
|
39
39
|
closureSignals(signal: AbortSignal, dispatchReason: string): ClosureSignals;
|
|
40
40
|
snapshot(): AccountingSnapshot;
|
|
41
41
|
}
|
|
@@ -90,12 +90,7 @@ export declare class AgentSession implements IAgentSession {
|
|
|
90
90
|
getHistory(): readonly Message[];
|
|
91
91
|
getTurnCount(): number;
|
|
92
92
|
close(): Promise<void>;
|
|
93
|
-
recordSubagentCompletion(usage?:
|
|
94
|
-
inputTokens?: number;
|
|
95
|
-
outputTokens?: number;
|
|
96
|
-
cacheReadTokens?: number;
|
|
97
|
-
cacheCreationTokens?: number;
|
|
98
|
-
}, costUsd?: number): void;
|
|
93
|
+
recordSubagentCompletion(usage?: import('../subagent/result.js').SubagentTrace['usage'], costUsd?: number): void;
|
|
99
94
|
pushSidebandEvent(event: OutputEvent): void;
|
|
100
95
|
recordLedgerElicitation(reqId: string, request: ElicitationRequest): void;
|
|
101
96
|
}
|
|
@@ -7,6 +7,7 @@ type SubagentUsage = {
|
|
|
7
7
|
outputTokens?: number;
|
|
8
8
|
cacheReadTokens?: number;
|
|
9
9
|
cacheCreationTokens?: number;
|
|
10
|
+
outcome?: 'failed' | 'cancelled';
|
|
10
11
|
};
|
|
11
12
|
export declare function recordSubagentCompletionInTree(accounting: AccountingAccumulator, config: AgentConfig, abortController: AbortController, usage: SubagentUsage | undefined, costUsd: number | undefined): void;
|
|
12
13
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BillingUsage } from '../provider.js';
|
|
2
|
+
import type { BillingRollupSnapshot } from '../trace/events.billing.js';
|
|
3
|
+
export type { BillingCounters, BillingRollupSnapshot } from '../trace/events.billing.js';
|
|
4
|
+
export declare class BillingRollup {
|
|
5
|
+
private total;
|
|
6
|
+
private byProvider;
|
|
7
|
+
private recorded;
|
|
8
|
+
add(b: BillingUsage | undefined): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
snapshot(): BillingRollupSnapshot | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function optionalBilling<K extends string>(key: K, snap: BillingRollupSnapshot | undefined): Partial<Record<K, BillingRollupSnapshot>>;
|
|
13
|
+
export declare function sealBillingField(root: BillingRollupSnapshot | undefined, subagents: BillingRollupSnapshot | undefined): {
|
|
14
|
+
billing?: {
|
|
15
|
+
root?: BillingRollupSnapshot;
|
|
16
|
+
subagents?: BillingRollupSnapshot;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClosureReason, TraceSink } from '../trace/index.js';
|
|
2
2
|
import type { TraceWriter } from '../trace/writer.js';
|
|
3
|
+
import { type BillingRollupSnapshot } from './billing-rollup.js';
|
|
3
4
|
export interface ClosureTokenCounters {
|
|
4
5
|
input: number;
|
|
5
6
|
output: number;
|
|
@@ -28,6 +29,8 @@ export interface SealTraceInput extends ClosureSignals, ClosureTotals {
|
|
|
28
29
|
subagentCompletedCount: number;
|
|
29
30
|
subagentRunningTokens: ClosureTokenCounters;
|
|
30
31
|
subagentRunningCostUsd: number;
|
|
32
|
+
sessionBilling?: BillingRollupSnapshot;
|
|
33
|
+
subagentBilling?: BillingRollupSnapshot;
|
|
31
34
|
pendingChildTerminalWrites?: readonly Promise<void>[];
|
|
32
35
|
}
|
|
33
36
|
export declare function sealTraceWriter(writer: TraceWriter | undefined, input: SealTraceInput): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SubagentManager } from '../subagent.js';
|
|
2
|
+
import type { AgentConfig } from '../types.js';
|
|
3
|
+
export interface BillingStreamSource {
|
|
4
|
+
getPendingChildBillingStreams(): readonly Promise<void>[];
|
|
5
|
+
}
|
|
6
|
+
export declare function pendingChildBillingStreams(...sources: ReadonlyArray<BillingStreamSource | undefined>): readonly Promise<void>[];
|
|
7
|
+
export declare function managerShutdownConfig(manager: SubagentManager, composeExecutor?: BillingStreamSource): Pick<AgentConfig, 'drainSubagents' | 'getPendingChildTerminalWrites' | 'getPendingChildBillingStreams'>;
|
|
@@ -10,12 +10,7 @@ export interface SessionExecutorsBindTarget {
|
|
|
10
10
|
readonly hookRegistry: HookRegistry | undefined;
|
|
11
11
|
readonly messageJournal: MessageJournal | undefined;
|
|
12
12
|
getInputStreamRef(): Pick<InputStreamRef, 'pushUserMessage' | 'queueFrameworkContext'>;
|
|
13
|
-
recordSubagentCompletion(usage?:
|
|
14
|
-
inputTokens?: number;
|
|
15
|
-
outputTokens?: number;
|
|
16
|
-
cacheReadTokens?: number;
|
|
17
|
-
cacheCreationTokens?: number;
|
|
18
|
-
}, costUsd?: number): void;
|
|
13
|
+
recordSubagentCompletion(usage?: import('../subagent/result.js').SubagentTrace['usage'], costUsd?: number): void;
|
|
19
14
|
}
|
|
20
15
|
export interface SessionExecutors {
|
|
21
16
|
readonly subagentExecutor?: SubagentExecutor;
|
|
@@ -23,6 +18,7 @@ export interface SessionExecutors {
|
|
|
23
18
|
readonly composeExecutor?: ComposeExecutor;
|
|
24
19
|
bind(session: SessionExecutorsBindTarget): void;
|
|
25
20
|
drain(reason: string): Promise<unknown>;
|
|
21
|
+
getPendingChildBillingStreams?(): readonly Promise<void>[];
|
|
26
22
|
}
|
|
27
23
|
export type ProviderExecutorOpts = Pick<SessionExecutors, 'subagentExecutor' | 'skillExecutor' | 'composeExecutor'>;
|
|
28
24
|
export declare function providerExecutorOpts(executors: ProviderExecutorOpts | undefined): ProviderExecutorOpts;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Message, IAgentSession, OutputEvent } from '../types.js';
|
|
2
2
|
import type { SubagentHandleImpl } from './handle.js';
|
|
3
|
+
import type { RunBillingContext } from './handle.billing.js';
|
|
3
4
|
import { TOOL_USE_LOOP_CAPPED } from '../providers/shared/tool-loop-cap.js';
|
|
4
5
|
export declare function isNarrationOnly(text: string): boolean;
|
|
5
6
|
export declare class CappedHandoffAccumulator {
|
|
@@ -13,7 +14,7 @@ export declare class CappedHandoffAccumulator {
|
|
|
13
14
|
onEvent(event: OutputEvent): void;
|
|
14
15
|
finish(finalMessage: Message | undefined, session: IAgentSession): Message;
|
|
15
16
|
}
|
|
16
|
-
export declare function emitSuccessfulHandoff<T>(handle: SubagentHandleImpl<T>, message: Message, startTime: number): Promise<void>;
|
|
17
|
+
export declare function emitSuccessfulHandoff<T>(handle: SubagentHandleImpl<T>, message: Message, startTime: number, billingContext?: RunBillingContext): Promise<void>;
|
|
17
18
|
export interface CappedHandoff {
|
|
18
19
|
incomplete: true;
|
|
19
20
|
incompleteReason: typeof TOOL_USE_LOOP_CAPPED;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BillingUsage } from '../provider.js';
|
|
2
|
+
import { billingLifecycleFields } from '../usage.billing.js';
|
|
3
|
+
import type { SubagentHandleImpl } from './handle.js';
|
|
4
|
+
export type SubagentUnsuccessfulOutcome = 'failed' | 'cancelled';
|
|
5
|
+
export interface RunBillingContext {
|
|
6
|
+
total?: BillingUsage;
|
|
7
|
+
reported?: BillingUsage;
|
|
8
|
+
terminalOutcome?: SubagentUnsuccessfulOutcome;
|
|
9
|
+
}
|
|
10
|
+
export declare function unreportedBillingDelta(context: RunBillingContext): BillingUsage | undefined;
|
|
11
|
+
export declare function takeUnreportedBilling(context: RunBillingContext): BillingUsage | undefined;
|
|
12
|
+
export declare function settleUnreportedBilling<T>(handle: SubagentHandleImpl<T>, outcome: SubagentUnsuccessfulOutcome, context?: RunBillingContext): ReturnType<typeof billingLifecycleFields>;
|
|
13
|
+
export declare function trackBillingStream<T>(pending: Set<Promise<void>>, stream: Promise<T>): Promise<T>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ZodType } from 'zod';
|
|
2
2
|
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
3
3
|
import { AbortGraph } from '../abort-graph.js';
|
|
4
|
+
import type { BillingUsage } from '../provider.js';
|
|
4
5
|
import type { HookRegistry } from '../hooks.js';
|
|
5
6
|
import type { IAgentSession, Message } from '../types.js';
|
|
6
7
|
import type { OutputEvent, SubagentProgressSink, SubagentProgressMeta } from '../types/session-types.js';
|
|
@@ -8,6 +9,7 @@ import type { TraceSink } from '../trace/index.js';
|
|
|
8
9
|
import { PauseAwareCeiling } from './pause-ceiling.js';
|
|
9
10
|
import type { WorkspaceEntry, WorkspaceStore } from '../workspace/workspace-store.js';
|
|
10
11
|
import { type SubagentResult, type SubagentStatus, type SubagentTrace } from './result.js';
|
|
12
|
+
import { type RunBillingContext } from './handle.billing.js';
|
|
11
13
|
export type { SubagentProgressMeta };
|
|
12
14
|
export interface SubagentHandle<T = unknown> {
|
|
13
15
|
readonly id: string;
|
|
@@ -42,6 +44,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
42
44
|
readonly _idleTimeoutMs: number;
|
|
43
45
|
_currentStatus: SubagentStatus;
|
|
44
46
|
private inFlight;
|
|
47
|
+
private runInProgress;
|
|
45
48
|
_lastMessage: string | undefined;
|
|
46
49
|
_lastDurationMs: number | undefined;
|
|
47
50
|
private latestTerminalStatus;
|
|
@@ -54,6 +57,11 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
54
57
|
_lastStreamedContent: string;
|
|
55
58
|
_pauseCeiling: PauseAwareCeiling | undefined;
|
|
56
59
|
_lastStopReason: string | undefined;
|
|
60
|
+
_billingContext: RunBillingContext;
|
|
61
|
+
readonly _pendingBillingStreams: Set<Promise<void>>;
|
|
62
|
+
get pendingBillingStreams(): Promise<void>[];
|
|
63
|
+
get _runBilling(): BillingUsage | undefined;
|
|
64
|
+
set _runBilling(value: BillingUsage | undefined);
|
|
57
65
|
_logWriter?: {
|
|
58
66
|
write(event: OutputEvent): void;
|
|
59
67
|
close(): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SubagentProgressSink } from '../types/session-types.js';
|
|
2
2
|
import type { Message } from '../types.js';
|
|
3
|
+
import { type RunBillingContext } from './handle.billing.js';
|
|
3
4
|
import type { SubagentHandleImpl } from './handle.js';
|
|
4
|
-
export declare function drainAndEmitSuccess(handle: SubagentHandleImpl<unknown>, firstMsg: Message, startTime: number, sinkOverride: SubagentProgressSink | undefined): Promise<Message>;
|
|
5
|
+
export declare function drainAndEmitSuccess(handle: SubagentHandleImpl<unknown>, firstMsg: Message, startTime: number, sinkOverride: SubagentProgressSink | undefined, billingContext?: RunBillingContext): Promise<Message>;
|
|
@@ -3,7 +3,8 @@ import type { OutputEvent, SubagentProgressSink } from '../types/session-types.j
|
|
|
3
3
|
import type { Message } from '../types.js';
|
|
4
4
|
import { type SubagentResult, type SubagentStatus } from './result.js';
|
|
5
5
|
import type { SubagentHandleImpl } from './handle.js';
|
|
6
|
-
|
|
6
|
+
import { type RunBillingContext } from './handle.billing.js';
|
|
7
|
+
export declare function streamToFinalMessage<T>(handle: SubagentHandleImpl<T>, prompt: string | ContentBlockParam[], sinkOverride?: SubagentProgressSink, billingContext?: RunBillingContext): Promise<Message>;
|
|
7
8
|
export declare function runToResult<T>(handle: SubagentHandleImpl<T>, prompt: string | ContentBlockParam[], sinkOverride?: SubagentProgressSink): Promise<SubagentResult<T>>;
|
|
8
9
|
export declare function runInBackground<T>(handle: SubagentHandleImpl<T>, prompt: string, onResult?: (result: SubagentResult<T>) => void, onProgress?: (event: OutputEvent) => void): void;
|
|
9
10
|
export declare function dispatchStopAndRelease<T>(handle: SubagentHandleImpl<T>, reportedStatus: SubagentStatus, options?: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ZodError, ZodType } from 'zod';
|
|
2
2
|
import type { Message } from '../types.js';
|
|
3
|
+
import type { BillingUsage } from '../provider.js';
|
|
3
4
|
import { type CappedHandoff } from './capped-handoff.js';
|
|
4
5
|
import { type Signal } from '../signal-block.js';
|
|
5
6
|
export type SubagentStatus = 'idle' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
@@ -31,6 +32,8 @@ export interface SubagentTrace {
|
|
|
31
32
|
outputTokens?: number;
|
|
32
33
|
cacheReadTokens?: number;
|
|
33
34
|
cacheCreationTokens?: number;
|
|
35
|
+
billing?: BillingUsage;
|
|
36
|
+
outcome?: 'failed' | 'cancelled';
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
export declare function createEmptyTrace(): SubagentTrace;
|
package/dist/agent/subagent.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { SUBAGENT_DEFAULT_IDLE_TIMEOUT_MS, SUBAGENT_DRAIN_TIMEOUT_MS, resolveSub
|
|
|
13
13
|
export type { ForkParent, ForkSubagentOptions, SubagentManagerOptions };
|
|
14
14
|
export declare class SubagentManager {
|
|
15
15
|
private readonly active;
|
|
16
|
+
private readonly pendingChildBillingStreams;
|
|
16
17
|
readonly completed: CompletedCache;
|
|
17
18
|
private readonly parentCanUseTool;
|
|
18
19
|
private readonly hookRegistry;
|
|
@@ -54,6 +55,8 @@ export declare class SubagentManager {
|
|
|
54
55
|
kill(id: string): Promise<boolean>;
|
|
55
56
|
killAll(): Promise<void>;
|
|
56
57
|
getPendingChildTerminalWrites(): readonly Promise<void>[];
|
|
58
|
+
getPendingChildBillingStreams(): readonly Promise<void>[];
|
|
59
|
+
private retainChildBillingStreams;
|
|
57
60
|
abortAllAndDrain(reason?: unknown, origin?: AbortOrigin, timeoutMs?: number, rearm?: boolean): Promise<{
|
|
58
61
|
drained: number;
|
|
59
62
|
timedOut: boolean;
|
|
@@ -8,6 +8,11 @@ import type { DetachableToolRegistry } from './detach-registry.js';
|
|
|
8
8
|
export declare class ComposeExecutor {
|
|
9
9
|
private readonly ctx;
|
|
10
10
|
private currentCwd;
|
|
11
|
+
private readonly billingManagers;
|
|
12
|
+
private readonly pendingBillingStreams;
|
|
13
|
+
getPendingChildBillingStreams(): readonly Promise<void>[];
|
|
14
|
+
private retainBillingStreams;
|
|
15
|
+
private teardownManager;
|
|
11
16
|
constructor(ctx: ComposeExecutorContext);
|
|
12
17
|
setCwd(cwd: string): void;
|
|
13
18
|
setTraceWriter(writer: TraceSink | undefined): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SessionCostSource = 'closures+seal' | 'closures' | 'seal' | 'none';
|
|
1
|
+
export type SessionCostSource = 'closures+seal' | 'closures' | 'closures-incomplete' | 'seal' | 'none';
|
|
2
2
|
export interface CostTokens {
|
|
3
3
|
input?: number;
|
|
4
4
|
output?: number;
|
|
@@ -24,7 +24,9 @@ export declare class SessionCostAccumulator {
|
|
|
24
24
|
private readonly tokens;
|
|
25
25
|
private sealRoot;
|
|
26
26
|
private sealSubagent;
|
|
27
|
+
private sealIncomplete;
|
|
27
28
|
add(event: CostEventLike): void;
|
|
28
29
|
result(): SessionCostBreakdown;
|
|
30
|
+
private tokenTotals;
|
|
29
31
|
}
|
|
30
32
|
export declare function computeSessionCost(events: Iterable<CostEventLike>): SessionCostBreakdown;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BillingCountersSchema: z.ZodObject<{
|
|
3
|
+
uncachedInput: z.ZodNumber;
|
|
4
|
+
cacheRead: z.ZodNumber;
|
|
5
|
+
cacheWrite: z.ZodNumber;
|
|
6
|
+
output: z.ZodNumber;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const BillingRollupSchema: z.ZodObject<{
|
|
9
|
+
total: z.ZodObject<{
|
|
10
|
+
uncachedInput: z.ZodNumber;
|
|
11
|
+
cacheRead: z.ZodNumber;
|
|
12
|
+
cacheWrite: z.ZodNumber;
|
|
13
|
+
output: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
16
|
+
uncachedInput: z.ZodNumber;
|
|
17
|
+
cacheRead: z.ZodNumber;
|
|
18
|
+
cacheWrite: z.ZodNumber;
|
|
19
|
+
output: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const SessionBillingSchema: z.ZodObject<{
|
|
23
|
+
root: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
total: z.ZodObject<{
|
|
25
|
+
uncachedInput: z.ZodNumber;
|
|
26
|
+
cacheRead: z.ZodNumber;
|
|
27
|
+
cacheWrite: z.ZodNumber;
|
|
28
|
+
output: z.ZodNumber;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
31
|
+
uncachedInput: z.ZodNumber;
|
|
32
|
+
cacheRead: z.ZodNumber;
|
|
33
|
+
cacheWrite: z.ZodNumber;
|
|
34
|
+
output: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
subagents: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
total: z.ZodObject<{
|
|
39
|
+
uncachedInput: z.ZodNumber;
|
|
40
|
+
cacheRead: z.ZodNumber;
|
|
41
|
+
cacheWrite: z.ZodNumber;
|
|
42
|
+
output: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
45
|
+
uncachedInput: z.ZodNumber;
|
|
46
|
+
cacheRead: z.ZodNumber;
|
|
47
|
+
cacheWrite: z.ZodNumber;
|
|
48
|
+
output: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export declare const BillingLifecycleShape: {
|
|
53
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
54
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
uncachedInput: z.ZodNumber;
|
|
56
|
+
cacheRead: z.ZodNumber;
|
|
57
|
+
cacheWrite: z.ZodNumber;
|
|
58
|
+
output: z.ZodNumber;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
};
|
|
61
|
+
export type BillingCounters = z.infer<typeof BillingCountersSchema>;
|
|
62
|
+
export type BillingRollupSnapshot = z.infer<typeof BillingRollupSchema>;
|
|
63
|
+
export interface SubagentBillingFields {
|
|
64
|
+
provider?: string;
|
|
65
|
+
tokens?: BillingCounters;
|
|
66
|
+
}
|
|
@@ -65,8 +65,8 @@ export declare const BrowserEventPayloadSchema: z.ZodObject<{
|
|
|
65
65
|
urlBefore: z.ZodNullable<z.ZodString>;
|
|
66
66
|
urlAfter: z.ZodNullable<z.ZodString>;
|
|
67
67
|
status: z.ZodEnum<{
|
|
68
|
-
ok: "ok";
|
|
69
68
|
error: "error";
|
|
69
|
+
ok: "ok";
|
|
70
70
|
ambiguous_target: "ambiguous_target";
|
|
71
71
|
blocked_by_policy: "blocked_by_policy";
|
|
72
72
|
}>;
|
|
@@ -25,8 +25,8 @@ export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
|
|
|
25
25
|
incompleteReason: z.ZodOptional<z.ZodString>;
|
|
26
26
|
circuitBreaker: z.ZodOptional<z.ZodBoolean>;
|
|
27
27
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
28
|
-
budget: "budget";
|
|
29
28
|
abort: "abort";
|
|
29
|
+
budget: "budget";
|
|
30
30
|
"policy-refusal": "policy-refusal";
|
|
31
31
|
timeout: "timeout";
|
|
32
32
|
"permission-denied": "permission-denied";
|
|
@@ -62,8 +62,8 @@ export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
62
62
|
incompleteReason: z.ZodOptional<z.ZodString>;
|
|
63
63
|
circuitBreaker: z.ZodOptional<z.ZodBoolean>;
|
|
64
64
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
65
|
-
budget: "budget";
|
|
66
65
|
abort: "abort";
|
|
66
|
+
budget: "budget";
|
|
67
67
|
"policy-refusal": "policy-refusal";
|
|
68
68
|
timeout: "timeout";
|
|
69
69
|
"permission-denied": "permission-denied";
|
|
@@ -274,6 +274,36 @@ export declare const SessionSealedPayloadSchema: z.ZodObject<{
|
|
|
274
274
|
cacheCreation: z.ZodOptional<z.ZodNumber>;
|
|
275
275
|
}, z.core.$strip>>;
|
|
276
276
|
subagentCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
billing: z.ZodOptional<z.ZodObject<{
|
|
278
|
+
root: z.ZodOptional<z.ZodObject<{
|
|
279
|
+
total: z.ZodObject<{
|
|
280
|
+
uncachedInput: z.ZodNumber;
|
|
281
|
+
cacheRead: z.ZodNumber;
|
|
282
|
+
cacheWrite: z.ZodNumber;
|
|
283
|
+
output: z.ZodNumber;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
286
|
+
uncachedInput: z.ZodNumber;
|
|
287
|
+
cacheRead: z.ZodNumber;
|
|
288
|
+
cacheWrite: z.ZodNumber;
|
|
289
|
+
output: z.ZodNumber;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
}, z.core.$strip>>;
|
|
292
|
+
subagents: z.ZodOptional<z.ZodObject<{
|
|
293
|
+
total: z.ZodObject<{
|
|
294
|
+
uncachedInput: z.ZodNumber;
|
|
295
|
+
cacheRead: z.ZodNumber;
|
|
296
|
+
cacheWrite: z.ZodNumber;
|
|
297
|
+
output: z.ZodNumber;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
300
|
+
uncachedInput: z.ZodNumber;
|
|
301
|
+
cacheRead: z.ZodNumber;
|
|
302
|
+
cacheWrite: z.ZodNumber;
|
|
303
|
+
output: z.ZodNumber;
|
|
304
|
+
}, z.core.$strip>>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
}, z.core.$strip>>;
|
|
277
307
|
}, z.core.$strip>;
|
|
278
308
|
export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
279
309
|
kind: z.ZodLiteral<"tool_call">;
|
|
@@ -297,8 +327,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
297
327
|
incompleteReason: z.ZodOptional<z.ZodString>;
|
|
298
328
|
circuitBreaker: z.ZodOptional<z.ZodBoolean>;
|
|
299
329
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
300
|
-
budget: "budget";
|
|
301
330
|
abort: "abort";
|
|
331
|
+
budget: "budget";
|
|
302
332
|
"policy-refusal": "policy-refusal";
|
|
303
333
|
timeout: "timeout";
|
|
304
334
|
"permission-denied": "permission-denied";
|
|
@@ -366,6 +396,13 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
366
396
|
resolvedAgentType: z.ZodOptional<z.ZodString>;
|
|
367
397
|
maxToolUseIterations: z.ZodOptional<z.ZodNumber>;
|
|
368
398
|
}, z.core.$strip>, z.ZodObject<{
|
|
399
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
400
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
401
|
+
uncachedInput: z.ZodNumber;
|
|
402
|
+
cacheRead: z.ZodNumber;
|
|
403
|
+
cacheWrite: z.ZodNumber;
|
|
404
|
+
output: z.ZodNumber;
|
|
405
|
+
}, z.core.$strip>>;
|
|
369
406
|
transition: z.ZodLiteral<"succeeded">;
|
|
370
407
|
subagentId: z.ZodString;
|
|
371
408
|
durationMs: z.ZodNumber;
|
|
@@ -374,14 +411,21 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
374
411
|
outputBytes: z.ZodNumber;
|
|
375
412
|
stopReason: z.ZodOptional<z.ZodString>;
|
|
376
413
|
}, z.core.$strip>, z.ZodObject<{
|
|
414
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
415
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
416
|
+
uncachedInput: z.ZodNumber;
|
|
417
|
+
cacheRead: z.ZodNumber;
|
|
418
|
+
cacheWrite: z.ZodNumber;
|
|
419
|
+
output: z.ZodNumber;
|
|
420
|
+
}, z.core.$strip>>;
|
|
377
421
|
transition: z.ZodLiteral<"failed">;
|
|
378
422
|
subagentId: z.ZodString;
|
|
379
423
|
errorClass: z.ZodString;
|
|
380
424
|
errorMessage: z.ZodString;
|
|
381
425
|
partialOutputBytes: z.ZodNumber;
|
|
382
426
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
383
|
-
budget: "budget";
|
|
384
427
|
abort: "abort";
|
|
428
|
+
budget: "budget";
|
|
385
429
|
"policy-refusal": "policy-refusal";
|
|
386
430
|
timeout: "timeout";
|
|
387
431
|
"permission-denied": "permission-denied";
|
|
@@ -393,6 +437,13 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
393
437
|
"hook-block-repeat": "hook-block-repeat";
|
|
394
438
|
}>>;
|
|
395
439
|
}, z.core.$strip>, z.ZodObject<{
|
|
440
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
441
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
442
|
+
uncachedInput: z.ZodNumber;
|
|
443
|
+
cacheRead: z.ZodNumber;
|
|
444
|
+
cacheWrite: z.ZodNumber;
|
|
445
|
+
output: z.ZodNumber;
|
|
446
|
+
}, z.core.$strip>>;
|
|
396
447
|
transition: z.ZodLiteral<"cancelled">;
|
|
397
448
|
subagentId: z.ZodString;
|
|
398
449
|
source: z.ZodEnum<{
|
|
@@ -565,8 +616,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
565
616
|
urlBefore: z.ZodNullable<z.ZodString>;
|
|
566
617
|
urlAfter: z.ZodNullable<z.ZodString>;
|
|
567
618
|
status: z.ZodEnum<{
|
|
568
|
-
ok: "ok";
|
|
569
619
|
error: "error";
|
|
620
|
+
ok: "ok";
|
|
570
621
|
ambiguous_target: "ambiguous_target";
|
|
571
622
|
blocked_by_policy: "blocked_by_policy";
|
|
572
623
|
}>;
|
|
@@ -702,8 +753,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
702
753
|
incompleteReason: z.ZodOptional<z.ZodString>;
|
|
703
754
|
circuitBreaker: z.ZodOptional<z.ZodBoolean>;
|
|
704
755
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
705
|
-
budget: "budget";
|
|
706
756
|
abort: "abort";
|
|
757
|
+
budget: "budget";
|
|
707
758
|
"policy-refusal": "policy-refusal";
|
|
708
759
|
timeout: "timeout";
|
|
709
760
|
"permission-denied": "permission-denied";
|
|
@@ -777,6 +828,13 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
777
828
|
resolvedAgentType: z.ZodOptional<z.ZodString>;
|
|
778
829
|
maxToolUseIterations: z.ZodOptional<z.ZodNumber>;
|
|
779
830
|
}, z.core.$strip>, z.ZodObject<{
|
|
831
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
832
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
833
|
+
uncachedInput: z.ZodNumber;
|
|
834
|
+
cacheRead: z.ZodNumber;
|
|
835
|
+
cacheWrite: z.ZodNumber;
|
|
836
|
+
output: z.ZodNumber;
|
|
837
|
+
}, z.core.$strip>>;
|
|
780
838
|
transition: z.ZodLiteral<"succeeded">;
|
|
781
839
|
subagentId: z.ZodString;
|
|
782
840
|
durationMs: z.ZodNumber;
|
|
@@ -785,14 +843,21 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
785
843
|
outputBytes: z.ZodNumber;
|
|
786
844
|
stopReason: z.ZodOptional<z.ZodString>;
|
|
787
845
|
}, z.core.$strip>, z.ZodObject<{
|
|
846
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
847
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
848
|
+
uncachedInput: z.ZodNumber;
|
|
849
|
+
cacheRead: z.ZodNumber;
|
|
850
|
+
cacheWrite: z.ZodNumber;
|
|
851
|
+
output: z.ZodNumber;
|
|
852
|
+
}, z.core.$strip>>;
|
|
788
853
|
transition: z.ZodLiteral<"failed">;
|
|
789
854
|
subagentId: z.ZodString;
|
|
790
855
|
errorClass: z.ZodString;
|
|
791
856
|
errorMessage: z.ZodString;
|
|
792
857
|
partialOutputBytes: z.ZodNumber;
|
|
793
858
|
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
794
|
-
budget: "budget";
|
|
795
859
|
abort: "abort";
|
|
860
|
+
budget: "budget";
|
|
796
861
|
"policy-refusal": "policy-refusal";
|
|
797
862
|
timeout: "timeout";
|
|
798
863
|
"permission-denied": "permission-denied";
|
|
@@ -804,6 +869,13 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
804
869
|
"hook-block-repeat": "hook-block-repeat";
|
|
805
870
|
}>>;
|
|
806
871
|
}, z.core.$strip>, z.ZodObject<{
|
|
872
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
873
|
+
tokens: z.ZodOptional<z.ZodObject<{
|
|
874
|
+
uncachedInput: z.ZodNumber;
|
|
875
|
+
cacheRead: z.ZodNumber;
|
|
876
|
+
cacheWrite: z.ZodNumber;
|
|
877
|
+
output: z.ZodNumber;
|
|
878
|
+
}, z.core.$strip>>;
|
|
807
879
|
transition: z.ZodLiteral<"cancelled">;
|
|
808
880
|
subagentId: z.ZodString;
|
|
809
881
|
source: z.ZodEnum<{
|
|
@@ -994,8 +1066,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
994
1066
|
urlBefore: z.ZodNullable<z.ZodString>;
|
|
995
1067
|
urlAfter: z.ZodNullable<z.ZodString>;
|
|
996
1068
|
status: z.ZodEnum<{
|
|
997
|
-
ok: "ok";
|
|
998
1069
|
error: "error";
|
|
1070
|
+
ok: "ok";
|
|
999
1071
|
ambiguous_target: "ambiguous_target";
|
|
1000
1072
|
blocked_by_policy: "blocked_by_policy";
|
|
1001
1073
|
}>;
|
|
@@ -1134,5 +1206,35 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1134
1206
|
cacheCreation: z.ZodOptional<z.ZodNumber>;
|
|
1135
1207
|
}, z.core.$strip>>;
|
|
1136
1208
|
subagentCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
1209
|
+
billing: z.ZodOptional<z.ZodObject<{
|
|
1210
|
+
root: z.ZodOptional<z.ZodObject<{
|
|
1211
|
+
total: z.ZodObject<{
|
|
1212
|
+
uncachedInput: z.ZodNumber;
|
|
1213
|
+
cacheRead: z.ZodNumber;
|
|
1214
|
+
cacheWrite: z.ZodNumber;
|
|
1215
|
+
output: z.ZodNumber;
|
|
1216
|
+
}, z.core.$strip>;
|
|
1217
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1218
|
+
uncachedInput: z.ZodNumber;
|
|
1219
|
+
cacheRead: z.ZodNumber;
|
|
1220
|
+
cacheWrite: z.ZodNumber;
|
|
1221
|
+
output: z.ZodNumber;
|
|
1222
|
+
}, z.core.$strip>>;
|
|
1223
|
+
}, z.core.$strip>>;
|
|
1224
|
+
subagents: z.ZodOptional<z.ZodObject<{
|
|
1225
|
+
total: z.ZodObject<{
|
|
1226
|
+
uncachedInput: z.ZodNumber;
|
|
1227
|
+
cacheRead: z.ZodNumber;
|
|
1228
|
+
cacheWrite: z.ZodNumber;
|
|
1229
|
+
output: z.ZodNumber;
|
|
1230
|
+
}, z.core.$strip>;
|
|
1231
|
+
byProvider: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1232
|
+
uncachedInput: z.ZodNumber;
|
|
1233
|
+
cacheRead: z.ZodNumber;
|
|
1234
|
+
cacheWrite: z.ZodNumber;
|
|
1235
|
+
output: z.ZodNumber;
|
|
1236
|
+
}, z.core.$strip>>;
|
|
1237
|
+
}, z.core.$strip>>;
|
|
1238
|
+
}, z.core.$strip>>;
|
|
1137
1239
|
}, z.core.$strip>;
|
|
1138
1240
|
}, z.core.$strip>], "kind">;
|