@agentstep/agent-sdk 0.4.28 → 0.4.30
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 +7 -7
- package/dist/backends/claude/args.js +5 -5
- package/dist/backends/claude/index.js +7 -7
- package/dist/backends/claude/tool-bridge.js +3 -1
- package/dist/backends/codex/auth.js +5 -5
- package/dist/backends/codex/index.js +6 -6
- package/dist/backends/factory/auth.js +5 -5
- package/dist/backends/factory/index.js +6 -6
- package/dist/backends/gemini/auth.js +5 -5
- package/dist/backends/gemini/index.js +6 -6
- package/dist/backends/opencode/auth.js +5 -5
- package/dist/backends/opencode/index.js +6 -6
- package/dist/backends/pi/auth.js +5 -5
- package/dist/backends/pi/index.js +6 -6
- package/dist/backends/registry.js +18 -18
- package/dist/{chunk-TY3HD5I5.js → chunk-2DRBKIGQ.js} +1 -1
- package/dist/{chunk-ATGDKD4W.js → chunk-2JKOYBUO.js} +1 -1
- package/dist/{chunk-4IFVESQO.js → chunk-3KLJGU75.js} +17 -14
- package/dist/{chunk-ZP5VMV5O.js → chunk-46XURNM7.js} +4 -4
- package/dist/{chunk-P525BPB2.js → chunk-4B7PQTTS.js} +6 -6
- package/dist/{chunk-5GZEX4HV.js → chunk-4C7XJI2V.js} +1 -1
- package/dist/chunk-4FDEJHH7.js +128 -0
- package/dist/{chunk-R5OZHLAD.js → chunk-4PVPM2WC.js} +1 -1
- package/dist/{chunk-O45IQUWS.js → chunk-5NBZZZKH.js} +2 -2
- package/dist/{chunk-S3SKODVV.js → chunk-5QTDZQ2H.js} +4 -4
- package/dist/{chunk-JNHADPQ3.js → chunk-65XR7JU6.js} +11 -5
- package/dist/{chunk-X2CAT5MN.js → chunk-67D4I5AE.js} +1 -1
- package/dist/{chunk-EHCGLMPC.js → chunk-6EQZSMIZ.js} +1 -1
- package/dist/{chunk-HQACDTN4.js → chunk-6VENJOPG.js} +5 -5
- package/dist/{chunk-VHZML3D5.js → chunk-7DSZOBSQ.js} +2 -2
- package/dist/{chunk-VIGJQU6V.js → chunk-7GNSB22P.js} +3 -3
- package/dist/{chunk-4TF2EKVQ.js → chunk-7UJ2PIXJ.js} +2 -2
- package/dist/{chunk-NUINUAXO.js → chunk-7V277COF.js} +2 -2
- package/dist/{chunk-4RNCKCDV.js → chunk-AP2N4R6D.js} +1 -1
- package/dist/{chunk-WJUWZKRP.js → chunk-AXISFTHX.js} +2 -2
- package/dist/{chunk-JDELTTHV.js → chunk-BBYQMNGK.js} +1 -1
- package/dist/{chunk-FEHDZT7I.js → chunk-BJK4SGWG.js} +2 -2
- package/dist/{chunk-4WMYJM36.js → chunk-BKBC43KV.js} +1 -1
- package/dist/{chunk-CGPTH3JC.js → chunk-BQOFXJSK.js} +3 -3
- package/dist/{chunk-PF6W4L5F.js → chunk-BSVZAXLI.js} +11 -8
- package/dist/{chunk-UO2N4Q3V.js → chunk-CL3DUJRJ.js} +7 -4
- package/dist/{chunk-UZJI64HR.js → chunk-DL2BACWC.js} +12 -9
- package/dist/{chunk-B7L5XD24.js → chunk-DNV6JZLZ.js} +1 -1
- package/dist/{chunk-AU2DTTBR.js → chunk-EFCCO74P.js} +8 -5
- package/dist/{chunk-EF5QCTEQ.js → chunk-EFDAVLKN.js} +1 -1
- package/dist/{chunk-WFIMX3HG.js → chunk-EIR2TG5I.js} +1 -1
- package/dist/{chunk-F3M4HKEJ.js → chunk-EN3ICYTL.js} +9 -9
- package/dist/{chunk-Y2KDIPCT.js → chunk-F3BVYYRX.js} +5 -5
- package/dist/{chunk-ZMMDLKR3.js → chunk-FGQFNIRI.js} +3 -3
- package/dist/{chunk-DNGLD7VN.js → chunk-FIJTBRZ5.js} +1 -1
- package/dist/{chunk-AMWWPUSK.js → chunk-H3O7QBOQ.js} +1 -1
- package/dist/{chunk-AYNYP3G3.js → chunk-H62LRJJP.js} +19 -18
- package/dist/{chunk-FRDJNX6Z.js → chunk-H7Z4BWRI.js} +2 -2
- package/dist/{chunk-I44FSUBC.js → chunk-HA5FIXGQ.js} +1 -1
- package/dist/{chunk-NWW4246M.js → chunk-HEDK5J34.js} +1 -1
- package/dist/{chunk-M4CTE7EH.js → chunk-HF6HORZZ.js} +2 -2
- package/dist/{chunk-34BN2SJC.js → chunk-HFBC2TOG.js} +2 -2
- package/dist/{chunk-DO4WVWW7.js → chunk-IFXD4DH5.js} +1 -1
- package/dist/{chunk-ATTHVKNE.js → chunk-JN3G4Y4L.js} +4 -4
- package/dist/{chunk-ZQGJKPPY.js → chunk-JSKZXF5J.js} +31 -6
- package/dist/{chunk-Y2J7CAME.js → chunk-JYUJQHPR.js} +3 -3
- package/dist/{chunk-HLNTWWAZ.js → chunk-KA33M67F.js} +2 -2
- package/dist/{chunk-T45NOW43.js → chunk-L43UD7PK.js} +1 -1
- package/dist/{chunk-3QIIJADA.js → chunk-LOAFGJWC.js} +2 -2
- package/dist/{chunk-DWAA3F5Y.js → chunk-LR4TA74O.js} +15 -15
- package/dist/{chunk-MJ5J57UJ.js → chunk-M36DF445.js} +1 -1
- package/dist/{chunk-MHQXDTJB.js → chunk-NC4FHDIP.js} +1 -1
- package/dist/{chunk-NIOWKTIF.js → chunk-NT2AI5IE.js} +1 -1
- package/dist/{chunk-5D5P37FY.js → chunk-NZATVUV2.js} +1 -1
- package/dist/{chunk-ES5VD2ML.js → chunk-PFWTQ43U.js} +1 -1
- package/dist/{chunk-SVYLMMBI.js → chunk-QV5WI73T.js} +19 -6
- package/dist/{chunk-I5ZA45YL.js → chunk-QWGJS6V6.js} +4 -4
- package/dist/{chunk-YCXELHKG.js → chunk-REGPK5NG.js} +1 -1
- package/dist/{chunk-NUO56TF7.js → chunk-S5HVHCAK.js} +2 -2
- package/dist/{chunk-SXE7H3VK.js → chunk-SLAOS6JN.js} +1 -1
- package/dist/{chunk-NXRJ7Z4G.js → chunk-SW75SNDB.js} +1 -1
- package/dist/{chunk-JK5TPJHH.js → chunk-SXTHM67U.js} +1 -1
- package/dist/{chunk-NWFYV2VI.js → chunk-TRGHIMCR.js} +4 -4
- package/dist/{chunk-BMPB7XJH.js → chunk-TRQX5AIZ.js} +4 -4
- package/dist/{chunk-JEI7I3EH.js → chunk-TXUUUO5R.js} +2 -2
- package/dist/{chunk-P6NCA7G5.js → chunk-TZZMVXFM.js} +4 -4
- package/dist/{chunk-ND7BRD6B.js → chunk-UF3NB27E.js} +8 -8
- package/dist/{chunk-36VCC3BY.js → chunk-ULJVEN67.js} +3 -3
- package/dist/{chunk-UXMCHRGA.js → chunk-ULQOJ3WO.js} +2 -2
- package/dist/{chunk-B2JLKTBJ.js → chunk-VC25NYHW.js} +1 -1
- package/dist/{chunk-CCE6MVB3.js → chunk-VMILIALE.js} +18 -15
- package/dist/chunk-VUADJZRV.js +212 -0
- package/dist/{chunk-ADK2TYO4.js → chunk-WHV4YUQB.js} +1 -1
- package/dist/{chunk-AWHHLOWE.js → chunk-WP5EWNGJ.js} +4 -4
- package/dist/{chunk-HDSLSNN5.js → chunk-X2EEOO6Q.js} +5 -5
- package/dist/{chunk-AQXCXWAZ.js → chunk-XQEMI2MI.js} +1 -1
- package/dist/{chunk-OWP537VU.js → chunk-XTTHH5MF.js} +1 -1
- package/dist/{chunk-2BDD6OHG.js → chunk-XUNTHJIE.js} +7 -0
- package/dist/{chunk-BZ6HFTHU.js → chunk-YGTC5UP5.js} +1 -1
- package/dist/{chunk-YGAHGTVZ.js → chunk-YIOKUA23.js} +2 -2
- package/dist/{chunk-YY3NF45U.js → chunk-YTC6ST5T.js} +5 -5
- package/dist/config/index.js +4 -4
- package/dist/containers/client.js +5 -5
- package/dist/containers/exec.js +5 -5
- package/dist/containers/lifecycle.js +30 -30
- package/dist/containers/setup.js +7 -7
- package/dist/db/agents.js +5 -5
- package/dist/db/api_keys.js +4 -4
- package/dist/db/audit.js +3 -3
- package/dist/db/batch.js +9 -9
- package/dist/db/client.js +2 -2
- package/dist/db/credentials.js +3 -3
- package/dist/db/drizzle.js +3 -3
- package/dist/db/environments.js +5 -5
- package/dist/db/events.js +4 -4
- package/dist/db/files.js +4 -4
- package/dist/db/memory.js +4 -4
- package/dist/db/migrations.js +1 -1
- package/dist/db/proxy.js +4 -4
- package/dist/db/session-resources.js +4 -4
- package/dist/db/sessions.js +6 -6
- package/dist/db/sync.js +4 -4
- package/dist/db/tenants.js +3 -3
- package/dist/db/traces.js +4 -4
- package/dist/db/upstream_keys.js +3 -3
- package/dist/db/vaults.js +5 -5
- package/dist/handlers/agents.js +45 -45
- package/dist/handlers/api_keys.js +46 -46
- package/dist/handlers/audit.js +46 -46
- package/dist/handlers/batch.js +46 -46
- package/dist/handlers/credentials.js +46 -46
- package/dist/handlers/environments.js +46 -46
- package/dist/handlers/events.js +49 -49
- package/dist/handlers/files.js +46 -46
- package/dist/handlers/index.js +81 -81
- package/dist/handlers/license.js +45 -45
- package/dist/handlers/memory.js +46 -46
- package/dist/handlers/metrics.js +45 -45
- package/dist/handlers/models.js +46 -46
- package/dist/handlers/providers.js +45 -45
- package/dist/handlers/resources.js +45 -45
- package/dist/handlers/sessions.js +48 -48
- package/dist/handlers/settings.js +45 -45
- package/dist/handlers/skills-write.js +45 -45
- package/dist/handlers/skills.js +46 -46
- package/dist/handlers/stream.js +45 -45
- package/dist/handlers/tenants.js +46 -46
- package/dist/handlers/threads.js +45 -45
- package/dist/handlers/traces.js +46 -46
- package/dist/handlers/upstream_keys.js +48 -48
- package/dist/handlers/vaults.js +45 -45
- package/dist/handlers/whoami.js +45 -45
- package/dist/http.js +44 -44
- package/dist/index.js +48 -48
- package/dist/init.js +41 -41
- package/dist/lib/model-registry.js +5 -5
- package/dist/lib/skills-cache.js +5 -5
- package/dist/observability/otlp.js +11 -11
- package/dist/observability/redactor.js +7 -7
- package/dist/providers/fly.js +4 -4
- package/dist/providers/modal.js +4 -4
- package/dist/providers/registry.js +1 -1
- package/dist/providers/resolve-secrets.js +6 -6
- package/dist/providers/sprites.js +6 -6
- package/dist/providers/upstream-keys.js +10 -10
- package/dist/providers/vercel.js +4 -4
- package/dist/proxy/forward.js +5 -5
- package/dist/queue/index.js +5 -5
- package/dist/sessions/bus.js +9 -9
- package/dist/sessions/driver.js +34 -34
- package/dist/sessions/grader.js +4 -4
- package/dist/sessions/secrets.js +7 -7
- package/dist/sessions/sweeper.js +31 -31
- package/dist/sessions/threads.js +34 -34
- package/dist/shutdown.js +32 -32
- package/dist/sync/anthropic.js +9 -9
- package/dist/sync/container-file-sync.js +5 -5
- package/dist/sync/file-sync.js +16 -16
- package/package.json +1 -1
- package/dist/chunk-ALVC7G6R.js +0 -187
- package/dist/chunk-JLZO6TQL.js +0 -131
- /package/dist/{chunk-QUJNG4RA.js → chunk-C6JEPQ7T.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_session_resources,
|
|
3
3
|
session_resources_exports
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4PVPM2WC.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_TENANT_ID
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BBYQMNGK.js";
|
|
8
8
|
import {
|
|
9
9
|
init_ids,
|
|
10
10
|
newId
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
getDrizzle,
|
|
14
14
|
init_drizzle
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SLAOS6JN.js";
|
|
16
16
|
import {
|
|
17
17
|
schema_exports
|
|
18
18
|
} from "./chunk-LHHBOQUR.js";
|
|
@@ -95,7 +95,7 @@ function hydrateSession(row) {
|
|
|
95
95
|
}
|
|
96
96
|
function createSession(input) {
|
|
97
97
|
const db = getDrizzle();
|
|
98
|
-
const id = newId("
|
|
98
|
+
const id = newId("sesn");
|
|
99
99
|
const now = nowMs();
|
|
100
100
|
db.insert(schema_exports.sessions).values({
|
|
101
101
|
id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_TENANT_ID
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BBYQMNGK.js";
|
|
4
4
|
import {
|
|
5
5
|
init_ids,
|
|
6
6
|
newId
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
getDrizzle,
|
|
10
10
|
init_drizzle
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SLAOS6JN.js";
|
|
12
12
|
import {
|
|
13
13
|
schema_exports
|
|
14
14
|
} from "./chunk-LHHBOQUR.js";
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
reconcileDockerOrphanSandboxes,
|
|
7
7
|
reconcileOrphanSandboxes,
|
|
8
8
|
releaseSession
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EN3ICYTL.js";
|
|
10
10
|
import {
|
|
11
11
|
appendEvent,
|
|
12
12
|
dropEmitter
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TRQX5AIZ.js";
|
|
14
14
|
import {
|
|
15
15
|
archiveSession,
|
|
16
16
|
getSessionRow,
|
|
17
17
|
listIdleSessions,
|
|
18
18
|
updateSessionStatus
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QWGJS6V6.js";
|
|
20
20
|
import {
|
|
21
21
|
getConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-EFDAVLKN.js";
|
|
23
23
|
import {
|
|
24
24
|
init_clock,
|
|
25
25
|
nowMs
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSession
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QWGJS6V6.js";
|
|
4
4
|
import {
|
|
5
5
|
appendEvent,
|
|
6
6
|
appendEventsBatch,
|
|
7
7
|
listEvents,
|
|
8
8
|
rowToManagedEvent
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5NBZZZKH.js";
|
|
10
10
|
import {
|
|
11
11
|
getAgent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TXUUUO5R.js";
|
|
13
13
|
import {
|
|
14
14
|
getDb,
|
|
15
15
|
init_client
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4C7XJI2V.js";
|
|
17
17
|
|
|
18
18
|
// src/sessions/bus.ts
|
|
19
19
|
import { EventEmitter } from "events";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_TENANT_ID
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BBYQMNGK.js";
|
|
4
4
|
import {
|
|
5
5
|
init_ids,
|
|
6
6
|
newId
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
getDrizzle,
|
|
10
10
|
init_drizzle
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SLAOS6JN.js";
|
|
12
12
|
import {
|
|
13
13
|
schema_exports
|
|
14
14
|
} from "./chunk-LHHBOQUR.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SUPPORTED_PROVIDERS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JN3G4Y4L.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-YGTC5UP5.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-NC4FHDIP.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-LOAFGJWC.js";
|
|
25
25
|
import {
|
|
26
26
|
badRequest,
|
|
27
27
|
notFound
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRemoteSessionId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YIOKUA23.js";
|
|
4
4
|
import {
|
|
5
5
|
assertResourceTenant
|
|
6
6
|
} from "./chunk-23UKWXJH.js";
|
|
7
7
|
import {
|
|
8
8
|
authenticateAndIntercept
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FGQFNIRI.js";
|
|
10
10
|
import {
|
|
11
11
|
forwardToAnthropic
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-L43UD7PK.js";
|
|
13
13
|
import {
|
|
14
14
|
ensureInitialized
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LR4TA74O.js";
|
|
16
16
|
import {
|
|
17
17
|
getProxiedTenantId,
|
|
18
18
|
isProxied
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NT2AI5IE.js";
|
|
20
20
|
import {
|
|
21
21
|
subscribe
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TRQX5AIZ.js";
|
|
23
23
|
import {
|
|
24
24
|
getSession
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-QWGJS6V6.js";
|
|
26
26
|
import {
|
|
27
27
|
getDb,
|
|
28
28
|
init_client
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4C7XJI2V.js";
|
|
30
30
|
import {
|
|
31
31
|
notFound,
|
|
32
32
|
toResponse
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./chunk-23UKWXJH.js";
|
|
4
4
|
import {
|
|
5
5
|
recordAudit
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NC4FHDIP.js";
|
|
7
7
|
import {
|
|
8
8
|
requireFeature
|
|
9
9
|
} from "./chunk-2N2KL4KM.js";
|
|
10
10
|
import {
|
|
11
11
|
jsonOk,
|
|
12
12
|
routeWrap
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LOAFGJWC.js";
|
|
14
14
|
import {
|
|
15
15
|
archiveTenant,
|
|
16
16
|
createTenant,
|
|
17
17
|
getTenant,
|
|
18
18
|
listTenants,
|
|
19
19
|
renameTenant
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BBYQMNGK.js";
|
|
21
21
|
import {
|
|
22
22
|
badRequest,
|
|
23
23
|
notFound
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
reportUpstreamFailure,
|
|
3
3
|
reportUpstreamSuccess,
|
|
4
4
|
resolveAnthropicKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JN3G4Y4L.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveRemoteSessionId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YIOKUA23.js";
|
|
9
9
|
import {
|
|
10
10
|
assertResourceTenant
|
|
11
11
|
} from "./chunk-23UKWXJH.js";
|
|
@@ -20,45 +20,45 @@ import {
|
|
|
20
20
|
listMemoryStores,
|
|
21
21
|
searchMemories,
|
|
22
22
|
updateMemory
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7V277COF.js";
|
|
24
24
|
import {
|
|
25
25
|
jsonOk,
|
|
26
26
|
routeWrap
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LOAFGJWC.js";
|
|
28
28
|
import {
|
|
29
29
|
forwardToAnthropic
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-L43UD7PK.js";
|
|
31
31
|
import {
|
|
32
32
|
enqueueTurn
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XQEMI2MI.js";
|
|
34
34
|
import {
|
|
35
35
|
runTurn,
|
|
36
36
|
writePermissionResponse
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-H62LRJJP.js";
|
|
38
38
|
import {
|
|
39
39
|
getProxiedTenantId,
|
|
40
40
|
isProxied
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-NT2AI5IE.js";
|
|
42
42
|
import {
|
|
43
43
|
getActor
|
|
44
44
|
} from "./chunk-LAWTTG2E.js";
|
|
45
45
|
import {
|
|
46
46
|
appendEvent
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-TRQX5AIZ.js";
|
|
48
48
|
import {
|
|
49
49
|
bumpSessionStats,
|
|
50
50
|
getSession,
|
|
51
51
|
getSessionRow,
|
|
52
52
|
setOutcomeCriteria,
|
|
53
53
|
updateSessionMutable
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-QWGJS6V6.js";
|
|
55
55
|
import {
|
|
56
56
|
listEvents,
|
|
57
57
|
rowToManagedEvent
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-5NBZZZKH.js";
|
|
59
59
|
import {
|
|
60
60
|
getAgent
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-TXUUUO5R.js";
|
|
62
62
|
import {
|
|
63
63
|
init_clock,
|
|
64
64
|
nowMs
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
import {
|
|
67
67
|
getDb,
|
|
68
68
|
init_client
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-4C7XJI2V.js";
|
|
70
70
|
import {
|
|
71
71
|
badRequest,
|
|
72
72
|
notFound
|
|
@@ -633,9 +633,12 @@ function handleListEvents(request, sessionId) {
|
|
|
633
633
|
const order = url.searchParams.get("order") === "desc" ? "desc" : "asc";
|
|
634
634
|
const afterSeq = Number(url.searchParams.get("after_seq") ?? url.searchParams.get("page") ?? "0");
|
|
635
635
|
const rows = listEvents(sessionId, { limit, order, afterSeq });
|
|
636
|
+
const data = rows.map(rowToManagedEvent);
|
|
636
637
|
return jsonOk({
|
|
637
|
-
data
|
|
638
|
-
|
|
638
|
+
data,
|
|
639
|
+
has_more: rows.length === limit,
|
|
640
|
+
first_id: data.length > 0 ? data[0].id : null,
|
|
641
|
+
last_id: data.length > 0 ? data[data.length - 1].id : null
|
|
639
642
|
});
|
|
640
643
|
});
|
|
641
644
|
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadVaultForCaller
|
|
3
|
+
} from "./chunk-65XR7JU6.js";
|
|
4
|
+
import {
|
|
5
|
+
jsonOk,
|
|
6
|
+
routeWrap
|
|
7
|
+
} from "./chunk-LOAFGJWC.js";
|
|
8
|
+
import {
|
|
9
|
+
createCredential,
|
|
10
|
+
deleteCredential,
|
|
11
|
+
getCredential,
|
|
12
|
+
listCredentials,
|
|
13
|
+
updateCredential
|
|
14
|
+
} from "./chunk-JSKZXF5J.js";
|
|
15
|
+
import {
|
|
16
|
+
badRequest,
|
|
17
|
+
conflict,
|
|
18
|
+
notFound
|
|
19
|
+
} from "./chunk-EZYKRG4W.js";
|
|
20
|
+
|
|
21
|
+
// src/handlers/credentials.ts
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
var TokenEndpointAuthSchema = z.object({
|
|
24
|
+
type: z.string().min(1),
|
|
25
|
+
client_secret: z.string().min(1)
|
|
26
|
+
});
|
|
27
|
+
var OAuthRefreshSchema = z.object({
|
|
28
|
+
token_endpoint: z.string().url(),
|
|
29
|
+
client_id: z.string().min(1),
|
|
30
|
+
scope: z.string().optional(),
|
|
31
|
+
refresh_token: z.string().min(1),
|
|
32
|
+
token_endpoint_auth: TokenEndpointAuthSchema.optional()
|
|
33
|
+
});
|
|
34
|
+
var StaticBearerAuthSchema = z.object({
|
|
35
|
+
type: z.literal("static_bearer"),
|
|
36
|
+
mcp_server_url: z.string().url().optional(),
|
|
37
|
+
token: z.string().min(1)
|
|
38
|
+
});
|
|
39
|
+
var McpOauthAuthSchema = z.object({
|
|
40
|
+
type: z.literal("mcp_oauth"),
|
|
41
|
+
mcp_server_url: z.string().url().optional(),
|
|
42
|
+
access_token: z.string().min(1),
|
|
43
|
+
expires_at: z.string().optional(),
|
|
44
|
+
refresh: OAuthRefreshSchema.optional()
|
|
45
|
+
});
|
|
46
|
+
var CreateCredentialSchema = z.object({
|
|
47
|
+
display_name: z.string().min(1).max(200),
|
|
48
|
+
auth: z.discriminatedUnion("type", [StaticBearerAuthSchema, McpOauthAuthSchema]),
|
|
49
|
+
metadata: z.record(z.string()).optional()
|
|
50
|
+
});
|
|
51
|
+
var UpdateStaticBearerAuthSchema = z.object({
|
|
52
|
+
type: z.literal("static_bearer").optional(),
|
|
53
|
+
token: z.string().min(1).optional(),
|
|
54
|
+
mcp_server_url: z.string().url().nullish()
|
|
55
|
+
});
|
|
56
|
+
var UpdateMcpOauthAuthSchema = z.object({
|
|
57
|
+
type: z.literal("mcp_oauth").optional(),
|
|
58
|
+
access_token: z.string().min(1).optional(),
|
|
59
|
+
expires_at: z.string().nullish(),
|
|
60
|
+
refresh: OAuthRefreshSchema.optional()
|
|
61
|
+
});
|
|
62
|
+
var UpdateAuthSchema = z.object({
|
|
63
|
+
type: z.enum(["static_bearer", "mcp_oauth"]).optional(),
|
|
64
|
+
token: z.string().min(1).optional(),
|
|
65
|
+
mcp_server_url: z.string().url().nullish(),
|
|
66
|
+
access_token: z.string().min(1).optional(),
|
|
67
|
+
expires_at: z.string().nullish(),
|
|
68
|
+
refresh: OAuthRefreshSchema.optional()
|
|
69
|
+
}).optional();
|
|
70
|
+
var UpdateCredentialSchema = z.object({
|
|
71
|
+
display_name: z.string().min(1).max(200).optional(),
|
|
72
|
+
auth: UpdateAuthSchema
|
|
73
|
+
});
|
|
74
|
+
function handleCreateCredential(request, vaultId) {
|
|
75
|
+
return routeWrap(request, async ({ auth }) => {
|
|
76
|
+
loadVaultForCaller(auth, vaultId);
|
|
77
|
+
const body = await request.json();
|
|
78
|
+
const parsed = CreateCredentialSchema.safeParse(body);
|
|
79
|
+
if (!parsed.success) throw badRequest(parsed.error.message);
|
|
80
|
+
const { auth: authData } = parsed.data;
|
|
81
|
+
try {
|
|
82
|
+
if (authData.type === "mcp_oauth") {
|
|
83
|
+
const refreshConfig = authData.refresh ? {
|
|
84
|
+
token_endpoint: authData.refresh.token_endpoint,
|
|
85
|
+
client_id: authData.refresh.client_id,
|
|
86
|
+
scope: authData.refresh.scope,
|
|
87
|
+
refresh_token: authData.refresh.refresh_token,
|
|
88
|
+
token_endpoint_auth: authData.refresh.token_endpoint_auth
|
|
89
|
+
} : null;
|
|
90
|
+
const cred2 = createCredential({
|
|
91
|
+
vault_id: vaultId,
|
|
92
|
+
display_name: parsed.data.display_name,
|
|
93
|
+
auth_type: "mcp_oauth",
|
|
94
|
+
token: authData.access_token,
|
|
95
|
+
mcp_server_url: authData.mcp_server_url ?? null,
|
|
96
|
+
expires_at: authData.expires_at ?? null,
|
|
97
|
+
refresh_config: refreshConfig
|
|
98
|
+
});
|
|
99
|
+
return jsonOk(cred2, 201);
|
|
100
|
+
}
|
|
101
|
+
const cred = createCredential({
|
|
102
|
+
vault_id: vaultId,
|
|
103
|
+
display_name: parsed.data.display_name,
|
|
104
|
+
auth_type: "static_bearer",
|
|
105
|
+
token: authData.token,
|
|
106
|
+
mcp_server_url: authData.mcp_server_url ?? null
|
|
107
|
+
});
|
|
108
|
+
return jsonOk(cred, 201);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
111
|
+
if (msg.includes("UNIQUE constraint failed") || msg.includes("SQLITE_CONSTRAINT")) {
|
|
112
|
+
throw conflict(
|
|
113
|
+
`Credential "${parsed.data.display_name}" already exists in this vault`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function handleListCredentials(request, vaultId) {
|
|
121
|
+
return routeWrap(request, async ({ auth, request: req }) => {
|
|
122
|
+
loadVaultForCaller(auth, vaultId);
|
|
123
|
+
const url = new URL(req.url);
|
|
124
|
+
const requestedLimit = Number(url.searchParams.get("limit") || "100");
|
|
125
|
+
const data = listCredentials(vaultId);
|
|
126
|
+
return jsonOk({
|
|
127
|
+
data,
|
|
128
|
+
has_more: data.length === requestedLimit,
|
|
129
|
+
first_id: data.length > 0 ? data[0].id : null,
|
|
130
|
+
last_id: data.length > 0 ? data[data.length - 1].id : null
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function handleGetCredential(request, vaultId, credentialId) {
|
|
135
|
+
return routeWrap(request, async ({ auth }) => {
|
|
136
|
+
loadVaultForCaller(auth, vaultId);
|
|
137
|
+
const cred = getCredential(credentialId);
|
|
138
|
+
if (!cred || cred.vault_id !== vaultId) {
|
|
139
|
+
throw notFound(`credential not found: ${credentialId}`);
|
|
140
|
+
}
|
|
141
|
+
return jsonOk(cred);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function handleUpdateCredential(request, vaultId, credentialId) {
|
|
145
|
+
return routeWrap(request, async ({ auth }) => {
|
|
146
|
+
loadVaultForCaller(auth, vaultId);
|
|
147
|
+
const existing = getCredential(credentialId);
|
|
148
|
+
if (!existing || existing.vault_id !== vaultId) {
|
|
149
|
+
throw notFound(`credential not found: ${credentialId}`);
|
|
150
|
+
}
|
|
151
|
+
const body = await request.json();
|
|
152
|
+
const parsed = UpdateCredentialSchema.safeParse(body);
|
|
153
|
+
if (!parsed.success) throw badRequest(parsed.error.message);
|
|
154
|
+
try {
|
|
155
|
+
const authData = parsed.data.auth;
|
|
156
|
+
const isMcpOauth = existing.auth.type === "mcp_oauth" || authData?.type === "mcp_oauth";
|
|
157
|
+
if (isMcpOauth && authData) {
|
|
158
|
+
const refreshConfig = authData.refresh ? {
|
|
159
|
+
token_endpoint: authData.refresh.token_endpoint,
|
|
160
|
+
client_id: authData.refresh.client_id,
|
|
161
|
+
scope: authData.refresh.scope,
|
|
162
|
+
refresh_token: authData.refresh.refresh_token,
|
|
163
|
+
token_endpoint_auth: authData.refresh.token_endpoint_auth
|
|
164
|
+
} : void 0;
|
|
165
|
+
const updated2 = updateCredential(credentialId, {
|
|
166
|
+
display_name: parsed.data.display_name,
|
|
167
|
+
auth_type: authData.type,
|
|
168
|
+
token: authData.access_token,
|
|
169
|
+
expires_at: authData.expires_at,
|
|
170
|
+
refresh_config: refreshConfig
|
|
171
|
+
});
|
|
172
|
+
if (!updated2) throw notFound(`credential not found: ${credentialId}`);
|
|
173
|
+
return jsonOk(updated2);
|
|
174
|
+
}
|
|
175
|
+
const updated = updateCredential(credentialId, {
|
|
176
|
+
display_name: parsed.data.display_name,
|
|
177
|
+
auth_type: authData?.type,
|
|
178
|
+
token: authData?.token,
|
|
179
|
+
mcp_server_url: authData?.mcp_server_url
|
|
180
|
+
});
|
|
181
|
+
if (!updated) throw notFound(`credential not found: ${credentialId}`);
|
|
182
|
+
return jsonOk(updated);
|
|
183
|
+
} catch (err) {
|
|
184
|
+
if (err instanceof Error && (err.message.includes("UNIQUE constraint failed") || err.message.includes("SQLITE_CONSTRAINT"))) {
|
|
185
|
+
throw conflict(
|
|
186
|
+
`Credential "${parsed.data.display_name}" already exists in this vault`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
throw err;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function handleDeleteCredential(request, vaultId, credentialId) {
|
|
194
|
+
return routeWrap(request, async ({ auth }) => {
|
|
195
|
+
loadVaultForCaller(auth, vaultId);
|
|
196
|
+
const existing = getCredential(credentialId);
|
|
197
|
+
if (!existing || existing.vault_id !== vaultId) {
|
|
198
|
+
throw notFound(`credential not found: ${credentialId}`);
|
|
199
|
+
}
|
|
200
|
+
const deleted = deleteCredential(credentialId);
|
|
201
|
+
if (!deleted) throw notFound(`credential not found: ${credentialId}`);
|
|
202
|
+
return jsonOk({ id: credentialId, type: "vault_credential_deleted" });
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export {
|
|
207
|
+
handleCreateCredential,
|
|
208
|
+
handleListCredentials,
|
|
209
|
+
handleGetCredential,
|
|
210
|
+
handleUpdateCredential,
|
|
211
|
+
handleDeleteCredential
|
|
212
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listTraces
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SXTHM67U.js";
|
|
4
4
|
import {
|
|
5
5
|
jsonOk,
|
|
6
6
|
routeWrap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LOAFGJWC.js";
|
|
8
8
|
import {
|
|
9
9
|
exportTrace
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F3BVYYRX.js";
|
|
11
11
|
import {
|
|
12
12
|
listEventsByTrace,
|
|
13
13
|
rowToManagedEvent
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5NBZZZKH.js";
|
|
15
15
|
import {
|
|
16
16
|
badRequest,
|
|
17
17
|
notFound
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
jsonOk,
|
|
6
6
|
routeWrap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LOAFGJWC.js";
|
|
8
8
|
import {
|
|
9
9
|
getProxiedTenantId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NT2AI5IE.js";
|
|
11
11
|
import {
|
|
12
12
|
getSession,
|
|
13
13
|
updateSessionResources
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QWGJS6V6.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-4PVPM2WC.js";
|
|
23
23
|
import {
|
|
24
24
|
getDb,
|
|
25
25
|
init_client
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4C7XJI2V.js";
|
|
27
27
|
import {
|
|
28
28
|
badRequest,
|
|
29
29
|
notFound
|
|
@@ -444,6 +444,13 @@ function runMigrations(db) {
|
|
|
444
444
|
UNIQUE(vault_id, display_name)
|
|
445
445
|
)
|
|
446
446
|
`);
|
|
447
|
+
const credCols = db.prepare(`PRAGMA table_info(vault_credentials)`).all();
|
|
448
|
+
if (!credCols.some((c) => c.name === "expires_at")) {
|
|
449
|
+
db.exec(`ALTER TABLE vault_credentials ADD COLUMN expires_at TEXT`);
|
|
450
|
+
}
|
|
451
|
+
if (!credCols.some((c) => c.name === "refresh_config_encrypted")) {
|
|
452
|
+
db.exec(`ALTER TABLE vault_credentials ADD COLUMN refresh_config_encrypted TEXT`);
|
|
453
|
+
}
|
|
447
454
|
const sessCols3 = db.prepare(`PRAGMA table_info(sessions)`).all();
|
|
448
455
|
if (sessCols3.some((c) => c.name === "sprite_name")) {
|
|
449
456
|
db.exec(`ALTER TABLE sessions RENAME COLUMN sprite_name TO sandbox_name`);
|