dsh-continual-evolve 0.11.0 → 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.
- package/README.md +35 -115
- package/README.zh.md +26 -93
- package/cordis.patch.yml +2 -2
- package/lib/index.d.ts +44 -225
- package/lib/index.js +30 -239
- package/lib/memory-guide.d.ts +13 -14
- package/lib/memory-guide.js +32 -21
- package/lib/memory-section.d.ts +77 -0
- package/lib/memory-section.js +189 -0
- package/package.json +2 -17
- package/lib/apply.d.ts +0 -22
- package/lib/apply.js +0 -157
- package/lib/approval.d.ts +0 -73
- package/lib/approval.js +0 -127
- package/lib/audit-log.d.ts +0 -19
- package/lib/audit-log.js +0 -52
- package/lib/auto.d.ts +0 -236
- package/lib/auto.js +0 -773
- package/lib/autocase.d.ts +0 -38
- package/lib/autocase.js +0 -76
- package/lib/benchmark-command.d.ts +0 -9
- package/lib/benchmark-command.js +0 -357
- package/lib/benchmark.d.ts +0 -151
- package/lib/benchmark.js +0 -250
- package/lib/command-util.d.ts +0 -70
- package/lib/command-util.js +0 -123
- package/lib/command.d.ts +0 -13
- package/lib/command.js +0 -134
- package/lib/consolidate.d.ts +0 -90
- package/lib/consolidate.js +0 -180
- package/lib/copy.d.ts +0 -37
- package/lib/copy.js +0 -58
- package/lib/declines.d.ts +0 -103
- package/lib/declines.js +0 -179
- package/lib/evaluate.d.ts +0 -74
- package/lib/evaluate.js +0 -271
- package/lib/evolve-event.d.ts +0 -40
- package/lib/evolve-event.js +0 -60
- package/lib/extraction-phase.d.ts +0 -132
- package/lib/extraction-phase.js +0 -236
- package/lib/failures.d.ts +0 -42
- package/lib/failures.js +0 -171
- package/lib/fate.d.ts +0 -130
- package/lib/fate.js +0 -350
- package/lib/goal-command.d.ts +0 -7
- package/lib/goal-command.js +0 -37
- package/lib/goal.d.ts +0 -72
- package/lib/goal.js +0 -72
- package/lib/inject.d.ts +0 -90
- package/lib/inject.js +0 -164
- package/lib/injection-caps.d.ts +0 -4
- package/lib/injection-caps.js +0 -4
- package/lib/injection-directory.d.ts +0 -29
- package/lib/injection-directory.js +0 -78
- package/lib/injection-rank.d.ts +0 -85
- package/lib/injection-rank.js +0 -161
- package/lib/listener.d.ts +0 -45
- package/lib/listener.js +0 -199
- package/lib/llm-text.d.ts +0 -104
- package/lib/llm-text.js +0 -140
- package/lib/logfile.d.ts +0 -71
- package/lib/logfile.js +0 -159
- package/lib/maintenance-commands.d.ts +0 -23
- package/lib/maintenance-commands.js +0 -136
- package/lib/memory-agent.d.ts +0 -93
- package/lib/memory-agent.js +0 -300
- package/lib/memory-apply.d.ts +0 -44
- package/lib/memory-apply.js +0 -202
- package/lib/memory-benchmark.d.ts +0 -76
- package/lib/memory-benchmark.js +0 -170
- package/lib/memory-index.d.ts +0 -114
- package/lib/memory-index.js +0 -197
- package/lib/memory-manifest.d.ts +0 -16
- package/lib/memory-manifest.js +0 -70
- package/lib/message-source.d.ts +0 -23
- package/lib/message-source.js +0 -12
- package/lib/mount-command.d.ts +0 -10
- package/lib/mount-command.js +0 -48
- package/lib/mount.d.ts +0 -42
- package/lib/mount.js +0 -212
- package/lib/notify.d.ts +0 -48
- package/lib/notify.js +0 -57
- package/lib/plan-command.d.ts +0 -12
- package/lib/plan-command.js +0 -38
- package/lib/plan.d.ts +0 -16
- package/lib/plan.js +0 -126
- package/lib/planner.d.ts +0 -61
- package/lib/planner.js +0 -144
- package/lib/pool.d.ts +0 -7
- package/lib/pool.js +0 -25
- package/lib/prefix-cache.d.ts +0 -79
- package/lib/prefix-cache.js +0 -168
- package/lib/project.d.ts +0 -28
- package/lib/project.js +0 -66
- package/lib/projection.d.ts +0 -22
- package/lib/projection.js +0 -112
- package/lib/promotion.d.ts +0 -94
- package/lib/promotion.js +0 -171
- package/lib/recall.d.ts +0 -85
- package/lib/recall.js +0 -142
- package/lib/record-language.d.ts +0 -85
- package/lib/record-language.js +0 -152
- package/lib/render.d.ts +0 -13
- package/lib/render.js +0 -80
- package/lib/review-scheduler.d.ts +0 -38
- package/lib/review-scheduler.js +0 -183
- package/lib/review.d.ts +0 -60
- package/lib/review.js +0 -145
- package/lib/rollback.d.ts +0 -9
- package/lib/rollback.js +0 -68
- package/lib/rubric.d.ts +0 -29
- package/lib/rubric.js +0 -119
- package/lib/runtime-commands.d.ts +0 -14
- package/lib/runtime-commands.js +0 -115
- package/lib/runtime.d.ts +0 -24
- package/lib/runtime.js +0 -87
- package/lib/score.d.ts +0 -64
- package/lib/score.js +0 -191
- package/lib/search.d.ts +0 -83
- package/lib/search.js +0 -136
- package/lib/service.d.ts +0 -63
- package/lib/service.js +0 -253
- package/lib/skill-render.d.ts +0 -23
- package/lib/skill-render.js +0 -69
- package/lib/skill.d.ts +0 -15
- package/lib/skill.js +0 -80
- package/lib/skillquality.d.ts +0 -85
- package/lib/skillquality.js +0 -320
- package/lib/source.d.ts +0 -30
- package/lib/source.js +0 -43
- package/lib/state.d.ts +0 -26
- package/lib/state.js +0 -151
- package/lib/store.d.ts +0 -61
- package/lib/store.js +0 -164
- package/lib/token-usage.d.ts +0 -68
- package/lib/token-usage.js +0 -211
- package/lib/tool.d.ts +0 -34
- package/lib/tool.js +0 -320
- package/lib/turn-snapshot.d.ts +0 -78
- package/lib/turn-snapshot.js +0 -252
- package/lib/types.d.ts +0 -218
- package/lib/types.js +0 -133
- package/lib/usage.d.ts +0 -36
- package/lib/usage.js +0 -98
- package/lib/validate.d.ts +0 -28
- package/lib/validate.js +0 -181
- package/lib/wrapup-candidates.d.ts +0 -127
- package/lib/wrapup-candidates.js +0 -161
- package/lib/wrapup-command.d.ts +0 -10
- package/lib/wrapup-command.js +0 -243
- package/lib/wrapup-proposals.d.ts +0 -101
- package/lib/wrapup-proposals.js +0 -281
- package/lib/wrapup.d.ts +0 -56
- package/lib/wrapup.js +0 -105
package/lib/wrapup.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session wrap-up: the lifecycle exit for a session's local harness entries.
|
|
3
|
-
*
|
|
4
|
-
* When a session ends, its local entries default to orphans: a later session
|
|
5
|
-
* (not on the parentSession chain) never sees them, and nothing promotes or
|
|
6
|
-
* archives them — the exploration results effectively "die" with the session.
|
|
7
|
-
* Wrap-up gives those entries a real exit:
|
|
8
|
-
*
|
|
9
|
-
* - cross-session-reusable content is classified `promote` and moved into the
|
|
10
|
-
* global store (through the human approval gate — global is a governed
|
|
11
|
-
* resource, exactly like skill proposals);
|
|
12
|
-
* - session-specific / superseded / already-covered content is classified
|
|
13
|
-
* `archive` (hidden from injection, data stays restorable, rollbackable);
|
|
14
|
-
* - everything else is kept.
|
|
15
|
-
*
|
|
16
|
-
* Division of labor is deliberate: the mechanical audit proposes, the LLM
|
|
17
|
-
* classifies, the user approves, the code applies deterministically. The
|
|
18
|
-
* apply-side guard (`filterPromotable`) re-checks global coverage at apply
|
|
19
|
-
* time so a stale classification can never write a duplicate global entry.
|
|
20
|
-
*
|
|
21
|
-
* Split (2026-10-03 refactor): the candidate domain lives in
|
|
22
|
-
* `wrapup-candidates.ts`, the proposal builders in `wrapup-proposals.ts`;
|
|
23
|
-
* this module owns the bounded LLM assessment call. Moved symbols are
|
|
24
|
-
* re-exported here so the public surface stays on one module.
|
|
25
|
-
*/
|
|
26
|
-
import type { Context } from "@deepseek-ai/cordis";
|
|
27
|
-
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
28
|
-
import { type TokenUsageTarget } from "./token-usage.js";
|
|
29
|
-
import { type RecordLanguage } from "./record-language.js";
|
|
30
|
-
import { type WrapupAssessment, type WrapupCandidate } from "./wrapup-candidates.js";
|
|
31
|
-
export * from "./wrapup-candidates.js";
|
|
32
|
-
export * from "./wrapup-proposals.js";
|
|
33
|
-
export declare const WRAPUP_ASSESS_SYSTEM_PROMPT = "You are the /evolve session wrap-up assessor.\nA session is ending and its local harness entries need a fate. Classify each\nlisted entry exactly once:\n\n- \"promote\" \u2014 the content is a stable, durable, CROSS-SESSION reusable lesson:\n a durable user preference, a project-level fact or convention, a reusable\n procedure or skill. Future sessions would benefit from seeing it.\n- \"archive\" \u2014 the content is session-specific task progress, one-off noise,\n superseded or obsolete, or already covered by the global store (note\n \"covered globally\" in the reason), or stale (old + never injected \u2014 note\n \"stale (injectionCount=0, recency low)\" in the reason), or CONTRADICTED \u2014\n newer evidence in the trajectory or the global store disproves or overrides\n the entry's content (note what contradicts it in the reason).\n- \"keep\" \u2014 still actively useful to this session, or genuinely uncertain.\n\nRules:\n- CONTRADICTED: when evidence contradicts an entry, set \"contradicted\": true\n on that item (besides the verdict). Entries marked \"(contradicted N\u00D7\n before)\" were contradicted in earlier assessments \u2014 prefer \"archive\" for\n them unless you have concrete evidence the content is valid again.\n- When an entry is marked \"covered globally\" in the listing, prefer \"archive\"\n or \"keep\" over \"promote\" \u2014 promoting a duplicate gains nothing.\n- When an entry is marked \"stale\" (injectionCount=0 and low recency), prefer\n \"archive\" \u2014 the entry has never been used and is old, so it is unlikely to\n be needed again. Only \"keep\" if the content is clearly valuable despite low\n usage (e.g. a safety policy that rarely triggers but is critical).\n- Do not promote local task state, work-in-progress notes, or content tied to\n one session's ephemeral details.\n- Memory entries carry a recall type (user/feedback/project/reference): a\n memory WITHOUT one cannot be promoted (the guard skips it) \u2014 verdict such\n entries \"keep\" (or \"archive\" when they qualify) rather than \"promote\".\n- Skills: only \"promote\" a skill entry that is a genuinely reusable procedure\n meeting the DSH skill quality standard; one-off workflows are \"archive\" or\n \"keep\".\n- SPLIT PROMOTION: when an entry mixes a stable, cross-session-reusable part\n WITH session-specific snapshot details, do NOT promote it whole. Instead\n give verdict \"archive\" WITH a \"promote\" sub-object holding a CLEANED\n version of only the durable part (a stable title + the persistent facts,\n stripped of dates/states/one-off figures). Ephemeral snapshot content stays\n out of the sub-object \u2014 it is left behind in the archive. A sub-object is\n only meaningful on \"archive\" verdicts.\n\nReturn JSON only:\n{\n \"rationale\": \"one or two sentences\",\n \"items\": [\n {\"key\": \"memory:foo\", \"verdict\": \"promote|archive|keep\", \"reason\": \"why\"},\n {\"key\": \"memory:bar\", \"verdict\": \"archive\", \"reason\": \"why\", \"contradicted\": true,\n \"promote\": {\"title\": \"cleaned stable title\", \"content\": \"cleaned durable part only\"}}\n ]\n}\nOnly keys from the provided list are allowed; any entry you omit defaults to \"keep\".";
|
|
34
|
-
export interface AssessOptions {
|
|
35
|
-
/** Output token budget for the assessment call. */
|
|
36
|
-
maxOutputTokens?: number;
|
|
37
|
-
/** Abort signal forwarded to the model call. */
|
|
38
|
-
signal?: AbortSignal;
|
|
39
|
-
/** Direct-call token ledger destination; phase is selected by the caller. */
|
|
40
|
-
tokenUsage?: TokenUsageTarget;
|
|
41
|
-
/** Ledger phase for this classifier call (manual wrapup or automatic fate). */
|
|
42
|
-
tokenUsagePhase?: "wrapup" | "fate";
|
|
43
|
-
/**
|
|
44
|
-
* Authoring language for verdict reasons. Absent → resolved per call
|
|
45
|
-
* (durable client preference, else `en`; the assessor sees candidate
|
|
46
|
-
* snapshots, not user text, so there is no detection tier here).
|
|
47
|
-
*/
|
|
48
|
-
language?: RecordLanguage;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Ask the model to classify the audited local candidates. Routes through the
|
|
52
|
-
* calling agent's own provider/model (same model the session runs on), with
|
|
53
|
-
* reasoning disabled so the output budget goes to the JSON verdicts.
|
|
54
|
-
*/
|
|
55
|
-
export declare function assessLocalEntries(ctx: Context, agent: Agent, candidates: readonly WrapupCandidate[], options?: AssessOptions): Promise<WrapupAssessment>;
|
|
56
|
-
//# sourceMappingURL=wrapup.d.ts.map
|
package/lib/wrapup.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { asLlmSessionId, streamText } from "./llm-text.js";
|
|
2
|
-
import { createTokenUsageObserver } from "./token-usage.js";
|
|
3
|
-
import { recordLanguageInstruction, resolveRecordLanguage } from "./record-language.js";
|
|
4
|
-
import { compactText } from "./render.js";
|
|
5
|
-
import { candidateKey, parseWrapupAssessment } from "./wrapup-candidates.js";
|
|
6
|
-
export * from "./wrapup-candidates.js";
|
|
7
|
-
export * from "./wrapup-proposals.js";
|
|
8
|
-
export const WRAPUP_ASSESS_SYSTEM_PROMPT = `You are the /evolve session wrap-up assessor.
|
|
9
|
-
A session is ending and its local harness entries need a fate. Classify each
|
|
10
|
-
listed entry exactly once:
|
|
11
|
-
|
|
12
|
-
- "promote" — the content is a stable, durable, CROSS-SESSION reusable lesson:
|
|
13
|
-
a durable user preference, a project-level fact or convention, a reusable
|
|
14
|
-
procedure or skill. Future sessions would benefit from seeing it.
|
|
15
|
-
- "archive" — the content is session-specific task progress, one-off noise,
|
|
16
|
-
superseded or obsolete, or already covered by the global store (note
|
|
17
|
-
"covered globally" in the reason), or stale (old + never injected — note
|
|
18
|
-
"stale (injectionCount=0, recency low)" in the reason), or CONTRADICTED —
|
|
19
|
-
newer evidence in the trajectory or the global store disproves or overrides
|
|
20
|
-
the entry's content (note what contradicts it in the reason).
|
|
21
|
-
- "keep" — still actively useful to this session, or genuinely uncertain.
|
|
22
|
-
|
|
23
|
-
Rules:
|
|
24
|
-
- CONTRADICTED: when evidence contradicts an entry, set "contradicted": true
|
|
25
|
-
on that item (besides the verdict). Entries marked "(contradicted N×
|
|
26
|
-
before)" were contradicted in earlier assessments — prefer "archive" for
|
|
27
|
-
them unless you have concrete evidence the content is valid again.
|
|
28
|
-
- When an entry is marked "covered globally" in the listing, prefer "archive"
|
|
29
|
-
or "keep" over "promote" — promoting a duplicate gains nothing.
|
|
30
|
-
- When an entry is marked "stale" (injectionCount=0 and low recency), prefer
|
|
31
|
-
"archive" — the entry has never been used and is old, so it is unlikely to
|
|
32
|
-
be needed again. Only "keep" if the content is clearly valuable despite low
|
|
33
|
-
usage (e.g. a safety policy that rarely triggers but is critical).
|
|
34
|
-
- Do not promote local task state, work-in-progress notes, or content tied to
|
|
35
|
-
one session's ephemeral details.
|
|
36
|
-
- Memory entries carry a recall type (user/feedback/project/reference): a
|
|
37
|
-
memory WITHOUT one cannot be promoted (the guard skips it) — verdict such
|
|
38
|
-
entries "keep" (or "archive" when they qualify) rather than "promote".
|
|
39
|
-
- Skills: only "promote" a skill entry that is a genuinely reusable procedure
|
|
40
|
-
meeting the DSH skill quality standard; one-off workflows are "archive" or
|
|
41
|
-
"keep".
|
|
42
|
-
- SPLIT PROMOTION: when an entry mixes a stable, cross-session-reusable part
|
|
43
|
-
WITH session-specific snapshot details, do NOT promote it whole. Instead
|
|
44
|
-
give verdict "archive" WITH a "promote" sub-object holding a CLEANED
|
|
45
|
-
version of only the durable part (a stable title + the persistent facts,
|
|
46
|
-
stripped of dates/states/one-off figures). Ephemeral snapshot content stays
|
|
47
|
-
out of the sub-object — it is left behind in the archive. A sub-object is
|
|
48
|
-
only meaningful on "archive" verdicts.
|
|
49
|
-
|
|
50
|
-
Return JSON only:
|
|
51
|
-
{
|
|
52
|
-
"rationale": "one or two sentences",
|
|
53
|
-
"items": [
|
|
54
|
-
{"key": "memory:foo", "verdict": "promote|archive|keep", "reason": "why"},
|
|
55
|
-
{"key": "memory:bar", "verdict": "archive", "reason": "why", "contradicted": true,
|
|
56
|
-
"promote": {"title": "cleaned stable title", "content": "cleaned durable part only"}}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
Only keys from the provided list are allowed; any entry you omit defaults to "keep".`;
|
|
60
|
-
/**
|
|
61
|
-
* Ask the model to classify the audited local candidates. Routes through the
|
|
62
|
-
* calling agent's own provider/model (same model the session runs on), with
|
|
63
|
-
* reasoning disabled so the output budget goes to the JSON verdicts.
|
|
64
|
-
*/
|
|
65
|
-
export async function assessLocalEntries(ctx, agent, candidates, options = {}) {
|
|
66
|
-
if (candidates.length === 0) {
|
|
67
|
-
return { items: [], rationale: "No local candidates to assess." };
|
|
68
|
-
}
|
|
69
|
-
if (!agent.options.provider || !agent.options.model) {
|
|
70
|
-
throw new Error("evolve: no provider/model route for the wrap-up assessor");
|
|
71
|
-
}
|
|
72
|
-
const candidateText = candidates
|
|
73
|
-
.map((candidate) => {
|
|
74
|
-
const key = candidateKey(candidate.kind, candidate.id);
|
|
75
|
-
const covered = candidate.coveredGlobally ? " (covered globally)" : "";
|
|
76
|
-
const stale = candidate.stale ? ` (stale: injectionCount=${candidate.injectionCount}, recency low)` : "";
|
|
77
|
-
const negated = candidate.negativeCount > 0 ? ` (contradicted ${candidate.negativeCount}× before)` : "";
|
|
78
|
-
const hints = candidate.globalHints.length > 0
|
|
79
|
-
? ` | global≈${candidate.globalHints.map((hint) => hint.id + ":" + hint.title).join(", ")}`
|
|
80
|
-
: "";
|
|
81
|
-
return `- ${key} [${candidate.path}, v${candidate.version}] "${candidate.title}"${covered}${stale}${negated}${hints}: ${compactText(candidate.content, 220)}`;
|
|
82
|
-
})
|
|
83
|
-
.join("\n");
|
|
84
|
-
const userPrompt = [
|
|
85
|
-
`A local session is wrapping up. Classify each entry below for its fate.`,
|
|
86
|
-
`<local_entries>\n${candidateText}\n</local_entries>`,
|
|
87
|
-
"Return only JSON. Every item must reference one of the keys above.",
|
|
88
|
-
].join("\n\n");
|
|
89
|
-
const text = await streamText(ctx, {
|
|
90
|
-
provider: agent.options.provider,
|
|
91
|
-
model: agent.options.model,
|
|
92
|
-
sessionId: asLlmSessionId(agent.id),
|
|
93
|
-
system: `${WRAPUP_ASSESS_SYSTEM_PROMPT}\n\n${recordLanguageInstruction(options.language ?? resolveRecordLanguage({ ctx }))}`,
|
|
94
|
-
prompt: userPrompt,
|
|
95
|
-
maxTokens: options.maxOutputTokens ?? 4096,
|
|
96
|
-
signal: options.signal,
|
|
97
|
-
...(options.tokenUsage
|
|
98
|
-
? {
|
|
99
|
-
onUsage: createTokenUsageObserver(options.tokenUsage, options.tokenUsagePhase ?? "wrapup", agent.options.provider, agent.options.model),
|
|
100
|
-
}
|
|
101
|
-
: {}),
|
|
102
|
-
});
|
|
103
|
-
return parseWrapupAssessment(text, candidates);
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=wrapup.js.map
|