agentv 4.7.0 → 4.8.0

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.
@@ -301,7 +301,7 @@ var require_dist = __commonJS({
301
301
  }
302
302
  });
303
303
 
304
- // ../../packages/core/dist/chunk-75RFVESM.js
304
+ // ../../packages/core/dist/chunk-VCVVKCC4.js
305
305
  import { constants } from "node:fs";
306
306
  import { access, readFile } from "node:fs/promises";
307
307
  import path from "node:path";
@@ -419,7 +419,7 @@ __export(external_exports2, {
419
419
  void: () => voidType
420
420
  });
421
421
 
422
- // ../../packages/core/dist/chunk-75RFVESM.js
422
+ // ../../packages/core/dist/chunk-VCVVKCC4.js
423
423
  import { readFile as readFile2 } from "node:fs/promises";
424
424
  import path3 from "node:path";
425
425
  import fg from "fast-glob";
@@ -1416,6 +1416,52 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
1416
1416
  );
1417
1417
  const logFormat = normalizeCopilotLogFormat(logFormatSource);
1418
1418
  const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
1419
+ const byok = target.byok;
1420
+ let byokType;
1421
+ let byokBaseUrl;
1422
+ let byokApiKey;
1423
+ let byokBearerToken;
1424
+ let byokApiVersion;
1425
+ let byokWireApi;
1426
+ if (byok && typeof byok === "object") {
1427
+ byokType = resolveOptionalString(byok.type, env, `${target.name} byok type`, {
1428
+ allowLiteral: true,
1429
+ optionalEnv: true
1430
+ });
1431
+ byokBaseUrl = resolveOptionalString(byok.base_url, env, `${target.name} byok base URL`, {
1432
+ allowLiteral: true,
1433
+ optionalEnv: true
1434
+ });
1435
+ byokApiKey = resolveOptionalString(byok.api_key, env, `${target.name} byok API key`, {
1436
+ allowLiteral: false,
1437
+ optionalEnv: true
1438
+ });
1439
+ byokBearerToken = resolveOptionalString(
1440
+ byok.bearer_token,
1441
+ env,
1442
+ `${target.name} byok bearer token`,
1443
+ {
1444
+ allowLiteral: false,
1445
+ optionalEnv: true
1446
+ }
1447
+ );
1448
+ byokApiVersion = resolveOptionalString(
1449
+ byok.api_version,
1450
+ env,
1451
+ `${target.name} byok API version`,
1452
+ {
1453
+ allowLiteral: true,
1454
+ optionalEnv: true
1455
+ }
1456
+ );
1457
+ byokWireApi = resolveOptionalString(byok.wire_api, env, `${target.name} byok wire API`, {
1458
+ allowLiteral: true,
1459
+ optionalEnv: true
1460
+ });
1461
+ if (!byokBaseUrl) {
1462
+ throw new Error(`${target.name}: 'byok.base_url' is required when 'byok' is specified`);
1463
+ }
1464
+ }
1419
1465
  return {
1420
1466
  cliUrl,
1421
1467
  cliPath,
@@ -1426,7 +1472,13 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
1426
1472
  timeoutMs,
1427
1473
  logDir,
1428
1474
  logFormat,
1429
- systemPrompt
1475
+ systemPrompt,
1476
+ byokType,
1477
+ byokBaseUrl,
1478
+ byokApiKey,
1479
+ byokBearerToken,
1480
+ byokApiVersion,
1481
+ byokWireApi
1430
1482
  };
1431
1483
  }
1432
1484
  function resolveCopilotCliConfig(target, env, evalFilePath) {
@@ -21457,6 +21509,25 @@ var CopilotSdkProvider = class {
21457
21509
  content: systemPrompt
21458
21510
  };
21459
21511
  }
21512
+ if (this.config.byokBaseUrl) {
21513
+ const byokType = this.config.byokType ?? "openai";
21514
+ const provider = {
21515
+ type: byokType,
21516
+ baseUrl: normalizeByokBaseUrl(this.config.byokBaseUrl, byokType)
21517
+ };
21518
+ if (this.config.byokBearerToken) {
21519
+ provider.bearerToken = this.config.byokBearerToken;
21520
+ } else if (this.config.byokApiKey) {
21521
+ provider.apiKey = this.config.byokApiKey;
21522
+ }
21523
+ if (this.config.byokWireApi) {
21524
+ provider.wireApi = this.config.byokWireApi;
21525
+ }
21526
+ if (this.config.byokType === "azure" && this.config.byokApiVersion) {
21527
+ provider.azure = { apiVersion: this.config.byokApiVersion };
21528
+ }
21529
+ sessionOptions.provider = provider;
21530
+ }
21460
21531
  let session;
21461
21532
  try {
21462
21533
  session = await client.createSession(sessionOptions);
@@ -21688,6 +21759,16 @@ function resolveSkillDirectories(cwd) {
21688
21759
  ];
21689
21760
  return candidates.filter((dir) => existsSync2(dir));
21690
21761
  }
21762
+ function normalizeByokBaseUrl(baseUrl, type) {
21763
+ const trimmed = baseUrl.trim().replace(/\/+$/, "");
21764
+ if (/^https?:\/\//i.test(trimmed)) {
21765
+ return trimmed;
21766
+ }
21767
+ if (type === "azure") {
21768
+ return `https://${trimmed}.openai.azure.com`;
21769
+ }
21770
+ return trimmed;
21771
+ }
21691
21772
  function summarizeSdkEvent(eventType, data) {
21692
21773
  if (!data || typeof data !== "object") {
21693
21774
  return eventType;
@@ -33789,4 +33870,4 @@ export {
33789
33870
  TranscriptProvider,
33790
33871
  createAgentKernel
33791
33872
  };
33792
- //# sourceMappingURL=chunk-I6UE4LHZ.js.map
33873
+ //# sourceMappingURL=chunk-H4GQXK5M.js.map