@cursor/july 0.1.5 → 0.1.7

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.
Files changed (177) hide show
  1. package/dist/ab.d.ts +8 -95
  2. package/dist/ab.d.ts.map +1 -1
  3. package/dist/ab.js +9 -150
  4. package/dist/bin/agent-serve.js +41 -8
  5. package/dist/channels/slack/post-update-delivery.d.ts +85 -0
  6. package/dist/channels/slack/post-update-delivery.d.ts.map +1 -0
  7. package/dist/docs/404.html +2 -2
  8. package/dist/docs/ab.html +4 -4
  9. package/dist/docs/assets/{app.DabPG-io.js → app.COTN7wgo.js} +1 -1
  10. package/dist/docs/assets/chunks/@localSearchIndexroot.B7UcKvIn.js +1 -0
  11. package/dist/docs/assets/chunks/{VPLocalSearchBox.jmyr0bU0.js → VPLocalSearchBox.BW3TBdT0.js} +1 -1
  12. package/dist/docs/assets/chunks/{theme.DysN9-VN.js → theme.BEJW0vE7.js} +2 -2
  13. package/dist/docs/assets/deployment.md.BtfEsc9S.js +55 -0
  14. package/dist/docs/assets/deployment.md.BtfEsc9S.lean.js +1 -0
  15. package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.js +10 -0
  16. package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.lean.js +1 -0
  17. package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.js +7 -0
  18. package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.lean.js +1 -0
  19. package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.js +11 -0
  20. package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.lean.js +1 -0
  21. package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.js +8 -0
  22. package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.lean.js +1 -0
  23. package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.js +8 -0
  24. package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.lean.js +1 -0
  25. package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.js +23 -0
  26. package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.lean.js +1 -0
  27. package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.js +15 -0
  28. package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.lean.js +1 -0
  29. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +2 -0
  30. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.lean.js +1 -0
  31. package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.js +11 -0
  32. package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.lean.js +1 -0
  33. package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.js +19 -0
  34. package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.lean.js +1 -0
  35. package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.js +5 -0
  36. package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.lean.js +1 -0
  37. package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.js +24 -0
  38. package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.lean.js +1 -0
  39. package/dist/docs/assets/index.md.COiu-1jL.js +20 -0
  40. package/dist/docs/assets/{index.md.Cylk70gg.lean.js → index.md.COiu-1jL.lean.js} +1 -1
  41. package/dist/docs/assets/reference_cli.md.D189RBCH.js +60 -0
  42. package/dist/docs/assets/reference_cli.md.D189RBCH.lean.js +1 -0
  43. package/dist/docs/building-with-agents.html +4 -4
  44. package/dist/docs/concepts.html +4 -4
  45. package/dist/docs/deployment.html +58 -17
  46. package/dist/docs/evals.html +4 -4
  47. package/dist/docs/example-agents/approval-buddy.html +34 -0
  48. package/dist/docs/example-agents/benny.html +31 -0
  49. package/dist/docs/example-agents/bugbot.html +35 -0
  50. package/dist/docs/example-agents/codebase-wiki.html +32 -0
  51. package/dist/docs/example-agents/codeowners-review.html +32 -0
  52. package/dist/docs/example-agents/concierge.html +47 -0
  53. package/dist/docs/example-agents/fsd.html +39 -0
  54. package/dist/docs/example-agents/index.html +26 -0
  55. package/dist/docs/example-agents/knowledge-base.html +35 -0
  56. package/dist/docs/example-agents/security-reviewer.html +43 -0
  57. package/dist/docs/example-agents/slack-agent.html +29 -0
  58. package/dist/docs/example-agents/weather-agent.html +48 -0
  59. package/dist/docs/guides/agent-to-agent.html +4 -4
  60. package/dist/docs/guides/cloud-runtime.html +5 -5
  61. package/dist/docs/guides/github.html +4 -4
  62. package/dist/docs/guides/human-in-the-loop.html +4 -4
  63. package/dist/docs/guides/slack.html +4 -4
  64. package/dist/docs/guides/webhooks.html +4 -4
  65. package/dist/docs/hashmap.json +1 -1
  66. package/dist/docs/hillclimbing.html +4 -4
  67. package/dist/docs/index.html +7 -7
  68. package/dist/docs/quickstart.html +4 -4
  69. package/dist/docs/reference/agent-config.html +4 -4
  70. package/dist/docs/reference/channels.html +4 -4
  71. package/dist/docs/reference/cli.html +52 -30
  72. package/dist/docs/reference/connections.html +4 -4
  73. package/dist/docs/reference/hooks.html +4 -4
  74. package/dist/docs/reference/http-api.html +4 -4
  75. package/dist/docs/reference/instructions.html +4 -4
  76. package/dist/docs/reference/playground.html +4 -4
  77. package/dist/docs/reference/project-layout.html +4 -4
  78. package/dist/docs/reference/schedules.html +4 -4
  79. package/dist/docs/reference/sessions.html +4 -4
  80. package/dist/docs/reference/skills.html +4 -4
  81. package/dist/docs/reference/subagents.html +4 -4
  82. package/dist/docs/reference/tools.html +4 -4
  83. package/dist/docs/scaffolding-agents.html +4 -4
  84. package/dist/docs/storage.html +4 -4
  85. package/dist/docs/troubleshooting.html +4 -4
  86. package/dist/evals.d.ts +5 -62
  87. package/dist/evals.d.ts.map +1 -1
  88. package/dist/evals.js +3 -66
  89. package/dist/index.d.ts +1 -1
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/internal/ab-collector.d.ts +7 -5
  92. package/dist/internal/ab-collector.d.ts.map +1 -1
  93. package/dist/internal/ab-collector.js +3 -14
  94. package/dist/internal/ab-snapshot.d.ts +2 -4
  95. package/dist/internal/ab-snapshot.d.ts.map +1 -1
  96. package/dist/internal/cli-ax.d.ts +33 -5
  97. package/dist/internal/cli-ax.d.ts.map +1 -1
  98. package/dist/internal/cli-ax.js +428 -87
  99. package/dist/internal/cli-deploy.js +1 -1
  100. package/dist/internal/discovery.js +3 -3
  101. package/dist/internal/eval-run-store.d.ts +35 -30
  102. package/dist/internal/eval-run-store.d.ts.map +1 -1
  103. package/dist/internal/eval-run-store.js +88 -100
  104. package/dist/internal/evals-client.d.ts +96 -0
  105. package/dist/internal/evals-client.d.ts.map +1 -0
  106. package/dist/internal/evals-client.js +262 -0
  107. package/dist/internal/init-project.d.ts.map +1 -1
  108. package/dist/internal/init-project.js +1 -0
  109. package/dist/internal/persistence-coordinator.d.ts +127 -0
  110. package/dist/internal/persistence-coordinator.d.ts.map +1 -0
  111. package/dist/internal/playground-proxy.d.ts +5 -5
  112. package/dist/internal/playground-proxy.js +3 -3
  113. package/dist/internal/resolve-prod-target.d.ts +30 -0
  114. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  115. package/dist/internal/resolve-prod-target.js +74 -2
  116. package/dist/internal/server.d.ts.map +1 -1
  117. package/dist/internal/server.js +16 -5
  118. package/dist/internal/session-engine.d.ts +1 -2
  119. package/dist/internal/session-engine.d.ts.map +1 -1
  120. package/dist/internal/session-engine.js +14 -31
  121. package/dist/internal/storage-coordinator.d.ts +16 -15
  122. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  123. package/dist/internal/storage-coordinator.js +73 -80
  124. package/dist/persistence.d.ts +184 -0
  125. package/dist/persistence.d.ts.map +1 -0
  126. package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
  127. package/dist/playground/assets/index-72vCOBWO.js +86 -0
  128. package/dist/playground/assets/index-BjnMwYoR.css +1 -0
  129. package/dist/playground/index.html +2 -2
  130. package/dist/storage.d.ts +51 -10
  131. package/dist/storage.d.ts.map +1 -1
  132. package/dist/storage.js +27 -10
  133. package/docs/README.md +34 -5
  134. package/docs/deployment.md +352 -149
  135. package/docs/example-agents/approval-buddy.md +270 -0
  136. package/docs/example-agents/benny.md +186 -0
  137. package/docs/example-agents/bugbot.md +231 -0
  138. package/docs/example-agents/codebase-wiki.md +174 -0
  139. package/docs/example-agents/codeowners-review.md +195 -0
  140. package/docs/example-agents/concierge.md +205 -0
  141. package/docs/example-agents/fsd.md +330 -0
  142. package/docs/example-agents/index.md +102 -0
  143. package/docs/example-agents/knowledge-base.md +171 -0
  144. package/docs/example-agents/security-reviewer.md +296 -0
  145. package/docs/example-agents/slack-agent.md +146 -0
  146. package/docs/example-agents/weather-agent.md +302 -0
  147. package/docs/reference/cli.md +546 -147
  148. package/package.json +1 -1
  149. package/src/ab.ts +9 -261
  150. package/src/bin/agent-serve.ts +46 -7
  151. package/src/evals.ts +5 -119
  152. package/src/index.ts +2 -0
  153. package/src/internal/ab-collector.ts +12 -22
  154. package/src/internal/ab-snapshot.ts +2 -4
  155. package/src/internal/cli-ax.ts +551 -104
  156. package/src/internal/cli-deploy.ts +1 -1
  157. package/src/internal/discovery.ts +2 -2
  158. package/src/internal/eval-run-store.ts +91 -100
  159. package/src/internal/evals-client.ts +431 -0
  160. package/src/internal/init-project.ts +1 -0
  161. package/src/internal/playground-proxy.ts +5 -5
  162. package/src/internal/resolve-prod-target.ts +101 -3
  163. package/src/internal/server.ts +17 -3
  164. package/src/internal/session-engine.ts +9 -29
  165. package/src/internal/storage-coordinator.ts +109 -101
  166. package/src/storage.ts +79 -14
  167. package/dist/docs/assets/chunks/@localSearchIndexroot.QwK5BtEH.js +0 -1
  168. package/dist/docs/assets/deployment.md.DTKwE15Z.js +0 -14
  169. package/dist/docs/assets/deployment.md.DTKwE15Z.lean.js +0 -1
  170. package/dist/docs/assets/index.md.Cylk70gg.js +0 -20
  171. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.js +0 -38
  172. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.lean.js +0 -1
  173. package/dist/internal/json-dir-store.js +0 -100
  174. package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
  175. package/dist/playground/assets/index-BEauYlII.css +0 -1
  176. package/dist/playground/assets/index-BtM0wEGg.js +0 -319
  177. package/src/internal/json-dir-store.ts +0 -109
