dsh-continual-evolve 0.10.6 → 0.12.0

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.
Files changed (126) hide show
  1. package/README.md +35 -122
  2. package/README.zh.md +26 -97
  3. package/cordis.patch.yml +2 -2
  4. package/lib/index.d.ts +44 -241
  5. package/lib/index.js +30 -253
  6. package/lib/memory-guide.d.ts +13 -14
  7. package/lib/memory-guide.js +32 -21
  8. package/lib/memory-section.d.ts +77 -0
  9. package/lib/memory-section.js +189 -0
  10. package/package.json +2 -17
  11. package/lib/apply.d.ts +0 -22
  12. package/lib/apply.js +0 -157
  13. package/lib/approval.d.ts +0 -72
  14. package/lib/approval.js +0 -127
  15. package/lib/auto.d.ts +0 -236
  16. package/lib/auto.js +0 -773
  17. package/lib/autocase.d.ts +0 -38
  18. package/lib/autocase.js +0 -76
  19. package/lib/benchmark-command.d.ts +0 -9
  20. package/lib/benchmark-command.js +0 -357
  21. package/lib/benchmark.d.ts +0 -151
  22. package/lib/benchmark.js +0 -250
  23. package/lib/command.d.ts +0 -49
  24. package/lib/command.js +0 -568
  25. package/lib/consolidate.d.ts +0 -90
  26. package/lib/consolidate.js +0 -180
  27. package/lib/copy.d.ts +0 -74
  28. package/lib/copy.js +0 -160
  29. package/lib/declines.d.ts +0 -101
  30. package/lib/declines.js +0 -175
  31. package/lib/evaluate.d.ts +0 -74
  32. package/lib/evaluate.js +0 -271
  33. package/lib/evolve-event.d.ts +0 -40
  34. package/lib/evolve-event.js +0 -59
  35. package/lib/failures.d.ts +0 -42
  36. package/lib/failures.js +0 -171
  37. package/lib/fate.d.ts +0 -130
  38. package/lib/fate.js +0 -350
  39. package/lib/goal-command.d.ts +0 -7
  40. package/lib/goal-command.js +0 -37
  41. package/lib/goal.d.ts +0 -72
  42. package/lib/goal.js +0 -72
  43. package/lib/inject.d.ts +0 -196
  44. package/lib/inject.js +0 -412
  45. package/lib/llm-text.d.ts +0 -104
  46. package/lib/llm-text.js +0 -140
  47. package/lib/logfile.d.ts +0 -71
  48. package/lib/logfile.js +0 -159
  49. package/lib/memory-agent.d.ts +0 -129
  50. package/lib/memory-agent.js +0 -568
  51. package/lib/memory-benchmark.d.ts +0 -76
  52. package/lib/memory-benchmark.js +0 -170
  53. package/lib/memory-index.d.ts +0 -114
  54. package/lib/memory-index.js +0 -197
  55. package/lib/message-source.d.ts +0 -23
  56. package/lib/message-source.js +0 -12
  57. package/lib/mount-command.d.ts +0 -10
  58. package/lib/mount-command.js +0 -48
  59. package/lib/mount.d.ts +0 -42
  60. package/lib/mount.js +0 -212
  61. package/lib/notify.d.ts +0 -59
  62. package/lib/notify.js +0 -97
  63. package/lib/plan.d.ts +0 -16
  64. package/lib/plan.js +0 -126
  65. package/lib/planner.d.ts +0 -61
  66. package/lib/planner.js +0 -144
  67. package/lib/pool.d.ts +0 -7
  68. package/lib/pool.js +0 -25
  69. package/lib/prefix-cache.d.ts +0 -78
  70. package/lib/prefix-cache.js +0 -168
  71. package/lib/project.d.ts +0 -28
  72. package/lib/project.js +0 -66
  73. package/lib/projection.d.ts +0 -22
  74. package/lib/projection.js +0 -112
  75. package/lib/promotion.d.ts +0 -94
  76. package/lib/promotion.js +0 -171
  77. package/lib/recall.d.ts +0 -85
  78. package/lib/recall.js +0 -142
  79. package/lib/record-language.d.ts +0 -85
  80. package/lib/record-language.js +0 -152
  81. package/lib/render.d.ts +0 -13
  82. package/lib/render.js +0 -80
  83. package/lib/review-scheduler.d.ts +0 -38
  84. package/lib/review-scheduler.js +0 -191
  85. package/lib/review.d.ts +0 -60
  86. package/lib/review.js +0 -145
  87. package/lib/rollback.d.ts +0 -9
  88. package/lib/rollback.js +0 -68
  89. package/lib/rubric.d.ts +0 -29
  90. package/lib/rubric.js +0 -119
  91. package/lib/runtime.d.ts +0 -24
  92. package/lib/runtime.js +0 -87
  93. package/lib/score.d.ts +0 -64
  94. package/lib/score.js +0 -191
  95. package/lib/search.d.ts +0 -83
  96. package/lib/search.js +0 -136
  97. package/lib/service.d.ts +0 -49
  98. package/lib/service.js +0 -180
  99. package/lib/skill-render.d.ts +0 -23
  100. package/lib/skill-render.js +0 -69
  101. package/lib/skill.d.ts +0 -15
  102. package/lib/skill.js +0 -80
  103. package/lib/skillquality.d.ts +0 -85
  104. package/lib/skillquality.js +0 -320
  105. package/lib/source.d.ts +0 -30
  106. package/lib/source.js +0 -43
  107. package/lib/state.d.ts +0 -26
  108. package/lib/state.js +0 -151
  109. package/lib/store.d.ts +0 -62
  110. package/lib/store.js +0 -164
  111. package/lib/token-usage.d.ts +0 -68
  112. package/lib/token-usage.js +0 -211
  113. package/lib/tool.d.ts +0 -34
  114. package/lib/tool.js +0 -320
  115. package/lib/turn-snapshot.d.ts +0 -72
  116. package/lib/turn-snapshot.js +0 -238
  117. package/lib/types.d.ts +0 -208
  118. package/lib/types.js +0 -127
  119. package/lib/usage.d.ts +0 -36
  120. package/lib/usage.js +0 -98
  121. package/lib/validate.d.ts +0 -28
  122. package/lib/validate.js +0 -181
  123. package/lib/wrapup-command.d.ts +0 -10
  124. package/lib/wrapup-command.js +0 -243
  125. package/lib/wrapup.d.ts +0 -260
  126. package/lib/wrapup.js +0 -539
