@ycodium-ai/agent-opencode 0.2.2106 → 0.2.2130

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