chatroom-cli 1.64.0 → 1.65.0
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.js +62 -46
- package/dist/index.js.map +10 -10
- package/dist/node-launch.js.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -33370,7 +33370,8 @@ var exports_cursor_sdk_package = {};
|
|
|
33370
33370
|
__export(exports_cursor_sdk_package, {
|
|
33371
33371
|
importBundledCursorSdk: () => importBundledCursorSdk,
|
|
33372
33372
|
getBundledCursorSdkVersion: () => getBundledCursorSdkVersion,
|
|
33373
|
-
formatCursorSdkLoadError: () => formatCursorSdkLoadError
|
|
33373
|
+
formatCursorSdkLoadError: () => formatCursorSdkLoadError,
|
|
33374
|
+
formatCursorSdkError: () => formatCursorSdkError
|
|
33374
33375
|
});
|
|
33375
33376
|
import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
|
|
33376
33377
|
import { createRequire as createRequire4 } from "node:module";
|
|
@@ -33435,11 +33436,20 @@ function getBundledCursorSdkVersion(moduleRef = import.meta.url) {
|
|
|
33435
33436
|
const entryPath = require3.resolve("@cursor/sdk", { paths: [chatroomCliRoot] });
|
|
33436
33437
|
return readInstalledSdkVersion2(entryPath);
|
|
33437
33438
|
}
|
|
33439
|
+
function formatCursorSdkError(err) {
|
|
33440
|
+
if (err instanceof Error) {
|
|
33441
|
+
const sdkErr = err;
|
|
33442
|
+
const code2 = sdkErr.code ? `[${sdkErr.code}] ` : "";
|
|
33443
|
+
const name = sdkErr.name && sdkErr.name !== "Error" ? `${sdkErr.name}: ` : "";
|
|
33444
|
+
return `${name}${code2}${err.message}`.trim();
|
|
33445
|
+
}
|
|
33446
|
+
return String(err);
|
|
33447
|
+
}
|
|
33438
33448
|
function formatCursorSdkLoadError(err) {
|
|
33439
33449
|
if (err instanceof CursorSdkPackageError) {
|
|
33440
33450
|
return err.message;
|
|
33441
33451
|
}
|
|
33442
|
-
const message =
|
|
33452
|
+
const message = formatCursorSdkError(err);
|
|
33443
33453
|
const chunkMatch = message.match(/(\d+)\.index\.js/);
|
|
33444
33454
|
if (chunkMatch) {
|
|
33445
33455
|
return `@cursor/sdk installation is incomplete (missing ${chunkMatch[1]}.index.js). ${REINSTALL_HINT2}`;
|
|
@@ -33483,6 +33493,11 @@ var init_cursor_sdk_stream_adapter = __esm(() => {
|
|
|
33483
33493
|
break;
|
|
33484
33494
|
case "tool_call": {
|
|
33485
33495
|
this.flushText();
|
|
33496
|
+
if (message.status === "error") {
|
|
33497
|
+
const detail = message.result !== undefined ? JSON.stringify(message.result) : "no result";
|
|
33498
|
+
this.writeLine(formatAgentLogLine(this.logPrefix, "tool-error", `${message.name} (${message.call_id}): ${detail}`));
|
|
33499
|
+
break;
|
|
33500
|
+
}
|
|
33486
33501
|
const bashCmd = extractBashCommandFromToolInput(message.name, message.args);
|
|
33487
33502
|
if (bashCmd !== null) {
|
|
33488
33503
|
this.writeLine(formatAgentLogLine(this.logPrefix, BASH_TOOL_KIND, formatBashRunningPayload(bashCmd)));
|
|
@@ -33491,9 +33506,11 @@ var init_cursor_sdk_stream_adapter = __esm(() => {
|
|
|
33491
33506
|
this.writeLine(formatAgentLogLine(this.logPrefix, `tool: ${message.call_id} ${message.name} ${JSON.stringify({ status: message.status, args: message.args })}`));
|
|
33492
33507
|
break;
|
|
33493
33508
|
}
|
|
33494
|
-
case "status":
|
|
33495
|
-
|
|
33509
|
+
case "status": {
|
|
33510
|
+
const payload = message.message ? `${message.status}: ${message.message}` : message.status;
|
|
33511
|
+
this.writeLine(formatAgentLogLine(this.logPrefix, "status", payload));
|
|
33496
33512
|
break;
|
|
33513
|
+
}
|
|
33497
33514
|
case "thinking":
|
|
33498
33515
|
this.writeLine(formatAgentLogLine(this.logPrefix, "thinking", message.text));
|
|
33499
33516
|
break;
|
|
@@ -33502,8 +33519,16 @@ var init_cursor_sdk_stream_adapter = __esm(() => {
|
|
|
33502
33519
|
this.writeLine(formatAgentLogLine(this.logPrefix, "system: init"));
|
|
33503
33520
|
}
|
|
33504
33521
|
break;
|
|
33505
|
-
|
|
33522
|
+
case "task":
|
|
33523
|
+
this.writeLine(formatAgentLogLine(this.logPrefix, "task", [message.status, message.text].filter(Boolean).join(": ")));
|
|
33524
|
+
break;
|
|
33525
|
+
default: {
|
|
33526
|
+
const unknown = message;
|
|
33527
|
+
if (unknown.type) {
|
|
33528
|
+
this.writeLine(formatAgentLogLine(this.logPrefix, "stream", `unhandled type: ${unknown.type}`));
|
|
33529
|
+
}
|
|
33506
33530
|
break;
|
|
33531
|
+
}
|
|
33507
33532
|
}
|
|
33508
33533
|
}
|
|
33509
33534
|
flushPendingOutput() {
|
|
@@ -33604,8 +33629,14 @@ function waitForResumeOrAbort2(session2) {
|
|
|
33604
33629
|
function resolveModelId(model) {
|
|
33605
33630
|
return model ? resolveCursorSdkModel(model) : DEFAULT_MODEL;
|
|
33606
33631
|
}
|
|
33632
|
+
function buildLocalAgentOptions(cwd) {
|
|
33633
|
+
return {
|
|
33634
|
+
cwd,
|
|
33635
|
+
settingSources: []
|
|
33636
|
+
};
|
|
33637
|
+
}
|
|
33607
33638
|
function writeSpawnError2(logPrefix, err, emitLogLine) {
|
|
33608
|
-
const line = formatAgentLogLine(logPrefix, "spawn-error",
|
|
33639
|
+
const line = formatAgentLogLine(logPrefix, "spawn-error", formatCursorSdkError(err));
|
|
33609
33640
|
process.stderr.write(`${line}
|
|
33610
33641
|
`);
|
|
33611
33642
|
emitLogLine?.(line);
|
|
@@ -33724,6 +33755,7 @@ var init_cursor_sdk_agent_service = __esm(() => {
|
|
|
33724
33755
|
const keeper = this.spawnKeeper(options.workingDir);
|
|
33725
33756
|
const pid = keeper.pid;
|
|
33726
33757
|
const context5 = options.context;
|
|
33758
|
+
const logPrefix = buildAgentLogPrefix("cursor-sdk", context5);
|
|
33727
33759
|
const agentName = stored.agentName;
|
|
33728
33760
|
const modelId = resolveModelId(options.model ?? stored.model);
|
|
33729
33761
|
const systemPrompt = options.systemPrompt ? `${NO_SUBAGENT_DIRECTIVE2}
|
|
@@ -33738,11 +33770,11 @@ ${options.prompt}`;
|
|
|
33738
33770
|
agent = await withTimeout(Agent.resume(stored.harnessSessionId, {
|
|
33739
33771
|
apiKey,
|
|
33740
33772
|
model: { id: modelId },
|
|
33741
|
-
local:
|
|
33773
|
+
local: buildLocalAgentOptions(stored.workingDir)
|
|
33742
33774
|
}), AGENT_CREATE_TIMEOUT_MS, "Agent.resume");
|
|
33743
33775
|
} catch (err) {
|
|
33744
|
-
|
|
33745
|
-
process.stderr.write(`[${new Date().toISOString()}] role:${context5.role} daemon-resume-fallback] ${
|
|
33776
|
+
writeSpawnError2(logPrefix, err);
|
|
33777
|
+
process.stderr.write(`[${new Date().toISOString()}] role:${context5.role} daemon-resume-fallback] ${formatCursorSdkError(err)} — cold spawning
|
|
33746
33778
|
`);
|
|
33747
33779
|
keeper.kill();
|
|
33748
33780
|
this.deleteProcess(pid);
|
|
@@ -33990,6 +34022,7 @@ ${deferredResume}` : deferredResume;
|
|
|
33990
34022
|
const keeper = this.spawnKeeper(options.workingDir);
|
|
33991
34023
|
const pid = keeper.pid;
|
|
33992
34024
|
const context5 = options.context;
|
|
34025
|
+
const logPrefix = buildAgentLogPrefix("cursor-sdk", context5);
|
|
33993
34026
|
const agentName = buildAgentName(context5);
|
|
33994
34027
|
const modelId = resolveModelId(options.model);
|
|
33995
34028
|
const systemPrompt = options.systemPrompt ? `${NO_SUBAGENT_DIRECTIVE2}
|
|
@@ -34005,9 +34038,10 @@ ${options.prompt}`;
|
|
|
34005
34038
|
apiKey,
|
|
34006
34039
|
name: agentName,
|
|
34007
34040
|
model: { id: modelId, params: [{ id: "fast", value: "false" }] },
|
|
34008
|
-
local:
|
|
34041
|
+
local: buildLocalAgentOptions(options.workingDir)
|
|
34009
34042
|
}), AGENT_CREATE_TIMEOUT_MS, "Agent.create");
|
|
34010
34043
|
} catch (err) {
|
|
34044
|
+
writeSpawnError2(logPrefix, err);
|
|
34011
34045
|
keeper.kill();
|
|
34012
34046
|
this.deleteProcess(pid);
|
|
34013
34047
|
throw err;
|
|
@@ -36119,6 +36153,8 @@ function isClassifiableHarnessLogLine(line) {
|
|
|
36119
36153
|
return false;
|
|
36120
36154
|
if (line.includes("agent_end]"))
|
|
36121
36155
|
return true;
|
|
36156
|
+
if (line.includes("spawn-error]"))
|
|
36157
|
+
return true;
|
|
36122
36158
|
if (line.includes(" error]"))
|
|
36123
36159
|
return true;
|
|
36124
36160
|
if (line.includes(" run-error]"))
|
|
@@ -36165,7 +36201,9 @@ var init_terminal_provider_error = __esm(() => {
|
|
|
36165
36201
|
FATAL_HARNESS_PHRASES = [
|
|
36166
36202
|
"failed to load model",
|
|
36167
36203
|
"model loading was stopped",
|
|
36168
|
-
"insufficient system resources"
|
|
36204
|
+
"insufficient system resources",
|
|
36205
|
+
"sandboxing is not supported",
|
|
36206
|
+
"disable local.sandboxoptions.enabled"
|
|
36169
36207
|
];
|
|
36170
36208
|
QUOTA_PHRASES = [
|
|
36171
36209
|
"usagelimit",
|
|
@@ -79757,7 +79795,6 @@ var init_errorCodes = __esm(() => {
|
|
|
79757
79795
|
TEAM_REQUIRED: "TEAM_REQUIRED",
|
|
79758
79796
|
CONFIGURATION_ERROR: "CONFIGURATION_ERROR",
|
|
79759
79797
|
PARTICIPANT_NOT_FOUND: "PARTICIPANT_NOT_FOUND",
|
|
79760
|
-
CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT: "CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT",
|
|
79761
79798
|
CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND",
|
|
79762
79799
|
CONTEXT_RESTRICTED: "CONTEXT_RESTRICTED",
|
|
79763
79800
|
INVALID_ROLE: "INVALID_ROLE",
|
|
@@ -79836,7 +79873,6 @@ var init_errorCodes = __esm(() => {
|
|
|
79836
79873
|
BACKEND_ERROR_CODES.FEATURE_DISABLED
|
|
79837
79874
|
];
|
|
79838
79875
|
NON_FATAL_ERROR_CODES = [
|
|
79839
|
-
BACKEND_ERROR_CODES.CONTEXT_NO_HANDOFF_SINCE_LAST_CONTEXT,
|
|
79840
79876
|
BACKEND_ERROR_CODES.CONTEXT_NOT_FOUND,
|
|
79841
79877
|
BACKEND_ERROR_CODES.CONTEXT_RESTRICTED,
|
|
79842
79878
|
BACKEND_ERROR_CODES.BACKLOG_ITEM_NOT_FOUND,
|
|
@@ -83695,21 +83731,6 @@ function handleContextError(err) {
|
|
|
83695
83731
|
} else if (err._tag === "EmptyContent") {
|
|
83696
83732
|
console.error(`❌ Context content cannot be empty`);
|
|
83697
83733
|
process.exit(1);
|
|
83698
|
-
} else if (err._tag === "ContextNoHandoffSinceLast") {
|
|
83699
|
-
const { content, createdAt, createdBy } = err.existingContext;
|
|
83700
|
-
console.error(`❌ Cannot create new context: no handoff sent since last context was created.`);
|
|
83701
|
-
console.error(`
|
|
83702
|
-
\uD83D\uDCCC Current Context (resume from here):`);
|
|
83703
|
-
console.error(` Created by: ${sanitizeForTerminal(createdBy)}`);
|
|
83704
|
-
console.error(` Created at: ${new Date(createdAt).toLocaleString()}`);
|
|
83705
|
-
console.error(` Content:`);
|
|
83706
|
-
const safeContent = sanitizeForTerminal(content);
|
|
83707
|
-
console.error(safeContent.split(`
|
|
83708
|
-
`).map((l) => ` ${l}`).join(`
|
|
83709
|
-
`));
|
|
83710
|
-
console.error(`
|
|
83711
|
-
\uD83D\uDCA1 Send a handoff first, then create a new context.`);
|
|
83712
|
-
process.exit(1);
|
|
83713
83734
|
} else if (err._tag === "ReadContextFailed") {
|
|
83714
83735
|
console.error(`❌ Failed to read context: ${sanitizeUnknownForTerminal(err.cause.message)}`);
|
|
83715
83736
|
process.exit(1);
|
|
@@ -83885,19 +83906,10 @@ var readContextEffect = (chatroomId, options) => exports_Effect.gen(function* ()
|
|
|
83885
83906
|
content: options.content,
|
|
83886
83907
|
role: options.role,
|
|
83887
83908
|
triggerMessageId: options.triggerMessageId
|
|
83888
|
-
}).pipe(exports_Effect.catchAll((cause3) => {
|
|
83889
|
-
|
|
83890
|
-
|
|
83891
|
-
|
|
83892
|
-
_tag: "ContextNoHandoffSinceLast",
|
|
83893
|
-
existingContext: errData.existingContext
|
|
83894
|
-
});
|
|
83895
|
-
}
|
|
83896
|
-
return exports_Effect.fail({
|
|
83897
|
-
_tag: "NewContextFailed",
|
|
83898
|
-
cause: cause3
|
|
83899
|
-
});
|
|
83900
|
-
}));
|
|
83909
|
+
}).pipe(exports_Effect.catchAll((cause3) => exports_Effect.fail({
|
|
83910
|
+
_tag: "NewContextFailed",
|
|
83911
|
+
cause: cause3
|
|
83912
|
+
})));
|
|
83901
83913
|
yield* exports_Effect.sync(() => {
|
|
83902
83914
|
console.log(`✅ Context created successfully`);
|
|
83903
83915
|
console.log(` Context ID: ${contextId}`);
|
|
@@ -90535,7 +90547,7 @@ var init_crash_loop_tracker = __esm(() => {
|
|
|
90535
90547
|
});
|
|
90536
90548
|
|
|
90537
90549
|
// ../../services/backend/src/domain/entities/participant.ts
|
|
90538
|
-
var NATIVE_WAITING_ACTION = "native:waiting", NATIVE_TASK_INJECTED_ACTION = "native:task-injected", NATIVE_HANDOFF_REMINDER = "Reminder: Use the handoff command to send your response to the team.", ONLINE_OR_STARTING_STATUSES;
|
|
90550
|
+
var PARTICIPANT_EXITED_ACTION = "exited", NATIVE_WAITING_ACTION = "native:waiting", NATIVE_TASK_INJECTED_ACTION = "native:task-injected", NATIVE_HANDOFF_REMINDER = "Reminder: Use the handoff command to send your response to the team.", ONLINE_OR_STARTING_STATUSES;
|
|
90539
90551
|
var init_participant = __esm(() => {
|
|
90540
90552
|
ONLINE_OR_STARTING_STATUSES = new Set([
|
|
90541
90553
|
"agent.waiting",
|
|
@@ -90638,7 +90650,10 @@ function isNativeInjectableAliveRunning(task) {
|
|
|
90638
90650
|
function isInjectableNativeAction(action) {
|
|
90639
90651
|
if (action == null)
|
|
90640
90652
|
return true;
|
|
90641
|
-
return action === NATIVE_WAITING_ACTION;
|
|
90653
|
+
return action === NATIVE_WAITING_ACTION || action === PARTICIPANT_EXITED_ACTION;
|
|
90654
|
+
}
|
|
90655
|
+
function isNativePendingRedeliveryAfterRelease(task) {
|
|
90656
|
+
return task.status === "pending" && task.participant?.lastSeenAction === NATIVE_TASK_INJECTED_ACTION;
|
|
90642
90657
|
}
|
|
90643
90658
|
function isNativeIdleAfterTaskComplete(participant) {
|
|
90644
90659
|
return participant.lastSeenAction === NATIVE_TASK_INJECTED_ACTION && participant.lastStatus === "task.completed";
|
|
@@ -90704,9 +90719,10 @@ function shouldDeliverNativeTask(task, opts) {
|
|
|
90704
90719
|
return false;
|
|
90705
90720
|
if (!opts.harnessSessionId)
|
|
90706
90721
|
return false;
|
|
90707
|
-
if (opts.ledger.isDelivered(task.taskId, opts.harnessSessionId))
|
|
90722
|
+
if (opts.ledger.isDelivered(task.taskId, opts.harnessSessionId) && task.status !== "pending") {
|
|
90708
90723
|
return false;
|
|
90709
|
-
|
|
90724
|
+
}
|
|
90725
|
+
return isInjectableNativeAction(task.participant?.lastSeenAction) || isNativeIdleAfterTaskComplete(task.participant ?? {}) || isNativeAcknowledgedInjectionRetry(task) || isNativePendingRedeliveryAfterRelease(task);
|
|
90710
90726
|
}
|
|
90711
90727
|
function buildNativeInjectionPrompt(params) {
|
|
90712
90728
|
const { taskDeliveryOutput, augmentationMode } = params;
|
|
@@ -108829,4 +108845,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
108829
108845
|
});
|
|
108830
108846
|
program2.parse();
|
|
108831
108847
|
|
|
108832
|
-
//# debugId=
|
|
108848
|
+
//# debugId=44E20CE9388FFEA564756E2164756E21
|