@ycodium-ai/agent-opencode 0.2.2098 → 0.2.2126

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.
Files changed (2) hide show
  1. package/dist/index.js +1882 -475
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { createRequire as __ycodiumCreateRequire } from "node:module";
2
+ const require = __ycodiumCreateRequire(import.meta.url);
1
3
  var __create = Object.create;
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -536,6 +538,7 @@ import { definePlugin } from "@ycodium-ai/plugin-api";
536
538
 
537
539
  // src/card.ts
538
540
  var OPENCODE_DRIVER_KIND = "opencode";
541
+ var OPENCODE_BINDING_PROVIDER_ID = "ycodium";
539
542
  var OPENCODE_CARD = {
540
543
  driverKind: OPENCODE_DRIVER_KIND,
541
544
  displayName: "OpenCode",
@@ -574,6 +577,10 @@ var OPENCODE_CARD = {
574
577
  sessionModelSwitch: "in-session",
575
578
  // permission ruleset 在 session 创建/恢复时定下,中途改不了。
576
579
  runtimeModeSwitch: "next-turn",
580
+ // 权限规则在建会话时发一次,切档要重开会话(与 runtimeModeSwitch 同为 next-turn)。
581
+ // 声明这一位让界面画这双手真有的三档;四档在它身上撞车(auto 与 approval-required
582
+ // 拼出逐字相同的规则集)。
583
+ nativeModeSwitch: true,
577
584
  contextCompaction: "native"
578
585
  },
579
586
  // OpenCode 凭据由 CLI 自己管在 XDG 目录,probe 从已连接 provider 推断,不读 auth.json。
@@ -612,12 +619,17 @@ var OPENCODE_CARD = {
612
619
  extraEnv: [
613
620
  {
614
621
  name: "OPENCODE_CONFIG_CONTENT",
615
- value: '{"provider":{"ycodium":{"npm":"@ai-sdk/openai-compatible","name":"Ycodium","options":{"baseURL":"$baseUrl","apiKey":"$credential"},"models":{"$model":{"name":"$model"}}}},"model":"ycodium/$model"}'
622
+ value: `{"provider":{"${OPENCODE_BINDING_PROVIDER_ID}":{"npm":"@ai-sdk/openai-compatible","name":"Ycodium","options":{"baseURL":"$baseUrl","apiKey":"$credential"},"models":{"$model":{"name":"$model"}}}},"model":"${OPENCODE_BINDING_PROVIDER_ID}/$model"}`
616
623
  }
617
624
  ]
618
625
  }
619
626
  };
620
627
 
628
+ // src/opencodeInstance.ts
629
+ import {
630
+ createCatalogModelMatcher as createCatalogModelMatcher2
631
+ } from "@ycodium-ai/plugin-api/executor";
632
+
621
633
  // src/config.ts
