@augmentd-labs/canvas-edge 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +661 -0
  2. package/NOTICE +114 -0
  3. package/README.md +76 -2
  4. package/bin/canvas-edge +2 -0
  5. package/bin/healthcheck.mjs +9 -0
  6. package/node_modules/canvas-stored/LICENSE +661 -0
  7. package/node_modules/canvas-stored/NOTICE +85 -0
  8. package/node_modules/canvas-stored/README.md +472 -0
  9. package/node_modules/canvas-stored/package.json +26 -0
  10. package/node_modules/canvas-stored/src/backends/BackendManager.js +60 -0
  11. package/node_modules/canvas-stored/src/backends/StorageBackend.js +72 -0
  12. package/node_modules/canvas-stored/src/backends/cacache/index.js +130 -0
  13. package/node_modules/canvas-stored/src/backends/canvas/index.js +722 -0
  14. package/node_modules/canvas-stored/src/backends/file/index.js +658 -0
  15. package/node_modules/canvas-stored/src/backends/gdrive/index.js +924 -0
  16. package/node_modules/canvas-stored/src/backends/http/index.js +47 -0
  17. package/node_modules/canvas-stored/src/backends/s3/index.js +25 -0
  18. package/node_modules/canvas-stored/src/cache/index.js +65 -0
  19. package/node_modules/canvas-stored/src/extractors/audio.js +53 -0
  20. package/node_modules/canvas-stored/src/extractors/image.js +90 -0
  21. package/node_modules/canvas-stored/src/extractors/index.js +41 -0
  22. package/node_modules/canvas-stored/src/extractors/text.js +65 -0
  23. package/node_modules/canvas-stored/src/index/index.js +360 -0
  24. package/node_modules/canvas-stored/src/index.js +2058 -0
  25. package/node_modules/canvas-stored/src/sync/JobQueue.js +0 -0
  26. package/node_modules/canvas-stored/src/sync/Ledger.js +138 -0
  27. package/node_modules/canvas-stored/src/sync/Mirror.js +995 -0
  28. package/node_modules/canvas-stored/src/sync/SyncQueue.js +111 -0
  29. package/node_modules/canvas-stored/src/sync/keys.js +140 -0
  30. package/node_modules/canvas-stored/src/sync/worker.js +52 -0
  31. package/node_modules/canvas-stored/src/utils/checksum.js +32 -0
  32. package/node_modules/canvas-stored/src/utils/common.js +37 -0
  33. package/node_modules/canvas-stored/src/utils/mime.js +107 -0
  34. package/node_modules/canvas-stored/src/utils/mount.js +99 -0
  35. package/package.json +49 -4
  36. package/src/EdgeClient.js +129 -0
  37. package/src/control.js +48 -0
  38. package/src/daemon.js +88 -0
  39. package/src/env.js +182 -0
  40. package/src/fuse-runtime.js +173 -0
  41. package/src/index.js +26 -0
  42. package/src/mirror-runtime.js +232 -0
  43. package/src/remote-config.js +69 -0
  44. package/src/runtime.js +61 -0
