@polka-codes/cli 0.9.37 → 0.9.39
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.
- package/dist/index.js +209 -272
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25374,7 +25374,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
25374
25374
|
req.emit("proxyConnect", connect);
|
|
25375
25375
|
this.emit("proxyConnect", connect, req);
|
|
25376
25376
|
if (connect.statusCode === 200) {
|
|
25377
|
-
req.once("socket",
|
|
25377
|
+
req.once("socket", resume2);
|
|
25378
25378
|
if (opts.secureEndpoint) {
|
|
25379
25379
|
debug("Upgrading socket connection to TLS");
|
|
25380
25380
|
return tls.connect({
|
|
@@ -25398,7 +25398,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
25398
25398
|
}
|
|
25399
25399
|
HttpsProxyAgent.protocols = ["http", "https"];
|
|
25400
25400
|
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
25401
|
-
function
|
|
25401
|
+
function resume2(socket) {
|
|
25402
25402
|
socket.resume();
|
|
25403
25403
|
}
|
|
25404
25404
|
function omit2(obj, ...keys) {
|
|
@@ -52386,7 +52386,7 @@ var require_createNode2 = __commonJS((exports) => {
|
|
|
52386
52386
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
52387
52387
|
value = value.valueOf();
|
|
52388
52388
|
}
|
|
52389
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
52389
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema2, sourceObjects } = ctx;
|
|
52390
52390
|
let ref = undefined;
|
|
52391
52391
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
52392
52392
|
ref = sourceObjects.get(value);
|
|
@@ -52400,7 +52400,7 @@ var require_createNode2 = __commonJS((exports) => {
|
|
|
52400
52400
|
}
|
|
52401
52401
|
if (tagName?.startsWith("!!"))
|
|
52402
52402
|
tagName = defaultTagPrefix + tagName.slice(2);
|
|
52403
|
-
let tagObj = findTagObject(value, tagName,
|
|
52403
|
+
let tagObj = findTagObject(value, tagName, schema2.tags);
|
|
52404
52404
|
if (!tagObj) {
|
|
52405
52405
|
if (value && typeof value.toJSON === "function") {
|
|
52406
52406
|
value = value.toJSON();
|
|
@@ -52411,7 +52411,7 @@ var require_createNode2 = __commonJS((exports) => {
|
|
|
52411
52411
|
ref.node = node2;
|
|
52412
52412
|
return node2;
|
|
52413
52413
|
}
|
|
52414
|
-
tagObj = value instanceof Map ?
|
|
52414
|
+
tagObj = value instanceof Map ? schema2[identity2.MAP] : (Symbol.iterator in Object(value)) ? schema2[identity2.SEQ] : schema2[identity2.MAP];
|
|
52415
52415
|
}
|
|
52416
52416
|
if (onTagObj) {
|
|
52417
52417
|
onTagObj(tagObj);
|
|
@@ -52434,7 +52434,7 @@ var require_Collection2 = __commonJS((exports) => {
|
|
|
52434
52434
|
var createNode = require_createNode2();
|
|
52435
52435
|
var identity2 = require_identity2();
|
|
52436
52436
|
var Node = require_Node2();
|
|
52437
|
-
function collectionFromPath(
|
|
52437
|
+
function collectionFromPath(schema2, path, value) {
|
|
52438
52438
|
let v = value;
|
|
52439
52439
|
for (let i = path.length - 1;i >= 0; --i) {
|
|
52440
52440
|
const k = path[i];
|
|
@@ -52452,27 +52452,27 @@ var require_Collection2 = __commonJS((exports) => {
|
|
|
52452
52452
|
onAnchor: () => {
|
|
52453
52453
|
throw new Error("This should not happen, please report a bug.");
|
|
52454
52454
|
},
|
|
52455
|
-
schema,
|
|
52455
|
+
schema: schema2,
|
|
52456
52456
|
sourceObjects: new Map
|
|
52457
52457
|
});
|
|
52458
52458
|
}
|
|
52459
52459
|
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
52460
52460
|
|
|
52461
52461
|
class Collection extends Node.NodeBase {
|
|
52462
|
-
constructor(type,
|
|
52462
|
+
constructor(type, schema2) {
|
|
52463
52463
|
super(type);
|
|
52464
52464
|
Object.defineProperty(this, "schema", {
|
|
52465
|
-
value:
|
|
52465
|
+
value: schema2,
|
|
52466
52466
|
configurable: true,
|
|
52467
52467
|
enumerable: false,
|
|
52468
52468
|
writable: true
|
|
52469
52469
|
});
|
|
52470
52470
|
}
|
|
52471
|
-
clone(
|
|
52471
|
+
clone(schema2) {
|
|
52472
52472
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
52473
|
-
if (
|
|
52474
|
-
copy.schema =
|
|
52475
|
-
copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(
|
|
52473
|
+
if (schema2)
|
|
52474
|
+
copy.schema = schema2;
|
|
52475
|
+
copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema2) : it);
|
|
52476
52476
|
if (this.range)
|
|
52477
52477
|
copy.range = this.range.slice();
|
|
52478
52478
|
return copy;
|
|
@@ -53404,12 +53404,12 @@ var require_Pair2 = __commonJS((exports) => {
|
|
|
53404
53404
|
this.key = key2;
|
|
53405
53405
|
this.value = value;
|
|
53406
53406
|
}
|
|
53407
|
-
clone(
|
|
53407
|
+
clone(schema2) {
|
|
53408
53408
|
let { key: key2, value } = this;
|
|
53409
53409
|
if (identity2.isNode(key2))
|
|
53410
|
-
key2 = key2.clone(
|
|
53410
|
+
key2 = key2.clone(schema2);
|
|
53411
53411
|
if (identity2.isNode(value))
|
|
53412
|
-
value = value.clone(
|
|
53412
|
+
value = value.clone(schema2);
|
|
53413
53413
|
return new Pair2(key2, value);
|
|
53414
53414
|
}
|
|
53415
53415
|
toJSON(_, ctx) {
|
|
@@ -53594,13 +53594,13 @@ var require_YAMLMap2 = __commonJS((exports) => {
|
|
|
53594
53594
|
static get tagName() {
|
|
53595
53595
|
return "tag:yaml.org,2002:map";
|
|
53596
53596
|
}
|
|
53597
|
-
constructor(
|
|
53598
|
-
super(identity2.MAP,
|
|
53597
|
+
constructor(schema2) {
|
|
53598
|
+
super(identity2.MAP, schema2);
|
|
53599
53599
|
this.items = [];
|
|
53600
53600
|
}
|
|
53601
|
-
static from(
|
|
53601
|
+
static from(schema2, obj, ctx) {
|
|
53602
53602
|
const { keepUndefined, replacer } = ctx;
|
|
53603
|
-
const map3 = new this(
|
|
53603
|
+
const map3 = new this(schema2);
|
|
53604
53604
|
const add = (key2, value) => {
|
|
53605
53605
|
if (typeof replacer === "function")
|
|
53606
53606
|
value = replacer.call(obj, key2, value);
|
|
@@ -53616,8 +53616,8 @@ var require_YAMLMap2 = __commonJS((exports) => {
|
|
|
53616
53616
|
for (const key2 of Object.keys(obj))
|
|
53617
53617
|
add(key2, obj[key2]);
|
|
53618
53618
|
}
|
|
53619
|
-
if (typeof
|
|
53620
|
-
map3.items.sort(
|
|
53619
|
+
if (typeof schema2.sortMapEntries === "function") {
|
|
53620
|
+
map3.items.sort(schema2.sortMapEntries);
|
|
53621
53621
|
}
|
|
53622
53622
|
return map3;
|
|
53623
53623
|
}
|
|
@@ -53710,7 +53710,7 @@ var require_map2 = __commonJS((exports) => {
|
|
|
53710
53710
|
onError("Expected a mapping for this tag");
|
|
53711
53711
|
return map4;
|
|
53712
53712
|
},
|
|
53713
|
-
createNode: (
|
|
53713
|
+
createNode: (schema2, obj, ctx) => YAMLMap2.YAMLMap.from(schema2, obj, ctx)
|
|
53714
53714
|
};
|
|
53715
53715
|
exports.map = map3;
|
|
53716
53716
|
});
|
|
@@ -53728,8 +53728,8 @@ var require_YAMLSeq2 = __commonJS((exports) => {
|
|
|
53728
53728
|
static get tagName() {
|
|
53729
53729
|
return "tag:yaml.org,2002:seq";
|
|
53730
53730
|
}
|
|
53731
|
-
constructor(
|
|
53732
|
-
super(identity2.SEQ,
|
|
53731
|
+
constructor(schema2) {
|
|
53732
|
+
super(identity2.SEQ, schema2);
|
|
53733
53733
|
this.items = [];
|
|
53734
53734
|
}
|
|
53735
53735
|
add(value) {
|
|
@@ -53783,9 +53783,9 @@ var require_YAMLSeq2 = __commonJS((exports) => {
|
|
|
53783
53783
|
onComment
|
|
53784
53784
|
});
|
|
53785
53785
|
}
|
|
53786
|
-
static from(
|
|
53786
|
+
static from(schema2, obj, ctx) {
|
|
53787
53787
|
const { replacer } = ctx;
|
|
53788
|
-
const seq = new this(
|
|
53788
|
+
const seq = new this(schema2);
|
|
53789
53789
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
53790
53790
|
let i = 0;
|
|
53791
53791
|
for (let it of obj) {
|
|
@@ -53822,7 +53822,7 @@ var require_seq2 = __commonJS((exports) => {
|
|
|
53822
53822
|
onError("Expected a sequence for this tag");
|
|
53823
53823
|
return seq2;
|
|
53824
53824
|
},
|
|
53825
|
-
createNode: (
|
|
53825
|
+
createNode: (schema2, obj, ctx) => YAMLSeq2.YAMLSeq.from(schema2, obj, ctx)
|
|
53826
53826
|
};
|
|
53827
53827
|
exports.seq = seq;
|
|
53828
53828
|
});
|
|
@@ -53997,7 +53997,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
53997
53997
|
var bool = require_bool3();
|
|
53998
53998
|
var float = require_float3();
|
|
53999
53999
|
var int2 = require_int3();
|
|
54000
|
-
var
|
|
54000
|
+
var schema2 = [
|
|
54001
54001
|
map3.map,
|
|
54002
54002
|
seq.seq,
|
|
54003
54003
|
string5.string,
|
|
@@ -54010,7 +54010,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
54010
54010
|
float.floatExp,
|
|
54011
54011
|
float.float
|
|
54012
54012
|
];
|
|
54013
|
-
exports.schema =
|
|
54013
|
+
exports.schema = schema2;
|
|
54014
54014
|
});
|
|
54015
54015
|
|
|
54016
54016
|
// ../../node_modules/yaml/dist/schema/json/schema.js
|
|
@@ -54073,8 +54073,8 @@ var require_schema5 = __commonJS((exports) => {
|
|
|
54073
54073
|
return str;
|
|
54074
54074
|
}
|
|
54075
54075
|
};
|
|
54076
|
-
var
|
|
54077
|
-
exports.schema =
|
|
54076
|
+
var schema2 = [map3.map, seq.seq].concat(jsonScalars, jsonError);
|
|
54077
|
+
exports.schema = schema2;
|
|
54078
54078
|
});
|
|
54079
54079
|
|
|
54080
54080
|
// ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
@@ -54164,9 +54164,9 @@ ${cn.comment}` : item.comment;
|
|
|
54164
54164
|
onError("Expected a sequence for this tag");
|
|
54165
54165
|
return seq;
|
|
54166
54166
|
}
|
|
54167
|
-
function createPairs(
|
|
54167
|
+
function createPairs(schema2, iterable, ctx) {
|
|
54168
54168
|
const { replacer } = ctx;
|
|
54169
|
-
const pairs2 = new YAMLSeq2.YAMLSeq(
|
|
54169
|
+
const pairs2 = new YAMLSeq2.YAMLSeq(schema2);
|
|
54170
54170
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
54171
54171
|
let i = 0;
|
|
54172
54172
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
@@ -54245,8 +54245,8 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
54245
54245
|
}
|
|
54246
54246
|
return map3;
|
|
54247
54247
|
}
|
|
54248
|
-
static from(
|
|
54249
|
-
const pairs$1 = pairs.createPairs(
|
|
54248
|
+
static from(schema2, iterable, ctx) {
|
|
54249
|
+
const pairs$1 = pairs.createPairs(schema2, iterable, ctx);
|
|
54250
54250
|
const omap2 = new this;
|
|
54251
54251
|
omap2.items = pairs$1.items;
|
|
54252
54252
|
return omap2;
|
|
@@ -54273,7 +54273,7 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
54273
54273
|
}
|
|
54274
54274
|
return Object.assign(new YAMLOMap, pairs$1);
|
|
54275
54275
|
},
|
|
54276
|
-
createNode: (
|
|
54276
|
+
createNode: (schema2, iterable, ctx) => YAMLOMap.from(schema2, iterable, ctx)
|
|
54277
54277
|
};
|
|
54278
54278
|
exports.YAMLOMap = YAMLOMap;
|
|
54279
54279
|
exports.omap = omap;
|
|
@@ -54437,8 +54437,8 @@ var require_set2 = __commonJS((exports) => {
|
|
|
54437
54437
|
var YAMLMap2 = require_YAMLMap2();
|
|
54438
54438
|
|
|
54439
54439
|
class YAMLSet extends YAMLMap2.YAMLMap {
|
|
54440
|
-
constructor(
|
|
54441
|
-
super(
|
|
54440
|
+
constructor(schema2) {
|
|
54441
|
+
super(schema2);
|
|
54442
54442
|
this.tag = YAMLSet.tag;
|
|
54443
54443
|
}
|
|
54444
54444
|
add(key2) {
|
|
@@ -54478,9 +54478,9 @@ var require_set2 = __commonJS((exports) => {
|
|
|
54478
54478
|
else
|
|
54479
54479
|
throw new Error("Set items must all have null values");
|
|
54480
54480
|
}
|
|
54481
|
-
static from(
|
|
54481
|
+
static from(schema2, iterable, ctx) {
|
|
54482
54482
|
const { replacer } = ctx;
|
|
54483
|
-
const set6 = new this(
|
|
54483
|
+
const set6 = new this(schema2);
|
|
54484
54484
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
54485
54485
|
for (let value of iterable) {
|
|
54486
54486
|
if (typeof replacer === "function")
|
|
@@ -54497,7 +54497,7 @@ var require_set2 = __commonJS((exports) => {
|
|
|
54497
54497
|
nodeClass: YAMLSet,
|
|
54498
54498
|
default: false,
|
|
54499
54499
|
tag: "tag:yaml.org,2002:set",
|
|
54500
|
-
createNode: (
|
|
54500
|
+
createNode: (schema2, iterable, ctx) => YAMLSet.from(schema2, iterable, ctx),
|
|
54501
54501
|
resolve(map3, onError) {
|
|
54502
54502
|
if (identity2.isMap(map3)) {
|
|
54503
54503
|
if (map3.hasAllNullValues(true))
|
|
@@ -54610,7 +54610,7 @@ var require_schema6 = __commonJS((exports) => {
|
|
|
54610
54610
|
var pairs = require_pairs2();
|
|
54611
54611
|
var set5 = require_set2();
|
|
54612
54612
|
var timestamp = require_timestamp2();
|
|
54613
|
-
var
|
|
54613
|
+
var schema2 = [
|
|
54614
54614
|
map3.map,
|
|
54615
54615
|
seq.seq,
|
|
54616
54616
|
string5.string,
|
|
@@ -54633,7 +54633,7 @@ var require_schema6 = __commonJS((exports) => {
|
|
|
54633
54633
|
timestamp.floatTime,
|
|
54634
54634
|
timestamp.timestamp
|
|
54635
54635
|
];
|
|
54636
|
-
exports.schema =
|
|
54636
|
+
exports.schema = schema2;
|
|
54637
54637
|
});
|
|
54638
54638
|
|
|
54639
54639
|
// ../../node_modules/yaml/dist/schema/tags.js
|
|
@@ -54645,7 +54645,7 @@ var require_tags2 = __commonJS((exports) => {
|
|
|
54645
54645
|
var bool = require_bool3();
|
|
54646
54646
|
var float = require_float3();
|
|
54647
54647
|
var int2 = require_int3();
|
|
54648
|
-
var
|
|
54648
|
+
var schema2 = require_schema4();
|
|
54649
54649
|
var schema$1 = require_schema5();
|
|
54650
54650
|
var binary = require_binary2();
|
|
54651
54651
|
var merge5 = require_merge2();
|
|
@@ -54655,7 +54655,7 @@ var require_tags2 = __commonJS((exports) => {
|
|
|
54655
54655
|
var set5 = require_set2();
|
|
54656
54656
|
var timestamp = require_timestamp2();
|
|
54657
54657
|
var schemas3 = new Map([
|
|
54658
|
-
["core",
|
|
54658
|
+
["core", schema2.schema],
|
|
54659
54659
|
["failsafe", [map3.map, seq.seq, string5.string]],
|
|
54660
54660
|
["json", schema$1.schema],
|
|
54661
54661
|
["yaml11", schema$2.schema],
|
|
@@ -54737,9 +54737,9 @@ var require_Schema2 = __commonJS((exports) => {
|
|
|
54737
54737
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
54738
54738
|
|
|
54739
54739
|
class Schema2 {
|
|
54740
|
-
constructor({ compat: compat2, customTags, merge: merge5, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
54740
|
+
constructor({ compat: compat2, customTags, merge: merge5, resolveKnownTags, schema: schema2, sortMapEntries, toStringDefaults }) {
|
|
54741
54741
|
this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
|
|
54742
|
-
this.name = typeof
|
|
54742
|
+
this.name = typeof schema2 === "string" && schema2 || "core";
|
|
54743
54743
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
54744
54744
|
this.tags = tags.getTags(customTags, this.name, merge5);
|
|
54745
54745
|
this.toStringOptions = toStringDefaults ?? null;
|
|
@@ -56231,11 +56231,11 @@ var require_compose_scalar2 = __commonJS((exports) => {
|
|
|
56231
56231
|
scalar.comment = comment;
|
|
56232
56232
|
return scalar;
|
|
56233
56233
|
}
|
|
56234
|
-
function findScalarTagByName(
|
|
56234
|
+
function findScalarTagByName(schema2, value, tagName, tagToken, onError) {
|
|
56235
56235
|
if (tagName === "!")
|
|
56236
|
-
return
|
|
56236
|
+
return schema2[identity2.SCALAR];
|
|
56237
56237
|
const matchWithTest = [];
|
|
56238
|
-
for (const tag of
|
|
56238
|
+
for (const tag of schema2.tags) {
|
|
56239
56239
|
if (!tag.collection && tag.tag === tagName) {
|
|
56240
56240
|
if (tag.default && tag.test)
|
|
56241
56241
|
matchWithTest.push(tag);
|
|
@@ -56246,18 +56246,18 @@ var require_compose_scalar2 = __commonJS((exports) => {
|
|
|
56246
56246
|
for (const tag of matchWithTest)
|
|
56247
56247
|
if (tag.test?.test(value))
|
|
56248
56248
|
return tag;
|
|
56249
|
-
const kt =
|
|
56249
|
+
const kt = schema2.knownTags[tagName];
|
|
56250
56250
|
if (kt && !kt.collection) {
|
|
56251
|
-
|
|
56251
|
+
schema2.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
|
|
56252
56252
|
return kt;
|
|
56253
56253
|
}
|
|
56254
56254
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
56255
|
-
return
|
|
56255
|
+
return schema2[identity2.SCALAR];
|
|
56256
56256
|
}
|
|
56257
|
-
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
56258
|
-
const tag =
|
|
56259
|
-
if (
|
|
56260
|
-
const compat2 =
|
|
56257
|
+
function findScalarTagByTest({ atKey, directives, schema: schema2 }, value, token, onError) {
|
|
56258
|
+
const tag = schema2.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema2[identity2.SCALAR];
|
|
56259
|
+
if (schema2.compat) {
|
|
56260
|
+
const compat2 = schema2.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema2[identity2.SCALAR];
|
|
56261
56261
|
if (tag.tag !== compat2.tag) {
|
|
56262
56262
|
const ts = directives.tagString(tag.tag);
|
|
56263
56263
|
const cs = directives.tagString(compat2.tag);
|
|
@@ -58608,7 +58608,7 @@ var {
|
|
|
58608
58608
|
Help
|
|
58609
58609
|
} = import__.default;
|
|
58610
58610
|
// package.json
|
|
58611
|
-
var version = "0.9.
|
|
58611
|
+
var version = "0.9.39";
|
|
58612
58612
|
|
|
58613
58613
|
// src/commands/chat.ts
|
|
58614
58614
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -87178,7 +87178,13 @@ var makeAgentStepSpecHandler = (getModelFn) => ({
|
|
|
87178
87178
|
const handleExitReason = async (reason) => {
|
|
87179
87179
|
switch (reason.type) {
|
|
87180
87180
|
case "Pause":
|
|
87181
|
-
return {
|
|
87181
|
+
return {
|
|
87182
|
+
type: "paused",
|
|
87183
|
+
state: {
|
|
87184
|
+
messages: agent.messages,
|
|
87185
|
+
usage: usageMeter.usage
|
|
87186
|
+
}
|
|
87187
|
+
};
|
|
87182
87188
|
case "UsageExceeded":
|
|
87183
87189
|
return { type: "error", error: new Error("Usage limit exceeded") };
|
|
87184
87190
|
case "Exit" /* Exit */: {
|
|
@@ -87287,6 +87293,13 @@ class StepsBuilder {
|
|
|
87287
87293
|
step
|
|
87288
87294
|
});
|
|
87289
87295
|
}
|
|
87296
|
+
loop(id, config2) {
|
|
87297
|
+
return this.step({
|
|
87298
|
+
...config2,
|
|
87299
|
+
id,
|
|
87300
|
+
type: "loop"
|
|
87301
|
+
});
|
|
87302
|
+
}
|
|
87290
87303
|
custom(idOrSpec, run) {
|
|
87291
87304
|
if (typeof idOrSpec === "string") {
|
|
87292
87305
|
if (!run) {
|
|
@@ -87300,6 +87313,13 @@ class StepsBuilder {
|
|
|
87300
87313
|
}
|
|
87301
87314
|
return this.step(idOrSpec);
|
|
87302
87315
|
}
|
|
87316
|
+
workflow(id, config2) {
|
|
87317
|
+
return this.step({
|
|
87318
|
+
...config2,
|
|
87319
|
+
id,
|
|
87320
|
+
type: "workflow"
|
|
87321
|
+
});
|
|
87322
|
+
}
|
|
87303
87323
|
agent(id, spec2) {
|
|
87304
87324
|
return this.step({
|
|
87305
87325
|
...spec2,
|
|
@@ -87307,6 +87327,13 @@ class StepsBuilder {
|
|
|
87307
87327
|
type: "agent"
|
|
87308
87328
|
});
|
|
87309
87329
|
}
|
|
87330
|
+
branch(id, config2) {
|
|
87331
|
+
return this.step({
|
|
87332
|
+
...config2,
|
|
87333
|
+
id,
|
|
87334
|
+
type: "branch"
|
|
87335
|
+
});
|
|
87336
|
+
}
|
|
87310
87337
|
}
|
|
87311
87338
|
var builder = () => {
|
|
87312
87339
|
return new StepsBuilder;
|
|
@@ -87340,6 +87367,29 @@ var runStep = async (step, input, context, resumedState, allOutputs) => {
|
|
|
87340
87367
|
}
|
|
87341
87368
|
};
|
|
87342
87369
|
|
|
87370
|
+
// ../core/src/workflow/workflow.ts
|
|
87371
|
+
var run = async (workflow, context, handler15, input) => {
|
|
87372
|
+
const rootStep = handler15(workflow.step, handler15);
|
|
87373
|
+
const result = await runStep(rootStep, input, context, undefined, {});
|
|
87374
|
+
switch (result.type) {
|
|
87375
|
+
case "paused":
|
|
87376
|
+
return {
|
|
87377
|
+
type: "paused",
|
|
87378
|
+
state: result.state
|
|
87379
|
+
};
|
|
87380
|
+
case "error":
|
|
87381
|
+
return {
|
|
87382
|
+
type: "error",
|
|
87383
|
+
error: result.error
|
|
87384
|
+
};
|
|
87385
|
+
case "success":
|
|
87386
|
+
return {
|
|
87387
|
+
type: "success",
|
|
87388
|
+
output: result.output
|
|
87389
|
+
};
|
|
87390
|
+
}
|
|
87391
|
+
};
|
|
87392
|
+
|
|
87343
87393
|
// ../core/src/workflow/steps.ts
|
|
87344
87394
|
var combineHandlers = (...handlers) => {
|
|
87345
87395
|
const allHandlers = {};
|
|
@@ -87403,28 +87453,6 @@ var customStepSpecHandler = {
|
|
|
87403
87453
|
};
|
|
87404
87454
|
}
|
|
87405
87455
|
};
|
|
87406
|
-
// ../core/src/workflow/workflow.ts
|
|
87407
|
-
var run = async (workflow, context, handler15, input) => {
|
|
87408
|
-
const rootStep = handler15(workflow.step, handler15);
|
|
87409
|
-
const result = await runStep(rootStep, input, context, undefined, {});
|
|
87410
|
-
switch (result.type) {
|
|
87411
|
-
case "paused":
|
|
87412
|
-
return {
|
|
87413
|
-
type: "paused",
|
|
87414
|
-
state: result.state
|
|
87415
|
-
};
|
|
87416
|
-
case "error":
|
|
87417
|
-
return {
|
|
87418
|
-
type: "error",
|
|
87419
|
-
error: result.error
|
|
87420
|
-
};
|
|
87421
|
-
case "success":
|
|
87422
|
-
return {
|
|
87423
|
-
type: "success",
|
|
87424
|
-
output: result.output
|
|
87425
|
-
};
|
|
87426
|
-
}
|
|
87427
|
-
};
|
|
87428
87456
|
// src/commands/chat.ts
|
|
87429
87457
|
var import_lodash6 = __toESM(require_lodash(), 1);
|
|
87430
87458
|
|
|
@@ -106590,197 +106618,106 @@ var import_lodash5 = __toESM(require_lodash(), 1);
|
|
|
106590
106618
|
|
|
106591
106619
|
// src/commandSummarizer.ts
|
|
106592
106620
|
var prompt3 = `
|
|
106593
|
-
|
|
106594
|
-
|
|
106595
|
-
|
|
106596
|
-
|
|
106597
|
-
|
|
106598
|
-
|
|
106599
|
-
|
|
106600
|
-
|
|
106601
|
-
|
|
106602
|
-
|
|
106603
|
-
|
|
106604
|
-
|
|
106605
|
-
|
|
106606
|
-
|
|
106607
|
-
-
|
|
106608
|
-
|
|
106609
|
-
|
|
106610
|
-
|
|
106611
|
-
|
|
106612
|
-
|
|
106613
|
-
|
|
106614
|
-
|
|
106615
|
-
|
|
106616
|
-
|
|
106617
|
-
|
|
106618
|
-
|
|
106619
|
-
|
|
106620
|
-
- Truncate extremely long single lines to a reasonable width while preserving the essential portion (start and end), indicating truncation with "...".
|
|
106621
|
-
- Redact obvious secrets (tokens, passwords, keys) by masking the middle with "****", keeping at most the last 4 chars.
|
|
106622
|
-
|
|
106623
|
-
2) Severity and Ordering
|
|
106624
|
-
- Prioritize in this order: Errors, Test Failures, Warnings, Important Notes.
|
|
106625
|
-
- Preserve original order within each section when helpful for debugging.
|
|
106626
|
-
- If an exit code is inferable (e.g., via error footers or phrases like "exit status 1"), include it in the Summary.
|
|
106627
|
-
|
|
106628
|
-
3) Output Format (ASCII only, no tables)
|
|
106629
|
-
- Summary: one short line if any issues were found.
|
|
106630
|
-
Example: "Summary: exit_code=1; errors=3; warnings=2; failing_tests=4"
|
|
106631
|
-
- Then zero or more sections in this order, only if present:
|
|
106632
|
-
- Errors:
|
|
106633
|
-
- Test Failures:
|
|
106634
|
-
- Warnings:
|
|
106635
|
-
- Notes:
|
|
106636
|
-
- Within each section, use compact bullet points ("- ").
|
|
106637
|
-
- Quote key lines verbatim when they carry the signal (file:line:col, codes, rule names, assertion diffs).
|
|
106638
|
-
- Never include large code blocks; include at most 1-2 context lines around a key message when indispensable, marked with "...".
|
|
106639
|
-
|
|
106640
|
-
4) What to Include vs Ignore (by tool/type)
|
|
106641
|
-
A) Test Runners (jest, mocha, vitest, pytest, nose, unittest, go test, rspec, junit, maven-surefire, gradle test)
|
|
106642
|
-
Include:
|
|
106643
|
-
- Names of failing test suites and test cases.
|
|
106644
|
-
- Assertion messages, diffs (Expected vs Received / AssertionError messages).
|
|
106645
|
-
- First 1-3 relevant stack frames pointing to user code (omit framework internals).
|
|
106646
|
-
- Summary counts: failed, skipped (if significant), total time if useful.
|
|
106647
|
-
Ignore:
|
|
106648
|
-
- Passed tests, pass counts, coverage success lines.
|
|
106649
|
-
- Test discovery notices, "OK"/"PASSED" banners, shard routing info.
|
|
106650
|
-
Example bullet:
|
|
106651
|
-
- tests/math.spec.ts: "adds numbers" FAILED: Expected 3, Received 4 at src/math.ts:12:7
|
|
106652
|
-
|
|
106653
|
-
B) Compilers/Build Tools (tsc, vite, webpack, esbuild, babel, gcc/clang, javac, kotlinc, rustc/cargo, go build, dotnet build, swiftc)
|
|
106654
|
-
Include:
|
|
106655
|
-
- Errors and warnings only (file:line:col if present, diagnostic code).
|
|
106656
|
-
- Linker errors and type mismatch details.
|
|
106657
|
-
Ignore:
|
|
106658
|
-
- Status/progress lines like "Compiling X", "Bundling Y", "Starting dev server...", "Note: some messages have been simplified".
|
|
106659
|
-
Example bullets:
|
|
106660
|
-
- src/foo.ts:42:13 TS2339 error: Property 'bar' does not exist on type 'Baz'.
|
|
106661
|
-
- lib/util.c:88:5 warning: unused variable 'tmp' [-Wunused-variable]
|
|
106662
|
-
|
|
106663
|
-
C) Linters/Formatters (eslint, flake8, pylint, rubocop, golangci-lint, stylelint, mypy, black/prettier)
|
|
106664
|
-
Include:
|
|
106665
|
-
- Violations with file:line:col, rule/id, brief message.
|
|
106666
|
-
- mypy type errors (treat as errors).
|
|
106667
|
-
Ignore:
|
|
106668
|
-
- "All matched files" summaries, formatter no-op messages.
|
|
106669
|
-
Example bullet:
|
|
106670
|
-
- src/app.tsx:17:9 eslint(no-unused-vars): 'user' is assigned a value but never used.
|
|
106671
|
-
|
|
106672
|
-
D) Runtime/Execution Errors (node, python, java, go, ruby, dotnet, shell)
|
|
106673
|
-
Include:
|
|
106674
|
-
- Error type/name and message.
|
|
106675
|
-
- Top 1-3 stack frames in user code; include "Caused by" chains.
|
|
106676
|
-
- Non-zero exit status if visible.
|
|
106677
|
-
Ignore:
|
|
106678
|
-
- Long internal/framework stacks unless they are the only frames available.
|
|
106679
|
-
Example bullet:
|
|
106680
|
-
- RuntimeError: connection refused at services/db.py:54 (exit status 1)
|
|
106681
|
-
|
|
106682
|
-
E) Package/Build Systems (npm/yarn/pnpm, pip/pipenv, poetry, cargo, maven, gradle)
|
|
106683
|
-
Include:
|
|
106684
|
-
- Install/build failures, script failures, postinstall errors.
|
|
106685
|
-
- Security advisories at high/critical severity (count + top advisory IDs).
|
|
106686
|
-
- Missing/invalid peer dependency errors that break install/build.
|
|
106687
|
-
Ignore:
|
|
106688
|
-
- Progress bars, fetch logs, cache hits, "up to date" lines.
|
|
106689
|
-
Example bullet:
|
|
106690
|
-
- npm ERR! test script failed: "jest --runInBand" (code 1)
|
|
106691
|
-
|
|
106692
|
-
F) VCS and CI (git, gh, svn; CI logs)
|
|
106693
|
-
Include:
|
|
106694
|
-
- Merge/rebase conflicts (files and conflict markers).
|
|
106695
|
-
- Push rejections (non-fast-forward, auth failures).
|
|
106696
|
-
- CI job failures (job name, failing step, error excerpt).
|
|
106697
|
-
Ignore:
|
|
106698
|
-
- Clean status, branch listings unless indicating a problem.
|
|
106699
|
-
Example bullet:
|
|
106700
|
-
- Merge conflict: src/index.ts (markers found around lines ~120-145)
|
|
106701
|
-
|
|
106702
|
-
G) Containers/Orchestration (docker, podman, kubectl, helm)
|
|
106703
|
-
Include:
|
|
106704
|
-
- Build failures (failed stages, missing files), run-time exit codes.
|
|
106705
|
-
- Kubernetes apply errors and crashloop events with reason.
|
|
106706
|
-
Ignore:
|
|
106707
|
-
- Layer download progress, pull status noise.
|
|
106708
|
-
Example bullet:
|
|
106709
|
-
- CrashLoopBackOff: pod api-7f6c... container "api" OOMKilled (restart 3/5)
|
|
106710
|
-
|
|
106711
|
-
H) Databases/SQL/Migrations (psql, mysql, sqlite, prisma, liquibase, flyway)
|
|
106712
|
-
Include:
|
|
106713
|
-
- SQLSTATE/error codes, constraint violations, migration failure details.
|
|
106714
|
-
Example bullet:
|
|
106715
|
-
- SQLSTATE 23505 unique_violation on users(email) at 2025-09-11T03:22Z
|
|
106716
|
-
|
|
106717
|
-
5) Counts and Grouping
|
|
106718
|
-
- If 3+ similar diagnostics occur, summarize with a count and show 1-2 exemplars:
|
|
106719
|
-
Example: "Type errors (7): e.g., src/a.ts:10 TS2322: Type 'X' is not assignable to 'Y'."
|
|
106720
|
-
- When possible, group by file or rule to reduce noise.
|
|
106721
|
-
|
|
106722
|
-
6) Stack Traces
|
|
106723
|
-
- Keep only the topmost relevant frames pointing to project files (e.g., paths under src/, app/, lib/).
|
|
106724
|
-
- Omit frames from node:internal, <anonymous>, site-packages/dist-packages unless they are the only frames.
|
|
106725
|
-
|
|
106726
|
-
7) Timeouts/Resource Failures
|
|
106727
|
-
- If a timeout/OOM/segfault is detected, surface it prominently under Errors with the best short cause line.
|
|
106728
|
-
|
|
106729
|
-
8) When There Is Nothing Noteworthy
|
|
106730
|
-
- If no errors, no warnings, and no failing tests are detected, output a single line:
|
|
106731
|
-
"No issues found."
|
|
106732
|
-
- Do NOT restate benign status like "build succeeded" or "all tests passed".
|
|
106733
|
-
|
|
106734
|
-
9) Tone and Style
|
|
106735
|
-
- Be precise and unemotional.
|
|
106736
|
-
- Use short bullets; avoid prose paragraphs.
|
|
106737
|
-
- ASCII only; no emojis; no tables.
|
|
106738
|
-
|
|
106739
|
-
10) Optional Next Actions
|
|
106740
|
-
- If and only if issues exist, append a short "Next actions:" section with up to 3 bullets of direct, obvious steps derived from the messages (e.g., "Fix missing import in src/foo.ts line 12").
|
|
106741
|
-
|
|
106742
|
-
Detection Heuristics (non-exhaustive)
|
|
106743
|
-
- Errors: lines containing "error", "ERR!", "E ", "fatal", "Traceback", "Exception", "undefined reference", "cannot find symbol", "not found", "Segmentation fault", "panic:", "stack overflow".
|
|
106744
|
-
- Warnings: lines containing "warning", "WARN", "deprecated", "note: this will be removed" (treat "note" as warning only if explicitly labeled).
|
|
106745
|
-
- Test failures: lines with "FAIL", "FAILED", "Error", "AssertionError", "expect(", "--- FAIL:", "not ok", "Tests failed", or junit/pytest summaries with non-zero failures.
|
|
106746
|
-
|
|
106747
|
-
Output Template
|
|
106748
|
-
- Follow this shape; omit empty sections:
|
|
106749
|
-
|
|
106750
|
-
Summary: exit_code=<code>; errors=<N>; warnings=<M>; failing_tests=<K>
|
|
106751
|
-
Errors:
|
|
106752
|
-
- <file:line:col> <diagnostic code if any> <short message>
|
|
106753
|
-
- <next...>
|
|
106754
|
-
|
|
106755
|
-
Test Failures:
|
|
106756
|
-
- <suite or file> "<test name>": <assertion message or diff>; at <file:line[:col]>
|
|
106757
|
-
- <next...>
|
|
106758
|
-
|
|
106759
|
-
Warnings:
|
|
106760
|
-
- <file:line:col> <rule/code>: <short message>
|
|
106761
|
-
|
|
106762
|
-
Notes:
|
|
106763
|
-
- <concise note if indispensable>
|
|
106764
|
-
|
|
106765
|
-
Next actions:
|
|
106766
|
-
- <up to 3 short, concrete steps>
|
|
106767
|
-
|
|
106768
|
-
Final Requirements
|
|
106769
|
-
- Be concise, avoid repeating the same information.
|
|
106770
|
-
- Ensure accuracy; never invent details not present in the input.
|
|
106771
|
-
- Do not output tables unless explicitly asked.`;
|
|
106621
|
+
You are a command output summarizer. Analyze the provided command output, which is prefixed with line numbers and the stream name (stdout/stderr). Your task is to identify the most important lines, such as errors, failures, or key results.
|
|
106622
|
+
|
|
106623
|
+
The input is structured as follows:
|
|
106624
|
+
[line_number]: [stream]: [content]
|
|
106625
|
+
|
|
106626
|
+
Your output must be a JSON object containing the line number ranges of the most important lines for each stream. The JSON object should be enclosed in a markdown code block.
|
|
106627
|
+
|
|
106628
|
+
The JSON schema is as follows:
|
|
106629
|
+
{
|
|
106630
|
+
"stdout": [[start_line, end_line], ...],
|
|
106631
|
+
"stderr": [[start_line, end_line], ...]
|
|
106632
|
+
}
|
|
106633
|
+
|
|
106634
|
+
- Only include lines that are important for understanding the outcome of the command.
|
|
106635
|
+
- Group consecutive lines into a single range.
|
|
106636
|
+
|
|
106637
|
+
Example Output:
|
|
106638
|
+
\`\`\`json
|
|
106639
|
+
{
|
|
106640
|
+
"stdout": [[1, 3], [5, 7], [9, 11]],
|
|
106641
|
+
"stderr": [[1, 2], [4, 5]]
|
|
106642
|
+
}
|
|
106643
|
+
`;
|
|
106644
|
+
var schema = exports_external.object({
|
|
106645
|
+
stdout: exports_external.array(exports_external.array(exports_external.number()).length(2)).default([]),
|
|
106646
|
+
stderr: exports_external.array(exports_external.array(exports_external.number()).length(2)).default([])
|
|
106647
|
+
});
|
|
106772
106648
|
var summarizeOutput = async (model, stdout, stderr) => {
|
|
106773
|
-
const
|
|
106774
|
-
|
|
106775
|
-
|
|
106776
|
-
|
|
106777
|
-
|
|
106778
|
-
|
|
106779
|
-
|
|
106780
|
-
|
|
106781
|
-
|
|
106782
|
-
}
|
|
106783
|
-
|
|
106649
|
+
const lines = [];
|
|
106650
|
+
let input = "";
|
|
106651
|
+
let lineNumber = 1;
|
|
106652
|
+
for (const line of stdout.split(`
|
|
106653
|
+
`)) {
|
|
106654
|
+
lines.push(line);
|
|
106655
|
+
input += `[${lineNumber}]: stdout: ${line}
|
|
106656
|
+
`;
|
|
106657
|
+
lineNumber++;
|
|
106658
|
+
}
|
|
106659
|
+
for (const line of stderr.split(`
|
|
106660
|
+
`)) {
|
|
106661
|
+
lines.push(line);
|
|
106662
|
+
input += `[${lineNumber}]: stderr: ${line}
|
|
106663
|
+
`;
|
|
106664
|
+
lineNumber++;
|
|
106665
|
+
}
|
|
106666
|
+
let lastError;
|
|
106667
|
+
let respText = "";
|
|
106668
|
+
let currentPrompt = input;
|
|
106669
|
+
for (let i = 0;i < 3; i++) {
|
|
106670
|
+
const resp = await generateText({
|
|
106671
|
+
model,
|
|
106672
|
+
system: prompt3,
|
|
106673
|
+
prompt: currentPrompt
|
|
106674
|
+
});
|
|
106675
|
+
respText = resp.text;
|
|
106676
|
+
try {
|
|
106677
|
+
const parsed = parseJsonFromMarkdown(respText);
|
|
106678
|
+
const { stdout: stdoutRanges, stderr: stderrRanges } = schema.parse(parsed || {});
|
|
106679
|
+
let summarizedStdout = "";
|
|
106680
|
+
for (const range of stdoutRanges) {
|
|
106681
|
+
const [start, end] = range;
|
|
106682
|
+
for (let i2 = start;i2 <= end; i2++) {
|
|
106683
|
+
summarizedStdout += `${lines[i2 - 1]}
|
|
106684
|
+
`;
|
|
106685
|
+
}
|
|
106686
|
+
}
|
|
106687
|
+
let summarizedStderr = "";
|
|
106688
|
+
for (const range of stderrRanges) {
|
|
106689
|
+
const [start, end] = range;
|
|
106690
|
+
for (let i2 = start;i2 <= end; i2++) {
|
|
106691
|
+
summarizedStderr += `${lines[i2 - 1]}
|
|
106692
|
+
`;
|
|
106693
|
+
}
|
|
106694
|
+
}
|
|
106695
|
+
if (!summarizedStdout && !summarizedStderr) {
|
|
106696
|
+
throw new Error("You must output at least one line of stdout or stderr");
|
|
106697
|
+
}
|
|
106698
|
+
let result = "";
|
|
106699
|
+
if (summarizedStdout) {
|
|
106700
|
+
result += `STDOUT:
|
|
106701
|
+
${summarizedStdout}`;
|
|
106702
|
+
}
|
|
106703
|
+
if (summarizedStderr) {
|
|
106704
|
+
if (result) {
|
|
106705
|
+
result += `
|
|
106706
|
+
|
|
106707
|
+
`;
|
|
106708
|
+
}
|
|
106709
|
+
result += `STDERR:
|
|
106710
|
+
${summarizedStderr}`;
|
|
106711
|
+
}
|
|
106712
|
+
return result;
|
|
106713
|
+
} catch (error43) {
|
|
106714
|
+
lastError = error43 instanceof Error ? error43 : new Error(String(error43));
|
|
106715
|
+
currentPrompt = `${input}
|
|
106716
|
+
|
|
106717
|
+
Your previous output was invalid: ${lastError.message}. You MUST output a valid JSON object inside a markdown code block. Please correct it.`;
|
|
106718
|
+
}
|
|
106719
|
+
}
|
|
106720
|
+
throw new Error("Unable to summarize output");
|
|
106784
106721
|
};
|
|
106785
106722
|
|
|
106786
106723
|
// src/getProviderOptions.ts
|