@namzu/sdk 54.0.0 → 55.1.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 +43 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +1 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +5 -1
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/managers/structured.d.ts.map +1 -1
- package/dist/compaction/managers/structured.js +5 -0
- package/dist/compaction/managers/structured.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +6 -0
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/serializer.d.ts +6 -0
- package/dist/compaction/serializer.d.ts.map +1 -1
- package/dist/compaction/serializer.js +21 -3
- package/dist/compaction/serializer.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +27 -6
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/constants/compaction/index.d.ts +1 -0
- package/dist/constants/compaction/index.d.ts.map +1 -1
- package/dist/constants/compaction/index.js +1 -0
- 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 +19 -5
- 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 +31 -9
- 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/coding-agent-doctrine.d.ts +3 -3
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +18 -20
- package/dist/prompt/coding-agent-doctrine.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 +10 -4
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -4
- 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/checkpoint.d.ts +12 -2
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +42 -8
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +39 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +115 -7
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +18 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +20 -1
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +17 -8
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +24 -2
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +22 -22
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts +87 -0
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/per-call-review.js +513 -0
- package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -0
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +129 -62
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/step-context.d.ts +14 -0
- package/dist/runtime/query/iteration/step-context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-context.js +29 -0
- package/dist/runtime/query/iteration/step-context.js.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.js +6 -2
- package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +16 -3
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/project-instructions.d.ts +24 -5
- package/dist/runtime/query/project-instructions.d.ts.map +1 -1
- package/dist/runtime/query/project-instructions.js +107 -35
- package/dist/runtime/query/project-instructions.js.map +1 -1
- package/dist/runtime/query/prompt.d.ts +6 -0
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +10 -49
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +8 -0
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +101 -0
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +18 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +10 -0
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +55 -56
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +78 -72
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +8 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +13 -18
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser.d.ts.map +1 -1
- package/dist/tools/builtins/browser.js +38 -12
- package/dist/tools/builtins/browser.js.map +1 -1
- package/dist/tools/builtins/edit.js +4 -4
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/job.js +1 -1
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/skill.js +1 -1
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/builtins/structuredOutput.js +1 -1
- package/dist/tools/builtins/structuredOutput.js.map +1 -1
- package/dist/tools/builtins/verify-outputs.js +1 -1
- package/dist/tools/builtins/verify-outputs.js.map +1 -1
- package/dist/tools/builtins/write-file.js +4 -4
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts +6 -0
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
- package/dist/tools/coordinator/ask-user-question.js +6 -1
- package/dist/tools/coordinator/ask-user-question.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +10 -3
- package/dist/tools/coordinator/index.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/tools/schedules/loop-tool.d.ts.map +1 -1
- package/dist/tools/schedules/loop-tool.js +4 -2
- package/dist/tools/schedules/loop-tool.js.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +2 -2
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/task/create.js +1 -1
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/untrusted-envelope.js +1 -1
- package/dist/tools/untrusted-envelope.js.map +1 -1
- package/dist/turn/evidence-query.d.ts.map +1 -1
- package/dist/turn/evidence-query.js +16 -1
- package/dist/turn/evidence-query.js.map +1 -1
- package/dist/turn/evidence-recall.js +1 -1
- package/dist/turn/evidence-recall.js.map +1 -1
- package/dist/types/agent/base.d.ts +7 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +66 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +8 -0
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +12 -2
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/message/notice-frame.d.ts +41 -0
- package/dist/types/message/notice-frame.d.ts.map +1 -0
- package/dist/types/message/notice-frame.js +65 -0
- package/dist/types/message/notice-frame.js.map +1 -0
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +1 -0
- package/src/compaction/extractor.ts +8 -1
- package/src/compaction/managers/structured.ts +3 -0
- package/src/compaction/manual.ts +5 -0
- package/src/compaction/serializer.ts +28 -3
- package/src/compaction/verifier.ts +32 -6
- package/src/constants/compaction/index.ts +1 -0
- 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/coding-agent-doctrine.ts +18 -20
- package/src/prompt/resident-learning.ts +16 -7
- package/src/prompt/resident-step.ts +19 -13
- package/src/public-runtime.ts +36 -5
- package/src/public-types.ts +96 -34
- package/src/runtime/query/checkpoint.ts +49 -8
- package/src/runtime/query/executor.ts +165 -15
- package/src/runtime/query/index.ts +45 -1
- package/src/runtime/query/iteration/index.ts +19 -6
- package/src/runtime/query/iteration/phases/context.ts +37 -11
- package/src/runtime/query/iteration/phases/per-call-review.ts +617 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +168 -83
- package/src/runtime/query/iteration/step-context.ts +29 -0
- package/src/runtime/query/iteration/step-shaping.ts +6 -2
- package/src/runtime/query/prepare-turn.ts +18 -1
- package/src/runtime/query/project-instructions.ts +119 -38
- package/src/runtime/query/prompt.ts +11 -54
- package/src/runtime/query/resume-pending.ts +131 -0
- package/src/runtime/query/review-policy.ts +28 -0
- package/src/runtime/query/steering.ts +100 -96
- package/src/tools/builtins/bash.ts +13 -19
- package/src/tools/builtins/browser.ts +38 -12
- package/src/tools/builtins/edit.ts +4 -4
- package/src/tools/builtins/job.ts +1 -1
- package/src/tools/builtins/skill.ts +1 -1
- package/src/tools/builtins/structuredOutput.ts +1 -1
- package/src/tools/builtins/verify-outputs.ts +1 -1
- package/src/tools/builtins/write-file.ts +4 -4
- package/src/tools/coordinator/ask-user-question.ts +12 -1
- package/src/tools/coordinator/index.ts +10 -3
- package/src/tools/resident-history.ts +2 -0
- package/src/tools/resident-tool-evidence.ts +5 -1
- package/src/tools/schedules/loop-tool.ts +4 -2
- package/src/tools/schedules/schedule-tool.ts +2 -2
- package/src/tools/task/create.ts +1 -1
- package/src/tools/untrusted-envelope.ts +1 -1
- package/src/turn/evidence-query.ts +19 -1
- package/src/turn/evidence-recall.ts +1 -1
- package/src/types/agent/base.ts +8 -0
- package/src/types/hitl/index.ts +67 -0
- package/src/types/message/index.ts +20 -2
- package/src/types/message/notice-frame.ts +88 -0
- 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
|
@@ -51,10 +51,18 @@ const receiptSchema = z
|
|
|
51
51
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Unpriced usage exceeds own usage.' })
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @experimental Host-authenticated cumulative root receipt. Cost covers this root only.
|
|
56
|
+
*
|
|
57
|
+
* @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.
|
|
58
|
+
*/
|
|
55
59
|
export type ResidentConsumptionReceipt = z.infer<typeof receiptSchema>
|
|
56
60
|
|
|
57
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* @experimental A host resolves only authoritative admitted claims and bounds each read.
|
|
63
|
+
*
|
|
64
|
+
* @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.
|
|
65
|
+
*/
|
|
58
66
|
export interface ResidentConsumptionResolver {
|
|
59
67
|
/** Worst-case bytes read per resolution; reserved before calling the adapter. */
|
|
60
68
|
readonly maxReadBytes: number
|
|
@@ -64,7 +72,11 @@ export interface ResidentConsumptionResolver {
|
|
|
64
72
|
): Promise<ResidentConsumptionReceipt | null>
|
|
65
73
|
}
|
|
66
74
|
|
|
67
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* @experimental Bounds the entire inspection, not just each page. No inference or writes.
|
|
77
|
+
*
|
|
78
|
+
* @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.
|
|
79
|
+
*/
|
|
68
80
|
export interface ResidentConsumptionOptions {
|
|
69
81
|
readonly cursor?: number
|
|
70
82
|
readonly maxRevisions?: number
|
|
@@ -72,14 +84,22 @@ export interface ResidentConsumptionOptions {
|
|
|
72
84
|
readonly maxReceiptBytes?: number
|
|
73
85
|
}
|
|
74
86
|
|
|
75
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* @experimental Missing and deferred receipts never establish zero usage.
|
|
89
|
+
*
|
|
90
|
+
* @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.
|
|
91
|
+
*/
|
|
76
92
|
export interface ResidentConsumptionAttempt extends ResidentAdmission {
|
|
77
93
|
readonly settlement: ResidentSettlement | null
|
|
78
94
|
readonly receipt: ResidentConsumptionReceipt | null
|
|
79
95
|
readonly receiptStatus: 'available' | 'missing' | 'invalid' | 'deferred' | 'duplicate-turn'
|
|
80
96
|
}
|
|
81
97
|
|
|
82
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* @experimental An evidence projection, not a bill or an enforced spending cap.
|
|
100
|
+
*
|
|
101
|
+
* @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.
|
|
102
|
+
*/
|
|
83
103
|
export interface ResidentConsumptionReport {
|
|
84
104
|
readonly scope: ResidentActivityScope
|
|
85
105
|
readonly fromRevision: number
|
|
@@ -110,6 +130,8 @@ export interface ResidentConsumptionReport {
|
|
|
110
130
|
* @experimental Inspect cumulative root receipts once per admitted claim. Historical
|
|
111
131
|
* archive/reconcile events never erase consumption. Tree tokens are a separate total:
|
|
112
132
|
* adding them to own tokens would count the root twice. Descendant prices are unknown.
|
|
133
|
+
*
|
|
134
|
+
* @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.
|
|
113
135
|
*/
|
|
114
136
|
export async function inspectResidentConsumption(
|
|
115
137
|
source: ResidentActivitySource,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ResidentDeliveryGate } from './outbox.js'
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @experimental A daily allowed delivery window in an explicit named time zone.
|
|
5
|
+
*
|
|
6
|
+
* @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.
|
|
7
|
+
*/
|
|
4
8
|
export interface ResidentDeliveryWindowConfig {
|
|
5
9
|
readonly timeZone: string
|
|
6
10
|
/** Inclusive local minute of the day, from 0 through 1439. */
|
|
@@ -22,6 +26,8 @@ const searchMinutes = 72 * 60
|
|
|
22
26
|
* is bounded to 72 hours and the Date range; no opening returns nextCheckAt:null.
|
|
23
27
|
* Historic time zones with second-based offsets may defer up to one extra minute.
|
|
24
28
|
* This gate does not schedule a timer, authorize a destination or send a message.
|
|
29
|
+
*
|
|
30
|
+
* @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.
|
|
25
31
|
*/
|
|
26
32
|
export function createResidentDeliveryWindow(
|
|
27
33
|
config: ResidentDeliveryWindowConfig,
|
|
@@ -13,7 +13,11 @@ import { evidenceTokenKey } from '../../utils/evidence-tokens.js'
|
|
|
13
13
|
import { type ResidentState, residentStateSchema } from './store.js'
|
|
14
14
|
import type { ResidentToolEvidenceSource } from './tool-evidence.js'
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @experimental Automatic original-tool recall for exactly one admitted resident turn.
|
|
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
|
+
*/
|
|
17
21
|
export interface ResidentEvidenceRecallOptions {
|
|
18
22
|
readonly source: ResidentToolEvidenceSource
|
|
19
23
|
/** Already admitted state; summaries supply search words, never new observations. */
|
|
@@ -74,6 +78,8 @@ function residentQueryWords(text: string): string[] {
|
|
|
74
78
|
* Reuses the shared bounded ranking/rendering engine while retaining the
|
|
75
79
|
* pursuit's settlement authority. No arbitrary Session discovery, saved fact
|
|
76
80
|
* cache, inference, workspace reread or action replay is performed here.
|
|
81
|
+
*
|
|
82
|
+
* @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.
|
|
77
83
|
*/
|
|
78
84
|
export function createResidentEvidenceRecallStep(
|
|
79
85
|
options: ResidentEvidenceRecallOptions,
|
|
@@ -6,7 +6,11 @@ const SCAN_BYTES = 8 * 1024 * 1024
|
|
|
6
6
|
const SCAN_REVISIONS = 32
|
|
7
7
|
const TEXT_PAGE_CHARS = 6_000
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @experimental Host-bound historical scope; the upper revision never advances implicitly.
|
|
11
|
+
*
|
|
12
|
+
* @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.
|
|
13
|
+
*/
|
|
10
14
|
export interface ResidentHistoryScope {
|
|
11
15
|
readonly tenantId: string
|
|
12
16
|
readonly agentKey: string
|
|
@@ -14,13 +18,21 @@ export interface ResidentHistoryScope {
|
|
|
14
18
|
readonly throughRevision: number
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @experimental Revision plus part identifies retained text within one pursuit.
|
|
23
|
+
*
|
|
24
|
+
* @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.
|
|
25
|
+
*/
|
|
18
26
|
export interface ResidentHistoryAddress {
|
|
19
27
|
readonly revision: number
|
|
20
28
|
readonly part: number
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @experimental Summary or accepted wake input from a settled historical step.
|
|
33
|
+
*
|
|
34
|
+
* @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.
|
|
35
|
+
*/
|
|
24
36
|
export interface ResidentHistoryMatch extends ResidentHistoryAddress {
|
|
25
37
|
readonly step: number
|
|
26
38
|
readonly claimId: string
|
|
@@ -30,7 +42,11 @@ export interface ResidentHistoryMatch extends ResidentHistoryAddress {
|
|
|
30
42
|
readonly matchingParts: readonly number[]
|
|
31
43
|
}
|
|
32
44
|
|
|
33
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @experimental Empty query browses recent steps; cursor is the next inclusive revision.
|
|
47
|
+
*
|
|
48
|
+
* @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.
|
|
49
|
+
*/
|
|
34
50
|
export interface ResidentHistorySearchOptions {
|
|
35
51
|
/** Optional per-call ceiling, 1 byte–8 MiB. Defaults to 8 MiB. */
|
|
36
52
|
readonly maxReadBytes?: number
|
|
@@ -39,7 +55,11 @@ export interface ResidentHistorySearchOptions {
|
|
|
39
55
|
readonly limit?: number
|
|
40
56
|
}
|
|
41
57
|
|
|
42
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @experimental Counts describe this page, not the whole history.
|
|
60
|
+
*
|
|
61
|
+
* @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.
|
|
62
|
+
*/
|
|
43
63
|
export interface ResidentHistorySearchResult {
|
|
44
64
|
readonly matches: readonly ResidentHistoryMatch[]
|
|
45
65
|
readonly nextCursor: number | null
|
|
@@ -49,14 +69,22 @@ export interface ResidentHistorySearchResult {
|
|
|
49
69
|
readonly incomplete: boolean
|
|
50
70
|
}
|
|
51
71
|
|
|
52
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @experimental Use the returned nextOffset to continue exact Unicode-safe text.
|
|
74
|
+
*
|
|
75
|
+
* @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.
|
|
76
|
+
*/
|
|
53
77
|
export interface ResidentHistoryReadOptions extends ResidentHistoryAddress {
|
|
54
78
|
readonly offset?: number
|
|
55
79
|
/** Optional per-call ceiling, 1 byte–8 MiB. Defaults to 8 MiB. */
|
|
56
80
|
readonly maxReadBytes?: number
|
|
57
81
|
}
|
|
58
82
|
|
|
59
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* @experimental A recorded claim remains historical evidence, not proof of current validity.
|
|
85
|
+
*
|
|
86
|
+
* @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.
|
|
87
|
+
*/
|
|
60
88
|
export interface ResidentHistoryText extends ResidentHistoryAddress {
|
|
61
89
|
readonly step: number
|
|
62
90
|
readonly claimId: string
|
|
@@ -69,7 +97,11 @@ export interface ResidentHistoryText extends ResidentHistoryAddress {
|
|
|
69
97
|
readonly nextOffset: number | null
|
|
70
98
|
}
|
|
71
99
|
|
|
72
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* @experimental Null with unavailable revisions means unreadable evidence, not proven absence.
|
|
102
|
+
*
|
|
103
|
+
* @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.
|
|
104
|
+
*/
|
|
73
105
|
export interface ResidentHistoryReadResult {
|
|
74
106
|
readonly entry: ResidentHistoryText | null
|
|
75
107
|
readonly scannedRevisions: number
|
|
@@ -77,7 +109,11 @@ export interface ResidentHistoryReadResult {
|
|
|
77
109
|
readonly unavailableRevisions: readonly number[]
|
|
78
110
|
}
|
|
79
111
|
|
|
80
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* @experimental A backend must enforce its bound scope and bounded reads.
|
|
114
|
+
*
|
|
115
|
+
* @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.
|
|
116
|
+
*/
|
|
81
117
|
export interface ResidentHistorySource {
|
|
82
118
|
readonly scope: ResidentHistoryScope
|
|
83
119
|
search(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { setTimeout as sleep } from 'node:timers/promises'
|
|
2
|
+
import { type LearningState, freezeLearning } from '../../learning/skill.js'
|
|
2
3
|
import type { ResidentAgendaState, ResidentAgendaStore, ResidentPursuit } from './agenda.js'
|
|
3
4
|
import {
|
|
4
5
|
type ResidentObservation,
|
|
@@ -6,12 +7,15 @@ import {
|
|
|
6
7
|
type ResidentSelector,
|
|
7
8
|
residentObservationSchema,
|
|
8
9
|
} from './initiative.js'
|
|
9
|
-
import { type ResidentLearningState, freezeResidentLearning } from './learning.js'
|
|
10
10
|
import { type ResidentStep, stepResident } from './loop.js'
|
|
11
11
|
import { type ResidentMessageInput, residentMessageInputSchema } from './outbox.js'
|
|
12
12
|
import { ResidentConflictError, type ResidentDecision, residentDecisionSchema } from './store.js'
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @experimental Host result describes execution, not external-effect rollback.
|
|
16
|
+
*
|
|
17
|
+
* @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.
|
|
18
|
+
*/
|
|
15
19
|
export interface ResidentHostResult {
|
|
16
20
|
readonly status: 'idle' | 'paused' | 'unresolved' | 'cancelled' | 'limit' | 'contended'
|
|
17
21
|
readonly stepsSettled: number
|
|
@@ -19,7 +23,11 @@ export interface ResidentHostResult {
|
|
|
19
23
|
readonly selection?: ResidentSelection
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @experimental Explicit authorization to drive a finite number of background steps.
|
|
28
|
+
*
|
|
29
|
+
* @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.
|
|
30
|
+
*/
|
|
23
31
|
export interface ResidentHostRunOptions {
|
|
24
32
|
readonly signal: AbortSignal
|
|
25
33
|
readonly maxSteps: number
|
|
@@ -29,40 +37,64 @@ export interface ResidentHostRunOptions {
|
|
|
29
37
|
readonly keepAlive?: boolean
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @experimental Immutable context from the agenda snapshot that authorized this admission.
|
|
42
|
+
*
|
|
43
|
+
* @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.
|
|
44
|
+
*/
|
|
33
45
|
export interface ResidentStepContext {
|
|
34
46
|
readonly agendaRevision: number
|
|
35
|
-
readonly learning?:
|
|
47
|
+
readonly learning?: LearningState
|
|
36
48
|
}
|
|
37
49
|
|
|
38
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @experimental A developer callback may bind a different SDK turn for each pursuit.
|
|
52
|
+
*
|
|
53
|
+
* @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.
|
|
54
|
+
*/
|
|
39
55
|
export type ResidentPursuitStep = (
|
|
40
56
|
pursuit: ResidentPursuit,
|
|
41
57
|
signal: AbortSignal,
|
|
42
58
|
) => ReturnType<ResidentStep>
|
|
43
59
|
|
|
44
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* @experimental Context-aware callback; existing two-argument steps remain assignable.
|
|
62
|
+
*
|
|
63
|
+
* @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.
|
|
64
|
+
*/
|
|
45
65
|
export type ResidentContextualStep = (
|
|
46
66
|
pursuit: ResidentPursuit,
|
|
47
67
|
signal: AbortSignal,
|
|
48
68
|
context: ResidentStepContext,
|
|
49
69
|
) => ReturnType<ResidentStep>
|
|
50
70
|
|
|
51
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* @experimental Inspect actual outcomes and resource receipts independently of model prose.
|
|
73
|
+
*
|
|
74
|
+
* @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.
|
|
75
|
+
*/
|
|
52
76
|
export type ResidentObserver = (
|
|
53
77
|
pursuit: ResidentPursuit,
|
|
54
78
|
decision: ResidentDecision,
|
|
55
79
|
signal: AbortSignal,
|
|
56
80
|
) => Promise<ResidentObservation>
|
|
57
81
|
|
|
58
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* @experimental Host validates content and destination; null means no communication.
|
|
84
|
+
*
|
|
85
|
+
* @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.
|
|
86
|
+
*/
|
|
59
87
|
export type ResidentMessageFactory = (
|
|
60
88
|
pursuit: ResidentPursuit,
|
|
61
89
|
decision: ResidentDecision,
|
|
62
90
|
signal: AbortSignal,
|
|
63
91
|
) => Promise<ResidentMessageInput | null>
|
|
64
92
|
|
|
65
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* @experimental Opt-in local selection, observed settlement and atomic outbound intent.
|
|
95
|
+
*
|
|
96
|
+
* @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.
|
|
97
|
+
*/
|
|
66
98
|
export interface ResidentHostOptions {
|
|
67
99
|
readonly select?: ResidentSelector
|
|
68
100
|
readonly observe?: ResidentObserver
|
|
@@ -75,6 +107,8 @@ export interface ResidentHostOptions {
|
|
|
75
107
|
* @experimental Local driver for one durable agenda. Shared agenda admission
|
|
76
108
|
* prevents overlapping pursuits across processes. Notifications are local;
|
|
77
109
|
* opt-in keepAlive also rereads durable state on bounded idle timers.
|
|
110
|
+
*
|
|
111
|
+
* @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.
|
|
78
112
|
*/
|
|
79
113
|
export class ResidentHost {
|
|
80
114
|
private controller: AbortController | undefined
|
|
@@ -239,7 +273,7 @@ export class ResidentHost {
|
|
|
239
273
|
const context: ResidentStepContext = Object.freeze({
|
|
240
274
|
agendaRevision: state.revision,
|
|
241
275
|
...(this.options.learning && state.learning
|
|
242
|
-
? { learning:
|
|
276
|
+
? { learning: freezeLearning(state.learning) }
|
|
243
277
|
: {}),
|
|
244
278
|
})
|
|
245
279
|
const execution =
|
|
@@ -11,7 +11,11 @@ export const residentObservationSchema = z.object({
|
|
|
11
11
|
costUnits: cost.nullable(),
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @experimental Host-validated outcome and measured resource use, never model self-confidence.
|
|
16
|
+
*
|
|
17
|
+
* @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.
|
|
18
|
+
*/
|
|
15
19
|
export type ResidentObservation = Readonly<z.infer<typeof residentObservationSchema>>
|
|
16
20
|
|
|
17
21
|
export const residentFeedbackSchema = z.object({
|
|
@@ -29,7 +33,11 @@ export const residentFeedbackSchema = z.object({
|
|
|
29
33
|
.max(8),
|
|
30
34
|
})
|
|
31
35
|
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @experimental Last eight observations; best progress and stagnation survive eviction.
|
|
38
|
+
*
|
|
39
|
+
* @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.
|
|
40
|
+
*/
|
|
33
41
|
export type ResidentFeedback = Readonly<
|
|
34
42
|
Omit<z.infer<typeof residentFeedbackSchema>, 'observations'>
|
|
35
43
|
> & {
|
|
@@ -69,7 +77,11 @@ export function freezeResidentFeedback(value: ResidentFeedback): ResidentFeedbac
|
|
|
69
77
|
})
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* @experimental Policy units are chosen by the host; scores are heuristics, not probabilities.
|
|
82
|
+
*
|
|
83
|
+
* @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.
|
|
84
|
+
*/
|
|
73
85
|
export interface ResidentSelectionConfig {
|
|
74
86
|
readonly progressValue: number
|
|
75
87
|
readonly initialExpectedProgress: number
|
|
@@ -77,7 +89,11 @@ export interface ResidentSelectionConfig {
|
|
|
77
89
|
readonly maxStagnantSteps?: number
|
|
78
90
|
}
|
|
79
91
|
|
|
80
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @experimental Explainable inputs for a single selection; unknown cost is not zero.
|
|
94
|
+
*
|
|
95
|
+
* @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.
|
|
96
|
+
*/
|
|
81
97
|
export interface ResidentCandidate {
|
|
82
98
|
readonly pursuitId: string
|
|
83
99
|
readonly reason:
|
|
@@ -92,7 +108,11 @@ export interface ResidentCandidate {
|
|
|
92
108
|
readonly score: number | null
|
|
93
109
|
}
|
|
94
110
|
|
|
95
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* @experimental Choice is bound to the whole agenda revision used to compute it.
|
|
113
|
+
*
|
|
114
|
+
* @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.
|
|
115
|
+
*/
|
|
96
116
|
export interface ResidentSelection {
|
|
97
117
|
readonly agendaRevision: number
|
|
98
118
|
readonly pursuitId: string | null
|
|
@@ -100,7 +120,11 @@ export interface ResidentSelection {
|
|
|
100
120
|
readonly candidates: readonly ResidentCandidate[]
|
|
101
121
|
}
|
|
102
122
|
|
|
103
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* @experimental Pure local selection; perform inference inside budgeted steps, not here.
|
|
125
|
+
*
|
|
126
|
+
* @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.
|
|
127
|
+
*/
|
|
104
128
|
export type ResidentSelector = (agenda: ResidentAgendaState, now: number) => ResidentSelection
|
|
105
129
|
|
|
106
130
|
function meanObservedCost(observations: readonly ResidentObservation[]): number {
|
|
@@ -119,6 +143,8 @@ function meanObservedCost(observations: readonly ResidentObservation[]): number
|
|
|
119
143
|
* @experimental Cost-aware continuation with an explicit abstention choice.
|
|
120
144
|
* This is a measured-progress heuristic, not Bayesian value of computation.
|
|
121
145
|
* A finite bootstrap allowance permits delayed payoffs but may stop too early.
|
|
146
|
+
*
|
|
147
|
+
* @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.
|
|
122
148
|
*/
|
|
123
149
|
export function createResidentSelector(config: ResidentSelectionConfig): ResidentSelector {
|
|
124
150
|
const policy = z
|
|
@@ -6,10 +6,18 @@ import {
|
|
|
6
6
|
type ResidentState,
|
|
7
7
|
} from './store.js'
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @experimental Developer-owned step; bind providers, tools and budgets in the host.
|
|
11
|
+
*
|
|
12
|
+
* @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.
|
|
13
|
+
*/
|
|
10
14
|
export type ResidentStep = (state: ResidentState, signal: AbortSignal) => Promise<ResidentDecision>
|
|
11
15
|
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @experimental No model is invoked for an idle, terminal or unresolved resident.
|
|
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
|
+
*/
|
|
13
21
|
export type ResidentStepResult =
|
|
14
22
|
| { status: 'settled'; state: ResidentState }
|
|
15
23
|
| {
|
|
@@ -18,7 +26,11 @@ export type ResidentStepResult =
|
|
|
18
26
|
state: ResidentState
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @experimental A failed/aborted callback leaves its durable claim unresolved.
|
|
31
|
+
*
|
|
32
|
+
* @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.
|
|
33
|
+
*/
|
|
22
34
|
export async function stepResident(
|
|
23
35
|
store: ResidentExecutionStore,
|
|
24
36
|
step: ResidentStep,
|
|
@@ -53,7 +65,11 @@ export async function stepResident(
|
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @experimental Bounded local driver; not a daemon, process recovery service or notification transport.
|
|
70
|
+
*
|
|
71
|
+
* @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.
|
|
72
|
+
*/
|
|
57
73
|
export interface ResidentLoopOptions {
|
|
58
74
|
readonly store: ResidentExecutionStore
|
|
59
75
|
readonly step: ResidentStep
|
|
@@ -68,6 +84,8 @@ export interface ResidentLoopOptions {
|
|
|
68
84
|
* @experimental Continue a pursuit without a new user message. Null wake times
|
|
69
85
|
* and terminal states stop immediately; cancellation also interrupts idle waits.
|
|
70
86
|
* An abort cannot undo callback effects or forcibly stop a callback ignoring its signal.
|
|
87
|
+
*
|
|
88
|
+
* @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.
|
|
71
89
|
*/
|
|
72
90
|
export async function runResident(options: ResidentLoopOptions): Promise<ResidentStepResult> {
|
|
73
91
|
const maxIdleMs = options.maxIdleMs ?? 60_000
|
|
@@ -18,7 +18,11 @@ export const residentMessageInputSchema = z.object({
|
|
|
18
18
|
notBefore: time,
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @experimental Host-approved content and an opaque destination route, never credentials.
|
|
23
|
+
*
|
|
24
|
+
* @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.
|
|
25
|
+
*/
|
|
22
26
|
export type ResidentMessageInput = Readonly<z.infer<typeof residentMessageInputSchema>>
|
|
23
27
|
|
|
24
28
|
export const residentOutboxMessageSchema = residentMessageInputSchema
|
|
@@ -47,7 +51,11 @@ export const residentOutboxMessageSchema = residentMessageInputSchema
|
|
|
47
51
|
context.addIssue({ code: z.ZodIssueCode.custom, message: 'Invalid outbox lifecycle.' })
|
|
48
52
|
})
|
|
49
53
|
|
|
50
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @experimental Acknowledgment proves transport acceptance, not human reading.
|
|
56
|
+
*
|
|
57
|
+
* @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.
|
|
58
|
+
*/
|
|
51
59
|
export type ResidentOutboxMessage = Readonly<z.infer<typeof residentOutboxMessageSchema>>
|
|
52
60
|
|
|
53
61
|
export const residentDeliveryOutcomeSchema = z.discriminatedUnion('kind', [
|
|
@@ -59,10 +67,18 @@ export const residentDeliveryOutcomeSchema = z.discriminatedUnion('kind', [
|
|
|
59
67
|
}),
|
|
60
68
|
])
|
|
61
69
|
|
|
62
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* @experimental Retry only with evidence of non-acceptance; null retryAt ends delivery.
|
|
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
|
+
*/
|
|
63
75
|
export type ResidentDeliveryOutcome = Readonly<z.infer<typeof residentDeliveryOutcomeSchema>>
|
|
64
76
|
|
|
65
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @experimental Atomic admission and exact-claim settlement, without automatic claim expiry.
|
|
79
|
+
*
|
|
80
|
+
* @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.
|
|
81
|
+
*/
|
|
66
82
|
export interface ResidentOutboxStore {
|
|
67
83
|
read(): Promise<ResidentAgendaState | null>
|
|
68
84
|
claimMessage(
|
|
@@ -77,7 +93,11 @@ export interface ResidentOutboxStore {
|
|
|
77
93
|
): Promise<ResidentOutboxMessage>
|
|
78
94
|
}
|
|
79
95
|
|
|
80
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* @experimental A synchronous host policy, evaluated before claiming and again before sending.
|
|
98
|
+
*
|
|
99
|
+
* @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.
|
|
100
|
+
*/
|
|
81
101
|
export type ResidentDeliveryGate = (
|
|
82
102
|
message: ResidentOutboxMessage,
|
|
83
103
|
now: number,
|
|
@@ -89,20 +109,32 @@ export type ResidentDeliveryGate = (
|
|
|
89
109
|
readonly reason: string
|
|
90
110
|
}
|
|
91
111
|
|
|
92
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* @experimental Bind an authorized route; forward message.id as the stable idempotency key.
|
|
114
|
+
*
|
|
115
|
+
* @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.
|
|
116
|
+
*/
|
|
93
117
|
export type ResidentMessageTransport = (
|
|
94
118
|
message: ResidentOutboxMessage,
|
|
95
119
|
signal: AbortSignal,
|
|
96
120
|
) => Promise<ResidentDeliveryOutcome>
|
|
97
121
|
|
|
98
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* @experimental One dispatch admission, with no model invocation, polling or implicit retries.
|
|
124
|
+
*
|
|
125
|
+
* @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.
|
|
126
|
+
*/
|
|
99
127
|
export interface ResidentDeliveryOptions {
|
|
100
128
|
readonly signal: AbortSignal
|
|
101
129
|
readonly gate: ResidentDeliveryGate
|
|
102
130
|
readonly now?: () => number
|
|
103
131
|
}
|
|
104
132
|
|
|
105
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* @experimental An idle result never asserts a message reached its destination.
|
|
135
|
+
*
|
|
136
|
+
* @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.
|
|
137
|
+
*/
|
|
106
138
|
export type ResidentDeliveryResult =
|
|
107
139
|
| { readonly status: 'settled'; readonly message: ResidentOutboxMessage }
|
|
108
140
|
| {
|
|
@@ -223,6 +255,8 @@ function admission(gate: ResidentDeliveryGate, message: ResidentOutboxMessage, n
|
|
|
223
255
|
* @experimental Persist one send claim before calling a host-owned transport.
|
|
224
256
|
* Throws, malformed outcomes and cancellation keep the claim unresolved. Stop
|
|
225
257
|
* old executors and inspect effects before explicit settleMessage reconciliation.
|
|
258
|
+
*
|
|
259
|
+
* @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.
|
|
226
260
|
*/
|
|
227
261
|
export async function deliverResidentMessage(
|
|
228
262
|
store: ResidentOutboxStore,
|
|
@@ -27,7 +27,11 @@ export const residentProposalLimitsSchema = z.object({
|
|
|
27
27
|
maxDepth: z.number().int().min(1).max(4),
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @experimental An inert subgoal proposal; creating it grants no execution authority.
|
|
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
|
+
*/
|
|
31
35
|
export interface ResidentProposal {
|
|
32
36
|
readonly id: string
|
|
33
37
|
readonly parentId: string
|
|
@@ -38,7 +42,11 @@ export interface ResidentProposal {
|
|
|
38
42
|
readonly evidenceKey: string
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @experimental Host-approved routing domains and finite subgoal admission bounds.
|
|
47
|
+
*
|
|
48
|
+
* @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.
|
|
49
|
+
*/
|
|
42
50
|
export interface ResidentProposalLimits {
|
|
43
51
|
readonly domains: readonly string[]
|
|
44
52
|
readonly maxChildrenPerParent: number
|
|
@@ -56,13 +64,19 @@ export const residentProposalOriginSchema = z.object({
|
|
|
56
64
|
depth: z.number().int().min(1).max(4),
|
|
57
65
|
})
|
|
58
66
|
|
|
59
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* @experimental Host-admitted ancestry and evidence for a resident subgoal.
|
|
69
|
+
*
|
|
70
|
+
* @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.
|
|
71
|
+
*/
|
|
60
72
|
export type ResidentProposalOrigin = Readonly<z.infer<typeof residentProposalOriginSchema>>
|
|
61
73
|
|
|
62
74
|
/**
|
|
63
75
|
* @experimental Pure validation against one agenda snapshot. The host must
|
|
64
76
|
* atomically bind this snapshot to admission. Domains are routing metadata;
|
|
65
77
|
* this does not prove an objective fits its domain or authorize any tools.
|
|
78
|
+
*
|
|
79
|
+
* @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.
|
|
66
80
|
*/
|
|
67
81
|
export function validateResidentProposal(
|
|
68
82
|
agenda: ResidentAgendaState,
|