@ai-sdk/harness-deepagents 1.0.63 → 1.0.64

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.
@@ -11,6 +11,7 @@ export const outboundMessageSchema = harnessV1BridgeOutboundMessageSchema;
11
11
  export type OutboundMessage = z.infer<typeof outboundMessageSchema>;
12
12
 
13
13
  export const startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
14
+ mcpServers: z.record(z.string(), z.unknown()).optional(),
14
15
  // Prepended to the first user message (createDeepAgent takes no instructions param).
15
16
  instructions: z.string().optional(),
16
17
  // In-backend skills source dirs ($HOME and <workDir>), passed to createDeepAgent({ skills }).
@@ -96,11 +96,21 @@ export type DeepAgentsHarnessSettings = {
96
96
  readonly port?: number;
97
97
  /** Maximum milliseconds to wait for the bridge to advertise its port. Defaults to 120000. */
98
98
  readonly startupTimeoutMs?: number;
99
+ /**
100
+ * Creates the authentication token used by the sandbox bridge. Defaults to
101
+ * a random 32-byte hexadecimal token.
102
+ */
103
+ readonly mintBridgeToken?: (sandboxId: string) => string;
99
104
  /**
100
105
  * Maximum LangGraph super-steps per turn before it errors.
101
106
  * When omitted, the Deep Agents default applies.
102
107
  */
103
108
  readonly recursionLimit?: number;
109
+ /**
110
+ * MCP server definitions keyed by server name. Each definition uses the
111
+ * underlying runtime's native MCP server configuration format.
112
+ */
113
+ readonly mcpServers?: Record<string, unknown>;
104
114
  };
105
115
 
106
116
  // Every model-callable DeepAgents built-in, keyed by what the bridge emits (commonName ?? nativeName); all must be listed or AI SDK throws AI_NoSuchToolError.
@@ -278,6 +288,7 @@ export function createDeepAgents(
278
288
  permissionMode,
279
289
  builtinToolFiltering: startOpts.builtinToolFiltering,
280
290
  recursionLimit: settings.recursionLimit,
291
+ mcpServers: settings.mcpServers,
281
292
  });
282
293
  } catch {
283
294
  // Bridge no longer reachable — recover by respawning below.
@@ -285,7 +296,10 @@ export function createDeepAgents(
285
296
  }
286
297
 
287
298
  const port = resolveBridgePort(sandboxSession, settings.port);
288
- const token = randomBytes(32).toString('hex');
299
+ const token =
300
+ settings.mintBridgeToken == null
301
+ ? randomBytes(32).toString('hex')
302
+ : settings.mintBridgeToken(sandboxId);
289
303
 
290
304
  // Always discover repo-provided skills under <workDir>/.agents/skills (e.g. a cloned repo); a missing dir is tolerated by deepagents.
291
305
  // Absolute paths: LocalShellBackend (non-virtual) treats a leading-slash path as a real fs path.
@@ -393,6 +407,7 @@ export function createDeepAgents(
393
407
  permissionMode,
394
408
  builtinToolFiltering: startOpts.builtinToolFiltering,
395
409
  recursionLimit: settings.recursionLimit,
410
+ mcpServers: settings.mcpServers,
396
411
  });
397
412
  },
398
413
  };
@@ -490,6 +505,7 @@ function createSession({
490
505
  permissionMode,
491
506
  builtinToolFiltering,
492
507
  recursionLimit,
508
+ mcpServers,
493
509
  }: {
494
510
  sessionId: string;
495
511
  channel: DeepAgentsChannel;
@@ -508,6 +524,7 @@ function createSession({
508
524
  permissionMode?: HarnessV1PermissionMode;
509
525
  builtinToolFiltering?: HarnessV1BuiltinToolFiltering;
510
526
  recursionLimit?: number;
527
+ mcpServers?: Record<string, unknown>;
511
528
  }): HarnessV1Session {
512
529
  let stopped = false;
513
530
  let instructionsApplied = attached;
@@ -665,6 +682,7 @@ function createSession({
665
682
  ...(permissionMode ? { permissionMode } : {}),
666
683
  ...(builtinToolFiltering ? { builtinToolFiltering } : {}),
667
684
  ...(recursionLimit != null ? { recursionLimit } : {}),
685
+ ...(mcpServers == null ? {} : { mcpServers }),
668
686
  });
669
687
 
670
688
  return control;