@agentstep/agent-sdk 0.5.1 → 0.5.3
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 +11 -11
- 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 +30 -30
- package/dist/backends/shared/wrap-prompt.js +1 -1
- package/dist/{chunk-4LHJJXH3.js → chunk-23CUQSLR.js} +2 -2
- package/dist/{chunk-57LAR6EM.js → chunk-2FKWZKV2.js} +4 -4
- package/dist/chunk-2YPJLPTR.js +166 -0
- package/dist/{chunk-FYBHPBWY.js → chunk-335F7KSU.js} +2 -2
- package/dist/chunk-3LUY2POB.js +50 -0
- package/dist/{chunk-HMOSAXVZ.js → chunk-4A4F4L4H.js} +2 -2
- package/dist/{chunk-JWHSUEDE.js → chunk-5NCA624D.js} +23 -7
- package/dist/{chunk-7SY65LWY.js → chunk-62CZZBEE.js} +4 -4
- package/dist/{chunk-GD3WXIHX.js → chunk-65XQ72BF.js} +1 -1
- package/dist/{chunk-RT5S5KRX.js → chunk-6DPJVMEC.js} +1 -1
- package/dist/{chunk-NBYCX6L4.js → chunk-6KJS42ZL.js} +7 -6
- package/dist/{chunk-QJ6QQO6D.js → chunk-6KQFP32G.js} +2 -2
- package/dist/{chunk-GIUB2OPA.js → chunk-6TJBZXD4.js} +1 -1
- package/dist/{chunk-UMVZZQKD.js → chunk-6ZM7XNH3.js} +1 -1
- package/dist/{chunk-ZY2U24QP.js → chunk-75XURMV5.js} +51 -12
- 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-T7BHW3CP.js → chunk-7JWW4ZQI.js} +70 -24
- package/dist/{chunk-YZZHDZ7B.js → chunk-7XIAKW75.js} +1 -1
- package/dist/{chunk-USIMPXUH.js → chunk-A2W3USEZ.js} +1 -1
- package/dist/{chunk-WU74DV5R.js → chunk-A7AXD5AM.js} +2 -2
- package/dist/chunk-ACPP4KN7.js +164 -0
- package/dist/{chunk-22OUZJAV.js → chunk-AESA3ARX.js} +3 -3
- package/dist/{chunk-37C5BNVV.js → chunk-AIAF5ZZA.js} +1 -1
- package/dist/{chunk-YYMUSVUI.js → chunk-ANS2TQYT.js} +3 -3
- package/dist/{chunk-T3FQPTOA.js → chunk-BCBDHUFY.js} +2 -2
- package/dist/{chunk-COZG53R3.js → chunk-BCBRLP33.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-R6EXYBCT.js → chunk-C52BVTYC.js} +8 -8
- package/dist/{chunk-DMMNAQUM.js → chunk-C5GVKLNS.js} +10 -18
- package/dist/{chunk-B5EY2VJC.js → chunk-C7BU4RX6.js} +3 -3
- package/dist/{chunk-T3IGOI6Z.js → chunk-DTQ7J35Q.js} +2 -2
- package/dist/{chunk-5M47X54D.js → chunk-DZGFZMUE.js} +5 -5
- package/dist/{chunk-3NKK4M23.js → chunk-E2OYBE5D.js} +2 -2
- package/dist/{chunk-L35CBI7F.js → chunk-E35XHOFL.js} +5 -5
- package/dist/{chunk-CE366H6Z.js → chunk-EHMKMOXH.js} +5 -5
- package/dist/{chunk-3S4CGFKJ.js → chunk-EQ32JFKT.js} +3 -3
- package/dist/{chunk-PZNAQBHQ.js → chunk-FILGQF2G.js} +2 -2
- package/dist/{chunk-MZYJFU4K.js → chunk-FSVDF57K.js} +5 -5
- package/dist/{chunk-XSNJ7NT2.js → chunk-G4DTLYOD.js} +1 -1
- package/dist/{chunk-IEZFRNLC.js → chunk-GBLR2CPP.js} +107 -9
- package/dist/{chunk-C35ZTCBP.js → chunk-IAKR572X.js} +8 -8
- package/dist/{chunk-W3JMIUHV.js → chunk-KQTTKYZY.js} +1 -1
- package/dist/{chunk-LIXSR7BG.js → chunk-LHFEBLOE.js} +7 -7
- package/dist/{chunk-BCIFFAGW.js → chunk-M3752GFZ.js} +15 -5
- package/dist/{chunk-5U5LRAFJ.js → chunk-MTLM36QD.js} +2 -2
- package/dist/{chunk-CKFJN5XK.js → chunk-MV42BTU3.js} +1 -1
- package/dist/{chunk-ZWC5V2DB.js → chunk-NJ6KNTZR.js} +17 -17
- package/dist/{chunk-5MERXOLJ.js → chunk-NRX5WHHN.js} +4 -4
- package/dist/{chunk-2YIMCZJK.js → chunk-NUOCXBFP.js} +68 -20
- package/dist/{chunk-T3HMVHDG.js → chunk-O2X4XBU7.js} +1 -1
- package/dist/{chunk-2YZOIFVN.js → chunk-P4NU74SP.js} +47 -0
- package/dist/{chunk-BJP5BIHE.js → chunk-PGJSOKPH.js} +3 -3
- package/dist/{chunk-IMPLRDOV.js → chunk-Q2JYAAJO.js} +9 -9
- package/dist/{chunk-56XDLNEW.js → chunk-RJDYM2HR.js} +1 -1
- package/dist/{chunk-4MKBT3KA.js → chunk-T6F4TFHD.js} +4 -4
- package/dist/{chunk-74E7GKUG.js → chunk-TE6KCRPP.js} +1 -1
- package/dist/{chunk-VJWNFMMQ.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-6RFQCFL2.js → chunk-UALRSWXY.js} +44 -14
- package/dist/{chunk-GQYSSSVA.js → chunk-UGH5JDXX.js} +2 -2
- package/dist/{chunk-I26QP3A3.js → chunk-UQZFFG7U.js} +1 -1
- package/dist/{chunk-Q4XF3OBK.js → chunk-UYP3VGYB.js} +8 -8
- package/dist/{chunk-ILHIHMO3.js → chunk-VC5DELR4.js} +37 -2
- package/dist/{chunk-O56RNR7B.js → chunk-VMLXV2H6.js} +1 -1
- package/dist/{chunk-FCUXFLNK.js → chunk-VY6IWBSK.js} +17 -4
- package/dist/{chunk-NL4UNA53.js → chunk-VYY4RHIF.js} +2 -2
- package/dist/{chunk-NRXTWATQ.js → chunk-WFRHLTKI.js} +3 -3
- package/dist/{chunk-UMRDMOB6.js → chunk-WRLCJNQF.js} +1 -1
- package/dist/{chunk-DRNZ24RF.js → chunk-WXMEJVLS.js} +4 -4
- package/dist/{chunk-63AKPSCV.js → chunk-X4ARJS6I.js} +10 -10
- package/dist/{chunk-MXMXJYN4.js → chunk-XXGVNVPI.js} +5 -5
- package/dist/{chunk-A46RUKGA.js → chunk-Y4MI27HU.js} +1 -1
- package/dist/{chunk-TG3S4RVJ.js → chunk-Y7NMJ662.js} +2 -2
- package/dist/{chunk-FVBDEOTZ.js → chunk-YE2RMJY7.js} +18 -4
- package/dist/{chunk-EDUTIJAU.js → chunk-YIY47OVD.js} +6 -6
- package/dist/{chunk-HZZ6ZLKP.js → chunk-YL6IQUJC.js} +4 -4
- package/dist/{chunk-WDACZSRU.js → chunk-Z6OPLBPQ.js} +1 -1
- package/dist/{chunk-UQ3LKJPM.js → chunk-ZG3PHDZJ.js} +3 -3
- package/dist/{chunk-2YFS435Z.js → chunk-ZGI6YG2G.js} +42 -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 +44 -42
- package/dist/containers/setup.js +8 -8
- 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 +58 -58
- package/dist/handlers/api_keys.js +59 -59
- package/dist/handlers/audit.js +59 -59
- package/dist/handlers/batch.js +59 -59
- package/dist/handlers/credentials.js +59 -59
- package/dist/handlers/environments.js +59 -59
- package/dist/handlers/events.js +62 -62
- package/dist/handlers/files.js +59 -59
- package/dist/handlers/index.js +158 -143
- package/dist/handlers/license.js +58 -58
- package/dist/handlers/memory.js +65 -59
- package/dist/handlers/metrics.js +58 -58
- package/dist/handlers/models.js +59 -59
- package/dist/handlers/providers.js +58 -58
- package/dist/handlers/resources.js +58 -58
- package/dist/handlers/sessions.js +62 -61
- package/dist/handlers/settings.js +58 -58
- package/dist/handlers/skills-write.js +58 -58
- package/dist/handlers/skills.js +59 -59
- package/dist/handlers/stream.js +58 -58
- package/dist/handlers/tenants.js +59 -59
- package/dist/handlers/threads.js +69 -60
- package/dist/handlers/traces.js +59 -59
- package/dist/handlers/upstream_keys.js +61 -61
- package/dist/handlers/vaults.js +58 -58
- package/dist/handlers/whoami.js +58 -58
- package/dist/http.js +57 -57
- package/dist/index.js +71 -66
- package/dist/init.js +54 -54
- 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 +47 -47
- package/dist/sessions/grader.js +5 -5
- package/dist/sessions/secrets.js +8 -8
- package/dist/sessions/sweeper.js +43 -43
- package/dist/sessions/threads.js +120 -54
- package/dist/shutdown.js +44 -44
- package/dist/sync/anthropic.js +10 -10
- package/dist/sync/container-file-sync.js +24 -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-AQB3P5ZP.js +0 -48
- package/dist/{chunk-JRQB3SHR.js → chunk-LT5PRO54.js} +0 -0
- package/dist/{dist-EY25RQ2S.js → dist-S64ZABZX.js} +3 -3
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runTurn
|
|
3
|
-
} from "./chunk-T7BHW3CP.js";
|
|
4
1
|
import {
|
|
5
2
|
enqueueTurn
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AIAF5ZZA.js";
|
|
4
|
+
import {
|
|
5
|
+
runTurn
|
|
6
|
+
} from "./chunk-7JWW4ZQI.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-335F7KSU.js";
|
|
23
23
|
import {
|
|
24
24
|
runSweep
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YIY47OVD.js";
|
|
26
26
|
import {
|
|
27
27
|
fillWarmPools,
|
|
28
28
|
reconcileDockerOrphanSandboxes,
|
|
29
29
|
reconcileOrphanSandboxes
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-75XURMV5.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,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSession
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TSR33JMZ.js";
|
|
4
4
|
import {
|
|
5
5
|
appendEvent,
|
|
6
6
|
appendEventsBatch,
|
|
7
7
|
listEvents,
|
|
8
8
|
rowToManagedEvent
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7JAUY5SG.js";
|
|
10
10
|
import {
|
|
11
11
|
getAgent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-M3752GFZ.js";
|
|
13
13
|
import {
|
|
14
14
|
getDb,
|
|
15
15
|
init_client
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KQTTKYZY.js";
|
|
17
17
|
|
|
18
18
|
// src/sessions/bus.ts
|
|
19
19
|
import { EventEmitter } from "events";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
reportUpstreamFailure,
|
|
3
3
|
reportUpstreamSuccess,
|
|
4
4
|
resolveAnthropicKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YL6IQUJC.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveRemoteSessionId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AESA3ARX.js";
|
|
9
9
|
import {
|
|
10
10
|
assertResourceTenant
|
|
11
11
|
} from "./chunk-23UKWXJH.js";
|
|
@@ -20,46 +20,46 @@ import {
|
|
|
20
20
|
listMemoryStores,
|
|
21
21
|
searchMemories,
|
|
22
22
|
updateMemory
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GBLR2CPP.js";
|
|
24
24
|
import {
|
|
25
25
|
jsonOk,
|
|
26
26
|
paginatedOk,
|
|
27
27
|
routeWrap
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DTQ7J35Q.js";
|
|
29
29
|
import {
|
|
30
30
|
forwardToAnthropic
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-Y4MI27HU.js";
|
|
32
|
+
import {
|
|
33
|
+
enqueueTurn
|
|
34
|
+
} from "./chunk-AIAF5ZZA.js";
|
|
32
35
|
import {
|
|
33
36
|
runTurn,
|
|
34
37
|
writePermissionResponse
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import {
|
|
37
|
-
enqueueTurn
|
|
38
|
-
} from "./chunk-37C5BNVV.js";
|
|
38
|
+
} from "./chunk-7JWW4ZQI.js";
|
|
39
39
|
import {
|
|
40
40
|
getProxiedTenantId,
|
|
41
41
|
isProxied
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-MTLM36QD.js";
|
|
43
43
|
import {
|
|
44
44
|
getActor
|
|
45
45
|
} from "./chunk-LAWTTG2E.js";
|
|
46
46
|
import {
|
|
47
47
|
appendEvent
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-NRX5WHHN.js";
|
|
49
49
|
import {
|
|
50
50
|
bumpSessionStats,
|
|
51
51
|
getSession,
|
|
52
52
|
getSessionRow,
|
|
53
53
|
setOutcomeCriteria,
|
|
54
54
|
updateSessionMutable
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-TSR33JMZ.js";
|
|
56
56
|
import {
|
|
57
57
|
listEvents,
|
|
58
58
|
rowToManagedEvent
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-7JAUY5SG.js";
|
|
60
60
|
import {
|
|
61
61
|
getAgent
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-M3752GFZ.js";
|
|
63
63
|
import {
|
|
64
64
|
init_clock,
|
|
65
65
|
nowMs
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
import {
|
|
68
68
|
getDb,
|
|
69
69
|
init_client
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-KQTTKYZY.js";
|
|
71
71
|
import {
|
|
72
72
|
badRequest,
|
|
73
73
|
notFound
|
|
@@ -423,7 +423,11 @@ var UserCustomToolResult = z.object({
|
|
|
423
423
|
var UserDefineOutcome = z.object({
|
|
424
424
|
type: z.literal("user.define_outcome"),
|
|
425
425
|
description: z.string().min(1),
|
|
426
|
-
rubric: z.
|
|
426
|
+
rubric: z.union([
|
|
427
|
+
z.string(),
|
|
428
|
+
z.object({ type: z.literal("text"), content: z.string() }),
|
|
429
|
+
z.object({ type: z.literal("file"), file_id: z.string() })
|
|
430
|
+
]).optional(),
|
|
427
431
|
max_iterations: z.number().int().min(1).max(20).optional()
|
|
428
432
|
});
|
|
429
433
|
var UserEvent = z.union([
|
|
@@ -589,16 +593,60 @@ function handlePostEvents(request, sessionId) {
|
|
|
589
593
|
continue;
|
|
590
594
|
}
|
|
591
595
|
if (event.type === "user.define_outcome") {
|
|
592
|
-
const {
|
|
596
|
+
const { newId: genId } = await import("./util/ids.js");
|
|
597
|
+
const outcomeId = genId("outc");
|
|
598
|
+
let rubricText;
|
|
599
|
+
if (typeof event.rubric === "string") {
|
|
600
|
+
rubricText = event.rubric;
|
|
601
|
+
} else if (event.rubric && event.rubric.type === "text") {
|
|
602
|
+
rubricText = event.rubric.content;
|
|
603
|
+
} else if (event.rubric && event.rubric.type === "file") {
|
|
604
|
+
const { getFile: getFileRow } = await import("./db/files.js");
|
|
605
|
+
const { readFile: readStoredFile } = await import("./files/storage.js");
|
|
606
|
+
const fileRow = getFileRow(event.rubric.file_id);
|
|
607
|
+
if (!fileRow) throw badRequest(`Rubric file not found: ${event.rubric.file_id}`);
|
|
608
|
+
rubricText = readStoredFile(fileRow.storage_path).toString("utf-8");
|
|
609
|
+
} else {
|
|
610
|
+
rubricText = "";
|
|
611
|
+
}
|
|
612
|
+
const maxIterations = event.max_iterations ?? 3;
|
|
613
|
+
const processedAt = nowMs();
|
|
614
|
+
const outcomeData = {
|
|
615
|
+
outcome_id: outcomeId,
|
|
616
|
+
description: event.description,
|
|
617
|
+
rubric: rubricText,
|
|
618
|
+
max_iterations: maxIterations,
|
|
619
|
+
grader_iteration: 0,
|
|
620
|
+
status: "running"
|
|
621
|
+
};
|
|
622
|
+
setOutcomeCriteria(sessionId, outcomeData);
|
|
593
623
|
const row = appendEvent(sessionId, {
|
|
594
624
|
type: "user.define_outcome",
|
|
595
|
-
payload:
|
|
625
|
+
payload: {
|
|
626
|
+
outcome_id: outcomeId,
|
|
627
|
+
description: event.description,
|
|
628
|
+
rubric: rubricText,
|
|
629
|
+
max_iterations: maxIterations,
|
|
630
|
+
processed_at: processedAt
|
|
631
|
+
},
|
|
596
632
|
origin: "user",
|
|
597
633
|
idempotencyKey: ik,
|
|
598
|
-
processedAt
|
|
634
|
+
processedAt
|
|
599
635
|
});
|
|
600
636
|
rows.push(row);
|
|
601
|
-
|
|
637
|
+
const descRow = appendEvent(sessionId, {
|
|
638
|
+
type: "user.message",
|
|
639
|
+
payload: { content: [{ type: "text", text: event.description }] },
|
|
640
|
+
origin: "user",
|
|
641
|
+
processedAt: null
|
|
642
|
+
});
|
|
643
|
+
const inp = { kind: "text", eventId: descRow.id, text: event.description };
|
|
644
|
+
const currentStatus = getSessionRow(sessionId)?.status ?? "idle";
|
|
645
|
+
if (currentStatus === "running" || sawInterrupt) {
|
|
646
|
+
pushPendingUserInput({ sessionId, input: inp });
|
|
647
|
+
} else {
|
|
648
|
+
pendingForTurn.push(inp);
|
|
649
|
+
}
|
|
602
650
|
continue;
|
|
603
651
|
}
|
|
604
652
|
}
|
|
@@ -445,6 +445,25 @@ function runMigrations(db) {
|
|
|
445
445
|
UNIQUE(vault_id, display_name)
|
|
446
446
|
)
|
|
447
447
|
`);
|
|
448
|
+
db.exec(`
|
|
449
|
+
CREATE TABLE IF NOT EXISTS memory_versions (
|
|
450
|
+
id TEXT PRIMARY KEY,
|
|
451
|
+
store_id TEXT NOT NULL,
|
|
452
|
+
memory_id TEXT NOT NULL,
|
|
453
|
+
operation TEXT NOT NULL,
|
|
454
|
+
path TEXT NOT NULL,
|
|
455
|
+
content TEXT,
|
|
456
|
+
content_sha256 TEXT,
|
|
457
|
+
session_id TEXT,
|
|
458
|
+
created_at INTEGER NOT NULL
|
|
459
|
+
)
|
|
460
|
+
`);
|
|
461
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_memver_store ON memory_versions(store_id, created_at)`);
|
|
462
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_memver_memory ON memory_versions(memory_id, created_at)`);
|
|
463
|
+
const memStoreColsArchive = db.prepare(`PRAGMA table_info(memory_stores)`).all();
|
|
464
|
+
if (!memStoreColsArchive.some((c) => c.name === "archived_at")) {
|
|
465
|
+
db.exec(`ALTER TABLE memory_stores ADD COLUMN archived_at INTEGER`);
|
|
466
|
+
}
|
|
448
467
|
const credCols = db.prepare(`PRAGMA table_info(vault_credentials)`).all();
|
|
449
468
|
if (!credCols.some((c) => c.name === "expires_at")) {
|
|
450
469
|
db.exec(`ALTER TABLE vault_credentials ADD COLUMN expires_at TEXT`);
|
|
@@ -484,6 +503,34 @@ function runMigrations(db) {
|
|
|
484
503
|
db.exec("UPDATE environments SET updated_at = created_at WHERE updated_at IS NULL");
|
|
485
504
|
}
|
|
486
505
|
}
|
|
506
|
+
db.exec(`
|
|
507
|
+
CREATE TABLE IF NOT EXISTS session_threads (
|
|
508
|
+
id TEXT PRIMARY KEY,
|
|
509
|
+
session_id TEXT NOT NULL,
|
|
510
|
+
agent_id TEXT NOT NULL,
|
|
511
|
+
agent_version INTEGER NOT NULL,
|
|
512
|
+
parent_thread_id TEXT,
|
|
513
|
+
status TEXT NOT NULL DEFAULT 'idle',
|
|
514
|
+
stop_reason TEXT,
|
|
515
|
+
usage_input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
516
|
+
usage_output_tokens INTEGER NOT NULL DEFAULT 0,
|
|
517
|
+
usage_cache_read_input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
518
|
+
usage_cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
519
|
+
created_at INTEGER NOT NULL,
|
|
520
|
+
updated_at INTEGER NOT NULL,
|
|
521
|
+
archived_at INTEGER
|
|
522
|
+
)
|
|
523
|
+
`);
|
|
524
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_session_threads_session ON session_threads(session_id)`);
|
|
525
|
+
const eventColsThread = db.prepare(`PRAGMA table_info(events)`).all();
|
|
526
|
+
if (!eventColsThread.some((c) => c.name === "thread_id")) {
|
|
527
|
+
db.exec(`ALTER TABLE events ADD COLUMN thread_id TEXT`);
|
|
528
|
+
}
|
|
529
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_events_thread ON events(thread_id) WHERE thread_id IS NOT NULL`);
|
|
530
|
+
const avColsMultiagent = db.prepare(`PRAGMA table_info(agent_versions)`).all();
|
|
531
|
+
if (!avColsMultiagent.some((c) => c.name === "multiagent_json")) {
|
|
532
|
+
db.exec(`ALTER TABLE agent_versions ADD COLUMN multiagent_json TEXT`);
|
|
533
|
+
}
|
|
487
534
|
{
|
|
488
535
|
const cols = db.prepare("PRAGMA table_info(vaults)").all();
|
|
489
536
|
const names = new Set(cols.map((c) => c.name));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsonOk,
|
|
3
3
|
routeWrap
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DTQ7J35Q.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveContainerProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LT5PRO54.js";
|
|
8
8
|
import {
|
|
9
9
|
getConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UGH5JDXX.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/providers.ts
|
|
13
13
|
var LOCAL_PROVIDERS = ["docker", "apple-container", "podman"];
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
piBackend
|
|
3
|
-
} from "./chunk-C35ZTCBP.js";
|
|
4
1
|
import {
|
|
5
2
|
opencodeBackend
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X4ARJS6I.js";
|
|
7
4
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
5
|
+
piBackend
|
|
6
|
+
} from "./chunk-IAKR572X.js";
|
|
10
7
|
import {
|
|
11
8
|
geminiBackend
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DZGFZMUE.js";
|
|
10
|
+
import {
|
|
11
|
+
factoryBackend
|
|
12
|
+
} from "./chunk-C52BVTYC.js";
|
|
13
13
|
import {
|
|
14
14
|
codexBackend
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-E35XHOFL.js";
|
|
16
16
|
import {
|
|
17
17
|
claudeBackend
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6KJS42ZL.js";
|
|
19
19
|
|
|
20
20
|
// src/backends/registry.ts
|
|
21
21
|
var BACKENDS = {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
jsonOk,
|
|
8
8
|
paginatedOk,
|
|
9
9
|
routeWrap
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DTQ7J35Q.js";
|
|
11
11
|
import {
|
|
12
12
|
archiveVault,
|
|
13
13
|
createVault,
|
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
listVaults,
|
|
20
20
|
setEntry,
|
|
21
21
|
updateVault
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BYIU4WAQ.js";
|
|
23
23
|
import {
|
|
24
24
|
getAgent
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-M3752GFZ.js";
|
|
26
26
|
import {
|
|
27
27
|
getDb,
|
|
28
28
|
init_client
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KQTTKYZY.js";
|
|
30
30
|
import {
|
|
31
31
|
badRequest,
|
|
32
32
|
conflict,
|
|
@@ -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,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
syncAndCreateSession
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-62CZZBEE.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveRemoteSessionId,
|
|
6
6
|
upsertSync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AESA3ARX.js";
|
|
8
8
|
import {
|
|
9
9
|
assertResourceTenant,
|
|
10
10
|
tenantFilter
|
|
@@ -12,18 +12,21 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
interruptSession
|
|
14
14
|
} from "./chunk-DC2UMEQH.js";
|
|
15
|
+
import {
|
|
16
|
+
getMemoryStore
|
|
17
|
+
} from "./chunk-GBLR2CPP.js";
|
|
15
18
|
import {
|
|
16
19
|
kickoffEnvironmentSetup
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6KQFP32G.js";
|
|
18
21
|
import {
|
|
19
22
|
decodeCursor,
|
|
20
23
|
jsonOk,
|
|
21
24
|
paginatedOk,
|
|
22
25
|
routeWrap
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-DTQ7J35Q.js";
|
|
24
27
|
import {
|
|
25
28
|
forwardToAnthropic
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-Y4MI27HU.js";
|
|
27
30
|
import {
|
|
28
31
|
errors_exports,
|
|
29
32
|
init_errors
|
|
@@ -33,18 +36,18 @@ import {
|
|
|
33
36
|
isProxied,
|
|
34
37
|
markProxied,
|
|
35
38
|
unmarkProxied
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-MTLM36QD.js";
|
|
37
40
|
import {
|
|
38
41
|
dropActor,
|
|
39
42
|
getActor
|
|
40
43
|
} from "./chunk-LAWTTG2E.js";
|
|
41
44
|
import {
|
|
42
45
|
releaseSession
|
|
43
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-75XURMV5.js";
|
|
44
47
|
import {
|
|
45
48
|
appendEvent,
|
|
46
49
|
dropEmitter
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-NRX5WHHN.js";
|
|
48
51
|
import {
|
|
49
52
|
archiveSession,
|
|
50
53
|
createSession,
|
|
@@ -52,13 +55,13 @@ import {
|
|
|
52
55
|
listSessions,
|
|
53
56
|
updateSessionMutable,
|
|
54
57
|
updateSessionStatus
|
|
55
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-TSR33JMZ.js";
|
|
56
59
|
import {
|
|
57
60
|
getEnvironment
|
|
58
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-7APAOJIZ.js";
|
|
59
62
|
import {
|
|
60
63
|
getAgent
|
|
61
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-M3752GFZ.js";
|
|
62
65
|
import {
|
|
63
66
|
init_clock,
|
|
64
67
|
nowMs
|
|
@@ -66,7 +69,7 @@ import {
|
|
|
66
69
|
import {
|
|
67
70
|
getDb,
|
|
68
71
|
init_client
|
|
69
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-KQTTKYZY.js";
|
|
70
73
|
import {
|
|
71
74
|
badRequest,
|
|
72
75
|
notFound
|
|
@@ -115,7 +118,7 @@ var AgentRef = z.union([
|
|
|
115
118
|
z.object({ id: z.string(), version: z.number().int(), type: z.literal("agent").optional() })
|
|
116
119
|
]);
|
|
117
120
|
var ResourceSchema = z.object({
|
|
118
|
-
type: z.enum(["uri", "text", "file", "github_repository"]),
|
|
121
|
+
type: z.enum(["uri", "text", "file", "github_repository", "memory_store"]),
|
|
119
122
|
uri: z.string().optional(),
|
|
120
123
|
content: z.string().optional(),
|
|
121
124
|
file_id: z.string().optional(),
|
|
@@ -131,7 +134,11 @@ var ResourceSchema = z.object({
|
|
|
131
134
|
name: z.string().optional(),
|
|
132
135
|
sha: z.string().optional()
|
|
133
136
|
}).optional(),
|
|
134
|
-
authorization_token: z.string().optional()
|
|
137
|
+
authorization_token: z.string().optional(),
|
|
138
|
+
// Memory store resource fields
|
|
139
|
+
memory_store_id: z.string().optional(),
|
|
140
|
+
access: z.enum(["read_only", "read_write"]).optional(),
|
|
141
|
+
instructions: z.string().optional()
|
|
135
142
|
});
|
|
136
143
|
var CreateSchema = z.object({
|
|
137
144
|
agent: AgentRef,
|
|
@@ -243,6 +250,20 @@ function handleCreateSession(request) {
|
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
}
|
|
253
|
+
if (data.resources?.length) {
|
|
254
|
+
const memStoreResources = data.resources.filter((r) => r.type === "memory_store");
|
|
255
|
+
if (memStoreResources.length > 8) {
|
|
256
|
+
throw badRequest(`max 8 memory_store resources per session (got ${memStoreResources.length})`);
|
|
257
|
+
}
|
|
258
|
+
for (const r of memStoreResources) {
|
|
259
|
+
if (!r.memory_store_id) {
|
|
260
|
+
throw badRequest(`memory_store resource requires memory_store_id`);
|
|
261
|
+
}
|
|
262
|
+
const store = getMemoryStore(r.memory_store_id);
|
|
263
|
+
if (!store) throw notFound(`memory store not found: ${r.memory_store_id}`);
|
|
264
|
+
if (store.archived_at) throw badRequest(`memory store ${r.memory_store_id} is archived`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
246
267
|
if (env.config?.provider === "anthropic") {
|
|
247
268
|
const { resolveAnthropicKey } = await import("./providers/upstream-keys.js");
|
|
248
269
|
const resolved = resolveAnthropicKey({ vaultIds: data.vault_ids ?? void 0 });
|
|
@@ -342,6 +363,15 @@ function handleCreateSession(request) {
|
|
|
342
363
|
if (data.resources?.length) {
|
|
343
364
|
const { createResource } = await import("./db/session-resources.js");
|
|
344
365
|
for (const r of data.resources) {
|
|
366
|
+
if (r.type === "memory_store") {
|
|
367
|
+
createResource(session.id, {
|
|
368
|
+
type: "memory_store",
|
|
369
|
+
memory_store_id: r.memory_store_id,
|
|
370
|
+
access: r.access ?? "read_write",
|
|
371
|
+
instructions: r.instructions
|
|
372
|
+
});
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
345
375
|
let repoUrl = r.type === "github_repository" ? r.repository_url ?? r.url : r.uri;
|
|
346
376
|
if (r.type === "github_repository" && r.authorization_token && repoUrl) {
|
|
347
377
|
try {
|