@ai-sdk/harness 1.0.122 → 1.0.123
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 +18 -0
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +128 -49
- package/dist/agent/index.js.map +1 -1
- package/dist/bridge/index.js +0 -1
- package/dist/bridge/index.js.map +1 -1
- package/dist/index.d.ts +28 -6
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +30 -5
- package/dist/utils/index.js +130 -16
- package/dist/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/src/agent/harness-agent.ts +32 -12
- package/src/agent/internal/bootstrap-recipe.ts +16 -16
- package/src/agent/internal/harness-stream-text-result.ts +1 -3
- package/src/agent/internal/sandbox-bootstrap.ts +24 -10
- package/src/agent/prepare-harness-sandbox-template.ts +16 -3
- package/src/agent/prepare-sandbox-for-harness.ts +14 -5
- package/src/bridge/index.ts +0 -1
- package/src/utils/sandbox-channel.ts +172 -19
- package/src/utils/write-instructions.ts +1 -1
- package/src/utils/write-skills.ts +1 -1
- package/src/v1/harness-session-data-directory-path.ts +28 -0
- package/src/v1/harness-v1-bootstrap.ts +5 -5
- package/src/v1/harness-v1-network-sandbox-session.ts +24 -0
- package/src/v1/index.ts +2 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One file to write into the sandbox as part of an adapter's bootstrap recipe.
|
|
3
3
|
* Absolute paths are used as-is. Relative paths are resolved against the
|
|
4
|
-
*
|
|
4
|
+
* harness state directory (`$HOME/.ai-sdk-harness`). Paths should live under
|
|
5
5
|
* {@link HarnessV1Bootstrap.bootstrapDir}.
|
|
6
6
|
*/
|
|
7
7
|
export interface HarnessV1BootstrapFile {
|
|
@@ -33,10 +33,10 @@ export interface HarnessV1Bootstrap {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Path inside the sandbox where this recipe writes its state. Absolute paths
|
|
36
|
-
* are used as-is. Relative paths are resolved against the
|
|
37
|
-
*
|
|
38
|
-
* declared in {@link files} should also use this prefix so an
|
|
39
|
-
* can sweep stale state by clearing the directory.
|
|
36
|
+
* are used as-is. Relative paths are resolved against the harness state
|
|
37
|
+
* directory (`$HOME/.ai-sdk-harness`). The marker file lives directly under
|
|
38
|
+
* it. Files declared in {@link files} should also use this prefix so an
|
|
39
|
+
* adapter upgrade can sweep stale state by clearing the directory.
|
|
40
40
|
*/
|
|
41
41
|
readonly bootstrapDir: string;
|
|
42
42
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
1
2
|
import type { Experimental_SandboxSession as SandboxSession } from '@ai-sdk/provider-utils';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -9,6 +10,29 @@ export type HarnessV1PortEndpoint = {
|
|
|
9
10
|
readonly headers?: Readonly<Record<string, string>>;
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Fixed directory, relative to the sandbox's own HOME, that holds every
|
|
15
|
+
* piece of state the harness machinery generates.
|
|
16
|
+
*/
|
|
17
|
+
const HARNESS_V1_STATE_DIRECTORY_NAME = '.ai-sdk-harness';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Fixed, non-configurable path for harness-generated state (bootstrap files,
|
|
21
|
+
* markers, and `.agent-runs`) under the sandbox's own HOME, never under
|
|
22
|
+
* {@link HarnessV1NetworkSandboxSession.defaultWorkingDirectory}. Resolve HOME
|
|
23
|
+
* with `resolveSandboxHomeDir` when it is not already known. This works from
|
|
24
|
+
* provider creation hooks that only have a plain sandbox session. The
|
|
25
|
+
* framework also calls this with a symbolic `$HOME` when hashing bootstrap
|
|
26
|
+
* recipes, so changes to the state path invalidate existing templates.
|
|
27
|
+
*/
|
|
28
|
+
export function harnessStateDirectoryPath({
|
|
29
|
+
sandboxHomeDir,
|
|
30
|
+
}: {
|
|
31
|
+
sandboxHomeDir: string;
|
|
32
|
+
}): string {
|
|
33
|
+
return posix.join(sandboxHomeDir, HARNESS_V1_STATE_DIRECTORY_NAME);
|
|
34
|
+
}
|
|
35
|
+
|
|
12
36
|
/**
|
|
13
37
|
* Network sandbox session returned by `HarnessV1SandboxProvider.createSession()`. The
|
|
14
38
|
* harness keeps this for the lifetime of a session. It is itself a
|
package/src/v1/index.ts
CHANGED
|
@@ -63,6 +63,8 @@ export type {
|
|
|
63
63
|
HarnessV1RequestTransformation,
|
|
64
64
|
HarnessV1RequestTransformationSources,
|
|
65
65
|
} from './harness-v1-network-sandbox-session';
|
|
66
|
+
export { harnessStateDirectoryPath } from './harness-v1-network-sandbox-session';
|
|
67
|
+
export { harnessSessionDataDirectoryPath } from './harness-session-data-directory-path';
|
|
66
68
|
export type { HarnessV1Skill } from './harness-v1-skill';
|
|
67
69
|
export type { HarnessV1StreamPart } from './harness-v1-stream-part';
|
|
68
70
|
export {
|