dsh-ta 0.3.0 → 0.4.1

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +160 -107
  3. package/cordis.patch.yml +5 -35
  4. package/docs/RELEASE.md +62 -49
  5. package/docs/USAGE.md +6 -7
  6. package/docs/presets.example.yml +7 -43
  7. package/index.js +3 -164
  8. package/package.json +5 -28
  9. package/src/client/client.js +3176 -0
  10. package/{config.js → src/host/config.js} +39 -3
  11. package/src/host/constants.js +7 -0
  12. package/src/host/gates.js +34 -0
  13. package/src/host/identity.js +145 -0
  14. package/{im → src/host/im}/bindings.js +1 -1
  15. package/src/host/index.js +173 -0
  16. package/{jurisdiction.js → src/host/jurisdiction.js} +1 -1
  17. package/src/host/maintenance/collect.js +362 -0
  18. package/src/host/maintenance/completions.js +56 -0
  19. package/src/host/maintenance/consumption.js +67 -0
  20. package/src/host/maintenance/cursors.js +53 -0
  21. package/src/host/maintenance/engine.js +392 -0
  22. package/src/host/maintenance/llm.js +381 -0
  23. package/src/host/maintenance/lock.js +105 -0
  24. package/src/host/maintenance/prompts.js +255 -0
  25. package/src/host/maintenance/runs.js +47 -0
  26. package/src/host/maintenance/schedule.js +173 -0
  27. package/src/host/maintenance/session-cleanup.js +289 -0
  28. package/src/host/maintenance/session-watcher.js +107 -0
  29. package/src/host/maintenance/sleep.js +3 -0
  30. package/src/host/maintenance/stages.js +241 -0
  31. package/src/host/maintenance/state.js +192 -0
  32. package/src/host/prompts.js +96 -0
  33. package/src/host/records.js +175 -0
  34. package/src/host/runtime-manager.js +287 -0
  35. package/{runtime.js → src/host/runtime.js} +6 -8
  36. package/src/host/settings/defaults.js +55 -0
  37. package/{settings → src/host/settings}/home.js +4 -3
  38. package/{settings/routes.js → src/host/settings/http.js} +5 -137
  39. package/{settings → src/host/settings}/im.js +18 -1
  40. package/{settings → src/host/settings}/lifecycle.js +29 -43
  41. package/src/host/settings/persona.js +113 -0
  42. package/src/host/settings/routes.js +229 -0
  43. package/{settings → src/host/settings}/status.js +70 -42
  44. package/src/host/state/appraisals.js +56 -0
  45. package/src/host/state/feel.js +78 -0
  46. package/src/host/state/index.js +9 -0
  47. package/src/host/state/mood.js +103 -0
  48. package/src/host/state/notes.js +18 -0
  49. package/{life.js → src/host/state/outing.js} +13 -136
  50. package/src/host/state/values.js +9 -0
  51. package/{stickers → src/host/stickers}/tool.js +1 -1
  52. package/src/host/storage/fs.js +29 -0
  53. package/src/host/storage/index.js +8 -0
  54. package/src/host/storage/paths.js +20 -0
  55. package/src/host/storage/revision.js +5 -0
  56. package/src/host/storage/session-state.js +38 -0
  57. package/src/host/storage/time.js +127 -0
  58. package/src/host/tools/index.js +152 -0
  59. package/src/host/tools/read.js +252 -0
  60. package/src/host/tools/shared.js +23 -0
  61. package/src/host/tools/wiki.js +35 -0
  62. package/src/host/tools/write.js +164 -0
  63. package/{usage → src/host/usage}/aggregate.js +4 -1
  64. package/{usage → src/host/usage}/ledger.js +47 -21
  65. package/client.js +0 -2554
  66. package/gates.js +0 -18
  67. package/identity.js +0 -97
  68. package/prompts.js +0 -28
  69. package/runtime-manager.js +0 -153
  70. package/settings/defaults.js +0 -41
  71. package/settings/persona.js +0 -203
  72. package/settings/schedule.js +0 -156
  73. package/storage.js +0 -122
  74. package/tools.js +0 -540
  75. /package/{im → src/host/im}/say.js +0 -0
  76. /package/{memory → src/host/memory}/capture.js +0 -0
  77. /package/{memory → src/host/memory}/messages.js +0 -0
  78. /package/{memory → src/host/memory}/outbox.js +0 -0
  79. /package/{reme.js → src/host/reme.js} +0 -0
  80. /package/{settings → src/host/settings}/errors.js +0 -0
  81. /package/{stickers → src/host/stickers}/load.js +0 -0
  82. /package/{stickers → src/host/stickers}/select.js +0 -0
  83. /package/{stickers → src/host/stickers}/serve.js +0 -0
  84. /package/{usage → src/host/usage}/pricing.js +0 -0
  85. /package/{usage → src/host/usage}/serve.js +0 -0
