dal-code 1.0.47 → 1.0.48

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 (218) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/bun/register-bedrock.js +1 -0
  3. package/dist/cli/experimental/auth.js +1 -0
  4. package/dist/cli/experimental/cli.js +1 -0
  5. package/dist/cli/experimental/command-options.js +1 -0
  6. package/dist/cli/experimental/command.js +1 -0
  7. package/dist/cli/experimental/commands/client.js +1 -0
  8. package/dist/cli/experimental/commands/pi.js +1 -0
  9. package/dist/cli/experimental/commands/server.js +1 -0
  10. package/dist/cli/experimental/transport-address.js +1 -0
  11. package/dist/client/index.js +1 -0
  12. package/dist/client/remote-session.js +1 -0
  13. package/dist/client/transcript.js +1 -0
  14. package/dist/core/extensions/engine-specifiers.js +1 -1
  15. package/dist/core/extensions/virtual-modules.js +1 -1
  16. package/dist/core/provider-attribution.js +1 -0
  17. package/dist/modes/interactive/components/daxnuts.js +1 -0
  18. package/dist/modes/interactive/theme/theme-json.js +12 -0
  19. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  20. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  21. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  22. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  23. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  24. package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
  25. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  26. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  27. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  28. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  29. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  30. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  31. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  32. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  33. package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
  34. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  35. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
  36. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  37. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  38. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  39. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  40. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  41. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  42. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  43. package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
  44. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  45. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  46. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  47. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  48. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  49. package/dist/node_modules/@dalcode/dal-sync/package.json +5 -4
  50. package/dist/node_modules/@dalcode/dal-sync/src/client.d.ts +12 -0
  51. package/dist/node_modules/@dalcode/dal-sync/src/core.d.ts +68 -0
  52. package/dist/node_modules/@dalcode/dal-sync/src/core.js +2 -2
  53. package/dist/node_modules/@dalcode/dal-sync/src/host.d.ts +25 -0
  54. package/dist/node_modules/@dalcode/dal-sync/src/host.js +2 -0
  55. package/dist/node_modules/@dalcode/dal-sync/src/index.js +3 -4
  56. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
  57. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  58. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  59. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  60. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  61. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  62. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  63. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +1 -0
  64. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +37 -0
  65. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +104 -0
  66. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +16 -0
  67. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +1 -0
  68. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +1 -0
  69. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +10 -0
  70. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +1 -0
  71. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +1 -0
  72. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +1 -0
  73. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +1 -0
  74. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +1 -0
  75. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +17 -0
  76. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bash.js +1 -0
  77. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bounded.js +1 -0
  78. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/chord.js +1 -0
  79. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/context.js +1 -0
  80. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/harness.js +1 -0
  81. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/hooks.js +1 -0
  82. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/index.js +1 -0
  83. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/jsonl.js +4 -0
  84. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/collapse.js +3 -0
  85. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/entries.js +1 -0
  86. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/frames.js +1 -0
  87. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/generation.js +1 -0
  88. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/job.js +1 -0
  89. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/plugin.js +1 -0
  90. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/post-tools.js +1 -0
  91. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/task-api.js +1 -0
  92. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/tool.js +3 -0
  93. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/membrane.js +1 -0
  94. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/memory.js +1 -0
  95. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/scheduler.js +1 -0
  96. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/session.js +1 -0
  97. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/system.js +8 -0
  98. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/types.js +1 -0
  99. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/view.js +1 -0
  100. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +5 -0
  101. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +1 -0
  102. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +1 -0
  103. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +1 -0
  104. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +1 -0
  105. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +1 -0
  106. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +1 -0
  107. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +1 -0
  108. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +1 -0
  109. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +1 -0
  110. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +1 -0
  111. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +1 -0
  112. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +1 -0
  113. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +1 -0
  114. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +1 -0
  115. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +1 -0
  116. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +1 -0
  117. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +1 -0
  118. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1 -0
  119. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +1 -0
  120. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +1 -0
  121. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +1 -0
  122. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +1 -0
  123. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +1 -0
  124. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +1 -0
  125. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +1 -0
  126. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +1 -0
  127. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +1 -0
  128. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +1 -0
  129. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +1 -0
  130. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +1 -0
  131. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +1 -0
  132. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +1 -0
  133. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +1 -0
  134. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +3 -0
  135. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +1 -0
  136. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +1 -0
  137. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +8 -0
  138. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +1 -0
  139. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +1 -0
  140. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +5 -0
  141. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +1 -0
  142. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +1 -0
  143. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +1 -0
  144. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +1 -0
  145. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +1 -0
  146. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +1 -0
  147. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +1 -0
  148. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +1 -0
  149. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +1 -0
  150. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +1 -0
  151. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +1 -0
  152. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +1 -0
  153. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +1 -0
  154. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +1 -0
  155. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +1 -0
  156. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +1 -0
  157. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +1 -0
  158. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +1 -0
  159. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js +0 -0
  160. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +1 -0
  161. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +1 -0
  162. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +10 -0
  163. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +2 -0
  164. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +1 -0
  165. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +12 -0
  166. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +16 -0
  167. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +1 -0
  168. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +1 -0
  169. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +1 -0
  170. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +1 -0
  171. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +1 -0
  172. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +14 -0
  173. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +0 -0
  174. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -0
  175. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +1 -0
  176. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +1 -0
  177. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +5 -0
  178. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +1 -0
  179. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +5 -0
  180. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +1 -0
  181. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +1 -0
  182. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +0 -0
  183. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +1 -0
  184. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  185. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +1 -0
  186. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +74 -0
  187. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +1 -0
  188. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +1 -0
  189. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
  190. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +1 -0
  191. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  192. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  193. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  194. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +1 -0
  195. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +1 -0
  196. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +1 -0
  197. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +1 -0
  198. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
  199. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
  200. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  201. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  202. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  203. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  204. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  205. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  206. package/dist/sdk/sync.d.ts +2 -0
  207. package/dist/sdk/sync.js +1 -0
  208. package/dist/server/create-harness.js +1 -0
  209. package/dist/utils/clipboard-native.js +1 -0
  210. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  211. package/examples/extensions/gondolin/package-lock.json +2 -2
  212. package/examples/extensions/gondolin/package.json +1 -1
  213. package/examples/extensions/sandbox/package-lock.json +2 -2
  214. package/examples/extensions/sandbox/package.json +1 -1
  215. package/examples/extensions/with-deps/package-lock.json +2 -2
  216. package/examples/extensions/with-deps/package.json +1 -1
  217. package/npm-shrinkwrap.json +2 -2
  218. package/package.json +5 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-goal",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Goal mode for DAL: /goal keeps the agent working on one objective until it is verified complete, with token and continuation limits. Adapted from @narumitw/pi-goal 0.54.11 (MIT, narumiruna); the independent completion check adapts pi-goal-x 0.32.3 (MIT, Lucas).",
