mycomesh-consumer 0.1.1 → 0.1.3

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,10 @@ 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.
47
49
 
48
50
  The existing stateless API commands remain available. For example:
49
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mycomesh-consumer",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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
@@ -169,7 +176,11 @@ while ! curl --noproxy '*' --fail --silent --max-time 3 http://127.0.0.1:8110/re
169
176
  sleep 2
170
177
  done
171
178
 
172
- eval "$("$DOCKER" compose --project-name "$PROJECT_NAME" --file "$COMPOSE_FILE" exec -T consumer python -m gateway.local_consumer codex-env)"
179
+ if ! codex_env="$("$DOCKER" compose --project-name "$PROJECT_NAME" --file "$COMPOSE_FILE" exec -T consumer python -m gateway.local_consumer codex-env)"; then
180
+ die "could not load Codex credentials from the local Consumer"
181
+ fi
182
+ eval "$codex_env"
183
+ unset codex_env
173
184
  if ! command -v "$CODEX_COMMAND" >/dev/null 2>&1; then
174
185
  printf "error: Consumer is ready, but '%s' is not installed on this host\n" "$CODEX_COMMAND" >&2
175
186
  exit 127
@@ -177,7 +188,7 @@ fi
177
188
 
178
189
  printf '%s\n' "Opening Codex through the local MycoMesh Consumer."
179
190
  exec "$CODEX_COMMAND" \
180
- -c 'model="mycomesh-codex-standard-v1"' \
191
+ -c 'model="gpt-5.5"' \
181
192
  -c 'model_provider="mycomesh"' \
182
193
  -c 'model_providers.mycomesh.name="MycoMesh"' \
183
194
  -c 'model_providers.mycomesh.base_url="http://127.0.0.1:8110/v1"' \
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.1";
4
+ const CLI_VERSION = "0.1.3";
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.1";
5
+ const CONSUMER_RELEASE_VERSION = "0.1.3";
6
6
  const DEFAULT_NODE_IMAGE =
7
- "ghcr.io/charleslzp/mycomesh-node@sha256:aeb61a318a29b70a96f54daacae6fc35ca7cad719b9de295d76306a5cb2b6222";
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");