package/cordis.patch.yml CHANGED
@@ -6,7 +6,6 @@
6
6
  remeEndpoint: http://127.0.0.1:2333
7
7
  presets:
8
8
  - ta
9
- - ta-review
10
9
  permissionPreset: read-only
11
10
  captureEnabled: true
12
11
  captureInterval: 5
@@ -60,42 +59,13 @@
60
59
  name: "@deepseek-ai/dsh-command-compact"
61
60
  - id: tool-result-pruner
62
61
  name: "@deepseek-ai/dsh-compaction-tool-result-pruner"
63
-
64
- - id: preset-ta-review
62
+ - id: preset-ta-maintenance
65
63
  name: "@deepseek-ai/dsh-agent-preset"
66
64
  config:
67
- id: ta-review
68
- name: "TA Review"
69
- description: "Nightly review preset. Read-only files and controlled review write tools."
70
- order: 10
65
+ id: ta-maintenance
66
+ name: "TA Maintenance"
67
+ description: "Thin trigger preset: one deterministic maintenance tool, no file or shell access."
68
+ order: 11
71
69
  plugins:
72
70
  - id: time-context
73
71
  name: "@deepseek-ai/dsh-time-context"
74
- - id: agent-instructions
75
- name: "@deepseek-ai/dsh-agent-instructions"
76
- config:
77
- maxBytes: 65536
78
- - id: tool-fs
79
- name: "@deepseek-ai/dsh-tool-fs"
80
- config:
81
- read: true
82
- readImage: true
83
- write: false
84
- edit: false
85
- - id: tool-fs-search
86
- name: "@deepseek-ai/dsh-tool-fs-search"
87
- config:
88
- sampleOverCapGlobResults: false
89
- - id: compaction
90
- name: cordis:group
91
- group: true
92
- isolate:
93
- compaction: true
94
- toolResultPruner: true
95
- config:
96
- - id: compaction-basic
97
- name: "@deepseek-ai/dsh-compaction-basic"
98
- - id: command-compact
99
- name: "@deepseek-ai/dsh-command-compact"
100
- - id: tool-result-pruner
101
- name: "@deepseek-ai/dsh-compaction-tool-result-pruner"
package/docs/RELEASE.md CHANGED
@@ -1,8 +1,10 @@
1
- # Release
1
+ # 发布
2
2
 
3
- This package is plain JavaScript. A release is a versioned npm package and a matching Git tag.
3
+ 本包是纯 JavaScript,发布就是版本化的 npm 包加对应的 Git tag。
4
4
 
5
- ## 1. Prepare
5
+ 0.4 结构重整后,包入口是根 `index.js`(薄壳),Host 实现位于 `src/host/`,设置页客户端是单文件 `src/client/client.js`(`package.json` 的 `exports["./client"]` 指向它)。
6
+
7
+ ## 1. 准备
6
8
 
7
9
  ```bash
8
10
  npm ci
@@ -11,82 +13,93 @@ npm run check
11
13
  npm pack --dry-run
12
14
  ```
13
15
 
