@qilin-agent/cli 3.1.3 → 3.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.i18n.yaml +14 -14
- package/README.md +12 -3
- package/README.zh.md +12 -3
- package/lib/bin.js +101 -7
- package/lib/tenant-runtime-ChD53FKq.js +489 -0
- package/lib/tenants-roster-Bhr9x2Jw.js +252 -0
- package/lib/types/args.d.ts +10 -1
- package/lib/types/scheduler-yield.d.ts +19 -0
- package/lib/types/tenant-proxy.d.ts +101 -0
- package/lib/types/tenant-runtime.d.ts +338 -0
- package/lib/types/tenants-roster.d.ts +138 -0
- package/lib/types/tenants.d.ts +175 -0
- package/lib/types/usage-ledger.d.ts +143 -0
- package/lib/types/web-entry.d.ts +97 -0
- package/lib/web-entry-C--0C6wG.js +1500 -0
- package/package.json +127 -119
package/README.i18n.yaml
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
3
|
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write apps/cli/README.md
|
|
5
|
-
/qilin-cli:
|
|
6
|
-
en:
|
|
7
|
-
zh:
|
|
8
|
-
/qilin-cli/entry-modes:
|
|
9
|
-
en:
|
|
10
|
-
zh:
|
|
11
|
-
/qilin-cli/app-arguments:
|
|
5
|
+
/qilin-agent-cli:
|
|
6
|
+
en: 063f13813a8fa190
|
|
7
|
+
zh: 682d157e19163ff0
|
|
8
|
+
/qilin-agent-cli/entry-modes:
|
|
9
|
+
en: cebfeaa9a9e60c00
|
|
10
|
+
zh: 652208729fa392df
|
|
11
|
+
/qilin-agent-cli/app-arguments:
|
|
12
12
|
en: 979c1c9bedaf1b3e
|
|
13
13
|
zh: a77b6d9db2cfc191
|
|
14
|
-
/qilin-cli/profiles:
|
|
15
|
-
en:
|
|
16
|
-
zh:
|
|
17
|
-
/qilin-cli/optional-overlays:
|
|
14
|
+
/qilin-agent-cli/profiles:
|
|
15
|
+
en: 7d717e3a016726f8
|
|
16
|
+
zh: 9ffeeb5933153c80
|
|
17
|
+
/qilin-agent-cli/optional-overlays:
|
|
18
18
|
en: 55972a91e0d1d24d
|
|
19
19
|
zh: 920ae26285d8e1b6
|
|
20
|
-
/qilin-cli/development:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
20
|
+
/qilin-agent-cli/development:
|
|
21
|
+
en: fa8d7705c54df6f5
|
|
22
|
+
zh: 8fe3f713cfe31dbf
|
package/README.md
CHANGED
|
@@ -14,11 +14,19 @@ The `qilin` command is the sole supported Node application launcher: profiles ar
|
|
|
14
14
|
| `qilin --profile headless "job"` | Run one fresh persisted session, print the final answer, and exit. |
|
|
15
15
|
| `qilin --profile sdk` | Serve SDK clients over JSON-RPC stdio until shutdown or disconnect. |
|
|
16
16
|
| `qilin --profile sdk-minimal` | Serve SDK clients with the standalone minimal agent tree. |
|
|
17
|
-
| `qilin web` |
|
|
17
|
+
| `qilin`, `qilin web` | Serve the deployment at one address: one isolated Web runtime per account, each serving the application's own landing page and sign-in form. The profile you already start is the deployment. |
|
|
18
|
+
| `qilin tenants accounts` | List this Harness home's accounts and the tenant directory each owns. |
|
|
19
|
+
| `qilin tenants add <username>` | Create an account, prompting for its password or reading `--password-stdin`. |
|
|
20
|
+
| `qilin tenants passwd <username>` | Replace an account's password and retire the sessions it issued. |
|
|
21
|
+
| `qilin tenants remove <username>` | Retire an account, keeping its tenant directory unless `--purge-data` is given. |
|
|
18
22
|
| `qilin plugin --profile <name> <pnpm args>` | Manage a profile's plugins by forwarding to pnpm in the profile directory. |
|
|
19
23
|
| `qilin plugin list` | List a profile's bundle layers in activation order; omit `--profile` for the product profile. |
|
|
20
24
|
| `qilin plugin doctor <package\|directory>` | Report one plugin package's DSH-era compatibility without installing or running anything. |
|
|
21
25
|
|
|
26
|
+
The browser-serving profiles — the product surface `qilin` and `qilin web` — are the deployment: one command, one address, with no second entry. The entry draws no interface of its own: it starts one Web runtime per account on demand under `$QILIN_HOME/tenants/<account id>/`, and forwards every request the browser makes — the application document, the `/api` channel, the mux upgrade, and ranged media reads — to the runtime its routing cookie names, with the runtime's own authority in place of the entry's so its session cookie stays bound to the runtime that minted it. A runtime's harness home is its own: sessions, tasks, workspaces, attachments, plugins, model settings, credentials, skills, and presets resolve there, and only the roster at `$QILIN_HOME/auth/accounts.json` is shared. Credentials are verified by the named account's own runtime: the entry forwards the sign-in submission there and relays the session cookie it issues, and the runtime admits only its own account, so a forged routing cookie reaches a runtime that does not recognize the caller. `--idle-ms` reclaims a runtime that has served no traffic for that long, and `0` disables reclamation; `--max-tenants` bounds how many runtimes live at once, reclaiming the least recently used one past that bound; `--restart-backoff-ms` sets the first wait before a runtime that failed to start is retried, doubling per consecutive failure. `--patch` composes every runtime with an extra overlay layer; `--tls-cert` and `--tls-key` serve the entry's address over HTTPS and terminate TLS in front of the loopback runtimes, so the pair is supplied together and is refused with `--per-account-ports`. The entry reads only the flags it owns: every other argument reaches each runtime's own command line, and `--host` refuses a wildcard address. One browser drives one account at a time. The application inside a runtime owns the landing page, the sign-in form, and registration. With accounts in the roster the bare address redirects to the first account's path, `/t/<account>/`, and every other account is reachable at its own. With no accounts yet, every path goes to a first-run runtime, whose layer admits whoever the roster holds, so the product's own form creates the first account and the deployment never describes what to type. `--registration open|closed` decides whether the product's form may create accounts: the default is `open` on a loopback address and `closed` on every other, so an address other machines reach creates an account only where the operator says so, with `qilin tenants add`; a name the roster does not hold, a routing cookie naming an account it no longer holds, and every other request that names no account are answered by that same runtime, so the deployment never speaks for the application. `/healthz` and `/status` stay the entry's own reads.
|
|
27
|
+
|
|
28
|
+
The roster subcommands maintain the accounts that shared file holds. A tenant runtime admits exactly the account it serves and closes registration, so its own Web surface cannot create a second account; the first-run runtime carries the deployment's policy instead, which is where a deployment that accepts accounts grows through the product's own form. `add` creates an account without a browser, `passwd` re-keys one and retires its issued sessions, and `remove` retires one while keeping its Sessions on disk unless `--purge-data` is given. A runtime started for a removed account fails loud, because its overlay admits an account the file no longer holds.
|
|
29
|
+
|
|
22
30
|
The invoking directory is the default workspace root. The `web`, `headless`, `sdk`, `sdk-minimal`, and `acp` profiles auto-initialize on first use from shipped templates. Create another profile at an unused, non-shipped name with `--from-default-profile`, or initialize a base-backed profile through `qilin plugin`. The `desktop` name is reserved for the Electron-owned profile, so the CLI rejects boot, config-dump, and plugin-management requests for it. After a successful package operation the command reconciles the profile's bundle list, and it refuses a profile whose installed dependencies include an upstream DSH-era engine package: the diagnostic names each colliding package, the QiLin package it maps onto, and the `remove` command that clears it, and the command exits 1 without changing the bundle list.
|
|
23
31
|
|
|
24
32
|
`list` and `doctor` read the profile and never initialize it or run pnpm. `doctor` accepts an installed package name or a package directory and checks the four rules a plugin must satisfy to load here: whether the package builds the DSH-era home itself instead of reading `DSH_HOME`/`QILIN_HOME`, installs an engine package the harness supplies, imports an engine name it never declared as a peer, and injects client module names the compatibility layer cannot map. It prints one finding per line and exits 1 only when a finding blocks activation.
|
|
@@ -32,10 +40,11 @@ Install the command itself from the published package (`npm install -g @qilin-ag
|
|
|
32
40
|
The launcher parses only its own flags and hands everything after them to the booted profile, where any injected app plugin may parse the shared immutable snapshot ([`qilin-cmdline`](../../packages/boot/cmdline/README.md)). The first token the launcher does not recognize starts the app's arguments:
|
|
33
41
|
|
|
34
42
|
```sh
|
|
35
|
-
qilin --profile web --port 8080 # --port
|
|
43
|
+
qilin --profile web --port 8080 # --port is the deployment's address
|
|
36
44
|
qilin --profile tui --resume <id> # example, assuming the tui profile is installed; --resume belongs to the terminal app
|
|
37
45
|
qilin --profile headless "run the tests"
|
|
38
|
-
qilin --profile web --
|
|
46
|
+
qilin --profile web --patch ./extra.cordis.yml # the overlay every account's runtime composes with
|
|
47
|
+
qilin --profile web --help # the deployment's flags, then the app's
|
|
39
48
|
qilin --help # the launcher's own help
|
|
40
49
|
```
|
|
41
50
|
|
package/README.zh.md
CHANGED
|
@@ -14,11 +14,19 @@
|
|
|
14
14
|
| `qilin --profile headless "job"` | 运行一个全新的持久化会话,打印最终答案并退出。 |
|
|
15
15
|
| `qilin --profile sdk` | 通过 JSON-RPC stdio 为 SDK 客户端提供服务,直至关闭或断开连接。 |
|
|
16
16
|
| `qilin --profile sdk-minimal` | 以独立极简 agent(智能体)配置树为 SDK 客户端提供服务。 |
|
|
17
|
-
| `qilin web` |
|
|
17
|
+
| `qilin`、`qilin web` | 在一个地址上服务整套部署:每个账户一个隔离的 Web 运行时,各自服务应用自己的落地页与登录表单。你原本就在启动的那个 profile 就是整套部署。 |
|
|
18
|
+
| `qilin tenants accounts` | 列出本 harness home 的账户,以及每个账户拥有的租户目录。 |
|
|
19
|
+
| `qilin tenants add <用户名>` | 创建一个账户,交互式输入密码,或读取 `--password-stdin`。 |
|
|
20
|
+
| `qilin tenants passwd <用户名>` | 替换某个账户的密码,并使其已签发的会话失效。 |
|
|
21
|
+
| `qilin tenants remove <用户名>` | 注销某个账户,默认保留其租户目录,除非给出 `--purge-data`。 |
|
|
18
22
|
| `qilin plugin --profile <name> <pnpm args>` | 通过在 profile 目录中转发给 pnpm 来管理该 profile 的插件。 |
|
|
19
23
|
| `qilin plugin list` | 按激活顺序列出某个 profile 的 bundle 层;省略 `--profile` 时使用产品 profile。 |
|
|
20
24
|
| `qilin plugin doctor <包名\|目录>` | 报告某个插件包的 DSH 时代兼容性,不安装也不运行任何东西。 |
|
|
21
25
|
|
|
26
|
+
会服务浏览器的 profile——产品面 `qilin` 与 `qilin web`——就是整套部署:一条命令,一个地址,没有第二个入口。入口自己不作画:它按需在 `$QILIN_HOME/tenants/<账户 id>/` 下为每个账户启动一个 Web 运行时,并把浏览器发出的每个请求——应用文档、`/api` 通道、mux 升级与带 Range 的媒体读取——转发到它的路由 cookie 所命中的那个运行时,同时把运行时自己的 authority 顶替掉入口的,从而让它的会话 cookie 始终绑定在签发它的那个运行时上。运行时的 harness home 归它自己:会话、任务、工作区、附件、插件、模型设置、凭据、技能与预设都在其中解析,只有 `$QILIN_HOME/auth/accounts.json` 这份名册是共享的。凭据由被指名账户自己的运行时校验:入口把登录提交转发到那里,并中继它签发的会话 cookie;运行时只接纳自己的账户,因此伪造的路由 cookie 只会到达一个不认可调用者的运行时。`--idle-ms` 会回收在该时长内没有服务过任何流量的运行时,`0` 表示不回收;`--max-tenants` 限定同时存活多少个运行时,超出上限时回收最久未使用的那个;`--restart-backoff-ms` 设定启动失败的运行时第一次重试前的等待,每次连续失败翻倍。`--patch` 让每个运行时都多叠一层 overlay;`--tls-cert` 与 `--tls-key` 让入口地址以 HTTPS 服务,并在 loopback 运行时之前终止 TLS,因此两者必须成对给出,且与 `--per-account-ports` 互斥。入口只读自己拥有的 flag:其余参数一律交给每个运行时自己的命令行,而 `--host` 拒绝通配地址。同一个浏览器一次只服务一个账户。落地页、登录表单与注册都归运行时内部的应用所有。名册里有账户时,裸地址会重定向到第一个账户的路径 `/t/<账户>/`,其余账户各自在自己的路径上可达。名册为空时,每个路径都交给首启运行时,它那一层的接纳判据就是名册里有什么就接纳什么,于是由产品自己的表单创建第一个账户,入口从不说明该输入什么。`--registration open|closed` 决定产品自己的表单能否创建账户:loopback 地址上默认为 `open`,其他地址上默认为 `closed`,因此别的机器能到达的地址只在运维明说时才创建账户(用 `qilin tenants add`);名册里没有的名字、指向一个名册已不再持有的账户的路由 cookie,以及其余任何没有指名账户的请求,都由同一个运行时回答,因此入口从不替应用说话。`/healthz` 与 `/status` 仍归入口自己读取。
|
|
27
|
+
|
|
28
|
+
roster 子命令维护该共享文件中的账户。租户运行时只接纳自己服务的那个账户且关闭注册,因此它自己的 Web 界面无法创建第二个账户;首启运行时承载的则是部署自己的策略,接受新账户的部署由此通过产品自己的表单扩充账户。`add` 无需浏览器即可创建账户,`passwd` 为一个账户重新设置密码并使其已签发的会话失效,`remove` 注销一个账户,默认把它的 Session 留在磁盘上,除非给出 `--purge-data`。为已注销账户启动的运行时会明确失败,因为它的覆盖层接纳的是一个文件里已不存在的账户。
|
|
29
|
+
|
|
22
30
|
运行命令时所在的目录将作为默认 workspace 根目录。`web`、`headless`、`sdk`、`sdk-minimal` 和 `acp` profile 在首次使用时会从随附模板自动初始化。使用 `--from-default-profile` 可以基于这些模板之一,在尚未使用的非内置名称处创建其他 profile;通过 `qilin plugin` 则可以初始化一个以 base 为基础的 profile。`desktop` 名称保留给 Electron 持有的 profile,因此 CLI(命令行界面)会拒绝针对它的启动、配置 dump 和插件管理请求。包操作成功后命令会协调 profile 的 bundle 列表;若 profile 的已安装依赖中出现上游 DSH 时代的引擎包,命令会拒绝:诊断会指明每个冲突包、它映射到的 QiLin 包,以及清除它的 `remove` 命令,命令以退出码 1 结束且不改变 bundle 列表。
|
|
23
31
|
|
|
24
32
|
`list` 与 `doctor` 只读取 profile,既不初始化它也不运行 pnpm。`doctor` 接受已安装的包名或包目录,检查插件要在此加载必须满足的四条规则:包是否自己拼出 DSH 时代的主目录而不是读取 `DSH_HOME`/`QILIN_HOME`、是否安装了 harness 已提供的引擎包、是否导入了未声明为 peer 的引擎名、以及是否注入了兼容层无法映射的客户端模块名。它每行输出一条发现,仅当某条发现会阻断激活时才以退出码 1 结束。
|
|
@@ -32,10 +40,11 @@
|
|
|
32
40
|
启动器只解析自身的 flag,并将其后的所有内容交给已启动的 profile;注入该 profile 的任意应用插件都可以解析这份共享的不可变快照([`qilin-cmdline`](../../packages/boot/cmdline/README.zh.md))。启动器无法识别的第一个 token 标志着应用参数的开始:
|
|
33
41
|
|
|
34
42
|
```sh
|
|
35
|
-
qilin --profile web --port 8080 # --port
|
|
43
|
+
qilin --profile web --port 8080 # --port is the deployment's address
|
|
36
44
|
qilin --profile tui --resume <id> # example, assuming the tui profile is installed; --resume belongs to the terminal app
|
|
37
45
|
qilin --profile headless "run the tests"
|
|
38
|
-
qilin --profile web --
|
|
46
|
+
qilin --profile web --patch ./extra.cordis.yml # the overlay every account's runtime composes with
|
|
47
|
+
qilin --profile web --help # the deployment's flags, then the app's
|
|
39
48
|
qilin --help # the launcher's own help
|
|
40
49
|
```
|
|
41
50
|
|
package/lib/bin.js
CHANGED
|
@@ -62,6 +62,12 @@ Examples:
|
|
|
62
62
|
allow one rejected plugin/runtime pair
|
|
63
63
|
qilin plugin revoke-version <pkg@ver> --qilin-version <exact>
|
|
64
64
|
withdraw one exemption
|
|
65
|
+
qilin web --port 0 serve the deployment; each account gets its own runtime
|
|
66
|
+
qilin tenants accounts list this home's accounts and their tenant directories
|
|
67
|
+
qilin tenants add alice create an account, prompting for its password
|
|
68
|
+
echo "$PASSWORD" | qilin tenants passwd alice --password-stdin
|
|
69
|
+
replace a password and retire its sessions
|
|
70
|
+
qilin tenants remove alice retire an account, keeping its Sessions on disk
|
|
65
71
|
`;
|
|
66
72
|
/**
|
|
67
73
|
* Resolve a boot or dump invocation from the launcher flags and the leftover
|
|
@@ -106,7 +112,7 @@ function parseQilinArgs(argv, version) {
|
|
|
106
112
|
const first = argv[0];
|
|
107
113
|
let resolved;
|
|
108
114
|
const program = new Command();
|
|
109
|
-
program.name("qilin").version(version, "-V, --version", "output the version number").usage("[--profile] <name> [options] [app-args...]\n qilin plugin --profile <name> <pnpm-args
|
|
115
|
+
program.name("qilin").version(version, "-V, --version", "output the version number").usage("[--profile] <name> [options] [app-args...]\n qilin plugin --profile <name> <pnpm-args...>\n qilin web [options]").description("qilin: boot the QiLin product surface, or any profile — an ordered stack of plugin-bundle patch layers under your own overrides.").addHelpText("after", HELP_EXAMPLES).exitOverride().helpOption(false).helpCommand(false).allowUnknownOption().passThroughOptions().enablePositionalOptions().argument("[args...]", "arguments for the booted profile's app (see: qilin --profile <name> --help)").option("--profile <name>", "the profile under $QILIN_HOME/profiles to boot", selectProfile).option("--from-default-profile <name>", "initialize a new custom profile from a shipped profile template").option("--patch <path>", "extra patch-list overlay applied after the profile layer (repeatable)", collect).option("--dump-config", "print the composed profile tree and exit").option("--dump-default-config", "print the profile tree without its user layer or --patch overlays and exit").action((args, options) => {
|
|
110
116
|
if (options.profile === void 0 && args.some((argument) => argument === "-h" || argument === "--help")) program.help();
|
|
111
117
|
const profile = options.profile ?? PRODUCT_PROFILE;
|
|
112
118
|
if (profile === "") program.error("error: --profile needs a name");
|
|
@@ -129,8 +135,52 @@ function parseQilinArgs(argv, version) {
|
|
|
129
135
|
};
|
|
130
136
|
});
|
|
131
137
|
}
|
|
138
|
+
if (first === "tenants") {
|
|
139
|
+
const tenants = program.command("tenants").description("maintain the accounts every runtime under this Harness home shares; qilin web serves the deployment, one isolated runtime per account");
|
|
140
|
+
tenants.action(() => {
|
|
141
|
+
program.error("error: tenants needs a subcommand (accounts, add, passwd, remove)");
|
|
142
|
+
});
|
|
143
|
+
tenants.command("accounts").description("list the accounts of this Harness home and the tenant directory each owns").action(() => {
|
|
144
|
+
resolved = {
|
|
145
|
+
mode: "tenants",
|
|
146
|
+
request: { command: "accounts" }
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
tenants.command("add").description("create one account in this Harness home").argument("<username>", "login name: 3-32 characters of a-z, 0-9, _, ., or -, starting with a letter or digit").option("--email <address>", "address stored with the account").option("--admin", "make this the deployment's administrator: the one account that reads every account's usage ledger").option("--password-stdin", "read the password from standard input instead of prompting").action((username, options) => {
|
|
150
|
+
resolved = {
|
|
151
|
+
mode: "tenants",
|
|
152
|
+
request: {
|
|
153
|
+
command: "add",
|
|
154
|
+
username,
|
|
155
|
+
email: options.email,
|
|
156
|
+
admin: options.admin === true,
|
|
157
|
+
password: options.passwordStdin === true ? { kind: "stdin" } : { kind: "prompt" }
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
tenants.command("passwd").description("replace one account's password, retiring the sessions it issued").argument("<username>", "login name of the account to re-key").option("--password-stdin", "read the password from standard input instead of prompting").action((username, options) => {
|
|
162
|
+
resolved = {
|
|
163
|
+
mode: "tenants",
|
|
164
|
+
request: {
|
|
165
|
+
command: "passwd",
|
|
166
|
+
username,
|
|
167
|
+
password: options.passwordStdin === true ? { kind: "stdin" } : { kind: "prompt" }
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
tenants.command("remove").description("retire one account from this Harness home").argument("<username>", "login name of the account to retire").option("--purge-data", "also remove the account's tenant directory, Sessions included").action((username, options) => {
|
|
172
|
+
resolved = {
|
|
173
|
+
mode: "tenants",
|
|
174
|
+
request: {
|
|
175
|
+
command: "remove",
|
|
176
|
+
username,
|
|
177
|
+
purgeData: options.purgeData === true
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
}
|
|
132
182
|
try {
|
|
133
|
-
const expanded = first !== void 0 && !first.startsWith("-") && first !== "plugin" ? ["--profile", ...argv] : argv;
|
|
183
|
+
const expanded = first !== void 0 && !first.startsWith("-") && first !== "plugin" && first !== "tenants" ? ["--profile", ...argv] : argv;
|
|
134
184
|
program.parse(expanded, { from: "user" });
|
|
135
185
|
} catch (error) {
|
|
136
186
|
return process.exit(error instanceof CommanderError ? error.exitCode : 1);
|
|
@@ -140,6 +190,34 @@ function parseQilinArgs(argv, version) {
|
|
|
140
190
|
return resolved;
|
|
141
191
|
}
|
|
142
192
|
//#endregion
|
|
193
|
+
//#region lib/types/scheduler-yield.js
|
|
194
|
+
/**
|
|
195
|
+
* Host fallback for the Web Scheduler API global.
|
|
196
|
+
* @module @qilin-agent/cli/scheduler-yield
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* Install `globalThis.scheduler.yield` unless the host already defines a
|
|
200
|
+
* `scheduler`.
|
|
201
|
+
*
|
|
202
|
+
* The fallback resolves on the next `setImmediate` — the API's "yield to the
|
|
203
|
+
* event loop once, then continue" semantic — and a host-provided `scheduler`
|
|
204
|
+
* is left untouched. Call it before importing anything that may read the
|
|
205
|
+
* global; `bin.ts` calls it at the top of the entry, ahead of every mode
|
|
206
|
+
* module. Rationale: [the host-shim Agent
|
|
207
|
+
* Note](../../../.agents/notes/implemented/architecture/2026-10-07-web-scheduler-yield-host-shim.md).
|
|
208
|
+
*
|
|
209
|
+
* @returns whether this call installed the fallback.
|
|
210
|
+
*/
|
|
211
|
+
function installSchedulerYield() {
|
|
212
|
+
if (globalThis.scheduler !== void 0) return false;
|
|
213
|
+
Object.defineProperty(globalThis, "scheduler", {
|
|
214
|
+
value: { yield: () => new Promise((resolve) => setImmediate(resolve)) },
|
|
215
|
+
writable: true,
|
|
216
|
+
configurable: true
|
|
217
|
+
});
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
143
221
|
//#region lib/types/startup-diagnostics.js
|
|
144
222
|
/** Save original startup diagnostics while keeping the terminal report concise. */
|
|
145
223
|
/** Wait for stderr to finish the write before the failed process exits. */
|
|
@@ -203,11 +281,7 @@ async function reportStartupFailure(error, context, write = writeStderr) {
|
|
|
203
281
|
* @module @qilin-agent/cli/bin
|
|
204
282
|
*/
|
|
205
283
|
/* v8 ignore file -- built-bin acceptance exercises this self-executing dispatch. */
|
|
206
|
-
|
|
207
|
-
value: { yield: () => new Promise((resolve) => setImmediate(resolve)) },
|
|
208
|
-
writable: true,
|
|
209
|
-
configurable: true
|
|
210
|
-
});
|
|
284
|
+
installSchedulerYield();
|
|
211
285
|
/**
|
|
212
286
|
* Run the public qilin command-line interface.
|
|
213
287
|
* @returns a promise that settles when the selected command mode finishes.
|
|
@@ -217,6 +291,21 @@ async function runCli() {
|
|
|
217
291
|
const invocation = parseQilinArgs(process.argv.slice(2), version);
|
|
218
292
|
switch (invocation.mode) {
|
|
219
293
|
case "profile": {
|
|
294
|
+
const { ENTRY_PROFILES, isWebEntry, runWebEntry } = await import("./web-entry-C--0C6wG.js");
|
|
295
|
+
if (ENTRY_PROFILES.includes(invocation.profile) && isWebEntry()) {
|
|
296
|
+
try {
|
|
297
|
+
process.exitCode = await runWebEntry({
|
|
298
|
+
args: invocation.args,
|
|
299
|
+
profile: invocation.profile,
|
|
300
|
+
patches: invocation.patches,
|
|
301
|
+
fromDefaultProfile: invocation.fromDefaultProfile
|
|
302
|
+
});
|
|
303
|
+
} catch (error) {
|
|
304
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
305
|
+
process.exit(1);
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
220
309
|
const { runProfile } = await import("./profile-boot.js");
|
|
221
310
|
try {
|
|
222
311
|
await runProfile({
|
|
@@ -242,6 +331,11 @@ async function runCli() {
|
|
|
242
331
|
process.exit(await runPlugin(invocation.profile, invocation.args));
|
|
243
332
|
break;
|
|
244
333
|
}
|
|
334
|
+
case "tenants": {
|
|
335
|
+
const { runTenantsRoster } = await import("./tenants-roster-Bhr9x2Jw.js");
|
|
336
|
+
process.exitCode = await runTenantsRoster(invocation.request);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
245
339
|
case "dump-config": {
|
|
246
340
|
const { runDumpConfig } = await import("./dump-config-_HRfhhWz.js");
|
|
247
341
|
runDumpConfig(invocation.profile, invocation.defaultOnly, invocation.patches, invocation.fromDefaultProfile);
|