@glyphteck/veyl 0.1.2 → 0.3.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 CHANGED
@@ -1,106 +1,113 @@
1
1
  # Veyl Headless
2
2
 
3
- `apps/headless` is the programmable Bun client for terminal users, scripts, automations, and MCP servers.
3
+ `@glyphteck/veyl` is the Bun client for using Veyl from a terminal, script, automation, bot, agent, or MCP client.
4
4
 
5
- It is a client, not a privileged backend. Headless accounts own their local machine credential, vault secret, wallet seed, and chat key material. The server should only create public account records, verify login challenges, and store encrypted vault material it cannot decrypt.
5
+ Headless is a normal Veyl client, not a privileged backend. Account keys, vault secrets, wallet entropy, chat seeds, Spark wallet boot, message encryption, and payment signing run locally. The backend only creates public account records, verifies machine-key login challenges, issues Firebase custom tokens, and stores encrypted vault data it cannot decrypt.
6
6
 
7
- The package also supports real passkey accounts from a terminal. Passkey create/login opens the configured Veyl web origin for the WebAuthn ceremony, receives a Firebase token on a localhost callback, then pairs a local machine credential to that signed-in account for future CLI sessions. True machine-created headless accounts remain separate from passkey-created accounts.
7
+ Machine-created accounts are marked as `bot` on their public profile. Passkey-created CLI accounts are real human accounts and are not marked as bots.
8
8
 
9
- Run the public package with Bun:
9
+ ## Install
10
10
 
11
11
  ```bash
12
12
  bunx @glyphteck/veyl help
13
13
  ```
14
14
 
15
- ## Interface Boundary
15
+ For scripts:
16
16
 
17
- `headless` is the client boundary. CLI, MCP, scripts, and future channel adapters are interfaces on top of the same client, not separate clients with their own account, vault, chat, or money logic.
17
+ ```bash
18
+ bun add @glyphteck/veyl
19
+ ```
20
+
21
+ ## Quick Start
18
22
 
19
- - `src/client.js`: shared programmable API.
20
- - `src/cli.js`: terminal command wrapper.
21
- - `src/mcp.js`: MCP wrapper.
22
- - `src/passkey.js`: browser-assisted passkey bridge for terminal flows.
23
+ ```bash
24
+ veyl create @runner
25
+ veyl vault create
26
+ veyl balance
27
+ veyl listen --agent
28
+ ```
23
29
 
24
- The npm package publishes bundled `dist` entrypoints so callers do not need Veyl's monorepo workspace packages installed locally.
30
+ Passkey account from the terminal:
25
31
 
26
- ## API Shape
32
+ ```bash
33
+ veyl create --passkey @runner
34
+ veyl vault create
35
+ veyl listen --agent
36
+ ```
27
37
 
28
- The public surface should stay simple enough to infer from the command names:
38
+ ## JavaScript
29
39
 
30
40
  ```js
31
41
  import { open } from '@glyphteck/veyl';
32
42
 
33
- const veyl = await open();
43
+ const veyl = await open({ profile: 'runner', network: 'REGTEST' });
34
44
 
35
- const account = await veyl.account.create({ username: 'runner' });
36
- const vault = await veyl.vault.create();
45
+ await veyl.account.login();
37
46
  await veyl.vault.unlock();
38
47
  await veyl.chat.send('@alice', 'hello');
39
- const messages = await veyl.chat.read('@alice');
40
-
41
- await veyl.money.send('@alice', 1000);
42
48
  await veyl.money.request('@alice', 1000);
43
- const transactions = await veyl.money.transactions();
49
+ ```
50
+
51
+ ## Agent Loop
52
+
53
+ ```js
54
+ import { open } from '@glyphteck/veyl';
55
+
56
+ const veyl = await open({ profile: 'runner', network: 'REGTEST' });
57
+
58
+ await veyl.account.login();
59
+ await veyl.vault.unlock();
44
60
 
45
- console.log(account.uid, vault.vaultSecret, messages, transactions);
61
+ await veyl.listen({
62
+ agent: true,
63
+ onEvent: async (event) => {
64
+ if (event.type !== 'message' || event.message.type !== 'txt') return;
65
+ await veyl.chat.reply(event, `received: ${event.message.text}`);
66
+ },
67
+ });
46
68
  ```
47
69
 
48
- CLI names should mirror the JS API:
70
+ ## Common CLI Commands
49
71
 