14
- `npm test` currently runs 161 tests (2026-12-04). Confirm the current count
15
- from the output before release rather than copying this number into release notes.
16
+ 发布前完整跑一遍:
17
+
18
+ ```bash
19
+ npm test && npm run check && npm pack --dry-run
20
+ ```
21
+
22
+ 测试数量以 `npm test` 输出为准(2026-12-04 本机为 259 项通过)。不要直接把本文档里的数字抄进发布说明。
16
23
 
17
- `npm run check` verifies:
24
+ 发布前还要确认 CI 工作流的语法检查路径已指向当前文件布局(`index.js`、`src/client/client.js`),不要继续检查已删除的根 `client.js`。
18
25
 
19
- - package metadata and license
20
- - `dsh.bundle` / web client manifest
21
- - required public files
22
- - no local absolute paths in shipped documentation or configuration
26
+ `npm run check` 验证:
23
27
 
24
- ## 2. Version and changelog
28
+ - package 元数据与 license
29
+ - `dsh.bundle` 与 web client manifest
30
+ - 必需的发布文件
31
+ - 发布的文档与配置中没有本机绝对路径
25
32
 
26
- 1. Update `package.json` `version`.
27
- 2. Add the same version to `CHANGELOG.md`.
28
- 3. Commit the changes.
33
+ 另外确认 `npm pack --dry-run` 的文件列表里包含:
29
34
 
30
- Use semantic versioning:
35
+ - `index.js`(根入口薄壳:`export * from './src/host/index.js'`)
36
+ - `src/host/`(Host 实现:storage/、state/、tools/、maintenance/、settings/、usage/ 等)
37
+ - `src/client/client.js`(设置页客户端;DSH 客户端插件只加载这一个文件)
38
+ - `cordis.patch.yml`(bundle patch:`dsh-ta` 插件行 + `ta` preset)
31
39
 
32
- - `0.x.y` while the public surface is still moving
33
- - `x.y.z` once the settings/config surface is stable
40
+ ## 2. 版本与 changelog
34
41
 
35
- ## 3. Tag and publish
42
+ 1. 更新 `package.json` 的 `version`。
43
+ 2. 在 `CHANGELOG.md` 顶部加同版本条目。
44
+ 3. 提交改动。
45
+
46
+ 语义化版本:
47
+
48
+ - `0.x.y`:公开接口仍在变化
49
+ - `x.y.z`:设置/配置接口稳定后
50
+
51
+ ## 3. 打 tag 与发布
36
52
 
37
53
  ```bash
38
- git tag v0.3.0
39
- git push origin v0.3.0
54
+ git tag v0.4.1
55
+ git push origin v0.4.1
40
56
  ```
41
57
 
42
- `.github/workflows/publish.yml` runs on `v*` tags:
58
+ `.github/workflows/publish.yml` 在 `v*` tag 上运行:
43
59
 
44
- 1. checks that the tag equals `package.json.version`
45
- 2. skips a version already present on npm
46
- 3. installs dependencies, runs tests and release checks
47
- 4. publishes with npm trusted publishing (OIDC)
60
+ 1. 校验 tag 与 `package.json.version` 一致
61
+ 2. 跳过 npm 上已存在的版本
62
+ 3. 安装依赖、跑测试与发布检查
63
+ 4. 通过 npm trusted publishing(OIDC)发布
48
64
 
49
- Prereleases such as `0.2.0-beta.1` publish under the `next` dist-tag. Stable
50
- versions publish under `latest`.
65
+ 预发布版本(如 `0.4.1-beta.1`)发布到 `next` dist-tag,正式版本发布到 `latest`。
51
66
 
52
- No `NPM_TOKEN` is stored in the repository by default. The workflow supports
53
- two authentication paths:
67
+ 仓库默认不保存长期 `NPM_TOKEN`。工作流支持两种认证方式:
54
68
 