package/NOTICE ADDED
@@ -0,0 +1,114 @@
1
+ Canvas
2
+ Copyright (C) 2023-2026 Jozef Melich
3
+
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License as published by the Free
6
+ Software Foundation, either version 3 of the License, or (at your option) any
7
+ later version.
8
+
9
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
+ PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
12
+
13
+ You should have received a copy of the GNU Affero General Public License along
14
+ with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ Contact:
17
+ lic@augmentd.eu licensing
18
+ contrib@augmentd.eu contributions
19
+ security@augmentd.eu security
20
+
21
+
22
+ NETWORK USE
23
+ -----------
24
+
25
+ Section 13 of the AGPL applies to this software. If you run a modified version
26
+ and let users interact with it over a network, those users must be able to
27
+ obtain the corresponding source of your modified version.
28
+
29
+ This server implements its side of that obligation. Every HTTP response carries
30
+ an `X-Source-Code` header, and `GET /rest/v2/ping` (no authentication required)
31
+ reports the running version, revision and source URL:
32
+
33
+ curl -sI https://your-host/ | grep -i x-source-code
34
+ curl -s https://your-host/rest/v2/ping
35
+
36
+ If you deploy a modified version, repoint these at the repository that publishes
37
+ your changes. Set `CANVAS_SOURCE_URL`, and set `CANVAS_SOURCE_COMMIT` where the
38
+ build has no git metadata, as in the container image. Removing the notice
39
+ instead of repointing it does not satisfy the licence.
40
+
41
+
42
+ COPYRIGHT AND COMMERCIAL LICENSING
43
+ ----------------------------------
44
+
45
+ Copyright in this codebase is held by Jozef Melich. Augmentd s.r.o. holds an
46
+ exclusive licence to it, including the right to grant sublicences, and is the
47
+ entity authorised to issue commercial licences for Canvas.
48
+
49
+ The AGPL is not the only option for the components marked [dual] below. If its
50
+ terms do not work for you, most often because you want to build a commercial or
51
+ hosted product on Canvas without publishing your own changes, a separate
52
+ commercial licence is available for those components, and no AGPL obligation
53
+ applies to it. See COMMERCIAL.md.
54
+
55
+ The Canvas clients marked [AGPL] are available under the AGPL-3.0-or-later and
56
+ under no other terms. No commercial licence is offered for them to anyone,
57
+ including holders of a commercial licence to the server runtime. The clients
58
+ stay free software in all cases.
59
+
60
+ Licensing enquiries: lic@augmentd.eu
61
+
62
+ Augmentd s.r.o.
63
+ DUETT Business Center
64
+ Námestie Osloboditeľov 3/A
65
+ 040 01 Košice, Slovakia
66
+ Company ID: 45331936
67
+ VAT ID: SK2022968717
68
+ https://augmentd.eu
69
+
70
+
71
+ COMPONENTS
72
+ ----------
73
+
74
+ Canvas is assembled from several repositories. They are not all licensed the
75
+ same way. Every component is available under the AGPL-3.0-or-later; only those
76
+ marked [dual] are also available under a commercial licence. Components in
77
+ separate repositories each carry their own LICENSE and NOTICE.
78
+
79
+ The server runtime and the services behind it, together the engine:
80
+
81
+ [dual] canvas-server this repository, server runtime, transports, core
82
+ src/services/messaging notification and chat channels
83
+ src/services/voice speech-to-text and text-to-speech
84
+ src/core/agent agent runtime
85
+ [dual] canvas-synapsd (dependency) context indexing engine
86
+ [dual] canvas-stored (dependency) blob storage
87
+ [dual] canvas-inferd (dependency) inference service
88
+ [dual] canvas-agentd (repository) agent runtime service, consolidating
89
+ the former canvas-neurald
90
+ [dual] packages/* (monorepo) shared libraries: protocol, schemas,
91
+ api-client
92
+
93
+ The client applications, AGPL-only for everyone. Most live in the Canvas
94
+ monorepo, https://github.com/canvas-ui/canvas:
95
+
96
+ [AGPL] apps/cli (monorepo) command-line client
97
+ [AGPL] apps/web (monorepo) web UI, served by this server
98
+ [AGPL] apps/shell (monorepo) shell client and applets
99
+ [AGPL] apps/desktop (monorepo) desktop app
100
+ [AGPL] apps/browser-extension (monorepo) Chrome and Firefox extensions
101
+ [AGPL] canvas-fuse (repository) FUSE filesystem client
102
+
103
+ A commercial licence to a [dual] component grants no rights over an [AGPL] one.
104
+ If you hold a commercial licence to the server runtime and you modify and convey
105
+ the CLI, the AGPL applies to that CLI in full. The same holds for the web UI:
106
+ it is AGPL-only, and serving a modified web UI to users over a network obliges
107
+ you to offer them its corresponding source, whatever engine licence you hold.
108
+
109
+
110
+ THIRD-PARTY CODE
111
+ ----------------
112
+
113
+ Third-party dependencies keep their own licences. See the dependency manifests
114
+ and node_modules for their terms. This notice covers Canvas code only.
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # @augmentd-labs/canvas-edge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The device-side Canvas runtime. One Node process, two jobs:
4
+
5
+ - **mirror** — keep real folders in sync with hub workspaces (canvas-stored's
6
+ `Mirror` engine, state under `<folder>/.workspace/` or an external state dir). Configured by the CLI's
7
+ `~/.canvas/config/mirrors.json` (`canvas remote mirror init`), driven over a local
8
+ control socket (`~/.canvas/run/edge.sock`, a localhost port on Windows).
9
+ - **tunnel** — `EdgeClient` dials out to a canvas-server, announces what this
10
+ runtime hosts and replays proxied requests into a local fastify app, so a
11
+ remote workspace or agent behaves as if it were server-local. The hub side
12
+ (`EdgeRegistry`) lives in canvas-server.
13
+
14
+ No canvas-server imports: the same package backs `ws`, canvas-agentd and the
15
+ desktop sidecar. This is the seed of the generic standalone runtime
16
+ (`mirror | workspace | agent` units behind one lifecycle).
17
+
18
+ ```
19
+ canvas-edge --foreground # run attached (pm2 / systemd); logs to stdout
20
+ canvas-edge # detached, logs to ~/.canvas/var/log/canvas-edge.log
21
+ ```
22
+
23
+ ## Install
24
+
25
+ Not on npm yet. The pipeline publishes a self-contained artifact branch,
26
+ `edge-dist`. The CLI fetches it into its own prefix:
27
+
28
+ ```
29
+ canvas remote mirror edge install # → ~/.canvas/edge/node_modules/@augmentd-labs/canvas-edge
30
+ canvas remote mirror edge update # latest edge-dist + restart the daemon
31
+ ```
32
+
33
+ (`npm install --ignore-scripts github:canvas-ui/canvas#edge-dist` in any
34
+ project does the same; avoid `npm -g` — global installs of git packages with
35
+ bundled deps came out incomplete on npm 11.) `canvas remote mirror init` offers the
36
+ install when the binary is missing. The
37
+ artifact bundles its workspace/git dependencies (canvas-protocol,
38
+ canvas-stored) and keeps only registry dependencies external — see
39
+ `scripts/pack-dist.mjs`.
40
+
41
+ ## fuse units (on-demand mounts, e.g. a GPU workstation)
42
+
43
+ A mirrors.json entry with `client: 'fuse', managed: 'edge'` is a **fuse unit**:
44
+ the daemon spawns `canvas-fuse mount -w <ws> <root> --remote <id> --mirror …`
45
+ attached, restarts it with backoff when it dies, reads `canvas-fuse status
46
+ --json` for its state and unmounts it on stop — one process per workspace
47
+ under one root (`<root>/<folder>`), as many units as workspaces. canvas-fuse
48
+ stays a plain executable (`CANVAS_FUSE_BIN`, `~/.cargo/bin`, PATH); its
49
+ on-demand namespace, content cache, pins and LRU are its own. `canvas remote
50
+ mirror add <ws> --edge` (or `… supervisor <ws> edge`) configures one.
51
+
52
+ ## Container (NAS, servers)
53
+
54
+ `runtimes/edge/Dockerfile` installs the `edge-dist` artifact into an
55
+ unprivileged image; one container mirrors one workspace, configured by
56
+ environment (no CLI needed on the host):
57
+
58
+ ```
59
+ docker build -t canvas-edge -f runtimes/edge/Dockerfile .
60
+ docker run -d --name canvas-edge-augmentd --restart unless-stopped \
61
+ -e CANVAS_HUB_URL=https://canvas.example.org -e CANVAS_HUB_TOKEN=canvas-… \
62
+ -e CANVAS_WORKSPACE=augmentd -e CANVAS_DIRECTION=pull -e CANVAS_DEVICE_ID=nas-synology \
63
+ -v /volume1/work/Augmentd:/data -v canvas-edge-config:/config -v canvas-edge-state:/state \
64
+ canvas-edge
65
+ ```
66
+
67
+ `docker/docker-compose.example.yml` is the same as a compose project (what
68
+ Synology Container Manager takes). `canvas remote mirror docker <workspace>`
69
+ prints one filled in from a remote you are logged in to. State (ledger,
70
+ queue, cache, trash, conflicts) lives under `/state/<mirror id>`
71
+ (`CANVAS_EDGE_STATE_ROOT`), so the mirrored share holds user files only; a
72
+ non-container mirror gets the same with `--state-dir` (`stateDir` in
73
+ mirrors.json). `CANVAS_DIRECTION=pull` makes the container a backup target
74
+ (hub is the only writer), `bi` while seeding from existing files.
75
+
76
+ Protocol: canvas-server `docs/canvas-edge-protocol.md` (tunnel) and
77
+ `docs/sync-protocol.md` (file plane).
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import('../src/daemon.js').then((m) => m.main()).catch((err) => { console.error(err); process.exit(1); });
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ // Container health: the control socket answers /status. Exit 0 when it does.
3
+ import http from 'node:http';
4
+ import { EDGE_PATHS } from '../src/env.js';
5
+
6
+ const opts = EDGE_PATHS.socket ? { socketPath: EDGE_PATHS.socket, path: '/status' } : { host: '127.0.0.1', port: EDGE_PATHS.port, path: '/status' };
7
+ const req = http.get(opts, (res) => { process.exit(res.statusCode === 200 ? 0 : 1); });
8
+ req.on('error', () => process.exit(1));
9
+ req.setTimeout(5000, () => { req.destroy(); process.exit(1); });