@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycle.js","sourceRoot":"","sources":["../../src/learning/cycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAEN,0BAA0B,GAC1B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAGN,sBAAsB,GACtB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EACN,iBAAiB,EAIjB,oBAAoB,GACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAGN,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAo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live under `manager/resident` and carried a
|
|
3
|
+
* `Resident` prefix. Learning is a feature of all of Namzu, not of residents,
|
|
4
|
+
* so every name now lives in `learning/` without the prefix. The old names stay
|
|
5
|
+
* as aliases of the new ones until the next major release.
|
|
6
|
+
*/
|
|
7
|
+
import { runLearningCycle } from './cycle.js';
|
|
8
|
+
import type * as Cycle from './cycle.js';
|
|
9
|
+
import type * as Observation from './observation.js';
|
|
10
|
+
import { hashLearningSkill, projectLearning } from './skill.js';
|
|
11
|
+
import type * as Skill from './skill.js';
|
|
12
|
+
import { SqliteLearningStore, runStoredLearningCycle, runStoredLearningFromObservations } from './store.js';
|
|
13
|
+
import type * as Store from './store.js';
|
|
14
|
+
/** @deprecated Renamed to `LearningEvidence`; the old name is removed in the next major release. */
|
|
15
|
+
export type ResidentLearningEvidence = Skill.LearningEvidence;
|
|
16
|
+
/** @deprecated Renamed to `LearningSkillCandidate`; the old name is removed in the next major release. */
|
|
17
|
+
export type ResidentSkillCandidate = Skill.LearningSkillCandidate;
|
|
18
|
+
/** @deprecated Renamed to `LearnedSkill`; the old name is removed in the next major release. */
|
|
19
|
+
export type ResidentLearnedSkill = Skill.LearnedSkill;
|
|
20
|
+
/** @deprecated Renamed to `LearningState`; the old name is removed in the next major release. */
|
|
21
|
+
export type ResidentLearningState = Skill.LearningState;
|
|
22
|
+
/** @deprecated Renamed to `LearningProfileUpdate`; the old name is removed in the next major release. */
|
|
23
|
+
export type ResidentProfileUpdate = Skill.LearningProfileUpdate;
|
|
24
|
+
/** @deprecated Renamed to `LearningSkillEvaluation`; the old name is removed in the next major release. */
|
|
25
|
+
export type ResidentSkillEvaluation = Skill.LearningSkillEvaluation;
|
|
26
|
+
/** @deprecated Renamed to `LearningProjectionOptions`; the old name is removed in the next major release. */
|
|
27
|
+
export type ResidentLearningProjectionOptions = Skill.LearningProjectionOptions;
|
|
28
|
+
/** @deprecated Renamed to `LearningSource`; the old name is removed in the next major release. */
|
|
29
|
+
export type ResidentLearningSource = Skill.LearningSource;
|
|
30
|
+
/** @deprecated Renamed to `LearningProjection`; the old name is removed in the next major release. */
|
|
31
|
+
export type ResidentLearningProjection = Skill.LearningProjection;
|
|
32
|
+
/** @deprecated Renamed to `LearningStage`; the old name is removed in the next major release. */
|
|
33
|
+
export type ResidentLearningStage = Cycle.LearningStage;
|
|
34
|
+
/** @deprecated Renamed to `LearningReceipt`; the old name is removed in the next major release. */
|
|
35
|
+
export type ResidentLearningReceipt = Cycle.LearningReceipt;
|
|
36
|
+
/** @deprecated Renamed to `LearningConsumption`; the old name is removed in the next major release. */
|
|
37
|
+
export type ResidentLearningConsumption = Cycle.LearningConsumption;
|
|
38
|
+
/** @deprecated Renamed to `LearningCycleEvent`; the old name is removed in the next major release. */
|
|
39
|
+
export type ResidentLearningCycleEvent = Cycle.LearningCycleEvent;
|
|
40
|
+
/** @deprecated Renamed to `LearningCycleContext`; the old name is removed in the next major release. */
|
|
41
|
+
export type ResidentLearningCycleContext = Cycle.LearningCycleContext;
|
|
42
|
+
/** @deprecated Renamed to `LearningGenerationContext`; the old name is removed in the next major release. */
|
|
43
|
+
export type ResidentLearningGenerationContext = Cycle.LearningGenerationContext;
|
|
44
|
+
/** @deprecated Renamed to `LearningExplorationContext`; the old name is removed in the next major release. */
|
|
45
|
+
export type ResidentLearningExplorationContext = Cycle.LearningExplorationContext;
|
|
46
|
+
/** @deprecated Renamed to `LearningExploration`; the old name is removed in the next major release. */
|
|
47
|
+
export type ResidentLearningExploration = Cycle.LearningExploration;
|
|
48
|
+
/** @deprecated Renamed to `LearningEvaluationContext`; the old name is removed in the next major release. */
|
|
49
|
+
export type ResidentLearningEvaluationContext = Cycle.LearningEvaluationContext;
|
|
50
|
+
/** @deprecated Renamed to `LearningCycleOptions`; the old name is removed in the next major release. */
|
|
51
|
+
export type ResidentLearningCycleOptions = Cycle.LearningCycleOptions;
|
|
52
|
+
/** @deprecated Renamed to `LearningCycleResult`; the old name is removed in the next major release. */
|
|
53
|
+
export type ResidentLearningCycleResult = Cycle.LearningCycleResult;
|
|
54
|
+
/** @deprecated Renamed to `SqliteLearningStoreOptions`; the old name is removed in the next major release. */
|
|
55
|
+
export type SqliteResidentLearningStoreOptions = Store.SqliteLearningStoreOptions;
|
|
56
|
+
/** @deprecated Renamed to `LearningArtifact`; the old name is removed in the next major release. */
|
|
57
|
+
export type ResidentLearningArtifact = Store.LearningArtifact;
|
|
58
|
+
/** @deprecated Renamed to `LearningRecordedUsage`; the old name is removed in the next major release. */
|
|
59
|
+
export type ResidentLearningRecordedUsage = Store.LearningRecordedUsage;
|
|
60
|
+
/** @deprecated Renamed to `LearningCycleSummary`; the old name is removed in the next major release. */
|
|
61
|
+
export type ResidentLearningCycleSummary = Store.LearningCycleSummary;
|
|
62
|
+
/** @deprecated Renamed to `LearningDiscoveryOptions`; the old name is removed in the next major release. */
|
|
63
|
+
export type ResidentLearningDiscoveryOptions = Store.LearningDiscoveryOptions;
|
|
64
|
+
/** @deprecated Renamed to `LearningDiscoveryResult`; the old name is removed in the next major release. */
|
|
65
|
+
export type ResidentLearningDiscoveryResult = Store.LearningDiscoveryResult;
|
|
66
|
+
/** @deprecated Renamed to `LearningObservation`; the old name is removed in the next major release. */
|
|
67
|
+
export type ResidentLearningObservation = Observation.LearningObservation;
|
|
68
|
+
/** @deprecated Renamed to `LearningObservationRecord`; the old name is removed in the next major release. */
|
|
69
|
+
export type ResidentLearningObservationRecord = Observation.LearningObservationRecord;
|
|
70
|
+
/** @deprecated Renamed to `LearningTarget`; the old name is removed in the next major release. */
|
|
71
|
+
export type ResidentLearningTarget = Observation.LearningTarget;
|
|
72
|
+
/** @deprecated Renamed to `hashLearningSkill`; the old name is removed in the next major release. */
|
|
73
|
+
export declare const hashResidentSkill: typeof hashLearningSkill;
|
|
74
|
+
/** @deprecated Renamed to `projectLearning`; the old name is removed in the next major release. */
|
|
75
|
+
export declare const projectResidentLearning: typeof projectLearning;
|
|
76
|
+
/** @deprecated Renamed to `runLearningCycle`; the old name is removed in the next major release. */
|
|
77
|
+
export declare const runResidentLearningCycle: typeof runLearningCycle;
|
|
78
|
+
/** @deprecated Renamed to `runStoredLearningCycle`; the old name is removed in the next major release. */
|
|
79
|
+
export declare const runStoredResidentLearningCycle: typeof runStoredLearningCycle;
|
|
80
|
+
/** @deprecated Renamed to `runStoredLearningFromObservations`; the old name is removed in the next major release. */
|
|
81
|
+
export declare const runStoredResidentLearningFromObservations: typeof runStoredLearningFromObservations;
|
|
82
|
+
/** @deprecated Renamed to `SqliteLearningStore`; the old name is removed in the next major release. */
|
|
83
|
+
export declare const SqliteResidentLearningStore: typeof SqliteLearningStore;
|
|
84
|
+
/** @deprecated Renamed to `SqliteLearningStore`; the old name is removed in the next major release. */
|
|
85
|
+
export type SqliteResidentLearningStore = SqliteLearningStore;
|
|
86
|
+
//# sourceMappingURL=deprecated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/learning/deprecated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,iCAAiC,EACjC,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,oGAAoG;AACpG,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,CAAA;AAE7D,0GAA0G;AAC1G,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,sBAAsB,CAAA;AAEjE,gGAAgG;AAChG,MAAM,MAAM,oBAAoB,GAAG,KAAK,CA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all of Namzu, not of residents,
|
|
4
|
+
* so every name now lives in `learning/` without the prefix. The old names stay
|
|
5
|
+
* as aliases of the new ones until the next major release.
|
|
6
|
+
*/
|
|
7
|
+
import { runLearningCycle } from './cycle.js';
|
|
8
|
+
import { hashLearningSkill, projectLearning } from './skill.js';
|
|
9
|
+
import { SqliteLearningStore, runStoredLearningCycle, runStoredLearningFromObservations, } from './store.js';
|
|
10
|
+
/** @deprecated Renamed to `hashLearningSkill`; the old name is removed in the next major release. */
|
|
11
|
+
export const hashResidentSkill = hashLearningSkill;
|
|
12
|
+
/** @deprecated Renamed to `projectLearning`; the old name is removed in the next major release. */
|
|
13
|
+
export const projectResidentLearning = projectLearning;
|
|
14
|
+
/** @deprecated Renamed to `runLearningCycle`; the old name is removed in the next major release. */
|
|
15
|
+
export const runResidentLearningCycle = runLearningCycle;
|
|
16
|
+
/** @deprecated Renamed to `runStoredLearningCycle`; the old name is removed in the next major release. */
|
|
17
|
+
export const runStoredResidentLearningCycle = runStoredLearningCycle;
|
|
18
|
+
/** @deprecated Renamed to `runStoredLearningFromObservations`; the old name is removed in the next major release. */
|
|
19
|
+
export const runStoredResidentLearningFromObservations = runStoredLearningFromObservations;
|
|
20
|
+
/** @deprecated Renamed to `SqliteLearningStore`; the old name is removed in the next major release. */
|
|
21
|
+
export const SqliteResidentLearningStore = SqliteLearningStore;
|
|
22
|
+
//# sourceMappingURL=deprecated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../src/learning/deprecated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAG7C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,EACN,mBAAmB,EACnB,sBAAsB,EACtB,iCAAiC,GACjC,MAAM,YAAY,CAAA;AA0FnB,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAElD,mGAAmG;AACnG,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAA;AAEtD,oGAAoG;AACpG,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAA;AAExD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAA;AAEpE,qHAAqH;AACrH,MAAM,CAAC,MAAM,yCAAyC,GAAG,iCAAiC,CAAA;AAE1F,uGAAuG;AACvG,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ProjectId, TenantId } from '../types/ids/index.js';
|
|
2
|
+
import { type LearningExperienceEntry, type LearningExperienceInput, type LearningExperienceQuery } from './experience.js';
|
|
3
|
+
/** The schema version this store reads and writes. */
|
|
4
|
+
export declare const LEARNING_EXPERIENCE_STORE_VERSION = 1;
|
|
5
|
+
/** @experimental Where the library lives; a separate file from the observation journal. */
|
|
6
|
+
export interface SqliteLearningExperienceStoreOptions {
|
|
7
|
+
readonly databasePath: string;
|
|
8
|
+
readonly scope: {
|
|
9
|
+
readonly tenantId: TenantId;
|
|
10
|
+
readonly projectId: ProjectId;
|
|
11
|
+
readonly agentKey: string;
|
|
12
|
+
};
|
|
13
|
+
readonly readOnly?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @experimental Durable experience library. Entries are immutable: recording
|
|
17
|
+
* the same cycle again with identical content returns the stored entry, with
|
|
18
|
+
* different content is refused. The artefact is stored whole.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SqliteLearningExperienceStore {
|
|
21
|
+
readonly databasePath: string;
|
|
22
|
+
private readonly scope;
|
|
23
|
+
private readonly readOnly;
|
|
24
|
+
constructor(options: SqliteLearningExperienceStoreOptions);
|
|
25
|
+
private use;
|
|
26
|
+
private scopeArgs;
|
|
27
|
+
private decode;
|
|
28
|
+
/** Record one finished cycle. Throws `LearningLeakError` when the entry carries evaluator-side material. */
|
|
29
|
+
record(input: LearningExperienceInput): Promise<LearningExperienceEntry>;
|
|
30
|
+
/** The ordinal the next entry will be recorded after; pass it as `beforeOrdinal` to read everything so far. */
|
|
31
|
+
nextOrdinal(): Promise<number>;
|
|
32
|
+
/** Entries of one domain and evaluator revision recorded before `beforeOrdinal`, newest first. */
|
|
33
|
+
retrieve(query: LearningExperienceQuery): Promise<LearningExperienceEntry[]>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=experience-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experience-store.d.ts","sourceRoot":"","sources":["../../src/learning/experience-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhE,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAI5B,MAAM,iBAAiB,CAAA;AAexB,sDAAsD;AACtD,eAAO,MAAM,iCAAiC,IAAI,CAAA;AAElD,2FAA2F;AAC3F,MAAM,WAAW,oCAAoC;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE;QACf,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;QAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;QAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KACzB,CAAA;IACD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC3B;AAID;;;;GAIG;AACH,qBAAa,6BAA6B;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+C;IACrE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,EAAE,oCAAoC;IAazD,OAAO,CAAC,GAAG;IA6CX,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,MAAM;IAOd,4GAA4G;IACtG,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAkC9E,+GAA+G;IACzG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAepC,kGAAkG;IAC5F,QAAQ,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAyBlF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { mkdirSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { asProjectId, asTenantId } from '../utils/id.js';
|
|
6
|
+
import { assertExperienceHasNoLeak, normalizeLearningExperience, selectLearningExperience, } from './experience.js';
|
|
7
|
+
const SCHEMA = `
|
|
8
|
+
CREATE TABLE experience (
|
|
9
|
+
ordinal INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
10
|
+
tenant_id TEXT NOT NULL, project_id TEXT NOT NULL, agent_key TEXT NOT NULL,
|
|
11
|
+
domain TEXT NOT NULL, cycle_id TEXT NOT NULL, evaluator_revision TEXT NOT NULL,
|
|
12
|
+
decision TEXT NOT NULL, body TEXT NOT NULL,
|
|
13
|
+
UNIQUE(tenant_id, project_id, agent_key, cycle_id)
|
|
14
|
+
);
|
|
15
|
+
CREATE INDEX experience_read ON experience(
|
|
16
|
+
tenant_id, project_id, agent_key, domain, evaluator_revision, ordinal
|
|
17
|
+
);
|
|
18
|
+
`;
|
|
19
|
+
/** The schema version this store reads and writes. */
|
|
20
|
+
export const LEARNING_EXPERIENCE_STORE_VERSION = 1;
|
|
21
|
+
/**
|
|
22
|
+
* @experimental Durable experience library. Entries are immutable: recording
|
|
23
|
+
* the same cycle again with identical content returns the stored entry, with
|
|
24
|
+
* different content is refused. The artefact is stored whole.
|
|
25
|
+
*/
|
|
26
|
+
export class SqliteLearningExperienceStore {
|
|
27
|
+
databasePath;
|
|
28
|
+
scope;
|
|
29
|
+
readOnly;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
this.databasePath = resolve(options.databasePath);
|
|
32
|
+
this.scope = Object.freeze({
|
|
33
|
+
tenantId: asTenantId(options.scope.tenantId.toLowerCase()),
|
|
34
|
+
projectId: asProjectId(options.scope.projectId.toLowerCase()),
|
|
35
|
+
agentKey: z
|
|
36
|
+
.string()
|
|
37
|
+
.regex(/^[a-z0-9][a-z0-9_-]{0,63}$/)
|
|
38
|
+
.parse(options.scope.agentKey),
|
|
39
|
+
});
|
|
40
|
+
this.readOnly = options.readOnly === true;
|
|
41
|
+
}
|
|
42
|
+
use(write, operation, whenEmpty) {
|
|
43
|
+
if (write && this.readOnly)
|
|
44
|
+
throw new Error('Learning experience database is read-only.');
|
|
45
|
+
let Database;
|
|
46
|
+
try {
|
|
47
|
+
Database = createRequire(import.meta.url)('node:sqlite')
|
|
48
|
+
.DatabaseSync;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error('SqliteLearningExperienceStore requires Node.js 22.13 or newer.', {
|
|
52
|
+
cause: error,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!this.readOnly)
|
|
56
|
+
mkdirSync(dirname(this.databasePath), { recursive: true, mode: 0o700 });
|
|
57
|
+
const db = new Database(this.databasePath, { readOnly: this.readOnly });
|
|
58
|
+
try {
|
|
59
|
+
db.exec('PRAGMA busy_timeout = 5000;');
|
|
60
|
+
if (!this.readOnly)
|
|
61
|
+
db.exec('PRAGMA journal_mode = DELETE; PRAGMA synchronous = FULL;');
|
|
62
|
+
db.exec(write ? 'BEGIN IMMEDIATE' : 'BEGIN');
|
|
63
|
+
try {
|
|
64
|
+
const version = Number(db.prepare('PRAGMA user_version').get()?.user_version);
|
|
65
|
+
if (version === 0 && write) {
|
|
66
|
+
db.exec(`${SCHEMA} PRAGMA user_version = ${LEARNING_EXPERIENCE_STORE_VERSION};`);
|
|
67
|
+
}
|
|
68
|
+
else if (version === 0) {
|
|
69
|
+
if (whenEmpty) {
|
|
70
|
+
db.exec('COMMIT');
|
|
71
|
+
return whenEmpty();
|
|
72
|
+
}
|
|
73
|
+
throw new Error('Learning experience database is not initialized; open it for writing first.');
|
|
74
|
+
}
|
|
75
|
+
else if (version !== LEARNING_EXPERIENCE_STORE_VERSION)
|
|
76
|
+
throw new Error(`Learning experience database is at schema version ${version}; this store reads version ${LEARNING_EXPERIENCE_STORE_VERSION} only.`);
|
|
77
|
+
const value = operation(db);
|
|
78
|
+
db.exec('COMMIT');
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
db.exec('ROLLBACK');
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
db.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
scopeArgs() {
|
|
91
|
+
return [this.scope.tenantId, this.scope.projectId, this.scope.agentKey];
|
|
92
|
+
}
|
|
93
|
+
decode(row) {
|
|
94
|
+
return {
|
|
95
|
+
...JSON.parse(row.body),
|
|
96
|
+
ordinal: row.ordinal,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Record one finished cycle. Throws `LearningLeakError` when the entry carries evaluator-side material. */
|
|
100
|
+
async record(input) {
|
|
101
|
+
if (!input.leakGuard)
|
|
102
|
+
throw new Error('Recording an experience entry requires a leakGuard.');
|
|
103
|
+
const entry = normalizeLearningExperience(input);
|
|
104
|
+
assertExperienceHasNoLeak(entry, input.leakGuard);
|
|
105
|
+
const body = JSON.stringify(entry);
|
|
106
|
+
return this.use(true, (db) => {
|
|
107
|
+
const existing = db
|
|
108
|
+
.prepare('SELECT ordinal, body FROM experience WHERE tenant_id=? AND project_id=? AND agent_key=? AND cycle_id=?')
|
|
109
|
+
.get(...this.scopeArgs(), entry.cycleId);
|
|
110
|
+
if (existing) {
|
|
111
|
+
if (existing.body !== body)
|
|
112
|
+
throw new Error('This cycle already has a different experience entry; entries are immutable.');
|
|
113
|
+
return this.decode(existing);
|
|
114
|
+
}
|
|
115
|
+
const result = db
|
|
116
|
+
.prepare('INSERT INTO experience (tenant_id, project_id, agent_key, domain, cycle_id, evaluator_revision, decision, body) VALUES (?,?,?,?,?,?,?,?)')
|
|
117
|
+
.run(...this.scopeArgs(), entry.domain, entry.cycleId, entry.evaluatorRevision, entry.decision, body);
|
|
118
|
+
return { ...entry, ordinal: Number(result.lastInsertRowid) };
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** The ordinal the next entry will be recorded after; pass it as `beforeOrdinal` to read everything so far. */
|
|
122
|
+
async nextOrdinal() {
|
|
123
|
+
return this.use(false, (db) => {
|
|
124
|
+
const row = db
|
|
125
|
+
.prepare('SELECT MAX(ordinal) AS last FROM experience WHERE tenant_id=? AND project_id=? AND agent_key=?')
|
|
126
|
+
.get(...this.scopeArgs());
|
|
127
|
+
return (row.last ?? 0) + 1;
|
|
128
|
+
}, () => 1);
|
|
129
|
+
}
|
|
130
|
+
/** Entries of one domain and evaluator revision recorded before `beforeOrdinal`, newest first. */
|
|
131
|
+
async retrieve(query) {
|
|
132
|
+
const rows = this.use(false, (db) => db
|
|
133
|
+
.prepare('SELECT ordinal, body FROM experience WHERE tenant_id=? AND project_id=? AND agent_key=? AND domain=? AND evaluator_revision=? AND ordinal<? ORDER BY ordinal DESC')
|
|
134
|
+
.all(...this.scopeArgs(), query.domain, query.evaluatorRevision, query.beforeOrdinal), () => []);
|
|
135
|
+
if (!query.leakGuard)
|
|
136
|
+
throw new Error('Retrieving experience entries requires a leakGuard.');
|
|
137
|
+
const selected = selectLearningExperience(rows.map((row) => this.decode(row)), query);
|
|
138
|
+
for (const { ordinal: _ordinal, ...entry } of selected)
|
|
139
|
+
assertExperienceHasNoLeak(entry, query.leakGuard);
|
|
140
|
+
return selected;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=experience-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experience-store.js","sourceRoot":"","sources":["../../src/learning/experience-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAIN,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,GACxB,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,GAAG;;;;;;;;;;;CAWd,CAAA;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAA;AAelD;;;;GAIG;AACH,MAAM,OAAO,6BAA6B;IAChC,YAAY,CAAQ;IACZ,KAAK,CAA+C;IACpD,QAAQ,CAAS;IAElC,YAAY,OAA6C;QACxD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;YAC1B,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC1D,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC7D,QAAQ,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,KAAK,CAAC,4BAA4B,CAAC;iBACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC/B,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,C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B,CAAC,EACD,GAAG,EAAE,CAAC,CAAC,CACP,CAAA;IACF,CAAC;IAED,kGAAkG;IAClG,KAAK,CAAC,QAAQ,CAAC,KAA8B;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CACpB,KAAK,EACL,CAAC,EAAE,EAAE,EAAE,CACN,EAAE;aACA,OAAO,CACP,mKAAmK,CACnK;aACA,GAAG,CACH,GAAG,IAAI,CAAC,SAAS,EAAE,EACnB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,aAAa,CACV,EACZ,GAAG,EAAE,CAAC,EAAE,CACR,CAAA;QACD,IAAI,CAAC,KAAK,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;QAC5F,MAAM,QAAQ,GAAG,wBAAwB,CACxC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EACnC,KAAK,CACL,CAAA;QACD,KAAK,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,IAAI,QAAQ;YACrD,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;QAClD,OAAO,QAAQ,CAAA;IAChB,CAAC;CACD"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type LearningLeakGuard } from './leak-tripwire.js';
|
|
3
|
+
import { type LearningSkillCandidate, learningEvidenceSchema } from './skill.js';
|
|
4
|
+
export declare const LEARNING_EDIT_VERDICTS: readonly ["helped", "hurt", "no observed effect", "confounded"];
|
|
5
|
+
/** @experimental What one edit did, as far as the evidence can separate it from the others. */
|
|
6
|
+
export type LearningEditVerdict = (typeof LEARNING_EDIT_VERDICTS)[number];
|
|
7
|
+
export declare const LEARNING_CONFIDENCE_LEVELS: readonly ["high", "medium", "low"];
|
|
8
|
+
/** @experimental How far a lesson can be trusted. */
|
|
9
|
+
export type LearningConfidence = (typeof LEARNING_CONFIDENCE_LEVELS)[number];
|
|
10
|
+
declare const editSchema: z.ZodObject<{
|
|
11
|
+
/** The part of the harness the edit touched, such as `instruction-skill`. */
|
|
12
|
+
surface: z.ZodString;
|
|
13
|
+
/** What changed, in a sentence. */
|
|
14
|
+
change: z.ZodString;
|
|
15
|
+
verdict: z.ZodEnum<["helped", "hurt", "no observed effect", "confounded"]>;
|
|
16
|
+
/**
|
|
17
|
+
* True only when this edit was tried alone (an ablation), so its verdict is
|
|
18
|
+
* separable even though the candidate changed several components. The store
|
|
19
|
+
* trusts this flag from the caller; it does not check that an ablation ran.
|
|
20
|
+
*/
|
|
21
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
verdict: "helped" | "hurt" | "no observed effect" | "confounded";
|
|
24
|
+
change: string;
|
|
25
|
+
surface: string;
|
|
26
|
+
isolated?: boolean | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
verdict: "helped" | "hurt" | "no observed effect" | "confounded";
|
|
29
|
+
change: string;
|
|
30
|
+
surface: string;
|
|
31
|
+
isolated?: boolean | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
declare const lessonSchema: z.ZodObject<{
|
|
34
|
+
/** The shape of the situation the lesson applies to, not the incident itself. */
|
|
35
|
+
cue: z.ZodString;
|
|
36
|
+
lesson: z.ZodString;
|
|
37
|
+
/** References into the observations, session log or verification receipts. */
|
|
38
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
39
|
+
key: z.ZodString;
|
|
40
|
+
source: z.ZodString;
|
|
41
|
+
reason: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
key: string;
|
|
44
|
+
reason: string;
|
|
45
|
+
source: string;
|
|
46
|
+
}, {
|
|
47
|
+
key: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
source: string;
|
|
50
|
+
}>, "many">;
|
|
51
|
+
confidence: z.ZodEnum<["high", "medium", "low"]>;
|
|
52
|
+
confidenceReason: z.ZodString;
|
|
53
|
+
/** Indexes into the entry's edits that the lesson rests on. */
|
|
54
|
+
edits: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
confidence: "low" | "medium" | "high";
|
|
57
|
+
evidence: {
|
|
58
|
+
key: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
source: string;
|
|
61
|
+
}[];
|
|
62
|
+
cue: string;
|
|
63
|
+
lesson: string;
|
|
64
|
+
confidenceReason: string;
|
|
65
|
+
edits?: number[] | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
confidence: "low" | "medium" | "high";
|
|
68
|
+
evidence: {
|
|
69
|
+
key: string;
|
|
70
|
+
reason: string;
|
|
71
|
+
source: string;
|
|
72
|
+
}[];
|
|
73
|
+
cue: string;
|
|
74
|
+
lesson: string;
|
|
75
|
+
confidenceReason: string;
|
|
76
|
+
edits?: number[] | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
/** @experimental One edit row of the typed ledger. */
|
|
79
|
+
export type LearningEditRow = Readonly<z.infer<typeof editSchema>>;
|
|
80
|
+
/** @experimental A lesson, with the confidence the evidence supports. */
|
|
81
|
+
export type LearningLesson = Readonly<Omit<z.infer<typeof lessonSchema>, 'evidence' | 'edits'> & {
|
|
82
|
+
readonly evidence: readonly Readonly<z.infer<typeof learningEvidenceSchema>>[];
|
|
83
|
+
readonly edits?: readonly number[];
|
|
84
|
+
}>;
|
|
85
|
+
/** What a host passes when it records one finished cycle. */
|
|
86
|
+
export interface LearningExperienceInput {
|
|
87
|
+
/** The kind of task the cycle was about; retrieval never crosses domains. */
|
|
88
|
+
readonly domain: string;
|
|
89
|
+
/** The cycle that produced the entry; one entry per cycle. */
|
|
90
|
+
readonly cycleId: string;
|
|
91
|
+
/** The evaluator that judged the candidate. Lessons are only comparable under the same revision. */
|
|
92
|
+
readonly evaluatorRevision: string;
|
|
93
|
+
readonly decision: 'adopted' | 'rejected';
|
|
94
|
+
/** Why, as the verification recorded it. */
|
|
95
|
+
readonly reason: string;
|
|
96
|
+
/** The whole artefact, as proposed. */
|
|
97
|
+
readonly candidate: LearningSkillCandidate;
|
|
98
|
+
readonly edits: readonly LearningEditRow[];
|
|
99
|
+
readonly lessons?: readonly LearningLesson[];
|
|
100
|
+
/**
|
|
101
|
+
* Evaluator-side material to refuse in anything the entry would keep. Required:
|
|
102
|
+
* pass `{}` to apply only the built-in markers and secret shapes.
|
|
103
|
+
*/
|
|
104
|
+
readonly leakGuard: LearningLeakGuard;
|
|
105
|
+
}
|
|
106
|
+
/** @experimental A stored entry. `ordinal` is its position in recording order. */
|
|
107
|
+
export interface LearningExperienceEntry {
|
|
108
|
+
readonly ordinal: number;
|
|
109
|
+
readonly domain: string;
|
|
110
|
+
readonly cycleId: string;
|
|
111
|
+
readonly evaluatorRevision: string;
|
|
112
|
+
readonly decision: 'adopted' | 'rejected';
|
|
113
|
+
readonly reason: string;
|
|
114
|
+
/** The full artefact as proposed, unabridged. */
|
|
115
|
+
readonly candidate: LearningSkillCandidate;
|
|
116
|
+
readonly candidateRevision: string;
|
|
117
|
+
readonly edits: readonly LearningEditRow[];
|
|
118
|
+
readonly lessons: readonly LearningLesson[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Apply the rules that keep a record honest. Several components in one
|
|
122
|
+
* candidate share a single outcome, so unless a row was tried alone its
|
|
123
|
+
* verdict becomes `confounded`. A lesson that rests on a confounded edit is
|
|
124
|
+
* capped at medium; one that rests only on confounded edits is low, and its
|
|
125
|
+
* reason says why.
|
|
126
|
+
*/
|
|
127
|
+
export declare function normalizeLearningExperience(input: LearningExperienceInput): Omit<LearningExperienceEntry, 'ordinal'>;
|
|
128
|
+
/**
|
|
129
|
+
* Refuse an entry that would keep evaluator-side material. Every string the
|
|
130
|
+
* entry holds is scanned, found by walking the entry rather than by naming
|
|
131
|
+
* fields; source keys are also tried as paths. Throws {@link LearningLeakError}.
|
|
132
|
+
*/
|
|
133
|
+
export declare function assertExperienceHasNoLeak(entry: Omit<LearningExperienceEntry, 'ordinal'>, guard: LearningLeakGuard | undefined): void;
|
|
134
|
+
/** @experimental Where retrieval may look. */
|
|
135
|
+
export interface LearningExperienceQuery {
|
|
136
|
+
readonly domain: string;
|
|
137
|
+
/** The evaluator the reader is judged by; entries from another revision are not comparable. */
|
|
138
|
+
readonly evaluatorRevision: string;
|
|
139
|
+
/** Evaluator-side material; entries are scanned again before they are returned. */
|
|
140
|
+
readonly leakGuard: LearningLeakGuard;
|
|
141
|
+
/** Only entries recorded before this ordinal. The reader's own entry is never among them. */
|
|
142
|
+
readonly beforeOrdinal: number;
|
|
143
|
+
readonly decision?: 'adopted' | 'rejected';
|
|
144
|
+
/** Newest first; default 20. */
|
|
145
|
+
readonly limit?: number;
|
|
146
|
+
}
|
|
147
|
+
/** The retrieval rule, shared by every store: same domain, same evaluator, strictly earlier. */
|
|
148
|
+
export declare function selectLearningExperience(entries: readonly LearningExperienceEntry[], query: LearningExperienceQuery): LearningExperienceEntry[];
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=experience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../src/learning/experience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,oBAAoB,CAAA;AACjF,OAAO,EACN,KAAK,sBAAsB,EAE3B,sBAAsB,EAEtB,MAAM,YAAY,CAAA;AAgBnB,eAAO,MAAM,sBAAsB,iEAKzB,CAAA;AACV,+FAA+F;AAC/F,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzE,eAAO,MAAM,0BAA0B,oCAAqC,CAA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