nexgenk 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/main.mjs +1212 -512
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -143,7 +143,7 @@ function isAbortError$9(err) {
143
143
  return typeof err === "object" && err !== null && ("name" in err && err.name === "AbortError" || "message" in err && String(err.message).includes("FetchRequestCanceledException"));
144
144
  }
145
145
  var castToError$2;
146
- var init_errors$45 = __esmMin((() => {
146
+ var init_errors$46 = __esmMin((() => {
147
147
  castToError$2 = (err) => {
148
148
  if (err instanceof Error) return err;
149
149
  if (typeof err === "object" && err !== null) {
@@ -166,7 +166,7 @@ var init_errors$45 = __esmMin((() => {
166
166
  // ../../node_modules/.pnpm/@anthropic-ai+sdk@0.95.2_zod@4.3.6/node_modules/@anthropic-ai/sdk/core/error.mjs
167
167
  var AnthropicError, APIError$2, APIUserAbortError$2, APIConnectionError$3, APIConnectionTimeoutError$2, BadRequestError$2, AuthenticationError$2, PermissionDeniedError$2, NotFoundError$2, ConflictError$2, UnprocessableEntityError$2, RateLimitError$2, InternalServerError$2;
168
168
  var init_error$4 = __esmMin((() => {
169
- init_errors$45();
169
+ init_errors$46();
170
170
  AnthropicError = class extends Error {};
171
171
  APIError$2 = class APIError$2 extends AnthropicError {
172
172
  constructor(status, error, message, headers, type) {
@@ -1684,7 +1684,7 @@ var init_streaming$4 = __esmMin((() => {
1684
1684
  init_error$4();
1685
1685
  init_shims$1();
1686
1686
  init_line$1();
1687
- init_errors$45();
1687
+ init_errors$46();
1688
1688
  init_values$1();
1689
1689
  init_bytes$1();
1690
1690
  init_log$3();
@@ -4389,7 +4389,7 @@ var init_BetaMessageStream = __esmMin((() => {
4389
4389
  init_tslib$1();
4390
4390
  init_parser$6();
4391
4391
  init_error$3();
4392
- init_errors$45();
4392
+ init_errors$46();
4393
4393
  init_streaming$3();
4394
4394
  init_beta_parser();
4395
4395
  JSON_BUF_PROPERTY$1 = "__json_buf";
@@ -6369,7 +6369,7 @@ function tracksToolInput(content) {
6369
6369
  var _MessageStream_instances, _MessageStream_currentMessageSnapshot, _MessageStream_params, _MessageStream_connectedPromise, _MessageStream_resolveConnectedPromise, _MessageStream_rejectConnectedPromise, _MessageStream_endPromise, _MessageStream_resolveEndPromise, _MessageStream_rejectEndPromise, _MessageStream_listeners, _MessageStream_ended, _MessageStream_errored, _MessageStream_aborted, _MessageStream_catchingPromiseCreated, _MessageStream_response, _MessageStream_request_id, _MessageStream_logger, _MessageStream_getFinalMessage, _MessageStream_getFinalText, _MessageStream_handleError, _MessageStream_beginRequest, _MessageStream_addStreamEvent, _MessageStream_endRequest, _MessageStream_accumulateMessage, JSON_BUF_PROPERTY, MessageStream;
6370
6370
  var init_MessageStream = __esmMin((() => {
6371
6371
  init_tslib$1();
6372
- init_errors$45();
6372
+ init_errors$46();
6373
6373
  init_error$3();
6374
6374
  init_streaming$3();
6375
6375
  init_parser$6();
@@ -7174,12 +7174,12 @@ var init_resources$1 = __esmMin((() => {
7174
7174
  }));
7175
7175
  // ../../node_modules/.pnpm/@anthropic-ai+sdk@0.95.2_zod@4.3.6/node_modules/@anthropic-ai/sdk/client.mjs
7176
7176
  var _BaseAnthropic_instances, _a$5, _BaseAnthropic_encoder, _BaseAnthropic_baseURLOverridden, HUMAN_PROMPT, AI_PROMPT, BaseAnthropic, Anthropic;
7177
- var init_client$4 = __esmMin((() => {
7177
+ var init_client$5 = __esmMin((() => {
7178
7178
  init_tslib$1();
7179
7179
  init_uuid$1();
7180
7180
  init_values$1();
7181
7181
  init_sleep$1();
7182
- init_errors$45();
7182
+ init_errors$46();
7183
7183
  init_detect_platform$1();
7184
7184
  init_shims$1();
7185
7185
  init_request_options$1();
@@ -7809,7 +7809,7 @@ var init_client$4 = __esmMin((() => {
7809
7809
  }));
7810
7810
  // ../../node_modules/.pnpm/@anthropic-ai+sdk@0.95.2_zod@4.3.6/node_modules/@anthropic-ai/sdk/index.mjs
7811
7811
  var init_sdk = __esmMin((() => {
7812
- init_client$4();
7812
+ init_client$5();
7813
7813
  init_uploads$3();
7814
7814
  init_api_promise$1();
7815
7815
  init_pagination$2();
@@ -39114,7 +39114,7 @@ function isAbortError$7(err) {
39114
39114
  return typeof err === "object" && err !== null && ("name" in err && err.name === "AbortError" || "message" in err && String(err.message).includes("FetchRequestCanceledException"));
39115
39115
  }
39116
39116
  var castToError;
39117
- var init_errors$44 = __esmMin((() => {
39117
+ var init_errors$45 = __esmMin((() => {
39118
39118
  castToError = (err) => {
39119
39119
  if (err instanceof Error) return err;
39120
39120
  if (typeof err === "object" && err !== null) {
@@ -39137,7 +39137,7 @@ var init_errors$44 = __esmMin((() => {
39137
39137
  // ../../node_modules/.pnpm/openai@6.34.0_ws@8.20.0_zod@4.3.6/node_modules/openai/core/error.mjs
39138
39138
  var OpenAIError, APIError, APIUserAbortError, APIConnectionError$1, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, LengthFinishReasonError, ContentFilterFinishReasonError, InvalidWebhookSignatureError, OAuthError$2, SubjectTokenProviderError;
39139
39139
  var init_error$2 = __esmMin((() => {
39140
- init_errors$44();
39140
+ init_errors$45();
39141
39141
  OpenAIError = class extends Error {};
39142
39142
  APIError = class APIError extends OpenAIError {
39143
39143
  constructor(status, error, message, headers) {
@@ -39967,7 +39967,7 @@ var init_streaming$2 = __esmMin((() => {
39967
39967
  init_error$2();
39968
39968
  init_shims();
39969
39969
  init_line();
39970
- init_errors$44();
39970
+ init_errors$45();
39971
39971
  init_bytes();
39972
39972
  init_log$2();
39973
39973
  Stream$1 = class Stream$1 {
@@ -45688,12 +45688,12 @@ var init_resources = __esmMin((() => {
45688
45688
  }));
45689
45689
  // ../../node_modules/.pnpm/openai@6.34.0_ws@8.20.0_zod@4.3.6/node_modules/openai/client.mjs
45690
45690
  var _OpenAI_instances, _a$2, _OpenAI_encoder, _OpenAI_baseURLOverridden, WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER, OpenAI;
45691
- var init_client$3 = __esmMin((() => {
45691
+ var init_client$4 = __esmMin((() => {
45692
45692
  init_tslib();
45693
45693
  init_uuid();
45694
45694
  init_values();
45695
45695
  init_sleep();
45696
- init_errors$44();
45696
+ init_errors$45();
45697
45697
  init_detect_platform();
45698
45698
  init_shims();
45699
45699
  init_request_options();
@@ -46269,11 +46269,11 @@ var init_client$3 = __esmMin((() => {
46269
46269
  var init_azure = __esmMin((() => {
46270
46270
  init_error$1();
46271
46271
  init_utils$5();
46272
- init_client$3();
46272
+ init_client$4();
46273
46273
  }));
46274
46274
  // ../../node_modules/.pnpm/openai@6.34.0_ws@8.20.0_zod@4.3.6/node_modules/openai/index.mjs
46275
46275
  var init_openai = __esmMin((() => {
46276
- init_client$3();
46276
+ init_client$4();
46277
46277
  init_uploads$1();
46278
46278
  init_api_promise();
46279
46279
  init_pagination$1();
@@ -46612,7 +46612,7 @@ function inferOverrideWire$1(npm) {
46612
46612
  if (normalized.includes("openai")) return "openai";
46613
46613
  }
46614
46614
  var KNOWN_WIRE_TYPES$1;
46615
- var init_catalog$3 = __esmMin((() => {
46615
+ var init_catalog$4 = __esmMin((() => {
46616
46616
  KNOWN_WIRE_TYPES$1 = [
46617
46617
  "anthropic",
46618
46618
  "openai",
@@ -46628,7 +46628,7 @@ var init_src$14 = __esmMin((() => {
46628
46628
  init_providers$1();
46629
46629
  init_nexgenk();
46630
46630
  init_capability$7();
46631
- init_catalog$3();
46631
+ init_catalog$4();
46632
46632
  }));
46633
46633
  /**
46634
46634
  * Concrete provider adapters stay off the root barrel because their SDK type
@@ -46653,7 +46653,7 @@ function makeErrorPayload$1(code, message, options) {
46653
46653
  };
46654
46654
  }
46655
46655
  var ErrorCodes$1, NEXGEN_ERROR_INFO, NexgenError;
46656
- var init_errors$43 = __esmMin((() => {
46656
+ var init_errors$44 = __esmMin((() => {
46657
46657
  init_src$14();
46658
46658
  ErrorCodes$1 = {
46659
46659
  CONFIG_INVALID: "config.invalid",
@@ -47247,7 +47247,7 @@ function hasResumeState(summary) {
47247
47247
  }
47248
47248
  var MAIN_AGENT_ID$7, Session;
47249
47249
  var init_session$4 = __esmMin((() => {
47250
- init_errors$43();
47250
+ init_errors$44();
47251
47251
  MAIN_AGENT_ID$7 = "main";
47252
47252
  Session = class {
47253
47253
  id;
@@ -47861,7 +47861,7 @@ function normalizeSessionId(value) {
47861
47861
  }
47862
47862
  var NexgenHarness, DEFAULT_SESSION_STARTED_UI_MODE;
47863
47863
  var init_nexgenk_harness = __esmMin((() => {
47864
- init_errors$43();
47864
+ init_errors$44();
47865
47865
  init_telemetry$3();
47866
47866
  init_session$4();
47867
47867
  NexgenHarness = class {
@@ -50221,7 +50221,7 @@ var init_codes = __esmMin((() => {
50221
50221
  }));
50222
50222
  // ../../packages/agent-core-v2/src/session/agentLifecycle/errors.ts
50223
50223
  var AgentLifecycleErrors;
50224
- var init_errors$42 = __esmMin((() => {
50224
+ var init_errors$43 = __esmMin((() => {
50225
50225
  init_codes();
50226
50226
  AgentLifecycleErrors = { codes: {
50227
50227
  AGENT_NOT_FOUND: "agent.not_found",
@@ -50237,7 +50237,7 @@ var init_errors$42 = __esmMin((() => {
50237
50237
  }));
50238
50238
  // ../../packages/agent-core-v2/src/app/auth/errors.ts
50239
50239
  var AuthErrors;
50240
- var init_errors$41 = __esmMin((() => {
50240
+ var init_errors$42 = __esmMin((() => {
50241
50241
  init_codes();
50242
50242
  AuthErrors = {
50243
50243
  codes: {
@@ -50284,7 +50284,7 @@ var init_errors$41 = __esmMin((() => {
50284
50284
  }));
50285
50285
  // ../../packages/agent-core-v2/src/agent/task/errors.ts
50286
50286
  var TaskErrors;
50287
- var init_errors$40 = __esmMin((() => {
50287
+ var init_errors$41 = __esmMin((() => {
50288
50288
  init_codes();
50289
50289
  TaskErrors = {
50290
50290
  codes: {
@@ -50305,7 +50305,7 @@ function unwrapErrorCause(error) {
50305
50305
  return current;
50306
50306
  }
50307
50307
  var BugIndicatingError, Error2;
50308
- var init_errors$39 = __esmMin((() => {
50308
+ var init_errors$40 = __esmMin((() => {
50309
50309
  init_codes();
50310
50310
  BugIndicatingError = class extends Error {
50311
50311
  constructor(message) {
@@ -50482,7 +50482,7 @@ function isImageFormatStatusError(statusCode, message) {
50482
50482
  return IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS.some((pattern) => pattern.test(lowerMessage)) || MEDIA_TYPE_FIELD_PATTERN.test(lowerMessage) && lowerMessage.includes("image");
50483
50483
  }
50484
50484
  var NETWORK_RE$1, TIMEOUT_RE$1, CONTEXT_OVERFLOW_MESSAGE_PATTERNS, PROVIDER_OVERLOAD_MESSAGE_PATTERNS, REQUEST_TOO_LARGE_MESSAGE_PATTERNS, TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS, STRUCTURAL_REQUEST_MESSAGE_PATTERNS, IMAGE_FORMAT_STATUS_MESSAGE_PATTERNS, MEDIA_TYPE_FIELD_PATTERN, THINKING_EFFORT_CONFIG_DOCS_URL, THINKING_EFFORT_STATUS_MESSAGE_PATTERNS;
50485
- var init_errors$38 = __esmMin((() => {
50485
+ var init_errors$39 = __esmMin((() => {
50486
50486
  NETWORK_RE$1 = /network|connection|connect|disconnect|terminated/i;
50487
50487
  TIMEOUT_RE$1 = /timed?\s*out|timeout|deadline/i;
50488
50488
  CONTEXT_OVERFLOW_MESSAGE_PATTERNS = [
@@ -50773,9 +50773,9 @@ function llmMessageFromError(error) {
50773
50773
  };
50774
50774
  }
50775
50775
  var CONFIG_INVALID_ERROR_CODE, PROVIDER_API_ERROR_CODE, PROVIDER_FILTERED_ERROR_CODE, PROVIDER_RATE_LIMIT_ERROR_CODE, PROVIDER_AUTH_ERROR_CODE, PROVIDER_CONNECTION_ERROR_CODE, PROVIDER_OVERLOADED_ERROR_CODE, CONTEXT_OVERFLOW_ERROR_CODE, ChatProviderError, APIConnectionError, VideoUploadUnsupportedError, ImageUploadUnsupportedError, APITimeoutError, APIStatusError, APIContextOverflowError, APIRequestTooLargeError, APIProviderRateLimitError, APIProviderQuotaExhaustedError, APIProviderOverloadedError, APIEmptyResponseError, IMAGE_FORMAT_PROVIDER_MESSAGE_PATTERNS, PROVIDER_RATE_LIMIT_MESSAGE_PATTERNS;
50776
- var init_errors$37 = __esmMin((() => {
50776
+ var init_errors$38 = __esmMin((() => {
50777
+ init_errors$40();
50777
50778
  init_errors$39();
50778
- init_errors$38();
50779
50779
  CONFIG_INVALID_ERROR_CODE = "config.invalid";
50780
50780
  PROVIDER_API_ERROR_CODE = "provider.api_error";
50781
50781
  PROVIDER_FILTERED_ERROR_CODE = "provider.filtered";
@@ -50901,10 +50901,10 @@ function translateProviderError(error) {
50901
50901
  return new Error2(CoreErrors.codes.INTERNAL, String(error), { cause: error });
50902
50902
  }
50903
50903
  var ProtocolErrors;
50904
- var init_errors$36 = __esmMin((() => {
50904
+ var init_errors$37 = __esmMin((() => {
50905
50905
  init_codes();
50906
- init_errors$39();
50907
- init_errors$37();
50906
+ init_errors$40();
50907
+ init_errors$38();
50908
50908
  ProtocolErrors = {
50909
50909
  codes: {
50910
50910
  PROVIDER_API_ERROR: PROVIDER_API_ERROR_CODE,
@@ -50958,9 +50958,9 @@ var init_errors$36 = __esmMin((() => {
50958
50958
  }));
50959
50959
  // ../../packages/agent-core-v2/src/app/config/errors.ts
50960
50960
  var ConfigErrors;
50961
- var init_errors$35 = __esmMin((() => {
50961
+ var init_errors$36 = __esmMin((() => {
50962
50962
  init_codes();
50963
- init_errors$37();
50963
+ init_errors$38();
50964
50964
  ConfigErrors = { codes: {
50965
50965
  CONFIG_INVALID: CONFIG_INVALID_ERROR_CODE,
50966
50966
  CONFIG_PERSIST_BLOCKED: "config.persist_blocked"
@@ -50969,7 +50969,7 @@ var init_errors$35 = __esmMin((() => {
50969
50969
  }));
50970
50970
  // ../../packages/agent-core-v2/src/app/capability/errors.ts
50971
50971
  var CapabilityErrors;
50972
- var init_errors$34 = __esmMin((() => {
50972
+ var init_errors$35 = __esmMin((() => {
50973
50973
  init_codes();
50974
50974
  CapabilityErrors = { codes: {
50975
50975
  CAPABILITY_NOT_FOUND: "capability.not_found",
@@ -50980,14 +50980,14 @@ var init_errors$34 = __esmMin((() => {
50980
50980
  }));
50981
50981
  // ../../packages/agent-core-v2/src/features/cron/errors.ts
50982
50982
  var CronErrors;
50983
- var init_errors$33 = __esmMin((() => {
50983
+ var init_errors$34 = __esmMin((() => {
50984
50984
  init_codes();
50985
50985
  CronErrors = { codes: { CRON_EXPRESSION_INVALID: "cron.expression_invalid" } };
50986
50986
  registerErrorDomain(CronErrors);
50987
50987
  }));
50988
50988
  // ../../packages/agent-core-v2/src/debug/errors.ts
50989
50989
  var DebugErrors;
50990
- var init_errors$32 = __esmMin((() => {
50990
+ var init_errors$33 = __esmMin((() => {
50991
50991
  init_codes();
50992
50992
  DebugErrors = { codes: {
50993
50993
  DEBUG_SCOPE_NOT_FOUND: "debug.scope_not_found",
@@ -50997,9 +50997,9 @@ var init_errors$32 = __esmMin((() => {
50997
50997
  }));
50998
50998
  // ../../packages/agent-core-v2/src/app/event/errors.ts
50999
50999
  var EventErrors, EventError;
51000
- var init_errors$31 = __esmMin((() => {
51000
+ var init_errors$32 = __esmMin((() => {
51001
51001
  init_codes();
51002
- init_errors$39();
51002
+ init_errors$40();
51003
51003
  EventErrors = {
51004
51004
  codes: {
51005
51005
  EVENT_DUPLICATE_EVENT: "event.duplicate_event",
@@ -51442,7 +51442,7 @@ function formatError$3(error, mapper = (issue) => issue.message) {
51442
51442
  return fieldErrors;
51443
51443
  }
51444
51444
  var initializer$1, $ZodError, $ZodRealError;
51445
- var init_errors$30 = __esmMin((() => {
51445
+ var init_errors$31 = __esmMin((() => {
51446
51446
  init_core$3();
51447
51447
  init_util$3();
51448
51448
  initializer$1 = (inst, def) => {
@@ -51468,7 +51468,7 @@ var init_errors$30 = __esmMin((() => {
51468
51468
  var _parse, _parseAsync, _safeParse, safeParse$2, _safeParseAsync, safeParseAsync$1, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync;
51469
51469
  var init_parse$6 = __esmMin((() => {
51470
51470
  init_core$3();
51471
- init_errors$30();
51471
+ init_errors$31();
51472
51472
  init_util$3();
51473
51473
  _parse = (_Err) => (schema, value, _ctx, _params) => {
51474
51474
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
@@ -54734,7 +54734,7 @@ var init_json_schema_processors = __esmMin((() => {
54734
54734
  var init_core$2 = __esmMin((() => {
54735
54735
  init_core$3();
54736
54736
  init_parse$6();
54737
- init_errors$30();
54737
+ init_errors$31();
54738
54738
  init_schemas$3();
54739
54739
  init_checks$2();
54740
54740
  init_versions();
@@ -54787,7 +54787,7 @@ var init_iso = __esmMin((() => {
54787
54787
  }));
54788
54788
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
54789
54789
  var initializer, ZodError$1, ZodRealError;
54790
- var init_errors$29 = __esmMin((() => {
54790
+ var init_errors$30 = __esmMin((() => {
54791
54791
  init_core$2();
54792
54792
  init_util$3();
54793
54793
  initializer = (inst, issues) => {
@@ -54816,7 +54816,7 @@ var init_errors$29 = __esmMin((() => {
54816
54816
  var parse$10, parseAsync, safeParse$1, safeParseAsync, encode$3, decode$4, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync;
54817
54817
  var init_parse$5 = __esmMin((() => {
54818
54818
  init_core$2();
54819
- init_errors$29();
54819
+ init_errors$30();
54820
54820
  parse$10 = /* @__PURE__ */ _parse(ZodRealError);
54821
54821
  parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
54822
54822
  safeParse$1 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -55560,7 +55560,7 @@ var init_external$2 = __esmMin((() => {
55560
55560
  init_core$2();
55561
55561
  init_schemas$2();
55562
55562
  init_checks$1();
55563
- init_errors$29();
55563
+ init_errors$30();
55564
55564
  init_parse$5();
55565
55565
  init_compat();
55566
55566
  init_json_schema_processors();
@@ -55677,7 +55677,7 @@ var init_fileService = __esmMin((() => {
55677
55677
  init_zod$1();
55678
55678
  init_instantiation();
55679
55679
  init_codes();
55680
- init_errors$39();
55680
+ init_errors$40();
55681
55681
  init_isoDateTime();
55682
55682
  fileMetaSchema$1 = object$1({
55683
55683
  id: string().min(1),
@@ -55708,7 +55708,7 @@ var init_fileService = __esmMin((() => {
55708
55708
  }));
55709
55709
  // ../../packages/agent-core-v2/src/workspace/workspaceFs/internal/errors.ts
55710
55710
  var FsErrors;
55711
- var init_errors$28 = __esmMin((() => {
55711
+ var init_errors$29 = __esmMin((() => {
55712
55712
  init_codes();
55713
55713
  FsErrors = { codes: {
55714
55714
  FS_PATH_NOT_FOUND: "fs.path_not_found",
@@ -55726,7 +55726,7 @@ var init_errors$28 = __esmMin((() => {
55726
55726
  }));
55727
55727
  // ../../packages/agent-core-v2/src/agent/fullCompaction/errors.ts
55728
55728
  var FullCompactionErrors;
55729
- var init_errors$27 = __esmMin((() => {
55729
+ var init_errors$28 = __esmMin((() => {
55730
55730
  init_codes();
55731
55731
  FullCompactionErrors = { codes: {
55732
55732
  COMPACTION_FAILED: "compaction.failed",
@@ -55736,7 +55736,7 @@ var init_errors$27 = __esmMin((() => {
55736
55736
  }));
55737
55737
  // ../../packages/agent-core-v2/src/features/goal/errors.ts
55738
55738
  var GoalErrors;
55739
- var init_errors$26 = __esmMin((() => {
55739
+ var init_errors$27 = __esmMin((() => {
55740
55740
  init_codes();
55741
55741
  GoalErrors = {
55742
55742
  codes: {
@@ -55804,7 +55804,7 @@ var init_errors$26 = __esmMin((() => {
55804
55804
  }));
55805
55805
  // ../../packages/agent-core-v2/src/agent/loop/errors.ts
55806
55806
  var LoopErrors;
55807
- var init_errors$25 = __esmMin((() => {
55807
+ var init_errors$26 = __esmMin((() => {
55808
55808
  init_codes();
55809
55809
  LoopErrors = {
55810
55810
  codes: {
@@ -55823,7 +55823,7 @@ var init_errors$25 = __esmMin((() => {
55823
55823
  }));
55824
55824
  // ../../packages/agent-core-v2/src/mcpCore/errors.ts
55825
55825
  var McpErrors;
55826
- var init_errors$24 = __esmMin((() => {
55826
+ var init_errors$25 = __esmMin((() => {
55827
55827
  init_codes();
55828
55828
  McpErrors = { codes: {
55829
55829
  MCP_SERVER_NOT_FOUND: "mcp.server_not_found",
@@ -55836,7 +55836,7 @@ var init_errors$24 = __esmMin((() => {
55836
55836
  }));
55837
55837
  // ../../packages/agent-core-v2/src/llm-adapter/model/errors.ts
55838
55838
  var ModelCatalogErrors;
55839
- var init_errors$23 = __esmMin((() => {
55839
+ var init_errors$24 = __esmMin((() => {
55840
55840
  init_codes();
55841
55841
  ModelCatalogErrors = {
55842
55842
  codes: {
@@ -55901,7 +55901,7 @@ function toHostFsError(error, ctx) {
55901
55901
  var OsFsErrors, HostFsError, REASONS$1;
55902
55902
  var init_hostFsErrors = __esmMin((() => {
55903
55903
  init_codes();
55904
- init_errors$39();
55904
+ init_errors$40();
55905
55905
  OsFsErrors = {
55906
55906
  codes: {
55907
55907
  OS_FS_NOT_FOUND: "os.fs.not_found",
@@ -55980,7 +55980,7 @@ var init_hostFsErrors = __esmMin((() => {
55980
55980
  var IHostProcessService, OsProcessErrors, HostProcessErrorCode, HostProcessError;
55981
55981
  var init_hostProcess = __esmMin((() => {
55982
55982
  init_codes();
55983
- init_errors$39();
55983
+ init_errors$40();
55984
55984
  init_instantiation();
55985
55985
  IHostProcessService = createDecorator("hostProcessService");
55986
55986
  OsProcessErrors = {
@@ -56024,7 +56024,7 @@ var init_hostProcess = __esmMin((() => {
56024
56024
  }));
56025
56025
  // ../../packages/agent-core-v2/src/app/plugin/errors.ts
56026
56026
  var PluginErrors;
56027
- var init_errors$22 = __esmMin((() => {
56027
+ var init_errors$23 = __esmMin((() => {
56028
56028
  init_codes();
56029
56029
  PluginErrors = { codes: {
56030
56030
  PLUGIN_NOT_FOUND: "plugin.not_found",
@@ -56034,7 +56034,7 @@ var init_errors$22 = __esmMin((() => {
56034
56034
  }));
56035
56035
  // ../../packages/agent-core-v2/src/agent/profile/errors.ts
56036
56036
  var ProfileErrors;
56037
- var init_errors$21 = __esmMin((() => {
56037
+ var init_errors$22 = __esmMin((() => {
56038
56038
  init_codes();
56039
56039
  ProfileErrors = { codes: {
56040
56040
  MODEL_NOT_CONFIGURED: "model.not_configured",
@@ -56048,7 +56048,7 @@ var init_errors$21 = __esmMin((() => {
56048
56048
  }));
56049
56049
  // ../../packages/agent-core-v2/src/agent/prompt/errors.ts
56050
56050
  var PromptErrors;
56051
- var init_errors$20 = __esmMin((() => {
56051
+ var init_errors$21 = __esmMin((() => {
56052
56052
  init_codes();
56053
56053
  PromptErrors = { codes: {
56054
56054
  REQUEST_INVALID: "request.invalid",
@@ -56062,7 +56062,7 @@ var init_errors$20 = __esmMin((() => {
56062
56062
  }));
56063
56063
  // ../../packages/agent-core-v2/src/app/kosongConfig/errors.ts
56064
56064
  var ModelsDevImportErrors;
56065
- var init_errors$19 = __esmMin((() => {
56065
+ var init_errors$20 = __esmMin((() => {
56066
56066
  init_codes();
56067
56067
  ModelsDevImportErrors = {
56068
56068
  codes: {
@@ -56109,7 +56109,7 @@ var init_errors$19 = __esmMin((() => {
56109
56109
  }));
56110
56110
  // ../../packages/agent-core-v2/src/app/sessionExport/errors.ts
56111
56111
  var SessionExportErrors;
56112
- var init_errors$18 = __esmMin((() => {
56112
+ var init_errors$19 = __esmMin((() => {
56113
56113
  init_codes();
56114
56114
  SessionExportErrors = { codes: {
56115
56115
  SESSION_EXPORT_NOT_FOUND: "session.export_not_found",
@@ -56119,6 +56119,16 @@ var init_errors$18 = __esmMin((() => {
56119
56119
  } };
56120
56120
  registerErrorDomain(SessionExportErrors);
56121
56121
  }));
56122
+ // ../../packages/agent-core-v2/src/features/serverTools/errors.ts
56123
+ var ServerToolsErrors;
56124
+ var init_errors$18 = __esmMin((() => {
56125
+ init_codes();
56126
+ ServerToolsErrors = { codes: {
56127
+ SERVER_TOOL_NOT_IN_CATALOG: "server_tools.not_in_catalog",
56128
+ SERVER_TOOL_DENIED: "server_tools.denied"
56129
+ } };
56130
+ registerErrorDomain(ServerToolsErrors);
56131
+ }));
56122
56132
  // ../../packages/agent-core-v2/src/session/errors.ts
56123
56133
  var SessionErrors;
56124
56134
  var init_errors$17 = __esmMin((() => {
@@ -56158,7 +56168,7 @@ var init_errors$16 = __esmMin((() => {
56158
56168
  var StateErrors, StateError;
56159
56169
  var init_errors$15 = __esmMin((() => {
56160
56170
  init_codes();
56161
- init_errors$39();
56171
+ init_errors$40();
56162
56172
  StateErrors = {
56163
56173
  codes: {
56164
56174
  STATE_DUPLICATE_FOLD: "state.duplicate_fold",
@@ -56229,7 +56239,7 @@ var StorageErrors, StorageError, REASONS, IFileSystemStorageService;
56229
56239
  var init_storage$1 = __esmMin((() => {
56230
56240
  init_instantiation();
56231
56241
  init_codes();
56232
- init_errors$39();
56242
+ init_errors$40();
56233
56243
  StorageErrors = {
56234
56244
  codes: {
56235
56245
  STORAGE_NOT_FOUND: "storage.not_found",
@@ -56324,7 +56334,7 @@ var init_errors$13 = __esmMin((() => {
56324
56334
  var WireErrors, WireError;
56325
56335
  var init_errors$12 = __esmMin((() => {
56326
56336
  init_codes();
56327
- init_errors$39();
56337
+ init_errors$40();
56328
56338
  WireErrors = {
56329
56339
  codes: {
56330
56340
  WIRE_UNKNOWN_RECORD: "wire.unknown_record",
@@ -56412,7 +56422,7 @@ function readErrorCause(error) {
56412
56422
  var MAX_CAUSE_DEPTH, toNexgenErrorPayload;
56413
56423
  var init_serialize$2 = __esmMin((() => {
56414
56424
  init_codes();
56415
- init_errors$39();
56425
+ init_errors$40();
56416
56426
  MAX_CAUSE_DEPTH = 8;
56417
56427
  toNexgenErrorPayload = toErrorPayload;
56418
56428
  }));
@@ -56463,24 +56473,25 @@ var init_unexpectedError = __esmMin((() => {
56463
56473
  var ErrorCodes;
56464
56474
  var init_errors$10 = __esmMin((() => {
56465
56475
  init_codes();
56476
+ init_errors$43();
56466
56477
  init_errors$42();
56467
56478
  init_errors$41();
56468
- init_errors$40();
56479
+ init_errors$37();
56469
56480
  init_errors$36();
56470
56481
  init_errors$35();
56471
56482
  init_errors$34();
56472
56483
  init_errors$33();
56473
56484
  init_errors$32();
56474
- init_errors$31();
56475
56485
  init_fileService();
56486
+ init_errors$29();
56476
56487
  init_errors$28();
56477
56488
  init_errors$27();
56478
56489
  init_errors$26();
56479
56490
  init_errors$25();
56480
56491
  init_errors$24();
56481
- init_errors$23();
56482
56492
  init_hostFsErrors();
56483
56493
  init_hostProcess();
56494
+ init_errors$23();
56484
56495
  init_errors$22();
56485
56496
  init_errors$21();
56486
56497
  init_errors$20();
@@ -56496,7 +56507,7 @@ var init_errors$10 = __esmMin((() => {
56496
56507
  init_errors$11();
56497
56508
  init_codes();
56498
56509
  init_errorMessage();
56499
- init_errors$39();
56510
+ init_errors$40();
56500
56511
  init_serialize$2();
56501
56512
  init_unexpectedError();
56502
56513
  ErrorCodes = {
@@ -56523,6 +56534,7 @@ var init_errors$10 = __esmMin((() => {
56523
56534
  ...PromptErrors.codes,
56524
56535
  ...ModelsDevImportErrors.codes,
56525
56536
  ...SessionExportErrors.codes,
56537
+ ...ServerToolsErrors.codes,
56526
56538
  ...SessionErrors.codes,
56527
56539
  ...SkillErrors.codes,
56528
56540
  ...StorageErrors.codes,
@@ -56610,7 +56622,7 @@ var HOOK_EVENT_TYPES$1, ProviderTypeSchema$1, OAuthRefSchema$2, StringRecordSche
56610
56622
  var init_schema$4 = __esmMin((() => {
56611
56623
  init_matchesRule();
56612
56624
  init_zod$1();
56613
- init_errors$43();
56625
+ init_errors$44();
56614
56626
  HOOK_EVENT_TYPES$1 = [
56615
56627
  "PreToolUse",
56616
56628
  "PostToolUse",
@@ -58039,7 +58051,7 @@ function rawThinking(config) {
58039
58051
  }
58040
58052
  var ENV_MODEL_PROVIDER_KEY$1, ENV_MODEL_ALIAS_KEY$1, ALLOWED_TYPES, DEFAULT_BASE_URL$1, DEFAULT_MAX_CONTEXT_SIZE$1, DEFAULT_CAPABILITIES$1;
58041
58053
  var init_env_model = __esmMin((() => {
58042
- init_errors$43();
58054
+ init_errors$44();
58043
58055
  init_resolve$1();
58044
58056
  init_schema$4();
58045
58057
  ENV_MODEL_PROVIDER_KEY$1 = "__nexgenk_env__";
@@ -58297,7 +58309,7 @@ function transformTomlData$1(data) {
58297
58309
  else if (targetKey === "models" && isPlainObject$6(value)) result[targetKey] = transformRecord(value, transformModelData);
58298
58310
  else if (targetKey === "thinking" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
58299
58311
  else if (targetKey === "permission" && isPlainObject$6(value)) result[targetKey] = transformPermissionData(value);
58300
- else if (targetKey === "services" && isPlainObject$6(value)) result[targetKey] = transformRecord(value, transformServiceData, snakeToCamel$2);
58312
+ else if (targetKey === "services" && isPlainObject$6(value)) result[targetKey] = migrateLegacyServiceKeys$1(transformRecord(value, transformServiceData, snakeToCamel$2));
58301
58313
  else if (targetKey === "loopControl" && isPlainObject$6(value)) result[targetKey] = transformLoopControlData(value);
58302
58314
  else if (targetKey === "background" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
58303
58315
  else if (targetKey === "image" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
@@ -58314,6 +58326,26 @@ function transformRecord(value, transformEntry, transformName = (name) => name)
58314
58326
  for (const [entryName, entryConfig] of Object.entries(value)) record[transformName(entryName)] = isPlainObject$6(entryConfig) ? transformEntry(entryConfig) : entryConfig;
58315
58327
  return record;
58316
58328
  }
58329
+ function migrateLegacyServiceKeys$1(services) {
58330
+ let out;
58331
+ for (const [legacy, current] of Object.entries(LEGACY_SERVICE_KEYS$1)) {
58332
+ if (!(legacy in services)) continue;
58333
+ out ??= { ...services };
58334
+ const shadowed = out[current] !== void 0;
58335
+ if (!shadowed) out[current] = out[legacy];
58336
+ delete out[legacy];
58337
+ reportLegacyServiceKey$1(legacy, current, shadowed);
58338
+ }
58339
+ return out ?? services;
58340
+ }
58341
+ function reportLegacyServiceKey$1(legacy, current, shadowed) {
58342
+ const key = `${legacy}->${current}`;
58343
+ if (reportedLegacyServiceKeys$1.has(key)) return;
58344
+ reportedLegacyServiceKeys$1.add(key);
58345
+ const from = `services.${legacy.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
58346
+ const to = `services.${current.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
58347
+ process.emitWarning(shadowed ? `${from} is obsolete and ignored because ${to} is already set; delete the old table.` : `${from} is obsolete; using it as ${to}. Rename the table to silence this warning.`, { code: "NEXGEN_CONFIG_LEGACY_SERVICE_KEY" });
58348
+ }
58317
58349
  function transformPlainObject$1(data) {
58318
58350
  const out = {};
58319
58351
  for (const [key, value] of Object.entries(data)) out[snakeToCamel$2(key)] = value;
@@ -58579,10 +58611,10 @@ function setDefined$1(target, key, value) {
58579
58611
  function isFileExistsError(error) {
58580
58612
  return typeof error === "object" && error !== null && error.code === "EEXIST";
58581
58613
  }
58582
- var DEFAULT_CONFIG_FILE_TEXT$1, ENTRY_KEYED_SECTIONS, PROVIDER_CREDENTIAL_FIELDS$1;
58614
+ var DEFAULT_CONFIG_FILE_TEXT$1, ENTRY_KEYED_SECTIONS, LEGACY_SERVICE_KEYS$1, reportedLegacyServiceKeys$1, PROVIDER_CREDENTIAL_FIELDS$1;
58583
58615
  var init_toml$1 = __esmMin((() => {
58584
58616
  init_dist$8();
58585
- init_errors$43();
58617
+ init_errors$44();
58586
58618
  init_fs$3();
58587
58619
  init_env_model();
58588
58620
  init_secondary_model();
@@ -58593,6 +58625,13 @@ var init_toml$1 = __esmMin((() => {
58593
58625
  # Login will populate managed Nexgen provider and model entries.
58594
58626
  `;
58595
58627
  ENTRY_KEYED_SECTIONS = /* @__PURE__ */ new Set(["providers", "models"]);
58628
+ LEGACY_SERVICE_KEYS$1 = {
58629
+ moonshotSearch: "nexgenSearch",
58630
+ moonshotFetch: "nexgenFetch",
58631
+ kimiSearch: "nexgenSearch",
58632
+ kimiFetch: "nexgenFetch"
58633
+ };
58634
+ reportedLegacyServiceKeys$1 = /* @__PURE__ */ new Set();
58596
58635
  PROVIDER_CREDENTIAL_FIELDS$1 = [
58597
58636
  "apiKey",
58598
58637
  "oauth",
@@ -64068,7 +64107,7 @@ function mapOAuthTokenError(error, providerName) {
64068
64107
  if (error instanceof OAuthConnectionError || error instanceof RetryableRefreshError) return new NexgenError(ErrorCodes$1.PROVIDER_CONNECTION_ERROR, `OAuth provider "${providerName}" failed to fetch an access token: ${error.message}`, { cause: error });
64069
64108
  }
64070
64109
  var init_oauth_error = __esmMin((() => {
64071
- init_errors$43();
64110
+ init_errors$44();
64072
64111
  init_src$13();
64073
64112
  }));
64074
64113
  // ../../packages/node-sdk/src/auth.ts
@@ -72982,7 +73021,7 @@ var init_ajv_provider = __esmMin((() => {
72982
73021
  }));
72983
73022
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
72984
73023
  var ExperimentalClientTasks;
72985
- var init_client$2 = __esmMin((() => {
73024
+ var init_client$3 = __esmMin((() => {
72986
73025
  init_types$27();
72987
73026
  ExperimentalClientTasks = class {
72988
73027
  constructor(_client) {
@@ -73232,12 +73271,12 @@ function getSupportedElicitationModes(capabilities) {
73232
73271
  };
73233
73272
  }
73234
73273
  var Client;
73235
- var init_client$1 = __esmMin((() => {
73274
+ var init_client$2 = __esmMin((() => {
73236
73275
  init_protocol$4();
73237
73276
  init_types$27();
73238
73277
  init_ajv_provider();
73239
73278
  init_zod_compat();
73240
- init_client$2();
73279
+ init_client$3();
73241
73280
  init_helpers$2();
73242
73281
  Client = class extends Protocol {
73243
73282
  /**
@@ -76306,7 +76345,7 @@ function buildMcpHttpHeaders(config, envLookup) {
76306
76345
  var HttpMcpClient;
76307
76346
  var init_client_http = __esmMin((() => {
76308
76347
  init_errors$10();
76309
- init_client$1();
76348
+ init_client$2();
76310
76349
  init_streamableHttp();
76311
76350
  init_client_shared();
76312
76351
  init_client_remote();
@@ -76433,7 +76472,7 @@ function isTerminalSseTransportError(error) {
76433
76472
  var SseMcpClient;
76434
76473
  var init_client_sse = __esmMin((() => {
76435
76474
  init_errors$10();
76436
- init_client$1();
76475
+ init_client$2();
76437
76476
  init_sse();
76438
76477
  init_client_shared();
76439
76478
  init_client_remote();
@@ -102230,7 +102269,7 @@ function classifyStdioStartupError(error) {
102230
102269
  }
102231
102270
  var STDERR_BUFFER_CAPACITY, STDIO_TERMINATION_GRACE_MS, StdioMcpClient, RuntimeStdioTransport, BoundedTail, permanentSpawnErrnos;
102232
102271
  var init_client_stdio = __esmMin((() => {
102233
- init_client$1();
102272
+ init_client$2();
102234
102273
  init_stdio();
102235
102274
  init_errors$10();
102236
102275
  init_hostProcess();
@@ -109093,7 +109132,7 @@ function createAppScope(options = {}) {
109093
109132
  }
109094
109133
  var _scopeTopology, _scopedRegistry, Scope;
109095
109134
  var init_scope = __esmMin((() => {
109096
- init_errors$39();
109135
+ init_errors$40();
109097
109136
  init_descriptors();
109098
109137
  init_instantiation();
109099
109138
  init_instantiationService();
@@ -111660,7 +111699,7 @@ function isRecord$25(value) {
111660
111699
  var SkillParseError, UnsupportedSkillTypeError, FENCE, METADATA_ALIASES;
111661
111700
  var init_parser$2 = __esmMin((() => {
111662
111701
  init_dist$5();
111663
- init_errors$39();
111702
+ init_errors$40();
111664
111703
  init_frontmatter();
111665
111704
  init_errors$16();
111666
111705
  init_types$24();
@@ -112485,7 +112524,7 @@ var ISessionLockService, SessionLockHolds;
112485
112524
  var init_sessionLock = __esmMin((() => {
112486
112525
  init_instantiation();
112487
112526
  init_lifecycle$2();
112488
- init_errors$39();
112527
+ init_errors$40();
112489
112528
  init_event$2();
112490
112529
  init_errors$17();
112491
112530
  ISessionLockService = createDecorator("sessionLockService");
@@ -113782,7 +113821,7 @@ function toJsonSafe(value, seen) {
113782
113821
  var StateRegistry;
113783
113822
  var init_stateRegistry = __esmMin((() => {
113784
113823
  init_lifecycle$2();
113785
- init_errors$39();
113824
+ init_errors$40();
113786
113825
  init_event$2();
113787
113826
  StateRegistry = class extends Disposable {
113788
113827
  values = /* @__PURE__ */ new Map();
@@ -114829,7 +114868,7 @@ function event2FromRecord(cls, record) {
114829
114868
  }
114830
114869
  var DuplicateEventError, Event2, AgentEvent2, EVENT2_REGISTRY;
114831
114870
  var init_event2 = __esmMin((() => {
114832
- init_errors$31();
114871
+ init_errors$32();
114833
114872
  DuplicateEventError = class extends EventError {
114834
114873
  eventType;
114835
114874
  constructor(eventType) {
@@ -114965,7 +115004,7 @@ function expandedRuntimeFolds(owner, undoable, folds) {
114965
115004
  var ReplayableStateKeyImpl, StateKeyBuilderImpl, undoableProtocol;
114966
115005
  var init_state$1 = __esmMin((() => {
114967
115006
  init_immer();
114968
- init_errors$39();
115007
+ init_errors$40();
114969
115008
  init_event2();
114970
115009
  init_errors$15();
114971
115010
  enableMapSet();
@@ -118432,7 +118471,7 @@ function swallowRootAbortError(actor) {
118432
118471
  var reportRootActorError, createActor;
118433
118472
  var init_xstate2 = __esmMin((() => {
118434
118473
  init_xstate_esm();
118435
- init_errors$38();
118474
+ init_errors$39();
118436
118475
  init_xstateInspection();
118437
118476
  init_xstate_esm();
118438
118477
  reportRootActorError = () => {};
@@ -122873,7 +122912,7 @@ function parseTimeoutMsEnv$2(raw) {
122873
122912
  return Number.isInteger(parsed) && parsed >= 1 && parsed <= 2147483647 ? parsed : void 0;
122874
122913
  }
122875
122914
  var McpSectionSchema, MCP_STARTUP_TIMEOUT_ENV, MCP_TOOL_TIMEOUT_ENV, MCP_RECONNECT_INITIAL_DELAY_ENV, MCP_RECONNECT_MAX_DELAY_ENV, mcpEnvBindings, stripMcpEnv;
122876
- var init_configSection$20 = __esmMin((() => {
122915
+ var init_configSection$21 = __esmMin((() => {
122877
122916
  init_zod$1();
122878
122917
  init_config$6();
122879
122918
  init_configSectionContributions();
@@ -123119,7 +123158,7 @@ var init_workspaceMcpConfigService = __esmMin((() => {
123119
123158
  init_bootstrap$1();
123120
123159
  init_config$6();
123121
123160
  init_configLoader();
123122
- init_configSection$20();
123161
+ init_configSection$21();
123123
123162
  init_configStore();
123124
123163
  init_plugin();
123125
123164
  init_hostFileSystem();
@@ -123608,7 +123647,7 @@ function builtinProductSkillsEnabled(config) {
123608
123647
  return config.get(BUILTIN_PRODUCT_SKILLS_SECTION) !== false;
123609
123648
  }
123610
123649
  var EXTRA_SKILL_DIRS_SECTION, ExtraSkillDirsConfigSchema, MERGE_ALL_AVAILABLE_SKILLS_SECTION, MergeAllAvailableSkillsConfigSchema, BUILTIN_PRODUCT_SKILLS_SECTION, BuiltinProductSkillsConfigSchema, BUILTIN_PRODUCT_SKILLS_ENV, builtinProductSkillsEnvBindings, stripBuiltinProductSkillsEnv;
123611
- var init_configSection$19 = __esmMin((() => {
123650
+ var init_configSection$20 = __esmMin((() => {
123612
123651
  init_zod$1();
123613
123652
  init_env$1();
123614
123653
  init_config$6();
@@ -123774,7 +123813,7 @@ var init_trustDisclosureService = __esmMin((() => {
123774
123813
  init_builtinAgentProfileLoader();
123775
123814
  init_workTree();
123776
123815
  init_configLoader();
123777
- init_configSection$19();
123816
+ init_configSection$20();
123778
123817
  init_skillRoots();
123779
123818
  EMPTY_INSTRUCTION_SOURCES$1 = {
123780
123819
  agentsMdPaths: [],
@@ -124029,7 +124068,7 @@ function isRecord$22(value) {
124029
124068
  var AgentFileParseError, AGENT_NAME_PATTERN;
124030
124069
  var init_agentFile = __esmMin((() => {
124031
124070
  init_codes();
124032
- init_errors$39();
124071
+ init_errors$40();
124033
124072
  init_frontmatter();
124034
124073
  AgentFileParseError = class extends Error2 {
124035
124074
  reason;
@@ -124501,7 +124540,7 @@ var init_agentRoots = __esmMin((() => {
124501
124540
  }));
124502
124541
  // ../../packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/configSection.ts
124503
124542
  var EXTRA_AGENT_DIRS_SECTION, ExtraAgentDirsConfigSchema;
124504
- var init_configSection$18 = __esmMin((() => {
124543
+ var init_configSection$19 = __esmMin((() => {
124505
124544
  init_zod$1();
124506
124545
  init_configSectionContributions();
124507
124546
  EXTRA_AGENT_DIRS_SECTION = "extraAgentDirs";
@@ -124529,7 +124568,7 @@ var init_extraAgentProfileLoaderService = __esmMin((() => {
124529
124568
  init_agentProfileContribution();
124530
124569
  init_agentProfileFromFile();
124531
124570
  init_agentRoots();
124532
- init_configSection$18();
124571
+ init_configSection$19();
124533
124572
  init_userAgentProfileLoader();
124534
124573
  init_bootstrap$1();
124535
124574
  init_config$6();
@@ -124925,7 +124964,7 @@ var init_extraFileSkillSource = __esmMin((() => {
124925
124964
  init_event$2();
124926
124965
  init_bootstrap$1();
124927
124966
  init_config$6();
124928
- init_configSection$19();
124967
+ init_configSection$20();
124929
124968
  init_skillRoots();
124930
124969
  init_skillDiscovery();
124931
124970
  init_skillSource();
@@ -125001,7 +125040,7 @@ var init_rootFileSkillSource = __esmMin((() => {
125001
125040
  init_paths$3();
125002
125041
  init_config$6();
125003
125042
  init_bootstrap$1();
125004
- init_configSection$19();
125043
+ init_configSection$20();
125005
125044
  init_skillDiscovery();
125006
125045
  init_skillRoots();
125007
125046
  init_skillSource();
@@ -125308,7 +125347,7 @@ var init_toml = __esmMin((() => {
125308
125347
  }));
125309
125348
  // ../../packages/agent-core-v2/src/app/flag/flag.ts
125310
125349
  var EXPERIMENTAL_SECTION, ExperimentalConfigSchema, experimentalFromToml, experimentalToToml, IFlagService;
125311
- var init_flag$5 = __esmMin((() => {
125350
+ var init_flag$6 = __esmMin((() => {
125312
125351
  init_zod$1();
125313
125352
  init_instantiation();
125314
125353
  init_configSectionContributions();
@@ -125599,9 +125638,9 @@ var init_builtinSkillSource = __esmMin((() => {
125599
125638
  init_scopes();
125600
125639
  init_scope();
125601
125640
  init_config$6();
125602
- init_flag$5();
125641
+ init_flag$6();
125603
125642
  init_builtin();
125604
- init_configSection$19();
125643
+ init_configSection$20();
125605
125644
  init_skillSource();
125606
125645
  init_decorateParam();
125607
125646
  init_decorate();
@@ -125862,7 +125901,7 @@ var init_userFileSkillSource = __esmMin((() => {
125862
125901
  init_timer();
125863
125902
  init_paths$3();
125864
125903
  init_watch();
125865
- init_configSection$19();
125904
+ init_configSection$20();
125866
125905
  init_skillDiscovery();
125867
125906
  init_skillRoots();
125868
125907
  init_skillSource();
@@ -127041,7 +127080,7 @@ var init_logService = __esmMin((() => {
127041
127080
  }));
127042
127081
  // ../../packages/agent-core-v2/src/features/plan/configSection.ts
127043
127082
  var DEFAULT_PLAN_MODE_SECTION, DefaultPlanModeSchema;
127044
- var init_configSection$17 = __esmMin((() => {
127083
+ var init_configSection$18 = __esmMin((() => {
127045
127084
  init_zod$1();
127046
127085
  init_configSectionContributions();
127047
127086
  DEFAULT_PLAN_MODE_SECTION = "defaultPlanMode";
@@ -127184,7 +127223,7 @@ function agentModelDefinitions() {
127184
127223
  var AgentModel, AGENT_MODEL_DEFINITIONS, AgentModelContribution, SessionModelContribution;
127185
127224
  var init_agentModel = __esmMin((() => {
127186
127225
  init_collection();
127187
- init_errors$39();
127226
+ init_errors$40();
127188
127227
  init_event2();
127189
127228
  AgentModel = class {
127190
127229
  committedState;
@@ -127274,7 +127313,7 @@ function agentSpaceOf(agent) {
127274
127313
  }
127275
127314
  var AgentSpaceImpl;
127276
127315
  var init_agentSpace = __esmMin((() => {
127277
- init_errors$39();
127316
+ init_errors$40();
127278
127317
  init_unexpectedError();
127279
127318
  init_agentModel();
127280
127319
  AgentSpaceImpl = class {
@@ -172007,7 +172046,7 @@ async function touchForkedFileHistory(input) {
172007
172046
  var RETENTION_DOC_SCOPE, touchQueues;
172008
172047
  var init_fileHistoryRetention = __esmMin((() => {
172009
172048
  init_dist$5();
172010
- init_errors$39();
172049
+ init_errors$40();
172011
172050
  init_unexpectedError();
172012
172051
  init_fileHistory$1();
172013
172052
  RETENTION_DOC_SCOPE = "file-history";
@@ -172156,7 +172195,7 @@ var AgentFileHistoryService, LCS_CELL_BUDGET, LCS_AGGREGATE_CELL_BUDGET;
172156
172195
  var init_fileHistoryService = __esmMin((() => {
172157
172196
  init_dist$5();
172158
172197
  init_service$1();
172159
- init_errors$39();
172198
+ init_errors$40();
172160
172199
  init_unexpectedError();
172161
172200
  init_agentRuntime();
172162
172201
  init_scopeContext();
@@ -172578,8 +172617,8 @@ function isMaxStepsExceededError$1(error) {
172578
172617
  var LoopError, IAgentLoopService;
172579
172618
  var init_loop = __esmMin((() => {
172580
172619
  init_instantiation();
172581
- init_errors$39();
172582
- init_errors$25();
172620
+ init_errors$40();
172621
+ init_errors$26();
172583
172622
  LoopError = class extends Error2 {
172584
172623
  constructor(code, message, options) {
172585
172624
  super(code, message, options);
@@ -173625,7 +173664,7 @@ var init_flagRegistry = __esmMin((() => {
173625
173664
  }));
173626
173665
  // ../../packages/agent-core-v2/src/features/notify/flag.ts
173627
173666
  var NOTIFY_USER_FLAG_ID, NOTIFY_USER_FLAG_ENV, notifyUserFlag;
173628
- var init_flag$4 = __esmMin((() => {
173667
+ var init_flag$5 = __esmMin((() => {
173629
173668
  init_flagRegistry();
173630
173669
  NOTIFY_USER_FLAG_ID = "notify_user";
173631
173670
  NOTIFY_USER_FLAG_ENV = "NEXGEN_EXPERIMENTAL_NOTIFY_USER";
@@ -173646,7 +173685,7 @@ function notifyUserAvailable(flags, bootstrap) {
173646
173685
  }
173647
173686
  var NOTIFY_USER_UI_CAPABILITY;
173648
173687
  var init_notifyUserAvailability = __esmMin((() => {
173649
- init_flag$4();
173688
+ init_flag$5();
173650
173689
  NOTIFY_USER_UI_CAPABILITY = "update_panel";
173651
173690
  }));
173652
173691
  // ../../packages/agent-core-v2/src/features/notify/sessionNotify.ts
@@ -173656,7 +173695,7 @@ var init_sessionNotify = __esmMin((() => {
173656
173695
  init_scopes();
173657
173696
  init_scope();
173658
173697
  init_bootstrap$1();
173659
- init_flag$5();
173698
+ init_flag$6();
173660
173699
  init_atomicDocumentStore$1();
173661
173700
  init_appendLogStore$1();
173662
173701
  init_sessionContext();
@@ -174264,11 +174303,11 @@ var init_sessionLifecycleService = __esmMin((() => {
174264
174303
  init_dist$5();
174265
174304
  init_lifecycle$2();
174266
174305
  init_scope();
174267
- init_errors$39();
174306
+ init_errors$40();
174268
174307
  init_event$2();
174269
174308
  init_log$1();
174270
174309
  init_logService();
174271
- init_configSection$17();
174310
+ init_configSection$18();
174272
174311
  init_fileHistory$1();
174273
174312
  init_fileHistoryService();
174274
174313
  init_fileHistoryRetention();
@@ -174278,7 +174317,7 @@ var init_sessionLifecycleService = __esmMin((() => {
174278
174317
  init_bootstrap$1();
174279
174318
  init_config$6();
174280
174319
  init_event$1();
174281
- init_flag$5();
174320
+ init_flag$6();
174282
174321
  init_sessionIndex();
174283
174322
  init_sessionIndexSource();
174284
174323
  init_telemetry$2();
@@ -174989,7 +175028,7 @@ var init_workspaceInstanceManagerService = __esmMin((() => {
174989
175028
  init_bootstrap$1();
174990
175029
  init_config$6();
174991
175030
  init_event$1();
174992
- init_flag$5();
175031
+ init_flag$6();
174993
175032
  init_git();
174994
175033
  init_oauthService();
174995
175034
  init_configStore();
@@ -175635,7 +175674,7 @@ var init_node$8 = __esmMin((() => {
175635
175674
  var AgentActorService;
175636
175675
  var init_agentActorService = __esmMin((() => {
175637
175676
  init_xstate2();
175638
- init_errors$39();
175677
+ init_errors$40();
175639
175678
  init_unexpectedError();
175640
175679
  init_instantiation();
175641
175680
  init_lifecycle$2();
@@ -175804,7 +175843,7 @@ function parsePollIntervalMs(raw) {
175804
175843
  return parsed;
175805
175844
  }
175806
175845
  var CRON_SECTION, DEFAULT_CRON_CONFIG, cronConfigSchema, on$1, cronEnvBindings, stripCronEnv;
175807
- var init_configSection$16 = __esmMin((() => {
175846
+ var init_configSection$17 = __esmMin((() => {
175808
175847
  init_config$6();
175809
175848
  init_configSectionContributions();
175810
175849
  CRON_SECTION = "cron";
@@ -177016,7 +177055,7 @@ var init_cronService = __esmMin((() => {
177016
177055
  init_event2();
177017
177056
  init_config$6();
177018
177057
  init_clock();
177019
- init_configSection$16();
177058
+ init_configSection$17();
177020
177059
  init_cron_expr();
177021
177060
  init_format$6();
177022
177061
  init_jitter();
@@ -179042,7 +179081,7 @@ var HostEnvironmentService;
179042
179081
  var init_hostEnvironmentService = __esmMin((() => {
179043
179082
  init_scopes();
179044
179083
  init_scope();
179045
- init_errors$39();
179084
+ init_errors$40();
179046
179085
  init_environmentProbe();
179047
179086
  init_loginShellPath();
179048
179087
  init_hostEnvironment();
@@ -179946,7 +179985,7 @@ function parsePrintBackgroundMode(raw) {
179946
179985
  return parsed.success ? parsed.data : void 0;
179947
179986
  }
179948
179987
  var TASK_SECTION, LEGACY_BACKGROUND_SECTION, PrintBackgroundModeSchema, AgentTaskConfigSchema, KEEP_ALIVE_ON_EXIT_ENV, MAX_RUNNING_TASKS_ENV, BASH_TASK_TIMEOUT_S_ENV, PRINT_WAIT_CEILING_S_ENV, PRINT_BACKGROUND_MODE_ENV, PRINT_MAX_TURNS_ENV, taskEnvBindings, stripTaskEnv;
179949
- var init_configSection$15 = __esmMin((() => {
179988
+ var init_configSection$16 = __esmMin((() => {
179950
179989
  init_zod$1();
179951
179990
  init_env$1();
179952
179991
  init_config$6();
@@ -180592,7 +180631,7 @@ function rewriteWindowsNullRedirect(command) {
180592
180631
  var MS_PER_SECOND, SHELL_TIMEOUT_VARS, BashTool, WINDOWS_NUL_REDIRECT;
180593
180632
  var init_bashTool = __esmMin((() => {
180594
180633
  init_task$3();
180595
- init_configSection$15();
180634
+ init_configSection$16();
180596
180635
  init_config$6();
180597
180636
  init_sessionContext();
180598
180637
  init_workspaceContext();
@@ -185629,9 +185668,9 @@ var IOAuthService, IOAuthToolkit, IAuthSummaryService, AuthProvisioningRequiredE
185629
185668
  var init_auth$5 = __esmMin((() => {
185630
185669
  init_provider_credential();
185631
185670
  init_instantiation();
185632
- init_errors$39();
185633
- init_errors$37();
185634
- init_errors$41();
185671
+ init_errors$40();
185672
+ init_errors$38();
185673
+ init_errors$42();
185635
185674
  IOAuthService = createDecorator("oauthService");
185636
185675
  IOAuthToolkit = createDecorator("oauthToolkit");
185637
185676
  IAuthSummaryService = createDecorator("authSummaryService");
@@ -185753,7 +185792,7 @@ var init_globTool = __esmMin((() => {
185753
185792
  init_rgLocator();
185754
185793
  init_runRg$1();
185755
185794
  init_agentRuntime();
185756
- init_errors$39();
185795
+ init_errors$40();
185757
185796
  init_runtimeWorkspaceView();
185758
185797
  init_skillCatalog();
185759
185798
  init_workspaceContext();
@@ -186349,7 +186388,7 @@ var init_grepTool = __esmMin((() => {
186349
186388
  init_toolContribution();
186350
186389
  init_agentRuntime();
186351
186390
  init_runtimeWorkspaceView();
186352
- init_errors$39();
186391
+ init_errors$40();
186353
186392
  init_skillCatalog();
186354
186393
  init_workspaceContext();
186355
186394
  init_path_access();
@@ -186658,8 +186697,8 @@ var init_sessionMediaStore = __esmMin((() => {
186658
186697
  var ProfileError, IAgentProfileService;
186659
186698
  var init_profile$1 = __esmMin((() => {
186660
186699
  init_instantiation();
186661
- init_errors$39();
186662
- init_errors$21();
186700
+ init_errors$40();
186701
+ init_errors$22();
186663
186702
  ProfileError = class extends Error2 {
186664
186703
  constructor(code, message, details) {
186665
186704
  super(code, message, { details });
@@ -186859,7 +186898,7 @@ var init_toolResultTruncation = __esmMin((() => {
186859
186898
  }));
186860
186899
  // ../../packages/agent-core-v2/src/agent/tools/os/read/configSection.ts
186861
186900
  var READ_SECTION, ReadConfigSchema;
186862
- var init_configSection$14 = __esmMin((() => {
186901
+ var init_configSection$15 = __esmMin((() => {
186863
186902
  init_zod$1();
186864
186903
  init_configSectionContributions();
186865
186904
  READ_SECTION = "read";
@@ -186946,7 +186985,7 @@ var init_readTool = __esmMin((() => {
186946
186985
  init_mediaRef$1();
186947
186986
  init_fileReadSource();
186948
186987
  init_runtimeWorkspaceView();
186949
- init_errors$39();
186988
+ init_errors$40();
186950
186989
  init_skillCatalog();
186951
186990
  init_workspaceContext();
186952
186991
  init_config$6();
@@ -186962,7 +187001,7 @@ var init_readTool = __esmMin((() => {
186962
187001
  init_render_prompt();
186963
187002
  init_read$1();
186964
187003
  init_toolResultTruncation();
186965
- init_configSection$14();
187004
+ init_configSection$15();
186966
187005
  init_read();
186967
187006
  init_decorateParam();
186968
187007
  init_decorate();
@@ -187432,7 +187471,7 @@ var init_writeTool = __esmMin((() => {
187432
187471
  init_dist$5();
187433
187472
  init_agentRuntime();
187434
187473
  init_runtimeWorkspaceView();
187435
- init_errors$39();
187474
+ init_errors$40();
187436
187475
  init_skillCatalog();
187437
187476
  init_workspaceContext();
187438
187477
  init_toolContract();
@@ -187953,7 +187992,7 @@ var EventStateContribution;
187953
187992
  var init_stateContribution = __esmMin((() => {
187954
187993
  init_collection();
187955
187994
  init_unexpectedError();
187956
- init_errors$31();
187995
+ init_errors$32();
187957
187996
  init_event2();
187958
187997
  init_state$1();
187959
187998
  EventStateContribution = collection("event-state");
@@ -188028,7 +188067,7 @@ function sanitizePendingUndo(ctx, meta) {
188028
188067
  var MAX_DRAIN, DISPATCH_STUCK_WARN_MS, replayImmer$1, UNREPORTED_WIRE_RECORD_TYPES, CycleError, FoldContextImpl, EventDispatcherService;
188029
188068
  var init_eventDispatcherService = __esmMin((() => {
188030
188069
  init_immer();
188031
- init_errors$39();
188070
+ init_errors$40();
188032
188071
  init_unexpectedError();
188033
188072
  init_log$1();
188034
188073
  init_service$1();
@@ -189217,7 +189256,7 @@ function databaseSearchSyncTuning(config) {
189217
189256
  };
189218
189257
  }
189219
189258
  var DATABASE_SECTION, PERSISTENCE_MINIDB_READMODEL_ENV, SEARCH_WORKER_ENV, SEARCH_SYNC_SESSION_CAP_ENV, SEARCH_SYNC_DEBOUNCE_MS_ENV, DatabaseConfigSchema, databaseEnvBindings, stripDatabaseEnv;
189220
- var init_configSection$13 = __esmMin((() => {
189259
+ var init_configSection$14 = __esmMin((() => {
189221
189260
  init_zod$1();
189222
189261
  init_env$1();
189223
189262
  init_config$6();
@@ -189627,7 +189666,7 @@ var init_sessionIndexService = __esmMin((() => {
189627
189666
  init_telemetry$2();
189628
189667
  init_workspaceAlias();
189629
189668
  init_errors$10();
189630
- init_configSection$13();
189669
+ init_configSection$14();
189631
189670
  init_atomicDocumentStore$1();
189632
189671
  init_queryStore();
189633
189672
  init_storage$1();
@@ -190168,7 +190207,7 @@ var init_sessionIndexMirrorService = __esmMin((() => {
190168
190207
  init_bootstrap$1();
190169
190208
  init_config$6();
190170
190209
  init_telemetry$2();
190171
- init_configSection$13();
190210
+ init_configSection$14();
190172
190211
  init_queryStore();
190173
190212
  init_storage$1();
190174
190213
  init_sessionIndex();
@@ -191508,7 +191547,7 @@ var ContextUndone, AgentConversationUndoService;
191508
191547
  var init_undoService = __esmMin((() => {
191509
191548
  init_lifecycle$2();
191510
191549
  init_service$1();
191511
- init_errors$39();
191550
+ init_errors$40();
191512
191551
  init_scopes();
191513
191552
  init_scope();
191514
191553
  init_log$1();
@@ -191876,7 +191915,7 @@ var SESSION_LOCK_RELEASE_DELAY_MS, SessionRunGateService;
191876
191915
  var init_sessionRunGateService = __esmMin((() => {
191877
191916
  init_lifecycle$2();
191878
191917
  init_scope();
191879
- init_errors$39();
191918
+ init_errors$40();
191880
191919
  init_scopes();
191881
191920
  init_appendLogStore$1();
191882
191921
  init_sessionLock();
@@ -192096,7 +192135,7 @@ var init_host_request_headers = __esmMin((() => {
192096
192135
  }));
192097
192136
  // ../../packages/agent-core-v2/src/human/llm/requester/bases/anthropic/contract.ts
192098
192137
  var CONTEXT_MANAGEMENT_BETA;
192099
- var init_contract$2 = __esmMin((() => {
192138
+ var init_contract$3 = __esmMin((() => {
192100
192139
  CONTEXT_MANAGEMENT_BETA = "context-management-2025-06-27";
192101
192140
  }));
192102
192141
  // ../../packages/agent-core-v2/src/human/llm/syntax-errors.ts
@@ -192498,6 +192537,10 @@ function convertNexgenTool(tool) {
192498
192537
  type: "builtin_function",
192499
192538
  function: { name: tool.name }
192500
192539
  };
192540
+ if (tool.name.startsWith("openrouter:")) return {
192541
+ type: tool.name,
192542
+ parameters: tool.parameters
192543
+ };
192501
192544
  return {
192502
192545
  type: "function",
192503
192546
  function: {
@@ -192515,7 +192558,7 @@ function nexgenkUnsetCompletionTokens(input) {
192515
192558
  var NEXGEN_API_KEY_ENV, NEXGEN_BASE_URL_ENV$1, NEXGEN_DEFAULT_BASE_URL, nexgenkEndpoint$1, nexgenkConnection, nexgenkAcceptedImageMimes, nexgenkResponsesTrait, nexgenkOpenAITrait, nexgenkAnthropicTrait;
192516
192559
  var init_trait = __esmMin((() => {
192517
192560
  init_image_formats();
192518
- init_contract$2();
192561
+ init_contract$3();
192519
192562
  init_schema$3();
192520
192563
  NEXGEN_API_KEY_ENV = "NEXGEN_API_KEY";
192521
192564
  NEXGEN_BASE_URL_ENV$1 = "NEXGEN_BASE_URL";
@@ -192632,7 +192675,7 @@ function classifyNexgenQuotaError(error) {
192632
192675
  }
192633
192676
  var NEXGEN_QUOTA_EXHAUSTED_ERROR_CODES, NEXGEN_QUOTA_EXHAUSTED_MESSAGE_PATTERNS;
192634
192677
  var init_errors$4 = __esmMin((() => {
192635
- init_errors$38();
192678
+ init_errors$39();
192636
192679
  NEXGEN_QUOTA_EXHAUSTED_ERROR_CODES = /* @__PURE__ */ new Set(["exceeded_current_quota_error"]);
192637
192680
  NEXGEN_QUOTA_EXHAUSTED_MESSAGE_PATTERNS = [
192638
192681
  /exceeded your current (?:token )?quota/,
@@ -192729,7 +192772,7 @@ function firstEnvHit(names, env) {
192729
192772
  }
192730
192773
  var openAIConnection, anthropicConnection, geminiEndpoint, vertexEndpoint, geminiConnection, vertexConnection, nexgenkEndpoint, providerDefinitions;
192731
192774
  var init_provider_definition = __esmMin((() => {
192732
- init_errors$39();
192775
+ init_errors$40();
192733
192776
  init_trait();
192734
192777
  init_errors$4();
192735
192778
  openAIConnection = { endpoint: () => ({
@@ -193078,7 +193121,7 @@ var init_configEvents = __esmMin((() => {
193078
193121
  }));
193079
193122
  // ../../packages/agent-core-v2/src/app/watch/configSection.ts
193080
193123
  var WATCH_SECTION, WatchConfigSchema, watchEnvBindings, stripWatchEnv;
193081
- var init_configSection$12 = __esmMin((() => {
193124
+ var init_configSection$13 = __esmMin((() => {
193082
193125
  init_zod$1();
193083
193126
  init_env$1();
193084
193127
  init_config$6();
@@ -193855,7 +193898,7 @@ var init_configService = __esmMin((() => {
193855
193898
  init_log$1();
193856
193899
  init_atomicDocumentStore$1();
193857
193900
  init_watch();
193858
- init_configSection$12();
193901
+ init_configSection$13();
193859
193902
  init_config$6();
193860
193903
  init_configPure();
193861
193904
  init_configSectionContributions();
@@ -194531,7 +194574,7 @@ function modelOverridesToToml(overrides, rawSnake) {
194531
194574
  return out;
194532
194575
  }
194533
194576
  var PROVIDERS_SECTION, DEFAULT_PROVIDER_SECTION, ENV_MODEL_PROVIDER_KEY, ProviderTypeSchema, OAuthRefSchema$1, ModelSourceSchema, StringRecordSchema$1, ProviderConfigSchema, ProvidersSectionSchema, providersEnvBindings, stripProvidersEnv, providersFromToml, providersToToml, PROVIDER_CREDENTIAL_FIELDS, MODELS_SECTION, DEFAULT_MODEL_SECTION, ModelBaseSchema, ModelOverrideSchema, ModelRecordSchema, ModelsSectionSchema, MODEL_OBJECT_FIELDS, modelsFromToml, modelsToToml, THINKING_SECTION, ThinkingConfigSchema, thinkingEnvBindings, stripThinkingEnv, MODEL_CATALOG_SECTION, ModelCatalogConfigSchema;
194534
- var init_configSection$11 = __esmMin((() => {
194577
+ var init_configSection$12 = __esmMin((() => {
194535
194578
  init_zod$1();
194536
194579
  init_config$6();
194537
194580
  init_configSectionContributions();
@@ -196020,12 +196063,12 @@ function convertAnthropicError(error, classifyErrorHook) {
196020
196063
  var CLEAR_THINKING_EDIT, CACHE_CONTROL, CACHEABLE_TYPES;
196021
196064
  var init_format$4 = __esmMin((() => {
196022
196065
  init_sdk();
196023
- init_errors$38();
196066
+ init_errors$39();
196024
196067
  init_finish_reason();
196025
196068
  init_syntax_errors();
196026
196069
  init_patterns$3();
196027
196070
  init_rewrite();
196028
- init_contract$2();
196071
+ init_contract$3();
196029
196072
  init_lower$3();
196030
196073
  init_patterns$2();
196031
196074
  init_profile();
@@ -196222,7 +196265,7 @@ var ANTHROPIC_TOOL_CALL_ID_POLICY, anthropicBase, anthropicBetaBase;
196222
196265
  var init_requester$4 = __esmMin((() => {
196223
196266
  init_sdk();
196224
196267
  init_radashi();
196225
- init_errors$38();
196268
+ init_errors$39();
196226
196269
  init_image_formats();
196227
196270
  init_syntax_errors();
196228
196271
  init_connection();
@@ -196700,7 +196743,7 @@ function parseRetryInfoDelayMs(message) {
196700
196743
  var NETWORK_RE, TIMEOUT_RE;
196701
196744
  var init_format$3 = __esmMin((() => {
196702
196745
  init_node$9();
196703
- init_errors$38();
196746
+ init_errors$39();
196704
196747
  init_finish_reason();
196705
196748
  init_thinking$2();
196706
196749
  init_patterns$3();
@@ -197259,6 +197302,7 @@ function lowerOpenAIMessages(input, options) {
197259
197302
  })));
197260
197303
  }
197261
197304
  function assembleOpenAIRequest(input, parts) {
197305
+ if (Object.hasOwn(parts.kwargs, "tools")) throw new SyntaxRequestFormatError("extra_params.openai.tools is not supported: the tool list comes from the agent tool registry, and a value here would silently replace it.");
197262
197306
  return {
197263
197307
  model: input.model.model,
197264
197308
  messages: parts.messages,
@@ -197410,8 +197454,9 @@ function convertOpenAIError(error, classifyErrorHook) {
197410
197454
  var CHAT_COMPLETIONS_MAX_OUTPUT_TOKENS_CEILING;
197411
197455
  var init_format$2 = __esmMin((() => {
197412
197456
  init_openai();
197413
- init_errors$38();
197457
+ init_errors$39();
197414
197458
  init_finish_reason();
197459
+ init_syntax_errors();
197415
197460
  init_patterns$3();
197416
197461
  init_rewrite();
197417
197462
  init_lower$1();
@@ -197602,7 +197647,7 @@ var OPENAI_CHAT_TOOL_CALL_ID_POLICY, openAIBase;
197602
197647
  var init_requester$2 = __esmMin((() => {
197603
197648
  init_openai();
197604
197649
  init_radashi();
197605
- init_errors$38();
197650
+ init_errors$39();
197606
197651
  init_model();
197607
197652
  init_syntax_errors();
197608
197653
  init_connection();
@@ -198388,7 +198433,7 @@ var OPENAI_RESPONSES_TOOL_CALL_ID_POLICY, openAIResponsesBase;
198388
198433
  var init_requester$1 = __esmMin((() => {
198389
198434
  init_openai();
198390
198435
  init_radashi();
198391
- init_errors$38();
198436
+ init_errors$39();
198392
198437
  init_syntax_errors();
198393
198438
  init_connection();
198394
198439
  init_thinking$3();
@@ -198585,7 +198630,7 @@ function parseIdentityEnv(raw) {
198585
198630
  return trimmed.length > 0 ? trimmed : void 0;
198586
198631
  }
198587
198632
  var IDENTITY_SECTION, IdentityConfigSchema, IDENTITY_NAME_ENV, IDENTITY_SLUG_ENV, identityEnvBindings, stripIdentityEnv;
198588
- var init_configSection$10 = __esmMin((() => {
198633
+ var init_configSection$11 = __esmMin((() => {
198589
198634
  init_zod$1();
198590
198635
  init_config$6();
198591
198636
  init_configSectionContributions();
@@ -198619,11 +198664,11 @@ var init_agentIdentityService = __esmMin((() => {
198619
198664
  init_scopes();
198620
198665
  init_scope();
198621
198666
  init_codes();
198622
- init_errors$39();
198667
+ init_errors$40();
198623
198668
  init_bootstrap$1();
198624
198669
  init_config$6();
198625
198670
  init_agentIdentity();
198626
- init_configSection$10();
198671
+ init_configSection$11();
198627
198672
  init_decorateParam();
198628
198673
  init_decorate();
198629
198674
  AgentIdentityService = class AgentIdentityService {
@@ -198713,11 +198758,11 @@ function collectModelOverrides(input) {
198713
198758
  var ENV_MODEL_ALIAS_KEY, DEFAULT_MAX_CONTEXT_SIZE, DEFAULT_CAPABILITIES, nexgenkModelEnvOverlay;
198714
198759
  var init_envOverlay = __esmMin((() => {
198715
198760
  init_env$1();
198716
- init_errors$39();
198761
+ init_errors$40();
198717
198762
  init_configOverlayContributions();
198718
- init_errors$37();
198763
+ init_errors$38();
198719
198764
  init_provider_definition();
198720
- init_configSection$11();
198765
+ init_configSection$12();
198721
198766
  ENV_MODEL_ALIAS_KEY = "__nexgenk_env_model__";
198722
198767
  DEFAULT_MAX_CONTEXT_SIZE = 262144;
198723
198768
  DEFAULT_CAPABILITIES = ["image_in", "thinking"];
@@ -199120,10 +199165,10 @@ function nonEmpty$3(value) {
199120
199165
  return trimmed === void 0 || trimmed.length === 0 ? void 0 : trimmed;
199121
199166
  }
199122
199167
  var init_model_auth = __esmMin((() => {
199123
- init_errors$39();
199168
+ init_errors$40();
199124
199169
  init_provider_credential();
199125
199170
  init_profile();
199126
- init_errors$37();
199171
+ init_errors$38();
199127
199172
  init_protocol$2();
199128
199173
  init_provider_definition();
199129
199174
  init_thinking$1();
@@ -199184,7 +199229,7 @@ function globalDefaultForProvider(models, globalDefaultModel, providerId) {
199184
199229
  return models[globalDefaultModel]?.provider === providerId ? globalDefaultModel : void 0;
199185
199230
  }
199186
199231
  var modelCatalogItemSchema$1, providerCatalogStatusSchema$1, providerCatalogItemSchema$1, setDefaultModelResponseSchema$1, IModelCatalog;
199187
- var init_catalog$2 = __esmMin((() => {
199232
+ var init_catalog$3 = __esmMin((() => {
199188
199233
  init_zod$1();
199189
199234
  init_instantiation();
199190
199235
  init_model_auth();
@@ -199253,7 +199298,7 @@ function applyCredential(model, credential) {
199253
199298
  }
199254
199299
  var CREDENTIALS_RECOVERY_ID, credentialsRecovery;
199255
199300
  var init_credentials$1 = __esmMin((() => {
199256
- init_errors$38();
199301
+ init_errors$39();
199257
199302
  init_requester$5();
199258
199303
  CREDENTIALS_RECOVERY_ID = "credentials";
199259
199304
  credentialsRecovery = { propose: ({ error, appliedRecoveries, credentialProvider }) => {
@@ -200139,10 +200184,10 @@ var init_model_requester_impl = __esmMin((() => {
200139
200184
  init_finish_reason();
200140
200185
  init_message$2();
200141
200186
  init_credentials$1();
200142
- init_errors$37();
200187
+ init_errors$38();
200143
200188
  init_message$1();
200144
200189
  init_usage$1();
200145
- init_errors$36();
200190
+ init_errors$37();
200146
200191
  ModelRequesterImpl = class {
200147
200192
  model;
200148
200193
  gateway;
@@ -200434,16 +200479,16 @@ var init_catalog_service = __esmMin((() => {
200434
200479
  init_lifecycle$2();
200435
200480
  init_scopes();
200436
200481
  init_scope();
200437
- init_errors$39();
200482
+ init_errors$40();
200438
200483
  init_credentials$1();
200439
- init_errors$37();
200484
+ init_errors$38();
200440
200485
  init_protocol$2();
200441
200486
  init_provider$1();
200442
200487
  init_provider_definition();
200443
- init_catalog$2();
200488
+ init_catalog$3();
200444
200489
  init_catalog_runtime();
200445
200490
  init_credential_recovery();
200446
- init_errors$23();
200491
+ init_errors$24();
200447
200492
  init_host_request_headers();
200448
200493
  init_model$1();
200449
200494
  init_model_auth();
@@ -200818,7 +200863,7 @@ var init_kosongConfigService = __esmMin((() => {
200818
200863
  init_model$1();
200819
200864
  init_provider$1();
200820
200865
  init_kosongConfig();
200821
- init_configSection$11();
200866
+ init_configSection$12();
200822
200867
  init_decorateParam();
200823
200868
  init_decorate();
200824
200869
  PERSIST_MAX_ATTEMPTS = 3;
@@ -200935,9 +200980,9 @@ var ModelOAuthTokenAdapter;
200935
200980
  var init_oauthTokenAdapter = __esmMin((() => {
200936
200981
  init_scopes();
200937
200982
  init_scope();
200938
- init_errors$39();
200983
+ init_errors$40();
200939
200984
  init_auth$5();
200940
- init_errors$41();
200985
+ init_errors$42();
200941
200986
  init_model_auth();
200942
200987
  init_model_oauth();
200943
200988
  init_decorateParam();
@@ -201059,18 +201104,18 @@ var init_discoveryService = __esmMin((() => {
201059
201104
  init_lifecycle$2();
201060
201105
  init_scope();
201061
201106
  init_event$2();
201062
- init_errors$39();
201107
+ init_errors$40();
201063
201108
  init_auth$5();
201064
- init_errors$41();
201109
+ init_errors$42();
201065
201110
  init_agentIdentity();
201066
201111
  init_config$6();
201067
201112
  init_event$1();
201068
- init_errors$23();
201113
+ init_errors$24();
201069
201114
  init_model$1();
201070
201115
  init_model_auth();
201071
201116
  init_provider$1();
201072
201117
  init_provider_definition();
201073
- init_configSection$11();
201118
+ init_configSection$12();
201074
201119
  init_discovery();
201075
201120
  init_decorateParam();
201076
201121
  init_decorate();
@@ -201604,9 +201649,9 @@ function modelsDevModelToRecord(providerId, model) {
201604
201649
  var MODELS_DEV_URL, CACHE_TTL_MS, UPSTREAM_FETCH_TIMEOUT_MS, cache, inFlight$2, builtInMemo, fetchImpl, nowImpl;
201605
201650
  var init_modelsDevUpstream = __esmMin((() => {
201606
201651
  init_codes();
201607
- init_errors$39();
201652
+ init_errors$40();
201608
201653
  init_builtInModelsDev();
201609
- init_errors$19();
201654
+ init_errors$20();
201610
201655
  init_modelsDev();
201611
201656
  MODELS_DEV_URL = "https://models.dev/api.json";
201612
201657
  CACHE_TTL_MS = 6e5;
@@ -201643,15 +201688,15 @@ var init_modelsDevImportService = __esmMin((() => {
201643
201688
  init_src$13();
201644
201689
  init_scopes();
201645
201690
  init_scope();
201646
- init_errors$39();
201691
+ init_errors$40();
201647
201692
  init_agentIdentity();
201648
201693
  init_config$6();
201649
- init_catalog$2();
201694
+ init_catalog$3();
201650
201695
  init_model$1();
201651
201696
  init_provider$1();
201652
201697
  init_modelsDev();
201653
- init_configSection$11();
201654
- init_errors$19();
201698
+ init_configSection$12();
201699
+ init_errors$20();
201655
201700
  init_kosongConfig();
201656
201701
  init_modelsDevImport();
201657
201702
  init_modelsDevUpstream();
@@ -202059,7 +202104,7 @@ var init_types$19 = __esmMin((() => {
202059
202104
  }));
202060
202105
  // ../../packages/agent-core-v2/src/features/externalHooks/configSection.ts
202061
202106
  var HOOKS_SECTION, HookDefSchema, HooksConfigSchema, hooksFromToml, hooksToToml;
202062
- var init_configSection$9 = __esmMin((() => {
202107
+ var init_configSection$10 = __esmMin((() => {
202063
202108
  init_zod$1();
202064
202109
  init_configSectionContributions();
202065
202110
  init_toml();
@@ -202552,7 +202597,7 @@ async function isDir(p) {
202552
202597
  }
202553
202598
  var NEXGEN_PLUGIN_ROOT_PATH, NEXGEN_PLUGIN_DIR_PATH, PLUGIN_SYSTEM_PROMPT_MAX_BYTES, UNSUPPORTED_RUNTIME_FIELDS;
202554
202599
  var init_manifest$2 = __esmMin((() => {
202555
- init_configSection$9();
202600
+ init_configSection$10();
202556
202601
  init_config_schema();
202557
202602
  init_types$20();
202558
202603
  NEXGEN_PLUGIN_ROOT_PATH = "nexgenk.plugin.json";
@@ -206170,7 +206215,7 @@ var init_capabilityService = __esmMin((() => {
206170
206215
  init_region$1();
206171
206216
  init_hostProcess();
206172
206217
  init_capability();
206173
- init_errors$34();
206218
+ init_errors$35();
206174
206219
  init_nexgenkCu();
206175
206220
  init_nexgenkWebbridge();
206176
206221
  init_decorateParam();
@@ -206869,7 +206914,7 @@ var init_debug = __esmMin((() => {
206869
206914
  init_debugLedger();
206870
206915
  init_debugGraph();
206871
206916
  init_debugCascade();
206872
- init_errors$32();
206917
+ init_errors$33();
206873
206918
  init_debugLedgerService();
206874
206919
  init_debugGraphService();
206875
206920
  init_debugCascadeService();
@@ -208019,7 +208064,7 @@ var init_flagService = __esmMin((() => {
208019
208064
  init_env$1();
208020
208065
  init_bootstrap$1();
208021
208066
  init_config$6();
208022
- init_flag$5();
208067
+ init_flag$6();
208023
208068
  init_flagRegistry();
208024
208069
  init_decorateParam();
208025
208070
  init_decorate();
@@ -208299,7 +208344,7 @@ function parseNonNegativeInt$1(raw) {
208299
208344
  return Number.isInteger(parsed) && parsed >= 0 ? parsed : void 0;
208300
208345
  }
208301
208346
  var LOOP_CONTROL_SECTION, LOOP_MAX_STEPS_PER_TURN_ENV, LOOP_MAX_ATTEMPTS_PER_STEP_ENV, LOOP_MAX_RETRIES_PER_STEP_ENV, LoopControlSchema, loopControlEnvBindings, stripLoopControlEnv, loopControlToToml;
208302
- var init_configSection$8 = __esmMin((() => {
208347
+ var init_configSection$9 = __esmMin((() => {
208303
208348
  init_zod$1();
208304
208349
  init_config$6();
208305
208350
  init_configSectionContributions();
@@ -208347,7 +208392,7 @@ var init_configSection$8 = __esmMin((() => {
208347
208392
  }));
208348
208393
  // ../../packages/agent-core-v2/src/agent/tools/task/task-wait/flag.ts
208349
208394
  var WAIT_FOR_FLAG_ID, WAIT_FOR_FLAG_ENV, waitForFlag;
208350
- var init_flag$3 = __esmMin((() => {
208395
+ var init_flag$4 = __esmMin((() => {
208351
208396
  init_flagRegistry();
208352
208397
  WAIT_FOR_FLAG_ID = "wait_for";
208353
208398
  WAIT_FOR_FLAG_ENV = "NEXGEN_EXPERIMENTAL_WAIT_FOR";
@@ -208364,7 +208409,7 @@ var init_flag$3 = __esmMin((() => {
208364
208409
  // ../../packages/agent-core-v2/src/agent/usage/usage.ts
208365
208410
  var init_usage = __esmMin((() => {
208366
208411
  init_errors$10();
208367
- init_errors$39();
208412
+ init_errors$40();
208368
208413
  init_errors$14();
208369
208414
  }));
208370
208415
  // ../../packages/agent-core-v2/src/session/usage/sessionUsage.ts
@@ -209102,8 +209147,8 @@ var init_goalService = __esmMin((() => {
209102
209147
  init_agentActorService();
209103
209148
  init_contextEvents();
209104
209149
  init_goalInjection();
209105
- init_configSection$8();
209106
- init_errors$25();
209150
+ init_configSection$9();
209151
+ init_errors$26();
209107
209152
  init_loop();
209108
209153
  init_turnEvents();
209109
209154
  init_turnOps();
@@ -209113,12 +209158,12 @@ var init_goalService = __esmMin((() => {
209113
209158
  init_toolExecutor();
209114
209159
  init_toolPolicy();
209115
209160
  init_toolRegistry();
209116
- init_flag$3();
209161
+ init_flag$4();
209117
209162
  init_usage();
209118
209163
  init_config$6();
209119
209164
  init_eventBus();
209120
209165
  init_event2();
209121
- init_flag$5();
209166
+ init_flag$6();
209122
209167
  init_telemetry$2();
209123
209168
  init_errors$10();
209124
209169
  init_agentLifecycle();
@@ -210427,7 +210472,7 @@ var init_planService = __esmMin((() => {
210427
210472
  init_dist$5();
210428
210473
  init_lifecycle$2();
210429
210474
  init_service$1();
210430
- init_errors$39();
210475
+ init_errors$40();
210431
210476
  init_errors$10();
210432
210477
  init_hero_slug();
210433
210478
  init_contextMemory();
@@ -210775,7 +210820,7 @@ var PlanFeature;
210775
210820
  var init_planFeature = __esmMin((() => {
210776
210821
  init_feature();
210777
210822
  init_featureRegistry();
210778
- init_configSection$17();
210823
+ init_configSection$18();
210779
210824
  init_plan$3();
210780
210825
  init_planService();
210781
210826
  init_exit_plan_mode$1();
@@ -211085,7 +211130,7 @@ var init_externalHooksRunnerService = __esmMin((() => {
211085
211130
  init_plugin();
211086
211131
  init_telemetry$2();
211087
211132
  init_hostProcess();
211088
- init_configSection$9();
211133
+ init_configSection$10();
211089
211134
  init_externalHooksRunner();
211090
211135
  init_matchHooks();
211091
211136
  init_decorateParam();
@@ -211818,7 +211863,7 @@ var init_externalHooksFeature = __esmMin((() => {
211818
211863
  init_scopes();
211819
211864
  init_feature();
211820
211865
  init_featureRegistry();
211821
- init_configSection$9();
211866
+ init_configSection$10();
211822
211867
  init_agentExternalHooks();
211823
211868
  init_agentExternalHooksService();
211824
211869
  init_externalHooksRunner();
@@ -211940,7 +211985,7 @@ function resolveSwarmTimeoutMs(config) {
211940
211985
  return config.get("swarm")?.timeoutMs ?? 72e5;
211941
211986
  }
211942
211987
  var SWARM_SECTION, SwarmConfigSchema, DEFAULT_SWARM_TIMEOUT_MS, SWARM_TIMEOUT_ENV, swarmEnvBindings, stripSwarmEnv;
211943
- var init_configSection$7 = __esmMin((() => {
211988
+ var init_configSection$8 = __esmMin((() => {
211944
211989
  init_zod$1();
211945
211990
  init_config$6();
211946
211991
  init_configSectionContributions();
@@ -212279,7 +212324,7 @@ var init_mirrorAgentRun = __esmMin((() => {
212279
212324
  init_sessionTokenCounting();
212280
212325
  init_profile$1();
212281
212326
  init_scopeContext();
212282
- init_errors$37();
212327
+ init_errors$38();
212283
212328
  init_telemetry$2();
212284
212329
  init_event2();
212285
212330
  init_agentLifecycle();
@@ -212352,7 +212397,7 @@ function resolveSwarmMaxConcurrency(env = process.env) {
212352
212397
  }
212353
212398
  var import_retry, INITIAL_LAUNCH_LIMIT, INITIAL_LAUNCH_INTERVAL_MS, RATE_LIMIT_RETRY_BASE_MS, RATE_LIMIT_RETRY_FACTOR, RATE_LIMIT_CAPACITY_SHRINK_INTERVAL_MS$1, RATE_LIMIT_CAPACITY_RECOVERY_INTERVAL_MS$1, RATE_LIMIT_SUSPENDED_REASON, AGENT_SWARM_MAX_CONCURRENCY_ENV, AgentRunBatch;
212354
212399
  var init_agentRunBatch = __esmMin((() => {
212355
- init_errors$37();
212400
+ init_errors$38();
212356
212401
  import_retry = /* @__PURE__ */ __toESM(require_retry$4(), 1);
212357
212402
  init_abort$1();
212358
212403
  init_timer();
@@ -213254,13 +213299,13 @@ function formatSubagentTimeoutDescription(ms) {
213254
213299
  return `${ms} ms`;
213255
213300
  }
213256
213301
  var SUBAGENT_SECTION, SECONDARY_MODEL_SECTION, SubagentConfigSchema, SecondaryModelConfigSchema, DEFAULT_SUBAGENT_TIMEOUT_MS, SUBAGENT_TIMEOUT_ENV, subagentEnvBindings, stripSubagentEnv, PRIMARY_SUBAGENT_MODEL_CHOICE, SECONDARY_MODEL_FORCE_REQUIRES_DEFAULT_MESSAGE, SECONDARY_MODEL_FORCE_EXCLUDES_MODELS_MESSAGE, SECONDARY_MODEL_DEFAULT_MODEL_REQUIRED_MESSAGE, SECONDARY_MODEL_PRIMARY_MODEL_RESERVED_MESSAGE;
213257
- var init_configSection$6 = __esmMin((() => {
213302
+ var init_configSection$7 = __esmMin((() => {
213258
213303
  init_zod$1();
213259
213304
  init_errors$10();
213260
213305
  init_toml();
213261
213306
  init_config$6();
213262
213307
  init_configSectionContributions();
213263
- init_configSection$11();
213308
+ init_configSection$12();
213264
213309
  init_thinking$1();
213265
213310
  SUBAGENT_SECTION = "subagent";
213266
213311
  SECONDARY_MODEL_SECTION = "secondaryModel";
@@ -213310,7 +213355,7 @@ function forkIncompatibility(args, own) {
213310
213355
  }
213311
213356
  var DEFAULT_PROFILE_NAME, FORK_WITH_RESUME_UNAVAILABLE, FORK_WITH_TYPE_UNAVAILABLE, FORK_WITH_MODEL_UNAVAILABLE, FORK_EXPERIMENTAL_UNAVAILABLE, FORK_CONTEXT_NOTICE;
213312
213357
  var init_spawn$2 = __esmMin((() => {
213313
- init_configSection$6();
213358
+ init_configSection$7();
213314
213359
  DEFAULT_PROFILE_NAME = "coder";
213315
213360
  FORK_WITH_RESUME_UNAVAILABLE = "Cannot set resume when forking the current context. Fork creates a new agent; resume continues an existing one.";
213316
213361
  FORK_WITH_TYPE_UNAVAILABLE = "Cannot set a different subagent_type when forking the current context. A fork inherits this agent's own agent type.";
@@ -213320,7 +213365,7 @@ var init_spawn$2 = __esmMin((() => {
213320
213365
  }));
213321
213366
  // ../../packages/agent-core-v2/src/session/subagent/flag.ts
213322
213367
  var SUBAGENT_FORK_FLAG_ID, SUBAGENT_FORK_FLAG_ENV, subagentForkFlag;
213323
- var init_flag$2 = __esmMin((() => {
213368
+ var init_flag$3 = __esmMin((() => {
213324
213369
  init_flagRegistry();
213325
213370
  SUBAGENT_FORK_FLAG_ID = "subagent_fork";
213326
213371
  SUBAGENT_FORK_FLAG_ENV = "NEXGEN_EXPERIMENTAL_SUBAGENT_FORK";
@@ -213437,16 +213482,16 @@ var init_agentSwarmTool = __esmMin((() => {
213437
213482
  init_errors$10();
213438
213483
  init_input_schema();
213439
213484
  init_config$6();
213440
- init_flag$5();
213485
+ init_flag$6();
213441
213486
  init_sessionSwarm();
213442
213487
  init_profile$1();
213443
213488
  init_scopeContext();
213444
213489
  init_swarm$1();
213445
- init_configSection$7();
213490
+ init_configSection$8();
213446
213491
  init_subagent();
213447
213492
  init_spawn$2();
213448
- init_flag$2();
213449
- init_configSection$6();
213493
+ init_flag$3();
213494
+ init_configSection$7();
213450
213495
  init_agent_swarm$1();
213451
213496
  init_agent_swarm();
213452
213497
  init_agent_swarm_fork();
@@ -214088,7 +214133,7 @@ var init_goalFeature = __esmMin((() => {
214088
214133
  })), RATE_LIMIT_CAPACITY_RECOVERY_INTERVAL_MS, TOWER_SPAWN_PAUSE_MS, RateLimitCapacityGovernor, TowerRateLimitService;
214089
214134
  var init_towerRateLimitService = __esmMin((() => {
214090
214135
  init_lifecycle$2();
214091
- init_configSection$15();
214136
+ init_configSection$16();
214092
214137
  init_config$6();
214093
214138
  init_towerRateLimit();
214094
214139
  init_decorateParam();
@@ -215654,12 +215699,12 @@ var init_taskWaitTool = __esmMin((() => {
215654
215699
  init_types$15();
215655
215700
  init_format();
215656
215701
  init_taskListTool();
215657
- init_flag$5();
215702
+ init_flag$6();
215658
215703
  init_goalService();
215659
215704
  init_telemetry$2();
215660
215705
  init_agentLifecycle();
215661
215706
  init_abort$1();
215662
- init_flag$3();
215707
+ init_flag$4();
215663
215708
  init_task_wait$1();
215664
215709
  init_task_wait();
215665
215710
  init_decorateParam();
@@ -216100,8 +216145,8 @@ var init_taskService = __esmMin((() => {
216100
216145
  init_agentState();
216101
216146
  init_toolPolicy();
216102
216147
  init_toolRegistry();
216103
- init_flag$3();
216104
- init_flag$5();
216148
+ init_flag$4();
216149
+ init_flag$6();
216105
216150
  init_task$2();
216106
216151
  init_agentLifecycle();
216107
216152
  init_types$15();
@@ -216114,7 +216159,7 @@ var init_taskService = __esmMin((() => {
216114
216159
  init_storage$1();
216115
216160
  init_telemetry$2();
216116
216161
  init_task$3();
216117
- init_configSection$15();
216162
+ init_configSection$16();
216118
216163
  init_persist();
216119
216164
  init_taskOps();
216120
216165
  init_taskListTool();
@@ -217140,12 +217185,12 @@ var init_spawnTool = __esmMin((() => {
217140
217185
  init_tower$1();
217141
217186
  init_towerRateLimit();
217142
217187
  init_config$6();
217143
- init_catalog$2();
217188
+ init_catalog$3();
217144
217189
  init_input_schema();
217145
217190
  init_agentLifecycle();
217146
217191
  init_subagentMetadata();
217147
217192
  init_sessionContext();
217148
- init_configSection$6();
217193
+ init_configSection$7();
217149
217194
  init_mirrorAgentRun();
217150
217195
  init_subagent();
217151
217196
  init_subagent_task();
@@ -217839,7 +217884,7 @@ function isTowerFeatureAssembled(flags) {
217839
217884
  var TOWER_TOOL_CONTRIBUTIONS, TowerFeature, assembledFlagServices, assembledOverrideForTests;
217840
217885
  var init_towerFeature = __esmMin((() => {
217841
217886
  init_instantiation();
217842
- init_flag$5();
217887
+ init_flag$6();
217843
217888
  init_scopes();
217844
217889
  init_feature();
217845
217890
  init_featureRegistry();
@@ -217965,7 +218010,7 @@ var init_towerFeature = __esmMin((() => {
217965
218010
  }));
217966
218011
  // ../../packages/agent-core-v2/src/features/tower/flag.ts
217967
218012
  var TOWER_FLAG_ENV, towerFlag;
217968
- var init_flag$1 = __esmMin((() => {
218013
+ var init_flag$2 = __esmMin((() => {
217969
218014
  init_flagRegistry();
217970
218015
  init_tower$1();
217971
218016
  init_towerFeature();
@@ -218023,7 +218068,7 @@ var TOWER_MODE_DEDUP_MIN_TURNS, TOWER_MODE_FULL_REFRESH_TURNS, TOWER_MODE_INJECT
218023
218068
  var init_towerModeInjection = __esmMin((() => {
218024
218069
  init_service$1();
218025
218070
  init_contextMemory();
218026
- init_flag$5();
218071
+ init_flag$6();
218027
218072
  init_tower$1();
218028
218073
  init_tower_mode_exit_reminder();
218029
218074
  init_tower_mode_full_reminder();
@@ -218515,7 +218560,7 @@ var init_towerService = __esmMin((() => {
218515
218560
  init_eventBus();
218516
218561
  init_featureManager();
218517
218562
  init_scopes();
218518
- init_flag$5();
218563
+ init_flag$6();
218519
218564
  init_sessionManager();
218520
218565
  init_telemetry$2();
218521
218566
  init_bashParser();
@@ -219197,7 +219242,7 @@ var init_cacheProbeService = __esmMin((() => {
219197
219242
  init_scopeContext();
219198
219243
  init_telemetry$2();
219199
219244
  init_usage$1();
219200
- init_catalog$2();
219245
+ init_catalog$3();
219201
219246
  init_agentLifecycle();
219202
219247
  init_sessionUsage();
219203
219248
  init_cacheProbe();
@@ -220432,7 +220477,7 @@ var init_agentsMdReminderService = __esmMin((() => {
220432
220477
  }));
220433
220478
  // ../../packages/agent-core-v2/src/agent/toolSelect/flag.ts
220434
220479
  var TOOL_SELECT_FLAG_ID, TOOL_SELECT_FLAG_ENV, toolSelectFlag;
220435
- var init_flag = __esmMin((() => {
220480
+ var init_flag$1 = __esmMin((() => {
220436
220481
  init_flagRegistry();
220437
220482
  TOOL_SELECT_FLAG_ID = "tool-select";
220438
220483
  TOOL_SELECT_FLAG_ENV = "NEXGEN_EXPERIMENTAL_TOOL_SELECT";
@@ -220622,7 +220667,7 @@ var init_toolSelectService = __esmMin((() => {
220622
220667
  init_scope();
220623
220668
  init_state$1();
220624
220669
  init_eventBus();
220625
- init_flag$5();
220670
+ init_flag$6();
220626
220671
  init_contextMemory();
220627
220672
  init_contextEvents();
220628
220673
  init_compactionOps();
@@ -220633,7 +220678,7 @@ var init_toolSelectService = __esmMin((() => {
220633
220678
  init_toolExecutor();
220634
220679
  init_toolRegistry();
220635
220680
  init_dynamicTools();
220636
- init_flag();
220681
+ init_flag$1();
220637
220682
  init_toolSelect();
220638
220683
  init_decorateParam();
220639
220684
  init_decorate();
@@ -221013,7 +221058,7 @@ var init_toolSelectSchemasService = __esmMin((() => {
221013
221058
  }));
221014
221059
  // ../../packages/agent-core-v2/src/agent/toolPolicy/configSection.ts
221015
221060
  var TOOLS_SECTION, ToolsConfigSchema;
221016
- var init_configSection$5 = __esmMin((() => {
221061
+ var init_configSection$6 = __esmMin((() => {
221017
221062
  init_zod$1();
221018
221063
  init_configSectionContributions();
221019
221064
  TOOLS_SECTION = "tools";
@@ -221088,7 +221133,7 @@ var init_toolPolicyService = __esmMin((() => {
221088
221133
  init_scopes();
221089
221134
  init_scope();
221090
221135
  init_profile$1();
221091
- init_configSection$5();
221136
+ init_configSection$6();
221092
221137
  init_toolExecutor();
221093
221138
  init_config$6();
221094
221139
  init_sessionToolPolicy();
@@ -221200,10 +221245,10 @@ var PRINT_WAIT_CEILING_S_DEFAULT;
221200
221245
  var init_printDefaults = __esmMin((() => {
221201
221246
  init_timer();
221202
221247
  init_config$6();
221248
+ init_configSection$9();
221203
221249
  init_configSection$8();
221204
221250
  init_configSection$7();
221205
- init_configSection$6();
221206
- init_configSection$15();
221251
+ init_configSection$16();
221207
221252
  PRINT_WAIT_CEILING_S_DEFAULT = Math.floor(MAX_TIMER_DELAY_MS$2 / 1e3);
221208
221253
  }));
221209
221254
  // ../../packages/agent-core-v2/src/features/cron/cronTask.ts
@@ -221840,7 +221885,7 @@ var init_profiles = __esmMin((() => {
221840
221885
  }));
221841
221886
  // ../../packages/agent-core-v2/src/agent/permissionMode/configSection.ts
221842
221887
  var DEFAULT_PERMISSION_MODE_SECTION, DefaultPermissionModeSchema;
221843
- var init_configSection$4 = __esmMin((() => {
221888
+ var init_configSection$5 = __esmMin((() => {
221844
221889
  init_zod$1();
221845
221890
  init_configSectionContributions();
221846
221891
  DEFAULT_PERMISSION_MODE_SECTION = "defaultPermissionMode";
@@ -222476,7 +222521,7 @@ function createRequestActor(requester, messageResolvers = []) {
222476
222521
  var init_actor$1 = __esmMin((() => {
222477
222522
  init_xstate2();
222478
222523
  init_credentials$1();
222479
- init_errors$38();
222524
+ init_errors$39();
222480
222525
  }));
222481
222526
  // ../../packages/agent-core-v2/src/human/llm/requester/retry.ts
222482
222527
  function resolveMaxAttempts(options) {
@@ -222518,7 +222563,7 @@ function retryErrorFields(error) {
222518
222563
  }
222519
222564
  var BASE_DELAY_MS, MAX_DELAY_MS, RETRY_FACTOR, JITTER_FACTOR, RETRYABLE_STATUS_CODES;
222520
222565
  var init_retry = __esmMin((() => {
222521
- init_errors$38();
222566
+ init_errors$39();
222522
222567
  BASE_DELAY_MS = 500;
222523
222568
  MAX_DELAY_MS = 32e3;
222524
222569
  RETRY_FACTOR = 2;
@@ -224477,8 +224522,8 @@ function createMachineRequester(service, options) {
224477
224522
  var GATE_FAILURE;
224478
224523
  var init_requester = __esmMin((() => {
224479
224524
  init_errors$10();
224480
- init_errors$37();
224481
224525
  init_errors$38();
224526
+ init_errors$39();
224482
224527
  GATE_FAILURE = {
224483
224528
  kind: "abort",
224484
224529
  message: "The agent loop gate stopped the step."
@@ -225853,7 +225898,7 @@ var init_agentLifecycleService = __esmMin((() => {
225853
225898
  init_bootstrap$1();
225854
225899
  init_config$6();
225855
225900
  init_eventBus();
225856
- init_configSection$4();
225901
+ init_configSection$5();
225857
225902
  init_permissionModeOps();
225858
225903
  init_profileOps();
225859
225904
  init_tower$1();
@@ -226660,7 +226705,7 @@ var init_mcpManagementService = __esmMin((() => {
226660
226705
  init_runtimeRegistry();
226661
226706
  init_agentIdentity();
226662
226707
  init_config$6();
226663
- init_configSection$20();
226708
+ init_configSection$21();
226664
226709
  init_configStore();
226665
226710
  init_oauthService();
226666
226711
  init_mcpRegistry();
@@ -227192,7 +227237,7 @@ function collectRunOutput(bus) {
227192
227237
  }
227193
227238
  var AGENT_RUN_PROMPT_ORIGIN, SUBAGENT_MAX_TOKENS_ERROR, PARTIAL_OUTPUT_MAX_CHARS, PARTIAL_OUTPUT_TRUNCATED_MARKER, RunText;
227194
227239
  var init_runAgentTurn = __esmMin((() => {
227195
- init_errors$37();
227240
+ init_errors$38();
227196
227241
  init_abort$1();
227197
227242
  init_code_points();
227198
227243
  init_eventBus();
@@ -227267,7 +227312,7 @@ var init_subagentService = __esmMin((() => {
227267
227312
  init_userTool();
227268
227313
  init_agentRuntime();
227269
227314
  init_config$6();
227270
- init_catalog$2();
227315
+ init_catalog$3();
227271
227316
  init_log$1();
227272
227317
  init_sessionContext();
227273
227318
  init_runtimeWorkspaceView();
@@ -227277,7 +227322,7 @@ var init_subagentService = __esmMin((() => {
227277
227322
  init_reminderService();
227278
227323
  init_subagent();
227279
227324
  init_runAgentTurn();
227280
- init_configSection$6();
227325
+ init_configSection$7();
227281
227326
  init_spawn$2();
227282
227327
  init_decorateParam();
227283
227328
  init_decorate();
@@ -227432,8 +227477,8 @@ var init_subagentModelsValidationService = __esmMin((() => {
227432
227477
  init_scopes();
227433
227478
  init_scope();
227434
227479
  init_config$6();
227435
- init_catalog$2();
227436
- init_configSection$6();
227480
+ init_catalog$3();
227481
+ init_configSection$7();
227437
227482
  init_subagentModelsValidation();
227438
227483
  init_decorateParam();
227439
227484
  init_decorate();
@@ -227773,10 +227818,10 @@ var init_agentTool = __esmMin((() => {
227773
227818
  init_rule_match();
227774
227819
  init_task$3();
227775
227820
  init_profile$1();
227776
- init_catalog$2();
227821
+ init_catalog$3();
227777
227822
  init_evaluate();
227778
227823
  init_toolPolicy();
227779
- init_flag();
227824
+ init_flag$1();
227780
227825
  init_toolSelect();
227781
227826
  init_scopeContext();
227782
227827
  init_agentRuntime();
@@ -227791,7 +227836,7 @@ var init_agentTool = __esmMin((() => {
227791
227836
  init_log$1();
227792
227837
  init_tower$1();
227793
227838
  init_config$6();
227794
- init_flag$5();
227839
+ init_flag$6();
227795
227840
  init_agentLifecycle();
227796
227841
  init_createAwaitingClose();
227797
227842
  init_subagentMetadata();
@@ -227800,8 +227845,8 @@ var init_agentTool = __esmMin((() => {
227800
227845
  init_eventDispatcher();
227801
227846
  init_subagent();
227802
227847
  init_spawn$2();
227803
- init_flag$2();
227804
- init_configSection$6();
227848
+ init_flag$3();
227849
+ init_configSection$7();
227805
227850
  init_agent$2();
227806
227851
  init_subagent_task();
227807
227852
  init_agent_background_disabled();
@@ -229929,7 +229974,7 @@ var init_sessionLegacyService = __esmMin((() => {
229929
229974
  init_tower$1();
229930
229975
  init_scopeContext();
229931
229976
  init_sessionLookup();
229932
- init_catalog$2();
229977
+ init_catalog$3();
229933
229978
  init_model$1();
229934
229979
  init_errors$10();
229935
229980
  init_mainAgent$1();
@@ -230134,7 +230179,7 @@ function isQuestionResponse$1(result) {
230134
230179
  var QUESTION_DISMISSED_MESSAGE, QUESTION_UNSUPPORTED_FAILURE_MESSAGE, QUESTION_NON_INTERACTIVE_MESSAGE, BACKGROUND_DESCRIPTION, BACKGROUND_UNAVAILABLE_MESSAGE, PARAMETERS_WITH_BACKGROUND, PARAMETERS_FOREGROUND_ONLY, AskUserQuestionTool;
230135
230180
  var init_askUserQuestionTool = __esmMin((() => {
230136
230181
  init_codes();
230137
- init_errors$39();
230182
+ init_errors$40();
230138
230183
  init_input_schema();
230139
230184
  init_abort$1();
230140
230185
  init_task$3();
@@ -235737,8 +235782,8 @@ var init_hostFolderBrowser = __esmMin((() => {
235737
235782
  init_zod$1();
235738
235783
  init_instantiation();
235739
235784
  init_codes();
235740
- init_errors$39();
235741
- init_errors$28();
235785
+ init_errors$40();
235786
+ init_errors$29();
235742
235787
  fsBrowseQuerySchema = object$1({ path: string().min(1).optional() });
235743
235788
  fsBrowseEntrySchema$1 = object$1({
235744
235789
  name: string().min(1),
@@ -250286,7 +250331,7 @@ var init_authService = __esmMin((() => {
250286
250331
  init_log$1();
250287
250332
  init_model_auth();
250288
250333
  init_model$1();
250289
- init_configSection$11();
250334
+ init_configSection$12();
250290
250335
  init_discovery();
250291
250336
  init_provider$1();
250292
250337
  init_provider_definition();
@@ -250868,6 +250913,26 @@ function isolateEnvServiceCredentials(service, getEnv, baseUrlEnv, apiKeyEnv) {
250868
250913
  apiKey
250869
250914
  };
250870
250915
  }
250916
+ function migrateLegacyServiceKeys(services) {
250917
+ let out;
250918
+ for (const [legacy, current] of Object.entries(LEGACY_SERVICE_KEYS)) {
250919
+ if (!(legacy in services)) continue;
250920
+ out ??= { ...services };
250921
+ const shadowed = out[current] !== void 0;
250922
+ if (!shadowed) out[current] = out[legacy];
250923
+ delete out[legacy];
250924
+ reportLegacyServiceKey(legacy, current, shadowed);
250925
+ }
250926
+ return out ?? services;
250927
+ }
250928
+ function reportLegacyServiceKey(legacy, current, shadowed) {
250929
+ const key = `${legacy}->${current}`;
250930
+ if (reportedLegacyServiceKeys.has(key)) return;
250931
+ reportedLegacyServiceKeys.add(key);
250932
+ const from = `services.${legacy.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
250933
+ const to = `services.${current.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
250934
+ process.emitWarning(shadowed ? `${from} is obsolete and ignored because ${to} is already set; delete the old table.` : `${from} is obsolete; using it as ${to}. Rename the table to silence this warning.`, { code: "NEXGEN_CONFIG_LEGACY_SERVICE_KEY" });
250935
+ }
250871
250936
  function serviceEntryFromToml(data) {
250872
250937
  const out = {};
250873
250938
  for (const [key, value] of Object.entries(data)) {
@@ -250889,8 +250954,8 @@ function serviceEntryToToml(service) {
250889
250954
  else setDefined(out, camelToSnake$3(key), value);
250890
250955
  return out;
250891
250956
  }
250892
- var SERVICES_SECTION, StringRecordSchema, OAuthRefSchema, NexgenServiceConfigSchema, ServicesConfigSchema, WEB_SEARCH_BASE_URL_ENV, WEB_SEARCH_API_KEY_ENV, WEB_FETCH_BASE_URL_ENV, WEB_FETCH_API_KEY_ENV, nonBlankEnv, nexgenSearchEnvBindings, nexgenFetchEnvBindings, servicesEnvBindings, servicesCredentialEnvOverlay, stripNexgenSearchEnv, stripNexgenFetchEnv, stripServicesEnv, servicesFromToml, servicesToToml;
250893
- var init_configSection$3 = __esmMin((() => {
250957
+ var SERVICES_SECTION, StringRecordSchema, OAuthRefSchema, NexgenServiceConfigSchema, ServicesConfigSchema, WEB_SEARCH_BASE_URL_ENV, WEB_SEARCH_API_KEY_ENV, WEB_FETCH_BASE_URL_ENV, WEB_FETCH_API_KEY_ENV, nonBlankEnv, nexgenSearchEnvBindings, nexgenFetchEnvBindings, servicesEnvBindings, servicesCredentialEnvOverlay, stripNexgenSearchEnv, stripNexgenFetchEnv, stripServicesEnv, servicesFromToml, LEGACY_SERVICE_KEYS, reportedLegacyServiceKeys, servicesToToml;
250958
+ var init_configSection$4 = __esmMin((() => {
250894
250959
  init_zod$1();
250895
250960
  init_config$6();
250896
250961
  init_configOverlayContributions();
@@ -250978,8 +251043,15 @@ var init_configSection$3 = __esmMin((() => {
250978
251043
  if (!isPlainObject$2(rawSnake)) return rawSnake;
250979
251044
  const out = {};
250980
251045
  for (const [name, entry] of Object.entries(rawSnake)) out[snakeToCamel$1(name)] = isPlainObject$2(entry) ? serviceEntryFromToml(entry) : entry;
250981
- return out;
251046
+ return migrateLegacyServiceKeys(out);
251047
+ };
251048
+ LEGACY_SERVICE_KEYS = {
251049
+ moonshotSearch: "nexgenSearch",
251050
+ moonshotFetch: "nexgenFetch",
251051
+ kimiSearch: "nexgenSearch",
251052
+ kimiFetch: "nexgenFetch"
250982
251053
  };
251054
+ reportedLegacyServiceKeys = /* @__PURE__ */ new Set();
250983
251055
  servicesToToml = (value, rawSnake) => {
250984
251056
  if (!isPlainObject$2(value)) return value;
250985
251057
  const out = cloneRecord$1(rawSnake);
@@ -251092,7 +251164,7 @@ var init_webSearchService = __esmMin((() => {
251092
251164
  init_config$6();
251093
251165
  init_provider$1();
251094
251166
  init_provider_definition();
251095
- init_configSection$3();
251167
+ init_configSection$4();
251096
251168
  init_nexgen_web_search();
251097
251169
  init_webSearch();
251098
251170
  init_decorateParam();
@@ -251195,7 +251267,7 @@ var init_authLegacyService = __esmMin((() => {
251195
251267
  init_scope();
251196
251268
  init_auth$5();
251197
251269
  init_config$6();
251198
- init_configSection$11();
251270
+ init_configSection$12();
251199
251271
  init_model_auth();
251200
251272
  init_authLegacy();
251201
251273
  init_decorateParam();
@@ -251531,7 +251603,7 @@ var FileEditService;
251531
251603
  var init_fileEditService = __esmMin((() => {
251532
251604
  init_scopes();
251533
251605
  init_scope();
251534
- init_errors$39();
251606
+ init_errors$40();
251535
251607
  init_hostFileSystem();
251536
251608
  init_editService();
251537
251609
  init_fileEdit();
@@ -251720,7 +251792,7 @@ var init_fetch_url$1 = __esmMin((() => {
251720
251792
  // ../../packages/agent-core-v2/src/app/web/tools/fetch-url-types.ts
251721
251793
  var HttpFetchError;
251722
251794
  var init_fetch_url_types = __esmMin((() => {
251723
- init_errors$39();
251795
+ init_errors$40();
251724
251796
  init_errors$13();
251725
251797
  HttpFetchError = class extends Error2 {
251726
251798
  name = "HttpFetchError";
@@ -265046,7 +265118,7 @@ var init_webService = __esmMin((() => {
265046
265118
  init_scopes();
265047
265119
  init_scope();
265048
265120
  init_auth$5();
265049
- init_configSection$3();
265121
+ init_configSection$4();
265050
265122
  init_agentIdentity();
265051
265123
  init_bootstrap$1();
265052
265124
  init_config$6();
@@ -266238,7 +266310,7 @@ function parseStrategy(raw) {
266238
266310
  return TOKEN_COUNTING_STRATEGIES.includes(value) ? value : void 0;
266239
266311
  }
266240
266312
  var TOKEN_COUNTING_SECTION, TOKEN_COUNTING_STRATEGY_ENV, TOKEN_COUNTING_STRATEGIES, TokenCountingConfigSchema, tokenCountingEnvBindings, stripTokenCountingEnv, DEFAULT_TOKEN_COUNTING_CONFIG;
266241
- var init_configSection$2 = __esmMin((() => {
266313
+ var init_configSection$3 = __esmMin((() => {
266242
266314
  init_zod$1();
266243
266315
  init_config$6();
266244
266316
  init_configSectionContributions();
@@ -266270,7 +266342,7 @@ var init_sessionTokenCountingService = __esmMin((() => {
266270
266342
  init_turnOps();
266271
266343
  init_config$6();
266272
266344
  init_eventBus();
266273
- init_configSection$2();
266345
+ init_configSection$3();
266274
266346
  init_tokens();
266275
266347
  init_agentLifecycle();
266276
266348
  init_sessionTokenCounting();
@@ -266730,9 +266802,9 @@ var init_changeNotifierService = __esmMin((() => {
266730
266802
  init_agentProfileCatalog();
266731
266803
  init_agentLifecycle();
266732
266804
  init_context$3();
266733
- init_configSection$6();
266805
+ init_configSection$7();
266734
266806
  init_evaluate();
266735
- init_configSection$5();
266807
+ init_configSection$6();
266736
266808
  init_sessionToolPolicy();
266737
266809
  init_sessionToolPolicyGate();
266738
266810
  init_changeNotifier();
@@ -267592,7 +267664,7 @@ var init_fullCompactionService = __esmMin((() => {
267592
267664
  init_todoItem();
267593
267665
  init_unexpectedError();
267594
267666
  init_wire$1();
267595
- init_errors$37();
267667
+ init_errors$38();
267596
267668
  init_message$1();
267597
267669
  init_usage$1();
267598
267670
  init_eventBus();
@@ -268191,6 +268263,401 @@ var init_mediaResolver = __esmMin((() => {
268191
268263
  init_instantiation();
268192
268264
  IAgentMediaResolverService = createDecorator("agentVideoResolverService");
268193
268265
  }));
268266
+ // ../../packages/agent-core-v2/src/features/serverTools/catalog.ts
268267
+ function findServerTool(name) {
268268
+ return SERVER_TOOL_CATALOG.find((tool) => tool.type === name);
268269
+ }
268270
+ var domainList, engineValues, SERVER_TOOL_CATALOG, DENIED_SERVER_TOOLS;
268271
+ var init_catalog$2 = __esmMin((() => {
268272
+ domainList = {
268273
+ type: "array",
268274
+ items: { type: "string" }
268275
+ };
268276
+ engineValues = [
268277
+ "auto",
268278
+ "native",
268279
+ "exa",
268280
+ "firecrawl",
268281
+ "parallel",
268282
+ "perplexity"
268283
+ ];
268284
+ SERVER_TOOL_CATALOG = [
268285
+ {
268286
+ type: "openrouter:web_search",
268287
+ description: "Search the web and return ranked results with page snippets. The provider runs the search server-side; no local network access is involved.",
268288
+ parameters: {
268289
+ type: "object",
268290
+ properties: {
268291
+ max_results: {
268292
+ type: "integer",
268293
+ minimum: 1,
268294
+ maximum: 25,
268295
+ description: "Number of search results to return."
268296
+ },
268297
+ max_uses: {
268298
+ type: "integer",
268299
+ minimum: 1,
268300
+ description: "Maximum number of searches the provider may run in one response."
268301
+ },
268302
+ max_total_results: {
268303
+ type: "integer",
268304
+ minimum: 1,
268305
+ description: "Cap on results accumulated across every search in the response."
268306
+ },
268307
+ engine: {
268308
+ type: "string",
268309
+ enum: [...engineValues],
268310
+ description: "Search backend to use; \"auto\" lets the router choose."
268311
+ },
268312
+ search_context_size: {
268313
+ type: "string",
268314
+ enum: [
268315
+ "low",
268316
+ "medium",
268317
+ "high"
268318
+ ],
268319
+ description: "Amount of page context attached to each result."
268320
+ },
268321
+ max_characters: {
268322
+ type: "integer",
268323
+ minimum: 1,
268324
+ description: "Truncate each result body to this many characters."
268325
+ },
268326
+ user_location: {
268327
+ type: "object",
268328
+ properties: {
268329
+ city: { type: "string" },
268330
+ region: { type: "string" },
268331
+ country: { type: "string" },
268332
+ timezone: { type: "string" }
268333
+ },
268334
+ additionalProperties: false,
268335
+ description: "Location hint used to localize results."
268336
+ },
268337
+ allowed_domains: {
268338
+ ...domainList,
268339
+ description: "Restrict results to these domains."
268340
+ },
268341
+ excluded_domains: {
268342
+ ...domainList,
268343
+ description: "Drop results from these domains."
268344
+ },
268345
+ x_search: {
268346
+ type: "object",
268347
+ properties: {
268348
+ max_results: {
268349
+ type: "integer",
268350
+ minimum: 1,
268351
+ maximum: 25
268352
+ },
268353
+ from_date: {
268354
+ type: "string",
268355
+ description: "Lower date bound for matching posts."
268356
+ },
268357
+ to_date: {
268358
+ type: "string",
268359
+ description: "Upper date bound for matching posts."
268360
+ }
268361
+ },
268362
+ additionalProperties: false,
268363
+ description: "Restrict the search to X (Twitter) posts."
268364
+ }
268365
+ },
268366
+ additionalProperties: false
268367
+ }
268368
+ },
268369
+ {
268370
+ type: "openrouter:web_fetch",
268371
+ description: "Fetch a page by URL and return its extracted content. The provider performs the request server-side.",
268372
+ parameters: {
268373
+ type: "object",
268374
+ properties: {
268375
+ engine: {
268376
+ type: "string",
268377
+ enum: [...engineValues],
268378
+ description: "Fetch backend to use; \"auto\" lets the router choose."
268379
+ },
268380
+ max_uses: {
268381
+ type: "integer",
268382
+ minimum: 1,
268383
+ description: "Maximum number of fetches the provider may run in one response."
268384
+ },
268385
+ max_content_tokens: {
268386
+ type: "integer",
268387
+ minimum: 1,
268388
+ description: "Cap on the tokens of page content returned per fetch."
268389
+ },
268390
+ allowed_domains: {
268391
+ ...domainList,
268392
+ description: "Only fetch URLs from these domains."
268393
+ },
268394
+ blocked_domains: {
268395
+ ...domainList,
268396
+ description: "Never fetch URLs from these domains."
268397
+ }
268398
+ },
268399
+ additionalProperties: false
268400
+ }
268401
+ },
268402
+ {
268403
+ type: "openrouter:datetime",
268404
+ description: "Return the current date and time from the provider, optionally in a named time zone.",
268405
+ parameters: {
268406
+ type: "object",
268407
+ properties: { timezone: {
268408
+ type: "string",
268409
+ description: "IANA time zone name, for example \"Europe/Madrid\". Defaults to UTC."
268410
+ } },
268411
+ additionalProperties: false
268412
+ }
268413
+ },
268414
+ {
268415
+ type: "openrouter:image_generation",
268416
+ description: "Generate an image from a prompt. The provider produces the image server-side and returns it in the response.",
268417
+ parameters: {
268418
+ type: "object",
268419
+ properties: {
268420
+ model: {
268421
+ type: "string",
268422
+ description: "Image model to use; the router default applies when omitted."
268423
+ },
268424
+ quality: {
268425
+ type: "string",
268426
+ enum: [
268427
+ "auto",
268428
+ "low",
268429
+ "medium",
268430
+ "high"
268431
+ ],
268432
+ description: "Rendering quality tier."
268433
+ },
268434
+ size: {
268435
+ type: "string",
268436
+ description: "Output resolution, for example \"1024x1024\"."
268437
+ },
268438
+ aspect_ratio: {
268439
+ type: "string",
268440
+ description: "Output aspect ratio, for example \"16:9\"."
268441
+ },
268442
+ background: {
268443
+ type: "string",
268444
+ enum: [
268445
+ "auto",
268446
+ "transparent",
268447
+ "opaque"
268448
+ ],
268449
+ description: "Background treatment of the generated image."
268450
+ },
268451
+ output_format: {
268452
+ type: "string",
268453
+ enum: [
268454
+ "png",
268455
+ "jpeg",
268456
+ "webp"
268457
+ ],
268458
+ description: "Encoded format of the generated image."
268459
+ },
268460
+ output_compression: {
268461
+ type: "integer",
268462
+ minimum: 0,
268463
+ maximum: 100,
268464
+ description: "Compression level for lossy output formats."
268465
+ },
268466
+ moderation: {
268467
+ type: "string",
268468
+ enum: ["auto", "low"],
268469
+ description: "Content moderation strictness applied to the prompt."
268470
+ }
268471
+ },
268472
+ additionalProperties: false
268473
+ }
268474
+ },
268475
+ {
268476
+ type: "openrouter:fusion",
268477
+ description: "Fuse several analysis models into one answer: the provider runs the listed models and merges their output.",
268478
+ parameters: {
268479
+ type: "object",
268480
+ properties: {
268481
+ analysis_models: {
268482
+ type: "array",
268483
+ items: { type: "string" },
268484
+ description: "Model identifiers that produce the candidate analyses."
268485
+ },
268486
+ model: {
268487
+ type: "string",
268488
+ description: "Model that fuses the analyses into the final answer."
268489
+ },
268490
+ max_tool_calls: {
268491
+ type: "integer",
268492
+ minimum: 0,
268493
+ description: "Cap on tool calls the fusion pass may make."
268494
+ },
268495
+ max_completion_tokens: {
268496
+ type: "integer",
268497
+ minimum: 1,
268498
+ description: "Cap on the tokens the fusion pass may generate."
268499
+ },
268500
+ reasoning: {
268501
+ type: "object",
268502
+ properties: {
268503
+ effort: { type: "string" },
268504
+ max_tokens: {
268505
+ type: "integer",
268506
+ minimum: 1
268507
+ }
268508
+ },
268509
+ additionalProperties: false,
268510
+ description: "Reasoning budget for the fusion pass."
268511
+ },
268512
+ temperature: {
268513
+ type: "number",
268514
+ minimum: 0,
268515
+ maximum: 2,
268516
+ description: "Sampling temperature for the fusion pass."
268517
+ }
268518
+ },
268519
+ additionalProperties: false
268520
+ }
268521
+ },
268522
+ {
268523
+ type: "openrouter:advisor",
268524
+ description: "Ask a named advisor model for a second opinion on the current request; the provider calls it server-side.",
268525
+ parameters: {
268526
+ type: "object",
268527
+ properties: {
268528
+ name: {
268529
+ type: "string",
268530
+ description: "Advisor identifier referenced by the response."
268531
+ },
268532
+ model: {
268533
+ type: "string",
268534
+ description: "Model backing the advisor."
268535
+ },
268536
+ max_completion_tokens: {
268537
+ type: "integer",
268538
+ minimum: 1,
268539
+ description: "Cap on the tokens the advisor may generate."
268540
+ }
268541
+ },
268542
+ additionalProperties: false
268543
+ }
268544
+ },
268545
+ {
268546
+ type: "openrouter:subagent",
268547
+ description: "Delegate a subtask to a named subagent model; the provider runs the subagent server-side.",
268548
+ parameters: {
268549
+ type: "object",
268550
+ properties: {
268551
+ name: {
268552
+ type: "string",
268553
+ description: "Subagent identifier referenced by the response."
268554
+ },
268555
+ model: {
268556
+ type: "string",
268557
+ description: "Model backing the subagent."
268558
+ }
268559
+ },
268560
+ additionalProperties: false
268561
+ }
268562
+ },
268563
+ {
268564
+ type: "openrouter:tool_search",
268565
+ description: "Responses-only marker: lets the provider expose additional server tools to the model. It is not callable and takes no parameters.",
268566
+ parameters: {
268567
+ type: "object",
268568
+ properties: {},
268569
+ additionalProperties: false
268570
+ }
268571
+ },
268572
+ {
268573
+ type: "openrouter:experimental__search_models",
268574
+ description: "Search the router model catalog by description and return matching model identifiers.",
268575
+ parameters: {
268576
+ type: "object",
268577
+ properties: { max_results: {
268578
+ type: "integer",
268579
+ minimum: 1,
268580
+ description: "Number of matching models to return."
268581
+ } },
268582
+ additionalProperties: false
268583
+ }
268584
+ }
268585
+ ];
268586
+ DENIED_SERVER_TOOLS = [
268587
+ "openrouter:shell",
268588
+ "openrouter:bash",
268589
+ "openrouter:apply_patch"
268590
+ ];
268591
+ }));
268592
+ // ../../packages/agent-core-v2/src/features/serverTools/configSection.ts
268593
+ var SERVER_TOOLS_SECTION, ServerToolsConfigSchema, DEFAULT_SERVER_TOOLS_CONFIG;
268594
+ var init_configSection$2 = __esmMin((() => {
268595
+ init_zod$1();
268596
+ init_configSectionContributions();
268597
+ SERVER_TOOLS_SECTION = "serverTools";
268598
+ ServerToolsConfigSchema = object$1({ enabled: array(string()).default([]) });
268599
+ DEFAULT_SERVER_TOOLS_CONFIG = { enabled: [] };
268600
+ registerConfigSection(SERVER_TOOLS_SECTION, ServerToolsConfigSchema, { defaultValue: DEFAULT_SERVER_TOOLS_CONFIG });
268601
+ }));
268602
+ // ../../packages/agent-core-v2/src/features/serverTools/flag.ts
268603
+ var SERVER_TOOLS_FLAG_ID, SERVER_TOOLS_FLAG_ENV, serverToolsFlag;
268604
+ var init_flag = __esmMin((() => {
268605
+ init_flagRegistry();
268606
+ SERVER_TOOLS_FLAG_ID = "server_tools";
268607
+ SERVER_TOOLS_FLAG_ENV = "NEXGEN_EXPERIMENTAL_SERVER_TOOLS";
268608
+ serverToolsFlag = {
268609
+ id: SERVER_TOOLS_FLAG_ID,
268610
+ title: "NexgenRouter server tools",
268611
+ description: "Declare NexgenRouter server-side tools (openrouter:web_search, openrouter:datetime, ...) that the provider executes instead of the client.",
268612
+ env: SERVER_TOOLS_FLAG_ENV,
268613
+ default: false,
268614
+ surface: "core"
268615
+ };
268616
+ registerFlagDefinition(serverToolsFlag);
268617
+ }));
268618
+ // ../../packages/agent-core-v2/src/features/serverTools/serverToolsService.ts
268619
+ function serverToolDescriptors(names) {
268620
+ return names.map(serverToolDescription);
268621
+ }
268622
+ function serverToolDescription(name) {
268623
+ if (DENIED_SERVER_TOOLS.includes(name)) throw new Error2(ErrorCodes.SERVER_TOOL_DENIED, `Server tool "${name}" is permanently denied and cannot be declared in [server_tools] enabled.`, { details: { name } });
268624
+ const definition = findServerTool(name);
268625
+ if (definition === void 0) {
268626
+ const known = SERVER_TOOL_CATALOG.map((tool) => tool.type).join(", ");
268627
+ throw new Error2(ErrorCodes.SERVER_TOOL_NOT_IN_CATALOG, `Server tool "${name}" is not in the NexgenRouter server tool catalog. Known tools: ${known}.`, { details: { name } });
268628
+ }
268629
+ return {
268630
+ name: definition.type,
268631
+ description: definition.description,
268632
+ parameters: definition.parameters
268633
+ };
268634
+ }
268635
+ var IServerToolsService, ServerToolsService;
268636
+ var init_serverToolsService = __esmMin((() => {
268637
+ init_instantiation();
268638
+ init_config$6();
268639
+ init_flag$6();
268640
+ init_errors$10();
268641
+ init_catalog$2();
268642
+ init_configSection$2();
268643
+ init_flag();
268644
+ init_decorateParam();
268645
+ init_decorate();
268646
+ IServerToolsService = createDecorator("serverToolsService");
268647
+ ServerToolsService = class ServerToolsService {
268648
+ config;
268649
+ flags;
268650
+ constructor(config, flags) {
268651
+ this.config = config;
268652
+ this.flags = flags;
268653
+ }
268654
+ descriptors() {
268655
+ if (!this.flags.enabled("server_tools")) return [];
268656
+ return serverToolDescriptors(this.config.get("serverTools")?.enabled ?? []);
268657
+ }
268658
+ };
268659
+ ServerToolsService = __decorate([__decorateParam(0, IConfigService), __decorateParam(1, IFlagService)], ServerToolsService);
268660
+ }));
268194
268661
  // ../../packages/agent-core-v2/src/agent/llmRequester/llmRequestOps.ts
268195
268662
  var llmToolEntrySchema, llmToolsSnapshotSchema, LlmToolsSnapshot, llmRequestSchema, LlmRequest, llmRequestTraceKey;
268196
268663
  var init_llmRequestOps = __esmMin((() => {
@@ -268362,17 +268829,18 @@ var init_llmRequesterService = __esmMin((() => {
268362
268829
  init_mediaResolver();
268363
268830
  init_sessionUsage();
268364
268831
  init_config$6();
268365
- init_errors$37();
268832
+ init_serverToolsService();
268833
+ init_errors$38();
268366
268834
  init_thinking$2();
268367
268835
  init_message$2();
268368
268836
  init_usage$1();
268369
268837
  init_log$1();
268370
- init_catalog$2();
268838
+ init_catalog$3();
268371
268839
  init_model_requester();
268372
268840
  init_model$1();
268373
268841
  init_completion_budget();
268374
268842
  init_thinking$1();
268375
- init_configSection$11();
268843
+ init_configSection$12();
268376
268844
  init_telemetry$2();
268377
268845
  init_scopeContext();
268378
268846
  init_eventDispatcher();
@@ -268408,6 +268876,7 @@ var init_llmRequesterService = __esmMin((() => {
268408
268876
  profile;
268409
268877
  usage;
268410
268878
  config;
268879
+ serverTools;
268411
268880
  modelService;
268412
268881
  modelCatalog;
268413
268882
  log;
@@ -268417,7 +268886,7 @@ var init_llmRequesterService = __esmMin((() => {
268417
268886
  states;
268418
268887
  bootstrap;
268419
268888
  toolCallIdNormalizer = new ToolCallIdNormalizer();
268420
- constructor(context, projector, tokenCounting, tools, toolSelect, mediaResolver, profile, usage, config, modelService, modelCatalog, log, telemetry, dispatcher, scopeContext, states, bootstrap) {
268889
+ constructor(context, projector, tokenCounting, tools, toolSelect, mediaResolver, profile, usage, config, serverTools, modelService, modelCatalog, log, telemetry, dispatcher, scopeContext, states, bootstrap) {
268421
268890
  this.context = context;
268422
268891
  this.projector = projector;
268423
268892
  this.tokenCounting = tokenCounting;
@@ -268427,6 +268896,7 @@ var init_llmRequesterService = __esmMin((() => {
268427
268896
  this.profile = profile;
268428
268897
  this.usage = usage;
268429
268898
  this.config = config;
268899
+ this.serverTools = serverTools;
268430
268900
  this.modelService = modelService;
268431
268901
  this.modelCatalog = modelCatalog;
268432
268902
  this.log = log;
@@ -268881,7 +269351,7 @@ var init_llmRequesterService = __esmMin((() => {
268881
269351
  modelAlias: resolved.modelAlias,
268882
269352
  thinkingEffort: resolved.thinkingLevel,
268883
269353
  systemPrompt: overrides.systemPrompt ?? turnConfig?.systemPrompt ?? this.profile.getSystemPrompt(),
268884
- tools: [...overrides.tools ?? this.defaultTools()],
269354
+ tools: [...overrides.tools ?? this.defaultTools(), ...this.serverToolsFor(requester.model)],
268885
269355
  messages: [...messages],
268886
269356
  contextRevision: this.context.prefixRevision(),
268887
269357
  promptCacheProbe,
@@ -268889,6 +269359,10 @@ var init_llmRequesterService = __esmMin((() => {
268889
269359
  logFields: logFieldsForSource(overrides.source)
268890
269360
  };
268891
269361
  }
269362
+ serverToolsFor(model) {
269363
+ if (model.providerType !== "nexgenk") return [];
269364
+ return this.serverTools.descriptors();
269365
+ }
268892
269366
  resolveTurnConfig(source) {
268893
269367
  if (source?.type !== "turn") return void 0;
268894
269368
  return this.getOrCreateTurnConfig(source.turnId);
@@ -269006,14 +269480,15 @@ var init_llmRequesterService = __esmMin((() => {
269006
269480
  __decorateParam(6, IAgentProfileService),
269007
269481
  __decorateParam(7, ISessionUsageService),
269008
269482
  __decorateParam(8, IConfigService),
269009
- __decorateParam(9, IModelService),
269010
- __decorateParam(10, IModelCatalog),
269011
- __decorateParam(11, ILogService),
269012
- __decorateParam(12, ITelemetryService),
269013
- __decorateParam(13, IEventDispatcher),
269014
- __decorateParam(14, IAgentScopeContext),
269015
- __decorateParam(15, IAgentStateService),
269016
- __decorateParam(16, IBootstrapService)
269483
+ __decorateParam(9, IServerToolsService),
269484
+ __decorateParam(10, IModelService),
269485
+ __decorateParam(11, IModelCatalog),
269486
+ __decorateParam(12, ILogService),
269487
+ __decorateParam(13, ITelemetryService),
269488
+ __decorateParam(14, IEventDispatcher),
269489
+ __decorateParam(15, IAgentScopeContext),
269490
+ __decorateParam(16, IAgentStateService),
269491
+ __decorateParam(17, IBootstrapService)
269017
269492
  ], AgentLLMRequesterService);
269018
269493
  MutableLLMRequestTrace = class {
269019
269494
  traceId;
@@ -271096,7 +271571,7 @@ var init_loopService = __esmMin((() => {
271096
271571
  init_eventDispatcher();
271097
271572
  init_wire$1();
271098
271573
  init_promptEvents();
271099
- init_configSection$8();
271574
+ init_configSection$9();
271100
271575
  init_loop();
271101
271576
  init_origin$2();
271102
271577
  init_hookParts();
@@ -274080,9 +274555,9 @@ function inlineVideoPart(data, mimeType) {
274080
274555
  };
274081
274556
  }
274082
274557
  var init_videoUpload = __esmMin((() => {
274083
- init_errors$37();
274084
274558
  init_errors$38();
274085
- init_errors$36();
274559
+ init_errors$39();
274560
+ init_errors$37();
274086
274561
  })), ReadMediaFileInputSchema;
274087
274562
  var init_read_media_file = __esmMin((() => {
274088
274563
  init_zod$1();
@@ -274145,7 +274620,7 @@ function shouldSurfaceVideoUploadError(error, inlineVideoSupported) {
274145
274620
  }
274146
274621
  var ReadMediaFileTool;
274147
274622
  var init_readMediaFileTool = __esmMin((() => {
274148
- init_errors$37();
274623
+ init_errors$38();
274149
274624
  init_videoUpload();
274150
274625
  init_mediaRef$1();
274151
274626
  init_fileReadSource();
@@ -274512,7 +274987,7 @@ var init_mediaToolsRegistrar = __esmMin((() => {
274512
274987
  init_eventDispatcher();
274513
274988
  init_usageEvents();
274514
274989
  init_telemetry$2();
274515
- init_catalog$2();
274990
+ init_catalog$3();
274516
274991
  init_credential_recovery();
274517
274992
  init_agentRuntime();
274518
274993
  init_skillCatalog();
@@ -274885,7 +275360,7 @@ var init_mediaResolverService = __esmMin((() => {
274885
275360
  init_fileService();
274886
275361
  init_scopes();
274887
275362
  init_telemetry$2();
274888
- init_errors$37();
275363
+ init_errors$38();
274889
275364
  init_credential_recovery();
274890
275365
  init_blobStore();
274891
275366
  init_file_type$1();
@@ -276580,10 +277055,10 @@ var init_profileService = __esmMin((() => {
276580
277055
  init_state$1();
276581
277056
  init_capability$6();
276582
277057
  init_thinking$2();
276583
- init_catalog$2();
277058
+ init_catalog$3();
276584
277059
  init_protocol$2();
276585
277060
  init_thinking$1();
276586
- init_configSection$11();
277061
+ init_configSection$12();
276587
277062
  init_discovery();
276588
277063
  init_agentProfileCatalog();
276589
277064
  init_builtinAgentProfileLoader();
@@ -276609,7 +277084,7 @@ var init_profileService = __esmMin((() => {
276609
277084
  init_eventDispatcher();
276610
277085
  init_context$3();
276611
277086
  init_profile$1();
276612
- init_configSection$5();
277087
+ init_configSection$6();
276613
277088
  init_evaluate();
276614
277089
  init_toolRegistry();
276615
277090
  init_sessionNotify();
@@ -278419,7 +278894,7 @@ var init_notifyUserNudgeService = __esmMin((() => {
278419
278894
  init_scopeContext();
278420
278895
  init_toolRegistry();
278421
278896
  init_bootstrap$1();
278422
- init_flag$5();
278897
+ init_flag$6();
278423
278898
  init_telemetry$2();
278424
278899
  init_reminderService();
278425
278900
  init_eventDispatcher();
@@ -278488,7 +278963,7 @@ var NOTIFY_USER_DELIVERED_OUTPUT, NOTIFY_USER_EMPTY_TITLE, NOTIFY_USER_MULTILINE
278488
278963
  var init_notifyUserTool = __esmMin((() => {
278489
278964
  init_contextMemory();
278490
278965
  init_bootstrap$1();
278491
- init_flag$5();
278966
+ init_flag$6();
278492
278967
  init_telemetry$2();
278493
278968
  init_input_schema();
278494
278969
  init_toolContract();
@@ -278593,6 +279068,21 @@ var init_notifyFeature = __esmMin((() => {
278593
279068
  };
278594
279069
  registerFeature(NotifyFeature);
278595
279070
  }));
279071
+ // ../../packages/agent-core-v2/src/features/serverTools/serverToolsFeature.ts
279072
+ var ServerToolsFeature;
279073
+ var init_serverToolsFeature = __esmMin((() => {
279074
+ init_feature();
279075
+ init_featureRegistry();
279076
+ init_serverToolsService();
279077
+ ServerToolsFeature = class extends Feature {
279078
+ static name = "serverTools";
279079
+ constructor() {
279080
+ super();
279081
+ this.contributeAgentService(IServerToolsService, ServerToolsService);
279082
+ }
279083
+ };
279084
+ registerFeature(ServerToolsFeature);
279085
+ }));
278596
279086
  // ../../packages/agent-core-v2/src/agent/toolExecutor/toolHooks.ts
278597
279087
  var init_toolHooks = __esmMin((() => {}));
278598
279088
  // ../../packages/agent-core-v2/src/agent/toolResultTruncation/toolResultTruncationService.ts
@@ -279265,7 +279755,7 @@ var init_src$10 = __esmMin((() => {
279265
279755
  init_fiberEventResolver();
279266
279756
  init_eventBus();
279267
279757
  init_event$1();
279268
- init_errors$31();
279758
+ init_errors$32();
279269
279759
  init_event2();
279270
279760
  init_errors$15();
279271
279761
  init_state$1();
@@ -279284,7 +279774,7 @@ var init_src$10 = __esmMin((() => {
279284
279774
  init_agentState();
279285
279775
  init_agentStateService();
279286
279776
  init_capability$6();
279287
- init_errors$37();
279777
+ init_errors$38();
279288
279778
  init_message$1();
279289
279779
  init_request_trace();
279290
279780
  init_sessionIndex();
@@ -279309,18 +279799,18 @@ var init_src$10 = __esmMin((() => {
279309
279799
  init_configEvents();
279310
279800
  init_configService();
279311
279801
  init_configSectionContributions();
279312
- init_configSection$11();
279802
+ init_configSection$12();
279313
279803
  init_provider$1();
279314
279804
  init_provider_service();
279315
279805
  init_provider_definition();
279316
279806
  init_protocolAdapterRegistry();
279317
- init_configSection$19();
279318
- init_configSection$10();
279319
- init_configSection$10();
279807
+ init_configSection$20();
279808
+ init_configSection$11();
279809
+ init_configSection$11();
279320
279810
  init_agentIdentity();
279321
279811
  init_agentIdentityService();
279322
- init_errors$36();
279323
- init_errors$36();
279812
+ init_errors$37();
279813
+ init_errors$37();
279324
279814
  init_protocol$2();
279325
279815
  init_protocol_base();
279326
279816
  init_envOverlay();
@@ -279330,10 +279820,10 @@ var init_src$10 = __esmMin((() => {
279330
279820
  init_model_types();
279331
279821
  init_model_service();
279332
279822
  init_thinking$1();
279333
- init_catalog$2();
279823
+ init_catalog$3();
279334
279824
  init_catalog_service();
279335
279825
  init_model_requester();
279336
- init_errors$23();
279826
+ init_errors$24();
279337
279827
  init_kosongConfig();
279338
279828
  init_kosongConfigService();
279339
279829
  init_model_oauth();
@@ -279341,7 +279831,7 @@ var init_src$10 = __esmMin((() => {
279341
279831
  init_hostRequestHeadersAdapter();
279342
279832
  init_discovery();
279343
279833
  init_discoveryService();
279344
- init_errors$19();
279834
+ init_errors$20();
279345
279835
  init_modelsDevImport();
279346
279836
  init_modelsDevImportService();
279347
279837
  init_modelsDevUpstream();
@@ -279355,7 +279845,7 @@ var init_src$10 = __esmMin((() => {
279355
279845
  init_profile_shared();
279356
279846
  init_promptPrefix();
279357
279847
  init_contribution();
279358
- init_configSection$18();
279848
+ init_configSection$19();
279359
279849
  init_agentFile();
279360
279850
  init_paths$2();
279361
279851
  init_userAgentProfileLoader();
@@ -279375,7 +279865,7 @@ var init_src$10 = __esmMin((() => {
279375
279865
  init_capability();
279376
279866
  init_capabilityEvents();
279377
279867
  init_capabilityService();
279378
- init_errors$34();
279868
+ init_errors$35();
279379
279869
  init_types$18();
279380
279870
  init_featureManager();
279381
279871
  init_featureServiceContribution();
@@ -279395,7 +279885,7 @@ var init_src$10 = __esmMin((() => {
279395
279885
  init_skillService();
279396
279886
  init_skillFeature();
279397
279887
  init_types$24();
279398
- init_configSection$19();
279888
+ init_configSection$20();
279399
279889
  init_parser$2();
279400
279890
  init_registry$5();
279401
279891
  init_errors$16();
@@ -279434,13 +279924,13 @@ var init_src$10 = __esmMin((() => {
279434
279924
  init_permissionGateService();
279435
279925
  init_toolApproval();
279436
279926
  init_toolApprovalService();
279437
- init_flag$5();
279927
+ init_flag$6();
279438
279928
  init_flagRegistry();
279439
279929
  init_flagRegistryService();
279440
279930
  init_flagService();
279441
279931
  init_flagRegistry();
279442
279932
  init_flagRegistryService();
279443
- init_flag$5();
279933
+ init_flag$6();
279444
279934
  init_flagService();
279445
279935
  init_modeMutex();
279446
279936
  init_modeMutexService();
@@ -279450,7 +279940,7 @@ var init_src$10 = __esmMin((() => {
279450
279940
  init_plan$2();
279451
279941
  init_exit_plan_mode$1();
279452
279942
  init_exitPlanModeTool();
279453
- init_configSection$17();
279943
+ init_configSection$18();
279454
279944
  init_plan$3();
279455
279945
  init_planOps();
279456
279946
  init_planService();
@@ -279460,7 +279950,7 @@ var init_src$10 = __esmMin((() => {
279460
279950
  init_fileHistoryOps();
279461
279951
  init_fileHistoryService();
279462
279952
  init_fileHistoryFeature();
279463
- init_configSection$9();
279953
+ init_configSection$10();
279464
279954
  init_externalHooksRunner();
279465
279955
  init_externalHooksRunnerService();
279466
279956
  init_sessionExternalHooks();
@@ -279471,7 +279961,7 @@ var init_src$10 = __esmMin((() => {
279471
279961
  init_debugEvents();
279472
279962
  init_debugEventsService();
279473
279963
  init_debugEventsFeature();
279474
- init_configSection$7();
279964
+ init_configSection$8();
279475
279965
  init_swarm$1();
279476
279966
  init_swarmService();
279477
279967
  init_sessionSwarm();
@@ -279493,7 +279983,7 @@ var init_src$10 = __esmMin((() => {
279493
279983
  init_goalOps();
279494
279984
  init_types$16();
279495
279985
  init_goalFeature();
279496
- init_flag$1();
279986
+ init_flag$2();
279497
279987
  init_tower$1();
279498
279988
  init_towerFeature();
279499
279989
  init_towerService();
@@ -279510,7 +280000,7 @@ var init_src$10 = __esmMin((() => {
279510
280000
  init_review$1();
279511
280001
  init_mission$1();
279512
280002
  init_status$1();
279513
- init_flag$1();
280003
+ init_flag$2();
279514
280004
  init_towerFeature();
279515
280005
  init_usage();
279516
280006
  init_cacheProbe();
@@ -279523,7 +280013,7 @@ var init_src$10 = __esmMin((() => {
279523
280013
  init_toolDedupeService();
279524
280014
  init_agentsMdReminder();
279525
280015
  init_agentsMdReminderService();
279526
- init_flag();
280016
+ init_flag$1();
279527
280017
  init_select_tools();
279528
280018
  init_selectToolsTool();
279529
280019
  init_dynamicTools();
@@ -279533,12 +280023,12 @@ var init_src$10 = __esmMin((() => {
279533
280023
  init_toolSelectAnnouncementsService();
279534
280024
  init_toolSelectSchemas();
279535
280025
  init_toolSelectSchemasService();
279536
- init_configSection$5();
279537
- init_configSection$5();
280026
+ init_configSection$6();
280027
+ init_configSection$6();
279538
280028
  init_evaluate();
279539
280029
  init_toolPolicy();
279540
280030
  init_toolPolicyService();
279541
- init_configSection$15();
280031
+ init_configSection$16();
279542
280032
  init_printDefaults();
279543
280033
  init_task_list$1();
279544
280034
  init_taskListTool();
@@ -279551,9 +280041,9 @@ var init_src$10 = __esmMin((() => {
279551
280041
  init_task$3();
279552
280042
  init_taskOps();
279553
280043
  init_taskService();
279554
- init_configSection$16();
280044
+ init_configSection$17();
279555
280045
  init_cronTask();
279556
- init_configSection$16();
280046
+ init_configSection$17();
279557
280047
  init_cronService();
279558
280048
  init_cronOps();
279559
280049
  init_cronFeature();
@@ -279567,7 +280057,7 @@ var init_src$10 = __esmMin((() => {
279567
280057
  init_forked();
279568
280058
  init_mainAgent$1();
279569
280059
  init_sessionMcpHandle();
279570
- init_configSection$20();
280060
+ init_configSection$21();
279571
280061
  init_oauthStore();
279572
280062
  init_configStore();
279573
280063
  init_oauthService();
@@ -279582,7 +280072,7 @@ var init_src$10 = __esmMin((() => {
279582
280072
  init_subagent();
279583
280073
  init_subagentService();
279584
280074
  init_spawn$2();
279585
- init_flag$2();
280075
+ init_flag$3();
279586
280076
  init_subagentModelsValidation();
279587
280077
  init_subagentModelsValidationService();
279588
280078
  init_subagent_task();
@@ -279590,7 +280080,7 @@ var init_src$10 = __esmMin((() => {
279590
280080
  init_mirrorAgentRun();
279591
280081
  init_subagentScopeCache();
279592
280082
  init_subagentScopeCacheService();
279593
- init_configSection$6();
280083
+ init_configSection$7();
279594
280084
  init_agent$2();
279595
280085
  init_agentTool();
279596
280086
  init_sessionLookup();
@@ -279600,7 +280090,7 @@ var init_src$10 = __esmMin((() => {
279600
280090
  init_sessionLifecycleService();
279601
280091
  init_coldSessionArchive();
279602
280092
  init_addressing();
279603
- init_errors$18();
280093
+ init_errors$19();
279604
280094
  init_sessionExport$1();
279605
280095
  init_sessionExportService();
279606
280096
  init_manifest$1();
@@ -279633,7 +280123,7 @@ var init_src$10 = __esmMin((() => {
279633
280123
  init_gitService();
279634
280124
  init_bashParser();
279635
280125
  init_bashParserService();
279636
- init_errors$28();
280126
+ init_errors$29();
279637
280127
  init_fs$1();
279638
280128
  init_fsService();
279639
280129
  init_gitContext();
@@ -279660,10 +280150,10 @@ var init_src$10 = __esmMin((() => {
279660
280150
  init_atomicDocumentStore();
279661
280151
  init_blobStoreService();
279662
280152
  init_projectLocalConfigService();
280153
+ init_configSection$14();
280154
+ init_configSection$14();
279663
280155
  init_configSection$13();
279664
280156
  init_configSection$13();
279665
- init_configSection$12();
279666
- init_configSection$12();
279667
280157
  init_miniDbQueryStore();
279668
280158
  init_inMemoryStorageService();
279669
280159
  init_sessionLockService();
@@ -279673,7 +280163,7 @@ var init_src$10 = __esmMin((() => {
279673
280163
  init_authService();
279674
280164
  init_region$1();
279675
280165
  init_regionService();
279676
- init_configSection$3();
280166
+ init_configSection$4();
279677
280167
  init_webSearch();
279678
280168
  init_webSearchService();
279679
280169
  init_nexgen_web_search();
@@ -279743,7 +280233,7 @@ var init_src$10 = __esmMin((() => {
279743
280233
  init_promise();
279744
280234
  init_retry$1();
279745
280235
  init_timer();
279746
- init_configSection$8();
280236
+ init_configSection$9();
279747
280237
  init_loop();
279748
280238
  init_loopService();
279749
280239
  init_promptChannel();
@@ -279767,7 +280257,7 @@ var init_src$10 = __esmMin((() => {
279767
280257
  init_mediaResolverService();
279768
280258
  init_configSection$1();
279769
280259
  init_imageConfigBridge();
279770
- init_configSection$4();
280260
+ init_configSection$5();
279771
280261
  init_permissionMode();
279772
280262
  init_permissionModeService();
279773
280263
  init_permissionPolicy();
@@ -279802,10 +280292,15 @@ var init_src$10 = __esmMin((() => {
279802
280292
  init_todoService();
279803
280293
  init_todo_list$1();
279804
280294
  init_todoFeature();
279805
- init_flag$4();
280295
+ init_flag$5();
279806
280296
  init_notifyUserAvailability();
279807
280297
  init_notify_user$1();
279808
280298
  init_notifyFeature();
280299
+ init_catalog$2();
280300
+ init_configSection$2();
280301
+ init_flag();
280302
+ init_serverToolsService();
280303
+ init_serverToolsFeature();
279809
280304
  init_toolContract();
279810
280305
  init_toolHooks();
279811
280306
  init_toolExecutor();
@@ -281714,7 +282209,7 @@ function isStreamingContract(contract) {
281714
282209
  var init_types$8 = __esmMin((() => {}));
281715
282210
  // ../../packages/klient/src/contract/index.ts
281716
282211
  var globalContract;
281717
- var init_contract$1 = __esmMin((() => {
282212
+ var init_contract$2 = __esmMin((() => {
281718
282213
  init_services();
281719
282214
  init_auth$3();
281720
282215
  init_capabilities$1();
@@ -282732,7 +283227,7 @@ function createKlientFromChannel(channel, options = {}) {
282732
283227
  };
282733
283228
  }
282734
283229
  var init_klient = __esmMin((() => {
282735
- init_contract$1();
283230
+ init_contract$2();
282736
283231
  init_events$4();
282737
283232
  init_events$3();
282738
283233
  init_events$2();
@@ -282867,12 +283362,12 @@ var init_serviceRegistry = __esmMin((() => {
282867
283362
  init_workspace$1();
282868
283363
  init_config$6();
282869
283364
  init_model$1();
282870
- init_catalog$2();
283365
+ init_catalog$3();
282871
283366
  init_discovery();
282872
283367
  init_modelsDevImport();
282873
283368
  init_provider$1();
282874
283369
  init_auth$5();
282875
- init_flag$5();
283370
+ init_flag$6();
282876
283371
  init_plugin();
282877
283372
  init_capability();
282878
283373
  init_bootstrap$1();
@@ -283389,7 +283884,7 @@ function errorMessage$10(error) {
283389
283884
  }
283390
283885
  var MAIN_AGENT_ID$4, SDKRpcClientBase;
283391
283886
  var init_rpc = __esmMin((() => {
283392
- init_errors$43();
283887
+ init_errors$44();
283393
283888
  MAIN_AGENT_ID$4 = "main";
283394
283889
  SDKRpcClientBase = class {
283395
283890
  interactiveAgentScope = new AsyncLocalStorage();
@@ -283688,7 +284183,7 @@ function assertImportFits(message, currentTokenCount, maxContextTokens) {
283688
284183
  var IMPORT_CONTEXT_GUIDANCE;
283689
284184
  var init_import_context = __esmMin((() => {
283690
284185
  init_tokens();
283691
- init_errors$43();
284186
+ init_errors$44();
283692
284187
  IMPORT_CONTEXT_GUIDANCE = "This is a prior conversation history that may be relevant to the current session. Please review this context and use it to inform your responses.";
283693
284188
  }));
283694
284189
  // ../../packages/product/src/shared/node/json-file.ts
@@ -285424,7 +285919,7 @@ function normalizeServerName(name) {
285424
285919
  }
285425
285920
  var init_global_mcp = __esmMin((() => {
285426
285921
  init_config_schema();
285427
- init_errors$43();
285922
+ init_errors$44();
285428
285923
  }));
285429
285924
  // ../../packages/node-sdk/src/v2/session-mapper.ts
285430
285925
  /**
@@ -285851,7 +286346,7 @@ var init_sdk_rpc_client_v2 = __esmMin((() => {
285851
286346
  init_src$13();
285852
286347
  init_auth$8();
285853
286348
  init_config$7();
285854
- init_errors$43();
286349
+ init_errors$44();
285855
286350
  init_nexgenk_harness();
285856
286351
  init_telemetry$3();
285857
286352
  init_rpc();
@@ -287799,14 +288294,14 @@ var init_sdk_rpc_client_v2 = __esmMin((() => {
287799
288294
  var init_config_rpc = __esmMin((() => {
287800
288295
  init_src$10();
287801
288296
  init_config$7();
287802
- init_errors$43();
288297
+ init_errors$44();
287803
288298
  }));
287804
288299
  // ../../packages/node-sdk/src/nexgenk-model-provider.ts
287805
288300
  var init_nexgenk_model_provider = __esmMin((() => {
287806
288301
  init_src$13();
287807
288302
  init_src$14();
287808
288303
  init_src$10();
287809
- init_errors$43();
288304
+ init_errors$44();
287810
288305
  init_oauth_error();
287811
288306
  }));
287812
288307
  // ../../packages/node-sdk/src/logging/types.ts
@@ -288321,12 +288816,12 @@ var init_src$8 = __esmMin((() => {
288321
288816
  init_rpc();
288322
288817
  init_nexgenk_model_provider();
288323
288818
  init_catalog();
288324
- init_errors$43();
288819
+ init_errors$44();
288325
288820
  init_logging();
288326
288821
  init_src$10();
288327
288822
  init_config$7();
288328
288823
  init_replay$1();
288329
- init_configSection$6();
288824
+ init_configSection$7();
288330
288825
  init_proxy();
288331
288826
  init_image$1();
288332
288827
  init_mediaRef$1();
@@ -288396,7 +288891,7 @@ function sanitizeProperties(input) {
288396
288891
  };
288397
288892
  }
288398
288893
  var MAX_QUEUE_SIZE, TelemetryClient, ScopedTelemetryClient, defaultClient;
288399
- var init_client = __esmMin((() => {
288894
+ var init_client$1 = __esmMin((() => {
288400
288895
  init_types$6();
288401
288896
  MAX_QUEUE_SIZE = 1e3;
288402
288897
  TelemetryClient = class {
@@ -289087,7 +289582,7 @@ function initializeTelemetry(options) {
289087
289582
  }
289088
289583
  var TELEMETRY_DISABLE_ENV$1, TRUE_ENV_VALUES;
289089
289584
  var init_bootstrap = __esmMin((() => {
289090
- init_client();
289585
+ init_client$1();
289091
289586
  init_sink();
289092
289587
  init_systemMetrics();
289093
289588
  init_transport();
@@ -289159,7 +289654,7 @@ function isAbortError$3(reason) {
289159
289654
  }
289160
289655
  var phase, installed$1, installedUncaughtHandler, installedRejectionHandler;
289161
289656
  var init_crash = __esmMin((() => {
289162
- init_client();
289657
+ init_client$1();
289163
289658
  phase = "startup";
289164
289659
  installed$1 = false;
289165
289660
  installedUncaughtHandler = null;
@@ -289191,7 +289686,7 @@ async function shutdownTelemetry(options = {}) {
289191
289686
  } catch {}
289192
289687
  }
289193
289688
  var init_src$7 = __esmMin((() => {
289194
- init_client();
289689
+ init_client$1();
289195
289690
  init_bootstrap();
289196
289691
  init_crash();
289197
289692
  }));
@@ -289244,12 +289739,11 @@ function freshNexgenProfile() {
289244
289739
  function refreshNexgenRegion() {
289245
289740
  return resolveNexgenRegionFresh().region;
289246
289741
  }
289247
- var MANAGED_NEXGEN_CODE_PROVIDER_KEY, NEXGEN_GLOBAL_PLATFORM_VALUE, resolver;
289742
+ var MANAGED_NEXGEN_CODE_PROVIDER_KEY, resolver;
289248
289743
  var init_region = __esmMin((() => {
289249
289744
  init_src$8();
289250
289745
  init_src$13();
289251
289746
  MANAGED_NEXGEN_CODE_PROVIDER_KEY = "managed:nexgenk";
289252
- NEXGEN_GLOBAL_PLATFORM_VALUE = "nexgenk-global";
289253
289747
  }));
289254
289748
  // src/constant/app.ts
289255
289749
  function nexgenkCodeSignupUrl() {
@@ -290520,23 +291014,23 @@ async function copyDeviceId(sourceHome, targetHome) {
290520
291014
  var TUI_TOP_LEVEL_KEYS, TOP_LEVEL_KEYS_TO_DROP, LOOP_CONTROL_FIELDS_TO_KEEP, BACKGROUND_FIELDS_TO_KEEP, REGISTERED_EXPERIMENTAL_FLAGS, TUI_THEMES, SUPPORTED_PROVIDER_TYPES, SUPPORTED_TOP_LEVEL_KEYS, LEGACY_PROVIDER_TYPE_MAP;
290521
291015
  var init_config$4 = __esmMin((() => {
290522
291016
  init_dist$8();
290523
- init_configSection$11();
290524
- init_configSection$9();
291017
+ init_configSection$12();
291018
+ init_configSection$10();
290525
291019
  init_configSectionContributions();
290526
291020
  init_flagRegistry();
290527
291021
  init_toml();
290528
- init_configSection$8();
290529
- init_configSection$15();
291022
+ init_configSection$9();
291023
+ init_configSection$16();
291024
+ init_configSection$5();
291025
+ init_configSection$21();
290530
291026
  init_configSection$4();
291027
+ init_flag$6();
290531
291028
  init_configSection$20();
290532
- init_configSection$3();
290533
- init_flag$5();
290534
- init_configSection$19();
291029
+ init_flag$3();
290535
291030
  init_flag$2();
290536
291031
  init_flag$1();
290537
- init_flag();
290538
- init_flag$3();
290539
- init_configSection$13();
291032
+ init_flag$4();
291033
+ init_configSection$14();
290540
291034
  init_atomic_write();
290541
291035
  init_stub_detect();
290542
291036
  init_source_config();
@@ -314978,33 +315472,6 @@ var init_esm = __esmMin((() => {
314978
315472
  ({program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help} = import_commander.default);
314979
315473
  }));
314980
315474
  // src/cli/sso/contract.ts
314981
- init_session_import();
314982
- init_esm();
314983
- /**
314984
- * Pure contract for the NexgenRouter SSO provisioning flow, ported from the
314985
- * gateway client already in production (`nexgen-movil/src/lib/gateway/sso-contract.ts`).
314986
- *
314987
- * ```
314988
- * 1. POST /sso/cli/start (public) -> { login_id, poll_secret, user_code, verification_uri_complete }
314989
- * 2. open verification_uri_complete -> SSO login
314990
- * 3. GET /sso/cli/poll/{login_id} [x-litellm-cli-poll-secret] -> pending… -> ready { key (JWT 24h), user_id, teams }
314991
- * 3b. GET .../poll/{login_id}?team_id=<id> -> ready { key } when `requires_team_selection`
314992
- * 4. POST /key/generate (Bearer JWT) -> durable key `sk-…`
314993
- * ```
314994
- *
314995
- * Everything here is decided without network so the parsing rules stay testable:
314996
- * the HTTP client that uses these pieces lives in `./client.ts`.
314997
- */
314998
- /** Team alias in the gateway that carries the models a CLI key should be scoped to. */
314999
- const NEXGEN_SSO_TEAM_ALIAS = "nexgen-desktop";
315000
- var SsoError = class extends Error {
315001
- code;
315002
- constructor(code, message) {
315003
- super(message);
315004
- this.name = "SsoError";
315005
- this.code = code;
315006
- }
315007
- };
315008
315475
  function isRecord$11(value) {
315009
315476
  return typeof value === "object" && value !== null;
315010
315477
  }
@@ -315062,9 +315529,6 @@ function parseReady(body) {
315062
315529
  teamId: body.teamId
315063
315530
  };
315064
315531
  }
315065
- const NO_TEAM_MESSAGE = `this account does not belong to the ${NEXGEN_SSO_TEAM_ALIAS} team — ask an administrator to add it`;
315066
- const NO_MATCHING_TEAM_MESSAGE = `this account belongs to several teams and none is ${NEXGEN_SSO_TEAM_ALIAS} — ask an administrator to add it`;
315067
- const NO_TEAM_MODELS_MESSAGE = `the ${NEXGEN_SSO_TEAM_ALIAS} team has no models assigned — ask an administrator to check the team`;
315068
315532
  function resolveLoginTeam(teams, details) {
315069
315533
  const byAlias = details.find((detail) => detail.teamAlias === "nexgen-desktop" && detail.teamId !== void 0)?.teamId;
315070
315534
  if (byAlias !== void 0) return { teamId: byAlias };
@@ -315140,16 +315604,22 @@ function selectTeam(teams, details) {
315140
315604
  if (firstWithId !== void 0) return firstWithId;
315141
315605
  return teams.length === 1 ? teams[0] : void 0;
315142
315606
  }
315607
+ var NEXGEN_SSO_TEAM_ALIAS, SsoError, NO_TEAM_MESSAGE, NO_MATCHING_TEAM_MESSAGE, NO_TEAM_MODELS_MESSAGE;
315608
+ var init_contract$1 = __esmMin((() => {
315609
+ NEXGEN_SSO_TEAM_ALIAS = "nexgen-desktop";
315610
+ SsoError = class extends Error {
315611
+ code;
315612
+ constructor(code, message) {
315613
+ super(message);
315614
+ this.name = "SsoError";
315615
+ this.code = code;
315616
+ }
315617
+ };
315618
+ NO_TEAM_MESSAGE = `this account does not belong to the ${NEXGEN_SSO_TEAM_ALIAS} team — ask an administrator to add it`;
315619
+ NO_MATCHING_TEAM_MESSAGE = `this account belongs to several teams and none is ${NEXGEN_SSO_TEAM_ALIAS} — ask an administrator to add it`;
315620
+ NO_TEAM_MODELS_MESSAGE = `the ${NEXGEN_SSO_TEAM_ALIAS} team has no models assigned — ask an administrator to check the team`;
315621
+ }));
315143
315622
  // src/cli/sso/client.ts
315144
- /**
315145
- * HTTP client for the NexgenRouter SSO provisioning flow described in
315146
- * `./contract.ts`. It turns a browser login into the durable `sk-…` key the
315147
- * CLI stores, mirroring the client already in production for the mobile and
315148
- * desktop apps.
315149
- */
315150
- const POLL_INTERVAL_MS$1 = 2e3;
315151
- const DEFAULT_EXPIRES_IN_SECONDS = 600;
315152
- const MAX_TEAM_SELECTIONS = 2;
315153
315623
  async function readJson(response) {
315154
315624
  const text = await response.text();
315155
315625
  try {
@@ -315198,7 +315668,10 @@ async function mintDurableKey(input, ready, signal) {
315198
315668
  signal
315199
315669
  });
315200
315670
  const body = await readJson(response);
315201
- if (!response.ok) throw new SsoError("malformed", `the gateway refused to create the key: ${typeof body === "object" && body !== null && "error" in body ? JSON.stringify(body.error).slice(0, 200) : `HTTP ${response.status}`}`);
315671
+ if (!response.ok) {
315672
+ const detail = typeof body === "object" && body !== null && "error" in body ? JSON.stringify(body.error).slice(0, 200) : `HTTP ${response.status}`;
315673
+ throw new SsoError("malformed", `the gateway refused to create the key: ${detail}`);
315674
+ }
315202
315675
  const minted = parseMintResponse(body, alias);
315203
315676
  return {
315204
315677
  key: minted.key,
@@ -315216,9 +315689,15 @@ async function provisionApiKeyViaSso(input) {
315216
315689
  const interval = input.pollIntervalMs ?? POLL_INTERVAL_MS$1;
315217
315690
  const start = await startSso(input, input.signal);
315218
315691
  const browserUrl = start.verificationUriComplete ?? `${input.gatewayUrl}/sso/key/generate?source=litellm-cli&key=${encodeURIComponent(start.loginId)}&user_code=${encodeURIComponent(start.userCode)}`;
315692
+ const expiresInSeconds = start.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS;
315693
+ input.onAuthorization?.({
315694
+ url: browserUrl,
315695
+ userCode: start.userCode,
315696
+ expiresInSeconds
315697
+ });
315219
315698
  input.onStatus?.(`Opening browser to sign in: ${browserUrl}`);
315220
315699
  input.openBrowser?.(browserUrl);
315221
- const deadline = now() + (start.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS) * 1e3 - 5e3;
315700
+ const deadline = now() + expiresInSeconds * 1e3 - 5e3;
315222
315701
  let pendingTeamId;
315223
315702
  let chosenTeamId;
315224
315703
  let selections = 0;
@@ -315249,6 +315728,100 @@ async function provisionApiKeyViaSso(input) {
315249
315728
  await sleep(interval);
315250
315729
  }
315251
315730
  }
315731
+ var POLL_INTERVAL_MS$1, DEFAULT_EXPIRES_IN_SECONDS, MAX_TEAM_SELECTIONS;
315732
+ var init_client = __esmMin((() => {
315733
+ init_contract$1();
315734
+ POLL_INTERVAL_MS$1 = 2e3;
315735
+ DEFAULT_EXPIRES_IN_SECONDS = 600;
315736
+ MAX_TEAM_SELECTIONS = 2;
315737
+ }));
315738
+ // src/cli/sso/provision.ts
315739
+ function normalizeBaseUrl(raw) {
315740
+ const trimmed = raw.trim().replace(/\/+$/, "");
315741
+ if (trimmed === "") throw new Error("empty base URL.");
315742
+ let parsed;
315743
+ try {
315744
+ parsed = new URL(trimmed);
315745
+ } catch {
315746
+ throw new Error(`invalid base URL "${raw}".`);
315747
+ }
315748
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error(`base URL must be http(s), got "${raw}".`);
315749
+ return parsed.pathname === "" || parsed.pathname === "/" ? `${trimmed}/v1` : trimmed;
315750
+ }
315751
+ /** `https://host/v1` → `https://host`, where the SSO and key endpoints live. */
315752
+ function gatewayOrigin(baseUrl) {
315753
+ const parsed = new URL(baseUrl);
315754
+ return /\/v1\/?$/.test(parsed.pathname) ? parsed.origin : baseUrl.replace(/\/+$/, "");
315755
+ }
315756
+ async function fetchRouterModels(input) {
315757
+ const url = `${input.baseUrl}/models`;
315758
+ let response;
315759
+ try {
315760
+ response = await fetch(url, {
315761
+ headers: {
315762
+ Authorization: `Bearer ${input.apiKey}`,
315763
+ Accept: "application/json"
315764
+ },
315765
+ signal: AbortSignal.timeout(MODELS_REQUEST_TIMEOUT_MS)
315766
+ });
315767
+ } catch (error) {
315768
+ if (error instanceof Error && error.name === "TimeoutError") throw new Error(`${url} did not answer within ${MODELS_REQUEST_TIMEOUT_MS / 1e3}s.`);
315769
+ throw new Error(`could not reach ${url}: ${error instanceof Error ? error.message : String(error)}`);
315770
+ }
315771
+ if (response.status === 401 || response.status === 403) throw new Error(`${url} rejected the API key (HTTP ${response.status}). Check the key and try again.`);
315772
+ if (!response.ok) {
315773
+ const body = (await response.text().catch(() => "")).slice(0, 200);
315774
+ throw new Error(`${url} answered HTTP ${response.status}${body === "" ? "" : `: ${body}`}`);
315775
+ }
315776
+ const models = ((await response.json().catch(() => void 0))?.data ?? []).flatMap((entry) => {
315777
+ if (typeof entry.id !== "string" || entry.id.length === 0) return [];
315778
+ return [{
315779
+ id: entry.id,
315780
+ maxInputTokens: entry.max_input_tokens,
315781
+ maxOutputTokens: entry.max_output_tokens
315782
+ }];
315783
+ });
315784
+ if (models.length === 0) throw new Error(`${url} returned no models for this key.`);
315785
+ return models;
315786
+ }
315787
+ function buildConfigPatch(input) {
315788
+ const aliases = {};
315789
+ for (const model of input.models) aliases[model.id] = {
315790
+ provider: PROVIDER_ID,
315791
+ model: model.id,
315792
+ maxContextSize: model.maxInputTokens ?? FALLBACK_MAX_CONTEXT_SIZE,
315793
+ maxOutputSize: model.maxOutputTokens,
315794
+ displayName: model.id
315795
+ };
315796
+ const ids = input.models.map((model) => model.id);
315797
+ return {
315798
+ providers: { [PROVIDER_ID]: {
315799
+ type: "nexgenk",
315800
+ baseUrl: input.baseUrl,
315801
+ apiKey: input.apiKey
315802
+ } },
315803
+ models: aliases,
315804
+ defaultModel: ids.includes("nexgen-auto") ? PREFERRED_MODEL : ids[0],
315805
+ services: {
315806
+ nexgenSearch: {
315807
+ baseUrl: `${input.baseUrl}/tools/search`,
315808
+ apiKey: input.apiKey
315809
+ },
315810
+ nexgenFetch: {
315811
+ baseUrl: `${input.baseUrl}/tools/fetch`,
315812
+ apiKey: input.apiKey
315813
+ }
315814
+ }
315815
+ };
315816
+ }
315817
+ var DEFAULT_BASE_URL, PROVIDER_ID, PREFERRED_MODEL, FALLBACK_MAX_CONTEXT_SIZE, MODELS_REQUEST_TIMEOUT_MS;
315818
+ var init_provision = __esmMin((() => {
315819
+ DEFAULT_BASE_URL = "https://ia.nexgen.systems/v1";
315820
+ PROVIDER_ID = "nexgenk";
315821
+ PREFERRED_MODEL = "nexgen-auto";
315822
+ FALLBACK_MAX_CONTEXT_SIZE = 262144;
315823
+ MODELS_REQUEST_TIMEOUT_MS = 2e4;
315824
+ }));
315252
315825
  // src/utils/process/resolve-command.ts
315253
315826
  function pathExtensions(platform, env) {
315254
315827
  if (platform !== "win32") return [""];
@@ -315334,17 +315907,16 @@ var init_open_url = __esmMin((() => {
315334
315907
  init_resolve_command();
315335
315908
  }));
315336
315909
  // src/cli/sub/login-flow.ts
315910
+ init_session_import();
315911
+ init_esm();
315337
315912
  init_src$8();
315338
315913
  init_version$2();
315914
+ init_client();
315915
+ init_provision();
315339
315916
  init_open_url();
315340
- const DEFAULT_BASE_URL = "https://ia.nexgen.systems/v1";
315341
- const PROVIDER_ID = "nexgenk";
315342
- const PREFERRED_MODEL = "nexgen-auto";
315343
- const FALLBACK_MAX_CONTEXT_SIZE = 262144;
315344
- const MODELS_REQUEST_TIMEOUT_MS = 2e4;
315345
315917
  async function runLoginFlow(options = {}) {
315346
315918
  try {
315347
- const baseUrl = normalizeBaseUrl(options.baseUrl ?? readEnv("NEXGEN_BASE_URL") ?? DEFAULT_BASE_URL);
315919
+ const baseUrl = normalizeBaseUrl(options.baseUrl ?? readEnv("NEXGEN_BASE_URL") ?? "https://ia.nexgen.systems/v1");
315348
315920
  const { apiKey, source } = await obtainApiKey(options, baseUrl);
315349
315921
  const models = await fetchRouterModels({
315350
315922
  apiKey,
@@ -315359,7 +315931,7 @@ async function runLoginFlow(options = {}) {
315359
315931
  apiKey,
315360
315932
  baseUrl,
315361
315933
  models
315362
- }))).defaultModel ?? PREFERRED_MODEL;
315934
+ }))).defaultModel ?? "nexgen-auto";
315363
315935
  process.stderr.write([
315364
315936
  "",
315365
315937
  `Logged in to ${baseUrl} (${models.length} models available) via ${source}.`,
@@ -315404,15 +315976,14 @@ async function obtainApiKey(options, baseUrl) {
315404
315976
  const provisioned = await provisionApiKeyViaSso({
315405
315977
  gatewayUrl: gatewayOrigin(baseUrl),
315406
315978
  signal: controller.signal,
315407
- onStatus: (line) => process.stderr.write(`${line}\n`),
315408
- openBrowser: (url) => {
315979
+ onAuthorization: (info) => {
315409
315980
  if (options.noBrowser === true) {
315410
- process.stderr.write(`Open this URL to sign in: ${url}\n`);
315981
+ process.stderr.write(`Sign in at ${info.url}\nThe code ${info.userCode} is already in the URL; it expires in ${Math.round(info.expiresInSeconds / 60)} minutes.\n`);
315411
315982
  return;
315412
315983
  }
315413
315984
  process.stderr.write(`Waiting for the SSO login to complete…\n`);
315414
- openUrl(url, (error) => {
315415
- process.stderr.write(`Could not open a browser (${error.message}). Open this URL to sign in: ${url}\n`);
315985
+ openUrl(info.url, (error) => {
315986
+ process.stderr.write(`Could not open a browser (${error.message}). Sign in at ${info.url}\n`);
315416
315987
  });
315417
315988
  }
315418
315989
  });
@@ -315424,73 +315995,6 @@ async function obtainApiKey(options, baseUrl) {
315424
315995
  process.off("SIGINT", onSigint);
315425
315996
  }
315426
315997
  }
315427
- function normalizeBaseUrl(raw) {
315428
- const trimmed = raw.trim().replace(/\/+$/, "");
315429
- if (trimmed === "") throw new Error("empty base URL.");
315430
- let parsed;
315431
- try {
315432
- parsed = new URL(trimmed);
315433
- } catch {
315434
- throw new Error(`invalid base URL "${raw}".`);
315435
- }
315436
- if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error(`base URL must be http(s), got "${raw}".`);
315437
- return parsed.pathname === "" || parsed.pathname === "/" ? `${trimmed}/v1` : trimmed;
315438
- }
315439
- function gatewayOrigin(baseUrl) {
315440
- const parsed = new URL(baseUrl);
315441
- return /\/v1\/?$/.test(parsed.pathname) ? parsed.origin : baseUrl.replace(/\/+$/, "");
315442
- }
315443
- async function fetchRouterModels(input) {
315444
- const url = `${input.baseUrl}/models`;
315445
- let response;
315446
- try {
315447
- response = await fetch(url, {
315448
- headers: {
315449
- Authorization: `Bearer ${input.apiKey}`,
315450
- Accept: "application/json"
315451
- },
315452
- signal: AbortSignal.timeout(MODELS_REQUEST_TIMEOUT_MS)
315453
- });
315454
- } catch (error) {
315455
- if (error instanceof Error && error.name === "TimeoutError") throw new Error(`${url} did not answer within ${MODELS_REQUEST_TIMEOUT_MS / 1e3}s.`);
315456
- throw new Error(`could not reach ${url}: ${error instanceof Error ? error.message : String(error)}`);
315457
- }
315458
- if (response.status === 401 || response.status === 403) throw new Error(`${url} rejected the API key (HTTP ${response.status}). Check the key and try again.`);
315459
- if (!response.ok) {
315460
- const body = (await response.text().catch(() => "")).slice(0, 200);
315461
- throw new Error(`${url} answered HTTP ${response.status}${body === "" ? "" : `: ${body}`}`);
315462
- }
315463
- const models = ((await response.json().catch(() => void 0))?.data ?? []).flatMap((entry) => {
315464
- if (typeof entry.id !== "string" || entry.id.length === 0) return [];
315465
- return [{
315466
- id: entry.id,
315467
- maxInputTokens: entry.max_input_tokens,
315468
- maxOutputTokens: entry.max_output_tokens
315469
- }];
315470
- });
315471
- if (models.length === 0) throw new Error(`${url} returned no models for this key.`);
315472
- return models;
315473
- }
315474
- function buildConfigPatch(input) {
315475
- const aliases = {};
315476
- for (const model of input.models) aliases[model.id] = {
315477
- provider: PROVIDER_ID,
315478
- model: model.id,
315479
- maxContextSize: model.maxInputTokens ?? FALLBACK_MAX_CONTEXT_SIZE,
315480
- maxOutputSize: model.maxOutputTokens,
315481
- displayName: model.id
315482
- };
315483
- const ids = input.models.map((model) => model.id);
315484
- return {
315485
- providers: { [PROVIDER_ID]: {
315486
- type: "nexgenk",
315487
- baseUrl: input.baseUrl,
315488
- apiKey: input.apiKey
315489
- } },
315490
- models: aliases,
315491
- defaultModel: ids.includes(PREFERRED_MODEL) ? PREFERRED_MODEL : ids[0]
315492
- };
315493
- }
315494
315998
  // ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.3.0_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
315495
315999
  var AGENT_METHODS, CLIENT_METHODS, PROTOCOL_METHODS;
315496
316000
  var init_schema$2 = __esmMin((() => {
@@ -322765,6 +323269,190 @@ var init_config$3 = __esmMin((() => {
322765
323269
  }
322766
323270
  };
322767
323271
  }));
323272
+ // src/cli/sub/doctor-tools.ts
323273
+ init_config$3();
323274
+ init_src$8();
323275
+ const PROBE_TIMEOUT_MS = 15e3;
323276
+ async function probeRouterTools(input) {
323277
+ const doFetch = input.fetchImpl ?? fetch;
323278
+ const timeoutMs = input.timeoutMs ?? PROBE_TIMEOUT_MS;
323279
+ const baseUrl = input.providerBaseUrl;
323280
+ const apiKey = input.apiKey;
323281
+ const rows = [];
323282
+ if (baseUrl === void 0 || apiKey === void 0 || apiKey.length === 0) {
323283
+ rows.push({
323284
+ name: "credentials",
323285
+ state: "BLOQUEADO",
323286
+ detail: "no nexgenk provider with an API key in config.toml — run `nexgenk login`"
323287
+ });
323288
+ return rows;
323289
+ }
323290
+ const auth = { Authorization: `Bearer ${apiKey}` };
323291
+ rows.push(await classify$1("models", async () => {
323292
+ const response = await doFetch(`${baseUrl}/models`, {
323293
+ headers: auth,
323294
+ signal: AbortSignal.timeout(timeoutMs)
323295
+ });
323296
+ if (!response.ok) return failed(response);
323297
+ const body = await response.json().catch(() => void 0);
323298
+ const count = Array.isArray(body?.data) ? body.data.length : 0;
323299
+ return count === 0 ? {
323300
+ state: "BLOQUEADO",
323301
+ detail: "HTTP 200 without models"
323302
+ } : {
323303
+ state: "MEDIDO",
323304
+ detail: `${count} models granted`
323305
+ };
323306
+ }));
323307
+ rows.push(await probePost("search", input.searchUrl, `${baseUrl}/tools/search`, {
323308
+ query: "nexgen probe",
323309
+ count: 1
323310
+ }, auth, doFetch, timeoutMs));
323311
+ rows.push(await probePost("fetch", input.fetchUrl, `${baseUrl}/tools/fetch`, { url: "https://example.com" }, auth, doFetch, timeoutMs));
323312
+ rows.push(serverToolRow(input));
323313
+ rows.push({
323314
+ name: "fim",
323315
+ state: "SIN-SONDA",
323316
+ detail: "POST /beta/completions answers 404; no public route"
323317
+ });
323318
+ rows.push({
323319
+ name: "balance",
323320
+ state: "SIN-SONDA",
323321
+ detail: "GET /user/balance answers 404; no public route"
323322
+ });
323323
+ rows.push({
323324
+ name: "files",
323325
+ state: "SIN-SONDA",
323326
+ detail: "needs a Files grant on the key, and no endpoint serves the bytes"
323327
+ });
323328
+ rows.push({
323329
+ name: "denied:shell,bash,apply_patch",
323330
+ state: "SIN-SONDA",
323331
+ detail: "denied by edge policy; the catalog never declares them"
323332
+ });
323333
+ return rows;
323334
+ }
323335
+ function serverToolRow(input) {
323336
+ if (!input.serverToolsFlagOn) return {
323337
+ name: "server_tools",
323338
+ state: "SIN-SONDA",
323339
+ detail: "feature disabled (NEXGEN_EXPERIMENTAL_SERVER_TOOLS)"
323340
+ };
323341
+ if (input.serverToolsEnabled.length === 0) return {
323342
+ name: "server_tools",
323343
+ state: "SIN-SONDA",
323344
+ detail: "no [server_tools] enabled entries"
323345
+ };
323346
+ return {
323347
+ name: "server_tools",
323348
+ state: "SIN-SONDA",
323349
+ detail: `declared on the next model turn: ${input.serverToolsEnabled.join(", ")}`
323350
+ };
323351
+ }
323352
+ async function probePost(name, configuredUrl, defaultUrl, body, auth, doFetch, timeoutMs) {
323353
+ if (configuredUrl === void 0) return {
323354
+ name,
323355
+ state: "SIN-SONDA",
323356
+ detail: "no [services] entry — `nexgenk login` provisions it"
323357
+ };
323358
+ const url = configuredUrl.length > 0 ? configuredUrl : defaultUrl;
323359
+ return classify$1(name, async () => {
323360
+ const response = await doFetch(url, {
323361
+ method: "POST",
323362
+ headers: {
323363
+ ...auth,
323364
+ "Content-Type": "application/json"
323365
+ },
323366
+ body: JSON.stringify(body),
323367
+ signal: AbortSignal.timeout(timeoutMs)
323368
+ });
323369
+ if (response.ok) return {
323370
+ state: "MEDIDO",
323371
+ detail: `HTTP 200 from ${url}`
323372
+ };
323373
+ return failed(response);
323374
+ });
323375
+ }
323376
+ async function classify$1(name, run) {
323377
+ try {
323378
+ const { state, detail } = await run();
323379
+ return {
323380
+ name,
323381
+ state,
323382
+ detail
323383
+ };
323384
+ } catch (error) {
323385
+ if (error instanceof Error && error.name === "TimeoutError") return {
323386
+ name,
323387
+ state: "BLOQUEADO",
323388
+ detail: "probe timed out"
323389
+ };
323390
+ return {
323391
+ name,
323392
+ state: "BLOQUEADO",
323393
+ detail: `probe failed: ${error instanceof Error ? error.message : String(error)}`
323394
+ };
323395
+ }
323396
+ }
323397
+ async function failed(response) {
323398
+ const motivo = response.headers.get("x-nexgen-motivo") ?? "";
323399
+ const bodyText = (await response.text().catch(() => "")).slice(0, 160);
323400
+ const detail = `HTTP ${response.status}${motivo === "" ? "" : ` ${motivo}`}${bodyText === "" ? "" : `: ${bodyText}`}`;
323401
+ if (response.status === 401 || response.status === 403) return {
323402
+ state: "DENEGADO",
323403
+ detail
323404
+ };
323405
+ if (response.status === 429) return {
323406
+ state: "DENEGADO",
323407
+ detail
323408
+ };
323409
+ return {
323410
+ state: "BLOQUEADO",
323411
+ detail
323412
+ };
323413
+ }
323414
+ async function handleDoctorTools(deps) {
323415
+ const configPath = resolveConfigPath({ homeDir: resolveNexgenHome() });
323416
+ const { config, fileError } = loadRuntimeConfigSafe(configPath);
323417
+ if (fileError !== void 0) {
323418
+ deps.stderr.write(`Cannot read ${configPath}: ${fileError.message}\n`);
323419
+ deps.exit(1);
323420
+ }
323421
+ const provider = config.providers["nexgenk"];
323422
+ const rows = await probeRouterTools({
323423
+ providerBaseUrl: provider?.baseUrl,
323424
+ apiKey: provider?.apiKey,
323425
+ searchUrl: config.services?.nexgenSearch?.baseUrl,
323426
+ fetchUrl: config.services?.nexgenFetch?.baseUrl,
323427
+ serverToolsEnabled: readServerToolsEnabled(config.raw),
323428
+ serverToolsFlagOn: readFlag("NEXGEN_EXPERIMENTAL_SERVER_TOOLS"),
323429
+ fetchImpl: deps.fetchImpl
323430
+ });
323431
+ const conclusive = rows.every((row) => row.state === "MEDIDO" || row.state === "DENEGADO");
323432
+ const width = Math.max(...rows.map((row) => row.name.length));
323433
+ const lines = [
323434
+ "NexgenRouter tools",
323435
+ "",
323436
+ ...rows.map((row) => ` ${row.state.padEnd(9)} ${row.name.padEnd(width)} ${row.detail}`),
323437
+ "",
323438
+ conclusive ? "Every row was measured. A DENEGADO row means the edge refused it by policy, not that the tool is broken." : "NO CONCLUYENTE: some rows could not be measured (BLOQUEADO or SIN-SONDA are never green).",
323439
+ ""
323440
+ ];
323441
+ deps.stdout.write(lines.join("\n"));
323442
+ deps.exit(conclusive ? 0 : 2);
323443
+ }
323444
+ function readFlag(envName) {
323445
+ const raw = process.env[envName]?.trim().toLowerCase();
323446
+ if (raw === void 0 || raw === "") return false;
323447
+ return raw === "1" || raw === "true" || raw === "yes" || raw === "on";
323448
+ }
323449
+ function readServerToolsEnabled(raw) {
323450
+ const section = raw?.["server_tools"];
323451
+ if (section === null || typeof section !== "object") return [];
323452
+ const enabled = section["enabled"];
323453
+ if (!Array.isArray(enabled)) return [];
323454
+ return enabled.filter((entry) => typeof entry === "string");
323455
+ }
322768
323456
  // src/cli/v2/validate-config.ts
322769
323457
  var validate_config_exports = /* @__PURE__ */ __exportAll({ validateConfigTomlV2: () => validateConfigTomlV2 });
322770
323458
  /**
@@ -322861,7 +323549,6 @@ var init_validate_config = __esmMin((() => {
322861
323549
  // src/cli/sub/doctor.ts
322862
323550
  init_src$8();
322863
323551
  init_zod$1();
322864
- init_config$3();
322865
323552
  async function handleDoctor(deps, options) {
322866
323553
  const resolved = resolveDeps$1(deps);
322867
323554
  const specs = await buildCheckSpecs(resolved, options, resolved.cwd());
@@ -322888,6 +323575,14 @@ function registerDoctorCommand(parent, deps) {
322888
323575
  path
322889
323576
  });
322890
323577
  });
323578
+ doctor.command("tools").description("Probe the NexgenRouter tool surface and report measured states.").action(async () => {
323579
+ const resolved = resolveDeps$1(deps);
323580
+ await handleDoctorTools({
323581
+ stdout: resolved.stdout,
323582
+ stderr: resolved.stderr,
323583
+ exit: resolved.exit
323584
+ });
323585
+ });
322891
323586
  }
322892
323587
  async function runDoctorCommand(deps, options) {
322893
323588
  const resolved = resolveDeps$1(deps);
@@ -366414,7 +367109,7 @@ var listModelsResponseSchema, listProvidersResponseSchema, getProviderResponseSc
366414
367109
  var init_rest_modelCatalog = __esmMin((() => {
366415
367110
  init_zod$1();
366416
367111
  init_src$10();
366417
- init_catalog$2();
367112
+ init_catalog$3();
366418
367113
  listModelsResponseSchema = object$1({ items: array(modelCatalogItemSchema$1) });
366419
367114
  listProvidersResponseSchema = object$1({ items: array(providerCatalogItemSchema$1) });
366420
367115
  getProviderResponseSchema = providerCatalogItemSchema$1.extend({ api_key: string().optional() });
@@ -367005,9 +367700,9 @@ var providerIdParamSchema, modelActionTailParamSchema, providerActionTailParamSc
367005
367700
  var init_modelCatalog = __esmMin((() => {
367006
367701
  init_src$10();
367007
367702
  init_provider_credential();
367008
- init_catalog$2();
367703
+ init_catalog$3();
367009
367704
  init_discovery();
367010
- init_configSection$11();
367705
+ init_configSection$12();
367011
367706
  init_zod$1();
367012
367707
  init_envelope();
367013
367708
  init_defineRoute();
@@ -375299,7 +375994,7 @@ var init_registerApiV1Routes = __esmMin((() => {
375299
375994
  init_src$10();
375300
375995
  init_fiber();
375301
375996
  init_featureManager();
375302
- init_flag$5();
375997
+ init_flag$6();
375303
375998
  init_node$8();
375304
375999
  init_envelope();
375305
376000
  init_sessionEventBroadcaster();
@@ -462718,27 +463413,19 @@ var init_model_selector = __esmMin((() => {
462718
463413
  }));
462719
463414
  // src/tui/components/dialogs/platform-selector.ts
462720
463415
  function platformOptions() {
462721
- return [
462722
- NEXGEN_MAINLAND_CN_OPTION,
462723
- NEXGEN_GLOBAL_OPTION,
462724
- ...OPEN_PLATFORMS.map((platform) => ({
462725
- value: platform.id,
462726
- label: platform.name
462727
- }))
462728
- ];
463416
+ return [NEXGEN_SSO_OPTION, ...OPEN_PLATFORMS.map((platform) => ({
463417
+ value: platform.id,
463418
+ label: platform.name
463419
+ }))];
462729
463420
  }
462730
- var NEXGEN_MAINLAND_CN_OPTION, NEXGEN_GLOBAL_OPTION, PlatformSelectorComponent;
463421
+ var NEXGEN_SSO_OPTION, PlatformSelectorComponent;
462731
463422
  var init_platform_selector = __esmMin((() => {
462732
463423
  init_src$13();
462733
- init_region();
462734
463424
  init_choice_picker();
462735
- NEXGEN_MAINLAND_CN_OPTION = {
463425
+ NEXGEN_SSO_OPTION = {
462736
463426
  value: "nexgenk",
462737
- label: "NexgenK (nexgenk.com/code)"
462738
- };
462739
- NEXGEN_GLOBAL_OPTION = {
462740
- value: NEXGEN_GLOBAL_PLATFORM_VALUE,
462741
- label: "NexgenK (nexgenk.ai/code)"
463427
+ label: "NexgenK (SSO)",
463428
+ description: "Sign in at ia.nexgen.systems and mint an API key"
462742
463429
  };
462743
463430
  PlatformSelectorComponent = class extends ChoicePickerComponent {
462744
463431
  constructor(opts) {
@@ -462949,7 +463636,7 @@ async function handleLoginCommand(host) {
462949
463636
  const platformId = await promptPlatformSelection(host);
462950
463637
  if (platformId === void 0) return;
462951
463638
  if (platformId === "nexgenk" || platformId === "nexgenk-global") {
462952
- await handleNexgenCodeOAuthLogin(host, platformId === "nexgenk-global" ? "global" : "mainland-cn");
463639
+ await handleNexgenSsoLogin(host);
462953
463640
  return;
462954
463641
  }
462955
463642
  const platform = getOpenPlatformById(platformId);
@@ -462959,23 +463646,41 @@ async function handleLoginCommand(host) {
462959
463646
  releaseAuthBlock();
462960
463647
  }
462961
463648
  }
462962
- async function handleNexgenCodeOAuthLogin(host, region) {
462963
- const alreadyLoggedIn = (await host.harness.auth.status(DEFAULT_OAUTH_PROVIDER_NAME)).providers.some((provider) => provider.providerName === "managed:nexgenk" && provider.hasToken);
462964
- let spinner;
463649
+ async function handleNexgenSsoLogin(host) {
462965
463650
  const controller = new AbortController();
462966
463651
  const cancelLogin = () => {
462967
463652
  controller.abort();
462968
463653
  };
462969
463654
  host.cancelInFlight = cancelLogin;
463655
+ let spinner;
462970
463656
  try {
462971
- await host.harness.auth.login(DEFAULT_OAUTH_PROVIDER_NAME, {
463657
+ const existing = await host.harness.getConfig();
463658
+ const configuredBaseUrl = existing.providers[PROVIDER_ID]?.baseUrl;
463659
+ const baseUrl = typeof configuredBaseUrl === "string" && configuredBaseUrl.length > 0 ? configuredBaseUrl : DEFAULT_BASE_URL;
463660
+ const alreadyLoggedIn = existing.providers[PROVIDER_ID] !== void 0;
463661
+ const provisioned = await provisionApiKeyViaSso({
463662
+ gatewayUrl: gatewayOrigin(baseUrl),
462972
463663
  signal: controller.signal,
462973
- region,
462974
- onDeviceCode: (data) => {
462975
- spinner = host.showLoginAuthorizationPrompt(data);
463664
+ onAuthorization: (info) => {
463665
+ spinner = host.showLoginAuthorizationPrompt({
463666
+ userCode: info.userCode,
463667
+ deviceCode: info.url,
463668
+ verificationUri: info.url,
463669
+ verificationUriComplete: info.url,
463670
+ expiresIn: info.expiresInSeconds,
463671
+ interval: 2
463672
+ });
462976
463673
  }
462977
463674
  });
462978
- refreshNexgenRegion();
463675
+ const models = await fetchRouterModels({
463676
+ apiKey: provisioned.key,
463677
+ baseUrl
463678
+ });
463679
+ await host.harness.setConfig(buildConfigPatch({
463680
+ apiKey: provisioned.key,
463681
+ baseUrl,
463682
+ models
463683
+ }));
462979
463684
  if (host.state.appState.model.trim().length > 0) host.setAuthRequired(false);
462980
463685
  spinner?.stop({
462981
463686
  ok: true,
@@ -462990,32 +463695,25 @@ async function handleNexgenCodeOAuthLogin(host, region) {
462990
463695
  return;
462991
463696
  }
462992
463697
  host.track("login", {
462993
- provider: DEFAULT_OAUTH_PROVIDER_NAME,
462994
- method: "oauth",
463698
+ provider: PROVIDER_ID,
463699
+ method: "sso",
462995
463700
  already_logged_in: alreadyLoggedIn
462996
463701
  });
462997
- if (alreadyLoggedIn) host.showStatus("Already logged in. Model configuration refreshed.", "success");
463702
+ host.showStatus(`Signed in to ${baseUrl} · key ${provisioned.alias}`, "success");
462998
463703
  } catch (error) {
462999
463704
  const cancelled = controller.signal.aborted;
463000
- const denied = error instanceof OAuthAccessDeniedError;
463001
463705
  spinner?.stop({
463002
463706
  ok: false,
463003
- label: cancelled || denied ? "Login cancelled." : "Login failed."
463707
+ label: cancelled ? "Login cancelled." : "Login failed."
463004
463708
  });
463005
463709
  spinner = void 0;
463006
463710
  if (cancelled) return;
463007
- const message = formatErrorMessage$2(error);
463008
- if (denied) {
463009
- host.showError(`Login cancelled: ${message}`);
463010
- return;
463011
- }
463012
463711
  log$1.warn("login failed", {
463013
- providerName: DEFAULT_OAUTH_PROVIDER_NAME,
463014
- alreadyLoggedIn,
463712
+ providerName: PROVIDER_ID,
463015
463713
  sessionId: host.session?.id,
463016
463714
  error
463017
463715
  });
463018
- host.showError(`Login failed: ${message}`);
463716
+ host.showError(`Login failed: ${formatErrorMessage$2(error)}`);
463019
463717
  } finally {
463020
463718
  if (host.cancelInFlight === cancelLogin) host.cancelInFlight = void 0;
463021
463719
  }
@@ -463116,6 +463814,8 @@ async function handleLogoutCommand(host) {
463116
463814
  var init_auth = __esmMin((() => {
463117
463815
  init_src$13();
463118
463816
  init_src$8();
463817
+ init_client();
463818
+ init_provision();
463119
463819
  init_nexgenk_tui();
463120
463820
  init_event_payload();
463121
463821
  init_region();