@xopcai/xopc 0.0.206 → 0.0.207
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 +7 -7
- package/README.zh-CN.md +7 -7
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-URW-e_me.js → activity-store-BmpM0zwM.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BLK6kRCJ.js → agent-avatar-dicebear-DhK5wi6_.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bc3Lc-n2.js +68 -0
- package/dist/gateway/static/root/assets/{api-C_MS4arC.js → api-CzaAcDOn.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CnUN6BJk.js → app-management-settings-panel-Dqj5G_cd.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C8Nx8hZE.js → appearance-settings-Bm1uLGMi.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BKtwU47-.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C7FqeJZD.js → archive-plugin-CgnzBplN.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DCYQgsYE.js → attachment-load-Cuybcmhn.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-ilGeRLDN.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Bf1WROsh.js → binary-plugins-D6BBx6Ps.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BPK08Pjv.js → block-editor-Dk1c3Spa.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-BCu8AZbs.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-cqVoDHyp.js → browser-workflow-inputs-DvfIzCgV.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Des1UTsS.js → browser-workflows-page-DZScuPlF.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BbWQBtTe.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-D4MjqV2a.js → capability-presets-api-hoA8R_J1.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BTVU46Yn.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CcimZduy.js → channel-recipient-api-BS8I65NT.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BEQsC9a9.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DRwbgtOT.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-BIPhWBDI.js +36 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B1njb2Cr.css → chat-terminal-dock-uQUnjRtf.css} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-CUvFu8jh.js → connectors-api-B_78jmvM.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BJoHjWnu.js → connectors-page-w_3kpqbc.js} +2 -2
- package/dist/gateway/static/root/assets/{cron-expression-hFSZZpvM.js → cron-expression-BBheaBIr.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CKZ0gc-Y.js → date-picker-CDwj7UrT.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-zv1oHtg4.js → dependency-picker-Dnrc2qZe.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DY9ykMtD.js → desktop-pet-Bj_vUjXp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-XiSmmt26.js → desktop-pet-settings-uiCwJJk4.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CZkgk15r.js → directory-picker-path-field-D0zUQ-TO.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CTppsTEi.js → extension-debug-page-_GZ4y2da.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CHRTUvAa.js → extension-page-scR96Edg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-z2UBx25A.js → extension-settings-page-CILsAwxx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DzFPJTnm.js → gateway-config-api-984O_4wM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CGpoH1gU.js → gateway-config-swr-D4hvsdJA.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DBa2I6VM.js → gateway-settings-aF4eQHo3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Te-TREBt.js → gateway-startup-retry-Deo5-O87.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DyQGGdBu.js → heartbeat-settings-D5DrFWH6.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-EkT4eGeP.js → home-page-DiMWxngC.js} +2 -2
- package/dist/gateway/static/root/assets/{index-CrwXzRpA.js → index-DzKLVgY-.js} +47 -47
- package/dist/gateway/static/root/assets/index-wR5jX-lw.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-fb0zS8pk.js → keyboard-shortcuts-settings-DGmOlNcB.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-De8vuwu1.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DFdheruU.js → local-apps-page-CzS2sCxg.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CieddUjx.js → locale-store-C7xtkP3D.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BI9stsVO.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D3PsQ612.js → management-settings-Cpxs43JB.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-x5K52Thz.js → markdown-split-CQvFHxUa.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Cjjey5Y6.js → markdown-view-BRwrSbwM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DNtEkRAh.js → media-plugins-Bs9MsiaM.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dxk5Rzj_.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-nWEqlwDw.js → notes-page-Dux_g6aZ.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CGafcgJ8.js +4 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CXcIKVi9.js → preview-open-alternatives-fvhtN4Y2.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CZLJudPk.js → product-open-page-f_jbg-9N.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-Cf1v94LO.js → project-detail-page-C6mNsjYr.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BRMZkNht.js → projects-page-D1G6VIxR.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CIez6X0x.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-RYjduQV6.js → runtime-tools-settings-panel-zapSiJrv.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form--1ZXg4qC.js → schema-form-CFyz8y5v.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-6irxQjHb.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CRb0QTG2.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-71-8j3zt.js → settings-form-section-DCiK4TIq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-C5Jn1l0q.js → settings-loading-skeleton-DFUJEv4G.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-TYYGe6kZ.js → settings-page-Cnp9Bdd0.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-jA5I-17g.js → setup-status-panel-BFMGTGBO.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BMUQIGfk.js → share-preview-page-DA8nA4cz.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CaKfvJzQ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOBUcYr5.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BzZT1SKg.js → skills-page-BJJACxzz.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DnaBw5Ji.js → skills-page.utils--1-vOg3V.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DqiPQgVI.js → system-settings-panel-DY0lIaXY.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-Ciuwe7AG.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BP3_RpaY.js → theme-store-DoyRfkoi.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BJkQ-vpu.js → use-autosave-DzIR5Lxf.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-BP8-sOPi.js → user-context-page-yf18T_BZ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-C6c8e7Mx.js → voice-api-key-field-B7MZS8tS.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CCNjWKql.js → work-discovery-overlay-zyX6yxxF.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-2e5J0sIp.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-Cj1vPWRM.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-D37zWlWY.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-vWi33CZJ.js → working-directory-picker-modal-Bm7cox3y.js} +1 -1
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/transcript-runtime.d.ts +2 -1
- package/dist/src/agent/embedded/transcript-runtime.js +38 -4
- package/dist/src/agent/inbound/inbound-loop.d.ts +1 -1
- package/dist/src/agent/memory/compaction-ledger.d.ts +11 -0
- package/dist/src/agent/memory/compaction-ledger.js +108 -0
- package/dist/src/agent/memory/compaction-serializer.d.ts +2 -0
- package/dist/src/agent/memory/compaction-serializer.js +52 -0
- package/dist/src/agent/memory/compaction-source-planner.d.ts +20 -0
- package/dist/src/agent/memory/compaction-source-planner.js +67 -0
- package/dist/src/agent/memory/compaction.d.ts +11 -5
- package/dist/src/agent/memory/compaction.js +245 -153
- package/dist/src/agent/prompt/sections/behavior.js +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -2
- package/dist/src/agent/prompt/sections/tooling.js +2 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +1 -1
- package/dist/src/agent/tools/factory.js +5 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/session-recall-tool.d.ts +7 -0
- package/dist/src/agent/tools/session-recall-tool.js +82 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +1 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +3 -3
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/session/compaction-types.d.ts +30 -0
- package/dist/src/session/compaction-types.js +35 -0
- package/dist/src/session/manager.d.ts +3 -0
- package/dist/src/session/session-context-for-llm.d.ts +4 -2
- package/dist/src/session/session-context-for-llm.js +2 -1
- package/dist/src/session/store.d.ts +10 -1
- package/dist/src/session/store.js +55 -23
- package/dist/src/session/types.d.ts +3 -2
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +25 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/transcript-repository.d.ts +24 -1
- package/dist/src/storage/sqlite/transcript-repository.js +78 -29
- package/dist/src/user-context/config.d.ts +4 -0
- package/dist/src/user-context/config.js +2 -0
- package/package.json +3 -3
- package/skills/THIRD_PARTY_NOTICES.md +1 -1
- package/skills/engineering/define-task/SKILL.md +48 -0
- package/skills/engineering/define-task/references/task-contract-rubric.md +15 -0
- package/dist/gateway/static/root/assets/agents-D5HVmdNx.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-DKCA_LFY.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BEOE4ZKM.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CLRmMdU9.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BNcVi4ar.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-uFwW2ah5.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DSLP8OjS.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-D0OR6Ylw.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-wpi7abPg.js +0 -38
- package/dist/gateway/static/root/assets/index-BpLqHdfz.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-CCC3Cvb8.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-B6jfkNDF.js +0 -2
- package/dist/gateway/static/root/assets/messages-CySMn8WL.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-QstkgWsW.js +0 -4
- package/dist/gateway/static/root/assets/remote-access-hub-D55FTXZw.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C5Yy6eIn.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqO_8bUh.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Dru1a2rZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C8iqS6kF.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DQP5vDr-.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DL_Ie0s2.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DLO-dMSN.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-B4-k2FHB.js +0 -5
- package/dist/src/agent/memory/compaction-planner.d.ts +0 -16
- package/dist/src/agent/memory/compaction-planner.js +0 -168
- package/dist/src/agent/memory/summary-generator.d.ts +0 -46
- package/dist/src/agent/memory/summary-generator.js +0 -229
- package/skills/engineering/define-goal/SKILL.md +0 -41
- package/skills/engineering/define-goal/references/objective-rubric.md +0 -12
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { readAgentMessageContent } from "./agent-message-access.js";
|
|
4
|
-
//#region src/agent/memory/summary-generator.ts
|
|
5
|
-
init_logger();
|
|
6
|
-
const log = createLogger("SummaryGenerator");
|
|
7
|
-
const DEFAULT_OPTIONS = {
|
|
8
|
-
maxUserRequests: 10,
|
|
9
|
-
maxToolCalls: 50,
|
|
10
|
-
deduplicateByFile: true,
|
|
11
|
-
includeUsage: true
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Categorize tool operation based on tool name
|
|
15
|
-
*/
|
|
16
|
-
function categorizeToolOperation(toolName) {
|
|
17
|
-
const name = toolName.toLowerCase();
|
|
18
|
-
if ([
|
|
19
|
-
"read",
|
|
20
|
-
"read_file",
|
|
21
|
-
"read_multiple",
|
|
22
|
-
"glob",
|
|
23
|
-
"list_dir",
|
|
24
|
-
"ls",
|
|
25
|
-
"memory_get"
|
|
26
|
-
].some((n) => name.includes(n))) return "read";
|
|
27
|
-
if ([
|
|
28
|
-
"write",
|
|
29
|
-
"write_file",
|
|
30
|
-
"write_multiple",
|
|
31
|
-
"edit",
|
|
32
|
-
"patch",
|
|
33
|
-
"create",
|
|
34
|
-
"mkdir"
|
|
35
|
-
].some((n) => name.includes(n))) return "write";
|
|
36
|
-
if ([
|
|
37
|
-
"grep",
|
|
38
|
-
"search",
|
|
39
|
-
"find",
|
|
40
|
-
"find_files",
|
|
41
|
-
"memory_search",
|
|
42
|
-
"web_search"
|
|
43
|
-
].some((n) => name.includes(n))) return "search";
|
|
44
|
-
if ([
|
|
45
|
-
"bash",
|
|
46
|
-
"exec",
|
|
47
|
-
"run",
|
|
48
|
-
"command"
|
|
49
|
-
].some((n) => name.includes(n))) return "command";
|
|
50
|
-
return "other";
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Extract text content from message
|
|
54
|
-
*/
|
|
55
|
-
function extractTextContent(content) {
|
|
56
|
-
if (typeof content === "string") return content;
|
|
57
|
-
if (Array.isArray(content)) return content.filter((c) => c.type === "text").map((c) => c.text || "").join("\n");
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Type guard: Check if message has tool calls (assistant message)
|
|
62
|
-
*/
|
|
63
|
-
function hasToolCalls(msg) {
|
|
64
|
-
return msg.role === "assistant" && "toolCalls" in msg;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Type guard: Check if message is a tool result
|
|
68
|
-
*/
|
|
69
|
-
function isToolResult(msg) {
|
|
70
|
-
return msg.role === "toolResult" && "name" in msg;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Deduplicate tool calls by file path (keep last operation per file)
|
|
74
|
-
*/
|
|
75
|
-
function deduplicateByFilePath(toolCalls) {
|
|
76
|
-
const byFile = /* @__PURE__ */ new Map();
|
|
77
|
-
const otherCalls = [];
|
|
78
|
-
for (const call of toolCalls) if (call.filePath) byFile.set(call.filePath, call);
|
|
79
|
-
else otherCalls.push(call);
|
|
80
|
-
return [...Array.from(byFile.values()), ...otherCalls];
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Generate structured summary from messages
|
|
84
|
-
*/
|
|
85
|
-
function generateStructuredSummary(messages, options = {}) {
|
|
86
|
-
const opts = {
|
|
87
|
-
...DEFAULT_OPTIONS,
|
|
88
|
-
...options
|
|
89
|
-
};
|
|
90
|
-
const summary = {
|
|
91
|
-
userRequests: [],
|
|
92
|
-
toolCalls: [],
|
|
93
|
-
keyDecisions: [],
|
|
94
|
-
filesModified: [],
|
|
95
|
-
totalToolCalls: 0,
|
|
96
|
-
successfulToolCalls: 0,
|
|
97
|
-
failedToolCalls: 0
|
|
98
|
-
};
|
|
99
|
-
let lastAssistantMessage = null;
|
|
100
|
-
for (const msg of messages) {
|
|
101
|
-
if (msg.role === "user") {
|
|
102
|
-
const text = extractTextContent(readAgentMessageContent(msg));
|
|
103
|
-
if (text.trim().length > 20) summary.userRequests.push(text.slice(0, 500));
|
|
104
|
-
}
|
|
105
|
-
if (hasToolCalls(msg)) {
|
|
106
|
-
lastAssistantMessage = msg;
|
|
107
|
-
const toolCalls = msg.toolCalls;
|
|
108
|
-
if (toolCalls && toolCalls.length > 0) {
|
|
109
|
-
summary.totalToolCalls += toolCalls.length;
|
|
110
|
-
for (const call of toolCalls) {
|
|
111
|
-
const toolSummary = {
|
|
112
|
-
toolName: call.name,
|
|
113
|
-
operation: categorizeToolOperation(call.name),
|
|
114
|
-
success: true,
|
|
115
|
-
filePath: String(call.args?.path || call.args?.file_path || call.args?.filePath || ""),
|
|
116
|
-
timestamp: msg.timestamp
|
|
117
|
-
};
|
|
118
|
-
summary.toolCalls.push(toolSummary);
|
|
119
|
-
if (["write", "edit"].includes(toolSummary.operation) && toolSummary.filePath) summary.filesModified.push(toolSummary.filePath);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (isToolResult(msg)) {
|
|
124
|
-
const toolMsg = msg;
|
|
125
|
-
const toolName = toolMsg.toolName;
|
|
126
|
-
const toolCall = summary.toolCalls.slice().reverse().find((tc) => tc.toolName === toolName && !tc.timestamp);
|
|
127
|
-
if (toolCall) {
|
|
128
|
-
const resultText = extractTextContent(readAgentMessageContent(toolMsg));
|
|
129
|
-
const isError = resultText.toLowerCase().includes("error") || resultText.toLowerCase().includes("failed") || resultText.startsWith("Error:");
|
|
130
|
-
toolCall.success = !isError;
|
|
131
|
-
toolCall.briefResult = resultText.slice(0, 200);
|
|
132
|
-
if (isError) summary.failedToolCalls++;
|
|
133
|
-
else summary.successfulToolCalls++;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (opts.deduplicateByFile) summary.toolCalls = deduplicateByFilePath(summary.toolCalls);
|
|
138
|
-
if (summary.toolCalls.length > opts.maxToolCalls) summary.toolCalls = summary.toolCalls.slice(-opts.maxToolCalls);
|
|
139
|
-
if (summary.userRequests.length > opts.maxUserRequests) summary.userRequests = summary.userRequests.slice(-opts.maxUserRequests);
|
|
140
|
-
summary.filesModified = [...new Set(summary.filesModified)];
|
|
141
|
-
if (lastAssistantMessage) summary.keyDecisions = extractKeyDecisions(lastAssistantMessage);
|
|
142
|
-
log.debug({
|
|
143
|
-
userRequests: summary.userRequests.length,
|
|
144
|
-
toolCalls: summary.toolCalls.length,
|
|
145
|
-
filesModified: summary.filesModified.length,
|
|
146
|
-
totalToolCalls: summary.totalToolCalls,
|
|
147
|
-
successfulToolCalls: summary.successfulToolCalls,
|
|
148
|
-
failedToolCalls: summary.failedToolCalls
|
|
149
|
-
}, "Generated structured summary");
|
|
150
|
-
return summary;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Extract key decisions from assistant message
|
|
154
|
-
*/
|
|
155
|
-
function extractKeyDecisions(msg) {
|
|
156
|
-
const content = extractTextContent(readAgentMessageContent(msg));
|
|
157
|
-
const decisions = [];
|
|
158
|
-
for (const pattern of [
|
|
159
|
-
/(?:I'll|I will|Let's|We should|Decision:|Decided to|Chose to)\s+(.+?)(?:\.|\n)/gi,
|
|
160
|
-
/(?:Based on|After analyzing|Given that)\s+(.+?)(?:\.|\n)/gi,
|
|
161
|
-
/(?:The best approach|The solution|The answer) is\s+(.+?)(?:\.|\n)/gi
|
|
162
|
-
]) {
|
|
163
|
-
const matches = content.match(pattern);
|
|
164
|
-
if (matches) decisions.push(...matches.slice(0, 5).map((m) => m.trim()));
|
|
165
|
-
}
|
|
166
|
-
return decisions.slice(0, 10);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Format structured summary as text for injection into context
|
|
170
|
-
*/
|
|
171
|
-
function formatSummaryAsText(summary, includeUsage = true) {
|
|
172
|
-
const lines = [];
|
|
173
|
-
lines.push("[Previous Conversation Summary]");
|
|
174
|
-
if (summary.userRequests.length > 0) {
|
|
175
|
-
lines.push("");
|
|
176
|
-
lines.push("User Requests:");
|
|
177
|
-
for (const req of summary.userRequests.slice(-5)) lines.push(` - ${req.slice(0, 150)}${req.length > 150 ? "..." : ""}`);
|
|
178
|
-
}
|
|
179
|
-
if (summary.toolCalls.length > 0) {
|
|
180
|
-
lines.push("");
|
|
181
|
-
lines.push("Tool Operations:");
|
|
182
|
-
const byType = /* @__PURE__ */ new Map();
|
|
183
|
-
for (const call of summary.toolCalls) {
|
|
184
|
-
const list = byType.get(call.operation) || [];
|
|
185
|
-
list.push(call);
|
|
186
|
-
byType.set(call.operation, list);
|
|
187
|
-
}
|
|
188
|
-
for (const [type, calls] of byType.entries()) {
|
|
189
|
-
const files = calls.filter((c) => c.filePath).map((c) => c.filePath);
|
|
190
|
-
const successCount = calls.filter((c) => c.success).length;
|
|
191
|
-
lines.push(` ${type.toUpperCase()}: ${calls.length} operations (${successCount}/${calls.length} successful)`);
|
|
192
|
-
if (files.length > 0) lines.push(` Files: ${files.slice(0, 10).join(", ")}${files.length > 10 ? "..." : ""}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (summary.filesModified.length > 0) {
|
|
196
|
-
lines.push("");
|
|
197
|
-
lines.push("Files Modified:");
|
|
198
|
-
for (const file of summary.filesModified.slice(-10)) lines.push(` - ${file}`);
|
|
199
|
-
}
|
|
200
|
-
if (summary.keyDecisions.length > 0) {
|
|
201
|
-
lines.push("");
|
|
202
|
-
lines.push("Key Decisions:");
|
|
203
|
-
for (const decision of summary.keyDecisions.slice(-5)) lines.push(` - ${decision}`);
|
|
204
|
-
}
|
|
205
|
-
if (includeUsage) {
|
|
206
|
-
lines.push("");
|
|
207
|
-
lines.push("Statistics:");
|
|
208
|
-
lines.push(` Total tool calls: ${summary.totalToolCalls}`);
|
|
209
|
-
lines.push(` Successful: ${summary.successfulToolCalls}`);
|
|
210
|
-
lines.push(` Failed: ${summary.failedToolCalls}`);
|
|
211
|
-
lines.push(` Files modified: ${summary.filesModified.length}`);
|
|
212
|
-
}
|
|
213
|
-
return lines.join("\n");
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Generate compact summary message for context injection
|
|
217
|
-
*/
|
|
218
|
-
function createSummaryMessage(summary) {
|
|
219
|
-
return {
|
|
220
|
-
role: "user",
|
|
221
|
-
content: [{
|
|
222
|
-
type: "text",
|
|
223
|
-
text: formatSummaryAsText(summary, true)
|
|
224
|
-
}],
|
|
225
|
-
timestamp: Date.now()
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
//#endregion
|
|
229
|
-
export { createSummaryMessage, formatSummaryAsText, generateStructuredSummary };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: define-goal
|
|
3
|
-
description: Turn an explicitly requested goal into a concise, measurable objective with verifiable completion evidence.
|
|
4
|
-
metadata:
|
|
5
|
-
xopc:
|
|
6
|
-
emoji: "🎯"
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Goal definition
|
|
10
|
-
|
|
11
|
-
Use this skill only when the user explicitly asks to define, create, or refine a persistent goal.
|
|
12
|
-
Do ordinary implementation work directly; do not create a goal merely because a task has several steps.
|
|
13
|
-
|
|
14
|
-
## Shape a usable objective
|
|
15
|
-
|
|
16
|
-
State the desired outcome, the affected artifact or behaviour, the evidence that will prove success,
|
|
17
|
-
and any material scope boundary. Prefer an observable threshold over activity wording.
|
|
18
|
-
|
|
19
|
-
Good objectives name a result and a check:
|
|
20
|
-
|
|
21
|
-
> Deliver the requested export change in `src/export/`, keep all existing formats compatible, and
|
|
22
|
-
> verify it with the targeted export tests and a generated sample file.
|
|
23
|
-
|
|
24
|
-
Avoid objectives such as “make progress” or “investigate this”; turn them into a bounded decision,
|
|
25
|
-
reproduction, fix, or written finding.
|
|
26
|
-
|
|
27
|
-
## Create safely
|
|
28
|
-
|
|
29
|
-
1. Use available repository and conversation context to make the objective concrete.
|
|
30
|
-
2. Ask one concise question only when a missing outcome, metric, or scope limit would change the
|
|
31
|
-
work materially.
|
|
32
|
-
3. Check the current goal state before creating another one. Continue a matching active goal rather
|
|
33
|
-
than duplicating it.
|
|
34
|
-
4. Create a persistent goal only after the user asked for one and the objective is verifiable.
|
|
35
|
-
5. Include a token budget only when the user requested one.
|
|
36
|
-
|
|
37
|
-
For bugs, define a reproducer and a passing regression check. For performance work, name the metric,
|
|
38
|
-
threshold, method, and run count. For research, name the decision the research must enable and the
|
|
39
|
-
evidence standard.
|
|
40
|
-
|
|
41
|
-
For a compact review checklist, read `references/objective-rubric.md`.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Define-goal objective rubric
|
|
2
|
-
|
|
3
|
-
Review a goal against these questions before creating it:
|
|
4
|
-
|
|
5
|
-
1. What will be observably true at completion?
|
|
6
|
-
2. Which artifact, service, workflow, or user experience is in scope?
|
|
7
|
-
3. What exact evidence proves success?
|
|
8
|
-
4. Which boundary prevents unrelated work from expanding the goal?
|
|
9
|
-
5. What missing information should stop execution and trigger a question?
|
|
10
|
-
|
|
11
|
-
Use binary evidence when possible: a test passes, an artifact exists, a report contains a decision,
|
|
12
|
-
or a reviewer accepts named criteria.
|