6
6
  "license": "MIT",
@@ -21,8 +21,8 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-pi-kit": "1.0.47",
25
- "@dalcode/dal-subagent": "1.0.47",
24
+ "@dalcode/dal-pi-kit": "1.0.48",
25
+ "@dalcode/dal-subagent": "1.0.48",
26
26
  "typebox": "1.3.27"
27
27
  },
28
28
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-guard",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -21,9 +21,9 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-pi-kit": "1.0.47",
25
- "@dalcode/dal-bridge": "1.0.47",
26
- "@dalcode/dal-halo": "1.0.47"
24
+ "@dalcode/dal-pi-kit": "1.0.48",
25
+ "@dalcode/dal-bridge": "1.0.48",
26
+ "@dalcode/dal-halo": "1.0.48"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-halo",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-interactive",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Terminal-UI conveniences adopted from pi's example extensions: the questionnaire tool (the model asks you questions), /handoff (carry context into a new session) and interactive ! commands (vim, git rebase -i, htop). Active only in the TUI; stands down under DAL Code.",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@dalcode/dal-pi-kit": "1.0.47",
23
+ "@dalcode/dal-pi-kit": "1.0.48",
24
24
  "typebox": "1.3.7"
25
25
  },
26
26
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-lang",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -17,8 +17,8 @@
17
17
  ]
18
18
  },
19
19
  "dependencies": {
20
- "@dalcode/dal-pi-kit": "1.0.47",
21
- "@dalcode/dal-bridge": "1.0.47"
20
+ "@dalcode/dal-pi-kit": "1.0.48",
21
+ "@dalcode/dal-bridge": "1.0.48"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-learn",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Self-evolution for DAL: lessons learned from earlier sessions (project and personal), a project map of verified commands and locations, effect tracking, and skill proposals for recurring procedures (/lessons).",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  ]
28
28
  },
29
29
  "dependencies": {
30
- "@dalcode/dal-pi-kit": "1.0.47"
30
+ "@dalcode/dal-pi-kit": "1.0.48"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-lsp",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -21,9 +21,9 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-bridge": "1.0.47",
25
- "@dalcode/dal-dap": "1.0.47",
26
- "@dalcode/dal-pi-kit": "1.0.47",
24
+ "@dalcode/dal-bridge": "1.0.48",
25
+ "@dalcode/dal-dap": "1.0.48",
26
+ "@dalcode/dal-pi-kit": "1.0.48",
27
27
  "cross-spawn": "7.0.6",
28
28
  "typebox": "1.3.7",
29
29
  "typescript": "5.9.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-mcp",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -29,11 +29,11 @@
29
29
  ]
30
30
  },
31
31
  "dependencies": {
32
- "@dalcode/dal-bridge": "1.0.47",
33
- "@dalcode/dal-guard": "1.0.47",
34
- "@dalcode/dal-pi-kit": "1.0.47",
35
- "@dalcode/deepailab": "1.0.47",
36
- "@earendil-works/pi-mcp": "1.0.47",
32
+ "@dalcode/dal-bridge": "1.0.48",
33
+ "@dalcode/dal-guard": "1.0.48",
34
+ "@dalcode/dal-pi-kit": "1.0.48",
35
+ "@dalcode/deepailab": "1.0.48",
36
+ "@earendil-works/pi-mcp": "1.0.48",
37
37
  "cross-spawn": "7.0.6"
38
38
  },
39
39
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-office",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.47",
21
+ "@dalcode/dal-pi-kit": "1.0.48",
22
22
  "docx": "9.7.1",
23
23
  "echarts": "6.1.0",
24
24
  "exceljs": "4.4.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-pi-kit",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Shared i18n helpers for DAL pi extensions. No engine peer.",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-plugins",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -20,9 +20,9 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@dalcode/dal-pi-kit": "1.0.47",
