@qwen-code/qwen-code 0.16.1 → 0.16.2

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 (83) hide show
  1. package/bundled/new-app/SKILL.md +22 -0
  2. package/bundled/qc-helper/docs/configuration/settings.md +9 -4
  3. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  4. package/bundled/qc-helper/docs/features/headless.md +32 -0
  5. package/bundled/qc-helper/docs/features/memory.md +22 -5
  6. package/bundled/qc-helper/docs/features/worktree.md +345 -0
  7. package/chunks/{agent-2JCG7FDJ.js → agent-RY5EB3XR.js} +15 -15
  8. package/chunks/{anthropicContentGenerator-RQJNXJIY.js → anthropicContentGenerator-LYI3OHBB.js} +4 -4
  9. package/chunks/{askUserQuestion-PQPMPNM3.js → askUserQuestion-R3MKD2JT.js} +2 -2
  10. package/chunks/{ca-UZ7BANMN.js → ca-NMZFEGAU.js} +1 -0
  11. package/chunks/{chunk-JCR2WRXZ.js → chunk-4YNZFYJY.js} +666 -29
  12. package/chunks/{chunk-HW5S7L73.js → chunk-66CJCYYZ.js} +11 -11
  13. package/chunks/{chunk-MAY32HXD.js → chunk-6NUSWV4M.js} +1 -1
  14. package/chunks/{chunk-BAZDG3QU.js → chunk-7HM6OB7M.js} +2801 -1894
  15. package/chunks/{chunk-GGNTZ2NH.js → chunk-7YJIR2FX.js} +2 -2
  16. package/chunks/{chunk-XP27SJMH.js → chunk-ACBGEKB7.js} +10 -1
  17. package/chunks/{chunk-CAVZVZX6.js → chunk-C27V5A2J.js} +1 -1
  18. package/chunks/{chunk-G7YTSRES.js → chunk-EY6BDW7Y.js} +1 -1
  19. package/chunks/{chunk-YJLGXDQJ.js → chunk-FO7BIVSR.js} +1 -1
  20. package/chunks/{chunk-D6LBYOCX.js → chunk-GQXXO5HJ.js} +109 -17
  21. package/chunks/{chunk-F23NCRJ2.js → chunk-GVWPJCXU.js} +1 -1
  22. package/chunks/{chunk-CSWBPY3P.js → chunk-JVD46YJV.js} +1 -1
  23. package/chunks/{chunk-4AOCVI6J.js → chunk-K72FHBFO.js} +1 -1
  24. package/chunks/{chunk-PR4T27R7.js → chunk-NQ3E7YLD.js} +1 -1
  25. package/chunks/{chunk-D5NTAHYL.js → chunk-ODPVJ6JJ.js} +1 -1
  26. package/chunks/{chunk-KXZ4TJB4.js → chunk-OIL7KDWV.js} +1 -1
  27. package/chunks/{chunk-7LMPOVYW.js → chunk-PJLEMR7N.js} +38 -16
  28. package/chunks/{chunk-L5E26RN6.js → chunk-TXQI3VZ7.js} +1 -1
  29. package/chunks/{chunk-N6GSJHZ4.js → chunk-UE5LPQF7.js} +9 -14
  30. package/chunks/{chunk-DMIMF3CG.js → chunk-VMOWXTRC.js} +2 -2
  31. package/chunks/{chunk-PVVL5Q3W.js → chunk-YMDXEEOW.js} +1 -1
  32. package/chunks/{contextCommand-XVRGKS3Q.js → contextCommand-DDGVLQSF.js} +17 -17
  33. package/chunks/{cron-create-IGYXQVG4.js → cron-create-BTEOGHPH.js} +2 -2
  34. package/chunks/{cron-delete-ETKIZCWT.js → cron-delete-56CEWELN.js} +2 -2
  35. package/chunks/{cron-list-BVCUSWRU.js → cron-list-SV6QRZW2.js} +2 -2
  36. package/chunks/{de-V4IE2OOZ.js → de-OIMT3OMI.js} +1 -0
  37. package/chunks/{dist-4L54HRX2.js → dist-R2SXPG74.js} +22 -3
  38. package/chunks/{edit-3MLXHQPW.js → edit-4LLGNYVZ.js} +16 -16
  39. package/chunks/{en-HGJ2SPLM.js → en-2IFZ5THF.js} +1 -0
  40. package/chunks/{enter-worktree-OCA4SG6D.js → enter-worktree-E2R5XAFT.js} +18 -16
  41. package/chunks/{exit-worktree-6EDLXVEV.js → exit-worktree-YVBYYYDD.js} +15 -15
  42. package/chunks/{exitPlanMode-H75KHRX4.js → exitPlanMode-WD5IH7NS.js} +15 -15
  43. package/chunks/{fr-CJULI7ZX.js → fr-PVELSHTV.js} +1 -0
  44. package/chunks/{geminiContentGenerator-E7Y6TCPU.js → geminiContentGenerator-LM65ADWM.js} +3 -3
  45. package/chunks/{glob-JFFSKARO.js → glob-6X6OCEWE.js} +15 -15
  46. package/chunks/{grep-7TAFR7MX.js → grep-2UUPSSIQ.js} +15 -15
  47. package/chunks/{ja-L7CHRQEW.js → ja-P5TK5GNN.js} +1 -0
  48. package/chunks/{keychain-token-storage-335UOLJ6.js → keychain-token-storage-3552ENXE.js} +2 -2
  49. package/chunks/{ls-7HD6XG3V.js → ls-MYXAM7LJ.js} +3 -3
  50. package/chunks/{lsp-ZZSFCIWD.js → lsp-PFGI35JL.js} +2 -2
  51. package/chunks/{monitor-YX2ABLXH.js → monitor-VUHPEGUW.js} +25 -20
  52. package/chunks/{notebook-edit-EEJEGFZR.js → notebook-edit-P4QVLW6I.js} +16 -16
  53. package/chunks/{openaiContentGenerator-BSAWHGQJ.js → openaiContentGenerator-JH4YNZ3H.js} +10 -10
  54. package/chunks/{pt-M6JULLEQ.js → pt-A5GHG66T.js} +1 -0
  55. package/chunks/{qwenContentGenerator-47XRHQXM.js → qwenContentGenerator-5FE4UYUT.js} +17 -17
  56. package/chunks/{qwenOAuth2-EEJGROP7.js → qwenOAuth2-BAN2EGSH.js} +3 -3
  57. package/chunks/{read-file-O53WD46Y.js → read-file-J7DH4OKV.js} +7 -7
  58. package/chunks/{ripGrep-OXNZ5Z3T.js → ripGrep-33DECY4F.js} +15 -15
  59. package/chunks/{ru-QILM4HBC.js → ru-66XKB4QX.js} +1 -0
  60. package/chunks/{send-message-ULK4MQXJ.js → send-message-JUFP62VD.js} +2 -2
  61. package/chunks/{serve-H2REZAYD.js → serve-7FX7MREA.js} +17 -17
  62. package/chunks/{shell-DET66JID.js → shell-ZNTQIRK6.js} +15 -15
  63. package/chunks/{skill-ZIXPX3L3.js → skill-CFCUIY23.js} +9 -9
  64. package/chunks/{src-PN3XGQYP.js → src-AHV2CWEQ.js} +39 -15
  65. package/chunks/{syntheticOutput-IS2X5OZ2.js → syntheticOutput-AKTXC6FR.js} +3 -3
  66. package/chunks/{task-stop-7QSJGSSP.js → task-stop-2NYFR2ES.js} +2 -2
  67. package/chunks/{todoWrite-7CVACFUX.js → todoWrite-WHZ2O2XP.js} +3 -3
  68. package/chunks/{tool-search-GTYLSGZ3.js → tool-search-C2EMLFBJ.js} +7 -7
  69. package/chunks/{web-fetch-ENQ2I5JA.js → web-fetch-S6MZXPZ5.js} +4 -4
  70. package/chunks/{write-file-NILNEZCR.js → write-file-EEPVRS4Q.js} +16 -16
  71. package/chunks/{zh-PWL2NKY3.js → zh-OB5P2ZDO.js} +1 -0
  72. package/chunks/{zh-TW-S3YGWICZ.js → zh-TW-3ND6DQRX.js} +1 -0
  73. package/cli.js +5666 -4466
  74. package/locales/ca.js +1 -0
  75. package/locales/de.js +1 -0
  76. package/locales/en.js +1 -0
  77. package/locales/fr.js +1 -0
  78. package/locales/ja.js +1 -0
  79. package/locales/pt.js +1 -0
  80. package/locales/ru.js +1 -0
  81. package/locales/zh-TW.js +1 -0
  82. package/locales/zh.js +1 -0
  83. package/package.json +2 -2
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-OFEVLU4C.js";
10
10
  import {
11
11
  isAutoMemPath
12
- } from "./chunk-PR4T27R7.js";
12
+ } from "./chunk-NQ3E7YLD.js";
13
13
  import {
14
14
  DEFAULT_OPENAI_BASE_URL,
15
15
  convertSchema,
@@ -17,23 +17,23 @@ import {
17
17
  runtimeDiagnostics,
18
18
  safeJsonParse,
19
19
  tokenLimit
20
- } from "./chunk-MAY32HXD.js";
20
+ } from "./chunk-6NUSWV4M.js";
21
21
  import {
22
22
  InstallationManager
23
- } from "./chunk-D5NTAHYL.js";
23
+ } from "./chunk-ODPVJ6JJ.js";
24
24
  import {
25
25
  FinishReason,
26
26
  GenerateContentResponse
27
27
  } from "./chunk-T4VD6OJ4.js";