55
- - **Trusted publishing (recommended after the first publish):** configure the
56
- npm package's trusted publisher for this GitHub repository and workflow.
57
- The workflow uses OIDC; no long-lived token is needed.
58
- - **First publish by tag:** add a repository secret named `NPM_TOKEN` with an
59
- npm granular/automation token that can publish `dsh-ta`. The publish step
60
- exports it as `NODE_AUTH_TOKEN` for that run only.
69
+ - **Trusted publishing(首次发布后推荐)**:在 npm 包上配置本 GitHub 仓库与 workflow 的 trusted publisher,工作流使用 OIDC,不需要长期 token。
70
+ - **首次 tag 发布**:在仓库添加名为 `NPM_TOKEN` 的 secret,填入能发布 `dsh-ta` 的 npm granular/automation token;发布步骤只在本次运行中把它导出为 `NODE_AUTH_TOKEN`。
61
71
 
62
- npm trusted publishing can only be configured for a package that already
63
- exists, so the first release usually needs either one manual `npm publish`
64
- after `npm login`, or the `NPM_TOKEN` secret for the tag workflow. Later
65
- releases can use OIDC trusted publishing.
72
+ npm trusted publishing 只能为已经存在的包配置,所以首次发布通常需要二选一:`npm login` 后手动 `npm publish`,或用 `NPM_TOKEN` secret 走 tag 工作流。之后的版本可以改用 OIDC trusted publishing。
66
73
 
67
- ## 4. After publish
74
+ ## 4. 发布后
68
75
 
69
- Verify:
76
+ 验证:
70
77
 
71
78
  ```bash
72
- npm view dsh-ta@0.3.0 version
79
+ npm view dsh-ta@0.4.1 version
73
80
  ```
74
81
 
75
- Install the published version in a clean DSH profile:
82
+ 在干净的 DSH profile 里安装发布版本:
76
83
 
77
84
  ```bash
78
85
  dsh plugin --profile <profile> add dsh-ta
79
86
  ```
80
87
 
81
- Then open **Settings → TA 的家** and confirm the panel can read and save the
82
- config, and that the status, persona and connection cards load.
88
+ 然后打开 **设置 → TA 的家**,确认:
89
+
90
+ - 配置能读写并即时生效;
91
+ - 状态页能显示四件套状态、维护状态与最近运行;
92
+ - 人设页只编辑 SOUL 与称呼;
93
+ - SOUL 建议队列按预期出现。
94
+
95
+ 0.4 的维护由插件内定时器直调模型,不创建会话;发布后确认 23:00 触发、`state/runs.jsonl` 与状态页显示一致。
83
96
 
84
- ## Rollback
97
+ ## 回滚
85
98
 
86
- Never republish the same version. If a release is broken:
99
+ 不要重复发布同一个版本。发布坏了:
87
100
 
88
101
  ```bash
89
- npm deprecate dsh-ta@0.3.0 "use 0.3.1"
102
+ npm deprecate dsh-ta@0.4.0 "use 0.4.1"
90
103
  ```
91
104
 
92
- Publish a fixed patch version instead.
105
+ 然后发布修复后的 patch 版本。
package/docs/USAGE.md CHANGED
@@ -6,11 +6,10 @@ dsh-TA 记录 **DSH 内的 Ta agent 花销**,用于查看累计用量、估算
6
6
 
7
7
  ## 计入范围
8
8
 
9
- - 日常聊天(Web / 飞书)
10
- - 23:00 回顾
11
- - 22:45 辖区外出
12
- - 心跳 life 会话
13
- - 其他以 `ta` / `ta-review` 运行的 DSH 会话
9
+ - 日常聊天(Web / 飞书,`category: chat`)
10
+ - 插件内每日维护的直调模型调用(`category: maintenance`)
11
+ - 22:45 辖区外出(`category: outing`)
12
+ - 心跳 life 会话(`category: heartbeat`)
14
13
 
15
14
  ## 不计入
16
15
 
@@ -37,11 +36,11 @@ $TA_HOME/state/usage/
37
36
  - 价格表版本
38
37
  - 估算 CNY
39
38
 
40
- 相同 `session:turn` 在汇总时只计一次;正常事件流不会重复写入。
39
+ 维护的同一 run 会发多次模型请求,用 `callId` 区分,不会被当成重复记录合并;没有 `callId` 的记录按 `session:turn` 去重。
41
40
 
42
41
  ## 价格
