visionclaw 0.1.176-beta.2 → 0.1.176
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/CHANGELOG.md +22 -0
- package/dist/agent/system-prompt.d.ts.map +1 -1
- package/dist/agent/system-prompt.js +12 -0
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/data-processing/convert-demo-cli.d.ts +7 -0
- package/dist/data-processing/convert-demo-cli.d.ts.map +1 -0
- package/dist/data-processing/convert-demo-cli.js +30 -0
- package/dist/data-processing/convert-demo-cli.js.map +1 -0
- package/dist/data-processing/convert-demo.d.ts +26 -0
- package/dist/data-processing/convert-demo.d.ts.map +1 -0
- package/dist/data-processing/convert-demo.js +233 -0
- package/dist/data-processing/convert-demo.js.map +1 -0
- package/dist/tools/transcript-memory.d.ts.map +1 -1
- package/dist/tools/transcript-memory.js +48 -15
- package/dist/tools/transcript-memory.js.map +1 -1
- package/dist-agent/bundle.cjs +50 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [0.1.176](https://github.com/babelcloud/visionclaw/compare/v0.1.175...v0.1.176) (2026-04-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* accept short TOTP secrets from real services (GitHub, Discord) ([7a9fada](https://github.com/babelcloud/visionclaw/commit/7a9fadaac0055eaa2af5e404dbedd2877087dc10))
|
|
7
|
+
* address general sdk review feedback ([f29ff49](https://github.com/babelcloud/visionclaw/commit/f29ff494b1630aa7757afb7337bd0a7dbced7a5e))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add general agent sdk host adaptation ([462fe66](https://github.com/babelcloud/visionclaw/commit/462fe66a9b11ae018fe9e8075afee2b1f7623195))
|
|
13
|
+
* add GitHub Actions workflow for beta release ([bedbed3](https://github.com/babelcloud/visionclaw/commit/bedbed355f89825b4e9f4beb55a8315f8ac17c1d))
|
|
14
|
+
* implement heartbeat management and transcript backfill functionality ([bbfd700](https://github.com/babelcloud/visionclaw/commit/bbfd70036b9a46d8c1f053a2149b60e85208e1fb))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Reverts
|
|
18
|
+
|
|
19
|
+
* Revert "Merge pull request #85 from babelcloud/feat/general-agent-sdk-adaptation" ([742ebb4](https://github.com/babelcloud/visionclaw/commit/742ebb48bea51872a57d635b2824adec817ad521)), closes [#85](https://github.com/babelcloud/visionclaw/issues/85)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## [0.1.175](https://github.com/babelcloud/visionclaw/compare/v0.1.175-beta.1...v0.1.175) (2026-04-01)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGxE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,WAAW,GACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGxE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,WAAW,GACvB,MAAM,CAwLR"}
|
|
@@ -174,6 +174,18 @@ IMPORTANT: ALWAYS VIEW YOUR MEMORY DIRECTORY BEFORE DOING ANYTHING ELSE.
|
|
|
174
174
|
|
|
175
175
|
ASSUME INTERRUPTION: Your context window might be compacted at any moment, so you risk losing any progress that is not recorded in your memory directory. Keep memory content up-to-date, coherent, and organized. Delete files that are no longer relevant.
|
|
176
176
|
|
|
177
|
+
### Transcript Search (Long-term Recall)
|
|
178
|
+
|
|
179
|
+
Your memory files capture what you explicitly saved. But many conversations, decisions, and actions are NOT saved to memory files. Use \`memory_transcript_search\` to search the full history of past wake cycles when:
|
|
180
|
+
- You need to recall a conversation or decision that wasn't saved to a memory file
|
|
181
|
+
- The user asks "did we discuss X?" or "what happened with Y?" and your memory files don't have it
|
|
182
|
+
- You want context on a topic before starting work (e.g., prior attempts, user preferences expressed in conversation)
|
|
183
|
+
|
|
184
|
+
**Choosing memory files vs transcript search:**
|
|
185
|
+
- Check memory files first — they are curated and fast
|
|
186
|
+
- Use transcript search when memory files don't have what you need, or when the user asks about past conversations specifically
|
|
187
|
+
- Transcript search covers everything discussed, not just what was explicitly saved
|
|
188
|
+
|
|
177
189
|
## Current Time
|
|
178
190
|
${now} (${tz})
|
|
179
191
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAwB,EACxB,WAAwB;IAExB,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE;QAC7C,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;KAClB,CAAC,CAAC;IAEH,OAAO;;UAEC,MAAM,CAAC,SAAS,oHAAoH,OAAO,CAAC,QAAQ,KAAK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AAG,KAAK,EAAE;CACX,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IAE5E,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-demo-cli.d.ts","sourceRoot":"","sources":["../../src/data-processing/convert-demo-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BlE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI wrapper for convert-demo.
|
|
3
|
+
*
|
|
4
|
+
* Usage: visionclaw convert-demo <output-dir> [-o demo-output-dir]
|
|
5
|
+
*/
|
|
6
|
+
import { convertDemo } from "./convert-demo.js";
|
|
7
|
+
export async function runConvertDemo(args) {
|
|
8
|
+
let outputDir = "";
|
|
9
|
+
let demoOutputDir;
|
|
10
|
+
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
const arg = args[i];
|
|
12
|
+
if ((arg === "-o" || arg === "--output-dir") && i + 1 < args.length) {
|
|
13
|
+
demoOutputDir = args[++i];
|
|
14
|
+
}
|
|
15
|
+
else if (!arg.startsWith("-") && !outputDir) {
|
|
16
|
+
outputDir = arg;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!outputDir) {
|
|
20
|
+
console.error("Usage: visionclaw convert-demo <output-dir> [-o demo-output-dir]\n" +
|
|
21
|
+
"\n" +
|
|
22
|
+
" <output-dir> Path to pipeline output (contains restructured-*.jsonl + workspace/)\n" +
|
|
23
|
+
" -o <dir> Where to write demo-*.jsonl (defaults to output-dir)");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
console.log(`Converting to demo format: ${outputDir}`);
|
|
27
|
+
await convertDemo({ outputDir, demoOutputDir });
|
|
28
|
+
console.log("Done.");
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=convert-demo-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-demo-cli.js","sourceRoot":"","sources":["../../src/data-processing/convert-demo-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc;IACjD,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,aAAiC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACpE,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9C,SAAS,GAAG,GAAG,CAAC;QAClB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,oEAAoE;YACpE,IAAI;YACJ,yFAAyF;YACzF,uEAAuE,CACxE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;IACvD,MAAM,WAAW,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert restructured JSONL records to the OpenClaw demo.json format.
|
|
3
|
+
*
|
|
4
|
+
* The demo format uses an OpenAI chat-completion-style messages array:
|
|
5
|
+
* system → user → (assistant → tool)* → assistant
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx tsx src/data-processing/convert-demo.ts <output-dir> [-o <demo-output-dir>]
|
|
9
|
+
*
|
|
10
|
+
* Reads:
|
|
11
|
+
* <output-dir>/restructured-*.jsonl
|
|
12
|
+
* <output-dir>/workspace/system-prompt.md
|
|
13
|
+
*
|
|
14
|
+
* Writes:
|
|
15
|
+
* <demo-output-dir>/demo-clean.jsonl (or specified output dir)
|
|
16
|
+
* <demo-output-dir>/demo-interrupted.jsonl
|
|
17
|
+
* <demo-output-dir>/demo-heartbeat.jsonl
|
|
18
|
+
*/
|
|
19
|
+
export interface ConvertDemoOptions {
|
|
20
|
+
/** Path to output dir (containing restructured-*.jsonl and workspace/) */
|
|
21
|
+
outputDir: string;
|
|
22
|
+
/** Where to write demo JSONL files (defaults to outputDir) */
|
|
23
|
+
demoOutputDir?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function convertDemo(opts: ConvertDemoOptions): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=convert-demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-demo.d.ts","sourceRoot":"","sources":["../../src/data-processing/convert-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA2PH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzE"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert restructured JSONL records to the OpenClaw demo.json format.
|
|
3
|
+
*
|
|
4
|
+
* The demo format uses an OpenAI chat-completion-style messages array:
|
|
5
|
+
* system → user → (assistant → tool)* → assistant
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx tsx src/data-processing/convert-demo.ts <output-dir> [-o <demo-output-dir>]
|
|
9
|
+
*
|
|
10
|
+
* Reads:
|
|
11
|
+
* <output-dir>/restructured-*.jsonl
|
|
12
|
+
* <output-dir>/workspace/system-prompt.md
|
|
13
|
+
*
|
|
14
|
+
* Writes:
|
|
15
|
+
* <demo-output-dir>/demo-clean.jsonl (or specified output dir)
|
|
16
|
+
* <demo-output-dir>/demo-interrupted.jsonl
|
|
17
|
+
* <demo-output-dir>/demo-heartbeat.jsonl
|
|
18
|
+
*/
|
|
19
|
+
import fs from "node:fs";
|
|
20
|
+
import path from "node:path";
|
|
21
|
+
import readline from "node:readline";
|
|
22
|
+
import { randomUUID } from "node:crypto";
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Turn grouping helpers
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
/**
|
|
27
|
+
* Group trajectory entries into chat-style turns.
|
|
28
|
+
*
|
|
29
|
+
* Grouping rules:
|
|
30
|
+
* - Consecutive `thinking`, `assistant`, `tool_call` entries are merged
|
|
31
|
+
* into a single `assistant` message.
|
|
32
|
+
* - Each `tool_result` becomes a separate `tool` message.
|
|
33
|
+
* - `user_message` entries become `user` messages.
|
|
34
|
+
* - `context` entries become `user` messages (system-injected context).
|
|
35
|
+
*/
|
|
36
|
+
function groupTrajectoryIntoMessages(trajectory) {
|
|
37
|
+
const messages = [];
|
|
38
|
+
// Accumulator for a single assistant turn
|
|
39
|
+
let thinkingBuf = "";
|
|
40
|
+
let contentBuf = "";
|
|
41
|
+
let toolCalls = [];
|
|
42
|
+
let toolCallCounter = 0;
|
|
43
|
+
function flushAssistant() {
|
|
44
|
+
if (!thinkingBuf && !contentBuf && toolCalls.length === 0)
|
|
45
|
+
return;
|
|
46
|
+
const msg = {
|
|
47
|
+
role: "assistant",
|
|
48
|
+
content: contentBuf,
|
|
49
|
+
};
|
|
50
|
+
if (thinkingBuf) {
|
|
51
|
+
msg.reasoning_content = thinkingBuf;
|
|
52
|
+
}
|
|
53
|
+
if (toolCalls.length > 0) {
|
|
54
|
+
msg.tool_calls = [...toolCalls];
|
|
55
|
+
}
|
|
56
|
+
messages.push(msg);
|
|
57
|
+
thinkingBuf = "";
|
|
58
|
+
contentBuf = "";
|
|
59
|
+
toolCalls = [];
|
|
60
|
+
}
|
|
61
|
+
for (const entry of trajectory) {
|
|
62
|
+
switch (entry.role) {
|
|
63
|
+
case "thinking":
|
|
64
|
+
// Thinking can appear before assistant/tool_call, accumulate
|
|
65
|
+
if (thinkingBuf)
|
|
66
|
+
thinkingBuf += "\n";
|
|
67
|
+
thinkingBuf += entry.content;
|
|
68
|
+
break;
|
|
69
|
+
case "assistant":
|
|
70
|
+
// Assistant text content
|
|
71
|
+
if (contentBuf)
|
|
72
|
+
contentBuf += "\n";
|
|
73
|
+
contentBuf += entry.content;
|
|
74
|
+
break;
|
|
75
|
+
case "tool_call": {
|
|
76
|
+
// Parse tool call metadata
|
|
77
|
+
const meta = entry.metadata ?? {};
|
|
78
|
+
const toolName = meta.tool_name ?? entry.content;
|
|
79
|
+
const toolInput = meta.tool_input !== undefined && meta.tool_input !== null
|
|
80
|
+
? (typeof meta.tool_input === "string" ? meta.tool_input : JSON.stringify(meta.tool_input))
|
|
81
|
+
: "";
|
|
82
|
+
const toolUseId = meta.tool_use_id ?? `call_${++toolCallCounter}`;
|
|
83
|
+
toolCalls.push({
|
|
84
|
+
id: toolUseId,
|
|
85
|
+
type: "function",
|
|
86
|
+
function: {
|
|
87
|
+
name: toolName,
|
|
88
|
+
arguments: toolInput,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "tool_result": {
|
|
94
|
+
// Flush pending assistant turn before adding tool result
|
|
95
|
+
flushAssistant();
|
|
96
|
+
const resultMeta = entry.metadata ?? {};
|
|
97
|
+
const resultToolUseId = resultMeta.tool_use_id ?? `call_${toolCallCounter}`;
|
|
98
|
+
messages.push({
|
|
99
|
+
role: "tool",
|
|
100
|
+
content: entry.content,
|
|
101
|
+
tool_call_id: resultToolUseId,
|
|
102
|
+
});
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case "user_message":
|
|
106
|
+
// Flush any pending assistant turn
|
|
107
|
+
flushAssistant();
|
|
108
|
+
messages.push({
|
|
109
|
+
role: "user",
|
|
110
|
+
content: entry.content,
|
|
111
|
+
});
|
|
112
|
+
break;
|
|
113
|
+
case "context":
|
|
114
|
+
// Flush any pending assistant turn
|
|
115
|
+
flushAssistant();
|
|
116
|
+
messages.push({
|
|
117
|
+
role: "user",
|
|
118
|
+
content: entry.content,
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
default:
|
|
122
|
+
// Unknown role — skip
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Flush any remaining assistant content
|
|
127
|
+
flushAssistant();
|
|
128
|
+
return messages;
|
|
129
|
+
}
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// Prior context → user message
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
function buildPriorContextContent(priorContext, prompt) {
|
|
134
|
+
const parts = [];
|
|
135
|
+
if (priorContext?.compaction_summary) {
|
|
136
|
+
parts.push(`[Prior Context Summary]\n${priorContext.compaction_summary}`);
|
|
137
|
+
}
|
|
138
|
+
if (priorContext?.prior_messages && priorContext.prior_messages.length > 0) {
|
|
139
|
+
const priorText = priorContext.prior_messages
|
|
140
|
+
.map((m) => `[${m.role}] ${m.content}`)
|
|
141
|
+
.join("\n");
|
|
142
|
+
parts.push(`[Prior Messages]\n${priorText}`);
|
|
143
|
+
}
|
|
144
|
+
parts.push(prompt);
|
|
145
|
+
return parts.join("\n\n");
|
|
146
|
+
}
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
// Convert a single OutputRecord → DemoRecord
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
function convertRecord(record, systemPrompt) {
|
|
151
|
+
const messages = [];
|
|
152
|
+
// 1. System message
|
|
153
|
+
messages.push({
|
|
154
|
+
role: "system",
|
|
155
|
+
content: systemPrompt,
|
|
156
|
+
});
|
|
157
|
+
// 2. User message (prior context + prompt)
|
|
158
|
+
const userContent = buildPriorContextContent(record.prior_context, record.prompt);
|
|
159
|
+
messages.push({
|
|
160
|
+
role: "user",
|
|
161
|
+
content: userContent,
|
|
162
|
+
});
|
|
163
|
+
// 3. Trajectory → grouped messages
|
|
164
|
+
const trajectoryMessages = groupTrajectoryIntoMessages(record.trajectory);
|
|
165
|
+
messages.push(...trajectoryMessages);
|
|
166
|
+
return {
|
|
167
|
+
uid: record.wake_cycle_id ?? randomUUID(),
|
|
168
|
+
agent_type: "main",
|
|
169
|
+
subagent_index: null,
|
|
170
|
+
prompt: record.prompt,
|
|
171
|
+
success: record.complete,
|
|
172
|
+
messages,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
// File processing
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
async function processJsonlFile(inputPath, outputPath, systemPrompt) {
|
|
179
|
+
if (!fs.existsSync(inputPath))
|
|
180
|
+
return 0;
|
|
181
|
+
const rl = readline.createInterface({
|
|
182
|
+
input: fs.createReadStream(inputPath),
|
|
183
|
+
crlfDelay: Infinity,
|
|
184
|
+
});
|
|
185
|
+
const outStream = fs.createWriteStream(outputPath);
|
|
186
|
+
let count = 0;
|
|
187
|
+
for await (const line of rl) {
|
|
188
|
+
if (!line.trim())
|
|
189
|
+
continue;
|
|
190
|
+
try {
|
|
191
|
+
const record = JSON.parse(line);
|
|
192
|
+
const demo = convertRecord(record, systemPrompt);
|
|
193
|
+
outStream.write(JSON.stringify(demo) + "\n");
|
|
194
|
+
count++;
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Skip malformed lines
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
outStream.end();
|
|
201
|
+
return count;
|
|
202
|
+
}
|
|
203
|
+
export async function convertDemo(opts) {
|
|
204
|
+
const { outputDir } = opts;
|
|
205
|
+
const demoOutputDir = opts.demoOutputDir ?? outputDir;
|
|
206
|
+
// Read system prompt
|
|
207
|
+
const systemPromptPath = path.join(outputDir, "workspace", "system-prompt.md");
|
|
208
|
+
if (!fs.existsSync(systemPromptPath)) {
|
|
209
|
+
console.error(`System prompt not found: ${systemPromptPath}`);
|
|
210
|
+
console.error("Run the pipeline with system-prompt export first.");
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
const systemPrompt = fs.readFileSync(systemPromptPath, "utf-8");
|
|
214
|
+
fs.mkdirSync(demoOutputDir, { recursive: true });
|
|
215
|
+
// Convert each category
|
|
216
|
+
const categories = ["clean", "interrupted", "incomplete", "heartbeat"];
|
|
217
|
+
let totalRecords = 0;
|
|
218
|
+
for (const cat of categories) {
|
|
219
|
+
const inputFile = path.join(outputDir, `restructured-${cat}.jsonl`);
|
|
220
|
+
const outputFile = path.join(demoOutputDir, `demo-${cat}.jsonl`);
|
|
221
|
+
const count = await processJsonlFile(inputFile, outputFile, systemPrompt);
|
|
222
|
+
if (count > 0) {
|
|
223
|
+
console.log(` ${path.basename(outputFile)}: ${count} records`);
|
|
224
|
+
totalRecords += count;
|
|
225
|
+
}
|
|
226
|
+
else if (fs.existsSync(outputFile)) {
|
|
227
|
+
// Remove empty output files
|
|
228
|
+
fs.unlinkSync(outputFile);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
console.log(` Total: ${totalRecords} demo records`);
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=convert-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-demo.js","sourceRoot":"","sources":["../../src/data-processing/convert-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiCzC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,SAAS,2BAA2B,CAAC,UAA6B;IAChE,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,0CAA0C;IAC1C,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,SAAS,GAAmB,EAAE,CAAC;IACnC,IAAI,eAAe,GAAG,CAAC,CAAC;IAExB,SAAS,cAAc;QACrB,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAClE,MAAM,GAAG,GAAgB;YACvB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,UAAU;SACpB,CAAC;QACF,IAAI,WAAW,EAAE,CAAC;YAChB,GAAG,CAAC,iBAAiB,GAAG,WAAW,CAAC;QACtC,CAAC;QACD,IAAI,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,EAAE,CAAC;YACrC,4BAA4B;YAC5B,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,YAAY,eAAe,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-memory.d.ts","sourceRoot":"","sources":["../../src/tools/transcript-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"transcript-memory.d.ts","sourceRoot":"","sources":["../../src/tools/transcript-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAyJhC,CAAC;AAMF,eAAO,MAAM,oBAAoB;;;;;;EAmFhC,CAAC"}
|
|
@@ -31,16 +31,21 @@ This searches an indexed database of wake cycle transcripts — use it when you
|
|
|
31
31
|
Returns lightweight summaries only (Layer 1). Use memory_transcript_detail to get more information about a specific result.
|
|
32
32
|
|
|
33
33
|
Search modes:
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
34
|
+
- hybrid (recommended): combines keyword + semantic for best results. Use for most queries. Example: "discussion about auth middleware rewrite"
|
|
35
|
+
- keyword: FTS5 full-text search with BM25 ranking. Best for exact terms, identifiers, or error messages. Example: "ECONNREFUSED", "deployScript.ts"
|
|
36
|
+
- semantic: vector similarity search (requires embeddings). Best for conceptual/meaning-based queries. Example: "when did we set up the CI pipeline"
|
|
37
|
+
|
|
38
|
+
Tips:
|
|
39
|
+
- Start with hybrid search for most queries
|
|
40
|
+
- Use keyword only when searching for exact strings, rephrase key words if needed.
|
|
41
|
+
- Filter by session_type ("general" or "coding") and time_range to narrow results`, {
|
|
37
42
|
query: z
|
|
38
43
|
.string()
|
|
39
44
|
.describe("Search query: keywords or natural language description of what you are looking for"),
|
|
40
45
|
type: z
|
|
41
46
|
.enum(["keyword", "semantic", "hybrid"])
|
|
42
47
|
.optional()
|
|
43
|
-
.describe("Search type. Default:
|
|
48
|
+
.describe("Search type. Default: hybrid"),
|
|
44
49
|
time_range: z
|
|
45
50
|
.object({
|
|
46
51
|
start: z.string().describe("Start time (ISO8601)"),
|
|
@@ -61,7 +66,7 @@ Search modes:
|
|
|
61
66
|
.describe("Max results to return. Default: 5"),
|
|
62
67
|
}, async (args) => {
|
|
63
68
|
try {
|
|
64
|
-
const searchType = args.type ?? "
|
|
69
|
+
const searchType = args.type ?? "hybrid";
|
|
65
70
|
const limit = args.limit ?? 5;
|
|
66
71
|
const baseOpts = {
|
|
67
72
|
query: args.query,
|
|
@@ -70,6 +75,7 @@ Search modes:
|
|
|
70
75
|
limit,
|
|
71
76
|
};
|
|
72
77
|
let results = [];
|
|
78
|
+
let actualSearchType = searchType;
|
|
73
79
|
if (searchType === "semantic" || searchType === "hybrid") {
|
|
74
80
|
// Semantic / hybrid require async embedding generation + config
|
|
75
81
|
let config;
|
|
@@ -87,25 +93,52 @@ Search modes:
|
|
|
87
93
|
: await searchSemanticAsync(asyncOpts);
|
|
88
94
|
}
|
|
89
95
|
else {
|
|
96
|
+
actualSearchType = "keyword";
|
|
90
97
|
results = searchWakeCycles({ ...baseOpts, type: "keyword" });
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
else {
|
|
94
101
|
results = searchWakeCycles({ ...baseOpts, type: "keyword" });
|
|
95
102
|
}
|
|
103
|
+
// Auto-fallback: if keyword search returns 0 results, try hybrid
|
|
104
|
+
if (results.length === 0 &&
|
|
105
|
+
actualSearchType === "keyword" &&
|
|
106
|
+
isSemanticSearchAvailable()) {
|
|
107
|
+
let config;
|
|
108
|
+
try {
|
|
109
|
+
config = loadConfig();
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// ignore
|
|
113
|
+
}
|
|
114
|
+
if (config) {
|
|
115
|
+
actualSearchType = "hybrid";
|
|
116
|
+
results = await searchHybridAsync({
|
|
117
|
+
...baseOpts,
|
|
118
|
+
type: "hybrid",
|
|
119
|
+
config,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
96
123
|
if (results.length === 0) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
return ok(`No matching wake cycles found for query: "${args.query}"\n\nTip: Try different keywords, rephrase your query, or broaden the time range.`);
|
|
125
|
+
}
|
|
126
|
+
// Normalize relevance scores to 0-1 range for consistent display
|
|
127
|
+
const maxScore = Math.max(...results.map((r) => r.relevance_score));
|
|
128
|
+
if (maxScore > 0) {
|
|
129
|
+
for (const r of results) {
|
|
130
|
+
r.relevance_score = r.relevance_score / maxScore;
|
|
131
|
+
}
|
|
102
132
|
}
|
|
103
133
|
const lines = [];
|
|
104
|
-
const
|
|
105
|
-
?
|
|
106
|
-
:
|
|
107
|
-
|
|
108
|
-
|
|
134
|
+
const fallbackNote = actualSearchType !== searchType
|
|
135
|
+
? ` [auto-fallback from ${searchType} → ${actualSearchType}]`
|
|
136
|
+
: "";
|
|
137
|
+
const modeLabel = actualSearchType === "hybrid"
|
|
138
|
+
? ` (hybrid: keyword + semantic)${fallbackNote}`
|
|
139
|
+
: actualSearchType === "semantic"
|
|
140
|
+
? ` (semantic)${fallbackNote}`
|
|
141
|
+
: fallbackNote;
|
|
109
142
|
lines.push(`Found ${results.length} matching wake cycle(s)${modeLabel}:\n`);
|
|
110
143
|
for (const r of results) {
|
|
111
144
|
lines.push(`### ${r.wake_cycle_id}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-memory.js","sourceRoot":"","sources":["../../src/tools/transcript-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,E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UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,OAAO,GAAG,CACR,yBAAyB,IAAI,CAAC,aAAa,yDAAyD,CACrG,CAAC;QACJ,CAAC;QAED,iEAAiE;QACjE,MAAM,SAAS,GAAG,MAAM,CAAC;QACzB,MAAM,SAAS,GACb,UAAU,CAAC,MAAM,GAAG,SAAS;YAC3B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC;gBAC9B,gCAAgC,SAAS,WAAW,UAAU,CAAC,MAAM,GAAG,SAAS,kBAAkB;YACrG,CAAC,CAAC,UAAU,CAAC;QAEjB,OAAO,EAAE,CACP,sCAAsC,IAAI,CAAC,aAAa,QAAQ,SAAS,EAAE,CAC5E,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CACR,4BAA4B,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACzE,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC"}
|
package/dist-agent/bundle.cjs
CHANGED
|
@@ -20314,7 +20314,7 @@ var require_prompts3 = __commonJS({
|
|
|
20314
20314
|
|
|
20315
20315
|
// dist/utils/version-check.js
|
|
20316
20316
|
function isBundled() {
|
|
20317
|
-
const v10 = "0.1.176
|
|
20317
|
+
const v10 = "0.1.176";
|
|
20318
20318
|
return typeof v10 === "string" && v10 !== "undefined";
|
|
20319
20319
|
}
|
|
20320
20320
|
function getPackageRoot() {
|
|
@@ -20331,7 +20331,7 @@ function getInstallationInfo() {
|
|
|
20331
20331
|
};
|
|
20332
20332
|
}
|
|
20333
20333
|
function getCurrentVersion() {
|
|
20334
|
-
const bundledVersion = "0.1.176
|
|
20334
|
+
const bundledVersion = "0.1.176";
|
|
20335
20335
|
if (bundledVersion && bundledVersion !== "undefined") {
|
|
20336
20336
|
return bundledVersion;
|
|
20337
20337
|
}
|
|
@@ -969639,6 +969639,18 @@ IMPORTANT: ALWAYS VIEW YOUR MEMORY DIRECTORY BEFORE DOING ANYTHING ELSE.
|
|
|
969639
969639
|
|
|
969640
969640
|
ASSUME INTERRUPTION: Your context window might be compacted at any moment, so you risk losing any progress that is not recorded in your memory directory. Keep memory content up-to-date, coherent, and organized. Delete files that are no longer relevant.
|
|
969641
969641
|
|
|
969642
|
+
### Transcript Search (Long-term Recall)
|
|
969643
|
+
|
|
969644
|
+
Your memory files capture what you explicitly saved. But many conversations, decisions, and actions are NOT saved to memory files. Use \`memory_transcript_search\` to search the full history of past wake cycles when:
|
|
969645
|
+
- You need to recall a conversation or decision that wasn't saved to a memory file
|
|
969646
|
+
- The user asks "did we discuss X?" or "what happened with Y?" and your memory files don't have it
|
|
969647
|
+
- You want context on a topic before starting work (e.g., prior attempts, user preferences expressed in conversation)
|
|
969648
|
+
|
|
969649
|
+
**Choosing memory files vs transcript search:**
|
|
969650
|
+
- Check memory files first \u2014 they are curated and fast
|
|
969651
|
+
- Use transcript search when memory files don't have what you need, or when the user asks about past conversations specifically
|
|
969652
|
+
- Transcript search covers everything discussed, not just what was explicitly saved
|
|
969653
|
+
|
|
969642
969654
|
## Current Time
|
|
969643
969655
|
${now} (${tz})
|
|
969644
969656
|
`;
|
|
@@ -973502,11 +973514,16 @@ This searches an indexed database of wake cycle transcripts \u2014 use it when y
|
|
|
973502
973514
|
Returns lightweight summaries only (Layer 1). Use memory_transcript_detail to get more information about a specific result.
|
|
973503
973515
|
|
|
973504
973516
|
Search modes:
|
|
973505
|
-
-
|
|
973506
|
-
-
|
|
973507
|
-
-
|
|
973517
|
+
- hybrid (recommended): combines keyword + semantic for best results. Use for most queries. Example: "discussion about auth middleware rewrite"
|
|
973518
|
+
- keyword: FTS5 full-text search with BM25 ranking. Best for exact terms, identifiers, or error messages. Example: "ECONNREFUSED", "deployScript.ts"
|
|
973519
|
+
- semantic: vector similarity search (requires embeddings). Best for conceptual/meaning-based queries. Example: "when did we set up the CI pipeline"
|
|
973520
|
+
|
|
973521
|
+
Tips:
|
|
973522
|
+
- Start with hybrid search for most queries
|
|
973523
|
+
- Use keyword only when searching for exact strings, rephrase key words if needed.
|
|
973524
|
+
- Filter by session_type ("general" or "coding") and time_range to narrow results`, {
|
|
973508
973525
|
query: external_exports.string().describe("Search query: keywords or natural language description of what you are looking for"),
|
|
973509
|
-
type: external_exports.enum(["keyword", "semantic", "hybrid"]).optional().describe("Search type. Default:
|
|
973526
|
+
type: external_exports.enum(["keyword", "semantic", "hybrid"]).optional().describe("Search type. Default: hybrid"),
|
|
973510
973527
|
time_range: external_exports.object({
|
|
973511
973528
|
start: external_exports.string().describe("Start time (ISO8601)"),
|
|
973512
973529
|
end: external_exports.string().describe("End time (ISO8601)")
|
|
@@ -973515,7 +973532,7 @@ Search modes:
|
|
|
973515
973532
|
limit: external_exports.number().int().min(1).max(20).optional().describe("Max results to return. Default: 5")
|
|
973516
973533
|
}, async (args) => {
|
|
973517
973534
|
try {
|
|
973518
|
-
const searchType = args.type ?? "
|
|
973535
|
+
const searchType = args.type ?? "hybrid";
|
|
973519
973536
|
const limit2 = args.limit ?? 5;
|
|
973520
973537
|
const baseOpts = {
|
|
973521
973538
|
query: args.query,
|
|
@@ -973524,6 +973541,7 @@ Search modes:
|
|
|
973524
973541
|
limit: limit2
|
|
973525
973542
|
};
|
|
973526
973543
|
let results = [];
|
|
973544
|
+
let actualSearchType = searchType;
|
|
973527
973545
|
if (searchType === "semantic" || searchType === "hybrid") {
|
|
973528
973546
|
let config2;
|
|
973529
973547
|
try {
|
|
@@ -973534,20 +973552,41 @@ Search modes:
|
|
|
973534
973552
|
const asyncOpts = { ...baseOpts, type: searchType, config: config2 };
|
|
973535
973553
|
results = searchType === "hybrid" ? await searchHybridAsync(asyncOpts) : await searchSemanticAsync(asyncOpts);
|
|
973536
973554
|
} else {
|
|
973555
|
+
actualSearchType = "keyword";
|
|
973537
973556
|
results = searchWakeCycles({ ...baseOpts, type: "keyword" });
|
|
973538
973557
|
}
|
|
973539
973558
|
} else {
|
|
973540
973559
|
results = searchWakeCycles({ ...baseOpts, type: "keyword" });
|
|
973541
973560
|
}
|
|
973561
|
+
if (results.length === 0 && actualSearchType === "keyword" && isSemanticSearchAvailable()) {
|
|
973562
|
+
let config2;
|
|
973563
|
+
try {
|
|
973564
|
+
config2 = loadConfig();
|
|
973565
|
+
} catch {
|
|
973566
|
+
}
|
|
973567
|
+
if (config2) {
|
|
973568
|
+
actualSearchType = "hybrid";
|
|
973569
|
+
results = await searchHybridAsync({
|
|
973570
|
+
...baseOpts,
|
|
973571
|
+
type: "hybrid",
|
|
973572
|
+
config: config2
|
|
973573
|
+
});
|
|
973574
|
+
}
|
|
973575
|
+
}
|
|
973542
973576
|
if (results.length === 0) {
|
|
973543
|
-
const vecAvailable = isSemanticSearchAvailable();
|
|
973544
|
-
const hint = searchType === "keyword" && vecAvailable ? " Try type='semantic' or type='hybrid' for meaning-based search." : "";
|
|
973545
973577
|
return ok6(`No matching wake cycles found for query: "${args.query}"
|
|
973546
973578
|
|
|
973547
|
-
Tip: Try different keywords or broaden the
|
|
973579
|
+
Tip: Try different keywords, rephrase your query, or broaden the time range.`);
|
|
973580
|
+
}
|
|
973581
|
+
const maxScore = Math.max(...results.map((r10) => r10.relevance_score));
|
|
973582
|
+
if (maxScore > 0) {
|
|
973583
|
+
for (const r10 of results) {
|
|
973584
|
+
r10.relevance_score = r10.relevance_score / maxScore;
|
|
973585
|
+
}
|
|
973548
973586
|
}
|
|
973549
973587
|
const lines = [];
|
|
973550
|
-
const
|
|
973588
|
+
const fallbackNote = actualSearchType !== searchType ? ` [auto-fallback from ${searchType} \u2192 ${actualSearchType}]` : "";
|
|
973589
|
+
const modeLabel = actualSearchType === "hybrid" ? ` (hybrid: keyword + semantic)${fallbackNote}` : actualSearchType === "semantic" ? ` (semantic)${fallbackNote}` : fallbackNote;
|
|
973551
973590
|
lines.push(`Found ${results.length} matching wake cycle(s)${modeLabel}:
|
|
973552
973591
|
`);
|
|
973553
973592
|
for (const r10 of results) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visionclaw",
|
|
3
|
-
"version": "0.1.176
|
|
3
|
+
"version": "0.1.176",
|
|
4
4
|
"description": "A personal assistant agent that runs on your desktop, receives commands from messaging channels, and executes tasks autonomously.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|