@clearideas/agent-runtime-model-ai-sdk 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -29,3 +29,14 @@ functions in `createProviderRegistryModelResolver`.
29
29
  The adapter supports generation, text and reasoning deltas, structured object
30
30
  output, tool-call conversion, usage, provider metadata, and abort signals.
31
31
  Agent Runtime executes tool calls sequentially.
32
+
33
+ Anthropic 4.0.72 and newer emit an `anthropic.message_start` custom part with
34
+ stream metadata. The adapter omits this metadata-only part from replayable
35
+ assistant content while preserving ordinary content, token usage, and provider
36
+ options. Older provider versions that do not emit this part remain supported.
37
+
38
+ Other custom parts remain unsupported and raise an error. In particular,
39
+ Anthropic server-side fallback blocks carry replay semantics and are not
40
+ silently discarded. Replaying those blocks requires an extension to the
41
+ runtime's content contracts; this compatibility fix does not enable that
42
+ feature.
@@ -27,7 +27,12 @@ const defaultGenerateText = async (options) => {
27
27
  return result;
28
28
  };
29
29
  const defaultStreamText = (options) => {
30
- const result = streamText(options);
30
+ const result = streamText({
31
+ ...options,
32
+ // The adapter propagates fullStream error parts to the runtime. Disable
33
+ // the SDK's default console.error handler to avoid duplicate stderr output.
34
+ onError: () => { },
35
+ });
31
36
  return result;
32
37
  };
33
38
  const combinedProviderOptions = (message) => {
@@ -551,7 +556,15 @@ function fromAiSdkResponseMessage(message, id, createdAt, model) {
551
556
  const rawContent = typeof message.content === "string"
552
557
  ? [{ type: "text", text: message.content }]
553
558
  : message.content;
554
- const content = rawContent.map((rawPart) => {
559
+ // Anthropic's message-start part carries bookkeeping, not replay content.
560
+ // Other custom parts can carry semantics such as fallback boundaries.
561
+ const replayContent = rawContent.filter((rawPart) => {
562
+ const part = rawPart;
563
+ return !(message.role === "assistant" &&
564
+ part.type === "custom" &&
565
+ part.kind === "anthropic.message_start");
566
+ });
567
+ const content = replayContent.map((rawPart) => {
555
568
  const part = rawPart;
556
569
  switch (part.type) {
557
570
  case "text":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearideas/agent-runtime-model-ai-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "AI SDK model adapter for the vendor-neutral Clear Ideas Agent Runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Clear Ideas Incorporated",
@@ -36,8 +36,8 @@
36
36
  "postpack": "node ../../scripts/cleanup-package-license.mjs"
37
37
  },
38
38
  "dependencies": {
39
- "@clearideas/agent-runtime-contracts": "0.6.0",
40
- "@clearideas/agent-runtime-core": "0.6.0",
39
+ "@clearideas/agent-runtime-contracts": "0.6.1",
40
+ "@clearideas/agent-runtime-core": "0.6.1",
41
41
  "ai": "^7.0.98"
42
42
  },
43
43
  "devDependencies": {