@xrkseek/harness 0.7.8 → 0.7.10
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/node_modules/@xrkseek/core-tools/dist/output-bound.d.ts +4 -1
- package/node_modules/@xrkseek/core-tools/dist/output-bound.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/output-bound.js +19 -5
- package/node_modules/@xrkseek/core-tools/dist/output-bound.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js +2 -2
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts +2 -2
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.js +2 -2
- package/node_modules/@xrkseek/exec-memory/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/layered.d.ts +20 -3
- package/node_modules/@xrkseek/exec-memory/dist/layered.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/layered.js +46 -17
- package/node_modules/@xrkseek/exec-memory/dist/layered.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/store.d.ts +17 -0
- package/node_modules/@xrkseek/exec-memory/dist/store.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/store.js +35 -14
- package/node_modules/@xrkseek/exec-memory/dist/store.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/tools.js +20 -8
- package/node_modules/@xrkseek/exec-memory/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/edge-tts.d.ts +60 -0
- package/node_modules/@xrkseek/exec-voice/dist/edge-tts.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/edge-tts.js +393 -0
- package/node_modules/@xrkseek/exec-voice/dist/edge-tts.js.map +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.js +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/engine-ids.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/engines.d.ts +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/engines.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/engines.js +19 -1
- package/node_modules/@xrkseek/exec-voice/dist/engines.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/format.js +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/format.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/index.js +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/openai-http.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/openai-http.js +1 -0
- package/node_modules/@xrkseek/exec-voice/dist/openai-http.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.d.ts +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.js +13 -1
- package/node_modules/@xrkseek/exec-voice/dist/readiness.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.js +6 -5
- package/node_modules/@xrkseek/exec-voice/dist/sensevoice-local.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.d.ts +2 -0
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.js +10 -7
- package/node_modules/@xrkseek/exec-voice/dist/system-tts.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/tools.d.ts +19 -0
- package/node_modules/@xrkseek/exec-voice/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/tools.js +160 -25
- package/node_modules/@xrkseek/exec-voice/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.d.ts +12 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-voice/dist/types.js +6 -0
- package/node_modules/@xrkseek/exec-voice/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-voice/package.json +7 -2
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +5 -0
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js +13 -6
- package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.js +14 -2
- package/node_modules/@xrkseek/preset-server/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-home-boundary.d.ts +14 -0
- package/node_modules/@xrkseek/server-face/dist/agent-home-boundary.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-home-boundary.js +40 -0
- package/node_modules/@xrkseek/server-face/dist/agent-home-boundary.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-member-pack.d.ts +21 -1
- package/node_modules/@xrkseek/server-face/dist/agent-member-pack.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-member-pack.js +29 -1
- package/node_modules/@xrkseek/server-face/dist/agent-member-pack.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-roster-tools.js +4 -4
- package/node_modules/@xrkseek/server-face/dist/agent-roster-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.js +30 -15
- package/node_modules/@xrkseek/server-face/dist/agent-team-roles.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/canvas-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/canvas-tools.js +2 -1
- package/node_modules/@xrkseek/server-face/dist/canvas-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.js +32 -5
- package/node_modules/@xrkseek/server-face/dist/handlers/voice.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js +1 -0
- package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js +18 -8
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.js +12 -0
- package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-attachment.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-attachment.js +60 -5
- package/node_modules/@xrkseek/server-face/dist/session-attachment.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-capability.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-capability.js +45 -19
- package/node_modules/@xrkseek/server-face/dist/session-capability.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-thread-tools.d.ts +2 -2
- package/node_modules/@xrkseek/server-face/dist/session-thread-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-thread-tools.js +5 -38
- package/node_modules/@xrkseek/server-face/dist/session-thread-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.js +6 -2
- package/node_modules/@xrkseek/server-face/dist/session-tool-copy.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-tools.js +0 -2
- package/node_modules/@xrkseek/server-face/dist/session-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +40 -7
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts +2 -2
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js +15 -56
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/tts-availability.d.ts +33 -0
- package/node_modules/@xrkseek/server-face/dist/tts-availability.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/tts-availability.js +67 -0
- package/node_modules/@xrkseek/server-face/dist/tts-availability.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.js +58 -18
- package/node_modules/@xrkseek/server-face/dist/workspace-orchestrate-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/xiangyang-skill-bodies/mainline-sideline.d.ts +1 -1
- package/node_modules/@xrkseek/server-face/dist/xiangyang-skill-bodies/mainline-sideline.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/xiangyang-skill-bodies/mainline-sideline.js +1 -1
- package/node_modules/@xrkseek/server-host/dist/im-reply-tool.d.ts +5 -1
- package/node_modules/@xrkseek/server-host/dist/im-reply-tool.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/im-reply-tool.js +1 -1
- package/node_modules/@xrkseek/server-host/dist/im-reply-tool.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts +5 -0
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +79 -8
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/durable-inject.d.ts +10 -4
- package/node_modules/@xrkseek/workspace/dist/durable-inject.d.ts.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/durable-inject.js +26 -8
- package/node_modules/@xrkseek/workspace/dist/durable-inject.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/skill-tools.js +1 -1
- package/node_modules/@xrkseek/workspace/dist/skill-tools.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/skills.d.ts +1 -1
- package/node_modules/@xrkseek/workspace/dist/skills.d.ts.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/skills.js +2 -2
- package/node_modules/@xrkseek/workspace/dist/skills.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/standing-skill-dirs.d.ts.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/standing-skill-dirs.js +1 -7
- package/node_modules/@xrkseek/workspace/dist/standing-skill-dirs.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,10 @@ export interface BoundToolOutputOptions extends ToolOutputBoundLimits {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Bound model-visible tool text. Pure aside from optional `persist`.
|
|
33
|
-
* Image-bearing ContentBlock[] results are left intact
|
|
33
|
+
* Image- and file-bearing ContentBlock[] results are left intact: flattening
|
|
34
|
+
* them would destroy the durable reference the client needs (a `file` block is
|
|
35
|
+
* a deliverable, not prose). Model routes re-project blocks to handle text
|
|
36
|
+
* later (`projectFilesToText`), so nothing leaks raw bytes into a request.
|
|
34
37
|
*/
|
|
35
38
|
export declare function boundToolOutput(content: MessageContent, options?: BoundToolOutputOptions): Promise<BoundToolOutputResult>;
|
|
36
39
|
/** In-memory persist for tests / ephemeral hosts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-bound.d.ts","sourceRoot":"","sources":["../src/output-bound.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AACnD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtE;AA2FD
|
|
1
|
+
{"version":3,"file":"output-bound.d.ts","sourceRoot":"","sources":["../src/output-bound.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AACnD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtE;AA2FD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAsDhC;AAED,qDAAqD;AACrD,wBAAgB,6BAA6B,CAAC,MAAM,SAAuB;qBAItD,MAAM,GAAG,MAAM;aAKvB,MAAM,GAAG,MAAM,GAAG,SAAS;;EAOvC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Model-facing tool output bounding (OpenCode ToolOutputStore.bound semantics).
|
|
3
3
|
* Domain tools may return full text; this layer truncates what the model / session log sees.
|
|
4
4
|
*/
|
|
5
|
-
import { contentHasImage, flattenText } from "@xrkseek/protocol";
|
|
5
|
+
import { contentHasFile, contentHasImage, flattenText } from "@xrkseek/protocol";
|
|
6
6
|
export const DEFAULT_TOOL_OUTPUT_MAX_LINES = 2_000;
|
|
7
7
|
/**
|
|
8
8
|
* Shared UTF-8 inline ceiling with agent-loop spill
|
|
@@ -87,17 +87,31 @@ function boundedPreview(text, marker, maxLines, maxBytes) {
|
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Bound model-visible tool text. Pure aside from optional `persist`.
|
|
90
|
-
* Image-bearing ContentBlock[] results are left intact
|
|
90
|
+
* Image- and file-bearing ContentBlock[] results are left intact: flattening
|
|
91
|
+
* them would destroy the durable reference the client needs (a `file` block is
|
|
92
|
+
* a deliverable, not prose). Model routes re-project blocks to handle text
|
|
93
|
+
* later (`projectFilesToText`), so nothing leaks raw bytes into a request.
|
|
91
94
|
*/
|
|
92
95
|
export async function boundToolOutput(content, options = {}) {
|
|
93
96
|
if (typeof content !== "string") {
|
|
94
|
-
if (contentHasImage(content)) {
|
|
97
|
+
if (contentHasImage(content) || contentHasFile(content)) {
|
|
98
|
+
// The durable blocks pass through untouched, but the text beside them is
|
|
99
|
+
// still content. Reporting 0 bytes made every image / file result read as
|
|
100
|
+
// "produced nothing" to callers that key on `originalBytes`.
|
|
101
|
+
let textBytes = 0;
|
|
102
|
+
let textLines = 0;
|
|
103
|
+
for (const block of content) {
|
|
104
|
+
if (block.type !== 'text')
|
|
105
|
+
continue;
|
|
106
|
+
textBytes += Buffer.byteLength(block.text, 'utf8');
|
|
107
|
+
textLines += lineCount(block.text);
|
|
108
|
+
}
|
|
95
109
|
return {
|
|
96
110
|
content,
|
|
97
111
|
truncated: false,
|
|
98
112
|
outputPaths: [],
|
|
99
|
-
originalBytes:
|
|
100
|
-
originalLines:
|
|
113
|
+
originalBytes: textBytes,
|
|
114
|
+
originalLines: textLines,
|
|
101
115
|
};
|
|
102
116
|
}
|
|
103
117
|
content = flattenText(content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-bound.js","sourceRoot":"","sources":["../src/output-bound.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,C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CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -19,7 +19,7 @@ export function delegationModeLine(mode) {
|
|
|
19
19
|
return [
|
|
20
20
|
"Delegation: proactive.",
|
|
21
21
|
"- Spawning is an approved strategy; spawn when it genuinely helps (parallel independent work, research without burning this context).",
|
|
22
|
-
"- Depth, active-child, and budget caps still apply — `
|
|
22
|
+
"- Depth, active-child, and budget caps still apply — call `list_agents` before fanning out; it prints the live quota.",
|
|
23
23
|
].join("\n");
|
|
24
24
|
}
|
|
25
25
|
export function subagentRoutingPrompt(mode = "proactive") {
|
|
@@ -45,7 +45,7 @@ export function subagentRoutingPrompt(mode = "proactive") {
|
|
|
45
45
|
"- Match the live catalog by name and brief when this session has subagent tools. If a member fits, `subagent` with that `member_id` this turn. Do not Skill-load a standing skill that covers the same job. Frugal has no subagent tools — Skill-load here. Tiny asks with no catalog match stay with you. `presence_set` may run in parallel.",
|
|
46
46
|
"- Sibling parent sessions talk with `thread_message` (session_id from the collab board). Do not `thread_switch` to send mail. That is not a subagent.",
|
|
47
47
|
"- `team_graph` reads/edits the collaboration graph (delegates + peer): view · neighbors · link/unlink · role · announce to peers. Same-parent siblings are auto peer-linked on spawn.",
|
|
48
|
-
"- `
|
|
48
|
+
"- `list_agents` shows depth/active quota, per-child state and inbox backlog before spawning more work.",
|
|
49
49
|
"- Default `runtime` is in-process (Face child). Set `runtime` to `acp` / `app-server` / `claude-code` for an external subprocess (needs local binary / Settings). `acp` / `app-server` support `run_in_background` + the same followup/wait/interrupt tools; `claude-code` stays one-shot print.",
|
|
50
50
|
"- Use `ralph` only when the human explicitly asks for a Ralph / fresh-agent loop toward one immutable objective (each round is a new child; handoff is structured JSON). Prefer `subagent` for ordinary delegation.",
|
|
51
51
|
"- Prefer a few independent children over deep nesting; respect depth and active-child caps. Prefer doing small work yourself **only when no catalog member fits** — **Frugal** has no subagent tools; **Shallow** allows depth 1 only.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-prompt.js","sourceRoot":"","sources":["../src/subagent-prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA2B;IAC5D,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,OAAO;YACL,4BAA4B;YAC5B,0FAA0F;YAC1F,+FAA+F;YAC/F,0DAA0D;SAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO;QACL,wBAAwB;QACxB,uIAAuI;QACvI,
|
|
1
|
+
{"version":3,"file":"subagent-prompt.js","sourceRoot":"","sources":["../src/subagent-prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA2B;IAC5D,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,OAAO;YACL,4BAA4B;YAC5B,0FAA0F;YAC1F,+FAA+F;YAC/F,0DAA0D;SAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO;QACL,wBAAwB;QACxB,uIAAuI;QACvI,uHAAuH;KACxH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAA8B,WAAW;IAEzC,OAAO;QACL,YAAY;QACZ,uXAAuX;QACvX,iGAAiG;QACjG,iMAAiM;QACjM,+KAA+K;QAC/K,qNAAqN;QACrN,kJAAkJ;QAClJ,2UAA2U;QAC3U,yBAAyB;QACzB,+SAA+S;QAC/S,4LAA4L;QAC5L,wEAAwE;QACxE,yEAAyE;QACzE,+NAA+N;QAC/N,gQAAgQ;QAChQ,mWAAmW;QACnW,4VAA4V;QAC5V,yJAAyJ;QACzJ,gVAAgV;QAChV,uJAAuJ;QACvJ,uLAAuL;QACvL,wGAAwG;QACxG,kSAAkS;QAClS,qNAAqN;QACrN,wOAAwO;QACxO,kBAAkB,CAAC,IAAI,CAAC;KACzB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { createCuratedMemoryStore, defaultCuratedMemoryDir, ENTRY_DELIMITER, MEMORY_CHAR_LIMIT, USER_CHAR_LIMIT, USAGE_SIDECAR_FILE, type CreateCuratedMemoryStoreOptions, type CuratedMemoryAction, type CuratedMemoryOperation, type CuratedMemoryStore, type CuratedMemoryTarget, type CuratedMemoryWriteResult, type MemoryEntryAge, type MaybeAsync, } from "./store.js";
|
|
1
|
+
export { createCuratedMemoryStore, defaultCuratedMemoryDir, ENTRY_DELIMITER, MEMORY_CHAR_LIMIT, USER_CHAR_LIMIT, USAGE_SIDECAR_FILE, CURATED_MEMORY_LIMIT_MIN, CURATED_MEMORY_LIMIT_MAX, resolveCuratedMemoryLimits, type CuratedMemoryLimits, type CreateCuratedMemoryStoreOptions, type CuratedMemoryAction, type CuratedMemoryOperation, type CuratedMemoryStore, type CuratedMemoryTarget, type CuratedMemoryWriteResult, type MemoryEntryAge, type MaybeAsync, } from "./store.js";
|
|
2
2
|
export type { MemoryProvider, MemoryProviderKind, } from "./provider.js";
|
|
3
3
|
export { createHttpMemoryProvider, HttpMemoryProviderError, probeHttpMemoryProvider, type HttpMemoryProviderOptions, } from "./http.js";
|
|
4
4
|
export { createFileMemoryProvider, resolveMemoryProvider, type ResolveMemoryProviderOptions, } from "./resolve.js";
|
|
5
5
|
export { createSqliteMemoryProvider, type SqliteMemoryProvider, type SqliteMemoryProviderOptions, } from "./sqlite.js";
|
|
6
6
|
export { CURATED_MEMORY_PROMPT_TEXT, createCuratedMemoryTools, } from "./tools.js";
|
|
7
7
|
export { curatedMemoryDirFor, canOpenCuratedMemoryScope, curatedMemoryHome, CURATED_MEMORY_SCOPE_KINDS, type CuratedMemoryScopeKind, type CuratedMemoryScopeIds, } from "./scopes.js";
|
|
8
|
-
export { openCuratedMemoryLayers, createLayeredCuratedMemoryStore, createScopedCuratedMemoryTools, SCOPED_CURATED_MEMORY_PROMPT_TEXT, type MemoryScopeLayer, type CreateLayeredCuratedMemoryStoreOptions, } from "./layered.js";
|
|
8
|
+
export { openCuratedMemoryLayers, createLayeredCuratedMemoryStore, createScopedCuratedMemoryTools, SCOPED_CURATED_MEMORY_PROMPT_TEXT, scopedCuratedMemoryPromptText, type MemoryScopeLayer, type CreateLayeredCuratedMemoryStoreOptions, } from "./layered.js";
|
|
9
9
|
export { CONSOLIDATE_LEASE_FILE, CONSOLIDATE_REPORT_FILE, tryClaimConsolidateLease, readConsolidateReport, writeConsolidateReport, runCuratedMemoryConsolidate, type CuratedMemoryConsolidateReport, type CuratedMemoryPhase2Status, type RunCuratedMemoryConsolidateInput, } from "./consolidate-pipeline.js";
|
|
10
10
|
export { CURATED_MEMORY_FRAGMENT_ID, createCuratedMemoryLiveGate, curatedMemoryBodyFingerprint, formatCuratedMemoryLiveBody, } from "./live-fragment.js";
|
|
11
11
|
export { extractReusableNotes, writeReusableNotesAfterTurn, consolidateCuratedMemoryPhase1, consolidateCuratedMemoryPhase2, buildPhase2ExtractPrompt, parsePhase2Notes, noteCoveredByEntries, TRIM_LOG_FILE, type TurnNoteInput, type TurnNoteWriteResult, type SessionEndConsolidateInput, type SessionEndPhase2Input, type Phase2CompleteFn, } from "./write-path.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,KAAK,+BAA+B,EACpC,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,UAA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BAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,yBAAyB,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,GACjC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,EAC7B,KAAK,gBAAgB,EACrB,KAAK,sCAAsC,GAC5C,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,GACtC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { createCuratedMemoryStore, defaultCuratedMemoryDir, ENTRY_DELIMITER, MEMORY_CHAR_LIMIT, USER_CHAR_LIMIT, USAGE_SIDECAR_FILE, } from "./store.js";
|
|
1
|
+
export { createCuratedMemoryStore, defaultCuratedMemoryDir, ENTRY_DELIMITER, MEMORY_CHAR_LIMIT, USER_CHAR_LIMIT, USAGE_SIDECAR_FILE, CURATED_MEMORY_LIMIT_MIN, CURATED_MEMORY_LIMIT_MAX, resolveCuratedMemoryLimits, } from "./store.js";
|
|
2
2
|
export { createHttpMemoryProvider, HttpMemoryProviderError, probeHttpMemoryProvider, } from "./http.js";
|
|
3
3
|
export { createFileMemoryProvider, resolveMemoryProvider, } from "./resolve.js";
|
|
4
4
|
export { createSqliteMemoryProvider, } from "./sqlite.js";
|
|
5
5
|
export { CURATED_MEMORY_PROMPT_TEXT, createCuratedMemoryTools, } from "./tools.js";
|
|
6
6
|
export { curatedMemoryDirFor, canOpenCuratedMemoryScope, curatedMemoryHome, CURATED_MEMORY_SCOPE_KINDS, } from "./scopes.js";
|
|
7
|
-
export { openCuratedMemoryLayers, createLayeredCuratedMemoryStore, createScopedCuratedMemoryTools, SCOPED_CURATED_MEMORY_PROMPT_TEXT, } from "./layered.js";
|
|
7
|
+
export { openCuratedMemoryLayers, createLayeredCuratedMemoryStore, createScopedCuratedMemoryTools, SCOPED_CURATED_MEMORY_PROMPT_TEXT, scopedCuratedMemoryPromptText, } from "./layered.js";
|
|
8
8
|
export { CONSOLIDATE_LEASE_FILE, CONSOLIDATE_REPORT_FILE, tryClaimConsolidateLease, readConsolidateReport, writeConsolidateReport, runCuratedMemoryConsolidate, } from "./consolidate-pipeline.js";
|
|
9
9
|
export { CURATED_MEMORY_FRAGMENT_ID, createCuratedMemoryLiveGate, curatedMemoryBodyFingerprint, formatCuratedMemoryLiveBody, } from "./live-fragment.js";
|
|
10
10
|
export { extractReusableNotes, writeReusableNotesAfterTurn, consolidateCuratedMemoryPhase1, consolidateCuratedMemoryPhase2, buildPhase2ExtractPrompt, parsePhase2Notes, noteCoveredByEntries, TRIM_LOG_FILE, } from "./write-path.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,GAU3B,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GAExB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GAEtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,GAG3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,GAG3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EACjC,6BAA6B,GAG9B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,GAI5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GAMd,MAAM,iBAAiB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* workspace / session / agent). Frozen system prompt concatenates each zone.
|
|
4
4
|
*/
|
|
5
5
|
import type { ToolDefinition } from "@xrkseek/core-tools";
|
|
6
|
-
import { type CuratedMemoryOperation, type CuratedMemoryStore, type CuratedMemoryTarget, type CuratedMemoryWriteResult, type MemoryEntryAge, type MaybeAsync } from "./store.js";
|
|
6
|
+
import { type CuratedMemoryOperation, type CuratedMemoryLimits, type CuratedMemoryStore, type CuratedMemoryTarget, type CuratedMemoryWriteResult, type MemoryEntryAge, type MaybeAsync } from "./store.js";
|
|
7
7
|
import { type CuratedMemoryScopeIds, type CuratedMemoryScopeKind } from "./scopes.js";
|
|
8
8
|
export interface MemoryScopeLayer {
|
|
9
9
|
readonly scope: CuratedMemoryScopeKind;
|
|
@@ -15,9 +15,20 @@ export interface CreateLayeredCuratedMemoryStoreOptions extends CuratedMemorySco
|
|
|
15
15
|
* Prefer session when present, else workspace, else global.
|
|
16
16
|
*/
|
|
17
17
|
readonly defaultScope?: CuratedMemoryScopeKind;
|
|
18
|
+
/**
|
|
19
|
+
* Display word for the agent zone (Settings → seat titles, e.g. 干员 · 水手 ·
|
|
20
|
+
* 成员). Prompt headers and the zoned policy text use it verbatim; the store
|
|
21
|
+
* itself never hardcodes one scheme's word.
|
|
22
|
+
*/
|
|
23
|
+
readonly agentLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Per-file char caps. Settings → Plugins → Curated memory owns the values;
|
|
26
|
+
* omitted fields keep the shipped defaults (2200 / 1375).
|
|
27
|
+
*/
|
|
28
|
+
readonly limits?: CuratedMemoryLimits;
|
|
18
29
|
}
|
|
19
30
|
/** Open every zone that has ids; always includes global. */
|
|
20
|
-
export declare function openCuratedMemoryLayers(ids: CuratedMemoryScopeIds): MemoryScopeLayer[];
|
|
31
|
+
export declare function openCuratedMemoryLayers(ids: CuratedMemoryScopeIds, limits?: CuratedMemoryLimits): MemoryScopeLayer[];
|
|
21
32
|
/**
|
|
22
33
|
* A {@link CuratedMemoryStore} facade over several zones.
|
|
23
34
|
* Mutations hit `defaultScope`; {@link frozenSystemBlock} merges all zones.
|
|
@@ -25,14 +36,20 @@ export declare function openCuratedMemoryLayers(ids: CuratedMemoryScopeIds): Mem
|
|
|
25
36
|
export declare function createLayeredCuratedMemoryStore(options: CreateLayeredCuratedMemoryStoreOptions): CuratedMemoryStore & {
|
|
26
37
|
readonly layers: readonly MemoryScopeLayer[];
|
|
27
38
|
readonly defaultScope: CuratedMemoryScopeKind;
|
|
39
|
+
/** True when more than one zone exists; the one "layered" predicate. */
|
|
40
|
+
readonly isLayered: boolean;
|
|
28
41
|
storeFor(scope: CuratedMemoryScopeKind): CuratedMemoryStore | undefined;
|
|
29
42
|
};
|
|
30
43
|
/**
|
|
31
44
|
* `memory` tool with a `scope` field (global|workspace|session|agent).
|
|
32
45
|
* Falls back to {@link createCuratedMemoryTools} when only one layer exists.
|
|
33
46
|
*/
|
|
34
|
-
export declare function createScopedCuratedMemoryTools(layered: ReturnType<typeof createLayeredCuratedMemoryStore
|
|
47
|
+
export declare function createScopedCuratedMemoryTools(layered: ReturnType<typeof createLayeredCuratedMemoryStore>, options?: {
|
|
48
|
+
readonly agentLabel?: string | undefined;
|
|
49
|
+
}): ToolDefinition[];
|
|
35
50
|
/** Policy text mentioning independent zones (when layered). */
|
|
51
|
+
export declare function scopedCuratedMemoryPromptText(agentLabel?: string): string;
|
|
52
|
+
/** Default zoned policy text (no seat-title override). */
|
|
36
53
|
export declare const SCOPED_CURATED_MEMORY_PROMPT_TEXT: string;
|
|
37
54
|
/** Re-export write helpers typing for layered facades. */
|
|
38
55
|
export type { CuratedMemoryOperation, CuratedMemoryTarget, CuratedMemoryWriteResult, MemoryEntryAge, MaybeAsync, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layered.d.ts","sourceRoot":"","sources":["../src/layered.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;CACpC;AAED,MAAM,WAAW,sCACf,SAAQ,qBAAqB;IAC7B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"layered.d.ts","sourceRoot":"","sources":["../src/layered.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAEL,KAA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A;CAAO,GACzD,cAAc,EAAE,CAgFlB;AAED,+DAA+D;AAC/D,wBAAgB,6BAA6B,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAWzE;AAED,0DAA0D;AAC1D,eAAO,MAAM,iCAAiC,QAAkC,CAAC;AAEjF,0DAA0D;AAC1D,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,UAAU,GACX,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { createCuratedMemoryStore, } from "./store.js";
|
|
2
2
|
import { canOpenCuratedMemoryScope, curatedMemoryDirFor, CURATED_MEMORY_SCOPE_KINDS, } from "./scopes.js";
|
|
3
3
|
import { createCuratedMemoryTools, CURATED_MEMORY_PROMPT_TEXT } from "./tools.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/** Zone headers; the agent word comes from Settings seat titles. */
|
|
5
|
+
function scopeHeaders(agentLabel) {
|
|
6
|
+
return {
|
|
7
|
+
global: "GLOBAL curated memory (home-wide)",
|
|
8
|
+
workspace: "WORKSPACE curated memory",
|
|
9
|
+
session: "SESSION curated memory (this conversation)",
|
|
10
|
+
agent: `AGENT curated memory (this ${agentLabel} / roster member)`,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function normalizedAgentLabel(raw) {
|
|
14
|
+
const text = raw?.trim();
|
|
15
|
+
return text || "member";
|
|
16
|
+
}
|
|
10
17
|
function pickDefaultScope(layers, preferred) {
|
|
11
18
|
if (preferred && layers.some((l) => l.scope === preferred))
|
|
12
19
|
return preferred;
|
|
@@ -17,7 +24,7 @@ function pickDefaultScope(layers, preferred) {
|
|
|
17
24
|
return "global";
|
|
18
25
|
}
|
|
19
26
|
/** Open every zone that has ids; always includes global. */
|
|
20
|
-
export function openCuratedMemoryLayers(ids) {
|
|
27
|
+
export function openCuratedMemoryLayers(ids, limits) {
|
|
21
28
|
const layers = [];
|
|
22
29
|
for (const scope of CURATED_MEMORY_SCOPE_KINDS) {
|
|
23
30
|
if (!canOpenCuratedMemoryScope(scope, ids))
|
|
@@ -27,6 +34,7 @@ export function openCuratedMemoryLayers(ids) {
|
|
|
27
34
|
store: createCuratedMemoryStore({
|
|
28
35
|
dir: curatedMemoryDirFor(scope, ids),
|
|
29
36
|
...(ids.env ? { env: ids.env } : {}),
|
|
37
|
+
...(limits ? { limits } : {}),
|
|
30
38
|
}),
|
|
31
39
|
});
|
|
32
40
|
}
|
|
@@ -37,15 +45,17 @@ export function openCuratedMemoryLayers(ids) {
|
|
|
37
45
|
* Mutations hit `defaultScope`; {@link frozenSystemBlock} merges all zones.
|
|
38
46
|
*/
|
|
39
47
|
export function createLayeredCuratedMemoryStore(options) {
|
|
40
|
-
const layers = openCuratedMemoryLayers(options);
|
|
48
|
+
const layers = openCuratedMemoryLayers(options, options.limits);
|
|
41
49
|
const defaultScope = pickDefaultScope(layers, options.defaultScope);
|
|
42
50
|
const byScope = new Map(layers.map((l) => [l.scope, l.store]));
|
|
43
51
|
const primary = byScope.get(defaultScope) ?? layers[0].store;
|
|
52
|
+
const headers = scopeHeaders(normalizedAgentLabel(options.agentLabel));
|
|
44
53
|
const storeFor = (scope) => byScope.get(scope);
|
|
45
54
|
const facade = {
|
|
46
55
|
dir: primary.dir,
|
|
47
56
|
layers,
|
|
48
57
|
defaultScope,
|
|
58
|
+
isLayered: layers.length > 1,
|
|
49
59
|
storeFor,
|
|
50
60
|
frozenPrompt(target) {
|
|
51
61
|
return primary.frozenPrompt(target);
|
|
@@ -56,7 +66,7 @@ export function createLayeredCuratedMemoryStore(options) {
|
|
|
56
66
|
const body = layer.store.frozenSystemBlock().trim();
|
|
57
67
|
if (!body)
|
|
58
68
|
continue;
|
|
59
|
-
parts.push(`### ${
|
|
69
|
+
parts.push(`### ${headers[layer.scope]}\n${body}`);
|
|
60
70
|
}
|
|
61
71
|
return parts.join("\n\n");
|
|
62
72
|
},
|
|
@@ -66,7 +76,7 @@ export function createLayeredCuratedMemoryStore(options) {
|
|
|
66
76
|
const body = (layer.store.liveSystemBlock?.() ?? layer.store.frozenSystemBlock()).trim();
|
|
67
77
|
if (!body)
|
|
68
78
|
continue;
|
|
69
|
-
parts.push(`### ${
|
|
79
|
+
parts.push(`### ${headers[layer.scope]}\n${body}`);
|
|
70
80
|
}
|
|
71
81
|
return parts.join("\n\n");
|
|
72
82
|
},
|
|
@@ -104,12 +114,13 @@ function asScope(raw, fallback) {
|
|
|
104
114
|
* `memory` tool with a `scope` field (global|workspace|session|agent).
|
|
105
115
|
* Falls back to {@link createCuratedMemoryTools} when only one layer exists.
|
|
106
116
|
*/
|
|
107
|
-
export function createScopedCuratedMemoryTools(layered) {
|
|
117
|
+
export function createScopedCuratedMemoryTools(layered, options = {}) {
|
|
108
118
|
if (layered.layers.length <= 1) {
|
|
109
119
|
return createCuratedMemoryTools(layered);
|
|
110
120
|
}
|
|
111
121
|
const base = createCuratedMemoryTools(layered)[0];
|
|
112
122
|
const available = layered.layers.map((l) => l.scope);
|
|
123
|
+
const agentLabel = normalizedAgentLabel(options.agentLabel);
|
|
113
124
|
const tool = {
|
|
114
125
|
...base,
|
|
115
126
|
description: `${base.description} ` +
|
|
@@ -122,11 +133,12 @@ export function createScopedCuratedMemoryTools(layered) {
|
|
|
122
133
|
scope: {
|
|
123
134
|
type: "string",
|
|
124
135
|
enum: [...available],
|
|
125
|
-
description:
|
|
136
|
+
description: `Memory zone: global (home) · workspace · session · agent (${agentLabel}). ` +
|
|
126
137
|
`Default ${layered.defaultScope}.`,
|
|
127
138
|
},
|
|
128
139
|
},
|
|
129
|
-
|
|
140
|
+
// Same as the flat tool: `target` only ever holds `memory`.
|
|
141
|
+
required: [],
|
|
130
142
|
},
|
|
131
143
|
async execute(args) {
|
|
132
144
|
const a = args && typeof args === "object"
|
|
@@ -153,6 +165,15 @@ export function createScopedCuratedMemoryTools(layered) {
|
|
|
153
165
|
};
|
|
154
166
|
}
|
|
155
167
|
const [scopedTool] = createCuratedMemoryTools(store);
|
|
168
|
+
if (scopedTool === undefined) {
|
|
169
|
+
return {
|
|
170
|
+
isError: true,
|
|
171
|
+
content: JSON.stringify({
|
|
172
|
+
success: false,
|
|
173
|
+
error: `memory tool is unavailable for scope '${scope}'.`,
|
|
174
|
+
}),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
156
177
|
const out = await scopedTool.execute(args);
|
|
157
178
|
if (typeof out.content === "string" && out.content.startsWith("{")) {
|
|
158
179
|
try {
|
|
@@ -172,8 +193,16 @@ export function createScopedCuratedMemoryTools(layered) {
|
|
|
172
193
|
return [tool];
|
|
173
194
|
}
|
|
174
195
|
/** Policy text mentioning independent zones (when layered). */
|
|
175
|
-
export
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
export function scopedCuratedMemoryPromptText(agentLabel) {
|
|
197
|
+
const label = normalizedAgentLabel(agentLabel);
|
|
198
|
+
return (CURATED_MEMORY_PROMPT_TEXT +
|
|
199
|
+
" Independent zones share the same tool: scope=global|workspace|session|agent. " +
|
|
200
|
+
`Use session for this conversation's facts, agent for a ${label}'s private notes, ` +
|
|
201
|
+
"workspace for project-wide facts, global for home-wide preferences. " +
|
|
202
|
+
"Per-file char caps come from Settings → Plugins → Curated memory " +
|
|
203
|
+
"(defaults: MEMORY.md 2200, USER.md 1375); when a cap blocks a write the " +
|
|
204
|
+
"tool returns `prune_candidates`.");
|
|
205
|
+
}
|
|
206
|
+
/** Default zoned policy text (no seat-title override). */
|
|
207
|
+
export const SCOPED_CURATED_MEMORY_PROMPT_TEXT = scopedCuratedMemoryPromptText();
|
|
179
208
|
//# sourceMappingURL=layered.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layered.js","sourceRoot":"","sources":["../src/layered.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,wBAAwB,
|
|
1
|
+
{"version":3,"file":"layered.js","sourceRoot":"","sources":["../src/layered.ts"],"names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EAAsE;QACtE,mEAAmE;QACnE,0EAA0E;QAC1E,kCAAkC,CACnC,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iCAAiC,GAAG,6BAA6B,EAAE,CAAC"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
export declare const ENTRY_DELIMITER = "\n\u00A7\n";
|
|
2
2
|
export declare const MEMORY_CHAR_LIMIT = 2200;
|
|
3
3
|
export declare const USER_CHAR_LIMIT = 1375;
|
|
4
|
+
/** Plugin-configurable bounds for one zone file (Settings → Curated memory). */
|
|
5
|
+
export declare const CURATED_MEMORY_LIMIT_MIN = 200;
|
|
6
|
+
export declare const CURATED_MEMORY_LIMIT_MAX = 20000;
|
|
7
|
+
/** Per-file caps; omitted fields keep the shipped defaults. */
|
|
8
|
+
export interface CuratedMemoryLimits {
|
|
9
|
+
readonly memory?: number;
|
|
10
|
+
readonly user?: number;
|
|
11
|
+
}
|
|
12
|
+
interface ResolvedCuratedMemoryLimits {
|
|
13
|
+
readonly memory: number;
|
|
14
|
+
readonly user: number;
|
|
15
|
+
}
|
|
16
|
+
/** Clamp configured caps into the supported range. */
|
|
17
|
+
export declare function resolveCuratedMemoryLimits(limits?: CuratedMemoryLimits): ResolvedCuratedMemoryLimits;
|
|
4
18
|
/** Sidecar beside MEMORY.md/USER.md: entry hash -> epoch ms of its last tracked write. */
|
|
5
19
|
export declare const USAGE_SIDECAR_FILE = ".usage.json";
|
|
6
20
|
export type CuratedMemoryTarget = "memory" | "user";
|
|
@@ -65,8 +79,11 @@ export interface CreateCuratedMemoryStoreOptions {
|
|
|
65
79
|
/** Override the memories directory (tests). Default `{XRK_HOME}/memories`. */
|
|
66
80
|
readonly dir?: string;
|
|
67
81
|
readonly env?: NodeJS.ProcessEnv;
|
|
82
|
+
/** Per-file char caps (Settings → Plugins → Curated memory). */
|
|
83
|
+
readonly limits?: CuratedMemoryLimits;
|
|
68
84
|
}
|
|
69
85
|
export declare function createCuratedMemoryStore(options?: CreateCuratedMemoryStoreOptions): CuratedMemoryStore;
|
|
70
86
|
/** `{XRK_HOME}/memories` — not the Mnemon document library. */
|
|
71
87
|
export declare function defaultCuratedMemoryDir(env?: NodeJS.ProcessEnv): string;
|
|
88
|
+
export {};
|
|
72
89
|
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe,eAAU,CAAC;AACvC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAQhD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,MAAM,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,CAAC,EAAE,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AAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEpF"}
|
|
@@ -9,6 +9,21 @@ import { resolveXrkHome } from "@xrkseek/xrk-home-paths";
|
|
|
9
9
|
export const ENTRY_DELIMITER = "\n§\n";
|
|
10
10
|
export const MEMORY_CHAR_LIMIT = 2200;
|
|
11
11
|
export const USER_CHAR_LIMIT = 1375;
|
|
12
|
+
/** Plugin-configurable bounds for one zone file (Settings → Curated memory). */
|
|
13
|
+
export const CURATED_MEMORY_LIMIT_MIN = 200;
|
|
14
|
+
export const CURATED_MEMORY_LIMIT_MAX = 20000;
|
|
15
|
+
function resolveLimit(raw, fallback) {
|
|
16
|
+
if (typeof raw !== "number" || !Number.isFinite(raw))
|
|
17
|
+
return fallback;
|
|
18
|
+
return Math.min(CURATED_MEMORY_LIMIT_MAX, Math.max(CURATED_MEMORY_LIMIT_MIN, Math.round(raw)));
|
|
19
|
+
}
|
|
20
|
+
/** Clamp configured caps into the supported range. */
|
|
21
|
+
export function resolveCuratedMemoryLimits(limits) {
|
|
22
|
+
return {
|
|
23
|
+
memory: resolveLimit(limits?.memory, MEMORY_CHAR_LIMIT),
|
|
24
|
+
user: resolveLimit(limits?.user, USER_CHAR_LIMIT),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
12
27
|
/** Sidecar beside MEMORY.md/USER.md: entry hash -> epoch ms of its last tracked write. */
|
|
13
28
|
export const USAGE_SIDECAR_FILE = ".usage.json";
|
|
14
29
|
const HEADERS = {
|
|
@@ -18,8 +33,8 @@ const HEADERS = {
|
|
|
18
33
|
function fileFor(dir, target) {
|
|
19
34
|
return path.join(dir, target === "user" ? "USER.md" : "MEMORY.md");
|
|
20
35
|
}
|
|
21
|
-
function limitFor(target) {
|
|
22
|
-
return target === "user" ?
|
|
36
|
+
function limitFor(target, limits) {
|
|
37
|
+
return target === "user" ? limits.user : limits.memory;
|
|
23
38
|
}
|
|
24
39
|
function parseEntries(raw) {
|
|
25
40
|
return raw
|
|
@@ -58,20 +73,20 @@ function readRaw(file) {
|
|
|
58
73
|
return { raw: "", ok: false };
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
|
-
function drifted(raw, target) {
|
|
76
|
+
function drifted(raw, target, limit) {
|
|
62
77
|
if (!raw.trim())
|
|
63
78
|
return false;
|
|
64
79
|
const parsed = parseEntries(raw);
|
|
65
80
|
const roundTrip = raw.trim() === parsed.join(ENTRY_DELIMITER);
|
|
66
81
|
const maxLen = parsed.reduce((max, entry) => Math.max(max, entry.length), 0);
|
|
67
|
-
return !(roundTrip && maxLen <=
|
|
82
|
+
return !(roundTrip && maxLen <= limit);
|
|
68
83
|
}
|
|
69
|
-
function renderBlock(target, entries) {
|
|
84
|
+
function renderBlock(target, entries, limit) {
|
|
70
85
|
if (entries.length === 0)
|
|
71
86
|
return "";
|
|
72
87
|
const content = entries.join(ENTRY_DELIMITER);
|
|
73
88
|
const sep = "═".repeat(46);
|
|
74
|
-
return `${sep}\n${HEADERS[target]} [${usagePct(content.length,
|
|
89
|
+
return `${sep}\n${HEADERS[target]} [${usagePct(content.length, limit)}]\n${sep}\n${content}`;
|
|
75
90
|
}
|
|
76
91
|
function writeAtomic(file, text) {
|
|
77
92
|
mkdirSync(path.dirname(file), { recursive: true });
|
|
@@ -200,21 +215,21 @@ function withFileLock(lockPath, fn) {
|
|
|
200
215
|
function fail(message, extra = {}) {
|
|
201
216
|
return { success: false, error: message, ...extra };
|
|
202
217
|
}
|
|
203
|
-
function
|
|
218
|
+
function failWithEntriesWithLimit(target, entries, message, limit, pruneCandidates) {
|
|
204
219
|
return fail(message, {
|
|
205
220
|
target,
|
|
206
221
|
current_entries: entries,
|
|
207
|
-
usage: `${charCount(entries).toLocaleString("en-US")}/${
|
|
222
|
+
usage: `${charCount(entries).toLocaleString("en-US")}/${limit.toLocaleString("en-US")}`,
|
|
208
223
|
...(pruneCandidates && pruneCandidates.length > 0 ? { prune_candidates: pruneCandidates } : {}),
|
|
209
224
|
});
|
|
210
225
|
}
|
|
211
|
-
function
|
|
226
|
+
function savedWithLimit(target, message, entries, limit) {
|
|
212
227
|
const current = charCount(entries);
|
|
213
228
|
return {
|
|
214
229
|
success: true,
|
|
215
230
|
done: true,
|
|
216
231
|
target,
|
|
217
|
-
usage: usagePct(current,
|
|
232
|
+
usage: usagePct(current, limit),
|
|
218
233
|
entry_count: entries.length,
|
|
219
234
|
message,
|
|
220
235
|
note: "Write saved to disk. This session's system-prompt snapshot is unchanged — do not repeat the write.",
|
|
@@ -236,6 +251,12 @@ export function createCuratedMemoryStore(options = {}) {
|
|
|
236
251
|
const dir = explicit
|
|
237
252
|
? path.resolve(explicit)
|
|
238
253
|
: path.join(resolveXrkHome(options.env ?? process.env), "memories");
|
|
254
|
+
const limits = resolveCuratedMemoryLimits(options.limits);
|
|
255
|
+
const limitForTarget = (target) => limitFor(target, limits);
|
|
256
|
+
// Local wrappers so every write path reports against the configured cap
|
|
257
|
+
// without threading a parameter through a dozen call sites.
|
|
258
|
+
const saved = (target, message, entries) => savedWithLimit(target, message, entries, limitForTarget(target));
|
|
259
|
+
const failWithEntries = (target, entries, message, pruneCandidates) => failWithEntriesWithLimit(target, entries, message, limitForTarget(target), pruneCandidates);
|
|
239
260
|
const usagePath = path.join(dir, USAGE_SIDECAR_FILE);
|
|
240
261
|
const snapshot = {
|
|
241
262
|
memory: "",
|
|
@@ -244,7 +265,7 @@ export function createCuratedMemoryStore(options = {}) {
|
|
|
244
265
|
for (const target of ["memory", "user"]) {
|
|
245
266
|
const { raw, ok } = readRaw(fileFor(dir, target));
|
|
246
267
|
const entries = ok ? dedupe(parseEntries(raw)) : [];
|
|
247
|
-
snapshot[target] = renderBlock(target, entries);
|
|
268
|
+
snapshot[target] = renderBlock(target, entries, limitForTarget(target));
|
|
248
269
|
}
|
|
249
270
|
function rankedEntries(target) {
|
|
250
271
|
const file = fileFor(dir, target);
|
|
@@ -265,7 +286,7 @@ export function createCuratedMemoryStore(options = {}) {
|
|
|
265
286
|
if (!ok) {
|
|
266
287
|
return fail(`Refusing to write ${path.basename(file)}: the file exists but could not be read. Nothing was changed.`);
|
|
267
288
|
}
|
|
268
|
-
if (drifted(raw, target)) {
|
|
289
|
+
if (drifted(raw, target, limitForTarget(target))) {
|
|
269
290
|
const bak = `${file}.bak.${Date.now()}`;
|
|
270
291
|
try {
|
|
271
292
|
writeFileSync(bak, raw, "utf8");
|
|
@@ -276,7 +297,7 @@ export function createCuratedMemoryStore(options = {}) {
|
|
|
276
297
|
return fail(`Refusing to write ${path.basename(file)}: on-disk content would not round-trip through add/replace/remove. A snapshot was saved to ${bak}.`, { drift_backup: bak });
|
|
277
298
|
}
|
|
278
299
|
const entries = dedupe(parseEntries(raw));
|
|
279
|
-
const step = apply(entries,
|
|
300
|
+
const step = apply(entries, limitForTarget(target));
|
|
280
301
|
if (step.kind === "done")
|
|
281
302
|
return step.result;
|
|
282
303
|
writeAtomic(file, step.entries.join(ENTRY_DELIMITER));
|
|
@@ -348,7 +369,7 @@ export function createCuratedMemoryStore(options = {}) {
|
|
|
348
369
|
// letting a failed read look like "memory is empty".
|
|
349
370
|
if (!ok)
|
|
350
371
|
return snapshot[target];
|
|
351
|
-
return renderBlock(target, dedupe(parseEntries(raw)));
|
|
372
|
+
return renderBlock(target, dedupe(parseEntries(raw)), limitForTarget(target));
|
|
352
373
|
});
|
|
353
374
|
return blocks.filter((block) => block.trim()).join("\n\n");
|
|
354
375
|
},
|