ai-project-manage-cli 8.1.5 → 8.1.6
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 -0
- package/dist/worker-script.js +72 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -287,6 +287,11 @@ var requestConfig = {
|
|
|
287
287
|
method: "POST",
|
|
288
288
|
path: "/cli/webide/actions"
|
|
289
289
|
}),
|
|
290
|
+
/** CLI 准备步骤实时回写到「待→进行中」转移线 */
|
|
291
|
+
webideUpdateTransitionPrepEvents: defineEndpoint({
|
|
292
|
+
method: "PUT",
|
|
293
|
+
path: "/cli/webide/transition-prep-events"
|
|
294
|
+
}),
|
|
290
295
|
webideUpsertMessageLog: defineEndpoint({
|
|
291
296
|
method: "PUT",
|
|
292
297
|
path: "/cli/webide/message-logs"
|
package/dist/worker-script.js
CHANGED
|
@@ -35,6 +35,11 @@ var requestConfig = {
|
|
|
35
35
|
method: "POST",
|
|
36
36
|
path: "/cli/webide/actions"
|
|
37
37
|
}),
|
|
38
|
+
/** CLI 准备步骤实时回写到「待→进行中」转移线 */
|
|
39
|
+
webideUpdateTransitionPrepEvents: defineEndpoint({
|
|
40
|
+
method: "PUT",
|
|
41
|
+
path: "/cli/webide/transition-prep-events"
|
|
42
|
+
}),
|
|
38
43
|
webideUpsertMessageLog: defineEndpoint({
|
|
39
44
|
method: "PUT",
|
|
40
45
|
path: "/cli/webide/message-logs"
|
|
@@ -1216,6 +1221,16 @@ var EventSession = class {
|
|
|
1216
1221
|
});
|
|
1217
1222
|
this.markDirty(this.events.length - 1);
|
|
1218
1223
|
}
|
|
1224
|
+
/** 导出当前 CLI 准备步骤快照(供 start-* 写入转移日志) */
|
|
1225
|
+
getCliSteps() {
|
|
1226
|
+
return this.events.filter((e) => e.type === "cli_step" && typeof e.step === "string").map((e) => ({
|
|
1227
|
+
step: String(e.step),
|
|
1228
|
+
status: typeof e.status === "string" ? e.status : "ok",
|
|
1229
|
+
text: typeof e.text === "string" ? e.text : "",
|
|
1230
|
+
...typeof e.at === "string" ? { at: e.at } : {},
|
|
1231
|
+
...typeof e.durationMs === "number" && Number.isFinite(e.durationMs) ? { durationMs: e.durationMs } : {}
|
|
1232
|
+
}));
|
|
1233
|
+
}
|
|
1219
1234
|
formatEvent(event) {
|
|
1220
1235
|
switch (event.type) {
|
|
1221
1236
|
case "assistant": {
|
|
@@ -4193,6 +4208,36 @@ async function webIdeRunAction(cfg2, taskId, action, params) {
|
|
|
4193
4208
|
await api.cli.webideRunAction({ taskId, action, params });
|
|
4194
4209
|
console.log(`[apm] webide runAction ok action=${action} taskId=${taskId}`);
|
|
4195
4210
|
}
|
|
4211
|
+
async function webIdeSyncTransitionPrepEvents(cfg2, taskId, startAction, prepEvents) {
|
|
4212
|
+
try {
|
|
4213
|
+
const api = createApmApiClient(cfg2);
|
|
4214
|
+
await api.cli.webideUpdateTransitionPrepEvents({
|
|
4215
|
+
taskId,
|
|
4216
|
+
startAction,
|
|
4217
|
+
prepEvents
|
|
4218
|
+
});
|
|
4219
|
+
} catch (err) {
|
|
4220
|
+
console.warn(
|
|
4221
|
+
`[apm] sync transition prepEvents failed taskId=${taskId}:`,
|
|
4222
|
+
err instanceof Error ? err.message : err
|
|
4223
|
+
);
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
async function webIdeDiscardTransitionPrepDraft(cfg2, taskId, startAction) {
|
|
4227
|
+
try {
|
|
4228
|
+
const api = createApmApiClient(cfg2);
|
|
4229
|
+
await api.cli.webideUpdateTransitionPrepEvents({
|
|
4230
|
+
taskId,
|
|
4231
|
+
startAction,
|
|
4232
|
+
discardDraft: true
|
|
4233
|
+
});
|
|
4234
|
+
} catch (err) {
|
|
4235
|
+
console.warn(
|
|
4236
|
+
`[apm] discard transition prep draft failed taskId=${taskId}:`,
|
|
4237
|
+
err instanceof Error ? err.message : err
|
|
4238
|
+
);
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4196
4241
|
|
|
4197
4242
|
// src/commands/connect/webide-ask-question.ts
|
|
4198
4243
|
function asString5(value) {
|
|
@@ -4805,11 +4850,22 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4805
4850
|
}
|
|
4806
4851
|
)
|
|
4807
4852
|
};
|
|
4853
|
+
let pausedForAssumptions = false;
|
|
4854
|
+
let startAction = null;
|
|
4808
4855
|
const syncPrepLog = async () => {
|
|
4809
4856
|
const sync = logSyncRef.current;
|
|
4810
|
-
if (
|
|
4811
|
-
|
|
4812
|
-
|
|
4857
|
+
if (sync) {
|
|
4858
|
+
sync.schedule(eventSession);
|
|
4859
|
+
await sync.flush(eventSession);
|
|
4860
|
+
}
|
|
4861
|
+
if (startAction) {
|
|
4862
|
+
await webIdeSyncTransitionPrepEvents(
|
|
4863
|
+
cfg2,
|
|
4864
|
+
taskId,
|
|
4865
|
+
startAction,
|
|
4866
|
+
eventSession.getCliSteps()
|
|
4867
|
+
);
|
|
4868
|
+
}
|
|
4813
4869
|
};
|
|
4814
4870
|
const runPrepStep = async (step, work, formatOk) => {
|
|
4815
4871
|
eventSession.addCliStep(step, "\u8FDB\u884C\u4E2D\u2026", "running");
|
|
@@ -4826,12 +4882,8 @@ async function handleWebIdeInboundMessage(cfg2, msg2, signal) {
|
|
|
4826
4882
|
throw err;
|
|
4827
4883
|
}
|
|
4828
4884
|
};
|
|
4829
|
-
let pausedForAssumptions = false;
|
|
4830
4885
|
try {
|
|
4831
|
-
|
|
4832
|
-
if (startAction) {
|
|
4833
|
-
await webIdeRunAction(cfg2, taskId, startAction);
|
|
4834
|
-
}
|
|
4886
|
+
startAction = startActionForInbound(msg2.action);
|
|
4835
4887
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
4836
4888
|
let assumptionAnswersText;
|
|
4837
4889
|
if (msg2.action === "confirm-assumptions") {
|
|
@@ -5092,6 +5144,15 @@ ${assumptionAnswersText}` : msg2.content,
|
|
|
5092
5144
|
logSyncRef.current?.schedule(eventSession);
|
|
5093
5145
|
await logSyncRef.current?.markRun(runId, "running");
|
|
5094
5146
|
await logSyncRef.current?.flush(eventSession);
|
|
5147
|
+
if (startAction) {
|
|
5148
|
+
await webIdeSyncTransitionPrepEvents(
|
|
5149
|
+
cfg2,
|
|
5150
|
+
taskId,
|
|
5151
|
+
startAction,
|
|
5152
|
+
eventSession.getCliSteps()
|
|
5153
|
+
);
|
|
5154
|
+
await webIdeRunAction(cfg2, taskId, startAction, { runId });
|
|
5155
|
+
}
|
|
5095
5156
|
}
|
|
5096
5157
|
}
|
|
5097
5158
|
);
|
|
@@ -5306,6 +5367,9 @@ ${assumptionAnswersText}` : msg2.content,
|
|
|
5306
5367
|
} catch (err) {
|
|
5307
5368
|
const detail = err instanceof Error ? err.message : String(err);
|
|
5308
5369
|
console.error(`[apm] webide-message \u5931\u8D25: ${detail}`);
|
|
5370
|
+
if (startAction) {
|
|
5371
|
+
await webIdeDiscardTransitionPrepDraft(cfg2, taskId, startAction);
|
|
5372
|
+
}
|
|
5309
5373
|
if (detail.includes("\u590D\u7528 Agent") || detail.includes("resume")) {
|
|
5310
5374
|
clearWebIdeAgentId(workdir, taskId);
|
|
5311
5375
|
}
|