@sentry/junior 0.105.0 → 0.107.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-EOFSY2PD.js → agent-hooks-ICPIJAFY.js} +9 -7
- package/dist/api/conversations/detail.d.ts +1 -1
- package/dist/api/conversations/events.d.ts +14 -0
- package/dist/api/conversations/schema.d.ts +196 -463
- package/dist/api/schema.d.ts +2 -7
- package/dist/api/schema.js +10 -8
- package/dist/api.js +377 -810
- package/dist/app.js +2284 -2288
- package/dist/{catalog-runtime-5CVM2DOF.js → catalog-runtime-FOFNPR3P.js} +3 -2
- package/dist/chat/agent/prompt.d.ts +1 -1
- package/dist/chat/agent/request.d.ts +28 -29
- package/dist/chat/agent/resume.d.ts +7 -7
- package/dist/chat/agent/session.d.ts +5 -6
- package/dist/chat/agent/tools.d.ts +3 -3
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/config.d.ts +3 -2
- package/dist/chat/conversations/history.d.ts +582 -167
- package/dist/chat/conversations/message-projection.d.ts +6 -0
- package/dist/chat/conversations/message-summaries.d.ts +9 -0
- package/dist/chat/conversations/messages.d.ts +13 -27
- package/dist/chat/conversations/projection.d.ts +30 -53
- package/dist/chat/conversations/provenance.d.ts +42 -0
- package/dist/chat/conversations/search.d.ts +2 -2
- package/dist/chat/conversations/sql/conversation-row.d.ts +1 -1
- package/dist/chat/conversations/sql/event-lock.d.ts +3 -0
- package/dist/chat/conversations/sql/history.d.ts +3 -3
- package/dist/chat/conversations/sql/privacy.d.ts +27 -0
- package/dist/chat/conversations/sql/purge.d.ts +2 -10
- package/dist/chat/conversations/sql/store.d.ts +0 -5
- package/dist/chat/conversations/store.d.ts +8 -13
- package/dist/chat/conversations/turn-lifecycle.d.ts +41 -0
- package/dist/chat/db.d.ts +4 -10
- package/dist/chat/model-profile.d.ts +10 -0
- package/dist/chat/oauth-flow.d.ts +0 -5
- package/dist/chat/pi/conversation-events.d.ts +33 -0
- package/dist/chat/pi/sql-model-usage.d.ts +10 -0
- package/dist/chat/plugins/agent-hooks.d.ts +4 -2
- package/dist/chat/resource-events/ingest.d.ts +0 -13
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -1
- package/dist/chat/runtime/generated-artifacts.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +2 -0
- package/dist/chat/runtime/slack-resume.d.ts +23 -28
- package/dist/chat/runtime/slack-runtime.d.ts +2 -0
- package/dist/chat/runtime/turn.d.ts +14 -1
- package/dist/chat/services/context-compaction-marker.d.ts +0 -1
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/services/conversation-memory.d.ts +9 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -4
- package/dist/chat/services/subscribed-decision.d.ts +1 -1
- package/dist/chat/services/turn-failure-response.d.ts +10 -3
- package/dist/chat/services/turn-limit.d.ts +6 -0
- package/dist/chat/services/turn-result.d.ts +7 -12
- package/dist/chat/services/{turn-reasoning-level.d.ts → turn-router.d.ts} +12 -8
- package/dist/chat/services/turn-session-record.d.ts +15 -17
- package/dist/chat/slack/adapter.d.ts +2 -2
- package/dist/chat/slack/errors.d.ts +2 -0
- package/dist/chat/slack/outbound.d.ts +0 -1
- package/dist/chat/slack/reply.d.ts +2 -8
- package/dist/chat/slack/tools/channel-capabilities.d.ts +2 -2
- package/dist/chat/slack/tools/{send-message.d.ts → send-files.d.ts} +27 -19
- package/dist/chat/state/conversation.d.ts +4 -4
- package/dist/chat/state/turn-id.d.ts +2 -0
- package/dist/chat/state/turn-session-keys.d.ts +6 -0
- package/dist/chat/state/turn-session.d.ts +11 -9
- package/dist/chat/task-execution/state.d.ts +6 -1
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/tool-support/pi-tool-adapter.d.ts +1 -1
- package/dist/chat/tool-support/tool-execution-report.d.ts +1 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -2
- package/dist/chat/tools/sandbox/file-uploads.d.ts +28 -6
- package/dist/chat/tools/types.d.ts +6 -9
- package/dist/chat/tools/web/image-generate.d.ts +4 -6
- package/dist/{chunk-QDKRE3LS.js → chunk-4YF7Z6IA.js} +390 -270
- package/dist/{chunk-4PDVOHXP.js → chunk-AUUOHQAT.js} +2 -2
- package/dist/chunk-B2Z2H66D.js +250 -0
- package/dist/{chunk-QVTVCJR4.js → chunk-CQ7KSO2B.js} +75 -45
- package/dist/{chunk-MJSJAHBW.js → chunk-DY7TRYB5.js} +1 -1
- package/dist/{chunk-NJJFU6CP.js → chunk-EDLNHZH3.js} +883 -898
- package/dist/{chunk-O7ILGCMJ.js → chunk-IGHMVDWI.js} +134 -18
- package/dist/chunk-MU6HHZEN.js +99 -0
- package/dist/{chunk-BCULHGZK.js → chunk-NVOTGWYX.js} +458 -684
- package/dist/{chunk-AEWZ7F65.js → chunk-O24R4DCK.js} +2 -179
- package/dist/{chunk-CCFROYAV.js → chunk-PUAMO4PI.js} +115 -125
- package/dist/{chunk-VDHMFCDY.js → chunk-RMVOAJRL.js} +30 -13
- package/dist/{chunk-7G4J3CR7.js → chunk-SPUAJVVH.js} +6 -4
- package/dist/{chunk-M3UAVLEN.js → chunk-SS67LUOK.js} +43 -290
- package/dist/{chunk-FXFQNHRU.js → chunk-VFUK3X5B.js} +4 -2
- package/dist/{chunk-CCTCIISK.js → chunk-VH6KWKG2.js} +2 -2
- package/dist/chunk-VIXFG2VC.js +182 -0
- package/dist/{chunk-RMZ65YAA.js → chunk-YFQ7CQDE.js} +687 -21
- package/dist/{chunk-77LHNQK4.js → chunk-YIPD3L6L.js} +4 -2
- package/dist/{chunk-U26ZWZCN.js → chunk-YNP2ATQX.js} +6 -4
- package/dist/{chunk-WR7H7VLJ.js → chunk-YT72TOEK.js} +2 -2
- package/dist/cli/chat.js +21 -20
- package/dist/cli/check.js +4 -3
- package/dist/cli/plugins.js +11 -9
- package/dist/cli/snapshot-warmup.js +7 -5
- package/dist/cli/upgrade.js +2046 -105
- package/dist/db/schema/{agent-steps.d.ts → conversation-events.d.ts} +37 -21
- package/dist/db/schema.d.ts +28 -159
- package/dist/{db-PDMC67T3.js → db-DIGO4TGW.js} +6 -8
- package/dist/{runner-6A7MQRUE.js → runner-ACR2HAIC.js} +209 -101
- package/dist/{skills-722AXRV5.js → skills-ITNHBARB.js} +4 -3
- package/dist/{validation-EUI2UFRM.js → validation-AGQ46ZGV.js} +4 -3
- package/migrations/0005_conversation_events.sql +122 -0
- package/migrations/README.md +23 -10
- package/migrations/meta/0005_snapshot.json +948 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/api/conversations/activity.d.ts +0 -40
- package/dist/api/conversations/detail-projection.d.ts +0 -11
- package/dist/api/conversations/detail.query.d.ts +0 -3
- package/dist/api/conversations/subagent.d.ts +0 -10
- package/dist/api/conversations/transcript.d.ts +0 -28
- package/dist/chat/conversations/legacy-advisor-session.d.ts +0 -7
- package/dist/chat/conversations/legacy-import.d.ts +0 -38
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +0 -55
- package/dist/chat/conversations/sql/messages.d.ts +0 -4
- package/dist/chat/conversations/visible-compactions.d.ts +0 -11
- package/dist/chat/conversations/visible-messages.d.ts +0 -47
- package/dist/chat/services/reply-delivery-plan.d.ts +0 -5
- package/dist/chat/state/session-log.d.ts +0 -384
- package/dist/chunk-RYDF4GOX.js +0 -1072
- package/dist/chunk-XIMUQ4IU.js +0 -147
- package/dist/db/schema/conversation-messages.d.ts +0 -153
- package/dist/handlers/github-webhook/check-suite.d.ts +0 -3
- package/dist/handlers/github-webhook/issue-comment.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request-review.d.ts +0 -3
- package/dist/handlers/github-webhook/pull-request.d.ts +0 -3
- package/dist/handlers/github-webhook/resource.d.ts +0 -10
- package/dist/handlers/github-webhook.d.ts +0 -15
- package/dist/legacy-import-G333RHJZ.js +0 -18
|
@@ -1,23 +1,145 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Durable
|
|
2
|
+
* Durable conversation event history port.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* is corrupt state and fails loudly — while `pi_message` content stays
|
|
10
|
-
* permissive because the Pi SDK owns the message shape.
|
|
4
|
+
* Events append under the conversation lease in stable sequence order.
|
|
5
|
+
* Compaction and handoff replace the active model history without rewriting
|
|
6
|
+
* prior events. Unsupported stored events remain readable as opaque facts,
|
|
7
|
+
* while malformed known events fail loudly. Provider-specific message fields
|
|
8
|
+
* are validated by the Pi adapter when it restores model context.
|
|
11
9
|
*/
|
|
12
10
|
import { z } from "zod";
|
|
13
|
-
|
|
11
|
+
/** Store one opaque agent-step payload while Pi owns provider validation. */
|
|
12
|
+
export declare const conversationAgentStepPayloadSchema: z.ZodPipe<z.ZodObject<{
|
|
13
|
+
role: z.ZodString;
|
|
14
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
15
|
+
role: string;
|
|
16
|
+
}, {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
role: string;
|
|
19
|
+
}>>;
|
|
20
|
+
/** The opaque Pi history entry carried by an `agent_step` event. */
|
|
21
|
+
export type ConversationAgentStepPayload = z.output<typeof conversationAgentStepPayloadSchema>;
|
|
22
|
+
/** Validate an event that intentionally replaces active model history. */
|
|
23
|
+
export declare const historyReplacementSchema: z.ZodObject<{
|
|
24
|
+
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"handoff">;
|
|
26
|
+
modelProfile: z.ZodString;
|
|
27
|
+
modelId: z.ZodString;
|
|
28
|
+
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
30
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
31
|
+
role: z.ZodString;
|
|
32
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
33
|
+
role: string;
|
|
34
|
+
}, {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
role: string;
|
|
37
|
+
}>>;
|
|
38
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
40
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
platform: z.ZodLiteral<"slack">;
|
|
42
|
+
teamId: z.ZodString;
|
|
43
|
+
email: z.ZodOptional<z.ZodString>;
|
|
44
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
45
|
+
userId: z.ZodString;
|
|
46
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
platform: z.ZodLiteral<"local">;
|
|
49
|
+
email: z.ZodOptional<z.ZodString>;
|
|
50
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
51
|
+
userId: z.ZodString;
|
|
52
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
platform: z.ZodLiteral<"system">;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
}, z.core.$strict>], "platform">>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"compaction">;
|
|
62
|
+
modelProfile: z.ZodString;
|
|
63
|
+
modelId: z.ZodString;
|
|
64
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
65
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
66
|
+
role: z.ZodString;
|
|
67
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
68
|
+
role: string;
|
|
69
|
+
}, {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
role: string;
|
|
72
|
+
}>>;
|
|
73
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
75
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
|
+
platform: z.ZodLiteral<"slack">;
|
|
77
|
+
teamId: z.ZodString;
|
|
78
|
+
email: z.ZodOptional<z.ZodString>;
|
|
79
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
80
|
+
userId: z.ZodString;
|
|
81
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
83
|
+
platform: z.ZodLiteral<"local">;
|
|
84
|
+
email: z.ZodOptional<z.ZodString>;
|
|
85
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
86
|
+
userId: z.ZodString;
|
|
87
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
platform: z.ZodLiteral<"system">;
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
}, z.core.$strict>], "platform">>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strict>>;
|
|
95
|
+
}, z.core.$strict>], "type">;
|
|
96
|
+
createdAtMs: z.ZodNumber;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
/** One atomically persisted model-history replacement. */
|
|
99
|
+
export type HistoryReplacement = z.output<typeof historyReplacementSchema>;
|
|
100
|
+
export declare const authorizationKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
101
|
+
/** Provider authorization family recorded by conversation events. */
|
|
102
|
+
export type AuthorizationKind = z.output<typeof authorizationKindSchema>;
|
|
103
|
+
/** Product surface that owns a durable conversation turn. */
|
|
104
|
+
export declare const conversationTurnSurfaceSchema: z.ZodEnum<{
|
|
105
|
+
slack: "slack";
|
|
106
|
+
api: "api";
|
|
107
|
+
internal: "internal";
|
|
108
|
+
scheduler: "scheduler";
|
|
109
|
+
}>;
|
|
110
|
+
/** Stable, privacy-safe classification for a failed turn. */
|
|
111
|
+
export declare const conversationTurnFailureCodeSchema: z.ZodEnum<{
|
|
112
|
+
agent_run_failed: "agent_run_failed";
|
|
113
|
+
delivery_failed: "delivery_failed";
|
|
114
|
+
model_execution_failed: "model_execution_failed";
|
|
115
|
+
persistence_failed: "persistence_failed";
|
|
116
|
+
}>;
|
|
117
|
+
/** Failure classification persisted without raw provider or exception data. */
|
|
118
|
+
export type ConversationTurnFailureCode = z.output<typeof conversationTurnFailureCodeSchema>;
|
|
119
|
+
/** Strict event-data contract reused by the SQL row codec. */
|
|
120
|
+
export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
121
|
+
type: z.ZodLiteral<"message">;
|
|
122
|
+
messageId: z.ZodString;
|
|
123
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
124
|
+
text: z.ZodString;
|
|
125
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
126
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
127
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
128
|
+
messageId: z.ZodString;
|
|
129
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
130
|
+
text: z.ZodString;
|
|
131
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
133
|
+
type: z.ZodLiteral<"message_updated">;
|
|
134
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14
135
|
message: z.ZodPipe<z.ZodObject<{
|
|
15
136
|
role: z.ZodString;
|
|
16
|
-
}, z.core.$loose>, z.ZodTransform<
|
|
137
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
138
|
+
role: string;
|
|
139
|
+
}, {
|
|
17
140
|
[x: string]: unknown;
|
|
18
141
|
role: string;
|
|
19
142
|
}>>;
|
|
20
|
-
createdAtMs: z.ZodNumber;
|
|
21
143
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
22
144
|
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
23
145
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -38,20 +160,93 @@ declare const piMessageStepSchema: z.ZodObject<{
|
|
|
38
160
|
name: z.ZodString;
|
|
39
161
|
}, z.core.$strict>], "platform">>;
|
|
40
162
|
}, z.core.$strict>>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
163
|
+
type: z.ZodLiteral<"agent_step">;
|
|
164
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
165
|
+
type: z.ZodLiteral<"mcp_provider_connected">;
|
|
166
|
+
provider: z.ZodString;
|
|
167
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"authorization_requested">;
|
|
169
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
170
|
+
provider: z.ZodString;
|
|
171
|
+
actorId: z.ZodString;
|
|
172
|
+
authorizationId: z.ZodString;
|
|
173
|
+
delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
|
|
174
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"authorization_completed">;
|
|
176
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
177
|
+
provider: z.ZodString;
|
|
178
|
+
actorId: z.ZodString;
|
|
179
|
+
authorizationId: z.ZodString;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"tool_execution_started">;
|
|
182
|
+
toolCallId: z.ZodString;
|
|
183
|
+
toolName: z.ZodString;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"message_handled">;
|
|
186
|
+
messageId: z.ZodString;
|
|
187
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"messages_summarized">;
|
|
189
|
+
historyFromSeq: z.ZodNumber;
|
|
190
|
+
compactions: z.ZodArray<z.ZodObject<{
|
|
191
|
+
coveredMessageCount: z.ZodNumber;
|
|
192
|
+
createdAtMs: z.ZodNumber;
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
summary: z.ZodString;
|
|
195
|
+
}, z.core.$strict>>;
|
|
196
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
197
|
+
type: z.ZodLiteral<"turn_started">;
|
|
198
|
+
turnId: z.ZodString;
|
|
199
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
200
|
+
surface: z.ZodEnum<{
|
|
201
|
+
slack: "slack";
|
|
202
|
+
api: "api";
|
|
203
|
+
internal: "internal";
|
|
204
|
+
scheduler: "scheduler";
|
|
205
|
+
}>;
|
|
206
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
207
|
+
type: z.ZodLiteral<"turn_completed">;
|
|
208
|
+
turnId: z.ZodString;
|
|
209
|
+
outcome: z.ZodEnum<{
|
|
210
|
+
success: "success";
|
|
211
|
+
no_reply: "no_reply";
|
|
212
|
+
}>;
|
|
213
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"turn_failed">;
|
|
215
|
+
turnId: z.ZodString;
|
|
216
|
+
failureCode: z.ZodEnum<{
|
|
217
|
+
agent_run_failed: "agent_run_failed";
|
|
218
|
+
delivery_failed: "delivery_failed";
|
|
219
|
+
model_execution_failed: "model_execution_failed";
|
|
220
|
+
persistence_failed: "persistence_failed";
|
|
221
|
+
}>;
|
|
222
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
+
type: z.ZodLiteral<"subagent_started">;
|
|
225
|
+
subagentInvocationId: z.ZodString;
|
|
226
|
+
subagentKind: z.ZodString;
|
|
227
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
228
|
+
parentToolCallId: z.ZodOptional<z.ZodString>;
|
|
229
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
230
|
+
childConversationId: z.ZodString;
|
|
231
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
232
|
+
type: z.ZodLiteral<"subagent_ended">;
|
|
233
|
+
subagentInvocationId: z.ZodString;
|
|
234
|
+
outcome: z.ZodUnion<readonly [z.ZodLiteral<"success">, z.ZodLiteral<"error">, z.ZodLiteral<"aborted">]>;
|
|
235
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strict>]>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"handoff">;
|
|
238
|
+
modelProfile: z.ZodString;
|
|
46
239
|
modelId: z.ZodString;
|
|
47
|
-
|
|
240
|
+
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
241
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
48
242
|
message: z.ZodPipe<z.ZodObject<{
|
|
49
243
|
role: z.ZodString;
|
|
50
|
-
}, z.core.$loose>, z.ZodTransform<
|
|
244
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
245
|
+
role: string;
|
|
246
|
+
}, {
|
|
51
247
|
[x: string]: unknown;
|
|
52
248
|
role: string;
|
|
53
249
|
}>>;
|
|
54
|
-
createdAtMs: z.ZodNumber;
|
|
55
250
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
56
251
|
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
57
252
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -72,19 +267,21 @@ export declare const contextEpochStartSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
72
267
|
name: z.ZodString;
|
|
73
268
|
}, z.core.$strict>], "platform">>;
|
|
74
269
|
}, z.core.$strict>>;
|
|
270
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
75
271
|
}, z.core.$strict>>;
|
|
76
272
|
}, z.core.$strict>, z.ZodObject<{
|
|
77
|
-
|
|
273
|
+
type: z.ZodLiteral<"compaction">;
|
|
78
274
|
modelProfile: z.ZodString;
|
|
79
275
|
modelId: z.ZodString;
|
|
80
|
-
|
|
276
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
81
277
|
message: z.ZodPipe<z.ZodObject<{
|
|
82
278
|
role: z.ZodString;
|
|
83
|
-
}, z.core.$loose>, z.ZodTransform<
|
|
279
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
280
|
+
role: string;
|
|
281
|
+
}, {
|
|
84
282
|
[x: string]: unknown;
|
|
85
283
|
role: string;
|
|
86
284
|
}>>;
|
|
87
|
-
createdAtMs: z.ZodNumber;
|
|
88
285
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
89
286
|
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
90
287
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -105,19 +302,21 @@ export declare const contextEpochStartSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
105
302
|
name: z.ZodString;
|
|
106
303
|
}, z.core.$strict>], "platform">>;
|
|
107
304
|
}, z.core.$strict>>;
|
|
305
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
108
306
|
}, z.core.$strict>>;
|
|
109
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
-
|
|
307
|
+
}, z.core.$strict>], "type">, z.ZodObject<{
|
|
308
|
+
type: z.ZodLiteral<"rollback">;
|
|
111
309
|
modelProfile: z.ZodString;
|
|
112
310
|
modelId: z.ZodString;
|
|
113
|
-
|
|
311
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
114
312
|
message: z.ZodPipe<z.ZodObject<{
|
|
115
313
|
role: z.ZodString;
|
|
116
|
-
}, z.core.$loose>, z.ZodTransform<
|
|
314
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
315
|
+
role: string;
|
|
316
|
+
}, {
|
|
117
317
|
[x: string]: unknown;
|
|
118
318
|
role: string;
|
|
119
319
|
}>>;
|
|
120
|
-
createdAtMs: z.ZodNumber;
|
|
121
320
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
122
321
|
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
123
322
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -138,121 +337,303 @@ export declare const contextEpochStartSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
138
337
|
name: z.ZodString;
|
|
139
338
|
}, z.core.$strict>], "platform">>;
|
|
140
339
|
}, z.core.$strict>>;
|
|
340
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
141
341
|
}, z.core.$strict>>;
|
|
142
|
-
}, z.core.$strict>]
|
|
143
|
-
/** One
|
|
144
|
-
export type
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}, z.core.$
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
342
|
+
}, z.core.$strict>]>;
|
|
343
|
+
/** One durable conversation event's validated data. */
|
|
344
|
+
export type ConversationEventData = z.output<typeof conversationEventDataSchema>;
|
|
345
|
+
declare const unknownConversationEventDataSchema: z.ZodObject<{
|
|
346
|
+
type: z.ZodLiteral<"unknown">;
|
|
347
|
+
originalType: z.ZodString;
|
|
348
|
+
payload: z.ZodUnknown;
|
|
349
|
+
}, z.core.$strict>;
|
|
350
|
+
/** Opaque data from a stored event this Junior version cannot interpret. */
|
|
351
|
+
export type UnknownConversationEventData = z.output<typeof unknownConversationEventDataSchema>;
|
|
352
|
+
/**
|
|
353
|
+
* Canonical ordered envelope for the durable conversation log.
|
|
354
|
+
* `schemaVersion` is persisted with every physical event row.
|
|
355
|
+
*/
|
|
356
|
+
export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
357
|
+
seq: z.ZodNumber;
|
|
358
|
+
historyVersion: z.ZodNumber;
|
|
359
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
360
|
+
createdAtMs: z.ZodNumber;
|
|
361
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
362
|
+
data: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
363
|
+
type: z.ZodLiteral<"message">;
|
|
364
|
+
messageId: z.ZodString;
|
|
365
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
366
|
+
text: z.ZodString;
|
|
367
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
368
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
369
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
370
|
+
messageId: z.ZodString;
|
|
371
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
372
|
+
text: z.ZodString;
|
|
373
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
374
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
375
|
+
type: z.ZodLiteral<"message_updated">;
|
|
376
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
377
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
378
|
+
role: z.ZodString;
|
|
379
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
380
|
+
role: string;
|
|
381
|
+
}, {
|
|
382
|
+
[x: string]: unknown;
|
|
383
|
+
role: string;
|
|
384
|
+
}>>;
|
|
385
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
386
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
387
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
388
|
+
platform: z.ZodLiteral<"slack">;
|
|
389
|
+
teamId: z.ZodString;
|
|
390
|
+
email: z.ZodOptional<z.ZodString>;
|
|
391
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
392
|
+
userId: z.ZodString;
|
|
393
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
394
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
395
|
+
platform: z.ZodLiteral<"local">;
|
|
396
|
+
email: z.ZodOptional<z.ZodString>;
|
|
397
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
398
|
+
userId: z.ZodString;
|
|
399
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
400
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
+
platform: z.ZodLiteral<"system">;
|
|
402
|
+
name: z.ZodString;
|
|
403
|
+
}, z.core.$strict>], "platform">>;
|
|
404
|
+
}, z.core.$strict>>;
|
|
405
|
+
type: z.ZodLiteral<"agent_step">;
|
|
406
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
407
|
+
type: z.ZodLiteral<"mcp_provider_connected">;
|
|
408
|
+
provider: z.ZodString;
|
|
409
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
410
|
+
type: z.ZodLiteral<"authorization_requested">;
|
|
411
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
412
|
+
provider: z.ZodString;
|
|
413
|
+
actorId: z.ZodString;
|
|
414
|
+
authorizationId: z.ZodString;
|
|
415
|
+
delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
|
|
416
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
417
|
+
type: z.ZodLiteral<"authorization_completed">;
|
|
418
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
419
|
+
provider: z.ZodString;
|
|
420
|
+
actorId: z.ZodString;
|
|
421
|
+
authorizationId: z.ZodString;
|
|
422
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
423
|
+
type: z.ZodLiteral<"tool_execution_started">;
|
|
424
|
+
toolCallId: z.ZodString;
|
|
425
|
+
toolName: z.ZodString;
|
|
426
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
427
|
+
type: z.ZodLiteral<"message_handled">;
|
|
428
|
+
messageId: z.ZodString;
|
|
429
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
430
|
+
type: z.ZodLiteral<"messages_summarized">;
|
|
431
|
+
historyFromSeq: z.ZodNumber;
|
|
432
|
+
compactions: z.ZodArray<z.ZodObject<{
|
|
433
|
+
coveredMessageCount: z.ZodNumber;
|
|
434
|
+
createdAtMs: z.ZodNumber;
|
|
435
|
+
id: z.ZodString;
|
|
436
|
+
summary: z.ZodString;
|
|
437
|
+
}, z.core.$strict>>;
|
|
438
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
439
|
+
type: z.ZodLiteral<"turn_started">;
|
|
440
|
+
turnId: z.ZodString;
|
|
441
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
442
|
+
surface: z.ZodEnum<{
|
|
443
|
+
slack: "slack";
|
|
444
|
+
api: "api";
|
|
445
|
+
internal: "internal";
|
|
446
|
+
scheduler: "scheduler";
|
|
447
|
+
}>;
|
|
448
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
449
|
+
type: z.ZodLiteral<"turn_completed">;
|
|
450
|
+
turnId: z.ZodString;
|
|
451
|
+
outcome: z.ZodEnum<{
|
|
452
|
+
success: "success";
|
|
453
|
+
no_reply: "no_reply";
|
|
454
|
+
}>;
|
|
455
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
456
|
+
type: z.ZodLiteral<"turn_failed">;
|
|
457
|
+
turnId: z.ZodString;
|
|
458
|
+
failureCode: z.ZodEnum<{
|
|
459
|
+
agent_run_failed: "agent_run_failed";
|
|
460
|
+
delivery_failed: "delivery_failed";
|
|
461
|
+
model_execution_failed: "model_execution_failed";
|
|
462
|
+
persistence_failed: "persistence_failed";
|
|
463
|
+
}>;
|
|
464
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
465
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
466
|
+
type: z.ZodLiteral<"subagent_started">;
|
|
467
|
+
subagentInvocationId: z.ZodString;
|
|
468
|
+
subagentKind: z.ZodString;
|
|
469
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
470
|
+
parentToolCallId: z.ZodOptional<z.ZodString>;
|
|
471
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
472
|
+
childConversationId: z.ZodString;
|
|
473
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
474
|
+
type: z.ZodLiteral<"subagent_ended">;
|
|
475
|
+
subagentInvocationId: z.ZodString;
|
|
476
|
+
outcome: z.ZodUnion<readonly [z.ZodLiteral<"success">, z.ZodLiteral<"error">, z.ZodLiteral<"aborted">]>;
|
|
477
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
478
|
+
}, z.core.$strict>]>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
479
|
+
type: z.ZodLiteral<"handoff">;
|
|
480
|
+
modelProfile: z.ZodString;
|
|
481
|
+
modelId: z.ZodString;
|
|
482
|
+
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
483
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
484
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
485
|
+
role: z.ZodString;
|
|
486
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
487
|
+
role: string;
|
|
488
|
+
}, {
|
|
489
|
+
[x: string]: unknown;
|
|
490
|
+
role: string;
|
|
491
|
+
}>>;
|
|
492
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
493
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
494
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
495
|
+
platform: z.ZodLiteral<"slack">;
|
|
496
|
+
teamId: z.ZodString;
|
|
497
|
+
email: z.ZodOptional<z.ZodString>;
|
|
498
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
499
|
+
userId: z.ZodString;
|
|
500
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
501
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
502
|
+
platform: z.ZodLiteral<"local">;
|
|
503
|
+
email: z.ZodOptional<z.ZodString>;
|
|
504
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
505
|
+
userId: z.ZodString;
|
|
506
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
507
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
508
|
+
platform: z.ZodLiteral<"system">;
|
|
509
|
+
name: z.ZodString;
|
|
510
|
+
}, z.core.$strict>], "platform">>;
|
|
511
|
+
}, z.core.$strict>>;
|
|
512
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
513
|
+
}, z.core.$strict>>;
|
|
514
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
515
|
+
type: z.ZodLiteral<"compaction">;
|
|
516
|
+
modelProfile: z.ZodString;
|
|
517
|
+
modelId: z.ZodString;
|
|
518
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
519
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
520
|
+
role: z.ZodString;
|
|
521
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
522
|
+
role: string;
|
|
523
|
+
}, {
|
|
524
|
+
[x: string]: unknown;
|
|
525
|
+
role: string;
|
|
526
|
+
}>>;
|
|
527
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
528
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
529
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
530
|
+
platform: z.ZodLiteral<"slack">;
|
|
531
|
+
teamId: z.ZodString;
|
|
532
|
+
email: z.ZodOptional<z.ZodString>;
|
|
533
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
534
|
+
userId: z.ZodString;
|
|
535
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
536
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
537
|
+
platform: z.ZodLiteral<"local">;
|
|
538
|
+
email: z.ZodOptional<z.ZodString>;
|
|
539
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
540
|
+
userId: z.ZodString;
|
|
541
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
542
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
543
|
+
platform: z.ZodLiteral<"system">;
|
|
544
|
+
name: z.ZodString;
|
|
545
|
+
}, z.core.$strict>], "platform">>;
|
|
546
|
+
}, z.core.$strict>>;
|
|
547
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
548
|
+
}, z.core.$strict>>;
|
|
549
|
+
}, z.core.$strict>], "type">, z.ZodObject<{
|
|
550
|
+
type: z.ZodLiteral<"rollback">;
|
|
551
|
+
modelProfile: z.ZodString;
|
|
552
|
+
modelId: z.ZodString;
|
|
553
|
+
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
554
|
+
message: z.ZodPipe<z.ZodObject<{
|
|
555
|
+
role: z.ZodString;
|
|
556
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
557
|
+
role: string;
|
|
558
|
+
}, {
|
|
559
|
+
[x: string]: unknown;
|
|
560
|
+
role: string;
|
|
561
|
+
}>>;
|
|
562
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
563
|
+
authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
|
|
564
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
565
|
+
platform: z.ZodLiteral<"slack">;
|
|
566
|
+
teamId: z.ZodString;
|
|
567
|
+
email: z.ZodOptional<z.ZodString>;
|
|
568
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
569
|
+
userId: z.ZodString;
|
|
570
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
571
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
572
|
+
platform: z.ZodLiteral<"local">;
|
|
573
|
+
email: z.ZodOptional<z.ZodString>;
|
|
574
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
575
|
+
userId: z.ZodString;
|
|
576
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
577
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
578
|
+
platform: z.ZodLiteral<"system">;
|
|
579
|
+
name: z.ZodString;
|
|
580
|
+
}, z.core.$strict>], "platform">>;
|
|
581
|
+
}, z.core.$strict>>;
|
|
582
|
+
sourceEventSeq: z.ZodOptional<z.ZodNumber>;
|
|
583
|
+
}, z.core.$strict>>;
|
|
584
|
+
}, z.core.$strict>]>;
|
|
233
585
|
}, z.core.$strict>, z.ZodObject<{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
586
|
+
schemaVersion: z.ZodNumber;
|
|
587
|
+
seq: z.ZodNumber;
|
|
588
|
+
historyVersion: z.ZodNumber;
|
|
589
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
590
|
+
createdAtMs: z.ZodNumber;
|
|
591
|
+
data: z.ZodObject<{
|
|
592
|
+
type: z.ZodLiteral<"unknown">;
|
|
593
|
+
originalType: z.ZodString;
|
|
594
|
+
payload: z.ZodUnknown;
|
|
595
|
+
}, z.core.$strict>;
|
|
596
|
+
}, z.core.$strict>]>;
|
|
597
|
+
/** One versioned event read from the durable conversation log. */
|
|
598
|
+
export type ConversationEvent = z.output<typeof conversationEventSchema>;
|
|
599
|
+
declare const storedConversationEventSchema: z.ZodObject<{
|
|
600
|
+
schemaVersion: z.ZodNumber;
|
|
601
|
+
seq: z.ZodNumber;
|
|
602
|
+
historyVersion: z.ZodNumber;
|
|
603
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
604
|
+
createdAtMs: z.ZodNumber;
|
|
605
|
+
type: z.ZodString;
|
|
606
|
+
payload: z.ZodUnknown;
|
|
607
|
+
}, z.core.$strict>;
|
|
608
|
+
/**
|
|
609
|
+
* Decode a physical event row without making old or future event types
|
|
610
|
+
* unreadable. Unsupported rows stay opaque until an upgrade migration defines
|
|
611
|
+
* their semantics; known version-one events remain strict so corrupt canonical
|
|
612
|
+
* data cannot be mistaken for compatibility data.
|
|
613
|
+
*/
|
|
614
|
+
export declare function decodeStoredConversationEvent(value: z.input<typeof storedConversationEventSchema>): ConversationEvent;
|
|
615
|
+
/** Validate an append without permitting model-history replacement events. */
|
|
616
|
+
export declare const newConversationEventSchema: z.ZodObject<{
|
|
617
|
+
data: z.ZodUnion<readonly [z.ZodObject<{
|
|
618
|
+
type: z.ZodLiteral<"message">;
|
|
619
|
+
messageId: z.ZodString;
|
|
620
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
621
|
+
text: z.ZodString;
|
|
622
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
623
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
624
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
625
|
+
messageId: z.ZodString;
|
|
626
|
+
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">, z.ZodLiteral<"system">]>;
|
|
627
|
+
text: z.ZodString;
|
|
628
|
+
authorIdentityId: z.ZodOptional<z.ZodString>;
|
|
629
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
630
|
+
type: z.ZodLiteral<"message_updated">;
|
|
631
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
253
632
|
message: z.ZodPipe<z.ZodObject<{
|
|
254
633
|
role: z.ZodString;
|
|
255
|
-
}, z.core.$loose>, z.ZodTransform<
|
|
634
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
635
|
+
role: string;
|
|
636
|
+
}, {
|
|
256
637
|
[x: string]: unknown;
|
|
257
638
|
role: string;
|
|
258
639
|
}>>;
|
|
@@ -276,36 +657,67 @@ export declare const newAgentStepSchema: z.ZodObject<{
|
|
|
276
657
|
name: z.ZodString;
|
|
277
658
|
}, z.core.$strict>], "platform">>;
|
|
278
659
|
}, z.core.$strict>>;
|
|
279
|
-
|
|
660
|
+
type: z.ZodLiteral<"agent_step">;
|
|
661
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
280
662
|
type: z.ZodLiteral<"mcp_provider_connected">;
|
|
281
663
|
provider: z.ZodString;
|
|
282
|
-
}, z.core.$
|
|
664
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
283
665
|
type: z.ZodLiteral<"authorization_requested">;
|
|
284
666
|
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
285
667
|
provider: z.ZodString;
|
|
286
668
|
actorId: z.ZodString;
|
|
287
669
|
authorizationId: z.ZodString;
|
|
288
670
|
delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
|
|
289
|
-
}, z.core.$
|
|
671
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
290
672
|
type: z.ZodLiteral<"authorization_completed">;
|
|
291
673
|
kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
|
|
292
674
|
provider: z.ZodString;
|
|
293
675
|
actorId: z.ZodString;
|
|
294
676
|
authorizationId: z.ZodString;
|
|
295
|
-
}, z.core.$
|
|
677
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
296
678
|
type: z.ZodLiteral<"tool_execution_started">;
|
|
297
679
|
toolCallId: z.ZodString;
|
|
298
680
|
toolName: z.ZodString;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
681
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
682
|
+
type: z.ZodLiteral<"message_handled">;
|
|
683
|
+
messageId: z.ZodString;
|
|
684
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
685
|
+
type: z.ZodLiteral<"messages_summarized">;
|
|
686
|
+
historyFromSeq: z.ZodNumber;
|
|
302
687
|
compactions: z.ZodArray<z.ZodObject<{
|
|
303
|
-
|
|
688
|
+
coveredMessageCount: z.ZodNumber;
|
|
304
689
|
createdAtMs: z.ZodNumber;
|
|
305
690
|
id: z.ZodString;
|
|
306
691
|
summary: z.ZodString;
|
|
307
|
-
}, z.core.$
|
|
308
|
-
}, z.core.$
|
|
692
|
+
}, z.core.$strict>>;
|
|
693
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
694
|
+
type: z.ZodLiteral<"turn_started">;
|
|
695
|
+
turnId: z.ZodString;
|
|
696
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
697
|
+
surface: z.ZodEnum<{
|
|
698
|
+
slack: "slack";
|
|
699
|
+
api: "api";
|
|
700
|
+
internal: "internal";
|
|
701
|
+
scheduler: "scheduler";
|
|
702
|
+
}>;
|
|
703
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
704
|
+
type: z.ZodLiteral<"turn_completed">;
|
|
705
|
+
turnId: z.ZodString;
|
|
706
|
+
outcome: z.ZodEnum<{
|
|
707
|
+
success: "success";
|
|
708
|
+
no_reply: "no_reply";
|
|
709
|
+
}>;
|
|
710
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
711
|
+
type: z.ZodLiteral<"turn_failed">;
|
|
712
|
+
turnId: z.ZodString;
|
|
713
|
+
failureCode: z.ZodEnum<{
|
|
714
|
+
agent_run_failed: "agent_run_failed";
|
|
715
|
+
delivery_failed: "delivery_failed";
|
|
716
|
+
model_execution_failed: "model_execution_failed";
|
|
717
|
+
persistence_failed: "persistence_failed";
|
|
718
|
+
}>;
|
|
719
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
720
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
309
721
|
type: z.ZodLiteral<"subagent_started">;
|
|
310
722
|
subagentInvocationId: z.ZodString;
|
|
311
723
|
subagentKind: z.ZodString;
|
|
@@ -313,30 +725,33 @@ export declare const newAgentStepSchema: z.ZodObject<{
|
|
|
313
725
|
parentToolCallId: z.ZodOptional<z.ZodString>;
|
|
314
726
|
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
315
727
|
childConversationId: z.ZodString;
|
|
316
|
-
historyMode: z.ZodUnion<readonly [z.ZodLiteral<"isolated">, z.ZodLiteral<"shared">]>;
|
|
317
728
|
}, z.core.$strict>, z.ZodObject<{
|
|
318
729
|
type: z.ZodLiteral<"subagent_ended">;
|
|
319
730
|
subagentInvocationId: z.ZodString;
|
|
320
731
|
outcome: z.ZodUnion<readonly [z.ZodLiteral<"success">, z.ZodLiteral<"error">, z.ZodLiteral<"aborted">]>;
|
|
321
732
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
322
|
-
}, z.core.$
|
|
733
|
+
}, z.core.$strict>]>;
|
|
734
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
323
735
|
createdAtMs: z.ZodNumber;
|
|
324
736
|
}, z.core.$strict>;
|
|
325
|
-
/**
|
|
326
|
-
export type
|
|
327
|
-
/**
|
|
328
|
-
export
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
737
|
+
/** An event to append; the store assigns `seq` and current history version. */
|
|
738
|
+
export type NewConversationEvent = z.output<typeof newConversationEventSchema>;
|
|
739
|
+
/** Persist and read the canonical per-conversation event log. */
|
|
740
|
+
export interface ConversationEventStore {
|
|
741
|
+
/** Append events atomically, assigning `seq = max+1` under the lease. */
|
|
742
|
+
append(conversationId: string, events: NewConversationEvent[]): Promise<void>;
|
|
743
|
+
/** Replace active model history with a compaction or handoff event. */
|
|
744
|
+
replaceHistory(conversationId: string, replacement: HistoryReplacement): Promise<void>;
|
|
745
|
+
/** Events of the current history version in `seq` order. */
|
|
746
|
+
loadCurrentHistory(conversationId: string): Promise<ConversationEvent[]>;
|
|
747
|
+
/** Events in the history version containing `seq`, when it exists. */
|
|
748
|
+
loadHistoryContaining(conversationId: string, seq: number, throughSeq?: number): Promise<ConversationEvent[] | undefined>;
|
|
749
|
+
/** Current source/destination messages and their latest summary snapshot. */
|
|
750
|
+
loadMessageHistory(conversationId: string): Promise<{
|
|
751
|
+
events: ConversationEvent[];
|
|
752
|
+
compaction: ConversationEvent | undefined;
|
|
753
|
+
}>;
|
|
754
|
+
/** All events across every history version in `seq` order. */
|
|
755
|
+
loadHistory(conversationId: string): Promise<ConversationEvent[]>;
|
|
341
756
|
}
|
|
342
757
|
export {};
|