mycomesh-consumer 0.1.22 → 0.1.24
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 +16 -23
- package/consumer.compose.yml +5 -9
- package/package.json +1 -1
- package/scripts/start-consumer.sh +5 -5
- package/src/cli.mjs +1 -1
- package/src/consumer.mjs +10 -11
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# mycomesh-consumer
|
|
2
2
|
|
|
3
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
|
|
5
|
-
|
|
6
|
-
loopback proxy.
|
|
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.
|
|
7
7
|
|
|
8
8
|
The package is published as `mycomesh-consumer`. `mycomesh-consumer` and the
|
|
9
9
|
short `mycomesh` command are equivalent.
|
|
@@ -13,7 +13,6 @@ short `mycomesh` command are equivalent.
|
|
|
13
13
|
- Node.js 20 or newer
|
|
14
14
|
- Docker Desktop/Engine with Compose V2
|
|
15
15
|
- The official Codex dependency installed with this npm package
|
|
16
|
-
- An injected browser wallet on Sepolia with enough ETH for transaction gas
|
|
17
16
|
|
|
18
17
|
For local development, install it directly from the repository:
|
|
19
18
|
|
|
@@ -29,11 +28,10 @@ mycomesh-consumer
|
|
|
29
28
|
```
|
|
30
29
|
|
|
31
30
|
No checkout, separate Codex install, host Python, GNU Make, public Gateway URL, or command arguments are
|
|
32
|
-
required. The command
|
|
33
|
-
possible.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
state stay in a protected Docker volume.
|
|
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.
|
|
37
35
|
|
|
38
36
|
The runtime image is pinned by digest. Stop it without deleting state with:
|
|
39
37
|
|
|
@@ -47,24 +45,19 @@ local proxy running. Consumer network traffic is direct by default. Use
|
|
|
47
45
|
hosts are translated to `host.docker.internal`. Dedicated
|
|
48
46
|
`MYCOMESH_CONSUMER_*_PROXY` variables remain available for operators.
|
|
49
47
|
|
|
50
|
-
Upgrading the npm package does not require clearing
|
|
51
|
-
volume is intentionally reused so its
|
|
52
|
-
|
|
53
|
-
close that tab and reopen the printed onboarding URL, or clear site data for
|
|
54
|
-
`http://127.0.0.1:8110` in the browser. To reset all local Consumer state,
|
|
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,
|
|
55
51
|
use the explicit, confirmed reset command:
|
|
56
52
|
|
|
57
53
|
```sh
|
|
58
54
|
mycomesh-consumer --reset-local
|
|
59
55
|
```
|
|
60
56
|
|
|
61
|
-
If Codex reports an interrupted request, stop Codex
|
|
62
|
-
`mycomesh-consumer --no-codex
|
|
63
|
-
access**. The Consumer handles the previous payment state without replaying it.
|
|
57
|
+
If Codex reports an interrupted request, stop Codex and run
|
|
58
|
+
`mycomesh-consumer --no-codex` to restart the local edge.
|
|
64
59
|
|
|
65
|
-
This removes the local
|
|
66
|
-
records. Any pending payment authorization remains managed separately. The
|
|
67
|
-
command asks you to type `RESET`
|
|
60
|
+
This removes the local payment key and Consumer state. The command asks you to type `RESET`
|
|
68
61
|
and removes only the fixed Consumer Compose project and its protected volume.
|
|
69
62
|
|
|
70
63
|
The existing stateless API commands remain available. For example:
|
|
@@ -102,8 +95,8 @@ export MYCOMESH_BASE_URL=http://127.0.0.1:8110/v1
|
|
|
102
95
|
export MYCOMESH_API_KEY='replace-with-local-consumer-key'
|
|
103
96
|
```
|
|
104
97
|
|
|
105
|
-
The local proxy selects
|
|
106
|
-
identifier or per-request wallet signature is needed. A public Gateway can
|
|
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
|
|
107
100
|
still be used explicitly with `--base-url`, but it is never the default.
|
|
108
101
|
|
|
109
102
|
## Commands
|
|
@@ -125,7 +118,7 @@ mycomesh chat \
|
|
|
125
118
|
```
|
|
126
119
|
|
|
127
120
|
The request CLI sends standard OpenAI-shaped requests. The local proxy binds
|
|
128
|
-
each request to the
|
|
121
|
+
each request to the persisted payment key automatically.
|
|
129
122
|
|
|
130
123
|
Use `--stream` to request SSE. SSE bytes are forwarded to stdout as they arrive,
|
|
131
124
|
without rewriting event boundaries:
|
package/consumer.compose.yml
CHANGED
|
@@ -37,15 +37,11 @@ services:
|
|
|
37
37
|
working_dir: /data
|
|
38
38
|
environment:
|
|
39
39
|
MYCOMESH_CONSUMER_DATA_DIR: /data
|
|
40
|
-
MYCOMESH_CONSUMER_NETWORK_CONFIG: /app/deployments/sepolia-provider-network-
|
|
40
|
+
MYCOMESH_CONSUMER_NETWORK_CONFIG: /app/deployments/sepolia-provider-network-v7.json
|
|
41
41
|
MYCOMESH_CONSUMER_PUBLIC_BASE_URL: http://127.0.0.1:8110/v1
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
MYCOMESH_CONSUMER_SESSION_MAX_AMOUNT_UNITS: ${MYCOMESH_CONSUMER_SESSION_MAX_AMOUNT_UNITS:-10000000}
|
|
46
|
-
MYCOMESH_CONSUMER_REQUEST_TIMEOUT_SECONDS: ${MYCOMESH_CONSUMER_REQUEST_TIMEOUT_SECONDS:-300}
|
|
47
|
-
MYCOMESH_CONSUMER_MAX_REQUEST_BYTES: ${MYCOMESH_CONSUMER_MAX_REQUEST_BYTES:-1048576}
|
|
48
|
-
MYCOMESH_CONSUMER_REQUEST_BODY_TIMEOUT_SECONDS: ${MYCOMESH_CONSUMER_REQUEST_BODY_TIMEOUT_SECONDS:-30}
|
|
42
|
+
MYCOMESH_V7_RELAY_URLS: ${MYCOMESH_V7_RELAY_URLS:-https://bridge.mycomesh.xyz}
|
|
43
|
+
MYCOMESH_V7_MAX_FEE_UNITS: ${MYCOMESH_V7_MAX_FEE_UNITS:-100000}
|
|
44
|
+
MYCOMESH_V7_REQUEST_TIMEOUT_SECONDS: ${MYCOMESH_V7_REQUEST_TIMEOUT_SECONDS:-300}
|
|
49
45
|
HTTP_PROXY: ${MYCOMESH_CONSUMER_HTTP_PROXY:-}
|
|
50
46
|
HTTPS_PROXY: ${MYCOMESH_CONSUMER_HTTPS_PROXY:-}
|
|
51
47
|
ALL_PROXY: ${MYCOMESH_CONSUMER_ALL_PROXY:-}
|
|
@@ -76,7 +72,7 @@ services:
|
|
|
76
72
|
timeout: 5s
|
|
77
73
|
retries: 4
|
|
78
74
|
start_period: 10s
|
|
79
|
-
entrypoint: ["python", "-m", "gateway.
|
|
75
|
+
entrypoint: ["python", "-m", "gateway.consumer_v7"]
|
|
80
76
|
command: ["serve", "--host", "0.0.0.0", "--port", "8110"]
|
|
81
77
|
|
|
82
78
|
volumes:
|
package/package.json
CHANGED
|
@@ -104,7 +104,7 @@ compose() {
|
|
|
104
104
|
|
|
105
105
|
open_browser() {
|
|
106
106
|
local url="$1" opener=""
|
|
107
|
-
printf 'MycoMesh Consumer
|
|
107
|
+
printf 'MycoMesh Consumer credentials: %s\n' "$url"
|
|
108
108
|
((NO_BROWSER)) && return
|
|
109
109
|
case "$(uname -s 2>/dev/null || printf unknown)" in
|
|
110
110
|
Darwin) opener=open ;;
|
|
@@ -173,7 +173,7 @@ if ! compose up -d --wait --wait-timeout 90 consumer; then
|
|
|
173
173
|
"$DOCKER" compose --project-name "$PROJECT_NAME" --file "$COMPOSE_FILE" logs --tail=120 consumer >&2 || true
|
|
174
174
|
exit 1
|
|
175
175
|
fi
|
|
176
|
-
url="http://127.0.0.1:8110/
|
|
176
|
+
url="http://127.0.0.1:8110/"
|
|
177
177
|
open_browser "$url"
|
|
178
178
|
|
|
179
179
|
if ((DRY_RUN || NO_CODEX)); then
|
|
@@ -182,7 +182,7 @@ if ((DRY_RUN || NO_CODEX)); then
|
|
|
182
182
|
exit 0
|
|
183
183
|
fi
|
|
184
184
|
|
|
185
|
-
printf '%s\n' "Waiting for
|
|
185
|
+
printf '%s\n' "Waiting for a healthy Settlement V7 Relay..."
|
|
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
|
|
@@ -192,7 +192,7 @@ while ! curl --noproxy '*' --fail --silent --max-time 3 http://127.0.0.1:8110/re
|
|
|
192
192
|
sleep 2
|
|
193
193
|
done
|
|
194
194
|
|
|
195
|
-
if ! codex_env="$("$DOCKER" compose --project-name "$PROJECT_NAME" --file "$COMPOSE_FILE" exec -T consumer python -m gateway.
|
|
195
|
+
if ! codex_env="$("$DOCKER" compose --project-name "$PROJECT_NAME" --file "$COMPOSE_FILE" exec -T consumer python -m gateway.consumer_v7 codex-env)"; then
|
|
196
196
|
die "could not load Codex credentials from the local Consumer"
|
|
197
197
|
fi
|
|
198
198
|
eval "$codex_env"
|
|
@@ -209,7 +209,7 @@ codex_command=(
|
|
|
209
209
|
-c 'model_provider="mycomesh"' \
|
|
210
210
|
-c 'model_providers.mycomesh.name="MycoMesh"' \
|
|
211
211
|
-c 'model_providers.mycomesh.base_url="http://127.0.0.1:8110/v1"' \
|
|
212
|
-
-c 'model_providers.mycomesh.env_key="
|
|
212
|
+
-c 'model_providers.mycomesh.env_key="OPENAI_API_KEY"' \
|
|
213
213
|
-c 'model_providers.mycomesh.wire_api="responses"'
|
|
214
214
|
)
|
|
215
215
|
if ((${#CODEX_ARGS[@]})); then
|
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.24";
|
|
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.
|
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.24";
|
|
6
6
|
const DEFAULT_NODE_IMAGE =
|
|
7
|
-
"ghcr.io/charleslzp/mycomesh-node@sha256:
|
|
7
|
+
"ghcr.io/charleslzp/mycomesh-node@sha256:bdbefd69c3dcb622717e71917e06f7da3d2a25dd8fe8e4effcccb3fd79a7929b";
|
|
8
8
|
const API_COMMANDS = new Set(["health", "models", "responses", "chat"]);
|
|
9
9
|
const API_VALUE_OPTIONS = new Set([
|
|
10
10
|
"--base-url",
|
|
@@ -25,17 +25,17 @@ const HELP = `Usage: mycomesh-consumer [options] [-- codex-options]
|
|
|
25
25
|
|
|
26
26
|
Start the local MycoMesh Consumer. No options are needed.
|
|
27
27
|
|
|
28
|
-
The default command starts the pinned Docker runtime, opens the local
|
|
29
|
-
|
|
28
|
+
The default command starts the pinned Docker runtime, opens the local
|
|
29
|
+
credentials page with the export URL and payment key, then opens Codex through
|
|
30
30
|
the loopback Consumer at http://127.0.0.1:8110/v1.
|
|
31
31
|
|
|
32
32
|
Options:
|
|
33
|
-
--no-browser Print the
|
|
34
|
-
--no-codex Start the Consumer and
|
|
35
|
-
--stop Stop the Consumer without deleting its
|
|
33
|
+
--no-browser Print the credentials URL without opening it
|
|
34
|
+
--no-codex Start the Consumer and credentials page without Codex
|
|
35
|
+
--stop Stop the Consumer without deleting its payment key
|
|
36
36
|
--reset-local Confirm and delete the local Consumer volume
|
|
37
37
|
--codex-command PATH Codex executable (default: codex)
|
|
38
|
-
--ready-timeout SEC
|
|
38
|
+
--ready-timeout SEC Relay readiness timeout (default: 1800)
|
|
39
39
|
--proxy URL Optional proxy for Consumer network traffic
|
|
40
40
|
--node-image IMAGE Advanced: override the pinned Consumer image
|
|
41
41
|
--dry-run Print the planned Docker operations
|
|
@@ -48,9 +48,8 @@ Existing API commands remain available:
|
|
|
48
48
|
mycomesh-consumer responses "hello"
|
|
49
49
|
mycomesh-consumer chat "hello"
|
|
50
50
|
|
|
51
|
-
Docker Desktop/Engine is required. The
|
|
52
|
-
|
|
53
|
-
payment state remain in a protected Docker volume.`;
|
|
51
|
+
Docker Desktop/Engine is required. The payment key and Consumer state remain
|
|
52
|
+
in a protected Docker volume; no wallet signature or browser session is used.`;
|
|
54
53
|
|
|
55
54
|
class ConsumerCliError extends Error {
|
|
56
55
|
constructor(message, exitCode = 1) {
|