@anthropic-ai/sdk 0.121.0 → 0.123.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/CHANGELOG.md +63 -0
- package/README.md +1 -1
- package/core/credentials.d.mts.map +1 -1
- package/core/credentials.d.ts.map +1 -1
- package/core/credentials.js +5 -7
- package/core/credentials.js.map +1 -1
- package/core/credentials.mjs +5 -7
- package/core/credentials.mjs.map +1 -1
- package/core/middleware.d.mts.map +1 -1
- package/core/middleware.d.ts.map +1 -1
- package/core/middleware.js +4 -4
- package/core/middleware.js.map +1 -1
- package/core/middleware.mjs +4 -4
- package/core/middleware.mjs.map +1 -1
- package/internal/errors.d.mts.map +1 -1
- package/internal/errors.d.ts.map +1 -1
- package/internal/errors.js +3 -1
- package/internal/errors.js.map +1 -1
- package/internal/errors.mjs +3 -1
- package/internal/errors.mjs.map +1 -1
- package/internal/file-store.d.mts.map +1 -1
- package/internal/file-store.d.ts.map +1 -1
- package/internal/file-store.js +23 -25
- package/internal/file-store.js.map +1 -1
- package/internal/file-store.mjs +5 -6
- package/internal/file-store.mjs.map +1 -1
- package/internal/node.browser.d.mts +9 -0
- package/internal/node.browser.d.mts.map +1 -0
- package/internal/node.browser.d.ts +9 -0
- package/internal/node.browser.d.ts.map +1 -0
- package/internal/node.browser.js +22 -0
- package/internal/node.browser.js.map +1 -0
- package/internal/node.browser.mjs +19 -0
- package/internal/node.browser.mjs.map +1 -0
- package/internal/node.d.mts +14 -0
- package/internal/node.d.mts.map +1 -0
- package/internal/node.d.ts +14 -0
- package/internal/node.d.ts.map +1 -0
- package/internal/node.js +24 -0
- package/internal/node.js.map +1 -0
- package/internal/node.mjs +14 -0
- package/internal/node.mjs.map +1 -0
- package/internal/parse.js +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/uploads.js +10 -6
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +10 -6
- package/internal/uploads.mjs.map +1 -1
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.js +3 -0
- package/lib/BetaMessageStream.js.map +1 -1
- package/lib/BetaMessageStream.mjs +3 -0
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/credentials/credential-chain.js +1 -1
- package/lib/credentials/credential-chain.js.map +1 -1
- package/lib/credentials/credential-chain.mjs +1 -1
- package/lib/credentials/credential-chain.mjs.map +1 -1
- package/lib/credentials/identity-token.js +1 -1
- package/lib/credentials/identity-token.js.map +1 -1
- package/lib/credentials/identity-token.mjs +1 -1
- package/lib/credentials/identity-token.mjs.map +1 -1
- package/lib/credentials/types.d.mts.map +1 -1
- package/lib/credentials/types.d.ts.map +1 -1
- package/lib/credentials/types.js +2 -3
- package/lib/credentials/types.js.map +1 -1
- package/lib/credentials/types.mjs +2 -3
- package/lib/credentials/types.mjs.map +1 -1
- package/lib/credentials/user-oauth.js +1 -1
- package/lib/credentials/user-oauth.js.map +1 -1
- package/lib/credentials/user-oauth.mjs +1 -1
- package/lib/credentials/user-oauth.mjs.map +1 -1
- package/lib/middleware.d.mts.map +1 -1
- package/lib/middleware.d.ts.map +1 -1
- package/lib/middleware.js +30 -7
- package/lib/middleware.js.map +1 -1
- package/lib/middleware.mjs +30 -7
- package/lib/middleware.mjs.map +1 -1
- package/lib/sessions/accumulate.d.mts +3 -2
- package/lib/sessions/accumulate.d.mts.map +1 -1
- package/lib/sessions/accumulate.d.ts +3 -2
- package/lib/sessions/accumulate.d.ts.map +1 -1
- package/lib/sessions/accumulate.js +3 -45
- package/lib/sessions/accumulate.js.map +1 -1
- package/lib/sessions/accumulate.mjs +3 -45
- package/lib/sessions/accumulate.mjs.map +1 -1
- package/package.json +3 -1
- package/resources/beta/agents/agents.d.mts +1 -1
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +1 -1
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/beta.d.mts +9 -9
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +9 -9
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/deployment-runs.d.mts +6 -6
- package/resources/beta/deployment-runs.d.ts +6 -6
- package/resources/beta/deployments.d.mts +3 -2
- package/resources/beta/deployments.d.mts.map +1 -1
- package/resources/beta/deployments.d.ts +3 -2
- package/resources/beta/deployments.d.ts.map +1 -1
- package/resources/beta/dreams.d.mts +28 -1
- package/resources/beta/dreams.d.mts.map +1 -1
- package/resources/beta/dreams.d.ts +28 -1
- package/resources/beta/dreams.d.ts.map +1 -1
- package/resources/beta/files.d.mts +25 -5
- package/resources/beta/files.d.mts.map +1 -1
- package/resources/beta/files.d.ts +25 -5
- package/resources/beta/files.d.ts.map +1 -1
- package/resources/beta/files.js +6 -6
- package/resources/beta/files.js.map +1 -1
- package/resources/beta/files.mjs +7 -7
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/index.d.mts +4 -4
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +4 -4
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/memory-stores/memories.d.mts +6 -4
- package/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/resources/beta/memory-stores/memories.d.ts +6 -4
- package/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/resources/beta/messages/index.d.mts +1 -1
- package/resources/beta/messages/index.d.mts.map +1 -1
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +148 -21
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +148 -21
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/organization/compliance-settings.d.mts +74 -0
- package/resources/beta/organization/compliance-settings.d.mts.map +1 -0
- package/resources/beta/organization/compliance-settings.d.ts +74 -0
- package/resources/beta/organization/compliance-settings.d.ts.map +1 -0
- package/resources/beta/organization/compliance-settings.js +52 -0
- package/resources/beta/organization/compliance-settings.js.map +1 -0
- package/resources/beta/organization/compliance-settings.mjs +48 -0
- package/resources/beta/organization/compliance-settings.mjs.map +1 -0
- package/resources/beta/organization/external-keys.d.mts +6 -3
- package/resources/beta/organization/external-keys.d.mts.map +1 -1
- package/resources/beta/organization/external-keys.d.ts +6 -3
- package/resources/beta/organization/external-keys.d.ts.map +1 -1
- package/resources/beta/organization/index.d.mts +1 -0
- package/resources/beta/organization/index.d.mts.map +1 -1
- package/resources/beta/organization/index.d.ts +1 -0
- package/resources/beta/organization/index.d.ts.map +1 -1
- package/resources/beta/organization/index.js +3 -1
- package/resources/beta/organization/index.js.map +1 -1
- package/resources/beta/organization/index.mjs +1 -0
- package/resources/beta/organization/index.mjs.map +1 -1
- package/resources/beta/organization/organization.d.mts +4 -0
- package/resources/beta/organization/organization.d.mts.map +1 -1
- package/resources/beta/organization/organization.d.ts +4 -0
- package/resources/beta/organization/organization.d.ts.map +1 -1
- package/resources/beta/organization/organization.js +4 -0
- package/resources/beta/organization/organization.js.map +1 -1
- package/resources/beta/organization/organization.mjs +4 -0
- package/resources/beta/organization/organization.mjs.map +1 -1
- package/resources/beta/organization/rate-limits.d.mts +2 -3
- package/resources/beta/organization/rate-limits.d.mts.map +1 -1
- package/resources/beta/organization/rate-limits.d.ts +2 -3
- package/resources/beta/organization/rate-limits.d.ts.map +1 -1
- package/resources/beta/organization/rate-limits.js +2 -3
- package/resources/beta/organization/rate-limits.js.map +1 -1
- package/resources/beta/organization/rate-limits.mjs +2 -3
- package/resources/beta/organization/rate-limits.mjs.map +1 -1
- package/resources/beta/organization/workspaces/rate-limits.d.mts +2 -3
- package/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -1
- package/resources/beta/organization/workspaces/rate-limits.d.ts +2 -3
- package/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -1
- package/resources/beta/organization/workspaces/rate-limits.js +2 -3
- package/resources/beta/organization/workspaces/rate-limits.js.map +1 -1
- package/resources/beta/organization/workspaces/rate-limits.mjs +2 -3
- package/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -1
- package/resources/beta/organization/workspaces/workspaces.d.mts +28 -12
- package/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -1
- package/resources/beta/organization/workspaces/workspaces.d.ts +28 -12
- package/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -1
- package/resources/beta/organization/workspaces/workspaces.js.map +1 -1
- package/resources/beta/organization/workspaces/workspaces.mjs.map +1 -1
- package/resources/beta/sessions/events.d.mts +1 -1
- package/resources/beta/sessions/events.d.ts +1 -1
- package/resources/beta/sessions/sessions.d.mts +10 -10
- package/resources/beta/sessions/sessions.d.ts +10 -10
- package/resources/beta/skills/index.d.mts +2 -2
- package/resources/beta/skills/index.d.mts.map +1 -1
- package/resources/beta/skills/index.d.ts +2 -2
- package/resources/beta/skills/index.d.ts.map +1 -1
- package/resources/beta/skills/index.js.map +1 -1
- package/resources/beta/skills/index.mjs.map +1 -1
- package/resources/beta/skills/skills.d.mts +48 -120
- package/resources/beta/skills/skills.d.mts.map +1 -1
- package/resources/beta/skills/skills.d.ts +48 -120
- package/resources/beta/skills/skills.d.ts.map +1 -1
- package/resources/beta/skills/skills.js +12 -8
- package/resources/beta/skills/skills.js.map +1 -1
- package/resources/beta/skills/skills.mjs +12 -8
- package/resources/beta/skills/skills.mjs.map +1 -1
- package/resources/beta/skills/versions.d.mts +35 -138
- package/resources/beta/skills/versions.d.mts.map +1 -1
- package/resources/beta/skills/versions.d.ts +35 -138
- package/resources/beta/skills/versions.d.ts.map +1 -1
- package/resources/beta/skills/versions.js +18 -18
- package/resources/beta/skills/versions.js.map +1 -1
- package/resources/beta/skills/versions.mjs +18 -18
- package/resources/beta/skills/versions.mjs.map +1 -1
- package/resources/beta/user-profiles.d.mts +21 -25
- package/resources/beta/user-profiles.d.mts.map +1 -1
- package/resources/beta/user-profiles.d.ts +21 -25
- package/resources/beta/user-profiles.d.ts.map +1 -1
- package/resources/beta/webhooks.d.mts +16 -17
- package/resources/beta/webhooks.d.mts.map +1 -1
- package/resources/beta/webhooks.d.ts +16 -17
- package/resources/beta/webhooks.d.ts.map +1 -1
- package/resources/beta/webhooks.js +21 -8
- package/resources/beta/webhooks.js.map +1 -1
- package/resources/beta/webhooks.mjs +21 -8
- package/resources/beta/webhooks.mjs.map +1 -1
- package/resources/messages/messages.d.mts +1 -3
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +1 -3
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs.map +1 -1
- package/src/core/credentials.ts +5 -7
- package/src/core/middleware.ts +4 -3
- package/src/internal/errors.ts +3 -1
- package/src/internal/file-store.ts +11 -10
- package/src/internal/node.browser.ts +22 -0
- package/src/internal/node.ts +14 -0
- package/src/internal/parse.ts +1 -1
- package/src/internal/uploads.ts +10 -7
- package/src/lib/BetaMessageStream.ts +4 -0
- package/src/lib/credentials/credential-chain.ts +1 -1
- package/src/lib/credentials/identity-token.ts +1 -1
- package/src/lib/credentials/types.ts +2 -3
- package/src/lib/credentials/user-oauth.ts +1 -1
- package/src/lib/middleware.ts +33 -9
- package/src/lib/sessions/accumulate.ts +7 -47
- package/src/resources/beta/agents/agents.ts +1 -0
- package/src/resources/beta/beta.ts +28 -15
- package/src/resources/beta/deployment-runs.ts +6 -6
- package/src/resources/beta/deployments.ts +3 -2
- package/src/resources/beta/dreams.ts +42 -0
- package/src/resources/beta/files.ts +34 -11
- package/src/resources/beta/index.ts +12 -7
- package/src/resources/beta/memory-stores/memories.ts +6 -4
- package/src/resources/beta/messages/index.ts +5 -1
- package/src/resources/beta/messages/messages.ts +171 -30
- package/src/resources/beta/organization/compliance-settings.ts +96 -0
- package/src/resources/beta/organization/external-keys.ts +6 -3
- package/src/resources/beta/organization/index.ts +9 -0
- package/src/resources/beta/organization/organization.ts +24 -0
- package/src/resources/beta/organization/rate-limits.ts +2 -3
- package/src/resources/beta/organization/workspaces/rate-limits.ts +2 -3
- package/src/resources/beta/organization/workspaces/workspaces.ts +28 -12
- package/src/resources/beta/sessions/events.ts +1 -1
- package/src/resources/beta/sessions/sessions.ts +10 -10
- package/src/resources/beta/skills/index.ts +7 -10
- package/src/resources/beta/skills/skills.ts +60 -150
- package/src/resources/beta/skills/versions.ts +43 -166
- package/src/resources/beta/user-profiles.ts +24 -27
- package/src/resources/beta/webhooks.ts +25 -29
- package/src/resources/messages/messages.ts +2 -8
- package/src/tools/agent-toolset/fs-util.ts +6 -5
- package/src/tools/agent-toolset/memories.ts +5 -3
- package/src/tools/agent-toolset/node.browser.ts +0 -4
- package/src/tools/agent-toolset/node.ts +118 -13
- package/src/tools/agent-toolset/skills.ts +10 -43
- package/src/version.ts +1 -1
- package/tools/agent-toolset/fs-util.d.mts.map +1 -1
- package/tools/agent-toolset/fs-util.d.ts.map +1 -1
- package/tools/agent-toolset/fs-util.js +13 -15
- package/tools/agent-toolset/fs-util.js.map +1 -1
- package/tools/agent-toolset/fs-util.mjs +3 -4
- package/tools/agent-toolset/fs-util.mjs.map +1 -1
- package/tools/agent-toolset/memories.d.mts.map +1 -1
- package/tools/agent-toolset/memories.d.ts.map +1 -1
- package/tools/agent-toolset/memories.js +6 -4
- package/tools/agent-toolset/memories.js.map +1 -1
- package/tools/agent-toolset/memories.mjs +5 -3
- package/tools/agent-toolset/memories.mjs.map +1 -1
- package/tools/agent-toolset/node.browser.d.mts +0 -1
- package/tools/agent-toolset/node.browser.d.mts.map +1 -1
- package/tools/agent-toolset/node.browser.d.ts +0 -1
- package/tools/agent-toolset/node.browser.d.ts.map +1 -1
- package/tools/agent-toolset/node.browser.js +0 -4
- package/tools/agent-toolset/node.browser.js.map +1 -1
- package/tools/agent-toolset/node.browser.mjs +0 -3
- package/tools/agent-toolset/node.browser.mjs.map +1 -1
- package/tools/agent-toolset/node.d.mts +9 -7
- package/tools/agent-toolset/node.d.mts.map +1 -1
- package/tools/agent-toolset/node.d.ts +9 -7
- package/tools/agent-toolset/node.d.ts.map +1 -1
- package/tools/agent-toolset/node.js +96 -8
- package/tools/agent-toolset/node.js.map +1 -1
- package/tools/agent-toolset/node.mjs +96 -7
- package/tools/agent-toolset/node.mjs.map +1 -1
- package/tools/agent-toolset/skills.d.mts +0 -8
- package/tools/agent-toolset/skills.d.mts.map +1 -1
- package/tools/agent-toolset/skills.d.ts +0 -8
- package/tools/agent-toolset/skills.d.ts.map +1 -1
- package/tools/agent-toolset/skills.js +20 -46
- package/tools/agent-toolset/skills.js.map +1 -1
- package/tools/agent-toolset/skills.mjs +9 -33
- package/tools/agent-toolset/skills.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/lib/middleware.ts
CHANGED
|
@@ -38,16 +38,17 @@ const DEFAULT_BETAS: readonly AnthropicBeta[] = ['fallback-credit-2026-07-01'];
|
|
|
38
38
|
* Remove `fallback` blocks replayed in history. They only parse under the
|
|
39
39
|
* server-side fallback beta, which belongs to the caller-owned server-side
|
|
40
40
|
* `fallbacks` feature — this middleware never sends it, so a request
|
|
41
|
-
* replaying them would 400.
|
|
41
|
+
* replaying them would 400. A turn the strip leaves empty is dropped whole;
|
|
42
|
+
* a turn that was already empty is kept — it may carry other payload (e.g. a
|
|
43
|
+
* directive-only system message's `output_config`).
|
|
42
44
|
*/
|
|
43
45
|
function stripFallbackBlocks(body: MessageCreateParams): MessageCreateParams {
|
|
44
|
-
const messages = body.messages
|
|
45
|
-
.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.filter((message) => !Array.isArray(message.content) || message.content.length > 0);
|
|
46
|
+
const messages = body.messages.flatMap((message) => {
|
|
47
|
+
if (!Array.isArray(message.content)) return [message];
|
|
48
|
+
const content = message.content.filter((block) => block.type !== 'fallback');
|
|
49
|
+
if (content.length === message.content.length) return [message];
|
|
50
|
+
return content.length > 0 ? [{ ...message, content }] : [];
|
|
51
|
+
});
|
|
51
52
|
return { ...body, messages };
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -453,6 +454,9 @@ async function* splicedEvents(
|
|
|
453
454
|
// The refusal whose token is currently in flight — surfaced verbatim (with a
|
|
454
455
|
// recommended_model added) if every fallback request fails and we degrade.
|
|
455
456
|
let refusalDetails = a.refused.stopDetails;
|
|
457
|
+
// That refused hop's suppressed message_start `input_transformations`, which
|
|
458
|
+
// ride on the surfaced refusal delta (none for A: its start reached the client).
|
|
459
|
+
let refusalInputTransformations = a.refused.inputTransformations;
|
|
456
460
|
|
|
457
461
|
// One `message` entry per refused hop, in order — A first. Failed hops are
|
|
458
462
|
// skipped (no usage came back); the serving hop is appended as
|
|
@@ -559,6 +563,9 @@ async function* splicedEvents(
|
|
|
559
563
|
stop_details: stopDetails,
|
|
560
564
|
},
|
|
561
565
|
usage: (lastUsage ?? {}) as BetaMessageDeltaUsage,
|
|
566
|
+
...(refusalInputTransformations !== undefined && {
|
|
567
|
+
input_transformations: refusalInputTransformations,
|
|
568
|
+
}),
|
|
562
569
|
});
|
|
563
570
|
yield emit<BetaRawMessageStopEvent>('message_stop', { type: 'message_stop' });
|
|
564
571
|
return;
|
|
@@ -580,6 +587,7 @@ async function* splicedEvents(
|
|
|
580
587
|
// continues.
|
|
581
588
|
token = b.refused.token;
|
|
582
589
|
refusalDetails = b.refused.stopDetails;
|
|
590
|
+
refusalInputTransformations = b.refused.inputTransformations;
|
|
583
591
|
base = continuation;
|
|
584
592
|
partial = b.refused.hasPrefillClaim ? toPrefillBlocks(b.blocks) : [];
|
|
585
593
|
iterations.push(toIterationUsage('message', model, b.refused.usage));
|
|
@@ -598,6 +606,12 @@ interface HopOutcome {
|
|
|
598
606
|
usage: BetaMessageDeltaUsage;
|
|
599
607
|
/** The refusal's stop_details verbatim, surfaced if the whole chain degrades. */
|
|
600
608
|
stopDetails: BetaRefusalStopDetails;
|
|
609
|
+
/**
|
|
610
|
+
* A spliced hop's suppressed message_start `input_transformations`, forwarded
|
|
611
|
+
* on the surfaced refusal delta if the whole chain degrades; `undefined` for
|
|
612
|
+
* stream A (its start reached the client) or when the start had none.
|
|
613
|
+
*/
|
|
614
|
+
inputTransformations: BetaMessage['input_transformations'] | undefined;
|
|
601
615
|
} | null;
|
|
602
616
|
/** The hop's serving model, from its message_start. */
|
|
603
617
|
model: string | undefined;
|
|
@@ -615,7 +629,8 @@ interface HopOutcome {
|
|
|
615
629
|
* spliced hop (`splice` set) has its message_start suppressed (the client
|
|
616
630
|
* already saw A's), its block indices shifted by `indexBase`, and its
|
|
617
631
|
* terminal message_delta's usage rewritten to the `usage.iterations`
|
|
618
|
-
* chain shape
|
|
632
|
+
* chain shape, with the suppressed message_start's `input_transformations`
|
|
633
|
+
* forwarded onto it.
|
|
619
634
|
*
|
|
620
635
|
* A refusal that can be chained — it carries a `fallback_credit_token` and a
|
|
621
636
|
* fallback entry remains — ends the hop early: open blocks are closed, the
|
|
@@ -638,6 +653,10 @@ async function* consumeHop(args: {
|
|
|
638
653
|
const tracker = new BlockTracker(indexBase);
|
|
639
654
|
let model: string | undefined;
|
|
640
655
|
let startUsage: BetaUsage | null = null;
|
|
656
|
+
// A spliced hop's message_start is suppressed, so its `input_transformations`
|
|
657
|
+
// must ride on the re-emitted terminal message_delta — the way a server-side
|
|
658
|
+
// fallback reports the serving model's list.
|
|
659
|
+
let startInputTransformations: BetaMessage['input_transformations'];
|
|
641
660
|
|
|
642
661
|
for await (const sse of Stream.rawEvents(response, controller)) {
|
|
643
662
|
const p = safeJSON(sse.data) as BetaRawMessageStreamEvent | undefined;
|
|
@@ -645,6 +664,7 @@ async function* consumeHop(args: {
|
|
|
645
664
|
case 'message_start': {
|
|
646
665
|
model = p.message.model;
|
|
647
666
|
startUsage = p.message.usage;
|
|
667
|
+
if ('input_transformations' in p.message) startInputTransformations = p.message.input_transformations;
|
|
648
668
|
if (splice) continue;
|
|
649
669
|
break;
|
|
650
670
|
}
|
|
@@ -687,6 +707,7 @@ async function* consumeHop(args: {
|
|
|
687
707
|
hasPrefillClaim: details.fallback_has_prefill_claim === true,
|
|
688
708
|
usage,
|
|
689
709
|
stopDetails: details,
|
|
710
|
+
inputTransformations: splice ? startInputTransformations : undefined,
|
|
690
711
|
},
|
|
691
712
|
model,
|
|
692
713
|
blocks: tracker.contentBlocks(),
|
|
@@ -721,6 +742,9 @@ async function* consumeHop(args: {
|
|
|
721
742
|
toIterationUsage('fallback_message', splice.model, usage),
|
|
722
743
|
];
|
|
723
744
|
p.usage = usage;
|
|
745
|
+
if (!('input_transformations' in p) && startInputTransformations !== undefined) {
|
|
746
|
+
p.input_transformations = startInputTransformations;
|
|
747
|
+
}
|
|
724
748
|
yield emit('message_delta', p);
|
|
725
749
|
continue;
|
|
726
750
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnthropicError } from '../../core/error';
|
|
2
|
-
import { checkNever } from '../../internal/utils/values';
|
|
3
2
|
import type {
|
|
4
3
|
BetaManagedAgentsAgentMessageEvent,
|
|
5
4
|
BetaManagedAgentsStreamSessionEvents,
|
|
@@ -19,10 +18,11 @@ export type AccumulatedEvent = BetaManagedAgentsAgentMessageEvent;
|
|
|
19
18
|
* fragment as a fresh content entry; an existing index returns a copy with
|
|
20
19
|
* that entry appended to. An unrecognised fragment type on an existing
|
|
21
20
|
* index passes the entry through unchanged — deltas are best-effort and the
|
|
22
|
-
* buffered final event is canonical
|
|
23
|
-
* exhaustiveness guard, matching `MessageStream#accumulateMessage`.
|
|
21
|
+
* buffered final event is canonical.
|
|
24
22
|
* - `agent.message` is the buffered final event: a copy of it is returned,
|
|
25
23
|
* replacing whatever the preview had accumulated.
|
|
24
|
+
* - Every other event type returns `accumulated` unchanged, so new event types
|
|
25
|
+
* added to the stream union need no change here.
|
|
26
26
|
*/
|
|
27
27
|
export function accumulateManagedAgentsEvent<T extends AccumulatedEvent>(
|
|
28
28
|
accumulated: AccumulatedEvent | undefined,
|
|
@@ -72,57 +72,17 @@ export function accumulateManagedAgentsEvent(
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
let updated = existing;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (existing.type === 'text') {
|
|
78
|
-
updated = { ...existing, text: existing.text + fragment.text };
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
checkNever(fragment.type);
|
|
75
|
+
if (fragment.type === 'text' && existing.type === 'text') {
|
|
76
|
+
updated = { ...existing, text: existing.text + fragment.text };
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
const content = accumulated.content.slice();
|
|
86
80
|
content[idx] = updated;
|
|
87
81
|
return { ...accumulated, content };
|
|
88
82
|
}
|
|
89
|
-
|
|
90
|
-
case 'user.interrupt':
|
|
91
|
-
case 'user.tool_confirmation':
|
|
92
|
-
case 'user.tool_result':
|
|
93
|
-
case 'user.custom_tool_result':
|
|
94
|
-
case 'user.define_outcome':
|
|
95
|
-
case 'agent.thinking':
|
|
96
|
-
case 'agent.tool_use':
|
|
97
|
-
case 'agent.tool_result':
|
|
98
|
-
case 'agent.custom_tool_use':
|
|
99
|
-
case 'agent.mcp_tool_use':
|
|
100
|
-
case 'agent.mcp_tool_result':
|
|
101
|
-
case 'agent.thread_message_received':
|
|
102
|
-
case 'agent.thread_message_sent':
|
|
103
|
-
case 'agent.thread_context_compacted':
|
|
104
|
-
case 'session.error':
|
|
105
|
-
case 'session.updated':
|
|
106
|
-
case 'session.deleted':
|
|
107
|
-
case 'session.usage':
|
|
108
|
-
case 'session.status_running':
|
|
109
|
-
case 'session.status_idle':
|
|
110
|
-
case 'session.status_rescheduled':
|
|
111
|
-
case 'session.status_terminated':
|
|
112
|
-
case 'session.thread_created':
|
|
113
|
-
case 'session.thread_status_running':
|
|
114
|
-
case 'session.thread_status_idle':
|
|
115
|
-
case 'session.thread_status_rescheduled':
|
|
116
|
-
case 'session.thread_status_terminated':
|
|
117
|
-
case 'span.model_request_start':
|
|
118
|
-
case 'span.model_request_end':
|
|
119
|
-
case 'span.outcome_evaluation_start':
|
|
120
|
-
case 'span.outcome_evaluation_ongoing':
|
|
121
|
-
case 'span.outcome_evaluation_end':
|
|
122
|
-
case 'system.message':
|
|
123
|
-
return accumulated;
|
|
83
|
+
|
|
124
84
|
default:
|
|
125
|
-
|
|
85
|
+
// Any other event, including types newer than this SDK, leaves the snapshot unchanged.
|
|
126
86
|
return accumulated;
|
|
127
87
|
}
|
|
128
88
|
}
|
|
@@ -88,10 +88,12 @@ import {
|
|
|
88
88
|
BetaDreamSessionsInput,
|
|
89
89
|
BetaDreamStatus,
|
|
90
90
|
BetaDreamUsage,
|
|
91
|
+
BetaDreamingError,
|
|
91
92
|
BetaDreamsPageCursor,
|
|
92
93
|
BetaOutputBehavior,
|
|
93
94
|
BetaOutputBehaviorCreateNew,
|
|
94
95
|
BetaOutputBehaviorUpdateExisting,
|
|
96
|
+
BetaTargetStoreHeldError,
|
|
95
97
|
DreamArchiveParams,
|
|
96
98
|
DreamCancelParams,
|
|
97
99
|
DreamCreateParams,
|
|
@@ -103,7 +105,7 @@ import * as FilesAPI from './files';
|
|
|
103
105
|
import {
|
|
104
106
|
BetaDeletedFile,
|
|
105
107
|
BetaFileMetadata,
|
|
106
|
-
|
|
108
|
+
BetaFileMetadataPageCursor,
|
|
107
109
|
BetaFileScope,
|
|
108
110
|
FileDeleteParams,
|
|
109
111
|
FileDownloadParams,
|
|
@@ -427,6 +429,7 @@ import {
|
|
|
427
429
|
BetaComputerZoomConfig,
|
|
428
430
|
BetaContainer,
|
|
429
431
|
BetaContainerParams,
|
|
432
|
+
BetaContainerSkill,
|
|
430
433
|
BetaContainerUploadBlock,
|
|
431
434
|
BetaContainerUploadBlockParam,
|
|
432
435
|
BetaContentBlock,
|
|
@@ -507,9 +510,9 @@ import {
|
|
|
507
510
|
BetaServerToolUseBlock,
|
|
508
511
|
BetaServerToolUseBlockParam,
|
|
509
512
|
BetaSignatureDelta,
|
|
510
|
-
BetaSkill,
|
|
511
513
|
BetaSkillParams,
|
|
512
514
|
BetaStopReason,
|
|
515
|
+
BetaSystemMessageOutputConfig,
|
|
513
516
|
BetaTextBlock,
|
|
514
517
|
BetaTextBlockParam,
|
|
515
518
|
BetaTextCitation,
|
|
@@ -526,12 +529,15 @@ import {
|
|
|
526
529
|
BetaTextEditorCodeExecutionViewResultBlock,
|
|
527
530
|
BetaTextEditorCodeExecutionViewResultBlockParam,
|
|
528
531
|
BetaThinkingBlock,
|
|
532
|
+
BetaThinkingBlockBinding,
|
|
529
533
|
BetaThinkingBlockParam,
|
|
530
534
|
BetaThinkingConfigAdaptive,
|
|
531
535
|
BetaThinkingConfigDisabled,
|
|
532
536
|
BetaThinkingConfigEnabled,
|
|
533
537
|
BetaThinkingConfigParam,
|
|
534
538
|
BetaThinkingDelta,
|
|
539
|
+
BetaThinkingDroppedInputTransformation,
|
|
540
|
+
BetaThinkingPrefixMismatchBehavior,
|
|
535
541
|
BetaThinkingTurns,
|
|
536
542
|
BetaTokenTaskBudget,
|
|
537
543
|
BetaTool,
|
|
@@ -644,15 +650,14 @@ import {
|
|
|
644
650
|
} from './sessions/sessions';
|
|
645
651
|
import * as SkillsAPI from './skills/skills';
|
|
646
652
|
import {
|
|
653
|
+
BetaDeletedSkill,
|
|
654
|
+
BetaSkill,
|
|
655
|
+
BetaSkillSource,
|
|
656
|
+
BetaSkillsPageCursor,
|
|
647
657
|
SkillCreateParams,
|
|
648
|
-
SkillCreateResponse,
|
|
649
658
|
SkillDeleteParams,
|
|
650
|
-
SkillDeleteResponse,
|
|
651
659
|
SkillListParams,
|
|
652
|
-
SkillListResponse,
|
|
653
|
-
SkillListResponsesPageCursor,
|
|
654
660
|
SkillRetrieveParams,
|
|
655
|
-
SkillRetrieveResponse,
|
|
656
661
|
Skills,
|
|
657
662
|
} from './skills/skills';
|
|
658
663
|
import * as TunnelsAPI from './tunnels/tunnels';
|
|
@@ -743,7 +748,10 @@ export type AnthropicBeta =
|
|
|
743
748
|
| 'structured-outputs-2025-11-13'
|
|
744
749
|
| 'task-budgets-2026-03-13'
|
|
745
750
|
| 'thinking-display-updates-2026-08-18'
|
|
746
|
-
| 'ce-user-management-2026-07-13'
|
|
751
|
+
| 'ce-user-management-2026-07-13'
|
|
752
|
+
| 'mid-conversation-output-config-2026-07-01'
|
|
753
|
+
| 'thinking-binding-controls-2026-08-01'
|
|
754
|
+
| 'mid-conversation-system-clear-at-2026-08-21';
|
|
747
755
|
|
|
748
756
|
export interface BetaAPIError {
|
|
749
757
|
message: string;
|
|
@@ -1017,6 +1025,7 @@ export declare namespace Beta {
|
|
|
1017
1025
|
type BetaComputerZoomConfig as BetaComputerZoomConfig,
|
|
1018
1026
|
type BetaContainer as BetaContainer,
|
|
1019
1027
|
type BetaContainerParams as BetaContainerParams,
|
|
1028
|
+
type BetaContainerSkill as BetaContainerSkill,
|
|
1020
1029
|
type BetaContainerUploadBlock as BetaContainerUploadBlock,
|
|
1021
1030
|
type BetaContainerUploadBlockParam as BetaContainerUploadBlockParam,
|
|
1022
1031
|
type BetaContentBlock as BetaContentBlock,
|
|
@@ -1099,9 +1108,9 @@ export declare namespace Beta {
|
|
|
1099
1108
|
type BetaServerToolUseBlock as BetaServerToolUseBlock,
|
|
1100
1109
|
type BetaServerToolUseBlockParam as BetaServerToolUseBlockParam,
|
|
1101
1110
|
type BetaSignatureDelta as BetaSignatureDelta,
|
|
1102
|
-
type BetaSkill as BetaSkill,
|
|
1103
1111
|
type BetaSkillParams as BetaSkillParams,
|
|
1104
1112
|
type BetaStopReason as BetaStopReason,
|
|
1113
|
+
type BetaSystemMessageOutputConfig as BetaSystemMessageOutputConfig,
|
|
1105
1114
|
type BetaTextBlock as BetaTextBlock,
|
|
1106
1115
|
type BetaTextBlockParam as BetaTextBlockParam,
|
|
1107
1116
|
type BetaTextCitation as BetaTextCitation,
|
|
@@ -1118,12 +1127,15 @@ export declare namespace Beta {
|
|
|
1118
1127
|
type BetaTextEditorCodeExecutionViewResultBlock as BetaTextEditorCodeExecutionViewResultBlock,
|
|
1119
1128
|
type BetaTextEditorCodeExecutionViewResultBlockParam as BetaTextEditorCodeExecutionViewResultBlockParam,
|
|
1120
1129
|
type BetaThinkingBlock as BetaThinkingBlock,
|
|
1130
|
+
type BetaThinkingBlockBinding as BetaThinkingBlockBinding,
|
|
1121
1131
|
type BetaThinkingBlockParam as BetaThinkingBlockParam,
|
|
1122
1132
|
type BetaThinkingConfigAdaptive as BetaThinkingConfigAdaptive,
|
|
1123
1133
|
type BetaThinkingConfigDisabled as BetaThinkingConfigDisabled,
|
|
1124
1134
|
type BetaThinkingConfigEnabled as BetaThinkingConfigEnabled,
|
|
1125
1135
|
type BetaThinkingConfigParam as BetaThinkingConfigParam,
|
|
1126
1136
|
type BetaThinkingDelta as BetaThinkingDelta,
|
|
1137
|
+
type BetaThinkingDroppedInputTransformation as BetaThinkingDroppedInputTransformation,
|
|
1138
|
+
type BetaThinkingPrefixMismatchBehavior as BetaThinkingPrefixMismatchBehavior,
|
|
1127
1139
|
type BetaThinkingTurns as BetaThinkingTurns,
|
|
1128
1140
|
type BetaTokenTaskBudget as BetaTokenTaskBudget,
|
|
1129
1141
|
type BetaTool as BetaTool,
|
|
@@ -1430,7 +1442,7 @@ export declare namespace Beta {
|
|
|
1430
1442
|
type BetaDeletedFile as BetaDeletedFile,
|
|
1431
1443
|
type BetaFileMetadata as BetaFileMetadata,
|
|
1432
1444
|
type BetaFileScope as BetaFileScope,
|
|
1433
|
-
type
|
|
1445
|
+
type BetaFileMetadataPageCursor as BetaFileMetadataPageCursor,
|
|
1434
1446
|
type FileListParams as FileListParams,
|
|
1435
1447
|
type FileDeleteParams as FileDeleteParams,
|
|
1436
1448
|
type FileDownloadParams as FileDownloadParams,
|
|
@@ -1440,11 +1452,10 @@ export declare namespace Beta {
|
|
|
1440
1452
|
|
|
1441
1453
|
export {
|
|
1442
1454
|
Skills as Skills,
|
|
1443
|
-
type
|
|
1444
|
-
type
|
|
1445
|
-
type
|
|
1446
|
-
type
|
|
1447
|
-
type SkillListResponsesPageCursor as SkillListResponsesPageCursor,
|
|
1455
|
+
type BetaDeletedSkill as BetaDeletedSkill,
|
|
1456
|
+
type BetaSkill as BetaSkill,
|
|
1457
|
+
type BetaSkillSource as BetaSkillSource,
|
|
1458
|
+
type BetaSkillsPageCursor as BetaSkillsPageCursor,
|
|
1448
1459
|
type SkillCreateParams as SkillCreateParams,
|
|
1449
1460
|
type SkillRetrieveParams as SkillRetrieveParams,
|
|
1450
1461
|
type SkillListParams as SkillListParams,
|
|
@@ -1528,9 +1539,11 @@ export declare namespace Beta {
|
|
|
1528
1539
|
type BetaDreamSessionsInput as BetaDreamSessionsInput,
|
|
1529
1540
|
type BetaDreamStatus as BetaDreamStatus,
|
|
1530
1541
|
type BetaDreamUsage as BetaDreamUsage,
|
|
1542
|
+
type BetaDreamingError as BetaDreamingError,
|
|
1531
1543
|
type BetaOutputBehavior as BetaOutputBehavior,
|
|
1532
1544
|
type BetaOutputBehaviorCreateNew as BetaOutputBehaviorCreateNew,
|
|
1533
1545
|
type BetaOutputBehaviorUpdateExisting as BetaOutputBehaviorUpdateExisting,
|
|
1546
|
+
type BetaTargetStoreHeldError as BetaTargetStoreHeldError,
|
|
1534
1547
|
type BetaDreamsPageCursor as BetaDreamsPageCursor,
|
|
1535
1548
|
type DreamCreateParams as DreamCreateParams,
|
|
1536
1549
|
type DreamRetrieveParams as DreamRetrieveParams,
|
|
@@ -130,8 +130,8 @@ export interface BetaManagedAgentsDeploymentRun {
|
|
|
130
130
|
| null;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* Populated on success. Null on creation failure. Exactly one of session_id or
|
|
134
|
-
* error is non-null.
|
|
133
|
+
* Populated on success. Null on creation failure. Exactly one of `session_id` or
|
|
134
|
+
* `error` is non-null.
|
|
135
135
|
*/
|
|
136
136
|
session_id: string | null;
|
|
137
137
|
|
|
@@ -389,14 +389,14 @@ export interface DeploymentRunListParams extends PageCursorParams {
|
|
|
389
389
|
|
|
390
390
|
/**
|
|
391
391
|
* Query param: Filter to a specific deployment. Omit to list across all
|
|
392
|
-
* deployments in the workspace. Filtering by a non-existent deployment_id
|
|
393
|
-
* 200 with empty data.
|
|
392
|
+
* deployments in the workspace. Filtering by a non-existent `deployment_id`
|
|
393
|
+
* returns 200 with empty data.
|
|
394
394
|
*/
|
|
395
395
|
deployment_id?: string;
|
|
396
396
|
|
|
397
397
|
/**
|
|
398
|
-
* Query param: Filter: true for runs with non-null error
|
|
399
|
-
* non-null session_id
|
|
398
|
+
* Query param: Filter: true for runs with non-null `error`, false for runs with
|
|
399
|
+
* non-null `session_id`. Omit for all.
|
|
400
400
|
*/
|
|
401
401
|
has_error?: boolean;
|
|
402
402
|
|
|
@@ -909,8 +909,9 @@ export interface DeploymentListParams extends PageCursorParams {
|
|
|
909
909
|
include_archived?: boolean;
|
|
910
910
|
|
|
911
911
|
/**
|
|
912
|
-
* Query param: Filter by status: active or paused
|
|
913
|
-
* archived deployments, use include_archived instead; the two cannot be
|
|
912
|
+
* Query param: Filter by status: `active` or `paused`. Omit for both. To include
|
|
913
|
+
* archived deployments, use `include_archived` instead; the two cannot be
|
|
914
|
+
* combined.
|
|
914
915
|
*/
|
|
915
916
|
status?: BetaManagedAgentsDeploymentStatus;
|
|
916
917
|
|
|
@@ -320,6 +320,27 @@ export interface BetaDreamUsage {
|
|
|
320
320
|
output_tokens: number;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
/**
|
|
324
|
+
* The `output_behavior.memory_store_id` target is still held by a prior
|
|
325
|
+
* `{type: "update_existing"}` dream — one that is `pending` or `running`, or was
|
|
326
|
+
* canceled with its final writes still landing. Rarely the named dream has just
|
|
327
|
+
* finished (`completed`/`failed`) and its execution is still closing; an immediate
|
|
328
|
+
* retry then almost always succeeds. The message names the holding dream when the
|
|
329
|
+
* server can identify it (rarely omitted); poll it to a terminal state or cancel
|
|
330
|
+
* it, then retry. Carried with `x-should-retry: false`.
|
|
331
|
+
*/
|
|
332
|
+
export type BetaDreamingError =
|
|
333
|
+
| BetaAPI.BetaInvalidRequestError
|
|
334
|
+
| BetaAPI.BetaAuthenticationError
|
|
335
|
+
| BetaAPI.BetaBillingError
|
|
336
|
+
| BetaAPI.BetaPermissionError
|
|
337
|
+
| BetaAPI.BetaNotFoundError
|
|
338
|
+
| BetaAPI.BetaRateLimitError
|
|
339
|
+
| BetaAPI.BetaGatewayTimeoutError
|
|
340
|
+
| BetaAPI.BetaAPIError
|
|
341
|
+
| BetaAPI.BetaOverloadedError
|
|
342
|
+
| BetaTargetStoreHeldError;
|
|
343
|
+
|
|
323
344
|
/**
|
|
324
345
|
* The default destination: the job creates a new output memory store as a clone of
|
|
325
346
|
* the memory_store input and writes the consolidated memories into it. The input
|
|
@@ -347,6 +368,25 @@ export interface BetaOutputBehaviorUpdateExisting {
|
|
|
347
368
|
type: 'update_existing';
|
|
348
369
|
}
|
|
349
370
|
|
|
371
|
+
/**
|
|
372
|
+
* The `output_behavior.memory_store_id` target is still held by a prior
|
|
373
|
+
* `{type: "update_existing"}` dream — one that is `pending` or `running`, or was
|
|
374
|
+
* canceled with its final writes still landing. Rarely the named dream has just
|
|
375
|
+
* finished (`completed`/`failed`) and its execution is still closing; an immediate
|
|
376
|
+
* retry then almost always succeeds. The message names the holding dream when the
|
|
377
|
+
* server can identify it (rarely omitted); poll it to a terminal state or cancel
|
|
378
|
+
* it, then retry. Carried with `x-should-retry: false`.
|
|
379
|
+
*/
|
|
380
|
+
export interface BetaTargetStoreHeldError {
|
|
381
|
+
type: 'conflict_error';
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Human-readable description of the conflict, naming the dream that holds the
|
|
385
|
+
* target store when the server can identify it.
|
|
386
|
+
*/
|
|
387
|
+
message?: string;
|
|
388
|
+
}
|
|
389
|
+
|
|
350
390
|
export interface DreamCreateParams {
|
|
351
391
|
/**
|
|
352
392
|
* Body param
|
|
@@ -440,9 +480,11 @@ export declare namespace Dreams {
|
|
|
440
480
|
type BetaDreamSessionsInput as BetaDreamSessionsInput,
|
|
441
481
|
type BetaDreamStatus as BetaDreamStatus,
|
|
442
482
|
type BetaDreamUsage as BetaDreamUsage,
|
|
483
|
+
type BetaDreamingError as BetaDreamingError,
|
|
443
484
|
type BetaOutputBehavior as BetaOutputBehavior,
|
|
444
485
|
type BetaOutputBehaviorCreateNew as BetaOutputBehaviorCreateNew,
|
|
445
486
|
type BetaOutputBehaviorUpdateExisting as BetaOutputBehaviorUpdateExisting,
|
|
487
|
+
type BetaTargetStoreHeldError as BetaTargetStoreHeldError,
|
|
446
488
|
type BetaDreamsPageCursor as BetaDreamsPageCursor,
|
|
447
489
|
type DreamCreateParams as DreamCreateParams,
|
|
448
490
|
type DreamRetrieveParams as DreamRetrieveParams,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as BetaAPI from './beta';
|
|
5
5
|
import { APIPromise } from '../../core/api-promise';
|
|
6
|
-
import {
|
|
6
|
+
import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination';
|
|
7
7
|
import { type Uploadable } from '../../core/uploads';
|
|
8
8
|
import { buildHeaders } from '../../internal/headers';
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
@@ -26,13 +26,13 @@ export class Files extends APIResource {
|
|
|
26
26
|
list(
|
|
27
27
|
params: FileListParams | null | undefined = {},
|
|
28
28
|
options?: RequestOptions,
|
|
29
|
-
): PagePromise<
|
|
29
|
+
): PagePromise<BetaFileMetadataPageCursor, BetaFileMetadata> {
|
|
30
30
|
const { betas, ...query } = params ?? {};
|
|
31
|
-
return this._client.getAPIList('/v1/files?beta=true',
|
|
31
|
+
return this._client.getAPIList('/v1/files?beta=true', PageCursor<BetaFileMetadata>, {
|
|
32
32
|
query,
|
|
33
33
|
...options,
|
|
34
34
|
headers: buildHeaders([
|
|
35
|
-
{
|
|
35
|
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
|
36
36
|
options?.headers,
|
|
37
37
|
]),
|
|
38
38
|
});
|
|
@@ -57,7 +57,7 @@ export class Files extends APIResource {
|
|
|
57
57
|
return this._client.delete(path`/v1/files/${fileID}?beta=true`, {
|
|
58
58
|
...options,
|
|
59
59
|
headers: buildHeaders([
|
|
60
|
-
{
|
|
60
|
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
|
61
61
|
options?.headers,
|
|
62
62
|
]),
|
|
63
63
|
});
|
|
@@ -86,8 +86,8 @@ export class Files extends APIResource {
|
|
|
86
86
|
...options,
|
|
87
87
|
headers: buildHeaders([
|
|
88
88
|
{
|
|
89
|
-
'anthropic-beta': [...(betas ?? []), 'files-api-2025-04-14'].toString(),
|
|
90
89
|
Accept: 'application/binary',
|
|
90
|
+
...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
|
|
91
91
|
},
|
|
92
92
|
options?.headers,
|
|
93
93
|
]),
|
|
@@ -113,7 +113,7 @@ export class Files extends APIResource {
|
|
|
113
113
|
return this._client.get(path`/v1/files/${fileID}?beta=true`, {
|
|
114
114
|
...options,
|
|
115
115
|
headers: buildHeaders([
|
|
116
|
-
{
|
|
116
|
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
|
117
117
|
options?.headers,
|
|
118
118
|
]),
|
|
119
119
|
});
|
|
@@ -139,7 +139,7 @@ export class Files extends APIResource {
|
|
|
139
139
|
body,
|
|
140
140
|
...options,
|
|
141
141
|
headers: buildHeaders([
|
|
142
|
-
{
|
|
142
|
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
|
143
143
|
stainlessHelperHeaderFromFile(body.file),
|
|
144
144
|
options?.headers,
|
|
145
145
|
]),
|
|
@@ -150,7 +150,7 @@ export class Files extends APIResource {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
export type
|
|
153
|
+
export type BetaFileMetadataPageCursor = PageCursor<BetaFileMetadata>;
|
|
154
154
|
|
|
155
155
|
export interface BetaDeletedFile {
|
|
156
156
|
/**
|
|
@@ -206,6 +206,13 @@ export interface BetaFileMetadata {
|
|
|
206
206
|
*/
|
|
207
207
|
downloadable?: boolean;
|
|
208
208
|
|
|
209
|
+
/**
|
|
210
|
+
* RFC 3339 datetime string representing when the file will expire and become
|
|
211
|
+
* unavailable for download. Null if the file does not expire. For files uploaded
|
|
212
|
+
* with `expires_in_seconds`, this is the upload time plus that value.
|
|
213
|
+
*/
|
|
214
|
+
expires_at?: string | null;
|
|
215
|
+
|
|
209
216
|
/**
|
|
210
217
|
* The scope of this file, indicating the context in which it was created (e.g., a
|
|
211
218
|
* session).
|
|
@@ -225,7 +232,16 @@ export interface BetaFileScope {
|
|
|
225
232
|
type: 'session';
|
|
226
233
|
}
|
|
227
234
|
|
|
228
|
-
export interface FileListParams extends
|
|
235
|
+
export interface FileListParams extends PageCursorParams {
|
|
236
|
+
/**
|
|
237
|
+
* Query param: Restrict the result set to Files whose `id` is in this list. At
|
|
238
|
+
* most 100 entries (after de-duplication). Mutually exclusive with `page` and
|
|
239
|
+
* `limit`. When supplied, the response is always a single page (`next_page` is
|
|
240
|
+
* null). IDs that do not resolve to a visible File — including deleted Files — are
|
|
241
|
+
* silently omitted.
|
|
242
|
+
*/
|
|
243
|
+
ids?: Array<string> | null;
|
|
244
|
+
|
|
229
245
|
/**
|
|
230
246
|
* Query param: Filter by scope ID. Only returns files associated with the
|
|
231
247
|
* specified scope (e.g., a session ID).
|
|
@@ -265,6 +281,13 @@ export interface FileUploadParams {
|
|
|
265
281
|
*/
|
|
266
282
|
file: Uploadable;
|
|
267
283
|
|
|
284
|
+
/**
|
|
285
|
+
* Body param: Seconds from upload until the file expires and its bytes become
|
|
286
|
+
* permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety
|
|
287
|
+
* days).
|
|
288
|
+
*/
|
|
289
|
+
expires_in_seconds?: number;
|
|
290
|
+
|
|
268
291
|
/**
|
|
269
292
|
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
270
293
|
*/
|
|
@@ -276,7 +299,7 @@ export declare namespace Files {
|
|
|
276
299
|
type BetaDeletedFile as BetaDeletedFile,
|
|
277
300
|
type BetaFileMetadata as BetaFileMetadata,
|
|
278
301
|
type BetaFileScope as BetaFileScope,
|
|
279
|
-
type
|
|
302
|
+
type BetaFileMetadataPageCursor as BetaFileMetadataPageCursor,
|
|
280
303
|
type FileListParams as FileListParams,
|
|
281
304
|
type FileDeleteParams as FileDeleteParams,
|
|
282
305
|
type FileDownloadParams as FileDownloadParams,
|
|
@@ -173,9 +173,11 @@ export {
|
|
|
173
173
|
type BetaDreamSessionsInput,
|
|
174
174
|
type BetaDreamStatus,
|
|
175
175
|
type BetaDreamUsage,
|
|
176
|
+
type BetaDreamingError,
|
|
176
177
|
type BetaOutputBehavior,
|
|
177
178
|
type BetaOutputBehaviorCreateNew,
|
|
178
179
|
type BetaOutputBehaviorUpdateExisting,
|
|
180
|
+
type BetaTargetStoreHeldError,
|
|
179
181
|
type DreamCreateParams,
|
|
180
182
|
type DreamRetrieveParams,
|
|
181
183
|
type DreamListParams,
|
|
@@ -214,7 +216,7 @@ export {
|
|
|
214
216
|
type FileDownloadParams,
|
|
215
217
|
type FileRetrieveMetadataParams,
|
|
216
218
|
type FileUploadParams,
|
|
217
|
-
type
|
|
219
|
+
type BetaFileMetadataPageCursor,
|
|
218
220
|
} from './files';
|
|
219
221
|
export {
|
|
220
222
|
MemoryStores,
|
|
@@ -357,6 +359,7 @@ export {
|
|
|
357
359
|
type BetaComputerZoomConfig,
|
|
358
360
|
type BetaContainer,
|
|
359
361
|
type BetaContainerParams,
|
|
362
|
+
type BetaContainerSkill,
|
|
360
363
|
type BetaContainerUploadBlock,
|
|
361
364
|
type BetaContainerUploadBlockParam,
|
|
362
365
|
type BetaContentBlock,
|
|
@@ -440,9 +443,9 @@ export {
|
|
|
440
443
|
type BetaServerToolUseBlock,
|
|
441
444
|
type BetaServerToolUseBlockParam,
|
|
442
445
|
type BetaSignatureDelta,
|
|
443
|
-
type BetaSkill,
|
|
444
446
|
type BetaSkillParams,
|
|
445
447
|
type BetaStopReason,
|
|
448
|
+
type BetaSystemMessageOutputConfig,
|
|
446
449
|
type BetaTextBlock,
|
|
447
450
|
type BetaTextBlockParam,
|
|
448
451
|
type BetaTextCitation,
|
|
@@ -459,12 +462,15 @@ export {
|
|
|
459
462
|
type BetaTextEditorCodeExecutionViewResultBlock,
|
|
460
463
|
type BetaTextEditorCodeExecutionViewResultBlockParam,
|
|
461
464
|
type BetaThinkingBlock,
|
|
465
|
+
type BetaThinkingBlockBinding,
|
|
462
466
|
type BetaThinkingBlockParam,
|
|
463
467
|
type BetaThinkingConfigAdaptive,
|
|
464
468
|
type BetaThinkingConfigDisabled,
|
|
465
469
|
type BetaThinkingConfigEnabled,
|
|
466
470
|
type BetaThinkingConfigParam,
|
|
467
471
|
type BetaThinkingDelta,
|
|
472
|
+
type BetaThinkingDroppedInputTransformation,
|
|
473
|
+
type BetaThinkingPrefixMismatchBehavior,
|
|
468
474
|
type BetaThinkingTurns,
|
|
469
475
|
type BetaTokenTaskBudget,
|
|
470
476
|
type BetaTool,
|
|
@@ -595,15 +601,14 @@ export {
|
|
|
595
601
|
} from './sessions/index';
|
|
596
602
|
export {
|
|
597
603
|
Skills,
|
|
598
|
-
type
|
|
599
|
-
type
|
|
600
|
-
type
|
|
601
|
-
type SkillDeleteResponse,
|
|
604
|
+
type BetaDeletedSkill,
|
|
605
|
+
type BetaSkill,
|
|
606
|
+
type BetaSkillSource,
|
|
602
607
|
type SkillCreateParams,
|
|
603
608
|
type SkillRetrieveParams,
|
|
604
609
|
type SkillListParams,
|
|
605
610
|
type SkillDeleteParams,
|
|
606
|
-
type
|
|
611
|
+
type BetaSkillsPageCursor,
|
|
607
612
|
} from './skills/index';
|
|
608
613
|
export {
|
|
609
614
|
Tunnels,
|