@namzu/sdk 55.0.0 → 56.0.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/CHANGELOG.md +23 -0
- package/dist/compaction/serializer.d.ts.map +1 -1
- package/dist/compaction/serializer.js +27 -15
- package/dist/compaction/serializer.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +3 -2
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/constants/compaction/index.d.ts +3 -1
- package/dist/constants/compaction/index.d.ts.map +1 -1
- package/dist/constants/compaction/index.js +3 -1
- package/dist/constants/compaction/index.js.map +1 -1
- package/dist/{manager/resident/learning-cycle.d.ts → learning/cycle.d.ts} +45 -36
- package/dist/learning/cycle.d.ts.map +1 -0
- package/dist/{manager/resident/learning-cycle.js → learning/cycle.js} +52 -20
- package/dist/learning/cycle.js.map +1 -0
- package/dist/learning/deprecated.d.ts +86 -0
- package/dist/learning/deprecated.d.ts.map +1 -0
- package/dist/learning/deprecated.js +22 -0
- package/dist/learning/deprecated.js.map +1 -0
- package/dist/learning/experience-store.d.ts +35 -0
- package/dist/learning/experience-store.d.ts.map +1 -0
- package/dist/learning/experience-store.js +143 -0
- package/dist/learning/experience-store.js.map +1 -0
- package/dist/learning/experience.d.ts +150 -0
- package/dist/learning/experience.d.ts.map +1 -0
- package/dist/learning/experience.js +146 -0
- package/dist/learning/experience.js.map +1 -0
- package/dist/learning/generator.d.ts +118 -0
- package/dist/learning/generator.d.ts.map +1 -0
- package/dist/learning/generator.js +275 -0
- package/dist/learning/generator.js.map +1 -0
- package/dist/learning/leak-tripwire.d.ts +66 -0
- package/dist/learning/leak-tripwire.d.ts.map +1 -0
- package/dist/learning/leak-tripwire.js +208 -0
- package/dist/learning/leak-tripwire.js.map +1 -0
- package/dist/{manager/resident/learning-observation.d.ts → learning/observation.d.ts} +4 -4
- package/dist/learning/observation.d.ts.map +1 -0
- package/dist/{manager/resident/learning-observation.js → learning/observation.js} +3 -3
- package/dist/learning/observation.js.map +1 -0
- package/dist/{manager/resident/learning.d.ts → learning/skill.d.ts} +29 -29
- package/dist/learning/skill.d.ts.map +1 -0
- package/dist/{manager/resident/learning.js → learning/skill.js} +27 -27
- package/dist/learning/skill.js.map +1 -0
- package/dist/{manager/resident/learning-store.d.ts → learning/store.d.ts} +38 -31
- package/dist/learning/store.d.ts.map +1 -0
- package/dist/{manager/resident/learning-store.js → learning/store.js} +52 -20
- package/dist/learning/store.js.map +1 -0
- package/dist/manager/resident/activity.d.ts +30 -6
- package/dist/manager/resident/activity.d.ts.map +1 -1
- package/dist/manager/resident/activity.js.map +1 -1
- package/dist/manager/resident/agenda.d.ts +42 -12
- package/dist/manager/resident/agenda.d.ts.map +1 -1
- package/dist/manager/resident/agenda.js +9 -7
- package/dist/manager/resident/agenda.js.map +1 -1
- package/dist/manager/resident/consumption.d.ts +27 -5
- package/dist/manager/resident/consumption.d.ts.map +1 -1
- package/dist/manager/resident/consumption.js +2 -0
- package/dist/manager/resident/consumption.js.map +1 -1
- package/dist/manager/resident/delivery-window.d.ts +7 -1
- package/dist/manager/resident/delivery-window.d.ts.map +1 -1
- package/dist/manager/resident/delivery-window.js +2 -0
- package/dist/manager/resident/delivery-window.js.map +1 -1
- package/dist/manager/resident/evidence-recall.d.ts +7 -1
- package/dist/manager/resident/evidence-recall.d.ts.map +1 -1
- package/dist/manager/resident/evidence-recall.js +2 -0
- package/dist/manager/resident/evidence-recall.js.map +1 -1
- package/dist/manager/resident/history.d.ts +45 -9
- package/dist/manager/resident/history.d.ts.map +1 -1
- package/dist/manager/resident/history.js.map +1 -1
- package/dist/manager/resident/host.d.ts +44 -10
- package/dist/manager/resident/host.d.ts.map +1 -1
- package/dist/manager/resident/host.js +4 -2
- package/dist/manager/resident/host.js.map +1 -1
- package/dist/manager/resident/initiative.d.ts +32 -6
- package/dist/manager/resident/initiative.d.ts.map +1 -1
- package/dist/manager/resident/initiative.js +2 -0
- package/dist/manager/resident/initiative.js.map +1 -1
- package/dist/manager/resident/loop.d.ts +22 -4
- package/dist/manager/resident/loop.d.ts.map +1 -1
- package/dist/manager/resident/loop.js +7 -1
- package/dist/manager/resident/loop.js.map +1 -1
- package/dist/manager/resident/outbox.d.ts +42 -8
- package/dist/manager/resident/outbox.d.ts.map +1 -1
- package/dist/manager/resident/outbox.js +2 -0
- package/dist/manager/resident/outbox.js.map +1 -1
- package/dist/manager/resident/proposal.d.ts +17 -3
- package/dist/manager/resident/proposal.d.ts.map +1 -1
- package/dist/manager/resident/proposal.js +2 -0
- package/dist/manager/resident/proposal.js.map +1 -1
- package/dist/manager/resident/store.d.ts +27 -5
- package/dist/manager/resident/store.d.ts.map +1 -1
- package/dist/manager/resident/store.js +7 -1
- package/dist/manager/resident/store.js.map +1 -1
- package/dist/manager/resident/tool-evidence.d.ts +45 -9
- package/dist/manager/resident/tool-evidence.d.ts.map +1 -1
- package/dist/manager/resident/tool-evidence.js +5 -1
- package/dist/manager/resident/tool-evidence.js.map +1 -1
- package/dist/prompt/resident-learning.d.ts +12 -2
- package/dist/prompt/resident-learning.d.ts.map +1 -1
- package/dist/prompt/resident-learning.js +6 -5
- package/dist/prompt/resident-learning.js.map +1 -1
- package/dist/prompt/resident-step.d.ts +10 -4
- package/dist/prompt/resident-step.d.ts.map +1 -1
- package/dist/prompt/resident-step.js +6 -4
- package/dist/prompt/resident-step.js.map +1 -1
- package/dist/public-runtime.d.ts +9 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +10 -3
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +9 -4
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/file-evidence-context.d.ts +4 -0
- package/dist/runtime/query/file-evidence-context.d.ts.map +1 -1
- package/dist/runtime/query/file-evidence-context.js +5 -1
- package/dist/runtime/query/file-evidence-context.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +2 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +19 -11
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts +9 -0
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.js +19 -0
- package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +4 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/step-context.d.ts +42 -0
- package/dist/runtime/query/iteration/step-context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-context.js +114 -0
- package/dist/runtime/query/iteration/step-context.js.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.d.ts +9 -1
- package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.js +21 -11
- package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +13 -0
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +42 -0
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/scheduler/completion-inbox.js +1 -1
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +3 -5
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +14 -15
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/edit.js +1 -1
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/env-scrub.d.ts +8 -0
- package/dist/tools/env-scrub.d.ts.map +1 -1
- package/dist/tools/env-scrub.js +13 -0
- package/dist/tools/env-scrub.js.map +1 -1
- package/dist/tools/resident-history.d.ts +2 -0
- package/dist/tools/resident-history.d.ts.map +1 -1
- package/dist/tools/resident-history.js +2 -0
- package/dist/tools/resident-history.js.map +1 -1
- package/dist/tools/resident-tool-evidence.d.ts +5 -1
- package/dist/tools/resident-tool-evidence.d.ts.map +1 -1
- package/dist/tools/resident-tool-evidence.js +5 -1
- package/dist/tools/resident-tool-evidence.js.map +1 -1
- package/dist/turn/evidence-recall.d.ts +15 -3
- package/dist/turn/evidence-recall.d.ts.map +1 -1
- package/dist/turn/evidence-recall.js +116 -27
- package/dist/turn/evidence-recall.js.map +1 -1
- package/dist/types/message/notice-frame.d.ts +1 -1
- package/dist/types/message/notice-frame.d.ts.map +1 -1
- package/dist/types/message/notice-frame.js +1 -0
- package/dist/types/message/notice-frame.js.map +1 -1
- package/package.json +1 -1
- package/src/compaction/serializer.ts +29 -17
- package/src/compaction/verifier.ts +3 -2
- package/src/constants/compaction/index.ts +3 -1
- package/src/{manager/resident/learning-cycle.ts → learning/cycle.ts} +130 -78
- package/src/learning/deprecated.ts +124 -0
- package/src/learning/experience-store.ts +202 -0
- package/src/learning/experience.ts +238 -0
- package/src/learning/generator.ts +388 -0
- package/src/learning/leak-tripwire.ts +280 -0
- package/src/{manager/resident/learning-observation.ts → learning/observation.ts} +5 -5
- package/src/{manager/resident/learning.ts → learning/skill.ts} +64 -67
- package/src/{manager/resident/learning-store.ts → learning/store.ts} +97 -67
- package/src/manager/resident/activity.ts +30 -6
- package/src/manager/resident/agenda.ts +63 -33
- package/src/manager/resident/consumption.ts +27 -5
- package/src/manager/resident/delivery-window.ts +7 -1
- package/src/manager/resident/evidence-recall.ts +7 -1
- package/src/manager/resident/history.ts +45 -9
- package/src/manager/resident/host.ts +45 -11
- package/src/manager/resident/initiative.ts +32 -6
- package/src/manager/resident/loop.ts +22 -4
- package/src/manager/resident/outbox.ts +42 -8
- package/src/manager/resident/proposal.ts +17 -3
- package/src/manager/resident/store.ts +27 -5
- package/src/manager/resident/tool-evidence.ts +45 -9
- package/src/prompt/resident-learning.ts +16 -7
- package/src/prompt/resident-step.ts +19 -13
- package/src/public-runtime.ts +35 -5
- package/src/public-types.ts +96 -34
- package/src/runtime/query/file-evidence-context.ts +8 -1
- package/src/runtime/query/iteration/index.ts +27 -13
- package/src/runtime/query/iteration/phases/per-call-review.ts +19 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +3 -0
- package/src/runtime/query/iteration/step-context.ts +138 -0
- package/src/runtime/query/iteration/step-shaping.ts +39 -13
- package/src/runtime/query/steering.ts +51 -0
- package/src/scheduler/completion-inbox.ts +1 -1
- package/src/tools/builtins/bash.ts +14 -14
- package/src/tools/builtins/edit.ts +1 -1
- package/src/tools/env-scrub.ts +13 -0
- package/src/tools/resident-history.ts +2 -0
- package/src/tools/resident-tool-evidence.ts +5 -1
- package/src/turn/evidence-recall.ts +125 -30
- package/src/types/message/notice-frame.ts +3 -1
- package/dist/manager/resident/learning-cycle.d.ts.map +0 -1
- package/dist/manager/resident/learning-cycle.js.map +0 -1
- package/dist/manager/resident/learning-observation.d.ts.map +0 -1
- package/dist/manager/resident/learning-observation.js.map +0 -1
- package/dist/manager/resident/learning-store.d.ts.map +0 -1
- package/dist/manager/resident/learning-store.js.map +0 -1
- package/dist/manager/resident/learning.d.ts.map +0 -1
- package/dist/manager/resident/learning.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 56.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 4ef7f2d: A failing `bash` result no longer ends with the line "NOTE: N credential-shaped environment variables were removed ..."; its `output` is only what the command printed, and the count is in `data.withheldEnv`. The kernel now tells the model in a framed user-role notice of its own after the tool batch, once, and again only when the count changes. If your host parsed that line out of `output`, read `result.data.withheldEnv` instead; `describeWithheldEnv` now returns the notice sentence without the "NOTE:" prefix.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 4ef7f2d: The compaction summary's `## Current Goal` section is written only when the newest request says something the `## Task` entry does not; it no longer repeats the task word for word. Nothing to do on upgrade.
|
|
12
|
+
- 4ef7f2d: The summary a compaction leaves reads more plainly. The files list gives one line per file, the path then what was done to it ("read; changed"), instead of repeating "read: read". The heading for details the summary check adds is now `## Missing Details`, and the newest request is restated under `## Current Goal` (the task when nothing newer was asked) just before the open items; the `Latest request:` prefix inside `## User Requirements` is gone. The `edit` tool's description now gives the reason for its 12000 character budget. A host that matches these headings in a summary should read the new names; the saved working state itself is unchanged.
|
|
13
|
+
- 4ef7f2d: A turn's request-only data (repository snapshot, recalled memory, conversation evidence, file evidence) now keeps the place it first had on every later call of the turn, instead of moving from before your message to after the tool results, so within a turn each request begins with the whole of the one before it and a caching provider keeps reading the same prefix. This holds for the calls of one turn only: the next turn takes its data afresh, so its opening differs from the previous turn's. The conversation-evidence step reads the archive once per turn: a tool result written to the archive mid-turn no longer changes the block, and the next turn (or a new message from the person) reads afresh. File evidence and the owned-work block, when they change, are appended as a later block, as their headings say, instead of replacing the earlier one in place; this is a behaviour change: the model can still read the earlier, out of date text of a file body, so only the latest version and the two before it are carried, and versions a compaction displaced are dropped. Other data whose text changed is replaced. The conversation-evidence opening paragraph is no longer than before, names each JSON key it mentions once in code style, and no longer prints internal kind names; its JSON no longer carries the scan byte count. The note that evidence is unavailable is now two plain sentences, not JSON, so it no longer carries the status, stage or reason as fields. Nothing to change in your code; a host that matches the old wording of the evidence block, reads `scannedBytes` from it, parses the availability note's fields, or expects one file-evidence block per request should read the new text and take the last block.
|
|
14
|
+
|
|
15
|
+
## 55.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 5aae7c4: New, additive: an experience library for the learning module. `SqliteLearningExperienceStore` records, per adopted or rejected cycle, the full artefact, a typed edit ledger (surface, change, verdict `helped` / `hurt` / `no observed effect` / `confounded`) and lessons (cue, lesson, evidence, confidence with a reason). When a candidate changed several components, rows not tried alone are stored as `confounded`, and a lesson resting on confounded edits is capped at medium or low. `retrieve` returns entries only from the same domain and evaluator revision, and only those recorded before the ordinal you pass. Entries are immutable, run through the leak tripwire, and live in a separate database file. New exports: `SqliteLearningExperienceStore`, `normalizeLearningExperience`, `selectLearningExperience`, `LEARNING_EDIT_VERDICTS`, `LEARNING_CONFIDENCE_LEVELS`, `LEARNING_EXPERIENCE_STORE_VERSION` and the related types. Nothing existing changes; the cycle does not read the library yet. `record` and `retrieve` require a `leakGuard` (pass `{}` for the built-in checks only) and scan every string an entry holds, on write and again on read. More than one edit row is treated as changed together unless marked `isolated`, and a lesson citing no edits is capped as resting on all of them.
|
|
20
|
+
- 5aae7c4: New, additive: the first built-in learning generator. `proposeLearningCandidate` reads a domain's observations and earlier cycles, asks a model you supply (`LearningModel`, one function returning text and token counts) for one revision of an instruction skill, and returns the candidate with its typed edits, or refuses it. Every edit must sit on the editable surface (`resolveLearningSurface`, today the instruction skill only) and the wording must stay clear of the safety floor; a problem goes back to the model once and a second failure is refused, naming the part and never the text. `LEARNING_FLOOR_COMPONENTS` lists what is never editable and `resolveLearningSurface` throws if a configuration names one. `learningExperienceFromCycle` turns a finished cycle into an experience entry (adopted and helped, rejected and hurt or no observed effect). The proposal does not judge itself: it goes through `runLearningCycle` for paired verification, protection, confirmation and exact-revision activation. Nothing existing changes. New exports: `proposeLearningCandidate`, `resolveLearningSurface`, `learningExperienceFromCycle`, `LEARNING_SURFACE_KINDS`, `LEARNING_FLOOR_COMPONENTS` and the related types.
|
|
21
|
+
- 5aae7c4: The learning cycle now refuses to learn from, or produce, anything that carries evaluator-side material. `runLearningCycle` checks the active skill baseline, the failure evidence (before any stage or journal entry), exploration observations and the generated candidate against the built-in grader-verdict and answer-key wording and secret shapes, plus an optional `leakGuard` you supply (path globs, planted canaries from `createLearningCanary()`, extra markers, verbatim protection-task text, literal secrets). A hit ends the cycle with status `failed`, a reason that says it is a leak and not a false positive, and `result.leak` listing the kind, subject and rule; the matched text is never repeated and a refused candidate is not returned. New exports: `createLearningCanary`, `scanForLearningLeak`, `assertNoLearningLeak`, `LearningLeakError` and the types `LearningLeakGuard`, `LearningLeakFinding`, `LearningLeakKind`, `LearningLeakSubject`. What to check: evidence that legitimately mentions a verdict, an answer key or a secret-shaped string is now refused. Remove or redact it at the source; there is no switch to turn the built-in checks off. Canaries are also found inside larger base64 or base64url blobs at any alignment and in uppercase hex; the built-in secret shapes are found through zero-width characters. The CLI passes no `leakGuard`, so it applies only the built-in checks.
|
|
22
|
+
- 5aae7c4: Learning moves out of the resident module into its own, because it is not specific to residents. Nothing breaks: every exported name that began with `Resident` (`runResidentLearningCycle`, `SqliteResidentLearningStore`, `runStoredResidentLearningCycle`, `runStoredResidentLearningFromObservations`, `hashResidentSkill`, `projectResidentLearning`, `ResidentSkillCandidate`, `ResidentLearningState`, and the rest) still works and is the same value or type as its new name (`runLearningCycle`, `SqliteLearningStore`, `runStoredLearningCycle`, `runStoredLearningFromObservations`, `hashLearningSkill`, `projectLearning`, `LearningSkillCandidate`, `LearningState`, ...). The old names are marked `@deprecated` and will be removed in the next major release; switch to the new names when convenient. Also new: `SqliteLearningStore.pruneObservations(shouldDrop)`, which removes unclaimed observations a host no longer wants to keep.
|
|
23
|
+
- 5aae7c4: Learning by itself no longer counts a refused tool call as a failure: the answer to a call you declined, to a call that went with the turn your No ended, and to a call whose question went unanswered records nothing, because those are your choices, not a tool that broke. The background learning cycle also stays still while any question about a tool call waits on you, and goes on once it closes. The guidance a project learned now opens with "Namzu learned" instead of claiming you confirmed it, since the background cycle activates it without a prompt; a stored memory still wins where the two disagree. `@namzu/sdk` adds `isReviewRefusalResult(output)`, which says whether a tool result answers a call the review did not let run, so a host that counts failures can leave those out. Nothing to change on upgrade.
|
|
24
|
+
- 5aae7c4: Residents are deprecated and will be removed in the next major release. Every resident export (`runResident`, `stepResident`, `ResidentHost`, `DiskResidentStore`, `DiskResidentAgenda`, `createResidentSelector`, `inspectResidentConsumption`, the outbox, history, tool-evidence and step-context helpers, and their types) is now marked `@deprecated` and behaves as before. Nothing is removed in this release. If you use them for long-running work, move to scheduled tasks (`LocalTaskScheduler`), session goals or background agents; learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda (`DiskResidentAgenda`) as its activation target and throws `ResidentConflictError` when it is paused, so a consumer of learning still needs the deprecated resident agenda store. Learning gets its own activation target before the residents are removed; that is the precondition for removing them in the next major release.
|
|
25
|
+
|
|
3
26
|
## 55.0.0
|
|
4
27
|
|
|
5
28
|
### Major Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/compaction/serializer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/compaction/serializer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,YAAY,CAAA;AAuExD,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAW7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIhD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA0E1D"}
|
|
@@ -8,19 +8,29 @@ const PLAN_STATUS_ICONS = {
|
|
|
8
8
|
function renderPlan(plan) {
|
|
9
9
|
return plan.map((slot) => `- ${PLAN_STATUS_ICONS[slot.status]} ${slot.label}`).join('\n');
|
|
10
10
|
}
|
|
11
|
+
/** What one recorded action says, in words a reader needs no key for. */
|
|
12
|
+
function describeAction(action) {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case 'read':
|
|
15
|
+
return 'read';
|
|
16
|
+
case 'delete':
|
|
17
|
+
return 'deleted';
|
|
18
|
+
case 'create':
|
|
19
|
+
case 'edit': {
|
|
20
|
+
const verb = action.type === 'create' ? 'created' : 'changed';
|
|
21
|
+
const detail = action.detail?.replace(/\s+/g, ' ').trim();
|
|
22
|
+
return detail && detail !== 'modified' ? `${verb} (${detail})` : verb;
|
|
23
|
+
}
|
|
24
|
+
default:
|
|
25
|
+
return action.type;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** One line per file: the path, then what was done to it, each distinct step once and in order. */
|
|
11
29
|
function renderFiles(files) {
|
|
12
30
|
const lines = [];
|
|
13
31
|
for (const [, slot] of files) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (action.type === 'delete') {
|
|
17
|
-
lines.push(' - deleted');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const desc = 'detail' in action ? action.detail : action.summary;
|
|
21
|
-
lines.push(` - ${action.type}: ${desc ?? ''}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
32
|
+
const done = [...new Set(slot.actions.map(describeAction))];
|
|
33
|
+
lines.push(`- \`${slot.path}\`: ${done.join('; ')}`);
|
|
24
34
|
}
|
|
25
35
|
return lines.join('\n');
|
|
26
36
|
}
|
|
@@ -35,10 +45,6 @@ function renderList(items, evictedCount = 0) {
|
|
|
35
45
|
}
|
|
36
46
|
return lines.join('\n');
|
|
37
47
|
}
|
|
38
|
-
/** The newest request is the goal the next step works toward; mark it where it already stands. */
|
|
39
|
-
function markLatest(requirements) {
|
|
40
|
-
return requirements.map((item, i) => i === requirements.length - 1 ? `Latest request: ${item}` : item);
|
|
41
|
-
}
|
|
42
48
|
function renderToolResults(results, evictedCount = 0) {
|
|
43
49
|
const lines = results.map((r) => `- **${r.tool}**: ${r.summary}`);
|
|
44
50
|
if (evictedCount > 0) {
|
|
@@ -77,7 +83,7 @@ export function serializeState(state) {
|
|
|
77
83
|
sections.push(`${SECTION_HEADERS.task}\n\n${state.task}`);
|
|
78
84
|
}
|
|
79
85
|
if (state.userRequirements.length > 0) {
|
|
80
|
-
sections.push(`${SECTION_HEADERS.userRequirements}\n\n${renderList(
|
|
86
|
+
sections.push(`${SECTION_HEADERS.userRequirements}\n\n${renderList(state.userRequirements, state.evicted.userRequirements)}`);
|
|
81
87
|
}
|
|
82
88
|
if (state.plan.length > 0) {
|
|
83
89
|
sections.push(`${SECTION_HEADERS.plan}\n\n${renderPlan(state.plan)}`);
|
|
@@ -108,6 +114,12 @@ export function serializeState(state) {
|
|
|
108
114
|
if (state.discoveries.length > 0) {
|
|
109
115
|
sections.push(`${SECTION_HEADERS.discoveries}\n\n${renderList(state.discoveries, state.evicted.discoveries)}`);
|
|
110
116
|
}
|
|
117
|
+
// The goal is restated near the end, where recency keeps it in view: the
|
|
118
|
+
// newest request, and only when it says something the Task entry does not.
|
|
119
|
+
const goal = state.userRequirements[state.userRequirements.length - 1];
|
|
120
|
+
if (goal && goal.trim() !== state.task?.trim()) {
|
|
121
|
+
sections.push(`${SECTION_HEADERS.goal}\n\n${goal}`);
|
|
122
|
+
}
|
|
111
123
|
// Last, where recency keeps it in view: what is still to do.
|
|
112
124
|
if (openItems.length > 0) {
|
|
113
125
|
sections.push(`${SECTION_HEADERS.openItems}\n\n${renderList(openItems)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/compaction/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,MAAM,iBAAiB,GAAuC;IAC7D,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;CACjB,CAAA;AAED,SAAS,UAAU,CAAC,IAAgB;IACnC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1F,CAAC;AAED,SAAS,
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/compaction/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,CAAC,CAAC,CAAA;IACtE,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QAChD,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,OAAO,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;IAED,6DAA6D;IAC7D,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,SAAS,OAAO,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/compaction/verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../src/compaction/verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAS5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAsC,MAAM,2BAA2B,CAAA;AAE5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAuIvD;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnD,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC7C,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,OAAQ,CAAA;AAgBtD,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,mBAAmB,EAC5B,aAAa,EAAE,OAAO,EAAE,EACxB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,SAAS;AACnB;;;;;;GAMG;AACH,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,GAAE,6BAAkC,GACzC,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;;;;GAKG;AACH,wBAAsB,uCAAuC,CAC5D,OAAO,EAAE,mBAAmB,EAC5B,aAAa,EAAE,OAAO,EAAE,EACxB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,WAAW,EACpB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SECTION_HEADERS } from '../constants/compaction/index.js';
|
|
1
2
|
import { collectChatCompletion } from '../provider/collect-chat-completion.js';
|
|
2
3
|
import { resolveStreamIdleTimeoutMs, withStreamIdleTimeout } from '../provider/idle-timeout.js';
|
|
3
4
|
import { generateRenderNonce, nonceClosureStatement, pickRenderNonce, } from '../tools/render-nonce.js';
|
|
@@ -233,7 +234,7 @@ async function buildVerifiedSummaryWithProvider(manager, olderMessages, provider
|
|
|
233
234
|
// says the same thing by accident — a turn truncated at
|
|
234
235
|
// `llmVerificationMaxTokens`, a refusal, or a provider that returned no
|
|
235
236
|
// content at all — and used to fall through to the append below, stamping a
|
|
236
|
-
// bare `##
|
|
237
|
+
// bare `## Missing Details` heading with nothing under it. That
|
|
237
238
|
// empty promise then rides in the compaction summary, and therefore in every
|
|
238
239
|
// subsequent system prompt, for the rest of the turn. A heading with no body
|
|
239
240
|
// is not a verification result; treat a silent verifier the same as one that
|
|
@@ -241,6 +242,6 @@ async function buildVerifiedSummaryWithProvider(manager, olderMessages, provider
|
|
|
241
242
|
if (responseText === 'COMPLETE' || responseText.length === 0) {
|
|
242
243
|
return serialized;
|
|
243
244
|
}
|
|
244
|
-
return `${serialized}\n\n
|
|
245
|
+
return `${serialized}\n\n${SECTION_HEADERS.verifierAdditions}\n\n${responseText}`;
|
|
245
246
|
}
|
|
246
247
|
//# sourceMappingURL=verifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../src/compaction/verifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAC/F,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GACf,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;4PAagO,CAAA;AAE5P,QAAQ,CAAC,CAAC,iBAAiB,CAC1B,UAA0E;IAE1E,MAAM,IAAI,GACT,UAAU,CAAC,IAAI,KAAK,QAAQ;QAC3B,CAAC,CAAC,UAAU,CAAC,IAAI;QACjB,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU;YAC/B,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,OAAO,CAAA;IACZ,MAAM,IAAI,IAAI,EAAE,CAAA;IAChB,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC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I,YAAY,KAAK,UAAU,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9D,OAAO,UAAU,CAAA;IAClB,CAAC;IAED,OAAO,GAAG,UAAU,OAAO,eAAe,CAAC,iBAAiB,OAAO,YAAY,EAAE,CAAA;AAClF,CAAC"}
|
|
@@ -8,12 +8,14 @@ export declare const SECTION_HEADERS: {
|
|
|
8
8
|
readonly userRequirements: "## User Requirements";
|
|
9
9
|
readonly plan: "## Plan";
|
|
10
10
|
readonly environment: "## Environment";
|
|
11
|
-
readonly files: "## Files
|
|
11
|
+
readonly files: "## Files";
|
|
12
12
|
readonly decisions: "## Key Decisions";
|
|
13
13
|
readonly assistantNotes: "## Assistant Notes";
|
|
14
14
|
readonly toolResults: "## Tool Results";
|
|
15
15
|
readonly failures: "## Errors & Failures";
|
|
16
16
|
readonly discoveries: "## Discoveries";
|
|
17
|
+
readonly goal: "## Current Goal";
|
|
17
18
|
readonly openItems: "## Open Items and Next Step";
|
|
19
|
+
readonly verifierAdditions: "## Missing Details";
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/compaction/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,aAAoB,CAAA;AAE3C,eAAO,MAAM,UAAU,aAA6B,CAAA;AAEpD,eAAO,MAAM,WAAW,aAAoB,CAAA;AAE5C,eAAO,MAAM,YAAY,aAA4B,CAAA;AAErD,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/compaction/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,aAAoB,CAAA;AAE3C,eAAO,MAAM,UAAU,aAA6B,CAAA;AAEpD,eAAO,MAAM,WAAW,aAAoB,CAAA;AAE5C,eAAO,MAAM,YAAY,aAA4B,CAAA;AAErD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAelB,CAAA"}
|
|
@@ -13,12 +13,14 @@ export const SECTION_HEADERS = {
|
|
|
13
13
|
userRequirements: '## User Requirements',
|
|
14
14
|
plan: '## Plan',
|
|
15
15
|
environment: '## Environment',
|
|
16
|
-
files: '## Files
|
|
16
|
+
files: '## Files',
|
|
17
17
|
decisions: '## Key Decisions',
|
|
18
18
|
assistantNotes: '## Assistant Notes',
|
|
19
19
|
toolResults: '## Tool Results',
|
|
20
20
|
failures: '## Errors & Failures',
|
|
21
21
|
discoveries: '## Discoveries',
|
|
22
|
+
goal: '## Current Goal',
|
|
22
23
|
openItems: '## Open Items and Next Step',
|
|
24
|
+
verifierAdditions: '## Missing Details',
|
|
23
25
|
};
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/compaction/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,kEAAkE;AAClE,+DAA+D;AAC/D,8DAA8D;AAC9D,oCAAoC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,sBAAsB;IACxC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/compaction/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,kEAAkE;AAClE,+DAA+D;AAC/D,8DAA8D;AAC9D,oCAAoC;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,sBAAsB;IACxC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,kBAAkB;IAC7B,cAAc,EAAE,oBAAoB;IACpC,WAAW,EAAE,iBAAiB;IAC9B,QAAQ,EAAE,sBAAsB;IAChC,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,iBAAiB;IACvB,SAAS,EAAE,6BAA6B;IACxC,iBAAiB,EAAE,oBAAoB;CAC9B,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type HarnessProtectionPlan } from '
|
|
3
|
-
import { type HarnessReview, type HarnessVerificationBatch } from '
|
|
4
|
-
import type { DiskResidentAgenda } from '
|
|
5
|
-
import { type
|
|
2
|
+
import { type HarnessProtectionPlan } from '../eval/harness-protection.js';
|
|
3
|
+
import { type HarnessReview, type HarnessVerificationBatch } from '../eval/harness-verification.js';
|
|
4
|
+
import type { DiskResidentAgenda } from '../manager/resident/agenda.js';
|
|
5
|
+
import { type LearningLeakFinding, type LearningLeakGuard } from './leak-tripwire.js';
|
|
6
|
+
import { type LearningEvidence, type LearningSkillCandidate } from './skill.js';
|
|
6
7
|
/** @experimental One explicitly requested experiment; callbacks own inference and evaluation. */
|
|
7
|
-
export type
|
|
8
|
+
export type LearningStage = 'explore' | 'generate' | 'verification' | 'confirmation';
|
|
8
9
|
declare const receiptSchema: z.ZodObject<{
|
|
9
10
|
/** The session and turn of the execution this usage belongs to; one receipt per turn. */
|
|
10
11
|
sessionId: z.ZodString;
|
|
@@ -23,9 +24,9 @@ declare const receiptSchema: z.ZodObject<{
|
|
|
23
24
|
costUsd: number | null;
|
|
24
25
|
}>;
|
|
25
26
|
/** @experimental One non-overlapping execution's usage, including its retries. Null is unknown. */
|
|
26
|
-
export type
|
|
27
|
+
export type LearningReceipt = Readonly<z.infer<typeof receiptSchema>>;
|
|
27
28
|
/** @experimental Recorded values are lower bounds when a receipt or stage is incomplete. */
|
|
28
|
-
export interface
|
|
29
|
+
export interface LearningConsumption {
|
|
29
30
|
readonly tokens: number;
|
|
30
31
|
readonly costUsd: number;
|
|
31
32
|
readonly receipts: number;
|
|
@@ -34,51 +35,51 @@ export interface ResidentLearningConsumption {
|
|
|
34
35
|
readonly unfinishedStages: number;
|
|
35
36
|
}
|
|
36
37
|
/** @experimental Append in sequence to host-owned durable storage before acknowledging. */
|
|
37
|
-
export interface
|
|
38
|
+
export interface LearningCycleEvent {
|
|
38
39
|
readonly cycleId: string;
|
|
39
40
|
readonly sequence: number;
|
|
40
41
|
readonly kind: 'started' | 'stage-started' | 'stage-finished' | 'usage' | 'exploration' | 'candidate' | 'evaluation' | 'activation-requested' | 'finished';
|
|
41
|
-
readonly stage?:
|
|
42
|
+
readonly stage?: LearningStage;
|
|
42
43
|
readonly data: Readonly<Record<string, unknown>>;
|
|
43
44
|
}
|
|
44
45
|
/** @experimental Use this stage's signal for every owned execution; await every usage append. */
|
|
45
|
-
export interface
|
|
46
|
+
export interface LearningCycleContext {
|
|
46
47
|
readonly cycleId: string;
|
|
47
|
-
readonly stage:
|
|
48
|
+
readonly stage: LearningStage;
|
|
48
49
|
readonly signal: AbortSignal;
|
|
49
50
|
/** Planning allowance, not a reservation or a cap on a callback's in-flight work. */
|
|
50
51
|
readonly remainingUnits: number;
|
|
51
|
-
recordUsage(receipt:
|
|
52
|
+
recordUsage(receipt: LearningReceipt): Promise<void>;
|
|
52
53
|
}
|
|
53
54
|
/** @experimental Original failure and active baseline; never contains confirmation tasks. */
|
|
54
|
-
export interface
|
|
55
|
+
export interface LearningExplorationContext extends LearningCycleContext {
|
|
55
56
|
readonly skillName: string;
|
|
56
57
|
/** Admitted by the host before generation; cannot be changed by a candidate. */
|
|
57
58
|
readonly purpose?: 'task' | 'exploration';
|
|
58
59
|
readonly failure: Readonly<{
|
|
59
|
-
evidence:
|
|
60
|
+
evidence: LearningEvidence;
|
|
60
61
|
trace: string;
|
|
61
62
|
}>;
|
|
62
|
-
readonly baseline:
|
|
63
|
+
readonly baseline: LearningSkillCandidate | null;
|
|
63
64
|
}
|
|
64
65
|
/** @experimental Host-retained environment observations, not a model's claim of success. */
|
|
65
|
-
export interface
|
|
66
|
-
readonly evidence:
|
|
66
|
+
export interface LearningExploration {
|
|
67
|
+
readonly evidence: LearningEvidence;
|
|
67
68
|
readonly trace: string;
|
|
68
69
|
}
|
|
69
70
|
/** @experimental Generation sees completed exploration, never held-out evaluation cases. */
|
|
70
|
-
export interface
|
|
71
|
-
readonly exploration?: Readonly<
|
|
71
|
+
export interface LearningGenerationContext extends LearningExplorationContext {
|
|
72
|
+
readonly exploration?: Readonly<LearningExploration>;
|
|
72
73
|
}
|
|
73
74
|
/** @experimental The host supplies independently scored, retained traces for these exact revisions. */
|
|
74
|
-
export interface
|
|
75
|
-
readonly baseline:
|
|
76
|
-
readonly candidate:
|
|
75
|
+
export interface LearningEvaluationContext extends LearningCycleContext {
|
|
76
|
+
readonly baseline: LearningSkillCandidate | null;
|
|
77
|
+
readonly candidate: LearningSkillCandidate;
|
|
77
78
|
readonly baselineRevision: string;
|
|
78
79
|
readonly candidateRevision: string;
|
|
79
80
|
}
|
|
80
|
-
/** @experimental
|
|
81
|
-
export interface
|
|
81
|
+
/** @experimental The SDK installs no provider, background loop or executable-code activation; the host supplies them. */
|
|
82
|
+
export interface LearningCycleOptions {
|
|
82
83
|
/** Omitted means task guidance. Explicitly select exploration to improve an explorer policy. */
|
|
83
84
|
readonly purpose?: 'task' | 'exploration';
|
|
84
85
|
/** Fixed before generation; both rounds must preserve every named task. */
|
|
@@ -86,43 +87,51 @@ export interface ResidentLearningCycleOptions {
|
|
|
86
87
|
readonly agenda: Pick<DiskResidentAgenda, 'read' | 'promoteSkill'>;
|
|
87
88
|
readonly skillName: string;
|
|
88
89
|
readonly failure: {
|
|
89
|
-
readonly evidence:
|
|
90
|
+
readonly evidence: LearningEvidence;
|
|
90
91
|
readonly trace: string;
|
|
91
92
|
};
|
|
92
93
|
readonly parentCycleId?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Evaluator-side material to keep out of the evidence and the guidance built
|
|
96
|
+
* from it. The built-in markers and secret shapes always apply. A hit refuses
|
|
97
|
+
* the cycle as a leak (see `LearningCycleResult.leak`), before anything is built.
|
|
98
|
+
*/
|
|
99
|
+
readonly leakGuard?: LearningLeakGuard;
|
|
93
100
|
readonly signal: AbortSignal;
|
|
94
101
|
/** Stops subsequent stages/activation after observed excess; callbacks enforce in-flight limits. */
|
|
95
102
|
readonly resources: {
|
|
96
103
|
readonly unit: 'tokens' | 'usd';
|
|
97
104
|
readonly maxUnits: number;
|
|
98
105
|
};
|
|
99
|
-
readonly record: (event:
|
|
106
|
+
readonly record: (event: LearningCycleEvent) => Promise<void>;
|
|
100
107
|
/** Optional active tool exploration before synthesis; the host retains actual observations. */
|
|
101
|
-
readonly explore?: (context:
|
|
102
|
-
readonly observations:
|
|
108
|
+
readonly explore?: (context: LearningExplorationContext) => Promise<{
|
|
109
|
+
readonly observations: LearningExploration;
|
|
103
110
|
readonly usageComplete: boolean;
|
|
104
111
|
}>;
|
|
105
|
-
readonly generate: (context:
|
|
106
|
-
readonly candidate:
|
|
112
|
+
readonly generate: (context: LearningGenerationContext) => Promise<{
|
|
113
|
+
readonly candidate: LearningSkillCandidate;
|
|
107
114
|
/** All executions, including failures and side calls, have supplied receipts. */
|
|
108
115
|
readonly usageComplete: boolean;
|
|
109
116
|
}>;
|
|
110
|
-
readonly evaluate: (context:
|
|
117
|
+
readonly evaluate: (context: LearningEvaluationContext) => Promise<{
|
|
111
118
|
readonly batch: HarnessVerificationBatch;
|
|
112
119
|
readonly usageComplete: boolean;
|
|
113
120
|
}>;
|
|
114
121
|
}
|
|
115
122
|
/** @experimental An ambiguous activation must be inspected, never automatically replayed. */
|
|
116
|
-
export interface
|
|
123
|
+
export interface LearningCycleResult {
|
|
117
124
|
readonly cycleId: string;
|
|
118
125
|
readonly status: 'activated' | 'rejected' | 'inconclusive' | 'conflict' | 'cancelled' | 'failed' | 'activation-unknown';
|
|
119
126
|
readonly reason: string;
|
|
120
|
-
readonly candidate?:
|
|
127
|
+
readonly candidate?: LearningSkillCandidate;
|
|
121
128
|
readonly candidateRevision?: string;
|
|
122
129
|
readonly baselineRevision?: string;
|
|
123
130
|
readonly agendaRevision?: number;
|
|
124
131
|
readonly review?: HarnessReview;
|
|
125
|
-
|
|
132
|
+
/** Present when the cycle was refused as a leak: where it was seen, never the text. */
|
|
133
|
+
readonly leak?: readonly LearningLeakFinding[];
|
|
134
|
+
readonly consumption: LearningConsumption;
|
|
126
135
|
readonly auditComplete: boolean;
|
|
127
136
|
}
|
|
128
137
|
/**
|
|
@@ -130,6 +139,6 @@ export interface ResidentLearningCycleResult {
|
|
|
130
139
|
* activate through the existing exact-revision transaction. No internal inference
|
|
131
140
|
* loop, retry or model-generated success claim replaces the host's evaluator.
|
|
132
141
|
*/
|
|
133
|
-
export declare function
|
|
142
|
+
export declare function runLearningCycle(options: LearningCycleOptions): Promise<LearningCycleResult>;
|
|
134
143
|
export {};
|
|
135
|
-
//# sourceMappingURL=
|
|
144
|
+
//# sourceMappingURL=cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycle.d.ts","sourceRoot":"","sources":["../../src/learning/cycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAE7B,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAGtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAK3B,MAAM,YAAY,CAAA;AAEnB,iGAAiG;AACjG,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,cAAc,GAAG,cAAc,CAAA;AAEpF,QAAA,MAAM,aAAa;IAClB,yFAAyF;;;;;;;;;;;;;;;EAKxF,CAAA;AAEF,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC,CAAA;AAErE,4FAA4F;AAC5F,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;CACjC;AAED,2FAA2F;AAC3F,MAAM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,EAAE,OAAO,CAAA;CAC/B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAyX9B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { normalizeHarnessProtection, } from '
|
|
4
|
-
import { reviewHarnessCandidate, } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { normalizeHarnessProtection, } from '../eval/harness-protection.js';
|
|
4
|
+
import { reviewHarnessCandidate, } from '../eval/harness-verification.js';
|
|
5
|
+
import { ResidentConflictError } from '../manager/resident/store.js';
|
|
6
|
+
import { LearningLeakError, assertNoLearningLeak, } from './leak-tripwire.js';
|
|
7
|
+
import { hashLearningSkill, learningEvidenceSchema, normalizeLearningSkill, promoteLearningSkill, } from './skill.js';
|
|
7
8
|
const receiptSchema = z.object({
|
|
8
9
|
/** The session and turn of the execution this usage belongs to; one receipt per turn. */
|
|
9
10
|
sessionId: z.string().uuid(),
|
|
@@ -16,7 +17,7 @@ const receiptSchema = z.object({
|
|
|
16
17
|
* activate through the existing exact-revision transaction. No internal inference
|
|
17
18
|
* loop, retry or model-generated success claim replaces the host's evaluator.
|
|
18
19
|
*/
|
|
19
|
-
export async function
|
|
20
|
+
export async function runLearningCycle(options) {
|
|
20
21
|
const protection = normalizeHarnessProtection(options.protection);
|
|
21
22
|
const purpose = z.enum(['task', 'exploration']).parse(options.purpose ?? 'task');
|
|
22
23
|
const purposeContext = options.purpose === undefined ? {} : { purpose };
|
|
@@ -25,7 +26,7 @@ export async function runResidentLearningCycle(options) {
|
|
|
25
26
|
.regex(/^[a-z0-9][a-z0-9_-]{0,63}$/)
|
|
26
27
|
.parse(options.skillName);
|
|
27
28
|
const failure = Object.freeze({
|
|
28
|
-
evidence: Object.freeze(
|
|
29
|
+
evidence: Object.freeze(learningEvidenceSchema.parse(options.failure.evidence)),
|
|
29
30
|
trace: z.string().trim().min(1).max(32_000).parse(options.failure.trace),
|
|
30
31
|
});
|
|
31
32
|
const resources = z
|
|
@@ -44,6 +45,7 @@ export async function runResidentLearningCycle(options) {
|
|
|
44
45
|
let review;
|
|
45
46
|
let activatedRevision;
|
|
46
47
|
let activationRequested = false;
|
|
48
|
+
let leak;
|
|
47
49
|
const usage = () => ({
|
|
48
50
|
tokens: [...receipts.values()].reduce((n, r) => n + (r.tokens ?? 0), 0),
|
|
49
51
|
costUsd: [...receipts.values()].reduce((n, r) => n + (r.costUsd ?? 0), 0),
|
|
@@ -75,6 +77,7 @@ export async function runResidentLearningCycle(options) {
|
|
|
75
77
|
...(candidate ? { candidate, candidateRevision } : {}),
|
|
76
78
|
...(baselineRevision ? { baselineRevision } : {}),
|
|
77
79
|
...(review ? { review } : {}),
|
|
80
|
+
...(leak ? { leak } : {}),
|
|
78
81
|
...(activatedRevision !== undefined ? { agendaRevision: activatedRevision } : {}),
|
|
79
82
|
consumption: usage(),
|
|
80
83
|
auditComplete,
|
|
@@ -93,6 +96,11 @@ export async function runResidentLearningCycle(options) {
|
|
|
93
96
|
};
|
|
94
97
|
const execute = async () => {
|
|
95
98
|
options.signal.throwIfAborted();
|
|
99
|
+
const guard = (...subjects) => assertNoLearningLeak(options.leakGuard, subjects);
|
|
100
|
+
guard({
|
|
101
|
+
subject: 'failure.evidence',
|
|
102
|
+
text: `${failure.evidence.key}\n${failure.evidence.source}\n${failure.evidence.reason}`,
|
|
103
|
+
}, { subject: 'failure.trace', text: failure.trace });
|
|
96
104
|
const snapshot = structuredClone(await options.agenda.read());
|
|
97
105
|
if (!snapshot)
|
|
98
106
|
throw new Error('No resident agenda exists for this learning cycle.');
|
|
@@ -101,8 +109,18 @@ export async function runResidentLearningCycle(options) {
|
|
|
101
109
|
const current = snapshot.learning?.skills.find((s) => s.name === skillName);
|
|
102
110
|
if (current && (current.purpose ?? 'task') !== purpose)
|
|
103
111
|
throw new Error('The active skill has a different learning purpose; use a distinct skill name.');
|
|
104
|
-
const baseline = current ?
|
|
105
|
-
baselineRevision = baseline ?
|
|
112
|
+
const baseline = current ? normalizeLearningSkill(current) : null;
|
|
113
|
+
baselineRevision = baseline ? hashLearningSkill(baseline) : 'none';
|
|
114
|
+
if (baseline)
|
|
115
|
+
guard({
|
|
116
|
+
subject: 'baseline',
|
|
117
|
+
text: [
|
|
118
|
+
baseline.name,
|
|
119
|
+
baseline.description,
|
|
120
|
+
baseline.body,
|
|
121
|
+
...(baseline.sources ? [JSON.stringify(baseline.sources)] : []),
|
|
122
|
+
].join('\n'),
|
|
123
|
+
});
|
|
106
124
|
await append('started', {
|
|
107
125
|
tenantId: snapshot.tenantId,
|
|
108
126
|
agentKey: snapshot.agentKey,
|
|
@@ -187,9 +205,13 @@ export async function runResidentLearningCycle(options) {
|
|
|
187
205
|
const explore = options.explore;
|
|
188
206
|
const observed = await stage('explore', (context) => explore(Object.freeze({ ...context, skillName, ...purposeContext, failure, baseline })));
|
|
189
207
|
exploration = Object.freeze({
|
|
190
|
-
evidence: Object.freeze(
|
|
208
|
+
evidence: Object.freeze(learningEvidenceSchema.parse(observed.observations.evidence)),
|
|
191
209
|
trace: z.string().trim().min(1).max(32_000).parse(observed.observations.trace),
|
|
192
210
|
});
|
|
211
|
+
guard({
|
|
212
|
+
subject: 'exploration.evidence',
|
|
213
|
+
text: `${exploration.evidence.key}\n${exploration.evidence.source}\n${exploration.evidence.reason}`,
|
|
214
|
+
}, { subject: 'exploration.trace', text: exploration.trace });
|
|
193
215
|
await append('exploration', {
|
|
194
216
|
observations: exploration,
|
|
195
217
|
digest: createHash('sha256').update(JSON.stringify(exploration)).digest('hex'),
|
|
@@ -206,8 +228,14 @@ export async function runResidentLearningCycle(options) {
|
|
|
206
228
|
baseline,
|
|
207
229
|
...(exploration ? { exploration } : {}),
|
|
208
230
|
})));
|
|
209
|
-
|
|
210
|
-
candidate
|
|
231
|
+
const built = normalizeLearningSkill(generated.candidate);
|
|
232
|
+
guard({ subject: 'candidate.name', text: built.name }, { subject: 'candidate.description', text: built.description }, { subject: 'candidate.body', text: built.body }, {
|
|
233
|
+
subject: 'candidate.sources',
|
|
234
|
+
text: (built.sources ?? []).map((s) => `${s.key}\n${s.revision}`).join('\n'),
|
|
235
|
+
paths: (built.sources ?? []).map((s) => s.key),
|
|
236
|
+
});
|
|
237
|
+
candidateRevision = hashLearningSkill(generated.candidate);
|
|
238
|
+
candidate = built;
|
|
211
239
|
if ((candidate.purpose ?? 'task') !== purpose)
|
|
212
240
|
throw new Error('Generated skill purpose does not match the host-admitted learning purpose.');
|
|
213
241
|
if (candidate.name !== skillName)
|
|
@@ -270,7 +298,7 @@ export async function runResidentLearningCycle(options) {
|
|
|
270
298
|
};
|
|
271
299
|
// Validate all existing activation contracts before entering the ambiguous
|
|
272
300
|
// commit interval. The store repeats this against its atomic snapshot.
|
|
273
|
-
|
|
301
|
+
promoteLearningSkill(snapshot.learning, candidate, { verification, confirmation, protection }, evidence);
|
|
274
302
|
await append('activation-requested', {
|
|
275
303
|
baselineRevision,
|
|
276
304
|
candidateRevision,
|
|
@@ -287,13 +315,17 @@ export async function runResidentLearningCycle(options) {
|
|
|
287
315
|
outcome = await execute();
|
|
288
316
|
}
|
|
289
317
|
catch (error) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
318
|
+
if (error instanceof LearningLeakError)
|
|
319
|
+
leak = error.findings;
|
|
320
|
+
outcome = result(error instanceof LearningLeakError
|
|
321
|
+
? 'failed'
|
|
322
|
+
: error instanceof ResidentConflictError
|
|
323
|
+
? 'conflict'
|
|
324
|
+
: activationRequested
|
|
325
|
+
? 'activation-unknown'
|
|
326
|
+
: options.signal.aborted
|
|
327
|
+
? 'cancelled'
|
|
328
|
+
: 'failed', error instanceof Error ? error.message : String(error));
|
|
297
329
|
}
|
|
298
330
|
if (auditComplete) {
|
|
299
331
|
try {
|
|
@@ -305,4 +337,4 @@ export async function runResidentLearningCycle(options) {
|
|
|
305
337
|
}
|
|
306
338
|
return { ...outcome, auditComplete };
|
|
307
339
|
}
|
|
308
|
-
//# sourceMappingURL=
|
|
340
|
+
//# sourceMappingURL=cycle.js.map
|