50
72
  ```bash
73
+ veyl create @runner
51
74
  veyl create --passkey @runner
52
- veyl send @alice 1000
53
- veyl request @alice 1000
54
- veyl balance
55
- veyl read @alice
56
- veyl say @alice "hello"
57
- veyl listen
58
-
59
- veyl account create @runner
60
- veyl account create --passkey @runner
61
- veyl account login @runner
62
- veyl account login --passkey @runner
75
+ veyl login [@runner]
63
76
  veyl vault create
64
77
  veyl vault unlock
65
- veyl vault lock
66
- veyl chat read @alice
67
- veyl chat send @alice "hello"
68
- veyl money balance
69
- veyl money send @alice 1000
70
- veyl money request @alice 1000
78
+ veyl balance
79
+ veyl receive
80
+ veyl claim
81
+ veyl say @alice "hello"
82
+ veyl reply @alice <message-id> "got it"
83
+ veyl react @alice <message-id> +1
84
+ veyl send @alice 1000
85
+ veyl request @alice 1000
86
+ veyl pay <request-id>
71
87
  veyl transactions
88
+ veyl listen --agent
72
89
  veyl mcp serve
73
90
  ```
74
91
 
75
- The same commands are exposed as MCP tools through `veyl mcp serve`.
76
-
77
- `veyl listen` keeps one auth and vault session alive in the current process, then emits newline-delimited JSON events for new messages and wallet transfers. It is the terminal event-stream path for agents that do not want to speak MCP.
92
+ ## Docs
78
93
 
79
- Passkey browser auth defaults to `https://veyl.glyphteck.com`. Use `--web-url` or `VEYL_WEB_URL` to point the CLI at another allowed passkey origin, such as a local dev host or a future dedicated auth host.
80
-
81
- From this monorepo, use the root dev helper instead of the package filter form:
82
-
83
- ```bash
84
- bun dev headless regtest create --passkey @runner
85
- ```
94
+ - Agent quick reference: [docs/agents.md](docs/agents.md)
95
+ - JavaScript API: [docs/api.md](docs/api.md)
96
+ - CLI: [docs/cli.md](docs/cli.md)
97
+ - MCP: [docs/mcp.md](docs/mcp.md)
86
98
 
87
99
  ## Local Secrets
88
100
 
89
- The package creates a local profile under `~/.veyl` by default. It stores the machine credential and, unless `saveSecret: false` or `--no-save-secret` is used, the generated vault secret. Passkey flows pair and store a local machine credential by default so later CLI commands do not need a browser prompt; use `--no-save-credential` or `saveCredential: false` to return the credential material without saving the private key locally. Callers that already have a secret manager can pass `VEYL_HOME`, `VEYL_PROFILE`, `VEYL_VAULT_SECRET`, or explicit SDK options and store those secrets elsewhere.
90
-
91
- Glyphteck-owned Google Secret Manager bot seeds are not used by this public path.
101
+ Profiles live under `~/.veyl` by default, or `VEYL_HOME` if set. Use `--no-save-secret`, `--no-save-credential`, `saveSecret: false`, or `saveCredential: false` if you want to store vault or machine credentials yourself.
92
102
 
93
- ## Backend Contract
103
+ ## Environment
94
104
 
95
- The backend only verifies machine-key challenges and issues Firebase custom tokens:
96
-
97
- - `POST /headless/account/create/start`
98
- - `POST /headless/account/create/finish`
99
- - `POST /headless/account/login/start`
100
- - `POST /headless/account/login/finish`
101
- - `POST /headless/account/credential/add/start`
102
- - `POST /headless/account/credential/add/finish`
103
-
104
- Vault secrets, wallet entropy, chat seeds, Spark wallet boot, and message/payment signing all run locally in this package through shared Veyl primitives.
105
+ ```bash
106
+ VEYL_HOME=/secure/veyl-home
107
+ VEYL_PROFILE=runner
108
+ VEYL_NETWORK=REGTEST
109
+ VEYL_VAULT_SECRET=...
110
+ VEYL_WEB_URL=https://veyl.glyphteck.com
111
+ ```
105
112
 
106
- Generic unlocked-account actions live in `@veyl/shared/account/actions`; this package only wraps them with headless account auth, local profile storage, CLI commands, and MCP serving.
113
+ `VEYL_WEB_URL` is used for passkey flows and must be `https://...` or `localhost`.