@glyphteck/veyl 0.2.0 → 0.3.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/README.md CHANGED
@@ -1,148 +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
+ ```
18
20
 
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.
21
+ ## Quick Start
23
22
 
24
- The npm package publishes bundled `dist` entrypoints so callers do not need Veyl's monorepo workspace packages installed locally.
23
+ ```bash
24
+ veyl create @runner
25
+ veyl vault create
26
+ veyl balance
27
+ veyl listen --agent
28
+ ```
25
29
 
26
- ## API Shape
30
+ Passkey account from the terminal:
31
+
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
- await veyl.chat.reply({ peer: '@alice', messageId: messages.messages[0].id }, 'got it');
41
- await veyl.chat.react('@alice', messages.messages[0].id, '+1');
42
- await veyl.chat.save('@alice', messages.messages[0].id);
43
- await veyl.chat.retention('@alice', '24h');
48
+ await veyl.money.request('@alice', 1000);
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
61
  await veyl.listen({
46
- compact: true,
47
- incomingOnly: true,
62
+ agent: true,
48
63
  onEvent: async (event) => {
49
- if (event.type !== 'message') return;
50
- await veyl.chat.reactTo(event, '+1');
51
- await veyl.chat.reply(event, 'thanks');
64
+ if (event.type !== 'message' || event.message.type !== 'txt') return;
65
+ await veyl.chat.reply(event, `received: ${event.message.text}`);
52
66
  },
53
67
  });
54
-
55
- const receive = await veyl.money.receive();
56
- const invoice = await veyl.money.invoice(1000, { memo: 'coffee' });
57
- await veyl.money.send('@alice', 1000);
58
- await veyl.money.request('@alice', 1000);
59
- const transactions = await veyl.money.transactions();
60
-
61
- console.log(account.uid, vault.vaultSecret, receive.address, invoice.encodedInvoice, messages, transactions);
62
68
  ```
63
69
 
64
- CLI names should mirror the JS API:
70
+ ## Common CLI Commands
65
71
 
66
72
  ```bash
73
+ veyl create @runner
67
74
  veyl create --passkey @runner
68
- veyl send @alice 1000
69
- veyl request @alice 1000
75
+ veyl login [@runner]
76
+ veyl vault create
77
+ veyl vault unlock
78
+ veyl balance
70
79
  veyl receive
71
80
  veyl claim
72
- veyl invoice 100 "coffee"
73
- veyl pay-invoice <invoice>
74
- veyl withdraw <address> 1000
75
- veyl balance
76
- veyl read @alice
77
81
  veyl say @alice "hello"
78
82
  veyl reply @alice <message-id> "got it"
79
83
  veyl react @alice <message-id> +1
80
- veyl save @alice <message-id>
81
- veyl retention @alice 24h
82
- veyl listen --agent
83
-
84
- veyl account create @runner
85
- veyl account create --passkey @runner
86
- veyl account login @runner
87
- veyl account login --passkey @runner
88
- veyl vault create
89
- veyl vault unlock
90
- veyl vault lock
91
- veyl chat read @alice
92
- veyl chat send @alice "hello"
93
- veyl chat reply @alice <message-id> "got it"
94
- veyl chat react @alice <message-id> +1
95
- veyl chat react-to @alice <message-id> +1
96
- veyl chat unreact @alice <message-id>
97
- veyl chat save @alice <message-id>
98
- veyl chat unsave @alice <message-id>
99
- veyl chat delete @alice <message-id>
100
- veyl chat delete-chat @alice
101
- veyl chat retention @alice seen
102
- veyl money receive
103
- veyl money balance
104
- veyl money claim
105
- veyl money invoice 100 "coffee"
106
- veyl money pay-invoice <invoice>
107
- veyl money send @alice 1000
108
- veyl money request @alice 1000
109
- veyl money withdraw-quote <address> 1000
110
- veyl money withdraw <address> 1000
84
+ veyl send @alice 1000
85
+ veyl request @alice 1000
86
+ veyl pay <request-id>
111
87
  veyl transactions
88
+ veyl listen --agent
112
89
  veyl mcp serve
113
90
  ```
114
91
 
115
- The same commands are exposed as MCP tools through `veyl mcp serve`.
116
-
117
- `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. Use `veyl listen --agent` for compact peer-authored message events with `replyTo` and `reactTo` handles shaped as `{ peer, messageId }`.
118
-
119
- 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.
92
+ ## Docs
120
93
 
121
- From this monorepo, use the root dev helper instead of the package filter form:
122
-
123
- ```bash
124
- bun dev headless regtest create --passkey @runner
125
- ```
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)
126
98
 
127
99
  ## Local Secrets
128
100
 
129
- 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.
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.
130
102
 
131
- Glyphteck-owned Google Secret Manager bot seeds are not used by this public path.
103
+ ## Environment
132
104
 
133
- ## Backend Contract
134
-
135
- The backend only verifies machine-key challenges and issues Firebase custom tokens:
136
-
137
- - `POST /headless/account/create/start`
138
- - `POST /headless/account/create/finish`
139
- - `POST /headless/account/login/start`
140
- - `POST /headless/account/login/finish`
141
- - `POST /headless/account/credential/add/start`
142
- - `POST /headless/account/credential/add/finish`
143
-
144
- Machine-created accounts are marked as bots on their public profile so app users can tell that the account is bot-operated. Passkey-created CLI accounts are not marked as bots.
145
-
146
- 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
+ ```
147
112
 
148
- 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`.