@ai-sdk/harness 1.0.54 → 1.0.56

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ai-sdk/harness
2
2
 
3
+ ## 1.0.56
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [79e133c]
8
+ - Updated dependencies [da64b51]
9
+ - @ai-sdk/provider@4.0.5
10
+ - ai@7.0.50
11
+ - @ai-sdk/provider-utils@5.0.19
12
+
13
+ ## 1.0.55
14
+
15
+ ### Patch Changes
16
+
17
+ - 2c0a8aa: fix(harness): remove unused and unnecessary `workingDirectory` property from `HarnessV1BootstrapCommand`
18
+ - 861d423: feat(harness): improve harness sandbox auth error handling and expose `getHarnessErrorMessage()` helper
19
+ - 8f10600: fix(harness): rename harness bridge `detach` to `stop` and `shutdown` to `destroy` for clarity
20
+ - ai@7.0.49
21
+
3
22
  ## 1.0.54
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -114,9 +114,7 @@ Implement the `HarnessV1` factory and a `HarnessV1Session` whose `doPromptTurn`
114
114
  Bootstrap recipe paths may be absolute or relative. Relative `bootstrapDir` and
115
115
  file paths are resolved against `sandboxSession.defaultWorkingDirectory`.
116
116
  The framework creates `bootstrapDir` before writing files, and bootstrap
117
- commands run from that directory by default. A relative command
118
- `workingDirectory` override is resolved against the sandbox's default working
119
- directory. Prefer a relative directory such as
117
+ commands always run from that directory. Prefer a relative directory such as
120
118
  `.harness-bootstrap/my-harness` so bootstrap assets are kept with the sandbox's
121
119
  snapshot-persistent working tree.
122
120
 
package/agent/index.ts CHANGED
@@ -52,6 +52,8 @@ export type {
52
52
  } from '../src/agent/observability/types';
53
53
  export { HarnessError } from '../src/errors/harness-error';
54
54
  export { HarnessCapabilityUnsupportedError } from '../src/errors/harness-capability-unsupported-error';
