replicas-cli 0.2.277 → 0.2.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +235 -23
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1473,7 +1473,7 @@ var require_stringify = __commonJS({
|
|
|
1473
1473
|
props.push(doc.directives.tagString(tag));
|
|
1474
1474
|
return props.join(" ");
|
|
1475
1475
|
}
|
|
1476
|
-
function
|
|
1476
|
+
function stringify2(item, ctx, onComment, onChompKeep) {
|
|
1477
1477
|
if (identity.isPair(item))
|
|
1478
1478
|
return item.toString(ctx, onComment, onChompKeep);
|
|
1479
1479
|
if (identity.isAlias(item)) {
|
|
@@ -1502,7 +1502,7 @@ var require_stringify = __commonJS({
|
|
|
1502
1502
|
${ctx.indent}${str}`;
|
|
1503
1503
|
}
|
|
1504
1504
|
exports.createStringifyContext = createStringifyContext;
|
|
1505
|
-
exports.stringify =
|
|
1505
|
+
exports.stringify = stringify2;
|
|
1506
1506
|
}
|
|
1507
1507
|
});
|
|
1508
1508
|
|
|
@@ -1512,7 +1512,7 @@ var require_stringifyPair = __commonJS({
|
|
|
1512
1512
|
"use strict";
|
|
1513
1513
|
var identity = require_identity();
|
|
1514
1514
|
var Scalar = require_Scalar();
|
|
1515
|
-
var
|
|
1515
|
+
var stringify2 = require_stringify();
|
|
1516
1516
|
var stringifyComment = require_stringifyComment();
|
|
1517
1517
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
1518
1518
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
@@ -1534,7 +1534,7 @@ var require_stringifyPair = __commonJS({
|
|
|
1534
1534
|
});
|
|
1535
1535
|
let keyCommentDone = false;
|
|
1536
1536
|
let chompKeep = false;
|
|
1537
|
-
let str =
|
|
1537
|
+
let str = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
1538
1538
|
if (!explicitKey && !ctx.inFlow && str.length > 1024) {
|
|
1539
1539
|
if (simpleKeys)
|
|
1540
1540
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -1586,7 +1586,7 @@ ${indent}:`;
|
|
|
1586
1586
|
ctx.indent = ctx.indent.substring(2);
|
|
1587
1587
|
}
|
|
1588
1588
|
let valueCommentDone = false;
|
|
1589
|
-
const valueStr =
|
|
1589
|
+
const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
|
|
1590
1590
|
let ws = " ";
|
|
1591
1591
|
if (keyComment || vsb || vcb) {
|
|
1592
1592
|
ws = vsb ? "\n" : "";
|
|
@@ -1727,7 +1727,7 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1727
1727
|
"use strict";
|
|
1728
1728
|
var log = require_log();
|
|
1729
1729
|
var merge = require_merge();
|
|
1730
|
-
var
|
|
1730
|
+
var stringify2 = require_stringify();
|
|
1731
1731
|
var identity = require_identity();
|
|
1732
1732
|
var toJS = require_toJS();
|
|
1733
1733
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
@@ -1763,7 +1763,7 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1763
1763
|
if (typeof jsKey !== "object")
|
|
1764
1764
|
return String(jsKey);
|
|
1765
1765
|
if (identity.isNode(key) && ctx?.doc) {
|
|
1766
|
-
const strCtx =
|
|
1766
|
+
const strCtx = stringify2.createStringifyContext(ctx.doc, {});
|
|
1767
1767
|
strCtx.anchors = /* @__PURE__ */ new Set();
|
|
1768
1768
|
for (const node of ctx.anchors.keys())
|
|
1769
1769
|
strCtx.anchors.add(node.anchor);
|
|
@@ -1830,12 +1830,12 @@ var require_stringifyCollection = __commonJS({
|
|
|
1830
1830
|
"../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
|
|
1831
1831
|
"use strict";
|
|
1832
1832
|
var identity = require_identity();
|
|
1833
|
-
var
|
|
1833
|
+
var stringify2 = require_stringify();
|
|
1834
1834
|
var stringifyComment = require_stringifyComment();
|
|
1835
1835
|
function stringifyCollection(collection, ctx, options) {
|
|
1836
1836
|
const flow = ctx.inFlow ?? collection.flow;
|
|
1837
|
-
const
|
|
1838
|
-
return
|
|
1837
|
+
const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
1838
|
+
return stringify3(collection, ctx, options);
|
|
1839
1839
|
}
|
|
1840
1840
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
1841
1841
|
const { indent, options: { commentString } } = ctx;
|
|
@@ -1860,7 +1860,7 @@ var require_stringifyCollection = __commonJS({
|
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
1862
|
chompKeep = false;
|
|
1863
|
-
let str2 =
|
|
1863
|
+
let str2 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
1864
1864
|
if (comment2)
|
|
1865
1865
|
str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
|
|
1866
1866
|
if (chompKeep && comment2)
|
|
@@ -1927,7 +1927,7 @@ ${indent}${line}` : "\n";
|
|
|
1927
1927
|
}
|
|
1928
1928
|
if (comment)
|
|
1929
1929
|
reqNewline = true;
|
|
1930
|
-
let str =
|
|
1930
|
+
let str = stringify2.stringify(item, itemCtx, () => comment = null);
|
|
1931
1931
|
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
|
|
1932
1932
|
if (i < items.length - 1) {
|
|
1933
1933
|
str += ",";
|
|
@@ -3288,7 +3288,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3288
3288
|
"../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
|
|
3289
3289
|
"use strict";
|
|
3290
3290
|
var identity = require_identity();
|
|
3291
|
-
var
|
|
3291
|
+
var stringify2 = require_stringify();
|
|
3292
3292
|
var stringifyComment = require_stringifyComment();
|
|
3293
3293
|
function stringifyDocument(doc, options) {
|
|
3294
3294
|
const lines = [];
|
|
@@ -3303,7 +3303,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3303
3303
|
}
|
|
3304
3304
|
if (hasDirectives)
|
|
3305
3305
|
lines.push("---");
|
|
3306
|
-
const ctx =
|
|
3306
|
+
const ctx = stringify2.createStringifyContext(doc, options);
|
|
3307
3307
|
const { commentString } = ctx.options;
|
|
3308
3308
|
if (doc.commentBefore) {
|
|
3309
3309
|
if (lines.length !== 1)
|
|
@@ -3325,7 +3325,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3325
3325
|
contentComment = doc.contents.comment;
|
|
3326
3326
|
}
|
|
3327
3327
|
const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
|
|
3328
|
-
let body =
|
|
3328
|
+
let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
|
|
3329
3329
|
if (contentComment)
|
|
3330
3330
|
body += stringifyComment.lineComment(body, "", commentString(contentComment));
|
|
3331
3331
|
if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
|
|
@@ -3333,7 +3333,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3333
3333
|
} else
|
|
3334
3334
|
lines.push(body);
|
|
3335
3335
|
} else {
|
|
3336
|
-
lines.push(
|
|
3336
|
+
lines.push(stringify2.stringify(doc.contents, ctx));
|
|
3337
3337
|
}
|
|
3338
3338
|
if (doc.directives?.docEnd) {
|
|
3339
3339
|
if (doc.comment) {
|
|
@@ -5468,7 +5468,7 @@ var require_cst_scalar = __commonJS({
|
|
|
5468
5468
|
var require_cst_stringify = __commonJS({
|
|
5469
5469
|
"../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js"(exports) {
|
|
5470
5470
|
"use strict";
|
|
5471
|
-
var
|
|
5471
|
+
var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
|
|
5472
5472
|
function stringifyToken(token) {
|
|
5473
5473
|
switch (token.type) {
|
|
5474
5474
|
case "block-scalar": {
|
|
@@ -5521,7 +5521,7 @@ var require_cst_stringify = __commonJS({
|
|
|
5521
5521
|
res += stringifyToken(value);
|
|
5522
5522
|
return res;
|
|
5523
5523
|
}
|
|
5524
|
-
exports.stringify =
|
|
5524
|
+
exports.stringify = stringify2;
|
|
5525
5525
|
}
|
|
5526
5526
|
});
|
|
5527
5527
|
|
|
@@ -7251,7 +7251,7 @@ var require_public_api = __commonJS({
|
|
|
7251
7251
|
}
|
|
7252
7252
|
return doc.toJS(Object.assign({ reviver: _reviver }, options));
|
|
7253
7253
|
}
|
|
7254
|
-
function
|
|
7254
|
+
function stringify2(value, replacer, options) {
|
|
7255
7255
|
let _replacer = null;
|
|
7256
7256
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
7257
7257
|
_replacer = replacer;
|
|
@@ -7276,7 +7276,7 @@ var require_public_api = __commonJS({
|
|
|
7276
7276
|
exports.parse = parse;
|
|
7277
7277
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7278
7278
|
exports.parseDocument = parseDocument;
|
|
7279
|
-
exports.stringify =
|
|
7279
|
+
exports.stringify = stringify2;
|
|
7280
7280
|
}
|
|
7281
7281
|
});
|
|
7282
7282
|
|
|
@@ -7555,7 +7555,7 @@ function createErrorResult(error) {
|
|
|
7555
7555
|
}
|
|
7556
7556
|
|
|
7557
7557
|
// ../shared/src/agent.ts
|
|
7558
|
-
var VALID_AGENT_PROVIDERS = ["claude", "codex", "relay"];
|
|
7558
|
+
var VALID_AGENT_PROVIDERS = ["claude", "codex", "cursor", "relay"];
|
|
7559
7559
|
function isValidAgentProvider(value) {
|
|
7560
7560
|
return VALID_AGENT_PROVIDERS.some((p) => p === value);
|
|
7561
7561
|
}
|
|
@@ -7567,6 +7567,8 @@ function getProviderDisplayName(provider) {
|
|
|
7567
7567
|
switch (provider) {
|
|
7568
7568
|
case "codex":
|
|
7569
7569
|
return "Codex";
|
|
7570
|
+
case "cursor":
|
|
7571
|
+
return "Cursor";
|
|
7570
7572
|
case "relay":
|
|
7571
7573
|
return "Relay";
|
|
7572
7574
|
case "claude":
|
|
@@ -7600,6 +7602,10 @@ var CODEX_ASP_ITEM_ID_PAYLOAD_KEY = "codexAspItemId";
|
|
|
7600
7602
|
var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
|
|
7601
7603
|
|
|
7602
7604
|
// ../shared/src/pricing.ts
|
|
7605
|
+
var INTEGRATION_SOURCES = ["slack", "linear", "github", "gitlab"];
|
|
7606
|
+
var SYSTEMIC_SOURCES = ["api", "automation"];
|
|
7607
|
+
var INTEGRATION_SOURCES_SQL = INTEGRATION_SOURCES.map((s) => `'${s}'`).join(", ");
|
|
7608
|
+
var SYSTEMIC_SOURCES_SQL = SYSTEMIC_SOURCES.map((s) => `'${s}'`).join(", ");
|
|
7603
7609
|
var PLANS = {
|
|
7604
7610
|
hobby: {
|
|
7605
7611
|
id: "hobby",
|
|
@@ -9236,7 +9242,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9236
9242
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9237
9243
|
|
|
9238
9244
|
// ../shared/src/cli-version.ts
|
|
9239
|
-
var CLI_VERSION = "0.2.
|
|
9245
|
+
var CLI_VERSION = "0.2.279";
|
|
9240
9246
|
|
|
9241
9247
|
// ../shared/src/engine/environment.ts
|
|
9242
9248
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
@@ -9252,6 +9258,7 @@ var DESKTOP_VIEWER_HEIGHT = 1080;
|
|
|
9252
9258
|
var DEFAULT_CHAT_TITLES = {
|
|
9253
9259
|
claude: "Claude Code",
|
|
9254
9260
|
codex: "Codex",
|
|
9261
|
+
cursor: "Cursor",
|
|
9255
9262
|
relay: "Relay"
|
|
9256
9263
|
};
|
|
9257
9264
|
function getInitialChatId(chats, preferredProvider = "claude") {
|
|
@@ -9266,6 +9273,7 @@ function getInitialChatId(chats, preferredProvider = "claude") {
|
|
|
9266
9273
|
var CLAUDE_OPUS_1M_MODEL = "opus[1m]";
|
|
9267
9274
|
var LEGACY_CLAUDE_OPUS_1M_MODEL = "opus-1m";
|
|
9268
9275
|
var DEFAULT_CODEX_MODEL = "gpt-5.5";
|
|
9276
|
+
var DEFAULT_CURSOR_MODEL = "composer-2";
|
|
9269
9277
|
function normalizeClaudeModel(model) {
|
|
9270
9278
|
if (model === LEGACY_CLAUDE_OPUS_1M_MODEL) {
|
|
9271
9279
|
return CLAUDE_OPUS_1M_MODEL;
|
|
@@ -9275,6 +9283,7 @@ function normalizeClaudeModel(model) {
|
|
|
9275
9283
|
var AGENT_MODELS = {
|
|
9276
9284
|
claude: [CLAUDE_OPUS_1M_MODEL, "sonnet", "haiku"],
|
|
9277
9285
|
codex: [DEFAULT_CODEX_MODEL, "gpt-5.4", "gpt-5.4-mini", "gpt-5.3-codex", "gpt-5.2"],
|
|
9286
|
+
cursor: [DEFAULT_CURSOR_MODEL, "composer-2.5"],
|
|
9278
9287
|
relay: [CLAUDE_OPUS_1M_MODEL, "sonnet"]
|
|
9279
9288
|
};
|
|
9280
9289
|
var MODEL_LABELS = {
|
|
@@ -9284,6 +9293,8 @@ var MODEL_LABELS = {
|
|
|
9284
9293
|
[LEGACY_CLAUDE_OPUS_1M_MODEL]: "Opus 4.8 (1M)",
|
|
9285
9294
|
haiku: "Haiku 4.5",
|
|
9286
9295
|
[DEFAULT_CODEX_MODEL]: "GPT-5.5",
|
|
9296
|
+
[DEFAULT_CURSOR_MODEL]: "Composer 2",
|
|
9297
|
+
"composer-2.5": "Composer 2.5",
|
|
9287
9298
|
"gpt-5.4": "GPT-5.4",
|
|
9288
9299
|
"gpt-5.4-mini": "GPT-5.4 Mini",
|
|
9289
9300
|
"gpt-5.3-codex": "GPT-5.3 Codex",
|
|
@@ -9342,7 +9353,7 @@ function workspaceConfigWithPrFollowups(config2, prFollowups = config2?.capabili
|
|
|
9342
9353
|
}
|
|
9343
9354
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
9344
9355
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
9345
|
-
var WORKSPACE_SIDEBAR_VIEWS = ["owned", "shared", "team", "
|
|
9356
|
+
var WORKSPACE_SIDEBAR_VIEWS = ["owned", "shared", "team", "automated"];
|
|
9346
9357
|
var WORKSPACE_STATUS_FILTERS = ["active", "sleeping", "preparing", "failed"];
|
|
9347
9358
|
var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
|
|
9348
9359
|
var DEFAULT_WORKSPACE_FILTERS = {
|
|
@@ -9738,6 +9749,204 @@ function parseCodexEvents(events) {
|
|
|
9738
9749
|
return messages;
|
|
9739
9750
|
}
|
|
9740
9751
|
|
|
9752
|
+
// ../shared/src/display-message/parsers/cursor-parser.ts
|
|
9753
|
+
function getTextContent(value) {
|
|
9754
|
+
if (!Array.isArray(value)) return "";
|
|
9755
|
+
return value.map((block) => isRecord(block) && block.type === "text" && typeof block.text === "string" ? block.text : "").join("");
|
|
9756
|
+
}
|
|
9757
|
+
function stringify(value) {
|
|
9758
|
+
if (value === void 0 || value === null) return void 0;
|
|
9759
|
+
if (typeof value === "string") return value;
|
|
9760
|
+
try {
|
|
9761
|
+
return JSON.stringify(value, null, 2);
|
|
9762
|
+
} catch {
|
|
9763
|
+
return String(value);
|
|
9764
|
+
}
|
|
9765
|
+
}
|
|
9766
|
+
function cursorStatusToDisplayStatus(status) {
|
|
9767
|
+
return status === "completed" || status === "FINISHED" ? "completed" : status === "error" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED" ? "failed" : "in_progress";
|
|
9768
|
+
}
|
|
9769
|
+
function cursorRunId(event) {
|
|
9770
|
+
const runId = event.payload.run_id;
|
|
9771
|
+
return typeof runId === "string" ? runId : "unknown-run";
|
|
9772
|
+
}
|
|
9773
|
+
function getCursorAssistantText(event) {
|
|
9774
|
+
const message = isRecord(event.payload.message) ? event.payload.message : null;
|
|
9775
|
+
return getTextContent(message?.content);
|
|
9776
|
+
}
|
|
9777
|
+
function getCursorThinkingText(event) {
|
|
9778
|
+
const text = event.payload.text;
|
|
9779
|
+
if (typeof text === "string") return text;
|
|
9780
|
+
const message = isRecord(event.payload.message) ? event.payload.message : null;
|
|
9781
|
+
return typeof message?.text === "string" ? message.text : "";
|
|
9782
|
+
}
|
|
9783
|
+
function isTerminalStatus(status) {
|
|
9784
|
+
return status === "FINISHED" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED";
|
|
9785
|
+
}
|
|
9786
|
+
function finalizeOpenTools(messages, toolIndexes, status) {
|
|
9787
|
+
for (const index of toolIndexes.values()) {
|
|
9788
|
+
const message = messages[index];
|
|
9789
|
+
if (message?.type === "tool_call" && message.status === "in_progress") {
|
|
9790
|
+
messages[index] = {
|
|
9791
|
+
...message,
|
|
9792
|
+
status
|
|
9793
|
+
};
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9796
|
+
}
|
|
9797
|
+
function parseCursorEvents(events) {
|
|
9798
|
+
const messages = [];
|
|
9799
|
+
const toolIndexes = /* @__PURE__ */ new Map();
|
|
9800
|
+
const runAssistantSegments = /* @__PURE__ */ new Map();
|
|
9801
|
+
const runThinkingSegments = /* @__PURE__ */ new Map();
|
|
9802
|
+
let activeAssistant = null;
|
|
9803
|
+
let activeThinking = null;
|
|
9804
|
+
const finalizeActiveThinking = (status) => {
|
|
9805
|
+
if (!activeThinking) return;
|
|
9806
|
+
const message = messages[activeThinking.index];
|
|
9807
|
+
if (message?.type === "reasoning") {
|
|
9808
|
+
messages[activeThinking.index] = {
|
|
9809
|
+
...message,
|
|
9810
|
+
status
|
|
9811
|
+
};
|
|
9812
|
+
}
|
|
9813
|
+
};
|
|
9814
|
+
for (const event of events) {
|
|
9815
|
+
if (event.type === "event_msg" && event.payload.type === "user_message") {
|
|
9816
|
+
activeAssistant = null;
|
|
9817
|
+
activeThinking = null;
|
|
9818
|
+
const message = event.payload.message;
|
|
9819
|
+
if (typeof message === "string" && message.trim()) {
|
|
9820
|
+
messages.push({
|
|
9821
|
+
id: `cursor-user-${event.timestamp}-${messages.length}`,
|
|
9822
|
+
type: "user",
|
|
9823
|
+
content: message,
|
|
9824
|
+
timestamp: event.timestamp
|
|
9825
|
+
});
|
|
9826
|
+
}
|
|
9827
|
+
continue;
|
|
9828
|
+
}
|
|
9829
|
+
if (event.type === "cursor-assistant") {
|
|
9830
|
+
const text = getCursorAssistantText(event);
|
|
9831
|
+
if (text) {
|
|
9832
|
+
const runId = cursorRunId(event);
|
|
9833
|
+
if (!activeAssistant || activeAssistant.runId !== runId) {
|
|
9834
|
+
const segment = runAssistantSegments.get(runId) ?? 0;
|
|
9835
|
+
runAssistantSegments.set(runId, segment + 1);
|
|
9836
|
+
activeAssistant = {
|
|
9837
|
+
runId,
|
|
9838
|
+
index: messages.push({
|
|
9839
|
+
id: `cursor-agent-${runId}-${segment}`,
|
|
9840
|
+
type: "agent",
|
|
9841
|
+
content: "",
|
|
9842
|
+
timestamp: event.timestamp
|
|
9843
|
+
}) - 1
|
|
9844
|
+
};
|
|
9845
|
+
}
|
|
9846
|
+
const message = messages[activeAssistant.index];
|
|
9847
|
+
if (message?.type === "agent") {
|
|
9848
|
+
messages[activeAssistant.index] = {
|
|
9849
|
+
...message,
|
|
9850
|
+
content: `${message.content}${text}`
|
|
9851
|
+
};
|
|
9852
|
+
}
|
|
9853
|
+
}
|
|
9854
|
+
continue;
|
|
9855
|
+
}
|
|
9856
|
+
if (event.type === "cursor-thinking") {
|
|
9857
|
+
const text = getCursorThinkingText(event);
|
|
9858
|
+
if (text.trim()) {
|
|
9859
|
+
const runId = cursorRunId(event);
|
|
9860
|
+
if (!activeThinking || activeThinking.runId !== runId) {
|
|
9861
|
+
const segment = runThinkingSegments.get(runId) ?? 0;
|
|
9862
|
+
runThinkingSegments.set(runId, segment + 1);
|
|
9863
|
+
activeThinking = {
|
|
9864
|
+
runId,
|
|
9865
|
+
index: messages.push({
|
|
9866
|
+
id: `cursor-reasoning-${runId}-${segment}`,
|
|
9867
|
+
type: "reasoning",
|
|
9868
|
+
content: "",
|
|
9869
|
+
status: "in_progress",
|
|
9870
|
+
timestamp: event.timestamp
|
|
9871
|
+
}) - 1
|
|
9872
|
+
};
|
|
9873
|
+
}
|
|
9874
|
+
const message = messages[activeThinking.index];
|
|
9875
|
+
if (message?.type === "reasoning") {
|
|
9876
|
+
messages[activeThinking.index] = {
|
|
9877
|
+
...message,
|
|
9878
|
+
content: `${message.content}${text}`,
|
|
9879
|
+
status: "in_progress"
|
|
9880
|
+
};
|
|
9881
|
+
}
|
|
9882
|
+
}
|
|
9883
|
+
continue;
|
|
9884
|
+
}
|
|
9885
|
+
if (event.type === "cursor-tool_call") {
|
|
9886
|
+
activeAssistant = null;
|
|
9887
|
+
const callId = typeof event.payload.call_id === "string" ? event.payload.call_id : `cursor-tool-${event.timestamp}-${messages.length}`;
|
|
9888
|
+
const tool = typeof event.payload.name === "string" ? event.payload.name : "tool";
|
|
9889
|
+
const status = cursorStatusToDisplayStatus(event.payload.status);
|
|
9890
|
+
const input = isRecord(event.payload.args) ? event.payload.args : typeof event.payload.args === "string" ? event.payload.args : void 0;
|
|
9891
|
+
const existing = toolIndexes.get(callId);
|
|
9892
|
+
const next = {
|
|
9893
|
+
id: callId,
|
|
9894
|
+
type: "tool_call",
|
|
9895
|
+
server: "cursor",
|
|
9896
|
+
tool,
|
|
9897
|
+
...input !== void 0 ? { input } : {},
|
|
9898
|
+
output: stringify(event.payload.result),
|
|
9899
|
+
status,
|
|
9900
|
+
timestamp: event.timestamp
|
|
9901
|
+
};
|
|
9902
|
+
if (existing === void 0) {
|
|
9903
|
+
toolIndexes.set(callId, messages.push(next) - 1);
|
|
9904
|
+
} else {
|
|
9905
|
+
messages[existing] = { ...messages[existing], ...next };
|
|
9906
|
+
}
|
|
9907
|
+
continue;
|
|
9908
|
+
}
|
|
9909
|
+
if (event.type === "cursor-task") {
|
|
9910
|
+
activeAssistant = null;
|
|
9911
|
+
const text = event.payload.text;
|
|
9912
|
+
if (typeof text === "string" && text.trim()) {
|
|
9913
|
+
messages.push({
|
|
9914
|
+
id: `cursor-task-${event.timestamp}-${messages.length}`,
|
|
9915
|
+
type: "agent",
|
|
9916
|
+
content: text,
|
|
9917
|
+
timestamp: event.timestamp
|
|
9918
|
+
});
|
|
9919
|
+
}
|
|
9920
|
+
continue;
|
|
9921
|
+
}
|
|
9922
|
+
if (event.type === "cursor-status") {
|
|
9923
|
+
const status = event.payload.status;
|
|
9924
|
+
if (isTerminalStatus(status)) {
|
|
9925
|
+
const displayStatus = cursorStatusToDisplayStatus(status);
|
|
9926
|
+
finalizeActiveThinking(displayStatus);
|
|
9927
|
+
finalizeOpenTools(messages, toolIndexes, displayStatus);
|
|
9928
|
+
activeThinking = null;
|
|
9929
|
+
activeAssistant = null;
|
|
9930
|
+
}
|
|
9931
|
+
continue;
|
|
9932
|
+
}
|
|
9933
|
+
if (event.type === "cursor-error") {
|
|
9934
|
+
finalizeActiveThinking("failed");
|
|
9935
|
+
finalizeOpenTools(messages, toolIndexes, "failed");
|
|
9936
|
+
activeAssistant = null;
|
|
9937
|
+
activeThinking = null;
|
|
9938
|
+
const message = typeof event.payload.message === "string" ? event.payload.message : "Cursor run failed";
|
|
9939
|
+
messages.push({
|
|
9940
|
+
id: `cursor-error-${event.timestamp}-${messages.length}`,
|
|
9941
|
+
type: "error",
|
|
9942
|
+
message,
|
|
9943
|
+
timestamp: event.timestamp
|
|
9944
|
+
});
|
|
9945
|
+
}
|
|
9946
|
+
}
|
|
9947
|
+
return messages;
|
|
9948
|
+
}
|
|
9949
|
+
|
|
9741
9950
|
// ../shared/src/display-message/task-accumulator.ts
|
|
9742
9951
|
function mapTaskStatus(status) {
|
|
9743
9952
|
if (status === "in_progress" || status === "completed") return status;
|
|
@@ -10444,6 +10653,9 @@ function parseAgentEvents(events, agentType) {
|
|
|
10444
10653
|
if (agentType === "codex") {
|
|
10445
10654
|
return parseCodexEvents(events);
|
|
10446
10655
|
}
|
|
10656
|
+
if (agentType === "cursor") {
|
|
10657
|
+
return parseCursorEvents(events);
|
|
10658
|
+
}
|
|
10447
10659
|
return parseClaudeEvents(events);
|
|
10448
10660
|
}
|
|
10449
10661
|
function parseDisplayMessages(events, agentType, codexAspTranscript, options = {}) {
|