@agentstep/agent-sdk 0.4.13 → 0.4.15
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/auth/middleware.js +11 -6
- package/dist/auth/passthrough.js +9 -0
- package/dist/backends/claude/args.js +6 -6
- package/dist/backends/claude/index.js +8 -8
- package/dist/backends/claude/wrapper-script.js +1 -1
- package/dist/backends/codex/auth.js +6 -6
- package/dist/backends/codex/index.js +13 -13
- package/dist/backends/codex/setup.js +4 -4
- package/dist/backends/codex/wrapper-script.js +1 -1
- package/dist/backends/factory/auth.js +6 -6
- package/dist/backends/factory/index.js +14 -14
- package/dist/backends/factory/setup.js +4 -4
- package/dist/backends/factory/wrapper-script.js +1 -1
- package/dist/backends/gemini/auth.js +6 -6
- package/dist/backends/gemini/index.js +13 -13
- package/dist/backends/gemini/setup.js +4 -4
- package/dist/backends/gemini/wrapper-script.js +1 -1
- package/dist/backends/opencode/auth.js +6 -6
- package/dist/backends/opencode/index.js +11 -11
- package/dist/backends/opencode/setup.js +4 -4
- package/dist/backends/opencode/wrapper-script.js +1 -1
- package/dist/backends/pi/auth.js +6 -6
- package/dist/backends/pi/index.js +14 -14
- package/dist/backends/pi/setup.js +4 -4
- package/dist/backends/pi/wrapper-script.js +1 -1
- package/dist/backends/registry.js +30 -30
- package/dist/{chunk-5GDMWWYD.js → chunk-2BDD6OHG.js} +10 -2
- package/dist/{chunk-7YYEE7XR.js → chunk-2BZ2XKJU.js} +5 -5
- package/dist/{chunk-OHYPVKTP.js → chunk-3LG7DRJL.js} +4 -4
- package/dist/{chunk-ZA4JVJJE.js → chunk-3PLJHZFD.js} +1 -1
- package/dist/{chunk-ME6IR4T6.js → chunk-3W6KEDQE.js} +4 -4
- package/dist/{chunk-PMEF3X3C.js → chunk-46LBKEBE.js} +2 -2
- package/dist/{chunk-XLMHG3KR.js → chunk-5DHH2PGR.js} +50 -47
- package/dist/{chunk-6QDHS2MR.js → chunk-5GIZLWWF.js} +1 -1
- package/dist/{chunk-DZDWNOEY.js → chunk-5GZEX4HV.js} +1 -1
- package/dist/{chunk-V364DYC3.js → chunk-5XF65N7J.js} +1 -1
- package/dist/{chunk-6UXT3RG5.js → chunk-64ZLFLMN.js} +4 -4
- package/dist/{chunk-JMDS2RJJ.js → chunk-66CJ6LMV.js} +1 -1
- package/dist/{chunk-2FWZ247V.js → chunk-6IWTDQJN.js} +9 -4
- package/dist/{chunk-TQHS4W74.js → chunk-6OL43KT2.js} +1 -1
- package/dist/{chunk-JZ5RFO77.js → chunk-7LQN7NVU.js} +5 -5
- package/dist/{chunk-X3U7IVTN.js → chunk-7OAMTB47.js} +2 -2
- package/dist/{chunk-I3AP3LEY.js → chunk-ACKMNK3C.js} +7 -7
- package/dist/{chunk-IJEZAD5O.js → chunk-ADK2TYO4.js} +2 -2
- package/dist/{chunk-CX4VNHL6.js → chunk-AH7DAJU5.js} +74 -32
- package/dist/{chunk-5ZRGJTR3.js → chunk-AM7F65IC.js} +10 -10
- package/dist/{chunk-MXRGQRFX.js → chunk-BMPB7XJH.js} +6 -6
- package/dist/{chunk-V7OXXKAL.js → chunk-BZ6HFTHU.js} +1 -1
- package/dist/{chunk-TSYQ4XKJ.js → chunk-CDCLICKM.js} +2 -2
- package/dist/{chunk-FXLGGDLM.js → chunk-CE45WWNZ.js} +4 -4
- package/dist/{chunk-QKRWCXDU.js → chunk-CGSUJZ56.js} +1 -1
- package/dist/{chunk-3WJMUX5B.js → chunk-DO4WVWW7.js} +1 -1
- package/dist/{chunk-AKRE4OEL.js → chunk-EFOIR7R3.js} +5 -3
- package/dist/{chunk-M4RE42AY.js → chunk-ENOKSV57.js} +3 -3
- package/dist/{chunk-RTS2QUZB.js → chunk-EO5ZTIP7.js} +20 -11
- package/dist/{chunk-3NZQBGUJ.js → chunk-F2SDCOHG.js} +18 -18
- package/dist/{chunk-FB6FOIAY.js → chunk-FB4OSWM2.js} +1 -1
- package/dist/{chunk-2PKJSOXX.js → chunk-FCULDJQO.js} +1 -1
- package/dist/{chunk-Q4XYK6FF.js → chunk-GJBKDPQD.js} +5 -5
- package/dist/{chunk-7TW4LHPM.js → chunk-HECQRMDR.js} +2 -2
- package/dist/{chunk-XLVCC4IB.js → chunk-HWWCVD2R.js} +7 -7
- package/dist/{chunk-MBLMAWSE.js → chunk-I5ZA45YL.js} +7 -7
- package/dist/{chunk-X7W6S3TE.js → chunk-IU457W7Q.js} +5 -5
- package/dist/{chunk-HWTECG57.js → chunk-J4TYHQQG.js} +1 -1
- package/dist/{chunk-Y2SC7HU5.js → chunk-JDBXIJKG.js} +4 -4
- package/dist/{chunk-FDY5BA67.js → chunk-JDELTTHV.js} +1 -1
- package/dist/{chunk-BAH4JSTO.js → chunk-JEI7I3EH.js} +3 -3
- package/dist/{chunk-CKPGSS76.js → chunk-JK5TPJHH.js} +1 -1
- package/dist/{chunk-WUNJJNOV.js → chunk-JKUR5MIM.js} +4 -4
- package/dist/{chunk-4BYPJFC5.js → chunk-JOAEFGXZ.js} +62 -54
- package/dist/{chunk-NHY4Q6LS.js → chunk-JOZK6G5O.js} +14 -14
- package/dist/{chunk-5A6E4F5D.js → chunk-JSLEB2ED.js} +2 -1
- package/dist/{chunk-3KDZP45U.js → chunk-K7KLJ2UJ.js} +13 -10
- package/dist/{chunk-LP7AQJCU.js → chunk-KGARPQA4.js} +3 -3
- package/dist/{chunk-6A74MTSB.js → chunk-L6CUSDUF.js} +3 -3
- package/dist/{chunk-N5CUDEUJ.js → chunk-LHHBOQUR.js} +2 -2
- package/dist/{chunk-4FHRWC4H.js → chunk-LJF4GWPJ.js} +5 -5
- package/dist/{chunk-RL6XEYOD.js → chunk-MHQXDTJB.js} +1 -1
- package/dist/{chunk-UX6I36QR.js → chunk-NDQ6CQ7B.js} +122 -122
- package/dist/{chunk-7BGILLYC.js → chunk-NIOWKTIF.js} +2 -2
- package/dist/{chunk-KDAZ5TBL.js → chunk-NK2RCTFI.js} +8 -8
- package/dist/{chunk-OXREXXAQ.js → chunk-NUINUAXO.js} +2 -2
- package/dist/{chunk-XTZ5RQDF.js → chunk-NUO56TF7.js} +4 -4
- package/dist/{chunk-ZIV74JWW.js → chunk-NXRJ7Z4G.js} +2 -2
- package/dist/{chunk-AHHH4PYB.js → chunk-O45IQUWS.js} +3 -3
- package/dist/{chunk-UXZSRUXD.js → chunk-ORU5GQ4Z.js} +2 -2
- package/dist/{chunk-QYFD2OBI.js → chunk-OWTXN2FU.js} +1 -1
- package/dist/{chunk-V4P46OHG.js → chunk-P7P2NWZD.js} +5 -5
- package/dist/{chunk-MAW3HLIO.js → chunk-PB7LR2AG.js} +2 -2
- package/dist/{chunk-KEV4OMRF.js → chunk-PNYCULIF.js} +9 -9
- package/dist/{chunk-VVH5DQ2C.js → chunk-PWWRWR75.js} +42 -3
- package/dist/{chunk-G5RQN53K.js → chunk-PZWVTEL2.js} +1 -1
- package/dist/{chunk-OGONPLTA.js → chunk-QFUJDBET.js} +6 -6
- package/dist/{chunk-Q5KHBU7P.js → chunk-QH57EOKP.js} +12 -4
- package/dist/{chunk-6ZJ6X6H7.js → chunk-QLWA4MJ5.js} +15 -4
- package/dist/{chunk-2QGVGXIT.js → chunk-QQDSHL27.js} +4 -4
- package/dist/{chunk-J4NKW3L5.js → chunk-QYSDP6V5.js} +5 -5
- package/dist/{chunk-ETGRQMFJ.js → chunk-R45W644X.js} +1 -1
- package/dist/{chunk-LPWEFC55.js → chunk-R5OZHLAD.js} +2 -2
- package/dist/{chunk-DFE7VZWD.js → chunk-RMEX55EU.js} +4 -4
- package/dist/{chunk-TY7XTT5N.js → chunk-RZXRMPF4.js} +1 -1
- package/dist/{chunk-D5XOXR3A.js → chunk-S3SKODVV.js} +4 -4
- package/dist/{chunk-CU5GUNFW.js → chunk-S6AM7WVH.js} +2 -2
- package/dist/{chunk-YOFB6CO5.js → chunk-SDLNBA53.js} +7 -7
- package/dist/{chunk-JFY6EH24.js → chunk-SIKTYKVO.js} +15 -15
- package/dist/{chunk-7XFIUYFM.js → chunk-SWIP7JBQ.js} +4 -4
- package/dist/{chunk-XNK2KUTI.js → chunk-SXE7H3VK.js} +2 -2
- package/dist/{chunk-OQWHKEYE.js → chunk-TFK6TCMC.js} +3 -3
- package/dist/{chunk-TV2VE2LX.js → chunk-TWPTR2C2.js} +2 -2
- package/dist/{chunk-3MNDEAPX.js → chunk-UJDAT42X.js} +8 -8
- package/dist/{chunk-UN3LHCWQ.js → chunk-VIGJQU6V.js} +3 -3
- package/dist/{chunk-4INVRCRD.js → chunk-VO7BDPYU.js} +2 -2
- package/dist/{chunk-UVCPCX74.js → chunk-VS7AMAMU.js} +8 -8
- package/dist/chunk-W6WKXFHN.js +39 -0
- package/dist/{chunk-3EGA6TEL.js → chunk-WPEGSLXX.js} +1 -1
- package/dist/{chunk-YM2LYRYY.js → chunk-WRWTK455.js} +3 -3
- package/dist/{chunk-W3M3ME6B.js → chunk-XG4UIGDH.js} +5 -5
- package/dist/{chunk-TH54MJMX.js → chunk-XPKY3Z54.js} +1 -1
- package/dist/{chunk-BM34UHSS.js → chunk-Y27R572J.js} +6 -5
- package/dist/{chunk-6BDLNY5J.js → chunk-Y4X3QY2S.js} +2 -2
- package/dist/{chunk-U4F4JSME.js → chunk-Y6ZY23HE.js} +3 -3
- package/dist/{chunk-KZGAZPNV.js → chunk-YGAHGTVZ.js} +3 -3
- package/dist/{chunk-H74BPBKE.js → chunk-YSUPRYX2.js} +5 -5
- package/dist/{chunk-HERWBOQ7.js → chunk-ZLUBNJEO.js} +5 -5
- package/dist/{chunk-Y5553CX6.js → chunk-ZP5VMV5O.js} +4 -4
- package/dist/config/index.js +5 -5
- package/dist/containers/client.js +6 -6
- package/dist/containers/exec.js +6 -6
- package/dist/containers/lifecycle.js +47 -47
- package/dist/containers/pool.js +3 -3
- package/dist/containers/setup.js +9 -9
- package/dist/db/agents.js +6 -6
- package/dist/db/api_keys.js +5 -5
- package/dist/db/audit.js +3 -3
- package/dist/db/batch.js +10 -10
- package/dist/db/client.js +2 -2
- package/dist/db/credentials.js +3 -3
- package/dist/db/drizzle.js +4 -4
- package/dist/db/environments.js +6 -6
- package/dist/db/events.js +5 -5
- package/dist/db/files.js +5 -5
- package/dist/db/memory.js +5 -5
- package/dist/db/migrations.js +1 -1
- package/dist/db/proxy.js +5 -5
- package/dist/db/schema.js +1 -1
- package/dist/db/session-resources.js +5 -5
- package/dist/db/sessions.js +9 -9
- package/dist/db/sync.js +5 -5
- package/dist/db/tenants.js +3 -3
- package/dist/db/traces.js +5 -5
- package/dist/db/upstream_keys.js +3 -3
- package/dist/db/vaults.js +6 -6
- package/dist/handlers/agents.js +60 -59
- package/dist/handlers/api_keys.js +61 -59
- package/dist/handlers/audit.js +61 -59
- package/dist/handlers/batch.js +61 -59
- package/dist/handlers/credentials.js +61 -59
- package/dist/handlers/environments.js +61 -60
- package/dist/handlers/events.js +64 -63
- package/dist/handlers/files.js +61 -59
- package/dist/handlers/index.js +125 -124
- package/dist/handlers/license.js +60 -58
- package/dist/handlers/memory.js +61 -59
- package/dist/handlers/metrics.js +60 -58
- package/dist/handlers/models.js +61 -59
- package/dist/handlers/openapi.js +3 -3
- package/dist/handlers/providers.js +60 -58
- package/dist/handlers/resources.js +60 -58
- package/dist/handlers/sessions.js +63 -62
- package/dist/handlers/settings.js +60 -58
- package/dist/handlers/skills-write.js +60 -58
- package/dist/handlers/skills.js +61 -59
- package/dist/handlers/stream.js +60 -59
- package/dist/handlers/tenants.js +61 -59
- package/dist/handlers/threads.js +60 -58
- package/dist/handlers/traces.js +61 -59
- package/dist/handlers/ui.js +1 -1
- package/dist/handlers/upstream_keys.js +63 -61
- package/dist/handlers/vaults.js +60 -58
- package/dist/handlers/whoami.js +60 -58
- package/dist/http.js +59 -57
- package/dist/index.js +81 -78
- package/dist/init.js +55 -55
- package/dist/lib/model-registry.js +6 -6
- package/dist/lib/skills-cache.js +6 -6
- package/dist/observability/otlp.js +12 -12
- package/dist/observability/redactor.js +8 -8
- package/dist/openapi/schemas.js +1 -1
- package/dist/openapi/spec.js +2 -2
- package/dist/providers/fly.js +5 -5
- package/dist/providers/modal.js +5 -5
- package/dist/providers/registry.js +1 -1
- package/dist/providers/resolve-secrets.js +7 -7
- package/dist/providers/sprites.js +7 -7
- package/dist/providers/upstream-keys.js +11 -11
- package/dist/providers/vercel.js +5 -5
- package/dist/proxy/forward.js +6 -6
- package/dist/queue/index.js +6 -6
- package/dist/sessions/bus.js +10 -10
- package/dist/sessions/driver.js +48 -48
- package/dist/sessions/grader.js +5 -5
- package/dist/sessions/secrets.js +8 -8
- package/dist/sessions/sweeper.js +44 -44
- package/dist/sessions/threads.js +52 -52
- package/dist/shutdown.js +45 -45
- package/dist/sync/anthropic.js +10 -10
- package/dist/sync/container-file-sync.js +27 -15
- package/dist/sync/file-sync.js +19 -19
- package/package.json +1 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listBackends,
|
|
3
3
|
resolveBackend
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-QFUJDBET.js";
|
|
5
|
+
import "../chunk-VS7AMAMU.js";
|
|
6
|
+
import "../chunk-T5VRE77P.js";
|
|
7
|
+
import "../chunk-66CJ6LMV.js";
|
|
8
|
+
import "../chunk-QYSDP6V5.js";
|
|
8
9
|
import "../chunk-B6E6BVNK.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-JDBXIJKG.js";
|
|
11
|
+
import "../chunk-GJBKDPQD.js";
|
|
11
12
|
import "../chunk-K4E66KY5.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-3PLJHZFD.js";
|
|
13
14
|
import "../chunk-Z25I7DRV.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-P7P2NWZD.js";
|
|
15
16
|
import "../chunk-ETWGCBIQ.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-XLVCC4IB.js";
|
|
17
|
+
import "../chunk-SWIP7JBQ.js";
|
|
18
|
+
import "../chunk-HWWCVD2R.js";
|
|
19
19
|
import "../chunk-JHGJG2Z2.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-RZXRMPF4.js";
|
|
21
|
+
import "../chunk-XG4UIGDH.js";
|
|
22
|
+
import "../chunk-3W6KEDQE.js";
|
|
22
23
|
import "../chunk-S3JRZFF5.js";
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-NK2RCTFI.js";
|
|
25
|
+
import "../chunk-5XF65N7J.js";
|
|
26
|
+
import "../chunk-7LQN7NVU.js";
|
|
26
27
|
import "../chunk-CULYZ3VA.js";
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-RMEX55EU.js";
|
|
29
|
+
import "../chunk-UJDAT42X.js";
|
|
30
|
+
import "../chunk-YSUPRYX2.js";
|
|
29
31
|
import "../chunk-7TSTCMII.js";
|
|
32
|
+
import "../chunk-QQDSHL27.js";
|
|
30
33
|
import "../chunk-DAT55TX2.js";
|
|
31
34
|
import "../chunk-IAF6VMPO.js";
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
-
import "../chunk-
|
|
35
|
-
import "../chunk-JFY6EH24.js";
|
|
36
|
-
import "../chunk-G5RQN53K.js";
|
|
35
|
+
import "../chunk-FCULDJQO.js";
|
|
36
|
+
import "../chunk-SIKTYKVO.js";
|
|
37
|
+
import "../chunk-PZWVTEL2.js";
|
|
37
38
|
import "../chunk-CY6AWCC6.js";
|
|
38
39
|
import "../chunk-ALVC7G6R.js";
|
|
39
40
|
import "../chunk-JFYE5BFI.js";
|
|
40
41
|
import "../chunk-NQX7WBA4.js";
|
|
41
|
-
import "../chunk-V364DYC3.js";
|
|
42
42
|
import "../chunk-XBHDQK4Z.js";
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-IU457W7Q.js";
|
|
44
44
|
import "../chunk-F4WUVOLE.js";
|
|
45
|
-
import "../chunk-
|
|
46
|
-
import "../chunk-
|
|
47
|
-
import "../chunk-
|
|
45
|
+
import "../chunk-QH57EOKP.js";
|
|
46
|
+
import "../chunk-SXE7H3VK.js";
|
|
47
|
+
import "../chunk-LHHBOQUR.js";
|
|
48
48
|
import "../chunk-HFDLUBWN.js";
|
|
49
|
-
import "../chunk-
|
|
50
|
-
import "../chunk-
|
|
49
|
+
import "../chunk-5GZEX4HV.js";
|
|
50
|
+
import "../chunk-2BDD6OHG.js";
|
|
51
51
|
import "../chunk-EZYKRG4W.js";
|
|
52
52
|
import "../chunk-XZYIH3AF.js";
|
|
53
53
|
import "../chunk-2ESYSVXG.js";
|
|
@@ -51,7 +51,7 @@ function runMigrations(db) {
|
|
|
51
51
|
config_json TEXT NOT NULL,
|
|
52
52
|
state TEXT NOT NULL DEFAULT 'preparing',
|
|
53
53
|
state_message TEXT,
|
|
54
|
-
|
|
54
|
+
template_sandbox TEXT,
|
|
55
55
|
checkpoint_id TEXT,
|
|
56
56
|
created_at INTEGER NOT NULL,
|
|
57
57
|
archived_at INTEGER
|
|
@@ -62,7 +62,7 @@ function runMigrations(db) {
|
|
|
62
62
|
agent_id TEXT NOT NULL,
|
|
63
63
|
agent_version INTEGER NOT NULL,
|
|
64
64
|
environment_id TEXT NOT NULL,
|
|
65
|
-
|
|
65
|
+
sandbox_name TEXT,
|
|
66
66
|
-- Legacy name: holds any backend's session id (claude's session_id or
|
|
67
67
|
-- opencode's sessionID). Kept as claude_session_id to avoid schema
|
|
68
68
|
-- churn; see lib/backends/types.ts for the abstraction.
|
|
@@ -444,6 +444,14 @@ function runMigrations(db) {
|
|
|
444
444
|
UNIQUE(vault_id, display_name)
|
|
445
445
|
)
|
|
446
446
|
`);
|
|
447
|
+
const sessCols3 = db.prepare(`PRAGMA table_info(sessions)`).all();
|
|
448
|
+
if (sessCols3.some((c) => c.name === "sprite_name")) {
|
|
449
|
+
db.exec(`ALTER TABLE sessions RENAME COLUMN sprite_name TO sandbox_name`);
|
|
450
|
+
}
|
|
451
|
+
const envCols3 = db.prepare(`PRAGMA table_info(environments)`).all();
|
|
452
|
+
if (envCols3.some((c) => c.name === "template_sprite")) {
|
|
453
|
+
db.exec(`ALTER TABLE environments RENAME COLUMN template_sprite TO template_sandbox`);
|
|
454
|
+
}
|
|
447
455
|
}
|
|
448
456
|
var init_migrations = __esm({
|
|
449
457
|
"src/db/migrations.ts"() {
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
jsonOk,
|
|
6
6
|
routeWrap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6IWTDQJN.js";
|
|
8
8
|
import {
|
|
9
9
|
getProxiedTenantId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NIOWKTIF.js";
|
|
11
11
|
import {
|
|
12
12
|
getSession,
|
|
13
13
|
updateSessionResources
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-I5ZA45YL.js";
|
|
15
15
|
import {
|
|
16
16
|
countResources,
|
|
17
17
|
createResource,
|
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
getResource,
|
|
20
20
|
init_session_resources,
|
|
21
21
|
listResources
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-R5OZHLAD.js";
|
|
23
23
|
import {
|
|
24
24
|
getDb,
|
|
25
25
|
init_client
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5GZEX4HV.js";
|
|
27
27
|
import {
|
|
28
28
|
badRequest,
|
|
29
29
|
notFound
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disableUpstreamKey,
|
|
3
3
|
selectNextUpstreamKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BZ6HFTHU.js";
|
|
5
5
|
import {
|
|
6
6
|
listEntries
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VIGJQU6V.js";
|
|
8
8
|
import {
|
|
9
9
|
getSession
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-I5ZA45YL.js";
|
|
11
11
|
import {
|
|
12
12
|
getConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QH57EOKP.js";
|
|
14
14
|
|
|
15
15
|
// src/providers/upstream-keys.ts
|
|
16
16
|
var CONSECUTIVE_FAIL_THRESHOLD = 3;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/backends/gemini/wrapper-script.ts
|
|
2
2
|
var GEMINI_WRAPPER_PATH = "/tmp/.gemini-wrapper";
|
|
3
|
-
var
|
|
3
|
+
var SANDBOX_WRAPPER_SCRIPT = [
|
|
4
4
|
"#!/bin/bash",
|
|
5
5
|
'while IFS= read -r line; do [ -z "$line" ] && break; export "$line"; done',
|
|
6
6
|
'exec gemini "$@"'
|
|
7
7
|
].join("\n");
|
|
8
|
-
async function installGeminiWrapper(
|
|
9
|
-
const escaped =
|
|
10
|
-
await provider.exec(
|
|
8
|
+
async function installGeminiWrapper(sandboxName, provider) {
|
|
9
|
+
const escaped = SANDBOX_WRAPPER_SCRIPT.replace(/'/g, "'\\''");
|
|
10
|
+
await provider.exec(sandboxName, [
|
|
11
11
|
"bash",
|
|
12
12
|
"-c",
|
|
13
13
|
`printf '%s' '${escaped}' > ${GEMINI_WRAPPER_PATH} && chmod +x ${GEMINI_WRAPPER_PATH}`
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
jsonOk,
|
|
10
10
|
routeWrap
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6IWTDQJN.js";
|
|
12
12
|
import {
|
|
13
13
|
snapshotApiMetrics
|
|
14
14
|
} from "./chunk-D2XITRN6.js";
|
|
15
15
|
import {
|
|
16
16
|
getDb,
|
|
17
17
|
init_client
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5GZEX4HV.js";
|
|
19
19
|
import {
|
|
20
20
|
badRequest
|
|
21
21
|
} from "./chunk-EZYKRG4W.js";
|
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
childSpan,
|
|
6
6
|
newTrace
|
|
7
7
|
} from "./chunk-AU4NAQGA.js";
|
|
8
|
+
import {
|
|
9
|
+
buildErrorPayload,
|
|
10
|
+
classifyError,
|
|
11
|
+
init_errors
|
|
12
|
+
} from "./chunk-H6TQGV4L.js";
|
|
8
13
|
import {
|
|
9
14
|
injectMcpAuthHeaders
|
|
10
15
|
} from "./chunk-SV2B3P6B.js";
|
|
@@ -16,37 +21,22 @@ import {
|
|
|
16
21
|
} from "./chunk-72BKGVBE.js";
|
|
17
22
|
import {
|
|
18
23
|
loadSessionSecrets
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
buildErrorPayload,
|
|
22
|
-
classifyError,
|
|
23
|
-
init_errors
|
|
24
|
-
} from "./chunk-H6TQGV4L.js";
|
|
24
|
+
} from "./chunk-7OAMTB47.js";
|
|
25
25
|
import {
|
|
26
26
|
isProxied
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-NIOWKTIF.js";
|
|
28
28
|
import {
|
|
29
29
|
acquireForFirstTurn,
|
|
30
30
|
installSkills,
|
|
31
31
|
provisionResources
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-JOAEFGXZ.js";
|
|
33
33
|
import {
|
|
34
34
|
BLOCKED_ENV_KEYS
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-DO4WVWW7.js";
|
|
36
36
|
import {
|
|
37
37
|
appendEvent,
|
|
38
38
|
appendEventsBatch
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
listEvents,
|
|
42
|
-
markUserEventProcessed
|
|
43
|
-
} from "./chunk-AHHH4PYB.js";
|
|
44
|
-
import {
|
|
45
|
-
getBySession
|
|
46
|
-
} from "./chunk-AKRE4OEL.js";
|
|
47
|
-
import {
|
|
48
|
-
resolveContainerProvider
|
|
49
|
-
} from "./chunk-5A6E4F5D.js";
|
|
39
|
+
} from "./chunk-BMPB7XJH.js";
|
|
50
40
|
import {
|
|
51
41
|
bumpSessionStats,
|
|
52
42
|
getOutcomeCriteria,
|
|
@@ -57,16 +47,26 @@ import {
|
|
|
57
47
|
setOutcomeCriteria,
|
|
58
48
|
updateSessionMutable,
|
|
59
49
|
updateSessionStatus
|
|
60
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-I5ZA45YL.js";
|
|
51
|
+
import {
|
|
52
|
+
listEvents,
|
|
53
|
+
markUserEventProcessed
|
|
54
|
+
} from "./chunk-O45IQUWS.js";
|
|
55
|
+
import {
|
|
56
|
+
getBySession
|
|
57
|
+
} from "./chunk-EFOIR7R3.js";
|
|
58
|
+
import {
|
|
59
|
+
resolveContainerProvider
|
|
60
|
+
} from "./chunk-JSLEB2ED.js";
|
|
61
61
|
import {
|
|
62
62
|
getEnvironment
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-NUO56TF7.js";
|
|
64
64
|
import {
|
|
65
65
|
getAgent
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-JEI7I3EH.js";
|
|
67
67
|
import {
|
|
68
68
|
resolveBackend
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-QFUJDBET.js";
|
|
70
70
|
import {
|
|
71
71
|
PERMISSION_BRIDGE_PENDING_PATH,
|
|
72
72
|
PERMISSION_BRIDGE_REQUEST_PATH,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
} from "./chunk-XBHDQK4Z.js";
|
|
78
78
|
import {
|
|
79
79
|
getConfig
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-QH57EOKP.js";
|
|
81
81
|
import {
|
|
82
82
|
init_clock,
|
|
83
83
|
nowMs
|
|
@@ -181,14 +181,17 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
181
181
|
if (row && row.title == null) {
|
|
182
182
|
const firstText = inputs.find((i) => i.kind === "text");
|
|
183
183
|
if (firstText?.text) {
|
|
184
|
-
|
|
184
|
+
const sanitized = firstText.text.replace(/[\x00-\x1F\x7F\u200B-\u200F\u2028-\u202F\uFEFF]/g, "").replace(/^Image(?=[A-Z])/g, "").replace(/\s+/g, " ").trim();
|
|
185
|
+
if (sanitized) {
|
|
186
|
+
updateSessionMutable(sessionId, { title: sanitized.slice(0, 60) });
|
|
187
|
+
}
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
console.log(`[driver] ${sessionId} acquiring container...`);
|
|
188
|
-
let
|
|
191
|
+
let sandboxName;
|
|
189
192
|
try {
|
|
190
|
-
|
|
191
|
-
console.log(`[driver] ${sessionId} container ready: ${
|
|
193
|
+
sandboxName = await acquireForFirstTurn(sessionId);
|
|
194
|
+
console.log(`[driver] ${sessionId} container ready: ${sandboxName}`);
|
|
192
195
|
const latestAgent = getAgent(session.agent.id);
|
|
193
196
|
if (latestAgent && latestAgent.skills && latestAgent.skills.length > 0) {
|
|
194
197
|
const currentSkills = new Map((agent.skills ?? []).map((s) => [s.name, s.content.length]));
|
|
@@ -199,7 +202,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
199
202
|
console.log(`[driver] ${sessionId} injecting ${newSkills.length} new skill(s)...`);
|
|
200
203
|
const envRow = getEnvironment(session.environment_id);
|
|
201
204
|
const sp = await resolveContainerProvider(envRow?.config?.provider);
|
|
202
|
-
await installSkills(
|
|
205
|
+
await installSkills(sandboxName, sp, newSkills, agent.engine);
|
|
203
206
|
console.log(`[driver] ${sessionId} skills injected`);
|
|
204
207
|
}
|
|
205
208
|
}
|
|
@@ -207,7 +210,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
207
210
|
if (freshSession2?.resources && freshSession2.resources.length > 0) {
|
|
208
211
|
const envRow = getEnvironment(session.environment_id);
|
|
209
212
|
const sp = await resolveContainerProvider(envRow?.config?.provider);
|
|
210
|
-
await provisionResources(
|
|
213
|
+
await provisionResources(sandboxName, freshSession2.resources, sp);
|
|
211
214
|
}
|
|
212
215
|
} catch (err) {
|
|
213
216
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -271,7 +274,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
|
|
|
271
274
|
let ollamaHostPort;
|
|
272
275
|
if (!turnBuild.env.OLLAMA_HOST) {
|
|
273
276
|
const envRow = getEnvironment(session.environment_id);
|
|
274
|
-
const provName = envRow?.config?.provider ?? "
|
|
277
|
+
const provName = envRow?.config?.provider ?? "docker";
|
|
275
278
|
if (provName === "docker" || provName === "podman") {
|
|
276
279
|
ollamaHostPort = "host.docker.internal:11434";
|
|
277
280
|
} else if (provName === "apple-container" || provName === "apple-firecracker") {
|
|
@@ -328,19 +331,19 @@ ${turnBuild.stdin}`;
|
|
|
328
331
|
});
|
|
329
332
|
if (agent.engine === "claude" && toolResults.length > 0) {
|
|
330
333
|
const { TOOL_BRIDGE_RESPONSE_PATH, TOOL_BRIDGE_PENDING_PATH } = await import("./backends/claude/tool-bridge.js");
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
334
|
+
const sandboxName2 = getSessionRow(sessionId)?.sandbox_name;
|
|
335
|
+
if (sandboxName2) {
|
|
333
336
|
for (const r of toolResults) {
|
|
334
337
|
const responseJson = JSON.stringify({ content: r.content });
|
|
335
338
|
await provider.exec(
|
|
336
|
-
|
|
339
|
+
sandboxName2,
|
|
337
340
|
["bash", "-c", `cat > ${TOOL_BRIDGE_RESPONSE_PATH}`],
|
|
338
341
|
{ stdin: responseJson, secrets }
|
|
339
342
|
).catch((err) => {
|
|
340
343
|
console.warn(`[driver] failed to write tool bridge response:`, err);
|
|
341
344
|
});
|
|
342
345
|
await provider.exec(
|
|
343
|
-
|
|
346
|
+
sandboxName2,
|
|
344
347
|
["rm", "-f", TOOL_BRIDGE_PENDING_PATH],
|
|
345
348
|
{ secrets }
|
|
346
349
|
).catch(() => {
|
|
@@ -357,7 +360,7 @@ ${turnBuild.stdin}`;
|
|
|
357
360
|
});
|
|
358
361
|
let exec;
|
|
359
362
|
try {
|
|
360
|
-
exec = await provider.startExec(
|
|
363
|
+
exec = await provider.startExec(sandboxName, {
|
|
361
364
|
argv,
|
|
362
365
|
stdin,
|
|
363
366
|
signal: controller.signal,
|
|
@@ -379,7 +382,7 @@ ${turnBuild.stdin}`;
|
|
|
379
382
|
let permissionPollTimer = null;
|
|
380
383
|
if (agent.confirmation_mode) {
|
|
381
384
|
permissionPollTimer = setInterval(() => {
|
|
382
|
-
void checkPermissionSentinel(sessionId,
|
|
385
|
+
void checkPermissionSentinel(sessionId, sandboxName, provider).catch(
|
|
383
386
|
(err) => {
|
|
384
387
|
console.warn(`[driver] permission sentinel check failed:`, err);
|
|
385
388
|
}
|
|
@@ -511,12 +514,12 @@ ${turnBuild.stdin}`;
|
|
|
511
514
|
result?.usage
|
|
512
515
|
);
|
|
513
516
|
const sessionRowForSync = getSessionRow(sessionId);
|
|
514
|
-
if (sessionRowForSync?.
|
|
517
|
+
if (sessionRowForSync?.sandbox_name && !isProxied(sessionId)) {
|
|
515
518
|
try {
|
|
516
519
|
const { syncContainerFiles } = await import("./sync/container-file-sync.js");
|
|
517
520
|
const syncResult = await syncContainerFiles({
|
|
518
521
|
sessionId,
|
|
519
|
-
|
|
522
|
+
sandboxName: sessionRowForSync.sandbox_name,
|
|
520
523
|
provider,
|
|
521
524
|
secrets
|
|
522
525
|
});
|
|
@@ -541,7 +544,7 @@ ${turnBuild.stdin}`;
|
|
|
541
544
|
emit("session.status_idle", { stop_reason: formatStopReason("custom_tool_call", customToolEventIds) }, { at: now });
|
|
542
545
|
updateSessionStatus(sessionId, "idle", "custom_tool_call");
|
|
543
546
|
const { TOOL_BRIDGE_RESPONSE_PATH, TOOL_BRIDGE_PENDING_PATH } = await import("./backends/claude/tool-bridge.js");
|
|
544
|
-
const sprName = getSessionRow(sessionId)?.
|
|
547
|
+
const sprName = getSessionRow(sessionId)?.sandbox_name;
|
|
545
548
|
if (sprName) {
|
|
546
549
|
const responseJson = JSON.stringify({ content: [{ type: "text", text: serverToolResult.text }] });
|
|
547
550
|
const envForSession = getEnvironment(session.environment_id);
|
|
@@ -691,11 +694,11 @@ function getPendingConfirmations() {
|
|
|
691
694
|
if (!gd.__caPendingConfirmations) gd.__caPendingConfirmations = /* @__PURE__ */ new Set();
|
|
692
695
|
return gd.__caPendingConfirmations;
|
|
693
696
|
}
|
|
694
|
-
async function checkPermissionSentinel(sessionId,
|
|
697
|
+
async function checkPermissionSentinel(sessionId, sandboxName, provider) {
|
|
695
698
|
if (getPendingConfirmations().has(sessionId)) return;
|
|
696
699
|
try {
|
|
697
700
|
const result = await provider.exec(
|
|
698
|
-
|
|
701
|
+
sandboxName,
|
|
699
702
|
["test", "-f", PERMISSION_BRIDGE_PENDING_PATH]
|
|
700
703
|
);
|
|
701
704
|
if (result.exit_code !== 0) return;
|
|
@@ -705,7 +708,7 @@ async function checkPermissionSentinel(sessionId, spriteName, provider) {
|
|
|
705
708
|
let request;
|
|
706
709
|
try {
|
|
707
710
|
const result = await provider.exec(
|
|
708
|
-
|
|
711
|
+
sandboxName,
|
|
709
712
|
["cat", PERMISSION_BRIDGE_REQUEST_PATH]
|
|
710
713
|
);
|
|
711
714
|
request = JSON.parse(result.stdout);
|
|
@@ -727,8 +730,8 @@ async function checkPermissionSentinel(sessionId, spriteName, provider) {
|
|
|
727
730
|
}
|
|
728
731
|
async function writePermissionResponse(sessionId, result, denyMessage) {
|
|
729
732
|
const row = getSessionRow(sessionId);
|
|
730
|
-
if (!row?.
|
|
731
|
-
console.warn(`[driver] no
|
|
733
|
+
if (!row?.sandbox_name) {
|
|
734
|
+
console.warn(`[driver] no sandbox for session ${sessionId}, cannot write permission response`);
|
|
732
735
|
return;
|
|
733
736
|
}
|
|
734
737
|
const env = getEnvironment(row.environment_id);
|
|
@@ -740,7 +743,7 @@ async function writePermissionResponse(sessionId, result, denyMessage) {
|
|
|
740
743
|
});
|
|
741
744
|
try {
|
|
742
745
|
await provider.exec(
|
|
743
|
-
row.
|
|
746
|
+
row.sandbox_name,
|
|
744
747
|
["bash", "-c", `cat > ${PERMISSION_BRIDGE_RESPONSE_PATH}`],
|
|
745
748
|
{ stdin: response, secrets: permSecrets }
|
|
746
749
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SUPPORTED_PROVIDERS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3LG7DRJL.js";
|
|
4
4
|
import {
|
|
5
5
|
addUpstreamKey,
|
|
6
6
|
deleteUpstreamKey,
|
|
@@ -8,20 +8,20 @@ import {
|
|
|
8
8
|
enableUpstreamKey,
|
|
9
9
|
getUpstreamKey,
|
|
10
10
|
listUpstreamKeys
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BZ6HFTHU.js";
|
|
12
12
|
import {
|
|
13
13
|
requireGlobalAdmin
|
|
14
14
|
} from "./chunk-23UKWXJH.js";
|
|
15
15
|
import {
|
|
16
16
|
recordAudit
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MHQXDTJB.js";
|
|
18
18
|
import {
|
|
19
19
|
requireFeature
|
|
20
20
|
} from "./chunk-2N2KL4KM.js";
|
|
21
21
|
import {
|
|
22
22
|
jsonOk,
|
|
23
23
|
routeWrap
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6IWTDQJN.js";
|
|
25
25
|
import {
|
|
26
26
|
badRequest,
|
|
27
27
|
notFound
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
recordApiRequest
|
|
4
4
|
} from "./chunk-D2XITRN6.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
authenticateAndIntercept
|
|
7
|
+
} from "./chunk-PWWRWR75.js";
|
|
8
8
|
import {
|
|
9
9
|
checkAndBump
|
|
10
10
|
} from "./chunk-HVUWXUUI.js";
|
|
11
11
|
import {
|
|
12
12
|
ensureInitialized
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AH7DAJU5.js";
|
|
14
14
|
import {
|
|
15
15
|
captureException
|
|
16
16
|
} from "./chunk-3MQ2FWXS.js";
|
|
@@ -26,7 +26,12 @@ async function routeWrap(request, handler) {
|
|
|
26
26
|
let status = 500;
|
|
27
27
|
try {
|
|
28
28
|
await ensureInitialized();
|
|
29
|
-
const
|
|
29
|
+
const result = await authenticateAndIntercept(request);
|
|
30
|
+
if (result.kind === "response") {
|
|
31
|
+
status = result.response.status;
|
|
32
|
+
return result.response;
|
|
33
|
+
}
|
|
34
|
+
const auth = result.auth;
|
|
30
35
|
const retryAfter = await checkAndBump(auth.keyId, auth.rateLimitRpm);
|
|
31
36
|
if (retryAfter != null) {
|
|
32
37
|
const err = tooManyRequests(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installCodexWrapper
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RMEX55EU.js";
|
|
4
4
|
|
|
5
5
|
// src/backends/codex/setup.ts
|
|
6
6
|
var SENTINEL_NAME = ".claude-agents-codex-installed";
|
|
7
|
-
async function
|
|
8
|
-
await installCodexWrapper(
|
|
7
|
+
async function prepareCodexOnSandbox(sandboxName, provider) {
|
|
8
|
+
await installCodexWrapper(sandboxName, provider);
|
|
9
9
|
const script = [
|
|
10
10
|
"set -euo pipefail",
|
|
11
11
|
`SENTINEL="$HOME/${SENTINEL_NAME}"`,
|
|
@@ -16,7 +16,7 @@ async function prepareCodexOnSprite(spriteName, provider) {
|
|
|
16
16
|
"/usr/local/bin/codex --version || $PREFIX/bin/codex --version",
|
|
17
17
|
'touch "$SENTINEL"'
|
|
18
18
|
].join(" && ");
|
|
19
|
-
const result = await provider.exec(
|
|
19
|
+
const result = await provider.exec(sandboxName, ["bash", "-c", script], {
|
|
20
20
|
timeoutMs: 5 * 6e4
|
|
21
21
|
});
|
|
22
22
|
if (result.exit_code !== 0) {
|
|
@@ -27,5 +27,5 @@ async function prepareCodexOnSprite(spriteName, provider) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
prepareCodexOnSandbox
|
|
31
31
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listCredentialsWithTokens
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J4TYHQQG.js";
|
|
4
4
|
import {
|
|
5
5
|
listEntries
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VIGJQU6V.js";
|
|
7
7
|
|
|
8
8
|
// src/sessions/secrets.ts
|
|
9
9
|
function loadSessionSecrets(vaultIds) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
onAfterCommit
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
listEventsByTrace
|
|
6
|
-
} from "./chunk-AHHH4PYB.js";
|
|
3
|
+
} from "./chunk-BMPB7XJH.js";
|
|
7
4
|
import {
|
|
8
5
|
getSessionRow
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I5ZA45YL.js";
|
|
7
|
+
import {
|
|
8
|
+
listEventsByTrace
|
|
9
|
+
} from "./chunk-O45IQUWS.js";
|
|
10
10
|
import {
|
|
11
11
|
getAgent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JEI7I3EH.js";
|
|
13
13
|
import {
|
|
14
14
|
getConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QH57EOKP.js";
|
|
16
16
|
|
|
17
17
|
// src/observability/otlp.ts
|
|
18
18
|
import { createHash } from "crypto";
|