@cursor/july 0.1.5 → 0.1.6

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 (169) 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 +14 -6
  5. package/dist/docs/404.html +2 -2
  6. package/dist/docs/ab.html +4 -4
  7. package/dist/docs/assets/{app.DabPG-io.js → app.DMboGKUD.js} +1 -1
  8. package/dist/docs/assets/chunks/@localSearchIndexroot.O6eP7QZr.js +1 -0
  9. package/dist/docs/assets/chunks/{VPLocalSearchBox.jmyr0bU0.js → VPLocalSearchBox.DkEqEnJU.js} +1 -1
  10. package/dist/docs/assets/chunks/{theme.DysN9-VN.js → theme.ASugdMNm.js} +2 -2
  11. package/dist/docs/assets/deployment.md.BtfEsc9S.js +55 -0
  12. package/dist/docs/assets/deployment.md.BtfEsc9S.lean.js +1 -0
  13. package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.js +10 -0
  14. package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.lean.js +1 -0
  15. package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.js +7 -0
  16. package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.lean.js +1 -0
  17. package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.js +11 -0
  18. package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.lean.js +1 -0
  19. package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.js +8 -0
  20. package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.lean.js +1 -0
  21. package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.js +8 -0
  22. package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.lean.js +1 -0
  23. package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.js +23 -0
  24. package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.lean.js +1 -0
  25. package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.js +15 -0
  26. package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.lean.js +1 -0
  27. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +2 -0
  28. package/dist/docs/assets/example-agents_index.md.CRqJlnIf.lean.js +1 -0
  29. package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.js +11 -0
  30. package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.lean.js +1 -0
  31. package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.js +19 -0
  32. package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.lean.js +1 -0
  33. package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.js +5 -0
  34. package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.lean.js +1 -0
  35. package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.js +24 -0
  36. package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.lean.js +1 -0
  37. package/dist/docs/assets/index.md.COiu-1jL.js +20 -0
  38. package/dist/docs/assets/{index.md.Cylk70gg.lean.js → index.md.COiu-1jL.lean.js} +1 -1
  39. package/dist/docs/assets/reference_cli.md.D189RBCH.js +60 -0
  40. package/dist/docs/assets/reference_cli.md.D189RBCH.lean.js +1 -0
  41. package/dist/docs/building-with-agents.html +4 -4
  42. package/dist/docs/concepts.html +4 -4
  43. package/dist/docs/deployment.html +58 -17
  44. package/dist/docs/evals.html +4 -4
  45. package/dist/docs/example-agents/approval-buddy.html +34 -0
  46. package/dist/docs/example-agents/benny.html +31 -0
  47. package/dist/docs/example-agents/bugbot.html +35 -0
  48. package/dist/docs/example-agents/codebase-wiki.html +32 -0
  49. package/dist/docs/example-agents/codeowners-review.html +32 -0
  50. package/dist/docs/example-agents/concierge.html +47 -0
  51. package/dist/docs/example-agents/fsd.html +39 -0
  52. package/dist/docs/example-agents/index.html +26 -0
  53. package/dist/docs/example-agents/knowledge-base.html +35 -0
  54. package/dist/docs/example-agents/security-reviewer.html +43 -0
  55. package/dist/docs/example-agents/slack-agent.html +29 -0
  56. package/dist/docs/example-agents/weather-agent.html +48 -0
  57. package/dist/docs/guides/agent-to-agent.html +4 -4
  58. package/dist/docs/guides/cloud-runtime.html +5 -5
  59. package/dist/docs/guides/github.html +4 -4
  60. package/dist/docs/guides/human-in-the-loop.html +4 -4
  61. package/dist/docs/guides/slack.html +4 -4
  62. package/dist/docs/guides/webhooks.html +4 -4
  63. package/dist/docs/hashmap.json +1 -1
  64. package/dist/docs/hillclimbing.html +4 -4
  65. package/dist/docs/index.html +7 -7
  66. package/dist/docs/quickstart.html +4 -4
  67. package/dist/docs/reference/agent-config.html +4 -4
  68. package/dist/docs/reference/channels.html +4 -4
  69. package/dist/docs/reference/cli.html +52 -30
  70. package/dist/docs/reference/connections.html +4 -4
  71. package/dist/docs/reference/hooks.html +4 -4
  72. package/dist/docs/reference/http-api.html +4 -4
  73. package/dist/docs/reference/instructions.html +4 -4
  74. package/dist/docs/reference/playground.html +4 -4
  75. package/dist/docs/reference/project-layout.html +4 -4
  76. package/dist/docs/reference/schedules.html +4 -4
  77. package/dist/docs/reference/sessions.html +4 -4
  78. package/dist/docs/reference/skills.html +4 -4
  79. package/dist/docs/reference/subagents.html +4 -4
  80. package/dist/docs/reference/tools.html +4 -4
  81. package/dist/docs/scaffolding-agents.html +4 -4
  82. package/dist/docs/storage.html +4 -4
  83. package/dist/docs/troubleshooting.html +4 -4
  84. package/dist/evals.d.ts +4 -61
  85. package/dist/evals.d.ts.map +1 -1
  86. package/dist/evals.js +3 -66
  87. package/dist/index.d.ts +1 -1
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/internal/ab-collector.d.ts +7 -5
  90. package/dist/internal/ab-collector.d.ts.map +1 -1
  91. package/dist/internal/ab-collector.js +3 -14
  92. package/dist/internal/ab-snapshot.d.ts +2 -4
  93. package/dist/internal/ab-snapshot.d.ts.map +1 -1
  94. package/dist/internal/cli-ax.d.ts +18 -3
  95. package/dist/internal/cli-ax.d.ts.map +1 -1
  96. package/dist/internal/cli-ax.js +80 -42
  97. package/dist/internal/cli-deploy.js +1 -1
  98. package/dist/internal/discovery.js +3 -3
  99. package/dist/internal/eval-run-store.d.ts +33 -30
  100. package/dist/internal/eval-run-store.d.ts.map +1 -1
  101. package/dist/internal/eval-run-store.js +84 -96
  102. package/dist/internal/init-project.d.ts.map +1 -1
  103. package/dist/internal/init-project.js +3 -2
  104. package/dist/internal/playground-proxy.d.ts +5 -5
  105. package/dist/internal/playground-proxy.js +3 -3
  106. package/dist/internal/resolve-prod-target.d.ts +30 -0
  107. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  108. package/dist/internal/resolve-prod-target.js +74 -2
  109. package/dist/internal/server.d.ts.map +1 -1
  110. package/dist/internal/server.js +5 -3
  111. package/dist/internal/session-engine.d.ts +1 -2
  112. package/dist/internal/session-engine.d.ts.map +1 -1
  113. package/dist/internal/session-engine.js +14 -31
  114. package/dist/internal/storage-coordinator.d.ts +16 -15
  115. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  116. package/dist/internal/storage-coordinator.js +73 -80
  117. package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
  118. package/dist/playground/assets/index-7GJIUFQj.css +1 -0
  119. package/dist/playground/assets/index-mux9aj5P.js +319 -0
  120. package/dist/playground/index.html +2 -2
  121. package/dist/storage.d.ts +51 -10
  122. package/dist/storage.d.ts.map +1 -1
  123. package/dist/storage.js +27 -10
  124. package/docs/README.md +34 -5
  125. package/docs/deployment.md +352 -149
  126. package/docs/example-agents/approval-buddy.md +270 -0
  127. package/docs/example-agents/benny.md +186 -0
  128. package/docs/example-agents/bugbot.md +231 -0
  129. package/docs/example-agents/codebase-wiki.md +174 -0
  130. package/docs/example-agents/codeowners-review.md +195 -0
  131. package/docs/example-agents/concierge.md +205 -0
  132. package/docs/example-agents/fsd.md +330 -0
  133. package/docs/example-agents/index.md +102 -0
  134. package/docs/example-agents/knowledge-base.md +171 -0
  135. package/docs/example-agents/security-reviewer.md +296 -0
  136. package/docs/example-agents/slack-agent.md +146 -0
  137. package/docs/example-agents/weather-agent.md +302 -0
  138. package/docs/reference/cli.md +546 -147
  139. package/package.json +1 -1
  140. package/src/ab.ts +9 -261
  141. package/src/bin/agent-serve.ts +14 -6
  142. package/src/evals.ts +4 -118
  143. package/src/index.ts +2 -0
  144. package/src/internal/ab-collector.ts +12 -22
  145. package/src/internal/ab-snapshot.ts +2 -4
  146. package/src/internal/cli-ax.ts +101 -45
  147. package/src/internal/cli-deploy.ts +1 -1
  148. package/src/internal/discovery.ts +2 -2
  149. package/src/internal/eval-run-store.ts +86 -100
  150. package/src/internal/init-project.ts +3 -2
  151. package/src/internal/playground-proxy.ts +5 -5
  152. package/src/internal/resolve-prod-target.ts +101 -3
  153. package/src/internal/server.ts +5 -3
  154. package/src/internal/session-engine.ts +9 -29
  155. package/src/internal/storage-coordinator.ts +109 -101
  156. package/src/storage.ts +79 -14
  157. package/dist/docs/assets/chunks/@localSearchIndexroot.QwK5BtEH.js +0 -1
  158. package/dist/docs/assets/deployment.md.DTKwE15Z.js +0 -14
  159. package/dist/docs/assets/deployment.md.DTKwE15Z.lean.js +0 -1
  160. package/dist/docs/assets/index.md.Cylk70gg.js +0 -20
  161. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.js +0 -38
  162. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.lean.js +0 -1
  163. package/dist/internal/json-dir-store.d.ts +0 -32
  164. package/dist/internal/json-dir-store.d.ts.map +0 -1
  165. package/dist/internal/json-dir-store.js +0 -100
  166. package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
  167. package/dist/playground/assets/index-BEauYlII.css +0 -1
  168. package/dist/playground/assets/index-BtM0wEGg.js +0 -319
  169. package/src/internal/json-dir-store.ts +0 -109
