@aiaiai-pt/martha-cli 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +401 -203
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var __export = (target, all) => {
29
29
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
30
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
31
 
32
- // node_modules/commander/lib/error.js
32
+ // ../../../../martha-cli/node_modules/commander/lib/error.js
33
33
  var require_error = __commonJS((exports) => {
34
34
  class CommanderError extends Error {
35
35
  constructor(exitCode, code, message) {
@@ -53,7 +53,7 @@ var require_error = __commonJS((exports) => {
53
53
  exports.InvalidArgumentError = InvalidArgumentError;
54
54
  });
55
55
 
56
- // node_modules/commander/lib/argument.js
56
+ // ../../../../martha-cli/node_modules/commander/lib/argument.js
57
57
  var require_argument = __commonJS((exports) => {
58
58
  var { InvalidArgumentError } = require_error();
59
59
 
@@ -133,7 +133,7 @@ var require_argument = __commonJS((exports) => {
133
133
  exports.humanReadableArgName = humanReadableArgName;
134
134
  });
135
135
 
136
- // node_modules/commander/lib/help.js
136
+ // ../../../../martha-cli/node_modules/commander/lib/help.js
137
137
  var require_help = __commonJS((exports) => {
138
138
  var { humanReadableArgName } = require_argument();
139
139
 
@@ -490,7 +490,7 @@ ${itemIndentStr}`);
490
490
  exports.stripColor = stripColor;
491
491
  });
492
492
 
493
- // node_modules/commander/lib/option.js
493
+ // ../../../../martha-cli/node_modules/commander/lib/option.js
494
494
  var require_option = __commonJS((exports) => {
495
495
  var { InvalidArgumentError } = require_error();
496
496
 
@@ -674,7 +674,7 @@ var require_option = __commonJS((exports) => {
674
674
  exports.DualOptions = DualOptions;
675
675
  });
676
676
 
677
- // node_modules/commander/lib/suggestSimilar.js
677
+ // ../../../../martha-cli/node_modules/commander/lib/suggestSimilar.js
678
678
  var require_suggestSimilar = __commonJS((exports) => {
679
679
  var maxDistance = 3;
680
680
  function editDistance(a, b) {
@@ -747,7 +747,7 @@ var require_suggestSimilar = __commonJS((exports) => {
747
747
  exports.suggestSimilar = suggestSimilar;
748
748
  });
749
749
 
750
- // node_modules/commander/lib/command.js
750
+ // ../../../../martha-cli/node_modules/commander/lib/command.js
751
751
  var require_command = __commonJS((exports) => {
752
752
  var EventEmitter = __require("node:events").EventEmitter;
753
753
  var childProcess = __require("node:child_process");
@@ -2102,7 +2102,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2102
2102
  exports.useColor = useColor;
2103
2103
  });
2104
2104
 
2105
- // node_modules/commander/index.js
2105
+ // ../../../../martha-cli/node_modules/commander/index.js
2106
2106
  var require_commander = __commonJS((exports) => {
2107
2107
  var { Argument } = require_argument();
2108
2108
  var { Command } = require_command();
@@ -2196,7 +2196,7 @@ var init_errors = __esm(() => {
2196
2196
  };
2197
2197
  });
2198
2198
 
2199
- // node_modules/yaml/dist/nodes/identity.js
2199
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/identity.js
2200
2200
  var require_identity = __commonJS((exports) => {
2201
2201
  var ALIAS = Symbol.for("yaml.alias");
2202
2202
  var DOC = Symbol.for("yaml.document");
@@ -2250,7 +2250,7 @@ var require_identity = __commonJS((exports) => {
2250
2250
  exports.isSeq = isSeq;
2251
2251
  });
2252
2252
 
2253
- // node_modules/yaml/dist/visit.js
2253
+ // ../../../../martha-cli/node_modules/yaml/dist/visit.js
2254
2254
  var require_visit = __commonJS((exports) => {
2255
2255
  var identity = require_identity();
2256
2256
  var BREAK = Symbol("break visit");
@@ -2405,7 +2405,7 @@ var require_visit = __commonJS((exports) => {
2405
2405
  exports.visitAsync = visitAsync;
2406
2406
  });
2407
2407
 
2408
- // node_modules/yaml/dist/doc/directives.js
2408
+ // ../../../../martha-cli/node_modules/yaml/dist/doc/directives.js
2409
2409
  var require_directives = __commonJS((exports) => {
2410
2410
  var identity = require_identity();
2411
2411
  var visit = require_visit();
@@ -2557,7 +2557,7 @@ var require_directives = __commonJS((exports) => {
2557
2557
  exports.Directives = Directives;
2558
2558
  });
2559
2559
 
2560
- // node_modules/yaml/dist/doc/anchors.js
2560
+ // ../../../../martha-cli/node_modules/yaml/dist/doc/anchors.js
2561
2561
  var require_anchors = __commonJS((exports) => {
2562
2562
  var identity = require_identity();
2563
2563
  var visit = require_visit();
@@ -2619,7 +2619,7 @@ var require_anchors = __commonJS((exports) => {
2619
2619
  exports.findNewAnchor = findNewAnchor;
2620
2620
  });
2621
2621
 
2622
- // node_modules/yaml/dist/doc/applyReviver.js
2622
+ // ../../../../martha-cli/node_modules/yaml/dist/doc/applyReviver.js
2623
2623
  var require_applyReviver = __commonJS((exports) => {
2624
2624
  function applyReviver(reviver, obj, key, val) {
2625
2625
  if (val && typeof val === "object") {
@@ -2666,7 +2666,7 @@ var require_applyReviver = __commonJS((exports) => {
2666
2666
  exports.applyReviver = applyReviver;
2667
2667
  });
2668
2668
 
2669
- // node_modules/yaml/dist/nodes/toJS.js
2669
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/toJS.js
2670
2670
  var require_toJS = __commonJS((exports) => {
2671
2671
  var identity = require_identity();
2672
2672
  function toJS(value, arg, ctx) {
@@ -2693,7 +2693,7 @@ var require_toJS = __commonJS((exports) => {
2693
2693
  exports.toJS = toJS;
2694
2694
  });
2695
2695
 
2696
- // node_modules/yaml/dist/nodes/Node.js
2696
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/Node.js
2697
2697
  var require_Node = __commonJS((exports) => {
2698
2698
  var applyReviver = require_applyReviver();
2699
2699
  var identity = require_identity();
@@ -2730,7 +2730,7 @@ var require_Node = __commonJS((exports) => {
2730
2730
  exports.NodeBase = NodeBase;
2731
2731
  });
2732
2732
 
2733
- // node_modules/yaml/dist/nodes/Alias.js
2733
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/Alias.js
2734
2734
  var require_Alias = __commonJS((exports) => {
2735
2735
  var anchors = require_anchors();
2736
2736
  var visit = require_visit();
@@ -2838,7 +2838,7 @@ var require_Alias = __commonJS((exports) => {
2838
2838
  exports.Alias = Alias;
2839
2839
  });
2840
2840
 
2841
- // node_modules/yaml/dist/nodes/Scalar.js
2841
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/Scalar.js
2842
2842
  var require_Scalar = __commonJS((exports) => {
2843
2843
  var identity = require_identity();
2844
2844
  var Node = require_Node();
@@ -2866,7 +2866,7 @@ var require_Scalar = __commonJS((exports) => {
2866
2866
  exports.isScalarValue = isScalarValue;
2867
2867
  });
2868
2868
 
2869
- // node_modules/yaml/dist/doc/createNode.js
2869
+ // ../../../../martha-cli/node_modules/yaml/dist/doc/createNode.js
2870
2870
  var require_createNode = __commonJS((exports) => {
2871
2871
  var Alias = require_Alias();
2872
2872
  var identity = require_identity();
@@ -2938,7 +2938,7 @@ var require_createNode = __commonJS((exports) => {
2938
2938
  exports.createNode = createNode;
2939
2939
  });
2940
2940
 
2941
- // node_modules/yaml/dist/nodes/Collection.js
2941
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/Collection.js
2942
2942
  var require_Collection = __commonJS((exports) => {
2943
2943
  var createNode = require_createNode();
2944
2944
  var identity = require_identity();
@@ -3053,7 +3053,7 @@ var require_Collection = __commonJS((exports) => {
3053
3053
  exports.isEmptyPath = isEmptyPath;
3054
3054
  });
3055
3055
 
3056
- // node_modules/yaml/dist/stringify/stringifyComment.js
3056
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyComment.js
3057
3057
  var require_stringifyComment = __commonJS((exports) => {
3058
3058
  var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
3059
3059
  function indentComment(comment, indent) {
@@ -3070,7 +3070,7 @@ var require_stringifyComment = __commonJS((exports) => {
3070
3070
  exports.stringifyComment = stringifyComment;
3071
3071
  });
3072
3072
 
3073
- // node_modules/yaml/dist/stringify/foldFlowLines.js
3073
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/foldFlowLines.js
3074
3074
  var require_foldFlowLines = __commonJS((exports) => {
3075
3075
  var FOLD_FLOW = "flow";
3076
3076
  var FOLD_BLOCK = "block";
@@ -3207,7 +3207,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
3207
3207
  exports.foldFlowLines = foldFlowLines;
3208
3208
  });
3209
3209
 
3210
- // node_modules/yaml/dist/stringify/stringifyString.js
3210
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyString.js
3211
3211
  var require_stringifyString = __commonJS((exports) => {
3212
3212
  var Scalar = require_Scalar();
3213
3213
  var foldFlowLines = require_foldFlowLines();
@@ -3505,7 +3505,7 @@ ${indent}`);
3505
3505
  exports.stringifyString = stringifyString;
3506
3506
  });
3507
3507
 
3508
- // node_modules/yaml/dist/stringify/stringify.js
3508
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringify.js
3509
3509
  var require_stringify = __commonJS((exports) => {
3510
3510
  var anchors = require_anchors();
3511
3511
  var identity = require_identity();
@@ -3626,7 +3626,7 @@ ${ctx.indent}${str}`;
3626
3626
  exports.stringify = stringify;
3627
3627
  });
3628
3628
 
3629
- // node_modules/yaml/dist/stringify/stringifyPair.js
3629
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyPair.js
3630
3630
  var require_stringifyPair = __commonJS((exports) => {
3631
3631
  var identity = require_identity();
3632
3632
  var Scalar = require_Scalar();
@@ -3762,7 +3762,7 @@ ${ctx.indent}`;
3762
3762
  exports.stringifyPair = stringifyPair;
3763
3763
  });
3764
3764
 
3765
- // node_modules/yaml/dist/log.js
3765
+ // ../../../../martha-cli/node_modules/yaml/dist/log.js
3766
3766
  var require_log = __commonJS((exports) => {
3767
3767
  var node_process = __require("process");
3768
3768
  function debug(logLevel, ...messages) {
@@ -3781,7 +3781,7 @@ var require_log = __commonJS((exports) => {
3781
3781
  exports.warn = warn;
3782
3782
  });
3783
3783
 
3784
- // node_modules/yaml/dist/schema/yaml-1.1/merge.js
3784
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/merge.js
3785
3785
  var require_merge = __commonJS((exports) => {
3786
3786
  var identity = require_identity();
3787
3787
  var Scalar = require_Scalar();
@@ -3835,7 +3835,7 @@ var require_merge = __commonJS((exports) => {
3835
3835
  exports.merge = merge;
3836
3836
  });
3837
3837
 
3838
- // node_modules/yaml/dist/nodes/addPairToJSMap.js
3838
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/addPairToJSMap.js
3839
3839
  var require_addPairToJSMap = __commonJS((exports) => {
3840
3840
  var log = require_log();
3841
3841
  var merge = require_merge();
@@ -3896,7 +3896,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
3896
3896
  exports.addPairToJSMap = addPairToJSMap;
3897
3897
  });
3898
3898
 
3899
- // node_modules/yaml/dist/nodes/Pair.js
3899
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/Pair.js
3900
3900
  var require_Pair = __commonJS((exports) => {
3901
3901
  var createNode = require_createNode();
3902
3902
  var stringifyPair = require_stringifyPair();
@@ -3934,7 +3934,7 @@ var require_Pair = __commonJS((exports) => {
3934
3934
  exports.createPair = createPair;
3935
3935
  });
3936
3936
 
3937
- // node_modules/yaml/dist/stringify/stringifyCollection.js
3937
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyCollection.js
3938
3938
  var require_stringifyCollection = __commonJS((exports) => {
3939
3939
  var identity = require_identity();
3940
3940
  var stringify = require_stringify();
@@ -4086,7 +4086,7 @@ ${indent}${end}`;
4086
4086
  exports.stringifyCollection = stringifyCollection;
4087
4087
  });
4088
4088
 
4089
- // node_modules/yaml/dist/nodes/YAMLMap.js
4089
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/YAMLMap.js
4090
4090
  var require_YAMLMap = __commonJS((exports) => {
4091
4091
  var stringifyCollection = require_stringifyCollection();
4092
4092
  var addPairToJSMap = require_addPairToJSMap();
@@ -4213,7 +4213,7 @@ var require_YAMLMap = __commonJS((exports) => {
4213
4213
  exports.findPair = findPair;
4214
4214
  });
4215
4215
 
4216
- // node_modules/yaml/dist/schema/common/map.js
4216
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/common/map.js
4217
4217
  var require_map = __commonJS((exports) => {
4218
4218
  var identity = require_identity();
4219
4219
  var YAMLMap = require_YAMLMap();
@@ -4232,7 +4232,7 @@ var require_map = __commonJS((exports) => {
4232
4232
  exports.map = map;
4233
4233
  });
4234
4234
 
4235
- // node_modules/yaml/dist/nodes/YAMLSeq.js
4235
+ // ../../../../martha-cli/node_modules/yaml/dist/nodes/YAMLSeq.js
4236
4236
  var require_YAMLSeq = __commonJS((exports) => {
4237
4237
  var createNode = require_createNode();
4238
4238
  var stringifyCollection = require_stringifyCollection();
@@ -4325,7 +4325,7 @@ var require_YAMLSeq = __commonJS((exports) => {
4325
4325
  exports.YAMLSeq = YAMLSeq;
4326
4326
  });
4327
4327
 
4328
- // node_modules/yaml/dist/schema/common/seq.js
4328
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/common/seq.js
4329
4329
  var require_seq = __commonJS((exports) => {
4330
4330
  var identity = require_identity();
4331
4331
  var YAMLSeq = require_YAMLSeq();
@@ -4344,7 +4344,7 @@ var require_seq = __commonJS((exports) => {
4344
4344
  exports.seq = seq;
4345
4345
  });
4346
4346
 
4347
- // node_modules/yaml/dist/schema/common/string.js
4347
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/common/string.js
4348
4348
  var require_string = __commonJS((exports) => {
4349
4349
  var stringifyString = require_stringifyString();
4350
4350
  var string = {
@@ -4360,7 +4360,7 @@ var require_string = __commonJS((exports) => {
4360
4360
  exports.string = string;
4361
4361
  });
4362
4362
 
4363
- // node_modules/yaml/dist/schema/common/null.js
4363
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/common/null.js
4364
4364
  var require_null = __commonJS((exports) => {
4365
4365
  var Scalar = require_Scalar();
4366
4366
  var nullTag = {
@@ -4375,7 +4375,7 @@ var require_null = __commonJS((exports) => {
4375
4375
  exports.nullTag = nullTag;
4376
4376
  });
4377
4377
 
4378
- // node_modules/yaml/dist/schema/core/bool.js
4378
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/core/bool.js
4379
4379
  var require_bool = __commonJS((exports) => {
4380
4380
  var Scalar = require_Scalar();
4381
4381
  var boolTag = {
@@ -4396,7 +4396,7 @@ var require_bool = __commonJS((exports) => {
4396
4396
  exports.boolTag = boolTag;
4397
4397
  });
4398
4398
 
4399
- // node_modules/yaml/dist/stringify/stringifyNumber.js
4399
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyNumber.js
4400
4400
  var require_stringifyNumber = __commonJS((exports) => {
4401
4401
  function stringifyNumber({ format, minFractionDigits, tag, value }) {
4402
4402
  if (typeof value === "bigint")
@@ -4420,7 +4420,7 @@ var require_stringifyNumber = __commonJS((exports) => {
4420
4420
  exports.stringifyNumber = stringifyNumber;
4421
4421
  });
4422
4422
 
4423
- // node_modules/yaml/dist/schema/core/float.js
4423
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/core/float.js
4424
4424
  var require_float = __commonJS((exports) => {
4425
4425
  var Scalar = require_Scalar();
4426
4426
  var stringifyNumber = require_stringifyNumber();
@@ -4463,7 +4463,7 @@ var require_float = __commonJS((exports) => {
4463
4463
  exports.floatNaN = floatNaN;
4464
4464
  });
4465
4465
 
4466
- // node_modules/yaml/dist/schema/core/int.js
4466
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/core/int.js
4467
4467
  var require_int = __commonJS((exports) => {
4468
4468
  var stringifyNumber = require_stringifyNumber();
4469
4469
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
@@ -4505,7 +4505,7 @@ var require_int = __commonJS((exports) => {
4505
4505
  exports.intOct = intOct;
4506
4506
  });
4507
4507
 
4508
- // node_modules/yaml/dist/schema/core/schema.js
4508
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/core/schema.js
4509
4509
  var require_schema = __commonJS((exports) => {
4510
4510
  var map = require_map();
4511
4511
  var _null = require_null();
@@ -4530,7 +4530,7 @@ var require_schema = __commonJS((exports) => {
4530
4530
  exports.schema = schema;
4531
4531
  });
4532
4532
 
4533
- // node_modules/yaml/dist/schema/json/schema.js
4533
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/json/schema.js
4534
4534
  var require_schema2 = __commonJS((exports) => {
4535
4535
  var Scalar = require_Scalar();
4536
4536
  var map = require_map();
@@ -4594,7 +4594,7 @@ var require_schema2 = __commonJS((exports) => {
4594
4594
  exports.schema = schema;
4595
4595
  });
4596
4596
 
4597
- // node_modules/yaml/dist/schema/yaml-1.1/binary.js
4597
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/binary.js
4598
4598
  var require_binary = __commonJS((exports) => {
4599
4599
  var node_buffer = __require("buffer");
4600
4600
  var Scalar = require_Scalar();
@@ -4649,7 +4649,7 @@ var require_binary = __commonJS((exports) => {
4649
4649
  exports.binary = binary;
4650
4650
  });
4651
4651
 
4652
- // node_modules/yaml/dist/schema/yaml-1.1/pairs.js
4652
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
4653
4653
  var require_pairs = __commonJS((exports) => {
4654
4654
  var identity = require_identity();
4655
4655
  var Pair = require_Pair();
@@ -4724,7 +4724,7 @@ ${cn.comment}` : item.comment;
4724
4724
  exports.resolvePairs = resolvePairs;
4725
4725
  });
4726
4726
 
4727
- // node_modules/yaml/dist/schema/yaml-1.1/omap.js
4727
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/omap.js
4728
4728
  var require_omap = __commonJS((exports) => {
4729
4729
  var identity = require_identity();
4730
4730
  var toJS = require_toJS();
@@ -4796,7 +4796,7 @@ var require_omap = __commonJS((exports) => {
4796
4796
  exports.omap = omap;
4797
4797
  });
4798
4798
 
4799
- // node_modules/yaml/dist/schema/yaml-1.1/bool.js
4799
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/bool.js
4800
4800
  var require_bool2 = __commonJS((exports) => {
4801
4801
  var Scalar = require_Scalar();
4802
4802
  function boolStringify({ value, source }, ctx) {
@@ -4825,7 +4825,7 @@ var require_bool2 = __commonJS((exports) => {
4825
4825
  exports.trueTag = trueTag;
4826
4826
  });
4827
4827
 
4828
- // node_modules/yaml/dist/schema/yaml-1.1/float.js
4828
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/float.js
4829
4829
  var require_float2 = __commonJS((exports) => {
4830
4830
  var Scalar = require_Scalar();
4831
4831
  var stringifyNumber = require_stringifyNumber();
@@ -4871,7 +4871,7 @@ var require_float2 = __commonJS((exports) => {
4871
4871
  exports.floatNaN = floatNaN;
4872
4872
  });
4873
4873
 
4874
- // node_modules/yaml/dist/schema/yaml-1.1/int.js
4874
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/int.js
4875
4875
  var require_int2 = __commonJS((exports) => {
4876
4876
  var stringifyNumber = require_stringifyNumber();
4877
4877
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
@@ -4947,7 +4947,7 @@ var require_int2 = __commonJS((exports) => {
4947
4947
  exports.intOct = intOct;
4948
4948
  });
4949
4949
 
4950
- // node_modules/yaml/dist/schema/yaml-1.1/set.js
4950
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/set.js
4951
4951
  var require_set = __commonJS((exports) => {
4952
4952
  var identity = require_identity();
4953
4953
  var Pair = require_Pair();
@@ -5030,7 +5030,7 @@ var require_set = __commonJS((exports) => {
5030
5030
  exports.set = set;
5031
5031
  });
5032
5032
 
5033
- // node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
5033
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
5034
5034
  var require_timestamp = __commonJS((exports) => {
5035
5035
  var stringifyNumber = require_stringifyNumber();
5036
5036
  function parseSexagesimal(str, asBigInt) {
@@ -5112,7 +5112,7 @@ var require_timestamp = __commonJS((exports) => {
5112
5112
  exports.timestamp = timestamp;
5113
5113
  });
5114
5114
 
5115
- // node_modules/yaml/dist/schema/yaml-1.1/schema.js
5115
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/yaml-1.1/schema.js
5116
5116
  var require_schema3 = __commonJS((exports) => {
5117
5117
  var map = require_map();
5118
5118
  var _null = require_null();
@@ -5153,7 +5153,7 @@ var require_schema3 = __commonJS((exports) => {
5153
5153
  exports.schema = schema;
5154
5154
  });
5155
5155
 
5156
- // node_modules/yaml/dist/schema/tags.js
5156
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/tags.js
5157
5157
  var require_tags = __commonJS((exports) => {
5158
5158
  var map = require_map();
5159
5159
  var _null = require_null();
@@ -5244,7 +5244,7 @@ var require_tags = __commonJS((exports) => {
5244
5244
  exports.getTags = getTags;
5245
5245
  });
5246
5246
 
5247
- // node_modules/yaml/dist/schema/Schema.js
5247
+ // ../../../../martha-cli/node_modules/yaml/dist/schema/Schema.js
5248
5248
  var require_Schema = __commonJS((exports) => {
5249
5249
  var identity = require_identity();
5250
5250
  var map = require_map();
@@ -5274,7 +5274,7 @@ var require_Schema = __commonJS((exports) => {
5274
5274
  exports.Schema = Schema;
5275
5275
  });
5276
5276
 
5277
- // node_modules/yaml/dist/stringify/stringifyDocument.js
5277
+ // ../../../../martha-cli/node_modules/yaml/dist/stringify/stringifyDocument.js
5278
5278
  var require_stringifyDocument = __commonJS((exports) => {
5279
5279
  var identity = require_identity();
5280
5280
  var stringify = require_stringify();
@@ -5354,7 +5354,7 @@ var require_stringifyDocument = __commonJS((exports) => {
5354
5354
  exports.stringifyDocument = stringifyDocument;
5355
5355
  });
5356
5356
 
5357
- // node_modules/yaml/dist/doc/Document.js
5357
+ // ../../../../martha-cli/node_modules/yaml/dist/doc/Document.js
5358
5358
  var require_Document = __commonJS((exports) => {
5359
5359
  var Alias = require_Alias();
5360
5360
  var Collection = require_Collection();
@@ -5589,7 +5589,7 @@ var require_Document = __commonJS((exports) => {
5589
5589
  exports.Document = Document;
5590
5590
  });
5591
5591
 
5592
- // node_modules/yaml/dist/errors.js
5592
+ // ../../../../martha-cli/node_modules/yaml/dist/errors.js
5593
5593
  var require_errors = __commonJS((exports) => {
5594
5594
  class YAMLError extends Error {
5595
5595
  constructor(name, pos, code, message) {
@@ -5654,7 +5654,7 @@ ${pointer}
5654
5654
  exports.prettifyError = prettifyError;
5655
5655
  });
5656
5656
 
5657
- // node_modules/yaml/dist/compose/resolve-props.js
5657
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-props.js
5658
5658
  var require_resolve_props = __commonJS((exports) => {
5659
5659
  function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
5660
5660
  let spaceBefore = false;
@@ -5784,7 +5784,7 @@ var require_resolve_props = __commonJS((exports) => {
5784
5784
  exports.resolveProps = resolveProps;
5785
5785
  });
5786
5786
 
5787
- // node_modules/yaml/dist/compose/util-contains-newline.js
5787
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/util-contains-newline.js
5788
5788
  var require_util_contains_newline = __commonJS((exports) => {
5789
5789
  function containsNewline(key) {
5790
5790
  if (!key)
@@ -5824,7 +5824,7 @@ var require_util_contains_newline = __commonJS((exports) => {
5824
5824
  exports.containsNewline = containsNewline;
5825
5825
  });
5826
5826
 
5827
- // node_modules/yaml/dist/compose/util-flow-indent-check.js
5827
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/util-flow-indent-check.js
5828
5828
  var require_util_flow_indent_check = __commonJS((exports) => {
5829
5829
  var utilContainsNewline = require_util_contains_newline();
5830
5830
  function flowIndentCheck(indent, fc, onError) {
@@ -5839,7 +5839,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
5839
5839
  exports.flowIndentCheck = flowIndentCheck;
5840
5840
  });
5841
5841
 
5842
- // node_modules/yaml/dist/compose/util-map-includes.js
5842
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/util-map-includes.js
5843
5843
  var require_util_map_includes = __commonJS((exports) => {
5844
5844
  var identity = require_identity();
5845
5845
  function mapIncludes(ctx, items, search) {
@@ -5852,7 +5852,7 @@ var require_util_map_includes = __commonJS((exports) => {
5852
5852
  exports.mapIncludes = mapIncludes;
5853
5853
  });
5854
5854
 
5855
- // node_modules/yaml/dist/compose/resolve-block-map.js
5855
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-block-map.js
5856
5856
  var require_resolve_block_map = __commonJS((exports) => {
5857
5857
  var Pair = require_Pair();
5858
5858
  var YAMLMap = require_YAMLMap();
@@ -5959,7 +5959,7 @@ var require_resolve_block_map = __commonJS((exports) => {
5959
5959
  exports.resolveBlockMap = resolveBlockMap;
5960
5960
  });
5961
5961
 
5962
- // node_modules/yaml/dist/compose/resolve-block-seq.js
5962
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-block-seq.js
5963
5963
  var require_resolve_block_seq = __commonJS((exports) => {
5964
5964
  var YAMLSeq = require_YAMLSeq();
5965
5965
  var resolveProps = require_resolve_props();
@@ -6007,7 +6007,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
6007
6007
  exports.resolveBlockSeq = resolveBlockSeq;
6008
6008
  });
6009
6009
 
6010
- // node_modules/yaml/dist/compose/resolve-end.js
6010
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-end.js
6011
6011
  var require_resolve_end = __commonJS((exports) => {
6012
6012
  function resolveEnd(end, offset, reqSpace, onError) {
6013
6013
  let comment = "";
@@ -6047,7 +6047,7 @@ var require_resolve_end = __commonJS((exports) => {
6047
6047
  exports.resolveEnd = resolveEnd;
6048
6048
  });
6049
6049
 
6050
- // node_modules/yaml/dist/compose/resolve-flow-collection.js
6050
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-flow-collection.js
6051
6051
  var require_resolve_flow_collection = __commonJS((exports) => {
6052
6052
  var identity = require_identity();
6053
6053
  var Pair = require_Pair();
@@ -6238,7 +6238,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
6238
6238
  exports.resolveFlowCollection = resolveFlowCollection;
6239
6239
  });
6240
6240
 
6241
- // node_modules/yaml/dist/compose/compose-collection.js
6241
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/compose-collection.js
6242
6242
  var require_compose_collection = __commonJS((exports) => {
6243
6243
  var identity = require_identity();
6244
6244
  var Scalar = require_Scalar();
@@ -6300,7 +6300,7 @@ var require_compose_collection = __commonJS((exports) => {
6300
6300
  exports.composeCollection = composeCollection;
6301
6301
  });
6302
6302
 
6303
- // node_modules/yaml/dist/compose/resolve-block-scalar.js
6303
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-block-scalar.js
6304
6304
  var require_resolve_block_scalar = __commonJS((exports) => {
6305
6305
  var Scalar = require_Scalar();
6306
6306
  function resolveBlockScalar(ctx, scalar, onError) {
@@ -6493,7 +6493,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
6493
6493
  exports.resolveBlockScalar = resolveBlockScalar;
6494
6494
  });
6495
6495
 
6496
- // node_modules/yaml/dist/compose/resolve-flow-scalar.js
6496
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/resolve-flow-scalar.js
6497
6497
  var require_resolve_flow_scalar = __commonJS((exports) => {
6498
6498
  var Scalar = require_Scalar();
6499
6499
  var resolveEnd = require_resolve_end();
@@ -6709,7 +6709,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
6709
6709
  exports.resolveFlowScalar = resolveFlowScalar;
6710
6710
  });
6711
6711
 
6712
- // node_modules/yaml/dist/compose/compose-scalar.js
6712
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/compose-scalar.js
6713
6713
  var require_compose_scalar = __commonJS((exports) => {
6714
6714
  var identity = require_identity();
6715
6715
  var Scalar = require_Scalar();
@@ -6787,7 +6787,7 @@ var require_compose_scalar = __commonJS((exports) => {
6787
6787
  exports.composeScalar = composeScalar;
6788
6788
  });
6789
6789
 
6790
- // node_modules/yaml/dist/compose/util-empty-scalar-position.js
6790
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/util-empty-scalar-position.js
6791
6791
  var require_util_empty_scalar_position = __commonJS((exports) => {
6792
6792
  function emptyScalarPosition(offset, before, pos) {
6793
6793
  if (before) {
@@ -6814,7 +6814,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
6814
6814
  exports.emptyScalarPosition = emptyScalarPosition;
6815
6815
  });
6816
6816
 
6817
- // node_modules/yaml/dist/compose/compose-node.js
6817
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/compose-node.js
6818
6818
  var require_compose_node = __commonJS((exports) => {
6819
6819
  var Alias = require_Alias();
6820
6820
  var identity = require_identity();
@@ -6917,7 +6917,7 @@ var require_compose_node = __commonJS((exports) => {
6917
6917
  exports.composeNode = composeNode;
6918
6918
  });
6919
6919
 
6920
- // node_modules/yaml/dist/compose/compose-doc.js
6920
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/compose-doc.js
6921
6921
  var require_compose_doc = __commonJS((exports) => {
6922
6922
  var Document = require_Document();
6923
6923
  var composeNode = require_compose_node();
@@ -6957,7 +6957,7 @@ var require_compose_doc = __commonJS((exports) => {
6957
6957
  exports.composeDoc = composeDoc;
6958
6958
  });
6959
6959
 
6960
- // node_modules/yaml/dist/compose/composer.js
6960
+ // ../../../../martha-cli/node_modules/yaml/dist/compose/composer.js
6961
6961
  var require_composer = __commonJS((exports) => {
6962
6962
  var node_process = __require("process");
6963
6963
  var directives = require_directives();
@@ -7146,7 +7146,7 @@ ${end.comment}` : end.comment;
7146
7146
  exports.Composer = Composer;
7147
7147
  });
7148
7148
 
7149
- // node_modules/yaml/dist/parse/cst-scalar.js
7149
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/cst-scalar.js
7150
7150
  var require_cst_scalar = __commonJS((exports) => {
7151
7151
  var resolveBlockScalar = require_resolve_block_scalar();
7152
7152
  var resolveFlowScalar = require_resolve_flow_scalar();
@@ -7336,7 +7336,7 @@ var require_cst_scalar = __commonJS((exports) => {
7336
7336
  exports.setScalarValue = setScalarValue;
7337
7337
  });
7338
7338
 
7339
- // node_modules/yaml/dist/parse/cst-stringify.js
7339
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/cst-stringify.js
7340
7340
  var require_cst_stringify = __commonJS((exports) => {
7341
7341
  var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
7342
7342
  function stringifyToken(token) {
@@ -7394,7 +7394,7 @@ var require_cst_stringify = __commonJS((exports) => {
7394
7394
  exports.stringify = stringify;
7395
7395
  });
7396
7396
 
7397
- // node_modules/yaml/dist/parse/cst-visit.js
7397
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/cst-visit.js
7398
7398
  var require_cst_visit = __commonJS((exports) => {
7399
7399
  var BREAK = Symbol("break visit");
7400
7400
  var SKIP = Symbol("skip children");
@@ -7453,7 +7453,7 @@ var require_cst_visit = __commonJS((exports) => {
7453
7453
  exports.visit = visit;
7454
7454
  });
7455
7455
 
7456
- // node_modules/yaml/dist/parse/cst.js
7456
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/cst.js
7457
7457
  var require_cst = __commonJS((exports) => {
7458
7458
  var cstScalar = require_cst_scalar();
7459
7459
  var cstStringify = require_cst_stringify();
@@ -7554,7 +7554,7 @@ var require_cst = __commonJS((exports) => {
7554
7554
  exports.tokenType = tokenType;
7555
7555
  });
7556
7556
 
7557
- // node_modules/yaml/dist/parse/lexer.js
7557
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/lexer.js
7558
7558
  var require_lexer = __commonJS((exports) => {
7559
7559
  var cst = require_cst();
7560
7560
  function isEmpty(ch) {
@@ -8140,7 +8140,7 @@ var require_lexer = __commonJS((exports) => {
8140
8140
  exports.Lexer = Lexer;
8141
8141
  });
8142
8142
 
8143
- // node_modules/yaml/dist/parse/line-counter.js
8143
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/line-counter.js
8144
8144
  var require_line_counter = __commonJS((exports) => {
8145
8145
  class LineCounter {
8146
8146
  constructor() {
@@ -8168,7 +8168,7 @@ var require_line_counter = __commonJS((exports) => {
8168
8168
  exports.LineCounter = LineCounter;
8169
8169
  });
8170
8170
 
8171
- // node_modules/yaml/dist/parse/parser.js
8171
+ // ../../../../martha-cli/node_modules/yaml/dist/parse/parser.js
8172
8172
  var require_parser = __commonJS((exports) => {
8173
8173
  var node_process = __require("process");
8174
8174
  var cst = require_cst();
@@ -9017,7 +9017,7 @@ var require_parser = __commonJS((exports) => {
9017
9017
  exports.Parser = Parser;
9018
9018
  });
9019
9019
 
9020
- // node_modules/yaml/dist/public-api.js
9020
+ // ../../../../martha-cli/node_modules/yaml/dist/public-api.js
9021
9021
  var require_public_api = __commonJS((exports) => {
9022
9022
  var composer = require_composer();
9023
9023
  var Document = require_Document();
@@ -9111,7 +9111,7 @@ var require_public_api = __commonJS((exports) => {
9111
9111
  exports.stringify = stringify;
9112
9112
  });
9113
9113
 
9114
- // node_modules/yaml/dist/index.js
9114
+ // ../../../../martha-cli/node_modules/yaml/dist/index.js
9115
9115
  var composer, Document, Schema, errors, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
9116
9116
  var init_dist = __esm(() => {
9117
9117
  composer = require_composer();
@@ -9735,7 +9735,7 @@ var init_api_client = __esm(() => {
9735
9735
  };
9736
9736
  });
9737
9737
 
9738
- // node_modules/commander/esm.mjs
9738
+ // ../../../../martha-cli/node_modules/commander/esm.mjs
9739
9739
  var import__ = __toESM(require_commander(), 1);
9740
9740
  var {
9741
9741
  program,
@@ -9754,7 +9754,7 @@ var {
9754
9754
  // src/index.ts
9755
9755
  init_errors();
9756
9756
 
9757
- // node_modules/chalk/source/vendor/ansi-styles/index.js
9757
+ // ../../../../martha-cli/node_modules/chalk/source/vendor/ansi-styles/index.js
9758
9758
  var ANSI_BACKGROUND_OFFSET = 10;
9759
9759
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
9760
9760
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -9931,7 +9931,7 @@ function assembleStyles() {
9931
9931
  var ansiStyles = assembleStyles();
9932
9932
  var ansi_styles_default = ansiStyles;
9933
9933
 
9934
- // node_modules/chalk/source/vendor/supports-color/index.js
9934
+ // ../../../../martha-cli/node_modules/chalk/source/vendor/supports-color/index.js
9935
9935
  import process2 from "node:process";
9936
9936
  import os from "node:os";
9937
9937
  import tty from "node:tty";
@@ -10063,7 +10063,7 @@ var supportsColor = {
10063
10063
  };
10064
10064
  var supports_color_default = supportsColor;
10065
10065
 
10066
- // node_modules/chalk/source/utilities.js
10066
+ // ../../../../martha-cli/node_modules/chalk/source/utilities.js
10067
10067
  function stringReplaceAll(string, substring, replacer) {
10068
10068
  let index = string.indexOf(substring);
10069
10069
  if (index === -1) {
@@ -10096,7 +10096,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
10096
10096
  return returnValue;
10097
10097
  }
10098
10098
 
10099
- // node_modules/chalk/source/index.js
10099
+ // ../../../../martha-cli/node_modules/chalk/source/index.js
10100
10100
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
10101
10101
  var GENERATOR = Symbol("GENERATOR");
10102
10102
  var STYLER = Symbol("STYLER");
@@ -11070,13 +11070,12 @@ ${items.length} ${config.typeNamePlural}`));
11070
11070
  }
11071
11071
 
11072
11072
  // src/commands/chat.ts
11073
- import { createHash as createHash2 } from "node:crypto";
11074
11073
  import { createInterface as createInterface2 } from "node:readline";
11075
11074
  init_config();
11076
11075
  init_errors();
11077
11076
 
11078
11077
  // src/version.ts
11079
- var CLI_VERSION = "0.32.0";
11078
+ var CLI_VERSION = "0.34.0";
11080
11079
 
11081
11080
  // src/commands/sessions.ts
11082
11081
  function relativeTime(iso) {
@@ -11348,6 +11347,81 @@ function createApprovalTagStripper() {
11348
11347
  };
11349
11348
  }
11350
11349
 
11350
+ // src/lib/local-agent.ts
11351
+ var AGENT_PRESETS = {
11352
+ claude: {
11353
+ name: "claude",
11354
+ command: ["claude", "-p"],
11355
+ promptVia: "argv",
11356
+ description: "Claude Code headless (prompt passed as an argument)."
11357
+ },
11358
+ codex: {
11359
+ name: "codex",
11360
+ command: ["codex", "exec", "--skip-git-repo-check"],
11361
+ promptVia: "stdin",
11362
+ description: "OpenAI Codex CLI (prompt on stdin; runs outside a git repo)."
11363
+ },
11364
+ "cursor-agent": {
11365
+ name: "cursor-agent",
11366
+ command: ["cursor-agent", "--print", "--trust"],
11367
+ promptVia: "argv",
11368
+ description: "Cursor Agent headless (prompt passed as an argument)."
11369
+ }
11370
+ };
11371
+ var DEFAULT_LOCAL_AGENT = "codex";
11372
+ var DEFAULT_LOCAL_AGENT_TIMEOUT_MS = 30 * 60 * 1000;
11373
+ function resolveAgentInvocation(value) {
11374
+ const trimmed = (value || "").trim();
11375
+ if (!trimmed)
11376
+ throw new Error("local agent command is empty");
11377
+ const preset = AGENT_PRESETS[trimmed];
11378
+ if (preset) {
11379
+ return {
11380
+ command: preset.command,
11381
+ promptVia: preset.promptVia,
11382
+ source: preset.name
11383
+ };
11384
+ }
11385
+ const parts = trimmed.split(/\s+/).filter(Boolean);
11386
+ return { command: parts, promptVia: "argv", source: trimmed };
11387
+ }
11388
+ function buildSpawn(invocation, task) {
11389
+ if (invocation.command.length === 0)
11390
+ throw new Error("local agent command is empty");
11391
+ const [bin, ...rest] = invocation.command;
11392
+ if (invocation.promptVia === "stdin") {
11393
+ return { bin, args: rest, stdin: task };
11394
+ }
11395
+ return { bin, args: [...rest, task], stdin: null };
11396
+ }
11397
+ function parseLocalAgentRequests(data) {
11398
+ let tools;
11399
+ try {
11400
+ tools = JSON.parse(data);
11401
+ } catch {
11402
+ return [];
11403
+ }
11404
+ if (!Array.isArray(tools))
11405
+ return [];
11406
+ const out = [];
11407
+ for (const t of tools) {
11408
+ if (t.tool_name !== "local_agent" || t.status !== "awaiting_input")
11409
+ continue;
11410
+ if (!t.tool_call_id || !t.args?.task)
11411
+ continue;
11412
+ out.push({
11413
+ toolCallId: t.tool_call_id,
11414
+ task: t.args.task,
11415
+ cwd: typeof t.args.cwd === "string" ? t.args.cwd : undefined,
11416
+ background: t.args.background === true
11417
+ });
11418
+ }
11419
+ return out;
11420
+ }
11421
+
11422
+ // src/lib/local-tool-runner.ts
11423
+ import { createHash as createHash2 } from "node:crypto";
11424
+
11351
11425
  // src/lib/local-exec.ts
11352
11426
  import { spawn } from "node:child_process";
11353
11427
  import { randomBytes as randomBytes2 } from "node:crypto";
@@ -11988,78 +12062,6 @@ function parseHostFileRequests(data) {
11988
12062
  return out;
11989
12063
  }
11990
12064
 
11991
- // src/lib/local-agent.ts
11992
- var AGENT_PRESETS = {
11993
- claude: {
11994
- name: "claude",
11995
- command: ["claude", "-p"],
11996
- promptVia: "argv",
11997
- description: "Claude Code headless (prompt passed as an argument)."
11998
- },
11999
- codex: {
12000
- name: "codex",
12001
- command: ["codex", "exec", "--skip-git-repo-check"],
12002
- promptVia: "stdin",
12003
- description: "OpenAI Codex CLI (prompt on stdin; runs outside a git repo)."
12004
- },
12005
- "cursor-agent": {
12006
- name: "cursor-agent",
12007
- command: ["cursor-agent", "--print", "--trust"],
12008
- promptVia: "argv",
12009
- description: "Cursor Agent headless (prompt passed as an argument)."
12010
- }
12011
- };
12012
- var DEFAULT_LOCAL_AGENT = "codex";
12013
- var DEFAULT_LOCAL_AGENT_TIMEOUT_MS = 30 * 60 * 1000;
12014
- function resolveAgentInvocation(value) {
12015
- const trimmed = (value || "").trim();
12016
- if (!trimmed)
12017
- throw new Error("local agent command is empty");
12018
- const preset = AGENT_PRESETS[trimmed];
12019
- if (preset) {
12020
- return {
12021
- command: preset.command,
12022
- promptVia: preset.promptVia,
12023
- source: preset.name
12024
- };
12025
- }
12026
- const parts = trimmed.split(/\s+/).filter(Boolean);
12027
- return { command: parts, promptVia: "argv", source: trimmed };
12028
- }
12029
- function buildSpawn(invocation, task) {
12030
- if (invocation.command.length === 0)
12031
- throw new Error("local agent command is empty");
12032
- const [bin, ...rest] = invocation.command;
12033
- if (invocation.promptVia === "stdin") {
12034
- return { bin, args: rest, stdin: task };
12035
- }
12036
- return { bin, args: [...rest, task], stdin: null };
12037
- }
12038
- function parseLocalAgentRequests(data) {
12039
- let tools;
12040
- try {
12041
- tools = JSON.parse(data);
12042
- } catch {
12043
- return [];
12044
- }
12045
- if (!Array.isArray(tools))
12046
- return [];
12047
- const out = [];
12048
- for (const t of tools) {
12049
- if (t.tool_name !== "local_agent" || t.status !== "awaiting_input")
12050
- continue;
12051
- if (!t.tool_call_id || !t.args?.task)
12052
- continue;
12053
- out.push({
12054
- toolCallId: t.tool_call_id,
12055
- task: t.args.task,
12056
- cwd: typeof t.args.cwd === "string" ? t.args.cwd : undefined,
12057
- background: t.args.background === true
12058
- });
12059
- }
12060
- return out;
12061
- }
12062
-
12063
12065
  // src/lib/local-jobs.ts
12064
12066
  import { execFileSync, spawn as spawn2 } from "node:child_process";
12065
12067
  import { randomBytes as randomBytes3 } from "node:crypto";
@@ -12294,7 +12296,7 @@ function parseJobToolRequests(data, toolName) {
12294
12296
  return out;
12295
12297
  }
12296
12298
 
12297
- // src/commands/chat.ts
12299
+ // src/lib/local-tool-runner.ts
12298
12300
  async function uploadImageArtifact(ctx, sessionId, png) {
12299
12301
  try {
12300
12302
  const mint = await ctx.api.post(`/api/chat/${encodeURIComponent(sessionId)}/local-artifact-upload`, {
@@ -12561,7 +12563,7 @@ async function resolveLocalAgent(sessionId, toolCallId, req, state) {
12561
12563
  log_path: result.log_path
12562
12564
  };
12563
12565
  }
12564
- async function claimGate(ctx, sessionId, toolCallId, state) {
12566
+ async function claimGate(sessionId, toolCallId, state, transport) {
12565
12567
  if (state.claimed.has(toolCallId))
12566
12568
  return;
12567
12569
  const secret = state.secrets.get(toolCallId) ?? mintExecSecret();
@@ -12569,90 +12571,159 @@ async function claimGate(ctx, sessionId, toolCallId, state) {
12569
12571
  state.secrets.set(toolCallId, secret);
12570
12572
  await state.journal.recordSecret(sessionId, toolCallId, secret);
12571
12573
  try {
12572
- await ctx.api.post(`/api/chat/${encodeURIComponent(sessionId)}/tool-claim`, { tool_call_id: toolCallId, secret_hash: secretHash });
12574
+ await transport.claim(toolCallId, secretHash);
12573
12575
  state.claimed.add(toolCallId);
12574
12576
  } catch (e) {
12575
12577
  process.stderr.write(source_default.yellow(`[local-exec] failed to claim gate for ${toolCallId}: ${String(e)}
12576
12578
  `));
12577
12579
  }
12578
12580
  }
12579
- async function _postToolResult(ctx, sessionId, toolCallId, result, label, execSecret) {
12581
+ async function postToolResult(toolCallId, result, label, transport, execSecret) {
12580
12582
  try {
12581
- await ctx.api.post(`/api/chat/${encodeURIComponent(sessionId)}/tool-result`, {
12582
- tool_call_id: toolCallId,
12583
- result,
12584
- ...execSecret !== undefined ? { exec_secret: execSecret } : {}
12585
- });
12583
+ await transport.postResult(toolCallId, result, execSecret);
12586
12584
  } catch (e) {
12587
12585
  process.stderr.write(source_default.red(`[${label}] failed to POST result: ${String(e)}
12588
12586
  `));
12589
12587
  }
12590
12588
  }
12591
- async function handleHostExecFrame(ctx, sessionId, data, state) {
12589
+ async function handleToolStatusData(ctx, sessionId, data, state, transport) {
12592
12590
  for (const req of parseHostExecRequests(data)) {
12593
12591
  const id = req.toolCallId;
12594
12592
  if (state.handled.has(id))
12595
12593
  continue;
12596
12594
  state.handled.add(id);
12597
- await claimGate(ctx, sessionId, id, state);
12595
+ await claimGate(sessionId, id, state, transport);
12598
12596
  const result = await resolveHostExec(sessionId, id, req, state);
12599
- await _postToolResult(ctx, sessionId, id, result, "host_exec", state.secrets.get(id));
12597
+ await postToolResult(id, result, "host_exec", transport, state.secrets.get(id));
12600
12598
  }
12601
12599
  for (const req of parseHostOutputRequests(data)) {
12602
12600
  const id = req.toolCallId;
12603
12601
  if (state.handled.has(id))
12604
12602
  continue;
12605
12603
  state.handled.add(id);
12606
- await claimGate(ctx, sessionId, id, state);
12604
+ await claimGate(sessionId, id, state, transport);
12607
12605
  const result = await resolveHostOutput(req, state);
12608
- await _postToolResult(ctx, sessionId, id, result, "host_output", state.secrets.get(id));
12606
+ await postToolResult(id, result, "host_output", transport, state.secrets.get(id));
12609
12607
  }
12610
12608
  for (const req of parseHostKillRequests(data)) {
12611
12609
  const id = req.toolCallId;
12612
12610
  if (state.handled.has(id))
12613
12611
  continue;
12614
12612
  state.handled.add(id);
12615
- await claimGate(ctx, sessionId, id, state);
12613
+ await claimGate(sessionId, id, state, transport);
12616
12614
  const result = await resolveHostKill(req, state);
12617
- await _postToolResult(ctx, sessionId, id, result, "host_kill", state.secrets.get(id));
12615
+ await postToolResult(id, result, "host_kill", transport, state.secrets.get(id));
12618
12616
  }
12619
12617
  for (const req of parseHostScreenshotRequests(data)) {
12620
12618
  const id = req.toolCallId;
12621
12619
  if (state.handled.has(id))
12622
12620
  continue;
12623
12621
  state.handled.add(id);
12624
- await claimGate(ctx, sessionId, id, state);
12622
+ await claimGate(sessionId, id, state, transport);
12625
12623
  const result = await resolveHostScreenshot(ctx, sessionId, req, state);
12626
- await _postToolResult(ctx, sessionId, id, result, "host_screenshot", state.secrets.get(id));
12624
+ await postToolResult(id, result, "host_screenshot", transport, state.secrets.get(id));
12627
12625
  }
12628
12626
  for (const req of parseHostBrowserRequests(data)) {
12629
12627
  const id = req.toolCallId;
12630
12628
  if (state.handled.has(id))
12631
12629
  continue;
12632
12630
  state.handled.add(id);
12633
- await claimGate(ctx, sessionId, id, state);
12631
+ await claimGate(sessionId, id, state, transport);
12634
12632
  const result = await resolveHostBrowser(ctx, sessionId, req, state);
12635
- await _postToolResult(ctx, sessionId, id, result, "host_browser", state.secrets.get(id));
12633
+ await postToolResult(id, result, "host_browser", transport, state.secrets.get(id));
12636
12634
  }
12637
12635
  for (const req of parseHostFileRequests(data)) {
12638
12636
  const id = req.toolCallId;
12639
12637
  if (state.handled.has(id))
12640
12638
  continue;
12641
12639
  state.handled.add(id);
12642
- await claimGate(ctx, sessionId, id, state);
12640
+ await claimGate(sessionId, id, state, transport);
12643
12641
  const result = await resolveHostFile(req, state);
12644
- await _postToolResult(ctx, sessionId, id, result, req.action, state.secrets.get(id));
12642
+ await postToolResult(id, result, req.action, transport, state.secrets.get(id));
12645
12643
  }
12646
12644
  for (const req of parseLocalAgentRequests(data)) {
12647
12645
  const id = req.toolCallId;
12648
12646
  if (state.handled.has(id))
12649
12647
  continue;
12650
12648
  state.handled.add(id);
12651
- await claimGate(ctx, sessionId, id, state);
12649
+ await claimGate(sessionId, id, state, transport);
12652
12650
  const result = await resolveLocalAgent(sessionId, id, req, state);
12653
- await _postToolResult(ctx, sessionId, id, result, "local_agent", state.secrets.get(id));
12651
+ await postToolResult(id, result, "local_agent", transport, state.secrets.get(id));
12654
12652
  }
12655
12653
  }
12654
+ var OBJECT_REF_SESSION_PREFIX = "chat-session:";
12655
+ function createLocalExecState(opts) {
12656
+ return {
12657
+ cwd: opts.cwd,
12658
+ autoYes: opts.autoYes,
12659
+ localAgent: opts.localAgent,
12660
+ handled: new Set,
12661
+ journal: new Journal(opts.cwd),
12662
+ secrets: new Map,
12663
+ claimed: new Set
12664
+ };
12665
+ }
12666
+ function makeChatTransport(ctx, sessionId) {
12667
+ const base = `/api/chat/${encodeURIComponent(sessionId)}`;
12668
+ return {
12669
+ async claim(toolCallId, secretHash) {
12670
+ await ctx.api.post(`${base}/tool-claim`, {
12671
+ tool_call_id: toolCallId,
12672
+ secret_hash: secretHash
12673
+ });
12674
+ },
12675
+ async postResult(toolCallId, result, execSecret) {
12676
+ await ctx.api.post(`${base}/tool-result`, {
12677
+ tool_call_id: toolCallId,
12678
+ result,
12679
+ ...execSecret !== undefined ? { exec_secret: execSecret } : {}
12680
+ });
12681
+ }
12682
+ };
12683
+ }
12684
+ function makeChannelTransport(ctx, objectRef) {
12685
+ return {
12686
+ async claim(toolCallId, secretHash) {
12687
+ await ctx.api.post(`/api/channel/ingress`, {
12688
+ type: "tool.claim",
12689
+ correlation_id: toolCallId,
12690
+ object_ref: objectRef,
12691
+ data: { secret_hash: secretHash }
12692
+ });
12693
+ },
12694
+ async postResult(toolCallId, result, execSecret) {
12695
+ await ctx.api.post(`/api/channel/ingress`, {
12696
+ type: "tool.result",
12697
+ correlation_id: toolCallId,
12698
+ object_ref: objectRef,
12699
+ data: {
12700
+ result,
12701
+ ...execSecret !== undefined ? { exec_secret: execSecret } : {}
12702
+ }
12703
+ });
12704
+ }
12705
+ };
12706
+ }
12707
+ async function runToolInvokeFrame(ctx, frame, state) {
12708
+ const toolCallId = frame.correlation_id ?? undefined;
12709
+ const toolName = frame.data?.tool_name;
12710
+ const objectRef = frame.object_ref ?? undefined;
12711
+ if (!toolCallId || !toolName || !objectRef)
12712
+ return;
12713
+ const transport = makeChannelTransport(ctx, objectRef);
12714
+ const journalKey = frame.data?.session_id ?? (objectRef.startsWith(OBJECT_REF_SESSION_PREFIX) ? objectRef.slice(OBJECT_REF_SESSION_PREFIX.length) : objectRef);
12715
+ const synthetic = JSON.stringify([
12716
+ {
12717
+ tool_name: toolName,
12718
+ status: "awaiting_input",
12719
+ tool_call_id: toolCallId,
12720
+ args: frame.data?.arguments ?? {}
12721
+ }
12722
+ ]);
12723
+ await handleToolStatusData(ctx, journalKey, synthetic, state, transport);
12724
+ }
12725
+
12726
+ // src/commands/chat.ts
12656
12727
  function parseSlashCommand(input) {
12657
12728
  const trimmed = input.trim();
12658
12729
  if (!trimmed.startsWith("/"))
@@ -12703,15 +12774,11 @@ async function sendMessage(ctx, sessionId, message, opts = {}) {
12703
12774
  params.selected_agent = opts.agentName;
12704
12775
  reqOpts.params = params;
12705
12776
  }
12706
- const localExecState = opts.localExec ? {
12777
+ const localExecState = opts.localExec ? createLocalExecState({
12707
12778
  cwd: opts.localExec.cwd,
12708
12779
  autoYes: opts.localExec.autoYes,
12709
- localAgent: opts.localExec.agent,
12710
- handled: new Set,
12711
- journal: new Journal(opts.localExec.cwd),
12712
- secrets: new Map,
12713
- claimed: new Set
12714
- } : null;
12780
+ localAgent: opts.localExec.agent
12781
+ }) : null;
12715
12782
  const reqBody = { content: message };
12716
12783
  if (opts.localExec)
12717
12784
  reqBody.capability_keys = ["local_exec"];
@@ -12764,7 +12831,7 @@ async function sendMessage(ctx, sessionId, message, opts = {}) {
12764
12831
  if (opts.onToolStatus)
12765
12832
  opts.onToolStatus(event.data);
12766
12833
  if (localExecState) {
12767
- await handleHostExecFrame(ctx, sessionId, event.data, localExecState);
12834
+ await handleToolStatusData(ctx, sessionId, event.data, localExecState, makeChatTransport(ctx, sessionId));
12768
12835
  }
12769
12836
  break;
12770
12837
  case "clear":
@@ -15010,7 +15077,7 @@ var agentsConfig = {
15010
15077
  },
15011
15078
  normalizeBody: normalizeAgentBody,
15012
15079
  extraCreateOptions: (cmd) => {
15013
- cmd.option("--name <name>", "Agent name").option("--type <type>", "Agent type (cloud or external)", "cloud").option("--model <model>", "LLM model (e.g. anthropic/claude-sonnet-4-6)").option("--provider <provider>", "LLM provider (anthropic, openai)").option("--prompt <text>", "System prompt").option("--description <text>", "Agent description").option("--temperature <n>", "Temperature (0-1)").option("--max-tokens <n>", "Max output tokens").option("--tags <tags>", "Capability domains (comma-separated)").option("--local-tools <tools>", "Local tools (comma-separated)").option("--auth <method>", "Auth method for external agents: service-account or api-key");
15080
+ cmd.option("--name <name>", "Agent name").option("--reasoning <mode>", "Where the agent reasons: 'martha' (Martha-hosted, default) or " + "'self-hosted' (your service; reached via webhook)").option("--enable-host-runner", "Enable a host runner + mint a runner key: attach `martha runner` as this " + "agent's host executor (channel tool.* only). Alias: --runner-key").option("--runner-key", "Alias for --enable-host-runner").option("--model <model>", "LLM model (e.g. anthropic/claude-sonnet-4-6)").option("--provider <provider>", "LLM provider (anthropic, openai)").option("--prompt <text>", "System prompt").option("--description <text>", "Agent description").option("--temperature <n>", "Temperature (0-1)").option("--max-tokens <n>", "Max output tokens").option("--tags <tags>", "Capability domains (comma-separated)").option("--local-tools <tools>", "Local tools (comma-separated)").option("--type <type>", "Deprecated: use --reasoning. cloud=Martha-hosted, external=self-hosted").option("--auth <method>", "Deprecated: use --enable-host-runner. service-account (self-hosted only) or api-key");
15014
15081
  },
15015
15082
  buildInlineBody: (opts) => {
15016
15083
  if (!opts.name)
@@ -15020,8 +15087,19 @@ var agentsConfig = {
15020
15087
  body.description = opts.description;
15021
15088
  if (opts.prompt)
15022
15089
  body.system_prompt = opts.prompt;
15023
- if (opts.type)
15090
+ if (opts.reasoning) {
15091
+ const reasoningMap = {
15092
+ martha: "cloud",
15093
+ "self-hosted": "external"
15094
+ };
15095
+ const mappedType = reasoningMap[opts.reasoning];
15096
+ if (!mappedType) {
15097
+ throw new CLIError(`Invalid --reasoning value: "${opts.reasoning}". Use "martha" or "self-hosted".`, 4 /* Validation */);
15098
+ }
15099
+ body.agent_type = mappedType;
15100
+ } else if (opts.type) {
15024
15101
  body.agent_type = opts.type;
15102
+ }
15025
15103
  if (opts.model)
15026
15104
  body.model = opts.model;
15027
15105
  if (opts.provider)
@@ -15030,7 +15108,9 @@ var agentsConfig = {
15030
15108
  body.temperature = parseFloat(opts.temperature);
15031
15109
  if (opts.maxTokens)
15032
15110
  body.max_tokens = parseInt(opts.maxTokens, 10);
15033
- if (opts.auth) {
15111
+ if (opts.enableHostRunner || opts.runnerKey) {
15112
+ body.auth_method = "api_key";
15113
+ } else if (opts.auth) {
15034
15114
  const authMap = {
15035
15115
  "service-account": "service_account",
15036
15116
  "api-key": "api_key",
@@ -15206,17 +15286,28 @@ Usage:
15206
15286
  console.log(` export MARTHA_TOKEN=${String(creds.api_key ?? "")}`);
15207
15287
  }
15208
15288
  });
15209
- parentCmd.command("generate-key <agent>").description("Generate or rotate an API key for an external agent").action(async (agent) => {
15289
+ parentCmd.command("generate-key <agent>").description("Generate or rotate the agent's runner key (a Martha-hosted agent's host " + "executor key, or a self-hosted agent's api key)").action(async (agent) => {
15210
15290
  const ctx = getCtx();
15211
15291
  const result = await ctx.api.post(`${API_PATH}/${encodeURIComponent(agent)}/generate-key`, {});
15212
15292
  if (isJson()) {
15213
15293
  console.log(JSON.stringify(result, null, 2));
15214
15294
  return;
15215
15295
  }
15216
- console.log(source_default.bold("API Key Generated"));
15296
+ const scope = String(result.api_key_scope ?? "");
15297
+ console.log(source_default.bold(scope === "runner" ? "Runner Key Generated" : "API Key Generated"));
15217
15298
  console.log(source_default.dim(`This key will only be shown once.
15218
15299
  `));
15219
15300
  console.log(` ${source_default.green(String(result.api_key ?? ""))}`);
15301
+ console.log(source_default.dim(`
15302
+ Usage:
15303
+ `));
15304
+ console.log(` export MARTHA_TOKEN=${String(result.api_key ?? "")}`);
15305
+ if (scope === "runner") {
15306
+ console.log(source_default.dim(`
15307
+ Attach it as this agent's host executor:
15308
+ martha runner --tools --allow-host-exec
15309
+ `));
15310
+ }
15220
15311
  });
15221
15312
  parentCmd.command("functions <agent>").description("List functions assigned to an agent").action(async (agent) => {
15222
15313
  const ctx = getCtx();
@@ -17347,16 +17438,88 @@ function startupEchoLine(who, opts) {
17347
17438
  const identity2 = who ? who.kind === "agent" ? `agent ${who.agent_name ?? "?"} (${(who.agent_id ?? "").slice(0, 8)}…)` : `${who.kind} ${who.sub ?? ""}`.trim() : "identity unknown (whoami unavailable)";
17348
17439
  const scope = opts.team ? `team:${opts.team}` : "direct";
17349
17440
  const exec = opts.allowHostExec ? "host exec allowed" : "host exec refused (pass --allow-host-exec)";
17350
- return `[runner] authenticated as ${identity2}, scope ${scope}, cwd ${opts.cwd}, ${exec}${opts.once ? " — once" : ""}`;
17441
+ const modePart = opts.mode ? `, mode ${opts.mode}` : "";
17442
+ return `[runner] attached as ${identity2}${modePart}, scope ${scope}, cwd ${opts.cwd}, ${exec}${opts.once ? " — once" : ""}`;
17443
+ }
17444
+ async function runChannelLoop(ctx, state, abort) {
17445
+ let lastEventId;
17446
+ let backoffMs = 1000;
17447
+ const maxBackoff = 30000;
17448
+ while (!abort.signal.aborted) {
17449
+ const headers = { Accept: "text/event-stream" };
17450
+ if (lastEventId)
17451
+ headers["Last-Event-ID"] = lastEventId;
17452
+ let res;
17453
+ try {
17454
+ res = await ctx.api.getRaw("/api/channel/stream", {
17455
+ headers,
17456
+ timeout: 2147483647,
17457
+ signal: abort.signal
17458
+ });
17459
+ } catch (err) {
17460
+ if (abort.signal.aborted)
17461
+ break;
17462
+ if (err instanceof MarthaAPIError && err.status === 404) {
17463
+ process.stderr.write(source_default.dim(`[runner] channel unavailable (server flag off) — task polling continues
17464
+ `));
17465
+ return;
17466
+ }
17467
+ if (err instanceof MarthaAPIError && err.status === 403) {
17468
+ process.stderr.write(source_default.yellow(`[runner] channel requires an agent token — not connecting
17469
+ `));
17470
+ return;
17471
+ }
17472
+ process.stderr.write(source_default.yellow(`[runner] channel connect failed: ${String(err)} — retrying in ${Math.round(backoffMs / 1000)}s
17473
+ `));
17474
+ await sleepUnref(backoffMs);
17475
+ backoffMs = Math.min(backoffMs * 2, maxBackoff);
17476
+ continue;
17477
+ }
17478
+ if (!res.body) {
17479
+ await sleepUnref(backoffMs);
17480
+ continue;
17481
+ }
17482
+ backoffMs = 1000;
17483
+ process.stderr.write(source_default.dim(`[runner] channel connected${lastEventId ? ` (resumed since ${lastEventId})` : ""}
17484
+ `));
17485
+ try {
17486
+ for await (const evt of parseGenericSSE(res.body)) {
17487
+ if (abort.signal.aborted)
17488
+ break;
17489
+ if (evt.id)
17490
+ lastEventId = evt.id;
17491
+ if (evt.event !== "tool.invoke")
17492
+ continue;
17493
+ let frame = null;
17494
+ try {
17495
+ frame = evt.data ? JSON.parse(evt.data) : null;
17496
+ } catch {
17497
+ continue;
17498
+ }
17499
+ if (!frame)
17500
+ continue;
17501
+ try {
17502
+ await runToolInvokeFrame(ctx, frame, state);
17503
+ } catch (e) {
17504
+ process.stderr.write(source_default.red(`[runner] tool.invoke execution failed: ${String(e)}
17505
+ `));
17506
+ }
17507
+ }
17508
+ } catch (err) {
17509
+ if (abort.signal.aborted)
17510
+ break;
17511
+ process.stderr.write(source_default.yellow(`[runner] channel stream dropped: ${String(err)} — reconnecting
17512
+ `));
17513
+ }
17514
+ }
17351
17515
  }
17352
17516
  function registerRunnerCommand(program2) {
17353
- program2.command("runner").description("Run as an external agent's executor: claim tasks and run them on this host.").option("--agent <id>", "Deprecated: identity comes from the API token; applied as a client-side filter only").option("--team <name>", "Poll this team's queue (name or UUID) instead of direct-only").option("--once", "Claim + run a single task, then exit").option("--poll-interval <ms>", "Poll interval when idle (ms)", "3000").option("--cwd <dir>", "Scoped workspace for task execution", process.cwd()).option("--allow-host-exec", "Consent to run host commands (required to execute)").option("--yes", "Deprecated alias for --allow-host-exec").action(async (opts) => {
17517
+ program2.command("runner").description("Attach this machine as an agent's host executor (#822). Two modes: " + "--tools executes host-tool calls pushed over the channel (a Martha-hosted " + "agent's host runner); --tasks claims and runs tasks (a self-hosted agent's " + "executor). Identity comes from the API token.").option("--tools", "Host-runner mode: execute host-tool calls pushed over the per-agent channel. " + "Never polls task queues. Requires --allow-host-exec.").option("--tasks", "Task-executor mode: poll/claim/run tasks assigned to this agent.").option("--agent <id>", "Deprecated: identity comes from the API token; applied as a client-side filter only").option("--team <name>", "Poll this team's queue (name or UUID) instead of direct-only (task mode)").option("--once", "Claim + run a single task, then exit (task mode)").option("--poll-interval <ms>", "Poll interval when idle (ms)", "3000").option("--cwd <dir>", "Scoped workspace for host execution", process.cwd()).option("--allow-host-exec", "Consent to run host commands (required to execute)").option("--yes", "Deprecated alias for --allow-host-exec").option("--channel", "Deprecated alias for --tools alongside task polling (pre-#822 behaviour).").option("--local-agent <name>", "Local coding agent for local_agent delegation over the channel", DEFAULT_LOCAL_AGENT).action(async (opts) => {
17354
17518
  const ctx = createContext({
17355
17519
  profileOverride: program2.opts().profile,
17356
- verbose: program2.opts().verbose
17520
+ verbose: program2.opts().verbose,
17521
+ apiUrlOverride: program2.opts().apiUrl
17357
17522
  });
17358
- if (program2.opts().apiUrl)
17359
- ctx.profile.api_url = program2.opts().apiUrl;
17360
17523
  const pollInterval = parseInt(opts.pollInterval, 10);
17361
17524
  if (isNaN(pollInterval) || pollInterval < 250) {
17362
17525
  throw new CLIError("--poll-interval must be >= 250 (ms)", 4 /* Validation */);
@@ -17371,27 +17534,48 @@ function registerRunnerCommand(program2) {
17371
17534
  cwd: opts.cwd,
17372
17535
  allowHostExec: !!(opts.allowHostExec || opts.yes)
17373
17536
  };
17537
+ let runTasks;
17538
+ let runChannel;
17539
+ if (opts.tools || opts.tasks) {
17540
+ runTasks = !!opts.tasks;
17541
+ runChannel = !!opts.tools;
17542
+ } else if (opts.channel) {
17543
+ runTasks = true;
17544
+ runChannel = true;
17545
+ } else {
17546
+ runTasks = true;
17547
+ runChannel = false;
17548
+ }
17549
+ const mode = runTasks && runChannel ? "tools+tasks" : runChannel ? "tools" : "tasks";
17374
17550
  let who;
17375
17551
  try {
17376
17552
  who = await ctx.api.get("/api/tasks/whoami");
17377
17553
  } catch {}
17378
- process.stderr.write(source_default.dim(`${startupEchoLine(who, { team: opts.team, cwd: opts.cwd, allowHostExec: runOpts.allowHostExec, once: !!opts.once })}
17554
+ process.stderr.write(source_default.dim(`${startupEchoLine(who, { team: opts.team, cwd: opts.cwd, allowHostExec: runOpts.allowHostExec, once: !!opts.once, mode })}
17379
17555
  `));
17556
+ if (runChannel && !runOpts.allowHostExec) {
17557
+ throw new CLIError("--tools executes host-tool calls; re-run with --allow-host-exec to consent", 4 /* Validation */);
17558
+ }
17380
17559
  if (opts.once) {
17560
+ if (!runTasks) {
17561
+ throw new CLIError("--once runs a single TASK; it has no meaning in --tools (host-runner) mode", 4 /* Validation */);
17562
+ }
17381
17563
  await runOnce(ctx, runOpts);
17382
17564
  return;
17383
17565
  }
17384
17566
  let stop = false;
17567
+ const abort = new AbortController;
17385
17568
  const onSignal = () => {
17386
17569
  stop = true;
17570
+ abort.abort();
17387
17571
  process.stderr.write(`
17388
17572
  [runner] stopping…
17389
17573
  `);
17390
17574
  };
17391
17575
  process.on("SIGINT", onSignal);
17392
17576
  process.on("SIGTERM", onSignal);
17393
- const handled = new Set;
17394
- try {
17577
+ const pollLoop = async () => {
17578
+ const handled = new Set;
17395
17579
  while (!stop) {
17396
17580
  let r;
17397
17581
  try {
@@ -17404,6 +17588,20 @@ function registerRunnerCommand(program2) {
17404
17588
  if (!r.ran)
17405
17589
  await sleep5(pollInterval);
17406
17590
  }
17591
+ };
17592
+ const loops = [];
17593
+ if (runTasks)
17594
+ loops.push(pollLoop());
17595
+ if (runChannel) {
17596
+ const state = createLocalExecState({
17597
+ cwd: opts.cwd,
17598
+ autoYes: runOpts.allowHostExec,
17599
+ localAgent: opts.localAgent ?? DEFAULT_LOCAL_AGENT
17600
+ });
17601
+ loops.push(runChannelLoop(ctx, state, abort));
17602
+ }
17603
+ try {
17604
+ await Promise.all(loops);
17407
17605
  } finally {
17408
17606
  process.off("SIGINT", onSignal);
17409
17607
  process.off("SIGTERM", onSignal);