@agentstep/agent-sdk 0.4.41 → 0.5.1
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 +8 -8
- 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/args.js +1 -1
- package/dist/backends/codex/auth.js +6 -6
- package/dist/backends/codex/index.js +8 -8
- package/dist/backends/factory/args.js +1 -1
- package/dist/backends/factory/auth.js +6 -6
- package/dist/backends/factory/index.js +8 -8
- package/dist/backends/gemini/args.js +1 -1
- package/dist/backends/gemini/auth.js +6 -6
- package/dist/backends/gemini/index.js +8 -8
- package/dist/backends/opencode/args.js +1 -1
- package/dist/backends/opencode/auth.js +6 -6
- package/dist/backends/opencode/index.js +9 -9
- package/dist/backends/opencode/mcp.js +1 -1
- package/dist/backends/pi/args.js +1 -1
- package/dist/backends/pi/auth.js +6 -6
- package/dist/backends/pi/index.js +8 -8
- package/dist/backends/registry.js +25 -25
- package/dist/{chunk-L2RX552S.js → chunk-22OUZJAV.js} +3 -3
- package/dist/{chunk-XWWLMJXT.js → chunk-2YFS435Z.js} +6 -15
- package/dist/{chunk-W2NHS4IF.js → chunk-2YIMCZJK.js} +15 -19
- package/dist/{chunk-WCDWL6ED.js → chunk-2YZOIFVN.js} +49 -0
- package/dist/{chunk-2PPB644A.js → chunk-37C5BNVV.js} +1 -1
- package/dist/{chunk-RDGOGAQ5.js → chunk-3FLQ7KZP.js} +1 -1
- package/dist/{chunk-2RSL5SO7.js → chunk-3NKK4M23.js} +2 -2
- package/dist/{chunk-CHDQ3HIR.js → chunk-3S4CGFKJ.js} +5 -9
- package/dist/{chunk-H7UKW666.js → chunk-445EL6J5.js} +1 -1
- package/dist/{chunk-FP4E3QUS.js → chunk-4LHJJXH3.js} +2 -2
- package/dist/{chunk-ZFJPOQSY.js → chunk-4MKBT3KA.js} +69 -30
- package/dist/{chunk-ENGKR2JT.js → chunk-56XDLNEW.js} +1 -1
- package/dist/{chunk-Y6SFUNGO.js → chunk-57LAR6EM.js} +4 -4
- package/dist/{chunk-JZL4L54R.js → chunk-5M47X54D.js} +2 -2
- package/dist/{chunk-MHBLVGRF.js → chunk-5MERXOLJ.js} +4 -4
- package/dist/{chunk-E7DD7F7J.js → chunk-5U5LRAFJ.js} +2 -2
- package/dist/{chunk-MQQ44IGX.js → chunk-63AKPSCV.js} +3 -3
- package/dist/{chunk-T5VRE77P.js → chunk-6KWJASEO.js} +1 -1
- package/dist/{chunk-EUINGLHA.js → chunk-6RFQCFL2.js} +30 -20
- package/dist/{chunk-V5HWHJ4P.js → chunk-74E7GKUG.js} +1 -1
- package/dist/{chunk-DU7LSFQQ.js → chunk-7SY65LWY.js} +6 -9
- package/dist/{chunk-JCW3ZRES.js → chunk-A46RUKGA.js} +1 -1
- package/dist/{chunk-LZFB3HRK.js → chunk-AQB3P5ZP.js} +5 -10
- package/dist/{chunk-RP6WQ4IH.js → chunk-B5EY2VJC.js} +3 -3
- package/dist/{chunk-ZTH5JRZG.js → chunk-BCIFFAGW.js} +41 -10
- package/dist/{chunk-2Z2KAPUL.js → chunk-BJP5BIHE.js} +3 -3
- package/dist/{chunk-5EQJOUWM.js → chunk-C35ZTCBP.js} +2 -2
- package/dist/{chunk-OXWELRJL.js → chunk-CBPO2P4I.js} +101 -16
- package/dist/{chunk-HH4OXSOV.js → chunk-CE366H6Z.js} +5 -5
- package/dist/{chunk-C46UG6GQ.js → chunk-CKFJN5XK.js} +1 -1
- package/dist/{chunk-YBZJHDSE.js → chunk-COZG53R3.js} +2 -2
- package/dist/{chunk-SV2B3P6B.js → chunk-DBFPJSOY.js} +19 -17
- package/dist/{chunk-NQVRZAIX.js → chunk-DMMNAQUM.js} +2 -2
- package/dist/{chunk-JWH4OIBP.js → chunk-DRNZ24RF.js} +4 -4
- package/dist/{chunk-3FDE3BPB.js → chunk-EDUTIJAU.js} +9 -7
- package/dist/{chunk-5EKQBD2H.js → chunk-FCUXFLNK.js} +2 -2
- package/dist/{chunk-34EB622U.js → chunk-FYBHPBWY.js} +2 -2
- package/dist/{chunk-HOIDGDU5.js → chunk-GD3WXIHX.js} +1 -1
- package/dist/{chunk-6IYCBW4J.js → chunk-GIUB2OPA.js} +1 -1
- package/dist/{chunk-V7MTIMPB.js → chunk-GQYSSSVA.js} +3 -3
- package/dist/{chunk-X6IQ57SC.js → chunk-H6OT5GUL.js} +9 -5
- package/dist/{chunk-TPPLYCJF.js → chunk-HMOSAXVZ.js} +2 -2
- package/dist/{chunk-L5RW66H5.js → chunk-HVLYE4S5.js} +1 -1
- package/dist/{chunk-PIJKJNGB.js → chunk-HZZ6ZLKP.js} +4 -4
- package/dist/{chunk-AR2TM7CR.js → chunk-I26QP3A3.js} +1 -1
- package/dist/{chunk-D2TRWKVQ.js → chunk-I2WVMCYN.js} +80 -2
- package/dist/{chunk-JHGJG2Z2.js → chunk-IBYOMAZ3.js} +1 -1
- package/dist/{chunk-SUGSHXND.js → chunk-IEZFRNLC.js} +2 -2
- package/dist/{chunk-ZMJ4EP4C.js → chunk-ILHIHMO3.js} +7 -2
- package/dist/{chunk-FDBR634Z.js → chunk-IMPLRDOV.js} +6 -6
- package/dist/{chunk-ZYISLRS6.js → chunk-JWHSUEDE.js} +114 -37
- package/dist/{chunk-TH7WJLZC.js → chunk-KGBKIJPF.js} +3 -3
- package/dist/{chunk-3NK6YTA5.js → chunk-KUWJJD6O.js} +42 -8
- package/dist/{chunk-2I35VGHX.js → chunk-L35CBI7F.js} +2 -2
- package/dist/{chunk-KLN6HPYM.js → chunk-L3IACZ72.js} +1 -1
- package/dist/{chunk-MXOG5SAO.js → chunk-LIXSR7BG.js} +11 -14
- package/dist/{chunk-7GG3FEK2.js → chunk-MCWCRZM4.js} +4 -4
- package/dist/{chunk-V66YKIW6.js → chunk-MXMXJYN4.js} +5 -5
- package/dist/{chunk-GVPJL3XS.js → chunk-MZYJFU4K.js} +5 -5
- package/dist/{chunk-ZMNQ2YJ6.js → chunk-NBYCX6L4.js} +4 -4
- package/dist/{chunk-ZQXBHNEZ.js → chunk-NL4UNA53.js} +2 -2
- package/dist/{chunk-WQARLGBG.js → chunk-NRXTWATQ.js} +3 -3
- package/dist/{chunk-FXLUSECC.js → chunk-O56RNR7B.js} +1 -1
- package/dist/{chunk-3IV56JJW.js → chunk-P56WU3UT.js} +3 -2
- package/dist/{chunk-NQX7WBA4.js → chunk-PJYCPDV5.js} +14 -9
- package/dist/{chunk-R5T4LJSK.js → chunk-PZNAQBHQ.js} +2 -2
- package/dist/{chunk-32XS3Y6P.js → chunk-Q4XF3OBK.js} +8 -8
- package/dist/{chunk-IU457W7Q.js → chunk-QBJOYOVF.js} +2 -1
- package/dist/{chunk-C6AXM3M7.js → chunk-QJ6QQO6D.js} +3 -3
- package/dist/{chunk-2GIX4HAT.js → chunk-R6EXYBCT.js} +2 -2
- package/dist/{chunk-RVR6C22M.js → chunk-RT5S5KRX.js} +1 -1
- package/dist/{chunk-USYY3L7G.js → chunk-T3FQPTOA.js} +2 -2
- package/dist/{chunk-5IGBMS2U.js → chunk-T3HMVHDG.js} +1 -1
- package/dist/{chunk-RH4GKU52.js → chunk-T3IGOI6Z.js} +18 -3
- package/dist/{chunk-DAVYI5H4.js → chunk-T7BHW3CP.js} +23 -23
- package/dist/{chunk-QSUGIJWV.js → chunk-TG3S4RVJ.js} +4 -9
- package/dist/{chunk-IAF6VMPO.js → chunk-TPMZO6S2.js} +1 -1
- package/dist/{chunk-OGJUSGF7.js → chunk-UMRDMOB6.js} +1 -1
- package/dist/{chunk-KKCLTWG7.js → chunk-UMVZZQKD.js} +1 -1
- package/dist/{chunk-LAVHQCRP.js → chunk-UQ3LKJPM.js} +3 -3
- package/dist/{chunk-P26WOAA3.js → chunk-USIMPXUH.js} +1 -1
- package/dist/{chunk-Z25I7DRV.js → chunk-V5DH3OAC.js} +10 -5
- package/dist/{chunk-N3QIXC2B.js → chunk-VJWNFMMQ.js} +2 -2
- package/dist/{chunk-ZVXIZ2JD.js → chunk-VP527YC5.js} +35 -6
- package/dist/{chunk-6POQAFEC.js → chunk-W3JMIUHV.js} +1 -1
- package/dist/{chunk-V2R7RWVY.js → chunk-WDACZSRU.js} +1 -1
- package/dist/{chunk-FOOH6SCB.js → chunk-WU74DV5R.js} +2 -2
- package/dist/{chunk-6GP5IKXE.js → chunk-XSNJ7NT2.js} +1 -1
- package/dist/{chunk-S7W3KJYH.js → chunk-YYMUSVUI.js} +9 -4
- package/dist/{chunk-CREPPDHX.js → chunk-YZZHDZ7B.js} +1 -1
- package/dist/{chunk-LMNFIJ6M.js → chunk-ZWC5V2DB.js} +15 -15
- package/dist/{chunk-N76ZVITA.js → chunk-ZY2U24QP.js} +24 -14
- 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 +37 -37
- package/dist/containers/setup.js +9 -9
- package/dist/db/agents.js +8 -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 +8 -7
- 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 +12 -8
- package/dist/handlers/agents.js +57 -53
- package/dist/handlers/api_keys.js +54 -54
- package/dist/handlers/audit.js +54 -54
- package/dist/handlers/batch.js +54 -54
- package/dist/handlers/credentials.js +54 -54
- package/dist/handlers/environments.js +54 -54
- package/dist/handlers/events.js +57 -57
- package/dist/handlers/files.js +54 -54
- package/dist/handlers/index.js +101 -93
- package/dist/handlers/license.js +53 -53
- package/dist/handlers/memory.js +54 -54
- package/dist/handlers/metrics.js +53 -53
- package/dist/handlers/models.js +54 -54
- package/dist/handlers/openapi.js +3 -3
- package/dist/handlers/providers.js +53 -53
- package/dist/handlers/resources.js +53 -53
- package/dist/handlers/sessions.js +56 -56
- package/dist/handlers/settings.js +53 -53
- package/dist/handlers/skills-write.js +53 -53
- package/dist/handlers/skills.js +54 -54
- package/dist/handlers/stream.js +53 -53
- package/dist/handlers/tenants.js +54 -54
- package/dist/handlers/threads.js +53 -53
- package/dist/handlers/traces.js +54 -54
- package/dist/handlers/upstream_keys.js +56 -56
- package/dist/handlers/vaults.js +57 -53
- package/dist/handlers/whoami.js +53 -53
- package/dist/http.js +56 -52
- package/dist/index.js +58 -58
- package/dist/init.js +49 -49
- 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 +3 -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 +12 -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 +42 -42
- package/dist/sessions/grader.js +5 -5
- package/dist/sessions/mcp-auth.js +1 -1
- package/dist/sessions/secrets.js +8 -8
- package/dist/sessions/sweeper.js +38 -38
- package/dist/sessions/threads.js +42 -42
- package/dist/shutdown.js +39 -39
- package/dist/sync/anthropic.js +11 -11
- package/dist/sync/container-file-sync.js +6 -6
- package/dist/sync/file-sync.js +17 -17
- package/package.json +1 -1
- /package/dist/{chunk-WPK4ZPMG.js → chunk-JRQB3SHR.js} +0 -0
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
getSyncRow,
|
|
3
3
|
getSyncedRemoteId,
|
|
4
4
|
upsertSync
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-22OUZJAV.js";
|
|
6
6
|
import {
|
|
7
7
|
injectMcpAuthHeaders
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DBFPJSOY.js";
|
|
9
9
|
import {
|
|
10
10
|
listEntries
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VP527YC5.js";
|
|
12
12
|
import {
|
|
13
13
|
getEnvironment
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-H6OT5GUL.js";
|
|
15
15
|
import {
|
|
16
16
|
getAgent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BCIFFAGW.js";
|
|
18
18
|
|
|
19
19
|
// src/sync/anthropic.ts
|
|
20
20
|
import { createHash } from "crypto";
|
|
@@ -47,10 +47,7 @@ async function syncAgent(agentId, vaultEntries, apiKey) {
|
|
|
47
47
|
const agent = getAgent(agentId);
|
|
48
48
|
if (!agent) throw new Error(`Agent ${agentId} not found`);
|
|
49
49
|
const agentWithAuth = injectMcpAuthHeaders(agent, vaultEntries);
|
|
50
|
-
const mcpArray = agentWithAuth.mcp_servers
|
|
51
|
-
name,
|
|
52
|
-
...config
|
|
53
|
-
})) : [];
|
|
50
|
+
const mcpArray = agentWithAuth.mcp_servers ?? [];
|
|
54
51
|
const tools = agentWithAuth.tools && agentWithAuth.tools.length > 0 ? agentWithAuth.tools : [{ type: "agent_toolset_20260401" }];
|
|
55
52
|
const agentConfig = {
|
|
56
53
|
name: agentWithAuth.name,
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
tenantFilter
|
|
4
4
|
} from "./chunk-23UKWXJH.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
paginatedOk,
|
|
7
7
|
routeWrap
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T3IGOI6Z.js";
|
|
9
9
|
import {
|
|
10
10
|
getSession,
|
|
11
11
|
listSessions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KUWJJD6O.js";
|
|
13
13
|
import {
|
|
14
14
|
getDb,
|
|
15
15
|
init_client
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-W3JMIUHV.js";
|
|
17
17
|
import {
|
|
18
18
|
notFound
|
|
19
19
|
} from "./chunk-EZYKRG4W.js";
|
|
@@ -39,12 +39,7 @@ function handleListThreads(request, sessionId) {
|
|
|
39
39
|
// show all threads including completed ones
|
|
40
40
|
tenantFilter: tenantFilter(auth)
|
|
41
41
|
});
|
|
42
|
-
return
|
|
43
|
-
data,
|
|
44
|
-
has_more: data.length === requestedLimit,
|
|
45
|
-
first_id: data.length > 0 ? data[0].id : null,
|
|
46
|
-
last_id: data.length > 0 ? data[data.length - 1].id : null
|
|
47
|
-
});
|
|
42
|
+
return paginatedOk(data, requestedLimit);
|
|
48
43
|
});
|
|
49
44
|
}
|
|
50
45
|
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./chunk-23UKWXJH.js";
|
|
4
4
|
import {
|
|
5
5
|
recordAudit
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L3IACZ72.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-T3IGOI6Z.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-I26QP3A3.js";
|
|
21
21
|
import {
|
|
22
22
|
badRequest,
|
|
23
23
|
notFound
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_TENANT_ID
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I26QP3A3.js";
|
|
4
4
|
import {
|
|
5
5
|
init_ids,
|
|
6
6
|
newId
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getDrizzle,
|
|
15
15
|
init_drizzle
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PZNAQBHQ.js";
|
|
17
17
|
import {
|
|
18
18
|
schema_exports
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ILHIHMO3.js";
|
|
20
20
|
|
|
21
21
|
// src/db/agents.ts
|
|
22
22
|
init_drizzle();
|
|
@@ -24,14 +24,24 @@ init_ids();
|
|
|
24
24
|
init_clock();
|
|
25
25
|
import { eq, and, isNull, lt, gt, asc, desc } from "drizzle-orm";
|
|
26
26
|
function hydrate(row, ver) {
|
|
27
|
+
const modelConfig = ver.model_config_json ? JSON.parse(ver.model_config_json) : {};
|
|
28
|
+
const rawMcp = ver.mcp_servers_json ? JSON.parse(ver.mcp_servers_json) : {};
|
|
29
|
+
const mcpServers = Array.isArray(rawMcp) ? rawMcp : Object.entries(rawMcp).map(([name, cfg]) => ({
|
|
30
|
+
name,
|
|
31
|
+
type: "url",
|
|
32
|
+
...typeof cfg === "string" ? { url: cfg } : cfg
|
|
33
|
+
}));
|
|
27
34
|
return {
|
|
35
|
+
type: "agent",
|
|
28
36
|
id: row.id,
|
|
29
37
|
version: ver.version,
|
|
30
38
|
name: row.name,
|
|
31
|
-
|
|
39
|
+
description: row.description ?? "",
|
|
40
|
+
model: { id: ver.model, ...modelConfig.speed ? { speed: modelConfig.speed } : {} },
|
|
32
41
|
system: ver.system,
|
|
33
42
|
tools: JSON.parse(ver.tools_json),
|
|
34
|
-
mcp_servers:
|
|
43
|
+
mcp_servers: mcpServers,
|
|
44
|
+
metadata: row.metadata_json ? JSON.parse(row.metadata_json) : {},
|
|
35
45
|
engine: ver.backend ?? "claude",
|
|
36
46
|
webhook_url: ver.webhook_url ?? null,
|
|
37
47
|
webhook_events: ver.webhook_events_json ? JSON.parse(ver.webhook_events_json) : ["session.status_idle", "session.status_running", "session.error"],
|
|
@@ -40,10 +50,11 @@ function hydrate(row, ver) {
|
|
|
40
50
|
confirmation_mode: Boolean(ver.confirmation_mode),
|
|
41
51
|
callable_agents: ver.callable_agents_json ? JSON.parse(ver.callable_agents_json) : [],
|
|
42
52
|
skills: ver.skills_json ? JSON.parse(ver.skills_json) : [],
|
|
43
|
-
model_config:
|
|
53
|
+
model_config: modelConfig,
|
|
44
54
|
fallback_json: row.fallback_json ?? null,
|
|
45
55
|
created_at: toIso(row.created_at),
|
|
46
|
-
updated_at: toIso(row.updated_at)
|
|
56
|
+
updated_at: toIso(row.updated_at),
|
|
57
|
+
archived_at: row.archived_at ? new Date(row.archived_at).toISOString() : null
|
|
47
58
|
};
|
|
48
59
|
}
|
|
49
60
|
function createAgent(input) {
|
|
@@ -55,6 +66,8 @@ function createAgent(input) {
|
|
|
55
66
|
id,
|
|
56
67
|
current_version: 1,
|
|
57
68
|
name: input.name,
|
|
69
|
+
description: input.description ?? null,
|
|
70
|
+
metadata_json: JSON.stringify(input.metadata ?? {}),
|
|
58
71
|
tenant_id: input.tenant_id ?? DEFAULT_TENANT_ID,
|
|
59
72
|
created_at: now,
|
|
60
73
|
updated_at: now
|
|
@@ -98,7 +111,10 @@ function updateAgent(id, input) {
|
|
|
98
111
|
const db = getDrizzle();
|
|
99
112
|
const existing = getAgent(id);
|
|
100
113
|
if (!existing) return null;
|
|
101
|
-
const existingVer = db.select({
|
|
114
|
+
const existingVer = db.select({
|
|
115
|
+
webhook_secret: schema_exports.agentVersions.webhook_secret,
|
|
116
|
+
mcp_servers_json: schema_exports.agentVersions.mcp_servers_json
|
|
117
|
+
}).from(schema_exports.agentVersions).where(
|
|
102
118
|
and(
|
|
103
119
|
eq(schema_exports.agentVersions.agent_id, id),
|
|
104
120
|
eq(schema_exports.agentVersions.version, existing.version)
|
|
@@ -111,10 +127,10 @@ function updateAgent(id, input) {
|
|
|
111
127
|
tx.insert(schema_exports.agentVersions).values({
|
|
112
128
|
agent_id: id,
|
|
113
129
|
version: newVersion,
|
|
114
|
-
model: input.model ?? existing.model,
|
|
130
|
+
model: input.model ?? existing.model.id,
|
|
115
131
|
system: input.system ?? existing.system,
|
|
116
132
|
tools_json: JSON.stringify(input.tools ?? existing.tools),
|
|
117
|
-
mcp_servers_json: JSON.stringify(input.mcp_servers ??
|
|
133
|
+
mcp_servers_json: input.mcp_servers ? JSON.stringify(input.mcp_servers) : existingVer?.mcp_servers_json ?? "{}",
|
|
118
134
|
backend: existing.engine,
|
|
119
135
|
webhook_url: input.webhook_url !== void 0 ? input.webhook_url : existing.webhook_url,
|
|
120
136
|
webhook_events_json: JSON.stringify(input.webhook_events ?? existing.webhook_events),
|
|
@@ -129,6 +145,8 @@ function updateAgent(id, input) {
|
|
|
129
145
|
tx.update(schema_exports.agents).set({
|
|
130
146
|
current_version: newVersion,
|
|
131
147
|
name: input.name ?? existing.name,
|
|
148
|
+
description: input.description !== void 0 ? input.description ?? null : existing.description || null,
|
|
149
|
+
metadata_json: input.metadata !== void 0 ? JSON.stringify(input.metadata) : JSON.stringify(existing.metadata),
|
|
132
150
|
updated_at: now
|
|
133
151
|
}).where(eq(schema_exports.agents.id, id)).run();
|
|
134
152
|
});
|
|
@@ -139,6 +157,18 @@ function archiveAgent(id) {
|
|
|
139
157
|
const res = db.update(schema_exports.agents).set({ archived_at: nowMs() }).where(and(eq(schema_exports.agents.id, id), isNull(schema_exports.agents.archived_at))).run();
|
|
140
158
|
return res.changes > 0;
|
|
141
159
|
}
|
|
160
|
+
function listAgentVersions(agentId, opts) {
|
|
161
|
+
const db = getDrizzle();
|
|
162
|
+
const limit = Math.min(Math.max(opts.limit ?? 20, 1), 100);
|
|
163
|
+
const row = db.select().from(schema_exports.agents).where(eq(schema_exports.agents.id, agentId)).get();
|
|
164
|
+
if (!row) return [];
|
|
165
|
+
const conditions = [eq(schema_exports.agentVersions.agent_id, agentId)];
|
|
166
|
+
if (opts.cursor) {
|
|
167
|
+
conditions.push(lt(schema_exports.agentVersions.version, opts.cursor));
|
|
168
|
+
}
|
|
169
|
+
const versions = db.select().from(schema_exports.agentVersions).where(and(...conditions)).orderBy(desc(schema_exports.agentVersions.version)).limit(limit).all();
|
|
170
|
+
return versions.map((ver) => hydrate(row, ver));
|
|
171
|
+
}
|
|
142
172
|
function listAgents(opts) {
|
|
143
173
|
const db = getDrizzle();
|
|
144
174
|
const limit = Math.min(Math.max(opts.limit ?? 20, 1), 100);
|
|
@@ -165,5 +195,6 @@ export {
|
|
|
165
195
|
getAgent,
|
|
166
196
|
updateAgent,
|
|
167
197
|
archiveAgent,
|
|
198
|
+
listAgentVersions,
|
|
168
199
|
listAgents
|
|
169
200
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsonOk,
|
|
3
3
|
routeWrap
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T3IGOI6Z.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveContainerProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JRQB3SHR.js";
|
|
8
8
|
import {
|
|
9
9
|
getConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GQYSSSVA.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/providers.ts
|
|
13
13
|
var LOCAL_PROVIDERS = ["docker", "apple-container", "podman"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildPiArgs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6KWJASEO.js";
|
|
4
4
|
import {
|
|
5
5
|
buildPiAuthEnv,
|
|
6
6
|
validatePiRuntime
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RT5S5KRX.js";
|
|
8
8
|
import {
|
|
9
9
|
preparePiOnSandbox
|
|
10
10
|
} from "./chunk-QYSDP6V5.js";
|
|
@@ -78,13 +78,27 @@ var ModelConfigSchema = registry.register(
|
|
|
78
78
|
var AgentSchema = registry.register(
|
|
79
79
|
"Agent",
|
|
80
80
|
z.object({
|
|
81
|
+
type: z.literal("agent"),
|
|
81
82
|
id: UlidId,
|
|
82
83
|
version: z.number().int().positive(),
|
|
83
84
|
name: z.string(),
|
|
84
|
-
|
|
85
|
+
description: z.string().openapi({ description: "Human-readable description of the agent." }),
|
|
86
|
+
model: z.object({
|
|
87
|
+
id: z.string(),
|
|
88
|
+
speed: z.enum(["standard", "fast"]).optional()
|
|
89
|
+
}).openapi({ description: "Model configuration. `id` is the canonical model identifier." }),
|
|
85
90
|
system: z.string().nullable(),
|
|
86
91
|
tools: z.array(ToolConfigSchema),
|
|
87
|
-
mcp_servers: z.
|
|
92
|
+
mcp_servers: z.array(z.object({
|
|
93
|
+
name: z.string(),
|
|
94
|
+
type: z.string(),
|
|
95
|
+
url: z.string().optional()
|
|
96
|
+
}).catchall(z.unknown())).openapi({
|
|
97
|
+
description: "MCP servers configured for this agent. Each entry has a name, type, and optional url."
|
|
98
|
+
}),
|
|
99
|
+
metadata: z.record(z.string()).openapi({
|
|
100
|
+
description: "Key-value metadata attached to the agent. Values must be strings."
|
|
101
|
+
}),
|
|
88
102
|
engine: z.enum(["claude", "opencode", "codex", "anthropic", "gemini", "factory", "pi"]).openapi({
|
|
89
103
|
description: "Which agent harness powers this agent. `claude` drives `claude -p`; `opencode` drives sst/opencode-ai's `opencode run`; `gemini` drives Google's `gemini -p`; `factory` drives Factory's `droid exec`; `pi` drives the pi.dev coding agent (`pi --mode json`). Immutable after agent creation."
|
|
90
104
|
}),
|
|
@@ -94,12 +108,22 @@ var AgentSchema = registry.register(
|
|
|
94
108
|
webhook_events: z.array(z.string()).openapi({
|
|
95
109
|
description: "Event types that trigger webhook delivery. Defaults to status + error events."
|
|
96
110
|
}),
|
|
111
|
+
webhook_signing_enabled: z.boolean().openapi({
|
|
112
|
+
description: "Whether a webhook shared secret is configured. The secret itself is never returned."
|
|
113
|
+
}),
|
|
97
114
|
threads_enabled: z.boolean().openapi({
|
|
98
115
|
description: "Whether this agent can spawn sub-agents via the spawn_agent tool."
|
|
99
116
|
}),
|
|
100
117
|
confirmation_mode: z.boolean().openapi({
|
|
101
118
|
description: "Whether this agent requires tool confirmation via user.tool_confirmation events. When true, claude runs with --permission-mode default and a PermissionRequest hook bridges tool approvals to the MA API."
|
|
102
119
|
}),
|
|
120
|
+
callable_agents: z.array(z.object({
|
|
121
|
+
type: z.literal("agent"),
|
|
122
|
+
id: z.string(),
|
|
123
|
+
version: z.number().int().optional()
|
|
124
|
+
})).openapi({
|
|
125
|
+
description: "Agents that can be called by this agent via the spawn_agent tool."
|
|
126
|
+
}),
|
|
103
127
|
skills: z.array(AgentSkillSchema).openapi({
|
|
104
128
|
description: "Skills injected into the container at session start. For Claude backend, written to .claude/skills/<name>/SKILL.md. For all backends, also written to .agents/skills/<name>/SKILL.md. Non-Claude backends also receive skills prepended to the system prompt."
|
|
105
129
|
}),
|
|
@@ -107,17 +131,30 @@ var AgentSchema = registry.register(
|
|
|
107
131
|
description: "Model configuration options. 'fast' speed enables fast mode on Claude (claude engine only)."
|
|
108
132
|
}),
|
|
109
133
|
created_at: IsoTimestamp,
|
|
110
|
-
updated_at: IsoTimestamp
|
|
134
|
+
updated_at: IsoTimestamp,
|
|
135
|
+
archived_at: IsoTimestamp.nullable()
|
|
111
136
|
})
|
|
112
137
|
);
|
|
113
138
|
var CreateAgentRequestSchema = registry.register(
|
|
114
139
|
"CreateAgentRequest",
|
|
115
140
|
z.object({
|
|
116
141
|
name: z.string().min(1).openapi({ example: "my-agent" }),
|
|
117
|
-
model: z.string().min(1).openapi({ example: "claude-sonnet-4-6" }),
|
|
142
|
+
model: z.object({ id: z.string().min(1), speed: z.enum(["standard", "fast"]).optional() }).openapi({ description: "Model configuration. `id` is the canonical model identifier.", example: { id: "claude-sonnet-4-6" } }),
|
|
143
|
+
description: z.string().max(2048).optional().openapi({
|
|
144
|
+
description: "Human-readable description of the agent."
|
|
145
|
+
}),
|
|
146
|
+
metadata: z.record(z.string(), z.string().max(512)).optional().openapi({
|
|
147
|
+
description: "Key-value metadata. Max 16 keys, values max 512 chars."
|
|
148
|
+
}),
|
|
118
149
|
system: z.string().nullish().openapi({ example: "You are a helpful assistant." }),
|
|
119
150
|
tools: z.array(ToolConfigSchema).optional(),
|
|
120
|
-
mcp_servers: z.
|
|
151
|
+
mcp_servers: z.array(z.object({
|
|
152
|
+
name: z.string(),
|
|
153
|
+
type: z.string().optional(),
|
|
154
|
+
url: z.string().optional()
|
|
155
|
+
}).catchall(z.unknown())).optional().openapi({
|
|
156
|
+
description: "MCP servers as an array of objects with name, type, and optional url."
|
|
157
|
+
}),
|
|
121
158
|
engine: z.enum(["claude", "opencode", "codex", "anthropic", "gemini", "factory", "pi"]).optional().openapi({
|
|
122
159
|
description: "Agent harness. Defaults to `claude`. Opencode agents must set `model` to a `provider/model` string (e.g. `anthropic/claude-sonnet-4-6`) and must NOT declare `tools` \u2014 opencode manages its tool surface internally. Gemini agents require GEMINI_API_KEY. Factory agents require FACTORY_API_KEY. Pi agents (pi.dev) require at least one of ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY.",
|
|
123
160
|
example: "claude"
|
|
@@ -143,7 +180,7 @@ var CreateAgentRequestSchema = registry.register(
|
|
|
143
180
|
}).openapi({
|
|
144
181
|
example: {
|
|
145
182
|
name: "my-agent",
|
|
146
|
-
model: "claude-sonnet-4-6",
|
|
183
|
+
model: { id: "claude-sonnet-4-6" },
|
|
147
184
|
system: "You are a helpful assistant.",
|
|
148
185
|
tools: [{ type: "agent_toolset_20260401" }]
|
|
149
186
|
}
|
|
@@ -152,11 +189,28 @@ var CreateAgentRequestSchema = registry.register(
|
|
|
152
189
|
var UpdateAgentRequestSchema = registry.register(
|
|
153
190
|
"UpdateAgentRequest",
|
|
154
191
|
z.object({
|
|
192
|
+
version: z.number().int().min(1).openapi({
|
|
193
|
+
description: "Current agent version for optimistic concurrency. Must match the agent's current version."
|
|
194
|
+
}),
|
|
155
195
|
name: z.string().min(1).optional(),
|
|
156
|
-
model: z.string().min(1).optional()
|
|
196
|
+
model: z.object({ id: z.string().min(1), speed: z.enum(["standard", "fast"]).optional() }).optional().openapi({
|
|
197
|
+
description: "Model configuration. `id` is the canonical model identifier."
|
|
198
|
+
}),
|
|
199
|
+
description: z.string().max(2048).optional().openapi({
|
|
200
|
+
description: "Human-readable description of the agent."
|
|
201
|
+
}),
|
|
202
|
+
metadata: z.record(z.string(), z.string().max(512)).optional().openapi({
|
|
203
|
+
description: "Key-value metadata. Max 16 keys, values max 512 chars."
|
|
204
|
+
}),
|
|
157
205
|
system: z.string().nullish(),
|
|
158
206
|
tools: z.array(ToolConfigSchema).optional(),
|
|
159
|
-
mcp_servers: z.
|
|
207
|
+
mcp_servers: z.array(z.object({
|
|
208
|
+
name: z.string(),
|
|
209
|
+
type: z.string().optional(),
|
|
210
|
+
url: z.string().optional()
|
|
211
|
+
}).catchall(z.unknown())).optional().openapi({
|
|
212
|
+
description: "MCP servers as an array of objects with name, type, and optional url."
|
|
213
|
+
}),
|
|
160
214
|
skills: z.array(AgentSkillSchema).max(20).optional().openapi({
|
|
161
215
|
description: "Updated skills list. Replaces the existing skills entirely."
|
|
162
216
|
}),
|
|
@@ -198,6 +252,7 @@ var EnvironmentConfigSchema = registry.register(
|
|
|
198
252
|
var EnvironmentSchema = registry.register(
|
|
199
253
|
"Environment",
|
|
200
254
|
z.object({
|
|
255
|
+
type: z.literal("environment"),
|
|
201
256
|
id: UlidId,
|
|
202
257
|
name: z.string(),
|
|
203
258
|
description: z.string().nullable().openapi({
|
|
@@ -254,7 +309,10 @@ var SessionUsageSchema = z.object({
|
|
|
254
309
|
input_tokens: z.number().int().nonnegative(),
|
|
255
310
|
output_tokens: z.number().int().nonnegative(),
|
|
256
311
|
cache_read_input_tokens: z.number().int().nonnegative(),
|
|
257
|
-
|
|
312
|
+
cache_creation: z.object({
|
|
313
|
+
ephemeral_5m_input_tokens: z.number().int().nonnegative(),
|
|
314
|
+
ephemeral_1h_input_tokens: z.number().int().nonnegative()
|
|
315
|
+
}),
|
|
258
316
|
cost_usd: z.number().nonnegative()
|
|
259
317
|
});
|
|
260
318
|
var SessionStatusSchema = registry.register(
|
|
@@ -265,7 +323,18 @@ var SessionSchema = registry.register(
|
|
|
265
323
|
"Session",
|
|
266
324
|
z.object({
|
|
267
325
|
id: UlidId,
|
|
268
|
-
agent: z.object({
|
|
326
|
+
agent: z.object({
|
|
327
|
+
type: z.literal("agent"),
|
|
328
|
+
id: UlidId,
|
|
329
|
+
version: z.number().int().positive(),
|
|
330
|
+
name: z.string(),
|
|
331
|
+
description: z.string(),
|
|
332
|
+
model: z.object({ id: z.string(), speed: z.enum(["standard", "fast"]).optional() }),
|
|
333
|
+
system: z.string().nullable(),
|
|
334
|
+
tools: z.array(z.record(z.unknown())),
|
|
335
|
+
mcp_servers: z.array(z.record(z.unknown())),
|
|
336
|
+
skills: z.array(z.record(z.unknown()))
|
|
337
|
+
}),
|
|
269
338
|
environment_id: UlidId,
|
|
270
339
|
status: SessionStatusSchema,
|
|
271
340
|
stop_reason: z.union([
|
|
@@ -425,11 +494,17 @@ var ManagedEventSchema = registry.register(
|
|
|
425
494
|
var VaultSchema = registry.register(
|
|
426
495
|
"Vault",
|
|
427
496
|
z.object({
|
|
497
|
+
type: z.literal("vault"),
|
|
428
498
|
id: UlidId,
|
|
429
|
-
agent_id: UlidId,
|
|
499
|
+
agent_id: UlidId.nullable().openapi({ description: "Owning agent ID. Null for unscoped vaults." }),
|
|
430
500
|
name: z.string(),
|
|
501
|
+
display_name: z.string().openapi({ description: "Anthropic-compatible alias for `name`." }),
|
|
502
|
+
metadata: z.record(z.string()).openapi({
|
|
503
|
+
description: "Key-value metadata attached to the vault. Values must be strings."
|
|
504
|
+
}),
|
|
431
505
|
created_at: IsoTimestamp,
|
|
432
|
-
updated_at: IsoTimestamp
|
|
506
|
+
updated_at: IsoTimestamp,
|
|
507
|
+
archived_at: IsoTimestamp.nullable()
|
|
433
508
|
})
|
|
434
509
|
);
|
|
435
510
|
var VaultEntrySchema = registry.register(
|
|
@@ -442,10 +517,21 @@ var VaultEntrySchema = registry.register(
|
|
|
442
517
|
var CreateVaultRequestSchema = registry.register(
|
|
443
518
|
"CreateVaultRequest",
|
|
444
519
|
z.object({
|
|
445
|
-
agent_id: UlidId.openapi({ example: "agent_01ABCDEFG..." }),
|
|
520
|
+
agent_id: UlidId.optional().openapi({ example: "agent_01ABCDEFG...", description: "Owning agent ID. Optional for unscoped vaults." }),
|
|
446
521
|
name: z.string().min(1).openapi({ example: "my-vault" })
|
|
447
522
|
})
|
|
448
523
|
);
|
|
524
|
+
var UpdateVaultRequestSchema = registry.register(
|
|
525
|
+
"UpdateVaultRequest",
|
|
526
|
+
z.object({
|
|
527
|
+
display_name: z.string().min(1).max(255).optional().openapi({
|
|
528
|
+
description: "Update the vault display name."
|
|
529
|
+
}),
|
|
530
|
+
metadata: z.record(z.string().max(512)).optional().openapi({
|
|
531
|
+
description: "Replaces the metadata entirely. Max 16 key-value pairs."
|
|
532
|
+
})
|
|
533
|
+
})
|
|
534
|
+
);
|
|
449
535
|
var SetVaultEntryRequestSchema = registry.register(
|
|
450
536
|
"SetVaultEntryRequest",
|
|
451
537
|
z.object({
|
|
@@ -555,9 +641,7 @@ var FileListResponseSchema = registry.register(
|
|
|
555
641
|
"FileListResponse",
|
|
556
642
|
z.object({
|
|
557
643
|
data: z.array(FileRecordSchema),
|
|
558
|
-
|
|
559
|
-
first_id: z.string().nullable().openapi({ description: "ID of the first item in this page." }),
|
|
560
|
-
last_id: z.string().nullable().openapi({ description: "ID of the last item in this page." })
|
|
644
|
+
next_page: z.string().nullable().openapi({ description: "Opaque cursor for the next page, or null if no more results." })
|
|
561
645
|
})
|
|
562
646
|
);
|
|
563
647
|
var FileDeletedResponseSchema = registry.register(
|
|
@@ -1093,6 +1177,7 @@ export {
|
|
|
1093
1177
|
VaultSchema,
|
|
1094
1178
|
VaultEntrySchema,
|
|
1095
1179
|
CreateVaultRequestSchema,
|
|
1180
|
+
UpdateVaultRequestSchema,
|
|
1096
1181
|
SetVaultEntryRequestSchema,
|
|
1097
1182
|
VaultDeletedResponseSchema,
|
|
1098
1183
|
VaultEntryDeletedResponseSchema,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-23UKWXJH.js";
|
|
7
7
|
import {
|
|
8
8
|
recordAudit
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L3IACZ72.js";
|
|
10
10
|
import {
|
|
11
11
|
COMMUNITY_LIMITS,
|
|
12
12
|
hasFeature,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
jsonOk,
|
|
17
17
|
routeWrap
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-T3IGOI6Z.js";
|
|
19
19
|
import {
|
|
20
20
|
createApiKey,
|
|
21
21
|
getApiKeyById,
|
|
@@ -23,14 +23,14 @@ import {
|
|
|
23
23
|
listApiKeys,
|
|
24
24
|
revokeApiKey,
|
|
25
25
|
updateApiKeyPermissions
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-T3FQPTOA.js";
|
|
27
27
|
import {
|
|
28
28
|
listSessionsByApiKey
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KUWJJD6O.js";
|
|
30
30
|
import {
|
|
31
31
|
getDb,
|
|
32
32
|
init_client
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-W3JMIUHV.js";
|
|
34
34
|
import {
|
|
35
35
|
badRequest,
|
|
36
36
|
forbidden,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
getSources,
|
|
5
5
|
getStats,
|
|
6
6
|
searchSkills
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-74E7GKUG.js";
|
|
8
8
|
import {
|
|
9
9
|
jsonOk,
|
|
10
10
|
routeWrap
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-T3IGOI6Z.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/skills.ts
|
|
14
14
|
async function handleGetSkillsCatalog(request) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// src/sessions/mcp-auth.ts
|
|
2
2
|
function injectMcpAuthHeaders(agent, vaultEntries) {
|
|
3
3
|
const mcpServers = agent.mcp_servers;
|
|
4
|
-
if (!mcpServers ||
|
|
4
|
+
if (!mcpServers || mcpServers.length === 0) return agent;
|
|
5
5
|
if (vaultEntries.length === 0) return agent;
|
|
6
6
|
const serverLookup = /* @__PURE__ */ new Map();
|
|
7
|
-
for (
|
|
8
|
-
|
|
7
|
+
for (let i = 0; i < mcpServers.length; i++) {
|
|
8
|
+
const name = mcpServers[i].name;
|
|
9
|
+
serverLookup.set(name.toUpperCase().replace(/-/g, "_"), i);
|
|
9
10
|
}
|
|
10
11
|
let mutated = false;
|
|
11
12
|
const merged = {};
|
|
@@ -13,10 +14,10 @@ function injectMcpAuthHeaders(agent, vaultEntries) {
|
|
|
13
14
|
const authMatch = /^MCP_AUTH_(.+)$/i.exec(key);
|
|
14
15
|
if (authMatch) {
|
|
15
16
|
const norm = authMatch[1].toUpperCase();
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
merged[
|
|
19
|
-
merged[
|
|
17
|
+
const idx = serverLookup.get(norm);
|
|
18
|
+
if (idx !== void 0) {
|
|
19
|
+
merged[idx] = merged[idx] ?? {};
|
|
20
|
+
merged[idx]["Authorization"] = `Bearer ${value}`;
|
|
20
21
|
mutated = true;
|
|
21
22
|
}
|
|
22
23
|
continue;
|
|
@@ -28,10 +29,10 @@ function injectMcpAuthHeaders(agent, vaultEntries) {
|
|
|
28
29
|
for (let i = parts.length - 1; i >= 1; i--) {
|
|
29
30
|
const serverPart = parts.slice(0, i).join("_").toUpperCase();
|
|
30
31
|
const headerPart = parts.slice(i).join("-");
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
merged[
|
|
34
|
-
merged[
|
|
32
|
+
const idx = serverLookup.get(serverPart);
|
|
33
|
+
if (idx !== void 0) {
|
|
34
|
+
merged[idx] = merged[idx] ?? {};
|
|
35
|
+
merged[idx][headerPart] = value;
|
|
35
36
|
mutated = true;
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
@@ -39,13 +40,14 @@ function injectMcpAuthHeaders(agent, vaultEntries) {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
if (!mutated) return agent;
|
|
42
|
-
const newServers =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const newServers = mcpServers.map((server, idx) => {
|
|
44
|
+
const headers = merged[idx];
|
|
45
|
+
if (!headers) return server;
|
|
46
|
+
return {
|
|
47
|
+
...server,
|
|
48
|
+
headers: { ...server.headers, ...headers }
|
|
47
49
|
};
|
|
48
|
-
}
|
|
50
|
+
});
|
|
49
51
|
return { ...agent, mcp_servers: newServers };
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
getDrizzle,
|
|
12
12
|
init_drizzle
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PZNAQBHQ.js";
|
|
14
14
|
import {
|
|
15
15
|
schema_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ILHIHMO3.js";
|
|
17
17
|
|
|
18
18
|
// src/db/files.ts
|
|
19
19
|
init_drizzle();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listTraces
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XSNJ7NT2.js";
|
|
4
4
|
import {
|
|
5
5
|
jsonOk,
|
|
6
6
|
routeWrap
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T3IGOI6Z.js";
|
|
8
8
|
import {
|
|
9
9
|
exportTrace
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MZYJFU4K.js";
|
|
11
11
|
import {
|
|
12
12
|
listEventsByTrace,
|
|
13
13
|
rowToManagedEvent
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KGBKIJPF.js";
|
|
15
15
|
import {
|
|
16
16
|
badRequest,
|
|
17
17
|
notFound
|