mycomesh-consumer 0.1.31 → 0.1.33

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,156 +1,103 @@
1
1
  # mycomesh-consumer
2
2
 
3
- Local-first launcher and request CLI for the MycoMesh OpenAI-compatible
4
- Consumer edge. With no arguments it starts the pinned Docker runtime, opens a
5
- local page containing the export URL and payment key, and opens Codex through
6
- the loopback proxy.
3
+ Native Node.js Consumer for the MycoMesh Settlement V8 Relay network. It runs
4
+ on the user's machine with no Docker, Python runtime, Compose file, or public
5
+ Gateway dependency.
7
6
 
8
- The package is published as `mycomesh-consumer`. `mycomesh-consumer` and the
9
- short `mycomesh` command are equivalent.
7
+ ## Install
10
8
 
11
- ## Requirements
12
-
13
- - Node.js 20 or newer
14
- - Docker Desktop/Engine with Compose V2
15
- - The official Codex dependency installed with this npm package
16
-
17
- For local development, install it directly from the repository:
18
-
19
- ```sh
20
- npm install --global ./packages/mycomesh-cli
21
- ```
22
-
23
- For an npm install from the public registry:
9
+ Requirements: Node.js 20 or newer. The package contains only the small
10
+ cryptographic dependencies needed for V8 EIP-712 payment-key authorizations;
11
+ Codex is an independent client.
24
12
 
25
13
  ```sh
26
14
  npm install --global mycomesh-consumer
27
15
  mycomesh-consumer
28
16
  ```
29
17
 
30
- No checkout, separate Codex install, host Python, GNU Make, public Gateway URL, or command arguments are
31
- required. The command prints the local credentials URL and opens it when
32
- possible. The page contains only `OPENAI_BASE_URL` and `OPENAI_API_KEY` exports;
33
- the payment key is generated and persisted in a protected Docker volume. No
34
- wallet signature or browser session is required.
35
-
36
- The runtime image is pinned by digest. Stop it without deleting state with:
18
+ For a checkout:
37
19
 
38
20
  ```sh
39
- mycomesh-consumer --stop
21
+ npm install --global ./packages/mycomesh-cli
40
22
  ```
41
23
 
42
- Use `--no-browser` on a headless machine or `--no-codex` to leave only the
43
- local proxy running. Consumer network traffic is direct by default. Use
44
- `--proxy http://127.0.0.1:10792` only when a proxy is needed; loopback proxy
45
- hosts are translated to `host.docker.internal`. Dedicated
46
- `MYCOMESH_CONSUMER_*_PROXY` variables remain available for operators.
47
-
48
- Upgrading the npm package does not require clearing the payment key. The
49
- Consumer volume is intentionally reused so its key and routing state survive
50
- restarts. To reset all local Consumer state,
51
- use the explicit, confirmed reset command:
52
-
53
- ```sh
54
- mycomesh-consumer --reset-local
55
- ```
24
+ The command starts the Consumer API on `127.0.0.1:8110`, prints and optionally
25
+ opens the local credentials page, and stays available for any
26
+ OpenAI-compatible client. It does not start or configure Codex.
56
27
 
57
- If Codex reports an interrupted request, stop Codex and run
58
- `mycomesh-consumer --no-codex` to restart the local edge.
28
+ The page exposes only the local API URL, payment key/export, prepaid balance,
29
+ key operations, and local consumption history. It has no conversation or
30
+ request-session UI. The payment key is generated once and stored at
31
+ `~/.mycomesh/consumer/payment-key` with mode `0600`; set
32
+ `MYCOMESH_CONSUMER_DATA_DIR` to choose another directory.
59
33
 
60
- This removes the local payment key and Consumer state. The command asks you to type `RESET`
61
- and removes only the fixed Consumer Compose project and its protected volume.
34
+ ## Connect a client
62
35
 
