@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.
- 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 +14 -6
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DF-Yx4OP.js → app.DMboGKUD.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.O6eP7QZr.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DSeJSudL.js → VPLocalSearchBox.DkEqEnJU.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DZVLTXOC.js → theme.ASugdMNm.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 +4 -61
- 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 +18 -3
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +80 -42
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +5 -2
- package/dist/internal/cursor-event-relay.d.ts +4 -1
- package/dist/internal/cursor-event-relay.d.ts.map +1 -1
- package/dist/internal/cursor-event-relay.js +6 -0
- package/dist/internal/cursor-relay-core.d.ts +36 -1
- package/dist/internal/cursor-relay-core.d.ts.map +1 -1
- package/dist/internal/cursor-relay-core.js +89 -8
- package/dist/internal/cursor-slack-relay.d.ts +2 -2
- package/dist/internal/cursor-slack-relay.d.ts.map +1 -1
- package/dist/internal/cursor-slack-relay.js +4 -0
- package/dist/internal/discovery.js +3 -3
- package/dist/internal/eval-run-store.d.ts +33 -30
- package/dist/internal/eval-run-store.d.ts.map +1 -1
- package/dist/internal/eval-run-store.js +84 -96
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +3 -2
- 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 +5 -3
- 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/playground/assets/cursor-icons-16-CQ50JpfO.woff2 +0 -0
- package/dist/playground/assets/index-7GJIUFQj.css +1 -0
- package/dist/playground/assets/index-mux9aj5P.js +319 -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 +14 -6
- package/src/evals.ts +4 -118
- 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 +101 -45
- package/src/internal/cli-deploy.ts +5 -2
- package/src/internal/cursor-event-relay.ts +10 -1
- package/src/internal/cursor-relay-core.ts +115 -9
- package/src/internal/cursor-slack-relay.ts +6 -2
- package/src/internal/discovery.ts +2 -2
- package/src/internal/eval-run-store.ts +86 -100
- package/src/internal/init-project.ts +3 -2
- package/src/internal/playground-proxy.ts +5 -5
- package/src/internal/resolve-prod-target.ts +101 -3
- package/src/internal/server.ts +5 -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.0XrheBv2.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.d.ts +0 -32
- package/dist/internal/json-dir-store.d.ts.map +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-Ct_Usdm8.css +0 -1
- package/dist/playground/assets/index-Dsyb-Vaj.js +0 -319
- package/src/internal/json-dir-store.ts +0 -109
|
@@ -301,14 +301,15 @@ Recommended loop once the project exists:
|
|
|
301
301
|
1. Edit agent/ + tools under agent/tools/
|
|
302
302
|
2. ${CLI_COMMAND_NAME} info --dir . --json
|
|
303
303
|
3. ${CLI_COMMAND_NAME} run --dir . --message "..."
|
|
304
|
-
4. ${CLI_COMMAND_NAME} eval --dir .
|
|
304
|
+
4. ${CLI_COMMAND_NAME} eval --local --dir .
|
|
305
305
|
|
|
306
306
|
Evals:
|
|
307
307
|
Create evals/**/*.eval.ts using defineEval from ${PACKAGE_NAME}/evals
|
|
308
308
|
Case id is the path: evals/weather/nyc.eval.ts → weather/nyc
|
|
309
309
|
Required: evals/evals.config.ts with defineEvalConfig({ maxConcurrency })
|
|
310
310
|
(hard-capped at 200 due to model provider request limits)
|
|
311
|
-
Run: ${CLI_COMMAND_NAME} eval [--json] [evalId...]
|
|
311
|
+
Run: ${CLI_COMMAND_NAME} eval --local [--json] [evalId...]
|
|
312
|
+
(omit --local to run against the hosted deployment)
|
|
312
313
|
|
|
313
314
|
See AGENTS.md in the ${PACKAGE_NAME} package for the full loop.
|
|
314
315
|
`);
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* request-targets are rejected so injected headers never leave the configured
|
|
15
15
|
* upstream.
|
|
16
16
|
*
|
|
17
|
-
* When `refreshUpstream` is provided (
|
|
18
|
-
* re-minted shortly before `expiresAt` and once on upstream
|
|
19
|
-
* playground session does not require restarting the CLI.
|
|
17
|
+
* When `refreshUpstream` is provided (e.g. short-lived upstream tokens),
|
|
18
|
+
* credentials are re-minted shortly before `expiresAt` and once on upstream
|
|
19
|
+
* 401 so a long playground session does not require restarting the CLI.
|
|
20
20
|
*/
|
|
21
21
|
import { createServer } from "node:http";
|
|
22
22
|
import { openBrowser } from "./open-browser.js";
|
|
@@ -49,8 +49,8 @@ export interface StartPlaygroundProxyArgs {
|
|
|
49
49
|
/** Initial engineAccess expiry (ISO); enables proactive refresh. */
|
|
50
50
|
expiresAt?: string;
|
|
51
51
|
/**
|
|
52
|
-
* Re-mint upstream URL + headers
|
|
53
|
-
*
|
|
52
|
+
* Re-mint upstream URL + headers. Single-flighted across concurrent browser
|
|
53
|
+
* requests; called near expiry and once on 401.
|
|
54
54
|
*/
|
|
55
55
|
refreshUpstream?: () => Promise<PlaygroundUpstreamAccess>;
|
|
56
56
|
/** Bind port; `0` = ephemeral. */
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* request-targets are rejected so injected headers never leave the configured
|
|
15
15
|
* upstream.
|
|
16
16
|
*
|
|
17
|
-
* When `refreshUpstream` is provided (
|
|
18
|
-
* re-minted shortly before `expiresAt` and once on upstream
|
|
19
|
-
* playground session does not require restarting the CLI.
|
|
17
|
+
* When `refreshUpstream` is provided (e.g. short-lived upstream tokens),
|
|
18
|
+
* credentials are re-minted shortly before `expiresAt` and once on upstream
|
|
19
|
+
* 401 so a long playground session does not require restarting the CLI.
|
|
20
20
|
*/
|
|
21
21
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
22
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -30,11 +30,41 @@ export interface ResolvedProdTarget {
|
|
|
30
30
|
slug: string;
|
|
31
31
|
expiresAt: string;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a hosted deployment cannot be resolved. `notFound` is true
|
|
35
|
+
* when the deployment does not exist, so callers can suggest deploying
|
|
36
|
+
* (or running locally) instead of surfacing a bare API error.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ProdTargetError extends Error {
|
|
39
|
+
readonly options: {
|
|
40
|
+
slug: string;
|
|
41
|
+
notFound?: boolean;
|
|
42
|
+
};
|
|
43
|
+
constructor(message: string, options?: {
|
|
44
|
+
slug: string;
|
|
45
|
+
notFound?: boolean;
|
|
46
|
+
});
|
|
47
|
+
get slug(): string;
|
|
48
|
+
get notFound(): boolean;
|
|
49
|
+
}
|
|
33
50
|
/**
|
|
34
51
|
* Look up a running deployment and return its engineAccess URL/headers.
|
|
35
52
|
* Throws {@link Error} with a CLI-ready message on failure.
|
|
36
53
|
*/
|
|
37
54
|
export declare function resolveProdTarget(options: ResolveProdTargetOptions): Promise<ResolvedProdTarget>;
|
|
55
|
+
export interface ResolvedProdAliasPlayground {
|
|
56
|
+
/** Hosted playground URL on the API alias (SPA owns alias-token sign-in). */
|
|
57
|
+
playgroundUrl: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Look up a running deployment and return its stable alias playground URL.
|
|
62
|
+
* Does not mint `engineAccess` — the browser signs in with the alias token.
|
|
63
|
+
* Throws {@link Error} with a CLI-ready message on failure.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveProdAliasPlaygroundUrl(options: ResolveProdTargetOptions & {
|
|
66
|
+
sessionId?: string;
|
|
67
|
+
}): Promise<ResolvedProdAliasPlayground>;
|
|
38
68
|
/** Resolve the deployment slug the same way `deploy` does for a single dir. */
|
|
39
69
|
export declare function resolveProdSlug(options: {
|
|
40
70
|
dir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-prod-target.d.ts","sourceRoot":"","sources":["../../src/internal/resolve-prod-target.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGrE,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,gDAAgD;IAChD,KAAK,CA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GtC,QAAQ,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAFxD,YACE,OAAO,EAAE,MAAM,EACN,OAAO,GAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAiB,EAItE;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;CACF;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CA0F7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,wBAAwB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,OAAO,CAAC,2BAA2B,CAAC,CAyDtC;AAiBD,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAgBT"}
|
|
@@ -29,6 +29,24 @@ export const PROD_ENGINE_WAKE_HEADERS = {
|
|
|
29
29
|
"x-anyrun-hibernation-lower-bound-s": "1800",
|
|
30
30
|
"x-anyrun-hibernation-upper-bound-s": "3600",
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when a hosted deployment cannot be resolved. `notFound` is true
|
|
34
|
+
* when the deployment does not exist, so callers can suggest deploying
|
|
35
|
+
* (or running locally) instead of surfacing a bare API error.
|
|
36
|
+
*/
|
|
37
|
+
export class ProdTargetError extends Error {
|
|
38
|
+
constructor(message, options = { slug: "" }) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.options = options;
|
|
41
|
+
this.name = "ProdTargetError";
|
|
42
|
+
}
|
|
43
|
+
get slug() {
|
|
44
|
+
return this.options.slug;
|
|
45
|
+
}
|
|
46
|
+
get notFound() {
|
|
47
|
+
return this.options.notFound === true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
32
50
|
/**
|
|
33
51
|
* Look up a running deployment and return its engineAccess URL/headers.
|
|
34
52
|
* Throws {@link Error} with a CLI-ready message on failure.
|
|
@@ -45,7 +63,9 @@ export function resolveProdTarget(options) {
|
|
|
45
63
|
err,
|
|
46
64
|
});
|
|
47
65
|
if (typeof auth === "number") {
|
|
48
|
-
|
|
66
|
+
// Not "--prod": `eval` resolves the hosted deployment by default,
|
|
67
|
+
// without any flag.
|
|
68
|
+
throw new Error(`Could not resolve Cursor credentials/team for the hosted deployment (see above).`);
|
|
49
69
|
}
|
|
50
70
|
// A hibernated engine can briefly omit engineAccess while getPod fails
|
|
51
71
|
// during wake. Retry a few times before surfacing "not reachable yet".
|
|
@@ -61,7 +81,7 @@ export function resolveProdTarget(options) {
|
|
|
61
81
|
}
|
|
62
82
|
catch (error) {
|
|
63
83
|
if (error instanceof DeployApiError) {
|
|
64
|
-
throw new
|
|
84
|
+
throw new ProdTargetError(`Deployment "${slug}" (team ${auth.teamId}): ${error.message}`, { slug, notFound: error.status === 404 });
|
|
65
85
|
}
|
|
66
86
|
throw error;
|
|
67
87
|
}
|
|
@@ -102,6 +122,58 @@ export function resolveProdTarget(options) {
|
|
|
102
122
|
};
|
|
103
123
|
});
|
|
104
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Look up a running deployment and return its stable alias playground URL.
|
|
127
|
+
* Does not mint `engineAccess` — the browser signs in with the alias token.
|
|
128
|
+
* Throws {@link Error} with a CLI-ready message on failure.
|
|
129
|
+
*/
|
|
130
|
+
export function resolveProdAliasPlaygroundUrl(options) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
var _a;
|
|
133
|
+
const err = (_a = options.err) !== null && _a !== void 0 ? _a : ((text) => void process.stderr.write(text));
|
|
134
|
+
const slug = resolveProdSlug(options);
|
|
135
|
+
const auth = yield resolveDeployAuth({
|
|
136
|
+
team: options.team,
|
|
137
|
+
apiKey: options.apiKey,
|
|
138
|
+
fetchImpl: options.fetchImpl,
|
|
139
|
+
err,
|
|
140
|
+
});
|
|
141
|
+
if (typeof auth === "number") {
|
|
142
|
+
throw new Error(`Could not resolve Cursor credentials/team for the hosted deployment (see above).`);
|
|
143
|
+
}
|
|
144
|
+
let detail;
|
|
145
|
+
try {
|
|
146
|
+
detail = yield auth.client.getDeployment({
|
|
147
|
+
teamId: auth.teamId,
|
|
148
|
+
slug,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
if (error instanceof DeployApiError) {
|
|
153
|
+
throw new Error(`Deployment "${slug}" (team ${auth.teamId}): ${error.message}`);
|
|
154
|
+
}
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
const statusOk = detail.status === "running" || detail.status === "degraded";
|
|
158
|
+
if (!statusOk) {
|
|
159
|
+
const lastError = detail.lastError === null || detail.lastError === undefined
|
|
160
|
+
? ""
|
|
161
|
+
: ` ${sanitizeCustomerFacingDetail(detail.lastError)}`;
|
|
162
|
+
throw new Error(`Deployment "${slug}" is ${detail.status}, not running.${lastError}\n` +
|
|
163
|
+
`Deploy or wait: \`${CLI} deploy --slug ${slug}\` / \`${CLI} deployment ${slug}\``);
|
|
164
|
+
}
|
|
165
|
+
const aliasBase = auth.client.aliasUrl(detail.engineAlias).replace(/\/$/, "");
|
|
166
|
+
const base = `${aliasBase}/playground`;
|
|
167
|
+
const sessionId = options.sessionId !== undefined && options.sessionId.trim() !== ""
|
|
168
|
+
? options.sessionId.trim()
|
|
169
|
+
: undefined;
|
|
170
|
+
const playgroundUrl = sessionId === undefined
|
|
171
|
+
? base
|
|
172
|
+
: `${base}?sessionId=${encodeURIComponent(sessionId)}`;
|
|
173
|
+
err(`${stderrPalette().dim(`Using hosted deployment "${slug}".`)}\n`);
|
|
174
|
+
return { playgroundUrl, slug };
|
|
175
|
+
});
|
|
176
|
+
}
|
|
105
177
|
/** Strip obvious hosting internals from customer-facing error fragments. */
|
|
106
178
|
function sanitizeCustomerFacingDetail(message) {
|
|
107
179
|
return message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAoFrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAapE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAYD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAoFrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAapE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAYD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CA2lB3B"}
|
package/dist/internal/server.js
CHANGED
|
@@ -223,9 +223,8 @@ export function startServer(mounts_1) {
|
|
|
223
223
|
const scheduleRunner = new ScheduleRunner(engine, project, logger);
|
|
224
224
|
const reminderRunner = new ReminderRunner(engine, logger);
|
|
225
225
|
const evalRuns = new EvalRunStore(project.rootDir, logger,
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
(_b = engine.storage) === null || _b === void 0 ? void 0 : _b.asEvalRunPersistence());
|
|
226
|
+
// Playground eval history mirrors onto the defineStorage evals table.
|
|
227
|
+
(_b = engine.storage) === null || _b === void 0 ? void 0 : _b.evalRuns());
|
|
229
228
|
// Eval history restores with the same startup step as sessions (reads
|
|
230
229
|
// also hydrate lazily, but doing it here surfaces store problems at
|
|
231
230
|
// boot and makes /v1/dev/evals complete from the first request).
|
|
@@ -561,6 +560,9 @@ export function startServer(mounts_1) {
|
|
|
561
560
|
for (const runtime of runtimes) {
|
|
562
561
|
runtime.scheduleRunner.stop();
|
|
563
562
|
runtime.reminderRunner.stop();
|
|
563
|
+
// Before the engines close their storage coordinators, so the
|
|
564
|
+
// interrupted-batch write can still reach the sink.
|
|
565
|
+
runtime.evalRuns.close();
|
|
564
566
|
}
|
|
565
567
|
for (const stop of channelStopHooks) {
|
|
566
568
|
try {
|
|
@@ -87,8 +87,7 @@ export declare class SessionEngine {
|
|
|
87
87
|
* Runtime for `agent/storage.ts` (`defineStorage`), when
|
|
88
88
|
* authored. All durable state changes funnel through it (session
|
|
89
89
|
* records, event chunks, A/B samples/snapshots); the eval run store
|
|
90
|
-
* attaches via {@link StorageCoordinator.
|
|
91
|
-
* serve start.
|
|
90
|
+
* attaches via {@link StorageCoordinator.evalRuns} at serve start.
|
|
92
91
|
*/
|
|
93
92
|
readonly storage: StorageCoordinator | undefined;
|
|
94
93
|
/** In-flight lazy restores, deduped per channel + continuation key. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-engine.d.ts","sourceRoot":"","sources":["../../src/internal/session-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EAInB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG1B,KAAK,eAAe,EACpB,KAAK,YAAY,EAIjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EAGpB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAOpE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAe9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,eAAe,SAAS,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,SAAS,EAAE,MAAM,EAK5B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,SAAS,EAAE,MAAM,EAK5B;CACF;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,SAAS,EAAE,MAAM,EAG5B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAGvC,QAAQ,CAAC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UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GACjC,OAAO,CAAC,UAAU,CAAC,CA6CrB;IAEK,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,UAAU,SAAI,GACb,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAGrC;IAED;;;;OAIG;IACG,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCzE;IAED,kEAAkE;IAC5D,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,SAAI,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAG3E;IAEK,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;IAED,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIxC;IAED,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,CAc9C;IAED,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,mBAAmB;IAc3B,sEAAsE;IACtE,OAAO,CAAC,YAAY;IA6BpB;;;;;;;;;;;OAWG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc3C;YAEa,cAAc;IA4F5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,4BAA4B;YAqBtB,gCAAgC;IAyB9C;;;;;OAKG;YACW,kBAAkB;IAYhC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAO/C;IAED,yEAAyE;IACnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3B;CACF"}
|
|
@@ -110,7 +110,6 @@ export class ApprovalInterruptedError extends Error {
|
|
|
110
110
|
export class SessionEngine {
|
|
111
111
|
constructor(options) {
|
|
112
112
|
var _a, _b;
|
|
113
|
-
var _c, _d, _e;
|
|
114
113
|
/** In-flight lazy restores, deduped per channel + continuation key. */
|
|
115
114
|
this.restoreInFlight = new Map();
|
|
116
115
|
this.channelsById = new Map();
|
|
@@ -131,7 +130,7 @@ export class SessionEngine {
|
|
|
131
130
|
this.project = options.project;
|
|
132
131
|
this.stateRoot = options.stateRoot;
|
|
133
132
|
this.runner = options.runner;
|
|
134
|
-
this.logger = (
|
|
133
|
+
this.logger = (_a = options.logger) !== null && _a !== void 0 ? _a : (() => { });
|
|
135
134
|
this.sessions = new SessionStore(join(options.stateRoot, "sessions"));
|
|
136
135
|
this.logs = new EventLogStore((sessionId) => this.sessions.eventFilePath(sessionId), (sessionId, error) => this.logger(`[agentkit] failed to persist events for ${sessionId}: ${describeError(error)}`));
|
|
137
136
|
this.storage =
|
|
@@ -143,17 +142,14 @@ export class SessionEngine {
|
|
|
143
142
|
projectRoot: options.project.rootDir,
|
|
144
143
|
logger: this.logger,
|
|
145
144
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
projectRoot: options.project.rootDir,
|
|
150
|
-
persistSamples,
|
|
151
|
-
});
|
|
145
|
+
this.abCollector = new ABCollector(options.project.abs, this.logger, (sessionId) => __awaiter(this, void 0, void 0, function* () { return (yield this.logs.get(sessionId)).snapshot(0); }),
|
|
146
|
+
// Samples flow to the defineStorage `abs` table (no-op without one).
|
|
147
|
+
{ persistSample: (sample) => { var _a; return (_a = this.storage) === null || _a === void 0 ? void 0 : _a.abSample(sample); } });
|
|
152
148
|
// Peer and Cursor-account transports are symbolic until the serve host
|
|
153
149
|
// resolves them; the host-side MCP registry starts with the concrete
|
|
154
150
|
// connections and gains the rest via setResolvedConnections.
|
|
155
151
|
this.mcpHost = new McpHost(options.project.agent.connections.filter((connection) => !isSymbolicConnectionTransport(connection.transport)));
|
|
156
|
-
this.platforms = (
|
|
152
|
+
this.platforms = (_b = options.platforms) !== null && _b !== void 0 ? _b : createHostPlatforms();
|
|
157
153
|
for (const channel of options.project.channels) {
|
|
158
154
|
this.channelsById.set(channel.id, channel.definition);
|
|
159
155
|
}
|
|
@@ -1175,8 +1171,8 @@ export class SessionEngine {
|
|
|
1175
1171
|
*/
|
|
1176
1172
|
abSnapshot(caller, options) {
|
|
1177
1173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1178
|
-
var _a;
|
|
1179
|
-
var
|
|
1174
|
+
var _a, _b;
|
|
1175
|
+
var _c;
|
|
1180
1176
|
const sessions = yield this.listSessions(caller, options);
|
|
1181
1177
|
const abConfig = this.project.abConfig;
|
|
1182
1178
|
const maxPlaygroundSessions = resolveABMaxPlaygroundSessions(abConfig === null || abConfig === void 0 ? void 0 : abConfig.maxPlaygroundSessions);
|
|
@@ -1192,12 +1188,13 @@ export class SessionEngine {
|
|
|
1192
1188
|
if (foldedSessions.length === 0 &&
|
|
1193
1189
|
this.storage !== undefined &&
|
|
1194
1190
|
(yield this.sessions.list()).length === 0) {
|
|
1195
|
-
(
|
|
1191
|
+
(_c = this.restoredAbSnapshot) !== null && _c !== void 0 ? _c : (this.restoredAbSnapshot = this.storage.getLatestAbSnapshot());
|
|
1196
1192
|
const restoredSnapshot = yield this.restoredAbSnapshot;
|
|
1197
1193
|
if (restoredSnapshot !== undefined) {
|
|
1198
1194
|
return restoredSnapshot;
|
|
1199
1195
|
}
|
|
1200
1196
|
}
|
|
1197
|
+
const abTable = (_a = this.project.storage) === null || _a === void 0 ? void 0 : _a.abs;
|
|
1201
1198
|
const snapshot = yield buildABSnapshot({
|
|
1202
1199
|
experiments: this.project.abs,
|
|
1203
1200
|
agentName: this.project.name,
|
|
@@ -1208,27 +1205,13 @@ export class SessionEngine {
|
|
|
1208
1205
|
logger: this.logger,
|
|
1209
1206
|
config: {
|
|
1210
1207
|
maxPlaygroundSessions,
|
|
1211
|
-
durableSamples:
|
|
1212
|
-
durableSnapshots: (
|
|
1208
|
+
durableSamples: abTable !== undefined,
|
|
1209
|
+
durableSnapshots: (abTable === null || abTable === void 0 ? void 0 : abTable.putSnapshot) !== undefined,
|
|
1213
1210
|
},
|
|
1214
1211
|
});
|
|
1215
|
-
// Side effect on the read path: playground polls GET /v1/abs ~every 4s
|
|
1216
|
-
//
|
|
1217
|
-
|
|
1218
|
-
if (persistSnapshots !== undefined) {
|
|
1219
|
-
try {
|
|
1220
|
-
yield persistSnapshots.save(snapshot, {
|
|
1221
|
-
projectRoot: this.project.rootDir,
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
catch (error) {
|
|
1225
|
-
this.logger(`[agentkit] ab persistSnapshots.save threw: ${describeError(error)}`);
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
else {
|
|
1229
|
-
// defineStorage fallback (throttled inside the coordinator).
|
|
1230
|
-
(_a = this.storage) === null || _a === void 0 ? void 0 : _a.abSnapshot(snapshot);
|
|
1231
|
-
}
|
|
1212
|
+
// Side effect on the read path: playground polls GET /v1/abs ~every 4s;
|
|
1213
|
+
// the coordinator throttles the actual table write.
|
|
1214
|
+
(_b = this.storage) === null || _b === void 0 ? void 0 : _b.abSnapshot(snapshot);
|
|
1232
1215
|
return snapshot;
|
|
1233
1216
|
});
|
|
1234
1217
|
}
|
|
@@ -10,15 +10,15 @@
|
|
|
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
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
-
import type {
|
|
18
|
-
import type { EvalRunPersistence } from "../evals.js";
|
|
17
|
+
import type { ABMetricSample } from "../ab.js";
|
|
19
18
|
import { type ResolvedStoragePolicy, type StorageContext, type StorageDefinition } from "../storage.js";
|
|
20
19
|
import type { SessionEvent, SessionRecord } from "../types.js";
|
|
21
20
|
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
21
|
+
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
22
22
|
import { type ReminderRecord } from "./reminder-store.js";
|
|
23
23
|
export interface StorageCoordinatorOptions {
|
|
24
24
|
definition: StorageDefinition;
|
|
@@ -67,6 +67,10 @@ export declare class StorageCoordinator {
|
|
|
67
67
|
* put the current token, delete the previous one when it changed.
|
|
68
68
|
*/
|
|
69
69
|
private continuationOps;
|
|
70
|
+
/** KV upsert op on the sink's `put`. */
|
|
71
|
+
private putOp;
|
|
72
|
+
/** KV delete op on the sink's `delete` (skipped when the hook is absent). */
|
|
73
|
+
private deleteOp;
|
|
70
74
|
/** Whether the sink can serve the startup bulk restore (`list`). */
|
|
71
75
|
get canBulkRestore(): boolean;
|
|
72
76
|
/**
|
|
@@ -103,20 +107,17 @@ export declare class StorageCoordinator {
|
|
|
103
107
|
*/
|
|
104
108
|
listReminders(): Promise<ReminderRecord[]>;
|
|
105
109
|
/**
|
|
106
|
-
* Adapter
|
|
107
|
-
*
|
|
108
|
-
*
|
|
110
|
+
* Adapter over the sink's dedicated `evals` table for the playground
|
|
111
|
+
* eval-run store. Undefined when the table is not configured — eval
|
|
112
|
+
* history then stays in process memory.
|
|
109
113
|
*/
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
* back to this sink when `ab.config.ts` sets no `persistSamples`.
|
|
114
|
-
*/
|
|
115
|
-
asABSamplePersistence(): ABSamplePersistence;
|
|
114
|
+
evalRuns(): EvalRunStorage | undefined;
|
|
115
|
+
/** Append one metric sample to the `abs` table (no-op without it). */
|
|
116
|
+
abSample(sample: ABMetricSample): void;
|
|
116
117
|
/**
|
|
117
118
|
* Refresh the persisted aggregate A/B snapshot, throttled to once per
|
|
118
119
|
* {@link AB_SNAPSHOT_MIN_INTERVAL_MS} (the playground recomputes the
|
|
119
|
-
* fold on every `GET /v1/abs` poll).
|
|
120
|
+
* fold on every `GET /v1/abs` poll). No-op without `abs.putSnapshot`.
|
|
120
121
|
*/
|
|
121
122
|
abSnapshot(snapshot: ABSnapshot): void;
|
|
122
123
|
/** Latest persisted aggregate A/B snapshot; errors read as absent. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-coordinator.d.ts","sourceRoot":"","sources":["../../src/internal/storage-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"storage-coordinator.d.ts","sourceRoot":"","sources":["../../src/internal/storage-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAa,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA0C5E,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AASD,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAEvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,6DA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