24
- "@dalcode/dal-skills": "1.0.47",
25
- "@dalcode/deepailab": "1.0.47",
23
+ "@dalcode/dal-pi-kit": "1.0.48",
24
+ "@dalcode/dal-skills": "1.0.48",
25
+ "@dalcode/deepailab": "1.0.48",
26
26
  "typebox": "1.3.27"
27
27
  },
28
28
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-recall",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Search past sessions: a local full-text index of earlier conversations the model can query with session_search. Adapted from @henryqw/pi-session-recall 5.1.4 (MIT).",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  ]
21
21
  },
22
22
  "dependencies": {
23
- "@dalcode/dal-pi-kit": "1.0.47",
23
+ "@dalcode/dal-pi-kit": "1.0.48",
24
24
  "typebox": "1.3.27"
25
25
  },
26
26
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-remote",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "`dal remote enable|disable|status|pair|logs`: installs the phone daemon (a pinned, integrity-checked npm package) and runs it as a systemd user service or a launchd agent, so the DAL Code phone app can reach this machine.",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  ]
20
20
  },
21
21
  "dependencies": {
22
- "@dalcode/dal-pi-kit": "1.0.47"
22
+ "@dalcode/dal-pi-kit": "1.0.48"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-review",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Code review: a read-only reviewer sub-agent over uncommitted changes, a base branch, a commit, a PR or a supplied diff, returning structured, deduplicated findings. /review in the TUI, dal -p, RPC and the SDK.",
6
6
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  ]
20
20
  },
21
21
  "dependencies": {
22
- "@dalcode/dal-pi-kit": "1.0.47",
23
- "@dalcode/dal-subagent": "1.0.47",
22
+ "@dalcode/dal-pi-kit": "1.0.48",
23
+ "@dalcode/dal-subagent": "1.0.48",
24
24
  "typebox": "1.3.7"
25
25
  },
26
26
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-rewind",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Git checkpoints for DAL: a snapshot after every turn that changes files, /rewind, Esc+Esc, safe restore, undo. Adapted from pi-rewind 0.5.0 (MIT, arpagon).",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-pi-kit": "1.0.47"
24
+ "@dalcode/dal-pi-kit": "1.0.48"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-router",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -29,11 +29,11 @@
29
29
  ]
30
30
  },
31
31
  "dependencies": {
32
- "@dalcode/dal-guard": "1.0.47",
33
- "@dalcode/dal-pi-kit": "1.0.47",
34
- "@dalcode/dal-tool-catalog": "1.0.47",
35
- "@dalcode/deepailab": "1.0.47",
36
- "@earendil-works/pi-tui": "1.0.47"
32
+ "@dalcode/dal-guard": "1.0.48",
33
+ "@dalcode/dal-pi-kit": "1.0.48",
34
+ "@dalcode/dal-tool-catalog": "1.0.48",
35
+ "@dalcode/deepailab": "1.0.48",
36
+ "@earendil-works/pi-tui": "1.0.48"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@earendil-works/pi-coding-agent": "^1.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-rtk",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Uses rtk, when the user has installed it, to compress the output of shell commands the agent runs. Does nothing when rtk is not installed; never installs it.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.47"
21
+ "@dalcode/dal-pi-kit": "1.0.48"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-skills",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -22,8 +22,8 @@
22
22
  ]
23
23
  },
24
24
  "dependencies": {
25
- "@dalcode/dal-pi-kit": "1.0.47",
26
- "@dalcode/deepailab": "1.0.47",
25
+ "@dalcode/dal-pi-kit": "1.0.48",
26
+ "@dalcode/deepailab": "1.0.48",
27
27
  "typebox": "1.3.7"
28
28
  },
29
29
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-statusline",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "A scriptable status line under the footer: a template or a command of the user's choosing. Grown from the status-line and custom-footer extension examples.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.47"
21
+ "@dalcode/dal-pi-kit": "1.0.48"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-structured",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "dal -p --output-schema: the final answer as JSON that matches a JSON Schema, with a non-zero exit when it does not. Grown from the structured-output extension example.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.47",
21
+ "@dalcode/dal-pi-kit": "1.0.48",
22
22
  "typebox": "1.3.27"
23
23
  },
24
24
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-subagent",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -18,10 +18,10 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.47",
22
- "@dalcode/dal-guard": "1.0.47",
23
- "@earendil-works/pi-agent-core": "1.0.47",
24
- "@earendil-works/pi-ai": "1.0.47",
21
+ "@dalcode/dal-pi-kit": "1.0.48",
22
+ "@dalcode/dal-guard": "1.0.48",
23
+ "@earendil-works/pi-agent-core": "1.0.48",
24
+ "@earendil-works/pi-ai": "1.0.48",
25
25
  "typebox": "1.3.7"
26
26
  },
27
27
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-sync",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "private": true,
5
5
  "description": "Opt-in sync of personal skills and personal lessons through the signed-in DeepAILab account, so other computers pick them up (/sync).",
6
6
  "license": "MIT",
@@ -9,6 +9,7 @@
9
9
  "exports": {
10
10
  ".": "./src/index.js",
11
11
  "./core": "./src/core.js",
12
+ "./host": "./src/host.js",
12
13
  "./package.json": "./package.json"
13
14
  },
14
15
  "files": [
@@ -20,9 +21,9 @@
20
21
  ]
21
22
  },
