@tensorix/metahub 0.5.7 → 0.6.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.
- package/README.md +35 -14
- package/README.zh-CN.md +41 -13
- package/dist/cli.js +4436 -1328
- package/dist/cli.js.map +71 -48
- package/dist/core/blobs.d.ts.map +1 -1
- package/dist/core/blocks.d.ts +6 -2
- package/dist/core/blocks.d.ts.map +1 -1
- package/dist/core/compact.d.ts.map +1 -1
- package/dist/core/crdt.d.ts +5 -6
- package/dist/core/crdt.d.ts.map +1 -1
- package/dist/core/db.d.ts.map +1 -1
- package/dist/core/documents.d.ts +39 -0
- package/dist/core/documents.d.ts.map +1 -1
- package/dist/core/errors.d.ts +6 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/history-archive.d.ts +41 -0
- package/dist/core/history-archive.d.ts.map +1 -0
- package/dist/core/history.d.ts.map +1 -1
- package/dist/core/hlc.d.ts +4 -0
- package/dist/core/hlc.d.ts.map +1 -1
- package/dist/core/node.d.ts.map +1 -1
- package/dist/core/properties.d.ts +6 -0
- package/dist/core/properties.d.ts.map +1 -1
- package/dist/core/replica/drafts.d.ts +26 -0
- package/dist/core/replica/drafts.d.ts.map +1 -0
- package/dist/core/replica/rpc.d.ts +8 -0
- package/dist/core/replica/rpc.d.ts.map +1 -0
- package/dist/core/replica/service.d.ts +970 -0
- package/dist/core/replica/service.d.ts.map +1 -0
- package/dist/core/replica/sync.d.ts +55 -0
- package/dist/core/replica/sync.d.ts.map +1 -0
- package/dist/core/schema-init.d.ts +1 -1
- package/dist/core/schema-init.d.ts.map +1 -1
- package/dist/core/search.d.ts +34 -0
- package/dist/core/search.d.ts.map +1 -1
- package/dist/core/snapshot.d.ts.map +1 -1
- package/dist/core/sync/bucket-v2.d.ts +110 -0
- package/dist/core/sync/bucket-v2.d.ts.map +1 -0
- package/dist/core/sync/client.d.ts +14 -1
- package/dist/core/sync/client.d.ts.map +1 -1
- package/dist/core/sync/commit-log.d.ts +41 -0
- package/dist/core/sync/commit-log.d.ts.map +1 -0
- package/dist/core/sync/current-checkpoint.d.ts +47 -0
- package/dist/core/sync/current-checkpoint.d.ts.map +1 -0
- package/dist/core/sync/data-map-db.d.ts.map +1 -1
- package/dist/core/sync/data-version.d.ts +29 -0
- package/dist/core/sync/data-version.d.ts.map +1 -0
- package/dist/core/sync/drop-keys.d.ts.map +1 -1
- package/dist/core/sync/drop-pull.d.ts.map +1 -1
- package/dist/core/sync/e2ee.d.ts +5 -0
- package/dist/core/sync/e2ee.d.ts.map +1 -1
- package/dist/core/sync/enroll.d.ts +2 -0
- package/dist/core/sync/enroll.d.ts.map +1 -1
- package/dist/core/sync/history-observation.d.ts +5 -0
- package/dist/core/sync/history-observation.d.ts.map +1 -0
- package/dist/core/sync/http-status.d.ts.map +1 -1
- package/dist/core/sync/page-messages.d.ts +12 -0
- package/dist/core/sync/page-messages.d.ts.map +1 -1
- package/dist/core/sync/peer-v2.d.ts +9 -0
- package/dist/core/sync/peer-v2.d.ts.map +1 -0
- package/dist/core/sync/peers.d.ts +1 -0
- package/dist/core/sync/peers.d.ts.map +1 -1
- package/dist/core/sync/portable-json.d.ts +5 -0
- package/dist/core/sync/portable-json.d.ts.map +1 -0
- package/dist/core/sync/protocol.d.ts +32 -0
- package/dist/core/sync/protocol.d.ts.map +1 -1
- package/dist/core/sync/recovery-desktop.d.ts +6 -0
- package/dist/core/sync/recovery-desktop.d.ts.map +1 -0
- package/dist/core/sync/recovery-intent.d.ts +7 -0
- package/dist/core/sync/recovery-intent.d.ts.map +1 -0
- package/dist/core/sync/recovery-local.d.ts +21 -0
- package/dist/core/sync/recovery-local.d.ts.map +1 -0
- package/dist/core/sync/recovery-v2.d.ts +40 -0
- package/dist/core/sync/recovery-v2.d.ts.map +1 -0
- package/dist/core/sync/retention-executor.d.ts +77 -0
- package/dist/core/sync/retention-executor.d.ts.map +1 -0
- package/dist/core/sync/retention-protocol.d.ts +74 -0
- package/dist/core/sync/retention-protocol.d.ts.map +1 -0
- package/dist/core/sync/retention-state.d.ts +87 -0
- package/dist/core/sync/retention-state.d.ts.map +1 -0
- package/dist/core/sync/routes.d.ts +1 -1
- package/dist/core/sync/routes.d.ts.map +1 -1
- package/dist/core/sync/server.d.ts +1 -1
- package/dist/core/sync/server.d.ts.map +1 -1
- package/dist/core/sync/share-export.d.ts.map +1 -1
- package/dist/core/sync/share-serve.d.ts.map +1 -1
- package/dist/core/sync/share-table-client.d.ts +7 -0
- package/dist/core/sync/share-table-client.d.ts.map +1 -0
- package/dist/core/sync/share-table.d.ts +11 -0
- package/dist/core/sync/share-table.d.ts.map +1 -0
- package/dist/core/sync/share-tools.d.ts +10 -0
- package/dist/core/sync/share-tools.d.ts.map +1 -0
- package/dist/core/sync/storage-s3-bun.d.ts +3 -1
- package/dist/core/sync/storage-s3-bun.d.ts.map +1 -1
- package/dist/core/sync/storage-s3-fetch.d.ts +8 -0
- package/dist/core/sync/storage-s3-fetch.d.ts.map +1 -0
- package/dist/core/sync/storage-s3-sign.d.ts +3 -0
- package/dist/core/sync/storage-s3-sign.d.ts.map +1 -1
- package/dist/core/sync/storage-v2.d.ts +18 -0
- package/dist/core/sync/storage-v2.d.ts.map +1 -0
- package/dist/core/sync/storage.d.ts +47 -6
- package/dist/core/sync/storage.d.ts.map +1 -1
- package/dist/core/sync/transport.d.ts +4 -0
- package/dist/core/sync/transport.d.ts.map +1 -0
- package/dist/core/sync/v2-ingest.d.ts +10 -0
- package/dist/core/sync/v2-ingest.d.ts.map +1 -0
- package/dist/core/sync/v2-maintenance.d.ts +10 -0
- package/dist/core/sync/v2-maintenance.d.ts.map +1 -0
- package/dist/db-worker.js +212 -160
- package/dist/edge-worker.js +4956 -186
- package/dist/index.js +9461 -6468
- package/dist/index.js.map +69 -47
- package/dist/metahub-sdk.js +5 -5
- package/dist/mh-runtime.js +2 -2
- package/dist/shared/views/date.d.ts +21 -0
- package/dist/shared/views/date.d.ts.map +1 -0
- package/dist/shared/views/model.d.ts +65 -0
- package/dist/shared/views/model.d.ts.map +1 -0
- package/dist/shared/views/query.d.ts +47 -0
- package/dist/shared/views/query.d.ts.map +1 -0
- package/dist/sw.js +9 -9
- package/dist/webui/server/routes.d.ts.map +1 -1
- package/dist/webui.js +131 -130
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
# metahub
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**A local-first workspace you and your agents share.**
|
|
4
4
|
|
|
5
5
|
English · [简体中文](./README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
metahub
|
|
7
|
+
metahub brings **Markdown notes**, **typed tables**, and **simple agent-built sites** into one shared workspace. You work in the desktop app or browser; your agent reads and writes the same notes and tables through the CLI. Ask your agent to build a small site to collect feedback or show hub data, then bring that input into the work. Built on Bun + SQLite, everything starts on your own machine under `~/.metahub/`, with offline use and sync across your devices.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<img src="./
|
|
10
|
+
<img src="./website/public/assets/documents-v0.5.4-en.png" alt="metahub shared workspace — document editor" width="100%">
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[Download desktop](#install) · [Connect an agent](#connect-an-agent)
|
|
14
|
+
|
|
15
|
+
> The CLI and library use [Bun](https://bun.sh). Desktop downloads and standalone binaries are also available.
|
|
14
16
|
|
|
15
17
|
## Why metahub
|
|
16
18
|
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
19
|
+
- **Write a starting point** — a note, requirement, or task board gives you and your agent something concrete to work on. Markdown notes sit beside typed tables with 9 property types, including links between records and documents.
|
|
20
|
+
- **See what AI changes** — agent writes land in the workspace you open in the app. Open views refresh when the CLI writes, so you can review the result and make the next decision.
|
|
21
|
+
- **Revise, then continue** — change a priority or rewrite a requirement in the UI. Your agent explicitly re-reads the note or table to pick up your revision; `doc read` returns a version token and `doc edit --old/--new` sends an anchored, incremental edit.
|
|
22
|
+
- **Keep the work yours** — notes and tables live on your own disk and work offline. Pair devices to sync both ways; concurrent edits to different paragraphs merge cleanly.
|
|
23
|
+
- **Trace and undo agent work** — agent writes carry an `ai` tag. `mh audit` shows the whole-hub change feed; `mh audit revert <txn>` undoes a logical change group while preserving later edits.
|
|
22
24
|
|
|
23
25
|
<p align="center">
|
|
24
|
-
<img src="./
|
|
26
|
+
<img src="./website/public/assets/tables-v0.5.4-en.png" alt="metahub shared workspace — typed tables" width="100%">
|
|
25
27
|
</p>
|
|
26
28
|
|
|
27
|
-
>
|
|
29
|
+
> Download the [desktop app](#install), or run `mh --server` and open `http://localhost:7777/`. [Connect an agent](#connect-an-agent) to read and write the same workspace.
|
|
28
30
|
|
|
29
31
|
## Quick start
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
|
|
34
|
+
bun install -g @tensorix/metahub # install the mh command (requires Bun)
|
|
35
|
+
mh init # create ~/.metahub
|
|
33
36
|
mh db create "Tasks" # create a table → returns an id like db_tasks-k3f9c1
|
|
34
37
|
mh use tasks # set the "current db"; record/prop commands target it
|
|
35
38
|
mh prop add Title --type text
|
|
@@ -55,11 +58,13 @@ Output adapts to the audience: a terminal (human) gets tables / Markdown, a pipe
|
|
|
55
58
|
|
|
56
59
|
| Form | Install | For |
|
|
57
60
|
| --- | --- | --- |
|
|
58
|
-
| **Desktop app** (GUI) | `brew install --cask tensorix/tap/metahub-app` |
|
|
59
|
-
| **CLI** | `brew install tensorix/tap/metahub-cli`, or `
|
|
61
|
+
| **Desktop app** (GUI) | `brew install --cask tensorix/tap/metahub-app` | Write and manage your workspace on macOS |
|
|
62
|
+
| **CLI** | `brew install tensorix/tap/metahub-cli`, or `bun install -g @tensorix/metahub`, or `bunx @tensorix/metahub <cmd>` | AI agents and the command line |
|
|
60
63
|
| **Library** (Bun) | `bun add @tensorix/metahub` | Calling metahub from your own Bun program |
|
|
61
64
|
| **Standalone binary** | download for your platform, `chmod +x`, run | No runtime to install |
|
|
62
65
|
|
|
66
|
+
The package-based CLI and library require [Bun](https://bun.sh). The desktop app and standalone binaries bundle their runtime.
|
|
67
|
+
|
|
63
68
|
```ts
|
|
64
69
|
// As a library: every core capability is exported from the package root
|
|
65
70
|
import { openMetahub, createDatabase, createRecord, search } from "@tensorix/metahub";
|
|
@@ -67,6 +72,20 @@ import { openMetahub, createDatabase, createRecord, search } from "@tensorix/met
|
|
|
67
72
|
|
|
68
73
|
Platforms: `darwin-arm64` / `darwin-x64` / `linux-x64` / `linux-arm64` / `windows-x64` / `windows-arm64`. Library API: see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
69
74
|
|
|
75
|
+
## Connect an agent
|
|
76
|
+
|
|
77
|
+
After installing the CLI, add the usage guide to the agent you work with:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mh init --codex # install the $mh skill for Codex
|
|
81
|
+
# or
|
|
82
|
+
mh init --claude # install the /mh skill for Claude Code
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For other agents, provide [SKILL.md](./SKILL.md) and access to the CLI or API. MetaHub supplies the workspace; your external agent runs the model and decides when to read or write.
|
|
86
|
+
|
|
87
|
+
Try: “Read my event plan, draft an invitation in the workspace, and tell me what you changed.” After revising the plan yourself, ask: “Re-read the latest plan and update the invitation.” Review the changes in the app or with `mh audit`.
|
|
88
|
+
|
|
70
89
|
## Sync across machines
|
|
71
90
|
|
|
72
91
|
Run a server on one machine and sync from another. Documents merge at the paragraph level, so concurrent edits to different parts of the same document combine cleanly.
|
|
@@ -155,6 +174,8 @@ The WebUI is an installable PWA. Open **Settings → 离线副本** and this bro
|
|
|
155
174
|
|
|
156
175
|
## Documentation
|
|
157
176
|
|
|
177
|
+
- [Brand and slogan](./assets/brand/README.md) — product narrative, bilingual copy, palette roles, and logo assets.
|
|
178
|
+
- [Website design](./website/DESIGN.md) — interactive scenarios, App fidelity, localization, and motion rules.
|
|
158
179
|
- [System design](./docs/system-design/) — architecture, data model, capabilities, usage flows.
|
|
159
180
|
- [Contributing](./CONTRIBUTING.md) — local development, build, release, project layout, library API.
|
|
160
181
|
- [Desktop app](./apps/desktop/README.md) — Electron shell + Bun sidecar.
|
package/README.zh-CN.md
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
# metahub
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**你和 Agent 共享的本地优先工作空间。**
|
|
4
4
|
|
|
5
5
|
[English](./README.md) · 简体中文
|
|
6
6
|
|
|
7
|
-
metahub
|
|
7
|
+
metahub 把 **Markdown 笔记**、**类型化数据表**与 **Agent 构建的简单站点**放进同一个共享工作空间。你用桌面 App 或浏览器界面,Agent 通过 CLI 读写同一份笔记与数据表。还可以让 Agent 搭建小站点,收集反馈或展示工作空间的数据,再把这些输入带回日常工作。基于 Bun + SQLite,数据从本机的 `~/.metahub/` 开始,离线可用,也能在你的设备之间同步。
|
|
8
8
|
|
|
9
|
-
>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="./website/public/assets/documents-v0.5.4-en.png" alt="metahub 共享工作空间 — 文档编辑" width="100%">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
[下载桌面版](#获取--安装) · [连接 Agent](#连接-agent)
|
|
14
|
+
|
|
15
|
+
> CLI 与库依赖 [Bun](https://bun.sh),也可下载桌面版或独立可执行文件。
|
|
10
16
|
|
|
11
17
|
## 为什么用它
|
|
12
18
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- **Agent 的改动可追可撤** ——
|
|
19
|
+
- **写下一个起点** —— 笔记、需求或任务看板,让你和 Agent 有具体的事情可做。Markdown 笔记与类型化数据表放在一起,支持 9 种属性类型,包括记录之间、记录与文档之间的关联。
|
|
20
|
+
- **看见 AI 的改动** —— Agent 写入的进展落在你打开的同一个工作空间中。CLI 写入后,已打开的界面会刷新,方便你查看结果、做下一步判断。
|
|
21
|
+
- **你来调整,接着往下做** —— 在界面里改优先级、重写需求。Agent 明确重新读取笔记或数据表,才能接上你的修改;`doc read` 返回版本号,`doc edit --old/--new` 做锚定增量编辑。
|
|
22
|
+
- **工作始终属于你** —— 笔记和数据表在自己的磁盘上,离线照常用。配对设备后双向同步,不同段落的并发修改可以合并。
|
|
23
|
+
- **Agent 的改动可追可撤** —— Agent 写入带有 `ai` 标记;`mh audit` 展示全库变更流,`mh audit revert <txn>` 按逻辑变更组撤销,并保留之后的编辑。
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img src="./website/public/assets/tables-v0.5.4-en.png" alt="metahub 共享工作空间 — 类型化数据表" width="100%">
|
|
27
|
+
</p>
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
> 想看界面?装上[桌面 App](#获取--安装),或运行 `mh --server` 后打开 `http://localhost:7777/`。
|
|
29
|
+
> [下载桌面版](#获取--安装),或运行 `mh --server` 后打开 `http://localhost:7777/`。[连接 Agent](#连接-agent),一起读写同一个工作空间。
|
|
21
30
|
|
|
22
31
|
## 快速开始
|
|
23
32
|
|
|
24
33
|
```bash
|
|
25
|
-
|
|
34
|
+
bun install -g @tensorix/metahub # 安装 mh 命令(需要 Bun)
|
|
35
|
+
mh init # 创建 ~/.metahub
|
|
26
36
|
mh db create "Tasks" # 建一张表 → 返回 id,如 db_tasks-k3f9c1
|
|
27
37
|
mh use tasks # 设为「当前库」,之后 record/prop 免带库参数
|
|
28
38
|
mh prop add Title --type text
|
|
@@ -48,11 +58,13 @@ mh doc append <ref> --body "追加段落" # 也有 prepend
|
|
|
48
58
|
|
|
49
59
|
| 形态 | 安装 | 适合 |
|
|
50
60
|
| --- | --- | --- |
|
|
51
|
-
| **桌面 App**(GUI) | `brew install --cask tensorix/tap/metahub-app` |
|
|
52
|
-
| **CLI** | `brew install tensorix/tap/metahub-cli`,或 `
|
|
61
|
+
| **桌面 App**(GUI) | `brew install --cask tensorix/tap/metahub-app` | 在 macOS 上编辑和管理工作区 |
|
|
62
|
+
| **CLI** | `brew install tensorix/tap/metahub-cli`,或 `bun install -g @tensorix/metahub`,或免安装 `bunx @tensorix/metahub <cmd>` | AI agent / 命令行 |
|
|
53
63
|
| **库**(Bun) | `bun add @tensorix/metahub` | 在自己的 Bun 程序里直接调用 |
|
|
54
64
|
| **独立二进制** | 下载对应平台文件,`chmod +x` 后直接运行 | 无运行时环境 |
|
|
55
65
|
|
|
66
|
+
通过包安装的 CLI 和库需要 [Bun](https://bun.sh);桌面 App 和独立二进制已自带运行时。
|
|
67
|
+
|
|
56
68
|
```ts
|
|
57
69
|
// 作为库使用:所有 core 能力从包根导出
|
|
58
70
|
import { openMetahub, createDatabase, createRecord, search } from "@tensorix/metahub";
|
|
@@ -60,6 +72,20 @@ import { openMetahub, createDatabase, createRecord, search } from "@tensorix/met
|
|
|
60
72
|
|
|
61
73
|
支持平台:`darwin-arm64` / `darwin-x64` / `linux-x64` / `linux-arm64` / `windows-x64` / `windows-arm64`。库 API 详见 [CONTRIBUTING.md](./CONTRIBUTING.md)。
|
|
62
74
|
|
|
75
|
+
## 连接 Agent
|
|
76
|
+
|
|
77
|
+
安装 CLI 后,把使用指南装到你正在用的 Agent 中:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mh init --codex # 安装 Codex 的 $mh skill
|
|
81
|
+
# 或者
|
|
82
|
+
mh init --claude # 安装 Claude Code 的 /mh skill
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
其他 Agent 可以读取 [SKILL.md](./SKILL.md),通过 CLI 或 API 接入。MetaHub 提供工作区;模型运行和何时读写由外部 Agent 负责。
|
|
86
|
+
|
|
87
|
+
可以先试:「读取我的活动计划,在工作区里起草邀请文案,并告诉我改了什么。」亲手修改计划后,再说:「重新读取最新计划,更新邀请。」在 App 或 `mh audit` 中检查改动。
|
|
88
|
+
|
|
63
89
|
## 多机同步
|
|
64
90
|
|
|
65
91
|
在一台机器起服务端,另一台与它同步。文档按段落级合并,所以并发改同一篇文档的不同部分能干净合并。
|
|
@@ -140,6 +166,8 @@ mh sync http://a-host:7777
|
|
|
140
166
|
|
|
141
167
|
## 文档
|
|
142
168
|
|
|
169
|
+
- [品牌与 slogan](./assets/brand/README.md) —— 产品叙事、中英文文案、配色分工与 Logo 资源。
|
|
170
|
+
- [官网设计](./website/DESIGN.md) —— 交互场景、App 对齐、双语排版与动效规则。
|
|
143
171
|
- [系统设计](./docs/system-design/) —— 架构、数据模型、能力清单、使用流程。
|
|
144
172
|
- [贡献指南](./CONTRIBUTING.md) —— 本地开发、构建、发布、目录结构、库 API。
|
|
145
173
|
- [桌面 App](./apps/desktop/README.md) —— Electron 壳 + Bun sidecar。
|