43
42
 
44
- 默认价格表在 `usage/pricing.js`,单位是 **CNY / 百万 token**,只是估算。
43
+ 默认价格表在 `src/host/usage/pricing.js`,单位是 **CNY / 百万 token**,只是估算。
45
44
 
46
45
  用户可覆盖:
47
46
 
@@ -1,11 +1,14 @@
1
- # Example Agent presets for dsh-ta.
1
+ # Example Agent preset for dsh-ta 0.4.
2
2
  #
3
- # Add these rows to the `insert:` list in your DSH profile patch
3
+ # Add this row to the `insert:` list in your DSH profile patch
4
4
  # (~/.dsh/profiles/<profile>/cordis.patch.yml). If you already have other
5
- # insert rows, append these entries to the same list.
5
+ # insert rows, append this entry to the same list.
6
6
  #
7
- # The dsh-ta bundle registers its own tools; these presets define the host
7
+ # The dsh-ta bundle registers its own tools; this preset defines the host
8
8
  # tool surface that the adapter gates and extends.
9
+ #
10
+ # 0.4 的维护由插件内定时器在 23:00 直调模型,不创建会话,
11
+ # 因此只需要 ta 这一个 preset。
9
12
 
10
13
  - insert:
11
14
  - id: preset-ta
@@ -54,42 +57,3 @@
54
57
  name: "@deepseek-ai/dsh-command-compact"
55
58
  - id: tool-result-pruner
56
59
  name: "@deepseek-ai/dsh-compaction-tool-result-pruner"
57
-
58
- - id: preset-ta-review
59
- name: "@deepseek-ai/dsh-agent-preset"
60
- config:
61
- id: ta-review
62
- name: "TA Review"
63
- description: "Nightly review preset. Read-only files and controlled review write tools."
64
- order: 10
65
- plugins:
66
- - id: time-context
67
- name: "@deepseek-ai/dsh-time-context"
68
- - id: agent-instructions
69
- name: "@deepseek-ai/dsh-agent-instructions"
70
- config:
71
- maxBytes: 65536
72
- - id: tool-fs
73
- name: "@deepseek-ai/dsh-tool-fs"
74
- config:
75
- read: true
76
- readImage: true
77
- write: false
78
- edit: false
79
- - id: tool-fs-search
80
- name: "@deepseek-ai/dsh-tool-fs-search"
81
- config:
82
- sampleOverCapGlobResults: false
83
- - id: compaction
84
- name: cordis:group
85
- group: true
86
- isolate:
87
- compaction: true
88
- toolResultPruner: true
89
- config:
90
- - id: compaction-basic
91
- name: "@deepseek-ai/dsh-compaction-basic"
92
- - id: command-compact
93
- name: "@deepseek-ai/dsh-command-compact"
94
- - id: tool-result-pruner
95
- name: "@deepseek-ai/dsh-compaction-tool-result-pruner"
package/index.js CHANGED
@@ -1,166 +1,5 @@
1
1
  /**
2
- * dsh-ta: Ta's DSH adapter.
3
- *
4
- * Host half: identity, gates, capture, review, outings, jurisdiction reads,
5
- * settings/lifecycle API, and the settings surface shared with the client half.
2
+ * dsh-TA 插件入口薄壳:实现都在 src/host。
3
+ * 保留这个文件是为了让包入口、profile patch 与旧引用路径保持稳定。
6
4
  */
