@vm0/cli 9.157.1 → 9.158.1
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/{chunk-YWCHIHYE.js → chunk-Y2IQIGV7.js} +671 -143
- package/{chunk-YWCHIHYE.js.map → chunk-Y2IQIGV7.js.map} +1 -1
- package/index.js +9 -9
- package/package.json +1 -2
- package/zero.js +275 -1043
- package/zero.js.map +1 -1
|
@@ -30012,7 +30012,7 @@ var require_proxy_agent = __commonJS({
|
|
|
30012
30012
|
});
|
|
30013
30013
|
}
|
|
30014
30014
|
dispatch(opts, handler) {
|
|
30015
|
-
const headers =
|
|
30015
|
+
const headers = buildHeaders5(opts.headers);
|
|
30016
30016
|
throwIfProxyAuthIsSent(headers);
|
|
30017
30017
|
if (headers && !("host" in headers) && !("Host" in headers)) {
|
|
30018
30018
|
const { host } = new URL3(opts.origin);
|
|
@@ -30048,7 +30048,7 @@ var require_proxy_agent = __commonJS({
|
|
|
30048
30048
|
await this[kClient].destroy();
|
|
30049
30049
|
}
|
|
30050
30050
|
};
|
|
30051
|
-
function
|
|
30051
|
+
function buildHeaders5(headers) {
|
|
30052
30052
|
if (Array.isArray(headers)) {
|
|
30053
30053
|
const headersPair = {};
|
|
30054
30054
|
for (let i = 0; i < headers.length; i += 2) {
|
|
@@ -74083,7 +74083,7 @@ if (DSN) {
|
|
|
74083
74083
|
init2({
|
|
74084
74084
|
dsn: DSN,
|
|
74085
74085
|
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
74086
|
-
release: "9.
|
|
74086
|
+
release: "9.158.1",
|
|
74087
74087
|
sendDefaultPii: false,
|
|
74088
74088
|
tracesSampleRate: 0,
|
|
74089
74089
|
shutdownTimeout: 500,
|
|
@@ -74102,7 +74102,7 @@ if (DSN) {
|
|
|
74102
74102
|
}
|
|
74103
74103
|
});
|
|
74104
74104
|
setContext("cli", {
|
|
74105
|
-
version: "9.
|
|
74105
|
+
version: "9.158.1",
|
|
74106
74106
|
command: process.argv.slice(2).join(" ")
|
|
74107
74107
|
});
|
|
74108
74108
|
setContext("runtime", {
|
|
@@ -74342,7 +74342,8 @@ var FEATURE_SWITCHES = {
|
|
|
74342
74342
|
["pwaOfflineCache" /* PwaOfflineCache */]: {
|
|
74343
74343
|
maintainer: "ethan@vm0.ai",
|
|
74344
74344
|
description: "Enable PWA offline caching (static asset cache-first, offline fallback page, and service worker updateViaCache: none)",
|
|
74345
|
-
enabled: false
|
|
74345
|
+
enabled: false,
|
|
74346
|
+
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74346
74347
|
},
|
|
74347
74348
|
["mailchimpConnector" /* MailchimpConnector */]: {
|
|
74348
74349
|
maintainer: "ethan@vm0.ai",
|
|
@@ -74380,10 +74381,17 @@ var FEATURE_SWITCHES = {
|
|
|
74380
74381
|
enabled: false,
|
|
74381
74382
|
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74382
74383
|
},
|
|
74384
|
+
["desktopLocalAgent" /* DesktopLocalAgent */]: {
|
|
74385
|
+
maintainer: "lancy@vm0.ai",
|
|
74386
|
+
description: "Enable the Desktop-owned Local Agent page, folder selection, and native host lifecycle",
|
|
74387
|
+
enabled: false,
|
|
74388
|
+
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74389
|
+
},
|
|
74383
74390
|
["lab" /* Lab */]: {
|
|
74384
74391
|
maintainer: "ethan@vm0.ai",
|
|
74385
74392
|
description: "Show the Lab page for toggling experimental features",
|
|
74386
|
-
enabled: false
|
|
74393
|
+
enabled: false,
|
|
74394
|
+
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74387
74395
|
},
|
|
74388
74396
|
["auditLink" /* AuditLink */]: {
|
|
74389
74397
|
maintainer: "ethan@vm0.ai",
|
|
@@ -74408,8 +74416,7 @@ var FEATURE_SWITCHES = {
|
|
|
74408
74416
|
["chatHeaderNewButton" /* ChatHeaderNewButton */]: {
|
|
74409
74417
|
maintainer: "ethan@vm0.ai",
|
|
74410
74418
|
description: "Replace the Invite people button in the agent chat page header with a New button that creates a new chat thread",
|
|
74411
|
-
enabled: false
|
|
74412
|
-
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74419
|
+
enabled: false
|
|
74413
74420
|
},
|
|
74414
74421
|
["agentPhoneAppUi" /* AgentPhoneAppUi */]: {
|
|
74415
74422
|
maintainer: "linghan@vm0.ai",
|
|
@@ -74420,8 +74427,7 @@ var FEATURE_SWITCHES = {
|
|
|
74420
74427
|
["chatMessageStartButton" /* ChatMessageStartButton */]: {
|
|
74421
74428
|
maintainer: "linghan@vm0.ai",
|
|
74422
74429
|
description: "Show an icon button in assistant message group actions that scrolls back to the start of that message group.",
|
|
74423
|
-
enabled: false
|
|
74424
|
-
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74430
|
+
enabled: false
|
|
74425
74431
|
},
|
|
74426
74432
|
["goal" /* Goal */]: {
|
|
74427
74433
|
maintainer: "ethan@vm0.ai",
|
|
@@ -74432,8 +74438,7 @@ var FEATURE_SWITCHES = {
|
|
|
74432
74438
|
["chatThreadRename" /* ChatThreadRename */]: {
|
|
74433
74439
|
maintainer: "ethan@vm0.ai",
|
|
74434
74440
|
description: "Adds a Rename chat item to the sidebar thread kebab menu. When the user renames a thread, automated title generation is suppressed for that thread.",
|
|
74435
|
-
enabled: false
|
|
74436
|
-
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74441
|
+
enabled: false
|
|
74437
74442
|
},
|
|
74438
74443
|
["docsSite" /* DocsSite */]: {
|
|
74439
74444
|
maintainer: "linghan@vm0.ai",
|
|
@@ -74493,6 +74498,11 @@ var FEATURE_SWITCHES = {
|
|
|
74493
74498
|
description: "Enable the Zapier connector. When disabled, Zapier is hidden from the connectors list and cannot be connected.",
|
|
74494
74499
|
enabled: false
|
|
74495
74500
|
},
|
|
74501
|
+
["wereadConnector" /* WereadConnector */]: {
|
|
74502
|
+
maintainer: "ethan@vm0.ai",
|
|
74503
|
+
description: "Enable the WeRead (\u5FAE\u4FE1\u8BFB\u4E66) connector. When disabled, WeRead is hidden from the connectors list and cannot be connected.",
|
|
74504
|
+
enabled: false
|
|
74505
|
+
},
|
|
74496
74506
|
["voiceChatRealtimeBilling" /* VoiceChatRealtimeBilling */]: {
|
|
74497
74507
|
maintainer: "lancy@vm0.ai",
|
|
74498
74508
|
description: "Gate voice-chat realtime billing (Plan D, Epic #12128). When OFF, the token route mints an OpenAI ephemeral token without admission checks and the /session-started, /usage, and /session-ended endpoints are 200 no-ops \u2014 the org gets unmetered voice-chat. When ON, the token route runs credit + pricing admission, /session-started inserts an audit row in voice_chat_realtime_sessions, and the browser self-reports response.done + transcription.completed usage events for billing. Staff-only during rollout; operator flips per org via the feature-switch overrides API.",
|
|
@@ -74504,6 +74514,12 @@ var FEATURE_SWITCHES = {
|
|
|
74504
74514
|
description: "Enable static hosted-site deployments from zero host. Staff-only during rollout.",
|
|
74505
74515
|
enabled: false,
|
|
74506
74516
|
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74517
|
+
},
|
|
74518
|
+
["sandboxIoLimiters" /* SandboxIoLimiters */]: {
|
|
74519
|
+
maintainer: "liangyou@vm0.ai",
|
|
74520
|
+
description: "Enable runner-provided disk and network device rate limiters for sandbox VMs.",
|
|
74521
|
+
enabled: false,
|
|
74522
|
+
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
74507
74523
|
}
|
|
74508
74524
|
};
|
|
74509
74525
|
function isFeatureEnabled(key, ctx) {
|
|
@@ -88971,6 +88987,18 @@ var RUN_ERROR_GUIDANCE = {
|
|
|
88971
88987
|
guidance: "Wait for your current run to complete before starting a new one."
|
|
88972
88988
|
}
|
|
88973
88989
|
};
|
|
88990
|
+
var ACTIONABLE_RUN_ERROR_SNIPPETS = [
|
|
88991
|
+
...Object.values(RUN_ERROR_GUIDANCE).flatMap((guidance) => {
|
|
88992
|
+
return [guidance.title, guidance.guidance];
|
|
88993
|
+
}),
|
|
88994
|
+
"Cannot continue session",
|
|
88995
|
+
"Invalid signature in thinking block",
|
|
88996
|
+
"Run cancelled",
|
|
88997
|
+
"usage limit",
|
|
88998
|
+
"usage_limit",
|
|
88999
|
+
"usage-limit",
|
|
89000
|
+
"UsageLimit"
|
|
89001
|
+
];
|
|
88974
89002
|
|
|
88975
89003
|
// src/lib/api/core/client-factory.ts
|
|
88976
89004
|
init_esm_shims();
|
|
@@ -96227,34 +96255,6 @@ var MODEL_PROVIDER_TYPES = {
|
|
|
96227
96255
|
label: "ChatGPT (Codex)",
|
|
96228
96256
|
helpText: "Run `codex login` on your machine, then paste the resulting ~/.codex/auth.json contents to authorize ChatGPT (Plus / Pro / Business / Edu / Enterprise) for Codex.",
|
|
96229
96257
|
authMethods: {
|
|
96230
|
-
oauth: {
|
|
96231
|
-
label: "OpenAI OAuth",
|
|
96232
|
-
helpText: "Sign in with OpenAI to authorize ChatGPT (Plus / Pro / Business / Edu / Enterprise) for Codex.",
|
|
96233
|
-
secrets: {
|
|
96234
|
-
CHATGPT_ACCESS_TOKEN: {
|
|
96235
|
-
label: "CHATGPT_ACCESS_TOKEN",
|
|
96236
|
-
required: true,
|
|
96237
|
-
derived: true
|
|
96238
|
-
},
|
|
96239
|
-
CHATGPT_REFRESH_TOKEN: {
|
|
96240
|
-
label: "CHATGPT_REFRESH_TOKEN",
|
|
96241
|
-
required: true,
|
|
96242
|
-
serverOnly: true,
|
|
96243
|
-
derived: true
|
|
96244
|
-
},
|
|
96245
|
-
CHATGPT_ACCOUNT_ID: {
|
|
96246
|
-
label: "CHATGPT_ACCOUNT_ID",
|
|
96247
|
-
required: true,
|
|
96248
|
-
derived: true
|
|
96249
|
-
},
|
|
96250
|
-
CHATGPT_ID_TOKEN: {
|
|
96251
|
-
label: "CHATGPT_ID_TOKEN",
|
|
96252
|
-
required: true,
|
|
96253
|
-
serverOnly: true,
|
|
96254
|
-
derived: true
|
|
96255
|
-
}
|
|
96256
|
-
}
|
|
96257
|
-
},
|
|
96258
96258
|
// Paste-based auth: client posts CODEX_AUTH_JSON, server parses it via
|
|
96259
96259
|
// codex-auth-json-parser.ts and persists the four derived CHATGPT_*
|
|
96260
96260
|
// fields. The raw blob is NEVER stored. The wire-shape secret
|
|
@@ -96675,11 +96675,8 @@ var modelProviderResponseSchema = external_exports.object({
|
|
|
96675
96675
|
selectedModel: external_exports.string().nullable(),
|
|
96676
96676
|
createdAt: external_exports.string(),
|
|
96677
96677
|
updatedAt: external_exports.string(),
|
|
96678
|
-
// ChatGPT-only metadata populated by the codex-oauth-token
|
|
96679
|
-
// Other provider types omit these.
|
|
96680
|
-
// shape in apps/web/src/lib/zero/connector/providers/codex-oauth.ts.
|
|
96681
|
-
// The corresponding server route lands in #11909; declared here so the
|
|
96682
|
-
// platform UI does not have to bypass schema validation to read them.
|
|
96678
|
+
// ChatGPT-only metadata populated by the codex-oauth-token auth.json paste
|
|
96679
|
+
// flow. Other provider types omit these.
|
|
96683
96680
|
workspaceName: external_exports.string().nullable().optional(),
|
|
96684
96681
|
planType: external_exports.string().nullable().optional(),
|
|
96685
96682
|
// OAuth refresh state. `needsReconnect` flips to true when the firewall's
|
|
@@ -104529,6 +104526,44 @@ var webflow = {
|
|
|
104529
104526
|
}
|
|
104530
104527
|
};
|
|
104531
104528
|
|
|
104529
|
+
// ../../packages/connectors/src/connectors/weread.ts
|
|
104530
|
+
init_esm_shims();
|
|
104531
|
+
var weread = {
|
|
104532
|
+
weread: {
|
|
104533
|
+
label: "WeRead",
|
|
104534
|
+
category: "docs-files-knowledge",
|
|
104535
|
+
tags: [
|
|
104536
|
+
"weread",
|
|
104537
|
+
"\u5FAE\u4FE1\u8BFB\u4E66",
|
|
104538
|
+
"wechat reading",
|
|
104539
|
+
"books",
|
|
104540
|
+
"reading",
|
|
104541
|
+
"highlights",
|
|
104542
|
+
"notes",
|
|
104543
|
+
"bookshelf"
|
|
104544
|
+
],
|
|
104545
|
+
environmentMapping: {
|
|
104546
|
+
WEREAD_API_KEY: "$secrets.WEREAD_API_KEY"
|
|
104547
|
+
},
|
|
104548
|
+
helpText: "Connect WeChat Reading (\u5FAE\u4FE1\u8BFB\u4E66) to search books, browse your bookshelf, and read your notes, highlights, reviews, and reading statistics",
|
|
104549
|
+
authMethods: {
|
|
104550
|
+
"api-token": {
|
|
104551
|
+
featureFlag: "wereadConnector" /* WereadConnector */,
|
|
104552
|
+
label: "WeRead API Key",
|
|
104553
|
+
helpText: "1. Open the [WeRead Skill page](https://weread.qq.com/r/weread-skills)\n2. Scan the QR code with WeChat to sign in to your WeChat Reading account\n3. Copy the generated API key (it begins with `wrk-`)\n4. The key authorises every endpoint under `i.weread.qq.com` and is scoped to your own account data",
|
|
104554
|
+
secrets: {
|
|
104555
|
+
WEREAD_API_KEY: {
|
|
104556
|
+
label: "API Key",
|
|
104557
|
+
required: true,
|
|
104558
|
+
placeholder: "wrk-xxxxxxxxxxxxxxxx"
|
|
104559
|
+
}
|
|
104560
|
+
}
|
|
104561
|
+
}
|
|
104562
|
+
},
|
|
104563
|
+
defaultAuthMethod: "api-token"
|
|
104564
|
+
}
|
|
104565
|
+
};
|
|
104566
|
+
|
|
104532
104567
|
// ../../packages/connectors/src/connectors/wix.ts
|
|
104533
104568
|
init_esm_shims();
|
|
104534
104569
|
var wix = {
|
|
@@ -105053,6 +105088,7 @@ var CONNECTOR_TYPES_DEF = {
|
|
|
105053
105088
|
...v0,
|
|
105054
105089
|
...wandb,
|
|
105055
105090
|
...webflow,
|
|
105091
|
+
...weread,
|
|
105056
105092
|
...wix,
|
|
105057
105093
|
...workos,
|
|
105058
105094
|
...wrike,
|
|
@@ -106542,6 +106578,7 @@ var sandboxReuseResultSchema = external_exports.enum([
|
|
|
106542
106578
|
"noSessionId",
|
|
106543
106579
|
"poolMiss",
|
|
106544
106580
|
"profileMismatch",
|
|
106581
|
+
"deviceLimitMismatch",
|
|
106545
106582
|
"unparkFailed"
|
|
106546
106583
|
]);
|
|
106547
106584
|
var agentEventSchema = external_exports.object({
|
|
@@ -107984,92 +108021,586 @@ init_esm_shims();
|
|
|
107984
108021
|
// ../../packages/api-contracts/src/contracts/zero-computer-use.ts
|
|
107985
108022
|
init_esm_shims();
|
|
107986
108023
|
var c25 = initContract();
|
|
107987
|
-
var
|
|
108024
|
+
var computerUseHostStatusSchema = external_exports.enum(["online", "offline"]);
|
|
108025
|
+
var computerUseReadCommandKindSchema = external_exports.enum([
|
|
108026
|
+
"apps.list",
|
|
108027
|
+
"app.state"
|
|
108028
|
+
]);
|
|
108029
|
+
var computerUseWriteCommandKindSchema = external_exports.enum([
|
|
108030
|
+
"app.open",
|
|
108031
|
+
"element.click",
|
|
108032
|
+
"element.scroll",
|
|
108033
|
+
"element.set_value",
|
|
108034
|
+
"element.perform_action",
|
|
108035
|
+
"keyboard.type_text",
|
|
108036
|
+
"keyboard.press_key"
|
|
108037
|
+
]);
|
|
108038
|
+
var computerUseCommandKindSchema = external_exports.enum([
|
|
108039
|
+
...computerUseReadCommandKindSchema.options,
|
|
108040
|
+
...computerUseWriteCommandKindSchema.options
|
|
108041
|
+
]);
|
|
108042
|
+
var computerUseCommandStatusSchema = external_exports.enum([
|
|
108043
|
+
"pending_approval",
|
|
108044
|
+
"queued",
|
|
108045
|
+
"running",
|
|
108046
|
+
"succeeded",
|
|
108047
|
+
"failed"
|
|
108048
|
+
]);
|
|
108049
|
+
var computerUseCommandErrorCodeSchema = external_exports.enum([
|
|
108050
|
+
"no_host",
|
|
108051
|
+
"permission_denied",
|
|
108052
|
+
"accessibility_unavailable",
|
|
108053
|
+
"screen_recording_unavailable",
|
|
108054
|
+
"unsupported_command",
|
|
108055
|
+
"timeout"
|
|
108056
|
+
]);
|
|
108057
|
+
var hostNameSchema = external_exports.string().trim().min(1).max(128);
|
|
108058
|
+
var hostVersionSchema = external_exports.string().trim().min(1).max(64);
|
|
108059
|
+
var hostOsVersionSchema = external_exports.string().trim().min(1).max(128);
|
|
108060
|
+
var hostIdPathParamsSchema = external_exports.object({
|
|
108061
|
+
hostId: external_exports.string().min(1)
|
|
108062
|
+
});
|
|
108063
|
+
var commandIdPathParamsSchema = external_exports.object({
|
|
108064
|
+
commandId: external_exports.string().min(1)
|
|
108065
|
+
});
|
|
108066
|
+
var supportedCapabilitiesSchema = external_exports.array(external_exports.string().trim().min(1).max(128)).max(50);
|
|
108067
|
+
var appNameSchema = external_exports.string().trim().min(1).max(256);
|
|
108068
|
+
var snapshotIdSchema = external_exports.string().trim().min(1).max(256);
|
|
108069
|
+
var elementIdSchema = external_exports.string().trim().min(1).max(256);
|
|
108070
|
+
var computerUsePermissionsSchema = external_exports.object({
|
|
108071
|
+
accessibility: external_exports.boolean(),
|
|
108072
|
+
screenRecording: external_exports.boolean()
|
|
108073
|
+
});
|
|
108074
|
+
var computerUseRuntimeBodySchema = external_exports.object({
|
|
108075
|
+
hostName: hostNameSchema,
|
|
108076
|
+
appVersion: hostVersionSchema,
|
|
108077
|
+
osVersion: hostOsVersionSchema,
|
|
108078
|
+
supportedCapabilities: supportedCapabilitiesSchema.default([]),
|
|
108079
|
+
permissions: computerUsePermissionsSchema
|
|
108080
|
+
});
|
|
108081
|
+
var computerUseCommandTargetShape = {
|
|
108082
|
+
hostId: external_exports.string().min(1).optional(),
|
|
108083
|
+
hostName: hostNameSchema.optional(),
|
|
108084
|
+
timeoutMs: external_exports.number().int().min(1e3).max(6e4).default(15e3)
|
|
108085
|
+
};
|
|
108086
|
+
var computerUseCommandPayloadShape = {
|
|
108087
|
+
app: appNameSchema.optional(),
|
|
108088
|
+
snapshotId: snapshotIdSchema.optional(),
|
|
108089
|
+
elementId: elementIdSchema.optional(),
|
|
108090
|
+
x: external_exports.number().int().min(0).optional(),
|
|
108091
|
+
y: external_exports.number().int().min(0).optional(),
|
|
108092
|
+
button: external_exports.enum(["left", "right", "middle"]).optional(),
|
|
108093
|
+
clickCount: external_exports.number().int().min(1).max(3).optional(),
|
|
108094
|
+
direction: external_exports.enum(["up", "down", "left", "right"]).optional(),
|
|
108095
|
+
pages: external_exports.number().positive().max(25).optional(),
|
|
108096
|
+
value: external_exports.string().min(1).max(64e3).optional(),
|
|
108097
|
+
text: external_exports.string().min(1).max(64e3).optional(),
|
|
108098
|
+
key: external_exports.string().trim().min(1).max(256).optional(),
|
|
108099
|
+
action: external_exports.string().trim().min(1).max(256).optional()
|
|
108100
|
+
};
|
|
108101
|
+
var computerUseCommandCreateBodySchema = external_exports.object({
|
|
108102
|
+
kind: computerUseReadCommandKindSchema,
|
|
108103
|
+
...computerUseCommandTargetShape,
|
|
108104
|
+
...computerUseCommandPayloadShape
|
|
108105
|
+
}).superRefine((body, ctx) => {
|
|
108106
|
+
if (body.kind === "app.state" && !body.app) {
|
|
108107
|
+
ctx.addIssue({
|
|
108108
|
+
code: "custom",
|
|
108109
|
+
path: ["app"],
|
|
108110
|
+
message: "app.state requires app"
|
|
108111
|
+
});
|
|
108112
|
+
}
|
|
108113
|
+
});
|
|
108114
|
+
var computerUseWriteCommandCreateBaseSchema = external_exports.object({
|
|
108115
|
+
kind: computerUseWriteCommandKindSchema,
|
|
108116
|
+
...computerUseCommandTargetShape,
|
|
108117
|
+
...computerUseCommandPayloadShape
|
|
108118
|
+
});
|
|
108119
|
+
function requireComputerUseField(ctx, field, message) {
|
|
108120
|
+
ctx.addIssue({ code: "custom", path: [field], message });
|
|
108121
|
+
}
|
|
108122
|
+
function validateElementClickCommand(body, ctx) {
|
|
108123
|
+
const hasPoint = body.x !== void 0 && body.y !== void 0;
|
|
108124
|
+
if (!body.elementId && !hasPoint) {
|
|
108125
|
+
requireComputerUseField(
|
|
108126
|
+
ctx,
|
|
108127
|
+
"elementId",
|
|
108128
|
+
"element.click requires elementId or x/y"
|
|
108129
|
+
);
|
|
108130
|
+
}
|
|
108131
|
+
if (body.x === void 0 !== (body.y === void 0)) {
|
|
108132
|
+
requireComputerUseField(
|
|
108133
|
+
ctx,
|
|
108134
|
+
"x",
|
|
108135
|
+
"element.click coordinates require both x and y"
|
|
108136
|
+
);
|
|
108137
|
+
}
|
|
108138
|
+
}
|
|
108139
|
+
function validateElementScrollCommand(body, ctx) {
|
|
108140
|
+
if (!body.elementId) {
|
|
108141
|
+
requireComputerUseField(
|
|
108142
|
+
ctx,
|
|
108143
|
+
"elementId",
|
|
108144
|
+
"element.scroll requires elementId"
|
|
108145
|
+
);
|
|
108146
|
+
}
|
|
108147
|
+
if (!body.direction) {
|
|
108148
|
+
requireComputerUseField(
|
|
108149
|
+
ctx,
|
|
108150
|
+
"direction",
|
|
108151
|
+
"element.scroll requires direction"
|
|
108152
|
+
);
|
|
108153
|
+
}
|
|
108154
|
+
}
|
|
108155
|
+
function validateElementSetValueCommand(body, ctx) {
|
|
108156
|
+
if (!body.elementId) {
|
|
108157
|
+
requireComputerUseField(
|
|
108158
|
+
ctx,
|
|
108159
|
+
"elementId",
|
|
108160
|
+
"element.set_value requires elementId"
|
|
108161
|
+
);
|
|
108162
|
+
}
|
|
108163
|
+
if (!body.value) {
|
|
108164
|
+
requireComputerUseField(ctx, "value", "element.set_value requires value");
|
|
108165
|
+
}
|
|
108166
|
+
}
|
|
108167
|
+
function validateElementActionCommand(body, ctx) {
|
|
108168
|
+
if (!body.elementId) {
|
|
108169
|
+
requireComputerUseField(
|
|
108170
|
+
ctx,
|
|
108171
|
+
"elementId",
|
|
108172
|
+
"element.perform_action requires elementId"
|
|
108173
|
+
);
|
|
108174
|
+
}
|
|
108175
|
+
if (!body.action) {
|
|
108176
|
+
requireComputerUseField(
|
|
108177
|
+
ctx,
|
|
108178
|
+
"action",
|
|
108179
|
+
"element.perform_action requires action"
|
|
108180
|
+
);
|
|
108181
|
+
}
|
|
108182
|
+
}
|
|
108183
|
+
function validateComputerUseWriteCommand(body, ctx) {
|
|
108184
|
+
if (!body.app) {
|
|
108185
|
+
requireComputerUseField(ctx, "app", `${body.kind} requires app`);
|
|
108186
|
+
return;
|
|
108187
|
+
}
|
|
108188
|
+
switch (body.kind) {
|
|
108189
|
+
case "app.open":
|
|
108190
|
+
return;
|
|
108191
|
+
case "element.click":
|
|
108192
|
+
validateElementClickCommand(body, ctx);
|
|
108193
|
+
return;
|
|
108194
|
+
case "element.scroll":
|
|
108195
|
+
validateElementScrollCommand(body, ctx);
|
|
108196
|
+
return;
|
|
108197
|
+
case "element.set_value":
|
|
108198
|
+
validateElementSetValueCommand(body, ctx);
|
|
108199
|
+
return;
|
|
108200
|
+
case "element.perform_action":
|
|
108201
|
+
validateElementActionCommand(body, ctx);
|
|
108202
|
+
return;
|
|
108203
|
+
case "keyboard.type_text":
|
|
108204
|
+
if (!body.text) {
|
|
108205
|
+
requireComputerUseField(
|
|
108206
|
+
ctx,
|
|
108207
|
+
"text",
|
|
108208
|
+
"keyboard.type_text requires text"
|
|
108209
|
+
);
|
|
108210
|
+
}
|
|
108211
|
+
return;
|
|
108212
|
+
case "keyboard.press_key":
|
|
108213
|
+
if (!body.key) {
|
|
108214
|
+
requireComputerUseField(ctx, "key", "keyboard.press_key requires key");
|
|
108215
|
+
}
|
|
108216
|
+
}
|
|
108217
|
+
}
|
|
108218
|
+
var computerUseWriteCommandCreateBodySchema = computerUseWriteCommandCreateBaseSchema.superRefine(
|
|
108219
|
+
validateComputerUseWriteCommand
|
|
108220
|
+
);
|
|
108221
|
+
var computerUseCommandErrorSchema = external_exports.object({
|
|
108222
|
+
code: computerUseCommandErrorCodeSchema,
|
|
108223
|
+
message: external_exports.string()
|
|
108224
|
+
});
|
|
108225
|
+
var computerUseCommandResultSchema = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
108226
|
+
var computerUseHostSchema = external_exports.object({
|
|
107988
108227
|
id: external_exports.string(),
|
|
107989
|
-
|
|
107990
|
-
|
|
107991
|
-
|
|
107992
|
-
|
|
108228
|
+
displayName: external_exports.string(),
|
|
108229
|
+
appVersion: external_exports.string(),
|
|
108230
|
+
osVersion: external_exports.string(),
|
|
108231
|
+
supportedCapabilities: external_exports.array(external_exports.string()),
|
|
108232
|
+
permissions: computerUsePermissionsSchema,
|
|
108233
|
+
status: computerUseHostStatusSchema,
|
|
108234
|
+
lastSeenAt: external_exports.string(),
|
|
108235
|
+
createdAt: external_exports.string()
|
|
107993
108236
|
});
|
|
107994
|
-
var
|
|
107995
|
-
|
|
107996
|
-
|
|
108237
|
+
var computerUseHostStartResponseSchema = external_exports.object({
|
|
108238
|
+
hostId: external_exports.string(),
|
|
108239
|
+
hostToken: external_exports.string()
|
|
107997
108240
|
});
|
|
107998
|
-
var
|
|
107999
|
-
|
|
108241
|
+
var computerUseHeartbeatResponseSchema = external_exports.object({
|
|
108242
|
+
ok: external_exports.literal(true),
|
|
108243
|
+
hostId: external_exports.string()
|
|
108244
|
+
});
|
|
108245
|
+
var computerUseHostListResponseSchema = external_exports.object({
|
|
108246
|
+
hosts: external_exports.array(computerUseHostSchema)
|
|
108247
|
+
});
|
|
108248
|
+
var computerUseHostDeleteResponseSchema = external_exports.object({
|
|
108249
|
+
ok: external_exports.literal(true)
|
|
108250
|
+
});
|
|
108251
|
+
var computerUseCommandCreateResponseSchema = external_exports.object({
|
|
108252
|
+
commandId: external_exports.string(),
|
|
108253
|
+
status: external_exports.enum(["queued", "pending_approval"])
|
|
108254
|
+
});
|
|
108255
|
+
var computerUseCommandResponseSchema = external_exports.object({
|
|
108256
|
+
id: external_exports.string(),
|
|
108257
|
+
kind: computerUseCommandKindSchema,
|
|
108258
|
+
status: computerUseCommandStatusSchema,
|
|
108259
|
+
hostId: external_exports.string().nullable(),
|
|
108260
|
+
hostName: external_exports.string().nullable(),
|
|
108261
|
+
payload: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
108262
|
+
result: computerUseCommandResultSchema.optional(),
|
|
108263
|
+
error: computerUseCommandErrorSchema.optional(),
|
|
108264
|
+
timeoutMs: external_exports.number().int().nullable(),
|
|
108265
|
+
createdAt: external_exports.string(),
|
|
108266
|
+
claimedAt: external_exports.string().nullable(),
|
|
108267
|
+
completedAt: external_exports.string().nullable()
|
|
108268
|
+
});
|
|
108269
|
+
var computerUseCommandApprovalBodySchema = external_exports.object({
|
|
108270
|
+
decision: external_exports.enum(["approve", "deny"]),
|
|
108271
|
+
message: external_exports.string().max(512).optional()
|
|
108272
|
+
});
|
|
108273
|
+
var computerUseCommandApprovalResponseSchema = external_exports.object({
|
|
108274
|
+
commandId: external_exports.string(),
|
|
108275
|
+
status: external_exports.enum(["queued", "failed"])
|
|
108276
|
+
});
|
|
108277
|
+
var computerUseHostCommandNextBodySchema = external_exports.object({
|
|
108278
|
+
supportedCapabilities: supportedCapabilitiesSchema.default([])
|
|
108279
|
+
});
|
|
108280
|
+
var computerUseHostCommandNextResponseSchema = external_exports.discriminatedUnion(
|
|
108281
|
+
"status",
|
|
108282
|
+
[
|
|
108283
|
+
external_exports.object({ status: external_exports.literal("idle") }),
|
|
108284
|
+
external_exports.object({
|
|
108285
|
+
status: external_exports.literal("command"),
|
|
108286
|
+
command: computerUseCommandResponseSchema
|
|
108287
|
+
})
|
|
108288
|
+
]
|
|
108289
|
+
);
|
|
108290
|
+
var computerUseHostCommandCompleteBodySchema = external_exports.discriminatedUnion(
|
|
108291
|
+
"status",
|
|
108292
|
+
[
|
|
108293
|
+
external_exports.object({
|
|
108294
|
+
status: external_exports.literal("succeeded"),
|
|
108295
|
+
result: computerUseCommandResultSchema
|
|
108296
|
+
}),
|
|
108297
|
+
external_exports.object({
|
|
108298
|
+
status: external_exports.literal("failed"),
|
|
108299
|
+
error: computerUseCommandErrorSchema
|
|
108300
|
+
})
|
|
108301
|
+
]
|
|
108302
|
+
);
|
|
108303
|
+
var computerUseCommandCompleteResponseSchema = external_exports.object({
|
|
108304
|
+
ok: external_exports.literal(true)
|
|
108305
|
+
});
|
|
108306
|
+
var computerUseAuditEventSchema = external_exports.object({
|
|
108307
|
+
id: external_exports.string(),
|
|
108308
|
+
commandId: external_exports.string(),
|
|
108309
|
+
runId: external_exports.string().nullable(),
|
|
108310
|
+
hostId: external_exports.string().nullable(),
|
|
108311
|
+
kind: computerUseWriteCommandKindSchema,
|
|
108312
|
+
app: external_exports.string().nullable(),
|
|
108313
|
+
event: external_exports.enum(["created", "approved", "denied", "completed"]),
|
|
108314
|
+
approvalOutcome: external_exports.enum(["approved", "denied"]).nullable(),
|
|
108315
|
+
redactedResult: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
|
|
108316
|
+
error: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
|
|
108317
|
+
createdAt: external_exports.string()
|
|
108318
|
+
});
|
|
108319
|
+
var computerUseAuditEventListResponseSchema = external_exports.object({
|
|
108320
|
+
auditEvents: external_exports.array(computerUseAuditEventSchema)
|
|
108321
|
+
});
|
|
108322
|
+
var zeroComputerUseHostsContract = c25.router({
|
|
108323
|
+
start: {
|
|
108000
108324
|
method: "POST",
|
|
108001
|
-
path: "/api/zero/computer-use/
|
|
108325
|
+
path: "/api/zero/computer-use/hosts/start",
|
|
108002
108326
|
headers: authHeadersSchema,
|
|
108003
|
-
body:
|
|
108327
|
+
body: computerUseRuntimeBodySchema,
|
|
108004
108328
|
responses: {
|
|
108005
|
-
200:
|
|
108329
|
+
200: computerUseHostStartResponseSchema,
|
|
108006
108330
|
401: apiErrorSchema,
|
|
108007
|
-
403: apiErrorSchema
|
|
108008
|
-
409: apiErrorSchema
|
|
108331
|
+
403: apiErrorSchema
|
|
108009
108332
|
},
|
|
108010
|
-
summary: "
|
|
108011
|
-
}
|
|
108012
|
-
|
|
108013
|
-
|
|
108014
|
-
|
|
108333
|
+
summary: "Start or reactivate a desktop computer-use host"
|
|
108334
|
+
},
|
|
108335
|
+
list: {
|
|
108336
|
+
method: "GET",
|
|
108337
|
+
path: "/api/zero/computer-use/hosts",
|
|
108338
|
+
headers: authHeadersSchema,
|
|
108339
|
+
responses: {
|
|
108340
|
+
200: computerUseHostListResponseSchema,
|
|
108341
|
+
401: apiErrorSchema,
|
|
108342
|
+
403: apiErrorSchema
|
|
108343
|
+
},
|
|
108344
|
+
summary: "List linked desktop computer-use hosts"
|
|
108345
|
+
},
|
|
108346
|
+
delete: {
|
|
108015
108347
|
method: "DELETE",
|
|
108016
|
-
path: "/api/zero/computer-use/
|
|
108348
|
+
path: "/api/zero/computer-use/hosts/:hostId",
|
|
108017
108349
|
headers: authHeadersSchema,
|
|
108018
|
-
|
|
108350
|
+
pathParams: hostIdPathParamsSchema,
|
|
108019
108351
|
responses: {
|
|
108020
|
-
|
|
108352
|
+
200: computerUseHostDeleteResponseSchema,
|
|
108021
108353
|
401: apiErrorSchema,
|
|
108022
108354
|
403: apiErrorSchema,
|
|
108023
108355
|
404: apiErrorSchema
|
|
108024
108356
|
},
|
|
108025
|
-
summary: "
|
|
108357
|
+
summary: "Delete a desktop computer-use host"
|
|
108026
108358
|
}
|
|
108027
108359
|
});
|
|
108028
|
-
var
|
|
108029
|
-
|
|
108360
|
+
var zeroComputerUseHeartbeatContract = c25.router({
|
|
108361
|
+
heartbeat: {
|
|
108362
|
+
method: "POST",
|
|
108363
|
+
path: "/api/zero/computer-use/heartbeat",
|
|
108364
|
+
headers: authHeadersSchema,
|
|
108365
|
+
body: computerUseRuntimeBodySchema,
|
|
108366
|
+
responses: {
|
|
108367
|
+
200: computerUseHeartbeatResponseSchema,
|
|
108368
|
+
401: apiErrorSchema
|
|
108369
|
+
},
|
|
108370
|
+
summary: "Refresh a desktop computer-use host heartbeat"
|
|
108371
|
+
}
|
|
108372
|
+
});
|
|
108373
|
+
var zeroComputerUseCommandContract = c25.router({
|
|
108374
|
+
create: {
|
|
108375
|
+
method: "POST",
|
|
108376
|
+
path: "/api/zero/computer-use/commands",
|
|
108377
|
+
headers: authHeadersSchema,
|
|
108378
|
+
body: computerUseCommandCreateBodySchema,
|
|
108379
|
+
responses: {
|
|
108380
|
+
200: computerUseCommandCreateResponseSchema,
|
|
108381
|
+
400: apiErrorSchema,
|
|
108382
|
+
401: apiErrorSchema,
|
|
108383
|
+
403: apiErrorSchema,
|
|
108384
|
+
404: apiErrorSchema,
|
|
108385
|
+
409: apiErrorSchema
|
|
108386
|
+
},
|
|
108387
|
+
summary: "Create a read-only desktop computer-use command"
|
|
108388
|
+
},
|
|
108389
|
+
get: {
|
|
108030
108390
|
method: "GET",
|
|
108031
|
-
path: "/api/zero/computer-use/
|
|
108391
|
+
path: "/api/zero/computer-use/commands/:commandId",
|
|
108032
108392
|
headers: authHeadersSchema,
|
|
108393
|
+
pathParams: commandIdPathParamsSchema,
|
|
108033
108394
|
responses: {
|
|
108034
|
-
200:
|
|
108395
|
+
200: computerUseCommandResponseSchema,
|
|
108035
108396
|
401: apiErrorSchema,
|
|
108036
108397
|
403: apiErrorSchema,
|
|
108037
108398
|
404: apiErrorSchema
|
|
108038
108399
|
},
|
|
108039
|
-
summary: "Get computer-use
|
|
108400
|
+
summary: "Get a desktop computer-use command result"
|
|
108401
|
+
}
|
|
108402
|
+
});
|
|
108403
|
+
var zeroComputerUseWriteCommandContract = c25.router({
|
|
108404
|
+
create: {
|
|
108405
|
+
method: "POST",
|
|
108406
|
+
path: "/api/zero/computer-use/write-commands",
|
|
108407
|
+
headers: authHeadersSchema,
|
|
108408
|
+
body: computerUseWriteCommandCreateBodySchema,
|
|
108409
|
+
responses: {
|
|
108410
|
+
200: computerUseCommandCreateResponseSchema,
|
|
108411
|
+
400: apiErrorSchema,
|
|
108412
|
+
401: apiErrorSchema,
|
|
108413
|
+
403: apiErrorSchema,
|
|
108414
|
+
404: apiErrorSchema,
|
|
108415
|
+
409: apiErrorSchema
|
|
108416
|
+
},
|
|
108417
|
+
summary: "Create an approved-write desktop computer-use command"
|
|
108418
|
+
}
|
|
108419
|
+
});
|
|
108420
|
+
var zeroComputerUseCommandApprovalContract = c25.router({
|
|
108421
|
+
decide: {
|
|
108422
|
+
method: "POST",
|
|
108423
|
+
path: "/api/zero/computer-use/commands/:commandId/approval",
|
|
108424
|
+
headers: authHeadersSchema,
|
|
108425
|
+
pathParams: commandIdPathParamsSchema,
|
|
108426
|
+
body: computerUseCommandApprovalBodySchema,
|
|
108427
|
+
responses: {
|
|
108428
|
+
200: computerUseCommandApprovalResponseSchema,
|
|
108429
|
+
401: apiErrorSchema,
|
|
108430
|
+
403: apiErrorSchema,
|
|
108431
|
+
404: apiErrorSchema,
|
|
108432
|
+
409: apiErrorSchema
|
|
108433
|
+
},
|
|
108434
|
+
summary: "Approve or deny a pending desktop computer-use write command"
|
|
108435
|
+
}
|
|
108436
|
+
});
|
|
108437
|
+
var zeroComputerUseHostCommandsContract = c25.router({
|
|
108438
|
+
next: {
|
|
108439
|
+
method: "POST",
|
|
108440
|
+
path: "/api/zero/computer-use/host/commands/next",
|
|
108441
|
+
headers: authHeadersSchema,
|
|
108442
|
+
body: computerUseHostCommandNextBodySchema,
|
|
108443
|
+
responses: {
|
|
108444
|
+
200: computerUseHostCommandNextResponseSchema,
|
|
108445
|
+
401: apiErrorSchema
|
|
108446
|
+
},
|
|
108447
|
+
summary: "Claim the next approved desktop computer-use command"
|
|
108448
|
+
},
|
|
108449
|
+
complete: {
|
|
108450
|
+
method: "POST",
|
|
108451
|
+
path: "/api/zero/computer-use/host/commands/:commandId/complete",
|
|
108452
|
+
headers: authHeadersSchema,
|
|
108453
|
+
pathParams: commandIdPathParamsSchema,
|
|
108454
|
+
body: computerUseHostCommandCompleteBodySchema,
|
|
108455
|
+
responses: {
|
|
108456
|
+
200: computerUseCommandCompleteResponseSchema,
|
|
108457
|
+
400: apiErrorSchema,
|
|
108458
|
+
401: apiErrorSchema,
|
|
108459
|
+
404: apiErrorSchema,
|
|
108460
|
+
409: apiErrorSchema
|
|
108461
|
+
},
|
|
108462
|
+
summary: "Complete a desktop computer-use command"
|
|
108463
|
+
}
|
|
108464
|
+
});
|
|
108465
|
+
var zeroComputerUseAuditEventsContract = c25.router({
|
|
108466
|
+
list: {
|
|
108467
|
+
method: "GET",
|
|
108468
|
+
path: "/api/zero/computer-use/audit-events",
|
|
108469
|
+
headers: authHeadersSchema,
|
|
108470
|
+
query: external_exports.object({
|
|
108471
|
+
limit: external_exports.coerce.number().int().positive().max(200).default(50),
|
|
108472
|
+
commandId: external_exports.string().optional(),
|
|
108473
|
+
hostId: external_exports.string().optional(),
|
|
108474
|
+
runId: external_exports.string().optional()
|
|
108475
|
+
}),
|
|
108476
|
+
responses: {
|
|
108477
|
+
200: computerUseAuditEventListResponseSchema,
|
|
108478
|
+
401: apiErrorSchema,
|
|
108479
|
+
403: apiErrorSchema
|
|
108480
|
+
},
|
|
108481
|
+
summary: "List desktop computer-use write command audit events"
|
|
108040
108482
|
}
|
|
108041
108483
|
});
|
|
108042
108484
|
|
|
108043
108485
|
// src/lib/api/domains/zero-computer-use.ts
|
|
108044
|
-
|
|
108045
|
-
|
|
108046
|
-
|
|
108047
|
-
|
|
108486
|
+
function normalizeConfiguredUrl(value) {
|
|
108487
|
+
return value.startsWith("http") ? value : `https://${value}`;
|
|
108488
|
+
}
|
|
108489
|
+
function resolveComputerUseApiBaseUrl(baseUrl) {
|
|
108490
|
+
const override = process.env.VM0_API_BACKEND_URL;
|
|
108491
|
+
if (override) {
|
|
108492
|
+
return normalizeConfiguredUrl(override).replace(/\/$/, "");
|
|
108493
|
+
}
|
|
108494
|
+
const url2 = new URL(baseUrl);
|
|
108495
|
+
if (url2.hostname === "www.vm0.ai" || url2.hostname === "app.vm0.ai") {
|
|
108496
|
+
url2.hostname = "api.vm0.ai";
|
|
108497
|
+
}
|
|
108498
|
+
return url2.toString().replace(/\/$/, "");
|
|
108499
|
+
}
|
|
108500
|
+
function buildHeaders2(token) {
|
|
108501
|
+
const headers = {};
|
|
108502
|
+
if (token) {
|
|
108503
|
+
headers.Authorization = `Bearer ${token}`;
|
|
108504
|
+
}
|
|
108505
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
|
|
108506
|
+
if (bypassSecret) {
|
|
108507
|
+
headers["x-vercel-protection-bypass"] = bypassSecret;
|
|
108508
|
+
}
|
|
108509
|
+
return headers;
|
|
108510
|
+
}
|
|
108511
|
+
async function getComputerUseClientConfig() {
|
|
108512
|
+
const baseUrl = resolveComputerUseApiBaseUrl(await getBaseUrl());
|
|
108513
|
+
const token = await getActiveToken();
|
|
108514
|
+
if (!token) {
|
|
108515
|
+
throw new ApiRequestError("Not authenticated", "UNAUTHORIZED", 401);
|
|
108516
|
+
}
|
|
108517
|
+
return {
|
|
108518
|
+
baseUrl,
|
|
108519
|
+
baseHeaders: buildHeaders2(token),
|
|
108520
|
+
jsonQuery: false
|
|
108521
|
+
};
|
|
108522
|
+
}
|
|
108523
|
+
function commandBody(params) {
|
|
108524
|
+
return {
|
|
108525
|
+
kind: params.kind,
|
|
108526
|
+
timeoutMs: params.timeoutMs ?? 15e3,
|
|
108527
|
+
...params.hostId ? { hostId: params.hostId } : {},
|
|
108528
|
+
...params.hostName ? { hostName: params.hostName } : {},
|
|
108529
|
+
...params.app ? { app: params.app } : {},
|
|
108530
|
+
...params.snapshotId ? { snapshotId: params.snapshotId } : {},
|
|
108531
|
+
...params.elementId ? { elementId: params.elementId } : {},
|
|
108532
|
+
...params.x !== void 0 ? { x: params.x } : {},
|
|
108533
|
+
...params.y !== void 0 ? { y: params.y } : {},
|
|
108534
|
+
...params.button ? { button: params.button } : {},
|
|
108535
|
+
...params.clickCount !== void 0 ? { clickCount: params.clickCount } : {},
|
|
108536
|
+
...params.direction ? { direction: params.direction } : {},
|
|
108537
|
+
...params.pages !== void 0 ? { pages: params.pages } : {},
|
|
108538
|
+
...params.value !== void 0 ? { value: params.value } : {},
|
|
108539
|
+
...params.text !== void 0 ? { text: params.text } : {},
|
|
108540
|
+
...params.key ? { key: params.key } : {},
|
|
108541
|
+
...params.action ? { action: params.action } : {}
|
|
108542
|
+
};
|
|
108543
|
+
}
|
|
108544
|
+
async function createComputerUseReadCommand(params) {
|
|
108545
|
+
const config4 = await getComputerUseClientConfig();
|
|
108546
|
+
const client = initClient(zeroComputerUseCommandContract, config4);
|
|
108547
|
+
const result = await client.create({ body: commandBody(params) });
|
|
108048
108548
|
if (result.status === 200) {
|
|
108049
108549
|
return result.body;
|
|
108050
108550
|
}
|
|
108051
|
-
handleError(result, "Failed to
|
|
108551
|
+
handleError(result, "Failed to create computer-use command");
|
|
108052
108552
|
}
|
|
108053
|
-
async function
|
|
108054
|
-
const config4 = await
|
|
108055
|
-
const client = initClient(
|
|
108056
|
-
const result = await client.
|
|
108057
|
-
if (result.status ===
|
|
108058
|
-
return;
|
|
108553
|
+
async function createComputerUseWriteCommand(params) {
|
|
108554
|
+
const config4 = await getComputerUseClientConfig();
|
|
108555
|
+
const client = initClient(zeroComputerUseWriteCommandContract, config4);
|
|
108556
|
+
const result = await client.create({ body: commandBody(params) });
|
|
108557
|
+
if (result.status === 200) {
|
|
108558
|
+
return result.body;
|
|
108059
108559
|
}
|
|
108060
|
-
handleError(result, "Failed to
|
|
108560
|
+
handleError(result, "Failed to create computer-use write command");
|
|
108061
108561
|
}
|
|
108062
|
-
async function
|
|
108063
|
-
const config4 = await
|
|
108064
|
-
const client = initClient(
|
|
108065
|
-
const result = await client.
|
|
108562
|
+
async function getComputerUseCommand(commandId) {
|
|
108563
|
+
const config4 = await getComputerUseClientConfig();
|
|
108564
|
+
const client = initClient(zeroComputerUseCommandContract, config4);
|
|
108565
|
+
const result = await client.get({ params: { commandId } });
|
|
108066
108566
|
if (result.status === 200) {
|
|
108067
108567
|
return result.body;
|
|
108068
108568
|
}
|
|
108069
|
-
|
|
108070
|
-
|
|
108569
|
+
handleError(result, "Failed to get computer-use command");
|
|
108570
|
+
}
|
|
108571
|
+
async function listComputerUseHosts() {
|
|
108572
|
+
const config4 = await getComputerUseClientConfig();
|
|
108573
|
+
const client = initClient(zeroComputerUseHostsContract, config4);
|
|
108574
|
+
const result = await client.list({ headers: {} });
|
|
108575
|
+
if (result.status === 200) {
|
|
108576
|
+
return result.body;
|
|
108577
|
+
}
|
|
108578
|
+
handleError(result, "Failed to list computer-use hosts");
|
|
108579
|
+
}
|
|
108580
|
+
async function deleteComputerUseHost(hostId) {
|
|
108581
|
+
const config4 = await getComputerUseClientConfig();
|
|
108582
|
+
const client = initClient(zeroComputerUseHostsContract, config4);
|
|
108583
|
+
const result = await client.delete({ params: { hostId } });
|
|
108584
|
+
if (result.status === 200) {
|
|
108585
|
+
return result.body;
|
|
108586
|
+
}
|
|
108587
|
+
handleError(result, "Failed to revoke computer-use host");
|
|
108588
|
+
}
|
|
108589
|
+
async function listComputerUseAuditEvents(params) {
|
|
108590
|
+
const config4 = await getComputerUseClientConfig();
|
|
108591
|
+
const client = initClient(zeroComputerUseAuditEventsContract, config4);
|
|
108592
|
+
const result = await client.list({
|
|
108593
|
+
query: {
|
|
108594
|
+
limit: params.limit ?? 50,
|
|
108595
|
+
...params.commandId ? { commandId: params.commandId } : {},
|
|
108596
|
+
...params.hostId ? { hostId: params.hostId } : {},
|
|
108597
|
+
...params.runId ? { runId: params.runId } : {}
|
|
108598
|
+
}
|
|
108599
|
+
});
|
|
108600
|
+
if (result.status === 200) {
|
|
108601
|
+
return result.body;
|
|
108071
108602
|
}
|
|
108072
|
-
handleError(result, "Failed to
|
|
108603
|
+
handleError(result, "Failed to list computer-use audit events");
|
|
108073
108604
|
}
|
|
108074
108605
|
|
|
108075
108606
|
// src/lib/api/domains/zero-local-agent.ts
|
|
@@ -108141,7 +108672,7 @@ var localAgentJobStatusSchema = external_exports.enum([
|
|
|
108141
108672
|
"failed"
|
|
108142
108673
|
]);
|
|
108143
108674
|
var localAgentHostStatusSchema = external_exports.enum(["online", "closed"]);
|
|
108144
|
-
var
|
|
108675
|
+
var hostNameSchema2 = external_exports.string().trim().min(1).max(128);
|
|
108145
108676
|
var supportedBackendsSchema = external_exports.array(localAgentBackendSchema).min(1).max(2);
|
|
108146
108677
|
var promptSchema = external_exports.string().trim().min(1).max(6e4);
|
|
108147
108678
|
var localAgentRealtimeSubscriptionSchema = external_exports.object({
|
|
@@ -108243,7 +108774,7 @@ var zeroLocalAgentDeviceStartContract = c27.router({
|
|
|
108243
108774
|
method: "POST",
|
|
108244
108775
|
path: "/api/zero/local-agent/device/start",
|
|
108245
108776
|
body: external_exports.object({
|
|
108246
|
-
hostName:
|
|
108777
|
+
hostName: hostNameSchema2,
|
|
108247
108778
|
supportedBackends: supportedBackendsSchema
|
|
108248
108779
|
}),
|
|
108249
108780
|
responses: {
|
|
@@ -108293,7 +108824,7 @@ var zeroLocalAgentHeartbeatContract = c27.router({
|
|
|
108293
108824
|
path: "/api/zero/local-agent/heartbeat",
|
|
108294
108825
|
headers: authHeadersSchema,
|
|
108295
108826
|
body: external_exports.object({
|
|
108296
|
-
hostName:
|
|
108827
|
+
hostName: hostNameSchema2,
|
|
108297
108828
|
supportedBackends: supportedBackendsSchema,
|
|
108298
108829
|
realtimeConnected: external_exports.boolean().optional()
|
|
108299
108830
|
}),
|
|
@@ -108376,7 +108907,7 @@ var zeroLocalAgentHostsContract = c27.router({
|
|
|
108376
108907
|
path: "/api/zero/local-agent/hosts/start",
|
|
108377
108908
|
headers: authHeadersSchema,
|
|
108378
108909
|
body: external_exports.object({
|
|
108379
|
-
hostName:
|
|
108910
|
+
hostName: hostNameSchema2,
|
|
108380
108911
|
supportedBackends: supportedBackendsSchema,
|
|
108381
108912
|
hostId: external_exports.string().min(1).optional()
|
|
108382
108913
|
}),
|
|
@@ -108468,13 +108999,13 @@ var zeroLocalAgentHostJobsContract = c27.router({
|
|
|
108468
108999
|
});
|
|
108469
109000
|
|
|
108470
109001
|
// src/lib/api/domains/zero-local-agent.ts
|
|
108471
|
-
function
|
|
109002
|
+
function normalizeConfiguredUrl2(value) {
|
|
108472
109003
|
return value.startsWith("http") ? value : `https://${value}`;
|
|
108473
109004
|
}
|
|
108474
109005
|
function resolveLocalAgentApiBaseUrl(baseUrl) {
|
|
108475
109006
|
const override = process.env.VM0_API_BACKEND_URL;
|
|
108476
109007
|
if (override) {
|
|
108477
|
-
return
|
|
109008
|
+
return normalizeConfiguredUrl2(override).replace(/\/$/, "");
|
|
108478
109009
|
}
|
|
108479
109010
|
const url2 = new URL(baseUrl);
|
|
108480
109011
|
if (url2.hostname === "www.vm0.ai" || url2.hostname === "app.vm0.ai") {
|
|
@@ -108482,7 +109013,7 @@ function resolveLocalAgentApiBaseUrl(baseUrl) {
|
|
|
108482
109013
|
}
|
|
108483
109014
|
return url2.toString().replace(/\/$/, "");
|
|
108484
109015
|
}
|
|
108485
|
-
function
|
|
109016
|
+
function buildHeaders3(token) {
|
|
108486
109017
|
const headers = {};
|
|
108487
109018
|
if (token) {
|
|
108488
109019
|
headers.Authorization = `Bearer ${token}`;
|
|
@@ -108506,7 +109037,7 @@ async function getLocalAgentClientConfig() {
|
|
|
108506
109037
|
};
|
|
108507
109038
|
}
|
|
108508
109039
|
function buildBearerHeaders(token) {
|
|
108509
|
-
return
|
|
109040
|
+
return buildHeaders3(token);
|
|
108510
109041
|
}
|
|
108511
109042
|
async function sendLocalAgentHeartbeat(params) {
|
|
108512
109043
|
const baseUrl = resolveLocalAgentApiBaseUrl(await getBaseUrl());
|
|
@@ -108694,7 +109225,7 @@ var localBrowserCommandErrorCodeSchema = external_exports.enum([
|
|
|
108694
109225
|
"timeout",
|
|
108695
109226
|
"unsupported_command"
|
|
108696
109227
|
]);
|
|
108697
|
-
var
|
|
109228
|
+
var hostNameSchema3 = external_exports.string().trim().min(1).max(128);
|
|
108698
109229
|
var browserSchema = external_exports.string().trim().min(1).max(64);
|
|
108699
109230
|
var extensionVersionSchema = external_exports.string().trim().min(1).max(64);
|
|
108700
109231
|
var tabIdSchema = external_exports.string().trim().min(1).max(128);
|
|
@@ -108703,12 +109234,12 @@ var targetUrlSchema = external_exports.string().trim().url().max(2048).refine((v
|
|
|
108703
109234
|
return protocol === "http:" || protocol === "https:";
|
|
108704
109235
|
}, "URL must use http or https");
|
|
108705
109236
|
var cssSelectorSchema = external_exports.string().trim().min(1).max(1024);
|
|
108706
|
-
var
|
|
109237
|
+
var supportedCapabilitiesSchema2 = external_exports.array(external_exports.string().trim().min(1).max(128)).max(50);
|
|
108707
109238
|
var localBrowserRuntimeBodySchema = external_exports.object({
|
|
108708
|
-
hostName:
|
|
109239
|
+
hostName: hostNameSchema3,
|
|
108709
109240
|
browser: browserSchema,
|
|
108710
109241
|
extensionVersion: extensionVersionSchema,
|
|
108711
|
-
supportedCapabilities:
|
|
109242
|
+
supportedCapabilities: supportedCapabilitiesSchema2.default([])
|
|
108712
109243
|
});
|
|
108713
109244
|
var localBrowserRealtimeSubscriptionSchema = external_exports.object({
|
|
108714
109245
|
channelName: external_exports.string(),
|
|
@@ -108783,7 +109314,7 @@ var localBrowserHostDeleteResponseSchema = external_exports.object({
|
|
|
108783
109314
|
var localBrowserCommandTargetShape = {
|
|
108784
109315
|
tabId: tabIdSchema.optional(),
|
|
108785
109316
|
hostId: external_exports.string().min(1).optional(),
|
|
108786
|
-
hostName:
|
|
109317
|
+
hostName: hostNameSchema3.optional(),
|
|
108787
109318
|
timeoutMs: external_exports.number().int().min(1e3).max(6e4).default(15e3)
|
|
108788
109319
|
};
|
|
108789
109320
|
var localBrowserCommandCreateBodySchema = external_exports.object({
|
|
@@ -109182,7 +109713,7 @@ var zeroLocalBrowserHostCommandsContract = c28.router({
|
|
|
109182
109713
|
path: "/api/zero/local-browser/host/commands/next",
|
|
109183
109714
|
headers: authHeadersSchema,
|
|
109184
109715
|
body: external_exports.object({
|
|
109185
|
-
supportedCapabilities:
|
|
109716
|
+
supportedCapabilities: supportedCapabilitiesSchema2.default([])
|
|
109186
109717
|
}),
|
|
109187
109718
|
responses: {
|
|
109188
109719
|
200: localBrowserHostCommandNextResponseSchema,
|
|
@@ -109211,13 +109742,13 @@ var zeroLocalBrowserHostCommandsContract = c28.router({
|
|
|
109211
109742
|
});
|
|
109212
109743
|
|
|
109213
109744
|
// src/lib/api/domains/zero-local-browser.ts
|
|
109214
|
-
function
|
|
109745
|
+
function normalizeConfiguredUrl3(value) {
|
|
109215
109746
|
return value.startsWith("http") ? value : `https://${value}`;
|
|
109216
109747
|
}
|
|
109217
109748
|
function resolveLocalBrowserApiBaseUrl(baseUrl) {
|
|
109218
109749
|
const override = process.env.VM0_API_BACKEND_URL;
|
|
109219
109750
|
if (override) {
|
|
109220
|
-
return
|
|
109751
|
+
return normalizeConfiguredUrl3(override).replace(/\/$/, "");
|
|
109221
109752
|
}
|
|
109222
109753
|
const url2 = new URL(baseUrl);
|
|
109223
109754
|
if (url2.hostname === "www.vm0.ai" || url2.hostname === "app.vm0.ai") {
|
|
@@ -109225,7 +109756,7 @@ function resolveLocalBrowserApiBaseUrl(baseUrl) {
|
|
|
109225
109756
|
}
|
|
109226
109757
|
return url2.toString().replace(/\/$/, "");
|
|
109227
109758
|
}
|
|
109228
|
-
function
|
|
109759
|
+
function buildHeaders4(token) {
|
|
109229
109760
|
const headers = {};
|
|
109230
109761
|
if (token) {
|
|
109231
109762
|
headers.Authorization = `Bearer ${token}`;
|
|
@@ -109244,7 +109775,7 @@ async function getLocalBrowserClientConfig() {
|
|
|
109244
109775
|
}
|
|
109245
109776
|
return {
|
|
109246
109777
|
baseUrl,
|
|
109247
|
-
baseHeaders:
|
|
109778
|
+
baseHeaders: buildHeaders4(token),
|
|
109248
109779
|
jsonQuery: false
|
|
109249
109780
|
};
|
|
109250
109781
|
}
|
|
@@ -122744,6 +123275,27 @@ var webflowFirewall = {
|
|
|
122744
123275
|
]
|
|
122745
123276
|
};
|
|
122746
123277
|
|
|
123278
|
+
// ../../packages/connectors/src/firewalls/weread.generated.ts
|
|
123279
|
+
init_esm_shims();
|
|
123280
|
+
var wereadFirewall = {
|
|
123281
|
+
name: "weread",
|
|
123282
|
+
description: "WeRead (\u5FAE\u4FE1\u8BFB\u4E66) Agent gateway: bookshelf, notes, reading stats, search",
|
|
123283
|
+
placeholders: {
|
|
123284
|
+
WEREAD_API_KEY: "wrk-CoffeeSafeLocalCoffeeSafeLocalCoffee"
|
|
123285
|
+
},
|
|
123286
|
+
apis: [
|
|
123287
|
+
{
|
|
123288
|
+
base: "https://i.weread.qq.com",
|
|
123289
|
+
auth: {
|
|
123290
|
+
headers: {
|
|
123291
|
+
Authorization: "Bearer ${{ secrets.WEREAD_API_KEY }}"
|
|
123292
|
+
}
|
|
123293
|
+
},
|
|
123294
|
+
permissions: []
|
|
123295
|
+
}
|
|
123296
|
+
]
|
|
123297
|
+
};
|
|
123298
|
+
|
|
122747
123299
|
// ../../packages/connectors/src/firewalls/wix.generated.ts
|
|
122748
123300
|
init_esm_shims();
|
|
122749
123301
|
var wixFirewall = {
|
|
@@ -125067,6 +125619,7 @@ var CONNECTOR_FIREWALLS = {
|
|
|
125067
125619
|
vercel: vercelFirewall,
|
|
125068
125620
|
wandb: wandbFirewall,
|
|
125069
125621
|
webflow: webflowFirewall,
|
|
125622
|
+
weread: wereadFirewall,
|
|
125070
125623
|
wix: wixFirewall,
|
|
125071
125624
|
workos: workosFirewall,
|
|
125072
125625
|
wrike: wrikeFirewall,
|
|
@@ -127324,34 +127877,6 @@ var zeroPersonalModelProvidersByTypeContract = c65.router({
|
|
|
127324
127877
|
summary: "Delete a personal model provider for the requesting user"
|
|
127325
127878
|
}
|
|
127326
127879
|
});
|
|
127327
|
-
var zeroPersonalModelProvidersCodexOauthContract = c65.router({
|
|
127328
|
-
authorize: {
|
|
127329
|
-
method: "GET",
|
|
127330
|
-
path: "/api/zero/me/model-providers/codex-oauth-token/oauth/authorize",
|
|
127331
|
-
headers: authHeadersSchema,
|
|
127332
|
-
responses: {
|
|
127333
|
-
307: c65.noBody(),
|
|
127334
|
-
404: external_exports.object({ error: external_exports.string() }),
|
|
127335
|
-
500: external_exports.object({ error: external_exports.string() })
|
|
127336
|
-
},
|
|
127337
|
-
summary: "Start Codex OAuth for a personal model provider"
|
|
127338
|
-
},
|
|
127339
|
-
callback: {
|
|
127340
|
-
method: "GET",
|
|
127341
|
-
path: "/api/zero/me/model-providers/codex-oauth-token/oauth/callback",
|
|
127342
|
-
headers: authHeadersSchema,
|
|
127343
|
-
query: external_exports.object({
|
|
127344
|
-
code: external_exports.string().optional(),
|
|
127345
|
-
state: external_exports.string().optional(),
|
|
127346
|
-
error: external_exports.string().optional(),
|
|
127347
|
-
error_description: external_exports.string().optional()
|
|
127348
|
-
}),
|
|
127349
|
-
responses: {
|
|
127350
|
-
307: c65.noBody()
|
|
127351
|
-
},
|
|
127352
|
-
summary: "Complete Codex OAuth for a personal model provider"
|
|
127353
|
-
}
|
|
127354
|
-
});
|
|
127355
127880
|
|
|
127356
127881
|
// ../../packages/api-contracts/src/contracts/api-keys.ts
|
|
127357
127882
|
init_esm_shims();
|
|
@@ -131541,9 +132066,12 @@ export {
|
|
|
131541
132066
|
searchLogs,
|
|
131542
132067
|
requestDeveloperSupportConsent,
|
|
131543
132068
|
submitDeveloperSupport,
|
|
131544
|
-
|
|
131545
|
-
|
|
131546
|
-
|
|
132069
|
+
createComputerUseReadCommand,
|
|
132070
|
+
createComputerUseWriteCommand,
|
|
132071
|
+
getComputerUseCommand,
|
|
132072
|
+
listComputerUseHosts,
|
|
132073
|
+
deleteComputerUseHost,
|
|
132074
|
+
listComputerUseAuditEvents,
|
|
131547
132075
|
createLocalBrowserReadCommand,
|
|
131548
132076
|
createLocalBrowserWriteCommand,
|
|
131549
132077
|
getLocalBrowserReadCommand,
|
|
@@ -131607,4 +132135,4 @@ undici/lib/web/fetch/body.js:
|
|
|
131607
132135
|
undici/lib/web/websocket/frame.js:
|
|
131608
132136
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
131609
132137
|
*/
|
|
131610
|
-
//# sourceMappingURL=chunk-
|
|
132138
|
+
//# sourceMappingURL=chunk-Y2IQIGV7.js.map
|