22
23
  "dependencies": {
23
- "@dalcode/dal-learn": "1.0.47",
24
- "@dalcode/dal-pi-kit": "1.0.47",
25
- "@dalcode/deepailab": "1.0.47"
24
+ "@dalcode/dal-learn": "1.0.48",
25
+ "@dalcode/dal-pi-kit": "1.0.48",
26
+ "@dalcode/deepailab": "1.0.48"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "@earendil-works/pi-coding-agent": "^1.0.9"
@@ -0,0 +1,12 @@
1
+ import { type SyncRemote } from "./core.js";
2
+ export interface HttpRemoteOptions {
3
+ readonly apiBase: string;
4
+ readonly token: () => Promise<string | undefined>;
5
+ readonly device: string;
6
+ readonly fetch?: typeof fetch;
7
+ readonly timeoutMs?: number;
8
+ }
9
+ export interface HttpRemote extends SyncRemote {
10
+ removeAll(): Promise<number>;
11
+ }
12
+ export declare function createHttpRemote(options: HttpRemoteOptions): HttpRemote;
@@ -0,0 +1,68 @@
1
+ export type SyncKind = "skill" | "lesson";
2
+ export declare const MAX_ITEM_BYTES: number;
3
+ export interface LocalItem {
4
+ readonly id: string;
5
+ readonly kind: SyncKind;
6
+ readonly content: Record<string, unknown>;
7
+ readonly hash: string;
8
+ readonly updatedAt: number;
9
+ }
10
+ export interface RemoteEntry {
11
+ readonly id: string;
12
+ readonly kind: SyncKind;
13
+ readonly version: number;
14
+ readonly updatedAt: string;
15
+ }
16
+ export interface ItemState {
17
+ version: number;
18
+ hash: string;
19
+ remoteDeleted?: boolean;
20
+ refused?: string;
21
+ }
22
+ export interface SyncState {
23
+ account: string;
24
+ items: Record<string, ItemState>;
25
+ lastRun?: string;
26
+ lastError?: string;
27
+ lastErrorStatus?: number;
28
+ }
29
+ export interface SyncRemote {
30
+ manifest(): Promise<RemoteEntry[]>;
31
+ get(id: string): Promise<{
32
+ version: number;
33
+ content: Record<string, unknown>;
34
+ } | undefined>;
35
+ put(id: string, kind: SyncKind, baseVersion: number, content: Record<string, unknown>): Promise<{
36
+ status: "written";
37
+ version: number;
38
+ } | {
39
+ status: "conflict";
40
+ } | {
41
+ status: "refused";
42
+ reason: string;
43
+ }>;
44
+ remove(id: string): Promise<boolean>;
45
+ }
46
+ export interface SyncReport {
47
+ uploaded: number;
48
+ downloaded: number;
49
+ deletedRemote: number;
50
+ conflicts: number;
51
+ refused: string[];
52
+ }
53
+ export declare class SyncHttpError extends Error {
54
+ readonly status: number;
55
+ constructor(status: number);
56
+ }
57
+ export declare const skillsDir: (agentDir: string) => string;
58
+ export declare const userLessonsDir: (agentDir: string) => string;
59
+ export declare const statePath: (agentDir: string) => string;
60
+ export declare function contentHash(content: Record<string, unknown>): string;
61
+ export declare function newSyncId(): string;
62
+ export declare function readLocalItems(agentDir: string): LocalItem[];
63
+ export declare function applyRemoteItem(agentDir: string, id: string, content: Record<string, unknown>, neverSynced?: (syncId: string) => boolean): void;
64
+ export declare function removeLocalItem(agentDir: string, id: string): void;
65
+ export declare function readState(agentDir: string): SyncState | undefined;
66
+ export declare function writeState(agentDir: string, state: SyncState): void;
67
+ export declare function clearState(agentDir: string): void;
68
+ export declare function runSync(agentDir: string, account: string, remote: SyncRemote): Promise<SyncReport>;
@@ -1,2 +1,2 @@
1
- var Q=Object.defineProperty;var u=(e,s)=>Q(e,"name",{value:s,configurable:!0});var U=Object.defineProperty,a=u((e,s)=>U(e,"name",{value:s,configurable:!0}),"c");import{createHash as Z,randomBytes as tt}from"node:crypto";import{existsSync as N,mkdirSync as O,readdirSync as et,readFileSync as B,rmSync as F,statSync as st}from"node:fs";import{join as p}from"node:path";import{readLessons as C,updateLessons as $}from"@dalcode/dal-learn/lessons";import{redact as P}from"@dalcode/dal-learn/safety";import{withFileLockSync as nt,writeFileAtomicSync as W}from"@dalcode/dal-pi-kit";const z=256*1024,x=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,K=1;class ot extends Error{static{u(this,"ie")}static{a(this,"SyncHttpError")}status;constructor(s){super(`dal sync request failed (${s})`),this.status=s}}const w=a(e=>p(e,"skills"),"skillsDir"),b=a(e=>p(e,"learned","user"),"userLessonsDir"),L=a(e=>p(e,"sync","state.json"),"statePath");function j(e){return Array.isArray(e)?`[${e.map(j).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,s])=>s!==void 0).sort(([s],[n])=>s<n?-1:s>n?1:0).map(([s,n])=>`${JSON.stringify(s)}:${j(n)}`).join(",")}}`:JSON.stringify(e)}u(j,"A"),a(j,"stable");function S(e){return Z("sha256").update(j(e)).digest("hex")}u(S,"I"),a(S,"contentHash");function A(e){return typeof e=="string"?P(e):Array.isArray(e)?e.map(A):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([s,n])=>[s,A(n)])):e}u(A,"E"),a(A,"redactDeep");const T=["section","content","rootCause","signature","fix","status","risk","helpful","harmful","created","updated","activatedAt","activatedBy","lastHelpfulAt","retiredAt","retiredReason"];function V(e){const s={};for(const n of T)e[n]!==void 0&&(s[n]=e[n]);return A(s)}u(V,"z"),a(V,"lessonContent");function _(e){const s=w(e);if(!N(s))return[];const n=[];for(const r of et(s)){if(!x.test(r)||r.length>64)continue;const i=p(s,r,"SKILL.md");let d,y;try{const c=st(i);if(!c.isFile())continue;d=B(i,"utf8"),y=c.mtimeMs}catch{continue}const m={name:r,body:P(d)};n.push({id:`skill.${r}`,kind:"skill",content:m,hash:S(m),updatedAt:y})}return n}u(_,"q"),a(_,"readSkills");function q(e){const s=b(e);return N(p(s,"lessons.json"))?(C(s).lessons.some(n=>n.scope==="user"&&!n.syncId)&&$(s,n=>({...n,lessons:n.lessons.map(r=>r.scope==="user"&&!r.syncId?{...r,syncId:E()}:r)})),C(s).lessons.filter(n=>n.scope==="user"&&typeof n.syncId=="string").map(n=>{const r=V(n);return{id:`lesson.${n.syncId}`,kind:"lesson",content:r,hash:S(r),updatedAt:Date.parse(n.updated)||0}})):[]}u(q,"X"),a(q,"readLessonItems");function E(){return tt(8).toString("hex")}u(E,"Y"),a(E,"newSyncId");function D(e){return[..._(e),...q(e)]}u(D,"J"),a(D,"readLocalItems");function R(e,s,n,r=()=>!1){if(s.startsWith("skill.")){const c=s.slice(6);if(!x.test(c)||typeof n.body!="string")return;O(p(w(e),c),{recursive:!0}),W(p(w(e),c,"SKILL.md"),n.body);return}if(!s.startsWith("lesson."))return;const i=s.slice(7),d={};for(const c of T)n[c]!==void 0&&(d[c]=n[c]);const y=d.content;if(typeof y!="string"||!y)return;const m=b(e);O(m,{recursive:!0,mode:448}),$(m,c=>{const v=c.lessons,I=v.find(f=>f.syncId===i)??v.find(f=>f.scope==="user"&&(!f.syncId||r(f.syncId))&&f.content===d.content);if(I)return{...c,lessons:v.map(f=>f===I?{...f,...d,syncId:i}:f)};const g=new Date().toISOString(),k={id:`u-${String(c.nextId).padStart(4,"0")}`,scope:"user",section:"general",rootCause:"",status:"candidate",risk:[],sessions:[],evidence:[],helpful:0,harmful:0,feedback:[],created:g,updated:g,...d,content:y,syncId:i};return{...c,nextId:c.nextId+1,lessons:[...v,k]}})}u(R,"G"),a(R,"applyRemoteItem");function X(e,s){if(s.startsWith("skill.")){const r=s.slice(6);x.test(r)&&F(p(w(e),r),{recursive:!0,force:!0});return}const n=s.slice(7);$(b(e),r=>({...r,lessons:r.lessons.filter(i=>i.syncId!==n)}))}u(X,"ce"),a(X,"removeLocalItem");function H(e){try{const s=JSON.parse(B(L(e),"utf8"));if(s.formatVersion!==K||typeof s.account!="string")return;const n=s.items&&typeof s.items=="object"?s.items:{};return{account:s.account,items:n,lastRun:typeof s.lastRun=="string"?s.lastRun:void 0,lastError:typeof s.lastError=="string"?s.lastError:void 0}}catch{return}}u(H,"Q"),a(H,"readState");function M(e,s){const n=L(e);O(p(e,"sync"),{recursive:!0,mode:448}),nt(n,()=>W(n,`${JSON.stringify({formatVersion:K,...s},null," ")}
2
- `,{mode:384}))}u(M,"U"),a(M,"writeState");function Y(e){F(L(e),{force:!0})}u(Y,"ae"),a(Y,"clearState");async function G(e,s,n){const r=H(e),i={account:s,items:r?.account===s?{...r.items}:{}},d={uploaded:0,downloaded:0,deletedRemote:0,conflicts:0,refused:[]},y=a(()=>M(e,{...i,lastRun:new Date().toISOString()}),"save"),m=new Map((await n.manifest()).map(t=>[t.id,t]));let c=new Map(D(e).map(t=>[t.id,t]));const v=a(t=>{const o=`lesson.${t}`;return!i.items[o]&&!m.has(o)},"neverSynced"),I=new Set,g=a((t,o)=>{R(e,t,o.content,v),i.items[t]={version:o.version,hash:S(o.content)},I.add(t),d.downloaded++},"apply"),k=a(async t=>{const o=await n.get(t);return o?(g(t,o),!0):!1},"download"),f=a(async(t,o)=>{const l=i.items[t.id];if(l?.refused===t.hash)return;if(Buffer.byteLength(JSON.stringify(t.content))>z){i.items[t.id]={version:l?.version??0,hash:l?.hash??"",refused:t.hash},d.refused.push(t.id);return}const h=await n.put(t.id,t.kind,o,t.content);h.status==="written"?(i.items[t.id]={version:h.version,hash:t.hash},d.uploaded++):h.status==="conflict"?d.conflicts++:(i.items[t.id]={version:l?.version??0,hash:l?.hash??"",refused:t.hash},d.refused.push(t.id))},"upload");for(const t of m.values()){const o=i.items[t.id]?.remoteDeleted?void 0:i.items[t.id],l=c.get(t.id);if(!l){if(o&&o.version===t.version){await n.remove(t.id)&&d.deletedRemote++,delete i.items[t.id];continue}await k(t.id);continue}if(o&&o.version===t.version)continue;if(o&&l.hash===o.hash){await k(t.id);continue}const h=await n.get(t.id);if(!h)continue;const J=S(h.content);if(J===l.hash){i.items[t.id]={version:h.version,hash:J};continue}d.conflicts++,Date.parse(t.updatedAt)>l.updatedAt?g(t.id,h):await f(l,h.version)}c=new Map(D(e).map(t=>[t.id,t]));for(const t of I){const o=c.get(t);o&&i.items[t]&&(i.items[t].hash=o.hash)}for(const t of c.values()){const o=i.items[t.id],l=m.get(t.id);if(l){o&&o.version===l.version&&t.hash!==o.hash&&await f(t,l.version);continue}if(o&&t.hash===o.hash){!o.remoteDeleted&&o.version>0&&(i.items[t.id]={...o,remoteDeleted:!0});continue}await f(t,0)}for(const t of Object.keys(i.items))!c.has(t)&&!m.has(t)&&delete i.items[t];return y(),d}u(G,"de"),a(G,"runSync");export{z as MAX_ITEM_BYTES,ot as SyncHttpError,R as applyRemoteItem,Y as clearState,S as contentHash,E as newSyncId,D as readLocalItems,H as readState,X as removeLocalItem,G as runSync,w as skillsDir,L as statePath,b as userLessonsDir,M as writeState};
1
+ var Q=Object.defineProperty;var u=(e,s)=>Q(e,"name",{value:s,configurable:!0});var U=Object.defineProperty,a=u((e,s)=>U(e,"name",{value:s,configurable:!0}),"c");import{createHash as Z,randomBytes as tt}from"node:crypto";import{existsSync as N,mkdirSync as E,readdirSync as et,readFileSync as B,rmSync as F,statSync as st}from"node:fs";import{join as p}from"node:path";import{readLessons as C,updateLessons as O}from"@dalcode/dal-learn/lessons";import{redact as P}from"@dalcode/dal-learn/safety";import{withFileLockSync as nt,writeFileAtomicSync as W}from"@dalcode/dal-pi-kit";const z=256*1024,$=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,K=1;class ot extends Error{static{u(this,"ie")}static{a(this,"SyncHttpError")}status;constructor(s){super(`dal sync request failed (${s})`),this.status=s}}const w=a(e=>p(e,"skills"),"skillsDir"),b=a(e=>p(e,"learned","user"),"userLessonsDir"),L=a(e=>p(e,"sync","state.json"),"statePath");function j(e){return Array.isArray(e)?`[${e.map(j).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,s])=>s!==void 0).sort(([s],[n])=>s<n?-1:s>n?1:0).map(([s,n])=>`${JSON.stringify(s)}:${j(n)}`).join(",")}}`:JSON.stringify(e)}u(j,"E"),a(j,"stable");function S(e){return Z("sha256").update(j(e)).digest("hex")}u(S,"I"),a(S,"contentHash");function A(e){return typeof e=="string"?P(e):Array.isArray(e)?e.map(A):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([s,n])=>[s,A(n)])):e}u(A,"A"),a(A,"redactDeep");const T=["section","content","rootCause","signature","fix","status","risk","helpful","harmful","created","updated","activatedAt","activatedBy","lastHelpfulAt","retiredAt","retiredReason"];function V(e){const s={};for(const n of T)e[n]!==void 0&&(s[n]=e[n]);return A(s)}u(V,"z"),a(V,"lessonContent");function _(e){const s=w(e);if(!N(s))return[];const n=[];for(const i of et(s)){if(!$.test(i)||i.length>64)continue;const r=p(s,i,"SKILL.md");let d,y;try{const c=st(r);if(!c.isFile())continue;d=B(r,"utf8"),y=c.mtimeMs}catch{continue}const m={name:i,body:P(d)};n.push({id:`skill.${i}`,kind:"skill",content:m,hash:S(m),updatedAt:y})}return n}u(_,"q"),a(_,"readSkills");function q(e){const s=b(e);return N(p(s,"lessons.json"))?(C(s).lessons.some(n=>n.scope==="user"&&!n.syncId)&&O(s,n=>({...n,lessons:n.lessons.map(i=>i.scope==="user"&&!i.syncId?{...i,syncId:x()}:i)})),C(s).lessons.filter(n=>n.scope==="user"&&typeof n.syncId=="string").map(n=>{const i=V(n);return{id:`lesson.${n.syncId}`,kind:"lesson",content:i,hash:S(i),updatedAt:Date.parse(n.updated)||0}})):[]}u(q,"X"),a(q,"readLessonItems");function x(){return tt(8).toString("hex")}u(x,"Y"),a(x,"newSyncId");function D(e){return[..._(e),...q(e)]}u(D,"J"),a(D,"readLocalItems");function R(e,s,n,i=()=>!1){if(s.startsWith("skill.")){const c=s.slice(6);if(!$.test(c)||typeof n.body!="string")return;E(p(w(e),c),{recursive:!0}),W(p(w(e),c,"SKILL.md"),n.body);return}if(!s.startsWith("lesson."))return;const r=s.slice(7),d={};for(const c of T)n[c]!==void 0&&(d[c]=n[c]);const y=d.content;if(typeof y!="string"||!y)return;const m=b(e);E(m,{recursive:!0,mode:448}),O(m,c=>{const v=c.lessons,I=v.find(f=>f.syncId===r)??v.find(f=>f.scope==="user"&&(!f.syncId||i(f.syncId))&&f.content===d.content);if(I)return{...c,lessons:v.map(f=>f===I?{...f,...d,syncId:r}:f)};const g=new Date().toISOString(),k={id:`u-${String(c.nextId).padStart(4,"0")}`,scope:"user",section:"general",rootCause:"",status:"candidate",risk:[],sessions:[],evidence:[],helpful:0,harmful:0,feedback:[],created:g,updated:g,...d,content:y,syncId:r};return{...c,nextId:c.nextId+1,lessons:[...v,k]}})}u(R,"G"),a(R,"applyRemoteItem");function X(e,s){if(s.startsWith("skill.")){const i=s.slice(6);$.test(i)&&F(p(w(e),i),{recursive:!0,force:!0});return}const n=s.slice(7);O(b(e),i=>({...i,lessons:i.lessons.filter(r=>r.syncId!==n)}))}u(X,"ce"),a(X,"removeLocalItem");function H(e){try{const s=JSON.parse(B(L(e),"utf8"));if(s.formatVersion!==K||typeof s.account!="string")return;const n=s.items&&typeof s.items=="object"?s.items:{};return{account:s.account,items:n,lastRun:typeof s.lastRun=="string"?s.lastRun:void 0,lastError:typeof s.lastError=="string"?s.lastError:void 0,lastErrorStatus:typeof s.lastErrorStatus=="number"?s.lastErrorStatus:void 0}}catch{return}}u(H,"Q"),a(H,"readState");function M(e,s){const n=L(e);E(p(e,"sync"),{recursive:!0,mode:448}),nt(n,()=>W(n,`${JSON.stringify({formatVersion:K,...s},null," ")}
2
+ `,{mode:384}))}u(M,"U"),a(M,"writeState");function Y(e){F(L(e),{force:!0})}u(Y,"ae"),a(Y,"clearState");async function G(e,s,n){const i=H(e),r={account:s,items:i?.account===s?{...i.items}:{}},d={uploaded:0,downloaded:0,deletedRemote:0,conflicts:0,refused:[]},y=a(()=>M(e,{...r,lastRun:new Date().toISOString()}),"save"),m=new Map((await n.manifest()).map(t=>[t.id,t]));let c=new Map(D(e).map(t=>[t.id,t]));const v=a(t=>{const o=`lesson.${t}`;return!r.items[o]&&!m.has(o)},"neverSynced"),I=new Set,g=a((t,o)=>{R(e,t,o.content,v),r.items[t]={version:o.version,hash:S(o.content)},I.add(t),d.downloaded++},"apply"),k=a(async t=>{const o=await n.get(t);return o?(g(t,o),!0):!1},"download"),f=a(async(t,o)=>{const l=r.items[t.id];if(l?.refused===t.hash)return;if(Buffer.byteLength(JSON.stringify(t.content))>z){r.items[t.id]={version:l?.version??0,hash:l?.hash??"",refused:t.hash},d.refused.push(t.id);return}const h=await n.put(t.id,t.kind,o,t.content);h.status==="written"?(r.items[t.id]={version:h.version,hash:t.hash},d.uploaded++):h.status==="conflict"?d.conflicts++:(r.items[t.id]={version:l?.version??0,hash:l?.hash??"",refused:t.hash},d.refused.push(t.id))},"upload");for(const t of m.values()){const o=r.items[t.id]?.remoteDeleted?void 0:r.items[t.id],l=c.get(t.id);if(!l){if(o&&o.version===t.version){await n.remove(t.id)&&d.deletedRemote++,delete r.items[t.id];continue}await k(t.id);continue}if(o&&o.version===t.version)continue;if(o&&l.hash===o.hash){await k(t.id);continue}const h=await n.get(t.id);if(!h)continue;const J=S(h.content);if(J===l.hash){r.items[t.id]={version:h.version,hash:J};continue}d.conflicts++,Date.parse(t.updatedAt)>l.updatedAt?g(t.id,h):await f(l,h.version)}c=new Map(D(e).map(t=>[t.id,t]));for(const t of I){const o=c.get(t);o&&r.items[t]&&(r.items[t].hash=o.hash)}for(const t of c.values()){const o=r.items[t.id],l=m.get(t.id);if(l){o&&o.version===l.version&&t.hash!==o.hash&&await f(t,l.version);continue}if(o&&t.hash===o.hash){!o.remoteDeleted&&o.version>0&&(r.items[t.id]={...o,remoteDeleted:!0});continue}await f(t,0)}for(const t of Object.keys(r.items))!c.has(t)&&!m.has(t)&&delete r.items[t];return y(),d}u(G,"de"),a(G,"runSync");export{z as MAX_ITEM_BYTES,ot as SyncHttpError,R as applyRemoteItem,Y as clearState,S as contentHash,x as newSyncId,D as readLocalItems,H as readState,X as removeLocalItem,G as runSync,w as skillsDir,L as statePath,b as userLessonsDir,M as writeState};
@@ -0,0 +1,25 @@
1
+ import { type HttpRemote } from "./client.js";
2
+ import { type SyncReport } from "./core.js";
3
+ export declare const SETTINGS_KEY = "dalSync";
4
+ export declare const SYNC_CONSOLE_URL = "https://deepailab.ai/dal-sync";
5
+ export declare function syncEnabled(agentDir: string): boolean;
6
+ export declare function saveSyncEnabled(agentDir: string, enabled: boolean): void;
7
+ export declare function syncErrorStatus(error: unknown): number;
8
+ export declare function syncErrorText(error: unknown): string;
9
+ export interface SyncStatus {
10
+ readonly enabled: boolean;
11
+ readonly synced: number;
12
+ readonly lastRun?: string;
13
+ readonly lastError?: string;
14
+ readonly lastErrorStatus?: number;
15
+ }
16
+ export declare function syncStatus(agentDir: string): SyncStatus;
17
+ export interface SyncConnection {
18
+ readonly apiBase: string;
19
+ readonly token: () => Promise<string | undefined>;
20
+ readonly device: string;
21
+ readonly fetch?: typeof fetch;
22
+ }
23
+ export declare function syncRemote(connection: SyncConnection): HttpRemote;
24
+ export declare function syncOnce(agentDir: string, account: string, remote: HttpRemote): Promise<SyncReport>;
25
+ export declare function removeCloudCopies(agentDir: string, remote: HttpRemote): Promise<number>;
@@ -0,0 +1,2 @@
1
+ var v=Object.defineProperty;var n=(u,t)=>v(u,"name",{value:t,configurable:!0});var w=Object.defineProperty,a=n((u,t)=>w(u,"name",{value:t,configurable:!0}),"o");import{existsSync as b,readFileSync as B}from"node:fs";import{join as g}from"node:path";import{declaredDataFormat as h,t as o,withFileLockSync as R,writeFileAtomicSync as O}from"@dalcode/dal-pi-kit";import{createHttpRemote as N}from"./client.js";import{clearState as L,readState as S,runSync as j,SyncHttpError as x,writeState as J}from"./core.js";const c="dalSync",T="https://deepailab.ai/dal-sync",A=a(u=>g(u,"settings.json"),"settingsPath");function i(u){try{const t=JSON.parse(B(u,"utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}n(i,"c"),a(i,"readJson");function E(u){return process.env.DAL_SYNC==="0"?!1:i(A(u))?.[c]?.enabled===!0}n(E,"k"),a(E,"syncEnabled");function d(u,t){const r=A(u);R(r,()=>{if(b(r)&&i(r)===void 0)throw new Error(`${r} is not valid JSON; not overwriting it`);const s=i(r)??{};if(h(s)>1)throw new Error(`${r} was written by a newer DAL; not overwriting it`);const e=s[c]??{};s[c]={...e,enabled:t},O(r,`${JSON.stringify(s,null,2)}
2
+ `)})}n(d,"P"),a(d,"saveSyncEnabled");function f(u,t){return u.replace(/\{(\w+)\}/g,(r,s)=>s in t?String(t[s]):r)}n(f,"A"),a(f,"fill");function l(u){return u instanceof x?u.status:0}n(l,"f"),a(l,"syncErrorStatus");function F(u){const t=l(u);return t===401?o("\u672A\u767B\u5F55 DeepAILab\uFF0C\u6216\u767B\u5F55\u5DF2\u8FC7\u671F\uFF1B\u767B\u5F55\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u540C\u6B65\u3002"):t===404?o("\u540C\u6B65\u670D\u52A1\u5C1A\u672A\u5F00\u653E\uFF0C\u5F00\u653E\u540E\u4F1A\u81EA\u52A8\u5F00\u59CB\u3002"):t===503?o("\u540C\u6B65\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"):t?f(o("\u540C\u6B65\u8BF7\u6C42\u5931\u8D25\uFF08{status}\uFF09\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"),{status:t}):o("\u7F51\u7EDC\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002")}n(F,"C"),a(F,"syncErrorText");function C(u){const t=S(u),r=t?Object.values(t.items).filter(s=>!s.remoteDeleted&&s.version>0).length:0;return{enabled:E(u),synced:r,...t?.lastRun?{lastRun:t.lastRun}:{},...t?.lastError?{lastError:t.lastError}:{},...t?.lastError&&t.lastErrorStatus!==void 0?{lastErrorStatus:t.lastErrorStatus}:{}}}n(C,"_"),a(C,"syncStatus");function m(u){return N(u)}n(m,"T"),a(m,"syncRemote");async function D(u,t,r){try{return await j(u,t,r)}catch(s){const e=S(u),y=e?.account===t;throw J(u,{account:t,items:y?e.items:{},lastRun:y?e.lastRun:void 0,lastError:F(s),lastErrorStatus:l(s)}),s}}n(D,"Y"),a(D,"syncOnce");async function p(u,t){const r=await t.removeAll();return L(u),r}n(p,"$"),a(p,"removeCloudCopies");export{c as SETTINGS_KEY,T as SYNC_CONSOLE_URL,p as removeCloudCopies,d as saveSyncEnabled,E as syncEnabled,l as syncErrorStatus,F as syncErrorText,D as syncOnce,m as syncRemote,C as syncStatus};