@ai-sdk/harness-deepagents 1.0.100 → 1.0.102

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.
@@ -15,7 +15,6 @@ import {
15
15
  type HarnessV1PortEndpoint,
16
16
  type HarnessV1ResumeSessionState,
17
17
  type HarnessV1Session,
18
- type HarnessV1Skill,
19
18
  type HarnessV1StreamPart,
20
19
  } from '@ai-sdk/harness';
21
20
  import {
@@ -35,8 +34,7 @@ import {
35
34
  warnCredentialBrokeringUnavailable,
36
35
  waitForBridgeReady,
37
36
  withBridgeToken,
38
- writeSkills as writeHarnessSkills,
39
- type WriteSkillsResult,
37
+ writeSkills,
40
38
  } from '@ai-sdk/harness/utils';
41
39
  import {
42
40
  tool,
@@ -362,12 +360,13 @@ export function createDeepAgents(
362
360
  sandboxCredentialEnvironment,
363
361
  isResume: true,
364
362
  sandbox: toolSafeSandboxSession,
365
- homeSkillsRoot,
363
+ homeDir,
366
364
  skillsPaths,
367
365
  permissionMode,
368
366
  builtinToolFiltering: startOpts.builtinToolFiltering,
369
367
  recursionLimit: settings.recursionLimit,
370
368
  mcpServers: settings.mcpServers,
369
+ headers: startOpts.headers,
371
370
  });
372
371
  } catch {
373
372
  // Bridge no longer reachable — recover by respawning below.
@@ -485,12 +484,13 @@ export function createDeepAgents(
485
484
  sandboxCredentialEnvironment,
486
485
  isResume,
487
486
  sandbox: toolSafeSandboxSession,
488
- homeSkillsRoot,
487
+ homeDir,
489
488
  skillsPaths,
490
489
  permissionMode,
491
490
  builtinToolFiltering: startOpts.builtinToolFiltering,
492
491
  recursionLimit: settings.recursionLimit,
493
492
  mcpServers: settings.mcpServers,
493
+ headers: startOpts.headers,
494
494
  });
495
495
  },
496
496
  };
@@ -561,36 +561,6 @@ async function resolveBridgeEndpoint({
561
561
  });
562
562
  }
563
563
 
564
- // Materialize each skill as a native deepagents `<name>/SKILL.md` folder (+ attached files) under the given root, so skills load on demand and file references resolve.
565
- async function writeSkills({
566
- sandbox,
567
- root,
568
- skills,
569
- abortSignal,
570
- }: {
571
- sandbox: SandboxSession;
572
- root: string;
573
- skills: ReadonlyArray<HarnessV1Skill>;
574
- abortSignal?: AbortSignal;
575
- }): Promise<WriteSkillsResult> {
576
- /*
577
- * DeepAgents requires each `SKILL.md` frontmatter name to match the parent
578
- * directory name, so keep the stricter lowercase skill-name policy here.
579
- */
580
- return writeHarnessSkills({
581
- sandbox,
582
- rootDir: root,
583
- skills,
584
- abortSignal,
585
- skillNamePattern: /^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/,
586
- invalidSkillNameMessage: ({ name }) =>
587
- `Invalid deepagents skill name '${name}': must be lowercase alphanumeric with hyphens, 1-64 chars.`,
588
- filePathMode: 'strip-leading-slashes',
589
- invalidSkillFilePathMessage: ({ skillName, filePath }) =>
590
- `Invalid skill file path for '${skillName}': ${filePath}`,
591
- });
592
- }
593
-
594
564
  function openWebSocket({
595
565
  url,
596
566
  headers,
@@ -625,12 +595,13 @@ function createSession({
625
595
  sandboxCredentialEnvironment,
626
596
  isResume,
627
597
  sandbox,
628
- homeSkillsRoot,
598
+ homeDir,
629
599
  skillsPaths,
630
600
  permissionMode,
631
601
  builtinToolFiltering,
632
602
  recursionLimit,
633
603
  mcpServers,
604
+ headers,
634
605
  }: {
635
606
  sessionId: string;
636
607
  channel: DeepAgentsChannel;
@@ -645,12 +616,13 @@ function createSession({
645
616
  sandboxCredentialEnvironment: Record<string, string> | undefined;
646
617
  isResume: boolean;
647
618
  sandbox: SandboxSession;
648
- homeSkillsRoot: string;
619
+ homeDir: string;
649
620
  skillsPaths?: string[];
650
621
  permissionMode?: HarnessV1PermissionMode;
651
622
  builtinToolFiltering?: HarnessV1BuiltinToolFiltering;
652
623
  recursionLimit?: number;
653
624
  mcpServers?: Record<string, unknown>;
625
+ headers?: Readonly<Record<string, string>>;
654
626
  }): HarnessV1Session {
655
627
  let stopped = false;
656
628
 
@@ -792,9 +764,16 @@ function createSession({
792
764
  }
793
765
  const skillWriteResult = await writeSkills({
794
766
  sandbox,
795
- root: homeSkillsRoot,
767
+ homePath: homeDir,
768
+ skillsDir: '.agents/skills',
796
769
  skills: promptOpts.skills,
797
770
  abortSignal: promptOpts.abortSignal,
771
+ skillNamePattern: /^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/,
772
+ invalidSkillNameMessage: ({ name }) =>
773
+ `Invalid deepagents skill name '${name}': must be lowercase alphanumeric with hyphens, 1-64 chars.`,
774
+ filePathMode: 'strip-leading-slashes',
775
+ invalidSkillFilePathMessage: ({ skillName, filePath }) =>
776
+ `Invalid skill file path for '${skillName}': ${filePath}`,
798
777
  });
799
778
  const control = wireTurn({
800
779
  emit: promptOpts.emit,
@@ -826,6 +805,7 @@ function createSession({
826
805
  ...(builtinToolFiltering ? { builtinToolFiltering } : {}),
827
806
  ...(recursionLimit != null ? { recursionLimit } : {}),
828
807
  ...(mcpServers == null ? {} : { mcpServers }),
808
+ ...(headers == null ? {} : { headers }),
829
809
  });
830
810
 
831
811
  return control;