@agentstep/gateway 0.5.4 → 0.5.5
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/gateway.js +56 -10
- package/package.json +1 -1
package/dist/gateway.js
CHANGED
|
@@ -20052,7 +20052,7 @@ var init_chunk_K2UJFAGD = __esm({
|
|
|
20052
20052
|
}
|
|
20053
20053
|
});
|
|
20054
20054
|
|
|
20055
|
-
// ../agent-sdk/dist/chunk-
|
|
20055
|
+
// ../agent-sdk/dist/chunk-IN3EHQ4Z.js
|
|
20056
20056
|
function extractSessionSummary(sessionId, title, events2) {
|
|
20057
20057
|
const parts = [];
|
|
20058
20058
|
const errors = [];
|
|
@@ -20148,7 +20148,7 @@ Analyze the sessions above and propose memory changes using the update_memories
|
|
|
20148
20148
|
"anthropic-version": "2023-06-01"
|
|
20149
20149
|
},
|
|
20150
20150
|
body: JSON.stringify({
|
|
20151
|
-
model: "claude-sonnet-4-
|
|
20151
|
+
model: opts.model || "claude-sonnet-4-6",
|
|
20152
20152
|
max_tokens: 4096,
|
|
20153
20153
|
system: DREAMING_SYSTEM_PROMPT,
|
|
20154
20154
|
tools: [UPDATE_MEMORIES_TOOL],
|
|
@@ -20186,8 +20186,8 @@ Analyze the sessions above and propose memory changes using the update_memories
|
|
|
20186
20186
|
};
|
|
20187
20187
|
}
|
|
20188
20188
|
var MAX_SESSIONS, MAX_EVENTS_PER_SESSION, RELEVANT_EVENT_TYPES;
|
|
20189
|
-
var
|
|
20190
|
-
"../agent-sdk/dist/chunk-
|
|
20189
|
+
var init_chunk_IN3EHQ4Z = __esm({
|
|
20190
|
+
"../agent-sdk/dist/chunk-IN3EHQ4Z.js"() {
|
|
20191
20191
|
"use strict";
|
|
20192
20192
|
init_chunk_3LUY2POB();
|
|
20193
20193
|
init_chunk_FSQ6I3C7();
|
|
@@ -217399,7 +217399,7 @@ var init_dist2 = __esm({
|
|
|
217399
217399
|
init_chunk_I2WVMCYN();
|
|
217400
217400
|
init_chunk_CBPO2P4I();
|
|
217401
217401
|
init_chunk_7346CKTF();
|
|
217402
|
-
|
|
217402
|
+
init_chunk_IN3EHQ4Z();
|
|
217403
217403
|
init_chunk_3LUY2POB();
|
|
217404
217404
|
init_chunk_FSQ6I3C7();
|
|
217405
217405
|
init_chunk_PVVJCRII();
|
|
@@ -221474,7 +221474,7 @@ var init_chunk_5WY3LSCS = __esm({
|
|
|
221474
221474
|
}
|
|
221475
221475
|
});
|
|
221476
221476
|
|
|
221477
|
-
// ../agent-sdk/dist/chunk-
|
|
221477
|
+
// ../agent-sdk/dist/chunk-JP4HHXHY.js
|
|
221478
221478
|
function assertStoreTenant(auth, storeAgentId) {
|
|
221479
221479
|
if (storeAgentId == null) {
|
|
221480
221480
|
if (!auth.isGlobalAdmin) throw notFound("memory store not found");
|
|
@@ -221641,13 +221641,47 @@ function handleArchiveMemoryStore(request2, storeId) {
|
|
|
221641
221641
|
return jsonOk(store2);
|
|
221642
221642
|
});
|
|
221643
221643
|
}
|
|
221644
|
-
|
|
221645
|
-
|
|
221646
|
-
|
|
221644
|
+
function handleDreamMemoryStore(request2, storeId) {
|
|
221645
|
+
return routeWrap(request2, async ({ auth }) => {
|
|
221646
|
+
loadStoreForCaller(auth, storeId);
|
|
221647
|
+
const body = await request2.json();
|
|
221648
|
+
const parsed = DreamRequestSchema.safeParse(body);
|
|
221649
|
+
if (!parsed.success) throw badRequest(parsed.error.message);
|
|
221650
|
+
const lastDreamed = dreamCooldowns.get(storeId);
|
|
221651
|
+
if (lastDreamed !== void 0 && Date.now() - lastDreamed < DREAM_COOLDOWN_MS) {
|
|
221652
|
+
const retryAfterSec = Math.ceil((DREAM_COOLDOWN_MS - (Date.now() - lastDreamed)) / 1e3);
|
|
221653
|
+
throw tooManyRequests(`dream was triggered recently; retry after ${retryAfterSec}s`);
|
|
221654
|
+
}
|
|
221655
|
+
const apiKey = parsed.data.api_key || getConfig().anthropicApiKey;
|
|
221656
|
+
if (!apiKey) {
|
|
221657
|
+
throw badRequest("No Anthropic API key available. Provide api_key in the request body or set ANTHROPIC_API_KEY.");
|
|
221658
|
+
}
|
|
221659
|
+
const result = await reviewSessions({
|
|
221660
|
+
storeId,
|
|
221661
|
+
lookbackMs: parsed.data.lookback_hours * 36e5,
|
|
221662
|
+
dryRun: parsed.data.dry_run,
|
|
221663
|
+
apiKey,
|
|
221664
|
+
model: parsed.data.model
|
|
221665
|
+
});
|
|
221666
|
+
dreamCooldowns.set(storeId, Date.now());
|
|
221667
|
+
return jsonOk({
|
|
221668
|
+
type: "dream_result",
|
|
221669
|
+
memory_store_id: storeId,
|
|
221670
|
+
session_count: result.sessionCount,
|
|
221671
|
+
proposed_changes: result.proposedChanges,
|
|
221672
|
+
applied: result.applied
|
|
221673
|
+
});
|
|
221674
|
+
});
|
|
221675
|
+
}
|
|
221676
|
+
var CreateStoreSchema, UpdateStoreSchema, CreateMemorySchema, UpdateMemorySchema, DreamRequestSchema, dreamCooldowns, DREAM_COOLDOWN_MS;
|
|
221677
|
+
var init_chunk_JP4HHXHY = __esm({
|
|
221678
|
+
"../agent-sdk/dist/chunk-JP4HHXHY.js"() {
|
|
221647
221679
|
"use strict";
|
|
221648
221680
|
init_chunk_23UKWXJH();
|
|
221681
|
+
init_chunk_IN3EHQ4Z();
|
|
221649
221682
|
init_chunk_FSQ6I3C7();
|
|
221650
221683
|
init_chunk_IYVGGJMH();
|
|
221684
|
+
init_chunk_P2NWS65Y();
|
|
221651
221685
|
init_chunk_W3YXUIPS();
|
|
221652
221686
|
init_chunk_EZYKRG4W();
|
|
221653
221687
|
init_zod();
|
|
@@ -221670,6 +221704,14 @@ var init_chunk_T7NQMCDT = __esm({
|
|
|
221670
221704
|
content: external_exports.string(),
|
|
221671
221705
|
content_sha256: external_exports.string().optional()
|
|
221672
221706
|
});
|
|
221707
|
+
DreamRequestSchema = external_exports.object({
|
|
221708
|
+
lookback_hours: external_exports.number().min(1).max(720).default(24),
|
|
221709
|
+
dry_run: external_exports.boolean().default(false),
|
|
221710
|
+
model: external_exports.string().optional(),
|
|
221711
|
+
api_key: external_exports.string().optional()
|
|
221712
|
+
});
|
|
221713
|
+
dreamCooldowns = /* @__PURE__ */ new Map();
|
|
221714
|
+
DREAM_COOLDOWN_MS = 5 * 60 * 1e3;
|
|
221673
221715
|
}
|
|
221674
221716
|
});
|
|
221675
221717
|
|
|
@@ -223542,6 +223584,7 @@ __export(handlers_exports, {
|
|
|
223542
223584
|
handleDeleteSkillVersion: () => handleDeleteSkillVersion,
|
|
223543
223585
|
handleDeleteUpstreamKey: () => handleDeleteUpstreamKey,
|
|
223544
223586
|
handleDeleteVault: () => handleDeleteVault,
|
|
223587
|
+
handleDreamMemoryStore: () => handleDreamMemoryStore,
|
|
223545
223588
|
handleExportTrace: () => handleExportTrace,
|
|
223546
223589
|
handleGetAgent: () => handleGetAgent,
|
|
223547
223590
|
handleGetApiKey: () => handleGetApiKey,
|
|
@@ -223643,7 +223686,7 @@ var init_handlers3 = __esm({
|
|
|
223643
223686
|
init_chunk_DMROEZYE();
|
|
223644
223687
|
init_chunk_UKCIGI3T();
|
|
223645
223688
|
init_chunk_5WY3LSCS();
|
|
223646
|
-
|
|
223689
|
+
init_chunk_JP4HHXHY();
|
|
223647
223690
|
init_chunk_DYRGMJTC();
|
|
223648
223691
|
init_chunk_R6M4V3IG();
|
|
223649
223692
|
init_chunk_7OM5LP3K();
|
|
@@ -223669,6 +223712,8 @@ var init_handlers3 = __esm({
|
|
|
223669
223712
|
init_chunk_I2WVMCYN();
|
|
223670
223713
|
init_chunk_CBPO2P4I();
|
|
223671
223714
|
init_chunk_7346CKTF();
|
|
223715
|
+
init_chunk_IN3EHQ4Z();
|
|
223716
|
+
init_chunk_3LUY2POB();
|
|
223672
223717
|
init_chunk_FSQ6I3C7();
|
|
223673
223718
|
init_chunk_PVVJCRII();
|
|
223674
223719
|
init_chunk_2N2KL4KM();
|
|
@@ -238266,6 +238311,7 @@ var init_src = __esm({
|
|
|
238266
238311
|
app.post("/v1/memory_stores", (c2) => handleCreateMemoryStore(c2.req.raw));
|
|
238267
238312
|
app.get("/v1/memory_stores", (c2) => handleListMemoryStores(c2.req.raw));
|
|
238268
238313
|
app.post("/v1/memory_stores/:id/archive", (c2) => handleArchiveMemoryStore(c2.req.raw, c2.req.param("id")));
|
|
238314
|
+
app.post("/v1/memory_stores/:id/dream", (c2) => handleDreamMemoryStore(c2.req.raw, c2.req.param("id")));
|
|
238269
238315
|
app.get("/v1/memory_stores/:id/memory_versions", (c2) => handleListMemoryVersions(c2.req.raw, c2.req.param("id")));
|
|
238270
238316
|
app.get("/v1/memory_stores/:id/memory_versions/:vid", (c2) => handleGetMemoryVersion(c2.req.raw, c2.req.param("id"), c2.req.param("vid")));
|
|
238271
238317
|
app.post("/v1/memory_stores/:id/memory_versions/:vid/redact", (c2) => handleRedactMemoryVersion(c2.req.raw, c2.req.param("id"), c2.req.param("vid")));
|
package/package.json
CHANGED