ai-project-manage-cli 5.0.17 → 5.0.18
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 +5 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1040,23 +1040,8 @@ function validateAgentWsMessage(value, kind) {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
1042
|
// src/commands/connect/cursor-agent.ts
|
|
1043
|
-
import { resolve as resolve3 } from "path";
|
|
1044
1043
|
import { Agent, CursorAgentError } from "@cursor/sdk";
|
|
1045
|
-
|
|
1046
|
-
function resolveModelId(model) {
|
|
1047
|
-
const id = model.trim();
|
|
1048
|
-
return id || DEFAULT_CURSOR_MODEL;
|
|
1049
|
-
}
|
|
1050
|
-
function buildPrompt(ctx) {
|
|
1051
|
-
const lines = [
|
|
1052
|
-
`\u4F60\u662F${ctx.user}`,
|
|
1053
|
-
`\u4F1A\u8BDDID: ${ctx.sessionId}`,
|
|
1054
|
-
`\u6D88\u606FID: ${ctx.messageId}`,
|
|
1055
|
-
`\u4EFB\u52A1: ${ctx.content}`,
|
|
1056
|
-
`\u8BF7\u5148\u9605\u8BFBAPM\u6307\u5357\uFF1A [AGENTS.md](.apm/AGENTS.md)\uFF0C\u4E25\u683C\u6309\u7167\u6307\u5357\u7684\u5DE5\u4F5C\u6D41\u7A0B\u5B8C\u6210\u4EFB\u52A1`
|
|
1057
|
-
];
|
|
1058
|
-
return lines.join("\n");
|
|
1059
|
-
}
|
|
1044
|
+
import { resolve as resolve3 } from "path";
|
|
1060
1045
|
function extractAssistantTextFromStream(event) {
|
|
1061
1046
|
if (event.type !== "assistant") {
|
|
1062
1047
|
return "";
|
|
@@ -1079,13 +1064,13 @@ async function runCursorAgent(_cfg, ctx) {
|
|
|
1079
1064
|
throw new Error("\u7F3A\u5C11 apiKey\uFF0C\u65E0\u6CD5\u8C03\u7528 Cursor SDK");
|
|
1080
1065
|
}
|
|
1081
1066
|
const cwd = resolve3(ctx.workdir);
|
|
1082
|
-
const prompt =
|
|
1067
|
+
const prompt = ctx.prompt;
|
|
1083
1068
|
console.log(
|
|
1084
1069
|
`[apm] Cursor Agent \u5F00\u59CB messageId=${ctx.messageId} sessionId=${ctx.sessionId} cwd=${cwd}`
|
|
1085
1070
|
);
|
|
1086
1071
|
const agent = await Agent.create({
|
|
1087
1072
|
apiKey,
|
|
1088
|
-
model: { id:
|
|
1073
|
+
model: { id: ctx.model || "default" },
|
|
1089
1074
|
local: {
|
|
1090
1075
|
cwd,
|
|
1091
1076
|
settingSources: []
|
|
@@ -1159,11 +1144,10 @@ async function handleInboundMessage(cfg, raw) {
|
|
|
1159
1144
|
await runCursorAgent(cfg, {
|
|
1160
1145
|
messageId: msg.messageId,
|
|
1161
1146
|
sessionId: msg.sessionId,
|
|
1162
|
-
|
|
1147
|
+
prompt: msg.content,
|
|
1163
1148
|
model: msg.model,
|
|
1164
1149
|
apiKey: msg.apiKey,
|
|
1165
|
-
workdir: msg.workdir
|
|
1166
|
-
user: msg.user
|
|
1150
|
+
workdir: msg.workdir
|
|
1167
1151
|
});
|
|
1168
1152
|
await updateMessageStatus(cfg, messageId, "SUCCESS");
|
|
1169
1153
|
} catch (err) {
|