Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(browser): 收敛凭据入口与文件检查并限制下载模式

Dasha60d5fad79d1
diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-backend.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-backend.test.ts
index eff42bfd2e..8ffed217bb 100644
--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-backend.test.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-backend.test.ts
@@ -7,7 +7,7 @@
// - advanced unsupported actions yield a structured error (no throw)
import fs from 'node:fs/promises';
-import { writeFileSync } from 'node:fs';
+import { writeFileSync, realpathSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -1451,7 +1451,7 @@ describe('RsbWebviewBackend — uploads and page dialogs', () => {
expect(res.ok).toBe(true);
expect(res.data).toMatchObject({ tabId: 't1', uploadedFiles: 1 });
expect(env.sendCommand).toHaveBeenCalledWith('DOM.setFileInputFiles', {
- files: [await fs.realpath(file)],
+ files: [realpathSync(file)],
objectId: 'file-input',
});
await env.backend.dispose();
diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
index 6a62b5dec7..82357c419c 100644
--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/rsb-webview-upload-policy.test.ts
@@ -1,4 +1,5 @@
import fs from 'node:fs/promises';
+import { realpathSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -32,7 +33,7 @@ describe('resolveUploadFiles', () => {
await withRecipeHost(undefined, async () => {
file = recipeDiagnosticPath('upload-copy.png');
await fs.writeFile(file, 'test-only-image');
- await expect(resolveUploadFiles([file], [allowedRoot])).resolves.toEqual([await fs.realpath(file)]);
+ await expect(resolveUploadFiles([file], [allowedRoot])).resolves.toEqual([realpathSync(file)]);
await expect(resolveUploadFiles([file], [outsideRoot])).rejects.toThrow('inside the current session directory');
}, { read: () => Buffer.alloc(0), open: () => -1, temporaryRoot: allowedRoot });
await expect(fs.access(path.dirname(file))).rejects.toThrow();
@@ -43,7 +44,7 @@ describe('resolveUploadFiles', () => {
// Real host resolver, unit tier; smallest failure is one outside output path.
it('resolves missing task outputs and rejects outside, sensitive and remote-only paths', async () => {
expect(resolveRecipeOutputPath(path.join('new', 'report.txt'), [allowedRoot]))
- .toBe(path.join(await fs.realpath(allowedRoot), 'new', 'report.txt'));
+ .toBe(path.join(realpathSync(allowedRoot), 'new', 'report.txt'));
for (const candidate of [path.join(outsideRoot, 'new', 'report.txt'), path.join(allowedRoot, '.git', 'config'), path.join(allowedRoot, '.env')]) {
expect(() => resolveRecipeOutputPath(candidate, [allowedRoot])).toThrow();
}
@@ -62,7 +63,7 @@ describe('resolveUploadFiles', () => {
await fs.writeFile(file, 'hello');
await expect(resolveUploadFiles([file], [allowedRoot])).resolves.toEqual([
- await fs.realpath(file),
+ realpathSync(file),
]);
});
diff --git a/packages/lizi-mcps/src/browser/opencli-recipes.test.ts b/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
index 040d3890e7..77dc0af97b 100644
--- a/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
+++ b/packages/lizi-mcps/src/browser/opencli-recipes.test.ts
@@ -9,7 +9,7 @@ import { runRecipe } from "./recipe-runner.js";
import { executeAdapter, type IPage } from '@jackwener/opencli/cindy';
import { saveBase64ToFile } from '@jackwener/opencli/utils';
import { withRecipeHost, recipeDiagnosticPath, recipeOutputPath, readRecipeFileSync } from '@jackwener/opencli/cindy/host';
-import { mkdtemp, writeFile, rm, readFile, realpath, access } from 'node:fs/promises';
+import { mkdtemp, mkdir, writeFile, rm, readFile, realpath, access } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
// @ts-expect-error Pinned upstream adapter helpers ship JavaScript without declarations.
@@ -17,6 +17,13 @@ import * as gemini from '../../../opencli-vendor/clis/gemini/utils.js';
// @ts-expect-error Pinned upstream adapter helpers ship JavaScript without declarations.
import * as qwen from '../../../opencli-vendor/clis/qwen/utils.js';
import * as network from '../../../opencli-vendor/src/node-network.js';
+// @ts-expect-error Pinned upstream JavaScript helpers have no declarations.
+import { readUtf8File } from '../../../opencli-vendor/clis/_atlassian/shared.js';
+// @ts-expect-error Pinned upstream JavaScript helpers have no declarations.
+import { resolvePayload } from '../../../opencli-vendor/clis/zhihu/write-shared.js';
+// @ts-expect-error Pinned upstream JavaScript helpers have no declarations.
+import { prepareChatGPTFilePaths } from '../../../opencli-vendor/clis/chatgpt/utils.js';
+import { readFileSync, openSync } from 'node:fs';
afterEach(() => {
vi.useRealTimers();
@@ -25,6 +32,46 @@ afterEach(() => {
});
describe("bundled OpenCLI recipes", () => {
+ // #6826 file-check regression, unit tier. Actual text readers and host IO;
+ // older write tests did not inspect relative files before reading them.
+ // Two interleaved tasks with the same filename must retain separate content.
+ it.each([readUtf8File, (file: string) => resolvePayload({ file }), async (file: string) => {
+ const result = await prepareChatGPTFilePaths([file]);
+ if (!result.ok) throw new Error(result.reason);
+ return readRecipeFileSync(result.paths[0], 'utf8');
+ }])('keeps text inspection and reading in each invoking task', async (readText) => {
+ const root = await mkdtemp(path.join(tmpdir(), 'cindy-recipe-text-test-'));
+ const dirs = [path.join(root, 'a'), path.join(root, 'b')];
+ try {
+ for (const [i, dir] of dirs.entries()) {
+ await mkdir(dir);
+ await writeFile(path.join(dir, 'page.md'), `task-${i}`);
+ }
+ const values = await Promise.all(dirs.map((directory) => withRecipeHost(undefined, async () => {
+ await Promise.resolve();
+ return readText('page.md');
+ }, { directory, read: file => readFileSync(file), open: file => openSync(file, 'r') })));
+ expect(values).toEqual(['task-0', 'task-1']);
+ const read = vi.fn();
+ await expect(withRecipeHost(undefined, () => readText('page.md'), {
+ directory: dirs[0], read, open: () => { throw new Error('denied by host'); },
+ })).rejects.toThrow();
+ expect(read).not.toHaveBeenCalled();
+ await expect(withRecipeHost(undefined, () => readText('page.md'))).rejects.toThrow();
+ } finally { await rm(root, { recursive: true, force: true }); }
+ });
+
+ // Unsupported export modes must be input failures before any navigation or
+ // click; they used to perform page actions and then fail on waitForDownload.
+ it.each(['video-social', 'gif'])('rejects unsupported export %s before browser execution', async (kind) => {
+ const call = vi.fn();
+ const result = await runRecipe(loadRecipes().get('opencli:midjourney/download')!, {
+ job: '11111111-1111-1111-1111-111111111111', kind,
+ }, { call });
+ expect(result).toMatchObject({ ok: false, failureKind: 'input' });
+ expect(call).not.toHaveBeenCalled();
+ });
+
// #6826: argument defaults bypassed the task-relative resolver. Unit tier,
// real adapter -> shared writer with fake generation/network; previous novel
// coverage did not pass image/download argument defaults through prepareInputs.
@@ -438,13 +485,16 @@ describe("bundled OpenCLI recipes", () => {
const all = await query();
expect(all.ok).toBe(true);
expect(all.recipeCount).toBe(loadRecipes().size);
- for (const id of ['opencli:zlibrary/search', 'opencli:slock/task-create', 'opencli:claude/login', 'opencli:claude/ask', 'opencli:spotify/auth', 'opencli:spotify/status', 'books-list', 'hockey-search']) {
+ for (const id of ['opencli:zlibrary/search', 'opencli:slock/task-create', 'opencli:claude/login', 'opencli:claude/ask', 'opencli:spotify/auth', 'opencli:spotify/status', 'opencli:ones/login', 'opencli:ones/token-info', 'books-list', 'hockey-search']) {
expect(JSON.stringify(all)).not.toContain(id);
const response = await client.callTool({ name: 'call_tool', arguments: { name: 'browser', args: { action: 'recipe', recipeId: id } } });
expect(JSON.parse((response.content as Array<{ text: string }>)[0].text).ok).toBe(false);
}
expect(JSON.stringify(all)).toContain('open-library-search');
expect(JSON.stringify(all)).toContain('steam-reviews');
+ const midjourney = await query('midjourney');
+ expect(midjourney.recipes.find((recipe: { id: string }) => recipe.id === 'opencli:midjourney/download').parameters.kind.choices)
+ .toEqual(['auto', 'image', 'video-raw']);
// The public guide must describe the same task-relative defaults used by
// execution; otherwise callers can reintroduce an out-of-task path.
for (const [site, command, arg, expected] of [
diff --git a/packages/opencli-vendor/README.md b/packages/opencli-vendor/README.md
index e2bc798aa4..3d8d52d661 100644
--- a/packages/opencli-vendor/README.md
+++ b/packages/opencli-vendor/README.md
@@ -10,15 +10,15 @@
- 170 个站点/应用,1,223 条命令(916 read、307 write)。
- 1,112 个命令模块,所有生产共享代码、JSON 和其他资源一并引入;不引入上游测试。
-- 上游快照完整保留,但默认目录独立选择:排除 Z-Library 2 条、Slock 44 条、Claude.ai 9 条和 Spotify 11 条,
- 剩余 1,157 条命令、25 个上游别名。原因记录在 [selection.json](cindy/selection.json),
+- 上游快照完整保留,但默认目录独立选择:排除 Z-Library 2 条、Slock 44 条、Claude.ai 9 条、Spotify 11 条和 ONES 8 条,
+ 剩余 1,149 条命令、25 个上游别名。原因记录在 [selection.json](cindy/selection.json),
同步会沿用此选择,排除条目不进入模块导入表和可执行目录。
- Cindy 原有 56 个 ID:47 个转到新版适配器,7 个保留原流程,两个爬虫练习站移至
`packages/lizi-mcps/src/browser/recipe-examples`,不再出现在默认列表。
逐项记录见 [legacy-coverage.json](cindy/legacy-coverage.json)。
- Cindy 独立增加 App Store 搜索、Google Play 搜索、TapTap 中国站游戏详情、Steam 玩家评价、
Open Library 书目查询和 Crossref 文献/DOI 查询,共 6 个配方,位于
- `packages/lizi-mcps/src/browser/cindy-recipes`。共 1,242 个可发现 ID、172 份指南;这个数包含别名和兼容入口。
+ `packages/lizi-mcps/src/browser/cindy-recipes`。共 1,234 个可发现 ID、171 份指南;这个数包含别名和兼容入口。
- 兼容入口保持输入名,输出改为新版结构化结果;用户本地覆盖层仍优先于内置层。
通过 `browser(action="siteguide")` 查询精简完整目录;传 `site`(域名或上游站点名)
@@ -39,11 +39,14 @@
- Spotify 暂不进入默认目录:客户端密钥的明文文件配置尚未接入宿主加密凭据库;
保留完整来源,不增加新的凭据配置流程。小宇宙的新令牌只写宿主加密凭据库,
既有配置只在显式执行时读取,不删除旧配置或新增明文令牌文件。
+- ONES 暂不进入默认目录:密码参数和令牌打印不符合宿主代输入及凭据边界。
+ 登录继续使用已有的通用代输入流程,不新增站点专用配置。
- 文章 stdout 输出改为 MCP 返回值;
Readability 脚本随构建打包,避免安装包运行时查找源码文件。
- 主进程使用静态入口加载所选命令及其执行依赖,不在运行期动态导入模块;导入不执行命令。
- 适配器直接读取文件和分片上传也须通过宿主文件代理,复用原有上传目录、敏感文件和
- realpath 校验;无会话目录或宿主文件代理时拒绝读取。ChatGPT 后端请求只发送自身域的 Cookie。
+ realpath 校验;文件检查复用同一代理的描述符,命名导入与别名导入均按任务解析。
+ 无会话目录或宿主文件代理时拒绝读取。ChatGPT 后端请求只发送自身域的 Cookie。
- 图片、音频和下载成果的默认路径与目录参数元数据均使用任务内相对路径;
诊断截图及跟踪文件按调用隔离,结束后清理,兼容 Windows。
- 与配方按使用维护共用暂停状态:适配器参数预检失败不会暂停配方,执行失败才暂停;
@@ -63,8 +66,8 @@
包含可达依赖,但不是完整安装包增量,也不包括 Cindy 的 JSON 配方。
站点登录、API 凭据、本机应用和下载工具等条件仍由各适配器要求;需要浏览器桥接特有的
-可选能力(例如 Midjourney 社交视频/GIF 的浏览器下载完成事件)仍受 Cindy 后端能力限制,
-会明确报错。普通文件/API 下载不依赖该可选能力。不要为测试写命令对真实账号执行发布、
+可选能力仍受 Cindy 后端能力限制。Midjourney 默认目录只提供图片与原始视频下载,
+不暴露社交视频/GIF;显式调用不支持的模式在操作页面前按参数错误拒绝。普通文件/API 下载不依赖该可选能力。不要为测试写命令对真实账号执行发布、
点赞、删除或付款。
## 下次同步
diff --git a/packages/opencli-vendor/UPSTREAM.json b/packages/opencli-vendor/UPSTREAM.json
index 53e65d3181..a52426fe2b 100644
--- a/packages/opencli-vendor/UPSTREAM.json
+++ b/packages/opencli-vendor/UPSTREAM.json
@@ -219,7 +219,7 @@
}
},
"files": {
- "clis/_atlassian/shared.js": "d5edb3a2d1d5ca5b578953a87554df76ff8ba1f710638b380dcc970051ca1938",
+ "clis/_atlassian/shared.js": "5e456bf1db1b0c86982e424682d929c7b97ab0b678b914ea2ed7f131031f8e40",
"clis/_shared/common.js": "0d70b3b99d9e03aae3bf476d8f5ca21435018b62fb4936d6d40fa6febe5155f5",
"clis/_shared/google-account.js": "0a17bd23206b65378560d0514c0f5c3c27d3bad9ba58d23190d6fa7f1e59400c",
"clis/_shared/search-adapter.js": "e3d77ac024970330244d753cc526cfc24f9edb5c0947acab0b6749355fb6f381",
@@ -392,7 +392,7 @@
"clis/chatgpt/read.js": "44ed9824abd6568227ac2164b3175ec14251e3ef09c161cdaea8da89cd355d0c",
"clis/chatgpt/send.js": "535cfb3fba02ca3d00e0d5804c617ac9c67cdc2f1581abc92c27ae57bbb4d76b",
"clis/chatgpt/status.js": "c61a2407c5b4d375f2c09c51de83c7800d5a501993329c308eac209328e50e6b",
- "clis/chatgpt/utils.js": "64e667c5e7a42cc4b945ea743a09a056f9cc79db0c0b1ea0167ce0c2544c26d8",
+ "clis/chatgpt/utils.js": "dacffa8304591fcd3f3f2b6a25d300ba417dddadc84b4c9b7096f64e3b20a630",
"clis/chess/analyze.js": "6310c246f7d03e73736d5b885706a6bfe7cd057761c3a3a5d13109a9afd67ae2",
"clis/chess/game.js": "cdf30c1fef8813af0acff84c028c31225f47044db144fb71af32c47342639dab",
"clis/chess/games.js": "0d8df9fcbe4f49982bc7f1b82581b5e581ae72808de1c41a5dd85568881b6bad",
@@ -458,7 +458,7 @@
"clis/deepseek/send.js": "64fc9bd159a6e39f4e5a2b7a734ee0498b979dc652587b326d756833d7467a45",
"clis/deepseek/status.js": "d26c1b40774618d53abc85a88467a81690798af42286d806791c7902a9c892b4",
"clis/deepseek/usage.js": "da5908b8dae865fd4c7f6e6c01afeea2460c10333b126a9734f399ae19f002ba",
- "clis/deepseek/utils.js": "070b84ce87ab5ceae4b794d43b07581ca3b450354b008750987a069a0c1cb525",
+ "clis/deepseek/utils.js": "2bd17df4fe416e16563582f4d676b668f802f0453b8677f12ccd71ef3176dd32",
"clis/defillama/protocol.js": "509e04905e836cab678d51ed46e7658095fa58502cd1f80d288ad93a71729f4e",
"clis/defillama/protocols.js": "bd73c95fcf37760ec4a78d7c98bdc4ac2568e9e1e10953871d07d3626de1386f",
"clis/defillama/utils.js": "a205c83f8a76451386605908933d0e7aba7fb98818adfadc48de116dd906ff80",
@@ -883,7 +883,7 @@
"clis/midjourney/auth-utils.js": "af4fb68018bac5fd94b0108ae69aaa12b2c3a6d370b0e96636f74e961578ed8f",
"clis/midjourney/capabilities.js": "fd7413726b757b07db627be9b81ef3b29b17b2ebb822ad6475f47788901e6b8f",
"clis/midjourney/describe.js": "7c6dbd76161bc16905147f976468147b90b15cd55c6667d02d3de3bc4e6e1e56",
- "clis/midjourney/download.js": "5ddafa3585c22b6e3c39ff329a41c2963d6390900677207a8e95aea95aea680c",
+ "clis/midjourney/download.js": "3980137ccc10d0b1984288a4e6a18a25124d9a67d106e8e12f8ebc4b360d3c63",
"clis/midjourney/generate.js": "370bf20986bb40e8c80f57b7b5fda61930e1b09c38433f732b25412c826ee9fb",
"clis/midjourney/history.js": "2ed49c8ceef4f9731014246329db5c5143e362d9d8f4c87e3ea38c67f613c36b",
"clis/midjourney/login.js": "f235209ecae8eea22efe41a50fff08441a1cbe8cd2b51021d961d251f0da65eb",
@@ -1523,7 +1523,7 @@
"clis/zhihu/user-arg.js": "d701ebe20a5c7ca4c997a024e929a559415cbee269921df132aed838b0b59ad1",
"clis/zhihu/user-articles.js": "33c33df443439994d8e7ff2c10156559e6fc663323a7ef768d9fb7ae88197d73",
"clis/zhihu/user.js": "ee49fbab83d6429e24299bcfb759f56e16f952bca140d4748f7833236d5f9650",
- "clis/zhihu/write-shared.js": "a72eeef1fba24ca6cae162858da2c1a47c209441b3ad5cd9183ea355e582d906",
+ "clis/zhihu/write-shared.js": "9d075c3aff1f8c0f0921da74b025962816a694118887b9b2c50e2a3e663eba6e",
"clis/zlibrary/info.js": "b8e7af76fb4cb0e19cfd30319df74c9a147fd767ea218c4e095700339c1c7883",
"clis/zlibrary/search.js": "56627632933eb3de4c05d8766e15ad8c9e78297c6fc66bfe54c149276f39f0e9",
"clis/zlibrary/utils.js": "63dfa74f171ccd0e918b609d4d85ff9ae000dcc45d23fce8c8729e52d5d3931a",
@@ -1648,6 +1648,6 @@
"src/verify.ts": "9ad21f961c94b750dca8db63a6ffc78689dda5186f1d443ab8f912eef30b2fc9",
"src/version.ts": "7bb1ede5cfc1f796e434cacd08cb9f903022f8c9375b17237aa16ad7d825aa2b",
"LICENSE": "0210b8b66cf00358242cb921ba2be3a46dfe0190159b1b952388a3880ce1ff54",
- "cli-manifest.json": "a1824f6c01d76c231682ee1de6626d588d6b274706546743eec6bd20e73f5b87"
+ "cli-manifest.json": "29ae519d76909a34d71010afddca96892f27fe0980bfcfd112d62d567b27b5d7"
}
}
diff --git a/packages/opencli-vendor/cindy/host.ts b/packages/opencli-vendor/cindy/host.ts
index bffcbdb7d9..76466fd1ca 100644
--- a/packages/opencli-vendor/cindy/host.ts
+++ b/packages/opencli-vendor/cindy/host.ts
@@ -1,5 +1,5 @@
import { AsyncLocalStorage } from "node:async_hooks";
-import { readFileSync, mkdirSync, mkdtempSync, rmSync, openSync, closeSync } from "node:fs";
+import { readFileSync, mkdirSync, mkdtempSync, rmSync, openSync, closeSync, fstatSync } from "node:fs";
import { tmpdir } from 'node:os';
import { join, resolve, relative, isAbsolute, basename } from 'node:path';
@@ -131,6 +131,13 @@ export function openRecipeFileSync(file: string): number {
return descriptor;
}
+/** Inspection uses the same approved file descriptor boundary as reading. */
+export function statRecipeFileSync(file: string): ReturnType<typeof fstatSync> {
+ const descriptor = openRecipeFileSync(file);
+ try { return fstatSync(descriptor); }
+ finally { closeRecipeFileSync(descriptor); }
+}
+
/** Legacy OpenCLI files are read only on explicit execution, never on import.
* Refreshed tokens are written exclusively through the host's encrypted store. */
export function readSecretJSON(key: string, legacyPath: string): unknown {
diff --git a/packages/opencli-vendor/cindy/modules.js b/packages/opencli-vendor/cindy/modules.js
index 39b47fce52..03137fed23 100644
--- a/packages/opencli-vendor/cindy/modules.js
+++ b/packages/opencli-vendor/cindy/modules.js
@@ -613,14 +613,6 @@ import "../clis/nuget/search.js";
import "../clis/nvd/cve.js";
import "../clis/oeis/search.js";
import "../clis/oeis/sequence.js";
-import "../clis/ones/login.js";
-import "../clis/ones/logout.js";
-import "../clis/ones/me.js";
-import "../clis/ones/my-tasks.js";
-import "../clis/ones/task.js";
-import "../clis/ones/tasks.js";
-import "../clis/ones/token-info.js";
-import "../clis/ones/worklog.js";
import "../clis/openalex/search.js";
import "../clis/openalex/work.js";
import "../clis/openfda/drug-label.js";
@@ -1672,14 +1664,6 @@ export const modules = {
"nvd/cve.js": true,
"oeis/search.js": true,
"oeis/sequence.js": true,
- "ones/login.js": true,
- "ones/logout.js": true,
- "ones/me.js": true,
- "ones/my-tasks.js": true,
- "ones/task.js": true,
- "ones/tasks.js": true,
- "ones/token-info.js": true,
- "ones/worklog.js": true,
"openalex/search.js": true,
"openalex/work.js": true,
"openfda/drug-label.js": true,
diff --git a/packages/opencli-vendor/cindy/patches.json b/packages/opencli-vendor/cindy/patches.json
index 2f83a88bb5..8b39935bce 100644
--- a/packages/opencli-vendor/cindy/patches.json
+++ b/packages/opencli-vendor/cindy/patches.json
@@ -2541,5 +2541,167 @@
"before": "default: ~/Music/suno",
"after": "default: ./suno-audio",
"count": 2
+ },
+ {
+ "file": "clis/_atlassian/shared.js",
+ "before": "import { readRecipeFileSync }",
+ "after": "import { readRecipeFileSync, statRecipeFileSync }",
+ "count": 1
+ },
+ {
+ "file": "clis/_atlassian/shared.js",
+ "before": "import { stat } from 'node:fs/promises';\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "clis/_atlassian/shared.js",
+ "before": "await stat(path)",
+ "after": "statRecipeFileSync(path)",
+ "count": 1
+ },
+ {
+ "file": "clis/zhihu/write-shared.js",
+ "before": "import { readRecipeFileSync }",
+ "after": "import { readRecipeFileSync, statRecipeFileSync }",
+ "count": 1
+ },
+ {
+ "file": "clis/zhihu/write-shared.js",
+ "before": "import { stat } from 'node:fs/promises';\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "clis/zhihu/write-shared.js",
+ "before": "stat: (path) => stat(path)",
+ "after": "stat: statRecipeFileSync",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": " downloadRenderedVideo,\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": "const KINDS = ['auto', 'image', 'video-raw', 'video-social', 'gif'];",
+ "after": "const KINDS = ['auto', 'image', 'video-raw'];",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": "Download original images, raw video, social MP4, or GIF with MIME and atomic-write checks",
+ "after": "Download original images or raw video with MIME and atomic-write checks",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": "{ name: 'kind', default: 'auto', help: 'auto, image, video-raw, video-social, or gif' }",
+ "after": "{ name: 'kind', default: 'auto', choices: KINDS, help: 'auto, image, or video-raw' }",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": "Video jobs support video-raw, video-social, or gif downloads",
+ "after": "Video jobs support video-raw downloads",
+ "count": 1
+ },
+ {
+ "file": "clis/midjourney/download.js",
+ "before": " } else {\n files = [];\n for (const index of indices) files.push(await downloadRenderedVideo(page, jobId, index, kind, outputDir, force));\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "cli-manifest.json",
+ "before": "Download original images, raw video, social MP4, or GIF with MIME and atomic-write checks",
+ "after": "Download original images or raw video with MIME and atomic-write checks",
+ "count": 1
+ },
+ {
+ "file": "cli-manifest.json",
+ "before": "\"help\": \"auto, image, video-raw, video-social, or gif\"",
+ "after": "\"choices\": [\"auto\", \"image\", \"video-raw\"],\n \"help\": \"auto, image, or video-raw\"",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": "import { readRecipeFileSync }",
+ "after": "import { readRecipeFileSync, statRecipeFileSync, resolveRecipePath }",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": "path.default.resolve(",
+ "after": "resolveRecipePath(",
+ "count": 2
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": "fs.default.statSync(",
+ "after": "statRecipeFileSync(",
+ "count": 3
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": "import { readRecipeFileSync }",
+ "after": "import { readRecipeFileSync, statRecipeFileSync, resolveRecipePath }",
+ "count": 1
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": "path.default.resolve(",
+ "after": "resolveRecipePath(",
+ "count": 1
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": "fs.default.statSync(",
+ "after": "statRecipeFileSync(",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": " if (!fs.default.existsSync(absPath)) {\n return { ok: false, reason: `Image not found: ${absPath}` };\n }\n const stat = statRecipeFileSync(absPath);",
+ "after": " let stat;\n try { stat = statRecipeFileSync(absPath); }\n catch { return { ok: false, reason: `Image not found: ${absPath}` }; }",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": " if (!fs.default.existsSync(absPath)) {\n return { ok: false, reason: `File not found: ${absPath}` };\n }\n const stat = statRecipeFileSync(absPath);",
+ "after": " let stat;\n try { stat = statRecipeFileSync(absPath); }\n catch { return { ok: false, reason: `File not found: ${absPath}` }; }",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": "import * as __cindy_node_fs from \"node:fs\";\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "clis/chatgpt/utils.js",
+ "before": " const fs = __cindy_node_fs;\n",
+ "after": "",
+ "count": 4
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": " if (!fs.default.existsSync(absPath)) {\n return { ok: false, reason: `File not found: ${absPath}` };\n }\n\n const stats = statRecipeFileSync(absPath);",
+ "after": " let stats;\n try { stats = statRecipeFileSync(absPath); }\n catch { return { ok: false, reason: `File not found: ${absPath}` }; }",
+ "count": 1
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": "import * as __cindy_node_fs from \"node:fs\";\n",
+ "after": "",
+ "count": 1
+ },
+ {
+ "file": "clis/deepseek/utils.js",
+ "before": " const fs = __cindy_node_fs;\n",
+ "after": "",
+ "count": 1
}
]
diff --git a/packages/opencli-vendor/cindy/selection.json b/packages/opencli-vendor/cindy/selection.json
index 1d06710ddf..c8be9738b5 100644
--- a/packages/opencli-vendor/cindy/selection.json
+++ b/packages/opencli-vendor/cindy/selection.json
@@ -3,6 +3,7 @@
"zlibrary": "Not in Cindy's default catalog: copyright enforcement history and unverified mirror ownership (reviewed 2026-10-23).",
"slock": "Deferred: app.slock.ai redirects to app.raft.build; the adapter still assumes the old origin and token storage. Revalidate before inclusion.",
"claude": "Excluded: Claude subscription login and use belong to the unmodified built-in Claude Code CLI, not a Claude.ai browser adapter (credentials-and-local-storage.md).",
- "spotify": "Deferred: client credentials still depend on a plaintext spotify.env file. Do not bundle until credential configuration uses the host encrypted store."
+ "spotify": "Deferred: client credentials still depend on a plaintext spotify.env file. Do not bundle until credential configuration uses the host encrypted store.",
+ "ones": "Deferred: the login adapter accepts account passwords as model inputs and prints reusable bearer tokens. Login must use the existing trusted input handoff instead."
}
}
diff --git a/packages/opencli-vendor/cli-manifest.json b/packages/opencli-vendor/cli-manifest.json
index 0791cde8c5..df8ef9a7f9 100644
--- a/packages/opencli-vendor/cli-manifest.json
+++ b/packages/opencli-vendor/cli-manifest.json
@@ -23588,7 +23588,7 @@
{
"site": "midjourney",
"name": "download",
- "description": "Download original images, raw video, social MP4, or GIF with MIME and atomic-write checks",
+ "description": "Download original images or raw video with MIME and atomic-write checks",
"access": "write",
"example": "opencli midjourney download <job> --kind auto --index all",
"domain": "www.midjourney.com",
@@ -23614,7 +23614,8 @@
"type": "str",
"default": "auto",
"required": false,
- "help": "auto, image, video-raw, video-social, or gif"
+ "choices": ["auto", "image", "video-raw"],
+ "help": "auto, image, or video-raw"
},
{
"name": "output",
diff --git a/packages/opencli-vendor/clis/_atlassian/shared.js b/packages/opencli-vendor/clis/_atlassian/shared.js
index 548392bd6a..c41277ad61 100644
--- a/packages/opencli-vendor/clis/_atlassian/shared.js
+++ b/packages/opencli-vendor/clis/_atlassian/shared.js
@@ -1,5 +1,4 @@
-import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
-import { stat } from 'node:fs/promises';
+import { readRecipeFileSync, statRecipeFileSync } from '@jackwener/opencli/cindy/host';
import { htmlToMarkdown as coreHtmlToMarkdown } from '@jackwener/opencli/utils';
import {
ArgumentError,
@@ -294,7 +293,7 @@ export async function readUtf8File(filePath) {
const path = requireString(filePath, '--file');
let fileStat;
try {
- fileStat = await stat(path);
+ fileStat = statRecipeFileSync(path);
} catch {
throw new ArgumentError(`File not found: ${path}`);
}
diff --git a/packages/opencli-vendor/clis/chatgpt/utils.js b/packages/opencli-vendor/clis/chatgpt/utils.js
index d974645850..1346aa0204 100644
--- a/packages/opencli-vendor/clis/chatgpt/utils.js
+++ b/packages/opencli-vendor/clis/chatgpt/utils.js
@@ -1,6 +1,5 @@
-import * as __cindy_node_fs from "node:fs";
import * as __cindy_node_path from "node:path";
-import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
+import { readRecipeFileSync, statRecipeFileSync, resolveRecipePath } from '@jackwener/opencli/cindy/host';
/**
* ChatGPT web browser automation helpers.
* Cross-platform: works on Linux/macOS/Windows via OpenCLI's CDP browser automation.
@@ -2464,16 +2463,14 @@ function imageMimeFromPath(filePath) {
}
export async function prepareChatGPTImagePaths(imagePaths) {
- const fs = __cindy_node_fs;
const path = __cindy_node_path;
- const absPaths = imagePaths.map(filePath => path.default.resolve(filePath));
+ const absPaths = imagePaths.map(filePath => resolveRecipePath(filePath));
const allowedExts = new Set(['.jpg', '.jpeg', '.png', '.webp', '.gif', '.heic', '.heif']);
for (const absPath of absPaths) {
- if (!fs.default.existsSync(absPath)) {
- return { ok: false, reason: `Image not found: ${absPath}` };
- }
- const stat = fs.default.statSync(absPath);
+ let stat;
+ try { stat = statRecipeFileSync(absPath); }
+ catch { return { ok: false, reason: `Image not found: ${absPath}` }; }
if (!stat.isFile()) {
return { ok: false, reason: `Not a file: ${absPath}` };
}
@@ -2539,12 +2536,11 @@ async function waitForChatGPTUploadPreview(page, fileNames) {
}
async function uploadChatGPTChunkedFiles(page, paths, selector, mimeForPath) {
- const fs = __cindy_node_fs;
const path = __cindy_node_path;
if (typeof page.evaluateOnce !== 'function') {
throw new CommandExecutionError('File upload fallback requires a browser backend with evaluateOnce support.');
}
- if (paths.some(file => fs.default.statSync(file).size > 25 * 1024 * 1024)) {
+ if (paths.some(file => statRecipeFileSync(file).size > 25 * 1024 * 1024)) {
return { ok: false, reason: 'Uploads over 25 MB require a current Browser Bridge extension with native file-input support' };
}
// Base64 can exceed the daemon's 1 MB request limit. Stage bounded,
@@ -3380,7 +3376,6 @@ export async function openProjectKnowledgeDialog(page) {
*/
export async function uploadChatGPTProjectFiles(page, projectId, filePaths) {
const id = parseChatGPTProjectId(projectId);
- const fs = __cindy_node_fs;
const path = __cindy_node_path;
const prepared = await prepareChatGPTFilePaths(filePaths);
@@ -3530,15 +3525,13 @@ async function waitForChatGPTProjectUploadConfirmation(page, fileNames) {
* Accepts all file types with a 512 MB per-file limit (matching ChatGPT's project limit).
*/
export async function prepareChatGPTFilePaths(filePaths) {
- const fs = __cindy_node_fs;
const path = __cindy_node_path;
- const absPaths = filePaths.map(filePath => path.default.resolve(filePath));
+ const absPaths = filePaths.map(filePath => resolveRecipePath(filePath));
for (const absPath of absPaths) {
- if (!fs.default.existsSync(absPath)) {
- return { ok: false, reason: `File not found: ${absPath}` };
- }
- const stat = fs.default.statSync(absPath);
+ let stat;
+ try { stat = statRecipeFileSync(absPath); }
+ catch { return { ok: false, reason: `File not found: ${absPath}` }; }
if (!stat.isFile()) {
return { ok: false, reason: `Not a file: ${absPath}` };
}
diff --git a/packages/opencli-vendor/clis/deepseek/utils.js b/packages/opencli-vendor/clis/deepseek/utils.js
index cd62095ca3..cd5b00c80c 100644
--- a/packages/opencli-vendor/clis/deepseek/utils.js
+++ b/packages/opencli-vendor/clis/deepseek/utils.js
@@ -1,6 +1,5 @@
-import * as __cindy_node_fs from "node:fs";
import * as __cindy_node_path from "node:path";
-import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
+import { readRecipeFileSync, statRecipeFileSync, resolveRecipePath } from '@jackwener/opencli/cindy/host';
import { ArgumentError } from '@jackwener/opencli/errors';
export const DEEPSEEK_DOMAIN = 'chat.deepseek.com';
@@ -379,15 +378,12 @@ async function waitForFilePreview(page, fileName) {
}
export async function sendWithFile(page, filePath, prompt) {
- const fs = __cindy_node_fs;
const path = __cindy_node_path;
- const absPath = path.default.resolve(filePath);
+ const absPath = resolveRecipePath(filePath);
- if (!fs.default.existsSync(absPath)) {
- return { ok: false, reason: `File not found: ${absPath}` };
- }
-
- const stats = fs.default.statSync(absPath);
+ let stats;
+ try { stats = statRecipeFileSync(absPath); }
+ catch { return { ok: false, reason: `File not found: ${absPath}` }; }
if (stats.size > 100 * 1024 * 1024) {
return { ok: false, reason: `File too large (${(stats.size / 1024 / 1024).toFixed(1)} MB). Max: 100 MB` };
}
diff --git a/packages/opencli-vendor/clis/midjourney/download.js b/packages/opencli-vendor/clis/midjourney/download.js
index f03099c6b9..a13eb61a54 100644
--- a/packages/opencli-vendor/clis/midjourney/download.js
+++ b/packages/opencli-vendor/clis/midjourney/download.js
@@ -4,7 +4,6 @@ import {
displayPath,
downloadOriginals,
downloadRawVideo,
- downloadRenderedVideo,
fetchJobStatus,
isVideoJob,
normalizeBoolean,
@@ -13,13 +12,13 @@ import {
resolveOutputDir,
} from './utils.js';
-const KINDS = ['auto', 'image', 'video-raw', 'video-social', 'gif'];
+const KINDS = ['auto', 'image', 'video-raw'];
cli({
site: 'midjourney',
name: 'download',
access: 'write',
- description: 'Download original images, raw video, social MP4, or GIF with MIME and atomic-write checks',
+ description: 'Download original images or raw video with MIME and atomic-write checks',
example: 'opencli midjourney download <job> --kind auto --index all',
domain: 'www.midjourney.com',
strategy: Strategy.COOKIE,
@@ -30,7 +29,7 @@ cli({
args: [
{ name: 'job', positional: true, required: true, help: 'Job UUID or Midjourney /jobs/<uuid> URL' },
{ name: 'index', default: 'all', help: 'Candidate 1..4 or all' },
- { name: 'kind', default: 'auto', help: 'auto, image, video-raw, video-social, or gif' },
+ { name: 'kind', default: 'auto', choices: KINDS, help: 'auto, image, or video-raw' },
{ name: 'output', default: './midjourney-downloads', help: 'Output directory' },
{ name: 'force', type: 'boolean', default: false, help: 'Overwrite existing non-empty files' },
],
@@ -46,7 +45,7 @@ cli({
let kind = String(kwargs.kind || 'auto').trim().toLowerCase();
if (!KINDS.includes(kind)) throw new ArgumentError(`--kind must be one of: ${KINDS.join(', ')}`);
if (kind === 'auto') kind = video ? 'video-raw' : 'image';
- if (video && kind === 'image') throw new ArgumentError('Video jobs support video-raw, video-social, or gif downloads');
+ if (video && kind === 'image') throw new ArgumentError('Video jobs support video-raw downloads');
if (!video && kind !== 'image') throw new ArgumentError('Image jobs only support --kind image');
const indices = parseImageIndices(kwargs.index, Number(job.batch_size || (video ? 1 : 4)));
@@ -61,9 +60,6 @@ cli({
} else if (kind === 'video-raw') {
files = [];
for (const index of indices) files.push(await downloadRawVideo(page, jobId, index, outputDir, force));
- } else {
- files = [];
- for (const index of indices) files.push(await downloadRenderedVideo(page, jobId, index, kind, outputDir, force));
}
return files.map((item) => ({
job_id: jobId,
diff --git a/packages/opencli-vendor/clis/zhihu/write-shared.js b/packages/opencli-vendor/clis/zhihu/write-shared.js
index dec7c928ec..01e7876041 100644
--- a/packages/opencli-vendor/clis/zhihu/write-shared.js
+++ b/packages/opencli-vendor/clis/zhihu/write-shared.js
@@ -1,5 +1,4 @@
-import { readRecipeFileSync } from '@jackwener/opencli/cindy/host';
-import { stat } from 'node:fs/promises';
+import { readRecipeFileSync, statRecipeFileSync } from '@jackwener/opencli/cindy/host';
import { CliError } from '@jackwener/opencli/errors';
const RESULT_ROW_RESERVED_KEYS = new Set(['status', 'outcome', 'message', 'target_type', 'target']);
const NAV_SCOPE_SELECTOR = 'header, nav, [role="banner"], [role="navigation"]';
@@ -17,7 +16,7 @@ const IN_PAGE_EXPLICIT_IDENTITY_META_TOKEN_GROUPS = JSON.stringify(EXPLICIT_IDEN
function defaultFileReaderDeps() {
return {
readFile: readRecipeFileSync,
- stat: (path) => stat(path),
+ stat: statRecipeFileSync,
decodeUtf8: (raw) => new TextDecoder('utf-8', { fatal: true }).decode(raw),
};
}