dominds 1.26.0 → 1.26.2

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
@@ -264,11 +264,11 @@ dominds cert create
264
264
  # Add explicit SAN hosts; --host can be repeated
265
265
  dominds cert create --host 192.168.1.10 --host my-host.local
266
266
 
267
- # Inspect whether a host can use an HTTPS certificate
268
- dominds cert status --host 0.0.0.0
267
+ # Inspect whether the detected LAN hosts can use an HTTPS certificate
268
+ dominds cert status
269
269
  ```
270
270
 
271
- `localhost`, `loopback`, `127.0.0.0/8`, `::1`, `0.0.0.0`, and `::` are not certificate hosts. `0.0.0.0` / `::` only mean bind-all; certificate matching uses detected non-loopback LAN hosts. A bare `--port 5666` disables Dominds built-in HTTPS and assumes a front proxy handles HTTPS, while the default port behavior and `--port 5666+/-` may auto-enable built-in HTTPS when a matching certificate exists.
271
+ `localhost`, `loopback`, `127.0.0.0/8`, `169.254.0.0/16`, `::1`, `fe80::/10`, `0.0.0.0`, and `::` are not certificate hosts. `0.0.0.0` / `::` only mean bind-all; certificate matching uses detected non-loopback LAN hosts. A bare `--port 5666` disables Dominds built-in HTTPS and assumes a front proxy handles HTTPS, while the default port behavior and `--port 5666+/-` may auto-enable built-in HTTPS when a matching certificate exists.
272
272
 
273
273
  ## Start from scratch
274
274
 
package/README.zh.md CHANGED
@@ -203,11 +203,11 @@ dominds cert create
203
203
  # 显式指定证书 SAN,可重复 --host
204
204
  dominds cert create --host 192.168.1.10 --host my-host.local
205
205
 
206
- # 查看指定 host 是否能匹配到证书
207
- dominds cert status --host 0.0.0.0
206
+ # 查看检测到的 LAN 主机是否能匹配到证书
207
+ dominds cert status
208
208
  ```
209
209
 
210
- `localhost`、`loopback`、`127.0.0.0/8`、`::1`、`0.0.0.0`、`::` 不会作为 HTTPS 证书主机;其中 `0.0.0.0` / `::` 仅表示绑定所有地址,匹配证书时会使用检测到的非 loopback LAN 主机。使用裸 `--port 5666` 启动时,Dominds 会认为 HTTPS 由前置代理负责,不启用内建 HTTPS;使用默认端口或 `--port 5666+/-` 时才会自动启用内建 HTTPS。
210
+ `localhost`、`loopback`、`127.0.0.0/8`、`169.254.0.0/16`、`::1`、`fe80::/10`、`0.0.0.0`、`::` 不会作为 HTTPS 证书主机;其中 `0.0.0.0` / `::` 仅表示绑定所有地址,匹配证书时会使用检测到的非 loopback LAN 主机。使用裸 `--port 5666` 启动时,Dominds 会认为 HTTPS 由前置代理负责,不启用内建 HTTPS;使用默认端口或 `--port 5666+/-` 时才会自动启用内建 HTTPS。
211
211
 
212
212
  ## 从零开始(空文件夹启动)
213
213
 
@@ -4,4 +4,5 @@ export type RtwsCliParseResult = Readonly<{
4
4
  }>;
5
5
  export declare function extractGlobalRtwsChdir(params: Readonly<{
6
6
  argv: ReadonlyArray<string>;
7
+ baseCwd?: string;
7
8
  }>): RtwsCliParseResult;
@@ -36,13 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.extractGlobalRtwsChdir = extractGlobalRtwsChdir;
37
37
  const path = __importStar(require("path"));
