mycomesh-consumer 0.1.2 → 0.1.4

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
@@ -42,8 +42,28 @@ mycomesh-consumer --stop
42
42
  ```
43
43
 
44
44
  Use `--no-browser` on a headless machine or `--no-codex` to leave only the
45
- local proxy running. Standard proxy variables are forwarded into the Consumer;
46
- loopback proxy hosts are translated to `host.docker.internal`.
45
+ local proxy running. Consumer network traffic is direct by default. Use
46
+ `--proxy http://127.0.0.1:10792` only when a proxy is needed; loopback proxy
47
+ hosts are translated to `host.docker.internal`. Dedicated
48
+ `MYCOMESH_CONSUMER_*_PROXY` variables remain available for operators.
49
+
50
+ Upgrading the npm package does not require clearing a Session. The Consumer
51
+ volume is intentionally reused so its API key, identity and verified Session
52
+ route survive restarts. If the browser page is stuck on an old local record,
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,
55
+ stop it first and remove only the named volume:
56
+
57
+ ```sh
58
+ mycomesh-consumer --stop
59
+ docker volume ls --filter name=mycomesh-consumer-data
60
+ docker volume rm mycomesh-consumer-data
61
+ ```
62
+
63
+ This removes the local API key, identity, wallet metadata and SQLite Session
64
+ records. It does not close or refund an already-open on-chain V5 Session; let
65
+ that Session expire or submit the contract's close transaction separately
66
+ before treating its escrow as available.
47
67
 
48
68
  The existing stateless API commands remain available. For example:
49
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mycomesh-consumer",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Local-first MycoMesh Consumer launcher and OpenAI-compatible request CLI.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -7,6 +7,7 @@ PROJECT_NAME="mycomesh-consumer"
7
7
  NODE_IMAGE="${MYCOMESH_NODE_IMAGE:-}"
8
8
  CODEX_COMMAND="${MYCOMESH_CODEX_COMMAND:-codex}"
9
9
  READY_TIMEOUT="${MYCOMESH_CONSUMER_READY_TIMEOUT_SECONDS:-1800}"
10
+ PROXY_URL="${MYCOMESH_CONSUMER_PROXY:-}"
10
11
  NO_BROWSER=0
11
12
  NO_CODEX=0
12
13
  STOP=0
