@xopcai/xopc 0.0.396 → 0.0.397
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DwTaeL1e.js → agent-avatar-dicebear-CIEGrioy.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-D8Q9Cpge.js → agent-defaults-settings-panel-CzKNVkRn.js} +1 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-mpA9rwYd.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DOv68iBN.js → agents-7VMa7Rzo.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B1ApwlFh.js → app-management-settings-panel-DIJ0ii-n.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Avd_jVji.js → appearance-settings-BGnyHS-p.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CvqDUvof.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C26WGbj9.js → archive-plugin-CR8FcRAa.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-T3FSuURJ.js → automations-page-BLInZo7N.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-B9r27rPk.js → automations-workspace-DvTSHLt3.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-CLaLkM3M.js → binary-plugins-DW9pu205.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CB4oRyM5.js → block-editor-ClgTc5v8.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-0nkk3bLA.js → browser-automation-inputs-Bn7kDuUB.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-KLG8IXvl.js → browser-automations-page-CJGBhDnv.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Tcejw5fF.js → browser-settings-page-tsi5W-cJ.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-CfbGk8q_.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-kEvUR6Yu.js → capabilities-settings-panel-BkO7QEyA.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-Br5PchG2.js → capability-header-actions-9ZG71-BO.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DRaE6_ub.js → channels-D0CwJktG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Cl0hAav9.js → chat-terminal-dock-x1W2_hwc.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-B6JI2S1b.js → computer-settings-page-D_b_bFVz.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-AqsoqTnF.js → connector-service-page-Kf8kaNm_.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-cDRZ8bqm.js → connectors-page-DlpfL2Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CyFehuto.js → date-picker-d5kiPUG0.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Vu_5QGGJ.js → dependency-picker-BcH76tQC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Dw9k0Z2p.js → desktop-pet-B-925tPX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DKqkhvxu.js → desktop-pet-settings-3XJ4qR65.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-12m5Z9-8.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-7svbL2tR.js → directory-picker-path-field-B-qZCjGR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CFa6PCBV.js → extension-debug-page-BlQu1u6X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BD4nZ9sf.js → extension-page-CXxM1M62.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CxPIMrmn.js → extension-settings-page-AF5nvsPP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Da2CtQ7c.js → gateway-settings-ABXvW_yL.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DzEeyJpH.js → highlighted-body-KQOG7T2V-Czdbbi0H.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Cp4-sTfX.js → home-page-LXGxGwVl.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-Zo56ZmKs.js → image-generation-api-DPFPJ2ps.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C_PPaOFv.js → imports-page-Bwyotfbt.js} +1 -1
- package/dist/gateway/static/root/assets/index-BKHxJaGD.css +1 -0
- package/dist/gateway/static/root/assets/{index-XRbEWVyZ.js → index-Dsp_gNdl.js} +116 -116
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BGtrzFT6.js → keyboard-shortcuts-settings-C20gl-l7.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Cu80fCA0.js → local-app-workbench-page-o0M_OSjC.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Zsu8FnwP.js → local-apps-page-DoWJCmOq.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DlIhfEW_.js → logs-page-BFTL93RX.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-CDV-xItG.js → management-settings-C52cuMg1.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Ba1_QMmZ.js → media-plugins-DLrTRF0a.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CPYJsRUJ.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-BXi6BrXd.js → note-detail-panel-CNN41byS.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-ClR9R90o.js → notes-page-BsfBp_8z.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BqNWtf_f.js → page-context-capture-button-YTVWZ02-.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-CSF-sn8w.js → personal-page-N4KoCZYG.js} +1 -1
- package/dist/gateway/static/root/assets/plugin-details-page-DcrrzQI-.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-kkbrbiVd.js → preview-open-alternatives-DzA__S54.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dheqo_4J.js → product-open-page-DvlMKj0T.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-B9Y6dIuh.js → product-preview-content-qdFyo4NG.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-l5dXxnSq.js → project-detail-page-y67s_fA8.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-95Od8gLy.js → projects-page-D5iYgi0O.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DPEpPFax.js → remote-access-hub-DeFF7Re-.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BjyZGNP3.js → runtime-tools-settings-panel-BCHLh-KQ.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DelMOLjg.js → schema-form-CJvaVHkx.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BN0nMm0w.js → sessions-page-DZ93_D5M.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-F1WX7vxq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DNWEDA71.js → settings-form-section-B3eODxNv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DJ27gC7J.js → settings-page-Dg86uCnr.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BWA_puDN.js → setup-status-panel-ruFzAArp.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Du4mumVM.js → share-preview-page-DCy1f25V.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-C0ixka9_.js → shares-settings-DeIVZvpJ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-zOxHjU7m.js → skill-api-RisyPAMA.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-743oJIiS.js → skill-reload-api-Dwkm1Fof.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DBYhEjP9.js → skills-page-UiTLsrFc.js} +1 -1
- package/dist/gateway/static/root/assets/{style-DsnKw5jo.js → style-CwMX73G7.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-mz9hWo_H.js → system-settings-panel-Cma37Pfm.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-Brp2wrEc.js → task-detail-page-BKOF_kxS.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-aC-ziRbY.js → tracing-settings-page-DC-kLysq.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Ch2Veztk.js → tunnel-api-BgdhbR1L.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-KfKZ2a3t.js → usage-page-BSlFg3Xj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BLW3t_OK.js → use-autosave-iKvZ1pvC.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BSsT8WjA.js → user-model-page-D4GB8QsM.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DulF6Cm4.js → voice-api-key-field-CESbtuwM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-bBMZM8tN.js → work-discovery-overlay-dtPpmYyh.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CsxXS1WI.js → workflow-run-setup-panel-DmFn3E_B.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-a-mfjQ2h.js → workflows-page-DEtaRuxH.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-wwIRBFCs.js → xopc-cloud-account-card-DTZnabfg.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
- package/dist/src/agent/embedded/codemode-extension.js +6 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +34 -2
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/mcp/config.d.ts +2 -0
- package/dist/src/agent/mcp/config.js +2 -2
- package/dist/src/agent/mcp/connection-setup.js +13 -1
- package/dist/src/agent/mcp/effective-server.d.ts +3 -0
- package/dist/src/agent/mcp/effective-server.js +27 -0
- package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
- package/dist/src/agent/mcp/native-mcp.js +13 -4
- package/dist/src/agent/mcp/tool-catalog.js +2 -1
- package/dist/src/agent/skills/index.d.ts +1 -0
- package/dist/src/agent/skills/index.js +6 -2
- package/dist/src/agent/skills/skill-manager.d.ts +1 -0
- package/dist/src/agent/skills/skill-manager.js +6 -1
- package/dist/src/agent/skills/skill-sources.d.ts +1 -0
- package/dist/src/agent/skills/skill-sources.js +4 -3
- package/dist/src/agent/skills/types.d.ts +1 -0
- package/dist/src/agent/workspace-runtime/registry.js +6 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +2 -2
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/mcp.js +6 -4
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
- package/dist/src/extensions/agent-plugins/auth.js +53 -12
- package/dist/src/extensions/agent-plugins/branding.d.ts +6 -0
- package/dist/src/extensions/agent-plugins/branding.js +44 -0
- package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +22 -0
- package/dist/src/extensions/agent-plugins/cli-authorization.js +198 -0
- package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
- package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
- package/dist/src/extensions/agent-plugins/credentials.js +24 -1
- package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
- package/dist/src/extensions/agent-plugins/formats.js +208 -0
- package/dist/src/extensions/agent-plugins/inventory.d.ts +142 -2
- package/dist/src/extensions/agent-plugins/inventory.js +39 -5
- package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
- package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
- package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
- package/dist/src/extensions/agent-plugins/resources.js +112 -0
- package/dist/src/extensions/agent-plugins/setup-contract.d.ts +54 -0
- package/dist/src/extensions/agent-plugins/setup-contract.js +58 -0
- package/dist/src/extensions/agent-plugins/setup.d.ts +119 -0
- package/dist/src/extensions/agent-plugins/setup.js +491 -0
- package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
- package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
- package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/sources.js +12 -3
- package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
- package/dist/src/extensions/agent-plugins/store.js +175 -25
- package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
- package/dist/src/extensions/agent-plugins/user-config.js +49 -0
- package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
- package/dist/src/extensions/agent-plugins/validation.js +142 -27
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/routes/agent-plugins.js +120 -9
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/gateway/hono/routes/composer-history.js +22 -4
- package/dist/src/gateway/hono/routes/mcp.js +6 -4
- package/dist/src/gateway/service.js +5 -3
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
- package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
- package/dist/src/tui/backends/embedded-backend.js +4 -4
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
- package/dist/src/tui/composer-history.d.ts +14 -0
- package/dist/src/tui/composer-history.js +85 -0
- package/dist/src/tui/tui-backend.d.ts +4 -3
- package/dist/src/tui/tui.js +19 -46
- package/package.json +12 -4
- package/dist/gateway/static/root/assets/agent-plugin-dialog-C-UKhDkS.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Da6Ar2U3.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BJlw9rhA.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-4l4ESMon.js +0 -1
- package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CpK57Kgp.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvfEKyfy.js +0 -1
|
@@ -11,8 +11,8 @@ import { effectiveWorkspacePathForSession } from "../session/session-workspace.j
|
|
|
11
11
|
import { ProjectStore } from "../projects/project-store.js";
|
|
12
12
|
import { TaskOriginRepository } from "../tasks/task-origin-repository.js";
|
|
13
13
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
14
|
-
import { TaskCollaborationRepository } from "../tasks/task-collaboration-repository.js";
|
|
15
14
|
import { runExec } from "../infra/exec.js";
|
|
15
|
+
import { TaskCollaborationRepository } from "../tasks/task-collaboration-repository.js";
|
|
16
16
|
import { isSessionSourceBinding } from "../agent/source-context/types.js";
|
|
17
17
|
import { realpath, stat } from "node:fs/promises";
|
|
18
18
|
//#region src/gateway/session-context-summary.ts
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export declare const COMPOSER_INPUT_HISTORY_LIMIT = 100;
|
|
2
2
|
export interface ComposerInputHistoryItem {
|
|
3
|
+
conversationId: string;
|
|
3
4
|
id: number;
|
|
4
5
|
text: string;
|
|
5
6
|
createdAt: number;
|
|
6
7
|
}
|
|
7
|
-
export declare function listComposerInputHistory(limit?: number): ComposerInputHistoryItem[];
|
|
8
|
-
export declare function appendComposerInputHistory(text: string, now?: number): {
|
|
8
|
+
export declare function listComposerInputHistory(conversationId: string, limit?: number): ComposerInputHistoryItem[];
|
|
9
|
+
export declare function appendComposerInputHistory(conversationId: string, text: string, now?: number): {
|
|
9
10
|
item: ComposerInputHistoryItem;
|
|
10
11
|
inserted: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function clearComposerInputHistory(): number;
|
|
13
|
+
export declare function clearComposerInputHistory(conversationId: string): number;
|
|
@@ -3,30 +3,32 @@ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "
|
|
|
3
3
|
//#region src/storage/sqlite/composer-input-history-repository.ts
|
|
4
4
|
function fromRow(row) {
|
|
5
5
|
return {
|
|
6
|
+
conversationId: row.conversation_id,
|
|
6
7
|
id: row.id,
|
|
7
8
|
text: row.text,
|
|
8
9
|
createdAt: row.created_at
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
|
-
function listComposerInputHistory(limit = 100) {
|
|
12
|
+
function listComposerInputHistory(conversationId, limit = 100) {
|
|
12
13
|
const boundedLimit = Number.isFinite(limit) ? Math.min(100, Math.max(1, Math.trunc(limit))) : 100;
|
|
13
|
-
return getSqliteDatabase().prepare("SELECT id, text, created_at FROM composer_input_history ORDER BY id DESC LIMIT ?").all(boundedLimit).map(fromRow);
|
|
14
|
+
return getSqliteDatabase().prepare("SELECT conversation_id, id, text, created_at FROM composer_input_history WHERE conversation_id = ? ORDER BY id DESC LIMIT ?").all(conversationId, boundedLimit).map(fromRow);
|
|
14
15
|
}
|
|
15
|
-
function appendComposerInputHistory(text, now = Date.now()) {
|
|
16
|
+
function appendComposerInputHistory(conversationId, text, now = Date.now()) {
|
|
16
17
|
const normalized = text.trim();
|
|
17
18
|
if (!normalized) throw new Error("Composer history text is required");
|
|
18
19
|
return runSqliteWriteTransaction((db) => {
|
|
19
|
-
const latest = db.prepare("SELECT id, text, created_at FROM composer_input_history ORDER BY id DESC LIMIT 1").get();
|
|
20
|
+
const latest = db.prepare("SELECT conversation_id, id, text, created_at FROM composer_input_history WHERE conversation_id = ? ORDER BY id DESC LIMIT 1").get(conversationId);
|
|
20
21
|
if (latest?.text === normalized) return {
|
|
21
22
|
item: fromRow(latest),
|
|
22
23
|
inserted: false
|
|
23
24
|
};
|
|
24
|
-
const result = db.prepare("INSERT INTO composer_input_history (text, created_at) VALUES (?, ?)").run(normalized, now);
|
|
25
|
+
const result = db.prepare("INSERT INTO composer_input_history (conversation_id, text, created_at) VALUES (?, ?, ?)").run(conversationId, normalized, now);
|
|
25
26
|
const id = Number(result.lastInsertRowid);
|
|
26
27
|
db.prepare(`DELETE FROM composer_input_history
|
|
27
|
-
WHERE id NOT IN (SELECT id FROM composer_input_history ORDER BY id DESC LIMIT ?)`).run(100);
|
|
28
|
+
WHERE conversation_id = ? AND id NOT IN (SELECT id FROM composer_input_history WHERE conversation_id = ? ORDER BY id DESC LIMIT ?)`).run(conversationId, conversationId, 100);
|
|
28
29
|
return {
|
|
29
30
|
item: {
|
|
31
|
+
conversationId,
|
|
30
32
|
id,
|
|
31
33
|
text: normalized,
|
|
32
34
|
createdAt: now
|
|
@@ -35,8 +37,8 @@ function appendComposerInputHistory(text, now = Date.now()) {
|
|
|
35
37
|
};
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
function clearComposerInputHistory() {
|
|
39
|
-
return Number(runSqliteWriteTransaction((db) => db.prepare("DELETE FROM composer_input_history").run().changes));
|
|
40
|
+
function clearComposerInputHistory(conversationId) {
|
|
41
|
+
return Number(runSqliteWriteTransaction((db) => db.prepare("DELETE FROM composer_input_history WHERE conversation_id = ?").run(conversationId).changes));
|
|
40
42
|
}
|
|
41
43
|
var COMPOSER_INPUT_HISTORY_LIMIT;
|
|
42
44
|
var init_composer_input_history_repository = __esmMin((() => {
|
|
@@ -5,8 +5,8 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
5
5
|
import { init_gateway_scopes } from "../../gateway/security/gateway-scopes.js";
|
|
6
6
|
import { createDevice, getDevice, init_device_access_repository, registerInitialDeviceRefreshToken, revokeDevice } from "./device-access-repository.js";
|
|
7
7
|
import { getOrCreateGatewayIdentity, init_gateway_identity_repository } from "./gateway-identity-repository.js";
|
|
8
|
-
import { browserEnrollmentPublicKeyThumbprint } from "../../browser/enrollment.js";
|
|
9
8
|
import "../../browser/extension-identity.js";
|
|
9
|
+
import { browserEnrollmentPublicKeyThumbprint } from "../../browser/enrollment.js";
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
//#region src/storage/sqlite/device-pairing-approval.ts
|
|
12
12
|
init_src();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Keep unscoped legacy entries out of session recall.
|
|
2
|
+
ALTER TABLE composer_input_history RENAME TO composer_input_history_legacy;
|
|
3
|
+
DROP INDEX idx_composer_input_history_recent;
|
|
4
|
+
CREATE TABLE composer_input_history (
|
|
5
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
6
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
7
|
+
text TEXT NOT NULL,
|
|
8
|
+
created_at INTEGER NOT NULL
|
|
9
|
+
);
|
|
10
|
+
CREATE INDEX idx_composer_input_history_recent
|
|
11
|
+
ON composer_input_history(conversation_id, id DESC);
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 217;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 257;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -48,7 +48,7 @@ function applySingleMigration(db, migration) {
|
|
|
48
48
|
function applyPendingMigrations(db, options = {}) {
|
|
49
49
|
db.function("xopc_memory_search_text", { deterministic: true }, (value) => memorySearchText(String(value ?? "")));
|
|
50
50
|
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
51
|
-
const targetVersion = options.targetVersion ??
|
|
51
|
+
const targetVersion = options.targetVersion ?? 257;
|
|
52
52
|
let currentVersion = readSchemaVersion(db);
|
|
53
53
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
54
54
|
if (!options.migrationsDir && currentVersion < 217) throw new DatabaseSchemaTooOldError(currentVersion, 217);
|
|
@@ -65,7 +65,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
65
65
|
}
|
|
66
66
|
/** Inspect schema version without mutating the database. */
|
|
67
67
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
68
|
-
const appVersion = options.targetVersion ??
|
|
68
|
+
const appVersion = options.targetVersion ?? 257;
|
|
69
69
|
const dbVersion = readSchemaVersion(db);
|
|
70
70
|
if (dbVersion > appVersion) return {
|
|
71
71
|
dbVersion,
|
|
@@ -105,7 +105,7 @@ var init_runner = __esmMin((() => {
|
|
|
105
105
|
init_errors();
|
|
106
106
|
log = createLogger("Sqlite:Migrations");
|
|
107
107
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 217;
|
|
108
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
108
|
+
XOPC_DB_SCHEMA_VERSION = 257;
|
|
109
109
|
}));
|
|
110
110
|
//#endregion
|
|
111
111
|
init_runner();
|
|
@@ -26,7 +26,7 @@ function ensureXopcDatabaseSchema(db) {
|
|
|
26
26
|
bootstrapFreshDatabase(db);
|
|
27
27
|
currentVersion = 217;
|
|
28
28
|
}
|
|
29
|
-
applyPendingMigrations(db, { targetVersion:
|
|
29
|
+
applyPendingMigrations(db, { targetVersion: 257 });
|
|
30
30
|
}
|
|
31
31
|
var init_schema = __esmMin((() => {
|
|
32
32
|
init_sql_assets();
|
|
@@ -36,9 +36,9 @@ export declare class EmbeddedBackend implements TuiBackend {
|
|
|
36
36
|
onDisconnected?: (reason: string) => void;
|
|
37
37
|
constructor(opts?: EmbeddedBackendOptions);
|
|
38
38
|
get connectionLabel(): string;
|
|
39
|
-
getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
|
|
39
|
+
getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
|
|
40
40
|
getComposerDraftDirectory(): Promise<string>;
|
|
41
|
-
recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
|
|
41
|
+
recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
|
|
42
42
|
start(): void;
|
|
43
43
|
private ensureAgent;
|
|
44
44
|
private createAgent;
|
|
@@ -104,14 +104,14 @@ var EmbeddedBackend = class {
|
|
|
104
104
|
get connectionLabel() {
|
|
105
105
|
return "local embedded";
|
|
106
106
|
}
|
|
107
|
-
async getComposerInputHistory() {
|
|
108
|
-
return listComposerInputHistory();
|
|
107
|
+
async getComposerInputHistory(conversationId) {
|
|
108
|
+
return listComposerInputHistory(conversationId);
|
|
109
109
|
}
|
|
110
110
|
async getComposerDraftDirectory() {
|
|
111
111
|
return join(resolveStateDir(), "client-drafts", "embedded", "composers");
|
|
112
112
|
}
|
|
113
|
-
async recordComposerInputHistory(text) {
|
|
114
|
-
return appendComposerInputHistory(text).item;
|
|
113
|
+
async recordComposerInputHistory(conversationId, text) {
|
|
114
|
+
return appendComposerInputHistory(conversationId, text).item;
|
|
115
115
|
}
|
|
116
116
|
start() {
|
|
117
117
|
if (this.running) return;
|
|
@@ -42,8 +42,8 @@ export declare class GatewayRealtimeBackend implements TuiBackend {
|
|
|
42
42
|
start(): void;
|
|
43
43
|
stop(): void;
|
|
44
44
|
getActiveSignal(): AbortSignal | undefined;
|
|
45
|
-
getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
|
|
46
|
-
recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
|
|
45
|
+
getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
|
|
46
|
+
recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
|
|
47
47
|
private acceptReceipt;
|
|
48
48
|
private reconcileInput;
|
|
49
49
|
private prepareInput;
|
|
@@ -133,15 +133,18 @@ var GatewayRealtimeBackend = class {
|
|
|
133
133
|
const signal = this.chatAbort?.signal;
|
|
134
134
|
return signal && !signal.aborted ? signal : void 0;
|
|
135
135
|
}
|
|
136
|
-
async getComposerInputHistory() {
|
|
137
|
-
const res = await gatewayFetch(this.baseUrl,
|
|
136
|
+
async getComposerInputHistory(conversationId) {
|
|
137
|
+
const res = await gatewayFetch(this.baseUrl, `/api/composer-history?conversationId=${encodeURIComponent(conversationId)}`, this.credential);
|
|
138
138
|
if (!res.ok) throw new Error(`Failed to load composer history (${res.status})`);
|
|
139
139
|
return (await res.json()).items ?? [];
|
|
140
140
|
}
|
|
141
|
-
async recordComposerInputHistory(text) {
|
|
141
|
+
async recordComposerInputHistory(conversationId, text) {
|
|
142
142
|
const res = await gatewayFetch(this.baseUrl, "/api/composer-history", this.credential, {
|
|
143
143
|
method: "POST",
|
|
144
|
-
body: JSON.stringify({
|
|
144
|
+
body: JSON.stringify({
|
|
145
|
+
conversationId,
|
|
146
|
+
text
|
|
147
|
+
})
|
|
145
148
|
});
|
|
146
149
|
if (!res.ok) throw new Error(`Failed to save composer history (${res.status})`);
|
|
147
150
|
return (await res.json()).item;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TuiComposerHistoryItem } from './tui-backend.js';
|
|
2
|
+
/** Session-scoped history; late responses never replace another session's editor history. */
|
|
3
|
+
export declare function createTuiComposerHistory(opts: {
|
|
4
|
+
currentConversationId: () => string;
|
|
5
|
+
load: (conversationId: string) => Promise<TuiComposerHistoryItem[]>;
|
|
6
|
+
persist: (conversationId: string, text: string) => Promise<TuiComposerHistoryItem>;
|
|
7
|
+
replace: (texts: string[]) => void;
|
|
8
|
+
}): {
|
|
9
|
+
append: (item: TuiComposerHistoryItem) => void;
|
|
10
|
+
refresh: (id?: string) => Promise<void>;
|
|
11
|
+
switchSession: () => void;
|
|
12
|
+
clear: (id: string) => void;
|
|
13
|
+
record: (text: string, id?: string) => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//#region src/tui/composer-history.ts
|
|
2
|
+
/** Session-scoped history; late responses never replace another session's editor history. */
|
|
3
|
+
function createTuiComposerHistory(opts) {
|
|
4
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
5
|
+
const stateFor = (id) => {
|
|
6
|
+
let state = sessions.get(id);
|
|
7
|
+
if (!state) {
|
|
8
|
+
state = {
|
|
9
|
+
items: [],
|
|
10
|
+
revision: 0,
|
|
11
|
+
loadVersion: 0,
|
|
12
|
+
clearVersion: 0,
|
|
13
|
+
writeQueue: Promise.resolve()
|
|
14
|
+
};
|
|
15
|
+
sessions.set(id, state);
|
|
16
|
+
}
|
|
17
|
+
return state;
|
|
18
|
+
};
|
|
19
|
+
const publish = (id) => {
|
|
20
|
+
if (id === opts.currentConversationId()) opts.replace(stateFor(id).items.map((item) => item.text));
|
|
21
|
+
};
|
|
22
|
+
const append = (item) => {
|
|
23
|
+
if (typeof item.conversationId !== "string" || !item.conversationId || typeof item.text !== "string" || typeof item.id !== "number") return;
|
|
24
|
+
const state = stateFor(item.conversationId);
|
|
25
|
+
if (state.items.some((entry) => item.id > 0 && entry.id === item.id)) return;
|
|
26
|
+
state.revision += 1;
|
|
27
|
+
const optimisticIndex = state.items.findIndex((entry) => entry.id === 0 && entry.text === item.text);
|
|
28
|
+
if (optimisticIndex >= 0 && item.id > 0) {
|
|
29
|
+
state.items[optimisticIndex] = item;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (state.items[0]?.text === item.text) {
|
|
33
|
+
state.items[0] = item;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
state.items = [item, ...state.items].slice(0, 100);
|
|
37
|
+
publish(item.conversationId);
|
|
38
|
+
};
|
|
39
|
+
const refresh = async (id = opts.currentConversationId()) => {
|
|
40
|
+
const state = stateFor(id);
|
|
41
|
+
const loadVersion = ++state.loadVersion;
|
|
42
|
+
try {
|
|
43
|
+
await state.writeQueue;
|
|
44
|
+
const revision = state.revision;
|
|
45
|
+
const items = await opts.load(id);
|
|
46
|
+
if (state.revision !== revision || state.loadVersion !== loadVersion) return;
|
|
47
|
+
state.items = items.filter((item) => item.conversationId === id).slice(0, 100);
|
|
48
|
+
publish(id);
|
|
49
|
+
} catch {}
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
append,
|
|
53
|
+
refresh,
|
|
54
|
+
switchSession: () => {
|
|
55
|
+
const id = opts.currentConversationId();
|
|
56
|
+
publish(id);
|
|
57
|
+
refresh(id);
|
|
58
|
+
},
|
|
59
|
+
clear: (id) => {
|
|
60
|
+
const state = stateFor(id);
|
|
61
|
+
state.revision += 1;
|
|
62
|
+
state.clearVersion += 1;
|
|
63
|
+
state.items = [];
|
|
64
|
+
publish(id);
|
|
65
|
+
},
|
|
66
|
+
record: (text, id = opts.currentConversationId()) => {
|
|
67
|
+
text = text.trim();
|
|
68
|
+
if (!text) return;
|
|
69
|
+
const state = stateFor(id);
|
|
70
|
+
const clearVersion = state.clearVersion;
|
|
71
|
+
append({
|
|
72
|
+
conversationId: id,
|
|
73
|
+
id: 0,
|
|
74
|
+
text,
|
|
75
|
+
createdAt: Date.now()
|
|
76
|
+
});
|
|
77
|
+
state.writeQueue = state.writeQueue.then(async () => {
|
|
78
|
+
const item = await opts.persist(id, text);
|
|
79
|
+
if (state.clearVersion === clearVersion && item.conversationId === id) append(item);
|
|
80
|
+
}).catch(() => {});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { createTuiComposerHistory };
|
|
@@ -29,6 +29,7 @@ export interface TuiEvent {
|
|
|
29
29
|
source?: TuiEventSource;
|
|
30
30
|
}
|
|
31
31
|
export interface TuiComposerHistoryItem {
|
|
32
|
+
conversationId: string;
|
|
32
33
|
id: number;
|
|
33
34
|
text: string;
|
|
34
35
|
createdAt: number;
|
|
@@ -190,11 +191,11 @@ export interface TuiBackend {
|
|
|
190
191
|
stop(): void;
|
|
191
192
|
/** Current active chat abort signal, if a run is in progress. */
|
|
192
193
|
getActiveSignal?(): AbortSignal | undefined;
|
|
193
|
-
/**
|
|
194
|
-
getComposerInputHistory(): Promise<TuiComposerHistoryItem[]>;
|
|
194
|
+
/** Composer history for one conversation, shared across its clients. */
|
|
195
|
+
getComposerInputHistory(conversationId: string): Promise<TuiComposerHistoryItem[]>;
|
|
195
196
|
getComposerDraftDirectory(): Promise<string>;
|
|
196
197
|
/** Persist one submitted chat input. */
|
|
197
|
-
recordComposerInputHistory(text: string): Promise<TuiComposerHistoryItem>;
|
|
198
|
+
recordComposerInputHistory(conversationId: string, text: string): Promise<TuiComposerHistoryItem>;
|
|
198
199
|
/** Send a chat message, returns the run id. */
|
|
199
200
|
sendChat(opts: ChatSendOptions): Promise<{
|
|
200
201
|
runId: string;
|
package/dist/src/tui/tui.js
CHANGED
|
@@ -18,6 +18,7 @@ import { applyThemeById, getBashExcludeBorderColor, getBashModeBorderColor, getC
|
|
|
18
18
|
import { editorTheme, theme } from "./theme.js";
|
|
19
19
|
import { extensionForImageMimeType, readClipboardImage } from "./clipboard-image.js";
|
|
20
20
|
import { copyTextToClipboard } from "./clipboard-text.js";
|
|
21
|
+
import { createTuiComposerHistory } from "./composer-history.js";
|
|
21
22
|
import { createXopcTuiKeybindingsManager } from "./tui-keybindings-file.js";
|
|
22
23
|
import { isActiveRunStreamStale, markActiveRunStalled, markRunRecovering, markRunRecoveryComplete, markRunSending } from "./tui-run-state.js";
|
|
23
24
|
import { clearSeenStreamEvents, clearSeenStreamEventsForRun, dispatchAgentEvent } from "./tui-agent-events.js";
|
|
@@ -1863,45 +1864,25 @@ async function runTui(opts) {
|
|
|
1863
1864
|
updateFooter();
|
|
1864
1865
|
tui.requestRender();
|
|
1865
1866
|
};
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
defaultEditor.replaceHistory(
|
|
1873
|
-
|
|
1867
|
+
const composerHistory = createTuiComposerHistory({
|
|
1868
|
+
currentConversationId: () => state.currentConversationId,
|
|
1869
|
+
load: (id) => client.getComposerInputHistory(id),
|
|
1870
|
+
persist: (id, text) => client.recordComposerInputHistory(id, text),
|
|
1871
|
+
replace: (texts) => {
|
|
1872
|
+
composerHistoryTexts = texts;
|
|
1873
|
+
defaultEditor.replaceHistory(texts);
|
|
1874
|
+
if (editor !== defaultEditor) setEditorComponent(editorComponentFactory);
|
|
1875
|
+
tui.requestRender();
|
|
1874
1876
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
const refreshComposerHistory = async () => {
|
|
1878
|
-
try {
|
|
1879
|
-
await composerHistoryWriteQueue;
|
|
1880
|
-
applyComposerHistory(await client.getComposerInputHistory());
|
|
1881
|
-
} catch {}
|
|
1882
|
-
};
|
|
1877
|
+
});
|
|
1878
|
+
const refreshComposerHistory = () => composerHistory.refresh();
|
|
1883
1879
|
const refreshChatInputState = async (conversationId = state.currentConversationId) => {
|
|
1884
1880
|
try {
|
|
1885
1881
|
applyChatInputState(await client.getChatInputState(conversationId));
|
|
1886
1882
|
} catch {}
|
|
1887
1883
|
};
|
|
1888
|
-
const recordChatHistory = (value) => {
|
|
1889
|
-
|
|
1890
|
-
if (!text) return;
|
|
1891
|
-
editor.addToHistory?.(text);
|
|
1892
|
-
if (composerHistory[0]?.text !== text) {
|
|
1893
|
-
composerHistory = [{
|
|
1894
|
-
id: 0,
|
|
1895
|
-
text,
|
|
1896
|
-
createdAt: Date.now()
|
|
1897
|
-
}, ...composerHistory].slice(0, 100);
|
|
1898
|
-
composerHistoryTexts = composerHistory.map((item) => item.text);
|
|
1899
|
-
}
|
|
1900
|
-
composerHistoryWriteQueue = composerHistoryWriteQueue.then(async () => {
|
|
1901
|
-
const item = await client.recordComposerInputHistory(text);
|
|
1902
|
-
const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
|
|
1903
|
-
if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
|
|
1904
|
-
}).catch(() => {});
|
|
1884
|
+
const recordChatHistory = (value, conversationId = state.currentConversationId) => {
|
|
1885
|
+
composerHistory.record(value, conversationId);
|
|
1905
1886
|
};
|
|
1906
1887
|
const submitBurst = createSubmitBurstCoalescer({
|
|
1907
1888
|
submit: createEditorSubmitHandler({
|
|
@@ -1939,7 +1920,7 @@ async function runTui(opts) {
|
|
|
1939
1920
|
if (!ok) throw new Error("Queued input changed; refreshed latest state");
|
|
1940
1921
|
editingQueuedInput = void 0;
|
|
1941
1922
|
if (state.currentConversationId === conversationId && editor.getText().trim() === content) editor.setText("");
|
|
1942
|
-
recordChatHistory(content);
|
|
1923
|
+
recordChatHistory(content, conversationId);
|
|
1943
1924
|
tui.requestRender();
|
|
1944
1925
|
}).catch((error) => {
|
|
1945
1926
|
chatLog.addSystem(theme.dim(`Edit failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
@@ -1967,7 +1948,7 @@ async function runTui(opts) {
|
|
|
1967
1948
|
delivery: "next"
|
|
1968
1949
|
}).then(({ ok, state: inputState }) => {
|
|
1969
1950
|
if (!ok) throw new Error("Gateway did not accept the message");
|
|
1970
|
-
recordChatHistory(text);
|
|
1951
|
+
recordChatHistory(text, conversationId);
|
|
1971
1952
|
if (state.currentConversationId === conversationId && editor.getText().trim() === text) editor.setText("");
|
|
1972
1953
|
if (inputState) applyChatInputState(inputState);
|
|
1973
1954
|
else refreshChatInputState(conversationId);
|
|
@@ -1982,6 +1963,7 @@ async function runTui(opts) {
|
|
|
1982
1963
|
};
|
|
1983
1964
|
const setConversationId = (key) => {
|
|
1984
1965
|
state.currentConversationId = resolveConversationId(key);
|
|
1966
|
+
composerHistory.switchSession();
|
|
1985
1967
|
state.chatInputState = createEmptyChatInputState(state.currentConversationId);
|
|
1986
1968
|
editingQueuedInput = void 0;
|
|
1987
1969
|
refreshChatInputState(state.currentConversationId);
|
|
@@ -2280,20 +2262,11 @@ async function runTui(opts) {
|
|
|
2280
2262
|
return;
|
|
2281
2263
|
}
|
|
2282
2264
|
if (evt.event === "composer-history.appended") {
|
|
2283
|
-
|
|
2284
|
-
if (typeof item.text === "string" && typeof item.id === "number") {
|
|
2285
|
-
const optimisticIndex = composerHistory.findIndex((entry) => entry.id === 0 && entry.text === item.text);
|
|
2286
|
-
if (optimisticIndex >= 0) composerHistory[optimisticIndex] = item;
|
|
2287
|
-
else if (composerHistory[0]?.text !== item.text) {
|
|
2288
|
-
composerHistory = [item, ...composerHistory].slice(0, 100);
|
|
2289
|
-
composerHistoryTexts = composerHistory.map((entry) => entry.text);
|
|
2290
|
-
editor.addToHistory?.(item.text);
|
|
2291
|
-
} else composerHistory[0] = item;
|
|
2292
|
-
}
|
|
2265
|
+
composerHistory.append(data);
|
|
2293
2266
|
return;
|
|
2294
2267
|
}
|
|
2295
2268
|
if (evt.event === "composer-history.cleared") {
|
|
2296
|
-
|
|
2269
|
+
if (typeof data.conversationId === "string") composerHistory.clear(data.conversationId);
|
|
2297
2270
|
return;
|
|
2298
2271
|
}
|
|
2299
2272
|
if (evt.event === "workflow.run.updated" && handleWorkflowRunUpdated(data)) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.397",
|
|
4
4
|
"description": "Local-first personal AI with Ada, task delegation, files, projects, workflows, and automations. Use cloud or local models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -170,10 +170,10 @@
|
|
|
170
170
|
"xlsx": "file:web/vendor/xlsx-0.20.3.tgz",
|
|
171
171
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
172
172
|
"@xopcai/computer-control-contract": "0.1.0",
|
|
173
|
-
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
174
173
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
175
|
-
"@xopcai/
|
|
174
|
+
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
176
175
|
"@xopcai/image-providers": "0.1.0",
|
|
176
|
+
"@xopcai/gateway-contract": "0.0.0",
|
|
177
177
|
"@xopcai/realtime-client": "0.0.0",
|
|
178
178
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
179
179
|
},
|
|
@@ -222,6 +222,11 @@
|
|
|
222
222
|
"test:extensions": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=extensions",
|
|
223
223
|
"test:web": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=web",
|
|
224
224
|
"test:packages": "cross-env XOPC_LOG_LEVEL=fatal vitest run --project=packages",
|
|
225
|
+
"test:plugins:e2e": "pnpm run build:node && pnpm run build:web && pnpm run test:plugins:store:e2e && pnpm run test:plugins:app:e2e && pnpm run test:plugins:authorization:e2e && pnpm run test:plugins:browser",
|
|
226
|
+
"test:plugins:app:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-app-e2e.mts",
|
|
227
|
+
"test:plugins:store:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-store-plugin-e2e.mts",
|
|
228
|
+
"test:plugins:fixtures": "tsx scripts/build-store-plugin-lab.mts",
|
|
229
|
+
"test:plugins:browser": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-setup-browser.mts",
|
|
225
230
|
"test:web:onboarding-visual": "node scripts/test-onboarding-visual.mjs",
|
|
226
231
|
"test:web:onboarding-visual:update": "node scripts/test-onboarding-visual.mjs --update",
|
|
227
232
|
"test:quick-understanding": "XOPC_LOG_LEVEL=fatal vitest run src/work-discovery/__tests__/evaluation.test.ts src/user-context/sources/__tests__/activity-clustering.test.ts src/knowledge/__tests__/quick-understanding.e2e.test.ts src/connectors/__tests__/content-enrichment.test.ts src/connectors/__tests__/connected-source-ingestion.test.ts",
|
|
@@ -285,6 +290,9 @@
|
|
|
285
290
|
"eval:benchmark": "tsx evals/coder/apps/cli/src/benchmark.ts",
|
|
286
291
|
"eval:benchmark:check": "pnpm -C evals/coder run typecheck && pnpm -C evals/coder exec vitest run --configLoader native tests/benchmark-v1.test.ts tests/xopc-adapter.test.ts tests/suite-loader.test.ts",
|
|
287
292
|
"eval:benchmark:live": "node --import tsx evals/coder/scripts/run-benchmark-live.mjs",
|
|
288
|
-
"eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts"
|
|
293
|
+
"eval:benchmark:regrade": "tsx evals/coder/apps/cli/src/benchmark-regrade.ts",
|
|
294
|
+
"test:plugins:authorization:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-plugin-authorization-e2e.mts",
|
|
295
|
+
"test:plugins:production:e2e": "cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-catalog.mts && cross-env XOPC_LOG_LEVEL=fatal tsx scripts/verify-production-plugin-browser.mts",
|
|
296
|
+
"test:plugins:dingtalk:live": "tsx scripts/verify-dingtalk-live-e2e.mts"
|
|
289
297
|
}
|
|
290
298
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as ee}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./folder-open-CyzJ19I9.js";import{t as o}from"./messages-DPxcWxfD.js";import{t as s}from"./cn-0WouolD0.js";import{a as c,n as te,r as l}from"./locale-store-Djl2FW6_.js";import{a as ne,i as u,o as d,r as f,s as re,t as p}from"./dist-BGTk37IG.js";import{a as ie}from"./vendor-swr-BIWyz7Rc.js";import{$a as m,El as h,Pd as g,Wc as _,Wu as v,Xl as y,lf as b}from"./index-XRbEWVyZ.js";var x=n(),S=e(t(),1),C=r(),w=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function T(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在本机运行工具服务:${n}`:`Run a local tool service: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e}function E(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function D(e,t,n){let r=await c(l(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function O(e){let t=(0,x.c)(49),{pluginId:n,server:r,enabled:ee}=e,i=te(ae),a;t[0]===i?a=t[1]:(a=i.startsWith(`zh`),t[0]=i,t[1]=a);let o=a,[s,c]=(0,S.useState)(``),[l,ne]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``),[f,re]=(0,S.useState)(r.type===`stdio`?`API_KEY`:`Authorization`),[p,ie]=(0,S.useState)(r.type===`stdio`?``:`Bearer `),m;t[2]!==r.name||t[3]!==r.type?(m=(0,C.jsxs)(`p`,{className:`font-medium`,children:[r.name,` · `,r.type]}),t[2]=r.name,t[3]=r.type,t[4]=m):m=t[4];let h=r.type===`stdio`?`xopc mcp list`:`xopc mcp login ${r.id}`,g;t[5]===h?g=t[6]:(g=(0,C.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-fg-muted`,children:h}),t[5]=h,t[6]=g);let v;t[7]!==f||t[8]!==n||t[9]!==p||t[10]!==s||t[11]!==r.name||t[12]!==r.type||t[13]!==o?(v=e=>{e.preventDefault(),ne(!0),d(``),D(`/api/extensions/agent-plugins/${encodeURIComponent(n)}/mcp/${encodeURIComponent(r.name)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:r.type===`stdio`?`env`:`headers`,key:f,value:s,prefix:p}]}).then(()=>{c(``),d(o?`已保存`:`Saved`)}).catch(e=>d(String(e))).finally(()=>ne(!1))},t[7]=f,t[8]=n,t[9]=p,t[10]=s,t[11]=r.name,t[12]=r.type,t[13]=o,t[14]=v):v=t[14];let y=o?`字段名`:`Field name`,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>re(e.target.value),t[15]=b):b=t[15];let T;t[16]===f?T=t[17]:(T=(0,C.jsx)(`input`,{className:w,value:f,onChange:b,required:!0}),t[16]=f,t[17]=T);let E;t[18]!==y||t[19]!==T?(E=(0,C.jsxs)(`label`,{className:`block`,children:[y,T]}),t[18]=y,t[19]=T,t[20]=E):E=t[20];let O=o?`前缀`:`Prefix`,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>ie(e.target.value),t[21]=k):k=t[21];let A;t[22]===p?A=t[23]:(A=(0,C.jsx)(`input`,{className:w,value:p,onChange:k}),t[22]=p,t[23]=A);let j;t[24]!==O||t[25]!==A?(j=(0,C.jsxs)(`label`,{className:`block`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M=o?`密钥`:`Secret`,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>c(e.target.value),t[27]=N):N=t[27];let P;t[28]===s?P=t[29]:(P=(0,C.jsx)(`input`,{type:`password`,autoComplete:`off`,className:w,value:s,onChange:N,required:!0}),t[28]=s,t[29]=P);let F;t[30]!==M||t[31]!==P?(F=(0,C.jsxs)(`label`,{className:`block`,children:[M,P]}),t[30]=M,t[31]=P,t[32]=F):F=t[32];let I=!ee||l||!s,L=o?`保存密钥`:`Save API key`,R;t[33]!==I||t[34]!==L?(R=(0,C.jsx)(_,{type:`submit`,disabled:I,children:L}),t[33]=I,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==E||t[37]!==j||t[38]!==F||t[39]!==R||t[40]!==v?(z=(0,C.jsxs)(`form`,{className:`mt-3 space-y-2`,onSubmit:v,children:[E,j,F,R]}),t[36]=E,t[37]=j,t[38]=F,t[39]=R,t[40]=v,t[41]=z):z=t[41];let B;t[42]===u?B=t[43]:(B=u?(0,C.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:u}):null,t[42]=u,t[43]=B);let V;return t[44]!==z||t[45]!==B||t[46]!==m||t[47]!==g?(V=(0,C.jsxs)(`div`,{className:`rounded-lg border border-edge p-3 text-sm`,children:[m,g,z,B]}),t[44]=z,t[45]=B,t[46]=m,t[47]=g,t[48]=V):V=t[48],V}function ae(e){return e.language}function k({extension:e,onClose:t,initialSource:n=``,marketplace:r,autoInstall:c=!1}){let l=te(e=>e.language),x=l.startsWith(`zh`),ae=r?.localizations?.[x?`zh-CN`:`en`],k=ae?.displayName??r?.name,A=ae?.description??r?.description,j=(0,S.useId)(),{mutate:M}=ie(),[N,P]=(0,S.useState)(e),[F,I]=(0,S.useState)(n),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(!1),[V,H]=(0,S.useState)(``),[oe,se]=(0,S.useState)(!1),[ce,le]=(0,S.useState)(!1),[ue,de]=(0,S.useState)(!1),[fe,U]=(0,S.useState)(!1),[pe,W]=(0,S.useState)(!1),[G,me]=(0,S.useState)(!1),[he,ge]=(0,S.useState)(!1),_e=(0,S.useRef)(!1),K=`/api/extensions/agent-plugins/${encodeURIComponent(N?.pluginId??``)}`,q=F.trim().startsWith(`store:`),J=()=>M(`gateway-extensions-list`);async function Y(e){B(!0),H(``);try{await e()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}function X(e){I(e),R(null),H(``)}let Z=typeof window<`u`?window.electronAPI?.file:void 0,Q=/^(?:\/|[A-Za-z]:[\\/])/.test(F.trim())?F.trim():void 0;async function ve(){if(!Z?.openDirectory){W(!0);return}let e=await Z.openDirectory(Q?{defaultPath:Q}:void 0);e&&X(e)}async function ye(){if(!Z?.openFile){W(!0);return}let e=await Z.openFile({...Q?{defaultPath:Q}:{},extensions:[`zip`]});e&&X(e)}function be(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function xe(e){if(!be(e))return;e.preventDefault(),U(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){H(x?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=Z?.getPathForFile?.(t[0]);e?X(e):H(x?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&X(n.trim().split(/\r?\n/)[0])}async function Se(e){P(await D(`${K}/activation`,`POST`,{enabled:e})),await J()}async function Ce(e){let t=!N,n=await D(t?`/api/extensions/install`:`${K}/update`,`POST`,{source:F,reviewHash:e.reviewHash});P(n),await J(),t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await D(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),P(n),await J()),R(null),ge(t&&n.activationEligible===!0)}async function we(){let e=await D(`/api/extensions/inspect`,`POST`,{source:F});if(E(e,r)){R(e);return}await Ce(e)}(0,S.useEffect)(()=>{e&&P(e)},[e]),(0,S.useEffect)(()=>{!c||N||!q||_e.current||(_e.current=!0,Y(we))},[c,N,q]);let Te=c&&!N&&q&&!_e.current,$=N?.components;return(0,C.jsx)(p,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,C.jsxs)(d,{children:[(0,C.jsx)(ne,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,C.jsxs)(f,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(76vh,30rem)] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,C.jsx)(re,{className:`font-semibold`,children:N?.name??k??(x?`安装 Agent Plugin`:`Install Agent Plugin`)}),(0,C.jsx)(_,{variant:`ghost`,onClick:t,children:x?`关闭`:`Close`})]}),(0,C.jsx)(u,{className:`sr-only`,children:x?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,C.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!N&&q?(0,C.jsxs)(`section`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:k??L?.manifest.name??F.slice(6)}),A?(0,C.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:A}):null,(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r?.publisher?.verification===`verified`?x?`已认证发布者 · 安装后自动启用`:`Verified publisher · enabled automatically after installation`:x?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),L?null:(0,C.jsxs)(_,{className:`w-full`,disabled:z||Te,onClick:()=>void Y(we),children:[z||Te?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,z||Te?x?`正在安全检查并安装…`:`Checking and installing…`:x?`一键安装`:`Install`]})]}):null,N?(0,C.jsxs)(C.Fragment,{children:[he?(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,C.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-fg`,children:x?`插件已安装并启用`:`Plugin installed and enabled`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,N.activationEligible?null:(0,C.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`font-medium text-accent-fg`,children:x?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,C.jsx)(_,{disabled:z||N.readiness===`blocked`,onClick:()=>void Y(()=>Se(!0)),children:x?`启用插件`:`Enable plugin`})]}),(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Agent Plugin · `,N.version,` · `,N.readiness&&{ready:x?`已就绪`:`Ready`,setup_required:x?`待连接`:`Setup required`,degraded:x?`部分不可用`:`Partially available`,blocked:x?`已阻止`:`Blocked`}[N.readiness]]}),N.provenance?(0,C.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[N.provenance.publisherVerification===`verified`?x?`已认证发布者`:`Verified publisher`:x?`社区发布者`:`Community publisher`,` · `,N.provenance.packageName,`@`,N.provenance.version,` · SHA-256 `,N.provenance.sha256.slice(0,12),`…`,N.provenance.riskTier?` · ${N.provenance.riskTier}`:``]}):null,(0,C.jsx)(`p`,{className:`text-sm`,children:N.description}),N.activationEligible?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(()=>Se(!1)),children:x?`停用`:`Disable`}):null,N.canRollback?(0,C.jsx)(_,{disabled:z,variant:`secondary`,onClick:()=>void Y(async()=>{P(await D(`${K}/rollback`,`POST`)),await J()}),children:x?`回滚上一版本`:`Roll back`}):null,$?.skills.length||$?.mcp.length?(0,C.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:x?`此插件提供的能力`:`Capabilities from this plugin`}),$.skills.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`Skills: `,$.skills.map(e=>e.name).join(`, `)]}):null,$.mcp.length?(0,C.jsxs)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:[`MCP: `,$.mcp.map(e=>e.name).join(`, `)]}):null]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$.skills.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/skills?source=plugin`,children:x?`管理技能`:`Manage skills`})}):null,$.mcp.length?(0,C.jsx)(_,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(ee,{to:`/capabilities/connectors?tab=connected`,children:x?`管理连接`:`Manage connections`})}):null]})]}):null,N.components?.mcp.length?(0,C.jsxs)(`details`,{className:`group rounded-lg border border-edge p-3`,children:[(0,C.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,C.jsx)(`span`,{children:x?`连接与密钥(按需)`:`Connections and API keys (as needed)`}),(0,C.jsx)(b,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,C.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:x?`仅当工具服务提示登录或缺少密钥时设置。`:`Only configure this when a tool service asks you to sign in or provide a key.`}),(0,C.jsx)(`div`,{className:`mt-3 space-y-3`,children:N.components.mcp.map(e=>(0,C.jsx)(O,{pluginId:N.pluginId,server:e,enabled:N.active},e.id))})]}):null,N.diagnostics?.map((e,t)=>(0,C.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,q&&N?(0,C.jsxs)(_,{variant:`ghost`,className:`px-0`,"aria-expanded":G,onClick:()=>me(e=>!e),children:[(0,C.jsx)(b,{className:s(`size-4 transition-transform motion-reduce:transition-none`,G&&`rotate-180`),"aria-hidden":!0}),x?`高级操作`:`Advanced actions`]}):null,!q||G?(0,C.jsxs)(`form`,{className:s(`space-y-3`,N&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),Y(async()=>{R(await D(`/api/extensions/inspect`,`POST`,{source:F}))})},children:[(0,C.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:s(`rounded-xl border border-dashed p-3 transition-colors`,fe?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{be(e)&&(e.preventDefault(),U(!0))},onDragOver:e=>{be(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,U(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||U(!1)},onDrop:xe,children:[(0,C.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,C.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:j,className:`block text-sm font-medium`,children:N?x?`更新包来源`:`Update package source`:x?`安装包来源`:`Package source`}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:x?`拖入插件目录或 ZIP,也可输入 HTTPS ZIP 或 store:包名`:`Drop a plugin directory or ZIP, or enter an HTTPS ZIP or store:package`})]})]}),(0,C.jsx)(`input`,{id:j,className:w,value:F,onChange:e=>X(e.target.value),placeholder:x?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,C.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Z?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ve),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择目录`:`Choose directory`]}),(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void Y(ye),children:[(0,C.jsx)(g,{className:`size-4`,"aria-hidden":!0}),x?`选择 ZIP`:`Choose ZIP`]})]}):(0,C.jsxs)(_,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>W(!0),children:[(0,C.jsx)(a,{className:`size-4`,"aria-hidden":!0}),x?`选择文件或目录`:`Choose file or folder`]})})]}),(0,C.jsx)(_,{type:`submit`,variant:`secondary`,disabled:z||!F,children:x?`检查安装包`:`Inspect package`})]}):null,L?(0,C.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(y,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:x?`需要你的授权`:`Your authorization is required`}),(0,C.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:x?`此插件需要以下新增能力。确认后会自动完成安装并启用。`:`This plugin requests the capabilities below. After approval, installation and activation continue automatically.`})]})]}),(0,C.jsx)(`ul`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-3 break-words`,children:L.addedCapabilities.map(e=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,C.jsx)(`span`,{children:T(e,x)})]},e))}),L.diagnostics.map((e,t)=>(0,C.jsxs)(`p`,{children:[e.component,`: `,e.message]},t)),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsxs)(_,{disabled:z||!!N&&L.manifest.name!==N.pluginId,onClick:()=>void Y(()=>Ce(L)),children:[z?(0,C.jsx)(v,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x?`授权并安装`:`Authorize and install`]}),(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>R(null),children:x?`取消`:`Cancel`})]})]}):null,N&&(!q||G)?(0,C.jsx)(`div`,{className:`border-t border-edge pt-4`,children:ue?(0,C.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,C.jsx)(`p`,{children:x?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:oe,onChange:e=>se(e.target.checked)}),x?`同时删除插件数据`:`Also delete plugin data`]}),(0,C.jsxs)(`label`,{className:`flex gap-2`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.target.checked)}),x?`同时删除本地凭据`:`Also delete local credentials`]}),(0,C.jsx)(_,{disabled:z,onClick:()=>void Y(async()=>{await D(K,`DELETE`,{removeData:oe,removeCredentials:ce}),await J(),t()}),children:x?`确认卸载`:`Confirm uninstall`})]}):(0,C.jsx)(_,{variant:`ghost`,disabled:z,onClick:()=>de(!0),children:x?`卸载插件`:`Uninstall`})}):null,V?(0,C.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:V}):null]})]}),Z?null:(0,C.jsx)(m,{open:pe,onOpenChange:W,initialAbsolutePath:Q,onConfirm:async e=>X(e),wd:o(l).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:x?`选择插件安装包`:`Choose plugin package`,description:x?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:x?`使用此来源`:`Use this source`,nested:!0})]})})}export{O as n,k as t};
|