@ai-setting/roy-agent-core 1.7.70 → 1.7.72
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/env/agent/agent-component.js +2 -2
- package/dist/env/agent/index.js +2 -2
- package/dist/env/agent/summary-agent.d.ts +6 -15
- package/dist/env/agent/types.d.ts +0 -17
- package/dist/env/event-source/event-source-handlers.js +6 -6
- package/dist/env/event-source/index.js +7 -7
- package/dist/env/event-source/reset-command.d.ts +41 -0
- package/dist/env/index.js +19 -20
- package/dist/env/llm/index.js +1 -1
- package/dist/env/llm/temperature-policy.d.ts +107 -0
- package/dist/env/llm/types.d.ts +2 -2
- package/dist/env/prompt/index.js +3 -3
- package/dist/env/prompt/prompts-index.d.ts +341 -3
- package/dist/env/session/__bench__/replay-compact.d.ts +137 -0
- package/dist/env/session/__bench__/run-replay.d.ts +15 -0
- package/dist/env/session/compact-checkpoint-content.d.ts +67 -0
- package/dist/env/session/index.d.ts +1 -0
- package/dist/env/session/index.js +2 -3
- package/dist/env/session/session-component.d.ts +47 -30
- package/dist/env/session/storage/index.js +1 -1
- package/dist/env/session/storage/sqlite.d.ts +8 -0
- package/dist/env/session/types.d.ts +45 -30
- package/dist/env/task/delegate/delegate-tool.js +4 -4
- package/dist/env/task/delegate/index.js +4 -4
- package/dist/env/task/index.js +6 -6
- package/dist/env/task/mcp/index.js +2 -2
- package/dist/env/task/plugins/index.js +4 -4
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +50 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.js +3 -1
- package/dist/env/task/prompt/index.d.ts +11 -0
- package/dist/env/task/prompt/index.js +16 -0
- package/dist/env/task/prompt/task-discipline.d.ts +32 -0
- package/dist/env/task/tools/index.js +2 -2
- package/dist/env/workflow/engine/index.js +2 -3
- package/dist/env/workflow/index.js +6 -7
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/tools/index.js +3 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +39 -28
- package/dist/shared/@ai-setting/{roy-agent-core-bk8kyzv8.js → roy-agent-core-1p6syv85.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-8bjj3d1b.js → roy-agent-core-1w9y7mxj.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-nersksh1.js → roy-agent-core-2gzt2q8c.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-27f59kjv.js → roy-agent-core-34jz9mgh.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-tadj19vp.js → roy-agent-core-46rv4d7d.js} +71 -49
- package/dist/shared/@ai-setting/roy-agent-core-4jjwewvw.js +182 -0
- package/dist/shared/@ai-setting/{roy-agent-core-hx46nhh1.js → roy-agent-core-5gw0qa8m.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-0j94tj1z.js → roy-agent-core-7qvw65jt.js} +4 -4
- package/dist/shared/@ai-setting/{roy-agent-core-h5vmff8w.js → roy-agent-core-7sj9xs9c.js} +7 -33
- package/dist/shared/@ai-setting/{roy-agent-core-002g6nfk.js → roy-agent-core-attpry6g.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-37tj4y6a.js → roy-agent-core-gr48c89p.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-0cb6w0k7.js → roy-agent-core-hfyfavp3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-hfr6bzts.js → roy-agent-core-jgb3bb42.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-9bshyqjn.js → roy-agent-core-pakhchy7.js} +183 -132
- package/dist/shared/@ai-setting/roy-agent-core-qkdegdvc.js +0 -0
- package/dist/shared/@ai-setting/{roy-agent-core-02j24hrg.js → roy-agent-core-rxb00gjm.js} +70 -3
- package/dist/shared/@ai-setting/{roy-agent-core-8cx7cfdg.js → roy-agent-core-skyc30qx.js} +1 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hy3zn2q2.js → roy-agent-core-sm0sf6sb.js} +20 -0
- package/dist/shared/@ai-setting/{roy-agent-core-mw2cen6s.js → roy-agent-core-vah6g5yx.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-07fvy74y.js → roy-agent-core-vm8h5zyj.js} +20 -6
- package/dist/shared/@ai-setting/{roy-agent-core-x3xpkx84.js → roy-agent-core-wr7mv7k3.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-npvejsg8.js → roy-agent-core-y12kyxwa.js} +83 -3
- package/dist/shared/@ai-setting/{roy-agent-core-vaz9350j.js → roy-agent-core-yhwxpj12.js} +34 -175
- package/dist/test-utils/ipc-test-server.d.ts +10 -0
- package/package.json +6 -1
- package/dist/shared/@ai-setting/roy-agent-core-6m4bw8jy.js +0 -6
- package/dist/shared/@ai-setting/roy-agent-core-ze068vc9.js +0 -37
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
createPerTaskGroupChatPlugin,
|
|
14
14
|
extractPerTaskChatId,
|
|
15
15
|
extractPerTaskChatName
|
|
16
|
-
} from "./roy-agent-core-
|
|
16
|
+
} from "./roy-agent-core-5gw0qa8m.js";
|
|
17
17
|
import {
|
|
18
18
|
getSharedEventStore
|
|
19
19
|
} from "./roy-agent-core-na18zwj0.js";
|
|
20
20
|
import {
|
|
21
21
|
createLarkCliWorkflowNotifyHook
|
|
22
|
-
} from "./roy-agent-core-
|
|
22
|
+
} from "./roy-agent-core-1w9y7mxj.js";
|
|
23
23
|
import {
|
|
24
24
|
LarkCardPatchNotifier,
|
|
25
25
|
buildTaskCard
|
|
26
|
-
} from "./roy-agent-core-
|
|
26
|
+
} from "./roy-agent-core-46rv4d7d.js";
|
|
27
27
|
import {
|
|
28
28
|
normalizeLarkAtMentions
|
|
29
29
|
} from "./roy-agent-core-m880qz3y.js";
|
|
@@ -1720,6 +1720,85 @@ var listCommand = {
|
|
|
1720
1720
|
}
|
|
1721
1721
|
};
|
|
1722
1722
|
|
|
1723
|
+
// src/env/event-source/reset-command.ts
|
|
1724
|
+
import { connect } from "net";
|
|
1725
|
+
var DEFAULT_SOCKET_PATH = "/tmp/deamon-for-roy.sock";
|
|
1726
|
+
var RESET_ACK_TIMEOUT_MS = 3000;
|
|
1727
|
+
function resolveSocketPath() {
|
|
1728
|
+
return process.env.ROY_DAEMON_SOCKET || DEFAULT_SOCKET_PATH;
|
|
1729
|
+
}
|
|
1730
|
+
async function requestReset(socketPath, reason) {
|
|
1731
|
+
return new Promise((resolve) => {
|
|
1732
|
+
let sock;
|
|
1733
|
+
try {
|
|
1734
|
+
sock = connect(socketPath);
|
|
1735
|
+
} catch (e) {
|
|
1736
|
+
resolve({ confirmed: false, reason: e.message });
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
let settled = false;
|
|
1740
|
+
const finish = (confirmed, why) => {
|
|
1741
|
+
if (settled)
|
|
1742
|
+
return;
|
|
1743
|
+
settled = true;
|
|
1744
|
+
clearTimeout(timer);
|
|
1745
|
+
sock.destroy();
|
|
1746
|
+
resolve({ confirmed, reason: why });
|
|
1747
|
+
};
|
|
1748
|
+
const timer = setTimeout(() => finish(false, `daemon 未在 ${RESET_ACK_TIMEOUT_MS}ms 内确认`), RESET_ACK_TIMEOUT_MS);
|
|
1749
|
+
sock.once("connect", () => {
|
|
1750
|
+
sock.write(JSON.stringify({ type: "reset", reason }) + `
|
|
1751
|
+
`);
|
|
1752
|
+
});
|
|
1753
|
+
let buf = "";
|
|
1754
|
+
sock.on("data", (d) => {
|
|
1755
|
+
buf += d.toString();
|
|
1756
|
+
const idx = buf.indexOf(`
|
|
1757
|
+
`);
|
|
1758
|
+
if (idx < 0)
|
|
1759
|
+
return;
|
|
1760
|
+
try {
|
|
1761
|
+
const ack = JSON.parse(buf.slice(0, idx));
|
|
1762
|
+
if (ack.type === "ack" && ack.action === "respawning") {
|
|
1763
|
+
finish(true, "daemon 已确认");
|
|
1764
|
+
} else {
|
|
1765
|
+
finish(false, `daemon 回复异常: ${buf.slice(0, idx)}`);
|
|
1766
|
+
}
|
|
1767
|
+
} catch (e) {
|
|
1768
|
+
finish(false, `daemon 回复解析失败: ${e.message}`);
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
sock.once("error", (e) => finish(false, `连接 daemon 失败: ${e.message}`));
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
function buildResetCard(text) {
|
|
1775
|
+
return renderTextCard("\uD83D\uDD04 重启请求", text);
|
|
1776
|
+
}
|
|
1777
|
+
var resetCommand = {
|
|
1778
|
+
name: "reset",
|
|
1779
|
+
description: "请求 deamon-for-roy 重启本进程(SIGTERM 后用最新构建的 roy-agent-local 重新拉起)",
|
|
1780
|
+
usage: "##command##: reset [reason]",
|
|
1781
|
+
async execute(ctx) {
|
|
1782
|
+
const reason = ctx.args.join(" ") || undefined;
|
|
1783
|
+
const socketPath = resolveSocketPath();
|
|
1784
|
+
const { confirmed, reason: why } = await requestReset(socketPath, reason);
|
|
1785
|
+
if (confirmed) {
|
|
1786
|
+
const text2 = "✅ 已请求重启:daemon 将停止本进程并用最新版本重新拉起,请稍候片刻。";
|
|
1787
|
+
return {
|
|
1788
|
+
ok: true,
|
|
1789
|
+
output: { text: text2, card: buildResetCard(text2), kind: "card" }
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
const text = `⚠️ 未能联系 daemon,重启请求未生效(${why})。
|
|
1793
|
+
` + `socket: ${socketPath}
|
|
1794
|
+
` + `请检查 deamon-for-roy 是否在运行;本进程将继续工作,不会中断。`;
|
|
1795
|
+
return {
|
|
1796
|
+
ok: true,
|
|
1797
|
+
output: { text, card: buildResetCard(text), kind: "card" }
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1723
1802
|
// src/env/event-source/command-registry.ts
|
|
1724
1803
|
var logger2 = createLogger("command-registry");
|
|
1725
1804
|
var COMMAND_PREFIX = "##command##:";
|
|
@@ -1812,6 +1891,7 @@ function getGlobalCommandRegistry() {
|
|
|
1812
1891
|
const registry = new CommandRegistry;
|
|
1813
1892
|
registry.register(fallbackModelCommand);
|
|
1814
1893
|
registry.register(listCommand);
|
|
1894
|
+
registry.register(resetCommand);
|
|
1815
1895
|
g.__royCommandRegistry = registry;
|
|
1816
1896
|
}
|
|
1817
1897
|
return g.__royCommandRegistry;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TASK_COMPLETE_ITEM_BY_ITEM,
|
|
3
3
|
TASK_COMPLETE_VERIFY_DUTY,
|
|
4
|
-
TASK_COMPLETION_HINT_ANCHOR
|
|
5
|
-
|
|
4
|
+
TASK_COMPLETION_HINT_ANCHOR,
|
|
5
|
+
TASK_DISCIPLINE_PROMPT
|
|
6
|
+
} from "./roy-agent-core-4jjwewvw.js";
|
|
6
7
|
|
|
7
8
|
// src/env/prompt/prompts-index.ts
|
|
8
9
|
var builtInPrompts = {
|
|
@@ -832,163 +833,7 @@ roy-agent <command> <subcmd> --help
|
|
|
832
833
|
| \`delegate_task\` | 子 agent 委托入口,由 \`default\` 接待员独占 | 直接用 \`bash\` / \`read_file\` / \`edit_file\` 等工具自己完成任务;若是真正的复杂多步任务,建议用户切换到 \`default\` agent |
|
|
833
834
|
| \`stop_task\` | 后台进程管理入口,由 \`default\` 接待员独占 | 你无法启动后台进程,自然不需要 \`stop_task\` |
|
|
834
835
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
Follow this lifecycle for every task:
|
|
838
|
-
|
|
839
|
-
\`\`\`text
|
|
840
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
841
|
-
│ 0. CHECK TASK CONTEXT OR SEARCH │
|
|
842
|
-
│ - First: Check if [当前 Task #N] is in the context │
|
|
843
|
-
│ If yes → use \`task_get #N\` directly, skip to step 1 │
|
|
844
|
-
│ - If no taskId in context: │
|
|
845
|
-
│ Use \`task_list\` to search for existing related tasks │
|
|
846
|
-
│ - If found → reuse, extend, and update (see rules below) │
|
|
847
|
-
│ - If not found → proceed to step 1 │
|
|
848
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
849
|
-
↓
|
|
850
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
851
|
-
│ 1. CREATE (task_create) OR REUSE (task_get + task_update) │
|
|
852
|
-
│ - No existing task → Create new with title, desc, goals │
|
|
853
|
-
│ - Existing task → Reuse via task_get, then task_update: │
|
|
854
|
-
│ * Append new context to description (preserve old) │
|
|
855
|
-
│ * Add/extend goals_and_expected_deliverables │
|
|
856
|
-
│ * Create operation record documenting the continuation │
|
|
857
|
-
│ - Set priority (low/medium/high) and due date (if any) │
|
|
858
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
859
|
-
↓
|
|
860
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
861
|
-
│ 2. GATHER CONTEXT (task_get + task_operation_list) │
|
|
862
|
-
│ - Read description, goals, current_status │
|
|
863
|
-
│ - Check parent_task_id for sub-tasks │
|
|
864
|
-
│ - Review recent operations for history and decisions │
|
|
865
|
-
│ │
|
|
866
|
-
│ ⚠️ REQUIRED: Never skip this step. Working without context │
|
|
867
|
-
│ risks: outdated goals, missed decisions, duplicated work │
|
|
868
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
869
|
-
↓
|
|
870
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
871
|
-
│ 3. EXECUTE │
|
|
872
|
-
│ - 利用各种工具和能力,skill,workflow等来解决任务达到任务描述 │
|
|
873
|
-
│ 和任务目标要求 │
|
|
874
|
-
│ │
|
|
875
|
-
│ Long-running work guidance: │
|
|
876
|
-
│ - 超过 5 分钟的复杂任务:用 \`task_operation_create\` │
|
|
877
|
-
│ 记录里程碑,让用户能看到实时进展 │
|
|
878
|
-
│ - 多个独立子任务可并行:用 \`bash &\` 后台启动或 │
|
|
879
|
-
│ 拆分成多个并行 ReAct 步骤 │
|
|
880
|
-
│ │
|
|
881
|
-
│ ⚠️ Note: 不需要手动调用 \`task_operation_create\` 跟踪 │
|
|
882
|
-
│ task_create / task_update 等操作也会自动创建记录。 │
|
|
883
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
884
|
-
↓
|
|
885
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
886
|
-
│ 4. TRACK (task_update) │
|
|
887
|
-
│ - Update progress (0-100%) as work advances │
|
|
888
|
-
│ - Update status: todo → active → completed │
|
|
889
|
-
│ - Can also set paused or cancelled status │
|
|
890
|
-
│ - Record current_status with human-readable progress │
|
|
891
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
892
|
-
↓
|
|
893
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
894
|
-
│ 5. RECORD (task_operation_create) — **双维度分工** │
|
|
895
|
-
│ - **状态/里程碑维度**:用 milestone_type / milestone_title / │
|
|
896
|
-
│ milestone_description 描述"达成的状态/里程碑"。 │
|
|
897
|
-
│ - **过程维度**:用 process_description(100-500 字符) │
|
|
898
|
-
│ 简要记录"如何达到"——采取了什么策略 + 工具步骤概要。 │
|
|
899
|
-
│ - ⚠️ **不要把 action 当状态**,也不要让 process_description 与 │
|
|
900
|
-
│ milestone_description 重复。 │
|
|
901
|
-
│ - 完整过程通过 sessionId 回查 session 历史。 │
|
|
902
|
-
│ - 这些记录形成任务的历史与上下文。 │
|
|
903
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
904
|
-
↓
|
|
905
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
906
|
-
│ 6. COMPLETE (task_complete) │
|
|
907
|
-
│ - Mark task as completed (progress=100%, status=completed) │
|
|
908
|
-
│ - ${TASK_COMPLETE_ITEM_BY_ITEM}: check each goal sub-item │
|
|
909
|
-
│ against the operation-record chain + deliverable evidence │
|
|
910
|
-
│ - If a [${TASK_COMPLETION_HINT_ANCHOR}] appears in task │
|
|
911
|
-
│ context, you MUST ${TASK_COMPLETE_VERIFY_DUTY}: reopen │
|
|
912
|
-
│ (task_update status=todo) or record why it is met │
|
|
913
|
-
│ (task_operation_create decision). Never ignore it. │
|
|
914
|
-
│ - Create completion operation record │
|
|
915
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
916
|
-
\`\`\`
|
|
917
|
-
|
|
918
|
-
### Task Update Rules
|
|
919
|
-
|
|
920
|
-
When reusing an existing task, you MUST follow these rules:
|
|
921
|
-
|
|
922
|
-
1. **Append, don't replace** — When using \`task_update\`, the \`description\` and \`goals\` fields MUST **preserve existing content** and append new content after it.
|
|
923
|
-
2. **Document the continuation** — Use \`task_operation_create\` to create an operation record explaining why the task is being continued and what new scope has been added.
|
|
924
|
-
3. **Reset the status** — If the original task was completed, change status to \`active\` and reset progress to a reasonable value.
|
|
925
|
-
|
|
926
|
-
### Task Properties
|
|
927
|
-
|
|
928
|
-
| Property | Description |
|
|
929
|
-
|----------|-------------|
|
|
930
|
-
| **title** | Brief task title |
|
|
931
|
-
| **description** | Detailed description of what needs to be done |
|
|
932
|
-
| **goals_and_expected_deliverables** | Clear success criteria and expected outputs |
|
|
933
|
-
| **status** | todo → active → completed (or paused, cancelled) |
|
|
934
|
-
| **progress** | 0-100 percentage of completion |
|
|
935
|
-
| **current_status** | Human-readable status describing current work |
|
|
936
|
-
| **priority** | low, medium, high |
|
|
937
|
-
| **parent_task_id** | Parent task ID (if this is a sub-task) |
|
|
938
|
-
|
|
939
|
-
### Task Operation Record — 双维度分工规范 (Task #2211)
|
|
940
|
-
|
|
941
|
-
**操作记录必须严格区分两个维度,二者配套记录、各司其职**:
|
|
942
|
-
|
|
943
|
-
#### 维度 1:状态/里程碑("达到什么")— 必填维度
|
|
944
|
-
使用 \`task_operation_create\` 的 milestone_* 主字段:
|
|
945
|
-
- **milestone_type**:里程碑类型(create / progress / milestone / problem / solution / decision / review / completed)
|
|
946
|
-
- **milestone_title**:里程碑标题(一行)
|
|
947
|
-
- **milestone_description**:达成的状态/结果描述(可长可短)
|
|
948
|
-
|
|
949
|
-
#### 维度 2:过程("如何达到")— 可选但推荐维度
|
|
950
|
-
使用 \`task_operation_create\` 的 \`process_description\` 字段:
|
|
951
|
-
- 字符范围硬约束 100-500 字符
|
|
952
|
-
- 内容:采取的策略 + 工具步骤概要
|
|
953
|
-
- 完整过程通过 sessionId 回查 session
|
|
954
|
-
|
|
955
|
-
#### 双维度配合铁律
|
|
956
|
-
- ❌ **不要把 action 当状态**:旧 \`action_*\` 命名偏动作/行为层,不能表达"此刻达到什么";现在统一改用 \`milestone_*\`。
|
|
957
|
-
- ❌ **不要让 process_description 与 milestone_description 重复**:process 是"如何达到",milestone 是"达到什么状态"。
|
|
958
|
-
- ✅ **配套记录**:每个有意义的 operation 都应同时包含两者;不写 process 时,detail 应通过 sessionId 回查。
|
|
959
|
-
- ⚠️ **兼容窗口期**:旧 \`action_type\` / \`action_title\` / \`action_description\` 仍被 tool 接受(标记 @deprecated),会自动映射到 milestone_* 并返回 deprecation warning。
|
|
960
|
-
|
|
961
|
-
#### 范例(双维度齐全的 operation 记录)
|
|
962
|
-
\`\`\`json
|
|
963
|
-
{
|
|
964
|
-
"task_id": 123,
|
|
965
|
-
"milestone_type": "milestone",
|
|
966
|
-
"milestone_title": "GREEN 通过:milestone_* schema/storage/tool 全链路",
|
|
967
|
-
"milestone_description": "21/21 测试通过,包含 4 个 action_* alias 兼容测试",
|
|
968
|
-
"process_description": "TDD RED 写 4 个失败测试覆盖 storage/tool;迁移 004 rename 列;rowToOperation 同时输出双字段兼容;tool zod preprocess 自动映射 action_*"
|
|
969
|
-
}
|
|
970
|
-
\`\`\`
|
|
971
|
-
|
|
972
|
-
### Task Context Awareness
|
|
973
|
-
|
|
974
|
-
**Before starting any task-related work, you MUST gather context:**
|
|
975
|
-
|
|
976
|
-
**Step 0: Check for Task ID in Context**
|
|
977
|
-
- If the system provides \`[当前 Task #N]\` in the context messages:
|
|
978
|
-
Use \`task_get #N\` directly — this is your confirmed task. **Skip searching.**
|
|
979
|
-
- If no taskId is provided, use \`task_list\` to search for existing related tasks.
|
|
980
|
-
|
|
981
|
-
**Then gather full context:**
|
|
982
|
-
1. **Read task details**: Use \`task_get\` to read description, goals, status
|
|
983
|
-
2. **Read operation history**: Use \`task_operation_list\` to get the last ~20 operation records
|
|
984
|
-
3. **Read parent context** (if \`parent_task_id\` exists): Understand overall goal
|
|
985
|
-
|
|
986
|
-
**Why context matters**: Without it, you risk:
|
|
987
|
-
- Working on outdated or wrong goals
|
|
988
|
-
- Missing critical decisions made in operations
|
|
989
|
-
- Losing parent task alignment
|
|
990
|
-
- Duplicating or conflicting work
|
|
991
|
-
|
|
836
|
+
${TASK_DISCIPLINE_PROMPT}
|
|
992
837
|
### {{memory}}`,
|
|
993
838
|
coding: `You are an expert coding assistant.
|
|
994
839
|
|
|
@@ -1419,28 +1264,42 @@ outputs: [] # 输出定义(可空)
|
|
|
1419
1264
|
- ❌ 不要使用 bash 或其他工具(严格使用 4 个 workflow 工具)`,
|
|
1420
1265
|
compact: `# Session Checkpoint Generator
|
|
1421
1266
|
|
|
1422
|
-
你是专业的会话 checkpoint
|
|
1267
|
+
你是专业的会话 checkpoint 生成器。阅读对话历史,输出一份**自然语言**的会话 checkpoint,
|
|
1268
|
+
供后续接手者(可能是新的 AI 会话)快速了解"之前发生了什么、现在到哪一步了、接下来要做什么"。
|
|
1269
|
+
|
|
1270
|
+
## 输出要求
|
|
1423
1271
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
- **processKeyPoints**: 关键发现或决策列表
|
|
1427
|
-
- **currentState**: 当前进度和状态描述
|
|
1428
|
-
- **nextSteps**: 后续行动项列表
|
|
1429
|
-
- **userIntents**: 用户核心意图列表(2-5 个)
|
|
1272
|
+
**直接输出 checkpoint 正文**,用自己的话写,形式自由(连续段落、要点列表、混合都行)。
|
|
1273
|
+
内容上要覆盖这几件事(不要求任何段落标题,也不要求固定顺序):
|
|
1430
1274
|
|
|
1431
|
-
|
|
1275
|
+
- 这次会话做了什么、进展到哪一步
|
|
1276
|
+
- 关键决策 / 关键发现 / 踩过的坑
|
|
1277
|
+
- 当前状态:手上有什么、卡在哪里
|
|
1278
|
+
- 后续要做什么
|
|
1279
|
+
- 用户的核心诉求
|
|
1432
1280
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
-
|
|
1436
|
-
-
|
|
1437
|
-
-
|
|
1438
|
-
-
|
|
1281
|
+
## 硬性要求
|
|
1282
|
+
|
|
1283
|
+
- **不要**输出 JSON、不要代码块围栏、不要"以下是 checkpoint"之类的开场白
|
|
1284
|
+
- **不要**使用固定的小节标题模板(如 Summary / Current State 之类),自然叙述即可
|
|
1285
|
+
- 直接用中文写(除非对话本身是英文)
|
|
1286
|
+
- 信息密度优先:写具体的东西(文件名、命令、报错原文、参数值),不要空泛概括
|
|
1287
|
+
- 篇幅控制在能让人快速读完的长度(约 200-800 字),拖沓冗余不如简洁
|
|
1288
|
+
- 用户输入里若带了场景提示(scenario hint),它指明了重点关注方向,请优先覆盖`,
|
|
1439
1289
|
"compact-hint": `# Compact Hint Generator
|
|
1440
1290
|
|
|
1441
|
-
|
|
1291
|
+
你是会话压缩指导提示生成器。分析对话历史,产出一段"压缩关注点提示",告诉
|
|
1292
|
+
checkpoint 生成器在压缩这次会话时**最该保留什么**。
|
|
1293
|
+
|
|
1294
|
+
## 输出要求
|
|
1295
|
+
|
|
1296
|
+
- **直接回复提示正文**(3-4 句话),不要 JSON、不要代码块、不要工具调用、不要任何额外说明或开场白
|
|
1297
|
+
- 内容要具体:指出本次会话的主题、当前进展、以及压缩时最该保留的信息
|
|
1298
|
+
- 用自然语言描述,可以是一段话或几条要点
|
|
1299
|
+
|
|
1300
|
+
示例:
|
|
1442
1301
|
|
|
1443
|
-
|
|
1302
|
+
会话围绕 lark-cli 多 profile 部署展开:已完成 profile 选型与凭据写入,当前卡在用户身份 reply 的权限确认。压缩时应重点保留各 profile 的 region 与凭据路径,以及权限报错原文。`,
|
|
1444
1303
|
"workflow-creator": `# Workflow Creator (交互式 workflow 构建子代理)
|
|
1445
1304
|
|
|
1446
1305
|
## 你的身份
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TestIpcServer {
|
|
2
|
+
socketPath: string;
|
|
3
|
+
/** last parsed JSON request received from a client */
|
|
4
|
+
lastRequest: Record<string, unknown> | null;
|
|
5
|
+
start(): Promise<void>;
|
|
6
|
+
stop(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createIpcServer(opts?: {
|
|
9
|
+
replyDelayMs?: number;
|
|
10
|
+
}): TestIpcServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-agent-core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./env/task/prompt": {
|
|
17
|
+
"import": "./dist/env/task/prompt/index.js",
|
|
18
|
+
"types": "./dist/env/task/prompt/index.d.ts",
|
|
19
|
+
"default": "./dist/env/task/prompt/index.js"
|
|
20
|
+
},
|
|
16
21
|
"./env/task/plugins": {
|
|
17
22
|
"import": "./dist/env/task/plugins/index.js",
|
|
18
23
|
"types": "./dist/env/task/plugins/index.d.ts",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// src/env/task/tools/completion-copy.ts
|
|
2
|
-
var TASK_COMPLETE_ITEM_BY_ITEM = "按子项逐条验收";
|
|
3
|
-
var TASK_COMPLETION_HINT_ANCHOR = "TASK_COMPLETION_HINT";
|
|
4
|
-
var TASK_COMPLETE_VERIFY_DUTY = "核实义务";
|
|
5
|
-
|
|
6
|
-
export { TASK_COMPLETE_ITEM_BY_ITEM, TASK_COMPLETION_HINT_ANCHOR, TASK_COMPLETE_VERIFY_DUTY };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__esm
|
|
3
|
-
} from "./roy-agent-core-fs0mn2jk.js";
|
|
4
|
-
|
|
5
|
-
// src/utils/loose-json.ts
|
|
6
|
-
function tryParseJsonString(s) {
|
|
7
|
-
try {
|
|
8
|
-
const parsed = JSON.parse(s);
|
|
9
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
10
|
-
return parsed;
|
|
11
|
-
}
|
|
12
|
-
} catch {}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
function tryParseJsonFromText(text) {
|
|
16
|
-
if (!text || typeof text !== "string")
|
|
17
|
-
return null;
|
|
18
|
-
const direct = tryParseJsonString(text.trim());
|
|
19
|
-
if (direct)
|
|
20
|
-
return direct;
|
|
21
|
-
const codeBlock = text.match(/```(?:json|JSON)?\s*\n?([\s\S]*?)\n?\s*```/);
|
|
22
|
-
if (codeBlock) {
|
|
23
|
-
const parsed = tryParseJsonString(codeBlock[1].trim());
|
|
24
|
-
if (parsed)
|
|
25
|
-
return parsed;
|
|
26
|
-
}
|
|
27
|
-
const jsonMatch = text.match(/\{[\s\S]*\}/);
|
|
28
|
-
if (jsonMatch) {
|
|
29
|
-
const parsed = tryParseJsonString(jsonMatch[0]);
|
|
30
|
-
if (parsed)
|
|
31
|
-
return parsed;
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
var init_loose_json = () => {};
|
|
36
|
-
|
|
37
|
-
export { tryParseJsonFromText, init_loose_json };
|