622
634
  function isRecord(value) {
623
635
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -760,14 +772,6 @@ function nowIso() {
760
772
  function randomUUID() {
761
773
  return crypto.randomUUID();
762
774
  }
763
- function compactEnv(env) {
764
- const out = {};
765
- if (!env) return out;
766
- for (const [key, value] of Object.entries(env)) {
767
- if (value !== void 0) out[key] = value;
768
- }
769
- return out;
770
- }
771
775
 
772
776
  // src/error.ts
773
777
  function isOpenCodeNotFound(cause) {
@@ -1143,6 +1147,61 @@ async function isSameOpenCodeDirectory(left, right) {
1143
1147
  return await canonicalize(lexicalLeft) === await canonicalize(lexicalRight);
1144
1148
  }
1145
1149
 
1150
+ // src/slug.ts
1151
+ function parseOpenCodeModelSlug(slug) {
1152
+ if (typeof slug !== "string") {
1153
+ return null;
1154
+ }
1155
+ const trimmed = slug.trim();
1156
+ const separator = trimmed.indexOf("/");
1157
+ if (separator <= 0 || separator === trimmed.length - 1) {
1158
+ return null;
1159
+ }
1160
+ return {
1161
+ providerID: trimmed.slice(0, separator),
1162
+ modelID: trimmed.slice(separator + 1)
1163
+ };
1164
+ }
1165
+ var OPENCODE_RESUME_VERSION = 1;
1166
+ function parseOpenCodeResume(raw) {
1167
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
1168
+ return void 0;
1169
+ }
1170
+ const record = raw;
1171
+ if (record.schemaVersion !== OPENCODE_RESUME_VERSION) {
1172
+ return void 0;
1173
+ }
1174
+ if (typeof record.sessionId !== "string" || record.sessionId.trim().length === 0) {
1175
+ return void 0;
1176
+ }
1177
+ return { sessionId: record.sessionId.trim() };
1178
+ }
1179
+ function makeOpenCodeResumeCursor(sessionId) {
1180
+ return { schemaVersion: OPENCODE_RESUME_VERSION, sessionId };
1181
+ }
1182
+ var OPENCODE_DEFAULT_TITLE_PATTERN = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
1183
+ function isOpenCodeDefaultTitle(title) {
1184
+ return OPENCODE_DEFAULT_TITLE_PATTERN.test(title);
1185
+ }
1186
+ function parseGenericCliVersion(output) {
1187
+ const match = output.match(/\b(\d+\.\d+\.\d+)\b/);
1188
+ return match?.[1] ?? null;
1189
+ }
1190
+ function compareSemverVersions(left, right) {
1191
+ const parse = (value) => {
1192
+ const match = value.trim().replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
1193
+ if (!match) return null;
1194
+ return [Number(match[1]), Number(match[2]), Number(match[3])];
1195
+ };
1196
+ const a = parse(left);
1197
+ const b = parse(right);
1198
+ if (!a || !b) return left.localeCompare(right);
1199
+ if (a[0] !== b[0]) return a[0] - b[0];
1200
+ if (a[1] !== b[1]) return a[1] - b[1];
1201
+ return a[2] - b[2];
1202
+ }
1203
+ var MINIMUM_OPENCODE_VERSION = "1.14.19";
1204
+
1146
1205
  // src/model.ts
1147
1206
  function extractJsonObject(raw) {
1148
1207
  const trimmed = raw.trim();
@@ -1193,11 +1252,119 @@ function modelIdFromSelection(selection) {
1193
1252
  const model = selection["model"];
1194
1253
  return typeof model === "string" ? model.trim() || void 0 : void 0;
1195
1254
  }
1255
+ function chooseOpenCodeModel(input) {
1256
+ if (input.boundModelId !== void 0) {
1257
+ const bound = input.match(input.requested, [
1258
+ `${OPENCODE_BINDING_PROVIDER_ID}/${input.boundModelId}`
1259
+ ]);
1260
+ return parseOpenCodeModelSlug(bound) ?? void 0;
1261
+ }
1262
+ const own = parseOpenCodeModelSlug(input.requested);
1263
+ if (own) return own;
1264
+ input.match(input.requested, []);
1265
+ return void 0;
1266
+ }
1196
1267
  function boundInstanceIdFromSelection(selection) {
1197
1268
  if (!isRecord2(selection)) return void 0;
1198
1269
  const instanceId = selection["instanceId"];
1199
1270
  return typeof instanceId === "string" ? instanceId.trim() || void 0 : void 0;
1200
1271
  }
1272
+ function titleCaseSlug(value) {
1273
+ const segments = [];
1274
+ for (const segment of value.split(/[-_/]+/)) {
1275
+ if (segment.length > 0) {
1276
+ segments.push(segment.charAt(0).toUpperCase() + segment.slice(1));
1277
+ }
1278
+ }
1279
+ return segments.join(" ");
1280
+ }
1281
+ function inferDefaultVariant(providerID, variants) {
1282
+ if (variants.length === 1) {
1283
+ return variants[0];
1284
+ }
1285
+ if (providerID === "anthropic" || providerID.startsWith("google")) {
1286
+ return variants.includes("high") ? "high" : void 0;
1287
+ }
1288
+ if (providerID === "openai" || providerID === "opencode") {
1289
+ return variants.includes("medium") ? "medium" : variants.includes("high") ? "high" : void 0;
1290
+ }
1291
+ return void 0;
1292
+ }
1293
+ function inferDefaultAgent(agents) {
1294
+ return agents.find((agent) => agent.name === "build")?.name ?? agents[0]?.name ?? void 0;
1295
+ }
1296
+ function nonEmptyTrimmed(value) {
1297
+ const trimmed = value?.trim();
1298
+ return trimmed && trimmed.length > 0 ? trimmed : void 0;
1299
+ }
1300
+ function openCodeCapabilitiesForModel(input) {
1301
+ const variantValues = Object.keys(input.model.variants ?? {});
1302
+ const defaultVariant = inferDefaultVariant(input.providerID, variantValues);
1303
+ const variantOptions = variantValues.map(
1304
+ (value) => defaultVariant === value ? { id: value, label: titleCaseSlug(value), isDefault: true } : { id: value, label: titleCaseSlug(value) }
1305
+ );
1306
+ const primaryAgents = input.agents.filter(
1307
+ (agent) => !agent.hidden && (agent.mode === "primary" || agent.mode === "all")
1308
+ );
1309
+ const defaultAgent = inferDefaultAgent(primaryAgents);
1310
+ const agentOptions = primaryAgents.map(
1311
+ (agent) => defaultAgent === agent.name ? { id: agent.name, label: titleCaseSlug(agent.name), isDefault: true } : { id: agent.name, label: titleCaseSlug(agent.name) }
1312
+ );
1313
+ return {
1314
+ optionDescriptors: [
1315
+ ...variantOptions.length > 0 ? [
1316
+ {
1317
+ id: "variant",
1318
+ label: "Variant",
1319
+ type: "select",
1320
+ options: variantOptions,
1321
+ ...defaultVariant ? { currentValue: defaultVariant } : {}
1322
+ }
1323
+ ] : [],
1324
+ ...agentOptions.length > 0 ? [
1325
+ {
1326
+ id: "agent",
1327
+ label: "Agent",
1328
+ type: "select",
1329
+ options: agentOptions,
1330
+ ...defaultAgent ? { currentValue: defaultAgent } : {}
1331
+ }
1332
+ ] : []
1333
+ ]
1334
+ };
1335
+ }
1336
+ function flattenOpenCodeModels(input) {
1337
+ const connected = new Set(input.providerList.connected);
1338
+ const models = [];
1339
+ for (const provider of input.providerList.all) {
1340
+ if (!connected.has(provider.id)) continue;
1341
+ for (const [modelKey, model] of Object.entries(provider.models)) {
1342
+ const name = nonEmptyTrimmed(model.name);
1343
+ if (!name) continue;
1344
+ const modelId = nonEmptyTrimmed(model.id) ?? modelKey;
1345
+ const subProvider = nonEmptyTrimmed(provider.name);
1346
+ models.push({
1347
+ slug: `${provider.id}/${modelId}`,
1348
+ name,
1349
+ ...subProvider ? { subProvider } : {},
1350
+ isCustom: false,
1351
+ capabilities: openCodeCapabilitiesForModel({
1352
+ providerID: provider.id,
1353
+ model,
1354
+ agents: input.agents
1355
+ })
1356
+ });
1357
+ }
1358
+ }
1359
+ return models.toSorted((left, right) => left.name.localeCompare(right.name));
1360
+ }
1361
+ function openCodeProbeModels(inventory) {
1362
+ return flattenOpenCodeModels(inventory).map((model) => ({
1363
+ slug: model.slug,
1364
+ name: model.name,
1365
+ ...model.capabilities.optionDescriptors.length > 0 ? { capabilities: model.capabilities } : {}
1366
+ }));
1367
+ }
1201
1368
  function formatOpenCodeProbeError(input) {
1202
1369
  const raw = toMessage(input.cause, String(input.cause));
1203
1370
  const detail = hideGenericEffectText(raw);
@@ -1232,6 +1399,45 @@ function formatOpenCodeProbeError(input) {
1232
1399
  }
1233
1400
 
1234
1401
  // src/permission.ts
1402
+ var OPENCODE_NATIVE_MODES = [
1403
+ {
1404
+ id: "ask",
1405
+ name: "Ask every time",
1406
+ description: "Asks before editing files, running commands, or reaching the network."
1407
+ },
1408
+ {
1409
+ id: "accept-edits",
1410
+ name: "Accept edits",
1411
+ description: "Edits files without asking; still asks for commands and network access."
1412
+ },
1413
+ {
1414
+ id: "allow-all",
1415
+ name: "Allow everything",
1416
+ description: "Never asks. Every tool runs immediately."
1417
+ }
1418
+ ];
1419
+ var OPENCODE_DEFAULT_NATIVE_MODE_ID = "ask";
1420
+ var OPENCODE_NATIVE_MODE_BY_RUNTIME_MODE = {
1421
+ "approval-required": "ask",
1422
+ "auto-accept-edits": "accept-edits",
1423
+ auto: "ask",
1424
+ "full-access": "allow-all"
1425
+ };
1426
+ function isOpenCodeNativeModeId(value) {
1427
+ return OPENCODE_NATIVE_MODES.some((mode) => mode.id === value);
1428
+ }
1429
+ function openCodeNativeModeFor(runtimeMode, nativeModeId) {
1430
+ return nativeModeId !== void 0 && isOpenCodeNativeModeId(nativeModeId) ? nativeModeId : OPENCODE_NATIVE_MODE_BY_RUNTIME_MODE[runtimeMode];
1431
+ }
1432
+ function openCodePermissionRulesForNativeMode(nativeModeId) {
1433
+ if (nativeModeId === "allow-all") {
1434
+ return buildOpenCodePermissionRules("full-access");
1435
+ }
1436
+ if (nativeModeId === "accept-edits") {
1437
+ return buildOpenCodePermissionRules("auto-accept-edits");
1438
+ }
1439
+ return buildOpenCodePermissionRules("approval-required");
1440
+ }
1235
1441
  function buildOpenCodePermissionRules(runtimeMode) {
1236
1442
  if (runtimeMode === "full-access") {
1237
1443
  return [{ permission: "*", pattern: "*", action: "allow" }];
@@ -1319,7 +1525,7 @@ function mapPermissionDecision(reply) {
1319
1525
  import * as NodeNet from "node:net";
1320
1526
  import * as NodeOS3 from "node:os";
1321
1527
 
1322
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
1528
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
1323
1529
  var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
1324
1530
  let lastEventId;
1325
1531
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
@@ -1438,7 +1644,7 @@ var createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer,
1438
1644
  return { stream };
1439
1645
  };
1440
1646
 
1441
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js
1647
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/pathSerializer.gen.js
1442
1648
  var separatorArrayExplode = (style) => {
1443
1649
  switch (style) {
1444
1650
  case "label":
@@ -1541,7 +1747,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
1541
1747
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
1542
1748
  };
1543
1749
 
1544
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
1750
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
1545
1751
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
1546
1752
  var defaultPathSerializer = ({ path, url: _url }) => {
1547
1753
  let url = _url;
@@ -1624,7 +1830,7 @@ function getValidRequestBody(options) {
1624
1830
  return void 0;
1625
1831
  }
1626
1832
 
1627
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js
1833
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/auth.gen.js
1628
1834
  var getAuthToken = async (auth, callback) => {
1629
1835
  const token = typeof callback === "function" ? await callback(auth) : callback;
1630
1836
  if (!token) {
@@ -1639,12 +1845,12 @@ var getAuthToken = async (auth, callback) => {
1639
1845
  return token;
1640
1846
  };
1641
1847
 
1642
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js
1848
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/bodySerializer.gen.js
1643
1849
  var jsonBodySerializer = {
1644
1850
  bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
1645
1851
  };
1646
1852
 
1647
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js
1853
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/client/utils.gen.js
1648
1854
  var createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
1649
1855
  const querySerializer = (queryParams) => {
1650
1856
  const search = [];
@@ -1854,7 +2060,7 @@ var createConfig = (override = {}) => ({
1854
2060
  ...override
1855
2061
  });
1856
2062
 
1857
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js
2063
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/client/client.gen.js
1858
2064
  var createClient = (config = {}) => {
1859
2065
  let _config = mergeConfigs(createConfig(), config);
1860
2066
  const getConfig = () => ({ ..._config });
@@ -2062,7 +2268,7 @@ var createClient = (config = {}) => {
2062
2268
  };
2063
2269
  };
2064
2270
 
2065
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js
2271
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/core/params.gen.js
2066
2272
  var extraPrefixesMap = {
2067
2273
  $body_: "body",
2068
2274
  $headers_: "headers",
@@ -2158,10 +2364,10 @@ var buildClientParams = (args, fields) => {
2158
2364
  return params;
2159
2365
  };
2160
2366
 
2161
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js
2367
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/client.gen.js
2162
2368
  var client = createClient(createConfig({ baseUrl: "http://localhost:4096" }));
2163
2369
 
2164
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js
2370
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/gen/sdk.gen.js
2165
2371
  var HeyApiClient = class {
2166
2372
  client;
2167
2373
  constructor(args) {
@@ -2293,154 +2499,24 @@ var App = class extends HeyApiClient {
2293
2499
  });
2294
2500
  }
2295
2501
  };
2296
- var Config = class extends HeyApiClient {
2297
- /**
2298
- * Get global configuration
2299
- *
2300
- * Retrieve the current global OpenCode configuration settings and preferences.
2301
- */
2302
- get(options) {
2303
- return (options?.client ?? this.client).get({
2304
- url: "/global/config",
2305
- ...options
2306
- });
2307
- }
2308
- /**
2309
- * Update global configuration
2310
- *
2311
- * Update global OpenCode configuration settings and preferences.
2312
- */
2313
- update(parameters, options) {
2314
- const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
2315
- return (options?.client ?? this.client).patch({
2316
- url: "/global/config",
2317
- ...options,
2318
- ...params,
2319
- headers: {
2320
- "Content-Type": "application/json",
2321
- ...options?.headers,
2322
- ...params.headers
2323
- }
2324
- });
2325
- }
2326
- };
2327
- var Global = class extends HeyApiClient {
2328
- /**
2329
- * Get health
2330
- *
2331
- * Get health information about the OpenCode server.
2332
- */
2333
- health(options) {
2334
- return (options?.client ?? this.client).get({
2335
- url: "/global/health",
2336
- ...options
2337
- });
2338
- }
2339
- /**
2340
- * Get global events
2341
- *
2342
- * Subscribe to global events from the OpenCode system using server-sent events.
2343
- */
2344
- event(options) {
2345
- return (options?.client ?? this.client).sse.get({
2346
- url: "/global/event",
2347
- ...options
2348
- });
2349
- }
2350
- /**
2351
- * Dispose instance
2352
- *
2353
- * Clean up and dispose all OpenCode instances, releasing all resources.
2354
- */
2355
- dispose(options) {
2356
- return (options?.client ?? this.client).post({
2357
- url: "/global/dispose",
2358
- ...options
2359
- });
2360
- }
2361
- /**
2362
- * Upgrade opencode
2363
- *
2364
- * Upgrade opencode to the specified version or latest if not specified.
2365
- */
2366
- upgrade(parameters, options) {
2367
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
2368
- return (options?.client ?? this.client).post({
2369
- url: "/global/upgrade",
2370
- ...options,
2371
- ...params,
2372
- headers: {
2373
- "Content-Type": "application/json",
2374
- ...options?.headers,
2375
- ...params.headers
2376
- }
2377
- });
2378
- }
2379
- _config;
2380
- get config() {
2381
- return this._config ??= new Config({ client: this.client });
2382
- }
2383
- };
2384
- var Event = class extends HeyApiClient {
2385
- /**
2386
- * Subscribe to events
2387
- *
2388
- * Get events
2389
- */
2390
- subscribe(parameters, options) {
2391
- const params = buildClientParams([parameters], [
2392
- {
2393
- args: [
2394
- { in: "query", key: "directory" },
2395
- { in: "query", key: "workspace" }
2396
- ]
2397
- }
2398
- ]);
2399
- return (options?.client ?? this.client).sse.get({
2400
- url: "/event",
2401
- ...options,
2402
- ...params
2403
- });
2404
- }
2405
- };
2406
- var Config2 = class extends HeyApiClient {
2407
- /**
2408
- * Get configuration
2409
- *
2410
- * Retrieve the current OpenCode configuration settings and preferences.
2411
- */
2412
- get(parameters, options) {
2413
- const params = buildClientParams([parameters], [
2414
- {
2415
- args: [
2416
- { in: "query", key: "directory" },
2417
- { in: "query", key: "workspace" }
2418
- ]
2419
- }
2420
- ]);
2421
- return (options?.client ?? this.client).get({
2422
- url: "/config",
2423
- ...options,
2424
- ...params
2425
- });
2426
- }
2502
+ var ControlPlane = class extends HeyApiClient {
2427
2503
  /**
2428
- * Update configuration
2504
+ * Move session
2429
2505
  *
2430
- * Update OpenCode configuration settings and preferences.
2506
+ * Move a session to another project directory, optionally transferring local changes.
2431
2507
  */
2432
- update(parameters, options) {
2508
+ moveSession(parameters, options) {
2433
2509
  const params = buildClientParams([parameters], [
2434
2510
  {
2435
2511
  args: [
2436
- { in: "query", key: "directory" },
2437
- { in: "query", key: "workspace" },
2438
- { key: "config", map: "body" }
2512
+ { in: "body", key: "sessionID" },
2513
+ { in: "body", key: "destination" },
2514
+ { in: "body", key: "moveChanges" }
2439
2515
  ]
2440
2516
  }
2441
2517
  ]);
2442
- return (options?.client ?? this.client).patch({
2443
- url: "/config",
2518
+ return (options?.client ?? this.client).post({
2519
+ url: "/experimental/control-plane/move-session",
2444
2520
  ...options,
2445
2521
  ...params,
2446
2522
  headers: {
@@ -2450,12 +2526,14 @@ var Config2 = class extends HeyApiClient {
2450
2526
  }
2451
2527
  });
2452
2528
  }
2529
+ };
2530
+ var Capabilities = class extends HeyApiClient {
2453
2531
  /**
2454
- * List config providers
2532
+ * Get experimental capabilities
2455
2533
  *
2456
- * Get a list of all configured AI providers and their default models.
2534
+ * Get experimental features enabled on the OpenCode server.
2457
2535
  */
2458
- providers(parameters, options) {
2536
+ get(parameters, options) {
2459
2537
  const params = buildClientParams([parameters], [
2460
2538
  {
2461
2539
  args: [
@@ -2465,7 +2543,7 @@ var Config2 = class extends HeyApiClient {
2465
2543
  }
2466
2544
  ]);
2467
2545
  return (options?.client ?? this.client).get({
2468
- url: "/config/providers",
2546
+ url: "/experimental/capabilities",
2469
2547
  ...options,
2470
2548
  ...params
2471
2549
  });
@@ -2567,14 +2645,35 @@ var Session = class extends HeyApiClient {
2567
2645
  ...params
2568
2646
  });
2569
2647
  }
2570
- };
2571
- var Resource = class extends HeyApiClient {
2572
2648
  /**
2573
- * Get MCP resources
2649
+ * Background subagents
2574
2650
  *
2575
- * Get all available MCP resources from connected servers. Optionally filter by name.
2651
+ * Detach any synchronous subagents currently blocking the session and continue them in the background.
2576
2652
  */
2577
- list(parameters, options) {
2653
+ background(parameters, options) {
2654
+ const params = buildClientParams([parameters], [
2655
+ {
2656
+ args: [
2657
+ { in: "path", key: "sessionID" },
2658
+ { in: "query", key: "directory" },
2659
+ { in: "query", key: "workspace" }
2660
+ ]
2661
+ }
2662
+ ]);
2663
+ return (options?.client ?? this.client).post({
2664
+ url: "/experimental/session/{sessionID}/background",
2665
+ ...options,
2666
+ ...params
2667
+ });
2668
+ }
2669
+ };
2670
+ var Resource = class extends HeyApiClient {
2671
+ /**
2672
+ * Get MCP resources
2673
+ *
2674
+ * Get all available MCP resources from connected servers. Optionally filter by name.
2675
+ */
2676
+ list(parameters, options) {
2578
2677
  const params = buildClientParams([parameters], [
2579
2678
  {
2580
2679
  args: [
@@ -2590,6 +2689,35 @@ var Resource = class extends HeyApiClient {
2590
2689
  });
2591
2690
  }
2592
2691
  };
2692
+ var ProjectCopy = class extends HeyApiClient {
2693
+ /**
2694
+ * Generate project copy name
2695
+ *
2696
+ * Generate a short name for a project copy from task context.
2697
+ */
2698
+ generateName(parameters, options) {
2699
+ const params = buildClientParams([parameters], [
2700
+ {
2701
+ args: [
2702
+ { in: "path", key: "projectID" },
2703
+ { in: "query", key: "directory" },
2704
+ { in: "query", key: "workspace" },
2705
+ { in: "body", key: "context" }
2706
+ ]
2707
+ }
2708
+ ]);
2709
+ return (options?.client ?? this.client).post({
2710
+ url: "/experimental/project/{projectID}/copy/generate-name",
2711
+ ...options,
2712
+ ...params,
2713
+ headers: {
2714
+ "Content-Type": "application/json",
2715
+ ...options?.headers,
2716
+ ...params.headers
2717
+ }
2718
+ });
2719
+ }
2720
+ };
2593
2721
  var Adapter = class extends HeyApiClient {
2594
2722
  /**
2595
2723
  * List workspace adapters
@@ -2757,6 +2885,14 @@ var Workspace = class extends HeyApiClient {
2757
2885
  }
2758
2886
  };
2759
2887
  var Experimental = class extends HeyApiClient {
2888
+ _controlPlane;
2889
+ get controlPlane() {
2890
+ return this._controlPlane ??= new ControlPlane({ client: this.client });
2891
+ }
2892
+ _capabilities;
2893
+ get capabilities() {
2894
+ return this._capabilities ??= new Capabilities({ client: this.client });
2895
+ }
2760
2896
  _console;
2761
2897
  get console() {
2762
2898
  return this._console ??= new Console({ client: this.client });
@@ -2769,11 +2905,193 @@ var Experimental = class extends HeyApiClient {
2769
2905
  get resource() {
2770
2906
  return this._resource ??= new Resource({ client: this.client });
2771
2907
  }
2908
+ _projectCopy;
2909
+ get projectCopy() {
2910
+ return this._projectCopy ??= new ProjectCopy({ client: this.client });
2911
+ }
2772
2912
  _workspace;
2773
2913
  get workspace() {
2774
2914
  return this._workspace ??= new Workspace({ client: this.client });
2775
2915
  }
2776
2916
  };
2917
+ var Config = class extends HeyApiClient {
2918
+ /**
2919
+ * Get global configuration
2920
+ *
2921
+ * Retrieve the current global OpenCode configuration settings and preferences.
2922
+ */
2923
+ get(options) {
2924
+ return (options?.client ?? this.client).get({
2925
+ url: "/global/config",
2926
+ ...options
2927
+ });
2928
+ }
2929
+ /**
2930
+ * Update global configuration
2931
+ *
2932
+ * Update global OpenCode configuration settings and preferences.
2933
+ */
2934
+ update(parameters, options) {
2935
+ const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]);
2936
+ return (options?.client ?? this.client).patch({
2937
+ url: "/global/config",
2938
+ ...options,
2939
+ ...params,
2940
+ headers: {
2941
+ "Content-Type": "application/json",
2942
+ ...options?.headers,
2943
+ ...params.headers
2944
+ }
2945
+ });
2946
+ }
2947
+ };
2948
+ var Global = class extends HeyApiClient {
2949
+ /**
2950
+ * Get health
2951
+ *
2952
+ * Get health information about the OpenCode server.
2953
+ */
2954
+ health(options) {
2955
+ return (options?.client ?? this.client).get({
2956
+ url: "/global/health",
2957
+ ...options
2958
+ });
2959
+ }
2960
+ /**
2961
+ * Get global events
2962
+ *
2963
+ * Subscribe to global events from the OpenCode system using server-sent events.
2964
+ */
2965
+ event(options) {
2966
+ return (options?.client ?? this.client).sse.get({
2967
+ url: "/global/event",
2968
+ ...options
2969
+ });
2970
+ }
2971
+ /**
2972
+ * Dispose instance
2973
+ *
2974
+ * Clean up and dispose all OpenCode instances, releasing all resources.
2975
+ */
2976
+ dispose(options) {
2977
+ return (options?.client ?? this.client).post({
2978
+ url: "/global/dispose",
2979
+ ...options
2980
+ });
2981
+ }
2982
+ /**
2983
+ * Upgrade opencode
2984
+ *
2985
+ * Upgrade opencode to the specified version.
2986
+ */
2987
+ upgrade(parameters, options) {
2988
+ const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]);
2989
+ return (options?.client ?? this.client).post({
2990
+ url: "/global/upgrade",
2991
+ ...options,
2992
+ ...params,
2993
+ headers: {
2994
+ "Content-Type": "application/json",
2995
+ ...options?.headers,
2996
+ ...params.headers
2997
+ }
2998
+ });
2999
+ }
3000
+ _config;
3001
+ get config() {
3002
+ return this._config ??= new Config({ client: this.client });
3003
+ }
3004
+ };
3005
+ var Event = class extends HeyApiClient {
3006
+ /**
3007
+ * Subscribe to events
3008
+ *
3009
+ * Get events
3010
+ */
3011
+ subscribe(parameters, options) {
3012
+ const params = buildClientParams([parameters], [
3013
+ {
3014
+ args: [
3015
+ { in: "query", key: "directory" },
3016
+ { in: "query", key: "workspace" }
3017
+ ]
3018
+ }
3019
+ ]);
3020
+ return (options?.client ?? this.client).sse.get({
3021
+ url: "/event",
3022
+ ...options,
3023
+ ...params
3024
+ });
3025
+ }
3026
+ };
3027
+ var Config2 = class extends HeyApiClient {
3028
+ /**
3029
+ * Get configuration
3030
+ *
3031
+ * Retrieve the current OpenCode configuration settings and preferences.
3032
+ */
3033
+ get(parameters, options) {
3034
+ const params = buildClientParams([parameters], [
3035
+ {
3036
+ args: [
3037
+ { in: "query", key: "directory" },
3038
+ { in: "query", key: "workspace" }
3039
+ ]
3040
+ }
3041
+ ]);
3042
+ return (options?.client ?? this.client).get({
3043
+ url: "/config",
3044
+ ...options,
3045
+ ...params
3046
+ });
3047
+ }
3048
+ /**
3049
+ * Update configuration
3050
+ *
3051
+ * Update OpenCode configuration settings and preferences.
3052
+ */
3053
+ update(parameters, options) {
3054
+ const params = buildClientParams([parameters], [
3055
+ {
3056
+ args: [
3057
+ { in: "query", key: "directory" },
3058
+ { in: "query", key: "workspace" },
3059
+ { key: "config", map: "body" }
3060
+ ]
3061
+ }
3062
+ ]);
3063
+ return (options?.client ?? this.client).patch({
3064
+ url: "/config",
3065
+ ...options,
3066
+ ...params,
3067
+ headers: {
3068
+ "Content-Type": "application/json",
3069
+ ...options?.headers,
3070
+ ...params.headers
3071
+ }
3072
+ });
3073
+ }
3074
+ /**
3075
+ * List config providers
3076
+ *
3077
+ * Get a list of all configured AI providers and their default models.
3078
+ */
3079
+ providers(parameters, options) {
3080
+ const params = buildClientParams([parameters], [
3081
+ {
3082
+ args: [
3083
+ { in: "query", key: "directory" },
3084
+ { in: "query", key: "workspace" }
3085
+ ]
3086
+ }
3087
+ ]);
3088
+ return (options?.client ?? this.client).get({
3089
+ url: "/config/providers",
3090
+ ...options,
3091
+ ...params
3092
+ });
3093
+ }
3094
+ };
2777
3095
  var Tool = class extends HeyApiClient {
2778
3096
  /**
2779
3097
  * List tools
@@ -3549,6 +3867,27 @@ var Project = class extends HeyApiClient {
3549
3867
  }
3550
3868
  });
3551
3869
  }
3870
+ /**
3871
+ * List project directories
3872
+ *
3873
+ * List known local absolute directories for a project.
3874
+ */
3875
+ directories(parameters, options) {
3876
+ const params = buildClientParams([parameters], [
3877
+ {
3878
+ args: [
3879
+ { in: "path", key: "projectID" },
3880
+ { in: "query", key: "directory" },
3881
+ { in: "query", key: "workspace" }
3882
+ ]
3883
+ }
3884
+ ]);
3885
+ return (options?.client ?? this.client).get({
3886
+ url: "/project/{projectID}/directories",
3887
+ ...options,
3888
+ ...params
3889
+ });
3890
+ }
3552
3891
  };
3553
3892
  var Pty = class extends HeyApiClient {
3554
3893
  /**
@@ -4768,53 +5107,44 @@ var Sync = class extends HeyApiClient {
4768
5107
  return this._history ??= new History({ client: this.client });
4769
5108
  }
4770
5109
  };
4771
- var Session3 = class extends HeyApiClient {
5110
+ var Control = class extends HeyApiClient {
4772
5111
  /**
4773
- * List v2 sessions
5112
+ * Get next TUI request
4774
5113
  *
4775
- * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
5114
+ * Retrieve the next TUI request from the queue for processing.
4776
5115
  */
4777
- list(parameters, options) {
5116
+ next(parameters, options) {
4778
5117
  const params = buildClientParams([parameters], [
4779
5118
  {
4780
5119
  args: [
4781
5120
  { in: "query", key: "directory" },
4782
- { in: "query", key: "workspace" },
4783
- { in: "query", key: "limit" },
4784
- { in: "query", key: "order" },
4785
- { in: "query", key: "path" },
4786
- { in: "query", key: "roots" },
4787
- { in: "query", key: "start" },
4788
- { in: "query", key: "search" },
4789
- { in: "query", key: "cursor" }
5121
+ { in: "query", key: "workspace" }
4790
5122
  ]
4791
5123
  }
4792
5124
  ]);
4793
5125
  return (options?.client ?? this.client).get({
4794
- url: "/api/session",
5126
+ url: "/tui/control/next",
4795
5127
  ...options,
4796
5128
  ...params
4797
5129
  });
4798
5130
  }
4799
5131
  /**
4800
- * Send v2 message
5132
+ * Submit TUI response
4801
5133
  *
4802
- * Create a v2 session message and queue it for the agent loop.
5134
+ * Submit a response to the TUI request queue to complete a pending request.
4803
5135
  */
4804
- prompt(parameters, options) {
5136
+ response(parameters, options) {
4805
5137
  const params = buildClientParams([parameters], [
4806
5138
  {
4807
5139
  args: [
4808
- { in: "path", key: "sessionID" },
4809
5140
  { in: "query", key: "directory" },
4810
5141
  { in: "query", key: "workspace" },
4811
- { in: "body", key: "prompt" },
4812
- { in: "body", key: "delivery" }
5142
+ { key: "body", map: "body" }
4813
5143
  ]
4814
5144
  }
4815
5145
  ]);
4816
5146
  return (options?.client ?? this.client).post({
4817
- url: "/api/session/{sessionID}/prompt",
5147
+ url: "/tui/control/response",
4818
5148
  ...options,
4819
5149
  ...params,
4820
5150
  headers: {
@@ -4824,196 +5154,200 @@ var Session3 = class extends HeyApiClient {
4824
5154
  }
4825
5155
  });
4826
5156
  }
5157
+ };
5158
+ var Tui = class extends HeyApiClient {
4827
5159
  /**
4828
- * Compact v2 session
5160
+ * Append TUI prompt
4829
5161
  *
4830
- * Compact a v2 session conversation.
5162
+ * Append prompt to the TUI.
4831
5163
  */
4832
- compact(parameters, options) {
5164
+ appendPrompt(parameters, options) {
4833
5165
  const params = buildClientParams([parameters], [
4834
5166
  {
4835
5167
  args: [
4836
- { in: "path", key: "sessionID" },
4837
5168
  { in: "query", key: "directory" },
4838
- { in: "query", key: "workspace" }
5169
+ { in: "query", key: "workspace" },
5170
+ { in: "body", key: "text" }
4839
5171
  ]
4840
5172
  }
4841
5173
  ]);
4842
5174
  return (options?.client ?? this.client).post({
4843
- url: "/api/session/{sessionID}/compact",
5175
+ url: "/tui/append-prompt",
4844
5176
  ...options,
4845
- ...params
5177
+ ...params,
5178
+ headers: {
5179
+ "Content-Type": "application/json",
5180
+ ...options?.headers,
5181
+ ...params.headers
5182
+ }
4846
5183
  });
4847
5184
  }
4848
5185
  /**
4849
- * Wait for v2 session
5186
+ * Open help dialog
4850
5187
  *
4851
- * Wait for a v2 session agent loop to become idle.
5188
+ * Open the help dialog in the TUI to display user assistance information.
4852
5189
  */
4853
- wait(parameters, options) {
5190
+ openHelp(parameters, options) {
4854
5191
  const params = buildClientParams([parameters], [
4855
5192
  {
4856
5193
  args: [
4857
- { in: "path", key: "sessionID" },
4858
5194
  { in: "query", key: "directory" },
4859
5195
  { in: "query", key: "workspace" }
4860
5196
  ]
4861
5197
  }
4862
5198
  ]);
4863
5199
  return (options?.client ?? this.client).post({
4864
- url: "/api/session/{sessionID}/wait",
5200
+ url: "/tui/open-help",
4865
5201
  ...options,
4866
5202
  ...params
4867
5203
  });
4868
5204
  }
4869
5205
  /**
4870
- * Get v2 session context
5206
+ * Open sessions dialog
4871
5207
  *
4872
- * Retrieve the active context messages for a v2 session (all messages after the last compaction).
5208
+ * Open the session dialog.
4873
5209
  */
4874
- context(parameters, options) {
5210
+ openSessions(parameters, options) {
4875
5211
  const params = buildClientParams([parameters], [
4876
5212
  {
4877
5213
  args: [
4878
- { in: "path", key: "sessionID" },
4879
5214
  { in: "query", key: "directory" },
4880
5215
  { in: "query", key: "workspace" }
4881
5216
  ]
4882
5217
  }
4883
5218
  ]);
4884
- return (options?.client ?? this.client).get({
4885
- url: "/api/session/{sessionID}/context",
5219
+ return (options?.client ?? this.client).post({
5220
+ url: "/tui/open-sessions",
4886
5221
  ...options,
4887
5222
  ...params
4888
5223
  });
4889
5224
  }
4890
5225
  /**
4891
- * Get v2 session messages
5226
+ * Open themes dialog
4892
5227
  *
4893
- * Retrieve projected v2 messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.
5228
+ * Open the theme dialog.
4894
5229
  */
4895
- messages(parameters, options) {
5230
+ openThemes(parameters, options) {
4896
5231
  const params = buildClientParams([parameters], [
4897
5232
  {
4898
5233
  args: [
4899
- { in: "path", key: "sessionID" },
4900
5234
  { in: "query", key: "directory" },
4901
- { in: "query", key: "workspace" },
4902
- { in: "query", key: "limit" },
4903
- { in: "query", key: "order" },
4904
- { in: "query", key: "cursor" }
5235
+ { in: "query", key: "workspace" }
4905
5236
  ]
4906
5237
  }
4907
5238
  ]);
4908
- return (options?.client ?? this.client).get({
4909
- url: "/api/session/{sessionID}/message",
5239
+ return (options?.client ?? this.client).post({
5240
+ url: "/tui/open-themes",
4910
5241
  ...options,
4911
5242
  ...params
4912
5243
  });
4913
5244
  }
4914
- };
4915
- var Model = class extends HeyApiClient {
4916
5245
  /**
4917
- * List v2 models
5246
+ * Open models dialog
4918
5247
  *
4919
- * Retrieve available v2 models ordered by release date.
5248
+ * Open the model dialog.
4920
5249
  */
4921
- list(parameters, options) {
4922
- const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
4923
- return (options?.client ?? this.client).get({
4924
- url: "/api/model",
5250
+ openModels(parameters, options) {
5251
+ const params = buildClientParams([parameters], [
5252
+ {
5253
+ args: [
5254
+ { in: "query", key: "directory" },
5255
+ { in: "query", key: "workspace" }
5256
+ ]
5257
+ }
5258
+ ]);
5259
+ return (options?.client ?? this.client).post({
5260
+ url: "/tui/open-models",
4925
5261
  ...options,
4926
5262
  ...params
4927
5263
  });
4928
5264
  }
4929
- };
4930
- var Provider2 = class extends HeyApiClient {
4931
5265
  /**
4932
- * List v2 providers
5266
+ * Submit TUI prompt
4933
5267
  *
4934
- * Retrieve active v2 AI providers so clients can show provider availability and configuration.
5268
+ * Submit the prompt.
4935
5269
  */
4936
- list(parameters, options) {
4937
- const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
4938
- return (options?.client ?? this.client).get({
4939
- url: "/api/provider",
5270
+ submitPrompt(parameters, options) {
5271
+ const params = buildClientParams([parameters], [
5272
+ {
5273
+ args: [
5274
+ { in: "query", key: "directory" },
5275
+ { in: "query", key: "workspace" }
5276
+ ]
5277
+ }
5278
+ ]);
5279
+ return (options?.client ?? this.client).post({
5280
+ url: "/tui/submit-prompt",
4940
5281
  ...options,
4941
5282
  ...params
4942
5283
  });
4943
5284
  }
4944
5285
  /**
4945
- * Get v2 provider
5286
+ * Clear TUI prompt
4946
5287
  *
4947
- * Retrieve a single v2 AI provider so clients can inspect its availability and endpoint settings.
5288
+ * Clear the prompt.
4948
5289
  */
4949
- get(parameters, options) {
5290
+ clearPrompt(parameters, options) {
4950
5291
  const params = buildClientParams([parameters], [
4951
5292
  {
4952
5293
  args: [
4953
- { in: "path", key: "providerID" },
4954
- { in: "query", key: "location" }
5294
+ { in: "query", key: "directory" },
5295
+ { in: "query", key: "workspace" }
4955
5296
  ]
4956
5297
  }
4957
5298
  ]);
4958
- return (options?.client ?? this.client).get({
4959
- url: "/api/provider/{providerID}",
5299
+ return (options?.client ?? this.client).post({
5300
+ url: "/tui/clear-prompt",
4960
5301
  ...options,
4961
5302
  ...params
4962
5303
  });
4963
5304
  }
4964
- };
4965
- var V2 = class extends HeyApiClient {
4966
- _session;
4967
- get session() {
4968
- return this._session ??= new Session3({ client: this.client });
4969
- }
4970
- _model;
4971
- get model() {
4972
- return this._model ??= new Model({ client: this.client });
4973
- }
4974
- _provider;
4975
- get provider() {
4976
- return this._provider ??= new Provider2({ client: this.client });
4977
- }
4978
- };
4979
- var Control = class extends HeyApiClient {
4980
5305
  /**
4981
- * Get next TUI request
5306
+ * Execute TUI command
4982
5307
  *
4983
- * Retrieve the next TUI request from the queue for processing.
5308
+ * Execute a TUI command.
4984
5309
  */
4985
- next(parameters, options) {
5310
+ executeCommand(parameters, options) {
4986
5311
  const params = buildClientParams([parameters], [
4987
5312
  {
4988
5313
  args: [
4989
5314
  { in: "query", key: "directory" },
4990
- { in: "query", key: "workspace" }
5315
+ { in: "query", key: "workspace" },
5316
+ { in: "body", key: "command" }
4991
5317
  ]
4992
5318
  }
4993
5319
  ]);
4994
- return (options?.client ?? this.client).get({
4995
- url: "/tui/control/next",
5320
+ return (options?.client ?? this.client).post({
5321
+ url: "/tui/execute-command",
4996
5322
  ...options,
4997
- ...params
5323
+ ...params,
5324
+ headers: {
5325
+ "Content-Type": "application/json",
5326
+ ...options?.headers,
5327
+ ...params.headers
5328
+ }
4998
5329
  });
4999
5330
  }
5000
5331
  /**
5001
- * Submit TUI response
5332
+ * Show TUI toast
5002
5333
  *
5003
- * Submit a response to the TUI request queue to complete a pending request.
5334
+ * Show a toast notification in the TUI.
5004
5335
  */
5005
- response(parameters, options) {
5336
+ showToast(parameters, options) {
5006
5337
  const params = buildClientParams([parameters], [
5007
5338
  {
5008
5339
  args: [
5009
5340
  { in: "query", key: "directory" },
5010
5341
  { in: "query", key: "workspace" },
5011
- { key: "body", map: "body" }
5342
+ { in: "body", key: "title" },
5343
+ { in: "body", key: "message" },
5344
+ { in: "body", key: "variant" },
5345
+ { in: "body", key: "duration" }
5012
5346
  ]
5013
5347
  }
5014
5348
  ]);
5015
5349
  return (options?.client ?? this.client).post({
5016
- url: "/tui/control/response",
5350
+ url: "/tui/show-toast",
5017
5351
  ...options,
5018
5352
  ...params,
5019
5353
  headers: {
@@ -5023,25 +5357,23 @@ var Control = class extends HeyApiClient {
5023
5357
  }
5024
5358
  });
5025
5359
  }
5026
- };
5027
- var Tui = class extends HeyApiClient {
5028
5360
  /**
5029
- * Append TUI prompt
5361
+ * Publish TUI event
5030
5362
  *
5031
- * Append prompt to the TUI.
5363
+ * Publish a TUI event.
5032
5364
  */
5033
- appendPrompt(parameters, options) {
5365
+ publish(parameters, options) {
5034
5366
  const params = buildClientParams([parameters], [
5035
5367
  {
5036
5368
  args: [
5037
5369
  { in: "query", key: "directory" },
5038
5370
  { in: "query", key: "workspace" },
5039
- { in: "body", key: "text" }
5371
+ { key: "body", map: "body" }
5040
5372
  ]
5041
5373
  }
5042
5374
  ]);
5043
5375
  return (options?.client ?? this.client).post({
5044
- url: "/tui/append-prompt",
5376
+ url: "/tui/publish",
5045
5377
  ...options,
5046
5378
  ...params,
5047
5379
  headers: {
@@ -5052,171 +5384,1210 @@ var Tui = class extends HeyApiClient {
5052
5384
  });
5053
5385
  }
5054
5386
  /**
5055
- * Open help dialog
5387
+ * Select session
5056
5388
  *
5057
- * Open the help dialog in the TUI to display user assistance information.
5389
+ * Navigate the TUI to display the specified session.
5058
5390
  */
5059
- openHelp(parameters, options) {
5391
+ selectSession(parameters, options) {
5060
5392
  const params = buildClientParams([parameters], [
5061
5393
  {
5062
5394
  args: [
5063
5395
  { in: "query", key: "directory" },
5064
- { in: "query", key: "workspace" }
5396
+ { in: "query", key: "workspace" },
5397
+ { in: "body", key: "sessionID" }
5065
5398
  ]
5066
5399
  }
5067
5400
  ]);
5068
5401
  return (options?.client ?? this.client).post({
5069
- url: "/tui/open-help",
5402
+ url: "/tui/select-session",
5403
+ ...options,
5404
+ ...params,
5405
+ headers: {
5406
+ "Content-Type": "application/json",
5407
+ ...options?.headers,
5408
+ ...params.headers
5409
+ }
5410
+ });
5411
+ }
5412
+ _control;
5413
+ get control() {
5414
+ return this._control ??= new Control({ client: this.client });
5415
+ }
5416
+ };
5417
+ var Health = class extends HeyApiClient {
5418
+ /**
5419
+ * Check server health
5420
+ *
5421
+ * Check whether the API server is ready to accept requests.
5422
+ */
5423
+ get(options) {
5424
+ return (options?.client ?? this.client).get({
5425
+ url: "/api/health",
5426
+ ...options
5427
+ });
5428
+ }
5429
+ };
5430
+ var Location = class extends HeyApiClient {
5431
+ /**
5432
+ * Get location
5433
+ *
5434
+ * Resolve the requested location or the server default location.
5435
+ */
5436
+ get(parameters, options) {
5437
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
5438
+ return (options?.client ?? this.client).get({
5439
+ url: "/api/location",
5070
5440
  ...options,
5071
5441
  ...params
5072
5442
  });
5073
5443
  }
5444
+ };
5445
+ var Agent = class extends HeyApiClient {
5074
5446
  /**
5075
- * Open sessions dialog
5447
+ * List agents
5076
5448
  *
5077
- * Open the session dialog.
5449
+ * Retrieve currently registered agents.
5078
5450
  */
5079
- openSessions(parameters, options) {
5451
+ list(parameters, options) {
5452
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
5453
+ return (options?.client ?? this.client).get({
5454
+ url: "/api/agent",
5455
+ ...options,
5456
+ ...params
5457
+ });
5458
+ }
5459
+ };
5460
+ var Revert = class extends HeyApiClient {
5461
+ /**
5462
+ * Stage session revert
5463
+ *
5464
+ * Stage or move a reversible session boundary and optionally apply its file changes.
5465
+ */
5466
+ stage(parameters, options) {
5080
5467
  const params = buildClientParams([parameters], [
5081
5468
  {
5082
5469
  args: [
5083
- { in: "query", key: "directory" },
5084
- { in: "query", key: "workspace" }
5470
+ { in: "path", key: "sessionID" },
5471
+ { in: "body", key: "messageID" },
5472
+ { in: "body", key: "files" }
5085
5473
  ]
5086
5474
  }
5087
5475
  ]);
5088
5476
  return (options?.client ?? this.client).post({
5089
- url: "/tui/open-sessions",
5477
+ url: "/api/session/{sessionID}/revert/stage",
5478
+ ...options,
5479
+ ...params,
5480
+ headers: {
5481
+ "Content-Type": "application/json",
5482
+ ...options?.headers,
5483
+ ...params.headers
5484
+ }
5485
+ });
5486
+ }
5487
+ /**
5488
+ * Clear staged revert
5489
+ */
5490
+ clear(parameters, options) {
5491
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5492
+ return (options?.client ?? this.client).post({
5493
+ url: "/api/session/{sessionID}/revert/clear",
5090
5494
  ...options,
5091
5495
  ...params
5092
5496
  });
5093
5497
  }
5094
5498
  /**
5095
- * Open themes dialog
5499
+ * Commit staged revert
5500
+ */
5501
+ commit(parameters, options) {
5502
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5503
+ return (options?.client ?? this.client).post({
5504
+ url: "/api/session/{sessionID}/revert/commit",
5505
+ ...options,
5506
+ ...params
5507
+ });
5508
+ }
5509
+ };
5510
+ var Permission2 = class extends HeyApiClient {
5511
+ /**
5512
+ * List session permission requests
5096
5513
  *
5097
- * Open the theme dialog.
5514
+ * Retrieve pending permission requests owned by a session.
5098
5515
  */
5099
- openThemes(parameters, options) {
5516
+ list(parameters, options) {
5517
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5518
+ return (options?.client ?? this.client).get({
5519
+ url: "/api/session/{sessionID}/permission",
5520
+ ...options,
5521
+ ...params
5522
+ });
5523
+ }
5524
+ /**
5525
+ * Create permission request
5526
+ *
5527
+ * Evaluate and, when approval is required, create a permission request for a session.
5528
+ */
5529
+ create(parameters, options) {
5530
+ const params = buildClientParams([parameters], [
5531
+ {
5532
+ args: [
5533
+ { in: "path", key: "sessionID" },
5534
+ { in: "body", key: "id" },
5535
+ { in: "body", key: "action" },
5536
+ { in: "body", key: "resources" },
5537
+ { in: "body", key: "save" },
5538
+ { in: "body", key: "metadata" },
5539
+ { in: "body", key: "source" },
5540
+ { in: "body", key: "agent" }
5541
+ ]
5542
+ }
5543
+ ]);
5544
+ return (options?.client ?? this.client).post({
5545
+ url: "/api/session/{sessionID}/permission",
5546
+ ...options,
5547
+ ...params,
5548
+ headers: {
5549
+ "Content-Type": "application/json",
5550
+ ...options?.headers,
5551
+ ...params.headers
5552
+ }
5553
+ });
5554
+ }
5555
+ /**
5556
+ * Get permission request
5557
+ *
5558
+ * Retrieve a pending permission request owned by a session.
5559
+ */
5560
+ get(parameters, options) {
5561
+ const params = buildClientParams([parameters], [
5562
+ {
5563
+ args: [
5564
+ { in: "path", key: "sessionID" },
5565
+ { in: "path", key: "requestID" }
5566
+ ]
5567
+ }
5568
+ ]);
5569
+ return (options?.client ?? this.client).get({
5570
+ url: "/api/session/{sessionID}/permission/{requestID}",
5571
+ ...options,
5572
+ ...params
5573
+ });
5574
+ }
5575
+ /**
5576
+ * Reply to pending permission request
5577
+ *
5578
+ * Respond to a pending permission request owned by a session.
5579
+ */
5580
+ reply(parameters, options) {
5581
+ const params = buildClientParams([parameters], [
5582
+ {
5583
+ args: [
5584
+ { in: "path", key: "sessionID" },
5585
+ { in: "path", key: "requestID" },
5586
+ { in: "body", key: "reply" },
5587
+ { in: "body", key: "message" }
5588
+ ]
5589
+ }
5590
+ ]);
5591
+ return (options?.client ?? this.client).post({
5592
+ url: "/api/session/{sessionID}/permission/{requestID}/reply",
5593
+ ...options,
5594
+ ...params,
5595
+ headers: {
5596
+ "Content-Type": "application/json",
5597
+ ...options?.headers,
5598
+ ...params.headers
5599
+ }
5600
+ });
5601
+ }
5602
+ };
5603
+ var Question2 = class extends HeyApiClient {
5604
+ /**
5605
+ * List session question requests
5606
+ *
5607
+ * Retrieve pending question requests owned by a session.
5608
+ */
5609
+ list(parameters, options) {
5610
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5611
+ return (options?.client ?? this.client).get({
5612
+ url: "/api/session/{sessionID}/question",
5613
+ ...options,
5614
+ ...params
5615
+ });
5616
+ }
5617
+ /**
5618
+ * Reply to pending question request
5619
+ *
5620
+ * Answer a pending question request owned by a session.
5621
+ */
5622
+ reply(parameters, options) {
5623
+ const params = buildClientParams([parameters], [
5624
+ {
5625
+ args: [
5626
+ { in: "path", key: "sessionID" },
5627
+ { in: "path", key: "requestID" },
5628
+ { key: "questionV2Reply", map: "body" }
5629
+ ]
5630
+ }
5631
+ ]);
5632
+ return (options?.client ?? this.client).post({
5633
+ url: "/api/session/{sessionID}/question/{requestID}/reply",
5634
+ ...options,
5635
+ ...params,
5636
+ headers: {
5637
+ "Content-Type": "application/json",
5638
+ ...options?.headers,
5639
+ ...params.headers
5640
+ }
5641
+ });
5642
+ }
5643
+ /**
5644
+ * Reject pending question request
5645
+ *
5646
+ * Reject a pending question request owned by a session.
5647
+ */
5648
+ reject(parameters, options) {
5649
+ const params = buildClientParams([parameters], [
5650
+ {
5651
+ args: [
5652
+ { in: "path", key: "sessionID" },
5653
+ { in: "path", key: "requestID" }
5654
+ ]
5655
+ }
5656
+ ]);
5657
+ return (options?.client ?? this.client).post({
5658
+ url: "/api/session/{sessionID}/question/{requestID}/reject",
5659
+ ...options,
5660
+ ...params
5661
+ });
5662
+ }
5663
+ };
5664
+ var Session3 = class extends HeyApiClient {
5665
+ /**
5666
+ * List sessions
5667
+ *
5668
+ * Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
5669
+ */
5670
+ list(parameters, options) {
5100
5671
  const params = buildClientParams([parameters], [
5101
5672
  {
5102
5673
  args: [
5674
+ { in: "query", key: "workspace" },
5675
+ { in: "query", key: "limit" },
5676
+ { in: "query", key: "order" },
5677
+ { in: "query", key: "search" },
5103
5678
  { in: "query", key: "directory" },
5104
- { in: "query", key: "workspace" }
5679
+ { in: "query", key: "project" },
5680
+ { in: "query", key: "subpath" },
5681
+ { in: "query", key: "cursor" }
5682
+ ]
5683
+ }
5684
+ ]);
5685
+ return (options?.client ?? this.client).get({
5686
+ url: "/api/session",
5687
+ ...options,
5688
+ ...params
5689
+ });
5690
+ }
5691
+ /**
5692
+ * Create session
5693
+ *
5694
+ * Create a session at the requested location.
5695
+ */
5696
+ create(parameters, options) {
5697
+ const params = buildClientParams([parameters], [
5698
+ {
5699
+ args: [
5700
+ { in: "body", key: "id" },
5701
+ { in: "body", key: "agent" },
5702
+ { in: "body", key: "model" },
5703
+ { in: "body", key: "location" }
5704
+ ]
5705
+ }
5706
+ ]);
5707
+ return (options?.client ?? this.client).post({
5708
+ url: "/api/session",
5709
+ ...options,
5710
+ ...params,
5711
+ headers: {
5712
+ "Content-Type": "application/json",
5713
+ ...options?.headers,
5714
+ ...params.headers
5715
+ }
5716
+ });
5717
+ }
5718
+ /**
5719
+ * List active sessions
5720
+ *
5721
+ * Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.
5722
+ */
5723
+ active(options) {
5724
+ return (options?.client ?? this.client).get({
5725
+ url: "/api/session/active",
5726
+ ...options
5727
+ });
5728
+ }
5729
+ /**
5730
+ * Get session
5731
+ *
5732
+ * Retrieve a session by ID.
5733
+ */
5734
+ get(parameters, options) {
5735
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5736
+ return (options?.client ?? this.client).get({
5737
+ url: "/api/session/{sessionID}",
5738
+ ...options,
5739
+ ...params
5740
+ });
5741
+ }
5742
+ /**
5743
+ * Switch session agent
5744
+ *
5745
+ * Switch the agent used by subsequent provider turns.
5746
+ */
5747
+ switchAgent(parameters, options) {
5748
+ const params = buildClientParams([parameters], [
5749
+ {
5750
+ args: [
5751
+ { in: "path", key: "sessionID" },
5752
+ { in: "body", key: "agent" }
5753
+ ]
5754
+ }
5755
+ ]);
5756
+ return (options?.client ?? this.client).post({
5757
+ url: "/api/session/{sessionID}/agent",
5758
+ ...options,
5759
+ ...params,
5760
+ headers: {
5761
+ "Content-Type": "application/json",
5762
+ ...options?.headers,
5763
+ ...params.headers
5764
+ }
5765
+ });
5766
+ }
5767
+ /**
5768
+ * Switch session model
5769
+ *
5770
+ * Switch the model used by subsequent provider turns.
5771
+ */
5772
+ switchModel(parameters, options) {
5773
+ const params = buildClientParams([parameters], [
5774
+ {
5775
+ args: [
5776
+ { in: "path", key: "sessionID" },
5777
+ { in: "body", key: "model" }
5778
+ ]
5779
+ }
5780
+ ]);
5781
+ return (options?.client ?? this.client).post({
5782
+ url: "/api/session/{sessionID}/model",
5783
+ ...options,
5784
+ ...params,
5785
+ headers: {
5786
+ "Content-Type": "application/json",
5787
+ ...options?.headers,
5788
+ ...params.headers
5789
+ }
5790
+ });
5791
+ }
5792
+ /**
5793
+ * Send message
5794
+ *
5795
+ * Durably admit one session input and schedule agent-loop execution unless resume is false.
5796
+ */
5797
+ prompt(parameters, options) {
5798
+ const params = buildClientParams([parameters], [
5799
+ {
5800
+ args: [
5801
+ { in: "path", key: "sessionID" },
5802
+ { in: "body", key: "id" },
5803
+ { in: "body", key: "prompt" },
5804
+ { in: "body", key: "delivery" },
5805
+ { in: "body", key: "resume" }
5806
+ ]
5807
+ }
5808
+ ]);
5809
+ return (options?.client ?? this.client).post({
5810
+ url: "/api/session/{sessionID}/prompt",
5811
+ ...options,
5812
+ ...params,
5813
+ headers: {
5814
+ "Content-Type": "application/json",
5815
+ ...options?.headers,
5816
+ ...params.headers
5817
+ }
5818
+ });
5819
+ }
5820
+ /**
5821
+ * Compact session
5822
+ *
5823
+ * Compact a session conversation.
5824
+ */
5825
+ compact(parameters, options) {
5826
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5827
+ return (options?.client ?? this.client).post({
5828
+ url: "/api/session/{sessionID}/compact",
5829
+ ...options,
5830
+ ...params
5831
+ });
5832
+ }
5833
+ /**
5834
+ * Wait for session
5835
+ *
5836
+ * Wait for a session agent loop to become idle.
5837
+ */
5838
+ wait(parameters, options) {
5839
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5840
+ return (options?.client ?? this.client).post({
5841
+ url: "/api/session/{sessionID}/wait",
5842
+ ...options,
5843
+ ...params
5844
+ });
5845
+ }
5846
+ /**
5847
+ * Get session context
5848
+ *
5849
+ * Retrieve the active context messages for a session (all messages after the last compaction).
5850
+ */
5851
+ context(parameters, options) {
5852
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5853
+ return (options?.client ?? this.client).get({
5854
+ url: "/api/session/{sessionID}/context",
5855
+ ...options,
5856
+ ...params
5857
+ });
5858
+ }
5859
+ /**
5860
+ * Get session history
5861
+ *
5862
+ * Read one finite page of public durable Session events after an exclusive aggregate sequence. Newly committed events may appear on later pages.
5863
+ */
5864
+ history(parameters, options) {
5865
+ const params = buildClientParams([parameters], [
5866
+ {
5867
+ args: [
5868
+ { in: "path", key: "sessionID" },
5869
+ { in: "query", key: "limit" },
5870
+ { in: "query", key: "after" }
5871
+ ]
5872
+ }
5873
+ ]);
5874
+ return (options?.client ?? this.client).get({
5875
+ url: "/api/session/{sessionID}/history",
5876
+ ...options,
5877
+ ...params
5878
+ });
5879
+ }
5880
+ /**
5881
+ * Subscribe to session events
5882
+ *
5883
+ * Replay durable events after an aggregate sequence, then continue with new durable events.
5884
+ */
5885
+ events(parameters, options) {
5886
+ const params = buildClientParams([parameters], [
5887
+ {
5888
+ args: [
5889
+ { in: "path", key: "sessionID" },
5890
+ { in: "query", key: "after" }
5891
+ ]
5892
+ }
5893
+ ]);
5894
+ return (options?.client ?? this.client).sse.get({
5895
+ url: "/api/session/{sessionID}/event",
5896
+ ...options,
5897
+ ...params
5898
+ });
5899
+ }
5900
+ /**
5901
+ * Interrupt session execution
5902
+ *
5903
+ * Interrupt active execution owned by this OpenCode process. Idle interruption is a no-op.
5904
+ */
5905
+ interrupt(parameters, options) {
5906
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }]);
5907
+ return (options?.client ?? this.client).post({
5908
+ url: "/api/session/{sessionID}/interrupt",
5909
+ ...options,
5910
+ ...params
5911
+ });
5912
+ }
5913
+ /**
5914
+ * Get session message
5915
+ *
5916
+ * Retrieve one projected message owned by the Session.
5917
+ */
5918
+ message(parameters, options) {
5919
+ const params = buildClientParams([parameters], [
5920
+ {
5921
+ args: [
5922
+ { in: "path", key: "sessionID" },
5923
+ { in: "path", key: "messageID" }
5924
+ ]
5925
+ }
5926
+ ]);
5927
+ return (options?.client ?? this.client).get({
5928
+ url: "/api/session/{sessionID}/message/{messageID}",
5929
+ ...options,
5930
+ ...params
5931
+ });
5932
+ }
5933
+ /**
5934
+ * Get session messages
5935
+ *
5936
+ * Retrieve projected messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.
5937
+ */
5938
+ messages(parameters, options) {
5939
+ const params = buildClientParams([parameters], [
5940
+ {
5941
+ args: [
5942
+ { in: "path", key: "sessionID" },
5943
+ { in: "query", key: "limit" },
5944
+ { in: "query", key: "order" },
5945
+ { in: "query", key: "cursor" }
5946
+ ]
5947
+ }
5948
+ ]);
5949
+ return (options?.client ?? this.client).get({
5950
+ url: "/api/session/{sessionID}/message",
5951
+ ...options,
5952
+ ...params
5953
+ });
5954
+ }
5955
+ _revert;
5956
+ get revert() {
5957
+ return this._revert ??= new Revert({ client: this.client });
5958
+ }
5959
+ _permission;
5960
+ get permission() {
5961
+ return this._permission ??= new Permission2({ client: this.client });
5962
+ }
5963
+ _question;
5964
+ get question() {
5965
+ return this._question ??= new Question2({ client: this.client });
5966
+ }
5967
+ };
5968
+ var Model = class extends HeyApiClient {
5969
+ /**
5970
+ * List models
5971
+ *
5972
+ * Retrieve available models ordered by release date.
5973
+ */
5974
+ list(parameters, options) {
5975
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
5976
+ return (options?.client ?? this.client).get({
5977
+ url: "/api/model",
5978
+ ...options,
5979
+ ...params
5980
+ });
5981
+ }
5982
+ };
5983
+ var Provider2 = class extends HeyApiClient {
5984
+ /**
5985
+ * List providers
5986
+ *
5987
+ * Retrieve active AI providers so clients can show provider availability and configuration.
5988
+ */
5989
+ list(parameters, options) {
5990
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
5991
+ return (options?.client ?? this.client).get({
5992
+ url: "/api/provider",
5993
+ ...options,
5994
+ ...params
5995
+ });
5996
+ }
5997
+ /**
5998
+ * Get provider
5999
+ *
6000
+ * Retrieve a single AI provider so clients can inspect its availability and endpoint settings.
6001
+ */
6002
+ get(parameters, options) {
6003
+ const params = buildClientParams([parameters], [
6004
+ {
6005
+ args: [
6006
+ { in: "path", key: "providerID" },
6007
+ { in: "query", key: "location" }
6008
+ ]
6009
+ }
6010
+ ]);
6011
+ return (options?.client ?? this.client).get({
6012
+ url: "/api/provider/{providerID}",
6013
+ ...options,
6014
+ ...params
6015
+ });
6016
+ }
6017
+ };
6018
+ var Connect = class extends HeyApiClient {
6019
+ /**
6020
+ * Connect with key
6021
+ *
6022
+ * Run a key authentication method and store the resulting credential.
6023
+ */
6024
+ key(parameters, options) {
6025
+ const params = buildClientParams([parameters], [
6026
+ {
6027
+ args: [
6028
+ { in: "path", key: "integrationID" },
6029
+ { in: "query", key: "location" },
6030
+ { in: "body", key: "key" },
6031
+ { in: "body", key: "label" }
6032
+ ]
6033
+ }
6034
+ ]);
6035
+ return (options?.client ?? this.client).post({
6036
+ url: "/api/integration/{integrationID}/connect/key",
6037
+ ...options,
6038
+ ...params,
6039
+ headers: {
6040
+ "Content-Type": "application/json",
6041
+ ...options?.headers,
6042
+ ...params.headers
6043
+ }
6044
+ });
6045
+ }
6046
+ /**
6047
+ * Begin OAuth connection
6048
+ *
6049
+ * Start an OAuth attempt and return the authorization details.
6050
+ */
6051
+ oauth(parameters, options) {
6052
+ const params = buildClientParams([parameters], [
6053
+ {
6054
+ args: [
6055
+ { in: "path", key: "integrationID" },
6056
+ { in: "query", key: "location" },
6057
+ { in: "body", key: "methodID" },
6058
+ { in: "body", key: "inputs" },
6059
+ { in: "body", key: "label" }
6060
+ ]
6061
+ }
6062
+ ]);
6063
+ return (options?.client ?? this.client).post({
6064
+ url: "/api/integration/{integrationID}/connect/oauth",
6065
+ ...options,
6066
+ ...params,
6067
+ headers: {
6068
+ "Content-Type": "application/json",
6069
+ ...options?.headers,
6070
+ ...params.headers
6071
+ }
6072
+ });
6073
+ }
6074
+ };
6075
+ var Attempt = class extends HeyApiClient {
6076
+ /**
6077
+ * Cancel OAuth connection
6078
+ *
6079
+ * Cancel an OAuth attempt and release its resources.
6080
+ */
6081
+ cancel(parameters, options) {
6082
+ const params = buildClientParams([parameters], [
6083
+ {
6084
+ args: [
6085
+ { in: "path", key: "attemptID" },
6086
+ { in: "query", key: "location" }
6087
+ ]
6088
+ }
6089
+ ]);
6090
+ return (options?.client ?? this.client).delete({
6091
+ url: "/api/integration/attempt/{attemptID}",
6092
+ ...options,
6093
+ ...params
6094
+ });
6095
+ }
6096
+ /**
6097
+ * Get OAuth attempt status
6098
+ *
6099
+ * Poll the current status of an OAuth attempt.
6100
+ */
6101
+ status(parameters, options) {
6102
+ const params = buildClientParams([parameters], [
6103
+ {
6104
+ args: [
6105
+ { in: "path", key: "attemptID" },
6106
+ { in: "query", key: "location" }
6107
+ ]
6108
+ }
6109
+ ]);
6110
+ return (options?.client ?? this.client).get({
6111
+ url: "/api/integration/attempt/{attemptID}",
6112
+ ...options,
6113
+ ...params
6114
+ });
6115
+ }
6116
+ /**
6117
+ * Complete OAuth connection
6118
+ *
6119
+ * Complete a code-based OAuth attempt and store the resulting credential.
6120
+ */
6121
+ complete(parameters, options) {
6122
+ const params = buildClientParams([parameters], [
6123
+ {
6124
+ args: [
6125
+ { in: "path", key: "attemptID" },
6126
+ { in: "query", key: "location" },
6127
+ { in: "body", key: "code" }
6128
+ ]
6129
+ }
6130
+ ]);
6131
+ return (options?.client ?? this.client).post({
6132
+ url: "/api/integration/attempt/{attemptID}/complete",
6133
+ ...options,
6134
+ ...params,
6135
+ headers: {
6136
+ "Content-Type": "application/json",
6137
+ ...options?.headers,
6138
+ ...params.headers
6139
+ }
6140
+ });
6141
+ }
6142
+ };
6143
+ var Integration = class extends HeyApiClient {
6144
+ /**
6145
+ * List integrations
6146
+ *
6147
+ * Retrieve available integrations and their authentication methods.
6148
+ */
6149
+ list(parameters, options) {
6150
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6151
+ return (options?.client ?? this.client).get({
6152
+ url: "/api/integration",
6153
+ ...options,
6154
+ ...params
6155
+ });
6156
+ }
6157
+ /**
6158
+ * Get integration
6159
+ *
6160
+ * Retrieve one integration and its authentication methods.
6161
+ */
6162
+ get(parameters, options) {
6163
+ const params = buildClientParams([parameters], [
6164
+ {
6165
+ args: [
6166
+ { in: "path", key: "integrationID" },
6167
+ { in: "query", key: "location" }
6168
+ ]
6169
+ }
6170
+ ]);
6171
+ return (options?.client ?? this.client).get({
6172
+ url: "/api/integration/{integrationID}",
6173
+ ...options,
6174
+ ...params
6175
+ });
6176
+ }
6177
+ _connect;
6178
+ get connect() {
6179
+ return this._connect ??= new Connect({ client: this.client });
6180
+ }
6181
+ _attempt;
6182
+ get attempt() {
6183
+ return this._attempt ??= new Attempt({ client: this.client });
6184
+ }
6185
+ };
6186
+ var Credential = class extends HeyApiClient {
6187
+ /**
6188
+ * Remove credential
6189
+ *
6190
+ * Remove a stored integration credential.
6191
+ */
6192
+ remove(parameters, options) {
6193
+ const params = buildClientParams([parameters], [
6194
+ {
6195
+ args: [
6196
+ { in: "path", key: "credentialID" },
6197
+ { in: "query", key: "location" }
6198
+ ]
6199
+ }
6200
+ ]);
6201
+ return (options?.client ?? this.client).delete({
6202
+ url: "/api/credential/{credentialID}",
6203
+ ...options,
6204
+ ...params
6205
+ });
6206
+ }
6207
+ /**
6208
+ * Update credential
6209
+ *
6210
+ * Update a stored credential label.
6211
+ */
6212
+ update(parameters, options) {
6213
+ const params = buildClientParams([parameters], [
6214
+ {
6215
+ args: [
6216
+ { in: "path", key: "credentialID" },
6217
+ { in: "query", key: "location" },
6218
+ { in: "body", key: "label" }
6219
+ ]
6220
+ }
6221
+ ]);
6222
+ return (options?.client ?? this.client).patch({
6223
+ url: "/api/credential/{credentialID}",
6224
+ ...options,
6225
+ ...params,
6226
+ headers: {
6227
+ "Content-Type": "application/json",
6228
+ ...options?.headers,
6229
+ ...params.headers
6230
+ }
6231
+ });
6232
+ }
6233
+ };
6234
+ var Request2 = class extends HeyApiClient {
6235
+ /**
6236
+ * List pending permission requests
6237
+ *
6238
+ * Retrieve pending permission requests for a location.
6239
+ */
6240
+ list(parameters, options) {
6241
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6242
+ return (options?.client ?? this.client).get({
6243
+ url: "/api/permission/request",
6244
+ ...options,
6245
+ ...params
6246
+ });
6247
+ }
6248
+ };
6249
+ var Saved = class extends HeyApiClient {
6250
+ /**
6251
+ * List saved permissions
6252
+ *
6253
+ * Retrieve saved permissions, optionally filtered by project.
6254
+ */
6255
+ list(parameters, options) {
6256
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "projectID" }] }]);
6257
+ return (options?.client ?? this.client).get({
6258
+ url: "/api/permission/saved",
6259
+ ...options,
6260
+ ...params
6261
+ });
6262
+ }
6263
+ /**
6264
+ * Remove saved permission
6265
+ *
6266
+ * Remove a saved permission by ID.
6267
+ */
6268
+ remove(parameters, options) {
6269
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
6270
+ return (options?.client ?? this.client).delete({
6271
+ url: "/api/permission/saved/{id}",
6272
+ ...options,
6273
+ ...params
6274
+ });
6275
+ }
6276
+ };
6277
+ var Permission3 = class extends HeyApiClient {
6278
+ _request;
6279
+ get request() {
6280
+ return this._request ??= new Request2({ client: this.client });
6281
+ }
6282
+ _saved;
6283
+ get saved() {
6284
+ return this._saved ??= new Saved({ client: this.client });
6285
+ }
6286
+ };
6287
+ var Fs = class extends HeyApiClient {
6288
+ /**
6289
+ * Read file
6290
+ *
6291
+ * Serve one file relative to the requested location.
6292
+ */
6293
+ read(parameters, options) {
6294
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6295
+ return (options?.client ?? this.client).get({
6296
+ url: "/api/fs/read/*",
6297
+ ...options,
6298
+ ...params
6299
+ });
6300
+ }
6301
+ /**
6302
+ * List directory
6303
+ *
6304
+ * List direct children of one directory relative to the requested location.
6305
+ */
6306
+ list(parameters, options) {
6307
+ const params = buildClientParams([parameters], [
6308
+ {
6309
+ args: [
6310
+ { in: "query", key: "location" },
6311
+ { in: "query", key: "path" }
6312
+ ]
6313
+ }
6314
+ ]);
6315
+ return (options?.client ?? this.client).get({
6316
+ url: "/api/fs/list",
6317
+ ...options,
6318
+ ...params
6319
+ });
6320
+ }
6321
+ /**
6322
+ * Find files
6323
+ *
6324
+ * Find recursively ranked filesystem entries relative to the requested location.
6325
+ */
6326
+ find(parameters, options) {
6327
+ const params = buildClientParams([parameters], [
6328
+ {
6329
+ args: [
6330
+ { in: "query", key: "location" },
6331
+ { in: "query", key: "query" },
6332
+ { in: "query", key: "type" },
6333
+ { in: "query", key: "limit" }
6334
+ ]
6335
+ }
6336
+ ]);
6337
+ return (options?.client ?? this.client).get({
6338
+ url: "/api/fs/find",
6339
+ ...options,
6340
+ ...params
6341
+ });
6342
+ }
6343
+ };
6344
+ var Command2 = class extends HeyApiClient {
6345
+ /**
6346
+ * List commands
6347
+ *
6348
+ * Retrieve currently registered commands.
6349
+ */
6350
+ list(parameters, options) {
6351
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6352
+ return (options?.client ?? this.client).get({
6353
+ url: "/api/command",
6354
+ ...options,
6355
+ ...params
6356
+ });
6357
+ }
6358
+ };
6359
+ var Skill = class extends HeyApiClient {
6360
+ /**
6361
+ * List skills
6362
+ *
6363
+ * Retrieve currently registered skills.
6364
+ */
6365
+ list(parameters, options) {
6366
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6367
+ return (options?.client ?? this.client).get({
6368
+ url: "/api/skill",
6369
+ ...options,
6370
+ ...params
6371
+ });
6372
+ }
6373
+ };
6374
+ var Event2 = class extends HeyApiClient {
6375
+ /**
6376
+ * Subscribe to events
6377
+ *
6378
+ * Subscribe to native event payloads for the server.
6379
+ */
6380
+ subscribe(options) {
6381
+ return (options?.client ?? this.client).sse.get({
6382
+ url: "/api/event",
6383
+ ...options
6384
+ });
6385
+ }
6386
+ };
6387
+ var Pty2 = class extends HeyApiClient {
6388
+ /**
6389
+ * List PTY sessions
6390
+ *
6391
+ * List PTY sessions for a location, including exited sessions retained until removal.
6392
+ */
6393
+ list(parameters, options) {
6394
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6395
+ return (options?.client ?? this.client).get({
6396
+ url: "/api/pty",
6397
+ ...options,
6398
+ ...params
6399
+ });
6400
+ }
6401
+ /**
6402
+ * Create PTY session
6403
+ *
6404
+ * Create a pseudo-terminal session for a location.
6405
+ */
6406
+ create(parameters, options) {
6407
+ const params = buildClientParams([parameters], [
6408
+ {
6409
+ args: [
6410
+ { in: "query", key: "location" },
6411
+ { in: "body", key: "command" },
6412
+ { in: "body", key: "args" },
6413
+ { in: "body", key: "cwd" },
6414
+ { in: "body", key: "title" },
6415
+ { in: "body", key: "env" }
6416
+ ]
6417
+ }
6418
+ ]);
6419
+ return (options?.client ?? this.client).post({
6420
+ url: "/api/pty",
6421
+ ...options,
6422
+ ...params,
6423
+ headers: {
6424
+ "Content-Type": "application/json",
6425
+ ...options?.headers,
6426
+ ...params.headers
6427
+ }
6428
+ });
6429
+ }
6430
+ /**
6431
+ * Remove PTY session
6432
+ *
6433
+ * Terminate and remove one PTY session.
6434
+ */
6435
+ remove(parameters, options) {
6436
+ const params = buildClientParams([parameters], [
6437
+ {
6438
+ args: [
6439
+ { in: "path", key: "ptyID" },
6440
+ { in: "query", key: "location" }
6441
+ ]
6442
+ }
6443
+ ]);
6444
+ return (options?.client ?? this.client).delete({
6445
+ url: "/api/pty/{ptyID}",
6446
+ ...options,
6447
+ ...params
6448
+ });
6449
+ }
6450
+ /**
6451
+ * Get PTY session
6452
+ *
6453
+ * Get one PTY session, including its exit code once exited.
6454
+ */
6455
+ get(parameters, options) {
6456
+ const params = buildClientParams([parameters], [
6457
+ {
6458
+ args: [
6459
+ { in: "path", key: "ptyID" },
6460
+ { in: "query", key: "location" }
5105
6461
  ]
5106
6462
  }
5107
6463
  ]);
5108
- return (options?.client ?? this.client).post({
5109
- url: "/tui/open-themes",
6464
+ return (options?.client ?? this.client).get({
6465
+ url: "/api/pty/{ptyID}",
5110
6466
  ...options,
5111
6467
  ...params
5112
6468
  });
5113
6469
  }
5114
6470
  /**
5115
- * Open models dialog
6471
+ * Update PTY session
5116
6472
  *
5117
- * Open the model dialog.
6473
+ * Update the title or viewport size of one PTY session.
5118
6474
  */
5119
- openModels(parameters, options) {
6475
+ update(parameters, options) {
5120
6476
  const params = buildClientParams([parameters], [
5121
6477
  {
5122
6478
  args: [
5123
- { in: "query", key: "directory" },
5124
- { in: "query", key: "workspace" }
6479
+ { in: "path", key: "ptyID" },
6480
+ { in: "query", key: "location" },
6481
+ { in: "body", key: "title" },
6482
+ { in: "body", key: "size" }
5125
6483
  ]
5126
6484
  }
5127
6485
  ]);
5128
- return (options?.client ?? this.client).post({
5129
- url: "/tui/open-models",
6486
+ return (options?.client ?? this.client).put({
6487
+ url: "/api/pty/{ptyID}",
5130
6488
  ...options,
5131
- ...params
6489
+ ...params,
6490
+ headers: {
6491
+ "Content-Type": "application/json",
6492
+ ...options?.headers,
6493
+ ...params.headers
6494
+ }
5132
6495
  });
5133
6496
  }
5134
6497
  /**
5135
- * Submit TUI prompt
6498
+ * Create PTY WebSocket token
5136
6499
  *
5137
- * Submit the prompt.
6500
+ * Create a short-lived single-use ticket for opening a PTY WebSocket connection.
5138
6501
  */
5139
- submitPrompt(parameters, options) {
6502
+ connectToken(parameters, options) {
5140
6503
  const params = buildClientParams([parameters], [
5141
6504
  {
5142
6505
  args: [
5143
- { in: "query", key: "directory" },
5144
- { in: "query", key: "workspace" }
6506
+ { in: "path", key: "ptyID" },
6507
+ { in: "query", key: "location" }
5145
6508
  ]
5146
6509
  }
5147
6510
  ]);
5148
6511
  return (options?.client ?? this.client).post({
5149
- url: "/tui/submit-prompt",
6512
+ url: "/api/pty/{ptyID}/connect-token",
5150
6513
  ...options,
5151
6514
  ...params
5152
6515
  });
5153
6516
  }
5154
6517
  /**
5155
- * Clear TUI prompt
6518
+ * Connect to PTY session
5156
6519
  *
5157
- * Clear the prompt.
6520
+ * Establish a WebSocket connection streaming PTY output and accepting terminal input.
5158
6521
  */
5159
- clearPrompt(parameters, options) {
6522
+ connect(parameters, options) {
5160
6523
  const params = buildClientParams([parameters], [
5161
6524
  {
5162
6525
  args: [
5163
- { in: "query", key: "directory" },
5164
- { in: "query", key: "workspace" }
6526
+ { in: "path", key: "ptyID" },
6527
+ { in: "query", key: "location[directory]" },
6528
+ { in: "query", key: "location[workspace]" },
6529
+ { in: "query", key: "cursor" },
6530
+ { in: "query", key: "ticket" }
5165
6531
  ]
5166
6532
  }
5167
6533
  ]);
5168
- return (options?.client ?? this.client).post({
5169
- url: "/tui/clear-prompt",
6534
+ return (options?.client ?? this.client).get({
6535
+ url: "/api/pty/{ptyID}/connect",
5170
6536
  ...options,
5171
6537
  ...params
5172
6538
  });
5173
6539
  }
6540
+ };
6541
+ var Request22 = class extends HeyApiClient {
5174
6542
  /**
5175
- * Execute TUI command
6543
+ * List pending question requests
5176
6544
  *
5177
- * Execute a TUI command.
6545
+ * Retrieve pending question requests for a location.
5178
6546
  */
5179
- executeCommand(parameters, options) {
5180
- const params = buildClientParams([parameters], [
5181
- {
5182
- args: [
5183
- { in: "query", key: "directory" },
5184
- { in: "query", key: "workspace" },
5185
- { in: "body", key: "command" }
5186
- ]
5187
- }
5188
- ]);
5189
- return (options?.client ?? this.client).post({
5190
- url: "/tui/execute-command",
6547
+ list(parameters, options) {
6548
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6549
+ return (options?.client ?? this.client).get({
6550
+ url: "/api/question/request",
5191
6551
  ...options,
5192
- ...params,
5193
- headers: {
5194
- "Content-Type": "application/json",
5195
- ...options?.headers,
5196
- ...params.headers
5197
- }
6552
+ ...params
5198
6553
  });
5199
6554
  }
6555
+ };
6556
+ var Question3 = class extends HeyApiClient {
6557
+ _request;
6558
+ get request() {
6559
+ return this._request ??= new Request22({ client: this.client });
6560
+ }
6561
+ };
6562
+ var Reference = class extends HeyApiClient {
5200
6563
  /**
5201
- * Show TUI toast
6564
+ * List references
5202
6565
  *
5203
- * Show a toast notification in the TUI.
6566
+ * List references available in the requested location.
5204
6567
  */
5205
- showToast(parameters, options) {
6568
+ list(parameters, options) {
6569
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]);
6570
+ return (options?.client ?? this.client).get({
6571
+ url: "/api/reference",
6572
+ ...options,
6573
+ ...params
6574
+ });
6575
+ }
6576
+ };
6577
+ var ProjectCopy2 = class extends HeyApiClient {
6578
+ remove(parameters, options) {
5206
6579
  const params = buildClientParams([parameters], [
5207
6580
  {
5208
6581
  args: [
5209
- { in: "query", key: "directory" },
5210
- { in: "query", key: "workspace" },
5211
- { in: "body", key: "title" },
5212
- { in: "body", key: "message" },
5213
- { in: "body", key: "variant" },
5214
- { in: "body", key: "duration" }
6582
+ { in: "path", key: "projectID" },
6583
+ { in: "query", key: "location" },
6584
+ { in: "body", key: "directory" },
6585
+ { in: "body", key: "force" }
5215
6586
  ]
5216
6587
  }
5217
6588
  ]);
5218
- return (options?.client ?? this.client).post({
5219
- url: "/tui/show-toast",
6589
+ return (options?.client ?? this.client).delete({
6590
+ url: "/experimental/project/{projectID}/copy",
5220
6591
  ...options,
5221
6592
  ...params,
5222
6593
  headers: {
@@ -5226,23 +6597,20 @@ var Tui = class extends HeyApiClient {
5226
6597
  }
5227
6598
  });
5228
6599
  }
5229
- /**
5230
- * Publish TUI event
5231
- *
5232
- * Publish a TUI event.
5233
- */
5234
- publish(parameters, options) {
6600
+ create(parameters, options) {
5235
6601
  const params = buildClientParams([parameters], [
5236
6602
  {
5237
6603
  args: [
5238
- { in: "query", key: "directory" },
5239
- { in: "query", key: "workspace" },
5240
- { key: "body", map: "body" }
6604
+ { in: "path", key: "projectID" },
6605
+ { in: "query", key: "location" },
6606
+ { in: "body", key: "strategy" },
6607
+ { in: "body", key: "directory" },
6608
+ { in: "body", key: "name" }
5241
6609
  ]
5242
6610
  }
5243
6611
  ]);
5244
6612
  return (options?.client ?? this.client).post({
5245
- url: "/tui/publish",
6613
+ url: "/experimental/project/{projectID}/copy",
5246
6614
  ...options,
5247
6615
  ...params,
5248
6616
  headers: {
@@ -5252,35 +6620,90 @@ var Tui = class extends HeyApiClient {
5252
6620
  }
5253
6621
  });
5254
6622
  }
5255
- /**
5256
- * Select session
5257
- *
5258
- * Navigate the TUI to display the specified session.
5259
- */
5260
- selectSession(parameters, options) {
6623
+ refresh(parameters, options) {
5261
6624
  const params = buildClientParams([parameters], [
5262
6625
  {
5263
6626
  args: [
5264
- { in: "query", key: "directory" },
5265
- { in: "query", key: "workspace" },
5266
- { in: "body", key: "sessionID" }
6627
+ { in: "path", key: "projectID" },
6628
+ { in: "query", key: "location" }
5267
6629
  ]
5268
6630
  }
5269
6631
  ]);
5270
6632
  return (options?.client ?? this.client).post({
5271
- url: "/tui/select-session",
6633
+ url: "/experimental/project/{projectID}/copy/refresh",
5272
6634
  ...options,
5273
- ...params,
5274
- headers: {
5275
- "Content-Type": "application/json",
5276
- ...options?.headers,
5277
- ...params.headers
5278
- }
6635
+ ...params
5279
6636
  });
5280
6637
  }
5281
- _control;
5282
- get control() {
5283
- return this._control ??= new Control({ client: this.client });
6638
+ };
6639
+ var V2 = class extends HeyApiClient {
6640
+ _health;
6641
+ get health() {
6642
+ return this._health ??= new Health({ client: this.client });
6643
+ }
6644
+ _location;
6645
+ get location() {
6646
+ return this._location ??= new Location({ client: this.client });
6647
+ }
6648
+ _agent;
6649
+ get agent() {
6650
+ return this._agent ??= new Agent({ client: this.client });
6651
+ }
6652
+ _session;
6653
+ get session() {
6654
+ return this._session ??= new Session3({ client: this.client });
6655
+ }
6656
+ _model;
6657
+ get model() {
6658
+ return this._model ??= new Model({ client: this.client });
6659
+ }
6660
+ _provider;
6661
+ get provider() {
6662
+ return this._provider ??= new Provider2({ client: this.client });
6663
+ }
6664
+ _integration;
6665
+ get integration() {
6666
+ return this._integration ??= new Integration({ client: this.client });
6667
+ }
6668
+ _credential;
6669
+ get credential() {
6670
+ return this._credential ??= new Credential({ client: this.client });
6671
+ }
6672
+ _permission;
6673
+ get permission() {
6674
+ return this._permission ??= new Permission3({ client: this.client });
6675
+ }
6676
+ _fs;
6677
+ get fs() {
6678
+ return this._fs ??= new Fs({ client: this.client });
6679
+ }
6680
+ _command;
6681
+ get command() {
6682
+ return this._command ??= new Command2({ client: this.client });
6683
+ }
6684
+ _skill;
6685
+ get skill() {
6686
+ return this._skill ??= new Skill({ client: this.client });
6687
+ }
6688
+ _event;
6689
+ get event() {
6690
+ return this._event ??= new Event2({ client: this.client });
6691
+ }
6692
+ _pty;
6693
+ get pty() {
6694
+ return this._pty ??= new Pty2({ client: this.client });
6695
+ }
6696
+ _question;
6697
+ get question() {
6698
+ return this._question ??= new Question3({ client: this.client });
6699
+ }
6700
+ _reference;
6701
+ get reference() {
6702
+ return this._reference ??= new Reference({ client: this.client });
6703
+ }
6704
+ _projectCopy;
6705
+ get projectCopy() {
6706
+ return this._projectCopy ??= new ProjectCopy2({ client: this.client });
5284
6707
  }
5285
6708
  };
5286
6709
  var OpencodeClient = class _OpencodeClient extends HeyApiClient {
@@ -5297,6 +6720,10 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
5297
6720
  get app() {
5298
6721
  return this._app ??= new App({ client: this.client });
5299
6722
  }
6723
+ _experimental;
6724
+ get experimental() {
6725
+ return this._experimental ??= new Experimental({ client: this.client });
6726
+ }
5300
6727
  _global;
5301
6728
  get global() {
5302
6729
  return this._global ??= new Global({ client: this.client });
@@ -5309,10 +6736,6 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
5309
6736
  get config() {
5310
6737
  return this._config ??= new Config2({ client: this.client });
5311
6738
  }
5312
- _experimental;
5313
- get experimental() {
5314
- return this._experimental ??= new Experimental({ client: this.client });
5315
- }
5316
6739
  _tool;
5317
6740
  get tool() {
5318
6741
  return this._tool ??= new Tool({ client: this.client });
@@ -5389,17 +6812,17 @@ var OpencodeClient = class _OpencodeClient extends HeyApiClient {
5389
6812
  get sync() {
5390
6813
  return this._sync ??= new Sync({ client: this.client });
5391
6814
  }
5392
- _v2;
5393
- get v2() {
5394
- return this._v2 ??= new V2({ client: this.client });
5395
- }
5396
6815
  _tui;
5397
6816
  get tui() {
5398
6817
  return this._tui ??= new Tui({ client: this.client });
5399
6818
  }
6819
+ _v2;
6820
+ get v2() {
6821
+ return this._v2 ??= new V2({ client: this.client });
6822
+ }
5400
6823
  };
5401
6824
 
5402
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/error-interceptor.js
6825
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/error-interceptor.js
5403
6826
  function wrapClientError(error, response, request, opts) {
5404
6827
  if (!opts?.throwOnError)
5405
6828
  return error;
@@ -5426,7 +6849,7 @@ function describe(request, response) {
5426
6849
  return `${method} ${url}${status ? " \u2192 " + status : ""}${statusText ? " " + statusText : ""}`;
5427
6850
  }
5428
6851
 
5429
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/client.js
6852
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/client.js
5430
6853
  function pick(value, fallback, encode) {
5431
6854
  if (!value)
5432
6855
  return;
@@ -5450,8 +6873,10 @@ function rewrite(request, values) {
5450
6873
  const value = pick(request.headers.get(name), key === "directory" ? values.directory : values.workspace, key === "directory" ? encodeURIComponent : void 0);
5451
6874
  if (!value)
5452
6875
  continue;
5453
- if (!url.searchParams.has(key)) {
5454
- url.searchParams.set(key, value);
6876
+ for (const query of url.pathname.startsWith("/api/") ? [key, `location[${key}]`] : [key]) {
6877
+ if (!url.searchParams.has(query)) {
6878
+ url.searchParams.set(query, value);
6879
+ }
5455
6880
  }
5456
6881
  changed = true;
5457
6882
  }
@@ -5500,9 +6925,15 @@ function createOpencodeClient(config) {
5500
6925
  return new OpencodeClient({ client: client2 });
5501
6926
  }
5502
6927
 
5503
- // ../../node_modules/.pnpm/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/server.js
6928
+ // ../../node_modules/.pnpm/@opencode-ai+sdk@1.18.31/node_modules/@opencode-ai/sdk/dist/v2/server.js
5504
6929
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
5505
6930
 
6931
+ // src/server.ts
6932
+ import {
6933
+ mergeLaunchEnv,
6934
+ brainSlotEnvKeys
6935
+ } from "@ycodium-ai/plugin-api/executor";
6936
+
5506
6937
  // src/cliParse.ts
5507
6938
  var OPENCODE_SERVER_READY_PREFIX = "opencode server listening";
5508
6939
  var DEFAULT_OPENCODE_SERVER_TIMEOUT_MS = 3e4;
@@ -5659,13 +7090,18 @@ async function findAvailablePort() {
5659
7090
  });
5660
7091
  }
5661
7092
  function buildSpawnEnv(input) {
5662
- const inherited = input.processEnv ?? process.env;
5663
- const withHome = makeOpenCodeEnvironment(input.recipe.homePath, inherited);
5664
- return compactEnv({
5665
- ...withHome,
5666
- ...input.recipe.environment,
5667
- ...compactEnv(input.processEnv),
5668
- OPENCODE_CONFIG_CONTENT: resolveOpenCodeConfigContent(input.processEnv, withHome)
7093
+ const xdgHome = makeOpenCodeEnvironment(input.recipe.homePath, {});
7094
+ return mergeLaunchEnv({
7095
+ brainSlots: brainSlotEnvKeys(OPENCODE_CARD),
7096
+ accountHome: xdgHome,
7097
+ instanceTable: input.recipe.environment,
7098
+ handOverrides: {
7099
+ OPENCODE_CONFIG_CONTENT: resolveOpenCodeConfigContent(
7100
+ input.processEnv,
7101
+ input.processEnv ?? process.env
7102
+ )
7103
+ },
7104
+ launch: input.processEnv
5669
7105
  });
5670
7106
  }
5671
7107
  async function terminateOwnedProcess(handle) {
@@ -5929,62 +7365,16 @@ async function loadOpenCodeInventory(client2) {
5929
7365
  };
5930
7366
  }
5931
7367
 
5932
- // src/slug.ts
5933
- function parseOpenCodeModelSlug(slug) {
5934
- if (typeof slug !== "string") {
5935
- return null;
5936
- }
5937
- const trimmed = slug.trim();
5938
- const separator = trimmed.indexOf("/");
5939
- if (separator <= 0 || separator === trimmed.length - 1) {
5940
- return null;
5941
- }
5942
- return {
5943
- providerID: trimmed.slice(0, separator),
5944
- modelID: trimmed.slice(separator + 1)
5945
- };
5946
- }
5947
- var OPENCODE_RESUME_VERSION = 1;
5948
- function parseOpenCodeResume(raw) {
5949
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
5950
- return void 0;
5951
- }
5952
- const record = raw;
5953
- if (record.schemaVersion !== OPENCODE_RESUME_VERSION) {
5954
- return void 0;
5955
- }
5956
- if (typeof record.sessionId !== "string" || record.sessionId.trim().length === 0) {
5957
- return void 0;
5958
- }
5959
- return { sessionId: record.sessionId.trim() };
5960
- }
5961
- function makeOpenCodeResumeCursor(sessionId) {
5962
- return { schemaVersion: OPENCODE_RESUME_VERSION, sessionId };
5963
- }
5964
- var OPENCODE_DEFAULT_TITLE_PATTERN = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
5965
- function isOpenCodeDefaultTitle(title) {
5966
- return OPENCODE_DEFAULT_TITLE_PATTERN.test(title);
5967
- }
5968
- function parseGenericCliVersion(output) {
5969
- const match = output.match(/\b(\d+\.\d+\.\d+)\b/);
5970
- return match?.[1] ?? null;
5971
- }
5972
- function compareSemverVersions(left, right) {
5973
- const parse = (value) => {
5974
- const match = value.trim().replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
5975
- if (!match) return null;
5976
- return [Number(match[1]), Number(match[2]), Number(match[3])];
5977
- };
5978
- const a = parse(left);
5979
- const b = parse(right);
5980
- if (!a || !b) return left.localeCompare(right);
5981
- if (a[0] !== b[0]) return a[0] - b[0];
5982
- if (a[1] !== b[1]) return a[1] - b[1];
5983
- return a[2] - b[2];
5984
- }
5985
- var MINIMUM_OPENCODE_VERSION = "1.14.19";
5986
-
5987
7368
  // src/probe.ts
7369
+ var OPENCODE_NATIVE_MODE_REPORT = {
7370
+ nativeModes: OPENCODE_NATIVE_MODES.map((mode) => ({
7371
+ id: mode.id,
7372
+ name: mode.name,
7373
+ description: mode.description
7374
+ })),
7375
+ currentNativeModeId: OPENCODE_DEFAULT_NATIVE_MODE_ID,
7376
+ nativeModeByRuntimeMode: OPENCODE_NATIVE_MODE_BY_RUNTIME_MODE
7377
+ };
5988
7378
  async function probeOpenCode(input) {
5989
7379
  void input.signal;
5990
7380
  if (!input.recipe.enabled) {
@@ -6024,7 +7414,8 @@ ${result.stderr}`);
6024
7414
  version,
6025
7415
  readiness: "error",
6026
7416
  auth: { status: "unknown" },
6027
- detail: `OpenCode v${version} is older than the required v${MINIMUM_OPENCODE_VERSION}.`
7417
+ detail: `OpenCode v${version} is older than the required v${MINIMUM_OPENCODE_VERSION}.`,
7418
+ ...OPENCODE_NATIVE_MODE_REPORT
6028
7419
  };
6029
7420
  }
6030
7421
  } catch (cause) {
@@ -6052,14 +7443,17 @@ ${result.stderr}`);
6052
7443
  installed: true,
6053
7444
  version,
6054
7445
  readiness: "ready",
6055
- auth: { status: "authenticated", type: "opencode" }
7446
+ auth: { status: "authenticated", type: "opencode" },
7447
+ models: openCodeProbeModels(inventory2),
7448
+ ...OPENCODE_NATIVE_MODE_REPORT
6056
7449
  };
6057
7450
  }
6058
7451
  return {
6059
7452
  installed: true,
6060
7453
  version,
6061
7454
  readiness: "error",
6062
- auth: { status: "unauthenticated" }
7455
+ auth: { status: "unauthenticated" },
7456
+ ...OPENCODE_NATIVE_MODE_REPORT
6063
7457
  };
6064
7458
  } finally {
6065
7459
  await closeOpenCodeServer(handle);
@@ -6077,14 +7471,17 @@ ${result.stderr}`);
6077
7471
  installed: true,
6078
7472
  version,
6079
7473
  readiness: "ready",
6080
- auth: { status: "authenticated", type: "opencode" }
7474
+ auth: { status: "authenticated", type: "opencode" },
7475
+ models: openCodeProbeModels(inventory),
7476
+ ...OPENCODE_NATIVE_MODE_REPORT
6081
7477
  };
6082
7478
  }
6083
7479
  return {
6084
7480
  installed: true,
6085
7481
  version,
6086
7482
  readiness: "error",
6087
- auth: { status: "unauthenticated" }
7483
+ auth: { status: "unauthenticated" },
7484
+ ...OPENCODE_NATIVE_MODE_REPORT
6088
7485
  };
6089
7486
  } catch (cause) {
6090
7487
  const mapped = formatOpenCodeProbeError({ cause, isExternalServer: isExternal, version });
@@ -6674,6 +8071,11 @@ function startEventPump(input) {
6674
8071
  }
6675
8072
  }
6676
8073
 
8074
+ // src/textGeneration.ts
8075
+ import {
8076
+ createCatalogModelMatcher
8077
+ } from "@ycodium-ai/plugin-api/executor";
8078
+
6677
8079
  // src/textGenerationUtils.ts
6678
8080
  function limitSection(value, maxChars) {
6679
8081
  if (value.length <= maxChars) return value;
@@ -7062,14 +8464,6 @@ function decodeStructuredOutput(rawText, operation, schemaKeys) {
7062
8464
  }
7063
8465
  return record;
7064
8466
  }
7065
- function resolveTextGenerationModel(input) {
7066
- const slug = input.launch?.requestedModelId ?? modelIdFromSelection(input.modelSelection) ?? input.fallback;
7067
- const parsed = parseOpenCodeModelSlug(slug);
7068
- if (!parsed) {
7069
- throw new Error("OpenCode model slug must be provider/model.");
7070
- }
7071
- return { ...parsed, slug };
7072
- }
7073
8467
  function createOpenCodeTextGeneration(recipe, host) {
7074
8468
  const shared = {
7075
8469
  handle: null,
@@ -7079,6 +8473,7 @@ function createOpenCodeTextGeneration(recipe, host) {
7079
8473
  idleTimer: null
7080
8474
  };
7081
8475
  let mutex = Promise.resolve();
8476
+ const matchModel = createCatalogModelMatcher(host.log);
7082
8477
  const withMutex = async (fn) => {
7083
8478
  let release;
7084
8479
  const previous = mutex;
@@ -7171,11 +8566,6 @@ function createOpenCodeTextGeneration(recipe, host) {
7171
8566
  });
7172
8567
  };
7173
8568
  const runOpenCodeJson = async (input) => {
7174
- const model = resolveTextGenerationModel({
7175
- modelSelection: input.modelSelection,
7176
- ...input.launch ? { launch: input.launch } : {},
7177
- fallback: "openai/gpt-5"
7178
- });
7179
8569
  const agent = getModelSelectionStringOptionValue(input.modelSelection, "agent");
7180
8570
  const variant = getModelSelectionStringOptionValue(input.modelSelection, "variant");
7181
8571
  const client2 = await acquireClient({
@@ -7183,6 +8573,12 @@ function createOpenCodeTextGeneration(recipe, host) {
7183
8573
  ...input.launch?.processEnv ? { processEnv: input.launch.processEnv } : {}
7184
8574
  });
7185
8575
  try {
8576
+ const boundModelId = input.launch?.requestedModelId?.trim() || void 0;
8577
+ const model = chooseOpenCodeModel({
8578
+ requested: boundModelId ?? modelIdFromSelection(input.modelSelection) ?? "openai/gpt-5",
8579
+ boundModelId,
8580
+ match: matchModel
8581
+ });
7186
8582
  if (input.signal?.aborted) {
7187
8583
  throw new Error(`${input.operation}: aborted.`);
7188
8584
  }
@@ -7198,7 +8594,7 @@ function createOpenCodeTextGeneration(recipe, host) {
7198
8594
  const prompted = await client2.session.prompt({
7199
8595
  sessionID: session.id,
7200
8596
  directory: input.cwd,
7201
- model: { providerID: model.providerID, modelID: model.modelID },
8597
+ ...model ? { model: { providerID: model.providerID, modelID: model.modelID } } : {},
7202
8598
  ...agent ? { agent } : {},
7203
8599
  ...variant ? { variant } : {},
7204
8600
  parts: [{ type: "text", text: input.prompt }]
@@ -7433,7 +8829,8 @@ function createOpenCodeInstance(config, host, attachments) {
7433
8829
  directory,
7434
8830
  password: server.password
7435
8831
  });
7436
- const permission = buildOpenCodePermissionRules(input.runtimeMode);
8832
+ const nativeModeId = openCodeNativeModeFor(input.runtimeMode, input.nativeModeId);
8833
+ const permission = openCodePermissionRulesForNativeMode(nativeModeId);
7437
8834
  const resume = input.discardResumeCursor === true ? void 0 : parseOpenCodeResume(input.resumeCursor);
7438
8835
  let sessionId;
7439
8836
  let createdSession = false;
@@ -7513,6 +8910,7 @@ function createOpenCodeInstance(config, host, attachments) {
7513
8910
  providerInstanceId: boundInstanceId,
7514
8911
  status: "ready",
7515
8912
  runtimeMode: input.runtimeMode,
8913
+ nativeModeId,
7516
8914
  cwd: directory,
7517
8915
  threadId: input.threadId,
7518
8916
  resumeCursor,
@@ -7543,7 +8941,9 @@ function createOpenCodeInstance(config, host, attachments) {
7543
8941
  startedToolItems: /* @__PURE__ */ new Set(),
7544
8942
  compaction: void 0,
7545
8943
  attachmentsApi: attachments,
7546
- runtimeMode: input.runtimeMode
8944
+ runtimeMode: input.runtimeMode,
8945
+ boundModelId: input.launch.requestedModelId?.trim() || void 0,
8946
+ matchModel: createCatalogModelMatcher2(host.log)
7547
8947
  };
7548
8948
  const winner = sessions.get(input.threadId);
7549
8949
  if (winner) {
@@ -7578,11 +8978,12 @@ function createOpenCodeInstance(config, host, attachments) {
7578
8978
  }
7579
8979
  const steering = context.session.activeTurnId !== void 0;
7580
8980
  const turnId = steering ? context.session.activeTurnId : randomUUID();
7581
- const slugSource = modelIdFromSelection(input.modelSelection) ?? readString2(input.modelSelection?.model) ?? context.session.model ?? "";
7582
- const parsedSlug = parseOpenCodeModelSlug(slugSource);
7583
- if (!parsedSlug) {
7584
- throw new Error("OpenCode model slug must be provider/model.");
7585
- }
8981
+ const requestedModel = modelIdFromSelection(input.modelSelection) ?? readString2(input.modelSelection?.model) ?? context.session.model;
8982
+ const parsedSlug = chooseOpenCodeModel({
8983
+ requested: requestedModel,
8984
+ boundModelId: context.boundModelId,
8985
+ match: context.matchModel
8986
+ });
7586
8987
  const queuedDecline = declineRelay.take(input.threadId);
7587
8988
  const text = prependDeclineReasons(input.input ?? "", queuedDecline);
7588
8989
  const fileParts = await toOpenCodeFileParts({
@@ -7606,17 +9007,23 @@ function createOpenCodeInstance(config, host, attachments) {
7606
9007
  ...context.session,
7607
9008
  status: "running",
7608
9009
  activeTurnId: turnId,
7609
- model: slugSource,
9010
+ ...requestedModel ? { model: requestedModel } : {},
7610
9011
  updatedAt: nowIso()
7611
9012
  };
7612
- emitEvent(events, context, "turn.started", { model: slugSource }, { turnId });
9013
+ emitEvent(
9014
+ events,
9015
+ context,
9016
+ "turn.started",
9017
+ requestedModel ? { model: requestedModel } : {},
9018
+ { turnId }
9019
+ );
7613
9020
  emitEvent(events, context, "session.state.changed", { state: "running" });
7614
9021
  }
7615
9022
  try {
7616
9023
  await context.client.session.promptAsync({
7617
9024
  sessionID: context.sessionId,
7618
9025
  directory: context.directory,
7619
- model: { providerID: parsedSlug.providerID, modelID: parsedSlug.modelID },
9026
+ ...parsedSlug ? { model: { providerID: parsedSlug.providerID, modelID: parsedSlug.modelID } } : {},
7620
9027
  ...agent ? { agent } : {},
7621
9028
  ...variant ? { variant } : {},
7622
9029
  parts