@sentry/junior 0.96.0 → 0.97.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/dist/{agent-hooks-5URSMY3O.js → agent-hooks-XSUIVRQS.js} +8 -6
- package/dist/{reporting → api}/conversations/activity.d.ts +1 -1
- package/dist/api/conversations/detail-projection.d.ts +10 -0
- package/dist/api/conversations/detail.d.ts +3 -0
- package/dist/api/conversations/detail.query.d.ts +3 -0
- package/dist/api/conversations/list.d.ts +3 -0
- package/dist/api/conversations/list.query.d.ts +94 -0
- package/dist/api/conversations/projection.d.ts +14 -0
- package/dist/api/conversations/schema.d.ts +683 -0
- package/dist/{reporting → api}/conversations/shared.d.ts +1 -5
- package/dist/api/conversations/stats.d.ts +3 -0
- package/dist/api/conversations/stats.query.d.ts +3 -0
- package/dist/api/conversations/subagent.d.ts +3 -0
- package/dist/{reporting → api}/conversations/transcript.d.ts +4 -4
- package/dist/api/people/list.d.ts +1 -2
- package/dist/api/people/list.query.d.ts +3 -4
- package/dist/api/people/profile.d.ts +1 -2
- package/dist/api/people/profile.query.d.ts +3 -4
- package/dist/api/people/schema.d.ts +193 -0
- package/dist/api/people/shared.d.ts +31 -9
- package/dist/api/schema.d.ts +20 -0
- package/dist/api/schema.js +50 -0
- package/dist/api-reference.d.ts +4 -3
- package/dist/api.d.ts +3 -0
- package/dist/api.js +156 -0
- package/dist/app.d.ts +1 -4
- package/dist/app.js +100 -366
- package/dist/build/virtual-config.d.ts +2 -2
- package/dist/{catalog-runtime-MSMAYYIK.js → catalog-runtime-PFHVMHDR.js} +3 -2
- package/dist/chat/agent/resume.d.ts +3 -1
- package/dist/chat/agent/tools.d.ts +2 -1
- package/dist/chat/config.d.ts +1 -8
- package/dist/chat/conversations/history.d.ts +241 -27
- package/dist/chat/conversations/legacy-advisor-session.d.ts +7 -0
- package/dist/chat/conversations/legacy-import.d.ts +2 -2
- package/dist/chat/conversations/projection.d.ts +19 -3
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +1 -1
- package/dist/chat/conversations/sql/store.d.ts +15 -9
- package/dist/chat/conversations/store.d.ts +9 -4
- package/dist/chat/model-profile.d.ts +14 -0
- package/dist/chat/pi/transcript.d.ts +5 -3
- package/dist/chat/resource-events/store.d.ts +2 -2
- package/dist/chat/services/context-compaction.d.ts +15 -0
- package/dist/chat/services/turn-result.d.ts +1 -0
- package/dist/chat/services/turn-session-record.d.ts +6 -6
- package/dist/chat/state/turn-session.d.ts +16 -5
- package/dist/chat/task-execution/store.d.ts +2 -2
- package/dist/chat/tools/handoff/tool.d.ts +45 -0
- package/dist/chat/tools/types.d.ts +7 -2
- package/dist/chat/usage.d.ts +25 -25
- package/dist/{chunk-RITD7E5L.js → chunk-35BNLDOJ.js} +338 -577
- package/dist/{chunk-PMNN6ST4.js → chunk-3ECW2K2O.js} +7 -2
- package/dist/{chunk-5C6XTTFI.js → chunk-3F4OPKGF.js} +89 -55
- package/dist/chunk-3V7OFJZC.js +264 -0
- package/dist/chunk-4ZNGQH7C.js +25 -0
- package/dist/{chunk-S5KZ5LPG.js → chunk-5HLDPVYS.js} +14 -447
- package/dist/{chunk-DZENG5ML.js → chunk-6U26PYI5.js} +24 -14
- package/dist/chunk-AUUCAFDE.js +546 -0
- package/dist/{chunk-6APU57E6.js → chunk-B3IT5END.js} +41 -260
- package/dist/chunk-CEA3A3UA.js +86 -0
- package/dist/{chunk-YDT7SNCN.js → chunk-D5KZYS4T.js} +1 -1
- package/dist/{chunk-YDVEH3SB.js → chunk-EEZCY5WX.js} +78 -28
- package/dist/{chunk-2NAZZPPS.js → chunk-EOWXRY5E.js} +1 -1
- package/dist/{chunk-GQ3GK22G.js → chunk-FBHZJFHI.js} +2 -2
- package/dist/{chunk-CZEX6KIQ.js → chunk-G3E7SCME.js} +0 -23
- package/dist/chunk-GUAP3H7O.js +319 -0
- package/dist/{chunk-BYZWPRJA.js → chunk-H66UCBPW.js} +6 -4
- package/dist/{chunk-L7CDEIVJ.js → chunk-LMJPRYHP.js} +4 -2
- package/dist/chunk-LUAE4MGW.js +199 -0
- package/dist/{chunk-GY34VGP5.js → chunk-LVA4I4H7.js} +3 -1
- package/dist/chunk-LVUKF5CE.js +63 -0
- package/dist/{chunk-AAZXTVJT.js → chunk-NG2AV7IB.js} +2 -72
- package/dist/chunk-ON6YKIQ7.js +260 -0
- package/dist/chunk-PDO5BLNM.js +22 -0
- package/dist/chunk-QNVHH5PU.js +20 -0
- package/dist/{chunk-P3YFQLEN.js → chunk-T533JLM3.js} +8 -10
- package/dist/chunk-UAMKJPDF.js +11 -0
- package/dist/chunk-VFH4ZKZT.js +66 -0
- package/dist/{chunk-UKHVMPX5.js → chunk-WGXMTFNU.js} +15 -17
- package/dist/{chunk-MNTINMWR.js → chunk-WJOSZOON.js} +184 -300
- package/dist/chunk-WTYEKPXU.js +451 -0
- package/dist/{chunk-IYM2SIVG.js → chunk-XIRPQQVE.js} +605 -363
- package/dist/cli/chat.js +24 -21
- package/dist/cli/check.js +4 -3
- package/dist/cli/init.js +12 -0
- package/dist/cli/plugins.js +12 -9
- package/dist/cli/snapshot-warmup.js +8 -6
- package/dist/cli/upgrade.js +265 -137
- package/dist/db/db.d.ts +4 -0
- package/dist/db/schema/conversations.d.ts +128 -0
- package/dist/db/schema.d.ts +129 -60
- package/dist/{db-2D6RMG67.js → db-BWXYIKFQ.js} +3 -3
- package/dist/detail-GA6NXWQJ.js +43 -0
- package/dist/discovery-RMHYSRL7.js +43 -0
- package/dist/handlers/health.d.ts +3 -0
- package/dist/instrumentation.js +1 -1
- package/dist/{legacy-import-VZ2MEGP7.js → legacy-import-3NQJVGQL.js} +4 -4
- package/dist/{api/people/list.js → list-A3WFRIYX.js} +26 -16
- package/dist/list-UXJI5Q5X.js +27 -0
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -1
- package/dist/plugin-conversations-DDNGC35A.js +36 -0
- package/dist/{api/people/profile.js → profile-4RYDXWTF.js} +33 -18
- package/dist/reporting/plugin-conversations.d.ts +3 -0
- package/dist/reporting-schema.d.ts +140 -0
- package/dist/reporting.d.ts +12 -81
- package/dist/{runner-JZBRQP4F.js → runner-JALSYH2P.js} +17 -12
- package/dist/skills-MAZXZ2KE.js +26 -0
- package/dist/stats-XKXH3PTY.js +217 -0
- package/dist/subagent-TZ55XY37.js +48 -0
- package/dist/usage-schema.d.ts +25 -0
- package/dist/{validation-6XOOQGME.js → validation-FMEAEKCY.js} +4 -3
- package/migrations/0000_initial.sql +115 -0
- package/migrations/0001_conversation_metrics.sql +4 -0
- package/migrations/README.md +12 -30
- package/migrations/meta/0000_snapshot.json +1 -33
- package/migrations/meta/0001_snapshot.json +972 -0
- package/migrations/meta/_journal.json +9 -2
- package/package.json +14 -18
- package/dist/api/people/types.d.ts +0 -85
- package/dist/chat/advisor-request.d.ts +0 -4
- package/dist/chat/conversations/sql/migrations.d.ts +0 -22
- package/dist/chat/tools/advisor/session-store.d.ts +0 -9
- package/dist/chat/tools/advisor/tool.d.ts +0 -72
- package/dist/chunk-RAIB6WSG.js +0 -142
- package/dist/chunk-WM6KHPBQ.js +0 -48
- package/dist/db/schema/migrations.d.ts +0 -58
- package/dist/reporting/conversations/context.d.ts +0 -8
- package/dist/reporting/conversations/details.d.ts +0 -6
- package/dist/reporting/conversations/index.d.ts +0 -4
- package/dist/reporting/conversations/statistics.d.ts +0 -4
- package/dist/reporting/conversations/summaries.d.ts +0 -20
- package/dist/reporting/conversations/types.d.ts +0 -191
- package/dist/reporting/conversations.d.ts +0 -1
- package/dist/reporting.js +0 -1155
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { completeText } from "@/chat/pi/client";
|
|
2
2
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
3
|
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
4
|
+
import { type ModelProfile } from "@/chat/model-profile";
|
|
4
5
|
export interface ContextCompactorDeps {
|
|
5
6
|
completeText: typeof completeText;
|
|
6
7
|
autoCompactionTriggerTokens?: number;
|
|
@@ -26,7 +27,21 @@ export interface CompactContextResult {
|
|
|
26
27
|
piMessages?: PiMessage[];
|
|
27
28
|
reason?: "below_threshold" | "missing_context" | "summary_failed";
|
|
28
29
|
}
|
|
30
|
+
interface HandoffContextArgs {
|
|
31
|
+
conversationContext?: string;
|
|
32
|
+
conversationId: string;
|
|
33
|
+
metadata?: CompactContextArgs["metadata"];
|
|
34
|
+
piMessages: PiMessage[];
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
target: {
|
|
37
|
+
modelId: string;
|
|
38
|
+
modelProfile: ModelProfile;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
29
41
|
/** Build retained user messages for a compacted Pi replacement history. */
|
|
30
42
|
export declare function selectRetainedUserMessages(messages: PiMessage[], maxTokens?: number): PiMessage[];
|
|
31
43
|
/** Build the service that owns local context compaction. */
|
|
32
44
|
export declare function createContextCompactor(deps: ContextCompactorDeps): ContextCompactor;
|
|
45
|
+
/** Compact the active conversation and durably bind its selected handoff profile. */
|
|
46
|
+
export declare function compactContextForHandoff(args: HandoffContextArgs, deps: Pick<ContextCompactorDeps, "completeText">): Promise<PiMessage[]>;
|
|
47
|
+
export {};
|
|
@@ -50,6 +50,7 @@ export interface TurnResultInput {
|
|
|
50
50
|
runId?: string;
|
|
51
51
|
};
|
|
52
52
|
assistantUserName?: string;
|
|
53
|
+
modelId: string;
|
|
53
54
|
}
|
|
54
55
|
/** Process raw agent messages into a structured AgentRunResult. */
|
|
55
56
|
export declare function buildTurnResult(input: TurnResultInput): AgentRunResult;
|
|
@@ -21,7 +21,6 @@ interface SessionRecordLogContext {
|
|
|
21
21
|
channelId?: string;
|
|
22
22
|
runId?: string;
|
|
23
23
|
assistantUserName?: string;
|
|
24
|
-
modelId: string;
|
|
25
24
|
}
|
|
26
25
|
/** Load turn session record state for a conversation/session pair. */
|
|
27
26
|
export declare function loadTurnSessionRecord(ctx: TurnSessionContext): Promise<TurnSessionState>;
|
|
@@ -38,7 +37,7 @@ export declare function persistRunningSessionRecord(args: {
|
|
|
38
37
|
trailingMessageProvenance?: PiMessageProvenance[];
|
|
39
38
|
loadedSkillNames?: string[];
|
|
40
39
|
logContext: SessionRecordLogContext;
|
|
41
|
-
modelId
|
|
40
|
+
modelId: string;
|
|
42
41
|
actor?: Actor;
|
|
43
42
|
reasoningLevel?: string;
|
|
44
43
|
surface?: AgentTurnSurface;
|
|
@@ -68,7 +67,7 @@ export declare function persistCompletedSessionRecord(args: {
|
|
|
68
67
|
allMessages: PiMessage[];
|
|
69
68
|
loadedSkillNames?: string[];
|
|
70
69
|
logContext: SessionRecordLogContext;
|
|
71
|
-
modelId
|
|
70
|
+
modelId: string;
|
|
72
71
|
actor?: Actor;
|
|
73
72
|
reasoningLevel?: string;
|
|
74
73
|
surface?: AgentTurnSurface;
|
|
@@ -84,6 +83,7 @@ export declare function completeDeliveredTurn(args: {
|
|
|
84
83
|
loadedSkillNames?: string[];
|
|
85
84
|
logContext: SessionRecordLogContext;
|
|
86
85
|
messages: PiMessage[];
|
|
86
|
+
modelId: string;
|
|
87
87
|
actor?: Actor;
|
|
88
88
|
reasoningLevel?: string;
|
|
89
89
|
sessionId: string;
|
|
@@ -108,7 +108,7 @@ export declare function persistAuthPauseSessionRecord(args: {
|
|
|
108
108
|
source?: Source;
|
|
109
109
|
messages: PiMessage[];
|
|
110
110
|
loadedSkillNames?: string[];
|
|
111
|
-
modelId
|
|
111
|
+
modelId: string;
|
|
112
112
|
errorMessage: string;
|
|
113
113
|
logContext: SessionRecordLogContext;
|
|
114
114
|
actor?: Actor;
|
|
@@ -130,7 +130,7 @@ export declare function persistTimeoutSessionRecord(args: {
|
|
|
130
130
|
source?: Source;
|
|
131
131
|
messages: PiMessage[];
|
|
132
132
|
loadedSkillNames?: string[];
|
|
133
|
-
modelId
|
|
133
|
+
modelId: string;
|
|
134
134
|
errorMessage: string;
|
|
135
135
|
logContext: SessionRecordLogContext;
|
|
136
136
|
actor?: Actor;
|
|
@@ -151,7 +151,7 @@ export declare function persistYieldSessionRecord(args: {
|
|
|
151
151
|
source?: Source;
|
|
152
152
|
messages: PiMessage[];
|
|
153
153
|
loadedSkillNames?: string[];
|
|
154
|
-
modelId
|
|
154
|
+
modelId: string;
|
|
155
155
|
errorMessage: string;
|
|
156
156
|
logContext: SessionRecordLogContext;
|
|
157
157
|
actor?: Actor;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn session records.
|
|
3
|
+
*
|
|
4
|
+
* These records track one user request across auth pauses, timeout slices, and
|
|
5
|
+
* completion. Full Pi messages live in the durable agent step store; this
|
|
6
|
+
* record stores resumability metadata and a committed `seq` cursor into
|
|
7
|
+
* `junior_agent_steps` so resumes can materialize the exact continuable
|
|
8
|
+
* boundary without duplicating the step history.
|
|
9
|
+
*/
|
|
10
|
+
import { type StateAdapter } from "chat";
|
|
1
11
|
import { type Destination, type Source } from "@sentry/junior-plugin-api";
|
|
2
12
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
13
|
import { type Actor } from "@/chat/actor";
|
|
@@ -26,9 +36,9 @@ export interface AgentTurnSessionRecord {
|
|
|
26
36
|
piMessageProvenance: PiMessageProvenance[];
|
|
27
37
|
/**
|
|
28
38
|
* All distinct actors annotated on this run's committed instruction-authority
|
|
29
|
-
* messages, in first-seen order.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
39
|
+
* messages, in first-seen order. Persisted as an attribution handle so a
|
|
40
|
+
* summary-only handoff cannot erase them. It never grants authority or
|
|
41
|
+
* replaces the singular execution actor.
|
|
32
42
|
*/
|
|
33
43
|
actors: Actor[];
|
|
34
44
|
/** The single actor this run executes as (credential binding, auth flows). */
|
|
@@ -59,7 +69,7 @@ export declare function upsertAgentTurnSessionRecord(args: {
|
|
|
59
69
|
source?: Source;
|
|
60
70
|
lastProgressAtMs?: number;
|
|
61
71
|
loadedSkillNames?: string[];
|
|
62
|
-
modelId
|
|
72
|
+
modelId: string;
|
|
63
73
|
conversationStore?: ConversationStore;
|
|
64
74
|
sessionId: string;
|
|
65
75
|
sliceId: number;
|
|
@@ -69,6 +79,7 @@ export declare function upsertAgentTurnSessionRecord(args: {
|
|
|
69
79
|
/** Provenance for trailing newly committed messages, such as steering. */
|
|
70
80
|
trailingMessageProvenance?: PiMessageProvenance[];
|
|
71
81
|
actor?: Actor;
|
|
82
|
+
actors?: Actor[];
|
|
72
83
|
resumeReason?: AgentTurnResumeReason;
|
|
73
84
|
reasoningLevel?: string;
|
|
74
85
|
errorMessage?: string;
|
|
@@ -111,7 +122,7 @@ export declare function listAgentTurnSessionSummaries(limit?: number): Promise<A
|
|
|
111
122
|
/** List turn-session summaries for one conversation without the global feed cap. */
|
|
112
123
|
export declare function listAgentTurnSessionSummariesForConversation(conversationId: string): Promise<AgentTurnSessionSummary[]>;
|
|
113
124
|
/** Read complete per-conversation summary indexes with bounded backend load. */
|
|
114
|
-
export declare function listAgentTurnSessionSummariesForConversations(conversationIds: string[]): Promise<Map<string, AgentTurnSessionSummary[]>>;
|
|
125
|
+
export declare function listAgentTurnSessionSummariesForConversations(stateAdapter: StateAdapter, conversationIds: string[]): Promise<Map<string, AgentTurnSessionSummary[]>>;
|
|
115
126
|
/** Mark an unfinished turn session record as abandoned when a newer turn wins. */
|
|
116
127
|
export declare function abandonAgentTurnSessionRecord(args: {
|
|
117
128
|
conversationId: string;
|
|
@@ -128,7 +128,7 @@ export declare function completeConversationWork(args: {
|
|
|
128
128
|
conversationStore?: ConversationStore;
|
|
129
129
|
nowMs?: number;
|
|
130
130
|
state?: StateAdapter;
|
|
131
|
-
}): Promise<"
|
|
131
|
+
}): Promise<"completed" | "pending" | "lost_lease">;
|
|
132
132
|
/** Record one failed delivery attempt and dead-letter messages at their limit. */
|
|
133
133
|
export declare function recordAttemptFailure(args: {
|
|
134
134
|
conversationId: string;
|
|
@@ -145,7 +145,7 @@ export declare function deadLetterAttempt(args: {
|
|
|
145
145
|
conversationStore?: ConversationStore;
|
|
146
146
|
nowMs?: number;
|
|
147
147
|
state?: StateAdapter;
|
|
148
|
-
}): Promise<"
|
|
148
|
+
}): Promise<"failed" | "pending" | "lost_lease">;
|
|
149
149
|
/** Clear an expired durable lease so a later worker can resume safely. */
|
|
150
150
|
export declare function clearExpiredConversationLease(args: {
|
|
151
151
|
conversationId: string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
2
|
+
export declare const HANDOFF_TOOL_NAME = "handoff";
|
|
3
|
+
/** Create the terminal standard-agent control for an in-place model upgrade. */
|
|
4
|
+
export declare function createHandoffTool(handoff: NonNullable<ToolRuntimeContext["handoff"]>): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
5
|
+
inputSchema: import("../definition").JsonSchemaObject;
|
|
6
|
+
outputSchema: import("../definition").JsonSchemaObject;
|
|
7
|
+
prepareArguments(args: unknown): {
|
|
8
|
+
profile?: string | null | undefined;
|
|
9
|
+
};
|
|
10
|
+
execute?: ((input: unknown, options: import("../definition").ToolExecuteOptions) => {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
status: "error" | "success";
|
|
14
|
+
model_profile: string;
|
|
15
|
+
target?: string | undefined;
|
|
16
|
+
data?: unknown;
|
|
17
|
+
truncated?: boolean | undefined;
|
|
18
|
+
continuation?: {
|
|
19
|
+
arguments: Record<string, unknown>;
|
|
20
|
+
reason?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
error?: string | {
|
|
23
|
+
kind: string;
|
|
24
|
+
message: string;
|
|
25
|
+
retryable?: boolean | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
} | Promise<{
|
|
28
|
+
[x: string]: unknown;
|
|
29
|
+
ok: boolean;
|
|
30
|
+
status: "error" | "success";
|
|
31
|
+
model_profile: string;
|
|
32
|
+
target?: string | undefined;
|
|
33
|
+
data?: unknown;
|
|
34
|
+
truncated?: boolean | undefined;
|
|
35
|
+
continuation?: {
|
|
36
|
+
arguments: Record<string, unknown>;
|
|
37
|
+
reason?: string | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
error?: string | {
|
|
40
|
+
kind: string;
|
|
41
|
+
message: string;
|
|
42
|
+
retryable?: boolean | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}>) | undefined;
|
|
45
|
+
};
|
|
@@ -6,9 +6,14 @@ import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
|
6
6
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
7
7
|
import type { Skill } from "@/chat/skills";
|
|
8
8
|
import type { LoadSkillMetadata } from "@/chat/tools/skill/load-skill";
|
|
9
|
-
import type { AdvisorToolRuntimeContext } from "@/chat/tools/advisor/tool";
|
|
10
9
|
import type { JuniorToolResult } from "@/chat/tool-support/structured-result";
|
|
11
10
|
import type { LocalActor, Actor, SlackActor } from "@/chat/actor";
|
|
11
|
+
import type { ModelProfile } from "@/chat/model-profile";
|
|
12
|
+
interface HandoffControl {
|
|
13
|
+
/** Non-empty catalog with the default target first. */
|
|
14
|
+
profiles: readonly [ModelProfile, ...ModelProfile[]];
|
|
15
|
+
execute: (profile: ModelProfile, signal?: AbortSignal) => Promise<void>;
|
|
16
|
+
}
|
|
12
17
|
export interface ImageGenerateToolDeps {
|
|
13
18
|
fetch?: typeof fetch;
|
|
14
19
|
}
|
|
@@ -46,7 +51,7 @@ export interface ToolHooks {
|
|
|
46
51
|
};
|
|
47
52
|
}
|
|
48
53
|
interface BaseToolRuntimeContext {
|
|
49
|
-
|
|
54
|
+
handoff?: HandoffControl;
|
|
50
55
|
/**
|
|
51
56
|
* Opaque Junior conversation/session identity for this turn.
|
|
52
57
|
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
package/dist/chat/usage.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const agentTurnCostSchema:
|
|
3
|
-
input:
|
|
4
|
-
output:
|
|
5
|
-
cacheRead:
|
|
6
|
-
cacheWrite:
|
|
7
|
-
total:
|
|
8
|
-
},
|
|
1
|
+
import type { Usage, UsageCost } from "@/usage-schema";
|
|
2
|
+
export declare const agentTurnCostSchema: import("zod").ZodObject<{
|
|
3
|
+
input: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
4
|
+
output: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
5
|
+
cacheRead: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
6
|
+
cacheWrite: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
7
|
+
total: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
8
|
+
}, import("zod/v4/core").$strict>;
|
|
9
9
|
/** Estimated USD cost reported by pi-ai for one or more model calls. */
|
|
10
|
-
export type AgentTurnCost =
|
|
11
|
-
export declare const agentTurnUsageSchema:
|
|
12
|
-
inputTokens:
|
|
13
|
-
outputTokens:
|
|
14
|
-
cachedInputTokens:
|
|
15
|
-
cacheCreationTokens:
|
|
16
|
-
reasoningTokens:
|
|
17
|
-
totalTokens:
|
|
18
|
-
cost:
|
|
19
|
-
input:
|
|
20
|
-
output:
|
|
21
|
-
cacheRead:
|
|
22
|
-
cacheWrite:
|
|
23
|
-
total:
|
|
24
|
-
},
|
|
25
|
-
},
|
|
10
|
+
export type AgentTurnCost = UsageCost;
|
|
11
|
+
export declare const agentTurnUsageSchema: import("zod").ZodObject<{
|
|
12
|
+
inputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
13
|
+
outputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
14
|
+
cachedInputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
15
|
+
cacheCreationTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
16
|
+
reasoningTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
17
|
+
totalTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
18
|
+
cost: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
19
|
+
input: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
20
|
+
output: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
21
|
+
cacheRead: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
22
|
+
cacheWrite: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
23
|
+
total: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
24
|
+
}, import("zod/v4/core").$strict>>;
|
|
25
|
+
}, import("zod/v4/core").$strict>;
|
|
26
26
|
/**
|
|
27
27
|
* Structured token and cost usage captured for a single agent turn.
|
|
28
28
|
*
|
|
@@ -31,7 +31,7 @@ export declare const agentTurnUsageSchema: z.ZodObject<{
|
|
|
31
31
|
* provider normalizes into the pi-ai shape as its own item. Renderers decide
|
|
32
32
|
* whether to display a breakdown or a single aggregate.
|
|
33
33
|
*/
|
|
34
|
-
export type AgentTurnUsage =
|
|
34
|
+
export type AgentTurnUsage = Usage;
|
|
35
35
|
/** Return whether any token counter is present on a usage record. */
|
|
36
36
|
export declare function hasAgentTurnUsage(usage: AgentTurnUsage | undefined): usage is AgentTurnUsage;
|
|
37
37
|
/** Aggregate token usage across slices without double-counting provider totals. */
|