@@ -82,11 +83,11 @@ rewrite_loopback_proxy() {
82
83
 
83
84
  prepare_proxy_env() {
84
85
  local all_proxy_value no_proxy_value
85
- all_proxy_value="${MYCOMESH_CONSUMER_ALL_PROXY:-${all_proxy:-${ALL_PROXY:-}}}"
86
- export MYCOMESH_CONSUMER_HTTP_PROXY="$(rewrite_loopback_proxy "${MYCOMESH_CONSUMER_HTTP_PROXY:-${http_proxy:-${HTTP_PROXY:-$all_proxy_value}}}")"
87
- export MYCOMESH_CONSUMER_HTTPS_PROXY="$(rewrite_loopback_proxy "${MYCOMESH_CONSUMER_HTTPS_PROXY:-${https_proxy:-${HTTPS_PROXY:-$all_proxy_value}}}")"
86
+ all_proxy_value="${MYCOMESH_CONSUMER_ALL_PROXY:-}"
87
+ export MYCOMESH_CONSUMER_HTTP_PROXY="$(rewrite_loopback_proxy "${MYCOMESH_CONSUMER_HTTP_PROXY:-$PROXY_URL}")"
88
+ export MYCOMESH_CONSUMER_HTTPS_PROXY="$(rewrite_loopback_proxy "${MYCOMESH_CONSUMER_HTTPS_PROXY:-$PROXY_URL}")"
88
89
  export MYCOMESH_CONSUMER_ALL_PROXY="$(rewrite_loopback_proxy "$all_proxy_value")"
89
- no_proxy_value="${MYCOMESH_CONSUMER_NO_PROXY:-${no_proxy:-${NO_PROXY:-}}}"
90
+ no_proxy_value="${MYCOMESH_CONSUMER_NO_PROXY:-}"
90
91
  export MYCOMESH_CONSUMER_NO_PROXY="${no_proxy_value:+${no_proxy_value},}127.0.0.1,localhost,::1"
91
92
  export NO_PROXY="$MYCOMESH_CONSUMER_NO_PROXY"
92
93
  export no_proxy="$MYCOMESH_CONSUMER_NO_PROXY"
@@ -119,6 +120,7 @@ while (($#)); do
119
120
  --node-image) (($# >= 2)) || die "--node-image requires a value"; NODE_IMAGE="$2"; shift 2 ;;
120
121
  --codex-command) (($# >= 2)) || die "--codex-command requires a value"; CODEX_COMMAND="$2"; shift 2 ;;
121
122
  --ready-timeout) (($# >= 2)) || die "--ready-timeout requires a value"; READY_TIMEOUT="$2"; shift 2 ;;
123
+ --proxy) (($# >= 2)) || die "--proxy requires a value"; PROXY_URL="$2"; shift 2 ;;
122
124
  --no-browser) NO_BROWSER=1; shift ;;
123
125
  --no-codex) NO_CODEX=1; shift ;;
124
126
  --stop) STOP=1; shift ;;
@@ -136,6 +138,11 @@ done
136
138
  DOCKER="$(find_docker_cli)"
137
139
  if ((!DRY_RUN)); then "$DOCKER" info >/dev/null 2>&1 || die "Docker Engine/Desktop is not running"; fi
138
140
  prepare_proxy_env
141
+ if [[ -n "$MYCOMESH_CONSUMER_HTTP_PROXY$MYCOMESH_CONSUMER_HTTPS_PROXY$MYCOMESH_CONSUMER_ALL_PROXY" ]]; then
142
+ printf '%s\n' "Consumer network: explicit proxy"
143
+ else
144
+ printf '%s\n' "Consumer network: direct"
145
+ fi
139
146
  export MYCOMESH_NODE_IMAGE="$NODE_IMAGE"
140
147
 
141
148
  if ((STOP)); then
@@ -180,11 +187,16 @@ if ! command -v "$CODEX_COMMAND" >/dev/null 2>&1; then
180
187
  fi
181
188
 
182
189
  printf '%s\n' "Opening Codex through the local MycoMesh Consumer."
183
- exec "$CODEX_COMMAND" \
190
+ codex_command=(
191
+ "$CODEX_COMMAND"
184
192
  -c 'model="gpt-5.5"' \
185
193
  -c 'model_provider="mycomesh"' \
186
194
  -c 'model_providers.mycomesh.name="MycoMesh"' \
187
195
  -c 'model_providers.mycomesh.base_url="http://127.0.0.1:8110/v1"' \
188
196
  -c 'model_providers.mycomesh.env_key="MYCOMESH_API_KEY"' \
189
- -c 'model_providers.mycomesh.wire_api="responses"' \
190
- "${CODEX_ARGS[@]}"
197
+ -c 'model_providers.mycomesh.wire_api="responses"'
198
+ )
199
+ if ((${#CODEX_ARGS[@]})); then
200
+ codex_command+=("${CODEX_ARGS[@]}")
201
+ fi
202
+ exec "${codex_command[@]}"
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.2";
4
+ const CLI_VERSION = "0.1.4";
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.2";
5
+ const CONSUMER_RELEASE_VERSION = "0.1.4";
6
6
  const DEFAULT_NODE_IMAGE =
7
- "ghcr.io/charleslzp/mycomesh-node@sha256:341fff4ee5d1d820d2149c5b1fc4de619ef0abbb41c83408ad8a9f8bfbf31d10";
7
+ "ghcr.io/charleslzp/mycomesh-node@sha256:86c44b7807057904446f74528e4e4ed7c863edcbd833c3688975d6d4ca8c480d";
8
8
  const API_COMMANDS = new Set(["health", "models", "responses", "chat"]);
9
9
  const API_VALUE_OPTIONS = new Set([
10
10
  "--base-url",
@@ -35,6 +35,7 @@ Options:
35
35
  --stop Stop the Consumer without deleting its wallet state
36
36
  --codex-command PATH Codex executable (default: codex)
37
37
  --ready-timeout SEC Wallet onboarding timeout (default: 1800)
38
+ --proxy URL Optional proxy for Consumer network traffic
38
39
  --node-image IMAGE Advanced: override the pinned Consumer image
39
40
  --dry-run Print the planned Docker operations
40
41
  -h, --help Show this help
@@ -91,6 +92,7 @@ export function parseArguments(argv, env = process.env) {
91
92
  nodeImage: env.MYCOMESH_NODE_IMAGE || DEFAULT_NODE_IMAGE,
92
93
  codexCommand: env.MYCOMESH_CODEX_COMMAND || bundledCodexCommand(),
93
94
  readyTimeout: env.MYCOMESH_CONSUMER_READY_TIMEOUT_SECONDS || undefined,
95
+ proxy: env.MYCOMESH_CONSUMER_PROXY || undefined,
94
96
  noBrowser: false,
95
97
  noCodex: false,
96
98
  stop: false,
@@ -133,7 +135,7 @@ export function parseArguments(argv, env = process.env) {
133
135
  const separator = token.indexOf("=");
134
136
  const name = separator === -1 ? token : token.slice(0, separator);
135
137
  let value = separator === -1 ? undefined : token.slice(separator + 1);
136
- if (!["--node-image", "--codex-command", "--ready-timeout"].includes(name)) {
138
+ if (!["--node-image", "--codex-command", "--ready-timeout", "--proxy"].includes(name)) {
137
139
  throw new ConsumerCliError(`unknown option: ${token}`, 2);
138
140
  }
139
141
  if (value === undefined) {
@@ -144,6 +146,7 @@ export function parseArguments(argv, env = process.env) {
144
146
  if (name === "--node-image") parsed.nodeImage = value;
145
147
  if (name === "--codex-command") parsed.codexCommand = value;
146
148
  if (name === "--ready-timeout") parsed.readyTimeout = value;
149
+ if (name === "--proxy") parsed.proxy = value;
147
150
  }
148
151
  if (!/^[A-Za-z0-9][A-Za-z0-9._/-]*@sha256:[a-f0-9]{64}$/.test(parsed.nodeImage)) {
149
152
  throw new ConsumerCliError("Consumer image must be pinned by digest", 2);
@@ -181,6 +184,7 @@ export function toScriptArgs(parsed) {
181
184
  const args = ["--node-image", parsed.nodeImage];
182
185
  if (parsed.codexCommand) args.push("--codex-command", parsed.codexCommand);
183
186
  if (parsed.readyTimeout) args.push("--ready-timeout", parsed.readyTimeout);
187
+ if (parsed.proxy) args.push("--proxy", parsed.proxy);
184
188
  if (parsed.noBrowser) args.push("--no-browser");
185
189
  if (parsed.noCodex) args.push("--no-codex");
186
190
  if (parsed.stop) args.push("--stop");