@@ -8,8 +8,8 @@
8
8
  />
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1" />
10
10
  <title>agent-serve playground</title>
11
- <script type="module" crossorigin src="./assets/index-BtM0wEGg.js"></script>
12
- <link rel="stylesheet" crossorigin href="./assets/index-BEauYlII.css">
11
+ <script type="module" crossorigin src="./assets/index-72vCOBWO.js"></script>
12
+ <link rel="stylesheet" crossorigin href="./assets/index-BjnMwYoR.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/dist/storage.d.ts CHANGED
@@ -4,10 +4,11 @@
4
4
  * Author `agent/storage.ts` with {@link defineStorage} to mirror the
5
5
  * framework's durable state into storage you own (a database, S3, a data
6
6
  * pipeline, …). Without it, state lives under `--state-root` on local disk
7
- * only (and eval/A/B history follows the narrower `persistRuns` /
8
- * `persistSamples` / `persistSnapshots` hooks).
7
+ * only, and eval/A/B history stays in process memory.
9
8
  *
10
- * The sink is a plain key-value store — four functions, no schema:
9
+ * The sink is a plain key-value store — four functions, no schema — plus
10
+ * two optional dedicated tables ({@link StorageConfig.evals} and
11
+ * {@link StorageConfig.abs}) for eval-run and A/B history:
11
12
  *
