@decocms/runtime 1.4.0 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/runtime",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
package/src/bindings.ts CHANGED
@@ -161,7 +161,10 @@ export const AgentOf = () =>
161
161
  thinking: AgentModelInfoSchema.optional(),
162
162
  coding: AgentModelInfoSchema.optional(),
163
163
  fast: AgentModelInfoSchema.optional(),
164
- toolApprovalLevel: z.enum(["auto", "readonly", "plan"]).default("auto"),
164
+ toolApprovalLevel: z.enum(["auto", "readonly"]).default("auto"),
165
+ mode: z
166
+ .enum(["default", "plan", "web-search", "gen-image"])
167
+ .default("default"),
165
168
  temperature: z.number().default(0.5),
166
169
  });
167
170
 
package/src/decopilot.ts CHANGED
@@ -31,7 +31,9 @@ export interface AgentBindingConfig {
31
31
  thinking?: AgentModelInfo;
32
32
  coding?: AgentModelInfo;
33
33
  fast?: AgentModelInfo;
34
- toolApprovalLevel?: "auto" | "readonly" | "plan";
34
+ toolApprovalLevel?: "auto" | "readonly";
35
+ /** Decopilot stream mode — default, plan, web-search, gen-image */
36
+ mode?: "default" | "plan" | "web-search" | "gen-image";
35
37
  temperature?: number;
36
38
  }
37
39
 
@@ -45,7 +47,9 @@ export interface AgentStreamParams {
45
47
  thinking?: AgentModelInfo;
46
48
  coding?: AgentModelInfo;
47
49
  fast?: AgentModelInfo;
48
- toolApprovalLevel?: "auto" | "readonly" | "plan";
50
+ toolApprovalLevel?: "auto" | "readonly";
51
+ /** Decopilot stream mode — default, plan, web-search, gen-image */
52
+ mode?: "default" | "plan" | "web-search" | "gen-image";
49
53
  temperature?: number;
50
54
  memory?: { windowSize: number; thread_id: string };
51
55
  thread_id?: string;
@@ -126,6 +130,7 @@ export async function streamAgent(
126
130
  agent: { id: agentId },
127
131
  temperature: params.temperature ?? config.temperature,
128
132
  toolApprovalLevel: params.toolApprovalLevel ?? config.toolApprovalLevel,
133
+ mode: params.mode ?? config.mode ?? "default",
129
134
  ...(params.memory ? { memory: params.memory } : {}),
130
135
  ...(params.thread_id ? { thread_id: params.thread_id } : {}),
131
136
  };
@@ -188,6 +193,7 @@ export function createDecopilotClient(options: DecopilotClientOptions) {
188
193
  coding: request.coding,
189
194
  fast: request.fast,
190
195
  toolApprovalLevel: request.toolApprovalLevel,
196
+ mode: request.mode,
191
197
  temperature: request.temperature,
192
198
  };
193
199
  return streamAgent(streamUrl, token, config, request, opts);
package/src/tools.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
9
  import { WebStandardStreamableHTTPServerTransport as HttpServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
10
10
  import type {
11
+ CallToolResult,
11
12
  GetPromptResult,
12
13
  Implementation,
13
14
  ToolAnnotations,
@@ -957,6 +958,22 @@ export const createMCPServer = <
957
958
  ctx,
958
959
  );
959
960
 
961
+ if (
962
+ result != null &&
963
+ typeof result === "object" &&
964
+ "content" in result &&
965
+ Array.isArray(result.content) &&
966
+ result.content.every(
967
+ (item: unknown) =>
968
+ item != null &&
969
+ typeof item === "object" &&
970
+ "type" in item &&
971
+ typeof (item as Record<string, unknown>).type === "string",
972
+ )
973
+ ) {
974
+ return result as CallToolResult;
975
+ }
976
+
960
977
  return {
961
978
  structuredContent: result as Record<string, unknown>,
962
979
  content: [