ai-project-manage-cli 8.1.0 → 8.1.2
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 -1
- package/dist/worker-script.js +71 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1043,6 +1043,8 @@ function validateWebIdeMessagePush(o) {
|
|
|
1043
1043
|
if (!nonEmptyString(o.user)) {
|
|
1044
1044
|
return { ok: false, reason: "webide-message \u7F3A\u5C11 user" };
|
|
1045
1045
|
}
|
|
1046
|
+
const useNewAgent = o.useNewAgent === true;
|
|
1047
|
+
const tools = Array.isArray(o.tools) ? o.tools.filter((t) => typeof t === "string" && t.trim().length > 0).map((t) => t.trim()) : void 0;
|
|
1046
1048
|
return {
|
|
1047
1049
|
ok: true,
|
|
1048
1050
|
data: {
|
|
@@ -1054,7 +1056,9 @@ function validateWebIdeMessagePush(o) {
|
|
|
1054
1056
|
model: o.model.trim(),
|
|
1055
1057
|
apiKey: o.apiKey.trim(),
|
|
1056
1058
|
workdir: o.workdir.trim(),
|
|
1057
|
-
user: o.user.trim()
|
|
1059
|
+
user: o.user.trim(),
|
|
1060
|
+
...useNewAgent ? { useNewAgent: true } : {},
|
|
1061
|
+
...tools && tools.length > 0 ? { tools } : {}
|
|
1058
1062
|
}
|
|
1059
1063
|
};
|
|
1060
1064
|
}
|
package/dist/worker-script.js
CHANGED
|
@@ -2250,12 +2250,22 @@ AskQuestion \u5DF2\u901A\u8FC7 MCP \u670D\u52A1\u5668 custom-user-tools \u6CE8\u
|
|
|
2250
2250
|
var WORKSPACE_BOUNDARY_HINT = `[\u5DE5\u4F5C\u533A\u8FB9\u754C]
|
|
2251
2251
|
\u6240\u6709\u6587\u4EF6\u8BFB\u5199\u3001\u641C\u7D22\uFF08Grep/Glob/Read\uFF09\u3001Shell \u5FC5\u987B\u4E25\u683C\u9650\u5236\u5728\u5F53\u524D\u5DE5\u4F5C\u533A cwd \u5185\u3002
|
|
2252
2252
|
\u7981\u6B62\u8BBF\u95EE\u5DE5\u4F5C\u533A\u5916\u8DEF\u5F84\uFF08\u5982\u5176\u5B83\u9879\u76EE\u3001~/.cursor\u3001agent-transcripts\u3001\u7CFB\u7EDF\u76EE\u5F55\u7B49\uFF09\u3002`;
|
|
2253
|
+
function wantsTool(name, options, legacyDefault) {
|
|
2254
|
+
if (options.toolNames) {
|
|
2255
|
+
return options.toolNames.includes(name);
|
|
2256
|
+
}
|
|
2257
|
+
return legacyDefault;
|
|
2258
|
+
}
|
|
2253
2259
|
function createCursorCustomTools(cfg2, options) {
|
|
2260
|
+
const enableAppend = options.enableAppendMessage !== false && Boolean(options.appendMessageContent);
|
|
2261
|
+
const enableAsk = options.enableAskQuestion !== false;
|
|
2262
|
+
const enablePlan = options.enableWebIdePlanTools === true;
|
|
2263
|
+
const enableMysql = options.enableMysqlTools === true;
|
|
2254
2264
|
const tools = {
|
|
2255
|
-
...options
|
|
2265
|
+
...wantsTool("AppendMessage", options, enableAppend) && options.appendMessageContent ? createAppendMessageCustomTools({
|
|
2256
2266
|
appendContent: options.appendMessageContent
|
|
2257
2267
|
}) : {},
|
|
2258
|
-
...options
|
|
2268
|
+
...wantsTool("AskQuestion", options, enableAsk) ? createAskQuestionTool({
|
|
2259
2269
|
onInvoke: options?.onAskQuestion,
|
|
2260
2270
|
execute: options?.askQuestionExecute
|
|
2261
2271
|
}) : {}
|
|
@@ -2263,24 +2273,39 @@ function createCursorCustomTools(cfg2, options) {
|
|
|
2263
2273
|
if (options?.taskId && options.workdir) {
|
|
2264
2274
|
const { cli } = createApmApiClient(cfg2);
|
|
2265
2275
|
const taskId = options.taskId;
|
|
2266
|
-
if (options
|
|
2276
|
+
if (wantsTool("RecommendPlan", options, enablePlan)) {
|
|
2267
2277
|
Object.assign(
|
|
2268
2278
|
tools,
|
|
2269
2279
|
createRecommendPlanTool({
|
|
2270
2280
|
webideRecommendPlan: (args) => cli.webideRecommendPlan({ taskId, ...args })
|
|
2271
|
-
})
|
|
2281
|
+
})
|
|
2282
|
+
);
|
|
2283
|
+
}
|
|
2284
|
+
if (wantsTool("UpsertWebIdePlan", options, enablePlan)) {
|
|
2285
|
+
Object.assign(
|
|
2286
|
+
tools,
|
|
2272
2287
|
createUpsertWebIdePlanTool({
|
|
2273
2288
|
webideUpsertPlan: (args) => cli.webideUpsertPlan({ taskId, ...args })
|
|
2274
|
-
})
|
|
2289
|
+
})
|
|
2290
|
+
);
|
|
2291
|
+
}
|
|
2292
|
+
if (wantsTool("UpsertWebIdeTestCases", options, enablePlan)) {
|
|
2293
|
+
Object.assign(
|
|
2294
|
+
tools,
|
|
2275
2295
|
createUpsertWebIdeTestCasesTool({
|
|
2276
2296
|
webideReplaceTestCases: (args) => cli.webideReplaceTestCases({ taskId, ...args })
|
|
2277
|
-
})
|
|
2297
|
+
})
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2300
|
+
if (wantsTool("MergeWebIdePullRequests", options, enablePlan)) {
|
|
2301
|
+
Object.assign(
|
|
2302
|
+
tools,
|
|
2278
2303
|
createMergeWebIdePullRequestsTool({
|
|
2279
2304
|
webideMergePullRequests: () => cli.webideMergePullRequests({ taskId })
|
|
2280
2305
|
})
|
|
2281
2306
|
);
|
|
2282
2307
|
}
|
|
2283
|
-
if (options
|
|
2308
|
+
if (wantsTool("MysqlExecute", options, enableMysql) && options.sqlExecutionId && options.workdir) {
|
|
2284
2309
|
Object.assign(
|
|
2285
2310
|
tools,
|
|
2286
2311
|
createMysqlExecuteTool({
|
|
@@ -2440,6 +2465,7 @@ async function runCursorAgent(cfg2, ctx, options) {
|
|
|
2440
2465
|
enableWebIdePlanTools: options.enableWebIdePlanTools,
|
|
2441
2466
|
enableMysqlTools: options.enableMysqlTools,
|
|
2442
2467
|
sqlExecutionId: options.sqlExecutionId,
|
|
2468
|
+
toolNames: options.toolNames,
|
|
2443
2469
|
taskId: options.taskId,
|
|
2444
2470
|
workdir,
|
|
2445
2471
|
enablePackageStatusTools: options.enablePackageStatusTools,
|
|
@@ -3902,10 +3928,12 @@ function markBranchDone(taskId, workdir) {
|
|
|
3902
3928
|
}
|
|
3903
3929
|
|
|
3904
3930
|
// src/commands/connect/webide-pull-requests.ts
|
|
3905
|
-
var
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3931
|
+
var POST_AGENT_PR_ACTIONS = /* @__PURE__ */ new Set([
|
|
3932
|
+
"request-organize-code",
|
|
3933
|
+
"request-patch"
|
|
3934
|
+
]);
|
|
3935
|
+
function shouldEnsureWebIdePullRequests(_action) {
|
|
3936
|
+
return false;
|
|
3909
3937
|
}
|
|
3910
3938
|
function shouldEnsureWebIdePullRequestsAfterAgent(action) {
|
|
3911
3939
|
return POST_AGENT_PR_ACTIONS.has(action);
|
|
@@ -4396,10 +4424,6 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4396
4424
|
);
|
|
4397
4425
|
await updateStatus2(cfg2, messageId, "TYPING");
|
|
4398
4426
|
syncLocalTaskStatus(workdir, taskId, msg2, "TYPING");
|
|
4399
|
-
const startAction = startActionForInbound(msg2.action);
|
|
4400
|
-
if (startAction) {
|
|
4401
|
-
await webIdeRunAction(cfg2, taskId, startAction);
|
|
4402
|
-
}
|
|
4403
4427
|
const eventSession = new EventSession(msg2.content);
|
|
4404
4428
|
const prepAgentId = loadWebIdeAgentId(workdir, taskId) ?? "webide-cli-prep";
|
|
4405
4429
|
const logSyncRef = {
|
|
@@ -4435,7 +4459,12 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4435
4459
|
throw err;
|
|
4436
4460
|
}
|
|
4437
4461
|
};
|
|
4462
|
+
let pausedForAssumptions = false;
|
|
4438
4463
|
try {
|
|
4464
|
+
const startAction = startActionForInbound(msg2.action);
|
|
4465
|
+
if (startAction) {
|
|
4466
|
+
await webIdeRunAction(cfg2, taskId, startAction);
|
|
4467
|
+
}
|
|
4439
4468
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
4440
4469
|
let assumptionAnswersText;
|
|
4441
4470
|
if (msg2.action === "confirm-assumptions") {
|
|
@@ -4443,7 +4472,6 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4443
4472
|
{ cfg: cfg2, taskId }
|
|
4444
4473
|
);
|
|
4445
4474
|
}
|
|
4446
|
-
let pausedForAssumptions = false;
|
|
4447
4475
|
await runPrepStep(
|
|
4448
4476
|
"\u521D\u59CB\u5316\u5DE5\u4F5C\u533A",
|
|
4449
4477
|
async () => {
|
|
@@ -4505,7 +4533,7 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4505
4533
|
if (shouldEnsureWebIdePullRequests(msg2.action)) {
|
|
4506
4534
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
4507
4535
|
await runPrepStep(
|
|
4508
|
-
"\
|
|
4536
|
+
"\u9A8C\u6536\u524D\u63A8\u9001",
|
|
4509
4537
|
async () => pushWorkspaceRepos(workdir),
|
|
4510
4538
|
(pushed) => `\u5DF2 push ${pushed} \u4E2A\u4ED3\u5E93`
|
|
4511
4539
|
);
|
|
@@ -4611,7 +4639,15 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4611
4639
|
const startLocalServices = isStartLocalServicesAction(msg2.action);
|
|
4612
4640
|
const designAction = isDesignAction(msg2.action);
|
|
4613
4641
|
const executeSql = isExecuteSqlAction(msg2.action);
|
|
4614
|
-
const
|
|
4642
|
+
const useNewAgent = msg2.useNewAgent === true;
|
|
4643
|
+
if (useNewAgent && !startLocalServices) {
|
|
4644
|
+
if (designAction) {
|
|
4645
|
+
clearWebIdeDesignAgentId(workdir, taskId);
|
|
4646
|
+
} else {
|
|
4647
|
+
clearWebIdeAgentId(workdir, taskId);
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
const savedAgentId = startLocalServices || useNewAgent ? void 0 : designAction ? loadWebIdeDesignAgentId(workdir, taskId) : loadWebIdeAgentId(workdir, taskId);
|
|
4615
4651
|
const promptPayload = executeSql ? parseWebIdePromptPayload(msg2.content) : null;
|
|
4616
4652
|
const sqlExecutionId = executeSql && typeof promptPayload?.executionId === "string" ? promptPayload.executionId.trim() : void 0;
|
|
4617
4653
|
const persistAgentId = (agentId) => {
|
|
@@ -4653,6 +4689,7 @@ ${assumptionAnswersText}` : msg2.content,
|
|
|
4653
4689
|
enablePtySessionMcp: startLocalServices,
|
|
4654
4690
|
enableMysqlTools: executeSql,
|
|
4655
4691
|
sqlExecutionId,
|
|
4692
|
+
toolNames: Array.isArray(msg2.tools) && msg2.tools.length > 0 ? msg2.tools : void 0,
|
|
4656
4693
|
enableSandbox: false,
|
|
4657
4694
|
onInvalidatePersistedAgentId: startLocalServices ? void 0 : () => {
|
|
4658
4695
|
if (designAction) {
|
|
@@ -4911,6 +4948,22 @@ ${assumptionAnswersText}` : msg2.content,
|
|
|
4911
4948
|
statusErr instanceof Error ? statusErr.message : statusErr
|
|
4912
4949
|
);
|
|
4913
4950
|
}
|
|
4951
|
+
const completeAction = completeActionForInbound(msg2.action);
|
|
4952
|
+
if (completeAction && !pausedForAssumptions) {
|
|
4953
|
+
try {
|
|
4954
|
+
await webIdeRunAction(
|
|
4955
|
+
cfg2,
|
|
4956
|
+
taskId,
|
|
4957
|
+
completeAction,
|
|
4958
|
+
completeAction === "complete-assessment" ? { force: true } : void 0
|
|
4959
|
+
);
|
|
4960
|
+
} catch (completeErr) {
|
|
4961
|
+
console.warn(
|
|
4962
|
+
`[apm] \u5931\u8D25\u540E\u56DE\u5199 complete \u8DF3\u8FC7 action=${completeAction}:`,
|
|
4963
|
+
completeErr instanceof Error ? completeErr.message : completeErr
|
|
4964
|
+
);
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4914
4967
|
syncLocalTaskStatus(workdir, taskId, msg2, "FAILED");
|
|
4915
4968
|
}
|
|
4916
4969
|
}
|