managed-deepagents 0.0.3-dev.24 → 0.0.3-dev.26
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/dist/connectors.d.ts.map +1 -1
- package/dist/connectors.js +3 -1
- package/dist/connectors.js.map +1 -1
- package/dist/define-deep-agent.d.ts.map +1 -1
- package/dist/define-deep-agent.js +5 -3
- package/dist/define-deep-agent.js.map +1 -1
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +16 -4
- package/dist/resolve.js.map +1 -1
- package/dist/runtime/connectors-manager.d.ts.map +1 -1
- package/dist/runtime/connectors-manager.js +5 -2
- package/dist/runtime/connectors-manager.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +99 -43
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/sandbox-manager.d.ts +3 -21
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js +41 -119
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/setup-script.d.ts +2 -4
- package/dist/runtime/setup-script.d.ts.map +1 -1
- package/dist/runtime/setup-script.js +5 -5
- package/dist/runtime/setup-script.js.map +1 -1
- package/dist/runtime/types.d.ts +3 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandbox.d.ts +18 -18
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +37 -9
- package/dist/sandbox.js.map +1 -1
- package/dist/schedules.js +4 -2
- package/dist/schedules.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -9
- package/dist/runtime/credentials.d.ts +0 -42
- package/dist/runtime/credentials.d.ts.map +0 -1
- package/dist/runtime/credentials.js +0 -69
- package/dist/runtime/credentials.js.map +0 -1
- package/dist/runtime/dev-notice.d.ts +0 -7
- package/dist/runtime/dev-notice.d.ts.map +0 -1
- package/dist/runtime/dev-notice.js +0 -27
- package/dist/runtime/dev-notice.js.map +0 -1
- package/dist/runtime/local-dev-sandbox.d.ts +0 -13
- package/dist/runtime/local-dev-sandbox.d.ts.map +0 -1
- package/dist/runtime/local-dev-sandbox.js +0 -39
- package/dist/runtime/local-dev-sandbox.js.map +0 -1
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logDevSandboxNoticeOnce } from "./dev-notice.js";
|
|
3
|
-
import { createLocalDevSandbox } from "./local-dev-sandbox.js";
|
|
4
|
-
import { runSetupScript, runSetupScriptInline } from "./setup-script.js";
|
|
1
|
+
import { runSetupScript } from "./setup-script.js";
|
|
5
2
|
/**
|
|
6
3
|
* Created sandboxes, keyed by scope, reused for the lifetime of this runtime
|
|
7
4
|
* process. Storing the in-flight promise dedupes concurrent runs and guarantees
|
|
8
5
|
* `setup.sh` is executed only once per newly created sandbox.
|
|
9
6
|
*/
|
|
10
7
|
const managedSandboxes = new Map();
|
|
11
|
-
/**
|
|
12
|
-
* Cache key for the single, process-wide sandbox used under `mda dev`.
|
|
13
|
-
*
|
|
14
|
-
* Deploys key sandboxes per scope (thread/tenant/actor) for isolation. Dev is a
|
|
15
|
-
* single developer iterating locally, so it shares one sandbox across every
|
|
16
|
-
* thread: that lets `announceSandboxPlan` create it eagerly at startup (to
|
|
17
|
-
* report local-vs-remote and the temp dir up front) and have the first real run
|
|
18
|
-
* reuse it instead of provisioning a second one.
|
|
19
|
-
*/
|
|
20
|
-
const DEV_SANDBOX_SCOPE_KEY = "__mda_dev__";
|
|
21
8
|
const defaultLangSmithSandboxClientLoader = async () => {
|
|
22
9
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
23
10
|
return (await dynamicImport("langsmith/sandbox"));
|
|
24
11
|
};
|
|
25
12
|
let langSmithSandboxClientLoader = defaultLangSmithSandboxClientLoader;
|
|
26
13
|
/**
|
|
27
|
-
* Resolve (and cache) the scoped sandbox backend for this run,
|
|
28
|
-
* with `setup.sh` the first time it is created.
|
|
14
|
+
* Resolve (and cache) the scoped LangSmith sandbox backend for this run,
|
|
15
|
+
* provisioning it with `setup.sh` the first time it is created.
|
|
29
16
|
*/
|
|
30
17
|
export function resolveManagedSandbox(sandbox, setupScript, config) {
|
|
31
|
-
const key =
|
|
18
|
+
const key = sandboxScopeKey(sandbox, config);
|
|
32
19
|
let pending = managedSandboxes.get(key);
|
|
33
20
|
if (!pending) {
|
|
34
|
-
pending =
|
|
35
|
-
// Don't cache a failed provisioning attempt
|
|
21
|
+
pending = createLangSmithSandbox(sandbox, setupScript).catch((error) => {
|
|
22
|
+
// Don't cache a failed provisioning attempt. Let the next run retry.
|
|
36
23
|
managedSandboxes.delete(key);
|
|
37
24
|
throw error;
|
|
38
25
|
});
|
|
@@ -40,22 +27,13 @@ export function resolveManagedSandbox(sandbox, setupScript, config) {
|
|
|
40
27
|
}
|
|
41
28
|
return pending;
|
|
42
29
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Derive the reuse key from the run. Without runtime identity, sandboxes are
|
|
45
|
-
* keyed by thread; with identity, by the configured tenant/actor scope.
|
|
46
|
-
*/
|
|
30
|
+
/** Derive the process-level reuse key from the configured sandbox scope. */
|
|
47
31
|
export function sandboxScopeKey(sandbox, config) {
|
|
48
|
-
const configurable = (config?.configurable ?? {});
|
|
49
|
-
const identity = configurable.identity;
|
|
50
32
|
const scope = sandbox.options?.scope ?? "thread";
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
key = identity?.actor?.id;
|
|
56
|
-
else
|
|
57
|
-
key = configurable.thread_id;
|
|
58
|
-
return key ?? identity?.tenant?.id ?? identity?.actor?.id ?? configurable.thread_id ?? "default";
|
|
33
|
+
if (scope === "agent") {
|
|
34
|
+
return `agent:${assistantIdFromConfig(config)}`;
|
|
35
|
+
}
|
|
36
|
+
return `thread:${threadIdFromConfig(config)}`;
|
|
59
37
|
}
|
|
60
38
|
/** Clear the process-level sandbox cache. Test-only. */
|
|
61
39
|
export function clearManagedSandboxCacheForTests() {
|
|
@@ -65,115 +43,59 @@ export function clearManagedSandboxCacheForTests() {
|
|
|
65
43
|
export function setLangSmithSandboxClientLoaderForTests(loader) {
|
|
66
44
|
langSmithSandboxClientLoader = loader ?? defaultLangSmithSandboxClientLoader;
|
|
67
45
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* path when local — right when the dev server boots, not on the first run.
|
|
72
|
-
*
|
|
73
|
-
* Sandboxes are otherwise created lazily (on first run), so with `--browser`
|
|
74
|
-
* off nothing would print until the agent is invoked. The generated entry
|
|
75
|
-
* calls this at module load (graph registration); because dev shares one
|
|
76
|
-
* sandbox ({@link DEV_SANDBOX_SCOPE_KEY}), the first real run reuses what is
|
|
77
|
-
* created here rather than provisioning a second sandbox. The authoritative
|
|
78
|
-
* "created" log (with the temp dir) is emitted by {@link createDevSandbox}.
|
|
79
|
-
*
|
|
80
|
-
* No-op outside `mda dev`, so the generated entry can always call it.
|
|
81
|
-
*/
|
|
82
|
-
export async function announceSandboxPlan(sandbox, setupScript) {
|
|
83
|
-
if (!isDevMode())
|
|
84
|
-
return;
|
|
85
|
-
await resolveManagedSandbox(sandbox, setupScript, undefined);
|
|
86
|
-
}
|
|
87
|
-
function createManagedSandbox(sandbox, setupScript) {
|
|
88
|
-
// `mda dev` never provisions a real provider sandbox the same way a deploy
|
|
89
|
-
// does (it builds no snapshot/image), so it gets its own resolution path with
|
|
90
|
-
// a local fallback. The flag gating ensures a real deployment can never be
|
|
91
|
-
// silently downgraded to local shell execution.
|
|
92
|
-
return isDevMode()
|
|
93
|
-
? createDevSandbox(sandbox, setupScript)
|
|
94
|
-
: createProviderSandbox(sandbox, setupScript, { useDefaultLangSmithRuntime: true });
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Production path: construct the configured provider's sandbox and provision it.
|
|
98
|
-
* Any failure propagates — a misconfigured deployment must surface, not degrade.
|
|
99
|
-
*/
|
|
100
|
-
async function createProviderSandbox(sandbox, setupScript, options) {
|
|
101
|
-
const backend = await createProviderBackend(sandbox, options);
|
|
102
|
-
if (setupScript && setupScript.trim().length > 0) {
|
|
103
|
-
await runSetupScript(backend, setupScript);
|
|
46
|
+
async function createLangSmithSandbox(sandbox, setupScript) {
|
|
47
|
+
if (providerKey(sandbox.provider) !== "LangSmithSandbox") {
|
|
48
|
+
throw new Error("MDA only supports deepagents' LangSmithSandbox provider");
|
|
104
49
|
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Dev path: prefer the configured provider when its credentials are present,
|
|
109
|
-
* but fall back to a local temp-directory sandbox when credentials are missing
|
|
110
|
-
* *or* the provider cannot be created (e.g. `LangSmithSandbox`, which needs a
|
|
111
|
-
* snapshot that only `mda deploy` builds). This keeps `mda dev` working offline
|
|
112
|
-
* and resilient to provider/config gaps while still exercising real providers
|
|
113
|
-
* that can spin up from an API key alone.
|
|
114
|
-
*/
|
|
115
|
-
async function createDevSandbox(sandbox, setupScript) {
|
|
116
|
-
const cred = providerCredentialStatus(sandbox.provider);
|
|
117
|
-
if (cred.status !== "missing") {
|
|
118
|
-
try {
|
|
119
|
-
const backend = await createProviderSandbox(sandbox, setupScript, {
|
|
120
|
-
useDefaultLangSmithRuntime: false,
|
|
121
|
-
});
|
|
122
|
-
logDevSandboxNoticeOnce(cred.status === "available"
|
|
123
|
-
? `[mda dev] using the configured ${cred.provider} sandbox.`
|
|
124
|
-
: `[mda dev] using the configured sandbox provider (${cred.provider}).`);
|
|
125
|
-
return backend;
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
return createLocalSandbox(setupScript, `the configured ${cred.provider} sandbox could not be created ` +
|
|
129
|
-
`(${errorMessage(error)}); using a local temporary directory instead`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const missing = cred.missing.join(", ") || "the provider credentials";
|
|
133
|
-
return createLocalSandbox(setupScript, `no credentials found for the configured sandbox provider (${cred.provider}); ` +
|
|
134
|
-
`using a local temporary directory instead — set ${missing} to use it`);
|
|
135
|
-
}
|
|
136
|
-
/** Provision the local dev sandbox and run `setup.sh` inline inside it. */
|
|
137
|
-
async function createLocalSandbox(setupScript, reason) {
|
|
138
|
-
const backend = await createLocalDevSandbox(reason);
|
|
50
|
+
const backend = await createLangSmithSandboxBackend(sandbox);
|
|
139
51
|
if (setupScript && setupScript.trim().length > 0) {
|
|
140
|
-
await
|
|
52
|
+
await runSetupScript(backend, setupScript);
|
|
141
53
|
}
|
|
142
54
|
return backend;
|
|
143
55
|
}
|
|
144
|
-
/** Construct the configured provider's backend, stripping MDA-managed knobs. */
|
|
145
|
-
async function createProviderBackend(sandbox, options) {
|
|
146
|
-
if (options.useDefaultLangSmithRuntime && providerKey(sandbox.provider) === "LangSmithSandbox") {
|
|
147
|
-
return createLangSmithSandboxBackend(sandbox);
|
|
148
|
-
}
|
|
149
|
-
const { scope: _scope, idleTtlSeconds: _idleTtlSeconds, ...providerOptions } = sandbox.options ?? {};
|
|
150
|
-
void _scope;
|
|
151
|
-
void _idleTtlSeconds;
|
|
152
|
-
return (await sandbox.provider.create(providerOptions));
|
|
153
|
-
}
|
|
154
56
|
async function createLangSmithSandboxBackend(sandbox) {
|
|
155
57
|
const { scope: _scope, apiKey = process.env.LANGSMITH_API_KEY, defaultTimeout, templateName, snapshotId, ...createSandboxOptions } = sandbox.options ?? {};
|
|
156
|
-
void _scope;
|
|
157
58
|
if (snapshotId && templateName) {
|
|
158
59
|
throw new Error("snapshotId and templateName are mutually exclusive. Pass only one creation source.");
|
|
159
60
|
}
|
|
160
61
|
if (templateName) {
|
|
161
62
|
createSandboxOptions.snapshotName = templateName;
|
|
162
63
|
}
|
|
163
|
-
const { SandboxClient } = await langSmithSandboxClientLoader();
|
|
164
64
|
if (snapshotId) {
|
|
165
65
|
createSandboxOptions.snapshotId = snapshotId;
|
|
166
66
|
}
|
|
67
|
+
const { SandboxClient } = await langSmithSandboxClientLoader();
|
|
167
68
|
const sdkOptions = stringOption(apiKey);
|
|
168
69
|
const client = new SandboxClient(sdkOptions ? { apiKey: sdkOptions } : undefined);
|
|
169
70
|
const langSmithSandbox = await client.createSandbox(createSandboxOptions);
|
|
170
71
|
const Backend = sandbox.provider;
|
|
171
72
|
return new Backend({ sandbox: langSmithSandbox, defaultTimeout });
|
|
172
73
|
}
|
|
74
|
+
function providerKey(provider) {
|
|
75
|
+
const providerId = provider.providerId;
|
|
76
|
+
if (typeof providerId === "string" && providerId.trim()) {
|
|
77
|
+
return providerId.trim();
|
|
78
|
+
}
|
|
79
|
+
return typeof provider.name === "string" ? provider.name.trim() : "";
|
|
80
|
+
}
|
|
81
|
+
function threadIdFromConfig(config) {
|
|
82
|
+
const threadId = configValue(config, "thread_id");
|
|
83
|
+
if (threadId === undefined) {
|
|
84
|
+
throw new Error('sandbox scope "thread" requires configurable.thread_id');
|
|
85
|
+
}
|
|
86
|
+
return threadId;
|
|
87
|
+
}
|
|
88
|
+
function assistantIdFromConfig(config) {
|
|
89
|
+
return configValue(config, "assistant_id") ?? "agent";
|
|
90
|
+
}
|
|
173
91
|
function stringOption(value) {
|
|
174
|
-
|
|
92
|
+
if (typeof value !== "string")
|
|
93
|
+
return undefined;
|
|
94
|
+
const trimmed = value.trim();
|
|
95
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
175
96
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
97
|
+
function configValue(config, key) {
|
|
98
|
+
return (stringOption(config?.metadata?.[key]) ??
|
|
99
|
+
stringOption(config?.configurable?.[key]));
|
|
178
100
|
}
|
|
179
101
|
//# sourceMappingURL=sandbox-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-manager.js","sourceRoot":"","sources":["../../src/runtime/sandbox-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sandbox-manager.js","sourceRoot":"","sources":["../../src/runtime/sandbox-manager.ts"],"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AAS,CAAC;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC;AAED,SAAS,WAAW,CAClB,MAAoC,EACpC,GAAW;IAEX,OAAO,CACL,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;QACrC,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,CAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -10,10 +10,8 @@ export declare function runSetupScript(backend: ManagedSandboxBackend, script: s
|
|
|
10
10
|
/**
|
|
11
11
|
* Run `setup.sh` by piping its contents straight to the backend's shell.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* filesystem, so an uploaded `/tmp/mda-setup.sh` would not be found by `bash`.
|
|
16
|
-
* Executed inline, the script runs with the temp root as its working directory.
|
|
13
|
+
* Kept as a compatibility fallback for sandbox backend implementations that
|
|
14
|
+
* conform to the execute surface but do not expose upload support.
|
|
17
15
|
*/
|
|
18
16
|
export declare function runSetupScriptInline(backend: ManagedSandboxBackend, script: string): Promise<void>;
|
|
19
17
|
export declare function assertSetupSucceeded(result: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-script.d.ts","sourceRoot":"","sources":["../../src/runtime/setup-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAKxD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"setup-script.d.ts","sourceRoot":"","sources":["../../src/runtime/setup-script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAKxD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,IAAI,CAOP"}
|
|
@@ -9,7 +9,9 @@ const SETUP_REMOTE_PATH = "/tmp/mda-setup.sh";
|
|
|
9
9
|
*/
|
|
10
10
|
export async function runSetupScript(backend, script) {
|
|
11
11
|
if (typeof backend.uploadFiles === "function") {
|
|
12
|
-
await backend.uploadFiles([
|
|
12
|
+
await backend.uploadFiles([
|
|
13
|
+
[SETUP_REMOTE_PATH, new TextEncoder().encode(script)],
|
|
14
|
+
]);
|
|
13
15
|
assertSetupSucceeded(await backend.execute(`bash ${SETUP_REMOTE_PATH}`));
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
@@ -18,10 +20,8 @@ export async function runSetupScript(backend, script) {
|
|
|
18
20
|
/**
|
|
19
21
|
* Run `setup.sh` by piping its contents straight to the backend's shell.
|
|
20
22
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* filesystem, so an uploaded `/tmp/mda-setup.sh` would not be found by `bash`.
|
|
24
|
-
* Executed inline, the script runs with the temp root as its working directory.
|
|
23
|
+
* Kept as a compatibility fallback for sandbox backend implementations that
|
|
24
|
+
* conform to the execute surface but do not expose upload support.
|
|
25
25
|
*/
|
|
26
26
|
export async function runSetupScriptInline(backend, script) {
|
|
27
27
|
assertSetupSucceeded(await backend.execute(script));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-script.js","sourceRoot":"","sources":["../../src/runtime/setup-script.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B,EAC9B,MAAc;IAEd,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAC9C,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"setup-script.js","sourceRoot":"","sources":["../../src/runtime/setup-script.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B,EAC9B,MAAc;IAEd,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAC9C,MAAM,OAAO,CAAC,WAAW,CAAC;YACxB,CAAC,iBAAiB,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACtD,CAAC,CAAC;QACH,oBAAoB,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,iBAAiB,EAAE,CAAC,CAAC,CAAC;QACzE,OAAO;IACT,CAAC;IACD,MAAM,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAA8B,EAC9B,MAAc;IAEd,oBAAoB,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAGpC;IACC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QACjE,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,0CAA0C,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1F,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ import type { SandboxDefinition } from "../sandbox.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* The LangGraph runnable config passed to a graph factory at invocation time.
|
|
5
5
|
*
|
|
6
|
-
* Kept loose for v0; the managed runtime reads
|
|
7
|
-
* from here to scope the
|
|
6
|
+
* Kept loose for v0; the managed runtime reads LangGraph metadata/configurable
|
|
7
|
+
* values from here to scope the managed sandbox.
|
|
8
8
|
*/
|
|
9
9
|
export interface ManagedRunConfig {
|
|
10
10
|
configurable?: Record<string, unknown>;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
11
12
|
[key: string]: unknown;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE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AE,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CACL,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC,CAAC;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpE"}
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* The managed `sandbox/` declaration primitive.
|
|
3
3
|
*
|
|
4
4
|
* A Managed Deep Agent declares its execution environment in `sandbox/index.ts`
|
|
5
|
-
* by importing
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* by importing `LangSmithSandbox` from `deepagents` and handing it to
|
|
6
|
+
* {@link defineSandbox}. The options are typed straight from the provider's own
|
|
7
|
+
* `create(...)` signature — MDA invents no schema. MDA owns how the sandbox is
|
|
8
|
+
* *resolved*: construction, scoped reuse across turns, the provisioning
|
|
9
|
+
* `setup.sh`, and lifecycle/TTL.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
@@ -19,25 +19,26 @@
|
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
+
import { LangSmithSandbox } from "deepagents";
|
|
22
23
|
/**
|
|
23
24
|
* A sandbox provider class MDA knows how to instantiate.
|
|
24
25
|
*
|
|
25
|
-
* Providers expose a static async `create(options)` factory. MDA
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Providers expose a static async `create(options)` factory. MDA types options
|
|
27
|
+
* from that factory signature (matching `deepagents`' `LangSmithSandbox.create(...)`)
|
|
28
|
+
* and constructs the backend with `new Provider({ sandbox, ... })` at runtime.
|
|
28
29
|
*/
|
|
29
30
|
export interface SandboxProviderClass<TOptions extends Record<string, any>, TInstance> {
|
|
30
31
|
create(options: TOptions): Promise<TInstance>;
|
|
31
|
-
/** Optional stable provider id for
|
|
32
|
+
/** Optional stable provider id for validation and diagnostics. */
|
|
32
33
|
readonly providerId?: string;
|
|
33
34
|
}
|
|
34
35
|
/** Reuse boundary for a managed sandbox. Defaults to `"thread"`. */
|
|
35
|
-
export type SandboxScope = "thread" | "
|
|
36
|
+
export type SandboxScope = "thread" | "agent";
|
|
36
37
|
/**
|
|
37
38
|
* Provider options MDA owns and developers must not set directly.
|
|
38
39
|
*
|
|
39
|
-
* MDA
|
|
40
|
-
*
|
|
40
|
+
* MDA owns sandbox identity and managed runtime safety knobs. Use
|
|
41
|
+
* `templateName` or `snapshotId` when an explicit LangSmith source is needed.
|
|
41
42
|
*/
|
|
42
43
|
export type ManagedSandboxOptionKey = "name" | "image" | "snapshot" | "imageName";
|
|
43
44
|
/** Extracts the option type accepted by a provider's static `create(...)`. */
|
|
@@ -55,8 +56,7 @@ export type DefineSandboxOptions<TProvider extends SandboxProviderClass<any, any
|
|
|
55
56
|
* Sandbox reuse scope. Defaults to `"thread"`.
|
|
56
57
|
*
|
|
57
58
|
* - `"thread"`: one sandbox per durable thread/conversation.
|
|
58
|
-
* - `"
|
|
59
|
-
* - `"actor"`: one sandbox shared across threads for the current actor.
|
|
59
|
+
* - `"agent"`: one sandbox shared by all threads handled by this agent process.
|
|
60
60
|
*/
|
|
61
61
|
scope?: SandboxScope;
|
|
62
62
|
/**
|
|
@@ -74,9 +74,9 @@ export interface SandboxDefinition<TProvider extends SandboxProviderClass<any, a
|
|
|
74
74
|
/**
|
|
75
75
|
* Declare the managed sandbox provider for a Managed Deep Agent.
|
|
76
76
|
*
|
|
77
|
-
* The
|
|
78
|
-
*
|
|
79
|
-
*
|
|
77
|
+
* The provider must be `LangSmithSandbox`; MDA owns naming, scoping, lifecycle,
|
|
78
|
+
* reuse, the provisioning `setup.sh`, and cleanup. The agent file stays clean —
|
|
79
|
+
* it never sets `backend`.
|
|
80
80
|
*/
|
|
81
|
-
export declare function defineSandbox<TProvider extends
|
|
81
|
+
export declare function defineSandbox<TProvider extends typeof LangSmithSandbox = typeof LangSmithSandbox>(provider: TProvider, options?: DefineSandboxOptions<TProvider>): SandboxDefinition<TProvider>;
|
|
82
82
|
//# sourceMappingURL=sandbox.d.ts.map
|
package/dist/sandbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB,
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB,CACnC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpC,SAAS;IAET,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,kEAAkE;IAClE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,CAAC;AAEhB,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,CAAC,SAAS,IAAI,SAAS,SAAS;IAChE,MAAM,CAAC,OAAO,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD,GACG,QAAQ,SAAS,MAAM,GACrB,QAAQ,GACR,KAAK,GACP,KAAK,CAAC;AAEV;;;;;GAKG;AAEH,MAAM,MAAM,oBAAoB,CAC9B,SAAS,SAAS,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,IAC9C,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,uBAAuB,CAAC,GAAG;IACrE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,mDAAmD;AAEnD,MAAM,WAAW,iBAAiB,CAChC,SAAS,SAAS,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,oBAAoB,CACrE,GAAG,EACH,GAAG,CACJ;IAED,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;CACpD;AAED;;;;;;GAMG;AAEH,wBAAgB,aAAa,CAC3B,SAAS,SAAS,OAAO,gBAAgB,GAAG,OAAO,gBAAgB,EAEnE,QAAQ,EAAE,SAAS,EACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,GACxC,iBAAiB,CAAC,SAAS,CAAC,CAuB9B"}
|
package/dist/sandbox.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* The managed `sandbox/` declaration primitive.
|
|
3
3
|
*
|
|
4
4
|
* A Managed Deep Agent declares its execution environment in `sandbox/index.ts`
|
|
5
|
-
* by importing
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* by importing `LangSmithSandbox` from `deepagents` and handing it to
|
|
6
|
+
* {@link defineSandbox}. The options are typed straight from the provider's own
|
|
7
|
+
* `create(...)` signature — MDA invents no schema. MDA owns how the sandbox is
|
|
8
|
+
* *resolved*: construction, scoped reuse across turns, the provisioning
|
|
9
|
+
* `setup.sh`, and lifecycle/TTL.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
@@ -19,15 +19,43 @@
|
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
+
import { LangSmithSandbox } from "deepagents";
|
|
22
23
|
/**
|
|
23
24
|
* Declare the managed sandbox provider for a Managed Deep Agent.
|
|
24
25
|
*
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* The provider must be `LangSmithSandbox`; MDA owns naming, scoping, lifecycle,
|
|
27
|
+
* reuse, the provisioning `setup.sh`, and cleanup. The agent file stays clean —
|
|
28
|
+
* it never sets `backend`.
|
|
28
29
|
*/
|
|
29
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
31
|
export function defineSandbox(provider, options) {
|
|
31
|
-
|
|
32
|
+
if (providerKey(provider) !== "LangSmithSandbox") {
|
|
33
|
+
throw new TypeError("defineSandbox(...) only supports deepagents' LangSmithSandbox provider");
|
|
34
|
+
}
|
|
35
|
+
const scope = options?.scope ?? "thread";
|
|
36
|
+
if (scope !== "thread" && scope !== "agent") {
|
|
37
|
+
throw new TypeError('sandbox scope must be "thread" or "agent"');
|
|
38
|
+
}
|
|
39
|
+
const managed = managedOptionKeys(options);
|
|
40
|
+
if (managed.length > 0) {
|
|
41
|
+
throw new TypeError(`${managed.join(", ")} ${managed.length === 1 ? "is" : "are"} owned by the managed runtime and cannot be set in defineSandbox(...).`);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
kind: "sandbox",
|
|
45
|
+
provider,
|
|
46
|
+
options: { ...options, scope },
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function providerKey(provider) {
|
|
50
|
+
const providerId = provider.providerId;
|
|
51
|
+
if (typeof providerId === "string" && providerId.trim()) {
|
|
52
|
+
return providerId.trim();
|
|
53
|
+
}
|
|
54
|
+
return typeof provider.name === "string" ? provider.name.trim() : "";
|
|
55
|
+
}
|
|
56
|
+
function managedOptionKeys(options) {
|
|
57
|
+
if (!options)
|
|
58
|
+
return [];
|
|
59
|
+
return ["name", "image", "snapshot", "imageName"].filter((key) => Object.prototype.hasOwnProperty.call(options, key));
|
|
32
60
|
}
|
|
33
61
|
//# sourceMappingURL=sandbox.js.map
|
package/dist/sandbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgF9C;;;;;;GAMG;AACH,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAG3B,QAAmB,EACnB,OAAyC;IAEzC,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,kBAAkB,EAAE,CAAC;QACjD,MAAM,IAAI,SAAS,CACjB,wEAAwE,CACzE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,QAAQ,CAAC;IACzC,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QAC5C,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,SAAS,CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IACnB,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAChC,wEAAwE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,QAAQ;QACR,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAqC;KAClE,CAAC;AACJ,CAAC;AAMD,SAAS,WAAW,CAAC,QAAiC;IACpD,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACvC,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;QACxD,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,iBAAiB,CACxB,OAA4C;IAE5C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAC/D,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CACnD,CAAC;AACJ,CAAC"}
|
package/dist/schedules.js
CHANGED
|
@@ -7,7 +7,8 @@ export function defineSchedule(config) {
|
|
|
7
7
|
}
|
|
8
8
|
function validateScheduleConfig(config) {
|
|
9
9
|
const provided = config;
|
|
10
|
-
if (typeof provided.cron !== "string" ||
|
|
10
|
+
if (typeof provided.cron !== "string" ||
|
|
11
|
+
provided.cron.trim().split(/\s+/).length !== 5) {
|
|
11
12
|
throw new Error("defineSchedule(...) requires `cron` to be a standard 5-field cron expression.");
|
|
12
13
|
}
|
|
13
14
|
const hasPrompt = typeof provided.prompt === "string";
|
|
@@ -31,7 +32,8 @@ function validateThread(thread) {
|
|
|
31
32
|
if (mode !== "ephemeral" && mode !== "persistent") {
|
|
32
33
|
throw new Error('defineSchedule(...) requires `thread.mode` to be "ephemeral" or "persistent".');
|
|
33
34
|
}
|
|
34
|
-
if (mode === "persistent" &&
|
|
35
|
+
if (mode === "persistent" &&
|
|
36
|
+
(typeof config.id !== "string" || config.id.trim().length === 0)) {
|
|
35
37
|
throw new Error("defineSchedule(...) requires `thread.id` for persistent schedules.");
|
|
36
38
|
}
|
|
37
39
|
}
|
package/dist/schedules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"AA2FA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAsB;IACpD,MAAM,QAAQ,GAAG,MAA4C,CAAC;IAE9D,
|
|
1
|
+
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../src/schedules.ts"],"names":[],"mappings":"AA2FA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAsB;IACpD,MAAM,QAAQ,GAAG,MAA4C,CAAC;IAE9D,IACE,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ;QACjC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,EAC9C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,OAAO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/
|
|
44
44
|
export interface DeepAgentDefinition {
|
|
45
45
|
readonly kind: "deep-agent";
|
|
46
|
-
readonly config:
|
|
47
|
-
readonly disableMemory: boolean;
|
|
46
|
+
readonly config: DefineDeepAgentConfig;
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* Metadata about the inbound channel event that created or resumed a run.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,OAAO,GACP,cAAc,GACd,cAAc,GACd,QAAQ,GACR,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,OAAO,GACP,cAAc,GACd,cAAc,GACd,QAAQ,GACR,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,qBAAqB,EACrB,mBAAmB,CACpB,GAAG;IACF,4EAA4E;IAC5E,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,mDAAmD;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kDAAkD;IAClD,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,qEAAqE;IACrE,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,6DAA6D;IAC7D,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB;;;OAGG;IACH,aAAa,CAA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B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IAC1E,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CACF,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,cAAc,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "managed-deepagents",
|
|
3
|
-
"version": "0.0.3-dev.
|
|
3
|
+
"version": "0.0.3-dev.26",
|
|
4
4
|
"description": "Managed Deep Agents — the `defineDeepAgent` authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langchain",
|
|
@@ -38,27 +38,33 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -p tsconfig.json",
|
|
40
40
|
"clean": "rm -rf dist",
|
|
41
|
+
"format": "oxfmt --config ../../.oxfmtrc.jsonc --write src",
|
|
42
|
+
"format:check": "oxfmt --config ../../.oxfmtrc.jsonc --check src",
|
|
43
|
+
"lint": "oxlint --config ../../.oxlintrc.jsonc src",
|
|
44
|
+
"lint:fix": "oxlint --config ../../.oxlintrc.jsonc src --fix",
|
|
41
45
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
42
|
-
"test": "vitest run",
|
|
46
|
+
"test": "vitest run --typecheck",
|
|
43
47
|
"test:watch": "vitest"
|
|
44
48
|
},
|
|
45
49
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
50
|
+
"node": ">=22"
|
|
47
51
|
},
|
|
48
52
|
"dependencies": {
|
|
49
53
|
"@langchain/mcp-adapters": "^1.1.3",
|
|
50
54
|
"deepagents": "^1.10.4"
|
|
51
55
|
},
|
|
52
56
|
"optionalDependencies": {
|
|
53
|
-
"@langchain/managed-deepagents-darwin-arm64": "0.0.3-dev.
|
|
54
|
-
"@langchain/managed-deepagents-darwin-x64": "0.0.3-dev.
|
|
55
|
-
"@langchain/managed-deepagents-linux-arm64": "0.0.3-dev.
|
|
56
|
-
"@langchain/managed-deepagents-linux-x64": "0.0.3-dev.
|
|
57
|
-
"@langchain/managed-deepagents-win32-
|
|
58
|
-
"@langchain/managed-deepagents-win32-
|
|
57
|
+
"@langchain/managed-deepagents-darwin-arm64": "0.0.3-dev.26",
|
|
58
|
+
"@langchain/managed-deepagents-darwin-x64": "0.0.3-dev.26",
|
|
59
|
+
"@langchain/managed-deepagents-linux-arm64": "0.0.3-dev.26",
|
|
60
|
+
"@langchain/managed-deepagents-linux-x64": "0.0.3-dev.26",
|
|
61
|
+
"@langchain/managed-deepagents-win32-arm64": "0.0.3-dev.26",
|
|
62
|
+
"@langchain/managed-deepagents-win32-x64": "0.0.3-dev.26"
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"@types/node": "^26.0.1",
|
|
66
|
+
"oxfmt": "^0.57.0",
|
|
67
|
+
"oxlint": "^1.72.0",
|
|
62
68
|
"typescript": "^6.0.3",
|
|
63
69
|
"vitest": "^4.1.9"
|
|
64
70
|
}
|