12
13
  * ```ts
13
14
  * import { defineStorage } from "@anysphere/agent-serve/storage";
@@ -17,6 +18,8 @@
17
18
  * get: (key) => db.get(key),
18
19
  * delete: (key) => db.delete(key),
19
20
  * list: (prefix) => db.listByPrefix(prefix), // [{ key, value }] in key order
21
+ * evals: { put: ..., delete: ..., list: ... }, // eval-runs table
22
+ * abs: { putSample: ... }, // A/B table
20
23
  * });
21
24
  * ```
22
25
  *
@@ -39,6 +42,9 @@
39
42
  * event log under `--state-root` remains the live source of truth; this
40
43
  * interface is the durable mirror.
41
44
  */
45
+ import type { ABMetricSample } from "./ab.js";
46
+ import type { EvalRunSnapshot } from "./evals.js";
47
+ import type { ABSnapshot } from "./internal/ab-snapshot.js";
42
48
  import type { JsonValue } from "./types.js";
43
49
  /** One `{ key, value }` pair returned by {@link StorageConfig.list}. */
44
50
  export interface StorageEntry {
@@ -98,11 +104,50 @@ export interface StorageRestorePolicy {
98
104
  */
99
105
  maxTotalBytes?: number;
100
106
  }
107
+ /**
108
+ * Dedicated table for playground eval batches, keyed by `runId`. The
109
+ * framework saves a full {@link EvalRunSnapshot} as a batch starts,
110
+ * progresses, and finishes; prunes runs past the playground history
111
+ * window; and lists everything back at serve start.
112
+ */
113
+ export interface StorageEvalsTable {
114
+ /** Upsert one run snapshot under `run.runId` (last write wins). */
115
+ put(run: EvalRunSnapshot, ctx: StorageContext): void | Promise<void>;
116
+ /** Remove a run pruned out of the playground history window. */
117
+ delete(runId: string, ctx: StorageContext): void | Promise<void>;
118
+ /** All saved runs (any order). Called once when the serve process hydrates. */
119
+ list(ctx: StorageContext): EvalRunSnapshot[] | Promise<EvalRunSnapshot[]>;
120
+ }
121
+ /**
122
+ * Dedicated table for live A/B metrics: one row per cumulative metric
123
+ * sample (unique per `experiment` + `sessionId` + `at` — one boundary
124
+ * event emits a sample per enrolled experiment), plus — optionally — the latest
125
+ * aggregate snapshot so a replacement host with no local sessions can
126
+ * still serve the A/Bs surface.
127
+ */
128
+ export interface StorageABTable {
129
+ /** Append one cumulative metric sample (turn complete/fail). */
130
+ putSample(sample: ABMetricSample, ctx: StorageContext): void | Promise<void>;
131
+ /** Upsert the latest aggregate snapshot (framework-throttled). Optional. */
132
+ putSnapshot?(snapshot: ABSnapshot, ctx: StorageContext): void | Promise<void>;
133
+ /** Latest saved aggregate snapshot (replacement-host backfill). Optional. */
134
+ getSnapshot?(ctx: StorageContext): ABSnapshot | undefined | null | Promise<ABSnapshot | undefined | null>;
135
+ }
101
136
  export interface StorageConfig {
102
137
  /** Optional label surfaced on `GET /v1/info` diagnostics. */
103
138
  name?: string;
104
139
  /** Timing knobs; see {@link StoragePolicy}. */
105
140
  policy?: StoragePolicy;
141
+ /**
142
+ * Dedicated eval-runs table. Omit it and playground eval history stays
143
+ * in process memory (lost on restart).
144
+ */
145
+ evals?: StorageEvalsTable;
146
+ /**
147
+ * Dedicated A/B table. Omit it and metric samples are not exported
148
+ * (session event logs remain the assignment/fold source of truth).
149
+ */
150
+ abs?: StorageABTable;
106
151
  /**
107
152
  * Store one value under a key (upsert, last-write-wins). Called on the
108
153
  * framework's schedule — never concurrently, always in order. Keep it
@@ -160,9 +205,9 @@ export declare const STORAGE_KEY_ROOT: "agentkit/v1";
160
205
  * | `agentkit/v1/{agent}/session-events/{sessionId}/{index}` | `SessionEvent[]` chunk (index = first event's index, zero-padded) |
161
206
  * | `agentkit/v1/{agent}/continuation/{channelId}/{token}` | `{ sessionId }` |
162
207
  * | `agentkit/v1/{agent}/reminder/{reminderId}` | `ReminderRecord` |
163
- * | `agentkit/v1/{agent}/eval-run/{runId}` | `EvalRunSnapshot` |
164
- * | `agentkit/v1/{agent}/ab-sample/{sessionId}/{at}` | `ABMetricSample` |
165
- * | `agentkit/v1/{agent}/ab-snapshot` | latest aggregate `ABSnapshot` |
208
+ *
209
+ * Eval-run and A/B history do not flow through this KV scheme — they have
210
+ * dedicated tables ({@link StorageConfig.evals} / {@link StorageConfig.abs}).
166
211
  */
167
212
  export declare const storageKeys: {
168
213
  readonly session: (agent: string, sessionId: string) => string;
@@ -172,10 +217,6 @@ export declare const storageKeys: {
172
217
  readonly continuation: (agent: string, channelId: string, continuationKey: string) => string;
173
218
  readonly reminder: (agent: string, reminderId: string) => string;
174
219
  readonly reminderPrefix: (agent: string) => string;
175
- readonly evalRun: (agent: string, runId: string) => string;
176
- readonly evalRunPrefix: (agent: string) => string;
177
- readonly abSample: (agent: string, sessionId: string, at: string) => string;
178
- readonly abSnapshot: (agent: string) => string;
179
220
  };
180
221
  /**
181
222
  * Max bytes a caller-controlled key segment may occupy after URI-encoding.
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,oBAAoB,GAAG,KAAK,CAAC;CACxC;AAED,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,kEAAkE;IAClE,MAAM,CAAC,CAAC,GAAG,EAAE,MA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jB,MAAM;aAET,mBAAmB,UAAU,MAAM,aAAa,MAAM,KAAG,MAAM;aAE/D,YAAY,UACH,MAAM,aACF,MAAM,mBACA,MAAM,KACtB,MAAM;aAET,QAAQ,UAAU,MAAM,cAAc,MAAM,KAAG,MAAM;aAErD,cAAc,UAAU,MAAM,KAAG,MAAM;CAE/B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAoBzC,eAAO,MAAM,oCAAoC,OAAQ,CAAC;AAC1D,eAAO,MAAM,kCAAkC,EAAE,MAA8B,CAAC;AAChF,eAAO,MAAM,uCAAuC,aAAgB,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,MAAM,EAAE,SAAS,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,OAAO,EACH,KAAK,GACL;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,GAAG,SAAS,GAChC,qBAAqB,CA8BvB"}
package/dist/storage.js CHANGED
@@ -4,10 +4,11 @@
4
4
  * Author `agent/storage.ts` with {@link defineStorage} to mirror the
5
5
  * framework's durable state into storage you own (a database, S3, a data
6
6
  * pipeline, …). Without it, state lives under `--state-root` on local disk
7
- * only (and eval/A/B history follows the narrower `persistRuns` /
8
- * `persistSamples` / `persistSnapshots` hooks).
7
+ * only, and eval/A/B history stays in process memory.
9
8
  *
10
- * The sink is a plain key-value store — four functions, no schema:
9
+ * The sink is a plain key-value store — four functions, no schema — plus
10
+ * two optional dedicated tables ({@link StorageConfig.evals} and
11
+ * {@link StorageConfig.abs}) for eval-run and A/B history:
11
12
  *
12
13
  * ```ts
13
14
  * import { defineStorage } from "@anysphere/agent-serve/storage";
@@ -17,6 +18,8 @@
17
18
  * get: (key) => db.get(key),
18
19
  * delete: (key) => db.delete(key),
19
20
  * list: (prefix) => db.listByPrefix(prefix), // [{ key, value }] in key order
21
+ * evals: { put: ..., delete: ..., list: ... }, // eval-runs table
22
+ * abs: { putSample: ... }, // A/B table
20
23
  * });
21
24
  * ```
22
25
  *
@@ -55,6 +58,24 @@ export function defineStorage(config) {
55
58
  throw new Error(`defineStorage: config.${hook} must be a function when set`);
56
59
  }
57
60
  }
61
+ if (config.evals !== undefined) {
62
+ for (const hook of ["put", "delete", "list"]) {
63
+ if (typeof config.evals[hook] !== "function") {
64
+ throw new Error(`defineStorage: evals.${hook} must be a function when the evals table is set`);
65
+ }
66
+ }
67
+ }
68
+ if (config.abs !== undefined) {
69
+ if (typeof config.abs.putSample !== "function") {
70
+ throw new Error("defineStorage: abs.putSample must be a function when the abs table is set");
71
+ }
72
+ for (const hook of ["putSnapshot", "getSnapshot"]) {
73
+ const value = config.abs[hook];
74
+ if (value !== undefined && typeof value !== "function") {
75
+ throw new Error(`defineStorage: abs.${hook} must be a function when set`);
76
+ }
77
+ }
78
+ }
58
79
  // Validate eagerly so a bad policy fails at discovery, not first flush.
59
80
  resolveStoragePolicy(config.policy);
60
81
  return brandDefinition("storage", config);
@@ -85,9 +106,9 @@ export const STORAGE_KEY_ROOT = "agentkit/v1";
85
106
  * | `agentkit/v1/{agent}/session-events/{sessionId}/{index}` | `SessionEvent[]` chunk (index = first event's index, zero-padded) |
86
107
  * | `agentkit/v1/{agent}/continuation/{channelId}/{token}` | `{ sessionId }` |
87
108
  * | `agentkit/v1/{agent}/reminder/{reminderId}` | `ReminderRecord` |
88
- * | `agentkit/v1/{agent}/eval-run/{runId}` | `EvalRunSnapshot` |
89
- * | `agentkit/v1/{agent}/ab-sample/{sessionId}/{at}` | `ABMetricSample` |
90
- * | `agentkit/v1/{agent}/ab-snapshot` | latest aggregate `ABSnapshot` |
109
+ *
110
+ * Eval-run and A/B history do not flow through this KV scheme — they have
111
+ * dedicated tables ({@link StorageConfig.evals} / {@link StorageConfig.abs}).
91
112
  */
92
113
  export const storageKeys = {
93
114
  session: (agent, sessionId) => `${STORAGE_KEY_ROOT}/${agent}/session/${sessionId}`,
@@ -97,10 +118,6 @@ export const storageKeys = {
97
118
  continuation: (agent, channelId, continuationKey) => `${STORAGE_KEY_ROOT}/${agent}/continuation/${keySegment(channelId)}/${keySegment(continuationKey)}`,
98
119
  reminder: (agent, reminderId) => `${STORAGE_KEY_ROOT}/${agent}/reminder/${reminderId}`,
99
120
  reminderPrefix: (agent) => `${STORAGE_KEY_ROOT}/${agent}/reminder/`,
100
- evalRun: (agent, runId) => `${STORAGE_KEY_ROOT}/${agent}/eval-run/${runId}`,
101
- evalRunPrefix: (agent) => `${STORAGE_KEY_ROOT}/${agent}/eval-run/`,
102
- abSample: (agent, sessionId, at) => `${STORAGE_KEY_ROOT}/${agent}/ab-sample/${sessionId}/${at}`,
103
- abSnapshot: (agent) => `${STORAGE_KEY_ROOT}/${agent}/ab-snapshot`,
104
121
  };
105
122
  /**
106
123
  * Max bytes a caller-controlled key segment may occupy after URI-encoding.
package/docs/README.md CHANGED
@@ -47,11 +47,12 @@ Pick your entry point based on your goal.
47
47
  | --- | --- |
48
48
  | New to agentkit | [Quickstart](./quickstart.md) (PR approver), then [Concepts](./concepts.md) |
49
49
  | Building a new agent with Cursor | [Scaffold an agent with Cursor](./scaffolding-agents.md) |
50
+ | Learning from working agents | [Example agents](./example-agents/index.md) |
50
51
  | Wiring an agent to Slack | [Slack guide](./guides/slack.md) |
51
52
  | Wiring an agent to GitHub webhooks | [GitHub guide](./guides/github.md) |
52
53
  | Making an existing agent measurably better | [Evals](./evals.md), then [Hillclimbing](./hillclimbing.md) |
53
54
  | Comparing variants on live traffic | [Live A/B metrics](./ab.md) |
54
- | Deploying an agent to a server | [Deployment](./deployment.md) |
55
+ | Deploying with Cursor or on your own infrastructure | [Deployment](./deployment.md) |
55
56
  | Debugging something that misbehaves | [Fix common agent problems](./troubleshooting.md) |
56
57
 
57
58
  ## The documentation
@@ -89,10 +90,37 @@ Pick your entry point based on your goal.
89
90
  - [Cloud runtime](./guides/cloud-runtime.md): run turns on Cursor cloud
90
91
  agents instead of the local harness.
91
92
 
93
+ **Example agents**
94
+
95
+ - [Choose the right example](./example-agents/index.md): compare all eleven
96
+ agents by runtime, channels, tools, state, and architecture.
97
+ - [Weather agent](./example-agents/weather-agent.md): explore tools, MCP,
98
+ approvals, skills, subagents, schedules, hooks, A/B metrics, and evals.
99
+ - [Slack agent](./example-agents/slack-agent.md): put a minimal agent in
100
+ Slack through an account-linked transport.
101
+ - [Concierge](./example-agents/concierge.md): delegate work to a peer agent
102
+ with its own context and sessions.
103
+ - [Playbook router](./example-agents/benny.md): route Slack intake through inherited
104
+ repository playbooks.
105
+ - [PR evidence reviewer](./example-agents/bugbot.md): review a host-prepared,
106
+ diff-first pull-request evidence tree.
107
+ - [Approval Buddy](./example-agents/approval-buddy.md): keep approval policy
108
+ in code while subagents supply review findings.
109
+ - [Security Reviewer](./example-agents/security-reviewer.md): run a staged,
110
+ parallel security pipeline with live playground progress.
111
+ - [Remote PR coordinator](./example-agents/fsd.md): hand PR triage from local
112
+ chat and webhooks to durable remote sessions.
113
+ - [Knowledge base](./example-agents/knowledge-base.md): turn conversations
114
+ about people, systems, decisions, and preferences into shared markdown.
115
+ - [Codebase wiki](./example-agents/codebase-wiki.md): ingest merged PRs into
116
+ per-feature pages with a daily digest schedule.
117
+ - [Codeowners review](./example-agents/codeowners-review.md): route PR
118
+ reviews by ownership to per-area playbooks and aggregate verdicts.
119
+
92
120
  **Operating**
93
121
 
94
- - [Deployment](./deployment.md): auth, state, credentials, Docker, and
95
- running on a server.
122
+ - [Deployment](./deployment.md): Cursor-managed hosting, self-hosting,
123
+ auth, state, and operations.
96
124
  - [Fix common agent problems](./troubleshooting.md): symptom to cause,
97
125
  in plain language.
98
126
 
@@ -132,8 +160,9 @@ comes from depends on where you run.
132
160
 
133
161
  > [!NOTE]
134
162
  > The framework is being renamed from agent-serve to agentkit,
135
- > and these docs use the new names throughout. Until the code rename
136
- > ships, substitute the current identifiers where they differ:
163
+ > and CLI examples use the new `agentkit` name. Paths, package imports,
164
+ > and environment variables keep their current names until the code rename
165
+ > ships:
137
166
  >
138
167
  > | Docs say | Current name |
139
168
  > | --- | --- |