personal-bot 0.3.0 → 0.3.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/bin/pbot-pi-acp.mjs +27 -11
- package/bin/pbot.mjs +1 -1
- package/docs/README.md +1 -1
- package/docs/architecture/design.md +23 -10
- package/docs/architecture/extensibility.md +20 -18
- package/docs/architecture/model-context.md +2 -2
- package/docs/architecture/principles.md +4 -3
- package/docs/guides/capabilities.md +3 -3
- package/docs/guides/history.md +50 -16
- package/docs/guides/workspace-configuration.md +31 -6
- package/docs/hosts/antigravity.md +2 -0
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/dsh.md +1 -1
- package/docs/hosts/pi.md +1 -1
- package/hooks/hooks.json +3 -0
- package/lib/antigravity-plugin/hooks.json +7 -0
- package/lib/antigravity-plugin/lib/claude.js +2 -2
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +156 -11
- package/lib/antigravity-plugin/lib/extension/{plugin-runtime.d.ts → hosts/plugin-runtime.d.ts} +2 -2
- package/lib/antigravity-plugin/lib/extension/{plugin-runtime.js → hosts/plugin-runtime.js} +34 -8
- package/lib/antigravity-plugin/lib/extension/mcp.js +1113 -78
- package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +1 -0
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +5 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +171 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/{claude.js → claude/adapter.js} +32 -4
- package/lib/antigravity-plugin/lib/integrations/hosts/{registry.js → plugin-registry.js} +2 -2
- package/lib/antigravity-plugin/lib/model/history.d.ts +169 -0
- package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +26 -0
- package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +25 -0
- package/lib/antigravity-plugin/lib/plugin.js +2 -2
- package/lib/antigravity-plugin/lib/services/history/history-capture.d.ts +4 -0
- package/lib/antigravity-plugin/lib/services/history/history-capture.js +86 -0
- package/lib/antigravity-plugin/lib/services/history/history-index.d.ts +17 -0
- package/lib/antigravity-plugin/lib/services/history/history-index.js +112 -0
- package/lib/antigravity-plugin/lib/services/history/history-migrate.d.ts +12 -0
- package/lib/antigravity-plugin/lib/services/history/history-migrate.js +88 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +121 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +124 -0
- package/lib/antigravity-plugin/lib/services/history/summary-registry.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-registry.js +36 -0
- package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +37 -0
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +301 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.d.ts +5 -1
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +75 -4
- package/lib/antigravity-plugin/lib/storage/file-access.d.ts +2 -0
- package/lib/antigravity-plugin/lib/storage/file-access.js +26 -0
- package/lib/antigravity-plugin/lib/storage/history-files.d.ts +54 -0
- package/lib/antigravity-plugin/lib/storage/history-files.js +467 -0
- package/lib/antigravity-plugin/lib/storage/history-format.d.ts +6 -0
- package/lib/antigravity-plugin/lib/storage/history-format.js +62 -0
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +22 -12
- package/lib/claude.js +2 -2
- package/lib/client.js +21 -11
- package/lib/dsh.js +4 -4
- package/lib/extension/{acp-member.d.ts → acp/member.d.ts} +5 -5
- package/lib/extension/{acp-member.js → acp/member.js} +6 -6
- package/lib/extension/acp/worker.d.ts +1 -0
- package/lib/extension/acp/worker.js +384 -0
- package/lib/extension/acp-worker.js +156 -11
- package/lib/extension/{dsh → hosts/dsh}/acp-member.js +8 -8
- package/lib/extension/hosts/dsh/command.js +92 -0
- package/lib/extension/{dsh → hosts/dsh}/files.js +3 -3
- package/lib/extension/hosts/dsh/history.d.ts +4 -0
- package/lib/extension/hosts/dsh/history.js +62 -0
- package/lib/extension/{dsh → hosts/dsh}/management.d.ts +1 -1
- package/lib/extension/{dsh → hosts/dsh}/management.js +12 -10
- package/lib/extension/{dsh → hosts/dsh}/workspace.d.ts +3 -9
- package/lib/extension/{dsh → hosts/dsh}/workspace.js +32 -70
- package/lib/extension/{plugin-runtime.d.ts → hosts/plugin-runtime.d.ts} +2 -2
- package/lib/extension/{plugin-runtime.js → hosts/plugin-runtime.js} +34 -8
- package/lib/extension/{mcp-bridge.d.ts → mcp/bridge.d.ts} +1 -1
- package/lib/extension/{mcp-bridge.js → mcp/bridge.js} +4 -4
- package/lib/extension/{mcp-workers.d.ts → mcp/workers.d.ts} +222 -2
- package/lib/extension/{mcp-workers.js → mcp/workers.js} +229 -63
- package/lib/extension/mcp.js +1113 -78
- package/lib/extension/{setup-cli.js → setup/cli.js} +9 -9
- package/lib/integrations/acp/connection.d.ts +11 -10
- package/lib/integrations/acp/connection.js +6 -0
- package/lib/integrations/acp/harnesses/claude.js +1 -1
- package/lib/integrations/acp/harnesses/dsh.js +1 -1
- package/lib/integrations/acp/history-summary.d.ts +17 -0
- package/lib/integrations/acp/history-summary.js +100 -0
- package/lib/integrations/agent-resources.d.ts +1 -0
- package/lib/integrations/agent-resources.js +5 -1
- package/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
- package/lib/integrations/hosts/antigravity/adapter.js +171 -0
- package/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
- package/lib/integrations/hosts/{claude.js → claude/adapter.js} +32 -4
- package/lib/integrations/{dsh → hosts/dsh}/mcp.d.ts +1 -1
- package/lib/integrations/{dsh → hosts/dsh}/resources.d.ts +1 -1
- package/lib/integrations/{dsh → hosts/dsh}/resources.js +4 -4
- package/lib/integrations/{dsh → hosts/dsh}/schema.js +1 -1
- package/lib/integrations/{dsh → hosts/dsh}/skills.js +1 -1
- package/lib/integrations/hosts/{registry.js → plugin-registry.js} +2 -2
- package/lib/integrations/installation/pi-setup.js +1 -1
- package/lib/model/history.d.ts +133 -34
- package/lib/model/plugin-host.d.ts +26 -0
- package/lib/model/workspace-config.d.ts +25 -0
- package/lib/plugin.js +2 -2
- package/lib/services/agents/agent-run.d.ts +1 -1
- package/lib/services/history/history-capture.d.ts +4 -0
- package/lib/services/history/history-capture.js +86 -0
- package/lib/services/history/history-index.d.ts +16 -7
- package/lib/services/history/history-index.js +48 -70
- package/lib/services/history/history-migrate.d.ts +12 -0
- package/lib/services/history/history-migrate.js +88 -0
- package/lib/services/history/history-query.d.ts +51 -0
- package/lib/services/history/history-query.js +371 -0
- package/lib/services/history/summary-command.d.ts +20 -0
- package/lib/services/history/summary-command.js +68 -0
- package/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
- package/lib/services/history/summary-dimensions/monthly.js +121 -0
- package/lib/services/history/summary-dimensions/session.d.ts +7 -0
- package/lib/services/history/summary-dimensions/session.js +124 -0
- package/lib/services/history/summary-registry.d.ts +7 -0
- package/lib/services/history/summary-registry.js +36 -0
- package/lib/services/history/summary-runner.d.ts +37 -0
- package/lib/services/history/summary-runner.js +301 -0
- package/lib/services/workspace/workspace-config.d.ts +5 -1
- package/lib/services/workspace/workspace-config.js +75 -4
- package/lib/storage/history-files.d.ts +45 -9
- package/lib/storage/history-files.js +373 -247
- package/lib/storage/history-format.d.ts +3 -12
- package/lib/storage/history-format.js +26 -50
- package/lib/tools/history/actions.d.ts +3 -68
- package/lib/tools/history/actions.js +7 -5
- package/lib/tools/history/contract.d.ts +14 -7
- package/lib/tools/history/contract.js +58 -18
- package/lib/tools/history/dsh-tool.d.ts +1 -2
- package/lib/tools/history/dsh-tool.js +11 -5
- package/lib/ui/dsh/management.js +18 -5
- package/package.json +1 -1
- package/resources/prompts/history-coordinator.md +1 -1
- package/resources/prompts/history-monthly-summary.md +13 -0
- package/resources/prompts/history-summary.md +10 -4
- package/resources/skills/provider-connections/SKILL.md +22 -12
- package/src/claude.ts +2 -2
- package/src/dsh.ts +4 -4
- package/src/extension/{acp-member.ts → acp/member.ts} +7 -7
- package/src/extension/{acp-worker.ts → acp/worker.ts} +131 -17
- package/src/extension/{dsh → hosts/dsh}/acp-member.ts +9 -9
- package/src/extension/hosts/dsh/command.ts +92 -0
- package/src/extension/{dsh → hosts/dsh}/files.ts +3 -3
- package/src/extension/hosts/dsh/history.ts +67 -0
- package/src/extension/{dsh → hosts/dsh}/management.ts +11 -9
- package/src/extension/{dsh → hosts/dsh}/workspace.ts +31 -50
- package/src/extension/{pi-acp-member.ts → hosts/pi/acp-member.ts} +9 -9
- package/src/extension/hosts/pi/command.ts +158 -0
- package/src/extension/{events.ts → hosts/pi/events.ts} +14 -4
- package/src/extension/hosts/pi/history.ts +45 -0
- package/src/extension/{lifecycle.ts → hosts/pi/lifecycle.ts} +7 -11
- package/src/extension/{plugin-runtime.ts → hosts/plugin-runtime.ts} +29 -9
- package/src/extension/{mcp-bridge.ts → mcp/bridge.ts} +5 -5
- package/src/extension/{mcp-workers.ts → mcp/workers.ts} +237 -64
- package/src/extension/{setup-cli.ts → setup/cli.ts} +11 -11
- package/src/integrations/acp/connection.ts +6 -0
- package/src/integrations/acp/harnesses/claude.ts +1 -1
- package/src/integrations/acp/harnesses/dsh.ts +1 -1
- package/src/integrations/acp/history-summary.ts +108 -0
- package/src/integrations/agent-resources.ts +6 -0
- package/src/integrations/hosts/antigravity/adapter.ts +161 -0
- package/src/integrations/hosts/{claude.ts → claude/adapter.ts} +28 -5
- package/src/integrations/{dsh → hosts/dsh}/mcp.ts +1 -1
- package/src/integrations/{dsh → hosts/dsh}/resources.ts +5 -5
- package/src/integrations/{dsh → hosts/dsh}/schema.ts +1 -1
- package/src/integrations/{dsh → hosts/dsh}/session.ts +2 -2
- package/src/integrations/{dsh → hosts/dsh}/skills.ts +1 -1
- package/src/integrations/{pi → hosts/pi}/mcp.ts +1 -1
- package/src/integrations/{pi → hosts/pi}/skills.ts +1 -1
- package/src/integrations/hosts/{registry.ts → plugin-registry.ts} +2 -2
- package/src/integrations/installation/pi-setup.ts +1 -1
- package/src/mcp.ts +1 -1
- package/src/model/history.ts +151 -26
- package/src/model/plugin-host.ts +26 -2
- package/src/model/workspace-config.ts +30 -0
- package/src/pbot.ts +13 -22
- package/src/plugin.ts +2 -2
- package/src/services/history/history-capture.ts +83 -0
- package/src/services/history/history-index.ts +48 -62
- package/src/services/history/history-migrate.ts +89 -0
- package/src/services/history/history-query.ts +415 -0
- package/src/services/history/summary-command.ts +69 -0
- package/src/services/history/summary-dimensions/monthly.ts +139 -0
- package/src/services/history/summary-dimensions/session.ts +149 -0
- package/src/services/history/summary-registry.ts +44 -0
- package/src/services/history/summary-runner.ts +352 -0
- package/src/services/workspace/workspace-config.ts +93 -5
- package/src/storage/history-files.ts +408 -188
- package/src/storage/history-format.ts +46 -60
- package/src/tools/history/actions.ts +8 -6
- package/src/tools/history/contract.ts +65 -20
- package/src/tools/history/dsh-tool.ts +17 -8
- package/src/tools/history/pi-tool.ts +21 -0
- package/src/tools/register.ts +3 -4
- package/src/ui/dsh/management.ts +27 -11
- package/src/ui/{confirmation.ts → pi/confirmation.ts} +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.d.ts +0 -4
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.js +0 -79
- package/lib/extension/dsh/command.js +0 -50
- package/lib/extension/dsh/history.d.ts +0 -15
- package/lib/extension/dsh/history.js +0 -87
- package/lib/integrations/dsh/history-summary.d.ts +0 -11
- package/lib/integrations/dsh/history-summary.js +0 -36
- package/lib/integrations/dsh/history.d.ts +0 -16
- package/lib/integrations/dsh/history.js +0 -167
- package/lib/integrations/history-summary.d.ts +0 -4
- package/lib/integrations/history-summary.js +0 -32
- package/lib/integrations/hosts/antigravity.d.ts +0 -4
- package/lib/integrations/hosts/antigravity.js +0 -79
- package/lib/services/history/history-service.d.ts +0 -106
- package/lib/services/history/history-service.js +0 -242
- package/lib/storage/acp-history.d.ts +0 -10
- package/lib/storage/acp-history.js +0 -57
- package/src/extension/command.ts +0 -76
- package/src/extension/dsh/command.ts +0 -54
- package/src/extension/dsh/history.ts +0 -74
- package/src/extension/history.ts +0 -26
- package/src/integrations/dsh/history-summary.ts +0 -39
- package/src/integrations/dsh/history.ts +0 -84
- package/src/integrations/history-summary.ts +0 -30
- package/src/integrations/hosts/antigravity.ts +0 -83
- package/src/integrations/pi/history.ts +0 -99
- package/src/services/history/history-service.ts +0 -195
- package/src/storage/acp-history.ts +0 -49
- package/src/tools/history/tool.ts +0 -19
- /package/lib/antigravity-plugin/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +0 -0
- /package/lib/{extension/acp-worker.d.ts → antigravity-plugin/lib/model/history.js} +0 -0
- /package/lib/extension/{dsh → hosts/dsh}/acp-member.d.ts +0 -0
- /package/lib/extension/{dsh → hosts/dsh}/command.d.ts +0 -0
- /package/lib/extension/{dsh → hosts/dsh}/files.d.ts +0 -0
- /package/lib/extension/{setup-guard.js → setup/guard.js} +0 -0
- /package/lib/integrations/acp/{claude.d.ts → claude-settings.d.ts} +0 -0
- /package/lib/integrations/acp/{claude.js → claude-settings.js} +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/mcp.js +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/messages.d.ts +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/messages.js +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/root-agents.d.ts +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/root-agents.js +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/schema.d.ts +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/skills.d.ts +0 -0
- /package/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +0 -0
- /package/src/extension/{setup-guard.ts → setup/guard.ts} +0 -0
- /package/src/integrations/acp/{claude.ts → claude-settings.ts} +0 -0
- /package/src/integrations/{dsh → hosts/dsh}/messages.ts +0 -0
- /package/src/integrations/{dsh → hosts/dsh}/root-agents.ts +0 -0
- /package/src/integrations/{pi → hosts/pi}/agent-tools.ts +0 -0
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { acpHistorySessions } from "../../storage/acp-history.js";
|
|
3
|
-
import { HistoryFiles } from "../../storage/history-files.js";
|
|
4
|
-
import { HistoryService } from "../../services/history/history-service.js";
|
|
5
|
-
import { DshHistory } from "../../integrations/dsh/history.js";
|
|
6
|
-
import { dshHistorySummarizer } from "../../integrations/dsh/history-summary.js";
|
|
7
|
-
import { finalDshAnswer } from "../../integrations/dsh/messages.js";
|
|
8
|
-
import { defaultWorkerDirectory } from "../mcp-workers.js";
|
|
9
|
-
/** One server-owned organizer per workspace, shared by its parent Sessions. */
|
|
10
|
-
export class DshHistoryWork {
|
|
11
|
-
ctx;
|
|
12
|
-
service;
|
|
13
|
-
#parents = new Set();
|
|
14
|
-
#controller;
|
|
15
|
-
#work;
|
|
16
|
-
#closing;
|
|
17
|
-
constructor(ctx, root) {
|
|
18
|
-
this.ctx = ctx;
|
|
19
|
-
this.service = new HistoryService(root, new HistoryFiles(join(root, ".pbot/history"), "dsh"), new DshHistory(ctx, root), [new HistoryFiles(join(root, ".pbot/history"), "pi"), new HistoryFiles(join(root, ".pbot/history"), "claude")], () => acpHistorySessions({ mcp: defaultWorkerDirectory() }));
|
|
20
|
-
}
|
|
21
|
-
attach(agent) { this.#parents.add(agent); return () => { this.#parents.delete(agent); }; }
|
|
22
|
-
cancel() { this.#controller?.abort(); }
|
|
23
|
-
schedule(agent) {
|
|
24
|
-
if (this.#closing || [...this.#parents].some(parent => parent.status !== "idle" || parent.inbox.nextTurn.length || parent.inbox.nextStep.length))
|
|
25
|
-
return;
|
|
26
|
-
this.cancel();
|
|
27
|
-
const controller = new AbortController(), selection = agent.model.current(), sessionId = agent.id;
|
|
28
|
-
this.#controller = controller;
|
|
29
|
-
const signal = controller.signal;
|
|
30
|
-
const work = (this.#work ?? Promise.resolve()).catch(() => { }).then(async () => {
|
|
31
|
-
signal.throwIfAborted();
|
|
32
|
-
await this.service.refresh({ host: "dsh", sessionId }, signal);
|
|
33
|
-
signal.throwIfAborted();
|
|
34
|
-
await this.service.organize(dshHistorySummarizer(this.ctx, selection, sessionId), signal);
|
|
35
|
-
}).catch(error => { if (!signal.aborted)
|
|
36
|
-
this.ctx.logger.warn("pbot 历史整理未完成:" + String(error)); });
|
|
37
|
-
this.#work = work;
|
|
38
|
-
void work.finally(() => { if (this.#work === work) {
|
|
39
|
-
this.#work = undefined;
|
|
40
|
-
this.#controller = undefined;
|
|
41
|
-
} });
|
|
42
|
-
}
|
|
43
|
-
close() {
|
|
44
|
-
if (this.#closing)
|
|
45
|
-
return this.#closing;
|
|
46
|
-
this.cancel();
|
|
47
|
-
this.#closing = (async () => { await this.#work; await this.service.close(); this.#parents.clear(); })();
|
|
48
|
-
return this.#closing;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export function registerDshHistoryEvents(ctx, agent, work, check) {
|
|
52
|
-
let normal = false, final = false;
|
|
53
|
-
ctx.effect(() => work.attach(agent));
|
|
54
|
-
ctx.on("session/event", (session, event) => {
|
|
55
|
-
if (session !== agent.session)
|
|
56
|
-
return;
|
|
57
|
-
if (event.type === "turn/start") {
|
|
58
|
-
normal = false;
|
|
59
|
-
final = false;
|
|
60
|
-
}
|
|
61
|
-
if (event.type === "assistant/message")
|
|
62
|
-
final = Boolean(finalDshAnswer(event).trim());
|
|
63
|
-
if (event.type === "agent/inbox/spliced" && event.data.inserted.some(message => message.source.kind === "user")) {
|
|
64
|
-
normal = false;
|
|
65
|
-
work.cancel();
|
|
66
|
-
}
|
|
67
|
-
if (event.type === "turn/end")
|
|
68
|
-
normal = event.data.reason.kind === "completed" && final;
|
|
69
|
-
});
|
|
70
|
-
ctx.on("agent/pre-step", async (_payload, next) => { work.cancel(); check(); return next(); });
|
|
71
|
-
ctx.on("agent/status", ({ agent: changed, status }) => {
|
|
72
|
-
if (changed !== agent || status !== "idle" || !normal)
|
|
73
|
-
return;
|
|
74
|
-
normal = false;
|
|
75
|
-
if (!agent.inbox.nextTurn.length && !agent.inbox.nextStep.length) {
|
|
76
|
-
try {
|
|
77
|
-
check();
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
if (error.name === "AbortError")
|
|
81
|
-
return;
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
work.schedule(agent);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
|
-
import type { SessionId } from "@deepseek-ai/dsh-session";
|
|
4
|
-
import type { HistorySummarizer } from "../../model/history.js";
|
|
5
|
-
declare module "@deepseek-ai/dsh-llm" {
|
|
6
|
-
interface LlmRequestPurposeMap {
|
|
7
|
-
"pbot-history": true;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
/** Independent text calls through the host's routing and authentication; no Agent or Session messages. */
|
|
11
|
-
export declare function dshHistorySummarizer(ctx: Context, selection: ReturnType<Agent["model"]["current"]>, sessionId: SessionId): HistorySummarizer;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BlockAssembler } from "@deepseek-ai/dsh-llm";
|
|
2
|
-
import { requireThat } from "../../common/validation.js";
|
|
3
|
-
import { reduceHistorySummary } from "../history-summary.js";
|
|
4
|
-
/** Independent text calls through the host's routing and authentication; no Agent or Session messages. */
|
|
5
|
-
export function dshHistorySummarizer(ctx, selection, sessionId) {
|
|
6
|
-
return async (request, signal) => {
|
|
7
|
-
requireThat(selection, "请先选择 dsh 模型。");
|
|
8
|
-
signal.throwIfAborted();
|
|
9
|
-
const prepare = () => ctx.llm.prepareCall({ provider: selection.provider, model: selection.model, maxTokens: request.maxTokens }, signal, (controls, model) => ({ ...controls, ...(model.reasoning?.efforts[0] ? { reasoningEffort: model.reasoning.efforts[0].id } : {}) }));
|
|
10
|
-
let first = await prepare();
|
|
11
|
-
const budget = Math.max(2000, Math.min(24000, Math.floor((first.context?.contextWindow ?? 12000) / 2)));
|
|
12
|
-
const ask = async ({ system, prompt }, signal) => {
|
|
13
|
-
signal.throwIfAborted();
|
|
14
|
-
const prepared = first ?? await prepare();
|
|
15
|
-
first = undefined;
|
|
16
|
-
const assembler = new BlockAssembler();
|
|
17
|
-
let finished = false;
|
|
18
|
-
for await (const chunk of prepared.stream({ ...prepared.config, system, sessionId, purpose: "pbot-history", signal, tools: [],
|
|
19
|
-
messages: [{ role: "user", content: [{ type: "text", text: prompt }] }] })) {
|
|
20
|
-
signal.throwIfAborted();
|
|
21
|
-
assembler.push(chunk);
|
|
22
|
-
if (chunk.type === "finish")
|
|
23
|
-
finished = true;
|
|
24
|
-
}
|
|
25
|
-
signal.throwIfAborted();
|
|
26
|
-
const reason = assembler.finish;
|
|
27
|
-
requireThat(finished && reason.kind === "stop", reason.kind === "error" || reason.kind === "aborted" ? reason.failure.message : "历史摘要未正常结束:" + reason.kind);
|
|
28
|
-
const blocks = assembler.blocks();
|
|
29
|
-
requireThat(!blocks.some(block => block.type === "tool-call"), "历史摘要不能执行工具。");
|
|
30
|
-
const answer = blocks.filter(block => block.type === "text").map(block => block.text).join("\n").trim();
|
|
31
|
-
requireThat(answer, "历史摘要为空。");
|
|
32
|
-
return answer;
|
|
33
|
-
};
|
|
34
|
-
return reduceHistorySummary(budget, ask)(request, signal);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type { SessionEvent, SessionHeader } from "@deepseek-ai/dsh-session";
|
|
3
|
-
import type { HistoryLocation, HistorySession, HistorySource } from "../../model/history.js";
|
|
4
|
-
/** Archive questions and the final/partial answer; raw tool records stay in the native log. */
|
|
5
|
-
export declare function projectDshHistory(header: SessionHeader, events: readonly SessionEvent[], name?: string): HistorySession;
|
|
6
|
-
export declare class DshHistory implements HistorySource {
|
|
7
|
-
private readonly ctx;
|
|
8
|
-
private readonly root;
|
|
9
|
-
private readonly relatedSessions;
|
|
10
|
-
readonly host = "dsh";
|
|
11
|
-
constructor(ctx: Context, root: string, relatedSessions?: () => string[]);
|
|
12
|
-
scan(location: HistoryLocation, signal?: AbortSignal, excluded?: ReadonlySet<string>): Promise<{
|
|
13
|
-
sessions: HistorySession[];
|
|
14
|
-
warnings: string[];
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
|
-
import { realpath } from "node:fs/promises";
|
|
54
|
-
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
55
|
-
import { requireThat } from "../../common/validation.js";
|
|
56
|
-
import { finalDshAnswer } from "./messages.js";
|
|
57
|
-
const text = (content) => content.flatMap(block => block.type === "text" ? [block.text] :
|
|
58
|
-
block.type === "image" ? ["[图片 " + (block.attachment.name ?? block.attachment.attachmentId) + "]"] :
|
|
59
|
-
block.type === "file" ? ["[附件 " + (block.attachment.name ?? block.attachment.attachmentId) + "]"] : []).join("\n");
|
|
60
|
-
/** Archive questions and the final/partial answer; raw tool records stay in the native log. */
|
|
61
|
-
export function projectDshHistory(header, events, name = "") {
|
|
62
|
-
const exchanges = [], supersededEntryIds = [];
|
|
63
|
-
let users = [], answer, observed = [];
|
|
64
|
-
const finish = (completed = false) => {
|
|
65
|
-
if (users.length) {
|
|
66
|
-
const entries = [...users, ...(answer ? [answer] : [])];
|
|
67
|
-
const body = answer ? answer.data.message.content.filter(block => block.type === "text").map(block => block.text).join("\n") : "";
|
|
68
|
-
exchanges.push({ entryIds: entries.map(event => "dsh:" + event.seq), from: new Date(users[0].time).toISOString(),
|
|
69
|
-
to: new Date(entries.at(-1).time).toISOString(),
|
|
70
|
-
completed: completed && Boolean(answer && finalDshAnswer(answer).trim()),
|
|
71
|
-
text: users.map(event => (event.data.source.kind === "user" ? "用户:\n" : "协调者要求:\n") + text(event.data.content)).join("\n\n") +
|
|
72
|
-
(body ? "\n\n助手:\n" + body : "") });
|
|
73
|
-
}
|
|
74
|
-
const last = (answer ?? users.at(-1))?.seq;
|
|
75
|
-
supersededEntryIds.push(...observed.filter(id => id !== "dsh:" + last));
|
|
76
|
-
users = [];
|
|
77
|
-
answer = undefined;
|
|
78
|
-
observed = [];
|
|
79
|
-
};
|
|
80
|
-
for (const event of events) {
|
|
81
|
-
if (event.type === "turn/start")
|
|
82
|
-
finish();
|
|
83
|
-
else if (event.type === "user/message" && ["user", "pbot-input"].includes(event.data.source.kind)) {
|
|
84
|
-
if (!answer)
|
|
85
|
-
observed.push("dsh:" + event.seq);
|
|
86
|
-
users.push(event);
|
|
87
|
-
}
|
|
88
|
-
else if (event.type === "assistant/message" && users.length) {
|
|
89
|
-
answer = event;
|
|
90
|
-
observed.push("dsh:" + event.seq);
|
|
91
|
-
}
|
|
92
|
-
else if (event.type === "turn/end")
|
|
93
|
-
finish(event.data.reason.kind === "completed");
|
|
94
|
-
}
|
|
95
|
-
finish();
|
|
96
|
-
return { sessionId: header.id, name, branches: exchanges.length ? [exchanges] : [], supersededEntryIds };
|
|
97
|
-
}
|
|
98
|
-
export class DshHistory {
|
|
99
|
-
ctx;
|
|
100
|
-
root;
|
|
101
|
-
relatedSessions;
|
|
102
|
-
host = "dsh";
|
|
103
|
-
constructor(ctx, root, relatedSessions = () => []) {
|
|
104
|
-
this.ctx = ctx;
|
|
105
|
-
this.root = root;
|
|
106
|
-
this.relatedSessions = relatedSessions;
|
|
107
|
-
}
|
|
108
|
-
async scan(location, signal, excluded) {
|
|
109
|
-
requireThat(location.host === "dsh", "dsh 历史只读取 dsh 原生会话。");
|
|
110
|
-
signal?.throwIfAborted();
|
|
111
|
-
const records = (await this.ctx.sessionQuery.listSessions(signal)).filter(record => !excluded?.has(record.header.id));
|
|
112
|
-
const selected = new Set(), warnings = [];
|
|
113
|
-
// Expert records also name ACP members and sessions that dsh no longer stores; only real dsh sessions are readable.
|
|
114
|
-
const stored = new Set(records.map(record => record.header.id));
|
|
115
|
-
try {
|
|
116
|
-
for (const id of this.relatedSessions())
|
|
117
|
-
if (stored.has(id))
|
|
118
|
-
selected.add(id);
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
warnings.push("专家引用:" + String(error));
|
|
122
|
-
}
|
|
123
|
-
if (location.sessionId && !excluded?.has(location.sessionId))
|
|
124
|
-
selected.add(location.sessionId);
|
|
125
|
-
for (const record of records) {
|
|
126
|
-
signal?.throwIfAborted();
|
|
127
|
-
if ((record.header.origin !== "subagent" || !record.header.parentSession) && record.header.cwd &&
|
|
128
|
-
await realpath(record.header.cwd).catch(() => record.header.cwd) === this.root)
|
|
129
|
-
selected.add(record.header.id);
|
|
130
|
-
}
|
|
131
|
-
// Native subagents may use a different cwd while still belonging to a workspace's parent.
|
|
132
|
-
for (let changed = true; changed;) {
|
|
133
|
-
changed = false;
|
|
134
|
-
for (const record of records)
|
|
135
|
-
if (record.header.origin === "subagent" && record.header.parentSession && selected.has(record.header.parentSession) && !selected.has(record.header.id)) {
|
|
136
|
-
selected.add(record.header.id);
|
|
137
|
-
changed = true;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
const sessions = [];
|
|
141
|
-
for (const id of selected) {
|
|
142
|
-
signal?.throwIfAborted();
|
|
143
|
-
try {
|
|
144
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
145
|
-
try {
|
|
146
|
-
const observation = __addDisposableResource(env_1, await this.ctx.sessionQuery.observeSession(SessionId(id), { ...(signal ? { signal } : {}), projectionMode: "none" }), false);
|
|
147
|
-
const title = await this.ctx.sessionQuery.readTitle(SessionId(id), signal);
|
|
148
|
-
const session = projectDshHistory(observation.header, observation.events, title?.title);
|
|
149
|
-
if (session.branches.length)
|
|
150
|
-
sessions.push(session);
|
|
151
|
-
}
|
|
152
|
-
catch (e_1) {
|
|
153
|
-
env_1.error = e_1;
|
|
154
|
-
env_1.hasError = true;
|
|
155
|
-
}
|
|
156
|
-
finally {
|
|
157
|
-
__disposeResources(env_1);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
signal?.throwIfAborted();
|
|
162
|
-
warnings.push(id + ": " + String(error));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return { sessions, warnings };
|
|
166
|
-
}
|
|
167
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { HistorySummarizer } from "../model/history.js";
|
|
2
|
-
/** Split Pi/dsh summary inputs within the model's character budget. */
|
|
3
|
-
export declare function splitHistorySummary(text: string, budget: number): string[];
|
|
4
|
-
export declare function reduceHistorySummary(budget: number, ask: HistorySummarizer): HistorySummarizer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** Split Pi/dsh summary inputs within the model's character budget. */
|
|
2
|
-
export function splitHistorySummary(text, budget) {
|
|
3
|
-
if (!Number.isInteger(budget) || budget < 2)
|
|
4
|
-
throw new Error("历史摘要分段预算无效。");
|
|
5
|
-
const parts = [];
|
|
6
|
-
for (let offset = 0; offset < text.length;) {
|
|
7
|
-
let end = Math.min(text.length, offset + budget);
|
|
8
|
-
if (end < text.length && /[\uD800-\uDBFF]/.test(text[end - 1]))
|
|
9
|
-
end--;
|
|
10
|
-
parts.push(text.slice(offset, end));
|
|
11
|
-
offset = end;
|
|
12
|
-
}
|
|
13
|
-
return parts;
|
|
14
|
-
}
|
|
15
|
-
export function reduceHistorySummary(budget, ask) {
|
|
16
|
-
return async (request, signal) => {
|
|
17
|
-
let text = request.prompt;
|
|
18
|
-
while (text.length > budget) {
|
|
19
|
-
const parts = [];
|
|
20
|
-
for (const prompt of splitHistorySummary(text, budget)) {
|
|
21
|
-
signal.throwIfAborted();
|
|
22
|
-
parts.push(await ask({ ...request, prompt }, signal));
|
|
23
|
-
}
|
|
24
|
-
const smaller = parts.join("\n\n");
|
|
25
|
-
if (smaller.length >= text.length)
|
|
26
|
-
throw new Error("历史摘要未缩短,稍后重试。");
|
|
27
|
-
text = smaller;
|
|
28
|
-
}
|
|
29
|
-
signal.throwIfAborted();
|
|
30
|
-
return ask({ ...request, prompt: text }, signal);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { PluginHostAdapter } from "../../model/plugin-host.js";
|
|
2
|
-
export declare function antigravityWorkspaceRoot(cwd: string, payload?: unknown): Promise<string>;
|
|
3
|
-
export declare const antigravityAdapter: PluginHostAdapter;
|
|
4
|
-
export declare const antigravitySkillPath: (pluginRoot: string, skill: string) => string;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { realpath, stat } from "node:fs/promises";
|
|
2
|
-
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { object } from "../../common/json.js";
|
|
4
|
-
import { resourceRoot } from "../../common/paths.js";
|
|
5
|
-
import { requireThat } from "../../common/validation.js";
|
|
6
|
-
const supportedEvents = ["SessionStart", "PreToolUse"];
|
|
7
|
-
function workspaceFromPayload(cwd, payload) {
|
|
8
|
-
if (object(payload) && Array.isArray(payload.workspacePaths)) {
|
|
9
|
-
const first = payload.workspacePaths.find(value => typeof value === "string" && value.length > 0);
|
|
10
|
-
if (typeof first === "string")
|
|
11
|
-
return first;
|
|
12
|
-
}
|
|
13
|
-
return cwd;
|
|
14
|
-
}
|
|
15
|
-
function skillFromReadPath(targetPath, pluginRoot = process.env.PLUGIN_ROOT || resolve(resourceRoot, "..")) {
|
|
16
|
-
const skillsRoot = resolve(pluginRoot, "skills");
|
|
17
|
-
const rel = relative(skillsRoot, resolve(targetPath));
|
|
18
|
-
if (!rel || rel.startsWith("..") || isAbsolute(rel))
|
|
19
|
-
return undefined;
|
|
20
|
-
const skill = rel.split(sep)[0];
|
|
21
|
-
if (!skill || skill === "pbot")
|
|
22
|
-
return undefined;
|
|
23
|
-
return skill;
|
|
24
|
-
}
|
|
25
|
-
function isPreToolUse(payload) {
|
|
26
|
-
return object(payload) && payload.hookEventName === "PreToolUse";
|
|
27
|
-
}
|
|
28
|
-
export async function antigravityWorkspaceRoot(cwd, payload) {
|
|
29
|
-
const directory = workspaceFromPayload(cwd, payload);
|
|
30
|
-
requireThat(isAbsolute(directory), "Antigravity 工作区需要绝对路径。");
|
|
31
|
-
const root = await realpath(directory);
|
|
32
|
-
requireThat((await stat(root)).isDirectory(), "Antigravity 工作区需要目录。");
|
|
33
|
-
return root;
|
|
34
|
-
}
|
|
35
|
-
export const antigravityAdapter = {
|
|
36
|
-
host: "antigravity",
|
|
37
|
-
nativeRootAgents: true,
|
|
38
|
-
nativeWorkspaceSkills: true,
|
|
39
|
-
coordinatorPrompt: "plugin-coordinator.md",
|
|
40
|
-
initCommandHint: "/pbot init",
|
|
41
|
-
usage: "用法:node <插件目录>/lib/plugin.js antigravity init|status",
|
|
42
|
-
resolveRoot(cwd, rawPayload) {
|
|
43
|
-
return antigravityWorkspaceRoot(cwd, rawPayload);
|
|
44
|
-
},
|
|
45
|
-
parseEvent(value) {
|
|
46
|
-
requireThat(object(value) && typeof value.hookEventName === "string", "Antigravity hook 输入无效。");
|
|
47
|
-
const event = value.hookEventName;
|
|
48
|
-
requireThat(supportedEvents.includes(event), "Antigravity hook 事件未支持。");
|
|
49
|
-
const cwd = typeof value.cwd === "string" && value.cwd ? value.cwd : workspaceFromPayload("", value);
|
|
50
|
-
requireThat(cwd, "Antigravity hook 缺少工作目录。");
|
|
51
|
-
if (event === "SessionStart") {
|
|
52
|
-
return { kind: "inject-context", role: "coordinator", cwd, raw: value };
|
|
53
|
-
}
|
|
54
|
-
if (!object(value.toolCall) || typeof value.toolCall.name !== "string" || !object(value.toolCall.args)) {
|
|
55
|
-
return { kind: "ignore" };
|
|
56
|
-
}
|
|
57
|
-
const { name, args } = value.toolCall;
|
|
58
|
-
if (name === "read_file" && typeof args.Path === "string") {
|
|
59
|
-
const skill = skillFromReadPath(args.Path);
|
|
60
|
-
if (skill)
|
|
61
|
-
return { kind: "check-skill", skill, cwd, raw: value };
|
|
62
|
-
}
|
|
63
|
-
return { kind: "ignore" };
|
|
64
|
-
},
|
|
65
|
-
formatPass(payload) {
|
|
66
|
-
return isPreToolUse(payload) ? { decision: "allow" } : {};
|
|
67
|
-
},
|
|
68
|
-
formatContext(_event, context) {
|
|
69
|
-
return {
|
|
70
|
-
injectSteps: [
|
|
71
|
-
{ systemMessage: { systemMessage: context.text } },
|
|
72
|
-
],
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
formatDeny(_event, reason) {
|
|
76
|
-
return { decision: "deny", reason };
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
export const antigravitySkillPath = (pluginRoot, skill) => join(pluginRoot, "skills", skill, "SKILL.md");
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { HistoryHost, HistoryIdentity, HistoryLocation, HistoryNode, HistoryRecord, HistorySource, HistorySummarizer } from "../../model/history.js";
|
|
2
|
-
import type { HistoryFiles } from "../../storage/history-files.js";
|
|
3
|
-
export interface HistoryQuery {
|
|
4
|
-
host?: HistoryHost;
|
|
5
|
-
query?: string;
|
|
6
|
-
sessionId?: string;
|
|
7
|
-
from?: string;
|
|
8
|
-
to?: string;
|
|
9
|
-
offset?: number;
|
|
10
|
-
limit?: number;
|
|
11
|
-
}
|
|
12
|
-
type HistoryReader = Pick<HistoryFiles, "host" | "list" | "warnings">;
|
|
13
|
-
/** Validate the exact target and ordered inputs under the source lock. Only publish the derived file. */
|
|
14
|
-
export declare function commitHistorySummary(files: Pick<HistoryFiles, "control" | "list" | "saveSummaries">, identity: HistoryIdentity, expected: HistoryNode, children: readonly HistoryNode[], text: string, signal?: AbortSignal): HistoryRecord | undefined;
|
|
15
|
-
export declare class HistoryService {
|
|
16
|
-
#private;
|
|
17
|
-
readonly root: string;
|
|
18
|
-
private readonly files;
|
|
19
|
-
private readonly source;
|
|
20
|
-
private readonly otherFiles;
|
|
21
|
-
private readonly acpSessions?;
|
|
22
|
-
constructor(root: string, files: HistoryFiles, source: HistorySource, otherFiles?: readonly HistoryReader[], acpSessions?: (() => {
|
|
23
|
-
ids: Record<HistoryHost, ReadonlySet<string>>;
|
|
24
|
-
warnings: string[];
|
|
25
|
-
}) | undefined);
|
|
26
|
-
check(): void;
|
|
27
|
-
get warnings(): string[];
|
|
28
|
-
get status(): {
|
|
29
|
-
loaded: boolean;
|
|
30
|
-
organizing: boolean;
|
|
31
|
-
pending: number | null;
|
|
32
|
-
warnings: string[];
|
|
33
|
-
};
|
|
34
|
-
refresh(location: HistoryLocation, signal?: AbortSignal): Promise<void>;
|
|
35
|
-
private load;
|
|
36
|
-
search({ host, query, sessionId, from, to, offset, limit }?: HistoryQuery): {
|
|
37
|
-
matches: {
|
|
38
|
-
parents: string[];
|
|
39
|
-
snippet: string;
|
|
40
|
-
host: HistoryHost;
|
|
41
|
-
id: string;
|
|
42
|
-
kind: "session" | "exchange" | "summary";
|
|
43
|
-
sessionId: string;
|
|
44
|
-
name: string;
|
|
45
|
-
preview: string;
|
|
46
|
-
from: string;
|
|
47
|
-
to: string;
|
|
48
|
-
ready: boolean;
|
|
49
|
-
completed: boolean;
|
|
50
|
-
}[];
|
|
51
|
-
total: number;
|
|
52
|
-
nextOffset: number | null;
|
|
53
|
-
warnings: string[];
|
|
54
|
-
};
|
|
55
|
-
private find;
|
|
56
|
-
read(id: string, offset?: number, limit?: number, childrenOffset?: number, host?: HistoryHost): {
|
|
57
|
-
text: string;
|
|
58
|
-
totalLength: number;
|
|
59
|
-
nextOffset: number | null;
|
|
60
|
-
parents: {
|
|
61
|
-
host: HistoryHost;
|
|
62
|
-
id: string;
|
|
63
|
-
kind: "session" | "exchange" | "summary";
|
|
64
|
-
sessionId: string;
|
|
65
|
-
name: string;
|
|
66
|
-
preview: string;
|
|
67
|
-
from: string;
|
|
68
|
-
to: string;
|
|
69
|
-
ready: boolean;
|
|
70
|
-
completed: boolean;
|
|
71
|
-
}[];
|
|
72
|
-
children: {
|
|
73
|
-
host: HistoryHost;
|
|
74
|
-
id: string;
|
|
75
|
-
kind: "session" | "exchange" | "summary";
|
|
76
|
-
sessionId: string;
|
|
77
|
-
name: string;
|
|
78
|
-
preview: string;
|
|
79
|
-
from: string;
|
|
80
|
-
to: string;
|
|
81
|
-
ready: boolean;
|
|
82
|
-
completed: boolean;
|
|
83
|
-
}[];
|
|
84
|
-
nextChildrenOffset: number | null;
|
|
85
|
-
source: {
|
|
86
|
-
host: HistoryHost;
|
|
87
|
-
sessionId: string;
|
|
88
|
-
entryIds: string[];
|
|
89
|
-
};
|
|
90
|
-
warnings: string[];
|
|
91
|
-
host: HistoryHost;
|
|
92
|
-
id: string;
|
|
93
|
-
kind: "session" | "exchange" | "summary";
|
|
94
|
-
sessionId: string;
|
|
95
|
-
name: string;
|
|
96
|
-
preview: string;
|
|
97
|
-
from: string;
|
|
98
|
-
to: string;
|
|
99
|
-
ready: boolean;
|
|
100
|
-
completed: boolean;
|
|
101
|
-
};
|
|
102
|
-
/** Retain exact inputs only for this call; model work never holds the source write lock. */
|
|
103
|
-
organize(summarize: HistorySummarizer, signal: AbortSignal): Promise<void>;
|
|
104
|
-
close(): Promise<void>;
|
|
105
|
-
}
|
|
106
|
-
export {};
|