@dsh-ray/assistant-dreaming 0.0.1-seed.0 → 0.2.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/LICENSE +21 -0
- package/README.md +302 -1
- package/cordis.patch.yml +5 -0
- package/lib/config.d.ts +88 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +190 -0
- package/lib/config.js.map +1 -0
- package/lib/dream-agent.d.ts +58 -0
- package/lib/dream-agent.d.ts.map +1 -0
- package/lib/dream-agent.js +190 -0
- package/lib/dream-agent.js.map +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +15 -0
- package/lib/index.js.map +1 -0
- package/lib/notify.d.ts +64 -0
- package/lib/notify.d.ts.map +1 -0
- package/lib/notify.js +52 -0
- package/lib/notify.js.map +1 -0
- package/lib/projection.d.ts +36 -0
- package/lib/projection.d.ts.map +1 -0
- package/lib/projection.js +162 -0
- package/lib/projection.js.map +1 -0
- package/lib/runtime.d.ts +69 -0
- package/lib/runtime.d.ts.map +1 -0
- package/lib/runtime.js +835 -0
- package/lib/runtime.js.map +1 -0
- package/lib/store.d.ts +120 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/store.js +462 -0
- package/lib/store.js.map +1 -0
- package/lib/trigger.d.ts +136 -0
- package/lib/trigger.d.ts.map +1 -0
- package/lib/trigger.js +160 -0
- package/lib/trigger.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/package.json +117 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-ray contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,304 @@
|
|
|
1
1
|
# @dsh-ray/assistant-dreaming
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
条件式默认启用的"做梦/突发奇想"插件:在缺少 `scope`/`databasePath`/`provider`/`model`/`budgetId`/`budgetAmount` 等必填前提时保持安全休眠(`enabled: false`,零写入);一旦配置齐备且未显式禁用或退役(`enabled: false` / `retired: true`),默认解析为 `enabled: true` 自动激活。启用后它以低频率、确定性随机、
|
|
4
|
+
空闲感知的方式回顾**已认证的历史投影**(可信任务投影、owner 目标、活动技能,以及可选
|
|
5
|
+
`personalMemory` 提供的严格非敏感 `private` 摘要),在随机时刻让一个冻结的单工具
|
|
6
|
+
Agent 产生少量结构化 idea,并只写入插件私有的 SQLite 账本。
|
|
7
|
+
|
|
8
|
+
它**不是**成长复盘:输入是跨任务的模式与空白,输出是未验证假设。默认级别 L0
|
|
9
|
+
(仅私有 idea),默认不通知、不开 Goal/WorkItem、不形成候选、不自动采用;模型输出
|
|
10
|
+
schema 不允许任何评分/置信度/自收益字段,沉默不算正向。只有 owner 通过受策略保护的
|
|
11
|
+
接口显式 `acknowledgeIdea` / `transitionIdea(..., 'validate')` 验证后,其他受控管线
|
|
12
|
+
(如可选的 `assistant-growth-driver`)才可在有限预算内读取已验证 idea。
|
|
13
|
+
|
|
14
|
+
## 召回抽奖("无事找事")
|
|
15
|
+
|
|
16
|
+
在触发门(活跃时段/空闲/日上限/概率抽签)全部通过后,wake 不会直接调用模型,
|
|
17
|
+
而是先跑一段纯代码的 per-subject 抽奖:每个可回顾对象(任务投影、目标、技能,以及
|
|
18
|
+
本 lane 尚未了结的已记录 idea)由 `HMAC(seed, lane+kind+key)` 派生出一个
|
|
19
|
+
`[0, 1_000_000)` 内的稳定**票号**并登记入账;每个 wake 槽位再由
|
|
20
|
+
`HMAC(seed, lane+occurrence)` 滚出一个**开奖号**,票号落在开奖号环形窗口
|
|
21
|
+
(默认 ±5,000,约 1%)内的对象被"召回"。已了结(validated/rejected/withdrawn)
|
|
22
|
+
的 idea 每 wake 清理其票,不再被召回。没有任何票命中是正常的无思考槽位:
|
|
23
|
+
执行器返回 no-effect success(`failureCode` 恒为 `none`,跳过原因保留在
|
|
24
|
+
`health().lastSkipReason === 'lottery-no-hit'`),完全不调用模型;命中时才启动
|
|
25
|
+
Agent,并把
|
|
26
|
+
被召回对象作为聚焦提示注入(recorded-idea 附带其 summary),模型围绕它展开思考。
|
|
27
|
+
全程确定性、可审计、可重放,随机性只来自 owner seed 的 HMAC,代码里没有
|
|
28
|
+
`Math.random`。
|
|
29
|
+
|
|
30
|
+
## 信任边界与权限
|
|
31
|
+
|
|
32
|
+
- Cordis 注入:必需注入仅保留 Host/Automations 协调所需服务
|
|
33
|
+
(`assistantAutomations`、`assistantDelivery`、`assistantEvaluation`、
|
|
34
|
+
`assistantGoals`、`assistantSkills`、`agents`、`sessions`、`tools`),所有
|
|
35
|
+
sibling DSH bundle(含可选 `assistantPolicy`、`personalMemory`)在 `package.json`
|
|
36
|
+
中均声明为**可选** `peerDependencies`(不放入 `dependencies`),只有
|
|
37
|
+
`@deepseek-ai/schemastery` 与 `@dsh-ray/task-acceptance-contract` 等非激活
|
|
38
|
+
共享库留在 `dependencies`。模型调用本身经 `agents`/Agent Loop 与 Host 的 `llm`
|
|
39
|
+
route 发生;启用阶段会做前置门禁(`validateOwnerRoute`、可选 `assistantPolicy`
|
|
40
|
+
emergency-stop/budget/execute 规则、可选 `llm.listProviders()` 与执行前
|
|
41
|
+
`resolveModelInfo`),前置条件未就绪时保持 `dormant` 暂停态且不注册执行器,等
|
|
42
|
+
`onSchedulerWake` 或 `llm/adapters-updated` 就绪后再激活,避免空烧稀缺预算。
|
|
43
|
+
- 可选 `personalMemory` 仅调用 `listLearningTargets({ owner, limit })` 读取严格非敏感
|
|
44
|
+
(`sensitivity === 'private'` 或缺省)且受长度限制的摘要并记为 `memory-summary`;
|
|
45
|
+
仍不读敏感(`sensitive`)记忆、不读原始 transcript/工具参数/验收回执、不读凭据;所有
|
|
46
|
+
输入是 Host 投影后的有界摘要,每条带证据 digest,idea 必须引用本 wake 材料内的
|
|
47
|
+
证据 digest。
|
|
48
|
+
- 工具面冻结为恰好一个 `dream_submit_ideas`;其余全局工具在 Agent setup 中
|
|
49
|
+
`restrict` 拒绝,并做精确 allowlist 断言。真实 Host 的 Policy 仍会检查这次工具
|
|
50
|
+
调用,默认拒绝的部署需要为它添加一条后台 allow 规则(见“安装与启用”)。
|
|
51
|
+
- Owner 状态迁移(`acknowledgeIdea` / `transitionIdea({ ideaId, transition: 'validate' | 'reject' | 'retire' })`)
|
|
52
|
+
强制实时校验 `validateOwnerRoute`、`principalId` 一致性与 `assistantPolicy.authorize`
|
|
53
|
+
(action 为 `dream.acknowledge` / `dream.validate` / `dream.reject` / `dream.retire`,
|
|
54
|
+
resource kind 为 `evolution`,missing policy/emergency-stop/deny 一律 fail-closed),
|
|
55
|
+
并把操作记录进 `dream_idea_events` 审计轨迹。
|
|
56
|
+
- 每次 occurrence 的预算预留/结算由 `assistant-automations` 持有;dreaming 执行器
|
|
57
|
+
不再重复预留,只在自己的账本里按 `maxDreamsPerDay` 计日上限。模型/工具调用
|
|
58
|
+
次数、输出 token、时长、输入字节、每日次数都有硬顶。
|
|
59
|
+
- 随机性是 `HMAC(seedDigest, lane+occurrence)` 的确定性抽签,可审计可重放,从不
|
|
60
|
+
调用 `Math.random`。
|
|
61
|
+
- 权限摘要:文件系统仅读写配置指定的绝对私有 SQLite(`0600`)及其目录(`0700`);网络仅经 Host 已注册的 `llm` route 发起有界模型请求(`notifyOwner: true` 时经 Delivery 通知通道);**子进程、凭据存储、浏览器、安装脚本:无。**
|
|
62
|
+
|
|
63
|
+
## 配置(前提齐备时默认开启,缺省时安全休眠;未知字段拒绝)
|
|
64
|
+
|
|
65
|
+
| 键 | 默认 | 说明 |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `enabled` | 条件默认(前提齐备且未 `retired` 时 `true`,否则 `false`) | 显式设为 `false` 时强制关闭(即使前提齐备也不注册 automation、不打开数据库、零写入);显式 `true` 时若缺前提则 fail-closed 拒绝加载。 |
|
|
68
|
+
| `retired` | `false` | owner 暂停开关:`enabled: true` 且 `retired: true` 时加载即把 system automation 收敛为 paused、不注册执行器(账本照常打开并执行保留期),用于暂停后再关闭/卸载。必须同时 `enabled: true`;`enabled: false` 时保留 `retired: true` 会 fail-closed 报错(disabled 路径无法 pause,不能让 owner 误以为已退役)。去掉该标志后的下一次加载用新的 reconcile key 恢复 active。 |
|
|
69
|
+
| `scope` | 无 | `workspace/preset/principalId/ownerRouteId`;启用时必填。 |
|
|
70
|
+
| `databasePath` | `!!js dshHomePath('assistant-dreaming/state.sqlite')`(随包 `cordis.patch.yml` 提供;程序化 `Config` 缺省为空) | 私有 SQLite 绝对规范路径;启用时必填,目录不可组/全局可写。 |
|
|
71
|
+
| `baseIntervalMs` | `3600000` | 抽签节拍(15 分钟–24 小时),复用原生 Automations `every`。 |
|
|
72
|
+
| `runProbabilityPpm` | `250000` | 每节拍抽中率(0–1,000,000)。 |
|
|
73
|
+
| `idleMinMs` | `1800000` | 距最近可信活动至少 30 分钟才触发;冷启动完全无任务投影(`latestActivityAt === null`)时回退到账本持久化的 per-lane 冷启动锚点(`dream_lane_state.cold_start_anchor_at`),锚点经过 `idleMinMs` 后解锁空闲门,若完全没有真实目标/技能/非敏感记忆材料则以 `no-recallable-material` 干净跳过,绝不伪造任务证据;两者皆无时 fail-closed。 |
|
|
74
|
+
| `lotteryWindow` | `5000` | 召回开奖号环形窗口半宽(0–500,000;0 = 仅精确票号命中),按命中率调节召回频率。 |
|
|
75
|
+
| `activeHours` | 无 | 同日窗口 `timezone/startMinute/endMinute`,不跨午夜。 |
|
|
76
|
+
| `randomSeed` | 无 | 可选 HMAC seed;只持久化其 digest。 |
|
|
77
|
+
| `maxDreamsPerDay` | `3` | 每日做梦次数硬顶(1–24)。 |
|
|
78
|
+
| `maxIdeasPerWake` | `3` | 每次 wake 最多 idea 数(1–5)。 |
|
|
79
|
+
| `maxModelCalls` / `maxToolCalls` / `maxOutputTokens` / `maxDurationMs` | `2/1/2048/90000` | 单轮冻结上限。 |
|
|
80
|
+
| `maxInputBytes` / `maxEvidenceRefs` | `16384/8` | 输入材料上限。 |
|
|
81
|
+
| `notifyOwner` | `false` | L1:开启后在每日/间隔门内发一条有界 owner 摘要(仅计数与前 3 条 summary,经 Delivery 认证通知通道;撤回/拒收不推断),默认关闭。 |
|
|
82
|
+
| `maxNotificationsPerDay` | `1` | L1 每日通知硬顶(0–3),不得超过 `maxDreamsPerDay`。 |
|
|
83
|
+
| `notifyMinIntervalMs` | `86400000` | 两次 L1 通知的最小间隔(1 分钟–7 天)。 |
|
|
84
|
+
| `budgetId` / `budgetAmount` | 无 | 必须成对;启用时必填,写入 system automation 定义,由 `assistant-automations` 在每个 occurrence 前预留并结算。Policy 里要有同 id、metric 为 `automation-runs` 的 budget。 |
|
|
85
|
+
| `provider` / `model` | 无 | 供应商中立通用字段,必须成对;启用时必填,必须是 Host 已注册的 LLM route。`reasoningEffort` 可选。 |
|
|
86
|
+
| `retentionDays` | `90` | idea 保留期;插件加载时与每次成功做梦后硬删除过期 idea。 |
|
|
87
|
+
|
|
88
|
+
启用时 fail-closed 校验:scope(含规范绝对 `workspace`)、规范绝对 `databasePath`、
|
|
89
|
+
provider/model 对、budget 对、`maxNotificationsPerDay <= maxDreamsPerDay`、activeHours
|
|
90
|
+
同日窗口;任何一项不满足直接拒绝装配。
|
|
91
|
+
|
|
92
|
+
## 安装与启用(真实部署)
|
|
93
|
+
|
|
94
|
+
裸安装(无完整 `scope`、`provider`/`model` 与 `budgetId`/`budgetAmount`)时,`enabled` 解析为 `false` 保持安全休眠:不注册 automation、不打开 SQLite、零写入、零模型调用;补齐全部前提后(即使省略 `enabled`)自动解析为 `enabled: true`(显式 `enabled: false` 可随时停用,`retired: true` 可按既定 owner 流程安全暂停退役)。
|
|
95
|
+
|
|
96
|
+
1. 安装 bundle(npm 发布后)或把本地打包 tarball 装进目标 profile:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
dsh plugin --profile <profile> add @dsh-ray/assistant-dreaming
|
|
100
|
+
# 或本地验证:pnpm --dir plugins/assistant-dreaming pack --pack-destination /tmp
|
|
101
|
+
# dsh plugin --profile <profile> add /tmp/dsh-ray-assistant-dreaming-<version>.tgz
|
|
102
|
+
dsh --profile <profile> --dump-config | grep -A2 assistant-dreaming
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`dsh plugin add` 会把包注册进 profile 的 `dsh.profile.bundles`,bundle patch 插入
|
|
106
|
+
一行 `dsh-ray-assistant-dreaming`(默认仅含 `databasePath: !!js dshHomePath('assistant-dreaming/state.sqlite')`,缺少完整前提时保持关闭休眠态)。
|
|
107
|
+
|
|
108
|
+
2. 在 profile 的 `cordis.patch.yml` 里按 id 覆盖该行,写入启用配置(值按实际 owner
|
|
109
|
+
替换;行内 config 是整段替换,不是深合并):
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
- id: dsh-ray-assistant-dreaming
|
|
113
|
+
name: '@dsh-ray/assistant-dreaming'
|
|
114
|
+
config:
|
|
115
|
+
enabled: true
|
|
116
|
+
scope:
|
|
117
|
+
workspace: /Users/<owner>/.dsh/assistant-workspace # 规范绝对路径
|
|
118
|
+
preset: standard # 必须是该 workspace 的 Agent preset
|
|
119
|
+
principalId: <existing-delivery-principal-id>
|
|
120
|
+
ownerRouteId: <existing-delivery-owner-route-id>
|
|
121
|
+
databasePath: !!js dshHomePath('assistant-dreaming/dream.sqlite')
|
|
122
|
+
baseIntervalMs: 3600000 # 1 小时一个抽签槽
|
|
123
|
+
runProbabilityPpm: 250000 # 1/4 槽位通过触发门
|
|
124
|
+
idleMinMs: 1800000 # 距最近可信活动 ≥30 分钟
|
|
125
|
+
lotteryWindow: 5000 # 每个 subject 每槽约 1% 召回率
|
|
126
|
+
activeHours: { timezone: Asia/Shanghai, startMinute: 480, endMinute: 1380 }
|
|
127
|
+
randomSeed: "<owner 提供的 ≥16 字符 seed>"
|
|
128
|
+
maxDreamsPerDay: 3
|
|
129
|
+
maxIdeasPerWake: 3
|
|
130
|
+
budgetId: assistant-dreaming-runs
|
|
131
|
+
budgetAmount: 1
|
|
132
|
+
provider: <host-registered-llm-provider>
|
|
133
|
+
model: <host-registered-model-id>
|
|
134
|
+
# 可选 L1 摘要通知;默认关闭:
|
|
135
|
+
# notifyOwner: true
|
|
136
|
+
# maxNotificationsPerDay: 1
|
|
137
|
+
# notifyMinIntervalMs: 86400000
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
3. Host 侧前置条件(缺一不可,缺失时按 fail-closed 处理而不是伪造成功):
|
|
141
|
+
|
|
142
|
+
- **Automations 调度器**:目标 profile 的 `assistant-automations` 行必须
|
|
143
|
+
`schedulerEnabled: true`(插件默认 `false`),否则 automation 注册成功但永远
|
|
144
|
+
不会触发;同时 `allowUnbudgetedExecution` 保持默认 `false`。
|
|
145
|
+
- **Policy 预算**:`budgetId` 必须在 `assistant-policy` 的 `budgets` 里存在且
|
|
146
|
+
metric 精确为 `automation-runs`;Automations 在每个 occurrence 调用执行器前
|
|
147
|
+
预留、结束后结算 `budgetAmount`。因为**每个调度槽**都会消耗一次,budget 的
|
|
148
|
+
limit/period 至少要覆盖该周期内的槽位数(例如 1 小时节拍 + 每日 limit 24),
|
|
149
|
+
否则当天晚些槽位会因预算耗尽跳过。
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
budgets:
|
|
153
|
+
- id: assistant-dreaming-runs
|
|
154
|
+
metric: automation-runs
|
|
155
|
+
limit: 24 # 1 小时节拍时覆盖一天 24 个槽
|
|
156
|
+
periodMs: 86400000
|
|
157
|
+
scope: subject
|
|
158
|
+
```
|
|
159
|
+
- **Policy 规则(默认 deny 的 profile 必须配,否则加载即失败)**:
|
|
160
|
+
`assistant-automations` 在**加载时**先以 background subject
|
|
161
|
+
`{kind: background, id: 'assistant-dreaming', workspace, principal}`、
|
|
162
|
+
action `reconcile` 请求授权(缺失时 `reconcileSystem` 抛 policy-denied,插件
|
|
163
|
+
等加载失败并已自行清理),每次 occurrence 又以
|
|
164
|
+
`{kind: background, id: <automationId>, ...}`、action `execute` 授权。
|
|
165
|
+
因此 automation 规则要同时覆盖 `reconcile` 与 `execute`,subject id 用
|
|
166
|
+
`'*'`(owner id 与 automation id 都会出现),workspace/principal 必须与
|
|
167
|
+
scope 精确一致(身份字段不能用通配)。冻结 Agent 里的唯一工具
|
|
168
|
+
`dream_submit_ideas` 也要 allow;dream Agent 已绑定 background initiator,
|
|
169
|
+
所以用 `initiators: [background]`。若 profile 已设
|
|
170
|
+
`toolDefaultEffect: allow`,工具规则可省略。示意:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
rules:
|
|
174
|
+
- id: assistant-dreaming-automation
|
|
175
|
+
effect: allow
|
|
176
|
+
subject: { kind: background, id: '*', workspace: /Users/<owner>/.dsh/assistant-workspace, principal: <principal> }
|
|
177
|
+
actions: [reconcile, execute]
|
|
178
|
+
resource: { kind: automation, id: 'dsh-ray-assistant-dreaming:*' }
|
|
179
|
+
context: { initiators: [background] }
|
|
180
|
+
- id: assistant-dreaming-submit
|
|
181
|
+
effect: allow
|
|
182
|
+
subject: { kind: agent, id: standard, workspace: /Users/<owner>/.dsh/assistant-workspace, principal: <principal> }
|
|
183
|
+
actions: [execute]
|
|
184
|
+
resource: { kind: tool, id: dream_submit_ideas }
|
|
185
|
+
context: { initiators: [background] }
|
|
186
|
+
# 仅 notifyOwner: true 时需要(L1 摘要走 Delivery 后台 send)
|
|
187
|
+
- id: assistant-dreaming-notify
|
|
188
|
+
effect: allow
|
|
189
|
+
subject: { kind: background, id: 'assistant-dreaming-idea-summary/v1', workspace: /Users/<owner>/.dsh/assistant-workspace }
|
|
190
|
+
actions: [send]
|
|
191
|
+
resource: { kind: message, id: '*' }
|
|
192
|
+
context: { initiators: [background] }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
- **Delivery owner route**:`ownerRouteId` 必须是 Delivery 中既有的、已认证 active
|
|
196
|
+
route;生成输入材料前会用当前 route 重新校验,缺失/撤权时该 wake 以
|
|
197
|
+
`dream-material-unavailable`(配置类失败、零模型调用)结束。开启
|
|
198
|
+
`notifyOwner` 时还需要上面的 Delivery `send` 规则;Delivery 校验失败时不发送,
|
|
199
|
+
插件把通知失败当成“不影响做梦结果”,不伪造送达。
|
|
200
|
+
- **模型 route**:`provider`/`model` 必须是 Host LLM 插件已注册的 route;dreaming
|
|
201
|
+
不携带凭据,也不读环境变量里的 key。
|
|
202
|
+
|
|
203
|
+
4. 启用后产生的副作用:
|
|
204
|
+
|
|
205
|
+
- 每个通过触发门且召回抽奖命中的槽位会创建一次冻结 Agent 并调用**付费模型**
|
|
206
|
+
(上限 `maxModelCalls`/`maxToolCalls`/`maxOutputTokens`/`maxDurationMs`);
|
|
207
|
+
未命中抽奖的槽位零模型调用。
|
|
208
|
+
- 写入 `databasePath` 指向的插件私有 SQLite(WAL/SHM;目录必须 owner-private,
|
|
209
|
+
组/全局可写会拒绝启动):`dream_runs`/`dream_ideas`/`dream_idea_events`/
|
|
210
|
+
`dream_counters`/`dream_tickets`/`dream_recalls`/`dream_lane_state`。
|
|
211
|
+
- 默认只有私有 idea,不写 Goals/WorkItems、不创建候选、不自动采用、不发消息;
|
|
212
|
+
`notifyOwner: true` 时才通过 Delivery 认证通道发有界摘要(每日/间隔门内)。
|
|
213
|
+
- 服务接口:只读 `health()` / `inspectIdeas()` / `inspectValidatedIdeas()` /
|
|
214
|
+
`inspectIdeaEvents(ideaId)` 与变更订阅 `onIdeaChange(listener)`(`enabled: false` 时返回无副作用的退订函数;供可选 `assistant-association` 等可信 Host 在 idea 创建、状态迁移或过期清理后刷新投影与撤回已拒绝/已撤回条目),以及受 owner 路由与 `assistantPolicy.authorize`
|
|
215
|
+
门禁保护的 `acknowledgeIdea(...)`、`transitionIdea(...)`(支持 `validate` /
|
|
216
|
+
`reject` / `retire` -> `withdrawn`)与 `retire()`(暂停 system automation、
|
|
217
|
+
注销执行器并保留账本)。owner 也可通过配置项 `retired: true` 完成静态退役:
|
|
218
|
+
1) 在 profile patch 里保持完整配置、加 `retired: true`,重载/重启 profile:
|
|
219
|
+
automation 收敛为 paused、执行器不注册;构造失败时插件会自行回滚
|
|
220
|
+
executor 与账本再抛错,不会留下半装状态;
|
|
221
|
+
2) 确认 paused 后,把 `enabled` 设为 `false`(或移除/卸载 bundle);**同一次
|
|
222
|
+
修改里必须删除 `retired`**:`enabled: false` + `retired: true` 会被配置
|
|
223
|
+
fail-closed 拒绝(disabled 路径在 reconcile 之前就返回,根本不会 pause,
|
|
224
|
+
接受该组合会制造“看起来已安全退役”的假象);
|
|
225
|
+
3) 恢复时删除 `retired`(或设 false)并重载:active 与 paused 的 reconcile key
|
|
226
|
+
都按每次加载生成(Automations 对相同 key 回放旧收据),所以 resume、
|
|
227
|
+
重复 retire、resume 后再 retire 都能收敛到目标状态,不会被旧收据挡住。
|
|
228
|
+
代价是每次加载多一条 system-reconcile 审计收据(已知限制 P2)。
|
|
229
|
+
若已误把 `enabled` 改成 false:Automations 在 materialize 阶段就找不到执行器,
|
|
230
|
+
会为每个到期 slot 记录 availability incident(**不产生 run**,也没有模型调用),
|
|
231
|
+
需要用 Automations 的 owner/system ownership 入口暂停或删除该
|
|
232
|
+
`dsh-ray-assistant-dreaming:*` 行,然后重载 profile。
|
|
233
|
+
|
|
234
|
+
## 账本
|
|
235
|
+
|
|
236
|
+
`dream_runs`(每次抽签/运行与 drawDigest)、`dream_ideas`(含状态机
|
|
237
|
+
`recorded → owner-acknowledged → validated/rejected` 或 `withdrawn`,同 lane 同日
|
|
238
|
+
同摘要去重)、`dream_idea_events`(含初始 `recorded` 与后续 `owner`/`host` 迁移
|
|
239
|
+
审计事件)、`dream_counters`(每日做梦/通知计数)、`dream_tickets`(每个 subject
|
|
240
|
+
的稳定票号,支持 `task-projection`/`goal`/`skill`/`recorded-idea`/`memory-summary`,
|
|
241
|
+
重复登记不覆盖原票)、`dream_recalls`(每次开奖命中的审计行,槽位重放幂等)与
|
|
242
|
+
`dream_lane_state`(per-lane `cold_start_anchor_at` 与 `last_activity_at`)。
|
|
243
|
+
`PRAGMA user_version=3`(schema 2/3 均对旧版本做幂等迁移不丢数据),schema 变新即
|
|
244
|
+
拒绝启动。
|
|
245
|
+
插件加载时把重启遗留的 running 行改为 `interrupted`,并按 `retentionDays` 硬删除
|
|
246
|
+
过期 idea(每次成功做梦后再执行一次);`dream_runs` 的审计摘要保留。
|
|
247
|
+
|
|
248
|
+
## 不做的事
|
|
249
|
+
|
|
250
|
+
- 除可选 L1 摘要通知外不发消息;不读 `sensitive` 记忆、不读 web、不直接调用写工具或
|
|
251
|
+
Goal/WorkItem 候选 API,也不在无证据时伪造任务投影。
|
|
252
|
+
- 不评分、不排序、不把工具成功或 owner 沉默当作收益证据;任何"采用"只认后续真实
|
|
253
|
+
owner 动作或独立验收轨道。
|
|
254
|
+
- 不新建循环或定时器:调度完全走 `assistant-automations`,`misfire: skip`、
|
|
255
|
+
`overlap: skip`、`retrySafety: never`、`maxRetries: 0`,重启后 running 仅转
|
|
256
|
+
`interrupted`,不自动重放;错过的 slot 不会补跑,避免停机后集中产生付费调用。
|
|
257
|
+
- 执行器不自行预留预算:每个 occurrence 的 Policy budget 由 `assistant-automations`
|
|
258
|
+
在调用执行器前预留并结算,执行结果只报告 outcome/副作用/可重试性,不报告预算结算。
|
|
259
|
+
|
|
260
|
+
## 已知限制
|
|
261
|
+
|
|
262
|
+
- P2:active 与 paused reconcile key 都带每次加载的 nonce,每次加载会向 Automations
|
|
263
|
+
的 system-reconcile 审计表追加一条收据;行数随插件加载次数增长(低频、只增不改)。
|
|
264
|
+
- P3:`retired` 参与 configDigest,而 configDigest 也用作 definition 的
|
|
265
|
+
`activationNonce`;切换 retired 会更新 system automation 的 definition hash。
|
|
266
|
+
这是 resume 时重新收敛定义的结果,不影响正确性,但审计上会看到 definition 版本变化。
|
|
267
|
+
- P5:两个真实 `HostAutomationExecutorRegistry` 用例在 sibling
|
|
268
|
+
`assistant-automations/lib` 不存在时跳过(`pnpm check` 先 build,正常会执行);
|
|
269
|
+
镜像终态断言始终执行。
|
|
270
|
+
- enabled:false 不会自动 pause 上次注册的 system automation(需要 Policy
|
|
271
|
+
`reconcile` 授权且与“关闭零写入”冲突);必须按上面的 retired 顺序退役。
|
|
272
|
+
|
|
273
|
+
## 测试
|
|
274
|
+
|
|
275
|
+
`pnpm --filter @dsh-ray/assistant-dreaming test`(62 个用例,6 个文件):
|
|
276
|
+
config fail-closed、包依赖边界(sibling DSH bundle 仅在可选 `peerDependencies`)、
|
|
277
|
+
确定性抽签/active-hours/idle(含 `coldStartAnchorAt`)/日上限门、确定性票号/环形窗口
|
|
278
|
+
匹配、SQLite 账本/状态机/保留期(含带生命周期事件的过期 idea)/schema 1→2→3 迁移/
|
|
279
|
+
`ownData` 防护、L1 通知路由验证与 fail-closed、真实 AgentLoop 冻结单工具集成,以及真实
|
|
280
|
+
Cordis 装载、前置门禁(`budget`/`policy`/`llm` 就绪前保持 `dormant` 并在 wake/`llm` 更新
|
|
281
|
+
后自动激活)、可选 `personalMemory` 仅召回非敏感摘要、owner `acknowledgeIdea` /
|
|
282
|
+
`transitionIdea` 授权审计测试:
|
|
283
|
+
|
|
284
|
+
- 默认导出服务类可被 `ctx.plugin` 以 `(ctx, config)` 装载;关闭态不注册 automation、
|
|
285
|
+
不注册执行器、不打开 SQLite。
|
|
286
|
+
- 启用态 reconcile 出的 system automation 定义(`every`/锚点/interval、
|
|
287
|
+
`misfire: skip`、`overlap: skip`、budget、Host execution spec)与注册的
|
|
288
|
+
`assistant-dreaming-v1` 执行器 allowlist。
|
|
289
|
+
- 执行器 4 条 wake 路径(preview / 触发门未过 / 抽奖未命中 / agent 失败 + 成功提交
|
|
290
|
+
idea)的终态在测试里用本地镜像断言检查,并在 `assistant-automations` 构建产物
|
|
291
|
+
存在时,额外用**真实** `HostAutomationExecutorRegistry.execute`(生产侧在
|
|
292
|
+
`host-executors.ts` 的 `validateHostExecutorResult` 校验)跑真实注册/执行路径;
|
|
293
|
+
镜像断言不是生产校验器,只为在无 sibling 构建时覆盖插件侧终态。
|
|
294
|
+
- 构造失败(例如 reconcile 被 Policy 拒绝)会回滚已注册 executor 与账本并抛错,
|
|
295
|
+
回归测试验证:失败后 registry 无残留 descriptor、下一次装载能成功(含真实
|
|
296
|
+
registry 的 duplicate-descriptor 断言)。
|
|
297
|
+
- 加载时按 `retentionDays` 清理过期 idea(先删事件再删 idea,事件外键不会让保留期
|
|
298
|
+
静默失效);`retire()` 暂停 automation 但保留账本;`retired: true` 加载为 paused
|
|
299
|
+
且不注册执行器。
|
|
300
|
+
- 状态收敛回归:retire 后重载恢复 active;**retired → resume → 再次 retired 必须
|
|
301
|
+
paused**;**reload 后调用 retire() 必须 paused**(paused reconcile key 也必须
|
|
302
|
+
每次加载唯一,否则旧 paused 收据会让行卡在 active 而插件已 dormant)。
|
|
303
|
+
|
|
304
|
+
完整真实模型长跑与真实通知发送留待运行验收;`test` 不访问网络、不调用真实模型。
|
package/cordis.patch.yml
ADDED
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
2
|
+
/**
|
|
3
|
+
* The dreaming plugin is opt-in and fail-closed: when disabled it registers no
|
|
4
|
+
* automation, opens no database and performs no work. Every bound below is an
|
|
5
|
+
* owner configuration value; model output can never supply paths, budgets or
|
|
6
|
+
* targets.
|
|
7
|
+
*/
|
|
8
|
+
export interface DreamingScopeConfig {
|
|
9
|
+
workspace: string;
|
|
10
|
+
preset: string;
|
|
11
|
+
principalId: string;
|
|
12
|
+
ownerRouteId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DreamingActiveHours {
|
|
15
|
+
timezone: string;
|
|
16
|
+
/** Minutes since local midnight; same-day window only, no midnight crossing. */
|
|
17
|
+
startMinute: number;
|
|
18
|
+
endMinute: number;
|
|
19
|
+
}
|
|
20
|
+
export interface DreamingConfig {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Owner pause switch: load in the paused state (reconcile the system
|
|
24
|
+
* automation to paused, register no executor) while keeping full config.
|
|
25
|
+
* Removing the flag on the next load resumes with a fresh reconcile nonce.
|
|
26
|
+
*/
|
|
27
|
+
retired?: boolean;
|
|
28
|
+
scope?: DreamingScopeConfig;
|
|
29
|
+
databasePath?: string;
|
|
30
|
+
baseIntervalMs?: number;
|
|
31
|
+
runProbabilityPpm?: number;
|
|
32
|
+
idleMinMs?: number;
|
|
33
|
+
activeHours?: DreamingActiveHours;
|
|
34
|
+
/** Optional owner-supplied HMAC seed; randomness stays deterministic. */
|
|
35
|
+
randomSeed?: string;
|
|
36
|
+
/** Half-width of the recall lottery's circular window around the draw. */
|
|
37
|
+
lotteryWindow?: number;
|
|
38
|
+
maxDreamsPerDay?: number;
|
|
39
|
+
maxIdeasPerWake?: number;
|
|
40
|
+
maxModelCalls?: number;
|
|
41
|
+
maxToolCalls?: number;
|
|
42
|
+
maxOutputTokens?: number;
|
|
43
|
+
maxDurationMs?: number;
|
|
44
|
+
maxInputBytes?: number;
|
|
45
|
+
maxEvidenceRefs?: number;
|
|
46
|
+
notifyOwner?: boolean;
|
|
47
|
+
maxNotificationsPerDay?: number;
|
|
48
|
+
notifyMinIntervalMs?: number;
|
|
49
|
+
budgetId?: string;
|
|
50
|
+
budgetAmount?: number;
|
|
51
|
+
provider?: string;
|
|
52
|
+
model?: string;
|
|
53
|
+
reasoningEffort?: string;
|
|
54
|
+
retentionDays?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface NormalizedDreamingConfig {
|
|
57
|
+
readonly enabled: boolean;
|
|
58
|
+
readonly retired: boolean;
|
|
59
|
+
readonly scope: DreamingScopeConfig | null;
|
|
60
|
+
readonly databasePath: string | null;
|
|
61
|
+
readonly baseIntervalMs: number;
|
|
62
|
+
readonly runProbabilityPpm: number;
|
|
63
|
+
readonly idleMinMs: number;
|
|
64
|
+
readonly lotteryWindow: number;
|
|
65
|
+
readonly activeHours: DreamingActiveHours | null;
|
|
66
|
+
readonly seedDigest: string | null;
|
|
67
|
+
readonly maxDreamsPerDay: number;
|
|
68
|
+
readonly maxIdeasPerWake: number;
|
|
69
|
+
readonly maxModelCalls: number;
|
|
70
|
+
readonly maxToolCalls: number;
|
|
71
|
+
readonly maxOutputTokens: number;
|
|
72
|
+
readonly maxDurationMs: number;
|
|
73
|
+
readonly maxInputBytes: number;
|
|
74
|
+
readonly maxEvidenceRefs: number;
|
|
75
|
+
readonly notifyOwner: boolean;
|
|
76
|
+
readonly maxNotificationsPerDay: number;
|
|
77
|
+
readonly notifyMinIntervalMs: number;
|
|
78
|
+
readonly budgetId: string | null;
|
|
79
|
+
readonly budgetAmount: number | null;
|
|
80
|
+
readonly provider: string | null;
|
|
81
|
+
readonly model: string | null;
|
|
82
|
+
readonly reasoningEffort: string | null;
|
|
83
|
+
readonly retentionDays: number;
|
|
84
|
+
}
|
|
85
|
+
export declare function hasCompleteDreamingPrerequisites(value: Partial<DreamingConfig> | undefined): boolean;
|
|
86
|
+
export declare const Config: Schema<DreamingConfig>;
|
|
87
|
+
export declare function normalizeConfig(input?: DreamingConfig): Readonly<NormalizedDreamingConfig>;
|
|
88
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAE7C;;;;;GAKG;AAEH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IAGrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,mBAAmB,CAAA;IACjC,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAA;IAGtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAA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Y,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;IACvC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAuED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,OAAO,CAapG;AAmBD,eAAO,MAAM,MAAM,EAGb,MAAM,CAAC,cAAc,CAAC,CAAA;AAE5B,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAC,wBAAwB,CAAC,CAiF1F"}
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
3
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
4
|
+
const fields = new Set([
|
|
5
|
+
'enabled', 'retired', 'scope', 'databasePath', 'baseIntervalMs', 'runProbabilityPpm', 'idleMinMs', 'lotteryWindow',
|
|
6
|
+
'activeHours', 'randomSeed', 'maxDreamsPerDay', 'maxIdeasPerWake', 'maxModelCalls', 'maxToolCalls',
|
|
7
|
+
'maxOutputTokens', 'maxDurationMs', 'maxInputBytes', 'maxEvidenceRefs', 'notifyOwner',
|
|
8
|
+
'maxNotificationsPerDay', 'notifyMinIntervalMs', 'budgetId', 'budgetAmount', 'provider', 'model',
|
|
9
|
+
'reasoningEffort', 'retentionDays',
|
|
10
|
+
]);
|
|
11
|
+
const BOUNDED_TEXT_PATTERN = /^[^\s\p{Cc}](?:[^\p{Cc}]*[^\s\p{Cc}])?$/u;
|
|
12
|
+
const boundedText = (max) => Schema.string().min(1).max(max).pattern(BOUNDED_TEXT_PATTERN);
|
|
13
|
+
const scopeSchema = Schema.object({
|
|
14
|
+
workspace: boundedText(4_096).required(),
|
|
15
|
+
preset: boundedText(256).required(),
|
|
16
|
+
principalId: boundedText(256).required(),
|
|
17
|
+
ownerRouteId: boundedText(256).required(),
|
|
18
|
+
}).default(undefined);
|
|
19
|
+
const activeHoursSchema = Schema.object({
|
|
20
|
+
timezone: boundedText(128).required(),
|
|
21
|
+
startMinute: Schema.natural().min(0).max(1_439).required(),
|
|
22
|
+
endMinute: Schema.natural().min(1).max(1_440).required(),
|
|
23
|
+
}).default(undefined);
|
|
24
|
+
const schema = Schema.object({
|
|
25
|
+
enabled: Schema.boolean().default(false),
|
|
26
|
+
retired: Schema.boolean().default(false),
|
|
27
|
+
scope: scopeSchema,
|
|
28
|
+
databasePath: boundedText(4_096),
|
|
29
|
+
baseIntervalMs: Schema.natural().min(900_000).max(86_400_000).default(3_600_000),
|
|
30
|
+
runProbabilityPpm: Schema.natural().min(0).max(1_000_000).default(250_000),
|
|
31
|
+
idleMinMs: Schema.natural().min(300_000).max(86_400_000).default(1_800_000),
|
|
32
|
+
lotteryWindow: Schema.natural().min(0).max(500_000).default(5_000),
|
|
33
|
+
activeHours: activeHoursSchema,
|
|
34
|
+
randomSeed: Schema.string().min(16).max(256),
|
|
35
|
+
maxDreamsPerDay: Schema.natural().min(1).max(24).default(3),
|
|
36
|
+
maxIdeasPerWake: Schema.natural().min(1).max(5).default(3),
|
|
37
|
+
maxModelCalls: Schema.natural().min(1).max(8).default(2),
|
|
38
|
+
maxToolCalls: Schema.natural().min(0).max(8).default(1),
|
|
39
|
+
maxOutputTokens: Schema.natural().min(1).max(4_096).default(2_048),
|
|
40
|
+
maxDurationMs: Schema.natural().min(1_000).max(300_000).default(90_000),
|
|
41
|
+
maxInputBytes: Schema.natural().min(1_024).max(65_536).default(16_384),
|
|
42
|
+
maxEvidenceRefs: Schema.natural().min(1).max(16).default(8),
|
|
43
|
+
notifyOwner: Schema.boolean().default(false),
|
|
44
|
+
maxNotificationsPerDay: Schema.natural().min(0).max(3).default(1),
|
|
45
|
+
notifyMinIntervalMs: Schema.natural().min(60_000).max(604_800_000).default(86_400_000),
|
|
46
|
+
budgetId: boundedText(128),
|
|
47
|
+
// Automations bounds the per-run budget amount to 10,000,000; reject larger
|
|
48
|
+
// values here instead of failing later while reconciling the definition.
|
|
49
|
+
budgetAmount: Schema.natural().min(1).max(10_000_000),
|
|
50
|
+
provider: boundedText(256),
|
|
51
|
+
model: boundedText(256),
|
|
52
|
+
reasoningEffort: boundedText(128),
|
|
53
|
+
retentionDays: Schema.natural().min(1).max(365).default(90),
|
|
54
|
+
}).default(undefined);
|
|
55
|
+
function isNonEmptyString(value) {
|
|
56
|
+
return typeof value === 'string' && BOUNDED_TEXT_PATTERN.test(value);
|
|
57
|
+
}
|
|
58
|
+
function isCanonicalAbsolutePath(value) {
|
|
59
|
+
return isNonEmptyString(value) && isAbsolute(value) && resolve(value) === value;
|
|
60
|
+
}
|
|
61
|
+
export function hasCompleteDreamingPrerequisites(value) {
|
|
62
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
63
|
+
return false;
|
|
64
|
+
const scope = value.scope;
|
|
65
|
+
if (!scope || typeof scope !== 'object' || Array.isArray(scope))
|
|
66
|
+
return false;
|
|
67
|
+
if (!isCanonicalAbsolutePath(scope.workspace)
|
|
68
|
+
|| !isNonEmptyString(scope.preset)
|
|
69
|
+
|| !isNonEmptyString(scope.principalId)
|
|
70
|
+
|| !isNonEmptyString(scope.ownerRouteId))
|
|
71
|
+
return false;
|
|
72
|
+
if (!isCanonicalAbsolutePath(value.databasePath))
|
|
73
|
+
return false;
|
|
74
|
+
if (!isNonEmptyString(value.provider) || !isNonEmptyString(value.model))
|
|
75
|
+
return false;
|
|
76
|
+
if (!isNonEmptyString(value.budgetId))
|
|
77
|
+
return false;
|
|
78
|
+
if (!Number.isSafeInteger(value.budgetAmount) || value.budgetAmount < 1 || value.budgetAmount > 10_000_000)
|
|
79
|
+
return false;
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
function parseDreamingConfigInput(value) {
|
|
83
|
+
if (value !== undefined && (value === null || typeof value !== 'object' || Array.isArray(value))) {
|
|
84
|
+
throw new Error('assistant-dreaming: config must be an object');
|
|
85
|
+
}
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
for (const key of Object.keys(value)) {
|
|
88
|
+
if (!fields.has(key))
|
|
89
|
+
throw new Error(`assistant-dreaming: unknown config field: ${key}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const rawEnabled = value !== undefined ? value.enabled : undefined;
|
|
93
|
+
const parsed = schema(value);
|
|
94
|
+
if (parsed && rawEnabled === undefined && parsed.retired !== true && hasCompleteDreamingPrerequisites(parsed)) {
|
|
95
|
+
return { ...parsed, enabled: true };
|
|
96
|
+
}
|
|
97
|
+
return parsed;
|
|
98
|
+
}
|
|
99
|
+
export const Config = Schema.transform(Schema.any(), (value, options) => {
|
|
100
|
+
try {
|
|
101
|
+
return parseDreamingConfigInput(value);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
throw new Schema.ValidationError(error instanceof Error ? error.message : String(error), options ?? { path: [] });
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
export function normalizeConfig(input) {
|
|
108
|
+
const rawEnabled = input && typeof input === 'object' && !Array.isArray(input) ? input.enabled : undefined;
|
|
109
|
+
const config = (Config(input) ?? {});
|
|
110
|
+
const enabled = rawEnabled ?? (config.retired !== true && hasCompleteDreamingPrerequisites(config));
|
|
111
|
+
const normalized = Object.freeze({
|
|
112
|
+
enabled,
|
|
113
|
+
retired: config.retired ?? false,
|
|
114
|
+
scope: config.scope ? Object.freeze({ ...config.scope }) : null,
|
|
115
|
+
databasePath: config.databasePath ?? null,
|
|
116
|
+
baseIntervalMs: config.baseIntervalMs ?? 3_600_000,
|
|
117
|
+
runProbabilityPpm: config.runProbabilityPpm ?? 250_000,
|
|
118
|
+
idleMinMs: config.idleMinMs ?? 1_800_000,
|
|
119
|
+
lotteryWindow: config.lotteryWindow ?? 5_000,
|
|
120
|
+
activeHours: config.activeHours ? Object.freeze({ ...config.activeHours }) : null,
|
|
121
|
+
seedDigest: config.randomSeed === undefined
|
|
122
|
+
? null : createHash('sha256').update(config.randomSeed).digest('hex'),
|
|
123
|
+
maxDreamsPerDay: config.maxDreamsPerDay ?? 3,
|
|
124
|
+
maxIdeasPerWake: config.maxIdeasPerWake ?? 3,
|
|
125
|
+
maxModelCalls: config.maxModelCalls ?? 2,
|
|
126
|
+
maxToolCalls: config.maxToolCalls ?? 1,
|
|
127
|
+
maxOutputTokens: config.maxOutputTokens ?? 2_048,
|
|
128
|
+
maxDurationMs: config.maxDurationMs ?? 90_000,
|
|
129
|
+
maxInputBytes: config.maxInputBytes ?? 16_384,
|
|
130
|
+
maxEvidenceRefs: config.maxEvidenceRefs ?? 8,
|
|
131
|
+
notifyOwner: config.notifyOwner ?? false,
|
|
132
|
+
maxNotificationsPerDay: config.maxNotificationsPerDay ?? 1,
|
|
133
|
+
notifyMinIntervalMs: config.notifyMinIntervalMs ?? 86_400_000,
|
|
134
|
+
budgetId: config.budgetId ?? null,
|
|
135
|
+
budgetAmount: config.budgetAmount ?? null,
|
|
136
|
+
provider: config.provider ?? null,
|
|
137
|
+
model: config.model ?? null,
|
|
138
|
+
reasoningEffort: config.reasoningEffort ?? null,
|
|
139
|
+
retentionDays: config.retentionDays ?? 90,
|
|
140
|
+
});
|
|
141
|
+
if (normalized.enabled) {
|
|
142
|
+
if (!normalized.scope)
|
|
143
|
+
throw new Error('assistant-dreaming: enabled requires an explicit owner scope');
|
|
144
|
+
if (!isNonEmptyString(normalized.scope.preset)
|
|
145
|
+
|| !isNonEmptyString(normalized.scope.principalId)
|
|
146
|
+
|| !isNonEmptyString(normalized.scope.ownerRouteId)) {
|
|
147
|
+
throw new Error('assistant-dreaming: enabled requires explicit scope.preset, scope.principalId and scope.ownerRouteId');
|
|
148
|
+
}
|
|
149
|
+
// The frozen workspace becomes an Automations definition field, so it must
|
|
150
|
+
// already be the canonical absolute path that definition normalization
|
|
151
|
+
// accepts; reject it at load time instead of failing reconciliation later.
|
|
152
|
+
if (!isAbsolute(normalized.scope.workspace) || resolve(normalized.scope.workspace) !== normalized.scope.workspace) {
|
|
153
|
+
throw new Error('assistant-dreaming: enabled requires a canonical absolute scope.workspace');
|
|
154
|
+
}
|
|
155
|
+
if (normalized.databasePath === null || !isAbsolute(normalized.databasePath)
|
|
156
|
+
|| resolve(normalized.databasePath) !== normalized.databasePath) {
|
|
157
|
+
throw new Error('assistant-dreaming: enabled requires a canonical absolute databasePath');
|
|
158
|
+
}
|
|
159
|
+
if (!isNonEmptyString(normalized.provider) || !isNonEmptyString(normalized.model)) {
|
|
160
|
+
throw new Error('assistant-dreaming: enabled requires an explicit provider and model');
|
|
161
|
+
}
|
|
162
|
+
if (!isNonEmptyString(normalized.budgetId) || normalized.budgetAmount === null) {
|
|
163
|
+
throw new Error('assistant-dreaming: enabled requires a budgetId and budgetAmount pair');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if ((normalized.provider === null) !== (normalized.model === null)) {
|
|
167
|
+
throw new Error('assistant-dreaming: provider and model must be configured together');
|
|
168
|
+
}
|
|
169
|
+
if (normalized.reasoningEffort !== null && normalized.provider === null) {
|
|
170
|
+
throw new Error('assistant-dreaming: reasoningEffort requires an explicit provider and model');
|
|
171
|
+
}
|
|
172
|
+
if ((normalized.budgetId === null) !== (normalized.budgetAmount === null)) {
|
|
173
|
+
throw new Error('assistant-dreaming: budgetId and budgetAmount must be configured together');
|
|
174
|
+
}
|
|
175
|
+
if (normalized.activeHours && normalized.activeHours.startMinute >= normalized.activeHours.endMinute) {
|
|
176
|
+
throw new Error('assistant-dreaming: activeHours must be a same-day window with startMinute < endMinute');
|
|
177
|
+
}
|
|
178
|
+
if (normalized.maxNotificationsPerDay > normalized.maxDreamsPerDay) {
|
|
179
|
+
throw new Error('assistant-dreaming: maxNotificationsPerDay cannot exceed maxDreamsPerDay');
|
|
180
|
+
}
|
|
181
|
+
// `retired` only pauses through the enabled loading path (it reconciles the
|
|
182
|
+
// existing system automation to paused). A disabled row returns before that
|
|
183
|
+
// point and cannot pause anything, so accepting the combination would
|
|
184
|
+
// silently leave a previously active automation running. Fail closed instead.
|
|
185
|
+
if (normalized.retired && !normalized.enabled) {
|
|
186
|
+
throw new Error('assistant-dreaming: retired requires enabled: true; pause the enabled row first, then remove retired before disabling');
|
|
187
|
+
}
|
|
188
|
+
return normalized;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAmG7C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,eAAe;IAClH,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc;IAClG,i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