@anthropic-ai/claude-code 1.0.108 → 1.0.109

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "main": "sdk.mjs",
5
5
  "types": "sdk.d.ts",
6
6
  "bin": {
package/sdk.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { MessageParam as APIUserMessage } from '@anthropic-ai/sdk/resources';
2
- import type { BetaMessage as APIAssistantMessage, BetaUsage as Usage } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';
2
+ import type { BetaMessage as APIAssistantMessage, BetaUsage as Usage, BetaRawMessageStreamEvent as RawMessageStreamEvent } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';
3
3
  import type { UUID } from 'crypto';
4
4
  import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
5
5
  import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
@@ -140,13 +140,16 @@ export type SessionEndHookInput = BaseHookInput & {
140
140
  reason: ExitReason;
141
141
  };
142
142
  export type HookInput = PreToolUseHookInput | PostToolUseHookInput | NotificationHookInput | UserPromptSubmitHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | SubagentStopHookInput | PreCompactHookInput;
143
- export interface HookJSONOutput {
143
+ export type AsyncHookJSONOutput = {
144
+ async: true;
145
+ asyncTimeout?: number;
146
+ };
147
+ export type SyncHookJSONOutput = {
144
148
  continue?: boolean;
145
149
  suppressOutput?: boolean;
146
150
  stopReason?: string;
147
151
  decision?: 'approve' | 'block';
148
152
  systemMessage?: string;
149
- permissionDecision?: 'allow' | 'deny' | 'ask';
150
153
  reason?: string;
151
154
  hookSpecificOutput?: {
152
155
  hookEventName: 'PreToolUse';
@@ -162,7 +165,8 @@ export interface HookJSONOutput {
162
165
  hookEventName: 'PostToolUse';
163
166
  additionalContext?: string;
164
167
  };
165
- }
168
+ };
169
+ export type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
166
170
  export type Options = {
167
171
  abortController?: AbortController;
168
172
  additionalDirectories?: string[];
@@ -179,6 +183,7 @@ export type Options = {
179
183
  extraArgs?: Record<string, string | null>;
180
184
  fallbackModel?: string;
181
185
  hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
186
+ includePartialMessages?: boolean;
182
187
  maxThinkingTokens?: number;
183
188
  maxTurns?: number;
184
189
  mcpServers?: Record<string, McpServerConfig>;
@@ -252,7 +257,20 @@ export type SDKSystemMessage = SDKMessageBase & {
252
257
  slash_commands: string[];
253
258
  output_style: string;
254
259
  };
255
- export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage;
260
+ export type SDKPartialAssistantMessage = SDKMessageBase & {
261
+ type: 'stream_event';
262
+ event: RawMessageStreamEvent;
263
+ parent_tool_use_id: string | null;
264
+ };
265
+ export type SDKCompactBoundaryMessage = SDKMessageBase & {
266
+ type: 'system';
267
+ subtype: 'compact_boundary';
268
+ compact_metadata: {
269
+ trigger: 'manual' | 'auto';
270
+ pre_tokens: number;
271
+ };
272
+ };
273
+ export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage;
256
274
  export interface Query extends AsyncGenerator<SDKMessage, void> {
257
275
  /**
258
276
  * Interrupt the query.
package/sdk.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
4
4
 
5
- // Version: 1.0.108
5
+ // Version: 1.0.109
6
6
 
7
7
  // Want to see the unminified source? We're hiring!
8
8
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
@@ -6315,6 +6315,9 @@ var NodeFsOperations = {
6315
6315
  },
6316
6316
  rmSync(path, options) {
6317
6317
  fs.rmSync(path, options);
6318
+ },
6319
+ createWriteStream(path) {
6320
+ return fs.createWriteStream(path);
6318
6321
  }
6319
6322
  };
6320
6323
  var activeFs = NodeFsOperations;
@@ -6368,7 +6371,8 @@ class ProcessTransport {
6368
6371
  disallowedTools = [],
6369
6372
  mcpServers,
6370
6373
  strictMcpConfig,
6371
- canUseTool
6374
+ canUseTool,
6375
+ includePartialMessages
6372
6376
  } = this.options;
6373
6377
  const args = ["--output-format", "stream-json", "--verbose"];
6374
6378
  if (customSystemPrompt)
@@ -6417,6 +6421,9 @@ class ProcessTransport {
6417
6421
  }
6418
6422
  args.push("--fallback-model", fallbackModel);
6419
6423
  }
6424
+ if (includePartialMessages) {
6425
+ args.push("--include-partial-messages");
6426
+ }
6420
6427
  if (typeof prompt === "string") {
6421
6428
  args.push("--print");
6422
6429
  args.push("--", prompt.trim());
@@ -6851,9 +6858,6 @@ class Query {
6851
6858
  this.handleControlCancelRequest(message);
6852
6859
  continue;
6853
6860
  }
6854
- if (message.type === "stream_event") {
6855
- continue;
6856
- }
6857
6861
  this.inputStream.enqueue(message);
6858
6862
  }
6859
6863
  this.inputStream.done();
@@ -13983,6 +13987,7 @@ function query({
13983
13987
  extraArgs = {},
13984
13988
  fallbackModel,
13985
13989
  hooks,
13990
+ includePartialMessages,
13986
13991
  maxTurns,
13987
13992
  mcpServers,
13988
13993
  model,
@@ -14046,7 +14051,8 @@ function query({
14046
14051
  mcpServers,
14047
14052
  strictMcpConfig,
14048
14053
  canUseTool: !!canUseTool,
14049
- hooks: !!hooks
14054
+ hooks: !!hooks,
14055
+ includePartialMessages
14050
14056
  });
14051
14057
  const query2 = new Query(transport, isStreamingMode, canUseTool, hooks, abortController, sdkMcpServers);
14052
14058
  if (typeof prompt !== "string") {
Binary file