55
+ export { HarnessSandboxAuthenticationError } from '../src/errors/harness-sandbox-authentication-error';
56
+ export { getHarnessErrorMessage } from '../src/agent/get-harness-error-message';
55
57
  export {
56
58
  createFileReporter,
57
59
  createTraceTreeReporter,
@@ -90,12 +90,6 @@ interface HarnessV1BootstrapFile {
90
90
  */
91
91
  interface HarnessV1BootstrapCommand {
92
92
  readonly command: string;
93
- /**
94
- * Absolute working directories are used as-is. Relative working directories
95
- * are resolved against the sandbox's default working directory. When
96
- * omitted, the command runs from the recipe's bootstrap directory.
97
- */
98
- readonly workingDirectory?: string;
99
93
  }
100
94
  /**
101
95
  * Adapter-owned bootstrap recipe. The adapter declares the files and commands
@@ -1010,6 +1004,12 @@ interface HarnessV1SandboxProvider {
1010
1004
  * leave this undefined.
1011
1005
  */
1012
1006
  readonly bridgePorts?: ReadonlyArray<number>;
1007
+ /**
1008
+ * Providers should throw `HarnessSandboxAuthenticationError` when sandbox
1009
+ * acquisition fails because credentials are missing, invalid, or not
1010
+ * authorized. This lets framework integrations distinguish configuration
1011
+ * failures from general sandbox infrastructure errors.
1012
+ */
1013
1013
  readonly createSession: (options?: {
1014
1014
  /**
1015
1015
  * Stable per-session identifier. When supplied, the provider names the
@@ -1608,14 +1608,14 @@ declare function prepareSandboxForHarness(options: {
1608
1608
  readonly abortSignal?: AbortSignal;
1609
1609
  }): Promise<PrepareSandboxForHarnessResult>;
1610
1610
 
1611
- declare const symbol$1: unique symbol;
1611
+ declare const symbol$2: unique symbol;
1612
1612
  /**
1613
1613
  * Base error type for failures originating in or signalled by a harness
1614
1614
  * adapter. Specific failure modes (e.g. unsupported capability) extend this
1615
1615
  * class.
1616
1616
  */
1617
1617
  declare class HarnessError extends AISDKError {
1618
- private readonly [symbol$1];
1618
+ private readonly [symbol$2];
1619
1619
  constructor({ message, cause }: {
1620
1620
  message: string;
1621
1621
  cause?: unknown;
@@ -1623,7 +1623,7 @@ declare class HarnessError extends AISDKError {
1623
1623
  static isInstance(error: unknown): error is HarnessError;
1624
1624
  }
1625
1625
 
1626
- declare const symbol: unique symbol;
1626
+ declare const symbol$1: unique symbol;
1627
1627
  /**
1628
1628
  * Thrown when a caller asks the harness to do something the adapter (or the
1629
1629
  * supplied sandbox) does not support, e.g. requesting manual compaction from
@@ -1634,7 +1634,7 @@ declare const symbol: unique symbol;
1634
1634
  * is recorded as structured context for tooling.
1635
1635
  */
1636
1636
  declare class HarnessCapabilityUnsupportedError extends HarnessError {
1637
- private readonly [symbol];
1637
+ private readonly [symbol$1];
1638
1638
  readonly harnessId?: string;
1639
1639
  constructor({ message, harnessId, cause, }: {
1640
1640
  message: string;
@@ -1644,6 +1644,32 @@ declare class HarnessCapabilityUnsupportedError extends HarnessError {
1644
1644
  static isInstance(error: unknown): error is HarnessCapabilityUnsupportedError;
1645
1645
  }
1646
1646
 
1647
+ declare const symbol: unique symbol;
1648
+ /**
1649
+ * Thrown when a sandbox provider cannot authenticate or authorize the
1650
+ * operation needed to create or resume a harness sandbox. Providers should
1651
+ * preserve the underlying SDK failure as `cause` and supply a message that
1652
+ * explains how the consumer can configure credentials.
1653
+ */
1654
+ declare class HarnessSandboxAuthenticationError extends HarnessError {
1655
+ private readonly [symbol];
1656
+ readonly sandboxProviderId: string;
1657
+ constructor({ message, sandboxProviderId, cause, }: {
1658
+ message: string;
1659
+ sandboxProviderId: string;
1660
+ cause?: unknown;
1661
+ });
1662
+ static isInstance(error: unknown): error is HarnessSandboxAuthenticationError;
1663
+ }
1664
+
1665
+ /**
1666
+ * Returns a client-safe message for errors produced by the harness runtime.
1667
+ * Messages from explicitly reviewed harness error types are preserved. All
1668
+ * other errors are masked so provider, sandbox, and server details are not
1669
+ * exposed to clients by default.
1670
+ */
1671
+ declare function getHarnessErrorMessage(error: unknown): string;
1672
+
1647
1673
  /**
1648
1674
  * A harness observability reporter that writes a unified, non-lossy
1649
1675
  * `events.jsonl` containing **both** the telemetry span lifecycle (turn / step
@@ -1683,4 +1709,4 @@ interface TraceTreeReporterOptions {
1683
1709
  }
1684
1710
  declare function createTraceTreeReporter(options?: TraceTreeReporterOptions): Telemetry;
1685
1711
 
1686
- export { type FileReporter, type FileReporterOptions, HarnessAgent, type HarnessAgentAdapter, type HarnessAgentAdapterSession, type HarnessAgentBuiltinTool, type HarnessAgentBuiltinToolName, type HarnessAgentBuiltinToolUseKind, type HarnessAgentBuiltinTools, type HarnessAgentContinueTurnOptions, type HarnessAgentContinueTurnState, type HarnessAgentLifecycleState, type HarnessAgentPendingToolApproval, type HarnessAgentPendingToolResult, type HarnessAgentPermissionMode, type HarnessAgentPrompt, type HarnessAgentPromptControl, type HarnessAgentPromptTurnOptions, type HarnessAgentResumeSessionState, type HarnessAgentSandboxConfig, HarnessAgentSession, type HarnessAgentSettings, type HarnessAgentSkill, type HarnessAgentStartOptions, type HarnessAgentStreamPart, type HarnessAgentToolApprovalConfiguration, type HarnessAgentToolApprovalContinuation, type HarnessAgentToolResultContinuation, type HarnessAgentToolSpec, type HarnessAllTools, HarnessCapabilityUnsupportedError, type HarnessDebugConfig, type HarnessDebugLevel, type HarnessDiagnostic, type HarnessDiagnosticConsumer, HarnessError, type PrepareSandboxForHarnessResult, type TraceTreeReporterOptions, collectHarnessAgentToolApprovalContinuations, collectHarnessAgentToolResultContinuations, createFileReporter, createTraceTreeReporter, prepareHarnessSandboxTemplate, prepareSandboxForHarness, prewarmHarness };
1712
+ export { type FileReporter, type FileReporterOptions, HarnessAgent, type HarnessAgentAdapter, type HarnessAgentAdapterSession, type HarnessAgentBuiltinTool, type HarnessAgentBuiltinToolName, type HarnessAgentBuiltinToolUseKind, type HarnessAgentBuiltinTools, type HarnessAgentContinueTurnOptions, type HarnessAgentContinueTurnState, type HarnessAgentLifecycleState, type HarnessAgentPendingToolApproval, type HarnessAgentPendingToolResult, type HarnessAgentPermissionMode, type HarnessAgentPrompt, type HarnessAgentPromptControl, type HarnessAgentPromptTurnOptions, type HarnessAgentResumeSessionState, type HarnessAgentSandboxConfig, HarnessAgentSession, type HarnessAgentSettings, type HarnessAgentSkill, type HarnessAgentStartOptions, type HarnessAgentStreamPart, type HarnessAgentToolApprovalConfiguration, type HarnessAgentToolApprovalContinuation, type HarnessAgentToolResultContinuation, type HarnessAgentToolSpec, type HarnessAllTools, HarnessCapabilityUnsupportedError, type HarnessDebugConfig, type HarnessDebugLevel, type HarnessDiagnostic, type HarnessDiagnosticConsumer, HarnessError, HarnessSandboxAuthenticationError, type PrepareSandboxForHarnessResult, type TraceTreeReporterOptions, collectHarnessAgentToolApprovalContinuations, collectHarnessAgentToolResultContinuations, createFileReporter, createTraceTreeReporter, getHarnessErrorMessage, prepareHarnessSandboxTemplate, prepareSandboxForHarness, prewarmHarness };