geo-ai-search-optimization 1.2.18 → 1.2.20
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/README.md +61 -0
- package/package.json +1 -1
- package/resources/geo-ai-search-optimization/references/skill-bundle-map.md +20 -0
- package/resources/geo-ai-search-optimization-agent-continue/SKILL.md +24 -0
- package/resources/geo-ai-search-optimization-agent-continue/agents/openai.yaml +4 -0
- package/resources/geo-ai-search-optimization-agent-resume/SKILL.md +24 -0
- package/resources/geo-ai-search-optimization-agent-resume/agents/openai.yaml +4 -0
- package/resources/geo-ai-search-optimization-usage/SKILL.md +35 -25
- package/src/agent-continue.js +316 -0
- package/src/agent-resume.js +331 -0
- package/src/agent-session.js +20 -0
- package/src/auto-flow.js +67 -29
- package/src/cli.js +68 -0
- package/src/index.js +2 -0
- package/src/skills.js +6 -0
package/README.md
CHANGED
|
@@ -63,6 +63,47 @@ geo-ai-search-optimization agent-orchestrator ./reports/agent-playbook-pack.json
|
|
|
63
63
|
- 做完之后下一条是什么
|
|
64
64
|
- 可直接复制给 agent 的 orchestrator prompt
|
|
65
65
|
|
|
66
|
+
## Agent Resume 命令
|
|
67
|
+
|
|
68
|
+
如果 GEO 工作已经做过一轮或多轮,你不想让下一个 agent 从头重新判断,而是想让它从最近一个可靠恢复点继续,可以直接用 `agent-resume`:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
geo-ai-search-optimization agent-resume "继续这个 GEO 任务"
|
|
72
|
+
geo-ai-search-optimization agent-resume https://example.com
|
|
73
|
+
geo-ai-search-optimization agent-resume ./your-site
|
|
74
|
+
geo-ai-search-optimization agent-resume ./reports/agent-playbook-pack.json --format json --out ./reports/agent-resume.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
它会输出:
|
|
78
|
+
|
|
79
|
+
- 恢复模式
|
|
80
|
+
- 从哪里恢复
|
|
81
|
+
- 现在只恢复哪一条命令
|
|
82
|
+
- 恢复前要先确认什么
|
|
83
|
+
- 恢复时不要重置什么
|
|
84
|
+
- 恢复后下一条是什么
|
|
85
|
+
- 可直接复制给 agent 的 resume prompt
|
|
86
|
+
|
|
87
|
+
## Agent Continue 命令
|
|
88
|
+
|
|
89
|
+
如果你希望 agent 不只知道从哪里恢复,还要知道这一轮做完之后该更新哪些状态工件,可以直接用 `agent-continue`:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
geo-ai-search-optimization agent-continue ./your-site
|
|
93
|
+
geo-ai-search-optimization agent-continue ./reports/agent-playbook-pack.json
|
|
94
|
+
geo-ai-search-optimization agent-continue ./reports/agent-resume.json --format json --out ./reports/agent-continue.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
它会输出:
|
|
98
|
+
|
|
99
|
+
- 这一轮怎么继续
|
|
100
|
+
- 现在先执行哪条命令
|
|
101
|
+
- 这轮的 do-now checklist
|
|
102
|
+
- 执行后先验证什么
|
|
103
|
+
- 完成后更新哪些工件
|
|
104
|
+
- 可以进入收尾时跑什么
|
|
105
|
+
- 可直接复制给 agent 的 continue prompt
|
|
106
|
+
|
|
66
107
|
## Auto Flow 命令
|
|
67
108
|
|
|
68
109
|
如果你希望 agent 不用自己判断现在该用哪个 skill、该跑哪个命令,可以直接用 `auto-flow`:
|
|
@@ -682,6 +723,8 @@ geo-ai-search-optimization
|
|
|
682
723
|
geo-ai-search-optimization install
|
|
683
724
|
geo-ai-search-optimization install --target ./tmp/custom-skills --json
|
|
684
725
|
geo-ai-search-optimization agent-orchestrator ./your-site
|
|
726
|
+
geo-ai-search-optimization agent-resume ./your-site
|
|
727
|
+
geo-ai-search-optimization agent-continue ./your-site
|
|
685
728
|
geo-ai-search-optimization auto-flow "audit this site and tell me the next skill"
|
|
686
729
|
geo-ai-search-optimization agent-session ./your-site
|
|
687
730
|
geo-ai-search-optimization agent-runbook ./your-site
|
|
@@ -763,6 +806,22 @@ geo-ai-search-optimization help
|
|
|
763
806
|
- 输出 do-now checklist、stop checklist、success checklist、验证命令和回报模板
|
|
764
807
|
- 新增 `geo-ai-search-optimization-agent-executor` skill
|
|
765
808
|
|
|
809
|
+
## New in 1.2.20
|
|
810
|
+
|
|
811
|
+
- 新增 `agent-continue`
|
|
812
|
+
- 把 `agent-resume` 再推进成“继续这一轮并回写状态工件”的微闭环入口
|
|
813
|
+
- 输出 `continue_now`、`validate_after`、`update_artifacts`、`closeout_when_ready`、`report_back`
|
|
814
|
+
- `auto-flow`、`agent-session` 已能把 `playbook-pack / agent-resume / agent-continue` 统一接成继续链
|
|
815
|
+
- 新增 `geo-ai-search-optimization-agent-continue` skill
|
|
816
|
+
|
|
817
|
+
## New in 1.2.19
|
|
818
|
+
|
|
819
|
+
- 新增 `agent-resume`
|
|
820
|
+
- 把 `agent-orchestrator + agent-playbook-pack` 收敛成“从最近一个可靠恢复点继续”的恢复入口
|
|
821
|
+
- 输出 `resume_mode`、`resume_from`、`resume_command`、`verify_before_resume`、`do_not_reset`、`after_resume`
|
|
822
|
+
- `auto-flow`、`agent-session`、`skills` 已经把 `agent-resume` 视为正式恢复链路
|
|
823
|
+
- 新增 `geo-ai-search-optimization-agent-resume` skill
|
|
824
|
+
|
|
766
825
|
## New in 1.2.18
|
|
767
826
|
|
|
768
827
|
- 新增 `agent-orchestrator`
|
|
@@ -1009,6 +1068,8 @@ The installed package now includes a bundled GEO skill pack, including:
|
|
|
1009
1068
|
- `geo-ai-search-optimization`
|
|
1010
1069
|
- `geo-ai-search-optimization-auto-flow`
|
|
1011
1070
|
- `geo-ai-search-optimization-agent-orchestrator`
|
|
1071
|
+
- `geo-ai-search-optimization-agent-resume`
|
|
1072
|
+
- `geo-ai-search-optimization-agent-continue`
|
|
1012
1073
|
- `geo-ai-search-optimization-agent-session`
|
|
1013
1074
|
- `geo-ai-search-optimization-agent-runbook`
|
|
1014
1075
|
- `geo-ai-search-optimization-agent-executor`
|
package/package.json
CHANGED
|
@@ -42,6 +42,26 @@ Best for:
|
|
|
42
42
|
- returning a short contract with expected artifact, stop conditions, and follow-up command
|
|
43
43
|
- reducing ambiguity for PM-to-agent or agent-to-agent handoffs
|
|
44
44
|
|
|
45
|
+
### `geo-ai-search-optimization-agent-resume`
|
|
46
|
+
|
|
47
|
+
Use this when the next agent should continue from the latest reliable GEO checkpoint instead of restarting the whole chain.
|
|
48
|
+
|
|
49
|
+
Best for:
|
|
50
|
+
|
|
51
|
+
- resuming from a playbook pack, decision log, status board, checkpoint, or similar GEO artifact
|
|
52
|
+
- telling the next agent exactly where to continue and what not to reset
|
|
53
|
+
- turning a previously interrupted GEO chain into one resume command plus one follow-up command
|
|
54
|
+
|
|
55
|
+
### `geo-ai-search-optimization-agent-continue`
|
|
56
|
+
|
|
57
|
+
Use this when the next agent should not only resume, but also finish one execution round and immediately write the new state back into GEO artifacts.
|
|
58
|
+
|
|
59
|
+
Best for:
|
|
60
|
+
|
|
61
|
+
- continuing the current packet and then updating status-board, checkpoint, or decision-log style artifacts
|
|
62
|
+
- turning a resume point into a one-round execution loop
|
|
63
|
+
- giving the next agent one execution command, one validation set, and one writeback list
|
|
64
|
+
|
|
45
65
|
### `geo-ai-search-optimization-agent-session`
|
|
46
66
|
|
|
47
67
|
Use this when the next agent needs a runnable session plan, not just a routing answer.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-ai-search-optimization-agent-continue
|
|
3
|
+
description: Continue one GEO execution round from a reliable recovery point and write the new state back into GEO artifacts. Use when an agent, PM, or workflow already has a GEO resume point, playbook pack, decision log, status board, or similar artifact and needs the next execution command, validation steps, state writeback commands, and closeout path for this round.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GEO Agent Continue
|
|
7
|
+
|
|
8
|
+
Use this skill when the next agent should continue one round, not restart or over-plan.
|
|
9
|
+
|
|
10
|
+
`GEO = Generative Engine Optimization`
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
- turns a GEO resume point into one concrete execution round
|
|
15
|
+
- tells the next agent what to run now
|
|
16
|
+
- lists what to validate after the round
|
|
17
|
+
- shows which GEO status artifacts should be updated next
|
|
18
|
+
- keeps the round connected to closeout commands when the work is ready
|
|
19
|
+
|
|
20
|
+
## Best use
|
|
21
|
+
|
|
22
|
+
- when GEO work already has a current packet and should keep moving
|
|
23
|
+
- when the next agent must update status-board, checkpoint, or decision-log after execution
|
|
24
|
+
- when PM wants one clean “do this round, then write back state” artifact
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GEO Agent Continue"
|
|
3
|
+
short_description: "Continue one GEO round and write status back"
|
|
4
|
+
default_prompt: "Use $geo-ai-search-optimization-agent-continue to continue this GEO round from the latest reliable point, run the next execution command, validate the result, and list which GEO status artifacts must be updated afterward."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-ai-search-optimization-agent-resume
|
|
3
|
+
description: Resume a GEO workflow from the latest reliable point instead of restarting the whole chain. Use when an agent, PM, or another workflow has a GEO URL, codebase, playbook pack, decision log, status board, checkpoint, or related artifact and needs the exact resume command, pre-resume checks, and a clear list of what should not be reset.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GEO Agent Resume
|
|
7
|
+
|
|
8
|
+
Use this skill when the next agent should continue, not restart.
|
|
9
|
+
|
|
10
|
+
`GEO = Generative Engine Optimization`
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
- finds the latest reliable GEO recovery point
|
|
15
|
+
- tells the next agent which one command to resume now
|
|
16
|
+
- explains what to verify before resuming
|
|
17
|
+
- lists what should not be reset while continuing the chain
|
|
18
|
+
- keeps the agent aligned with the current packet, next packet, and follow-up command
|
|
19
|
+
|
|
20
|
+
## Best use
|
|
21
|
+
|
|
22
|
+
- when GEO work was interrupted and another agent needs to continue safely
|
|
23
|
+
- when PM wants to say "pick up from where the last agent left off"
|
|
24
|
+
- when there are already GEO artifacts and the risk is restarting the chain from the wrong place
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GEO Agent Resume"
|
|
3
|
+
short_description: "Resume GEO work from the latest reliable point"
|
|
4
|
+
default_prompt: "Use $geo-ai-search-optimization-agent-resume to continue this GEO workflow from the latest reliable checkpoint, identify the one resume command to run now, list what to verify first, and explain what must not be reset."
|
|
@@ -13,33 +13,35 @@ Treat this tool as a PM-friendly GEO workflow for websites.
|
|
|
13
13
|
|
|
14
14
|
`GEO = Generative Engine Optimization`
|
|
15
15
|
|
|
16
|
-
The package is best explained as twenty-
|
|
16
|
+
The package is best explained as twenty-seven layers:
|
|
17
17
|
|
|
18
18
|
1. `agent-orchestrator`: choose the one next GEO command to run right now
|
|
19
|
-
2. `
|
|
20
|
-
3. `agent-
|
|
21
|
-
4. `
|
|
22
|
-
5. `agent-
|
|
23
|
-
6. `agent-
|
|
24
|
-
7. `agent-
|
|
25
|
-
8. `agent-
|
|
26
|
-
9. `agent-
|
|
27
|
-
10. `agent-
|
|
28
|
-
11. `agent-
|
|
29
|
-
12. `agent-
|
|
30
|
-
13. `
|
|
31
|
-
14. `
|
|
32
|
-
15. `
|
|
33
|
-
16. `
|
|
34
|
-
17. `
|
|
35
|
-
18. `
|
|
36
|
-
19. `
|
|
37
|
-
20. `
|
|
38
|
-
21. `
|
|
39
|
-
22. `
|
|
40
|
-
23. `
|
|
41
|
-
24. `
|
|
42
|
-
25. `
|
|
19
|
+
2. `agent-resume`: resume from the latest reliable GEO checkpoint instead of restarting the whole chain
|
|
20
|
+
3. `agent-continue`: continue this round and write status artifacts back after execution
|
|
21
|
+
4. `auto-flow`: auto-select the next skill and command chain
|
|
22
|
+
5. `agent-session`: build a runnable session for the next agent
|
|
23
|
+
6. `agent-runbook`: execution manual and checklist for the next agent
|
|
24
|
+
7. `agent-executor`: choose one packet to execute right now
|
|
25
|
+
8. `agent-batch-executor`: queue the first few packets, but still advance one packet at a time
|
|
26
|
+
9. `agent-progress-tracker`: track which packet is done, which one is active, and what comes next
|
|
27
|
+
10. `agent-status-board`: turn the execution state into a board view for PM and agents
|
|
28
|
+
11. `agent-checkpoint`: freeze the current round into a continue / unblock / closeout decision
|
|
29
|
+
12. `agent-decision-log`: preserve why each round continued, paused, or closed out
|
|
30
|
+
13. `agent-retrospective`: explain multi-round patterns, lessons, and next-round advice
|
|
31
|
+
14. `agent-playbook-pack`: compress retrospective, decision history, and handoff into one resume entrypoint
|
|
32
|
+
15. `skills`: inspect the bundled skill package
|
|
33
|
+
16. `onboard-url` / `onboard`: first look
|
|
34
|
+
17. `scan`: raw signal check
|
|
35
|
+
18. `audit` / `report`: diagnosis
|
|
36
|
+
19. `fix-plan` / `owner-board`: execution planning
|
|
37
|
+
20. `agent-handoff`: agent takeover package
|
|
38
|
+
21. `apply-plan`: execution loop
|
|
39
|
+
22. `completion-report`: closeout
|
|
40
|
+
23. `handoff-bundle`: all-in-one package
|
|
41
|
+
24. `share-pack`: audience-ready delivery
|
|
42
|
+
25. `export-pack`: folder export
|
|
43
|
+
26. `html-pack` / `publish-pack`: browsable and final delivery output
|
|
44
|
+
27. `pm-brief` / `roadmap`: stakeholder alignment
|
|
43
45
|
|
|
44
46
|
## Recommended command order
|
|
45
47
|
|
|
@@ -47,6 +49,8 @@ If the user only has a website URL:
|
|
|
47
49
|
|
|
48
50
|
```bash
|
|
49
51
|
npx geo-ai-search-optimization agent-orchestrator https://example.com
|
|
52
|
+
npx geo-ai-search-optimization agent-resume https://example.com
|
|
53
|
+
npx geo-ai-search-optimization agent-continue https://example.com
|
|
50
54
|
npx geo-ai-search-optimization auto-flow https://example.com
|
|
51
55
|
npx geo-ai-search-optimization agent-session https://example.com
|
|
52
56
|
npx geo-ai-search-optimization agent-runbook https://example.com
|
|
@@ -67,6 +71,8 @@ If the user has the website codebase:
|
|
|
67
71
|
|
|
68
72
|
```bash
|
|
69
73
|
npx geo-ai-search-optimization agent-orchestrator ./your-site
|
|
74
|
+
npx geo-ai-search-optimization agent-resume ./your-site
|
|
75
|
+
npx geo-ai-search-optimization agent-continue ./your-site
|
|
70
76
|
npx geo-ai-search-optimization auto-flow ./your-site
|
|
71
77
|
npx geo-ai-search-optimization agent-session ./your-site
|
|
72
78
|
npx geo-ai-search-optimization agent-runbook ./your-site
|
|
@@ -96,6 +102,8 @@ npx geo-ai-search-optimization roadmap ./your-site
|
|
|
96
102
|
## When to recommend each command
|
|
97
103
|
|
|
98
104
|
- `agent-orchestrator`: choose the one next GEO command to run now, plus expected artifact, stop conditions, and follow-up command
|
|
105
|
+
- `agent-resume`: resume from the latest reliable checkpoint, confirm what not to reset, and tell the next agent the one resume command to run
|
|
106
|
+
- `agent-continue`: continue the current round, validate it, and tell the next agent which state artifacts to update right after execution
|
|
99
107
|
- `auto-flow`: auto-select the next skill and command order from a task brief, URL, project path, or GEO artifact
|
|
100
108
|
- `agent-session`: build a step-by-step session packet for the next agent from the same kinds of inputs
|
|
101
109
|
- `agent-runbook`: build a checklist-driven runbook with preflight, validation, and reporting rules
|
|
@@ -132,6 +140,8 @@ When explaining the tool to a user:
|
|
|
132
140
|
|
|
133
141
|
- prefer telling them which command to run next, not listing every command
|
|
134
142
|
- if the user or next agent wants just one next command, move them to `agent-orchestrator`
|
|
143
|
+
- if the user or next agent needs to continue from the latest reliable checkpoint without restarting, move them to `agent-resume`
|
|
144
|
+
- if the user or next agent needs one round of execution plus status writeback, move them to `agent-continue`
|
|
135
145
|
- if the user or the next agent is unsure where to start, move them to `auto-flow` first
|
|
136
146
|
- if the user wants something the next agent can follow step by step, move them to `agent-session`
|
|
137
147
|
- if the user wants the next agent to follow a checklist and execution manual, move them to `agent-runbook`
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { createAgentExecutor } from "./agent-executor.js";
|
|
2
|
+
import { createAgentResume } from "./agent-resume.js";
|
|
3
|
+
import { writeScanOutput } from "./scan.js";
|
|
4
|
+
|
|
5
|
+
const VALID_FORMATS = new Set(["markdown", "json"]);
|
|
6
|
+
|
|
7
|
+
function normalizeFormat(format) {
|
|
8
|
+
const resolved = (format || "markdown").toLowerCase();
|
|
9
|
+
if (!VALID_FORMATS.has(resolved)) {
|
|
10
|
+
throw new Error(`不支持的 agent-continue 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
|
|
11
|
+
}
|
|
12
|
+
return resolved;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function inferContinueMode(resume, executor) {
|
|
16
|
+
if (resume.resume_mode === "needs-context") {
|
|
17
|
+
return "needs-context";
|
|
18
|
+
}
|
|
19
|
+
if (
|
|
20
|
+
resume.resume_mode === "resume-closeout" ||
|
|
21
|
+
/\b(completion-report|meeting-pack|publish-pack)\b/.test(resume.resume_command || "")
|
|
22
|
+
) {
|
|
23
|
+
return "closeout-loop";
|
|
24
|
+
}
|
|
25
|
+
if (executor?.selectedPacket) {
|
|
26
|
+
return "single-packet-loop";
|
|
27
|
+
}
|
|
28
|
+
if (/\bagent-batch-executor\b/.test(resume.resume_command || "")) {
|
|
29
|
+
return "batch-loop";
|
|
30
|
+
}
|
|
31
|
+
if (/\b(agent-status-board|agent-progress-tracker|agent-checkpoint|agent-decision-log)\b/.test(resume.resume_command || "")) {
|
|
32
|
+
return "tracking-loop";
|
|
33
|
+
}
|
|
34
|
+
return "workflow-loop";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function tryCreateExecutor(resume) {
|
|
38
|
+
if (!resume?.source || !resume?.currentPacket?.id) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
return await createAgentExecutor(resume.source, {
|
|
44
|
+
format: "json",
|
|
45
|
+
taskId: resume.currentPacket.id
|
|
46
|
+
});
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function buildContinueNow(resume, executor) {
|
|
53
|
+
if (executor?.selectedPacket) {
|
|
54
|
+
return `geo-ai-search-optimization agent-executor ${resume.source} --task ${executor.selectedPacket.id}`;
|
|
55
|
+
}
|
|
56
|
+
return resume.resume_command;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function buildContinueSummary(mode, resume, executor) {
|
|
60
|
+
if (mode === "needs-context") {
|
|
61
|
+
return "当前还缺恢复所需上下文,先补网址、目录或 GEO 工件,再继续这一轮。";
|
|
62
|
+
}
|
|
63
|
+
if (mode === "closeout-loop") {
|
|
64
|
+
return "当前最稳的继续方式是进入收尾与交付,不要重新打开新的执行包。";
|
|
65
|
+
}
|
|
66
|
+
if (mode === "single-packet-loop" && executor?.selectedPacket) {
|
|
67
|
+
return `这一轮先把 ${executor.selectedPacket.id} 做完,完成后马上回写状态与决策工件。`;
|
|
68
|
+
}
|
|
69
|
+
if (mode === "batch-loop") {
|
|
70
|
+
return "当前适合沿着批次继续,但每次仍然只推进一包,再更新状态。";
|
|
71
|
+
}
|
|
72
|
+
if (mode === "tracking-loop") {
|
|
73
|
+
return "当前更适合先校准状态,再决定是否进入下一包或收尾。";
|
|
74
|
+
}
|
|
75
|
+
return "当前应先按既有恢复命令继续,再根据结果更新状态,不要重新规划整条链。";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function buildDoNowChecklist(mode, resume, executor, continueNow) {
|
|
79
|
+
if (mode === "needs-context") {
|
|
80
|
+
return [...resume.contextNeeded];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (executor?.selectedPacket) {
|
|
84
|
+
return Array.from(
|
|
85
|
+
new Set([
|
|
86
|
+
...executor.doNowChecklist,
|
|
87
|
+
"完成这一包后,立刻更新状态看板和决策历史,不要只做代码动作不回写工件。"
|
|
88
|
+
])
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const items = [`先运行:${continueNow}`];
|
|
93
|
+
if (resume.currentPacket) {
|
|
94
|
+
items.push(`继续围绕当前包 ${resume.currentPacket.id} 推进,不要中途切到别的包。`);
|
|
95
|
+
}
|
|
96
|
+
if (resume.after_resume) {
|
|
97
|
+
items.push(`这一步完成后,继续运行:${resume.after_resume}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return items;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function buildValidateAfter(mode, resume, executor) {
|
|
104
|
+
if (mode === "needs-context") {
|
|
105
|
+
return ["确认已经拿到网址、目录或 GEO JSON 工件,再重新进入继续链。"];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (executor?.validationCommands?.length) {
|
|
109
|
+
return Array.from(new Set(executor.validationCommands));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const items = [];
|
|
113
|
+
if (resume.expected_artifact) {
|
|
114
|
+
items.push(`确认这一步真的产出了:${resume.expected_artifact}`);
|
|
115
|
+
}
|
|
116
|
+
if (mode === "closeout-loop") {
|
|
117
|
+
items.push("确认收尾输出里已经明确写出:已完成、未完成、待验证、下一轮任务。");
|
|
118
|
+
} else {
|
|
119
|
+
items.push("确认这一步没有把恢复链跑偏,也没有跳过当前包。");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return items;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function buildUpdateArtifacts(mode, resume) {
|
|
126
|
+
if (mode === "needs-context" || !resume.source) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (mode === "closeout-loop") {
|
|
131
|
+
return [
|
|
132
|
+
`geo-ai-search-optimization completion-report ${resume.source}`,
|
|
133
|
+
`geo-ai-search-optimization meeting-pack ${resume.source}`,
|
|
134
|
+
`geo-ai-search-optimization publish-pack ${resume.source}`
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return [
|
|
139
|
+
`geo-ai-search-optimization agent-status-board ${resume.source}`,
|
|
140
|
+
`geo-ai-search-optimization agent-checkpoint ${resume.source}`,
|
|
141
|
+
`geo-ai-search-optimization agent-decision-log ${resume.source}`
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function buildCloseoutWhenReady(resume) {
|
|
146
|
+
if (!resume.source) {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return [
|
|
151
|
+
`geo-ai-search-optimization completion-report ${resume.source}`,
|
|
152
|
+
`geo-ai-search-optimization handoff-bundle ${resume.source}`,
|
|
153
|
+
`geo-ai-search-optimization publish-pack ${resume.source}`
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function buildReportBack(mode, executor) {
|
|
158
|
+
if (executor?.userReplyTemplate) {
|
|
159
|
+
return executor.userReplyTemplate;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (mode === "closeout-loop") {
|
|
163
|
+
return [
|
|
164
|
+
"这轮我已经进入收尾阶段。",
|
|
165
|
+
"我整理了什么:",
|
|
166
|
+
"- ",
|
|
167
|
+
"我确认了哪些剩余风险:",
|
|
168
|
+
"- ",
|
|
169
|
+
"下一轮建议:",
|
|
170
|
+
"- "
|
|
171
|
+
].join("\n");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return [
|
|
175
|
+
"这轮我已经从最近一个可靠恢复点继续。",
|
|
176
|
+
"我先做了什么:",
|
|
177
|
+
"- ",
|
|
178
|
+
"我验证了什么:",
|
|
179
|
+
"- ",
|
|
180
|
+
"我接着更新了哪些状态工件:",
|
|
181
|
+
"- ",
|
|
182
|
+
"下一步:",
|
|
183
|
+
"- "
|
|
184
|
+
].join("\n");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function buildContinuePrompt(artifact) {
|
|
188
|
+
const lines = [
|
|
189
|
+
"你现在进入 GEO Agent Continue 模式。",
|
|
190
|
+
`当前输入:${artifact.source}`,
|
|
191
|
+
`继续模式:${artifact.continue_mode}`,
|
|
192
|
+
`继续摘要:${artifact.continue_summary}`,
|
|
193
|
+
`现在先执行:${artifact.continue_now || "先补上下文"}`
|
|
194
|
+
];
|
|
195
|
+
|
|
196
|
+
if (artifact.currentPacket) {
|
|
197
|
+
lines.push(`当前包:${artifact.currentPacket.id}|${artifact.currentPacket.title}`);
|
|
198
|
+
}
|
|
199
|
+
if (artifact.nextPacket) {
|
|
200
|
+
lines.push(`下一包:${artifact.nextPacket.id}|${artifact.nextPacket.title}`);
|
|
201
|
+
}
|
|
202
|
+
if (artifact.validate_after.length > 0) {
|
|
203
|
+
lines.push("执行后先验证:");
|
|
204
|
+
for (const item of artifact.validate_after) {
|
|
205
|
+
lines.push(`- ${item}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (artifact.update_artifacts.length > 0) {
|
|
209
|
+
lines.push("完成这轮后更新这些工件:");
|
|
210
|
+
for (const item of artifact.update_artifacts) {
|
|
211
|
+
lines.push(`- ${item}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
lines.push("不要重新规划整条链。先继续这一轮,再回写状态与决策。");
|
|
216
|
+
return lines.join("\n");
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export async function createAgentContinue(input, options = {}) {
|
|
220
|
+
const format = normalizeFormat(options.format);
|
|
221
|
+
const resume = await createAgentResume(input, {
|
|
222
|
+
format: "json",
|
|
223
|
+
intent: options.intent
|
|
224
|
+
});
|
|
225
|
+
const executor = await tryCreateExecutor(resume);
|
|
226
|
+
const continueMode = inferContinueMode(resume, executor);
|
|
227
|
+
const continueNow = buildContinueNow(resume, executor);
|
|
228
|
+
|
|
229
|
+
const artifact = {
|
|
230
|
+
kind: "geo-agent-continue",
|
|
231
|
+
input,
|
|
232
|
+
source: resume.source,
|
|
233
|
+
sourceType: resume.sourceType,
|
|
234
|
+
artifactKind: resume.kind,
|
|
235
|
+
format,
|
|
236
|
+
continue_mode: continueMode,
|
|
237
|
+
continue_summary: buildContinueSummary(continueMode, resume, executor),
|
|
238
|
+
continue_now: continueNow,
|
|
239
|
+
currentPacket: executor?.selectedPacket || resume.currentPacket || null,
|
|
240
|
+
nextPacket: resume.nextPacket || null,
|
|
241
|
+
do_now_checklist: buildDoNowChecklist(continueMode, resume, executor, continueNow),
|
|
242
|
+
validate_after: buildValidateAfter(continueMode, resume, executor),
|
|
243
|
+
update_artifacts: buildUpdateArtifacts(continueMode, resume),
|
|
244
|
+
closeout_when_ready: buildCloseoutWhenReady(resume),
|
|
245
|
+
do_not_restart: resume.do_not_reset,
|
|
246
|
+
report_back: buildReportBack(continueMode, executor),
|
|
247
|
+
selectedSkill: {
|
|
248
|
+
name: "geo-ai-search-optimization-agent-continue",
|
|
249
|
+
displayName: "GEO Agent Continue",
|
|
250
|
+
shortDescription: "Continue one GEO round and write status back"
|
|
251
|
+
},
|
|
252
|
+
resume,
|
|
253
|
+
executor,
|
|
254
|
+
continue_prompt: ""
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
artifact.continue_prompt = buildContinuePrompt(artifact);
|
|
258
|
+
return artifact;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function renderAgentContinueMarkdown(artifact) {
|
|
262
|
+
const lines = [
|
|
263
|
+
"# GEO Agent Continue",
|
|
264
|
+
"",
|
|
265
|
+
`- 输入:\`${artifact.source}\``,
|
|
266
|
+
`- 输入类型:\`${artifact.sourceType}\``,
|
|
267
|
+
`- 继续模式:\`${artifact.continue_mode}\``,
|
|
268
|
+
`- 当前建议 skill:\`${artifact.selectedSkill.name}\``,
|
|
269
|
+
"",
|
|
270
|
+
"## 这一轮怎么继续",
|
|
271
|
+
"",
|
|
272
|
+
`- ${artifact.continue_summary}`,
|
|
273
|
+
`- 现在先执行:\`${artifact.continue_now || "先补上下文"}\``
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
if (artifact.currentPacket) {
|
|
277
|
+
lines.push("", "## 当前包", "", `- ${artifact.currentPacket.id}|${artifact.currentPacket.title}`);
|
|
278
|
+
}
|
|
279
|
+
if (artifact.nextPacket) {
|
|
280
|
+
lines.push("", "## 下一包", "", `- ${artifact.nextPacket.id}|${artifact.nextPacket.title}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
lines.push("", "## 现在先做什么", "");
|
|
284
|
+
for (const item of artifact.do_now_checklist) {
|
|
285
|
+
lines.push(`- ${item}`);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
lines.push("", "## 执行后先验证", "");
|
|
289
|
+
for (const item of artifact.validate_after) {
|
|
290
|
+
lines.push(`- ${item}`);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
lines.push("", "## 这轮完成后更新哪些工件", "");
|
|
294
|
+
for (const item of artifact.update_artifacts) {
|
|
295
|
+
lines.push(`- \`${item}\``);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
lines.push("", "## 可以进入收尾时跑什么", "");
|
|
299
|
+
for (const item of artifact.closeout_when_ready) {
|
|
300
|
+
lines.push(`- \`${item}\``);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
lines.push("", "## 不要重启整条链", "");
|
|
304
|
+
for (const item of artifact.do_not_restart) {
|
|
305
|
+
lines.push(`- ${item}`);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
lines.push("", "## 回报模板", "", "```text", artifact.report_back, "```");
|
|
309
|
+
lines.push("", "## 可直接复制给 Agent 的 Continue Prompt", "", "```text", artifact.continue_prompt, "```");
|
|
310
|
+
|
|
311
|
+
return `${lines.join("\n")}\n`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export async function writeAgentContinueOutput(outputPath, content) {
|
|
315
|
+
return writeScanOutput(outputPath, content);
|
|
316
|
+
}
|