mycomesh-consumer 0.1.16 → 0.1.18
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 +18 -36
- package/package.json +1 -1
- package/scripts/start-consumer.sh +6 -6
- package/src/cli.mjs +1 -5
- package/src/consumer.mjs +4 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Local-first launcher and request CLI for the MycoMesh OpenAI-compatible
|
|
4
4
|
Consumer edge. With no arguments it starts the pinned Docker runtime, opens the
|
|
5
|
-
wallet and funding page, waits for
|
|
5
|
+
wallet and funding page, waits for prepaid access, and opens Codex through the
|
|
6
6
|
loopback proxy.
|
|
7
7
|
|
|
8
8
|
The package is published as `mycomesh-consumer`. `mycomesh-consumer` and the
|
|
@@ -30,10 +30,10 @@ mycomesh-consumer
|
|
|
30
30
|
|
|
31
31
|
No checkout, separate Codex install, host Python, GNU Make, public Gateway URL, or command arguments are
|
|
32
32
|
required. The command always prints the local onboarding URL and opens it when
|
|
33
|
-
possible. Connect the wallet, mint
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
possible. Connect the wallet, mint or transfer test tUSDC, and authorize prepaid
|
|
34
|
+
access once; Codex opens after `/ready` confirms access is ready. Wallet keys stay
|
|
35
|
+
in the browser wallet. Consumer credentials, transport identity, and payment
|
|
36
|
+
state stay in a protected Docker volume.
|
|
37
37
|
|
|
38
38
|
The runtime image is pinned by digest. Stop it without deleting state with:
|
|
39
39
|
|
|
@@ -47,8 +47,8 @@ local proxy running. Consumer network traffic is direct by default. Use
|
|
|
47
47
|
hosts are translated to `host.docker.internal`. Dedicated
|
|
48
48
|
`MYCOMESH_CONSUMER_*_PROXY` variables remain available for operators.
|
|
49
49
|
|
|
50
|
-
Upgrading the npm package does not require clearing
|
|
51
|
-
volume is intentionally reused so its API key, identity and verified
|
|
50
|
+
Upgrading the npm package does not require clearing prepaid access. The Consumer
|
|
51
|
+
volume is intentionally reused so its API key, identity and verified payment
|
|
52
52
|
route survive restarts. If the browser page is stuck on an old local record,
|
|
53
53
|
close that tab and reopen the printed onboarding URL, or clear site data for
|
|
54
54
|
`http://127.0.0.1:8110` in the browser. To reset all local Consumer state,
|
|
@@ -58,14 +58,13 @@ use the explicit, confirmed reset command:
|
|
|
58
58
|
mycomesh-consumer --reset-local
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
If Codex reports an
|
|
62
|
-
`mycomesh-consumer --no-codex`, open the local page, and click **
|
|
63
|
-
|
|
61
|
+
If Codex reports an interrupted request, stop Codex, run
|
|
62
|
+
`mycomesh-consumer --no-codex`, open the local page, and click **Refresh prepaid
|
|
63
|
+
access**. The Consumer handles the previous payment state without replaying it.
|
|
64
64
|
|
|
65
|
-
This removes the local API key, identity, wallet metadata and
|
|
66
|
-
records.
|
|
67
|
-
|
|
68
|
-
before treating its escrow as available. The command asks you to type `RESET`
|
|
65
|
+
This removes the local API key, identity, wallet metadata and local payment
|
|
66
|
+
records. Any pending payment authorization remains managed separately. The
|
|
67
|
+
command asks you to type `RESET`
|
|
69
68
|
and removes only the fixed Consumer Compose project and its protected volume.
|
|
70
69
|
|
|
71
70
|
The existing stateless API commands remain available. For example:
|
|
@@ -101,14 +100,11 @@ or provide explicit values:
|
|
|
101
100
|
```sh
|
|
102
101
|
export MYCOMESH_BASE_URL=http://127.0.0.1:8110/v1
|
|
103
102
|
export MYCOMESH_API_KEY='replace-with-local-consumer-key'
|
|
104
|
-
export MYCOMESH_SESSION_ID='0x...replace-with-active-v6-session-id'
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
The
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
the latest verified active Session. A public Gateway can still be used
|
|
111
|
-
explicitly with `--base-url`, but it is never the default.
|
|
105
|
+
The local proxy selects the current prepaid access automatically. No session
|
|
106
|
+
identifier or per-request wallet signature is needed. A public Gateway can
|
|
107
|
+
still be used explicitly with `--base-url`, but it is never the default.
|
|
112
108
|
|
|
113
109
|
## Commands
|
|
114
110
|
|
|
@@ -128,10 +124,8 @@ mycomesh chat \
|
|
|
128
124
|
--max-completion-tokens 500
|
|
129
125
|
```
|
|
130
126
|
|
|
131
|
-
The request CLI
|
|
132
|
-
|
|
133
|
-
for one command. The local proxy also accepts a standard OpenAI-shaped request
|
|
134
|
-
without the extension and binds its latest verified Session.
|
|
127
|
+
The request CLI sends standard OpenAI-shaped requests. The local proxy binds
|
|
128
|
+
each request to the current prepaid access automatically.
|
|
135
129
|
|
|
136
130
|
Use `--stream` to request SSE. SSE bytes are forwarded to stdout as they arrive,
|
|
137
131
|
without rewriting event boundaries:
|
|
@@ -153,18 +147,6 @@ mycomesh chat --json @request.json
|
|
|
153
147
|
generate-request | mycomesh responses --json -
|
|
154
148
|
```
|
|
155
149
|
|
|
156
|
-
When `MYCOMESH_SESSION_ID` or `--session-id` is set, the CLI overwrites any JSON
|
|
157
|
-
session field with that validated value. A client constructing the complete raw
|
|
158
|
-
request body instead may include the extension directly:
|
|
159
|
-
|
|
160
|
-
```json
|
|
161
|
-
{
|
|
162
|
-
"mycomesh_session": {
|
|
163
|
-
"session_id": "0x..."
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
150
|
Piped stdin is treated as JSON even without `--json`:
|
|
169
151
|
|
|
170
152
|
```sh
|
package/package.json
CHANGED
|
@@ -113,7 +113,7 @@ open_browser() {
|
|
|
113
113
|
if command -v cmd.exe >/dev/null 2>&1; then cmd.exe /c start "" "$url" >/dev/null 2>&1 & return; fi ;;
|
|
114
114
|
esac
|
|
115
115
|
if [[ -n "$opener" ]]; then "$opener" "$url" >/dev/null 2>&1 &
|
|
116
|
-
else printf '%s\n' "Open this URL in a browser to connect a wallet
|
|
116
|
+
else printf '%s\n' "Open this URL in a browser to connect a wallet and add prepaid access."; fi
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
while (($#)); do
|
|
@@ -149,7 +149,7 @@ export MYCOMESH_NODE_IMAGE="$NODE_IMAGE"
|
|
|
149
149
|
|
|
150
150
|
if ((STOP)); then
|
|
151
151
|
compose stop consumer
|
|
152
|
-
printf '%s\n' "MycoMesh Consumer stopped. Its wallet and
|
|
152
|
+
printf '%s\n' "MycoMesh Consumer stopped. Its wallet and payment state remain in the Docker volume."
|
|
153
153
|
exit 0
|
|
154
154
|
fi
|
|
155
155
|
|
|
@@ -158,12 +158,12 @@ if ((RESET_LOCAL)); then
|
|
|
158
158
|
printf '%s\n' "Would remove the Consumer containers, network, and protected local volume."
|
|
159
159
|
exit 0
|
|
160
160
|
fi
|
|
161
|
-
printf '%s\n' "This removes the local API key, Consumer identity, wallet metadata and
|
|
161
|
+
printf '%s\n' "This removes the local API key, Consumer identity, wallet metadata and local payment records."
|
|
162
162
|
printf '%s' 'Type RESET to continue: '
|
|
163
163
|
read -r confirmation
|
|
164
164
|
[[ "$confirmation" == RESET ]] || die "local Consumer reset cancelled"
|
|
165
165
|
compose down --volumes --remove-orphans
|
|
166
|
-
printf '%s\n' "Local Consumer state removed. Any
|
|
166
|
+
printf '%s\n' "Local Consumer state removed. Any pending payment authorization remains managed separately."
|
|
167
167
|
exit 0
|
|
168
168
|
fi
|
|
169
169
|
|
|
@@ -182,12 +182,12 @@ if ((DRY_RUN || NO_CODEX)); then
|
|
|
182
182
|
exit 0
|
|
183
183
|
fi
|
|
184
184
|
|
|
185
|
-
printf '%s\n' "Waiting for the browser to
|
|
185
|
+
printf '%s\n' "Waiting for the browser to make prepaid access ready..."
|
|
186
186
|
command -v curl >/dev/null 2>&1 || die "curl is required while waiting for wallet onboarding"
|
|
187
187
|
started_at="$(date +%s)"
|
|
188
188
|
while ! curl --noproxy '*' --fail --silent --max-time 3 http://127.0.0.1:8110/ready >/dev/null 2>&1; do
|
|
189
189
|
if (( $(date +%s) - started_at >= READY_TIMEOUT )); then
|
|
190
|
-
die "timed out waiting for
|
|
190
|
+
die "timed out waiting for prepaid access; reopen $url"
|
|
191
191
|
fi
|
|
192
192
|
sleep 2
|
|
193
193
|
done
|
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.
|
|
4
|
+
const CLI_VERSION = "0.1.18";
|
|
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.
|
|
@@ -29,10 +29,6 @@ Connection options:
|
|
|
29
29
|
(env: MYCOMESH_TIMEOUT_SECONDS; default: 300)
|
|
30
30
|
--allow-insecure-http Allow cleartext HTTP to a non-loopback test gateway
|
|
31
31
|
|
|
32
|
-
Session options:
|
|
33
|
-
--session-id <bytes32> Use an already-opened V6 Session
|
|
34
|
-
(env: MYCOMESH_SESSION_ID)
|
|
35
|
-
|
|
36
32
|
Request body options:
|
|
37
33
|
--json <json|@file|-> JSON object, JSON file, or JSON from stdin
|
|
38
34
|
--model <model> Set the request model
|
package/src/consumer.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { spawn as defaultSpawn } from "node:child_process";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
|
-
const CONSUMER_RELEASE_VERSION = "0.1.
|
|
5
|
+
const CONSUMER_RELEASE_VERSION = "0.1.18";
|
|
6
6
|
const DEFAULT_NODE_IMAGE =
|
|
7
|
-
"ghcr.io/charleslzp/mycomesh-node@sha256:
|
|
7
|
+
"ghcr.io/charleslzp/mycomesh-node@sha256:19da19f54d186a070b14e0817eddc933f081f65e3b652c356847a0c033d6edfb";
|
|
8
8
|
const API_COMMANDS = new Set(["health", "models", "responses", "chat"]);
|
|
9
9
|
const API_VALUE_OPTIONS = new Set([
|
|
10
10
|
"--base-url",
|
|
@@ -26,7 +26,7 @@ const HELP = `Usage: mycomesh-consumer [options] [-- codex-options]
|
|
|
26
26
|
Start the local MycoMesh Consumer. No options are needed.
|
|
27
27
|
|
|
28
28
|
The default command starts the pinned Docker runtime, opens the local wallet
|
|
29
|
-
and funding page, waits for
|
|
29
|
+
and funding page, waits for prepaid access, then opens Codex through
|
|
30
30
|
the loopback Consumer at http://127.0.0.1:8110/v1.
|
|
31
31
|
|
|
32
32
|
Options:
|
|
@@ -50,7 +50,7 @@ Existing API commands remain available:
|
|
|
50
50
|
|
|
51
51
|
Docker Desktop/Engine is required. The package installs official Codex and
|
|
52
52
|
wallet keys remain in the browser wallet; local Consumer credentials and
|
|
53
|
-
|
|
53
|
+
payment state remain in a protected Docker volume.`;
|
|
54
54
|
|
|
55
55
|
class ConsumerCliError extends Error {
|
|
56
56
|
constructor(message, exitCode = 1) {
|