pi-firecode 1.0.0 → 1.0.2
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 +59 -41
- package/README.zh-CN.md +78 -0
- package/config.example.jsonc +21 -22
- package/dist/config.example.jsonc +90 -0
- package/dist/index.js +11443 -0
- package/dist/master/prompts/master.en.md +22 -0
- package/{master → dist/master}/prompts/master.zh.md +3 -3
- package/dist/master/prompts/worker.en.md +1 -0
- package/dist/watcher/prompts/watch.en.md +43 -0
- package/package.json +10 -27
- package/activity.ts +0 -92
- package/busy.ts +0 -188
- package/config.ts +0 -500
- package/deliver.ts +0 -119
- package/flame.ts +0 -149
- package/format.ts +0 -133
- package/header.ts +0 -218
- package/herdr-client.ts +0 -60
- package/index.ts +0 -68
- package/jsonc.ts +0 -34
- package/master/actions.ts +0 -293
- package/master/activity-list.ts +0 -281
- package/master/event-card.ts +0 -87
- package/master/event-format.ts +0 -83
- package/master/guard.ts +0 -46
- package/master/index.ts +0 -252
- package/master/list-view.ts +0 -129
- package/master/outbox.ts +0 -188
- package/master/prompt.ts +0 -26
- package/master/role.ts +0 -18
- package/master/run.ts +0 -315
- package/master/runtime.ts +0 -259
- package/master/spawn.ts +0 -234
- package/master/state.ts +0 -225
- package/master/worker-view.ts +0 -517
- package/provider/claude-sub.ts +0 -151
- package/provider/openai-native/index.ts +0 -8
- package/provider/openai-native/src/compact-client.ts +0 -350
- package/provider/openai-native/src/config.ts +0 -297
- package/provider/openai-native/src/extension.ts +0 -93
- package/provider/openai-native/src/native-compaction.ts +0 -151
- package/provider/openai-native/src/native-details.ts +0 -157
- package/provider/openai-native/src/native-replay.ts +0 -253
- package/provider/openai-native/src/native-runtime.ts +0 -144
- package/provider/openai-native/src/options.ts +0 -87
- package/provider/openai-native/src/request-pipeline.ts +0 -21
- package/provider/openai-native/src/responses-input.ts +0 -433
- package/review/advisor.ts +0 -110
- package/review/card.ts +0 -398
- package/review/checkpoint.ts +0 -378
- package/review/evidence.ts +0 -230
- package/review/index.ts +0 -992
- package/review/occupancy.ts +0 -25
- package/review/outcome.ts +0 -98
- package/review/prompt.ts +0 -209
- package/review/reviewer.ts +0 -353
- package/review/session.ts +0 -110
- package/review/state.ts +0 -877
- package/review/ui.ts +0 -89
- package/round-recorder.ts +0 -18
- package/session/herdr-display.ts +0 -87
- package/session/presets.ts +0 -300
- package/session/quota.ts +0 -123
- package/session/rename.ts +0 -46
- package/session/stats.ts +0 -313
- package/statusbar/index.ts +0 -256
- package/statusbar/render.ts +0 -113
- package/theme.ts +0 -45
- package/tools/actions.ts +0 -53
- package/tools/assistant-view.ts +0 -64
- package/tools/click-anchor.ts +0 -56
- package/tools/group-view.ts +0 -420
- package/tools/grouping.ts +0 -158
- package/tools/host.ts +0 -369
- package/tools/index.ts +0 -186
- package/tools/line.ts +0 -231
- package/tools/machine.ts +0 -78
- package/tools/parts.ts +0 -143
- package/tools/round.ts +0 -95
- package/tools/timing.ts +0 -22
- package/tools/turn-clock.ts +0 -41
- package/tools/turn-summary.ts +0 -109
- package/truncated-write.ts +0 -18
- package/watcher/card.ts +0 -91
- package/watcher/index.ts +0 -176
- package/watcher/observer.ts +0 -75
- package/watcher/transcript.ts +0 -56
- /package/{master → dist/master}/prompts/worker.zh.md +0 -0
- /package/{review → dist/review}/prompts/advisor.en.md +0 -0
- /package/{review → dist/review}/prompts/advisor.zh.md +0 -0
- /package/{review → dist/review}/prompts/review.en.md +0 -0
- /package/{review → dist/review}/prompts/review.zh.md +0 -0
- /package/{watcher → dist/watcher}/prompts/watch.zh.md +0 -0
package/watcher/transcript.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 主会话回合的增量渲染:喂给观察会话的唯一素材,纯函数。
|
|
3
|
-
* minimal 省略 reasoning 与 diff 展开正文——观察员要的是「在做什么」,正文可以自己去读。
|
|
4
|
-
*/
|
|
5
|
-
import type { TurnEndEvent } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import type { WatcherContext } from "../config.js";
|
|
7
|
-
import { textOf } from "../format.js";
|
|
8
|
-
|
|
9
|
-
const RESULT_BUDGET = 400;
|
|
10
|
-
|
|
11
|
-
export function renderTurn(turn: TurnEndEvent, context: WatcherContext): string {
|
|
12
|
-
const lines: string[] = [];
|
|
13
|
-
const content = "content" in turn.message ? turn.message.content : undefined;
|
|
14
|
-
for (const part of blocks(content)) {
|
|
15
|
-
if (part.type === "text" && typeof part.text === "string" && part.text.trim())
|
|
16
|
-
lines.push(part.text.trim());
|
|
17
|
-
if (part.type === "thinking" && context === "full" && typeof part.thinking === "string")
|
|
18
|
-
lines.push(`(思考)${part.thinking.trim()}`);
|
|
19
|
-
if (part.type === "toolCall") lines.push(toolCallLine(part, context));
|
|
20
|
-
}
|
|
21
|
-
for (const result of turn.toolResults) {
|
|
22
|
-
const text = clipText(textOf(result.content), RESULT_BUDGET);
|
|
23
|
-
lines.push(`${result.isError ? "✗" : "→"} ${result.toolName}:${text || "(无输出)"}`);
|
|
24
|
-
}
|
|
25
|
-
return `<turn index="${turn.turnIndex}">\n${lines.join("\n")}\n</turn>`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function toolCallLine(part: Record<string, any>, context: WatcherContext): string {
|
|
29
|
-
const args = part.arguments && typeof part.arguments === "object" ? part.arguments : {};
|
|
30
|
-
const summary = Object.entries(args as Record<string, unknown>)
|
|
31
|
-
.map(([key, value]) => `${key}=${clipText(argumentText(key, value, context), 200)}`)
|
|
32
|
-
.join(" ");
|
|
33
|
-
return `· ${part.name ?? "工具"} ${summary}`.trimEnd();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** minimal 下 edit/write 的正文(新旧内容)只留长度:观察员判断的是动作,不是逐字 diff。 */
|
|
37
|
-
function argumentText(key: string, value: unknown, context: WatcherContext): string {
|
|
38
|
-
const text = typeof value === "string" ? value : JSON.stringify(value) ?? "";
|
|
39
|
-
if (context === "full") return oneLine(text);
|
|
40
|
-
return BODY_KEYS.has(key) ? `<${text.length} 字符>` : oneLine(text);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const BODY_KEYS = new Set(["content", "oldText", "newText", "old_text", "new_text", "edits"]);
|
|
44
|
-
|
|
45
|
-
function blocks(content: unknown): Array<Record<string, any>> {
|
|
46
|
-
return Array.isArray(content) ? content.filter((part) => !!part && typeof part === "object") : [];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function oneLine(text: string): string {
|
|
50
|
-
return text.replace(/\s+/gu, " ").trim();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function clipText(text: string, budget: number): string {
|
|
54
|
-
const single = oneLine(text);
|
|
55
|
-
return single.length > budget ? `${single.slice(0, budget)}…` : single;
|
|
56
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|