@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.
- package/dist/ab.d.ts +8 -95
- package/dist/ab.d.ts.map +1 -1
- package/dist/ab.js +9 -150
- package/dist/bin/agent-serve.js +41 -8
- package/dist/channels/slack/post-update-delivery.d.ts +85 -0
- package/dist/channels/slack/post-update-delivery.d.ts.map +1 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DabPG-io.js → app.COTN7wgo.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.B7UcKvIn.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.jmyr0bU0.js → VPLocalSearchBox.BW3TBdT0.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DysN9-VN.js → theme.BEJW0vE7.js} +2 -2
- package/dist/docs/assets/deployment.md.BtfEsc9S.js +55 -0
- package/dist/docs/assets/deployment.md.BtfEsc9S.lean.js +1 -0
- package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.js +10 -0
- package/dist/docs/assets/example-agents_approval-buddy.md.8R5phXb5.lean.js +1 -0
- package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.js +7 -0
- package/dist/docs/assets/example-agents_benny.md.B0gjhI-p.lean.js +1 -0
- package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.js +11 -0
- package/dist/docs/assets/example-agents_bugbot.md.DelIdhxB.lean.js +1 -0
- package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.js +8 -0
- package/dist/docs/assets/example-agents_codebase-wiki.md.DC6sgwn0.lean.js +1 -0
- package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.js +8 -0
- package/dist/docs/assets/example-agents_codeowners-review.md.Ku_tG2RY.lean.js +1 -0
- package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.js +23 -0
- package/dist/docs/assets/example-agents_concierge.md.4rQTSMXt.lean.js +1 -0
- package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.js +15 -0
- package/dist/docs/assets/example-agents_fsd.md.CzgUrDfi.lean.js +1 -0
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.js +2 -0
- package/dist/docs/assets/example-agents_index.md.CRqJlnIf.lean.js +1 -0
- package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.js +11 -0
- package/dist/docs/assets/example-agents_knowledge-base.md.BPJiVueF.lean.js +1 -0
- package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.js +19 -0
- package/dist/docs/assets/example-agents_security-reviewer.md.D2rtwDTO.lean.js +1 -0
- package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.js +5 -0
- package/dist/docs/assets/example-agents_slack-agent.md.buLbgvBf.lean.js +1 -0
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.js +24 -0
- package/dist/docs/assets/example-agents_weather-agent.md.C9Qv-W0o.lean.js +1 -0
- package/dist/docs/assets/index.md.COiu-1jL.js +20 -0
- package/dist/docs/assets/{index.md.Cylk70gg.lean.js → index.md.COiu-1jL.lean.js} +1 -1
- package/dist/docs/assets/reference_cli.md.D189RBCH.js +60 -0
- package/dist/docs/assets/reference_cli.md.D189RBCH.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +58 -17
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +34 -0
- package/dist/docs/example-agents/benny.html +31 -0
- package/dist/docs/example-agents/bugbot.html +35 -0
- package/dist/docs/example-agents/codebase-wiki.html +32 -0
- package/dist/docs/example-agents/codeowners-review.html +32 -0
- package/dist/docs/example-agents/concierge.html +47 -0
- package/dist/docs/example-agents/fsd.html +39 -0
- package/dist/docs/example-agents/index.html +26 -0
- package/dist/docs/example-agents/knowledge-base.html +35 -0
- package/dist/docs/example-agents/security-reviewer.html +43 -0
- package/dist/docs/example-agents/slack-agent.html +29 -0
- package/dist/docs/example-agents/weather-agent.html +48 -0
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +5 -5
- package/dist/docs/guides/github.html +4 -4
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +7 -7
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +52 -30
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/evals.d.ts +5 -62
- package/dist/evals.d.ts.map +1 -1
- package/dist/evals.js +3 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/ab-collector.d.ts +7 -5
- package/dist/internal/ab-collector.d.ts.map +1 -1
- package/dist/internal/ab-collector.js +3 -14
- package/dist/internal/ab-snapshot.d.ts +2 -4
- package/dist/internal/ab-snapshot.d.ts.map +1 -1
- package/dist/internal/cli-ax.d.ts +33 -5
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +428 -87
- package/dist/internal/cli-deploy.js +1 -1
- package/dist/internal/discovery.js +3 -3
- package/dist/internal/eval-run-store.d.ts +35 -30
- package/dist/internal/eval-run-store.d.ts.map +1 -1
- package/dist/internal/eval-run-store.js +88 -100
- package/dist/internal/evals-client.d.ts +96 -0
- package/dist/internal/evals-client.d.ts.map +1 -0
- package/dist/internal/evals-client.js +262 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +1 -0
- package/dist/internal/persistence-coordinator.d.ts +127 -0
- package/dist/internal/persistence-coordinator.d.ts.map +1 -0
- package/dist/internal/playground-proxy.d.ts +5 -5
- package/dist/internal/playground-proxy.js +3 -3
- package/dist/internal/resolve-prod-target.d.ts +30 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +74 -2
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +16 -5
- package/dist/internal/session-engine.d.ts +1 -2
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +14 -31
- package/dist/internal/storage-coordinator.d.ts +16 -15
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +73 -80
- package/dist/persistence.d.ts +184 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
- package/dist/playground/assets/index-72vCOBWO.js +86 -0
- package/dist/playground/assets/index-BjnMwYoR.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage.d.ts +51 -10
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +27 -10
- package/docs/README.md +34 -5
- package/docs/deployment.md +352 -149
- package/docs/example-agents/approval-buddy.md +270 -0
- package/docs/example-agents/benny.md +186 -0
- package/docs/example-agents/bugbot.md +231 -0
- package/docs/example-agents/codebase-wiki.md +174 -0
- package/docs/example-agents/codeowners-review.md +195 -0
- package/docs/example-agents/concierge.md +205 -0
- package/docs/example-agents/fsd.md +330 -0
- package/docs/example-agents/index.md +102 -0
- package/docs/example-agents/knowledge-base.md +171 -0
- package/docs/example-agents/security-reviewer.md +296 -0
- package/docs/example-agents/slack-agent.md +146 -0
- package/docs/example-agents/weather-agent.md +302 -0
- package/docs/reference/cli.md +546 -147
- package/package.json +1 -1
- package/src/ab.ts +9 -261
- package/src/bin/agent-serve.ts +46 -7
- package/src/evals.ts +5 -119
- package/src/index.ts +2 -0
- package/src/internal/ab-collector.ts +12 -22
- package/src/internal/ab-snapshot.ts +2 -4
- package/src/internal/cli-ax.ts +551 -104
- package/src/internal/cli-deploy.ts +1 -1
- package/src/internal/discovery.ts +2 -2
- package/src/internal/eval-run-store.ts +91 -100
- package/src/internal/evals-client.ts +431 -0
- package/src/internal/init-project.ts +1 -0
- package/src/internal/playground-proxy.ts +5 -5
- package/src/internal/resolve-prod-target.ts +101 -3
- package/src/internal/server.ts +17 -3
- package/src/internal/session-engine.ts +9 -29
- package/src/internal/storage-coordinator.ts +109 -101
- package/src/storage.ts +79 -14
- package/dist/docs/assets/chunks/@localSearchIndexroot.QwK5BtEH.js +0 -1
- package/dist/docs/assets/deployment.md.DTKwE15Z.js +0 -14
- package/dist/docs/assets/deployment.md.DTKwE15Z.lean.js +0 -1
- package/dist/docs/assets/index.md.Cylk70gg.js +0 -20
- package/dist/docs/assets/reference_cli.md.Bv6pOxcF.js +0 -38
- package/dist/docs/assets/reference_cli.md.Bv6pOxcF.lean.js +0 -1
- package/dist/internal/json-dir-store.js +0 -100
- package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
- package/dist/playground/assets/index-BEauYlII.css +0 -1
- package/dist/playground/assets/index-BtM0wEGg.js +0 -319
- package/src/internal/json-dir-store.ts +0 -109
package/dist/ab.d.ts
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Assignments and foldable metrics live in each session's `events.ndjson`
|
|
12
12
|
* (survive serve restart). Optional project defaults in `agent/ab.config.ts`
|
|
13
|
-
* ({@link defineABConfig})
|
|
14
|
-
*
|
|
15
|
-
* eval `persistRuns`.
|
|
13
|
+
* ({@link defineABConfig}) cap the playground fold window; durable
|
|
14
|
+
* sample/snapshot export lives on the `defineStorage` `abs` table.
|
|
16
15
|
*
|
|
17
16
|
* ```ts
|
|
18
17
|
* import { defineAB, splitBySessionHash } from "@anysphere/agent-serve/ab";
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
* });
|
|
31
30
|
* ```
|
|
32
31
|
*/
|
|
33
|
-
import type { ABSnapshot } from "./internal/ab-snapshot.js";
|
|
34
32
|
import type { SessionEvent, SessionInfo } from "./types.js";
|
|
35
33
|
export type { ABSnapshot } from "./internal/ab-snapshot.js";
|
|
36
34
|
export interface ABVariantMeta {
|
|
@@ -170,88 +168,29 @@ export declare function mergeABInstructions(base: string | undefined, abs: Reado
|
|
|
170
168
|
export declare const AB_DEFAULT_MAX_PLAYGROUND_SESSIONS = 200;
|
|
171
169
|
/** Hard ceiling for {@link ABConfigFile.maxPlaygroundSessions}. */
|
|
172
170
|
export declare const AB_MAX_PLAYGROUND_SESSIONS = 10000;
|
|
173
|
-
/** Default snapshot files kept when {@link ABConfigFile.persistSnapshots} is set. */
|
|
174
|
-
export declare const AB_DEFAULT_RETAIN_SNAPSHOTS = 20;
|
|
175
|
-
/** Hard ceiling for {@link ABConfigFile.retainSnapshots}. */
|
|
176
|
-
export declare const AB_MAX_RETAIN_SNAPSHOTS = 500;
|
|
177
|
-
/** Context passed to A/B persistence hooks. */
|
|
178
|
-
export interface ABPersistContext {
|
|
179
|
-
/** Absolute agent project root (directory that contains `agent/`). */
|
|
180
|
-
projectRoot: string;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Durable sink for {@link ABMetricSample} rows (same payload as
|
|
184
|
-
* {@link ABConfig.onSample}). Session `events.ndjson` remains the source of
|
|
185
|
-
* truth for assignment + fold; this is for analytics export.
|
|
186
|
-
*/
|
|
187
|
-
export interface ABSamplePersistence {
|
|
188
|
-
save(sample: ABMetricSample, ctx: ABPersistContext): void | Promise<void>;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Durable store for playground-style aggregate snapshots (`GET /v1/abs`).
|
|
192
|
-
* Without this, aggregates are always recomputed from session logs (nothing
|
|
193
|
-
* is kept after sessions are pruned).
|
|
194
|
-
*
|
|
195
|
-
* **Runtime note:** `serve` currently only calls {@link save} (after each
|
|
196
|
-
* `GET /v1/abs`). {@link load} / {@link delete} are for author tooling or a
|
|
197
|
-
* custom store; they are not wired into the playground hydrate path.
|
|
198
|
-
*/
|
|
199
|
-
export interface ABSnapshotPersistence {
|
|
200
|
-
load(ctx: ABPersistContext): ABSnapshot[] | Promise<ABSnapshot[]>;
|
|
201
|
-
save(snapshot: ABSnapshot, ctx: ABPersistContext): void | Promise<void>;
|
|
202
|
-
delete?(snapshotId: string, ctx: ABPersistContext): void | Promise<void>;
|
|
203
|
-
}
|
|
204
171
|
/**
|
|
205
172
|
* Project-wide A/B defaults (`agent/ab.config.ts`).
|
|
206
173
|
*
|
|
207
174
|
* **Assignments and foldable metrics** already persist in each session's
|
|
208
|
-
* `events.ndjson` under `--state-root
|
|
209
|
-
*
|
|
210
|
-
*
|
|
175
|
+
* `events.ndjson` under `--state-root`; durable sample/snapshot export
|
|
176
|
+
* lives on the `defineStorage` `abs` table (`agent/storage.ts`). This
|
|
177
|
+
* config only caps how many sessions the playground / `GET /v1/abs` folds.
|
|
211
178
|
*/
|
|
212
179
|
export interface ABConfigFile {
|
|
213
180
|
/**
|
|
214
181
|
* Optional. Max newest sessions folded into **`GET /v1/abs` / the A/Bs
|
|
215
|
-
* tab
|
|
216
|
-
* session logs, change assignment, or limit {@link persistSamples}.
|
|
182
|
+
* tab**. Does not prune session logs or change assignment.
|
|
217
183
|
*
|
|
218
184
|
* Default {@link AB_DEFAULT_MAX_PLAYGROUND_SESSIONS}; hard-capped at
|
|
219
185
|
* {@link AB_MAX_PLAYGROUND_SESSIONS}.
|
|
220
186
|
*/
|
|
221
187
|
maxPlaygroundSessions?: number;
|
|
222
|
-
/**
|
|
223
|
-
* Snapshot-file budget when {@link persistSnapshots} is set.
|
|
224
|
-
* Default {@link AB_DEFAULT_RETAIN_SNAPSHOTS}; hard-capped at
|
|
225
|
-
* {@link AB_MAX_RETAIN_SNAPSHOTS}.
|
|
226
|
-
*
|
|
227
|
-
* When using {@link persistABSnapshotsToDir}, this value controls on-disk
|
|
228
|
-
* pruning (overriding the helper's `{ retain }` default). Custom stores
|
|
229
|
-
* should apply the same budget themselves.
|
|
230
|
-
*/
|
|
231
|
-
retainSnapshots?: number;
|
|
232
|
-
/**
|
|
233
|
-
* Optional sink for cumulative metric samples (in addition to each
|
|
234
|
-
* experiment's {@link ABConfig.onSample}).
|
|
235
|
-
*
|
|
236
|
-
* ```ts
|
|
237
|
-
* persistSamples: persistABSamplesToDir(".agent-serve/ab-samples"),
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
|
-
persistSamples?: ABSamplePersistence;
|
|
241
|
-
/**
|
|
242
|
-
* Optional store for aggregate snapshots written when `GET /v1/abs` runs.
|
|
243
|
-
*
|
|
244
|
-
* ```ts
|
|
245
|
-
* persistSnapshots: persistABSnapshotsToDir(".agent-serve/ab-snapshots"),
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
persistSnapshots?: ABSnapshotPersistence;
|
|
249
188
|
}
|
|
250
189
|
/**
|
|
251
190
|
* Defaults for every experiment under `agent/ab*` (`agent/ab.config.ts`).
|
|
252
191
|
*
|
|
253
|
-
* Session event logs remain the assignment/metrics source of truth;
|
|
254
|
-
*
|
|
192
|
+
* Session event logs remain the assignment/metrics source of truth;
|
|
193
|
+
* durable exports go through the `defineStorage` `abs` table.
|
|
255
194
|
*/
|
|
256
195
|
export declare function defineABConfig(config: ABConfigFile): ABConfigFile;
|
|
257
196
|
/** Validate {@link ABConfigFile.maxPlaygroundSessions}. */
|
|
@@ -261,30 +200,4 @@ export declare function normalizeABMaxPlaygroundSessions(value: unknown): number
|
|
|
261
200
|
* {@link AB_DEFAULT_MAX_PLAYGROUND_SESSIONS}.
|
|
262
201
|
*/
|
|
263
202
|
export declare function resolveABMaxPlaygroundSessions(value: unknown): number;
|
|
264
|
-
/** Validate {@link ABConfigFile.retainSnapshots}. */
|
|
265
|
-
export declare function normalizeABRetainSnapshots(value: unknown): number;
|
|
266
|
-
/**
|
|
267
|
-
* Append-only NDJSON {@link ABSamplePersistence} under `dir` (relative to
|
|
268
|
-
* the agent project root).
|
|
269
|
-
*
|
|
270
|
-
* ```ts
|
|
271
|
-
* // agent/ab.config.ts
|
|
272
|
-
* export default defineABConfig({
|
|
273
|
-
* persistSamples: persistABSamplesToDir(".agent-serve/ab-samples"),
|
|
274
|
-
* });
|
|
275
|
-
* ```
|
|
276
|
-
*/
|
|
277
|
-
export declare function persistABSamplesToDir(dir: string): ABSamplePersistence;
|
|
278
|
-
/**
|
|
279
|
-
* Filesystem {@link ABSnapshotPersistence}: one JSON file per snapshot under
|
|
280
|
-
* `dir`, pruned to `retain` files (default {@link AB_DEFAULT_RETAIN_SNAPSHOTS}).
|
|
281
|
-
*
|
|
282
|
-
* Prefer setting {@link ABConfigFile.retainSnapshots} in `defineABConfig` —
|
|
283
|
-
* that value is applied to this helper's prune budget. Pass `{ retain }` here
|
|
284
|
-
* only when constructing the helper outside `defineABConfig`, or as a default
|
|
285
|
-
* that `retainSnapshots` may override.
|
|
286
|
-
*/
|
|
287
|
-
export declare function persistABSnapshotsToDir(dir: string, options?: {
|
|
288
|
-
retain?: number;
|
|
289
|
-
}): ABSnapshotPersistence;
|
|
290
203
|
//# sourceMappingURL=ab.d.ts.map
|
package/dist/ab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ab.d.ts","sourceRoot":"","sources":["../src/ab.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ab.d.ts","sourceRoot":"","sources":["../src/ab.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,KAAK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M,GAAG,IAAI,CAAC,CAAC,GAAG,SAAS,EACxD,WAAW,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,YAAY,CAAA;CAAE,CAAC,GACrE,MAAM,GAAG,SAAS,CAsBpB;AAMD,iEAAiE;AACjE,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,mEAAmE;AACnE,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAMjE;AAED,2DAA2D;AAC3D,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKvE;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASrE"}
|
package/dist/ab.js
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Assignments and foldable metrics live in each session's `events.ndjson`
|
|
12
12
|
* (survive serve restart). Optional project defaults in `agent/ab.config.ts`
|
|
13
|
-
* ({@link defineABConfig})
|
|
14
|
-
*
|
|
15
|
-
* eval `persistRuns`.
|
|
13
|
+
* ({@link defineABConfig}) cap the playground fold window; durable
|
|
14
|
+
* sample/snapshot export lives on the `defineStorage` `abs` table.
|
|
16
15
|
*
|
|
17
16
|
* ```ts
|
|
18
17
|
* import { defineAB, splitBySessionHash } from "@anysphere/agent-serve/ab";
|
|
@@ -39,12 +38,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
39
38
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
39
|
});
|
|
41
40
|
};
|
|
42
|
-
import { randomUUID } from "node:crypto";
|
|
43
|
-
import { appendFile, mkdir } from "node:fs/promises";
|
|
44
|
-
import { join } from "node:path";
|
|
45
41
|
import { normalizePositiveInt } from "./internal/bounded-int.js";
|
|
46
42
|
import { brandDefinition } from "./internal/brand.js";
|
|
47
|
-
import { assertNonEmptyDir, deleteFileInDir, listJsonBasenames, readJsonDir, resolveProjectRelativeDir, writeJsonFile, } from "./internal/json-dir-store.js";
|
|
48
43
|
/** Sticky hash of session id → arm (recommended default). */
|
|
49
44
|
export function splitBySessionHash(options) {
|
|
50
45
|
assertHoldout(options === null || options === void 0 ? void 0 : options.holdout);
|
|
@@ -208,42 +203,23 @@ export function mergeABInstructions(base, abs, experiments) {
|
|
|
208
203
|
: `${baseText}\n\n${extras.join("\n\n")}`;
|
|
209
204
|
}
|
|
210
205
|
// ---------------------------------------------------------------------------
|
|
211
|
-
// Project config (`agent/ab.config.ts`) — fold window
|
|
206
|
+
// Project config (`agent/ab.config.ts`) — playground fold window
|
|
212
207
|
// ---------------------------------------------------------------------------
|
|
213
208
|
/** Default sessions folded into `GET /v1/abs` / the A/Bs tab. */
|
|
214
209
|
export const AB_DEFAULT_MAX_PLAYGROUND_SESSIONS = 200;
|
|
215
210
|
/** Hard ceiling for {@link ABConfigFile.maxPlaygroundSessions}. */
|
|
216
211
|
export const AB_MAX_PLAYGROUND_SESSIONS = 10000;
|
|
217
|
-
/** Default snapshot files kept when {@link ABConfigFile.persistSnapshots} is set. */
|
|
218
|
-
export const AB_DEFAULT_RETAIN_SNAPSHOTS = 20;
|
|
219
|
-
/** Hard ceiling for {@link ABConfigFile.retainSnapshots}. */
|
|
220
|
-
export const AB_MAX_RETAIN_SNAPSHOTS = 500;
|
|
221
|
-
/** Lets {@link defineABConfig} push `retainSnapshots` into {@link persistABSnapshotsToDir}. */
|
|
222
|
-
const abSnapshotRetainState = new WeakMap();
|
|
223
212
|
/**
|
|
224
213
|
* Defaults for every experiment under `agent/ab*` (`agent/ab.config.ts`).
|
|
225
214
|
*
|
|
226
|
-
* Session event logs remain the assignment/metrics source of truth;
|
|
227
|
-
*
|
|
215
|
+
* Session event logs remain the assignment/metrics source of truth;
|
|
216
|
+
* durable exports go through the `defineStorage` `abs` table.
|
|
228
217
|
*/
|
|
229
218
|
export function defineABConfig(config) {
|
|
230
|
-
var _a
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
? abSnapshotRetainState.get(persistSnapshots)
|
|
235
|
-
: undefined;
|
|
236
|
-
let retainSnapshots;
|
|
237
|
-
if (config.retainSnapshots !== undefined) {
|
|
238
|
-
retainSnapshots = normalizeABRetainSnapshots(config.retainSnapshots);
|
|
239
|
-
if (helperRetain !== undefined) {
|
|
240
|
-
helperRetain.retain = retainSnapshots;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
else if (persistSnapshots !== undefined) {
|
|
244
|
-
retainSnapshots = (_a = helperRetain === null || helperRetain === void 0 ? void 0 : helperRetain.retain) !== null && _a !== void 0 ? _a : normalizeABRetainSnapshots(AB_DEFAULT_RETAIN_SNAPSHOTS);
|
|
245
|
-
}
|
|
246
|
-
return Object.assign(Object.assign(Object.assign({ maxPlaygroundSessions: normalizeABMaxPlaygroundSessions((_b = config.maxPlaygroundSessions) !== null && _b !== void 0 ? _b : AB_DEFAULT_MAX_PLAYGROUND_SESSIONS) }, (retainSnapshots === undefined ? {} : { retainSnapshots })), (persistSamples === undefined ? {} : { persistSamples })), (persistSnapshots === undefined ? {} : { persistSnapshots }));
|
|
219
|
+
var _a;
|
|
220
|
+
return {
|
|
221
|
+
maxPlaygroundSessions: normalizeABMaxPlaygroundSessions((_a = config.maxPlaygroundSessions) !== null && _a !== void 0 ? _a : AB_DEFAULT_MAX_PLAYGROUND_SESSIONS),
|
|
222
|
+
};
|
|
247
223
|
}
|
|
248
224
|
/** Validate {@link ABConfigFile.maxPlaygroundSessions}. */
|
|
249
225
|
export function normalizeABMaxPlaygroundSessions(value) {
|
|
@@ -267,120 +243,3 @@ export function resolveABMaxPlaygroundSessions(value) {
|
|
|
267
243
|
return AB_DEFAULT_MAX_PLAYGROUND_SESSIONS;
|
|
268
244
|
}
|
|
269
245
|
}
|
|
270
|
-
/** Validate {@link ABConfigFile.retainSnapshots}. */
|
|
271
|
-
export function normalizeABRetainSnapshots(value) {
|
|
272
|
-
return normalizePositiveInt(value, {
|
|
273
|
-
label: "ab.config.ts: retainSnapshots",
|
|
274
|
-
max: AB_MAX_RETAIN_SNAPSHOTS,
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
function normalizeSamplePersistence(value) {
|
|
278
|
-
if (value === undefined) {
|
|
279
|
-
return undefined;
|
|
280
|
-
}
|
|
281
|
-
if (typeof value !== "object" ||
|
|
282
|
-
value === null ||
|
|
283
|
-
typeof value.save !== "function") {
|
|
284
|
-
throw new Error("ab.config.ts: persistSamples must define save(sample, ctx)");
|
|
285
|
-
}
|
|
286
|
-
return value;
|
|
287
|
-
}
|
|
288
|
-
function normalizeSnapshotPersistence(value) {
|
|
289
|
-
if (value === undefined) {
|
|
290
|
-
return undefined;
|
|
291
|
-
}
|
|
292
|
-
if (typeof value !== "object" ||
|
|
293
|
-
value === null ||
|
|
294
|
-
typeof value.load !== "function" ||
|
|
295
|
-
typeof value.save !== "function") {
|
|
296
|
-
throw new Error("ab.config.ts: persistSnapshots must define load(ctx) and save(snapshot, ctx)");
|
|
297
|
-
}
|
|
298
|
-
if (value.delete !== undefined && typeof value.delete !== "function") {
|
|
299
|
-
throw new Error("ab.config.ts: persistSnapshots.delete must be a function");
|
|
300
|
-
}
|
|
301
|
-
return value;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Append-only NDJSON {@link ABSamplePersistence} under `dir` (relative to
|
|
305
|
-
* the agent project root).
|
|
306
|
-
*
|
|
307
|
-
* ```ts
|
|
308
|
-
* // agent/ab.config.ts
|
|
309
|
-
* export default defineABConfig({
|
|
310
|
-
* persistSamples: persistABSamplesToDir(".agent-serve/ab-samples"),
|
|
311
|
-
* });
|
|
312
|
-
* ```
|
|
313
|
-
*/
|
|
314
|
-
export function persistABSamplesToDir(dir) {
|
|
315
|
-
const relativeDir = assertNonEmptyDir(dir, "persistABSamplesToDir");
|
|
316
|
-
const resolveDir = (projectRoot) => resolveProjectRelativeDir({ dir: relativeDir, projectRoot });
|
|
317
|
-
return {
|
|
318
|
-
save(sample, ctx) {
|
|
319
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
-
const root = resolveDir(ctx.projectRoot);
|
|
321
|
-
yield mkdir(root, { recursive: true });
|
|
322
|
-
yield appendFile(join(root, "samples.ndjson"), `${JSON.stringify(sample)}\n`, "utf8");
|
|
323
|
-
});
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Filesystem {@link ABSnapshotPersistence}: one JSON file per snapshot under
|
|
329
|
-
* `dir`, pruned to `retain` files (default {@link AB_DEFAULT_RETAIN_SNAPSHOTS}).
|
|
330
|
-
*
|
|
331
|
-
* Prefer setting {@link ABConfigFile.retainSnapshots} in `defineABConfig` —
|
|
332
|
-
* that value is applied to this helper's prune budget. Pass `{ retain }` here
|
|
333
|
-
* only when constructing the helper outside `defineABConfig`, or as a default
|
|
334
|
-
* that `retainSnapshots` may override.
|
|
335
|
-
*/
|
|
336
|
-
export function persistABSnapshotsToDir(dir, options) {
|
|
337
|
-
var _a;
|
|
338
|
-
const relativeDir = assertNonEmptyDir(dir, "persistABSnapshotsToDir");
|
|
339
|
-
const retainState = {
|
|
340
|
-
retain: normalizeABRetainSnapshots((_a = options === null || options === void 0 ? void 0 : options.retain) !== null && _a !== void 0 ? _a : AB_DEFAULT_RETAIN_SNAPSHOTS),
|
|
341
|
-
};
|
|
342
|
-
const resolveDir = (projectRoot) => resolveProjectRelativeDir({ dir: relativeDir, projectRoot });
|
|
343
|
-
let saveChain = Promise.resolve();
|
|
344
|
-
const persist = {
|
|
345
|
-
load(ctx) {
|
|
346
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
return readJsonDir(resolveDir(ctx.projectRoot), {
|
|
348
|
-
sortBasenames: "desc",
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
},
|
|
352
|
-
save(snapshot, ctx) {
|
|
353
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
354
|
-
const run = () => __awaiter(this, void 0, void 0, function* () {
|
|
355
|
-
var _a;
|
|
356
|
-
var _b;
|
|
357
|
-
const root = resolveDir(ctx.projectRoot);
|
|
358
|
-
const snapshotId = (_b = (_a = snapshot.config) === null || _a === void 0 ? void 0 : _a.snapshotId) !== null && _b !== void 0 ? _b : `absnap_${randomUUID().replace(/-/g, "")}`;
|
|
359
|
-
const toWrite = Object.assign(Object.assign({}, snapshot), { config: Object.assign(Object.assign({}, snapshot.config), { snapshotId }) });
|
|
360
|
-
yield writeJsonFile({
|
|
361
|
-
root,
|
|
362
|
-
fileName: `${snapshotId}.json`,
|
|
363
|
-
value: toWrite,
|
|
364
|
-
});
|
|
365
|
-
const names = (yield listJsonBasenames(root)).sort().reverse();
|
|
366
|
-
for (const stale of names.slice(retainState.retain)) {
|
|
367
|
-
yield deleteFileInDir({ root, fileName: stale });
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
const next = saveChain.then(run, run);
|
|
371
|
-
saveChain = next.then(() => undefined, () => undefined);
|
|
372
|
-
yield next;
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
delete(snapshotId, ctx) {
|
|
376
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
377
|
-
yield deleteFileInDir({
|
|
378
|
-
root: resolveDir(ctx.projectRoot),
|
|
379
|
-
fileName: `${snapshotId}.json`,
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
},
|
|
383
|
-
};
|
|
384
|
-
abSnapshotRetainState.set(persist, retainState);
|
|
385
|
-
return persist;
|
|
386
|
-
}
|
package/dist/bin/agent-serve.js
CHANGED
|
@@ -27,7 +27,7 @@ import { resolve } from "node:path";
|
|
|
27
27
|
import { parseArgs } from "node:util";
|
|
28
28
|
import { formatDiagnostics, projectInfo, resolveAgentMounts, serve, } from "../index.js";
|
|
29
29
|
import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
|
|
30
|
-
import { cmdCall, cmdChat, cmdEval, cmdInit, cmdLogs, cmdPlayground, cmdResume, cmdRun, cmdSession, cmdSessions, cmdTrajectory, } from "../internal/cli-ax.js";
|
|
30
|
+
import { cmdCall, cmdChat, cmdEval, cmdEvalStatus, cmdInit, cmdLogs, cmdPlayground, cmdResume, cmdRun, cmdSession, cmdSessions, cmdTrajectory, } from "../internal/cli-ax.js";
|
|
31
31
|
import { cmdDeploy, cmdDeploymentStatus, cmdDeployments, cmdRotatePodCredential, cmdRotateToken, cmdSecretsList, cmdSecretsSet, cmdSecretsUnset, cmdStop, } from "../internal/cli-deploy.js";
|
|
32
32
|
import { CLI_COMMAND_NAME as CLI } from "../internal/distribution.js";
|
|
33
33
|
import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
|
|
@@ -67,8 +67,11 @@ Usage:
|
|
|
67
67
|
${CLI} init [dir] [--json]
|
|
68
68
|
${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
|
|
69
69
|
[--tag <tag>]... [--verbose] [--timeout-ms <n>]
|
|
70
|
-
[--no-stream] [--
|
|
70
|
+
[--no-stream] [--no-wait]
|
|
71
|
+
[--prod | --url <baseUrl>] [--slug <slug>]
|
|
71
72
|
[--team <id>]
|
|
73
|
+
${CLI} eval status [runId] --prod|--url <baseUrl> [--dir <path>] [--json]
|
|
74
|
+
[--slug <slug>] [--team <id>]
|
|
72
75
|
${CLI} info [--dir <path>] [--json]
|
|
73
76
|
${CLI} validate [--dir <path>]
|
|
74
77
|
${CLI} login [--api-key <key>] [--key-name <name>]
|
|
@@ -132,9 +135,19 @@ Commands:
|
|
|
132
135
|
machine-readable and never blocks on login. No directory:
|
|
133
136
|
print the setup guide.
|
|
134
137
|
eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
Default: ephemeral local harness against evals on disk. Pass
|
|
139
|
+
--prod to kick off the batch on the team's hosted deployment
|
|
140
|
+
(slug from --slug or the directory name) via /v1/dev/evals/runs
|
|
141
|
+
so results appear in the playground and persist when the agent
|
|
142
|
+
declares an evals storage table; or --url for a running server
|
|
143
|
+
(same server-side path). With --prod/--url, pass --no-wait to
|
|
144
|
+
return the runId immediately without polling; check later with
|
|
145
|
+
\`${CLI} eval status <runId> --prod\` (omit runId to list recent
|
|
146
|
+
runs; exit 3 while still running). The status subcommand only
|
|
147
|
+
binds when --prod/--url is set, so an eval id named status still
|
|
148
|
+
runs locally. Pass evalId args to select: one datapoint
|
|
149
|
+
(weather/nyc), a whole file (weather → all cases in that file),
|
|
150
|
+
several of either, or omit to run all.
|
|
138
151
|
info Print the discovered agent surface (tools, skills, channels, ...).
|
|
139
152
|
validate Check the project(s) and exit non-zero on error diagnostics.
|
|
140
153
|
login Sign the host in to Cursor: browser sign-in mints a named,
|
|
@@ -170,6 +183,7 @@ Agent loop:
|
|
|
170
183
|
${CLI} info --dir . --json
|
|
171
184
|
${CLI} run --dir . --message "..."
|
|
172
185
|
${CLI} eval --dir .
|
|
186
|
+
${CLI} eval --prod --dir .
|
|
173
187
|
${CLI} dev .
|
|
174
188
|
|
|
175
189
|
Options:
|
|
@@ -208,12 +222,14 @@ Options:
|
|
|
208
222
|
--prod chat/resume/run/call/eval/logs/sessions/session/playground:
|
|
209
223
|
use the team's hosted deployment. Slug from --slug or the
|
|
210
224
|
--dir basename. Mutually exclusive with --url. Requires
|
|
211
|
-
\`${CLI} login\`.
|
|
225
|
+
\`${CLI} login\`. For eval, this is how you opt into the
|
|
226
|
+
persisted server-side batch (default is local).
|
|
212
227
|
--once logs: print current progress / log buffer once and exit
|
|
213
228
|
(default is to follow).
|
|
214
229
|
--print playground: print the URL only; do not open a browser.
|
|
215
|
-
--no-wait deploy/stop: return right after the request is
|
|
216
|
-
instead of polling until a terminal status.
|
|
230
|
+
--no-wait deploy/stop/eval: return right after the request is
|
|
231
|
+
accepted instead of polling until a terminal status.
|
|
232
|
+
For eval, prints the runId (deployment / --url only).
|
|
217
233
|
--no-playground Disable the bundled web playground at /playground (also skips
|
|
218
234
|
auto-build / HMR).
|
|
219
235
|
--no-docs Disable the documentation site at /docs (also skips its
|
|
@@ -544,6 +560,21 @@ function main(argv) {
|
|
|
544
560
|
}));
|
|
545
561
|
}
|
|
546
562
|
case "eval": {
|
|
563
|
+
// Remote status subcommand only when targeting --prod/--url. Otherwise
|
|
564
|
+
// the bare token "status" is a normal eval id (evals/status.eval.ts).
|
|
565
|
+
if (positionals[0] === "status" &&
|
|
566
|
+
(values.prod === true || values.url !== undefined)) {
|
|
567
|
+
return cmdEvalStatus(positionals[1], axFromOptions({
|
|
568
|
+
dir,
|
|
569
|
+
json: values.json,
|
|
570
|
+
url: values.url,
|
|
571
|
+
prod: values.prod,
|
|
572
|
+
team: values.team,
|
|
573
|
+
apiKey: values["api-key"],
|
|
574
|
+
slug: values.slug,
|
|
575
|
+
bearerToken: values["bearer-token"],
|
|
576
|
+
}));
|
|
577
|
+
}
|
|
547
578
|
return cmdEval(axFromOptions({
|
|
548
579
|
dir,
|
|
549
580
|
evalIds: positionals,
|
|
@@ -553,6 +584,7 @@ function main(argv) {
|
|
|
553
584
|
tags: values.tag,
|
|
554
585
|
url: values.url,
|
|
555
586
|
prod: values.prod,
|
|
587
|
+
noWait: values["no-wait"],
|
|
556
588
|
team: values.team,
|
|
557
589
|
apiKey: values["api-key"],
|
|
558
590
|
slug: values.slug,
|
|
@@ -863,6 +895,7 @@ function axFromOptions(partial) {
|
|
|
863
895
|
toolInput: partial.toolInput,
|
|
864
896
|
url: partial.url,
|
|
865
897
|
prod: partial.prod,
|
|
898
|
+
noWait: partial.noWait,
|
|
866
899
|
team: partial.team,
|
|
867
900
|
apiKey: partial.apiKey,
|
|
868
901
|
fetchImpl: partial.fetchImpl,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live-reply delivery strategies for the Slack default handlers.
|
|
3
|
+
*
|
|
4
|
+
* A single strategy owns how an in-progress reply is opened, updated,
|
|
5
|
+
* finalized, and cleaned up so the handlers in `defaults.ts` don't fork on the
|
|
6
|
+
* delivery mode at every event:
|
|
7
|
+
*
|
|
8
|
+
* - `stream`: Slack chat.startStream / appendStream / stopStream.
|
|
9
|
+
* - `post-update`: a chat.postMessage skeleton edited with chat.update. This is
|
|
10
|
+
* the only path that preserves Cursor-account identity pinning (which only
|
|
11
|
+
* covers postMessage).
|
|
12
|
+
*
|
|
13
|
+
* `buildDefaultEvents` selects one via {@link selectLiveDeliveryStrategy} up
|
|
14
|
+
* front and calls into it. All calls keep the same soft-fail / log behavior as
|
|
15
|
+
* the inlined logic they replaced.
|
|
16
|
+
*/
|
|
17
|
+
import type { ChannelEventContext } from "../../types.js";
|
|
18
|
+
import type { SlackLog } from "./log.js";
|
|
19
|
+
import type { SlackBotToken, SlackChannelState } from "./types.js";
|
|
20
|
+
type SlackChannel = ChannelEventContext<SlackChannelState>;
|
|
21
|
+
export interface LiveDeliveryDeps {
|
|
22
|
+
botToken: SlackBotToken | undefined;
|
|
23
|
+
getLog: () => SlackLog;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How the default handlers deliver an in-progress reply. Methods write live
|
|
27
|
+
* delivery state (`streamTs`, `streamChannelId`, `lastPostedText`,
|
|
28
|
+
* `lastPostUpdateAtMs`, `streamingUnavailable`) on `channel.state` directly.
|
|
29
|
+
*/
|
|
30
|
+
export interface LiveDeliveryStrategy {
|
|
31
|
+
/** True when tool-call thinking steps can be appended to the live message. */
|
|
32
|
+
readonly inlineToolSteps: boolean;
|
|
33
|
+
/** Open the live message (skeleton post / stream start). */
|
|
34
|
+
start(args: {
|
|
35
|
+
channel: SlackChannel;
|
|
36
|
+
channelId: string;
|
|
37
|
+
threadTs: string;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
/** Push the latest cumulative text to the live message (throttled). */
|
|
41
|
+
append(args: {
|
|
42
|
+
channel: SlackChannel;
|
|
43
|
+
channelId: string;
|
|
44
|
+
streamTs: string;
|
|
45
|
+
text: string;
|
|
46
|
+
sessionId: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Flush the final reply text. `delivered` is false only when the caller must
|
|
50
|
+
* post the full reply as a fresh message (finalize failed on partial text).
|
|
51
|
+
*/
|
|
52
|
+
finalize(args: {
|
|
53
|
+
channel: SlackChannel;
|
|
54
|
+
channelId: string;
|
|
55
|
+
streamTs: string;
|
|
56
|
+
text: string;
|
|
57
|
+
sessionId: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
delivered: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
/** Close the live message when the turn produced no final text. */
|
|
62
|
+
finalizeEmpty(args: {
|
|
63
|
+
channel: SlackChannel;
|
|
64
|
+
channelId: string;
|
|
65
|
+
streamTs: string;
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
/** Best-effort remove a live message left open after the turn ended. */
|
|
68
|
+
cleanupOrphan(args: {
|
|
69
|
+
channel: SlackChannel;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
/** Deliver the error text into the live message; `delivered` gates a fallback post. */
|
|
72
|
+
fail(args: {
|
|
73
|
+
channel: SlackChannel;
|
|
74
|
+
channelId: string;
|
|
75
|
+
streamTs: string;
|
|
76
|
+
errorText: string;
|
|
77
|
+
sessionId: string;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
delivered: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
/** Pick the live-reply delivery strategy for a `buildDefaultEvents` instance. */
|
|
83
|
+
export declare function selectLiveDeliveryStrategy(deps: LiveDeliveryDeps, usePostUpdate: boolean): LiveDeliveryStrategy;
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=post-update-delivery.d.ts.map
|
|
@@ -0,0 +1 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B,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpC,mEAAmE;IACnE,aAAa,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,YAAY,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,wEAAwE;IACxE,aAAa,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,uFAAuF;IACvF,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,YAAY,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrC;AA6RD,iFAAiF;AACjF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,OAAO,GACrB,oBAAoB,CAItB"}
|
package/dist/docs/404.html
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.Bj-IXa5W.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.COTN7wgo.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
14
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
15
15
|
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="app"></div>
|
|
19
|
-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"ab.md\":\"BMCZ6Hd7\",\"building-with-agents.md\":\"CJCtZCyi\",\"concepts.md\":\"Cfb9b-k1\",\"deployment.md\":\"
|
|
19
|
+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"ab.md\":\"BMCZ6Hd7\",\"building-with-agents.md\":\"CJCtZCyi\",\"concepts.md\":\"Cfb9b-k1\",\"deployment.md\":\"BtfEsc9S\",\"evals.md\":\"DAgEc_hL\",\"example-agents_approval-buddy.md\":\"8R5phXb5\",\"example-agents_benny.md\":\"B0gjhI-p\",\"example-agents_bugbot.md\":\"DelIdhxB\",\"example-agents_codebase-wiki.md\":\"DC6sgwn0\",\"example-agents_codeowners-review.md\":\"Ku_tG2RY\",\"example-agents_concierge.md\":\"4rQTSMXt\",\"example-agents_fsd.md\":\"CzgUrDfi\",\"example-agents_index.md\":\"CRqJlnIf\",\"example-agents_knowledge-base.md\":\"BPJiVueF\",\"example-agents_security-reviewer.md\":\"D2rtwDTO\",\"example-agents_slack-agent.md\":\"buLbgvBf\",\"example-agents_weather-agent.md\":\"C9Qv-W0o\",\"guides_agent-to-agent.md\":\"Bpzgq2Pq\",\"guides_cloud-runtime.md\":\"gVzabdQL\",\"guides_github.md\":\"DOOCpqsW\",\"guides_human-in-the-loop.md\":\"DlUqsp1S\",\"guides_slack.md\":\"CCwqHvSV\",\"guides_webhooks.md\":\"B1EswtUu\",\"hillclimbing.md\":\"DHNast08\",\"index.md\":\"COiu-1jL\",\"quickstart.md\":\"BU6Iwi_9\",\"reference_agent-config.md\":\"DrW2JUM8\",\"reference_channels.md\":\"DdmiKgqf\",\"reference_cli.md\":\"D189RBCH\",\"reference_connections.md\":\"zaEYCLHT\",\"reference_hooks.md\":\"DyLVfE1O\",\"reference_http-api.md\":\"Dx_nmDG6\",\"reference_instructions.md\":\"CgoV-YEb\",\"reference_playground.md\":\"CPZhfYaO\",\"reference_project-layout.md\":\"Bd_CKtNS\",\"reference_schedules.md\":\"w_F2mXB6\",\"reference_sessions.md\":\"DdjWabnN\",\"reference_skills.md\":\"B_jHN7JL\",\"reference_subagents.md\":\"zWAMNfi1\",\"reference_tools.md\":\"CqgJroI0\",\"scaffolding-agents.md\":\"C3pTrmoE\",\"storage.md\":\"CVnInNiN\",\"troubleshooting.md\":\"DkovjS7h\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"agentkit\",\"description\":\"Filesystem-first framework for building and serving Cursor agents.\",\"base\":\"/docs/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Guides\",\"link\":\"/guides/webhooks\"},{\"text\":\"Examples\",\"link\":\"/example-agents/\"},{\"text\":\"Reference\",\"link\":\"/reference/project-layout\"}],\"search\":{\"provider\":\"local\"},\"outline\":{\"level\":[2,3]},\"sidebar\":[{\"text\":\"Getting started\",\"items\":[{\"text\":\"Overview\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Scaffold an agent with Cursor\",\"link\":\"/scaffolding-agents\"},{\"text\":\"Concepts\",\"link\":\"/concepts\"}]},{\"text\":\"Improving agents\",\"items\":[{\"text\":\"Building agents with agents\",\"link\":\"/building-with-agents\"},{\"text\":\"Evals\",\"link\":\"/evals\"},{\"text\":\"Live A/B metrics\",\"link\":\"/ab\"},{\"text\":\"Storage\",\"link\":\"/storage\"},{\"text\":\"Hillclimbing\",\"link\":\"/hillclimbing\"}]},{\"text\":\"Guides\",\"items\":[{\"text\":\"Webhooks & custom channels\",\"link\":\"/guides/webhooks\"},{\"text\":\"GitHub\",\"link\":\"/guides/github\"},{\"text\":\"Slack\",\"link\":\"/guides/slack\"},{\"text\":\"Human-in-the-loop approvals\",\"link\":\"/guides/human-in-the-loop\"},{\"text\":\"Agent-to-agent\",\"link\":\"/guides/agent-to-agent\"},{\"text\":\"Cloud runtime\",\"link\":\"/guides/cloud-runtime\"}]},{\"text\":\"Example agents\",\"items\":[{\"text\":\"Choose an example\",\"link\":\"/example-agents/\"},{\"text\":\"Weather agent\",\"link\":\"/example-agents/weather-agent\"},{\"text\":\"Slack agent\",\"link\":\"/example-agents/slack-agent\"},{\"text\":\"Concierge\",\"link\":\"/example-agents/concierge\"},{\"text\":\"Playbook router\",\"link\":\"/example-agents/benny\"},{\"text\":\"PR evidence reviewer\",\"link\":\"/example-agents/bugbot\"},{\"text\":\"Approval Buddy\",\"link\":\"/example-agents/approval-buddy\"},{\"text\":\"Security Reviewer\",\"link\":\"/example-agents/security-reviewer\"},{\"text\":\"Remote PR coordinator\",\"link\":\"/example-agents/fsd\"},{\"text\":\"Knowledge base\",\"link\":\"/example-agents/knowledge-base\"},{\"text\":\"Codebase wiki\",\"link\":\"/example-agents/codebase-wiki\"},{\"text\":\"Codeowners review\",\"link\":\"/example-agents/codeowners-review\"}]},{\"text\":\"Operating\",\"items\":[{\"text\":\"Deployment\",\"link\":\"/deployment\"},{\"text\":\"Fix common problems\",\"link\":\"/troubleshooting\"}]},{\"text\":\"Reference\",\"collapsed\":false,\"items\":[{\"text\":\"Project layout\",\"link\":\"/reference/project-layout\"},{\"text\":\"Agent config\",\"link\":\"/reference/agent-config\"},{\"text\":\"Instructions\",\"link\":\"/reference/instructions\"},{\"text\":\"Tools\",\"link\":\"/reference/tools\"},{\"text\":\"Skills\",\"link\":\"/reference/skills\"},{\"text\":\"MCP Connections\",\"link\":\"/reference/connections\"},{\"text\":\"Subagents\",\"link\":\"/reference/subagents\"},{\"text\":\"Channels\",\"link\":\"/reference/channels\"},{\"text\":\"Schedules & reminders\",\"link\":\"/reference/schedules\"},{\"text\":\"Hooks\",\"link\":\"/reference/hooks\"},{\"text\":\"Sessions & streaming\",\"link\":\"/reference/sessions\"},{\"text\":\"Playground\",\"link\":\"/reference/playground\"},{\"text\":\"CLI\",\"link\":\"/reference/cli\"},{\"text\":\"HTTP API\",\"link\":\"/reference/http-api\"}]}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
|
|
20
20
|
|
|
21
21
|
</body>
|
|
22
22
|
</html>
|