package/src/storage.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
  *
@@ -41,6 +44,9 @@
41
44
  */
42
45
 
43
46
  import { createHash } from "node:crypto";
47
+ import type { ABMetricSample } from "./ab.js";
48
+ import type { EvalRunSnapshot } from "./evals.js";
49
+ import type { ABSnapshot } from "./internal/ab-snapshot.js";
44
50
  import { brandDefinition } from "./internal/brand.js";
45
51
  import type { JsonValue } from "./types.js";
46
52
 
@@ -110,11 +116,54 @@ export interface StorageRestorePolicy {
110
116
  maxTotalBytes?: number;
111
117
  }
112
118
 
119
+ /**
120
+ * Dedicated table for playground eval batches, keyed by `runId`. The
121
+ * framework saves a full {@link EvalRunSnapshot} as a batch starts,
122
+ * progresses, and finishes; prunes runs past the playground history
123
+ * window; and lists everything back at serve start.
124
+ */
125
+ export interface StorageEvalsTable {
126
+ /** Upsert one run snapshot under `run.runId` (last write wins). */
127
+ put(run: EvalRunSnapshot, ctx: StorageContext): void | Promise<void>;
128
+ /** Remove a run pruned out of the playground history window. */
129
+ delete(runId: string, ctx: StorageContext): void | Promise<void>;
130
+ /** All saved runs (any order). Called once when the serve process hydrates. */
131
+ list(ctx: StorageContext): EvalRunSnapshot[] | Promise<EvalRunSnapshot[]>;
132
+ }
133
+
134
+ /**
135
+ * Dedicated table for live A/B metrics: one row per cumulative metric
136
+ * sample (unique per `experiment` + `sessionId` + `at` — one boundary
137
+ * event emits a sample per enrolled experiment), plus — optionally — the latest
138
+ * aggregate snapshot so a replacement host with no local sessions can
139
+ * still serve the A/Bs surface.
140
+ */
141
+ export interface StorageABTable {
142
+ /** Append one cumulative metric sample (turn complete/fail). */
143
+ putSample(sample: ABMetricSample, ctx: StorageContext): void | Promise<void>;
144
+ /** Upsert the latest aggregate snapshot (framework-throttled). Optional. */
145
+ putSnapshot?(snapshot: ABSnapshot, ctx: StorageContext): void | Promise<void>;
146
+ /** Latest saved aggregate snapshot (replacement-host backfill). Optional. */
147
+ getSnapshot?(
148
+ ctx: StorageContext
149
+ ): ABSnapshot | undefined | null | Promise<ABSnapshot | undefined | null>;
150
+ }
151
+
113
152
  export interface StorageConfig {
114
153
  /** Optional label surfaced on `GET /v1/info` diagnostics. */
115
154
  name?: string;
116
155
  /** Timing knobs; see {@link StoragePolicy}. */
117
156
  policy?: StoragePolicy;
157
+ /**
158
+ * Dedicated eval-runs table. Omit it and playground eval history stays
159
+ * in process memory (lost on restart).
160
+ */
161
+ evals?: StorageEvalsTable;
162
+ /**
163
+ * Dedicated A/B table. Omit it and metric samples are not exported
164
+ * (session event logs remain the assignment/fold source of truth).
165
+ */
166
+ abs?: StorageABTable;
118
167
  /**
119
168
  * Store one value under a key (upsert, last-write-wins). Called on the
120
169
  * framework's schedule — never concurrently, always in order. Keep it
@@ -168,6 +217,30 @@ export function defineStorage(config: StorageConfig): StorageDefinition {
168
217
  );
169
218
  }
170
219
  }
220
+ if (config.evals !== undefined) {
221
+ for (const hook of ["put", "delete", "list"] as const) {
222
+ if (typeof config.evals[hook] !== "function") {
223
+ throw new Error(
224
+ `defineStorage: evals.${hook} must be a function when the evals table is set`
225
+ );
226
+ }
227
+ }
228
+ }
229
+ if (config.abs !== undefined) {
230
+ if (typeof config.abs.putSample !== "function") {
231
+ throw new Error(
232
+ "defineStorage: abs.putSample must be a function when the abs table is set"
233
+ );
234
+ }
235
+ for (const hook of ["putSnapshot", "getSnapshot"] as const) {
236
+ const value = config.abs[hook];
237
+ if (value !== undefined && typeof value !== "function") {
238
+ throw new Error(
239
+ `defineStorage: abs.${hook} must be a function when set`
240
+ );
241
+ }
242
+ }
243
+ }
171
244
  // Validate eagerly so a bad policy fails at discovery, not first flush.
172
245
  resolveStoragePolicy(config.policy);
173
246
  return brandDefinition("storage", config);
@@ -201,9 +274,9 @@ export const STORAGE_KEY_ROOT = "agentkit/v1" as const;
201
274
  * | `agentkit/v1/{agent}/session-events/{sessionId}/{index}` | `SessionEvent[]` chunk (index = first event's index, zero-padded) |
202
275
  * | `agentkit/v1/{agent}/continuation/{channelId}/{token}` | `{ sessionId }` |
203
276
  * | `agentkit/v1/{agent}/reminder/{reminderId}` | `ReminderRecord` |
204
- * | `agentkit/v1/{agent}/eval-run/{runId}` | `EvalRunSnapshot` |
205
- * | `agentkit/v1/{agent}/ab-sample/{sessionId}/{at}` | `ABMetricSample` |
206
- * | `agentkit/v1/{agent}/ab-snapshot` | latest aggregate `ABSnapshot` |
277
+ *
278
+ * Eval-run and A/B history do not flow through this KV scheme — they have
279
+ * dedicated tables ({@link StorageConfig.evals} / {@link StorageConfig.abs}).
207
280
  */
208
281
  export const storageKeys = {
209
282
  session: (agent: string, sessionId: string): string =>
@@ -228,14 +301,6 @@ export const storageKeys = {
228
301
  `${STORAGE_KEY_ROOT}/${agent}/reminder/${reminderId}`,
229
302
  reminderPrefix: (agent: string): string =>
230
303
  `${STORAGE_KEY_ROOT}/${agent}/reminder/`,
231
- evalRun: (agent: string, runId: string): string =>
232
- `${STORAGE_KEY_ROOT}/${agent}/eval-run/${runId}`,
233
- evalRunPrefix: (agent: string): string =>
234
- `${STORAGE_KEY_ROOT}/${agent}/eval-run/`,
235
- abSample: (agent: string, sessionId: string, at: string): string =>
236
- `${STORAGE_KEY_ROOT}/${agent}/ab-sample/${sessionId}/${at}`,
237
- abSnapshot: (agent: string): string =>
238
- `${STORAGE_KEY_ROOT}/${agent}/ab-snapshot`,
239
304
  } as const;
240
305
 
241
306
  /**