@agentstep/agent-sdk 0.4.39 → 0.5.0
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 +7 -7
- 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 +24 -24
- package/dist/{chunk-L2RX552S.js → chunk-22OUZJAV.js} +3 -3
- package/dist/{chunk-PIJKJNGB.js → chunk-24IDJ7LY.js} +4 -4
- package/dist/{chunk-WCDWL6ED.js → chunk-2YZOIFVN.js} +49 -0
- package/dist/{chunk-RDGOGAQ5.js → chunk-3FLQ7KZP.js} +1 -1
- package/dist/{chunk-ZQXBHNEZ.js → chunk-3PA4NXRP.js} +2 -2
- package/dist/{chunk-FZFICXAN.js → chunk-3XGUMXGR.js} +2 -2
- package/dist/{chunk-H7UKW666.js → chunk-445EL6J5.js} +1 -1
- package/dist/{chunk-2RSL5SO7.js → chunk-4D345E27.js} +2 -2
- package/dist/{chunk-D6ZQXOSQ.js → chunk-4RDILRIO.js} +5 -5
- package/dist/{chunk-MHBLVGRF.js → chunk-5MERXOLJ.js} +4 -4
- package/dist/{chunk-E7DD7F7J.js → chunk-5U5LRAFJ.js} +2 -2
- package/dist/{chunk-34EB622U.js → chunk-64IQEPSD.js} +2 -2
- package/dist/{chunk-ENGKR2JT.js → chunk-6CVQDSTS.js} +1 -1
- package/dist/{chunk-T5VRE77P.js → chunk-6KWJASEO.js} +1 -1
- package/dist/{chunk-W2NHS4IF.js → chunk-6QZ23WRF.js} +15 -19
- package/dist/{chunk-DU7LSFQQ.js → chunk-7SY65LWY.js} +6 -9
- package/dist/{chunk-C46UG6GQ.js → chunk-A6VORSKD.js} +1 -1
- package/dist/{chunk-3FDE3BPB.js → chunk-AB7MPL3H.js} +6 -6
- package/dist/{chunk-RP6WQ4IH.js → chunk-AJL3T5JS.js} +3 -3
- package/dist/{chunk-KKCLTWG7.js → chunk-AXBM7HAR.js} +1 -1
- package/dist/{chunk-ZTH5JRZG.js → chunk-BCIFFAGW.js} +41 -10
- package/dist/{chunk-OXWELRJL.js → chunk-CBPO2P4I.js} +101 -16
- package/dist/{chunk-32XS3Y6P.js → chunk-CLSGNQ7J.js} +8 -8
- package/dist/{chunk-SV2B3P6B.js → chunk-DBFPJSOY.js} +19 -17
- package/dist/{chunk-JWH4OIBP.js → chunk-DJZSPWG2.js} +4 -4
- package/dist/{chunk-JZL4L54R.js → chunk-DKLHYSPW.js} +2 -2
- package/dist/{chunk-NQVRZAIX.js → chunk-DMMNAQUM.js} +2 -2
- package/dist/{chunk-Y6SFUNGO.js → chunk-EOJ66GY7.js} +4 -4
- package/dist/{chunk-EUINGLHA.js → chunk-EWIWVXXP.js} +30 -20
- package/dist/{chunk-5EKQBD2H.js → chunk-FCUXFLNK.js} +2 -2
- package/dist/{chunk-LAVHQCRP.js → chunk-FSQ4HGHX.js} +3 -3
- package/dist/{chunk-WQARLGBG.js → chunk-GCQDNUS2.js} +3 -3
- package/dist/{chunk-MXOG5SAO.js → chunk-GFSRNOPI.js} +11 -14
- package/dist/{chunk-S7W3KJYH.js → chunk-GIMDS46L.js} +9 -4
- package/dist/{chunk-FP4E3QUS.js → chunk-GLKWJESP.js} +2 -2
- package/dist/{chunk-FDBR634Z.js → chunk-GV6GUSCP.js} +6 -6
- 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-RVR6C22M.js → chunk-HWR2HYQJ.js} +1 -1
- package/dist/{chunk-HH4OXSOV.js → chunk-HY3T4YJV.js} +5 -5
- 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-XWWLMJXT.js → chunk-IRW7AYTP.js} +6 -15
- package/dist/{chunk-N76ZVITA.js → chunk-JFOHGHW5.js} +9 -9
- package/dist/{chunk-DAVYI5H4.js → chunk-JLUCJMAQ.js} +23 -23
- package/dist/{chunk-GVPJL3XS.js → chunk-JP7Y3TKK.js} +5 -5
- package/dist/{chunk-TH7WJLZC.js → chunk-KGBKIJPF.js} +3 -3
- package/dist/{chunk-MQQ44IGX.js → chunk-KKAJC3Z2.js} +3 -3
- package/dist/{chunk-3NK6YTA5.js → chunk-KUWJJD6O.js} +42 -8
- package/dist/{chunk-2GIX4HAT.js → chunk-L26TVIB6.js} +2 -2
- package/dist/{chunk-KLN6HPYM.js → chunk-L3IACZ72.js} +1 -1
- package/dist/{chunk-C6AXM3M7.js → chunk-LQP6XGFU.js} +2 -2
- package/dist/{chunk-JX627GQF.js → chunk-MAJWADF7.js} +2 -2
- package/dist/{chunk-7GG3FEK2.js → chunk-MCWCRZM4.js} +4 -4
- package/dist/{chunk-JCW3ZRES.js → chunk-MQBMXAPU.js} +1 -1
- package/dist/{chunk-CREPPDHX.js → chunk-NDTIDWBE.js} +1 -1
- package/dist/{chunk-5EQJOUWM.js → chunk-NHAYKVXG.js} +2 -2
- package/dist/{chunk-FXLUSECC.js → chunk-NKQVOAWN.js} +1 -1
- package/dist/{chunk-ZYISLRS6.js → chunk-OKT2J4ZB.js} +114 -37
- package/dist/{chunk-P3PHXVMA.js → chunk-OSNMIPHV.js} +54 -8
- package/dist/{chunk-ZFJPOQSY.js → chunk-OZFSKR2W.js} +69 -30
- package/dist/{chunk-3IV56JJW.js → chunk-P56WU3UT.js} +3 -2
- package/dist/{chunk-NQX7WBA4.js → chunk-PJYCPDV5.js} +14 -9
- package/dist/{chunk-LMNFIJ6M.js → chunk-PN3AWRMX.js} +15 -15
- package/dist/{chunk-ZMNQ2YJ6.js → chunk-PNZF7HIU.js} +3 -3
- package/dist/{chunk-R5T4LJSK.js → chunk-PZNAQBHQ.js} +2 -2
- package/dist/{chunk-RH4GKU52.js → chunk-QTXAWC5J.js} +18 -3
- package/dist/{chunk-2I35VGHX.js → chunk-R3QHLKJG.js} +2 -2
- package/dist/{chunk-OGJUSGF7.js → chunk-R6EEBWM3.js} +1 -1
- package/dist/{chunk-V66YKIW6.js → chunk-RYJXSXCV.js} +5 -5
- package/dist/{chunk-CHDQ3HIR.js → chunk-S7DFMJR5.js} +5 -9
- package/dist/{chunk-V2R7RWVY.js → chunk-STJNO6SL.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-IAF6VMPO.js → chunk-TPMZO6S2.js} +1 -1
- package/dist/{chunk-P26WOAA3.js → chunk-TUEBRYPZ.js} +1 -1
- package/dist/{chunk-HOIDGDU5.js → chunk-TVODT2UR.js} +1 -1
- package/dist/{chunk-Z25I7DRV.js → chunk-V5DH3OAC.js} +10 -5
- package/dist/{chunk-ZVXIZ2JD.js → chunk-VP527YC5.js} +35 -6
- package/dist/{chunk-6POQAFEC.js → chunk-W3JMIUHV.js} +1 -1
- package/dist/{chunk-6IYCBW4J.js → chunk-WEC625LQ.js} +1 -1
- package/dist/{chunk-V7MTIMPB.js → chunk-X6QIWZ33.js} +2 -2
- package/dist/{chunk-6GP5IKXE.js → chunk-XSNJ7NT2.js} +1 -1
- package/dist/{chunk-LZFB3HRK.js → chunk-XTKTIFHC.js} +5 -10
- package/dist/{chunk-QSUGIJWV.js → chunk-YMCS6AB7.js} +4 -9
- package/dist/{chunk-FOOH6SCB.js → chunk-YXOCKQZU.js} +2 -2
- package/dist/{chunk-2PPB644A.js → chunk-Z4LFLXRR.js} +1 -1
- package/dist/{chunk-N3QIXC2B.js → chunk-Z6VZYRVN.js} +2 -2
- 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 +36 -36
- package/dist/containers/setup.js +8 -8
- 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 +56 -52
- package/dist/handlers/api_keys.js +53 -53
- package/dist/handlers/audit.js +53 -53
- package/dist/handlers/batch.js +53 -53
- package/dist/handlers/credentials.js +53 -53
- package/dist/handlers/environments.js +53 -53
- package/dist/handlers/events.js +56 -56
- package/dist/handlers/files.js +53 -53
- package/dist/handlers/index.js +101 -93
- package/dist/handlers/license.js +52 -52
- package/dist/handlers/memory.js +53 -53
- package/dist/handlers/metrics.js +52 -52
- package/dist/handlers/models.js +53 -53
- package/dist/handlers/openapi.js +3 -3
- package/dist/handlers/providers.js +52 -52
- package/dist/handlers/resources.js +52 -52
- package/dist/handlers/sessions.js +55 -55
- package/dist/handlers/settings.js +52 -52
- package/dist/handlers/skills-write.js +52 -52
- package/dist/handlers/skills.js +53 -53
- package/dist/handlers/stream.js +52 -52
- package/dist/handlers/tenants.js +53 -53
- package/dist/handlers/threads.js +52 -52
- package/dist/handlers/traces.js +53 -53
- package/dist/handlers/ui.js +1 -1
- package/dist/handlers/upstream_keys.js +55 -55
- package/dist/handlers/vaults.js +56 -52
- package/dist/handlers/whoami.js +52 -52
- package/dist/http.js +55 -51
- package/dist/index.js +57 -57
- package/dist/init.js +48 -48
- 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 +41 -41
- 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 +37 -37
- package/dist/sessions/threads.js +41 -41
- package/dist/shutdown.js +38 -38
- 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 +2 -2
- /package/dist/{chunk-WPK4ZPMG.js → chunk-UE6DNLSV.js} +0 -0
|
@@ -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,
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRemoteSessionId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-22OUZJAV.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-GCQDNUS2.js";
|
|
10
10
|
import {
|
|
11
11
|
forwardToAnthropic
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MQBMXAPU.js";
|
|
13
13
|
import {
|
|
14
14
|
ensureInitialized
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PN3AWRMX.js";
|
|
16
16
|
import {
|
|
17
17
|
getProxiedTenantId,
|
|
18
18
|
isProxied
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5U5LRAFJ.js";
|
|
20
20
|
import {
|
|
21
21
|
subscribe
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5MERXOLJ.js";
|
|
23
23
|
import {
|
|
24
24
|
getSession
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KUWJJD6O.js";
|
|
26
26
|
import {
|
|
27
27
|
getDb,
|
|
28
28
|
init_client
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-W3JMIUHV.js";
|
|
30
30
|
import {
|
|
31
31
|
notFound,
|
|
32
32
|
toResponse
|
|
@@ -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
|
|
|
@@ -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-QTXAWC5J.js";
|
|
8
8
|
import {
|
|
9
9
|
exportTrace
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JP7Y3TKK.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
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-S3JRZFF5.js";
|
|
4
4
|
import {
|
|
5
5
|
buildGeminiArgs
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IBYOMAZ3.js";
|
|
7
7
|
import {
|
|
8
8
|
buildGeminiAuthEnv,
|
|
9
9
|
validateGeminiRuntime
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-STJNO6SL.js";
|
|
11
11
|
import {
|
|
12
12
|
prepareGeminiOnSandbox
|
|
13
13
|
} from "./chunk-XG4UIGDH.js";
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SUPPORTED_PROVIDERS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-24IDJ7LY.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-445EL6J5.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-L3IACZ72.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-QTXAWC5J.js";
|
|
25
25
|
import {
|
|
26
26
|
badRequest,
|
|
27
27
|
notFound
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
syncAndCreateSession
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7SY65LWY.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveRemoteSessionId,
|
|
6
6
|
upsertSync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-22OUZJAV.js";
|
|
8
8
|
import {
|
|
9
9
|
assertResourceTenant,
|
|
10
10
|
tenantFilter
|
|
@@ -14,14 +14,16 @@ import {
|
|
|
14
14
|
} from "./chunk-DC2UMEQH.js";
|
|
15
15
|
import {
|
|
16
16
|
kickoffEnvironmentSetup
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LQP6XGFU.js";
|
|
18
18
|
import {
|
|
19
|
+
decodeCursor,
|
|
19
20
|
jsonOk,
|
|
21
|
+
paginatedOk,
|
|
20
22
|
routeWrap
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QTXAWC5J.js";
|
|
22
24
|
import {
|
|
23
25
|
forwardToAnthropic
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-MQBMXAPU.js";
|
|
25
27
|
import {
|
|
26
28
|
errors_exports,
|
|
27
29
|
init_errors
|
|
@@ -31,18 +33,18 @@ import {
|
|
|
31
33
|
isProxied,
|
|
32
34
|
markProxied,
|
|
33
35
|
unmarkProxied
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-5U5LRAFJ.js";
|
|
35
37
|
import {
|
|
36
38
|
dropActor,
|
|
37
39
|
getActor
|
|
38
40
|
} from "./chunk-LAWTTG2E.js";
|
|
39
41
|
import {
|
|
40
42
|
releaseSession
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-JFOHGHW5.js";
|
|
42
44
|
import {
|
|
43
45
|
appendEvent,
|
|
44
46
|
dropEmitter
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-5MERXOLJ.js";
|
|
46
48
|
import {
|
|
47
49
|
archiveSession,
|
|
48
50
|
createSession,
|
|
@@ -50,13 +52,13 @@ import {
|
|
|
50
52
|
listSessions,
|
|
51
53
|
updateSessionMutable,
|
|
52
54
|
updateSessionStatus
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-KUWJJD6O.js";
|
|
54
56
|
import {
|
|
55
57
|
getEnvironment
|
|
56
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-H6OT5GUL.js";
|
|
57
59
|
import {
|
|
58
60
|
getAgent
|
|
59
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-BCIFFAGW.js";
|
|
60
62
|
import {
|
|
61
63
|
init_clock,
|
|
62
64
|
nowMs
|
|
@@ -64,7 +66,7 @@ import {
|
|
|
64
66
|
import {
|
|
65
67
|
getDb,
|
|
66
68
|
init_client
|
|
67
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-W3JMIUHV.js";
|
|
68
70
|
import {
|
|
69
71
|
badRequest,
|
|
70
72
|
notFound
|
|
@@ -445,13 +447,25 @@ function handleListSessions(request) {
|
|
|
445
447
|
const limit = url.searchParams.get("limit");
|
|
446
448
|
const order = url.searchParams.get("order");
|
|
447
449
|
const includeArchived = url.searchParams.get("include_archived") === "true";
|
|
448
|
-
const cursor = url.searchParams.get("page")
|
|
450
|
+
const cursor = decodeCursor(url.searchParams.get("page"));
|
|
449
451
|
const agentId = url.searchParams.get("agent_id") ?? void 0;
|
|
450
452
|
const agentVersion = url.searchParams.get("agent_version");
|
|
451
453
|
const environmentId = url.searchParams.get("environment_id") ?? void 0;
|
|
454
|
+
const statusesRaw = url.searchParams.getAll("statuses");
|
|
452
455
|
const statusRaw = url.searchParams.get("status");
|
|
456
|
+
let statuses;
|
|
453
457
|
let status;
|
|
454
|
-
if (
|
|
458
|
+
if (statusesRaw.length > 0) {
|
|
459
|
+
const values = statusesRaw.flatMap((v) => v.split(","));
|
|
460
|
+
for (const v of values) {
|
|
461
|
+
if (!ALLOWED_STATUSES.includes(v)) {
|
|
462
|
+
throw badRequest(
|
|
463
|
+
`invalid statuses value: ${v} (allowed: ${ALLOWED_STATUSES.join(",")})`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
statuses = values;
|
|
468
|
+
} else if (statusRaw != null) {
|
|
455
469
|
if (!ALLOWED_STATUSES.includes(statusRaw)) {
|
|
456
470
|
throw badRequest(
|
|
457
471
|
`invalid status value: ${statusRaw} (allowed: ${ALLOWED_STATUSES.join(",")})`
|
|
@@ -465,6 +479,7 @@ function handleListSessions(request) {
|
|
|
465
479
|
agent_version: agentVersion ? Number(agentVersion) : void 0,
|
|
466
480
|
environmentId,
|
|
467
481
|
status,
|
|
482
|
+
statuses,
|
|
468
483
|
limit: requestedLimit,
|
|
469
484
|
order: order ?? void 0,
|
|
470
485
|
includeArchived,
|
|
@@ -475,12 +490,7 @@ function handleListSessions(request) {
|
|
|
475
490
|
createdLte: parseMs(url.searchParams.get("created_at[lte]")),
|
|
476
491
|
tenantFilter: tenantFilter(auth)
|
|
477
492
|
});
|
|
478
|
-
return
|
|
479
|
-
data,
|
|
480
|
-
has_more: data.length === requestedLimit,
|
|
481
|
-
first_id: data.length > 0 ? data[0].id : null,
|
|
482
|
-
last_id: data.length > 0 ? data[data.length - 1].id : null
|
|
483
|
-
});
|
|
493
|
+
return paginatedOk(data, requestedLimit);
|
|
484
494
|
});
|
|
485
495
|
}
|
|
486
496
|
function handleGetSession(request, id) {
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
getFileRecord,
|
|
12
12
|
listFiles,
|
|
13
13
|
updateFileStoragePath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DMMNAQUM.js";
|
|
15
15
|
import {
|
|
16
16
|
assertResourceTenant
|
|
17
17
|
} from "./chunk-23UKWXJH.js";
|
|
18
18
|
import {
|
|
19
19
|
jsonOk,
|
|
20
20
|
routeWrap
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QTXAWC5J.js";
|
|
22
22
|
import {
|
|
23
23
|
getDb,
|
|
24
24
|
init_client
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-W3JMIUHV.js";
|
|
26
26
|
import {
|
|
27
27
|
badRequest,
|
|
28
28
|
notFound
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
forwardToAnthropic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MQBMXAPU.js";
|
|
4
4
|
import {
|
|
5
5
|
isAnthropicApiKey,
|
|
6
6
|
isPassthroughAllowedPath
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
findByRawKey,
|
|
10
10
|
hydratePermissions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-T3FQPTOA.js";
|
|
12
12
|
import {
|
|
13
13
|
getConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-X6QIWZ33.js";
|
|
15
15
|
import {
|
|
16
16
|
unauthorized
|
|
17
17
|
} from "./chunk-EZYKRG4W.js";
|
|
@@ -5,23 +5,25 @@ import {
|
|
|
5
5
|
} from "./chunk-23UKWXJH.js";
|
|
6
6
|
import {
|
|
7
7
|
kickoffEnvironmentSetup
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LQP6XGFU.js";
|
|
9
9
|
import {
|
|
10
|
+
decodeCursor,
|
|
10
11
|
jsonOk,
|
|
12
|
+
paginatedOk,
|
|
11
13
|
routeWrap
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QTXAWC5J.js";
|
|
13
15
|
import {
|
|
14
16
|
forwardToAnthropic
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MQBMXAPU.js";
|
|
16
18
|
import {
|
|
17
19
|
getProxiedTenantId,
|
|
18
20
|
isProxied,
|
|
19
21
|
markProxied,
|
|
20
22
|
unmarkProxied
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5U5LRAFJ.js";
|
|
22
24
|
import {
|
|
23
25
|
resolveContainerProvider
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-UE6DNLSV.js";
|
|
25
27
|
import {
|
|
26
28
|
archiveEnvironment,
|
|
27
29
|
createEnvironment,
|
|
@@ -30,11 +32,11 @@ import {
|
|
|
30
32
|
hasSessionsAttached,
|
|
31
33
|
listEnvironments,
|
|
32
34
|
updateEnvironment
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-H6OT5GUL.js";
|
|
34
36
|
import {
|
|
35
37
|
getDb,
|
|
36
38
|
init_client
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-W3JMIUHV.js";
|
|
38
40
|
import {
|
|
39
41
|
badRequest,
|
|
40
42
|
conflict,
|
|
@@ -155,7 +157,7 @@ function handleListEnvironments(request) {
|
|
|
155
157
|
const limit = url.searchParams.get("limit");
|
|
156
158
|
const order = url.searchParams.get("order");
|
|
157
159
|
const includeArchived = url.searchParams.get("include_archived") === "true";
|
|
158
|
-
const cursor = url.searchParams.get("page")
|
|
160
|
+
const cursor = decodeCursor(url.searchParams.get("page"));
|
|
159
161
|
const requestedLimit = limit ? Number(limit) : 20;
|
|
160
162
|
const data = listEnvironments({
|
|
161
163
|
limit: requestedLimit,
|
|
@@ -164,12 +166,7 @@ function handleListEnvironments(request) {
|
|
|
164
166
|
cursor,
|
|
165
167
|
tenantFilter: tenantFilter(auth)
|
|
166
168
|
});
|
|
167
|
-
return
|
|
168
|
-
data,
|
|
169
|
-
has_more: data.length === requestedLimit,
|
|
170
|
-
first_id: data.length > 0 ? data[0].id : null,
|
|
171
|
-
last_id: data.length > 0 ? data[data.length - 1].id : null
|
|
172
|
-
});
|
|
169
|
+
return paginatedOk(data, requestedLimit);
|
|
173
170
|
});
|
|
174
171
|
}
|
|
175
172
|
function handleGetEnvironment(request, id) {
|