@agentstep/agent-sdk 0.5.0 → 0.5.2
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 +7 -7
- package/dist/backends/claude/index.js +12 -12
- package/dist/backends/claude/wrapper-script.js +1 -1
- package/dist/backends/codex/auth.js +6 -6
- package/dist/backends/codex/index.js +11 -11
- package/dist/backends/factory/auth.js +6 -6
- package/dist/backends/factory/index.js +13 -13
- package/dist/backends/gemini/auth.js +6 -6
- package/dist/backends/gemini/index.js +11 -11
- package/dist/backends/opencode/auth.js +6 -6
- package/dist/backends/opencode/index.js +15 -15
- package/dist/backends/pi/auth.js +6 -6
- package/dist/backends/pi/index.js +13 -13
- package/dist/backends/registry.js +31 -31
- package/dist/backends/shared/wrap-prompt.js +1 -1
- package/dist/chunk-3LUY2POB.js +50 -0
- package/dist/{chunk-3PA4NXRP.js → chunk-3VPTHB7I.js} +2 -2
- package/dist/{chunk-YMCS6AB7.js → chunk-4236UQNZ.js} +2 -2
- package/dist/{chunk-HMOSAXVZ.js → chunk-4A4F4L4H.js} +2 -2
- package/dist/{chunk-JFOHGHW5.js → chunk-4B5H2MFO.js} +59 -16
- package/dist/{chunk-OZFSKR2W.js → chunk-5525T7PL.js} +4 -4
- package/dist/{chunk-AXBM7HAR.js → chunk-5EFY6UGV.js} +1 -1
- package/dist/chunk-5UTTNXNJ.js +166 -0
- package/dist/{chunk-4RDILRIO.js → chunk-5YGYUGDQ.js} +3 -3
- package/dist/{chunk-HWR2HYQJ.js → chunk-6DPJVMEC.js} +1 -1
- package/dist/{chunk-PNZF7HIU.js → chunk-6KJS42ZL.js} +8 -7
- package/dist/{chunk-LQP6XGFU.js → chunk-6KQFP32G.js} +3 -3
- package/dist/{chunk-DMMNAQUM.js → chunk-6L4AGHAV.js} +2 -2
- package/dist/{chunk-WEC625LQ.js → chunk-6TJBZXD4.js} +1 -1
- package/dist/{chunk-QTXAWC5J.js → chunk-6URMGCAC.js} +2 -2
- package/dist/{chunk-DJZSPWG2.js → chunk-6WUYI3DJ.js} +4 -4
- package/dist/{chunk-H6OT5GUL.js → chunk-7APAOJIZ.js} +3 -3
- package/dist/{chunk-HVLYE4S5.js → chunk-7EDLLXFQ.js} +1 -1
- package/dist/chunk-7IYL2O7H.js +185 -0
- package/dist/{chunk-KGBKIJPF.js → chunk-7JAUY5SG.js} +3 -3
- package/dist/{chunk-NDTIDWBE.js → chunk-7XIAKW75.js} +1 -1
- package/dist/{chunk-TUEBRYPZ.js → chunk-A2W3USEZ.js} +1 -1
- package/dist/chunk-ACPP4KN7.js +164 -0
- package/dist/{chunk-22OUZJAV.js → chunk-AESA3ARX.js} +3 -3
- package/dist/{chunk-Z4LFLXRR.js → chunk-AIAF5ZZA.js} +1 -1
- package/dist/{chunk-GIMDS46L.js → chunk-ANS2TQYT.js} +3 -3
- package/dist/{chunk-T3FQPTOA.js → chunk-BCBDHUFY.js} +2 -2
- package/dist/{chunk-MCWCRZM4.js → chunk-BLTCDZ3O.js} +4 -4
- package/dist/{chunk-VP527YC5.js → chunk-BYIU4WAQ.js} +3 -3
- package/dist/{chunk-L26TVIB6.js → chunk-C52BVTYC.js} +8 -8
- package/dist/{chunk-EWIWVXXP.js → chunk-CA76BJWL.js} +44 -14
- package/dist/{chunk-DKLHYSPW.js → chunk-DZGFZMUE.js} +5 -5
- package/dist/{chunk-R3QHLKJG.js → chunk-E35XHOFL.js} +5 -5
- package/dist/{chunk-PZNAQBHQ.js → chunk-FILGQF2G.js} +2 -2
- package/dist/{chunk-JP7Y3TKK.js → chunk-FSVDF57K.js} +5 -5
- package/dist/{chunk-S7DFMJR5.js → chunk-FWJOTEVY.js} +3 -3
- package/dist/{chunk-XSNJ7NT2.js → chunk-G4DTLYOD.js} +1 -1
- package/dist/{chunk-IEZFRNLC.js → chunk-GBLR2CPP.js} +107 -9
- package/dist/{chunk-7SY65LWY.js → chunk-GEC3NFYO.js} +4 -4
- package/dist/{chunk-GLKWJESP.js → chunk-GZZHVIEG.js} +2 -2
- package/dist/{chunk-NHAYKVXG.js → chunk-IAKR572X.js} +8 -8
- package/dist/{chunk-GFSRNOPI.js → chunk-IBUFLAAJ.js} +7 -7
- package/dist/{chunk-OKT2J4ZB.js → chunk-IZ5TUMCF.js} +23 -7
- package/dist/{chunk-W3JMIUHV.js → chunk-KQTTKYZY.js} +1 -1
- package/dist/{chunk-AJL3T5JS.js → chunk-L2DCOJTQ.js} +3 -3
- package/dist/{chunk-JLUCJMAQ.js → chunk-LA6IFUVR.js} +70 -24
- package/dist/{chunk-AB7MPL3H.js → chunk-LW4OCFIP.js} +9 -7
- package/dist/{chunk-BCIFFAGW.js → chunk-M3752GFZ.js} +15 -5
- package/dist/{chunk-5U5LRAFJ.js → chunk-MTLM36QD.js} +2 -2
- package/dist/{chunk-A6VORSKD.js → chunk-MV42BTU3.js} +1 -1
- package/dist/{chunk-5MERXOLJ.js → chunk-NRX5WHHN.js} +4 -4
- package/dist/{chunk-T3HMVHDG.js → chunk-O2X4XBU7.js} +1 -1
- package/dist/{chunk-2YZOIFVN.js → chunk-P4NU74SP.js} +47 -0
- package/dist/{chunk-TVODT2UR.js → chunk-P4OCCRQW.js} +1 -1
- package/dist/{chunk-YXOCKQZU.js → chunk-P4VJADXA.js} +2 -2
- package/dist/{chunk-6QZ23WRF.js → chunk-P6LESAPO.js} +54 -20
- package/dist/{chunk-HY3T4YJV.js → chunk-PICGSLMG.js} +5 -5
- package/dist/{chunk-64IQEPSD.js → chunk-PQKIXSEP.js} +2 -2
- package/dist/{chunk-GV6GUSCP.js → chunk-Q2JYAAJO.js} +9 -9
- package/dist/{chunk-IU457W7Q.js → chunk-QBJOYOVF.js} +2 -1
- package/dist/{chunk-MAJWADF7.js → chunk-RZOCX57A.js} +2 -2
- package/dist/{chunk-4D345E27.js → chunk-SQZPJFBF.js} +2 -2
- package/dist/{chunk-OSNMIPHV.js → chunk-TE6KCRPP.js} +1 -1
- package/dist/{chunk-Z6VZYRVN.js → chunk-TF36SWHG.js} +2 -2
- package/dist/{chunk-KUWJJD6O.js → chunk-TSR33JMZ.js} +14 -5
- package/dist/{chunk-L3IACZ72.js → chunk-TWH4UH6G.js} +1 -1
- package/dist/{chunk-445EL6J5.js → chunk-UAEVL47I.js} +1 -1
- package/dist/{chunk-X6QIWZ33.js → chunk-UGH5JDXX.js} +3 -3
- package/dist/{chunk-FSQ4HGHX.js → chunk-UJW3I3TX.js} +3 -3
- package/dist/{chunk-I26QP3A3.js → chunk-UQZFFG7U.js} +1 -1
- package/dist/{chunk-ILHIHMO3.js → chunk-VC5DELR4.js} +37 -2
- package/dist/{chunk-NKQVOAWN.js → chunk-VMLXV2H6.js} +1 -1
- package/dist/{chunk-FCUXFLNK.js → chunk-VY6IWBSK.js} +17 -4
- package/dist/{chunk-6CVQDSTS.js → chunk-WDAFSCYQ.js} +1 -1
- package/dist/{chunk-GCQDNUS2.js → chunk-WFRHLTKI.js} +3 -3
- package/dist/{chunk-R6EEBWM3.js → chunk-WRLCJNQF.js} +1 -1
- package/dist/{chunk-KKAJC3Z2.js → chunk-X4ARJS6I.js} +10 -10
- package/dist/{chunk-MQBMXAPU.js → chunk-Y4MI27HU.js} +1 -1
- package/dist/{chunk-PN3AWRMX.js → chunk-YDP3YA5D.js} +17 -17
- package/dist/{chunk-FVBDEOTZ.js → chunk-YE2RMJY7.js} +18 -4
- package/dist/{chunk-IRW7AYTP.js → chunk-YEWYRPN4.js} +42 -4
- package/dist/{chunk-24IDJ7LY.js → chunk-YL6IQUJC.js} +4 -4
- package/dist/{chunk-CLSGNQ7J.js → chunk-Z46R47QX.js} +8 -8
- package/dist/{chunk-STJNO6SL.js → chunk-Z6OPLBPQ.js} +1 -1
- package/dist/{chunk-RYJXSXCV.js → chunk-ZEJOFHR7.js} +5 -5
- package/dist/{chunk-EOJ66GY7.js → chunk-ZFGG62JW.js} +4 -4
- package/dist/config/index.js +5 -5
- package/dist/containers/client.js +6 -6
- package/dist/containers/exec.js +6 -6
- package/dist/containers/lifecycle.js +45 -43
- package/dist/containers/setup.js +9 -9
- package/dist/db/agents.js +6 -6
- package/dist/db/api_keys.js +5 -5
- package/dist/db/audit.js +3 -3
- package/dist/db/batch.js +10 -10
- package/dist/db/client.js +2 -2
- package/dist/db/credentials.js +3 -3
- package/dist/db/drizzle.js +4 -4
- package/dist/db/environments.js +6 -6
- package/dist/db/events.js +5 -5
- package/dist/db/files.js +5 -5
- package/dist/db/memory.js +13 -5
- package/dist/db/migrations.js +1 -1
- package/dist/db/proxy.js +5 -5
- package/dist/db/schema.js +5 -1
- package/dist/db/session-resources.js +5 -5
- package/dist/db/sessions.js +8 -8
- package/dist/db/sync.js +5 -5
- package/dist/db/tenants.js +3 -3
- package/dist/db/threads.js +27 -0
- package/dist/db/traces.js +5 -5
- package/dist/db/upstream_keys.js +3 -3
- package/dist/db/vaults.js +6 -6
- package/dist/dreaming/prompts.js +9 -0
- package/dist/dreaming/review.js +22 -0
- package/dist/handlers/agents.js +59 -59
- package/dist/handlers/api_keys.js +60 -60
- package/dist/handlers/audit.js +60 -60
- package/dist/handlers/batch.js +60 -60
- package/dist/handlers/credentials.js +60 -60
- package/dist/handlers/environments.js +60 -60
- package/dist/handlers/events.js +63 -63
- package/dist/handlers/files.js +60 -60
- package/dist/handlers/index.js +159 -144
- package/dist/handlers/license.js +59 -59
- package/dist/handlers/memory.js +66 -60
- package/dist/handlers/metrics.js +59 -59
- package/dist/handlers/models.js +60 -60
- package/dist/handlers/providers.js +59 -59
- package/dist/handlers/resources.js +59 -59
- package/dist/handlers/sessions.js +63 -62
- package/dist/handlers/settings.js +59 -59
- package/dist/handlers/skills-write.js +59 -59
- package/dist/handlers/skills.js +60 -60
- package/dist/handlers/stream.js +59 -59
- package/dist/handlers/tenants.js +60 -60
- package/dist/handlers/threads.js +70 -61
- package/dist/handlers/traces.js +60 -60
- package/dist/handlers/upstream_keys.js +62 -62
- package/dist/handlers/vaults.js +59 -59
- package/dist/handlers/whoami.js +59 -59
- package/dist/http.js +58 -58
- package/dist/index.js +72 -67
- package/dist/init.js +55 -55
- package/dist/lib/model-registry.js +6 -6
- package/dist/lib/skills-cache.js +6 -6
- package/dist/observability/otlp.js +12 -12
- package/dist/observability/redactor.js +8 -8
- package/dist/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 -12
- package/dist/providers/vercel.js +6 -6
- package/dist/proxy/forward.js +6 -6
- package/dist/queue/index.js +6 -6
- package/dist/sessions/bus.js +10 -10
- package/dist/sessions/driver.js +48 -48
- package/dist/sessions/grader.js +5 -5
- package/dist/sessions/secrets.js +8 -8
- package/dist/sessions/sweeper.js +44 -44
- package/dist/sessions/threads.js +121 -55
- package/dist/shutdown.js +45 -45
- package/dist/sync/anthropic.js +10 -10
- package/dist/sync/container-file-sync.js +6 -6
- package/dist/sync/file-sync.js +17 -17
- package/dist/sync/memory-sync.js +79 -0
- package/package.json +1 -1
- package/dist/chunk-XTKTIFHC.js +0 -48
- package/dist/{chunk-UE6DNLSV.js → chunk-LT5PRO54.js} +0 -0
- package/dist/{dist-EY25RQ2S.js → dist-S64ZABZX.js} +3 -3
|
@@ -7,7 +7,8 @@ export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
|
|
|
7
7
|
export NODE_COMPILE_CACHE=/tmp/v8-cache
|
|
8
8
|
mkdir -p /tmp/v8-cache
|
|
9
9
|
# Install claude CLI if not present
|
|
10
|
-
if ! command -v claude >/dev/null 2>&1; then npm install -g @anthropic-ai/claude-code
|
|
10
|
+
if ! command -v claude >/dev/null 2>&1; then npm install -g @anthropic-ai/claude-code; fi
|
|
11
|
+
claude --version >&2 2>/dev/null || true
|
|
11
12
|
# Read env vars from stdin until blank line, save remaining stdin to temp file
|
|
12
13
|
PROMPT_FILE=$(mktemp)
|
|
13
14
|
while IFS= read -r line; do [ -z "$line" ] && break; export "$line"; done
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
getSources,
|
|
5
5
|
getStats,
|
|
6
6
|
searchSkills
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TE6KCRPP.js";
|
|
8
8
|
import {
|
|
9
9
|
jsonOk,
|
|
10
10
|
routeWrap
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6URMGCAC.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/skills.ts
|
|
14
14
|
async function handleGetSkillsCatalog(request) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_session_resources,
|
|
3
3
|
session_resources_exports
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VY6IWBSK.js";
|
|
5
5
|
import {
|
|
6
6
|
getAgent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M3752GFZ.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_TENANT_ID
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UQZFFG7U.js";
|
|
11
11
|
import {
|
|
12
12
|
init_ids,
|
|
13
13
|
newId
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
getDrizzle,
|
|
22
22
|
init_drizzle
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FILGQF2G.js";
|
|
24
24
|
import {
|
|
25
25
|
schema_exports
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VC5DELR4.js";
|
|
27
27
|
import {
|
|
28
28
|
__toCommonJS
|
|
29
29
|
} from "./chunk-2ESYSVXG.js";
|
|
@@ -100,6 +100,15 @@ function hydrateSession(row) {
|
|
|
100
100
|
max_tokens: row.max_tokens ?? null,
|
|
101
101
|
max_wall_duration_ms: row.max_wall_duration_ms ?? null,
|
|
102
102
|
outcome: row.outcome_criteria_json ? JSON.parse(row.outcome_criteria_json) : null,
|
|
103
|
+
outcome_evaluations: row.outcome_criteria_json ? [JSON.parse(row.outcome_criteria_json)].filter((o) => o.outcome_id).map((o) => ({
|
|
104
|
+
type: "outcome_evaluation",
|
|
105
|
+
outcome_id: o.outcome_id,
|
|
106
|
+
description: o.description ?? "",
|
|
107
|
+
result: o.status === "running" ? "running" : o.status,
|
|
108
|
+
iteration: o.grader_iteration ?? 0,
|
|
109
|
+
completed_at: o.completed_at ?? null,
|
|
110
|
+
explanation: o.explanation ?? ""
|
|
111
|
+
})) : [],
|
|
103
112
|
resources,
|
|
104
113
|
vault_ids: row.vault_ids_json ? JSON.parse(row.vault_ids_json) : [],
|
|
105
114
|
parent_session_id: row.parent_session_id ?? null,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getDrizzle,
|
|
7
7
|
init_drizzle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FILGQF2G.js";
|
|
9
9
|
import {
|
|
10
10
|
schema_exports
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VC5DELR4.js";
|
|
12
12
|
|
|
13
13
|
// src/config/index.ts
|
|
14
14
|
init_drizzle();
|
|
@@ -45,7 +45,7 @@ function loadConfig() {
|
|
|
45
45
|
spriteTimeoutMs: num(process.env.SPRITE_TIMEOUT_MS, 3e4),
|
|
46
46
|
concurrency: num(process.env.CONCURRENCY, 4),
|
|
47
47
|
maxSandboxesPerEnv: num(process.env.MAX_SANDBOXES_PER_ENV, 8),
|
|
48
|
-
sessionMaxAgeMs: num(process.env.SESSION_MAX_AGE_MS,
|
|
48
|
+
sessionMaxAgeMs: num(process.env.SESSION_MAX_AGE_MS, 3600 * 1e3),
|
|
49
49
|
sweeperIntervalMs: num(process.env.SWEEPER_INTERVAL_MS, 6e4),
|
|
50
50
|
otlpEndpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.OTLP_ENDPOINT || readSetting("otlp_endpoint") || void 0,
|
|
51
51
|
otlpAuthorization: process.env.OTEL_EXPORTER_OTLP_HEADERS_AUTHORIZATION || process.env.OTLP_AUTHORIZATION || readSetting("otlp_authorization") || void 0,
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
getFileRecord,
|
|
12
12
|
listFiles,
|
|
13
13
|
updateFileStoragePath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6L4AGHAV.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-6URMGCAC.js";
|
|
22
22
|
import {
|
|
23
23
|
getDb,
|
|
24
24
|
init_client
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KQTTKYZY.js";
|
|
26
26
|
import {
|
|
27
27
|
badRequest,
|
|
28
28
|
notFound
|
|
@@ -15,15 +15,17 @@ __export(schema_exports, {
|
|
|
15
15
|
files: () => files,
|
|
16
16
|
memories: () => memories,
|
|
17
17
|
memoryStores: () => memoryStores,
|
|
18
|
+
memoryVersions: () => memoryVersions,
|
|
18
19
|
proxyResources: () => proxyResources,
|
|
19
20
|
sessionResources: () => sessionResources,
|
|
21
|
+
sessionThreads: () => sessionThreads,
|
|
20
22
|
sessions: () => sessions,
|
|
21
23
|
settings: () => settings,
|
|
22
24
|
vaultEntries: () => vaultEntries,
|
|
23
25
|
vaults: () => vaults
|
|
24
26
|
});
|
|
25
27
|
import { sqliteTable, text, integer, real, primaryKey } from "drizzle-orm/sqlite-core";
|
|
26
|
-
var settings, proxyResources, apiKeys, agents, agentVersions, environments, sessions, events, vaults, vaultEntries, memoryStores, memories, files, sessionResources, anthropicSync;
|
|
28
|
+
var settings, proxyResources, apiKeys, agents, agentVersions, environments, sessions, events, sessionThreads, vaults, vaultEntries, memoryStores, memoryVersions, memories, files, sessionResources, anthropicSync;
|
|
27
29
|
var init_schema = __esm({
|
|
28
30
|
"src/db/schema.ts"() {
|
|
29
31
|
settings = sqliteTable("settings", {
|
|
@@ -84,6 +86,8 @@ var init_schema = __esm({
|
|
|
84
86
|
model_config_json: text("model_config_json").notNull().default("{}"),
|
|
85
87
|
// v0.5 ALTER TABLE addition:
|
|
86
88
|
webhook_secret: text("webhook_secret"),
|
|
89
|
+
// Multi-agent orchestration config:
|
|
90
|
+
multiagent_json: text("multiagent_json"),
|
|
87
91
|
created_at: integer("created_at").notNull()
|
|
88
92
|
}, (table) => [
|
|
89
93
|
primaryKey({ columns: [table.agent_id, table.version] })
|
|
@@ -156,7 +160,24 @@ var init_schema = __esm({
|
|
|
156
160
|
idempotency_key: text("idempotency_key"),
|
|
157
161
|
trace_id: text("trace_id"),
|
|
158
162
|
span_id: text("span_id"),
|
|
159
|
-
parent_span_id: text("parent_span_id")
|
|
163
|
+
parent_span_id: text("parent_span_id"),
|
|
164
|
+
thread_id: text("thread_id")
|
|
165
|
+
});
|
|
166
|
+
sessionThreads = sqliteTable("session_threads", {
|
|
167
|
+
id: text("id").primaryKey(),
|
|
168
|
+
session_id: text("session_id").notNull(),
|
|
169
|
+
agent_id: text("agent_id").notNull(),
|
|
170
|
+
agent_version: integer("agent_version").notNull(),
|
|
171
|
+
parent_thread_id: text("parent_thread_id"),
|
|
172
|
+
status: text("status").notNull().default("idle"),
|
|
173
|
+
stop_reason: text("stop_reason"),
|
|
174
|
+
usage_input_tokens: integer("usage_input_tokens").notNull().default(0),
|
|
175
|
+
usage_output_tokens: integer("usage_output_tokens").notNull().default(0),
|
|
176
|
+
usage_cache_read_input_tokens: integer("usage_cache_read_input_tokens").notNull().default(0),
|
|
177
|
+
usage_cache_creation_input_tokens: integer("usage_cache_creation_input_tokens").notNull().default(0),
|
|
178
|
+
created_at: integer("created_at").notNull(),
|
|
179
|
+
updated_at: integer("updated_at").notNull(),
|
|
180
|
+
archived_at: integer("archived_at")
|
|
160
181
|
});
|
|
161
182
|
vaults = sqliteTable("vaults", {
|
|
162
183
|
id: text("id").primaryKey(),
|
|
@@ -183,9 +204,21 @@ var init_schema = __esm({
|
|
|
183
204
|
description: text("description"),
|
|
184
205
|
agent_id: text("agent_id"),
|
|
185
206
|
metadata_json: text("metadata_json").notNull().default("{}"),
|
|
207
|
+
archived_at: integer("archived_at"),
|
|
186
208
|
created_at: integer("created_at").notNull(),
|
|
187
209
|
updated_at: integer("updated_at").notNull()
|
|
188
210
|
});
|
|
211
|
+
memoryVersions = sqliteTable("memory_versions", {
|
|
212
|
+
id: text("id").primaryKey(),
|
|
213
|
+
store_id: text("store_id").notNull(),
|
|
214
|
+
memory_id: text("memory_id").notNull(),
|
|
215
|
+
operation: text("operation").notNull(),
|
|
216
|
+
path: text("path").notNull(),
|
|
217
|
+
content: text("content"),
|
|
218
|
+
content_sha256: text("content_sha256"),
|
|
219
|
+
session_id: text("session_id"),
|
|
220
|
+
created_at: integer("created_at").notNull()
|
|
221
|
+
});
|
|
189
222
|
memories = sqliteTable("memories", {
|
|
190
223
|
id: text("id").primaryKey(),
|
|
191
224
|
store_id: text("store_id").notNull(),
|
|
@@ -242,9 +275,11 @@ export {
|
|
|
242
275
|
environments,
|
|
243
276
|
sessions,
|
|
244
277
|
events,
|
|
278
|
+
sessionThreads,
|
|
245
279
|
vaults,
|
|
246
280
|
vaultEntries,
|
|
247
281
|
memoryStores,
|
|
282
|
+
memoryVersions,
|
|
248
283
|
memories,
|
|
249
284
|
files,
|
|
250
285
|
sessionResources,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
getDrizzle,
|
|
12
12
|
init_drizzle
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FILGQF2G.js";
|
|
14
14
|
import {
|
|
15
15
|
schema_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VC5DELR4.js";
|
|
17
17
|
import {
|
|
18
18
|
__esm,
|
|
19
19
|
__export
|
|
@@ -42,7 +42,14 @@ function hydrate(row) {
|
|
|
42
42
|
if (row.url) record.url = row.url;
|
|
43
43
|
if (row.checkout_json) {
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
const parsed = JSON.parse(row.checkout_json);
|
|
46
|
+
if (row.type === "memory_store") {
|
|
47
|
+
record.memory_store_id = parsed.memory_store_id;
|
|
48
|
+
record.access = parsed.access;
|
|
49
|
+
record.instructions = parsed.instructions;
|
|
50
|
+
} else {
|
|
51
|
+
record.checkout = parsed;
|
|
52
|
+
}
|
|
46
53
|
} catch {
|
|
47
54
|
}
|
|
48
55
|
}
|
|
@@ -53,7 +60,13 @@ function createResource(sessionId, input) {
|
|
|
53
60
|
const id = newId("sesrsc");
|
|
54
61
|
const now = nowMs();
|
|
55
62
|
let checkoutJson = null;
|
|
56
|
-
if (input.
|
|
63
|
+
if (input.type === "memory_store") {
|
|
64
|
+
checkoutJson = JSON.stringify({
|
|
65
|
+
memory_store_id: input.memory_store_id,
|
|
66
|
+
access: input.access ?? "read_write",
|
|
67
|
+
instructions: input.instructions
|
|
68
|
+
});
|
|
69
|
+
} else if (input.checkout) {
|
|
57
70
|
checkoutJson = JSON.stringify(input.checkout);
|
|
58
71
|
} else if (input.branch) {
|
|
59
72
|
checkoutJson = JSON.stringify({ type: "branch", name: input.branch });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
forwardToAnthropic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y4MI27HU.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-BCBDHUFY.js";
|
|
12
12
|
import {
|
|
13
13
|
getConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UGH5JDXX.js";
|
|
15
15
|
import {
|
|
16
16
|
unauthorized
|
|
17
17
|
} from "./chunk-EZYKRG4W.js";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildOpencodeArgs
|
|
3
|
-
} from "./chunk-P56WU3UT.js";
|
|
4
|
-
import {
|
|
5
|
-
buildOpencodeAuthEnv,
|
|
6
|
-
validateOpencodeRuntime
|
|
7
|
-
} from "./chunk-R6EEBWM3.js";
|
|
8
1
|
import {
|
|
9
2
|
buildOpencodeConfigEnv
|
|
10
3
|
} from "./chunk-V5DH3OAC.js";
|
|
11
4
|
import {
|
|
12
5
|
prepareOpencodeOnSandbox
|
|
13
6
|
} from "./chunk-P7P2NWZD.js";
|
|
7
|
+
import {
|
|
8
|
+
createOpencodeTranslator
|
|
9
|
+
} from "./chunk-ETWGCBIQ.js";
|
|
14
10
|
import {
|
|
15
11
|
OPENCODE_WRAPPER_PATH
|
|
16
12
|
} from "./chunk-SWIP7JBQ.js";
|
|
17
13
|
import {
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
14
|
+
buildOpencodeArgs
|
|
15
|
+
} from "./chunk-P56WU3UT.js";
|
|
16
|
+
import {
|
|
17
|
+
buildOpencodeAuthEnv,
|
|
18
|
+
validateOpencodeRuntime
|
|
19
|
+
} from "./chunk-WRLCJNQF.js";
|
|
20
20
|
import {
|
|
21
21
|
wrapPromptWithSystem
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YE2RMJY7.js";
|
|
23
23
|
import {
|
|
24
24
|
ApiError
|
|
25
25
|
} from "./chunk-EZYKRG4W.js";
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runTurn
|
|
3
|
-
} from "./chunk-JLUCJMAQ.js";
|
|
4
1
|
import {
|
|
5
2
|
enqueueTurn
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AIAF5ZZA.js";
|
|
4
|
+
import {
|
|
5
|
+
runTurn
|
|
6
|
+
} from "./chunk-LA6IFUVR.js";
|
|
7
7
|
import {
|
|
8
8
|
installOtlpExporter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FSVDF57K.js";
|
|
10
10
|
import {
|
|
11
11
|
redactAppendInput
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TF36SWHG.js";
|
|
13
13
|
import {
|
|
14
14
|
createApiKey,
|
|
15
15
|
listApiKeys
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BCBDHUFY.js";
|
|
17
17
|
import {
|
|
18
18
|
initSentry
|
|
19
19
|
} from "./chunk-3MQ2FWXS.js";
|
|
20
20
|
import {
|
|
21
21
|
installShutdownHandlers
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PQKIXSEP.js";
|
|
23
23
|
import {
|
|
24
24
|
runSweep
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LW4OCFIP.js";
|
|
26
26
|
import {
|
|
27
27
|
fillWarmPools,
|
|
28
28
|
reconcileDockerOrphanSandboxes,
|
|
29
29
|
reconcileOrphanSandboxes
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4B5H2MFO.js";
|
|
31
31
|
import {
|
|
32
32
|
appendEvent,
|
|
33
33
|
installPayloadRedactor
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NRX5WHHN.js";
|
|
35
35
|
import {
|
|
36
36
|
setSessionSandbox
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TSR33JMZ.js";
|
|
38
38
|
import {
|
|
39
39
|
readEnvValue,
|
|
40
40
|
upsertEnvLine
|
|
41
41
|
} from "./chunk-YPXI7Q2M.js";
|
|
42
42
|
import {
|
|
43
43
|
getLastUnprocessedUserMessage
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7JAUY5SG.js";
|
|
45
45
|
import {
|
|
46
46
|
getBySession,
|
|
47
47
|
register
|
|
48
48
|
} from "./chunk-EFOIR7R3.js";
|
|
49
49
|
import {
|
|
50
50
|
resolveContainerProvider
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-LT5PRO54.js";
|
|
52
52
|
import {
|
|
53
53
|
getEnvironment
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-7APAOJIZ.js";
|
|
55
55
|
import {
|
|
56
56
|
getConfig
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-UGH5JDXX.js";
|
|
58
58
|
import {
|
|
59
59
|
init_clock,
|
|
60
60
|
nowMs
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
import {
|
|
63
63
|
getDb,
|
|
64
64
|
init_client
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-KQTTKYZY.js";
|
|
66
66
|
import {
|
|
67
67
|
getRuntime
|
|
68
68
|
} from "./chunk-UYTSKFGK.js";
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
// src/backends/shared/wrap-prompt.ts
|
|
2
2
|
var GATEWAY_PREAMBLE = "You are running inside an AgentStep sandboxed container. Execute tools directly \u2014 never announce what you will do before doing it. All tools are already available; do not search for or discover tools. If custom tools are defined, use them by name immediately.";
|
|
3
|
-
function withGatewayPreamble(system) {
|
|
4
|
-
|
|
3
|
+
function withGatewayPreamble(system, memoryStores) {
|
|
4
|
+
let preamble = system ? `${system}
|
|
5
5
|
|
|
6
6
|
${GATEWAY_PREAMBLE}` : GATEWAY_PREAMBLE;
|
|
7
|
+
if (memoryStores && memoryStores.length > 0) {
|
|
8
|
+
const lines = memoryStores.map((s) => {
|
|
9
|
+
const parts = [];
|
|
10
|
+
parts.push(`- /mnt/memory/${s.name.replace(/[^a-zA-Z0-9_.-]/g, "_")}/ (${s.access})`);
|
|
11
|
+
if (s.description) parts[0] += ` \u2014 ${s.description}`;
|
|
12
|
+
if (s.instructions) parts[0] += `. ${s.instructions}`;
|
|
13
|
+
return parts[0];
|
|
14
|
+
});
|
|
15
|
+
preamble += `
|
|
16
|
+
|
|
17
|
+
Memory stores are mounted at /mnt/memory/:
|
|
18
|
+
${lines.join("\n")}`;
|
|
19
|
+
}
|
|
20
|
+
return preamble;
|
|
7
21
|
}
|
|
8
|
-
function wrapPromptWithSystem(prompt, systemPrompt, skills) {
|
|
9
|
-
let systemBlock = withGatewayPreamble(systemPrompt);
|
|
22
|
+
function wrapPromptWithSystem(prompt, systemPrompt, skills, memoryStores) {
|
|
23
|
+
let systemBlock = withGatewayPreamble(systemPrompt, memoryStores);
|
|
10
24
|
if (skills && skills.length > 0) {
|
|
11
25
|
const skillsText = skills.map(
|
|
12
26
|
(s) => `<skill name="${s.name}">
|
|
@@ -3,25 +3,28 @@ import {
|
|
|
3
3
|
tenantFilter
|
|
4
4
|
} from "./chunk-23UKWXJH.js";
|
|
5
5
|
import {
|
|
6
|
+
archiveMemoryStore,
|
|
6
7
|
createMemoryStore,
|
|
7
8
|
createOrUpsertMemory,
|
|
8
9
|
deleteMemory,
|
|
9
10
|
deleteMemoryStore,
|
|
10
11
|
getMemory,
|
|
11
12
|
getMemoryStore,
|
|
13
|
+
getMemoryVersion,
|
|
12
14
|
listMemories,
|
|
13
15
|
listMemoryStores,
|
|
16
|
+
listMemoryVersions,
|
|
14
17
|
updateMemory
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GBLR2CPP.js";
|
|
16
19
|
import {
|
|
17
20
|
jsonOk,
|
|
18
21
|
paginatedOk,
|
|
19
22
|
routeWrap
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6URMGCAC.js";
|
|
21
24
|
import {
|
|
22
25
|
getDb,
|
|
23
26
|
init_client
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KQTTKYZY.js";
|
|
25
28
|
import {
|
|
26
29
|
badRequest,
|
|
27
30
|
conflict,
|
|
@@ -156,6 +159,38 @@ function handleDeleteMemory(request, storeId, memId) {
|
|
|
156
159
|
return jsonOk({ id: memId, type: "memory_deleted" });
|
|
157
160
|
});
|
|
158
161
|
}
|
|
162
|
+
function handleListMemoryVersions(request, storeId) {
|
|
163
|
+
return routeWrap(request, async ({ auth, request: req }) => {
|
|
164
|
+
loadStoreForCaller(auth, storeId);
|
|
165
|
+
const url = new URL(req.url);
|
|
166
|
+
const memoryId = url.searchParams.get("memory_id") ?? void 0;
|
|
167
|
+
const requestedLimit = Number(url.searchParams.get("limit") || "100");
|
|
168
|
+
const cursor = url.searchParams.get("cursor") ?? void 0;
|
|
169
|
+
const data = listMemoryVersions(storeId, {
|
|
170
|
+
memoryId,
|
|
171
|
+
limit: requestedLimit,
|
|
172
|
+
cursor
|
|
173
|
+
});
|
|
174
|
+
return paginatedOk(data, requestedLimit);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function handleGetMemoryVersion(request, storeId, versionId) {
|
|
178
|
+
return routeWrap(request, async ({ auth }) => {
|
|
179
|
+
loadStoreForCaller(auth, storeId);
|
|
180
|
+
const version = getMemoryVersion(storeId, versionId);
|
|
181
|
+
if (!version) throw notFound(`memory version not found: ${versionId}`);
|
|
182
|
+
return jsonOk(version);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function handleArchiveMemoryStore(request, storeId) {
|
|
186
|
+
return routeWrap(request, async ({ auth }) => {
|
|
187
|
+
loadStoreForCaller(auth, storeId);
|
|
188
|
+
const archived = archiveMemoryStore(storeId);
|
|
189
|
+
if (!archived) throw notFound(`memory store not found: ${storeId}`);
|
|
190
|
+
const store = getMemoryStore(storeId);
|
|
191
|
+
return jsonOk(store);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
159
194
|
|
|
160
195
|
export {
|
|
161
196
|
handleCreateMemoryStore,
|
|
@@ -166,5 +201,8 @@ export {
|
|
|
166
201
|
handleListMemories,
|
|
167
202
|
handleGetMemory,
|
|
168
203
|
handleUpdateMemory,
|
|
169
|
-
handleDeleteMemory
|
|
204
|
+
handleDeleteMemory,
|
|
205
|
+
handleListMemoryVersions,
|
|
206
|
+
handleGetMemoryVersion,
|
|
207
|
+
handleArchiveMemoryStore
|
|
170
208
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disableUpstreamKey,
|
|
3
3
|
selectNextUpstreamKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UAEVL47I.js";
|
|
5
5
|
import {
|
|
6
6
|
listEntries
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BYIU4WAQ.js";
|
|
8
8
|
import {
|
|
9
9
|
getSession
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TSR33JMZ.js";
|
|
11
11
|
import {
|
|
12
12
|
getConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UGH5JDXX.js";
|
|
14
14
|
|
|
15
15
|
// src/providers/upstream-keys.ts
|
|
16
16
|
var CONSECUTIVE_FAIL_THRESHOLD = 3;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRemoteSessionId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AESA3ARX.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-WFRHLTKI.js";
|
|
10
10
|
import {
|
|
11
11
|
forwardToAnthropic
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y4MI27HU.js";
|
|
13
13
|
import {
|
|
14
14
|
ensureInitialized
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YDP3YA5D.js";
|
|
16
16
|
import {
|
|
17
17
|
getProxiedTenantId,
|
|
18
18
|
isProxied
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MTLM36QD.js";
|
|
20
20
|
import {
|
|
21
21
|
subscribe
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NRX5WHHN.js";
|
|
23
23
|
import {
|
|
24
24
|
getSession
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TSR33JMZ.js";
|
|
26
26
|
import {
|
|
27
27
|
getDb,
|
|
28
28
|
init_client
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KQTTKYZY.js";
|
|
30
30
|
import {
|
|
31
31
|
notFound,
|
|
32
32
|
toResponse
|