Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Improve task-board controls and scoped connector authorization
wytbaa9dd5ba060
diff --git a/bin/local-cli-auth.cjs b/bin/local-cli-auth.cjsindex 2e2de793..1cf5d9e4 100644--- a/bin/local-cli-auth.cjs+++ b/bin/local-cli-auth.cjs@@ -2,11 +2,12 @@'use strict';/** Interactive authorization driver for reviewed official provider CLIs.- * This file accepts no model/user command arguments: every executable, package and OAuth scope- * is pinned by Orkas-owned constants below. */+ * This file accepts no model/user command arguments. Executables and packages are pinned;+ * incremental scopes come from verified grants and structured provider recovery state. */const { spawn, spawnSync } = require('node:child_process');const fs = require('node:fs');const path = require('node:path');+const permissions = require('./local-cli-permissions.cjs');const MANIFESTS = Object.freeze({wecom: Object.freeze({@@ -87,7 +88,7 @@ function fail(error) {process.exitCode = 1;}-function run(node, npxCli, packageSpec, args, env, allowExisting = false, offline = true) {+function run(node, npxCli, packageSpec, args, env, allowExisting = false, offline = true, captureStdout = false) {return new Promise((resolve, reject) => {const child = spawn(node, [npxCli, ...(offline ? ['--offline'] : []), '-y', packageSpec, ...args], {cwd: env.ORKAS_LOCAL_CLI_WORK_DIR,@@ -96,7 +97,16 @@ function run(node, npxCli, packageSpec, args, env, allowExisting = false, offlinwindowsHide: true,});let outputForwarded = false;+ let stdout = '';+ let overflow = false;for (const [source, target] of [[child.stdout, process.stdout], [child.stderr, process.stderr]]) {+ if (captureStdout && source === child.stdout) {+ source.on('data', chunk => {+ if (!overflow && stdout.length + chunk.length <= 64 * 1024) stdout += chunk.toString();+ else { overflow = true; stdout = ''; }+ });+ continue;+ }source.on('data', () => { outputForwarded = true; });source.pipe(target, { end: false });}@@ -109,7 +119,7 @@ function run(node, npxCli, packageSpec, args, env, allowExisting = false, offlinchild.once('close', (code, signal) => {process.removeListener('SIGTERM', forward);process.removeListener('SIGINT', forward);- if (code === 0 || allowExisting) resolve();+ if (code === 0 || allowExisting) resolve(captureStdout && !overflow ? stdout : undefined);else reject(Object.assign(new Error(`official CLI exited with ${code ?? signal ?? 'unknown'}`), {outputForwarded,}));@@ -132,7 +142,7 @@ function commandSucceeds(node, npxCli, manifest, args, env, runner = spawnSync)return !result.error && result.status === 0;}-function larkAuthorizationReady(node, npxCli, manifest, env, runner = spawnSync) {+function larkUserScopes(node, npxCli, manifest, env, runner = spawnSync) {const verify = manifest.verify(env);const result = runner(node,@@ -146,16 +156,42 @@ function larkAuthorizationReady(node, npxCli, manifest, env, runner = spawnSync)windowsHide: true,},);- if (result.error) return false;+ if (result.error || result.status !== 0) return null;try {const status = JSON.parse(String(result.stdout || ''));- return status?.identities?.user?.available === true- && status?.identities?.user?.verified === true;+ const user = status?.identities?.user;+ const scopes = typeof user?.scope === 'string' ? user.scope.split(/\s+/)+ : Array.isArray(user?.scope) ? user.scope : [];+ return user?.available === true && user?.verified === true+ ? scopes.filter(permissions.isScopeName) : null;} catch {- return false;+ return null;}}+function larkAuthorizationReady(node, npxCli, manifest, env, runner = spawnSync, requiredScopes = []) {+ const scopes = larkUserScopes(node, npxCli, manifest, env, runner);+ return scopes !== null && requiredScopes.every((scope) => scopes.includes(scope));+}++function checkLarkPermissions(node, npxCli, manifest, env, runner = spawnSync) {+ const pending = permissions.readPermissionRequest(env);+ let scopeReported = false;+ const scopes = larkUserScopes(node, npxCli, manifest, env, (...args) => {+ const result = runner(...args);+ try {+ const value = JSON.parse(String(result.stdout || '')).identities?.user?.scope;+ scopeReported = typeof value === 'string'+ ? value.split(/\s+/).filter(Boolean).every(permissions.isScopeName)+ : Array.isArray(value) && value.every(permissions.isScopeName);+ } catch { /* An unavailable scope report is not proof of missing permission. */ }+ return result;+ });+ if (scopes === null || !scopeReported) return false;+ permissions.recordUserScopeCheck(env, scopes, pending, ['im:message.send_as_user']);+ return true;+}+function wecomAuthorizationReady(node, npxCli, manifest, env, runner = spawnSync) {const result = runner(node,@@ -169,7 +205,7 @@ function wecomAuthorizationReady(node, npxCli, manifest, env, runner = spawnSyncwindowsHide: true,},);- if (result.error) return false;+ if (result.error || result.status !== 0) return false;try {const identity = JSON.parse(String(result.stdout || ''));return typeof identity?.extra_identity_context === 'string'@@ -192,7 +228,7 @@ function dingtalkAuthorizationReady(node, npxCli, manifest, env, runner = spawnSwindowsHide: true,},);- if (result.error) return false;+ if (result.error || result.status !== 0) return false;try {const status = JSON.parse(String(result.stdout || ''));return status?.success === true && status?.authenticated === true;@@ -207,18 +243,67 @@ async function authorizeSingleStep(node, npxCli, manifest, env, authorizationReaconst ready = dependencies.authorizationReady|| (() => authorizationReady(node, npxCli, manifest, env));- if (ready()) return;+ const pending = permissions.readPermissionRequest(env);+ if (!pending && ready()) return;let loginError = null;try {await execute(manifest.login(env)[0]);} catch (error) {loginError = error;}- if (ready()) return;+ if (pending && loginError) throw loginError;+ if (ready()) {+ // Identity verification cannot attest to resource or business permissions.+ // Preserve the advisory request and the existing usable connection.+ if (pending) throw new Error('requested permissions could not be verified');+ return;+ }if (loginError) throw loginError;throw new Error('official CLI authorization did not produce a verified identity');}+// DWS login verifies identity only. PAT grants are additive and must acknowledge+// the requested scopes; a successful old login cannot resolve business denial.+async function authorizeDingtalk(node, npxCli, manifest, env, dependencies = {}) {+ const execute = dependencies.execute+ || ((args, capture = false) => run(node, npxCli, manifest.package, args, env, false, true, capture));+ const ready = dependencies.authorizationReady+ || (() => dingtalkAuthorizationReady(node, npxCli, manifest, env));+ const pending = permissions.readPermissionRequest(env);+ if (!pending) return authorizeSingleStep(node, npxCli, manifest, env, dingtalkAuthorizationReady, dependencies);+ const loginNeeded = !ready();+ if (loginNeeded) await execute(manifest.login(env)[0]);+ if (!ready()) throw new Error('official CLI authorization did not produce a verified identity');+ const scopes = pending.pat_scopes || [];+ // Recheck known PAT scopes after administrator changes; a cached policy denial+ // must not permanently prevent a user-initiated recovery attempt.+ if (pending.admin_required && !scopes.length) throw new Error('organization administrator approval is required');+ if (scopes.length) {+ const grantArgs = ['pat', 'chmod', ...scopes, '--grant-type', 'permanent', '--yes'];+ // Table mode lets the official CLI own consent/polling. DWS may return only+ // {ok:true} after consent; repeat the same additive grant in JSON mode to+ // obtain granted/already-granted scope evidence, never a business replay.+ await execute([...grantArgs, '--format', 'table']);+ const output = await execute([...grantArgs, '--format', 'json'], true);+ let receipt;+ try { receipt = JSON.parse(output); } catch { /* no verified grant receipt */ }+ const data = receipt?.data || receipt?.result;+ const granted = [...(Array.isArray(data?.grantedScopes) ? data.grantedScopes : []),+ ...(Array.isArray(data?.alreadyGrantedScopes) ? data.alreadyGrantedScopes : [])];+ if (receipt?.success === true) permissions.recordPatScopeGrant(env, pending, granted);+ if (receipt?.success !== true || !scopes.every(scope => granted.includes(scope))) {+ throw new Error('requested permissions are still unavailable');+ }+ }+ // DWS 1.0.61 declares --scopes but does not read it in auth login. Do not+ // silently claim an OAuth scope or an unknown resource denial was repaired.+ if (pending.scopes.length || pending.unresolved_access || !scopes.length) {+ if (!scopes.length && !loginNeeded) await execute(manifest.login(env)[0]);+ throw new Error('requested permissions could not be verified');+ }+ permissions.clearPermissionRequest(env, pending);+}+async function authorizeLark(node, npxCli, manifest, env, dependencies = {}) {const execute = dependencies.execute|| ((args) => run(node, npxCli, manifest.package, args, env));@@ -231,13 +316,36 @@ async function authorizeLark(node, npxCli, manifest, env, dependencies = {}) {env,));const authorizationReady = dependencies.authorizationReady- || (() => larkAuthorizationReady(node, npxCli, manifest, env));-- if (authorizationReady()) return;+ || ((scopes = []) => larkAuthorizationReady(node, npxCli, manifest, env, spawnSync, scopes));+ const pendingPermissions = permissions.readPermissionRequest(env);+ const authorizationScopes = dependencies.authorizationScopes+ || (() => larkUserScopes(node, npxCli, manifest, env));+ const ready = authorizationReady();+ if (ready && !pendingPermissions) return;const commands = manifest.login(env);- if (!profileConfigured()) {+ if (!ready && !profileConfigured()) {await execute(commands[0]);- if (authorizationReady()) return;+ if (!pendingPermissions && authorizationReady()) return;+ }+ if (pendingPermissions) {+ const existingScopes = authorizationScopes();+ if (ready && !existingScopes) throw new Error('current user permissions could not be verified');+ const requestedScopes = [...new Set([...(existingScopes || []), ...pendingPermissions.scopes])].sort();+ // A permission failure requires a real interactive login, including when the+ // current token is valid or the provider supplied no missing scope list.+ await execute(pendingPermissions.scopes.length+ ? ['auth', 'login', '--profile', env.ORKAS_LOCAL_CLI_PROFILE, '--scope', requestedScopes.join(' ')]+ : [...commands[1], ...(requestedScopes.length ? ['--scope', requestedScopes.join(' ')] : [])]);+ if (!authorizationReady(requestedScopes)) {+ throw new Error('requested permissions are still unavailable');+ }+ // Verified user scopes cannot establish bot visibility or unknown resource+ // access. Keep that advisory, just as a read-only scope check does.+ if (pendingPermissions.unresolved_access || !pendingPermissions.scopes.length) {+ throw new Error('requested permissions could not be verified');+ }+ permissions.clearPermissionRequest(env, pendingPermissions);+ return;}let loginError = null;@@ -334,6 +442,10 @@ async function main() {}assertIntegrityMarker(manifest, process.env);+ if (process.env.ORKAS_LOCAL_CLI_CHECK_PERMISSIONS_ONLY === '1') {+ if (provider === 'lark') checkLarkPermissions(node, npxCli, manifest, process.env);+ return;+ }// The host's session-start event owns progress; stdout/stderr carry provider output.// The pinned Lark CLI starts discovery on Feishu, reads tenant_brand from the scanned account,// and persists the final Feishu/Lark brand in the profile. Orkas therefore does not ask the@@ -345,10 +457,9 @@ async function main() {node, npxCli, manifest, process.env, wecomAuthorizationReady,);} else if (provider === 'dingtalk') {- await authorizeSingleStep(- node, npxCli, manifest, process.env, dingtalkAuthorizationReady,- );+ await authorizeDingtalk(node, npxCli, manifest, process.env);} else {+ const pending = permissions.readPermissionRequest(process.env);const commands = manifest.login(process.env);for (let index = 0; index < commands.length; index++) {// Xero profile creation may report that the deterministic profile already exists during@@ -358,6 +469,7 @@ async function main() {}const verify = typeof manifest.verify === 'function' ? manifest.verify(process.env) : manifest.verify;await run(node, npxCli, manifest.package, verify, process.env);+ if (pending) permissions.clearPermissionRequest(process.env, pending);}writeIntegrityMarker(manifest, process.env);process.stdout.write(`[Orkas] ${process.env.ORKAS_LOCAL_CLI_MESSAGE_DONE || 'Authorization complete. You can close this terminal.'}\n`);@@ -367,10 +479,13 @@ module.exports = {MANIFESTS,assertIntegrityMarker,authorizeLark,+ authorizeDingtalk,authorizeSingleStep,commandSucceeds,dingtalkAuthorizationReady,larkAuthorizationReady,+ larkUserScopes,+ checkLarkPermissions,main,run,verifyRegistryIntegrity,diff --git a/bin/local-cli-lark.cjs b/bin/local-cli-lark.cjsindex 79843656..77faecd1 100644--- a/bin/local-cli-lark.cjs+++ b/bin/local-cli-lark.cjs@@ -6,6 +6,7 @@*/const RISKS = new Set(['read', 'write', 'high-risk-write']);const OWNED_FLAGS = new Set(['help', 'profile', 'format', 'json', 'yes', 'dry-run']);+const { isScopeName, readPermissionRequest, rememberPermissionRequest, clearPermissionRequest } = require('./local-cli-permissions.cjs');function contractError() {return Object.assign(new Error('official lark-cli command contract is unavailable or incompatible'), {@@ -113,6 +114,11 @@ function shortcutParameters(parameters, schema, validateLocalFile) {function parameterArgs(parameters, schema) {const args = [];for (const [key, value] of Object.entries(parameters)) {+ const carrier = schema?.inputSchema?.properties?.[key];+ if (carrier?.carrier === '--file' && carrier.type === 'object') {+ for (const [field, file] of Object.entries(value)) args.push('--file', `${field}=${file}`);+ continue;+ }const property = schema?._meta?.source === 'cli-help' ? schema.inputSchema.properties[key] : null;const flag = property?.flag || `--${key.replace(/_/g, '-')}`;if (typeof value === 'boolean') args.push(`${flag}=${value}`);@@ -136,7 +142,7 @@ const ERROR_MESSAGES = Object.freeze({confirmation: ['local_cli_confirmation_required', 'official lark-cli requires confirmation for this action'],});const ERROR_SUBTYPES = new Set([- 'invalid_argument', 'command_unavailable', 'missing_scope', 'app_scope_not_applied',+ 'invalid_argument', 'command_unavailable', 'missing_scope', 'token_scope_insufficient', 'app_scope_not_applied','access_denied', 'token_missing', 'token_expired', 'token_invalid', 'not_configured','timeout', 'dns', 'tls', 'transport', 'protocol', 'server_error', 'rate_limit','not_found', 'failed_precondition', 'confirmation_required',@@ -151,15 +157,28 @@ function structuredFailure(result) {}if (payload?.ok !== false || !Object.hasOwn(ERROR_MESSAGES, payload.error?.type || '')) return null;const { type, subtype, code } = payload.error;- const [errorCode, message] = ERROR_MESSAGES[type];+ const identity = payload.identity || payload.error.identity;+ const missingScopes = payload.missing_scopes || payload.error.missing_scopes;+ // API visibility/scope denials may use the API envelope instead of the+ // authorization envelope. Preserve their provider type and numeric code.+ const permissionDenied = type === 'authorization' || (type === 'api' && [230013, 99991679].includes(code));+ const [errorCode, message] = ERROR_MESSAGES[permissionDenied ? 'authorization' : type];return Object.assign(new Error(message), {code: errorCode,provider_error: {type,...(ERROR_SUBTYPES.has(subtype) ? { subtype } : {}),...(Number.isSafeInteger(code) ? { code } : {}),+ ...(['user', 'bot'].includes(identity) ? { identity } : {}),+ ...(Array.isArray(missingScopes) ? {+ missing_scopes: missingScopes.filter(isScopeName).slice(0, 50),+ } : {}),},});}-module.exports = { shortcutSchema, capabilityCommands, apiSchema, shortcutParameters, parameterArgs, structuredFailure };++module.exports = {+ shortcutSchema, capabilityCommands, apiSchema, shortcutParameters, parameterArgs, structuredFailure,+ isScopeName, readPermissionRequest, rememberPermissionRequest, clearPermissionRequest,+};diff --git a/bin/local-cli-mcp-server.cjs b/bin/local-cli-mcp-server.cjsindex 997cca27..cec6a9cb 100644--- a/bin/local-cli-mcp-server.cjs+++ b/bin/local-cli-mcp-server.cjs@@ -11,7 +11,9 @@ const { spawn } = require('node:child_process');const { killProcessTree } = require('./bridge-skill-runner.cjs');const fs = require('node:fs');const path = require('node:path');+const os = require('node:os');const larkContract = require('./local-cli-lark.cjs');+const permissions = require('./local-cli-permissions.cjs');const { Server } = require('@modelcontextprotocol/sdk/server/index.js');const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');@@ -80,7 +82,7 @@ const ACTION_SCHEMA = Object.freeze({},parameters: {type: 'object',- description: 'Named parameters from describe_action. Raw CLI flags and local file/output paths are rejected.',+ description: 'Named parameters from describe_action. Local file inputs require absolute paths in Orkas-approved roots; raw CLI flags and output paths are rejected.',additionalProperties: true,},},@@ -333,8 +335,8 @@ function xeroInputHasDestructiveStatus(filePath) {}}-function invocationRisk(baseRisk, parameters, env = process.env) {- const validated = validatedParameters(parameters, env);+function invocationRisk(baseRisk, parameters, env = process.env, inspection) {+ const validated = validatedParameters(parameters, env, inspection);if (env.ORKAS_LOCAL_CLI_PROVIDER === 'xero') {let risk = containsDestructiveStatus(validated) ? 'D' : baseRisk;for (const [key, value] of Object.entries(validated)) {@@ -373,7 +375,104 @@ function isWithin(root, candidate) {return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));}-function validatedParameters(value, env = process.env) {+// Normalize provider parameter contracts at one boundary. Neither action names+// nor path-looking literal values determine whether the CLI may read a file.+function parameterSchema(inspection) {+ const schema = inspection?.schema || {};+ if (inspection?.provider === 'wecom') return schema.schemas?.[schema.request?.$ref] || schema.request || {};+ if (inspection?.provider === 'dingtalk') return { type: 'object', properties: schema.parameters || {} };+ return schema.inputSchema || {};+}++function fileContract(property, provider) {+ const description = typeof property?.description === 'string' ? property.description : '';+ // Pinned Lark shortcut help is its official introspection format; API methods+ // and WeCom expose binary markers, while DWS also exposes format/input facts.+ const localPath = property?.format === 'binary' || property?.format === 'file-path'+ || property?.['x-wecom-octet-stream'] === true+ || (provider === 'lark' && (description.includes('cwd-relative local path') || description.startsWith('local file path')))+ || (provider === 'dingtalk' && description.startsWith('本地文件路径'));+ const reference = (Array.isArray(property?.input) && property.input.includes('file')) || description.includes('supports @file')+ || (provider === 'dingtalk' && (property?.format === 'json' || description.includes('@file')));+ return {+ localPath, reference,+ url: localPath && description.includes('URL'),+ keyPrefixes: localPath ? ['file', 'img'].filter(prefix => description.includes(`${prefix}_xxx`)) : [],+ };+}++function localInputs(value, env, inspection) {+ const inputs = [];+ const provider = env.ORKAS_LOCAL_CLI_PROVIDER;+ const root = parameterSchema(inspection);+ function visit(raw, property, keys) {+ if (property?.$ref && provider === 'wecom') property = inspection?.schema?.schemas?.[property.$ref] || property;+ const contract = fileContract(property, provider);+ if (Array.isArray(raw)) {+ if (property?.type === 'object') throw new Error('object parameter requires an object');+ raw.forEach((item, index) => visit(item, { ...property, ...property?.items, type: property?.items?.type }, [...keys, index]));+ return;+ }+ if (property?.type === 'object') {+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error('object parameter requires an object');+ if (property.carrier === '--file') {+ for (const field of property.required || []) {+ if (!Object.hasOwn(raw, field)) throw new Error(`missing binary file field: ${field}`);+ }+ if (Object.keys(raw).some(field => property.properties?.[field]?.format !== 'binary')) {+ throw new Error('unknown binary file field');+ }+ }+ for (const [field, child] of Object.entries(raw)) visit(child, property.properties?.[field], [...keys, field]);+ return;+ }+ if (contract.localPath) {+ if (typeof raw === 'string' && ((contract.url && /^https:\/\//i.test(raw))+ || contract.keyPrefixes.some(prefix => new RegExp(`^${prefix}_[A-Za-z0-9_-]+$`).test(raw)))) return;+ inputs.push({ keys, value: raw });+ return;+ }+ if (typeof raw === 'string' && contract.reference) {+ if (raw === '-' || raw === '@-') throw new Error('stdin input is not available through this connector');+ if (raw.startsWith('@')) inputs.push({ keys, value: raw.slice(1), prefix: '@' });+ return;+ }+ // DWS has legacy @file readers that are absent from some leaf contracts.+ // Fail closed for their ASCII file-reference syntax; literal mentions stay text.+ if (typeof raw === 'string' && provider === 'dingtalk' && /^@[A-Za-z0-9./~_-]/.test(raw)) {+ throw new Error('indirect file input is not declared by this action; use inline content');+ }+ // Xero's existing full-JSON input inspection also serves callers that have+ // no introspection result yet. Do not infer files from arbitrary strings.+ if ((!inspection || provider === 'xero') && LOCAL_INPUT_PARAMETER_KEYS.test(String(keys.at(-1)))) {+ if (typeof raw === 'string' && /^https:\/\//i.test(raw)) return;+ inputs.push({ keys, value: raw });+ }+ }+ for (const [key, raw] of Object.entries(value)) {+ const property = root.properties?.[key] || root.properties?.[key.replace(/-/g, '_')]+ || root.properties?.[key.replace(/_/g, '-')];+ visit(raw, property, [key]);+ }+ return inputs;+}++function approvedInputPath(input, env) {+ if (typeof input !== 'string') throw new Error('local input parameter must be a path or HTTPS URL');+ let candidate;+ let stat;+ try { candidate = fs.realpathSync(input); stat = fs.statSync(candidate); }+ catch { throw new Error('local input file does not exist'); }+ if (!path.isAbsolute(input) || !allowedFileRoots(env).some((root) => isWithin(root, candidate))) {+ throw new Error('local input path is outside Orkas-approved roots');+ }+ if (env.ORKAS_LOCAL_CLI_PROVIDER !== 'xero' && !stat.isFile()) {+ throw new Error('local input must be a regular file');+ }+ return candidate;+}++function validatedParameters(value, env = process.env, inspection) {if (value == null) return {};if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('parameters must be an object');const serialized = JSON.stringify(value);@@ -400,27 +499,75 @@ function validatedParameters(value, env = process.env) {if (raw === undefined || typeof raw === 'function' || typeof raw === 'symbol') {throw new Error(`invalid parameter value: ${key}`);}- const pathLikeValue = typeof raw === 'string' && (- path.isAbsolute(raw)- || path.win32.isAbsolute(raw)- || /^file:\/\//i.test(raw)- || /^\.\.?[\\/]/.test(raw)- );- if (LOCAL_INPUT_PARAMETER_KEYS.test(key) || pathLikeValue) {- if (typeof raw !== 'string') throw new Error(`local input parameter must be a path or HTTPS URL: ${key}`);- if (!/^https:\/\//i.test(raw)) {- let candidate = '';- try { candidate = fs.realpathSync(raw); } catch { throw new Error(`local input file does not exist: ${key}`); }- if (!path.isAbsolute(raw) || !allowedFileRoots(env).some((root) => isWithin(root, candidate))) {- throw new Error(`local input path is outside Orkas-approved roots: ${key}`);- }- }- }out[key] = raw;}+ for (const input of localInputs(out, env, inspection)) approvedInputPath(input.value, env);return out;}+async function prepareLocalInputs(parameters, inspection, env, signal) {+ const inputs = localInputs(parameters, env, inspection);+ // Xero reads absolute JSON input and owns full-payload destructive-state+ // inspection. Do not replace that existing contract with a binary upload path.+ if (!inputs.length || inspection.provider === 'xero') return { parameters, cleanup() {} };+ // Provider config trees contain credentials. Lark rejects every upload from+ // that tree, including runtime/work. Stage approved bytes in a private,+ // per-call OS temporary directory and remove it on every terminal outcome.+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-cli-input-'));+ const cleanup = () => fs.rmSync(directory, { recursive: true, force: true });+ const prepared = structuredClone(parameters);+ try {+ for (const [index, input] of inputs.entries()) {+ throwIfCancelled(signal);+ const source = approvedInputPath(input.value, env);+ const relative = path.join(String(index), path.basename(input.value));+ const destination = path.join(directory, relative);+ fs.mkdirSync(path.dirname(destination), { mode: 0o700 });+ // Bound host staging; stricter media-specific limits belong to the provider.+ const limit = input.prefix ? 8 * 1024 * 1024 : 5 * 1024 * 1024 * 1024;+ const reader = await fs.promises.open(source, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK | (fs.constants.O_NOFOLLOW || 0));+ try {+ const stat = await reader.stat();+ if (!stat.isFile() || stat.size > limit) throw new Error('local input is not a regular file within the action size limit');+ const current = fs.statSync(source);+ if (approvedInputPath(source, env) !== source || current.dev !== stat.dev || current.ino !== stat.ino) {+ throw new Error('local input changed while opening');+ }+ const writer = await fs.promises.open(destination, 'wx', 0o600);+ try {+ const buffer = Buffer.alloc(1024 * 1024);+ let total = 0;+ while (true) {+ throwIfCancelled(signal);+ const { bytesRead } = await reader.read(buffer, 0, buffer.length, null);+ if (!bytesRead) break;+ total += bytesRead;+ if (total > limit) throw new Error('local input exceeds the action size limit');+ let offset = 0;+ while (offset < bytesRead) {+ const { bytesWritten } = await writer.write(buffer, offset, bytesRead - offset, null);+ if (!bytesWritten) throw new Error('local input staging failed');+ offset += bytesWritten;+ }+ }+ const after = await reader.stat();+ if (after.size !== total || after.size !== stat.size || after.mtimeMs !== stat.mtimeMs) {+ throw new Error('local input changed while copying');+ }+ } finally { await writer.close(); }+ } finally { await reader.close(); }+ let target = prepared;+ for (const key of input.keys.slice(0, -1)) target = target[key];+ target[input.keys.at(-1)] = `${input.prefix || ''}${relative}`;+ }+ return { parameters: prepared, cwd: directory, cleanup };+ } catch (error) {+ cleanup();+ if (error.code === 'E_TOOL_CALL_CANCELLED') throw error;+ throw new Error('local input could not be prepared; check file access and size');+ }+}+function parameterArgs(parameters) {const args = [];for (const [key, value] of Object.entries(parameters)) {@@ -443,7 +590,10 @@ function redact(value) {}function throwIfCancelled(signal) {- if (signal?.aborted) throw Object.assign(new Error('local CLI call was cancelled'), { code: 'E_TOOL_CALL_CANCELLED' });+ if (signal?.aborted) {+ if (signal.reason?.name === 'TimeoutError') throw Object.assign(new Error('local CLI call timed out'), { code: 'ETIMEDOUT' });+ throw Object.assign(new Error('local CLI call was cancelled'), { code: 'E_TOOL_CALL_CANCELLED' });+ }}function runOfficialProcess(command, args, options) {@@ -507,24 +657,33 @@ function runOfficialProcess(command, args, options) {async function runOfficial(args, options = {}, env = process.env) {throwIfCancelled(options.signal);+ await options.onProgress?.();const manifest = configuredManifest(env);const runner = options.runner || runOfficialProcess;const result = await runner(env.ORKAS_NODE, [env.ORKAS_LOCAL_CLI_NPX_CLI, '--offline', '-y', manifest.package, ...args,], {- cwd: env.ORKAS_LOCAL_CLI_WORK_DIR,+ cwd: options.cwd || env.ORKAS_LOCAL_CLI_WORK_DIR,env,encoding: 'utf8',- timeout: options.timeoutMs || 120_000,+ timeout: options.timeoutMs || 60_000,maxBuffer: MAX_OUTPUT_CHARS,windowsHide: true,signal: options.signal,});throwIfCancelled(options.signal);const stdout = redact(result.stdout);+ const permissionError = permissions.structuredPermissionFailure(result, manifest.provider);if (manifest.provider === 'lark' && !result.error) {const structured = larkContract.structuredFailure(result);- if (structured) throw structured;+ if (structured && (structured.code === 'connector_permission_denied' || !permissionError)) {+ permissions.rememberPermissionRequest(structured, env);+ throw structured;+ }+ }+ if (permissionError) {+ permissions.rememberPermissionRequest(permissionError, env);+ throw permissionError;}if (result.error || result.status !== 0) {const rawFailure = [result.error?.message, result.stderr, result.stdout].filter(Boolean).join('\n');@@ -615,7 +774,11 @@ async function inspectCapabilities(pathValue, options = {}, env = process.env) {function invocationFor(action, parameters, risk, env = process.env, inspection) {const validated = validateAction(action, env);- const params = validatedParameters(parameters, env);+ const params = validatedParameters(parameters, env, inspection);+ return providerInvocation(validated, params, risk, env, inspection);+}++function providerInvocation(validated, params, risk, env, inspection) {const args = validated.manifest.provider === 'lark' && inspection? [...inspection.cli_path.split(' '), ...larkContract.parameterArgs(params, inspection.schema)]: validated.manifest.provider === 'wecom'@@ -636,7 +799,7 @@ function invocationFor(action, parameters, risk, env = process.env, inspection)async function executeAction(expectedRisk, args, options = {}, env = process.env) {const inspection = await inspectAction(args.action, options, env);let parameters = args.parameters;- const effectiveRisk = invocationRisk(inspection.risk, parameters, env);+ const effectiveRisk = invocationRisk(inspection.risk, parameters, env, inspection);if (effectiveRisk !== expectedRisk) {throw new Error(`action risk mismatch: ${inspection.action} is ${effectiveRisk}, use ${effectiveRisk === 'R' ? 'execute_read'@@ -646,15 +809,42 @@ async function executeAction(expectedRisk, args, options = {}, env = process.env}`);}if (inspection.provider === 'lark' && inspection.schema._meta.source === 'cli-help') {- parameters = larkContract.shortcutParameters(validatedParameters(parameters, env), inspection.schema,+ parameters = larkContract.shortcutParameters(validatedParameters(parameters, env, inspection), inspection.schema,(file) => validatedParameters({ file }, env));}- const invocation = invocationFor(inspection.action, parameters, effectiveRisk, env, inspection);- return {- action: inspection.action,- risk: effectiveRisk,- result: await runOfficial(invocation, options, env),- };+ parameters = validatedParameters(parameters, env, inspection);+ const inputs = localInputs(parameters, env, inspection);+ const properties = parameterSchema(inspection).properties || {};+ const transfer = inputs.some(input => !input.prefix)+ || Object.entries(parameters).some(([key, value]) => {+ const property = properties[key] || properties[key.replace(/-/g, '_')];+ return fileContract(property, inspection.provider).url && typeof value === 'string' && /^https:\/\//i.test(value);+ })+ || actionTokens(inspection.action).at(-1).split(/[-_+]/).some(token => ['upload', 'download', 'import', 'export'].includes(token));+ const timeoutMs = transfer ? 10 * 60_000 : 60_000;+ const deadline = new AbortController();+ const signal = options.signal ? AbortSignal.any([options.signal, deadline.signal]) : deadline.signal;+ const timer = setTimeout(() => deadline.abort(new DOMException('Execution deadline exceeded', 'TimeoutError')), timeoutMs);+ timer.unref?.();+ // MCP progress is a liveness heartbeat during a bounded transfer, not a+ // completion percentage. Ordinary commands retain their shorter deadline.+ const heartbeat = transfer && options.onProgress ? setInterval(() => { void options.onProgress(); }, 15_000) : null;+ heartbeat?.unref?.();+ let prepared;+ try {+ prepared = await prepareLocalInputs(parameters, inspection, env, signal);+ throwIfCancelled(signal);+ const invocation = providerInvocation(validateAction(inspection.action, env), prepared.parameters, effectiveRisk, env, inspection);+ return {+ action: inspection.action,+ risk: effectiveRisk,+ result: await runOfficial(invocation, { ...options, signal, timeoutMs, ...(prepared.cwd ? { cwd: prepared.cwd } : {}) }, env),+ };+ } finally {+ clearTimeout(timer);+ clearInterval(heartbeat);+ prepared?.cleanup();+ }}async function callTool(name, args = {}, options = {}, env = process.env) {@@ -672,7 +862,19 @@ async function callTool(name, args = {}, options = {}, env = process.env) {guidance: 'Call list_capabilities again with a domain or subgroup path, then call describe_action with an exact leaf action.',};}- if (name === 'describe_action') return inspectAction(args.action, options, env);+ if (name === 'describe_action') {+ const inspection = await inspectAction(args.action, options, env);+ if (inspection.provider === 'lark') {+ for (const property of Object.values(inspection.schema.inputSchema.properties)) {+ if (fileContract(property, 'lark').localPath && typeof property.description === 'string') {+ property.description = property.description+ .replace('cwd-relative local path', 'absolute local path in Orkas-approved roots')+ .replace(' (absolute paths and .. are rejected)', '');+ }+ }+ }+ return inspection;+ }if (name === 'execute_read') return executeAction('R', args, options, env);if (name === 'execute_write') return executeAction('W', args, options, env);if (name === 'execute_high_impact') return executeAction('H', args, options, env);@@ -708,7 +910,12 @@ async function main() {server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {try {const signal = AbortSignal.any([lifetime.signal, extra.signal]);- const result = await runInOrder(() => callTool(request.params.name, request.params.arguments || {}, { signal }));+ let progress = 0;+ const progressToken = request.params._meta?.progressToken;+ const onProgress = progressToken == null ? undefined : () => extra.sendNotification({+ method: 'notifications/progress', params: { progressToken, progress: ++progress },+ }).catch(() => {});+ const result = await runInOrder(() => callTool(request.params.name, request.params.arguments || {}, { signal, onProgress }));return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };} catch (error) {return {diff --git a/bin/local-cli-permissions.cjs b/bin/local-cli-permissions.cjsnew file mode 100644index 00000000..39d96bad--- /dev/null+++ b/bin/local-cli-permissions.cjs@@ -0,0 +1,156 @@+'use strict';+const fs = require('node:fs');+const path = require('node:path');+const { randomUUID } = require('node:crypto');++// OAuth scope identifiers are case-sensitive protocol data. DingTalk uses names+// such as Contact.User.Read; preserve their spelling, including uppercase letters.+function isScopeName(value) {+ return typeof value === 'string' && /^[a-zA-Z][a-zA-Z0-9_.:-]{0,255}$/.test(value);+}++// Device-local reauthorization requests shared by official CLI providers.+// Preserve the legacy filename/profile reader; empty scope lists require an+// explicit reauthorize marker. Business calls never log in or replay themselves.+const MAX_PENDING_SCOPES = 50;+function permissionRequestPath(env) {+ return path.isAbsolute(env.ORKAS_LOCAL_CLI_RUNTIME_DIR || '') && env.ORKAS_LOCAL_CLI_PROFILE+ ? path.join(env.ORKAS_LOCAL_CLI_RUNTIME_DIR, '.orkas-user-permissions.json') : null;+}++function readPermissionRequest(env) {+ const file = permissionRequestPath(env);+ if (!file) return null;+ try {+ const stat = fs.lstatSync(file);+ if (!stat.isFile() || stat.size > 16 * 1024) return null;+ const value = JSON.parse(fs.readFileSync(file, 'utf8'));+ if (value.profile !== env.ORKAS_LOCAL_CLI_PROFILE || !Array.isArray(value.scopes)+ || (!value.scopes.length && value.reauthorize !== true) || value.scopes.length > MAX_PENDING_SCOPES+ || !value.scopes.every(isScopeName)+ || (value.pat_scopes !== undefined && (!Array.isArray(value.pat_scopes)+ || value.pat_scopes.length > MAX_PENDING_SCOPES || !value.pat_scopes.every(isScopeName)))) return null;+ return value;+ } catch { return null; }+}++function rememberPermissionRequest(error, env) {+ const failure = error?.provider_error;+ if (error?.code !== 'connector_permission_denied' && failure?.type !== 'authorization') return;+ // Only confirmed user scopes can be requested by Lark's user-login flow.+ const scopes = failure?.identity === 'user' && Array.isArray(failure.missing_scopes)+ ? failure.missing_scopes.filter(isScopeName) : [];+ const patScopes = failure?.identity === 'pat' && Array.isArray(failure.missing_scopes)+ ? failure.missing_scopes.filter(isScopeName) : [];+ const file = permissionRequestPath(env);+ if (!file) return;+ const prior = readPermissionRequest(env);+ const value = { profile: env.ORKAS_LOCAL_CLI_PROFILE, reauthorize: true, revision: randomUUID(), scopes: [...new Set([...(prior?.scopes || []), ...scopes])].sort(),+ unresolved_access: prior?.unresolved_access === true || (scopes.length === 0 && patScopes.length === 0) };+ if (patScopes.length || prior?.pat_scopes?.length) value.pat_scopes = [...new Set([...(prior?.pat_scopes || []), ...patScopes])].sort();+ if (failure?.admin_required || prior?.admin_required) value.admin_required = true;+ // A large provider scope list must not suppress the recovery entry. Use the+ // normal authorization flow when an explicit request exceeds this bound.+ if (value.scopes.length > MAX_PENDING_SCOPES) value.scopes = [];+ if (value.pat_scopes?.length > MAX_PENDING_SCOPES) { value.pat_scopes = []; value.unresolved_access = true; }+ if (value.scopes.length + (value.pat_scopes?.length || 0) > MAX_PENDING_SCOPES) {+ value.scopes = []; value.pat_scopes = []; value.unresolved_access = true;+ }+ if (writePermissionRequest(file, value) && failure) failure.recovery = 'reauthorize';+}++function writePermissionRequest(file, value) {+ const temp = `${file}.${process.pid}.tmp`;+ try {+ fs.writeFileSync(temp, JSON.stringify(value), { mode: 0o600, flag: 'wx' });+ fs.renameSync(temp, file);+ return true;+ } catch {+ // Preserve the provider failure when local persistence is unavailable.+ } finally {+ try { fs.unlinkSync(temp); } catch { /* no temporary request remains */ }+ }+}++// A token-scope check cannot establish resource visibility or administrator access.+// Do not overwrite a newer business denial observed while the check was running.+function recordUserScopeCheck(env, granted, expected, required) {+ if (!Array.isArray(granted) || !granted.every(isScopeName)) return;+ if (JSON.stringify(readPermissionRequest(env)) !== JSON.stringify(expected)) return;+ const scopes = [...new Set([...(expected?.scopes || []), ...required])].filter(scope => !granted.includes(scope)).sort();+ const unresolved = expected?.unresolved_access === true || (expected && !expected.scopes.length);+ if (!scopes.length && !unresolved) {+ clearPermissionRequest(env, expected);+ return;+ }+ const file = permissionRequestPath(env);+ if (!file || (expected && JSON.stringify(expected.scopes) === JSON.stringify(scopes))) return;+ writePermissionRequest(file, { profile: env.ORKAS_LOCAL_CLI_PROFILE, reauthorize: true,+ revision: randomUUID(), scopes: scopes.length > MAX_PENDING_SCOPES ? [] : scopes,+ unresolved_access: !!unresolved || scopes.length > MAX_PENDING_SCOPES });+}++function clearPermissionRequest(env, expected) {+ const current = readPermissionRequest(env);+ if (current && JSON.stringify(current) === JSON.stringify(expected)) fs.unlinkSync(permissionRequestPath(env));+}++function recordPatScopeGrant(env, expected, granted) {+ if (JSON.stringify(readPermissionRequest(env)) !== JSON.stringify(expected)) return;+ const remaining = (expected.pat_scopes || []).filter(scope => !granted.includes(scope));+ if (!remaining.length && !expected.scopes.length && !expected.unresolved_access) {+ clearPermissionRequest(env, expected);+ } else {+ writePermissionRequest(permissionRequestPath(env), { ...expected, pat_scopes: remaining, revision: randomUUID() });+ }+}+++// Inspect only failed protocol envelopes, never business data or error prose.+function structuredPermissionFailure(result, provider) {+ if (result.error) return null;+ const denied = new Set(['authorization', 'permission', 'permission_denied', 'insufficient_scope',+ 'missing_scope', 'token_scope_insufficient', 'app_scope_not_applied', 'access_denied', 'forbidden',+ 'http_403', 'AuthError', 'PermissionError']);+ let found = false;+ let detail = {};+ for (const stream of [result.stderr, result.stdout]) {+ let payload;+ try { payload = JSON.parse(stream); } catch { continue; }+ if (!payload || typeof payload !== 'object' || Array.isArray(payload)) continue;+ // DWS 1.0.61 also emits its frozen PAT permission channel without an+ // error wrapper. Do not inspect arbitrary data or authorization URLs.+ if (provider === 'dingtalk' && payload.success === false && [+ 'PAT_NO_PERMISSION', 'PAT_LOW_RISK_NO_PERMISSION', 'PAT_MEDIUM_RISK_NO_PERMISSION',+ 'PAT_HIGH_RISK_NO_PERMISSION', 'PAT_ORG_POLICY_DENIED', 'PAT_SCOPE_AUTH_REQUIRED', 'PAT_BATCH_AUTH_PENDING',+ ].includes(payload.code)) {+ found = true;+ const oauth = payload.code === 'PAT_SCOPE_AUTH_REQUIRED';+ const data = payload.data;+ const candidates = oauth ? [data?.missingScope] : [data?.scope, ...(Array.isArray(data?.scopes) ? data.scopes : [])];+ // The OAuth channel includes the affected identity; its code alone does+ // not establish that user consent can grant this permission.+ const identity = oauth ? (['user', 'bot', 'tenant'].includes(data?.identity) ? data.identity : undefined) : 'pat';+ detail = { ...(identity ? { identity } : {}), missing_scopes: [...new Set(candidates.filter(isScopeName))],+ ...(payload.code === 'PAT_ORG_POLICY_DENIED' ? { admin_required: true } : {}) };+ break;+ }+ const body = payload.error;+ if (!body || typeof body !== 'object' || Array.isArray(body)) continue;+ if (payload.ok === true || payload.success === true) continue;+ if (result.status === 0 && payload.ok !== false && payload.success !== false && payload.outcome !== 'failure') continue;+ found = [body.type, body.subtype, body.code].some(value => denied.has(value))+ || body.http_status === 403 || body.statusCode === 403;+ // Xero 0.0.7 sanitizes API responses into this fixed status-bearing format.+ if (provider === 'xero' && /^Xero API error \(403\)(?::|$)/.test(body.message || '')) found = true;+ if (found) break;+ }+ if (!found && provider === 'xero' && result.status !== 0) {+ found = /^(?:\s*Error:\s*)?Xero API error \(403\)(?::|\s*$)/m.test(result.stderr || '');+ }+ return found ? Object.assign(new Error('connector permission is insufficient; reauthorize this connector'), {+ code: 'connector_permission_denied', provider_error: { type: 'authorization', ...detail },+ }) : null;+}++module.exports = { isScopeName, readPermissionRequest, rememberPermissionRequest, clearPermissionRequest, recordUserScopeCheck, recordPatScopeGrant, structuredPermissionFailure };diff --git a/bin/native-package-gate.cjs b/bin/native-package-gate.cjsindex 192a530b..1a7df0e3 100644--- a/bin/native-package-gate.cjs+++ b/bin/native-package-gate.cjs@@ -67,6 +67,60 @@ function onnxRuntimePackage(nodeModules) {};}+// Shared by preparation, early archive preflight, afterPack and final validation.+// The first companion candidate is the current build requirement; remaining+// candidates preserve validation of older release artifacts.+function sharpNativeContract(platform, arch) {+ if (!TARGETS.has(targetKey(platform, arch))) {+ throw new Error(`[native-package-gate] unsupported Sharp target: ${platform}-${arch}`);+ }+ const mac = platform === 'darwin';+ const specs = [+ {+ id: 'sharp-binding',+ candidates: mac+ ? [+ `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}-0.35.4.node`,+ `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}-0.35.3.node`,+ `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}.node`,+ ]+ : [+ '@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.4.node',+ '@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.3.node',+ '@img/sharp-win32-x64/lib/sharp-win32-x64.node',+ ],+ },+ {+ id: 'sharp-libvips-cpp',+ candidates: mac+ ? [+ `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.18.6.dylib`,+ `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.18.3.dylib`,+ `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.17.3.dylib`,+ ]+ : [+ '@img/sharp-win32-x64/lib/libvips-cpp-8.18.6.dll',+ '@img/sharp-win32-x64/lib/libvips-cpp-8.18.3.dll',+ '@img/sharp-win32-x64/lib/libvips-cpp-8.17.3.dll',+ ],+ },+ ];+ if (!mac) specs.push({ id: 'sharp-libvips', candidates: ['@img/sharp-win32-x64/lib/libvips-42.dll'] });+ return specs;+}++function sharpPreparationFiles(platform, arch, version) {+ const specs = sharpNativeContract(platform, arch);+ if (!/^\d+\.\d+\.\d+$/.test(String(version || ''))) {+ throw new Error('[native-package-gate] missing concrete locked Sharp version');+ }+ return {+ binding: `@img/sharp-${platform}-${arch}/lib/sharp-${platform}-${arch}-${version}.node`,+ cpp: specs.find(spec => spec.id === 'sharp-libvips-cpp').candidates[0],+ ...(platform === 'win32' ? { libvips: specs.find(spec => spec.id === 'sharp-libvips').candidates[0] } : {}),+ };+}+function nativePackageContract(nodeModules, platform, arch) {const key = targetKey(platform, arch);if (!TARGETS.has(key)) {@@ -117,40 +171,11 @@ function nativePackageContract(nodeModules, platform, arch) {id: 'onnxruntime-core',candidates: [joinRelative(onnxBase, mac ? `libonnxruntime.${onnxVersion}.dylib` : 'onnxruntime.dll')],},- {- id: 'sharp-binding',- candidates: mac- ? [- `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}-0.35.4.node`,- `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}-0.35.3.node`,- `@img/sharp-darwin-${arch}/lib/sharp-darwin-${arch}.node`,- ]- : [- '@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.4.node',- '@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.3.node',- '@img/sharp-win32-x64/lib/sharp-win32-x64.node',- ],- },- {- id: 'sharp-libvips-cpp',- candidates: mac- ? [- `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.18.6.dylib`,- `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.18.3.dylib`,- `@img/sharp-libvips-darwin-${arch}/lib/libvips-cpp.8.17.3.dylib`,- ]- : [- '@img/sharp-win32-x64/lib/libvips-cpp-8.18.6.dll',- '@img/sharp-win32-x64/lib/libvips-cpp-8.18.3.dll',- '@img/sharp-win32-x64/lib/libvips-cpp-8.17.3.dll',- ],- },+ ...sharpNativeContract(platform, arch),];if (mac) {specs.push({ id: 'fsevents', candidates: ['fsevents/fsevents.node'] });- } else {- specs.push({ id: 'sharp-libvips', candidates: ['@img/sharp-win32-x64/lib/libvips-42.dll'] });}return specs;}@@ -233,6 +258,9 @@ module.exports = {TARGETS,collectNativePayloadFiles,nativePackageContract,+ sharpNativeContract,+ sharpPreparationFiles,+ isNativePayloadFile,requiredNativeVerificationEntries,targetKey,verifyNativePackagePayload,diff --git a/bin/packaged-entrypoint-gate.cjs b/bin/packaged-entrypoint-gate.cjsindex 6e51d5dd..8421716f 100644--- a/bin/packaged-entrypoint-gate.cjs+++ b/bin/packaged-entrypoint-gate.cjs@@ -117,6 +117,7 @@ const PACKAGED_BIN_HELPERS = Object.freeze(['gmail-mcp-server.cjs',// Lark CLI shortcut contract required by local-cli-mcp-server.cjs.'local-cli-lark.cjs',+ 'local-cli-permissions.cjs','commerce-request-context.cjs','ebay-signature.cjs','shopify-setup-requirements.cjs',diff --git a/docs/test/connectors-regression.md b/docs/test/connectors-regression.mdindex 57b4ff60..49af0556 100644--- a/docs/test/connectors-regression.md+++ b/docs/test/connectors-regression.md@@ -32,3 +32,46 @@ Use isolated local data and authorized test accounts. Deterministic fixtures est## Owning evidenceRun the existing connector catalog, local API, direct-commerce adapter, manager, registry, OAuth and renderer suites through `npm run test:js`. Run `npm run test:e2e:typecheck` before `npm run test:e2e -- test/e2e/connectors_e2e_validation.spec.ts`. These checks use local fixtures and do not claim all remote services are currently reachable.++## September 10 shared connector update++### Partial-permission acceptance matrix++The oracle is usable granted operations plus accurate recovery state, not merely+a successful login or a green transport. Exercise these journeys independently:++| Journey / initial state | Stimulus and required observation | Owning evidence |+| --- | --- | --- |+| First connection, verified identity with partial business access | Keep Use and Reauthorize together; an unverified/expired identity cannot establish a new connection. | `manager.test.ts`, `local-cli-files.test.ts`, `connectors-degraded-card.test.ts` |+| Connected account, one operation denied | Preserve the failed operation's error, expose only validated scope identifiers, then complete a different granted read on the same connection; no login or replay. Cover Feishu user/bot, DingTalk OAuth/PAT/admin, WeCom and Xero. | `local-cli-files.test.ts`, `manager.test.ts`, `local-cli_e2e_permissions.test.ts`, `local-cli_e2e_attachment.test.ts` |+| Error-shaped business data or unavailable provider | Success payloads, nested permission text, local-file errors, malformed JSON and timeouts must not manufacture a permission request. | `local-cli-files.test.ts` |+| Lark incremental consent | Request old grants plus missing user scopes; cancellation, absent grant, unknown resource/bot access and a newer denial retain recovery. A successful scope check clears only proven scope deficiencies. | `local-cli-files.test.ts` |+| DingTalk PAT incremental consent | Cover new/already-granted receipts, partial grants followed by retry, malformed/failed receipts, case-sensitive identifiers, mixed OAuth/PAT and changed administrator policy. Only acknowledged PAT scopes disappear. | `local-cli-files.test.ts` |+| WeCom or DingTalk identity-only login | Do not equate identity success with business access. Preserve the existing connection and permission notice after cancellation or unverifiable recovery. | `local-cli-files.test.ts`, `manager.test.ts` |+| Concurrent recovery and device-local persistence | An old check/grant cannot clear a newer denial, including the same scope denied again; profiles and providers remain isolated. Malformed/oversized/symlink state and failed writes do not leak or replace provider errors. | `local-cli-files.test.ts`, `local-cli.test.ts` |+| Page entry, refresh, account switch | Listing is read-only; page checks coalesce for one minute; explicit refresh/consent completion rechecks. Switching accounts/disconnecting aborts pending checks. No startup/timer login. | `local-cli.test.ts`, `ipc/connectors.test.ts`, `connectors-render-cache.test.ts` |+| Card action and recovery | Use stays available, Reauthorize is explicit, known names are localized, unknown identifiers render as text, and the notice disappears only after verified recovery. Preserve selected tools. | `connectors-degraded-card.test.ts`, `manager.test.ts` |++Real-account canaries (macOS and Windows) remain required for each provider:+start with verified identity plus one denied capability; perform one allowed read,+cancel reauthorization, repeat the allowed read, then grant the capability and+explicitly retry the denied operation once. Verify old grants and tool selections+survive, other accounts/devices are untouched, and inspect logs for duplicate+operations, unexpected browsers, sensitive output and leftover CLI processes.+Use test recipients and reversible writes only. Repeat administrator/visibility+denials before and after the administrator changes access; never report a user+login alone as proof of that change.++DingTalk OAuth incremental consent is an **open implementation and acceptance+gap**: require a real scope-bearing request, provider-confirmed union of old/new+grants, cancellation/partial-consent recovery, and a successful explicit operation+retry. The pinned DWS 1.0.61 login does not implement that request. Local identity+fixtures and PAT grant tests do not satisfy this gate. WeCom business-permission+verification likewise needs provider evidence beyond `identity whoami`.+++| Confirm a high-impact/destructive operation | The existing title is retained; the visible body shows the connector and operation identifier. First-party CLI/direct API execution lanes use the singular `action` parameter; other tools use their actual tool name. Only redacted parameters appear in the expandable details, collapsed by default; account, risk, tool metadata and explanatory notes are omitted. Allow once affects only that call. Allow for this task covers every action for the same connector account, including deletion, without changing global permissions; other tasks/accounts/connectors still ask. Concurrent prompts covered by the grant close as approved. Completion, stop, account switch and connector replacement/removal revoke the grant. | `action-confirm.test.ts`, `registry.test.ts`, `bash-permission.test.ts`, `bus-integration.test.ts`, `connectors_e2e_validation.spec.ts` |++6. Feishu/Lark authorization opens only structurally validated HTTPS URLs on exact official hosts and authorization routes; provider prose does not determine success. A successful automatic browser launch keeps the interactive terminal hidden; show manual recovery only if opening fails, the CLI requests input, or authorization fails. Fixed domains must remain a subset accepted by the pinned CLI auth login command. Reuse a pending attempt for the same account and catalog id. Any confirmed permission failure from an official CLI offers **Reauthorize**, regardless of business operation, identity or availability of scope metadata. Structured failure envelopes and pinned provider status protocols drive this state; successful business data, arbitrary prose and transport failures do not. Clicking starts the applicable authorization flow even with a valid old login. DingTalk retains structured missing OAuth and PAT scope identifiers. PAT recovery grants only the missing scopes and requires a structured granted/already-granted receipt; plain login success never clears PAT, unknown-access or administrator denials. WeCom identity-only reauthorization also retains the permission notice; it must not imply that business access was restored. Known DingTalk PAT scopes may be retried after an administrator changes policy; cached policy denials must not permanently block recovery. The pinned DWS 1.0.61 login does not implement incremental OAuth scope requests, so those deficiencies remain visible after login. Lark requests confirmed missing user scopes explicitly and retains existing granted scopes (including unprefixed OAuth scopes); unknown or bot scopes use the normal provider flow without inventing user scopes. Selected tools remain unchanged. On Connectors-page entry, inspect verified Lark user scopes for message sending and previously reported missing scopes, even when its transport is live. Repeated opens within one minute reuse the check; explicit refresh and completed authorization check again. There is no startup or timer scan. For Feishu/Lark, DingTalk and WeCom, a failed business operation or a cancelled/failed reauthorization leaves other authorized operations usable without replaying the failure. A missing scope adds a concise advisory card notice (localized names for known scopes, identifiers for other reported scopes, a generic notice if absent) and Reauthorize alongside Use; it never disables the whole connector. Unavailable checks retain prior evidence, confirmed grants clear only scope deficiencies, and resource/admin denials remain unresolved. Disconnect or account switch cancels an in-flight check. Cancellation or failed grant verification retains recovery; success clears only the request handled by that attempt. Newer denials remain recoverable. Bot visibility and administrator-owned permission failures also offer reauthorization, without claiming user consent can grant administrator access. No failed business action is replayed automatically.++11. Reject credentials, config/profile overrides, output paths, raw flags, excess parameters, outside files and symlink escapes. Approved local inputs must exist as absolute paths with a realpath inside Orkas-approved roots. Identify file carriers from the pinned provider parameter contract, preserving literal text and file arrays. Prepare private, per-call copies for CLI uploads and declared @file inputs, preserving bytes and filenames; serialize Lark native binary carriers as key=value and preserve WeCom media_id objects. Clean staging after success, failure or cancellation, and reject changed/non-regular sources before sending. Preserve Xero full-JSON destructive-status inspection. Use 60s execution deadlines for ordinary commands and 10min for transfers including staging; only active transfers emit periodic progress to extend the 90s MCP inactivity window, with a 13min total bound. Cancellation must stop descendant processes and must not replay an operation. Network file inputs require HTTPS; bound and sanitize provider output.diff --git a/scripts/codesign-adhoc.cjs b/scripts/codesign-adhoc.cjsindex a2e4ae09..f8f980e0 100644--- a/scripts/codesign-adhoc.cjs+++ b/scripts/codesign-adhoc.cjs@@ -14,7 +14,7 @@const { execSync } = require('node:child_process');const fs = require('node:fs');const path = require('node:path');-const { verifyNativePackagePayload } = require('../bin/native-package-gate.cjs');+const { verifyNativePackagePayload, sharpPreparationFiles } = require('../bin/native-package-gate.cjs');const {verifyRuntimeRoot,verifyWindowsVcAppLocalFiles,@@ -352,14 +352,6 @@ function verifyPackedNativePayload(nodeModules, targetPlatform, targetArch) {`${tokenizersPackage} binary`,path.join(tokenizersPackageDir(nodeModules, tokenizersPackage), 'tokenizers.darwin-universal.node'),);- requiredFile(- `${sharpPackages.binding} binding`,- path.join(packageDir(nodeModules, `@img/${sharpPackages.binding}`), 'lib', `sharp-darwin-${targetArch}-${sharpVersion}.node`),- );- requiredFile(- `${sharpPackages.libvips} runtime`,- path.join(packageDir(nodeModules, `@img/${sharpPackages.libvips}`), 'lib', 'libvips-cpp.8.18.6.dylib'),- );} else if (targetPlatform === 'win32') {requiredFile(`${esbuildPackage} binary`,@@ -377,18 +369,10 @@ function verifyPackedNativePayload(nodeModules, targetPlatform, targetArch) {`${tokenizersPackage} binary`,path.join(tokenizersPackageDir(nodeModules, tokenizersPackage), 'tokenizers.win32-x64-msvc.node'),);- requiredFile(- `${sharpPackages.binding} binding`,- path.join(packageDir(nodeModules, `@img/${sharpPackages.binding}`), 'lib', `sharp-win32-x64-${sharpVersion}.node`),- );- requiredFile(- `${sharpPackages.binding} libvips C++ runtime`,- path.join(packageDir(nodeModules, `@img/${sharpPackages.binding}`), 'lib', 'libvips-cpp-8.18.6.dll'),- );- requiredFile(- `${sharpPackages.binding} libvips runtime`,- path.join(packageDir(nodeModules, `@img/${sharpPackages.binding}`), 'lib', 'libvips-42.dll'),- );+ }++ for (const [kind, relativeFile] of Object.entries(sharpPreparationFiles(targetPlatform, targetArch, sharpVersion))) {+ requiredFile(`sharp ${kind}`, path.join(nodeModules, relativeFile));}requiredFile(diff --git a/scripts/prepare-mac-native-deps.cjs b/scripts/prepare-mac-native-deps.cjsindex 5cbcf933..e7e74a18 100644--- a/scripts/prepare-mac-native-deps.cjs+++ b/scripts/prepare-mac-native-deps.cjs@@ -4,6 +4,7 @@ const { spawnSync } = require('node:child_process');const fs = require('node:fs');const os = require('node:os');const path = require('node:path');+const { sharpPreparationFiles } = require('../bin/native-package-gate.cjs');const {ensureFile,isMachArch,@@ -108,6 +109,7 @@ function expectedState(targetArch) {scriptHashes: scriptHashes({prepareMacNativeDeps: __filename,nativePrepareCache: CACHE_HELPER,+ nativePackageGate: require.resolve('../bin/native-package-gate.cjs'),}),packages: {[`@esbuild/darwin-${targetArch}`]: readLockPackage(LOCK_FILE, `@esbuild/darwin-${targetArch}`),@@ -137,12 +139,13 @@ function main() {const state = expectedState(targetArch);const sharpVersion = state.packages[`@img/sharp-darwin-${targetArch}`];+ const sharpFiles = sharpPreparationFiles('darwin', targetArch, sharpVersion);const required = {esbuild: path.join(PC_DIR, 'node_modules', '@esbuild', `darwin-${targetArch}`, 'bin', 'esbuild'),sqliteVec: path.join(PC_DIR, 'node_modules', `sqlite-vec-darwin-${targetArch}`, 'vec0.dylib'),canvas: path.join(PC_DIR, 'node_modules', '@napi-rs', `canvas-darwin-${targetArch}`, `skia.darwin-${targetArch}.node`),- sharp: path.join(PC_DIR, 'node_modules', '@img', `sharp-darwin-${targetArch}`, 'lib', `sharp-darwin-${targetArch}-${sharpVersion}.node`),- sharpVips: path.join(PC_DIR, 'node_modules', '@img', `sharp-libvips-darwin-${targetArch}`, 'lib', 'libvips-cpp.8.18.6.dylib'),+ sharp: path.join(PC_DIR, 'node_modules', sharpFiles.binding),+ sharpVips: path.join(PC_DIR, 'node_modules', sharpFiles.cpp),};const requiredFiles = Object.values(required);const targetFilesMatch = () => requiredFiles.every((file) => isMachArch(file, targetArch));diff --git a/scripts/prepare-win-native-deps.cjs b/scripts/prepare-win-native-deps.cjsindex e354859a..53430369 100644--- a/scripts/prepare-win-native-deps.cjs+++ b/scripts/prepare-win-native-deps.cjs@@ -4,6 +4,7 @@ const { spawnSync } = require('node:child_process');const fs = require('node:fs');const os = require('node:os');const path = require('node:path');+const { sharpPreparationFiles } = require('../bin/native-package-gate.cjs');const {ensureFile,isPeX64,@@ -123,6 +124,7 @@ function expectedState(electronVersion) {scriptHashes: scriptHashes({prepareWinNativeDeps: __filename,nativePrepareCache: CACHE_HELPER,+ nativePackageGate: require.resolve('../bin/native-package-gate.cjs'),}),packages: {'@esbuild/win32-x64': readLockPackage(LOCK_FILE, '@esbuild/win32-x64'),@@ -154,6 +156,7 @@ function main() {const electronVersion = readElectronVersion(PC_DIR);const state = expectedState(electronVersion);const sharpVersion = state.packages['@img/sharp-win32-x64'];+ const sharpFiles = sharpPreparationFiles('win32', 'x64', sharpVersion);const sqliteVecDir = path.join(PC_DIR, 'node_modules', 'sqlite-vec');const betterSqliteDir = path.join(PC_DIR, 'node_modules', 'better-sqlite3');const betterSqliteBinary = path.join(betterSqliteDir, 'build', 'Release', 'better_sqlite3.node');@@ -163,9 +166,9 @@ function main() {betterSqlite: betterSqliteBinary,canvas: path.join(PC_DIR, 'node_modules', '@napi-rs', 'canvas-win32-x64-msvc', 'skia.win32-x64-msvc.node'),tokenizers: path.join(PC_DIR, 'node_modules', '@anush008', 'tokenizers-win32-x64-msvc', 'tokenizers.win32-x64-msvc.node'),- sharp: path.join(PC_DIR, 'node_modules', '@img', 'sharp-win32-x64', 'lib', `sharp-win32-x64-${sharpVersion}.node`),- sharpVipsCpp: path.join(PC_DIR, 'node_modules', '@img', 'sharp-win32-x64', 'lib', 'libvips-cpp-8.18.6.dll'),- sharpVips: path.join(PC_DIR, 'node_modules', '@img', 'sharp-win32-x64', 'lib', 'libvips-42.dll'),+ sharp: path.join(PC_DIR, 'node_modules', sharpFiles.binding),+ sharpVipsCpp: path.join(PC_DIR, 'node_modules', sharpFiles.cpp),+ sharpVips: path.join(PC_DIR, 'node_modules', sharpFiles.libvips),};if (!fs.existsSync(sqliteVecDir) || !fs.statSync(sqliteVecDir).isDirectory()) {diff --git a/src/main/features/chats.ts b/src/main/features/chats.tsindex cdcd566f..c2b5c550 100644--- a/src/main/features/chats.ts+++ b/src/main/features/chats.ts@@ -24,6 +24,7 @@ import { createHash, randomUUID } from 'node:crypto';import {userChatsDir, userLocalConfigDir, projectChatsDir, projectChatIndexFile,userConversationTurnIndexPath, WS_ROOT,+ localCliDirectoryFile,} from '../paths';import {conversationLayout,@@ -38,6 +39,7 @@ import {nowIso, genConversationId, genId12, safeId,readJson, writeJson, invalidateLineCount, readJsonl, readJsonlPage, readJsonlWindow, appendJsonlAtomic,} from '../storage';+import { removeCodingDirectory } from './local_agents/project-directory';import { createLogger } from '../logger';import { logErrorSummary, logPathRef, maskId } from '../util/log-redact';import { t } from '../i18n';@@ -232,7 +234,8 @@ async function _messageDisplayContext(} catch (err) {log.warn(`resolve workspace for legacy Codex output cid=${maskId(cid)}: ${(err as Error).message}`);}- const stamp = JSON.stringify([layout.stateFile, _fileStamp(layout.stateFile), workspaceRoot]);+ const stamp = JSON.stringify([layout.stateFile, _fileStamp(layout.stateFile),+ _fileStamp(localCliDirectoryFile(userId, cid)), workspaceRoot]);const remembered = _messageDisplayContextMemo.get(memoKey);if (remembered && remembered.stamp === stamp) return remembered.context;const context = await _computeMessageDisplayContext(userId, cid, layout, workspaceRoot);@@ -2195,6 +2198,7 @@ async function _purgeDeletedConversationFiles(userId: string, cid: string, remov}} catch (err) { log.warn(`purge cli sessions user=${userId} cid=${cid}: ${(err as Error).message}`); }+ removeCodingDirectory(userId, cid);log.info(`deleted user=${userId} cid=${cid}`);}diff --git a/src/main/features/connectors/action_confirm.ts b/src/main/features/connectors/action_confirm.tsindex d21a4362..a0c3f1dc 100644--- a/src/main/features/connectors/action_confirm.ts+++ b/src/main/features/connectors/action_confirm.ts@@ -1,8 +1,9 @@/** Host-owned confirmation gate for one sensitive connector action.** Sensitive actions use the account's operation permission mode. Approval- * modes wait for one exact-action decision; trusted mode executes without a- * dialog. Connector availability and prohibited actions are separate gates.+ * modes accept a one-time or task-scoped connector-account decision; trusted+ * mode executes without a dialog. Connector availability and prohibited actions+ * are separate gates.*/import * as crypto from 'node:crypto';@@ -11,6 +12,8 @@ import { createLogger } from '../../logger';import { getLocalExecMode } from '../permissions';import { getActiveUserId } from '../users';import { registerUserSwitchHook } from '../user-switch-hooks';+import { findCatalogEntry } from './catalog';+import type { ConnectorInstance } from './types';const log = createLogger('connector-action-confirm');const RESPONSE_TIMEOUT_MS = 10 * 60 * 1000;@@ -25,22 +28,45 @@ export interface ActionConfirmInfo {display_name: string;account_label: string;tool_name: string;+ action_name: string;risk: 'H' | 'D';sensitive_operation: string;arguments_preview: string;cid: string;+ can_allow_run: boolean;}-interface Pending {+interface GrantScope {uid: string;+ cid: string;+ connectorId: string;+ accountLabel: string;+ accountKey: string;+}++interface Pending extends GrantScope {heartbeat?: NodeJS.Timeout;resolve: (approved: boolean) => void;timer: NodeJS.Timeout;- cid: string;removeAbortListener?: () => void;}const _pending = new Map<string, Pending>();+// One connection slot owns one account. Registry replacement/removal invalidates+// these grants, including local CLI accounts with no display label or OAuth id.+const _taskGrants = new Map<string, GrantScope>();++function grantKey(scope: GrantScope): string {+ return JSON.stringify([scope.uid, scope.cid, scope.connectorId, scope.accountLabel, scope.accountKey]);+}++/** Stable host-owned identity, unaffected by token refresh or tool-cache updates.+ * Registry replacement additionally revokes local CLI grants without account ids.+ */+export function connectorAccountKey(instance: ConnectorInstance): string {+ return JSON.stringify([instance.created_at, instance.composio_grant?.connection_id,+ instance.oauth_grant?.server_grant_id, instance.connection_parameters]);+}let _broadcastOverride: ((channel: string, payload: unknown) => void | boolean) | null = null;export function _setBroadcastForTest(fn: ((channel: string, payload: unknown) => void | boolean) | null): void {@@ -91,6 +117,18 @@ export function previewArguments(argumentsValue: Record<string, unknown>): strin: preview;}+function actionName(connectorId: string, toolName: string, args: Record<string, unknown>): string {+ const entry = findCatalogEntry(connectorId);+ // First-party CLI and direct API adapters dispatch these lanes by `action`.+ // Other MCP tools may have unrelated action/actions parameters: keep their tool name.+ if ((entry?.auth_mode === 'local_cli' || entry?.auth_mode === 'local_api')+ && ['execute_high_impact', 'execute_destructive'].includes(toolName)+ && typeof args.action === 'string' && args.action.trim()) {+ return _previewValue(args.action.trim()) as string;+ }+ return toolName;+}+function _settle(requestId: string, approved: boolean): boolean {const pending = _pending.get(requestId);if (!pending) return false;@@ -109,6 +147,7 @@ export async function requestActionConfirm(opts: {connectorId: string;displayName: string;accountLabel?: string;+ accountKey?: string;toolName: string;risk: 'H' | 'D';sensitiveOperation?: string;@@ -119,6 +158,11 @@ export async function requestActionConfirm(opts: {const uid = opts.userId || getActiveUserId();if (uid !== getActiveUserId()) return false;if (getLocalExecMode() === 'all_files_auto') return true;+ const scope: GrantScope = {+ uid, cid: opts.cid || '', connectorId: opts.connectorId, accountLabel: opts.accountLabel || '',+ accountKey: opts.accountKey || '',+ };+ if (scope.cid && _taskGrants.has(grantKey(scope))) return true;const requestId = crypto.randomBytes(12).toString('hex');const info: ActionConfirmInfo = {request_id: requestId,@@ -126,10 +170,12 @@ export async function requestActionConfirm(opts: {display_name: opts.displayName,account_label: opts.accountLabel || '',tool_name: opts.toolName,+ action_name: actionName(opts.connectorId, opts.toolName, opts.args),risk: opts.risk,sensitive_operation: opts.sensitiveOperation || '',arguments_preview: previewArguments(opts.args),- cid: opts.cid || '',+ cid: scope.cid,+ can_allow_run: !!scope.cid,};return new Promise<boolean>((resolve) => {const timer = setTimeout(() => {@@ -141,7 +187,7 @@ export async function requestActionConfirm(opts: {_broadcast('connectors:action-confirm-cancelled', { request_ids: [requestId], cid: info.cid });}, RESPONSE_TIMEOUT_MS);timer.unref?.();- const pending: Pending = { uid, resolve, timer, cid: info.cid };+ const pending: Pending = { ...scope, resolve, timer };if (opts.signal) {const abort = () => {if (!_settle(requestId, false)) return;@@ -173,29 +219,54 @@ export async function requestActionConfirm(opts: {});}-export function respond(requestId: string, approved: boolean): boolean {- if (_pending.get(requestId)?.uid !== getActiveUserId()) return false;- return _settle(requestId, approved);+export function respond(requestId: string, approved: boolean, scope: 'once' | 'task' = 'once'): boolean {+ const pending = _pending.get(requestId);+ if (!pending || pending.uid !== getActiveUserId()) return false;+ if (!approved || scope === 'once') return _settle(requestId, approved);+ if (scope !== 'task' || !pending.cid) return false;+ const key = grantKey(pending);+ _taskGrants.set(key, {+ uid: pending.uid, cid: pending.cid, connectorId: pending.connectorId,+ accountLabel: pending.accountLabel, accountKey: pending.accountKey,+ });+ _settle(requestId, true);+ // Concurrent callers may already be waiting in the renderer queue. Resolve+ // them under the same grant and dismiss their stale dialogs as approved.+ const requestIds: string[] = [];+ for (const [id, other] of _pending) {+ if (grantKey(other) !== key) continue;+ requestIds.push(id);+ _settle(id, true);+ }+ if (requestIds.length) {+ _broadcast('connectors:action-confirm-cancelled', { request_ids: requestIds, cid: pending.cid, approved: true });+ }+ return true;}-export function cancelForCid(cid: string): void {+function cancelMatching(matches: (scope: GrantScope) => boolean, context: { cid?: string } = {}): void {+ for (const [key, grant] of _taskGrants) {+ if (matches(grant)) _taskGrants.delete(key);+ }const requestIds: string[] = [];for (const [requestId, pending] of _pending) {- if (pending.cid !== cid) continue;+ if (!matches(pending)) continue;requestIds.push(requestId);_settle(requestId, false);}if (requestIds.length) {- _broadcast('connectors:action-confirm-cancelled', { request_ids: requestIds, cid });+ _broadcast('connectors:action-confirm-cancelled', { request_ids: requestIds, ...context });}}+export function cancelForCid(cid: string): void {+ cancelMatching((scope) => scope.cid === cid, { cid });+}++export function cancelForConnector(uid: string, connectorId: string): void {+ cancelMatching((scope) => scope.uid === uid && scope.connectorId === connectorId);+}+registerUserSwitchHook('connector-action-confirm', (previousUid) => {- const requestIds: string[] = [];- for (const [requestId, pending] of _pending) {- if (pending.uid !== previousUid) continue;- requestIds.push(requestId);- _settle(requestId, false);- }- if (requestIds.length) _broadcast('connectors:action-confirm-cancelled', { request_ids: requestIds });+ cancelMatching((scope) => scope.uid === previousUid);});diff --git a/src/main/features/connectors/catalog-direct-commerce-brand-icons.ts b/src/main/features/connectors/catalog-direct-commerce-brand-icons.tsindex 1c56e2df..97ee3c34 100644--- a/src/main/features/connectors/catalog-direct-commerce-brand-icons.ts+++ b/src/main/features/connectors/catalog-direct-commerce-brand-icons.ts@@ -2,7 +2,8 @@export const XIAOHONGSHU_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="100%" height="100%" shape-rendering="crispEdges"><path fill="#FF2741" fill-opacity="0.14902" d="M1 0h1v1H1zM30 0h1v1H30zM0 1h1v1H0zM31 1h1v1H31zM0 30h1v1H0zM31 30h1v1H31zM1 31h1v1H1zM30 31h1v1H30z"/><path fill="#FF2741" fill-opacity="0.678431" d="M2 0h1v1H2zM29 0h1v1H29zM0 2h1v1H0zM31 2h1v1H31zM0 29h1v1H0zM31 29h1v1H31zM2 31h1v1H2zM29 31h1v1H29z"/><path fill="#FF2741" fill-opacity="0.945098" d="M3 0h1v1H3zM28 0h1v1H28zM0 3h1v1H0zM31 3h1v1H31zM0 28h1v1H0zM31 28h1v1H31zM3 31h1v1H3zM28 31h1v1H28z"/><path fill="#FF2741" d="M4 0h24v1H4zM2 1h28v1H2zM1 2h30v1H1zM1 3h30v1H1zM0 4h32v1H0zM0 5h32v1H0zM0 6h32v1H0zM0 7h32v1H0zM0 8h32v1H0zM0 9h32v1H0zM0 10h32v1H0zM0 11h5v1H0zM8 11h5v1H8zM27 11h1v1H27zM30 11h2v1H30zM0 12h5v1H0zM8 12h4v1H8zM15 12h1v1H15zM30 12h2v1H30zM0 13h2v1H0zM8 13h1v1H8zM11 13h1v1H11zM30 13h2v1H30zM0 14h2v1H0zM8 14h1v1H8zM16 14h1v1H16zM20 14h3v1H20zM28 14h4v1H28zM0 15h2v1H0zM8 15h1v1H8zM16 15h1v1H16zM20 15h1v1H20zM30 15h2v1H30zM0 16h2v1H0zM8 16h1v1H8zM16 16h1v1H16zM20 16h1v1H20zM30 16h2v1H30zM0 17h2v1H0zM8 17h1v1H8zM16 17h1v1H16zM20 17h3v1H20zM25 17h2v1H25zM30 17h2v1H30zM0 18h2v1H0zM8 18h1v1H8zM16 18h1v1H16zM20 18h3v1H20zM25 18h2v1H25zM30 18h2v1H30zM0 19h2v1H0zM8 19h1v1H8zM22 19h1v1H22zM25 19h1v1H25zM30 19h2v1H30zM0 20h3v1H0zM8 20h2v1H8zM22 20h1v1H22zM25 20h1v1H25zM30 20h2v1H30zM0 21h32v1H0zM0 22h32v1H0zM0 23h32v1H0zM0 24h32v1H0zM0 25h32v1H0zM0 26h32v1H0zM0 27h32v1H0zM1 28h30v1H1zM1 29h30v1H1zM2 30h28v1H2zM4 31h24v1H4z"/><path fill="#FF2741" fill-opacity="0.937255" d="M1 1h1v1H1zM30 1h1v1H30zM1 30h1v1H1zM30 30h1v1H30z"/><path fill="#FF2842" d="M5 11h1v1H5zM5 12h1v1H5zM5 13h1v1H5zM5 14h1v1H5zM5 15h1v1H5zM5 16h1v1H5zM5 17h1v1H5zM5 18h1v1H5z"/><path fill="#FFFDFE" d="M6 11h1v1H6z"/><path fill="#FFD1D6" d="M7 11h1v1H7z"/><path fill="#FFCBD1" d="M13 11h1v1H13z"/><path fill="#FFF3F4" d="M14 11h1v1H14zM22 15h1v1H22z"/><path fill="#FF374F" d="M15 11h1v1H15z"/><path fill="#FF4F64" d="M16 11h1v1H16z"/><path fill="#FF7787" d="M17 11h3v1H17zM22 11h1v1H22z"/><path fill="#FF5C70" d="M20 11h1v1H20zM2 15h1v1H2z"/><path fill="#FF314A" d="M21 11h1v1H21z"/><path fill="#FFF5F6" d="M23 11h1v1H23zM25 15h1v1H25z"/><path fill="#FFEDEF" d="M24 11h1v1H24zM12 19h1v1H12zM17 19h1v1H17z"/><path fill="#FF7283" d="M25 11h1v1H25z"/><path fill="#FF3F56" d="M26 11h1v1H26z"/><path fill="#FF6275" d="M28 11h1v1H28z"/><path fill="#FF3E55" d="M29 11h1v1H29zM9 19h1v1H9z"/><path fill="#FFFFFF" d="M6 12h1v1H6zM13 12h1v1H13zM17 12h3v1H17zM22 12h4v1H22zM6 13h1v1H6zM13 13h1v1H13zM18 13h1v1H18zM26 13h1v1H26zM3 14h1v1H3zM6 14h1v1H6zM13 14h2v1H13zM18 14h1v1H18zM26 14h1v1H26zM3 15h1v1H3zM6 15h1v1H6zM14 15h1v1H14zM18 15h1v1H18zM26 15h1v1H26zM3 16h1v1H3zM6 16h1v1H6zM18 16h1v1H18zM28 16h1v1H28zM3 17h1v1H3zM6 17h1v1H6zM10 17h1v1H10zM13 17h2v1H13zM18 17h1v1H18zM28 17h1v1H28zM3 18h1v1H3zM6 18h1v1H6zM18 18h1v1H18zM28 18h1v1H28zM6 19h1v1H6zM18 19h1v1H18zM28 19h1v1H28z"/><path fill="#FFD2D7" d="M7 12h1v1H7zM7 13h1v1H7zM7 14h1v1H7zM7 15h1v1H7zM7 16h1v1H7zM7 17h1v1H7zM7 18h1v1H7z"/><path fill="#FF5C6F" d="M12 12h1v1H12z"/><path fill="#FF9DA9" d="M14 12h1v1H14z"/><path fill="#FF96A2" d="M16 12h1v1H16z"/><path fill="#FFB8C0" d="M20 12h1v1H20zM29 17h1v1H29zM29 18h1v1H29z"/><path fill="#FF4359" d="M21 12h1v1H21z"/><path fill="#FFF6F7" d="M26 12h1v1H26zM13 16h1v1H13z"/><path fill="#FF6577" d="M27 12h1v1H27z"/><path fill="#FFFEFE" d="M28 12h1v1H28zM12 14h1v1H12zM23 15h1v1H23zM10 16h1v1H10zM23 16h1v1H23zM12 20h2v1H12zM16 20h5v1H16z"/><path fill="#FFABB5" d="M29 12h1v1H29z"/><path fill="#FF334B" d="M2 13h1v1H2z"/><path fill="#FF93A0" d="M3 13h1v1H3zM22 13h1v1H22z"/><path fill="#FF7A8A" d="M4 13h1v1H4z"/><path fill="#FF919E" d="M9 13h1v1H9zM15 13h1v1H15zM13 18h1v1H13z"/><path fill="#FF7E8D" d="M10 13h1v1H10z"/><path fill="#FFC3CA" d="M12 13h1v1H12z"/><path fill="#FF97A3" d="M14 13h1v1H14z"/><path fill="#FF6679" d="M16 13h1v1H16z"/><path fill="#FFB6BF" d="M17 13h1v1H17z"/><path fill="#FFC7CD" d="M19 13h1v1H19z"/><path fill="#FF7081" d="M20 13h1v1H20z"/><path fill="#FF354D" d="M21 13h1v1H21z"/><path fill="#FFF7F8" d="M23 13h1v1H23z"/><path fill="#FFF0F2" d="M24 13h1v1H24zM9 14h1v1H9z"/><path fill="#FFADB7" d="M25 13h1v1H25z"/><path fill="#FFA6B1" d="M27 13h1v1H27z"/><path fill="#FF8F9D" d="M28 13h1v1H28z"/><path fill="#FF485E" d="M29 13h1v1H29z"/><path fill="#FF4B61" d="M2 14h1v1H2z"/><path fill="#FFC1C8" d="M4 14h1v1H4z"/><path fill="#FFE2E5" d="M10 14h1v1H10zM24 20h1v1H24z"/><path fill="#FF3D55" d="M11 14h1v1H11z"/><path fill="#FFC0C8" d="M15 14h1v1H15z"/><path fill="#FF6C7E" d="M17 14h1v1H17zM17 15h1v1H17zM17 16h1v1H17zM17 17h1v1H17zM17 18h1v1H17z"/><path fill="#FF8E9B" d="M19 14h1v1H19zM19 15h1v1H19zM19 16h1v1H19zM19 17h1v1H19zM19 18h1v1H19z"/><path fill="#FFF0F1" d="M23 14h1v1H23zM23 17h1v1H23zM23 18h1v1H23zM23 19h1v1H23z"/><path fill="#FFE2E6" d="M24 14h1v1H24z"/><path fill="#FF5267" d="M25 14h1v1H25z"/><path fill="#FFA1AC" d="M27 14h1v1H27zM10 19h1v1H10z"/><path fill="#FFB0B9" d="M4 15h1v1H4zM29 19h1v1H29z"/><path fill="#FFE0E4" d="M9 15h1v1H9z"/><path fill="#FFF2F3" d="M10 15h1v1H10zM27 20h1v1H27z"/><path fill="#FF2943" d="M11 15h1v1H11zM3 20h2v1H3z"/><path fill="#FF6D7E" d="M12 15h1v1H12zM2 16h1v1H2z"/><path fill="#FFD0D5" d="M13 15h1v1H13zM9 16h1v1H9z"/><path fill="#FF586C" d="M15 15h1v1H15z"/><path fill="#FFBCC4" d="M21 15h1v1H21zM3 19h1v1H3z"/><path fill="#FFFDFD" d="M24 15h1v1H24zM24 16h1v1H24z"/><path fill="#FFF9FA" d="M27 15h1v1H27zM10 18h1v1H10z"/><path fill="#FFD1D7" d="M28 15h1v1H28zM15 20h1v1H15z"/><path fill="#FF475D" d="M29 15h1v1H29z"/><path fill="#FF9EAA" d="M4 16h1v1H4z"/><path fill="#FF2A44" d="M11 16h1v1H11z"/><path fill="#FF3850" d="M12 16h1v1H12z"/><path fill="#FFD5DA" d="M14 16h1v1H14z"/><path fill="#FF3049" d="M15 16h1v1H15z"/><path fill="#FFB9C2" d="M21 16h1v1H21z"/><path fill="#FFEFF1" d="M22 16h1v1H22zM25 16h2v1H25zM23 20h1v1H23z"/><path fill="#FFF8F9" d="M27 16h1v1H27z"/><path fill="#FFAAB4" d="M29 16h1v1H29z"/><path fill="#FF8795" d="M2 17h1v1H2z"/><path fill="#FF8796" d="M4 17h1v1H4z"/><path fill="#FFBAC2" d="M9 17h1v1H9z"/><path fill="#FF4158" d="M11 17h1v1H11z"/><path fill="#FF8997" d="M12 17h1v1H12z"/><path fill="#FF8C9A" d="M15 17h1v1H15zM9 18h1v1H9z"/><path fill="#FFE3E6" d="M24 17h1v1H24zM24 18h1v1H24zM24 19h1v1H24z"/><path fill="#FF4E63" d="M27 17h1v1H27zM12 18h1v1H12z"/><path fill="#FF7B8B" d="M2 18h1v1H2z"/><path fill="#FF576C" d="M4 18h1v1H4z"/><path fill="#FF3D54" d="M11 18h1v1H11zM4 19h1v1H4z"/><path fill="#FF929F" d="M14 18h1v1H14z"/><path fill="#FF324A" d="M15 18h1v1H15z"/><path fill="#FF4259" d="M27 18h1v1H27z"/><path fill="#FF2B45" d="M2 19h1v1H2z"/><path fill="#FFA5B0" d="M5 19h1v1H5z"/><path fill="#FFCCD2" d="M7 19h1v1H7z"/><path fill="#FF3A51" d="M11 19h1v1H11z"/><path fill="#FFE4E7" d="M13 19h1v1H13zM16 19h1v1H16zM20 19h1v1H20z"/><path fill="#FFB9C1" d="M14 19h1v1H14z"/><path fill="#FF6779" d="M15 19h1v1H15z"/><path fill="#FFF1F2" d="M19 19h1v1H19z"/><path fill="#FF5B6E" d="M21 19h1v1H21z"/><path fill="#FF99A5" d="M26 19h1v1H26z"/><path fill="#FFB5BE" d="M27 19h1v1H27z"/><path fill="#FFC2C9" d="M5 20h1v1H5z"/><path fill="#FFF4F5" d="M6 20h1v1H6z"/><path fill="#FF7485" d="M7 20h1v1H7z"/><path fill="#FF2942" d="M10 20h1v1H10z"/><path fill="#FF95A1" d="M11 20h1v1H11z"/><path fill="#FF697B" d="M14 20h1v1H14z"/><path fill="#FF6274" d="M21 20h1v1H21z"/><path fill="#FF7F8F" d="M26 20h1v1H26z"/><path fill="#FFE5E8" d="M28 20h1v1H28z"/><path fill="#FF5469" d="M29 20h1v1H29z"/></svg>`;export const DOUYIN_SHOP_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 28 26\" width=\"100%\" height=\"100%\" shape-rendering=\"crispEdges\"><path fill=\"#0052ff\" fill-opacity=\"0.109804\" d=\"M24 0h1v1H24z\"/><path fill=\"#004fff\" fill-opacity=\"0.113725\" d=\"M25 0h2v1H25z\"/><path fill=\"#004dff\" fill-opacity=\"0.078431\" d=\"M27 0h1v1H27zM17 21h1v1H17z\"/><path fill=\"#0051ff\" fill-opacity=\"0.074510\" d=\"M23 1h1v1H23z\"/><path fill=\"#0051ff\" d=\"M24 1h3v1H24zM24 2h3v1H24zM6 3h7v1H6zM24 3h3v1H24zM5 4h8v1H5zM24 4h3v1H24zM4 5h9v1H4zM24 5h2v1H24zM3 6h3v1H3zM24 6h2v1H24zM3 7h3v1H3zM23 7h3v1H23zM3 8h2v1H3zM23 8h3v1H23zM3 9h2v1H3zM23 9h3v1H23zM2 10h3v1H2zM23 10h3v1H23zM2 11h3v1H2zM23 11h2v1H23zM2 12h3v1H2zM23 12h2v1H23zM2 13h2v1H2zM22 13h3v1H22zM2 14h2v1H2zM22 14h3v1H22zM1 15h3v1H1zM22 15h3v1H22zM1 16h3v1H1zM22 16h2v1H22zM1 17h3v1H1zM22 17h2v1H22zM1 18h3v1H1zM22 18h2v1H22zM1 19h3v1H1zM21 19h3v1H21zM1 20h3v1H1zM21 20h3v1H21zM1 21h3v1H1zM20 21h3v1H20zM1 22h22v1H1zM1 23h21v1H1zM3 24h17v1H3z\"/><path fill=\"#0051ff\" fill-opacity=\"0.592157\" d=\"M27 1h1v1H27z\"/><path fill=\"#004fff\" fill-opacity=\"0.227451\" d=\"M6 2h1v1H6zM25 15h1v1H25z\"/><path fill=\"#0051ff\" fill-opacity=\"0.533333\" d=\"M7 2h1v1H7zM4 25h1v1H4z\"/><path fill=\"#0052ff\" fill-opacity=\"0.686275\" d=\"M8 2h1v1H8z\"/><path fill=\"#0050ff\" fill-opacity=\"0.733333\" d=\"M9 2h4v1H9z\"/><path fill=\"#0050ff\" fill-opacity=\"0.560784\" d=\"M13 2h1v1H13z\"/><path fill=\"#0052ff\" fill-opacity=\"0.254902\" d=\"M23 2h1v1H23z\"/><path fill=\"#0051ff\" fill-opacity=\"0.443137\" d=\"M27 2h1v1H27z\"/><path fill=\"#004eff\" fill-opacity=\"0.101961\" d=\"M4 3h1v1H4zM26 10h1v1H26zM11 17h1v1H11z\"/><path fill=\"#0050ff\" fill-opacity=\"0.721569\" d=\"M5 3h1v1H5zM5 9h1v1H5z\"/><path fill=\"#0052ff\" fill-opacity=\"0.611765\" d=\"M13 3h1v1H13zM7 6h1v1H7z\"/><path fill=\"#0051ff\" fill-opacity=\"0.431373\" d=\"M23 3h1v1H23zM8 12h1v1H8z\"/><path fill=\"#0052ff\" fill-opacity=\"0.294118\" d=\"M27 3h1v1H27z\"/><path fill=\"#0052ff\" fill-opacity=\"0.121569\" d=\"M3 4h1v1H3z\"/><path fill=\"#0051ff\" fill-opacity=\"0.878431\" d=\"M4 4h1v1H4zM24 17h1v1H24z\"/><path fill=\"#0052ff\" fill-opacity=\"0.439216\" d=\"M13 4h1v1H13z\"/><path fill=\"#0051ff\" fill-opacity=\"0.603922\" d=\"M23 4h1v1H23z\"/><path fill=\"#0053ff\" fill-opacity=\"0.145098\" d=\"M27 4h1v1H27z\"/><path fill=\"#0080ff\" fill-opacity=\"0.007843\" d=\"M2 5h1v1H2zM15 7h1v1H15zM23 23h1v1H23z\"/><path fill=\"#0051ff\" fill-opacity=\"0.780392\" d=\"M3 5h1v1H3zM23 5h1v1H23z\"/><path fill=\"#0050ff\" fill-opacity=\"0.262745\" d=\"M13 5h1v1H13z\"/><path fill=\"#0051ff\" fill-opacity=\"0.972549\" d=\"M26 5h1v1H26z\"/><path fill=\"#0080ff\" fill-opacity=\"0.015686\" d=\"M27 5h1v1H27z\"/><path fill=\"#0050ff\" fill-opacity=\"0.325490\" d=\"M2 6h1v1H2zM8 11h1v1H8z\"/><path fill=\"#0051ff\" fill-opacity=\"0.996078\" d=\"M6 6h1v1H6zM2 9h1v1H2zM24 16h1v1H24zM21 18h1v1H21zM2 24h1v1H2z\"/><path fill=\"#0050ff\" fill-opacity=\"0.200000\" d=\"M8 6h1v1H8zM19 10h1v1H19z\"/><path fill=\"#004bff\" fill-opacity=\"0.066667\" d=\"M9 6h4v1H9zM19 11h1v1H19zM7 21h10v1H7z\"/><path fill=\"#0055ff\" fill-opacity=\"0.011765\" d=\"M13 6h1v1H13zM11 18h1v1H11z\"/><path fill=\"#004fff\" fill-opacity=\"0.603922\" d=\"M16 6h1v1H16z\"/><path fill=\"#0051ff\" fill-opacity=\"0.745098\" d=\"M17 6h2v1H17z\"/><path fill=\"#0050ff\" fill-opacity=\"0.709804\" d=\"M19 6h1v1H19z\"/><path fill=\"#0000ff\" fill-opacity=\"0.003922\" d=\"M20 6h1v1H20zM22 6h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.952941\" d=\"M23 6h1v1H23z\"/><path fill=\"#0051ff\" fill-opacity=\"0.811765\" d=\"M26 6h1v1H26z\"/><path fill=\"#0051ff\" fill-opacity=\"0.654902\" d=\"M2 7h1v1H2z\"/><path fill=\"#0050ff\" fill-opacity=\"0.509804\" d=\"M6 7h1v1H6zM18 25h1v1H18z\"/><path fill=\"#0050ff\" fill-opacity=\"0.772549\" d=\"M16 7h1v1H16z\"/><path fill=\"#0050ff\" fill-opacity=\"0.800000\" d=\"M17 7h2v1H17zM16 8h3v1H16zM16 9h3v1H16zM16 10h3v1H16zM16 11h3v1H16zM16 12h2v1H16zM16 13h2v1H16zM15 14h3v1H15zM15 15h3v1H15zM15 16h3v1H15zM15 17h2v1H15z\"/><path fill=\"#0050ff\" fill-opacity=\"0.623529\" d=\"M19 7h1v1H19z\"/><path fill=\"#0053ff\" fill-opacity=\"0.133333\" d=\"M22 7h1v1H22zM12 11h1v1H12z\"/><path fill=\"#0050ff\" fill-opacity=\"0.635294\" d=\"M26 7h1v1H26z\"/><path fill=\"#0051ff\" fill-opacity=\"0.866667\" d=\"M2 8h1v1H2z\"/><path fill=\"#0051ff\" fill-opacity=\"0.945098\" d=\"M5 8h1v1H5z\"/><path fill=\"#0055ff\" fill-opacity=\"0.035294\" d=\"M6 8h1v1H6zM5 13h1v1H5zM14 13h1v1H14z\"/><path fill=\"#0050ff\" fill-opacity=\"0.125490\" d=\"M15 8h1v1H15zM12 9h1v1H12z\"/><path fill=\"#0051ff\" fill-opacity=\"0.482353\" d=\"M19 8h1v1H19zM22 9h1v1H22z\"/><path fill=\"#0052ff\" fill-opacity=\"0.305882\" d=\"M22 8h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.458824\" d=\"M26 8h1v1H26z\"/><path fill=\"#0055ff\" fill-opacity=\"0.047059\" d=\"M1 9h1v1H1zM24 21h1v1H24z\"/><path fill=\"#0055ff\" fill-opacity=\"0.058824\" d=\"M8 9h1v1H8zM20 18h1v1H20z\"/><path fill=\"#004fff\" fill-opacity=\"0.239216\" d=\"M9 9h3v1H9zM12 10h1v1H12zM8 18h3v1H8z\"/><path fill=\"#004fff\" fill-opacity=\"0.266667\" d=\"M15 9h1v1H15z\"/><path fill=\"#004fff\" fill-opacity=\"0.341176\" d=\"M19 9h1v1H19z\"/><path fill=\"#0051ff\" fill-opacity=\"0.282353\" d=\"M26 9h1v1H26z\"/><path fill=\"#0052ff\" fill-opacity=\"0.219608\" d=\"M1 10h1v1H1zM8 10h1v1H8z\"/><path fill=\"#0051ff\" fill-opacity=\"0.545098\" d=\"M5 10h1v1H5zM1 24h1v1H1z\"/><path fill=\"#0050ff\" fill-opacity=\"0.600000\" d=\"M9 10h3v1H9zM9 11h3v1H9zM9 12h2v1H9zM9 13h2v1H9zM8 14h3v1H8zM8 15h3v1H8zM8 16h3v1H8zM8 17h3v1H8z\"/><path fill=\"#0051ff\" fill-opacity=\"0.407843\" d=\"M15 10h1v1H15z\"/><path fill=\"#0050ff\" fill-opacity=\"0.658824\" d=\"M22 10h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.396078\" d=\"M1 11h1v1H1z\"/><path fill=\"#0051ff\" fill-opacity=\"0.368627\" d=\"M5 11h1v1H5z\"/><path fill=\"#0050ff\" fill-opacity=\"0.549020\" d=\"M15 11h1v1H15zM5 25h13v1H5z\"/><path fill=\"#0051ff\" fill-opacity=\"0.835294\" d=\"M22 11h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.929412\" d=\"M25 11h1v1H25z\"/><path fill=\"#0050ff\" fill-opacity=\"0.572549\" d=\"M1 12h1v1H1z\"/><path fill=\"#0053ff\" fill-opacity=\"0.192157\" d=\"M5 12h1v1H5z\"/><path fill=\"#0051ff\" fill-opacity=\"0.596078\" d=\"M11 12h1v1H11zM14 17h1v1H14z\"/><path fill=\"#0060ff\" fill-opacity=\"0.031373\" d=\"M12 12h1v1H12zM18 17h1v1H18z\"/><path fill=\"#0050ff\" fill-opacity=\"0.690196\" d=\"M15 12h1v1H15z\"/><path fill=\"#0050ff\" fill-opacity=\"0.725490\" d=\"M18 12h1v1H18z\"/><path fill=\"#0049ff\" fill-opacity=\"0.027451\" d=\"M21 12h1v1H21z\"/><path fill=\"#0051ff\" fill-opacity=\"0.980392\" d=\"M22 12h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.752941\" d=\"M25 12h1v1H25z\"/><path fill=\"#0051ff\" fill-opacity=\"0.749020\" d=\"M1 13h1v1H1z\"/><path fill=\"#0051ff\" fill-opacity=\"0.988235\" d=\"M4 13h1v1H4z\"/><path fill=\"#0050ff\" fill-opacity=\"0.537255\" d=\"M8 13h1v1H8z\"/><path fill=\"#0051ff\" fill-opacity=\"0.521569\" d=\"M11 13h1v1H11z\"/><path fill=\"#0050ff\" fill-opacity=\"0.792157\" d=\"M15 13h1v1H15zM17 17h1v1H17z\"/><path fill=\"#0050ff\" fill-opacity=\"0.584314\" d=\"M18 13h1v1H18z\"/><path fill=\"#0051ff\" fill-opacity=\"0.184314\" d=\"M21 13h1v1H21z\"/><path fill=\"#0052ff\" fill-opacity=\"0.576471\" d=\"M25 13h1v1H25z\"/><path fill=\"#0051ff\" fill-opacity=\"0.917647\" d=\"M1 14h1v1H1z\"/><path fill=\"#0051ff\" fill-opacity=\"0.843137\" d=\"M4 14h1v1H4z\"/><path fill=\"#0046ff\" fill-opacity=\"0.043137\" d=\"M7 14h1v1H7zM4 19h1v1H4z\"/><path fill=\"#004fff\" fill-opacity=\"0.415686\" d=\"M11 14h1v1H11z\"/><path fill=\"#0051ff\" fill-opacity=\"0.172549\" d=\"M14 14h1v1H14zM7 18h1v1H7z\"/><path fill=\"#004fff\" fill-opacity=\"0.443137\" d=\"M18 14h1v1H18z\"/><path fill=\"#0050ff\" fill-opacity=\"0.360784\" d=\"M21 14h1v1H21z\"/><path fill=\"#0052ff\" fill-opacity=\"0.403922\" d=\"M25 14h1v1H25z\"/><path fill=\"#0052ff\" fill-opacity=\"0.098039\" d=\"M0 15h1v1H0z\"/><path fill=\"#0051ff\" fill-opacity=\"0.666667\" d=\"M4 15h1v1H4z\"/><path fill=\"#0051ff\" fill-opacity=\"0.149020\" d=\"M7 15h1v1H7z\"/><path fill=\"#0051ff\" fill-opacity=\"0.309804\" d=\"M11 15h1v1H11z\"/><path fill=\"#0050ff\" fill-opacity=\"0.313725\" d=\"M14 15h1v1H14zM24 20h1v1H24z\"/><path fill=\"#004fff\" fill-opacity=\"0.301961\" d=\"M18 15h1v1H18z\"/><path fill=\"#0052ff\" fill-opacity=\"0.537255\" d=\"M21 15h1v1H21z\"/><path fill=\"#0050ff\" fill-opacity=\"0.274510\" d=\"M0 16h1v1H0zM14 18h1v1H14z\"/><path fill=\"#0051ff\" fill-opacity=\"0.494118\" d=\"M4 16h1v1H4z\"/><path fill=\"#0050ff\" fill-opacity=\"0.250980\" d=\"M7 16h1v1H7zM5 21h1v1H5z\"/><path fill=\"#0052ff\" fill-opacity=\"0.207843\" d=\"M11 16h1v1H11z\"/><path fill=\"#004fff\" fill-opacity=\"0.454902\" d=\"M14 16h1v1H14z\"/><path fill=\"#0051ff\" fill-opacity=\"0.160784\" d=\"M18 16h1v1H18z\"/><path fill=\"#0051ff\" fill-opacity=\"0.713725\" d=\"M21 16h1v1H21z\"/><path fill=\"#0050ff\" fill-opacity=\"0.062745\" d=\"M25 16h1v1H25z\"/><path fill=\"#0051ff\" fill-opacity=\"0.447059\" d=\"M0 17h1v1H0zM23 22h1v1H23z\"/><path fill=\"#0052ff\" fill-opacity=\"0.317647\" d=\"M4 17h1v1H4zM20 19h1v1H20z\"/><path fill=\"#0051ff\" fill-opacity=\"0.356863\" d=\"M7 17h1v1H7z\"/><path fill=\"#0051ff\" fill-opacity=\"0.886275\" d=\"M21 17h1v1H21z\"/><path fill=\"#0052ff\" fill-opacity=\"0.623529\" d=\"M0 18h1v1H0z\"/><path fill=\"#004eff\" fill-opacity=\"0.141176\" d=\"M4 18h1v1H4z\"/><path fill=\"#0051ff\" fill-opacity=\"0.321569\" d=\"M15 18h2v1H15z\"/><path fill=\"#004fff\" fill-opacity=\"0.290196\" d=\"M17 18h1v1H17z\"/><path fill=\"#0051ff\" fill-opacity=\"0.701961\" d=\"M24 18h1v1H24z\"/><path fill=\"#0050ff\" fill-opacity=\"0.796078\" d=\"M0 19h1v1H0z\"/><path fill=\"#0052ff\" fill-opacity=\"0.525490\" d=\"M24 19h1v1H24z\"/><path fill=\"#0051ff\" fill-opacity=\"0.941176\" d=\"M0 20h1v1H0z\"/><path fill=\"#0050ff\" fill-opacity=\"0.211765\" d=\"M4 20h1v1H4z\"/><path fill=\"#004dff\" fill-opacity=\"0.039216\" d=\"M19 20h1v1H19z\"/><path fill=\"#0051ff\" fill-opacity=\"0.803922\" d=\"M20 20h1v1H20z\"/><path fill=\"#0051ff\" fill-opacity=\"0.964706\" d=\"M0 21h1v1H0z\"/><path fill=\"#0051ff\" fill-opacity=\"0.847059\" d=\"M4 21h1v1H4z\"/><path fill=\"#0055ff\" fill-opacity=\"0.070588\" d=\"M6 21h1v1H6z\"/><path fill=\"#0053ff\" fill-opacity=\"0.266667\" d=\"M18 21h1v1H18z\"/><path fill=\"#0051ff\" fill-opacity=\"0.792157\" d=\"M19 21h1v1H19z\"/><path fill=\"#0051ff\" fill-opacity=\"0.933333\" d=\"M23 21h1v1H23z\"/><path fill=\"#0052ff\" fill-opacity=\"0.784314\" d=\"M0 22h1v1H0z\"/><path fill=\"#0052ff\" fill-opacity=\"0.352941\" d=\"M0 23h1v1H0z\"/><path fill=\"#0051ff\" fill-opacity=\"0.662745\" d=\"M22 23h1v1H22z\"/><path fill=\"#0051ff\" fill-opacity=\"0.976471\" d=\"M20 24h1v1H20z\"/><path fill=\"#0052ff\" fill-opacity=\"0.513725\" d=\"M21 24h1v1H21z\"/><path fill=\"#0040ff\" fill-opacity=\"0.015686\" d=\"M22 24h1v1H22z\"/><path fill=\"#004dff\" fill-opacity=\"0.168627\" d=\"M2 25h1v1H2z\"/><path fill=\"#0050ff\" fill-opacity=\"0.439216\" d=\"M3 25h1v1H3z\"/><path fill=\"#004eff\" fill-opacity=\"0.356863\" d=\"M19 25h1v1H19z\"/><path fill=\"#0051ff\" fill-opacity=\"0.086275\" d=\"M20 25h1v1H20z\"/></svg>";export const KUAISHOU_SHOP_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"100%\" height=\"100%\"><mask id=\"mask0_153_5678\" style=\"mask-type:luminance\" maskUnits=\"userSpaceOnUse\" x=\"10\" y=\"8\" width=\"27\" height=\"32\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.915 15.8305C12.915 19.7803 16.1201 22.9836 20.0719 22.9836C22.2583 22.9836 24.2164 22.0036 25.5289 20.4589C26.6464 21.9884 28.4546 22.9836 30.4961 22.9836C33.8899 22.9836 36.6412 20.2337 36.6412 16.8411C36.6412 13.4485 33.8899 10.6988 30.4961 10.6988C28.8823 10.6988 27.414 11.3198 26.3176 12.3358C25.0932 10.1519 22.7546 8.67676 20.0719 8.67676C16.1201 8.67676 12.915 11.8792 12.915 15.8305ZM15.793 15.8304C15.793 13.4681 17.7084 11.5532 20.071 11.5532C22.4341 11.5532 24.3495 13.4681 24.3495 15.8304C24.3495 18.1915 22.4341 20.1063 20.071 20.1063C17.7084 20.1063 15.793 18.1915 15.793 15.8304ZM27.2275 16.8409C27.2275 15.0369 28.691 13.5752 30.4952 13.5752C32.2997 13.5752 33.7623 15.0369 33.7623 16.8409C33.7623 18.6434 32.2997 20.1062 30.4952 20.1062C28.691 20.1062 27.2275 18.6434 27.2275 16.8409ZM23.5718 24.2278C21.213 24.2278 19.2149 25.771 18.5325 27.9031L13.9195 25.5689C13.5595 25.3873 13.1622 25.2921 12.7591 25.2921C11.3419 25.2921 10.1924 26.4408 10.1924 27.8579V35.389C10.1924 35.7884 10.2862 36.1815 10.4643 36.5386C11.0998 37.8056 12.6421 38.3176 13.9097 37.6827L18.5439 35.3607C19.2364 37.4737 21.2258 39.0012 23.5718 39.0012H31.351C34.2725 39.0012 36.6408 36.6335 36.6408 33.7137V29.5152C36.6408 26.5952 34.2725 24.2278 31.351 24.2278H23.5718ZM23.6063 36.2785C22.1663 36.2554 21.0059 35.0809 21.0059 33.6355V29.5925V29.5488C21.029 28.1085 22.2043 26.9492 23.6503 26.9492H31.2734H31.3175C32.7577 26.9721 33.9179 28.1468 33.9179 29.5925V33.6355V33.6795C33.895 35.1195 32.7203 36.2794 31.2734 36.2794H23.6503L23.6063 36.2785ZM12.9922 34.3272C12.9419 34.2286 12.915 34.1205 12.915 34.0093V29.2759C12.9222 28.8948 13.2332 28.5884 13.6163 28.5884C13.725 28.5884 13.8324 28.6144 13.9299 28.6633L18.2825 30.848V32.417L13.9339 34.6331L13.9211 34.6389C13.8239 34.6872 13.7192 34.7095 13.6163 34.7095C13.3616 34.7095 13.1157 34.5697 12.9922 34.3272Z\" fill=\"white\"></path></mask><g mask=\"url(#mask0_153_5678)\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9.05273 40.1402H37.7805V7.53613H9.05273V40.1402Z\" fill=\"#FF4906\"></path></g></svg>";-export const JD_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 140" width="100%" height="100%" shape-rendering="crispEdges"><path fill="#e7e6ea" fill-opacity="0.105882" d="M161 18h1v1H161zM184 18h1v1H184zM190 19h1v1H190zM194 20h1v1H194zM207 35h1v1H207zM97 58h1v1H97zM97 59h1v1H97zM97 60h1v1H97zM97 61h1v1H97zM92 72h1v1H92zM89 74h1v1H89zM73 75h1v1H73zM186 75h1v1H186zM134 103h1v1H134zM139 103h1v1H139zM137 116h1v1H137zM136 117h1v1H136z"/><path fill="#e9e8ed" fill-opacity="0.12549" d="M162 18h1v1H162zM121 29h1v1H121zM113 33h1v1H113zM102 41h1v1H102zM101 42h1v1H101zM99 44h1v1H99zM100 60h1v1H100zM75 63h1v1H75zM193 68h1v1H193zM111 71h1v1H111zM114 73h1v1H114zM117 75h1v1H117zM75 77h1v1H75zM164 89h1v1H164zM164 90h1v1H164zM164 91h1v1H164zM164 92h1v1H164zM145 93h1v1H145zM164 93h1v1H164zM164 94h1v1H164zM164 95h1v1H164zM164 96h1v1H164zM164 97h1v1H164zM164 98h1v1H164zM164 99h1v1H164zM164 100h1v1H164zM164 101h1v1H164zM164 102h1v1H164zM164 103h1v1H164zM164 104h1v1H164zM164 105h1v1H164zM164 106h1v1H164zM164 107h1v1H164zM164 108h1v1H164zM164 109h1v1H164zM135 110h1v1H135zM164 110h1v1H164zM164 111h1v1H164zM164 112h1v1H164zM164 113h1v1H164zM164 114h1v1H164zM132 115h1v1H132zM164 115h1v1H164zM164 116h1v1H164zM164 117h1v1H164zM144 118h1v1H144zM164 118h1v1H164zM134 119h1v1H134zM164 119h1v1H164zM129 120h1v1H129zM164 120h1v1H164zM144 121h1v1H144z"/><path fill="#e9e9ec" fill-opacity="0.180392" d="M163 18h1v1H163zM183 18h1v1H183zM103 40h1v1H103zM98 56h1v1H98zM196 64h1v1H196zM73 68h1v1H73zM192 69h1v1H192zM191 70h1v1H191zM77 78h1v1H77zM79 78h1v1H79zM129 81h1v1H129zM177 81h1v1H177zM144 119h1v1H144zM133 120h1v1H133z"/><path fill="#f8f8f9" fill-opacity="0.243137" d="M164 18h1v1H164zM182 18h1v1H182zM137 23h1v1H137zM126 27h1v1H126zM119 30h1v1H119zM117 31h1v1H117zM81 50h1v1H81zM78 58h1v1H78z"/><path fill="#f5f5f7" fill-opacity="0.317647" d="M165 18h1v1H165zM189 19h1v1H189zM193 20h1v1H193zM196 21h1v1H196zM203 25h1v1H203zM85 40h1v1H85zM205 45h1v1H205zM82 47h1v1H82zM204 48h1v1H204zM79 56h1v1H79zM170 84h1v1H170zM134 112h1v1H134z"/><path fill="#f5f5f8" fill-opacity="0.458824" d="M166 18h1v1H166zM180 18h1v1H180zM149 20h1v1H149zM141 22h1v1H141zM129 26h1v1H129zM107 37h1v1H107zM91 40h1v1H91zM93 41h1v1H93zM76 62h1v1H76zM75 64h1v1H75zM195 65h1v1H195zM73 69h1v1H73zM130 119h1v1H130z"/><path fill="#f9fafb" fill-opacity="0.505882" d="M167 18h3v1H167zM177 18h3v1H177zM188 19h1v1H188zM200 23h1v1H200zM206 30h1v1H206zM81 51h1v1H81z"/><path fill="#f8f9fb" fill-opacity="0.576471" d="M170 18h1v1H170zM198 22h1v1H198zM138 23h1v1H138zM112 34h1v1H112zM206 40h1v1H206zM204 47h1v1H204zM197 62h1v1H197z"/><path fill="#fafbfc" fill-opacity="0.615686" d="M171 18h5v1H171zM157 19h1v1H157zM150 20h1v1H150zM192 20h1v1H192zM127 27h1v1H127zM205 28h1v1H205zM120 30h1v1H120zM106 38h1v1H106z"/><path fill="#f8f8fa" fill-opacity="0.541176" d="M176 18h1v1H176zM156 19h1v1H156zM145 21h1v1H145zM135 24h1v1H135zM132 25h1v1H132zM122 29h1v1H122zM83 44h1v1H83zM98 44h1v1H98zM203 50h1v1H203zM80 54h1v1H80z"/><path fill="#f0f0f2" fill-opacity="0.290196" d="M181 18h1v1H181zM154 19h1v1H154zM144 21h1v1H144zM88 39h1v1H88zM84 41h1v1H84zM95 42h1v1H95zM95 68h1v1H95zM190 71h1v1H190zM119 76h1v1H119zM147 90h1v1H147zM131 117h1v1H131zM129 121h1v1H129z"/><path fill="#e6e6e8" fill-opacity="0.066667" d="M153 19h1v1H153zM147 20h1v1H147zM104 39h1v1H104zM92 40h1v1H92zM103 64h1v1H103zM105 66h1v1H105zM185 76h1v1H185zM83 77h1v1H83zM131 82h1v1H131zM153 109h1v1H153zM159 118h1v1H159zM164 121h1v1H164z"/><path fill="#f9f9fb" fill-opacity="0.372549" d="M155 19h1v1H155zM204 26h1v1H204zM124 28h1v1H124zM110 35h1v1H110zM206 41h1v1H206zM202 53h1v1H202z"/><path fill="#f9f9fb" fill-opacity="0.72549" d="M158 19h1v1H158zM187 19h1v1H187zM195 21h1v1H195zM130 26h1v1H130zM118 31h1v1H118zM206 31h1v1H206zM116 32h1v1H116zM114 33h1v1H114zM206 39h1v1H206zM205 44h1v1H205zM202 52h1v1H202z"/><path fill="#f5f5f8" fill-opacity="0.847059" d="M159 19h1v1H159zM201 24h1v1H201zM105 39h1v1H105zM104 40h1v1H104zM84 42h1v1H84zM94 42h1v1H94zM102 42h1v1H102zM205 43h1v1H205zM201 54h1v1H201zM196 63h1v1H196z"/><path fill="#fafafb" fill-opacity="0.87451" d="M160 19h1v1H160zM185 19h1v1H185zM139 23h1v1H139zM204 27h1v1H204zM111 35h1v1H111z"/><path fill="#fafafc" fill-opacity="0.933333" d="M161 19h1v1H161zM128 27h1v1H128zM123 29h1v1H123z"/><path fill="#fafafc" d="M162 19h1v1H162zM179 19h1v1H179zM180 20h1v1H180zM181 21h1v1H181zM169 23h1v1H169zM152 28h2v1H152zM125 29h1v1H125zM152 29h2v1H152zM151 30h2v1H151zM151 31h2v1H151z"/><path fill="#fbfbfd" d="M163 19h8v1H163zM153 20h18v1H153zM183 20h2v1H183zM147 21h23v1H147zM184 21h1v1H184zM144 22h26v1H144zM140 23h29v1H140zM144 24h16v1H144zM144 25h16v1H144zM144 26h12v1H144zM144 27h11v1H144zM144 28h8v1H144zM144 29h8v1H144zM144 30h7v1H144zM144 31h1v1H144zM150 31h1v1H150zM151 32h1v1H151z"/><path fill="#fafbfd" d="M171 19h5v1H171zM171 20h5v1H171zM170 21h6v1H170zM170 22h6v1H170zM178 22h4v1H178zM175 23h1v1H175zM137 24h7v1H137zM137 25h7v1H137zM138 26h6v1H138zM139 27h5v1H139zM139 28h5v1H139zM139 29h5v1H139zM139 30h5v1H139zM143 31h1v1H143z"/><path fill="#f9fafb" d="M176 19h3v1H176zM180 19h4v1H180zM176 20h4v1H176zM181 20h2v1H181zM185 20h1v1H185zM188 20h3v1H188zM176 21h5v1H176zM182 21h2v1H182zM176 22h2v1H176zM170 23h5v1H170zM177 23h3v1H177zM134 25h3v1H134zM132 26h6v1H132zM129 27h10v1H129zM128 28h11v1H128zM128 29h11v1H128zM130 30h9v1H130zM130 31h13v1H130zM206 36h1v1H206zM205 38h1v1H205zM205 39h1v1H205zM89 40h1v1H89z"/><path fill="#f8f9fa" d="M184 19h1v1H184zM187 20h1v1H187zM176 23h1v1H176zM177 24h1v1H177zM202 25h1v1H202zM203 27h1v1H203zM126 28h2v1H126zM204 28h1v1H204zM124 29h1v1H124zM126 29h2v1H126zM128 30h2v1H128zM153 30h1v1H153zM120 31h1v1H120zM128 31h2v1H128zM153 31h1v1H153zM110 36h1v1H110zM107 38h1v1H107zM87 40h1v1H87zM205 40h1v1H205zM205 41h1v1H205zM205 42h1v1H205z"/><path fill="#fafbfc" fill-opacity="0.772549" d="M186 19h1v1H186zM151 20h1v1H151zM146 21h1v1H146zM142 22h1v1H142zM125 28h1v1H125zM109 36h1v1H109z"/><path fill="#efeef1" fill-opacity="0.196078" d="M148 20h1v1H148zM140 22h1v1H140zM89 39h1v1H89zM83 43h1v1H83zM82 46h1v1H82zM203 51h1v1H203zM80 53h1v1H80zM96 66h1v1H96zM110 70h1v1H110zM188 73h1v1H188zM74 76h1v1H74zM182 78h1v1H182zM175 82h1v1H175zM145 86h1v1H145zM141 100h1v1H141z"/><path fill="#f9fafc" fill-opacity="0.956863" d="M152 20h1v1H152zM143 22h1v1H143zM205 29h1v1H205zM108 37h1v1H108zM206 37h1v1H206zM204 46h1v1H204z"/><path fill="#f7f7f8" d="M186 20h1v1H186zM185 21h1v1H185zM194 21h1v1H194zM178 24h1v1H178zM201 25h1v1H201zM201 26h2v1H201zM202 27h1v1H202zM203 28h1v1H203zM204 29h1v1H204zM111 36h1v1H111zM109 37h3v1H109zM108 38h4v1H108zM144 38h1v1H144zM106 39h1v1H106zM111 39h1v1H111z"/><path fill="#f9fafc" fill-opacity="0.898039" d="M191 20h1v1H191zM136 24h1v1H136zM133 25h1v1H133zM206 38h1v1H206zM90 40h1v1H90zM92 41h1v1H92zM203 49h1v1H203z"/><path fill="#f0f0f8" fill-opacity="0.011765" d="M143 21h1v1H143zM106 37h1v1H106zM206 43h1v1H206zM81 49h1v1H81zM204 49h1v1H204zM202 54h1v1H202zM106 67h1v1H106zM143 96h1v1H143zM132 106h1v1H132zM144 110h1v1H144zM144 117h1v1H144z"/><path fill="#eaeaef" d="M186 21h1v1H186zM90 43h1v1H90zM93 45h1v1H93zM99 47h2v1H99zM76 68h2v1H76zM75 69h1v1H75zM74 70h1v1H74zM74 71h1v1H74zM157 91h1v1H157zM157 92h1v1H157zM157 93h1v1H157zM157 94h1v1H157zM157 95h1v1H157zM157 96h1v1H157zM157 97h1v1H157zM158 99h1v1H158zM158 100h1v1H158z"/><path fill="#c8c7cb" d="M187 21h1v1H187zM145 31h1v1H145zM89 48h1v1H89zM89 49h2v1H89zM89 50h3v1H89zM91 51h3v1H91zM150 55h1v1H150zM159 56h1v1H159zM183 60h1v1H183zM176 64h2v1H176zM156 106h1v1H156zM155 107h1v1H155zM158 108h1v1H158zM158 110h1v1H158zM159 111h1v1H159zM160 118h1v1H160z"/><path fill="#c4c4c6" d="M188 21h1v1H188zM192 21h1v1H192zM189 63h1v1H189zM156 107h2v1H156zM158 109h1v1H158zM159 112h1v1H159zM159 113h1v1H159z"/><path fill="#b8b8bb" d="M189 21h1v1H189zM191 21h1v1H191zM184 30h1v1H184zM192 30h1v1H192zM155 54h1v1H155zM194 58h1v1H194zM161 61h1v1H161zM164 62h1v1H164zM193 62h1v1H193zM178 64h1v1H178z"/><path fill="#b1b0b2" d="M190 21h1v1H190zM178 25h1v1H178zM180 29h1v1H180zM148 31h1v1H148zM143 33h1v1H143zM151 51h1v1H151zM161 57h1v1H161zM168 59h1v1H168zM196 61h1v1H196zM169 63h1v1H169z"/><path fill="#cecdd2" d="M193 21h1v1H193zM199 28h1v1H199zM144 46h1v1H144zM146 46h1v1H146zM88 48h1v1H88zM148 48h1v1H148zM88 49h1v1H88zM92 49h1v1H92zM88 50h1v1H88zM88 51h1v1H88zM88 52h2v1H88zM94 52h1v1H94zM87 53h3v1H87zM94 53h1v1H94zM86 54h3v1H86zM92 54h2v1H92zM86 55h5v1H86zM92 55h1v1H92zM157 55h1v1H157zM86 56h7v1H86zM86 57h4v1H86zM91 57h2v1H91zM85 58h1v1H85zM88 58h1v1H88zM176 60h1v1H176zM182 60h1v1H182zM157 106h1v1H157zM143 107h2v1H143zM158 107h1v1H158zM142 108h1v1H142zM144 108h1v1H144zM141 110h1v1H141zM159 110h1v1H159zM160 116h1v1H160z"/><path fill="#ebebf2" fill-opacity="0.023529" d="M197 21h1v1H197zM128 26h1v1H128zM123 28h1v1H123zM109 35h1v1H109zM207 36h1v1H207zM79 55h1v1H79zM199 60h1v1H199zM76 61h1v1H76zM197 63h1v1H197zM74 65h1v1H74zM107 68h1v1H107zM181 79h1v1H181zM171 84h1v1H171zM140 85h1v1H140zM168 85h1v1H168zM144 86h1v1H144zM165 86h1v1H165zM130 118h1v1H130zM149 118h1v1H149z"/><path fill="#e9e8ed" d="M182 22h1v1H182zM176 45h1v1H176zM176 46h1v1H176zM176 47h3v1H176zM178 48h2v1H178zM182 49h2v1H182zM102 50h2v1H102zM144 50h1v1H144zM151 50h3v1H151zM183 50h2v1H183zM144 51h2v1H144zM152 51h5v1H152zM185 51h2v1H185zM146 52h1v1H146zM187 52h1v1H187zM188 53h1v1H188zM189 54h1v1H189zM190 55h2v1H190zM128 56h10v1H128zM83 58h1v1H83zM81 63h1v1H81zM189 64h1v1H189zM189 65h1v1H189zM188 66h1v1H188zM188 67h1v1H188zM187 68h1v1H187zM77 69h1v1H77zM187 69h1v1H187zM76 70h1v1H76zM186 70h1v1H186zM75 71h1v1H75zM186 71h1v1H186zM74 72h1v1H74zM185 72h3v1H185zM186 73h1v1H186zM184 74h2v1H184zM184 75h1v1H184zM181 76h1v1H181zM179 77h1v1H179zM178 78h2v1H178zM175 80h1v1H175zM177 80h1v1H177zM173 81h2v1H173zM172 82h1v1H172zM156 100h1v1H156zM156 101h1v1H156zM156 102h1v1H156zM156 103h2v1H156zM146 114h1v1H146zM146 115h1v1H146zM145 120h1v1H145zM163 120h1v1H163z"/><path fill="#a2a2a5" d="M183 22h1v1H183zM179 24h1v1H179zM185 30h1v1H185zM189 30h3v1H189zM144 49h1v1H144zM174 60h1v1H174zM184 60h1v1H184zM188 63h1v1H188z"/><path fill="#5e5d5f" d="M184 22h1v1H184zM150 33h1v1H150zM149 37h1v1H149zM166 62h1v1H166zM172 63h1v1H172z"/><path fill="#484748" d="M185 22h1v1H185zM192 23h5v1H192zM193 24h1v1H193zM193 25h5v1H193zM198 26h2v1H198zM179 28h1v1H179zM144 48h1v1H144zM147 48h1v1H147zM149 50h1v1H149zM151 55h1v1H151zM162 58h1v1H162zM160 60h1v1H160zM163 61h1v1H163zM191 62h1v1H191zM185 63h1v1H185z"/><path fill="#3b3b3c" d="M186 22h1v1H186zM184 23h2v1H184zM187 23h1v1H187zM180 24h1v1H180zM183 24h3v1H183zM185 25h2v1H185zM191 26h2v1H191zM197 27h1v1H197zM157 56h1v1H157zM194 61h1v1H194z"/><path fill="#3f3e40" d="M187 22h8v1H187zM186 23h1v1H186zM188 23h3v1H188zM186 24h4v1H186zM187 25h4v1H187zM193 26h3v1H193zM198 27h1v1H198zM146 47h1v1H146zM159 57h1v1H159zM158 59h1v1H158zM174 63h1v1H174z"/><path fill="#636265" d="M195 22h1v1H195zM181 29h1v1H181zM166 59h1v1H166zM192 59h1v1H192zM171 60h1v1H171zM195 61h1v1H195zM186 63h1v1H186z"/><path fill="#838385" d="M196 22h1v1H196zM178 27h1v1H178zM196 29h1v1H196zM163 58h1v1H163zM187 63h1v1H187z"/><path fill="#c1c1c2" fill-opacity="0.894118" d="M197 22h1v1H197zM199 23h1v1H199zM156 108h1v1H156zM157 109h1v1H157z"/><path fill="#eaeaec" fill-opacity="0.086275" d="M199 22h1v1H199zM111 34h1v1H111zM207 34h1v1H207zM100 43h1v1H100zM97 53h1v1H97zM93 71h1v1H93zM80 78h1v1H80zM122 78h1v1H122zM179 80h1v1H179zM137 84h1v1H137zM142 98h1v1H142zM142 111h1v1H142z"/><path fill="#e7e6ea" fill-opacity="0.047059" d="M136 23h1v1H136zM201 23h1v1H201zM105 38h1v1H105zM86 39h1v1H86zM205 46h1v1H205zM97 57h1v1H97zM97 62h1v1H97zM104 65h1v1H104zM194 67h1v1H194zM94 70h1v1H94zM146 91h1v1H146zM131 98h1v1H131zM157 111h1v1H157zM141 112h1v1H141zM133 113h1v1H133zM139 114h1v1H139zM138 115h1v1H138z"/><path fill="#d7d6db" d="M180 23h1v1H180zM88 45h1v1H88zM90 46h1v1H90zM91 47h1v1H91zM95 50h1v1H95zM200 55h1v1H200zM93 62h1v1H93zM93 63h1v1H93zM82 64h1v1H82zM92 64h1v1H92zM82 65h2v1H82zM83 66h2v1H83zM88 66h3v1H88zM81 67h1v1H81zM83 67h2v1H83zM88 67h2v1H88zM84 68h2v1H84zM88 68h2v1H88zM84 69h2v1H84zM88 69h2v1H88zM136 115h1v1H136z"/><path fill="#6e6e70" d="M181 23h1v1H181zM198 23h1v1H198zM143 34h1v1H143zM143 35h1v1H143zM150 36h1v1H150zM146 51h1v1H146zM153 53h1v1H153zM156 55h1v1H156zM160 57h1v1H160zM195 58h1v1H195zM187 60h1v1H187zM162 61h1v1H162zM171 63h1v1H171z"/><path fill="#383739" d="M182 23h2v1H182zM182 25h3v1H182zM189 26h2v1H189zM196 27h1v1H196zM148 32h1v1H148zM149 33h1v1H149zM150 34h1v1H150zM150 35h1v1H150zM145 47h1v1H145zM150 54h1v1H150zM155 56h1v1H155zM196 58h1v1H196z"/><path fill="#444244" d="M191 23h1v1H191zM190 24h3v1H190zM191 25h2v1H191zM196 26h2v1H196zM148 49h1v1H148zM154 54h1v1H154zM198 57h1v1H198zM156 58h1v1H156zM170 60h1v1H170zM197 60h1v1H197zM184 63h1v1H184z"/><path fill="#4b4a4b" fill-opacity="0.984314" d="M197 23h1v1H197zM194 24h3v1H194zM200 56h1v1H200zM173 63h1v1H173z"/><path fill="#edecef" fill-opacity="0.223529" d="M134 24h1v1H134zM115 32h1v1H115zM87 39h1v1H87zM206 42h1v1H206zM198 61h1v1H198zM189 72h1v1H189zM141 85h1v1H141zM144 95h1v1H144zM134 107h1v1H134zM149 117h1v1H149zM144 120h1v1H144z"/><path fill="#fafbff" d="M160 24h6v1H160zM160 25h4v1H160zM157 26h5v1H157zM155 27h5v1H155z"/><path fill="#f9fafe" d="M166 24h9v1H166zM164 25h4v1H164zM177 25h1v1H177zM162 26h4v1H162zM176 26h2v1H176zM160 27h4v1H160zM155 28h7v1H155zM154 29h6v1H154zM139 32h4v1H139zM152 32h3v1H152zM152 33h1v1H152zM142 35h1v1H142z"/><path fill="#f8f9fd" d="M175 24h2v1H175zM168 25h7v1H168zM131 26h1v1H131zM166 26h10v1H166zM164 27h4v1H164zM175 27h1v1H175zM162 28h6v1H162zM160 29h7v1H160zM154 30h13v1H154zM154 31h7v1H154zM166 31h1v1H166zM128 32h11v1H128zM143 32h1v1H143zM155 32h2v1H155zM128 33h15v1H128zM153 33h3v1H153zM128 34h15v1H128zM152 34h2v1H152zM128 35h14v1H128zM128 36h8v1H128zM128 37h8v1H128zM128 38h7v1H128z"/><path fill="#353436" d="M181 24h2v1H181zM187 26h2v1H187zM195 27h1v1H195zM146 32h2v1H146zM151 54h2v1H151zM153 55h2v1H153zM153 56h1v1H153zM156 57h1v1H156zM158 58h3v1H158zM199 58h1v1H199zM161 59h1v1H161zM165 59h1v1H165zM194 59h1v1H194zM166 60h2v1H166zM166 61h2v1H166zM191 61h1v1H191zM167 62h1v1H167zM173 62h1v1H173zM185 62h1v1H185zM190 62h1v1H190z"/><path fill="#515052" d="M197 24h3v1H197zM198 25h2v1H198zM199 27h1v1H199zM198 28h1v1H198zM195 29h1v1H195zM149 32h1v1H149zM144 47h1v1H144zM154 57h1v1H154zM188 60h1v1H188z"/><path fill="#bebec1" d="M200 24h1v1H200zM197 29h1v1H197zM143 36h1v1H143zM148 38h1v1H148zM153 57h1v1H153zM164 58h1v1H164zM190 59h1v1H190zM175 60h1v1H175zM179 64h1v1H179zM157 108h1v1H157z"/><path fill="#f2f2f4" fill-opacity="0.145098" d="M202 24h1v1H202zM131 25h1v1H131zM205 27h1v1H205zM206 29h1v1H206zM108 36h1v1H108zM97 43h1v1H97zM187 74h1v1H187zM134 83h1v1H134zM173 83h1v1H173zM136 108h1v1H136z"/><path fill="#e3c7c9" fill-opacity="0.003922" d="M130 25h1v1H130zM94 41h1v1H94zM81 47h1v1H81zM72 71h1v1H72zM115 74h1v1H115zM72 75h1v1H72zM126 80h1v1H126zM181 80h1v1H181zM133 102h1v1H133zM340 103h1v1H340zM158 114h1v1H158zM158 115h1v1H158zM143 121h1v1H143z"/><path fill="#f7f8fc" d="M175 25h2v1H175zM168 27h7v1H168zM176 27h1v1H176zM168 28h7v1H168zM177 28h1v1H177zM167 29h3v1H167zM126 30h2v1H126zM167 30h3v1H167zM205 30h1v1H205zM119 31h1v1H119zM126 31h2v1H126zM161 31h5v1H161zM167 31h1v1H167zM169 31h1v1H169zM205 31h1v1H205zM117 32h11v1H117zM157 32h3v1H157zM204 32h2v1H204zM115 33h13v1H115zM156 33h3v1H156zM204 33h2v1H204zM122 34h6v1H122zM154 34h2v1H154zM202 34h5v1H202zM112 35h1v1H112zM123 35h5v1H123zM152 35h1v1H152zM202 35h5v1H202zM123 36h5v1H123zM136 36h7v1H136zM202 36h4v1H202zM125 37h3v1H125zM136 37h8v1H136zM202 37h4v1H202zM126 38h2v1H126zM135 38h3v1H135zM203 38h2v1H203zM128 39h7v1H128zM204 39h1v1H204zM88 40h1v1H88z"/><path fill="#313030" d="M179 25h2v1H179zM184 26h1v1H184zM193 27h1v1H193zM195 28h1v1H195zM146 33h1v1H146zM148 33h1v1H148zM149 34h1v1H149zM149 35h1v1H149zM152 53h1v1H152zM153 54h1v1H153zM156 56h1v1H156zM155 57h1v1H155zM157 57h2v1H157zM199 57h1v1H199zM157 58h1v1H157zM163 59h1v1H163zM161 60h1v1H161zM192 60h1v1H192zM165 61h1v1H165zM170 61h1v1H170zM172 61h19v1H172zM169 62h3v1H169zM184 62h1v1H184zM187 62h2v1H187zM175 63h1v1H175z"/><path fill="#333233" d="M181 25h1v1H181zM185 26h2v1H185zM194 27h1v1H194zM196 28h2v1H196zM145 32h1v1H145zM147 33h1v1H147zM145 48h2v1H145zM145 49h3v1H145zM146 50h3v1H146zM147 51h4v1H147zM148 52h4v1H148zM149 53h3v1H149zM152 55h1v1H152zM155 55h1v1H155zM154 56h1v1H154zM160 59h1v1H160zM162 59h1v1H162zM164 59h1v1H164zM193 59h1v1H193zM162 60h4v1H162zM189 60h1v1H189zM194 60h1v1H194zM168 61h2v1H168zM171 61h1v1H171zM172 62h1v1H172zM174 62h10v1H174zM186 62h1v1H186z"/><path fill="#818082" d="M200 25h1v1H200zM145 50h1v1H145zM147 52h1v1H147zM148 53h1v1H148zM172 60h1v1H172z"/><path fill="#fbfaff" d="M156 26h1v1H156z"/><path fill="#79797c" d="M178 26h1v1H178zM158 56h1v1H158z"/><path fill="#222325" d="M179 26h2v1H179zM185 27h3v1H185zM189 28h3v1H189zM190 29h4v1H190zM144 33h1v1H144zM144 34h1v1H144zM146 35h3v1H146zM148 36h1v1H148zM145 37h1v1H145z"/><path fill="#29292b" d="M181 26h2v1H181zM188 27h4v1H188zM192 28h2v1H192zM194 29h1v1H194zM145 34h4v1H145zM149 36h1v1H149zM198 58h1v1H198zM198 59h1v1H198z"/><path fill="#2f2d2f" d="M183 26h1v1H183zM192 27h1v1H192zM194 28h1v1H194zM145 33h1v1H145zM161 58h1v1H161zM197 58h1v1H197zM159 59h1v1H159zM195 59h3v1H195zM168 60h2v1H168zM190 60h2v1H190zM193 60h1v1H193zM195 60h2v1H195zM164 61h1v1H164zM192 61h2v1H192zM168 62h1v1H168zM189 62h1v1H189zM176 63h8v1H176z"/><path fill="#8b8a8d" d="M200 26h1v1H200zM144 32h1v1H144zM145 46h1v1H145zM152 52h1v1H152zM152 56h1v1H152zM157 59h1v1H157zM173 60h1v1H173zM186 60h1v1H186zM165 62h1v1H165zM170 63h1v1H170z"/><path fill="#f5f5fa" d="M203 26h1v1H203zM201 27h1v1H201zM202 28h1v1H202zM178 29h2v1H178zM201 29h1v1H201zM179 30h2v1H179zM201 30h1v1H201zM180 31h1v1H180zM180 32h6v1H180zM166 33h3v1H166zM170 33h9v1H170zM161 34h3v1H161zM158 35h2v1H158zM151 36h1v1H151zM155 36h2v1H155zM152 37h2v1H152zM107 39h4v1H107zM144 39h2v1H144zM151 39h2v1H151zM114 40h2v1H114zM142 40h2v1H142zM202 40h1v1H202zM85 41h1v1H85zM119 41h5v1H119zM136 41h6v1H136zM202 41h1v1H202zM85 42h3v1H85zM126 42h10v1H126zM202 42h1v1H202zM202 43h1v1H202zM202 44h1v1H202zM202 45h1v1H202zM202 46h1v1H202zM202 47h1v1H202zM201 52h1v1H201zM200 54h1v1H200z"/><path fill="#f5f6fb" d="M177 27h1v1H177zM177 29h1v1H177zM202 29h2v1H202zM176 30h1v1H176zM177 31h3v1H177zM169 32h10v1H169zM179 33h1v1H179zM206 33h1v1H206zM156 35h2v1H156zM112 36h8v1H112zM152 36h3v1H152zM112 37h9v1H112zM112 38h9v1H112zM112 39h9v1H112zM138 39h6v1H138zM116 40h11v1H116zM136 40h6v1H136zM89 41h1v1H89zM124 41h12v1H124zM203 42h1v1H203zM203 43h1v1H203zM203 44h1v1H203zM203 45h1v1H203zM203 46h1v1H203zM203 47h1v1H203zM202 48h1v1H202zM202 49h1v1H202z"/><path fill="#141417" d="M179 27h3v1H179zM180 28h6v1H180zM183 29h3v1H183zM146 36h1v1H146zM146 37h3v1H146z"/><path fill="#1c1c1e" d="M182 27h3v1H182zM186 28h3v1H186zM182 29h1v1H182zM186 29h4v1H186zM144 35h2v1H144zM144 36h2v1H144zM147 36h1v1H147z"/><path fill="#dbdadf" d="M200 27h1v1H200zM88 44h1v1H88zM92 47h1v1H92zM94 48h1v1H94zM87 49h1v1H87zM99 56h1v1H99zM95 57h1v1H95zM95 59h1v1H95zM156 59h1v1H156zM169 59h1v1H169zM180 60h1v1H180zM94 62h1v1H94zM82 63h1v1H82zM81 66h1v1H81zM92 66h1v1H92zM92 67h1v1H92zM92 68h1v1H92zM79 71h1v1H79zM87 72h1v1H87zM79 73h6v1H79zM87 73h1v1H87zM142 106h1v1H142zM158 106h1v1H158zM140 109h1v1H140zM137 113h1v1H137zM161 117h1v1H161z"/><path fill="#faf9fe" d="M154 28h1v1H154z"/><path fill="#f6f7fb" d="M175 28h2v1H175zM170 29h7v1H170zM170 30h6v1H170zM202 30h3v1H202zM168 31h1v1H168zM170 31h7v1H170zM202 31h3v1H202zM179 32h1v1H179zM202 32h2v1H202zM159 33h1v1H159zM202 33h2v1H202zM114 34h8v1H114zM156 34h4v1H156zM113 35h10v1H113zM153 35h3v1H153zM120 36h3v1H120zM121 37h4v1H121zM121 38h5v1H121zM138 38h6v1H138zM121 39h7v1H121zM135 39h3v1H135zM203 39h1v1H203zM127 40h9v1H127zM203 40h2v1H203zM88 41h1v1H88zM90 41h2v1H90zM203 41h2v1H203zM204 42h1v1H204zM204 43h1v1H204zM204 44h1v1H204zM204 45h1v1H204zM203 48h1v1H203z"/><path fill="#e4e5e8" d="M178 28h1v1H178zM92 45h1v1H92zM95 66h1v1H95zM77 72h1v1H77zM76 73h1v1H76z"/><path fill="#f4f3f9" d="M200 28h1v1H200zM183 31h3v1H183zM166 34h3v1H166zM161 35h7v1H161zM160 36h4v1H160zM144 40h9v1H144zM84 44h3v1H84zM85 48h1v1H85zM201 49h1v1H201zM200 51h1v1H200zM199 53h1v1H199zM199 55h1v1H199z"/><path fill="#f4f4f9" d="M201 28h1v1H201zM200 29h1v1H200zM177 30h2v1H177zM181 30h2v1H181zM200 30h1v1H200zM181 31h2v1H181zM200 31h2v1H200zM186 32h2v1H186zM201 32h1v1H201zM169 33h1v1H169zM180 33h7v1H180zM164 34h2v1H164zM179 34h1v1H179zM160 35h1v1H160zM157 36h3v1H157zM154 37h3v1H154zM152 38h3v1H152zM108 40h6v1H108zM201 40h1v1H201zM118 41h1v1H118zM142 41h2v1H142zM201 41h1v1H201zM92 42h2v1H92zM122 42h4v1H122zM136 42h6v1H136zM201 42h1v1H201zM84 43h3v1H84zM128 43h8v1H128zM201 43h1v1H201zM201 44h1v1H201zM201 45h1v1H201zM201 46h1v1H201zM201 47h1v1H201zM201 48h1v1H201zM201 50h1v1H201zM201 51h1v1H201zM84 52h1v1H84z"/><path fill="#f2f3f8" d="M198 29h2v1H198zM195 30h5v1H195zM186 31h1v1H186zM190 31h10v1H190zM188 32h4v1H188zM200 32h1v1H200zM187 33h2v1H187zM200 33h2v1H200zM171 34h8v1H171zM180 34h8v1H180zM200 34h2v1H200zM172 35h8v1H172zM200 35h2v1H200zM200 36h2v1H200zM157 37h3v1H157zM200 37h2v1H200zM155 38h2v1H155zM200 38h3v1H200zM153 39h3v1H153zM201 39h2v1H201zM106 40h2v1H106zM105 41h13v1H105zM91 42h1v1H91zM113 42h9v1H113zM142 42h2v1H142zM92 43h2v1H92zM119 43h9v1H119zM136 43h6v1H136zM124 44h4v1H124zM97 45h1v1H97z"/><path fill="#f8f7fc" d="M121 30h5v1H121zM121 31h5v1H121zM160 32h6v1H160z"/><path fill="#d8d7dc" d="M183 30h1v1H183zM93 48h1v1H93zM94 49h1v1H94zM94 58h1v1H94zM94 59h1v1H94zM83 61h1v1H83zM93 64h1v1H93zM91 65h1v1H91zM82 66h1v1H82zM82 67h1v1H82zM82 68h2v1H82zM86 68h2v1H86zM82 69h2v1H82zM86 69h2v1H86zM83 70h3v1H83zM87 70h3v1H87zM83 71h3v1H83zM89 71h1v1H89zM137 114h1v1H137zM161 118h1v1H161z"/><path fill="#949397" d="M186 30h2v1H186zM146 31h2v1H146zM199 56h1v1H199zM155 58h1v1H155zM167 59h1v1H167zM191 59h1v1H191zM185 60h1v1H185z"/><path fill="#99989b" d="M188 30h1v1H188zM144 37h1v1H144zM146 38h1v1H146zM149 54h1v1H149zM197 57h1v1H197zM159 60h1v1H159z"/><path fill="#cbcacf" d="M193 30h1v1H193zM90 48h1v1H90zM91 49h1v1H91zM92 50h1v1H92zM89 51h2v1H89zM94 51h1v1H94zM90 52h4v1H90zM90 53h4v1H90zM89 54h3v1H89zM91 55h1v1H91zM180 64h3v1H180zM155 106h1v1H155zM154 107h1v1H154zM143 108h1v1H143zM142 109h2v1H142zM160 117h1v1H160z"/><path fill="#f1f2f7" d="M194 30h1v1H194zM187 31h3v1H187zM189 33h3v1H189zM188 34h4v1H188zM180 35h8v1H180zM173 36h3v1H173zM157 38h3v1H157zM156 39h2v1H156zM200 39h1v1H200zM200 40h1v1H200zM200 41h1v1H200zM105 42h8v1H105zM94 43h1v1H94zM113 43h6v1H113zM142 43h2v1H142zM96 44h1v1H96zM119 44h5v1H119zM128 44h8v1H128zM96 45h1v1H96zM124 45h4v1H124zM83 46h1v1H83z"/><path fill="#eae9ee" d="M149 31h1v1H149zM91 44h1v1H91zM175 44h1v1H175zM171 45h1v1H171zM177 45h7v1H177zM95 46h1v1H95zM168 46h1v1H168zM177 46h8v1H177zM96 47h1v1H96zM161 47h2v1H161zM179 47h6v1H179zM98 48h1v1H98zM152 48h9v1H152zM180 48h6v1H180zM98 49h2v1H98zM152 49h1v1H152zM184 49h3v1H184zM105 50h3v1H105zM185 50h4v1H185zM107 51h5v1H107zM141 51h3v1H141zM187 51h3v1H187zM109 52h3v1H109zM140 52h4v1H140zM156 52h1v1H156zM188 52h3v1H188zM115 53h11v1H115zM137 53h2v1H137zM189 53h4v1H189zM116 54h12v1H116zM137 54h2v1H137zM190 54h3v1H190zM117 55h11v1H117zM137 55h2v1H137zM192 55h1v1H192zM191 57h2v1H191zM188 59h1v1H188zM195 62h1v1H195zM80 65h1v1H80zM189 66h2v1H189zM189 67h1v1H189zM78 68h1v1H78zM188 68h1v1H188zM76 69h1v1H76zM188 69h1v1H188zM75 70h1v1H75zM187 70h2v1H187zM187 71h1v1H187zM183 75h1v1H183zM182 76h1v1H182zM181 77h1v1H181zM180 78h1v1H180zM178 79h1v1H178zM157 98h1v1H157zM157 99h1v1H157zM157 100h1v1H157zM157 101h1v1H157zM157 102h1v1H157zM146 106h1v1H146zM146 108h1v1H146zM146 111h1v1H146zM135 112h1v1H135zM146 112h1v1H146zM135 113h1v1H135zM146 113h1v1H146zM134 114h1v1H134zM134 115h1v1H134zM133 116h1v1H133zM146 116h1v1H146zM132 117h1v1H132zM132 118h1v1H132zM146 118h1v1H146zM131 119h1v1H131zM145 119h1v1H145zM131 120h1v1H131zM162 120h1v1H162z"/><path fill="#dedee0" d="M150 32h1v1H150zM154 58h1v1H154zM154 59h1v1H154zM83 60h1v1H83zM163 62h1v1H163zM79 70h1v1H79zM78 73h1v1H78zM78 74h1v1H78zM78 75h2v1H78zM75 76h8v1H75zM77 77h3v1H77zM152 85h8v1H152z"/><path fill="#f7f6fc" d="M166 32h3v1H166zM160 33h6v1H160zM160 34h1v1H160zM86 41h2v1H86zM85 49h1v1H85zM202 50h1v1H202zM202 51h1v1H202zM200 52h1v1H200zM200 53h2v1H200z"/><path fill="#f3f2f8" d="M192 32h8v1H192zM169 34h2v1H169zM168 35h4v1H168zM164 36h4v1H164zM160 37h4v1H160zM153 40h3v1H153zM144 41h2v1H144zM84 45h2v1H84zM84 49h1v1H84zM200 49h1v1H200zM200 50h1v1H200zM84 54h1v1H84zM198 54h2v1H198zM198 55h1v1H198z"/><path fill="#f7f8fa" fill-opacity="0.937255" d="M206 32h1v1H206zM113 34h1v1H113zM86 40h1v1H86z"/><path fill="#f3f3f7" d="M151 33h1v1H151zM151 37h1v1H151zM150 38h2v1H150zM146 39h2v1H146zM149 39h2v1H149zM105 40h1v1H105zM104 41h1v1H104zM197 61h1v1H197z"/><path fill="#f2f1f7" d="M192 33h8v1H192zM192 34h8v1H192zM192 35h8v1H192zM168 36h5v1H168zM192 36h8v1H192zM164 37h2v1H164zM160 38h1v1H160zM156 40h2v1H156zM146 41h7v1H146zM144 42h1v1H144zM86 45h1v1H86zM84 46h2v1H84zM84 47h2v1H84zM200 48h1v1H200zM84 51h2v1H84zM199 51h1v1H199zM198 52h2v1H198zM198 53h1v1H198zM81 58h1v1H81zM81 59h1v1H81zM80 62h1v1H80zM196 62h1v1H196zM195 63h1v1H195zM162 90h1v1H162z"/><path fill="#e0e0e2" d="M151 34h1v1H151zM91 45h1v1H91zM94 47h1v1H94zM82 62h1v1H82zM95 64h1v1H95zM79 69h1v1H79zM78 72h1v1H78zM75 75h3v1H75z"/><path fill="#e4e3e8" d="M151 35h1v1H151zM150 37h1v1H150zM90 44h1v1H90zM165 51h5v1H165zM161 52h3v1H161zM170 52h6v1H170zM100 53h1v1H100zM156 53h1v1H156zM160 53h1v1H160zM162 53h1v1H162zM176 53h2v1H176zM100 54h1v1H100zM156 54h1v1H156zM180 54h1v1H180zM102 55h2v1H102zM183 55h1v1H183zM150 56h1v1H150zM184 56h2v1H184zM106 57h1v1H106zM149 57h1v1H149zM186 57h1v1H186zM107 58h1v1H107zM146 58h2v1H146zM185 58h1v1H185zM83 59h1v1H83zM108 59h1v1H108zM145 59h1v1H145zM184 59h1v1H184zM109 60h13v1H109zM142 60h3v1H142zM122 61h20v1H122zM123 62h5v1H123zM179 65h2v1H179zM179 66h2v1H179zM179 67h2v1H179zM179 68h2v1H179zM179 69h2v1H179zM78 70h1v1H78zM179 70h2v1H179zM179 71h2v1H179zM178 72h2v1H178zM77 73h1v1H77zM178 73h2v1H178zM75 74h1v1H75zM178 74h2v1H178zM178 75h2v1H178zM177 76h1v1H177zM176 77h1v1H176zM175 78h1v1H175zM175 79h1v1H175zM131 80h1v1H131zM135 82h1v1H135zM137 83h1v1H137zM151 92h1v1H151zM153 95h1v1H153zM153 96h1v1H153zM150 97h2v1H150zM149 98h3v1H149zM149 99h3v1H149zM147 100h3v1H147zM147 101h2v1H147zM145 102h3v1H145zM145 103h3v1H145zM132 104h1v1H132zM141 104h1v1H141zM133 105h1v1H133zM135 105h1v1H135zM141 105h1v1H141zM134 106h1v1H134zM137 107h1v1H137zM150 108h1v1H150zM148 109h1v1H148zM138 110h1v1H138zM149 110h1v1H149zM148 113h1v1H148zM135 114h1v1H135zM135 115h1v1H135zM134 116h1v1H134zM147 116h1v1H147zM133 117h1v1H133zM133 118h1v1H133zM132 119h1v1H132z"/><path fill="#f0f1f6" d="M188 35h4v1H188zM176 36h12v1H176zM189 36h3v1H189zM191 37h1v1H191zM149 38h1v1H149zM148 39h1v1H148zM158 39h2v1H158zM90 42h1v1H90zM104 42h1v1H104zM200 42h1v1H200zM95 43h1v1H95zM104 43h9v1H104zM200 43h1v1H200zM93 44h3v1H93zM97 44h1v1H97zM113 44h6v1H113zM136 44h8v1H136zM200 44h1v1H200zM98 45h1v1H98zM119 45h5v1H119zM128 45h8v1H128zM200 45h1v1H200zM97 46h1v1H97zM124 46h4v1H124zM200 46h1v1H200zM83 47h1v1H83zM200 47h1v1H200z"/><path fill="#eff0f5" d="M188 36h1v1H188zM174 37h17v1H174zM112 44h1v1H112zM113 45h6v1H113zM119 46h5v1H119zM124 47h4v1H124z"/><path fill="#f1f0f6" d="M166 37h3v1H166zM192 37h8v1H192zM161 38h7v1H161zM190 38h10v1H190zM160 39h8v1H160zM192 39h8v1H192zM158 40h6v1H158zM153 41h5v1H153zM145 42h2v1H145zM102 43h1v1H102zM144 43h2v1H144zM86 46h1v1H86zM86 47h1v1H86zM199 48h1v1H199zM83 49h1v1H83zM199 49h1v1H199zM82 50h2v1H82zM198 50h2v1H198zM82 51h2v1H82zM198 51h1v1H198zM82 52h2v1H82zM197 52h1v1H197zM82 53h3v1H82zM197 53h1v1H197zM82 54h2v1H82zM197 54h1v1H197zM82 55h2v1H82zM197 55h1v1H197zM80 56h3v1H80zM81 57h2v1H81zM82 58h1v1H82zM82 59h1v1H82zM81 60h1v1H81zM81 61h1v1H81zM80 63h1v1H80zM162 112h1v1H162zM162 113h1v1H162zM162 114h1v1H162z"/><path fill="#f0eff4" d="M169 37h1v1H169zM168 38h2v1H168zM168 39h2v1H168zM189 39h3v1H189zM190 40h10v1H190zM191 41h9v1H191zM103 42h1v1H103zM147 42h5v1H147zM192 42h8v1H192zM103 43h1v1H103zM146 43h6v1H146zM192 43h8v1H192zM144 44h8v1H144zM192 44h8v1H192zM144 45h7v1H144zM192 45h8v1H192zM194 46h6v1H194zM196 47h4v1H196zM197 48h2v1H197zM197 49h2v1H197zM81 53h1v1H81zM81 54h1v1H81zM81 55h1v1H81zM83 56h1v1H83zM80 57h1v1H80zM195 57h1v1H195zM80 58h1v1H80zM80 59h1v1H80zM80 60h1v1H80zM80 61h1v1H80zM194 65h1v1H194z"/><path fill="#f0eff5" d="M170 37h4v1H170zM170 38h8v1H170zM185 38h1v1H185zM170 39h2v1H170zM164 40h6v1H164zM158 41h6v1H158zM152 42h5v1H152zM84 50h2v1H84zM197 50h1v1H197zM197 51h1v1H197zM196 53h1v1H196zM196 54h1v1H196zM196 55h1v1H196zM162 91h1v1H162zM162 110h1v1H162zM162 111h1v1H162zM162 115h1v1H162z"/><path fill="#d9d8dd" d="M145 38h1v1H145zM89 45h1v1H89zM91 46h1v1H91zM147 47h1v1H147zM95 49h1v1H95zM96 50h2v1H96zM96 51h2v1H96zM95 56h1v1H95zM84 58h1v1H84zM95 58h1v1H95zM94 60h1v1H94zM158 60h1v1H158zM178 60h1v1H178zM94 61h1v1H94zM159 61h1v1H159zM94 63h1v1H94zM94 64h1v1H94zM92 65h2v1H92zM91 66h1v1H91zM93 66h1v1H93zM90 67h2v1H90zM80 68h2v1H80zM90 68h2v1H90zM80 69h2v1H80zM90 69h3v1H90zM80 70h3v1H80zM86 70h1v1H86zM90 70h2v1H90zM80 71h3v1H80zM86 71h3v1H86zM90 71h2v1H90zM79 72h8v1H79zM85 73h2v1H85zM143 105h1v1H143zM157 105h1v1H157zM152 108h1v1H152zM159 108h1v1H159zM138 112h1v1H138zM135 116h1v1H135zM134 117h1v1H134z"/><path fill="#7d7d7f" d="M147 38h1v1H147zM192 62h1v1H192z"/><path fill="#efeef4" d="M178 38h7v1H178zM186 38h4v1H186zM172 39h4v1H172zM170 40h6v1H170zM164 41h4v1H164zM157 42h7v1H157zM152 43h3v1H152zM152 44h3v1H152zM152 45h1v1H152zM122 48h5v1H122zM196 50h1v1H196zM196 51h1v1H196zM196 52h1v1H196zM160 91h2v1H160zM163 91h1v1H163zM160 92h4v1H160zM160 93h4v1H160zM160 94h4v1H160zM160 95h4v1H160zM160 96h4v1H160zM161 97h3v1H161zM161 98h3v1H161zM161 99h3v1H161zM161 100h3v1H161zM162 101h2v1H162zM162 102h2v1H162zM162 103h2v1H162zM162 104h2v1H162zM162 105h2v1H162zM162 106h2v1H162zM162 107h2v1H162zM162 108h2v1H162zM162 109h2v1H162zM163 110h1v1H163zM163 111h1v1H163zM163 112h1v1H163zM163 113h1v1H163zM163 114h1v1H163zM163 115h1v1H163zM163 116h1v1H163zM163 117h1v1H163zM163 118h1v1H163z"/><path fill="#efeef3" d="M176 39h13v1H176zM186 40h2v1H186zM189 40h1v1H189zM190 41h1v1H190zM88 42h1v1H88zM189 42h3v1H189zM189 43h3v1H189zM92 44h1v1H92zM102 44h2v1H102zM189 44h3v1H189zM94 45h1v1H94zM104 45h2v1H104zM151 45h1v1H151zM190 45h2v1H190zM106 46h7v1H106zM190 46h4v1H190zM113 47h6v1H113zM136 47h4v1H136zM191 47h5v1H191zM84 48h1v1H84zM86 48h1v1H86zM194 48h3v1H194zM195 49h2v1H195zM85 52h1v1H85zM195 56h3v1H195zM79 58h1v1H79zM79 59h1v1H79zM78 60h2v1H78zM78 61h2v1H78zM80 64h1v1H80zM163 119h1v1H163z"/><path fill="#eeedf2" d="M176 40h6v1H176zM185 40h1v1H185zM188 40h1v1H188zM176 41h2v1H176zM187 41h3v1H187zM187 42h2v1H187zM188 43h1v1H188zM101 44h1v1H101zM188 44h1v1H188zM101 45h3v1H101zM147 46h5v1H147zM112 47h1v1H112zM148 47h1v1H148zM150 47h1v1H150zM190 47h1v1H190zM191 48h3v1H191zM193 49h2v1H193zM194 50h2v1H194zM83 57h1v1H83zM78 62h2v1H78zM81 62h1v1H81zM78 63h2v1H78zM194 63h1v1H194zM194 64h1v1H194zM193 66h1v1H193zM159 91h1v1H159zM159 92h1v1H159zM159 93h1v1H159zM159 94h1v1H159zM159 95h1v1H159zM159 96h1v1H159zM159 97h1v1H159zM159 98h1v1H159z"/><path fill="#edecf1" d="M182 40h3v1H182zM178 41h9v1H178zM176 42h5v1H176zM183 42h4v1H183zM185 43h3v1H185zM188 45h2v1H188zM99 46h2v1H99zM102 46h2v1H102zM188 46h2v1H188zM97 47h1v1H97zM104 47h1v1H104zM188 47h2v1H188zM189 48h2v1H189zM86 49h1v1H86zM190 49h3v1H190zM192 50h2v1H192zM194 51h1v1H194zM194 57h1v1H194zM191 63h1v1H191zM193 63h1v1H193zM193 64h1v1H193zM192 66h1v1H192zM192 67h1v1H192zM183 76h1v1H183zM158 96h1v1H158zM159 99h1v1H159zM159 100h1v1H159zM159 101h1v1H159zM159 102h1v1H159zM159 103h1v1H159z"/><path fill="#f2f1f5" fill-opacity="0.933333" d="M103 41h1v1H103zM82 49h1v1H82z"/><path fill="#eeedf3" d="M168 41h8v1H168zM164 42h9v1H164zM155 43h15v1H155zM155 44h5v1H155zM153 45h7v1H153zM116 48h6v1H116zM127 48h13v1H127zM122 49h6v1H122zM195 51h1v1H195zM195 52h1v1H195zM195 53h1v1H195zM195 54h1v1H195zM195 55h1v1H195zM195 64h1v1H195zM161 90h1v1H161zM163 90h1v1H163zM160 97h1v1H160zM160 98h1v1H160zM160 99h1v1H160zM160 100h1v1H160zM161 101h1v1H161zM161 102h1v1H161zM161 103h1v1H161zM162 116h1v1H162z"/><path fill="#eeeff4" d="M89 42h1v1H89zM104 44h2v1H104zM100 45h1v1H100zM106 45h7v1H106zM113 46h6v1H113zM136 46h8v1H136zM119 47h5v1H119zM130 47h6v1H130zM140 47h4v1H140z"/><path fill="#edecf2" d="M173 42h3v1H173zM170 43h3v1H170zM160 44h10v1H160zM160 45h4v1H160zM152 46h7v1H152zM106 48h10v1H106zM140 48h4v1H140zM112 49h10v1H112zM128 49h12v1H128zM122 50h16v1H122zM194 52h1v1H194zM193 65h1v1H193zM160 101h1v1H160zM160 102h1v1H160zM161 104h1v1H161zM161 105h1v1H161zM161 106h1v1H161zM161 107h1v1H161zM161 108h1v1H161zM161 109h1v1H161zM161 110h1v1H161zM161 111h1v1H161zM162 117h1v1H162z"/><path fill="#ecebf0" d="M181 42h2v1H181zM176 43h4v1H176zM181 43h4v1H181zM185 44h3v1H185zM186 45h2v1H186zM101 46h1v1H101zM186 46h2v1H186zM102 47h2v1H102zM149 47h1v1H149zM151 47h1v1H151zM186 47h2v1H186zM102 48h2v1H102zM150 48h1v1H150zM187 48h2v1H187zM188 49h2v1H188zM190 50h2v1H190zM191 51h3v1H191zM193 52h1v1H193zM192 56h1v1H192zM193 57h1v1H193zM82 60h1v1H82zM191 66h1v1H191zM74 68h2v1H74zM74 69h1v1H74zM190 69h1v1H190zM158 91h1v1H158zM158 92h1v1H158zM158 93h1v1H158zM158 94h1v1H158zM158 95h1v1H158zM158 97h1v1H158zM158 98h1v1H158zM158 101h1v1H158zM158 102h1v1H158zM158 103h1v1H158z"/><path fill="#e6e5ea" d="M87 43h1v1H87zM176 51h2v1H176zM98 52h1v1H98zM101 52h3v1H101zM153 52h2v1H153zM159 52h1v1H159zM180 52h1v1H180zM102 53h2v1H102zM182 53h2v1H182zM184 54h1v1H184zM185 55h2v1H185zM84 56h1v1H84zM106 56h1v1H106zM145 56h4v1H145zM198 56h1v1H198zM109 57h2v1H109zM138 57h4v1H138zM152 57h1v1H152zM110 58h10v1H110zM127 58h3v1H127zM122 59h6v1H122zM184 64h2v1H184zM184 65h2v1H184zM184 66h1v1H184zM183 67h1v1H183zM182 68h4v1H182zM78 69h1v1H78zM182 70h2v1H182zM183 71h1v1H183zM182 72h1v1H182zM75 73h1v1H75zM181 73h1v1H181zM74 74h1v1H74zM180 75h1v1H180zM178 76h2v1H178z"/><path fill="#e2e2e4" d="M88 43h1v1H88zM93 46h1v1H93zM95 47h1v1H95zM155 59h1v1H155zM157 60h1v1H157zM95 65h1v1H95zM78 71h1v1H78zM76 74h2v1H76zM118 74h2v1H118zM119 75h2v1H119zM151 90h1v1H151z"/><path fill="#e5e6eb" d="M89 43h1v1H89zM155 91h2v1H155zM155 92h2v1H155zM155 93h2v1H155zM155 94h2v1H155zM155 95h2v1H155zM155 96h2v1H155zM155 97h1v1H155zM155 98h1v1H155zM155 99h1v1H155zM155 100h1v1H155zM155 101h1v1H155zM152 102h4v1H152zM152 103h4v1H152z"/><path fill="#eff0f4" d="M91 43h1v1H91zM106 44h6v1H106zM95 45h1v1H95zM136 45h8v1H136zM96 46h1v1H96zM98 46h1v1H98zM128 46h8v1H128zM128 47h2v1H128zM83 48h1v1H83z"/><path fill="#edecf0" fill-opacity="0.721569" d="M96 43h1v1H96zM82 48h1v1H82zM78 59h1v1H78zM96 64h1v1H96zM73 70h1v1H73zM185 75h1v1H185zM135 111h1v1H135zM132 116h1v1H132z"/><path fill="#ebebef" fill-opacity="0.882353" d="M101 43h1v1H101zM81 52h1v1H81zM192 68h1v1H192zM73 72h1v1H73zM186 74h1v1H186zM179 79h1v1H179zM140 103h1v1H140zM145 114h1v1H145zM131 118h1v1H131z"/><path fill="#ecebf1" d="M173 43h3v1H173zM170 44h3v1H170zM164 45h6v1H164zM159 46h3v1H159zM152 47h1v1H152zM159 47h1v1H159zM104 48h2v1H104zM106 49h6v1H106zM140 49h3v1H140zM151 49h1v1H151zM112 50h10v1H112zM138 50h6v1H138zM123 51h15v1H123zM124 52h13v1H124zM194 53h1v1H194zM194 54h1v1H194zM84 55h1v1H84zM194 55h1v1H194zM192 64h1v1H192zM192 65h1v1H192zM160 103h1v1H160zM160 104h1v1H160zM160 106h1v1H160zM137 109h1v1H137zM146 109h1v1H146zM162 118h1v1H162z"/><path fill="#ebeaf0" d="M180 43h1v1H180zM173 44h2v1H173zM176 44h9v1H176zM170 45h1v1H170zM184 45h2v1H184zM162 46h6v1H162zM185 46h1v1H185zM101 47h1v1H101zM153 47h6v1H153zM160 47h1v1H160zM185 47h1v1H185zM99 48h3v1H99zM151 48h1v1H151zM186 48h1v1H186zM100 49h6v1H100zM143 49h1v1H143zM150 49h1v1H150zM187 49h1v1H187zM108 50h4v1H108zM189 50h1v1H189zM112 51h11v1H112zM138 51h3v1H138zM190 51h1v1H190zM112 52h12v1H112zM137 52h3v1H137zM191 52h2v1H191zM85 53h1v1H85zM126 53h11v1H126zM193 53h1v1H193zM128 54h9v1H128zM193 54h1v1H193zM128 55h9v1H128zM193 55h1v1H193zM193 56h2v1H193zM192 58h1v1H192zM192 63h1v1H192zM190 64h2v1H190zM190 65h2v1H190zM190 67h2v1H190zM189 68h3v1H189zM189 69h1v1H189zM189 70h1v1H189zM188 71h1v1H188zM180 77h1v1H180zM160 105h1v1H160zM146 107h1v1H146zM160 107h1v1H160zM136 110h1v1H136zM146 110h1v1H146zM136 111h1v1H136zM146 117h1v1H146zM145 118h1v1H145zM162 119h1v1H162z"/><path fill="#e5e4e9" d="M87 44h1v1H87zM97 48h1v1H97zM176 52h4v1H176zM101 53h1v1H101zM155 53h1v1H155zM157 53h3v1H157zM178 53h4v1H178zM101 54h3v1H101zM181 54h3v1H181zM100 55h2v1H100zM184 55h1v1H184zM149 56h1v1H149zM107 57h2v1H107zM142 57h7v1H142zM108 58h2v1H108zM130 58h16v1H130zM109 59h13v1H109zM128 59h17v1H128zM122 60h20v1H122zM181 65h3v1H181zM181 66h3v1H181zM181 67h2v1H181zM181 68h1v1H181zM181 69h3v1H181zM181 70h1v1H181zM181 71h2v1H181zM180 72h2v1H180zM180 73h1v1H180zM180 74h1v1H180zM177 77h1v1H177zM176 78h1v1H176zM152 91h1v1H152zM152 92h2v1H152zM152 93h2v1H152zM152 94h2v1H152zM152 95h1v1H152zM152 96h1v1H152zM152 97h1v1H152z"/><path fill="#dddce1" d="M89 44h1v1H89zM92 46h1v1H92zM93 47h1v1H93zM95 48h1v1H95zM97 49h1v1H97zM100 56h1v1H100zM156 60h1v1H156zM179 60h1v1H179zM95 61h1v1H95zM160 61h1v1H160zM161 62h1v1H161zM93 68h1v1H93zM90 72h1v1H90zM152 74h1v1H152zM85 75h1v1H85zM145 75h12v1H145zM83 76h1v1H83zM147 76h12v1H147zM147 77h13v1H147zM147 78h14v1H147zM145 79h17v1H145zM145 80h2v1H145zM152 80h9v1H152zM145 81h3v1H145zM152 81h8v1H152zM145 82h1v1H145zM147 82h3v1H147zM152 82h8v1H152zM147 83h6v1H147zM147 84h5v1H147zM149 85h3v1H149zM151 86h1v1H151zM152 107h1v1H152zM139 110h1v1H139zM138 111h1v1H138zM149 114h1v1H149z"/><path fill="#edecf1" fill-opacity="0.670588" d="M100 44h1v1H100zM194 66h1v1H194zM176 81h1v1H176zM174 82h1v1H174z"/><path fill="#ededf0" fill-opacity="0.847059" d="M83 45h1v1H83zM77 61h1v1H77zM193 67h1v1H193zM73 73h1v1H73zM134 113h1v1H134zM145 113h1v1H145z"/><path fill="#e3e2e7" d="M87 45h1v1H87zM96 48h1v1H96zM164 52h6v1H164zM99 53h1v1H99zM161 53h1v1H161zM163 53h13v1H163zM157 54h4v1H157zM162 54h1v1H162zM165 54h2v1H165zM170 54h10v1H170zM176 55h7v1H176zM104 56h2v1H104zM151 56h1v1H151zM163 56h1v1H163zM165 56h1v1H165zM176 56h8v1H176zM165 57h1v1H165zM184 57h2v1H184zM106 58h1v1H106zM148 58h1v1H148zM152 58h2v1H152zM184 58h1v1H184zM107 59h1v1H107zM146 59h1v1H146zM183 59h1v1H183zM107 60h2v1H107zM145 60h1v1H145zM109 61h13v1H109zM142 61h2v1H142zM109 62h14v1H109zM128 62h10v1H128zM123 63h5v1H123zM190 63h1v1H190zM81 64h1v1H81zM177 65h2v1H177zM80 66h1v1H80zM177 66h2v1H177zM177 67h2v1H177zM177 68h2v1H177zM176 69h3v1H176zM176 70h3v1H176zM176 71h3v1H176zM176 72h2v1H176zM176 73h2v1H176zM176 74h2v1H176zM174 75h4v1H174zM176 76h1v1H176zM123 77h4v1H123zM174 77h2v1H174zM125 78h3v1H125zM129 78h2v1H129zM173 78h2v1H173zM127 79h1v1H127zM129 79h2v1H129zM172 79h3v1H172zM129 80h2v1H129zM132 80h4v1H132zM171 80h4v1H171zM132 81h4v1H132zM170 81h3v1H170zM134 82h1v1H134zM136 82h2v1H136zM170 82h2v1H170zM138 83h1v1H138zM170 83h1v1H170zM151 91h1v1H151zM150 92h1v1H150zM148 93h2v1H148zM148 96h4v1H148zM148 97h2v1H148zM147 98h2v1H147zM143 99h1v1H143zM146 99h3v1H146zM143 100h4v1H143zM142 101h1v1H142zM144 101h3v1H144zM144 102h1v1H144zM144 103h1v1H144zM154 104h1v1H154zM153 105h1v1H153zM158 105h1v1H158zM138 106h1v1H138zM139 109h1v1H139zM148 110h1v1H148zM147 117h1v1H147zM147 118h1v1H147z"/><path fill="#dcdbe0" d="M90 45h1v1H90zM96 49h1v1H96zM85 55h1v1H85zM165 58h1v1H165zM95 60h1v1H95zM164 63h1v1H164zM94 65h1v1H94zM93 67h1v1H93zM88 72h1v1H88zM79 74h9v1H79zM147 80h5v1H147zM148 81h4v1H148zM150 82h2v1H150zM154 105h1v1H154zM153 106h1v1H153zM141 107h1v1H141zM151 109h1v1H151zM150 111h1v1H150zM136 114h1v1H136z"/><path fill="#efeff3" fill-opacity="0.92549" d="M99 45h1v1H99zM80 55h1v1H80zM188 72h1v1H188z"/><path fill="#e9e8ee" d="M172 45h4v1H172zM169 46h1v1H169zM174 46h2v1H174zM163 47h5v1H163zM175 47h1v1H175zM161 48h3v1H161zM153 49h8v1H153zM104 50h1v1H104zM155 50h5v1H155zM105 51h2v1H105zM107 52h2v1H107zM144 52h2v1H144zM108 53h7v1H108zM139 53h7v1H139zM109 54h7v1H109zM139 54h4v1H139zM144 54h2v1H144zM109 55h8v1H109zM139 55h3v1H139zM119 56h9v1H119zM190 56h1v1H190zM190 57h1v1H190zM159 104h1v1H159zM145 105h1v1H145zM159 105h1v1H159zM145 106h1v1H145zM145 107h1v1H145zM138 108h1v1H138zM160 108h1v1H160zM138 109h1v1H138zM137 110h1v1H137zM161 112h1v1H161z"/><path fill="#e2e1e6" d="M87 46h1v1H87zM87 47h1v1H87zM86 51h1v1H86zM99 54h1v1H99zM158 55h1v1H158zM102 56h2v1H102zM105 57h1v1H105zM150 57h2v1H150zM196 57h1v1H196zM105 58h1v1H105zM149 58h3v1H149zM106 59h1v1H106zM147 59h4v1H147zM153 59h1v1H153zM106 60h1v1H106zM146 60h6v1H146zM153 60h1v1H153zM107 61h2v1H107zM144 61h9v1H144zM107 62h2v1H107zM138 62h14v1H138zM107 63h16v1H107zM128 63h22v1H128zM128 64h2v1H128zM135 64h9v1H135zM138 65h6v1H138zM176 65h1v1H176zM176 66h1v1H176zM175 67h2v1H175zM109 68h3v1H109zM174 68h3v1H174zM111 69h1v1H111zM173 69h3v1H173zM173 70h3v1H173zM173 71h3v1H173zM115 72h1v1H115zM174 72h2v1H174zM116 73h4v1H116zM174 73h2v1H174zM174 74h2v1H174zM121 75h2v1H121zM121 76h1v1H121zM173 76h3v1H173zM172 77h2v1H172zM171 78h2v1H171zM128 79h1v1H128zM170 79h2v1H170zM170 80h1v1H170zM168 81h2v1H168zM138 82h1v1H138zM168 82h2v1H168zM139 83h1v1H139zM168 83h2v1H168zM166 84h2v1H166zM148 90h3v1H148zM148 91h2v1H148zM146 94h1v1H146zM157 104h1v1H157z"/><path fill="#d4d4d7" d="M88 46h2v1H88zM93 49h1v1H93zM94 50h1v1H94zM87 51h1v1H87zM86 53h1v1H86zM95 55h1v1H95zM85 56h1v1H85zM94 56h1v1H94zM84 59h1v1H84zM93 59h1v1H93zM181 60h1v1H181zM85 61h2v1H85zM83 62h10v1H83zM86 63h1v1H86zM88 63h4v1H88zM83 64h1v1H83zM86 64h5v1H86zM183 64h1v1H183zM86 65h5v1H86zM86 66h2v1H86zM155 105h2v1H155zM142 107h1v1H142zM159 109h1v1H159zM139 112h1v1H139zM160 112h1v1H160zM138 113h1v1H138zM160 113h1v1H160zM161 119h1v1H161z"/><path fill="#e8e7ec" d="M94 46h1v1H94zM170 46h4v1H170zM168 47h7v1H168zM149 48h1v1H149zM164 48h1v1H164zM169 48h9v1H169zM161 49h3v1H161zM174 49h8v1H174zM86 50h1v1H86zM98 50h4v1H98zM160 50h1v1H160zM177 50h6v1H177zM100 51h5v1H100zM157 51h4v1H157zM180 51h5v1H180zM106 52h1v1H106zM155 52h1v1H155zM184 52h3v1H184zM106 53h2v1H106zM186 53h2v1H186zM107 54h2v1H107zM143 54h1v1H143zM187 54h2v1H187zM107 55h2v1H107zM142 55h3v1H142zM188 55h2v1H188zM109 56h10v1H109zM138 56h4v1H138zM189 56h1v1H189zM191 56h1v1H191zM120 57h8v1H120zM96 60h1v1H96zM82 61h1v1H82zM188 64h1v1H188zM187 65h2v1H187zM187 66h1v1H187zM187 67h1v1H187zM79 68h1v1H79zM186 68h1v1H186zM185 69h2v1H185zM77 70h1v1H77zM76 71h2v1H76zM75 72h2v1H75zM184 72h1v1H184zM74 73h1v1H74zM182 73h4v1H182zM182 74h2v1H182zM182 75h1v1H182zM180 76h1v1H180zM177 79h1v1H177zM176 80h1v1H176zM175 81h1v1H175zM156 97h1v1H156zM156 98h1v1H156zM156 99h1v1H156zM139 105h2v1H139zM146 105h1v1H146zM139 106h1v1H139zM145 108h1v1H145zM147 109h1v1H147zM146 119h1v1H146zM146 120h1v1H146z"/><path fill="#ededf0" d="M104 46h2v1H104zM98 47h1v1H98zM105 47h7v1H105zM77 62h1v1H77zM77 63h1v1H77zM76 64h4v1H76zM76 65h4v1H76zM75 66h5v1H75zM75 67h5v1H75z"/><path fill="#e31f1c" fill-opacity="0.368627" d="M261 46h1v1H261zM223 59h1v1H223zM241 73h1v1H241zM306 90h1v1H306zM233 97h1v1H233zM245 99h1v1H245zM327 104h1v1H327zM273 109h1v1H273zM227 110h1v1H227zM358 110h1v1H358zM351 114h1v1H351zM351 115h1v1H351zM351 116h1v1H351zM351 117h1v1H351zM351 118h1v1H351zM365 118h1v1H365zM351 119h1v1H351zM351 120h1v1H351z"/><path fill="#e1211d" fill-opacity="0.72549" d="M262 46h11v1H262zM341 46h11v1H341z"/><path fill="#e2201c" fill-opacity="0.635294" d="M273 46h1v1H273zM328 76h1v1H328zM405 79h1v1H405zM331 96h1v1H331zM399 98h1v1H399zM242 103h1v1H242zM304 103h1v1H304zM405 111h1v1H405zM255 113h1v1H255zM366 117h1v1H366zM262 120h1v1H262zM254 121h1v1H254zM352 121h1v1H352z"/><path fill="#c40000" fill-opacity="0.003922" d="M274 46h1v1H274zM80 51h1v1H80zM343 71h1v1H343zM145 87h1v1H145zM385 97h1v1H385zM245 100h1v1H245zM274 104h1v1H274zM274 105h1v1H274zM326 105h1v1H326zM403 105h1v1H403zM404 107h1v1H404zM156 111h1v1H156zM226 111h1v1H226zM271 115h1v1H271zM397 115h1v1H397zM321 116h1v1H321zM399 118h1v1H399zM362 120h1v1H362zM359 121h1v1H359z"/><path fill="#df271f" fill-opacity="0.039216" d="M339 46h1v1H339zM346 63h1v1H346zM332 64h1v1H332zM344 68h1v1H344zM327 77h1v1H327zM325 82h1v1H325zM233 96h1v1H233zM387 100h1v1H387zM328 101h1v1H328zM372 106h1v1H372zM295 108h1v1H295zM336 109h1v1H336zM393 109h1v1H393zM371 111h1v1H371zM334 112h1v1H334zM299 114h1v1H299zM367 117h1v1H367zM330 118h1v1H330zM232 119h1v1H232zM264 120h1v1H264z"/><path fill="#e2201c" fill-opacity="0.717647" d="M340 46h1v1H340zM372 79h1v1H372zM229 90h1v1H229zM398 96h1v1H398zM326 107h1v1H326zM226 113h1v1H226z"/><path fill="#d61929" fill-opacity="0.345098" d="M352 46h1v1H352zM341 75h1v1H341zM352 113h1v1H352zM223 119h1v1H223z"/><path fill="#d1d0d4" d="M88 47h1v1H88zM91 48h1v1H91zM149 49h1v1H149zM93 50h1v1H93zM150 50h1v1H150zM87 52h1v1H87zM95 52h1v1H95zM95 53h1v1H95zM94 54h1v1H94zM93 55h1v1H93zM93 56h1v1H93zM85 57h1v1H85zM90 57h1v1H90zM86 58h2v1H86zM89 58h4v1H89zM85 59h4v1H85zM91 59h1v1H91zM88 60h1v1H88zM88 61h1v1H88zM141 109h1v1H141zM140 111h1v1H140zM160 115h1v1H160z"/><path fill="#d3d2d6" d="M89 47h2v1H89zM92 48h1v1H92zM95 51h1v1H95zM95 54h1v1H95zM94 55h1v1H94zM93 57h1v1H93zM93 58h1v1H93zM89 59h2v1H89zM92 59h1v1H92zM84 60h4v1H84zM89 60h4v1H89zM177 60h1v1H177zM84 61h1v1H84zM87 61h1v1H87zM89 61h4v1H89zM83 63h1v1H83zM168 63h1v1H168zM143 106h1v1H143zM154 106h1v1H154zM153 107h1v1H153zM160 114h1v1H160zM161 120h1v1H161z"/><path fill="#e2201c" fill-opacity="0.513725" d="M261 47h1v1H261zM261 48h1v1H261zM261 49h1v1H261zM261 50h1v1H261zM342 72h1v1H342zM359 87h1v1H359zM261 91h1v1H261zM261 92h1v1H261zM261 93h1v1H261zM261 94h1v1H261zM261 95h1v1H261zM261 96h1v1H261zM261 97h1v1H261zM261 98h1v1H261zM261 99h1v1H261zM261 100h1v1H261zM261 101h1v1H261zM261 102h1v1H261zM401 102h1v1H401zM261 103h1v1H261zM261 104h1v1H261zM261 105h1v1H261zM229 106h1v1H229zM336 108h1v1H336zM260 110h1v1H260zM297 110h1v1H297zM332 114h1v1H332zM301 116h1v1H301zM267 118h1v1H267zM355 121h1v1H355z"/><path fill="#e2211b" d="M262 47h10v1H262zM224 52h2v1H224zM224 53h2v1H224zM224 54h2v1H224zM224 55h2v1H224zM240 72h16v1H240zM400 102h1v1H400zM400 103h1v1H400zM240 104h1v1H240zM272 104h1v1H272zM240 105h1v1H240zM272 105h1v1H272zM272 106h1v1H272zM272 107h1v1H272zM272 108h1v1H272zM272 109h1v1H272zM272 110h1v1H272zM256 120h4v1H256z"/><path fill="#e2201c" d="M272 47h1v1H272zM262 48h11v1H262zM340 48h11v1H340zM262 49h11v1H262zM339 49h12v1H339zM262 50h11v1H262zM339 50h11v1H339zM262 51h11v1H262zM339 51h11v1H339zM226 52h86v1H226zM321 52h88v1H321zM226 53h86v1H226zM321 53h88v1H321zM226 54h86v1H226zM321 54h88v1H321zM226 55h86v1H226zM321 55h88v1H321zM224 56h88v1H224zM321 56h88v1H321zM224 57h88v1H224zM321 57h88v1H321zM224 58h88v1H224zM321 58h88v1H321zM335 59h12v1H335zM335 60h12v1H335zM335 61h11v1H335zM334 62h12v1H334zM334 63h11v1H334zM334 64h11v1H334zM333 65h12v1H333zM230 66h76v1H230zM333 66h11v1H333zM230 67h76v1H230zM332 67h12v1H332zM230 68h76v1H230zM332 68h11v1H332zM360 68h12v1H360zM230 69h76v1H230zM332 69h11v1H332zM360 69h12v1H360zM230 70h76v1H230zM331 70h12v1H331zM360 70h12v1H360zM230 71h76v1H230zM331 71h11v1H331zM360 71h12v1H360zM230 72h10v1H230zM256 72h50v1H256zM331 72h11v1H331zM360 72h12v1H360zM230 73h10v1H230zM295 73h11v1H295zM330 73h11v1H330zM360 73h12v1H360zM230 74h10v1H230zM295 74h11v1H295zM330 74h11v1H330zM360 74h12v1H360zM230 75h10v1H230zM295 75h11v1H295zM329 75h12v1H329zM360 75h12v1H360zM230 76h10v1H230zM295 76h11v1H295zM329 76h11v1H329zM360 76h12v1H360zM230 77h10v1H230zM295 77h11v1H295zM329 77h11v1H329zM360 77h12v1H360zM230 78h10v1H230zM295 78h11v1H295zM328 78h12v1H328zM360 78h12v1H360zM230 79h10v1H230zM295 79h11v1H295zM328 79h11v1H328zM360 79h12v1H360zM230 80h10v1H230zM295 80h11v1H295zM328 80h77v1H328zM230 81h10v1H230zM295 81h11v1H295zM328 81h77v1H328zM230 82h10v1H230zM295 82h11v1H295zM328 82h77v1H328zM230 83h76v1H230zM328 83h77v1H328zM230 84h76v1H230zM328 84h77v1H328zM230 85h76v1H230zM328 85h77v1H328zM230 86h76v1H230zM328 86h77v1H328zM230 87h76v1H230zM360 87h12v1H360zM230 88h76v1H230zM360 88h12v1H360zM230 89h76v1H230zM360 89h12v1H360zM262 90h11v1H262zM360 90h12v1H360zM262 91h11v1H262zM360 91h12v1H360zM262 92h11v1H262zM360 92h12v1H360zM262 93h11v1H262zM360 93h12v1H360zM262 94h11v1H262zM360 94h12v1H360zM262 95h11v1H262zM360 95h12v1H360zM262 96h11v1H262zM332 96h12v1H332zM360 96h12v1H360zM386 96h12v1H386zM234 97h12v1H234zM262 97h11v1H262zM290 97h11v1H290zM332 97h11v1H332zM360 97h12v1H360zM387 97h11v1H387zM234 98h11v1H234zM262 98h11v1H262zM290 98h12v1H290zM331 98h11v1H331zM360 98h12v1H360zM388 98h11v1H388zM233 99h12v1H233zM262 99h11v1H262zM291 99h11v1H291zM331 99h11v1H331zM360 99h12v1H360zM388 99h12v1H388zM233 100h11v1H233zM262 100h11v1H262zM292 100h11v1H292zM330 100h11v1H330zM360 100h12v1H360zM389 100h11v1H389zM232 101h11v1H232zM262 101h11v1H262zM292 101h11v1H292zM330 101h10v1H330zM360 101h12v1H360zM390 101h10v1H390zM232 102h11v1H232zM262 102h11v1H262zM293 102h10v1H293zM329 102h11v1H329zM360 102h12v1H360zM390 102h10v1H390zM232 103h10v1H232zM262 103h11v1H262zM294 103h10v1H294zM329 103h10v1H329zM360 103h12v1H360zM391 103h9v1H391zM231 104h9v1H231zM262 104h10v1H262zM294 104h10v1H294zM328 104h10v1H328zM360 104h12v1H360zM392 104h10v1H392zM231 105h9v1H231zM262 105h10v1H262zM295 105h10v1H295zM328 105h10v1H328zM360 105h12v1H360zM392 105h10v1H392zM230 106h10v1H230zM262 106h10v1H262zM295 106h10v1H295zM327 106h10v1H327zM360 106h12v1H360zM393 106h10v1H393zM230 107h9v1H230zM262 107h10v1H262zM296 107h10v1H296zM327 107h9v1H327zM360 107h11v1H360zM394 107h9v1H394zM229 108h9v1H229zM262 108h10v1H262zM297 108h9v1H297zM327 108h9v1H327zM360 108h11v1H360zM394 108h10v1H394zM229 109h9v1H229zM261 109h11v1H261zM298 109h9v1H298zM326 109h9v1H326zM360 109h11v1H360zM395 109h9v1H395zM228 110h9v1H228zM261 110h11v1H261zM298 110h9v1H298zM326 110h9v1H326zM360 110h11v1H360zM396 110h9v1H396zM228 111h9v1H228zM261 111h11v1H261zM299 111h9v1H299zM325 111h9v1H325zM360 111h10v1H360zM396 111h9v1H396zM227 112h9v1H227zM260 112h12v1H260zM300 112h8v1H300zM325 112h8v1H325zM358 112h12v1H358zM400 112h5v1H400zM227 113h8v1H227zM257 113h14v1H257zM300 113h9v1H300zM324 113h8v1H324zM356 113h13v1H356zM400 113h6v1H400zM227 114h7v1H227zM254 114h17v1H254zM301 114h8v1H301zM324 114h8v1H324zM352 114h17v1H352zM400 114h6v1H400zM226 115h8v1H226zM254 115h16v1H254zM302 115h8v1H302zM323 115h8v1H323zM352 115h16v1H352zM400 115h7v1H400zM226 116h7v1H226zM254 116h15v1H254zM302 116h8v1H302zM323 116h7v1H323zM352 116h15v1H352zM400 116h7v1H400zM225 117h8v1H225zM254 117h14v1H254zM303 117h8v1H303zM322 117h8v1H322zM352 117h14v1H352zM400 117h8v1H400zM225 118h7v1H225zM254 118h12v1H254zM304 118h7v1H304zM322 118h7v1H322zM352 118h12v1H352zM401 118h7v1H401zM254 119h10v1H254zM352 119h10v1H352zM254 120h2v1H254zM352 120h6v1H352z"/><path fill="#e2201c" fill-opacity="0.878431" d="M273 47h1v1H273zM273 48h1v1H273zM273 49h1v1H273zM273 50h1v1H273zM333 64h1v1H333zM326 82h1v1H326zM261 90h1v1H261zM273 91h1v1H273zM273 92h1v1H273zM273 93h1v1H273zM273 94h1v1H273zM273 95h1v1H273zM273 96h1v1H273zM273 97h1v1H273zM273 98h1v1H273zM273 99h1v1H273zM273 100h1v1H273zM273 101h1v1H273zM273 102h1v1H273zM292 102h1v1H292zM273 103h1v1H273zM273 104h1v1H273zM273 105h1v1H273zM402 105h1v1H402zM228 109h1v1H228zM237 110h1v1H237zM307 110h1v1H307zM235 113h1v1H235zM271 113h1v1H271zM329 118h1v1H329zM362 119h1v1H362z"/><path fill="#ee1e1b" fill-opacity="0.011765" d="M274 47h1v1H274zM274 48h1v1H274zM274 49h1v1H274zM274 50h1v1H274zM330 69h1v1H330zM341 76h1v1H341zM274 91h1v1H274zM274 92h1v1H274zM274 93h1v1H274zM274 94h1v1H274zM274 95h1v1H274zM274 96h1v1H274zM274 97h1v1H274zM274 98h1v1H274zM274 99h1v1H274zM274 100h1v1H274zM342 100h1v1H342zM274 101h1v1H274zM274 102h1v1H274zM274 103h1v1H274zM389 103h1v1H389zM293 105h1v1H293zM338 106h1v1H338zM227 109h1v1H227zM358 109h1v1H358zM308 110h1v1H308zM395 112h1v1H395zM322 114h1v1H322zM332 115h1v1H332zM301 117h1v1H301zM261 121h1v1H261z"/><path fill="#e2201d" fill-opacity="0.329412" d="M339 47h1v1H339zM409 59h1v1H409zM332 65h1v1H332zM325 83h1v1H325zM403 106h1v1H403zM309 113h1v1H309z"/><path fill="#e3211e" d="M340 47h12v1H340zM327 80h1v1H327zM327 81h1v1H327zM327 82h1v1H327zM326 83h2v1H326zM326 84h2v1H326zM325 85h3v1H325zM325 86h3v1H325zM359 110h1v1H359zM359 111h1v1H359zM397 112h3v1H397zM398 113h2v1H398zM398 114h2v1H398zM399 115h1v1H399zM399 116h1v1H399z"/><path fill="#e4211c" fill-opacity="0.215686" d="M352 47h1v1H352zM312 52h1v1H312zM312 53h1v1H312zM312 54h1v1H312zM312 55h1v1H312zM312 56h1v1H312zM312 57h1v1H312zM312 58h1v1H312zM345 65h1v1H345zM324 87h1v1H324zM303 100h1v1H303zM294 106h1v1H294zM326 106h1v1H326zM296 109h1v1H296zM405 110h1v1H405zM357 111h1v1H357zM333 113h1v1H333zM396 113h1v1H396zM398 116h1v1H398zM329 119h1v1H329zM409 119h1v1H409zM259 121h1v1H259zM351 121h1v1H351zM357 121h1v1H357z"/><path fill="#dfdee4" d="M87 48h1v1H87zM86 52h1v1H86zM101 56h1v1H101zM162 56h1v1H162zM101 57h1v1H101zM101 58h3v1H101zM167 58h1v1H167zM101 59h2v1H101zM104 59h1v1H104zM171 59h3v1H171zM102 60h1v1H102zM104 60h1v1H104zM102 61h3v1H102zM95 62h1v1H95zM104 62h1v1H104zM160 62h1v1H160zM95 63h1v1H95zM104 63h1v1H104zM161 63h3v1H161zM160 64h1v1H160zM162 64h3v1H162zM170 64h6v1H170zM81 65h1v1H81zM160 65h4v1H160zM169 65h4v1H169zM160 66h1v1H160zM169 66h3v1H169zM94 67h1v1H94zM168 67h3v1H168zM152 68h1v1H152zM168 68h2v1H168zM137 69h7v1H137zM150 69h3v1H150zM168 69h2v1H168zM129 70h24v1H129zM168 70h2v1H168zM129 71h23v1H129zM167 71h3v1H167zM130 72h9v1H130zM145 72h3v1H145zM167 72h3v1H167zM88 73h1v1H88zM130 73h7v1H130zM160 73h10v1H160zM133 74h6v1H133zM162 74h7v1H162zM135 75h4v1H135zM162 75h7v1H162zM137 76h5v1H137zM165 76h4v1H165zM138 77h5v1H138zM166 77h2v1H166zM142 78h1v1H142zM166 78h1v1H166zM142 79h2v1H142zM166 79h1v1H166zM143 80h1v1H143zM143 81h1v1H143zM143 82h2v1H143zM143 83h3v1H143zM144 84h2v1H144zM145 85h1v1H145zM156 104h1v1H156zM142 105h1v1H142zM159 107h1v1H159zM150 110h1v1H150zM149 112h1v1H149zM148 114h1v1H148zM148 115h1v1H148z"/><path fill="#e7e6ec" d="M165 48h4v1H165zM164 49h1v1H164zM170 49h4v1H170zM161 50h1v1H161zM174 50h3v1H174zM98 51h2v1H98zM161 51h1v1H161zM178 51h2v1H178zM99 52h2v1H99zM104 52h2v1H104zM157 52h2v1H157zM181 52h3v1H181zM105 53h1v1H105zM184 53h2v1H184zM105 54h2v1H105zM148 54h1v1H148zM185 54h2v1H185zM106 55h1v1H106zM145 55h1v1H145zM147 55h3v1H147zM187 55h1v1H187zM107 56h2v1H107zM142 56h3v1H142zM188 56h1v1H188zM111 57h9v1H111zM128 57h10v1H128zM189 57h1v1H189zM120 58h7v1H120zM188 58h4v1H188zM186 64h2v1H186zM186 65h1v1H186zM185 66h2v1H185zM184 67h3v1H184zM184 69h1v1H184zM184 70h2v1H184zM184 71h2v1H184zM183 72h1v1H183zM181 74h1v1H181zM181 75h1v1H181zM178 77h1v1H178zM177 78h1v1H177zM176 79h1v1H176zM140 104h1v1H140zM158 104h1v1H158zM147 105h1v1H147zM140 106h1v1H140zM147 106h1v1H147zM161 113h1v1H161zM147 114h1v1H147z"/><path fill="#e2201c" fill-opacity="0.764706" d="M339 48h1v1H339zM261 51h1v1H261zM334 61h1v1H334zM327 79h1v1H327zM343 97h1v1H343zM403 107h1v1H403zM227 111h1v1H227zM300 114h1v1H300z"/><path fill="#e2201c" fill-opacity="0.796078" d="M351 48h1v1H351zM347 59h1v1H347zM344 66h1v1H344zM342 71h1v1H342zM301 97h1v1H301zM386 97h1v1H386zM233 98h1v1H233zM341 100h1v1H341zM339 103h1v1H339zM390 103h1v1H390zM327 105h1v1H327zM273 106h1v1H273zM337 106h1v1H337zM394 109h1v1H394zM367 116h1v1H367zM268 117h1v1H268zM302 117h1v1H302zM321 118h1v1H321z"/><path fill="#e6e5eb" d="M165 49h5v1H165zM162 50h12v1H162zM162 51h1v1H162zM104 53h1v1H104zM104 54h1v1H104zM146 55h1v1H146zM187 56h1v1H187zM188 57h1v1H188zM186 58h2v1H186zM151 102h1v1H151zM150 103h1v1H150zM145 104h1v1H145zM147 104h1v1H147zM153 104h1v1H153zM138 107h2v1H138zM147 107h1v1H147zM147 108h1v1H147zM137 111h1v1H137zM136 112h1v1H136zM147 113h1v1H147zM147 115h1v1H147z"/><path fill="#e0201c" fill-opacity="0.184314" d="M338 49h1v1H338zM328 75h1v1H328zM326 80h1v1H326zM164 87h1v1H164zM331 95h1v1H331zM247 96h1v1H247zM399 97h1v1H399zM386 98h1v1H386zM304 102h1v1H304zM390 104h1v1H390zM337 107h1v1H337zM392 107h1v1H392zM325 108h1v1H325zM253 113h1v1H253zM225 114h1v1H225zM300 115h1v1H300zM311 117h1v1H311zM400 119h1v1H400z"/><path fill="#e2201c" fill-opacity="0.392157" d="M351 49h1v1H351zM334 60h1v1H334zM346 62h1v1H346zM344 67h1v1H344zM294 74h1v1H294zM294 75h1v1H294zM294 76h1v1H294zM294 77h1v1H294zM294 78h1v1H294zM327 78h1v1H327zM294 79h1v1H294zM294 80h1v1H294zM294 81h1v1H294zM372 87h1v1H372zM243 102h1v1H243zM328 102h1v1H328zM241 105h1v1H241zM359 107h1v1H359zM228 108h1v1H228zM308 111h1v1H308zM272 112h1v1H272zM369 114h1v1H369zM303 119h1v1H303zM263 120h1v1H263z"/><path fill="#d6d5d9" d="M87 50h1v1H87zM154 53h1v1H154zM94 57h1v1H94zM93 60h1v1H93zM93 61h1v1H93zM84 63h2v1H84zM87 63h1v1H87zM92 63h1v1H92zM84 64h2v1H84zM91 64h1v1H91zM84 65h2v1H84zM85 66h1v1H85zM85 67h3v1H85zM144 106h1v1H144zM141 108h1v1H141zM140 110h1v1H140zM151 110h1v1H151zM139 111h1v1H139z"/><path fill="#e9e7ee" d="M154 50h1v1H154zM146 53h2v1H146zM146 54h2v1H146z"/><path fill="#e2201c" fill-opacity="0.576471" d="M338 50h1v1H338zM400 100h1v1H400zM230 104h1v1H230zM324 111h1v1H324zM258 112h1v1H258zM406 113h1v1H406zM407 115h1v1H407zM330 117h1v1H330z"/><path fill="#e2201c" fill-opacity="0.996078" d="M350 50h1v1H350zM343 68h1v1H343zM341 73h1v1H341zM273 90h1v1H273zM289 97h1v1H289zM387 98h1v1H387zM291 100h1v1H291zM303 102h1v1H303zM231 103h1v1H231zM336 107h1v1H336zM238 108h1v1H238zM297 109h1v1H297zM260 111h1v1H260zM299 112h1v1H299zM332 113h1v1H332zM355 113h1v1H355zM226 114h1v1H226zM234 114h1v1H234zM406 114h1v1H406zM330 116h1v1H330zM266 118h1v1H266z"/><path fill="#e21f1d" fill-opacity="0.062745" d="M351 50h1v1H351zM228 65h1v1H228zM228 66h1v1H228zM228 67h1v1H228zM228 68h1v1H228zM228 69h1v1H228zM228 70h1v1H228zM228 71h1v1H228zM228 72h1v1H228zM329 72h1v1H329zM228 73h1v1H228zM228 74h1v1H228zM228 75h1v1H228zM228 76h1v1H228zM228 77h1v1H228zM228 78h1v1H228zM228 79h1v1H228zM228 80h1v1H228zM228 81h1v1H228zM228 82h1v1H228zM228 83h1v1H228zM228 84h1v1H228zM228 85h1v1H228zM228 86h1v1H228zM228 87h1v1H228zM228 88h1v1H228zM228 89h1v1H228zM228 90h1v1H228zM345 95h1v1H345zM384 95h1v1H384zM289 99h1v1H289zM329 99h1v1H329zM291 102h1v1H291zM402 103h1v1H402zM306 106h1v1H306zM391 106h1v1H391zM228 107h1v1H228zM240 107h1v1H240zM307 108h1v1H307zM273 110h1v1H273zM297 111h1v1H297zM236 113h1v1H236zM272 113h1v1H272zM370 113h1v1H370zM368 116h1v1H368zM408 116h1v1H408zM223 118h1v1H223zM409 118h1v1H409zM364 119h1v1H364z"/><path fill="#e5e4ea" d="M163 51h2v1H163zM170 51h6v1H170zM160 52h1v1H160zM104 55h2v1H104zM186 56h1v1H186zM187 57h1v1H187zM185 59h3v1H185zM189 59h1v1H189zM150 100h2v1H150zM149 101h3v1H149zM141 102h1v1H141zM148 102h3v1H148zM141 103h1v1H141zM148 103h2v1H148zM151 103h1v1H151zM144 104h1v1H144zM146 104h1v1H146zM148 104h4v1H148zM148 105h5v1H148zM148 106h4v1H148zM159 106h1v1H159zM148 107h4v1H148zM139 108h1v1H139zM148 108h2v1H148zM149 109h1v1H149zM160 109h1v1H160zM147 110h1v1H147zM147 111h1v1H147zM147 112h1v1H147zM161 114h1v1H161z"/><path fill="#e2201b" fill-opacity="0.270588" d="M223 51h1v1H223zM359 67h1v1H359zM242 73h52v1H242zM301 96h1v1H301zM290 100h1v1H290zM404 108h1v1H404zM331 116h1v1H331z"/><path fill="#e2201c" fill-opacity="0.501961" d="M224 51h37v1H224zM274 51h38v1H274zM409 52h1v1H409zM409 53h1v1H409zM409 54h1v1H409zM409 55h1v1H409zM409 56h1v1H409zM409 57h1v1H409zM409 58h1v1H409zM306 66h1v1H306zM306 67h1v1H306zM306 68h1v1H306zM331 68h1v1H331zM306 69h1v1H306zM306 70h1v1H306zM306 71h1v1H306zM306 72h1v1H306zM306 73h1v1H306zM306 74h1v1H306zM306 75h1v1H306zM306 76h1v1H306zM306 77h1v1H306zM306 78h1v1H306zM306 79h1v1H306zM306 80h1v1H306zM306 81h1v1H306zM241 82h1v1H241zM306 82h1v1H306zM306 83h1v1H306zM306 84h1v1H306zM306 85h1v1H306zM306 86h1v1H306zM324 86h1v1H324zM306 87h1v1H306zM306 88h1v1H306zM306 89h1v1H306zM387 99h1v1H387zM389 102h1v1H389zM338 105h1v1H338zM391 105h1v1H391zM356 112h1v1H356zM299 113h1v1H299zM323 113h1v1H323z"/><path fill="#e2201c" fill-opacity="0.945098" d="M273 51h1v1H273zM229 66h1v1H229zM229 67h1v1H229zM229 68h1v1H229zM229 69h1v1H229zM229 70h1v1H229zM229 71h1v1H229zM229 72h1v1H229zM229 73h1v1H229zM229 74h1v1H229zM229 75h1v1H229zM229 76h1v1H229zM229 77h1v1H229zM328 77h1v1H328zM229 78h1v1H229zM229 79h1v1H229zM339 79h1v1H339zM229 80h1v1H229zM405 80h1v1H405zM229 81h1v1H229zM405 81h1v1H405zM229 82h1v1H229zM405 82h1v1H405zM229 83h1v1H229zM405 83h1v1H405zM229 84h1v1H229zM405 84h1v1H405zM229 85h1v1H229zM405 85h1v1H405zM229 86h1v1H229zM405 86h1v1H405zM229 87h1v1H229zM229 88h1v1H229zM229 89h1v1H229zM342 98h1v1H342zM330 99h1v1H330zM340 101h1v1H340zM400 101h1v1H400zM304 104h1v1H304zM230 105h1v1H230zM305 106h1v1H305zM397 113h1v1H397zM303 118h1v1H303zM364 118h1v1H364zM264 119h1v1H264z"/><path fill="#e72420" fill-opacity="0.121569" d="M312 51h1v1H312zM372 67h1v1H372zM372 68h1v1H372zM372 69h1v1H372zM372 70h1v1H372zM372 71h1v1H372zM372 72h1v1H372zM342 73h1v1H342zM372 73h1v1H372zM372 74h1v1H372zM372 75h1v1H372zM372 76h1v1H372zM372 77h1v1H372zM372 78h1v1H372zM372 88h1v1H372zM372 89h1v1H372zM372 90h1v1H372zM372 91h1v1H372zM372 92h1v1H372zM372 93h1v1H372zM372 94h1v1H372zM372 95h1v1H372zM372 96h1v1H372zM372 97h1v1H372zM246 98h1v1H246zM343 98h1v1H343zM372 98h1v1H372zM372 99h1v1H372zM372 100h1v1H372zM244 101h1v1H244zM372 101h1v1H372zM372 102h1v1H372zM372 103h1v1H372zM372 104h1v1H372zM229 105h1v1H229zM260 109h1v1H260zM323 112h1v1H323zM224 116h1v1H224zM260 121h1v1H260zM358 121h1v1H358z"/><path fill="#e12320" fill-opacity="0.14902" d="M320 51h1v1H320zM312 59h1v1H312zM320 59h1v1H320zM347 60h1v1H347zM333 62h1v1H333zM331 67h1v1H331zM340 78h1v1H340zM164 88h1v1H164zM330 97h1v1H330zM341 101h1v1H341zM388 101h1v1H388zM230 103h1v1H230zM339 104h1v1H339zM335 110h1v1H335zM257 112h1v1H257zM298 112h1v1H298zM406 112h1v1H406zM302 118h1v1H302z"/><path fill="#e3201c" fill-opacity="0.552941" d="M321 51h17v1H321zM351 51h58v1H351zM223 52h1v1H223zM223 53h1v1H223zM223 54h1v1H223zM223 55h1v1H223zM223 56h1v1H223zM223 57h1v1H223zM223 58h1v1H223zM294 73h1v1H294zM340 77h1v1H340zM291 101h1v1H291zM293 104h1v1H293zM305 105h1v1H305zM295 107h1v1H295zM371 109h1v1H371zM236 112h1v1H236zM234 115h1v1H234zM224 117h1v1H224zM232 118h1v1H232z"/><path fill="#e2201c" fill-opacity="0.894118" d="M338 51h1v1H338zM245 98h1v1H245zM241 104h1v1H241zM239 107h1v1H239zM370 111h1v1H370zM323 114h1v1H323zM400 118h1v1H400z"/><path fill="#e2201c" fill-opacity="0.917647" d="M350 51h1v1H350zM345 63h1v1H345zM243 101h1v1H243zM371 107h1v1H371zM306 108h1v1H306zM357 112h1v1H357zM369 113h1v1H369z"/><path fill="#e31f1c" fill-opacity="0.282353" d="M409 51h1v1H409zM359 68h1v1H359zM359 69h1v1H359zM359 70h1v1H359zM359 71h1v1H359zM359 72h1v1H359zM359 73h1v1H359zM359 74h1v1H359zM359 75h1v1H359zM359 76h1v1H359zM359 77h1v1H359zM359 78h1v1H359zM405 87h1v1H405zM359 88h1v1H359zM359 89h1v1H359zM359 90h1v1H359zM359 91h1v1H359zM359 92h1v1H359zM359 93h1v1H359zM359 94h1v1H359zM359 95h1v1H359zM359 96h1v1H359zM288 97h1v1H288zM359 97h1v1H359zM359 98h1v1H359zM359 99h1v1H359zM359 100h1v1H359zM359 101h1v1H359zM359 102h1v1H359zM359 103h1v1H359zM359 104h1v1H359zM359 105h1v1H359zM371 110h1v1H371zM259 111h1v1H259z"/><path fill="#d6d6da" fill-opacity="0.647059" d="M96 52h1v1H96zM133 103h1v1H133zM140 112h1v1H140zM139 113h1v1H139zM150 113h1v1H150zM148 119h1v1H148zM147 121h1v1H147zM161 121h1v1H161z"/><path fill="#d8d7dc" fill-opacity="0.94902" d="M97 52h1v1H97zM150 112h1v1H150zM132 120h1v1H132z"/><path fill="#e0201c" fill-opacity="0.247059" d="M320 52h1v1H320zM320 53h1v1H320zM320 54h1v1H320zM320 55h1v1H320zM320 56h1v1H320zM320 57h1v1H320zM320 58h1v1H320zM343 70h1v1H343zM148 87h1v1H148zM398 95h1v1H398zM302 98h1v1H302zM231 101h1v1H231zM394 110h1v1H394zM310 115h1v1H310zM233 117h1v1H233z"/><path fill="#e3e2e7" fill-opacity="0.384314" d="M96 53h1v1H96zM77 60h1v1H77zM101 61h1v1H101zM82 77h1v1H82zM183 77h1v1H183zM125 79h1v1H125zM132 82h1v1H132zM167 85h1v1H167z"/><path fill="#e3e2e6" fill-opacity="0.976471" d="M98 53h1v1H98zM114 72h1v1H114zM117 74h1v1H117zM131 81h1v1H131zM140 84h1v1H140zM168 84h1v1H168zM136 107h1v1H136z"/><path fill="#e1e0e5" d="M85 54h1v1H85zM159 55h1v1H159zM104 57h1v1H104zM193 58h1v1H193zM105 59h1v1H105zM151 59h2v1H151zM152 60h1v1H152zM106 61h1v1H106zM153 61h2v1H153zM158 61h1v1H158zM106 62h1v1H106zM152 62h2v1H152zM106 63h1v1H106zM150 63h3v1H150zM105 64h3v1H105zM130 64h5v1H130zM144 64h8v1H144zM106 65h2v1H106zM128 65h10v1H128zM144 65h6v1H144zM174 65h2v1H174zM107 66h2v1H107zM128 66h22v1H128zM174 66h2v1H174zM108 67h2v1H108zM129 67h19v1H129zM173 67h2v1H173zM94 68h1v1H94zM172 68h2v1H172zM172 69h1v1H172zM92 70h1v1H92zM172 70h1v1H172zM172 71h1v1H172zM172 72h2v1H172zM120 73h3v1H120zM172 73h2v1H172zM120 74h4v1H120zM172 74h2v1H172zM171 75h3v1H171zM171 76h2v1H171zM170 77h2v1H170zM169 78h2v1H169zM168 79h2v1H168zM136 80h1v1H136zM168 80h2v1H168zM136 81h4v1H136zM166 81h1v1H166zM139 82h2v1H139zM166 82h2v1H166zM140 83h1v1H140zM166 83h2v1H166zM141 84h1v1H141zM164 84h2v1H164zM164 85h1v1H164zM147 92h1v1H147zM147 93h1v1H147zM145 95h1v1H145zM144 97h1v1H144z"/><path fill="#dfdee3" fill-opacity="0.545098" d="M96 54h1v1H96zM98 55h1v1H98zM108 68h1v1H108zM142 85h1v1H142zM147 86h1v1H147zM136 104h2v1H136zM133 106h1v1H133zM151 111h1v1H151zM149 116h1v1H149z"/><path fill="#e3e2e7" fill-opacity="0.847059" d="M98 54h1v1H98zM96 56h1v1H96zM96 63h1v1H96zM105 65h1v1H105zM111 70h1v1H111zM126 79h1v1H126zM144 96h1v1H144zM131 100h1v1H131zM141 101h1v1H141zM145 110h1v1H145z"/><path fill="#e2e1e7" d="M161 54h1v1H161zM163 54h2v1H163zM167 54h3v1H167zM163 55h5v1H163zM173 55h3v1H173zM164 56h1v1H164zM175 56h1v1H175zM178 57h6v1H178zM170 58h1v1H170zM181 59h2v1H181zM109 64h18v1H109zM109 65h11v1H109zM116 72h4v1H116zM123 75h4v1H123zM122 76h6v1H122zM127 77h3v1H127zM128 78h1v1H128zM132 78h3v1H132zM131 79h4v1H131zM150 91h1v1H150zM148 92h2v1H148zM147 94h3v1H147zM146 95h4v1H146zM146 96h2v1H146zM145 97h3v1H145zM146 98h1v1H146zM144 99h2v1H144zM142 100h1v1H142zM142 104h1v1H142zM136 105h1v1H136zM141 106h1v1H141zM152 106h1v1H152zM140 107h1v1H140zM150 109h1v1H150zM148 111h2v1H148zM137 112h1v1H137zM148 112h1v1H148z"/><path fill="#e0e0e4" fill-opacity="0.733333" d="M96 55h1v1H96zM99 57h1v1H99zM103 63h1v1H103zM86 75h1v1H86zM76 77h1v1H76zM81 77h1v1H81zM139 84h1v1H139zM135 104h1v1H135zM138 104h1v1H138z"/><path fill="#dedde3" d="M99 55h1v1H99zM100 57h1v1H100zM100 58h1v1H100zM166 58h1v1H166zM103 59h1v1H103zM170 59h1v1H170zM103 60h1v1H103zM162 62h1v1H162zM165 64h5v1H165zM164 65h5v1H164zM94 66h1v1H94zM161 66h8v1H161zM80 67h1v1H80zM160 67h8v1H160zM160 68h8v1H160zM93 69h1v1H93zM160 69h8v1H160zM160 70h8v1H160zM152 71h1v1H152zM160 71h7v1H160zM89 72h1v1H89zM139 72h6v1H139zM148 72h5v1H148zM160 72h7v1H160zM137 73h16v1H137zM139 74h13v1H139zM160 74h2v1H160zM80 75h5v1H80zM139 75h6v1H139zM160 75h2v1H160zM142 76h5v1H142zM160 76h5v1H160zM143 77h4v1H143zM160 77h6v1H160zM143 78h4v1H143zM161 78h5v1H161zM144 79h1v1H144zM162 79h4v1H162zM144 80h1v1H144zM144 81h1v1H144zM146 82h1v1H146zM146 83h1v1H146zM146 84h1v1H146zM146 85h3v1H146zM132 103h1v1H132zM133 104h1v1H133zM143 104h1v1H143zM134 105h1v1H134zM137 105h1v1H137zM135 106h3v1H135zM140 108h1v1H140zM160 111h1v1H160zM149 113h1v1H149zM148 116h1v1H148zM161 116h1v1H161zM148 117h1v1H148zM147 119h1v1H147zM147 120h1v1H147z"/><path fill="#e1e0e6" d="M160 55h3v1H160zM168 55h5v1H168zM166 56h3v1H166zM174 56h1v1H174zM164 57h1v1H164zM166 57h1v1H166zM169 57h4v1H169zM174 57h4v1H174zM173 58h11v1H173zM178 59h3v1H178zM108 64h1v1H108zM127 64h1v1H127zM108 65h1v1H108zM120 65h8v1H120zM109 66h19v1H109zM110 67h18v1H110zM112 68h16v1H112zM110 69h1v1H110zM112 69h16v1H112zM112 70h15v1H112zM113 71h14v1H113zM120 72h7v1H120zM123 73h4v1H123zM124 74h4v1H124zM127 75h3v1H127zM128 76h4v1H128zM130 77h4v1H130zM131 78h1v1H131zM136 78h1v1H136zM135 79h2v1H135zM137 80h3v1H137zM140 81h1v1H140zM145 96h1v1H145zM145 98h1v1H145zM138 105h1v1H138zM151 108h1v1H151zM160 110h1v1H160zM161 115h1v1H161z"/><path fill="#737375" fill-opacity="0.482353" d="M201 55h1v1H201z"/><path fill="#e0dee3" d="M160 56h2v1H160zM162 57h1v1H162zM167 63h1v1H167zM154 64h6v1H154zM154 65h6v1H154zM154 66h6v1H154zM153 67h5v1H153zM153 68h4v1H153zM153 69h3v1H153zM153 70h1v1H153zM163 80h3v1H163zM163 81h1v1H163zM162 82h2v1H162zM161 83h1v1H161zM160 84h2v1H160zM160 85h2v1H160z"/><path fill="#e0dfe5" d="M169 56h5v1H169zM84 57h1v1H84zM102 57h2v1H102zM167 57h2v1H167zM173 57h1v1H173zM104 58h1v1H104zM168 58h2v1H168zM171 58h2v1H171zM174 59h4v1H174zM105 60h1v1H105zM154 60h2v1H154zM105 61h1v1H105zM155 61h3v1H155zM103 62h1v1H103zM105 62h1v1H105zM154 62h6v1H154zM105 63h1v1H105zM153 63h8v1H153zM152 64h1v1H152zM161 64h1v1H161zM150 65h3v1H150zM173 65h1v1H173zM150 66h3v1H150zM172 66h2v1H172zM128 67h1v1H128zM148 67h5v1H148zM171 67h2v1H171zM128 68h24v1H128zM170 68h2v1H170zM128 69h9v1H128zM144 69h6v1H144zM170 69h2v1H170zM127 70h2v1H127zM170 70h2v1H170zM127 71h2v1H127zM170 71h2v1H170zM127 72h3v1H127zM170 72h2v1H170zM127 73h3v1H127zM170 73h2v1H170zM128 74h5v1H128zM169 74h3v1H169zM130 75h5v1H130zM169 75h2v1H169zM132 76h5v1H132zM169 76h2v1H169zM134 77h4v1H134zM168 77h2v1H168zM135 78h1v1H135zM137 78h5v1H137zM167 78h2v1H167zM137 79h5v1H137zM167 79h1v1H167zM140 80h3v1H140zM141 81h2v1H141zM141 82h2v1H141zM141 83h2v1H141zM142 84h2v1H142zM144 98h1v1H144zM155 104h1v1H155zM144 105h1v1H144zM136 113h1v1H136z"/><path fill="#39393a" fill-opacity="0.117647" d="M201 56h1v1H201zM200 58h1v1H200z"/><path fill="#ebeaee" fill-opacity="0.796078" d="M79 57h1v1H79zM74 67h1v1H74zM95 67h1v1H95zM73 71h1v1H73zM181 78h1v1H181zM145 111h1v1H145zM145 112h1v1H145z"/><path fill="#e2e1e5" fill-opacity="0.898039" d="M96 57h1v1H96zM74 75h1v1H74zM120 76h1v1H120zM80 77h1v1H80zM122 77h1v1H122zM124 78h1v1H124zM147 91h1v1H147zM131 101h1v1H131zM131 102h1v1H131z"/><path fill="#dfdde2" d="M163 57h1v1H163zM158 67h2v1H158zM157 68h3v1H157zM156 69h4v1H156zM154 70h6v1H154zM153 71h7v1H153zM153 72h7v1H153zM153 73h7v1H153zM153 74h7v1H153zM157 75h3v1H157zM159 76h1v1H159zM161 80h2v1H161zM160 81h3v1H160zM160 82h2v1H160zM160 83h1v1H160z"/><path fill="#303032" fill-opacity="0.505882" d="M200 57h1v1H200z"/><path fill="#e1e0e5" fill-opacity="0.952941" d="M96 58h1v1H96zM101 60h1v1H101zM144 85h1v1H144zM165 85h1v1H165zM146 93h1v1H146zM143 98h1v1H143zM134 104h1v1H134z"/><path fill="#dedde1" fill-opacity="0.266667" d="M99 58h1v1H99zM87 75h1v1H87zM85 76h1v1H85zM78 78h1v1H78zM127 80h1v1H127zM132 101h1v1H132zM131 104h1v1H131zM150 114h1v1H150zM132 121h1v1H132z"/><path fill="#eae9ed" fill-opacity="0.980392" d="M96 59h1v1H96zM96 61h1v1H96zM173 82h1v1H173zM133 115h1v1H133zM145 116h1v1H145z"/><path fill="#e0dfe4" fill-opacity="0.678431" d="M100 59h1v1H100zM104 64h1v1H104zM112 71h1v1H112zM91 72h1v1H91zM88 74h1v1H88zM118 75h1v1H118zM84 76h1v1H84zM166 85h1v1H166zM148 86h1v1H148zM142 99h1v1H142zM131 103h1v1H131zM135 107h1v1H135z"/><path fill="#393738" fill-opacity="0.447059" d="M199 59h1v1H199z"/><path fill="#e2201c" fill-opacity="0.670588" d="M224 59h88v1H224zM321 59h13v1H321zM348 59h61v1H348zM330 71h1v1H330zM344 95h1v1H344zM240 106h1v1H240zM225 115h1v1H225zM231 119h1v1H231z"/><path fill="#e2201c" fill-opacity="0.701961" d="M334 59h1v1H334zM246 97h1v1H246zM310 116h1v1H310zM224 119h7v1H224zM304 119h7v1H304zM321 119h8v1H321zM401 119h8v1H401z"/><path fill="#9c9a9b" fill-opacity="0.862745" d="M198 60h1v1H198z"/><path fill="#e2201c" fill-opacity="0.745098" d="M346 61h1v1H346zM230 90h31v1H230zM274 90h32v1H274zM302 99h1v1H302zM388 100h1v1H388zM273 107h1v1H273zM309 114h1v1H309z"/><path fill="#e8e7ec" fill-opacity="0.937255" d="M96 62h1v1H96zM171 83h1v1H171zM139 104h1v1H139zM137 108h1v1H137zM145 109h1v1H145zM145 115h1v1H145zM130 120h1v1H130z"/><path fill="#e6e5ea" fill-opacity="0.568627" d="M102 62h1v1H102zM107 67h1v1H107zM94 69h1v1H94zM130 81h1v1H130zM172 83h1v1H172zM136 109h1v1H136zM133 114h1v1H133z"/><path fill="#e1dfe4" d="M194 62h1v1H194zM165 63h2v1H165zM153 64h1v1H153zM153 65h1v1H153zM153 66h1v1H153zM166 80h2v1H166zM164 81h2v1H164zM167 81h1v1H167zM164 82h2v1H164zM162 83h4v1H162zM162 84h2v1H162zM162 85h2v1H162z"/><path fill="#ececf0" fill-opacity="0.917647" d="M76 63h1v1H76zM75 65h1v1H75zM191 69h1v1H191z"/><path fill="#e2201c" fill-opacity="0.611765" d="M333 63h1v1H333zM345 64h1v1H345zM326 81h1v1H326zM234 96h13v1H234zM289 96h12v1H289zM289 98h1v1H289zM330 98h1v1H330zM261 107h1v1H261zM238 109h1v1H238zM325 109h1v1H325zM270 115h1v1H270zM368 115h1v1H368zM311 118h1v1H311zM265 119h1v1H265zM360 120h1v1H360zM255 121h2v1H255zM353 121h2v1H353z"/><path fill="#dedee1" fill-opacity="0.490196" d="M96 65h1v1H96zM116 74h1v1H116zM135 83h1v1H135zM146 92h1v1H146zM131 99h1v1H131zM159 116h1v1H159z"/><path fill="#e2201c" fill-opacity="0.854902" d="M229 65h1v1H229zM360 67h12v1H360zM328 103h1v1H328zM294 105h1v1H294zM229 107h1v1H229zM335 109h1v1H335zM359 109h1v1H359zM333 112h1v1H333zM396 112h1v1H396zM256 113h1v1H256zM331 115h1v1H331zM233 116h1v1H233zM269 116h1v1H269zM322 116h1v1H322zM261 120h1v1H261zM359 120h1v1H359z"/><path fill="#e2201c" fill-opacity="0.901961" d="M230 65h76v1H230zM340 76h1v1H340zM290 99h1v1H290zM329 101h1v1H329zM401 103h1v1H401zM324 112h1v1H324zM407 116h1v1H407zM408 118h1v1H408z"/><path fill="#e2201c" fill-opacity="0.458824" d="M306 65h1v1H306zM329 73h1v1H329zM242 82h52v1H242zM258 121h1v1H258z"/><path fill="#e2e2e5" fill-opacity="0.439216" d="M74 66h1v1H74zM109 69h1v1H109zM113 72h1v1H113zM90 73h1v1H90zM121 77h1v1H121zM123 78h1v1H123zM180 79h1v1H180zM138 84h1v1H138zM146 86h1v1H146zM143 97h1v1H143zM140 102h1v1H140zM155 108h1v1H155z"/><path fill="#e2e2e6" fill-opacity="0.760784" d="M106 66h1v1H106zM93 70h1v1H93zM92 71h1v1H92zM133 82h1v1H133zM169 84h1v1H169zM143 85h1v1H143z"/><path fill="#e2201c" fill-opacity="0.737255" d="M332 66h1v1H332zM359 79h1v1H359zM232 100h1v1H232zM371 108h1v1H371zM404 109h1v1H404z"/><path fill="#e2201c" fill-opacity="0.831373" d="M331 69h1v1H331zM329 74h1v1H329zM392 106h1v1H392zM261 108h1v1H261zM296 108h1v1H296zM272 111h1v1H272zM298 111h1v1H298zM308 112h1v1H308zM398 115h1v1H398z"/><path fill="#e3201c" fill-opacity="0.666667" d="M343 69h1v1H343zM340 79h19v1H340zM373 79h32v1H373zM294 82h1v1H294zM244 100h1v1H244zM231 102h1v1H231zM359 108h1v1H359zM311 119h1v1H311z"/><path fill="#ecebf0" fill-opacity="0.945098" d="M190 70h1v1H190zM189 71h1v1H189zM182 77h1v1H182z"/><path fill="#e2201c" fill-opacity="0.309804" d="M330 70h1v1H330zM325 87h34v1H325zM373 87h32v1H373zM232 99h1v1H232zM359 106h1v1H359zM237 111h1v1H237zM235 114h1v1H235zM361 120h1v1H361zM253 121h1v1H253z"/><path fill="#e2201c" fill-opacity="0.960784" d="M330 72h1v1H330zM240 80h1v1H240zM240 81h1v1H240zM391 104h1v1H391zM395 110h1v1H395zM259 112h1v1H259zM301 115h1v1H301z"/><path fill="#dfdce2" d="M89 73h1v1H89zM153 83h7v1H153zM152 84h8v1H152zM152 86h8v1H152z"/><path fill="#e2e2e6" fill-opacity="0.8" d="M115 73h1v1H115zM128 80h1v1H128zM136 83h1v1H136zM132 102h1v1H132z"/><path fill="#eeedf2" fill-opacity="0.964706" d="M187 73h1v1H187z"/><path fill="#e2201c" fill-opacity="0.984314" d="M240 73h1v1H240zM240 82h1v1H240zM331 97h1v1H331zM398 97h1v1H398zM389 101h1v1H389zM293 103h1v1H293zM393 107h1v1H393zM326 108h1v1H326zM325 110h1v1H325zM358 111h1v1H358zM405 112h1v1H405zM225 116h1v1H225zM260 120h1v1H260z"/><path fill="#e9e9ec" fill-opacity="0.623529" d="M73 74h1v1H73zM184 76h1v1H184zM178 80h1v1H178zM145 94h1v1H145zM132 105h1v1H132zM130 121h2v1H130zM145 121h2v1H145zM162 121h2v1H162z"/><path fill="#e2201a" fill-opacity="0.968627" d="M240 74h1v1H240zM240 75h1v1H240zM240 76h1v1H240zM240 77h1v1H240zM240 78h1v1H240zM240 79h1v1H240zM338 104h1v1H338zM224 118h1v1H224zM358 120h1v1H358z"/><path fill="#e2201b" fill-opacity="0.090196" d="M241 74h1v1H241zM241 75h1v1H241zM241 76h1v1H241zM241 77h1v1H241zM241 78h1v1H241zM241 79h1v1H241zM241 80h1v1H241zM241 81h1v1H241zM324 85h1v1H324zM400 99h1v1H400zM401 101h1v1H401zM242 104h1v1H242zM305 104h1v1H305zM372 105h1v1H372zM238 110h1v1H238zM324 110h1v1H324zM355 112h1v1H355zM351 113h1v1H351zM407 114h1v1H407zM234 116h1v1H234zM270 116h1v1H270zM269 117h1v1H269zM266 119h1v1H266zM312 119h1v1H312zM320 119h1v1H320z"/><path fill="#e2201c" fill-opacity="0.690196" d="M341 74h1v1H341zM385 95h1v1H385zM303 101h1v1H303zM354 113h1v1H354z"/><path fill="#e3211c" fill-opacity="0.745098" d="M325 84h1v1H325zM332 95h12v1H332zM386 95h12v1H386z"/><path fill="#d2b0b6" fill-opacity="0.996078" d="M149 86h1v1H149zM153 90h2v1H153z"/><path fill="#e0bfc7" d="M150 86h1v1H150zM160 86h1v1H160zM152 90h1v1H152zM159 90h1v1H159z"/><path fill="#d8999c" d="M161 86h1v1H161zM162 89h1v1H162zM155 90h4v1H155z"/><path fill="#ca8f93" fill-opacity="0.996078" d="M162 86h1v1H162z"/><path fill="#ce6364" d="M163 86h1v1H163zM149 89h1v1H149z"/><path fill="#c9b5b7" fill-opacity="0.301961" d="M164 86h1v1H164zM158 113h1v1H158zM159 117h1v1H159z"/><path fill="#be1f20" d="M149 87h4v1H149zM158 87h6v1H158zM149 88h14v1H149zM152 89h9v1H152z"/><path fill="#c03633" d="M153 87h1v1H153zM157 87h1v1H157z"/><path fill="#c64847" d="M154 87h3v1H154zM150 89h1v1H150zM161 89h1v1H161z"/><path fill="#df201c" fill-opacity="0.529412" d="M148 88h1v1H148zM329 100h1v1H329zM261 106h1v1H261zM273 108h1v1H273zM334 111h1v1H334zM370 112h1v1H370zM397 114h1v1H397zM399 117h1v1H399zM257 121h1v1H257z"/><path fill="#c12d2a" d="M163 88h1v1H163zM151 89h1v1H151z"/><path fill="#d79294" fill-opacity="0.752941" d="M148 89h1v1H148z"/><path fill="#ecdde0" d="M163 89h1v1H163z"/><path fill="#e6d8d8" d="M160 90h1v1H160z"/><path fill="#e4e5ea" d="M153 91h2v1H153zM154 92h1v1H154zM154 93h1v1H154zM154 94h1v1H154zM154 95h1v1H154zM154 96h1v1H154zM153 97h2v1H153zM152 98h3v1H152zM152 99h3v1H152zM152 100h3v1H152zM152 101h3v1H152z"/><path fill="#e3e2e9" d="M150 93h1v1H150zM150 94h1v1H150zM150 95h1v1H150zM143 101h1v1H143zM142 102h2v1H142zM142 103h2v1H142z"/><path fill="#e4e3ea" d="M151 93h1v1H151zM151 94h1v1H151zM151 95h1v1H151zM152 104h1v1H152z"/><path fill="#e2201c" fill-opacity="0.482353" d="M288 96h1v1H288zM342 99h1v1H342zM340 102h1v1H340zM395 111h1v1H395zM254 113h1v1H254zM353 113h1v1H353zM253 114h1v1H253zM253 115h1v1H253zM253 116h1v1H253zM253 117h1v1H253zM253 118h1v1H253zM253 119h1v1H253zM253 120h1v1H253z"/><path fill="#e3201b" fill-opacity="0.431373" d="M344 96h1v1H344zM402 104h1v1H402zM306 107h1v1H306zM307 109h1v1H307zM271 114h1v1H271zM322 115h1v1H322zM408 117h1v1H408zM356 121h1v1H356z"/><path fill="#e2201c" fill-opacity="0.470588" d="M385 96h1v1H385zM393 108h1v1H393zM363 119h1v1H363z"/><path fill="#e2201c" fill-opacity="0.294118" d="M292 103h1v1H292zM239 108h1v1H239zM226 112h1v1H226zM321 117h1v1H321z"/><path fill="#cfced3" fill-opacity="0.854902" d="M153 108h1v1H153zM144 109h1v1H144zM152 109h1v1H152zM138 114h1v1H138zM149 115h1v1H149zM136 116h1v1H136zM160 119h1v1H160z"/><path fill="#cccbce" fill-opacity="0.372549" d="M154 108h1v1H154zM143 110h1v1H143zM157 110h1v1H157zM148 120h1v1H148zM160 121h1v1H160z"/><path fill="#d0d0d3" fill-opacity="0.160784" d="M156 109h1v1H156zM152 110h1v1H152zM151 112h1v1H151zM135 118h1v1H135zM148 121h1v1H148z"/><path fill="#c8c8cb" fill-opacity="0.94902" d="M142 110h1v1H142zM158 111h1v1H158zM159 114h1v1H159z"/><path fill="#cdccd1" fill-opacity="0.764706" d="M141 111h1v1H141zM137 115h1v1H137z"/><path fill="#c6c6c7" fill-opacity="0.647059" d="M158 112h1v1H158zM159 115h1v1H159zM160 120h1v1H160z"/><path fill="#d9d8de" fill-opacity="0.878431" d="M135 117h1v1H135zM134 118h1v1H134zM148 118h1v1H148zM133 119h1v1H133z"/><path fill="#ecebf0" fill-opacity="0.992157" d="M145 117h1v1H145z"/></svg>`;+// Official favicon, 32 x 32 / 32-bit frame, encoded as paths for the SVG sanitizer.+export const JD_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="100%" height="100%" shape-rendering="crispEdges"><path fill="#c81522" d="M0 0h32v1H0zM0 1h32v1H0zM0 2h32v1H0zM0 3h32v1H0zM0 4h32v1H0zM0 5h7v1H0zM25 5h7v1H25zM0 6h7v1H0zM25 6h7v1H25zM0 7h7v1H0zM27 7h5v1H27zM0 8h7v1H0zM27 8h5v1H27zM0 9h7v1H0zM29 9h3v1H29zM0 10h7v1H0zM29 10h3v1H29zM0 11h7v1H0zM29 11h3v1H29zM0 12h7v1H0zM29 12h3v1H29zM0 13h7v1H0zM19 13h4v1H19zM31 13h1v1H31zM0 14h7v1H0zM19 14h4v1H19zM31 14h1v1H31zM0 15h7v1H0zM19 15h4v1H19zM31 15h1v1H31zM0 16h7v1H0zM19 16h4v1H19zM31 16h1v1H31zM0 17h7v1H0zM19 17h4v1H19zM31 17h1v1H31zM0 18h7v1H0zM19 18h4v1H19zM31 18h1v1H31zM0 19h7v1H0zM19 19h3v1H19zM31 19h1v1H31zM0 20h7v1H0zM19 20h2v1H19zM31 20h1v1H31zM0 21h1v1H0zM29 21h3v1H29zM0 22h1v1H0zM29 22h3v1H29zM0 23h1v1H0zM29 23h3v1H29zM0 24h1v1H0zM29 24h3v1H29zM0 25h1v1H0zM27 25h5v1H27zM0 26h1v1H0zM27 26h5v1H27zM0 27h32v1H0zM0 28h32v1H0zM0 29h32v1H0zM0 30h32v1H0zM0 31h32v1H0z"/><path fill="#c91926" d="M7 5h1v1H7z"/><path fill="#ca1f2b" d="M8 5h1v1H8zM7 6h1v1H7zM23 15h1v1H23zM4 21h1v1H4z"/><path fill="#cb2430" d="M9 5h1v1H9zM11 5h1v1H11zM13 6h1v1H13zM29 13h1v1H29zM5 21h1v1H5zM20 21h1v1H20z"/><path fill="#cd2a36" d="M10 5h1v1H10zM25 26h1v1H25z"/><path fill="#c91925" d="M12 5h1v1H12z"/><path fill="#c91c28" d="M13 5h1v1H13zM30 13h1v1H30z"/><path fill="#cc2733" d="M14 5h1v1H14zM28 9h1v1H28zM23 19h1v1H23z"/><path fill="#cd2c37" d="M15 5h6v1H15z"/><path fill="#cc2934" d="M21 5h1v1H21zM30 14h1v1H30zM1 24h1v1H1z"/><path fill="#ca202c" d="M22 5h1v1H22zM23 6h1v1H23z"/><path fill="#c91a26" d="M23 5h1v1H23z"/><path fill="#c81724" d="M24 5h1v1H24zM2 21h1v1H2zM12 25h1v1H12z"/><path fill="#cd2b37" d="M8 6h1v1H8zM21 21h1v1H21z"/><path fill="#d03843" d="M9 6h1v1H9z"/><path fill="#d3444e" d="M10 6h1v1H10z"/><path fill="#d03742" d="M11 6h1v1H11z"/><path fill="#ca1e2a" d="M12 6h1v1H12zM23 16h1v1H23z"/><path fill="#d13d48" d="M14 6h1v1H14zM7 8h1v1H7zM12 20h1v1H12zM24 26h1v1H24z"/><path fill="#d44852" d="M15 6h6v1H15z"/><path fill="#d2414b" d="M21 6h1v1H21zM24 15h1v1H24zM4 22h1v1H4zM11 24h1v1H11z"/><path fill="#cd2f3a" d="M22 6h1v1H22zM3 22h1v1H3z"/><path fill="#c81926" d="M24 6h1v1H24zM1 22h1v1H1z"/><path fill="#cd2d38" d="M7 7h1v1H7zM2 26h1v1H2z"/><path fill="#d44a55" d="M8 7h1v1H8z"/><path fill="#db6870" d="M9 7h1v1H9zM25 16h1v1H25z"/><path fill="#e2868c" d="M10 7h1v1H10z"/><path fill="#db666e" d="M11 7h1v1H11zM7 21h1v1H7z"/><path fill="#cd2b36" d="M12 7h1v1H12zM30 18h1v1H30z"/><path fill="#d03a44" d="M13 7h1v1H13z"/><path fill="#de757c" d="M14 7h1v1H14z"/><path fill="#e48f95" d="M15 7h6v1H15zM26 23h1v1H26z"/><path fill="#e3898f" d="M21 7h1v1H21z"/><path fill="#df7980" d="M22 7h1v1H22zM3 24h1v1H3z"/><path fill="#db676f" d="M23 7h1v1H23z"/><path fill="#d6505a" d="M24 7h1v1H24z"/><path fill="#d03a45" d="M25 7h1v1H25zM12 8h1v1H12zM12 21h1v1H12z"/><path fill="#cc2531" d="M26 7h1v1H26z"/><path fill="#dd7078" d="M8 8h1v1H8z"/><path fill="#e9a2a7" d="M9 8h1v1H9z"/><path fill="#f5d4d7" d="M10 8h1v1H10z"/><path fill="#e89fa4" d="M11 8h1v1H11zM7 22h1v1H7zM17 23h1v1H17z"/><path fill="#d6535d" d="M13 8h1v1H13z"/><path fill="#eeb8bc" d="M14 8h1v1H14zM9 19h1v1H9z"/><path fill="#f8e4e5" d="M15 8h6v1H15zM15 22h1v1H15z"/><path fill="#f8e0e2" d="M21 8h1v1H21z"/><path fill="#f5d7d9" d="M22 8h1v1H22zM26 21h1v1H26zM9 22h1v1H9zM25 23h1v1H25z"/><path fill="#f1c3c7" d="M23 8h1v1H23z"/><path fill="#e7989e" d="M24 8h1v1H24z"/><path fill="#dc6c74" d="M25 8h1v1H25zM24 13h1v1H24zM24 25h1v1H24z"/><path fill="#d13c47" d="M26 8h1v1H26zM27 9h1v1H27zM24 16h1v1H24zM18 21h1v1H18z"/><path fill="#d3434d" d="M7 9h1v1H7zM7 10h1v1H7zM7 11h1v1H7zM7 12h1v1H7zM7 13h1v1H7zM7 14h1v1H7zM7 15h1v1H7zM7 16h1v1H7zM7 17h1v1H7zM7 18h1v1H7z"/><path fill="#e07b83" d="M8 9h1v1H8zM8 10h1v1H8zM8 11h1v1H8zM8 12h1v1H8zM8 13h1v1H8zM8 14h1v1H8zM8 15h1v1H8zM8 16h1v1H8zM8 17h1v1H8zM8 18h1v1H8z"/><path fill="#edb4b8" d="M9 9h1v1H9zM19 9h1v1H19zM9 10h1v1H9zM9 11h1v1H9zM9 12h1v1H9zM9 13h1v1H9zM9 14h1v1H9zM9 15h1v1H9zM9 16h1v1H9zM9 17h1v1H9zM9 18h1v1H9zM16 22h1v1H16z"/><path fill="#faedee" d="M10 9h1v1H10zM10 10h1v1H10zM10 11h1v1H10zM10 12h1v1H10zM10 13h1v1H10zM10 14h1v1H10zM27 14h1v1H27zM10 15h1v1H10zM10 16h1v1H10zM10 17h1v1H10zM10 18h1v1H10z"/><path fill="#ecb0b5" d="M11 9h1v1H11zM11 10h1v1H11zM11 11h1v1H11zM11 12h1v1H11zM11 13h1v1H11zM11 14h1v1H11zM11 15h1v1H11zM11 16h1v1H11zM11 17h1v1H11zM11 18h1v1H11z"/><path fill="#d23f4a" d="M12 9h1v1H12zM12 10h1v1H12zM12 11h1v1H12zM12 12h1v1H12zM12 13h1v1H12zM12 14h1v1H12zM12 15h1v1H12zM12 16h1v1H12zM12 17h1v1H12zM12 18h1v1H12z"/><path fill="#d85b64" d="M13 9h1v1H13zM13 10h1v1H13zM13 11h1v1H13zM13 12h1v1H13zM13 13h1v1H13zM13 14h1v1H13zM13 15h1v1H13zM13 16h1v1H13zM13 17h1v1H13zM13 18h1v1H13zM13 19h1v1H13zM24 19h1v1H24zM13 20h1v1H13zM13 21h1v1H13zM13 22h1v1H13zM13 23h1v1H13zM13 24h1v1H13z"/><path fill="#f3cdd0" d="M14 9h1v1H14zM14 10h1v1H14zM14 11h1v1H14zM14 12h1v1H14zM14 13h1v1H14zM14 14h1v1H14zM14 15h1v1H14zM14 16h1v1H14zM14 17h1v1H14zM14 18h1v1H14zM14 19h1v1H14zM14 20h1v1H14zM14 21h1v1H14zM14 22h1v1H14zM14 23h1v1H14zM14 24h1v1H14z"/><path fill="#fcf4f5" d="M15 9h1v1H15z"/><path fill="#f8e1e3" d="M16 9h1v1H16z"/><path fill="#f3ced1" d="M17 9h1v1H17z"/><path fill="#efbbbf" d="M18 9h1v1H18zM26 16h1v1H26z"/><path fill="#eebbbe" d="M20 9h1v1H20z"/><path fill="#f1c4c8" d="M21 9h1v1H21z"/><path fill="#f4d3d5" d="M22 9h1v1H22z"/><path fill="#f5d6d8" d="M23 9h1v1H23zM27 12h1v1H27zM8 22h1v1H8z"/><path fill="#f0c0c4" d="M24 9h1v1H24z"/><path fill="#e9a3a8" d="M25 9h1v1H25z"/><path fill="#dc6d75" d="M26 9h1v1H26zM6 22h1v1H6zM4 23h1v1H4z"/><path fill="#f8e4e6" d="M15 10h1v1H15zM16 24h1v1H16z"/><path fill="#eeb6ba" d="M16 10h1v1H16z"/><path fill="#e3888e" d="M17 10h1v1H17zM11 22h1v1H11zM22 22h1v1H22z"/><path fill="#d85962" d="M18 10h1v1H18z"/><path fill="#d34751" d="M19 10h1v1H19z"/><path fill="#d75861" d="M20 10h1v1H20zM26 24h1v1H26z"/><path fill="#de747b" d="M21 10h1v1H21z"/><path fill="#e9a1a6" d="M22 10h1v1H22z"/><path fill="#f1c6c9" d="M23 10h1v1H23z"/><path fill="#f6dadc" d="M24 10h1v1H24z"/><path fill="#f7ddde" d="M25 10h1v1H25z"/><path fill="#ebaaae" d="M26 10h1v1H26z"/><path fill="#df777e" d="M27 10h1v1H27z"/><path fill="#d2424d" d="M28 10h1v1H28z"/><path fill="#f7dfe0" d="M15 11h1v1H15zM15 12h1v1H15zM15 13h1v1H15zM15 14h1v1H15zM15 15h1v1H15zM15 16h1v1H15zM15 17h1v1H15zM15 18h1v1H15zM15 19h1v1H15zM15 20h1v1H15z"/><path fill="#eaa6ab" d="M16 11h1v1H16zM16 12h1v1H16zM16 13h1v1H16zM16 14h1v1H16zM16 15h1v1H16zM16 16h1v1H16zM16 17h1v1H16zM16 18h1v1H16zM16 19h1v1H16zM16 20h1v1H16z"/><path fill="#dd6d76" d="M17 11h1v1H17zM17 12h1v1H17zM17 13h1v1H17zM17 14h1v1H17zM17 15h1v1H17zM17 16h1v1H17zM17 17h1v1H17zM17 18h1v1H17zM17 19h1v1H17zM17 20h1v1H17z"/><path fill="#cf3440" d="M18 11h1v1H18zM18 12h1v1H18zM18 13h1v1H18zM18 14h1v1H18zM18 15h1v1H18zM18 16h1v1H18zM18 17h1v1H18zM18 18h1v1H18zM18 19h1v1H18zM18 20h1v1H18z"/><path fill="#c91b28" d="M19 11h1v1H19zM20 12h1v1H20zM22 20h1v1H22zM30 20h1v1H30z"/><path fill="#cc2a35" d="M20 11h1v1H20zM6 21h1v1H6z"/><path fill="#d2424c" d="M21 11h1v1H21zM29 18h1v1H29zM19 22h1v1H19z"/><path fill="#db6a72" d="M22 11h1v1H22z"/><path fill="#e6949a" d="M23 11h1v1H23z"/><path fill="#f1c4c7" d="M24 11h1v1H24zM16 23h1v1H16z"/><path fill="#f8e2e4" d="M25 11h1v1H25z"/><path fill="#f2cbcd" d="M26 11h1v1H26z"/><path fill="#eaa9ad" d="M27 11h1v1H27z"/><path fill="#d85a63" d="M28 11h1v1H28z"/><path fill="#c81623" d="M19 12h1v1H19zM22 19h1v1H22zM21 20h1v1H21zM1 21h1v1H1zM12 26h1v1H12z"/><path fill="#cb222e" d="M21 12h1v1H21zM29 20h1v1H29z"/><path fill="#ce2e3a" d="M22 12h1v1H22z"/><path fill="#d54c56" d="M23 12h1v1H23z"/><path fill="#e59197" d="M24 12h1v1H24z"/><path fill="#f2c9cc" d="M25 12h1v1H25zM20 24h1v1H20z"/><path fill="#f6dbdd" d="M26 12h1v1H26z"/><path fill="#dd6f77" d="M28 12h1v1H28z"/><path fill="#cc2935" d="M23 13h1v1H23z"/><path fill="#eba9ae" d="M25 13h1v1H25zM16 21h1v1H16z"/><path fill="#f6d8da" d="M26 13h1v1H26z"/><path fill="#faebec" d="M27 13h1v1H27z"/><path fill="#e18188" d="M28 13h1v1H28z"/><path fill="#cb232f" d="M23 14h1v1H23zM10 26h1v1H10z"/><path fill="#d6515a" d="M24 14h1v1H24z"/><path fill="#e2848b" d="M25 14h1v1H25zM17 22h1v1H17z"/><path fill="#f2c7cb" d="M26 14h1v1H26zM5 24h1v1H5z"/><path fill="#e59297" d="M28 14h1v1H28z"/><path fill="#d13e49" d="M29 14h1v1H29zM9 26h1v1H9z"/><path fill="#dc6e76" d="M25 15h1v1H25zM9 25h1v1H9z"/><path fill="#efbec1" d="M26 15h1v1H26z"/><path fill="#fbefef" d="M27 15h1v1H27zM27 16h1v1H27z"/><path fill="#e79a9f" d="M28 15h1v1H28zM28 16h1v1H28z"/><path fill="#d54c55" d="M29 15h1v1H29zM29 16h1v1H29z"/><path fill="#ce2f3a" d="M30 15h1v1H30zM30 16h1v1H30zM27 24h1v1H27zM1 25h1v1H1z"/><path fill="#ca1e2b" d="M23 17h1v1H23zM1 23h1v1H1zM26 26h1v1H26z"/><path fill="#d13e48" d="M24 17h1v1H24z"/><path fill="#dc6a72" d="M25 17h1v1H25z"/><path fill="#efbcbf" d="M26 17h1v1H26z"/><path fill="#fbeeef" d="M27 17h1v1H27zM27 18h1v1H27z"/><path fill="#e6989d" d="M28 17h1v1H28z"/><path fill="#d44952" d="M29 17h1v1H29zM2 25h1v1H2z"/><path fill="#cd2e39" d="M30 17h1v1H30z"/><path fill="#ca212d" d="M23 18h1v1H23zM12 24h1v1H12zM28 24h1v1H28zM1 26h1v1H1z"/><path fill="#d44751" d="M24 18h1v1H24z"/><path fill="#df767e" d="M25 18h1v1H25z"/><path fill="#f0c2c5" d="M26 18h1v1H26z"/><path fill="#e59499" d="M28 18h1v1H28z"/><path fill="#d34650" d="M7 19h1v1H7z"/><path fill="#e2828a" d="M8 19h1v1H8z"/><path fill="#faeced" d="M10 19h1v1H10zM8 23h1v1H8z"/><path fill="#ecafb3" d="M11 19h1v1H11z"/><path fill="#d13f49" d="M12 19h1v1H12z"/><path fill="#e59096" d="M25 19h1v1H25z"/><path fill="#f2cacd" d="M26 19h1v1H26zM7 23h1v1H7zM8 24h1v1H8zM22 24h1v1H22z"/><path fill="#f9e8e9" d="M27 19h1v1H27zM25 22h1v1H25z"/><path fill="#e38a90" d="M28 19h1v1H28z"/><path fill="#cf3641" d="M29 19h1v1H29zM23 20h1v1H23z"/><path fill="#cb2531" d="M30 19h1v1H30z"/><path fill="#d54e58" d="M7 20h1v1H7z"/><path fill="#e6959b" d="M8 20h1v1H8z"/><path fill="#f1c3c6" d="M9 20h1v1H9z"/><path fill="#fae9ea" d="M10 20h1v1H10zM15 25h6v1H15z"/><path fill="#ebaaaf" d="M11 20h1v1H11z"/><path fill="#e18288" d="M24 20h1v1H24z"/><path fill="#f0c0c3" d="M25 20h1v1H25z"/><path fill="#f5d8da" d="M26 20h1v1H26z"/><path fill="#f6d9db" d="M27 20h1v1H27z"/><path fill="#df787f" d="M28 20h1v1H28zM15 26h6v1H15z"/><path fill="#c91b27" d="M3 21h1v1H3z"/><path fill="#ecaeb3" d="M8 21h1v1H8z"/><path fill="#f3ced0" d="M9 21h1v1H9z"/><path fill="#f7dfe1" d="M10 21h1v1H10z"/><path fill="#e89fa5" d="M11 21h1v1H11z"/><path fill="#f7e0e2" d="M15 21h1v1H15z"/><path fill="#de737b" d="M17 21h1v1H17zM4 26h1v1H4z"/><path fill="#ca1f2c" d="M19 21h1v1H19z"/><path fill="#cf3843" d="M22 21h1v1H22z"/><path fill="#d75962" d="M23 21h1v1H23z"/><path fill="#eaaaae" d="M24 21h1v1H24zM23 22h1v1H23z"/><path fill="#f8e3e4" d="M25 21h1v1H25z"/><path fill="#efbdc0" d="M27 21h1v1H27z"/><path fill="#da636b" d="M28 21h1v1H28zM14 26h1v1H14z"/><path fill="#c91e2a" d="M2 22h1v1H2zM11 25h1v1H11z"/><path fill="#d75760" d="M5 22h1v1H5z"/><path fill="#f1c6ca" d="M10 22h1v1H10z"/><path fill="#cf343f" d="M12 22h1v1H12z"/><path fill="#d7555e" d="M18 22h1v1H18zM13 25h1v1H13z"/><path fill="#d7545d" d="M20 22h1v1H20z"/><path fill="#dc6a73" d="M21 22h1v1H21z"/><path fill="#f4d4d6" d="M24 22h1v1H24zM17 24h1v1H17z"/><path fill="#edb6ba" d="M26 22h1v1H26z"/><path fill="#e18289" d="M27 22h1v1H27z"/><path fill="#d34852" d="M28 22h1v1H28z"/><path fill="#cc2834" d="M2 23h1v1H2z"/><path fill="#d44a54" d="M3 23h1v1H3z"/><path fill="#e38b92" d="M5 23h1v1H5z"/><path fill="#eaaaaf" d="M6 23h1v1H6z"/><path fill="#f4d2d4" d="M9 23h1v1H9z"/><path fill="#e9a5aa" d="M10 23h1v1H10z"/><path fill="#dc6b73" d="M11 23h1v1H11z"/><path fill="#cd2c38" d="M12 23h1v1H12z"/><path fill="#f9e9eb" d="M15 23h1v1H15z"/><path fill="#df7a81" d="M18 23h1v1H18z"/><path fill="#dd7077" d="M19 23h1v1H19z"/><path fill="#e3888f" d="M20 23h1v1H20zM25 24h1v1H25z"/><path fill="#eaa4a9" d="M21 23h1v1H21z"/><path fill="#f1c5c8" d="M22 23h1v1H22z"/><path fill="#f7dedf" d="M23 23h1v1H23z"/><path fill="#f8e5e6" d="M24 23h1v1H24z"/><path fill="#d54f59" d="M27 23h1v1H27zM3 26h1v1H3z"/><path fill="#ce303b" d="M28 23h1v1H28z"/><path fill="#d13d47" d="M2 24h1v1H2z"/><path fill="#eeb7bb" d="M4 24h1v1H4z"/><path fill="#f4d1d4" d="M6 24h1v1H6z"/><path fill="#f3cfd2" d="M7 24h1v1H7z"/><path fill="#e8a0a5" d="M9 24h1v1H9z"/><path fill="#db6871" d="M10 24h1v1H10z"/><path fill="#fcf5f6" d="M15 24h1v1H15z"/><path fill="#f0c3c6" d="M18 24h1v1H18z"/><path fill="#f0bec2" d="M19 24h1v1H19z"/><path fill="#f3cfd1" d="M21 24h1v1H21z"/><path fill="#f0bfc2" d="M23 24h1v1H23z"/><path fill="#eaa7ab" d="M24 24h1v1H24z"/><path fill="#e59298" d="M3 25h1v1H3z"/><path fill="#f7e0e1" d="M4 25h1v1H4z"/><path fill="#f8e3e5" d="M5 25h1v1H5z"/><path fill="#f7dddf" d="M6 25h1v1H6zM21 25h1v1H21z"/><path fill="#f0c1c5" d="M7 25h1v1H7z"/><path fill="#e8a1a7" d="M8 25h1v1H8z"/><path fill="#ce343f" d="M10 25h1v1H10z"/><path fill="#efbcc0" d="M14 25h1v1H14z"/><path fill="#efbdc1" d="M22 25h1v1H22z"/><path fill="#e7999e" d="M23 25h1v1H23z"/><path fill="#d3444d" d="M25 25h1v1H25z"/><path fill="#cd2a35" d="M26 25h1v1H26z"/><path fill="#de757d" d="M5 26h1v1H5z"/><path fill="#de727a" d="M6 26h1v1H6zM21 26h1v1H21z"/><path fill="#db656e" d="M7 26h1v1H7z"/><path fill="#d75660" d="M8 26h1v1H8z"/><path fill="#c81925" d="M11 26h1v1H11z"/><path fill="#cf333e" d="M13 26h1v1H13z"/><path fill="#da636c" d="M22 26h1v1H22z"/><path fill="#d6525c" d="M23 26h1v1H23z"/></svg>`;export const PINDUODUO_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\" width=\"100%\" height=\"100%\" shape-rendering=\"crispEdges\"><path fill=\"#f40009\" fill-opacity=\"0.007843\" d=\"M47 5h1v1H47zM47 42h1v1H47zM45 45h1v1H45zM5 47h1v1H5zM42 47h1v1H42z\"/><path fill=\"#f30008\" fill-opacity=\"0.192157\" d=\"M6 0h1v1H6zM41 0h1v1H41zM4 1h1v1H4zM43 1h1v1H43zM1 4h1v1H1zM46 4h1v1H46zM0 6h1v1H0zM0 41h1v1H0zM1 43h1v1H1zM4 46h1v1H4z\"/><path fill=\"#f30008\" fill-opacity=\"0.301961\" d=\"M3 2h1v1H3zM44 2h1v1H44zM2 3h1v1H2zM47 6h1v1H47zM47 41h1v1H47zM46 43h1v1H46zM2 44h1v1H2zM43 46h1v1H43zM6 47h1v1H6zM41 47h1v1H41z\"/><path fill=\"#f30008\" fill-opacity=\"0.411765\" d=\"M45 3h1v1H45zM45 44h1v1H45zM3 45h1v1H3zM44 45h1v1H44z\"/><path fill=\"#f40009\" fill-opacity=\"0.568627\" d=\"M7 0h1v1H7zM40 0h1v1H40zM0 7h1v1H0zM0 40h1v1H0z\"/><path fill=\"#f30008\" fill-opacity=\"0.694118\" d=\"M5 1h1v1H5zM42 1h1v1H42zM1 5h1v1H1zM47 7h1v1H47zM47 40h1v1H47zM1 42h1v1H1zM7 47h1v1H7zM40 47h1v1H40z\"/><path fill=\"#f30008\" fill-opacity=\"0.803922\" d=\"M8 0h1v1H8zM39 0h1v1H39zM46 5h1v1H46zM0 8h1v1H0zM0 39h1v1H0zM46 42h1v1H46zM5 46h1v1H5zM42 46h1v1H42z\"/><path fill=\"#f30008\" fill-opacity=\"0.996078\" d=\"M9 0h30v1H9zM6 1h36v1H6zM4 2h40v1H4zM3 3h42v1H3zM2 4h44v1H2zM2 5h44v1H2zM1 6h46v1H1zM1 7h11v1H1zM16 7h16v1H16zM36 7h11v1H36zM1 8h9v1H1zM17 8h14v1H17zM38 8h10v1H38zM0 9h9v1H0zM19 9h10v1H19zM39 9h9v1H39zM0 10h8v1H0zM20 10h8v1H20zM40 10h8v1H40zM0 11h6v1H0zM22 11h5v1H22zM42 11h6v1H42zM0 12h5v1H0zM10 12h1v1H10zM16 12h3v1H16zM23 12h2v1H23zM30 12h2v1H30zM37 12h2v1H37zM43 12h5v1H43zM0 13h4v1H0zM10 13h1v1H10zM16 13h3v1H16zM36 13h3v1H36zM44 13h4v1H44zM0 14h4v1H0zM9 14h3v1H9zM16 14h3v1H16zM23 14h2v1H23zM36 14h3v1H36zM44 14h4v1H44zM0 15h4v1H0zM22 15h4v1H22zM44 15h4v1H44zM0 16h4v1H0zM20 16h1v1H20zM22 16h1v1H22zM25 16h1v1H25zM44 16h4v1H44zM0 17h4v1H0zM19 17h1v1H19zM44 17h4v1H44zM0 18h4v1H0zM17 18h2v1H17zM29 18h2v1H29zM44 18h4v1H44zM0 19h4v1H0zM16 19h4v1H16zM29 19h3v1H29zM44 19h4v1H44zM0 20h4v1H0zM6 20h3v1H6zM14 20h6v1H14zM28 20h6v1H28zM38 20h3v1H38zM44 20h4v1H44zM0 21h4v1H0zM6 21h3v1H6zM15 21h4v1H15zM29 21h4v1H29zM39 21h2v1H39zM44 21h4v1H44zM0 22h4v1H0zM16 22h3v1H16zM30 22h2v1H30zM44 22h4v1H44zM0 23h4v1H0zM18 23h2v1H18zM22 23h1v1H22zM25 23h1v1H25zM28 23h2v1H28zM44 23h4v1H44zM0 24h4v1H0zM22 24h1v1H22zM25 24h1v1H25zM28 24h1v1H28zM44 24h4v1H44zM0 25h4v1H0zM22 25h1v1H22zM25 25h1v1H25zM44 25h4v1H44zM0 26h4v1H0zM17 26h1v1H17zM22 26h4v1H22zM44 26h4v1H44zM0 27h4v1H0zM23 27h2v1H23zM30 27h2v1H30zM36 27h3v1H36zM44 27h4v1H44zM0 28h4v1H0zM30 28h2v1H30zM36 28h3v1H36zM44 28h4v1H44zM0 29h5v1H0zM36 29h3v1H36zM43 29h5v1H43zM0 30h7v1H0zM41 30h7v1H41zM0 31h8v1H0zM40 31h8v1H40zM0 32h10v1H0zM38 32h10v1H38zM0 33h11v1H0zM20 33h2v1H20zM37 33h11v1H37zM0 34h12v1H0zM19 34h3v1H19zM27 34h1v1H27zM36 34h12v1H36zM0 35h14v1H0zM26 35h3v1H26zM34 35h14v1H34zM0 36h15v1H0zM26 36h2v1H26zM33 36h15v1H33zM0 37h17v1H0zM31 37h17v1H31zM0 38h18v1H0zM30 38h18v1H30zM1 39h19v1H1zM29 39h19v1H29zM1 40h20v1H1zM27 40h20v1H27zM1 41h21v1H1zM26 41h21v1H26zM2 42h44v1H2zM2 43h44v1H2zM3 44h42v1H3zM4 45h40v1H4zM6 46h36v1H6zM8 47h32v1H8z\"/><path fill=\"#f4131b\" d=\"M10 8h1v1H10zM29 9h1v1H29zM21 11h1v1H21zM30 11h2v1H30zM30 13h1v1H30zM22 17h1v1H22zM34 20h1v1H34zM19 24h1v1H19zM11 27h1v1H11zM5 29h1v1H5zM12 34h1v1H12zM22 34h1v1H22zM26 34h1v1H26zM28 36h1v1H28zM28 39h1v1H28z\"/><path fill=\"#f51c24\" d=\"M37 8h1v1H37zM18 9h1v1H18zM31 13h1v1H31zM40 19h1v1H40zM41 20h2v1H41zM30 23h1v1H30zM9 29h1v1H9zM42 29h1v1H42zM19 33h1v1H19zM28 34h1v1H28zM35 34h1v1H35zM15 36h1v1H15zM22 41h1v1H22z\"/><path fill=\"#f5282f\" d=\"M15 7h1v1H15zM32 7h1v1H32zM6 11h1v1H6zM26 15h1v1H26zM13 20h1v1H13zM22 20h1v1H22zM9 21h1v1H9zM34 21h1v1H34zM38 21h1v1H38zM29 22h1v1H29zM17 23h1v1H17zM16 26h1v1H16zM18 26h1v1H18zM21 26h1v1H21zM26 26h1v1H26zM15 27h1v1H15zM19 27h1v1H19zM39 27h1v1H39zM15 28h1v1H15zM17 28h1v1H17zM19 28h1v1H19zM23 28h2v1H23zM8 31h1v1H8zM32 36h1v1H32zM25 41h1v1H25z\"/><path fill=\"#f6343b\" d=\"M25 12h1v1H25zM36 12h1v1H36zM21 15h1v1H21zM26 16h1v1H26zM20 17h1v1H20zM29 17h1v1H29zM14 21h1v1H14zM16 27h1v1H16zM18 27h1v1H18zM10 28h1v1H10zM10 29h1v1H10zM39 31h1v1H39zM27 33h1v1H27zM18 34h1v1H18zM14 35h1v1H14zM18 38h1v1H18z\"/><path fill=\"#f63b42\" d=\"M41 11h1v1H41zM18 17h1v1H18zM19 18h1v1H19zM32 19h1v1H32zM13 21h1v1H13zM33 21h1v1H33zM19 22h1v1H19zM24 25h1v1H24zM17 27h1v1H17zM4 28h1v1H4zM16 28h1v1H16zM18 28h1v1H18zM16 29h1v1H16zM18 29h1v1H18zM34 34h1v1H34z\"/><path fill=\"#f6484f\" d=\"M9 9h1v1H9zM28 10h1v1H28zM37 11h1v1H37zM19 12h1v1H19zM22 12h1v1H22zM9 13h1v1H9zM24 13h1v1H24zM39 13h1v1H39zM37 15h1v1H37zM24 16h1v1H24zM28 17h1v1H28zM28 18h1v1H28zM8 19h1v1H8zM15 19h1v1H15zM6 22h3v1H6zM40 22h1v1H40zM20 23h1v1H20zM29 24h1v1H29zM20 25h1v1H20zM27 25h1v1H27zM11 26h1v1H11zM30 26h2v1H30zM39 28h1v1H39zM43 28h1v1H43zM17 29h1v1H17zM30 29h2v1H30zM39 29h1v1H39zM11 33h1v1H11zM13 34h1v1H13zM33 35h1v1H33zM29 38h1v1H29z\"/><path fill=\"#f7545a\" d=\"M38 9h1v1H38zM19 10h1v1H19zM16 11h1v1H16zM18 11h1v1H18zM15 12h1v1H15zM10 15h1v1H10zM21 16h1v1H21zM25 17h1v1H25zM7 19h1v1H7zM9 20h1v1H9zM25 20h1v1H25zM41 21h2v1H41zM18 24h1v1H18zM25 27h1v1H25zM20 30h1v1H20zM27 30h1v1H27zM36 33h1v1H36zM20 35h1v1H20zM20 36h1v1H20zM21 40h1v1H21z\"/><path fill=\"#f75e63\" d=\"M12 7h1v1H12zM31 8h1v1H31zM6 15h1v1H6zM10 18h1v1H10zM37 18h1v1H37zM20 20h1v1H20zM12 26h1v1H12z\"/><path fill=\"#f86a6f\" d=\"M34 7h2v1H34zM16 8h1v1H16zM34 8h1v1H34zM34 9h1v1H34zM34 10h1v1H34zM34 11h1v1H34zM5 12h1v1H5zM29 12h1v1H29zM34 12h1v1H34zM11 13h1v1H11zM23 13h1v1H23zM34 13h1v1H34zM4 14h1v1H4zM25 14h1v1H25zM34 14h1v1H34zM39 14h1v1H39zM43 14h1v1H43zM17 15h2v1H17zM34 15h1v1H34zM38 15h1v1H38zM41 15h1v1H41zM23 16h1v1H23zM34 16h1v1H34zM40 16h1v1H40zM9 17h1v1H9zM23 17h1v1H23zM34 17h1v1H34zM38 17h1v1H38zM23 18h1v1H23zM34 18h1v1H34zM34 19h1v1H34zM39 19h1v1H39zM23 20h1v1H23zM34 22h1v1H34zM34 23h1v1H34zM34 24h1v1H34zM23 25h1v1H23zM34 25h1v1H34zM34 26h1v1H34zM4 27h1v1H4zM22 27h1v1H22zM34 27h1v1H34zM34 28h1v1H34zM8 29h1v1H8zM15 29h1v1H15zM19 29h1v1H19zM26 29h1v1H26zM34 29h1v1H34zM7 30h1v1H7zM34 30h1v1H34zM19 31h1v1H19zM34 31h1v1H34zM17 32h1v1H17zM30 32h1v1H30zM34 32h1v1H34zM16 33h1v1H16zM26 33h1v1H26zM31 33h1v1H31zM34 33h1v1H34zM14 34h1v1H14zM26 40h1v1H26z\"/><path fill=\"#f8757a\" d=\"M29 11h1v1H29zM38 11h1v1H38zM9 12h1v1H9zM32 12h1v1H32zM4 13h1v1H4zM5 14h1v1H5zM9 15h1v1H9zM16 15h1v1H16zM7 16h1v1H7zM6 19h1v1H6zM12 19h1v1H12zM36 19h1v1H36zM19 21h1v1H19zM11 22h1v1H11zM36 22h1v1H36zM26 25h1v1H26zM36 26h2v1H36zM12 27h1v1H12zM43 27h1v1H43zM21 29h1v1H21zM40 30h1v1H40zM28 31h1v1H28zM28 33h1v1H28zM33 34h1v1H33zM17 37h1v1H17zM23 41h2v1H23z\"/><path fill=\"#f97d81\" d=\"M13 7h1v1H13zM42 12h1v1H42zM22 14h1v1H22zM11 15h1v1H11zM27 16h2v1H27zM32 22h1v1H32zM22 29h1v1H22z\"/><path fill=\"#f98a8e\" d=\"M13 8h1v1H13zM13 9h1v1H13zM8 10h1v1H8zM13 10h1v1H13zM10 11h1v1H10zM13 11h1v1H13zM32 11h1v1H32zM13 12h1v1H13zM13 13h1v1H13zM43 13h1v1H43zM13 14h1v1H13zM42 14h1v1H42zM13 15h1v1H13zM30 15h1v1H30zM13 16h1v1H13zM19 16h1v1H19zM13 17h1v1H13zM13 18h1v1H13zM25 18h1v1H25zM31 18h1v1H31zM11 19h1v1H11zM13 19h1v1H13zM35 19h1v1H35zM12 21h1v1H12zM28 21h1v1H28zM35 21h1v1H35zM9 22h1v1H9zM13 22h1v1H13zM15 22h1v1H15zM22 22h1v1H22zM10 23h1v1H10zM13 23h1v1H13zM37 23h1v1H37zM8 24h1v1H8zM13 24h1v1H13zM27 24h1v1H27zM39 24h1v1H39zM7 25h1v1H7zM13 25h1v1H13zM21 25h1v1H21zM28 25h1v1H28zM40 25h1v1H40zM13 26h1v1H13zM38 26h1v1H38zM13 27h1v1H13zM29 27h1v1H29zM13 28h1v1H13zM29 28h1v1H29zM40 28h1v1H40zM13 29h1v1H13zM25 29h1v1H25zM13 30h1v1H13zM13 31h1v1H13zM29 31h1v1H29zM10 32h1v1H10zM13 32h1v1H13zM13 33h1v1H13zM15 34h1v1H15zM30 37h1v1H30z\"/><path fill=\"#fa9599\" d=\"M39 10h1v1H39zM9 11h1v1H9zM27 11h1v1H27zM11 12h1v1H11zM31 15h1v1H31zM8 16h1v1H8zM16 18h1v1H16zM23 23h1v1H23zM23 24h1v1H23zM19 25h1v1H19zM30 25h1v1H30zM15 26h1v1H15zM19 26h1v1H19zM32 27h1v1H32zM32 28h1v1H32zM30 30h1v1H30zM18 31h1v1H18zM37 32h1v1H37zM19 37h2v1H19zM20 39h1v1H20z\"/><path fill=\"#fa9da1\" d=\"M26 17h1v1H26zM5 21h1v1H5zM31 25h1v1H31zM42 26h1v1H42zM25 28h1v1H25zM31 30h1v1H31zM32 34h1v1H32z\"/><path fill=\"#faa8ab\" d=\"M14 7h1v1H14zM11 8h1v1H11zM30 9h1v1H30zM36 10h1v1H36zM11 11h1v1H11zM19 11h2v1H19zM36 11h1v1H36zM39 12h1v1H39zM39 16h1v1H39zM8 17h1v1H8zM39 17h1v1H39zM7 18h1v1H7zM22 19h1v1H22zM43 20h1v1H43zM43 21h1v1H43zM39 22h1v1H39zM38 23h1v1H38zM20 24h1v1H20zM24 24h1v1H24zM5 26h2v1H5zM39 26h1v1H39zM9 28h1v1H9zM11 28h1v1H11zM22 28h1v1H22zM6 29h1v1H6zM24 29h1v1H24zM24 30h1v1H24zM24 31h1v1H24zM18 32h1v1H18zM24 32h1v1H24zM27 32h1v1H27zM22 33h1v1H22zM24 33h1v1H24zM32 33h1v1H32zM23 34h2v1H23zM24 35h1v1H24zM19 36h1v1H19zM24 36h1v1H24zM24 37h1v1H24zM24 38h1v1H24zM24 39h1v1H24zM27 39h1v1H27zM24 40h1v1H24z\"/><path fill=\"#fbb7ba\" d=\"M33 7h1v1H33zM36 8h1v1H36zM17 9h1v1H17zM15 11h1v1H15zM17 11h1v1H17zM8 14h1v1H8zM30 14h1v1H30zM36 15h1v1H36zM11 18h1v1H11zM27 18h1v1H27zM14 19h1v1H14zM26 20h1v1H26zM35 20h1v1H35zM23 21h1v1H23zM9 23h1v1H9zM27 23h1v1H27zM31 23h1v1H31zM9 24h1v1H9zM26 24h1v1H26zM36 25h2v1H36zM41 26h1v1H41zM10 27h1v1H10zM12 28h1v1H12zM23 29h1v1H23zM41 29h1v1H41zM23 30h1v1H23zM23 31h1v1H23zM20 32h1v1H20zM23 32h1v1H23zM29 32h1v1H29zM15 33h1v1H15zM23 33h1v1H23zM23 35h1v1H23zM16 36h1v1H16zM23 36h1v1H23zM23 37h1v1H23zM23 38h1v1H23zM23 39h1v1H23zM23 40h1v1H23z\"/><path fill=\"#fcbfc1\" d=\"M25 21h1v1H25zM39 25h1v1H39z\"/><path fill=\"#fcc8c9\" d=\"M7 11h1v1H7zM19 13h1v1H19zM29 13h1v1H29zM35 13h1v1H35zM19 14h1v1H19zM31 14h1v1H31zM4 15h1v1H4zM20 15h1v1H20zM27 15h1v1H27zM42 15h1v1H42zM4 16h1v1H4zM4 17h1v1H4zM30 17h1v1H30zM4 18h1v1H4zM36 18h1v1H36zM4 19h1v1H4zM20 19h1v1H20zM28 19h1v1H28zM4 20h2v1H4zM12 20h1v1H12zM27 20h1v1H27zM4 21h1v1H4zM4 22h1v1H4zM12 22h1v1H12zM25 22h1v1H25zM4 23h1v1H4zM16 23h1v1H16zM4 24h1v1H4zM21 24h1v1H21zM38 24h1v1H38zM4 25h1v1H4zM41 25h1v1H41zM4 26h1v1H4zM27 26h1v1H27zM35 27h1v1H35zM40 27h1v1H40zM35 28h1v1H35zM12 29h1v1H12zM21 30h1v1H21zM26 30h1v1H26zM28 30h1v1H28zM9 31h1v1H9zM18 33h1v1H18zM31 36h1v1H31z\"/><path fill=\"#fcd7d9\" d=\"M14 8h1v1H14zM14 9h1v1H14zM14 10h1v1H14zM29 10h1v1H29zM37 10h1v1H37zM14 11h1v1H14zM40 11h1v1H40zM14 12h1v1H14zM21 12h1v1H21zM26 12h1v1H26zM14 13h2v1H14zM32 13h1v1H32zM12 14h1v1H12zM14 14h2v1H14zM35 14h1v1H35zM5 15h1v1H5zM7 15h2v1H7zM14 15h1v1H14zM40 15h1v1H40zM43 15h1v1H43zM14 16h1v1H14zM43 16h1v1H43zM14 17h1v1H14zM17 17h1v1H17zM43 17h1v1H43zM8 18h2v1H8zM14 18h1v1H14zM22 18h1v1H22zM38 18h1v1H38zM43 18h1v1H43zM9 19h1v1H9zM33 19h1v1H33zM38 19h1v1H38zM43 19h1v1H43zM37 20h1v1H37zM5 22h1v1H5zM14 22h1v1H14zM28 22h1v1H28zM35 22h1v1H35zM37 22h1v1H37zM43 22h1v1H43zM14 23h1v1H14zM43 23h1v1H43zM14 24h1v1H14zM43 24h1v1H43zM6 25h1v1H6zM14 25h1v1H14zM38 25h1v1H38zM43 25h1v1H43zM14 26h1v1H14zM20 26h1v1H20zM43 26h1v1H43zM5 27h1v1H5zM14 27h1v1H14zM5 28h1v1H5zM14 28h1v1H14zM11 29h1v1H11zM14 29h1v1H14zM35 29h1v1H35zM14 30h1v1H14zM19 30h1v1H19zM36 30h3v1H36zM14 31h1v1H14zM38 31h1v1H38zM14 32h1v1H14zM14 33h1v1H14zM19 35h1v1H19zM26 37h2v1H26zM19 38h1v1H19zM28 38h1v1H28z\"/><path fill=\"#fddfe0\" d=\"M10 9h1v1H10zM10 22h1v1H10zM26 23h1v1H26zM31 32h1v1H31zM17 33h1v1H17z\"/><path fill=\"#fde8e9\" d=\"M32 8h1v1H32zM37 9h1v1H37zM18 10h1v1H18zM38 10h1v1H38zM12 15h1v1H12zM15 15h1v1H15zM19 15h1v1H19zM39 15h1v1H39zM41 16h1v1H41zM10 17h1v1H10zM21 17h1v1H21zM37 17h1v1H37zM20 18h1v1H20zM40 18h1v1H40zM41 19h2v1H41zM22 21h1v1H22zM26 21h2v1H26zM37 21h1v1H37zM20 22h1v1H20zM21 23h1v1H21zM24 23h1v1H24zM17 24h1v1H17zM30 24h1v1H30zM40 24h1v1H40zM8 25h1v1H8zM11 25h1v1H11zM17 25h1v1H17zM35 26h1v1H35zM26 27h1v1H26zM42 27h1v1H42zM8 28h1v1H8zM42 28h1v1H42zM27 29h1v1H27zM39 30h1v1H39zM20 31h1v1H20zM16 32h1v1H16zM21 32h1v1H21zM12 33h1v1H12zM30 33h1v1H30zM35 33h1v1H35zM15 35h1v1H15zM18 35h1v1H18zM21 35h2v1H21zM32 35h1v1H32zM28 37h1v1H28zM22 40h1v1H22z\"/><path fill=\"#fefcfc\" d=\"M12 8h1v1H12zM15 8h1v1H15zM33 8h1v1H33zM35 8h1v1H35zM11 9h2v1H11zM15 9h2v1H15zM31 9h3v1H31zM35 9h2v1H35zM9 10h4v1H9zM15 10h3v1H15zM30 10h4v1H30zM35 10h1v1H35zM8 11h1v1H8zM12 11h1v1H12zM28 11h1v1H28zM33 11h1v1H33zM35 11h1v1H35zM39 11h1v1H39zM6 12h3v1H6zM12 12h1v1H12zM20 12h1v1H20zM27 12h2v1H27zM33 12h1v1H33zM35 12h1v1H35zM40 12h2v1H40zM5 13h4v1H5zM12 13h1v1H12zM20 13h3v1H20zM25 13h4v1H25zM33 13h1v1H33zM40 13h3v1H40zM6 14h2v1H6zM20 14h2v1H20zM26 14h4v1H26zM32 14h2v1H32zM40 14h2v1H40zM28 15h2v1H28zM32 15h2v1H32zM35 15h1v1H35zM5 16h2v1H5zM9 16h4v1H9zM15 16h4v1H15zM29 16h5v1H29zM35 16h4v1H35zM42 16h1v1H42zM5 17h3v1H5zM11 17h2v1H11zM15 17h2v1H15zM24 17h1v1H24zM27 17h1v1H27zM31 17h3v1H31zM35 17h2v1H35zM40 17h3v1H40zM5 18h2v1H5zM12 18h1v1H12zM15 18h1v1H15zM21 18h1v1H21zM24 18h1v1H24zM26 18h1v1H26zM32 18h2v1H32zM35 18h1v1H35zM39 18h1v1H39zM41 18h2v1H41zM5 19h1v1H5zM10 19h1v1H10zM21 19h1v1H21zM23 19h5v1H23zM37 19h1v1H37zM10 20h2v1H10zM21 20h1v1H21zM24 20h1v1H24zM36 20h1v1H36zM10 21h2v1H10zM20 21h2v1H20zM24 21h1v1H24zM36 21h1v1H36zM21 22h1v1H21zM23 22h2v1H23zM26 22h2v1H26zM33 22h1v1H33zM38 22h1v1H38zM41 22h2v1H41zM5 23h4v1H5zM11 23h2v1H11zM15 23h1v1H15zM32 23h2v1H32zM35 23h2v1H35zM39 23h4v1H39zM5 24h3v1H5zM10 24h3v1H10zM15 24h2v1H15zM31 24h3v1H31zM35 24h3v1H35zM41 24h2v1H41zM5 25h1v1H5zM9 25h2v1H9zM12 25h1v1H12zM15 25h2v1H15zM18 25h1v1H18zM29 25h1v1H29zM32 25h2v1H32zM35 25h1v1H35zM42 25h1v1H42zM7 26h4v1H7zM28 26h2v1H28zM32 26h2v1H32zM40 26h1v1H40zM6 27h4v1H6zM20 27h2v1H20zM27 27h2v1H27zM33 27h1v1H33zM41 27h1v1H41zM6 28h2v1H6zM20 28h2v1H20zM26 28h3v1H26zM33 28h1v1H33zM41 28h1v1H41zM7 29h1v1H7zM20 29h1v1H20zM28 29h2v1H28zM32 29h2v1H32zM40 29h1v1H40zM8 30h5v1H8zM15 30h4v1H15zM22 30h1v1H22zM25 30h1v1H25zM29 30h1v1H29zM32 30h2v1H32zM35 30h1v1H35zM10 31h3v1H10zM15 31h3v1H15zM21 31h2v1H21zM25 31h3v1H25zM30 31h4v1H30zM35 31h3v1H35zM11 32h2v1H11zM15 32h1v1H15zM19 32h1v1H19zM22 32h1v1H22zM25 32h2v1H25zM28 32h1v1H28zM32 32h2v1H32zM35 32h2v1H35zM25 33h1v1H25zM29 33h1v1H29zM33 33h1v1H33zM16 34h2v1H16zM25 34h1v1H25zM29 34h3v1H29zM16 35h2v1H16zM25 35h1v1H25zM29 35h3v1H29zM17 36h2v1H17zM21 36h2v1H21zM25 36h1v1H25zM29 36h2v1H29zM18 37h1v1H18zM21 37h2v1H21zM25 37h1v1H25zM29 37h1v1H29zM20 38h3v1H20zM25 38h3v1H25zM21 39h2v1H21zM25 39h2v1H25zM25 40h1v1H25z\"/></svg>";export const YOUZAN_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" width=\"100%\" height=\"100%\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h1v1H0zM63 0h1v1H63zM32 12h1v1H32zM31 13h5v1H31zM31 14h5v1H31zM31 15h5v1H31zM31 16h5v1H31zM31 17h5v1H31zM30 18h6v1H30zM30 19h6v1H30zM30 20h6v1H30zM30 21h6v1H30zM29 22h7v1H29zM29 23h7v1H29zM29 24h7v1H29zM28 25h9v1H28zM42 25h5v1H42zM28 26h17v1H28zM46 26h1v1H46zM28 27h19v1H28zM27 28h20v1H27zM26 29h21v1H26zM26 30h21v1H26zM24 31h23v1H24zM20 32h1v1H20zM24 32h23v1H24zM16 33h5v1H16zM24 33h23v1H24zM16 34h1v1H16zM18 34h3v1H18zM24 34h23v1H24zM16 35h5v1H16zM24 35h23v1H24zM16 36h5v1H16zM24 36h22v1H24zM16 37h5v1H16zM24 37h22v1H24zM16 38h5v1H16zM24 38h23v1H24zM16 39h5v1H16zM24 39h23v1H24zM16 40h5v1H16zM24 40h22v1H24zM16 41h5v1H16zM24 41h22v1H24zM16 42h5v1H16zM24 42h22v1H24zM16 43h5v1H16zM24 43h22v1H24zM16 44h5v1H16zM24 44h22v1H24zM16 45h5v1H16zM24 45h21v1H24zM16 46h5v1H16zM24 46h15v1H24zM16 47h5v1H16zM24 47h9v1H24zM16 48h1v1H16zM18 48h3v1H18zM24 48h3v1H24zM16 49h5v1H16zM0 63h1v1H0zM63 63h1v1H63z\"/><path fill=\"#f67b7b\" d=\"M1 0h1v1H1zM62 0h1v1H62zM0 1h1v1H0zM63 1h1v1H63zM36 21h1v1H36zM36 24h1v1H36zM45 24h1v1H45zM27 26h1v1H27zM23 31h1v1H23zM17 32h1v1H17zM36 47h1v1H36zM30 48h1v1H30zM21 49h1v1H21zM24 49h1v1H24zM0 62h1v1H0zM63 62h1v1H63zM1 63h1v1H1zM62 63h1v1H62z\"/><path fill=\"#ef1414\" d=\"M2 0h1v1H2zM61 0h1v1H61zM0 2h1v1H0zM63 2h1v1H63zM29 17h1v1H29zM40 24h1v1H40zM26 27h1v1H26zM47 37h1v1H47zM39 47h1v1H39zM33 48h1v1H33zM27 49h1v1H27zM15 50h1v1H15zM0 61h1v1H0zM63 61h1v1H63zM2 63h1v1H2zM61 63h1v1H61z\"/><path fill=\"#ee0000\" d=\"M3 0h58v1H3zM1 1h62v1H1zM1 2h62v1H1zM0 3h64v1H0zM0 4h64v1H0zM0 5h64v1H0zM0 6h64v1H0zM0 7h64v1H0zM0 8h64v1H0zM0 9h64v1H0zM0 10h64v1H0zM0 11h32v1H0zM34 11h30v1H34zM0 12h31v1H0zM36 12h28v1H36zM0 13h30v1H0zM37 13h27v1H37zM0 14h30v1H0zM37 14h27v1H37zM0 15h30v1H0zM37 15h27v1H37zM0 16h30v1H0zM37 16h27v1H37zM0 17h29v1H0zM37 17h27v1H37zM0 18h29v1H0zM37 18h27v1H37zM0 19h29v1H0zM37 19h27v1H37zM0 20h29v1H0zM37 20h27v1H37zM0 21h29v1H0zM37 21h27v1H37zM0 22h28v1H0zM37 22h27v1H37zM0 23h28v1H0zM37 23h27v1H37zM0 24h28v1H0zM37 24h3v1H37zM47 24h17v1H47zM0 25h27v1H0zM48 25h16v1H48zM0 26h27v1H0zM48 26h16v1H48zM0 27h26v1H0zM48 27h16v1H48zM0 28h26v1H0zM48 28h16v1H48zM0 29h25v1H0zM48 29h16v1H48zM0 30h24v1H0zM48 30h16v1H48zM0 31h20v1H0zM22 31h1v1H22zM48 31h16v1H48zM0 32h16v1H0zM22 32h1v1H22zM48 32h16v1H48zM0 33h15v1H0zM22 33h1v1H22zM48 33h16v1H48zM0 34h15v1H0zM22 34h1v1H22zM48 34h16v1H48zM0 35h15v1H0zM22 35h1v1H22zM48 35h16v1H48zM0 36h15v1H0zM22 36h1v1H22zM47 36h17v1H47zM0 37h15v1H0zM22 37h1v1H22zM48 37h16v1H48zM0 38h15v1H0zM22 38h1v1H22zM48 38h16v1H48zM0 39h15v1H0zM22 39h1v1H22zM48 39h16v1H48zM0 40h15v1H0zM22 40h1v1H22zM47 40h17v1H47zM0 41h15v1H0zM22 41h1v1H22zM47 41h17v1H47zM0 42h15v1H0zM22 42h1v1H22zM47 42h17v1H47zM0 43h15v1H0zM22 43h1v1H22zM47 43h17v1H47zM0 44h15v1H0zM22 44h1v1H22zM47 44h17v1H47zM0 45h15v1H0zM22 45h1v1H22zM46 45h18v1H46zM0 46h15v1H0zM22 46h1v1H22zM45 46h19v1H45zM0 47h15v1H0zM22 47h1v1H22zM40 47h24v1H40zM0 48h15v1H0zM22 48h1v1H22zM34 48h30v1H34zM0 49h15v1H0zM22 49h1v1H22zM28 49h36v1H28zM0 50h15v1H0zM21 50h43v1H21zM0 51h64v1H0zM0 52h64v1H0zM0 53h64v1H0zM0 54h64v1H0zM0 55h64v1H0zM0 56h64v1H0zM0 57h64v1H0zM0 58h64v1H0zM0 59h64v1H0zM0 60h64v1H0zM1 61h62v1H1zM1 62h62v1H1zM3 63h58v1H3z\"/><path fill=\"#f01c1c\" d=\"M32 11h2v1H32zM41 24h1v1H41zM20 31h2v1H20zM47 39h1v1H47zM46 44h1v1H46zM20 50h1v1H20z\"/><path fill=\"#f78585\" d=\"M31 12h1v1H31zM36 20h1v1H36zM26 28h1v1H26zM47 28h1v1H47zM21 32h1v1H21zM21 33h1v1H21zM21 34h1v1H21zM21 35h1v1H21zM21 36h1v1H21zM21 37h1v1H21zM21 38h1v1H21zM21 39h1v1H21zM21 40h1v1H21zM21 41h1v1H21zM21 42h1v1H21zM21 43h1v1H21zM21 44h1v1H21zM21 45h1v1H21zM21 46h1v1H21zM42 46h1v1H42zM21 47h1v1H21zM21 48h1v1H21zM15 49h1v1H15zM16 50h1v1H16z\"/><path fill=\"#fef1f1\" d=\"M33 12h1v1H33zM30 17h1v1H30zM41 25h1v1H41zM45 26h1v1H45zM25 30h1v1H25zM17 34h1v1H17zM17 48h1v1H17z\"/><path fill=\"#fbc8c8\" d=\"M34 12h1v1H34zM36 17h1v1H36zM39 25h1v1H39zM47 26h1v1H47zM47 27h1v1H47zM19 32h1v1H19zM47 32h1v1H47zM46 40h1v1H46zM34 47h1v1H34zM28 48h1v1H28z\"/><path fill=\"#f23838\" d=\"M35 12h1v1H35zM36 13h1v1H36zM29 18h1v1H29zM42 24h1v1H42zM46 24h1v1H46zM25 29h1v1H25zM24 30h1v1H24zM16 32h1v1H16zM46 42h1v1H46zM38 47h1v1H38z\"/><path fill=\"#f45959\" d=\"M30 13h1v1H30zM47 25h1v1H47zM15 33h1v1H15zM46 41h1v1H46zM37 47h1v1H37z\"/><path fill=\"#f89a9a\" d=\"M30 14h1v1H30zM36 19h1v1H36zM15 34h1v1H15zM15 35h1v1H15zM15 36h1v1H15zM15 37h1v1H15zM15 38h1v1H15zM15 39h1v1H15zM15 40h1v1H15zM15 41h1v1H15zM15 42h1v1H15zM15 43h1v1H15zM15 44h1v1H15zM15 45h1v1H15zM15 46h1v1H15zM15 47h1v1H15zM15 48h1v1H15zM29 48h1v1H29zM17 50h1v1H17z\"/><path fill=\"#f9acac\" d=\"M36 14h1v1H36zM29 20h1v1H29zM37 25h2v1H37zM47 31h1v1H47zM18 32h1v1H18zM23 33h1v1H23zM23 34h1v1H23zM23 35h1v1H23zM23 36h1v1H23zM23 37h1v1H23zM23 38h1v1H23zM23 39h1v1H23zM23 40h1v1H23zM23 41h1v1H23zM23 42h1v1H23zM23 43h1v1H23zM23 44h1v1H23zM23 45h1v1H23zM23 46h1v1H23zM41 46h1v1H41zM23 47h1v1H23zM35 47h1v1H35z\"/><path fill=\"#fab5b5\" d=\"M30 15h1v1H30zM36 18h1v1H36zM28 24h1v1H28zM23 32h1v1H23zM47 33h1v1H47zM23 48h1v1H23z\"/><path fill=\"#fcd5d5\" d=\"M36 15h1v1H36zM30 16h1v1H30zM36 16h1v1H36zM29 21h1v1H29zM40 46h1v1H40z\"/><path fill=\"#f56565\" d=\"M29 19h1v1H29zM36 22h1v1H36zM28 23h1v1H28zM44 24h1v1H44zM47 29h1v1H47zM47 30h1v1H47zM47 34h1v1H47zM45 45h1v1H45zM43 46h1v1H43zM23 49h1v1H23zM18 50h1v1H18z\"/><path fill=\"#f02525\" d=\"M28 22h1v1H28zM27 25h1v1H27zM47 35h1v1H47zM47 38h1v1H47zM44 46h1v1H44zM32 48h1v1H32zM26 49h1v1H26z\"/><path fill=\"#f34949\" d=\"M36 23h1v1H36zM43 24h1v1H43zM46 43h1v1H46zM31 48h1v1H31zM25 49h1v1H25zM19 50h1v1H19z\"/><path fill=\"#fde7e7\" d=\"M40 25h1v1H40zM27 27h1v1H27zM27 48h1v1H27z\"/><path fill=\"#fcd9d9\" d=\"M46 36h1v1H46z\"/><path fill=\"#feebeb\" d=\"M46 37h1v1H46zM39 46h1v1H39zM33 47h1v1H33z\"/></svg>";export const WEIMOB_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" width=\"100%\" height=\"100%\" shape-rendering=\"crispEdges\"><path fill=\"#ffffff\" d=\"M0 0h64v1H0zM0 1h64v1H0zM0 2h64v1H0zM0 3h64v1H0zM0 4h64v1H0zM0 5h64v1H0zM0 6h64v1H0zM0 7h64v1H0zM0 8h64v1H0zM0 9h64v1H0zM0 10h64v1H0zM0 11h64v1H0zM0 12h64v1H0zM0 13h64v1H0zM0 14h64v1H0zM0 15h64v1H0zM0 16h64v1H0zM0 17h20v1H0zM26 17h12v1H26zM44 17h20v1H44zM0 18h17v1H0zM29 18h6v1H29zM47 18h17v1H47zM0 19h15v1H0zM30 19h3v1H30zM49 19h15v1H49zM0 20h14v1H0zM30 20h2v1H30zM50 20h14v1H50zM0 21h13v1H0zM29 21h2v1H29zM51 21h13v1H51zM0 22h12v1H0zM21 22h9v1H21zM39 22h4v1H39zM52 22h12v1H52zM0 23h11v1H0zM18 23h11v1H18zM36 23h10v1H36zM53 23h11v1H53zM0 24h11v1H0zM17 24h11v1H17zM35 24h12v1H35zM54 24h10v1H54zM0 25h10v1H0zM16 25h11v1H16zM34 25h14v1H34zM54 25h10v1H54zM0 26h10v1H0zM15 26h11v1H15zM33 26h16v1H33zM55 26h9v1H55zM0 27h9v1H0zM15 27h10v1H15zM32 27h2v1H32zM38 27h12v1H38zM55 27h9v1H55zM0 28h9v1H0zM14 28h10v1H14zM30 28h2v1H30zM39 28h11v1H39zM55 28h9v1H55zM0 29h9v1H0zM14 29h9v1H14zM30 29h1v1H30zM38 29h3v1H38zM45 29h5v1H45zM56 29h8v1H56zM0 30h9v1H0zM14 30h8v1H14zM28 30h2v1H28zM37 30h2v1H37zM45 30h6v1H45zM56 30h8v1H56zM0 31h9v1H0zM14 31h7v1H14zM28 31h1v1H28zM36 31h2v1H36zM45 31h6v1H45zM56 31h8v1H56zM0 32h9v1H0zM14 32h5v1H14zM27 32h1v1H27zM35 32h2v1H35zM44 32h7v1H44zM56 32h8v1H56zM0 33h9v1H0zM14 33h5v1H14zM25 33h2v1H25zM34 33h2v1H34zM43 33h8v1H43zM56 33h8v1H56zM0 34h9v1H0zM14 34h6v1H14zM23 34h3v1H23zM33 34h2v1H33zM42 34h8v1H42zM56 34h8v1H56zM0 35h9v1H0zM14 35h12v1H14zM32 35h2v1H32zM41 35h9v1H41zM55 35h9v1H55zM0 36h9v1H0zM15 36h11v1H15zM30 36h3v1H30zM40 36h10v1H40zM55 36h9v1H55zM0 37h10v1H0zM15 37h17v1H15zM39 37h10v1H39zM55 37h9v1H55zM0 38h10v1H0zM16 38h15v1H16zM38 38h10v1H38zM54 38h10v1H54zM0 39h11v1H0zM17 39h13v1H17zM37 39h10v1H37zM54 39h10v1H54zM0 40h11v1H0zM18 40h10v1H18zM36 40h10v1H36zM53 40h11v1H53zM0 41h12v1H0zM21 41h5v1H21zM35 41h8v1H35zM52 41h12v1H52zM0 42h13v1H0zM34 42h1v1H34zM51 42h13v1H51zM0 43h14v1H0zM33 43h1v1H33zM50 43h14v1H50zM0 44h15v1H0zM31 44h3v1H31zM49 44h15v1H49zM0 45h17v1H0zM29 45h6v1H29zM47 45h17v1H47zM0 46h20v1H0zM26 46h12v1H26zM44 46h20v1H44zM0 47h64v1H0zM0 48h64v1H0zM0 49h64v1H0zM0 50h64v1H0zM0 51h64v1H0zM0 52h64v1H0zM0 53h64v1H0zM0 54h64v1H0zM0 55h64v1H0zM0 56h64v1H0zM0 57h64v1H0zM0 58h64v1H0zM0 59h64v1H0zM0 60h64v1H0zM0 61h64v1H0zM0 62h64v1H0zM0 63h64v1H0z\"/><path fill=\"#f3f8ff\" d=\"M20 17h1v1H20zM17 18h1v1H17zM15 19h1v1H15zM38 22h1v1H38zM43 22h1v1H43zM34 24h1v1H34zM33 25h1v1H33zM32 26h1v1H32zM31 27h1v1H31zM29 29h1v1H29zM44 29h1v1H44zM50 29h1v1H50zM55 29h1v1H55zM13 31h1v1H13zM27 31h1v1H27zM13 32h1v1H13zM19 32h1v1H19zM26 32h1v1H26zM50 34h1v1H50zM55 34h1v1H55zM43 41h1v1H43zM15 44h1v1H15zM17 45h1v1H17zM20 46h1v1H20z\"/><path fill=\"#e9f2ff\" d=\"M21 17h1v1H21zM46 18h1v1H46zM43 29h1v1H43zM55 30h1v1H55zM43 32h1v1H43zM42 33h1v1H42zM55 33h1v1H55zM41 34h1v1H41zM40 35h1v1H40zM29 36h1v1H29zM39 36h1v1H39zM38 37h1v1H38zM37 38h1v1H37zM36 39h1v1H36zM35 40h1v1H35zM26 41h1v1H26zM34 41h1v1H34zM46 45h1v1H46zM21 46h1v1H21z\"/><path fill=\"#d8e8ff\" d=\"M22 17h3v1H22zM40 17h2v1H40zM14 20h1v1H14zM28 21h1v1H28zM37 22h1v1H37zM35 23h1v1H35zM35 27h2v1H35zM42 29h1v1H42zM55 32h1v1H55zM21 34h1v1H21zM27 36h1v1H27zM14 43h1v1H14zM22 46h3v1H22zM40 46h2v1H40z\"/><path fill=\"#f1f7ff\" d=\"M25 17h1v1H25zM38 17h1v1H38zM43 17h1v1H43zM48 19h1v1H48zM20 22h1v1H20zM11 23h1v1H11zM47 24h1v1H47zM53 24h1v1H53zM48 25h1v1H48zM54 26h1v1H54zM14 27h1v1H14zM34 27h1v1H34zM37 27h1v1H37zM32 28h1v1H32zM38 28h1v1H38zM41 29h1v1H41zM13 30h1v1H13zM13 33h1v1H13zM20 34h1v1H20zM14 36h1v1H14zM26 36h1v1H26zM54 37h1v1H54zM48 38h1v1H48zM47 39h1v1H47zM53 39h1v1H53zM11 40h1v1H11zM28 40h1v1H28zM20 41h1v1H20zM33 42h1v1H33zM35 42h1v1H35zM32 43h1v1H32zM48 44h1v1H48zM25 46h1v1H25zM38 46h1v1H38zM43 46h1v1H43z\"/><path fill=\"#e3eeff\" d=\"M39 17h1v1H39zM42 17h1v1H42zM35 18h1v1H35zM33 19h1v1H33zM9 27h1v1H9zM31 29h1v1H31zM30 30h1v1H30zM29 31h1v1H29zM44 31h1v1H44zM55 31h1v1H55zM28 32h1v1H28zM27 33h1v1H27zM22 34h1v1H22zM26 34h1v1H26zM9 36h1v1H9zM34 43h1v1H34zM35 45h1v1H35zM39 46h1v1H39zM42 46h1v1H42z\"/><path fill=\"#c1dbff\" d=\"M18 18h1v1H18zM19 22h1v1H19zM52 23h1v1H52zM52 40h1v1H52zM19 41h1v1H19zM18 45h1v1H18z\"/><path fill=\"#89b9ff\" d=\"M19 18h1v1H19zM29 19h1v1H29zM34 19h1v1H34zM22 21h1v1H22zM24 21h1v1H24zM27 21h1v1H27zM40 21h2v1H40zM30 22h1v1H30zM45 22h1v1H45zM29 23h1v1H29zM11 24h1v1H11zM28 24h1v1H28zM33 24h1v1H33zM27 25h1v1H27zM32 25h1v1H32zM26 26h1v1H26zM31 26h1v1H31zM25 27h1v1H25zM30 27h1v1H30zM50 27h1v1H50zM24 28h1v1H24zM29 28h1v1H29zM9 29h1v1H9zM23 29h1v1H23zM28 29h1v1H28zM22 30h1v1H22zM27 30h1v1H27zM21 31h1v1H21zM26 31h1v1H26zM51 31h1v1H51zM20 32h1v1H20zM25 32h1v1H25zM51 32h1v1H51zM9 34h1v1H9zM50 36h1v1H50zM11 39h1v1H11zM45 41h1v1H45zM22 42h1v1H22zM24 42h1v1H24zM40 42h2v1H40zM31 43h1v1H31zM47 44h1v1H47zM19 45h1v1H19z\"/><path fill=\"#579cff\" d=\"M20 18h1v1H20zM17 19h1v1H17zM38 21h1v1H38zM43 21h1v1H43zM31 30h1v1H31zM30 31h1v1H30zM43 31h1v1H43zM29 32h1v1H29zM42 32h1v1H42zM28 33h1v1H28zM41 33h1v1H41zM27 34h1v1H27zM40 34h1v1H40zM39 35h1v1H39zM38 36h1v1H38zM37 37h1v1H37zM36 38h1v1H36zM49 38h1v1H49zM35 39h1v1H35zM34 40h1v1H34zM28 41h1v1H28zM33 41h1v1H33zM43 42h1v1H43zM35 43h1v1H35zM17 44h1v1H17zM20 45h1v1H20z\"/><path fill=\"#3789ff\" d=\"M21 18h1v1H21zM25 18h1v1H25zM35 19h1v1H35zM46 19h1v1H46zM28 20h1v1H28zM33 20h1v1H33zM13 22h1v1H13zM35 22h1v1H35zM46 22h1v1H46zM16 23h1v1H16zM14 25h1v1H14zM53 26h1v1H53zM10 27h1v1H10zM12 30h1v1H12zM41 30h1v1H41zM43 30h1v1H43zM54 30h1v1H54zM39 31h1v1H39zM12 33h1v1H12zM22 33h1v1H22zM54 33h1v1H54zM31 34h1v1H31zM29 35h1v1H29zM10 36h1v1H10zM53 37h1v1H53zM14 38h1v1H14zM16 40h1v1H16zM13 41h1v1H13zM46 41h1v1H46zM26 42h1v1H26zM35 44h1v1H35zM46 44h1v1H46zM21 45h1v1H21zM25 45h1v1H25z\"/><path fill=\"#2b82ff\" d=\"M22 18h1v1H22zM24 18h1v1H24zM39 18h1v1H39zM42 18h1v1H42zM37 21h1v1H37zM44 21h1v1H44zM50 26h1v1H50zM35 28h1v1H35zM36 29h1v1H36zM35 30h1v1H35zM42 30h1v1H42zM34 31h1v1H34zM54 31h1v1H54zM33 32h1v1H33zM38 32h1v1H38zM54 32h1v1H54zM21 33h1v1H21zM32 33h1v1H32zM37 33h1v1H37zM36 34h1v1H36zM27 35h1v1H27zM35 35h1v1H35zM34 36h1v1H34zM33 37h1v1H33zM50 37h1v1H50zM32 38h1v1H32zM31 39h1v1H31zM44 42h1v1H44zM22 45h1v1H22zM24 45h1v1H24zM39 45h1v1H39zM42 45h1v1H42z\"/><path fill=\"#247eff\" d=\"M23 18h1v1H23zM40 18h2v1H40zM28 19h1v1H28zM49 21h1v1H49zM51 23h1v1H51zM11 25h1v1H11zM36 28h1v1H36zM51 28h1v1H51zM12 29h1v1H12zM12 34h1v1H12zM28 35h1v1H28zM51 35h1v1H51zM11 38h1v1H11zM30 40h1v1H30zM51 40h1v1H51zM49 42h1v1H49zM30 43h1v1H30zM28 44h1v1H28zM23 45h1v1H23zM40 45h2v1H40z\"/><path fill=\"#5ea0ff\" d=\"M26 18h1v1H26zM47 23h1v1H47zM49 25h1v1H49zM37 28h1v1H37zM32 29h1v1H32zM9 31h1v1H9zM9 32h1v1H9zM23 33h1v1H23zM47 40h1v1H47zM26 45h1v1H26z\"/><path fill=\"#91beff\" d=\"M27 18h1v1H27zM47 19h1v1H47zM23 21h1v1H23zM36 22h1v1H36zM26 35h1v1H26zM23 42h1v1H23zM27 45h1v1H27z\"/><path fill=\"#cde2ff\" d=\"M28 18h1v1H28zM13 21h1v1H13zM12 22h1v1H12zM44 22h1v1H44zM46 23h1v1H46zM16 24h1v1H16zM10 25h1v1H10zM15 25h1v1H15zM49 26h1v1H49zM50 28h1v1H50zM13 29h1v1H13zM39 30h1v1H39zM19 33h1v1H19zM13 34h1v1H13zM31 35h1v1H31zM50 35h1v1H50zM28 36h1v1H28zM49 37h1v1H49zM10 38h1v1H10zM15 38h1v1H15zM16 39h1v1H16zM46 40h1v1H46zM12 41h1v1H12zM44 41h1v1H44zM13 42h1v1H13zM30 44h1v1H30zM28 45h1v1H28z\"/><path fill=\"#a5caff\" d=\"M36 18h1v1H36zM50 21h1v1H50zM51 22h1v1H51zM14 26h1v1H14zM44 30h1v1H44zM14 37h1v1H14zM51 41h1v1H51zM36 42h1v1H36zM50 42h1v1H50zM36 45h1v1H36z\"/><path fill=\"#6aa7ff\" d=\"M37 18h1v1H37zM15 20h1v1H15zM21 21h1v1H21zM25 21h2v1H25zM18 22h1v1H18zM34 23h1v1H34zM9 30h1v1H9zM9 33h1v1H9zM18 41h1v1H18zM25 42h1v1H25zM32 42h1v1H32zM37 42h2v1H37zM15 43h1v1H15zM29 44h1v1H29zM37 45h1v1H37z\"/><path fill=\"#4793ff\" d=\"M38 18h1v1H38zM43 18h1v1H43zM48 20h1v1H48zM14 21h1v1H14zM20 21h1v1H20zM12 23h1v1H12zM15 24h1v1H15zM52 24h1v1H52zM13 27h1v1H13zM34 28h1v1H34zM51 29h1v1H51zM54 29h1v1H54zM12 31h1v1H12zM12 32h1v1H12zM20 33h1v1H20zM51 34h1v1H51zM54 34h1v1H54zM13 36h1v1H13zM15 39h1v1H15zM52 39h1v1H52zM12 40h1v1H12zM14 42h1v1H14zM20 42h1v1H20zM48 43h1v1H48zM38 45h1v1H38zM43 45h1v1H43z\"/><path fill=\"#74adff\" d=\"M44 18h1v1H44zM48 24h1v1H48zM10 26h1v1H10zM40 30h1v1H40zM51 30h1v1H51zM51 33h1v1H51zM30 35h1v1H30zM10 37h1v1H10zM48 39h1v1H48zM21 42h1v1H21zM44 45h1v1H44z\"/><path fill=\"#afd0ff\" d=\"M45 18h1v1H45zM16 19h1v1H16zM32 20h1v1H32zM17 23h1v1H17zM54 27h1v1H54zM24 33h1v1H24zM36 33h1v1H36zM35 34h1v1H35zM33 36h1v1H33zM54 36h1v1H54zM32 37h1v1H32zM31 38h1v1H31zM30 39h1v1H30zM17 40h1v1H17zM27 41h1v1H27zM16 44h1v1H16zM45 45h1v1H45z\"/><path fill=\"#1676ff\" d=\"M18 19h1v1H18zM36 19h1v1H36zM45 19h1v1H45zM16 20h1v1H16zM47 20h1v1H47zM19 21h1v1H19zM32 21h1v1H32zM36 21h1v1H36zM45 21h1v1H45zM17 22h1v1H17zM31 22h1v1H31zM50 22h1v1H50zM30 23h1v1H30zM33 23h1v1H33zM48 23h1v1H48zM29 24h1v1H29zM32 24h1v1H32zM49 24h1v1H49zM28 25h1v1H28zM31 25h1v1H31zM52 25h1v1H52zM13 26h1v1H13zM27 26h1v1H27zM30 26h1v1H30zM26 27h1v1H26zM29 27h1v1H29zM53 27h1v1H53zM10 28h1v1H10zM25 28h1v1H25zM28 28h1v1H28zM24 29h1v1H24zM27 29h1v1H27zM33 29h1v1H33zM23 30h1v1H23zM26 30h1v1H26zM22 31h1v1H22zM25 31h1v1H25zM21 32h1v1H21zM24 32h1v1H24zM10 35h1v1H10zM53 36h1v1H53zM13 37h1v1H13zM52 38h1v1H52zM49 39h1v1H49zM48 40h1v1H48zM17 41h1v1H17zM29 41h1v1H29zM50 41h1v1H50zM19 42h1v1H19zM27 42h1v1H27zM31 42h1v1H31zM16 43h1v1H16zM36 43h1v1H36zM47 43h1v1H47zM18 44h1v1H18zM36 44h1v1H36zM45 44h1v1H45z\"/><path fill=\"#0d71ff\" d=\"M19 19h9v1H19zM37 19h8v1H37zM17 20h11v1H17zM34 20h13v1H34zM15 21h4v1H15zM33 21h3v1H33zM46 21h3v1H46zM14 22h3v1H14zM32 22h3v1H32zM47 22h3v1H47zM13 23h3v1H13zM31 23h2v1H31zM49 23h2v1H49zM12 24h3v1H12zM30 24h2v1H30zM50 24h2v1H50zM12 25h2v1H12zM29 25h2v1H29zM50 25h2v1H50zM11 26h2v1H11zM28 26h2v1H28zM51 26h2v1H51zM11 27h2v1H11zM27 27h2v1H27zM51 27h2v1H51zM11 28h2v1H11zM26 28h2v1H26zM52 28h2v1H52zM10 29h2v1H10zM25 29h2v1H25zM34 29h2v1H34zM52 29h2v1H52zM10 30h2v1H10zM24 30h2v1H24zM32 30h3v1H32zM52 30h2v1H52zM10 31h2v1H10zM23 31h2v1H23zM31 31h3v1H31zM40 31h3v1H40zM52 31h2v1H52zM10 32h2v1H10zM22 32h2v1H22zM30 32h3v1H30zM39 32h3v1H39zM52 32h2v1H52zM10 33h2v1H10zM29 33h3v1H29zM38 33h3v1H38zM52 33h2v1H52zM10 34h2v1H10zM28 34h3v1H28zM37 34h3v1H37zM52 34h2v1H52zM11 35h2v1H11zM36 35h3v1H36zM52 35h2v1H52zM11 36h2v1H11zM35 36h3v1H35zM51 36h2v1H51zM11 37h2v1H11zM34 37h3v1H34zM51 37h2v1H51zM12 38h2v1H12zM33 38h3v1H33zM50 38h2v1H50zM12 39h3v1H12zM32 39h3v1H32zM50 39h2v1H50zM13 40h3v1H13zM31 40h3v1H31zM49 40h2v1H49zM14 41h3v1H14zM30 41h3v1H30zM47 41h3v1H47zM15 42h4v1H15zM28 42h3v1H28zM45 42h4v1H45zM17 43h13v1H17zM37 43h10v1H37zM19 44h9v1H19zM37 44h8v1H37z\"/><path fill=\"#b8d5ff\" d=\"M29 20h1v1H29zM49 20h1v1H49zM9 28h1v1H9zM37 29h1v1H37zM36 30h1v1H36zM35 31h1v1H35zM38 31h1v1H38zM34 32h1v1H34zM37 32h1v1H37zM33 33h1v1H33zM32 34h1v1H32zM9 35h1v1H9zM34 35h1v1H34zM49 43h1v1H49zM34 44h1v1H34z\"/><path fill=\"#95c1ff\" d=\"M31 21h1v1H31zM53 25h1v1H53zM13 28h1v1H13zM33 28h1v1H33zM13 35h1v1H13zM53 38h1v1H53zM29 40h1v1H29z\"/><path fill=\"#7ab1ff\" d=\"M39 21h1v1H39zM42 21h1v1H42zM54 28h1v1H54zM54 35h1v1H54zM39 42h1v1H39zM42 42h1v1H42z\"/></svg>";diff --git a/src/main/features/connectors/catalog-direct-commerce.ts b/src/main/features/connectors/catalog-direct-commerce.tsindex d1b2e913..e57545a2 100644--- a/src/main/features/connectors/catalog-direct-commerce.ts+++ b/src/main/features/connectors/catalog-direct-commerce.ts@@ -594,8 +594,8 @@ const ALL_DIRECT_COMMERCE_ENTRIES: CatalogEntry[] = [id: 'jd-seller', setup_guide_id: 'jd-seller', display_name: 'JD.com Seller',display_name_zh: '京东卖家', display_name_en: 'JD.com Seller', category: 'commerce',icon_svg: JD_ICON_SVG,- icon_source_url: 'https://img10.360buyimg.com/img/jfs/t1/265960/38/828/10287/676565f6Fcdb37884/072d830437959819.png',- icon_source_sha256: 'bc15fdaa63c69d74296061d3034423cd1fcc83a5bcc93295226ddd27ceb8e8a6',+ icon_source_url: 'https://www.jd.com/favicon.ico',+ icon_source_sha256: '99adfd5e001df9645a32518bafaedfff7746575bf239e1fe9a236ea9f94ed0d4',description_zh: '使用商家自己的京东商家开放平台应用,经官方 OAuth 管理店铺身份、商品/SKU、库存、价格、上下架、订单、发货与售后退款;实际能力以应用类型和审核通过的 API 权限为准。',description_en: 'Use the merchant\'s own JD Merchant Open Platform app and official OAuth for shop identity, products and SKUs, inventory, pricing, publication state, orders, fulfillment, and after-sales refunds. Availability depends on the app category and approved API permissions.',description_ja: "加盟店自身の JD Merchant Open Platform アプリと公式 OAuth で店舗情報、商品・SKU、在庫、価格、公開状態、注文、配送、アフターサービスの返金を扱います。利用範囲はアプリ種別と承認済み API 権限によります。",diff --git a/src/main/features/connectors/local-cli.ts b/src/main/features/connectors/local-cli.tsindex 385e5387..e1f3ca28 100644--- a/src/main/features/connectors/local-cli.ts+++ b/src/main/features/connectors/local-cli.ts@@ -18,6 +18,7 @@ import { bundledNpxCli } from '../../util/bundled-runtime';import { buildChildProxyEnvironment } from '../../util/proxy-dispatcher';import { safeLocalCliAuthUrl } from '../../util/window-security';import { getLanguageForUser } from '../config';+import { registerUserSwitchHook } from '../user-switch-hooks';import { buildSandboxEnv, killProcessTree } from '../../../core-agent/src/sandbox/executor';import {startInteractiveCliSession,@@ -59,6 +60,7 @@ interface LocalCliInstallRunOptions {cwd: string;env: Record<string, string>;timeoutMs: number;+ signal?: AbortSignal;}type LocalCliInstallRunner = (options: LocalCliInstallRunOptions) => Promise<LocalCliInstallRunResult>;@@ -107,6 +109,69 @@ export function localCliProfileName(uid: string, catalogId: string): string {return `orkas-${digest}`;}+/** Read-only recovery state; the renderer receives no scope list or profile data. */+export function localCliReauthorizationRequired(uid: string, catalogId: string): boolean {+ return localCliMissingPermissions(uid, catalogId) !== null;+}++/** Only missing scope identifiers may cross IPC; never return granted scopes or identities. */+export function localCliMissingPermissions(uid: string, catalogId: string): string[] | null {+ if (!uid || !['feishu', 'lark', 'dingtalk', 'wecom', 'xero'].includes(catalogId)) return null;+ const contract = require(path.join(pcDirForChild(), 'bin/local-cli-permissions.cjs')) as {+ readPermissionRequest: (env: Record<string, string>) => { scopes: string[]; pat_scopes?: string[] } | null;+ };+ const pending = contract.readPermissionRequest({+ ORKAS_LOCAL_CLI_RUNTIME_DIR: localCliRuntimeDir(uid, catalogId),+ ORKAS_LOCAL_CLI_PROFILE: localCliProfileName(uid, catalogId),+ });+ return pending ? [...new Set([...pending.scopes, ...(pending.pat_scopes || [])])].sort() : null;+}++const permissionChecks = new Map<string, { checkedAt: number; running?: Promise<void>; abort: AbortController }>();+const PERMISSION_CHECK_TTL_MS = 60_000;+registerUserSwitchHook('connector-permission-checks', () => {+ for (const state of permissionChecks.values()) state.abort.abort();+ permissionChecks.clear();+});++/** Called by the Connectors page and the completed authorization flow, never on a timer.+ * Missing access is advisory and never rewrites the connector's usable status. */+export async function checkLocalCliPermissions(+ uid: string, entry: CatalogEntry, force = false, runner: LocalCliInstallRunner = runLocalCliProcess,+): Promise<void> {+ if (!uid || entry.local_cli?.provider !== 'lark' || !localCliInstallStatus(uid, entry).installed) return;+ const key = JSON.stringify([uid, entry.id]);+ const prior = permissionChecks.get(key);+ if (prior?.running) {+ await prior.running;+ // A refresh after consent must observe the new grant, not reuse a check+ // which started before the user granted it.+ if (!force || prior.abort.signal.aborted) return;+ }+ if (!force && prior && Date.now() - prior.checkedAt < PERMISSION_CHECK_TTL_MS) return;+ const state: { checkedAt: number; running?: Promise<void>; abort: AbortController } = {+ checkedAt: Date.now(), abort: new AbortController(),+ };+ const run = (async () => {+ try {+ const proxyEnv = await buildChildProxyEnvironment();+ // The user may disconnect while proxy setup is pending. Do not recreate its runtime.+ if (state.abort.signal.aborted || !localCliInstallStatus(uid, entry).installed) return;+ await runner({+ command: resolveBackgroundNodeRuntime().executable,+ args: [path.join(pcDirForChild(), 'bin/local-cli-auth.cjs')],+ cwd: localCliRuntimeDir(uid, entry.id),+ env: buildSandboxEnv({ ...localCliEnv(uid, entry), ...proxyEnv, ORKAS_LOCAL_CLI_CHECK_PERMISSIONS_ONLY: '1' }),+ timeoutMs: 60_000,+ signal: state.abort.signal,+ });+ } catch { /* Keep the last known permission state when verification is unavailable. */ }+ })();+ state.running = run;+ permissionChecks.set(key, state);+ try { await run; } finally { state.running = undefined; state.checkedAt = Date.now(); }+}+function localCliEnv(uid: string, entry: CatalogEntry): Record<string, string> {const config = requireLocalCli(entry);const runtime = resolveBackgroundNodeRuntime();@@ -219,6 +284,7 @@ export function localCliInstallStatus(uid: string, entry: CatalogEntry): LocalClfunction runLocalCliProcess(options: LocalCliInstallRunOptions): Promise<LocalCliInstallRunResult> {return new Promise((resolve) => {+ if (options.signal?.aborted) { resolve({ exitCode: null, stderr: '' }); return; }let stderr = '';let settled = false;let timedOut = false;@@ -234,6 +300,7 @@ function runLocalCliProcess(options: LocalCliInstallRunOptions): Promise<LocalClif (settled) return;settled = true;clearTimeout(timer);+ options.signal?.removeEventListener('abort', abort);resolve({ exitCode, stderr, timedOut });};child.stderr?.on('data', (chunk) => {@@ -244,13 +311,15 @@ function runLocalCliProcess(options: LocalCliInstallRunOptions): Promise<LocalClfinish(null);});child.once('close', (code) => finish(code));- timer = setTimeout(() => {- timedOut = true;+ const abort = () => {+ clearTimeout(timer);try { killProcessTree(child, 'SIGKILL'); } catch { /* child already exited */ }// Prefer close so Windows releases package/config file handles before cleanup.timer = setTimeout(() => finish(null), 3000);timer.unref?.();- }, options.timeoutMs);+ };+ options.signal?.addEventListener('abort', abort, { once: true });+ timer = setTimeout(() => { timedOut = true; abort(); }, options.timeoutMs);timer.unref?.();});}@@ -383,6 +452,8 @@ export async function authorizeLocalCli(uid: string, entry: CatalogEntry): Promi/** Provider logout is best-effort because some official CLIs only expose local config removal.* The exact connector-owned directory is removed after logout; no parent/glob path is accepted. */export async function removeLocalCliAuthorization(uid: string, entry: CatalogEntry): Promise<void> {+ permissionChecks.get(JSON.stringify([uid, entry.id]))?.abort.abort();+ permissionChecks.delete(JSON.stringify([uid, entry.id]));const config = requireLocalCli(entry);const runtimeDir = localCliRuntimeDir(uid, entry.id);const npxCli = bundledNpxCli();diff --git a/src/main/features/connectors/manager.ts b/src/main/features/connectors/manager.tsindex 6c1d039e..8a14ac3c 100644--- a/src/main/features/connectors/manager.ts+++ b/src/main/features/connectors/manager.ts@@ -40,6 +40,7 @@ import { sanitizeAuthorizationDetail } from './local-cli-auth-error';import { deriveCustomId, validateCustomTransport, validateDisplayName, type CustomConnectorInput } from './custom-transport';import {authorizeLocalCli,+ checkLocalCliPermissions,localCliTransport,removeLocalCliAuthorization,} from './local-cli';@@ -144,6 +145,11 @@ const VERIFY_TTL_MS = 5 * 60 * 1000;const RETRY_BACKOFF_BASE_MS = 30 * 1000;const RETRY_BACKOFF_MAX_MS = 30 * 60 * 1000;const COMPOSIO_CALL_TOOL_TIMEOUT_MS = 110 * 1000;+// Allow schema inspection and local staging around the CLI's ten-minute transfer deadline.+// The adapter enforces 60s ordinary / 10min transfer deadlines. Progress keeps+// only an active transfer alive across this transport inactivity window.+const LOCAL_CLI_IDLE_TIMEOUT_MS = 90 * 1000;+const LOCAL_CLI_TOTAL_TIMEOUT_MS = 13 * 60 * 1000;type StatusPatchCollector = Map<string, registry.ConnectorInstancePatch[]>;@@ -1430,6 +1436,8 @@ export async function connectViaOAuth(if (entry.auth_mode === 'local_cli') {await authorizeLocalCli(uid, entry);_assertRuntimeEpoch(runtimeEpoch);+ await checkLocalCliPermissions(uid, entry, true);+ _assertRuntimeEpoch(runtimeEpoch);// Official CLIs complete authorization without the desktop OAuth deep-link callback.// Keep the card busy while the authorized runtime connects and discovers its tools.if (opts.attemptId) {@@ -1689,15 +1697,16 @@ async function _provisionLocalCliInstance(_assertRuntimeEpoch(runtimeEpoch);await _closeDiscoveredConnection(uid, entry.id, runtimeEpoch);_assertRuntimeEpoch(runtimeEpoch);+ const prior = getInstance(uid, entry.id);const draft: ConnectorInstance = {id: entry.id,display_name: entry.display_name,transport: localCliTransport(uid, entry),- enabled_subtools: null,+ enabled_subtools: prior?.enabled_subtools ?? null,tools_cache: [],tools_cached_at: 0,status: { kind: 'connecting' },- created_at: _nowIso(),+ created_at: prior?.created_at ?? _nowIso(),updated_at: _nowIso(),};await registry.upsert(uid, draft);@@ -1939,6 +1948,9 @@ export async function callTool(const requestOpts = {...(opts.signal ? { signal: opts.signal } : {}),...(inst.composio_grant ? { timeoutMs: COMPOSIO_CALL_TOOL_TIMEOUT_MS } : {}),+ ...(entry?.auth_mode === 'local_cli'+ && ['execute_read', 'execute_write', 'execute_high_impact', 'execute_destructive'].includes(name)+ ? { timeoutMs: LOCAL_CLI_IDLE_TIMEOUT_MS, maxTotalTimeoutMs: LOCAL_CLI_TOTAL_TIMEOUT_MS } : {}),};const result = Object.keys(requestOpts).length? await conn.callTool(name, args, requestOpts)diff --git a/src/main/features/connectors/mcp-client.ts b/src/main/features/connectors/mcp-client.tsindex 2314999a..a656b41c 100644--- a/src/main/features/connectors/mcp-client.ts+++ b/src/main/features/connectors/mcp-client.ts@@ -130,6 +130,7 @@ function resolveMcpConnectTimeoutMs(kind: Transport['kind']): number {export interface McpRequestOptions {signal?: AbortSignal;timeoutMs?: number;+ maxTotalTimeoutMs?: number;}export class McpConnection {@@ -236,6 +237,11 @@ export class McpConnection {undefined,{timeout: opts.timeoutMs || DEFAULT_CALL_TOOL_TIMEOUT_MS,+ ...(opts.maxTotalTimeoutMs ? {+ maxTotalTimeout: opts.maxTotalTimeoutMs,+ resetTimeoutOnProgress: true,+ onprogress: () => {},+ } : {}),...(opts.signal ? { signal: opts.signal } : {}),},);diff --git a/src/main/features/connectors/registry.ts b/src/main/features/connectors/registry.tsindex 050bab8d..48482fac 100644--- a/src/main/features/connectors/registry.ts+++ b/src/main/features/connectors/registry.ts@@ -41,6 +41,7 @@ import { writeTextAtomicSync } from '../../storage';import { createLogger } from '../../logger';import { logErrorSummary } from '../../util/log-redact';import * as localSecrets from '../../util/local-secret-store';+import { cancelForConnector } from './action_confirm';import { connectorRecordsForScope, prepareDeviceLocalConnectorStorage } from './device-local';import type {ConnectorInstance,@@ -425,6 +426,7 @@ export async function upsert(uid: string, inst: ConnectorInstance): Promise<voidrt_after: _rt(inst.oauth_grant),had_existing: !!before,});+ cancelForConnector(uid, inst.id);cur.connections[inst.id] = inst;if (cur._deleted_at?.[inst.id]) {const deleted = { ...(cur._deleted_at || {}) };@@ -442,6 +444,7 @@ export async function remove(uid: string, id: string): Promise<boolean> {const cur = _readSync(uid);if (!cur.connections[id]) return false;log.info('registry.remove', { id, rt_before: _rt(cur.connections[id].oauth_grant) });+ cancelForConnector(uid, id);delete cur.connections[id];if (cur.oauth_hints?.[id]) {const hints = { ...(cur.oauth_hints || {}) };diff --git a/src/main/features/group_chat/bus.ts b/src/main/features/group_chat/bus.tsindex b21c3eb3..a5914952 100644--- a/src/main/features/group_chat/bus.ts+++ b/src/main/features/group_chat/bus.ts@@ -55,6 +55,7 @@ import {} from '../../storage';import * as path from 'node:path';import * as fs from 'node:fs';+import { inspectCodingDirectory } from '../local_agents/project-directory';import type {LocalActiveRunIngress,LocalActiveRunInput,@@ -146,6 +147,7 @@ import {type SkillSelectionRef,} from '../../model/core-agent/skill-registry';import { AGENT_DESCRIPTION_ROSTER_MAX_CHARS } from '../../util/skill-description-policy';+import * as connectorActionConfirm from '../connectors/action_confirm';import * as bashPermissions from '../../model/core-agent/bash-permissions';import { toolExecutionFactKind } from '../../model/core-agent/tool-catalog';import {@@ -1482,6 +1484,7 @@ function _emitTaskRunTerminal(state: CidState, status: TaskTerminalStatus): void// Abort also calls this directly so cancellation remains fail-closed before// the worker finishes unwinding.bashPermissions.cancelForCid(state.cid);+ connectorActionConfirm.cancelForCid(state.cid);const recovered = status === 'completed' && run.internalFailureObserved === true;const event: TaskTerminalEvent = {run_id: run.runId,@@ -5673,10 +5676,11 @@ async function runActorTurn(// still ask the user to switch through the standard directory form.// Non-coding CLIs always use the workspace. A frozen coding cwd that// disappears must never silently fall back to another workspace: that- // could make a later turn edit the wrong project while the required- // input gate still considers the stale path fulfilled. Clear it so the- // normal host form blocks the child until the user picks a real folder.+ // could make a later turn edit the wrong project. Retain the selection+ // and session binding, block this dispatch, and let restoration or an+ // explicit directory-form submission recover the same conversation.let cliWorkingDir = wsRoot;+ let projectDirectoryIssue: ReturnType<typeof inspectCodingDirectory> | undefined;if (agentsFeat.cliIsCodingAgent(cliAgent.runtime?.kind === 'cli' ? cliAgent.runtime.cli : '')) {const dirInfo = agentsFeat.getCliProjectDirInfoForAgent(uid, cliAgent, turnProjectId);cliWorkingDir = dirInfo.effective_path;@@ -5685,25 +5689,14 @@ async function runActorTurn(const stateFile = await st.readState(uid, cid);const projDir = stateFile.coding_project_dir;if (projDir) {- try {- if (fs.statSync(projDir).isDirectory()) {- cliWorkingDir = projDir;- } else {- throw new Error('coding project path is not a directory');- }- } catch {- await setCodingProjectDir(uid, cid, '', { explicit: false });- try {- const cliSessions = await import('../local_agents/sessions');- await cliSessions.clearForConversation(uid, cid);- } catch (err) {- log.warn('stale coding project directory session cleanup failed', {- cid: maskId(cid),- error: logErrorSummary(err),- });- }- log.info('coding project directory disappeared; awaiting user selection', {- cid: maskId(cid),+ projectDirectoryIssue = inspectCodingDirectory(projDir);+ if (projectDirectoryIssue.kind === 'available') {+ cliWorkingDir = projDir;+ } else {+ log.info('coding project directory check blocked dispatch', {+ cid: maskId(cid), source: 'device',+ directory: logPathRef(projDir),+ reason: projectDirectoryIssue.kind, code: projectDirectoryIssue.code,});}}@@ -5733,7 +5726,7 @@ async function runActorTurn(let persistedLiveCommentary = false;const cliOut = await _runCliAgentTurn({uid, cid, actor, agent: cliAgent,- item, canonicalRows, workingDir: cliWorkingDir,+ item, canonicalRows, workingDir: cliWorkingDir, projectDirectoryIssue,language: turnLanguage,...(turnConversationTitle ? { conversationTitle: turnConversationTitle } : {}),...(turnProjectId ? { projectId: turnProjectId } : {}),@@ -9514,20 +9507,14 @@ async function _initializeCodingProjectDir(uid: string, cid: string, info: agentsFeat.AgentCliProjectDirInfo,): Promise<void> {const cur = await readState(uid, cid);- if (cur.coding_project_dir) return;- if (info.mode === 'custom' && !info.exists) {- log.info('coding project directory unavailable; awaiting user selection', {- cid: maskId(cid),- });- return;- }- const target = info.effective_path;+ if (cur.coding_project_dir || cur.coding_project_dir_pending) return;+ const target = info.mode === 'custom' ? info.path : info.effective_path;if (!target) return;// Set-once under the state lock: two coding agents' first turns can race// this initialisation, and both must converge on ONE winner (the read above// is only a fast path). The caller re-reads state and uses the recorded dir.const { applied } = await setCodingProjectDirOnce(uid, cid, target, {- explicit: info.mode === 'custom' && info.exists,+ explicit: info.mode === 'custom',});if (applied) {log.info('coding project directory initialized', {@@ -9546,7 +9533,7 @@ async function _initializeCodingProjectDir(* re-asked on every dispatch (matches the "prompt every turn until* collected" behaviour the in-process branch already has). */async function _maybeBuildCliInputForm(- uid: string, cid: string, agent: import('../agents').Agent,+ uid: string, cid: string, agent: import('../agents').Agent, directoryMissing = false,): Promise<string | null> {const inputs = Array.isArray(agent.inputs) ? agent.inputs : [];if (!inputs.length) return null;@@ -9557,7 +9544,7 @@ async function _maybeBuildCliInputForm(const projectDir = state.coding_project_dir || '';const isFulfilled = (fieldId: string): boolean => {- if (fieldId === 'project_dir') return !!projectDir;+ if (fieldId === 'project_dir') return !!projectDir && !directoryMissing;return false;};@@ -9595,6 +9582,7 @@ async function _runCliAgentTurn(opts: {projectId?: string;conversationTitle?: string;workingDir: string;+ projectDirectoryIssue?: ReturnType<typeof inspectCodingDirectory>;language: Lang;signal: AbortSignal;deadlineAt?: number;@@ -9623,7 +9611,12 @@ async function _runCliAgentTurn(opts: {// through the standard pipeline. Only the `project_dir` input is// currently auto-injected, but the gate is generic so future required// inputs reuse the same path.- const formBlock = await _maybeBuildCliInputForm(opts.uid, opts.cid, opts.agent);+ const issue = opts.projectDirectoryIssue;+ if (issue?.kind === 'denied' || issue?.kind === 'unavailable') {+ const message = t(issue.kind === 'denied' ? 'errors.cli_directory_denied' : 'errors.cli_directory_unavailable');+ return { text: message, error: message, failureKind: 'dependency', failureCode: 'project_directory_unavailable' };+ }+ const formBlock = await _maybeBuildCliInputForm(opts.uid, opts.cid, opts.agent, issue?.kind === 'missing');if (formBlock) return { text: formBlock };// Look up any prior CLI session bound to this (cid, aid, cli). Ifdiff --git a/src/main/features/group_chat/index.ts b/src/main/features/group_chat/index.tsindex 62026d5a..420d6a42 100644--- a/src/main/features/group_chat/index.ts+++ b/src/main/features/group_chat/index.ts@@ -8,6 +8,7 @@* - Abort group + drop on conv delete*/+import { inspectCodingDirectory } from '../local_agents/project-directory';import * as fs from 'node:fs';import * as fsp from 'node:fs/promises';import * as path from 'node:path';@@ -957,6 +958,7 @@ type CodingProjectDirFormUpdate = {projectDir: string;oldDir: string;oldExplicit: boolean;+ oldPending?: string;};async function _prepareCodingProjectDirFormUpdate(@@ -994,11 +996,11 @@ async function _prepareCodingProjectDirFormUpdate(return { ok: false, error: t('errors.dir_not_exists') };}const projectDir = path.resolve(raw.trim());- try {- const stat = await fsp.stat(projectDir);- if (!stat.isDirectory()) return { ok: false, error: t('errors.path_not_dir') };- } catch {- return { ok: false, error: t('errors.dir_not_exists') };+ const inspection = inspectCodingDirectory(projectDir);+ if (inspection.kind !== 'available') {+ return { ok: false, error: t(inspection.kind === 'denied' ? 'errors.cli_directory_denied'+ : inspection.kind === 'unavailable' ? 'errors.cli_directory_unavailable'+ : inspection.code === 'ENOTDIR' ? 'errors.path_not_dir' : 'errors.dir_not_exists') };}try {@@ -1009,6 +1011,7 @@ async function _prepareCodingProjectDirFormUpdate(projectDir,oldDir: previous.coding_project_dir || '',oldExplicit: previous.coding_project_dir_explicit === true,+ oldPending: previous.coding_project_dir_pending,},};} catch (err) {@@ -1081,7 +1084,9 @@ async function _restoreProjectDirAfterFailedFormCommit(): Promise<void> {if (!update) return;try {- await setCodingProjectDir(userId, cid, update.oldDir, { explicit: update.oldExplicit });+ await setCodingProjectDir(userId, cid, update.oldDir || update.oldPending || '', {+ explicit: update.oldExplicit, needsConfirmation: !!update.oldPending,+ });} catch (err) {log.error('form-submit project directory rollback failed', { error: logErrorSummary(err) });}diff --git a/src/main/features/group_chat/state.ts b/src/main/features/group_chat/state.tsindex bd7e4a92..80a4fde1 100644--- a/src/main/features/group_chat/state.ts+++ b/src/main/features/group_chat/state.ts@@ -32,6 +32,8 @@ import {import { createLogger } from '../../logger';import { logErrorSummary, maskId } from '../../util/log-redact';+import { readCodingDirectory, readCodingDirectoryFromStateFile, writeCodingDirectory, cloudConversationState } from '../local_agents/project-directory';+const log = createLogger('group_chat.state');// ── Types ────────────────────────────────────────────────────────────────@@ -112,7 +114,7 @@ export interface StateFile {* the directory or update this field. See `conv_workspace.ts` for the* slug rules and the placeholder fallback. */workspace_dir?: string;- /** Project directory for coding-agent dispatches in+ /** Device-local projection (never written to cloud state). Project directory for coding-agent dispatches in* this conversation. Initialised on the first coding-agent turn from* that agent's detail-page project-dir setting; missing setting =* effective workspace path. Absolute path. Missing / empty → coding@@ -126,6 +128,8 @@ export interface StateFile {* picker (form-submit hook in `group_chat/index.ts`). Cleared* whenever `coding_project_dir` is cleared. */coding_project_dir_explicit?: boolean;+ /** Legacy selection without device provenance; never an execution root. */+ coding_project_dir_pending?: string;/** Conversation-scoped absolute roots for file tools. Used by narrow* system-created workflows such as sync-conflict resolution where the* target file lives outside the active workspace. */@@ -428,7 +432,14 @@ export async function renameAgentInMembers(// ── State IO ─────────────────────────────────────────────────────────────-export async function readState(+export async function readState(uid: string, cid: string, projectIdHint?: string | null): Promise<StateFile> {+ const cloud = await readCloudState(uid, cid, projectIdHint);+ return { ...cloudConversationState(cloud),+ ...readCodingDirectoryFromStateFile(uid, cid, conversationLayout(uid, cid, projectIdHint).stateFile),+ };+}++async function readCloudState(uid: string,cid: string,projectIdHint?: string | null,@@ -508,7 +519,7 @@ export async function readState(async function writeStateRaw(uid: string, cid: string, s: StateFile): Promise<void> {ensureGroupDir(uid, cid);- await writeJson(conversationLayout(uid, cid).stateFile, s);+ await writeJson(conversationLayout(uid, cid).stateFile, cloudConversationState(s));}// A compact local journal makes boot crash recovery proportional to the@@ -1066,21 +1077,16 @@ export async function setWorkspaceDirOnce(uid: string, cid: string, dir: string)* doesn't accidentally inherit a stale `true`. */export async function setCodingProjectDir(uid: string, cid: string, dir: string,- opts: { explicit: boolean },+ opts: { explicit: boolean; needsConfirmation?: boolean },): Promise<StateFile> {return _stateLock(uid, cid).runExclusive(async () => {const s = await readState(uid, cid);const trimmed = String(dir || '').trim();- if (trimmed) {- s.coding_project_dir = trimmed;- if (opts.explicit) s.coding_project_dir_explicit = true;- else delete s.coding_project_dir_explicit;- } else {- delete s.coding_project_dir;- delete s.coding_project_dir_explicit;- }- s.last_active_at = nowIso();- await writeStateRaw(uid, cid, s);+ writeCodingDirectory(uid, cid, trimmed, opts.explicit, opts.needsConfirmation);+ delete s.coding_project_dir;+ delete s.coding_project_dir_explicit;+ delete s.coding_project_dir_pending;+ Object.assign(s, readCodingDirectory(uid, cid));return s;});}@@ -1095,12 +1101,9 @@ export async function setCodingProjectDirOnce(return _stateLock(uid, cid).runExclusive(async () => {const s = await readState(uid, cid);const trimmed = String(dir || '').trim();- if (s.coding_project_dir || !trimmed) return { state: s, applied: false };- s.coding_project_dir = trimmed;- if (opts.explicit) s.coding_project_dir_explicit = true;- else delete s.coding_project_dir_explicit;- s.last_active_at = nowIso();- await writeStateRaw(uid, cid, s);+ if (s.coding_project_dir || s.coding_project_dir_pending || !trimmed) return { state: s, applied: false };+ writeCodingDirectory(uid, cid, trimmed, opts.explicit);+ Object.assign(s, readCodingDirectory(uid, cid));return { state: s, applied: true };});}diff --git a/src/main/features/local_agents/backends/base.ts b/src/main/features/local_agents/backends/base.tsindex 9d63dbce..08ec3d9e 100644--- a/src/main/features/local_agents/backends/base.ts+++ b/src/main/features/local_agents/backends/base.ts@@ -141,6 +141,8 @@ export interface LocalCliUserInputRequest {autoResolutionMs?: number;/** Aborted when the CLI clears this specific request or its run ends. */signal?: AbortSignal;+ /** Send a native decline and wait for request-specific protocol evidence. */+ cancel?: () => Promise<'cancelled' | 'closed' | 'failed' | 'unknown'>;}export interface LocalCliUserInputResponse {diff --git a/src/main/features/local_agents/backends/claude.ts b/src/main/features/local_agents/backends/claude.tsindex d8b008da..4c383210 100644--- a/src/main/features/local_agents/backends/claude.ts+++ b/src/main/features/local_agents/backends/claude.ts@@ -16,6 +16,7 @@import { createLogger } from '../../../logger.js';import { AGENT_EXECUTION_MAX_MS } from '../../../util/agent-execution-budget.js';import { logErrorSummary } from '../../../util/log-redact.js';+import { CliInputCancellation, CliInputNotSentError } from '../cli_input_cancel.js';import {type LocalBackend,type LocalActiveRunIngress,@@ -114,11 +115,11 @@ export const claudeBackend: LocalBackend = {// must never interleave records or let a steer overtake a pending approval// response.let stdinWrites: Promise<void> = Promise.resolve();- const writeInputRecord = (record: Record<string, unknown>): Promise<void> => {+ const writeInputRecord = (record: Record<string, unknown>, cancellationSignal?: AbortSignal): Promise<void> => {const line = `${JSON.stringify(record)}\n`;const write = stdinWrites.then(() => new Promise<void>((resolve, reject) => {- if (exited || child.stdin.destroyed || !child.stdin.writable) {- reject(new Error('claude stdin is no longer writable'));+ if (exited || cancellationSignal?.aborted || child.stdin.destroyed || !child.stdin.writable) {+ reject(new CliInputNotSentError('claude stdin is no longer writable'));return;}child.stdin.write(line, (err?: Error | null) => {@@ -392,15 +393,26 @@ export const claudeBackend: LocalBackend = {* overtake each other while the renderer is waiting for a decision. */let permissionResponseQueue = Promise.resolve();const userInputRequests = new Map<string, AbortController>();+ const inputCancellations = new Map<string, { requestId: string; cancellation: CliInputCancellation }>();const cancelUserInputs = (): void => {for (const controller of userInputRequests.values()) controller.abort();userInputRequests.clear();+ inputCancellations.clear();};const respondToControlRequest = async (msg: any, inputSignal?: AbortSignal): Promise<void> => {if (exited || inputSignal?.aborted) return;const req = msg?.request || {};const inputMap = (req.input && typeof req.input === 'object') ? req.input : {};if (req.subtype === 'can_use_tool' && req.tool_name === 'AskUserQuestion') {+ const toolUseId = typeof req.tool_use_id === 'string' ? req.tool_use_id : '';+ const cancellation = inputSignal && toolUseId ? new CliInputCancellation(inputSignal, () => writeInputRecord({+ type: 'control_response',+ response: {+ subtype: 'success', request_id: msg.request_id,+ response: { behavior: 'deny', message: 'The user did not answer this question.' },+ },+ }, inputSignal)) : undefined;+ if (cancellation) inputCancellations.set(toolUseId, { requestId: msg.request_id, cancellation });const original = Array.isArray(inputMap.questions) ? inputMap.questions : [];const questions = original.slice(0, 4).map((question: any, index: number) => ({id: `question-${index}`,@@ -416,12 +428,15 @@ export const claudeBackend: LocalBackend = {if (questions.length && questions.every((question: { question: string }) => question.question)&& opts.requestUserInput) {try {- answer = await opts.requestUserInput({ id: String(msg.request_id || ''), questions, isBlocking: true, signal: inputSignal });+ answer = await opts.requestUserInput({+ id: String(msg.request_id || ''), questions, isBlocking: true, signal: inputSignal,+ cancel: cancellation?.cancel,+ });} catch (err) {log.warn('claude user-input request failed', { error: logErrorSummary(err) });}}- if (inputSignal?.aborted || exited) return;+ if (inputSignal?.aborted || exited || cancellation?.mayHaveSent) return;const answered = !answer.cancelled && questions.length > 0&& questions.every((question: { id: string }) => answer.answers[question.id]?.some(value => value.trim()));const answers = Object.fromEntries(questions.map((question: { id: string; question: string }) => [@@ -526,6 +541,9 @@ export const claudeBackend: LocalBackend = {if (inputController && userInputRequests.get(obj.request_id) === inputController) {userInputRequests.delete(obj.request_id);}+ for (const [id, entry] of inputCancellations) {+ if (entry.requestId === obj.request_id) inputCancellations.delete(id);+ }});return;}@@ -534,6 +552,18 @@ export const claudeBackend: LocalBackend = {userInputRequests.delete(obj.request_id);return;}+ // Only the result for this exact tool invocation proves the CLI has+ // finished the declined question. Text, unrelated tool results, and+ // successful stdin writes cannot acknowledge a cancellation.+ if (obj?.type === 'user' && Array.isArray(obj.message?.content)) {+ for (const part of obj.message.content) {+ if (part?.type !== 'tool_result') continue;+ const entry = inputCancellations.get(part.tool_use_id);+ if (!entry) continue;+ entry.cancellation.confirm();+ userInputRequests.get(entry.requestId)?.abort();+ }+ }// Side-channel: each `assistant` block carries a `message.usage`// snapshot for that turn-piece. Multica accumulates these per// model and reports a flat total at the end. We do the samediff --git a/src/main/features/local_agents/backends/codex.ts b/src/main/features/local_agents/backends/codex.tsindex 5923c18c..f803ecf0 100644--- a/src/main/features/local_agents/backends/codex.ts+++ b/src/main/features/local_agents/backends/codex.ts@@ -28,6 +28,7 @@import { createLogger } from '../../../logger.js';import { logErrorSummary } from '../../../util/log-redact.js';+import { CliInputCancellation, CliInputNotSentError } from '../cli_input_cancel.js';import {type LocalBackend,type LocalActiveRunIngress,@@ -364,6 +365,7 @@ export const codexBackend: LocalBackend = {let nextRpcId = 1;const pending = new Map<number, { method: string; resolve: (r: any) => void; reject: (e: Error) => void }>();const userInputRequests = new Map<string | number, AbortController>();+ const inputCancellations = new Map<string | number, CliInputCancellation>();let threadId: string | undefined;let activeTurnId: string | undefined;let turnStarted = false;@@ -472,10 +474,20 @@ export const codexBackend: LocalBackend = {isSecret: question?.isSecret === true,})).filter((question: { id: string; question: string }) => question.id && question.question);+ const cancellation = new CliInputCancellation(signal, () => new Promise<void>((resolve, reject) => {+ if (exited || signal.aborted || child.stdin.destroyed || !child.stdin.writable) {+ reject(new CliInputNotSentError('codex input request is no longer writable'));+ return;+ }+ child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: env.id, result: { answers: {} } }) + '\n',+ (error?: Error | null) => error ? reject(error) : resolve());+ }));+ inputCancellations.set(env.id, cancellation);const response = opts.requestUserInput? await opts.requestUserInput({id: typeof params.itemId === 'string' ? params.itemId : String(env.id),signal,+ cancel: cancellation.cancel,questions,...(typeof params.isBlocking === 'boolean' ? { isBlocking: params.isBlocking } : {}),...(Number.isFinite(params.autoResolutionMs)@@ -486,7 +498,7 @@ export const codexBackend: LocalBackend = {cancelled: true,answers: Object.fromEntries(questions.map((question: { id: string }) => [question.id, []])),};- if (signal.aborted) return;+ if (signal.aborted || cancellation.mayHaveSent) return;const answers = Object.fromEntries(questions.map((question: { id: string }) => [question.id,{@@ -560,6 +572,7 @@ export const codexBackend: LocalBackend = {const closePending = (err: Error) => {for (const controller of userInputRequests.values()) controller.abort();userInputRequests.clear();+ inputCancellations.clear();for (const { reject } of pending.values()) reject(err);pending.clear();};@@ -620,6 +633,7 @@ export const codexBackend: LocalBackend = {});}).finally(() => {if (userInputRequests.get(env.id) === controller) userInputRequests.delete(env.id);+ inputCancellations.delete(env.id);});} else if (CODEX_OPTIONAL_SERVER_REQUEST_METHODS.has(env.method)) {// These callbacks require an explicit client capability or a@@ -721,6 +735,8 @@ export const codexBackend: LocalBackend = {const eventThreadId = typeof params.threadId === 'string' ? params.threadId : '';if (threadId && eventThreadId && eventThreadId !== threadId) return;if (method === 'serverRequest/resolved') {+ if (!threadId || eventThreadId !== threadId) return;+ inputCancellations.get(params.requestId)?.confirm();userInputRequests.get(params.requestId)?.abort();userInputRequests.delete(params.requestId);return;diff --git a/src/main/features/local_agents/bridge.ts b/src/main/features/local_agents/bridge.tsindex 53ca471f..e327b87b 100644--- a/src/main/features/local_agents/bridge.ts+++ b/src/main/features/local_agents/bridge.ts@@ -69,7 +69,7 @@ import {replaceAgentEntry,} from '../memory';import * as connectors from '../connectors';-import { requestActionConfirm } from '../connectors/action_confirm';+import { requestActionConfirm, connectorAccountKey } from '../connectors/action_confirm';import { connectorActionRisk, isConnectorActionBlocked } from '../connectors/action_policy';import {localCliCapabilities,@@ -437,6 +437,7 @@ function _buildMethods(cid: opts.cid,connectorId,displayName: target.instance.display_name,+ accountKey: connectorAccountKey(target.instance),accountLabel: target.instance.composio_grant?.account_label|| target.instance.oauth_grant?.account_label,toolName,diff --git a/src/main/features/local_agents/cli_input_cancel.ts b/src/main/features/local_agents/cli_input_cancel.tsnew file mode 100644index 00000000..7c846e08--- /dev/null+++ b/src/main/features/local_agents/cli_input_cancel.ts@@ -0,0 +1,58 @@+/** Only a failure before writing proves that a cancellation was not sent. */+export class CliInputNotSentError extends Error {}++/** Missing receipts leave the outcome unknown; never replay an uncertain reply. */+export class CliInputCancellation {+ private confirmed = false;+ private uncertain = false;+ private sentOrUnknown = false;+ private pending?: Promise<'cancelled' | 'closed' | 'failed' | 'unknown'>;+ private finish?: (result: 'cancelled' | 'closed' | 'failed' | 'unknown') => void;++ constructor(private readonly signal: AbortSignal, private readonly send: () => Promise<void>) {}++ get mayHaveSent(): boolean { return this.sentOrUnknown; }++ confirm(): void {+ this.confirmed = true;+ this.finish?.('cancelled');+ }++ cancel = (): Promise<'cancelled' | 'closed' | 'failed' | 'unknown'> => {+ if (this.confirmed) return Promise.resolve('cancelled');+ if (this.signal.aborted) return Promise.resolve('closed');+ if (this.pending) return this.pending;+ if (this.uncertain) return Promise.resolve('unknown');+ const attempt = new Promise<'cancelled' | 'closed' | 'failed' | 'unknown'>(resolve => {+ const finish = (result: 'cancelled' | 'closed' | 'failed' | 'unknown') => {+ if (this.finish !== finish) return;+ this.finish = undefined;+ this.uncertain = result === 'unknown';+ clearTimeout(timer);+ this.signal.removeEventListener('abort', onAbort);+ resolve(result);+ };+ const onAbort = () => finish(this.confirmed ? 'cancelled' : 'closed');+ // Bound receipt waiting only. This is neither a question deadline nor+ // evidence that the CLI rejected the cancellation.+ const timer = setTimeout(() => finish('unknown'), 5_000);+ timer.unref?.();+ this.finish = finish;+ this.signal.addEventListener('abort', onAbort, { once: true });+ void Promise.resolve().then(() => {+ if (this.signal.aborted) { onAbort(); return; }+ this.sentOrUnknown = true;+ return this.send();+ }).catch(error => {+ if (error instanceof CliInputNotSentError) {+ this.sentOrUnknown = false;+ finish('failed');+ } else {+ finish('unknown');+ }+ });+ });+ this.pending = attempt.finally(() => { this.pending = undefined; });+ return this.pending;+ };+}diff --git a/src/main/features/local_agents/cli_user_input.ts b/src/main/features/local_agents/cli_user_input.tsindex 62098000..2a0e958e 100644--- a/src/main/features/local_agents/cli_user_input.ts+++ b/src/main/features/local_agents/cli_user_input.ts@@ -35,6 +35,9 @@ interface Pending {heartbeat?: NodeJS.Timeout;autoResolve?: NodeJS.Timeout;detachAbort?: () => void;+ cancel?: LocalCliUserInputRequest['cancel'];+ cancelUncertain?: boolean;+ cancelling?: Promise<{ handled: boolean; cancelled?: boolean; closed?: boolean; cancel_failed?: boolean; unknown?: boolean }>;}const pending = new Map<string, Pending>();@@ -156,7 +159,7 @@ export async function requestUserInput(opts: {});}};- const entry: Pending = { uid: opts.uid, runId: opts.runId, questionIds, resolve };+ const entry: Pending = { uid: opts.uid, runId: opts.runId, questionIds, resolve, cancel: opts.request.cancel };pending.set(requestId, entry);const cancel = () => {if (settle(requestId, emptyResponse(questionIds))) {@@ -197,6 +200,7 @@ export function respond(): { handled: boolean; cancelled?: boolean } {const entry = pending.get(requestId);if (!entry || entry.uid !== uid) return { handled: false };+ if (entry.cancelling || entry.cancelUncertain) return { handled: false };const record = rawAnswers && typeof rawAnswers === 'object' && !Array.isArray(rawAnswers)? rawAnswers as Record<string, unknown>: {};@@ -212,6 +216,34 @@ export function respond(return { handled: true, cancelled };}+/** Keep ownership until the native question is confirmed closed. A retry after+ * a lost IPC response may find no pending request; report closed, not success. */+export async function cancelRequest(requestId: string, uid: string): Promise<{+ handled: boolean; cancelled?: boolean; closed?: boolean; cancel_failed?: boolean; unknown?: boolean;+}> {+ const entry = pending.get(requestId);+ if (!entry) return { handled: false, closed: true };+ if (entry.uid !== uid) return { handled: false };+ if (!entry.cancel) return { handled: false, cancel_failed: true };+ if (entry.cancelUncertain) return { handled: false, unknown: true };+ if (entry.cancelling) return entry.cancelling;+ entry.cancelling = (async () => {+ let result: 'cancelled' | 'closed' | 'failed' | 'unknown';+ try { result = await entry.cancel!(); } catch { result = 'unknown'; }+ if (result === 'failed') return { handled: false, cancel_failed: true };+ if (result !== 'cancelled' && result !== 'closed') {+ entry.cancelUncertain = true;+ return { handled: false, unknown: true };+ }+ settle(requestId, emptyResponse(entry.questionIds));+ return result === 'cancelled'+ ? { handled: true, cancelled: true }+ : { handled: false, closed: true };+ })();+ try { return await entry.cancelling; }+ finally { entry.cancelling = undefined; }+}+export function cancelForRun(runId: string): void {const requestIds: string[] = [];for (const [requestId, entry] of pending) {diff --git a/src/main/features/local_agents/project-directory.ts b/src/main/features/local_agents/project-directory.tsnew file mode 100644index 00000000..b4da6d12--- /dev/null+++ b/src/main/features/local_agents/project-directory.ts@@ -0,0 +1,120 @@+/** Device-owned conversation cwd. Legacy cloud values need local provenance;+ * existence alone cannot establish that a path belongs to this conversation.+ * Synchronous atomic migration cannot interleave with another main-process writer.+ */+import * as fs from 'node:fs';+import * as path from 'node:path';+import * as crypto from 'node:crypto';+import { localCliDirectoryFile, localCliSessionsFile, userAgentRuntimeConfigFile } from '../../paths';+import { writeTextAtomicSync } from '../../storage';+import { t } from '../../i18n';++interface DirectoryRecord {+ version: 1;+ directory: string;+ explicit: boolean;+ needs_confirmation?: boolean;+}++export interface CodingDirectoryState {+ coding_project_dir?: string;+ coding_project_dir_explicit?: boolean;+ coding_project_dir_pending?: string;+}++function readObject(file: string): Record<string, any> | null {+ try {+ const data = JSON.parse(fs.readFileSync(file, 'utf8'));+ if (!data || typeof data !== 'object' || Array.isArray(data)) throw new Error();+ return data;+ } catch (error) {+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null;+ throw new Error(t('errors.cli_directory_storage'));+ }+}++function writeRecord(uid: string, cid: string, record: DirectoryRecord): void {+ const file = localCliDirectoryFile(uid, cid);+ try {+ fs.mkdirSync(path.dirname(file), { recursive: true });+ writeTextAtomicSync(file, JSON.stringify(record, null, 2), 'utf8', { mode: 0o600 });+ }+ catch { throw new Error(t('errors.cli_directory_storage')); }+}++function hasLocalProvenance(uid: string, cid: string, directory: string): boolean {+ if (!path.isAbsolute(directory)) return false;+ const canonical = path.resolve(directory);+ // These two existing device files are read-only migration evidence. Their+ // owning modules remain the sole writers of sessions and Agent settings.+ const fingerprint = crypto.createHash('sha256').update(canonical).digest('hex');+ const sessions = readObject(localCliSessionsFile(uid, cid));+ if (Object.values(sessions || {}).some((r: any) => r?.sessionId && r.cwdFingerprint === fingerprint)) return true;+ const settings = readObject(userAgentRuntimeConfigFile(uid));+ return Object.values(settings?.project_dirs || {}).some((r: any) => (+ typeof r?.path === 'string' && path.isAbsolute(r.path) && path.resolve(r.path) === canonical+ ));+}++export function readCodingDirectory(uid: string, cid: string, legacy?: CodingDirectoryState | (() => CodingDirectoryState)): CodingDirectoryState {+ let record = readObject(localCliDirectoryFile(uid, cid)) as DirectoryRecord | null;+ if (!record) {+ const source = typeof legacy === 'function' ? legacy() : legacy;+ const directory = typeof source?.coding_project_dir === 'string' ? source.coding_project_dir.trim() : '';+ record = {+ version: 1, directory, explicit: source?.coding_project_dir_explicit === true,+ ...(directory && !hasLocalProvenance(uid, cid, directory) ? { needs_confirmation: true } : {}),+ };+ // Even an empty record is a migration tombstone: a later remote upload+ // from an old client must never become new local selection authority.+ writeRecord(uid, cid, record);+ }+ if (record.version !== 1 || typeof record.directory !== 'string'+ || typeof record.explicit !== 'boolean'+ || (record.needs_confirmation !== undefined && typeof record.needs_confirmation !== 'boolean')+ || (record.directory && !record.needs_confirmation && !path.isAbsolute(record.directory))) {+ throw new Error(t('errors.cli_directory_storage'));+ }+ if (!record.directory) return {};+ if (record.needs_confirmation) return { coding_project_dir_pending: record.directory };+ return {+ coding_project_dir: record.directory,+ ...(record.explicit ? { coding_project_dir_explicit: true } : {}),+ };+}++/** An unreadable migration source must remain retryable; never freeze an+ * empty choice merely because the normal cloud-state reader fell back. */+export function readCodingDirectoryFromStateFile(uid: string, cid: string, file: string): CodingDirectoryState {+ return readCodingDirectory(uid, cid, () => readObject(file) || {});+}++export function writeCodingDirectory(uid: string, cid: string, directory: string, explicit: boolean, needsConfirmation = false): void {+ if (directory && !needsConfirmation && !path.isAbsolute(directory)) throw new Error(t('errors.path_not_dir'));+ writeRecord(uid, cid, { version: 1, directory, explicit: !!directory && explicit,+ ...(directory && needsConfirmation ? { needs_confirmation: true } : {}),+ });+}++/** Never serialize the effective local overlay into cloud state. */+export function cloudConversationState<T extends Record<string, any>>(state: T): T {+ if (!state || typeof state !== 'object' || Array.isArray(state)) return state;+ const keys = ['coding_project_dir', 'coding_project_dir_explicit', 'coding_project_dir_pending'];+ if (!keys.some((key) => Object.prototype.hasOwnProperty.call(state, key))) return state;+ const cloud = { ...state };+ for (const key of keys) delete cloud[key];+ return cloud;+}++export function removeCodingDirectory(uid: string, cid: string): void {+ fs.rmSync(localCliDirectoryFile(uid, cid), { force: true });+}++export function inspectCodingDirectory(directory: string): { kind: 'available' | 'missing' | 'denied' | 'unavailable'; code?: string } {+ try { return fs.statSync(directory).isDirectory() ? { kind: 'available' } : { kind: 'missing', code: 'ENOTDIR' }; }+ catch (error) {+ const code = (error as NodeJS.ErrnoException).code;+ return { kind: code === 'ENOENT' || code === 'ENOTDIR' ? 'missing'+ : code === 'EACCES' || code === 'EPERM' ? 'denied' : 'unavailable', code };+ }+}diff --git a/src/main/ipc/connectors.ts b/src/main/ipc/connectors.tsindex 9a97cc6e..69ce8a17 100644--- a/src/main/ipc/connectors.ts+++ b/src/main/ipc/connectors.ts@@ -24,6 +24,7 @@ import type { ConnectorInstance, ConnectorStatus, ToolSchema } from '../featuresimport { isConnectorEnabled, setConnectorEnabled } from '../features/component_enabled';import { catalogWithAvailability, isConnectorRuntimeEnabled } from '../features/connectors/availability';import { requireConnectorApiKey } from '../features/connectors/api-key';+import { checkLocalCliPermissions, localCliMissingPermissions } from '../features/connectors/local-cli';/*** Renderer-safe view of a connector instance. The hydrated `ConnectorInstance`@@ -51,6 +52,8 @@ interface ClientConnectorInstance {created_at: string;updated_at: string;enabled?: boolean;+ reauthorization_required?: boolean;+ missing_permissions?: string[];}function _safeTransportSummary(inst: ConnectorInstance): ClientConnectorInstance['transport'] | undefined {@@ -75,7 +78,7 @@ function _safeTransportSummary(inst: ConnectorInstance): ClientConnectorInstance}/** Strip every secret-bearing field; never spread the raw instance to the renderer. */-function toClientInstance(inst: ConnectorInstance, enabled?: boolean): ClientConnectorInstance {+function toClientInstance(inst: ConnectorInstance, enabled?: boolean, uid?: string): ClientConnectorInstance {const transport = _safeTransportSummary(inst);const out: ClientConnectorInstance = {id: inst.id,@@ -97,6 +100,13 @@ function toClientInstance(inst: ConnectorInstance, enabled?: boolean): ClientConout.oauth_grant = { account_label: inst.composio_grant.account_label };}if (typeof enabled === 'boolean') out.enabled = enabled;+ if (uid && inst.origin !== 'custom') {+ const missing = localCliMissingPermissions(uid, inst.id);+ if (missing !== null) {+ out.reauthorization_required = true;+ out.missing_permissions = missing;+ }+ }return out;}@@ -114,7 +124,7 @@ export const invokeHandlers = {// without a second IPC. Defaults to true when the user hasn't toggled it (the file only// stores `false` overrides — see features/component_enabled.ts).const raw = connectors.listInstances(ctx.userId).filter((inst) => isConnectorRuntimeEnabled(inst.id));- const instances = raw.map((inst) => toClientInstance(inst, isConnectorEnabled(ctx.userId, inst.id)));+ const instances = raw.map((inst) => toClientInstance(inst, isConnectorEnabled(ctx.userId, inst.id), ctx.userId));return { instances };},@@ -124,9 +134,17 @@ export const invokeHandlers = {* happens to call one of its tools. TTL + live-connection checks live in the manager, so repeat* panel opens cost nothing — see `verifyUsableConnectors` for the full cost rationale. */'connectors.verify': async (_payload: unknown, ctx: { userId: string }) => {- const verified = await connectors.verifyUsableConnectors(ctx.userId, 'connectors_panel');+ const catalog = connectors.connectorCatalog();+ const checks = connectors.listInstances(ctx.userId).filter(inst => inst.origin !== 'custom'+ && isConnectorRuntimeEnabled(inst.id)).map(inst => {+ const entry = catalog.find(entry => entry.id === inst.id);+ return entry ? checkLocalCliPermissions(ctx.userId, entry) : Promise.resolve();+ });+ const [verified] = await Promise.all([+ connectors.verifyUsableConnectors(ctx.userId, 'connectors_panel'), ...checks,+ ]);const raw = connectors.listInstances(ctx.userId).filter((inst) => isConnectorRuntimeEnabled(inst.id));- const instances = raw.map((inst) => toClientInstance(inst, isConnectorEnabled(ctx.userId, inst.id)));+ const instances = raw.map((inst) => toClientInstance(inst, isConnectorEnabled(ctx.userId, inst.id), ctx.userId));return { verified, instances };},@@ -208,12 +226,13 @@ export const invokeHandlers = {},/** Renderer answer to a per-action sensitive connector confirmation. */- 'connectors.action_confirm_response': async (payload: { request_id?: unknown; approved?: unknown }) => {+ 'connectors.action_confirm_response': async (payload: { request_id?: unknown; approved?: unknown; scope?: unknown }) => {if (typeof payload?.request_id !== 'string' || !payload.request_id) throw new Error('invalid request_id');if (typeof payload?.approved !== 'boolean') throw new Error('invalid approved flag');// eslint-disable-next-line @typescript-eslint/no-require-importsconst actionConfirm = require('../features/connectors/action_confirm') as typeof import('../features/connectors/action_confirm');- return { handled: actionConfirm.respond(payload.request_id, payload.approved) };+ if (payload.scope !== undefined && payload.scope !== 'once' && payload.scope !== 'task') throw new Error('invalid approval scope');+ return { handled: actionConfirm.respond(payload.request_id, payload.approved, payload.scope === 'task' ? 'task' : 'once') };},'connectors.add_custom': async (@@ -226,7 +245,7 @@ export const invokeHandlers = {display_name: payload?.display_name as string,transport: payload?.transport as never,});- return { instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id)) };+ return { instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id), ctx.userId) };},'connectors.remove': async (payload: { id?: unknown }, ctx: { userId: string }) => {@@ -240,9 +259,13 @@ export const invokeHandlers = {const tools = await connectors.refreshTools(ctx.userId, payload.id);const instance = connectors.getInstance(ctx.userId, payload.id);if (!instance) throw new Error('instance not found after refresh');+ if (instance.origin !== 'custom') {+ const entry = connectors.connectorCatalog().find(entry => entry.id === instance.id);+ if (entry) await checkLocalCliPermissions(ctx.userId, entry, true);+ }return {tools,- instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id)),+ instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id), ctx.userId),};},@@ -258,7 +281,7 @@ export const invokeHandlers = {} else throw new Error('subtools must be null or string[]');const instance = await connectors.setEnabledSubtools(ctx.userId, payload.id, subset);if (!instance) throw new Error('instance not found');- return { instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id)) };+ return { instance: toClientInstance(instance, isConnectorEnabled(ctx.userId, instance.id), ctx.userId) };},'connectors.google_sheets_authorize_files': async (diff --git a/src/main/ipc/local_agents.ts b/src/main/ipc/local_agents.tsindex 4815c53a..6e3fe1c1 100644--- a/src/main/ipc/local_agents.ts+++ b/src/main/ipc/local_agents.ts@@ -287,6 +287,7 @@ export const invokeHandlers = {&& (!payload.answers || typeof payload.answers !== 'object' || Array.isArray(payload.answers))) {throw new Error('invalid answers');}+ if (payload.cancelled === true) return cliUserInput.cancelRequest(payload.request_id, ctx.userId);return cliUserInput.respond(payload.request_id,ctx.userId,diff --git a/src/main/locales/en.json b/src/main/locales/en.jsonindex bf1d0c9a..dc152700 100644--- a/src/main/locales/en.json+++ b/src/main/locales/en.json@@ -1,4 +1,7 @@{+ "errors.cli_directory_storage": "The project directory setting could not be read or saved. Check disk access and try again.",+ "errors.cli_directory_denied": "Access to the project directory was denied. Restore folder access and try again; your directory selection has been kept.",+ "errors.cli_directory_unavailable": "The project directory is temporarily unavailable. Check the folder or drive and try again; your directory selection has been kept.","agent.execution_idle_timeout_seconds": "The agent made no progress for {seconds}s, so the run was stopped. Try again or ask the agent to continue.","agent.execution_wall_timeout": "The run reached the 24-hour limit and was stopped. Ask the agent to continue unfinished work.","agent.execution_idle_timeout": "The agent made no progress for 30 minutes, so the run was stopped. Try again or ask the agent to continue.",diff --git a/src/main/locales/ja.json b/src/main/locales/ja.jsonindex 920e7743..ca8ea443 100644--- a/src/main/locales/ja.json+++ b/src/main/locales/ja.json@@ -1,4 +1,7 @@{+ "errors.cli_directory_storage": "プロジェクトディレクトリの設定を読み込み、または保存できません。ディスクへのアクセスを確認して再試行してください。",+ "errors.cli_directory_denied": "プロジェクトディレクトリへのアクセスが拒否されました。フォルダのアクセス権を復元して再試行してください。選択したディレクトリは保持されています。",+ "errors.cli_directory_unavailable": "プロジェクトディレクトリに一時的にアクセスできません。フォルダまたはドライブを確認して再試行してください。選択したディレクトリは保持されています。","agent.execution_idle_timeout_seconds": "{seconds}s間進展がなかったため実行を停止しました。再試行するか、エージェントに続行を依頼してください。","agent.execution_wall_timeout": "今回の実行が24時間の上限に達したため停止しました。エージェントに未完了の作業の続行を依頼できます。","agent.execution_idle_timeout": "30分間進展がなかったため実行を停止しました。再試行するか、エージェントに続行を依頼してください。",diff --git a/src/main/locales/pt.json b/src/main/locales/pt.jsonindex 524592e5..9cdbda6e 100644--- a/src/main/locales/pt.json+++ b/src/main/locales/pt.json@@ -1,4 +1,7 @@{+ "errors.cli_directory_storage": "Não foi possível ler ou salvar a configuração do diretório do projeto. Verifique o acesso ao disco e tente novamente.",+ "errors.cli_directory_denied": "O acesso ao diretório do projeto foi negado. Restaure o acesso à pasta e tente novamente; sua seleção foi mantida.",+ "errors.cli_directory_unavailable": "O diretório do projeto está temporariamente indisponível. Verifique a pasta ou unidade e tente novamente; sua seleção foi mantida.","agent.execution_idle_timeout_seconds": "O agente ficou {seconds}s sem progresso, e a execução foi interrompida. Tente novamente ou peça ao agente para continuar.","agent.execution_wall_timeout": "A execução atingiu o limite de 24 horas e foi interrompida. Peça ao agente para continuar o trabalho pendente.","agent.execution_idle_timeout": "O agente ficou 30 minutos sem progresso, e a execução foi interrompida. Tente novamente ou peça ao agente para continuar.",diff --git a/src/main/locales/zh.json b/src/main/locales/zh.jsonindex ed33d31b..59a76a79 100644--- a/src/main/locales/zh.json+++ b/src/main/locales/zh.json@@ -1,4 +1,7 @@{+ "errors.cli_directory_storage": "无法读取或保存项目目录设置,请检查磁盘访问权限后重试。",+ "errors.cli_directory_denied": "没有项目目录的访问权限。请恢复文件夹访问权限后重试,原目录选择已保留。",+ "errors.cli_directory_unavailable": "项目目录暂时无法访问。请检查文件夹或磁盘后重试,原目录选择已保留。","agent.execution_idle_timeout_seconds": "智能体已连续 {seconds}s 没有实际进展,执行已停止。请重试,或让智能体继续。","agent.execution_wall_timeout": "本次执行已达到 24 小时上限并停止。可让智能体继续未完成的工作。","agent.execution_idle_timeout": "智能体已连续 30 分钟没有实际进展,执行已停止。请重试,或让智能体继续。",diff --git a/src/main/model/core-agent/connector-meta-tools.ts b/src/main/model/core-agent/connector-meta-tools.tsindex b1fb7b85..7911c23f 100644--- a/src/main/model/core-agent/connector-meta-tools.ts+++ b/src/main/model/core-agent/connector-meta-tools.ts@@ -36,7 +36,7 @@ import {} from '../../features/connectors/tools-adapter';import { validateCustomTransport, validateDisplayName, CustomTransportError } from '../../features/connectors/custom-transport';import { requestInstallConfirm } from '../../features/connectors/install_confirm';-import { requestActionConfirm } from '../../features/connectors/action_confirm';+import { requestActionConfirm, connectorAccountKey } from '../../features/connectors/action_confirm';import { connectorActionRisk, isConnectorActionBlocked } from '../../features/connectors/action_policy';import { findCatalogEntry } from '../../features/connectors/catalog';import { resolveLanguageForUser } from '../../features/config';@@ -444,6 +444,7 @@ function createCallConnectorToolTool(opts: ConnectorMetaToolsOpts): AgentTool {match.instance,_descriptionLangForUser(opts.userId),),+ accountKey: connectorAccountKey(match.instance),accountLabel: match.instance.composio_grant?.account_label|| match.instance.oauth_grant?.account_label,toolName,diff --git a/src/main/model/core-agent/external-providers.ts b/src/main/model/core-agent/external-providers.tsindex ef9f7f91..1934a46e 100644--- a/src/main/model/core-agent/external-providers.ts+++ b/src/main/model/core-agent/external-providers.ts@@ -343,10 +343,11 @@ export async function createMoonshotProvider(config: CreateMoonshotProviderConficonst DEEPSEEK_BASE_URL = 'https://api.deepseek.com/v1';// Context windows from https://api-docs.deepseek.com/quick_start/pricing-// (checked 2026-08). DeepSeek V4 series introduced 1M-token context via+// (checked 2026-09-10). DeepSeek V4 series introduced 1M-token context via// Compressed Sparse Attention. Fallback 131072 for unknown ids (safe lower// bound; older deprecated v3 snapshots top out there).const DEEPSEEK_CONTEXT_WINDOW: Record<string, number> = {+ 'deepseek-flash': 1_048_576,'deepseek-v4-pro': 1_048_576,'deepseek-v4-flash-vision-exp': 1_048_576,'deepseek-v4-flash': 1_048_576,@@ -357,10 +358,11 @@ function deepseekContextWindow(modelId: string): number {}// The official V4 pricing/spec table lists a 384K maximum output for Pro,-// Flash, and Flash Vision Exp. pi-ai clamps only against remaining context,+// Flash (including V4.1), and Flash Vision Exp. pi-ai clamps only against remaining context,// so preserving the provider's real cap avoids silently truncating long// reasoning + answers. Unknown/legacy ids retain a conservative 8192 fallback.const DEEPSEEK_MAX_OUTPUT_TOKENS: Record<string, number> = {+ 'deepseek-flash': 384_000,'deepseek-v4-pro': 384_000,'deepseek-v4-flash-vision-exp': 384_000,'deepseek-v4-flash': 384_000,@@ -379,17 +381,10 @@ export function buildDeepSeekModel(modelId: string): Model<'openai-completions'>api: 'openai-completions',provider: 'deepseek' as any,baseUrl: DEEPSEEK_BASE_URL,- // Both V4 Pro and V4 Flash must be treated as reasoners: empirically- // V4 Flash also spontaneously returns `reasoning_content`, and once- // that lands in session history, subsequent turns missing- // `reasoning_effort` get rejected by DeepSeek (misleading error- // message "reasoning_content in the thinking mode must be passed- // back"). pi-ai's openai-completions adapter only attaches- // `reasoning_effort` when `model.reasoning === true` (see pi-ai- // openai-completions.js line 396), so we must mark every v4-* as- // true, paired with `defaultReasoning: 'low'` below so the request- // always carries the effort field.- reasoning: /^deepseek-v4-/.test(modelId),+ // Keep V4 models and the V4.1 Flash alias reasoning-capable. This+ // advertises support; it does not choose an effort level for the caller.+ // createDeepSeekProvider preserves explicit choices through its payload hook.+ reasoning: modelId === 'deepseek-flash' || /^deepseek-v4-/.test(modelId),// Official Pro/Flash aliases remain text-only. Flash Vision and remotely// configured models can declare supportsVision explicitly; an omitted// declaration defaults to visual for parity with user-defined endpoints.diff --git a/src/main/model/public_model_catalog.ts b/src/main/model/public_model_catalog.tsindex 3a0a53af..620470bb 100644--- a/src/main/model/public_model_catalog.ts+++ b/src/main/model/public_model_catalog.ts@@ -83,6 +83,7 @@ export const PUBLIC_PROVIDER_MODELS: Readonly<Record<string, readonly ProviderMo{ id: 'MiniMax-M2.7', name: 'MiniMax 2.7' },],deepseek: [+ { id: 'deepseek-flash', name: 'DeepSeek V4.1 Flash', contextWindow: 1_048_576, maxTokens: 384_000, supportsVision: true, maxInputImages: 600 },{ id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', contextWindow: 1_048_576, maxTokens: 384_000, supportsVision: false },{ id: 'deepseek-v4-flash-vision-exp', name: 'DeepSeek V4 Flash Vision', contextWindow: 1_048_576, maxTokens: 384_000, supportsVision: true, maxInputImages: 600 },{ id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash', contextWindow: 1_048_576, maxTokens: 384_000, supportsVision: false },@@ -109,6 +110,7 @@ export const PUBLIC_PROVIDER_MODELS: Readonly<Record<string, readonly ProviderMo{ id: 'google/gemini-3.7-flash', name: 'Gemini 3.7 Flash', maxInputImages: 20 },{ id: 'google/gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro (preview)', maxInputImages: 20 },{ id: 'google/gemini-3.5-flash-lite', name: 'Gemini 3.5 Flash Lite', maxInputImages: 20 },+ { id: 'deepseek/deepseek-v4.1-flash', name: 'DeepSeek V4.1 Flash', template: 'deepseek/deepseek-v4-flash-vision-exp', contextWindow: 1_048_576, maxTokens: 384_000, supportsVision: true, maxInputImages: 20 },{ id: 'deepseek/deepseek-v4-pro', name: 'DeepSeek V4 Pro' },{ id: 'deepseek/deepseek-v4-flash-0731', name: 'DeepSeek V4 Flash 0731', template: 'deepseek/deepseek-v4-flash', contextWindow: 1048576, maxTokens: 384000 },{ id: 'moonshotai/kimi-k3', name: 'Kimi K3', maxInputImages: 20 },diff --git a/src/main/paths.ts b/src/main/paths.tsindex 7959b59a..79ab3778 100644--- a/src/main/paths.ts+++ b/src/main/paths.ts@@ -566,6 +566,9 @@ export const userLocalCliSessionsDir = (uid: string) =>path.join(userLocalRoot(uid), 'cli-sessions');export const localCliSessionsFile = (uid: string, cid: string) =>path.join(userLocalCliSessionsDir(uid), `${cid}.json`);+// User selections are durable device state, independent of resumable sessions.+export const localCliDirectoryFile = (uid: string, cid: string) =>+ path.join(userLocalRoot(uid), 'cli-directories', `${assertProjectSegment(cid)}.json`);// ── External packages (machine-private, verbatim third-party repos) ─────// `<uid>/local/packages/<name>/` hosts a cloned open-source repo UNMODIFIEDdiff --git a/src/renderer/index.html b/src/renderer/index.htmlindex 07e179f9..201c022c 100644--- a/src/renderer/index.html+++ b/src/renderer/index.html@@ -1339,9 +1339,9 @@<input type="file" id="project-todo-file-input" multiple hidden /><div class="todo-editor-field-grid"><label class="todo-editor-field"><span data-i18n="todo.project">Project</span><span class="todo-editor-select" id="project-todo-project"></span></label>+ <label class="todo-editor-field"><span data-i18n="project.todo.assign">Agent</span><span class="todo-editor-select" id="project-todo-agent"></span></label><label class="todo-editor-field"><span data-i18n="todo.status">Status</span><span class="todo-editor-select" id="project-todo-status"></span></label></div>- <label class="todo-editor-field"><span data-i18n="project.todo.assign">Assign agent</span><span class="todo-editor-select" id="project-todo-agent"></span></label><div class="modal-actions todo-editor-actions"><button type="button" class="btn" id="project-todo-cancel" data-i18n="project.todo.cancel">Cancel</button><button type="button" class="btn btn-primary" id="project-todo-save" data-i18n="project.todo.save" disabled>Save</button>diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.jsonindex 42919502..3ecd1f58 100644--- a/src/renderer/locales/en.json+++ b/src/renderer/locales/en.json@@ -141,6 +141,11 @@"connectors.empty": "No connectors available.","connectors.search.placeholder": "Search connectors","connectors.search.empty": "No connectors match your search.",+ "connectors.action.authorize_permissions": "Reauthorize",+ "connectors.permissions.send_as_user": "Send messages",+ "connectors.permissions.missing": "Missing permission: {permissions}",+ "connectors.permissions.limited": "Some permissions are missing",+ "connectors.permissions.send_mail": "Send mail","connectors.action.connect": "Connect","connectors.action.connecting": "Connecting…","connectors.action.review_requirements": "Review requirements",@@ -246,9 +251,8 @@"connectors.action_confirm.account_unknown": "Current connected account","connectors.action_confirm.operation": "Sensitive type","connectors.action_confirm.action": "Action",+ "connectors.action_confirm.details": "View details","connectors.action_confirm.arguments": "Final arguments:",- "connectors.action_confirm.fresh_note": "This confirmation applies only to the account, action, and arguments above. Changed arguments require a new confirmation.",- "connectors.action_confirm.destructive_note": "This action may not be recoverable. This confirmation applies only to the details above and can be used once.","connectors.action_confirm.approve": "Confirm and run","connectors.action_confirm.approve_destructive": "Run this action","connectors.action_confirm.decline": "Cancel",@@ -2038,7 +2042,7 @@"project.todo.save": "Save","project.todo.delete": "Delete","todo.unassigned": "Unassigned",- "project.todo.assign": "Assign agent",+ "project.todo.assign": "Agent","project.todo.assigned_to": "Owner: {name}","project.todo.attach": "Attach files","project.todo.attach_count": "{n} attachments",diff --git a/src/renderer/locales/ja.json b/src/renderer/locales/ja.jsonindex 1b9793c2..d99d1453 100644--- a/src/renderer/locales/ja.json+++ b/src/renderer/locales/ja.json@@ -141,6 +141,11 @@"connectors.empty": "利用可能なコネクターはありません。","connectors.search.placeholder": "コネクターを検索","connectors.search.empty": "検索条件に一致するコネクターはありません。",+ "connectors.action.authorize_permissions": "再認証",+ "connectors.permissions.send_as_user": "メッセージ送信",+ "connectors.permissions.missing": "未許可:{permissions}",+ "connectors.permissions.limited": "一部の権限が不足しています",+ "connectors.permissions.send_mail": "メール送信","connectors.action.connect": "接続","connectors.action.connecting": "接続中…","connectors.action.review_requirements": "接続要件を確認",@@ -246,9 +251,8 @@"connectors.action_confirm.account_unknown": "現在接続中のアカウント","connectors.action_confirm.operation": "機密操作の種類","connectors.action_confirm.action": "操作",+ "connectors.action_confirm.details": "詳細を表示","connectors.action_confirm.arguments": "最終引数:",- "connectors.action_confirm.fresh_note": "この確認は上記のアカウント、操作、引数にのみ有効です。引数を変更した場合は再確認が必要です。",- "connectors.action_confirm.destructive_note": "この操作は元に戻せない場合があります。この確認は上記の内容にのみ有効で、一度だけ使用できます。","connectors.action_confirm.approve": "確認して実行","connectors.action_confirm.approve_destructive": "この操作を実行","connectors.action_confirm.decline": "キャンセル",@@ -2038,7 +2042,7 @@"project.todo.save": "保存","project.todo.delete": "削除","todo.unassigned": "未指定",- "project.todo.assign": "エージェントを割り当て",+ "project.todo.assign": "エージェント","project.todo.assigned_to": "担当: {name}","project.todo.attach": "ファイルを添付","project.todo.attach_count": "{n} 件の添付",diff --git a/src/renderer/locales/pt.json b/src/renderer/locales/pt.jsonindex 1cad57c8..0e1192a1 100644--- a/src/renderer/locales/pt.json+++ b/src/renderer/locales/pt.json@@ -136,6 +136,11 @@"connectors.empty": "Nenhum conector disponível.","connectors.search.placeholder": "Pesquisar conectores","connectors.search.empty": "Nenhum conector corresponde à pesquisa.",+ "connectors.action.authorize_permissions": "Autorizar novamente",+ "connectors.permissions.send_as_user": "Enviar mensagens",+ "connectors.permissions.missing": "Permissão ausente: {permissions}",+ "connectors.permissions.limited": "Algumas permissões estão ausentes",+ "connectors.permissions.send_mail": "Enviar e-mail","connectors.action.connect": "Conectar","connectors.action.connecting": "Conectando…","connectors.action.review_requirements": "Ver requisitos",@@ -241,9 +246,8 @@"connectors.action_confirm.account_unknown": "Conta conectada atual","connectors.action_confirm.operation": "Tipo sensível","connectors.action_confirm.action": "Ação",+ "connectors.action_confirm.details": "Ver detalhes","connectors.action_confirm.arguments": "Argumentos finais:",- "connectors.action_confirm.fresh_note": "Esta confirmação vale apenas para a conta, ação e argumentos acima. Argumentos alterados exigem nova confirmação.",- "connectors.action_confirm.destructive_note": "Esta ação pode não ser recuperável. A confirmação vale apenas para os detalhes acima e pode ser usada uma vez.","connectors.action_confirm.approve": "Confirmar e executar","connectors.action_confirm.approve_destructive": "Executar esta ação","connectors.action_confirm.decline": "Cancelar",@@ -2027,7 +2031,7 @@"project.todo.save": "Salvar","project.todo.delete": "Excluir","todo.unassigned": "Sem responsável",- "project.todo.assign": "Atribuir agente",+ "project.todo.assign": "Agente","project.todo.assigned_to": "Responsável: {name}","project.todo.attach": "Anexar arquivos","project.todo.attach_count": "{n} anexos",diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.jsonindex 6371a856..24bd5fe5 100644--- a/src/renderer/locales/zh.json+++ b/src/renderer/locales/zh.json@@ -141,6 +141,11 @@"connectors.empty": "暂无可用连接器。","connectors.search.placeholder": "搜索连接器","connectors.search.empty": "没有匹配的连接器。",+ "connectors.action.authorize_permissions": "重新授权",+ "connectors.permissions.send_as_user": "发送消息",+ "connectors.permissions.missing": "缺少权限:{permissions}",+ "connectors.permissions.limited": "部分权限不足",+ "connectors.permissions.send_mail": "发送邮件","connectors.action.connect": "连接","connectors.action.connecting": "连接中…","connectors.action.review_requirements": "查看接入要求",@@ -245,10 +250,9 @@"connectors.action_confirm.account": "账号","connectors.action_confirm.account_unknown": "当前已连接账号","connectors.action_confirm.operation": "敏感类型",- "connectors.action_confirm.action": "具体操作",+ "connectors.action_confirm.action": "操作",+ "connectors.action_confirm.details": "查看详情","connectors.action_confirm.arguments": "最终参数:",- "connectors.action_confirm.fresh_note": "本次确认仅对以上账号、操作和参数有效;修改参数后必须重新确认。",- "connectors.action_confirm.destructive_note": "此操作可能无法恢复。本次确认仅对以上账号、操作和参数有效,且只能使用一次。","connectors.action_confirm.approve": "确认执行","connectors.action_confirm.approve_destructive": "确认执行此操作","connectors.action_confirm.decline": "取消",@@ -2038,7 +2042,7 @@"project.todo.save": "保存","project.todo.delete": "删除","todo.unassigned": "未指定",- "project.todo.assign": "指派智能体",+ "project.todo.assign": "智能体","project.todo.assigned_to": "负责:{name}","project.todo.attach": "添加附件","project.todo.attach_count": "{n} 个附件",diff --git a/src/renderer/modules/bash_permission.js b/src/renderer/modules/bash_permission.jsindex 67d26e6a..2f414d1c 100644--- a/src/renderer/modules/bash_permission.js+++ b/src/renderer/modules/bash_permission.js@@ -13,6 +13,7 @@ const _bashPermLog = createLogger('bash-permission');const _bashPermQueue = [];let _bashPermDialogOpen = false;const _bashPermCancelled = new Set();+const _bashPermTaskApproved = new Set();const _bashPermDialogClosers = new Map();const _BASH_PERMISSION_MODES = ['workspace_approval', 'all_files_approval', 'all_files_auto'];@@ -59,17 +60,17 @@ function _bashPermissionReceivedAt(info, fallback = Date.now()) {}function _bashTrackCancelledPermission(info, currentMode, errorCode = 'request_cancelled') {+ const approved = _bashPermTaskApproved.delete(info.request_id);_bashTrackPermissionResult(info, {- result: 'cancelled',- decision: 'none',- effective_decision: 'deny',+ result: approved ? 'success' : 'cancelled',+ decision: approved ? 'allow_run' : 'none',+ effective_decision: approved ? 'allow_run' : 'deny',...(currentMode ? { mode: currentMode } : {}),mode_changed: false,categories: _bashPermissionCategories(info),...(_bashPermissionIrreversible(info) ? { irreversible: _bashPermissionIrreversible(info) } : {}),duration_ms: Math.max(0, Date.now() - _bashPermissionReceivedAt(info)),- error_type: 'state',- error_code: errorCode,+ ...(approved ? {} : { error_type: 'state', error_code: errorCode }),});}@@ -247,6 +248,8 @@ async function _setBashPermissionMode(mode) {function _showBashPermissionModeDialog({title,message,+ details,+ detailsLabel,currentMode,requestId,onPresented,@@ -265,6 +268,9 @@ function _showBashPermissionModeDialog({overlay.className = 'modal-overlay ui-dialog-overlay open';const titleHtml = title ? `<div class="modal-title ui-dialog-title">${_bashEscapeHtml(title)}</div>` : '';const msgHtml = _bashEscapeHtml(message).replace(/\n/g, '<br />');+ const detailsChevronHtml = details && typeof window.uiIconHtml === 'function'+ ? window.uiIconHtml('chevron-down', 'sidebar-section-chevron') : '';+ const detailsHtml = details ? `<details class="bash-permission-details"><summary>${detailsChevronHtml}${_bashEscapeHtml(detailsLabel)}</summary><pre>${_bashEscapeHtml(details)}</pre></details>` : '';let selectedModeValue = safeCurrentMode;const selectedItem = () => modes.find((item) => item.mode === selectedModeValue) || modes.find((item) => item.mode === safeCurrentMode) || modes[0];const modeHtml = modes.map((item) => `@@ -294,7 +300,7 @@ function _showBashPermissionModeDialog({overlay.innerHTML = `<div class="modal modal-standard ui-dialog bash-permission-dialog" role="dialog" aria-modal="true" aria-label="${_bashEscapeHtml(title)}">${titleHtml}- <div class="modal-body ui-dialog-message bash-permission-message">${msgHtml}</div>+ <div class="modal-body ui-dialog-message bash-permission-message">${msgHtml}${detailsHtml}</div><div class="bash-permission-footer"><div class="modal-actions bash-permission-actions">${modeControlHtml}@@ -468,10 +474,8 @@ async function _showBashPermissionDialog(info) {let presented = false;const isSensitiveApproval = isConnector || (Array.isArray(info.reasons)&& info.reasons.some((reason) => _BASH_PERMISSION_RISK_CATEGORIES.includes(reason)));- // Connector approvals bind the exact account, operation and arguments, like- // other external mutations. A task grant must not widen that approval.- const canAllowRun = !isConnector && info.unresolved_paths !== true- && (!isSensitiveApproval || info.can_allow_run === true);+ const canAllowRun = isConnector ? info.can_allow_run === true+ : info.unresolved_paths !== true && (!isSensitiveApproval || info.can_allow_run === true);// An earlier queued permission can switch the account to Trusted while this// connector waits. Its host gate already checked availability/prohibitions.let result;@@ -482,6 +486,10 @@ async function _showBashPermissionDialog(info) {: await _showBashPermissionModeDialog({title: t(isAction ? 'bash.permission.action_title' : 'bash.permission.title'),message,+ ...(isConnector ? {+ details: _connectorActionDetails(info),+ detailsLabel: t('connectors.action_confirm.details'),+ } : {}),currentMode,requestId,allowRun: canAllowRun,@@ -553,7 +561,7 @@ async function _showBashPermissionDialog(info) {const response = await window.orkas.invoke(isConnector ? 'connectors.action_confirm_response' : 'bash.permission_response',isConnector- ? { request_id: info.request_id, approved: decision !== 'deny' }+ ? { request_id: info.request_id, approved: decision !== 'deny', ...(decision === 'allow_run' ? { scope: 'task' } : {}) }: { request_id: info.request_id, decision },);const failed = !response || response.ok === false;@@ -716,6 +724,7 @@ function _cancelBashPermissionRequests(payload, kind) {: [];const cancelled = new Set(ids);for (const id of ids) {+ if (kind === 'connector' && payload.approved === true) _bashPermTaskApproved.add(id);_bashPermCancelled.add(id);const close = _bashPermDialogClosers.get(id);if (close) close();diff --git a/src/renderer/modules/cli_async_input.js b/src/renderer/modules/cli_async_input.jsindex 208436fc..0799fe4b 100644--- a/src/renderer/modules/cli_async_input.js+++ b/src/renderer/modules/cli_async_input.js@@ -1,5 +1,9 @@// Native questions appear only in the composer dock.// Drafts and submissions belong to the original turn; no answer is implicit.+// Two producers share the card: an asynchronous question carried by a message+// (answer steers the live turn) and a blocking request the CLI is waiting on+// (answer resolves that request over its own IPC). Only delivery differs, so+// the blocking caller passes its own controller.(function () {const drafts = new Map();const replies = new Map();@@ -12,8 +16,11 @@function syncDock() {const dock = document.getElementById('chat-cli-questions');if (!dock) return;+ // `pending` marks a blocking request: the CLI holds its turn open until the+ // answer arrives, so the card stays until it is answered or cancelled.const visible = [...dockEntries.values()].filter(entry => entry.cid === visibleCid- && !entry.saved && (entry.savePending || entry.submitting || (!entry.closed && activeTurns.has(entry.cid))));+ && !entry.saved && !entry.cancelling && (entry.pending || entry.savePending || entry.submitting+ || (!entry.closed && activeTurns.has(entry.cid))));const hosts = new Set(visible.map(entry => entry.host));for (const child of [...dock.children]) if (!hosts.has(child)) child.remove();let added = null;@@ -183,8 +190,242 @@paint();}+ const requestCards = new Set();++ /** One field per question: the label, the options as buttons that fill the+ * answer box, and the box itself. Same markup as the message-backed card+ * above, so both surfaces stay one visual contract. */+ function mountRequest(host, spec) {+ const questions = Array.isArray(spec && spec.questions) ? spec.questions : [];+ if (!questions.length) return null;+ const answers = questions.map(() => '');+ const picks = questions.map(() => []);+ const optionButtons = questions.map(() => []);+ let submitting = false;+ let closed = false;++ host.classList.add('chat-input-form');+ host.replaceChildren();+ const title = document.createElement('div');+ title.className = 'form-title';+ host.appendChild(title);++ const inputs = [];+ questions.forEach((question, index) => {+ const row = document.createElement('div');+ row.className = 'form-field';+ const label = document.createElement('label');+ label.className = 'form-field-label';+ label.textContent = question.header+ ? `${question.header} · ${question.question || ''}`+ : String(question.question || '');+ row.appendChild(label);++ const options = Array.isArray(question.options) ? question.options : [];+ const described = options.filter(option => option && option.description);+ if (described.length) {+ // An option's description is the reason to pick it. The dialog used to+ // dump these into its body; keep them beside the options instead. One+ // element per option, because a description long enough to wrap must+ // not read as the beginning of the next option.+ const desc = document.createElement('div');+ desc.className = 'form-field-desc';+ for (const option of described) {+ const line = document.createElement('div');+ line.className = 'form-field-desc-option';+ const name = document.createElement('span');+ name.className = 'form-field-desc-name';+ name.textContent = `${option.label}:`;+ line.appendChild(name);+ const body = document.createElement('span');+ body.textContent = String(option.description);+ line.appendChild(body);+ desc.appendChild(line);+ }+ row.appendChild(desc);+ }++ const input = document.createElement('textarea');+ input.className = 'form-field-input form-field-textarea';+ input.rows = 2;+ input.maxLength = 4000;+ input.setAttribute('aria-label', String(question.question || ''));+ inputs.push(input);++ if (options.length) {+ const group = document.createElement('div');+ group.className = 'form-field-checkgroup';+ options.forEach((option) => {+ const label2 = String(option && option.label || '');+ const button = document.createElement('button');+ button.type = 'button';+ button.className = 'btn';+ button.textContent = label2;+ if (option && option.description) button.setAttribute('title', String(option.description));+ button.addEventListener('click', () => {+ if (submitting || closed) return;+ const selected = picks[index];+ if (question.multiSelect === true) {+ const at = selected.indexOf(label2);+ if (at >= 0) selected.splice(at, 1);+ else selected.push(label2);+ } else {+ picks[index] = selected.length === 1 && selected[0] === label2 ? [] : [label2];+ }+ answers[index] = picks[index].join(', ');+ input.value = answers[index];+ paintOptions(index);+ updateSubmit();+ });+ optionButtons[index].push({ button, label: label2 });+ group.appendChild(button);+ });+ row.appendChild(group);+ }++ input.addEventListener('input', () => {+ answers[index] = input.value;+ // Typing owns the answer from here: a stale highlight would claim the+ // CLI received a label the user has edited away.+ if (picks[index].join(', ') !== input.value) picks[index] = [];+ paintOptions(index);+ updateSubmit();+ });+ row.appendChild(input);+ host.appendChild(row);+ });++ const status = document.createElement('div');+ status.className = 'form-error';+ host.appendChild(status);+ const actions = document.createElement('div');+ actions.className = 'cli-question-actions';+ const submit = document.createElement('button');+ submit.type = 'button';+ submit.className = 'btn btn-primary';+ const cancel = document.createElement('button');+ cancel.type = 'button';+ cancel.className = 'btn';+ actions.appendChild(submit);+ actions.appendChild(cancel);+ host.appendChild(actions);++ function paintOptions(index) {+ for (const entry of optionButtons[index]) {+ const active = picks[index].includes(entry.label);+ // A pick reads as a tint, not a second filled primary: the card spends+ // its one saturated fill on send, and two of them fight for the eye.+ entry.button.className = active ? 'btn is-selected' : 'btn';+ entry.button.setAttribute('aria-pressed', String(active));+ entry.button.disabled = submitting || closed;+ }+ }++ function updateSubmit() {+ submit.disabled = submitting || closed || answers.some(value => !String(value).trim());+ cancel.disabled = submitting || closed;+ for (const input of inputs) input.disabled = submitting || closed;+ }++ function paintText() {+ title.textContent = spec.actorLabel+ ? `${spec.actorLabel} · ${t('chat.cli_question.title')}`+ : t('chat.cli_question.title');+ for (const input of inputs) input.placeholder = t('chat.cli_question.placeholder');+ submit.textContent = t('chat.cli_question.send');+ cancel.textContent = t('common.cancel');+ }++ function settle() {+ if (closed) return;+ closed = true;+ requestCards.delete(paintText);+ updateSubmit();+ spec.onClosed?.();+ }++ submit.addEventListener('click', async () => {+ if (submit.disabled || submitting || closed) return;+ submitting = true;+ status.textContent = '';+ updateSubmit();+ questions.forEach((_, index) => paintOptions(index));+ let delivered = false;+ try {+ delivered = await spec.submit(answers.map(value => String(value).trim()), picks.map(list => list.slice()));+ } catch (_) {+ delivered = false;+ }+ submitting = false;+ if (delivered) {+ settle();+ return;+ }+ status.textContent = t('chat.cli_question.send_failed');+ updateSubmit();+ questions.forEach((_, index) => paintOptions(index));+ });++ cancel.addEventListener('click', async () => {+ if (cancel.disabled || submitting || closed) return;+ submitting = true;+ updateSubmit();+ questions.forEach((_, index) => paintOptions(index));+ spec.onCancelPending?.(true);+ let result = 'unknown';+ for (let attempt = 0; attempt < 2 && !closed; attempt += 1) {+ try { result = await spec.cancel(); } catch (_) { result = 'unknown'; }+ if (result !== 'failed') break;+ }+ submitting = false;+ if (closed) return;+ // Closing the local card does not claim that the CLI accepted the reply.+ // Only an explicit failure allows the user to answer this request again.+ if (result !== 'failed') { settle(); return; }+ updateSubmit();+ questions.forEach((_, index) => paintOptions(index));+ spec.onCancelPending?.(false);+ });++ requestCards.add(paintText);+ paintText();+ questions.forEach((_, index) => paintOptions(index));+ updateSubmit();+ return settle;+ }++ /** Dock a blocking request in its conversation. Returns a closer, or null+ * when there is no dock to render into (the caller then keeps its dialog). */+ function showCliInputRequest(spec) {+ const cid = String(spec && spec.cid || '');+ const requestId = String(spec && spec.requestId || '');+ if (!cid || !requestId) return null;+ if (!document.getElementById('chat-cli-questions')) return null;+ const id = keyFor(cid, `cli-input:${requestId}`);+ if (dockEntries.has(id)) return null;+ const entry = { cid, host: document.createElement('section'), pending: true };+ entry.host.classList.add('cli-question-panel');+ const settle = mountRequest(entry.host, {+ ...spec,+ onCancelPending: cancelling => {+ entry.cancelling = cancelling;+ syncDock();+ },+ onClosed: () => {+ dockEntries.delete(id);+ entry.host.remove();+ syncDock();+ spec.onClosed?.();+ },+ });+ if (!settle) return null;+ dockEntries.set(id, entry);+ syncDock();+ return settle;+ }+window.CliAsyncInput = {- mount, showQuestion, observe,+ mount, showQuestion, observe, showCliInputRequest,showConversation(cid) {visibleCid = cid || null;syncDock();@@ -208,5 +449,6 @@};window.addEventListener('i18n-change', () => {for (const key of mounts.keys()) refresh(key);+ for (const paintText of requestCards) paintText();});})();diff --git a/src/renderer/modules/connectors.js b/src/renderer/modules/connectors.jsindex 57bfefe3..7ec5a6d7 100644--- a/src/renderer/modules/connectors.js+++ b/src/renderer/modules/connectors.js@@ -772,7 +772,7 @@ window.openConnectorSetupById = async function openConnectorSetupById(id) {let entry = _catalogEntryById(targetId);if (entry && entry.catalog_parent_id) entry = _catalogEntryById(entry.catalog_parent_id);const installed = entry ? _instanceForCatalogEntry(entry) : null;- if (!entry || (installed && !_isReconnectableError(entry, installed))) {+ if (!entry || (installed && !installed.reauthorization_required && !_isReconnectableError(entry, installed))) {return window.focusConnectorById(entry ? entry.id : targetId);}// The protected form is owned by the catalog, not by a filtered DOM card.@@ -1159,6 +1159,7 @@ function _renderCatalogCard(entry, instance) {: 0;const installPhase = _localCliInstallPhases.get(e.id) || '';const installError = _localCliInstallErrors.get(e.id) || null;+ const permissionNotice = e.auth_mode === 'local_cli' && instance?.reauthorization_required;// The ⋯ menu lives on installed cards — it hosts the destructive disconnect action so it stays// one click away from accidental triggers. Un-connected / errored cards still surface the@@ -1198,6 +1199,11 @@ function _renderCatalogCard(entry, instance) {} else if (connected) {const useTitle = escapeHtml(formatChatUseLabel({ kind: 'connector', id: e.id, name: displayName || e.id }));action = `<button class="agent-card-use connector-card-use" data-act="use-connector" title="${useTitle}" aria-label="${useTitle}" ${enabledFlag ? '' : 'disabled aria-disabled="true" tabindex="-1"'}>${escapeHtml(t('common.use'))}</button>`;+ if (e.auth_mode === 'local_cli' && instance.reauthorization_required) {+ action = `<button class="btn btn-sm btn-primary" data-act="connect">${escapeHtml(t('connectors.action.authorize_permissions'))}</button>${action}`;+ }+ } else if (e.auth_mode === 'local_cli' && instance && instance.reauthorization_required) {+ action = `<button class="btn btn-sm btn-primary" data-act="connect">${escapeHtml(t('connectors.action.authorize_permissions'))}</button>`;} else if (degraded) {// Retry re-runs connect + token refresh (`connectors.refresh`) — NOT OAuth. The grant is fine;// what failed was reaching the backend. Offering "连接" here would send the user through a@@ -1242,10 +1248,25 @@ function _renderCatalogCard(entry, instance) {${menuHtml}</div><div class="connector-card-desc muted"></div>+ ${permissionNotice ? '<div class="connector-card-unverified" data-role="permission-notice"></div>' : ''}<div class="connector-card-foot">${cardBadgesHtml}${action}</div>`;card.querySelector('.connector-card-name').textContent = displayName;card.querySelector('.connector-card-desc').textContent = desc;+ if (permissionNotice) {+ const scopes = Array.isArray(instance.missing_permissions) ? instance.missing_permissions : [];+ const permissionLabels = {+ 'im:message.send_as_user': 'send_as_user',+ 'chat.message:send': 'send_as_user',+ 'mail:send': 'send_mail',+ };+ const labels = [...new Set(scopes.map(scope => Object.hasOwn(permissionLabels, scope)+ ? t('connectors.permissions.' + permissionLabels[scope]) : scope))];+ const notice = card.querySelector('[data-role="permission-notice"]');+ notice.textContent = labels.length+ ? t('connectors.permissions.missing', { permissions: labels.join(', ') })+ : t('connectors.permissions.limited');+ }if (installError) {const el = card.querySelector('.connector-card-error');const text = _formatLocalCliInstallError(installError, e);@@ -2246,27 +2267,14 @@ async function _drainConnectorInstallQueue() {}function _connectorActionMessage(info) {- const operationKey = `connectors.action_confirm.operation.${String(info.sensitive_operation || 'unclassified')}`;- const translatedOperation = t(operationKey);- const operation = translatedOperation === operationKey ? t('connectors.action_confirm.operation.unclassified') : translatedOperation;const catalogEntry = _catalogEntryById(info.connector_id);const displayName = catalogEntry ? _connectorDisplayName(catalogEntry) : (info.display_name || info.connector_id);- const account = info.account_label || t('connectors.action_confirm.account_unknown');return [- t(info.risk === 'D'- ? 'connectors.action_confirm.destructive_message'- : 'connectors.action_confirm.sensitive_message'),- '',`${t('connectors.action_confirm.connector')}: ${displayName}`,- `${t('connectors.action_confirm.account')}: ${account}`,- `${t('connectors.action_confirm.operation')}: ${operation}`,- `${t('connectors.action_confirm.action')}: ${info.tool_name}`,- '',- t('connectors.action_confirm.arguments'),- String(info.arguments_preview || '{}'),- '',- t(info.risk === 'D'- ? 'connectors.action_confirm.destructive_note'- : 'connectors.action_confirm.fresh_note'),+ `${t('connectors.action_confirm.action')}: ${info.action_name || info.tool_name}`,].join('\n');}++function _connectorActionDetails(info) {+ return String(info.arguments_preview || '{}');+}diff --git a/src/renderer/modules/dialogs.js b/src/renderer/modules/dialogs.jsindex 4200166d..e59f2505 100644--- a/src/renderer/modules/dialogs.js+++ b/src/renderer/modules/dialogs.js@@ -283,7 +283,13 @@ function uiConfirmDanger({ title, message, dangerLabel, cancelLabel } = {}) {// `choices: [{ id, label, style? }]` — `style` may be 'primary' (default),// 'danger', or '' for the neutral .btn look. `leadingChoices` renders one// or more neutral/contextual choices on the left edge of the actions row.-function uiChoice({ title, message, choices = [], leadingChoices = [], cancelLabel, signal, multiple = false } = {}) {+/** `choiceLayout: 'group'` lays the choices out as a wrapping group above the+ * action row, the way the native-question card in the composer dock renders+ * its options. Prose labels (a CLI question's options) need it: the action+ * row is one non-wrapping line, so more than a few of them collapse to their+ * min-width and the labels wrap into unreadable columns. The default keeps+ * short confirm choices beside cancel on the action row. */+function uiChoice({ title, message, choices = [], leadingChoices = [], cancelLabel, signal, multiple = false, choiceLayout = 'actions' } = {}) {return new Promise((resolve) => {if (signal && signal.aborted) {resolve(null);@@ -307,15 +313,20 @@ function uiChoice({ title, message, choices = [], leadingChoices = [], cancelLab};const leadingChoiceHtml = leadingChoices.map((c) => renderChoice(c, 'ui-choice-leading')).join('');const choiceHtml = choices.map((c) => renderChoice(c)).join('');+ const groupedChoices = choiceLayout === 'group';+ const choiceGroupHtml = groupedChoices+ ? `<div class="ui-dialog-choices" role="group" aria-labelledby="${messageId}">${choiceHtml}</div>`+ : '';const selectedIds = new Set();overlay.innerHTML = `<div class="modal ui-dialog modal-standard" role="dialog" aria-modal="true" aria-labelledby="${title ? titleId : messageId}"${title ? ` aria-describedby="${messageId}"` : ''}>${titleHtml}<div class="modal-body ui-dialog-message" id="${messageId}">${msgHtml}</div>+ ${choiceGroupHtml}<div class="modal-actions">${leadingChoiceHtml}<button class="btn" data-act="cancel">${cancelText}</button>- ${choiceHtml}+ ${groupedChoices ? '' : choiceHtml}${multiple ? `<button class="btn btn-primary" data-act="confirm" disabled>${escapeHtml(_dialogLabel('common.confirm', 'Confirm'))}</button>` : ''}</div></div>diff --git a/src/renderer/modules/local_agent_user_input.js b/src/renderer/modules/local_agent_user_input.jsindex de1eb961..3a06d1dd 100644--- a/src/renderer/modules/local_agent_user_input.js+++ b/src/renderer/modules/local_agent_user_input.js@@ -7,8 +7,69 @@(function () {const queue = [];const active = new Map();+ const cards = new Map();+ // Main assigns each request a fresh id. Retain only ids for this renderer's+ // lifetime so replay cannot reopen answered or withdrawn questions.+ const seenRequests = new Set();let draining = false;+ function respond(requestId, answers, cancelled) {+ return window.orkas.invoke('localAgents.userInputResponse', {+ request_id: requestId,+ answers,+ cancelled,+ });+ }++ /** A question that belongs to a conversation renders in that conversation's+ * composer dock — the same card a native asynchronous question uses. Secret+ * input needs masking the card has no control for, and a request without a+ * conversation or dock has nowhere to land, so both keep the dialog. */+ function cardEligible(info) {+ return typeof info.cid === 'string' && info.cid+ && !!(window.CliAsyncInput && typeof window.CliAsyncInput.showCliInputRequest === 'function')+ && Array.isArray(info.questions) && info.questions.length+ && info.questions.every(question => question && question.isSecret !== true);+ }++ function showCard(info) {+ const requestId = String(info.request_id || '');+ const questions = info.questions;+ const close = window.CliAsyncInput.showCliInputRequest({+ requestId,+ cid: String(info.cid || ''),+ actorLabel: String(info.agent_name || ''),+ questions,+ submit: async (values, picks) => {+ const answers = {};+ questions.forEach((question, index) => {+ const text = String(values[index] || '').trim();+ const picked = Array.isArray(picks[index]) ? picks[index] : [];+ // Keep the picked labels whole when the box still holds exactly them:+ // a multi-select answer stays several values instead of one string.+ answers[String(question.id || '')] = picked.length && picked.join(', ') === text+ ? picked.slice()+ : [text];+ });+ try {+ await respond(requestId, answers, false);+ return true;+ } catch (_) {+ return false;+ }+ },+ cancel: async () => {+ const result = await respond(requestId, {}, true);+ if (result?.cancelled === true || result?.closed === true) return 'closed';+ return result?.cancel_failed === true ? 'failed' : 'unknown';+ },+ onClosed: () => { cards.delete(requestId); },+ });+ if (!close) return false;+ cards.set(requestId, close);+ return true;+ }+function questionMessage(question) {const lines = [];if (question.header) lines.push(String(question.header));@@ -33,6 +94,11 @@title: t('agents.cli_user_input_title'),message: questionMessage(question),choices,+ // A CLI question carries prose options (up to 12 of them, 160 chars+ // each). Render them like the native-question card in the composer+ // dock: a wrapping group above the action row, each option as wide as+ // its own label.+ choiceLayout: 'group',signal,...(question.multiSelect === true ? { multiple: true } : {}),});@@ -76,20 +142,12 @@const value = await askQuestion(question, controller.signal);if (controller.signal.aborted) return;if (value === null) {- await window.orkas.invoke('localAgents.userInputResponse', {- request_id: requestId,- answers: {},- cancelled: true,- });+ await respond(requestId, {}, true);return;}answers[String(question.id || '')] = value;}- await window.orkas.invoke('localAgents.userInputResponse', {- request_id: requestId,- answers,- cancelled: false,- });+ await respond(requestId, answers, false);} catch (error) {try {createLogger('local-agent-user-input').warn('structured CLI input response failed', {@@ -114,6 +172,9 @@if (window.orkas && typeof window.orkas.onPushEvent === 'function') {window.orkas.onPushEvent('local-agent:user-input', (info) => {if (!info || typeof info.request_id !== 'string') return;+ if (seenRequests.has(info.request_id)) return;+ seenRequests.add(info.request_id);+ if (cardEligible(info) && showCard(info)) return;queue.push(info);void drain();});@@ -121,7 +182,12 @@const ids = new Set(Array.isArray(payload && payload.request_ids)? payload.request_ids.filter(id => typeof id === 'string'): []);- for (const id of ids) active.get(id)?.abort();+ for (const id of ids) {+ seenRequests.add(id);+ active.get(id)?.abort();+ cards.get(id)?.();+ cards.delete(id);+ }for (let index = queue.length - 1; index >= 0; index -= 1) {if (ids.has(queue[index] && queue[index].request_id)) queue.splice(index, 1);}diff --git a/src/renderer/modules/project-detail.js b/src/renderer/modules/project-detail.jsindex fdd1e6cf..cf81a754 100644--- a/src/renderer/modules/project-detail.js+++ b/src/renderer/modules/project-detail.js@@ -1333,7 +1333,7 @@ async function _loadTodoEditorAgents(task) {const options = [{ value: '', label: t('todo.unassigned') }];// Keep historical owners visible without re-saving them on title-only edits.const ownerValue = task?.owner_agent_id || task?.owner_agent || '';- if (ownerValue) options.push({ value: ownerValue, label: task.owner_agent || ownerValue });+ if (ownerValue) options.push({ value: ownerValue, label: task.owner_agent || ownerValue, avatar: { seed: ownerValue } });_todoEditorAgentSelect.setOptions(options, { value: ownerValue });_updateProjectTodoEditor();try {@@ -1347,8 +1347,11 @@ async function _loadTodoEditorAgents(task) {const owner = _findProjectAgent(task?.owner_agent_id, task?.owner_agent, _todoEditorAgents);const value = owner?.agent_id || ownerValue;const next = [{ value: '', label: t('todo.unassigned') },- ..._todoEditorAgents.map((a) => ({ value: a.agent_id, label: a.name || a.agent_id }))];- if (value && !next.some((a) => a.value === value)) next.push({ value, label: task.owner_agent || value });+ ..._todoEditorAgents.map((a) => ({+ value: a.agent_id, label: a.name || a.agent_id,+ avatar: { icon: a.icon, color: a.color, seed: a.agent_id },+ }))];+ if (value && !next.some((a) => a.value === value)) next.push({ value, label: task.owner_agent || value, avatar: { seed: value } });_todoEditorAgentSelect.setOptions(next, { value });} catch {if (seq === _todoEditorAgentLoadSeq && generation === _todoEditorGeneration) {diff --git a/src/renderer/modules/task-board.js b/src/renderer/modules/task-board.jsindex d4a0c035..b31781e9 100644--- a/src/renderer/modules/task-board.js+++ b/src/renderer/modules/task-board.js@@ -168,6 +168,18 @@ function _taskBoardOnEvent(cid, evData) {const task = evData && evData.task;if (!cid || !task || !task.task_id) return;const m = _taskBoardMapFor(cid);+ const cached = m.get(task.task_id);+ // The primary send stream, observer stream and list resync can overlap.+ // A delayed snapshot must not undo a settled lifecycle fact: terminal+ // tasks never revive, initial admission settles once, and a started task+ // never returns to queued/blocked (form resume goes straight to running).+ // Otherwise a stale row can briefly invent concurrent or waiting work.+ if (cached && (+ (_TASK_BOARD_TERMINAL.has(cached.status) && !_TASK_BOARD_TERMINAL.has(task.status))+ || (task.admission_pending === true && cached.admission_pending !== true)+ || ((task.status === 'queued' || task.status === 'blocked')+ && (cached.status === 'running' || cached.status === 'waiting_input'))+ )) return;// A task id this board has never seen starts (or joins) the current batch;// if everything tracked is already terminal, the new task opens a FRESH// batch and the previous run's terminal rows leave the active board view.@@ -336,6 +348,11 @@ function _taskBoardRender(cid) {// turn is suspended on the child — so the status text says that instead of// a second confusing "running".const orchestratingIds = new Set(rows.map((task) => task.parent_task_id).filter(Boolean));+ // Runtime updates replace these buttons. Restore the focused agent rather+ // than its index, which can change when another agent finishes.+ const activeToggle = document.activeElement;+ const focusedAssignee = activeToggle?.matches?.('.chat-queue-agent-toggle') && list.contains(activeToggle)+ ? activeToggle.closest('.chat-queue-agent-group')?.dataset.assignee : null;list.innerHTML = groups.map((group, index) => {const expanded = !_taskBoardCollapsedAgents.get(cid)?.has(group.assignee);return `@@ -416,6 +433,16 @@ function _taskBoardRender(cid) {button.setAttribute('aria-expanded', String(expanded));group.querySelector('.chat-queue-agent-items').hidden = !expanded;});+ button.addEventListener('keydown', (event) => {+ if (event.key !== ' ' || event.isComposing) return;+ // Native Space clicks on keyup, but a task update can detach the pressed+ // button first. Activate on keydown and suppress native/repeated clicks.+ event.preventDefault();+ if (!event.repeat) button.click();+ });+ if (focusedAssignee != null && button.closest('.chat-queue-agent-group')?.dataset.assignee === focusedAssignee) {+ button.focus({ preventScroll: true });+ }});list.querySelectorAll('.chat-queue-btn[data-act="task-send-now"]').forEach((btn) => {btn.addEventListener('click', (e) => {@@ -541,7 +568,10 @@ async function _taskBoardResumeBlocked(cid, taskId) {if (data && data.ok) {const m = _taskBoardMapFor(cid);const task = m.get(taskId);- if (task) m.set(taskId, { ...task, status: 'queued', after: undefined });+ // State events may beat the command acknowledgement. Only advance a+ // still-blocked snapshot; never overwrite an already running or+ // completed task with this acknowledgement's earlier queued state.+ if (task && task.status === 'blocked') m.set(taskId, { ...task, status: 'queued', after: undefined });_taskBoardRender(cid);// Run-anyway STARTS an execution from a bare invoke — no send stream is// attached, so the released task's task_state/turn events would have nodiff --git a/src/renderer/modules/utils.js b/src/renderer/modules/utils.jsindex 505cbe70..4711c3e7 100644--- a/src/renderer/modules/utils.js+++ b/src/renderer/modules/utils.js@@ -2192,7 +2192,7 @@ function _aiSelectPopoverZIndexFor(el) {function _aiSelectMount(el, config) {if (!el) return null;const state = {- options: [], // [{value, label, hint?, iconName?, disabled?}]+ options: [], // [{value, label, hint?, iconName?, avatar?, disabled?}]value: '',placeholder: (t('ai_select.placeholder')),onChange: () => {},@@ -2234,7 +2234,15 @@ function _aiSelectMount(el, config) {const renderOptionLabel = (target, opt) => {target.innerHTML = '';- if (opt && opt.iconName && typeof window !== 'undefined' && typeof window.uiIconHtml === 'function') {+ if (opt && opt.avatar && typeof renderAvatarHtml === 'function') {+ const avatar = document.createElement('span');+ avatar.className = 'ai-select-option-icon';+ avatar.setAttribute('aria-hidden', 'true');+ avatar.innerHTML = renderAvatarHtml(opt.avatar.icon, opt.avatar.color, {+ size: 18, seed: opt.avatar.seed,+ });+ target.appendChild(avatar);+ } else if (opt && opt.iconName && typeof window !== 'undefined' && typeof window.uiIconHtml === 'function') {const iconWrap = document.createElement('span');iconWrap.className = 'ai-select-option-icon';iconWrap.innerHTML = window.uiIconHtml(opt.iconName, 'ui-icon ai-select-svg-icon');@@ -2480,17 +2488,7 @@ function _aiSelectPick(api, value) {if (prev !== api.state.value) {try { api.state.onChange(api.state.value); } catch (_) {}}- const labelEl = api.el.querySelector('.ai-select-label');- const opt = api.state.options.find(o => o.value === api.state.value);- if (labelEl) {- if (opt) {- labelEl.textContent = opt.label;- labelEl.classList.remove('placeholder');- } else {- labelEl.textContent = api.state.placeholder;- labelEl.classList.add('placeholder');- }- }+ api.setValue(api.state.value);}// Test bridge — guarded CommonJS export of pure helpers. No-op in thediff --git a/src/renderer/style.css b/src/renderer/style.cssindex 5911a65f..19c1f291 100644--- a/src/renderer/style.css+++ b/src/renderer/style.css@@ -10027,10 +10027,89 @@ body.is-conversation-info-resizing * { cursor: col-resize !important; }background: var(--surface);box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);}-.cli-question-panel .form-field { margin-bottom: 8px; }-.cli-question-panel .form-field-label { color: var(--text); overflow-wrap: anywhere; }+/* The card is read top down before anything is clicked — who is asking, the+ question, then one line per option — so each step gets its own size and its+ own air. The inherited form styling was built for short field labels: it+ packs a 12px label against an 11px description with a negative margin, which+ collapses the three steps into one grey block. */+.cli-question-panel .form-title {+ font-size: 14px;+ line-height: 1.5;+ margin-bottom: 12px;+}+.cli-question-panel .form-field { gap: 8px; margin-bottom: 8px; }+.cli-question-panel .form-field-label {+ font-size: 13.5px;+ font-weight: 500;+ line-height: 1.55;+ color: var(--text);+ overflow-wrap: anywhere;+}.cli-question-panel .form-field-checkgroup .btn { white-space: normal; text-align: left; }.cli-question-panel .form-field-textarea { resize: none; }+/* Option descriptions arrive as one line per option, so line-height is the only+ thing separating one option's reason from the next. `--text-2` keeps them+ legible beside the buttons they explain instead of fading into the card. */+.cli-question-panel .form-field-desc {+ font-size: 12.5px;+ line-height: 1.7;+ color: var(--text-2);+ margin-top: 0;+ white-space: pre-line;+ overflow-wrap: anywhere;+}+/* Real space between options, not line-height: at a narrow dock a description+ wraps, and leading alone cannot say whether the next line continues this+ option or starts the next one. The name carries the card's text colour so a+ description can be matched back to the button that bears the same label. */+.cli-question-panel .form-field-desc-option + .form-field-desc-option {+ margin-top: 6px;+}+.cli-question-panel .form-field-desc-name {+ margin-right: 5px;+ color: var(--text);+ font-weight: 500;+}+/* Send sits under the answer box, with decline beside it: a blocking request+ must stay declinable, and the CLI is holding its turn until one is pressed. */+.cli-question-actions {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ margin-top: 10px;+}++/* The card sits inside the composer dock, a few pixels from the app's own send+ control, so it stays in the tinted register the rest of the app uses for a+ selected state (see `.project-driver-toggle[aria-pressed="true"]`) instead of+ the full-strength fill a modal's confirm button gets. Two tiers of the one+ hue: a picked option is the lighter one, send carries the solid border and+ the heavier weight so it still reads as the affirmative action. */+.cli-question-panel .form-field-checkgroup .btn.is-selected {+ background: var(--primary-soft);+ border-color: color-mix(in srgb, var(--primary) 38%, #fff);+ color: var(--primary-text);+}+.cli-question-panel .form-field-checkgroup .btn.is-selected:hover {+ background: color-mix(in srgb, var(--primary) 16%, #fff);+}+.cli-question-panel .btn-primary {+ background: color-mix(in srgb, var(--primary) 16%, #fff);+ border-color: var(--primary);+ color: var(--primary-text);+ font-weight: 600;+}+.cli-question-panel .btn-primary:hover {+ background: color-mix(in srgb, var(--primary) 26%, #fff);+}+/* `.btn-primary:disabled` re-asserts the solid fill, so the disabled send needs+ selectors that outrank it — including its `:disabled:hover` pair. */+.cli-question-panel .btn-primary:disabled,+.cli-question-panel .btn-primary:disabled:hover {+ background: color-mix(in srgb, var(--primary) 14%, #fff);+ border-color: color-mix(in srgb, var(--primary) 45%, #fff);+ color: var(--primary-text);+}.chat-skill-btn,@@ -11613,6 +11692,11 @@ body.is-conversation-info-resizing * { cursor: col-resize !important; }.modal-actions {display: flex;+ /* `min-width` below replaces the flex default `min-width: auto`, so without+ wrapping a row of several buttons shrinks every label into a narrow+ column. Wrap instead: each action keeps its own width and moves to the+ next line when the row is full. */+ flex-wrap: wrap;gap: 10px;justify-content: flex-end;margin-top: 20px;@@ -11621,9 +11705,33 @@ body.is-conversation-info-resizing * { cursor: col-resize !important; }.memory-modal-foot .btn {min-width: 76px;min-height: 36px;+ max-width: 100%;padding: 0 16px;font-size: 13px;line-height: 34px;+ /* A label longer than the dialog (a branch or file name) breaks instead of+ spilling out of its button. */+ overflow-wrap: anywhere;+}++/* Choice list for a question dialog. Same visual contract as the native+ question card in the composer dock (`.chat-input-form .form-field-checkgroup`):+ options wrap, each one is as wide as its own label, and they stay separate+ from cancel/confirm on the action row. */+.ui-dialog-choices {+ display: flex;+ flex-wrap: wrap;+ gap: 6px 10px;+ margin-top: 14px;+}+.ui-dialog-choices .btn {+ max-width: 100%;+ min-height: 32px;+ padding: 6px 12px;+ font-size: 13px;+ line-height: 1.45;+ text-align: left;+ overflow-wrap: anywhere;}.modal-actions .ui-choice-leading {@@ -11705,12 +11813,31 @@ body.is-conversation-info-resizing * { cursor: col-resize !important; }max-height: min(34vh, 260px);overflow: auto;}+.bash-permission-details {+ margin-top: 12px;+ white-space: normal;+}+.bash-permission-details summary {+ display: flex;+ align-items: center;+ gap: 4px;+ list-style: none;+ cursor: pointer;+ color: var(--text-2);+}+.bash-permission-details summary::-webkit-details-marker { display: none; }+.bash-permission-details:not([open]) .sidebar-section-chevron { transform: rotate(-90deg); }+.bash-permission-details pre {+ font-size: 12px;+ white-space: pre-wrap;+ overflow-wrap: anywhere;+}.bash-permission-footer {margin-top: 20px;}.bash-permission-actions {align-items: center;- flex-wrap: nowrap;+ flex-wrap: wrap;gap: 10px;margin-top: 0;}@@ -16669,6 +16796,10 @@ body.is-conversation-info-resizing * { cursor: col-resize !important; }margin-right: 4px;vertical-align: middle;}+.connector-card-unverified[data-role="permission-notice"] {+ white-space: normal;+ overflow-wrap: anywhere;+}.connector-card-desc {font-size: 12px;line-height: 1.5;diff --git a/test/e2e/automation_e2e_crud.spec.ts b/test/e2e/automation_e2e_crud.spec.tsindex 3884f99d..842605ca 100644--- a/test/e2e/automation_e2e_crud.spec.ts+++ b/test/e2e/automation_e2e_crud.spec.ts@@ -517,6 +517,9 @@ test.describe('automation', () => {});test('supports project-bound hourly, weekly, monthly, and one-time schedules with optional ends', async ({ orkas }) => {+ // This journey validates four schedules and persists project/global changes across several relaunches.+ // Budget the whole journey separately; individual UI and operation deadlines stay unchanged.+ test.setTimeout(120_000);if (!orkas.page) throw new Error('Orkas renderer is unavailable');const createdProject = await orkas.invoke<{ project: { project_id: string; name: string } }>('projects.create', {name: 'E2E Scheduled Project',diff --git a/test/e2e/chat_e2e_model_stream.spec.ts b/test/e2e/chat_e2e_model_stream.spec.tsindex 91efc20c..2965a851 100644--- a/test/e2e/chat_e2e_model_stream.spec.ts+++ b/test/e2e/chat_e2e_model_stream.spec.ts@@ -904,8 +904,10 @@ test.describe('real chat pipeline with a local model', () => {);const page = await sendNewChat(modelOrkas, 'E2E create a temporary file, then clean up that same task output.');- await expect.poll(() => existsSync(generatedPath), { timeout: 20_000 }).toBe(true);- expect(readFileSync(generatedPath, 'utf8')).toBe(generatedContent);+ // Creation is visible before the asynchronous write completes. Wait for+ // the exact content, not merely an opened (still empty) output file.+ await expect.poll(() => existsSync(generatedPath) ? readFileSync(generatedPath, 'utf8') : null,+ { timeout: 20_000 }).toBe(generatedContent);await expect(page.locator('#chat-history .chat-message.assistant [data-role="final"]', {hasText: 'E2E same-task cleanup completed without approval.',diff --git a/test/e2e/connectors_e2e_validation.spec.ts b/test/e2e/connectors_e2e_validation.spec.tsindex 60dc7e7d..8f49abdb 100644--- a/test/e2e/connectors_e2e_validation.spec.ts+++ b/test/e2e/connectors_e2e_validation.spec.ts@@ -255,7 +255,10 @@ test.describe('connectors', () => {await expect(custom).toHaveCount(0);});- test('connects to a real local MCP server, approves once, changes operation trust, toggles it, and disconnects', async ({ modelOrkas }, testInfo) => {+ test('connects to a real local MCP server, approves a task, changes operation trust, toggles it, and disconnects', async ({ modelOrkas }, testInfo) => {+ // This journey includes multiple model/tool rounds, permission changes and disconnect.+ // Budget the whole journey separately; individual UI and operation deadlines stay unchanged.+ test.setTimeout(120_000);if (!modelOrkas.page) throw new Error('Orkas renderer is unavailable');const page = modelOrkas.page;expect(await modelOrkas.invoke('permissions.setLocalExecMode', { mode: 'all_files_approval' }))@@ -349,20 +352,45 @@ rl.on('line', (line) => {await startConnectorChat();modelOrkas.setConnectorToolScenario(instance.id);+ await page.evaluate(() => (window as any).setLang('zh'));await page.locator('#new-chat-input').type('Call the deterministic echo connector.');await page.locator('#new-chat-send-btn').click();// Custom tool claims do not grant read-only trust. Complete the account's// normal approval flow and prove that the local peer sees no early call.- const actionConfirmation = page.getByRole('dialog', { name: 'Allow this sensitive action?' });+ const actionConfirmation = page.locator('.bash-permission-dialog');await expect(actionConfirmation).toBeVisible();- await expect(actionConfirmation).toContainText('e2e_echo');- await expect(actionConfirmation).toContainText('roundtrip');+ await expect(actionConfirmation.locator('.bash-permission-message')).toHaveText('连接器: E2E Local MCP 操作: e2e_echo 查看详情', { useInnerText: true });+ const details = actionConfirmation.locator('.bash-permission-details');+ await expect(details.locator('pre')).toBeHidden();+ await actionConfirmation.screenshot({ path: testInfo.outputPath('connector-approval-collapsed.png') });+ const viewport = page.viewportSize();+ await page.setViewportSize({ width: 560, height: 760 });+ expect(await actionConfirmation.evaluate((dialog) => {+ const bounds = dialog.getBoundingClientRect();+ return [...dialog.querySelectorAll('.bash-permission-actions button')].every((button) => {+ const rect = button.getBoundingClientRect();+ return rect.left >= bounds.left && rect.right <= bounds.right;+ });+ })).toBe(true);+ await actionConfirmation.screenshot({ path: testInfo.outputPath('connector-approval-narrow.png') });+ if (viewport) await page.setViewportSize(viewport);+ await details.locator('summary').click();+ await expect(details.locator('pre')).toBeVisible();+ expect(JSON.parse(await details.locator('pre').innerText())).toEqual({ text: 'roundtrip' });+ const expandedText = await details.locator('pre').textContent();+ await details.locator('summary').click();+ await expect(details.locator('pre')).toBeHidden();+ await details.locator('summary').click();+ await expect(details.locator('pre')).toBeVisible();+ expect(await details.locator('pre').textContent()).toBe(expandedText);+ await actionConfirmation.screenshot({ path: testInfo.outputPath('connector-approval-expanded.png') });+ // Inspecting the details never approves or sends the operation.expect(JSON.parse(readFileSync(callStatePath, 'utf8'))).toEqual([]);- await expect(actionConfirmation.getByRole('button', { name: "Don't run", exact: true })).toBeVisible();- // Like other external mutations, this grant covers one exact operation.- await expect(actionConfirmation.locator('[data-id="allow_run"]')).toHaveCount(0);- await actionConfirmation.getByRole('button', { name: 'Allow once', exact: true }).click();+ await expect(actionConfirmation.locator('[data-act="cancel"]')).toBeVisible();+ await expect(actionConfirmation.locator('[data-id="allow_run"]')).toBeVisible();+ await actionConfirmation.locator('[data-id="allow_run"]').click();await expect(actionConfirmation).toHaveCount(0);+ await page.evaluate(() => (window as any).setLang('en'));await expect(page.locator('#chat-history .chat-message.assistant [data-role="final"]', {hasText: 'E2E connector tool round trip completed.',})).toBeVisible({ timeout: 20_000 });@@ -372,8 +400,8 @@ rl.on('line', (line) => {name: 'e2e_echo',arguments: { text: 'roundtrip' },}]);- // Allow once leaves the account in approval mode. A later action offers the- // same local permission menu and persists Trusted only on approval.+ // Task approval leaves global permissions unchanged and expires at task+ // completion. A new task must ask again before switching to Trusted.expect(await modelOrkas.invoke('permissions.getLocalExec')).toMatchObject({ mode: 'all_files_approval' });await startConnectorChat();modelOrkas.setConnectorToolScenario(instance.id);diff --git a/test/e2e/dialogs_e2e_behavior.spec.ts b/test/e2e/dialogs_e2e_behavior.spec.tsindex 09737b8a..de3f778e 100644--- a/test/e2e/dialogs_e2e_behavior.spec.ts+++ b/test/e2e/dialogs_e2e_behavior.spec.ts@@ -138,6 +138,131 @@ test.describe('shared dialog behavior', () => {expect(await appPage.evaluate(() => (window as any).__nativeQuestionAnswer)).toEqual(['unit', 'integration']);});+ test('docks a blocking CLI question as the shared question card and answers it there', async ({ orkas: app }) => {+ // A CLI that pauses its turn for an answer (Codex requestUserInput, Claude+ // Code AskUserQuestion) uses the same card as an asynchronous question+ // instead of a modal: same place, same controls, and the app stays usable.+ const appPage = app.page!;+ const created = await app.invoke<{ conversation: { conversation_id: string } }>('conversations.create', { title: 'Blocking question' });+ const cid = created.conversation.conversation_id;+ await appPage.evaluate((cid) => (window as any).setView('conversation', cid, { skipLoad: true }), cid);+ await appPage.evaluate((cid) => {+ const root = window as any;+ root.__e2eBlockingAnswer = null;+ root.CliAsyncInput.showConversation(cid);+ root.__e2eBlockingClose = root.CliAsyncInput.showCliInputRequest({+ requestId: 'blocking-1',+ cid,+ actorLabel: 'Orkas Codex',+ questions: [{+ id: 'target',+ header: 'Push target',+ question: 'Which remote branch should this commit go to?',+ options: [+ { label: 'Create origin/release_2.0.0', description: 'A new release branch appears on the remote.' },+ { label: 'Advance origin/release_1.7.0' },+ { label: 'Hold the commit on this machine' },+ ],+ }],+ submit: async (values: string[]) => { root.__e2eBlockingAnswer = values; return true; },+ cancel: async () => { root.__e2eBlockingAnswer = 'cancelled'; },+ });+ }, cid);++ const card = appPage.locator('#chat-cli-questions .cli-question-panel');+ await expect(card).toBeVisible();+ await expect(card.locator('.form-title')).toHaveText('Orkas Codex · Question');+ await expect(card.locator('.form-field-label'))+ .toHaveText('Push target · Which remote branch should this commit go to?');+ const answer = card.getByRole('textbox', { name: 'Which remote branch should this commit go to?' });+ await expect(answer).toHaveValue('');+ const send = card.getByRole('button', { name: 'Send answer', exact: true });+ await expect(send).toBeDisabled();++ const layout = await card.evaluate((node: Element) => {+ const options = Array.from(node.querySelectorAll('.form-field-checkgroup .btn')) as HTMLElement[];+ const box = (element: HTMLElement) => element.getBoundingClientRect();+ return {+ count: options.length,+ clipped: options.filter((option) => option.scrollWidth > Math.ceil(box(option).width)).map((o) => o.textContent),+ tallest: Math.max(...options.map((option) => Math.round(box(option).height))),+ insideCard: options.every((option) => box(option).right <= Math.ceil(box(node as HTMLElement).right)),+ widerThanTheirLabel: options.every((option) => box(option).width >= option.scrollWidth),+ };+ });+ expect(layout.count).toBe(3);+ // Every option reads in full inside the card, one line each.+ expect(layout.clipped).toEqual([]);+ expect(layout.widerThanTheirLabel).toBe(true);+ expect(layout.insideCard).toBe(true);+ expect(layout.tallest).toBeLessThan(56);++ await card.getByRole('button', { name: 'Create origin/release_2.0.0', exact: true }).click();+ await expect(answer).toHaveValue('Create origin/release_2.0.0');+ await expect(send).toBeEnabled();+ await send.click();++ await expect.poll(() => appPage.evaluate(() => (window as any).__e2eBlockingAnswer))+ .toEqual(['Create origin/release_2.0.0']);+ await expect(card).toHaveCount(0);+ });++ test('lays a native question out as a wrapping option group instead of squeezing the action row', async ({+ appPage,+ }) => {+ // Reported 2026-09-09: a Claude Code AskUserQuestion with prose options+ // rendered as five narrow columns of wrapped text, with the branch names+ // clipped. Real layout is the only oracle for that, so measure it.+ await appPage.evaluate(() => {+ (window as any).__e2eQuestion = (window as any).uiChoice({+ title: 'Needs your input',+ message: 'Push target\nWhich remote branch should this commit go to?',+ choiceLayout: 'group',+ choices: [+ { id: 'option-0', label: 'Create origin/release_2.0.0' },+ { id: 'option-1', label: 'Advance origin/release_1.7.0' },+ { id: 'option-2', label: 'Hold the commit on this machine' },+ { id: 'other', label: 'Other' },+ ],+ });+ });+ const dialog = appPage.getByRole('dialog', { name: 'Needs your input' });+ await expect(dialog).toBeVisible();++ const layout = await dialog.evaluate((node: Element) => {+ const group = node.querySelector('.ui-dialog-choices');+ const options = Array.from(node.querySelectorAll('[data-act="choice"]')) as HTMLElement[];+ const box = (element: HTMLElement) => element.getBoundingClientRect();+ return {+ grouped: !!group && options.every((option) => group.contains(option)),+ actionRow: Array.from(node.querySelectorAll('.modal-actions button'))+ .map((button) => (button as HTMLElement).dataset.act),+ clipped: options+ .filter((option) => option.scrollWidth > Math.ceil(box(option).width))+ .map((option) => option.textContent),+ widerThanTheirLabel: options.every((option) => box(option).width >= option.scrollWidth),+ tallest: Math.max(...options.map((option) => Math.round(box(option).height))),+ rows: new Set(options.map((option) => Math.round(box(option).top))).size,+ insideDialog: options.every((option) => box(option).right <= Math.ceil(box(node as HTMLElement).right)),+ };+ });++ expect(layout.grouped).toBe(true);+ expect(layout.actionRow).toEqual(['cancel']);+ // Every label reads in full: nothing is cut off at the button edge.+ expect(layout.clipped).toEqual([]);+ expect(layout.widerThanTheirLabel).toBe(true);+ expect(layout.insideDialog).toBe(true);+ // Options keep one line each and wrap onto a second row instead of+ // collapsing into columns (the reported failure was ~138px tall buttons).+ expect(layout.tallest).toBeLessThan(56);+ expect(layout.rows).toBeGreaterThan(1);++ await dialog.locator('[data-act="cancel"]').click();+ await expect(dialog).toHaveCount(0);+ await expect.poll(() => appPage.evaluate(() => (window as any).__e2eQuestion)).toBeNull();+ });+test('preserves keyboard intent, accessible names, focus, and stacked decisions', async ({appPage,}) => {diff --git a/test/e2e/task_board_e2e_scheduling.spec.ts b/test/e2e/task_board_e2e_scheduling.spec.tsindex 4a2058ea..b3339d6d 100644--- a/test/e2e/task_board_e2e_scheduling.spec.ts+++ b/test/e2e/task_board_e2e_scheduling.spec.ts@@ -113,7 +113,7 @@ test.describe('task board scheduling (D18 serial chain)', () => {});- test('keeps ordinary admission hidden and surfaces a later queued send', async ({ modelOrkas, boardPage }) => {+ test('keeps ordinary admission hidden despite delayed prior-turn events and surfaces a real queue', async ({ modelOrkas, boardPage }) => {const app = modelOrkas;const page = boardPage;const board = page.locator('#chat-task-board');@@ -136,19 +136,67 @@ test.describe('task board scheduling (D18 serial chain)', () => {probe.observer.observe(board, { attributes: true, attributeFilter: ['style', 'class'] });inspect();(window as any).__orkasTaskBoardFlashProbe = probe;+ const taskBoard = (window as any).TaskBoard;+ const original = taskBoard.onEvent;+ const captured: Array<{ cid: string; event: any }> = [];+ taskBoard.onEvent = (cid: string, event: any) => {+ if (event.task?.status === 'running') captured.push({ cid, event: JSON.parse(JSON.stringify(event)) });+ return original(cid, event);+ };+ (window as any).__orkasTaskBoardEventProbe = { original, captured };});await input.fill('@ContentWriter start a later long draft.');await input.dispatchEvent('input');await page.locator('#chat-send-btn').click();await expect.poll(() => app.modelRequests.length, { timeout: 15_000 }).toBe(afterFirstBatch + 1);- const ordinarySendFlashedBoard = await page.evaluate(async () => {+ app.setModelMode('success');+ app.releaseControlledModelChunk();+ app.finishControlledModelStream();+ await expect(page.locator('#chat-send-btn')).not.toHaveClass(/\bstreaming\b/, { timeout: 20_000 });+ const priorCid = await page.locator('#conversation-list .conv-item').first().getAttribute('data-cid');+ const priorTaskId = await page.evaluate(() => (+ (window as any).__orkasTaskBoardEventProbe.captured[0]?.event.task.task_id+ ));+ expect(priorTaskId).toBeTruthy();+ await expect.poll(async () => {+ const data = await app.invoke<{ tasks: Array<{ task_id: string; status: string }> }>('groupChat.tasks.list', { cid: priorCid });+ return data.tasks.find((task) => task.task_id === priorTaskId)?.status;+ }).toBe('done');+ // Replay the actual running snapshot from a completed turn, as a slow+ // redundant observer can do after the primary stream or list has settled+ // it. The next ordinary send must not see a phantom concurrent task.+ await page.evaluate(() => {+ const probe = (window as any).__orkasTaskBoardEventProbe;+ const delayed = probe.captured[0];+ if (!delayed) throw new Error('missing captured running task event');+ // Deliver immediately before the new task event, after any reconnect+ // resync. Otherwise resync could repair the injected defect before the+ // assertion ever exercises the competing event streams.+ (window as any).TaskBoard.onEvent = (cid: string, event: any) => {+ if (cid === delayed.cid && event.type === 'task_created'+ && event.task?.task_id !== delayed.event.task.task_id) {+ (window as any).TaskBoard.onEvent = probe.original;+ probe.original(delayed.cid, delayed.event);+ probe.replayed = true;+ }+ return probe.original(cid, event);+ };+ });+ app.setModelMode('controlled-slow');+ await input.fill('@ContentWriter start the next independent draft.');+ await input.press('Enter');+ await expect.poll(() => app.modelRequests.length, { timeout: 15_000 }).toBe(afterFirstBatch + 2);+ const admissionProbe = await page.evaluate(async () => {await new Promise<void>((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));const probe = (window as any).__orkasTaskBoardFlashProbe;probe?.observer?.disconnect();delete (window as any).__orkasTaskBoardFlashProbe;- return probe?.becameVisible === true;+ const eventProbe = (window as any).__orkasTaskBoardEventProbe;+ (window as any).TaskBoard.onEvent = eventProbe.original;+ delete (window as any).__orkasTaskBoardEventProbe;+ return { flashed: probe?.becameVisible === true, replayed: eventProbe.replayed === true };});- expect(ordinarySendFlashedBoard).toBe(false);+ expect(admissionProbe).toEqual({ flashed: false, replayed: true });await expect(board).toBeHidden();await input.fill('@ContentWriter queue a later revision.');@@ -160,7 +208,7 @@ test.describe('task board scheduling (D18 serial chain)', () => {app.setModelMode('success');app.releaseControlledModelChunk();app.finishControlledModelStream();- await expect.poll(() => app.modelRequests.length, { timeout: 20_000 }).toBe(afterFirstBatch + 2);+ await expect.poll(() => app.modelRequests.length, { timeout: 20_000 }).toBe(afterFirstBatch + 3);await expect(page.locator('#chat-send-btn')).not.toHaveClass(/\bstreaming\b/, { timeout: 20_000 });await expect(board).toBeHidden({ timeout: 10_000 });});@@ -308,6 +356,10 @@ test.describe('task board scheduling (D18 serial chain)', () => {await expect.poll(() => app.modelRequests.length).toBe(before + 1);await send('@UIDesigner draft the layout.');await expect.poll(() => app.modelRequests.length).toBe(before + 2);+ // Two actual unfinished tasks still surface the execution controls even+ // without queued work; stale event protection must preserve this rule.+ await expect(page.locator('#chat-task-board')).toBeVisible();+ await expect(rows).toHaveCount(2);await send('@ContentWriter queued first revision.');await send('@UIDesigner queued layout revision.');await send('@ContentWriter queued second revision.');@@ -422,8 +474,19 @@ test.describe('task board scheduling (D18 serial chain)', () => {await page.mouse.move(0, 0);await page.locator('#chat-task-board').screenshot({ path: testInfo.outputPath('agent-groups-collapsed.png') });await secondToggle.focus();+ // A task event can replace the group between Space down and up. Keep+ // keyboard ownership and activate once even across that live repaint.+ await page.keyboard.down('Space');+ await page.evaluate((conversationId) => { (window as any).TaskBoard.render(conversationId); }, cid);+ await expect(secondToggle).toBeFocused();+ await page.keyboard.down('Space'); // Holding the key must not toggle twice.+ await page.keyboard.up('Space');+ await expect(groups.nth(1).locator('.chat-queue-agent-items')).toBeVisible();await secondToggle.press('Space');+ await expect(groups.nth(1).locator('.chat-queue-agent-items')).toBeHidden();+ await secondToggle.press('Enter');await expect(groups.nth(1).locator('.chat-queue-agent-items')).toBeVisible();+ await expect(groups.nth(0).locator('.chat-queue-agent-items')).toBeVisible();app.setModelMode('success');app.releaseControlledModelChunk();diff --git a/test/main/features/chats.test.ts b/test/main/features/chats.test.tsindex 3ebd303f..2f2cf0e7 100644--- a/test/main/features/chats.test.ts+++ b/test/main/features/chats.test.ts@@ -1518,6 +1518,30 @@ describe('chats › index repair', () => {});describe('chats › deleteConversation', () => {+ it('removes only the deleted task directory binding and preserves project files and other bindings', async () => {+ const chats = await loadChats();+ const removed = await chats.createConversation(TEST_UID);+ const retained = await chats.createConversation(TEST_UID);+ const state = await import('../../../src/main/features/group_chat/state');+ const paths = await import('../../../src/main/paths');+ const project = path.join(tmpDir, 'user-project');+ fs.mkdirSync(project);+ const source = path.join(project, 'main.ts');+ fs.writeFileSync(source, 'user project content');+ await state.setCodingProjectDir(TEST_UID, removed.conversation_id, project, { explicit: true });+ await state.setCodingProjectDir(TEST_UID, retained.conversation_id, project, { explicit: true });+ await state.setCodingProjectDir('other-account', removed.conversation_id, project, { explicit: true });+ expect(fs.existsSync(paths.localCliDirectoryFile(TEST_UID, removed.conversation_id))).toBe(true);++ expect(await chats.deleteConversation(TEST_UID, removed.conversation_id)).toBe(true);+ expect(fs.existsSync(paths.localCliDirectoryFile(TEST_UID, removed.conversation_id))).toBe(false);+ expect((await state.readState(TEST_UID, retained.conversation_id)).coding_project_dir).toBe(project);+ expect((await state.readState('other-account', removed.conversation_id)).coding_project_dir).toBe(project);+ expect(fs.readFileSync(source, 'utf8')).toBe('user project content');+ expect(await chats.deleteConversation(TEST_UID, removed.conversation_id)).toBe(true);+ expect(fs.existsSync(paths.localCliDirectoryFile(TEST_UID, removed.conversation_id))).toBe(false);+ });+it('exposes compact active ids for maintenance without tombstoned rows', async () => {const chats = await loadChats();const live = await chats.createConversation(TEST_UID);@@ -2149,11 +2173,15 @@ describe('chats › message display context memo', () => {fs.writeFileSync(path.join(root, 'report.txt'), root);}expect(workspace.setWorkspacePath(TEST_UID, oldRoot).ok).toBe(true);- const stateFile = path.join(tmpDir, TEST_UID, 'cloud', 'chats', cid, 'state.json');+ const paths = await import('../../../src/main/paths');+ const directory = await import('../../../src/main/features/local_agents/project-directory');+ if (change !== 'workspace selection') directory.writeCodingDirectory(TEST_UID, cid, oldRoot, true);+ const stateFile = change === 'workspace selection'+ ? paths.groupChatStateFile(TEST_UID, cid) : paths.localCliDirectoryFile(TEST_UID, cid);fs.mkdirSync(path.dirname(stateFile), { recursive: true });const state = {version: 1, status: 'idle', in_flight: [],- ...(change === 'workspace selection' ? {} : { coding_project_dir: oldRoot }),+ ...(change === 'workspace selection' ? {} : { directory: oldRoot, explicit: true }),};fs.writeFileSync(stateFile, JSON.stringify(state));const stamp = new Date('2026-07-10T09:00:00Z');@@ -2172,7 +2200,7 @@ describe('chats › message display context memo', () => {} else {await new Promise((resolve) => setTimeout(resolve, 20));const target = change === 'state replacement' ? `${stateFile}.replacement` : stateFile;- fs.writeFileSync(target, JSON.stringify({ ...state, coding_project_dir: newRoot }));+ fs.writeFileSync(target, JSON.stringify({ ...state, directory: newRoot }));fs.utimesSync(target, before.atime, before.mtime);if (target !== stateFile) fs.renameSync(target, stateFile);expect(fs.statSync(stateFile).size).toBe(before.size);@@ -2206,6 +2234,8 @@ describe('chats › message display context memo', () => {fs.writeFileSync(stateFile, JSON.stringify({version: 1, status: 'idle', in_flight: [], coding_project_dir: tmpDir,}));+ const directory = await import('../../../src/main/features/local_agents/project-directory');+ directory.writeCodingDirectory(TEST_UID, cid, tmpDir, true);// storage.ts binds `node:fs/promises` as an ESM namespace, so the patched// property has to be re-synced into that namespace.const { syncBuiltinESMExports } = await import('node:module');diff --git a/test/main/features/connectors/action-confirm.test.ts b/test/main/features/connectors/action-confirm.test.tsindex 6577b7be..f2ba9fdd 100644--- a/test/main/features/connectors/action-confirm.test.ts+++ b/test/main/features/connectors/action-confirm.test.ts@@ -15,6 +15,133 @@ afterEach(() => {describe('connectors/action_confirm', () => {+ it.each([+ ['feishu', 'execute_high_impact', { action: 'im.+messages-send' }, 'im.+messages-send'],+ ['dingtalk', 'execute_high_impact', { action: 'chat send' }, 'chat send'],+ ['xero', 'execute_destructive', { action: 'invoices.delete' }, 'invoices.delete'],+ ['shopify-admin', 'execute_high_impact', { action: 'orders.cancel' }, 'orders.cancel'],+ ['gmail', 'GMAIL_SEND_EMAIL', { action: 'unrelated parameter' }, 'GMAIL_SEND_EMAIL'],+ ['custom-example', 'execute_high_impact', { action: 'unrelated parameter' }, 'execute_high_impact'],+ ['unknown-provider', 'execute_high_impact', { action: 'unrelated parameter' }, 'execute_high_impact'],+ ['feishu', 'describe_action', { action: 'im.+messages-send' }, 'describe_action'],+ ['feishu', 'execute_high_impact', {}, 'execute_high_impact'],+ ['feishu', 'execute_high_impact', { action: null }, 'execute_high_impact'],+ ['feishu', 'execute_high_impact', { action: ['im.+messages-send'] }, 'execute_high_impact'],+ ['feishu', 'execute_high_impact', { actions: ['im.+messages-send'] }, 'execute_high_impact'],+ ['feishu', 'execute_high_impact', { action: { name: 'im.+messages-send' } }, 'execute_high_impact'],+ ['feishu', 'execute_high_impact', { action: ' ' }, 'execute_high_impact'],+ ])('shows the actual operation identifier for %s / %s without interpreting arbitrary parameters', async (connectorId, toolName, args, expected) => {+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ let info: any;+ confirm._setBroadcastForTest((_channel, payload) => { info = payload; });+ const pending = confirm.requestActionConfirm({+ connectorId, toolName, args, displayName: connectorId, risk: 'H',+ });+ expect(info.action_name).toBe(expected);+ expect(info.tool_name).toBe(toolName);+ confirm.respond(info.request_id, false);+ await expect(pending).resolves.toBe(false);+ });++ it('preserves the operation when large parameters truncate the details, without mutating execution arguments', async () => {+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ const args = {+ parameters: { user_id: 'recipient-1', attachments: [{ api_key: 'private-key', name: 'report' }] },+ ...Object.fromEntries(Array.from({ length: 30 }, (_, i) => [`field_${i}`, 'x'.repeat(700)])),+ action: 'im.+messages-send',+ };+ const original = JSON.stringify(args);+ let info: any;+ confirm._setBroadcastForTest((_channel, payload) => { info = payload; });+ const pending = confirm.requestActionConfirm({+ connectorId: 'feishu', displayName: 'Feishu', toolName: 'execute_high_impact', risk: 'H', args,+ });+ try {+ expect(info.action_name).toBe('im.+messages-send');+ expect(info.arguments_preview).not.toContain('im.+messages-send');+ expect(info.arguments_preview).toContain('recipient-1');+ expect(info.arguments_preview).toContain('[redacted]');+ expect(info.arguments_preview).not.toContain('private-key');+ expect(info.arguments_preview.length).toBeLessThanOrEqual(8_002);+ expect(info.arguments_preview.endsWith('…')).toBe(true);+ expect(JSON.stringify(args)).toBe(original);+ } finally {+ confirm.respond(info.request_id, false);+ await expect(pending).resolves.toBe(false);+ }+ });++ it('grants all actions for one connector account in one task, including concurrent requests', async () => {+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ const pushes: Array<{ channel: string; payload: any }> = [];+ confirm._setBroadcastForTest((channel, payload) => { pushes.push({ channel, payload }); });+ const opts = {+ cid: 'task-grant', connectorId: 'feishu', displayName: 'Feishu', accountLabel: 'Account A',+ toolName: 'execute_high_impact', risk: 'H' as const, args: { action: 'send', recipient: 'A' },+ };+ const first = confirm.requestActionConfirm(opts);+ const queued = confirm.requestActionConfirm({ ...opts, toolName: 'execute_destructive', risk: 'D' });+ const [one, two] = pushes.map((push) => push.payload);+ expect(one.can_allow_run).toBe(true);+ expect(confirm.respond(one.request_id, true, 'task')).toBe(true);+ await expect(first).resolves.toBe(true);+ await expect(queued).resolves.toBe(true);+ expect(pushes.at(-1)).toMatchObject({ channel: 'connectors:action-confirm-cancelled',+ payload: { request_ids: [two.request_id], approved: true } });+ expect(confirm.respond(two.request_id, false)).toBe(false);+ const delivered = pushes.length;+ await expect(confirm.requestActionConfirm({ ...opts, toolName: 'delete', risk: 'D', args: { id: 'other' } })).resolves.toBe(true);+ expect(pushes).toHaveLength(delivered);+ const permissions = await import('../../../../src/main/features/permissions');+ expect(permissions.getLocalExecMode()).toBe('all_files_approval');++ for (const change of [{ cid: 'other-task' }, { connectorId: 'gmail' }, { accountLabel: 'Account B' }, { accountKey: 'replacement-connection' }]) {+ const isolated = confirm.requestActionConfirm({ ...opts, ...change });+ expect(pushes.at(-1)?.channel).toBe('connectors:action-confirm');+ confirm.respond(pushes.at(-1)!.payload.request_id, false);+ await expect(isolated).resolves.toBe(false);+ }+ confirm.cancelForCid(opts.cid);+ const nextTask = confirm.requestActionConfirm(opts);+ expect(pushes.at(-1)?.channel).toBe('connectors:action-confirm');+ confirm.respond(pushes.at(-1)!.payload.request_id, false);+ await expect(nextTask).resolves.toBe(false);+ });++ it('does not cache one-time approval or denial and rejects task grants without a task', async () => {+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ let info: any;+ confirm._setBroadcastForTest((_channel, payload) => { info = payload; });+ const opts = { connectorId: 'feishu', displayName: 'Feishu', toolName: 'send', risk: 'H' as const, args: {} };+ const noTask = confirm.requestActionConfirm(opts);+ expect(info.can_allow_run).toBe(false);+ expect(confirm.respond(info.request_id, true, 'task')).toBe(false);+ confirm.respond(info.request_id, false);+ await expect(noTask).resolves.toBe(false);+ for (const approved of [true, false, true]) {+ const pending = confirm.requestActionConfirm({ ...opts, cid: 'repeat-once' });+ expect(confirm.respond(info.request_id, approved)).toBe(true);+ await expect(pending).resolves.toBe(approved);+ expect(confirm.respond(info.request_id, true, 'task')).toBe(false);+ }+ });++ it('revokes task grants after account switching even when returning to the original account', async () => {+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ const users = await import('../../../../src/main/features/users');+ let info: any;+ confirm._setBroadcastForTest((_channel, payload) => { info = payload; });+ const opts = { cid: 'switch-grant', connectorId: 'feishu', displayName: 'Feishu', toolName: 'send', risk: 'H' as const, args: {} };+ const first = confirm.requestActionConfirm(opts);+ confirm.respond(info.request_id, true, 'task');+ await expect(first).resolves.toBe(true);+ users.activateUser('other-account');+ users.activateUser('action-confirm-user');+ const next = confirm.requestActionConfirm(opts);+ expect(confirm.respond(info.request_id, false)).toBe(true);+ await expect(next).resolves.toBe(false);+ });+it.each(['H', 'D'] as const)('executes an allowed %s action without a dialog in trusted mode', async (risk) => {const confirm = await import('../../../../src/main/features/connectors/action_confirm');const permissions = await import('../../../../src/main/features/permissions');diff --git a/test/main/features/connectors/fixtures/local-cli-file-contracts.json b/test/main/features/connectors/fixtures/local-cli-file-contracts.jsonnew file mode 100644index 00000000..4110dcdc--- /dev/null+++ b/test/main/features/connectors/fixtures/local-cli-file-contracts.json@@ -0,0 +1,427 @@+{+ "versions": {+ "lark": "1.0.93",+ "wecom": "1.2.0",+ "dingtalk": "1.0.61"+ },+ "contracts": {+ "lark-upload": {+ "name": "im files create",+ "description": "上传文件。Identity: supports `user` and `bot`; user identity requires `im:resource` scope on the UAT",+ "inputSchema": {+ "type": "object",+ "required": [+ "data",+ "file"+ ],+ "properties": {+ "data": {+ "type": "object",+ "carrier": "--data",+ "required": [+ "file_name",+ "file_type"+ ],+ "properties": {+ "duration": {+ "type": "integer",+ "description": "文件的时长(视频、音频),单位:毫秒。不传值时无法显示文件的具体时长",+ "example": 3000+ },+ "file_name": {+ "type": "string",+ "description": "带后缀的文件名",+ "example": "测试视频.mp4"+ },+ "file_type": {+ "type": "string",+ "description": "待上传的文件类型",+ "enum": [+ "opus",+ "mp4",+ "pdf",+ "doc",+ "xls",+ "ppt",+ "stream"+ ],+ "enumDescriptions": [+ "OPUS 音频文件。其他格式的音频文件,请转为 OPUS 格式后上传。可使用 ffmpeg 转换格式:`ffmpeg -i SourceFile.mp3 -acodec libopus -ac 1 -ar 16000 TargetFile.opus`",+ "MP4 格式视频文件",+ "PDF 格式文件",+ "DOC 格式文件",+ "XLS 格式文件",+ "PPT 格式文件",+ "stream 格式文件。若上传文件不属于以上枚举类型,可以使用 stream 格式"+ ],+ "example": "mp4"+ }+ }+ },+ "file": {+ "type": "object",+ "description": "Binary file uploads. Each property is a file field with format:binary; CLI maps each to --file <key>=<path>.",+ "carrier": "--file",+ "required": [+ "file"+ ],+ "properties": {+ "file": {+ "type": "string",+ "description": "文件内容,具体的传值方式可参考请求体示例。; 注意:文件大小不得超过 30 MB,且不允许上传空文件",+ "example": "二进制文件",+ "format": "binary"+ }+ }+ }+ }+ },+ "outputSchema": {+ "type": "object",+ "properties": {+ "file_key": {+ "type": "string",+ "description": "文件的 Key",+ "example": "file_456a92d6-c6ea-4de4-ac3f-7afcf44ac78g"+ }+ }+ },+ "_meta": {+ "envelope_version": "1.0",+ "scopes": [+ "im:resource:upload",+ "im:resource"+ ],+ "required_scopes": [],+ "access_tokens": [+ "bot",+ "user"+ ],+ "danger": true,+ "risk": "write",+ "doc_url": "https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/file/create"+ }+ },+ "lark-media-help": "Insert a local image or file at the end of a Lark document (4-step orchestration + auto-rollback)\n\nUsage:\n lark-cli docs +media-insert [flags]\n\nFlags:\n --align string alignment: left | center | right\n --as string identity type: user | bot\n --caption string image caption text\n --doc string document URL or document_id\n --dry-run print request without executing\n --file string local file path (files > 20MB use multipart upload automatically)\n --file-view string file block rendering: card (default) | preview | inline; only applies when --type=file. preview renders audio/video as an inline player\n --format string output format: json (default) | pretty | table | ndjson | csv (default \"json\")\n --from-clipboard read image from system clipboard instead of a local file (macOS/Windows built-in; Linux requires xclip, xsel or wl-paste)\n --height int image display height in pixels (only for --type=image); if --width is omitted it is auto-computed from the source image aspect ratio\n -h, --help help for +media-insert\n -q, --jq string jq expression to filter JSON output\n --json shorthand for --format json\n --type string type: image | file (default \"image\")\n --width int image display width in pixels (only for --type=image); if --height is omitted it is auto-computed from the source image aspect ratio\n\nRisk: write\n",+ "wecom-upload": {+ "method": "media.upload",+ "description": "上传媒体文件,返回 media_id",+ "request": {+ "$ref": "UploadFileReq"+ },+ "response": {+ "$ref": "UploadFileRsp"+ },+ "schemas": {+ "UploadFileReq": {+ "type": "object",+ "description": "表单字段 type/md5 由框架自动从 form-data 表单字段中填充",+ "properties": {+ "file_path": {+ "type": "string",+ "description": "上传文件的二进制数据,框架自动从 form-data 中提取",+ "x-wecom-octet-stream": true+ },+ "type": {+ "type": "string",+ "description": "媒体类型(image/voice/video/file),从 form-data 表单字段获取",+ "enum": [+ "image",+ "voice",+ "file",+ "video"+ ]+ }+ }+ },+ "UploadFileRsp": {+ "type": "object",+ "description": "上传响应(CLI-Wrap 模式下框架自动序列化到 OpenClawHttpCallRsp.result)",+ "properties": {+ "created_at": {+ "type": "string",+ "description": "创建时间,格式 YYYY-MM-DD HH:MM:SS"+ },+ "media_id": {+ "type": "string",+ "description": "上传后的 media_id"+ },+ "type": {+ "type": "string",+ "description": "媒体类型(image/voice/video/file)",+ "enum": [+ "image",+ "voice",+ "file",+ "video"+ ]+ }+ }+ }+ }+ },+ "wecom-send": {+ "method": "message.aibot.send",+ "description": "以智能机器人身份向指定单聊/群聊会话发送消息,支持 markdown/图片/文件/语音/视频",+ "request": {+ "$ref": "SendAibotMessageReq"+ },+ "response": {+ "$ref": "SendAibotMessageRsp"+ },+ "schemas": {+ "SendAibotMessageReq": {+ "type": "object",+ "properties": {+ "chat_id": {+ "type": "string",+ "description": "会话 ID:单聊传接收成员的 userid,群聊传群会话 ID,由框架解密为 {id, type}"+ },+ "file": {+ "type": "object",+ "$ref": "AibotFileContent",+ "description": "文件消息内容,msg_type=file 时必填;不传则请求失败"+ },+ "image": {+ "type": "object",+ "$ref": "AibotImageContent",+ "description": "图片消息内容,msg_type=image 时必填;不传则请求失败"+ },+ "markdown": {+ "type": "object",+ "$ref": "AibotMarkdownContent",+ "description": "markdown 消息内容,msg_type=markdown 时必填;不传则请求失败"+ },+ "msg_type": {+ "type": "string",+ "description": "消息类型:markdown(markdown 文本)、image(图片)、file(文件)、voice(语音)、video(视频)",+ "enum": [+ "markdown",+ "image",+ "file",+ "voice",+ "video"+ ]+ },+ "video": {+ "type": "object",+ "$ref": "AibotVideoContent",+ "description": "视频消息内容,msg_type=video 时必填;不传则请求失败"+ },+ "voice": {+ "type": "object",+ "$ref": "AibotVoiceContent",+ "description": "语音消息内容,msg_type=voice 时必填;不传则请求失败"+ }+ },+ "required": [+ "chat_id",+ "msg_type"+ ]+ },+ "AibotFileContent": {+ "type": "object",+ "description": "机器人文件消息内容",+ "properties": {+ "media_id": {+ "type": "string",+ "description": "文件 media_id,由 file_upload 接口以 type=file 上传获得;文件名取上传时的原始文件名"+ }+ },+ "required": [+ "media_id"+ ]+ },+ "AibotImageContent": {+ "type": "object",+ "description": "机器人图片消息内容",+ "properties": {+ "media_id": {+ "type": "string",+ "description": "图片 media_id,由 file_upload 接口以 type=image 上传获得"+ }+ },+ "required": [+ "media_id"+ ]+ },+ "AibotVideoContent": {+ "type": "object",+ "description": "机器人视频消息内容",+ "properties": {+ "description": {+ "type": "string",+ "description": "视频描述;不传则不展示描述",+ "maxLength": 512+ },+ "media_id": {+ "type": "string",+ "description": "视频 media_id,由 file_upload 接口以 type=video 上传获得"+ },+ "title": {+ "type": "string",+ "description": "视频标题;不传则使用上传时的原始文件名",+ "maxLength": 128+ }+ },+ "required": [+ "media_id"+ ]+ },+ "AibotVoiceContent": {+ "type": "object",+ "description": "机器人语音消息内容",+ "properties": {+ "media_id": {+ "type": "string",+ "description": "语音 media_id,由 file_upload 接口以 type=voice 上传获得,仅支持 AMR 格式"+ }+ },+ "required": [+ "media_id"+ ]+ },+ "SendAibotMessageRsp": {+ "type": "object",+ "description": "发送结果由框架外壳的 errcode / errmsg 表达,但需要额外返回一个结果",+ "properties": {+ "success": {+ "type": "boolean",+ "description": "是否成功"+ }+ }+ },+ "AibotMarkdownContent": {+ "type": "object",+ "description": "机器人 markdown 消息内容",+ "properties": {+ "content": {+ "type": "string",+ "description": "markdown 正文,最长 20480 字节",+ "minLength": 1,+ "maxLength": 20480+ }+ },+ "required": [+ "content"+ ]+ }+ }+ },+ "dingtalk-chart": {+ "agent_summary": "创建浮动图表。",+ "availability": "available",+ "avoid_when": [+ "更新已有图表用 chart update;删除用 chart delete;AI 表格图表走 aitable"+ ],+ "canonical_path": "sheet.chart_create",+ "cli_path": "sheet chart create",+ "confirmation": "not_required",+ "description": "在钉钉电子表格的指定工作表中创建一个浮动图表。\n\n--properties 为 JSON 格式,包含 position(锚点位置)、dimensions(尺寸)、chart(图表配置)三个必填字段,\n以及可选的 offset(偏移量)。支持 stdin heredoc 和 @file 两种传入方式。\n\nchart.type 支持: column(柱形图)、bar(条形图)、columnStacked(堆积柱形图)、barStacked(堆积条形图)、\nline(折线图)、lineStacked(堆积折线图)、area(面积图)、areaStacked(堆积面积图)、\nareaPercentStacked(百分比堆积面积图)、pie(饼图)、doughnut(环形图)、scatter(散点图)、\nradar(雷达图)。\nchart.series[].value / chart.series[].name / chart.category 使用 A1 区域表示法(如 \"A2:B10\"),\n不指定 sheet 前缀时默认使用 --sheet-id 的值。\nposition.col 使用列字母表示法(如 \"A\"、\"AA\"),不支持数字形式。\n\n创建成功后返回新图表的完整信息,包含系统分配的 chart-id。",+ "effect": "write",+ "examples": [+ "dws sheet chart create --node NODE_ID --sheet-id SHEET_ID --properties '{\"chartType\":\"bar\",\"range\":\"A1:B10\"}'"+ ],+ "idempotency": "unknown",+ "interface_mode": "composite",+ "interface_reason": "Reviewed unpinned remote adapter: this executable CLI wrapper calls a remote helper that is absent from the pinned MCP metadata snapshot; no single pinned semantically equivalent interface_ref can represent the command.",+ "parameters": {+ "node": {+ "description": "表格文档 ID 或 URL (必填)",+ "required": true,+ "type": "string"+ },+ "properties": {+ "description": "图表完整配置 JSON (必填,含 position/dimensions/chart)",+ "example": "{\"position\":{\"row\":0,\"col\":\"A\"},\"dimensions\":{\"width\":600,\"height\":400},\"chart\":{\"type\":\"column\",\"series\":[{\"value\":[\"B2:B10\"]}],\"category\":[\"A2:A10\"]}}",+ "format": "json",+ "required": true,+ "type": "string"+ },+ "sheet-id": {+ "description": "工作表 ID (必填)",+ "required": true,+ "type": "string"+ }+ },+ "risk": "medium",+ "use_when": [+ "需要在电子表格工作表上新建柱状/折线等浮动图表时"+ ]+ },+ "dingtalk-upload": {+ "agent_summary": "上传本地文件到钉盘或文档空间,或按节点 ID 确认覆盖已有文件",+ "availability": "available",+ "avoid_when": [+ "常规场景不要拆成 upload-info + 手动 PUT + commit;仅自定义流式上传才用三步",+ "要把文件作为文档正文附件插入改用 dws doc media insert",+ "用户明确说文档空间且走 doc 兼容入口时可用 dws doc upload,默认仍推荐本命令",+ "用户没有明确同意替换目标文件时不要使用 --node;新建上传应使用 --folder 或目标根目录"+ ],+ "canonical_path": "drive.upload",+ "cli_path": "drive upload",+ "confirmation": "not_required",+ "description": "将本地文件上传(三步自动完成)。\n\n路由规则:\n 默认(无 --workspace) → 上传到钉盘(我的文件或指定空间)\n --workspace <id> → 上传到文档空间/知识库\n\n流程:\n 1. 获取 OSS 上传凭证\n 2. HTTP PUT 上传文件二进制到 OSS\n 3. 提交文件入库\n\n上传位置: --folder 指定父目录,不传则上传到空间根目录。",+ "dry_run": {+ "preview_kind": "plan"+ },+ "effect": "write",+ "examples": [+ "dws drive upload --file ./report.pdf --format json",+ "dws drive upload --file ./README.md --node <dentryUuid> --format json"+ ],+ "idempotency": "unknown",+ "interface_mode": "composite",+ "interface_reason": "命令包含多个 RPC、条件分派或本地 HTTP/文件步骤,不能绑定为单一 interface_ref",+ "parameters": {+ "convert": {+ "description": "是否转换为钉钉在线文档 (仅文档空间上传时生效)",+ "required": false,+ "type": "boolean"+ },+ "file": {+ "description": "本地文件路径 (必填)",+ "required": true,+ "type": "string"+ },+ "file-name": {+ "description": "文件显示名称 (默认使用文件名)",+ "required": false,+ "type": "string"+ },+ "folder": {+ "description": "父节点 ID,不传则上传到空间根目录 (可选,与 --node 互斥)",+ "required": false,+ "type": "string"+ },+ "mime-type": {+ "description": "文件 MIME 类型,不传则自动推断 (可选)",+ "required": false,+ "type": "string"+ },+ "node": {+ "description": "覆盖目标文件 ID,传入即覆盖已有文件(与 --folder 互斥)(可选)",+ "required": false,+ "type": "string"+ },+ "space-id": {+ "description": "目标钉盘空间 ID,不传则使用「我的文件」 (可选)",+ "required": false,+ "type": "string"+ },+ "workspace": {+ "description": "目标知识库 ID,传入时路由到文档空间上传 (可选)",+ "required": false,+ "type": "string"+ }+ },+ "risk": "medium",+ "use_when": [+ "用户要把本地文件上传到钉盘/我的文件(首选一条命令自动完成凭证+PUT+提交)时",+ "上传到知识库/文档空间时加 --workspace;需要转在线文档时加 --convert",+ "用户明确要求用本地文件替换已有钉盘/文档空间文件时传 --node;该模式会覆盖远端内容并要求确认"+ ]+ },+ "lark-array-help": "Upload one or more local files and append the returned file_token values to a Base attachment cell\n\nUsage:\n lark-cli base +record-upload-attachment [flags]\n\nFlags:\n --as string identity type: user | bot\n --base-token string base token\n --dry-run print request without executing\n --field-id string field ID or name\n --file stringArray local file path; repeat to append multiple attachments in one cell; max 50 files, max 2GB each; files > 20MB use multipart upload automatically\n --format string output format: json (default) | pretty | table | ndjson | csv (default \"json\")\n -h, --help help for +record-upload-attachment\n -q, --jq string jq expression to filter JSON output\n --json shorthand for --format json\n --record-id string record ID\n --table-id string table ID (must start with tbl if ID) or name\n\nRisk: write\n\nTips:\n • Example: lark-cli base +record-upload-attachment --base-token <base_token> --table-id <table_id> --record-id <record_id> --field-id <attachment_field_id> --file ./report.pdf\n • Repeat --file to append multiple attachments: --file ./report.pdf --file ./screenshot.png\n • Reuse returned file_token values for download/remove\n"+ }+}diff --git a/test/main/features/connectors/local-cli-files.test.ts b/test/main/features/connectors/local-cli-files.test.tsnew file mode 100644index 00000000..02776c91--- /dev/null+++ b/test/main/features/connectors/local-cli-files.test.ts@@ -0,0 +1,787 @@+import { createRequire } from 'node:module';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++const require = createRequire(import.meta.url);+const testNode = process.env.ORKAS_TEST_NODE || process.execPath;+const adapter = require('../../../../bin/local-cli-mcp-server.cjs');+const lark = require('../../../../bin/local-cli-lark.cjs');+const auth = require('../../../../bin/local-cli-auth.cjs');+const permissions = require('../../../../bin/local-cli-permissions.cjs');+const samples = require('./fixtures/lark-cli-1.0.93.json').samples;+const contracts = require('./fixtures/local-cli-file-contracts.json').contracts;+// Captured from the pinned official binary in an isolated, unauthenticated home.+const uploadSchema = contracts['lark-upload'];+let root: string;+let allowed: string;+let source: string;+let outside: string;+const bytes = Buffer.from('Handoff fixture\n\u0000$(literal) 宇涛');+beforeEach(() => {+ root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-cli-file-contract-'));+ allowed = path.join(root, 'approved');+ fs.mkdirSync(allowed);+ source = path.join(allowed, 'handoff 宇涛.md');+ outside = path.join(root, 'outside.json');+ fs.writeFileSync(source, bytes);+ fs.writeFileSync(outside, '{}');+});+afterEach(() => {+ vi.restoreAllMocks();+ fs.rmSync(root, { recursive: true, force: true });+});+function envFor(provider: string) {+ const manifest = adapter.MANIFESTS[provider];+ const runtime = path.join(root, provider);+ fs.mkdirSync(path.join(runtime, 'work'), { recursive: true });+ return {+ ORKAS_LOCAL_CLI_PROVIDER: provider,+ ORKAS_LOCAL_CLI_PACKAGE: manifest.package,+ ORKAS_LOCAL_CLI_PACKAGE_INTEGRITY: manifest.integrity,+ ORKAS_LOCAL_CLI_EXECUTABLE: manifest.executable,+ ORKAS_LOCAL_CLI_ALLOWED_DOMAINS_JSON: JSON.stringify(manifest.domains),+ ORKAS_LOCAL_CLI_RUNTIME_DIR: runtime,+ ORKAS_LOCAL_CLI_WORK_DIR: path.join(runtime, 'work'),+ ORKAS_LOCAL_CLI_PROFILE: 'file-contract',+ ORKAS_LOCAL_CLI_ALLOWED_FILE_ROOTS_JSON: JSON.stringify([allowed]),+ ORKAS_NODE: testNode,+ ORKAS_LOCAL_CLI_NPX_CLI: '/fixture/npx-cli.js',+ };+}+function ok(data: unknown) { return { status: 0, stdout: JSON.stringify(data), stderr: '' }; }+function runnerFor(execute: (args: string[], options: any) => unknown, provider = 'lark') {+ return vi.fn((_command: string, argv: string[], options: any) => {+ const args = argv.slice(4);+ if (args[0] === 'schema' || args.includes('--help') || args.includes('--schema')) {+ if (provider === 'wecom') return ok(contracts[args.includes('aibot') ? 'wecom-send' : 'wecom-upload']);+ if (provider === 'dingtalk') return ok(contracts[args.includes('sheet chart create') ? 'dingtalk-chart' : 'dingtalk-upload']);+ if (args.join(' ') === 'docs +media-insert --help') return { status: 0, stdout: contracts['lark-media-help'], stderr: '' };+ if (args.join(' ') === 'base +record-upload-attachment --help') return { status: 0, stdout: contracts['lark-array-help'], stderr: '' };+ if (args.join(' ') === 'schema im.files.create') return ok(uploadSchema);+ const sample = samples.find((entry: any) => entry.args.join(' ') === args.join(' '));+ if (!sample) throw new Error('Missing pinned CLI contract');+ return sample;+ }+ return execute(args, options);+ });+}+function stagedBytes(args: string[], options: any, flag: string, prefix = '') {+ const value = args[args.indexOf(flag) + 1];+ expect(value.startsWith(prefix)).toBe(true);+ const relative = value.slice(prefix.length);+ expect(path.isAbsolute(relative)).toBe(false);+ expect(relative.split(/[\\/]/)).not.toContain('..');+ expect(path.basename(relative)).toBe(path.basename(source));+ return fs.readFileSync(path.join(options.cwd, relative));+}++describe('local CLI attachment journeys and input boundaries', () => {+ it('uploads a declared file array with duplicate basenames without replacing either attachment', async () => {+ const other = path.join(allowed, 'other', path.basename(source));+ fs.mkdirSync(path.dirname(other));+ fs.writeFileSync(other, 'second attachment');+ const execute = vi.fn((args: string[], options: any) => {+ const files = args.flatMap((arg, i) => arg === '--file' ? [args[i + 1]] : []);+ expect(files).toHaveLength(2);+ expect(new Set(files).size).toBe(2);+ expect(files.map(file => path.basename(file))).toEqual([path.basename(source), path.basename(source)]);+ expect(files.map(file => fs.readFileSync(path.join(options.cwd, file))))+ .toEqual([bytes, Buffer.from('second attachment')]);+ return ok({ ok: true });+ });+ const env = envFor('lark');+ await adapter.executeAction('W', { action: 'base.+record-upload-attachment', parameters: {+ base_token: 'base-fixture', table_id: 'tblFixture', record_id: 'recFixture', field_id: 'fldFixture', file: [source, other],+ } }, { runner: runnerFor(execute) }, env);+ expect(execute).toHaveBeenCalledOnce();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it.each(['complete', 'cancel', 'deadline'])('keeps a transfer live only until its %s outcome and removes staging', async (outcome) => {+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval'] });+ const env = envFor('lark');+ const controller = new AbortController();+ const onProgress = vi.fn(async () => {});+ let finish: () => void = () => {};+ const execute = vi.fn(async (_args: string[], options: any) => {+ await new Promise<void>(resolve => {+ finish = resolve;+ options.signal.addEventListener('abort', () => resolve(), { once: true });+ });+ return ok({ ok: true });+ });+ const pending = adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', file: source,+ } }, { runner: runnerFor(execute), signal: controller.signal, onProgress }, env).catch((error: Error) => error);+ try {+ await vi.waitFor(() => expect(execute).toHaveBeenCalledOnce());+ const initial = onProgress.mock.calls.length;+ await vi.advanceTimersByTimeAsync(16_000);+ expect(onProgress.mock.calls.length).toBeGreaterThan(initial);+ if (outcome === 'complete') finish();+ else if (outcome === 'cancel') controller.abort();+ else await vi.advanceTimersByTimeAsync(600_000);+ const result = await pending;+ if (outcome === 'complete') expect(result).toMatchObject({ result: { ok: true } });+ else expect(result).toMatchObject({ code: outcome === 'cancel' ? 'E_TOOL_CALL_CANCELLED' : 'ETIMEDOUT' });+ expect(execute).toHaveBeenCalledOnce();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ const terminal = onProgress.mock.calls.length;+ await vi.advanceTimersByTimeAsync(30_000);+ expect(onProgress.mock.calls.length).toBe(terminal);+ } finally { finish(); await pending; vi.useRealTimers(); }+ });++ it('uses the declared file carrier across document operations and preserves caption text that looks like a path', async () => {+ const execute = vi.fn((args: string[], options: any) => {+ expect(stagedBytes(args, options, '--file')).toEqual(bytes);+ expect(args[args.indexOf('--caption') + 1]).toBe('/help');+ return ok({ ok: true });+ });+ await adapter.executeAction('W', { action: 'docs.+media-insert', parameters: {+ doc: 'doc-fixture', file: source, caption: '/help',+ } }, { runner: runnerFor(execute) }, envFor('lark'));+ expect(execute).toHaveBeenCalledOnce();+ });++ it.each(['ordinary', 'transfer'])('gives %s execution its own bounded deadline', async (kind) => {+ const execute = vi.fn((_args: string[], options: any) => {+ expect(options.timeout).toBe(kind === 'transfer' ? 600_000 : 60_000);+ return ok({ ok: true });+ });+ await adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', ...(kind === 'transfer' ? { file: source } : { text: 'hello' }),+ } }, { runner: runnerFor(execute) }, envFor('lark'));+ expect(execute).toHaveBeenCalledOnce();+ });+ it.each(['success', 'failure', 'cancel'])('sends the approved Lark attachment once and cleans staging on %s', async (outcome) => {+ const env = envFor('lark');+ const controller = new AbortController();+ let staging = '';+ const execute = vi.fn((args: string[], options: any) => {+ staging = options.cwd;+ expect(stagedBytes(args, options, '--file')).toEqual(bytes);+ const configRelative = path.relative(env.ORKAS_LOCAL_CLI_RUNTIME_DIR, fs.realpathSync(staging));+ expect(configRelative === '..' || configRelative.startsWith(`..${path.sep}`) || path.isAbsolute(configRelative)).toBe(true);+ if (process.platform !== 'win32') expect(fs.statSync(staging).mode & 0o777).toBe(0o700);+ expect(args.slice(args.indexOf('--as'), args.indexOf('--as') + 2)).toEqual(['--as', 'user']);+ expect(args).toContain('attachment-contract');+ if (outcome === 'cancel') controller.abort();+ return outcome === 'failure' ? { status: 2, stdout: '', stderr: 'private provider failure' }+ : ok({ ok: true, data: { message_id: 'message-fixture' } });+ });+ const pending = adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', file: source, as: 'user', idempotency_key: 'attachment-contract',+ } }, { runner: runnerFor(execute), signal: controller.signal }, env);+ if (outcome === 'success') await expect(pending).resolves.toMatchObject({ result: { ok: true } });+ else await expect(pending).rejects.toThrow(outcome === 'cancel' ? /cancelled/ : /command failed/);+ expect(execute).toHaveBeenCalledOnce();+ expect(staging).not.toBe(env.ORKAS_LOCAL_CLI_WORK_DIR);+ expect(fs.existsSync(staging)).toBe(false);+ expect(fs.readFileSync(source)).toEqual(bytes);+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it('uploads the native binary carrier, preserving file metadata and the provider key=value argv', async () => {+ const env = envFor('lark');+ const execute = vi.fn((args: string[], options: any) => {+ expect(stagedBytes(args, options, '--file', 'file=')).toEqual(bytes);+ const configRelative = path.relative(env.ORKAS_LOCAL_CLI_RUNTIME_DIR, fs.realpathSync(options.cwd));+ expect(configRelative === '..' || configRelative.startsWith(`..${path.sep}`) || path.isAbsolute(configRelative)).toBe(true);+ expect(JSON.parse(args[args.indexOf('--data') + 1])).toEqual({ file_type: 'stream', file_name: 'handoff 宇涛.md' });+ return ok({ ok: true, data: { file_key: 'file_fixture' } });+ });+ await adapter.executeAction('W', { action: 'im.files.create', parameters: {+ data: { file_type: 'stream', file_name: 'handoff 宇涛.md' }, file: { file: source },+ } }, { runner: runnerFor(execute) }, env);+ expect(execute).toHaveBeenCalledOnce();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it.each(['outside', 'symlink', 'missing', 'directory', 'wrong-risk', 'aborted', 'unknown-binary-field'])(+ 'prevents any upload or send with %s input and leaves no staging', async (failure) => {+ const env = envFor('lark');+ let input = source;+ if (failure === 'outside') input = outside;+ if (failure === 'symlink') { input = path.join(allowed, 'link.json'); fs.symlinkSync(outside, input); }+ if (failure === 'missing') input = path.join(allowed, 'missing');+ if (failure === 'directory') input = allowed;+ const controller = new AbortController();+ if (failure === 'aborted') controller.abort();+ const execute = vi.fn(() => ok({ ok: true }));+ const action = failure === 'unknown-binary-field' ? 'im.files.create' : 'im.+messages-send';+ const parameters = failure === 'unknown-binary-field' ? { file: { other: source } }+ : { user_id: 'ou_fixture', file: input };+ await expect(adapter.executeAction(failure === 'wrong-risk' ? 'R' : action === 'im.files.create' ? 'W' : 'H',+ { action, parameters }, { runner: runnerFor(execute), signal: controller.signal }, env)).rejects.toThrow();+ expect(execute).not.toHaveBeenCalled();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ },+ );++ it('rejects a source replaced between validation and opening without copying outside bytes', async () => {+ const env = envFor('lark');+ const open = fs.promises.open.bind(fs.promises);+ vi.spyOn(fs.promises, 'open').mockImplementation(async (file, ...args) => {+ if (file === fs.realpathSync(source)) {+ fs.unlinkSync(source);+ fs.symlinkSync(outside, source);+ }+ return open(file, ...args);+ });+ const execute = vi.fn(() => ok({ ok: true }));+ await expect(adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', file: source,+ } }, { runner: runnerFor(execute) }, env)).rejects.toThrow(/prepared/);+ expect(execute).not.toHaveBeenCalled();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it.each(['file_fixture', 'https://example.test/file.pdf'])('passes the remote Lark resource %s without local file access', async (file) => {+ const env = envFor('lark');+ const execute = vi.fn((args: string[]) => { expect(args).toContain(file); return ok({ ok: true }); });+ await adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', file,+ } }, { runner: runnerFor(execute) }, env);+ expect(execute).toHaveBeenCalledOnce();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it.each(['/help', '@alice hello', '@所有人 hello'])('preserves literal Lark message text %s', async (text) => {+ const execute = vi.fn((args: string[]) => { expect(args).toContain(text); return ok({ ok: true }); });+ await adapter.executeAction('H', { action: 'im.+messages-send', parameters: {+ user_id: 'ou_fixture', text,+ } }, { runner: runnerFor(execute) }, envFor('lark'));+ expect(execute).toHaveBeenCalledOnce();+ });++ it('sends a WeCom file media object without treating it as a path', async () => {+ const execute = vi.fn((args: string[]) => {+ expect(JSON.parse(args[args.indexOf('--json') + 1])).toEqual({ chat_id: 'chat-fixture', msg_type: 'file', file: { media_id: 'media-fixture' } });+ return ok({ ok: true });+ });+ await adapter.executeAction('H', { action: 'message.aibot.send', parameters: {+ chat_id: 'chat-fixture', msg_type: 'file', file: { media_id: 'media-fixture' },+ } }, { runner: runnerFor(execute, 'wecom') }, envFor('wecom'));+ expect(execute).toHaveBeenCalledOnce();+ });++ it.each(['wecom', 'dingtalk'])('preserves approved %s file uploads', async (provider) => {+ const execute = vi.fn((args: string[], options: any) => {+ const file = provider === 'wecom' ? JSON.parse(args[args.indexOf('--json') + 1]).file_path+ : args[args.indexOf('--file') + 1];+ expect(fs.readFileSync(path.join(options.cwd, file))).toEqual(bytes);+ return ok({ ok: true });+ });+ const env = envFor(provider);+ await adapter.executeAction('W', { action: provider === 'wecom' ? 'media.upload' : 'drive.upload',+ parameters: provider === 'wecom' ? { file_path: source } : { file: source },+ }, { runner: runnerFor(execute, provider) }, env);+ expect(execute).toHaveBeenCalledOnce();+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });++ it.each(['approved', 'outside', 'undeclared'])('controls DingTalk indirect input: %s', async (state) => {+ const execute = vi.fn((args: string[], options: any) => {+ expect(stagedBytes(args, options, '--properties', '@')).toEqual(bytes);+ return ok({ ok: true });+ });+ const env = envFor('dingtalk');+ const parameters = state === 'undeclared' ? { title: `@${outside}` }+ : { properties: `@${state === 'outside' ? outside : source}` };+ const pending = adapter.executeAction('W', { action: 'sheet.chart.create', parameters },+ { runner: runnerFor(execute, 'dingtalk') }, env);+ if (state === 'approved') { await pending; expect(execute).toHaveBeenCalledOnce(); }+ else { await expect(pending).rejects.toThrow(/outside|not declared/); expect(execute).not.toHaveBeenCalled(); }+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_WORK_DIR)).toEqual([]);+ });+});++describe('reauthorization across business domains and CLI providers', () => {+ it.each(['lark', 'dingtalk', 'wecom'])('rejects failed %s identity checks even when stdout contains a previously valid identity', provider => {+ const env = envFor(provider);+ const payload = provider === 'lark'+ ? { identities: { user: { available: true, verified: true, scope: 'im:message.send_as_user' } } }+ : provider === 'dingtalk' ? { success: true, authenticated: true } : { extra_identity_context: 'fixture-identity' };+ const verify = auth[`${provider}AuthorizationReady`];+ for (const status of [1, null]) {+ expect(verify('', '', auth.MANIFESTS[provider], env, () => ({ ...ok(payload), status }))).toBe(false);+ }+ expect(verify('', '', auth.MANIFESTS[provider], env, () => ok(payload))).toBe(true);+ });++ it.each(['missing', 'invalid', 'unverified', 'nonzero'])('retains prior recovery after a %s Lark scope report', variant => {+ const env = envFor('lark');+ permissions.rememberPermissionRequest({ provider_error: { type: 'authorization', identity: 'user',+ missing_scopes: ['im:message.send_as_user'] } }, env);+ const pending = permissions.readPermissionRequest(env);+ const user = { available: true, verified: variant !== 'unverified',+ scope: variant === 'missing' ? undefined : variant === 'invalid' ? ['im:message.send_as_user', '--unsafe'] : 'im:message.send_as_user' };+ expect(auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env,+ () => ({ ...ok({ identities: { user } }), status: variant === 'nonzero' ? 1 : 0 }))).toBe(false);+ expect(permissions.readPermissionRequest(env)).toEqual(pending);+ });++ it('does not clear a repeated same-scope denial with an older grant receipt or across profiles', () => {+ const env = envFor('dingtalk');+ const denied = { provider_error: { type: 'authorization', identity: 'pat', missing_scopes: ['chat.message:send'] } };+ permissions.rememberPermissionRequest(denied, env);+ const old = permissions.readPermissionRequest(env);+ permissions.rememberPermissionRequest(denied, env);+ const current = permissions.readPermissionRequest(env);+ expect(current.revision).not.toBe(old.revision);+ permissions.recordPatScopeGrant(env, old, ['chat.message:send']);+ expect(permissions.readPermissionRequest(env)).toEqual(current);+ const other = { ...env, ORKAS_LOCAL_CLI_PROFILE: 'different-account' };+ expect(permissions.readPermissionRequest(other)).toBeNull();+ permissions.clearPermissionRequest(other, current);+ expect(permissions.readPermissionRequest(env)).toEqual(current);+ expect(permissions.readPermissionRequest(envFor('wecom'))).toBeNull();+ });++ it('preserves the original provider error and pending record if persisting a newer denial fails', () => {+ const env = envFor('lark');+ permissions.rememberPermissionRequest({ code: 'connector_permission_denied' }, env);+ const pending = permissions.readPermissionRequest(env);+ const failure = Object.assign(new Error('original failure'), { code: 'connector_permission_denied' });+ const write = vi.spyOn(fs, 'writeFileSync').mockImplementation(() => { throw new Error('ENOSPC'); });+ expect(() => permissions.rememberPermissionRequest(failure, env)).not.toThrow();+ write.mockRestore();+ expect(failure.message).toBe('original failure');+ expect(permissions.readPermissionRequest(env)).toEqual(pending);+ expect(fs.readdirSync(env.ORKAS_LOCAL_CLI_RUNTIME_DIR).some(name => name.endsWith('.tmp'))).toBe(false);+ });++ it.each(['malformed', 'symlink', 'invalid-pat'])('ignores %s persisted recovery state without following external data', variant => {+ const env = envFor('dingtalk');+ const file = path.join(env.ORKAS_LOCAL_CLI_RUNTIME_DIR, '.orkas-user-permissions.json');+ const value = { profile: env.ORKAS_LOCAL_CLI_PROFILE, scopes: [], reauthorize: true,+ pat_scopes: variant === 'invalid-pat' ? ['--unsafe'] : ['chat.message:send'] };+ if (variant === 'symlink') {+ fs.writeFileSync(outside, JSON.stringify(value));+ fs.symlinkSync(outside, file);+ } else fs.writeFileSync(file, variant === 'malformed' ? '{' : JSON.stringify(value));+ expect(permissions.readPermissionRequest(env)).toBeNull();+ });++ it('discovers missing send permission without logging in, preserves other grants and removes the notice after a confirmed grant', () => {+ const env = envFor('lark');+ let grant = 'docx:document:readonly offline_access';+ const runner = vi.fn((_node, argv) => {+ expect(argv.slice(4)).toEqual(['auth', 'status', '--profile', 'file-contract', '--verify', '--json']);+ return ok({ identities: { user: { available: true, verified: true, scope: grant } } });+ });+ expect(auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, runner)).toBe(true);+ expect(permissions.readPermissionRequest(env)?.scopes).toEqual(['im:message.send_as_user']);+ const pending = permissions.readPermissionRequest(env);+ auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, runner);+ expect(permissions.readPermissionRequest(env)).toEqual(pending);+ grant += ' im:message.send_as_user';+ auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, runner);+ expect(permissions.readPermissionRequest(env)).toBeNull();+ });++ it('keeps permission evidence on unavailable checks, unknown scopes and concurrent business denials', () => {+ const env = envFor('lark');+ permissions.rememberPermissionRequest({ provider_error: { type: 'authorization', identity: 'user', missing_scopes: ['docx:document:readonly'] } }, env);+ const original = permissions.readPermissionRequest(env);+ for (const result of [{ error: new Error('network') }, ok({ identities: { user: { available: true, verified: true } } })]) {+ expect(auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, () => result)).toBe(false);+ expect(permissions.readPermissionRequest(env)).toEqual(original);+ }+ auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, () => {+ permissions.rememberPermissionRequest({ code: 'connector_permission_denied' }, env);+ return ok({ identities: { user: { available: true, verified: true, scope: 'docx:document:readonly im:message.send_as_user' } } });+ });+ expect(permissions.readPermissionRequest(env)).toMatchObject({ unresolved_access: true });+ auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, () => ok({ identities: { user: {+ available: true, verified: true, scope: 'docx:document:readonly im:message.send_as_user',+ } } }));+ expect(permissions.readPermissionRequest(env)).toMatchObject({ scopes: [], unresolved_access: true });+ });++ it.each([+ ['dingtalk', { ok: false, outcome: 'failure', error: { type: 'auth', subtype: 'http_403', http_status: 403 } }],+ ['wecom', { error: { type: 'AuthError', code: 893201 } }],+ ['xero', { error: { message: 'Xero API error (403): Forbidden' } }],+ ['lark', { ok: false, error: { type: 'authorization' } }],+ ])('records %s permission failures at discovery without business execution or scope metadata', async (provider, payload) => {+ const env = envFor(provider as string);+ const runner = vi.fn(() => ({ status: 1, stdout: JSON.stringify(payload), stderr: '' }));+ await expect(adapter.inspectAction(provider === 'xero' ? 'contacts.list' : provider === 'dingtalk' ? 'doc.get' : provider === 'wecom' ? 'contact.get-user' : 'docs.+fetch', { runner }, env))+ .rejects.toMatchObject({ code: 'connector_permission_denied', provider_error: { recovery: 'reauthorize' } });+ expect(runner).toHaveBeenCalledOnce();+ expect(permissions.readPermissionRequest(env)).toMatchObject({ reauthorize: true, scopes: [] });+ });++ it.each([+ { status: 0, stdout: JSON.stringify({ ok: true, error: { type: 'permission_denied' } }), stderr: '' },+ { status: 0, stdout: JSON.stringify({ error: { type: 'permission_denied' } }), stderr: '' },+ { status: 1, stdout: JSON.stringify({ error: { type: 'network', message: 'missing_scope forbidden 403' } }), stderr: '' },+ { status: 1, stdout: '', stderr: 'Permission denied: local file' },+ { status: 1, stdout: '', stderr: 'Xero API error (403): Forbidden', error: new Error('timeout') },+ { status: 0, stdout: JSON.stringify({ success: true, data: { error: { type: 'permission_denied' } } }), stderr: '' },+ { status: 1, stdout: 'prefix {"error":{"type":"permission_denied"}}', stderr: '' },+ { status: 1, stdout: JSON.stringify([{ error: { type: 'permission_denied' } }]), stderr: '' },+ ])('does not infer missing permissions from successful data, prose or transport failures: %#', result => {+ expect(permissions.structuredPermissionFailure(result, 'xero')).toBeNull();+ });++ it.each([+ { success: true, code: 'PAT_NO_PERMISSION' },+ { success: false, code: 'UNRELATED_FAILURE', data: { code: 'PAT_NO_PERMISSION' } },+ { success: false, data: { error: { type: 'permission_denied' } } },+ ])('does not treat DWS successful or nested business data as a permission channel: %#', payload => {+ expect(permissions.structuredPermissionFailure(ok(payload), 'dingtalk')).toBeNull();+ });++ it('recognizes the pinned Xero CLI status-bearing stderr protocol', () => {+ expect(permissions.structuredPermissionFailure({ status: 1, stdout: '', stderr: 'Error: Xero API error (403): Forbidden\n' }, 'xero'))+ .toMatchObject({ code: 'connector_permission_denied' });+ });++ it.each(['PAT_NO_PERMISSION', 'PAT_LOW_RISK_NO_PERMISSION', 'PAT_MEDIUM_RISK_NO_PERMISSION',+ 'PAT_HIGH_RISK_NO_PERMISSION', 'PAT_ORG_POLICY_DENIED', 'PAT_SCOPE_AUTH_REQUIRED'])(+ 'recognizes DWS permission channel %s without exposing its authorization URL', code => {+ const env = envFor('dingtalk');+ const result = { status: 4, stdout: '', stderr: JSON.stringify({ success: false, code, data: { uri: 'https://private.invalid/auth' } }) };+ const error = permissions.structuredPermissionFailure(result, 'dingtalk');+ permissions.rememberPermissionRequest(error, env);+ expect(error).toMatchObject({ code: 'connector_permission_denied', provider_error: { recovery: 'reauthorize' } });+ expect(JSON.stringify(error)).not.toContain('private.invalid');+ expect(permissions.readPermissionRequest(env)).not.toBeNull();+ },+ );++ it('still offers reauthorization when the accumulated scope list exceeds the bounded explicit request', () => {+ const env = envFor('lark');+ permissions.rememberPermissionRequest({ provider_error: { type: 'authorization', identity: 'user',+ missing_scopes: Array.from({ length: 51 }, (_, index) => `resource:scope${index}`),+ } }, env);+ expect(permissions.readPermissionRequest(env)).toMatchObject({ reauthorize: true, scopes: [] });+ });++ it.each([230013, 99991679])('retains Lark API permission code %s and offers reauthorization', code => {+ const env = envFor('lark');+ const error = lark.structuredFailure({ status: 1, stdout: JSON.stringify({ ok: false, error: { type: 'api', code } }), stderr: '' });+ permissions.rememberPermissionRequest(error, env);+ expect(error).toMatchObject({ code: 'connector_permission_denied', provider_error: { type: 'api', code, recovery: 'reauthorize' } });+ expect(permissions.readPermissionRequest(env)).toMatchObject({ reauthorize: true, scopes: [] });+ });++ function dwsDenied(env: any, code: string, data: unknown) {+ const error = permissions.structuredPermissionFailure({ status: 4, stdout: '',+ stderr: JSON.stringify({ success: false, code, data }) }, 'dingtalk');+ permissions.rememberPermissionRequest(error, env);+ return error;+ }++ it.each(['data', 'result'])('retries only outstanding DingTalk PAT scopes after a partial %s receipt', async envelope => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_BATCH_AUTH_PENDING', { scopes: ['chat.message:send', 'calendar.event:get'] });+ let granted = ['chat.message:send'];+ const execute = vi.fn(async (args: string[]) => args.includes('json')+ ? JSON.stringify({ success: true, [envelope]: { grantedScopes: granted } }) : undefined);+ const deps = { execute, authorizationReady: () => true };+ await expect(auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env, deps))+ .rejects.toThrow('permissions are still unavailable');+ expect(permissions.readPermissionRequest(env)?.pat_scopes).toEqual(['calendar.event:get']);+ granted = ['calendar.event:get'];+ execute.mockClear();+ await auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env, deps);+ expect(execute.mock.calls).toHaveLength(2);+ for (const [args] of execute.mock.calls) {+ expect(args).toContain('calendar.event:get');+ expect(args).not.toContain('chat.message:send');+ expect(args.slice(0, 2)).toEqual(['pat', 'chmod']);+ }+ expect(permissions.readPermissionRequest(env)).toBeNull();+ });++ it.each([+ ['plain success', JSON.stringify({ ok: true })],+ ['malformed JSON', '{'],+ ['missing receipt', undefined],+ ['failed grant', JSON.stringify({ success: false, data: { grantedScopes: ['chat.message:send'] } })],+ ['wrong case', JSON.stringify({ success: true, data: { grantedScopes: ['Chat.Message:Send'] } })],+ ['wrong shape', JSON.stringify({ success: true, data: { grantedScopes: 'chat.message:send' } })],+ ['unrelated grant', JSON.stringify({ success: true, data: { alreadyGrantedScopes: ['mail:send'] } })],+ ])('retains DingTalk recovery on %s instead of accepting identity success', async (_name, receipt) => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_NO_PERMISSION', { scope: 'chat.message:send' });+ const pending = permissions.readPermissionRequest(env);+ const execute = vi.fn(async (args: string[]) => args.includes('json') ? receipt : undefined);+ await expect(auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env,+ { execute, authorizationReady: () => true })).rejects.toThrow('permissions are still unavailable');+ expect(permissions.readPermissionRequest(env)).toMatchObject({ pat_scopes: pending.pat_scopes, scopes: [] });+ expect(execute.mock.calls.every(([args]) => args[0] === 'pat')).toBe(true);+ });++ it('stops before PAT grant when DingTalk identity renewal is cancelled or remains unverified', async () => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_NO_PERMISSION', { scope: 'chat.message:send' });+ const pending = permissions.readPermissionRequest(env);+ for (const cancel of [true, false]) {+ const execute = vi.fn(async () => { if (cancel) throw new Error('cancelled'); });+ await expect(auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env,+ { execute, authorizationReady: () => false })).rejects.toThrow(cancel ? 'cancelled' : 'verified identity');+ expect(execute.mock.calls).toEqual([[['auth', 'login', '--device', '--no-browser']]]);+ expect(permissions.readPermissionRequest(env)).toEqual(pending);+ }+ });++ it.each(['PAT_NO_PERMISSION', 'PAT_ORG_POLICY_DENIED'])('recovers a DingTalk scope after %s once the provider confirms access', async code => {+ const env = envFor('dingtalk');+ const error = dwsDenied(env, code, { scope: 'chat.message:send', uri: 'https://private.invalid', clientSecret: 'private' });+ expect(error.provider_error).toMatchObject({ identity: 'pat', missing_scopes: ['chat.message:send'] });+ expect(JSON.stringify(error)).not.toContain('private');+ const pending = permissions.readPermissionRequest(env);+ expect(pending).toMatchObject({ scopes: [], pat_scopes: ['chat.message:send'], unresolved_access: false });+ const execute = vi.fn(async (args: string[]) => args.includes('json')+ ? JSON.stringify({ success: true, data: { alreadyGrantedScopes: ['chat.message:send'] } }) : undefined);+ await auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env, { execute, authorizationReady: () => true });+ expect(execute.mock.calls.map(([args]) => args)).toEqual([+ ['pat', 'chmod', 'chat.message:send', '--grant-type', 'permanent', '--yes', '--format', 'table'],+ ['pat', 'chmod', 'chat.message:send', '--grant-type', 'permanent', '--yes', '--format', 'json'],+ ]);+ expect(permissions.readPermissionRequest(env)).toBeNull();+ });++ it('preserves case-sensitive DingTalk OAuth identifiers and rejects CLI argument look-alikes', () => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_SCOPE_AUTH_REQUIRED', { identity: 'user', missingScope: 'Contact.User.Read' });+ dwsDenied(env, 'PAT_SCOPE_AUTH_REQUIRED', { identity: 'user', missingScope: 'Todo.Personal.Write' });+ expect(permissions.readPermissionRequest(env)?.scopes).toEqual(['Contact.User.Read', 'Todo.Personal.Write']);+ for (const scope of ['Contact.User.Read --other', '--scope', 'Contact.User.Read\\nOther', 'Contact.User.Read;command']) {+ expect(permissions.isScopeName(scope)).toBe(false);+ }+ });++ it.each(['bot', 'tenant', undefined])('does not convert DingTalk %s scope failures into user consent', identity => {+ const env = envFor('dingtalk');+ // DWS buildPATScopeJSON carries the affected identity separately from the+ // permission-channel code. Only explicit user scope evidence permits login scopes.+ const error = dwsDenied(env, 'PAT_SCOPE_AUTH_REQUIRED', { identity, missingScope: 'Contact.User.Read' });+ expect(error.provider_error.identity).not.toBe('user');+ expect(permissions.readPermissionRequest(env)).toMatchObject({ scopes: [], unresolved_access: true });+ });++ it('removes acknowledged PAT permissions while keeping a separate OAuth deficiency', async () => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_SCOPE_AUTH_REQUIRED', { identity: 'user', missingScope: 'mail:send' });+ dwsDenied(env, 'PAT_BATCH_AUTH_PENDING', { scopes: ['chat.message:send'] });+ const execute = vi.fn(async (args: string[]) => args.includes('json')+ ? JSON.stringify({ success: true, data: { grantedScopes: ['chat.message:send'] } }) : undefined);+ await expect(auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env,+ { execute, authorizationReady: () => true })).rejects.toThrow('permissions could not be verified');+ expect(permissions.readPermissionRequest(env)).toMatchObject({ scopes: ['mail:send'], pat_scopes: [] });+ expect(execute.mock.calls.every(([args]) => args[0] === 'pat')).toBe(true);+ });++ it.each(['cancel', 'partial', 'newer'])('keeps DingTalk permission recovery after %s', async mode => {+ const env = envFor('dingtalk');+ dwsDenied(env, 'PAT_NO_PERMISSION', { scope: 'chat.message:send' });+ const execute = vi.fn(async (args: string[]) => {+ if (mode === 'cancel') throw new Error('cancelled');+ if (mode === 'newer') dwsDenied(env, 'PAT_NO_PERMISSION', { scope: 'calendar.event:get' });+ return args.includes('json') ? JSON.stringify({ success: true, data: {+ grantedScopes: mode === 'partial' ? [] : ['chat.message:send'],+ } }) : undefined;+ });+ const result = auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env, { execute, authorizationReady: () => true });+ if (mode === 'newer') await result;+ else await expect(result).rejects.toThrow(mode === 'cancel' ? 'cancelled' : 'permissions are still unavailable');+ expect(permissions.readPermissionRequest(env)).not.toBeNull();+ expect(execute.mock.calls.every(([args]) => args[0] === 'pat')).toBe(true);+ });++ it.each(['PAT_SCOPE_AUTH_REQUIRED', 'PAT_ORG_POLICY_DENIED', 'PAT_NO_PERMISSION'])(+ 'does not mistake identity login for restored DingTalk access: %s', async code => {+ const env = envFor('dingtalk');+ dwsDenied(env, code, code === 'PAT_SCOPE_AUTH_REQUIRED' ? { missingScope: 'mail:send' } : {});+ const execute = vi.fn(async () => undefined);+ await expect(auth.authorizeDingtalk('', '', auth.MANIFESTS.dingtalk, env,+ { execute, authorizationReady: () => true })).rejects.toThrow();+ expect(permissions.readPermissionRequest(env)).not.toBeNull();+ expect(execute.mock.calls.length).toBe(code === 'PAT_ORG_POLICY_DENIED' ? 0 : 1);+ });++ it('keeps WeCom recovery after cancellation and identity-only reauthorization without replaying business calls', async () => {+ const env = envFor('wecom');+ const denied = { code: 'connector_permission_denied' };+ permissions.rememberPermissionRequest(denied, env);+ const execute = vi.fn(async () => { throw new Error('cancelled'); });+ await expect(auth.authorizeSingleStep('', '', auth.MANIFESTS.wecom, env, () => true, { execute }))+ .rejects.toThrow('cancelled');+ expect(permissions.readPermissionRequest(env)).not.toBeNull();+ execute.mockImplementation(async () => { permissions.rememberPermissionRequest(denied, env); });+ await expect(auth.authorizeSingleStep('', '', auth.MANIFESTS.wecom, env, () => true, { execute }))+ .rejects.toThrow('permissions could not be verified');+ const newer = permissions.readPermissionRequest(env);+ execute.mockImplementation(async () => undefined);+ await expect(auth.authorizeSingleStep('', '', auth.MANIFESTS.wecom, env, () => true, { execute }))+ .rejects.toThrow('permissions could not be verified');+ expect(permissions.readPermissionRequest(env)).toEqual(newer);+ expect(execute.mock.calls).toEqual(Array(3).fill([['auth', 'init', '--noninteractive', '--no-browser']]));+ });++ it('forces Lark authorization without missing scope names and preserves old grants through cancellation and retry', async () => {+ const env = envFor('lark');+ permissions.rememberPermissionRequest({ code: 'connector_permission_denied' }, env);+ const oldScopes = ['im:message.send_as_user', 'offline_access'];+ const authorizationReady = vi.fn(() => true);+ const execute = vi.fn(async () => { throw new Error('cancelled'); });+ const deps = { execute, authorizationReady, authorizationScopes: () => oldScopes };+ await expect(auth.authorizeLark('', '', auth.MANIFESTS.lark, env, deps)).rejects.toThrow('cancelled');+ expect(permissions.readPermissionRequest(env)).not.toBeNull();+ execute.mockImplementation(async () => undefined);+ await expect(auth.authorizeLark('', '', auth.MANIFESTS.lark, env, deps)).rejects.toThrow('permissions could not be verified');+ expect(execute).toHaveBeenCalledTimes(2);+ expect(execute).toHaveBeenLastCalledWith([...auth.MANIFESTS.lark.login(env)[1], '--scope', oldScopes.join(' ')]);+ expect(authorizationReady).toHaveBeenLastCalledWith(oldScopes);+ expect(permissions.readPermissionRequest(env)).toMatchObject({ unresolved_access: true });+ });++ function permissionError(identity = 'user', subtype = 'missing_scope') {+ return lark.structuredFailure({ status: 2, stdout: '', stderr: JSON.stringify({+ ok: false, identity, missing_scopes: ['im:message.send_as_user'],+ error: { type: 'authorization', subtype, message: 'private provider message', hint: 'private hint' },+ }) });+ }++ it('keeps a Lark bot visibility denial after confirming the requested user scope', async () => {+ const env = envFor('lark');+ lark.rememberPermissionRequest(permissionError('bot'), env);+ lark.rememberPermissionRequest(permissionError('user'), env);+ const execute = vi.fn(async () => undefined);+ await expect(auth.authorizeLark('', '', auth.MANIFESTS.lark, env, {+ execute, authorizationReady: () => true, authorizationScopes: () => ['offline_access'],+ })).rejects.toThrow('permissions could not be verified');+ expect(execute).toHaveBeenCalledExactlyOnceWith([+ 'auth', 'login', '--profile', 'file-contract', '--scope', 'im:message.send_as_user offline_access',+ ]);+ auth.checkLarkPermissions('', '', auth.MANIFESTS.lark, env, () => ok({ identities: { user: {+ available: true, verified: true, scope: 'im:message.send_as_user offline_access',+ } } }));+ expect(permissions.readPermissionRequest(env)).toMatchObject({ scopes: [], unresolved_access: true });+ });++ it.each(['missing_scope', 'token_scope_insufficient'])(+ 'recovers %s across document, spreadsheet and API operations without replaying them', async (subtype) => {+ const env = envFor('lark');+ const operations = [+ ['docs.+fetch', 'docx:document:readonly'],+ ['sheets.+cells-get', 'sheets:spreadsheet:read'],+ ['wiki.spaces.get_node', 'wiki:wiki:readonly'],+ ];+ for (const [action, scope] of operations) {+ const execute = vi.fn(() => ({ status: 3, stdout: '', stderr: JSON.stringify({+ ok: false, identity: 'user', error: {+ type: 'authorization', subtype, missing_scopes: [scope],+ },+ }) }));+ await expect(adapter.executeAction('R', { action }, { runner: runnerFor(execute) }, env))+ .rejects.toMatchObject({ provider_error: { subtype, recovery: 'reauthorize' } });+ expect(execute).toHaveBeenCalledOnce();+ }+ const required = operations.map(([, scope]) => scope);+ expect(lark.readPermissionRequest(env)?.scopes).toEqual([...required].sort());+ const granted = new Set(['im:message.send_as_user', 'offline_access']);+ const execute = vi.fn(async (args: string[]) => {+ expect(args.slice(0, 5)).toEqual(['auth', 'login', '--profile', 'file-contract', '--scope']);+ const requested = args[5].split(' ');+ expect(new Set(requested)).toEqual(new Set([...required, ...granted]));+ requested.forEach(scope => granted.add(scope));+ });+ await auth.authorizeLark('', '', auth.MANIFESTS.lark, env, {+ execute, authorizationReady: (scopes: string[] = []) => scopes.every(scope => granted.has(scope)),+ authorizationScopes: () => [...granted],+ });+ expect(execute).toHaveBeenCalledOnce();+ expect(lark.readPermissionRequest(env)).toBeNull();+ },+ );++ it.each(['wrong-profile', 'invalid-scope', 'oversized', 'empty'])(+ 'does not offer authorization from %s recovery state', (variant) => {+ const env = envFor('lark');+ const value = { profile: variant === 'wrong-profile' ? 'another-profile' : 'file-contract',+ scopes: variant === 'invalid-scope' ? ['docx:document:readonly --other']+ : variant === 'empty' ? [] : ['docx:document:readonly'],+ ...(variant === 'oversized' ? { padding: 'x'.repeat(20_000) } : {}),+ };+ fs.writeFileSync(path.join(env.ORKAS_LOCAL_CLI_RUNTIME_DIR, '.orkas-user-permissions.json'), JSON.stringify(value));+ expect(lark.readPermissionRequest(env)).toBeNull();+ },+ );++ it('preserves granted OAuth scopes that have no business-domain prefix', () => {+ const runner = vi.fn(() => ({ status: 0, stdout: JSON.stringify({ identities: { user: {+ available: true, verified: true, scope: 'offline_access docx:document:readonly',+ } } }) }));+ expect(auth.larkUserScopes('', '', auth.MANIFESTS.lark, envFor('lark'), runner))+ .toEqual(['offline_access', 'docx:document:readonly']);+ });+ it('retains the missing user scope and explicitly requests it on reconnect while preserving normal login reuse', async () => {+ const env = envFor('lark');+ const error = permissionError();+ lark.rememberPermissionRequest(error, env);+ expect(error.provider_error.recovery).toBe('reauthorize');+ expect(JSON.stringify(error)).not.toContain('private');+ let granted = false;+ const execute = vi.fn(async (args: string[]) => {+ expect(args).toEqual(['auth', 'login', '--profile', 'file-contract', '--scope', 'docs:document:read im:message.send_as_user']);+ granted = true;+ });+ await auth.authorizeLark('', '', auth.MANIFESTS.lark, env, {+ execute, authorizationReady: (scopes: string[] = []) => !scopes.length || granted,+ authorizationScopes: () => ['docs:document:read'],+ });+ expect(execute).toHaveBeenCalledOnce();+ expect(lark.readPermissionRequest(env)).toBeNull();+ execute.mockClear();+ await auth.authorizeLark('', '', auth.MANIFESTS.lark, env, { execute, authorizationReady: () => true });+ expect(execute).not.toHaveBeenCalled();+ });++ it('does not mistake a valid old login for successful permission grant and retains a retry', async () => {+ const env = envFor('lark');+ lark.rememberPermissionRequest(permissionError(), env);+ const execute = vi.fn(async () => undefined);+ await expect(auth.authorizeLark('', '', auth.MANIFESTS.lark, env, {+ execute, authorizationReady: (scopes: string[] = []) => !scopes.length,+ authorizationScopes: () => [],+ })).rejects.toThrow(/permissions are still unavailable/);+ expect(execute).toHaveBeenCalledOnce();+ expect(lark.readPermissionRequest(env)?.scopes).toEqual(['im:message.send_as_user']);+ });++ it('offers reauthorization without inventing scopes when the provider supplies no scope list', () => {+ const env = envFor('lark');+ const error = permissionError();+ delete error.provider_error.missing_scopes;+ lark.rememberPermissionRequest(error, env);+ expect(lark.readPermissionRequest(env)?.scopes).toEqual([]);+ });++ it.each([['bot', 'missing_scope'], ['bot', 'token_scope_insufficient'], ['', 'missing_scope'],+ ['user', 'app_scope_not_applied'], ['user', 'access_denied']])(+ 'offers reauthorization for %s/%s without requiring IM scope metadata', (identity, subtype) => {+ const env = envFor('lark');+ lark.rememberPermissionRequest(permissionError(identity, subtype), env);+ expect(lark.readPermissionRequest(env)?.reauthorize).toBe(true);+ if (identity !== 'user') expect(lark.readPermissionRequest(env)?.scopes).toEqual([]);+ },+ );++ it('verifies requested scope membership as well as the user identity', () => {+ const env = envFor('lark');+ const runner = vi.fn(() => ({ status: 0, stdout: JSON.stringify({ identities: { user: {+ available: true, verified: true, scope: 'im:message im:resource',+ } } }) }));+ expect(auth.larkAuthorizationReady('', '', auth.MANIFESTS.lark, env, runner)).toBe(true);+ expect(auth.larkAuthorizationReady('', '', auth.MANIFESTS.lark, env, runner, ['im:message.send_as_user'])).toBe(false);+ });+});diff --git a/test/main/features/connectors/local-cli-lark-contract.test.ts b/test/main/features/connectors/local-cli-lark-contract.test.tsindex 5fd0479a..28079b4e 100644--- a/test/main/features/connectors/local-cli-lark-contract.test.ts+++ b/test/main/features/connectors/local-cli-lark-contract.test.ts@@ -216,7 +216,11 @@ describe('Lark user journeys against the pinned official command contract', () =fs.writeFileSync(approved, '# Contract fixture');try {const execute = vi.fn((args: string[]) => {- expect(args).toContain(`@${approved}`);+ const reference = args[args.indexOf('--content') + 1];+ expect(reference.startsWith('@')).toBe(true);+ expect(path.isAbsolute(reference.slice(1))).toBe(false);+ const options = (runner.mock.calls.at(-1) as unknown[])[2] as { cwd: string };+ expect(fs.readFileSync(path.join(options.cwd, reference.slice(1)), 'utf8')).toBe('# Contract fixture');return { ok: true };});const args = { action: 'docs.+update', parameters: { doc: 'fixture-doc', command: 'append', content: `@${approved}` } };diff --git a/test/main/features/connectors/local-cli-stdio-adapter.test.ts b/test/main/features/connectors/local-cli-stdio-adapter.test.tsindex b0772186..6e684c80 100644--- a/test/main/features/connectors/local-cli-stdio-adapter.test.ts+++ b/test/main/features/connectors/local-cli-stdio-adapter.test.ts@@ -21,7 +21,7 @@ const adapter = require('../../../../bin/local-cli-mcp-server.cjs') as {classifyXeroAction: (action: string) => string;invocationRisk: (baseRisk: string, parameters: unknown, env?: NodeJS.ProcessEnv) => string;redact: (value: unknown) => string;- validatedParameters: (value: unknown, env?: NodeJS.ProcessEnv) => Record<string, unknown>;+ validatedParameters: (value: unknown, env?: NodeJS.ProcessEnv, inspection?: unknown) => Record<string, unknown>;invocationFor: (action: string, params: unknown, risk: string, env: NodeJS.ProcessEnv) => string[];executeAction: (risk: string,@@ -67,11 +67,17 @@ describe('official local CLI MCP adapter', () => {fs.mkdirSync(workDir);const schemaStarted = path.join(runtimeDir, 'schema-started');const mutation = path.join(runtimeDir, 'mutation');+ const descendantMutation = path.join(runtimeDir, 'descendant-mutation');+ const descendantPid = path.join(runtimeDir, 'descendant-pid');const fakeCli = path.join(runtimeDir, 'npx-cli.cjs');fs.writeFileSync(fakeCli, ["const fs = require('node:fs');","if (process.argv.includes('--schema')) {",- ` fs.writeFileSync(${JSON.stringify(schemaStarted)}, 'started');`,+ ` require('node:child_process').spawn(process.execPath, ['-e', ${JSON.stringify([+ `require('node:fs').writeFileSync(${JSON.stringify(descendantPid)}, String(process.pid));`,+ `require('node:fs').writeFileSync(${JSON.stringify(schemaStarted)}, 'started');`,+ `setTimeout(() => require('node:fs').writeFileSync(${JSON.stringify(descendantMutation)}, 'unexpected late effect'), 450);`,+ ].join('\n'))}], { stdio: 'inherit' });`,` setTimeout(() => process.stdout.write(JSON.stringify({ effect: 'write' })), 350);`,'} else {',` fs.writeFileSync(${JSON.stringify(mutation)}, 'unexpected mutation');`,@@ -102,7 +108,8 @@ describe('official local CLI MCP adapter', () => {const pending = client.callTool({name: 'execute_write', arguments: { action: 'todo.task.create', parameters: { title: 'fixture' } },}, undefined, { signal: controller.signal }).catch((error) => error);- await vi.waitFor(() => expect(fs.existsSync(schemaStarted)).toBe(true));+ // Wait for real child readiness; process startup is not the cancellation deadline.+ await vi.waitFor(() => expect(fs.existsSync(schemaStarted)).toBe(true), { timeout: 5_000 });if (abandon === 'cancel') controller.abort();else if (abandon === 'disconnect') await client.close();const result = await pending;@@ -113,6 +120,8 @@ describe('official local CLI MCP adapter', () => {await new Promise((resolve) => setTimeout(resolve, 550));}expect(fs.existsSync(mutation)).toBe(abandon === 'continue');+ expect(fs.existsSync(descendantMutation)).toBe(abandon === 'continue');+ await vi.waitFor(() => expect(() => process.kill(Number(fs.readFileSync(descendantPid, 'utf8')), 0)).toThrow());} finally {await client.close();fs.rmSync(runtimeDir, { recursive: true, force: true });@@ -377,7 +386,7 @@ describe('official local CLI MCP adapter', () => {const runner = vi.fn((_command: string, argv: string[]) => argv[4] === 'schema'? result({name: 'drive.file.upload',- inputSchema: { type: 'object', properties: { file: { type: 'string' } } },+ inputSchema: { type: 'object', properties: { file: { type: 'string', format: 'binary' } } },_meta: { risk: 'write' },}): result({ ok: true }));@@ -542,7 +551,9 @@ describe('official local CLI MCP adapter', () => {expect(() => adapter.validatedParameters({ output_path: '/tmp/leak' })).toThrow(/not allowed/);expect(() => adapter.validatedParameters({ file: '/tmp/leak' }, envFor('lark'))).toThrow(/outside|does not exist/);- expect(() => adapter.validatedParameters({ source: '../credential.json' }, envFor('lark')))+ expect(() => adapter.validatedParameters({ source: '../credential.json' }, envFor('lark'), {+ provider: 'lark', schema: { inputSchema: { properties: { source: { type: 'string', format: 'binary' } } } },+ })).toThrow(/outside|does not exist/);const approvedFile = path.join(process.cwd(), 'package.json');expect(adapter.validatedParameters({ file: approvedFile }, envFor('lark')))diff --git a/test/main/features/connectors/local-cli.test.ts b/test/main/features/connectors/local-cli.test.tsindex 2edd6a18..d19cd24c 100644--- a/test/main/features/connectors/local-cli.test.ts+++ b/test/main/features/connectors/local-cli.test.ts@@ -44,9 +44,11 @@ vi.mock('../../../../src/main/model/core-agent/interactive-cli-sessions', () =>import { findCatalogEntry } from '../../../../src/main/features/connectors/catalog';import {authorizeLocalCli,+ checkLocalCliPermissions,installLocalCli,LOCAL_CLI_MANIFESTS,localCliInstallStatus,+ localCliMissingPermissions,localCliProfileName,localCliRuntimeDir,localCliTransport,@@ -84,6 +86,72 @@ function seedInstalled(uid: string, entry: NonNullable<ReturnType<typeof findCat}describe('official local CLI connector runtime', () => {+ it('projects missing DingTalk OAuth and PAT scopes without exposing authorization data', () => {+ const uid = 'dingtalk-permission-projection';+ const runtime = localCliRuntimeDir(uid, 'dingtalk');+ fs.mkdirSync(runtime, { recursive: true });+ try {+ fs.writeFileSync(path.join(runtime, '.orkas-user-permissions.json'), JSON.stringify({+ profile: localCliProfileName(uid, 'dingtalk'), reauthorize: true,+ scopes: ['mail:send'], pat_scopes: ['chat.message:send'], admin_required: false,+ }));+ expect(localCliMissingPermissions(uid, 'dingtalk')).toEqual(['chat.message:send', 'mail:send']);+ } finally { fs.rmSync(runtime, { recursive: true, force: true }); }+ });++ it('does not start an old-account permission check after switching accounts during proxy setup', async () => {+ const entry = findCatalogEntry('feishu')!;+ const uid = 'permission-switch-check';+ const directory = seedInstalled(uid, entry);+ const proxy = await import('../../../../src/main/util/proxy-dispatcher');+ const { notifyUserSwitch } = await import('../../../../src/main/features/user-switch-hooks');+ let finish!: (value: Record<string, string>) => void;+ vi.mocked(proxy.buildChildProxyEnvironment).mockImplementationOnce(() => new Promise(resolve => { finish = resolve; }));+ const runner = vi.fn(async () => ({ exitCode: 0, stderr: '' }));+ try {+ const checking = checkLocalCliPermissions(uid, entry, true, runner);+ notifyUserSwitch(uid, 'next-account');+ finish({});+ await checking;+ expect(runner).not.toHaveBeenCalled();+ } finally { fs.rmSync(directory, { recursive: true, force: true }); }+ });++ it('checks installed Lark permissions on demand, coalesces repeated page opens and supports an explicit refresh', async () => {+ const entry = findCatalogEntry('feishu')!;+ const uid = 'permission-page-check';+ const directory = seedInstalled(uid, entry);+ let finish!: () => void;+ const runner = vi.fn(async (options: any) => {+ expect(options.env.ORKAS_LOCAL_CLI_CHECK_PERMISSIONS_ONLY).toBe('1');+ expect(options.timeoutMs).toBe(60_000);+ expect(options.args).toEqual([expect.stringContaining('local-cli-auth.cjs')]);+ await new Promise<void>(resolve => { finish = resolve; });+ return { exitCode: 0, stderr: '' };+ });+ try {+ expect(runner).not.toHaveBeenCalled();+ const first = checkLocalCliPermissions(uid, entry, false, runner);+ const second = checkLocalCliPermissions(uid, entry, false, runner);+ await vi.waitFor(() => expect(runner).toHaveBeenCalledOnce());+ finish();+ await Promise.all([first, second]);+ await checkLocalCliPermissions(uid, entry, false, runner);+ expect(runner).toHaveBeenCalledOnce();+ const refreshed = checkLocalCliPermissions(uid, entry, true, runner);+ await vi.waitFor(() => expect(runner).toHaveBeenCalledTimes(2));+ const afterConsent = checkLocalCliPermissions(uid, entry, true, runner);+ finish();+ await refreshed;+ await vi.waitFor(() => expect(runner).toHaveBeenCalledTimes(3));+ finish();+ await afterConsent;+ await checkLocalCliPermissions('not-installed', entry, true, runner);+ await checkLocalCliPermissions(uid, findCatalogEntry('wecom')!, true, runner);+ expect(runner).toHaveBeenCalledTimes(3);+ } finally { fs.rmSync(directory, { recursive: true, force: true }); }+ });+it('derives deterministic account+connector-isolated profiles and device-local paths', () => {expect(localCliProfileName('account-a', 'feishu')).toMatch(/^orkas-[a-f0-9]{16}$/);expect(localCliProfileName('account-a', 'feishu')).toBe(localCliProfileName('account-a', 'feishu'));@@ -95,6 +163,55 @@ describe('official local CLI connector runtime', () => {expect(() => localCliRuntimeDir('account-a', '../escape')).toThrow('invalid local CLI catalog id');});+ it('expires the page-check cache without scheduling background checks or borrowing another account result', async () => {+ const entry = findCatalogEntry('feishu')!;+ const accounts = ['permission-ttl-a', 'permission-ttl-b'];+ const directories = accounts.map(uid => seedInstalled(uid, entry));+ let now = Date.now();+ const clock = vi.spyOn(Date, 'now').mockImplementation(() => now);+ const runner = vi.fn(async () => ({ exitCode: 0, stderr: '' }));+ const authCalls = interactiveMocks.start.mock.calls.length;+ try {+ await checkLocalCliPermissions(accounts[0], entry, false, runner);+ now += 59_999;+ await checkLocalCliPermissions(accounts[0], entry, false, runner);+ expect(runner).toHaveBeenCalledOnce();+ await checkLocalCliPermissions(accounts[1], entry, false, runner);+ expect(runner).toHaveBeenCalledTimes(2);+ now += 1;+ expect(runner).toHaveBeenCalledTimes(2);+ await checkLocalCliPermissions(accounts[0], entry, false, runner);+ expect(runner).toHaveBeenCalledTimes(3);+ expect(interactiveMocks.start).toHaveBeenCalledTimes(authCalls);+ } finally {+ clock.mockRestore();+ directories.forEach(directory => fs.rmSync(directory, { recursive: true, force: true }));+ }+ });++ it.each(['disconnect', 'account-switch'])('aborts a running permission check and queued refresh on %s', async mode => {+ const entry = findCatalogEntry('feishu')!;+ const uid = `permission-running-${mode}`;+ const directory = seedInstalled(uid, entry);+ let signal!: AbortSignal;+ const runner = vi.fn(async (options: any) => {+ signal = options.signal;+ await new Promise<void>(resolve => signal.addEventListener('abort', () => resolve(), { once: true }));+ return { exitCode: 1, stderr: '' };+ });+ try {+ const checking = checkLocalCliPermissions(uid, entry, false, runner);+ await vi.waitFor(() => expect(runner).toHaveBeenCalledOnce());+ const queued = checkLocalCliPermissions(uid, entry, true, runner);+ if (mode === 'disconnect') await removeLocalCliAuthorization(uid, entry);+ else (await import('../../../../src/main/features/user-switch-hooks')).notifyUserSwitch(uid, 'next-account');+ await Promise.all([checking, queued]);+ expect(signal.aborted).toBe(true);+ expect(runner).toHaveBeenCalledOnce();+ if (mode === 'disconnect') expect(fs.existsSync(directory)).toBe(false);+ } finally { fs.rmSync(directory, { recursive: true, force: true }); }+ });+it('materializes the governed adapter with pinned official package metadata and isolated auth env', () => {const entry = findCatalogEntry('feishu');expect(entry).toBeTruthy();@@ -299,7 +416,7 @@ describe('official local CLI connector runtime', () => {);});- it('uses DingTalk structured authentication state instead of the process exit code', () => {+ it('requires DingTalk authenticated state as well as a successful status command', () => {const helper = require('../../../../bin/local-cli-auth.cjs') as {MANIFESTS: Record<string, { package: string; verify: string[] }>;dingtalkAuthorizationReady: (@@ -317,7 +434,9 @@ describe('official local CLI connector runtime', () => {stdout: JSON.stringify({ success: true, authenticated: false }),}).mockReturnValueOnce({- status: 3,+ // DWS 1.0.61 writeAuthStatusJSON returns the encoder result; a successful+ // status command exits zero even when authenticated is false.+ status: 0,stdout: JSON.stringify({ success: true, authenticated: true }),});@@ -355,7 +474,9 @@ describe('official local CLI connector runtime', () => {stdout: JSON.stringify({ error: { code: 893999 } }),}).mockReturnValueOnce({- status: 3,+ // WeCom's CLI reference defines exit zero as success; a payload alone+ // cannot turn a failed identity command into verification.+ status: 0,stdout: JSON.stringify({ extra_identity_context: 'verified identity context' }),});diff --git a/test/main/features/connectors/local-cli_e2e_attachment.test.ts b/test/main/features/connectors/local-cli_e2e_attachment.test.tsnew file mode 100644index 00000000..3d3f2d66--- /dev/null+++ b/test/main/features/connectors/local-cli_e2e_attachment.test.ts@@ -0,0 +1,106 @@+import { createRequire } from 'node:module';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { Client } from '@modelcontextprotocol/sdk/client/index.js';+import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';+import { expect, it } from 'vitest';++const require = createRequire(import.meta.url);+const adapter = require('../../../../bin/local-cli-mcp-server.cjs');+const samples = require('./fixtures/lark-cli-1.0.93.json').samples;++// Real MCP transport and a CLI fixture enforcing the pinned provider's file boundary.+// No credentials, provider account, or real recipient are used.+it('passes approved attachment bytes across stdio and offers scope recovery without replaying a send', async () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-attachment-e2e-'));+ const work = path.join(root, 'work');+ const approved = path.join(root, 'approved');+ fs.mkdirSync(work);+ fs.mkdirSync(approved);+ const source = path.join(approved, 'handoff 宇涛.md');+ const bytes = Buffer.from('Handoff\n\u0000literal $(value)');+ fs.writeFileSync(source, bytes);+ const cli = path.join(root, 'npx-cli.cjs');+ const trace = path.join(root, 'sends.jsonl');+ const marker = path.join(root, 'integrity.json');+ fs.writeFileSync(marker, JSON.stringify(adapter.MANIFESTS.lark));+ fs.writeFileSync(cli, [+ "const fs = require('node:fs'), path = require('node:path');",+ `const samples = ${JSON.stringify(samples)};`,+ 'const args = process.argv.slice(5);',+ "if (args[0] === 'im' && args[1] === '+messages-send' && !args.includes('--help')) {",+ " const file = args[args.indexOf('--file') + 1];",+ " if (path.isAbsolute(file) || file.split(/[\\\\/]/).includes('..')) process.exit(4);",+ " const configRelative = path.relative(fs.realpathSync(process.env.LARKSUITE_CLI_CONFIG_DIR), fs.realpathSync(file));",+ " if (configRelative === '' || (!configRelative.startsWith('..' + path.sep) && configRelative !== '..' && !path.isAbsolute(configRelative))) {",+ " process.stderr.write(JSON.stringify({ ok: false, error: { type: 'validation', subtype: 'invalid_argument', message: 'input is inside the CLI config directory, which is protected by the built-in denylist' } }));",+ ' process.exit(2);',+ ' }',+ ` fs.appendFileSync(${JSON.stringify(trace)}, JSON.stringify({ args, cwd: process.cwd(), bytes: fs.readFileSync(file).toString('base64') }) + '\\n');`,+ " if (args[args.indexOf('--user-id') + 1] === 'ou_denied') {",+ " process.stderr.write(JSON.stringify({ ok: false, identity: 'user', missing_scopes: ['im:message.send_as_user'], error: { type: 'authorization', subtype: 'missing_scope', message: 'private provider details' } }));",+ ' process.exitCode = 2;',+ " } else process.stdout.write(JSON.stringify({ ok: true, data: { message_id: 'message-fixture' } }));",+ '} else {',+ ' const sample = samples.find(s => JSON.stringify(s.args) === JSON.stringify(args));',+ ' if (!sample) process.exit(3);',+ ' process.stdout.write(sample.stdout); process.stderr.write(sample.stderr); process.exitCode = sample.status;',+ '}',+ ].join('\n'));+ const node = process.env.ORKAS_TEST_NODE || process.execPath;+ const env = {+ ORKAS_LOCAL_CLI_PROVIDER: 'lark',+ ORKAS_LOCAL_CLI_PACKAGE: adapter.MANIFESTS.lark.package,+ ORKAS_LOCAL_CLI_PACKAGE_INTEGRITY: adapter.MANIFESTS.lark.integrity,+ ORKAS_LOCAL_CLI_EXECUTABLE: adapter.MANIFESTS.lark.executable,+ ORKAS_LOCAL_CLI_ALLOWED_DOMAINS_JSON: JSON.stringify(adapter.MANIFESTS.lark.domains),+ ORKAS_LOCAL_CLI_ALLOWED_FILE_ROOTS_JSON: JSON.stringify([approved]),+ ORKAS_LOCAL_CLI_RUNTIME_DIR: root, ORKAS_LOCAL_CLI_WORK_DIR: work,+ LARKSUITE_CLI_CONFIG_DIR: root,+ ORKAS_LOCAL_CLI_PROFILE: 'attachment-e2e', ORKAS_LOCAL_CLI_SKIP_AUTH_CHECK: '1',+ ORKAS_LOCAL_CLI_NPX_CLI: cli, ORKAS_LOCAL_CLI_INTEGRITY_MARKER: marker,+ ORKAS_NODE: node,+ };+ const transport = new StdioClientTransport({ command: node,+ args: [path.resolve('bin/local-cli-mcp-server.cjs')], env, stderr: 'pipe' });+ let diagnostics = '';+ transport.stderr?.on('data', (data) => { diagnostics += String(data); });+ const client = new Client({ name: 'attachment-regression', version: '1.0.0' });+ const parse = (value: any) => JSON.parse(value.content[0].text);+ try {+ await client.connect(transport);+ const description = parse(await client.callTool({ name: 'describe_action', arguments: { action: 'im.+messages-send' } }));+ expect(description.schema.inputSchema.properties.file.description).toContain('absolute local path in Orkas-approved roots');+ expect(description.schema.inputSchema.properties.file.description).not.toContain('absolute paths and .. are rejected');+ expect(description.schema.inputSchema.properties.audio.description).toContain('Opus');+ for (const recipient of ['ou_fixture', 'ou_denied']) {+ const result = await client.callTool({ name: 'execute_high_impact', arguments: {+ action: 'im.+messages-send', parameters: { user_id: recipient, file: source, as: 'user', idempotency_key: recipient },+ } });+ if (recipient === 'ou_fixture') {+ expect(result.isError, JSON.stringify(result)).not.toBe(true);+ expect(parse(result).result.data.message_id).toBe('message-fixture');+ } else {+ expect(result.isError).toBe(true);+ expect(parse(result).provider_error).toMatchObject({ identity: 'user', recovery: 'reauthorize' });+ expect(JSON.stringify(result)).not.toContain('private provider');+ }+ }+ const calls = fs.readFileSync(trace, 'utf8').trim().split('\n').map(line => JSON.parse(line));+ expect(calls).toHaveLength(2);+ for (const call of calls) {+ expect(Buffer.from(call.bytes, 'base64')).toEqual(bytes);+ expect(path.basename(call.args[call.args.indexOf('--file') + 1])).toBe(path.basename(source));+ expect(fs.existsSync(call.cwd)).toBe(false);+ }+ expect(fs.readdirSync(work)).toEqual([]);+ expect(require('../../../../bin/local-cli-lark.cjs').readPermissionRequest(env)?.scopes)+ .toEqual(['im:message.send_as_user']);+ expect(fs.readFileSync(source)).toEqual(bytes);+ } finally {+ await client.close();+ fs.rmSync(root, { recursive: true, force: true });+ expect(diagnostics).toBe('');+ }+});diff --git a/test/main/features/connectors/local-cli_e2e_permissions.test.ts b/test/main/features/connectors/local-cli_e2e_permissions.test.tsnew file mode 100644index 00000000..afb16ae1--- /dev/null+++ b/test/main/features/connectors/local-cli_e2e_permissions.test.ts@@ -0,0 +1,88 @@+import { createRequire } from 'node:module';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { Client } from '@modelcontextprotocol/sdk/client/index.js';+import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';+import { expect, it } from 'vitest';++const require = createRequire(import.meta.url);+const adapter = require('../../../../bin/local-cli-mcp-server.cjs');+const permissions = require('../../../../bin/local-cli-permissions.cjs');++// Real adapter/stdio/process lifecycle with synthetic provider protocol fixtures.+// This proves operation isolation, not live provider consent or schema compatibility.+it.each(['dingtalk', 'wecom'])('keeps %s reads usable across a business denial and adapter restart without login or replay', async provider => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-permission-e2e-'));+ const work = path.join(root, 'work');+ fs.mkdirSync(work);+ const trace = path.join(root, 'calls.jsonl');+ const cli = path.join(root, 'npx-cli.cjs');+ const marker = path.join(root, 'integrity.json');+ const manifest = adapter.MANIFESTS[provider];+ fs.writeFileSync(marker, JSON.stringify(manifest));+ const denial = provider === 'dingtalk'+ ? { success: false, code: 'PAT_NO_PERMISSION', data: { scope: 'doc.content:read', uri: 'https://private.invalid/consent' } }+ : { error: { type: 'PermissionError', message: 'private provider detail' } };+ fs.writeFileSync(cli, [+ "const fs = require('node:fs');",+ 'const args = process.argv.slice(5);',+ `fs.appendFileSync(${JSON.stringify(trace)}, JSON.stringify(args) + '\\n');`,+ "if (args[0] === 'schema' || args.includes('--schema')) {",+ " process.stdout.write(JSON.stringify({ effect: 'read', parameters: {} }));",+ "} else if (args[0] === 'doc') {",+ ` process.stderr.write(JSON.stringify(${JSON.stringify(denial)})); process.exitCode = 4;`,+ "} else if (args[0] === 'contact') {",+ " process.stdout.write(JSON.stringify({ success: true, data: { fixture: 'allowed-read' } }));",+ "} else { process.stderr.write('Unexpected command'); process.exitCode = 9; }",+ ].join('\n'));+ const node = process.env.ORKAS_TEST_NODE || process.execPath;+ const env = {+ ORKAS_LOCAL_CLI_PROVIDER: provider,+ ORKAS_LOCAL_CLI_PACKAGE: manifest.package,+ ORKAS_LOCAL_CLI_PACKAGE_INTEGRITY: manifest.integrity,+ ORKAS_LOCAL_CLI_EXECUTABLE: manifest.executable,+ ORKAS_LOCAL_CLI_ALLOWED_DOMAINS_JSON: JSON.stringify(manifest.domains),+ ORKAS_LOCAL_CLI_RUNTIME_DIR: root, ORKAS_LOCAL_CLI_WORK_DIR: work,+ ORKAS_LOCAL_CLI_PROFILE: 'permission-e2e', ORKAS_LOCAL_CLI_SKIP_AUTH_CHECK: '1',+ ORKAS_LOCAL_CLI_NPX_CLI: cli, ORKAS_LOCAL_CLI_INTEGRITY_MARKER: marker,+ ORKAS_NODE: node,+ };+ const parse = (value: any) => JSON.parse(value.content[0].text);+ try {+ for (const restart of [false, true]) {+ const transport = new StdioClientTransport({ command: node,+ args: [path.resolve('bin/local-cli-mcp-server.cjs')], env, stderr: 'pipe' });+ let diagnostics = '';+ transport.stderr?.on('data', data => { diagnostics += String(data); });+ const client = new Client({ name: 'permission-regression', version: '1.0.0' });+ try {+ await client.connect(transport);+ if (!restart) {+ const denied = await client.callTool({ name: 'execute_read', arguments: { action: 'doc.get' } });+ expect(denied.isError).toBe(true);+ expect(parse(denied)).toMatchObject({ error_code: 'connector_permission_denied', provider_error: { recovery: 'reauthorize' } });+ expect(JSON.stringify(denied)).not.toContain('private');+ }+ const pending = permissions.readPermissionRequest(env);+ expect(pending).toMatchObject({ reauthorize: true });+ const allowed = await client.callTool({ name: 'execute_read', arguments: {+ action: provider === 'wecom' ? 'contact.get-user' : 'contact.get',+ } });+ expect(allowed.isError, JSON.stringify(allowed)).not.toBe(true);+ expect(parse(allowed).result.data.fixture).toBe('allowed-read');+ expect(permissions.readPermissionRequest(env)).toEqual(pending);+ } finally {+ await client.close();+ expect(diagnostics).toBe('');+ }+ }+ const calls: string[][] = fs.readFileSync(trace, 'utf8').trim().split('\n').map(line => JSON.parse(line));+ const business = calls.filter(args => args[0] !== 'schema' && !args.includes('--schema'));+ expect(business.map(args => args[0])).toEqual(['doc', 'contact', 'contact']);+ expect(calls.some(args => ['auth', 'pat', 'config'].includes(args[0]))).toBe(false);+ expect(fs.readdirSync(work)).toEqual([]);+ } finally {+ fs.rmSync(root, { recursive: true, force: true });+ }+});diff --git a/test/main/features/connectors/manager.test.ts b/test/main/features/connectors/manager.test.tsindex 7a0316d0..9ea20e13 100644--- a/test/main/features/connectors/manager.test.ts+++ b/test/main/features/connectors/manager.test.ts@@ -2218,6 +2218,68 @@ describe('OAuth refresh ownership', () => {},);+ it.each(['feishu', 'dingtalk', 'wecom'].flatMap(id =>+ ['user_cancelled', 'local_cli_authorization_failed'].map(code => [id, code])))(+ 'keeps an existing CLI connection usable when additional authorization for %s ends with %s', async (id, code) => {+ mocks.mcp.listTools = vi.fn(async () => [+ { name: 'execute_read', description: 'Read an official action.', input_schema: {} },+ ]);+ const manager = await import('../../../../src/main/features/connectors/manager');+ await manager.connectViaOAuth(TEST_UID, id);+ mocks.localCli.authorize.mockRejectedValueOnce(Object.assign(new Error(code), { code }));+ await expect(manager.connectViaOAuth(TEST_UID, id)).rejects.toMatchObject({ code });+ expect(manager.getInstance(TEST_UID, id)?.status.kind).toBe('connected');+ await manager.callTool(TEST_UID, id, 'execute_read', { action: 'docs.+fetch' });+ expect(mocks.mcp.callTool).toHaveBeenCalledOnce();+ },+ );++ it.each(['feishu', 'dingtalk', 'wecom'])(+ 'keeps %s connected and readable after one business operation is denied', async id => {+ mocks.mcp.listTools = vi.fn(async () => [+ { name: 'execute_high_impact', description: 'Send.', input_schema: {} },+ { name: 'execute_read', description: 'Read.', input_schema: {} },+ ]);+ const manager = await import('../../../../src/main/features/connectors/manager');+ await manager.connectViaOAuth(TEST_UID, id);+ const denial = { isError: true, content: [{ type: 'text', text: JSON.stringify({+ error_code: 'connector_permission_denied', provider_error: { type: 'authorization', recovery: 'reauthorize' },+ }) }] };+ mocks.mcp.callTool.mockResolvedValueOnce(denial);+ expect(await manager.callTool(TEST_UID, id, 'execute_high_impact', { action: 'message.send' })).toEqual(denial);+ expect(manager.getInstance(TEST_UID, id)?.status.kind).toBe('connected');+ const readable = { content: [{ type: 'text', text: 'read fixture' }] };+ mocks.mcp.callTool.mockResolvedValueOnce(readable);+ expect(await manager.callTool(TEST_UID, id, 'execute_read', { action: 'doc.get' })).toEqual(readable);+ expect(mocks.mcp.callTool).toHaveBeenCalledTimes(2);+ expect(manager.getInstance(TEST_UID, id)?.status.kind).toBe('connected');+ },+ );++ it('retains selected tools on CLI reauthorization and lets transfers finish within their own deadline', async () => {+ mocks.mcp.listTools = vi.fn(async () => [+ { name: 'execute_high_impact', description: 'Send a message.', input_schema: {} },+ { name: 'execute_read', description: 'Read.', input_schema: {} },+ ]);+ const manager = await import('../../../../src/main/features/connectors/manager');+ const registry = await import('../../../../src/main/features/connectors/registry');+ const initial = await manager.connectViaOAuth(TEST_UID, 'feishu');+ await registry.upsert(TEST_UID, { ...initial, enabled_subtools: ['execute_high_impact'], created_at: '2026-01-01T00:00:00Z' });+ const recovered = await manager.connectViaOAuth(TEST_UID, 'feishu');+ expect(recovered.enabled_subtools).toEqual(['execute_high_impact']);+ expect(recovered.created_at).toBe('2026-01-01T00:00:00Z');+ const controller = new AbortController();+ await manager.callTool(TEST_UID, 'feishu', 'execute_high_impact', {+ action: 'im.+messages-send', parameters: { file: '/fixture/attachment.md' },+ }, { signal: controller.signal });+ expect(mocks.mcp.callTool).toHaveBeenCalledOnce();+ const options = mocks.mcp.callTool.mock.calls[0][2];+ expect(options.signal).toBe(controller.signal);+ // A stalled transport fails promptly; only adapter progress extends the wait.+ expect(options.timeoutMs).toBe(90_000);+ expect(options.maxTotalTimeoutMs).toBe(13 * 60_000);+ });+it('keeps legacy standalone Lark installs mutually exclusive with the unified Feishu entry', async () => {mocks.mcp.listTools = vi.fn(async () => [{ name: 'execute_read', description: 'Read an official action.', input_schema: {} },diff --git a/test/main/features/connectors/mcp-client.test.ts b/test/main/features/connectors/mcp-client.test.tsindex 4f00c9af..f2cb7fda 100644--- a/test/main/features/connectors/mcp-client.test.ts+++ b/test/main/features/connectors/mcp-client.test.ts@@ -9,6 +9,63 @@ import { describe, expect, it } from 'vitest';const require = createRequire(import.meta.url);describe('MCP stdio diagnostic boundary', () => {+ it.each(['quiet', 'progress', 'endless'])('bounds a %s operation and never replays it after timeout', (mode) => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-mcp-deadline-'));+ const childPath = path.join(root, 'server.cjs');+ const probePath = path.join(root, 'probe.cjs');+ const eventsPath = path.join(root, 'events.jsonl');+ fs.writeFileSync(childPath, [+ `const { Server } = require(${JSON.stringify(require.resolve('@modelcontextprotocol/sdk/server/index.js'))});`,+ `const { StdioServerTransport } = require(${JSON.stringify(require.resolve('@modelcontextprotocol/sdk/server/stdio.js'))});`,+ `const { CallToolRequestSchema } = require(${JSON.stringify(require.resolve('@modelcontextprotocol/sdk/types.js'))});`,+ `const record = event => require('node:fs').appendFileSync(${JSON.stringify(eventsPath)}, JSON.stringify(event) + '\\n');`,+ "const server = new Server({ name: 'fixture', version: '1.0.0' }, { capabilities: { tools: {} } });",+ 'server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {',+ " record('start');",+ ' let count = 0, timer, pulse;',+ ' try {',+ ' await new Promise(resolve => {',+ " extra.signal.addEventListener('abort', () => { record('cancel'); resolve(); }, { once: true });",+ ...(mode !== 'quiet' ? [+ " pulse = setInterval(() => { void extra.sendNotification({ method: 'notifications/progress', params: { progressToken: request.params._meta.progressToken, progress: ++count } }).catch(() => {}); }, 80);",+ ] : []),+ ...(mode !== 'endless' ? [" timer = setTimeout(() => { record('complete'); resolve(); }, 800);"] : []),+ ' });',+ " return { content: [{ type: 'text', text: 'complete' }] };",+ ' } finally { clearTimeout(timer); clearInterval(pulse); }',+ '});',+ 'process.stdin.once("end", () => { void server.close(); });',+ 'void server.connect(new StdioServerTransport());',+ ].join('\n'));+ fs.writeFileSync(probePath, [+ `require.cache[require.resolve(${JSON.stringify(path.resolve('src/main/logger.ts'))})] = { exports: { createLogger: () => ({ info() {}, warn() {} }) } };`,+ `require.cache[require.resolve(${JSON.stringify(path.resolve('src/main/util/proxy-dispatcher.ts'))})] = { exports: { buildChildProxyEnvironment: async () => ({}) } };`,+ `const { McpConnection } = require(${JSON.stringify(path.resolve('src/main/features/connectors/mcp-client.ts'))});`,+ `const connection = new McpConnection('fixture', { kind: 'stdio', command: process.execPath, args: [${JSON.stringify(childPath)}], env: { ELECTRON_RUN_AS_NODE: '1' } });`,+ '(async () => {',+ ' try {',+ ' await connection.connect();',+ ' try {',+ " const result = await connection.callTool('execute_write', {}, { timeoutMs: 300, maxTotalTimeoutMs: 1500 });",+ " process.stdout.write(JSON.stringify({ outcome: result.content[0].text }));",+ ' } catch (error) { process.stdout.write(JSON.stringify({ code: error.code })); }',+ ' await new Promise(resolve => setTimeout(resolve, 150));',+ ' } finally { await connection.close(); }',+ '})().catch(() => { process.exitCode = 1; });',+ ].join('\n'));+ try {+ const result = spawnSync(process.execPath, ['-r', require.resolve('tsx/cjs'), probePath], {+ cwd: root, env: { ...process.env, ELECTRON_RUN_AS_NODE: '1', ORKAS_WORKSPACE_ROOT: root },+ encoding: 'utf8', timeout: 10_000, maxBuffer: 1024 * 1024,+ });+ expect(result.status).toBe(0);+ expect(result.stderr).toBe('');+ expect(JSON.parse(result.stdout)).toEqual(mode === 'progress' ? { outcome: 'complete' } : { code: -32001 });+ expect(fs.readFileSync(eventsPath, 'utf8').trim().split('\n').map(line => JSON.parse(line)))+ .toEqual(['start', mode === 'progress' ? 'complete' : 'cancel']);+ } finally { fs.rmSync(root, { recursive: true, force: true }); }+ });+it.each(['custom-fixture', 'notion'])('drains private child diagnostics without inheriting them into the parent: %s', (id) => {const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-mcp-diagnostics-'));const childPath = path.join(root, 'server.cjs');diff --git a/test/main/features/connectors/registry.test.ts b/test/main/features/connectors/registry.test.tsindex 933c716b..0c83e51a 100644--- a/test/main/features/connectors/registry.test.ts+++ b/test/main/features/connectors/registry.test.ts@@ -45,6 +45,38 @@ afterEach(() => {});describe('features/connectors/registry', () => {+ it.each(['replace', 'remove'] as const)('revokes connector-account task grants and pending dialogs on %s', async (operation) => {+ const uid = 'approval-account';+ const users = await import('../../../../src/main/features/users');+ users.activateUser(uid);+ const permissions = await import('../../../../src/main/features/permissions');+ permissions.setLocalExecMode('all_files_approval');+ const registry = await import('../../../../src/main/features/connectors/registry');+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ const instance = sampleInstance();+ await registry.upsert(uid, instance);+ let info: any;+ confirm._setBroadcastForTest((channel, payload) => { if (channel === 'connectors:action-confirm') info = payload; });+ const opts = { userId: uid, cid: 'grant-task', connectorId: instance.id, displayName: 'GitHub', toolName: 'publish', risk: 'H' as const, args: {} };+ const granted = confirm.requestActionConfirm(opts);+ confirm.respond(info.request_id, true, 'task');+ await expect(granted).resolves.toBe(true);+ // Ordinary tool-cache/status refresh is not account replacement.+ await registry.update(uid, instance.id, (current) => ({ ...current, tools_cached_at: 123 }));+ await expect(confirm.requestActionConfirm(opts)).resolves.toBe(true);+ const waiting = confirm.requestActionConfirm({ ...opts, cid: 'waiting-task' });+ const staleId = info.request_id;+ if (operation === 'replace') await registry.upsert(uid, instance);+ else await registry.remove(uid, instance.id);+ await expect(waiting).resolves.toBe(false);+ expect(confirm.respond(staleId, true, 'task')).toBe(false);+ const next = confirm.requestActionConfirm(opts);+ expect(info.request_id).not.toBe(staleId);+ confirm.respond(info.request_id, false);+ await expect(next).resolves.toBe(false);+ confirm._setBroadcastForTest(null);+ });+it('writes a tombstone on remove and clears it when reconnecting the same id', async () => {const uid = 'uid-delete';const file = path.join(tmpDir, uid, 'cloud', 'config', 'connectors.json');diff --git a/test/main/features/group_chat/bus-integration.test.ts b/test/main/features/group_chat/bus-integration.test.tsindex c17b4ce6..6f90a5aa 100644--- a/test/main/features/group_chat/bus-integration.test.ts+++ b/test/main/features/group_chat/bus-integration.test.ts@@ -4760,6 +4760,34 @@ describe('group_chat bus integration › G8d in-process dispatch (run_worker / d});describe('group_chat bus integration › task terminal boundary', () => {+ it('expires connector task grants on normal completion so the next request asks again', async () => {+ const cid = newCid();+ const state = await import('../../../../src/main/features/group_chat/state');+ const bus = await import('../../../../src/main/features/group_chat/bus');+ const confirm = await import('../../../../src/main/features/connectors/action_confirm');+ const permissions = await import('../../../../src/main/features/permissions');+ permissions.setLocalExecMode('all_files_approval');+ const prompts: any[] = [];+ confirm._setBroadcastForTest((channel, payload) => { if (channel === 'connectors:action-confirm') prompts.push(payload); });+ const opts = { userId: TEST_UID, cid, connectorId: 'feishu', displayName: 'Feishu', toolName: 'send', risk: 'H' as const, args: {} };+ try {+ const first = confirm.requestActionConfirm(opts);+ confirm.respond(prompts[0].request_id, true, 'task');+ await expect(first).resolves.toBe(true);+ await expect(confirm.requestActionConfirm(opts)).resolves.toBe(true);+ _setScript(state.buildGconvSessionId(cid), [{ type: 'final', text: 'Done.' }]);+ await bus.enqueue({ uid: TEST_UID, cid, fromActorId: 'user', text: 'Finish this task.' });+ await waitForQuiescent(TEST_UID, cid, 3000);+ const next = confirm.requestActionConfirm(opts);+ expect(prompts).toHaveLength(2);+ confirm.respond(prompts[1].request_id, false);+ await expect(next).resolves.toBe(false);+ } finally {+ confirm.cancelForCid(cid);+ confirm._setBroadcastForTest(null);+ }+ });+it('denies pending approvals when the active account changes', async () => {const users = await import('../../../../src/main/features/users');// Loading the bus mirrors the real runtime and exposes the synchronousdiff --git a/test/main/features/group_chat/bus.test.ts b/test/main/features/group_chat/bus.test.tsindex a20eebf1..4d3882cf 100644--- a/test/main/features/group_chat/bus.test.ts+++ b/test/main/features/group_chat/bus.test.ts@@ -4066,7 +4066,7 @@ describe('group_chat bus › enqueue routing + persistence', () => {expect(cliRunMock.calls).toHaveLength(0);const st = await state.readState(TEST_UID, cid);- expect(st.coding_project_dir).toBeUndefined();+ expect(st.coding_project_dir).toBe(projectDir);const mainFile = path.join(paths.userChatsDir(TEST_UID), `${cid}.jsonl`);const rows = fs.readFileSync(mainFile, 'utf8').trim().split('\n').map((line) => JSON.parse(line));@@ -4075,7 +4075,8 @@ describe('group_chat bus › enqueue routing + persistence', () => {},);- it('blocks a later OpenCode turn when its conversation cwd disappears instead of falling back', async () => {+ it.each(['removed', 'replaced-with-file'])(+ 'blocks a later OpenCode turn when its cwd is %s and resumes in the restored directory', async (fault) => {const paths = await import('../../../../src/main/paths');const agentFile = path.join(paths.agentDir(TEST_UID, AGENT_ID), 'agent.json');const spec = JSON.parse(fs.readFileSync(agentFile, 'utf8'));@@ -4104,6 +4105,7 @@ describe('group_chat bus › enqueue routing + persistence', () => {expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBe(projectDir);await sessions.setSessionId(TEST_UID, cid, AGENT_ID, 'opencode', 'stale-cwd-session');fs.rmSync(projectDir, { recursive: true, force: true });+ if (fault === 'replaced-with-file') fs.writeFileSync(projectDir, 'not a directory');await bus.enqueue({uid: TEST_UID,@@ -4114,15 +4116,90 @@ describe('group_chat bus › enqueue routing + persistence', () => {await waitForQuiescent(TEST_UID, cid);expect(cliRunMock.calls).toHaveLength(1);- expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBeUndefined();- expect(await sessions.getSessionId(TEST_UID, cid, AGENT_ID, 'opencode')).toBeNull();+ expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBe(projectDir);+ expect(await sessions.getSessionId(TEST_UID, cid, AGENT_ID, 'opencode')).toBe('stale-cwd-session');const rows = fs.readFileSync(path.join(paths.userChatsDir(TEST_UID), `${cid}.jsonl`), 'utf8').trim().split('\n').map((line) => JSON.parse(line));const recoveryForm = rows.find((row: any) => row?.form?.agent_id === AGENT_ID&& row.form.fields?.some((field: any) => field.id === 'project_dir'));expect(recoveryForm?.form?.submitted).toBe(false);+ if (fault === 'replaced-with-file') fs.rmSync(projectDir);+ fs.mkdirSync(projectDir);+ await bus.enqueue({ uid: TEST_UID, cid, fromActorId: 'user', text: `@${AGENT_NAME} continue after restoring the drive` });+ await waitForQuiescent(TEST_UID, cid);+ expect(cliRunMock.calls).toHaveLength(2);+ expect(cliRunMock.calls[1].cwd).toBe(projectDir);});+ it('keeps an unverified legacy directory recoverable when form persistence fails', async () => {+ const paths = await import('../../../../src/main/paths');+ const agentFile = path.join(paths.agentDir(TEST_UID, AGENT_ID), 'agent.json');+ const spec = JSON.parse(fs.readFileSync(agentFile, 'utf8'));+ spec.runtime = { kind: 'cli', cli: 'codex' };+ fs.writeFileSync(agentFile, JSON.stringify(spec));+ const state = await import('../../../../src/main/features/group_chat/state');+ const cid = 'cid-directory-migration-form';+ const legacy = path.join(tmpDir, 'legacy-unverified');+ await state.setCodingProjectDir(TEST_UID, cid, legacy, { explicit: true, needsConfirmation: true });+ const bus = await import('../../../../src/main/features/group_chat/bus');+ await bus.enqueue({ uid: TEST_UID, cid, fromActorId: 'user', text: `@${AGENT_NAME} continue the task` });+ await waitForQuiescent(TEST_UID, cid);+ expect(cliRunMock.calls).toHaveLength(0);+ const file = path.join(paths.userChatsDir(TEST_UID), `${cid}.jsonl`);+ const rows = fs.readFileSync(file, 'utf8').trim().split('\n').map((line) => JSON.parse(line));+ const form = rows.find((row: any) => row.form);+ const storage = await import('../../../../src/main/storage');+ const rewrite = vi.spyOn(storage, 'rewriteJsonlLine').mockResolvedValueOnce({ ok: false, error: 'injected transcript failure' });+ const facade = await import('../../../../src/main/features/group_chat');+ const input = { userId: TEST_UID, cid, msgId: form.id, formId: form.form.form_id, values: { project_dir: tmpDir } };+ try {+ expect((await facade.markFormSubmittedAndDispatch(input)).ok).toBe(false);+ expect((await state.readState(TEST_UID, cid)).coding_project_dir_pending).toBe(legacy);+ expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBeUndefined();+ } finally { rewrite.mockRestore(); }+ expect((await facade.markFormSubmittedAndDispatch(input)).ok).toBe(true);+ expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBe(tmpDir);+ expect((await state.readState(TEST_UID, cid)).coding_project_dir_pending).toBeUndefined();+ });++ it.each(['EACCES', 'EPERM', 'EIO'])(+ 'retains the project and resumes after a %s directory-check failure', async (code) => {+ const paths = await import('../../../../src/main/paths');+ const agentFile = path.join(paths.agentDir(TEST_UID, AGENT_ID), 'agent.json');+ const spec = JSON.parse(fs.readFileSync(agentFile, 'utf8'));+ spec.runtime = { kind: 'cli', cli: 'codex' };+ fs.writeFileSync(agentFile, JSON.stringify(spec));+ const selected = path.join(tmpDir, 'protected-project');+ fs.mkdirSync(selected);+ const state = await import('../../../../src/main/features/group_chat/state');+ const cid = 'cid-directory-access';+ await state.setCodingProjectDir(TEST_UID, cid, selected, { explicit: true });+ const bus = await import('../../../../src/main/features/group_chat/bus');+ const { syncBuiltinESMExports } = await import('node:module');+ const realStat = fs.statSync;+ const nativeFs = (await import('node:fs')).default;+ const stat = vi.spyOn(nativeFs, 'statSync').mockImplementation(((target: any, options: any) => {+ if (String(target) === selected) throw Object.assign(new Error('injected directory access error'), { code });+ return realStat(target, options);+ }) as typeof fs.statSync);+ syncBuiltinESMExports();+ try {+ await bus.enqueue({ uid: TEST_UID, cid, fromActorId: 'user', text: `@${AGENT_NAME} inspect this project` });+ await waitForQuiescent(TEST_UID, cid);+ expect(cliRunMock.calls).toHaveLength(0);+ expect((await state.readState(TEST_UID, cid)).coding_project_dir).toBe(selected);+ const rows = fs.readFileSync(path.join(paths.userChatsDir(TEST_UID), `${cid}.jsonl`), 'utf8')+ .trim().split('\n').map((line) => JSON.parse(line));+ expect(rows.some((row: any) => row.form)).toBe(false);+ expect(rows.some((row: any) => row.failure_code === 'project_directory_unavailable')).toBe(true);+ } finally { stat.mockRestore(); syncBuiltinESMExports(); }+ await bus.enqueue({ uid: TEST_UID, cid, fromActorId: 'user', text: `@${AGENT_NAME} try again` });+ await waitForQuiescent(TEST_UID, cid);+ expect(cliRunMock.calls).toHaveLength(1);+ expect(cliRunMock.calls[0].cwd).toBe(selected);+ },+ );+it('ignores a legacy per-agent model override when dispatching a CLI turn', async () => {const paths = await import('../../../../src/main/paths');const agentFile = path.join(paths.agentDir(TEST_UID, AGENT_ID), 'agent.json');diff --git a/test/main/features/local_agents/bridge.test.ts b/test/main/features/local_agents/bridge.test.tsindex 401e7227..e68ca674 100644--- a/test/main/features/local_agents/bridge.test.ts+++ b/test/main/features/local_agents/bridge.test.ts@@ -46,7 +46,8 @@ vi.mock('../../../../src/main/features/connectors', async (importOriginal) => {callTool: bridgeConnectorMock.callTool,};});-vi.mock('../../../../src/main/features/connectors/action_confirm', () => ({+vi.mock('../../../../src/main/features/connectors/action_confirm', async (importOriginal) => ({+ ...await importOriginal<typeof import('../../../../src/main/features/connectors/action_confirm')>(),requestActionConfirm: bridgeActionConfirmMock.request,}));diff --git a/test/main/features/local_agents/claude_e2e.test.ts b/test/main/features/local_agents/claude_e2e.test.tsindex 092d8e4d..0c93748f 100644--- a/test/main/features/local_agents/claude_e2e.test.ts+++ b/test/main/features/local_agents/claude_e2e.test.ts@@ -527,6 +527,74 @@ require('node:readline').createInterface({ input: process.stdin }).on('line', li}});+ it.each(['confirmed', 'late', 'host-closed'])('claude decline is sent once across %s completion', async boundary => {+ const trace = path.join(tmpDir, 'declined-input.json');+ const fake = writeNodeExecutable(tmpDir, 'claude-decline-input', `+const fs = require('node:fs');+const replies = [];+const send = msg => process.stdout.write(JSON.stringify(msg) + '\\n');+let users = 0;+require('node:readline').createInterface({ input: process.stdin }).on('line', line => {+ const msg = JSON.parse(line);+ if (msg.type === 'user' && ++users === 1) {+ send({ type: 'system', subtype: 'init', session_id: 'test-input-decline' });+ send({ type: 'control_request', request_id: 'ask-1', request: {+ subtype: 'can_use_tool', tool_name: 'AskUserQuestion', tool_use_id: 'question-tool',+ input: { questions: [{ question: 'Choose scope', options: [{ label: 'Current' }] }] },+ } });+ } else if (msg.type === 'user') {+ send({ type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: 'question-tool', is_error: true, content: 'Declined' }] } });+ send({ type: 'result', subtype: 'success', result: 'CLI continued.' });+ } else if (msg.type === 'control_response') {+ replies.push(msg);+ send({ type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: 'unrelated-tool', is_error: true, content: 'Declined' }] } });+ send({ type: 'assistant', message: { content: [{ type: 'text', text: 'Unrelated receipt delivered.' }] } });+ fs.writeFileSync(${JSON.stringify(trace)}, JSON.stringify(replies));+ }+});+`);+ let requestId = '';+ let ingress: any;+ const events: any[] = [];+ userInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ const run = claudeBackend.run({+ binPath: fake, prompt: 'inspect', cwd: tmpDir, signal: new AbortController().signal,+ timeoutMs: 15000, onEvent: event => events.push(event), onActiveRunIngress: value => { ingress = value; },+ requestUserInput: request => userInput.requestUserInput({ uid: 'u-input', cid: 'c-input', runId: 'claude-input', agentId: 'claude', agentName: 'Claude', cli: 'claude', request }),+ });+ try {+ await vi.waitFor(() => expect(requestId).not.toBe(''), { timeout: 5000 });+ let finished = false;+ const cancel = userInput.cancelRequest(requestId, 'u-input').then(result => { finished = true; return result; });+ await vi.waitFor(() => expect(events).toContainEqual({ type: 'text-delta', text: 'Unrelated receipt delivered.' }));+ expect(finished).toBe(false);+ if (boundary !== 'confirmed') {+ // The real child has consumed our reply. Withhold its receipt through+ // the host's receipt timeout; a second reply must never reach stdin.+ if (boundary === 'host-closed') userInput.cancelForRun('claude-input');+ await expect(cancel).resolves.toEqual({ handled: false, unknown: true });+ await expect(userInput.cancelRequest(requestId, 'u-input')).resolves.toEqual(+ boundary === 'host-closed' ? { handled: false, closed: true } : { handled: false, unknown: true },+ );+ expect(userInput.respond(requestId, 'u-input', { scope: ['Late answer'] })).toEqual({ handled: false });+ }+ await ingress.submit({ id: 'test-control', text: 'continue' });+ if (boundary === 'confirmed') await expect(cancel).resolves.toEqual({ handled: true, cancelled: true });+ await run;+ await expect(userInput.cancelRequest(requestId, 'u-input')).resolves.toEqual({ handled: false, closed: true });+ expect(JSON.parse(fs.readFileSync(trace, 'utf8'))).toEqual([{+ type: 'control_response', response: { subtype: 'success', request_id: 'ask-1',+ response: { behavior: 'deny', message: 'The user did not answer this question.' } },+ }]);+ expect(events.at(-1)).toMatchObject({ type: 'done', status: 'completed' });+ } finally {+ await run;+ userInput._resetForTest();+ }+ });+it('bridges a control_request to the host and returns the user decision', async () => {// fake CLI: reads the prompt, emits init + a control_request, then// reads ONE more line from stdin (our control_response) and onlydiff --git a/test/main/features/local_agents/cli_input_cancel.test.ts b/test/main/features/local_agents/cli_input_cancel.test.tsnew file mode 100644index 00000000..35b076cb--- /dev/null+++ b/test/main/features/local_agents/cli_input_cancel.test.ts@@ -0,0 +1,80 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { CliInputCancellation, CliInputNotSentError } from '../../../../src/main/features/local_agents/cli_input_cancel';++afterEach(() => { vi.clearAllTimers(); vi.useRealTimers(); });++describe('native question cancellation receipts', () => {+ it('does not confuse a successful write with a receipt, and joins concurrent attempts', async () => {+ vi.useFakeTimers();+ const send = vi.fn(async () => {});+ const cancellation = new CliInputCancellation(new AbortController().signal, send);+ const first = cancellation.cancel();+ expect(cancellation.cancel()).toBe(first);+ let finished = false;+ void first.then(() => { finished = true; });+ await vi.advanceTimersByTimeAsync(100);+ expect(finished).toBe(false);+ cancellation.confirm();+ expect(await first).toBe('cancelled');+ expect(await cancellation.cancel()).toBe('cancelled');+ expect(send).toHaveBeenCalledOnce();+ expect(vi.getTimerCount()).toBe(0);+ });++ it('retries only a proven unsent reply and never replays a missing receipt', async () => {+ vi.useFakeTimers();+ const send = vi.fn(async () => {}).mockRejectedValueOnce(new CliInputNotSentError('not written'));+ const cancellation = new CliInputCancellation(new AbortController().signal, send);+ expect(await cancellation.cancel()).toBe('failed');+ const timedOut = cancellation.cancel();+ await vi.advanceTimersByTimeAsync(5_000);+ expect(await timedOut).toBe('unknown');+ expect(await cancellation.cancel()).toBe('unknown');+ expect(cancellation.mayHaveSent).toBe(true);+ expect(send).toHaveBeenCalledTimes(2);+ cancellation.confirm();+ expect(await cancellation.cancel()).toBe('cancelled');+ expect(send).toHaveBeenCalledTimes(2);+ expect(vi.getTimerCount()).toBe(0);+ });++ it('does not interpret a transport exception as proof that the CLI rejected the reply', async () => {+ const send = vi.fn(async () => { throw new Error('delivery unknown'); });+ const cancellation = new CliInputCancellation(new AbortController().signal, send);+ expect(await cancellation.cancel()).toBe('unknown');+ expect(await cancellation.cancel()).toBe('unknown');+ expect(send).toHaveBeenCalledOnce();+ expect(cancellation.mayHaveSent).toBe(true);+ });++ it.each(['resolve', 'reject'])('never resends a write that completes after its receipt timeout: %s', async outcome => {+ vi.useFakeTimers();+ let resolveWrite!: () => void;+ let rejectWrite!: (error: Error) => void;+ const send = vi.fn(() => new Promise<void>((resolve, reject) => { resolveWrite = resolve; rejectWrite = reject; }));+ const controller = new AbortController();+ const cancellation = new CliInputCancellation(controller.signal, send);+ const result = cancellation.cancel();+ await vi.advanceTimersByTimeAsync(5_000);+ expect(await result).toBe('unknown');+ if (outcome === 'resolve') resolveWrite();+ else rejectWrite(new Error('late transport failure'));+ await vi.advanceTimersByTimeAsync(60_000);+ expect(await cancellation.cancel()).toBe('unknown');+ expect(send).toHaveBeenCalledOnce();+ controller.abort();+ expect(await cancellation.cancel()).toBe('closed');+ expect(vi.getTimerCount()).toBe(0);+ });++ it('treats native withdrawal as closed and never sends after withdrawal', async () => {+ const controller = new AbortController();+ const send = vi.fn(async () => {});+ const cancellation = new CliInputCancellation(controller.signal, send);+ const result = cancellation.cancel();+ controller.abort();+ expect(await result).toBe('closed');+ expect(await cancellation.cancel()).toBe('closed');+ expect(send).not.toHaveBeenCalled();+ });+});diff --git a/test/main/features/local_agents/cli_user_input.test.ts b/test/main/features/local_agents/cli_user_input.test.tsindex c6b22a19..2e051069 100644--- a/test/main/features/local_agents/cli_user_input.test.ts+++ b/test/main/features/local_agents/cli_user_input.test.ts@@ -31,6 +31,61 @@ function request(overrides: Record<string, unknown> = {}) {}describe('local_agents/cli_user_input', () => {+ it('retains a failed cancellation for retry and settles only after native confirmation', async () => {+ let requestId = '';+ userInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ let confirm!: (value: 'cancelled') => void;+ const cancel = vi.fn<() => Promise<'cancelled' | 'closed' | 'failed'>>()+ .mockResolvedValueOnce('failed')+ .mockImplementationOnce(() => new Promise(resolve => { confirm = resolve; }));+ const response = request({ request: { questions: [{ id: 'scope', question: 'Choose scope' }], cancel } });+ let settled = false;+ void response.then(() => { settled = true; });+ expect(await userInput.cancelRequest(requestId, 'other-account')).toEqual({ handled: false });+ expect(cancel).not.toHaveBeenCalled();+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, cancel_failed: true });+ expect(settled).toBe(false);+ const first = userInput.cancelRequest(requestId, 'u1');+ const duplicate = userInput.cancelRequest(requestId, 'u1');+ expect(cancel).toHaveBeenCalledTimes(2);+ expect(userInput.respond(requestId, 'u1', { scope: ['racing answer'] })).toEqual({ handled: false });+ confirm('cancelled');+ expect(await first).toEqual({ handled: true, cancelled: true });+ expect(await duplicate).toEqual({ handled: true, cancelled: true });+ expect(await response).toEqual({ cancelled: true, answers: { scope: [] } });+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, closed: true });+ expect(cancel).toHaveBeenCalledTimes(2);+ });++ it.each(['unknown', 'exception'])('never retries or accepts a second answer after an uncertain cancellation: %s', async outcome => {+ let requestId = '';+ userInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ const cancel = vi.fn(async () => 'unknown' as const);+ if (outcome === 'exception') cancel.mockRejectedValueOnce(new Error('delivery unknown'));+ const controller = new AbortController();+ const response = request({ request: { questions: [{ id: 'scope', question: 'Choose scope' }], cancel, signal: controller.signal } });+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, unknown: true });+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, unknown: true });+ expect(userInput.respond(requestId, 'u1', { scope: ['late answer'] })).toEqual({ handled: false });+ expect(cancel).toHaveBeenCalledOnce();+ controller.abort();+ await expect(response).resolves.toMatchObject({ cancelled: true });+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, closed: true });+ });++ it('does not claim native cancellation when the adapter cannot confirm it', async () => {+ let requestId = '';+ userInput._setBroadcastForTest((_channel, payload: any) => { requestId = payload.request_id || requestId; });+ const response = request();+ expect(await userInput.cancelRequest(requestId, 'u1')).toEqual({ handled: false, cancel_failed: true });+ expect(userInput.respond(requestId, 'u1', { environment: ['staging'] })).toEqual({ handled: true, cancelled: false });+ expect(await response).toEqual({ cancelled: false, answers: { environment: ['staging'] } });+ });+it('returns empty answers immediately when no renderer can receive the request', async () => {userInput._setBroadcastForTest(() => false);diff --git a/test/main/features/local_agents/codex_backend.test.ts b/test/main/features/local_agents/codex_backend.test.tsindex 928edad9..ece66fd9 100644--- a/test/main/features/local_agents/codex_backend.test.ts+++ b/test/main/features/local_agents/codex_backend.test.ts@@ -1207,6 +1207,7 @@ if (scenario.endsWith('-lingers') || scenario === 'hang' || scenario === 'bootstexpect(requestUserInput).toHaveBeenCalledWith({id: 'user-input-1',signal: expect.any(AbortSignal),+ cancel: expect.any(Function),questions: [{id: 'environment',header: 'Environment',@@ -1283,6 +1284,81 @@ require('node:readline').createInterface({ input: process.stdin }).on('line', li}});+ it.each(['confirmed', 'late', 'host-closed'])('codex decline is sent once across %s completion', async boundary => {+ const executable = path.join(tempDir, 'question-decline');+ const trace = path.join(tempDir, 'question-decline.json');+ fs.writeFileSync(executable, `#!/usr/bin/env node+const fs = require('node:fs');+const replies = [];+const send = msg => process.stdout.write(JSON.stringify(msg) + '\\n');+require('node:readline').createInterface({ input: process.stdin }).on('line', line => {+ const msg = JSON.parse(line);+ if (msg.method === 'initialize') send({ id: msg.id, result: {} });+ if (msg.method === 'thread/start') send({ id: msg.id, result: { threadId: 'fresh-thread' } });+ if (msg.method === 'turn/start') {+ send({ id: msg.id, result: { turn: { id: 'turn-1' } } });+ send({ method: 'turn/started', params: { threadId: 'fresh-thread', turn: { id: 'turn-1' } } });+ send({ id: 94, method: 'item/tool/requestUserInput', params: {+ threadId: 'fresh-thread', turnId: 'turn-1', itemId: 'question-94',+ questions: [{ id: 'scope', question: 'Choose scope' }], isBlocking: true,+ } });+ }+ if (msg.id === 94 && msg.result) {+ replies.push(msg);+ send({ method: 'serverRequest/resolved', params: { requestId: 94 } });+ send({ method: 'serverRequest/resolved', params: { threadId: 'other-thread', requestId: 94 } });+ send({ method: 'serverRequest/resolved', params: { threadId: 'fresh-thread', requestId: 95 } });+ send({ method: 'item/agentMessage/delta', params: { threadId: 'fresh-thread', turnId: 'turn-1', itemId: 'barrier', delta: 'Unrelated receipts delivered.' } });+ fs.writeFileSync(${JSON.stringify(trace)}, JSON.stringify(replies));+ }+ if (msg.method === 'turn/steer') {+ send({ method: 'serverRequest/resolved', params: { threadId: 'fresh-thread', requestId: 94 } });+ send({ id: msg.id, result: { turnId: 'turn-1' } });+ send({ method: 'turn/completed', params: { threadId: 'fresh-thread', turn: { id: 'turn-1', status: 'completed' } } });+ }+});+`, { mode: 0o755 });+ let requestId = '';+ let ingress: any;+ const events: any[] = [];+ userInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ const run = codexBackend.run({+ binPath: executable, prompt: 'inspect', cwd: tempDir, signal: new AbortController().signal,+ timeoutMs: 15000, onEvent: event => events.push(event), onActiveRunIngress: value => { ingress = value; },+ requestUserInput: request => userInput.requestUserInput({ uid: 'u-input', cid: 'c-input', runId: 'codex-input', agentId: 'codex', agentName: 'Codex', cli: 'codex', request }),+ });+ try {+ await vi.waitFor(() => expect(requestId).not.toBe(''), { timeout: 5000 });+ let finished = false;+ const cancel = userInput.cancelRequest(requestId, 'u-input').then(result => { finished = true; return result; });+ await vi.waitFor(() => expect(events).toContainEqual(expect.objectContaining({ type: 'text-delta', text: 'Unrelated receipts delivered.' })));+ expect(finished).toBe(false);+ if (boundary !== 'confirmed') {+ // The real child has consumed our reply. Withhold its receipt through+ // the host's receipt timeout; a second reply must never reach stdin.+ if (boundary === 'host-closed') userInput.cancelForRun('codex-input');+ await expect(cancel).resolves.toEqual({ handled: false, unknown: true });+ await expect(userInput.cancelRequest(requestId, 'u-input')).resolves.toEqual(+ boundary === 'host-closed' ? { handled: false, closed: true } : { handled: false, unknown: true },+ );+ expect(userInput.respond(requestId, 'u-input', { scope: ['Late answer'] })).toEqual({ handled: false });+ }+ await ingress.submit({ id: 'test-control', text: 'continue' });+ if (boundary === 'confirmed') await expect(cancel).resolves.toEqual({ handled: true, cancelled: true });+ await run;+ await expect(userInput.cancelRequest(requestId, 'u-input')).resolves.toEqual({ handled: false, closed: true });+ expect(JSON.parse(fs.readFileSync(trace, 'utf8'))).toEqual([+ { jsonrpc: '2.0', id: 94, result: { answers: {} } },+ ]);+ expect(events.at(-1)).toMatchObject({ type: 'done', status: 'completed' });+ } finally {+ await run;+ userInput._resetForTest();+ }+ });+it('fails an unknown app-server request immediately instead of waiting for the watchdog', async () => {const events: any[] = [];const startedAt = Date.now();diff --git a/test/main/features/local_agents/project-directory.test.ts b/test/main/features/local_agents/project-directory.test.tsnew file mode 100644index 00000000..00b337b6--- /dev/null+++ b/test/main/features/local_agents/project-directory.test.ts@@ -0,0 +1,166 @@+import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';+import * as crypto from 'node:crypto';++let root: string;+let previous: string | undefined;+const uid = 'directory-account';+const cid = 'directory-conversation';+function write(file: string, value: unknown) {+ fs.mkdirSync(path.dirname(file), { recursive: true });+ fs.writeFileSync(file, JSON.stringify(value));+}+beforeEach(() => {+ root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-directory-'));+ previous = process.env.ORKAS_WORKSPACE_ROOT;+ process.env.ORKAS_WORKSPACE_ROOT = root;+ vi.resetModules();+});+afterEach(() => {+ vi.restoreAllMocks();+ if (previous === undefined) delete process.env.ORKAS_WORKSPACE_ROOT;+ else process.env.ORKAS_WORKSPACE_ROOT = previous;+ fs.rmSync(root, { recursive: true, force: true });+});++describe('device-owned CLI directory', () => {+ it.each(['session', 'agent-setting'])('preserves a legacy choice proven by %s, even while its drive is unavailable', async (proof) => {+ const paths = await import('../../../../src/main/paths');+ const dir = path.join(root, 'temporarily-offline');+ if (proof === 'session') write(paths.localCliSessionsFile(uid, cid), {+ a: { cli: 'codex', sessionId: 'local-session', cwdFingerprint: crypto.createHash('sha256').update(dir).digest('hex') },+ });+ else write(paths.userAgentRuntimeConfigFile(uid), { version: 2, project_dirs: { a: { path: dir } } });+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ expect(m.readCodingDirectory(uid, cid, { coding_project_dir: dir, coding_project_dir_explicit: true }))+ .toEqual({ coding_project_dir: dir, coding_project_dir_explicit: true });+ // Restart and a newer remote path must not change the migrated selection.+ vi.resetModules();+ const restarted = await import('../../../../src/main/features/local_agents/project-directory');+ expect(restarted.readCodingDirectory(uid, cid, { coding_project_dir: path.join(root, 'other-device') }).coding_project_dir).toBe(dir);+ fs.mkdirSync(dir);+ expect(restarted.inspectCodingDirectory(dir).kind).toBe('available');+ });++ it('requires confirmation for unproven legacy paths even if they exist, and remembers explicit clearing', async () => {+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ const legacy = { coding_project_dir: root, coding_project_dir_explicit: true };+ expect(m.readCodingDirectory(uid, cid, legacy)).toEqual({ coding_project_dir_pending: root });+ m.writeCodingDirectory(uid, cid, root, true);+ expect(m.readCodingDirectory(uid, cid).coding_project_dir).toBe(root);+ m.writeCodingDirectory(uid, cid, '', false);+ expect(m.readCodingDirectory(uid, cid, legacy)).toEqual({});+ });++ it('fails closed on unreadable local state without replacing the selection from cloud', async () => {+ const paths = await import('../../../../src/main/paths');+ const file = paths.localCliDirectoryFile(uid, cid);+ write(file, { version: 99, directory: root, explicit: true });+ const before = fs.readFileSync(file, 'utf8');+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ expect(() => m.readCodingDirectory(uid, cid, { coding_project_dir: root })).toThrow();+ expect(fs.readFileSync(file, 'utf8')).toBe(before);+ });++ it('keeps the local selection through cloud replacement, state mutations and restart', async () => {+ const users = await import('../../../../src/main/features/users');+ users.activateUser(uid);+ const paths = await import('../../../../src/main/paths');+ const state = await import('../../../../src/main/features/group_chat/state');+ await state.setCodingProjectDir(uid, cid, root, { explicit: true });+ await state.setStatus(uid, cid, 'idle');+ const cloudFile = paths.groupChatStateFile(uid, cid);+ expect(JSON.parse(fs.readFileSync(cloudFile, 'utf8')).coding_project_dir).toBeUndefined();+ write(cloudFile, { version: 1, status: 'idle', coding_project_dir: path.join(root, 'remote') });+ await state.setStatus(uid, cid, 'running');+ expect((await state.readState(uid, cid)).coding_project_dir).toBe(root);+ expect(JSON.parse(fs.readFileSync(cloudFile, 'utf8')).coding_project_dir).toBeUndefined();+ expect((await state.readState('other-account', cid)).coding_project_dir).toBeUndefined();+ vi.resetModules();+ const restarted = await import('../../../../src/main/features/group_chat/state');+ expect((await restarted.readState(uid, cid)).coding_project_dir).toBe(root);+ });++ it('retries migration after a legacy source read failure instead of freezing an empty choice', async () => {+ const paths = await import('../../../../src/main/paths');+ const file = paths.groupChatStateFile(uid, cid);+ write(paths.userAgentRuntimeConfigFile(uid), { version: 2, project_dirs: { a: { path: root } } });+ fs.mkdirSync(path.dirname(file), { recursive: true });+ fs.writeFileSync(file, '{interrupted');+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ expect(() => m.readCodingDirectoryFromStateFile(uid, cid, file)).toThrow();+ expect(fs.existsSync(paths.localCliDirectoryFile(uid, cid))).toBe(false);+ expect(fs.readFileSync(file, 'utf8')).toBe('{interrupted');+ write(file, { coding_project_dir: root, coding_project_dir_explicit: true });+ expect(m.readCodingDirectoryFromStateFile(uid, cid, file).coding_project_dir).toBe(root);+ });++ it('does not alter cloud state when preserving a legacy selection fails', async () => {+ const users = await import('../../../../src/main/features/users');+ users.activateUser(uid);+ const paths = await import('../../../../src/main/paths');+ const cloudFile = paths.groupChatStateFile(uid, cid);+ write(cloudFile, { version: 1, status: 'idle', coding_project_dir: root });+ const before = fs.readFileSync(cloudFile, 'utf8');+ // A file occupying the parent directory forces a deterministic migration failure.+ fs.writeFileSync(path.dirname(paths.localCliDirectoryFile(uid, cid)), 'blocked');+ const state = await import('../../../../src/main/features/group_chat/state');+ await expect(state.setStatus(uid, cid, 'running')).rejects.toThrow();+ expect(fs.readFileSync(cloudFile, 'utf8')).toBe(before);+ expect(fs.existsSync(paths.localCliDirectoryFile(uid, cid))).toBe(false);+ fs.rmSync(path.dirname(paths.localCliDirectoryFile(uid, cid)));+ vi.resetModules();+ const restarted = await import('../../../../src/main/features/group_chat/state');+ await restarted.setStatus(uid, cid, 'running');+ const recovered = await restarted.readState(uid, cid);+ expect(recovered).toMatchObject({ status: 'running', coding_project_dir_pending: root });+ expect(recovered.coding_project_dir).toBeUndefined();+ expect(JSON.parse(fs.readFileSync(cloudFile, 'utf8')).coding_project_dir).toBeUndefined();+ });++ it('does not trust sessions from another task, account, or project during an upgrade', async () => {+ const paths = await import('../../../../src/main/paths');+ const directory = path.join(root, 'existing-project');+ fs.mkdirSync(directory);+ const proof = { cli: 'codex', sessionId: 'local-session',+ cwdFingerprint: crypto.createHash('sha256').update(directory).digest('hex') };+ write(paths.localCliSessionsFile(uid, 'other-task'), { a: proof });+ write(paths.localCliSessionsFile('other-account', cid), { a: proof });+ write(paths.localCliSessionsFile(uid, cid), { a: { ...proof, cwdFingerprint: 'different-project' } });+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ expect(m.readCodingDirectory(uid, cid, { coding_project_dir: directory }))+ .toEqual({ coding_project_dir_pending: directory });+ // The matching task still has valid evidence; isolation must not disable migration globally.+ expect(m.readCodingDirectory(uid, 'other-task', { coding_project_dir: directory }).coding_project_dir).toBe(directory);+ expect(m.readCodingDirectory('other-account', cid, { coding_project_dir: directory }).coding_project_dir).toBe(directory);+ });++ it('preserves the previous choice across an interrupted atomic replacement and permits retry after restart', async () => {+ const paths = await import('../../../../src/main/paths');+ const m = await import('../../../../src/main/features/local_agents/project-directory');+ m.writeCodingDirectory(uid, cid, root, true);+ const file = paths.localCliDirectoryFile(uid, cid);+ const before = fs.readFileSync(file, 'utf8');+ const replacement = path.join(root, 'new-project');+ const { syncBuiltinESMExports } = await import('node:module');+ const nativeFs = (await import('node:fs')).default;+ const realRename = nativeFs.renameSync;+ const rename = vi.spyOn(nativeFs, 'renameSync').mockImplementation((source, target) => {+ if (String(target) === file) throw Object.assign(new Error('injected atomic replacement failure'), { code: 'EIO' });+ return realRename(source, target);+ });+ syncBuiltinESMExports();+ try {+ expect(() => m.writeCodingDirectory(uid, cid, replacement, true)).toThrow();+ expect(fs.readFileSync(file, 'utf8')).toBe(before);+ expect(fs.readdirSync(path.dirname(file))).toEqual([path.basename(file)]);+ } finally { rename.mockRestore(); syncBuiltinESMExports(); }+ vi.resetModules();+ const restarted = await import('../../../../src/main/features/local_agents/project-directory');+ expect(restarted.readCodingDirectory(uid, cid).coding_project_dir).toBe(root);+ restarted.writeCodingDirectory(uid, cid, replacement, true);+ expect(restarted.readCodingDirectory(uid, cid).coding_project_dir).toBe(replacement);+ });+});diff --git a/test/main/ipc/connectors.test.ts b/test/main/ipc/connectors.test.tsindex 4ad72051..db618a8c 100644--- a/test/main/ipc/connectors.test.ts+++ b/test/main/ipc/connectors.test.ts@@ -20,6 +20,7 @@ afterEach(() => {vi.doUnmock('../../../src/main/features/component_enabled');vi.doUnmock('../../../src/main/features/connectors/availability');vi.doUnmock('../../../src/main/features/connectors/api-key');+ vi.doUnmock('../../../src/main/features/connectors/local-cli');fs.rmSync(tmpDir, { recursive: true, force: true });});@@ -46,6 +47,72 @@ function baseInstance(transport: any): any {}describe('ipc/connectors renderer DTO', () => {+ it('accepts one-time and task approval responses and rejects unknown scopes', async () => {+ // IPC deliberately uses CJS for the gate; share that module instance.+ const users = require('../../../src/main/features/users') as typeof import('../../../src/main/features/users');+ users.activateUser('approval-ipc');+ const permissions = require('../../../src/main/features/permissions') as typeof import('../../../src/main/features/permissions');+ permissions.setLocalExecMode('all_files_approval');+ const confirm = require('../../../src/main/features/connectors/action_confirm') as typeof import('../../../src/main/features/connectors/action_confirm');+ const { invokeHandlers } = await import('../../../src/main/ipc/connectors');+ let info: any;+ confirm._setBroadcastForTest((_channel, payload) => { info = payload; });+ const opts = { cid: 'ipc-task', connectorId: 'feishu', displayName: 'Feishu', toolName: 'send', risk: 'H' as const, args: {} };+ const once = confirm.requestActionConfirm(opts);+ const answer = invokeHandlers['connectors.action_confirm_response'];+ await expect(answer({ request_id: info.request_id, approved: true, scope: 'forever' })).rejects.toThrow('invalid approval scope');+ await expect(answer({ request_id: info.request_id, approved: true })).resolves.toEqual({ handled: true });+ await expect(once).resolves.toBe(true);+ const task = confirm.requestActionConfirm(opts);+ await expect(answer({ request_id: info.request_id, approved: true, scope: 'task' })).resolves.toEqual({ handled: true });+ await expect(task).resolves.toBe(true);+ await expect(confirm.requestActionConfirm({ ...opts, toolName: 'delete', risk: 'D' })).resolves.toBe(true);+ confirm.cancelForCid(opts.cid);+ confirm._setBroadcastForTest(null);+ });++ it('checks permissions on page verification and explicit refresh, while ordinary listing remains passive', async () => {+ const instance = { ...baseInstance({ kind: 'stdio' }), id: 'feishu', origin: undefined };+ const entry = { id: 'feishu', auth_mode: 'local_cli' };+ const check = vi.fn(async () => undefined);+ vi.doMock('../../../src/main/features/connectors/local-cli', () => ({+ checkLocalCliPermissions: check, localCliMissingPermissions: () => ['im:message.send_as_user'],+ }));+ vi.doMock('../../../src/main/features/connectors', () => ({+ connectorCatalog: () => [entry], listInstances: () => [instance],+ verifyUsableConnectors: async () => 0, refreshTools: async () => [],+ getInstance: () => instance, isValidInstanceId: () => true,+ }));+ const { invokeHandlers } = await import('../../../src/main/ipc/connectors');+ await invokeHandlers['connectors.list']({}, { userId: 'page-user' });+ expect(check).not.toHaveBeenCalled();+ const result = await invokeHandlers['connectors.verify']({}, { userId: 'page-user' });+ expect(check).toHaveBeenCalledWith('page-user', entry);+ expect(result.instances[0]).toMatchObject({ status: { kind: 'connected' }, reauthorization_required: true,+ missing_permissions: ['im:message.send_as_user'] });+ await invokeHandlers['connectors.refresh']({ id: 'feishu' }, { userId: 'page-user' });+ expect(check).toHaveBeenLastCalledWith('page-user', entry, true);+ });++ it('projects missing permissions for a usable Feishu card without exposing identity or granted permissions', async () => {+ const runtime = await import('../../../src/main/features/connectors/local-cli');+ const { _toClientInstanceForTest } = await import('../../../src/main/ipc/connectors');+ const directory = runtime.localCliRuntimeDir('u-ipc', 'feishu');+ fs.mkdirSync(directory, { recursive: true });+ fs.writeFileSync(path.join(directory, '.orkas-user-permissions.json'), JSON.stringify({+ profile: runtime.localCliProfileName('u-ipc', 'feishu'), scopes: ['im:message.send_as_user'],+ }));+ const instance = { ...baseInstance({ kind: 'stdio', command: 'node' }), id: 'feishu', origin: undefined };+ const dto = _toClientInstanceForTest(instance, true, 'u-ipc');+ expect(dto.reauthorization_required).toBe(true);+ expect(dto.status.kind).toBe('connected');+ expect(dto.missing_permissions).toEqual(['im:message.send_as_user']);+ expect(JSON.stringify(dto)).not.toContain('orkas-');+ expect(_toClientInstanceForTest(instance, true, 'another-account').reauthorization_required).toBeUndefined();+ expect(_toClientInstanceForTest({ ...instance, id: 'lark' }, true, 'u-ipc').reauthorization_required).toBeUndefined();+ expect(_toClientInstanceForTest({ ...instance, origin: 'custom' }, true, 'u-ipc').reauthorization_required).toBeUndefined();+ });+it('accepts OAuth start without waiting for the browser callback', async () => {const beginOAuthConnect = vi.fn(() => ({ attempt_id: 'attempt-1' }));vi.doMock('../../../src/main/features/connectors', () => ({diff --git a/test/main/ipc/local_agents-permissions.test.ts b/test/main/ipc/local_agents-permissions.test.tsindex db1d79fa..1b7147bc 100644--- a/test/main/ipc/local_agents-permissions.test.ts+++ b/test/main/ipc/local_agents-permissions.test.ts@@ -110,6 +110,47 @@ describe('ipc/local_agents permission responses', () => {});});+ it('routes cancellation through native confirmation and preserves failed requests for retry', async () => {+ let requestId = '';+ cliUserInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ const cancel = vi.fn().mockResolvedValueOnce('failed').mockResolvedValueOnce('cancelled');+ const pending = cliUserInput.requestUserInput({+ uid: 'u1', cid: 'c1', runId: 'run-input', agentId: 'a1', agentName: 'Agent', cli: 'codex',+ request: { questions: [{ id: 'scope', question: 'Choose scope' }], cancel },+ });+ const payload = { request_id: requestId, answers: {}, cancelled: true };+ await expect(cliUserInputResponse(payload, { userId: 'u2' })).resolves.toEqual({ handled: false });+ expect(cancel).not.toHaveBeenCalled();+ await expect(cliUserInputResponse(payload, { userId: 'u1' })).resolves.toEqual({ handled: false, cancel_failed: true });+ await expect(cliUserInputResponse(payload, { userId: 'u1' })).resolves.toEqual({ handled: true, cancelled: true });+ await expect(pending).resolves.toMatchObject({ cancelled: true });+ expect(cancel).toHaveBeenCalledTimes(2);+ });++ it('keeps an unknown native cancellation unknown across IPC replay and rejects a later answer', async () => {+ let requestId = '';+ cliUserInput._setBroadcastForTest((channel, payload: any) => {+ if (channel === 'local-agent:user-input') requestId = payload.request_id;+ });+ const controller = new AbortController();+ const cancel = vi.fn(async () => 'unknown' as const);+ const pending = cliUserInput.requestUserInput({+ uid: 'u1', cid: 'c1', runId: 'run-input', agentId: 'a1', agentName: 'Agent', cli: 'codex',+ request: { questions: [{ id: 'scope', question: 'Choose scope' }], cancel, signal: controller.signal },+ });+ const payload = { request_id: requestId, answers: {}, cancelled: true };+ await expect(cliUserInputResponse(payload, { userId: 'u1' })).resolves.toEqual({ handled: false, unknown: true });+ await expect(cliUserInputResponse(payload, { userId: 'u1' })).resolves.toEqual({ handled: false, unknown: true });+ await expect(cliUserInputResponse({ request_id: requestId, answers: { scope: ['Late'] } }, { userId: 'u1' }))+ .resolves.toEqual({ handled: false });+ expect(cancel).toHaveBeenCalledOnce();+ controller.abort();+ await expect(pending).resolves.toMatchObject({ cancelled: true });+ await expect(cliUserInputResponse(payload, { userId: 'u1' })).resolves.toEqual({ handled: false, closed: true });+ });+it('delivers a validated external CLI decision to the pending request exactly once', async () => {let requestId = '';cliPermissions._setBroadcastForTest((channel, payload) => {diff --git a/test/main/model/core-agent/connector-meta-tools.test.ts b/test/main/model/core-agent/connector-meta-tools.test.tsindex 3ddb8a66..2106048f 100644--- a/test/main/model/core-agent/connector-meta-tools.test.ts+++ b/test/main/model/core-agent/connector-meta-tools.test.ts@@ -58,7 +58,8 @@ vi.mock('../../../../src/main/features/connectors/install_confirm', () => ({requestInstallConfirm: async () => fixtures.installApproved,}));-vi.mock('../../../../src/main/features/connectors/action_confirm', () => ({+vi.mock('../../../../src/main/features/connectors/action_confirm', async (importOriginal) => ({+ ...await importOriginal<typeof import('../../../../src/main/features/connectors/action_confirm')>(),requestActionConfirm: async (opts: Parameters<RequestActionConfirm>[0]) => {fixtures.actionConfirmCalls.push(opts);if (fixtures.actionConfirmImpl) return fixtures.actionConfirmImpl(opts);@@ -944,6 +945,51 @@ describe('call_connector_tool', () => {}});+ it('reuses task approval across actions and metadata refresh but asks again for a replacement account', async () => {+ const users = await import('../../../../src/main/features/users');+ users.activateUser(UID);+ const permissions = await import('../../../../src/main/features/permissions');+ permissions.setLocalExecMode('all_files_approval');+ const confirm = await vi.importActual<typeof import('../../../../src/main/features/connectors/action_confirm')>(+ '../../../../src/main/features/connectors/action_confirm',+ );+ fixtures.actionConfirmImpl = confirm.requestActionConfirm;+ let prompts = 0;+ confirm._setBroadcastForTest((channel, payload: any) => {+ if (channel !== 'connectors:action-confirm') return;+ prompts += 1;+ queueMicrotask(() => confirm.respond(payload.request_id, prompts === 1, 'task'));+ });+ fixtures.instances = [makeInstance({ id: 'gmail', tools: [+ { name: 'GMAIL_SEND_EMAIL', description: 'Send mail.', input_schema: {} },+ { name: 'trash_message', description: 'Trash mail.', input_schema: {} },+ { name: 'GMAIL_BATCH_DELETE_MESSAGES', description: 'Batch delete.', input_schema: {} },+ ], composio_grant: { connection_id: 'account-a', toolkit: 'gmail', auth_config_id: 'config', account_label: 'Same label' } })];+ const execute = vi.fn(async () => 'completed');+ fixtures.callTool = execute;+ try {+ const { createConnectorMetaTools } = await loadModule();+ const [, call] = await createConnectorMetaTools({ userId: UID, cid: 'account-bound-grant' });+ const invoke = (name: string) => runTool(call, { connector_id: 'gmail', tool_name: name, args: {} });+ expect((await invoke('GMAIL_SEND_EMAIL')).isError).not.toBe(true);+ // Metadata refresh does not change the authorized account.+ fixtures.instances[0] = { ...fixtures.instances[0], updated_at: '2026-09-10T12:00:00Z' };+ expect((await invoke('trash_message')).isError).not.toBe(true);+ expect(prompts).toBe(1);+ expect(execute).toHaveBeenCalledTimes(2);+ expect((await invoke('GMAIL_BATCH_DELETE_MESSAGES')).isError).toBe(true);+ expect(execute).toHaveBeenCalledTimes(2);+ fixtures.instances[0].composio_grant!.connection_id = 'account-b';+ expect((await invoke('GMAIL_SEND_EMAIL')).isError).toBe(true);+ expect(prompts).toBe(2);+ expect(execute).toHaveBeenCalledTimes(2);+ } finally {+ confirm.cancelForCid('account-bound-grant');+ confirm._setBroadcastForTest(null);+ fixtures.actionConfirmImpl = undefined;+ }+ });+it('hides a forbidden action from a stale cache and rejects a forged direct call', async () => {fixtures.instances = [makeInstance({ id: 'gmail', tools: [{ name: 'GMAIL_FETCH_EMAILS', description: 'Read', input_schema: {} },diff --git a/test/main/model/core-agent/external-provider-request-parity.test.ts b/test/main/model/core-agent/external-provider-request-parity.test.tsindex a76de41e..117a62b8 100644--- a/test/main/model/core-agent/external-provider-request-parity.test.ts+++ b/test/main/model/core-agent/external-provider-request-parity.test.ts@@ -20,8 +20,14 @@ describe('external provider request policy', () => {expect(payload.messages[1]).not.toHaveProperty('tool_call_id');});- it('does not silently choose low reasoning for a direct DeepSeek request', async () => {- await createDeepSeekProvider({ apiKey: 'fixture', modelId: 'deepseek-v4-flash' });+ it.each(['deepseek-v4-flash', 'deepseek-flash'])('does not silently choose low reasoning for a direct %s request', async (modelId) => {+ await createDeepSeekProvider({ apiKey: 'fixture', modelId });expect(configs.at(-1).defaultReasoning).toBeUndefined();+ expect(configs.at(-1).customModel).toMatchObject({ id: modelId, reasoning: true });+ if (modelId === 'deepseek-flash') {+ expect(configs.at(-1).customModel).toMatchObject({+ name: 'DeepSeek V4.1 Flash', input: ['text', 'image'], contextWindow: 1_048_576, maxTokens: 384_000,+ });+ }});});diff --git a/test/main/model/core-agent/external-providers.test.ts b/test/main/model/core-agent/external-providers.test.tsindex c91453c4..e4e074c3 100644--- a/test/main/model/core-agent/external-providers.test.ts+++ b/test/main/model/core-agent/external-providers.test.ts@@ -7,7 +7,7 @@ import {buildOrkasApiModel,createMoonshotProvider,} from '../../../../src/main/model/core-agent/external-providers';-import { modelInputImageLimit } from '../../../../src/main/model/provider_catalog';+import { isSelectableModel, modelInputImageLimit } from '../../../../src/main/model/provider_catalog';describe('external-providers › custom OpenAI-compatible model', () => {const runtimeConfig = {@@ -95,6 +95,18 @@ describe('external-providers › DeepSeek model capabilities', () => {expect(modelInputImageLimit('deepseek', 'deepseek-v4-flash-vision-exp', model)).toBe(20);});+ it('selects the canonical V4.1 Flash alias with vision and reasoning capabilities', () => {+ expect(isSelectableModel('deepseek', 'deepseek-flash')).toBe(true);+ const model = buildDeepSeekModel('deepseek-flash');+ expect(model).toMatchObject({+ id: 'deepseek-flash', name: 'DeepSeek V4.1 Flash',+ api: 'openai-completions', baseUrl: 'https://api.deepseek.com/v1',+ reasoning: true, input: ['text', 'image'],+ contextWindow: 1_048_576, maxTokens: 384_000,+ });+ expect(modelInputImageLimit('deepseek', 'deepseek-flash', model)).toBe(20);+ });+it('defaults unknown direct DeepSeek models to vision while known aliases remain text-only', () => {expect(buildDeepSeekModel('deepseek-next').input).toEqual(['text', 'image']);expect(buildDeepSeekModel('deepseek-v4-flash').input).toEqual(['text']);diff --git a/test/main/model/provider_catalog.test.ts b/test/main/model/provider_catalog.test.tsindex ce2a520e..7d076612 100644--- a/test/main/model/provider_catalog.test.ts+++ b/test/main/model/provider_catalog.test.ts@@ -200,6 +200,39 @@ describe('provider_catalog › CURATED_MODELS', () => {]);});+ it('resolves the OpenRouter V4.1 Flash shortcut with vision before the SDK catalogs it', () => {+ const modelId = 'deepseek/deepseek-v4.1-flash';+ const catalog = {+ getPiModel(provider: string, id: string) {+ if (provider === 'openrouter' && id === modelId) return undefined;+ return (getBuiltinModel as (p: string, m: string) => any)(provider, id);+ },+ };+ expect(curatedModelsFor('openrouter')).toContainEqual(expect.objectContaining({+ id: modelId,+ name: 'DeepSeek V4.1 Flash',+ }));+ const resolved = resolveConfiguredPiModel(catalog, 'openrouter', modelId);+ expect(resolved).toMatchObject({+ requestedModelId: modelId,+ isConfiguredFallback: true,+ needsCustomModel: true,+ model: {+ id: modelId,+ name: 'DeepSeek V4.1 Flash',+ provider: 'openrouter',+ api: 'openai-completions',+ baseUrl: 'https://openrouter.ai/api/v1',+ reasoning: true,+ input: ['text', 'image'],+ contextWindow: 1_048_576,+ maxTokens: 384_000,+ compat: { thinkingFormat: 'openrouter', requiresReasoningContentOnAssistantMessages: true },+ },+ });+ expect(modelInputImageLimit('openrouter', modelId, resolved?.model)).toBe(20);+ });+it('curatedModelsFor returns a shallow copy safe to mutate', () => {const a = curatedModelsFor('anthropic');const b = curatedModelsFor('anthropic');@@ -208,6 +241,39 @@ describe('provider_catalog › CURATED_MODELS', () => {expect(curatedModelsFor('anthropic').length).toBe(b.length);});+ it('resolves the OpenRouter V4.1 Flash shortcut with vision before the SDK catalogs it', () => {+ const modelId = 'deepseek/deepseek-v4.1-flash';+ const catalog = {+ getPiModel(provider: string, id: string) {+ if (provider === 'openrouter' && id === modelId) return undefined;+ return (getBuiltinModel as (p: string, m: string) => any)(provider, id);+ },+ };+ expect(curatedModelsFor('openrouter')).toContainEqual(expect.objectContaining({+ id: modelId,+ name: 'DeepSeek V4.1 Flash',+ }));+ const resolved = resolveConfiguredPiModel(catalog, 'openrouter', modelId);+ expect(resolved).toMatchObject({+ requestedModelId: modelId,+ isConfiguredFallback: true,+ needsCustomModel: true,+ model: {+ id: modelId,+ name: 'DeepSeek V4.1 Flash',+ provider: 'openrouter',+ api: 'openai-completions',+ baseUrl: 'https://openrouter.ai/api/v1',+ reasoning: true,+ input: ['text', 'image'],+ contextWindow: 1_048_576,+ maxTokens: 384_000,+ compat: { thinkingFormat: 'openrouter', requiresReasoningContentOnAssistantMessages: true },+ },+ });+ expect(modelInputImageLimit('openrouter', modelId, resolved?.model)).toBe(20);+ });+it('curatedModelsFor returns [] for unknown providers (triggers pi-ai fallback)', () => {expect(curatedModelsFor('no-such-provider-id')).toEqual([]);});diff --git a/test/main/model/public_model_catalog.test.ts b/test/main/model/public_model_catalog.test.tsindex 2541f535..8fdcd448 100644--- a/test/main/model/public_model_catalog.test.ts+++ b/test/main/model/public_model_catalog.test.ts@@ -48,21 +48,29 @@ describe('public model catalog', () => {]);});- it('publishes the DeepSeek V4 vision model with its official limits', () => {+ it('publishes DeepSeek V4.1 Flash and the V4 models with their official limits', () => {expect(PUBLIC_PROVIDER_MODELS.deepseek?.map((model) => model.id)).toEqual([+ 'deepseek-flash','deepseek-v4-pro','deepseek-v4-flash-vision-exp','deepseek-v4-flash',]);- expect(PUBLIC_PROVIDER_MODELS.deepseek?.[1]).toMatchObject({+ expect(PUBLIC_PROVIDER_MODELS.deepseek?.[0]).toMatchObject({+ name: 'DeepSeek V4.1 Flash',+ contextWindow: 1_048_576,+ maxTokens: 384_000,+ supportsVision: true,+ maxInputImages: 600,+ });+ expect(PUBLIC_PROVIDER_MODELS.deepseek?.[2]).toMatchObject({name: 'DeepSeek V4 Flash Vision',contextWindow: 1_048_576,maxTokens: 384_000,supportsVision: true,maxInputImages: 600,});- expect(PUBLIC_PROVIDER_MODELS.deepseek?.[0]).toMatchObject({ supportsVision: false });- expect(PUBLIC_PROVIDER_MODELS.deepseek?.[2]).toMatchObject({ supportsVision: false });+ expect(PUBLIC_PROVIDER_MODELS.deepseek?.[1]).toMatchObject({ supportsVision: false });+ expect(PUBLIC_PROVIDER_MODELS.deepseek?.[3]).toMatchObject({ supportsVision: false });});it('keeps the explicitly curated OpenRouter shortcut set', () => {@@ -79,6 +87,7 @@ describe('public model catalog', () => {'google/gemini-3.7-flash','google/gemini-3.1-pro-preview','google/gemini-3.5-flash-lite',+ 'deepseek/deepseek-v4.1-flash','deepseek/deepseek-v4-pro','deepseek/deepseek-v4-flash-0731','moonshotai/kimi-k3',diff --git a/test/main/util/native-prepare-cache.test.ts b/test/main/util/native-prepare-cache.test.tsindex f96b5f72..7e1ef6f7 100644--- a/test/main/util/native-prepare-cache.test.ts+++ b/test/main/util/native-prepare-cache.test.ts@@ -109,6 +109,7 @@ describe('native preparation cache', () => {cache.writeMarker(root, state);expect(cache.markerMatches(root, state, [required], () => true)).toBe(true);+ expect(cache.markerMatches(root, { ...state, scriptHashes: { prepare: 'changed-shared-contract' } }, [required], () => true)).toBe(false);expect(cache.markerMatches(root, { ...state, arch: 'x64' }, [required], () => true)).toBe(false);expect(cache.markerMatches(root, state, [required], () => false)).toBe(false);fs.rmSync(required);diff --git a/test/renderer/bash-permission.test.ts b/test/renderer/bash-permission.test.tsindex 102efc13..1a55e18e 100644--- a/test/renderer/bash-permission.test.ts+++ b/test/renderer/bash-permission.test.ts@@ -178,6 +178,7 @@ class FakeDocument {interface DialogView {title: string;message: string;+ summary: string;currentMode: string;modeLabel: string;modes: Array<{ mode: string; label: string; desc: string }>;@@ -194,6 +195,9 @@ function dialogView(overlay: FakeElement): DialogView {return {title: text('.ui-dialog-title'),message: text('.bash-permission-message'),+ summary: (overlay.querySelector('.bash-permission-message')?.children ?? [])+ .filter((child) => typeof child === 'string' || child.tag !== 'details')+ .map((child) => typeof child === 'string' ? child : child.tag === 'br' ? '\n' : child.textContent).join(''),currentMode: options.find((option) => option.attrs['aria-selected'] === 'true')?.dataset.mode ?? '',modeLabel: text('.bash-permission-mode-trigger-label'),modes: options.map((option) => ({@@ -215,6 +219,7 @@ type Choice = 'allow_once' | 'allow_run' | 'deny';type UserAction = 'pending' | Choice | { choice: Choice; mode?: string };interface HarnessOptions {+ locale?: 'zh' | 'en' | 'ja' | 'pt';visibility?: { state: 'visible' | 'hidden'; focused?: boolean };// Dialogs whose `document.createElement` throws before elements work again// (the broken-dialog negative control).@@ -247,6 +252,9 @@ function loadHarness(invokeImpl?: (channel: string, payload: any) => Promise<any>,options: HarnessOptions = {},) {+ const localeStrings: Record<string, string> | undefined = options.locale+ ? JSON.parse(fs.readFileSync(path.join(__dirname, '../../src/renderer/locales', `${options.locale}.json`), 'utf8'))+ : undefined;let pushHandler: ((info: any) => void) | null = null;let cancelHandler: ((info: any) => void) | null = null;let localAgentPushHandler: ((info: any) => void) | null = null;@@ -318,7 +326,7 @@ function loadHarness('agents.cli_permission_full_access_desc': 'Automatically approve requests','agents.cli_permission_mode_hint': 'Change this in AI Team > {agent} > Runtime settings > Permission level.',};- let text = dict[key] || key;+ let text = (localeStrings ? localeStrings[key] : dict[key]) || key;for (const [k, v] of Object.entries(vars || {})) {text = text.replace(new RegExp('\\{' + k + '\\}', 'g'), String(v));}@@ -382,12 +390,114 @@ async function flush() {describe('connector actions share local operation permissions', () => {const action = {- request_id: 'connector-request', cid: 'task-1', connector_id: 'feishu',+ request_id: 'connector-request', cid: 'task-1', connector_id: 'feishu', can_allow_run: true,display_name: 'Feishu', account_label: 'Work account', tool_name: 'execute_high_impact',+ action_name: 'im.+messages-send',risk: 'H', sensitive_operation: 'external_action',arguments_preview: '{"action":"im.+messages-send","text":"private-message"}',};+ it.each([+ { locale: 'zh', risk: 'H', connector: '连接器', operation: '操作', title: '允许这项敏感操作吗?' },+ { locale: 'en', risk: 'D', connector: 'Connector', operation: 'Action', title: 'Allow this sensitive action?' },+ { locale: 'ja', risk: 'H', connector: 'コネクター', operation: '操作', title: 'この機密操作を許可しますか?' },+ { locale: 'pt', risk: 'D', connector: 'Conector', operation: 'Ação', title: 'Permitir esta ação sensível?' },+ ] as const)('shows a localized two-line summary and collapsed details in $locale ($risk)', async ({ locale, risk, connector, operation, title }) => {+ const h = loadHarness('pending', undefined, { locale });+ h.emitPush('connectors:action-confirm', { ...action, risk, arguments_preview: '<img src=x onerror=alert(1)>' });+ await flush();+ expect(h.dialogs[0].title).toBe(title);+ expect(h.dialogs[0].summary).toBe(`${connector}: Feishu\n${operation}: im.+messages-send`);+ expect(h.document.body.textContent).not.toMatch(/connectors\.action_confirm\.|bash\.permission\./);+ const details = h.document.body.querySelector('.bash-permission-details')!;+ expect(details.tag).toBe('details');+ expect(details.getAttribute('open')).toBeNull();+ expect(details.children.filter((child) => typeof child !== 'string' && child.tag === 'pre')+ .map((child) => (child as FakeElement).textContent)).toEqual(['<img src=x onerror=alert(1)>']);+ expect(details.textContent).toContain('<img src=x onerror=alert(1)>');+ expect([...details.descendants()].some((node) => node.tag === 'img')).toBe(false);+ h.emitPush('connectors:action-confirm-cancelled', { request_ids: [action.request_id] });+ await flush();+ });++ it('keeps a legacy request actionable without guessing from its parameter preview or offering task approval', async () => {+ const h = loadHarness('pending', undefined, { locale: 'zh' });+ h.emitPush('connectors:action-confirm', {+ ...action, action_name: undefined, can_allow_run: undefined, account_label: '', sensitive_operation: 'unknown_type',+ });+ await flush();+ expect(h.dialogs[0].summary).toBe('连接器: Feishu\n操作: execute_high_impact');+ expect(h.dialogs[0].choices).toEqual(['allow_once']);+ expect(h.dialogs[0].message).not.toContain('本次任务内允许');+ expect(h.dialogs[0].message).not.toContain('当前已连接账号');+ expect(h.dialogs[0].message).not.toContain('unknown_type');+ h.document.body.querySelector('[data-id="allow_once"]')!.click();+ await flush();+ expect(h.invokeCalls).toContainEqual({+ channel: 'connectors.action_confirm_response', payload: { request_id: action.request_id, approved: true },+ });+ expect(h.openDialogs()).toBe(0);+ });++ it('renders connector and operation markup as literal text and keeps it out of telemetry', async () => {+ const h = loadHarness('pending');+ const markup = '<img src=x onerror=alert(1)>';+ h.emitPush('connectors:action-confirm', { ...action, connector_id: 'custom-markup', display_name: markup, action_name: markup });+ await flush();+ expect(h.dialogs[0].summary).toContain(markup);+ expect([...h.document.body.descendants()].some((node) => node.tag === 'img')).toBe(false);+ h.document.body.querySelector('[data-act="cancel"]')!.click();+ await flush();+ expect(JSON.stringify(h.monitorEvent.mock.calls)).not.toContain(markup);+ expect(h.invokeCalls).toContainEqual({+ channel: 'connectors.action_confirm_response', payload: { request_id: action.request_id, approved: false },+ });+ });++ it('shows empty parameters without restoring removed metadata when the preview is missing', async () => {+ const h = loadHarness('pending', undefined, { locale: 'zh' });+ h.emitPush('connectors:action-confirm', { ...action, arguments_preview: undefined });+ await flush();+ expect(h.dialogs[0].message).toBe('连接器: Feishu\n操作: im.+messages-send查看详情{}');+ h.document.body.querySelector('[data-act="cancel"]')!.click();+ await flush();+ expect(h.openDialogs()).toBe(0);+ });++ it('sends a task-scoped approval without changing the global permission mode', async () => {+ const h = loadHarness('allow_run');+ h.emitPush('connectors:action-confirm', action);+ await flush();+ expect(h.invokeCalls).toEqual([+ { channel: 'permissions.getLocalExec', payload: undefined },+ { channel: 'connectors.action_confirm_response', payload: { request_id: action.request_id, approved: true, scope: 'task' } },+ ]);+ });++ it('omits task approval unless the host explicitly permits it', async () => {+ const h = loadHarness('allow_once');+ h.emitPush('connectors:action-confirm', { ...action, can_allow_run: false });+ await flush();+ expect(h.dialogs[0].allowRun).toBe(false);+ });++ it('dismisses active and queued approvals covered by a task grant without sending another decision', async () => {+ const h = loadHarness('pending');+ h.emitPush('connectors:action-confirm', action);+ h.emitPush('connectors:action-confirm', { ...action, request_id: 'queued-grant' });+ await flush();+ h.emitPush('connectors:action-confirm-cancelled', {+ request_ids: [action.request_id, 'queued-grant'], approved: true,+ });+ await flush();+ expect(h.openDialogs()).toBe(0);+ expect(h.dialogs).toHaveLength(1);+ expect(h.invokeCalls.every((call) => call.channel === 'permissions.getLocalExec')).toBe(true);+ const outcomes = h.monitorEvent.mock.calls.filter(([name]) => name === 'connector_action_confirmation_result');+ expect(outcomes).toHaveLength(2);+ for (const [, outcome] of outcomes) expect(outcome).toMatchObject({ decision: 'approved', result: 'success' });+ });+it.each(['built-in', 'codex', 'claude'])('shows the local mode menu for %s connector calls', async (caller) => {const h = loadHarness('allow_once');h.emitPush('connectors:action-confirm', {@@ -400,15 +510,16 @@ describe('connector actions share local operation permissions', () => {expect(h.dialogs).toHaveLength(1);expect(h.dialogs[0]).toMatchObject({title: 'Allow this sensitive action?', currentMode: 'all_files_approval', modeLabel: 'Standard',- showModeControl: true, allowRun: false,+ showModeControl: true, allowRun: true,modeHint: 'You can change this in Settings - General - Local operation permissions.',});expect(h.dialogs[0].modes.map((item: any) => item.mode)).toEqual(['workspace_approval', 'all_files_approval', 'all_files_auto',]);- for (const detail of ['Feishu', 'Work account', 'execute_high_impact', 'im.+messages-send', 'private-message']) {+ for (const detail of ['Feishu', 'im.+messages-send', 'private-message']) {expect(h.dialogs[0].message).toContain(detail);}+ expect(h.dialogs[0].message).not.toMatch(/Work account|execute_high_impact/);expect(h.invokeCalls).toEqual([{ channel: 'permissions.getLocalExec', payload: undefined },{ channel: 'connectors.action_confirm_response', payload: { request_id: action.request_id, approved: true } },diff --git a/test/renderer/cli-async-input.test.ts b/test/renderer/cli-async-input.test.tsindex ccbb4f66..619f38a4 100644--- a/test/renderer/cli-async-input.test.ts+++ b/test/renderer/cli-async-input.test.ts@@ -20,7 +20,12 @@ class Element {constructor(public tagName = 'div') {}appendChild(el: Element) { el.remove(); this.children.push(el); el.parentElement = this; return el; }replaceChildren() { this.children = []; }- setAttribute() {}+ attributes = new Map<string, string>();+ placeholder = '';+ rows = 0;+ maxLength = 0;+ type = '';+ setAttribute(name?: string, value?: string) { if (name) this.attributes.set(name, String(value)); }addEventListener(type: string, listener: () => any) { this.listeners.set(type, listener); }async fire(type: string) { if (type !== 'click' || !this.disabled) await this.listeners.get(type)?.(); }all(tag: string): Element[] { return this.children.flatMap(el => [...(el.tagName === tag ? [el] : []), ...el.all(tag)]); }@@ -42,6 +47,31 @@ function load(expiresAt?: number) {}const send = (host: Element) => host.all('button').find(el => el.textContent === 'chat.cli_question.send')!;+/** A blocking request card: same dock, same markup, caller-owned delivery. */+function loadRequest(questions: any[], overrides: Record<string, any> = {}) {+ const dock = new Element();+ const context: any = {+ Date, setTimeout, clearTimeout,+ window: { orkas: { invoke: vi.fn() }, addEventListener() {} },+ document: { getElementById: () => dock, createElement: (tag: string) => new Element(tag), addEventListener() {} },+ t: (key: string) => key,+ };+ vm.runInNewContext(fs.readFileSync(path.resolve(__dirname, '../../src/renderer/modules/cli_async_input.js'), 'utf8'), context);+ const api = context.window.CliAsyncInput;+ const submit = vi.fn(async () => true);+ const cancel = vi.fn(async () => 'closed');+ const onClosed = vi.fn();+ api.showConversation('chat-1');+ const close = api.showCliInputRequest({+ requestId: 'request-1', cid: 'chat-1', actorLabel: 'Orkas Codex',+ questions, submit, cancel, onClosed, ...overrides,+ });+ const host = dock.children[0];+ return { api, dock, host, close, submit, cancel, onClosed, context };+}+const cardButton = (host: Element, text: string) => host.all('button').find(el => el.textContent === text)!;+const cardInputs = (host: Element) => host.all('textarea');+describe('native asynchronous question drafts and delivery', () => {it('keeps a draft answerable after twenty minutes and ignores a previously stored host deadline', async () => {vi.useFakeTimers();@@ -144,6 +174,187 @@ describe('native asynchronous question drafts and delivery', () => {});+describe('blocking native request card', () => {+ const questions = [{+ id: 'target', header: '推送目标', question: '这次提交推到哪个远端分支?',+ options: [+ { label: '新建 origin/release_2.0.0', description: '远端会出现一条新的发布分支。' },+ { label: '推进 origin/release_1.7.0' },+ ],+ }];++ it('answers through the caller\'s delivery and leaves the dock when it settles', async () => {+ const { dock, host, submit, onClosed } = loadRequest(questions);+ expect(dock.children).toHaveLength(1);+ expect(host.all('div').find(el => el.className === 'form-title')!.textContent)+ .toBe('Orkas Codex · chat.cli_question.title');+ // The question, its options and the free-text box are one field.+ expect(host.all('label')[0].textContent).toBe('推送目标 · 这次提交推到哪个远端分支?');+ // One row per described option, its name split out so a wrapped+ // description cannot read as the next option's opening line.+ const described = host.all('div').filter(el => el.className === 'form-field-desc-option');+ expect(described).toHaveLength(1);+ expect(described[0].all('span').map(el => el.textContent))+ .toEqual(['新建 origin/release_2.0.0:', '远端会出现一条新的发布分支。']);+ expect(cardInputs(host)).toHaveLength(1);+ // Nothing is implicit: send stays closed until there is an answer.+ expect(cardButton(host, 'chat.cli_question.send').disabled).toBe(true);++ await cardButton(host, '新建 origin/release_2.0.0').fire('click');+ expect(cardInputs(host)[0].value).toBe('新建 origin/release_2.0.0');+ expect(cardButton(host, '新建 origin/release_2.0.0').className).toContain('is-selected');+ expect(cardButton(host, 'chat.cli_question.send').disabled).toBe(false);++ await cardButton(host, 'chat.cli_question.send').fire('click');+ expect(submit).toHaveBeenCalledWith(['新建 origin/release_2.0.0'], [['新建 origin/release_2.0.0']]);+ expect(onClosed).toHaveBeenCalledOnce();+ expect(dock.children).toHaveLength(0);+ });++ it('keeps the card and reports a failed delivery so the answer can be retried', async () => {+ const { dock, host, onClosed } = loadRequest(questions, { submit: vi.fn(async () => false) });+ await cardButton(host, '推进 origin/release_1.7.0').fire('click');+ await cardButton(host, 'chat.cli_question.send').fire('click');+ expect(host.all('div').find(el => el.className === 'form-error')!.textContent)+ .toBe('chat.cli_question.send_failed');+ expect(onClosed).not.toHaveBeenCalled();+ expect(dock.children).toHaveLength(1);+ expect(cardButton(host, 'chat.cli_question.send').disabled).toBe(false);+ });++ it('sends a declined request through cancel and drops a typed-over option', async () => {+ const declined = loadRequest(questions);+ await cardButton(declined.host, 'common.cancel').fire('click');+ expect(declined.cancel).toHaveBeenCalledOnce();+ expect(declined.submit).not.toHaveBeenCalled();+ expect(declined.dock.children).toHaveLength(0);++ const edited = loadRequest(questions);+ await cardButton(edited.host, '推进 origin/release_1.7.0').fire('click');+ const input = cardInputs(edited.host)[0];+ input.value = '推到 main';+ await input.fire('input');+ expect(cardButton(edited.host, '推进 origin/release_1.7.0').className).not.toContain('is-selected');+ await cardButton(edited.host, 'chat.cli_question.send').fire('click');+ // A label the user typed over must not travel back as a selected option.+ expect(edited.submit).toHaveBeenCalledWith(['推到 main'], [[]]);+ });++ it('accumulates a multi-select answer and asks every question before sending', async () => {+ const { host, submit } = loadRequest([+ { id: 'scope', question: 'Which areas?', multiSelect: true, options: [{ label: 'Docs' }, { label: 'Tests' }] },+ { id: 'note', question: 'Anything to add?' },+ ]);+ expect(cardInputs(host)).toHaveLength(2);+ await cardButton(host, 'Docs').fire('click');+ await cardButton(host, 'Tests').fire('click');+ expect(cardInputs(host)[0].value).toBe('Docs, Tests');+ // The second question is still unanswered, so nothing may be sent yet.+ expect(cardButton(host, 'chat.cli_question.send').disabled).toBe(true);+ cardInputs(host)[1].value = 'ship it';+ await cardInputs(host)[1].fire('input');+ await cardButton(host, 'chat.cli_question.send').fire('click');+ expect(submit).toHaveBeenCalledWith(['Docs, Tests', 'ship it'], [['Docs', 'Tests'], []]);+ });++ it('shows the card only in its own conversation and refuses a duplicate request id', () => {+ const first = loadRequest(questions);+ expect(first.dock.children).toHaveLength(1);+ first.api.showConversation('chat-2');+ expect(first.dock.children).toHaveLength(0);+ first.api.showConversation('chat-1');+ expect(first.dock.children).toHaveLength(1);+ expect(first.api.showCliInputRequest({+ requestId: 'request-1', cid: 'chat-1', questions, submit: vi.fn(), cancel: vi.fn(),+ })).toBeNull();+ });++ it('hides a cancelling card, retries once, and restores its answer without a message if both attempts fail', async () => {+ const cancel = vi.fn(async () => 'failed');+ const h = loadRequest(questions, { cancel });+ await cardButton(h.host, '推进 origin/release_1.7.0').fire('click');+ const pending = cardButton(h.host, 'common.cancel').fire('click');+ expect(h.dock.children).toHaveLength(0);+ await pending;+ expect(cancel).toHaveBeenCalledTimes(2);+ expect(h.dock.children).toEqual([h.host]);+ expect(cardInputs(h.host)[0].value).toBe('推进 origin/release_1.7.0');+ expect(cardButton(h.host, 'common.cancel').disabled).toBe(false);+ expect(h.host.all('div').find(el => el.className === 'form-error')!.textContent).toBe('');+ cancel.mockResolvedValueOnce('closed');+ await cardButton(h.host, 'common.cancel').fire('click');+ expect(h.dock.children).toHaveLength(0);+ expect(h.onClosed).toHaveBeenCalledOnce();+ expect(h.submit).not.toHaveBeenCalled();+ });++ it('restores a failed cancellation only in its original conversation and preserves multi-select answers', async () => {+ let failRetry!: (value: string) => void;+ const cancel = vi.fn(async () => 'failed').mockImplementationOnce(() =>+ new Promise<string>(resolve => { failRetry = resolve; }));+ const h = loadRequest([{+ id: 'checks', question: 'Which checks?', multiSelect: true,+ options: [{ label: 'Unit, fast' }, { label: 'Integration' }],+ }], { cancel });+ await cardButton(h.host, 'Unit, fast').fire('click');+ await cardButton(h.host, 'Integration').fire('click');+ const pending = cardButton(h.host, 'common.cancel').fire('click');+ await cardButton(h.host, 'common.cancel').fire('click');+ expect(cancel).toHaveBeenCalledOnce();+ h.api.showConversation('chat-2');+ failRetry('failed');+ await pending;+ expect(cancel).toHaveBeenCalledTimes(2);+ expect(h.dock.children).toHaveLength(0);+ h.api.showConversation('chat-1');+ expect(h.dock.children).toEqual([h.host]);+ expect(cardInputs(h.host)[0].value).toBe('Unit, fast, Integration');+ expect(cardButton(h.host, 'Unit, fast').attributes.get('aria-pressed')).toBe('true');+ expect(cardButton(h.host, 'Integration').attributes.get('aria-pressed')).toBe('true');+ await cardButton(h.host, 'chat.cli_question.send').fire('click');+ expect(h.submit).toHaveBeenCalledWith(['Unit, fast, Integration'], [['Unit, fast', 'Integration']]);+ expect(h.dock.children).toHaveLength(0);+ });++ it.each(['unknown', 'ipc-error', 'failed-then-unknown', 'malformed'])('keeps an uncertain cancellation hidden without retry or message: %s', async outcome => {+ const cancel = vi.fn(async () => 'unknown');+ if (outcome === 'ipc-error') cancel.mockRejectedValueOnce(new Error('reply lost'));+ if (outcome === 'failed-then-unknown') cancel.mockResolvedValueOnce('failed');+ if (outcome === 'malformed') cancel.mockResolvedValueOnce(undefined as any);+ const h = loadRequest(questions, { cancel });+ await cardButton(h.host, 'common.cancel').fire('click');+ expect(cancel).toHaveBeenCalledTimes(outcome === 'failed-then-unknown' ? 2 : 1);+ expect(h.dock.children).toHaveLength(0);+ expect(h.onClosed).toHaveBeenCalledOnce();+ expect(h.host.all('div').find(el => el.className === 'form-error')!.textContent).toBe('');+ h.api.showConversation('chat-2');+ h.api.showConversation('chat-1');+ h.close(); // A late CLI withdrawal must not resurrect or close it twice.+ expect(h.dock.children).toHaveLength(0);+ expect(h.onClosed).toHaveBeenCalledOnce();+ expect(h.submit).not.toHaveBeenCalled();+ });++ it('keeps the card closed when cancellation succeeds on retry or the CLI withdraws during cancellation', async () => {+ const cancel = vi.fn(async () => 'closed').mockResolvedValueOnce('failed');+ const retried = loadRequest(questions, { cancel });+ await cardButton(retried.host, 'common.cancel').fire('click');+ expect(cancel).toHaveBeenCalledTimes(2);+ expect(retried.dock.children).toHaveLength(0);++ let finish!: (value: string) => void;+ const slowCancel = vi.fn(() => new Promise<string>(resolve => { finish = resolve; }));+ const withdrawn = loadRequest(questions, { cancel: slowCancel });+ const pending = cardButton(withdrawn.host, 'common.cancel').fire('click');+ withdrawn.close();+ finish('failed');+ await pending;+ expect(slowCancel).toHaveBeenCalledOnce();+ expect(withdrawn.dock.children).toHaveLength(0);+ expect(withdrawn.onClosed).toHaveBeenCalledOnce();+ });+});+describe('composer question dock', () => {it('shows questions only in their conversation, retains a draft without rebuilding focused controls, and retracts on answer', async () => {const h = load();diff --git a/test/renderer/connectors-degraded-card.test.ts b/test/renderer/connectors-degraded-card.test.tsindex 3b4483bf..29b8eeb2 100644--- a/test/renderer/connectors-degraded-card.test.ts+++ b/test/renderer/connectors-degraded-card.test.ts@@ -49,11 +49,65 @@ function makeElement(tag: string): any {}describe('connector setup assistance', () => {+ it.each(['feishu', 'dingtalk', 'wecom'])('shows %s missing permissions alongside both Use and Reauthorize', id => {+ const ctx = loadConnectorsRenderer();+ ctx.t = (key: string, args: any = {}) => `${key} ${args.permissions || ''}`.trim();+ const entry = { id, display_name: 'Lark', auth_mode: 'local_cli' };+ const card = ctx._renderCatalogCard(entry, { id, status: { kind: 'connected' },+ reauthorization_required: true, missing_permissions: id === 'wecom' ? [] : [id === 'feishu' ? 'im:message.send_as_user' : 'chat.message:send'] });+ expect(card.innerHTML).toContain('data-act="use-connector"');+ expect(card.innerHTML).toContain('connectors.action.authorize_permissions');+ expect(card.querySelector('[data-role="permission-notice"]').textContent)+ .toBe(id === 'wecom' ? 'connectors.permissions.limited' : 'connectors.permissions.missing connectors.permissions.send_as_user');+ const ordinary = ctx._renderCatalogCard(entry, { id, status: { kind: 'connected' } });+ expect(ordinary.innerHTML).not.toContain('permission-notice');+ });++ it('names DingTalk message permission and preserves unknown identifiers as text', () => {+ const ctx = loadConnectorsRenderer();+ ctx.t = (key: string, args: any = {}) => `${key} ${args.permissions || ''}`.trim();+ const card = ctx._renderCatalogCard({ id: 'dingtalk', display_name: 'DingTalk', auth_mode: 'local_cli' },+ { id: 'dingtalk', status: { kind: 'connected' }, reauthorization_required: true,+ missing_permissions: ['chat.message:send', 'mail:send', 'calendar.event:get'] });+ expect(card.querySelector('[data-role="permission-notice"]').textContent)+ .toBe('connectors.permissions.missing connectors.permissions.send_as_user, connectors.permissions.send_mail, calendar.event:get');+ expect(card.innerHTML).toContain('data-act="use-connector"');+ expect(card.innerHTML).toContain('connectors.action.authorize_permissions');+ });+const complex = {id: 'seller-app', display_name: 'Seller', auth_mode: 'local_api',connection_setup: { requirement: 'provider_application', fields: [] },};+ it.each(['feishu', 'dingtalk', 'wecom'].flatMap(id => [false, true].map(required => ({ id, required }))))(+ 'keeps $id usable and opens reauthorization only when required: $required', async ({ id, required }) => {+ const ctx = loadConnectorsRenderer();+ const entry = { id, display_name: id, auth_mode: 'local_cli' };+ const instance = { id: entry.id, status: { kind: 'connected' }, reauthorization_required: required };+ ctx.__setCatalog([entry]);+ ctx.__setInstances([instance]);+ ctx.loadConnectors = vi.fn(async () => {});+ ctx._runConnect = vi.fn(async () => {});+ ctx.window.focusConnectorById = vi.fn(async () => true);+ const html = ctx._renderCatalogCard(entry, instance).innerHTML;+ expect(html).toContain('data-act="use-connector"');+ expect(html.includes('connectors.action.authorize_permissions')).toBe(required);+ expect(await ctx.window.openConnectorSetupById(entry.id)).toBe(true);+ expect(ctx._runConnect).toHaveBeenCalledTimes(required ? 1 : 0);+ expect(ctx.window.focusConnectorById).toHaveBeenCalledTimes(required ? 0 : 1);+ });++ it.each(['error', 'degraded'])('offers reauthorization from a %s CLI connection', kind => {+ const ctx = loadConnectorsRenderer();+ const entry = { id: 'dingtalk', display_name: 'DingTalk', auth_mode: 'local_cli' };+ const html = ctx._renderCatalogCard(entry, {+ id: entry.id, status: { kind }, reauthorization_required: true,+ }).innerHTML;+ expect(html).toContain('data-act="connect"');+ expect(html).toContain('connectors.action.authorize_permissions');+ });+it('offers assistance inside extra-setup panels while catalog cards and unavailable entries keep their normal actions', () => {const ctx = loadConnectorsRenderer();ctx.__setCatalog([{ ...complex, id: 'seller-region', catalog_parent_id: 'seller' }]);@@ -674,11 +728,15 @@ describe('connectors panel — degraded cards never claim 已连接', () => {}}for (const operation of ['external_or_financial_change', 'destructive', 'financial_record_change', 'external_or_workflow_change', 'future_unknown_operation']) {- const message = ctx._connectorActionMessage({ connector_id: 'feishu', display_name: '飞书', sensitive_operation: operation, tool_name: 'send_message', arguments_preview: '{"text":"用户内容"}' });+ const info = { connector_id: 'feishu', display_name: '飞书', sensitive_operation: operation, tool_name: 'send_message', arguments_preview: '{"text":"用户内容"}' };+ const message = ctx._connectorActionMessage(info);+ const details = ctx._connectorActionDetails(info);expect(message).not.toContain('connectors.');expect(message).not.toContain('future_unknown_operation');expect(message).toContain(expected[lang][3]);- expect(message).toContain('{"text":"用户内容"}');+ expect(details).not.toContain('connectors.');+ expect(details).not.toContain('future_unknown_operation');+ expect(details).toContain('{"text":"用户内容"}');}for (const [error, key] of [[{ code: 'seller_shop_mismatch', error: 'private upstream detail' }, 'connectors.seller.shop_mismatch'],@@ -867,10 +925,10 @@ describe('connectors panel — degraded cards never claim 已连接', () => {});});- it('preserves destructive connector, account and final arguments in the shared permission message', () => {+ it('keeps a destructive operation identifiable while details contain only its parameters', () => {const ctx = loadConnectorsRenderer();- const message = ctx._connectorActionMessage({+ const info = {request_id: 'action-request',cid: 'c1',connector_id: 'shop',@@ -880,13 +938,12 @@ describe('connectors panel — degraded cards never claim 已连接', () => {risk: 'D',sensitive_operation: 'delete',arguments_preview: '{"order_id":"private-order-1"}',- });+ };+ const message = ctx._connectorActionMessage(info);+ const details = ctx._connectorActionDetails(info);- expect(message).toContain('connectors.action_confirm.destructive_message');- expect(message).toContain('connectors.action_confirm.destructive_note');- for (const detail of ['Shop', 'Store A', 'SHOP_DELETE_ORDER', 'private-order-1']) {- expect(message).toContain(detail);- }+ expect(message).toBe('connectors.action_confirm.connector: Shop\nconnectors.action_confirm.action: SHOP_DELETE_ORDER');+ expect(details).toBe('{"order_id":"private-order-1"}');});it('closes a main-cancelled Agent install dialog without a stale response or funnel row', async () => {diff --git a/test/renderer/dialogs.test.ts b/test/renderer/dialogs.test.tsindex 6da39b86..9d672e58 100644--- a/test/renderer/dialogs.test.ts+++ b/test/renderer/dialogs.test.ts@@ -257,6 +257,48 @@ describe('shared renderer dialogs', () => {confirm.click();expect(await result).toEqual(['integration']);});+ it('groups a question dialog\'s choices above the action row and keeps confirm choices beside cancel', async () => {+ // A CLI question sends prose options. On the action row (one non-wrapping+ // line) more than a few of them collapse to their min-width and the labels+ // wrap into columns, which is what the 2026-09-09 report showed. The+ // grouped layout is the one the composer-dock question card already uses.+ const ctx = loadDialogs();+ const question = ctx.uiChoice({+ title: 'Needs your input',+ message: 'Which remote branch should this land on?',+ choiceLayout: 'group',+ choices: [+ { id: 'option-0', label: 'Create origin/release_2.0.0' },+ { id: 'option-1', label: 'Advance origin/release_1.7.0' },+ { id: 'other', label: 'Other' },+ ],+ });+ const grouped = overlays(ctx)[0];+ const groupedHtml = grouped.innerHTML;+ expect(groupedHtml).toContain('<div class="ui-dialog-choices"');+ expect(groupedHtml.indexOf('data-act="choice"'))+ .toBeGreaterThan(groupedHtml.indexOf('ui-dialog-choices'));+ expect(groupedHtml.indexOf('data-act="choice"'))+ .toBeLessThan(groupedHtml.indexOf('modal-actions'));+ expect(groupedHtml.lastIndexOf('data-act="choice"'))+ .toBeLessThan(groupedHtml.indexOf('modal-actions'));+ // The group is still the same clickable contract.+ grouped.querySelectorAll('[data-act="choice"]')[1].click();+ expect(await question).toBe('option-1');++ // A two-button confirm keeps its choices on the action row beside cancel.+ const confirmChoice = ctx.uiChoice({+ message: 'Disable cloud sync?',+ choices: [{ id: 'keep', label: 'Keep the cloud copy', style: 'primary' }],+ });+ const rowed = overlays(ctx)[0];+ expect(rowed.innerHTML).not.toContain('ui-dialog-choices');+ expect(rowed.innerHTML.indexOf('data-act="choice"'))+ .toBeGreaterThan(rowed.innerHTML.indexOf('modal-actions'));+ rowed.querySelector('[data-act="choice"]')!.click();+ expect(await confirmChoice).toBe('keep');+ });+it('keeps cancel keyboard intent, exposes an accessible name, escapes text, and restores focus', async () => {const ctx = loadDialogs();const background = ctx._document.createElement('button');diff --git a/test/renderer/local-agent-user-input.test.ts b/test/renderer/local-agent-user-input.test.tsindex 19f88d36..f72cf32e 100644--- a/test/renderer/local-agent-user-input.test.ts+++ b/test/renderer/local-agent-user-input.test.ts@@ -13,21 +13,30 @@ async function flush() {await new Promise<void>(resolve => setImmediate(resolve));}-// The module owns no markup of its own: every question goes through the shared-// uiChoice / uiPrompt dialogs, so the harness stubs those two globals with what-// a user would produce (a choice id, typed text, or null for a dismissed-// dialog) and observes what reaches IPC.-function loadHarness() {+// The module routes requests to the shared card or dialogs. Drive their+// callbacks with user decisions and observe what reaches IPC.+function loadHarness(options: { dock?: boolean } = {}) {const handlers = new Map<string, (payload: any) => void>();const invoke = vi.fn(async (_channel: string, _payload: any) => ({ handled: true }));const uiChoice = vi.fn<(arg: any) => Promise<any>>();const uiPrompt = vi.fn<(message: string, defaultValue: string, options: any) => Promise<any>>();+ // The composer dock owns the card; the harness records the spec it receives+ // and drives it the way a user would (answer, decline, or a cancelled run).+ const requests: any[] = [];+ const closed: string[] = [];+ const CliAsyncInput = options.dock === false ? undefined : {+ showCliInputRequest: vi.fn((spec: any) => {+ requests.push(spec);+ return () => { closed.push(spec.requestId); spec.onClosed?.(); };+ }),+ };const context = vm.createContext({window: {orkas: {invoke,onPushEvent: (channel: string, handler: (payload: any) => void) => handlers.set(channel, handler),},+ ...(CliAsyncInput ? { CliAsyncInput } : {}),},AbortController,createLogger: () => ({ warn() {} }),@@ -40,6 +49,9 @@ function loadHarness() {invoke,uiChoice,uiPrompt,+ requests,+ closed,+ CliAsyncInput,push: (channel: string, payload: any) => handlers.get(channel)?.(payload),};}@@ -53,6 +65,191 @@ describe('renderer local Agent structured user input', () => {};const textQuestion = { id: 'note', question: 'Release note' };+ it('shows a request only once, including after its card has closed, while allowing a new question with identical text', async () => {+ const harness = loadHarness();+ const info = { request_id: 'card-once', cid: 'chat-1', questions: [choiceQuestion] };+ // The real dock refuses another mount for the same pending request.+ harness.CliAsyncInput!.showCliInputRequest.mockImplementationOnce(spec => {+ harness.requests.push(spec);+ return () => spec.onClosed?.();+ }).mockImplementationOnce(() => null as any);+ harness.push('local-agent:user-input', info);+ harness.push('local-agent:user-input', info);+ await flush();+ expect(harness.CliAsyncInput!.showCliInputRequest).toHaveBeenCalledOnce();+ expect(harness.uiChoice).not.toHaveBeenCalled();+ expect(harness.uiPrompt).not.toHaveBeenCalled();++ await harness.requests[0].submit(['Staging'], [['Staging']]);+ harness.requests[0].onClosed();+ harness.push('local-agent:user-input', info);+ expect(harness.CliAsyncInput!.showCliInputRequest).toHaveBeenCalledOnce();+ expect(harness.invoke).toHaveBeenCalledOnce();++ harness.CliAsyncInput!.showCliInputRequest.mockReset().mockImplementation(spec => {+ harness.requests.push(spec);+ return () => spec.onClosed?.();+ });+ harness.push('local-agent:user-input', { ...info, request_id: 'card-new' });+ expect(harness.requests).toHaveLength(2);+ expect(harness.uiChoice).not.toHaveBeenCalled();+ });++ it('does not enqueue duplicate dialogs or reopen an answered request', async () => {+ const harness = loadHarness({ dock: false });+ const resolvers: Array<(value: string) => void> = [];+ harness.uiPrompt.mockImplementation(() => new Promise(resolve => resolvers.push(resolve)));+ const first = { request_id: 'dialog-first', questions: [textQuestion] };+ const second = { request_id: 'dialog-second', questions: [textQuestion] };+ for (const info of [first, first, second, second]) harness.push('local-agent:user-input', info);+ expect(harness.uiPrompt).toHaveBeenCalledOnce();+ resolvers[0]('first answer');+ await flush();+ expect(harness.uiPrompt).toHaveBeenCalledTimes(2);+ resolvers[1]('second answer');+ await flush();+ harness.push('local-agent:user-input', first);+ harness.push('local-agent:user-input', second);+ await flush();+ expect(harness.uiPrompt).toHaveBeenCalledTimes(2);+ expect(harness.invoke.mock.calls.map(([, payload]) => payload.request_id))+ .toEqual(['dialog-first', 'dialog-second']);+ });++ it('never displays a withdrawn request again, even when cancellation arrives before its delivery', async () => {+ const harness = loadHarness();+ const info = { request_id: 'withdrawn-card', cid: 'chat-1', questions: [choiceQuestion] };+ harness.push('local-agent:user-input', info);+ harness.push('local-agent:user-input_cancelled', { request_ids: [info.request_id, 'cancelled-before-delivery'] });+ harness.push('local-agent:user-input', info);+ harness.push('local-agent:user-input', { ...info, request_id: 'cancelled-before-delivery' });+ await flush();+ expect(harness.requests).toHaveLength(1);+ expect(harness.closed).toEqual([info.request_id]);+ expect(harness.uiChoice).not.toHaveBeenCalled();+ expect(harness.uiPrompt).not.toHaveBeenCalled();+ expect(harness.invoke).not.toHaveBeenCalled();+ });++ it('renders a conversation question in the composer dock and replies only over the dedicated IPC', async () => {+ const harness = loadHarness();++ harness.push('local-agent:user-input', {+ request_id: 'request-card',+ cid: 'chat-1',+ agent_name: 'Orkas Codex',+ questions: [{ ...choiceQuestion, multiSelect: true, isOther: true }],+ });+ await flush();++ // No dialog for a question that has a conversation to live in.+ expect(harness.uiChoice).not.toHaveBeenCalled();+ expect(harness.uiPrompt).not.toHaveBeenCalled();+ expect(harness.requests).toHaveLength(1);+ expect(harness.requests[0]).toMatchObject({+ requestId: 'request-card',+ cid: 'chat-1',+ actorLabel: 'Orkas Codex',+ questions: [expect.objectContaining({ id: 'environment' })],+ });++ // Two picked options stay two values; the card reports what it holds.+ expect(await harness.requests[0].submit(['Staging, Production'], [['Staging', 'Production']])).toBe(true);+ expect(harness.invoke).toHaveBeenCalledWith('localAgents.userInputResponse', {+ request_id: 'request-card',+ answers: { environment: ['Staging', 'Production'] },+ cancelled: false,+ });+ });++ it('sends a typed answer as one value and a declined card as a cancellation', async () => {+ const typed = loadHarness();+ typed.push('local-agent:user-input', {+ request_id: 'request-typed', cid: 'chat-1', questions: [choiceQuestion],+ });+ await flush();+ expect(await typed.requests[0].submit(['Canary ring'], [[]])).toBe(true);+ expect(typed.invoke).toHaveBeenCalledWith('localAgents.userInputResponse', {+ request_id: 'request-typed', answers: { environment: ['Canary ring'] }, cancelled: false,+ });++ const declined = loadHarness();+ declined.push('local-agent:user-input', {+ request_id: 'request-declined', cid: 'chat-1', questions: [choiceQuestion],+ });+ await flush();+ await declined.requests[0].cancel();+ expect(declined.invoke).toHaveBeenCalledWith('localAgents.userInputResponse', {+ request_id: 'request-declined', answers: {}, cancelled: true,+ });+ });++ it('reports a failed reply so the card can keep the answer for a retry', async () => {+ const harness = loadHarness();+ harness.invoke.mockRejectedValueOnce(new Error('ipc down'));+ harness.push('local-agent:user-input', {+ request_id: 'request-retry', cid: 'chat-1', questions: [choiceQuestion],+ });+ await flush();+ expect(await harness.requests[0].submit(['Staging'], [['Staging']])).toBe(false);+ expect(await harness.requests[0].submit(['Staging'], [['Staging']])).toBe(true);+ });++ it('accepts only confirmed cancellation or native closure, never IPC receipt alone', async () => {+ const harness = loadHarness();+ harness.push('local-agent:user-input', {+ request_id: 'cancel-status', cid: 'chat-1', questions: [choiceQuestion],+ });+ expect(await harness.requests[0].cancel()).toBe('unknown');+ harness.invoke.mockResolvedValueOnce({ handled: false, cancel_failed: true } as any);+ expect(await harness.requests[0].cancel()).toBe('failed');+ harness.invoke.mockResolvedValueOnce({ handled: true, cancelled: true } as any);+ expect(await harness.requests[0].cancel()).toBe('closed');+ harness.invoke.mockResolvedValueOnce({ handled: false, closed: true } as any);+ expect(await harness.requests[0].cancel()).toBe('closed');+ harness.invoke.mockRejectedValueOnce(new Error('ipc unavailable'));+ await expect(harness.requests[0].cancel()).rejects.toThrow('ipc unavailable');+ });++ it('keeps the dialog for masked input and when no dock can host the card', async () => {+ const secret = loadHarness();+ secret.uiPrompt.mockResolvedValue('hunter2');+ secret.push('local-agent:user-input', {+ request_id: 'request-secret-card',+ cid: 'chat-1',+ questions: [{ id: 'token', question: 'Paste the deploy token', isSecret: true }],+ });+ await flush();+ expect(secret.requests).toHaveLength(0);+ expect(secret.uiPrompt).toHaveBeenCalledWith('Paste the deploy token', '', { signal: expect.any(AbortSignal), secret: true });++ const noDock = loadHarness({ dock: false });+ noDock.uiChoice.mockResolvedValue('option-0');+ noDock.push('local-agent:user-input', {+ request_id: 'request-no-dock', cid: 'chat-1', questions: [choiceQuestion],+ });+ await flush();+ expect(noDock.uiChoice).toHaveBeenCalledOnce();+ expect(noDock.invoke).toHaveBeenCalledWith('localAgents.userInputResponse', {+ request_id: 'request-no-dock', answers: { environment: ['Staging'] }, cancelled: false,+ });+ });++ it('retracts a docked card when the CLI cancels its request', async () => {+ const harness = loadHarness();+ harness.push('local-agent:user-input', {+ request_id: 'request-gone', cid: 'chat-1', questions: [choiceQuestion],+ });+ await flush();+ expect(harness.requests).toHaveLength(1);++ harness.push('local-agent:user-input_cancelled', { request_ids: ['request-gone'] });+ await flush();+ expect(harness.closed).toEqual(['request-gone']);+ // A cancelled request is settled by the run; the renderer must not answer.+ expect(harness.invoke).not.toHaveBeenCalled();+ });+it('answers each question through the shared dialogs and replies only over the dedicated IPC', async () => {const harness = loadHarness();harness.uiChoice.mockResolvedValue('option-1');@@ -69,6 +266,10 @@ describe('renderer local Agent structured user input', () => {message: 'Deployment\nChoose target\nStaging: Pre-production',// No free-text escape hatch unless the CLI asked for one.choices: [{ id: 'option-0', label: 'Staging' }, { id: 'option-1', label: 'Production' }],+ // CLI options are prose, so they render as a wrapping group above the+ // action row (2026-09-09, requested by the product owner: same style as+ // the native-question card in the composer dock).+ choiceLayout: 'group',signal: expect.any(AbortSignal),});expect(harness.uiPrompt).toHaveBeenCalledWith('Release note', '', { signal: expect.any(AbortSignal), secret: false });diff --git a/test/renderer/task-board-background-cid.test.ts b/test/renderer/task-board-background-cid.test.tsindex e22569bb..5d40bc69 100644--- a/test/renderer/task-board-background-cid.test.ts+++ b/test/renderer/task-board-background-cid.test.ts@@ -109,6 +109,16 @@ describe('task board › a background conversation still settles', () => {expect(ctx._taskBoardTasks.get('visible-cid')?.get('v1')?.status).toBe('running');expect(ctx.renders).toEqual(['visible-cid']);});++ it('rejects a delayed background event without suppressing real work with the same task id in another conversation', () => {+ const ctx = applyEvents('visible-cid', [+ ['bg-cid', RUNNING], ['bg-cid', DONE], ['bg-cid', RUNNING],+ ['visible-cid', RUNNING],+ ]);+ expect(ctx._taskBoardTasks.get('bg-cid')?.get('t1')?.status).toBe('done');+ expect(ctx._taskBoardTasks.get('visible-cid')?.get('t1')?.status).toBe('running');+ expect(ctx.renders).toEqual(['visible-cid']);+ });});describe('task board › events are settled above the cross-cid view guard', () => {diff --git a/test/renderer/task-board.test.ts b/test/renderer/task-board.test.tsindex 47edc2ac..5b651811 100644--- a/test/renderer/task-board.test.ts+++ b/test/renderer/task-board.test.ts@@ -50,9 +50,8 @@ function runVisibility(liveRows: unknown): { visible: boolean } {);}-/** Paint one conversation's board through the real renderer against an inert- * panel/list pair and return the row markup the user would see. */-function renderBoardRows(tasks: Array<Record<string, unknown>>): string {+/** Run the real renderer against an inert panel/list pair. */+function boardHarness() {const list: any = { dataset: {}, style: {}, innerHTML: '', querySelectorAll: () => [], addEventListener() {} };const panel: any = { style: {}, querySelector: () => null, addEventListener() {} };const context: any = {@@ -61,13 +60,18 @@ function renderBoardRows(tasks: Array<Record<string, unknown>>): string {addEventListener() {},getElementById: (id: string) => (id === 'chat-task-board' ? panel : id === 'chat-task-board-list' ? list : null),},- window: {},+ window: {}, currentCid: 'c1',t: (key: string, params?: Record<string, unknown>) => (params && 'name' in params ? `${key}:${params.name}` : key),escapeHtml: (value: unknown) => String(value ?? ''),uiIconHtml: () => '',};vm.createContext(context);vm.runInContext(source, context, { filename: 'task-board.js' });+ return { context, panel, list, board: context.window.TaskBoard };+}++function renderBoardRows(tasks: Array<Record<string, unknown>>): string {+ const { context, list } = boardHarness();context.__tasks = tasks;vm.runInContext("for (const task of __tasks) _taskBoardMapFor('c1').set(task.task_id, task);", context);context._taskBoardRender('c1');@@ -375,6 +379,124 @@ describe('renderer task board › seed/resync merge (terminal-wins)', () => {});describe('renderer task board › visibility (multi-task only, adjudicated 2026-09-04)', () => {+ it.each([+ { terminal: 'done', settlement: 'event' },+ { terminal: 'done', settlement: 'list' },+ { terminal: 'failed', settlement: 'event' },+ { terminal: 'stopped', settlement: 'list' },+ { terminal: 'cancelled', settlement: 'event' },+ ])(+ 'does not revive a $terminal task from delayed stream events after $settlement settlement', async ({ terminal, settlement }) => {+ const { context, panel, board } = boardHarness();+ const old = { task_id: 'old', assignee: 'commander', status: 'running' };+ board.onEvent('c1', { task: old });+ if (settlement === 'event') board.onEvent('c1', { task: { ...old, status: terminal } });+ else {+ context.apiFetch = async () => ({ json: async () => ({ ok: true, tasks: [{ ...old, status: terminal }] }) });+ await board.sync('c1');+ }+ // A second observer can still be draining the previous turn. Its old+ // running row must not count as concurrent work when a new send arrives.+ for (const status of ['running', 'waiting_input', 'queued', 'blocked']) {+ board.onEvent('c1', { task: { ...old, status } });+ expect(panel.style.display).toBe('none');+ }+ const next = { task_id: 'next', assignee: 'commander', status: 'queued', admission_pending: true };+ board.onEvent('c1', { task: next });+ expect(panel.style.display).toBe('none');+ board.onEvent('c1', { task: { ...next, status: 'running', admission_pending: undefined } });+ expect(panel.style.display).toBe('none');+ // Genuine concurrency still needs the execution panel.+ board.onEvent('c1', { task: { task_id: 'parallel', assignee: 'other', status: 'running' } });+ expect(panel.style.display).toBe('');+ },+ );++ it('ignores old queue events after admission without hiding confirmed queue controls or form resumption', () => {+ const { panel, list, board } = boardHarness();+ const pending = { task_id: 'send', assignee: 'commander', status: 'queued', admission_pending: true };+ const confirmed = { ...pending, admission_pending: undefined };+ board.onEvent('c1', { task: pending });+ expect(panel.style.display).toBe('none');+ board.onEvent('c1', { task: confirmed });+ expect(panel.style.display).toBe('');+ board.onEvent('c1', { task: pending });+ expect(panel.style.display).toBe('');+ expect(list.innerHTML).toContain('data-act="task-cancel"');+ board.onEvent('c1', { task: { ...confirmed, status: 'running' } });+ for (const stale of [pending, confirmed]) {+ board.onEvent('c1', { task: stale });+ expect(panel.style.display).toBe('none');+ }+ board.onEvent('c1', { task: { ...confirmed, status: 'waiting_input' } });+ board.onEvent('c1', { task: confirmed });+ expect(panel.style.display).toBe('none');+ board.onEvent('c1', { task: { ...confirmed, status: 'running' } });+ board.onEvent('c1', { task: { task_id: 'parallel', assignee: 'other', status: 'running' } });+ expect(list.innerHTML.match(/chat.task_status_running/g)).toHaveLength(2);+ });++ it('keeps a send absorbed into its active turn hidden when its old queue event arrives', () => {+ const { panel, list, board } = boardHarness();+ const queued = { task_id: 'update', assignee: 'commander', status: 'queued' };+ board.onEvent('c1', { task: { task_id: 'active', assignee: 'commander', status: 'running' } });+ board.onEvent('c1', { task: queued });+ expect(panel.style.display).toBe('');+ const absorbed = { ...queued, status: 'running', absorbed_into_turn_id: 'active-turn' };+ board.onEvent('c1', { task: absorbed });+ board.onEvent('c1', { task: queued });+ expect(panel.style.display).toBe('none');+ board.onEvent('c1', { task: { task_id: 'parallel', assignee: 'other', status: 'running' } });+ expect(panel.style.display).toBe('');+ expect(list.innerHTML).not.toContain('data-task-id="update"');+ });++ it.each(['ack-first', 'running-first', 'done-first'])(+ 'preserves blocked recovery when delivery is %s', async (order) => {+ const { context, panel, list, board } = boardHarness();+ const task = { task_id: 'blocked', assignee: 'commander', status: 'blocked', after: 'stopped-predecessor' };+ board.onEvent('c1', { task });+ expect(list.innerHTML).toContain('data-act="task-run-anyway"');+ context.apiFetch = async () => {+ if (order !== 'ack-first') {+ board.onEvent('c1', { task: { ...task, after: undefined, status: 'running' } });+ if (order === 'done-first') board.onEvent('c1', { task: { ...task, after: undefined, status: 'done' } });+ }+ return { json: async () => ({ ok: true }) };+ };+ await context._taskBoardResumeBlocked('c1', task.task_id);+ if (order === 'ack-first') {+ expect(panel.style.display).toBe('');+ expect(list.innerHTML).toContain('chat.task_status_queued');+ expect(list.innerHTML).not.toContain('data-act="task-run-anyway"');+ board.onEvent('c1', { task: { ...task, after: undefined, status: 'running' } });+ }+ expect(panel.style.display).toBe('none');+ board.onEvent('c1', { task }); // A delayed pre-recovery blocked snapshot.+ expect(panel.style.display).toBe('none');+ // The completed task must not remain as a phantom second execution.+ if (order === 'done-first') {+ board.onEvent('c1', { task: { task_id: 'new', assignee: 'commander', status: 'running' } });+ expect(panel.style.display).toBe('none');+ }+ },+ );++ it('keeps blocked recovery controls available after a failed request, then accepts a successful retry', async () => {+ const { context, panel, list, board } = boardHarness();+ const task = { task_id: 'blocked', assignee: 'commander', status: 'blocked' };+ board.onEvent('c1', { task });+ context.apiFetch = async () => ({ json: async () => ({ ok: false }) });+ await context._taskBoardResumeBlocked('c1', task.task_id);+ expect(panel.style.display).toBe('');+ expect(list.innerHTML).toContain('data-act="task-run-anyway"');+ expect(list.innerHTML).toContain('data-act="task-cancel"');+ context.apiFetch = async () => ({ json: async () => ({ ok: true }) });+ await context._taskBoardResumeBlocked('c1', task.task_id);+ board.onEvent('c1', { task: { ...task, status: 'running' } });+ expect(panel.style.display).toBe('none');+ });+it('stays hidden for no work and ordinary single running or waiting-input turns', () => {expect(runVisibility([])).toEqual({ visible: false });expect(runVisibility([{ status: 'running' }])).toEqual({ visible: false });