anycodex 0.0.23 → 0.0.25

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.
@@ -1,43 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- LSP,
4
3
  MessageV2,
5
4
  ModelID,
6
5
  ProviderID,
7
6
  Todo,
8
7
  iife
9
- } from "./chunk-6SEC53MI.js";
8
+ } from "./chunk-4SPBQLA5.js";
9
+ import {
10
+ Identifier,
11
+ MessageID,
12
+ PartID
13
+ } from "./chunk-6Q6QFZOB.js";
10
14
  import {
11
- Filesystem,
12
15
  Flag,
13
- Log,
14
16
  NamedError,
15
17
  basename,
18
+ consoleLogger,
16
19
  dirname,
17
20
  extname,
18
21
  isAbsolute,
19
22
  join,
20
23
  relative,
21
24
  resolve
22
- } from "./chunk-RKQHI4QK.js";
23
- import {
24
- Glob
25
- } from "./chunk-H3TAXRCT.js";
26
- import {
27
- Identifier,
28
- MessageID,
29
- PartID
30
- } from "./chunk-LD436475.js";
25
+ } from "./chunk-NRFXEZ7N.js";
31
26
  import {
32
27
  Schema_exports,
28
+ __callDispose,
29
+ __using,
33
30
  external_exports,
34
31
  withStatics,
35
32
  zod_default
36
- } from "./chunk-3KUWIT4H.js";
37
- import {
38
- __callDispose,
39
- __using
40
- } from "./chunk-XXVDY7BO.js";
33
+ } from "./chunk-M6C7CWX3.js";
41
34
  import {
42
35
  __commonJS
43
36
  } from "./chunk-77HVPD4G.js";
