@namzu/sdk 61.4.0 → 62.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 +55 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +2 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +8 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +8 -1
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/constants/tools/index.d.ts +2 -0
- package/dist/constants/tools/index.d.ts.map +1 -1
- package/dist/constants/tools/index.js +23 -0
- package/dist/constants/tools/index.js.map +1 -1
- package/dist/eval/harness-protection.js +1 -1
- package/dist/eval/harness-protection.js.map +1 -1
- package/dist/learning/cycle.d.ts +5 -3
- package/dist/learning/cycle.d.ts.map +1 -1
- package/dist/learning/cycle.js +11 -13
- package/dist/learning/cycle.js.map +1 -1
- package/dist/learning/guidance.d.ts +74 -0
- package/dist/learning/guidance.d.ts.map +1 -0
- package/dist/learning/guidance.js +259 -0
- package/dist/learning/guidance.js.map +1 -0
- package/dist/learning/skill.d.ts +2 -2
- package/dist/learning/skill.d.ts.map +1 -1
- package/dist/learning/skill.js +6 -6
- package/dist/learning/skill.js.map +1 -1
- package/dist/learning/store.d.ts.map +1 -1
- package/dist/learning/store.js +6 -6
- package/dist/learning/store.js.map +1 -1
- package/dist/pals/communication/ingress-schema.d.ts +8 -8
- package/dist/pals/communication/schema.d.ts +2 -2
- package/dist/peers/client.d.ts +2 -3
- package/dist/peers/client.d.ts.map +1 -1
- package/dist/peers/client.js +2 -3
- package/dist/peers/client.js.map +1 -1
- package/dist/peers/endpoint.d.ts +1 -2
- package/dist/peers/endpoint.d.ts.map +1 -1
- package/dist/peers/endpoint.js +1 -2
- package/dist/peers/endpoint.js.map +1 -1
- package/dist/peers/protocol.d.ts.map +1 -1
- package/dist/peers/protocol.js +1 -0
- package/dist/peers/protocol.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +4 -4
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +5 -3
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/prompt/index.d.ts +0 -4
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/index.js +0 -2
- package/dist/prompt/index.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +3 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +5 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts.map +1 -1
- package/dist/provider/model-window-suffix.js +1 -0
- package/dist/provider/model-window-suffix.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +5 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/provider/step-stopped.d.ts +19 -0
- package/dist/provider/step-stopped.d.ts.map +1 -0
- package/dist/provider/step-stopped.js +25 -0
- package/dist/provider/step-stopped.js.map +1 -0
- package/dist/provider/token-budget.d.ts.map +1 -1
- package/dist/provider/token-budget.js +6 -1
- package/dist/provider/token-budget.js.map +1 -1
- package/dist/public-runtime.d.ts +3 -14
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +3 -14
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +0 -2
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +0 -2
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +3 -21
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +17 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +168 -5
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.js +4 -5
- 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 +6 -3
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts +9 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +48 -2
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +7 -4
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +40 -8
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +139 -24
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/turn/completion-audit.d.ts +32 -0
- package/dist/runtime/query/turn/completion-audit.d.ts.map +1 -0
- package/dist/runtime/query/turn/completion-audit.js +56 -0
- package/dist/runtime/query/turn/completion-audit.js.map +1 -0
- package/dist/runtime/query/turn/stall-monitor.d.ts +78 -0
- package/dist/runtime/query/turn/stall-monitor.d.ts.map +1 -0
- package/dist/runtime/query/turn/stall-monitor.js +101 -0
- package/dist/runtime/query/turn/stall-monitor.js.map +1 -0
- package/dist/session/paths.d.ts +1 -2
- package/dist/session/paths.d.ts.map +1 -1
- package/dist/session/paths.js +1 -4
- package/dist/session/paths.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +2 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +5 -2
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/content-fingerprint.d.ts +13 -0
- package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
- package/dist/tools/builtins/content-fingerprint.js +25 -0
- package/dist/tools/builtins/content-fingerprint.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +7 -2
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/shell-read-credit.d.ts +15 -0
- package/dist/tools/builtins/shell-read-credit.d.ts.map +1 -0
- package/dist/tools/builtins/shell-read-credit.js +161 -0
- package/dist/tools/builtins/shell-read-credit.js.map +1 -0
- package/dist/tools/paths.d.ts +15 -2
- package/dist/tools/paths.d.ts.map +1 -1
- package/dist/tools/paths.js +17 -2
- package/dist/tools/paths.js.map +1 -1
- package/dist/turn/evidence-recall.d.ts +1 -1
- package/dist/turn/evidence-recall.d.ts.map +1 -1
- package/dist/turn/evidence-recall.js +5 -14
- package/dist/turn/evidence-recall.js.map +1 -1
- package/dist/types/acp/index.d.ts +6 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +4 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +8 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/ids/index.d.ts +1 -1
- package/dist/types/message/index.d.ts +1 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +1 -0
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/provider/interface.d.ts +12 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/session/config.d.ts +25 -0
- package/dist/types/session/config.d.ts.map +1 -1
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +2 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/session/turn.d.ts +1 -1
- package/dist/types/session/turn.d.ts.map +1 -1
- package/dist/types/session/turn.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +2 -0
- package/src/bridge/acp/permission.ts +8 -0
- package/src/bridge/acp/server.ts +7 -1
- package/src/constants/tools/index.ts +27 -0
- package/src/eval/harness-protection.ts +1 -1
- package/src/learning/cycle.ts +15 -16
- package/src/learning/guidance.ts +339 -0
- package/src/learning/skill.ts +7 -7
- package/src/learning/store.ts +5 -6
- package/src/peers/client.ts +2 -3
- package/src/peers/endpoint.ts +1 -2
- package/src/peers/protocol.ts +1 -0
- package/src/prompt/coding-agent-doctrine.ts +5 -3
- package/src/prompt/index.ts +0 -4
- package/src/provider/fallback.ts +7 -0
- package/src/provider/idle-timeout.ts +8 -0
- package/src/provider/model-window-suffix.ts +1 -0
- package/src/provider/retry.ts +8 -0
- package/src/provider/step-stopped.ts +27 -0
- package/src/provider/token-budget.ts +6 -1
- package/src/public-runtime.ts +6 -28
- package/src/public-tools.ts +0 -3
- package/src/public-types.ts +5 -137
- package/src/runtime/query/iteration/index.ts +207 -5
- package/src/runtime/query/iteration/phases/per-call-review.ts +7 -5
- package/src/runtime/query/iteration/phases/tool-review.ts +5 -3
- package/src/runtime/query/iteration/stream-turn.ts +51 -1
- package/src/runtime/query/resume-pending.ts +11 -4
- package/src/runtime/query/review-policy.ts +157 -24
- package/src/runtime/query/turn/completion-audit.ts +71 -0
- package/src/runtime/query/turn/stall-monitor.ts +158 -0
- package/src/session/paths.ts +2 -6
- package/src/tools/builtins/bash.ts +6 -2
- package/src/tools/builtins/content-fingerprint.ts +25 -0
- package/src/tools/builtins/edit.ts +11 -2
- package/src/tools/builtins/shell-read-credit.ts +159 -0
- package/src/tools/paths.ts +18 -2
- package/src/turn/evidence-recall.ts +7 -15
- package/src/types/acp/index.ts +6 -0
- package/src/types/agent/base.ts +4 -0
- package/src/types/hitl/index.ts +8 -0
- package/src/types/ids/index.ts +1 -1
- package/src/types/message/index.ts +1 -0
- package/src/types/provider/interface.ts +13 -0
- package/src/types/session/config.ts +27 -0
- package/src/types/session/records.ts +2 -0
- package/src/types/session/turn.ts +2 -1
- package/dist/learning/deprecated.d.ts +0 -86
- package/dist/learning/deprecated.d.ts.map +0 -1
- package/dist/learning/deprecated.js +0 -22
- package/dist/learning/deprecated.js.map +0 -1
- package/dist/manager/resident/activity.d.ts +0 -74
- package/dist/manager/resident/activity.d.ts.map +0 -1
- package/dist/manager/resident/activity.js +0 -125
- package/dist/manager/resident/activity.js.map +0 -1
- package/dist/manager/resident/agenda.d.ts +0 -167
- package/dist/manager/resident/agenda.d.ts.map +0 -1
- package/dist/manager/resident/agenda.js +0 -588
- package/dist/manager/resident/agenda.js.map +0 -1
- package/dist/manager/resident/consumption.d.ts +0 -98
- package/dist/manager/resident/consumption.d.ts.map +0 -1
- package/dist/manager/resident/consumption.js +0 -237
- package/dist/manager/resident/consumption.js.map +0 -1
- package/dist/manager/resident/delivery-window.d.ts +0 -28
- package/dist/manager/resident/delivery-window.d.ts.map +0 -1
- package/dist/manager/resident/delivery-window.js +0 -80
- package/dist/manager/resident/delivery-window.js.map +0 -1
- package/dist/manager/resident/evidence-recall.d.ts +0 -30
- package/dist/manager/resident/evidence-recall.d.ts.map +0 -1
- package/dist/manager/resident/evidence-recall.js +0 -297
- package/dist/manager/resident/evidence-recall.js.map +0 -1
- package/dist/manager/resident/history-disk.d.ts +0 -10
- package/dist/manager/resident/history-disk.d.ts.map +0 -1
- package/dist/manager/resident/history-disk.js +0 -50
- package/dist/manager/resident/history-disk.js.map +0 -1
- package/dist/manager/resident/history.d.ts +0 -115
- package/dist/manager/resident/history.d.ts.map +0 -1
- package/dist/manager/resident/history.js +0 -203
- package/dist/manager/resident/history.js.map +0 -1
- package/dist/manager/resident/host.d.ts +0 -112
- package/dist/manager/resident/host.d.ts.map +0 -1
- package/dist/manager/resident/host.js +0 -254
- package/dist/manager/resident/host.js.map +0 -1
- package/dist/manager/resident/initiative.d.ts +0 -86
- package/dist/manager/resident/initiative.d.ts.map +0 -1
- package/dist/manager/resident/initiative.js +0 -131
- package/dist/manager/resident/initiative.js.map +0 -1
- package/dist/manager/resident/loop.d.ts +0 -49
- package/dist/manager/resident/loop.d.ts.map +0 -1
- package/dist/manager/resident/loop.js +0 -75
- package/dist/manager/resident/loop.js.map +0 -1
- package/dist/manager/resident/outbox.d.ts +0 -124
- package/dist/manager/resident/outbox.d.ts.map +0 -1
- package/dist/manager/resident/outbox.js +0 -216
- package/dist/manager/resident/outbox.js.map +0 -1
- package/dist/manager/resident/proposal.d.ts +0 -65
- package/dist/manager/resident/proposal.d.ts.map +0 -1
- package/dist/manager/resident/proposal.js +0 -77
- package/dist/manager/resident/proposal.js.map +0 -1
- package/dist/manager/resident/store.d.ts +0 -108
- package/dist/manager/resident/store.d.ts.map +0 -1
- package/dist/manager/resident/store.js +0 -205
- package/dist/manager/resident/store.js.map +0 -1
- package/dist/manager/resident/tool-evidence.d.ts +0 -112
- package/dist/manager/resident/tool-evidence.d.ts.map +0 -1
- package/dist/manager/resident/tool-evidence.js +0 -289
- package/dist/manager/resident/tool-evidence.js.map +0 -1
- package/dist/prompt/resident-learning.d.ts +0 -29
- package/dist/prompt/resident-learning.d.ts.map +0 -1
- package/dist/prompt/resident-learning.js +0 -126
- package/dist/prompt/resident-learning.js.map +0 -1
- package/dist/prompt/resident-step.d.ts +0 -42
- package/dist/prompt/resident-step.d.ts.map +0 -1
- package/dist/prompt/resident-step.js +0 -137
- package/dist/prompt/resident-step.js.map +0 -1
- package/dist/tools/resident-history.d.ts +0 -12
- package/dist/tools/resident-history.d.ts.map +0 -1
- package/dist/tools/resident-history.js +0 -82
- package/dist/tools/resident-history.js.map +0 -1
- package/dist/tools/resident-tool-evidence.d.ts +0 -9
- package/dist/tools/resident-tool-evidence.d.ts.map +0 -1
- package/dist/tools/resident-tool-evidence.js +0 -61
- package/dist/tools/resident-tool-evidence.js.map +0 -1
- package/src/learning/deprecated.ts +0 -124
- package/src/manager/resident/activity.ts +0 -211
- package/src/manager/resident/agenda.ts +0 -937
- package/src/manager/resident/consumption.ts +0 -335
- package/src/manager/resident/delivery-window.ts +0 -99
- package/src/manager/resident/evidence-recall.ts +0 -369
- package/src/manager/resident/history-disk.ts +0 -63
- package/src/manager/resident/history.ts +0 -348
- package/src/manager/resident/host.ts +0 -390
- package/src/manager/resident/initiative.ts +0 -231
- package/src/manager/resident/loop.ts +0 -119
- package/src/manager/resident/outbox.ts +0 -341
- package/src/manager/resident/proposal.ts +0 -119
- package/src/manager/resident/store.ts +0 -279
- package/src/manager/resident/tool-evidence.ts +0 -455
- package/src/prompt/resident-learning.ts +0 -152
- package/src/prompt/resident-step.ts +0 -182
- package/src/tools/resident-history.ts +0 -88
- package/src/tools/resident-tool-evidence.ts +0 -72
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The learning module used to 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 {
|
|
13
|
-
SqliteLearningStore,
|
|
14
|
-
runStoredLearningCycle,
|
|
15
|
-
runStoredLearningFromObservations,
|
|
16
|
-
} from './store.js'
|
|
17
|
-
import type * as Store from './store.js'
|
|
18
|
-
|
|
19
|
-
/** @deprecated Renamed to `LearningEvidence`; the old name is removed in the next major release. */
|
|
20
|
-
export type ResidentLearningEvidence = Skill.LearningEvidence
|
|
21
|
-
|
|
22
|
-
/** @deprecated Renamed to `LearningSkillCandidate`; the old name is removed in the next major release. */
|
|
23
|
-
export type ResidentSkillCandidate = Skill.LearningSkillCandidate
|
|
24
|
-
|
|
25
|
-
/** @deprecated Renamed to `LearnedSkill`; the old name is removed in the next major release. */
|
|
26
|
-
export type ResidentLearnedSkill = Skill.LearnedSkill
|
|
27
|
-
|
|
28
|
-
/** @deprecated Renamed to `LearningState`; the old name is removed in the next major release. */
|
|
29
|
-
export type ResidentLearningState = Skill.LearningState
|
|
30
|
-
|
|
31
|
-
/** @deprecated Renamed to `LearningProfileUpdate`; the old name is removed in the next major release. */
|
|
32
|
-
export type ResidentProfileUpdate = Skill.LearningProfileUpdate
|
|
33
|
-
|
|
34
|
-
/** @deprecated Renamed to `LearningSkillEvaluation`; the old name is removed in the next major release. */
|
|
35
|
-
export type ResidentSkillEvaluation = Skill.LearningSkillEvaluation
|
|
36
|
-
|
|
37
|
-
/** @deprecated Renamed to `LearningProjectionOptions`; the old name is removed in the next major release. */
|
|
38
|
-
export type ResidentLearningProjectionOptions = Skill.LearningProjectionOptions
|
|
39
|
-
|
|
40
|
-
/** @deprecated Renamed to `LearningSource`; the old name is removed in the next major release. */
|
|
41
|
-
export type ResidentLearningSource = Skill.LearningSource
|
|
42
|
-
|
|
43
|
-
/** @deprecated Renamed to `LearningProjection`; the old name is removed in the next major release. */
|
|
44
|
-
export type ResidentLearningProjection = Skill.LearningProjection
|
|
45
|
-
|
|
46
|
-
/** @deprecated Renamed to `LearningStage`; the old name is removed in the next major release. */
|
|
47
|
-
export type ResidentLearningStage = Cycle.LearningStage
|
|
48
|
-
|
|
49
|
-
/** @deprecated Renamed to `LearningReceipt`; the old name is removed in the next major release. */
|
|
50
|
-
export type ResidentLearningReceipt = Cycle.LearningReceipt
|
|
51
|
-
|
|
52
|
-
/** @deprecated Renamed to `LearningConsumption`; the old name is removed in the next major release. */
|
|
53
|
-
export type ResidentLearningConsumption = Cycle.LearningConsumption
|
|
54
|
-
|
|
55
|
-
/** @deprecated Renamed to `LearningCycleEvent`; the old name is removed in the next major release. */
|
|
56
|
-
export type ResidentLearningCycleEvent = Cycle.LearningCycleEvent
|
|
57
|
-
|
|
58
|
-
/** @deprecated Renamed to `LearningCycleContext`; the old name is removed in the next major release. */
|
|
59
|
-
export type ResidentLearningCycleContext = Cycle.LearningCycleContext
|
|
60
|
-
|
|
61
|
-
/** @deprecated Renamed to `LearningGenerationContext`; the old name is removed in the next major release. */
|
|
62
|
-
export type ResidentLearningGenerationContext = Cycle.LearningGenerationContext
|
|
63
|
-
|
|
64
|
-
/** @deprecated Renamed to `LearningExplorationContext`; the old name is removed in the next major release. */
|
|
65
|
-
export type ResidentLearningExplorationContext = Cycle.LearningExplorationContext
|
|
66
|
-
|
|
67
|
-
/** @deprecated Renamed to `LearningExploration`; the old name is removed in the next major release. */
|
|
68
|
-
export type ResidentLearningExploration = Cycle.LearningExploration
|
|
69
|
-
|
|
70
|
-
/** @deprecated Renamed to `LearningEvaluationContext`; the old name is removed in the next major release. */
|
|
71
|
-
export type ResidentLearningEvaluationContext = Cycle.LearningEvaluationContext
|
|
72
|
-
|
|
73
|
-
/** @deprecated Renamed to `LearningCycleOptions`; the old name is removed in the next major release. */
|
|
74
|
-
export type ResidentLearningCycleOptions = Cycle.LearningCycleOptions
|
|
75
|
-
|
|
76
|
-
/** @deprecated Renamed to `LearningCycleResult`; the old name is removed in the next major release. */
|
|
77
|
-
export type ResidentLearningCycleResult = Cycle.LearningCycleResult
|
|
78
|
-
|
|
79
|
-
/** @deprecated Renamed to `SqliteLearningStoreOptions`; the old name is removed in the next major release. */
|
|
80
|
-
export type SqliteResidentLearningStoreOptions = Store.SqliteLearningStoreOptions
|
|
81
|
-
|
|
82
|
-
/** @deprecated Renamed to `LearningArtifact`; the old name is removed in the next major release. */
|
|
83
|
-
export type ResidentLearningArtifact = Store.LearningArtifact
|
|
84
|
-
|
|
85
|
-
/** @deprecated Renamed to `LearningRecordedUsage`; the old name is removed in the next major release. */
|
|
86
|
-
export type ResidentLearningRecordedUsage = Store.LearningRecordedUsage
|
|
87
|
-
|
|
88
|
-
/** @deprecated Renamed to `LearningCycleSummary`; the old name is removed in the next major release. */
|
|
89
|
-
export type ResidentLearningCycleSummary = Store.LearningCycleSummary
|
|
90
|
-
|
|
91
|
-
/** @deprecated Renamed to `LearningDiscoveryOptions`; the old name is removed in the next major release. */
|
|
92
|
-
export type ResidentLearningDiscoveryOptions = Store.LearningDiscoveryOptions
|
|
93
|
-
|
|
94
|
-
/** @deprecated Renamed to `LearningDiscoveryResult`; the old name is removed in the next major release. */
|
|
95
|
-
export type ResidentLearningDiscoveryResult = Store.LearningDiscoveryResult
|
|
96
|
-
|
|
97
|
-
/** @deprecated Renamed to `LearningObservation`; the old name is removed in the next major release. */
|
|
98
|
-
export type ResidentLearningObservation = Observation.LearningObservation
|
|
99
|
-
|
|
100
|
-
/** @deprecated Renamed to `LearningObservationRecord`; the old name is removed in the next major release. */
|
|
101
|
-
export type ResidentLearningObservationRecord = Observation.LearningObservationRecord
|
|
102
|
-
|
|
103
|
-
/** @deprecated Renamed to `LearningTarget`; the old name is removed in the next major release. */
|
|
104
|
-
export type ResidentLearningTarget = Observation.LearningTarget
|
|
105
|
-
|
|
106
|
-
/** @deprecated Renamed to `hashLearningSkill`; the old name is removed in the next major release. */
|
|
107
|
-
export const hashResidentSkill = hashLearningSkill
|
|
108
|
-
|
|
109
|
-
/** @deprecated Renamed to `projectLearning`; the old name is removed in the next major release. */
|
|
110
|
-
export const projectResidentLearning = projectLearning
|
|
111
|
-
|
|
112
|
-
/** @deprecated Renamed to `runLearningCycle`; the old name is removed in the next major release. */
|
|
113
|
-
export const runResidentLearningCycle = runLearningCycle
|
|
114
|
-
|
|
115
|
-
/** @deprecated Renamed to `runStoredLearningCycle`; the old name is removed in the next major release. */
|
|
116
|
-
export const runStoredResidentLearningCycle = runStoredLearningCycle
|
|
117
|
-
|
|
118
|
-
/** @deprecated Renamed to `runStoredLearningFromObservations`; the old name is removed in the next major release. */
|
|
119
|
-
export const runStoredResidentLearningFromObservations = runStoredLearningFromObservations
|
|
120
|
-
|
|
121
|
-
/** @deprecated Renamed to `SqliteLearningStore`; the old name is removed in the next major release. */
|
|
122
|
-
export const SqliteResidentLearningStore = SqliteLearningStore
|
|
123
|
-
/** @deprecated Renamed to `SqliteLearningStore`; the old name is removed in the next major release. */
|
|
124
|
-
export type SqliteResidentLearningStore = SqliteLearningStore
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import type { ResidentAgendaState } from './agenda.js'
|
|
3
|
-
import { ResidentHistoryPageLimit, type ResidentHistoryReadBudget } from './history-disk.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @experimental An immutable upper boundary; new work requires a new source.
|
|
7
|
-
*
|
|
8
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
9
|
-
*/
|
|
10
|
-
export interface ResidentActivityScope {
|
|
11
|
-
readonly tenantId: string
|
|
12
|
-
readonly agentKey: string
|
|
13
|
-
readonly throughRevision: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @experimental Admission is authority to inspect an attempt, not proof that it executed.
|
|
18
|
-
*
|
|
19
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
20
|
-
*/
|
|
21
|
-
export interface ResidentAdmission {
|
|
22
|
-
readonly revision: number
|
|
23
|
-
readonly pursuitRevision: number
|
|
24
|
-
readonly pursuitId: string
|
|
25
|
-
readonly claimId: string
|
|
26
|
-
readonly step: number
|
|
27
|
-
readonly objective: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @experimental Settlement is an agenda decision, not proof of verification or delivery.
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
34
|
-
*/
|
|
35
|
-
export interface ResidentSettlement {
|
|
36
|
-
readonly revision: number
|
|
37
|
-
readonly pursuitId: string
|
|
38
|
-
readonly claimId: string
|
|
39
|
-
readonly outcome: 'wait' | 'complete' | 'blocked'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @experimental Forward pages; cursor is the next revision to inspect, initially 1.
|
|
44
|
-
*
|
|
45
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
46
|
-
*/
|
|
47
|
-
export interface ResidentActivityOptions {
|
|
48
|
-
readonly cursor?: number
|
|
49
|
-
readonly maxRevisions?: number
|
|
50
|
-
readonly maxReadBytes?: number
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @experimental Gaps stay explicit; counts cover only the scanned revision range.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
57
|
-
*/
|
|
58
|
-
export interface ResidentActivityPage {
|
|
59
|
-
readonly scope: ResidentActivityScope
|
|
60
|
-
readonly fromRevision: number
|
|
61
|
-
readonly throughRevision: number
|
|
62
|
-
readonly nextCursor: number | null
|
|
63
|
-
readonly scannedBytes: number
|
|
64
|
-
readonly unavailableRevisions: readonly number[]
|
|
65
|
-
readonly admissions: readonly ResidentAdmission[]
|
|
66
|
-
readonly settlements: readonly ResidentSettlement[]
|
|
67
|
-
readonly archivedPursuits: readonly string[]
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @experimental A backend must enforce scope, cancellation and read bounds.
|
|
72
|
-
*
|
|
73
|
-
* @deprecated Residents are deprecated and removed in the next major release. Learning (`runLearningCycle` and the other `Learning*` names) keeps working, but `runLearningCycle` still takes a resident agenda until learning gets its own activation target in the next major release; for long-running work use scheduled tasks (`LocalTaskScheduler`), session goals and background agents.
|
|
74
|
-
*/
|
|
75
|
-
export interface ResidentActivitySource {
|
|
76
|
-
readonly scope: ResidentActivityScope
|
|
77
|
-
read(options?: ResidentActivityOptions, signal?: AbortSignal): Promise<ResidentActivityPage>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** Internal adapter for the immutable disk agenda. */
|
|
81
|
-
export function createResidentActivitySource(
|
|
82
|
-
scopeInput: ResidentActivityScope,
|
|
83
|
-
load: (revision: number, budget: ResidentHistoryReadBudget) => Promise<ResidentAgendaState>,
|
|
84
|
-
): ResidentActivitySource {
|
|
85
|
-
const scope = Object.freeze(
|
|
86
|
-
z
|
|
87
|
-
.object({
|
|
88
|
-
tenantId: z.string().uuid(),
|
|
89
|
-
agentKey: z.string().min(1).max(200),
|
|
90
|
-
throughRevision: z.number().int().positive().safe(),
|
|
91
|
-
})
|
|
92
|
-
.parse(scopeInput),
|
|
93
|
-
)
|
|
94
|
-
return {
|
|
95
|
-
scope,
|
|
96
|
-
async read(options: ResidentActivityOptions = {}, signal?: AbortSignal) {
|
|
97
|
-
const from = z
|
|
98
|
-
.number()
|
|
99
|
-
.int()
|
|
100
|
-
.positive()
|
|
101
|
-
.max(scope.throughRevision)
|
|
102
|
-
.parse(options.cursor ?? 1)
|
|
103
|
-
const count = z
|
|
104
|
-
.number()
|
|
105
|
-
.int()
|
|
106
|
-
.positive()
|
|
107
|
-
.max(32)
|
|
108
|
-
.parse(options.maxRevisions ?? 32)
|
|
109
|
-
const budget: ResidentHistoryReadBudget = {
|
|
110
|
-
remaining: z
|
|
111
|
-
.number()
|
|
112
|
-
.int()
|
|
113
|
-
.positive()
|
|
114
|
-
.max(8 * 1024 * 1024)
|
|
115
|
-
.parse(options.maxReadBytes ?? 8 * 1024 * 1024),
|
|
116
|
-
bytesRead: 0,
|
|
117
|
-
signal,
|
|
118
|
-
}
|
|
119
|
-
const unavailable = new Set<number>()
|
|
120
|
-
const read = async (revision: number) => {
|
|
121
|
-
signal?.throwIfAborted()
|
|
122
|
-
try {
|
|
123
|
-
const state = await load(revision, budget)
|
|
124
|
-
if (
|
|
125
|
-
state.tenantId !== scope.tenantId ||
|
|
126
|
-
state.agentKey !== scope.agentKey ||
|
|
127
|
-
state.revision !== revision
|
|
128
|
-
)
|
|
129
|
-
throw new Error('Resident activity scope mismatch.')
|
|
130
|
-
return state
|
|
131
|
-
} catch (error) {
|
|
132
|
-
signal?.throwIfAborted()
|
|
133
|
-
if (error instanceof ResidentHistoryPageLimit) throw error
|
|
134
|
-
unavailable.add(revision)
|
|
135
|
-
return null
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const admissions: ResidentAdmission[] = []
|
|
139
|
-
const settlements: ResidentSettlement[] = []
|
|
140
|
-
const archivedPursuits: string[] = []
|
|
141
|
-
let through = from - 1
|
|
142
|
-
try {
|
|
143
|
-
let before = from > 1 ? await read(from - 1) : null
|
|
144
|
-
for (
|
|
145
|
-
let revision = from;
|
|
146
|
-
revision <= Math.min(scope.throughRevision, from + count - 1);
|
|
147
|
-
revision++
|
|
148
|
-
) {
|
|
149
|
-
const after = await read(revision)
|
|
150
|
-
if (before && after) {
|
|
151
|
-
for (const pursuit of after.pursuits) {
|
|
152
|
-
const previous = before.pursuits.find((p) => p.id === pursuit.id)?.state
|
|
153
|
-
const current = pursuit.state
|
|
154
|
-
if (!previous) continue
|
|
155
|
-
if (
|
|
156
|
-
current.revision === previous.revision + 1 &&
|
|
157
|
-
previous.phase !== 'running' &&
|
|
158
|
-
current.phase === 'running' &&
|
|
159
|
-
current.claimId &&
|
|
160
|
-
current.stepsAdmitted === previous.stepsAdmitted + 1
|
|
161
|
-
) {
|
|
162
|
-
admissions.push({
|
|
163
|
-
revision,
|
|
164
|
-
pursuitRevision: current.revision,
|
|
165
|
-
pursuitId: pursuit.id,
|
|
166
|
-
claimId: current.claimId,
|
|
167
|
-
step: current.stepsAdmitted,
|
|
168
|
-
objective: current.objective,
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
if (
|
|
172
|
-
current.revision === previous.revision + 1 &&
|
|
173
|
-
previous.phase === 'running' &&
|
|
174
|
-
previous.claimId &&
|
|
175
|
-
current.phase !== 'running' &&
|
|
176
|
-
current.claimId === null &&
|
|
177
|
-
current.stepsAdmitted === previous.stepsAdmitted
|
|
178
|
-
) {
|
|
179
|
-
settlements.push({
|
|
180
|
-
revision,
|
|
181
|
-
pursuitId: pursuit.id,
|
|
182
|
-
claimId: previous.claimId,
|
|
183
|
-
outcome: current.phase === 'waiting' ? 'wait' : current.phase,
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (after.archiveHead === revision)
|
|
188
|
-
for (const pursuit of before.pursuits)
|
|
189
|
-
if (!after.pursuits.some((p) => p.id === pursuit.id))
|
|
190
|
-
archivedPursuits.push(pursuit.id)
|
|
191
|
-
}
|
|
192
|
-
through = revision
|
|
193
|
-
before = after
|
|
194
|
-
}
|
|
195
|
-
} catch (error) {
|
|
196
|
-
if (!(error instanceof ResidentHistoryPageLimit)) throw error
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
scope,
|
|
200
|
-
fromRevision: from,
|
|
201
|
-
throughRevision: through,
|
|
202
|
-
nextCursor: through < scope.throughRevision ? through + 1 : null,
|
|
203
|
-
scannedBytes: budget.bytesRead,
|
|
204
|
-
unavailableRevisions: [...unavailable],
|
|
205
|
-
admissions,
|
|
206
|
-
settlements,
|
|
207
|
-
archivedPursuits,
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
}
|
|
211
|
-
}
|