@kmmao/happy-wire 0.2.1 → 0.2.3
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/index.cjs +52 -2
- package/dist/index.d.cts +1424 -254
- package/dist/index.d.mts +1424 -254
- package/dist/index.mjs +48 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -72,6 +72,46 @@ const sessionUsageUpdateEventSchema = z.object({
|
|
|
72
72
|
}),
|
|
73
73
|
durationMs: z.number().optional()
|
|
74
74
|
});
|
|
75
|
+
const sessionTaskStartEventSchema = z.object({
|
|
76
|
+
t: z.literal("task-start"),
|
|
77
|
+
taskId: z.string(),
|
|
78
|
+
toolUseId: z.string().optional(),
|
|
79
|
+
description: z.string(),
|
|
80
|
+
taskType: z.string().optional()
|
|
81
|
+
});
|
|
82
|
+
const sessionTaskProgressEventSchema = z.object({
|
|
83
|
+
t: z.literal("task-progress"),
|
|
84
|
+
taskId: z.string(),
|
|
85
|
+
description: z.string(),
|
|
86
|
+
usage: z.object({
|
|
87
|
+
totalTokens: z.number(),
|
|
88
|
+
toolUses: z.number(),
|
|
89
|
+
durationMs: z.number()
|
|
90
|
+
}),
|
|
91
|
+
lastToolName: z.string().optional()
|
|
92
|
+
});
|
|
93
|
+
const sessionTaskEndEventSchema = z.object({
|
|
94
|
+
t: z.literal("task-end"),
|
|
95
|
+
taskId: z.string(),
|
|
96
|
+
status: z.enum(["completed", "failed", "stopped"]),
|
|
97
|
+
summary: z.string(),
|
|
98
|
+
usage: z.object({
|
|
99
|
+
totalTokens: z.number(),
|
|
100
|
+
toolUses: z.number(),
|
|
101
|
+
durationMs: z.number()
|
|
102
|
+
}).optional()
|
|
103
|
+
});
|
|
104
|
+
const sessionToolProgressEventSchema = z.object({
|
|
105
|
+
t: z.literal("tool-progress"),
|
|
106
|
+
toolUseId: z.string(),
|
|
107
|
+
toolName: z.string(),
|
|
108
|
+
elapsedSeconds: z.number(),
|
|
109
|
+
taskId: z.string().optional()
|
|
110
|
+
});
|
|
111
|
+
const sessionPromptSuggestionEventSchema = z.object({
|
|
112
|
+
t: z.literal("prompt-suggestion"),
|
|
113
|
+
suggestion: z.string()
|
|
114
|
+
});
|
|
75
115
|
const sessionEventSchema = z.discriminatedUnion("t", [
|
|
76
116
|
sessionTextEventSchema,
|
|
77
117
|
sessionServiceMessageEventSchema,
|
|
@@ -82,7 +122,12 @@ const sessionEventSchema = z.discriminatedUnion("t", [
|
|
|
82
122
|
sessionStartEventSchema,
|
|
83
123
|
sessionTurnEndEventSchema,
|
|
84
124
|
sessionStopEventSchema,
|
|
85
|
-
sessionUsageUpdateEventSchema
|
|
125
|
+
sessionUsageUpdateEventSchema,
|
|
126
|
+
sessionTaskStartEventSchema,
|
|
127
|
+
sessionTaskProgressEventSchema,
|
|
128
|
+
sessionTaskEndEventSchema,
|
|
129
|
+
sessionToolProgressEventSchema,
|
|
130
|
+
sessionPromptSuggestionEventSchema
|
|
86
131
|
]);
|
|
87
132
|
const sessionEnvelopeSchema = z.object({
|
|
88
133
|
id: z.string(),
|
|
@@ -101,7 +146,7 @@ const sessionEnvelopeSchema = z.object({
|
|
|
101
146
|
path: ["role"]
|
|
102
147
|
});
|
|
103
148
|
}
|
|
104
|
-
if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update") && envelope.role !== "agent") {
|
|
149
|
+
if ((envelope.ev.t === "start" || envelope.ev.t === "stop" || envelope.ev.t === "usage-update" || envelope.ev.t === "task-start" || envelope.ev.t === "task-progress" || envelope.ev.t === "task-end" || envelope.ev.t === "tool-progress" || envelope.ev.t === "prompt-suggestion") && envelope.role !== "agent") {
|
|
105
150
|
ctx.addIssue({
|
|
106
151
|
code: z.ZodIssueCode.custom,
|
|
107
152
|
message: `${envelope.ev.t} events must use role "agent"`,
|
|
@@ -221,4 +266,4 @@ const ApiUpdateMachineStateSchema = UpdateMachineBodySchema;
|
|
|
221
266
|
const UpdateBodySchema = UpdateNewMessageBodySchema;
|
|
222
267
|
const UpdateSchema = CoreUpdateContainerSchema;
|
|
223
268
|
|
|
224
|
-
export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, LegacyMessageContentSchema, MessageContentSchema, MessageMetaSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
|
|
269
|
+
export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, LegacyMessageContentSchema, MessageContentSchema, MessageMetaSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, createEnvelope, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionPromptSuggestionEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTaskEndEventSchema, sessionTaskProgressEventSchema, sessionTaskStartEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionToolProgressEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, sessionUsageUpdateEventSchema };
|