@super-one/cli 0.53.7-alpha → 0.53.9-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 +219 -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
|
|
|
@@ -14425,6 +14431,16 @@ var init_fork_session = __esm({
|
|
|
14425
14431
|
}
|
|
14426
14432
|
});
|
|
14427
14433
|
|
|
14434
|
+
// ../../packages/claude/src/transcript-store.ts
|
|
14435
|
+
var MAX_INSPECT_BYTES;
|
|
14436
|
+
var init_transcript_store = __esm({
|
|
14437
|
+
"../../packages/claude/src/transcript-store.ts"() {
|
|
14438
|
+
"use strict";
|
|
14439
|
+
init_fork_session();
|
|
14440
|
+
MAX_INSPECT_BYTES = 64 * 1024;
|
|
14441
|
+
}
|
|
14442
|
+
});
|
|
14443
|
+
|
|
14428
14444
|
// ../../packages/claude/src/index.ts
|
|
14429
14445
|
var init_src2 = __esm({
|
|
14430
14446
|
"../../packages/claude/src/index.ts"() {
|
|
@@ -14438,6 +14454,7 @@ var init_src2 = __esm({
|
|
|
14438
14454
|
init_root_permission_guard();
|
|
14439
14455
|
init_map_sdk_message();
|
|
14440
14456
|
init_fork_session();
|
|
14457
|
+
init_transcript_store();
|
|
14441
14458
|
}
|
|
14442
14459
|
});
|
|
14443
14460
|
|
|
@@ -15451,6 +15468,18 @@ var init_capability_prompt_tags = __esm({
|
|
|
15451
15468
|
displayName: "Super Browser",
|
|
15452
15469
|
intent: "automate the built-in browser via browser tools",
|
|
15453
15470
|
toolPrefix: "browser_"
|
|
15471
|
+
},
|
|
15472
|
+
{
|
|
15473
|
+
id: "widget",
|
|
15474
|
+
displayName: "Widget",
|
|
15475
|
+
intent: "render SVG, diagrams, charts, or interactive HTML inline in chat via widget tools",
|
|
15476
|
+
toolPrefix: "widget_"
|
|
15477
|
+
},
|
|
15478
|
+
{
|
|
15479
|
+
id: "debug",
|
|
15480
|
+
displayName: "Debug",
|
|
15481
|
+
intent: "diagnose SuperOne bugs, gather logs, and help file an upstream issue when the user wants",
|
|
15482
|
+
hint: 'first call read_manual({ domain: "product", topic: "debug" }); then read_manual({ domain: "product", topic: "contribute" }) only if they want to report upstream. If they have no GitHub account, draft the issue for them to copy \u2014 do not open a PR'
|
|
15454
15483
|
}
|
|
15455
15484
|
];
|
|
15456
15485
|
BUILTIN_CAPABILITY_IDS = BUILTIN_CAPABILITIES.map((c) => c.id);
|
|
@@ -42021,9 +42050,94 @@ function formatSearchToolPayload(obj) {
|
|
|
42021
42050
|
}
|
|
42022
42051
|
return lines.join("\n").trim() || null;
|
|
42023
42052
|
}
|
|
42053
|
+
function isShellCommandResult(obj) {
|
|
42054
|
+
const hasStream = typeof obj.stdout === "string" || typeof obj.stderr === "string";
|
|
42055
|
+
if (!hasStream) return false;
|
|
42056
|
+
return typeof obj.exitCode === "number" || typeof obj.exit_code === "number" || typeof obj.signal === "string" || typeof obj.executionTime === "number";
|
|
42057
|
+
}
|
|
42058
|
+
function formatShellCommandResult(obj) {
|
|
42059
|
+
const stdout = typeof obj.stdout === "string" ? obj.stdout : "";
|
|
42060
|
+
const stderr = typeof obj.stderr === "string" ? obj.stderr : "";
|
|
42061
|
+
if (stdout && stderr) {
|
|
42062
|
+
return stdout.endsWith("\n") ? `${stdout}${stderr}` : `${stdout}
|
|
42063
|
+
${stderr}`;
|
|
42064
|
+
}
|
|
42065
|
+
if (stdout || stderr) return stdout || stderr;
|
|
42066
|
+
const code = typeof obj.exitCode === "number" ? obj.exitCode : obj.exit_code;
|
|
42067
|
+
if (typeof code === "number" && code !== 0) return `Exit code ${code}`;
|
|
42068
|
+
return "";
|
|
42069
|
+
}
|
|
42070
|
+
function isCursorGrepResult(obj) {
|
|
42071
|
+
const workspaces = obj.workspaceResults;
|
|
42072
|
+
if (workspaces && typeof workspaces === "object" && !Array.isArray(workspaces)) return true;
|
|
42073
|
+
return obj.activeEditorResult != null && typeof obj.activeEditorResult === "object";
|
|
42074
|
+
}
|
|
42075
|
+
function formatGrepUnion(result) {
|
|
42076
|
+
const rec = result && typeof result === "object" && !Array.isArray(result) ? result : null;
|
|
42077
|
+
if (!rec) return "";
|
|
42078
|
+
const output = rec.output && typeof rec.output === "object" && !Array.isArray(rec.output) ? rec.output : rec;
|
|
42079
|
+
const type = typeof rec.type === "string" ? rec.type : "";
|
|
42080
|
+
if (type === "files" || Array.isArray(output.files)) {
|
|
42081
|
+
const files = Array.isArray(output.files) ? output.files.filter((f2) => typeof f2 === "string") : [];
|
|
42082
|
+
return files.join("\n");
|
|
42083
|
+
}
|
|
42084
|
+
if (type === "count" || Array.isArray(output.counts)) {
|
|
42085
|
+
const counts = Array.isArray(output.counts) ? output.counts : [];
|
|
42086
|
+
const lines2 = [];
|
|
42087
|
+
for (const entry of counts) {
|
|
42088
|
+
if (!entry || typeof entry !== "object") continue;
|
|
42089
|
+
const row = entry;
|
|
42090
|
+
const file2 = typeof row.file === "string" ? row.file : "";
|
|
42091
|
+
const count = typeof row.count === "number" ? row.count : "";
|
|
42092
|
+
if (file2) lines2.push(count === "" ? file2 : `${file2}:${count}`);
|
|
42093
|
+
}
|
|
42094
|
+
return lines2.join("\n");
|
|
42095
|
+
}
|
|
42096
|
+
const matches = Array.isArray(output.matches) ? output.matches : [];
|
|
42097
|
+
const lines = [];
|
|
42098
|
+
for (const entry of matches) {
|
|
42099
|
+
if (!entry || typeof entry !== "object") continue;
|
|
42100
|
+
const row = entry;
|
|
42101
|
+
const file2 = typeof row.file === "string" ? row.file : "";
|
|
42102
|
+
if (!file2) continue;
|
|
42103
|
+
const lineNo = typeof row.lineNumber === "number" ? row.lineNumber : null;
|
|
42104
|
+
const line = typeof row.line === "string" ? row.line : "";
|
|
42105
|
+
if (lineNo != null && line) lines.push(`${file2}:${lineNo}:${line}`);
|
|
42106
|
+
else if (line) lines.push(`${file2}:${line}`);
|
|
42107
|
+
else lines.push(file2);
|
|
42108
|
+
}
|
|
42109
|
+
return lines.join("\n");
|
|
42110
|
+
}
|
|
42111
|
+
function formatCursorGrepResult(obj) {
|
|
42112
|
+
const chunks = [];
|
|
42113
|
+
const editor = formatGrepUnion(obj.activeEditorResult);
|
|
42114
|
+
if (editor) chunks.push(editor);
|
|
42115
|
+
const workspaces = asPlainRecord(obj.workspaceResults);
|
|
42116
|
+
if (workspaces) {
|
|
42117
|
+
const roots = Object.keys(workspaces);
|
|
42118
|
+
const multi = roots.length > 1;
|
|
42119
|
+
for (const root of roots) {
|
|
42120
|
+
const body = formatGrepUnion(workspaces[root]);
|
|
42121
|
+
if (!body) continue;
|
|
42122
|
+
chunks.push(multi ? `${root}
|
|
42123
|
+
${body}` : body);
|
|
42124
|
+
}
|
|
42125
|
+
}
|
|
42126
|
+
return chunks.join("\n");
|
|
42127
|
+
}
|
|
42128
|
+
function asPlainRecord(value) {
|
|
42129
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
42130
|
+
return value;
|
|
42131
|
+
}
|
|
42132
|
+
function isCursorGlobResult(obj) {
|
|
42133
|
+
return Array.isArray(obj.files) && obj.files.every((f2) => typeof f2 === "string") && typeof obj.totalFiles === "number";
|
|
42134
|
+
}
|
|
42135
|
+
function formatCursorGlobResult(obj) {
|
|
42136
|
+
return obj.files.join("\n");
|
|
42137
|
+
}
|
|
42024
42138
|
function isAgentOutputEnvelope(obj) {
|
|
42025
42139
|
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";
|
|
42140
|
+
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
42141
|
}
|
|
42028
42142
|
function formatAgentToolOutput(raw) {
|
|
42029
42143
|
if (raw == null) return "";
|
|
@@ -42079,6 +42193,15 @@ function formatAgentToolOutput(raw) {
|
|
|
42079
42193
|
const text = bytesOrStringToText(obj.stdout ?? obj.content ?? obj.output);
|
|
42080
42194
|
if (text) return text;
|
|
42081
42195
|
}
|
|
42196
|
+
if (isShellCommandResult(obj)) {
|
|
42197
|
+
return formatShellCommandResult(obj);
|
|
42198
|
+
}
|
|
42199
|
+
if (isCursorGrepResult(obj)) {
|
|
42200
|
+
return formatCursorGrepResult(obj);
|
|
42201
|
+
}
|
|
42202
|
+
if (isCursorGlobResult(obj)) {
|
|
42203
|
+
return formatCursorGlobResult(obj);
|
|
42204
|
+
}
|
|
42082
42205
|
const action = obj.action;
|
|
42083
42206
|
if (action && typeof action === "object") {
|
|
42084
42207
|
const a = action;
|
|
@@ -42133,7 +42256,20 @@ function formatAgentToolOutput(raw) {
|
|
|
42133
42256
|
return String(raw);
|
|
42134
42257
|
}
|
|
42135
42258
|
}
|
|
42136
|
-
|
|
42259
|
+
function truncateTranscriptToolResult(text, max = MAX_TRANSCRIPT_TOOL_RESULT_CHARS) {
|
|
42260
|
+
if (text.length <= max) return text;
|
|
42261
|
+
const omitted = text.length - max;
|
|
42262
|
+
return `${text.slice(0, max)}
|
|
42263
|
+
|
|
42264
|
+
\u2026 truncated ${omitted.toLocaleString()} characters`;
|
|
42265
|
+
}
|
|
42266
|
+
function formatTranscriptToolResult(content, opts) {
|
|
42267
|
+
const formatted = formatAgentToolOutput(content);
|
|
42268
|
+
if (!formatted) return "";
|
|
42269
|
+
const max = opts?.maxChars ?? MAX_TRANSCRIPT_TOOL_RESULT_CHARS;
|
|
42270
|
+
return truncateTranscriptToolResult(formatted, max);
|
|
42271
|
+
}
|
|
42272
|
+
var TOOL_ID_TO_UI_NAME, MAX_TRANSCRIPT_TOOL_RESULT_CHARS;
|
|
42137
42273
|
var init_tool_ui = __esm({
|
|
42138
42274
|
"../../packages/shared/src/tool-ui.ts"() {
|
|
42139
42275
|
"use strict";
|
|
@@ -42214,6 +42350,7 @@ var init_tool_ui = __esm({
|
|
|
42214
42350
|
scheduler_delete: "SchedulerDelete",
|
|
42215
42351
|
scheduler_list: "SchedulerList"
|
|
42216
42352
|
};
|
|
42353
|
+
MAX_TRANSCRIPT_TOOL_RESULT_CHARS = 48e3;
|
|
42217
42354
|
}
|
|
42218
42355
|
});
|
|
42219
42356
|
|
|
@@ -51520,7 +51657,7 @@ function mapPermissionToCursorLocal(mode) {
|
|
|
51520
51657
|
if (mode === "plan") {
|
|
51521
51658
|
return { mode: "plan", autoReview: false };
|
|
51522
51659
|
}
|
|
51523
|
-
if (mode === "auto" || mode === "acceptEdits" || mode === "default") {
|
|
51660
|
+
if (mode === "agent" || mode === "auto" || mode === "acceptEdits" || mode === "default") {
|
|
51524
51661
|
return { mode: "agent", autoReview: true };
|
|
51525
51662
|
}
|
|
51526
51663
|
return { mode: "agent", autoReview: false };
|
|
@@ -51793,13 +51930,21 @@ function stableIdField(obj, ...keys) {
|
|
|
51793
51930
|
if (!obj || typeof obj !== "object") return null;
|
|
51794
51931
|
const rec = obj;
|
|
51795
51932
|
for (const key of keys) {
|
|
51796
|
-
|
|
51933
|
+
const v2 = rec[key];
|
|
51934
|
+
if (typeof v2 === "string" && v2) return v2;
|
|
51935
|
+
if (typeof v2 === "number" && Number.isFinite(v2)) return String(v2);
|
|
51797
51936
|
}
|
|
51798
51937
|
return null;
|
|
51799
51938
|
}
|
|
51800
51939
|
function idField(obj, ...keys) {
|
|
51801
51940
|
return stableIdField(obj, ...keys) ?? `tool_${Date.now()}`;
|
|
51802
51941
|
}
|
|
51942
|
+
function extractCursorCallId(update) {
|
|
51943
|
+
const rec = asRecord9(update);
|
|
51944
|
+
if (!rec) return null;
|
|
51945
|
+
const nested = asRecord9(rec.toolCall) ?? asRecord9(rec.message);
|
|
51946
|
+
return stableIdField(rec, ...TOOL_CALL_ID_KEYS) ?? (nested ? stableIdField(nested, ...TOOL_CALL_ID_KEYS) : null);
|
|
51947
|
+
}
|
|
51803
51948
|
function asRecord9(value) {
|
|
51804
51949
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
51805
51950
|
return value;
|
|
@@ -51815,7 +51960,7 @@ function stringifyPayload(value) {
|
|
|
51815
51960
|
}
|
|
51816
51961
|
function extractToolCallParts(update) {
|
|
51817
51962
|
const rec = asRecord9(update) ?? {};
|
|
51818
|
-
const callId =
|
|
51963
|
+
const callId = extractCursorCallId(update);
|
|
51819
51964
|
const nested = asRecord9(rec.toolCall);
|
|
51820
51965
|
if (nested) {
|
|
51821
51966
|
const toolType2 = typeof nested.type === "string" && nested.type ? nested.type : "Tool";
|
|
@@ -51880,12 +52025,28 @@ function normalizeCursorToolInput(toolName, args) {
|
|
|
51880
52025
|
function mergeCursorToolResultArgs(toolType, args, result) {
|
|
51881
52026
|
if (toolType.toLowerCase() === "mcp") return args;
|
|
51882
52027
|
const res = asRecord9(result);
|
|
51883
|
-
|
|
51884
|
-
if (!diff) return args;
|
|
52028
|
+
if (!res) return args;
|
|
51885
52029
|
const rec = asRecord9(args);
|
|
51886
52030
|
if (!rec) return args;
|
|
51887
|
-
|
|
51888
|
-
|
|
52031
|
+
const diff = typeof res.diffString === "string" ? res.diffString : void 0;
|
|
52032
|
+
const linesAdded = typeof res.linesAdded === "number" ? res.linesAdded : void 0;
|
|
52033
|
+
const linesRemoved = typeof res.linesRemoved === "number" ? res.linesRemoved : void 0;
|
|
52034
|
+
if (!diff && linesAdded == null && linesRemoved == null) return args;
|
|
52035
|
+
const next = { ...rec };
|
|
52036
|
+
let changed = false;
|
|
52037
|
+
if (diff && rec.diffString == null && rec.diff == null) {
|
|
52038
|
+
next.diffString = diff;
|
|
52039
|
+
changed = true;
|
|
52040
|
+
}
|
|
52041
|
+
if (linesAdded != null && rec.linesAdded == null) {
|
|
52042
|
+
next.linesAdded = linesAdded;
|
|
52043
|
+
changed = true;
|
|
52044
|
+
}
|
|
52045
|
+
if (linesRemoved != null && rec.linesRemoved == null) {
|
|
52046
|
+
next.linesRemoved = linesRemoved;
|
|
52047
|
+
changed = true;
|
|
52048
|
+
}
|
|
52049
|
+
return changed ? next : rec;
|
|
51889
52050
|
}
|
|
51890
52051
|
function toolResultEvent(messageId, callId, result, isError) {
|
|
51891
52052
|
return {
|
|
@@ -51894,14 +52055,11 @@ function toolResultEvent(messageId, callId, result, isError) {
|
|
|
51894
52055
|
delta: {
|
|
51895
52056
|
type: "tool_result",
|
|
51896
52057
|
toolUseId: callId,
|
|
51897
|
-
summary: stringifyPayload(result),
|
|
52058
|
+
summary: formatTranscriptToolResult(result) || stringifyPayload(result),
|
|
51898
52059
|
isError
|
|
51899
52060
|
}
|
|
51900
52061
|
};
|
|
51901
52062
|
}
|
|
51902
|
-
function billedInputTokens(usage2) {
|
|
51903
|
-
return usage2.inputTokens + usage2.cacheWriteTokens;
|
|
51904
|
-
}
|
|
51905
52063
|
function contextTokensFromUsage(usage2) {
|
|
51906
52064
|
return usage2.inputTokens + usage2.cacheReadTokens + usage2.cacheWriteTokens;
|
|
51907
52065
|
}
|
|
@@ -51910,13 +52068,22 @@ function mapCursorTokenUsage(messageId, usage2, extras) {
|
|
|
51910
52068
|
return {
|
|
51911
52069
|
type: "message_usage",
|
|
51912
52070
|
messageId,
|
|
51913
|
-
inputTokens:
|
|
52071
|
+
inputTokens: usage2.inputTokens,
|
|
51914
52072
|
outputTokens: usage2.outputTokens,
|
|
51915
52073
|
cacheReadTokens: usage2.cacheReadTokens,
|
|
51916
52074
|
contextTokens,
|
|
51917
52075
|
...extras?.contextWindow && extras.contextWindow > 0 ? { contextWindow: extras.contextWindow } : {}
|
|
51918
52076
|
};
|
|
51919
52077
|
}
|
|
52078
|
+
function stampParentToolUseId(events, parentToolUseId) {
|
|
52079
|
+
if (!parentToolUseId) return events;
|
|
52080
|
+
return events.map((event) => {
|
|
52081
|
+
if (event.type !== "content_delta") return event;
|
|
52082
|
+
const delta = event.delta;
|
|
52083
|
+
if ("parentToolUseId" in delta && delta.parentToolUseId) return event;
|
|
52084
|
+
return { ...event, delta: { ...delta, parentToolUseId } };
|
|
52085
|
+
});
|
|
52086
|
+
}
|
|
51920
52087
|
function mapInteractionUpdate(messageId, update, options) {
|
|
51921
52088
|
const events = [];
|
|
51922
52089
|
const type = String(update.type ?? "");
|
|
@@ -51957,6 +52124,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51957
52124
|
case "tool-call-started":
|
|
51958
52125
|
case "partial-tool-call": {
|
|
51959
52126
|
const parts = extractToolCallParts(update);
|
|
52127
|
+
if (!parts.callId) break;
|
|
51960
52128
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, parts.args, "streaming"));
|
|
51961
52129
|
if (parts.toolType === "updateTodos" || parts.toolType === "update_todos") {
|
|
51962
52130
|
const todos = asRecord9(parts.args)?.todos;
|
|
@@ -51968,6 +52136,7 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51968
52136
|
events.push({
|
|
51969
52137
|
type: "task_started",
|
|
51970
52138
|
taskId: parts.callId,
|
|
52139
|
+
toolUseId: parts.callId,
|
|
51971
52140
|
description
|
|
51972
52141
|
});
|
|
51973
52142
|
}
|
|
@@ -51980,23 +52149,17 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
51980
52149
|
if (nestedType === "shell-output-delta") {
|
|
51981
52150
|
break;
|
|
51982
52151
|
}
|
|
51983
|
-
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
51987
|
-
|
|
51988
|
-
messageId,
|
|
51989
|
-
delta: { type: "text", text }
|
|
51990
|
-
});
|
|
51991
|
-
}
|
|
51992
|
-
break;
|
|
51993
|
-
}
|
|
51994
|
-
events.push(...mapInteractionUpdate(messageId, taskUpdate, options));
|
|
52152
|
+
const parentCallId = extractCursorCallId(rec) ?? options?.parentToolUseId;
|
|
52153
|
+
events.push(...mapInteractionUpdate(messageId, taskUpdate, {
|
|
52154
|
+
...options,
|
|
52155
|
+
...parentCallId ? { parentToolUseId: parentCallId } : {}
|
|
52156
|
+
}));
|
|
51995
52157
|
}
|
|
51996
52158
|
break;
|
|
51997
52159
|
}
|
|
51998
52160
|
case "tool-call-completed": {
|
|
51999
52161
|
const parts = extractToolCallParts(update);
|
|
52162
|
+
if (!parts.callId) break;
|
|
52000
52163
|
const args = mergeCursorToolResultArgs(parts.toolType, parts.args, parts.result);
|
|
52001
52164
|
events.push(toolUseEvent(messageId, parts.callId, parts.toolType, args, "complete"));
|
|
52002
52165
|
events.push(toolResultEvent(messageId, parts.callId, parts.result, parts.isError));
|
|
@@ -52006,12 +52169,14 @@ function mapInteractionUpdate(messageId, update, options) {
|
|
|
52006
52169
|
if (todoEvent) events.push(todoEvent);
|
|
52007
52170
|
}
|
|
52008
52171
|
if (parts.toolType === "task") {
|
|
52172
|
+
const transcriptPath = strField2(parts.result, "transcriptPath");
|
|
52009
52173
|
events.push({
|
|
52010
52174
|
type: "task_notification",
|
|
52011
52175
|
taskId: parts.callId,
|
|
52176
|
+
toolUseId: parts.callId,
|
|
52012
52177
|
taskStatus: parts.isError ? "failed" : "completed",
|
|
52013
|
-
outputFile:
|
|
52014
|
-
summary: stringifyPayload(parts.result) || strField2(parts.args, "description") || "Task"
|
|
52178
|
+
outputFile: transcriptPath,
|
|
52179
|
+
summary: strField2(parts.result, "resultSuffix") || stringifyPayload(parts.result) || strField2(parts.args, "description") || "Task"
|
|
52015
52180
|
});
|
|
52016
52181
|
}
|
|
52017
52182
|
break;
|
|
@@ -52100,7 +52265,7 @@ ${text}
|
|
|
52100
52265
|
break;
|
|
52101
52266
|
}
|
|
52102
52267
|
}
|
|
52103
|
-
return events;
|
|
52268
|
+
return stampParentToolUseId(events, options?.parentToolUseId);
|
|
52104
52269
|
}
|
|
52105
52270
|
function mapConversationStep(messageId, step, options) {
|
|
52106
52271
|
const events = [];
|
|
@@ -52113,8 +52278,7 @@ function mapConversationStep(messageId, step, options) {
|
|
|
52113
52278
|
if (stepType === "toolCall") {
|
|
52114
52279
|
const message = rec.message ?? rec.toolCall ?? rec;
|
|
52115
52280
|
const nested = asRecord9(message);
|
|
52116
|
-
const
|
|
52117
|
-
const callId = explicitCallId || options?.resolveCallId?.(step) || null;
|
|
52281
|
+
const callId = extractCursorCallId(rec) || options?.resolveCallId?.(step) || null;
|
|
52118
52282
|
if (!callId) {
|
|
52119
52283
|
return events;
|
|
52120
52284
|
}
|
|
@@ -52235,11 +52399,12 @@ function mapToolCallMessage(messageId, message) {
|
|
|
52235
52399
|
}
|
|
52236
52400
|
return events;
|
|
52237
52401
|
}
|
|
52238
|
-
var CursorTurnUsage, CursorTurnCallIdBridge;
|
|
52402
|
+
var TOOL_CALL_ID_KEYS, CursorTurnUsage, CursorTurnCallIdBridge;
|
|
52239
52403
|
var init_cursor_event_map = __esm({
|
|
52240
52404
|
"../../packages/cursor/src/cursor-event-map.ts"() {
|
|
52241
52405
|
"use strict";
|
|
52242
52406
|
init_tool_ui();
|
|
52407
|
+
TOOL_CALL_ID_KEYS = ["callId", "toolCallId", "call_id"];
|
|
52243
52408
|
CursorTurnUsage = class {
|
|
52244
52409
|
input = 0;
|
|
52245
52410
|
output = 0;
|
|
@@ -52248,13 +52413,12 @@ var init_cursor_event_map = __esm({
|
|
|
52248
52413
|
if (Number.isFinite(tokens) && tokens > 0) this.output += tokens;
|
|
52249
52414
|
}
|
|
52250
52415
|
applyInternalTurn(usage2) {
|
|
52251
|
-
this.input +=
|
|
52416
|
+
this.input += usage2.inputTokens;
|
|
52252
52417
|
if (usage2.outputTokens > this.output) this.output = usage2.outputTokens;
|
|
52253
52418
|
this.context = contextTokensFromUsage(usage2);
|
|
52254
52419
|
}
|
|
52255
52420
|
applyRunTotals(usage2) {
|
|
52256
|
-
|
|
52257
|
-
if (billed > this.input) this.input = billed;
|
|
52421
|
+
if (usage2.inputTokens > this.input) this.input = usage2.inputTokens;
|
|
52258
52422
|
if (usage2.outputTokens > this.output) this.output = usage2.outputTokens;
|
|
52259
52423
|
}
|
|
52260
52424
|
};
|
|
@@ -52264,10 +52428,17 @@ var init_cursor_event_map = __esm({
|
|
|
52264
52428
|
/** Observe a live InteractionUpdate; record callIds from tool-call events. */
|
|
52265
52429
|
observeDelta(update) {
|
|
52266
52430
|
const type = String(update.type ?? "");
|
|
52431
|
+
if (type === "tool-call-delta") {
|
|
52432
|
+
const taskUpdate = asRecord9(update)?.taskUpdate;
|
|
52433
|
+
if (taskUpdate && typeof taskUpdate === "object") {
|
|
52434
|
+
this.observeDelta(taskUpdate);
|
|
52435
|
+
}
|
|
52436
|
+
return;
|
|
52437
|
+
}
|
|
52267
52438
|
if (type !== "tool-call-started" && type !== "partial-tool-call" && type !== "tool-call-completed") {
|
|
52268
52439
|
return;
|
|
52269
52440
|
}
|
|
52270
|
-
const callId =
|
|
52441
|
+
const callId = extractCursorCallId(update);
|
|
52271
52442
|
if (!callId || this.seen.has(callId)) return;
|
|
52272
52443
|
this.seen.add(callId);
|
|
52273
52444
|
this.queue.push(callId);
|
|
@@ -61239,8 +61410,8 @@ import { fileURLToPath } from "node:url";
|
|
|
61239
61410
|
function resolveCliReleaseVersion() {
|
|
61240
61411
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
61241
61412
|
if (fromEnv) return fromEnv;
|
|
61242
|
-
if ("0.53.
|
|
61243
|
-
return "0.53.
|
|
61413
|
+
if ("0.53.9-alpha".trim()) {
|
|
61414
|
+
return "0.53.9-alpha".trim();
|
|
61244
61415
|
}
|
|
61245
61416
|
const fromDist = readDistManifestVersion();
|
|
61246
61417
|
if (fromDist) return fromDist;
|
package/package.json
CHANGED