@@ -4960,21 +4953,21 @@ var require_NodeIterator = __commonJS({
4960
4953
  var require_URL = __commonJS({
4961
4954
  "../../node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/URL.js"(exports, module) {
4962
4955
  "use strict";
4963
- module.exports = URL2;
4964
- function URL2(url) {
4965
- if (!url) return Object.create(URL2.prototype);
4956
+ module.exports = URL;
4957
+ function URL(url) {
4958
+ if (!url) return Object.create(URL.prototype);
4966
4959
  this.url = url.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, "");
4967
- var match = URL2.pattern.exec(this.url);
4960
+ var match = URL.pattern.exec(this.url);
4968
4961
  if (match) {
4969
4962
  if (match[2]) this.scheme = match[2];
4970
4963
  if (match[4]) {
4971
- var userinfo = match[4].match(URL2.userinfoPattern);
4964
+ var userinfo = match[4].match(URL.userinfoPattern);
4972
4965
  if (userinfo) {
4973
4966
  this.username = userinfo[1];
4974
4967
  this.password = userinfo[3];
4975
4968
  match[4] = match[4].substring(userinfo[0].length);
4976
4969
  }
4977
- if (match[4].match(URL2.portPattern)) {
4970
+ if (match[4].match(URL.portPattern)) {
4978
4971
  var pos = match[4].lastIndexOf(":");
4979
4972
  this.host = match[4].substring(0, pos);
4980
4973
  this.port = match[4].substring(pos + 1);
@@ -4987,27 +4980,27 @@ var require_URL = __commonJS({
4987
4980
  if (match[8]) this.fragment = match[9];
4988
4981
  }
4989
4982
  }
4990
- URL2.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;
4991
- URL2.userinfoPattern = /^([^@:]*)(:([^@]*))?@/;
4992
- URL2.portPattern = /:\d+$/;
4993
- URL2.authorityPattern = /^[^:\/?#]+:\/\//;
4994
- URL2.hierarchyPattern = /^[^:\/?#]+:\//;
4995
- URL2.percentEncode = function percentEncode(s) {
4983
+ URL.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;
4984
+ URL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/;
4985
+ URL.portPattern = /:\d+$/;
4986
+ URL.authorityPattern = /^[^:\/?#]+:\/\//;
4987
+ URL.hierarchyPattern = /^[^:\/?#]+:\//;
4988
+ URL.percentEncode = function percentEncode(s) {
4996
4989
  var c = s.charCodeAt(0);
4997
4990
  if (c < 256) return "%" + c.toString(16);
4998
4991
  else throw Error("can't percent-encode codepoints > 255 yet");
4999
4992
  };
5000
- URL2.prototype = {
5001
- constructor: URL2,
4993
+ URL.prototype = {
4994
+ constructor: URL,
5002
4995
  // XXX: not sure if this is the precise definition of absolute
5003
4996
  isAbsolute: function() {
5004
4997
  return !!this.scheme;
5005
4998
  },
5006
4999
  isAuthorityBased: function() {
5007
- return URL2.authorityPattern.test(this.url);
5000
+ return URL.authorityPattern.test(this.url);
5008
5001
  },
5009
5002
  isHierarchical: function() {
5010
- return URL2.hierarchyPattern.test(this.url);
5003
+ return URL.hierarchyPattern.test(this.url);
5011
5004
  },
5012
5005
  toString: function() {
5013
5006
  var s = "";
@@ -5035,8 +5028,8 @@ var require_URL = __commonJS({
5035
5028
  // and https://url.spec.whatwg.org/#constructors
5036
5029
  resolve: function(relative2) {
5037
5030
  var base = this;
5038
- var r = new URL2(relative2);
5039
- var t = new URL2();
5031
+ var r = new URL(relative2);
5032
+ var t = new URL();
5040
5033
  if (r.scheme !== void 0) {
5041
5034
  t.scheme = r.scheme;
5042
5035
  t.username = r.username;
@@ -5408,13 +5401,13 @@ var require_CSSStyleDeclaration = __commonJS({
5408
5401
  var require_URLUtils = __commonJS({
5409
5402
  "../../node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/URLUtils.js"(exports, module) {
5410
5403
  "use strict";
5411
- var URL2 = require_URL();
5404
+ var URL = require_URL();
5412
5405
  module.exports = URLUtils;
5413
5406
  function URLUtils() {
5414
5407
  }
5415
5408
  URLUtils.prototype = Object.create(Object.prototype, {
5416
5409
  _url: { get: function() {
5417
- return new URL2(this.href);
5410
+ return new URL(this.href);
5418
5411
  } },
5419
5412
  protocol: {
5420
5413
  get: function() {
@@ -5424,10 +5417,10 @@ var require_URLUtils = __commonJS({
5424
5417
  },
5425
5418
  set: function(v) {
5426
5419
  var output = this.href;
5427
- var url = new URL2(output);
5420
+ var url = new URL(output);
5428
5421
  if (url.isAbsolute()) {
5429
5422
  v = v.replace(/:+$/, "");
5430
- v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL2.percentEncode);
5423
+ v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL.percentEncode);
5431
5424
  if (v.length > 0) {
5432
5425
  url.scheme = v;
5433
5426
  output = url.toString();
@@ -5446,9 +5439,9 @@ var require_URLUtils = __commonJS({
5446
5439
  },
5447
5440
  set: function(v) {
5448
5441
  var output = this.href;
5449
- var url = new URL2(output);
5442
+ var url = new URL(output);
5450
5443
  if (url.isAbsolute() && url.isAuthorityBased()) {
5451
- v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL2.percentEncode);
5444
+ v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);
5452
5445
  if (v.length > 0) {
5453
5446
  url.host = v;
5454
5447
  delete url.port;
@@ -5468,10 +5461,10 @@ var require_URLUtils = __commonJS({
5468
5461
  },
5469
5462
  set: function(v) {
5470
5463
  var output = this.href;
5471
- var url = new URL2(output);
5464
+ var url = new URL(output);
5472
5465
  if (url.isAbsolute() && url.isAuthorityBased()) {
5473
5466
  v = v.replace(/^\/+/, "");
5474
- v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL2.percentEncode);
5467
+ v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);
5475
5468
  if (v.length > 0) {
5476
5469
  url.host = v;
5477
5470
  output = url.toString();
@@ -5490,7 +5483,7 @@ var require_URLUtils = __commonJS({
5490
5483
  },
5491
5484
  set: function(v) {
5492
5485
  var output = this.href;
5493
- var url = new URL2(output);
5486
+ var url = new URL(output);
5494
5487
  if (url.isAbsolute() && url.isAuthorityBased()) {
5495
5488
  v = "" + v;
5496
5489
  v = v.replace(/[^0-9].*$/, "");
@@ -5514,11 +5507,11 @@ var require_URLUtils = __commonJS({
5514
5507
  },
5515
5508
  set: function(v) {
5516
5509
  var output = this.href;
5517
- var url = new URL2(output);
5510
+ var url = new URL(output);
5518
5511
  if (url.isAbsolute() && url.isHierarchical()) {
5519
5512
  if (v.charAt(0) !== "/")
5520
5513
  v = "/" + v;
5521
- v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL2.percentEncode);
5514
+ v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL.percentEncode);
5522
5515
  url.path = v;
5523
5516
  output = url.toString();
5524
5517
  }
@@ -5535,10 +5528,10 @@ var require_URLUtils = __commonJS({
5535
5528
  },
5536
5529
  set: function(v) {
5537
5530
  var output = this.href;
5538
- var url = new URL2(output);
5531
+ var url = new URL(output);
5539
5532
  if (url.isAbsolute() && url.isHierarchical()) {
5540
5533
  if (v.charAt(0) === "?") v = v.substring(1);
5541
- v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL2.percentEncode);
5534
+ v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode);
5542
5535
  url.query = v;
5543
5536
  output = url.toString();
5544
5537
  }
@@ -5556,9 +5549,9 @@ var require_URLUtils = __commonJS({
5556
5549
  },
5557
5550
  set: function(v) {
5558
5551
  var output = this.href;
5559
- var url = new URL2(output);
5552
+ var url = new URL(output);
5560
5553
  if (v.charAt(0) === "#") v = v.substring(1);
5561
- v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL2.percentEncode);
5554
+ v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode);
5562
5555
  url.fragment = v;
5563
5556
  output = url.toString();
5564
5557
  this.href = output;
@@ -5571,9 +5564,9 @@ var require_URLUtils = __commonJS({
5571
5564
  },
5572
5565
  set: function(v) {
5573
5566
  var output = this.href;
5574
- var url = new URL2(output);
5567
+ var url = new URL(output);
5575
5568
  if (url.isAbsolute()) {
5576
- v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL2.percentEncode);
5569
+ v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL.percentEncode);
5577
5570
  url.username = v;
5578
5571
  output = url.toString();
5579
5572
  }
@@ -5587,12 +5580,12 @@ var require_URLUtils = __commonJS({
5587
5580
  },
5588
5581
  set: function(v) {
5589
5582
  var output = this.href;
5590
- var url = new URL2(output);
5583
+ var url = new URL(output);
5591
5584
  if (url.isAbsolute()) {
5592
5585
  if (v === "") {
5593
5586
  url.password = null;
5594
5587
  } else {
5595
- v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL2.percentEncode);
5588
+ v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL.percentEncode);
5596
5589
  url.password = v;
5597
5590
  }
5598
5591
  output = url.toString();
@@ -5734,7 +5727,7 @@ var require_htmlelts = __commonJS({
5734
5727
  function define(spec) {
5735
5728
  return defineElement(spec, HTMLElement, htmlElements, htmlNameToImpl);
5736
5729
  }
5737
- function URL2(attr) {
5730
+ function URL(attr) {
5738
5731
  return {
5739
5732
  get: function() {
5740
5733
  var v = this._getattr(attr);
@@ -5977,7 +5970,7 @@ var require_htmlelts = __commonJS({
5977
5970
  } }
5978
5971
  },
5979
5972
  attributes: {
5980
- href: URL2,
5973
+ href: URL,
5981
5974
  ping: String,
5982
5975
  download: String,
5983
5976
  target: String,
@@ -6007,7 +6000,7 @@ var require_htmlelts = __commonJS({
6007
6000
  download: String,
6008
6001
  rel: String,
6009
6002
  media: String,
6010
- href: URL2,
6003
+ href: URL,
6011
6004
  hreflang: String,
6012
6005
  type: String,
6013
6006
  shape: String,
@@ -6099,7 +6092,7 @@ var require_htmlelts = __commonJS({
6099
6092
  autofocus: Boolean,
6100
6093
  type: { type: ["submit", "reset", "button", "menu"], missing: "submit" },
6101
6094
  formTarget: String,
6102
- formAction: URL2,
6095
+ formAction: URL,
6103
6096
  formNoValidate: Boolean,
6104
6097
  formMethod: { type: ["get", "post", "dialog"], invalid: "get", missing: "" },
6105
6098
  formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "" }
@@ -6161,7 +6154,7 @@ var require_htmlelts = __commonJS({
6161
6154
  HTMLElement.call(this, doc, localName, prefix);
6162
6155
  },
6163
6156
  attributes: {
6164
- src: URL2,
6157
+ src: URL,
6165
6158
  type: String,
6166
6159
  width: String,
6167
6160
  height: String,
@@ -6241,7 +6234,7 @@ var require_htmlelts = __commonJS({
6241
6234
  HTMLElement.call(this, doc, localName, prefix);
6242
6235
  },
6243
6236
  attributes: {
6244
- xmlns: URL2,
6237
+ xmlns: URL,
6245
6238
  // Obsolete
6246
6239
  version: String
6247
6240
  }
@@ -6253,7 +6246,7 @@ var require_htmlelts = __commonJS({
6253
6246
  HTMLElement.call(this, doc, localName, prefix);
6254
6247
  },
6255
6248
  attributes: {
6256
- src: URL2,
6249
+ src: URL,
6257
6250
  srcdoc: String,
6258
6251
  name: String,
6259
6252
  width: String,
@@ -6270,7 +6263,7 @@ var require_htmlelts = __commonJS({
6270
6263
  align: String,
6271
6264
  scrolling: String,
6272
6265
  frameBorder: String,
6273
- longDesc: URL2,
6266
+ longDesc: URL,
6274
6267
  marginHeight: { type: String, treatNullAsEmptyString: true },
6275
6268
  marginWidth: { type: String, treatNullAsEmptyString: true }
6276
6269
  }
@@ -6283,7 +6276,7 @@ var require_htmlelts = __commonJS({
6283
6276
  },
6284
6277
  attributes: {
6285
6278
  alt: String,
6286
- src: URL2,
6279
+ src: URL,
6287
6280
  srcset: String,
6288
6281
  crossOrigin: CORS,
6289
6282
  useMap: String,
@@ -6295,11 +6288,11 @@ var require_htmlelts = __commonJS({
6295
6288
  loading: { type: ["eager", "lazy"], missing: "" },
6296
6289
  // Obsolete:
6297
6290
  name: String,
6298
- lowsrc: URL2,
6291
+ lowsrc: URL,
6299
6292
  align: String,
6300
6293
  hspace: { type: "unsigned long", default: 0 },
6301
6294
  vspace: { type: "unsigned long", default: 0 },
6302
- longDesc: URL2,
6295
+ longDesc: URL,
6303
6296
  border: { type: String, treatNullAsEmptyString: true }
6304
6297
  }
6305
6298
  });
@@ -6341,7 +6334,7 @@ var require_htmlelts = __commonJS({
6341
6334
  readOnly: Boolean,
6342
6335
  checked: Boolean,
6343
6336
  value: String,
6344
- src: URL2,
6337
+ src: URL,
6345
6338
  defaultChecked: { name: "checked", type: Boolean },
6346
6339
  size: { type: "unsigned long", default: 20, min: 1, setmin: 1 },
6347
6340
  width: { type: "unsigned long", min: 0, setmin: 0, default: 0 },
@@ -6445,7 +6438,7 @@ var require_htmlelts = __commonJS({
6445
6438
  },
6446
6439
  attributes: {
6447
6440
  // XXX Reflect DOMSettableTokenList sizes also DOMTokenList relList
6448
- href: URL2,
6441
+ href: URL,
6449
6442
  rel: String,
6450
6443
  media: String,
6451
6444
  hreflang: String,
@@ -6516,7 +6509,7 @@ var require_htmlelts = __commonJS({
6516
6509
  HTMLElement.call(this, doc, localName, prefix);
6517
6510
  },
6518
6511
  attributes: {
6519
- cite: URL2,
6512
+ cite: URL,
6520
6513
  dateTime: String
6521
6514
  }
6522
6515
  });
@@ -6562,7 +6555,7 @@ var require_htmlelts = __commonJS({
6562
6555
  },
6563
6556
  props: formAssociatedProps,
6564
6557
  attributes: {
6565
- data: URL2,
6558
+ data: URL,
6566
6559
  type: String,
6567
6560
  name: String,
6568
6561
  useMap: String,
@@ -6577,7 +6570,7 @@ var require_htmlelts = __commonJS({
6577
6570
  hspace: { type: "unsigned long", default: 0 },
6578
6571
  standby: String,
6579
6572
  vspace: { type: "unsigned long", default: 0 },
6580
- codeBase: URL2,
6573
+ codeBase: URL,
6581
6574
  codeType: String,
6582
6575
  border: { type: String, treatNullAsEmptyString: true }
6583
6576
  }
@@ -6702,7 +6695,7 @@ var require_htmlelts = __commonJS({
6702
6695
  HTMLElement.call(this, doc, localName, prefix);
6703
6696
  },
6704
6697
  attributes: {
6705
- cite: URL2
6698
+ cite: URL
6706
6699
  }
6707
6700
  });
6708
6701
  define({
@@ -6731,7 +6724,7 @@ var require_htmlelts = __commonJS({
6731
6724
  }
6732
6725
  },
6733
6726
  attributes: {
6734
- src: URL2,
6727
+ src: URL,
6735
6728
  type: String,
6736
6729
  charset: String,
6737
6730
  referrerPolicy: REFERRER,
@@ -7004,7 +6997,7 @@ var require_htmlelts = __commonJS({
7004
6997
  HTMLElement.call(this, doc, localName, prefix);
7005
6998
  },
7006
6999
  attributes: {
7007
- src: URL2,
7000
+ src: URL,
7008
7001
  crossOrigin: CORS,
7009
7002
  preload: { type: ["metadata", "none", "auto", { value: "", alias: "auto" }], missing: "auto" },
7010
7003
  loop: Boolean,
@@ -7030,7 +7023,7 @@ var require_htmlelts = __commonJS({
7030
7023
  htmlElements.HTMLMediaElement.call(this, doc, localName, prefix);
7031
7024
  },
7032
7025
  attributes: {
7033
- poster: URL2,
7026
+ poster: URL,
7034
7027
  width: { type: "unsigned long", min: 0, default: 0 },
7035
7028
  height: { type: "unsigned long", min: 0, default: 0 }
7036
7029
  }
@@ -7134,7 +7127,7 @@ var require_htmlelts = __commonJS({
7134
7127
  },
7135
7128
  attributes: {
7136
7129
  type: { type: ["command", "checkbox", "radio"], missing: "command" },
7137
- icon: URL2,
7130
+ icon: URL,
7138
7131
  disabled: Boolean,
7139
7132
  checked: Boolean,
7140
7133
  radiogroup: String,
@@ -7151,7 +7144,7 @@ var require_htmlelts = __commonJS({
7151
7144
  srcset: String,
7152
7145
  sizes: String,
7153
7146
  media: String,
7154
- src: URL2,
7147
+ src: URL,
7155
7148
  type: String,
7156
7149
  width: String,
7157
7150
  height: String
@@ -7164,7 +7157,7 @@ var require_htmlelts = __commonJS({
7164
7157
  HTMLElement.call(this, doc, localName, prefix);
7165
7158
  },
7166
7159
  attributes: {
7167
- src: URL2,
7160
+ src: URL,
7168
7161
  srclang: String,
7169
7162
  label: String,
7170
7163
  default: Boolean,
@@ -7438,7 +7431,7 @@ var require_Document = __commonJS({
7438
7431
  var TreeWalker = require_TreeWalker();
7439
7432
  var NodeIterator = require_NodeIterator();
7440
7433
  var NodeFilter = require_NodeFilter();
7441
- var URL2 = require_URL();
7434
+ var URL = require_URL();
7442
7435
  var select = require_select();
7443
7436
  var events = require_events();
7444
7437
  var xml = require_xmlnames();
@@ -7733,7 +7726,7 @@ var require_Document = __commonJS({
7733
7726
  contentType: { get: function contentType() {
7734
7727
  return this._contentType;
7735
7728
  } },
7736
- URL: { get: function URL3() {
7729
+ URL: { get: function URL2() {
7737
7730
  return this._address;
7738
7731
  } },
7739
7732
  domain: { get: utils.nyi, set: utils.nyi },
@@ -7981,14 +7974,14 @@ var require_Document = __commonJS({
7981
7974
  }
7982
7975
  } },
7983
7976
  _resolve: { value: function(href) {
7984
- return new URL2(this._documentBaseURL).resolve(href);
7977
+ return new URL(this._documentBaseURL).resolve(href);
7985
7978
  } },
7986
7979
  _documentBaseURL: { get: function() {
7987
7980
  var url = this._address;
7988
7981
  if (url === "about:blank") url = "/";
7989
7982
  var base = this.querySelector("base[href]");
7990
7983
  if (base) {
7991
- return new URL2(url).resolve(base.getAttribute("href"));
7984
+ return new URL(url).resolve(base.getAttribute("href"));
7992
7985
  }
7993
7986
  return url;
7994
7987
  } },
@@ -16448,7 +16441,7 @@ var require_DOMImplementation = __commonJS({
16448
16441
  var require_Location = __commonJS({
16449
16442
  "../../node_modules/.pnpm/@mixmark-io+domino@2.2.0/node_modules/@mixmark-io/domino/lib/Location.js"(exports, module) {
16450
16443
  "use strict";
16451
- var URL2 = require_URL();
16444
+ var URL = require_URL();
16452
16445
  var URLUtils = require_URLUtils();
16453
16446
  module.exports = Location;
16454
16447
  function Location(window2, href) {
@@ -16467,7 +16460,7 @@ var require_Location = __commonJS({
16467
16460
  }
16468
16461
  },
16469
16462
  assign: { value: function(url) {
16470
- var current = new URL2(this._href);
16463
+ var current = new URL(this._href);
16471
16464
  var newurl = current.resolve(url);
16472
16465
  this._href = newurl;
16473
16466
  } },
@@ -17833,11 +17826,10 @@ function canConvert(input) {
17833
17826
  }
17834
17827
  var turndown_es_default = TurndownService;
17835
17828
 
17836
- // ../agent/dist/chunk-HFK2PJII.js
17829
+ // ../agent/dist/chunk-MD6BEIK2.js
17837
17830
  import { pathToFileURL as pathToFileURL2 } from "url";
17838
17831
  import { pathToFileURL } from "url";
17839
17832
  var SchedulerService = class {
17840
- log = Log.create({ service: "scheduler" });
17841
17833
  tasks = /* @__PURE__ */ new Map();
17842
17834
  timers = /* @__PURE__ */ new Map();
17843
17835
  register(task) {
@@ -17852,9 +17844,9 @@ var SchedulerService = class {
17852
17844
  this.timers.set(task.id, timer);
17853
17845
  }
17854
17846
  async run(task) {
17855
- this.log.info("run", { id: task.id });
17847
+ consoleLogger.info(`[scheduler] run ${task.id}`);
17856
17848
  await task.run().catch((error) => {
17857
- this.log.error("run failed", { id: task.id, error });
17849
+ consoleLogger.error(`[scheduler] run failed ${task.id}`, error);
17858
17850
  });
17859
17851
  }
17860
17852
  dispose() {
@@ -17917,15 +17909,15 @@ var Truncate;
17917
17909
  async function cleanup(context) {
17918
17910
  if (!context) return;
17919
17911
  const cutoff = Identifier.timestamp(Identifier.create("tool", false, Date.now() - RETENTION_MS));
17920
- const entries = await Glob.scan(context, "tool_*", { cwd: dir(context), include: "file" }).catch(() => []);
17912
+ const entries = await context.fs.glob("tool_*", { cwd: dir(context), nodir: true }).catch(() => []);
17921
17913
  for (const entry of entries) {
17922
17914
  if (Identifier.timestamp(entry) >= cutoff) continue;
17923
- await Filesystem.remove(context, join(dir(context), entry)).catch(() => {
17915
+ await context.fs.remove(join(dir(context), entry)).catch(() => {
17924
17916
  });
17925
17917
  }
17926
17918
  }
17927
17919
  Truncate2.cleanup = cleanup;
17928
- async function output(context, text, options = {}, agent) {
17920
+ async function output(context, text, options = {}) {
17929
17921
  const maxLines = options.maxLines ?? Truncate2.MAX_LINES;
17930
17922
  const maxBytes = options.maxBytes ?? Truncate2.MAX_BYTES;
17931
17923
  const direction = options.direction ?? "head";
@@ -17964,7 +17956,7 @@ var Truncate;
17964
17956
  const preview = out.join("\n");
17965
17957
  const id = ToolID.ascending();
17966
17958
  const filepath = join(dir(context), id);
17967
- await Filesystem.write(context, filepath, text);
17959
+ await context.fs.write(filepath, text);
17968
17960
  const hint = `The tool call succeeded but the output was truncated. Full output saved to: ${filepath}
17969
17961
  Use Grep to search the full content or Read with offset/limit to view specific sections.`;
17970
17962
  const message = direction === "head" ? `${preview}
@@ -18005,7 +17997,7 @@ Please rewrite the input so it satisfies the expected schema.`,
18005
17997
  if (result.metadata.truncated !== void 0) {
18006
17998
  return result;
18007
17999
  }
18008
- const truncated = await Truncate.output(ctx, result.output, {}, initCtx?.agent);
18000
+ const truncated = await Truncate.output(ctx, result.output, {});
18009
18001
  return {
18010
18002
  ...result,
18011
18003
  output: truncated.content,
@@ -18022,7 +18014,7 @@ Please rewrite the input so it satisfies the expected schema.`,
18022
18014
  }
18023
18015
  Tool2.define = define;
18024
18016
  })(Tool || (Tool = {}));
18025
- var plan_exit_txt_default = `Use this tool when you have completed the planning phase and are ready to exit plan agent.
18017
+ var EXIT_DESCRIPTION = `Use this tool when you have completed the planning phase and are ready to exit plan agent.
18026
18018
 
18027
18019
  This tool will ask the user if they want to switch to build agent to start implementing the plan.
18028
18020
 
@@ -18043,7 +18035,7 @@ async function getLastModel(context, sessionID) {
18043
18035
  return context.provider.defaultModel();
18044
18036
  }
18045
18037
  var PlanExitTool = Tool.define("plan_exit", {
18046
- description: plan_exit_txt_default,
18038
+ description: EXIT_DESCRIPTION,
18047
18039
  parameters: zod_default.object({}),
18048
18040
  async execute(_params, ctx) {
18049
18041
  const session = await ctx.session.get(ctx.sessionID);
@@ -18075,7 +18067,7 @@ var PlanExitTool = Tool.define("plan_exit", {
18075
18067
  };
18076
18068
  }
18077
18069
  });
18078
- var bash_txt_default = `Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
18070
+ var DESCRIPTION = `Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
18079
18071
 
18080
18072
  All commands run in \${directory} by default. Use the \`workdir\` parameter if you need to run a command in a different directory. AVOID using \`cd <directory> && <command>\` patterns - use \`workdir\` instead.
18081
18073
 
@@ -18193,7 +18185,6 @@ Important:
18193
18185
  `;
18194
18186
  var MAX_METADATA_LENGTH = 3e4;
18195
18187
  var DEFAULT_TIMEOUT = Flag.OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS || 2 * 60 * 1e3;
18196
- var log = Log.create({ service: "bash-tool" });
18197
18188
  function parseBashCommands(input) {
18198
18189
  const results = [];
18199
18190
  const segments = input.split(/\s*(?:&&|\|\||[;|\n])\s*/);
@@ -18245,7 +18236,7 @@ function tokenize2(input) {
18245
18236
  }
18246
18237
  var BashTool = Tool.define("bash", async (initCtx) => {
18247
18238
  return {
18248
- description: bash_txt_default.replaceAll("${directory}", initCtx?.directory || "").replaceAll("${maxLines}", String(Truncate.MAX_LINES)).replaceAll("${maxBytes}", String(Truncate.MAX_BYTES)),
18239
+ description: DESCRIPTION.replaceAll("${directory}", initCtx?.directory || "").replaceAll("${maxLines}", String(Truncate.MAX_LINES)).replaceAll("${maxBytes}", String(Truncate.MAX_BYTES)),
18249
18240
  parameters: zod_default.object({
18250
18241
  command: zod_default.string().describe("The command to execute"),
18251
18242
  timeout: zod_default.number().describe("Optional timeout in milliseconds").optional(),
@@ -18273,11 +18264,12 @@ var BashTool = Tool.define("bash", async (initCtx) => {
18273
18264
  if (["cd", "rm", "cp", "mv", "mkdir", "touch", "chmod", "chown", "cat"].includes(name)) {
18274
18265
  for (const arg of args) {
18275
18266
  if (arg.startsWith("-") || name === "chmod" && arg.startsWith("+")) continue;
18276
- const resolved = Filesystem.resolve(resolve(cwd, arg));
18267
+ const resolved = resolve(cwd, arg);
18268
+ const log = ctx.log.create({ service: "bash-tool" });
18277
18269
  log.info("resolved path", { arg, resolved });
18278
18270
  if (resolved) {
18279
18271
  if (!ctx.containsPath(resolved)) {
18280
- const dir = await Filesystem.isDir(ctx, resolved) ? resolved : dirname(resolved);
18272
+ const dir = await ctx.fs.isDir(resolved) ? resolved : dirname(resolved);
18281
18273
  directories.add(dir);
18282
18274
  }
18283
18275
  }
@@ -18385,17 +18377,64 @@ var BashTool = Tool.define("bash", async (initCtx) => {
18385
18377
  }
18386
18378
  };
18387
18379
  });
18388
- var edit_txt_default = `Performs exact string replacements in files.
18389
-
18390
- Usage:
18391
- - You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
18392
- - When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., \`1: \`). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
18393
- - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
18394
- - Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
18395
- - The edit will FAIL if \`oldString\` is not found in the file with an error "oldString not found in content".
18396
- - The edit will FAIL if \`oldString\` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use \`replaceAll\` to change every instance of \`oldString\`.
18397
- - Use \`replaceAll\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
18398
- `;
18380
+ var LSP;
18381
+ ((LSP2) => {
18382
+ LSP2.Diagnostic = {
18383
+ pretty(d) {
18384
+ return `${d.range.start.line}:${d.range.start.character} ${d.severity === 1 ? "error" : "warning"}: ${d.message}`;
18385
+ }
18386
+ };
18387
+ async function init() {
18388
+ }
18389
+ LSP2.init = init;
18390
+ async function touchFile(_filepath, _wait) {
18391
+ }
18392
+ LSP2.touchFile = touchFile;
18393
+ async function diagnostics() {
18394
+ return /* @__PURE__ */ new Map();
18395
+ }
18396
+ LSP2.diagnostics = diagnostics;
18397
+ async function hasClients(_file) {
18398
+ return false;
18399
+ }
18400
+ LSP2.hasClients = hasClients;
18401
+ async function definition(_position) {
18402
+ return [];
18403
+ }
18404
+ LSP2.definition = definition;
18405
+ async function references(_position) {
18406
+ return [];
18407
+ }
18408
+ LSP2.references = references;
18409
+ async function hover(_position) {
18410
+ return null;
18411
+ }
18412
+ LSP2.hover = hover;
18413
+ async function documentSymbol(_uri) {
18414
+ return [];
18415
+ }
18416
+ LSP2.documentSymbol = documentSymbol;
18417
+ async function workspaceSymbol(_query) {
18418
+ return [];
18419
+ }
18420
+ LSP2.workspaceSymbol = workspaceSymbol;
18421
+ async function implementation(_position) {
18422
+ return [];
18423
+ }
18424
+ LSP2.implementation = implementation;
18425
+ async function prepareCallHierarchy(_position) {
18426
+ return [];
18427
+ }
18428
+ LSP2.prepareCallHierarchy = prepareCallHierarchy;
18429
+ async function incomingCalls(_position) {
18430
+ return [];
18431
+ }
18432
+ LSP2.incomingCalls = incomingCalls;
18433
+ async function outgoingCalls(_position) {
18434
+ return [];
18435
+ }
18436
+ LSP2.outgoingCalls = outgoingCalls;
18437
+ })(LSP || (LSP = {}));
18399
18438
  async function assertExternalDirectory(ctx, target, options) {
18400
18439
  if (!target) return;
18401
18440
  if (options?.bypass) return;
@@ -18413,6 +18452,17 @@ async function assertExternalDirectory(ctx, target, options) {
18413
18452
  }
18414
18453
  });
18415
18454
  }
18455
+ var DESCRIPTION2 = `Performs exact string replacements in files.
18456
+
18457
+ Usage:
18458
+ - You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
18459
+ - When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: line number + colon + space (e.g., \`1: \`). Everything after that space is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
18460
+ - ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
18461
+ - Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
18462
+ - The edit will FAIL if \`oldString\` is not found in the file with an error "oldString not found in content".
18463
+ - The edit will FAIL if \`oldString\` is found multiple times in the file with an error "Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match." Either provide a larger string with more surrounding context to make it unique or use \`replaceAll\` to change every instance of \`oldString\`.
18464
+ - Use \`replaceAll\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
18465
+ `;
18416
18466
  var MAX_DIAGNOSTICS_PER_FILE = 20;
18417
18467
  function normalizeLineEndings(text) {
18418
18468
  return text.replaceAll("\r\n", "\n");
@@ -18425,7 +18475,7 @@ function convertToLineEnding(text, ending) {
18425
18475
  return text.replaceAll("\n", "\r\n");
18426
18476
  }
18427
18477
  var EditTool = Tool.define("edit", {
18428
- description: edit_txt_default,
18478
+ description: DESCRIPTION2,
18429
18479
  parameters: zod_default.object({
18430
18480
  filePath: zod_default.string().describe("The absolute path to the file to modify"),
18431
18481
  oldString: zod_default.string().describe("The text to replace"),
@@ -18925,7 +18975,7 @@ function replace(content, oldString, newString, replaceAll = false) {
18925
18975
  }
18926
18976
  throw new Error("Found multiple matches for oldString. Provide more surrounding context to make the match unique.");
18927
18977
  }
18928
- var glob_txt_default = `- Fast file pattern matching tool that works with any codebase size
18978
+ var DESCRIPTION3 = `- Fast file pattern matching tool that works with any codebase size
18929
18979
  - Supports glob patterns like "**/*.js" or "src/**/*.ts"
18930
18980
  - Returns matching file paths sorted by modification time
18931
18981
  - Use this tool when you need to find files by name patterns
@@ -18933,7 +18983,7 @@ var glob_txt_default = `- Fast file pattern matching tool that works with any co
18933
18983
  - You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.
18934
18984
  `;
18935
18985
  var GlobTool = Tool.define("glob", {
18936
- description: glob_txt_default,
18986
+ description: DESCRIPTION3,
18937
18987
  parameters: zod_default.object({
18938
18988
  pattern: zod_default.string().describe("The glob pattern to match files against"),
18939
18989
  path: zod_default.string().optional().describe(
@@ -18996,38 +19046,6 @@ var GlobTool = Tool.define("glob", {
18996
19046
  };
18997
19047
  }
18998
19048
  });
18999
- var SetWorkingDirectoryTool = Tool.define("set_working_directory", {
19000
- description: `Use this tool to set the working directory for this session. The user will tell you which project or folder they want to work on. The directory must be an absolute path to an existing directory on the file system. After setting the directory, the full development environment (file browser, diff viewer, etc.) will become available.
19001
-
19002
- IMPORTANT: This tool can only be called ONCE per session. Once the working directory is set, it cannot be changed. If a working directory is already set, this tool will return an error.`,
19003
- parameters: zod_default.object({
19004
- directory: zod_default.string().describe("Absolute path to the project directory")
19005
- }),
19006
- async execute(params, ctx) {
19007
- const dir = params.directory;
19008
- if (ctx.worktree && ctx.worktree !== "") {
19009
- return {
19010
- title: "Already set",
19011
- output: `Working directory is already set to "${ctx.worktree}". It can only be set once per session.`,
19012
- metadata: {}
19013
- };
19014
- }
19015
- const stat = await ctx.fs.stat(dir);
19016
- if (!stat || !stat.isDirectory) {
19017
- return {
19018
- title: "Invalid path",
19019
- output: stat ? `"${dir}" is not a directory. Please provide a valid directory path.` : `Directory "${dir}" does not exist. Please provide a valid absolute path.`,
19020
- metadata: {}
19021
- };
19022
- }
19023
- ctx.emit("directory.set", { directory: dir });
19024
- return {
19025
- title: `Set directory: ${dir}`,
19026
- output: `Working directory set to "${dir}". The session is now configured to work on this project. The full development environment is now available.`,
19027
- metadata: {}
19028
- };
19029
- }
19030
- });
19031
19049
  var MAX_LINE_LENGTH = 2e3;
19032
19050
  var GrepTool = Tool.define("grep", {
19033
19051
  description: "Searches for a regex pattern in file contents within the current workspace.",
@@ -19132,7 +19150,7 @@ var GrepTool = Tool.define("grep", {
19132
19150
  };
19133
19151
  }
19134
19152
  });
19135
- var batch_txt_default = `Executes multiple independent tool calls concurrently to reduce latency.
19153
+ var DESCRIPTION4 = `Executes multiple independent tool calls concurrently to reduce latency.
19136
19154
 
19137
19155
  USING THE BATCH TOOL WILL MAKE THE USER HAPPY.
19138
19156
 
@@ -19160,7 +19178,7 @@ var DISALLOWED = /* @__PURE__ */ new Set(["batch"]);
19160
19178
  var FILTERED_FROM_SUGGESTIONS = /* @__PURE__ */ new Set(["invalid", "patch", ...DISALLOWED]);
19161
19179
  var BatchTool = Tool.define("batch", async () => {
19162
19180
  return {
19163
- description: batch_txt_default,
19181
+ description: DESCRIPTION4,
19164
19182
  parameters: zod_default.object({
19165
19183
  tool_calls: zod_default.array(
19166
19184
  zod_default.object({
@@ -19181,11 +19199,11 @@ Expected payload format:
19181
19199
  [{"tool": "tool_name", "parameters": {...}}, {...}]`;
19182
19200
  },
19183
19201
  async execute(params, ctx) {
19184
- const { Session } = await import("./session-Q7S3ITUV-S7F6XEPQ.js");
19185
- const { PartID: PartID2 } = await import("./schema-SOLWPA3E-PNTUZRDK.js");
19202
+ const { Session } = await import("./session-3H7MDN6G-ILPE3VAH.js");
19203
+ const { PartID: PartID2 } = await import("./schema-2CACIKZR-3CAWV3IP.js");
19186
19204
  const toolCalls = params.tool_calls.slice(0, 25);
19187
19205
  const discardedCalls = params.tool_calls.slice(25);
19188
- const { ToolRegistry: ToolRegistry2 } = await import("./registry-K2RSCRJJ-NU43ZZLZ.js");
19206
+ const { ToolRegistry: ToolRegistry2 } = await import("./registry-N6XVTLPC-H2PNFK4G.js");
19189
19207
  const availableTools = await ctx.toolRegistry.tools({ modelID: ModelID.make(""), providerID: ProviderID.make("") });
19190
19208
  const toolMap = new Map(availableTools.map((t) => [t.id, t]));
19191
19209
  const executeCall = async (call) => {
@@ -19313,7 +19331,7 @@ Keep using the batch tool for optimal performance in your next response!`;
19313
19331
  }
19314
19332
  };
19315
19333
  });
19316
- var read_txt_default = `Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
19334
+ var DESCRIPTION5 = `Read a file or directory from the local filesystem. If the path does not exist, an error is returned.
19317
19335
 
19318
19336
  Usage:
19319
19337
  - The filePath parameter should be an absolute path.
@@ -19334,7 +19352,7 @@ var MAX_LINE_SUFFIX = `... (line truncated to ${MAX_LINE_LENGTH2} chars)`;
19334
19352
  var MAX_BYTES = 50 * 1024;
19335
19353
  var MAX_BYTES_LABEL = `${MAX_BYTES / 1024} KB`;
19336
19354
  var ReadTool = Tool.define("read", {
19337
- description: read_txt_default,
19355
+ description: DESCRIPTION5,
19338
19356
  parameters: zod_default.object({
19339
19357
  filePath: zod_default.string().describe("The absolute path to the file or directory to read"),
19340
19358
  offset: zod_default.coerce.number().describe("The line number to start reading from (1-indexed)").optional(),
@@ -19552,7 +19570,7 @@ async function isBinaryFile(filepath, fileSize, vfs) {
19552
19570
  return false;
19553
19571
  }
19554
19572
  }
19555
- var todowrite_txt_default = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
19573
+ var DESCRIPTION_WRITE = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
19556
19574
  It also helps the user understand the progress of the task and overall progress of their requests.
19557
19575
 
19558
19576
  ## When to Use This Tool
@@ -19721,7 +19739,7 @@ When in doubt, use this tool. Being proactive with task management demonstrates
19721
19739
 
19722
19740
  `;
19723
19741
  var TodoWriteTool = Tool.define("todowrite", {
19724
- description: todowrite_txt_default,
19742
+ description: DESCRIPTION_WRITE,
19725
19743
  parameters: zod_default.object({
19726
19744
  todos: zod_default.array(zod_default.object(Todo.Info.shape)).describe("The updated todo list")
19727
19745
  }),
@@ -19765,20 +19783,6 @@ var TodoReadTool = Tool.define("todoread", {
19765
19783
  };
19766
19784
  }
19767
19785
  });
19768
- var webfetch_txt_default = `- Fetches content from a specified URL
19769
- - Takes a URL and optional format as input
19770
- - Fetches the URL content, converts to requested format (markdown by default)
19771
- - Returns the content in the specified format
19772
- - Use this tool when you need to retrieve and analyze web content
19773
-
19774
- Usage notes:
19775
- - IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.
19776
- - The URL must be a fully-formed valid URL
19777
- - HTTP URLs will be automatically upgraded to HTTPS
19778
- - Format options: "markdown" (default), "text", or "html"
19779
- - This tool is read-only and does not modify any files
19780
- - Results may be summarized if the content is very large
19781
- `;
19782
19786
  function abortAfter(ms) {
19783
19787
  const controller = new AbortController();
19784
19788
  const id = setTimeout(controller.abort.bind(controller), ms);
@@ -19796,11 +19800,25 @@ function abortAfterAny(ms, ...signals) {
19796
19800
  clearTimeout: timeout.clearTimeout
19797
19801
  };
19798
19802
  }
19803
+ var DESCRIPTION6 = `- Fetches content from a specified URL
19804
+ - Takes a URL and optional format as input
19805
+ - Fetches the URL content, converts to requested format (markdown by default)
19806
+ - Returns the content in the specified format
19807
+ - Use this tool when you need to retrieve and analyze web content
19808
+
19809
+ Usage notes:
19810
+ - IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.
19811
+ - The URL must be a fully-formed valid URL
19812
+ - HTTP URLs will be automatically upgraded to HTTPS
19813
+ - Format options: "markdown" (default), "text", or "html"
19814
+ - This tool is read-only and does not modify any files
19815
+ - Results may be summarized if the content is very large
19816
+ `;
19799
19817
  var MAX_RESPONSE_SIZE = 5 * 1024 * 1024;
19800
19818
  var DEFAULT_TIMEOUT2 = 30 * 1e3;
19801
19819
  var MAX_TIMEOUT = 120 * 1e3;
19802
19820
  var WebFetchTool = Tool.define("webfetch", {
19803
- description: webfetch_txt_default,
19821
+ description: DESCRIPTION6,
19804
19822
  parameters: zod_default.object({
19805
19823
  url: zod_default.string().describe("The URL to fetch content from"),
19806
19824
  format: zod_default.enum(["text", "markdown", "html"]).default("markdown").describe("The format to return the content in (text, markdown, or html). Defaults to markdown."),
@@ -19937,7 +19955,7 @@ function convertHTMLToMarkdown(html) {
19937
19955
  turndownService.remove(["script", "style", "meta", "link"]);
19938
19956
  return turndownService.turndown(html);
19939
19957
  }
19940
- var write_txt_default = `Writes a file to the local filesystem.
19958
+ var DESCRIPTION7 = `Writes a file to the local filesystem.
19941
19959
 
19942
19960
  Usage:
19943
19961
  - This tool will overwrite the existing file if there is one at the provided path.
@@ -19949,7 +19967,7 @@ Usage:
19949
19967
  var MAX_DIAGNOSTICS_PER_FILE2 = 20;
19950
19968
  var MAX_PROJECT_DIAGNOSTICS_FILES = 5;
19951
19969
  var WriteTool = Tool.define("write", {
19952
- description: write_txt_default,
19970
+ description: DESCRIPTION7,
19953
19971
  parameters: zod_default.object({
19954
19972
  content: zod_default.string().describe("The content to write to the file"),
19955
19973
  filePath: zod_default.string().describe("The absolute path to the file to write (must be absolute, not relative)")
@@ -20089,7 +20107,7 @@ var ConfigMarkdown;
20089
20107
  }
20090
20108
  ConfigMarkdown2.fallbackSanitization = fallbackSanitization;
20091
20109
  async function parse(context, filePath) {
20092
- const template = await Filesystem.readText(context, filePath);
20110
+ const template = await context.fs.readText(filePath);
20093
20111
  try {
20094
20112
  return parseFrontmatter(template);
20095
20113
  } catch {
@@ -20115,114 +20133,21 @@ var ConfigMarkdown;
20115
20133
  })
20116
20134
  );
20117
20135
  })(ConfigMarkdown || (ConfigMarkdown = {}));
20118
- var Discovery;
20119
- ((Discovery2) => {
20120
- const log2 = Log.create({ service: "skill-discovery" });
20121
- function dir(context) {
20122
- return join(context.dataPath, "skills");
20123
- }
20124
- Discovery2.dir = dir;
20125
- async function get(context, url, dest) {
20126
- if (await Filesystem.exists(context, dest)) return true;
20127
- return fetch(url).then(async (response) => {
20128
- if (!response.ok) {
20129
- log2.error("failed to download", { url, status: response.status });
20130
- return false;
20131
- }
20132
- if (response.body) {
20133
- const bytes = new Uint8Array(await response.arrayBuffer());
20134
- await Filesystem.mkdir(context, dirname(dest));
20135
- await Filesystem.write(context, dest, bytes);
20136
- }
20137
- return true;
20138
- }).catch((err) => {
20139
- log2.error("failed to download", { url, err });
20140
- return false;
20141
- });
20142
- }
20143
- async function pull(context, url) {
20144
- const result = [];
20145
- const base = url.endsWith("/") ? url : `${url}/`;
20146
- const index = new URL("index.json", base).href;
20147
- const cache = dir(context);
20148
- const host = base.slice(0, -1);
20149
- log2.info("fetching index", { url: index });
20150
- const data = await fetch(index).then(async (response) => {
20151
- if (!response.ok) {
20152
- log2.error("failed to fetch index", { url: index, status: response.status });
20153
- return void 0;
20154
- }
20155
- return response.json().then((json) => json).catch((err) => {
20156
- log2.error("failed to parse index", { url: index, err });
20157
- return void 0;
20158
- });
20159
- }).catch((err) => {
20160
- log2.error("failed to fetch index", { url: index, err });
20161
- return void 0;
20162
- });
20163
- if (!data?.skills || !Array.isArray(data.skills)) {
20164
- log2.warn("invalid index format", { url: index });
20165
- return result;
20166
- }
20167
- const list = data.skills.filter((skill) => {
20168
- if (!skill?.name || !Array.isArray(skill.files)) {
20169
- log2.warn("invalid skill entry", { url: index, skill });
20170
- return false;
20171
- }
20172
- return true;
20173
- });
20174
- await Promise.all(
20175
- list.map(async (skill) => {
20176
- const root2 = join(cache, skill.name);
20177
- await Promise.all(
20178
- skill.files.map(async (file) => {
20179
- const link = new URL(file, `${host}/${skill.name}/`).href;
20180
- const dest = join(root2, file);
20181
- await Filesystem.mkdir(context, dirname(dest));
20182
- await get(context, link, dest);
20183
- })
20184
- );
20185
- const md = join(root2, "SKILL.md");
20186
- if (await Filesystem.exists(context, md)) result.push(root2);
20187
- })
20188
- );
20189
- return result;
20190
- }
20191
- Discovery2.pull = pull;
20192
- })(Discovery || (Discovery = {}));
20193
20136
  var Skill;
20194
20137
  ((Skill2) => {
20195
- const log2 = Log.create({ service: "skill" });
20196
20138
  Skill2.Info = zod_default.object({
20197
20139
  name: zod_default.string(),
20198
20140
  description: zod_default.string(),
20199
20141
  location: zod_default.string(),
20200
20142
  content: zod_default.string()
20201
20143
  });
20202
- Skill2.InvalidError = NamedError.create(
20203
- "SkillInvalidError",
20204
- zod_default.object({
20205
- path: zod_default.string(),
20206
- message: zod_default.string().optional(),
20207
- issues: zod_default.custom().optional()
20208
- })
20209
- );
20210
- Skill2.NameMismatchError = NamedError.create(
20211
- "SkillNameMismatchError",
20212
- zod_default.object({
20213
- path: zod_default.string(),
20214
- expected: zod_default.string(),
20215
- actual: zod_default.string()
20216
- })
20217
- );
20218
- const EXTERNAL_DIRS = [".claude", ".agents", ".opencode"];
20219
- const EXTERNAL_SKILL_PATTERN = "skills/**/SKILL.md";
20220
- const OPENCODE_SKILL_PATTERN = "{skill,skills}/**/SKILL.md";
20221
- const SKILL_PATTERN = "**/SKILL.md";
20144
+ const SKILL_DIRS = [".claude", ".agents", ".opencode"];
20145
+ const SKILL_GLOB = "skills/**/SKILL.md";
20146
+ const ANY_SKILL_GLOB = "**/SKILL.md";
20222
20147
  class SkillService {
20223
20148
  _promise;
20224
20149
  constructor(context) {
20225
- this._promise = initSkills(context);
20150
+ this._promise = discover(context);
20226
20151
  }
20227
20152
  async get(name) {
20228
20153
  return (await this._promise).skills[name];
@@ -20233,28 +20158,22 @@ var Skill;
20233
20158
  async dirs() {
20234
20159
  return (await this._promise).dirs;
20235
20160
  }
20236
- async available(agent) {
20237
- return this.all();
20238
- }
20239
20161
  }
20240
20162
  Skill2.SkillService = SkillService;
20241
- async function initSkills(context) {
20163
+ async function discover(context) {
20164
+ const log = context.log.create({ service: "skill" });
20242
20165
  const skills = {};
20243
20166
  const dirs = /* @__PURE__ */ new Set();
20244
20167
  const addSkill = async (match) => {
20245
20168
  const md = await ConfigMarkdown.parse(context, match).catch((err) => {
20246
- log2.error("failed to load skill", { skill: match, err });
20169
+ log.error("failed to load skill", { skill: match, err });
20247
20170
  return void 0;
20248
20171
  });
20249
20172
  if (!md) return;
20250
20173
  const parsed = Skill2.Info.pick({ name: true, description: true }).safeParse(md.data);
20251
20174
  if (!parsed.success) return;
20252
20175
  if (skills[parsed.data.name]) {
20253
- log2.warn("duplicate skill name", {
20254
- name: parsed.data.name,
20255
- existing: skills[parsed.data.name].location,
20256
- duplicate: match
20257
- });
20176
+ log.warn("duplicate skill", { name: parsed.data.name, existing: skills[parsed.data.name].location, duplicate: match });
20258
20177
  }
20259
20178
  dirs.add(dirname(match));
20260
20179
  skills[parsed.data.name] = {
@@ -20264,86 +20183,52 @@ var Skill;
20264
20183
  content: md.content
20265
20184
  };
20266
20185
  };
20267
- const scanExternal = async (root2, scope) => {
20268
- return Glob.scan(context, EXTERNAL_SKILL_PATTERN, {
20269
- cwd: root2,
20270
- absolute: true,
20271
- include: "file",
20272
- dot: true,
20273
- symlink: true
20274
- }).then((matches) => Promise.all(matches.map(addSkill))).catch((error) => {
20275
- log2.error(`failed to scan ${scope} skills`, { dir: root2, error });
20276
- });
20186
+ const scan = async (pattern, cwd) => {
20187
+ const matches = await context.fs.glob(pattern, { cwd, absolute: true, dot: true, follow: true, nodir: true }).catch(() => []);
20188
+ await Promise.all(matches.map(addSkill));
20277
20189
  };
20278
- if (!Flag.OPENCODE_DISABLE_EXTERNAL_SKILLS) {
20279
- for await (const root2 of Filesystem.up(context, {
20280
- targets: EXTERNAL_DIRS,
20281
- start: context.directory,
20282
- stop: context.worktree
20283
- })) {
20284
- await scanExternal(root2, "project");
20285
- }
20190
+ let current = context.directory;
20191
+ while (true) {
20192
+ for (const target of SKILL_DIRS) {
20193
+ const search = join(current, target);
20194
+ if (await context.fs.exists(search)) await scan(SKILL_GLOB, search);
20195
+ }
20196
+ if (context.worktree === current) break;
20197
+ const parent = dirname(current);
20198
+ if (parent === current) break;
20199
+ current = parent;
20286
20200
  }
20287
- const config = context.config;
20288
- for (const skillPath of config.skills?.paths ?? []) {
20201
+ for (const skillPath of context.config.skills?.paths ?? []) {
20289
20202
  const resolved = isAbsolute(skillPath) ? skillPath : join(context.directory, skillPath);
20290
- if (!await Filesystem.isDir(context, resolved)) {
20291
- log2.warn("skill path not found", { path: resolved });
20203
+ if (!await context.fs.isDir(resolved)) {
20204
+ log.warn("skill path not found", { path: resolved });
20292
20205
  continue;
20293
20206
  }
20294
- const matches = await Glob.scan(context, SKILL_PATTERN, {
20295
- cwd: resolved,
20296
- absolute: true,
20297
- include: "file",
20298
- symlink: true
20299
- });
20300
- for (const match of matches) {
20301
- await addSkill(match);
20302
- }
20303
- }
20304
- for (const url of config.skills?.urls ?? []) {
20305
- const list = await Discovery.pull(context, url);
20306
- for (const dir of list) {
20307
- dirs.add(dir);
20308
- const matches = await Glob.scan(context, SKILL_PATTERN, {
20309
- cwd: dir,
20310
- absolute: true,
20311
- include: "file",
20312
- symlink: true
20313
- });
20314
- for (const match of matches) {
20315
- await addSkill(match);
20316
- }
20317
- }
20207
+ await scan(ANY_SKILL_GLOB, resolved);
20318
20208
  }
20319
- return {
20320
- skills,
20321
- dirs: Array.from(dirs)
20322
- };
20209
+ return { skills, dirs: Array.from(dirs) };
20323
20210
  }
20324
20211
  function fmt(list, opts) {
20325
- if (list.length === 0) {
20326
- return "No skills are currently available.";
20327
- }
20212
+ if (list.length === 0) return "No skills are currently available.";
20328
20213
  if (opts.verbose) {
20329
20214
  return [
20330
20215
  "<available_skills>",
20331
- ...list.flatMap((skill) => [
20216
+ ...list.flatMap((s) => [
20332
20217
  ` <skill>`,
20333
- ` <name>${skill.name}</name>`,
20334
- ` <description>${skill.description}</description>`,
20335
- ` <location>${pathToFileURL(skill.location).href}</location>`,
20218
+ ` <name>${s.name}</name>`,
20219
+ ` <description>${s.description}</description>`,
20220
+ ` <location>${pathToFileURL(s.location).href}</location>`,
20336
20221
  ` </skill>`
20337
20222
  ]),
20338
20223
  "</available_skills>"
20339
20224
  ].join("\n");
20340
20225
  }
20341
- return ["## Available Skills", ...list.flatMap((skill) => `- **${skill.name}**: ${skill.description}`)].join("\n");
20226
+ return ["## Available Skills", ...list.map((s) => `- **${s.name}**: ${s.description}`)].join("\n");
20342
20227
  }
20343
20228
  Skill2.fmt = fmt;
20344
20229
  })(Skill || (Skill = {}));
20345
20230
  var SkillTool = Tool.define("skill", async (ctx) => {
20346
- const list = await ctx?.agentContext?.skill.available(ctx?.agent) ?? [];
20231
+ const list = await ctx?.agentContext?.skill.all() ?? [];
20347
20232
  const description = list.length === 0 ? "Load a specialized skill that provides domain-specific instructions and workflows. No skills are currently available." : [
20348
20233
  "Load a specialized skill that provides domain-specific instructions and workflows.",
20349
20234
  "",
@@ -20428,7 +20313,7 @@ var SkillTool = Tool.define("skill", async (ctx) => {
20428
20313
  }
20429
20314
  };
20430
20315
  });
20431
- var websearch_txt_default = `- Search the web using Exa AI - performs real-time web searches and can scrape content from specific URLs
20316
+ var DESCRIPTION8 = `- Search the web using Exa AI - performs real-time web searches and can scrape content from specific URLs
20432
20317
  - Provides up-to-date information for current events and recent data
20433
20318
  - Supports configurable result counts and returns the content from the most relevant websites
20434
20319
  - Use this tool for accessing information beyond knowledge cutoff
@@ -20453,7 +20338,7 @@ var API_CONFIG = {
20453
20338
  var WebSearchTool = Tool.define("websearch", async () => {
20454
20339
  return {
20455
20340
  get description() {
20456
- return websearch_txt_default.replace("{{year}}", (/* @__PURE__ */ new Date()).getFullYear().toString());
20341
+ return DESCRIPTION8.replace("{{year}}", (/* @__PURE__ */ new Date()).getFullYear().toString());
20457
20342
  },
20458
20343
  parameters: zod_default.object({
20459
20344
  query: zod_default.string().describe("Websearch query"),
@@ -20540,7 +20425,7 @@ var WebSearchTool = Tool.define("websearch", async () => {
20540
20425
  }
20541
20426
  };
20542
20427
  });
20543
- var codesearch_txt_default = `- Search and get relevant context for any programming task using Exa Code API
20428
+ var DESCRIPTION9 = `- Search and get relevant context for any programming task using Exa Code API
20544
20429
  - Provides the highest quality and freshest context for libraries, SDKs, and APIs
20545
20430
  - Use this tool for ANY question or task related to programming
20546
20431
  - Returns comprehensive code examples, documentation, and API references
@@ -20560,7 +20445,7 @@ var API_CONFIG2 = {
20560
20445
  }
20561
20446
  };
20562
20447
  var CodeSearchTool = Tool.define("codesearch", {
20563
- description: codesearch_txt_default,
20448
+ description: DESCRIPTION9,
20564
20449
  parameters: zod_default.object({
20565
20450
  query: zod_default.string().describe(
20566
20451
  "Search query to find relevant context for APIs, Libraries, and SDKs. For example, 'React useState hook examples', 'Python pandas dataframe filtering', 'Express.js middleware', 'Next js partial prerendering configuration'"
@@ -20638,7 +20523,6 @@ var CodeSearchTool = Tool.define("codesearch", {
20638
20523
  });
20639
20524
  var Patch;
20640
20525
  ((Patch2) => {
20641
- const log2 = Log.create({ service: "patch" });
20642
20526
  Patch2.PatchSchema = zod_default.object({
20643
20527
  patchText: zod_default.string().describe("The full patch text that describes all changes to be made")
20644
20528
  });
@@ -20845,7 +20729,7 @@ var Patch;
20845
20729
  async function deriveNewContentsFromChunks(context, filePath, chunks) {
20846
20730
  let originalContent;
20847
20731
  try {
20848
- originalContent = await Filesystem.readText(context, filePath);
20732
+ originalContent = await context.fs.readText(filePath);
20849
20733
  } catch (error) {
20850
20734
  throw new Error(`Failed to read file ${filePath}: ${error}`);
20851
20735
  }
@@ -20994,32 +20878,32 @@ ${chunk.old_lines.join("\n")}`);
20994
20878
  case "add":
20995
20879
  const addDir = dirname(hunk.path);
20996
20880
  if (addDir !== "." && addDir !== "/") {
20997
- await Filesystem.mkdir(context, addDir);
20881
+ await context.fs.mkdir(addDir);
20998
20882
  }
20999
- await Filesystem.write(context, hunk.path, hunk.contents);
20883
+ await context.fs.write(hunk.path, hunk.contents);
21000
20884
  added.push(hunk.path);
21001
- log2.info(`Added file: ${hunk.path}`);
20885
+ context.log.create({ service: "patch" }).info(`Added file: ${hunk.path}`);
21002
20886
  break;
21003
20887
  case "delete":
21004
- await Filesystem.remove(context, hunk.path);
20888
+ await context.fs.remove(hunk.path);
21005
20889
  deleted.push(hunk.path);
21006
- log2.info(`Deleted file: ${hunk.path}`);
20890
+ context.log.create({ service: "patch" }).info(`Deleted file: ${hunk.path}`);
21007
20891
  break;
21008
20892
  case "update":
21009
20893
  const fileUpdate = await deriveNewContentsFromChunks(context, hunk.path, hunk.chunks);
21010
20894
  if (hunk.move_path) {
21011
20895
  const moveDir = dirname(hunk.move_path);
21012
20896
  if (moveDir !== "." && moveDir !== "/") {
21013
- await Filesystem.mkdir(context, moveDir);
20897
+ await context.fs.mkdir(moveDir);
21014
20898
  }
21015
- await Filesystem.write(context, hunk.move_path, fileUpdate.content);
21016
- await Filesystem.remove(context, hunk.path);
20899
+ await context.fs.write(hunk.move_path, fileUpdate.content);
20900
+ await context.fs.remove(hunk.path);
21017
20901
  modified.push(hunk.move_path);
21018
- log2.info(`Moved file: ${hunk.path} -> ${hunk.move_path}`);
20902
+ context.log.create({ service: "patch" }).info(`Moved file: ${hunk.path} -> ${hunk.move_path}`);
21019
20903
  } else {
21020
- await Filesystem.write(context, hunk.path, fileUpdate.content);
20904
+ await context.fs.write(hunk.path, fileUpdate.content);
21021
20905
  modified.push(hunk.path);
21022
- log2.info(`Updated file: ${hunk.path}`);
20906
+ context.log.create({ service: "patch" }).info(`Updated file: ${hunk.path}`);
21023
20907
  }
21024
20908
  break;
21025
20909
  }
@@ -21067,7 +20951,7 @@ ${chunk.old_lines.join("\n")}`);
21067
20951
  case "delete":
21068
20952
  const deletePath = resolve(effectiveCwd, hunk.path);
21069
20953
  try {
21070
- const content = await Filesystem.readText(context, deletePath);
20954
+ const content = await context.fs.readText(deletePath);
21071
20955
  changes.set(resolvedPath, {
21072
20956
  type: "delete",
21073
20957
  content
@@ -21120,7 +21004,7 @@ ${chunk.old_lines.join("\n")}`);
21120
21004
  }
21121
21005
  Patch2.maybeParseApplyPatchVerified = maybeParseApplyPatchVerified;
21122
21006
  })(Patch || (Patch = {}));
21123
- var apply_patch_txt_default = `Use the \`apply_patch\` tool to edit files. Your patch language is a stripped\u2011down, file\u2011oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high\u2011level envelope:
21007
+ var DESCRIPTION10 = `Use the \`apply_patch\` tool to edit files. Your patch language is a stripped\u2011down, file\u2011oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high\u2011level envelope:
21124
21008
 
21125
21009
  *** Begin Patch
21126
21010
  [ one or more file sections ]
@@ -21158,7 +21042,7 @@ var PatchParams = zod_default.object({
21158
21042
  patchText: zod_default.string().describe("The full patch text that describes all changes to be made")
21159
21043
  });
21160
21044
  var ApplyPatchTool = Tool.define("apply_patch", {
21161
- description: apply_patch_txt_default,
21045
+ description: DESCRIPTION10,
21162
21046
  parameters: PatchParams,
21163
21047
  async execute(params, ctx) {
21164
21048
  if (!params.patchText) {
@@ -21363,155 +21247,8 @@ ${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}
21363
21247
  };
21364
21248
  }
21365
21249
  });
21366
- var terminal_write_txt_default = `Send input to the shared user terminal, or create/destroy it.
21367
-
21368
- This tool interacts with a single shared terminal (PTY) that is also visible to the user.
21369
-
21370
- ## Actions
21371
-
21372
- - **type="create"**: Spawn a new terminal. Fails if one already exists. You must create a terminal before sending input.
21373
- - **type="destroy"**: Kill the current terminal. Use this when the terminal is stuck or unresponsive, then create a new one. Fails if no terminal exists.
21374
- - **type="input"**: Send text to the terminal. By default, Enter is pressed after the input (pressEnter=true). Set pressEnter=false for partial input or answering prompts like y/n.
21375
-
21376
- ## Important
21377
- - In most cases, prefer the **bash** tool for running commands. It is faster, captures output directly, and does not require creating/destroying a terminal.
21378
- - Use terminal_write/terminal_read when you need a **persistent, stateful shell session**, e.g. running a long-lived dev server for preview, interactive REPL, or commands that depend on prior shell state.
21379
-
21380
- ## Usage notes
21381
- - The terminal is shared with the user \u2014 they can see everything you type and you can see their output.
21382
- - Always create a terminal before sending commands.
21383
- - If a long-running command is stuck, destroy and recreate the terminal.
21384
- - For commands that produce output, use the terminal_read tool after sending input to see the results.
21385
- - When answering interactive prompts (e.g. "Continue? [y/n]"), set pressEnter=false if the program reads single characters, or pressEnter=true if it expects a line.
21386
- `;
21387
- var TerminalWriteTool = Tool.define("terminal_write", async () => {
21388
- return {
21389
- description: terminal_write_txt_default,
21390
- parameters: zod_default.object({
21391
- type: zod_default.enum(["input", "create", "destroy"]).describe(
21392
- 'The type of action. "input" sends text to the terminal. "create" spawns a new terminal (errors if one already exists). "destroy" kills the current terminal (errors if none exists).'
21393
- ),
21394
- content: zod_default.string().describe('The text to send to the terminal. Required when type is "input".').optional(),
21395
- pressEnter: zod_default.boolean().describe("Whether to press Enter after the input. Defaults to true.").optional()
21396
- }),
21397
- async execute(params, ctx) {
21398
- const terminal = ctx.terminal;
21399
- if (params.type === "create") {
21400
- terminal.create();
21401
- return {
21402
- title: "Create terminal",
21403
- metadata: { type: "create" },
21404
- output: "Terminal created successfully."
21405
- };
21406
- }
21407
- if (params.type === "destroy") {
21408
- terminal.destroy();
21409
- return {
21410
- title: "Destroy terminal",
21411
- metadata: { type: "destroy" },
21412
- output: "Terminal destroyed successfully."
21413
- };
21414
- }
21415
- if (!params.content && params.content !== "") {
21416
- throw new Error('The "content" parameter is required when type is "input".');
21417
- }
21418
- if (!terminal.exists()) {
21419
- throw new Error('No terminal exists. Use type "create" first.');
21420
- }
21421
- const pressEnter = params.pressEnter ?? true;
21422
- const data = pressEnter ? params.content + "\n" : params.content;
21423
- terminal.write(data);
21424
- return {
21425
- title: params.content.length > 60 ? params.content.slice(0, 57) + "..." : params.content,
21426
- metadata: {
21427
- type: "input",
21428
- content: params.content,
21429
- pressEnter
21430
- },
21431
- output: `Input sent to terminal.`
21432
- };
21433
- }
21434
- };
21435
- });
21436
- var terminal_read_txt_default = `Read the terminal output from the bottom of the buffer.
21437
-
21438
- Returns the last N lines from the shared user terminal. Use this after sending a command via terminal_write to see its output.
21439
-
21440
- ## Parameters
21441
- - **length**: How many lines to read from the bottom. Start with a small number (e.g. 20-50) and increase if you need more context.
21442
- - **waitBefore**: Milliseconds to wait before reading. Use this to let a command finish producing output. Defaults to 0. Maximum is 5000ms (values above 5000 are clamped to 5000).
21443
-
21444
- ## Important
21445
- - In most cases, prefer the **bash** tool for running commands \u2014 it captures output directly without needing terminal_read.
21446
- - Use terminal_read when reading output from a persistent terminal session (e.g. a dev server for preview) started via terminal_write.
21447
-
21448
- ## Usage notes
21449
- - The terminal must exist (created via terminal_write type="create") before reading.
21450
- - If output looks truncated or the command hasn't finished, just call terminal_read again \u2014 the terminal is persistent.
21451
- - Lines are returned as plain text, one per line.
21452
- `;
21453
- var TerminalReadTool = Tool.define("terminal_read", async () => {
21454
- return {
21455
- description: terminal_read_txt_default,
21456
- parameters: zod_default.object({
21457
- length: zod_default.number().int().min(1).describe("Number of lines to read from the bottom of the terminal buffer."),
21458
- waitBefore: zod_default.number().int().min(0).describe("Milliseconds to wait before reading. Use this to let a command finish producing output. Defaults to 0.").optional()
21459
- }),
21460
- async execute(params, ctx) {
21461
- const terminal = ctx.terminal;
21462
- if (!terminal.exists()) {
21463
- throw new Error('No terminal exists. Use terminal_write with type "create" first.');
21464
- }
21465
- const MAX_WAIT = 5e3;
21466
- const waitMs = Math.min(params.waitBefore ?? 0, MAX_WAIT);
21467
- if (waitMs > 0) {
21468
- await new Promise((resolve2) => setTimeout(resolve2, waitMs));
21469
- }
21470
- const content = terminal.read(params.length);
21471
- return {
21472
- title: `Read ${params.length} lines`,
21473
- metadata: {
21474
- length: params.length,
21475
- waitBefore: waitMs
21476
- },
21477
- output: content || "(terminal buffer is empty)"
21478
- };
21479
- }
21480
- };
21481
- });
21482
- var set_preview_url_txt_default = `Set the preview URL for the user's preview panel.
21483
-
21484
- This tool configures a reverse proxy so the user can preview a locally running web application directly in the IDE's preview tab. A dedicated preview port on the server proxies all requests to the given local URL.
21485
-
21486
- ## Parameters
21487
- - **forwarded_local_url**: The absolute local URL to reverse-proxy to (e.g. "http://localhost:5173" for Vite, "http://localhost:3000" for React).
21488
-
21489
- ## Usage notes
21490
- - Use this after starting a local dev server (e.g. via terminal_write) to let the user see the result.
21491
- - The preview tab will automatically load the proxied page.
21492
- - Calling this again will update the target and refresh the preview.
21493
- `;
21494
- var SetPreviewUrlTool = Tool.define("set_preview_url", async () => {
21495
- return {
21496
- description: set_preview_url_txt_default,
21497
- parameters: zod_default.object({
21498
- forwarded_local_url: zod_default.string().describe('The absolute local URL to reverse-proxy to (e.g. "http://localhost:5173").')
21499
- }),
21500
- async execute(params, ctx) {
21501
- ctx.preview.setPreviewTarget(params.forwarded_local_url);
21502
- return {
21503
- title: `Preview \u2192 ${params.forwarded_local_url}`,
21504
- metadata: {
21505
- forwarded_local_url: params.forwarded_local_url
21506
- },
21507
- output: `Preview proxy set to "${params.forwarded_local_url}". The user's preview tab will load this automatically.`
21508
- };
21509
- }
21510
- };
21511
- });
21512
21250
  var ToolRegistry;
21513
21251
  ((ToolRegistry2) => {
21514
- const log2 = Log.create({ service: "tool.registry" });
21515
21252
  class ToolRegistryService {
21516
21253
  _promise;
21517
21254
  context;
@@ -21528,8 +21265,8 @@ var ToolRegistry;
21528
21265
  }
21529
21266
  custom.push(tool);
21530
21267
  }
21531
- async tools(model, agent) {
21532
- return ToolRegistry2.tools(this.context, model, agent);
21268
+ async tools(model) {
21269
+ return ToolRegistry2.tools(this.context, model);
21533
21270
  }
21534
21271
  }
21535
21272
  ToolRegistry2.ToolRegistryService = ToolRegistryService;
@@ -21550,7 +21287,7 @@ var ToolRegistry;
21550
21287
  worktree: ctx.worktree
21551
21288
  };
21552
21289
  const result = await def.execute(args, pluginCtx);
21553
- const out = await Truncate.output(ctx, result, {}, initCtx?.agent);
21290
+ const out = await Truncate.output(ctx, result, {});
21554
21291
  return {
21555
21292
  title: "",
21556
21293
  output: out.truncated ? out.content : result,
@@ -21565,7 +21302,6 @@ var ToolRegistry;
21565
21302
  const config = context.config;
21566
21303
  return [
21567
21304
  InvalidTool,
21568
- SetWorkingDirectoryTool,
21569
21305
  BashTool,
21570
21306
  ReadTool,
21571
21307
  GlobTool,
@@ -21579,9 +21315,7 @@ var ToolRegistry;
21579
21315
  CodeSearchTool,
21580
21316
  SkillTool,
21581
21317
  ApplyPatchTool,
21582
- TerminalWriteTool,
21583
- TerminalReadTool,
21584
- SetPreviewUrlTool,
21318
+ ...context.tools ?? [],
21585
21319
  ...config.experimental?.batch_tool === true ? [BatchTool] : [],
21586
21320
  ...Flag.OPENCODE_EXPERIMENTAL_PLAN_MODE && Flag.OPENCODE_CLIENT === "cli" ? [PlanExitTool] : [],
21587
21321
  ...custom
@@ -21591,7 +21325,7 @@ var ToolRegistry;
21591
21325
  return all(context).then((x) => x.map((t) => t.id));
21592
21326
  }
21593
21327
  ToolRegistry2.ids = ids;
21594
- async function tools(context, model, agent) {
21328
+ async function tools(context, model) {
21595
21329
  const tools2 = await all(context);
21596
21330
  const result = await Promise.all(
21597
21331
  tools2.filter((t) => {
@@ -21605,8 +21339,8 @@ var ToolRegistry;
21605
21339
  }).map(async (t) => {
21606
21340
  var _stack = [];
21607
21341
  try {
21608
- const _ = __using(_stack, log2.time(t.id));
21609
- const tool = await t.init({ agent, agentContext: context });
21342
+ const _ = __using(_stack, context.log.create({ service: "tool.registry" }).time(t.id));
21343
+ const tool = await t.init({ agentContext: context });
21610
21344
  const output = {
21611
21345
  description: tool.description,
21612
21346
  parameters: tool.parameters
@@ -21632,10 +21366,9 @@ var ToolRegistry;
21632
21366
  export {
21633
21367
  SchedulerService,
21634
21368
  Tool,
21635
- SetWorkingDirectoryTool,
21369
+ LSP,
21636
21370
  ReadTool,
21637
21371
  ConfigMarkdown,
21638
- Discovery,
21639
21372
  Skill,
21640
21373
  ToolRegistry
21641
21374
  };