@kmmao/happy-wire 0.18.0 → 0.19.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/index.cjs CHANGED
@@ -2124,23 +2124,64 @@ const GetContextUsageResponseSchema = z.z.object({
2124
2124
  serverName: z.z.string(),
2125
2125
  tokens: z.z.number().int().nonnegative(),
2126
2126
  isLoaded: z.z.boolean().optional()
2127
- }))
2127
+ })),
2128
+ /** Messages 内部 token 细分(SDK messageBreakdown)。仅 SDK 0.2.139+ 返回。 */
2129
+ messageBreakdown: z.z.object({
2130
+ toolCallTokens: z.z.number().int().nonnegative(),
2131
+ toolResultTokens: z.z.number().int().nonnegative(),
2132
+ attachmentTokens: z.z.number().int().nonnegative(),
2133
+ assistantMessageTokens: z.z.number().int().nonnegative(),
2134
+ userMessageTokens: z.z.number().int().nonnegative(),
2135
+ redirectedContextTokens: z.z.number().int().nonnegative(),
2136
+ unattributedTokens: z.z.number().int().nonnegative(),
2137
+ toolCallsByType: z.z.array(z.z.object({
2138
+ name: z.z.string(),
2139
+ callTokens: z.z.number().int().nonnegative(),
2140
+ resultTokens: z.z.number().int().nonnegative()
2141
+ })),
2142
+ attachmentsByType: z.z.array(z.z.object({
2143
+ name: z.z.string(),
2144
+ tokens: z.z.number().int().nonnegative()
2145
+ }))
2146
+ }).optional(),
2147
+ /** System Prompt 各段 token 细分。 */
2148
+ systemPromptSections: z.z.array(z.z.object({
2149
+ name: z.z.string(),
2150
+ tokens: z.z.number().int().nonnegative()
2151
+ })).optional(),
2152
+ /** API 实际用量(input/output/cache hit/miss)。 */
2153
+ apiUsage: z.z.object({
2154
+ inputTokens: z.z.number().int().nonnegative(),
2155
+ outputTokens: z.z.number().int().nonnegative(),
2156
+ cacheCreationInputTokens: z.z.number().int().nonnegative(),
2157
+ cacheReadInputTokens: z.z.number().int().nonnegative()
2158
+ }).nullable().optional()
2128
2159
  }).strict();
2129
2160
  const GetContextDetailRequestSchema = z.z.object({
2130
2161
  /**
2131
2162
  * Category name from getContextUsage (e.g. "Messages", "System prompt",
2132
2163
  * "Skills", "Custom agents", "Autocompact buffer", "Memory files").
2133
2164
  */
2134
- category: z.z.string().min(1).max(128)
2165
+ category: z.z.string().min(1).max(128),
2166
+ /**
2167
+ * When true, return only subcategory counts (no item content).
2168
+ * Only meaningful for the "Messages" category.
2169
+ */
2170
+ summaryOnly: z.z.boolean().optional(),
2171
+ /**
2172
+ * Filter to a specific subcategory within "Messages".
2173
+ * One of: "user", "system-reminder", "assistant".
2174
+ */
2175
+ subcategory: z.z.string().optional()
2135
2176
  }).strict();
