@anthropic-ai/claude-code 2.0.12 → 2.0.14

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 (3) hide show
  1. package/cli.js +841 -829
  2. package/package.json +1 -1
  3. package/sdk.mjs +798 -128
package/sdk.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://docs.claude.com/en/docs/claude-code/legal-and-compliance.
3
3
 
4
- // Version: 2.0.12
4
+ // Version: 2.0.14
5
5
 
6
6
  // Want to see the unminified source? We're hiring!
7
7
  // https://job-boards.greenhouse.io/anthropic/jobs/4816199008
@@ -34,8 +34,8 @@ var __export = (target, all) => {
34
34
 
35
35
  // node_modules/uri-js/dist/es5/uri.all.js
36
36
  var require_uri_all = __commonJS((exports, module) => {
37
- (function(global, factory) {
38
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global.URI = global.URI || {});
37
+ (function(global2, factory) {
38
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : factory(global2.URI = global2.URI || {});
39
39
  })(exports, function(exports2) {
40
40
  function merge() {
41
41
  for (var _len = arguments.length, sets = Array(_len), _key = 0;_key < _len; _key++) {
@@ -1400,75 +1400,75 @@ var require_resolve = __commonJS((exports, module) => {
1400
1400
  resolve.ids = resolveIds;
1401
1401
  resolve.inlineRef = inlineRef;
1402
1402
  resolve.schema = resolveSchema;
1403
- function resolve(compile, root, ref) {
1403
+ function resolve(compile, root2, ref) {
1404
1404
  var refVal = this._refs[ref];
1405
1405
  if (typeof refVal == "string") {
1406
1406
  if (this._refs[refVal])
1407
1407
  refVal = this._refs[refVal];
1408
1408
  else
1409
- return resolve.call(this, compile, root, refVal);
1409
+ return resolve.call(this, compile, root2, refVal);
1410
1410
  }
1411
1411
  refVal = refVal || this._schemas[ref];
1412
1412
  if (refVal instanceof SchemaObject) {
1413
1413
  return inlineRef(refVal.schema, this._opts.inlineRefs) ? refVal.schema : refVal.validate || this._compile(refVal);
1414
1414
  }
1415
- var res = resolveSchema.call(this, root, ref);
1415
+ var res = resolveSchema.call(this, root2, ref);
1416
1416
  var schema, v, baseId;
1417
1417
  if (res) {
1418
1418
  schema = res.schema;
1419
- root = res.root;
1419
+ root2 = res.root;
1420
1420
  baseId = res.baseId;
1421
1421
  }
1422
1422
  if (schema instanceof SchemaObject) {
1423
- v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
1423
+ v = schema.validate || compile.call(this, schema.schema, root2, undefined, baseId);
1424
1424
  } else if (schema !== undefined) {
1425
- v = inlineRef(schema, this._opts.inlineRefs) ? schema : compile.call(this, schema, root, undefined, baseId);
1425
+ v = inlineRef(schema, this._opts.inlineRefs) ? schema : compile.call(this, schema, root2, undefined, baseId);
1426
1426
  }
1427
1427
  return v;
1428
1428
  }
1429
- function resolveSchema(root, ref) {
1430
- var p = URI.parse(ref), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root.schema));
1431
- if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
1429
+ function resolveSchema(root2, ref) {
1430
+ var p = URI.parse(ref), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root2.schema));
1431
+ if (Object.keys(root2.schema).length === 0 || refPath !== baseId) {
1432
1432
  var id = normalizeId(refPath);
1433
1433
  var refVal = this._refs[id];
1434
1434
  if (typeof refVal == "string") {
1435
- return resolveRecursive.call(this, root, refVal, p);
1435
+ return resolveRecursive.call(this, root2, refVal, p);
1436
1436
  } else if (refVal instanceof SchemaObject) {
1437
1437
  if (!refVal.validate)
1438
1438
  this._compile(refVal);
1439
- root = refVal;
1439
+ root2 = refVal;
1440
1440
  } else {
1441
1441
  refVal = this._schemas[id];
1442
1442
  if (refVal instanceof SchemaObject) {
1443
1443
  if (!refVal.validate)
1444
1444
  this._compile(refVal);
1445
1445
  if (id == normalizeId(ref))
1446
- return { schema: refVal, root, baseId };
1447
- root = refVal;
1446
+ return { schema: refVal, root: root2, baseId };
1447
+ root2 = refVal;
1448
1448
  } else {
1449
1449
  return;
1450
1450
  }
1451
1451
  }
1452
- if (!root.schema)
1452
+ if (!root2.schema)
1453
1453
  return;
1454
- baseId = getFullPath(this._getId(root.schema));
1454
+ baseId = getFullPath(this._getId(root2.schema));
1455
1455
  }
1456
- return getJsonPointer.call(this, p, baseId, root.schema, root);
1456
+ return getJsonPointer.call(this, p, baseId, root2.schema, root2);
1457
1457
  }
1458
- function resolveRecursive(root, ref, parsedRef) {
1459
- var res = resolveSchema.call(this, root, ref);
1458
+ function resolveRecursive(root2, ref, parsedRef) {
1459
+ var res = resolveSchema.call(this, root2, ref);
1460
1460
  if (res) {
1461
1461
  var schema = res.schema;
1462
1462
  var baseId = res.baseId;
1463
- root = res.root;
1463
+ root2 = res.root;
1464
1464
  var id = this._getId(schema);
1465
1465
  if (id)
1466
1466
  baseId = resolveUrl(baseId, id);
1467
- return getJsonPointer.call(this, parsedRef, baseId, schema, root);
1467
+ return getJsonPointer.call(this, parsedRef, baseId, schema, root2);
1468
1468
  }
1469
1469
  }
1470
1470
  var PREVENT_SCOPE_CHANGE = util3.toHash(["properties", "patternProperties", "enum", "dependencies", "definitions"]);
1471
- function getJsonPointer(parsedRef, baseId, schema, root) {
1471
+ function getJsonPointer(parsedRef, baseId, schema, root2) {
1472
1472
  parsedRef.fragment = parsedRef.fragment || "";
1473
1473
  if (parsedRef.fragment.slice(0, 1) != "/")
1474
1474
  return;
@@ -1487,18 +1487,18 @@ var require_resolve = __commonJS((exports, module) => {
1487
1487
  baseId = resolveUrl(baseId, id);
1488
1488
  if (schema.$ref) {
1489
1489
  var $ref = resolveUrl(baseId, schema.$ref);
1490
- var res = resolveSchema.call(this, root, $ref);
1490
+ var res = resolveSchema.call(this, root2, $ref);
1491
1491
  if (res) {
1492
1492
  schema = res.schema;
1493
- root = res.root;
1493
+ root2 = res.root;
1494
1494
  baseId = res.baseId;
1495
1495
  }
1496
1496
  }
1497
1497
  }
1498
1498
  }
1499
1499
  }
1500
- if (schema !== undefined && schema !== root.schema)
1501
- return { schema, root, baseId };
1500
+ if (schema !== undefined && schema !== root2.schema)
1501
+ return { schema, root: root2, baseId };
1502
1502
  }
1503
1503
  var SIMPLE_INLINED = util3.toHash([
1504
1504
  "type",
@@ -1593,20 +1593,20 @@ var require_resolve = __commonJS((exports, module) => {
1593
1593
  var baseIds = { "": schemaId };
1594
1594
  var fullPaths = { "": getFullPath(schemaId, false) };
1595
1595
  var localRefs = {};
1596
- var self = this;
1596
+ var self2 = this;
1597
1597
  traverse(schema, { allKeys: true }, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
1598
1598
  if (jsonPtr === "")
1599
1599
  return;
1600
- var id = self._getId(sch);
1600
+ var id = self2._getId(sch);
1601
1601
  var baseId = baseIds[parentJsonPtr];
1602
1602
  var fullPath = fullPaths[parentJsonPtr] + "/" + parentKeyword;
1603
1603
  if (keyIndex !== undefined)
1604
1604
  fullPath += "/" + (typeof keyIndex == "number" ? keyIndex : util3.escapeFragment(keyIndex));
1605
1605
  if (typeof id == "string") {
1606
1606
  id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
1607
- var refVal = self._refs[id];
1607
+ var refVal = self2._refs[id];
1608
1608
  if (typeof refVal == "string")
1609
- refVal = self._refs[refVal];
1609
+ refVal = self2._refs[refVal];
1610
1610
  if (refVal && refVal.schema) {
1611
1611
  if (!equal(sch, refVal.schema))
1612
1612
  throw new Error('id "' + id + '" resolves to more than one schema');
@@ -1616,7 +1616,7 @@ var require_resolve = __commonJS((exports, module) => {
1616
1616
  throw new Error('id "' + id + '" resolves to more than one schema');
1617
1617
  localRefs[id] = sch;
1618
1618
  } else {
1619
- self._refs[id] = fullPath;
1619
+ self2._refs[id] = fullPath;
1620
1620
  }
1621
1621
  }
1622
1622
  }
@@ -2196,17 +2196,17 @@ var require_compile = __commonJS((exports, module) => {
2196
2196
  var equal = require_fast_deep_equal();
2197
2197
  var ValidationError = errorClasses.Validation;
2198
2198
  module.exports = compile;
2199
- function compile(schema, root, localRefs, baseId) {
2200
- var self = this, opts = this._opts, refVal = [undefined], refs = {}, patterns = [], patternsHash = {}, defaults = [], defaultsHash = {}, customRules = [];
2201
- root = root || { schema, refVal, refs };
2202
- var c = checkCompiling.call(this, schema, root, baseId);
2199
+ function compile(schema, root2, localRefs, baseId) {
2200
+ var self2 = this, opts = this._opts, refVal = [undefined], refs = {}, patterns = [], patternsHash = {}, defaults = [], defaultsHash = {}, customRules = [];
2201
+ root2 = root2 || { schema, refVal, refs };
2202
+ var c = checkCompiling.call(this, schema, root2, baseId);
2203
2203
  var compilation = this._compilations[c.index];
2204
2204
  if (c.compiling)
2205
2205
  return compilation.callValidate = callValidate;
2206
2206
  var formats = this._formats;
2207
2207
  var RULES = this.RULES;
2208
2208
  try {
2209
- var v = localCompile(schema, root, localRefs, baseId);
2209
+ var v = localCompile(schema, root2, localRefs, baseId);
2210
2210
  compilation.validate = v;
2211
2211
  var cv = compilation.callValidate;
2212
2212
  if (cv) {
@@ -2221,7 +2221,7 @@ var require_compile = __commonJS((exports, module) => {
2221
2221
  }
2222
2222
  return v;
2223
2223
  } finally {
2224
- endCompiling.call(this, schema, root, baseId);
2224
+ endCompiling.call(this, schema, root2, baseId);
2225
2225
  }
2226
2226
  function callValidate() {
2227
2227
  var validate = compilation.validate;
@@ -2231,8 +2231,8 @@ var require_compile = __commonJS((exports, module) => {
2231
2231
  }
2232
2232
  function localCompile(_schema, _root, localRefs2, baseId2) {
2233
2233
  var isRoot = !_root || _root && _root.schema == _schema;
2234
- if (_root.schema != root.schema)
2235
- return compile.call(self, _schema, _root, localRefs2, baseId2);
2234
+ if (_root.schema != root2.schema)
2235
+ return compile.call(self2, _schema, _root, localRefs2, baseId2);
2236
2236
  var $async = _schema.$async === true;
2237
2237
  var sourceCode = validateGenerator({
2238
2238
  isTop: true,
@@ -2254,8 +2254,8 @@ var require_compile = __commonJS((exports, module) => {
2254
2254
  useCustomRule,
2255
2255
  opts,
2256
2256
  formats,
2257
- logger: self.logger,
2258
- self
2257
+ logger: self2.logger,
2258
+ self: self2
2259
2259
  });
2260
2260
  sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + vars(defaults, defaultCode) + vars(customRules, customRuleCode) + sourceCode;
2261
2261
  if (opts.processCode)
@@ -2263,10 +2263,10 @@ var require_compile = __commonJS((exports, module) => {
2263
2263
  var validate;
2264
2264
  try {
2265
2265
  var makeValidate = new Function("self", "RULES", "formats", "root", "refVal", "defaults", "customRules", "equal", "ucs2length", "ValidationError", sourceCode);
2266
- validate = makeValidate(self, RULES, formats, root, refVal, defaults, customRules, equal, ucs2length, ValidationError);
2266
+ validate = makeValidate(self2, RULES, formats, root2, refVal, defaults, customRules, equal, ucs2length, ValidationError);
2267
2267
  refVal[0] = validate;
2268
2268
  } catch (e) {
2269
- self.logger.error("Error compiling schema, function code:", sourceCode);
2269
+ self2.logger.error("Error compiling schema, function code:", sourceCode);
2270
2270
  throw e;
2271
2271
  }
2272
2272
  validate.schema = _schema;
@@ -2294,20 +2294,20 @@ var require_compile = __commonJS((exports, module) => {
2294
2294
  refCode = "refVal[" + refIndex + "]";
2295
2295
  return resolvedRef(_refVal, refCode);
2296
2296
  }
2297
- if (!isRoot && root.refs) {
2298
- var rootRefId = root.refs[ref];
2297
+ if (!isRoot && root2.refs) {
2298
+ var rootRefId = root2.refs[ref];
2299
2299
  if (rootRefId !== undefined) {
2300
- _refVal = root.refVal[rootRefId];
2300
+ _refVal = root2.refVal[rootRefId];
2301
2301
  refCode = addLocalRef(ref, _refVal);
2302
2302
  return resolvedRef(_refVal, refCode);
2303
2303
  }
2304
2304
  }
2305
2305
  refCode = addLocalRef(ref);
2306
- var v2 = resolve.call(self, localCompile, root, ref);
2306
+ var v2 = resolve.call(self2, localCompile, root2, ref);
2307
2307
  if (v2 === undefined) {
2308
2308
  var localSchema = localRefs && localRefs[ref];
2309
2309
  if (localSchema) {
2310
- v2 = resolve.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self, localSchema, root, localRefs, baseId2);
2310
+ v2 = resolve.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root2, localRefs, baseId2);
2311
2311
  }
2312
2312
  }
2313
2313
  if (v2 === undefined) {
@@ -2361,7 +2361,7 @@ var require_compile = __commonJS((exports, module) => {
2361
2361
  }
2362
2362
  }
2363
2363
  function useCustomRule(rule, schema2, parentSchema, it) {
2364
- if (self._opts.validateSchema !== false) {
2364
+ if (self2._opts.validateSchema !== false) {
2365
2365
  var deps = rule.definition.dependencies;
2366
2366
  if (deps && !deps.every(function(keyword) {
2367
2367
  return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
@@ -2371,9 +2371,9 @@ var require_compile = __commonJS((exports, module) => {
2371
2371
  if (validateSchema) {
2372
2372
  var valid = validateSchema(schema2);
2373
2373
  if (!valid) {
2374
- var message = "keyword schema is invalid: " + self.errorsText(validateSchema.errors);
2375
- if (self._opts.validateSchema == "log")
2376
- self.logger.error(message);
2374
+ var message = "keyword schema is invalid: " + self2.errorsText(validateSchema.errors);
2375
+ if (self2._opts.validateSchema == "log")
2376
+ self2.logger.error(message);
2377
2377
  else
2378
2378
  throw new Error(message);
2379
2379
  }
@@ -2382,13 +2382,13 @@ var require_compile = __commonJS((exports, module) => {
2382
2382
  var compile2 = rule.definition.compile, inline = rule.definition.inline, macro = rule.definition.macro;
2383
2383
  var validate;
2384
2384
  if (compile2) {
2385
- validate = compile2.call(self, schema2, parentSchema, it);
2385
+ validate = compile2.call(self2, schema2, parentSchema, it);
2386
2386
  } else if (macro) {
2387
- validate = macro.call(self, schema2, parentSchema, it);
2387
+ validate = macro.call(self2, schema2, parentSchema, it);
2388
2388
  if (opts.validateSchema !== false)
2389
- self.validateSchema(validate, true);
2389
+ self2.validateSchema(validate, true);
2390
2390
  } else if (inline) {
2391
- validate = inline.call(self, it, rule.keyword, schema2, parentSchema);
2391
+ validate = inline.call(self2, it, rule.keyword, schema2, parentSchema);
2392
2392
  } else {
2393
2393
  validate = rule.definition.validate;
2394
2394
  if (!validate)
@@ -2404,27 +2404,27 @@ var require_compile = __commonJS((exports, module) => {
2404
2404
  };
2405
2405
  }
2406
2406
  }
2407
- function checkCompiling(schema, root, baseId) {
2408
- var index = compIndex.call(this, schema, root, baseId);
2407
+ function checkCompiling(schema, root2, baseId) {
2408
+ var index = compIndex.call(this, schema, root2, baseId);
2409
2409
  if (index >= 0)
2410
2410
  return { index, compiling: true };
2411
2411
  index = this._compilations.length;
2412
2412
  this._compilations[index] = {
2413
2413
  schema,
2414
- root,
2414
+ root: root2,
2415
2415
  baseId
2416
2416
  };
2417
2417
  return { index, compiling: false };
2418
2418
  }
2419
- function endCompiling(schema, root, baseId) {
2420
- var i = compIndex.call(this, schema, root, baseId);
2419
+ function endCompiling(schema, root2, baseId) {
2420
+ var i = compIndex.call(this, schema, root2, baseId);
2421
2421
  if (i >= 0)
2422
2422
  this._compilations.splice(i, 1);
2423
2423
  }
2424
- function compIndex(schema, root, baseId) {
2424
+ function compIndex(schema, root2, baseId) {
2425
2425
  for (var i = 0;i < this._compilations.length; i++) {
2426
2426
  var c = this._compilations[i];
2427
- if (c.schema == schema && c.root == root && c.baseId == baseId)
2427
+ if (c.schema == schema && c.root == root2 && c.baseId == baseId)
2428
2428
  return i;
2429
2429
  }
2430
2430
  return -1;
@@ -5210,7 +5210,7 @@ var require_async = __commonJS((exports, module) => {
5210
5210
  var MissingRefError = require_error_classes().MissingRef;
5211
5211
  module.exports = compileAsync;
5212
5212
  function compileAsync(schema, meta, callback) {
5213
- var self = this;
5213
+ var self2 = this;
5214
5214
  if (typeof this._opts.loadSchema != "function")
5215
5215
  throw new Error("options.loadSchema should be a function");
5216
5216
  if (typeof meta == "function") {
@@ -5218,7 +5218,7 @@ var require_async = __commonJS((exports, module) => {
5218
5218
  meta = undefined;
5219
5219
  }
5220
5220
  var p = loadMetaSchemaOf(schema).then(function() {
5221
- var schemaObj = self._addSchema(schema, undefined, meta);
5221
+ var schemaObj = self2._addSchema(schema, undefined, meta);
5222
5222
  return schemaObj.validate || _compileAsync(schemaObj);
5223
5223
  });
5224
5224
  if (callback) {
@@ -5229,11 +5229,11 @@ var require_async = __commonJS((exports, module) => {
5229
5229
  return p;
5230
5230
  function loadMetaSchemaOf(sch) {
5231
5231
  var $schema = sch.$schema;
5232
- return $schema && !self.getSchema($schema) ? compileAsync.call(self, { $ref: $schema }, true) : Promise.resolve();
5232
+ return $schema && !self2.getSchema($schema) ? compileAsync.call(self2, { $ref: $schema }, true) : Promise.resolve();
5233
5233
  }
5234
5234
  function _compileAsync(schemaObj) {
5235
5235
  try {
5236
- return self._compile(schemaObj);
5236
+ return self2._compile(schemaObj);
5237
5237
  } catch (e) {
5238
5238
  if (e instanceof MissingRefError)
5239
5239
  return loadMissingSchema(e);
@@ -5243,26 +5243,26 @@ var require_async = __commonJS((exports, module) => {
5243
5243
  var ref = e.missingSchema;
5244
5244
  if (added(ref))
5245
5245
  throw new Error("Schema " + ref + " is loaded but " + e.missingRef + " cannot be resolved");
5246
- var schemaPromise = self._loadingSchemas[ref];
5246
+ var schemaPromise = self2._loadingSchemas[ref];
5247
5247
  if (!schemaPromise) {
5248
- schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
5248
+ schemaPromise = self2._loadingSchemas[ref] = self2._opts.loadSchema(ref);
5249
5249
  schemaPromise.then(removePromise, removePromise);
5250
5250
  }
5251
5251
  return schemaPromise.then(function(sch) {
5252
5252
  if (!added(ref)) {
5253
5253
  return loadMetaSchemaOf(sch).then(function() {
5254
5254
  if (!added(ref))
5255
- self.addSchema(sch, ref, undefined, meta);
5255
+ self2.addSchema(sch, ref, undefined, meta);
5256
5256
  });
5257
5257
  }
5258
5258
  }).then(function() {
5259
5259
  return _compileAsync(schemaObj);
5260
5260
  });
5261
5261
  function removePromise() {
5262
- delete self._loadingSchemas[ref];
5262
+ delete self2._loadingSchemas[ref];
5263
5263
  }
5264
5264
  function added(ref2) {
5265
- return self._refs[ref2] || self._schemas[ref2];
5265
+ return self2._refs[ref2] || self2._schemas[ref2];
5266
5266
  }
5267
5267
  }
5268
5268
  }
@@ -5945,10 +5945,10 @@ var require_ajv = __commonJS((exports, module) => {
5945
5945
  }
5946
5946
  return valid;
5947
5947
  }
5948
- function defaultMeta(self) {
5949
- var meta = self._opts.meta;
5950
- self._opts.defaultMeta = typeof meta == "object" ? self._getId(meta) || meta : self.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined;
5951
- return self._opts.defaultMeta;
5948
+ function defaultMeta(self2) {
5949
+ var meta = self2._opts.meta;
5950
+ self2._opts.defaultMeta = typeof meta == "object" ? self2._getId(meta) || meta : self2.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined;
5951
+ return self2._opts.defaultMeta;
5952
5952
  }
5953
5953
  function getSchema(keyRef) {
5954
5954
  var schemaObj = _getSchemaObj(this, keyRef);
@@ -5961,25 +5961,25 @@ var require_ajv = __commonJS((exports, module) => {
5961
5961
  return _getSchemaFragment(this, keyRef);
5962
5962
  }
5963
5963
  }
5964
- function _getSchemaFragment(self, ref) {
5965
- var res = resolve.schema.call(self, { schema: {} }, ref);
5964
+ function _getSchemaFragment(self2, ref) {
5965
+ var res = resolve.schema.call(self2, { schema: {} }, ref);
5966
5966
  if (res) {
5967
- var { schema, root, baseId } = res;
5968
- var v = compileSchema.call(self, schema, root, undefined, baseId);
5969
- self._fragments[ref] = new SchemaObject({
5967
+ var { schema, root: root2, baseId } = res;
5968
+ var v = compileSchema.call(self2, schema, root2, undefined, baseId);
5969
+ self2._fragments[ref] = new SchemaObject({
5970
5970
  ref,
5971
5971
  fragment: true,
5972
5972
  schema,
5973
- root,
5973
+ root: root2,
5974
5974
  baseId,
5975
5975
  validate: v
5976
5976
  });
5977
5977
  return v;
5978
5978
  }
5979
5979
  }
5980
- function _getSchemaObj(self, keyRef) {
5980
+ function _getSchemaObj(self2, keyRef) {
5981
5981
  keyRef = resolve.normalizeId(keyRef);
5982
- return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
5982
+ return self2._schemas[keyRef] || self2._refs[keyRef] || self2._fragments[keyRef];
5983
5983
  }
5984
5984
  function removeSchema(schemaKeyRef) {
5985
5985
  if (schemaKeyRef instanceof RegExp) {
@@ -6013,11 +6013,11 @@ var require_ajv = __commonJS((exports, module) => {
6013
6013
  }
6014
6014
  return this;
6015
6015
  }
6016
- function _removeAllSchemas(self, schemas, regex) {
6016
+ function _removeAllSchemas(self2, schemas, regex) {
6017
6017
  for (var keyRef in schemas) {
6018
6018
  var schemaObj = schemas[keyRef];
6019
6019
  if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
6020
- self._cache.del(schemaObj.cacheKey);
6020
+ self2._cache.del(schemaObj.cacheKey);
6021
6021
  delete schemas[keyRef];
6022
6022
  }
6023
6023
  }
@@ -6053,12 +6053,12 @@ var require_ajv = __commonJS((exports, module) => {
6053
6053
  this.validateSchema(schema, true);
6054
6054
  return schemaObj;
6055
6055
  }
6056
- function _compile(schemaObj, root) {
6056
+ function _compile(schemaObj, root2) {
6057
6057
  if (schemaObj.compiling) {
6058
6058
  schemaObj.validate = callValidate;
6059
6059
  callValidate.schema = schemaObj.schema;
6060
6060
  callValidate.errors = null;
6061
- callValidate.root = root ? root : callValidate;
6061
+ callValidate.root = root2 ? root2 : callValidate;
6062
6062
  if (schemaObj.schema.$async === true)
6063
6063
  callValidate.$async = true;
6064
6064
  return callValidate;
@@ -6071,7 +6071,7 @@ var require_ajv = __commonJS((exports, module) => {
6071
6071
  }
6072
6072
  var v;
6073
6073
  try {
6074
- v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs);
6074
+ v = compileSchema.call(this, schemaObj.schema, root2, schemaObj.localRefs);
6075
6075
  } catch (e) {
6076
6076
  delete schemaObj.validate;
6077
6077
  throw e;
@@ -6138,69 +6138,69 @@ var require_ajv = __commonJS((exports, module) => {
6138
6138
  this._formats[name] = format;
6139
6139
  return this;
6140
6140
  }
6141
- function addDefaultMetaSchema(self) {
6141
+ function addDefaultMetaSchema(self2) {
6142
6142
  var $dataSchema;
6143
- if (self._opts.$data) {
6143
+ if (self2._opts.$data) {
6144
6144
  $dataSchema = require_data2();
6145
- self.addMetaSchema($dataSchema, $dataSchema.$id, true);
6145
+ self2.addMetaSchema($dataSchema, $dataSchema.$id, true);
6146
6146
  }
6147
- if (self._opts.meta === false)
6147
+ if (self2._opts.meta === false)
6148
6148
  return;
6149
6149
  var metaSchema = require_json_schema_draft_07();
6150
- if (self._opts.$data)
6150
+ if (self2._opts.$data)
6151
6151
  metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
6152
- self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
6153
- self._refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
6152
+ self2.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
6153
+ self2._refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
6154
6154
  }
6155
- function addInitialSchemas(self) {
6156
- var optsSchemas = self._opts.schemas;
6155
+ function addInitialSchemas(self2) {
6156
+ var optsSchemas = self2._opts.schemas;
6157
6157
  if (!optsSchemas)
6158
6158
  return;
6159
6159
  if (Array.isArray(optsSchemas))
6160
- self.addSchema(optsSchemas);
6160
+ self2.addSchema(optsSchemas);
6161
6161
  else
6162
6162
  for (var key in optsSchemas)
6163
- self.addSchema(optsSchemas[key], key);
6163
+ self2.addSchema(optsSchemas[key], key);
6164
6164
  }
6165
- function addInitialFormats(self) {
6166
- for (var name in self._opts.formats) {
6167
- var format = self._opts.formats[name];
6168
- self.addFormat(name, format);
6165
+ function addInitialFormats(self2) {
6166
+ for (var name in self2._opts.formats) {
6167
+ var format = self2._opts.formats[name];
6168
+ self2.addFormat(name, format);
6169
6169
  }
6170
6170
  }
6171
- function addInitialKeywords(self) {
6172
- for (var name in self._opts.keywords) {
6173
- var keyword = self._opts.keywords[name];
6174
- self.addKeyword(name, keyword);
6171
+ function addInitialKeywords(self2) {
6172
+ for (var name in self2._opts.keywords) {
6173
+ var keyword = self2._opts.keywords[name];
6174
+ self2.addKeyword(name, keyword);
6175
6175
  }
6176
6176
  }
6177
- function checkUnique(self, id) {
6178
- if (self._schemas[id] || self._refs[id])
6177
+ function checkUnique(self2, id) {
6178
+ if (self2._schemas[id] || self2._refs[id])
6179
6179
  throw new Error('schema with key or id "' + id + '" already exists');
6180
6180
  }
6181
- function getMetaSchemaOptions(self) {
6182
- var metaOpts = util3.copy(self._opts);
6181
+ function getMetaSchemaOptions(self2) {
6182
+ var metaOpts = util3.copy(self2._opts);
6183
6183
  for (var i = 0;i < META_IGNORE_OPTIONS.length; i++)
6184
6184
  delete metaOpts[META_IGNORE_OPTIONS[i]];
6185
6185
  return metaOpts;
6186
6186
  }
6187
- function setLogger(self) {
6188
- var logger = self._opts.logger;
6187
+ function setLogger(self2) {
6188
+ var logger = self2._opts.logger;
6189
6189
  if (logger === false) {
6190
- self.logger = { log: noop, warn: noop, error: noop };
6190
+ self2.logger = { log: noop, warn: noop, error: noop };
6191
6191
  } else {
6192
6192
  if (logger === undefined)
6193
6193
  logger = console;
6194
6194
  if (!(typeof logger == "object" && logger.log && logger.warn && logger.error))
6195
6195
  throw new Error("logger must implement log, warn and error methods");
6196
- self.logger = logger;
6196
+ self2.logger = logger;
6197
6197
  }
6198
6198
  }
6199
6199
  function noop() {}
6200
6200
  });
6201
6201
 
6202
6202
  // src/entrypoints/sdk.ts
6203
- import { join } from "path";
6203
+ import { join as join3 } from "path";
6204
6204
  import { fileURLToPath } from "url";
6205
6205
 
6206
6206
  // src/utils/abortController.ts
@@ -6484,10 +6484,7 @@ class ProcessTransport {
6484
6484
  this.childStdout = this.child.stdout;
6485
6485
  if (env.DEBUG || stderr) {
6486
6486
  this.child.stderr.on("data", (data) => {
6487
- this.logForDebugging(`Claude Code stderr: ${data.toString()}`);
6488
- if (stderr) {
6489
- stderr(data.toString());
6490
- }
6487
+ this.logForDebugging(data.toString());
6491
6488
  });
6492
6489
  }
6493
6490
  const cleanup = () => {
@@ -6789,6 +6786,668 @@ class SdkControlServerTransport {
6789
6786
  }
6790
6787
  }
6791
6788
 
6789
+ // node_modules/lodash-es/_freeGlobal.js
6790
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
6791
+ var _freeGlobal_default = freeGlobal;
6792
+
6793
+ // node_modules/lodash-es/_root.js
6794
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
6795
+ var root = _freeGlobal_default || freeSelf || Function("return this")();
6796
+ var _root_default = root;
6797
+
6798
+ // node_modules/lodash-es/_Symbol.js
6799
+ var Symbol2 = _root_default.Symbol;
6800
+ var _Symbol_default = Symbol2;
6801
+
6802
+ // node_modules/lodash-es/_getRawTag.js
6803
+ var objectProto = Object.prototype;
6804
+ var hasOwnProperty = objectProto.hasOwnProperty;
6805
+ var nativeObjectToString = objectProto.toString;
6806
+ var symToStringTag = _Symbol_default ? _Symbol_default.toStringTag : undefined;
6807
+ function getRawTag(value) {
6808
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
6809
+ try {
6810
+ value[symToStringTag] = undefined;
6811
+ var unmasked = true;
6812
+ } catch (e) {}
6813
+ var result = nativeObjectToString.call(value);
6814
+ if (unmasked) {
6815
+ if (isOwn) {
6816
+ value[symToStringTag] = tag;
6817
+ } else {
6818
+ delete value[symToStringTag];
6819
+ }
6820
+ }
6821
+ return result;
6822
+ }
6823
+ var _getRawTag_default = getRawTag;
6824
+
6825
+ // node_modules/lodash-es/_objectToString.js
6826
+ var objectProto2 = Object.prototype;
6827
+ var nativeObjectToString2 = objectProto2.toString;
6828
+ function objectToString(value) {
6829
+ return nativeObjectToString2.call(value);
6830
+ }
6831
+ var _objectToString_default = objectToString;
6832
+
6833
+ // node_modules/lodash-es/_baseGetTag.js
6834
+ var nullTag = "[object Null]";
6835
+ var undefinedTag = "[object Undefined]";
6836
+ var symToStringTag2 = _Symbol_default ? _Symbol_default.toStringTag : undefined;
6837
+ function baseGetTag(value) {
6838
+ if (value == null) {
6839
+ return value === undefined ? undefinedTag : nullTag;
6840
+ }
6841
+ return symToStringTag2 && symToStringTag2 in Object(value) ? _getRawTag_default(value) : _objectToString_default(value);
6842
+ }
6843
+ var _baseGetTag_default = baseGetTag;
6844
+
6845
+ // node_modules/lodash-es/isObject.js
6846
+ function isObject(value) {
6847
+ var type = typeof value;
6848
+ return value != null && (type == "object" || type == "function");
6849
+ }
6850
+ var isObject_default = isObject;
6851
+
6852
+ // node_modules/lodash-es/isFunction.js
6853
+ var asyncTag = "[object AsyncFunction]";
6854
+ var funcTag = "[object Function]";
6855
+ var genTag = "[object GeneratorFunction]";
6856
+ var proxyTag = "[object Proxy]";
6857
+ function isFunction(value) {
6858
+ if (!isObject_default(value)) {
6859
+ return false;
6860
+ }
6861
+ var tag = _baseGetTag_default(value);
6862
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
6863
+ }
6864
+ var isFunction_default = isFunction;
6865
+
6866
+ // node_modules/lodash-es/_coreJsData.js
6867
+ var coreJsData = _root_default["__core-js_shared__"];
6868
+ var _coreJsData_default = coreJsData;
6869
+
6870
+ // node_modules/lodash-es/_isMasked.js
6871
+ var maskSrcKey = function() {
6872
+ var uid = /[^.]+$/.exec(_coreJsData_default && _coreJsData_default.keys && _coreJsData_default.keys.IE_PROTO || "");
6873
+ return uid ? "Symbol(src)_1." + uid : "";
6874
+ }();
6875
+ function isMasked(func) {
6876
+ return !!maskSrcKey && maskSrcKey in func;
6877
+ }
6878
+ var _isMasked_default = isMasked;
6879
+
6880
+ // node_modules/lodash-es/_toSource.js
6881
+ var funcProto = Function.prototype;
6882
+ var funcToString = funcProto.toString;
6883
+ function toSource(func) {
6884
+ if (func != null) {
6885
+ try {
6886
+ return funcToString.call(func);
6887
+ } catch (e) {}
6888
+ try {
6889
+ return func + "";
6890
+ } catch (e) {}
6891
+ }
6892
+ return "";
6893
+ }
6894
+ var _toSource_default = toSource;
6895
+
6896
+ // node_modules/lodash-es/_baseIsNative.js
6897
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
6898
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
6899
+ var funcProto2 = Function.prototype;
6900
+ var objectProto3 = Object.prototype;
6901
+ var funcToString2 = funcProto2.toString;
6902
+ var hasOwnProperty2 = objectProto3.hasOwnProperty;
6903
+ var reIsNative = RegExp("^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
6904
+ function baseIsNative(value) {
6905
+ if (!isObject_default(value) || _isMasked_default(value)) {
6906
+ return false;
6907
+ }
6908
+ var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
6909
+ return pattern.test(_toSource_default(value));
6910
+ }
6911
+ var _baseIsNative_default = baseIsNative;
6912
+
6913
+ // node_modules/lodash-es/_getValue.js
6914
+ function getValue(object, key) {
6915
+ return object == null ? undefined : object[key];
6916
+ }
6917
+ var _getValue_default = getValue;
6918
+
6919
+ // node_modules/lodash-es/_getNative.js
6920
+ function getNative(object, key) {
6921
+ var value = _getValue_default(object, key);
6922
+ return _baseIsNative_default(value) ? value : undefined;
6923
+ }
6924
+ var _getNative_default = getNative;
6925
+
6926
+ // node_modules/lodash-es/eq.js
6927
+ function eq(value, other) {
6928
+ return value === other || value !== value && other !== other;
6929
+ }
6930
+ var eq_default = eq;
6931
+
6932
+ // node_modules/lodash-es/_nativeCreate.js
6933
+ var nativeCreate = _getNative_default(Object, "create");
6934
+ var _nativeCreate_default = nativeCreate;
6935
+
6936
+ // node_modules/lodash-es/_hashClear.js
6937
+ function hashClear() {
6938
+ this.__data__ = _nativeCreate_default ? _nativeCreate_default(null) : {};
6939
+ this.size = 0;
6940
+ }
6941
+ var _hashClear_default = hashClear;
6942
+
6943
+ // node_modules/lodash-es/_hashDelete.js
6944
+ function hashDelete(key) {
6945
+ var result = this.has(key) && delete this.__data__[key];
6946
+ this.size -= result ? 1 : 0;
6947
+ return result;
6948
+ }
6949
+ var _hashDelete_default = hashDelete;
6950
+
6951
+ // node_modules/lodash-es/_hashGet.js
6952
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
6953
+ var objectProto4 = Object.prototype;
6954
+ var hasOwnProperty3 = objectProto4.hasOwnProperty;
6955
+ function hashGet(key) {
6956
+ var data = this.__data__;
6957
+ if (_nativeCreate_default) {
6958
+ var result = data[key];
6959
+ return result === HASH_UNDEFINED ? undefined : result;
6960
+ }
6961
+ return hasOwnProperty3.call(data, key) ? data[key] : undefined;
6962
+ }
6963
+ var _hashGet_default = hashGet;
6964
+
6965
+ // node_modules/lodash-es/_hashHas.js
6966
+ var objectProto5 = Object.prototype;
6967
+ var hasOwnProperty4 = objectProto5.hasOwnProperty;
6968
+ function hashHas(key) {
6969
+ var data = this.__data__;
6970
+ return _nativeCreate_default ? data[key] !== undefined : hasOwnProperty4.call(data, key);
6971
+ }
6972
+ var _hashHas_default = hashHas;
6973
+
6974
+ // node_modules/lodash-es/_hashSet.js
6975
+ var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
6976
+ function hashSet(key, value) {
6977
+ var data = this.__data__;
6978
+ this.size += this.has(key) ? 0 : 1;
6979
+ data[key] = _nativeCreate_default && value === undefined ? HASH_UNDEFINED2 : value;
6980
+ return this;
6981
+ }
6982
+ var _hashSet_default = hashSet;
6983
+
6984
+ // node_modules/lodash-es/_Hash.js
6985
+ function Hash(entries) {
6986
+ var index = -1, length = entries == null ? 0 : entries.length;
6987
+ this.clear();
6988
+ while (++index < length) {
6989
+ var entry = entries[index];
6990
+ this.set(entry[0], entry[1]);
6991
+ }
6992
+ }
6993
+ Hash.prototype.clear = _hashClear_default;
6994
+ Hash.prototype["delete"] = _hashDelete_default;
6995
+ Hash.prototype.get = _hashGet_default;
6996
+ Hash.prototype.has = _hashHas_default;
6997
+ Hash.prototype.set = _hashSet_default;
6998
+ var _Hash_default = Hash;
6999
+
7000
+ // node_modules/lodash-es/_listCacheClear.js
7001
+ function listCacheClear() {
7002
+ this.__data__ = [];
7003
+ this.size = 0;
7004
+ }
7005
+ var _listCacheClear_default = listCacheClear;
7006
+
7007
+ // node_modules/lodash-es/_assocIndexOf.js
7008
+ function assocIndexOf(array, key) {
7009
+ var length = array.length;
7010
+ while (length--) {
7011
+ if (eq_default(array[length][0], key)) {
7012
+ return length;
7013
+ }
7014
+ }
7015
+ return -1;
7016
+ }
7017
+ var _assocIndexOf_default = assocIndexOf;
7018
+
7019
+ // node_modules/lodash-es/_listCacheDelete.js
7020
+ var arrayProto = Array.prototype;
7021
+ var splice = arrayProto.splice;
7022
+ function listCacheDelete(key) {
7023
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
7024
+ if (index < 0) {
7025
+ return false;
7026
+ }
7027
+ var lastIndex = data.length - 1;
7028
+ if (index == lastIndex) {
7029
+ data.pop();
7030
+ } else {
7031
+ splice.call(data, index, 1);
7032
+ }
7033
+ --this.size;
7034
+ return true;
7035
+ }
7036
+ var _listCacheDelete_default = listCacheDelete;
7037
+
7038
+ // node_modules/lodash-es/_listCacheGet.js
7039
+ function listCacheGet(key) {
7040
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
7041
+ return index < 0 ? undefined : data[index][1];
7042
+ }
7043
+ var _listCacheGet_default = listCacheGet;
7044
+
7045
+ // node_modules/lodash-es/_listCacheHas.js
7046
+ function listCacheHas(key) {
7047
+ return _assocIndexOf_default(this.__data__, key) > -1;
7048
+ }
7049
+ var _listCacheHas_default = listCacheHas;
7050
+
7051
+ // node_modules/lodash-es/_listCacheSet.js
7052
+ function listCacheSet(key, value) {
7053
+ var data = this.__data__, index = _assocIndexOf_default(data, key);
7054
+ if (index < 0) {
7055
+ ++this.size;
7056
+ data.push([key, value]);
7057
+ } else {
7058
+ data[index][1] = value;
7059
+ }
7060
+ return this;
7061
+ }
7062
+ var _listCacheSet_default = listCacheSet;
7063
+
7064
+ // node_modules/lodash-es/_ListCache.js
7065
+ function ListCache(entries) {
7066
+ var index = -1, length = entries == null ? 0 : entries.length;
7067
+ this.clear();
7068
+ while (++index < length) {
7069
+ var entry = entries[index];
7070
+ this.set(entry[0], entry[1]);
7071
+ }
7072
+ }
7073
+ ListCache.prototype.clear = _listCacheClear_default;
7074
+ ListCache.prototype["delete"] = _listCacheDelete_default;
7075
+ ListCache.prototype.get = _listCacheGet_default;
7076
+ ListCache.prototype.has = _listCacheHas_default;
7077
+ ListCache.prototype.set = _listCacheSet_default;
7078
+ var _ListCache_default = ListCache;
7079
+
7080
+ // node_modules/lodash-es/_Map.js
7081
+ var Map2 = _getNative_default(_root_default, "Map");
7082
+ var _Map_default = Map2;
7083
+
7084
+ // node_modules/lodash-es/_mapCacheClear.js
7085
+ function mapCacheClear() {
7086
+ this.size = 0;
7087
+ this.__data__ = {
7088
+ hash: new _Hash_default,
7089
+ map: new (_Map_default || _ListCache_default),
7090
+ string: new _Hash_default
7091
+ };
7092
+ }
7093
+ var _mapCacheClear_default = mapCacheClear;
7094
+
7095
+ // node_modules/lodash-es/_isKeyable.js
7096
+ function isKeyable(value) {
7097
+ var type = typeof value;
7098
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
7099
+ }
7100
+ var _isKeyable_default = isKeyable;
7101
+
7102
+ // node_modules/lodash-es/_getMapData.js
7103
+ function getMapData(map, key) {
7104
+ var data = map.__data__;
7105
+ return _isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
7106
+ }
7107
+ var _getMapData_default = getMapData;
7108
+
7109
+ // node_modules/lodash-es/_mapCacheDelete.js
7110
+ function mapCacheDelete(key) {
7111
+ var result = _getMapData_default(this, key)["delete"](key);
7112
+ this.size -= result ? 1 : 0;
7113
+ return result;
7114
+ }
7115
+ var _mapCacheDelete_default = mapCacheDelete;
7116
+
7117
+ // node_modules/lodash-es/_mapCacheGet.js
7118
+ function mapCacheGet(key) {
7119
+ return _getMapData_default(this, key).get(key);
7120
+ }
7121
+ var _mapCacheGet_default = mapCacheGet;
7122
+
7123
+ // node_modules/lodash-es/_mapCacheHas.js
7124
+ function mapCacheHas(key) {
7125
+ return _getMapData_default(this, key).has(key);
7126
+ }
7127
+ var _mapCacheHas_default = mapCacheHas;
7128
+
7129
+ // node_modules/lodash-es/_mapCacheSet.js
7130
+ function mapCacheSet(key, value) {
7131
+ var data = _getMapData_default(this, key), size = data.size;
7132
+ data.set(key, value);
7133
+ this.size += data.size == size ? 0 : 1;
7134
+ return this;
7135
+ }
7136
+ var _mapCacheSet_default = mapCacheSet;
7137
+
7138
+ // node_modules/lodash-es/_MapCache.js
7139
+ function MapCache(entries) {
7140
+ var index = -1, length = entries == null ? 0 : entries.length;
7141
+ this.clear();
7142
+ while (++index < length) {
7143
+ var entry = entries[index];
7144
+ this.set(entry[0], entry[1]);
7145
+ }
7146
+ }
7147
+ MapCache.prototype.clear = _mapCacheClear_default;
7148
+ MapCache.prototype["delete"] = _mapCacheDelete_default;
7149
+ MapCache.prototype.get = _mapCacheGet_default;
7150
+ MapCache.prototype.has = _mapCacheHas_default;
7151
+ MapCache.prototype.set = _mapCacheSet_default;
7152
+ var _MapCache_default = MapCache;
7153
+
7154
+ // node_modules/lodash-es/memoize.js
7155
+ var FUNC_ERROR_TEXT = "Expected a function";
7156
+ function memoize(func, resolver) {
7157
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
7158
+ throw new TypeError(FUNC_ERROR_TEXT);
7159
+ }
7160
+ var memoized = function() {
7161
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
7162
+ if (cache.has(key)) {
7163
+ return cache.get(key);
7164
+ }
7165
+ var result = func.apply(this, args);
7166
+ memoized.cache = cache.set(key, result) || cache;
7167
+ return result;
7168
+ };
7169
+ memoized.cache = new (memoize.Cache || _MapCache_default);
7170
+ return memoized;
7171
+ }
7172
+ memoize.Cache = _MapCache_default;
7173
+ var memoize_default = memoize;
7174
+ // src/utils/process.ts
7175
+ var CHUNK_SIZE = 2000;
7176
+ function writeToStderr(data) {
7177
+ for (let i = 0;i < data.length; i += CHUNK_SIZE) {
7178
+ process.stderr.write(data.substring(i, i + CHUNK_SIZE));
7179
+ }
7180
+ }
7181
+
7182
+ // src/utils/debugFilter.ts
7183
+ var parseDebugFilter = memoize_default((filterString) => {
7184
+ if (!filterString || filterString.trim() === "") {
7185
+ return null;
7186
+ }
7187
+ const filters = filterString.split(",").map((f) => f.trim()).filter(Boolean);
7188
+ if (filters.length === 0) {
7189
+ return null;
7190
+ }
7191
+ const hasExclusive = filters.some((f) => f.startsWith("!"));
7192
+ const hasInclusive = filters.some((f) => !f.startsWith("!"));
7193
+ if (hasExclusive && hasInclusive) {
7194
+ return null;
7195
+ }
7196
+ const cleanFilters = filters.map((f) => f.replace(/^!/, "").toLowerCase());
7197
+ return {
7198
+ include: hasExclusive ? [] : cleanFilters,
7199
+ exclude: hasExclusive ? cleanFilters : [],
7200
+ isExclusive: hasExclusive
7201
+ };
7202
+ });
7203
+ function extractDebugCategories(message) {
7204
+ const categories = [];
7205
+ const mcpMatch = message.match(/^MCP server ["']([^"']+)["']/);
7206
+ if (mcpMatch && mcpMatch[1]) {
7207
+ categories.push("mcp");
7208
+ categories.push(mcpMatch[1].toLowerCase());
7209
+ } else {
7210
+ const prefixMatch = message.match(/^([^:[]+):/);
7211
+ if (prefixMatch && prefixMatch[1]) {
7212
+ categories.push(prefixMatch[1].trim().toLowerCase());
7213
+ }
7214
+ }
7215
+ const bracketMatch = message.match(/^\[([^\]]+)]/);
7216
+ if (bracketMatch && bracketMatch[1]) {
7217
+ categories.push(bracketMatch[1].trim().toLowerCase());
7218
+ }
7219
+ if (message.toLowerCase().includes("statsig event:")) {
7220
+ categories.push("statsig");
7221
+ }
7222
+ const secondaryMatch = message.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);
7223
+ if (secondaryMatch && secondaryMatch[1]) {
7224
+ const secondary = secondaryMatch[1].trim().toLowerCase();
7225
+ if (secondary.length < 30 && !secondary.includes(" ")) {
7226
+ categories.push(secondary);
7227
+ }
7228
+ }
7229
+ return Array.from(new Set(categories));
7230
+ }
7231
+ function shouldShowDebugCategories(categories, filter) {
7232
+ if (!filter) {
7233
+ return true;
7234
+ }
7235
+ if (categories.length === 0) {
7236
+ return false;
7237
+ }
7238
+ if (filter.isExclusive) {
7239
+ return !categories.some((cat) => filter.exclude.includes(cat));
7240
+ } else {
7241
+ return categories.some((cat) => filter.include.includes(cat));
7242
+ }
7243
+ }
7244
+ function shouldShowDebugMessage(message, filter) {
7245
+ if (!filter) {
7246
+ return true;
7247
+ }
7248
+ const categories = extractDebugCategories(message);
7249
+ return shouldShowDebugCategories(categories, filter);
7250
+ }
7251
+
7252
+ // src/utils/envUtils.ts
7253
+ import { join } from "path";
7254
+ import { homedir } from "os";
7255
+ function getClaudeConfigHomeDir() {
7256
+ return process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude");
7257
+ }
7258
+ function isEnvTruthy(envVar) {
7259
+ if (!envVar)
7260
+ return false;
7261
+ if (typeof envVar === "boolean")
7262
+ return envVar;
7263
+ const normalizedValue = envVar.toLowerCase().trim();
7264
+ return ["1", "true", "yes", "on"].includes(normalizedValue);
7265
+ }
7266
+
7267
+ // src/utils/debug.ts
7268
+ import { dirname, join as join2 } from "path";
7269
+
7270
+ // src/bootstrap/state.ts
7271
+ import { cwd } from "process";
7272
+ import { randomUUID } from "crypto";
7273
+
7274
+ // src/bootstrap/envValidators.ts
7275
+ var bashMaxOutputLengthValidator = {
7276
+ name: "BASH_MAX_OUTPUT_LENGTH",
7277
+ default: 30000,
7278
+ validate: (value) => {
7279
+ const MAX_OUTPUT_LENGTH = 150000;
7280
+ const DEFAULT_MAX_OUTPUT_LENGTH = 30000;
7281
+ if (!value) {
7282
+ return {
7283
+ effective: DEFAULT_MAX_OUTPUT_LENGTH,
7284
+ status: "valid"
7285
+ };
7286
+ }
7287
+ const parsed = parseInt(value, 10);
7288
+ if (isNaN(parsed) || parsed <= 0) {
7289
+ return {
7290
+ effective: DEFAULT_MAX_OUTPUT_LENGTH,
7291
+ status: "invalid",
7292
+ message: `Invalid value "${value}" (using default: ${DEFAULT_MAX_OUTPUT_LENGTH})`
7293
+ };
7294
+ }
7295
+ if (parsed > MAX_OUTPUT_LENGTH) {
7296
+ return {
7297
+ effective: MAX_OUTPUT_LENGTH,
7298
+ status: "capped",
7299
+ message: `Capped from ${parsed} to ${MAX_OUTPUT_LENGTH}`
7300
+ };
7301
+ }
7302
+ return { effective: parsed, status: "valid" };
7303
+ }
7304
+ };
7305
+ var maxOutputTokensValidator = {
7306
+ name: "CLAUDE_CODE_MAX_OUTPUT_TOKENS",
7307
+ default: 32000,
7308
+ validate: (value) => {
7309
+ if (!value) {
7310
+ return { effective: 32000, status: "valid" };
7311
+ }
7312
+ const parsed = parseInt(value, 10);
7313
+ if (isNaN(parsed) || parsed <= 0) {
7314
+ return {
7315
+ effective: 32000,
7316
+ status: "invalid",
7317
+ message: `Invalid value "${value}" (using default: 32000)`
7318
+ };
7319
+ }
7320
+ if (parsed > 32000) {
7321
+ return {
7322
+ effective: 32000,
7323
+ status: "capped",
7324
+ message: `Capped from ${parsed} to 32000`
7325
+ };
7326
+ }
7327
+ return { effective: parsed, status: "valid" };
7328
+ }
7329
+ };
7330
+
7331
+ // src/bootstrap/state.ts
7332
+ function getInitialState() {
7333
+ return {
7334
+ originalCwd: cwd(),
7335
+ totalCostUSD: 0,
7336
+ totalAPIDuration: 0,
7337
+ totalAPIDurationWithoutRetries: 0,
7338
+ totalToolDuration: 0,
7339
+ startTime: Date.now(),
7340
+ lastInteractionTime: Date.now(),
7341
+ totalLinesAdded: 0,
7342
+ totalLinesRemoved: 0,
7343
+ hasUnknownModelCost: false,
7344
+ cwd: cwd(),
7345
+ modelUsage: {},
7346
+ mainLoopModelOverride: undefined,
7347
+ maxRateLimitFallbackActive: false,
7348
+ initialMainLoopModel: null,
7349
+ modelStrings: null,
7350
+ isNonInteractiveSession: true,
7351
+ isInteractive: false,
7352
+ clientType: "cli",
7353
+ sessionIngressToken: undefined,
7354
+ oauthTokenFromFd: undefined,
7355
+ apiKeyFromFd: undefined,
7356
+ flagSettingsPath: undefined,
7357
+ allowedSettingSources: [
7358
+ "userSettings",
7359
+ "projectSettings",
7360
+ "localSettings",
7361
+ "flagSettings",
7362
+ "policySettings"
7363
+ ],
7364
+ meter: null,
7365
+ sessionCounter: null,
7366
+ locCounter: null,
7367
+ prCounter: null,
7368
+ commitCounter: null,
7369
+ costCounter: null,
7370
+ tokenCounter: null,
7371
+ codeEditToolDecisionCounter: null,
7372
+ activeTimeCounter: null,
7373
+ sessionId: randomUUID(),
7374
+ loggerProvider: null,
7375
+ eventLogger: null,
7376
+ meterProvider: null,
7377
+ agentColorMap: new Map,
7378
+ agentColorIndex: 0,
7379
+ envVarValidators: [bashMaxOutputLengthValidator, maxOutputTokensValidator],
7380
+ lastAPIRequest: null,
7381
+ inMemoryErrorLog: []
7382
+ };
7383
+ }
7384
+ var STATE = getInitialState();
7385
+ function getSessionId() {
7386
+ return STATE.sessionId;
7387
+ }
7388
+
7389
+ // src/utils/debug.ts
7390
+ var isDebugMode = memoize_default(() => {
7391
+ return isEnvTruthy(process.env.DEBUG) || isEnvTruthy(process.env.DEBUG_SDK) || process.argv.includes("--debug") || process.argv.includes("-d") || isDebugToStdErr() || process.argv.some((arg) => arg.startsWith("--debug="));
7392
+ });
7393
+ var getDebugFilter = memoize_default(() => {
7394
+ const debugArg = process.argv.find((arg) => arg.startsWith("--debug="));
7395
+ if (!debugArg) {
7396
+ return null;
7397
+ }
7398
+ const filterPattern = debugArg.substring("--debug=".length);
7399
+ return parseDebugFilter(filterPattern);
7400
+ });
7401
+ var isDebugToStdErr = memoize_default(() => {
7402
+ return process.argv.includes("--debug-to-stderr") || process.argv.includes("-d2e");
7403
+ });
7404
+ function shouldLogDebugMessage(message) {
7405
+ const filter = getDebugFilter();
7406
+ return shouldShowDebugMessage(message, filter);
7407
+ }
7408
+ var hasFormattedOutput = false;
7409
+ function logForDebugging(message, { level } = {
7410
+ level: "debug"
7411
+ }) {
7412
+ if (!shouldLogDebugMessage(message)) {
7413
+ return;
7414
+ }
7415
+ if (hasFormattedOutput && message.includes(`
7416
+ `)) {
7417
+ message = JSON.stringify(message);
7418
+ }
7419
+ const output = `[${level.toUpperCase()}] ${message.trim()}
7420
+ `;
7421
+ if (isDebugToStdErr()) {
7422
+ writeToStderr(output);
7423
+ return;
7424
+ }
7425
+ if (!getFsImplementation().existsSync(dirname(getDebugLogPath()))) {
7426
+ getFsImplementation().mkdirSync(dirname(getDebugLogPath()));
7427
+ }
7428
+ getFsImplementation().appendFileSync(getDebugLogPath(), output);
7429
+ updateLatestDebugLogSymlink();
7430
+ }
7431
+ function getDebugLogPath() {
7432
+ return process.env.CLAUDE_CODE_DEBUG_LOGS_DIR ?? join2(getClaudeConfigHomeDir(), "debug", `${getSessionId()}.txt`);
7433
+ }
7434
+ var updateLatestDebugLogSymlink = memoize_default(() => {
7435
+ try {
7436
+ const debugLogPath = getDebugLogPath();
7437
+ const debugLogsDir = dirname(debugLogPath);
7438
+ const latestSymlinkPath = join2(debugLogsDir, "latest");
7439
+ if (!getFsImplementation().existsSync(debugLogsDir)) {
7440
+ getFsImplementation().mkdirSync(debugLogsDir);
7441
+ }
7442
+ if (getFsImplementation().existsSync(latestSymlinkPath)) {
7443
+ try {
7444
+ getFsImplementation().unlinkSync(latestSymlinkPath);
7445
+ } catch {}
7446
+ }
7447
+ getFsImplementation().symlinkSync(debugLogPath, latestSymlinkPath);
7448
+ } catch {}
7449
+ });
7450
+
6792
7451
  // src/core/Query.ts
6793
7452
  class Query {
6794
7453
  transport;
@@ -7050,24 +7709,34 @@ class Query {
7050
7709
  return (await this.initialization).account;
7051
7710
  }
7052
7711
  async streamInput(stream) {
7712
+ logForDebugging(`[Query.streamInput] Starting to process input stream`);
7713
+ logForDebugging(`[Query.streamInput] this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`);
7053
7714
  try {
7715
+ let messageCount = 0;
7054
7716
  for await (const message of stream) {
7717
+ messageCount++;
7718
+ logForDebugging(`[Query.streamInput] Processing message ${messageCount}: ${message.type}`);
7055
7719
  if (this.abortController?.signal.aborted)
7056
7720
  break;
7057
7721
  await Promise.resolve(this.transport.write(JSON.stringify(message) + `
7058
7722
  `));
7059
7723
  }
7724
+ logForDebugging(`[Query.streamInput] Finished processing ${messageCount} messages from input stream`);
7725
+ logForDebugging(`[Query.streamInput] About to check MCP servers. this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`);
7060
7726
  if (this.sdkMcpTransports.size > 0 && this.firstResultReceivedPromise) {
7061
- const STREAM_CLOSE_TIMEOUT = 60000;
7727
+ logForDebugging(`[Query.streamInput] Entering Promise.race to wait for result`);
7728
+ const STREAM_CLOSE_TIMEOUT = 1e4;
7062
7729
  let timeoutId;
7063
7730
  await Promise.race([
7064
7731
  this.firstResultReceivedPromise.then(() => {
7732
+ logForDebugging(`[Query.streamInput] Received first result, closing input stream`);
7065
7733
  if (timeoutId) {
7066
7734
  clearTimeout(timeoutId);
7067
7735
  }
7068
7736
  }),
7069
7737
  new Promise((resolve) => {
7070
7738
  timeoutId = setTimeout(() => {
7739
+ logForDebugging(`[Query.streamInput] Timed out waiting for first result, closing input stream`);
7071
7740
  resolve();
7072
7741
  }, STREAM_CLOSE_TIMEOUT);
7073
7742
  })
@@ -7076,6 +7745,7 @@ class Query {
7076
7745
  clearTimeout(timeoutId);
7077
7746
  }
7078
7747
  }
7748
+ logForDebugging(`[Query] Calling transport.endInput() to close stdin to CLI process`);
7079
7749
  this.transport.endInput();
7080
7750
  } catch (error) {
7081
7751
  if (!(error instanceof AbortError)) {
@@ -7156,7 +7826,7 @@ function createSharedQuery({
7156
7826
  canUseTool,
7157
7827
  continue: continueConversation,
7158
7828
  customSystemPrompt,
7159
- cwd,
7829
+ cwd: cwd2,
7160
7830
  disallowedTools = [],
7161
7831
  env,
7162
7832
  executable = isRunningWithBun() ? "bun" : "node",
@@ -7209,7 +7879,7 @@ function createSharedQuery({
7209
7879
  abortController,
7210
7880
  additionalDirectories,
7211
7881
  agents,
7212
- cwd,
7882
+ cwd: cwd2,
7213
7883
  executable,
7214
7884
  executableArgs,
7215
7885
  extraArgs,
@@ -14144,8 +14814,8 @@ function query({
14144
14814
  let pathToClaudeCodeExecutable = options?.pathToClaudeCodeExecutable;
14145
14815
  if (!pathToClaudeCodeExecutable) {
14146
14816
  const filename = fileURLToPath(import.meta.url);
14147
- const dirname = join(filename, "..");
14148
- pathToClaudeCodeExecutable = join(dirname, "cli.js");
14817
+ const dirname2 = join3(filename, "..");
14818
+ pathToClaudeCodeExecutable = join3(dirname2, "cli.js");
14149
14819
  }
14150
14820
  return createSharedQuery({
14151
14821
  prompt,