mycomesh-consumer 0.1.5 → 0.1.6
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 +4 -5
- package/package.json +1 -1
- package/scripts/start-consumer.sh +16 -0
- package/src/cli.mjs +1 -1
- package/src/consumer.mjs +8 -1
package/README.md
CHANGED
|
@@ -52,18 +52,17 @@ volume is intentionally reused so its API key, identity and verified Session
|
|
|
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,
|
|
55
|
-
|
|
55
|
+
use the explicit, confirmed reset command:
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
mycomesh-consumer --
|
|
59
|
-
docker volume ls --filter name=mycomesh-consumer_mycomesh-consumer-data
|
|
60
|
-
docker volume rm mycomesh-consumer_mycomesh-consumer-data
|
|
58
|
+
mycomesh-consumer --reset-local
|
|
61
59
|
```
|
|
62
60
|
|
|
63
61
|
This removes the local API key, identity, wallet metadata and SQLite Session
|
|
64
62
|
records. It does not close or refund an already-open on-chain V5 Session; let
|
|
65
63
|
that Session expire or submit the contract's close transaction separately
|
|
66
|
-
before treating its escrow as available.
|
|
64
|
+
before treating its escrow as available. The command asks you to type `RESET`
|
|
65
|
+
and removes only the fixed Consumer Compose project and its protected volume.
|
|
67
66
|
|
|
68
67
|
The existing stateless API commands remain available. For example:
|
|
69
68
|
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ PROXY_URL="${MYCOMESH_CONSUMER_PROXY:-}"
|
|
|
11
11
|
NO_BROWSER=0
|
|
12
12
|
NO_CODEX=0
|
|
13
13
|
STOP=0
|
|
14
|
+
RESET_LOCAL=0
|
|
14
15
|
DRY_RUN=0
|
|
15
16
|
CODEX_ARGS=()
|
|
16
17
|
|
|
@@ -124,6 +125,7 @@ while (($#)); do
|
|
|
124
125
|
--no-browser) NO_BROWSER=1; shift ;;
|
|
125
126
|
--no-codex) NO_CODEX=1; shift ;;
|
|
126
127
|
--stop) STOP=1; shift ;;
|
|
128
|
+
--reset-local) RESET_LOCAL=1; shift ;;
|
|
127
129
|
--dry-run) DRY_RUN=1; shift ;;
|
|
128
130
|
--) shift; CODEX_ARGS=("$@"); break ;;
|
|
129
131
|
*) die "unknown option: $1" ;;
|
|
@@ -151,6 +153,20 @@ if ((STOP)); then
|
|
|
151
153
|
exit 0
|
|
152
154
|
fi
|
|
153
155
|
|
|
156
|
+
if ((RESET_LOCAL)); then
|
|
157
|
+
if ((DRY_RUN)); then
|
|
158
|
+
printf '%s\n' "Would remove the Consumer containers, network, and protected local volume."
|
|
159
|
+
exit 0
|
|
160
|
+
fi
|
|
161
|
+
printf '%s\n' "This removes the local API key, Consumer identity, wallet metadata and SQLite Session records."
|
|
162
|
+
printf '%s' 'Type RESET to continue: '
|
|
163
|
+
read -r confirmation
|
|
164
|
+
[[ "$confirmation" == RESET ]] || die "local Consumer reset cancelled"
|
|
165
|
+
compose down --volumes --remove-orphans
|
|
166
|
+
printf '%s\n' "Local Consumer state removed. Any on-chain V5 Session remains on-chain."
|
|
167
|
+
exit 0
|
|
168
|
+
fi
|
|
169
|
+
|
|
154
170
|
compose pull consumer-volume-init consumer
|
|
155
171
|
if ! compose up -d --wait --wait-timeout 90 consumer; then
|
|
156
172
|
printf '%s\n' "Consumer startup failed. Check whether another process owns 127.0.0.1:8110." >&2
|
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.6";
|
|
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,7 +2,7 @@ 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.6";
|
|
6
6
|
const DEFAULT_NODE_IMAGE =
|
|
7
7
|
"ghcr.io/charleslzp/mycomesh-node@sha256:86c44b7807057904446f74528e4e4ed7c863edcbd833c3688975d6d4ca8c480d";
|
|
8
8
|
const API_COMMANDS = new Set(["health", "models", "responses", "chat"]);
|
|
@@ -33,6 +33,7 @@ Options:
|
|
|
33
33
|
--no-browser Print the onboarding URL without opening it
|
|
34
34
|
--no-codex Start the Consumer and browser without opening Codex
|
|
35
35
|
--stop Stop the Consumer without deleting its wallet state
|
|
36
|
+
--reset-local Confirm and delete the local Consumer volume
|
|
36
37
|
--codex-command PATH Codex executable (default: codex)
|
|
37
38
|
--ready-timeout SEC Wallet onboarding timeout (default: 1800)
|
|
38
39
|
--proxy URL Optional proxy for Consumer network traffic
|
|
@@ -96,6 +97,7 @@ export function parseArguments(argv, env = process.env) {
|
|
|
96
97
|
noBrowser: false,
|
|
97
98
|
noCodex: false,
|
|
98
99
|
stop: false,
|
|
100
|
+
resetLocal: false,
|
|
99
101
|
dryRun: false,
|
|
100
102
|
help: false,
|
|
101
103
|
version: false,
|
|
@@ -128,6 +130,10 @@ export function parseArguments(argv, env = process.env) {
|
|
|
128
130
|
parsed.stop = true;
|
|
129
131
|
continue;
|
|
130
132
|
}
|
|
133
|
+
if (token === "--reset-local") {
|
|
134
|
+
parsed.resetLocal = true;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
131
137
|
if (token === "--dry-run") {
|
|
132
138
|
parsed.dryRun = true;
|
|
133
139
|
continue;
|
|
@@ -188,6 +194,7 @@ export function toScriptArgs(parsed) {
|
|
|
188
194
|
if (parsed.noBrowser) args.push("--no-browser");
|
|
189
195
|
if (parsed.noCodex) args.push("--no-codex");
|
|
190
196
|
if (parsed.stop) args.push("--stop");
|
|
197
|
+
if (parsed.resetLocal) args.push("--reset-local");
|
|
191
198
|
if (parsed.dryRun) args.push("--dry-run");
|
|
192
199
|
if (parsed.codexArgs.length) args.push("--", ...parsed.codexArgs);
|
|
193
200
|
return args;
|