nexgenk 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.mjs +1302 -513
  2. package/package.json +44 -44
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,17 @@ 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
+ SERVER_TOOL_UNSUPPORTED_SURFACE: "server_tools.unsupported_surface"
56130
+ } };
56131
+ registerErrorDomain(ServerToolsErrors);
56132
+ }));
56122
56133
  // ../../packages/agent-core-v2/src/session/errors.ts
56123
56134
  var SessionErrors;
56124
56135
  var init_errors$17 = __esmMin((() => {
@@ -56158,7 +56169,7 @@ var init_errors$16 = __esmMin((() => {
56158
56169
  var StateErrors, StateError;
56159
56170
  var init_errors$15 = __esmMin((() => {
56160
56171
  init_codes();
56161
- init_errors$39();
56172
+ init_errors$40();
56162
56173
  StateErrors = {
56163
56174
  codes: {
56164
56175
  STATE_DUPLICATE_FOLD: "state.duplicate_fold",
@@ -56229,7 +56240,7 @@ var StorageErrors, StorageError, REASONS, IFileSystemStorageService;
56229
56240
  var init_storage$1 = __esmMin((() => {
56230
56241
  init_instantiation();
56231
56242
  init_codes();
56232
- init_errors$39();
56243
+ init_errors$40();
56233
56244
  StorageErrors = {
56234
56245
  codes: {
56235
56246
  STORAGE_NOT_FOUND: "storage.not_found",
@@ -56324,7 +56335,7 @@ var init_errors$13 = __esmMin((() => {
56324
56335
  var WireErrors, WireError;
56325
56336
  var init_errors$12 = __esmMin((() => {
56326
56337
  init_codes();
56327
- init_errors$39();
56338
+ init_errors$40();
56328
56339
  WireErrors = {
56329
56340
  codes: {
56330
56341
  WIRE_UNKNOWN_RECORD: "wire.unknown_record",
@@ -56412,7 +56423,7 @@ function readErrorCause(error) {
56412
56423
  var MAX_CAUSE_DEPTH, toNexgenErrorPayload;
56413
56424
  var init_serialize$2 = __esmMin((() => {
56414
56425
  init_codes();
56415
- init_errors$39();
56426
+ init_errors$40();
56416
56427
  MAX_CAUSE_DEPTH = 8;
56417
56428
  toNexgenErrorPayload = toErrorPayload;
56418
56429
  }));
@@ -56463,24 +56474,25 @@ var init_unexpectedError = __esmMin((() => {
56463
56474
  var ErrorCodes;
56464
56475
  var init_errors$10 = __esmMin((() => {
56465
56476
  init_codes();
56477
+ init_errors$43();
56466
56478
  init_errors$42();
56467
56479
  init_errors$41();
56468
- init_errors$40();
56480
+ init_errors$37();
56469
56481
  init_errors$36();
56470
56482
  init_errors$35();
56471
56483
  init_errors$34();
56472
56484
  init_errors$33();
56473
56485
  init_errors$32();
56474
- init_errors$31();
56475
56486
  init_fileService();
56487
+ init_errors$29();
56476
56488
  init_errors$28();
56477
56489
  init_errors$27();
56478
56490
  init_errors$26();
56479
56491
  init_errors$25();
56480
56492
  init_errors$24();
56481
- init_errors$23();
56482
56493
  init_hostFsErrors();
56483
56494
  init_hostProcess();
56495
+ init_errors$23();
56484
56496
  init_errors$22();
56485
56497
  init_errors$21();
56486
56498
  init_errors$20();
@@ -56496,7 +56508,7 @@ var init_errors$10 = __esmMin((() => {
56496
56508
  init_errors$11();
56497
56509
  init_codes();
56498
56510
  init_errorMessage();
56499
- init_errors$39();
56511
+ init_errors$40();
56500
56512
  init_serialize$2();
56501
56513
  init_unexpectedError();
56502
56514
  ErrorCodes = {
@@ -56523,6 +56535,7 @@ var init_errors$10 = __esmMin((() => {
56523
56535
  ...PromptErrors.codes,
56524
56536
  ...ModelsDevImportErrors.codes,
56525
56537
  ...SessionExportErrors.codes,
56538
+ ...ServerToolsErrors.codes,
56526
56539
  ...SessionErrors.codes,
56527
56540
  ...SkillErrors.codes,
56528
56541
  ...StorageErrors.codes,
@@ -56610,7 +56623,7 @@ var HOOK_EVENT_TYPES$1, ProviderTypeSchema$1, OAuthRefSchema$2, StringRecordSche
56610
56623
  var init_schema$4 = __esmMin((() => {
56611
56624
  init_matchesRule();
56612
56625
  init_zod$1();
56613
- init_errors$43();
56626
+ init_errors$44();
56614
56627
  HOOK_EVENT_TYPES$1 = [
56615
56628
  "PreToolUse",
56616
56629
  "PostToolUse",
@@ -58039,7 +58052,7 @@ function rawThinking(config) {
58039
58052
  }
58040
58053
  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
58054
  var init_env_model = __esmMin((() => {
58042
- init_errors$43();
58055
+ init_errors$44();
58043
58056
  init_resolve$1();
58044
58057
  init_schema$4();
58045
58058
  ENV_MODEL_PROVIDER_KEY$1 = "__nexgenk_env__";
@@ -58297,7 +58310,7 @@ function transformTomlData$1(data) {
58297
58310
  else if (targetKey === "models" && isPlainObject$6(value)) result[targetKey] = transformRecord(value, transformModelData);
58298
58311
  else if (targetKey === "thinking" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
58299
58312
  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);
58313
+ else if (targetKey === "services" && isPlainObject$6(value)) result[targetKey] = migrateLegacyServiceKeys$1(transformRecord(value, transformServiceData, snakeToCamel$2));
58301
58314
  else if (targetKey === "loopControl" && isPlainObject$6(value)) result[targetKey] = transformLoopControlData(value);
58302
58315
  else if (targetKey === "background" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
58303
58316
  else if (targetKey === "image" && isPlainObject$6(value)) result[targetKey] = transformPlainObject$1(value);
@@ -58314,6 +58327,26 @@ function transformRecord(value, transformEntry, transformName = (name) => name)
58314
58327
  for (const [entryName, entryConfig] of Object.entries(value)) record[transformName(entryName)] = isPlainObject$6(entryConfig) ? transformEntry(entryConfig) : entryConfig;
58315
58328
  return record;
58316
58329
  }
58330
+ function migrateLegacyServiceKeys$1(services) {
58331
+ let out;
58332
+ for (const [legacy, current] of Object.entries(LEGACY_SERVICE_KEYS$1)) {
58333
+ if (!(legacy in services)) continue;
58334
+ out ??= { ...services };
58335
+ const shadowed = out[current] !== void 0;
58336
+ if (!shadowed) out[current] = out[legacy];
58337
+ delete out[legacy];
58338
+ reportLegacyServiceKey$1(legacy, current, shadowed);
58339
+ }
58340
+ return out ?? services;
58341
+ }
58342
+ function reportLegacyServiceKey$1(legacy, current, shadowed) {
58343
+ const key = `${legacy}->${current}`;
58344
+ if (reportedLegacyServiceKeys$1.has(key)) return;
58345
+ reportedLegacyServiceKeys$1.add(key);
58346
+ const from = `services.${legacy.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
58347
+ const to = `services.${current.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
58348
+ 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" });
58349
+ }
58317
58350
  function transformPlainObject$1(data) {
58318
58351
  const out = {};
58319
58352
  for (const [key, value] of Object.entries(data)) out[snakeToCamel$2(key)] = value;
@@ -58579,10 +58612,10 @@ function setDefined$1(target, key, value) {
58579
58612
  function isFileExistsError(error) {
58580
58613
  return typeof error === "object" && error !== null && error.code === "EEXIST";
58581
58614
  }
58582
- var DEFAULT_CONFIG_FILE_TEXT$1, ENTRY_KEYED_SECTIONS, PROVIDER_CREDENTIAL_FIELDS$1;
58615
+ var DEFAULT_CONFIG_FILE_TEXT$1, ENTRY_KEYED_SECTIONS, LEGACY_SERVICE_KEYS$1, reportedLegacyServiceKeys$1, PROVIDER_CREDENTIAL_FIELDS$1;
58583
58616
  var init_toml$1 = __esmMin((() => {
58584
58617
  init_dist$8();
58585
- init_errors$43();
58618
+ init_errors$44();
58586
58619
  init_fs$3();
58587
58620
  init_env_model();
58588
58621
  init_secondary_model();
@@ -58593,6 +58626,13 @@ var init_toml$1 = __esmMin((() => {
58593
58626
  # Login will populate managed Nexgen provider and model entries.
58594
58627
  `;
58595
58628
  ENTRY_KEYED_SECTIONS = /* @__PURE__ */ new Set(["providers", "models"]);
58629
+ LEGACY_SERVICE_KEYS$1 = {
58630
+ moonshotSearch: "nexgenSearch",
58631
+ moonshotFetch: "nexgenFetch",
58632
+ kimiSearch: "nexgenSearch",
58633
+ kimiFetch: "nexgenFetch"
58634
+ };
58635
+ reportedLegacyServiceKeys$1 = /* @__PURE__ */ new Set();
58596
58636
  PROVIDER_CREDENTIAL_FIELDS$1 = [
58597
58637
  "apiKey",
58598
58638
  "oauth",
@@ -64068,7 +64108,7 @@ function mapOAuthTokenError(error, providerName) {
64068
64108
  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
64109
  }
64070
64110
  var init_oauth_error = __esmMin((() => {
64071
- init_errors$43();
64111
+ init_errors$44();
64072
64112
  init_src$13();
64073
64113
  }));
64074
64114
  // ../../packages/node-sdk/src/auth.ts
@@ -72982,7 +73022,7 @@ var init_ajv_provider = __esmMin((() => {
72982
73022
  }));
72983
73023
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
72984
73024
  var ExperimentalClientTasks;
72985
- var init_client$2 = __esmMin((() => {
73025
+ var init_client$3 = __esmMin((() => {
72986
73026
  init_types$27();
72987
73027
  ExperimentalClientTasks = class {
72988
73028
  constructor(_client) {
@@ -73232,12 +73272,12 @@ function getSupportedElicitationModes(capabilities) {
73232
73272
  };
73233
73273
  }
73234
73274
  var Client;
73235
- var init_client$1 = __esmMin((() => {
73275
+ var init_client$2 = __esmMin((() => {
73236
73276
  init_protocol$4();
73237
73277
  init_types$27();
73238
73278
  init_ajv_provider();
73239
73279
  init_zod_compat();
73240
- init_client$2();
73280
+ init_client$3();
73241
73281
  init_helpers$2();
73242
73282
  Client = class extends Protocol {
73243
73283
  /**
@@ -76306,7 +76346,7 @@ function buildMcpHttpHeaders(config, envLookup) {
76306
76346
  var HttpMcpClient;
76307
76347
  var init_client_http = __esmMin((() => {
76308
76348
  init_errors$10();
76309
- init_client$1();
76349
+ init_client$2();
76310
76350
  init_streamableHttp();
76311
76351
  init_client_shared();
76312
76352
  init_client_remote();
@@ -76433,7 +76473,7 @@ function isTerminalSseTransportError(error) {
76433
76473
  var SseMcpClient;
76434
76474
  var init_client_sse = __esmMin((() => {
76435
76475
  init_errors$10();
76436
- init_client$1();
76476
+ init_client$2();
76437
76477
  init_sse();
76438
76478
  init_client_shared();
76439
76479
  init_client_remote();
@@ -102230,7 +102270,7 @@ function classifyStdioStartupError(error) {
102230
102270
  }
102231
102271
  var STDERR_BUFFER_CAPACITY, STDIO_TERMINATION_GRACE_MS, StdioMcpClient, RuntimeStdioTransport, BoundedTail, permanentSpawnErrnos;
102232
102272
  var init_client_stdio = __esmMin((() => {
102233
- init_client$1();
102273
+ init_client$2();
102234
102274
  init_stdio();
102235
102275
  init_errors$10();
102236
102276
  init_hostProcess();
@@ -109093,7 +109133,7 @@ function createAppScope(options = {}) {
109093
109133
  }
109094
109134
  var _scopeTopology, _scopedRegistry, Scope;
109095
109135
  var init_scope = __esmMin((() => {
109096
- init_errors$39();
109136
+ init_errors$40();
109097
109137
  init_descriptors();
109098
109138
  init_instantiation();
109099
109139
  init_instantiationService();
@@ -111660,7 +111700,7 @@ function isRecord$25(value) {
111660
111700
  var SkillParseError, UnsupportedSkillTypeError, FENCE, METADATA_ALIASES;
111661
111701
  var init_parser$2 = __esmMin((() => {
111662
111702
  init_dist$5();
111663
- init_errors$39();
111703
+ init_errors$40();
111664
111704
  init_frontmatter();
111665
111705
  init_errors$16();
111666
111706
  init_types$24();
@@ -112485,7 +112525,7 @@ var ISessionLockService, SessionLockHolds;
112485
112525
  var init_sessionLock = __esmMin((() => {
112486
112526
  init_instantiation();
112487
112527
  init_lifecycle$2();
112488
- init_errors$39();
112528
+ init_errors$40();
112489
112529
  init_event$2();
112490
112530
  init_errors$17();
112491
112531
  ISessionLockService = createDecorator("sessionLockService");
@@ -113782,7 +113822,7 @@ function toJsonSafe(value, seen) {
113782
113822
  var StateRegistry;
113783
113823
  var init_stateRegistry = __esmMin((() => {
113784
113824
  init_lifecycle$2();
113785
- init_errors$39();
113825
+ init_errors$40();
113786
113826
  init_event$2();
113787
113827
  StateRegistry = class extends Disposable {
113788
113828
  values = /* @__PURE__ */ new Map();
@@ -114829,7 +114869,7 @@ function event2FromRecord(cls, record) {
114829
114869
  }
114830
114870
  var DuplicateEventError, Event2, AgentEvent2, EVENT2_REGISTRY;
114831
114871
  var init_event2 = __esmMin((() => {
114832
- init_errors$31();
114872
+ init_errors$32();
114833
114873
  DuplicateEventError = class extends EventError {
114834
114874
  eventType;
114835
114875
  constructor(eventType) {
@@ -114965,7 +115005,7 @@ function expandedRuntimeFolds(owner, undoable, folds) {
114965
115005
  var ReplayableStateKeyImpl, StateKeyBuilderImpl, undoableProtocol;
114966
115006
  var init_state$1 = __esmMin((() => {
114967
115007
  init_immer();
114968
- init_errors$39();
115008
+ init_errors$40();
114969
115009
  init_event2();
114970
115010
  init_errors$15();
114971
115011
  enableMapSet();
@@ -118432,7 +118472,7 @@ function swallowRootAbortError(actor) {
118432
118472
  var reportRootActorError, createActor;
118433
118473
  var init_xstate2 = __esmMin((() => {
118434
118474
  init_xstate_esm();
118435
- init_errors$38();
118475
+ init_errors$39();
118436
118476
  init_xstateInspection();
118437
118477
  init_xstate_esm();
118438
118478
  reportRootActorError = () => {};
@@ -122873,7 +122913,7 @@ function parseTimeoutMsEnv$2(raw) {
122873
122913
  return Number.isInteger(parsed) && parsed >= 1 && parsed <= 2147483647 ? parsed : void 0;
122874
122914
  }
122875
122915
  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((() => {
122916
+ var init_configSection$21 = __esmMin((() => {
122877
122917
  init_zod$1();
122878
122918
  init_config$6();
122879
122919
  init_configSectionContributions();
@@ -123119,7 +123159,7 @@ var init_workspaceMcpConfigService = __esmMin((() => {
123119
123159
  init_bootstrap$1();
123120
123160
  init_config$6();
123121
123161
  init_configLoader();
123122
- init_configSection$20();
123162
+ init_configSection$21();
123123
123163
  init_configStore();
123124
123164
  init_plugin();
123125
123165
  init_hostFileSystem();
@@ -123608,7 +123648,7 @@ function builtinProductSkillsEnabled(config) {
123608
123648
  return config.get(BUILTIN_PRODUCT_SKILLS_SECTION) !== false;
123609
123649
  }
123610
123650
  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((() => {
123651
+ var init_configSection$20 = __esmMin((() => {
123612
123652
  init_zod$1();
123613
123653
  init_env$1();
123614
123654
  init_config$6();
@@ -123774,7 +123814,7 @@ var init_trustDisclosureService = __esmMin((() => {
123774
123814
  init_builtinAgentProfileLoader();
123775
123815
  init_workTree();
123776
123816
  init_configLoader();
123777
- init_configSection$19();
123817
+ init_configSection$20();
123778
123818
  init_skillRoots();
123779
123819
  EMPTY_INSTRUCTION_SOURCES$1 = {
123780
123820
  agentsMdPaths: [],
@@ -124029,7 +124069,7 @@ function isRecord$22(value) {
124029
124069
  var AgentFileParseError, AGENT_NAME_PATTERN;
124030
124070
  var init_agentFile = __esmMin((() => {
124031
124071
  init_codes();
124032
- init_errors$39();
124072
+ init_errors$40();
124033
124073
  init_frontmatter();
124034
124074
  AgentFileParseError = class extends Error2 {
124035
124075
  reason;
@@ -124501,7 +124541,7 @@ var init_agentRoots = __esmMin((() => {
124501
124541
  }));
124502
124542
  // ../../packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/configSection.ts
124503
124543
  var EXTRA_AGENT_DIRS_SECTION, ExtraAgentDirsConfigSchema;
124504
- var init_configSection$18 = __esmMin((() => {
124544
+ var init_configSection$19 = __esmMin((() => {
124505
124545
  init_zod$1();
124506
124546
  init_configSectionContributions();
124507
124547
  EXTRA_AGENT_DIRS_SECTION = "extraAgentDirs";
@@ -124529,7 +124569,7 @@ var init_extraAgentProfileLoaderService = __esmMin((() => {
124529
124569
  init_agentProfileContribution();
124530
124570
  init_agentProfileFromFile();
124531
124571
  init_agentRoots();
124532
- init_configSection$18();
124572
+ init_configSection$19();
124533
124573
  init_userAgentProfileLoader();
124534
124574
  init_bootstrap$1();
124535
124575
  init_config$6();
@@ -124925,7 +124965,7 @@ var init_extraFileSkillSource = __esmMin((() => {
124925
124965
  init_event$2();
124926
124966
  init_bootstrap$1();
124927
124967
  init_config$6();
124928
- init_configSection$19();
124968
+ init_configSection$20();
124929
124969
  init_skillRoots();
124930
124970
  init_skillDiscovery();
124931
124971
  init_skillSource();
@@ -125001,7 +125041,7 @@ var init_rootFileSkillSource = __esmMin((() => {
125001
125041
  init_paths$3();
125002
125042
  init_config$6();
125003
125043
  init_bootstrap$1();
125004
- init_configSection$19();
125044
+ init_configSection$20();
125005
125045
  init_skillDiscovery();
125006
125046
  init_skillRoots();
125007
125047
  init_skillSource();
@@ -125308,7 +125348,7 @@ var init_toml = __esmMin((() => {
125308
125348
  }));
125309
125349
  // ../../packages/agent-core-v2/src/app/flag/flag.ts
125310
125350
  var EXPERIMENTAL_SECTION, ExperimentalConfigSchema, experimentalFromToml, experimentalToToml, IFlagService;
125311
- var init_flag$5 = __esmMin((() => {
125351
+ var init_flag$6 = __esmMin((() => {
125312
125352
  init_zod$1();
125313
125353
  init_instantiation();
125314
125354
  init_configSectionContributions();
@@ -125599,9 +125639,9 @@ var init_builtinSkillSource = __esmMin((() => {
125599
125639
  init_scopes();
125600
125640
  init_scope();
125601
125641
  init_config$6();
125602
- init_flag$5();
125642
+ init_flag$6();
125603
125643
  init_builtin();
125604
- init_configSection$19();
125644
+ init_configSection$20();
125605
125645
  init_skillSource();
125606
125646
  init_decorateParam();
125607
125647
  init_decorate();
@@ -125862,7 +125902,7 @@ var init_userFileSkillSource = __esmMin((() => {
125862
125902
  init_timer();
125863
125903
  init_paths$3();
125864
125904
  init_watch();
125865
- init_configSection$19();
125905
+ init_configSection$20();
125866
125906
  init_skillDiscovery();
125867
125907
  init_skillRoots();
125868
125908
  init_skillSource();
@@ -127041,7 +127081,7 @@ var init_logService = __esmMin((() => {
127041
127081
  }));
127042
127082
  // ../../packages/agent-core-v2/src/features/plan/configSection.ts
127043
127083
  var DEFAULT_PLAN_MODE_SECTION, DefaultPlanModeSchema;
127044
- var init_configSection$17 = __esmMin((() => {
127084
+ var init_configSection$18 = __esmMin((() => {
127045
127085
  init_zod$1();
127046
127086
  init_configSectionContributions();
127047
127087
  DEFAULT_PLAN_MODE_SECTION = "defaultPlanMode";
@@ -127184,7 +127224,7 @@ function agentModelDefinitions() {
127184
127224
  var AgentModel, AGENT_MODEL_DEFINITIONS, AgentModelContribution, SessionModelContribution;
127185
127225
  var init_agentModel = __esmMin((() => {
127186
127226
  init_collection();
127187
- init_errors$39();
127227
+ init_errors$40();
127188
127228
  init_event2();
127189
127229
  AgentModel = class {
127190
127230
  committedState;
@@ -127274,7 +127314,7 @@ function agentSpaceOf(agent) {
127274
127314
  }
127275
127315
  var AgentSpaceImpl;
127276
127316
  var init_agentSpace = __esmMin((() => {
127277
- init_errors$39();
127317
+ init_errors$40();
127278
127318
  init_unexpectedError();
127279
127319
  init_agentModel();
127280
127320
  AgentSpaceImpl = class {
@@ -172007,7 +172047,7 @@ async function touchForkedFileHistory(input) {
172007
172047
  var RETENTION_DOC_SCOPE, touchQueues;
172008
172048
  var init_fileHistoryRetention = __esmMin((() => {
172009
172049
  init_dist$5();
172010
- init_errors$39();
172050
+ init_errors$40();
172011
172051
  init_unexpectedError();
172012
172052
  init_fileHistory$1();
172013
172053
  RETENTION_DOC_SCOPE = "file-history";
@@ -172156,7 +172196,7 @@ var AgentFileHistoryService, LCS_CELL_BUDGET, LCS_AGGREGATE_CELL_BUDGET;
172156
172196
  var init_fileHistoryService = __esmMin((() => {
172157
172197
  init_dist$5();
172158
172198
  init_service$1();
172159
- init_errors$39();
172199
+ init_errors$40();
172160
172200
  init_unexpectedError();
172161
172201
  init_agentRuntime();
172162
172202
  init_scopeContext();
@@ -172578,8 +172618,8 @@ function isMaxStepsExceededError$1(error) {
172578
172618
  var LoopError, IAgentLoopService;
172579
172619
  var init_loop = __esmMin((() => {
172580
172620
  init_instantiation();
172581
- init_errors$39();
172582
- init_errors$25();
172621
+ init_errors$40();
172622
+ init_errors$26();
172583
172623
  LoopError = class extends Error2 {
172584
172624
  constructor(code, message, options) {
172585
172625
  super(code, message, options);
@@ -173625,7 +173665,7 @@ var init_flagRegistry = __esmMin((() => {
173625
173665
  }));
173626
173666
  // ../../packages/agent-core-v2/src/features/notify/flag.ts
173627
173667
  var NOTIFY_USER_FLAG_ID, NOTIFY_USER_FLAG_ENV, notifyUserFlag;
173628
- var init_flag$4 = __esmMin((() => {
173668
+ var init_flag$5 = __esmMin((() => {
173629
173669
  init_flagRegistry();
173630
173670
  NOTIFY_USER_FLAG_ID = "notify_user";
173631
173671
  NOTIFY_USER_FLAG_ENV = "NEXGEN_EXPERIMENTAL_NOTIFY_USER";
@@ -173646,7 +173686,7 @@ function notifyUserAvailable(flags, bootstrap) {
173646
173686
  }
173647
173687
  var NOTIFY_USER_UI_CAPABILITY;
173648
173688
  var init_notifyUserAvailability = __esmMin((() => {
173649
- init_flag$4();
173689
+ init_flag$5();
173650
173690
  NOTIFY_USER_UI_CAPABILITY = "update_panel";
173651
173691
  }));
173652
173692
  // ../../packages/agent-core-v2/src/features/notify/sessionNotify.ts
@@ -173656,7 +173696,7 @@ var init_sessionNotify = __esmMin((() => {
173656
173696
  init_scopes();
173657
173697
  init_scope();
173658
173698
  init_bootstrap$1();
173659
- init_flag$5();
173699
+ init_flag$6();
173660
173700
  init_atomicDocumentStore$1();
173661
173701
  init_appendLogStore$1();
173662
173702
  init_sessionContext();
@@ -174264,11 +174304,11 @@ var init_sessionLifecycleService = __esmMin((() => {
174264
174304
  init_dist$5();
174265
174305
  init_lifecycle$2();
174266
174306
  init_scope();
174267
- init_errors$39();
174307
+ init_errors$40();
174268
174308
  init_event$2();
174269
174309
  init_log$1();
174270
174310
  init_logService();
174271
- init_configSection$17();
174311
+ init_configSection$18();
174272
174312
  init_fileHistory$1();
174273
174313
  init_fileHistoryService();
174274
174314
  init_fileHistoryRetention();
@@ -174278,7 +174318,7 @@ var init_sessionLifecycleService = __esmMin((() => {
174278
174318
  init_bootstrap$1();
174279
174319
  init_config$6();
174280
174320
  init_event$1();
174281
- init_flag$5();
174321
+ init_flag$6();
174282
174322
  init_sessionIndex();
174283
174323
  init_sessionIndexSource();
174284
174324
  init_telemetry$2();
@@ -174989,7 +175029,7 @@ var init_workspaceInstanceManagerService = __esmMin((() => {
174989
175029
  init_bootstrap$1();
174990
175030
  init_config$6();
174991
175031
  init_event$1();
174992
- init_flag$5();
175032
+ init_flag$6();
174993
175033
  init_git();
174994
175034
  init_oauthService();
174995
175035
  init_configStore();
@@ -175635,7 +175675,7 @@ var init_node$8 = __esmMin((() => {
175635
175675
  var AgentActorService;
175636
175676
  var init_agentActorService = __esmMin((() => {
175637
175677
  init_xstate2();
175638
- init_errors$39();
175678
+ init_errors$40();
175639
175679
  init_unexpectedError();
175640
175680
  init_instantiation();
175641
175681
  init_lifecycle$2();
@@ -175804,7 +175844,7 @@ function parsePollIntervalMs(raw) {
175804
175844
  return parsed;
175805
175845
  }
175806
175846
  var CRON_SECTION, DEFAULT_CRON_CONFIG, cronConfigSchema, on$1, cronEnvBindings, stripCronEnv;
175807
- var init_configSection$16 = __esmMin((() => {
175847
+ var init_configSection$17 = __esmMin((() => {
175808
175848
  init_config$6();
175809
175849
  init_configSectionContributions();
175810
175850
  CRON_SECTION = "cron";
@@ -177016,7 +177056,7 @@ var init_cronService = __esmMin((() => {
177016
177056
  init_event2();
177017
177057
  init_config$6();
177018
177058
  init_clock();
177019
- init_configSection$16();
177059
+ init_configSection$17();
177020
177060
  init_cron_expr();
177021
177061
  init_format$6();
177022
177062
  init_jitter();
@@ -179042,7 +179082,7 @@ var HostEnvironmentService;
179042
179082
  var init_hostEnvironmentService = __esmMin((() => {
179043
179083
  init_scopes();
179044
179084
  init_scope();
179045
- init_errors$39();
179085
+ init_errors$40();
179046
179086
  init_environmentProbe();
179047
179087
  init_loginShellPath();
179048
179088
  init_hostEnvironment();
@@ -179946,7 +179986,7 @@ function parsePrintBackgroundMode(raw) {
179946
179986
  return parsed.success ? parsed.data : void 0;
179947
179987
  }
179948
179988
  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((() => {
179989
+ var init_configSection$16 = __esmMin((() => {
179950
179990
  init_zod$1();
179951
179991
  init_env$1();
179952
179992
  init_config$6();
@@ -180592,7 +180632,7 @@ function rewriteWindowsNullRedirect(command) {
180592
180632
  var MS_PER_SECOND, SHELL_TIMEOUT_VARS, BashTool, WINDOWS_NUL_REDIRECT;
180593
180633
  var init_bashTool = __esmMin((() => {
180594
180634
  init_task$3();
180595
- init_configSection$15();
180635
+ init_configSection$16();
180596
180636
  init_config$6();
180597
180637
  init_sessionContext();
180598
180638
  init_workspaceContext();
@@ -185629,9 +185669,9 @@ var IOAuthService, IOAuthToolkit, IAuthSummaryService, AuthProvisioningRequiredE
185629
185669
  var init_auth$5 = __esmMin((() => {
185630
185670
  init_provider_credential();
185631
185671
  init_instantiation();
185632
- init_errors$39();
185633
- init_errors$37();
185634
- init_errors$41();
185672
+ init_errors$40();
185673
+ init_errors$38();
185674
+ init_errors$42();
185635
185675
  IOAuthService = createDecorator("oauthService");
185636
185676
  IOAuthToolkit = createDecorator("oauthToolkit");
185637
185677
  IAuthSummaryService = createDecorator("authSummaryService");
@@ -185753,7 +185793,7 @@ var init_globTool = __esmMin((() => {
185753
185793
  init_rgLocator();
185754
185794
  init_runRg$1();
185755
185795
  init_agentRuntime();
185756
- init_errors$39();
185796
+ init_errors$40();
185757
185797
  init_runtimeWorkspaceView();
185758
185798
  init_skillCatalog();
185759
185799
  init_workspaceContext();
@@ -186349,7 +186389,7 @@ var init_grepTool = __esmMin((() => {
186349
186389
  init_toolContribution();
186350
186390
  init_agentRuntime();
186351
186391
  init_runtimeWorkspaceView();
186352
- init_errors$39();
186392
+ init_errors$40();
186353
186393
  init_skillCatalog();
186354
186394
  init_workspaceContext();
186355
186395
  init_path_access();
@@ -186658,8 +186698,8 @@ var init_sessionMediaStore = __esmMin((() => {
186658
186698
  var ProfileError, IAgentProfileService;
186659
186699
  var init_profile$1 = __esmMin((() => {
186660
186700
  init_instantiation();
186661
- init_errors$39();
186662
- init_errors$21();
186701
+ init_errors$40();
186702
+ init_errors$22();
186663
186703
  ProfileError = class extends Error2 {
186664
186704
  constructor(code, message, details) {
186665
186705
  super(code, message, { details });
@@ -186859,7 +186899,7 @@ var init_toolResultTruncation = __esmMin((() => {
186859
186899
  }));
186860
186900
  // ../../packages/agent-core-v2/src/agent/tools/os/read/configSection.ts
186861
186901
  var READ_SECTION, ReadConfigSchema;
186862
- var init_configSection$14 = __esmMin((() => {
186902
+ var init_configSection$15 = __esmMin((() => {
186863
186903
  init_zod$1();
186864
186904
  init_configSectionContributions();
186865
186905
  READ_SECTION = "read";
@@ -186946,7 +186986,7 @@ var init_readTool = __esmMin((() => {
186946
186986
  init_mediaRef$1();
186947
186987
  init_fileReadSource();
186948
186988
  init_runtimeWorkspaceView();
186949
- init_errors$39();
186989
+ init_errors$40();
186950
186990
  init_skillCatalog();
186951
186991
  init_workspaceContext();
186952
186992
  init_config$6();
@@ -186962,7 +187002,7 @@ var init_readTool = __esmMin((() => {
186962
187002
  init_render_prompt();
186963
187003
  init_read$1();
186964
187004
  init_toolResultTruncation();
186965
- init_configSection$14();
187005
+ init_configSection$15();
186966
187006
  init_read();
186967
187007
  init_decorateParam();
186968
187008
  init_decorate();
@@ -187432,7 +187472,7 @@ var init_writeTool = __esmMin((() => {
187432
187472
  init_dist$5();
187433
187473
  init_agentRuntime();
187434
187474
  init_runtimeWorkspaceView();
187435
- init_errors$39();
187475
+ init_errors$40();
187436
187476
  init_skillCatalog();
187437
187477
  init_workspaceContext();
187438
187478
  init_toolContract();
@@ -187953,7 +187993,7 @@ var EventStateContribution;
187953
187993
  var init_stateContribution = __esmMin((() => {
187954
187994
  init_collection();
187955
187995
  init_unexpectedError();
187956
- init_errors$31();
187996
+ init_errors$32();
187957
187997
  init_event2();
187958
187998
  init_state$1();
187959
187999
  EventStateContribution = collection("event-state");
@@ -188028,7 +188068,7 @@ function sanitizePendingUndo(ctx, meta) {
188028
188068
  var MAX_DRAIN, DISPATCH_STUCK_WARN_MS, replayImmer$1, UNREPORTED_WIRE_RECORD_TYPES, CycleError, FoldContextImpl, EventDispatcherService;
188029
188069
  var init_eventDispatcherService = __esmMin((() => {
188030
188070
  init_immer();
188031
- init_errors$39();
188071
+ init_errors$40();
188032
188072
  init_unexpectedError();
188033
188073
  init_log$1();
188034
188074
  init_service$1();
@@ -189217,7 +189257,7 @@ function databaseSearchSyncTuning(config) {
189217
189257
  };
189218
189258
  }
189219
189259
  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((() => {
189260
+ var init_configSection$14 = __esmMin((() => {
189221
189261
  init_zod$1();
189222
189262
  init_env$1();
189223
189263
  init_config$6();
@@ -189627,7 +189667,7 @@ var init_sessionIndexService = __esmMin((() => {
189627
189667
  init_telemetry$2();
189628
189668
  init_workspaceAlias();
189629
189669
  init_errors$10();
189630
- init_configSection$13();
189670
+ init_configSection$14();
189631
189671
  init_atomicDocumentStore$1();
189632
189672
  init_queryStore();
189633
189673
  init_storage$1();
@@ -190168,7 +190208,7 @@ var init_sessionIndexMirrorService = __esmMin((() => {
190168
190208
  init_bootstrap$1();
190169
190209
  init_config$6();
190170
190210
  init_telemetry$2();
190171
- init_configSection$13();
190211
+ init_configSection$14();
190172
190212
  init_queryStore();
190173
190213
  init_storage$1();
190174
190214
  init_sessionIndex();
@@ -191508,7 +191548,7 @@ var ContextUndone, AgentConversationUndoService;
191508
191548
  var init_undoService = __esmMin((() => {
191509
191549
  init_lifecycle$2();
191510
191550
  init_service$1();
191511
- init_errors$39();
191551
+ init_errors$40();
191512
191552
  init_scopes();
191513
191553
  init_scope();
191514
191554
  init_log$1();
@@ -191876,7 +191916,7 @@ var SESSION_LOCK_RELEASE_DELAY_MS, SessionRunGateService;
191876
191916
  var init_sessionRunGateService = __esmMin((() => {
191877
191917
  init_lifecycle$2();
191878
191918
  init_scope();
191879
- init_errors$39();
191919
+ init_errors$40();
191880
191920
  init_scopes();
191881
191921
  init_appendLogStore$1();
191882
191922
  init_sessionLock();
@@ -192096,7 +192136,7 @@ var init_host_request_headers = __esmMin((() => {
192096
192136
  }));
192097
192137
  // ../../packages/agent-core-v2/src/human/llm/requester/bases/anthropic/contract.ts
192098
192138
  var CONTEXT_MANAGEMENT_BETA;
192099
- var init_contract$2 = __esmMin((() => {
192139
+ var init_contract$3 = __esmMin((() => {
192100
192140
  CONTEXT_MANAGEMENT_BETA = "context-management-2025-06-27";
192101
192141
  }));
192102
192142
  // ../../packages/agent-core-v2/src/human/llm/syntax-errors.ts
@@ -192498,6 +192538,10 @@ function convertNexgenTool(tool) {
192498
192538
  type: "builtin_function",
192499
192539
  function: { name: tool.name }
192500
192540
  };
192541
+ if (tool.name.startsWith("openrouter:")) return {
192542
+ type: tool.name,
192543
+ parameters: tool.parameters
192544
+ };
192501
192545
  return {
192502
192546
  type: "function",
192503
192547
  function: {
@@ -192515,7 +192559,7 @@ function nexgenkUnsetCompletionTokens(input) {
192515
192559
  var NEXGEN_API_KEY_ENV, NEXGEN_BASE_URL_ENV$1, NEXGEN_DEFAULT_BASE_URL, nexgenkEndpoint$1, nexgenkConnection, nexgenkAcceptedImageMimes, nexgenkResponsesTrait, nexgenkOpenAITrait, nexgenkAnthropicTrait;
192516
192560
  var init_trait = __esmMin((() => {
192517
192561
  init_image_formats();
192518
- init_contract$2();
192562
+ init_contract$3();
192519
192563
  init_schema$3();
192520
192564
  NEXGEN_API_KEY_ENV = "NEXGEN_API_KEY";
192521
192565
  NEXGEN_BASE_URL_ENV$1 = "NEXGEN_BASE_URL";
@@ -192632,7 +192676,7 @@ function classifyNexgenQuotaError(error) {
192632
192676
  }
192633
192677
  var NEXGEN_QUOTA_EXHAUSTED_ERROR_CODES, NEXGEN_QUOTA_EXHAUSTED_MESSAGE_PATTERNS;
192634
192678
  var init_errors$4 = __esmMin((() => {
192635
- init_errors$38();
192679
+ init_errors$39();
192636
192680
  NEXGEN_QUOTA_EXHAUSTED_ERROR_CODES = /* @__PURE__ */ new Set(["exceeded_current_quota_error"]);
192637
192681
  NEXGEN_QUOTA_EXHAUSTED_MESSAGE_PATTERNS = [
192638
192682
  /exceeded your current (?:token )?quota/,
@@ -192729,7 +192773,7 @@ function firstEnvHit(names, env) {
192729
192773
  }
192730
192774
  var openAIConnection, anthropicConnection, geminiEndpoint, vertexEndpoint, geminiConnection, vertexConnection, nexgenkEndpoint, providerDefinitions;
192731
192775
  var init_provider_definition = __esmMin((() => {
192732
- init_errors$39();
192776
+ init_errors$40();
192733
192777
  init_trait();
192734
192778
  init_errors$4();
192735
192779
  openAIConnection = { endpoint: () => ({
@@ -193078,7 +193122,7 @@ var init_configEvents = __esmMin((() => {
193078
193122
  }));
193079
193123
  // ../../packages/agent-core-v2/src/app/watch/configSection.ts
193080
193124
  var WATCH_SECTION, WatchConfigSchema, watchEnvBindings, stripWatchEnv;
193081
- var init_configSection$12 = __esmMin((() => {
193125
+ var init_configSection$13 = __esmMin((() => {
193082
193126
  init_zod$1();
193083
193127
  init_env$1();
193084
193128
  init_config$6();
@@ -193855,7 +193899,7 @@ var init_configService = __esmMin((() => {
193855
193899
  init_log$1();
193856
193900
  init_atomicDocumentStore$1();
193857
193901
  init_watch();
193858
- init_configSection$12();
193902
+ init_configSection$13();
193859
193903
  init_config$6();
193860
193904
  init_configPure();
193861
193905
  init_configSectionContributions();
@@ -194531,7 +194575,7 @@ function modelOverridesToToml(overrides, rawSnake) {
194531
194575
  return out;
194532
194576
  }
194533
194577
  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((() => {
194578
+ var init_configSection$12 = __esmMin((() => {
194535
194579
  init_zod$1();
194536
194580
  init_config$6();
194537
194581
  init_configSectionContributions();
@@ -196020,12 +196064,12 @@ function convertAnthropicError(error, classifyErrorHook) {
196020
196064
  var CLEAR_THINKING_EDIT, CACHE_CONTROL, CACHEABLE_TYPES;
196021
196065
  var init_format$4 = __esmMin((() => {
196022
196066
  init_sdk();
196023
- init_errors$38();
196067
+ init_errors$39();
196024
196068
  init_finish_reason();
196025
196069
  init_syntax_errors();
196026
196070
  init_patterns$3();
196027
196071
  init_rewrite();
196028
- init_contract$2();
196072
+ init_contract$3();
196029
196073
  init_lower$3();
196030
196074
  init_patterns$2();
196031
196075
  init_profile();
@@ -196222,7 +196266,7 @@ var ANTHROPIC_TOOL_CALL_ID_POLICY, anthropicBase, anthropicBetaBase;
196222
196266
  var init_requester$4 = __esmMin((() => {
196223
196267
  init_sdk();
196224
196268
  init_radashi();
196225
- init_errors$38();
196269
+ init_errors$39();
196226
196270
  init_image_formats();
196227
196271
  init_syntax_errors();
196228
196272
  init_connection();
@@ -196700,7 +196744,7 @@ function parseRetryInfoDelayMs(message) {
196700
196744
  var NETWORK_RE, TIMEOUT_RE;
196701
196745
  var init_format$3 = __esmMin((() => {
196702
196746
  init_node$9();
196703
- init_errors$38();
196747
+ init_errors$39();
196704
196748
  init_finish_reason();
196705
196749
  init_thinking$2();
196706
196750
  init_patterns$3();
@@ -197259,6 +197303,7 @@ function lowerOpenAIMessages(input, options) {
197259
197303
  })));
197260
197304
  }
197261
197305
  function assembleOpenAIRequest(input, parts) {
197306
+ 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
197307
  return {
197263
197308
  model: input.model.model,
197264
197309
  messages: parts.messages,
@@ -197410,8 +197455,9 @@ function convertOpenAIError(error, classifyErrorHook) {
197410
197455
  var CHAT_COMPLETIONS_MAX_OUTPUT_TOKENS_CEILING;
197411
197456
  var init_format$2 = __esmMin((() => {
197412
197457
  init_openai();
197413
- init_errors$38();
197458
+ init_errors$39();
197414
197459
  init_finish_reason();
197460
+ init_syntax_errors();
197415
197461
  init_patterns$3();
197416
197462
  init_rewrite();
197417
197463
  init_lower$1();
@@ -197602,7 +197648,7 @@ var OPENAI_CHAT_TOOL_CALL_ID_POLICY, openAIBase;
197602
197648
  var init_requester$2 = __esmMin((() => {
197603
197649
  init_openai();
197604
197650
  init_radashi();
197605
- init_errors$38();
197651
+ init_errors$39();
197606
197652
  init_model();
197607
197653
  init_syntax_errors();
197608
197654
  init_connection();
@@ -198388,7 +198434,7 @@ var OPENAI_RESPONSES_TOOL_CALL_ID_POLICY, openAIResponsesBase;
198388
198434
  var init_requester$1 = __esmMin((() => {
198389
198435
  init_openai();
198390
198436
  init_radashi();
198391
- init_errors$38();
198437
+ init_errors$39();
198392
198438
  init_syntax_errors();
198393
198439
  init_connection();
198394
198440
  init_thinking$3();
@@ -198585,7 +198631,7 @@ function parseIdentityEnv(raw) {
198585
198631
  return trimmed.length > 0 ? trimmed : void 0;
198586
198632
  }
198587
198633
  var IDENTITY_SECTION, IdentityConfigSchema, IDENTITY_NAME_ENV, IDENTITY_SLUG_ENV, identityEnvBindings, stripIdentityEnv;
198588
- var init_configSection$10 = __esmMin((() => {
198634
+ var init_configSection$11 = __esmMin((() => {
198589
198635
  init_zod$1();
198590
198636
  init_config$6();
198591
198637
  init_configSectionContributions();
@@ -198619,11 +198665,11 @@ var init_agentIdentityService = __esmMin((() => {
198619
198665
  init_scopes();
198620
198666
  init_scope();
198621
198667
  init_codes();
198622
- init_errors$39();
198668
+ init_errors$40();
198623
198669
  init_bootstrap$1();
198624
198670
  init_config$6();
198625
198671
  init_agentIdentity();
198626
- init_configSection$10();
198672
+ init_configSection$11();
198627
198673
  init_decorateParam();
198628
198674
  init_decorate();
198629
198675
  AgentIdentityService = class AgentIdentityService {
@@ -198713,11 +198759,11 @@ function collectModelOverrides(input) {
198713
198759
  var ENV_MODEL_ALIAS_KEY, DEFAULT_MAX_CONTEXT_SIZE, DEFAULT_CAPABILITIES, nexgenkModelEnvOverlay;
198714
198760
  var init_envOverlay = __esmMin((() => {
198715
198761
  init_env$1();
198716
- init_errors$39();
198762
+ init_errors$40();
198717
198763
  init_configOverlayContributions();
198718
- init_errors$37();
198764
+ init_errors$38();
198719
198765
  init_provider_definition();
198720
- init_configSection$11();
198766
+ init_configSection$12();
198721
198767
  ENV_MODEL_ALIAS_KEY = "__nexgenk_env_model__";
198722
198768
  DEFAULT_MAX_CONTEXT_SIZE = 262144;
198723
198769
  DEFAULT_CAPABILITIES = ["image_in", "thinking"];
@@ -199120,10 +199166,10 @@ function nonEmpty$3(value) {
199120
199166
  return trimmed === void 0 || trimmed.length === 0 ? void 0 : trimmed;
199121
199167
  }
199122
199168
  var init_model_auth = __esmMin((() => {
199123
- init_errors$39();
199169
+ init_errors$40();
199124
199170
  init_provider_credential();
199125
199171
  init_profile();
199126
- init_errors$37();
199172
+ init_errors$38();
199127
199173
  init_protocol$2();
199128
199174
  init_provider_definition();
199129
199175
  init_thinking$1();
@@ -199184,7 +199230,7 @@ function globalDefaultForProvider(models, globalDefaultModel, providerId) {
199184
199230
  return models[globalDefaultModel]?.provider === providerId ? globalDefaultModel : void 0;
199185
199231
  }
199186
199232
  var modelCatalogItemSchema$1, providerCatalogStatusSchema$1, providerCatalogItemSchema$1, setDefaultModelResponseSchema$1, IModelCatalog;
199187
- var init_catalog$2 = __esmMin((() => {
199233
+ var init_catalog$3 = __esmMin((() => {
199188
199234
  init_zod$1();
199189
199235
  init_instantiation();
199190
199236
  init_model_auth();
@@ -199253,7 +199299,7 @@ function applyCredential(model, credential) {
199253
199299
  }
199254
199300
  var CREDENTIALS_RECOVERY_ID, credentialsRecovery;
199255
199301
  var init_credentials$1 = __esmMin((() => {
199256
- init_errors$38();
199302
+ init_errors$39();
199257
199303
  init_requester$5();
199258
199304
  CREDENTIALS_RECOVERY_ID = "credentials";
199259
199305
  credentialsRecovery = { propose: ({ error, appliedRecoveries, credentialProvider }) => {
@@ -200139,10 +200185,10 @@ var init_model_requester_impl = __esmMin((() => {
200139
200185
  init_finish_reason();
200140
200186
  init_message$2();
200141
200187
  init_credentials$1();
200142
- init_errors$37();
200188
+ init_errors$38();
200143
200189
  init_message$1();
200144
200190
  init_usage$1();
200145
- init_errors$36();
200191
+ init_errors$37();
200146
200192
  ModelRequesterImpl = class {
200147
200193
  model;
200148
200194
  gateway;
@@ -200434,16 +200480,16 @@ var init_catalog_service = __esmMin((() => {
200434
200480
  init_lifecycle$2();
200435
200481
  init_scopes();
200436
200482
  init_scope();
200437
- init_errors$39();
200483
+ init_errors$40();
200438
200484
  init_credentials$1();
200439
- init_errors$37();
200485
+ init_errors$38();
200440
200486
  init_protocol$2();
200441
200487
  init_provider$1();
200442
200488
  init_provider_definition();
200443
- init_catalog$2();
200489
+ init_catalog$3();
200444
200490
  init_catalog_runtime();
200445
200491
  init_credential_recovery();
200446
- init_errors$23();
200492
+ init_errors$24();
200447
200493
  init_host_request_headers();
200448
200494
  init_model$1();
200449
200495
  init_model_auth();
@@ -200818,7 +200864,7 @@ var init_kosongConfigService = __esmMin((() => {
200818
200864
  init_model$1();
200819
200865
  init_provider$1();
200820
200866
  init_kosongConfig();
200821
- init_configSection$11();
200867
+ init_configSection$12();
200822
200868
  init_decorateParam();
200823
200869
  init_decorate();
200824
200870
  PERSIST_MAX_ATTEMPTS = 3;
@@ -200935,9 +200981,9 @@ var ModelOAuthTokenAdapter;
200935
200981
  var init_oauthTokenAdapter = __esmMin((() => {
200936
200982
  init_scopes();
200937
200983
  init_scope();
200938
- init_errors$39();
200984
+ init_errors$40();
200939
200985
  init_auth$5();
200940
- init_errors$41();
200986
+ init_errors$42();
200941
200987
  init_model_auth();
200942
200988
  init_model_oauth();
200943
200989
  init_decorateParam();
@@ -201059,18 +201105,18 @@ var init_discoveryService = __esmMin((() => {
201059
201105
  init_lifecycle$2();
201060
201106
  init_scope();
201061
201107
  init_event$2();
201062
- init_errors$39();
201108
+ init_errors$40();
201063
201109
  init_auth$5();
201064
- init_errors$41();
201110
+ init_errors$42();
201065
201111
  init_agentIdentity();
201066
201112
  init_config$6();
201067
201113
  init_event$1();
201068
- init_errors$23();
201114
+ init_errors$24();
201069
201115
  init_model$1();
201070
201116
  init_model_auth();
201071
201117
  init_provider$1();
201072
201118
  init_provider_definition();
201073
- init_configSection$11();
201119
+ init_configSection$12();
201074
201120
  init_discovery();
201075
201121
  init_decorateParam();
201076
201122
  init_decorate();
@@ -201604,9 +201650,9 @@ function modelsDevModelToRecord(providerId, model) {
201604
201650
  var MODELS_DEV_URL, CACHE_TTL_MS, UPSTREAM_FETCH_TIMEOUT_MS, cache, inFlight$2, builtInMemo, fetchImpl, nowImpl;
201605
201651
  var init_modelsDevUpstream = __esmMin((() => {
201606
201652
  init_codes();
201607
- init_errors$39();
201653
+ init_errors$40();
201608
201654
  init_builtInModelsDev();
201609
- init_errors$19();
201655
+ init_errors$20();
201610
201656
  init_modelsDev();
201611
201657
  MODELS_DEV_URL = "https://models.dev/api.json";
201612
201658
  CACHE_TTL_MS = 6e5;
@@ -201643,15 +201689,15 @@ var init_modelsDevImportService = __esmMin((() => {
201643
201689
  init_src$13();
201644
201690
  init_scopes();
201645
201691
  init_scope();
201646
- init_errors$39();
201692
+ init_errors$40();
201647
201693
  init_agentIdentity();
201648
201694
  init_config$6();
201649
- init_catalog$2();
201695
+ init_catalog$3();
201650
201696
  init_model$1();
201651
201697
  init_provider$1();
201652
201698
  init_modelsDev();
201653
- init_configSection$11();
201654
- init_errors$19();
201699
+ init_configSection$12();
201700
+ init_errors$20();
201655
201701
  init_kosongConfig();
201656
201702
  init_modelsDevImport();
201657
201703
  init_modelsDevUpstream();
@@ -202059,7 +202105,7 @@ var init_types$19 = __esmMin((() => {
202059
202105
  }));
202060
202106
  // ../../packages/agent-core-v2/src/features/externalHooks/configSection.ts
202061
202107
  var HOOKS_SECTION, HookDefSchema, HooksConfigSchema, hooksFromToml, hooksToToml;
202062
- var init_configSection$9 = __esmMin((() => {
202108
+ var init_configSection$10 = __esmMin((() => {
202063
202109
  init_zod$1();
202064
202110
  init_configSectionContributions();
202065
202111
  init_toml();
@@ -202552,7 +202598,7 @@ async function isDir(p) {
202552
202598
  }
202553
202599
  var NEXGEN_PLUGIN_ROOT_PATH, NEXGEN_PLUGIN_DIR_PATH, PLUGIN_SYSTEM_PROMPT_MAX_BYTES, UNSUPPORTED_RUNTIME_FIELDS;
202554
202600
  var init_manifest$2 = __esmMin((() => {
202555
- init_configSection$9();
202601
+ init_configSection$10();
202556
202602
  init_config_schema();
202557
202603
  init_types$20();
202558
202604
  NEXGEN_PLUGIN_ROOT_PATH = "nexgenk.plugin.json";
@@ -206170,7 +206216,7 @@ var init_capabilityService = __esmMin((() => {
206170
206216
  init_region$1();
206171
206217
  init_hostProcess();
206172
206218
  init_capability();
206173
- init_errors$34();
206219
+ init_errors$35();
206174
206220
  init_nexgenkCu();
206175
206221
  init_nexgenkWebbridge();
206176
206222
  init_decorateParam();
@@ -206869,7 +206915,7 @@ var init_debug = __esmMin((() => {
206869
206915
  init_debugLedger();
206870
206916
  init_debugGraph();
206871
206917
  init_debugCascade();
206872
- init_errors$32();
206918
+ init_errors$33();
206873
206919
  init_debugLedgerService();
206874
206920
  init_debugGraphService();
206875
206921
  init_debugCascadeService();
@@ -208019,7 +208065,7 @@ var init_flagService = __esmMin((() => {
208019
208065
  init_env$1();
208020
208066
  init_bootstrap$1();
208021
208067
  init_config$6();
208022
- init_flag$5();
208068
+ init_flag$6();
208023
208069
  init_flagRegistry();
208024
208070
  init_decorateParam();
208025
208071
  init_decorate();
@@ -208299,7 +208345,7 @@ function parseNonNegativeInt$1(raw) {
208299
208345
  return Number.isInteger(parsed) && parsed >= 0 ? parsed : void 0;
208300
208346
  }
208301
208347
  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((() => {
208348
+ var init_configSection$9 = __esmMin((() => {
208303
208349
  init_zod$1();
208304
208350
  init_config$6();
208305
208351
  init_configSectionContributions();
@@ -208347,7 +208393,7 @@ var init_configSection$8 = __esmMin((() => {
208347
208393
  }));
208348
208394
  // ../../packages/agent-core-v2/src/agent/tools/task/task-wait/flag.ts
208349
208395
  var WAIT_FOR_FLAG_ID, WAIT_FOR_FLAG_ENV, waitForFlag;
208350
- var init_flag$3 = __esmMin((() => {
208396
+ var init_flag$4 = __esmMin((() => {
208351
208397
  init_flagRegistry();
208352
208398
  WAIT_FOR_FLAG_ID = "wait_for";
208353
208399
  WAIT_FOR_FLAG_ENV = "NEXGEN_EXPERIMENTAL_WAIT_FOR";
@@ -208364,7 +208410,7 @@ var init_flag$3 = __esmMin((() => {
208364
208410
  // ../../packages/agent-core-v2/src/agent/usage/usage.ts
208365
208411
  var init_usage = __esmMin((() => {
208366
208412
  init_errors$10();
208367
- init_errors$39();
208413
+ init_errors$40();
208368
208414
  init_errors$14();
208369
208415
  }));
208370
208416
  // ../../packages/agent-core-v2/src/session/usage/sessionUsage.ts
@@ -209102,8 +209148,8 @@ var init_goalService = __esmMin((() => {
209102
209148
  init_agentActorService();
209103
209149
  init_contextEvents();
209104
209150
  init_goalInjection();
209105
- init_configSection$8();
209106
- init_errors$25();
209151
+ init_configSection$9();
209152
+ init_errors$26();
209107
209153
  init_loop();
209108
209154
  init_turnEvents();
209109
209155
  init_turnOps();
@@ -209113,12 +209159,12 @@ var init_goalService = __esmMin((() => {
209113
209159
  init_toolExecutor();
209114
209160
  init_toolPolicy();
209115
209161
  init_toolRegistry();
209116
- init_flag$3();
209162
+ init_flag$4();
209117
209163
  init_usage();
209118
209164
  init_config$6();
209119
209165
  init_eventBus();
209120
209166
  init_event2();
209121
- init_flag$5();
209167
+ init_flag$6();
209122
209168
  init_telemetry$2();
209123
209169
  init_errors$10();
209124
209170
  init_agentLifecycle();
@@ -210427,7 +210473,7 @@ var init_planService = __esmMin((() => {
210427
210473
  init_dist$5();
210428
210474
  init_lifecycle$2();
210429
210475
  init_service$1();
210430
- init_errors$39();
210476
+ init_errors$40();
210431
210477
  init_errors$10();
210432
210478
  init_hero_slug();
210433
210479
  init_contextMemory();
@@ -210775,7 +210821,7 @@ var PlanFeature;
210775
210821
  var init_planFeature = __esmMin((() => {
210776
210822
  init_feature();
210777
210823
  init_featureRegistry();
210778
- init_configSection$17();
210824
+ init_configSection$18();
210779
210825
  init_plan$3();
210780
210826
  init_planService();
210781
210827
  init_exit_plan_mode$1();
@@ -211085,7 +211131,7 @@ var init_externalHooksRunnerService = __esmMin((() => {
211085
211131
  init_plugin();
211086
211132
  init_telemetry$2();
211087
211133
  init_hostProcess();
211088
- init_configSection$9();
211134
+ init_configSection$10();
211089
211135
  init_externalHooksRunner();
211090
211136
  init_matchHooks();
211091
211137
  init_decorateParam();
@@ -211818,7 +211864,7 @@ var init_externalHooksFeature = __esmMin((() => {
211818
211864
  init_scopes();
211819
211865
  init_feature();
211820
211866
  init_featureRegistry();
211821
- init_configSection$9();
211867
+ init_configSection$10();
211822
211868
  init_agentExternalHooks();
211823
211869
  init_agentExternalHooksService();
211824
211870
  init_externalHooksRunner();
@@ -211940,7 +211986,7 @@ function resolveSwarmTimeoutMs(config) {
211940
211986
  return config.get("swarm")?.timeoutMs ?? 72e5;
211941
211987
  }
211942
211988
  var SWARM_SECTION, SwarmConfigSchema, DEFAULT_SWARM_TIMEOUT_MS, SWARM_TIMEOUT_ENV, swarmEnvBindings, stripSwarmEnv;
211943
- var init_configSection$7 = __esmMin((() => {
211989
+ var init_configSection$8 = __esmMin((() => {
211944
211990
  init_zod$1();
211945
211991
  init_config$6();
211946
211992
  init_configSectionContributions();
@@ -212279,7 +212325,7 @@ var init_mirrorAgentRun = __esmMin((() => {
212279
212325
  init_sessionTokenCounting();
212280
212326
  init_profile$1();
212281
212327
  init_scopeContext();
212282
- init_errors$37();
212328
+ init_errors$38();
212283
212329
  init_telemetry$2();
212284
212330
  init_event2();
212285
212331
  init_agentLifecycle();
@@ -212352,7 +212398,7 @@ function resolveSwarmMaxConcurrency(env = process.env) {
212352
212398
  }
212353
212399
  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
212400
  var init_agentRunBatch = __esmMin((() => {
212355
- init_errors$37();
212401
+ init_errors$38();
212356
212402
  import_retry = /* @__PURE__ */ __toESM(require_retry$4(), 1);
212357
212403
  init_abort$1();
212358
212404
  init_timer();
@@ -213254,13 +213300,13 @@ function formatSubagentTimeoutDescription(ms) {
213254
213300
  return `${ms} ms`;
213255
213301
  }
213256
213302
  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((() => {
213303
+ var init_configSection$7 = __esmMin((() => {
213258
213304
  init_zod$1();
213259
213305
  init_errors$10();
213260
213306
  init_toml();
213261
213307
  init_config$6();
213262
213308
  init_configSectionContributions();
213263
- init_configSection$11();
213309
+ init_configSection$12();
213264
213310
  init_thinking$1();
213265
213311
  SUBAGENT_SECTION = "subagent";
213266
213312
  SECONDARY_MODEL_SECTION = "secondaryModel";
@@ -213310,7 +213356,7 @@ function forkIncompatibility(args, own) {
213310
213356
  }
213311
213357
  var DEFAULT_PROFILE_NAME, FORK_WITH_RESUME_UNAVAILABLE, FORK_WITH_TYPE_UNAVAILABLE, FORK_WITH_MODEL_UNAVAILABLE, FORK_EXPERIMENTAL_UNAVAILABLE, FORK_CONTEXT_NOTICE;
213312
213358
  var init_spawn$2 = __esmMin((() => {
213313
- init_configSection$6();
213359
+ init_configSection$7();
213314
213360
  DEFAULT_PROFILE_NAME = "coder";
213315
213361
  FORK_WITH_RESUME_UNAVAILABLE = "Cannot set resume when forking the current context. Fork creates a new agent; resume continues an existing one.";
213316
213362
  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 +213366,7 @@ var init_spawn$2 = __esmMin((() => {
213320
213366
  }));
213321
213367
  // ../../packages/agent-core-v2/src/session/subagent/flag.ts
213322
213368
  var SUBAGENT_FORK_FLAG_ID, SUBAGENT_FORK_FLAG_ENV, subagentForkFlag;
213323
- var init_flag$2 = __esmMin((() => {
213369
+ var init_flag$3 = __esmMin((() => {
213324
213370
  init_flagRegistry();
213325
213371
  SUBAGENT_FORK_FLAG_ID = "subagent_fork";
213326
213372
  SUBAGENT_FORK_FLAG_ENV = "NEXGEN_EXPERIMENTAL_SUBAGENT_FORK";
@@ -213437,16 +213483,16 @@ var init_agentSwarmTool = __esmMin((() => {
213437
213483
  init_errors$10();
213438
213484
  init_input_schema();
213439
213485
  init_config$6();
213440
- init_flag$5();
213486
+ init_flag$6();
213441
213487
  init_sessionSwarm();
213442
213488
  init_profile$1();
213443
213489
  init_scopeContext();
213444
213490
  init_swarm$1();
213445
- init_configSection$7();
213491
+ init_configSection$8();
213446
213492
  init_subagent();
213447
213493
  init_spawn$2();
213448
- init_flag$2();
213449
- init_configSection$6();
213494
+ init_flag$3();
213495
+ init_configSection$7();
213450
213496
  init_agent_swarm$1();
213451
213497
  init_agent_swarm();
213452
213498
  init_agent_swarm_fork();
@@ -214088,7 +214134,7 @@ var init_goalFeature = __esmMin((() => {
214088
214134
  })), RATE_LIMIT_CAPACITY_RECOVERY_INTERVAL_MS, TOWER_SPAWN_PAUSE_MS, RateLimitCapacityGovernor, TowerRateLimitService;
214089
214135
  var init_towerRateLimitService = __esmMin((() => {
214090
214136
  init_lifecycle$2();
214091
- init_configSection$15();
214137
+ init_configSection$16();
214092
214138
  init_config$6();
214093
214139
  init_towerRateLimit();
214094
214140
  init_decorateParam();
@@ -215654,12 +215700,12 @@ var init_taskWaitTool = __esmMin((() => {
215654
215700
  init_types$15();
215655
215701
  init_format();
215656
215702
  init_taskListTool();
215657
- init_flag$5();
215703
+ init_flag$6();
215658
215704
  init_goalService();
215659
215705
  init_telemetry$2();
215660
215706
  init_agentLifecycle();
215661
215707
  init_abort$1();
215662
- init_flag$3();
215708
+ init_flag$4();
215663
215709
  init_task_wait$1();
215664
215710
  init_task_wait();
215665
215711
  init_decorateParam();
@@ -216100,8 +216146,8 @@ var init_taskService = __esmMin((() => {
216100
216146
  init_agentState();
216101
216147
  init_toolPolicy();
216102
216148
  init_toolRegistry();
216103
- init_flag$3();
216104
- init_flag$5();
216149
+ init_flag$4();
216150
+ init_flag$6();
216105
216151
  init_task$2();
216106
216152
  init_agentLifecycle();
216107
216153
  init_types$15();
@@ -216114,7 +216160,7 @@ var init_taskService = __esmMin((() => {
216114
216160
  init_storage$1();
216115
216161
  init_telemetry$2();
216116
216162
  init_task$3();
216117
- init_configSection$15();
216163
+ init_configSection$16();
216118
216164
  init_persist();
216119
216165
  init_taskOps();
216120
216166
  init_taskListTool();
@@ -217140,12 +217186,12 @@ var init_spawnTool = __esmMin((() => {
217140
217186
  init_tower$1();
217141
217187
  init_towerRateLimit();
217142
217188
  init_config$6();
217143
- init_catalog$2();
217189
+ init_catalog$3();
217144
217190
  init_input_schema();
217145
217191
  init_agentLifecycle();
217146
217192
  init_subagentMetadata();
217147
217193
  init_sessionContext();
217148
- init_configSection$6();
217194
+ init_configSection$7();
217149
217195
  init_mirrorAgentRun();
217150
217196
  init_subagent();
217151
217197
  init_subagent_task();
@@ -217839,7 +217885,7 @@ function isTowerFeatureAssembled(flags) {
217839
217885
  var TOWER_TOOL_CONTRIBUTIONS, TowerFeature, assembledFlagServices, assembledOverrideForTests;
217840
217886
  var init_towerFeature = __esmMin((() => {
217841
217887
  init_instantiation();
217842
- init_flag$5();
217888
+ init_flag$6();
217843
217889
  init_scopes();
217844
217890
  init_feature();
217845
217891
  init_featureRegistry();
@@ -217965,7 +218011,7 @@ var init_towerFeature = __esmMin((() => {
217965
218011
  }));
217966
218012
  // ../../packages/agent-core-v2/src/features/tower/flag.ts
217967
218013
  var TOWER_FLAG_ENV, towerFlag;
217968
- var init_flag$1 = __esmMin((() => {
218014
+ var init_flag$2 = __esmMin((() => {
217969
218015
  init_flagRegistry();
217970
218016
  init_tower$1();
217971
218017
  init_towerFeature();
@@ -218023,7 +218069,7 @@ var TOWER_MODE_DEDUP_MIN_TURNS, TOWER_MODE_FULL_REFRESH_TURNS, TOWER_MODE_INJECT
218023
218069
  var init_towerModeInjection = __esmMin((() => {
218024
218070
  init_service$1();
218025
218071
  init_contextMemory();
218026
- init_flag$5();
218072
+ init_flag$6();
218027
218073
  init_tower$1();
218028
218074
  init_tower_mode_exit_reminder();
218029
218075
  init_tower_mode_full_reminder();
@@ -218515,7 +218561,7 @@ var init_towerService = __esmMin((() => {
218515
218561
  init_eventBus();
218516
218562
  init_featureManager();
218517
218563
  init_scopes();
218518
- init_flag$5();
218564
+ init_flag$6();
218519
218565
  init_sessionManager();
218520
218566
  init_telemetry$2();
218521
218567
  init_bashParser();
@@ -219197,7 +219243,7 @@ var init_cacheProbeService = __esmMin((() => {
219197
219243
  init_scopeContext();
219198
219244
  init_telemetry$2();
219199
219245
  init_usage$1();
219200
- init_catalog$2();
219246
+ init_catalog$3();
219201
219247
  init_agentLifecycle();
219202
219248
  init_sessionUsage();
219203
219249
  init_cacheProbe();
@@ -220432,7 +220478,7 @@ var init_agentsMdReminderService = __esmMin((() => {
220432
220478
  }));
220433
220479
  // ../../packages/agent-core-v2/src/agent/toolSelect/flag.ts
220434
220480
  var TOOL_SELECT_FLAG_ID, TOOL_SELECT_FLAG_ENV, toolSelectFlag;
220435
- var init_flag = __esmMin((() => {
220481
+ var init_flag$1 = __esmMin((() => {
220436
220482
  init_flagRegistry();
220437
220483
  TOOL_SELECT_FLAG_ID = "tool-select";
220438
220484
  TOOL_SELECT_FLAG_ENV = "NEXGEN_EXPERIMENTAL_TOOL_SELECT";
@@ -220622,7 +220668,7 @@ var init_toolSelectService = __esmMin((() => {
220622
220668
  init_scope();
220623
220669
  init_state$1();
220624
220670
  init_eventBus();
220625
- init_flag$5();
220671
+ init_flag$6();
220626
220672
  init_contextMemory();
220627
220673
  init_contextEvents();
220628
220674
  init_compactionOps();
@@ -220633,7 +220679,7 @@ var init_toolSelectService = __esmMin((() => {
220633
220679
  init_toolExecutor();
220634
220680
  init_toolRegistry();
220635
220681
  init_dynamicTools();
220636
- init_flag();
220682
+ init_flag$1();
220637
220683
  init_toolSelect();
220638
220684
  init_decorateParam();
220639
220685
  init_decorate();
@@ -221013,7 +221059,7 @@ var init_toolSelectSchemasService = __esmMin((() => {
221013
221059
  }));
221014
221060
  // ../../packages/agent-core-v2/src/agent/toolPolicy/configSection.ts
221015
221061
  var TOOLS_SECTION, ToolsConfigSchema;
221016
- var init_configSection$5 = __esmMin((() => {
221062
+ var init_configSection$6 = __esmMin((() => {
221017
221063
  init_zod$1();
221018
221064
  init_configSectionContributions();
221019
221065
  TOOLS_SECTION = "tools";
@@ -221088,7 +221134,7 @@ var init_toolPolicyService = __esmMin((() => {
221088
221134
  init_scopes();
221089
221135
  init_scope();
221090
221136
  init_profile$1();
221091
- init_configSection$5();
221137
+ init_configSection$6();
221092
221138
  init_toolExecutor();
221093
221139
  init_config$6();
221094
221140
  init_sessionToolPolicy();
@@ -221200,10 +221246,10 @@ var PRINT_WAIT_CEILING_S_DEFAULT;
221200
221246
  var init_printDefaults = __esmMin((() => {
221201
221247
  init_timer();
221202
221248
  init_config$6();
221249
+ init_configSection$9();
221203
221250
  init_configSection$8();
221204
221251
  init_configSection$7();
221205
- init_configSection$6();
221206
- init_configSection$15();
221252
+ init_configSection$16();
221207
221253
  PRINT_WAIT_CEILING_S_DEFAULT = Math.floor(MAX_TIMER_DELAY_MS$2 / 1e3);
221208
221254
  }));
221209
221255
  // ../../packages/agent-core-v2/src/features/cron/cronTask.ts
@@ -221840,7 +221886,7 @@ var init_profiles = __esmMin((() => {
221840
221886
  }));
221841
221887
  // ../../packages/agent-core-v2/src/agent/permissionMode/configSection.ts
221842
221888
  var DEFAULT_PERMISSION_MODE_SECTION, DefaultPermissionModeSchema;
221843
- var init_configSection$4 = __esmMin((() => {
221889
+ var init_configSection$5 = __esmMin((() => {
221844
221890
  init_zod$1();
221845
221891
  init_configSectionContributions();
221846
221892
  DEFAULT_PERMISSION_MODE_SECTION = "defaultPermissionMode";
@@ -222476,7 +222522,7 @@ function createRequestActor(requester, messageResolvers = []) {
222476
222522
  var init_actor$1 = __esmMin((() => {
222477
222523
  init_xstate2();
222478
222524
  init_credentials$1();
222479
- init_errors$38();
222525
+ init_errors$39();
222480
222526
  }));
222481
222527
  // ../../packages/agent-core-v2/src/human/llm/requester/retry.ts
222482
222528
  function resolveMaxAttempts(options) {
@@ -222518,7 +222564,7 @@ function retryErrorFields(error) {
222518
222564
  }
222519
222565
  var BASE_DELAY_MS, MAX_DELAY_MS, RETRY_FACTOR, JITTER_FACTOR, RETRYABLE_STATUS_CODES;
222520
222566
  var init_retry = __esmMin((() => {
222521
- init_errors$38();
222567
+ init_errors$39();
222522
222568
  BASE_DELAY_MS = 500;
222523
222569
  MAX_DELAY_MS = 32e3;
222524
222570
  RETRY_FACTOR = 2;
@@ -224477,8 +224523,8 @@ function createMachineRequester(service, options) {
224477
224523
  var GATE_FAILURE;
224478
224524
  var init_requester = __esmMin((() => {
224479
224525
  init_errors$10();
224480
- init_errors$37();
224481
224526
  init_errors$38();
224527
+ init_errors$39();
224482
224528
  GATE_FAILURE = {
224483
224529
  kind: "abort",
224484
224530
  message: "The agent loop gate stopped the step."
@@ -225853,7 +225899,7 @@ var init_agentLifecycleService = __esmMin((() => {
225853
225899
  init_bootstrap$1();
225854
225900
  init_config$6();
225855
225901
  init_eventBus();
225856
- init_configSection$4();
225902
+ init_configSection$5();
225857
225903
  init_permissionModeOps();
225858
225904
  init_profileOps();
225859
225905
  init_tower$1();
@@ -226660,7 +226706,7 @@ var init_mcpManagementService = __esmMin((() => {
226660
226706
  init_runtimeRegistry();
226661
226707
  init_agentIdentity();
226662
226708
  init_config$6();
226663
- init_configSection$20();
226709
+ init_configSection$21();
226664
226710
  init_configStore();
226665
226711
  init_oauthService();
226666
226712
  init_mcpRegistry();
@@ -227192,7 +227238,7 @@ function collectRunOutput(bus) {
227192
227238
  }
227193
227239
  var AGENT_RUN_PROMPT_ORIGIN, SUBAGENT_MAX_TOKENS_ERROR, PARTIAL_OUTPUT_MAX_CHARS, PARTIAL_OUTPUT_TRUNCATED_MARKER, RunText;
227194
227240
  var init_runAgentTurn = __esmMin((() => {
227195
- init_errors$37();
227241
+ init_errors$38();
227196
227242
  init_abort$1();
227197
227243
  init_code_points();
227198
227244
  init_eventBus();
@@ -227267,7 +227313,7 @@ var init_subagentService = __esmMin((() => {
227267
227313
  init_userTool();
227268
227314
  init_agentRuntime();
227269
227315
  init_config$6();
227270
- init_catalog$2();
227316
+ init_catalog$3();
227271
227317
  init_log$1();
227272
227318
  init_sessionContext();
227273
227319
  init_runtimeWorkspaceView();
@@ -227277,7 +227323,7 @@ var init_subagentService = __esmMin((() => {
227277
227323
  init_reminderService();
227278
227324
  init_subagent();
227279
227325
  init_runAgentTurn();
227280
- init_configSection$6();
227326
+ init_configSection$7();
227281
227327
  init_spawn$2();
227282
227328
  init_decorateParam();
227283
227329
  init_decorate();
@@ -227432,8 +227478,8 @@ var init_subagentModelsValidationService = __esmMin((() => {
227432
227478
  init_scopes();
227433
227479
  init_scope();
227434
227480
  init_config$6();
227435
- init_catalog$2();
227436
- init_configSection$6();
227481
+ init_catalog$3();
227482
+ init_configSection$7();
227437
227483
  init_subagentModelsValidation();
227438
227484
  init_decorateParam();
227439
227485
  init_decorate();
@@ -227773,10 +227819,10 @@ var init_agentTool = __esmMin((() => {
227773
227819
  init_rule_match();
227774
227820
  init_task$3();
227775
227821
  init_profile$1();
227776
- init_catalog$2();
227822
+ init_catalog$3();
227777
227823
  init_evaluate();
227778
227824
  init_toolPolicy();
227779
- init_flag();
227825
+ init_flag$1();
227780
227826
  init_toolSelect();
227781
227827
  init_scopeContext();
227782
227828
  init_agentRuntime();
@@ -227791,7 +227837,7 @@ var init_agentTool = __esmMin((() => {
227791
227837
  init_log$1();
227792
227838
  init_tower$1();
227793
227839
  init_config$6();
227794
- init_flag$5();
227840
+ init_flag$6();
227795
227841
  init_agentLifecycle();
227796
227842
  init_createAwaitingClose();
227797
227843
  init_subagentMetadata();
@@ -227800,8 +227846,8 @@ var init_agentTool = __esmMin((() => {
227800
227846
  init_eventDispatcher();
227801
227847
  init_subagent();
227802
227848
  init_spawn$2();
227803
- init_flag$2();
227804
- init_configSection$6();
227849
+ init_flag$3();
227850
+ init_configSection$7();
227805
227851
  init_agent$2();
227806
227852
  init_subagent_task();
227807
227853
  init_agent_background_disabled();
@@ -229929,7 +229975,7 @@ var init_sessionLegacyService = __esmMin((() => {
229929
229975
  init_tower$1();
229930
229976
  init_scopeContext();
229931
229977
  init_sessionLookup();
229932
- init_catalog$2();
229978
+ init_catalog$3();
229933
229979
  init_model$1();
229934
229980
  init_errors$10();
229935
229981
  init_mainAgent$1();
@@ -230134,7 +230180,7 @@ function isQuestionResponse$1(result) {
230134
230180
  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
230181
  var init_askUserQuestionTool = __esmMin((() => {
230136
230182
  init_codes();
230137
- init_errors$39();
230183
+ init_errors$40();
230138
230184
  init_input_schema();
230139
230185
  init_abort$1();
230140
230186
  init_task$3();
@@ -235737,8 +235783,8 @@ var init_hostFolderBrowser = __esmMin((() => {
235737
235783
  init_zod$1();
235738
235784
  init_instantiation();
235739
235785
  init_codes();
235740
- init_errors$39();
235741
- init_errors$28();
235786
+ init_errors$40();
235787
+ init_errors$29();
235742
235788
  fsBrowseQuerySchema = object$1({ path: string().min(1).optional() });
235743
235789
  fsBrowseEntrySchema$1 = object$1({
235744
235790
  name: string().min(1),
@@ -249995,6 +250041,10 @@ var init_web_search$1 = __esmMin((() => {
249995
250041
  IWebSearchTool = createDecorator("webSearchTool");
249996
250042
  }));
249997
250043
  // ../../packages/agent-core-v2/src/app/auth/webSearch/webSearch.ts
250044
+ function webSearchUnavailableMessage(diagnosis) {
250045
+ if (diagnosis === "missing-api-key") return "WebSearch will fail: [services.nexgen_search] has no api_key. Run `nexgenk login` to provision it.";
250046
+ if (diagnosis === "missing-search-service") return "WebSearch is not available: config.toml has no [services.nexgen_search]. Run `nexgenk login` to provision it.";
250047
+ }
249998
250048
  var IWebSearchProviderService;
249999
250049
  var init_webSearch = __esmMin((() => {
250000
250050
  init_instantiation();
@@ -250286,7 +250336,7 @@ var init_authService = __esmMin((() => {
250286
250336
  init_log$1();
250287
250337
  init_model_auth();
250288
250338
  init_model$1();
250289
- init_configSection$11();
250339
+ init_configSection$12();
250290
250340
  init_discovery();
250291
250341
  init_provider$1();
250292
250342
  init_provider_definition();
@@ -250868,6 +250918,26 @@ function isolateEnvServiceCredentials(service, getEnv, baseUrlEnv, apiKeyEnv) {
250868
250918
  apiKey
250869
250919
  };
250870
250920
  }
250921
+ function migrateLegacyServiceKeys(services) {
250922
+ let out;
250923
+ for (const [legacy, current] of Object.entries(LEGACY_SERVICE_KEYS)) {
250924
+ if (!(legacy in services)) continue;
250925
+ out ??= { ...services };
250926
+ const shadowed = out[current] !== void 0;
250927
+ if (!shadowed) out[current] = out[legacy];
250928
+ delete out[legacy];
250929
+ reportLegacyServiceKey(legacy, current, shadowed);
250930
+ }
250931
+ return out ?? services;
250932
+ }
250933
+ function reportLegacyServiceKey(legacy, current, shadowed) {
250934
+ const key = `${legacy}->${current}`;
250935
+ if (reportedLegacyServiceKeys.has(key)) return;
250936
+ reportedLegacyServiceKeys.add(key);
250937
+ const from = `services.${legacy.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
250938
+ const to = `services.${current.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}`;
250939
+ 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" });
250940
+ }
250871
250941
  function serviceEntryFromToml(data) {
250872
250942
  const out = {};
250873
250943
  for (const [key, value] of Object.entries(data)) {
@@ -250889,8 +250959,8 @@ function serviceEntryToToml(service) {
250889
250959
  else setDefined(out, camelToSnake$3(key), value);
250890
250960
  return out;
250891
250961
  }
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((() => {
250962
+ 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;
250963
+ var init_configSection$4 = __esmMin((() => {
250894
250964
  init_zod$1();
250895
250965
  init_config$6();
250896
250966
  init_configOverlayContributions();
@@ -250978,8 +251048,15 @@ var init_configSection$3 = __esmMin((() => {
250978
251048
  if (!isPlainObject$2(rawSnake)) return rawSnake;
250979
251049
  const out = {};
250980
251050
  for (const [name, entry] of Object.entries(rawSnake)) out[snakeToCamel$1(name)] = isPlainObject$2(entry) ? serviceEntryFromToml(entry) : entry;
250981
- return out;
251051
+ return migrateLegacyServiceKeys(out);
251052
+ };
251053
+ LEGACY_SERVICE_KEYS = {
251054
+ moonshotSearch: "nexgenSearch",
251055
+ moonshotFetch: "nexgenFetch",
251056
+ kimiSearch: "nexgenSearch",
251057
+ kimiFetch: "nexgenFetch"
250982
251058
  };
251059
+ reportedLegacyServiceKeys = /* @__PURE__ */ new Set();
250983
251060
  servicesToToml = (value, rawSnake) => {
250984
251061
  if (!isPlainObject$2(value)) return value;
250985
251062
  const out = cloneRecord$1(rawSnake);
@@ -251092,7 +251169,7 @@ var init_webSearchService = __esmMin((() => {
251092
251169
  init_config$6();
251093
251170
  init_provider$1();
251094
251171
  init_provider_definition();
251095
- init_configSection$3();
251172
+ init_configSection$4();
251096
251173
  init_nexgen_web_search();
251097
251174
  init_webSearch();
251098
251175
  init_decorateParam();
@@ -251116,6 +251193,12 @@ var init_webSearchService = __esmMin((() => {
251116
251193
  hasWebSearchProvider() {
251117
251194
  return this.configuredSearch() !== void 0 || this.managedTokenProvider() !== void 0;
251118
251195
  }
251196
+ diagnose() {
251197
+ const search = this.configuredSearch();
251198
+ if (search === void 0) return this.managedTokenProvider() === void 0 ? "missing-search-service" : "configured";
251199
+ if (search.oauth !== void 0 || nonEmptyString$1(search.apiKey) !== void 0) return "configured";
251200
+ return nonEmptyString$1(process.env["NEXGEN_API_KEY"]) === void 0 ? "missing-api-key" : "configured";
251201
+ }
251119
251202
  configuredSearch() {
251120
251203
  const search = this.config.get(SERVICES_SECTION)?.nexgenSearch;
251121
251204
  if (search?.baseUrl === void 0) return void 0;
@@ -251195,7 +251278,7 @@ var init_authLegacyService = __esmMin((() => {
251195
251278
  init_scope();
251196
251279
  init_auth$5();
251197
251280
  init_config$6();
251198
- init_configSection$11();
251281
+ init_configSection$12();
251199
251282
  init_model_auth();
251200
251283
  init_authLegacy();
251201
251284
  init_decorateParam();
@@ -251531,7 +251614,7 @@ var FileEditService;
251531
251614
  var init_fileEditService = __esmMin((() => {
251532
251615
  init_scopes();
251533
251616
  init_scope();
251534
- init_errors$39();
251617
+ init_errors$40();
251535
251618
  init_hostFileSystem();
251536
251619
  init_editService();
251537
251620
  init_fileEdit();
@@ -251720,7 +251803,7 @@ var init_fetch_url$1 = __esmMin((() => {
251720
251803
  // ../../packages/agent-core-v2/src/app/web/tools/fetch-url-types.ts
251721
251804
  var HttpFetchError;
251722
251805
  var init_fetch_url_types = __esmMin((() => {
251723
- init_errors$39();
251806
+ init_errors$40();
251724
251807
  init_errors$13();
251725
251808
  HttpFetchError = class extends Error2 {
251726
251809
  name = "HttpFetchError";
@@ -265046,7 +265129,7 @@ var init_webService = __esmMin((() => {
265046
265129
  init_scopes();
265047
265130
  init_scope();
265048
265131
  init_auth$5();
265049
- init_configSection$3();
265132
+ init_configSection$4();
265050
265133
  init_agentIdentity();
265051
265134
  init_bootstrap$1();
265052
265135
  init_config$6();
@@ -266238,7 +266321,7 @@ function parseStrategy(raw) {
266238
266321
  return TOKEN_COUNTING_STRATEGIES.includes(value) ? value : void 0;
266239
266322
  }
266240
266323
  var TOKEN_COUNTING_SECTION, TOKEN_COUNTING_STRATEGY_ENV, TOKEN_COUNTING_STRATEGIES, TokenCountingConfigSchema, tokenCountingEnvBindings, stripTokenCountingEnv, DEFAULT_TOKEN_COUNTING_CONFIG;
266241
- var init_configSection$2 = __esmMin((() => {
266324
+ var init_configSection$3 = __esmMin((() => {
266242
266325
  init_zod$1();
266243
266326
  init_config$6();
266244
266327
  init_configSectionContributions();
@@ -266270,7 +266353,7 @@ var init_sessionTokenCountingService = __esmMin((() => {
266270
266353
  init_turnOps();
266271
266354
  init_config$6();
266272
266355
  init_eventBus();
266273
- init_configSection$2();
266356
+ init_configSection$3();
266274
266357
  init_tokens();
266275
266358
  init_agentLifecycle();
266276
266359
  init_sessionTokenCounting();
@@ -266730,9 +266813,9 @@ var init_changeNotifierService = __esmMin((() => {
266730
266813
  init_agentProfileCatalog();
266731
266814
  init_agentLifecycle();
266732
266815
  init_context$3();
266733
- init_configSection$6();
266816
+ init_configSection$7();
266734
266817
  init_evaluate();
266735
- init_configSection$5();
266818
+ init_configSection$6();
266736
266819
  init_sessionToolPolicy();
266737
266820
  init_sessionToolPolicyGate();
266738
266821
  init_changeNotifier();
@@ -267592,7 +267675,7 @@ var init_fullCompactionService = __esmMin((() => {
267592
267675
  init_todoItem();
267593
267676
  init_unexpectedError();
267594
267677
  init_wire$1();
267595
- init_errors$37();
267678
+ init_errors$38();
267596
267679
  init_message$1();
267597
267680
  init_usage$1();
267598
267681
  init_eventBus();
@@ -268191,6 +268274,415 @@ var init_mediaResolver = __esmMin((() => {
268191
268274
  init_instantiation();
268192
268275
  IAgentMediaResolverService = createDecorator("agentVideoResolverService");
268193
268276
  }));
268277
+ // ../../packages/agent-core-v2/src/features/serverTools/catalog.ts
268278
+ function findServerTool(name) {
268279
+ return SERVER_TOOL_CATALOG.find((tool) => tool.type === name);
268280
+ }
268281
+ var domainList, engineValues, SERVER_TOOL_CATALOG, DENIED_SERVER_TOOLS;
268282
+ var init_catalog$2 = __esmMin((() => {
268283
+ domainList = {
268284
+ type: "array",
268285
+ items: { type: "string" }
268286
+ };
268287
+ engineValues = [
268288
+ "auto",
268289
+ "native",
268290
+ "exa",
268291
+ "firecrawl",
268292
+ "parallel",
268293
+ "perplexity"
268294
+ ];
268295
+ SERVER_TOOL_CATALOG = [
268296
+ {
268297
+ type: "openrouter:web_search",
268298
+ surface: "chat",
268299
+ description: "Search the web and return ranked results with page snippets. The provider runs the search server-side; no local network access is involved.",
268300
+ parameters: {
268301
+ type: "object",
268302
+ properties: {
268303
+ max_results: {
268304
+ type: "integer",
268305
+ minimum: 1,
268306
+ maximum: 25,
268307
+ description: "Number of search results to return."
268308
+ },
268309
+ max_uses: {
268310
+ type: "integer",
268311
+ minimum: 1,
268312
+ description: "Maximum number of searches the provider may run in one response."
268313
+ },
268314
+ max_total_results: {
268315
+ type: "integer",
268316
+ minimum: 1,
268317
+ description: "Cap on results accumulated across every search in the response."
268318
+ },
268319
+ engine: {
268320
+ type: "string",
268321
+ enum: [...engineValues],
268322
+ description: "Search backend to use; \"auto\" lets the router choose."
268323
+ },
268324
+ search_context_size: {
268325
+ type: "string",
268326
+ enum: [
268327
+ "low",
268328
+ "medium",
268329
+ "high"
268330
+ ],
268331
+ description: "Amount of page context attached to each result."
268332
+ },
268333
+ max_characters: {
268334
+ type: "integer",
268335
+ minimum: 1,
268336
+ description: "Truncate each result body to this many characters."
268337
+ },
268338
+ user_location: {
268339
+ type: "object",
268340
+ properties: {
268341
+ city: { type: "string" },
268342
+ region: { type: "string" },
268343
+ country: { type: "string" },
268344
+ timezone: { type: "string" }
268345
+ },
268346
+ additionalProperties: false,
268347
+ description: "Location hint used to localize results."
268348
+ },
268349
+ allowed_domains: {
268350
+ ...domainList,
268351
+ description: "Restrict results to these domains."
268352
+ },
268353
+ excluded_domains: {
268354
+ ...domainList,
268355
+ description: "Drop results from these domains."
268356
+ },
268357
+ x_search: {
268358
+ type: "object",
268359
+ properties: {
268360
+ max_results: {
268361
+ type: "integer",
268362
+ minimum: 1,
268363
+ maximum: 25
268364
+ },
268365
+ from_date: {
268366
+ type: "string",
268367
+ description: "Lower date bound for matching posts."
268368
+ },
268369
+ to_date: {
268370
+ type: "string",
268371
+ description: "Upper date bound for matching posts."
268372
+ }
268373
+ },
268374
+ additionalProperties: false,
268375
+ description: "Restrict the search to X (Twitter) posts."
268376
+ }
268377
+ },
268378
+ additionalProperties: false
268379
+ }
268380
+ },
268381
+ {
268382
+ type: "openrouter:web_fetch",
268383
+ surface: "chat",
268384
+ description: "Fetch a page by URL and return its extracted content. The provider performs the request server-side.",
268385
+ parameters: {
268386
+ type: "object",
268387
+ properties: {
268388
+ engine: {
268389
+ type: "string",
268390
+ enum: [...engineValues],
268391
+ description: "Fetch backend to use; \"auto\" lets the router choose."
268392
+ },
268393
+ max_uses: {
268394
+ type: "integer",
268395
+ minimum: 1,
268396
+ description: "Maximum number of fetches the provider may run in one response."
268397
+ },
268398
+ max_content_tokens: {
268399
+ type: "integer",
268400
+ minimum: 1,
268401
+ description: "Cap on the tokens of page content returned per fetch."
268402
+ },
268403
+ allowed_domains: {
268404
+ ...domainList,
268405
+ description: "Only fetch URLs from these domains."
268406
+ },
268407
+ blocked_domains: {
268408
+ ...domainList,
268409
+ description: "Never fetch URLs from these domains."
268410
+ }
268411
+ },
268412
+ additionalProperties: false
268413
+ }
268414
+ },
268415
+ {
268416
+ type: "openrouter:datetime",
268417
+ surface: "chat",
268418
+ description: "Return the current date and time from the provider, optionally in a named time zone.",
268419
+ parameters: {
268420
+ type: "object",
268421
+ properties: { timezone: {
268422
+ type: "string",
268423
+ description: "IANA time zone name, for example \"Europe/Madrid\". Defaults to UTC."
268424
+ } },
268425
+ additionalProperties: false
268426
+ }
268427
+ },
268428
+ {
268429
+ type: "openrouter:image_generation",
268430
+ surface: "chat",
268431
+ description: "Generate an image from a prompt. The provider produces the image server-side and returns it in the response.",
268432
+ parameters: {
268433
+ type: "object",
268434
+ properties: {
268435
+ model: {
268436
+ type: "string",
268437
+ description: "Image model to use; the router default applies when omitted."
268438
+ },
268439
+ quality: {
268440
+ type: "string",
268441
+ enum: [
268442
+ "auto",
268443
+ "low",
268444
+ "medium",
268445
+ "high"
268446
+ ],
268447
+ description: "Rendering quality tier."
268448
+ },
268449
+ size: {
268450
+ type: "string",
268451
+ description: "Output resolution, for example \"1024x1024\"."
268452
+ },
268453
+ aspect_ratio: {
268454
+ type: "string",
268455
+ description: "Output aspect ratio, for example \"16:9\"."
268456
+ },
268457
+ background: {
268458
+ type: "string",
268459
+ enum: [
268460
+ "auto",
268461
+ "transparent",
268462
+ "opaque"
268463
+ ],
268464
+ description: "Background treatment of the generated image."
268465
+ },
268466
+ output_format: {
268467
+ type: "string",
268468
+ enum: [
268469
+ "png",
268470
+ "jpeg",
268471
+ "webp"
268472
+ ],
268473
+ description: "Encoded format of the generated image."
268474
+ },
268475
+ output_compression: {
268476
+ type: "integer",
268477
+ minimum: 0,
268478
+ maximum: 100,
268479
+ description: "Compression level for lossy output formats."
268480
+ },
268481
+ moderation: {
268482
+ type: "string",
268483
+ enum: ["auto", "low"],
268484
+ description: "Content moderation strictness applied to the prompt."
268485
+ }
268486
+ },
268487
+ additionalProperties: false
268488
+ }
268489
+ },
268490
+ {
268491
+ type: "openrouter:fusion",
268492
+ surface: "chat",
268493
+ description: "Fuse several analysis models into one answer: the provider runs the listed models and merges their output.",
268494
+ parameters: {
268495
+ type: "object",
268496
+ properties: {
268497
+ analysis_models: {
268498
+ type: "array",
268499
+ items: { type: "string" },
268500
+ description: "Model identifiers that produce the candidate analyses."
268501
+ },
268502
+ model: {
268503
+ type: "string",
268504
+ description: "Model that fuses the analyses into the final answer."
268505
+ },
268506
+ max_tool_calls: {
268507
+ type: "integer",
268508
+ minimum: 0,
268509
+ description: "Cap on tool calls the fusion pass may make."
268510
+ },
268511
+ max_completion_tokens: {
268512
+ type: "integer",
268513
+ minimum: 1,
268514
+ description: "Cap on the tokens the fusion pass may generate."
268515
+ },
268516
+ reasoning: {
268517
+ type: "object",
268518
+ properties: {
268519
+ effort: { type: "string" },
268520
+ max_tokens: {
268521
+ type: "integer",
268522
+ minimum: 1
268523
+ }
268524
+ },
268525
+ additionalProperties: false,
268526
+ description: "Reasoning budget for the fusion pass."
268527
+ },
268528
+ temperature: {
268529
+ type: "number",
268530
+ minimum: 0,
268531
+ maximum: 2,
268532
+ description: "Sampling temperature for the fusion pass."
268533
+ }
268534
+ },
268535
+ additionalProperties: false
268536
+ }
268537
+ },
268538
+ {
268539
+ type: "openrouter:advisor",
268540
+ surface: "chat",
268541
+ description: "Ask a named advisor model for a second opinion on the current request; the provider calls it server-side.",
268542
+ parameters: {
268543
+ type: "object",
268544
+ properties: {
268545
+ name: {
268546
+ type: "string",
268547
+ description: "Advisor identifier referenced by the response."
268548
+ },
268549
+ model: {
268550
+ type: "string",
268551
+ description: "Model backing the advisor."
268552
+ },
268553
+ max_completion_tokens: {
268554
+ type: "integer",
268555
+ minimum: 1,
268556
+ description: "Cap on the tokens the advisor may generate."
268557
+ }
268558
+ },
268559
+ additionalProperties: false
268560
+ }
268561
+ },
268562
+ {
268563
+ type: "openrouter:subagent",
268564
+ surface: "chat",
268565
+ description: "Delegate a subtask to a named subagent model; the provider runs the subagent server-side.",
268566
+ parameters: {
268567
+ type: "object",
268568
+ properties: {
268569
+ name: {
268570
+ type: "string",
268571
+ description: "Subagent identifier referenced by the response."
268572
+ },
268573
+ model: {
268574
+ type: "string",
268575
+ description: "Model backing the subagent."
268576
+ }
268577
+ },
268578
+ additionalProperties: false
268579
+ }
268580
+ },
268581
+ {
268582
+ type: "openrouter:tool_search",
268583
+ surface: "responses",
268584
+ description: "Responses-only marker: lets the provider expose additional server tools to the model. It is not callable and takes no parameters.",
268585
+ parameters: {
268586
+ type: "object",
268587
+ properties: {},
268588
+ additionalProperties: false
268589
+ }
268590
+ },
268591
+ {
268592
+ type: "openrouter:experimental__search_models",
268593
+ surface: "chat",
268594
+ description: "Search the router model catalog by description and return matching model identifiers.",
268595
+ parameters: {
268596
+ type: "object",
268597
+ properties: { max_results: {
268598
+ type: "integer",
268599
+ minimum: 1,
268600
+ description: "Number of matching models to return."
268601
+ } },
268602
+ additionalProperties: false
268603
+ }
268604
+ }
268605
+ ];
268606
+ DENIED_SERVER_TOOLS = [
268607
+ "openrouter:shell",
268608
+ "openrouter:bash",
268609
+ "openrouter:apply_patch"
268610
+ ];
268611
+ }));
268612
+ // ../../packages/agent-core-v2/src/features/serverTools/configSection.ts
268613
+ var SERVER_TOOLS_SECTION, ServerToolsConfigSchema, DEFAULT_SERVER_TOOLS_CONFIG;
268614
+ var init_configSection$2 = __esmMin((() => {
268615
+ init_zod$1();
268616
+ init_configSectionContributions();
268617
+ SERVER_TOOLS_SECTION = "serverTools";
268618
+ ServerToolsConfigSchema = object$1({ enabled: array(string()).default([]) });
268619
+ DEFAULT_SERVER_TOOLS_CONFIG = { enabled: [] };
268620
+ registerConfigSection(SERVER_TOOLS_SECTION, ServerToolsConfigSchema, { defaultValue: DEFAULT_SERVER_TOOLS_CONFIG });
268621
+ }));
268622
+ // ../../packages/agent-core-v2/src/features/serverTools/flag.ts
268623
+ var SERVER_TOOLS_FLAG_ID, SERVER_TOOLS_FLAG_ENV, serverToolsFlag;
268624
+ var init_flag = __esmMin((() => {
268625
+ init_flagRegistry();
268626
+ SERVER_TOOLS_FLAG_ID = "server_tools";
268627
+ SERVER_TOOLS_FLAG_ENV = "NEXGEN_EXPERIMENTAL_SERVER_TOOLS";
268628
+ serverToolsFlag = {
268629
+ id: SERVER_TOOLS_FLAG_ID,
268630
+ title: "NexgenRouter server tools",
268631
+ description: "Declare NexgenRouter server-side tools (openrouter:web_search, openrouter:datetime, ...) that the provider executes instead of the client.",
268632
+ env: SERVER_TOOLS_FLAG_ENV,
268633
+ default: false,
268634
+ surface: "core"
268635
+ };
268636
+ registerFlagDefinition(serverToolsFlag);
268637
+ }));
268638
+ // ../../packages/agent-core-v2/src/features/serverTools/serverToolsService.ts
268639
+ function serverToolDescriptors(names) {
268640
+ return names.map(serverToolDescription);
268641
+ }
268642
+ function serverToolDescription(name) {
268643
+ 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 } });
268644
+ const definition = findServerTool(name);
268645
+ if (definition === void 0) {
268646
+ const known = SERVER_TOOL_CATALOG.map((tool) => tool.type).join(", ");
268647
+ 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 } });
268648
+ }
268649
+ if (definition.surface !== SUPPORTED_SURFACE) throw new Error2(ErrorCodes.SERVER_TOOL_UNSUPPORTED_SURFACE, `Server tool "${name}" only runs on the ${definition.surface} endpoint (/v1/${definition.surface}), and this client speaks chat completions. Remove it from [server_tools] enabled: the router answers 400 for it on /v1/chat/completions.`, { details: {
268650
+ name,
268651
+ surface: definition.surface
268652
+ } });
268653
+ return {
268654
+ name: definition.type,
268655
+ description: definition.description,
268656
+ parameters: definition.parameters
268657
+ };
268658
+ }
268659
+ var SUPPORTED_SURFACE, IServerToolsService, ServerToolsService;
268660
+ var init_serverToolsService = __esmMin((() => {
268661
+ init_instantiation();
268662
+ init_config$6();
268663
+ init_flag$6();
268664
+ init_errors$10();
268665
+ init_catalog$2();
268666
+ init_configSection$2();
268667
+ init_flag();
268668
+ init_decorateParam();
268669
+ init_decorate();
268670
+ SUPPORTED_SURFACE = "chat";
268671
+ IServerToolsService = createDecorator("serverToolsService");
268672
+ ServerToolsService = class ServerToolsService {
268673
+ config;
268674
+ flags;
268675
+ constructor(config, flags) {
268676
+ this.config = config;
268677
+ this.flags = flags;
268678
+ }
268679
+ descriptors() {
268680
+ if (!this.flags.enabled("server_tools")) return [];
268681
+ return serverToolDescriptors(this.config.get("serverTools")?.enabled ?? []);
268682
+ }
268683
+ };
268684
+ ServerToolsService = __decorate([__decorateParam(0, IConfigService), __decorateParam(1, IFlagService)], ServerToolsService);
268685
+ }));
268194
268686
  // ../../packages/agent-core-v2/src/agent/llmRequester/llmRequestOps.ts
268195
268687
  var llmToolEntrySchema, llmToolsSnapshotSchema, LlmToolsSnapshot, llmRequestSchema, LlmRequest, llmRequestTraceKey;
268196
268688
  var init_llmRequestOps = __esmMin((() => {
@@ -268362,17 +268854,18 @@ var init_llmRequesterService = __esmMin((() => {
268362
268854
  init_mediaResolver();
268363
268855
  init_sessionUsage();
268364
268856
  init_config$6();
268365
- init_errors$37();
268857
+ init_serverToolsService();
268858
+ init_errors$38();
268366
268859
  init_thinking$2();
268367
268860
  init_message$2();
268368
268861
  init_usage$1();
268369
268862
  init_log$1();
268370
- init_catalog$2();
268863
+ init_catalog$3();
268371
268864
  init_model_requester();
268372
268865
  init_model$1();
268373
268866
  init_completion_budget();
268374
268867
  init_thinking$1();
268375
- init_configSection$11();
268868
+ init_configSection$12();
268376
268869
  init_telemetry$2();
268377
268870
  init_scopeContext();
268378
268871
  init_eventDispatcher();
@@ -268408,6 +268901,7 @@ var init_llmRequesterService = __esmMin((() => {
268408
268901
  profile;
268409
268902
  usage;
268410
268903
  config;
268904
+ serverTools;
268411
268905
  modelService;
268412
268906
  modelCatalog;
268413
268907
  log;
@@ -268417,7 +268911,7 @@ var init_llmRequesterService = __esmMin((() => {
268417
268911
  states;
268418
268912
  bootstrap;
268419
268913
  toolCallIdNormalizer = new ToolCallIdNormalizer();
268420
- constructor(context, projector, tokenCounting, tools, toolSelect, mediaResolver, profile, usage, config, modelService, modelCatalog, log, telemetry, dispatcher, scopeContext, states, bootstrap) {
268914
+ constructor(context, projector, tokenCounting, tools, toolSelect, mediaResolver, profile, usage, config, serverTools, modelService, modelCatalog, log, telemetry, dispatcher, scopeContext, states, bootstrap) {
268421
268915
  this.context = context;
268422
268916
  this.projector = projector;
268423
268917
  this.tokenCounting = tokenCounting;
@@ -268427,6 +268921,7 @@ var init_llmRequesterService = __esmMin((() => {
268427
268921
  this.profile = profile;
268428
268922
  this.usage = usage;
268429
268923
  this.config = config;
268924
+ this.serverTools = serverTools;
268430
268925
  this.modelService = modelService;
268431
268926
  this.modelCatalog = modelCatalog;
268432
268927
  this.log = log;
@@ -268881,7 +269376,7 @@ var init_llmRequesterService = __esmMin((() => {
268881
269376
  modelAlias: resolved.modelAlias,
268882
269377
  thinkingEffort: resolved.thinkingLevel,
268883
269378
  systemPrompt: overrides.systemPrompt ?? turnConfig?.systemPrompt ?? this.profile.getSystemPrompt(),
268884
- tools: [...overrides.tools ?? this.defaultTools()],
269379
+ tools: [...overrides.tools ?? this.defaultTools(), ...this.serverToolsFor(requester.model)],
268885
269380
  messages: [...messages],
268886
269381
  contextRevision: this.context.prefixRevision(),
268887
269382
  promptCacheProbe,
@@ -268889,6 +269384,10 @@ var init_llmRequesterService = __esmMin((() => {
268889
269384
  logFields: logFieldsForSource(overrides.source)
268890
269385
  };
268891
269386
  }
269387
+ serverToolsFor(model) {
269388
+ if (model.providerType !== "nexgenk") return [];
269389
+ return this.serverTools.descriptors();
269390
+ }
268892
269391
  resolveTurnConfig(source) {
268893
269392
  if (source?.type !== "turn") return void 0;
268894
269393
  return this.getOrCreateTurnConfig(source.turnId);
@@ -269006,14 +269505,15 @@ var init_llmRequesterService = __esmMin((() => {
269006
269505
  __decorateParam(6, IAgentProfileService),
269007
269506
  __decorateParam(7, ISessionUsageService),
269008
269507
  __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)
269508
+ __decorateParam(9, IServerToolsService),
269509
+ __decorateParam(10, IModelService),
269510
+ __decorateParam(11, IModelCatalog),
269511
+ __decorateParam(12, ILogService),
269512
+ __decorateParam(13, ITelemetryService),
269513
+ __decorateParam(14, IEventDispatcher),
269514
+ __decorateParam(15, IAgentScopeContext),
269515
+ __decorateParam(16, IAgentStateService),
269516
+ __decorateParam(17, IBootstrapService)
269017
269517
  ], AgentLLMRequesterService);
269018
269518
  MutableLLMRequestTrace = class {
269019
269519
  traceId;
@@ -271096,7 +271596,7 @@ var init_loopService = __esmMin((() => {
271096
271596
  init_eventDispatcher();
271097
271597
  init_wire$1();
271098
271598
  init_promptEvents();
271099
- init_configSection$8();
271599
+ init_configSection$9();
271100
271600
  init_loop();
271101
271601
  init_origin$2();
271102
271602
  init_hookParts();
@@ -274080,9 +274580,9 @@ function inlineVideoPart(data, mimeType) {
274080
274580
  };
274081
274581
  }
274082
274582
  var init_videoUpload = __esmMin((() => {
274083
- init_errors$37();
274084
274583
  init_errors$38();
274085
- init_errors$36();
274584
+ init_errors$39();
274585
+ init_errors$37();
274086
274586
  })), ReadMediaFileInputSchema;
274087
274587
  var init_read_media_file = __esmMin((() => {
274088
274588
  init_zod$1();
@@ -274145,7 +274645,7 @@ function shouldSurfaceVideoUploadError(error, inlineVideoSupported) {
274145
274645
  }
274146
274646
  var ReadMediaFileTool;
274147
274647
  var init_readMediaFileTool = __esmMin((() => {
274148
- init_errors$37();
274648
+ init_errors$38();
274149
274649
  init_videoUpload();
274150
274650
  init_mediaRef$1();
274151
274651
  init_fileReadSource();
@@ -274512,7 +275012,7 @@ var init_mediaToolsRegistrar = __esmMin((() => {
274512
275012
  init_eventDispatcher();
274513
275013
  init_usageEvents();
274514
275014
  init_telemetry$2();
274515
- init_catalog$2();
275015
+ init_catalog$3();
274516
275016
  init_credential_recovery();
274517
275017
  init_agentRuntime();
274518
275018
  init_skillCatalog();
@@ -274885,7 +275385,7 @@ var init_mediaResolverService = __esmMin((() => {
274885
275385
  init_fileService();
274886
275386
  init_scopes();
274887
275387
  init_telemetry$2();
274888
- init_errors$37();
275388
+ init_errors$38();
274889
275389
  init_credential_recovery();
274890
275390
  init_blobStore();
274891
275391
  init_file_type$1();
@@ -276580,10 +277080,10 @@ var init_profileService = __esmMin((() => {
276580
277080
  init_state$1();
276581
277081
  init_capability$6();
276582
277082
  init_thinking$2();
276583
- init_catalog$2();
277083
+ init_catalog$3();
276584
277084
  init_protocol$2();
276585
277085
  init_thinking$1();
276586
- init_configSection$11();
277086
+ init_configSection$12();
276587
277087
  init_discovery();
276588
277088
  init_agentProfileCatalog();
276589
277089
  init_builtinAgentProfileLoader();
@@ -276609,7 +277109,7 @@ var init_profileService = __esmMin((() => {
276609
277109
  init_eventDispatcher();
276610
277110
  init_context$3();
276611
277111
  init_profile$1();
276612
- init_configSection$5();
277112
+ init_configSection$6();
276613
277113
  init_evaluate();
276614
277114
  init_toolRegistry();
276615
277115
  init_sessionNotify();
@@ -278419,7 +278919,7 @@ var init_notifyUserNudgeService = __esmMin((() => {
278419
278919
  init_scopeContext();
278420
278920
  init_toolRegistry();
278421
278921
  init_bootstrap$1();
278422
- init_flag$5();
278922
+ init_flag$6();
278423
278923
  init_telemetry$2();
278424
278924
  init_reminderService();
278425
278925
  init_eventDispatcher();
@@ -278488,7 +278988,7 @@ var NOTIFY_USER_DELIVERED_OUTPUT, NOTIFY_USER_EMPTY_TITLE, NOTIFY_USER_MULTILINE
278488
278988
  var init_notifyUserTool = __esmMin((() => {
278489
278989
  init_contextMemory();
278490
278990
  init_bootstrap$1();
278491
- init_flag$5();
278991
+ init_flag$6();
278492
278992
  init_telemetry$2();
278493
278993
  init_input_schema();
278494
278994
  init_toolContract();
@@ -278593,6 +279093,21 @@ var init_notifyFeature = __esmMin((() => {
278593
279093
  };
278594
279094
  registerFeature(NotifyFeature);
278595
279095
  }));
279096
+ // ../../packages/agent-core-v2/src/features/serverTools/serverToolsFeature.ts
279097
+ var ServerToolsFeature;
279098
+ var init_serverToolsFeature = __esmMin((() => {
279099
+ init_feature();
279100
+ init_featureRegistry();
279101
+ init_serverToolsService();
279102
+ ServerToolsFeature = class extends Feature {
279103
+ static name = "serverTools";
279104
+ constructor() {
279105
+ super();
279106
+ this.contributeAgentService(IServerToolsService, ServerToolsService);
279107
+ }
279108
+ };
279109
+ registerFeature(ServerToolsFeature);
279110
+ }));
278596
279111
  // ../../packages/agent-core-v2/src/agent/toolExecutor/toolHooks.ts
278597
279112
  var init_toolHooks = __esmMin((() => {}));
278598
279113
  // ../../packages/agent-core-v2/src/agent/toolResultTruncation/toolResultTruncationService.ts
@@ -279265,7 +279780,7 @@ var init_src$10 = __esmMin((() => {
279265
279780
  init_fiberEventResolver();
279266
279781
  init_eventBus();
279267
279782
  init_event$1();
279268
- init_errors$31();
279783
+ init_errors$32();
279269
279784
  init_event2();
279270
279785
  init_errors$15();
279271
279786
  init_state$1();
@@ -279284,7 +279799,7 @@ var init_src$10 = __esmMin((() => {
279284
279799
  init_agentState();
279285
279800
  init_agentStateService();
279286
279801
  init_capability$6();
279287
- init_errors$37();
279802
+ init_errors$38();
279288
279803
  init_message$1();
279289
279804
  init_request_trace();
279290
279805
  init_sessionIndex();
@@ -279309,18 +279824,18 @@ var init_src$10 = __esmMin((() => {
279309
279824
  init_configEvents();
279310
279825
  init_configService();
279311
279826
  init_configSectionContributions();
279312
- init_configSection$11();
279827
+ init_configSection$12();
279313
279828
  init_provider$1();
279314
279829
  init_provider_service();
279315
279830
  init_provider_definition();
279316
279831
  init_protocolAdapterRegistry();
279317
- init_configSection$19();
279318
- init_configSection$10();
279319
- init_configSection$10();
279832
+ init_configSection$20();
279833
+ init_configSection$11();
279834
+ init_configSection$11();
279320
279835
  init_agentIdentity();
279321
279836
  init_agentIdentityService();
279322
- init_errors$36();
279323
- init_errors$36();
279837
+ init_errors$37();
279838
+ init_errors$37();
279324
279839
  init_protocol$2();
279325
279840
  init_protocol_base();
279326
279841
  init_envOverlay();
@@ -279330,10 +279845,10 @@ var init_src$10 = __esmMin((() => {
279330
279845
  init_model_types();
279331
279846
  init_model_service();
279332
279847
  init_thinking$1();
279333
- init_catalog$2();
279848
+ init_catalog$3();
279334
279849
  init_catalog_service();
279335
279850
  init_model_requester();
279336
- init_errors$23();
279851
+ init_errors$24();
279337
279852
  init_kosongConfig();
279338
279853
  init_kosongConfigService();
279339
279854
  init_model_oauth();
@@ -279341,7 +279856,7 @@ var init_src$10 = __esmMin((() => {
279341
279856
  init_hostRequestHeadersAdapter();
279342
279857
  init_discovery();
279343
279858
  init_discoveryService();
279344
- init_errors$19();
279859
+ init_errors$20();
279345
279860
  init_modelsDevImport();
279346
279861
  init_modelsDevImportService();
279347
279862
  init_modelsDevUpstream();
@@ -279355,7 +279870,7 @@ var init_src$10 = __esmMin((() => {
279355
279870
  init_profile_shared();
279356
279871
  init_promptPrefix();
279357
279872
  init_contribution();
279358
- init_configSection$18();
279873
+ init_configSection$19();
279359
279874
  init_agentFile();
279360
279875
  init_paths$2();
279361
279876
  init_userAgentProfileLoader();
@@ -279375,7 +279890,7 @@ var init_src$10 = __esmMin((() => {
279375
279890
  init_capability();
279376
279891
  init_capabilityEvents();
279377
279892
  init_capabilityService();
279378
- init_errors$34();
279893
+ init_errors$35();
279379
279894
  init_types$18();
279380
279895
  init_featureManager();
279381
279896
  init_featureServiceContribution();
@@ -279395,7 +279910,7 @@ var init_src$10 = __esmMin((() => {
279395
279910
  init_skillService();
279396
279911
  init_skillFeature();
279397
279912
  init_types$24();
279398
- init_configSection$19();
279913
+ init_configSection$20();
279399
279914
  init_parser$2();
279400
279915
  init_registry$5();
279401
279916
  init_errors$16();
@@ -279434,13 +279949,13 @@ var init_src$10 = __esmMin((() => {
279434
279949
  init_permissionGateService();
279435
279950
  init_toolApproval();
279436
279951
  init_toolApprovalService();
279437
- init_flag$5();
279952
+ init_flag$6();
279438
279953
  init_flagRegistry();
279439
279954
  init_flagRegistryService();
279440
279955
  init_flagService();
279441
279956
  init_flagRegistry();
279442
279957
  init_flagRegistryService();
279443
- init_flag$5();
279958
+ init_flag$6();
279444
279959
  init_flagService();
279445
279960
  init_modeMutex();
279446
279961
  init_modeMutexService();
@@ -279450,7 +279965,7 @@ var init_src$10 = __esmMin((() => {
279450
279965
  init_plan$2();
279451
279966
  init_exit_plan_mode$1();
279452
279967
  init_exitPlanModeTool();
279453
- init_configSection$17();
279968
+ init_configSection$18();
279454
279969
  init_plan$3();
279455
279970
  init_planOps();
279456
279971
  init_planService();
@@ -279460,7 +279975,7 @@ var init_src$10 = __esmMin((() => {
279460
279975
  init_fileHistoryOps();
279461
279976
  init_fileHistoryService();
279462
279977
  init_fileHistoryFeature();
279463
- init_configSection$9();
279978
+ init_configSection$10();
279464
279979
  init_externalHooksRunner();
279465
279980
  init_externalHooksRunnerService();
279466
279981
  init_sessionExternalHooks();
@@ -279471,7 +279986,7 @@ var init_src$10 = __esmMin((() => {
279471
279986
  init_debugEvents();
279472
279987
  init_debugEventsService();
279473
279988
  init_debugEventsFeature();
279474
- init_configSection$7();
279989
+ init_configSection$8();
279475
279990
  init_swarm$1();
279476
279991
  init_swarmService();
279477
279992
  init_sessionSwarm();
@@ -279493,7 +280008,7 @@ var init_src$10 = __esmMin((() => {
279493
280008
  init_goalOps();
279494
280009
  init_types$16();
279495
280010
  init_goalFeature();
279496
- init_flag$1();
280011
+ init_flag$2();
279497
280012
  init_tower$1();
279498
280013
  init_towerFeature();
279499
280014
  init_towerService();
@@ -279510,7 +280025,7 @@ var init_src$10 = __esmMin((() => {
279510
280025
  init_review$1();
279511
280026
  init_mission$1();
279512
280027
  init_status$1();
279513
- init_flag$1();
280028
+ init_flag$2();
279514
280029
  init_towerFeature();
279515
280030
  init_usage();
279516
280031
  init_cacheProbe();
@@ -279523,7 +280038,7 @@ var init_src$10 = __esmMin((() => {
279523
280038
  init_toolDedupeService();
279524
280039
  init_agentsMdReminder();
279525
280040
  init_agentsMdReminderService();
279526
- init_flag();
280041
+ init_flag$1();
279527
280042
  init_select_tools();
279528
280043
  init_selectToolsTool();
279529
280044
  init_dynamicTools();
@@ -279533,12 +280048,12 @@ var init_src$10 = __esmMin((() => {
279533
280048
  init_toolSelectAnnouncementsService();
279534
280049
  init_toolSelectSchemas();
279535
280050
  init_toolSelectSchemasService();
279536
- init_configSection$5();
279537
- init_configSection$5();
280051
+ init_configSection$6();
280052
+ init_configSection$6();
279538
280053
  init_evaluate();
279539
280054
  init_toolPolicy();
279540
280055
  init_toolPolicyService();
279541
- init_configSection$15();
280056
+ init_configSection$16();
279542
280057
  init_printDefaults();
279543
280058
  init_task_list$1();
279544
280059
  init_taskListTool();
@@ -279551,9 +280066,9 @@ var init_src$10 = __esmMin((() => {
279551
280066
  init_task$3();
279552
280067
  init_taskOps();
279553
280068
  init_taskService();
279554
- init_configSection$16();
280069
+ init_configSection$17();
279555
280070
  init_cronTask();
279556
- init_configSection$16();
280071
+ init_configSection$17();
279557
280072
  init_cronService();
279558
280073
  init_cronOps();
279559
280074
  init_cronFeature();
@@ -279567,7 +280082,7 @@ var init_src$10 = __esmMin((() => {
279567
280082
  init_forked();
279568
280083
  init_mainAgent$1();
279569
280084
  init_sessionMcpHandle();
279570
- init_configSection$20();
280085
+ init_configSection$21();
279571
280086
  init_oauthStore();
279572
280087
  init_configStore();
279573
280088
  init_oauthService();
@@ -279582,7 +280097,7 @@ var init_src$10 = __esmMin((() => {
279582
280097
  init_subagent();
279583
280098
  init_subagentService();
279584
280099
  init_spawn$2();
279585
- init_flag$2();
280100
+ init_flag$3();
279586
280101
  init_subagentModelsValidation();
279587
280102
  init_subagentModelsValidationService();
279588
280103
  init_subagent_task();
@@ -279590,7 +280105,7 @@ var init_src$10 = __esmMin((() => {
279590
280105
  init_mirrorAgentRun();
279591
280106
  init_subagentScopeCache();
279592
280107
  init_subagentScopeCacheService();
279593
- init_configSection$6();
280108
+ init_configSection$7();
279594
280109
  init_agent$2();
279595
280110
  init_agentTool();
279596
280111
  init_sessionLookup();
@@ -279600,7 +280115,7 @@ var init_src$10 = __esmMin((() => {
279600
280115
  init_sessionLifecycleService();
279601
280116
  init_coldSessionArchive();
279602
280117
  init_addressing();
279603
- init_errors$18();
280118
+ init_errors$19();
279604
280119
  init_sessionExport$1();
279605
280120
  init_sessionExportService();
279606
280121
  init_manifest$1();
@@ -279633,7 +280148,7 @@ var init_src$10 = __esmMin((() => {
279633
280148
  init_gitService();
279634
280149
  init_bashParser();
279635
280150
  init_bashParserService();
279636
- init_errors$28();
280151
+ init_errors$29();
279637
280152
  init_fs$1();
279638
280153
  init_fsService();
279639
280154
  init_gitContext();
@@ -279660,10 +280175,10 @@ var init_src$10 = __esmMin((() => {
279660
280175
  init_atomicDocumentStore();
279661
280176
  init_blobStoreService();
279662
280177
  init_projectLocalConfigService();
280178
+ init_configSection$14();
280179
+ init_configSection$14();
279663
280180
  init_configSection$13();
279664
280181
  init_configSection$13();
279665
- init_configSection$12();
279666
- init_configSection$12();
279667
280182
  init_miniDbQueryStore();
279668
280183
  init_inMemoryStorageService();
279669
280184
  init_sessionLockService();
@@ -279673,7 +280188,7 @@ var init_src$10 = __esmMin((() => {
279673
280188
  init_authService();
279674
280189
  init_region$1();
279675
280190
  init_regionService();
279676
- init_configSection$3();
280191
+ init_configSection$4();
279677
280192
  init_webSearch();
279678
280193
  init_webSearchService();
279679
280194
  init_nexgen_web_search();
@@ -279743,7 +280258,7 @@ var init_src$10 = __esmMin((() => {
279743
280258
  init_promise();
279744
280259
  init_retry$1();
279745
280260
  init_timer();
279746
- init_configSection$8();
280261
+ init_configSection$9();
279747
280262
  init_loop();
279748
280263
  init_loopService();
279749
280264
  init_promptChannel();
@@ -279767,7 +280282,7 @@ var init_src$10 = __esmMin((() => {
279767
280282
  init_mediaResolverService();
279768
280283
  init_configSection$1();
279769
280284
  init_imageConfigBridge();
279770
- init_configSection$4();
280285
+ init_configSection$5();
279771
280286
  init_permissionMode();
279772
280287
  init_permissionModeService();
279773
280288
  init_permissionPolicy();
@@ -279802,10 +280317,15 @@ var init_src$10 = __esmMin((() => {
279802
280317
  init_todoService();
279803
280318
  init_todo_list$1();
279804
280319
  init_todoFeature();
279805
- init_flag$4();
280320
+ init_flag$5();
279806
280321
  init_notifyUserAvailability();
279807
280322
  init_notify_user$1();
279808
280323
  init_notifyFeature();
280324
+ init_catalog$2();
280325
+ init_configSection$2();
280326
+ init_flag();
280327
+ init_serverToolsService();
280328
+ init_serverToolsFeature();
279809
280329
  init_toolContract();
279810
280330
  init_toolHooks();
279811
280331
  init_toolExecutor();
@@ -281714,7 +282234,7 @@ function isStreamingContract(contract) {
281714
282234
  var init_types$8 = __esmMin((() => {}));
281715
282235
  // ../../packages/klient/src/contract/index.ts
281716
282236
  var globalContract;
281717
- var init_contract$1 = __esmMin((() => {
282237
+ var init_contract$2 = __esmMin((() => {
281718
282238
  init_services();
281719
282239
  init_auth$3();
281720
282240
  init_capabilities$1();
@@ -282732,7 +283252,7 @@ function createKlientFromChannel(channel, options = {}) {
282732
283252
  };
282733
283253
  }
282734
283254
  var init_klient = __esmMin((() => {
282735
- init_contract$1();
283255
+ init_contract$2();
282736
283256
  init_events$4();
282737
283257
  init_events$3();
282738
283258
  init_events$2();
@@ -282867,12 +283387,12 @@ var init_serviceRegistry = __esmMin((() => {
282867
283387
  init_workspace$1();
282868
283388
  init_config$6();
282869
283389
  init_model$1();
282870
- init_catalog$2();
283390
+ init_catalog$3();
282871
283391
  init_discovery();
282872
283392
  init_modelsDevImport();
282873
283393
  init_provider$1();
282874
283394
  init_auth$5();
282875
- init_flag$5();
283395
+ init_flag$6();
282876
283396
  init_plugin();
282877
283397
  init_capability();
282878
283398
  init_bootstrap$1();
@@ -283389,7 +283909,7 @@ function errorMessage$10(error) {
283389
283909
  }
283390
283910
  var MAIN_AGENT_ID$4, SDKRpcClientBase;
283391
283911
  var init_rpc = __esmMin((() => {
283392
- init_errors$43();
283912
+ init_errors$44();
283393
283913
  MAIN_AGENT_ID$4 = "main";
283394
283914
  SDKRpcClientBase = class {
283395
283915
  interactiveAgentScope = new AsyncLocalStorage();
@@ -283688,7 +284208,7 @@ function assertImportFits(message, currentTokenCount, maxContextTokens) {
283688
284208
  var IMPORT_CONTEXT_GUIDANCE;
283689
284209
  var init_import_context = __esmMin((() => {
283690
284210
  init_tokens();
283691
- init_errors$43();
284211
+ init_errors$44();
283692
284212
  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
284213
  }));
283694
284214
  // ../../packages/product/src/shared/node/json-file.ts
@@ -285424,7 +285944,7 @@ function normalizeServerName(name) {
285424
285944
  }
285425
285945
  var init_global_mcp = __esmMin((() => {
285426
285946
  init_config_schema();
285427
- init_errors$43();
285947
+ init_errors$44();
285428
285948
  }));
285429
285949
  // ../../packages/node-sdk/src/v2/session-mapper.ts
285430
285950
  /**
@@ -285851,7 +286371,7 @@ var init_sdk_rpc_client_v2 = __esmMin((() => {
285851
286371
  init_src$13();
285852
286372
  init_auth$8();
285853
286373
  init_config$7();
285854
- init_errors$43();
286374
+ init_errors$44();
285855
286375
  init_nexgenk_harness();
285856
286376
  init_telemetry$3();
285857
286377
  init_rpc();
@@ -287352,11 +287872,23 @@ var init_sdk_rpc_client_v2 = __esmMin((() => {
287352
287872
  homeDir: this.engineAccessor.get(IHostEnvironment).homeDir
287353
287873
  }, session.accessor.get(ISessionContext).cwd, this.engineAccessor.get(IBootstrapService).homeDir, { additionalDirs: session.accessor.get(ISessionWorkspaceContext).additionalDirs })).agentsMdWarning;
287354
287874
  }
287355
- return warning === void 0 ? [] : [{
287875
+ const warnings = warning === void 0 ? [] : [{
287356
287876
  code: "agents-md-oversized",
287357
287877
  message: warning,
287358
287878
  severity: "warning"
287359
287879
  }];
287880
+ const searchWarning = this.webSearchWarning();
287881
+ if (searchWarning !== void 0) warnings.push(searchWarning);
287882
+ return warnings;
287883
+ }
287884
+ webSearchWarning() {
287885
+ if (this.engineAccessor.get(IProviderService).get("managed:nexgenk") === void 0) return void 0;
287886
+ const message = webSearchUnavailableMessage(this.engineAccessor.get(IWebSearchProviderService).diagnose());
287887
+ return message === void 0 ? void 0 : {
287888
+ code: "web-search-unavailable",
287889
+ message,
287890
+ severity: "warning"
287891
+ };
287360
287892
  }
287361
287893
  /**
287362
287894
  * Through the session scope (`ISessionBtwService`) — no klient facade
@@ -287799,14 +288331,14 @@ var init_sdk_rpc_client_v2 = __esmMin((() => {
287799
288331
  var init_config_rpc = __esmMin((() => {
287800
288332
  init_src$10();
287801
288333
  init_config$7();
287802
- init_errors$43();
288334
+ init_errors$44();
287803
288335
  }));
287804
288336
  // ../../packages/node-sdk/src/nexgenk-model-provider.ts
287805
288337
  var init_nexgenk_model_provider = __esmMin((() => {
287806
288338
  init_src$13();
287807
288339
  init_src$14();
287808
288340
  init_src$10();
287809
- init_errors$43();
288341
+ init_errors$44();
287810
288342
  init_oauth_error();
287811
288343
  }));
287812
288344
  // ../../packages/node-sdk/src/logging/types.ts
@@ -288321,12 +288853,12 @@ var init_src$8 = __esmMin((() => {
288321
288853
  init_rpc();
288322
288854
  init_nexgenk_model_provider();
288323
288855
  init_catalog();
288324
- init_errors$43();
288856
+ init_errors$44();
288325
288857
  init_logging();
288326
288858
  init_src$10();
288327
288859
  init_config$7();
288328
288860
  init_replay$1();
288329
- init_configSection$6();
288861
+ init_configSection$7();
288330
288862
  init_proxy();
288331
288863
  init_image$1();
288332
288864
  init_mediaRef$1();
@@ -288396,7 +288928,7 @@ function sanitizeProperties(input) {
288396
288928
  };
288397
288929
  }
288398
288930
  var MAX_QUEUE_SIZE, TelemetryClient, ScopedTelemetryClient, defaultClient;
288399
- var init_client = __esmMin((() => {
288931
+ var init_client$1 = __esmMin((() => {
288400
288932
  init_types$6();
288401
288933
  MAX_QUEUE_SIZE = 1e3;
288402
288934
  TelemetryClient = class {
@@ -289087,7 +289619,7 @@ function initializeTelemetry(options) {
289087
289619
  }
289088
289620
  var TELEMETRY_DISABLE_ENV$1, TRUE_ENV_VALUES;
289089
289621
  var init_bootstrap = __esmMin((() => {
289090
- init_client();
289622
+ init_client$1();
289091
289623
  init_sink();
289092
289624
  init_systemMetrics();
289093
289625
  init_transport();
@@ -289159,7 +289691,7 @@ function isAbortError$3(reason) {
289159
289691
  }
289160
289692
  var phase, installed$1, installedUncaughtHandler, installedRejectionHandler;
289161
289693
  var init_crash = __esmMin((() => {
289162
- init_client();
289694
+ init_client$1();
289163
289695
  phase = "startup";
289164
289696
  installed$1 = false;
289165
289697
  installedUncaughtHandler = null;
@@ -289191,7 +289723,7 @@ async function shutdownTelemetry(options = {}) {
289191
289723
  } catch {}
289192
289724
  }
289193
289725
  var init_src$7 = __esmMin((() => {
289194
- init_client();
289726
+ init_client$1();
289195
289727
  init_bootstrap();
289196
289728
  init_crash();
289197
289729
  }));
@@ -289244,12 +289776,11 @@ function freshNexgenProfile() {
289244
289776
  function refreshNexgenRegion() {
289245
289777
  return resolveNexgenRegionFresh().region;
289246
289778
  }
289247
- var MANAGED_NEXGEN_CODE_PROVIDER_KEY, NEXGEN_GLOBAL_PLATFORM_VALUE, resolver;
289779
+ var MANAGED_NEXGEN_CODE_PROVIDER_KEY, resolver;
289248
289780
  var init_region = __esmMin((() => {
289249
289781
  init_src$8();
289250
289782
  init_src$13();
289251
289783
  MANAGED_NEXGEN_CODE_PROVIDER_KEY = "managed:nexgenk";
289252
- NEXGEN_GLOBAL_PLATFORM_VALUE = "nexgenk-global";
289253
289784
  }));
289254
289785
  // src/constant/app.ts
289255
289786
  function nexgenkCodeSignupUrl() {
@@ -290520,23 +291051,23 @@ async function copyDeviceId(sourceHome, targetHome) {
290520
291051
  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
291052
  var init_config$4 = __esmMin((() => {
290522
291053
  init_dist$8();
290523
- init_configSection$11();
290524
- init_configSection$9();
291054
+ init_configSection$12();
291055
+ init_configSection$10();
290525
291056
  init_configSectionContributions();
290526
291057
  init_flagRegistry();
290527
291058
  init_toml();
290528
- init_configSection$8();
290529
- init_configSection$15();
291059
+ init_configSection$9();
291060
+ init_configSection$16();
291061
+ init_configSection$5();
291062
+ init_configSection$21();
290530
291063
  init_configSection$4();
291064
+ init_flag$6();
290531
291065
  init_configSection$20();
290532
- init_configSection$3();
290533
- init_flag$5();
290534
- init_configSection$19();
291066
+ init_flag$3();
290535
291067
  init_flag$2();
290536
291068
  init_flag$1();
290537
- init_flag();
290538
- init_flag$3();
290539
- init_configSection$13();
291069
+ init_flag$4();
291070
+ init_configSection$14();
290540
291071
  init_atomic_write();
290541
291072
  init_stub_detect();
290542
291073
  init_source_config();
@@ -314978,33 +315509,6 @@ var init_esm = __esmMin((() => {
314978
315509
  ({program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help} = import_commander.default);
314979
315510
  }));
314980
315511
  // 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
315512
  function isRecord$11(value) {
315009
315513
  return typeof value === "object" && value !== null;
315010
315514
  }
@@ -315062,9 +315566,6 @@ function parseReady(body) {
315062
315566
  teamId: body.teamId
315063
315567
  };
315064
315568
  }
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
315569
  function resolveLoginTeam(teams, details) {
315069
315570
  const byAlias = details.find((detail) => detail.teamAlias === "nexgen-desktop" && detail.teamId !== void 0)?.teamId;
315070
315571
  if (byAlias !== void 0) return { teamId: byAlias };
@@ -315140,16 +315641,22 @@ function selectTeam(teams, details) {
315140
315641
  if (firstWithId !== void 0) return firstWithId;
315141
315642
  return teams.length === 1 ? teams[0] : void 0;
315142
315643
  }
315644
+ var NEXGEN_SSO_TEAM_ALIAS, SsoError, NO_TEAM_MESSAGE, NO_MATCHING_TEAM_MESSAGE, NO_TEAM_MODELS_MESSAGE;
315645
+ var init_contract$1 = __esmMin((() => {
315646
+ NEXGEN_SSO_TEAM_ALIAS = "nexgen-desktop";
315647
+ SsoError = class extends Error {
315648
+ code;
315649
+ constructor(code, message) {
315650
+ super(message);
315651
+ this.name = "SsoError";
315652
+ this.code = code;
315653
+ }
315654
+ };
315655
+ NO_TEAM_MESSAGE = `this account does not belong to the ${NEXGEN_SSO_TEAM_ALIAS} team — ask an administrator to add it`;
315656
+ NO_MATCHING_TEAM_MESSAGE = `this account belongs to several teams and none is ${NEXGEN_SSO_TEAM_ALIAS} — ask an administrator to add it`;
315657
+ NO_TEAM_MODELS_MESSAGE = `the ${NEXGEN_SSO_TEAM_ALIAS} team has no models assigned — ask an administrator to check the team`;
315658
+ }));
315143
315659
  // 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
315660
  async function readJson(response) {
315154
315661
  const text = await response.text();
315155
315662
  try {
@@ -315198,7 +315705,10 @@ async function mintDurableKey(input, ready, signal) {
315198
315705
  signal
315199
315706
  });
315200
315707
  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}`}`);
315708
+ if (!response.ok) {
315709
+ const detail = typeof body === "object" && body !== null && "error" in body ? JSON.stringify(body.error).slice(0, 200) : `HTTP ${response.status}`;
315710
+ throw new SsoError("malformed", `the gateway refused to create the key: ${detail}`);
315711
+ }
315202
315712
  const minted = parseMintResponse(body, alias);
315203
315713
  return {
315204
315714
  key: minted.key,
@@ -315216,9 +315726,15 @@ async function provisionApiKeyViaSso(input) {
315216
315726
  const interval = input.pollIntervalMs ?? POLL_INTERVAL_MS$1;
315217
315727
  const start = await startSso(input, input.signal);
315218
315728
  const browserUrl = start.verificationUriComplete ?? `${input.gatewayUrl}/sso/key/generate?source=litellm-cli&key=${encodeURIComponent(start.loginId)}&user_code=${encodeURIComponent(start.userCode)}`;
315729
+ const expiresInSeconds = start.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS;
315730
+ input.onAuthorization?.({
315731
+ url: browserUrl,
315732
+ userCode: start.userCode,
315733
+ expiresInSeconds
315734
+ });
315219
315735
  input.onStatus?.(`Opening browser to sign in: ${browserUrl}`);
315220
315736
  input.openBrowser?.(browserUrl);
315221
- const deadline = now() + (start.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS) * 1e3 - 5e3;
315737
+ const deadline = now() + expiresInSeconds * 1e3 - 5e3;
315222
315738
  let pendingTeamId;
315223
315739
  let chosenTeamId;
315224
315740
  let selections = 0;
@@ -315249,6 +315765,106 @@ async function provisionApiKeyViaSso(input) {
315249
315765
  await sleep(interval);
315250
315766
  }
315251
315767
  }
315768
+ var POLL_INTERVAL_MS$1, DEFAULT_EXPIRES_IN_SECONDS, MAX_TEAM_SELECTIONS;
315769
+ var init_client = __esmMin((() => {
315770
+ init_contract$1();
315771
+ POLL_INTERVAL_MS$1 = 2e3;
315772
+ DEFAULT_EXPIRES_IN_SECONDS = 600;
315773
+ MAX_TEAM_SELECTIONS = 2;
315774
+ }));
315775
+ // src/cli/sso/provision.ts
315776
+ function normalizeBaseUrl(raw) {
315777
+ const trimmed = raw.trim().replace(/\/+$/, "");
315778
+ if (trimmed === "") throw new Error("empty base URL.");
315779
+ let parsed;
315780
+ try {
315781
+ parsed = new URL(trimmed);
315782
+ } catch {
315783
+ throw new Error(`invalid base URL "${raw}".`);
315784
+ }
315785
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error(`base URL must be http(s), got "${raw}".`);
315786
+ return parsed.pathname === "" || parsed.pathname === "/" ? `${trimmed}/v1` : trimmed;
315787
+ }
315788
+ /** `https://host/v1` → `https://host`, where the SSO and key endpoints live. */
315789
+ function gatewayOrigin(baseUrl) {
315790
+ const parsed = new URL(baseUrl);
315791
+ return /\/v1\/?$/.test(parsed.pathname) ? parsed.origin : baseUrl.replace(/\/+$/, "");
315792
+ }
315793
+ async function fetchRouterModels(input) {
315794
+ const url = `${input.baseUrl}/models`;
315795
+ let response;
315796
+ try {
315797
+ response = await fetch(url, {
315798
+ headers: {
315799
+ Authorization: `Bearer ${input.apiKey}`,
315800
+ Accept: "application/json"
315801
+ },
315802
+ signal: AbortSignal.timeout(MODELS_REQUEST_TIMEOUT_MS)
315803
+ });
315804
+ } catch (error) {
315805
+ if (error instanceof Error && error.name === "TimeoutError") throw new Error(`${url} did not answer within ${MODELS_REQUEST_TIMEOUT_MS / 1e3}s.`, { cause: error });
315806
+ throw new Error(`could not reach ${url}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
315807
+ }
315808
+ if (response.status === 401 || response.status === 403) throw new Error(`${url} rejected the API key (HTTP ${response.status}). Check the key and try again.`);
315809
+ if (!response.ok) {
315810
+ const body = (await response.text().catch(() => "")).slice(0, 200);
315811
+ throw new Error(`${url} answered HTTP ${response.status}${body === "" ? "" : `: ${body}`}`);
315812
+ }
315813
+ const models = ((await response.json().catch(() => void 0))?.data ?? []).flatMap((entry) => {
315814
+ if (typeof entry.id !== "string" || entry.id.length === 0) return [];
315815
+ return [{
315816
+ id: entry.id,
315817
+ maxInputTokens: entry.max_input_tokens,
315818
+ maxOutputTokens: entry.max_output_tokens
315819
+ }];
315820
+ });
315821
+ if (models.length === 0) throw new Error(`${url} returned no models for this key.`);
315822
+ return models;
315823
+ }
315824
+ function buildConfigPatch(input) {
315825
+ const usable = input.models.filter((model) => !RESPONSES_ONLY_MODELS.has(model.id));
315826
+ if (usable.length === 0) {
315827
+ const granted = input.models.map((model) => model.id).join(", ");
315828
+ throw new Error(`the router granted only responses-only models (${granted}); this client speaks chat completions, so there is no usable model.`);
315829
+ }
315830
+ const aliases = {};
315831
+ for (const model of usable) aliases[model.id] = {
315832
+ provider: PROVIDER_ID,
315833
+ model: model.id,
315834
+ maxContextSize: model.maxInputTokens ?? FALLBACK_MAX_CONTEXT_SIZE,
315835
+ maxOutputSize: model.maxOutputTokens,
315836
+ displayName: model.id
315837
+ };
315838
+ const ids = usable.map((model) => model.id);
315839
+ return {
315840
+ providers: { [PROVIDER_ID]: {
315841
+ type: "nexgenk",
315842
+ baseUrl: input.baseUrl,
315843
+ apiKey: input.apiKey
315844
+ } },
315845
+ models: aliases,
315846
+ defaultModel: ids.includes("nexgen-auto") ? PREFERRED_MODEL : ids[0],
315847
+ services: {
315848
+ nexgenSearch: {
315849
+ baseUrl: `${input.baseUrl}/tools/search`,
315850
+ apiKey: input.apiKey
315851
+ },
315852
+ nexgenFetch: {
315853
+ baseUrl: `${input.baseUrl}/tools/fetch`,
315854
+ apiKey: input.apiKey
315855
+ }
315856
+ }
315857
+ };
315858
+ }
315859
+ var DEFAULT_BASE_URL, PROVIDER_ID, PREFERRED_MODEL, FALLBACK_MAX_CONTEXT_SIZE, MODELS_REQUEST_TIMEOUT_MS, RESPONSES_ONLY_MODELS;
315860
+ var init_provision = __esmMin((() => {
315861
+ DEFAULT_BASE_URL = "https://ia.nexgen.systems/v1";
315862
+ PROVIDER_ID = "nexgenk";
315863
+ PREFERRED_MODEL = "nexgen-auto";
315864
+ FALLBACK_MAX_CONTEXT_SIZE = 262144;
315865
+ MODELS_REQUEST_TIMEOUT_MS = 2e4;
315866
+ RESPONSES_ONLY_MODELS = /* @__PURE__ */ new Set(["nexgen-tools-responses"]);
315867
+ }));
315252
315868
  // src/utils/process/resolve-command.ts
315253
315869
  function pathExtensions(platform, env) {
315254
315870
  if (platform !== "win32") return [""];
@@ -315334,17 +315950,16 @@ var init_open_url = __esmMin((() => {
315334
315950
  init_resolve_command();
315335
315951
  }));
315336
315952
  // src/cli/sub/login-flow.ts
315953
+ init_session_import();
315954
+ init_esm();
315337
315955
  init_src$8();
315338
315956
  init_version$2();
315957
+ init_client();
315958
+ init_provision();
315339
315959
  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
315960
  async function runLoginFlow(options = {}) {
315346
315961
  try {
315347
- const baseUrl = normalizeBaseUrl(options.baseUrl ?? readEnv("NEXGEN_BASE_URL") ?? DEFAULT_BASE_URL);
315962
+ const baseUrl = normalizeBaseUrl(options.baseUrl ?? readEnv("NEXGEN_BASE_URL") ?? "https://ia.nexgen.systems/v1");
315348
315963
  const { apiKey, source } = await obtainApiKey(options, baseUrl);
315349
315964
  const models = await fetchRouterModels({
315350
315965
  apiKey,
@@ -315359,7 +315974,7 @@ async function runLoginFlow(options = {}) {
315359
315974
  apiKey,
315360
315975
  baseUrl,
315361
315976
  models
315362
- }))).defaultModel ?? PREFERRED_MODEL;
315977
+ }))).defaultModel ?? "nexgen-auto";
315363
315978
  process.stderr.write([
315364
315979
  "",
315365
315980
  `Logged in to ${baseUrl} (${models.length} models available) via ${source}.`,
@@ -315404,15 +316019,14 @@ async function obtainApiKey(options, baseUrl) {
315404
316019
  const provisioned = await provisionApiKeyViaSso({
315405
316020
  gatewayUrl: gatewayOrigin(baseUrl),
315406
316021
  signal: controller.signal,
315407
- onStatus: (line) => process.stderr.write(`${line}\n`),
315408
- openBrowser: (url) => {
316022
+ onAuthorization: (info) => {
315409
316023
  if (options.noBrowser === true) {
315410
- process.stderr.write(`Open this URL to sign in: ${url}\n`);
316024
+ 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
316025
  return;
315412
316026
  }
315413
316027
  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`);
316028
+ openUrl(info.url, (error) => {
316029
+ process.stderr.write(`Could not open a browser (${error.message}). Sign in at ${info.url}\n`);
315416
316030
  });
315417
316031
  }
315418
316032
  });
@@ -315424,73 +316038,6 @@ async function obtainApiKey(options, baseUrl) {
315424
316038
  process.off("SIGINT", onSigint);
315425
316039
  }
315426
316040
  }
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
316041
  // ../../node_modules/.pnpm/@agentclientprotocol+sdk@1.3.0_zod@4.3.6/node_modules/@agentclientprotocol/sdk/dist/schema/index.js
315495
316042
  var AGENT_METHODS, CLIENT_METHODS, PROTOCOL_METHODS;
315496
316043
  var init_schema$2 = __esmMin((() => {
@@ -322765,6 +323312,235 @@ var init_config$3 = __esmMin((() => {
322765
323312
  }
322766
323313
  };
322767
323314
  }));
323315
+ // src/cli/sub/doctor-tools.ts
323316
+ init_config$3();
323317
+ init_src$8();
323318
+ const PROBE_TIMEOUT_MS = 15e3;
323319
+ async function probeRouterTools(input) {
323320
+ const doFetch = input.fetchImpl ?? fetch;
323321
+ const timeoutMs = input.timeoutMs ?? PROBE_TIMEOUT_MS;
323322
+ const baseUrl = input.providerBaseUrl;
323323
+ const apiKey = input.apiKey;
323324
+ const rows = [];
323325
+ if (baseUrl === void 0 || apiKey === void 0 || apiKey.length === 0) {
323326
+ rows.push({
323327
+ name: "credentials",
323328
+ kind: "probe",
323329
+ state: "BLOQUEADO",
323330
+ detail: "no nexgenk provider with an API key in config.toml — run `nexgenk login`"
323331
+ });
323332
+ return rows;
323333
+ }
323334
+ const auth = { Authorization: `Bearer ${apiKey}` };
323335
+ rows.push(await classify$1("models", async () => {
323336
+ const response = await doFetch(`${baseUrl}/models`, {
323337
+ headers: auth,
323338
+ signal: AbortSignal.timeout(timeoutMs)
323339
+ });
323340
+ if (!response.ok) return failed(response);
323341
+ const body = await response.json().catch(() => void 0);
323342
+ const count = Array.isArray(body?.data) ? body.data.length : 0;
323343
+ return count === 0 ? {
323344
+ state: "BLOQUEADO",
323345
+ detail: "HTTP 200 without models"
323346
+ } : {
323347
+ state: "MEDIDO",
323348
+ detail: `${count} models granted`
323349
+ };
323350
+ }));
323351
+ rows.push(await probePost("search", input.searchUrl, `${baseUrl}/tools/search`, {
323352
+ query: "nexgen probe",
323353
+ count: 1
323354
+ }, auth, doFetch, timeoutMs));
323355
+ rows.push(await probePost("fetch", input.fetchUrl, `${baseUrl}/tools/fetch`, { url: "https://example.com" }, auth, doFetch, timeoutMs));
323356
+ rows.push(serverToolRow(input));
323357
+ rows.push({
323358
+ name: "fim",
323359
+ kind: "declared",
323360
+ state: "SIN-SONDA",
323361
+ detail: "POST /beta/completions answers 404; no public route"
323362
+ });
323363
+ rows.push({
323364
+ name: "balance",
323365
+ kind: "declared",
323366
+ state: "SIN-SONDA",
323367
+ detail: "GET /user/balance answers 404; no public route"
323368
+ });
323369
+ rows.push({
323370
+ name: "files",
323371
+ kind: "declared",
323372
+ state: "SIN-SONDA",
323373
+ detail: "needs a Files grant on the key, and no endpoint serves the bytes"
323374
+ });
323375
+ rows.push({
323376
+ name: "denied:shell,bash,apply_patch",
323377
+ kind: "declared",
323378
+ state: "SIN-SONDA",
323379
+ detail: "denied by edge policy; the catalog never declares them"
323380
+ });
323381
+ return rows;
323382
+ }
323383
+ function serverToolRow(input) {
323384
+ if (!input.serverToolsFlagOn) return {
323385
+ name: "server_tools",
323386
+ kind: "declared",
323387
+ state: "SIN-SONDA",
323388
+ detail: "feature disabled (NEXGEN_EXPERIMENTAL_SERVER_TOOLS)"
323389
+ };
323390
+ if (input.serverToolsEnabled.length === 0) return {
323391
+ name: "server_tools",
323392
+ kind: "declared",
323393
+ state: "SIN-SONDA",
323394
+ detail: "no [server_tools] enabled entries"
323395
+ };
323396
+ return {
323397
+ name: "server_tools",
323398
+ kind: "declared",
323399
+ state: "SIN-SONDA",
323400
+ detail: `declared on the next model turn: ${input.serverToolsEnabled.join(", ")}`
323401
+ };
323402
+ }
323403
+ async function probePost(name, configuredUrl, defaultUrl, body, auth, doFetch, timeoutMs) {
323404
+ if (configuredUrl === void 0) return {
323405
+ name,
323406
+ kind: "probe",
323407
+ state: "SIN-SONDA",
323408
+ detail: "no [services] entry — `nexgenk login` provisions it"
323409
+ };
323410
+ const url = configuredUrl.length > 0 ? configuredUrl : defaultUrl;
323411
+ return classify$1(name, async () => {
323412
+ const response = await doFetch(url, {
323413
+ method: "POST",
323414
+ headers: {
323415
+ ...auth,
323416
+ "Content-Type": "application/json"
323417
+ },
323418
+ body: JSON.stringify(body),
323419
+ signal: AbortSignal.timeout(timeoutMs)
323420
+ });
323421
+ if (response.ok) return {
323422
+ state: "MEDIDO",
323423
+ detail: `HTTP 200 from ${url}`
323424
+ };
323425
+ return failed(response);
323426
+ });
323427
+ }
323428
+ async function classify$1(name, run) {
323429
+ try {
323430
+ const { state, detail } = await run();
323431
+ return {
323432
+ name,
323433
+ kind: "probe",
323434
+ state,
323435
+ detail
323436
+ };
323437
+ } catch (error) {
323438
+ if (error instanceof Error && error.name === "TimeoutError") return {
323439
+ name,
323440
+ kind: "probe",
323441
+ state: "BLOQUEADO",
323442
+ detail: "probe timed out"
323443
+ };
323444
+ return {
323445
+ name,
323446
+ kind: "probe",
323447
+ state: "BLOQUEADO",
323448
+ detail: `probe failed: ${error instanceof Error ? error.message : String(error)}`
323449
+ };
323450
+ }
323451
+ }
323452
+ async function failed(response) {
323453
+ const motivo = response.headers.get("x-nexgen-motivo") ?? "";
323454
+ const bodyText = (await response.text().catch(() => "")).slice(0, 160);
323455
+ const detail = `HTTP ${response.status}${motivo === "" ? "" : ` ${motivo}`}${bodyText === "" ? "" : `: ${bodyText}`}`;
323456
+ if (response.status === 401) return {
323457
+ state: "BLOQUEADO",
323458
+ detail: `${detail} — the key was not recognised, which is not a policy refusal`
323459
+ };
323460
+ if (response.status === 403 || response.status === 429) return {
323461
+ state: motivo.startsWith("tool_") || bodyText.includes("tool_") ? "DENEGADO" : "BLOQUEADO",
323462
+ detail
323463
+ };
323464
+ return {
323465
+ state: "BLOQUEADO",
323466
+ detail
323467
+ };
323468
+ }
323469
+ function verdictOf(rows) {
323470
+ const probes = rows.filter((row) => row.kind === "probe");
323471
+ if (probes.some((row) => row.state === "BLOQUEADO" || row.state === "SIN-SONDA")) return "inconclusive";
323472
+ if (probes.some((row) => row.state !== "MEDIDO")) return "contradicted";
323473
+ return "measured";
323474
+ }
323475
+ const EXIT_CODES = {
323476
+ measured: 0,
323477
+ contradicted: 1,
323478
+ inconclusive: 2
323479
+ };
323480
+ async function handleDoctorTools(deps) {
323481
+ const configPath = resolveConfigPath({ homeDir: resolveNexgenHome() });
323482
+ const { config, fileError } = loadRuntimeConfigSafe(configPath);
323483
+ if (fileError !== void 0) {
323484
+ deps.stderr.write(`Cannot read ${configPath}: ${fileError.message}\n`);
323485
+ deps.exit(1);
323486
+ }
323487
+ const provider = config.providers["nexgenk"];
323488
+ const rows = await probeRouterTools({
323489
+ providerBaseUrl: provider?.baseUrl,
323490
+ apiKey: provider?.apiKey,
323491
+ searchUrl: config.services?.nexgenSearch?.baseUrl,
323492
+ fetchUrl: config.services?.nexgenFetch?.baseUrl,
323493
+ serverToolsEnabled: readServerToolsEnabled(config.raw),
323494
+ serverToolsFlagOn: readFlag("NEXGEN_EXPERIMENTAL_SERVER_TOOLS"),
323495
+ fetchImpl: deps.fetchImpl
323496
+ });
323497
+ const verdict = verdictOf(rows);
323498
+ const chunk = deps.json === true ? formatJson(rows, verdict) : formatTable(rows, verdict);
323499
+ deps.stdout.write(chunk);
323500
+ deps.exit(EXIT_CODES[verdict]);
323501
+ }
323502
+ function formatJson(rows, verdict) {
323503
+ const report = {
323504
+ surface: "nexgenrouter",
323505
+ schema: 1,
323506
+ verdict,
323507
+ rows: rows.map((row) => ({
323508
+ name: row.name,
323509
+ kind: row.kind,
323510
+ state: row.state,
323511
+ detail: row.detail
323512
+ }))
323513
+ };
323514
+ return `${JSON.stringify(report, null, 2)}\n`;
323515
+ }
323516
+ function formatTable(rows, verdict) {
323517
+ const width = Math.max(...rows.map((row) => row.name.length));
323518
+ return [
323519
+ "NexgenRouter tools",
323520
+ "",
323521
+ ...rows.map((row) => ` ${row.state.padEnd(9)} ${row.name.padEnd(width)} ${row.detail}`),
323522
+ "",
323523
+ VERDICT_LINES[verdict],
323524
+ ""
323525
+ ].join("\n");
323526
+ }
323527
+ const VERDICT_LINES = {
323528
+ measured: "Every probed row answered the contract. Declared rows without a route are listed above and never count as green.",
323529
+ contradicted: "CONTRADICTED: a probe was measured and does not fit the contract (policy refusal or an off-shape answer).",
323530
+ inconclusive: "NO CONCLUYENTE: some rows could not be measured (BLOQUEADO or SIN-SONDA are never green)."
323531
+ };
323532
+ function readFlag(envName) {
323533
+ const raw = process.env[envName]?.trim().toLowerCase();
323534
+ if (raw === void 0 || raw === "") return false;
323535
+ return raw === "1" || raw === "true" || raw === "yes" || raw === "on";
323536
+ }
323537
+ function readServerToolsEnabled(raw) {
323538
+ const section = raw?.["server_tools"];
323539
+ if (section === null || typeof section !== "object") return [];
323540
+ const enabled = section["enabled"];
323541
+ if (!Array.isArray(enabled)) return [];
323542
+ return enabled.filter((entry) => typeof entry === "string");
323543
+ }
322768
323544
  // src/cli/v2/validate-config.ts
322769
323545
  var validate_config_exports = /* @__PURE__ */ __exportAll({ validateConfigTomlV2: () => validateConfigTomlV2 });
322770
323546
  /**
@@ -322861,7 +323637,6 @@ var init_validate_config = __esmMin((() => {
322861
323637
  // src/cli/sub/doctor.ts
322862
323638
  init_src$8();
322863
323639
  init_zod$1();
322864
- init_config$3();
322865
323640
  async function handleDoctor(deps, options) {
322866
323641
  const resolved = resolveDeps$1(deps);
322867
323642
  const specs = await buildCheckSpecs(resolved, options, resolved.cwd());
@@ -322888,6 +323663,15 @@ function registerDoctorCommand(parent, deps) {
322888
323663
  path
322889
323664
  });
322890
323665
  });
323666
+ doctor.command("tools").description("Probe the NexgenRouter tool surface and report measured states.").option("--json", "Emit a machine-readable report instead of the table.").action(async (options) => {
323667
+ const resolved = resolveDeps$1(deps);
323668
+ await handleDoctorTools({
323669
+ stdout: resolved.stdout,
323670
+ stderr: resolved.stderr,
323671
+ exit: resolved.exit,
323672
+ json: options.json === true
323673
+ });
323674
+ });
322891
323675
  }
322892
323676
  async function runDoctorCommand(deps, options) {
322893
323677
  const resolved = resolveDeps$1(deps);
@@ -366414,7 +367198,7 @@ var listModelsResponseSchema, listProvidersResponseSchema, getProviderResponseSc
366414
367198
  var init_rest_modelCatalog = __esmMin((() => {
366415
367199
  init_zod$1();
366416
367200
  init_src$10();
366417
- init_catalog$2();
367201
+ init_catalog$3();
366418
367202
  listModelsResponseSchema = object$1({ items: array(modelCatalogItemSchema$1) });
366419
367203
  listProvidersResponseSchema = object$1({ items: array(providerCatalogItemSchema$1) });
366420
367204
  getProviderResponseSchema = providerCatalogItemSchema$1.extend({ api_key: string().optional() });
@@ -367005,9 +367789,9 @@ var providerIdParamSchema, modelActionTailParamSchema, providerActionTailParamSc
367005
367789
  var init_modelCatalog = __esmMin((() => {
367006
367790
  init_src$10();
367007
367791
  init_provider_credential();
367008
- init_catalog$2();
367792
+ init_catalog$3();
367009
367793
  init_discovery();
367010
- init_configSection$11();
367794
+ init_configSection$12();
367011
367795
  init_zod$1();
367012
367796
  init_envelope();
367013
367797
  init_defineRoute();
@@ -375299,7 +376083,7 @@ var init_registerApiV1Routes = __esmMin((() => {
375299
376083
  init_src$10();
375300
376084
  init_fiber();
375301
376085
  init_featureManager();
375302
- init_flag$5();
376086
+ init_flag$6();
375303
376087
  init_node$8();
375304
376088
  init_envelope();
375305
376089
  init_sessionEventBroadcaster();
@@ -462718,27 +463502,19 @@ var init_model_selector = __esmMin((() => {
462718
463502
  }));
462719
463503
  // src/tui/components/dialogs/platform-selector.ts
462720
463504
  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
- ];
463505
+ return [NEXGEN_SSO_OPTION, ...OPEN_PLATFORMS.map((platform) => ({
463506
+ value: platform.id,
463507
+ label: platform.name
463508
+ }))];
462729
463509
  }
462730
- var NEXGEN_MAINLAND_CN_OPTION, NEXGEN_GLOBAL_OPTION, PlatformSelectorComponent;
463510
+ var NEXGEN_SSO_OPTION, PlatformSelectorComponent;
462731
463511
  var init_platform_selector = __esmMin((() => {
462732
463512
  init_src$13();
462733
- init_region();
462734
463513
  init_choice_picker();
462735
- NEXGEN_MAINLAND_CN_OPTION = {
463514
+ NEXGEN_SSO_OPTION = {
462736
463515
  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)"
463516
+ label: "NexgenK (SSO)",
463517
+ description: "Sign in at ia.nexgen.systems and mint an API key"
462742
463518
  };
462743
463519
  PlatformSelectorComponent = class extends ChoicePickerComponent {
462744
463520
  constructor(opts) {
@@ -462949,7 +463725,7 @@ async function handleLoginCommand(host) {
462949
463725
  const platformId = await promptPlatformSelection(host);
462950
463726
  if (platformId === void 0) return;
462951
463727
  if (platformId === "nexgenk" || platformId === "nexgenk-global") {
462952
- await handleNexgenCodeOAuthLogin(host, platformId === "nexgenk-global" ? "global" : "mainland-cn");
463728
+ await handleNexgenSsoLogin(host);
462953
463729
  return;
462954
463730
  }
462955
463731
  const platform = getOpenPlatformById(platformId);
@@ -462959,23 +463735,41 @@ async function handleLoginCommand(host) {
462959
463735
  releaseAuthBlock();
462960
463736
  }
462961
463737
  }
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;
463738
+ async function handleNexgenSsoLogin(host) {
462965
463739
  const controller = new AbortController();
462966
463740
  const cancelLogin = () => {
462967
463741
  controller.abort();
462968
463742
  };
462969
463743
  host.cancelInFlight = cancelLogin;
463744
+ let spinner;
462970
463745
  try {
462971
- await host.harness.auth.login(DEFAULT_OAUTH_PROVIDER_NAME, {
463746
+ const existing = await host.harness.getConfig();
463747
+ const configuredBaseUrl = existing.providers[PROVIDER_ID]?.baseUrl;
463748
+ const baseUrl = typeof configuredBaseUrl === "string" && configuredBaseUrl.length > 0 ? configuredBaseUrl : DEFAULT_BASE_URL;
463749
+ const alreadyLoggedIn = existing.providers[PROVIDER_ID] !== void 0;
463750
+ const provisioned = await provisionApiKeyViaSso({
463751
+ gatewayUrl: gatewayOrigin(baseUrl),
462972
463752
  signal: controller.signal,
462973
- region,
462974
- onDeviceCode: (data) => {
462975
- spinner = host.showLoginAuthorizationPrompt(data);
463753
+ onAuthorization: (info) => {
463754
+ spinner = host.showLoginAuthorizationPrompt({
463755
+ userCode: info.userCode,
463756
+ deviceCode: info.url,
463757
+ verificationUri: info.url,
463758
+ verificationUriComplete: info.url,
463759
+ expiresIn: info.expiresInSeconds,
463760
+ interval: 2
463761
+ });
462976
463762
  }
462977
463763
  });
462978
- refreshNexgenRegion();
463764
+ const models = await fetchRouterModels({
463765
+ apiKey: provisioned.key,
463766
+ baseUrl
463767
+ });
463768
+ await host.harness.setConfig(buildConfigPatch({
463769
+ apiKey: provisioned.key,
463770
+ baseUrl,
463771
+ models
463772
+ }));
462979
463773
  if (host.state.appState.model.trim().length > 0) host.setAuthRequired(false);
462980
463774
  spinner?.stop({
462981
463775
  ok: true,
@@ -462990,32 +463784,25 @@ async function handleNexgenCodeOAuthLogin(host, region) {
462990
463784
  return;
462991
463785
  }
462992
463786
  host.track("login", {
462993
- provider: DEFAULT_OAUTH_PROVIDER_NAME,
462994
- method: "oauth",
463787
+ provider: PROVIDER_ID,
463788
+ method: "sso",
462995
463789
  already_logged_in: alreadyLoggedIn
462996
463790
  });
462997
- if (alreadyLoggedIn) host.showStatus("Already logged in. Model configuration refreshed.", "success");
463791
+ host.showStatus(`Signed in to ${baseUrl} · key ${provisioned.alias}`, "success");
462998
463792
  } catch (error) {
462999
463793
  const cancelled = controller.signal.aborted;
463000
- const denied = error instanceof OAuthAccessDeniedError;
463001
463794
  spinner?.stop({
463002
463795
  ok: false,
463003
- label: cancelled || denied ? "Login cancelled." : "Login failed."
463796
+ label: cancelled ? "Login cancelled." : "Login failed."
463004
463797
  });
463005
463798
  spinner = void 0;
463006
463799
  if (cancelled) return;
463007
- const message = formatErrorMessage$2(error);
463008
- if (denied) {
463009
- host.showError(`Login cancelled: ${message}`);
463010
- return;
463011
- }
463012
463800
  log$1.warn("login failed", {
463013
- providerName: DEFAULT_OAUTH_PROVIDER_NAME,
463014
- alreadyLoggedIn,
463801
+ providerName: PROVIDER_ID,
463015
463802
  sessionId: host.session?.id,
463016
463803
  error
463017
463804
  });
463018
- host.showError(`Login failed: ${message}`);
463805
+ host.showError(`Login failed: ${formatErrorMessage$2(error)}`);
463019
463806
  } finally {
463020
463807
  if (host.cancelInFlight === cancelLogin) host.cancelInFlight = void 0;
463021
463808
  }
@@ -463116,6 +463903,8 @@ async function handleLogoutCommand(host) {
463116
463903
  var init_auth = __esmMin((() => {
463117
463904
  init_src$13();
463118
463905
  init_src$8();
463906
+ init_client();
463907
+ init_provision();
463119
463908
  init_nexgenk_tui();
463120
463909
  init_event_payload();
463121
463910
  init_region();