@integrity-labs/agt-cli 0.28.1113 → 0.28.1115
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/bin/agt.js +5 -5
- package/dist/{chunk-OBZB6MUE.js → chunk-I332Y7ZA.js} +2 -2
- package/dist/chunk-I332Y7ZA.js.map +1 -0
- package/dist/{chunk-TXNVB3DN.js → chunk-MKAOLKYE.js} +194 -22
- package/dist/{chunk-TXNVB3DN.js.map → chunk-MKAOLKYE.js.map} +1 -1
- package/dist/{chunk-JX7ZXCNZ.js → chunk-YTCFFKTS.js} +2 -2
- package/dist/chunk-YTCFFKTS.js.map +1 -0
- package/dist/{claude-pair-runtime-GL67TYXC.js → claude-pair-runtime-LC2KGTRK.js} +2 -2
- package/dist/lib/manager-worker.js +17 -16
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +527 -104
- package/dist/mcp/index.js +33 -3
- package/dist/mcp/slack-channel.js +37 -7
- package/dist/mcp/teams-channel.js +34 -4
- package/dist/mcp/telegram-channel.js +35 -5
- package/dist/{persistent-session-6KIQF4O7.js → persistent-session-DMGOR6L5.js} +3 -3
- package/dist/{responsiveness-probe-GGJNITME.js → responsiveness-probe-JYYAJNID.js} +3 -3
- package/dist/{session-auth-dead-LMCPZJ4K.js → session-auth-dead-75QVSVYA.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-JX7ZXCNZ.js.map +0 -1
- package/dist/chunk-OBZB6MUE.js.map +0 -1
- /package/dist/{claude-pair-runtime-GL67TYXC.js.map → claude-pair-runtime-LC2KGTRK.js.map} +0 -0
- /package/dist/{persistent-session-6KIQF4O7.js.map → persistent-session-DMGOR6L5.js.map} +0 -0
- /package/dist/{responsiveness-probe-GGJNITME.js.map → responsiveness-probe-JYYAJNID.js.map} +0 -0
- /package/dist/{session-auth-dead-LMCPZJ4K.js.map → session-auth-dead-75QVSVYA.js.map} +0 -0
|
@@ -2988,7 +2988,7 @@ var require_compile = __commonJS({
|
|
|
2988
2988
|
const schOrFunc = root.refs[ref];
|
|
2989
2989
|
if (schOrFunc)
|
|
2990
2990
|
return schOrFunc;
|
|
2991
|
-
let _sch =
|
|
2991
|
+
let _sch = resolve2.call(this, root, ref);
|
|
2992
2992
|
if (_sch === void 0) {
|
|
2993
2993
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
2994
2994
|
const { schemaId } = this.opts;
|
|
@@ -3015,7 +3015,7 @@ var require_compile = __commonJS({
|
|
|
3015
3015
|
function sameSchemaEnv(s1, s2) {
|
|
3016
3016
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function resolve2(root, ref) {
|
|
3019
3019
|
let sch;
|
|
3020
3020
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3021
3021
|
ref = sch;
|
|
@@ -3590,7 +3590,7 @@ var require_fast_uri = __commonJS({
|
|
|
3590
3590
|
}
|
|
3591
3591
|
return uri;
|
|
3592
3592
|
}
|
|
3593
|
-
function
|
|
3593
|
+
function resolve2(baseURI, relativeURI, options) {
|
|
3594
3594
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3595
3595
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3596
3596
|
schemelessOptions.skipEscape = true;
|
|
@@ -3817,7 +3817,7 @@ var require_fast_uri = __commonJS({
|
|
|
3817
3817
|
var fastUri = {
|
|
3818
3818
|
SCHEMES,
|
|
3819
3819
|
normalize,
|
|
3820
|
-
resolve,
|
|
3820
|
+
resolve: resolve2,
|
|
3821
3821
|
resolveComponent,
|
|
3822
3822
|
equal,
|
|
3823
3823
|
serialize,
|
|
@@ -11591,10 +11591,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
11591
11591
|
let offset = bm.offset;
|
|
11592
11592
|
let commentEnd = null;
|
|
11593
11593
|
for (const collItem of bm.items) {
|
|
11594
|
-
const { start, key, sep:
|
|
11594
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
11595
11595
|
const keyProps = resolveProps.resolveProps(start, {
|
|
11596
11596
|
indicator: "explicit-key-ind",
|
|
11597
|
-
next: key ??
|
|
11597
|
+
next: key ?? sep3?.[0],
|
|
11598
11598
|
offset,
|
|
11599
11599
|
onError,
|
|
11600
11600
|
parentIndent: bm.indent,
|
|
@@ -11608,7 +11608,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11608
11608
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
11609
11609
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
11610
11610
|
}
|
|
11611
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
11611
|
+
if (!keyProps.anchor && !keyProps.tag && !sep3) {
|
|
11612
11612
|
commentEnd = keyProps.end;
|
|
11613
11613
|
if (keyProps.comment) {
|
|
11614
11614
|
if (map.comment)
|
|
@@ -11632,7 +11632,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11632
11632
|
ctx.atKey = false;
|
|
11633
11633
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
11634
11634
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
11635
|
-
const valueProps = resolveProps.resolveProps(
|
|
11635
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
11636
11636
|
indicator: "map-value-ind",
|
|
11637
11637
|
next: value,
|
|
11638
11638
|
offset: keyNode.range[2],
|
|
@@ -11648,7 +11648,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11648
11648
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
11649
11649
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
11650
11650
|
}
|
|
11651
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
11651
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep3, null, valueProps, onError);
|
|
11652
11652
|
if (ctx.schema.compat)
|
|
11653
11653
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
11654
11654
|
offset = valueNode.range[2];
|
|
@@ -11739,7 +11739,7 @@ var require_resolve_end = __commonJS({
|
|
|
11739
11739
|
let comment = "";
|
|
11740
11740
|
if (end) {
|
|
11741
11741
|
let hasSpace = false;
|
|
11742
|
-
let
|
|
11742
|
+
let sep3 = "";
|
|
11743
11743
|
for (const token of end) {
|
|
11744
11744
|
const { source, type } = token;
|
|
11745
11745
|
switch (type) {
|
|
@@ -11753,13 +11753,13 @@ var require_resolve_end = __commonJS({
|
|
|
11753
11753
|
if (!comment)
|
|
11754
11754
|
comment = cb;
|
|
11755
11755
|
else
|
|
11756
|
-
comment +=
|
|
11757
|
-
|
|
11756
|
+
comment += sep3 + cb;
|
|
11757
|
+
sep3 = "";
|
|
11758
11758
|
break;
|
|
11759
11759
|
}
|
|
11760
11760
|
case "newline":
|
|
11761
11761
|
if (comment)
|
|
11762
|
-
|
|
11762
|
+
sep3 += source;
|
|
11763
11763
|
hasSpace = true;
|
|
11764
11764
|
break;
|
|
11765
11765
|
default:
|
|
@@ -11802,18 +11802,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11802
11802
|
let offset = fc.offset + fc.start.source.length;
|
|
11803
11803
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
11804
11804
|
const collItem = fc.items[i];
|
|
11805
|
-
const { start, key, sep:
|
|
11805
|
+
const { start, key, sep: sep3, value } = collItem;
|
|
11806
11806
|
const props = resolveProps.resolveProps(start, {
|
|
11807
11807
|
flow: fcName,
|
|
11808
11808
|
indicator: "explicit-key-ind",
|
|
11809
|
-
next: key ??
|
|
11809
|
+
next: key ?? sep3?.[0],
|
|
11810
11810
|
offset,
|
|
11811
11811
|
onError,
|
|
11812
11812
|
parentIndent: fc.indent,
|
|
11813
11813
|
startOnNewline: false
|
|
11814
11814
|
});
|
|
11815
11815
|
if (!props.found) {
|
|
11816
|
-
if (!props.anchor && !props.tag && !
|
|
11816
|
+
if (!props.anchor && !props.tag && !sep3 && !value) {
|
|
11817
11817
|
if (i === 0 && props.comma)
|
|
11818
11818
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
11819
11819
|
else if (i < fc.items.length - 1)
|
|
@@ -11867,8 +11867,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11867
11867
|
}
|
|
11868
11868
|
}
|
|
11869
11869
|
}
|
|
11870
|
-
if (!isMap && !
|
|
11871
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
11870
|
+
if (!isMap && !sep3 && !props.found) {
|
|
11871
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
|
|
11872
11872
|
coll.items.push(valueNode);
|
|
11873
11873
|
offset = valueNode.range[2];
|
|
11874
11874
|
if (isBlock(value))
|
|
@@ -11880,7 +11880,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11880
11880
|
if (isBlock(key))
|
|
11881
11881
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
11882
11882
|
ctx.atKey = false;
|
|
11883
|
-
const valueProps = resolveProps.resolveProps(
|
|
11883
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
11884
11884
|
flow: fcName,
|
|
11885
11885
|
indicator: "map-value-ind",
|
|
11886
11886
|
next: value,
|
|
@@ -11891,8 +11891,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11891
11891
|
});
|
|
11892
11892
|
if (valueProps.found) {
|
|
11893
11893
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
11894
|
-
if (
|
|
11895
|
-
for (const st of
|
|
11894
|
+
if (sep3)
|
|
11895
|
+
for (const st of sep3) {
|
|
11896
11896
|
if (st === valueProps.found)
|
|
11897
11897
|
break;
|
|
11898
11898
|
if (st.type === "newline") {
|
|
@@ -11909,7 +11909,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11909
11909
|
else
|
|
11910
11910
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
11911
11911
|
}
|
|
11912
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
11912
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
|
|
11913
11913
|
if (valueNode) {
|
|
11914
11914
|
if (isBlock(value))
|
|
11915
11915
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -12089,7 +12089,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
12089
12089
|
chompStart = i + 1;
|
|
12090
12090
|
}
|
|
12091
12091
|
let value = "";
|
|
12092
|
-
let
|
|
12092
|
+
let sep3 = "";
|
|
12093
12093
|
let prevMoreIndented = false;
|
|
12094
12094
|
for (let i = 0; i < contentStart; ++i)
|
|
12095
12095
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -12106,24 +12106,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
12106
12106
|
indent = "";
|
|
12107
12107
|
}
|
|
12108
12108
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
12109
|
-
value +=
|
|
12110
|
-
|
|
12109
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
12110
|
+
sep3 = "\n";
|
|
12111
12111
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
12112
|
-
if (
|
|
12113
|
-
|
|
12114
|
-
else if (!prevMoreIndented &&
|
|
12115
|
-
|
|
12116
|
-
value +=
|
|
12117
|
-
|
|
12112
|
+
if (sep3 === " ")
|
|
12113
|
+
sep3 = "\n";
|
|
12114
|
+
else if (!prevMoreIndented && sep3 === "\n")
|
|
12115
|
+
sep3 = "\n\n";
|
|
12116
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
12117
|
+
sep3 = "\n";
|
|
12118
12118
|
prevMoreIndented = true;
|
|
12119
12119
|
} else if (content === "") {
|
|
12120
|
-
if (
|
|
12120
|
+
if (sep3 === "\n")
|
|
12121
12121
|
value += "\n";
|
|
12122
12122
|
else
|
|
12123
|
-
|
|
12123
|
+
sep3 = "\n";
|
|
12124
12124
|
} else {
|
|
12125
|
-
value +=
|
|
12126
|
-
|
|
12125
|
+
value += sep3 + content;
|
|
12126
|
+
sep3 = " ";
|
|
12127
12127
|
prevMoreIndented = false;
|
|
12128
12128
|
}
|
|
12129
12129
|
}
|
|
@@ -12305,25 +12305,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
12305
12305
|
if (!match)
|
|
12306
12306
|
return source;
|
|
12307
12307
|
let res = match[1];
|
|
12308
|
-
let
|
|
12308
|
+
let sep3 = " ";
|
|
12309
12309
|
let pos = first.lastIndex;
|
|
12310
12310
|
line.lastIndex = pos;
|
|
12311
12311
|
while (match = line.exec(source)) {
|
|
12312
12312
|
if (match[1] === "") {
|
|
12313
|
-
if (
|
|
12314
|
-
res +=
|
|
12313
|
+
if (sep3 === "\n")
|
|
12314
|
+
res += sep3;
|
|
12315
12315
|
else
|
|
12316
|
-
|
|
12316
|
+
sep3 = "\n";
|
|
12317
12317
|
} else {
|
|
12318
|
-
res +=
|
|
12319
|
-
|
|
12318
|
+
res += sep3 + match[1];
|
|
12319
|
+
sep3 = " ";
|
|
12320
12320
|
}
|
|
12321
12321
|
pos = line.lastIndex;
|
|
12322
12322
|
}
|
|
12323
12323
|
const last = /[ \t]*(.*)/sy;
|
|
12324
12324
|
last.lastIndex = pos;
|
|
12325
12325
|
match = last.exec(source);
|
|
12326
|
-
return res +
|
|
12326
|
+
return res + sep3 + (match?.[1] ?? "");
|
|
12327
12327
|
}
|
|
12328
12328
|
function doubleQuotedValue(source, onError) {
|
|
12329
12329
|
let res = "";
|
|
@@ -13131,14 +13131,14 @@ var require_cst_stringify = __commonJS({
|
|
|
13131
13131
|
}
|
|
13132
13132
|
}
|
|
13133
13133
|
}
|
|
13134
|
-
function stringifyItem({ start, key, sep:
|
|
13134
|
+
function stringifyItem({ start, key, sep: sep3, value }) {
|
|
13135
13135
|
let res = "";
|
|
13136
13136
|
for (const st of start)
|
|
13137
13137
|
res += st.source;
|
|
13138
13138
|
if (key)
|
|
13139
13139
|
res += stringifyToken(key);
|
|
13140
|
-
if (
|
|
13141
|
-
for (const st of
|
|
13140
|
+
if (sep3)
|
|
13141
|
+
for (const st of sep3)
|
|
13142
13142
|
res += st.source;
|
|
13143
13143
|
if (value)
|
|
13144
13144
|
res += stringifyToken(value);
|
|
@@ -14288,18 +14288,18 @@ var require_parser = __commonJS({
|
|
|
14288
14288
|
if (this.type === "map-value-ind") {
|
|
14289
14289
|
const prev = getPrevProps(this.peek(2));
|
|
14290
14290
|
const start = getFirstKeyStartProps(prev);
|
|
14291
|
-
let
|
|
14291
|
+
let sep3;
|
|
14292
14292
|
if (scalar.end) {
|
|
14293
|
-
|
|
14294
|
-
|
|
14293
|
+
sep3 = scalar.end;
|
|
14294
|
+
sep3.push(this.sourceToken);
|
|
14295
14295
|
delete scalar.end;
|
|
14296
14296
|
} else
|
|
14297
|
-
|
|
14297
|
+
sep3 = [this.sourceToken];
|
|
14298
14298
|
const map = {
|
|
14299
14299
|
type: "block-map",
|
|
14300
14300
|
offset: scalar.offset,
|
|
14301
14301
|
indent: scalar.indent,
|
|
14302
|
-
items: [{ start, key: scalar, sep:
|
|
14302
|
+
items: [{ start, key: scalar, sep: sep3 }]
|
|
14303
14303
|
};
|
|
14304
14304
|
this.onKeyLine = true;
|
|
14305
14305
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -14452,15 +14452,15 @@ var require_parser = __commonJS({
|
|
|
14452
14452
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
14453
14453
|
const start2 = getFirstKeyStartProps(it.start);
|
|
14454
14454
|
const key = it.key;
|
|
14455
|
-
const
|
|
14456
|
-
|
|
14455
|
+
const sep3 = it.sep;
|
|
14456
|
+
sep3.push(this.sourceToken);
|
|
14457
14457
|
delete it.key;
|
|
14458
14458
|
delete it.sep;
|
|
14459
14459
|
this.stack.push({
|
|
14460
14460
|
type: "block-map",
|
|
14461
14461
|
offset: this.offset,
|
|
14462
14462
|
indent: this.indent,
|
|
14463
|
-
items: [{ start: start2, key, sep:
|
|
14463
|
+
items: [{ start: start2, key, sep: sep3 }]
|
|
14464
14464
|
});
|
|
14465
14465
|
} else if (start.length > 0) {
|
|
14466
14466
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -14654,13 +14654,13 @@ var require_parser = __commonJS({
|
|
|
14654
14654
|
const prev = getPrevProps(parent);
|
|
14655
14655
|
const start = getFirstKeyStartProps(prev);
|
|
14656
14656
|
fixFlowSeqItems(fc);
|
|
14657
|
-
const
|
|
14658
|
-
|
|
14657
|
+
const sep3 = fc.end.splice(1, fc.end.length);
|
|
14658
|
+
sep3.push(this.sourceToken);
|
|
14659
14659
|
const map = {
|
|
14660
14660
|
type: "block-map",
|
|
14661
14661
|
offset: fc.offset,
|
|
14662
14662
|
indent: fc.indent,
|
|
14663
|
-
items: [{ start, key: fc, sep:
|
|
14663
|
+
items: [{ start, key: fc, sep: sep3 }]
|
|
14664
14664
|
};
|
|
14665
14665
|
this.onKeyLine = true;
|
|
14666
14666
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -17507,7 +17507,7 @@ var require_runtime = __commonJS({
|
|
|
17507
17507
|
}
|
|
17508
17508
|
return p2 && p2.lookup(name);
|
|
17509
17509
|
};
|
|
17510
|
-
_proto.resolve = function
|
|
17510
|
+
_proto.resolve = function resolve2(name, forWrite) {
|
|
17511
17511
|
var p2 = forWrite && this.isolateWrites ? void 0 : this.parent;
|
|
17512
17512
|
var val = this.variables[name];
|
|
17513
17513
|
if (val !== void 0) {
|
|
@@ -19237,7 +19237,7 @@ var require_loader = __commonJS({
|
|
|
19237
19237
|
return _EmitterObj.apply(this, arguments) || this;
|
|
19238
19238
|
}
|
|
19239
19239
|
var _proto = Loader.prototype;
|
|
19240
|
-
_proto.resolve = function
|
|
19240
|
+
_proto.resolve = function resolve2(from, to) {
|
|
19241
19241
|
return path.resolve(path.dirname(from), to);
|
|
19242
19242
|
};
|
|
19243
19243
|
_proto.isRelative = function isRelative(filename) {
|
|
@@ -19448,10 +19448,10 @@ var require_readdirp = __commonJS({
|
|
|
19448
19448
|
}
|
|
19449
19449
|
async _formatEntry(dirent, path) {
|
|
19450
19450
|
let entry;
|
|
19451
|
-
const
|
|
19451
|
+
const basename2 = this._isDirent ? dirent.name : dirent;
|
|
19452
19452
|
try {
|
|
19453
|
-
const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path,
|
|
19454
|
-
entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename };
|
|
19453
|
+
const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path, basename2));
|
|
19454
|
+
entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename: basename2 };
|
|
19455
19455
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
19456
19456
|
} catch (err) {
|
|
19457
19457
|
this._onError(err);
|
|
@@ -19521,9 +19521,9 @@ var require_readdirp = __commonJS({
|
|
|
19521
19521
|
return new ReaddirpStream(options);
|
|
19522
19522
|
}
|
|
19523
19523
|
function readdirpPromise(root, options = {}) {
|
|
19524
|
-
return new Promise((
|
|
19524
|
+
return new Promise((resolve2, reject) => {
|
|
19525
19525
|
const files = [];
|
|
19526
|
-
readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () =>
|
|
19526
|
+
readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () => resolve2(files)).on("error", (error2) => reject(error2));
|
|
19527
19527
|
});
|
|
19528
19528
|
}
|
|
19529
19529
|
exports.default = readdirp;
|
|
@@ -20008,9 +20008,9 @@ var require_handler = __commonJS({
|
|
|
20008
20008
|
_watchWithNodeFs(path, listener) {
|
|
20009
20009
|
const opts = this.fsw.options;
|
|
20010
20010
|
const directory = sysPath.dirname(path);
|
|
20011
|
-
const
|
|
20011
|
+
const basename2 = sysPath.basename(path);
|
|
20012
20012
|
const parent = this.fsw._getWatchedDir(directory);
|
|
20013
|
-
parent.add(
|
|
20013
|
+
parent.add(basename2);
|
|
20014
20014
|
const absolutePath = sysPath.resolve(path);
|
|
20015
20015
|
const options = {
|
|
20016
20016
|
persistent: opts.persistent
|
|
@@ -20020,7 +20020,7 @@ var require_handler = __commonJS({
|
|
|
20020
20020
|
let closer;
|
|
20021
20021
|
if (opts.usePolling) {
|
|
20022
20022
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
20023
|
-
options.interval = enableBin && isBinaryPath(
|
|
20023
|
+
options.interval = enableBin && isBinaryPath(basename2) ? opts.binaryInterval : opts.interval;
|
|
20024
20024
|
closer = setFsWatchFileListener(path, absolutePath, options, {
|
|
20025
20025
|
listener,
|
|
20026
20026
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -20043,10 +20043,10 @@ var require_handler = __commonJS({
|
|
|
20043
20043
|
return;
|
|
20044
20044
|
}
|
|
20045
20045
|
const dirname4 = sysPath.dirname(file);
|
|
20046
|
-
const
|
|
20046
|
+
const basename2 = sysPath.basename(file);
|
|
20047
20047
|
const parent = this.fsw._getWatchedDir(dirname4);
|
|
20048
20048
|
let prevStats = stats;
|
|
20049
|
-
if (parent.has(
|
|
20049
|
+
if (parent.has(basename2))
|
|
20050
20050
|
return;
|
|
20051
20051
|
const listener = async (path, newStats) => {
|
|
20052
20052
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
@@ -20071,9 +20071,9 @@ var require_handler = __commonJS({
|
|
|
20071
20071
|
prevStats = newStats2;
|
|
20072
20072
|
}
|
|
20073
20073
|
} catch (error2) {
|
|
20074
|
-
this.fsw._remove(dirname4,
|
|
20074
|
+
this.fsw._remove(dirname4, basename2);
|
|
20075
20075
|
}
|
|
20076
|
-
} else if (parent.has(
|
|
20076
|
+
} else if (parent.has(basename2)) {
|
|
20077
20077
|
const at = newStats.atimeMs;
|
|
20078
20078
|
const mt = newStats.mtimeMs;
|
|
20079
20079
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
|
@@ -20167,7 +20167,7 @@ var require_handler = __commonJS({
|
|
|
20167
20167
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
20168
20168
|
}
|
|
20169
20169
|
}).on(EV.ERROR, this._boundHandleError);
|
|
20170
|
-
return new Promise((
|
|
20170
|
+
return new Promise((resolve2, reject) => {
|
|
20171
20171
|
if (!stream)
|
|
20172
20172
|
return reject();
|
|
20173
20173
|
stream.once(exports.STR_END, () => {
|
|
@@ -20176,7 +20176,7 @@ var require_handler = __commonJS({
|
|
|
20176
20176
|
return;
|
|
20177
20177
|
}
|
|
20178
20178
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
20179
|
-
|
|
20179
|
+
resolve2(void 0);
|
|
20180
20180
|
previous.getChildren().filter((item) => {
|
|
20181
20181
|
return item !== directory && !current.has(item);
|
|
20182
20182
|
}).forEach((item) => {
|
|
@@ -21307,11 +21307,11 @@ var require_globals = __commonJS({
|
|
|
21307
21307
|
}
|
|
21308
21308
|
};
|
|
21309
21309
|
}
|
|
21310
|
-
function _joiner(
|
|
21311
|
-
|
|
21310
|
+
function _joiner(sep3) {
|
|
21311
|
+
sep3 = sep3 || ",";
|
|
21312
21312
|
var first = true;
|
|
21313
21313
|
return function() {
|
|
21314
|
-
var val = first ? "" :
|
|
21314
|
+
var val = first ? "" : sep3;
|
|
21315
21315
|
first = false;
|
|
21316
21316
|
return val;
|
|
21317
21317
|
};
|
|
@@ -21341,8 +21341,8 @@ var require_globals = __commonJS({
|
|
|
21341
21341
|
cycler: function cycler() {
|
|
21342
21342
|
return _cycler(Array.prototype.slice.call(arguments));
|
|
21343
21343
|
},
|
|
21344
|
-
joiner: function joiner(
|
|
21345
|
-
return _joiner(
|
|
21344
|
+
joiner: function joiner(sep3) {
|
|
21345
|
+
return _joiner(sep3);
|
|
21346
21346
|
}
|
|
21347
21347
|
};
|
|
21348
21348
|
}
|
|
@@ -28188,7 +28188,7 @@ var Protocol = class {
|
|
|
28188
28188
|
return;
|
|
28189
28189
|
}
|
|
28190
28190
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
28191
|
-
await new Promise((
|
|
28191
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
28192
28192
|
options?.signal?.throwIfAborted();
|
|
28193
28193
|
}
|
|
28194
28194
|
} catch (error2) {
|
|
@@ -28205,7 +28205,7 @@ var Protocol = class {
|
|
|
28205
28205
|
*/
|
|
28206
28206
|
request(request, resultSchema, options) {
|
|
28207
28207
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
28208
|
-
return new Promise((
|
|
28208
|
+
return new Promise((resolve2, reject) => {
|
|
28209
28209
|
const earlyReject = (error2) => {
|
|
28210
28210
|
reject(error2);
|
|
28211
28211
|
};
|
|
@@ -28283,7 +28283,7 @@ var Protocol = class {
|
|
|
28283
28283
|
if (!parseResult.success) {
|
|
28284
28284
|
reject(parseResult.error);
|
|
28285
28285
|
} else {
|
|
28286
|
-
|
|
28286
|
+
resolve2(parseResult.data);
|
|
28287
28287
|
}
|
|
28288
28288
|
} catch (error2) {
|
|
28289
28289
|
reject(error2);
|
|
@@ -28544,12 +28544,12 @@ var Protocol = class {
|
|
|
28544
28544
|
}
|
|
28545
28545
|
} catch {
|
|
28546
28546
|
}
|
|
28547
|
-
return new Promise((
|
|
28547
|
+
return new Promise((resolve2, reject) => {
|
|
28548
28548
|
if (signal.aborted) {
|
|
28549
28549
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
28550
28550
|
return;
|
|
28551
28551
|
}
|
|
28552
|
-
const timeoutId = setTimeout(
|
|
28552
|
+
const timeoutId = setTimeout(resolve2, interval);
|
|
28553
28553
|
signal.addEventListener("abort", () => {
|
|
28554
28554
|
clearTimeout(timeoutId);
|
|
28555
28555
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -29419,12 +29419,12 @@ var StdioServerTransport = class {
|
|
|
29419
29419
|
this.onclose?.();
|
|
29420
29420
|
}
|
|
29421
29421
|
send(message) {
|
|
29422
|
-
return new Promise((
|
|
29422
|
+
return new Promise((resolve2) => {
|
|
29423
29423
|
const json = serializeMessage(message);
|
|
29424
29424
|
if (this._stdout.write(json)) {
|
|
29425
|
-
|
|
29425
|
+
resolve2();
|
|
29426
29426
|
} else {
|
|
29427
|
-
this._stdout.once("drain",
|
|
29427
|
+
this._stdout.once("drain", resolve2);
|
|
29428
29428
|
}
|
|
29429
29429
|
});
|
|
29430
29430
|
}
|
|
@@ -29561,6 +29561,9 @@ function shouldRefuseImpersonatedEgress(toolName, egressTools) {
|
|
|
29561
29561
|
var DIRECT_CHAT_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
29562
29562
|
"direct_chat.reply",
|
|
29563
29563
|
"direct_chat.consume",
|
|
29564
|
+
// ENG-11455: puts a file into the customer's conversation storage, the
|
|
29565
|
+
// Direct Chat twin of telegram.upload_file (gated above for the same reason).
|
|
29566
|
+
"direct_chat.attach_file",
|
|
29564
29567
|
"channel_request_input"
|
|
29565
29568
|
]);
|
|
29566
29569
|
|
|
@@ -32733,6 +32736,21 @@ var ASSET_TYPES = {
|
|
|
32733
32736
|
// module header does not apply. Embedded as <audio src=...> in the page HTML.
|
|
32734
32737
|
"audio/mpeg": { ext: "mp3", maxBytes: 20 * MB, enabled: true }
|
|
32735
32738
|
};
|
|
32739
|
+
function sniffImageType(bytes) {
|
|
32740
|
+
const b = bytes;
|
|
32741
|
+
if (b.length >= 8 && b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71 && b[4] === 13 && b[5] === 10 && b[6] === 26 && b[7] === 10) {
|
|
32742
|
+
return "image/png";
|
|
32743
|
+
}
|
|
32744
|
+
if (b.length >= 3 && b[0] === 255 && b[1] === 216 && b[2] === 255)
|
|
32745
|
+
return "image/jpeg";
|
|
32746
|
+
if (b.length >= 6 && b[0] === 71 && b[1] === 73 && b[2] === 70 && b[3] === 56 && (b[4] === 55 || b[4] === 57) && b[5] === 97) {
|
|
32747
|
+
return "image/gif";
|
|
32748
|
+
}
|
|
32749
|
+
if (b.length >= 12 && b[0] === 82 && b[1] === 73 && b[2] === 70 && b[3] === 70 && b[8] === 87 && b[9] === 69 && b[10] === 66 && b[11] === 80) {
|
|
32750
|
+
return "image/webp";
|
|
32751
|
+
}
|
|
32752
|
+
return null;
|
|
32753
|
+
}
|
|
32736
32754
|
|
|
32737
32755
|
// ../core/dist/integrations/augmented-live/codec.js
|
|
32738
32756
|
var DEFAULT_CHUNK_BUDGET_BYTES = 180 * 1024;
|
|
@@ -35412,6 +35430,140 @@ var INSTALLABLE_NATIVE_INTEGRATION_IDS = INSTALLABLE_NATIVE_INTEGRATIONS.map((i)
|
|
|
35412
35430
|
// ../core/dist/direct-chat/upload.js
|
|
35413
35431
|
var MB2 = 1024 * 1024;
|
|
35414
35432
|
var DIRECT_CHAT_UPLOAD_MAX_BYTES = 100 * MB2;
|
|
35433
|
+
var DIRECT_CHAT_UPLOAD_TYPES = {
|
|
35434
|
+
"image/png": { ext: "png", kind: "image" },
|
|
35435
|
+
"image/jpeg": { ext: "jpg", kind: "image" },
|
|
35436
|
+
"image/webp": { ext: "webp", kind: "image" },
|
|
35437
|
+
"image/gif": { ext: "gif", kind: "image" },
|
|
35438
|
+
"application/pdf": { ext: "pdf", kind: "document" },
|
|
35439
|
+
"text/plain": { ext: "txt", kind: "document" },
|
|
35440
|
+
"text/csv": { ext: "csv", kind: "document" },
|
|
35441
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
|
|
35442
|
+
ext: "docx",
|
|
35443
|
+
kind: "document"
|
|
35444
|
+
},
|
|
35445
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
|
|
35446
|
+
ext: "xlsx",
|
|
35447
|
+
kind: "document"
|
|
35448
|
+
},
|
|
35449
|
+
// CS-1916: PowerPoint decks. Same OOXML ZIP container as docx/xlsx, so it
|
|
35450
|
+
// shares their byte verification and the document cap. Legacy binary .ppt
|
|
35451
|
+
// (application/vnd.ms-powerpoint, an OLE2 file, not a ZIP) stays rejected,
|
|
35452
|
+
// matching .doc/.xls, which are not allowed either.
|
|
35453
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
|
|
35454
|
+
ext: "pptx",
|
|
35455
|
+
kind: "document"
|
|
35456
|
+
}
|
|
35457
|
+
};
|
|
35458
|
+
var OOXML_EXTS = /* @__PURE__ */ new Set(["docx", "xlsx", "pptx"]);
|
|
35459
|
+
function normalizeUploadContentType(contentType) {
|
|
35460
|
+
return (contentType ?? "").trim().toLowerCase();
|
|
35461
|
+
}
|
|
35462
|
+
function contentTypeForExtension(ext) {
|
|
35463
|
+
const e = (ext ?? "").trim().toLowerCase().replace(/^\./, "");
|
|
35464
|
+
const want = e === "jpeg" ? "jpg" : e;
|
|
35465
|
+
if (!want)
|
|
35466
|
+
return null;
|
|
35467
|
+
for (const [contentType, spec] of Object.entries(DIRECT_CHAT_UPLOAD_TYPES)) {
|
|
35468
|
+
if (spec.ext === want)
|
|
35469
|
+
return contentType;
|
|
35470
|
+
}
|
|
35471
|
+
return null;
|
|
35472
|
+
}
|
|
35473
|
+
function allowedUploadExtensions() {
|
|
35474
|
+
return Object.values(DIRECT_CHAT_UPLOAD_TYPES).map((s) => s.ext);
|
|
35475
|
+
}
|
|
35476
|
+
function formatUploadSize(bytes) {
|
|
35477
|
+
if (!Number.isFinite(bytes) || bytes < 0)
|
|
35478
|
+
return `${bytes} bytes`;
|
|
35479
|
+
if (bytes >= MB2)
|
|
35480
|
+
return `${Math.round(bytes / MB2)} MB`;
|
|
35481
|
+
if (bytes >= 1024)
|
|
35482
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
35483
|
+
return `${bytes} bytes`;
|
|
35484
|
+
}
|
|
35485
|
+
function formatTooLargeMessage(byteSize, maxBytes) {
|
|
35486
|
+
const size = formatUploadSize(byteSize);
|
|
35487
|
+
const limit = formatUploadSize(maxBytes);
|
|
35488
|
+
if (size === limit) {
|
|
35489
|
+
return `File is just over the ${limit} limit.`;
|
|
35490
|
+
}
|
|
35491
|
+
return `File is ${size}; the limit is ${limit}.`;
|
|
35492
|
+
}
|
|
35493
|
+
var PDF_MAGIC = [37, 80, 68, 70, 45];
|
|
35494
|
+
var ZIP_MAGIC = [80, 75, 3, 4];
|
|
35495
|
+
function startsWith(bytes, sig) {
|
|
35496
|
+
if (bytes.length < sig.length)
|
|
35497
|
+
return false;
|
|
35498
|
+
for (let i = 0; i < sig.length; i++) {
|
|
35499
|
+
if (bytes[i] !== sig[i])
|
|
35500
|
+
return false;
|
|
35501
|
+
}
|
|
35502
|
+
return true;
|
|
35503
|
+
}
|
|
35504
|
+
var DIRECT_CHAT_SNIFF_BYTES = 8192;
|
|
35505
|
+
function containsAscii(bytes, needle, limit = DIRECT_CHAT_SNIFF_BYTES) {
|
|
35506
|
+
const sig = Array.from(needle, (ch) => ch.charCodeAt(0));
|
|
35507
|
+
const end = Math.min(bytes.length, limit) - sig.length;
|
|
35508
|
+
for (let i = 0; i <= end; i++) {
|
|
35509
|
+
let match = true;
|
|
35510
|
+
for (let j = 0; j < sig.length; j++) {
|
|
35511
|
+
if (bytes[i + j] !== sig[j]) {
|
|
35512
|
+
match = false;
|
|
35513
|
+
break;
|
|
35514
|
+
}
|
|
35515
|
+
}
|
|
35516
|
+
if (match)
|
|
35517
|
+
return true;
|
|
35518
|
+
}
|
|
35519
|
+
return false;
|
|
35520
|
+
}
|
|
35521
|
+
function looksLikeText(bytes) {
|
|
35522
|
+
if (sniffImageType(bytes) !== null)
|
|
35523
|
+
return false;
|
|
35524
|
+
if (startsWith(bytes, PDF_MAGIC) || startsWith(bytes, ZIP_MAGIC))
|
|
35525
|
+
return false;
|
|
35526
|
+
const sample = bytes.subarray(0, Math.min(bytes.length, 4096));
|
|
35527
|
+
for (let i = 0; i < sample.length; i++) {
|
|
35528
|
+
if (sample[i] === 0)
|
|
35529
|
+
return false;
|
|
35530
|
+
}
|
|
35531
|
+
return true;
|
|
35532
|
+
}
|
|
35533
|
+
function verifyDirectChatUploadBytes(bytes, declaredContentType) {
|
|
35534
|
+
const contentType = normalizeUploadContentType(declaredContentType);
|
|
35535
|
+
const spec = DIRECT_CHAT_UPLOAD_TYPES[contentType];
|
|
35536
|
+
if (!spec)
|
|
35537
|
+
return { ok: false, reason: `content_type "${declaredContentType}" is not allowed` };
|
|
35538
|
+
if (spec.kind === "image") {
|
|
35539
|
+
const real = sniffImageType(bytes);
|
|
35540
|
+
if (real !== contentType) {
|
|
35541
|
+
return {
|
|
35542
|
+
ok: false,
|
|
35543
|
+
reason: `declared ${contentType} but the bytes are ${real ?? "not a recognized image"}`
|
|
35544
|
+
};
|
|
35545
|
+
}
|
|
35546
|
+
return { ok: true, contentType, ext: spec.ext, kind: spec.kind };
|
|
35547
|
+
}
|
|
35548
|
+
if (contentType === "application/pdf") {
|
|
35549
|
+
if (!startsWith(bytes, PDF_MAGIC))
|
|
35550
|
+
return { ok: false, reason: "declared application/pdf but the bytes are not a PDF" };
|
|
35551
|
+
return { ok: true, contentType, ext: spec.ext, kind: spec.kind };
|
|
35552
|
+
}
|
|
35553
|
+
if (OOXML_EXTS.has(spec.ext)) {
|
|
35554
|
+
if (!startsWith(bytes, ZIP_MAGIC)) {
|
|
35555
|
+
return { ok: false, reason: `declared ${contentType} but the bytes are not an OOXML (ZIP) container` };
|
|
35556
|
+
}
|
|
35557
|
+
if (!containsAscii(bytes, "[Content_Types].xml")) {
|
|
35558
|
+
return { ok: false, reason: `declared ${contentType} but the ZIP is not a valid OOXML document` };
|
|
35559
|
+
}
|
|
35560
|
+
return { ok: true, contentType, ext: spec.ext, kind: spec.kind };
|
|
35561
|
+
}
|
|
35562
|
+
if (!looksLikeText(bytes)) {
|
|
35563
|
+
return { ok: false, reason: `declared ${contentType} but the bytes look binary` };
|
|
35564
|
+
}
|
|
35565
|
+
return { ok: true, contentType, ext: spec.ext, kind: spec.kind };
|
|
35566
|
+
}
|
|
35415
35567
|
|
|
35416
35568
|
// ../core/dist/direct-chat/notice-display.js
|
|
35417
35569
|
var AGENT_DIRECTED_NOTICE_KINDS = [
|
|
@@ -39850,8 +40002,38 @@ import { join as join10 } from "path";
|
|
|
39850
40002
|
import { existsSync as existsSync4, readFileSync as readFileSync8 } from "fs";
|
|
39851
40003
|
import { homedir as homedir2 } from "os";
|
|
39852
40004
|
import { join as join9 } from "path";
|
|
39853
|
-
function
|
|
39854
|
-
|
|
40005
|
+
function hasUsableFlags(path) {
|
|
40006
|
+
try {
|
|
40007
|
+
if (!existsSync4(path)) return false;
|
|
40008
|
+
const parsed = JSON.parse(readFileSync8(path, "utf8"));
|
|
40009
|
+
if (!parsed || typeof parsed !== "object") return false;
|
|
40010
|
+
const flags = parsed.flags;
|
|
40011
|
+
return !!flags && typeof flags === "object" && !Array.isArray(flags);
|
|
40012
|
+
} catch {
|
|
40013
|
+
return false;
|
|
40014
|
+
}
|
|
40015
|
+
}
|
|
40016
|
+
function cacheUpdatedAt(path) {
|
|
40017
|
+
try {
|
|
40018
|
+
if (!existsSync4(path)) return void 0;
|
|
40019
|
+
const parsed = JSON.parse(readFileSync8(path, "utf8"));
|
|
40020
|
+
if (!parsed || typeof parsed !== "object") return void 0;
|
|
40021
|
+
const u = parsed.updated_at;
|
|
40022
|
+
return typeof u === "string" && u.length > 0 ? u : void 0;
|
|
40023
|
+
} catch {
|
|
40024
|
+
return void 0;
|
|
40025
|
+
}
|
|
40026
|
+
}
|
|
40027
|
+
function defaultFlagsCachePath(env2 = process.env) {
|
|
40028
|
+
const hostWide = join9(homedir2(), ".augmented", "flags-cache.json");
|
|
40029
|
+
const agentId = env2["AGT_AGENT_ID"]?.trim();
|
|
40030
|
+
if (!agentId) return hostWide;
|
|
40031
|
+
const perAgent = join9(homedir2(), ".augmented", agentId, "flags-cache.json");
|
|
40032
|
+
if (!hasUsableFlags(perAgent)) return hostWide;
|
|
40033
|
+
const hostWideAt = cacheUpdatedAt(hostWide);
|
|
40034
|
+
const perAgentAt = cacheUpdatedAt(perAgent);
|
|
40035
|
+
if (hostWideAt && (!perAgentAt || perAgentAt < hostWideAt)) return hostWide;
|
|
40036
|
+
return perAgent;
|
|
39855
40037
|
}
|
|
39856
40038
|
function envBoolean(raw) {
|
|
39857
40039
|
if (raw === void 0) return void 0;
|
|
@@ -39878,7 +40060,7 @@ function resolveHostBooleanFlag(opts) {
|
|
|
39878
40060
|
const env2 = opts.env ?? process.env;
|
|
39879
40061
|
const envValue = envBoolean(env2[opts.envVar]);
|
|
39880
40062
|
if (envValue !== void 0) return envValue;
|
|
39881
|
-
const cached2 = cachedBoolean(opts.key, opts.cachePath ?? defaultFlagsCachePath());
|
|
40063
|
+
const cached2 = cachedBoolean(opts.key, opts.cachePath ?? defaultFlagsCachePath(env2));
|
|
39882
40064
|
if (cached2 !== void 0) return cached2;
|
|
39883
40065
|
return opts.defaultValue;
|
|
39884
40066
|
}
|
|
@@ -39909,7 +40091,7 @@ function cachedMaintenanceMode(path) {
|
|
|
39909
40091
|
}
|
|
39910
40092
|
}
|
|
39911
40093
|
function resolveMaintenanceMode(opts) {
|
|
39912
|
-
const cached2 = cachedMaintenanceMode(opts?.cachePath ?? defaultFlagsCachePath());
|
|
40094
|
+
const cached2 = cachedMaintenanceMode(opts?.cachePath ?? defaultFlagsCachePath(opts?.env));
|
|
39913
40095
|
if (cached2 !== void 0) return cached2;
|
|
39914
40096
|
return "off";
|
|
39915
40097
|
}
|
|
@@ -40314,7 +40496,7 @@ function classifyTranscriptSince(opts) {
|
|
|
40314
40496
|
}
|
|
40315
40497
|
return newest;
|
|
40316
40498
|
}
|
|
40317
|
-
var sleep = (ms) => new Promise((
|
|
40499
|
+
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
40318
40500
|
async function watchForRateLimitRefusal(opts) {
|
|
40319
40501
|
const now = opts.now ?? (() => Date.now());
|
|
40320
40502
|
const wait = opts.wait ?? sleep;
|
|
@@ -40356,7 +40538,7 @@ var FAST_POLL_MS = 500;
|
|
|
40356
40538
|
var SLOW_POLL_MS = 3e3;
|
|
40357
40539
|
var FAST_PHASE_MS = 1e4;
|
|
40358
40540
|
var RETRYING_NOTICE_AFTER_MS = 3 * 6e4;
|
|
40359
|
-
var sleep2 = (ms) => new Promise((
|
|
40541
|
+
var sleep2 = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
40360
40542
|
function classifyTurnFailureSince(opts) {
|
|
40361
40543
|
const dir = opts.transcriptDir ?? agentTranscriptDir({ cwd: opts.cwd, home: opts.home });
|
|
40362
40544
|
let entries;
|
|
@@ -40581,7 +40763,7 @@ function defaultIsPidAlive(pid) {
|
|
|
40581
40763
|
}
|
|
40582
40764
|
}
|
|
40583
40765
|
function acquireMcpSpawnLock(args) {
|
|
40584
|
-
const { agentDir, basename, options = {} } = args;
|
|
40766
|
+
const { agentDir, basename: basename2, options = {} } = args;
|
|
40585
40767
|
if (!agentDir) return { kind: "no-agent-dir" };
|
|
40586
40768
|
const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
|
|
40587
40769
|
const selfPid = options.selfPid ?? process.pid;
|
|
@@ -40589,7 +40771,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
40589
40771
|
const nowMs = options.nowMs ?? (() => Date.now());
|
|
40590
40772
|
const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
|
|
40591
40773
|
const staleMs = options.staleMs ?? STALE_LOCK_MS;
|
|
40592
|
-
const path = join13(agentDir,
|
|
40774
|
+
const path = join13(agentDir, basename2);
|
|
40593
40775
|
const existing = readLockHolder(path);
|
|
40594
40776
|
if (existing) {
|
|
40595
40777
|
if (existing.pid === selfPid) {
|
|
@@ -40799,6 +40981,161 @@ async function downloadInboundAttachments(attachments, dir, deps) {
|
|
|
40799
40981
|
return out;
|
|
40800
40982
|
}
|
|
40801
40983
|
|
|
40984
|
+
// src/direct-chat-attach.ts
|
|
40985
|
+
import { createHash } from "crypto";
|
|
40986
|
+
import { constants as fsConstants, promises as fsp } from "fs";
|
|
40987
|
+
import { basename, extname, isAbsolute as isAbsolute2, resolve, sep as sep2 } from "path";
|
|
40988
|
+
import { Readable } from "stream";
|
|
40989
|
+
var PUT_TIMEOUT_MS = 1800 * 1e3;
|
|
40990
|
+
function redactUrls(text) {
|
|
40991
|
+
return text.replace(/https?:\/\/\S+/g, "<url>");
|
|
40992
|
+
}
|
|
40993
|
+
function isWithin(parent, child) {
|
|
40994
|
+
const p2 = parent.endsWith(sep2) ? parent : parent + sep2;
|
|
40995
|
+
return child === parent || child.startsWith(p2);
|
|
40996
|
+
}
|
|
40997
|
+
async function sha256OfHandle(handle) {
|
|
40998
|
+
const hash = createHash("sha256");
|
|
40999
|
+
await new Promise((resolvePromise, reject) => {
|
|
41000
|
+
const stream = handle.createReadStream({ start: 0, autoClose: false });
|
|
41001
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
41002
|
+
stream.on("end", () => resolvePromise());
|
|
41003
|
+
stream.on("error", reject);
|
|
41004
|
+
});
|
|
41005
|
+
return hash.digest("hex");
|
|
41006
|
+
}
|
|
41007
|
+
async function attachWorkspaceFile(input, deps) {
|
|
41008
|
+
const rawPath = typeof input.path === "string" ? input.path.trim() : "";
|
|
41009
|
+
if (!rawPath) return { ok: false, error: "path is required" };
|
|
41010
|
+
if (!input.sessionId) return { ok: false, error: "session_id is required" };
|
|
41011
|
+
if (!deps.agentRoot) {
|
|
41012
|
+
return { ok: false, error: "cannot resolve your workspace directory on this host, so no file can be attached" };
|
|
41013
|
+
}
|
|
41014
|
+
const candidate = isAbsolute2(rawPath) ? rawPath : resolve(deps.cwd, rawPath);
|
|
41015
|
+
let realRoot;
|
|
41016
|
+
try {
|
|
41017
|
+
realRoot = await fsp.realpath(deps.agentRoot);
|
|
41018
|
+
} catch {
|
|
41019
|
+
return { ok: false, error: "cannot resolve your workspace directory on this host, so no file can be attached" };
|
|
41020
|
+
}
|
|
41021
|
+
let handle;
|
|
41022
|
+
try {
|
|
41023
|
+
handle = await fsp.open(candidate, fsConstants.O_RDONLY | fsConstants.O_NONBLOCK);
|
|
41024
|
+
} catch {
|
|
41025
|
+
return { ok: false, error: `no such file: ${rawPath}` };
|
|
41026
|
+
}
|
|
41027
|
+
try {
|
|
41028
|
+
if (deps.afterOpenForTest) await deps.afterOpenForTest();
|
|
41029
|
+
let size;
|
|
41030
|
+
let realFile;
|
|
41031
|
+
try {
|
|
41032
|
+
const opened = await handle.stat();
|
|
41033
|
+
if (!opened.isFile()) return { ok: false, error: `${rawPath} is not a regular file` };
|
|
41034
|
+
realFile = await fsp.realpath(candidate);
|
|
41035
|
+
if (!isWithin(realRoot, realFile)) {
|
|
41036
|
+
return {
|
|
41037
|
+
ok: false,
|
|
41038
|
+
error: `${rawPath} is outside your workspace; only files under your own agent directory can be attached`
|
|
41039
|
+
};
|
|
41040
|
+
}
|
|
41041
|
+
const atPath = await fsp.stat(realFile);
|
|
41042
|
+
if (atPath.dev !== opened.dev || atPath.ino !== opened.ino) {
|
|
41043
|
+
return { ok: false, error: `${rawPath} changed while it was being attached; try again` };
|
|
41044
|
+
}
|
|
41045
|
+
size = opened.size;
|
|
41046
|
+
} catch {
|
|
41047
|
+
return { ok: false, error: `cannot read ${rawPath}` };
|
|
41048
|
+
}
|
|
41049
|
+
if (size <= 0) return { ok: false, error: `${rawPath} is empty` };
|
|
41050
|
+
if (size > DIRECT_CHAT_UPLOAD_MAX_BYTES) {
|
|
41051
|
+
return { ok: false, error: formatTooLargeMessage(size, DIRECT_CHAT_UPLOAD_MAX_BYTES) };
|
|
41052
|
+
}
|
|
41053
|
+
const filename = basename(realFile);
|
|
41054
|
+
const contentType = contentTypeForExtension(extname(filename));
|
|
41055
|
+
if (!contentType) {
|
|
41056
|
+
return {
|
|
41057
|
+
ok: false,
|
|
41058
|
+
error: `${filename} has a file type that cannot be attached. Allowed: ${allowedUploadExtensions().join(", ")}`
|
|
41059
|
+
};
|
|
41060
|
+
}
|
|
41061
|
+
let head;
|
|
41062
|
+
try {
|
|
41063
|
+
const buf = Buffer.alloc(DIRECT_CHAT_SNIFF_BYTES);
|
|
41064
|
+
const { bytesRead } = await handle.read(buf, 0, DIRECT_CHAT_SNIFF_BYTES, 0);
|
|
41065
|
+
head = new Uint8Array(buf.subarray(0, bytesRead));
|
|
41066
|
+
} catch {
|
|
41067
|
+
return { ok: false, error: `cannot read ${rawPath}` };
|
|
41068
|
+
}
|
|
41069
|
+
const sniff = verifyDirectChatUploadBytes(head, contentType);
|
|
41070
|
+
if (!sniff.ok) {
|
|
41071
|
+
return { ok: false, error: `${filename} does not contain what its extension says (${sniff.reason})` };
|
|
41072
|
+
}
|
|
41073
|
+
let sha256;
|
|
41074
|
+
try {
|
|
41075
|
+
sha256 = await sha256OfHandle(handle);
|
|
41076
|
+
} catch {
|
|
41077
|
+
return { ok: false, error: `cannot read ${rawPath}` };
|
|
41078
|
+
}
|
|
41079
|
+
let minted;
|
|
41080
|
+
try {
|
|
41081
|
+
const res = await deps.apiPost("/host/direct-chat/uploads", {
|
|
41082
|
+
agent_id: deps.agentId,
|
|
41083
|
+
session_id: input.sessionId,
|
|
41084
|
+
filename,
|
|
41085
|
+
content_type: contentType,
|
|
41086
|
+
byte_size: size,
|
|
41087
|
+
sha256
|
|
41088
|
+
});
|
|
41089
|
+
minted = await res.json().catch(() => ({})) ?? {};
|
|
41090
|
+
if (!res.ok || !minted.upload_id || !minted.upload_url) {
|
|
41091
|
+
return {
|
|
41092
|
+
ok: false,
|
|
41093
|
+
error: redactUrls(`could not start the upload: ${minted.error ?? `HTTP ${res.status}`}`)
|
|
41094
|
+
};
|
|
41095
|
+
}
|
|
41096
|
+
} catch (err) {
|
|
41097
|
+
return { ok: false, error: redactUrls(`could not start the upload: ${err.message}`) };
|
|
41098
|
+
}
|
|
41099
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
41100
|
+
try {
|
|
41101
|
+
const body = Readable.toWeb(handle.createReadStream({ start: 0, autoClose: false }));
|
|
41102
|
+
const put = await fetchImpl(minted.upload_url, {
|
|
41103
|
+
method: "PUT",
|
|
41104
|
+
headers: {
|
|
41105
|
+
"Content-Type": contentType,
|
|
41106
|
+
"If-None-Match": "*",
|
|
41107
|
+
"Content-Length": String(size)
|
|
41108
|
+
},
|
|
41109
|
+
body,
|
|
41110
|
+
// Required by Node's fetch for a streamed request body.
|
|
41111
|
+
duplex: "half",
|
|
41112
|
+
// Bounded by the presigned URL's own 30-minute validity: past that the PUT
|
|
41113
|
+
// cannot succeed anyway, so do not hold the tool call open beyond it.
|
|
41114
|
+
signal: AbortSignal.timeout(PUT_TIMEOUT_MS)
|
|
41115
|
+
});
|
|
41116
|
+
if (!(put.ok || put.status === 412)) {
|
|
41117
|
+
return { ok: false, error: `upload of ${filename} failed (HTTP ${put.status})` };
|
|
41118
|
+
}
|
|
41119
|
+
} catch (err) {
|
|
41120
|
+
return { ok: false, error: redactUrls(`upload of ${filename} failed: ${err.message}`) };
|
|
41121
|
+
}
|
|
41122
|
+
return { ok: true, file: { upload_id: minted.upload_id, filename, content_type: contentType, byte_size: size } };
|
|
41123
|
+
} finally {
|
|
41124
|
+
await handle.close().catch(() => void 0);
|
|
41125
|
+
}
|
|
41126
|
+
}
|
|
41127
|
+
function replySentText(data) {
|
|
41128
|
+
const linked = data?.attachments_linked ?? [];
|
|
41129
|
+
const rejected = data?.attachments_rejected ?? [];
|
|
41130
|
+
if (rejected.length > 0) {
|
|
41131
|
+
const list = rejected.map((r) => `${r.upload_id} (${redactUrls(r.reason)})`).join("; ");
|
|
41132
|
+
const attached = linked.length > 0 ? ` with ${linked.length} attachment(s)` : "";
|
|
41133
|
+
return `sent${attached}, but ${rejected.length} file(s) were NOT attached: ${list}. Tell the user, or fix and attach again in a follow-up reply.`;
|
|
41134
|
+
}
|
|
41135
|
+
if (linked.length > 0) return `sent with ${linked.length} attachment(s): ${linked.map((l) => l.filename).join(", ")}`;
|
|
41136
|
+
return "sent";
|
|
41137
|
+
}
|
|
41138
|
+
|
|
40802
41139
|
// src/direct-chat-structured-payload.ts
|
|
40803
41140
|
var RENDERED_KINDS = /* @__PURE__ */ new Set(["form_result", "button_click"]);
|
|
40804
41141
|
var MAX_RENDERED_CHARS = 4e3;
|
|
@@ -41434,12 +41771,16 @@ function buildDirectChatMcpInstructions() {
|
|
|
41434
41771
|
"Always reply to every direct chat message that expects a reply (its meta has requires_reply=true, or no requires_reply field) \u2014 the user is waiting in the webapp.",
|
|
41435
41772
|
"NEVER call direct_chat_reply for a NOTICE \u2014 a notification whose meta has requires_reply=false (ENG-6381). It is an informational FYI (e.g. an integration-status update), not a question, and it has ALREADY been acknowledged for you. Replying would wrongly post into the operator\u2019s chat history and burn a turn. Just take it into account and carry on.",
|
|
41436
41773
|
"In the rare case you deliberately handle a reply-expecting message without replying (e.g. an internal command), call direct_chat_consume with the session_id so it is not treated as undelivered and redelivered.",
|
|
41437
|
-
|
|
41774
|
+
// ENG-11455: replaces "You have full access to all your MCP tools", which
|
|
41775
|
+
// told the agent nothing it could act on. This blob is within ~40 chars of
|
|
41776
|
+
// the 2048 cap (eng-9649), so the file procedure lives in the
|
|
41777
|
+
// direct_chat_attach_file tool description; this line only points at it.
|
|
41778
|
+
"Keep replies concise. To send a file: direct_chat_attach_file, then its upload_id in direct_chat_reply upload_ids."
|
|
41438
41779
|
].join(" ");
|
|
41439
41780
|
}
|
|
41440
41781
|
|
|
41441
41782
|
// src/usage-limit-reactive-decision.ts
|
|
41442
|
-
import { createHash } from "crypto";
|
|
41783
|
+
import { createHash as createHash2 } from "crypto";
|
|
41443
41784
|
function shouldArmWatch(opts) {
|
|
41444
41785
|
return !opts.isBot && opts.replyOwed;
|
|
41445
41786
|
}
|
|
@@ -41474,7 +41815,7 @@ function decideUsageLimitCursorCall(opts) {
|
|
|
41474
41815
|
}
|
|
41475
41816
|
function describeUnparsedRefusal(text) {
|
|
41476
41817
|
if (!text) return "refusal=absent";
|
|
41477
|
-
const hash =
|
|
41818
|
+
const hash = createHash2("sha256").update(text).digest("hex").slice(0, 12);
|
|
41478
41819
|
return `refusal_hash=${hash} refusal_len=${text.length}`;
|
|
41479
41820
|
}
|
|
41480
41821
|
|
|
@@ -41503,6 +41844,12 @@ var INBOUND_ATTACHMENTS_DIR = resolveInboundAttachmentsDir({
|
|
|
41503
41844
|
agentId: AGT_AGENT_ID,
|
|
41504
41845
|
homeDir: homedir5()
|
|
41505
41846
|
});
|
|
41847
|
+
var OUTBOUND_ATTACHMENT_ROOT = resolveAgentDirAlias({
|
|
41848
|
+
codeName: process.env.AGT_AGENT_CODE_NAME,
|
|
41849
|
+
turnInitiatorFile: process.env.AGT_TURN_INITIATOR_FILE,
|
|
41850
|
+
agentId: AGT_AGENT_ID,
|
|
41851
|
+
homeDir: homedir5()
|
|
41852
|
+
});
|
|
41506
41853
|
var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
41507
41854
|
var directChatStderrLogStream = null;
|
|
41508
41855
|
if (AGT_AGENT_CODE_NAME) {
|
|
@@ -41701,7 +42048,7 @@ var STREAM_REPLY_FLUSH_MS = (() => {
|
|
|
41701
42048
|
const n = raw ? Number(raw) : NaN;
|
|
41702
42049
|
return Number.isFinite(n) && n >= 0 ? n : 60;
|
|
41703
42050
|
})();
|
|
41704
|
-
var sleep3 = (ms) => ms > 0 ? new Promise((
|
|
42051
|
+
var sleep3 = (ms) => ms > 0 ? new Promise((resolve2) => setTimeout(resolve2, ms)) : Promise.resolve();
|
|
41705
42052
|
async function apiPost(path, body) {
|
|
41706
42053
|
const token = await getAuthToken();
|
|
41707
42054
|
const res = await fetchWithTimeout(`${AGT_HOST}${path}`, {
|
|
@@ -41914,11 +42261,38 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
41914
42261
|
content: {
|
|
41915
42262
|
type: "string",
|
|
41916
42263
|
description: "The reply message (supports markdown)"
|
|
42264
|
+
},
|
|
42265
|
+
upload_ids: {
|
|
42266
|
+
type: "array",
|
|
42267
|
+
items: { type: "string" },
|
|
42268
|
+
description: "Files to attach to this reply: the upload_id values returned by direct_chat_attach_file in this same session (up to 10). The user downloads them from the chips under your message."
|
|
41917
42269
|
}
|
|
41918
42270
|
},
|
|
41919
42271
|
required: ["session_id", "content"]
|
|
41920
42272
|
}
|
|
41921
42273
|
},
|
|
42274
|
+
{
|
|
42275
|
+
// ENG-11455: the Direct Chat counterpart of slack_upload_file. Uploads a
|
|
42276
|
+
// workspace file through the existing, verified upload path and returns an
|
|
42277
|
+
// upload_id to pass to direct_chat_reply. The storage URL never reaches
|
|
42278
|
+
// the agent (see direct-chat-attach.ts).
|
|
42279
|
+
name: "direct_chat.attach_file",
|
|
42280
|
+
description: "Attach a file from your workspace to a Direct Chat reply. Uploads it and returns an upload_id; then call direct_chat_reply with upload_ids: [that id] to send it. Allowed types: png, jpg, webp, gif, pdf, txt, csv, docx, xlsx, pptx, up to 100 MB. The file must really be what its extension says. Only files under your own agent directory can be attached.",
|
|
42281
|
+
inputSchema: {
|
|
42282
|
+
type: "object",
|
|
42283
|
+
properties: {
|
|
42284
|
+
session_id: {
|
|
42285
|
+
type: "string",
|
|
42286
|
+
description: "Session ID (from the session_id attribute in the <channel> tag)"
|
|
42287
|
+
},
|
|
42288
|
+
path: {
|
|
42289
|
+
type: "string",
|
|
42290
|
+
description: "Absolute path to the file (recommended). Must be under your own agent directory (~/.augmented/<code_name>/), e.g. in project/ or scratch/. A relative path resolves against your working directory."
|
|
42291
|
+
}
|
|
42292
|
+
},
|
|
42293
|
+
required: ["session_id", "path"]
|
|
42294
|
+
}
|
|
42295
|
+
},
|
|
41922
42296
|
{
|
|
41923
42297
|
name: "direct_chat.consume",
|
|
41924
42298
|
description: "Acknowledge direct-chat message(s) you handled WITHOUT sending a reply (e.g. a command that only updated state, or a message you deliberately ignored). Pass the session_id from the <channel> tag. If you send a direct_chat_reply you do NOT also need to consume \u2014 the reply already acknowledges the message. Without one of the two, a silently-handled message is treated as undelivered and may be redelivered.",
|
|
@@ -41991,7 +42365,23 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
41991
42365
|
};
|
|
41992
42366
|
}
|
|
41993
42367
|
if (name === "direct_chat.reply") {
|
|
41994
|
-
const { session_id, content: rawContent } = args;
|
|
42368
|
+
const { session_id, content: rawContent, upload_ids: rawUploadIds } = args;
|
|
42369
|
+
let upload_ids;
|
|
42370
|
+
if (rawUploadIds !== void 0) {
|
|
42371
|
+
if (!Array.isArray(rawUploadIds) || rawUploadIds.some((x) => typeof x !== "string" || !x)) {
|
|
42372
|
+
return {
|
|
42373
|
+
content: [{ type: "text", text: "upload_ids must be an array of upload_id strings from direct_chat_attach_file" }],
|
|
42374
|
+
isError: true
|
|
42375
|
+
};
|
|
42376
|
+
}
|
|
42377
|
+
if (rawUploadIds.length > 10) {
|
|
42378
|
+
return {
|
|
42379
|
+
content: [{ type: "text", text: "At most 10 files can be attached to one reply" }],
|
|
42380
|
+
isError: true
|
|
42381
|
+
};
|
|
42382
|
+
}
|
|
42383
|
+
upload_ids = rawUploadIds.length > 0 ? rawUploadIds : void 0;
|
|
42384
|
+
}
|
|
41995
42385
|
if (rawContent == null) {
|
|
41996
42386
|
return {
|
|
41997
42387
|
content: [{ type: "text", text: "Missing required argument: content" }],
|
|
@@ -42018,7 +42408,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
42018
42408
|
agent_id: AGT_AGENT_ID,
|
|
42019
42409
|
session_id,
|
|
42020
42410
|
content: slices[0],
|
|
42021
|
-
message_ids
|
|
42411
|
+
message_ids,
|
|
42412
|
+
// ENG-11455: files bind to the anchor row, the one that persists.
|
|
42413
|
+
...upload_ids ? { upload_ids } : {}
|
|
42022
42414
|
});
|
|
42023
42415
|
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
42024
42416
|
const verdict = judgeCursorAdvance(
|
|
@@ -42074,7 +42466,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
42074
42466
|
await maybeSendDirectChatAccountWarn(session_id);
|
|
42075
42467
|
void maybeSendDirectChatToolsOfflineNotice(session_id).catch(() => {
|
|
42076
42468
|
});
|
|
42077
|
-
return { content: [{ type: "text", text:
|
|
42469
|
+
return { content: [{ type: "text", text: replySentText(data) }] };
|
|
42078
42470
|
} catch (err) {
|
|
42079
42471
|
return {
|
|
42080
42472
|
content: [{ type: "text", text: `Failed: ${err.message}` }],
|
|
@@ -42087,7 +42479,8 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
42087
42479
|
agent_id: AGT_AGENT_ID,
|
|
42088
42480
|
session_id,
|
|
42089
42481
|
content,
|
|
42090
|
-
message_ids
|
|
42482
|
+
message_ids,
|
|
42483
|
+
...upload_ids ? { upload_ids } : {}
|
|
42091
42484
|
});
|
|
42092
42485
|
const { body: data, httpOk, statusText } = await readCursorAdvanceBody(res);
|
|
42093
42486
|
const verdict = judgeCursorAdvance(
|
|
@@ -42117,7 +42510,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
42117
42510
|
await maybeSendDirectChatAccountWarn(session_id);
|
|
42118
42511
|
void maybeSendDirectChatToolsOfflineNotice(session_id).catch(() => {
|
|
42119
42512
|
});
|
|
42120
|
-
return { content: [{ type: "text", text:
|
|
42513
|
+
return { content: [{ type: "text", text: replySentText(data) }] };
|
|
42121
42514
|
} catch (err) {
|
|
42122
42515
|
return {
|
|
42123
42516
|
content: [{ type: "text", text: `Failed: ${err.message}` }],
|
|
@@ -42125,6 +42518,36 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
42125
42518
|
};
|
|
42126
42519
|
}
|
|
42127
42520
|
}
|
|
42521
|
+
if (name === "direct_chat.attach_file") {
|
|
42522
|
+
const { session_id, path } = args ?? {};
|
|
42523
|
+
if (!session_id || !path) {
|
|
42524
|
+
return {
|
|
42525
|
+
content: [{ type: "text", text: "Missing required argument: session_id and path" }],
|
|
42526
|
+
isError: true
|
|
42527
|
+
};
|
|
42528
|
+
}
|
|
42529
|
+
const result = await attachWorkspaceFile(
|
|
42530
|
+
{ sessionId: session_id, path },
|
|
42531
|
+
{ agentRoot: OUTBOUND_ATTACHMENT_ROOT, cwd: process.cwd(), apiPost, agentId: AGT_AGENT_ID }
|
|
42532
|
+
);
|
|
42533
|
+
if (!result.ok) {
|
|
42534
|
+
return { content: [{ type: "text", text: `Not attached: ${result.error}` }], isError: true };
|
|
42535
|
+
}
|
|
42536
|
+
return {
|
|
42537
|
+
content: [
|
|
42538
|
+
{
|
|
42539
|
+
type: "text",
|
|
42540
|
+
text: JSON.stringify({
|
|
42541
|
+
upload_id: result.file.upload_id,
|
|
42542
|
+
filename: result.file.filename,
|
|
42543
|
+
content_type: result.file.content_type,
|
|
42544
|
+
byte_size: result.file.byte_size,
|
|
42545
|
+
next: "Pass this upload_id in upload_ids on direct_chat_reply (same session_id) to send the file."
|
|
42546
|
+
})
|
|
42547
|
+
}
|
|
42548
|
+
]
|
|
42549
|
+
};
|
|
42550
|
+
}
|
|
42128
42551
|
if (name === "direct_chat.consume") {
|
|
42129
42552
|
const { session_id } = args;
|
|
42130
42553
|
const message_ids = claimTracker.peek(session_id);
|
|
@@ -42838,8 +43261,8 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
|
|
|
42838
43261
|
if (sessionState.fresh) {
|
|
42839
43262
|
void runBacklogDrain({
|
|
42840
43263
|
attempt: () => pollOnce(void 0),
|
|
42841
|
-
sleep: (ms) => new Promise((
|
|
42842
|
-
const t = setTimeout(
|
|
43264
|
+
sleep: (ms) => new Promise((resolve2) => {
|
|
43265
|
+
const t = setTimeout(resolve2, ms);
|
|
42843
43266
|
t.unref?.();
|
|
42844
43267
|
}),
|
|
42845
43268
|
onLog: (line) => process.stderr.write(`${line}
|