38
38
  function extractGlobalRtwsChdir(params) {
39
+ const baseCwd = params.baseCwd ?? process.cwd();
39
40
  let chdir;
40
41
  const out = [];
41
- const readAbsoluteChdir = (argName, value) => {
42
- if (!path.isAbsolute(value)) {
43
- throw new Error(`${argName} requires an absolute directory path: ${value}`);
44
- }
45
- return value;
42
+ const readChdir = (argName, value) => {
43
+ if (value.trim() === '')
44
+ throw new Error(`${argName} requires a directory argument`);
45
+ return path.resolve(baseCwd, value);
46
46
  };
47
47
  for (let i = 0; i < params.argv.length; i++) {
48
48
  const arg = params.argv[i];
@@ -55,7 +55,7 @@ function extractGlobalRtwsChdir(params) {
55
55
  if (typeof next !== 'string' || next.length === 0 || next === '--') {
56
56
  throw new Error(`${arg} requires a directory argument`);
57
57
  }
58
- chdir = readAbsoluteChdir(arg, next);
58
+ chdir = readChdir(arg, next);
59
59
  i++;
60
60
  continue;
61
61
  }
@@ -63,14 +63,14 @@ function extractGlobalRtwsChdir(params) {
63
63
  const value = arg.slice('--cwd='.length);
64
64
  if (value.length === 0)
65
65
  throw new Error(`--cwd requires a directory argument`);
66
- chdir = readAbsoluteChdir('--cwd', value);
66
+ chdir = readChdir('--cwd', value);
67
67
  continue;
68
68
  }
69
69
  if (arg.startsWith('--chdir=')) {
70
70
  const value = arg.slice('--chdir='.length);
71
71
  if (value.length === 0)
72
72
  throw new Error(`--chdir requires a directory argument`);
73
- chdir = readAbsoluteChdir('--chdir', value);
73
+ chdir = readChdir('--chdir', value);
74
74
  continue;
75
75
  }
76
76
  out.push(arg);
@@ -1,2 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export declare function main(args?: readonly string[]): Promise<void>;
2
+ export declare function main(args?: readonly string[], runtimeOptions?: Readonly<{
3
+ certsDirAbs?: string;
4
+ }>): Promise<void>;
package/dist/cli/cert.js CHANGED
@@ -10,11 +10,10 @@ Dominds certificate tools
10
10
 
11
11
  Usage:
12
12
  dominds cert create [--host <host>] [--days <days>] [--force]
13
- dominds cert self-cert [--host <host>] [--days <days>] [--force]
14
- dominds cert status --host <host> [--port <port>] [--origin]
13
+ dominds cert status [--host <host>] [--port <port>] [--origin]
15
14
 
16
15
  Options:
17
- --host <host> Host name or IP address (default for create: detected non-loopback LAN hosts)
16
+ --host <host> Host name or IP address (default: detected non-loopback LAN hosts)
18
17
  --days <days> Certificate validity in days (default: ${certificates_1.DEFAULT_SELF_SIGNED_CERT_DAYS})
19
18
  --force Overwrite existing generated files
20
19
  --port <port> Port for status --origin output
@@ -25,7 +24,7 @@ Certificates live in ~/.dominds/certs/. A WebUI server automatically enables HTT
25
24
  a certificate/key pair that matches the bind host or, for 0.0.0.0/::, a detected non-loopback LAN host.
26
25
  `);
27
26
  }
28
- async function main(args = process.argv.slice(2)) {
27
+ async function main(args = process.argv.slice(2), runtimeOptions = {}) {
29
28
  const first = args[0];
30
29
  if (first === undefined || first === '--help' || first === '-h') {
31
30
  printHelp();
@@ -49,6 +48,7 @@ async function main(args = process.argv.slice(2)) {
49
48
  altHosts: options.altHosts,
50
49
  days: options.days,
51
50
  force: options.force,
51
+ certsDirAbs: runtimeOptions.certsDirAbs,
52
52
  });
53
53
  console.log(`Created self-signed certificate for ${created.host}`);
54
54
  console.log(` hosts: ${created.hosts.join(', ')}`);
@@ -58,17 +58,15 @@ async function main(args = process.argv.slice(2)) {
58
58
  console.log(` days: ${created.days}`);
59
59
  return;
60
60
  }
61
- if (options.host === undefined) {
62
- console.error('Error: cert status requires --host <host>');
63
- printHelp();
64
- process.exit(1);
65
- }
66
- const lookup = await (0, certificates_1.findAutoHttpsCertificateForHost)({ host: options.host });
67
61
  if (options.origin) {
68
62
  if (options.port === undefined) {
69
63
  console.error('Error: cert status --origin requires --port <port>');
70
64
  process.exit(1);
71
65
  }
66
+ const lookup = await withConsoleInfoOnStderr(async () => (0, certificates_1.findAutoHttpsCertificateForHost)({
67
+ host: options.host ?? '::',
68
+ certsDirAbs: runtimeOptions.certsDirAbs,
69
+ }));
72
70
  console.log((0, auth_1.formatServerOrigin)({
73
71
  scheme: lookup.kind === 'found' ? 'https' : 'http',
74
72
  host: lookup.kind === 'found' ? lookup.certificate.matchedHost : lookup.endpoint.urlHost,
@@ -76,6 +74,10 @@ async function main(args = process.argv.slice(2)) {
76
74
  }));
77
75
  return;
78
76
  }
77
+ const lookup = await (0, certificates_1.findAutoHttpsCertificateForHost)({
78
+ host: options.host ?? '::',
79
+ certsDirAbs: runtimeOptions.certsDirAbs,
80
+ });
79
81
  for (const diagnostic of lookup.diagnostics) {
80
82
  console.warn(`warning: ${diagnostic.message}`);
81
83
  }
@@ -94,7 +96,6 @@ async function main(args = process.argv.slice(2)) {
94
96
  function parseAction(value) {
95
97
  switch (value) {
96
98
  case 'create':
97
- case 'self-cert':
98
99
  return 'create';
99
100
  case 'status':
100
101
  return 'status';
@@ -113,24 +114,30 @@ function parseOptions(args, action) {
113
114
  const arg = args[i];
114
115
  if (arg === '--host') {
115
116
  const next = args[i + 1];
116
- if (!next)
117
+ if (next === undefined || next === '') {
117
118
  return { kind: 'error', message: '--host requires a value' };
118
- if (host === undefined)
119
- host = next;
120
- else
121
- altHosts.push(next);
119
+ }
120
+ const hostResult = addHostOption({ action, host, altHosts, value: next });
121
+ if (hostResult.kind === 'error')
122
+ return hostResult;
123
+ host = hostResult.host;
122
124
  i += 1;
123
125
  continue;
124
126
  }
125
127
  if (arg.startsWith('--host=')) {
126
128
  const value = arg.slice('--host='.length);
127
- if (host === undefined)
128
- host = value;
129
- else
130
- altHosts.push(value);
129
+ if (value === '')
130
+ return { kind: 'error', message: '--host requires a value' };
131
+ const hostResult = addHostOption({ action, host, altHosts, value });
132
+ if (hostResult.kind === 'error')
133
+ return hostResult;
134
+ host = hostResult.host;
131
135
  continue;
132
136
  }
133
137
  if (arg === '--days') {
138
+ if (action !== 'create') {
139
+ return { kind: 'error', message: '--days is only valid for cert create' };
140
+ }
134
141
  const next = args[i + 1];
135
142
  const parsed = next === undefined ? null : parseInteger(next);
136
143
  if (parsed === null)
@@ -140,6 +147,9 @@ function parseOptions(args, action) {
140
147
  continue;
141
148
  }
142
149
  if (arg.startsWith('--days=')) {
150
+ if (action !== 'create') {
151
+ return { kind: 'error', message: '--days is only valid for cert create' };
152
+ }
143
153
  const parsed = parseInteger(arg.slice('--days='.length));
144
154
  if (parsed === null)
145
155
  return { kind: 'error', message: '--days requires an integer' };
@@ -147,6 +157,9 @@ function parseOptions(args, action) {
147
157
  continue;
148
158
  }
149
159
  if (arg === '--port') {
160
+ if (action !== 'status') {
161
+ return { kind: 'error', message: '--port is only valid for cert status' };
162
+ }
150
163
  const next = args[i + 1];
151
164
  const parsed = next === undefined ? null : parseInteger(next);
152
165
  if (parsed === null || parsed < 1 || parsed > 65535) {
@@ -157,6 +170,9 @@ function parseOptions(args, action) {
157
170
  continue;
158
171
  }
159
172
  if (arg.startsWith('--port=')) {
173
+ if (action !== 'status') {
174
+ return { kind: 'error', message: '--port is only valid for cert status' };
175
+ }
160
176
  const parsed = parseInteger(arg.slice('--port='.length));
161
177
  if (parsed === null || parsed < 1 || parsed > 65535) {
162
178
  return { kind: 'error', message: '--port requires a valid TCP port' };
@@ -165,10 +181,16 @@ function parseOptions(args, action) {
165
181
  continue;
166
182
  }
167
183
  if (arg === '--force') {
184
+ if (action !== 'create') {
185
+ return { kind: 'error', message: '--force is only valid for cert create' };
186
+ }
168
187
  force = true;
169
188
  continue;
170
189
  }
171
190
  if (arg === '--origin') {
191
+ if (action !== 'status') {
192
+ return { kind: 'error', message: '--origin is only valid for cert status' };
193
+ }
172
194
  origin = true;
173
195
  continue;
174
196
  }
@@ -184,12 +206,39 @@ function parseOptions(args, action) {
184
206
  }
185
207
  return { kind: 'ok', host, days, altHosts, force, port, origin };
186
208
  }
209
+ function addHostOption(params) {
210
+ if (params.host === undefined) {
211
+ return { kind: 'ok', host: params.value };
212
+ }
213
+ if (params.action !== 'create') {
214
+ return { kind: 'error', message: '--host can only be repeated for cert create' };
215
+ }
216
+ params.altHosts.push(params.value);
217
+ return { kind: 'ok', host: params.host };
218
+ }
187
219
  function parseInteger(raw) {
188
220
  if (!/^[0-9]+$/.test(raw))
189
221
  return null;
190
222
  const parsed = Number(raw);
191
223
  return Number.isSafeInteger(parsed) ? parsed : null;
192
224
  }
225
+ async function withConsoleInfoOnStderr(fn) {
226
+ const originalInfo = console.info;
227
+ const originalDebug = console.debug;
228
+ console.info = (...args) => {
229
+ console.error(...args);
230
+ };
231
+ console.debug = (...args) => {
232
+ console.error(...args);
233
+ };
234
+ try {
235
+ return await fn();
236
+ }
237
+ finally {
238
+ console.info = originalInfo;
239
+ console.debug = originalDebug;
240
+ }
241
+ }
193
242
  if (require.main === module) {
194
243
  main().catch((error) => {
195
244
  console.error(error instanceof Error ? error.message : String(error));
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Notes:
10
10
  * - Template can be a short name (resolved via DOMINDS_TEMPLATE_BASE) or a git URL.
11
- * - rtws directory is `process.cwd()`. Use 'dominds -C <abs-dir> create ...' to create under another base dir.
11
+ * - rtws directory is `process.cwd()`. Use 'dominds -C <dir> create ...' to create under another base dir.
12
12
  */
13
13
  declare function main(argv?: readonly string[]): Promise<void>;
14
14
  export { main };
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Notes:
11
11
  * - Template can be a short name (resolved via DOMINDS_TEMPLATE_BASE) or a git URL.
12
- * - rtws directory is `process.cwd()`. Use 'dominds -C <abs-dir> create ...' to create under another base dir.
12
+ * - rtws directory is `process.cwd()`. Use 'dominds -C <dir> create ...' to create under another base dir.
13
13
  */
14
14
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
15
  if (k2 === undefined) k2 = k;
package/dist/cli/read.js CHANGED
@@ -59,7 +59,7 @@ function printUsage() {
59
59
  console.log('`--audit` runs prompt audit via hidden teammate @fuxi using default LLM config (skips when unavailable), and also includes static toolset checks (registry vs `.minds/mcp.yaml` declarations).');
60
60
  console.log('When <member-id> is omitted, reads all visible team members.');
61
61
  console.log('');
62
- console.log("Note: rtws (runtime workspace) directory is `process.cwd()`. Use 'dominds -C <abs-dir> read' to run in another rtws.");
62
+ console.log("Note: rtws (runtime workspace) directory is `process.cwd()`. Use 'dominds -C <dir> read' to run in another rtws.");
63
63
  console.log('');
64
64
  console.log('Examples:');
65
65
  console.log(' dominds read # Read all team members');
package/dist/cli/tui.js CHANGED
@@ -76,7 +76,7 @@ function showHelp() {
76
76
  console.log('');
77
77
  console.log('Start or continue a dialog with an AI team member using a Taskdoc.');
78
78
  console.log('');
79
- console.log("Note: rtws (runtime workspace) directory is `process.cwd()`. Use 'dominds -C <abs-dir> tui ...' to run in another rtws.");
79
+ console.log("Note: rtws (runtime workspace) directory is `process.cwd()`. Use 'dominds -C <dir> tui ...' to run in another rtws.");
80
80
  console.log('');
81
81
  console.log('Arguments:');
82
82
  console.log(' <taskdoc-path> Path to Taskdoc (required for dialog)');
package/dist/cli/webui.js CHANGED
@@ -38,7 +38,7 @@ Usage:
38
38
  dominds webui [options]
39
39
 
40
40
  Note:
41
- rtws (runtime workspace) directory is \`process.cwd()\`. Use 'dominds -C <abs-dir> webui' to run in another rtws.
41
+ rtws (runtime workspace) directory is \`process.cwd()\`. Use 'dominds -C <dir> webui' to run in another rtws.
42
42
 
43
43
  Options:
44
44
  -p, --port <port> Port to listen on. Bare port is strict; suffix + tries higher ports; suffix - tries lower ports.
@@ -164,17 +164,19 @@ async function main(args = process.argv.slice(2)) {
164
164
  host: started.urlHost,
165
165
  port: started.port,
166
166
  })}`);
167
+ let httpsEndpoint;
167
168
  if (started.httpsPort !== undefined && started.httpsUrlHost !== undefined) {
169
+ httpsEndpoint = { host: started.httpsUrlHost, port: started.httpsPort };
168
170
  const httpsBaseUrl = (0, auth_1.formatServerOrigin)({
169
171
  scheme: 'https',
170
- host: started.httpsUrlHost,
171
- port: started.httpsPort,
172
+ host: httpsEndpoint.host,
173
+ port: httpsEndpoint.port,
172
174
  });
173
175
  log.info(`HTTPS WebUI ready: ${httpsBaseUrl}`);
174
176
  log.debug(`HTTPS WebSocket endpoint: ${formatWebSocketEndpoint({
175
177
  scheme: 'wss',
176
- host: started.httpsUrlHost,
177
- port: started.httpsPort,
178
+ host: httpsEndpoint.host,
179
+ port: httpsEndpoint.port,
178
180
  })}`);
179
181
  }
180
182
  if (auth.kind === 'enabled') {
@@ -185,6 +187,14 @@ async function main(args = process.argv.slice(2)) {
185
187
  authKey: auth.key,
186
188
  });
187
189
  log.info(`auto auth url (sensitive): ${autoAuthUrl}`);
190
+ if (httpsEndpoint !== undefined) {
191
+ log.info(`HTTPS auto auth url (sensitive): ${(0, auth_1.formatAutoAuthUrl)({
192
+ scheme: 'https',
193
+ host: httpsEndpoint.host,
194
+ port: httpsEndpoint.port,
195
+ authKey: auth.key,
196
+ })}`);
197
+ }
188
198
  if (shouldOpen) {
189
199
  log.debug(`Opening browser: ${autoAuthUrl}`);
190
200
  openInBrowser(autoAuthUrl);
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Business CLI runner for dominds
4
+ *
5
+ * Usage:
6
+ * dominds [subcommand] [options]
7
+ *
8
+ * Subcommands:
9
+ * webui - Start WebUI server (default)
10
+ * tui - Start Text User Interface
11
+ * run - Run task dialog (alias for tui)
12
+ * read - Read team configuration
13
+ * man - Render toolset manual to stdout
14
+ * manual - Alias for man
15
+ * validate_team_def - Validate explicit team toolset declarations
16
+ * cert - Create and inspect local HTTPS certificates
17
+ * create - Create a new runtime workspace (rtws) from a template
18
+ * install - Install a Dominds App into this rtws
19
+ * doctor - Diagnose Dominds App state in this rtws
20
+ * enable - Enable an installed Dominds App in this rtws
21
+ * disable - Disable an installed Dominds App in this rtws
22
+ * uninstall- Uninstall a Dominds App from this rtws
23
+ * update - Update installed Dominds App(s)
24
+ * new - Alias for create
25
+ * help - Show help
26
+ *
27
+ * This file is launched by the top-level dominds supervisor.
28
+ */
29
+ import './tools/builtins';
30
+ export declare function configureEnvProxySupport(): void;
31
+ export declare function main(argv?: readonly string[]): Promise<void>;