2136
2177
  const GetContextDetailResponseSchema = z.z.object({
2137
- /** Parsed JSONL records for the requested category. */
2178
+ /** Parsed JSONL records for the requested category. Empty when summaryOnly=true. */
2138
2179
  items: z.z.array(z.z.object({
2139
2180
  /** JSONL record type (user, assistant, attachment, system, summary, etc.) */
2140
2181
  type: z.z.string(),
2141
2182
  /** Role when applicable (user / assistant) */
2142
2183
  role: z.z.string().optional(),
2143
- /** Full text content of the record. Truncated at 10 KB per item. */
2184
+ /** Full text content of the record. Truncated at 50 KB per item. */
2144
2185
  content: z.z.string(),
2145
2186
  /** UUID of the JSONL record */
2146
2187
  uuid: z.z.string().optional(),
@@ -2150,7 +2191,19 @@ const GetContextDetailResponseSchema = z.z.object({
2150
2191
  /** Category name echoed back for display */
2151
2192
  category: z.z.string(),
2152
2193
  /** Total number of matching items */
2153
- totalItems: z.z.number().int().nonnegative()
2194
+ totalItems: z.z.number().int().nonnegative(),
2195
+ /**
2196
+ * Subcategory breakdown for "Messages" when summaryOnly=true.
2197
+ * Each entry has a key, display label, and item count.
2198
+ */
2199
+ subcategories: z.z.array(z.z.object({
2200
+ /** Subcategory key: "user" | "system-reminder" | "assistant" */
2201
+ name: z.z.string(),
2202
+ /** Human-readable label */
2203
+ label: z.z.string(),
2204
+ /** Number of items in this subcategory */
2205
+ count: z.z.number().int().nonnegative()
2206
+ })).optional()
2154
2207
  }).strict();
2155
2208
  const GetMcpServersRequestSchema = z.z.object({}).strict();
2156
2209
  const GetMcpServersResponseSchema = z.z.object({
package/dist/index.d.cts CHANGED
@@ -3726,11 +3726,41 @@ declare const GetContextUsageResponseSchema: z$1.ZodObject<{
3726
3726
  tokens: z$1.ZodNumber;
3727
3727
  isLoaded: z$1.ZodOptional<z$1.ZodBoolean>;
3728
3728
  }, z$1.core.$strip>>;
3729
+ messageBreakdown: z$1.ZodOptional<z$1.ZodObject<{
3730
+ toolCallTokens: z$1.ZodNumber;
3731
+ toolResultTokens: z$1.ZodNumber;
3732
+ attachmentTokens: z$1.ZodNumber;
3733
+ assistantMessageTokens: z$1.ZodNumber;
3734
+ userMessageTokens: z$1.ZodNumber;
3735
+ redirectedContextTokens: z$1.ZodNumber;
3736
+ unattributedTokens: z$1.ZodNumber;
3737
+ toolCallsByType: z$1.ZodArray<z$1.ZodObject<{
3738
+ name: z$1.ZodString;
3739
+ callTokens: z$1.ZodNumber;
3740
+ resultTokens: z$1.ZodNumber;
3741
+ }, z$1.core.$strip>>;
3742
+ attachmentsByType: z$1.ZodArray<z$1.ZodObject<{
3743
+ name: z$1.ZodString;
3744
+ tokens: z$1.ZodNumber;
3745
+ }, z$1.core.$strip>>;
3746
+ }, z$1.core.$strip>>;
3747
+ systemPromptSections: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
3748
+ name: z$1.ZodString;
3749
+ tokens: z$1.ZodNumber;
3750
+ }, z$1.core.$strip>>>;
3751
+ apiUsage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
3752
+ inputTokens: z$1.ZodNumber;
3753
+ outputTokens: z$1.ZodNumber;
3754
+ cacheCreationInputTokens: z$1.ZodNumber;
3755
+ cacheReadInputTokens: z$1.ZodNumber;
3756
+ }, z$1.core.$strip>>>;
3729
3757
  }, z$1.core.$strict>;
3730
3758
  type GetContextUsageRequest = z$1.infer<typeof GetContextUsageRequestSchema>;
3731
3759
  type GetContextUsageResponse = z$1.infer<typeof GetContextUsageResponseSchema>;
3732
3760
  declare const GetContextDetailRequestSchema: z$1.ZodObject<{
3733
3761
  category: z$1.ZodString;
3762
+ summaryOnly: z$1.ZodOptional<z$1.ZodBoolean>;
3763
+ subcategory: z$1.ZodOptional<z$1.ZodString>;
3734
3764
  }, z$1.core.$strict>;
3735
3765
  declare const GetContextDetailResponseSchema: z$1.ZodObject<{
3736
3766
  items: z$1.ZodArray<z$1.ZodObject<{
@@ -3742,6 +3772,11 @@ declare const GetContextDetailResponseSchema: z$1.ZodObject<{
3742
3772
  }, z$1.core.$strip>>;
3743
3773
  category: z$1.ZodString;
3744
3774
  totalItems: z$1.ZodNumber;
3775
+ subcategories: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
3776
+ name: z$1.ZodString;
3777
+ label: z$1.ZodString;
3778
+ count: z$1.ZodNumber;
3779
+ }, z$1.core.$strip>>>;
3745
3780
  }, z$1.core.$strict>;
3746
3781
  type GetContextDetailRequest = z$1.infer<typeof GetContextDetailRequestSchema>;
3747
3782
  type GetContextDetailResponse = z$1.infer<typeof GetContextDetailResponseSchema>;
package/dist/index.d.mts CHANGED
@@ -3726,11 +3726,41 @@ declare const GetContextUsageResponseSchema: z$1.ZodObject<{
3726
3726
  tokens: z$1.ZodNumber;
3727
3727
  isLoaded: z$1.ZodOptional<z$1.ZodBoolean>;
3728
3728
  }, z$1.core.$strip>>;
3729
+ messageBreakdown: z$1.ZodOptional<z$1.ZodObject<{
3730
+ toolCallTokens: z$1.ZodNumber;
3731
+ toolResultTokens: z$1.ZodNumber;
3732
+ attachmentTokens: z$1.ZodNumber;
3733
+ assistantMessageTokens: z$1.ZodNumber;
3734
+ userMessageTokens: z$1.ZodNumber;
3735
+ redirectedContextTokens: z$1.ZodNumber;
3736
+ unattributedTokens: z$1.ZodNumber;
3737
+ toolCallsByType: z$1.ZodArray<z$1.ZodObject<{
3738
+ name: z$1.ZodString;
3739
+ callTokens: z$1.ZodNumber;
3740
+ resultTokens: z$1.ZodNumber;
3741
+ }, z$1.core.$strip>>;
3742
+ attachmentsByType: z$1.ZodArray<z$1.ZodObject<{
3743
+ name: z$1.ZodString;
3744
+ tokens: z$1.ZodNumber;
3745
+ }, z$1.core.$strip>>;
3746
+ }, z$1.core.$strip>>;
3747
+ systemPromptSections: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
3748
+ name: z$1.ZodString;
3749
+ tokens: z$1.ZodNumber;
3750
+ }, z$1.core.$strip>>>;
3751
+ apiUsage: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
3752
+ inputTokens: z$1.ZodNumber;
3753
+ outputTokens: z$1.ZodNumber;
3754
+ cacheCreationInputTokens: z$1.ZodNumber;
3755
+ cacheReadInputTokens: z$1.ZodNumber;
3756
+ }, z$1.core.$strip>>>;
3729
3757
  }, z$1.core.$strict>;
3730
3758
  type GetContextUsageRequest = z$1.infer<typeof GetContextUsageRequestSchema>;
3731
3759
  type GetContextUsageResponse = z$1.infer<typeof GetContextUsageResponseSchema>;
3732
3760
  declare const GetContextDetailRequestSchema: z$1.ZodObject<{
3733
3761
  category: z$1.ZodString;
3762
+ summaryOnly: z$1.ZodOptional<z$1.ZodBoolean>;
3763
+ subcategory: z$1.ZodOptional<z$1.ZodString>;
3734
3764
  }, z$1.core.$strict>;
3735
3765
  declare const GetContextDetailResponseSchema: z$1.ZodObject<{
3736
3766
  items: z$1.ZodArray<z$1.ZodObject<{
@@ -3742,6 +3772,11 @@ declare const GetContextDetailResponseSchema: z$1.ZodObject<{
3742
3772
  }, z$1.core.$strip>>;
3743
3773
  category: z$1.ZodString;
3744
3774
  totalItems: z$1.ZodNumber;
3775
+ subcategories: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
3776
+ name: z$1.ZodString;
3777
+ label: z$1.ZodString;
3778
+ count: z$1.ZodNumber;
3779
+ }, z$1.core.$strip>>>;
3745
3780
  }, z$1.core.$strict>;
3746
3781
  type GetContextDetailRequest = z$1.infer<typeof GetContextDetailRequestSchema>;
3747
3782
  type GetContextDetailResponse = z$1.infer<typeof GetContextDetailResponseSchema>;
package/dist/index.mjs CHANGED
@@ -2104,23 +2104,64 @@ const GetContextUsageResponseSchema = z$1.object({
2104
2104
  serverName: z$1.string(),
2105
2105
  tokens: z$1.number().int().nonnegative(),
2106
2106
  isLoaded: z$1.boolean().optional()
2107
- }))
2107
+ })),
2108
+ /** Messages 内部 token 细分(SDK messageBreakdown)。仅 SDK 0.2.139+ 返回。 */
2109
+ messageBreakdown: z$1.object({
2110
+ toolCallTokens: z$1.number().int().nonnegative(),
2111
+ toolResultTokens: z$1.number().int().nonnegative(),
2112
+ attachmentTokens: z$1.number().int().nonnegative(),
2113
+ assistantMessageTokens: z$1.number().int().nonnegative(),
2114
+ userMessageTokens: z$1.number().int().nonnegative(),
2115
+ redirectedContextTokens: z$1.number().int().nonnegative(),
2116
+ unattributedTokens: z$1.number().int().nonnegative(),
2117
+ toolCallsByType: z$1.array(z$1.object({
2118
+ name: z$1.string(),
2119
+ callTokens: z$1.number().int().nonnegative(),
2120
+ resultTokens: z$1.number().int().nonnegative()
2121
+ })),
2122
+ attachmentsByType: z$1.array(z$1.object({
2123
+ name: z$1.string(),
2124
+ tokens: z$1.number().int().nonnegative()
2125
+ }))
2126
+ }).optional(),
2127
+ /** System Prompt 各段 token 细分。 */
2128
+ systemPromptSections: z$1.array(z$1.object({
2129
+ name: z$1.string(),
2130
+ tokens: z$1.number().int().nonnegative()
2131
+ })).optional(),
2132
+ /** API 实际用量(input/output/cache hit/miss)。 */
2133
+ apiUsage: z$1.object({
2134
+ inputTokens: z$1.number().int().nonnegative(),
2135
+ outputTokens: z$1.number().int().nonnegative(),
2136
+ cacheCreationInputTokens: z$1.number().int().nonnegative(),
2137
+ cacheReadInputTokens: z$1.number().int().nonnegative()
2138
+ }).nullable().optional()
2108
2139
  }).strict();
