@cursor/july 0.1.47 → 0.1.49
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/bin/agent-serve.js +30 -35
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +5 -5
- package/dist/docs/assets/{ab.md.hdxsvX5M.js → ab.md.DYjwREAP.js} +2 -2
- package/dist/docs/assets/{ab.md.hdxsvX5M.lean.js → ab.md.DYjwREAP.lean.js} +1 -1
- package/dist/docs/assets/{app.IEXEim5m.js → app.BpWAgjaR.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.D00d772K.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.78s6nqsH.js → VPLocalSearchBox.CnAktZtG.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DroGdz_Q.js → theme.B5IvUxOB.js} +2 -2
- package/dist/docs/assets/{evals.md.qeoGgPw0.js → evals.md.CVe_O75-.js} +3 -3
- package/dist/docs/assets/{evals.md.qeoGgPw0.lean.js → evals.md.CVe_O75-.lean.js} +1 -1
- package/dist/docs/assets/{reference_http-api.md.DGrw_wOu.js → reference_http-api.md.DMbdFGVQ.js} +1 -1
- package/dist/docs/assets/{storage.md.CJYd5YmN.js → storage.md.D8NQ389l.js} +3 -3
- package/dist/docs/assets/storage.md.D8NQ389l.lean.js +1 -0
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +3 -3
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +6 -6
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +3 -3
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +3 -3
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +3 -3
- package/dist/docs/guides/opentelemetry.html +3 -3
- package/dist/docs/guides/slack.html +3 -3
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +3 -3
- package/dist/docs/reference/artifacts.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +3 -3
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +5 -5
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +3 -3
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +3 -3
- package/dist/docs/reference/skills.html +3 -3
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +3 -3
- package/dist/docs/scaffolding-agents.html +3 -3
- package/dist/docs/storage.html +5 -5
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +3 -3
- package/dist/internal/authored-loaders.d.ts +19 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -1
- package/dist/internal/authored-loaders.js +39 -0
- package/dist/internal/cli-deploy.d.ts +2 -1
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +97 -1
- package/dist/internal/cli-slack.js +0 -3
- package/dist/internal/deploy-client.d.ts +7 -2
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +12 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +2 -8
- package/dist/internal/eval-runner.d.ts.map +1 -1
- package/dist/internal/eval-runner.js +3 -8
- package/dist/internal/event-log.d.ts +17 -0
- package/dist/internal/event-log.d.ts.map +1 -1
- package/dist/internal/event-log.js +32 -2
- package/dist/internal/logs-client.d.ts +1 -1
- package/dist/internal/logs-client.d.ts.map +1 -1
- package/dist/internal/logs-client.js +3 -0
- package/dist/internal/process-memory-telemetry.d.ts +90 -0
- package/dist/internal/process-memory-telemetry.d.ts.map +1 -0
- package/dist/internal/process-memory-telemetry.js +259 -0
- package/dist/internal/serve-restart.d.ts +42 -0
- package/dist/internal/serve-restart.d.ts.map +1 -0
- package/dist/internal/serve-restart.js +85 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +9 -10
- package/dist/internal/session-engine.d.ts +4 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +19 -5
- package/dist/internal/slack-provision-client.d.ts +4 -4
- package/dist/internal/slack-provision-client.js +7 -7
- package/dist/playground/assets/index-Dox74yWJ.css +1 -0
- package/dist/playground/assets/{index-BgUHfe3L.js → index-Dq_HqyU-.js} +46 -46
- package/dist/playground/index.html +2 -2
- package/dist/storage.d.ts +36 -10
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +82 -6
- package/docs/ab.md +4 -3
- package/docs/evals.md +10 -7
- package/docs/reference/http-api.md +4 -3
- package/docs/storage.md +38 -22
- package/package.json +1 -1
- package/skills/setup-slack/SKILL.md +1 -1
- package/src/bin/agent-serve.ts +39 -38
- package/src/internal/authored-loaders.ts +45 -0
- package/src/internal/cli-deploy.ts +103 -1
- package/src/internal/cli-slack.ts +0 -5
- package/src/internal/deploy-client.ts +19 -1
- package/src/internal/discovery.ts +5 -12
- package/src/internal/eval-runner.ts +3 -12
- package/src/internal/event-log.ts +45 -7
- package/src/internal/logs-client.ts +4 -0
- package/src/internal/process-memory-telemetry.ts +373 -0
- package/src/internal/serve-restart.ts +120 -0
- package/src/internal/server.ts +13 -0
- package/src/internal/session-engine.ts +20 -1
- package/src/internal/slack-provision-client.ts +7 -7
- package/src/storage.ts +130 -11
- package/dist/docs/assets/chunks/@localSearchIndexroot.D7w61u6Y.js +0 -1
- package/dist/docs/assets/storage.md.CJYd5YmN.lean.js +0 -1
- package/dist/playground/assets/index-uFaeqVZS.css +0 -1
- /package/dist/docs/assets/{reference_http-api.md.DGrw_wOu.lean.js → reference_http-api.md.DMbdFGVQ.lean.js} +0 -0
package/src/storage.ts
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* The sink is a plain key-value store — put/get/delete/list, no schema —
|
|
10
10
|
* plus a conditional-write group ({@link StorageConfig.cas}, the substrate
|
|
11
11
|
* for framework coordination; optional for plain storage, required by
|
|
12
|
-
* coordination features)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* coordination features). Implementing that small KV core is enough for
|
|
13
|
+
* FULL functionality: eval-run and A/B history are derived over the core
|
|
14
|
+
* when the optional dedicated tables ({@link StorageConfig.evals} and
|
|
15
|
+
* {@link StorageConfig.abs}) are not authored — those groups exist as
|
|
16
|
+
* backend-native optimizations (a real table, an analytics pipeline),
|
|
17
|
+
* not as required-or-lose-history hooks:
|
|
15
18
|
*
|
|
16
19
|
* ```ts
|
|
17
20
|
* import { defineStorage } from "@anysphere/agent-serve/storage";
|
|
@@ -207,13 +210,20 @@ export interface StorageConfig {
|
|
|
207
210
|
/** Timing knobs; see {@link StoragePolicy}. */
|
|
208
211
|
policy?: StoragePolicy;
|
|
209
212
|
/**
|
|
210
|
-
* Dedicated eval-runs table
|
|
211
|
-
*
|
|
213
|
+
* Dedicated eval-runs table — a backend-native optimization, not a
|
|
214
|
+
* requirement. When omitted, `defineStorage` derives the table over the
|
|
215
|
+
* KV core (one key per run under `agentkit/v1/{agent}/eval-runs/`),
|
|
216
|
+
* which needs core `put`, `delete`, and `list`; only when the core
|
|
217
|
+
* lacks `delete` or `list` does playground eval history stay in process
|
|
218
|
+
* memory (lost on restart).
|
|
212
219
|
*/
|
|
213
220
|
evals?: StorageEvalsTable;
|
|
214
221
|
/**
|
|
215
|
-
* Dedicated A/B table
|
|
216
|
-
*
|
|
222
|
+
* Dedicated A/B table — a backend-native optimization, not a
|
|
223
|
+
* requirement. When omitted, `defineStorage` derives it over the KV
|
|
224
|
+
* core: `putSample` and `putSnapshot` need only core `put` (always
|
|
225
|
+
* present), `getSnapshot` additionally needs core `get`. Session event
|
|
226
|
+
* logs remain the assignment/fold source of truth either way.
|
|
217
227
|
*/
|
|
218
228
|
abs?: StorageABTable;
|
|
219
229
|
/**
|
|
@@ -249,7 +259,8 @@ export interface StorageConfig {
|
|
|
249
259
|
/**
|
|
250
260
|
* All entries under a key prefix, in ascending key order. Optional —
|
|
251
261
|
* required for the **startup bulk restore** (sessions + event streams)
|
|
252
|
-
* and
|
|
262
|
+
* and, together with `delete`, for the derived eval-runs table
|
|
263
|
+
* (playground eval history).
|
|
253
264
|
*/
|
|
254
265
|
list?(
|
|
255
266
|
prefix: string,
|
|
@@ -326,7 +337,91 @@ export function defineStorage(config: StorageConfig): StorageDefinition {
|
|
|
326
337
|
}
|
|
327
338
|
// Validate eagerly so a bad policy fails at discovery, not first flush.
|
|
328
339
|
resolveStoragePolicy(config.policy);
|
|
329
|
-
|
|
340
|
+
// A backend that implements only the KV core gets full functionality:
|
|
341
|
+
// the dedicated tables are backend-native optimizations, derived over
|
|
342
|
+
// the core when absent. Authored groups always win.
|
|
343
|
+
const derivedEvals =
|
|
344
|
+
config.evals === undefined ? deriveEvalsTable(config) : undefined;
|
|
345
|
+
const derivedAbs =
|
|
346
|
+
config.abs === undefined ? deriveAbsTable(config) : undefined;
|
|
347
|
+
return brandDefinition("storage", {
|
|
348
|
+
...config,
|
|
349
|
+
...(derivedEvals === undefined ? {} : { evals: derivedEvals }),
|
|
350
|
+
...(derivedAbs === undefined ? {} : { abs: derivedAbs }),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Eval-runs table over the KV core: one key per run under
|
|
356
|
+
* {@link storageKeys.evalRun}, hydrate via prefix `list`, prune via
|
|
357
|
+
* `delete`. Requires core `put` + `delete` + `list`; without `delete` or
|
|
358
|
+
* `list` there is no derivation (pruning or hydration would silently not
|
|
359
|
+
* work) and eval history stays in process memory.
|
|
360
|
+
*/
|
|
361
|
+
function deriveEvalsTable(
|
|
362
|
+
config: StorageConfig
|
|
363
|
+
): StorageEvalsTable | undefined {
|
|
364
|
+
if (config.delete === undefined || config.list === undefined) {
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
put: (run, ctx) =>
|
|
369
|
+
config.put(
|
|
370
|
+
storageKeys.evalRun(ctx.agentName, run.runId),
|
|
371
|
+
run as unknown as JsonValue,
|
|
372
|
+
ctx
|
|
373
|
+
),
|
|
374
|
+
delete: (runId, ctx) =>
|
|
375
|
+
config.delete?.(storageKeys.evalRun(ctx.agentName, runId), ctx),
|
|
376
|
+
list: async (ctx) => {
|
|
377
|
+
const entries =
|
|
378
|
+
(await config.list?.(storageKeys.evalRunsPrefix(ctx.agentName), ctx)) ??
|
|
379
|
+
[];
|
|
380
|
+
return entries.map((entry) => entry.value as unknown as EvalRunSnapshot);
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* A/B table over the KV core. Each sample lands as its own key (identity
|
|
387
|
+
* = experiment + sessionId + at, matching the dedicated table's row
|
|
388
|
+
* uniqueness): appending to one array value would need read-modify-write
|
|
389
|
+
* — lost updates under concurrent writers without CAS, and unbounded
|
|
390
|
+
* value growth — while a key per sample keeps `putSample` a blind put
|
|
391
|
+
* with real append-only semantics. The aggregate snapshot lives at one
|
|
392
|
+
* fixed key via plain `put` (last-write-wins is correct for "latest").
|
|
393
|
+
* Requires only core `put`; `getSnapshot` is included when core `get`
|
|
394
|
+
* exists.
|
|
395
|
+
*/
|
|
396
|
+
function deriveAbsTable(config: StorageConfig): StorageABTable {
|
|
397
|
+
const get = config.get;
|
|
398
|
+
return {
|
|
399
|
+
putSample: (sample, ctx) =>
|
|
400
|
+
config.put(
|
|
401
|
+
storageKeys.abSample(
|
|
402
|
+
ctx.agentName,
|
|
403
|
+
sample.experiment,
|
|
404
|
+
sample.sessionId,
|
|
405
|
+
sample.at
|
|
406
|
+
),
|
|
407
|
+
sample as unknown as JsonValue,
|
|
408
|
+
ctx
|
|
409
|
+
),
|
|
410
|
+
putSnapshot: (snapshot, ctx) =>
|
|
411
|
+
config.put(
|
|
412
|
+
storageKeys.abSnapshot(ctx.agentName),
|
|
413
|
+
snapshot as unknown as JsonValue,
|
|
414
|
+
ctx
|
|
415
|
+
),
|
|
416
|
+
...(get === undefined
|
|
417
|
+
? {}
|
|
418
|
+
: {
|
|
419
|
+
getSnapshot: async (ctx: StorageContext) => {
|
|
420
|
+
const value = await get(storageKeys.abSnapshot(ctx.agentName), ctx);
|
|
421
|
+
return (value ?? undefined) as ABSnapshot | undefined;
|
|
422
|
+
},
|
|
423
|
+
}),
|
|
424
|
+
};
|
|
330
425
|
}
|
|
331
426
|
|
|
332
427
|
// ============================================================================
|
|
@@ -357,9 +452,14 @@ export const STORAGE_KEY_ROOT = "agentkit/v1" as const;
|
|
|
357
452
|
* | `agentkit/v1/{agent}/session-events/{sessionId}/{index}` | `SessionEvent[]` chunk (index = first event's index, zero-padded) |
|
|
358
453
|
* | `agentkit/v1/{agent}/continuation/{channelId}/{token}` | `{ sessionId }` |
|
|
359
454
|
* | `agentkit/v1/{agent}/kv/{key}` | Author JSON via {@link HostContext.kv} |
|
|
455
|
+
* | `agentkit/v1/{agent}/eval-runs/{runId}` | `EvalRunSnapshot` (derived `evals` table) |
|
|
456
|
+
* | `agentkit/v1/{agent}/ab-samples/{experiment}/{sessionId}/{at}` | `ABMetricSample` (derived `abs` table, append-only) |
|
|
457
|
+
* | `agentkit/v1/{agent}/ab-snapshot` | `ABSnapshot` (derived `abs` table, LWW) |
|
|
360
458
|
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
459
|
+
* The `eval-runs` / `ab-samples` / `ab-snapshot` families are minted only
|
|
460
|
+
* by the tables `defineStorage` derives over the KV core; a backend that
|
|
461
|
+
* authors dedicated {@link StorageConfig.evals} / {@link StorageConfig.abs}
|
|
462
|
+
* groups never sees them.
|
|
363
463
|
*/
|
|
364
464
|
export const storageKeys = {
|
|
365
465
|
session: (agent: string, sessionId: string): string =>
|
|
@@ -387,6 +487,25 @@ export const storageKeys = {
|
|
|
387
487
|
kv: (agent: string, key: string): string =>
|
|
388
488
|
`${STORAGE_KEY_ROOT}/${agent}/kv/${keySegment(key)}`,
|
|
389
489
|
kvPrefix: (agent: string): string => `${STORAGE_KEY_ROOT}/${agent}/kv/`,
|
|
490
|
+
/** One playground eval-run snapshot (derived `evals` table). */
|
|
491
|
+
evalRun: (agent: string, runId: string): string =>
|
|
492
|
+
`${STORAGE_KEY_ROOT}/${agent}/eval-runs/${keySegment(runId)}`,
|
|
493
|
+
evalRunsPrefix: (agent: string): string =>
|
|
494
|
+
`${STORAGE_KEY_ROOT}/${agent}/eval-runs/`,
|
|
495
|
+
/**
|
|
496
|
+
* One A/B metric sample (derived `abs` table); the segments mirror the
|
|
497
|
+
* dedicated table's row identity (experiment + sessionId + at).
|
|
498
|
+
*/
|
|
499
|
+
abSample: (
|
|
500
|
+
agent: string,
|
|
501
|
+
experiment: string,
|
|
502
|
+
sessionId: string,
|
|
503
|
+
at: string
|
|
504
|
+
): string =>
|
|
505
|
+
`${STORAGE_KEY_ROOT}/${agent}/ab-samples/${keySegment(experiment)}/${keySegment(sessionId)}/${keySegment(at)}`,
|
|
506
|
+
/** Latest aggregate A/B snapshot (derived `abs` table, LWW). */
|
|
507
|
+
abSnapshot: (agent: string): string =>
|
|
508
|
+
`${STORAGE_KEY_ROOT}/${agent}/ab-snapshot`,
|
|
390
509
|
} as const;
|
|
391
510
|
|
|
392
511
|
/**
|