@hearsay-tools/squawk 0.18.0-dev.6912 → 0.18.0-dev.6924
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/README.md +4 -5
- package/dist/agent-config/account-identity.js +0 -1
- package/dist/agent-config/account-identity.js.map +1 -1
- package/dist/agent-config/catalog.d.ts +0 -2
- package/dist/agent-config/catalog.js +3 -41
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/models.js +0 -4
- package/dist/agent-config/models.js.map +1 -1
- package/dist/automations/service.d.ts +14 -14
- package/dist/ci-wait/controller.d.ts +4 -4
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/contract/activity.d.ts +0 -7
- package/dist/contract/agent-config.d.ts +0 -2
- package/dist/contract/agent-profiles.d.ts +0 -15
- package/dist/contract/automation-requests.d.ts +0 -6
- package/dist/contract/automation-storage.d.ts +0 -6
- package/dist/contract/automations.d.ts +0 -18
- package/dist/contract/config-requests.d.ts +0 -2
- package/dist/contract/delegation.d.ts +0 -8
- package/dist/contract/discovery.d.ts +0 -8
- package/dist/contract/health.d.ts +0 -3
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +32 -40
- package/dist/contract/per-runner-optional-strings.d.ts +1 -2
- package/dist/contract/provider-requests.d.ts +0 -5
- package/dist/contract/query-requests.d.ts +0 -1
- package/dist/contract/run-predicates.d.ts +8 -2
- package/dist/contract/run-requests.d.ts +0 -1
- package/dist/contract/runner-facts.d.ts +2 -42
- package/dist/contract/runner.d.ts +4 -1
- package/dist/contract/runs.d.ts +11 -44
- package/dist/contract/workflow-file.d.ts +0 -1
- package/dist/contract/workflows.d.ts +0 -6
- package/dist/contract/workspace-events.d.ts +2 -4
- package/dist/contract/workspace.d.ts +1 -20
- package/dist/core/agent-env.js +0 -1
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.js +0 -3
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +10 -15
- package/dist/core/agent-runner.js +3 -2
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.js +0 -14
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/host-model-catalog.js +0 -2
- package/dist/core/host-model-catalog.js.map +1 -1
- package/dist/core/model-identity.js +0 -3
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +0 -4
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/model-probe-spawn.d.ts +9 -0
- package/dist/core/model-probe-spawn.js +7 -0
- package/dist/core/model-probe-spawn.js.map +1 -0
- package/dist/core/omp-model-catalog.d.ts +3 -5
- package/dist/core/omp-model-catalog.js +3 -8
- package/dist/core/omp-model-catalog.js.map +1 -1
- package/dist/core/pi-model-catalog.d.ts +3 -5
- package/dist/core/pi-model-catalog.js +3 -7
- package/dist/core/pi-model-catalog.js.map +1 -1
- package/dist/core/process-usage.d.ts +1 -1
- package/dist/core/process-usage.js +1 -1
- package/dist/core/process-usage.js.map +1 -1
- package/dist/core/provider-auth.d.ts +1 -1
- package/dist/core/provider-auth.js +0 -29
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-cli.js +0 -2
- package/dist/core/runner-cli.js.map +1 -1
- package/dist/core/runner-factory.d.ts +1 -4
- package/dist/core/runner-factory.js +1 -4
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-facts.d.ts +5 -28
- package/dist/core/runner-facts.js +0 -20
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/core/runner-model-catalog.d.ts +0 -3
- package/dist/core/runner-model-catalog.js +1 -25
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/session-process.d.ts +0 -4
- package/dist/core/session-process.js +0 -15
- package/dist/core/session-process.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/delegation/conversations.d.ts +10 -8
- package/dist/delegation/execution-identity.d.ts +3 -9
- package/dist/delegation/execution-identity.js +7 -1
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/provision.js +2 -1
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +19 -19
- package/dist/delegation/transport.d.ts +19 -19
- package/dist/discovery/cli.js +2 -1
- package/dist/discovery/cli.js.map +1 -1
- package/dist/paths.js +1 -4
- package/dist/paths.js.map +1 -1
- package/dist/runs/legacy-run-rows.d.ts +13 -0
- package/dist/runs/legacy-run-rows.js +60 -0
- package/dist/runs/legacy-run-rows.js.map +1 -1
- package/dist/runs/run-exits.d.ts +26 -20
- package/dist/runs/run-summary-page.js +2 -0
- package/dist/runs/run-summary-page.js.map +1 -1
- package/dist/runs/store.d.ts +11 -19
- package/dist/runs/store.js +2 -2
- package/dist/runs/store.js.map +1 -1
- package/dist/server/activity-routes.d.ts +2 -2
- package/dist/server/open-in-app.js +0 -1
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/server.d.ts +325 -322
- package/dist/server/server.js +10 -37
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/steps.js +0 -1
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills-remote.d.ts +1 -1
- package/dist/skills-remote.js +1 -1
- package/dist/skills-remote.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +19 -13
- package/dist/workflows/continuation-admission.js +16 -13
- package/dist/workflows/continuation-admission.js.map +1 -1
- package/dist/workflows/run/continuation-session.d.ts +1 -2
- package/dist/workflows/run/continuation-session.js +1 -5
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/launch-read-resolver.d.ts +11 -14
- package/dist/workflows/run/launch-read-resolver.js +8 -22
- package/dist/workflows/run/launch-read-resolver.js.map +1 -1
- package/dist/workflows/run/queued-revival.d.ts +2 -2
- package/dist/workflows/run/queued-revival.js +17 -6
- package/dist/workflows/run/queued-revival.js.map +1 -1
- package/dist/workflows/run/run-skills.d.ts +2 -2
- package/dist/workflows/run/run-skills.js +3 -4
- package/dist/workflows/run/run-skills.js.map +1 -1
- package/dist/workflows/run/session-events.js +1 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/turn-nudges.d.ts +1 -1
- package/dist/workflows/run/turn-nudges.js +2 -2
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/dist/workflows/run/turn-settler.js +1 -1
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +5 -4
- package/dist/workflows/run-scheduling.js +4 -0
- package/dist/workflows/run-scheduling.js.map +1 -1
- package/dist/workflows/run-states.js +1 -1
- package/dist/workflows/run-states.js.map +1 -1
- package/dist/workflows/run.js +12 -0
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.js +0 -1
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +1 -5
- package/dist/workspace/agent-accounts.js +0 -1
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/config.d.ts +1 -3
- package/dist/workspace/config.js +0 -1
- package/dist/workspace/config.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-ci-tool.mjs +2 -15
- package/scripts/mock-deferred-turn-start.mjs +1 -1
- package/scripts/mock-provider-failures.mjs +0 -9
- package/scripts/mock-scenario.d.mts +1 -1
- package/scripts/mock-scenario.mjs +2 -2
- package/web/dist/assets/activity-motion-DXtoOkpz.js +2 -0
- package/web/dist/assets/{activity-route-B0PcG2pV.js → activity-route-r-em7Y-G.js} +1 -1
- package/web/dist/assets/agent-accounts-DuMsyDoO.js +18 -0
- package/web/dist/assets/attention-CB_z05E7.js +1 -0
- package/web/dist/assets/{cez-idle-BqmM5iRr.js → cez-idle-D49bY6KR.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-AjehkvQl.js → commit-diff-panel-BGLQaKRb.js} +1 -1
- package/web/dist/assets/diff-BRFJnYsC.js +3 -0
- package/web/dist/assets/{diff-view-B44ukwHb.js → diff-view-JWqbvzMs.js} +3 -3
- package/web/dist/assets/{file-preview-9K7NRV-S.js → file-preview-BW__Krxm.js} +1 -1
- package/web/dist/assets/{git-toolbar-BwqVqZF5.js → git-toolbar-DoXf_s-G.js} +1 -1
- package/web/dist/assets/{github-D4K3g1dq.js → github-CijmslJ6.js} +1 -1
- package/web/dist/assets/{global-activity-route-BauSAsDZ.js → global-activity-route-B2EeYnAW.js} +1 -1
- package/web/dist/assets/index-BHoqo9RG.js +17 -0
- package/web/dist/assets/{live-protocol-BmbbwF5R.js → live-protocol-DHEBTIRD.js} +1 -1
- package/web/dist/assets/preview-pane-connected-D6vrA6hJ.js +3 -0
- package/web/dist/assets/{project-router-ONhFFLgV.js → project-router-C5EZmTkk.js} +1 -1
- package/web/dist/assets/project-scope-context-HUq7jkZN.js +4 -0
- package/web/dist/assets/{prompt-template-menu-1krX4ZTh.js → prompt-template-menu-DOYsMTKv.js} +1 -1
- package/web/dist/assets/queries-BXHx1ZPw.js +1 -0
- package/web/dist/assets/{reference-chip-N7Ds8lIY.js → reference-chip-CjJnlcQb.js} +1 -1
- package/web/dist/assets/{repo-git-D6K1ijkM.js → repo-git-CyRoQgtr.js} +1 -1
- package/web/dist/assets/{report-reader-DnlQSXH7.js → report-reader-BJiEbYfZ.js} +1 -1
- package/web/dist/assets/reports-Ddn-WBxa.js +1 -0
- package/web/dist/assets/run-header-B7qHisMu.js +2 -0
- package/web/dist/assets/runner-facts-BpvNgJqf.js +1 -0
- package/web/dist/assets/skills-D2wzJWpY.js +1 -0
- package/web/dist/assets/{tab-link-CtD23wUM.js → tab-link-B_gKjZgM.js} +1 -1
- package/web/dist/assets/{task-changes-C8tmdSsM.js → task-changes-CqKQIYHP.js} +1 -1
- package/web/dist/assets/{task-commits-DBst5qgV.js → task-commits-CY7XFJBU.js} +1 -1
- package/web/dist/assets/{task-files-C9aKsbXo.js → task-files-CW1gWAY3.js} +1 -1
- package/web/dist/assets/{task-github-item-D8qxN6iN.js → task-github-item-Djq-z2As.js} +1 -1
- package/web/dist/assets/task-thread-DyZ9WjLc.js +9 -0
- package/web/dist/assets/{thread-state-Brut_jkw.js → thread-state-Dbru_dO3.js} +1 -1
- package/web/dist/assets/use-desktop-BCMH-x7R.js +1 -0
- package/web/dist/assets/{use-hand-to-agent-state-Cdr9MMRo.js → use-hand-to-agent-state-C94Si0KS.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-DG4gGVok.js → useInfiniteQuery-O53uZ95W.js} +1 -1
- package/web/dist/assets/useQuery-C9ErlZEv.js +1 -0
- package/web/dist/assets/workflows-CwS6zbSa.js +7 -0
- package/web/dist/assets/{ws-7E9_cHrQ.js → ws-CRnL5yIc.js} +1 -1
- package/web/dist/index.html +15 -14
- package/web/dist/live-worker.js +1 -1
- package/dist/core/cursor-cli-flags.d.ts +0 -19
- package/dist/core/cursor-cli-flags.js +0 -47
- package/dist/core/cursor-cli-flags.js.map +0 -1
- package/dist/core/cursor-config-options.d.ts +0 -18
- package/dist/core/cursor-config-options.js +0 -31
- package/dist/core/cursor-config-options.js.map +0 -1
- package/dist/core/cursor-model-catalog.d.ts +0 -50
- package/dist/core/cursor-model-catalog.js +0 -306
- package/dist/core/cursor-model-catalog.js.map +0 -1
- package/dist/core/cursor-print-capabilities.d.ts +0 -14
- package/dist/core/cursor-print-capabilities.js +0 -169
- package/dist/core/cursor-print-capabilities.js.map +0 -1
- package/dist/core/cursor-print-process.d.ts +0 -36
- package/dist/core/cursor-print-process.js +0 -117
- package/dist/core/cursor-print-process.js.map +0 -1
- package/dist/core/cursor-print-runner.d.ts +0 -50
- package/dist/core/cursor-print-runner.js +0 -582
- package/dist/core/cursor-print-runner.js.map +0 -1
- package/dist/core/cursor-print-tool-catalog.d.ts +0 -3
- package/dist/core/cursor-print-tool-catalog.js +0 -13
- package/dist/core/cursor-print-tool-catalog.js.map +0 -1
- package/dist/core/cursor-print-ui-mapper.d.ts +0 -47
- package/dist/core/cursor-print-ui-mapper.js +0 -574
- package/dist/core/cursor-print-ui-mapper.js.map +0 -1
- package/dist/core/cursor-provider-error.d.ts +0 -9
- package/dist/core/cursor-provider-error.js +0 -15
- package/dist/core/cursor-provider-error.js.map +0 -1
- package/dist/core/cursor-runner.d.ts +0 -53
- package/dist/core/cursor-runner.js +0 -145
- package/dist/core/cursor-runner.js.map +0 -1
- package/scripts/mock-cursor-hang-stdin-late.mjs +0 -35
- package/scripts/mock-cursor-hang-stdin.mjs +0 -30
- package/scripts/mock-cursor-print.mjs +0 -237
- package/scripts/probe-cursor-print.mjs +0 -699
- package/web/dist/assets/activity-motion-Dw9VKFf3.js +0 -2
- package/web/dist/assets/agent-accounts-DqMzt9_9.js +0 -18
- package/web/dist/assets/attention-Cqji4PT4.js +0 -1
- package/web/dist/assets/diff-CgXr-Vj3.js +0 -3
- package/web/dist/assets/index-7rIsGPsh.js +0 -17
- package/web/dist/assets/preview-pane-connected-D1q-f2lo.js +0 -3
- package/web/dist/assets/project-scope-context-9Q-zjaft.js +0 -4
- package/web/dist/assets/queries-BIaHxHGs.js +0 -1
- package/web/dist/assets/reports-BxYfLoON.js +0 -1
- package/web/dist/assets/run-header-BqfP1FSM.js +0 -2
- package/web/dist/assets/skills-eFv2IZVX.js +0 -1
- package/web/dist/assets/task-thread-DzMRMGj_.js +0 -9
- package/web/dist/assets/use-desktop-Bp049F-t.js +0 -1
- package/web/dist/assets/useQuery-D-rAMmNQ.js +0 -1
- package/web/dist/assets/workflows-TD0kz7GM.js +0 -7
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cursor provider error text (#443). Cursor wraps a provider failure in a literal `\n\nError: `
|
|
3
|
-
* prefix. Print sessions embed the text in a run error and transcript, so it is reduced to one
|
|
4
|
-
* line and capped.
|
|
5
|
-
*/
|
|
6
|
-
/** Preserved provider text is diagnosis, not transcript bulk — cap it. */
|
|
7
|
-
export const CURSOR_PROVIDER_ERROR_MAX_CHARS = 500;
|
|
8
|
-
const ENVELOPE_PREFIX_RE = /^\n\nError: /u;
|
|
9
|
-
const CONTROL_RE = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/gu;
|
|
10
|
-
/** Strip the envelope prefix, control characters and runs of whitespace, then cap for display. */
|
|
11
|
-
export function sanitizeCursorProviderError(text) {
|
|
12
|
-
return text.replace(ENVELOPE_PREFIX_RE, '').replace(CONTROL_RE, ' ').replace(/\s+/g, ' ').trim()
|
|
13
|
-
.slice(0, CURSOR_PROVIDER_ERROR_MAX_CHARS);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=cursor-provider-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-provider-error.js","sourceRoot":"","sources":["../../src/core/cursor-provider-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,MAAM,UAAU,GAAG,kDAAkD,CAAC;AAEtE,kGAAkG;AAClG,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;SAC7F,KAAK,CAAC,CAAC,EAAE,+BAA+B,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { SessionTransport } from '../contract/index.js';
|
|
2
|
-
import type { AgentEvent, AgentRunResult, AgentRunner, AgentRunSpec, AgentSession, InputDelivery, SessionOptions } from './agent-runner.ts';
|
|
3
|
-
import type { CursorPrintCapabilityResult } from './cursor-print-capabilities.ts';
|
|
4
|
-
import type { ModelOption } from './runner-model-catalog.ts';
|
|
5
|
-
export interface CursorRunnerOptions {
|
|
6
|
-
sessionTransport?: SessionTransport;
|
|
7
|
-
bin?: string;
|
|
8
|
-
inspect?: (bin: string, spec: AgentRunSpec, signal?: AbortSignal) => Promise<CursorPrintCapabilityResult>;
|
|
9
|
-
makePrint?: (models?: readonly ModelOption[], resolvedModel?: string) => AgentRunner;
|
|
10
|
-
}
|
|
11
|
-
/** A Continue of a session that ran on the removed ACP transport (hearsay-tools/cezarion#1267). */
|
|
12
|
-
export declare const CURSOR_ACP_RESUME_REFUSED: string;
|
|
13
|
-
/** The step error for a Cursor build that fails print qualification (hearsay-tools/cezarion#1267). */
|
|
14
|
-
export declare function cursorPrintUnsupportedMessage(reason: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Runs every Cursor session on print, after a pre-inference qualification check. ACP sessions
|
|
17
|
-
* were removed in hearsay-tools/cezarion#1267: a resume recorded on ACP, or an untagged resume
|
|
18
|
-
* from before print existed, fails before any session starts, and so does an unqualified build.
|
|
19
|
-
*/
|
|
20
|
-
export declare class CursorRunner implements AgentRunner {
|
|
21
|
-
private readonly options;
|
|
22
|
-
readonly backend: 'cursor';
|
|
23
|
-
readonly specSupport: Readonly<Record<keyof AgentRunSpec, import("./agent-runner.ts").SpecFieldSupport>>;
|
|
24
|
-
readonly facts: {
|
|
25
|
-
readonly childWork: 'none';
|
|
26
|
-
readonly hookEvents: 'none';
|
|
27
|
-
readonly nativePermission: 'none';
|
|
28
|
-
readonly transport: 'stdio';
|
|
29
|
-
readonly humanPromptHold: 'turn-end';
|
|
30
|
-
readonly inputDelivery: {
|
|
31
|
-
readonly mode: 'boundary';
|
|
32
|
-
readonly consumption: 'unobservable';
|
|
33
|
-
readonly acknowledgement: 'model-work';
|
|
34
|
-
readonly humanInputAtTurnEnd: 'always-held';
|
|
35
|
-
readonly via: 'next exact-resume print process';
|
|
36
|
-
};
|
|
37
|
-
readonly systemPromptOnResume: 'in-thread';
|
|
38
|
-
readonly nativeAsk: 'auto-skipped';
|
|
39
|
-
readonly nativeSubagents: 'unreported';
|
|
40
|
-
readonly nativeTimerTool: null;
|
|
41
|
-
readonly costReport: 'per-turn';
|
|
42
|
-
readonly sessionIdSource: 'native';
|
|
43
|
-
readonly claudeModelAliases: false;
|
|
44
|
-
readonly turnStart: 'on-wire';
|
|
45
|
-
};
|
|
46
|
-
readonly systemPromptOnResume: "in-thread";
|
|
47
|
-
readonly inputDelivery: InputDelivery;
|
|
48
|
-
private lastSession?;
|
|
49
|
-
constructor(options?: CursorRunnerOptions);
|
|
50
|
-
startSession(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void, opts?: SessionOptions): AgentSession;
|
|
51
|
-
interrupt(): Promise<void>;
|
|
52
|
-
run(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void): Promise<AgentRunResult>;
|
|
53
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { productEnv } from './product-env.js';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { RUNNER_FACTS } from './runner-facts.js';
|
|
4
|
-
import { CursorPrintRunner, CURSOR_PRINT_SPEC_SUPPORT } from './cursor-print-runner.js';
|
|
5
|
-
import { inspectCursorPrintCapabilities } from './cursor-print-capabilities.js';
|
|
6
|
-
import { productName } from '../home/display.js';
|
|
7
|
-
/** A Continue of a session that ran on the removed ACP transport (hearsay-tools/cezarion#1267). */
|
|
8
|
-
export const CURSOR_ACP_RESUME_REFUSED = `This Cursor session was started on the ACP transport, which ${productName('Cezarion')} no longer `
|
|
9
|
-
+ 'supports, so it cannot resume. Start a new task to continue this work.';
|
|
10
|
-
/** The step error for a Cursor build that fails print qualification (hearsay-tools/cezarion#1267). */
|
|
11
|
-
export function cursorPrintUnsupportedMessage(reason) {
|
|
12
|
-
return `Cursor CLI cannot run this task: ${reason}. Run "agent update" to install a supported Cursor CLI, `
|
|
13
|
-
+ `or update ${productName('Cezarion')} if your build is newer than this version supports.`;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Runs every Cursor session on print, after a pre-inference qualification check. ACP sessions
|
|
17
|
-
* were removed in hearsay-tools/cezarion#1267: a resume recorded on ACP, or an untagged resume
|
|
18
|
-
* from before print existed, fails before any session starts, and so does an unqualified build.
|
|
19
|
-
*/
|
|
20
|
-
export class CursorRunner {
|
|
21
|
-
options;
|
|
22
|
-
backend = 'cursor';
|
|
23
|
-
specSupport = CURSOR_PRINT_SPEC_SUPPORT;
|
|
24
|
-
facts = RUNNER_FACTS.cursor;
|
|
25
|
-
systemPromptOnResume = this.facts.systemPromptOnResume;
|
|
26
|
-
inputDelivery = this.facts.inputDelivery;
|
|
27
|
-
lastSession;
|
|
28
|
-
constructor(options = {}) {
|
|
29
|
-
this.options = options;
|
|
30
|
-
}
|
|
31
|
-
startSession(spec, onEvent, opts = {}) {
|
|
32
|
-
const bundledPrintMock = fileURLToPath(new URL('../../scripts/mock-cursor-print.mjs', import.meta.url));
|
|
33
|
-
const bin = this.options.bin ?? productEnv('CURSOR_BIN') ?? (productEnv('DRY_RUN') === '1'
|
|
34
|
-
? bundledPrintMock : 'agent');
|
|
35
|
-
const isBundledMock = bin === bundledPrintMock;
|
|
36
|
-
const mockModels = [
|
|
37
|
-
{ id: 'mock-default-model', label: 'Mock default', description: 'Default model' },
|
|
38
|
-
{ id: 'mock-default-model-xhigh', label: 'Mock high effort', description: 'Mock high effort' },
|
|
39
|
-
];
|
|
40
|
-
const select = async (signal) => {
|
|
41
|
-
// An untagged resume predates print sessions, so its native ID belongs to ACP.
|
|
42
|
-
if (spec.resume && this.options.sessionTransport !== 'cursor-print')
|
|
43
|
-
throw new Error(CURSOR_ACP_RESUME_REFUSED);
|
|
44
|
-
if (isBundledMock) {
|
|
45
|
-
return { models: spec.effort ? mockModels : undefined,
|
|
46
|
-
model: spec.effort && !spec.model ? 'mock-default-model' : undefined };
|
|
47
|
-
}
|
|
48
|
-
const capability = await (this.options.inspect ?? inspectCursorPrintCapabilities)(bin, spec, signal);
|
|
49
|
-
if (!capability.supported)
|
|
50
|
-
throw new Error(cursorPrintUnsupportedMessage(capability.reason));
|
|
51
|
-
return { models: capability.models, model: capability.model, resolvedModel: capability.resolvedModel };
|
|
52
|
-
};
|
|
53
|
-
const makeRunner = (models, resolvedModel) => this.options.makePrint?.(models, resolvedModel)
|
|
54
|
-
?? new CursorPrintRunner({ bin: this.options.bin, models, resolvedModel });
|
|
55
|
-
return this.lastSession = new SelectingCursorSession(select, makeRunner, spec, onEvent, opts);
|
|
56
|
-
}
|
|
57
|
-
async interrupt() { this.lastSession?.interrupt(); }
|
|
58
|
-
run(spec, onEvent) {
|
|
59
|
-
return this.startSession(spec, onEvent, { autoEndAfterFirstTurn: true }).result;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
class SelectingCursorSession {
|
|
63
|
-
result;
|
|
64
|
-
resolveResult;
|
|
65
|
-
inner;
|
|
66
|
-
controller = new AbortController();
|
|
67
|
-
pendingHuman = [];
|
|
68
|
-
active = true;
|
|
69
|
-
settled = false;
|
|
70
|
-
constructor(select, makeRunner, spec, onEvent, opts = {}) {
|
|
71
|
-
this.result = new Promise(resolve => { this.resolveResult = resolve; });
|
|
72
|
-
void (async () => {
|
|
73
|
-
try {
|
|
74
|
-
const { models, model, resolvedModel } = await select(this.controller.signal);
|
|
75
|
-
if (!this.active)
|
|
76
|
-
return;
|
|
77
|
-
const runner = makeRunner(models, resolvedModel);
|
|
78
|
-
const selectedSpec = model && !spec.model ? { ...spec, model } : spec;
|
|
79
|
-
const inner = runner.startSession(selectedSpec, event => onEvent?.(event.type === 'session'
|
|
80
|
-
? { ...event, sessionTransport: 'cursor-print' } : event), opts);
|
|
81
|
-
this.inner = inner;
|
|
82
|
-
if (inner.pid !== undefined)
|
|
83
|
-
opts.onPidChange?.(inner.pid);
|
|
84
|
-
for (const message of this.pendingHuman.splice(0))
|
|
85
|
-
inner.sendMessage(message);
|
|
86
|
-
const result = await inner.result;
|
|
87
|
-
this.settle(result);
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
if (!this.active)
|
|
91
|
-
return;
|
|
92
|
-
const message = error instanceof Error ? error.message : 'Cursor print qualification failed';
|
|
93
|
-
onEvent?.({ type: 'error', message });
|
|
94
|
-
opts.onUiEvent?.({ type: 'session.error', message, fatal: true });
|
|
95
|
-
this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
|
|
96
|
-
}
|
|
97
|
-
})();
|
|
98
|
-
}
|
|
99
|
-
settle(result) {
|
|
100
|
-
if (this.settled)
|
|
101
|
-
return;
|
|
102
|
-
this.settled = true;
|
|
103
|
-
this.active = false;
|
|
104
|
-
this.resolveResult(result);
|
|
105
|
-
}
|
|
106
|
-
get pid() { return this.inner?.pid; }
|
|
107
|
-
get open() { return this.active && (this.inner?.open ?? true); }
|
|
108
|
-
sendMessage(content) {
|
|
109
|
-
if (!this.open)
|
|
110
|
-
return false;
|
|
111
|
-
if (this.inner)
|
|
112
|
-
return this.inner.sendMessage(content);
|
|
113
|
-
this.pendingHuman.push(content);
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
sendAgentMessage(content, ids) {
|
|
117
|
-
return this.inner?.sendAgentMessage(content, ids) ?? false;
|
|
118
|
-
}
|
|
119
|
-
discardQueuedMessages() { this.pendingHuman = []; this.inner?.discardQueuedMessages(); }
|
|
120
|
-
holdsHumanInput() { return this.inner?.holdsHumanInput() ?? this.pendingHuman.length > 0; }
|
|
121
|
-
heldHumanInputCount() { return this.inner?.heldHumanInputCount?.() ?? this.pendingHuman.length; }
|
|
122
|
-
end() {
|
|
123
|
-
if (!this.active)
|
|
124
|
-
return;
|
|
125
|
-
if (this.inner)
|
|
126
|
-
this.inner.end();
|
|
127
|
-
else {
|
|
128
|
-
this.active = false;
|
|
129
|
-
this.controller.abort();
|
|
130
|
-
this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
interrupt() {
|
|
134
|
-
if (!this.active)
|
|
135
|
-
return;
|
|
136
|
-
if (this.inner)
|
|
137
|
-
this.inner.interrupt();
|
|
138
|
-
else {
|
|
139
|
-
this.active = false;
|
|
140
|
-
this.controller.abort();
|
|
141
|
-
this.settle({ text: '', toolCalls: [], tokensUsed: 0 });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=cursor-runner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-runner.js","sourceRoot":"","sources":["../../src/core/cursor-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAGhF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAajD,mGAAmG;AACnG,MAAM,CAAC,MAAM,yBAAyB,GAAG,+DAA+D,WAAW,CAAC,UAAU,CAAC,aAAa;MACxI,wEAAwE,CAAC;AAE7E,sGAAsG;AACtG,MAAM,UAAU,6BAA6B,CAAC,MAAc;IAC1D,OAAO,oCAAoC,MAAM,0DAA0D;UACvG,aAAa,WAAW,CAAC,UAAU,CAAC,qDAAqD,CAAC;AAChG,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAQM,OAAO;IAP3B,OAAO,GAAG,QAAiB,CAAC;IAC5B,WAAW,GAAG,yBAAyB,CAAC;IACxC,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC;IAC5B,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACvD,aAAa,GAAkB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;IACzD,WAAW,CAAgB;IAEnC,YAA6B,OAAO,GAAwB,EAAE;uBAAjC,OAAO;IAA6B,CAAC;IAElE,YAAY,CAAC,IAAkB,EAAE,OAAqC,EAAE,IAA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QAAC,CAAC;IACjH,CAAC;CACF"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// #587: the bootstrap write succeeds first, then stdin dies.
|
|
3
|
-
//
|
|
4
|
-
// The parent writes session/new while the pipe's read end is still open, so
|
|
5
|
-
// that write cannot fail. The child then drops the read end and never answers
|
|
6
|
-
// session/new. The runner's next write — the bootstrap stdin probe — is what
|
|
7
|
-
// must surface the death, not the 15s request timeout.
|
|
8
|
-
//
|
|
9
|
-
// The close is three steps, and the order matters. Closing fd 0 while
|
|
10
|
-
// readline's libuv handle still owns it aborts the child on some machines
|
|
11
|
-
// (SIGABRT — the fixture would become a process-death test); on other
|
|
12
|
-
// machines closeSync alone throws EBADF and never closes the read end, so the
|
|
13
|
-
// parent's write silently succeeds and only the 15s request timeout can catch
|
|
14
|
-
// the hang (#588). destroy() disarms the handle, closeSync(0) actually closes
|
|
15
|
-
// the pipe's read end (destroy alone leaves the fd open). The stdin 'error'
|
|
16
|
-
// handler swallows the EBADF from the next read attempt.
|
|
17
|
-
import { createInterface } from 'node:readline';
|
|
18
|
-
import { closeSync } from 'node:fs';
|
|
19
|
-
const emit = value => process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', ...value })}\n`);
|
|
20
|
-
const rl = createInterface({ input: process.stdin });
|
|
21
|
-
process.stdin.on('error', () => { /* the EBADF below is intentional */ });
|
|
22
|
-
rl.on('line', line => {
|
|
23
|
-
let msg; try { msg = JSON.parse(line); } catch { return; }
|
|
24
|
-
if (msg.method === 'initialize') {
|
|
25
|
-
emit({ id: msg.id, result: { protocolVersion: 1, agentCapabilities: { loadSession: true } } });
|
|
26
|
-
} else if (msg.method === 'session/new') {
|
|
27
|
-
// The parent's write already succeeded into the kernel buffer; only now
|
|
28
|
-
// does the read end die, with the child staying up.
|
|
29
|
-
rl.close();
|
|
30
|
-
process.stdin.destroy();
|
|
31
|
-
try { closeSync(0); } catch { /* already closed */ }
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
process.on('SIGTERM', () => { /* ignore — the child must outlive its stdin */ });
|
|
35
|
-
setInterval(() => {}, 1e6);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// #587: answers initialize, then dies on stdin while the child stays up.
|
|
3
|
-
// The parent's next write (session/new) must hit EPIPE and surface as a fast
|
|
4
|
-
// v1 error.
|
|
5
|
-
//
|
|
6
|
-
// Close before replying: a fast parent sends session/new as soon as it reads
|
|
7
|
-
// initialize, and that write must encounter the dead input pipe. The close is
|
|
8
|
-
// three steps, and the order matters. Closing fd 0 while readline's libuv
|
|
9
|
-
// handle still owns it aborts the child on some machines (SIGABRT — the
|
|
10
|
-
// fixture would become a process-death test); on other machines closeSync
|
|
11
|
-
// alone throws EBADF and never closes the read end, so the parent's write
|
|
12
|
-
// silently succeeds and only the 15s request timeout can catch the hang
|
|
13
|
-
// (#588). destroy() disarms the handle, closeSync(0) actually closes the
|
|
14
|
-
// pipe's read end (destroy alone leaves the fd open).
|
|
15
|
-
import { createInterface } from 'node:readline';
|
|
16
|
-
import { closeSync } from 'node:fs';
|
|
17
|
-
const emit = value => process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', ...value })}\n`);
|
|
18
|
-
const rl = createInterface({ input: process.stdin });
|
|
19
|
-
process.stdin.on('error', () => { /* the EBADF below is intentional */ });
|
|
20
|
-
rl.on('line', line => {
|
|
21
|
-
let msg; try { msg = JSON.parse(line); } catch { return; }
|
|
22
|
-
if (msg.method === 'initialize') {
|
|
23
|
-
rl.close();
|
|
24
|
-
process.stdin.destroy();
|
|
25
|
-
try { closeSync(0); } catch { /* already closed */ }
|
|
26
|
-
emit({ id: msg.id, result: { protocolVersion: 1, agentCapabilities: { loadSession: true } } });
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
process.on('SIGTERM', () => { /* ignore — the child must outlive its stdin */ });
|
|
30
|
-
setInterval(() => {}, 1e6);
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { CURSOR_FAILURES } from './mock-provider-failures.mjs';
|
|
3
|
-
import { loadControls } from './mock-controls.mjs';
|
|
4
|
-
import { scenarioFor, play, PROVIDER_HOLD_SCENARIOS } from './mock-scenario.mjs';
|
|
5
|
-
import { waitForRelease } from './mock-lifecycle.mjs';
|
|
6
|
-
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
import { randomUUID } from 'node:crypto';
|
|
9
|
-
// Print acknowledges an input on its first model work and cannot refuse one, so a held
|
|
10
|
-
// acknowledgement and a held response both hold that first model work.
|
|
11
|
-
const { failureControl, delivery } = await loadControls({ delivery: ['hold-ack', 'hold-response'] });
|
|
12
|
-
const { answerNudge, NO_WAIT_NUDGE_PREFIX } = await import('./mock-nudge.mjs');
|
|
13
|
-
|
|
14
|
-
const args = process.argv.slice(2);
|
|
15
|
-
// No import or await on the ordinary mock path.
|
|
16
|
-
const wireRecorder = process.env.CEZ_MOCK_WIRE_FILE === undefined ? undefined
|
|
17
|
-
: await import('./mock-wire-recorder.mjs');
|
|
18
|
-
wireRecorder?.installWireRecorder();
|
|
19
|
-
if (args.includes('--version')) { process.stdout.write('2026.10.01-e373342\n'); process.exit(0); }
|
|
20
|
-
if (args.includes('__cezar_probe_invalid__')) {
|
|
21
|
-
process.stderr.write('Invalid --allowed-tools value(s): __cezar_probe_invalid__. Expected one of: '+
|
|
22
|
-
'shell_tool_call, delete_tool_call, glob_tool_call, grep_tool_call, read_tool_call, update_todos_tool_call, read_todos_tool_call, edit_tool_call, ls_tool_call, read_lints_tool_call, mcp_tool_call, sem_search_tool_call, create_plan_tool_call, web_search_tool_call, list_mcp_resources_tool_call, read_mcp_resource_tool_call, apply_agent_diff_tool_call, ask_question_tool_call, fetch_tool_call, switch_mode_tool_call, generate_image_tool_call, record_screen_tool_call, computer_use_tool_call, write_shell_stdin_tool_call, reflect_tool_call, setup_vm_environment_tool_call, truncated_tool_call, web_fetch_tool_call, report_bugfix_results_tool_call, ai_attribution_tool_call, pr_management_tool_call, mcp_auth_tool_call, await_tool_call, blame_by_file_path_tool_call, get_mcp_tools_tool_call, report_bug_tool_call, set_active_branch_tool_call, communicate_update_tool_call, send_final_summary_tool_call, update_pr_code_tour_tool_call, replace_env_tool_call, edit_pr_labels_tool_call, record_ci_investigation_findings_tool_call, fetch_cloud_agent_data_tool_call, send_to_user_tool_call, pi_read_tool_call, pi_bash_tool_call, pi_edit_tool_call, pi_write_tool_call, pi_grep_tool_call, pi_find_tool_call, pi_ls_tool_call, connect_scm_tool_call, search_conversations_tool_call, create_goal_tool_call, update_goal_tool_call, get_pr_code_tour_tool_call, write_canvas_tool_call, read_canvas_tool_call, task_tool_call, create_agent_tool_call, adopt_tool_call, send_to_agent_tool_call, send_message_tool_call, get_agent_status_tool_call, stop_agent_tool_call, read_agent_transcript_tool_call, start_grind_execution_tool_call, start_grind_planning_tool_call\n');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
const flag = name => { const at = args.indexOf(name); return at < 0 ? undefined : args[at + 1]; };
|
|
26
|
-
const resumeId = flag('--resume');
|
|
27
|
-
const mode = process.env.CEZ_MOCK_CURSOR_PRINT_MODE ?? 'normal';
|
|
28
|
-
const turn = resumeId ? 2 : 1;
|
|
29
|
-
// Cursor accepts a print prompt on stdin. Preserve the positional form so a
|
|
30
|
-
// regression back to argv delivery is visible to the runner tests.
|
|
31
|
-
const valueFlags = new Set(['--output-format', '--model', '--resume', '--allowed-tools',
|
|
32
|
-
'--add-dir', '--plugin-dir', '--image']);
|
|
33
|
-
let positionalPrompt = '';
|
|
34
|
-
for (let i = 0; i < args.length; i++) {
|
|
35
|
-
if (valueFlags.has(args[i])) { i++; continue; }
|
|
36
|
-
if (!args[i].startsWith('-')) positionalPrompt = args[i];
|
|
37
|
-
}
|
|
38
|
-
const stdinChunks = [];
|
|
39
|
-
if (!positionalPrompt) for await (const chunk of process.stdin) stdinChunks.push(chunk);
|
|
40
|
-
const stdinPrompt = Buffer.concat(stdinChunks).toString('utf8');
|
|
41
|
-
const promptArg = stdinPrompt || positionalPrompt;
|
|
42
|
-
const promptBoundary = promptArg.lastIndexOf('\n\n---\n\n');
|
|
43
|
-
const rawPrompt = promptBoundary < 0 ? promptArg : promptArg.slice(promptBoundary + '\n\n---\n\n'.length);
|
|
44
|
-
const taggedScenarios = [
|
|
45
|
-
['resume-cezar-done', 'a0000001'], ['autonomous-cezar-ask-cap', 'a0000002'],
|
|
46
|
-
['autonomous-cap', 'a0000003'], ['silent-tail-late-turn-start', 'a0000004'],
|
|
47
|
-
['silent-tail-no-reply', 'a0000005'], ['silent-tail-late-reply', 'a0000006'],
|
|
48
|
-
['silent-tail-slow-done', 'a0000007'], ['silent-tail', 'a0000009'],
|
|
49
|
-
];
|
|
50
|
-
const freshTag = taggedScenarios.find(([name]) => rawPrompt.includes(`mock:${name}`))?.[1];
|
|
51
|
-
const id = resumeId && mode !== 'mismatch-on-resume' ? resumeId
|
|
52
|
-
: (freshTag ? freshTag + randomUUID().slice(8) : randomUUID());
|
|
53
|
-
const stateFile = join(process.cwd(), '.ai', 'cezar', 'mock-cursor-print', `${id}.json`);
|
|
54
|
-
let origin = taggedScenarios.find(([, tag]) => resumeId?.startsWith(tag))?.[0];
|
|
55
|
-
if (resumeId && existsSync(stateFile)) {
|
|
56
|
-
try { origin = JSON.parse(readFileSync(stateFile, 'utf8')).origin ?? origin; } catch { /* isolated mock state */ }
|
|
57
|
-
}
|
|
58
|
-
if (freshTag) {
|
|
59
|
-
origin = taggedScenarios.find(([, tag]) => tag === freshTag)?.[0];
|
|
60
|
-
mkdirSync(join(process.cwd(), '.ai', 'cezar', 'mock-cursor-print'), { recursive: true });
|
|
61
|
-
writeFileSync(stateFile, JSON.stringify({ origin }));
|
|
62
|
-
}
|
|
63
|
-
// One process per turn: the session's opening scenario comes from its tag, not a latch.
|
|
64
|
-
const silentOrigin = (origin ?? '').startsWith('silent-tail');
|
|
65
|
-
const prompt = silentOrigin ? rawPrompt : answerNudge(rawPrompt);
|
|
66
|
-
const frame = value => process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
67
|
-
const assistant = text => frame({ type: 'assistant', session_id: id,
|
|
68
|
-
message: { role: 'assistant', content: [{ type: 'text', text }] } });
|
|
69
|
-
const result = (text, error = false) => frame({ type: 'result', subtype: error ? 'error_during_execution' : 'success',
|
|
70
|
-
session_id: id, is_error: error, result: text });
|
|
71
|
-
const readTool = (content = 'A project') => {
|
|
72
|
-
const call = { readToolCall: { args: { path: 'README.md' } } };
|
|
73
|
-
frame({ type: 'tool_call', subtype: 'started', call_id: 'read-1', session_id: id, tool_call: call });
|
|
74
|
-
frame({ type: 'tool_call', subtype: 'completed', call_id: 'read-1', session_id: id,
|
|
75
|
-
tool_call: { readToolCall: { ...call.readToolCall, result: { success: { content } } } } });
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const finish = (text) => { assistant(text); result(text); };
|
|
79
|
-
// hearsay-tools/cezarion#2397: a reply that finishes, asks or waits calls that Squawk tool over
|
|
80
|
-
// the --plugin-dir MCP config before its turn ends. Returns '' or a note for the text.
|
|
81
|
-
const tools = () => import('./mock-ci-tool.mjs');
|
|
82
|
-
const lifecycle = async (call) => (await tools()).lifecycleCall('cursor', args, ...call);
|
|
83
|
-
const done = async (text) => text + await lifecycle((await tools()).DONE);
|
|
84
|
-
const log = process.env.CEZ_MOCK_CURSOR_PRINT_LOG;
|
|
85
|
-
if (log) appendFileSync(log, `${JSON.stringify({ pid: process.pid, resumeId, id, args,
|
|
86
|
-
promptSource: stdinPrompt ? 'stdin' : 'argv', prompt: promptArg })}\n`);
|
|
87
|
-
if (process.env.CEZ_MOCK_ARGS_FILE) {
|
|
88
|
-
appendFileSync(process.env.CEZ_MOCK_ARGS_FILE, `${JSON.stringify(args)}\n`);
|
|
89
|
-
const pluginDir = flag('--plugin-dir');
|
|
90
|
-
if (pluginDir) appendFileSync(process.env.CEZ_MOCK_ARGS_FILE,
|
|
91
|
-
`${JSON.stringify({ type: 'cursor-print-plugin', ...JSON.parse(readFileSync(`${pluginDir}/mcp.json`, 'utf8')) })}\n`);
|
|
92
|
-
}
|
|
93
|
-
if (process.env.CEZ_MOCK_STDIN_FILE && stdinPrompt) {
|
|
94
|
-
appendFileSync(process.env.CEZ_MOCK_STDIN_FILE,
|
|
95
|
-
`${JSON.stringify({ method: 'cursor-print/stdin', prompt: stdinPrompt })}\n`);
|
|
96
|
-
}
|
|
97
|
-
if (mode === 'delay-init') await new Promise(resolve => setTimeout(resolve, 10_000));
|
|
98
|
-
// Reproduce a loaded host's per-process startup cost on every turn: Cursor print
|
|
99
|
-
// spawns one process per turn, so a cap row pays it MAX_AUTO_CONTINUES + 1 times
|
|
100
|
-
// (hearsay-tools/cezarion#1125).
|
|
101
|
-
const spawnDelayMs = Number.parseInt(process.env.CEZ_MOCK_CURSOR_SPAWN_DELAY_MS ?? '0', 10) || 0;
|
|
102
|
-
if (spawnDelayMs > 0) await new Promise(resolve => setTimeout(resolve, spawnDelayMs));
|
|
103
|
-
const attempt = log ? readFileSync(log, 'utf8').trim().split('\n').length : 1;
|
|
104
|
-
const rejectModel = () => process.stderr.write(`Cannot use this model: ${flag('--model')}. Available models: ${'other-model, '.repeat(1000)}\n`);
|
|
105
|
-
if (mode === 'model-rejection-always' || (mode === 'model-rejection-once' && attempt === 1) ||
|
|
106
|
-
(mode === 'model-rejection-on-resume' && resumeId && attempt === 2)) {
|
|
107
|
-
rejectModel(); process.exit(1);
|
|
108
|
-
}
|
|
109
|
-
if (mode === 'model-rejection-held') {
|
|
110
|
-
rejectModel(); await waitForRelease(10_000); process.exit(1);
|
|
111
|
-
}
|
|
112
|
-
if (mode === 'unrelated-startup-error') { process.stderr.write('Account unavailable\n'); process.exit(1); }
|
|
113
|
-
const sharedNames = ['autonomous', 'silent-tail', 'crash-stderr', 'cezar-tool', 'ci-wait',
|
|
114
|
-
'multi-pr-refs', 'turn-messages', 'agent-echo', 'provider-error', ...PROVIDER_HOLD_SCENARIOS.map(([name]) => name), 'hold-cezar-done', 'hold-cezar-ask',
|
|
115
|
-
'cezar-done', 'cezar-ask', 'busy-progress', 'no-progress', 'hold-gated', 'hold', 'deferred-turn-start'];
|
|
116
|
-
// Print has no persistent input, steering, child transcript or cezar-wait reply.
|
|
117
|
-
const unsupported = ['ack-only', 'steer-tool', 'steer-late', 'subagent-after-park', 'cezar-wait'];
|
|
118
|
-
let crashContinues = false;
|
|
119
|
-
const session = {
|
|
120
|
-
get resumeAfterAsk() { return origin === 'resume-cezar-done'; },
|
|
121
|
-
set resumeAfterAsk(value) {
|
|
122
|
-
if (!value) return;
|
|
123
|
-
mkdirSync(join(process.cwd(), '.ai', 'cezar', 'mock-cursor-print'), { recursive: true });
|
|
124
|
-
writeFileSync(stateFile, JSON.stringify({ origin: 'resume-cezar-done' }));
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
function selectScenario(name, text = prompt) {
|
|
128
|
-
return scenarioFor(text, {
|
|
129
|
-
runner: 'cursor', lifecycle, session, nativeFailureControl: Boolean(failureControl),
|
|
130
|
-
unsupported: [...unsupported, ...sharedNames.filter(candidate => candidate !== name)],
|
|
131
|
-
toolPrompt: text => tools().then(module => module.toolPrompt('cursor', args, text)),
|
|
132
|
-
ciPrompt: text => tools().then(module => module.ciPrompt('cursor', args, text)),
|
|
133
|
-
async crash(text) { crashContinues = (await import('./mock-runner-crash.mjs')).crashWithStderr(text, '{"type":"assistant",') === true; },
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
// A missing scenario is synchronous. The player alone awaits asynchronous steps.
|
|
137
|
-
function dispatch(replies, index = 0) {
|
|
138
|
-
for (; index < replies.length; index++) {
|
|
139
|
-
const route = replies[index];
|
|
140
|
-
if (route.when && !route.when()) continue;
|
|
141
|
-
if (route.reply) return route.reply();
|
|
142
|
-
const selected = selectScenario(route.name, route.prompt?.() ?? prompt);
|
|
143
|
-
if (!selected) continue;
|
|
144
|
-
const next = index + 1;
|
|
145
|
-
const finish = outcome => {
|
|
146
|
-
if (selected.name === 'no-progress' || selected.name === 'silent-tail' && origin === 'silent-tail-no-reply' && prompt.includes(NO_WAIT_NUDGE_PREFIX)) {
|
|
147
|
-
setInterval(() => {}, 1000); return new Promise(() => {});
|
|
148
|
-
}
|
|
149
|
-
return outcome === 'continue' || selected.name === 'crash-stderr' && crashContinues ? dispatch(replies, next) : undefined;
|
|
150
|
-
};
|
|
151
|
-
const outcome = play(selected, encoder(selected));
|
|
152
|
-
return outcome instanceof Promise ? outcome.then(finish) : finish(outcome);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function encoder(selected) {
|
|
156
|
-
let text = '';
|
|
157
|
-
return {
|
|
158
|
-
open() {},
|
|
159
|
-
text(step) { const block = step.parts.join(''); text = block; assistant(block); },
|
|
160
|
-
reasoning(step) { frame({ type: 'assistant', session_id: id, message: { role: 'assistant', content: [{ type: 'thinking', thinking: step.text }] } }); },
|
|
161
|
-
toolStart: ({ call }) => scenarioTool(call, false),
|
|
162
|
-
toolEnd: ({ call }) => scenarioTool(call, true),
|
|
163
|
-
child() { throw new Error('Cursor print has no child wire'); },
|
|
164
|
-
readSteers() {},
|
|
165
|
-
progress: () => assistant('working\n'),
|
|
166
|
-
reply: () => prompt === 'inspect the working tree' || prompt.includes('mock:baseline') ? baselineReply() : defaultReply(),
|
|
167
|
-
end(step) {
|
|
168
|
-
const empty = selected.name === 'turn-messages' || selected.name === 'silent-tail' && !prompt.includes(NO_WAIT_NUDGE_PREFIX);
|
|
169
|
-
result(step.error ? CURSOR_FAILURES[step.error] : empty ? '' : text, Boolean(step.error));
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
function scenarioTool(call, completed) {
|
|
174
|
-
const key = call.name === 'read' ? 'readToolCall' : 'shellToolCall';
|
|
175
|
-
const args = call.input;
|
|
176
|
-
const success = call.name === 'read' ? { content: call.output } : { exitCode: call.isError ? 1 : 0, stdout: call.output, stderr: '' };
|
|
177
|
-
frame({ type: 'tool_call', subtype: completed ? 'completed' : 'started', call_id: call.id, session_id: id,
|
|
178
|
-
tool_call: { [key]: { args, ...(completed ? { result: { success } } : {}) } } });
|
|
179
|
-
}
|
|
180
|
-
// Delay admission through the shared script, but keep native init and modes in their slots.
|
|
181
|
-
const deferred = selectScenario('deferred-turn-start');
|
|
182
|
-
if (deferred) await play({ steps: [...deferred.steps].filter(step => step.kind === 'effect') }, encoder(deferred));
|
|
183
|
-
frame({ type: 'system', subtype: 'init', session_id: id, model: flag('--model') ?? 'auto', cwd: process.cwd() });
|
|
184
|
-
if (delivery) {
|
|
185
|
-
await new Promise(resolve => delivery.ack(prompt, resolve));
|
|
186
|
-
await delivery.holdResponse(prompt);
|
|
187
|
-
}
|
|
188
|
-
if (mode === 'model-rejection-after-init' || mode === 'model-rejection-after-work') {
|
|
189
|
-
if (mode === 'model-rejection-after-work') assistant('Work already began');
|
|
190
|
-
rejectModel(); process.exit(1);
|
|
191
|
-
}
|
|
192
|
-
if (mode === 'no-result') process.exit(0);
|
|
193
|
-
if (mode === 'native-question') {
|
|
194
|
-
const args = { title: 'Choice', questions: [{ prompt: 'Choose', options: [{ label: 'Alpha' }, { label: 'Beta' }], allowMultiple: false }], runAsync: false };
|
|
195
|
-
const call = { askQuestionToolCall: { args } };
|
|
196
|
-
frame({ type: 'tool_call', subtype: 'started', call_id: 'question-1', session_id: id, tool_call: call });
|
|
197
|
-
frame({ type: 'tool_call', subtype: 'completed', call_id: 'question-1', session_id: id,
|
|
198
|
-
tool_call: { askQuestionToolCall: { args, result: { rejected: { reason: 'Questions skipped by the user, continue with the information you already have' } } } } });
|
|
199
|
-
finish('I could not ask the question.'); process.exit(0);
|
|
200
|
-
}
|
|
201
|
-
const selectedFailure = failureControl?.failureFor(prompt);
|
|
202
|
-
const nativeFailure = selectedFailure instanceof Promise ? await selectedFailure : selectedFailure;
|
|
203
|
-
if (failureControl ? nativeFailure === 'provider' : mode === 'provider-error') {
|
|
204
|
-
result(CURSOR_FAILURES.provider, true);
|
|
205
|
-
process.exit(0);
|
|
206
|
-
}
|
|
207
|
-
if (silentOrigin) (await import('./mock-silent-tail.mjs')).noteSilentTailPrompt(`mock:${origin}`);
|
|
208
|
-
await dispatch([
|
|
209
|
-
{ name: 'crash-stderr' },
|
|
210
|
-
{ when: () => origin === 'autonomous-cezar-ask-cap' && resumeId && prompt.startsWith('Continue working autonomously until the task is fully complete.'), reply: () => finish('Still working.') },
|
|
211
|
-
{ name: 'autonomous', prompt: () => origin?.startsWith('autonomous') && selectScenario('autonomous') ? `${prompt} mock:${origin}` : prompt },
|
|
212
|
-
{ name: 'silent-tail' },
|
|
213
|
-
{ when: () => origin === 'resume-cezar-done' && resumeId, reply: async () => finish(await done('Resumed work finished.')) },
|
|
214
|
-
{ name: 'cezar-tool' }, { name: 'ci-wait' },
|
|
215
|
-
{ when: () => process.env.CEZ_MOCK_CI_PR, reply: async () => finish(JSON.stringify((await (await tools()).probeCiTool('cursor', args)).response)) },
|
|
216
|
-
...['no-progress', 'busy-progress', 'hold-cezar-done', 'hold-cezar-ask', 'hold-gated', 'multi-pr-refs', 'turn-messages'].map(name => ({ name })),
|
|
217
|
-
{ when: () => prompt.includes('mock:ask-bad'), reply: () => finish('Malformed question skipped.') },
|
|
218
|
-
{ name: 'provider-error' }, ...PROVIDER_HOLD_SCENARIOS.map(([name]) => ({ name })),
|
|
219
|
-
{ when: () => resumeId && /Library:|Tests:|Plan:/.test(prompt), reply: async () => finish(await done('Done.')) },
|
|
220
|
-
{ name: 'cezar-done' },
|
|
221
|
-
{ name: 'cezar-ask', when: () => !resumeId || prompt.includes('mock:cezar-ask-reply-late') },
|
|
222
|
-
{ name: 'hold' },
|
|
223
|
-
{ when: () => prompt === 'inspect the working tree' || prompt.includes('mock:baseline'), reply: baselineReply },
|
|
224
|
-
{ name: 'agent-echo' },
|
|
225
|
-
{ reply: defaultReply },
|
|
226
|
-
]);
|
|
227
|
-
function baselineReply() { readTool(); finish('Cursor inspected the workspace.'); }
|
|
228
|
-
async function defaultReply() {
|
|
229
|
-
const text = `turn ${turn}: ${prompt}`;
|
|
230
|
-
if (mode === 'delay-work' && resumeId) await new Promise(resolve => setTimeout(resolve, 200));
|
|
231
|
-
assistant(text);
|
|
232
|
-
if (mode === 'crash-after-work') process.exit(1);
|
|
233
|
-
result(text);
|
|
234
|
-
if (mode === 'duplicate-result') result(text);
|
|
235
|
-
if (mode === 'late-frame') assistant('LATE_FRAME');
|
|
236
|
-
if (mode === 'result-before-exit') await new Promise(resolve => setTimeout(resolve, 250));
|
|
237
|
-
}
|