28
28
  import {
29
29
  STRUCTURED_OUTPUT_REDACTED_ARGS
30
- } from "./chunk-YJLGXDQJ.js";
30
+ } from "./chunk-FO7BIVSR.js";
31
31
  import {
32
32
  BaseDeclarativeTool,
33
33
  BaseToolInvocation,
34
34
  ToolDisplayNames,
35
35
  ToolNames
36
- } from "./chunk-PVVL5Q3W.js";
36
+ } from "./chunk-YMDXEEOW.js";
37
37
  import {
38
38
  FatalConfigError,
39
39
  Storage,
@@ -49,7 +49,7 @@ import {
49
49
  setSessionContext,
50
50
  shortenPath,
51
51
  unescapePath
52
- } from "./chunk-XP27SJMH.js";
52
+ } from "./chunk-ACBGEKB7.js";
53
53
  import {
54
54
  require_dist
55
55
  } from "./chunk-ZERZSAZL.js";
@@ -62445,6 +62445,506 @@ var require_src30 = __commonJS({
62445
62445
  }
62446
62446
  });
62447
62447
 
62448
+ // node_modules/@opentelemetry/instrumentation-undici/build/src/version.js
62449
+ var require_version10 = __commonJS({
62450
+ "node_modules/@opentelemetry/instrumentation-undici/build/src/version.js"(exports2) {
62451
+ "use strict";
62452
+ init_esbuild_shims();
62453
+ Object.defineProperty(exports2, "__esModule", { value: true });
62454
+ exports2.PACKAGE_NAME = exports2.PACKAGE_VERSION = void 0;
62455
+ exports2.PACKAGE_VERSION = "0.14.0";
62456
+ exports2.PACKAGE_NAME = "@opentelemetry/instrumentation-undici";
62457
+ }
62458
+ });
62459
+
62460
+ // node_modules/@opentelemetry/instrumentation-undici/build/src/enums/SemanticAttributes.js
62461
+ var require_SemanticAttributes = __commonJS({
62462
+ "node_modules/@opentelemetry/instrumentation-undici/build/src/enums/SemanticAttributes.js"(exports2) {
62463
+ "use strict";
62464
+ init_esbuild_shims();
62465
+ Object.defineProperty(exports2, "__esModule", { value: true });
62466
+ exports2.SemanticAttributes = void 0;
62467
+ exports2.SemanticAttributes = {
62468
+ /**
62469
+ * State of the HTTP connection in the HTTP connection pool.
62470
+ */
62471
+ HTTP_CONNECTION_STATE: "http.connection.state",
62472
+ /**
62473
+ * Describes a class of error the operation ended with.
62474
+ *
62475
+ * Note: The `error.type` SHOULD be predictable and SHOULD have low cardinality.
62476
+ Instrumentations SHOULD document the list of errors they report.
62477
+
62478
+ The cardinality of `error.type` within one instrumentation library SHOULD be low.
62479
+ Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
62480
+ should be prepared for `error.type` to have high cardinality at query time when no
62481
+ additional filters are applied.
62482
+
62483
+ If the operation has completed successfully, instrumentations SHOULD NOT set `error.type`.
62484
+
62485
+ If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes),
62486
+ it's RECOMMENDED to:
62487
+
62488
+ * Use a domain-specific attribute
62489
+ * Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
62490
+ */
62491
+ ERROR_TYPE: "error.type",
62492
+ /**
62493
+ * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
62494
+ */
62495
+ HTTP_REQUEST_BODY_SIZE: "http.request.body.size",
62496
+ /**
62497
+ * HTTP request method.
62498
+ *
62499
+ * Note: HTTP request method value SHOULD be "known" to the instrumentation.
62500
+ By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
62501
+ and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
62502
+
62503
+ If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`.
62504
+
62505
+ If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override
62506
+ the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named
62507
+ OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods
62508
+ (this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).
62509
+
62510
+ HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.
62511
+ Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.
62512
+ Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.
62513
+ */
62514
+ HTTP_REQUEST_METHOD: "http.request.method",
62515
+ /**
62516
+ * Original HTTP method sent by the client in the request line.
62517
+ */
62518
+ HTTP_REQUEST_METHOD_ORIGINAL: "http.request.method_original",
62519
+ /**
62520
+ * The ordinal number of request resending attempt (for any reason, including redirects).
62521
+ *
62522
+ * Note: The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).
62523
+ */
62524
+ HTTP_REQUEST_RESEND_COUNT: "http.request.resend_count",
62525
+ /**
62526
+ * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
62527
+ */
62528
+ HTTP_RESPONSE_BODY_SIZE: "http.response.body.size",
62529
+ /**
62530
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
62531
+ */
62532
+ HTTP_RESPONSE_STATUS_CODE: "http.response.status_code",
62533
+ /**
62534
+ * The matched route, that is, the path template in the format used by the respective server framework.
62535
+ *
62536
+ * Note: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.
62537
+ SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.
62538
+ */
62539
+ HTTP_ROUTE: "http.route",
62540
+ /**
62541
+ * Peer address of the network connection - IP address or Unix domain socket name.
62542
+ */
62543
+ NETWORK_PEER_ADDRESS: "network.peer.address",
62544
+ /**
62545
+ * Peer port number of the network connection.
62546
+ */
62547
+ NETWORK_PEER_PORT: "network.peer.port",
62548
+ /**
62549
+ * [OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.
62550
+ *
62551
+ * Note: The value SHOULD be normalized to lowercase.
62552
+ */
62553
+ NETWORK_PROTOCOL_NAME: "network.protocol.name",
62554
+ /**
62555
+ * Version of the protocol specified in `network.protocol.name`.
62556
+ *
62557
+ * Note: `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
62558
+ */
62559
+ NETWORK_PROTOCOL_VERSION: "network.protocol.version",
62560
+ /**
62561
+ * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
62562
+ *
62563
+ * Note: When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
62564
+ */
62565
+ SERVER_ADDRESS: "server.address",
62566
+ /**
62567
+ * Server port number.
62568
+ *
62569
+ * Note: When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
62570
+ */
62571
+ SERVER_PORT: "server.port",
62572
+ /**
62573
+ * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986).
62574
+ *
62575
+ * Note: For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless.
62576
+ `url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute's value SHOULD be `https://REDACTED:REDACTED@www.example.com/`.
62577
+ `url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes.
62578
+ */
62579
+ URL_FULL: "url.full",
62580
+ /**
62581
+ * The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component.
62582
+ */
62583
+ URL_PATH: "url.path",
62584
+ /**
62585
+ * The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component.
62586
+ *
62587
+ * Note: Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.
62588
+ */
62589
+ URL_QUERY: "url.query",
62590
+ /**
62591
+ * The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.
62592
+ */
62593
+ URL_SCHEME: "url.scheme",
62594
+ /**
62595
+ * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.
62596
+ */
62597
+ USER_AGENT_ORIGINAL: "user_agent.original"
62598
+ };
62599
+ }
62600
+ });
62601
+
62602
+ // node_modules/@opentelemetry/instrumentation-undici/build/src/undici.js
62603
+ var require_undici = __commonJS({
62604
+ "node_modules/@opentelemetry/instrumentation-undici/build/src/undici.js"(exports2) {
62605
+ "use strict";
62606
+ init_esbuild_shims();
62607
+ Object.defineProperty(exports2, "__esModule", { value: true });
62608
+ exports2.UndiciInstrumentation = void 0;
62609
+ var diagch = __require("diagnostics_channel");
62610
+ var url_1 = __require("url");
62611
+ var instrumentation_1 = require_src21();
62612
+ var api_1 = (init_esm(), __toCommonJS(esm_exports));
62613
+ var version_1 = require_version10();
62614
+ var SemanticAttributes_1 = require_SemanticAttributes();
62615
+ var core_1 = require_src3();
62616
+ var UndiciInstrumentation2 = class extends instrumentation_1.InstrumentationBase {
62617
+ static {
62618
+ __name(this, "UndiciInstrumentation");
62619
+ }
62620
+ _recordFromReq = /* @__PURE__ */ new WeakMap();
62621
+ constructor(config = {}) {
62622
+ super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config);
62623
+ }
62624
+ // No need to instrument files/modules
62625
+ init() {
62626
+ return void 0;
62627
+ }
62628
+ disable() {
62629
+ super.disable();
62630
+ this._channelSubs.forEach((sub) => sub.unsubscribe());
62631
+ this._channelSubs.length = 0;
62632
+ }
62633
+ enable() {
62634
+ super.enable();
62635
+ this._channelSubs = this._channelSubs || [];
62636
+ if (this._channelSubs.length > 0) {
62637
+ return;
62638
+ }
62639
+ this.subscribeToChannel("undici:request:create", this.onRequestCreated.bind(this));
62640
+ this.subscribeToChannel("undici:client:sendHeaders", this.onRequestHeaders.bind(this));
62641
+ this.subscribeToChannel("undici:request:headers", this.onResponseHeaders.bind(this));
62642
+ this.subscribeToChannel("undici:request:trailers", this.onDone.bind(this));
62643
+ this.subscribeToChannel("undici:request:error", this.onError.bind(this));
62644
+ }
62645
+ _updateMetricInstruments() {
62646
+ this._httpClientDurationHistogram = this.meter.createHistogram("http.client.request.duration", {
62647
+ description: "Measures the duration of outbound HTTP requests.",
62648
+ unit: "s",
62649
+ valueType: api_1.ValueType.DOUBLE,
62650
+ advice: {
62651
+ explicitBucketBoundaries: [
62652
+ 5e-3,
62653
+ 0.01,
62654
+ 0.025,
62655
+ 0.05,
62656
+ 0.075,
62657
+ 0.1,
62658
+ 0.25,
62659
+ 0.5,
62660
+ 0.75,
62661
+ 1,
62662
+ 2.5,
62663
+ 5,
62664
+ 7.5,
62665
+ 10
62666
+ ]
62667
+ }
62668
+ });
62669
+ }
62670
+ subscribeToChannel(diagnosticChannel, onMessage) {
62671
+ const [major, minor] = process.version.replace("v", "").split(".").map((n) => Number(n));
62672
+ const useNewSubscribe = major > 18 || major === 18 && minor >= 19;
62673
+ let unsubscribe;
62674
+ if (useNewSubscribe) {
62675
+ diagch.subscribe?.(diagnosticChannel, onMessage);
62676
+ unsubscribe = /* @__PURE__ */ __name(() => diagch.unsubscribe?.(diagnosticChannel, onMessage), "unsubscribe");
62677
+ } else {
62678
+ const channel = diagch.channel(diagnosticChannel);
62679
+ channel.subscribe(onMessage);
62680
+ unsubscribe = /* @__PURE__ */ __name(() => channel.unsubscribe(onMessage), "unsubscribe");
62681
+ }
62682
+ this._channelSubs.push({
62683
+ name: diagnosticChannel,
62684
+ unsubscribe
62685
+ });
62686
+ }
62687
+ parseRequestHeaders(request4) {
62688
+ const result = /* @__PURE__ */ new Map();
62689
+ if (Array.isArray(request4.headers)) {
62690
+ for (let i = 0; i < request4.headers.length; i += 2) {
62691
+ const key = request4.headers[i];
62692
+ const value = request4.headers[i + 1];
62693
+ if (typeof key === "string") {
62694
+ result.set(key.toLowerCase(), value);
62695
+ }
62696
+ }
62697
+ } else if (typeof request4.headers === "string") {
62698
+ const headers = request4.headers.split("\r\n");
62699
+ for (const line of headers) {
62700
+ if (!line) {
62701
+ continue;
62702
+ }
62703
+ const colonIndex = line.indexOf(":");
62704
+ if (colonIndex === -1) {
62705
+ continue;
62706
+ }
62707
+ const key = line.substring(0, colonIndex).toLowerCase();
62708
+ const value = line.substring(colonIndex + 1).trim();
62709
+ const allValues = result.get(key);
62710
+ if (allValues && Array.isArray(allValues)) {
62711
+ allValues.push(value);
62712
+ } else if (allValues) {
62713
+ result.set(key, [allValues, value]);
62714
+ } else {
62715
+ result.set(key, value);
62716
+ }
62717
+ }
62718
+ }
62719
+ return result;
62720
+ }
62721
+ // This is the 1st message we receive for each request (fired after request creation). Here we will
62722
+ // create the span and populate some atttributes, then link the span to the request for further
62723
+ // span processing
62724
+ onRequestCreated({ request: request4 }) {
62725
+ const config = this.getConfig();
62726
+ const enabled = config.enabled !== false;
62727
+ const shouldIgnoreReq = (0, instrumentation_1.safeExecuteInTheMiddle)(() => !enabled || request4.method === "CONNECT" || config.ignoreRequestHook?.(request4), (e) => e && this._diag.error("caught ignoreRequestHook error: ", e), true);
62728
+ if (shouldIgnoreReq) {
62729
+ return;
62730
+ }
62731
+ const startTime = (0, core_1.hrTime)();
62732
+ let requestUrl;
62733
+ try {
62734
+ requestUrl = new url_1.URL(request4.path, request4.origin);
62735
+ } catch (err) {
62736
+ this._diag.warn("could not determine url.full:", err);
62737
+ return;
62738
+ }
62739
+ const urlScheme = requestUrl.protocol.replace(":", "");
62740
+ const requestMethod = this.getRequestMethod(request4.method);
62741
+ const attributes = {
62742
+ [SemanticAttributes_1.SemanticAttributes.HTTP_REQUEST_METHOD]: requestMethod,
62743
+ [SemanticAttributes_1.SemanticAttributes.HTTP_REQUEST_METHOD_ORIGINAL]: request4.method,
62744
+ [SemanticAttributes_1.SemanticAttributes.URL_FULL]: requestUrl.toString(),
62745
+ [SemanticAttributes_1.SemanticAttributes.URL_PATH]: requestUrl.pathname,
62746
+ [SemanticAttributes_1.SemanticAttributes.URL_QUERY]: requestUrl.search,
62747
+ [SemanticAttributes_1.SemanticAttributes.URL_SCHEME]: urlScheme
62748
+ };
62749
+ const schemePorts = { https: "443", http: "80" };
62750
+ const serverAddress = requestUrl.hostname;
62751
+ const serverPort = requestUrl.port || schemePorts[urlScheme];
62752
+ attributes[SemanticAttributes_1.SemanticAttributes.SERVER_ADDRESS] = serverAddress;
62753
+ if (serverPort && !isNaN(Number(serverPort))) {
62754
+ attributes[SemanticAttributes_1.SemanticAttributes.SERVER_PORT] = Number(serverPort);
62755
+ }
62756
+ const headersMap = this.parseRequestHeaders(request4);
62757
+ const userAgentValues = headersMap.get("user-agent");
62758
+ if (userAgentValues) {
62759
+ const userAgent = Array.isArray(userAgentValues) ? userAgentValues[userAgentValues.length - 1] : userAgentValues;
62760
+ attributes[SemanticAttributes_1.SemanticAttributes.USER_AGENT_ORIGINAL] = userAgent;
62761
+ }
62762
+ const hookAttributes = (0, instrumentation_1.safeExecuteInTheMiddle)(() => config.startSpanHook?.(request4), (e) => e && this._diag.error("caught startSpanHook error: ", e), true);
62763
+ if (hookAttributes) {
62764
+ Object.entries(hookAttributes).forEach(([key, val]) => {
62765
+ attributes[key] = val;
62766
+ });
62767
+ }
62768
+ const activeCtx = api_1.context.active();
62769
+ const currentSpan = api_1.trace.getSpan(activeCtx);
62770
+ let span;
62771
+ if (config.requireParentforSpans && (!currentSpan || !api_1.trace.isSpanContextValid(currentSpan.spanContext()))) {
62772
+ span = api_1.trace.wrapSpanContext(api_1.INVALID_SPAN_CONTEXT);
62773
+ } else {
62774
+ span = this.tracer.startSpan(requestMethod === "_OTHER" ? "HTTP" : requestMethod, {
62775
+ kind: api_1.SpanKind.CLIENT,
62776
+ attributes
62777
+ }, activeCtx);
62778
+ }
62779
+ (0, instrumentation_1.safeExecuteInTheMiddle)(() => config.requestHook?.(span, request4), (e) => e && this._diag.error("caught requestHook error: ", e), true);
62780
+ const requestContext = api_1.trace.setSpan(api_1.context.active(), span);
62781
+ const addedHeaders = {};
62782
+ api_1.propagation.inject(requestContext, addedHeaders);
62783
+ const headerEntries = Object.entries(addedHeaders);
62784
+ for (let i = 0; i < headerEntries.length; i++) {
62785
+ const [k, v] = headerEntries[i];
62786
+ if (typeof request4.addHeader === "function") {
62787
+ request4.addHeader(k, v);
62788
+ } else if (typeof request4.headers === "string") {
62789
+ request4.headers += `${k}: ${v}\r
62790
+ `;
62791
+ } else if (Array.isArray(request4.headers)) {
62792
+ request4.headers.push(k, v);
62793
+ }
62794
+ }
62795
+ this._recordFromReq.set(request4, { span, attributes, startTime });
62796
+ }
62797
+ // This is the 2nd message we receive for each request. It is fired when connection with
62798
+ // the remote is established and about to send the first byte. Here we do have info about the
62799
+ // remote address and port so we can populate some `network.*` attributes into the span
62800
+ onRequestHeaders({ request: request4, socket }) {
62801
+ const record = this._recordFromReq.get(request4);
62802
+ if (!record) {
62803
+ return;
62804
+ }
62805
+ const config = this.getConfig();
62806
+ const { span } = record;
62807
+ const { remoteAddress, remotePort } = socket;
62808
+ const spanAttributes = {
62809
+ [SemanticAttributes_1.SemanticAttributes.NETWORK_PEER_ADDRESS]: remoteAddress,
62810
+ [SemanticAttributes_1.SemanticAttributes.NETWORK_PEER_PORT]: remotePort
62811
+ };
62812
+ if (config.headersToSpanAttributes?.requestHeaders) {
62813
+ const headersToAttribs = new Set(config.headersToSpanAttributes.requestHeaders.map((n) => n.toLowerCase()));
62814
+ const headersMap = this.parseRequestHeaders(request4);
62815
+ for (const [name, value] of headersMap.entries()) {
62816
+ if (headersToAttribs.has(name)) {
62817
+ const attrValue = Array.isArray(value) ? value.join(", ") : value;
62818
+ spanAttributes[`http.request.header.${name}`] = attrValue;
62819
+ }
62820
+ }
62821
+ }
62822
+ span.setAttributes(spanAttributes);
62823
+ }
62824
+ // This is the 3rd message we get for each request and it's fired when the server
62825
+ // headers are received, body may not be accessible yet.
62826
+ // From the response headers we can set the status and content length
62827
+ onResponseHeaders({ request: request4, response }) {
62828
+ const record = this._recordFromReq.get(request4);
62829
+ if (!record) {
62830
+ return;
62831
+ }
62832
+ const { span, attributes } = record;
62833
+ const spanAttributes = {
62834
+ [SemanticAttributes_1.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE]: response.statusCode
62835
+ };
62836
+ const config = this.getConfig();
62837
+ (0, instrumentation_1.safeExecuteInTheMiddle)(() => config.responseHook?.(span, { request: request4, response }), (e) => e && this._diag.error("caught responseHook error: ", e), true);
62838
+ const headersToAttribs = /* @__PURE__ */ new Set();
62839
+ if (config.headersToSpanAttributes?.responseHeaders) {
62840
+ config.headersToSpanAttributes?.responseHeaders.forEach((name) => headersToAttribs.add(name.toLowerCase()));
62841
+ }
62842
+ for (let idx = 0; idx < response.headers.length; idx = idx + 2) {
62843
+ const name = response.headers[idx].toString().toLowerCase();
62844
+ const value = response.headers[idx + 1];
62845
+ if (headersToAttribs.has(name)) {
62846
+ spanAttributes[`http.response.header.${name}`] = value.toString();
62847
+ }
62848
+ if (name === "content-length") {
62849
+ const contentLength = Number(value.toString());
62850
+ if (!isNaN(contentLength)) {
62851
+ spanAttributes["http.response.header.content-length"] = contentLength;
62852
+ }
62853
+ }
62854
+ }
62855
+ span.setAttributes(spanAttributes);
62856
+ span.setStatus({
62857
+ code: response.statusCode >= 400 ? api_1.SpanStatusCode.ERROR : api_1.SpanStatusCode.UNSET
62858
+ });
62859
+ record.attributes = Object.assign(attributes, spanAttributes);
62860
+ }
62861
+ // This is the last event we receive if the request went without any errors
62862
+ onDone({ request: request4 }) {
62863
+ const record = this._recordFromReq.get(request4);
62864
+ if (!record) {
62865
+ return;
62866
+ }
62867
+ const { span, attributes, startTime } = record;
62868
+ span.end();
62869
+ this._recordFromReq.delete(request4);
62870
+ this.recordRequestDuration(attributes, startTime);
62871
+ }
62872
+ // This is the event we get when something is wrong in the request like
62873
+ // - invalid options when calling `fetch` global API or any undici method for request
62874
+ // - connectivity errors such as unreachable host
62875
+ // - requests aborted through an `AbortController.signal`
62876
+ // NOTE: server errors are considered valid responses and it's the lib consumer
62877
+ // who should deal with that.
62878
+ onError({ request: request4, error }) {
62879
+ const record = this._recordFromReq.get(request4);
62880
+ if (!record) {
62881
+ return;
62882
+ }
62883
+ const { span, attributes, startTime } = record;
62884
+ span.recordException(error);
62885
+ span.setStatus({
62886
+ code: api_1.SpanStatusCode.ERROR,
62887
+ message: error.message
62888
+ });
62889
+ span.end();
62890
+ this._recordFromReq.delete(request4);
62891
+ attributes[SemanticAttributes_1.SemanticAttributes.ERROR_TYPE] = error.message;
62892
+ this.recordRequestDuration(attributes, startTime);
62893
+ }
62894
+ recordRequestDuration(attributes, startTime) {
62895
+ const metricsAttributes = {};
62896
+ const keysToCopy = [
62897
+ SemanticAttributes_1.SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
62898
+ SemanticAttributes_1.SemanticAttributes.HTTP_REQUEST_METHOD,
62899
+ SemanticAttributes_1.SemanticAttributes.SERVER_ADDRESS,
62900
+ SemanticAttributes_1.SemanticAttributes.SERVER_PORT,
62901
+ SemanticAttributes_1.SemanticAttributes.URL_SCHEME,
62902
+ SemanticAttributes_1.SemanticAttributes.ERROR_TYPE
62903
+ ];
62904
+ keysToCopy.forEach((key) => {
62905
+ if (key in attributes) {
62906
+ metricsAttributes[key] = attributes[key];
62907
+ }
62908
+ });
62909
+ const durationSeconds = (0, core_1.hrTimeToMilliseconds)((0, core_1.hrTimeDuration)(startTime, (0, core_1.hrTime)())) / 1e3;
62910
+ this._httpClientDurationHistogram.record(durationSeconds, metricsAttributes);
62911
+ }
62912
+ getRequestMethod(original) {
62913
+ const knownMethods = {
62914
+ CONNECT: true,
62915
+ OPTIONS: true,
62916
+ HEAD: true,
62917
+ GET: true,
62918
+ POST: true,
62919
+ PUT: true,
62920
+ PATCH: true,
62921
+ DELETE: true,
62922
+ TRACE: true
62923
+ };
62924
+ if (original.toUpperCase() in knownMethods) {
62925
+ return original.toUpperCase();
62926
+ }
62927
+ return "_OTHER";
62928
+ }
62929
+ };
62930
+ exports2.UndiciInstrumentation = UndiciInstrumentation2;
62931
+ }
62932
+ });
62933
+
62934
+ // node_modules/@opentelemetry/instrumentation-undici/build/src/index.js
62935
+ var require_src31 = __commonJS({
62936
+ "node_modules/@opentelemetry/instrumentation-undici/build/src/index.js"(exports2) {
62937
+ "use strict";
62938
+ init_esbuild_shims();
62939
+ Object.defineProperty(exports2, "__esModule", { value: true });
62940
+ exports2.UndiciInstrumentation = void 0;
62941
+ var undici_1 = require_undici();
62942
+ Object.defineProperty(exports2, "UndiciInstrumentation", { enumerable: true, get: /* @__PURE__ */ __name(function() {
62943
+ return undici_1.UndiciInstrumentation;
62944
+ }, "get") });
62945
+ }
62946
+ });
62947
+
62448
62948
  // packages/core/src/tools/read-file.ts