63
- The existing stateless API commands remain available. For example:
36
+ The default command is already service-only. Load the export block into a
37
+ shell and then use Codex or another compatible client:
64
38
 
65
39
  ```sh
66
- npx --yes --package=mycomesh-consumer mycomesh-consumer health
40
+ mycomesh-consumer --no-browser
41
+ eval "$(curl -sS http://127.0.0.1:8110/credentials)"
42
+ codex
67
43
  ```
68
44
 
69
- ## Configuration
45
+ The optional convenience wrapper is explicit:
70
46
 
71
47
  ```sh
72
- export MYCOMESH_BASE_URL=http://127.0.0.1:8110/v1
73
- export MYCOMESH_API_KEY=your-consumer-key
48
+ mycomesh-consumer --codex
74
49
  ```
75
50
 
76
- `--base-url` and `--api-key` override their corresponding environment
77
- variables. A base URL may be the service root or end in `/v1`.
78
- Remote base URLs must use HTTPS. Loopback HTTP remains available for local
79
- development; `--allow-insecure-http` is an explicit test-only escape hatch.
80
- Requests default to a 300-second deadline. Set `MYCOMESH_TIMEOUT_SECONDS` or
81
- `--timeout`; successful JSON bodies are capped at 32 MiB while SSE remains
82
- streamed with backpressure.
83
-
84
- Prefer `MYCOMESH_API_KEY` over `--api-key`: command-line arguments may be stored
85
- in shell history or visible to other local processes. The CLI never writes the
86
- key to disk and redacts it from HTTP error output.
87
-
88
- The zero-argument launcher configures Codex directly with a temporary
89
- `mycomesh` model provider and does not modify `~/.codex/config.toml`. For manual
90
- API commands, read the local credentials with the repository operator command
91
- or provide explicit values:
51
+ Use `--no-browser` on a headless machine. Stop the process without deleting
52
+ the key or history with `mycomesh-consumer --stop`. A full reset is explicit:
92
53
 
93
54
  ```sh
94
- export MYCOMESH_BASE_URL=http://127.0.0.1:8110/v1
95
- export MYCOMESH_API_KEY='replace-with-local-consumer-key'
55
+ MYCOMESH_CONFIRM_RESET=RESET mycomesh-consumer --reset-local
96
56
  ```
97
57
 
98
- The local proxy selects a healthy Relay and authorizes each request with the
99
- persisted payment key. No session identifier or per-request wallet signature is needed. A public Gateway can
100
- still be used explicitly with `--base-url`, but it is never the default.
101
-
102
- ## Commands
58
+ The local API is OpenAI-compatible:
103
59
 
104
60
  ```sh
105
- mycomesh health
106
- mycomesh models
61
+ export OPENAI_BASE_URL=http://127.0.0.1:8110/v1
62
+ export OPENAI_API_KEY='myco_sk_...'
63
+ mycomesh responses --input 'hello' --model mycomesh-codex-standard-v1
64
+ ```
107
65
 
108
- mycomesh responses \
109
- --input "Summarize this text" \
110
- --model mycomesh-codex-standard-v1 \
111
- --max-output-tokens 500
66
+ The browser's export block is the canonical way to obtain both values.
112
67
 
113
- mycomesh chat \
114
- --message "Explain this function" \
115
- --system "Be concise." \
116
- --model mycomesh-codex-standard-v1 \
117
- --max-completion-tokens 500
118
- ```
68
+ ## Relay scheduling and V8 payments
119
69
 
120
- The request CLI sends standard OpenAI-shaped requests. The local proxy binds
121
- each request to the persisted payment key automatically.
70
+ The Consumer checks each configured Relay's V8 health and automatically tries
71
+ the next Relay after a health, timeout, or retryable HTTP failure. A single
72
+ request ID is preserved across failover. Each attempt carries a fresh V8
73
+ EIP-712 payment authorization signed by the persisted key; the Relay resolves
74
+ the key address to its on-chain grant and settles the signed receipt. No wallet
75
+ signature or Consumer-managed conversation state is involved in inference.
122
76
 
123
- Use `--stream` to request SSE. SSE bytes are forwarded to stdout as they arrive,
124
- without rewriting event boundaries:
77
+ Configure multiple Relay origins and an optional outbound proxy:
125
78
 
126
79
  ```sh
