@super-one/cli 0.53.7-alpha → 0.53.8-alpha
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/MANIFEST.json +2 -2
- package/lib/cli.mjs +196 -48
- package/package.json +1 -1
package/MANIFEST.json
CHANGED
package/lib/cli.mjs
CHANGED
|
@@ -257,9 +257,10 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
257
257
|
"bypassPermissions",
|
|
258
258
|
"plan",
|
|
259
259
|
"dontAsk",
|
|
260
|
-
"auto"
|
|
260
|
+
"auto",
|
|
261
|
+
"agent"
|
|
261
262
|
],
|
|
262
|
-
"description": 'How autonomous the child session is. Prefer the most autonomous mode it can finish the task under \u2014 "bypassPermissions" (shown as Bypass on Claude-family harnesses, Full Access on Codex), or "auto" for ACP agents. Nobody watches a child session, so a conservative mode strands it on an approval prompt that is never answered. Requesting an autonomous mode is safe by construction: nothing runs until the user approves this very request, and that approval dialog is where they downgrade permission or sandbox per launch. Pick "plan" or "default" only when stopping for human review is the point of the launch.'
|
|
263
|
+
"description": 'How autonomous the child session is. Prefer the most autonomous mode it can finish the task under \u2014 "bypassPermissions" (shown as Bypass on Claude-family harnesses, Full Access on Codex/Cursor), "agent" for Cursor, or "auto" for ACP agents. Nobody watches a child session, so a conservative mode strands it on an approval prompt that is never answered. Requesting an autonomous mode is safe by construction: nothing runs until the user approves this very request, and that approval dialog is where they downgrade permission or sandbox per launch. Pick "plan" or "default" only when stopping for human review is the point of the launch.'
|
|
263
264
|
},
|
|
264
265
|
"sandboxMode": {
|
|
265
266
|
"type": "string",
|
|
@@ -411,7 +412,7 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
411
412
|
"modules": {
|
|
412
413
|
"type": "array",
|
|
413
414
|
"minItems": 1,
|
|
414
|
-
"maxItems":
|
|
415
|
+
"maxItems": 6,
|
|
415
416
|
"uniqueItems": true,
|
|
416
417
|
"items": {
|
|
417
418
|
"type": "string",
|
|
@@ -420,7 +421,8 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
420
421
|
"mockup",
|
|
421
422
|
"interactive",
|
|
422
423
|
"chart",
|
|
423
|
-
"art"
|
|
424
|
+
"art",
|
|
425
|
+
"native"
|
|
424
426
|
]
|
|
425
427
|
},
|
|
426
428
|
"description": "Widget only: one or more guideline modules. Mutually exclusive with topic."
|
|
@@ -659,7 +661,11 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
659
661
|
},
|
|
660
662
|
{
|
|
661
663
|
"name": "session_rename",
|
|
662
|
-
"description":
|
|
664
|
+
"description": `Rename the current chat session to a concise topic label shown in the sidebar. Always pass tags (set): 1\u20134 short kebab-case labels you choose so session_list/session_search can find this chat. Reuse names from session_tag_list when they fit; invent one when they don't.
|
|
665
|
+
|
|
666
|
+
Only the top-level agent talking directly to the user may call this. If you were launched as a Task/subagent worker, do NOT call it \u2014 you do not own the user-facing session title.
|
|
667
|
+
|
|
668
|
+
If the tool returns an error containing "user_locked", the user has manually named this session \u2014 do not call session_rename again. Tags in the same call were still applied; use session_tag for later tag edits.`,
|
|
663
669
|
"inputSchema": {
|
|
664
670
|
"type": "object",
|
|
665
671
|
"properties": {
|
|
@@ -673,7 +679,7 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
673
679
|
"type": "array",
|
|
674
680
|
"items": { "type": "string" },
|
|
675
681
|
"maxItems": 8,
|
|
676
|
-
"description": "Replace this session's tags (set).
|
|
682
|
+
"description": "Replace this session's tags (set). Pass 1\u20134 short kebab-case labels you choose. Reuse names from session_tag_list when they fit; invent when they don't. Empty array clears. Applied even when the title is user_locked."
|
|
677
683
|
}
|
|
678
684
|
},
|
|
679
685
|
"required": [
|
|
@@ -684,7 +690,7 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
684
690
|
},
|
|
685
691
|
{
|
|
686
692
|
"name": "session_tag",
|
|
687
|
-
"description": "Tag SuperOne sessions so session_list/session_search can filter by tag. Default: current session. Pass sessionId for one other session, or sessionIds with add to tag many. Use add, remove, or set (exactly one). set: [] clears.
|
|
693
|
+
"description": "Tag SuperOne sessions so session_list/session_search can filter by tag. Default: current session. Pass sessionId for one other session, or sessionIds with add to tag many. Use add, remove, or set (exactly one). set: [] clears. Pick 1\u20134 short kebab-case labels; reuse names from session_tag_list when they fit, otherwise invent. Only the top-level agent may call this; subagents must not. Not session_rename (titles) and not live collab.",
|
|
688
694
|
"inputSchema": {
|
|
689
695
|
"type": "object",
|
|
690
696
|
"properties": {
|
|
@@ -3373,7 +3379,7 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
3373
3379
|
},
|
|
3374
3380
|
{
|
|
3375
3381
|
"name": "widget_show",
|
|
3376
|
-
"description":
|
|
3382
|
+
"description": `Render SVG, diagrams, charts, or interactive HTML inline in chat. Pass widget_code for new content, or template + data to reuse a saved template. To show media you produced yourself, pass a @native/* template so it renders in SuperOne's own gallery (viewer, download, drag-out) instead of a lookalike you build in widget_code \u2014 call widget_list_templates for the list. Before the first new widget in a session, load the relevant design modules with read_manual({ domain: "widget", modules: [...] }).`,
|
|
3377
3383
|
"inputSchema": {
|
|
3378
3384
|
"type": "object",
|
|
3379
3385
|
"properties": {
|
|
@@ -3538,7 +3544,7 @@ var init_host_action_superone_descriptors = __esm({
|
|
|
3538
3544
|
},
|
|
3539
3545
|
"permissionMode": {
|
|
3540
3546
|
"type": "string",
|
|
3541
|
-
"enum": ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto"],
|
|
3547
|
+
"enum": ["default", "acceptEdits", "bypassPermissions", "plan", "dontAsk", "auto", "agent"],
|
|
3542
3548
|
"description": "Unified permission mode. Prefer bypassPermissions for unattended runs."
|
|
3543
3549
|
},
|
|
3544
3550
|
"sandboxMode": {
|
|
@@ -12757,7 +12763,7 @@ var SUPERONE_SYSTEM_PROMPT_APPEND;
|
|
|
12757
12763
|
var init_superone_system_prompt = __esm({
|
|
12758
12764
|
"../../packages/shared/src/superone-system-prompt.ts"() {
|
|
12759
12765
|
"use strict";
|
|
12760
|
-
SUPERONE_SYSTEM_PROMPT_APPEND = 'You are running inside SuperOne, a desktop GUI app \u2014 not a terminal. Your replies render as rich Markdown in a chat panel.\n\nPrefer the `widget_show` tool over plain markdown when the user wants something visual, data-heavy, or interactive. For mermaid diagrams, use fenced ```mermaid blocks instead \u2014 the host renders those natively.\n\nTwo markdown forms get special rendering from the host:\n- When you reference a project file, write it as a markdown link with an absolute path \u2014 it renders as a clickable chip. Add `:N` or `#LN` for a line, e.g. `[file.ts](/abs/path/file.ts:42)`.\n- `` embeds an image/video/audio file as an inline player. Use it ONLY when the user explicitly asks to see a file (e.g. "show me ..."), at most once per file per reply. If they only want a path or location, give a plain link instead \u2014 never the embed.\n- Media you create with a generation tool (e.g. `media_generate_image`, `media_generate_video`) is shown to the user inline by the host automatically. Never re-embed or link the result in your reply with Markdown (`![...]` or `[...]`) \u2014 that duplicates it. Just describe the result briefly in words.\n\nOn the first substantive user request, call `session_rename` as your first tool call, before answering \u2014 until you do, the title falls back to a noisy slice of the first message. Also rename when the user approves a plan, when the conversation shifts to a substantially different topic, or every ~10 user turns if the title has drifted. Title rules: 4-8 words, prefer "verb + object" over abstract nouns, match the user\'s conversation language, no surrounding quotes or trailing punctuation.';
|
|
12766
|
+
SUPERONE_SYSTEM_PROMPT_APPEND = 'You are running inside SuperOne, a desktop GUI app \u2014 not a terminal. Your replies render as rich Markdown in a chat panel.\n\nPrefer the `widget_show` tool over plain markdown when the user wants something visual, data-heavy, or interactive. For mermaid diagrams, use fenced ```mermaid blocks instead \u2014 the host renders those natively.\n\nTwo markdown forms get special rendering from the host:\n- When you reference a project file, write it as a markdown link with an absolute path \u2014 it renders as a clickable chip. Add `:N` or `#LN` for a line, e.g. `[file.ts](/abs/path/file.ts:42)`.\n- `` embeds an image/video/audio file as an inline player. Use it ONLY when the user explicitly asks to see a file (e.g. "show me ..."), at most once per file per reply. If they only want a path or location, give a plain link instead \u2014 never the embed.\n- Media you create with a generation tool (e.g. `media_generate_image`, `media_generate_video`) is shown to the user inline by the host automatically. Never re-embed or link the result in your reply with Markdown (`![...]` or `[...]`) \u2014 that duplicates it. Just describe the result briefly in words.\n\nOn the first substantive user request, call `session_rename` as your first tool call, before answering \u2014 until you do, the title falls back to a noisy slice of the first message. Always include `tags` on that call: 1\u20134 short kebab-case labels you pick so session_list/session_search can find this chat later. Reuse names from `session_tag_list` when they fit; invent one when they don\'t. Update tags with `session_tag` if the topic shifts. Also rename when the user approves a plan, when the conversation shifts to a substantially different topic, or every ~10 user turns if the title has drifted. Title rules: 4-8 words, prefer "verb + object" over abstract nouns, match the user\'s conversation language, no surrounding quotes or trailing punctuation.';
|
|
12761
12767
|
}
|
|
12762
12768
|
});
|
|
12763
12769
|
|
|
@@ -42021,9 +42027,94 @@ function formatSearchToolPayload(obj) {
|
|
|
42021
42027
|
}
|
|
42022
42028
|
return lines.join("\n").trim() || null;
|
|
42023
42029
|
}
|
|
42030
|
+
function isShellCommandResult(obj) {
|
|
42031
|
+
const hasStream = typeof obj.stdout === "string" || typeof obj.stderr === "string";
|
|
42032
|
+
if (!hasStream) return false;
|
|
42033
|
+
return typeof obj.exitCode === "number" || typeof obj.exit_code === "number" || typeof obj.signal === "string" || typeof obj.executionTime === "number";
|
|
42034
|
+
}
|
|
42035
|
+
function formatShellCommandResult(obj) {
|
|
42036
|
+
const stdout = typeof obj.stdout === "string" ? obj.stdout : "";
|
|
42037
|
+
const stderr = typeof obj.stderr === "string" ? obj.stderr : "";
|
|
42038
|
+
if (stdout && stderr) {
|
|
42039
|
+
return stdout.endsWith("\n") ? `${stdout}${stderr}` : `${stdout}
|
|
42040
|
+
${stderr}`;
|
|
42041
|
+
}
|
|
42042
|
+
if (stdout || stderr) return stdout || stderr;
|
|
42043
|
+
const code = typeof obj.exitCode === "number" ? obj.exitCode : obj.exit_code;
|
|
42044
|
+
if (typeof code === "number" && code !== 0) return `Exit code ${code}`;
|
|
42045
|
+
return "";
|
|
42046
|
+
}
|
|
42047
|
+
function isCursorGrepResult(obj) {
|
|
42048
|
+
const workspaces = obj.workspaceResults;
|
|
42049
|
+
if (workspaces && typeof workspaces === "object" && !Array.isArray(workspaces)) return true;
|
|
42050
|
+
return obj.activeEditorResult != null && typeof obj.activeEditorResult === "object";
|
|
42051
|
+
}
|
|
42052
|
+
function formatGrepUnion(result) {
|
|
42053
|
+
const rec = result && typeof result === "object" && !Array.isArray(result) ? result : null;
|
|
42054
|
+
if (!rec) return "";
|
|
42055
|
+
const output = rec.output && typeof rec.output === "object" && !Array.isArray(rec.output) ? rec.output : rec;
|
|
42056
|
+
const type = typeof rec.type === "string" ? rec.type : "";
|
|
42057
|
+
if (type === "files" || Array.isArray(output.files)) {
|
|
42058
|
+
const files = Array.isArray(output.files) ? output.files.filter((f2) => typeof f2 === "string") : [];
|
|
42059
|
+
return files.join("\n");
|
|
42060
|
+
}
|
|
42061
|
+
if (type === "count" || Array.isArray(output.counts)) {
|
|
42062
|
+
const counts = Array.isArray(output.counts) ? output.counts : [];
|
|
42063
|
+
const lines2 = [];
|
|
42064
|
+
for (const entry of counts) {
|
|
42065
|
+
if (!entry || typeof entry !== "object") continue;
|
|
42066
|
+
const row = entry;
|
|
42067
|
+
const file2 = typeof row.file === "string" ? row.file : "";
|
|
42068
|
+
const count = typeof row.count === "number" ? row.count : "";
|
|
42069
|
+
if (file2) lines2.push(count === "" ? file2 : `${file2}:${count}`);
|
|
42070
|
+
}
|
|
42071
|
+
return lines2.join("\n");
|
|
42072
|
+
}
|
|
42073
|
+
const matches = Array.isArray(output.matches) ? output.matches : [];
|
|
42074
|
+
const lines = [];
|
|
42075
|
+
for (const entry of matches) {
|
|
42076
|
+
if (!entry || typeof entry !== "object") continue;
|
|
42077
|
+
const row = entry;
|
|
42078
|
+
const file2 = typeof row.file === "string" ? row.file : "";
|
|
42079
|
+
if (!file2) continue;
|
|
42080
|
+
const lineNo = typeof row.lineNumber === "number" ? row.lineNumber : null;
|
|
42081
|
+
const line = typeof row.line === "string" ? row.line : "";
|
|
42082
|
+
if (lineNo != null && line) lines.push(`${file2}:${lineNo}:${line}`);
|
|
42083
|
+
else if (line) lines.push(`${file2}:${line}`);
|
|
42084
|
+
else lines.push(file2);
|
|
42085
|
+
}
|
|
42086
|
+
return lines.join("\n");
|
|
42087
|
+
}
|
|
42088
|
+
function formatCursorGrepResult(obj) {
|
|
42089
|
+
const chunks = [];
|
|
42090
|
+
const editor = formatGrepUnion(obj.activeEditorResult);
|
|
42091
|
+
if (editor) chunks.push(editor);
|
|
42092
|
+
const workspaces = asPlainRecord(obj.workspaceResults);
|
|
42093
|
+
if (workspaces) {
|
|
42094
|
+
const roots = Object.keys(workspaces);
|
|
42095
|
+
const multi = roots.length > 1;
|
|
42096
|
+
for (const root of roots) {
|
|
42097
|
+
const body = formatGrepUnion(workspaces[root]);
|
|
42098
|
+
if (!body) continue;
|
|
42099
|
+
chunks.push(multi ? `${root}
|
|
42100
|
+
${body}` : body);
|
|
42101
|
+
}
|
|
42102
|
+
}
|
|
42103
|
+
return chunks.join("\n");
|
|
42104
|
+
}
|
|
42105
|
+
function asPlainRecord(value) {
|
|
42106
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
42107
|
+
return value;
|
|
42108
|
+
}
|
|
42109
|
+
function isCursorGlobResult(obj) {
|
|
42110
|
+
return Array.isArray(obj.files) && obj.files.every((f2) => typeof f2 === "string") && typeof obj.totalFiles === "number";
|
|
42111
|
+
}
|
|
42112
|
+
function formatCursorGlobResult(obj) {
|
|
42113
|
+
return obj.files.join("\n");
|
|
42114
|
+
}
|
|
42024
42115
|
function isAgentOutputEnvelope(obj) {
|
|
42025
42116
|
const t = obj.type;
|
|
42026
|
-
return t === "MCP" || t === "ListDir" || t === "list_dir" || t === "LS" || t === "Todo" || t === "SearchTool" || t === "GrepSearch" || t === "grep" || obj.TodosUpdated != null || obj.Content != null && typeof obj.Content === "object" || Array.isArray(obj.results) || obj.action != null && typeof obj.action === "object";
|
|
42117
|
+
return t === "MCP" || t === "ListDir" || t === "list_dir" || t === "LS" || t === "Todo" || t === "SearchTool" || t === "GrepSearch" || t === "grep" || obj.TodosUpdated != null || obj.Content != null && typeof obj.Content === "object" || Array.isArray(obj.results) || obj.action != null && typeof obj.action === "object" || isShellCommandResult(obj) || isCursorGrepResult(obj) || isCursorGlobResult(obj);
|
|
42027
42118
|
}
|
|
42028
42119
|
function formatAgentToolOutput(raw) {
|
|
42029
42120
|
if (raw == null) return "";
|
|
@@ -42079,6 +42170,15 @@ function formatAgentToolOutput(raw) {
|
|
|
42079
42170
|
const text = bytesOrStringToText(obj.stdout ?? obj.content ?? obj.output);
|
|
42080
42171
|
if (text) return text;
|
|
42081
42172
|
}
|
|
42173
|
+
if (isShellCommandResult(obj)) {
|
|
42174
|
+
return formatShellCommandResult(obj);
|
|
42175
|
+
}
|
|
42176
|
+
if (isCursorGrepResult(obj)) {
|
|
42177
|
+
return formatCursorGrepResult(obj);
|
|
42178
|
+
}
|
|
42179
|
+
if (isCursorGlobResult(obj)) {
|
|
42180
|
+
return formatCursorGlobResult(obj);
|
|
42181
|
+
}
|
|
42082
42182
|
const action = obj.action;
|
|
42083
42183
|
if (action && typeof action === "object") {
|
|
42084
42184
|
const a = action;
|
|
@@ -42133,7 +42233,20 @@ function formatAgentToolOutput(raw) {
|
|
|
42133
42233
|
return String(raw);
|
|
42134
42234
|
}
|
|
42135
42235
|
}
|
|
42136
|
-
|
|
42236
|
+
function truncateTranscriptToolResult(text, max = MAX_TRANSCRIPT_TOOL_RESULT_CHARS) {
|
|
42237
|
+
if (text.length <= max) return text;
|
|
42238
|
+
const omitted = text.length - max;
|
|
42239
|
+
return `${text.slice(0, max)}
|
|
42240
|
+
|
|
42241
|
+
\u2026 truncated ${omitted.toLocaleString()} characters`;
|
|
42242
|
+
}
|
|
42243
|
+
function formatTranscriptToolResult(content, opts) {
|
|
42244
|
+
const formatted = formatAgentToolOutput(content);
|
|
42245
|
+
if (!formatted) return "";
|
|
42246
|
+
const max = opts?.maxChars ?? MAX_TRANSCRIPT_TOOL_RESULT_CHARS;
|
|
42247
|
+
return truncateTranscriptToolResult(formatted, max);
|
|
42248
|
+
}
|
|
42249
|
+
var TOOL_ID_TO_UI_NAME, MAX_TRANSCRIPT_TOOL_RESULT_CHARS;
|
|
42137
42250
|
var init_tool_ui = __esm({
|
|
42138
42251
|
"../../packages/shared/src/tool-ui.ts"() {
|
|
42139
42252
|
"use strict";
|
|
@@ -42214,6 +42327,7 @@ var init_tool_ui = __esm({
|
|
|
42214
42327
|
scheduler_delete: "SchedulerDelete",
|
|
42215
42328
|
scheduler_list: "SchedulerList"
|
|
42216
42329
|
};
|
|
42330
|
+
MAX_TRANSCRIPT_TOOL_RESULT_CHARS = 48e3;
|
|
42217
42331
|
}
|
|
42218
42332
|
});
|
|
42219
42333
|
|
|
@@ -51520,7 +51634,7 @@ function mapPermissionToCursorLocal(mode) {
|
|
|
51520
51634
|
if (mode === "plan") {
|
|
51521
51635
|
return { mode: "plan", autoReview: false };
|
|
51522
51636
|
}
|
|
51523
|
-
if (mode === "auto" || mode === "acceptEdits" || mode === "default") {
|
|
51637
|
+
if (mode === "agent" || mode === "auto" || mode === "acceptEdits" || mode === "default") {
|
|
51524
51638
|
return { mode: "agent", autoReview: true };
|
|
51525
51639
|
}
|
|
51526
51640
|
return { mode: "agent", autoReview: false };
|
|
@@ -51793,13 +51907,21 @@ function stableIdField(obj, ...keys) {
|
|
|
51793
51907
|
if (!obj || typeof obj !== "object") return null;
|
|
51794
51908
|
const rec = obj;
|
|
51795
51909
|
for (const key of keys) {
|
|
51796
|
-
|
|
51910
|
+
const v2 = rec[key];
|
|
51911
|
+
if (typeof v2 === "string" && v2) return v2;
|
|
51912
|
+
if (typeof v2 === "number" && Number.isFinite(v2)) return String(v2);
|
|
51797
51913
|
}
|
|
51798
51914
|
return null;
|
|
51799
51915
|
}
|
|
51800
51916
|
function idField(obj, ...keys) {
|
|
51801
51917
|
return stableIdField(obj, ...keys) ?? `tool_${Date.now()}`;
|
|
51802
51918
|
}
|
|
51919
|
+
function extractCursorCallId(update) {
|
|
51920
|
+
const rec = asRecord9(update);
|
|
51921
|
+
if (!rec) return null;
|
|
51922
|
+
const nested = asRecord9(rec.toolCall) ?? asRecord9(rec.message);
|
|
51923
|
+
return stableIdField(rec, ...TOOL_CALL_ID_KEYS) ?? (nested ? stableIdField(nested, ...TOOL_CALL_ID_KEYS) : null);
|
|
51924
|
+
}
|
|
51803
51925
|
function asRecord9(value) {
|
|
51804
51926
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
51805
51927
|
return value;
|
|
@@ -51815,7 +51937,7 @@ function stringifyPayload(value) {
|
|
|
51815
51937
|
}
|
|
51816
51938
|
function extractToolCallParts(update) {
|
|
51817
51939
|
const rec = asRecord9(update) ?? {};
|
|
51818
|
-
const callId =
|
|
51940
|
+
const callId = extractCursorCallId(update);
|
|
51819
51941
|
const nested = asRecord9(rec.toolCall);
|
|
51820
51942
|
if (nested) {
|
|
51821
51943
|
const toolType2 = typeof nested.type === "string" && nested.type ? nested.type : "Tool";
|
|
@@ -51880,12 +52002,28 @@ function normalizeCursorToolInput(toolName, args) {
|
|
|
51880
52002
|
function mergeCursorToolResultArgs(toolType, args, result) {
|
|
51881
52003
|
if (toolType.toLowerCase() === "mcp") return args;
|
|
51882
52004
|
const res = asRecord9(result);
|
|
51883
|
-
|
|
51884
|
-
if (!diff) return args;
|
|
52005
|
+
if (!res) return args;
|
|
51885
52006
|
const rec = asRecord9(args);
|
|
51886
52007
|
if (!rec) return args;
|
|
51887
|
-
|
|
51888
|
-
|
|
52008
|
+
const diff = typeof res.diffString === "string" ? res.diffString : void 0;
|
|
52009
|
+
const linesAdded = typeof res.linesAdded === "number" ? res.linesAdded : void 0;
|
|
52010
|
+
const linesRemoved = typeof res.linesRemoved === "number" ? res.linesRemoved : void 0;
|
|
52011
|
+
if (!diff && linesAdded == null && linesRemoved == null) return args;
|
|
52012
|
+
const next = { ...rec };
|
|
52013
|
+
let changed = false;
|
|
52014
|
+
if (diff && rec.diffString == null && rec.diff == null) {
|
|
52015
|
+
next.diffString = diff;
|
|
52016
|
+
changed = true;
|
|
52017
|
+
}
|
|
52018
|
+
if (linesAdded != null && rec.linesAdded == null) {
|
|
52019
|
+
next.linesAdded = linesAdded;
|
|
52020
|
+
changed = true;
|
|
52021
|
+
}
|
|
52022
|
+
if (linesRemoved != null && rec.linesRemoved == null) {
|
|
52023
|
+
next.linesRemoved = linesRemoved;
|
|
52024
|
+
changed = true;
|
|
52025
|
+
}
|
|
52026
|
+
return changed ? next : rec;
|
|
51889
52027
|
}
|
|
51890
52028
|
function toolResultEvent(messageId, callId, result, isError) {
|
|
51891
52029
|
return {
|
|
@@ -51894,14 +52032,11 @@ function toolResultEvent(messageId, callId, result, isError) {
|
|
|
51894
52032
|
delta: {
|
|
51895
52033
|
type: "tool_result",
|
|
51896
52034
|
toolUseId: callId,
|
|
51897
|
-
summary: stringifyPayload(result),
|
|
52035
|
+
summary: formatTranscriptToolResult(result) || stringifyPayload(result),
|
|
51898
52036
|
isError
|
|
51899
52037
|
}
|
|
51900
52038
|
};
|
|
51901
52039
|
}
|
|
51902
|
-
function billedInputTokens(usage2) {
|
|
51903
|
-
return usage2.inputTokens + usage2.cacheWriteTokens;
|
|
51904
|
-
}
|
|
51905
52040
|
function contextTokensFromUsage(usage2) {
|
|
51906
52041
|
return usage2.inputTokens + usage2.cacheReadTokens + usage2.cacheWriteTokens;
|
|
51907
52042
|
}
|
|
@@ -51910,13 +52045,22 @@ function mapCursorTokenUsage(messageId, usage2, extras) {
|
|
|
51910
52045
|
return {
|
|
51911
52046
|
type: "message_usage",
|
|
51912
52047
|
messageId,
|
|
51913
|
-
inputTokens:
|
|
52048
|
+
inputTokens: usage2.inputTokens,
|
|
51914
52049
|
outputTokens: usage2.outputTokens,
|
|
51915
52050
|
cacheReadTokens: usage2.cacheReadTokens,
|
|
51916
52051
|
contextTokens,
|
|
51917
52052
|
...extras?.contextWindow && extras.contextWindow > 0 ? { contextWindow: extras.contextWindow } : {}
|
|
51918
52053
|
};
|
|
51919
52054
|
}
|
|
52055
|
+
function stampParentToolUseId(events, parentToolUseId) {
|
|
52056
|
+
if (!parentToolUseId) return events;
|
|
52057
|
+
return events.map((event) => {
|
|
52058
|
+
if (event.type !== "content_delta") return event;
|
|
52059
|
+
const delta = event.delta;
|
|
52060
|
+
if ("parentToolUseId" in delta && delta.parentToolUseId) return event;
|
|
52061
|
+
return { ...event, delta: { ...delta, parentToolUseId } };
|
|
52062
|
+
});
|
|
52063
|
+
}
|
|
51920
52064
|
function mapInteractionUpdate(messageId, update, options) {
|
|
51921
52065
|
const events = [];
|
|
51922
52066
|
const type = String(update.type ?? "");
|
|
@@ -51957,6 +52101,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51957
52101
|
case "tool-call-started":
|
|
51958
52102
|
case "partial-tool-call": {
|
|
51959
52103
|
const parts = extractToolCallParts(update);
|
|
52104
|
+
if (!parts.callId) break;
|
|
51960
52105
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, parts.args, "streaming"));
|
|
51961
52106
|
if (parts.toolType === "updateTodos" || parts.toolType === "update_todos") {
|
|
51962
52107
|
const todos = asRecord9(parts.args)?.todos;
|
|
@@ -51968,6 +52113,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51968
52113
|
events.push({
|
|
51969
52114
|
type: "task_started",
|
|
51970
52115
|
taskId: parts.callId,
|
|
52116
|
+
toolUseId: parts.callId,
|
|
51971
52117
|
description
|
|
51972
52118
|
});
|
|
51973
52119
|
}
|
|
@@ -51980,23 +52126,17 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51980
52126
|
if (nestedType === "shell-output-delta") {
|
|
51981
52127
|
break;
|
|
51982
52128
|
}
|
|
51983
|
-
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
51987
|
-
|
|
51988
|
-
messageId,
|
|
51989
|
-
delta: { type: "text", text }
|
|
51990
|
-
});
|
|
51991
|
-
}
|
|
51992
|
-
break;
|
|
51993
|
-
}
|
|
51994
|
-
events.push(...mapInteractionUpdate(messageId, taskUpdate, options));
|
|
52129
|
+
const parentCallId = extractCursorCallId(rec) ?? options?.parentToolUseId;
|
|
52130
|
+
events.push(...mapInteractionUpdate(messageId, taskUpdate, {
|
|
52131
|
+
...options,
|
|
52132
|
+
...parentCallId ? { parentToolUseId: parentCallId } : {}
|
|
52133
|
+
}));
|
|
51995
52134
|
}
|
|
51996
52135
|
break;
|
|
51997
52136
|
}
|
|
51998
52137
|
case "tool-call-completed": {
|
|
51999
52138
|
const parts = extractToolCallParts(update);
|
|
52139
|
+
if (!parts.callId) break;
|
|
52000
52140
|
const args = mergeCursorToolResultArgs(parts.toolType, parts.args, parts.result);
|
|
52001
52141
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, args, "complete"));
|
|
52002
52142
|
events.push(toolResultEvent(messageId, parts.callId, parts.result, parts.isError));
|
|
@@ -52006,12 +52146,14 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
52006
52146
|
if (todoEvent) events.push(todoEvent);
|
|
52007
52147
|
}
|
|
52008
52148
|
if (parts.toolType === "task") {
|
|
52149
|
+
const transcriptPath = strField2(parts.result, "transcriptPath");
|
|
52009
52150
|
events.push({
|
|
52010
52151
|
type: "task_notification",
|
|
52011
52152
|
taskId: parts.callId,
|
|
52153
|
+
toolUseId: parts.callId,
|
|
52012
52154
|
taskStatus: parts.isError ? "failed" : "completed",
|
|
52013
|
-
outputFile:
|
|
52014
|
-
summary: stringifyPayload(parts.result) || strField2(parts.args, "description") || "Task"
|
|
52155
|
+
outputFile: transcriptPath,
|
|
52156
|
+
summary: strField2(parts.result, "resultSuffix") || stringifyPayload(parts.result) || strField2(parts.args, "description") || "Task"
|
|
52015
52157
|
});
|
|
52016
52158
|
}
|
|
52017
52159
|
break;
|
|
@@ -52100,7 +52242,7 @@ ${text}
|
|
|
52100
52242
|
break;
|
|
52101
52243
|
}
|
|
52102
52244
|
}
|
|
52103
|
-
return events;
|
|
52245
|
+
return stampParentToolUseId(events, options?.parentToolUseId);
|
|
52104
52246
|
}
|
|
52105
52247
|
function mapConversationStep(messageId, step, options) {
|
|
52106
52248
|
const events = [];
|
|
@@ -52113,8 +52255,7 @@ function mapConversationStep(messageId, step, options) {
|
|
|
52113
52255
|
if (stepType === "toolCall") {
|
|
52114
52256
|
const message = rec.message ?? rec.toolCall ?? rec;
|
|
52115
52257
|
const nested = asRecord9(message);
|
|
52116
|
-
const
|
|
52117
|
-
const callId = explicitCallId || options?.resolveCallId?.(step) || null;
|
|
52258
|
+
const callId = extractCursorCallId(rec) || options?.resolveCallId?.(step) || null;
|
|
52118
52259
|
if (!callId) {
|
|
52119
52260
|
return events;
|
|
52120
52261
|
}
|
|
@@ -52235,11 +52376,12 @@ function mapToolCallMessage(messageId, message) {
|
|
|
52235
52376
|
}
|
|
52236
52377
|
return events;
|
|
52237
52378
|
}
|
|
52238
|
-
var CursorTurnUsage, CursorTurnCallIdBridge;
|
|
52379
|
+
var TOOL_CALL_ID_KEYS, CursorTurnUsage, CursorTurnCallIdBridge;
|
|
52239
52380
|
var init_cursor_event_map = __esm({
|
|
52240
52381
|
"../../packages/cursor/src/cursor-event-map.ts"() {
|
|
52241
52382
|
"use strict";
|
|
52242
52383
|
init_tool_ui();
|
|
52384
|
+
TOOL_CALL_ID_KEYS = ["callId", "toolCallId", "call_id"];
|
|
52243
52385
|
CursorTurnUsage = class {
|
|
52244
52386
|
input = 0;
|
|
52245
52387
|
output = 0;
|
|
@@ -52248,13 +52390,12 @@ var init_cursor_event_map = __esm({
|
|
|
52248
52390
|
if (Number.isFinite(tokens) && tokens > 0) this.output += tokens;
|
|
52249
52391
|
}
|
|
52250
52392
|
applyInternalTurn(usage2) {
|
|
52251
|
-
this.input +=
|
|
52393
|
+
this.input += usage2.inputTokens;
|
|
52252
52394
|
if (usage2.outputTokens > this.output) this.output = usage2.outputTokens;
|
|
52253
52395
|
this.context = contextTokensFromUsage(usage2);
|
|
52254
52396
|
}
|
|
52255
52397
|
applyRunTotals(usage2) {
|
|
52256
|
-
|
|
52257
|
-
if (billed > this.input) this.input = billed;
|
|
52398
|
+
if (usage2.inputTokens > this.input) this.input = usage2.inputTokens;
|
|
52258
52399
|
if (usage2.outputTokens > this.output) this.output = usage2.outputTokens;
|
|
52259
52400
|
}
|
|
52260
52401
|
};
|
|
@@ -52264,10 +52405,17 @@ var init_cursor_event_map = __esm({
|
|
|
52264
52405
|
/** Observe a live InteractionUpdate; record callIds from tool-call events. */
|
|
52265
52406
|
observeDelta(update) {
|
|
52266
52407
|
const type = String(update.type ?? "");
|
|
52408
|
+
if (type === "tool-call-delta") {
|
|
52409
|
+
const taskUpdate = asRecord9(update)?.taskUpdate;
|
|
52410
|
+
if (taskUpdate && typeof taskUpdate === "object") {
|
|
52411
|
+
this.observeDelta(taskUpdate);
|
|
52412
|
+
}
|
|
52413
|
+
return;
|
|
52414
|
+
}
|
|
52267
52415
|
if (type !== "tool-call-started" && type !== "partial-tool-call" && type !== "tool-call-completed") {
|
|
52268
52416
|
return;
|
|
52269
52417
|
}
|
|
52270
|
-
const callId =
|
|
52418
|
+
const callId = extractCursorCallId(update);
|
|
52271
52419
|
if (!callId || this.seen.has(callId)) return;
|
|
52272
52420
|
this.seen.add(callId);
|
|
52273
52421
|
this.queue.push(callId);
|
|
@@ -61239,8 +61387,8 @@ import { fileURLToPath } from "node:url";
|
|
|
61239
61387
|
function resolveCliReleaseVersion() {
|
|
61240
61388
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
61241
61389
|
if (fromEnv) return fromEnv;
|
|
61242
|
-
if ("0.53.
|
|
61243
|
-
return "0.53.
|
|
61390
|
+
if ("0.53.8-alpha".trim()) {
|
|
61391
|
+
return "0.53.8-alpha".trim();
|
|
61244
61392
|
}
|
|
61245
61393
|
const fromDist = readDistManifestVersion();
|
|
61246
61394
|
if (fromDist) return fromDist;
|
package/package.json
CHANGED