@wjarka/cezarion 0.16.0-dev.1503 → 0.16.0-pr923.1504
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 +15 -4
- package/dist/contract/index.js +3 -0
- package/dist/contract/runs.d.ts +30 -0
- package/dist/contract/skills.d.ts +4 -0
- package/dist/core/agent-runner.d.ts +9 -6
- package/dist/core/agent-runner.js +4 -2
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/cursor-print-capabilities.d.ts +12 -0
- package/dist/core/cursor-print-capabilities.js +77 -0
- package/dist/core/cursor-print-capabilities.js.map +1 -0
- package/dist/core/cursor-print-process.d.ts +31 -0
- package/dist/core/cursor-print-process.js +129 -0
- package/dist/core/cursor-print-process.js.map +1 -0
- package/dist/core/cursor-print-runner.d.ts +26 -0
- package/dist/core/cursor-print-runner.js +512 -0
- package/dist/core/cursor-print-runner.js.map +1 -0
- package/dist/core/cursor-print-tool-catalog.d.ts +6 -0
- package/dist/core/cursor-print-tool-catalog.js +78 -0
- package/dist/core/cursor-print-tool-catalog.js.map +1 -0
- package/dist/core/cursor-print-ui-mapper.d.ts +47 -0
- package/dist/core/cursor-print-ui-mapper.js +573 -0
- package/dist/core/cursor-print-ui-mapper.js.map +1 -0
- package/dist/core/cursor-runner.d.ts +24 -0
- package/dist/core/cursor-runner.js +146 -0
- package/dist/core/cursor-runner.js.map +1 -0
- package/dist/core/process-usage.d.ts +5 -0
- package/dist/core/process-usage.js +24 -4
- package/dist/core/process-usage.js.map +1 -1
- package/dist/core/runner-factory.d.ts +4 -1
- package/dist/core/runner-factory.js +3 -3
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/delegation/transport.d.ts +13 -13
- package/dist/runs/store.d.ts +9 -0
- package/dist/runs/store.js +1 -0
- package/dist/runs/store.js.map +1 -1
- package/dist/server/server.d.ts +118 -92
- package/dist/workflows/run.js +39 -8
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-ci-tool.mjs +12 -4
- package/scripts/mock-cursor-acp.mjs +1 -0
- package/scripts/mock-cursor-print.mjs +196 -0
- package/scripts/probe-cursor-print.mjs +616 -0
- package/web/dist/assets/{agent-accounts-CFOBMVHc.js → agent-accounts-CDhVzwnd.js} +1 -1
- package/web/dist/assets/{alert-dialog-BrpNUwMt.js → alert-dialog-A0-kEfJK.js} +1 -1
- package/web/dist/assets/{button-C_rd7CPp.js → button-Jj1Itx83.js} +1 -1
- package/web/dist/assets/{compare-variants-D6WXhvXA.js → compare-variants-aor2j4bO.js} +1 -1
- package/web/dist/assets/{diff-DrEARXTV.js → diff-CDL5SDNO.js} +2 -2
- package/web/dist/assets/{diff-controls-B1-j7nFg.js → diff-controls-BWAkxipD.js} +1 -1
- package/web/dist/assets/{diff-view-DvGLjdTk.js → diff-view-DWh9FnNY.js} +1 -1
- package/web/dist/assets/{dropdown-menu-BegOZFrj.js → dropdown-menu-Ddqp8eUw.js} +1 -1
- package/web/dist/assets/{format-DpNe3S0A.js → format-DTNjugyE.js} +1 -1
- package/web/dist/assets/{git-toolbar-Cw4ljmhB.js → git-toolbar-B4rwm9Lr.js} +1 -1
- package/web/dist/assets/{github-CfV5sqL0.js → github-DgMD1v4U.js} +1 -1
- package/web/dist/assets/{image-preview-FOEfqpZP.js → image-preview-Dy5i96RC.js} +1 -1
- package/web/dist/assets/{index-DgWWlOLy.js → index-BfAearY6.js} +4 -4
- package/web/dist/assets/{nav-row-styles-vp2JbhuJ.js → nav-row-styles-Ci-Ke7wG.js} +1 -1
- package/web/dist/assets/{popover-BohP6WTx.js → popover-BjjDOSGv.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-qTA5KNoJ.js → preview-pane-connected-Nv_nhV63.js} +1 -1
- package/web/dist/assets/{preview-state-vuMviq6q.js → preview-state-D8-YBJ6m.js} +1 -1
- package/web/dist/assets/{prompt-templates-Cubdut_C.js → prompt-templates-DFeXUVOZ.js} +1 -1
- package/web/dist/assets/{repo-git-Cf4t5PD0.js → repo-git-DcWh5s_b.js} +1 -1
- package/web/dist/assets/{run-diff-BpkUW37Z.js → run-diff-1ZzFrOx1.js} +1 -1
- package/web/dist/assets/{run-header-68WHf9wV.js → run-header-CPoYzbAy.js} +1 -1
- package/web/dist/assets/{skills-DiVIgKeU.js → skills-CnLazLgF.js} +1 -1
- package/web/dist/assets/{status-dot-CqTJHSP9.js → status-dot-DwFmt_Jg.js} +1 -1
- package/web/dist/assets/{tab-link-B07Hu4QX.js → tab-link-COpvArgR.js} +1 -1
- package/web/dist/assets/{task-changes--lQF6EYf.js → task-changes-CY-mi-mC.js} +1 -1
- package/web/dist/assets/{task-commits-Cx0qy4DN.js → task-commits-EvLi8T4a.js} +1 -1
- package/web/dist/assets/{task-files-D50s-gKW.js → task-files-BR3d8X2U.js} +1 -1
- package/web/dist/assets/{task-github-item-DaqmSwYT.js → task-github-item-BVsPg9RI.js} +1 -1
- package/web/dist/assets/{task-thread-BPQ64lui.js → task-thread-DQCsu_v8.js} +1 -1
- package/web/dist/assets/{textarea-D20O4Pw0.js → textarea-BbNV5Uo2.js} +1 -1
- package/web/dist/assets/{thread-state-DWcFMrvb.js → thread-state-DTkIvHsU.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-Cy9eyyfL.js → use-hand-to-agent-state-DT-QBsPC.js} +1 -1
- package/web/dist/assets/{utils-JsL3ZsJf.js → utils-POVs3UKu.js} +1 -1
- package/web/dist/assets/{workflows-jwG7uxqi.js → workflows-BTE-5RwX.js} +1 -1
- package/web/dist/assets/{zoomable-image-BJJ64KGc.js → zoomable-image-cL1VgYK4.js} +1 -1
- package/web/dist/index.html +13 -13
package/README.md
CHANGED
|
@@ -941,7 +941,7 @@ cezar is not married to one vendor. Every agent step runs through a single
|
|
|
941
941
|
| **Claude Code** (default) | [`claude`](https://github.com/anthropics/claude-code) | Headless `stream-json` mode. | Per-tool `--allowedTools` (`bashAllowlist` scopes `Bash`); `dontAsk` denies unapproved tools without prompting (`CEZ_APPROVAL_GATE=1` → `acceptEdits` + approval UI; `CEZ_CLAUDE_PERMISSION_MODE=bypass` → `--dangerously-skip-permissions`). |
|
|
942
942
|
| **Codex** | [`codex`](https://github.com/openai/codex) | `codex app-server` — JSON-RPC over stdio, the same transport the Codex IDE extensions use. | Ignores `allowedTools`; inherits managed permissions and Codex approval defaults. Confirmed unmanaged sessions use `danger-full-access`. `CEZ_CODEX_NETWORK=0` requires network restriction: unmanaged sessions use network-blocked `workspace-write`; managed filesystem rules remain intact, and an unconfirmed network restriction stops before any turn. If requirements discovery is unavailable, Codex permission defaults apply. |
|
|
943
943
|
| **OpenCode** _(experimental)_ | [`opencode`](https://opencode.ai) | `opencode serve` — a local HTTP server with an SSE event stream. | Ignores `allowedTools` entirely; every permission is auto-approved. |
|
|
944
|
-
| **Cursor** | [`agent`](https://cursor.com/docs/cli/installation) |
|
|
944
|
+
| **Cursor** | [`agent`](https://cursor.com/docs/cli/installation) | Qualified builds use resumable `--print --output-format stream-json` turns; other builds and legacy sessions use ACP. | Print mode admits marketplace plugins, including user and team plugins, and narrows known native delegation tools for governed runs. Per-run `allowedTools` and `bashAllowlist` are unsupported. |
|
|
945
945
|
| **pi** _(experimental)_ | [`pi`](https://github.com/badlogic/pi-mono) | Persistent `--mode rpc` over JSONL; models are picked with the `provider/model` convention. | Maps `allowedTools` onto pi's `--tools` allowlist; default sessions also pass harness extras (`Subagent`, `SubagentSupervisor`, `SubagentWait`) through `--tools`, and an explicit `allowedTools` still restricts. A configured `bashAllowlist` disables Bash because pi cannot express command-prefix rules. |
|
|
946
946
|
| **OMP** _(experimental)_ | [`omp`](https://github.com/can1357/oh-my-pi) | Persistent `--mode rpc` over JSONL (Oh My Pi, a pi fork); models use the `provider/model` convention and are discovered from `omp models --json`. | Maps `allowedTools` onto OMP's `--tools` allowlist (`[]` becomes `--no-tools`); default sessions also pass `todo`, `lsp`, `ast_edit`, `task` and `wait`. A configured `bashAllowlist` disables `bash` because OMP cannot express command-prefix rules. |
|
|
947
947
|
|
|
@@ -957,10 +957,21 @@ the backends it found — install any one of the six and you're operational.
|
|
|
957
957
|
|
|
958
958
|
Install [Cursor CLI](https://cursor.com/docs/cli/installation) and run `agent login`,
|
|
959
959
|
or set `CURSOR_API_KEY`. Cezar discovers `agent` on PATH; `CEZ_CURSOR_BIN` overrides
|
|
960
|
-
its location. Select **Cursor** in the runner picker
|
|
960
|
+
its location. Select **Cursor** in the runner picker. On the qualified
|
|
961
|
+
`2026.10.01-e373342` build, new sessions use print mode so marketplace plugins
|
|
962
|
+
are available. Cezar checks `agent --version` and the native tool catalog before
|
|
963
|
+
the first turn; `agent --version` is also the quick way to check your installation.
|
|
964
|
+
Other builds use ACP, which may not see marketplace plugins. Existing ACP
|
|
965
|
+
sessions continue on ACP so their conversation history is preserved.
|
|
961
966
|
A missing CLI leaves the other backends available. `CEZ_DRY_RUN=1` uses the mock.
|
|
962
|
-
Cursor
|
|
963
|
-
|
|
967
|
+
Cursor questions from a plugin may be automatically skipped by print mode. Cezar's
|
|
968
|
+
own `CEZ:ASK` questions remain answerable in the cockpit; plugins that require
|
|
969
|
+
native questions may not work fully. Project-local Claude plugin settings may
|
|
970
|
+
not disable a user or team marketplace copy. A previously confirmed Cursor
|
|
971
|
+
session ID can also lose history inside Cursor without an error; Cezar resumes
|
|
972
|
+
the recorded ID and checks that Cursor returns the same ID.
|
|
973
|
+
Cursor provides no qualified token-usage telemetry; Cezar leaves usage unavailable
|
|
974
|
+
instead of estimating it. In ACP mode, Cezar negotiates Cursor’s parameterized model picker and
|
|
964
975
|
shows only the effort levels the selected model advertises. The runner applies
|
|
965
976
|
`effort` or `reasoning` through ACP session config options before prompting;
|
|
966
977
|
unsupported explicit values fail instead of silently using a default. Initial models
|
package/dist/contract/index.js
CHANGED
|
@@ -1620,6 +1620,7 @@ var stepStatusSchema = z14.enum([
|
|
|
1620
1620
|
"cancelled",
|
|
1621
1621
|
"skipped"
|
|
1622
1622
|
]);
|
|
1623
|
+
var sessionTransportSchema = z14.enum(["cursor-acp", "cursor-print"]);
|
|
1623
1624
|
var usageCounterSchema = z14.number().finite().nonnegative();
|
|
1624
1625
|
var stepStateSchema = z14.object({
|
|
1625
1626
|
id: z14.string(),
|
|
@@ -1642,6 +1643,7 @@ var stepStateSchema = z14.object({
|
|
|
1642
1643
|
error: z14.string().optional(),
|
|
1643
1644
|
/** Latest agent session id — `claude --resume <id>` and friends. */
|
|
1644
1645
|
sessionId: z14.string().optional(),
|
|
1646
|
+
sessionTransport: sessionTransportSchema.optional(),
|
|
1645
1647
|
/** Backend that owns `sessionId`; absent on records written before backend affinity. */
|
|
1646
1648
|
backend: runnerSchema.optional(),
|
|
1647
1649
|
/** Agent account (spec 2026-07-29-agent-profiles) that owns `sessionId` — `default`, or a
|
|
@@ -3580,6 +3582,7 @@ export {
|
|
|
3580
3582
|
saveWorkflowResponseSchema,
|
|
3581
3583
|
scheduleLabel,
|
|
3582
3584
|
selectAgentProfileInputSchema,
|
|
3585
|
+
sessionTransportSchema,
|
|
3583
3586
|
setAgentConfigInputSchema,
|
|
3584
3587
|
setConfigInputSchema,
|
|
3585
3588
|
setConfigResponseSchema,
|
package/dist/contract/runs.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ export declare const stepStatusSchema: z.ZodEnum<{
|
|
|
47
47
|
waiting: "waiting";
|
|
48
48
|
}>;
|
|
49
49
|
export type StepStatus = z.infer<typeof stepStatusSchema>;
|
|
50
|
+
/** Wire transport that owns a Cursor native session. Legacy Cursor sessions omit it (ACP). */
|
|
51
|
+
export declare const sessionTransportSchema: z.ZodEnum<{
|
|
52
|
+
"cursor-acp": "cursor-acp";
|
|
53
|
+
"cursor-print": "cursor-print";
|
|
54
|
+
}>;
|
|
55
|
+
export type SessionTransport = z.infer<typeof sessionTransportSchema>;
|
|
50
56
|
/** One step of a run's chain. */
|
|
51
57
|
export declare const stepStateSchema: z.ZodObject<{
|
|
52
58
|
id: z.ZodString;
|
|
@@ -79,6 +85,10 @@ export declare const stepStateSchema: z.ZodObject<{
|
|
|
79
85
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
80
86
|
error: z.ZodOptional<z.ZodString>;
|
|
81
87
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
"cursor-acp": "cursor-acp";
|
|
90
|
+
"cursor-print": "cursor-print";
|
|
91
|
+
}>>;
|
|
82
92
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
83
93
|
claude: "claude";
|
|
84
94
|
codex: "codex";
|
|
@@ -846,6 +856,10 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
846
856
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
847
857
|
error: z.ZodOptional<z.ZodString>;
|
|
848
858
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
859
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
860
|
+
"cursor-acp": "cursor-acp";
|
|
861
|
+
"cursor-print": "cursor-print";
|
|
862
|
+
}>>;
|
|
849
863
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
850
864
|
claude: "claude";
|
|
851
865
|
codex: "codex";
|
|
@@ -1588,6 +1602,10 @@ export declare const apiRunSchema: z.ZodObject<{
|
|
|
1588
1602
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
1589
1603
|
error: z.ZodOptional<z.ZodString>;
|
|
1590
1604
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
1605
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
1606
|
+
"cursor-acp": "cursor-acp";
|
|
1607
|
+
"cursor-print": "cursor-print";
|
|
1608
|
+
}>>;
|
|
1591
1609
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
1592
1610
|
claude: "claude";
|
|
1593
1611
|
codex: "codex";
|
|
@@ -3042,6 +3060,10 @@ export declare const createRunResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
3042
3060
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
3043
3061
|
error: z.ZodOptional<z.ZodString>;
|
|
3044
3062
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
3063
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
3064
|
+
"cursor-acp": "cursor-acp";
|
|
3065
|
+
"cursor-print": "cursor-print";
|
|
3066
|
+
}>>;
|
|
3045
3067
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
3046
3068
|
claude: "claude";
|
|
3047
3069
|
codex: "codex";
|
|
@@ -3777,6 +3799,10 @@ export declare const createRunResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
3777
3799
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
3778
3800
|
error: z.ZodOptional<z.ZodString>;
|
|
3779
3801
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
3802
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
3803
|
+
"cursor-acp": "cursor-acp";
|
|
3804
|
+
"cursor-print": "cursor-print";
|
|
3805
|
+
}>>;
|
|
3780
3806
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
3781
3807
|
claude: "claude";
|
|
3782
3808
|
codex: "codex";
|
|
@@ -4738,6 +4764,10 @@ export declare const pickVariantResponseSchema: z.ZodObject<{
|
|
|
4738
4764
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
4739
4765
|
error: z.ZodOptional<z.ZodString>;
|
|
4740
4766
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
4767
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
4768
|
+
"cursor-acp": "cursor-acp";
|
|
4769
|
+
"cursor-print": "cursor-print";
|
|
4770
|
+
}>>;
|
|
4741
4771
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
4742
4772
|
claude: "claude";
|
|
4743
4773
|
codex: "codex";
|
|
@@ -755,6 +755,10 @@ export declare const startTodoResponseSchema: z.ZodObject<{
|
|
|
755
755
|
finishedAt: z.ZodOptional<z.ZodString>;
|
|
756
756
|
error: z.ZodOptional<z.ZodString>;
|
|
757
757
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
758
|
+
sessionTransport: z.ZodOptional<z.ZodEnum<{
|
|
759
|
+
"cursor-acp": "cursor-acp";
|
|
760
|
+
"cursor-print": "cursor-print";
|
|
761
|
+
}>>;
|
|
758
762
|
backend: z.ZodOptional<z.ZodEnum<{
|
|
759
763
|
claude: "claude";
|
|
760
764
|
codex: "codex";
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* no token-budget circuit breaker, no zod response schemas — one run is one
|
|
5
5
|
* agent-CLI session streaming normalized events.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* process
|
|
7
|
+
* Interchangeable backends implement this seam as logical sessions. Most keep
|
|
8
|
+
* one process across turns; Cursor print replaces its owned process at each
|
|
9
|
+
* turn while preserving the native session ID. Both forms support follow-ups,
|
|
10
|
+
* `waiting`, interrupt and resume:
|
|
9
11
|
* - `claude` — Claude Code CLI, stream-json over stdin/stdout;
|
|
10
12
|
* - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
|
|
11
13
|
* - `opencode` — `opencode serve`, HTTP + SSE;
|
|
@@ -13,6 +15,7 @@
|
|
|
13
15
|
* model with `provider/model`.
|
|
14
16
|
*/
|
|
15
17
|
import type { UiEvent } from './ui-events.ts';
|
|
18
|
+
import type { SessionTransport } from '../contract/index.js';
|
|
16
19
|
/**
|
|
17
20
|
* The user-selectable runners (what config/GUI expose), in display order — the SINGLE source of
|
|
18
21
|
* truth for the set. Every runtime enumeration derives from this tuple (zod schemas, the
|
|
@@ -193,6 +196,7 @@ export type AgentEvent = {
|
|
|
193
196
|
| {
|
|
194
197
|
type: 'session';
|
|
195
198
|
sessionId: string;
|
|
199
|
+
sessionTransport?: SessionTransport;
|
|
196
200
|
}
|
|
197
201
|
/** `unconsumedInputIds`: agent input accepted in this turn that the model never
|
|
198
202
|
* read before the turn ended idle (#505). */
|
|
@@ -256,10 +260,9 @@ export interface SessionOptions {
|
|
|
256
260
|
onPidChange?: (pid: number) => void;
|
|
257
261
|
}
|
|
258
262
|
/**
|
|
259
|
-
* A live agent session
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* (claude stdin, codex app-server, opencode serve).
|
|
263
|
+
* A live logical agent session. Most backends retain one process and read
|
|
264
|
+
* follow-ups from it. Cursor print replaces its process after each completed
|
|
265
|
+
* turn and resumes the same native session ID for follow-ups.
|
|
263
266
|
*/
|
|
264
267
|
export interface AgentSession {
|
|
265
268
|
/** Resolves when the backend process exits — the session is fully over. */
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* no token-budget circuit breaker, no zod response schemas — one run is one
|
|
5
5
|
* agent-CLI session streaming normalized events.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* process
|
|
7
|
+
* Interchangeable backends implement this seam as logical sessions. Most keep
|
|
8
|
+
* one process across turns; Cursor print replaces its owned process at each
|
|
9
|
+
* turn while preserving the native session ID. Both forms support follow-ups,
|
|
10
|
+
* `waiting`, interrupt and resume:
|
|
9
11
|
* - `claude` — Claude Code CLI, stream-json over stdin/stdout;
|
|
10
12
|
* - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
|
|
11
13
|
* - `opencode` — `opencode serve`, HTTP + SSE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAQ1F,gFAAgF;AAChF,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAQ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AAC;AACtB,CAAC;AAmID,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC;AAC/H,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,MAA0C;IACxE,OAAO,MAAM,CAAC,aAAa,IAAI,uBAAuB,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentRunSpec } from './agent-runner.ts';
|
|
2
|
+
import type { ModelOption } from './runner-model-catalog.ts';
|
|
3
|
+
export type CursorPrintCapabilityResult = {
|
|
4
|
+
supported: true;
|
|
5
|
+
models?: readonly ModelOption[];
|
|
6
|
+
model?: string;
|
|
7
|
+
} | {
|
|
8
|
+
supported: false;
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
11
|
+
/** Bounded, pre-inference checks against the exact build and native tool schema qualified for print. */
|
|
12
|
+
export declare function inspectCursorPrintCapabilities(bin: string, spec: AgentRunSpec, signal?: AbortSignal): Promise<CursorPrintCapabilityResult>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { buildChildEnv } from './agent-env.js';
|
|
4
|
+
import { NATIVE_CURSOR_DELEGATION_TOOLS, SAFE_CURSOR_PRINT_TOOLS } from './cursor-print-tool-catalog.js';
|
|
5
|
+
import { parseCursorModels } from './cursor-model-catalog.js';
|
|
6
|
+
const execute = promisify(execFile);
|
|
7
|
+
const QUALIFIED_VERSION = '2026.10.01-e373342';
|
|
8
|
+
const INVALID_TOOL = '__cezar_probe_invalid__';
|
|
9
|
+
const EXPECTED_TOOLS = new Set([...SAFE_CURSOR_PRINT_TOOLS, ...NATIVE_CURSOR_DELEGATION_TOOLS]);
|
|
10
|
+
/** Bounded, pre-inference checks against the exact build and native tool schema qualified for print. */
|
|
11
|
+
export async function inspectCursorPrintCapabilities(bin, spec, signal) {
|
|
12
|
+
const options = {
|
|
13
|
+
cwd: spec.cwd,
|
|
14
|
+
env: buildChildEnv({ backend: 'cursor', extraEnv: spec.env }),
|
|
15
|
+
timeout: 5_000,
|
|
16
|
+
maxBuffer: 64 * 1024,
|
|
17
|
+
signal,
|
|
18
|
+
};
|
|
19
|
+
let version;
|
|
20
|
+
try {
|
|
21
|
+
version = (await execute(bin, ['--version'], options)).stdout.trim();
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error.code === 'ENOENT') {
|
|
25
|
+
throw new Error('Cursor CLI is not installed or is unavailable on PATH');
|
|
26
|
+
}
|
|
27
|
+
throw new Error('Cursor print capability preflight could not read CLI version');
|
|
28
|
+
}
|
|
29
|
+
if (version !== QUALIFIED_VERSION) {
|
|
30
|
+
return { supported: false, reason: `Cursor print marketplace support is qualified for ${QUALIFIED_VERSION}; installed build is not qualified` };
|
|
31
|
+
}
|
|
32
|
+
let output;
|
|
33
|
+
try {
|
|
34
|
+
// Match the trusted headless invocation. In a new task worktree Cursor
|
|
35
|
+
// checks workspace trust before it validates --allowed-tools otherwise.
|
|
36
|
+
await execute(bin, ['--print', '--force', '--trust', '--allowed-tools', INVALID_TOOL, 'capability validation only'], options);
|
|
37
|
+
throw new Error('Cursor print capability preflight did not reject an invalid native tool');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof Error && error.message.startsWith('Cursor print capability preflight'))
|
|
41
|
+
throw error;
|
|
42
|
+
const failure = error;
|
|
43
|
+
if (failure.code !== 1)
|
|
44
|
+
throw new Error('Cursor print capability preflight could not inspect native tools');
|
|
45
|
+
output = `${failure.stderr ?? ''}\n${failure.stdout ?? ''}`;
|
|
46
|
+
}
|
|
47
|
+
const match = /Invalid --allowed-tools value\(s\): __cezar_probe_invalid__\. Expected one of: ([a-z_, ]+)/.exec(output);
|
|
48
|
+
if (!match)
|
|
49
|
+
throw new Error('Cursor print capability preflight returned an unknown native tool response');
|
|
50
|
+
const names = match[1].split(',').map(name => name.trim()).filter(Boolean);
|
|
51
|
+
if (names.length !== EXPECTED_TOOLS.size || new Set(names).size !== EXPECTED_TOOLS.size ||
|
|
52
|
+
names.some(name => !EXPECTED_TOOLS.has(name))) {
|
|
53
|
+
return { supported: false, reason: 'Cursor native tool catalog differs from the qualified print build' };
|
|
54
|
+
}
|
|
55
|
+
if (!spec.model && !spec.effort)
|
|
56
|
+
return { supported: true };
|
|
57
|
+
let models;
|
|
58
|
+
try {
|
|
59
|
+
models = parseCursorModels((await execute(bin, ['--list-models'], options)).stdout);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw new Error('Cursor print capability preflight could not read selected-account models');
|
|
63
|
+
}
|
|
64
|
+
const model = spec.model ?? models.find(option => option.description === 'Default model')?.id;
|
|
65
|
+
if (!model || !models.some(option => option.id === model)) {
|
|
66
|
+
throw new Error('Cursor print requested model is not advertised for the selected account');
|
|
67
|
+
}
|
|
68
|
+
if (spec.effort) {
|
|
69
|
+
const base = model.replace(/-(?:none|low|medium|high|xhigh|extra-high|max)$/, '');
|
|
70
|
+
const suffixes = spec.effort === 'xhigh' ? ['xhigh', 'extra-high'] : [spec.effort];
|
|
71
|
+
if (!suffixes.some(suffix => models.some(option => option.id === `${base}-${suffix}`))) {
|
|
72
|
+
throw new Error('Cursor print requested effort is not advertised for the selected account');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { supported: true, models, model };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=cursor-print-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-print-capabilities.js","sourceRoot":"","sources":["../../src/core/cursor-print-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,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AC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;YACvF,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface CursorPrintProcessOptions {
|
|
2
|
+
bin: string;
|
|
3
|
+
args: readonly string[];
|
|
4
|
+
cwd: string;
|
|
5
|
+
env: NodeJS.ProcessEnv;
|
|
6
|
+
/** Test overrides; production uses the shared runner deadlines. */
|
|
7
|
+
drainMs?: number;
|
|
8
|
+
termGraceMs?: number;
|
|
9
|
+
killGraceMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CursorPrintProcess {
|
|
12
|
+
readonly pid?: number;
|
|
13
|
+
write(content: string): Promise<void>;
|
|
14
|
+
closeInput(): void;
|
|
15
|
+
readonly exit: Promise<{
|
|
16
|
+
code: number | null;
|
|
17
|
+
signal: NodeJS.Signals | null;
|
|
18
|
+
}>;
|
|
19
|
+
readonly settled: Promise<void>;
|
|
20
|
+
stop(mode: 'graceful' | 'interrupt'): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Own one Cursor print turn and its process group. `exit` means the leader
|
|
24
|
+
* exited; `settled` means inherited pipes were bounded and descendants were
|
|
25
|
+
* signalled. A subsequent turn must await `settled`, never just `exit`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function startCursorPrintProcess(options: CursorPrintProcessOptions, callbacks: {
|
|
28
|
+
onStdout(chunk: string): void;
|
|
29
|
+
onStderr(chunk: string): void;
|
|
30
|
+
onOutputError?(error: Error): void;
|
|
31
|
+
}): CursorPrintProcess;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { EOF_KILL_GRACE_MS, EOF_TERM_GRACE_MS } from './runner-runtime.js';
|
|
3
|
+
/**
|
|
4
|
+
* Own one Cursor print turn and its process group. `exit` means the leader
|
|
5
|
+
* exited; `settled` means inherited pipes were bounded and descendants were
|
|
6
|
+
* signalled. A subsequent turn must await `settled`, never just `exit`.
|
|
7
|
+
*/
|
|
8
|
+
export function startCursorPrintProcess(options, callbacks) {
|
|
9
|
+
const isNodeScript = /\.[cm]?js$/.test(options.bin);
|
|
10
|
+
const command = isNodeScript ? process.execPath : options.bin;
|
|
11
|
+
const args = isNodeScript ? [options.bin, ...options.args] : [...options.args];
|
|
12
|
+
const child = spawn(command, args, {
|
|
13
|
+
cwd: options.cwd,
|
|
14
|
+
env: options.env,
|
|
15
|
+
detached: process.platform !== 'win32',
|
|
16
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
17
|
+
});
|
|
18
|
+
const pid = child.pid;
|
|
19
|
+
let closed = false;
|
|
20
|
+
let inputClosed = false;
|
|
21
|
+
let termTimer;
|
|
22
|
+
let killTimer;
|
|
23
|
+
let drainTimer;
|
|
24
|
+
const useGroup = process.platform !== 'win32';
|
|
25
|
+
const groupAlive = () => {
|
|
26
|
+
if (!pid)
|
|
27
|
+
return false;
|
|
28
|
+
try {
|
|
29
|
+
process.kill(useGroup ? -pid : pid, 0);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const signal = (name) => {
|
|
37
|
+
if (!pid)
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
process.kill(useGroup ? -pid : pid, name);
|
|
41
|
+
}
|
|
42
|
+
catch { /* already gone */ }
|
|
43
|
+
};
|
|
44
|
+
child.stdout.setEncoding('utf8');
|
|
45
|
+
child.stderr.setEncoding('utf8');
|
|
46
|
+
child.stdout.on('data', (chunk) => { if (!closed)
|
|
47
|
+
callbacks.onStdout(chunk); });
|
|
48
|
+
child.stderr.on('data', (chunk) => { if (!closed)
|
|
49
|
+
callbacks.onStderr(chunk); });
|
|
50
|
+
child.stdout.on('error', error => { if (!closed)
|
|
51
|
+
callbacks.onOutputError?.(error); });
|
|
52
|
+
child.stderr.on('error', error => { if (!closed)
|
|
53
|
+
callbacks.onOutputError?.(error); });
|
|
54
|
+
// The input pipe can fail after an interrupted turn even if no writer is
|
|
55
|
+
// pending. Keep it observed so an EPIPE cannot crash the server.
|
|
56
|
+
child.stdin.on('error', () => { });
|
|
57
|
+
const exit = new Promise((resolve, reject) => {
|
|
58
|
+
child.once('exit', (code, exitSignal) => resolve({ code, signal: exitSignal }));
|
|
59
|
+
child.once('error', reject);
|
|
60
|
+
});
|
|
61
|
+
const settled = (async () => {
|
|
62
|
+
let failedExit = false;
|
|
63
|
+
try {
|
|
64
|
+
failedExit = (await exit).code !== 0;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
failedExit = true;
|
|
68
|
+
}
|
|
69
|
+
if (termTimer)
|
|
70
|
+
clearTimeout(termTimer);
|
|
71
|
+
if (killTimer)
|
|
72
|
+
clearTimeout(killTimer);
|
|
73
|
+
// The leader can exit while a child retains stdout/stderr. End its owned
|
|
74
|
+
// process group, allow buffered final frames, then force pipe closure.
|
|
75
|
+
// On a crash, allow a short bounded drain for a descendant's final
|
|
76
|
+
// diagnostic before terminating the group (#499/S19).
|
|
77
|
+
if (failedExit)
|
|
78
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
79
|
+
signal('SIGTERM');
|
|
80
|
+
const drainMs = options.drainMs ?? 250;
|
|
81
|
+
await new Promise(resolve => { drainTimer = setTimeout(resolve, drainMs); });
|
|
82
|
+
if (groupAlive())
|
|
83
|
+
signal('SIGKILL');
|
|
84
|
+
child.stdout.destroy();
|
|
85
|
+
child.stderr.destroy();
|
|
86
|
+
if (drainTimer)
|
|
87
|
+
clearTimeout(drainTimer);
|
|
88
|
+
closed = true;
|
|
89
|
+
})();
|
|
90
|
+
const closeInput = () => {
|
|
91
|
+
if (inputClosed)
|
|
92
|
+
return;
|
|
93
|
+
inputClosed = true;
|
|
94
|
+
child.stdin.end();
|
|
95
|
+
};
|
|
96
|
+
const stop = async (mode) => {
|
|
97
|
+
if (closed)
|
|
98
|
+
return;
|
|
99
|
+
closeInput();
|
|
100
|
+
if (termTimer)
|
|
101
|
+
clearTimeout(termTimer);
|
|
102
|
+
if (killTimer)
|
|
103
|
+
clearTimeout(killTimer);
|
|
104
|
+
const termGrace = mode === 'interrupt' ? 0 : options.termGraceMs ?? EOF_TERM_GRACE_MS;
|
|
105
|
+
const killGrace = options.killGraceMs ?? EOF_KILL_GRACE_MS;
|
|
106
|
+
if (termGrace === 0)
|
|
107
|
+
signal('SIGTERM');
|
|
108
|
+
else
|
|
109
|
+
termTimer = setTimeout(() => signal('SIGTERM'), termGrace);
|
|
110
|
+
killTimer = setTimeout(() => { if (groupAlive())
|
|
111
|
+
signal('SIGKILL'); }, termGrace + killGrace);
|
|
112
|
+
await settled;
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
pid,
|
|
116
|
+
exit,
|
|
117
|
+
settled,
|
|
118
|
+
closeInput,
|
|
119
|
+
stop,
|
|
120
|
+
write(content) {
|
|
121
|
+
if (inputClosed || closed)
|
|
122
|
+
return Promise.reject(new Error('Cursor print input is closed'));
|
|
123
|
+
return new Promise((resolve, reject) => {
|
|
124
|
+
child.stdin.write(content, error => error ? reject(error) : resolve());
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=cursor-print-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-print-process.js","sourceRoot":"","sources":["../../src/core/cursor-print-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAA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,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC5F,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentEvent, AgentRunResult, AgentRunner, AgentRunSpec, AgentRunSpecSupport, AgentSession, InputDelivery, SessionOptions } from './agent-runner.ts';
|
|
2
|
+
import type { ModelOption } from './runner-model-catalog.ts';
|
|
3
|
+
import { type CursorPrintProcessOptions } from './cursor-print-process.ts';
|
|
4
|
+
/** Cursor print fields with live-qualified invocation mechanisms. */
|
|
5
|
+
export declare const CURSOR_PRINT_SPEC_SUPPORT: AgentRunSpecSupport;
|
|
6
|
+
export interface CursorPrintRunnerOptions {
|
|
7
|
+
bin?: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
/** The selected account's read-only model catalog, supplied by the facade. */
|
|
10
|
+
models?: readonly ModelOption[];
|
|
11
|
+
/** Test override; production retains the shared 30-minute no-progress cap. */
|
|
12
|
+
noProgressTimeoutMs?: number;
|
|
13
|
+
processOptions?: Pick<CursorPrintProcessOptions, 'drainMs' | 'termGraceMs' | 'killGraceMs'>;
|
|
14
|
+
}
|
|
15
|
+
export declare class CursorPrintRunner implements AgentRunner {
|
|
16
|
+
private readonly options;
|
|
17
|
+
readonly backend: 'cursor';
|
|
18
|
+
readonly specSupport: Readonly<Record<keyof AgentRunSpec, import("./agent-runner.ts").SpecFieldSupport>>;
|
|
19
|
+
readonly systemPromptOnResume: 'in-thread';
|
|
20
|
+
readonly inputDelivery: InputDelivery;
|
|
21
|
+
private lastSession?;
|
|
22
|
+
constructor(options?: CursorPrintRunnerOptions);
|
|
23
|
+
startSession(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void, opts?: SessionOptions): AgentSession;
|
|
24
|
+
run(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void): Promise<AgentRunResult>;
|
|
25
|
+
interrupt(): Promise<void>;
|
|
26
|
+
}
|