@xopcai/xopc 0.0.402 → 0.0.404
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/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DF_bLVLU.js → agent-avatar-dicebear-CdwFK70g.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BMj9HwIQ.js +1 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-DvSe10zu.js → agents-admin-api-D6XzhsQy.js} +1 -1
- package/dist/gateway/static/root/assets/agents-hrm6V8Dp.js +77 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Cr_dcDOi.js → app-management-settings-panel-Rg9jOmoj.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C5TsJu_t.js → appearance-settings-S3yp0GUO.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-ChrJSB_2.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CpsVjh9E.js → archive-plugin-J7hwA5cs.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Db1YnE2r.js → automations-page-Cesz1cjw.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DdopDyED.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DYdnW_Fa.js → binary-plugins-Bg4Se8Kg.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-HZ37eyhY.js → block-editor-Bw1sO9YH.js} +40 -40
- package/dist/gateway/static/root/assets/{browser-automation-inputs-B-V9Vc6B.js → browser-automation-inputs-Y46Mf8aY.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BcNjBdFQ.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-ByeqxrSF.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-glv1DeRI.js → capabilities-CIv3LUQk.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-DEZJFRU_.js → capabilities-page-BUTQSo3A.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B-Uwmjbo.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BBPBfpGd.js → capability-header-actions-BGGJKzPL.js} +1 -1
- package/dist/gateway/static/root/assets/channels-z6iuM4HE.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DQWv9Smb.js → chat-terminal-dock-oMmP0flJ.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-CyPqxL6X.js → computer-settings-page-CERhSG5W.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DmCt-Kgx.js → connector-service-page-DyW3mLTh.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CdMwhiio.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-aOgNPu_Y.js → date-picker-CO3Jhdzg.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-oALjIlhN.js → dependency-picker-DbyMpo5J.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-pp9_jT3M.js → desktop-pet-DJ9OAPJs.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BZCCh5T4.js → desktop-pet-settings-CNrNXWlk.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DpKzQlqA.js → device-pairing-wizard-TzK-VCuf.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-LSNVNUaG.js → directory-picker-path-field-BmFgRA8G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Bvy_tPme.js → extension-debug-page-C3ZpHHYc.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D3J8-8AM.js → extension-page-gfOwpT2R.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-F6KLsxCY.js → extension-settings-page-BS7cDqZJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DAir1JsW.js → gateway-config-swr-BvuySoCX.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-dE0XrVAT.js → gateway-realtime-SBtdXzco.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-dKq2fm2X.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-UB6hyqcj.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CqyGHM2M.js → gateway-startup-retry-CEpuztYK.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BCCIvIlA.js → highlighted-body-KQOG7T2V-BRfDRn2k.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DBUnR1DO.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DjQXmXWa.js → image-generation-api-BoMWmqwF.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Bg5N_9Vg.js → imports-page-CPiPsiEP.js} +1 -1
- package/dist/gateway/static/root/assets/{index-cmsFpzI8.js → index-DmURUvvA.js} +114 -114
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxH3LBLL.js → keyboard-shortcuts-settings-D9y8h4dR.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DoAmV6on.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CsTZ1d01.js → local-apps-page-CE6Ag8oQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-fhip41-L.js → local-session-drafts-DhJjHCfQ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Jnhw2WMv.js → locale-store-D5h-Ha6-.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DFysUb2k.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-CmXPsu0I.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-B58RypQ4.js → markdown-view-CthsQiiO.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CGq_o7tI.js → media-plugins-DvfdiczR.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-SuiLTd5Y.js +1 -0
- package/dist/gateway/static/root/assets/{messages-DBvKzlCl.js → messages-Bwv-AOYl.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-BpddDFQt.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-CMLVzPsQ.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-DQ4KZsWt.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BH9WwSgw.js → page-context-capture-button-BcxVEGa2.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CCQDxb7E.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-CGFQ_-bG.js +1 -0
- package/dist/gateway/static/root/assets/plugin-presentation-DF1gfuGf.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-rJ3l8Ii4.js → preview-open-alternatives-CXjjpXVx.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CuzuFyIk.js → product-open-page-DqiyvM4c.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Dw2DstzN.js → product-preview-content-f7Q4giA3.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-PBK7vXK5.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DO_pIhy-.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BbUEMGcj.js → registry-api-Bf0hVPNV.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CpEq4PU0.js → remote-access-hub-BFtELmg0.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-api-D0xtCTXr.js → runtime-tools-api-ByH1meP7.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CNar1-_V.js → runtime-tools-settings-panel-B9Beu-oK.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-D_cAMxj5.js → schema-form-ZAX7C5uI.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CAKgrbgz.js → session-api-fVuszA_P.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-D_N7qha7.js → session-manager-BUMUjup5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D27knqOl.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDzdr1zW.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DvLxOebb.js → settings-form-section-BTUFu5KS.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C6Tl6TD4.js → settings-page-YFr6zzh7.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C5Jszsd1.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BLraXBAe.js → share-preview-page-CsfrvY_G.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BW6BNot0.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BE_i8VdM.js → skill-api-o3HSgF_K.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BJsPnE87.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Kuf2t7MG.js +2 -0
- package/dist/gateway/static/root/assets/{style-pk3FR76e.js → style-DOz6lLJB.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-M550B6Mj.js → system-settings-panel-B69rR6vw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DOb97OLI.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-HdEeV_0-.js → task-expandable-content-BZCJqajv.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-BIq3Ayeg.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-CC_TCY7S.js → tunnel-api-V9pJ8fUo.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-DZdpti28.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DrxAqqzV.js → use-autosave-BnMIUc_5.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BEgJ97hp.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bu4paIbu.js → voice-api-key-field-1h6fMaZL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-T3nM4buh.js → voice-config-api-CRjdZdJF.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-3TAUYZF4.js → work-discovery-overlay-CVNqSNz8.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-sgFaaLoB.js → workflow-run-setup-panel-Dq63AthQ.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CfA1iwZu.js +6 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DMZelX5s.js → xopc-cloud-account-card-BsW2acj1.js} +1 -1
- package/dist/gateway/static/root/index.html +14 -14
- package/dist/package.js +1 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +2 -2
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/computer/broker.d.ts +2 -0
- package/dist/src/computer/broker.js +64 -19
- package/dist/src/computer/diagnostics.d.ts +6 -0
- package/dist/src/computer/diagnostics.js +7 -2
- package/dist/src/computer/keyboard.d.ts +2 -0
- package/dist/src/computer/keyboard.js +31 -0
- package/dist/src/computer/model-adapter.d.ts +6 -0
- package/dist/src/computer/model-adapter.js +76 -4
- package/dist/src/computer/runtime.d.ts +9 -1
- package/dist/src/computer/runtime.js +73 -5
- package/dist/src/computer/semantic-plan.d.ts +41 -0
- package/dist/src/computer/semantic-plan.js +95 -0
- package/dist/src/computer/task-state.js +3 -2
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/auth.d.ts +2 -0
- package/dist/src/gateway/auth.js +13 -4
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/security/audit.js +3 -3
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +2 -2
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CB96Cbva.js +0 -1
- package/dist/gateway/static/root/assets/agents-C97HREhT.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-erjVBKui.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-iTSZBSZf.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-D0lBDbJO.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-DIbXx7Ux.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BfdoIjPK.js +0 -8
- package/dist/gateway/static/root/assets/channels-CapZyaWK.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-3xUE-PGt.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-_YecsQF1.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DUoecphg.js +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-C7RejhJl.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-uLju0b0e.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BkTmllrn.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DdlL1T6J.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-Cps8VMV6.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-BYNLO2pt.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-CdmoFpQ9.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-UKNVJRDn.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-gvBSFAhm.js +0 -1
- package/dist/gateway/static/root/assets/plugin-presentation-C0la7V8t.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-C0XssfWQ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-cT6yy_Xk.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-D5qR92KP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-eKqVXNOq.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DuN4e4iO.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-u2Y5Ljhu.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-1xNCuBFH.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Clye5gro.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-DqFhFqWu.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-nXw76P46.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-BZ0t4KYM.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BAQOJoHC.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CxNXNDNc.js +0 -6
|
@@ -10,7 +10,7 @@ import { ComputerDiagnosticSchema, ComputerOperationError, computerDiagnostic, c
|
|
|
10
10
|
import { createComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";
|
|
11
11
|
import { groundComputerAction } from "./semantic-actions.js";
|
|
12
12
|
import { ComputerFlowCapture, ComputerFlowStore, computerFlowHint, computerFlowMetadata } from "./flows.js";
|
|
13
|
-
import { ComputerSessionDiagnostics } from "./diagnostics.js";
|
|
13
|
+
import { ComputerNativeTimingSchema, ComputerSessionDiagnostics } from "./diagnostics.js";
|
|
14
14
|
import { ComputerExpectationSchema, ComputerTaskState, verifyComputerExpectation } from "./task-state.js";
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
|
16
16
|
import { z } from "zod";
|
|
@@ -35,6 +35,7 @@ const Reply = z.object({
|
|
|
35
35
|
generation: z.number().int().nonnegative(),
|
|
36
36
|
grantId: z.string().optional(),
|
|
37
37
|
observation: ComputerObservationSchema.optional(),
|
|
38
|
+
nativeMs: ComputerNativeTimingSchema.optional(),
|
|
38
39
|
errorCode: z.string().optional(),
|
|
39
40
|
diagnostic: ComputerDiagnosticSchema.optional(),
|
|
40
41
|
apps: z.array(ComputerAppSchema).max(100).optional(),
|
|
@@ -243,8 +244,18 @@ var ComputerRuntime = class {
|
|
|
243
244
|
}
|
|
244
245
|
async executeGoal(owner, input, signal, diagnostics) {
|
|
245
246
|
const startedAt = Date.now();
|
|
247
|
+
const phasesBefore = diagnostics?.snapshot().phaseMs;
|
|
246
248
|
const requestsBefore = diagnostics?.snapshot().counters.modelRequests ?? 0;
|
|
247
|
-
const context = {
|
|
249
|
+
const context = {
|
|
250
|
+
observationsReused: 0,
|
|
251
|
+
stabilityObservations: 0,
|
|
252
|
+
actionsRemaining: input.maxActions ?? 6,
|
|
253
|
+
nativeMs: {
|
|
254
|
+
precheckMs: 0,
|
|
255
|
+
inputMs: 0,
|
|
256
|
+
postObserveMs: 0
|
|
257
|
+
}
|
|
258
|
+
};
|
|
248
259
|
let actionsExecuted = 0;
|
|
249
260
|
const finish = (result, stopReason) => ({
|
|
250
261
|
...result,
|
|
@@ -252,6 +263,9 @@ var ComputerRuntime = class {
|
|
|
252
263
|
actionsExecuted,
|
|
253
264
|
modelRequests: (diagnostics?.snapshot().counters.modelRequests ?? 0) - requestsBefore,
|
|
254
265
|
observationsReused: context.observationsReused,
|
|
266
|
+
stabilityObservations: context.stabilityObservations,
|
|
267
|
+
nativeMs: context.nativeMs,
|
|
268
|
+
phaseMs: Object.fromEntries(Object.entries(diagnostics?.snapshot().phaseMs ?? {}).map(([key, value]) => [key, value - (phasesBefore?.[key] ?? 0)])),
|
|
255
269
|
elapsedMs: Math.max(0, Date.now() - startedAt),
|
|
256
270
|
stopReason
|
|
257
271
|
}
|
|
@@ -264,6 +278,7 @@ var ComputerRuntime = class {
|
|
|
264
278
|
try {
|
|
265
279
|
while (true) {
|
|
266
280
|
signal.throwIfAborted();
|
|
281
|
+
context.actionsRemaining = (input.maxActions ?? 6) - actionsExecuted;
|
|
267
282
|
let result = await this.executeInput(owner, step, signal, diagnostics, context);
|
|
268
283
|
const authorizationDeadline = Date.now() + 6e4;
|
|
269
284
|
while (result.status === "pending_authorization" || result.status === "pending_action") {
|
|
@@ -295,6 +310,7 @@ var ComputerRuntime = class {
|
|
|
295
310
|
} finally {
|
|
296
311
|
context.observation?.frame?.fill(0);
|
|
297
312
|
context.observation = void 0;
|
|
313
|
+
this.sessions.get(owner)?.adapter.reset?.();
|
|
298
314
|
}
|
|
299
315
|
}
|
|
300
316
|
async executeInput(owner, input, signal, diagnostics, goalContext) {
|
|
@@ -529,12 +545,15 @@ var ComputerRuntime = class {
|
|
|
529
545
|
height: o.imageHeight,
|
|
530
546
|
summary: o.summary,
|
|
531
547
|
stateDigest: o.stateDigest,
|
|
548
|
+
maxPlanActions: goalContext?.actionsRemaining,
|
|
532
549
|
history: s.task.history,
|
|
533
550
|
expectation: predictionInput.expect,
|
|
534
551
|
flowHint,
|
|
535
|
-
onModelRequest: () =>
|
|
552
|
+
onModelRequest: () => {
|
|
553
|
+
if (++s.modelRequests > config.computer.maxModelRequests) throw new Error("COMPUTER_MODEL_BUDGET");
|
|
554
|
+
s.diagnostics.count("modelRequests");
|
|
555
|
+
}
|
|
536
556
|
}, () => {
|
|
537
|
-
if (++s.modelRequests > config.computer.maxModelRequests) throw new Error("COMPUTER_MODEL_BUDGET");
|
|
538
557
|
s.diagnostics.count("predictionAttempts");
|
|
539
558
|
}, signal));
|
|
540
559
|
if (proposal.kind === "answer") return {
|
|
@@ -626,7 +645,7 @@ var ComputerRuntime = class {
|
|
|
626
645
|
s.pending = envelope;
|
|
627
646
|
s.diagnostics.propose(envelope.actionId, envelope.action.kind);
|
|
628
647
|
}
|
|
629
|
-
|
|
648
|
+
let reply = await this.send(s, {
|
|
630
649
|
op: "act",
|
|
631
650
|
sessionId: s.id,
|
|
632
651
|
owner: s.owner,
|
|
@@ -636,6 +655,51 @@ var ComputerRuntime = class {
|
|
|
636
655
|
reply.frame?.fill(0);
|
|
637
656
|
throw new Error("COMPUTER_RECEIPT_MISMATCH");
|
|
638
657
|
}
|
|
658
|
+
if (goalContext && s.adapter.hasPendingPlan && reply.value.status === "ready" && !reply.value.errorCode && reply.value.receipt?.dispatch === "completed" && reply.value.observation) {
|
|
659
|
+
const receipt = reply.value.receipt;
|
|
660
|
+
const nativeMs = reply.value.nativeMs;
|
|
661
|
+
let stable = false;
|
|
662
|
+
try {
|
|
663
|
+
for (let sample = 0; sample < 3; sample++) {
|
|
664
|
+
const next = await this.send(s, {
|
|
665
|
+
op: "observe",
|
|
666
|
+
sessionId: s.id,
|
|
667
|
+
owner: s.owner
|
|
668
|
+
}, signal);
|
|
669
|
+
goalContext.stabilityObservations++;
|
|
670
|
+
const previous = reply;
|
|
671
|
+
reply = {
|
|
672
|
+
...next,
|
|
673
|
+
value: {
|
|
674
|
+
...next.value,
|
|
675
|
+
receipt,
|
|
676
|
+
nativeMs
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
previous.frame?.fill(0);
|
|
680
|
+
if (previous.value.brokerEpoch !== next.value.brokerEpoch || previous.value.generation !== next.value.generation || previous.value.grantId !== next.value.grantId) {
|
|
681
|
+
reply.value.errorCode = "COMPUTER_GRANT_REVOKED";
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
const a = previous.value.observation, b = next.value.observation;
|
|
685
|
+
stable = next.value.status === "ready" && !next.value.errorCode && !!a && !!b && previous.value.brokerEpoch === next.value.brokerEpoch && previous.value.generation === next.value.generation && previous.value.grantId === next.value.grantId && a.stateDigest === b.stateDigest && JSON.stringify(a.target) === JSON.stringify(b.target);
|
|
686
|
+
if (stable || next.value.status !== "ready" || next.value.errorCode) break;
|
|
687
|
+
}
|
|
688
|
+
if (!stable && !reply.value.errorCode) reply.value.errorCode = "COMPUTER_UI_UNSTABLE";
|
|
689
|
+
} catch (error) {
|
|
690
|
+
reply.frame?.fill(0);
|
|
691
|
+
reply = { value: {
|
|
692
|
+
...reply.value,
|
|
693
|
+
receipt,
|
|
694
|
+
errorCode: signal?.aborted ? "COMPUTER_OPERATION_ABORTED" : "COMPUTER_POST_ACTION_OBSERVATION_FAILED"
|
|
695
|
+
} };
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (goalContext && reply.value.receipt?.dispatch === "completed" && reply.value.nativeMs) for (const key of [
|
|
699
|
+
"precheckMs",
|
|
700
|
+
"inputMs",
|
|
701
|
+
"postObserveMs"
|
|
702
|
+
]) goalContext.nativeMs[key] += reply.value.nativeMs[key];
|
|
639
703
|
if (reply.value.status !== "pending_action") s.pending = void 0;
|
|
640
704
|
if (goalContext && reply.value.status === "ready" && !reply.value.errorCode && reply.value.receipt?.dispatch === "completed" && reply.frame && reply.mimeType && reply.value.observation) {
|
|
641
705
|
goalContext.observation?.frame?.fill(0);
|
|
@@ -659,6 +723,10 @@ var ComputerRuntime = class {
|
|
|
659
723
|
s.task.record(context.goal, envelope.action, context.before, reply.value.receipt, reply.value.observation, verification);
|
|
660
724
|
s.flowCapture.record(envelope.action, context.before, reply.value.receipt, reply.value.observation, context.expectation, verification);
|
|
661
725
|
}
|
|
726
|
+
if (signal?.aborted) {
|
|
727
|
+
reply.frame?.fill(0);
|
|
728
|
+
signal.throwIfAborted();
|
|
729
|
+
}
|
|
662
730
|
if (!s.pending) s.pendingContext = void 0;
|
|
663
731
|
if (reply.value.status === "stopped") this.forget(s);
|
|
664
732
|
return {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ComputerAction } from '@xopcai/computer-control-contract';
|
|
3
|
+
import type { ComputerHistoryEntry } from './task-state.js';
|
|
4
|
+
export declare const ComputerButtonPlanSchema: z.ZodObject<{
|
|
5
|
+
kind: z.ZodLiteral<"button_plan">;
|
|
6
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
7
|
+
label: z.ZodString;
|
|
8
|
+
when: z.ZodUnion<readonly [z.ZodObject<{
|
|
9
|
+
text: z.ZodString;
|
|
10
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
+
role: z.ZodLiteral<"AXStaticText">;
|
|
12
|
+
label: z.ZodString;
|
|
13
|
+
value: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
+
role: z.ZodEnum<{
|
|
16
|
+
AXTextField: "AXTextField";
|
|
17
|
+
AXTextArea: "AXTextArea";
|
|
18
|
+
}>;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
}, z.core.$strict>]>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
type ButtonPlan = z.infer<typeof ComputerButtonPlanSchema>;
|
|
25
|
+
/** A call-local conditional plan. Every yielded action still goes through broker validation. */
|
|
26
|
+
export declare class ComputerButtonPlan {
|
|
27
|
+
private steps;
|
|
28
|
+
private goal?;
|
|
29
|
+
private awaiting?;
|
|
30
|
+
get pending(): boolean;
|
|
31
|
+
reset(): void;
|
|
32
|
+
install(plan: ButtonPlan, goal: string, limit: number): void;
|
|
33
|
+
next(input: {
|
|
34
|
+
goal: string;
|
|
35
|
+
summary: string;
|
|
36
|
+
stateDigest?: string;
|
|
37
|
+
history?: readonly ComputerHistoryEntry[];
|
|
38
|
+
maxPlanActions?: number;
|
|
39
|
+
}): ComputerAction | undefined;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/computer/semantic-plan.ts
|
|
3
|
+
const ComputerButtonPlanSchema = z.object({
|
|
4
|
+
kind: z.literal("button_plan"),
|
|
5
|
+
steps: z.array(z.object({
|
|
6
|
+
label: z.string().min(1).max(300),
|
|
7
|
+
when: z.union([
|
|
8
|
+
z.object({ text: z.string().min(1).max(1e3) }).strict(),
|
|
9
|
+
z.object({
|
|
10
|
+
role: z.literal("AXStaticText"),
|
|
11
|
+
label: z.string().max(300),
|
|
12
|
+
value: z.string().max(1e3).optional()
|
|
13
|
+
}).strict(),
|
|
14
|
+
z.object({
|
|
15
|
+
role: z.enum(["AXTextField", "AXTextArea"]),
|
|
16
|
+
label: z.string().max(300),
|
|
17
|
+
value: z.string().max(1e3)
|
|
18
|
+
}).strict()
|
|
19
|
+
])
|
|
20
|
+
}).strict()).min(2).max(6)
|
|
21
|
+
}).strict();
|
|
22
|
+
const NativeContextSchema = z.object({
|
|
23
|
+
text: z.string().optional(),
|
|
24
|
+
truncated: z.boolean().optional(),
|
|
25
|
+
elements: z.array(z.object({
|
|
26
|
+
role: z.string(),
|
|
27
|
+
label: z.string().optional(),
|
|
28
|
+
value: z.unknown().optional(),
|
|
29
|
+
ref: z.string().optional(),
|
|
30
|
+
enabled: z.boolean().optional(),
|
|
31
|
+
in_web_content: z.boolean().optional(),
|
|
32
|
+
semanticActions: z.array(z.string()).optional()
|
|
33
|
+
})).max(180)
|
|
34
|
+
});
|
|
35
|
+
const displayText = (value) => typeof value === "string" ? value.replace(/[\u200e\u200f\u2066-\u2069]/g, "") : void 0;
|
|
36
|
+
/** A call-local conditional plan. Every yielded action still goes through broker validation. */
|
|
37
|
+
var ComputerButtonPlan = class {
|
|
38
|
+
steps = [];
|
|
39
|
+
goal;
|
|
40
|
+
awaiting;
|
|
41
|
+
get pending() {
|
|
42
|
+
return this.steps.length > 0;
|
|
43
|
+
}
|
|
44
|
+
reset() {
|
|
45
|
+
this.steps = [];
|
|
46
|
+
this.goal = void 0;
|
|
47
|
+
this.awaiting = void 0;
|
|
48
|
+
}
|
|
49
|
+
install(plan, goal, limit) {
|
|
50
|
+
this.reset();
|
|
51
|
+
if (plan.steps.length > limit) throw new Error("COMPUTER_INVALID_MODEL_OUTPUT");
|
|
52
|
+
this.goal = goal;
|
|
53
|
+
this.steps = [...plan.steps];
|
|
54
|
+
}
|
|
55
|
+
next(input) {
|
|
56
|
+
if (!this.steps.length) return;
|
|
57
|
+
const reject = () => {
|
|
58
|
+
this.reset();
|
|
59
|
+
};
|
|
60
|
+
if (!input.maxPlanActions || this.goal !== input.goal || !input.stateDigest) return reject();
|
|
61
|
+
if (this.awaiting) {
|
|
62
|
+
const last = input.history?.at(-1);
|
|
63
|
+
if (last?.dispatch !== "completed" || last.actionPreview !== this.awaiting.preview || last.afterStateDigest !== input.stateDigest || this.awaiting.digest === input.stateDigest) return reject();
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const data = NativeContextSchema.parse(JSON.parse(input.summary));
|
|
67
|
+
if (!data.elements.some((e) => e.role === "AXWindow")) return reject();
|
|
68
|
+
const step = this.steps[0];
|
|
69
|
+
const when = step.when;
|
|
70
|
+
if ("text" in when) {
|
|
71
|
+
if ((typeof data.text === "string" ? [...data.text.matchAll(/^\s*- AXStaticText = "([^"\n]*)"\s*$/gm)] : []).filter((match) => displayText(match[1]) === displayText(when.text)).length !== 1) return reject();
|
|
72
|
+
} else {
|
|
73
|
+
if (data.truncated === true) return reject();
|
|
74
|
+
const guards = data.elements.filter((e) => e.role === when.role && displayText(e.label) === displayText(when.label));
|
|
75
|
+
if (guards.length !== 1 || guards[0].in_web_content === true || when.value !== void 0 && displayText(guards[0].value) !== displayText(when.value)) return reject();
|
|
76
|
+
}
|
|
77
|
+
const buttons = data.elements.filter((e) => e.role === "AXButton" && e.label === step.label);
|
|
78
|
+
if (buttons.length !== 1 || buttons[0].enabled === false || buttons[0].in_web_content === true || typeof buttons[0].ref !== "string" || !buttons[0].semanticActions?.includes("activate")) return reject();
|
|
79
|
+
const action = {
|
|
80
|
+
kind: "activate",
|
|
81
|
+
ref: buttons[0].ref
|
|
82
|
+
};
|
|
83
|
+
this.steps.shift();
|
|
84
|
+
this.awaiting = {
|
|
85
|
+
preview: JSON.stringify(action),
|
|
86
|
+
digest: input.stateDigest
|
|
87
|
+
};
|
|
88
|
+
return action;
|
|
89
|
+
} catch {
|
|
90
|
+
return reject();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { ComputerButtonPlan, ComputerButtonPlanSchema };
|
|
@@ -28,8 +28,9 @@ function verifyComputerExpectation(expectation, observation, before) {
|
|
|
28
28
|
const data = JSON.parse(observation.summary);
|
|
29
29
|
if (!Array.isArray(data.elements) || !data.elements.some((e) => e.role === "AXWindow")) return result("unavailable");
|
|
30
30
|
if (expectation.kind === "text") {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const evidence = [data.text, ...data.elements.filter((e) => ["AXTextField", "AXTextArea"].includes(String(e.role)) && e.in_web_content !== true).map((e) => e.value)].filter((text) => typeof text === "string" && text.length > 0);
|
|
32
|
+
if (!evidence.length) return result("unavailable");
|
|
33
|
+
const verification = result(evidence.some((text) => text.includes(expectation.text)) ? "satisfied" : data.truncated ? "unavailable" : "not_met");
|
|
33
34
|
if (verification.status === "satisfied" && before && verifyComputerExpectation(expectation, before)?.status === "satisfied") verification.preexisting = true;
|
|
34
35
|
return verification;
|
|
35
36
|
}
|
|
@@ -4,8 +4,8 @@ import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from ".
|
|
|
4
4
|
import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "./lockfile.js";
|
|
5
5
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
6
6
|
import { loadConfig } from "../config/loader.js";
|
|
7
|
-
import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionNpm, stageExtensionStoreZip } from "./install-transaction.js";
|
|
8
7
|
import { findExtension } from "./marketplace.js";
|
|
8
|
+
import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionNpm, stageExtensionStoreZip } from "./install-transaction.js";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
@@ -11,6 +11,8 @@ import type { GatewayAuthConfig } from '../config/schema.js';
|
|
|
11
11
|
export interface ResolvedGatewayAuth {
|
|
12
12
|
mode: 'none' | 'token' | 'password' | 'trusted-proxy';
|
|
13
13
|
token?: string;
|
|
14
|
+
/** Origin of the resolved token; generated tokens only live for this process. */
|
|
15
|
+
tokenSource?: 'environment' | 'config' | 'generated';
|
|
14
16
|
password?: string;
|
|
15
17
|
trustedProxy?: GatewayAuthConfig['trustedProxy'];
|
|
16
18
|
}
|
package/dist/src/gateway/auth.js
CHANGED
|
@@ -23,9 +23,17 @@ function resolveGatewayAuth(params) {
|
|
|
23
23
|
trustedProxy: config.trustedProxy
|
|
24
24
|
};
|
|
25
25
|
let token;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
let tokenSource;
|
|
27
|
+
if (mode === "token") if (envToken) {
|
|
28
|
+
token = envToken;
|
|
29
|
+
tokenSource = "environment";
|
|
30
|
+
} else if (config.token) {
|
|
31
|
+
token = config.token;
|
|
32
|
+
tokenSource = "config";
|
|
33
|
+
} else {
|
|
34
|
+
token = crypto.randomBytes(24).toString("hex");
|
|
35
|
+
tokenSource = "generated";
|
|
36
|
+
}
|
|
29
37
|
let password;
|
|
30
38
|
if (mode === "password") {
|
|
31
39
|
if (envPassword) password = envPassword;
|
|
@@ -34,7 +42,8 @@ function resolveGatewayAuth(params) {
|
|
|
34
42
|
return {
|
|
35
43
|
mode,
|
|
36
44
|
token,
|
|
37
|
-
password
|
|
45
|
+
password,
|
|
46
|
+
...tokenSource ? { tokenSource } : {}
|
|
38
47
|
};
|
|
39
48
|
}
|
|
40
49
|
/**
|
|
@@ -2,8 +2,8 @@ import { getAllModels, getAvailableModels, init_providers } from "../../../provi
|
|
|
2
2
|
import { ActivationPlanner } from "../../../extensions/activation-planner.js";
|
|
3
3
|
import { mergeActivationContext } from "../../../extensions/activation-context.js";
|
|
4
4
|
import { validateExtensionConfig } from "../../../extensions/config-validation.js";
|
|
5
|
-
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
6
5
|
import { listAgentPluginInventory } from "../../../extensions/agent-plugins/inventory.js";
|
|
6
|
+
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
7
7
|
import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
8
8
|
import { createOAuthHandler } from "../oauth.js";
|
|
9
9
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { enumerateLanGatewayCandidates, init_host } from "../../host.js";
|
|
2
2
|
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
3
|
+
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
3
4
|
import { VOICE_SETTING_SCOPES, voiceSettingsRevisions } from "../lib/voice-settings-revisions.js";
|
|
4
5
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
5
|
-
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
6
6
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
7
7
|
import { applyGatewayPatch } from "./config-patch/gateway.js";
|
|
8
8
|
import { applyMiscPatch, validateGatewayAfterPatch } from "./config-patch/misc.js";
|
|
@@ -21,13 +21,13 @@ import { createConnectorSetupSecretRequest, submitConnectorSetupSecret } from ".
|
|
|
21
21
|
import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
|
|
22
22
|
import { getConnectorInstance, getInstalledConnectorDefinition, listConnectorInstances } from "../../../connectors/instances.js";
|
|
23
23
|
import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
|
|
24
|
+
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
24
25
|
import { resumeApprovedConnectorAction } from "../../../connectors/approval-resume.js";
|
|
25
26
|
import { startConnectorAuthorization } from "../../../connectors/auth-provider-registry.js";
|
|
26
27
|
import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
27
28
|
import { inspectManagedComposioStatus } from "../../../connectors/composio-managed-client.js";
|
|
28
29
|
import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
|
|
29
30
|
import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
|
|
30
|
-
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
31
31
|
import { testConnectorInstance } from "../../../connectors/health.js";
|
|
32
32
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
33
33
|
import { projectComposioConnectionStatus } from "../../../connectors/runtime-status.js";
|
|
@@ -90,12 +90,12 @@ function collectGatewayConfigFindings(params) {
|
|
|
90
90
|
detail: "Token consists of a single repeated character, making it trivially guessable.",
|
|
91
91
|
remediation: "Generate a cryptographically random token: `openssl rand -hex 32`."
|
|
92
92
|
});
|
|
93
|
-
if (
|
|
93
|
+
if (params.auth.tokenSource === "generated") findings.push({
|
|
94
94
|
checkId: "gateway.auth.auto_generated_token",
|
|
95
95
|
severity: "info",
|
|
96
96
|
title: "Gateway token was auto-generated",
|
|
97
|
-
detail: "
|
|
98
|
-
remediation: "
|
|
97
|
+
detail: "Neither gateway.auth.token nor XOPC_GATEWAY_TOKEN is set. The token was auto-generated and will change on each restart.",
|
|
98
|
+
remediation: "Save gateway.auth.token in the configuration or set XOPC_GATEWAY_TOKEN for a stable token."
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
if (params.corsOrigins?.includes("*")) findings.push({
|
|
@@ -8,8 +8,8 @@ import { reloadImageGenerationProviders } from "../../agent/image/generation/pro
|
|
|
8
8
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
9
9
|
import { ConfigHotReloader } from "../../config/reload.js";
|
|
10
10
|
import "../../config/index.js";
|
|
11
|
-
import { computeExtensionActivationPatch } from "../../extensions/bundled-extension-activation.js";
|
|
12
11
|
import { sanitizeTunnelConfig } from "../../tunnel/tunnel-config.js";
|
|
12
|
+
import { computeExtensionActivationPatch } from "../../extensions/bundled-extension-activation.js";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
//#region src/gateway/service/config-coordinator.ts
|
|
15
15
|
/**
|
|
@@ -84,10 +84,10 @@ import { bootstrapApplicationStateSync } from "../bootstrap/application-state.js
|
|
|
84
84
|
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
85
85
|
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
86
86
|
import { ChannelManager } from "../channels/manager.js";
|
|
87
|
-
import { ChatPreviewService } from "../chat-previews/service.js";
|
|
88
|
-
import "../chat-previews/index.js";
|
|
89
87
|
import { configureGatewayHttpProxy } from "../infra/http-proxy-env.js";
|
|
90
88
|
import "../config/index.js";
|
|
89
|
+
import { ChatPreviewService } from "../chat-previews/service.js";
|
|
90
|
+
import "../chat-previews/index.js";
|
|
91
91
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
92
92
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
93
93
|
import "../knowledge/index.js";
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveConfigPath } from "../config/paths.js";
|
|
4
4
|
import { loadConfig } from "../config/loader.js";
|
|
5
|
-
import { resolveGatewayService } from "../daemon/service.js";
|
|
6
5
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
6
|
+
import { resolveGatewayService } from "../daemon/service.js";
|
|
7
7
|
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
8
8
|
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
9
9
|
import { refreshGatewayServiceAfterUpdate } from "./update-service-refresh.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../package-version.js";
|
|
2
|
-
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
3
2
|
import "./update-channels.js";
|
|
4
3
|
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
4
|
+
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
5
5
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
6
6
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
7
7
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.404",
|
|
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",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@opentelemetry/context-async-hooks": "^2.12.0",
|
|
86
86
|
"@opentelemetry/sdk-trace-base": "^2.12.0",
|
|
87
87
|
"@sinclair/typebox": "^0.34.49",
|
|
88
|
-
"@trycua/cua-driver": "0.
|
|
88
|
+
"@trycua/cua-driver": "0.36.0",
|
|
89
89
|
"@vscode/ripgrep": "^1.18.0",
|
|
90
90
|
"abort-controller": "^3.0.0",
|
|
91
91
|
"adm-zip": "^0.6.1",
|
|
@@ -171,9 +171,9 @@
|
|
|
171
171
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
172
172
|
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
173
173
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
174
|
-
"@xopcai/gateway-contract": "0.0.0",
|
|
175
|
-
"@xopcai/image-providers": "0.1.0",
|
|
176
174
|
"@xopcai/computer-control-contract": "0.1.0",
|
|
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
|
},
|
|
@@ -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{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./cn-0WouolD0.js";import{c as s,n as c}from"./locale-store-Jnhw2WMv.js";import{n as l,r as u}from"./cloud-credits-BMYMiiNn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ao as ee,Fn as f,G as te,Hn as ne,In as re,Jl as ie,Qu as p,Rc as m,Wc as ae,Zl as h,as as g,fu as _,ra as oe,ru as se,us as ce,v as le,wd as v}from"./index-cmsFpzI8.js";import{t as ue}from"./number-input-DDeqHK-G.js";import{n as y,r as b}from"./settings-page-layout-Dx5S-Msc.js";import{n as x,t as S}from"./use-autosave-DrxAqqzV.js";var de=n(),C=e(t(),1),w=r(),T=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function E(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function fe({draft:e,setDraft:t,zh:n}){let[r,i]=(0,C.useState)(()=>e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),[a,o]=(0,C.useState)(!1);return(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`每次运行的 Cloud 消费上限(Credits)`:`Cloud spend limit per run (Credits)`,(0,w.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:r,"aria-invalid":a,placeholder:n?`不设置额外上限`:`No additional limit`,className:`${T} mt-2`,onChange:n=>{let r=n.target.value;i(r);try{let n=r===``?void 0:u(r);if(n===`0`||n&&n.length>15)throw Error(`Invalid limit`);o(!1),t({...e,runtime:{...e.runtime,cloudCreditLimitPerRunMicro:n}})}catch{o(!0)}},onBlur:()=>{a&&i(e.runtime.cloudCreditLimitPerRunMicro?l(e.runtime.cloudCreditLimitPerRunMicro):``),o(!1)}}),(0,w.jsx)(`span`,{className:`mt-2 block font-normal ${a?`text-danger`:`text-fg-subtle`}`,children:a?n?`请输入大于零、最多四位小数的 Credits。无效输入不会保存。`:`Enter positive Credits with up to four decimals. Invalid input is not saved.`:n?`模型、图片和文件语音调用共享上限;不支持实时语音或 Cloud 电脑控制,不包含运行前后的后台调用。达到上限后停止,调整后需手动继续。`:`Shared by model, image and file audio calls during a run. Does not support realtime voice or Cloud computer use; excludes background calls outside the run. Stops at the limit; continue manually after adjusting it.`})]})}function D(e){let t=(0,de.c)(189),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let s=d(`agent-defaults-workflows`,le,a),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(O),t[3]=c,t[4]=l);let u=l,f=n.workflows.allowed===void 0,ne;t[5]!==n||t[6]!==r?(ne=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=ne):ne=t[7];let re=ne,ie=i?`费用控制`:`Spending control`,p;t[8]===ie?p=t[9]:(p=(0,w.jsx)(`h2`,{className:`mb-4 text-base font-semibold text-fg`,children:ie}),t[8]=ie,t[9]=p);let m;t[10]!==n||t[11]!==r||t[12]!==i?(m=(0,w.jsx)(fe,{draft:n,setDraft:r,zh:i}),t[10]=n,t[11]=r,t[12]=i,t[13]=m):m=t[13];let h;t[14]!==p||t[15]!==m?(h=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[p,m]}),t[14]=p,t[15]=m,t[16]=h):h=t[16];let g=i?`执行与缓存策略`:`Execution and cache policy`,_=i?`轮数:${n.runtime.maxTurns??`默认`} · 超时:${n.runtime.timeoutMs??`默认`} · 缓存:${n.runtime.promptCache?.mode??`默认`} · Codemode:${n.runtime.codemode?.enabled?`开启`:`关闭`}`:`Turns: ${n.runtime.maxTurns??`default`} · Timeout: ${n.runtime.timeoutMs??`default`} · Cache: ${n.runtime.promptCache?.mode??`default`} · Codemode: ${n.runtime.codemode?.enabled?`on`:`off`}`,oe=n.runtime.codemode?.enabled??!1,se;t[17]!==n||t[18]!==r?(se=e=>r({...n,runtime:{...n.runtime,codemode:{...n.runtime.codemode,enabled:e.target.checked}}}),t[17]=n,t[18]=r,t[19]=se):se=t[19];let v;t[20]!==oe||t[21]!==se?(v=(0,w.jsx)(`input`,{type:`checkbox`,checked:oe,onChange:se,className:`mt-1 size-4 accent-[var(--color-accent)]`}),t[20]=oe,t[21]=se,t[22]=v):v=t[22];let y=i?`Codemode 读取试点`:`Codemode read pilot`,b;t[23]===y?b=t[24]:(b=(0,w.jsx)(`span`,{className:`block text-base font-semibold text-fg`,children:y}),t[23]=y,t[24]=b);let x=i?`允许智能体用脚本组合已授权的读取工具。默认关闭,保留普通工具调用。`:`Let agents combine authorized reads in scripts. Off by default; ordinary tool calls stay available.`,S;t[25]===x?S=t[26]:(S=(0,w.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:x}),t[25]=x,t[26]=S);let C;t[27]!==b||t[28]!==S?(C=(0,w.jsxs)(`span`,{children:[b,S]}),t[27]=b,t[28]=S,t[29]=C):C=t[29];let D;t[30]!==v||t[31]!==C?(D=(0,w.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[v,C]})}),t[30]=v,t[31]=C,t[32]=D):D=t[32];let k=i?`执行限制`:`Execution limits`,A;t[33]===k?A=t[34]:(A=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:k}),t[33]=k,t[34]=A);let j=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,M;t[35]===j?M=t[36]:(M=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:j}),t[35]=j,t[36]=M);let N=i?`每次运行最多轮数`:`Maximum turns per run`,pe=n.runtime.maxTurns??``,me=i?`系统默认`:`System default`,P;t[37]!==n||t[38]!==r?(P=e=>r({...n,runtime:{...n.runtime,maxTurns:E(e.target.value)}}),t[37]=n,t[38]=r,t[39]=P):P=t[39];let F;t[40]!==pe||t[41]!==me||t[42]!==P?(F=(0,w.jsx)(ue,{allowEmpty:!0,type:`number`,min:1,value:pe,placeholder:me,onChange:P,className:`${T} mt-2`}),t[40]=pe,t[41]=me,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==N||t[45]!==F?(I=(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[N,F]}),t[44]=N,t[45]=F,t[46]=I):I=t[46];let he=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,ge=n.runtime.timeoutMs??``,_e=i?`系统默认`:`System default`,L;t[47]!==n||t[48]!==r?(L=e=>r({...n,runtime:{...n.runtime,timeoutMs:E(e.target.value)}}),t[47]=n,t[48]=r,t[49]=L):L=t[49];let R;t[50]!==ge||t[51]!==_e||t[52]!==L?(R=(0,w.jsx)(ue,{allowEmpty:!0,type:`number`,min:1,value:ge,placeholder:_e,onChange:L,className:`${T} mt-2`}),t[50]=ge,t[51]=_e,t[52]=L,t[53]=R):R=t[53];let z;t[54]!==he||t[55]!==R?(z=(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[he,R]}),t[54]=he,t[55]=R,t[56]=z):z=t[56];let B=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,V=n.runtime.maxToolFailuresPerTurn??``,H=i?`系统默认`:`System default`,U;t[57]!==n||t[58]!==r?(U=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:E(e.target.value)}}),t[57]=n,t[58]=r,t[59]=U):U=t[59];let W;t[60]!==V||t[61]!==H||t[62]!==U?(W=(0,w.jsx)(ue,{allowEmpty:!0,type:`number`,min:1,value:V,placeholder:H,onChange:U,className:`${T} mt-2`}),t[60]=V,t[61]=H,t[62]=U,t[63]=W):W=t[63];let G;t[64]!==B||t[65]!==W?(G=(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[B,W]}),t[64]=B,t[65]=W,t[66]=G):G=t[66];let ve;t[67]!==I||t[68]!==z||t[69]!==G?(ve=(0,w.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[I,z,G]}),t[67]=I,t[68]=z,t[69]=G,t[70]=ve):ve=t[70];let K;t[71]!==A||t[72]!==M||t[73]!==ve?(K=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[A,M,ve]}),t[71]=A,t[72]=M,t[73]=ve,t[74]=K):K=t[74];let q=i?`提示词缓存`:`Prompt cache`,J;t[75]===q?J=t[76]:(J=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:q}),t[75]=q,t[76]=J);let Y=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,X;t[77]===Y?X=t[78]:(X=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let ye=i?`缓存模式`:`Cache mode`,Z;t[79]===ye?Z=t[80]:(Z=(0,w.jsx)(`span`,{children:ye}),t[79]=ye,t[80]=Z);let be=i?`缓存模式`:`Cache mode`,Q;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Q=[`auto`,`off`],t[81]=Q):Q=t[81];let $;t[82]!==n||t[83]!==r||t[84]!==i?($=Q.map(e=>(0,w.jsx)(ae,{"aria-pressed":n.runtime.promptCache?.mode===e,variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e)),t[82]=n,t[83]=r,t[84]=i,t[85]=$):$=t[85];let xe;t[86]!==be||t[87]!==$?(xe=(0,w.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":be,children:$}),t[86]=be,t[87]=$,t[88]=xe):xe=t[88];let Se;t[89]!==Z||t[90]!==xe?(Se=(0,w.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[Z,xe]}),t[89]=Z,t[90]=xe,t[91]=Se):Se=t[91];let Ce;t[92]!==n||t[93]!==r||t[94]!==i?(Ce=n.runtime.promptCache?.mode===`auto`?(0,w.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,w.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,w.jsx)(ee,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,role:`group`,"aria-label":i?`缓存周期`:`Cache lifetime`,children:[`short`,`long`].map(e=>(0,w.jsx)(ae,{"aria-pressed":n.runtime.promptCache?.lifetime===e,variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[92]=n,t[93]=r,t[94]=i,t[95]=Ce):Ce=t[95];let we;t[96]!==Se||t[97]!==Ce?(we=(0,w.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[Se,Ce]}),t[96]=Se,t[97]=Ce,t[98]=we):we=t[98];let Te;t[99]!==J||t[100]!==X||t[101]!==we?(Te=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[J,X,we]}),t[99]=J,t[100]=X,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==_||t[104]!==D||t[105]!==K||t[106]!==Te||t[107]!==g?(Ee=(0,w.jsxs)(te,{title:g,summary:_,children:[D,K,Te]}),t[103]=_,t[104]=D,t[105]=K,t[106]=Te,t[107]=g,t[108]=Ee):Ee=t[108];let De=i?`工作流`:`Workflows`,Oe;t[109]===De?Oe=t[110]:(Oe=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:De}),t[109]=De,t[110]=Oe);let ke=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,Ae;t[111]===ke?Ae=t[112]:(Ae=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ke}),t[111]=ke,t[112]=Ae);let je=i?`默认工作流`:`Default workflow`,Me=n.workflows.default||(i?`未自动绑定工作流`:`No workflow bound automatically`),Ne=i?`默认工作流`:`Default workflow`,Pe;t[113]===Ne?Pe=t[114]:(Pe=(0,w.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:Ne}),t[113]=Ne,t[114]=Pe);let Fe=n.workflows.default??``,Ie=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,Le=i?`不设置默认工作流`:`No default workflow`,Re=i?`默认工作流`:`Default workflow`,ze;t[115]!==n||t[116]!==r?(ze=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[115]=n,t[116]=r,t[117]=ze):ze=t[117];let Be;t[118]!==Fe||t[119]!==Ie||t[120]!==Le||t[121]!==Re||t[122]!==ze||t[123]!==u||t[124]!==s.isLoading?(Be=(0,w.jsx)(ce,{value:Fe,options:u,placeholder:Ie,emptyLabel:Le,disabled:s.isLoading,ariaLabel:Re,onChange:ze,triggerClassName:`mt-2`}),t[118]=Fe,t[119]=Ie,t[120]=Le,t[121]=Re,t[122]=ze,t[123]=u,t[124]=s.isLoading,t[125]=Be):Be=t[125];let Ve;t[126]!==Pe||t[127]!==Be?(Ve=(0,w.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[Pe,Be]}),t[126]=Pe,t[127]=Be,t[128]=Ve):Ve=t[128];let He;t[129]!==je||t[130]!==Me||t[131]!==Ve?(He=(0,w.jsx)(te,{title:je,summary:Me,children:Ve}),t[129]=je,t[130]=Me,t[131]=Ve,t[132]=He):He=t[132];let Ue;t[133]===s.error?Ue=t[134]:(Ue=s.error?(0,w.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[133]=s.error,t[134]=Ue);let We=i?`允许调用的工作流`:`Allowed workflows`,Ge;t[135]===We?Ge=t[136]:(Ge=(0,w.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:We}),t[135]=We,t[136]=Ge);let Ke;t[137]!==n||t[138]!==r?(Ke=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[137]=n,t[138]=r,t[139]=Ke):Ke=t[139];let qe=f?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,Je;t[140]===qe?Je=t[141]:(Je=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,qe),t[140]=qe,t[141]=Je);let Ye=i?`允许全部工作流`:`Allow every workflow`,Xe;t[142]===Ye?Xe=t[143]:(Xe=(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Ye}),t[142]=Ye,t[143]=Xe);let Ze=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,Qe;t[144]===Ze?Qe=t[145]:(Qe=(0,w.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ze}),t[144]=Ze,t[145]=Qe);let $e;t[146]!==Ke||t[147]!==Je||t[148]!==Xe||t[149]!==Qe?($e=(0,w.jsxs)(`button`,{type:`button`,onClick:Ke,className:Je,children:[Xe,Qe]}),t[146]=Ke,t[147]=Je,t[148]=Xe,t[149]=Qe,t[150]=$e):$e=t[150];let et;t[151]!==n||t[152]!==r?(et=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[151]=n,t[152]=r,t[153]=et):et=t[153];let tt=f?`hover:bg-surface-hover`:`bg-accent-soft shadow-surface`,nt;t[154]===tt?nt=t[155]:(nt=o(`rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,tt),t[154]=tt,t[155]=nt);let rt=i?`只允许选中的工作流`:`Allow selected workflows only`,it;t[156]===rt?it=t[157]:(it=(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:rt}),t[156]=rt,t[157]=it);let at=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,ot;t[158]===at?ot=t[159]:(ot=(0,w.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:at}),t[158]=at,t[159]=ot);let st;t[160]!==et||t[161]!==nt||t[162]!==it||t[163]!==ot?(st=(0,w.jsxs)(`button`,{type:`button`,onClick:et,className:nt,children:[it,ot]}),t[160]=et,t[161]=nt,t[162]=it,t[163]=ot,t[164]=st):st=t[164];let ct;t[165]!==$e||t[166]!==st?(ct=(0,w.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[$e,st]}),t[165]=$e,t[166]=st,t[167]=ct):ct=t[167];let lt;t[168]!==f||t[169]!==n.workflows.allowed||t[170]!==re||t[171]!==s.data||t[172]!==s.isLoading||t[173]!==i?(lt=f?null:(0,w.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[(s.data??[]).map(e=>(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>re(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,w.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,w.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[168]=f,t[169]=n.workflows.allowed,t[170]=re,t[171]=s.data,t[172]=s.isLoading,t[173]=i,t[174]=lt):lt=t[174];let ut;t[175]!==Ge||t[176]!==ct||t[177]!==lt?(ut=(0,w.jsxs)(`div`,{className:`mt-6 rounded-xl bg-surface-base/45 p-4`,children:[Ge,ct,lt]}),t[175]=Ge,t[176]=ct,t[177]=lt,t[178]=ut):ut=t[178];let dt;t[179]!==Oe||t[180]!==Ae||t[181]!==He||t[182]!==Ue||t[183]!==ut?(dt=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,Ae,He,Ue,ut]}),t[179]=Oe,t[180]=Ae,t[181]=He,t[182]=Ue,t[183]=ut,t[184]=dt):dt=t[184];let ft;return t[185]!==Ee||t[186]!==h||t[187]!==dt?(ft=(0,w.jsxs)(`div`,{className:`space-y-5`,children:[h,Ee,dt]}),t[185]=Ee,t[186]=h,t[187]=dt,t[188]=ft):ft=t[188],ft}function O(e){return{value:e.id,label:e.title||e.name}}function k(e){return[...new Set(e)].sort()}var A=[{id:`core`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`],en:`Core`,zh:`核心`},{id:`office`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`docx`,`pdf`,`pptx`,`xlsx`],en:`Office`,zh:`办公成果`},{id:`local-app`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`build-xopc-local-app`,`frontend-design`,`theme-factory`],en:`Local App`,zh:`本地应用`},{id:`developer`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`diagnose`,`github`,`tdd`,`webapp-testing`],en:`Developer`,zh:`开发者`},{id:`desktop-pet`,names:[`doc-coauthoring`,`define-task`,`find-skills`,`summarize`,`hatch-pet`],en:`Desktop Pet`,zh:`桌面宠物`}];function j(e){let t=(0,de.c)(115),{draft:n,setDraft:r,zh:i}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[0]=s):s=t[0];let{data:c,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,oe,s),[ee,f]=(0,C.useState)(``),te=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;c?.catalog;let ne;if(t[1]!==te||t[2]!==c?.catalog||t[3]!==ee){let e=[...c?.catalog??[]],n=new Set(e.map(P));for(let t of te)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=ee.trim().toLowerCase();ne=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(me),t[1]=te,t[2]=c?.catalog,t[3]=ee,t[4]=ne}else ne=t[4];let re=ne,ie;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(ie=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=ie):ie=t[8];let m=ie,ae;t[9]!==n||t[10]!==r?(ae=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):k([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):k([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=ae):ae=t[11];let h=ae,g;t[12]===c?.catalog?g=t[13]:(g=c?.catalog??[],t[12]=c?.catalog,t[13]=g);let _;if(t[14]!==m||t[15]!==g){let e;t[17]===m?e=t[18]:(e=e=>e.enabled&&m(e.name),t[17]=m,t[18]=e),_=g.filter(e),t[14]=m,t[15]=g,t[16]=_}else _=t[16];let ce=_.length,le;t[19]!==c?.catalog||t[20]!==n||t[21]!==r?(le=e=>{let t=new Set((c?.catalog??[]).filter(pe).map(N));r({...n,skills:{mode:`selected`,include:k(e.filter(e=>t.has(e)))}})},t[19]=c?.catalog,t[20]=n,t[21]=r,t[22]=le):le=t[22];let v=le,ue=i?`技能策略`:`Skill policy`,y;t[23]===ue?y=t[24]:(y=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ue}),t[23]=ue,t[24]=y);let b=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,x;t[25]===b?x=t[26]:(x=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:b}),t[25]=b,t[26]=x);let S;t[27]!==n||t[28]!==r?(S=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[27]=n,t[28]=r,t[29]=S):S=t[29];let T=n.skills.mode===`all-enabled`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,E;t[30]===T?E=t[31]:(E=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,T),t[30]=T,t[31]=E);let fe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,w.jsx)(a,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[32]=fe):fe=t[32];let D=i?`使用所有已启用技能`:`Use every enabled skill`,O;t[33]===D?O=t[34]:(O=(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:D}),t[33]=D,t[34]=O);let j=i?`适合需要完整目录的高级智能体;新增技能会自动加入。`:`For advanced agents that need the full catalog; newly enabled skills are added automatically.`,F;t[35]===j?F=t[36]:(F=(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:j}),t[35]=j,t[36]=F);let I;t[37]!==O||t[38]!==F?(I=(0,w.jsxs)(`span`,{children:[O,F]}),t[37]=O,t[38]=F,t[39]=I):I=t[39];let he;t[40]!==S||t[41]!==E||t[42]!==I?(he=(0,w.jsxs)(`button`,{type:`button`,onClick:S,className:E,children:[fe,I]}),t[40]=S,t[41]=E,t[42]=I,t[43]=he):he=t[43];let ge;t[44]!==n||t[45]!==r?(ge=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[44]=n,t[45]=r,t[46]=ge):ge=t[46];let _e=n.skills.mode===`selected`?`bg-accent-soft shadow-surface`:`hover:bg-surface-hover`,L;t[47]===_e?L=t[48]:(L=o(`flex items-start gap-3 rounded-xl bg-surface-base/55 p-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,_e),t[47]=_e,t[48]=L);let R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,w.jsx)(p,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[49]=R):R=t[49];let z=i?`只使用选中的技能`:`Use selected skills only`,B;t[50]===z?B=t[51]:(B=(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,H;t[52]===V?H=t[53]:(H=(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U;t[54]!==B||t[55]!==H?(U=(0,w.jsxs)(`span`,{children:[B,H]}),t[54]=B,t[55]=H,t[56]=U):U=t[56];let W;t[57]!==ge||t[58]!==L||t[59]!==U?(W=(0,w.jsxs)(`button`,{type:`button`,onClick:ge,className:L,children:[R,U]}),t[57]=ge,t[58]=L,t[59]=U,t[60]=W):W=t[60];let G;t[61]!==he||t[62]!==W?(G=(0,w.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[he,W]}),t[61]=he,t[62]=W,t[63]=G):G=t[63];let ve=i?`能力组合(会替换当前选择)`:`Capability packs (replaces the current selection)`,K;t[64]===ve?K=t[65]:(K=(0,w.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:ve}),t[64]=ve,t[65]=K);let q;t[66]!==v||t[67]!==c||t[68]!==i?(q=A.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>v(e.names),disabled:!c,className:`rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,children:i?e.zh:e.en},e.id)),t[66]=v,t[67]=c,t[68]=i,t[69]=q):q=t[69];let J;t[70]===q?J=t[71]:(J=(0,w.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:q}),t[70]=q,t[71]=J);let Y;t[72]!==K||t[73]!==J?(Y=(0,w.jsxs)(`div`,{className:`mt-4`,children:[K,J]}),t[72]=K,t[73]=J,t[74]=Y):Y=t[74];let X;t[75]!==x||t[76]!==G||t[77]!==Y||t[78]!==y?(X=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[y,x,G,Y]}),t[75]=x,t[76]=G,t[77]=Y,t[78]=y,t[79]=X):X=t[79];let ye=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Z;t[80]===ye?Z=t[81]:(Z=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ye}),t[80]=ye,t[81]=Z);let be=i?`当前默认可用 ${ce} 个技能。`:`${ce} skills are available by default.`,Q;t[82]===be?Q=t[83]:(Q=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:be}),t[82]=be,t[83]=Q);let $;t[84]!==Z||t[85]!==Q?($=(0,w.jsxs)(`div`,{children:[Z,Q]}),t[84]=Z,t[85]=Q,t[86]=$):$=t[86];let xe=i?`搜索技能`:`Search skills`,Se;t[87]===xe?Se=t[88]:(Se=(0,w.jsx)(`span`,{className:`sr-only`,children:xe}),t[87]=xe,t[88]=Se);let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,w.jsx)(se,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[89]=Ce):Ce=t[89];let we;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>f(e.target.value),t[90]=we):we=t[90];let Te=i?`搜索技能`:`Search skills`,Ee;t[91]!==ee||t[92]!==Te?(Ee=(0,w.jsx)(`input`,{type:`search`,value:ee,onChange:we,placeholder:Te,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[91]=ee,t[92]=Te,t[93]=Ee):Ee=t[93];let De;t[94]!==Se||t[95]!==Ee?(De=(0,w.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[Se,Ce,Ee]}),t[94]=Se,t[95]=Ee,t[96]=De):De=t[96];let Oe;t[97]!==$||t[98]!==De?(Oe=(0,w.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[$,De]}),t[97]=$,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]===l?ke=t[101]:(ke=l?(0,w.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[100]=l,t[101]=ke);let Ae;t[102]!==m||t[103]!==u||t[104]!==re||t[105]!==h||t[106]!==i?(Ae=u?(0,w.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(M)}):(0,w.jsxs)(`div`,{className:`mt-4 flex max-h-[32rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>label]:rounded-lg [&>label]:bg-surface-panel/55`,children:[re.map(e=>{let t=m(e.name);return(0,w.jsxs)(`label`,{className:o(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>h(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,w.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,w.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),re.length===0?(0,w.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[102]=m,t[103]=u,t[104]=re,t[105]=h,t[106]=i,t[107]=Ae):Ae=t[107];let je;t[108]!==Oe||t[109]!==ke||t[110]!==Ae?(je=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[Oe,ke,Ae]}),t[108]=Oe,t[109]=ke,t[110]=Ae,t[111]=je):je=t[111];let Me;return t[112]!==X||t[113]!==je?(Me=(0,w.jsxs)(`div`,{className:`space-y-5`,children:[X,je]}),t[112]=X,t[113]=je,t[114]=Me):Me=t[114],Me}function M(e){return(0,w.jsx)(m,{className:`h-14 rounded-xl`},e)}function N(e){return e.name}function pe(e){return e.enabled}function me(e,t){return e.name.localeCompare(t.name)}function P(e){return e.name}function F(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function I(e){let t=(0,de.c)(101),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,s=ne(),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(`all`),[f,re]=(0,C.useState)(),p;t[0]===i?p=t[1]:(p=new Map(i.map(_e)),t[0]=i,t[1]=p);let m=p,h;t[2]!==i||t[3]!==n.tools?(h=[...new Set([...i.map(ge),...Object.keys(n.tools)])].filter(he).sort(),t[2]=i,t[3]=n.tools,t[4]=h):h=t[4];let g=h,_;if(t[5]!==g||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),_=g.filter(e),t[5]=g,t[6]=n.tools,t[7]=_}else _=t[7];let oe=_.length,ce;if(t[10]!==g||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),ce=g.filter(e),t[10]=g,t[11]=n.tools,t[12]=ce}else ce=t[12];let le=ce.length,v;if(t[15]!==g||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),v=g.filter(e),t[15]=g,t[16]=n.tools,t[17]=v}else v=t[17];let y;t[20]!==_.length||t[21]!==ce.length||t[22]!==v.length?(y={allow:oe,ask:le,deny:v.length},t[20]=_.length,t[21]=ce.length,t[22]=v.length,t[23]=y):y=t[23];let b=y,x;if(t[24]!==g||t[25]!==m||t[26]!==n.tools||t[27]!==u||t[28]!==c){let e=c.trim().toLowerCase();x=g.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=m.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(u===`all`||r===u)}),t[24]=g,t[25]=m,t[26]=n.tools,t[27]=u,t[28]=c,t[29]=x}else x=t[29];let S=x,T;t[30]!==n||t[31]!==r?(T=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=T):T=t[32];let E=T,fe=a?`全部 ${g.length}`:`All ${g.length}`,D;t[33]===fe?D=t[34]:(D={id:`all`,label:fe},t[33]=fe,t[34]=D);let O=a?`允许 ${b.allow}`:`Allow ${b.allow}`,k;t[35]===O?k=t[36]:(k={id:`allow`,label:O},t[35]=O,t[36]=k);let A=a?`询问 ${b.ask}`:`Ask ${b.ask}`,j;t[37]===A?j=t[38]:(j={id:`ask`,label:A},t[37]=A,t[38]=j);let M=a?`禁用 ${b.deny}`:`Deny ${b.deny}`,N;t[39]===M?N=t[40]:(N={id:`deny`,label:M},t[39]=M,t[40]=N);let pe;t[41]!==D||t[42]!==k||t[43]!==j||t[44]!==N?(pe=[D,k,j,N],t[41]=D,t[42]=k,t[43]=j,t[44]=N,t[45]=pe):pe=t[45];let me=pe,P=a?`默认工具权限`:`Default tool permissions`,I;t[46]===P?I=t[47]:(I=(0,w.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:P}),t[46]=P,t[47]=I);let L=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,R;t[48]===L?R=t[49]:(R=(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:L}),t[48]=L,t[49]=R);let z;t[50]!==I||t[51]!==R?(z=(0,w.jsxs)(`div`,{children:[I,R]}),t[50]=I,t[51]=R,t[52]=z):z=t[52];let B=a?`工具筛选`:`Tool filter`,V;t[53]!==u||t[54]!==me?(V=me.map(e=>(0,w.jsx)(`button`,{"aria-pressed":u===e.id,type:`button`,onClick:()=>d(e.id),className:o(`rounded-lg px-3 py-1.5 text-xs font-medium`,u===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id)),t[53]=u,t[54]=me,t[55]=V):V=t[55];let H;t[56]!==B||t[57]!==V?(H=(0,w.jsx)(ee,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,role:`group`,"aria-label":B,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:V}),t[56]=B,t[57]=V,t[58]=H):H=t[58];let U=a?`搜索工具`:`Search tools`,W;t[59]===U?W=t[60]:(W=(0,w.jsx)(`span`,{className:`sr-only`,children:U}),t[59]=U,t[60]=W);let G;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,w.jsx)(se,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[61]=G):G=t[61];let ve;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>l(e.target.value),t[62]=ve):ve=t[62];let K=a?`搜索工具`:`Search tools`,q;t[63]!==c||t[64]!==K?(q=(0,w.jsx)(`input`,{type:`search`,value:c,onChange:ve,placeholder:K,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[63]=c,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==W||t[67]!==q?(J=(0,w.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[W,G,q]}),t[66]=W,t[67]=q,t[68]=J):J=t[68];let Y;t[69]!==H||t[70]!==J?(Y=(0,w.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[H,J]}),t[69]=H,t[70]=J,t[71]=Y):Y=t[71];let X=a?`工具调用限制`:`Tool call limits`,ye=a?`每个工具的调用次数和超时限制继续生效;授权可在下方直接修改。`:`Call and timeout limits remain active; edit permissions below.`,Z;t[72]!==X||t[73]!==ye?(Z=(0,w.jsx)(te,{title:X,summary:ye,children:null}),t[72]=X,t[73]=ye,t[74]=Z):Z=t[74];let be;if(t[75]!==m||t[76]!==n.tools||t[77]!==f||t[78]!==s||t[79]!==E||t[80]!==S||t[81]!==a){let e;t[83]!==m||t[84]!==n.tools||t[85]!==f||t[86]!==s||t[87]!==E||t[88]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=m.get(e),i=f===e;return(0,w.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,w.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(ee,{className:`flex rounded-lg bg-surface-base p-1`,role:`group`,"aria-label":e,indicatorClassName:`rounded-md bg-accent`,children:[`allow`,`ask`,`deny`].map(n=>(0,w.jsx)(`button`,{"aria-pressed":t.mode===n,type:`button`,onClick:()=>E(e,{mode:n}),className:o(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-on-accent`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),s?(0,w.jsx)(ae,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>re(i?void 0:e),children:(0,w.jsx)(ie,{className:`size-4`})}):null]})]}),i&&s?(0,w.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,w.jsx)(ue,{allowEmpty:!0,type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>E(e,{maxCallsPerTurn:F(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,w.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,w.jsx)(ue,{allowEmpty:!0,type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>E(e,{timeoutMs:F(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[83]=m,t[84]=n.tools,t[85]=f,t[86]=s,t[87]=E,t[88]=a,t[89]=e):e=t[89],be=S.map(e),t[75]=m,t[76]=n.tools,t[77]=f,t[78]=s,t[79]=E,t[80]=S,t[81]=a,t[82]=be}else be=t[82];let Q;t[90]!==S.length||t[91]!==a?(Q=S.length===0?(0,w.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[90]=S.length,t[91]=a,t[92]=Q):Q=t[92];let $;t[93]!==be||t[94]!==Q?($=(0,w.jsxs)(`div`,{className:`mt-4 flex max-h-[38rem] flex-col gap-1 overflow-y-auto rounded-xl bg-surface-base/45 p-1 [&>*]:rounded-lg [&>*]:bg-surface-panel/55`,children:[be,Q]}),t[93]=be,t[94]=Q,t[95]=$):$=t[95];let xe;return t[96]!==z||t[97]!==Y||t[98]!==Z||t[99]!==$?(xe=(0,w.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[z,Y,Z,$]}),t[96]=z,t[97]=Y,t[98]=Z,t[99]=$,t[100]=xe):xe=t[100],xe}function he(e){return e!==`computer_use`||g()}function ge(e){return e.id}function _e(e){return[e.id,e.description]}function L(){let e=(0,de.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(b,{gap:`gap-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(m,{className:`h-7 w-56`}),(0,w.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,w.jsx)(m,{className:`h-9 w-28`})]}),(0,w.jsx)(m,{className:`h-20 rounded-2xl`}),(0,w.jsx)(m,{className:`h-12 rounded-xl`}),(0,w.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function R(e){let t=(0,de.c)(65),{initial:n,builtinTools:r,zh:a}=e,[s,c]=i(),l;t[0]===s?l=t[1]:(l=s.get(`panel`),t[0]=s,t[1]=l);let u=l,d=u===`skills`||u===`tools`||u===`runtime`?u:`skills`,te;t[2]!==s||t[3]!==c?(te=e=>{let t=new URLSearchParams(s);t.set(`panel`,e),c(t,{replace:!0})},t[2]=s,t[3]=c,t[4]=te):te=t[4];let ne=te,ie;t[5]===n?ie=t[6]:(ie=()=>structuredClone(n),t[5]=n,t[6]=ie);let[p,m]=(0,C.useState)(ie),g;t[7]===n?g=t[8]:(g=()=>structuredClone(n),t[7]=n,t[8]=g);let[oe,se]=(0,C.useState)(g),ce;t[9]===p?ce=t[10]:(ce=JSON.stringify(p),t[9]=p,t[10]=ce);let le;t[11]===oe?le=t[12]:(le=JSON.stringify(oe),t[11]=oe,t[12]=le);let ue=ce!==le,T=a?`技能`:`Skills`,E;t[13]===T?E=t[14]:(E={id:`skills`,label:T,icon:_},t[13]=T,t[14]=E);let fe=a?`工具`:`Tools`,O;t[15]===fe?O=t[16]:(O={id:`tools`,label:fe,icon:h},t[15]=fe,t[16]=O);let k=a?`运行`:`Runtime`,A;t[17]===k?A=t[18]:(A={id:`runtime`,label:k,icon:v},t[17]=k,t[18]=A);let M;t[19]!==O||t[20]!==A||t[21]!==E?(M=[E,O,A],t[19]=O,t[20]=A,t[21]=E,t[22]=M):M=t[22];let N=M,pe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(pe=async e=>{let t=structuredClone(e),n=await f(),r=await re({...t,models:n.defaults.models},{scope:`agent`}),i=structuredClone(r.defaults);m(e=>JSON.stringify(e)===JSON.stringify(t)?i:e),se(structuredClone(i))},t[23]=pe):pe=t[23];let me=pe,P;t[24]!==ue||t[25]!==p?(P={value:p,dirty:ue,onSave:me,delayMs:0},t[24]=ue,t[25]=p,t[26]=P):P=t[26];let F=S(P),he=F.onBlurCapture,ge=a?`智能体设置`:`Agent settings`,_e;t[27]!==F.error||t[28]!==F.status?(_e=(0,w.jsx)(x,{status:F.status,error:F.error}),t[27]=F.error,t[28]=F.status,t[29]=_e):_e=t[29];let L;t[30]!==ge||t[31]!==_e?(L=(0,w.jsx)(y,{title:ge,actions:_e}),t[30]=ge,t[31]=_e,t[32]=L):L=t[32];let R;t[33]!==F.error||t[34]!==F.retry||t[35]!==a?(R=F.error?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,w.jsx)(`span`,{children:F.error}),(0,w.jsx)(ae,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:F.retry,children:a?`重试`:`Retry`})]}):null,t[33]=F.error,t[34]=F.retry,t[35]=a,t[36]=R):R=t[36];let z=a?`默认配置分区`:`Default configuration sections`,B;t[37]!==d||t[38]!==ne||t[39]!==N?(B=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":d===t,onClick:()=>ne(t),className:o(`flex min-w-0 items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,d===t?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,w.jsx)(r,{className:o(`size-4 shrink-0`,d===t?`text-accent`:`text-fg-subtle`)}),(0,w.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[37]=d,t[38]=ne,t[39]=N,t[40]=B):B=t[40];let V;t[41]!==z||t[42]!==B?(V=(0,w.jsx)(ee,{as:`nav`,className:`grid grid-cols-3 gap-1 rounded-xl bg-surface-hover/20 p-1`,"aria-label":z,indicatorClassName:`rounded-lg bg-surface-base shadow-surface`,children:B}),t[41]=z,t[42]=B,t[43]=V):V=t[43];let H;t[44]!==d||t[45]!==p||t[46]!==a?(H=d===`skills`?(0,w.jsx)(j,{draft:p,setDraft:m,zh:a}):null,t[44]=d,t[45]=p,t[46]=a,t[47]=H):H=t[47];let U;t[48]!==d||t[49]!==r||t[50]!==p||t[51]!==a?(U=d===`tools`?(0,w.jsx)(I,{draft:p,setDraft:m,builtinTools:r,zh:a}):null,t[48]=d,t[49]=r,t[50]=p,t[51]=a,t[52]=U):U=t[52];let W;t[53]!==d||t[54]!==p||t[55]!==a?(W=d===`runtime`?(0,w.jsx)(D,{draft:p,setDraft:m,zh:a}):null,t[53]=d,t[54]=p,t[55]=a,t[56]=W):W=t[56];let G;return t[57]!==F.onBlurCapture||t[58]!==L||t[59]!==R||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==W?(G=(0,w.jsxs)(b,{gap:`gap-5`,onBlurCapture:he,children:[L,R,V,H,U,W]}),t[57]=F.onBlurCapture,t[58]=L,t[59]=R,t[60]=V,t[61]=H,t[62]=U,t[63]=W,t[64]=G):G=t[64],G}function z(){let e=(0,de.c)(17),t=s(V),n=c(B)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,f);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,w.jsx)(b,{children:(0,w.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,w.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,w.jsx)(ae,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,w.jsxs)(b,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsx)(L,{}),e[12]=t):t=e[12],t}let l;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(l=(0,w.jsx)(R,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=l):l=e[16],l}function B(e){return e.language}function V(e){return e.conversationId}export{z as AgentDefaultsSettingsPanel};
|