2109
2140
  const GetContextDetailRequestSchema = z$1.object({
2110
2141
  /**
2111
2142
  * Category name from getContextUsage (e.g. "Messages", "System prompt",
2112
2143
  * "Skills", "Custom agents", "Autocompact buffer", "Memory files").
2113
2144
  */
2114
- category: z$1.string().min(1).max(128)
2145
+ category: z$1.string().min(1).max(128),
2146
+ /**
2147
+ * When true, return only subcategory counts (no item content).
2148
+ * Only meaningful for the "Messages" category.
2149
+ */
2150
+ summaryOnly: z$1.boolean().optional(),
2151
+ /**
2152
+ * Filter to a specific subcategory within "Messages".
2153
+ * One of: "user", "system-reminder", "assistant".
2154
+ */
2155
+ subcategory: z$1.string().optional()
2115
2156
  }).strict();
2116
2157
  const GetContextDetailResponseSchema = z$1.object({
2117
- /** Parsed JSONL records for the requested category. */
2158
+ /** Parsed JSONL records for the requested category. Empty when summaryOnly=true. */
2118
2159
  items: z$1.array(z$1.object({
2119
2160
  /** JSONL record type (user, assistant, attachment, system, summary, etc.) */
2120
2161
  type: z$1.string(),
2121
2162
  /** Role when applicable (user / assistant) */
2122
2163
  role: z$1.string().optional(),
2123
- /** Full text content of the record. Truncated at 10 KB per item. */
2164
+ /** Full text content of the record. Truncated at 50 KB per item. */
2124
2165
  content: z$1.string(),
2125
2166
  /** UUID of the JSONL record */
2126
2167
  uuid: z$1.string().optional(),
@@ -2130,7 +2171,19 @@ const GetContextDetailResponseSchema = z$1.object({
2130
2171
  /** Category name echoed back for display */
2131
2172
  category: z$1.string(),
2132
2173
  /** Total number of matching items */
2133
- totalItems: z$1.number().int().nonnegative()
2174
+ totalItems: z$1.number().int().nonnegative(),
2175
+ /**
2176
+ * Subcategory breakdown for "Messages" when summaryOnly=true.
2177
+ * Each entry has a key, display label, and item count.
2178
+ */
2179
+ subcategories: z$1.array(z$1.object({
2180
+ /** Subcategory key: "user" | "system-reminder" | "assistant" */
2181
+ name: z$1.string(),
2182
+ /** Human-readable label */
2183
+ label: z$1.string(),
2184
+ /** Number of items in this subcategory */
2185
+ count: z$1.number().int().nonnegative()
2186
+ })).optional()
2134
2187
  }).strict();
2135
2188
  const GetMcpServersRequestSchema = z$1.object({}).strict();
2136
2189
  const GetMcpServersResponseSchema = z$1.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmmao/happy-wire",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared message wire types and Zod schemas for Happy clients and services",
5
5
  "author": "kmmao",
6
6
  "license": "MIT",