62449
62949
  init_esbuild_shims();
62450
62950
  import os4 from "node:os";
@@ -62954,6 +63454,7 @@ import path from "node:path";
62954
63454
  init_esbuild_shims();
62955
63455
  var DEFAULT_CONTEXT_FILENAME = "QWEN.md";
62956
63456
  var AGENT_CONTEXT_FILENAME = "AGENTS.md";
63457
+ var LOCAL_CONTEXT_FILENAME = "QWEN.local.md";
62957
63458
  var MEMORY_SECTION_HEADER = "## Qwen Added Memories";
62958
63459
  var currentGeminiMdFilename = [
62959
63460
  DEFAULT_CONTEXT_FILENAME,
@@ -65349,16 +65850,20 @@ __name(isInternalPromptId, "isInternalPromptId");
65349
65850
  // packages/core/src/utils/safeJsonStringify.ts
65350
65851
  init_esbuild_shims();
65351
65852
  function safeJsonStringify(obj, space) {
65352
- const seen = /* @__PURE__ */ new WeakSet();
65853
+ const ancestors = [];
65353
65854
  return JSON.stringify(
65354
65855
  obj,
65355
- (key, value) => {
65356
- if (typeof value === "object" && value !== null) {
65357
- if (seen.has(value)) {
65358
- return "[Circular]";
65359
- }
65360
- seen.add(value);
65856
+ function(_key, value) {
65857
+ if (typeof value !== "object" || value === null) {
65858
+ return value;
65859
+ }
65860
+ while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
65861
+ ancestors.pop();
65862
+ }
65863
+ if (ancestors.includes(value)) {
65864
+ return "[Circular]";
65361
65865
  }
65866
+ ancestors.push(value);
65362
65867
  return value;
65363
65868
  },
65364
65869
  space
@@ -68318,6 +68823,7 @@ var import_sdk_trace_node = __toESM(require_src20(), 1);
68318
68823
  var import_sdk_logs = __toESM(require_src17(), 1);
68319
68824
  var import_sdk_metrics2 = __toESM(require_src9(), 1);
68320
68825
  var import_instrumentation_http = __toESM(require_src30(), 1);
68826
+ var import_instrumentation_undici = __toESM(require_src31(), 1);
68321
68827
 
68322
68828
  // packages/core/src/telemetry/file-exporters.ts
68323
68829
  init_esbuild_shims();
@@ -69000,10 +69506,12 @@ function startInteractionSpan(config, options) {
69000
69506
  "qwen-code.approval_mode": config.getApprovalMode(),
69001
69507
  "interaction.sequence": interactionSequence
69002
69508
  };
69003
- const span = getTracer().startSpan(SPAN_INTERACTION, {
69004
- kind: SpanKind.INTERNAL,
69005
- attributes
69006
- });
69509
+ const sessionCtx = getSessionContext() ?? context.active();
69510
+ const span = getTracer().startSpan(
69511
+ SPAN_INTERACTION,
69512
+ { kind: SpanKind.INTERNAL, attributes },
69513
+ sessionCtx
69514
+ );
69007
69515
  const spanId = getSpanId(span);
69008
69516
  const spanContextObj = {
69009
69517
  span,
@@ -69467,6 +69975,16 @@ function resolveHttpOtlpUrl(baseEndpoint, signal) {
69467
69975
  }
69468
69976
  __name(resolveHttpOtlpUrl, "resolveHttpOtlpUrl");
69469
69977
  var SHUTDOWN_TIMEOUT_MS = 1e4;
69978
+ var NOOP_PROPAGATOR = {
69979
+ inject() {
69980
+ },
69981
+ extract(context2) {
69982
+ return context2;
69983
+ },
69984
+ fields() {
69985
+ return [];
69986
+ }
69987
+ };
69470
69988
  var sdk;
69471
69989
  var telemetryInitialized = false;
69472
69990
  var telemetryShutdownPromise;
@@ -69619,16 +70137,98 @@ function initializeTelemetry(config) {
69619
70137
  exportIntervalMillis: 1e4
69620
70138
  });
69621
70139
  }
70140
+ function normalizeOtlpPrefix(raw) {
70141
+ if (!raw) return void 0;
70142
+ const s = raw.trim().replace(/^["']|["']$/g, "");
70143
+ try {
70144
+ const u = new URL(s);
70145
+ const pathname = u.pathname === "/" ? "" : u.pathname.replace(/\/$/, "");
70146
+ return { origin: u.origin, pathname };
70147
+ } catch {
70148
+ diag.warn(
70149
+ `Telemetry OTLP endpoint "${raw}" is not a valid URL; instrumentation feedback-loop guard for it is disabled.`
70150
+ );
70151
+ return void 0;
70152
+ }
70153
+ }
70154
+ __name(normalizeOtlpPrefix, "normalizeOtlpPrefix");
70155
+ const otlpUrlPrefixes = [
70156
+ config.getTelemetryOtlpEndpoint(),
70157
+ config.getTelemetryOtlpTracesEndpoint(),
70158
+ config.getTelemetryOtlpLogsEndpoint(),
70159
+ config.getTelemetryOtlpMetricsEndpoint()
70160
+ ].map(normalizeOtlpPrefix).filter((u) => !!u);
70161
+ const matchesOtlpPrefix = /* @__PURE__ */ __name((origin, path8) => {
70162
+ for (const prefix of otlpUrlPrefixes) {
70163
+ if (origin !== prefix.origin) continue;
70164
+ if (prefix.pathname === "") return true;
70165
+ if (!path8.startsWith(prefix.pathname)) continue;
70166
+ const next = path8.charAt(prefix.pathname.length);
70167
+ if (next === "" || next === "/" || next === "?" || next === "#") {
70168
+ return true;
70169
+ }
70170
+ }
70171
+ return false;
70172
+ }, "matchesOtlpPrefix");
70173
+ const stripPathSuffix = /* @__PURE__ */ __name((path8) => {
70174
+ const qIdx = path8.indexOf("?");
70175
+ const fIdx = path8.indexOf("#");
70176
+ let cut = path8.length;
70177
+ if (qIdx !== -1) cut = Math.min(cut, qIdx);
70178
+ if (fIdx !== -1) cut = Math.min(cut, fIdx);
70179
+ return path8.slice(0, cut);
70180
+ }, "stripPathSuffix");
70181
+ const textMapPropagator = config.getOutboundCorrelationPropagateTraceContext() ? void 0 : NOOP_PROPAGATOR;
69622
70182
  sdk = new import_sdk_node.NodeSDK({
69623
70183
  resource,
69624
70184
  // Disable async host/process/env resource detectors: they leave attributes
69625
70185
  // pending and trigger an OTel diag.error on any resource attribute read
69626
70186
  // before the detectors settle (e.g. during HttpInstrumentation span creation).
69627
70187
  autoDetectResources: false,
70188
+ ...textMapPropagator && { textMapPropagator },
69628
70189
  spanProcessors: spanExporter ? [new import_sdk_trace_node.BatchSpanProcessor(spanExporter)] : [],
69629
70190
  logRecordProcessors: logExporter ? [new import_sdk_logs.BatchLogRecordProcessor(logExporter)] : logToSpanProcessor ? [logToSpanProcessor] : [],
69630
70191
  ...metricReader && { metricReader },
69631
- instrumentations: [new import_instrumentation_http.HttpInstrumentation()]
70192
+ instrumentations: [
70193
+ new import_instrumentation_http.HttpInstrumentation({
70194
+ // OTLP HTTP exporter uses node:http (patched here, not by undici).
70195
+ // Without this, every OTLP upload batch creates a parasitic client
70196
+ // span that itself gets exported → feedback loop. See PR #4390
70197
+ // review feedback (wenshao).
70198
+ ignoreOutgoingRequestHook: /* @__PURE__ */ __name((req) => {
70199
+ if (otlpUrlPrefixes.length === 0) return false;
70200
+ const proto = req.protocol ? String(req.protocol).replace(/:$/, "") : void 0;
70201
+ if (!proto) return false;
70202
+ let host = req.hostname || "";
70203
+ if (!host && req.host) {
70204
+ const h = String(req.host);
70205
+ const bracketEnd = h.indexOf("]");
70206
+ const portIdx = bracketEnd !== -1 ? h.indexOf(":", bracketEnd) : h.indexOf(":");
70207
+ host = portIdx !== -1 ? h.slice(0, portIdx) : h;
70208
+ }
70209
+ const portPart = req.port !== void 0 && req.port !== null && String(req.port) ? `:${req.port}` : "";
70210
+ let origin;
70211
+ try {
70212
+ origin = new URL(`${proto}://${host}${portPart}`).origin;
70213
+ } catch {
70214
+ return false;
70215
+ }
70216
+ const path8 = typeof req.path === "string" ? stripPathSuffix(req.path) : "";
70217
+ return matchesOtlpPrefix(origin, path8);
70218
+ }, "ignoreOutgoingRequestHook")
70219
+ }),
70220
+ // Modern fetch (`globalThis.fetch` / undici) is the HTTP layer used by
70221
+ // `openai`, `@google/genai`, and `@anthropic-ai/sdk`. Without this
70222
+ // instrumentation, outbound LLM requests carry no `traceparent` header
70223
+ // and the trace tree terminates at the qwen-code process boundary.
70224
+ new import_instrumentation_undici.UndiciInstrumentation({
70225
+ ignoreRequestHook: /* @__PURE__ */ __name((request4) => {
70226
+ if (otlpUrlPrefixes.length === 0) return false;
70227
+ const path8 = typeof request4.path === "string" ? stripPathSuffix(request4.path) : "";
70228
+ return matchesOtlpPrefix(request4.origin, path8);
70229
+ }, "ignoreRequestHook")
70230
+ })
70231
+ ]
69632
70232
  });
69633
70233
  try {
69634
70234
  sdk.start();
@@ -71430,12 +72030,48 @@ var ModelsConfig = class _ModelsConfig {
71430
72030
  await this.switchModel(this.currentAuthType, newModel);
71431
72031
  return;
71432
72032
  }
71433
- this.strictModelProviderSelection = false;
71434
- this._generationConfig.model = newModel;
71435
- this.generationConfigSources["model"] = {
71436
- kind: "programmatic",
71437
- detail: metadata?.reason || "setModel"
71438
- };
72033
+ const rollbackSnapshot = this.createStateSnapshotForRollback();
72034
+ try {
72035
+ this.strictModelProviderSelection = false;
72036
+ this._generationConfig.model = newModel;
72037
+ this.generationConfigSources["model"] = {
72038
+ kind: "programmatic",
72039
+ detail: metadata?.reason || "setModel"
72040
+ };
72041
+ this.applyRawModelDerivedDefaults(newModel);
72042
+ if (this.onModelChange && this.currentAuthType) {
72043
+ await this.onModelChange(this.currentAuthType, true);
72044
+ }
72045
+ } catch (error) {
72046
+ this.rollbackToStateSnapshot(rollbackSnapshot);
72047
+ throw error;
72048
+ }
72049
+ }
72050
+ /**
72051
+ * Raw model switches keep the current credentials, but model-derived
72052
+ * generation defaults must follow the new model. Otherwise a switch from a
72053
+ * multimodal registry model to a text-only raw model can keep stale image
72054
+ * support and send unsupported inline media.
72055
+ */
72056
+ applyRawModelDerivedDefaults(modelId) {
72057
+ if (this.shouldUpdateModelDerivedDefault("modalities")) {
72058
+ this._generationConfig.modalities = defaultModalities(modelId);
72059
+ this.generationConfigSources["modalities"] = {
72060
+ kind: "computed",
72061
+ detail: "auto-detected from model"
72062
+ };
72063
+ }
72064
+ if (this.shouldUpdateModelDerivedDefault("contextWindowSize")) {
72065
+ this._generationConfig.contextWindowSize = tokenLimit(modelId, "input");
72066
+ this.generationConfigSources["contextWindowSize"] = {
72067
+ kind: "computed",
72068
+ detail: "auto-detected from model"
72069
+ };
72070
+ }
72071
+ }
72072
+ shouldUpdateModelDerivedDefault(field) {
72073
+ const source = this.generationConfigSources[field];
72074
+ return source === void 0 || source.kind === "computed" || source.kind === "default" || source.kind === "modelProviders" || source.kind === "programmatic" || source.kind === "unknown";
71439
72075
  }
71440
72076
  /**
71441
72077
  * Switch model (and optionally authType).
@@ -72210,11 +72846,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
72210
72846
  }
72211
72847
  let baseGenerator;
72212
72848
  if (authType === "openai" /* USE_OPENAI */) {
72213
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-BSAWHGQJ.js");
72849
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-JH4YNZ3H.js");
72214
72850
  baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
72215
72851
  } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
72216
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-EEJGROP7.js");
72217
- const { QwenContentGenerator } = await import("./qwenContentGenerator-47XRHQXM.js");
72852
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-BAN2EGSH.js");
72853
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-5FE4UYUT.js");
72218
72854
  try {
72219
72855
  const qwenClient = await getQwenOauthClient(
72220
72856
  config,
@@ -72231,10 +72867,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
72231
72867
  );
72232
72868
  }
72233
72869
  } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
72234
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-RQJNXJIY.js");
72870
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-LYI3OHBB.js");
72235
72871
  baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
72236
72872
  } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
72237
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-E7Y6TCPU.js");
72873
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-LM65ADWM.js");
72238
72874
  baseGenerator = createGeminiContentGenerator(generatorConfig, config);
72239
72875
  } else {
72240
72876
  throw new Error(
@@ -74265,6 +74901,7 @@ export {
74265
74901
  isUtf8CompatibleEncoding,
74266
74902
  DEFAULT_CONTEXT_FILENAME,
74267
74903
  AGENT_CONTEXT_FILENAME,
74904
+ LOCAL_CONTEXT_FILENAME,
74268
74905
  MEMORY_SECTION_HEADER,
74269
74906
  setGeminiMdFilename,
74270
74907
  getCurrentGeminiMdFilename,