dal-code 1.0.55 → 1.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/bundle/chunks/{anthropic-messages-LJWWEQIU.js → anthropic-messages-ASQGS6BL.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-GK4VH6GM.js → azure-openai-responses-ZSCUJBSU.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-DBT5OS5V.js → chunk-2E7RGBKM.js} +1 -1
- package/dist/bundle/chunks/{chunk-3ANBT7AT.js → chunk-34D4KVPX.js} +1 -1
- package/dist/bundle/chunks/chunk-6PQZ4KMC.js +17 -0
- package/dist/bundle/chunks/chunk-6SPX3U36.js +1 -0
- package/dist/bundle/chunks/{chunk-DWMC4U2M.js → chunk-F577XLVZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-6U37J6E7.js → chunk-FSX34SAZ.js} +340 -366
- package/dist/bundle/chunks/chunk-G5AMLGXC.js +1 -0
- package/dist/bundle/chunks/{chunk-44EXLOHK.js → chunk-GPI2GHBH.js} +1 -1
- package/dist/bundle/chunks/chunk-HF334NQU.js +21 -0
- package/dist/bundle/chunks/{chunk-5TGFM4KW.js → chunk-IRSW3MVW.js} +2 -2
- package/dist/bundle/chunks/chunk-JPBJUBY4.js +17 -0
- package/dist/bundle/chunks/chunk-JPCWLZUZ.js +30 -0
- package/dist/bundle/chunks/chunk-JUUJCOIR.js +7 -0
- package/dist/bundle/chunks/{chunk-KSF7BFGS.js → chunk-KP7CMLOT.js} +1 -1
- package/dist/bundle/chunks/chunk-LZTZWS3N.js +9 -0
- package/dist/bundle/chunks/{chunk-ZYP3V3TD.js → chunk-MAJODFX6.js} +1 -1
- package/dist/bundle/chunks/{chunk-SNBVCTMQ.js → chunk-MZ7O6YLD.js} +3 -3
- package/dist/bundle/chunks/chunk-NJDCSLWK.js +1 -0
- package/dist/bundle/chunks/{chunk-SCSGNIU5.js → chunk-O3XFDBJ3.js} +1 -1
- package/dist/bundle/chunks/{chunk-2XX4WZT6.js → chunk-PD6QS7YD.js} +1 -1
- package/dist/bundle/chunks/{chunk-SMPERFJU.js → chunk-S7K3JBWA.js} +1 -1
- package/dist/bundle/chunks/{chunk-PRBATF6B.js → chunk-TNSXMGQB.js} +1 -1
- package/dist/bundle/chunks/chunk-XIJS4F22.js +14 -0
- package/dist/bundle/chunks/{chunk-GX37DI5S.js → chunk-YTDTROS5.js} +1 -1
- package/dist/bundle/chunks/{cli-Z44UHMMU.js → cli-IDAZVEZ2.js} +1 -1
- package/dist/bundle/chunks/{cli-VKNCK5P5.js → cli-NP7QEFQE.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-G4E4L26A.js → cloudflare-workers-ai-system-one-WLKVTF6I.js} +1 -1
- package/dist/bundle/chunks/{execute-3FWM3EMV.js → execute-VXSJSHXH.js} +2 -2
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-HVFDKPI3.js → google-generative-ai-3HIBMVL4.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-6E4HATAC.js → google-vertex-7PIUZFM3.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-3HAEJDKO.js → llama-cpp-classify-5OLOZHKT.js} +1 -1
- package/dist/bundle/chunks/mcp-GHYUCPI4.js +10 -0
- package/dist/bundle/chunks/{mistral-conversations-6UC2WYUC.js → mistral-conversations-6Y33SI3U.js} +1 -1
- package/dist/bundle/chunks/{office-2F4B572E.js → office-2JSKOL7V.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-WPSZR4EE.js → openai-codex-responses-BYGMMTPH.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-2RGIFVKJ.js → openai-completions-UWYQMOLR.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-BLZVYNRQ.js → openai-decisions-I5J7OD62.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-N65DO7MB.js → openai-responses-LWVKQGLT.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-LQ4VP5P7.js → openrouter-images-BDUFN6XX.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-VYTRLMVB.js → pi-messages-64FHWMQR.js} +1 -1
- package/dist/bundle/chunks/{review-MKITXKSI.js → review-OQEOVDLP.js} +2 -2
- package/dist/bundle/chunks/{router-RL7OYANY.js → router-3UQE4LBN.js} +1 -1
- package/dist/bundle/chunks/runtime-E7KOB62K.js +1 -0
- package/dist/bundle/chunks/sdk-5V64WBOZ.js +1 -0
- package/dist/bundle/chunks/sync-INSWGFSB.js +21 -0
- package/dist/bundle/chunks/{typesafe-system-one-6ZFGVJMV.js → typesafe-system-one-7QFJ5JNW.js} +1 -1
- package/dist/bundle/chunks/usage-MG7QDPG2.js +1 -0
- package/dist/bundle/chunks/virtual-modules-73ZLFCNE.js +1 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -0
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/headless-approver.d.ts +3 -0
- package/dist/core/headless-approver.js +1 -0
- package/dist/dal/manifest.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/main.js +3 -3
- package/dist/modes/acp/acp-mapping.js +3 -2
- package/dist/modes/acp/acp-mode.js +1 -1
- package/dist/modes/acp/acp-permissions.js +1 -0
- package/dist/modes/acp/acp-session-options.d.ts +24 -0
- package/dist/modes/acp/acp-session-options.js +3 -0
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-learn/src/store.js +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-mcp/src/config.js +1 -1
- package/dist/node_modules/@dalcode/dal-mcp/src/index.js +16 -16
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +2 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/agent-dir.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/agent-dir.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +7 -5
- package/dist/node_modules/@dalcode/dal-sync/src/client.d.ts +2 -0
- package/dist/node_modules/@dalcode/dal-sync/src/client.js +1 -1
- package/dist/node_modules/@dalcode/dal-sync/src/host.d.ts +11 -1
- package/dist/node_modules/@dalcode/dal-sync/src/host.js +2 -2
- package/dist/node_modules/@dalcode/dal-sync/src/index.js +3 -3
- package/dist/node_modules/@dalcode/dal-sync/src/sessions.d.ts +153 -0
- package/dist/node_modules/@dalcode/dal-sync/src/sessions.js +15 -0
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/sdk/sync.d.ts +8 -1
- package/dist/sdk/sync.js +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-3YGHTGYM.js +0 -7
- package/dist/bundle/chunks/chunk-D3HKK2ZD.js +0 -17
- package/dist/bundle/chunks/chunk-NMU45EFT.js +0 -9
- package/dist/bundle/chunks/chunk-SE42OS3U.js +0 -21
- package/dist/bundle/chunks/chunk-YDOF6JVP.js +0 -30
- package/dist/bundle/chunks/mcp-SGBPG7LV.js +0 -10
- package/dist/bundle/chunks/runtime-KB5ZUQB6.js +0 -1
- package/dist/bundle/chunks/sdk-C5BAFGNR.js +0 -1
- package/dist/bundle/chunks/sync-AQUDRXHM.js +0 -7
- package/dist/bundle/chunks/usage-CK3QZLTW.js +0 -1
- package/dist/bundle/chunks/virtual-modules-GRXCAWTO.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./i18n.js";export*from"./project-size.js";export*from"./session-scope.js";export*from"./shared-data.js";
|
|
1
|
+
export*from"./agent-dir.js";export*from"./i18n.js";export*from"./project-size.js";export*from"./session-scope.js";export*from"./shared-data.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
24
|
-
"@dalcode/dal-skills": "1.0.
|
|
25
|
-
"@dalcode/deepailab": "1.0.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
24
|
+
"@dalcode/dal-skills": "1.0.57",
|
|
25
|
+
"@dalcode/deepailab": "1.0.57",
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
22
|
+
"@dalcode/dal-pi-kit": "1.0.57"
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
23
|
-
"@dalcode/dal-subagent": "1.0.
|
|
22
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
23
|
+
"@dalcode/dal-subagent": "1.0.57",
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.57"
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
33
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
34
|
-
"@dalcode/dal-tool-catalog": "1.0.
|
|
35
|
-
"@dalcode/deepailab": "1.0.
|
|
36
|
-
"@earendil-works/pi-tui": "1.0.
|
|
32
|
+
"@dalcode/dal-guard": "1.0.57",
|
|
33
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
34
|
+
"@dalcode/dal-tool-catalog": "1.0.57",
|
|
35
|
+
"@dalcode/deepailab": "1.0.57",
|
|
36
|
+
"@earendil-works/pi-tui": "1.0.57"
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.57"
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
26
|
-
"@dalcode/deepailab": "1.0.
|
|
25
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
26
|
+
"@dalcode/deepailab": "1.0.57",
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.57"
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
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.
|
|
3
|
+
"version": "1.0.57",
|
|
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.
|
|
22
|
-
"@dalcode/dal-guard": "1.0.
|
|
23
|
-
"@earendil-works/pi-agent-core": "1.0.
|
|
24
|
-
"@earendil-works/pi-ai": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
22
|
+
"@dalcode/dal-guard": "1.0.57",
|
|
23
|
+
"@earendil-works/pi-agent-core": "1.0.57",
|
|
24
|
+
"@earendil-works/pi-ai": "1.0.57",
|
|
25
25
|
"typebox": "1.3.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-sync",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"private": true,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Conversations, personal skills and personal lessons follow the signed-in DeepAILab account, so other computers pick them up (/sync).",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.js",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
".": "./src/index.js",
|
|
11
11
|
"./core": "./src/core.js",
|
|
12
12
|
"./host": "./src/host.js",
|
|
13
|
+
"./client": "./src/client.js",
|
|
14
|
+
"./sessions": "./src/sessions.js",
|
|
13
15
|
"./package.json": "./package.json"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
@@ -21,9 +23,9 @@
|
|
|
21
23
|
]
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-learn": "1.0.
|
|
25
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
26
|
-
"@dalcode/deepailab": "1.0.
|
|
26
|
+
"@dalcode/dal-learn": "1.0.57",
|
|
27
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
28
|
+
"@dalcode/deepailab": "1.0.57"
|
|
27
29
|
},
|
|
28
30
|
"peerDependencies": {
|
|
29
31
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SyncRemote } from "./core.js";
|
|
2
|
+
import type { SessionRemote } from "./sessions.js";
|
|
2
3
|
export interface HttpRemoteOptions {
|
|
3
4
|
readonly apiBase: string;
|
|
4
5
|
readonly token: () => Promise<string | undefined>;
|
|
@@ -8,5 +9,6 @@ export interface HttpRemoteOptions {
|
|
|
8
9
|
}
|
|
9
10
|
export interface HttpRemote extends SyncRemote {
|
|
10
11
|
removeAll(): Promise<number>;
|
|
12
|
+
readonly sessions: SessionRemote;
|
|
11
13
|
}
|
|
12
14
|
export declare function createHttpRemote(options: HttpRemoteOptions): HttpRemote;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E=Object.defineProperty;var g=(f,l)=>E(f,"name",{value:l,configurable:!0});var b=Object.defineProperty,w=g((f,l)=>b(f,"name",{value:l,configurable:!0}),"f");import{SyncHttpError as d}from"./core.js";function A(f){const l=`${f.apiBase.replace(/\/+$/,"")}/portal/dal-sync`,q=f.fetch??fetch;async function c(t,e,r,s){const n=await f.token();if(!n)throw new d(401);const o=await q(`${l}${e}`,{method:t,headers:{Authorization:`Bearer ${n}`,Accept:"application/json",...r===void 0?{}:{"Content-Type":"application/json"}},body:r===void 0?void 0:JSON.stringify(r),signal:AbortSignal.timeout(s??f.timeoutMs??2e4)}),u=await o.json().catch(()=>null);return{status:o.status,data:u}}g(c,"d"),w(c,"call");const a=w(t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},"record"),m=w(t=>`/items/${encodeURIComponent(t)}`,"item"),i=w(t=>Number(t)||0,"num"),p=w(t=>typeof t=="string"&&t?t:null,"strOrNull"),h=w(t=>{const e=a(t);if(typeof e.id=="string")return{id:e.id,generation:i(e.generation),nextSeq:i(e.nextSeq),title:p(e.title),projectKey:p(e.projectKey),projectName:p(e.projectName),cwd:p(e.cwd),device:p(e.device),entries:i(e.entries),createdAt:p(e.createdAt),modifiedAt:p(e.modifiedAt)}},"toSession"),y=w(t=>`/sessions/${encodeURIComponent(t)}`,"session"),v=12e4;return{sessions:{async list(t,e=200){const r=new URLSearchParams({limit:String(e)});t&&r.set("project",t);const{status:s,data:n}=await c("GET",`/sessions?${r}`);if(s!==200)throw new d(s);const o=a(n).sessions;return(Array.isArray(o)?o:[]).flatMap(u=>h(u)??[])},async putMeta(t,e,r){const{status:s,data:n}=await c("PUT",y(t),{...e,device:f.device.slice(0,64),...r?.create===!1?{create:!1}:{}});if(s===404)return{status:"missing"};if(s===200){const o=h(n);if(o)return{status:"ok",session:o}}if(s===409)return{status:"conflict",generation:i(a(n).generation),nextSeq:i(a(n).nextSeq)};if(s===413)return{status:"quota"};if(s===400)return{status:"refused",reason:String(a(n).error??s)};throw new d(s)},async append(t,e){const{status:r,data:s}=await c("POST",`${y(t)}/chunks`,e,v),n=a(s);if(r===200)return{status:"ok",nextSeq:i(n.nextSeq)};if(r===409)return{status:"conflict",generation:i(n.generation),nextSeq:i(n.nextSeq)};if(r===404)return{status:"missing"};if(r===413&&n.error==="account_quota_exceeded")return{status:"quota"};if(r===413||r===400)return{status:"refused",reason:String(n.error??r)};throw new d(r)},async chunks(t,e,r){const s=new URLSearchParams({generation:String(e),after:String(r)}),{status:n,data:o}=await c("GET",`${y(t)}/chunks?${s}`,void 0,v),u=a(o);if(n===200){const k=Array.isArray(u.chunks)?u.chunks:[];return{status:"ok",generation:i(u.generation),nextSeq:i(u.nextSeq),more:u.more===!0,chunks:k.flatMap(x=>{const S=a(x);return typeof S.data=="string"?[{seq:i(S.seq),data:S.data}]:[]})}}if(n===409)return{status:"conflict",generation:i(u.generation),nextSeq:i(u.nextSeq)};if(n===404)return{status:"missing"};throw new d(n)},async remove(t){const{status:e}=await c("DELETE",y(t));if(e===200)return!0;if(e===404)return!1;throw new d(e)}},async manifest(){const{status:t,data:e}=await c("GET","/manifest");if(t!==200)throw new d(t);const r=a(e).items;return(Array.isArray(r)?r:[]).flatMap(s=>{const n=a(s);return typeof n.id!="string"||n.kind!=="skill"&&n.kind!=="lesson"?[]:[{id:n.id,kind:n.kind,version:Number(n.version)||0,updatedAt:typeof n.updatedAt=="string"?n.updatedAt:new Date(0).toISOString()}]})},async get(t){const{status:e,data:r}=await c("GET",m(t));if(e===404)return;if(e!==200)throw new d(e);const s=a(r);return{version:Number(s.version)||0,content:a(s.content)}},async put(t,e,r,s){const{status:n,data:o}=await c("PUT",m(t),{kind:e,baseVersion:r,content:s,device:f.device.slice(0,64)});if(n===200)return{status:"written",version:Number(a(o).version)||0};if(n===409)return{status:"conflict"};if(n===413||n===422||n===400)return{status:"refused",reason:String(a(o).error??n)};throw new d(n)},async remove(t){const{status:e}=await c("DELETE",m(t));if(e===200)return!0;if(e===404)return!1;throw new d(e)},async removeAll(){const{status:t,data:e}=await c("DELETE","");if(t!==200)throw new d(t);return Number(a(e).removed)||0}}}g(A,"v"),w(A,"createHttpRemote");export{A as createHttpRemote};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { type HttpRemote } from "./client.js";
|
|
2
2
|
import { type SyncReport } from "./core.js";
|
|
3
|
+
import { type SessionSyncOptions, type SessionSyncReport } from "./sessions.js";
|
|
3
4
|
export declare const SETTINGS_KEY = "dalSync";
|
|
4
5
|
export declare const SYNC_CONSOLE_URL = "https://deepailab.ai/dal-sync";
|
|
5
6
|
export declare function syncEnabled(agentDir: string): boolean;
|
|
7
|
+
export declare function syncChosen(agentDir: string): boolean;
|
|
8
|
+
export declare function takeSyncNotice(agentDir: string, account: string): boolean;
|
|
6
9
|
export declare function saveSyncEnabled(agentDir: string, enabled: boolean): void;
|
|
7
10
|
export declare function syncErrorStatus(error: unknown): number;
|
|
8
11
|
export declare function syncErrorText(error: unknown): string;
|
|
9
12
|
export interface SyncStatus {
|
|
10
13
|
readonly enabled: boolean;
|
|
11
14
|
readonly synced: number;
|
|
15
|
+
readonly sessions: number;
|
|
16
|
+
readonly sessionsPendingBytes: number;
|
|
17
|
+
readonly sessionsQuotaExceeded: boolean;
|
|
12
18
|
readonly lastRun?: string;
|
|
13
19
|
readonly lastError?: string;
|
|
14
20
|
readonly lastErrorStatus?: number;
|
|
@@ -21,5 +27,9 @@ export interface SyncConnection {
|
|
|
21
27
|
readonly fetch?: typeof fetch;
|
|
22
28
|
}
|
|
23
29
|
export declare function syncRemote(connection: SyncConnection): HttpRemote;
|
|
24
|
-
export
|
|
30
|
+
export interface FullSyncReport extends SyncReport {
|
|
31
|
+
readonly sessions?: SessionSyncReport;
|
|
32
|
+
}
|
|
33
|
+
export declare function syncOnce(agentDir: string, account: string, remote: HttpRemote, sessions?: SessionSyncOptions): Promise<FullSyncReport>;
|
|
25
34
|
export declare function removeCloudCopies(agentDir: string, remote: HttpRemote): Promise<number>;
|
|
35
|
+
export declare function deleteCloudSession(agentDir: string, account: string, remote: HttpRemote, sessionId: string): Promise<boolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)})}
|
|
1
|
+
var N=Object.defineProperty;var r=(t,e)=>N(t,"name",{value:e,configurable:!0});var k=Object.defineProperty,a=r((t,e)=>k(t,"name",{value:e,configurable:!0}),"r");import{existsSync as R,readFileSync as T}from"node:fs";import{join as j}from"node:path";import{declaredDataFormat as x,t as i,withFileLockSync as L,writeFileAtomicSync as I}from"@dalcode/dal-pi-kit";import{createHttpRemote as _}from"./client.js";import{clearState as $,readState as m,runSync as J,SyncHttpError as P,writeState as q}from"./core.js";import{clearSessionsState as G,markSessionDeleted as C,readSessionsState as D,syncSessions as H,writeSessionsState as M}from"./sessions.js";const l="dalSync",U="https://deepailab.ai/dal-sync",f=a(t=>j(t,"settings.json"),"settingsPath");function E(t){try{const e=JSON.parse(T(t,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}catch{return}}r(E,"l"),a(E,"readJson");function d(t){return process.env.DAL_SYNC==="0"?!1:E(f(t))?.[l]?.enabled!==!1}r(d,"j"),a(d,"syncEnabled");function F(t){return typeof E(f(t))?.[l]?.enabled=="boolean"}r(F,"H"),a(F,"syncChosen");function p(t,e){if(F(t))return!1;const s=D(t);if(s?.noticeShownAt)return!1;const n=s?.account===e?s:{account:e,sessions:{},projects:{}};return M(t,{...n,noticeShownAt:new Date().toISOString()}),!0}r(p,"D"),a(p,"takeSyncNotice");function w(t,e){const s=f(t);L(s,()=>{if(R(s)&&E(s)===void 0)throw new Error(`${s} is not valid JSON; not overwriting it`);const n=E(s)??{};if(x(n)>1)throw new Error(`${s} was written by a newer DAL; not overwriting it`);const o=n[l]??{};n[l]={...o,enabled:e},I(s,`${JSON.stringify(n,null,2)}
|
|
2
|
+
`)})}r(w,"G"),a(w,"saveSyncEnabled");function y(t,e){return t.replace(/\{(\w+)\}/g,(s,n)=>n in e?String(e[n]):s)}r(y,"p"),a(y,"fill");function v(t){return t instanceof Error?t.name==="TimeoutError"||t.name==="AbortError"?!0:t instanceof TypeError&&/fetch failed|network|socket|ECONN|ENOTFOUND|ETIMEDOUT|EAI_AGAIN/i.test(`${t.message} ${String(t.cause??"")}`):!1}r(v,"P"),a(v,"isNetworkFailure");function S(t){return t instanceof P?t.status:v(t)?0:-1}r(S,"m"),a(S,"syncErrorStatus");function A(t){const e=S(t);if(e===401)return i("\u672A\u767B\u5F55 DeepAILab\uFF0C\u6216\u767B\u5F55\u5DF2\u8FC7\u671F\uFF1B\u767B\u5F55\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u540C\u6B65\u3002");if(e===404)return i("\u540C\u6B65\u670D\u52A1\u5C1A\u672A\u5F00\u653E\uFF0C\u5F00\u653E\u540E\u4F1A\u81EA\u52A8\u5F00\u59CB\u3002");if(e===503)return i("\u540C\u6B65\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002");if(e===-1){const s=t instanceof Error?t.message:String(t);return y(i("\u540C\u6B65\u51FA\u9519\uFF08{detail}\uFF09\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"),{detail:s.slice(0,200)})}return e?y(i("\u540C\u6B65\u8BF7\u6C42\u5931\u8D25\uFF08{status}\uFF09\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002"),{status:e}):i("\u7F51\u7EDC\u4E0D\u53EF\u7528\uFF0C\u7A0D\u540E\u81EA\u52A8\u91CD\u8BD5\u3002")}r(A,"L"),a(A,"syncErrorText");function b(t){const e=m(t),s=e?Object.values(e.items).filter(u=>!u.remoteDeleted&&u.version>0).length:0,n=D(t),o=n?Object.values(n.sessions).filter(u=>!u.remoteDeleted&&!u.skipped&&u.nextSeq>0):[];return{enabled:d(t),synced:s,sessions:o.length,sessionsPendingBytes:n?Object.values(n.sessions).filter(u=>!u.remoteDeleted&&!u.skipped).reduce((u,c)=>u+Math.max(0,c.size-c.offset),0):0,sessionsQuotaExceeded:n?.quotaExceeded===!0,...e?.lastRun?{lastRun:e.lastRun}:{},...e?.lastError?{lastError:e.lastError}:{},...e?.lastError&&e.lastErrorStatus!==void 0?{lastErrorStatus:e.lastErrorStatus}:{}}}r(b,"M"),a(b,"syncStatus");function g(t){return _(t)}r(g,"Q"),a(g,"syncRemote");async function h(t,e,s,n){try{const o=await J(t,e,s);return n?{...o,sessions:await H(t,e,s.sessions,n)}:o}catch(o){const u=m(t),c=u?.account===e;throw q(t,{account:e,items:c?u.items:{},lastRun:c?u.lastRun:void 0,lastError:A(o),lastErrorStatus:S(o)}),o}}r(h,"z"),a(h,"syncOnce");async function O(t,e){const s=await e.removeAll();return $(t),G(t),s}r(O,"K"),a(O,"removeCloudCopies");async function B(t,e,s,n){C(t,e,n,!0);const o=await s.sessions.remove(n);return C(t,e,n,!1),o}r(B,"V"),a(B,"deleteCloudSession");export{l as SETTINGS_KEY,U as SYNC_CONSOLE_URL,B as deleteCloudSession,O as removeCloudCopies,w as saveSyncEnabled,F as syncChosen,d as syncEnabled,S as syncErrorStatus,A as syncErrorText,h as syncOnce,g as syncRemote,b as syncStatus,p as takeSyncNotice};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)},"say"),
|
|
3
|
-
`)},"status");
|
|
1
|
+
var v=Object.defineProperty;var A=(t,e)=>v(t,"name",{value:e,configurable:!0});var T=Object.defineProperty,E=A((t,e)=>T(t,"name",{value:e,configurable:!0}),"r");import{hostname as I}from"node:os";import{t as s}from"@dalcode/dal-pi-kit";import{deepAILabApiBase as L,resolveDeepAILabAccessToken as w}from"@dalcode/deepailab";import{decodeJwtPayload as R}from"@dalcode/deepailab/oidc";import{getAgentDir as O,getDefaultSessionDir as _,VERSION as P}from"@earendil-works/pi-coding-agent";import{readState as k,SyncHttpError as x}from"./core.js";import{SYNC_CONSOLE_URL as d,syncErrorText as l,removeCloudCopies as j,syncOnce as M,saveSyncEnabled as g,syncEnabled as c,syncRemote as N,syncStatus as U,takeSyncNotice as $}from"./host.js";import{SETTINGS_KEY as Y,saveSyncEnabled as G,syncEnabled as H}from"./host.js";const K=2e4,W="DALCODE_GATEWAY_URL";function o(t,e){return t.replace(/\{(\w+)\}/g,(a,i)=>i in e?String(e[i]):a)}A(o,"a"),E(o,"fill");function m(t){const e=[];if(t.sessions){const a=t.sessions;e.push(o(s("\u5BF9\u8BDD\uFF1A\u4E0A\u4F20 {up}\uFF0C\u4E0B\u8F7D {down}"),{up:a.uploaded,down:a.downloaded+a.updated})),a.pendingBytes>0&&e.push(o(s("\u8FD8\u6709\u7EA6 {mb} MB \u7A0D\u540E\u7EE7\u7EED\u4E0A\u4F20"),{mb:Math.max(1,Math.round(a.pendingBytes/1048576))})),a.quotaExceeded&&e.push(s("\u8D26\u6237\u7684\u5BF9\u8BDD\u7A7A\u95F4\u5DF2\u6EE1\uFF0C\u65B0\u5BF9\u8BDD\u53EA\u4FDD\u5B58\u5728\u8FD9\u53F0\u7535\u8111"))}return e.push(o(s("\u6280\u80FD\u4E0E\u7ECF\u9A8C\uFF1A\u4E0A\u4F20 {n}"),{n:t.uploaded}),o(s("\u4E0B\u8F7D {n}"),{n:t.downloaded})),t.deletedRemote&&e.push(o(s("\u4E91\u7AEF\u5220\u9664 {n}"),{n:t.deletedRemote})),t.conflicts&&e.push(o(s("\u51B2\u7A81 {n}\uFF08\u6309\u8F83\u65B0\u7684\u4FEE\u6539\u5904\u7406\uFF09"),{n:t.conflicts})),t.refused.length&&e.push(o(s("\u672A\u4E0A\u4F20 {n}\uFF08\u8FC7\u5927\u6216\u7591\u4F3C\u542B\u5BC6\u94A5\uFF09"),{n:t.refused.length})),e.join(s("\uFF0C"))}A(m,"C"),E(m,"reportText");function b(t){const e=O();let a=Promise.resolve(),i;const D=E((n,u,F="info")=>{n.hasUI?n.ui.notify(u,F):process.stdout.write(`${u}
|
|
2
|
+
`)},"say"),f=E(n=>N({apiBase:L(),token:E(()=>w(n.modelRegistry),"token"),device:`${I()} (dal ${P})`}),"remoteFor"),p=E(async n=>{const u=await w(n.modelRegistry),F=u?R(u)?.sub:void 0;return typeof F=="string"&&F?F:void 0},"accountOf"),C=E(async(n,u)=>{const F=u??await p(n);if(!F)throw new x(401);return M(e,F,f(n),{sessionDirFor:E(r=>_(r,e),"sessionDirFor"),pullCwds:[n.cwd]})},"syncOnce"),y=E(n=>{if(!c(e)||!n.hasUI||process.env[W])return;const u=E(async()=>{const F=await p(n);F&&(await C(n,F),$(e,F)&&n.ui.notify(o(s("\u4F60\u7684\u5BF9\u8BDD\u3001\u4E2A\u4EBA\u6280\u80FD\u548C\u7ECF\u9A8C\u4F1A\u540C\u6B65\u5230 DeepAILab \u8D26\u6237\uFF0C\u6362\u7535\u8111\u767B\u5F55\u540E\u53EF\u4EE5\u63A5\u7740\u7528\u3002\u4E0A\u4F20\u524D\u4F1A\u53BB\u6389\u5BC6\u94A5\u3001\u5BC6\u7801\u548C\u4E3B\u76EE\u5F55\u8DEF\u5F84\uFF0C\u56FE\u7247\u4E0D\u4E0A\u4F20\u3002\u5728 {url} \u67E5\u770B\u548C\u5220\u9664\uFF1B/sync off \u5173\u95ED\u3002"),{url:d}),"info"))},"work");a=a.then(u,u).catch(()=>{})},"background");t.on("session_start",(n,u)=>{u.mode==="print"||u.mode==="json"||y(u)}),t.on("agent_end",(n,u)=>{u.mode==="print"||u.mode==="json"||!c(e)||(i&&clearTimeout(i),i=setTimeout(()=>y(u),K),i.unref?.())}),t.on("session_shutdown",async()=>{i&&clearTimeout(i),await Promise.race([a,new Promise(n=>setTimeout(n,5e3).unref?.())])});const S=E(()=>{const n=c(e),u=k(e),F=U(e),r=[n?s("\u540C\u6B65\uFF1A\u5DF2\u5F00\u542F\uFF08\u5BF9\u8BDD\u3001\u4E2A\u4EBA\u6280\u80FD\u548C\u7ECF\u9A8C\uFF09\u3002"):s("\u540C\u6B65\uFF1A\u5DF2\u5173\u95ED\uFF0C\u53EA\u4FDD\u5B58\u5728\u8FD9\u53F0\u7535\u8111\uFF08/sync on \u5F00\u542F\uFF09\u3002")];if((F.sessions||F.sessionsPendingBytes)&&(r.push(o(s("\u5DF2\u540C\u6B65\u5BF9\u8BDD {n} \u4E2A\u3002"),{n:F.sessions})),F.sessionsPendingBytes>0&&r.push(o(s("\u8FD8\u6709\u7EA6 {mb} MB \u5BF9\u8BDD\u5F85\u4E0A\u4F20\uFF0C\u4F1A\u5728\u540E\u53F0\u7EE7\u7EED\u3002"),{mb:Math.max(1,Math.round(F.sessionsPendingBytes/1048576))})),F.sessionsQuotaExceeded&&r.push(s("\u8D26\u6237\u7684\u5BF9\u8BDD\u7A7A\u95F4\u5DF2\u6EE1\uFF0C\u65B0\u5BF9\u8BDD\u53EA\u4FDD\u5B58\u5728\u8FD9\u53F0\u7535\u8111\u3002"))),u){const B=Object.values(u.items).filter(h=>!h.remoteDeleted&&h.version>0).length;r.push(o(s("\u5DF2\u540C\u6B65\u6280\u80FD\u4E0E\u7ECF\u9A8C {n} \u6761\u3002"),{n:B})),u.lastRun&&r.push(o(s("\u4E0A\u6B21\u540C\u6B65\uFF1A{time}"),{time:new Date(u.lastRun).toLocaleString()})),u.lastError&&r.push(u.lastError)}return r.push(o(s("\u5728 {url} \u67E5\u770B\u3001\u5220\u9664\u548C\u5BFC\u51FA\u3002"),{url:d})),r.join(`
|
|
3
|
+
`)},"status");t.registerCommand("sync",{description:s("\u5BF9\u8BDD\u3001\u4E2A\u4EBA\u6280\u80FD\u548C\u7ECF\u9A8C\u8DDF\u968F DeepAILab \u8D26\u6237\u540C\u6B65\uFF08/sync on | off | now | status\uFF09"),getArgumentCompletions:E(n=>{const u=["on","off","now","status"].filter(F=>F.startsWith(n.trim()));return u.length?u.map(F=>({value:F,label:F})):null},"getArgumentCompletions"),handler:E(async(n,u)=>{const[F="status",r]=n.trim().toLowerCase().split(/\s+/);if(F==="status"||F===""){D(u,S());return}if(F==="on"){g(e,!0),D(u,s("\u5DF2\u5F00\u542F\u3002\u4F1A\u540C\u6B65\uFF1A\u5BF9\u8BDD\u8BB0\u5F55\u3001\u4F60\u7684\u4E2A\u4EBA\u6280\u80FD\uFF08~/.dal/agent/skills\uFF09\u548C\u9002\u7528\u4E8E\u6240\u6709\u9879\u76EE\u7684\u4E2A\u4EBA\u7ECF\u9A8C\uFF1B\u5728\u53E6\u4E00\u53F0\u7535\u8111\u767B\u5F55\u540E\uFF0C\u540C\u4E00\u4E2A\u9879\u76EE\u91CC\u53EF\u4EE5\u63A5\u7740\u4E4B\u524D\u7684\u5BF9\u8BDD\u3002\u4E0D\u4F1A\u540C\u6B65\uFF1A\u9879\u76EE\u7ECF\u9A8C\u3001\u9879\u76EE\u6587\u4EF6\u3001\u56FE\u7247\u3001\u8BBE\u7F6E\u548C\u4EFB\u4F55\u51ED\u636E\u3002\u4E0A\u4F20\u524D\u4F1A\u53BB\u6389\u5BC6\u94A5\u3001\u5BC6\u7801\u548C\u4E3B\u76EE\u5F55\u8DEF\u5F84\u3002"));try{D(u,m(await C(u)))}catch(B){D(u,l(B),"warning")}return}if(F==="now"){if(!c(e)){D(u,s("\u540C\u6B65\u672A\u5F00\u542F\uFF0C\u5148\u8FD0\u884C /sync on\u3002"),"warning");return}try{D(u,m(await C(u)))}catch(B){D(u,l(B),"warning")}return}if(F==="off"){if(g(e,!1),!(r==="--delete-cloud"||u.hasUI&&await u.ui.confirm(s("\u5173\u95ED\u540C\u6B65"),s("\u540C\u65F6\u5220\u9664\u4E91\u7AEF\u7684\u526F\u672C\u5417\uFF08\u5BF9\u8BDD\u3001\u6280\u80FD\u548C\u7ECF\u9A8C\uFF09\uFF1F\u8FD9\u53F0\u7535\u8111\u4E0A\u7684\u5185\u5BB9\u4E0D\u53D7\u5F71\u54CD\u3002")))){D(u,o(s("\u5DF2\u5173\u95ED\uFF0C\u4E0D\u518D\u4E0A\u4F20\u3002\u4E91\u7AEF\u526F\u672C\u4FDD\u7559\uFF0C\u53EF\u5728 {url} \u5220\u9664\u3002"),{url:d}));return}try{const B=await j(e,f(u));D(u,o(s("\u5DF2\u5173\u95ED\uFF0C\u5E76\u5220\u9664\u4E86\u4E91\u7AEF\u7684 {n} \u6761\u3002"),{n:B}))}catch(B){D(u,`${s("\u5DF2\u5173\u95ED\uFF0C\u4F46\u4E91\u7AEF\u526F\u672C\u6CA1\u6709\u5220\u9664\uFF1A")}${l(B)}`,"warning")}return}D(u,s("\u7528\u6CD5\uFF1A/sync on | off | now | status"),"warning")},"handler")})}A(b,"H"),E(b,"default");export{Y as SETTINGS_KEY,b as default,G as saveSyncEnabled,H as syncEnabled};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export interface RemoteSession {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly generation: number;
|
|
4
|
+
readonly nextSeq: number;
|
|
5
|
+
readonly title: string | null;
|
|
6
|
+
readonly projectKey: string | null;
|
|
7
|
+
readonly projectName: string | null;
|
|
8
|
+
readonly cwd: string | null;
|
|
9
|
+
readonly device: string | null;
|
|
10
|
+
readonly entries: number;
|
|
11
|
+
readonly createdAt: string | null;
|
|
12
|
+
readonly modifiedAt: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface SessionMetaInput {
|
|
15
|
+
readonly generation: number;
|
|
16
|
+
readonly title: string | null;
|
|
17
|
+
readonly projectKey: string | null;
|
|
18
|
+
readonly projectName: string | null;
|
|
19
|
+
readonly cwd: string | null;
|
|
20
|
+
readonly createdAt: string | null;
|
|
21
|
+
readonly modifiedAt: string | null;
|
|
22
|
+
}
|
|
23
|
+
export type MetaResult = {
|
|
24
|
+
status: "ok";
|
|
25
|
+
session: RemoteSession;
|
|
26
|
+
} | {
|
|
27
|
+
status: "missing";
|
|
28
|
+
} | {
|
|
29
|
+
status: "conflict";
|
|
30
|
+
generation: number;
|
|
31
|
+
nextSeq: number;
|
|
32
|
+
} | {
|
|
33
|
+
status: "quota";
|
|
34
|
+
} | {
|
|
35
|
+
status: "refused";
|
|
36
|
+
reason: string;
|
|
37
|
+
};
|
|
38
|
+
export type AppendResult = {
|
|
39
|
+
status: "ok";
|
|
40
|
+
nextSeq: number;
|
|
41
|
+
} | {
|
|
42
|
+
status: "conflict";
|
|
43
|
+
generation: number;
|
|
44
|
+
nextSeq: number;
|
|
45
|
+
} | {
|
|
46
|
+
status: "missing";
|
|
47
|
+
} | {
|
|
48
|
+
status: "quota";
|
|
49
|
+
} | {
|
|
50
|
+
status: "refused";
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
export type ChunksResult = {
|
|
54
|
+
status: "ok";
|
|
55
|
+
generation: number;
|
|
56
|
+
nextSeq: number;
|
|
57
|
+
more: boolean;
|
|
58
|
+
chunks: {
|
|
59
|
+
seq: number;
|
|
60
|
+
data: string;
|
|
61
|
+
}[];
|
|
62
|
+
} | {
|
|
63
|
+
status: "conflict";
|
|
64
|
+
generation: number;
|
|
65
|
+
nextSeq: number;
|
|
66
|
+
} | {
|
|
67
|
+
status: "missing";
|
|
68
|
+
};
|
|
69
|
+
export interface SessionRemote {
|
|
70
|
+
list(projectKey?: string, limit?: number): Promise<RemoteSession[]>;
|
|
71
|
+
putMeta(id: string, meta: SessionMetaInput, options?: {
|
|
72
|
+
create?: boolean;
|
|
73
|
+
}): Promise<MetaResult>;
|
|
74
|
+
append(id: string, chunk: {
|
|
75
|
+
generation: number;
|
|
76
|
+
seq: number;
|
|
77
|
+
data: string;
|
|
78
|
+
modifiedAt: string | null;
|
|
79
|
+
}): Promise<AppendResult>;
|
|
80
|
+
chunks(id: string, generation: number, after: number): Promise<ChunksResult>;
|
|
81
|
+
remove(id: string): Promise<boolean>;
|
|
82
|
+
}
|
|
83
|
+
export declare const DEFAULT_RUN_BUDGET: {
|
|
84
|
+
uploadBytes: number;
|
|
85
|
+
downloadBytes: number;
|
|
86
|
+
ms: number;
|
|
87
|
+
};
|
|
88
|
+
interface SessionState {
|
|
89
|
+
file: string;
|
|
90
|
+
generation: number;
|
|
91
|
+
nextSeq: number;
|
|
92
|
+
offset: number;
|
|
93
|
+
tail: string;
|
|
94
|
+
size: number;
|
|
95
|
+
mtimeMs: number;
|
|
96
|
+
metaHash?: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
remoteDeleted?: boolean;
|
|
99
|
+
pendingDelete?: boolean;
|
|
100
|
+
deletedAt?: string;
|
|
101
|
+
skipped?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface ProjectState {
|
|
104
|
+
key: string | null;
|
|
105
|
+
name: string | null;
|
|
106
|
+
at: number;
|
|
107
|
+
}
|
|
108
|
+
export interface SessionsState {
|
|
109
|
+
account: string;
|
|
110
|
+
sessions: Record<string, SessionState>;
|
|
111
|
+
projects: Record<string, ProjectState>;
|
|
112
|
+
lastRun?: string;
|
|
113
|
+
quotaExceeded?: boolean;
|
|
114
|
+
noticeShownAt?: string;
|
|
115
|
+
}
|
|
116
|
+
export declare const sessionsStatePath: (agentDir: string) => string;
|
|
117
|
+
export declare function readSessionsState(agentDir: string): SessionsState | undefined;
|
|
118
|
+
export declare function writeSessionsState(agentDir: string, state: SessionsState): void;
|
|
119
|
+
export declare function markSessionDeleted(agentDir: string, account: string, sessionId: string, pending: boolean): void;
|
|
120
|
+
export declare function clearSessionsState(agentDir: string): void;
|
|
121
|
+
interface LocalSession {
|
|
122
|
+
readonly id: string;
|
|
123
|
+
readonly path: string;
|
|
124
|
+
readonly size: number;
|
|
125
|
+
readonly mtimeMs: number;
|
|
126
|
+
}
|
|
127
|
+
export declare function listLocalSessions(agentDir: string): LocalSession[];
|
|
128
|
+
export declare function cleanLine(line: string, home?: string): string | null;
|
|
129
|
+
export declare function normalizeRemote(url: string): string | undefined;
|
|
130
|
+
export declare function cwdLabel(cwd: string, home?: string): string;
|
|
131
|
+
export declare function projectIdentity(cwd: string, home?: string): ProjectState;
|
|
132
|
+
export interface SessionSyncOptions {
|
|
133
|
+
readonly sessionDirFor: (cwd: string) => string;
|
|
134
|
+
readonly pullCwds?: readonly string[];
|
|
135
|
+
readonly budget?: {
|
|
136
|
+
uploadBytes: number;
|
|
137
|
+
downloadBytes: number;
|
|
138
|
+
ms: number;
|
|
139
|
+
};
|
|
140
|
+
readonly home?: string;
|
|
141
|
+
readonly now?: () => number;
|
|
142
|
+
readonly localOnlyRoots?: readonly string[];
|
|
143
|
+
}
|
|
144
|
+
export interface SessionSyncReport {
|
|
145
|
+
uploaded: number;
|
|
146
|
+
downloaded: number;
|
|
147
|
+
updated: number;
|
|
148
|
+
pendingBytes: number;
|
|
149
|
+
quotaExceeded: boolean;
|
|
150
|
+
busy: boolean;
|
|
151
|
+
}
|
|
152
|
+
export declare function syncSessions(agentDir: string, account: string, remote: SessionRemote, options: SessionSyncOptions): Promise<SessionSyncReport>;
|
|
153
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var Ee=Object.defineProperty;var d=(n,e)=>Ee(n,"name",{value:e,configurable:!0});var Re=Object.defineProperty,f=d((n,e)=>Re(n,"name",{value:e,configurable:!0}),"u");import{execFileSync as Ie}from"node:child_process";import{createHash as de}from"node:crypto";import{appendFileSync as Je,closeSync as Fe,existsSync as le,mkdirSync as J,openSync as _e,readdirSync as me,readFileSync as pe,readSync as He,rmSync as G,statSync as L,utimesSync as Te}from"node:fs";import{homedir as K}from"node:os";import{basename as Ce,isAbsolute as Ue,join as k,relative as We,resolve as V}from"node:path";import{gunzipSync as Pe,gzipSync as Ze}from"node:zlib";import{redact as X}from"@dalcode/dal-learn/safety";import{writeFileAtomicSync as ye}from"@dalcode/dal-pi-kit";const he=2*1024*1024,ge=3*1024*1024,Ge=2e5,Ke=2e4,Se={uploadBytes:48*1024*1024,downloadBytes:64*1024*1024,ms:9e4},Ve=50,Xe=1440*60*1e3,Ye=2160*60*60*1e3,we=1,Qe=4096,et=600*1e3,xe=/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/,tt=["/tmp/","/private/tmp/","/var/folders/","/private/var/folders/"],U=f(n=>k(n,"sync","sessions.json"),"sessionsStatePath");function F(n){try{const e=JSON.parse(pe(U(n),"utf8"));return e.formatVersion!==we||typeof e.account!="string"?void 0:{account:e.account,sessions:e.sessions&&typeof e.sessions=="object"?e.sessions:{},projects:e.projects&&typeof e.projects=="object"?e.projects:{},lastRun:typeof e.lastRun=="string"?e.lastRun:void 0,quotaExceeded:e.quotaExceeded===!0,noticeShownAt:typeof e.noticeShownAt=="string"?e.noticeShownAt:void 0}}catch{return}}d(F,"G"),f(F,"readSessionsState");function _(n,e){J(k(n,"sync"),{recursive:!0,mode:448}),ye(U(n),`${JSON.stringify({formatVersion:we,...e})}
|
|
2
|
+
`,{mode:384})}d(_,"U"),f(_,"writeSessionsState");function qe(n,e,t,s){const i=F(n),o=i?.account===e,c=o?i.sessions:{},r=c[t];c[t]={file:r?.file??"",generation:r?.generation??0,nextSeq:r?.nextSeq??0,offset:r?.offset??0,tail:r?.tail??"",size:r?.size??0,mtimeMs:r?.mtimeMs??0,remoteDeleted:!0,pendingDelete:s,deletedAt:new Date().toISOString()},_(n,{account:e,sessions:c,projects:o?i.projects:{},noticeShownAt:i?.noticeShownAt,...o&&i.quotaExceeded?{quotaExceeded:!0}:{}})}d(qe,"at"),f(qe,"markSessionDeleted");function be(n){const e=F(n);G(U(n),{force:!0}),e?.noticeShownAt&&_(n,{account:e.account,sessions:{},projects:{},noticeShownAt:e.noticeShownAt})}d(be,"ct"),f(be,"clearSessionsState");function ze(n){const e=k(n,"sync","sessions.lock");J(k(n,"sync"),{recursive:!0,mode:448});try{J(e)}catch{try{if(Date.now()-L(e).mtimeMs<et)return;G(e,{recursive:!0,force:!0}),J(e)}catch{return}}return()=>G(e,{recursive:!0,force:!0})}d(ze,"$e"),f(ze,"tryLock");function Y(n){const e=k(n,"sessions");if(!le(e))return[];const t=[];for(const s of me(e,{withFileTypes:!0})){if(!s.isDirectory())continue;let i;try{i=me(k(e,s.name))}catch{continue}for(const o of i){if(!o.endsWith(".jsonl"))continue;const c=o.slice(o.indexOf("_")+1,-6);if(!xe.test(c)||c.length>128)continue;const r=k(e,s.name,o);try{const l=L(r);l.isFile()&&l.size>0&&t.push({id:c,path:r,size:l.size,mtimeMs:l.mtimeMs})}catch{}}}return t.sort((s,i)=>i.mtimeMs-s.mtimeMs)}d(Y,"ve"),f(Y,"listLocalSessions");function E(n,e,t){const s=Math.max(0,t-e),i=Buffer.alloc(s);if(s===0)return i;const o=_e(n,"r");try{let c=0;for(;c<s;){const r=He(o,i,c,s-c,e+c);if(r===0)break;c+=r}return i.subarray(0,c)}finally{Fe(o)}}d(E,"T"),f(E,"readRange");function N(n,e){return de("sha256").update(E(n,Math.max(0,e-Qe),e)).digest("hex")}d(N,"L"),f(N,"tailHash");function Me(n){const e=E(n,0,1048576).toString("utf8"),t=e.slice(0,e.indexOf(`
|
|
3
|
+
`)>=0?e.indexOf(`
|
|
4
|
+
`):e.length);try{const s=JSON.parse(t);return s?.type==="session"&&typeof s.id=="string"?s:void 0}catch{return}}d(Me,"He"),f(Me,"readHeader");function Q(n,e=tt){if(!n)return!1;const t=n.endsWith("/")?n:`${n}/`;return e.some(s=>t.startsWith(s))}d(Q,"de"),f(Q,"isTemporary");function je(n,e){return n.length<=e?n:`${n.slice(0,e)}
|
|
5
|
+
[\u2026 ${n.length-e} characters not synced]`}d(je,"Ce"),f(je,"truncate");function H(n,e,t){if(typeof n=="string"){const s=je(n,e);return X(t&&t.length>1?s.split(t).join("~"):s)}if(Array.isArray(n))return n.map(s=>H(s,e,t));if(n&&typeof n=="object"){const s=n;if(s.type==="image"&&(typeof s.data=="string"||typeof s.source=="object"))return{type:"text",text:"[image not synced]"};const i={};for(const[o,c]of Object.entries(s))i[o]=H(c,e,t);return i}return n}d(H,"P"),f(H,"clean");function ee(n,e){let t;try{t=JSON.parse(n)}catch{return null}if(!t||typeof t!="object"||typeof t.type!="string")return null;let s=JSON.stringify(H(t,Ge,e));if(Buffer.byteLength(s)>ge&&(s=JSON.stringify(H(t,Ke,e))),Buffer.byteLength(s)>ge){const i={type:t.type,id:t.id,parentId:t.parentId,timestamp:t.timestamp},o=t.message;o&&typeof o=="object"&&(i.message={role:o.role,content:[{type:"text",text:"[content too large, not synced]"}]}),s=JSON.stringify(i)}return s}d(ee,"Je"),f(ee,"cleanLine");function T(n){try{const e=JSON.parse(n);return e.type!=="session"&&typeof e.id=="string"?e.id:void 0}catch{return}}d(T,"$"),f(T,"entryId");function ve(n){if(n.type!=="message")return;const e=n.message;if(e?.role!=="user")return;const t=e.content;if(typeof t=="string")return t;if(Array.isArray(t)){const s=t.find(i=>i.type==="text");return typeof s?.text=="string"?s.text:void 0}}d(ve,"Fe"),f(ve,"userText");function Oe(n,e){let t=e,s=!1;for(const i of n){if(!i.includes('"session_info"')&&(t||!i.includes('"user"')))continue;let o;try{o=JSON.parse(i)}catch{continue}if(o.type==="session_info"&&typeof o.name=="string"&&o.name.trim()){t=o.name.trim(),s=!0;continue}if(!t&&!s){const c=ve(o)?.replace(/\s+/g," ").trim();c&&(t=c)}}return t?X(t).slice(0,120):void 0}d(Oe,"Ke"),f(Oe,"titleFrom");function te(n){let e=n.trim();if(!e)return;const t=/^([^@/\s]+@)?([^:/\s]+):(?!\/)(.+)$/.exec(e);t&&!/^[a-z]+:\/\//i.test(e)&&(e=`ssh://${t[2]}/${t[3]}`);try{const s=new URL(e),i=s.pathname.replace(/\.git$/i,"").replace(/\/+$/,"");return!s.hostname||!i?void 0:`${s.hostname.toLowerCase()}${i.toLowerCase()}`}catch{return}}d(te,"Ge"),f(te,"normalizeRemote");function Ae(n){try{return Ie("git",["-C",n,"config","--get","remote.origin.url"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}d(Ae,"Ue"),f(Ae,"gitRemote");function W(n,e=K()){const t=We(e,n);return t===""?"~":t&&!t.startsWith("..")&&!Ue(t)?`~/${t}`:X(n)}d(W,"fe"),f(W,"cwdLabel");function ne(n,e=K()){const t=le(n)?Ae(n):void 0,s=t?te(t):void 0,i=Date.now();return s?{key:P(`git:${s}`).slice(0,32),name:s.split("/").pop()??null,at:i}:{key:P(`path:${W(n,e)}`).slice(0,32),name:Ce(n)||null,at:i}}d(ne,"We"),f(ne,"projectIdentity");function P(n){return de("sha256").update(n).digest("hex")}d(P,"W"),f(P,"sha");async function De(n,e,t,s){const i={uploaded:0,downloaded:0,updated:0,pendingBytes:0,quotaExceeded:!1,busy:!1},o=ze(n);if(!o)return{...i,busy:!0};try{return await ke(n,e,t,s,i)}finally{o()}}d(De,"ut"),f(De,"syncSessions");async function ke(n,e,t,s,i){const o=s.now??Date.now,c=o(),r=s.budget??Se,l=s.home??K(),g=F(n),m=g?.account===e?g:{account:e,sessions:{},projects:{},noticeShownAt:g?.noticeShownAt};let x=0,z=0;const v=f(()=>o()-c>r.ms,"overBudget"),R=f(()=>_(n,{...m,lastRun:new Date(o()).toISOString()}),"save"),M=f(p=>{const a=m.projects[p];if(a&&o()-a.at<Xe)return a;const u=ne(p,l);return m.projects[p]=u,u},"project"),h=Y(n),j=new Map(h.map(p=>[p.id,p]));for(const[p,a]of Object.entries(m.sessions))a.pendingDelete&&(await t.remove(p),a.pendingDelete=!1);for(const p of s.pullCwds??[]){if(v()||z>r.downloadBytes)break;if(Q(p,s.localOnlyRoots))continue;const{key:a}=M(V(p));if(!a)continue;const u=await t.list(a,Ve);for(const y of u){if(v()||z>r.downloadBytes)break;if(!xe.test(y.id)||y.nextSeq===0)continue;const b=m.sessions[y.id];if(b?.remoteDeleted)continue;const S=j.get(y.id);if(b&&S&&b.file===S.path){if(y.generation!==b.generation||y.nextSeq<=b.nextSeq||S.size!==b.offset)continue;const I=await Z(t,y.id,y.generation,b.nextSeq-1);if(!I)continue;z+=I.bytes;const C=oe(S.path,I.lines),$=L(S.path);Object.assign(b,{nextSeq:I.nextSeq,offset:$.size,tail:N(S.path,$.size),size:$.size,mtimeMs:$.mtimeMs}),C&&i.updated++;continue}if(S||b)continue;const D=await Z(t,y.id,y.generation,-1);if(!D)continue;z+=D.bytes;const O=$e(s.sessionDirFor(V(p)),V(p),y,D.lines),A=L(O);m.sessions[y.id]={file:O,generation:D.generation,nextSeq:D.nextSeq,offset:A.size,tail:N(O,A.size),size:A.size,mtimeMs:A.mtimeMs,title:y.title??void 0},j.set(y.id,{id:y.id,path:O,size:A.size,mtimeMs:A.mtimeMs}),i.downloaded++}R()}for(const p of h){let a;try{const w=L(p.path);a={id:p.id,path:p.path,size:w.size,mtimeMs:w.mtimeMs}}catch{continue}let u=m.sessions[a.id];if(u&&u.file===a.path&&u.size===a.size&&u.mtimeMs===a.mtimeMs&&(u.offset>=a.size||u.skipped||u.remoteDeleted))continue;if(u?.remoteDeleted){Object.assign(u,{file:a.path,size:a.size,mtimeMs:a.mtimeMs});continue}if(m.quotaExceeded||v()||x>r.uploadBytes){i.pendingBytes+=Math.max(0,a.size-(u?.file===a.path?u.offset:0));continue}const y=Me(a.path);if(!y||y.id!==a.id||Q(y.cwd,s.localOnlyRoots)){m.sessions[a.id]={file:a.path,generation:0,nextSeq:0,offset:0,tail:"",size:a.size,mtimeMs:a.mtimeMs,skipped:!0};continue}u?.skipped&&(u=void 0);let b=u?.generation??1,S=u?.offset??0,D=u?.nextSeq??0;u&&(u.file!==a.path||a.size<u.offset||N(a.path,u.offset)!==u.tail)&&(b=u.generation+1,S=0,D=0);const O=typeof y.cwd=="string"?y.cwd:"",A=O?M(O):{key:null,name:null,at:0},I=se(a.path,S,a.size,r.uploadBytes-x),C=E(a.path,S,I).toString("utf8"),$=C?C.slice(0,-1).split(`
|
|
6
|
+
`):[],re=Oe($,u?.title),ce={generation:b,title:re??null,projectKey:A.key,projectName:A.name,cwd:O?W(O,l):null,createdAt:typeof y.timestamp=="string"?y.timestamp:null,modifiedAt:new Date(a.mtimeMs).toISOString()},fe=P(JSON.stringify(ce)),q={file:a.path,generation:b,nextSeq:D,offset:S,tail:S>0?N(a.path,S):"",size:a.size,mtimeMs:a.mtimeMs,metaHash:u?.metaHash,title:re};if(m.sessions[a.id]=q,q.metaHash!==fe||!u){const w=await t.putMeta(a.id,ce,{create:!u||u.nextSeq===0});if(w.status==="missing"){q.remoteDeleted=!0;continue}if(w.status==="quota"){m.quotaExceeded=!0,i.quotaExceeded=!0;continue}if(w.status==="refused"){q.skipped=!0;continue}if(w.status==="conflict"||w.status==="ok"&&w.session.nextSeq!==q.nextSeq){const Be=w.status==="ok"?w.session.generation:w.generation,Le=w.status==="ok"?w.session.nextSeq:w.nextSeq,ue=await ae(t,a,q,Be,Le,i,l);if(x+=ue,ue<0)continue;q.metaHash=void 0;continue}q.metaHash=fe}const B=await ie(t,a,q,$,S,l);x+=B.bytes,B.chunks>0&&i.uploaded++,B.outcome==="conflict"?x+=Math.max(0,await ae(t,a,q,B.generation,B.nextSeq,i,l)):B.outcome==="missing"?(q.nextSeq>0||u)&&(q.remoteDeleted=!0):B.outcome==="quota"&&(m.quotaExceeded=!0,i.quotaExceeded=!0),q.offset<a.size&&(i.pendingBytes+=a.size-q.offset),R()}for(const[p,a]of Object.entries(m.sessions))j.has(p)||a.pendingDelete||a.deletedAt&&o()-Date.parse(a.deletedAt)<Ye||delete m.sessions[p];return R(),i}d(ke,"Xe"),f(ke,"run");function se(n,e,t,s){const i=Math.min(t,e+Math.max(s,he)),o=E(n,e,i).lastIndexOf(10);if(o>=0)return e+o+1;if(i<t){const c=E(n,e,t).indexOf(10);if(c>=0)return e+c+1}return e}d(se,"le"),f(se,"lastNewline");async function ie(n,e,t,s,i,o,c){let r=i,l=0,g=0,m=[],x=0,z=0;const v=f(async()=>{if(m.length===0){r+=z,z=0;return}const M=Ze(Buffer.from(`${m.join(`
|
|
7
|
+
`)}
|
|
8
|
+
`,"utf8")).toString("base64"),h=await n.append(e.id,{generation:t.generation,seq:t.nextSeq,data:M,modifiedAt:new Date(e.mtimeMs).toISOString()});if(h.status==="conflict")return{outcome:"conflict",bytes:l,chunks:g,generation:h.generation,nextSeq:h.nextSeq};if(h.status==="missing"||h.status==="quota")return{outcome:h.status,bytes:l,chunks:g};h.status==="ok"&&(t.nextSeq=h.nextSeq,g++),l+=x,r+=z,t.offset=r,t.tail=N(e.path,r),m=[],x=0,z=0},"flush");for(const M of s){if(z+=Buffer.byteLength(M,"utf8")+1,c&&!c(M))continue;const h=ee(M,o);if(h!==null&&(m.push(h),x+=Buffer.byteLength(h,"utf8")+1,x>=he)){const j=await v();if(j)return j}}return await v()||(t.offset=r,t.tail=r>0?N(e.path,r):"",{outcome:"done",bytes:l,chunks:g})}d(ie,"me"),f(ie,"sendLines");async function Z(n,e,t,s){const i=[];let o=0,c=s;for(;;){const r=await n.chunks(e,t,c);if(r.status!=="ok")return;for(const l of r.chunks){const g=Pe(Buffer.from(l.data,"base64")).toString("utf8");o+=g.length;for(const m of g.split(`
|
|
9
|
+
`))m&&i.push(m);c=l.seq}if(!r.more||r.chunks.length===0)return{lines:i,generation:r.generation,nextSeq:r.nextSeq,bytes:o}}}d(Z,"X"),f(Z,"fetchLines");function oe(n,e){const t=new Set;for(const i of pe(n,"utf8").split(`
|
|
10
|
+
`)){const o=i?T(i):void 0;o&&t.add(o)}const s=e.filter(i=>{const o=T(i);return o!==void 0&&!t.has(o)});return s.length&&Je(n,`${s.join(`
|
|
11
|
+
`)}
|
|
12
|
+
`),s.length}d(oe,"ge"),f(oe,"appendMissing");function Ne(n){return(n&&!Number.isNaN(Date.parse(n))?new Date(Date.parse(n)):new Date).toISOString().replace(/[:.]/g,"-")}d(Ne,"Ye"),f(Ne,"fileStamp");function $e(n,e,t,s){J(n,{recursive:!0});let i;const o=[];for(const g of s){if(!i)try{const m=JSON.parse(g);if(m.type==="session"){i=m;continue}}catch{}o.push(g)}const c={...i??{type:"session",version:3,id:t.id,timestamp:t.createdAt??new Date().toISOString()},id:t.id,cwd:e},r=k(n,`${Ne(typeof c.timestamp=="string"?c.timestamp:t.createdAt)}_${t.id}.jsonl`);ye(r,`${[JSON.stringify(c),...o].join(`
|
|
13
|
+
`)}
|
|
14
|
+
`);const l=t.modifiedAt?Date.parse(t.modifiedAt):Number.NaN;return Number.isNaN(l)||Te(r,new Date(l),new Date(l)),r}d($e,"Ze"),f($e,"writeDownloaded");async function ae(n,e,t,s,i,o,c){const r=s===t.generation&&t.nextSeq>0,l=await Z(n,e.id,s,r?t.nextSeq-1:-1);if(!l)return-1;const g=new Set(l.lines.map(T).filter(j=>j!==void 0)),m=L(e.path).size,x=r?t.offset:0,z=se(e.path,x,m,Number.MAX_SAFE_INTEGER),v=E(e.path,x,z).toString("utf8"),R=v?v.slice(0,-1).split(`
|
|
15
|
+
`):[];oe(e.path,l.lines)&&o.updated++,t.generation=l.generation,t.nextSeq=l.nextSeq;const M=await ie(n,e,t,R,x,c,f(j=>{const p=T(j);return p===void 0?l.nextSeq===0:!g.has(p)},"ownOnly"));if(M.outcome!=="done")return-1;M.chunks>0&&o.uploaded++;const h=L(e.path);return Object.assign(t,{offset:h.size,tail:N(e.path,h.size),size:h.size,mtimeMs:h.mtimeMs}),M.bytes}d(ae,"pe"),f(ae,"reconcile");export{Se as DEFAULT_RUN_BUDGET,ee as cleanLine,be as clearSessionsState,W as cwdLabel,Y as listLocalSessions,qe as markSessionDeleted,te as normalizeRemote,ne as projectIdentity,F as readSessionsState,U as sessionsStatePath,De as syncSessions,_ as writeSessionsState};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-telemetry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dalcode/dal-learn": "1.0.
|
|
29
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
30
|
-
"@dalcode/deepailab": "1.0.
|
|
28
|
+
"@dalcode/dal-learn": "1.0.57",
|
|
29
|
+
"@dalcode/dal-pi-kit": "1.0.57",
|
|
30
|
+
"@dalcode/deepailab": "1.0.57"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|