@cursor/july 0.1.4 → 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 (182) 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.DF-Yx4OP.js → app.DMboGKUD.js} +1 -1
  8. package/dist/docs/assets/chunks/@localSearchIndexroot.O6eP7QZr.js +1 -0
  9. package/dist/docs/assets/chunks/{VPLocalSearchBox.DSeJSudL.js → VPLocalSearchBox.DkEqEnJU.js} +1 -1
  10. package/dist/docs/assets/chunks/{theme.DZVLTXOC.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.d.ts.map +1 -1
  98. package/dist/internal/cli-deploy.js +5 -2
  99. package/dist/internal/cursor-event-relay.d.ts +4 -1
  100. package/dist/internal/cursor-event-relay.d.ts.map +1 -1
  101. package/dist/internal/cursor-event-relay.js +6 -0
  102. package/dist/internal/cursor-relay-core.d.ts +36 -1
  103. package/dist/internal/cursor-relay-core.d.ts.map +1 -1
  104. package/dist/internal/cursor-relay-core.js +89 -8
  105. package/dist/internal/cursor-slack-relay.d.ts +2 -2
  106. package/dist/internal/cursor-slack-relay.d.ts.map +1 -1
  107. package/dist/internal/cursor-slack-relay.js +4 -0
  108. package/dist/internal/discovery.js +3 -3
  109. package/dist/internal/eval-run-store.d.ts +33 -30
  110. package/dist/internal/eval-run-store.d.ts.map +1 -1
  111. package/dist/internal/eval-run-store.js +84 -96
  112. package/dist/internal/init-project.d.ts.map +1 -1
  113. package/dist/internal/init-project.js +3 -2
  114. package/dist/internal/playground-proxy.d.ts +5 -5
  115. package/dist/internal/playground-proxy.js +3 -3
  116. package/dist/internal/resolve-prod-target.d.ts +30 -0
  117. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  118. package/dist/internal/resolve-prod-target.js +74 -2
  119. package/dist/internal/server.d.ts.map +1 -1
  120. package/dist/internal/server.js +5 -3
  121. package/dist/internal/session-engine.d.ts +1 -2
  122. package/dist/internal/session-engine.d.ts.map +1 -1
  123. package/dist/internal/session-engine.js +14 -31
  124. package/dist/internal/storage-coordinator.d.ts +16 -15
  125. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  126. package/dist/internal/storage-coordinator.js +73 -80
  127. package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
  128. package/dist/playground/assets/index-7GJIUFQj.css +1 -0
  129. package/dist/playground/assets/index-mux9aj5P.js +319 -0
  130. package/dist/playground/index.html +2 -2
  131. package/dist/storage.d.ts +51 -10
  132. package/dist/storage.d.ts.map +1 -1
  133. package/dist/storage.js +27 -10
  134. package/docs/README.md +34 -5
  135. package/docs/deployment.md +352 -149
  136. package/docs/example-agents/approval-buddy.md +270 -0
  137. package/docs/example-agents/benny.md +186 -0
  138. package/docs/example-agents/bugbot.md +231 -0
  139. package/docs/example-agents/codebase-wiki.md +174 -0
  140. package/docs/example-agents/codeowners-review.md +195 -0
  141. package/docs/example-agents/concierge.md +205 -0
  142. package/docs/example-agents/fsd.md +330 -0
  143. package/docs/example-agents/index.md +102 -0
  144. package/docs/example-agents/knowledge-base.md +171 -0
  145. package/docs/example-agents/security-reviewer.md +296 -0
  146. package/docs/example-agents/slack-agent.md +146 -0
  147. package/docs/example-agents/weather-agent.md +302 -0
  148. package/docs/reference/cli.md +546 -147
  149. package/package.json +1 -1
  150. package/src/ab.ts +9 -261
  151. package/src/bin/agent-serve.ts +14 -6
  152. package/src/evals.ts +4 -118
  153. package/src/index.ts +2 -0
  154. package/src/internal/ab-collector.ts +12 -22
  155. package/src/internal/ab-snapshot.ts +2 -4
  156. package/src/internal/cli-ax.ts +101 -45
  157. package/src/internal/cli-deploy.ts +5 -2
  158. package/src/internal/cursor-event-relay.ts +10 -1
  159. package/src/internal/cursor-relay-core.ts +115 -9
  160. package/src/internal/cursor-slack-relay.ts +6 -2
  161. package/src/internal/discovery.ts +2 -2
  162. package/src/internal/eval-run-store.ts +86 -100
  163. package/src/internal/init-project.ts +3 -2
  164. package/src/internal/playground-proxy.ts +5 -5
  165. package/src/internal/resolve-prod-target.ts +101 -3
  166. package/src/internal/server.ts +5 -3
  167. package/src/internal/session-engine.ts +9 -29
  168. package/src/internal/storage-coordinator.ts +109 -101
  169. package/src/storage.ts +79 -14
  170. package/dist/docs/assets/chunks/@localSearchIndexroot.0XrheBv2.js +0 -1
  171. package/dist/docs/assets/deployment.md.DTKwE15Z.js +0 -14
  172. package/dist/docs/assets/deployment.md.DTKwE15Z.lean.js +0 -1
  173. package/dist/docs/assets/index.md.Cylk70gg.js +0 -20
  174. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.js +0 -38
  175. package/dist/docs/assets/reference_cli.md.Bv6pOxcF.lean.js +0 -1
  176. package/dist/internal/json-dir-store.d.ts +0 -32
  177. package/dist/internal/json-dir-store.d.ts.map +0 -1
  178. package/dist/internal/json-dir-store.js +0 -100
  179. package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
  180. package/dist/playground/assets/index-Ct_Usdm8.css +0 -1
  181. package/dist/playground/assets/index-Dsyb-Vaj.js +0 -319
  182. package/src/internal/json-dir-store.ts +0 -109
@@ -10,9 +10,9 @@
10
10
  * failures — a throwing sink is logged and its write dropped; storage
11
11
  * must never stall or fail a turn.
12
12
  *
13
- * Scaling shape: sessions, reminders, evals, and A/Bs all reduce to keyed
14
- * puts on the same queue, so one author-owned sink covers every domain,
15
- * and new domains are new key prefixes not new config surface.
13
+ * Scaling shape: sessions and reminders reduce to keyed puts on the KV
14
+ * sink; eval runs and A/B metrics go to their dedicated tables
15
+ * (`evals` / `abs`). Everything shares one bounded, serialized queue.
16
16
  */
17
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -139,18 +139,10 @@ export class StorageCoordinator {
139
139
  const ops = [];
140
140
  const first = buffer.events[0];
141
141
  if (first !== undefined) {
142
- ops.push({
143
- op: "put",
144
- key: storageKeys.sessionEvents(this.agentName, sessionId, first.index),
145
- value: buffer.events,
146
- });
142
+ ops.push(this.putOp(storageKeys.sessionEvents(this.agentName, sessionId, first.index), buffer.events));
147
143
  }
148
144
  if (buffer.record !== undefined) {
149
- ops.push({
150
- op: "put",
151
- key: storageKeys.session(this.agentName, sessionId),
152
- value: buffer.record,
153
- });
145
+ ops.push(this.putOp(storageKeys.session(this.agentName, sessionId), buffer.record));
154
146
  ops.push(...this.continuationOps(buffer.record));
155
147
  }
156
148
  if (ops.length > 0) {
@@ -170,20 +162,27 @@ export class StorageCoordinator {
170
162
  this.continuationIndex.set(record.sessionId, next);
171
163
  const ops = [];
172
164
  if (previous != null) {
173
- ops.push({
174
- op: "delete",
175
- key: storageKeys.continuation(this.agentName, record.channelId, previous),
176
- });
165
+ ops.push(this.deleteOp(storageKeys.continuation(this.agentName, record.channelId, previous)));
177
166
  }
178
167
  if (next != null) {
179
- ops.push({
180
- op: "put",
181
- key: storageKeys.continuation(this.agentName, record.channelId, next),
182
- value: { sessionId: record.sessionId },
183
- });
168
+ ops.push(this.putOp(storageKeys.continuation(this.agentName, record.channelId, next), { sessionId: record.sessionId }));
184
169
  }
185
170
  return ops;
186
171
  }
172
+ /** KV upsert op on the sink's `put`. */
173
+ putOp(key, value) {
174
+ return {
175
+ label: `put(${key})`,
176
+ run: (ctx) => this.definition.put(key, value, ctx),
177
+ };
178
+ }
179
+ /** KV delete op on the sink's `delete` (skipped when the hook is absent). */
180
+ deleteOp(key) {
181
+ return {
182
+ label: `delete(${key})`,
183
+ run: (ctx) => { var _a, _b; return (_b = (_a = this.definition).delete) === null || _b === void 0 ? void 0 : _b.call(_a, key, ctx); },
184
+ };
185
+ }
187
186
  // ==========================================================================
188
187
  // Sessions (reads / restore)
189
188
  // ==========================================================================
@@ -279,11 +278,7 @@ export class StorageCoordinator {
279
278
  return;
280
279
  }
281
280
  this.enqueue([
282
- {
283
- op: "put",
284
- key: storageKeys.reminder(this.agentName, record.id),
285
- value: record,
286
- },
281
+ this.putOp(storageKeys.reminder(this.agentName, record.id), record),
287
282
  ], "policy");
288
283
  }
289
284
  /**
@@ -297,93 +292,97 @@ export class StorageCoordinator {
297
292
  });
298
293
  }
299
294
  // ==========================================================================
300
- // Evals
295
+ // Evals (dedicated `evals` table)
301
296
  // ==========================================================================
302
297
  /**
303
- * Adapter for {@link EvalRunPersistence} so the playground eval store
304
- * can fall back to this sink when `evals.config.ts` sets no
305
- * `persistRuns`.
298
+ * Adapter over the sink's dedicated `evals` table for the playground
299
+ * eval-run store. Undefined when the table is not configured — eval
300
+ * history then stays in process memory.
306
301
  */
307
- asEvalRunPersistence() {
302
+ evalRuns() {
303
+ const table = this.definition.evals;
304
+ if (table === undefined) {
305
+ return undefined;
306
+ }
308
307
  return {
309
- load: () => __awaiter(this, void 0, void 0, function* () {
310
- const entries = yield this.tryList(storageKeys.evalRunPrefix(this.agentName));
311
- return entries
312
- .map((entry) => entry.value)
313
- .filter((run) => run != null);
314
- }),
315
308
  save: (run) => {
309
+ // Clone at enqueue time: the store mutates snapshots in place as
310
+ // cases finish, and delivery is async.
311
+ const snapshot = structuredClone(run);
316
312
  this.enqueue([
317
313
  {
318
- op: "put",
319
- key: storageKeys.evalRun(this.agentName, run.runId),
320
- value: run,
314
+ label: `evals.put(${run.runId})`,
315
+ run: (ctx) => table.put(snapshot, ctx),
321
316
  },
322
317
  ], "policy");
323
318
  },
324
319
  delete: (runId) => {
325
320
  this.enqueue([
326
321
  {
327
- op: "delete",
328
- key: storageKeys.evalRun(this.agentName, runId),
322
+ label: `evals.delete(${runId})`,
323
+ run: (ctx) => table.delete(runId, ctx),
329
324
  },
330
325
  ], "policy");
331
326
  },
327
+ list: () => __awaiter(this, void 0, void 0, function* () {
328
+ try {
329
+ const runs = yield table.list(this.context("restore"));
330
+ return Array.isArray(runs) ? runs : [];
331
+ }
332
+ catch (error) {
333
+ this.logger(`[agentkit] storage evals.list() failed: ${describeError(error)}`);
334
+ return [];
335
+ }
336
+ }),
332
337
  };
333
338
  }
334
339
  // ==========================================================================
335
- // A/Bs
340
+ // A/Bs (dedicated `abs` table)
336
341
  // ==========================================================================
337
- /**
338
- * Adapter for {@link ABSamplePersistence} so the AB collector can fall
339
- * back to this sink when `ab.config.ts` sets no `persistSamples`.
340
- */
341
- asABSamplePersistence() {
342
- return {
343
- save: (sample) => {
344
- this.enqueue([
345
- {
346
- op: "put",
347
- key: storageKeys.abSample(this.agentName, sample.sessionId, sample.at),
348
- value: sample,
349
- },
350
- ], "policy");
342
+ /** Append one metric sample to the `abs` table (no-op without it). */
343
+ abSample(sample) {
344
+ const table = this.definition.abs;
345
+ if (this.closed || table === undefined) {
346
+ return;
347
+ }
348
+ this.enqueue([
349
+ {
350
+ label: `abs.putSample(${sample.sessionId})`,
351
+ run: (ctx) => table.putSample(sample, ctx),
351
352
  },
352
- };
353
+ ], "policy");
353
354
  }
354
355
  /**
355
356
  * Refresh the persisted aggregate A/B snapshot, throttled to once per
356
357
  * {@link AB_SNAPSHOT_MIN_INTERVAL_MS} (the playground recomputes the
357
- * fold on every `GET /v1/abs` poll).
358
+ * fold on every `GET /v1/abs` poll). No-op without `abs.putSnapshot`.
358
359
  */
359
360
  abSnapshot(snapshot) {
361
+ var _a;
362
+ const putSnapshot = (_a = this.definition.abs) === null || _a === void 0 ? void 0 : _a.putSnapshot;
360
363
  const now = Date.now();
361
364
  if (this.closed ||
365
+ putSnapshot === undefined ||
362
366
  now - this.lastAbSnapshotAt < AB_SNAPSHOT_MIN_INTERVAL_MS) {
363
367
  return;
364
368
  }
365
369
  this.lastAbSnapshotAt = now;
366
- this.enqueue([
367
- {
368
- op: "put",
369
- key: storageKeys.abSnapshot(this.agentName),
370
- value: snapshot,
371
- },
372
- ], "policy");
370
+ this.enqueue([{ label: "abs.putSnapshot", run: (ctx) => putSnapshot(snapshot, ctx) }], "policy");
373
371
  }
374
372
  /** Latest persisted aggregate A/B snapshot; errors read as absent. */
375
373
  getLatestAbSnapshot() {
376
374
  return __awaiter(this, void 0, void 0, function* () {
377
- const get = this.definition.get;
378
- if (get === undefined) {
375
+ var _a;
376
+ const getSnapshot = (_a = this.definition.abs) === null || _a === void 0 ? void 0 : _a.getSnapshot;
377
+ if (getSnapshot === undefined) {
379
378
  return undefined;
380
379
  }
381
380
  try {
382
- const value = yield get(storageKeys.abSnapshot(this.agentName), this.context("restore"));
383
- return value == null ? undefined : value;
381
+ const value = yield getSnapshot(this.context("restore"));
382
+ return value !== null && value !== void 0 ? value : undefined;
384
383
  }
385
384
  catch (error) {
386
- this.logger(`[agentkit] storage get(ab-snapshot) failed: ${describeError(error)}`);
385
+ this.logger(`[agentkit] storage abs.getSnapshot() failed: ${describeError(error)}`);
387
386
  return undefined;
388
387
  }
389
388
  });
@@ -474,18 +473,12 @@ export class StorageCoordinator {
474
473
  this.pending += ops.length;
475
474
  const ctx = this.context(reason);
476
475
  this.queue = this.queue.then(() => __awaiter(this, void 0, void 0, function* () {
477
- var _a, _b;
478
476
  for (const op of ops) {
479
477
  try {
480
- if (op.op === "put") {
481
- yield this.definition.put(op.key, op.value, ctx);
482
- }
483
- else {
484
- yield (_b = (_a = this.definition).delete) === null || _b === void 0 ? void 0 : _b.call(_a, op.key, ctx);
485
- }
478
+ yield op.run(ctx);
486
479
  }
487
480
  catch (error) {
488
- this.logger(`[agentkit] storage ${op.op}(${op.key}) failed: ${describeError(error)}`);
481
+ this.logger(`[agentkit] storage ${op.label} failed: ${describeError(error)}`);
489
482
  }
490
483
  finally {
491
484
  this.pending -= 1;