7
-
8
- import { existsSync } from 'node:fs'
9
- import { disposeAgent, releaseReviewForSession, syncAgent } from './tools.js'
10
- import { moodLine } from './life.js'
11
- import { identityText } from './identity.js'
12
- import { normalizeConfig } from './config.js'
13
- import { isTaSession } from './gates.js'
14
- import { ensureReviewSchedule } from './settings/schedule.js'
15
- import { createLifecycleQueue } from './settings/lifecycle.js'
16
- import { mountSettingsRoutes } from './settings/routes.js'
17
- import { RuntimeManager } from './runtime-manager.js'
18
- import { MEMORY_GUIDANCE } from './prompts.js'
19
- import { UsageLedger } from './usage/ledger.js'
20
- import { mountStickerRoute } from './stickers/serve.js'
21
- import { mountUsageRoute } from './usage/serve.js'
22
- import { stickerGuidance } from './stickers/select.js'
23
-
24
- export { Config, normalizeConfig } from './config.js'
25
- export { realPath, todayText, withinHome, writeAtomic } from './storage.js'
26
- export { isTaSession } from './gates.js'
27
- export { identityText } from './identity.js'
28
- export { readJurisdictionSession, recentConversations, recentJurisdiction, visitJurisdiction } from './jurisdiction.js'
29
- export { addNote, cleanupOutings, finishOuting, moodLine, readMood, setMood, startOuting } from './life.js'
30
- export { aggregateUsage, usageCsv } from './usage/aggregate.js'
31
- export { ensureHome, readHomeMarker } from './settings/home.js'
32
- export { readPersona, writePersona, writePersonaField } from './settings/persona.js'
33
- export { readStatus } from './settings/status.js'
34
- export { readImState } from './settings/im.js'
35
- export { initializeHome, reincarnate } from './settings/lifecycle.js'
36
- export { RuntimeManager } from './runtime-manager.js'
37
-
38
- export const name = 'dsh-ta'
39
- export const inject = ['systemPrompt', 'agentPresets', 'agents']
40
-
41
- export function apply(ctx, input = {}) {
42
- const config = normalizeConfig(input)
43
-
44
- if (typeof ctx.inject === 'function') {
45
- ctx.inject(['settings'], (settingsCtx) => {
46
- const settings = settingsCtx.get?.('settings')
47
- if (typeof settings?.configure !== 'function') return
48
- try {
49
- ctx.effect(
50
- () => settings.configure({ auto: false }, ctx.fiber),
51
- 'dsh-ta settings presentation',
52
- )
53
- } catch {
54
- /* settings is optional */
55
- }
56
- })
57
- }
58
-
59
- ctx.systemPrompt.section({
60
- name: 'ta-identity',
61
- order: 10,
62
- interpolate: false,
63
- text: (context) => identityText(ctx, context?.session, config),
64
- })
65
-
66
- ctx.systemPrompt.section({
67
- name: 'ta-memory-guidance',
68
- order: 20,
69
- interpolate: false,
70
- text: (context) => isTaSession(ctx, context?.session, config) ? MEMORY_GUIDANCE : '',
71
- })
72
-
73
- ctx.systemPrompt.section({
74
- name: 'ta-sticker-guidance',
75
- order: 35,
76
- interpolate: false,
77
- text: (context) => {
78
- if (!isTaSession(ctx, context?.session, config)) return ''
79
- let preset
80
- try {
81
- preset = ctx.agentPresets?.presetForSession?.(context.session)
82
- } catch {
83
- preset = undefined
84
- }
85
- return preset === 'ta' ? stickerGuidance(config) : ''
86
- },
87
- })
88
-
89
- ctx.systemPrompt.section({
90
- name: 'ta-mood',
91
- order: 30,
92
- interpolate: false,
93
- text: (context) => isTaSession(ctx, context?.session, config) ? moodLine(config) : '',
94
- })
95
-
96
- ctx.on('agent/created', ({ agent }) => {
97
- try { syncAgent(ctx, agent, config) } catch { /* never fail the host for an adapter */ }
98
- })
99
-
100
- ctx.on('agent-preset/selected', (sessionId) => {
101
- try {
102
- const agent = ctx.agents.get(sessionId)
103
- if (agent) syncAgent(ctx, agent, config)
104
- } catch { /* never fail the host for an adapter */ }
105
- })
106
-
107
- ctx.on('agent/disposed', ({ agent }) => {
108
- disposeAgent(config, agent)
109
- })
110
-
111
- ctx.on('session/event', (session, event) => {
112
- if (event.type === 'turn/end') releaseReviewForSession(config, session)
113
- })
114
-
115
- // Runtime owns Capture, Outbox and every timer that is bound to TA_HOME. A
116
- // lifecycle operation stops it, changes the config, then starts a new one.
117
- const runtime = new RuntimeManager({ ctx, config, logger: ctx.logger })
118
- try { runtime.start() } catch { /* identity/tools must still load */ }
119
- ctx.on('session/event', (session, event) => {
120
- try { runtime.handle(session, event) } catch { /* adapter diagnostics must not stop sessions */ }
121
- })
122
- ctx.on('session/disposed', session => {
123
- try { runtime.handleDispose(session) } catch { /* noop */ }
124
- })
125
- if (typeof ctx.effect === 'function') {
126
- try {
127
- ctx.effect(() => () => runtime.stop(), 'dsh-ta runtime')
128
- } catch {
129
- /* runtime still works until process exit */
130
- }
131
- }
132
-
133
- const host = {
134
- ctx,
135
- config,
136
- runtime,
137
- lifecycle: { operation: null },
138
- queue: createLifecycleQueue(),
139
- logger: ctx.logger,
140
- }
141
- try { mountSettingsRoutes(ctx, config, host) } catch { /* settings API optional */ }
142
-
143
- try { mountStickerRoute(ctx, config) } catch { /* sticker route optional */ }
144
- try { mountUsageRoute(ctx, config) } catch { /* usage route optional */ }
145
-
146
- try {
147
- const ledger = new UsageLedger({ ctx, config })
148
- ledger.start()
149
- ctx.on('session/event', (session, event) => {
150
- try { ledger.handle(session, event) } catch { /* usage must not stop turns */ }
151
- })
152
- } catch {
153
- /* usage accounting is optional */
154
- }
155
-
156
- // Only create the nightly task once an existing TA home is present. The
157
- // initialize/reincarnate flows reconcile it explicitly after a change.
158
- if (config.reviewScheduleEnabled && existsSync(config.taHome)) {
159
- void ensureReviewSchedule(ctx, config).catch(() => {})
160
- }
161
-
162
- // HMR/reload: agents that already exist never emit agent/created again.
163
- try {
164
- for (const agent of ctx.agents.list()) syncAgent(ctx, agent, config)
165
- } catch { /* never fail the host for an adapter */ }
166
- }
5
+ export * from './src/host/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ta",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "A persistent personal assistant with its own home, memory, lifecycle and settings page for DeepSeek Harness.",
6
6
  "repository": {
@@ -18,7 +18,7 @@
18
18
  "exports": {
19
19
  ".": "./index.js",
20
20
  "./locale/*.json": "./locale/*.json",
21
- "./client": "./client.js",
21
+ "./client": "./src/client/client.js",
22
22
  "./icon": "./icon.svg"
23
23
  },
24
24
  "files": [
@@ -29,37 +29,14 @@
29
29
  "CHANGELOG.md",
30
30
  "LICENSE",
31
31
  "docs",
32
- "client.js",
33
- "memory",
34
32
  "icon.svg",
35
- "config.js",
36
- "storage.js",
37
- "identity.js",
38
- "gates.js",
39
- "jurisdiction.js",
40
- "tools.js",
41
- "life.js",
42
- "runtime.js",
43
- "reme.js",
44
- "prompts.js",
45
- "im",
46
- "usage",
47
- "stickers",
48
- "runtime-manager.js",
49
- "settings/defaults.js",
50
- "settings/errors.js",
51
- "settings/home.js",
52
- "settings/persona.js",
53
- "settings/status.js",
54
- "settings/im.js",
55
- "settings/routes.js",
56
- "settings/lifecycle.js",
57
- "settings/schedule.js"
33
+ "src"
58
34
  ],
59
35
  "scripts": {
60
36
  "test": "node --test test/*.test.mjs",
61
37
  "check": "node scripts/check-release.mjs",
62
- "prepublishOnly": "npm test && npm run check"
38
+ "prepublishOnly": "npm test && npm run check",
39
+ "inspect": "node scripts/inspect-home.mjs"
63
40
  },
64
41
  "engines": {
65
42
  "dsh": ">=0.2.3-alpha.3"