127
- mycomesh responses \
128
- --input "Write a short status update" \
129
- --max-output-tokens 500 \
130
- --stream
80
+ export MYCOMESH_V8_RELAY_URLS='https://relay-a.example,https://relay-b.example'
81
+ mycomesh-consumer --proxy http://127.0.0.1:10792
131
82
  ```
132
83
 
133
- ## JSON Input
134
-
135
- Pass an inline object, read a file, or read stdin explicitly:
84
+ The default Relay is `https://bridge.mycomesh.xyz`. The V8 deployment and RPC
85
+ defaults are embedded in the package; `MYCOMESH_CONSUMER_NETWORK_CONFIG` and
86
+ `MYCOMESH_CONSUMER_SETTLEMENT_RPC_URLS` can override them for another network.
136
87
 
137
- ```sh
138
- mycomesh responses --json '{"model":"my-model","input":"hello"}'
139
- mycomesh chat --json @request.json
140
- generate-request | mycomesh responses --json -
141
- ```
88
+ ## Stateless request CLI
142
89
 
143
- Piped stdin is treated as JSON even without `--json`:
90
+ The package also keeps the stateless API commands:
144
91
 
145
92
  ```sh
146
- printf '%s' '{"model":"my-model","messages":[{"role":"user","content":"hello"}]}' \
147
- | mycomesh chat
93
+ mycomesh health
94
+ mycomesh models
95
+ mycomesh responses --input 'Summarize this' --max-output-tokens 500
96
+ mycomesh chat --message 'Explain this function'
148
97
  ```
149
98
 
150
- Explicit flags such as `--model`, `--input`, `--message`, `--system`, and
151
- `--stream` override the corresponding JSON fields. Successful JSON responses
152
- are pretty-printed. SSE and other response types are copied to stdout. HTTP and
153
- input errors are written to stderr and return a nonzero exit status.
99
+ Use `--json @file`, `--json -`, or piped JSON for complete OpenAI-shaped
100
+ requests. `--stream` returns buffered-compatible SSE events from the Relay.
154
101
 
155
102
  ## Development
156
103
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mycomesh-consumer",
3
- "version": "0.1.31",
4
- "description": "Local-first MycoMesh Consumer launcher and OpenAI-compatible request CLI.",
3
+ "version": "0.1.33",
4
+ "description": "Native Node.js MycoMesh Consumer and OpenAI-compatible request CLI.",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -15,15 +15,16 @@
15
15
  "bin/mycomesh-consumer.mjs",
16
16
  "src/cli.mjs",
17
17
  "src/consumer.mjs",
18
- "scripts/start-consumer.sh",
19
- "consumer.compose.yml",
18
+ "src/consumer-runtime.mjs",
20
19
  "README.md"
21
20
  ],
22
21
  "engines": {
23
22
  "node": ">=20"
24
23
  },
25
24
  "dependencies": {
26
- "@openai/codex": "0.146.0"
25
+ "@noble/curves": "1.9.1",
26
+ "@noble/hashes": "1.8.0",
27
+ "undici": "6.28.0"
27
28
  },
28
29
  "scripts": {
29
30
  "test": "node --test"
package/src/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { once } from "node:events";
2
2
  import { readFile } from "node:fs/promises";
3
3
 
4
- const CLI_VERSION = "0.1.31";
4
+ const CLI_VERSION = "0.1.33";
5
5
  // The npm client is local-first. A public Gateway is an explicit override;
6
6
  // the default remains the loopback Consumer edge so a blocked domain cannot
7
7
  // strand the Codex client.