@@ -1,37 +0,0 @@
1
- import { blockEvolutionGoal, completeEvolutionGoal, goalServiceOf, goalStatusText, upsertEvolutionGoal } from "./goal.js";
2
- function success(text) {
3
- return { kind: "success", text };
4
- }
5
- function error(text) {
6
- return { kind: "error", text };
7
- }
8
- export function executeGoalCommand(ctx, invocation, rest) {
9
- const agent = invocation.agent;
10
- const goals = goalServiceOf(ctx);
11
- if (!goals) {
12
- return error(`/evolve goal requires the goals service (load @deepseek-ai/dsh-goal)`);
13
- }
14
- const sub = rest[0] ?? "";
15
- try {
16
- if (sub === "done") {
17
- const view = completeEvolutionGoal(ctx, agent);
18
- return view ? success(`evolution goal completed: ${goalStatusText(view)}`) : success("(no goal to complete)");
19
- }
20
- if (sub === "block") {
21
- const reason = rest.slice(1).join(" ") || "user requested block";
22
- const view = blockEvolutionGoal(ctx, agent, reason);
23
- return view ? success(`evolution goal blocked: ${goalStatusText(view)}`) : success("(no active goal to block)");
24
- }
25
- if (sub.length === 0) {
26
- const current = goals.get(agent);
27
- return current ? success(goalStatusText(current)) : success("(no evolution goal — /evolve goal <objective> to create one)");
28
- }
29
- const objective = rest.join(" ");
30
- const view = upsertEvolutionGoal(ctx, agent, objective);
31
- return success(`evolution goal ready: ${goalStatusText(view)}\n(active goal drives the review gate every round)`);
32
- }
33
- catch (cause) {
34
- return error(cause instanceof Error ? cause.message : String(cause));
35
- }
36
- }
37
- //# sourceMappingURL=goal-command.js.map
package/lib/goal.d.ts DELETED
@@ -1,72 +0,0 @@
1
- /**
2
- * Goal-driven evolution rounds (v3 optional item, design.md §6): a
3
- * same-session goal turns the auto-review into a per-round driver — while a
4
- * goal is active, the review gate runs every round instead of every
5
- * `reviewIntervalTurns`, so the "continual evolution loop" is driven by the
6
- * goal's round machine (goal-round-driver keeps the session continuing) and
7
- * stops when the goal is completed or blocked.
8
- *
9
- * The goal service (`ctx.goals`) is resolved lazily and never required
10
- * (FAQ #1 discipline): without it, `/evolve goal` reports the feature
11
- * unavailable and auto-review keeps its plain interval.
12
- */
13
- import type { Context } from "@deepseek-ai/cordis";
14
- import type { Agent } from "@deepseek-ai/dsh-agent";
15
- /** The durable goal phases we drive on. */
16
- export type GoalPhase = "active" | "paused" | "blocked" | "complete";
17
- /** Minimal structural view of a goal view (duck-typed against dsh-goal). */
18
- export interface GoalViewLike {
19
- readonly id: string;
20
- readonly revision: number;
21
- readonly objective: string;
22
- readonly phase: GoalPhase;
23
- readonly maxGoalRounds: number;
24
- }
25
- export interface GoalRefLike {
26
- readonly id: string;
27
- readonly revision: number;
28
- }
29
- export interface GoalServiceLike {
30
- get(agent: Agent): GoalViewLike | undefined;
31
- create(agent: Agent, request: {
32
- objective: string;
33
- maxGoalRounds?: number;
34
- }): GoalViewLike;
35
- edit(agent: Agent, ref: GoalRefLike, request: {
36
- objective?: string;
37
- maxGoalRounds?: number;
38
- }): GoalViewLike;
39
- complete(agent: Agent, ref: GoalRefLike): GoalViewLike;
40
- block?(agent: Agent, ref: GoalRefLike, reason: {
41
- code: string;
42
- reason: string;
43
- }): GoalViewLike;
44
- }
45
- /** The default objective used by `/evolve goal` without an explicit one. */
46
- export declare const DEFAULT_EVOLVE_GOAL_OBJECTIVE = "\u6301\u7EED\u8FDB\u5316\u672C\u4F1A\u8BDD harness \u72B6\u6001\uFF1A\u6BCF\u8F6E\u6C89\u6DC0\u53EF\u590D\u7528\u7ECF\u9A8C\uFF08\u5931\u8D25/\u6218\u672F/\u4E8B\u5B9E/\u59D4\u6D3E\u89C4\u683C\uFF09\uFF0C\u4FDD\u6301\u6761\u76EE\u5C0F\u800C\u5E26\u8BC1\u636E";
47
- /**
48
- * Resolve the goal service lazily; undefined when the profile lacks it.
49
- * Uses `ctx.get("goals")` (the global service registry) — a direct property
50
- * access like `ctx.goals` walks only the caller's fiber ancestor chain and
51
- * throws "cannot get property \"goals\" without inject" for services
52
- * provided by sibling plugin entries (the goal plugin is a sibling of this
53
- * one in the profile tree).
54
- */
55
- export declare function goalServiceOf(ctx: Context): GoalServiceLike | undefined;
56
- /** True when a goal view exists and is in a round-driving phase (active). */
57
- export declare function goalDrivesRounds(view: GoalViewLike | undefined): boolean;
58
- /** True when a goal exists at all (any phase) — used to gate create vs edit. */
59
- export declare function goalExists(view: GoalViewLike | undefined): view is GoalViewLike;
60
- /** Human-readable one-line status for a goal view. */
61
- export declare function goalStatusText(view: GoalViewLike): string;
62
- /**
63
- * Create or edit the session's evolution goal. With no current goal: create.
64
- * With a current goal: edit its objective (create-on-first-use semantics are
65
- * enforced by the goal service itself; completed goals may be replaced).
66
- */
67
- export declare function upsertEvolutionGoal(ctx: Context, agent: Agent, objective?: string): GoalViewLike;
68
- /** Complete the current goal, returning the completed view or undefined. */
69
- export declare function completeEvolutionGoal(ctx: Context, agent: Agent): GoalViewLike | undefined;
70
- /** Block the current goal with a reason (when the service supports it). */
71
- export declare function blockEvolutionGoal(ctx: Context, agent: Agent, reason: string): GoalViewLike | undefined;
72
- //# sourceMappingURL=goal.d.ts.map
package/lib/goal.js DELETED
@@ -1,72 +0,0 @@
1
- /** The default objective used by `/evolve goal` without an explicit one. */
2
- export const DEFAULT_EVOLVE_GOAL_OBJECTIVE = "持续进化本会话 harness 状态:每轮沉淀可复用经验(失败/战术/事实/委派规格),保持条目小而带证据";
3
- /**
4
- * Resolve the goal service lazily; undefined when the profile lacks it.
5
- * Uses `ctx.get("goals")` (the global service registry) — a direct property
6
- * access like `ctx.goals` walks only the caller's fiber ancestor chain and
7
- * throws "cannot get property \"goals\" without inject" for services
8
- * provided by sibling plugin entries (the goal plugin is a sibling of this
9
- * one in the profile tree).
10
- */
11
- export function goalServiceOf(ctx) {
12
- return ctx.get("goals");
13
- }
14
- /** True when a goal view exists and is in a round-driving phase (active). */
15
- export function goalDrivesRounds(view) {
16
- return view?.phase === "active";
17
- }
18
- /** True when a goal exists at all (any phase) — used to gate create vs edit. */
19
- export function goalExists(view) {
20
- return view !== undefined;
21
- }
22
- /** Human-readable one-line status for a goal view. */
23
- export function goalStatusText(view) {
24
- const rounds = typeof view.roundsStarted === "number"
25
- ? String(view.roundsStarted)
26
- : "?";
27
- return `[${view.phase}] ${view.objective} (rounds=${rounds}/${view.maxGoalRounds}, revision=${view.revision})`;
28
- }
29
- /**
30
- * Create or edit the session's evolution goal. With no current goal: create.
31
- * With a current goal: edit its objective (create-on-first-use semantics are
32
- * enforced by the goal service itself; completed goals may be replaced).
33
- */
34
- export function upsertEvolutionGoal(ctx, agent, objective) {
35
- const goals = goalServiceOf(ctx);
36
- if (!goals) {
37
- throw new Error("evolve: /evolve goal requires the goals service (load @deepseek-ai/dsh-goal)");
38
- }
39
- const current = goals.get(agent);
40
- const nextObjective = objective && objective.length > 0 ? objective : DEFAULT_EVOLVE_GOAL_OBJECTIVE;
41
- if (goalExists(current)) {
42
- if (current.phase === "active" || current.phase === "paused") {
43
- return goals.edit(agent, { id: current.id, revision: current.revision }, { objective: nextObjective });
44
- }
45
- }
46
- return goals.create(agent, { objective: nextObjective });
47
- }
48
- /** Complete the current goal, returning the completed view or undefined. */
49
- export function completeEvolutionGoal(ctx, agent) {
50
- const goals = goalServiceOf(ctx);
51
- if (!goals) {
52
- throw new Error("evolve: /evolve goal requires the goals service (load @deepseek-ai/dsh-goal)");
53
- }
54
- const current = goals.get(agent);
55
- if (!goalExists(current) || current.phase === "complete") {
56
- return current;
57
- }
58
- return goals.complete(agent, { id: current.id, revision: current.revision });
59
- }
60
- /** Block the current goal with a reason (when the service supports it). */
61
- export function blockEvolutionGoal(ctx, agent, reason) {
62
- const goals = goalServiceOf(ctx);
63
- if (!goals || typeof goals.block !== "function") {
64
- return undefined;
65
- }
66
- const current = goals.get(agent);
67
- if (!goalExists(current) || current.phase !== "active") {
68
- return current;
69
- }
70
- return goals.block(agent, { id: current.id, revision: current.revision }, { code: "evolve-blocked", reason });
71
- }
72
- //# sourceMappingURL=goal.js.map
package/lib/inject.d.ts DELETED
@@ -1,196 +0,0 @@
1
- /**
2
- * Real prompt/spec injection: the dynamic system-prompt section that makes
3
- * `prompt` entries visible to the model without a tool call, and `subagent`
4
- * entries available as reusable delegation specs at the delegation seam.
5
- *
6
- * Design (design.md §7 Phase 2):
7
- * - the section text is a provider evaluated at every assembly with the
8
- * assembling agent; a section that renders to "" is dropped by the prompt
9
- * renderer, so an empty store costs zero tokens;
10
- * - prompt entries render as an additive section (the base system prompt is
11
- * never touched); subagent entries render as delegation specs the parent
12
- * follows when delegating, and are inherited by child agents through the
13
- * `SessionHeader.parentSession` chain so a freshly spawned subagent carries
14
- * its parent's specs without any provider wrapping;
15
- * - every cap mirrors render.ts (6 entries/kind, 180 chars/entry, stable
16
- * sort), keeping the injected cost bounded no matter how the store grows;
17
- * - full text stays one `evolve_list` call away: the injected block is a
18
- * summary index, not a duplicate of the store.
19
- */
20
- import type { HarnessEntry, HarnessState } from "./types.js";
21
- import type { EvolutionEngine } from "./service.js";
22
- import { tokenize } from "./search.js";
23
- /** CJK-bigram tokenizer re-exported for ranking consumers (see search.ts). */
24
- export { tokenize };
25
- /** Prompt sections render at most this many entries per kind. */
26
- export declare const MAX_INJECTED_ENTRIES_PER_KIND = 6;
27
- /** Per-entry content budget inside the injected block (matches render.ts). */
28
- export declare const MAX_INJECTED_CONTENT_LENGTH = 180;
29
- /** How many `parentSession` hops a child walks to inherit entries. */
30
- export declare const MAX_PARENT_CHAIN_DEPTH = 8;
31
- /** Recency half-life for the injection ranking: an entry this old scores 0. */
32
- export declare const RECENCY_HALF_LIFE_MS: number;
33
- /** At most this many recent user messages feed the relevance query. */
34
- export declare const MAX_QUERY_MESSAGES = 3;
35
- /** Query text handed to the relevance scorer is capped at this many chars. */
36
- export declare const MAX_QUERY_CHARS = 400;
37
- /** A user-message event's durable shape, loosened for duck typing. */
38
- export interface UserMessageEventLike {
39
- type?: string;
40
- data?: {
41
- content?: unknown;
42
- source?: {
43
- kind?: string;
44
- };
45
- };
46
- }
47
- /** The minimal agent shape the section provider needs (duck-typed). */
48
- export interface AgentLike {
49
- id: string;
50
- session?: {
51
- header?: {
52
- parentSession?: string;
53
- };
54
- /**
55
- * Live append-only session log as the public `session.events` getter.
56
- * Typed loosely (`unknown[]`) so the real `SessionEvent[]` union from
57
- * dsh-session is assignable; rows are narrowed to
58
- * {@link UserMessageEventLike} at read time.
59
- */
60
- events?: readonly unknown[];
61
- /**
62
- * Full-log snapshot reader that answers the same rows in the same order
63
- * where the `events` getter is absent. Called with no arguments for the
64
- * whole log, which is the read {@link sessionEventsOf} needs.
65
- */
66
- snapshotEvents?: () => readonly unknown[];
67
- };
68
- }
69
- /**
70
- * The session's event log through whichever reader the running harness
71
- * generation exposes. Returns [] when neither is present, so every caller
72
- * degrades to its empty-log path rather than throwing.
73
- */
74
- export declare function sessionEventsOf(agent: AgentLike | undefined): readonly unknown[];
75
- /** The section-provider context shape we consume (subset of AssembleContext). */
76
- export interface InjectContext {
77
- agent?: AgentLike;
78
- }
79
- /**
80
- * Normalized recency in [0, 1]: 1 when the entry was just updated, decaying
81
- * linearly to 0 after {@link RECENCY_HALF_LIFE_MS}. Unparseable timestamps
82
- * score 0 (never preferred over a timestamped entry).
83
- */
84
- export declare function recencyScore(entry: HarnessEntry, now: number): number;
85
- /**
86
- * Rank entries for injection, best first. With no query the ranking is
87
- * negative-valence first (contradicted entries last), then pure recency
88
- * (newest first). With a query, entries are scored once against a per-call
89
- * BM25 index (CJK bigrams; field-weighted title ×2 — see search.ts): any
90
- * entry with a positive score (≥1 matched token) outranks every hit-less
91
- * entry (score exactly 0), scores decide the order among relevant entries,
92
- * the negative-valence counter breaks remaining ties (contradicted entries
93
- * sink), recency breaks remaining ties, and the stable dictionary order is
94
- * the final tiebreak, so the result is deterministic. The input is never
95
- * mutated.
96
- */
97
- export declare function rankEntries(entries: readonly HarnessEntry[], query?: string, now?: number): HarnessEntry[];
98
- /**
99
- * Compose the relevance query from the assembling agent's most recent direct
100
- * user messages (event rows whose `type` is `user/message` and whose source
101
- * is a human `user`, so injected plugin context and tool results never leak
102
- * into the query). Returns "" when nothing qualifies — the ranking then
103
- * falls back to pure recency.
104
- */
105
- export declare function recentUserText(agent: AgentLike | undefined, opts?: {
106
- maxMessages?: number;
107
- maxChars?: number;
108
- }): string;
109
- /** True when the state carries at least one entry of any kind. */
110
- export declare function hasAnyEntries(state: HarnessState): boolean;
111
- /** The additive prompt-notes block (empty when there are no visible prompt entries). */
112
- export declare function formatPromptEntriesSection(entries: readonly HarnessEntry[], query?: string): string;
113
- /** The reusable delegation-specs block (empty when there are no visible subagent entries). */
114
- export declare function formatSubagentSpecsSection(entries: readonly HarnessEntry[], query?: string): string;
115
- /**
116
- * Gap B3: a lightweight directory of ALL non-archived entries across all
117
- * kinds — one line per entry, no content. Memory lines carry their recall
118
- * type (`- [memory:feedback:id] title`) so the model can judge relevance
119
- * from the index alone. This gives the model a zero-cost overview of what
120
- * exists so it can ask for full text via `evolve_list` or `/evolve list`.
121
- * The directory is appended after the curated top-N injection sections and
122
- * adds minimal tokens.
123
- *
124
- * 2026-08-22 throttle: the directory is CAPPED at {@link DEFAULT_DIRECTORY_LINES}
125
- * lines with the remainder folded into a single counter line — an uncapped
126
- * directory across a polluted global store was measured at ~2K chars of
127
- * every build in every project.
128
- *
129
- * 2026-09-23 relevance order: the directory is sorted by
130
- * {@link rankEntries} against the assembly's relevance query, so the lines
131
- * folded below the cap are the least relevant — not the dictionary tail.
132
- */
133
- export declare const DEFAULT_DIRECTORY_LINES = 15;
134
- /** One directory index line: memory lines carry their recall-type hook. */
135
- export declare function directoryLine(entry: HarnessEntry): string;
136
- export declare function formatEntriesDirectory(...kindEntries: readonly HarnessEntry[][]): string;
137
- /** {@link formatEntriesDirectory} with an explicit cap (configurable). */
138
- export declare function formatEntriesDirectoryCapped(maxLines: number, ...kindEntries: readonly HarnessEntry[][]): string;
139
- /**
140
- * {@link formatEntriesDirectoryCapped} with a relevance query: entries are
141
- * ordered by {@link rankEntries} (relevance first, then recency) so the cap
142
- * folds the least relevant entries — never the dictionary tail. An empty
143
- * query degrades to the valence/recency/stable order, still deterministic.
144
- */
145
- export declare function formatEntriesDirectoryRanked(maxLines: number, query: string | undefined, ...kindEntries: readonly HarnessEntry[][]): string;
146
- /**
147
- * The directory entries actually shown under the cap, in display order —
148
- * the single source for both the rendered text and usage accounting (so a
149
- * memory's injection IS its directory line even with the `:type` hook).
150
- * Returns [] when the directory is suppressed or empty.
151
- */
152
- export declare function rankedDirectoryEntries(maxLines: number, query: string | undefined, ...kindEntries: readonly HarnessEntry[][]): HarnessEntry[];
153
- /**
154
- * Walk the parent-session chain from `agent` upward and return the nearest
155
- * session whose local store is non-empty, if any. Children inherit their
156
- * ancestor's prompt notes and delegation specs; the chain walk stops at the
157
- * first store that has entries (deep descendants do not re-inject ancestors
158
- * beyond the nearest carrying store).
159
- */
160
- export declare function nearestLocalStateWithEntries(engine: EvolutionEngine, agent: AgentLike): HarnessState | undefined;
161
- /**
162
- * The single three-store merge every injection path reads from: the global
163
- * store merged with this project's store (when the session cwd resolves one)
164
- * and the nearest carrying local store (precedence global < project < local —
165
- * see {@link mergeHarnessStates}). One home, so the memory section and the
166
- * entry directory can never disagree about what the model can see.
167
- */
168
- export declare function mergedInjectionState(engine: EvolutionEngine, agent: AgentLike, opts?: {
169
- projectKey?: string;
170
- }): HarnessState;
171
- /**
172
- * Compose the full injected block for one assembling agent: global entries
173
- * merged with this project's store (when the session cwd resolves one) and
174
- * the nearest carrying local store (precedence global < project < local).
175
- * The optional `query` — when absent, derived from the agent's most recent
176
- * direct user messages — ranks which entries fill the per-kind cap
177
- * (relevance first, then recency; see {@link rankEntries}). Returns "" when
178
- * nothing is injectable — the prompt renderer then drops the section, so an
179
- * empty store adds zero tokens to every assembly.
180
- *
181
- * `opts.directoryLines` caps the entry-directory index (2026-08-22 throttle);
182
- * `opts.projectKey` pins the project layer explicitly (tests, tools) —
183
- * otherwise it is derived from the agent's session cwd, best-effort.
184
- * `opts.includeMemoryDirectory` (default true) drops memory lines from the
185
- * directory when the memory section already carries them (evolve v2) — one
186
- * fact, one home, so the same memories are never paid for twice.
187
- * Usage recording covers ALL kinds — memories and skills appear as directory
188
- * lines, prompts/subagents as content — and is deduped per session so the
189
- * counts read "how many sessions saw this", not "how many prompt builds".
190
- */
191
- export declare function entriesSectionText(engine: EvolutionEngine, agent: AgentLike | undefined, query?: string, opts?: {
192
- directoryLines?: number;
193
- projectKey?: string;
194
- includeMemoryDirectory?: boolean;
195
- }): string;
196
- //# sourceMappingURL=inject.d.ts.map