@augmentd-labs/canvas-edge 0.0.0-stage → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/NOTICE +112 -0
- package/README.md +76 -2
- package/bin/canvas-edge +2 -0
- package/bin/healthcheck.mjs +9 -0
- package/node_modules/canvas-stored/LICENSE +661 -0
- package/node_modules/canvas-stored/NOTICE +85 -0
- package/node_modules/canvas-stored/README.md +472 -0
- package/node_modules/canvas-stored/package.json +26 -0
- package/node_modules/canvas-stored/src/backends/BackendManager.js +60 -0
- package/node_modules/canvas-stored/src/backends/StorageBackend.js +72 -0
- package/node_modules/canvas-stored/src/backends/cacache/index.js +130 -0
- package/node_modules/canvas-stored/src/backends/canvas/index.js +722 -0
- package/node_modules/canvas-stored/src/backends/file/index.js +658 -0
- package/node_modules/canvas-stored/src/backends/gdrive/index.js +924 -0
- package/node_modules/canvas-stored/src/backends/http/index.js +47 -0
- package/node_modules/canvas-stored/src/backends/s3/index.js +25 -0
- package/node_modules/canvas-stored/src/cache/index.js +65 -0
- package/node_modules/canvas-stored/src/extractors/audio.js +53 -0
- package/node_modules/canvas-stored/src/extractors/image.js +90 -0
- package/node_modules/canvas-stored/src/extractors/index.js +41 -0
- package/node_modules/canvas-stored/src/extractors/text.js +65 -0
- package/node_modules/canvas-stored/src/index/index.js +360 -0
- package/node_modules/canvas-stored/src/index.js +2058 -0
- package/node_modules/canvas-stored/src/sync/JobQueue.js +0 -0
- package/node_modules/canvas-stored/src/sync/Ledger.js +138 -0
- package/node_modules/canvas-stored/src/sync/Mirror.js +995 -0
- package/node_modules/canvas-stored/src/sync/SyncQueue.js +111 -0
- package/node_modules/canvas-stored/src/sync/keys.js +140 -0
- package/node_modules/canvas-stored/src/sync/worker.js +52 -0
- package/node_modules/canvas-stored/src/utils/checksum.js +32 -0
- package/node_modules/canvas-stored/src/utils/common.js +37 -0
- package/node_modules/canvas-stored/src/utils/mime.js +107 -0
- package/node_modules/canvas-stored/src/utils/mount.js +99 -0
- package/package.json +49 -4
- package/src/EdgeClient.js +129 -0
- package/src/control.js +48 -0
- package/src/daemon.js +88 -0
- package/src/env.js +182 -0
- package/src/fuse-runtime.js +173 -0
- package/src/index.js +26 -0
- package/src/mirror-runtime.js +232 -0
- package/src/remote-config.js +69 -0
- package/src/runtime.js +61 -0
package/NOTICE
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
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] canvas-common/packages/* (repository) shared libraries: protocol, schemas,
|
|
91
|
+
api-client
|
|
92
|
+
|
|
93
|
+
The client applications, AGPL-only for everyone:
|
|
94
|
+
|
|
95
|
+
[AGPL] canvas-cli (repository) command-line client and shell
|
|
96
|
+
[AGPL] canvas-web (repository) web UI, served by this server
|
|
97
|
+
[AGPL] canvas-desktop (repository) desktop app
|
|
98
|
+
[AGPL] canvas-browser-extension (repository) Chrome and Firefox extensions
|
|
99
|
+
[AGPL] canvas-fuse (repository) FUSE filesystem client
|
|
100
|
+
|
|
101
|
+
A commercial licence to a [dual] component grants no rights over an [AGPL] one.
|
|
102
|
+
If you hold a commercial licence to the server runtime and you modify and convey
|
|
103
|
+
the CLI, the AGPL applies to that CLI in full. The same holds for the web UI:
|
|
104
|
+
it is AGPL-only, and serving a modified web UI to users over a network obliges
|
|
105
|
+
you to offer them its corresponding source, whatever engine licence you hold.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
THIRD-PARTY CODE
|
|
109
|
+
----------------
|
|
110
|
+
|
|
111
|
+
Third-party dependencies keep their own licences. See the dependency manifests
|
|
112
|
+
and node_modules for their terms. This notice covers Canvas code only.
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @augmentd-labs/canvas-edge
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
Published to npm as `@augmentd-labs/canvas-edge` (canvas-common's
|
|
26
|
+
release.yml, on a version bump). 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 from npm + restart the daemon
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
(`npm install --ignore-scripts @augmentd-labs/canvas-edge` in any project does
|
|
34
|
+
the same; avoid `npm -g` — global installs of packages with bundled deps came
|
|
35
|
+
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 npm package 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).
|
package/bin/canvas-edge
ADDED
|
@@ -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); });
|