@integrity-labs/agt-cli 0.28.1088 → 0.28.1090
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-JAXSZCTH.js → chunk-3YZWZJZR.js} +4 -4
- package/dist/{chunk-YOIJFB4J.js → chunk-DAZBANX7.js} +4 -2
- package/dist/{chunk-YOIJFB4J.js.map → chunk-DAZBANX7.js.map} +1 -1
- package/dist/{chunk-HN6B5G5V.js → chunk-YBOORROA.js} +2 -2
- package/dist/{claude-pair-runtime-XZXUHC4Q.js → claude-pair-runtime-U3QGHO36.js} +2 -2
- package/dist/lib/manager-worker.js +16 -16
- package/dist/mcp/direct-chat-channel.js +176 -133
- package/dist/mcp/index.js +175 -41
- package/dist/mcp/origami.js +3 -1
- package/dist/mcp/slack-channel.js +347 -262
- package/dist/mcp/teams-channel.js +210 -86
- package/dist/mcp/telegram-channel.js +290 -207
- package/dist/mcp/whatsapp-channel.js +194 -69
- package/dist/{persistent-session-QVJASJSQ.js → persistent-session-V3AMSH7S.js} +3 -3
- package/dist/{responsiveness-probe-AZSZBDKL.js → responsiveness-probe-MZBID4WC.js} +3 -3
- package/dist/{session-auth-dead-VY7AZM77.js → session-auth-dead-OCGA6YZW.js} +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-JAXSZCTH.js.map → chunk-3YZWZJZR.js.map} +0 -0
- /package/dist/{chunk-HN6B5G5V.js.map → chunk-YBOORROA.js.map} +0 -0
- /package/dist/{claude-pair-runtime-XZXUHC4Q.js.map → claude-pair-runtime-U3QGHO36.js.map} +0 -0
- /package/dist/{persistent-session-QVJASJSQ.js.map → persistent-session-V3AMSH7S.js.map} +0 -0
- /package/dist/{responsiveness-probe-AZSZBDKL.js.map → responsiveness-probe-MZBID4WC.js.map} +0 -0
- /package/dist/{session-auth-dead-VY7AZM77.js.map → session-auth-dead-OCGA6YZW.js.map} +0 -0
|
@@ -3599,49 +3599,49 @@ var require_fast_uri = __commonJS({
|
|
|
3599
3599
|
schemelessOptions.skipEscape = true;
|
|
3600
3600
|
return serialize(resolved, schemelessOptions);
|
|
3601
3601
|
}
|
|
3602
|
-
function resolveComponent(base,
|
|
3602
|
+
function resolveComponent(base, relative2, options, skipNormalization) {
|
|
3603
3603
|
const target = {};
|
|
3604
3604
|
if (!skipNormalization) {
|
|
3605
3605
|
base = parse3(serialize(base, options), options);
|
|
3606
|
-
|
|
3606
|
+
relative2 = parse3(serialize(relative2, options), options);
|
|
3607
3607
|
}
|
|
3608
3608
|
options = options || {};
|
|
3609
|
-
if (!options.tolerant &&
|
|
3610
|
-
target.scheme =
|
|
3611
|
-
target.userinfo =
|
|
3612
|
-
target.host =
|
|
3613
|
-
target.port =
|
|
3614
|
-
target.path = removeDotSegments(
|
|
3615
|
-
target.query =
|
|
3609
|
+
if (!options.tolerant && relative2.scheme) {
|
|
3610
|
+
target.scheme = relative2.scheme;
|
|
3611
|
+
target.userinfo = relative2.userinfo;
|
|
3612
|
+
target.host = relative2.host;
|
|
3613
|
+
target.port = relative2.port;
|
|
3614
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
3615
|
+
target.query = relative2.query;
|
|
3616
3616
|
} else {
|
|
3617
|
-
if (
|
|
3618
|
-
target.userinfo =
|
|
3619
|
-
target.host =
|
|
3620
|
-
target.port =
|
|
3621
|
-
target.path = removeDotSegments(
|
|
3622
|
-
target.query =
|
|
3617
|
+
if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
|
|
3618
|
+
target.userinfo = relative2.userinfo;
|
|
3619
|
+
target.host = relative2.host;
|
|
3620
|
+
target.port = relative2.port;
|
|
3621
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
3622
|
+
target.query = relative2.query;
|
|
3623
3623
|
} else {
|
|
3624
|
-
if (!
|
|
3624
|
+
if (!relative2.path) {
|
|
3625
3625
|
target.path = base.path;
|
|
3626
|
-
if (
|
|
3627
|
-
target.query =
|
|
3626
|
+
if (relative2.query !== void 0) {
|
|
3627
|
+
target.query = relative2.query;
|
|
3628
3628
|
} else {
|
|
3629
3629
|
target.query = base.query;
|
|
3630
3630
|
}
|
|
3631
3631
|
} else {
|
|
3632
|
-
if (
|
|
3633
|
-
target.path = removeDotSegments(
|
|
3632
|
+
if (relative2.path[0] === "/") {
|
|
3633
|
+
target.path = removeDotSegments(relative2.path);
|
|
3634
3634
|
} else {
|
|
3635
3635
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
3636
|
-
target.path = "/" +
|
|
3636
|
+
target.path = "/" + relative2.path;
|
|
3637
3637
|
} else if (!base.path) {
|
|
3638
|
-
target.path =
|
|
3638
|
+
target.path = relative2.path;
|
|
3639
3639
|
} else {
|
|
3640
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
3640
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
|
|
3641
3641
|
}
|
|
3642
3642
|
target.path = removeDotSegments(target.path);
|
|
3643
3643
|
}
|
|
3644
|
-
target.query =
|
|
3644
|
+
target.query = relative2.query;
|
|
3645
3645
|
}
|
|
3646
3646
|
target.userinfo = base.userinfo;
|
|
3647
3647
|
target.host = base.host;
|
|
@@ -3649,7 +3649,7 @@ var require_fast_uri = __commonJS({
|
|
|
3649
3649
|
}
|
|
3650
3650
|
target.scheme = base.scheme;
|
|
3651
3651
|
}
|
|
3652
|
-
target.fragment =
|
|
3652
|
+
target.fragment = relative2.fragment;
|
|
3653
3653
|
return target;
|
|
3654
3654
|
}
|
|
3655
3655
|
function equal(uriA, uriB, options) {
|
|
@@ -11656,10 +11656,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
11656
11656
|
let offset = bm.offset;
|
|
11657
11657
|
let commentEnd = null;
|
|
11658
11658
|
for (const collItem of bm.items) {
|
|
11659
|
-
const { start, key: key2, sep:
|
|
11659
|
+
const { start, key: key2, sep: sep3, value } = collItem;
|
|
11660
11660
|
const keyProps = resolveProps.resolveProps(start, {
|
|
11661
11661
|
indicator: "explicit-key-ind",
|
|
11662
|
-
next: key2 ??
|
|
11662
|
+
next: key2 ?? sep3?.[0],
|
|
11663
11663
|
offset,
|
|
11664
11664
|
onError,
|
|
11665
11665
|
parentIndent: bm.indent,
|
|
@@ -11673,7 +11673,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11673
11673
|
else if ("indent" in key2 && key2.indent !== bm.indent)
|
|
11674
11674
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
11675
11675
|
}
|
|
11676
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
11676
|
+
if (!keyProps.anchor && !keyProps.tag && !sep3) {
|
|
11677
11677
|
commentEnd = keyProps.end;
|
|
11678
11678
|
if (keyProps.comment) {
|
|
11679
11679
|
if (map.comment)
|
|
@@ -11697,7 +11697,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11697
11697
|
ctx.atKey = false;
|
|
11698
11698
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
11699
11699
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
11700
|
-
const valueProps = resolveProps.resolveProps(
|
|
11700
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
11701
11701
|
indicator: "map-value-ind",
|
|
11702
11702
|
next: value,
|
|
11703
11703
|
offset: keyNode.range[2],
|
|
@@ -11713,7 +11713,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
11713
11713
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
11714
11714
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
11715
11715
|
}
|
|
11716
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
11716
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep3, null, valueProps, onError);
|
|
11717
11717
|
if (ctx.schema.compat)
|
|
11718
11718
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
11719
11719
|
offset = valueNode.range[2];
|
|
@@ -11804,7 +11804,7 @@ var require_resolve_end = __commonJS({
|
|
|
11804
11804
|
let comment = "";
|
|
11805
11805
|
if (end) {
|
|
11806
11806
|
let hasSpace = false;
|
|
11807
|
-
let
|
|
11807
|
+
let sep3 = "";
|
|
11808
11808
|
for (const token of end) {
|
|
11809
11809
|
const { source, type } = token;
|
|
11810
11810
|
switch (type) {
|
|
@@ -11818,13 +11818,13 @@ var require_resolve_end = __commonJS({
|
|
|
11818
11818
|
if (!comment)
|
|
11819
11819
|
comment = cb;
|
|
11820
11820
|
else
|
|
11821
|
-
comment +=
|
|
11822
|
-
|
|
11821
|
+
comment += sep3 + cb;
|
|
11822
|
+
sep3 = "";
|
|
11823
11823
|
break;
|
|
11824
11824
|
}
|
|
11825
11825
|
case "newline":
|
|
11826
11826
|
if (comment)
|
|
11827
|
-
|
|
11827
|
+
sep3 += source;
|
|
11828
11828
|
hasSpace = true;
|
|
11829
11829
|
break;
|
|
11830
11830
|
default:
|
|
@@ -11867,18 +11867,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11867
11867
|
let offset = fc.offset + fc.start.source.length;
|
|
11868
11868
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
11869
11869
|
const collItem = fc.items[i];
|
|
11870
|
-
const { start, key: key2, sep:
|
|
11870
|
+
const { start, key: key2, sep: sep3, value } = collItem;
|
|
11871
11871
|
const props = resolveProps.resolveProps(start, {
|
|
11872
11872
|
flow: fcName,
|
|
11873
11873
|
indicator: "explicit-key-ind",
|
|
11874
|
-
next: key2 ??
|
|
11874
|
+
next: key2 ?? sep3?.[0],
|
|
11875
11875
|
offset,
|
|
11876
11876
|
onError,
|
|
11877
11877
|
parentIndent: fc.indent,
|
|
11878
11878
|
startOnNewline: false
|
|
11879
11879
|
});
|
|
11880
11880
|
if (!props.found) {
|
|
11881
|
-
if (!props.anchor && !props.tag && !
|
|
11881
|
+
if (!props.anchor && !props.tag && !sep3 && !value) {
|
|
11882
11882
|
if (i === 0 && props.comma)
|
|
11883
11883
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
11884
11884
|
else if (i < fc.items.length - 1)
|
|
@@ -11932,8 +11932,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11932
11932
|
}
|
|
11933
11933
|
}
|
|
11934
11934
|
}
|
|
11935
|
-
if (!isMap && !
|
|
11936
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
11935
|
+
if (!isMap && !sep3 && !props.found) {
|
|
11936
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
|
|
11937
11937
|
coll.items.push(valueNode);
|
|
11938
11938
|
offset = valueNode.range[2];
|
|
11939
11939
|
if (isBlock(value))
|
|
@@ -11945,7 +11945,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11945
11945
|
if (isBlock(key2))
|
|
11946
11946
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
11947
11947
|
ctx.atKey = false;
|
|
11948
|
-
const valueProps = resolveProps.resolveProps(
|
|
11948
|
+
const valueProps = resolveProps.resolveProps(sep3 ?? [], {
|
|
11949
11949
|
flow: fcName,
|
|
11950
11950
|
indicator: "map-value-ind",
|
|
11951
11951
|
next: value,
|
|
@@ -11956,8 +11956,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11956
11956
|
});
|
|
11957
11957
|
if (valueProps.found) {
|
|
11958
11958
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
11959
|
-
if (
|
|
11960
|
-
for (const st of
|
|
11959
|
+
if (sep3)
|
|
11960
|
+
for (const st of sep3) {
|
|
11961
11961
|
if (st === valueProps.found)
|
|
11962
11962
|
break;
|
|
11963
11963
|
if (st.type === "newline") {
|
|
@@ -11974,7 +11974,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
11974
11974
|
else
|
|
11975
11975
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
11976
11976
|
}
|
|
11977
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
11977
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
|
|
11978
11978
|
if (valueNode) {
|
|
11979
11979
|
if (isBlock(value))
|
|
11980
11980
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -12154,7 +12154,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
12154
12154
|
chompStart = i + 1;
|
|
12155
12155
|
}
|
|
12156
12156
|
let value = "";
|
|
12157
|
-
let
|
|
12157
|
+
let sep3 = "";
|
|
12158
12158
|
let prevMoreIndented = false;
|
|
12159
12159
|
for (let i = 0; i < contentStart; ++i)
|
|
12160
12160
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -12171,24 +12171,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
12171
12171
|
indent = "";
|
|
12172
12172
|
}
|
|
12173
12173
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
12174
|
-
value +=
|
|
12175
|
-
|
|
12174
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
12175
|
+
sep3 = "\n";
|
|
12176
12176
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
12177
|
-
if (
|
|
12178
|
-
|
|
12179
|
-
else if (!prevMoreIndented &&
|
|
12180
|
-
|
|
12181
|
-
value +=
|
|
12182
|
-
|
|
12177
|
+
if (sep3 === " ")
|
|
12178
|
+
sep3 = "\n";
|
|
12179
|
+
else if (!prevMoreIndented && sep3 === "\n")
|
|
12180
|
+
sep3 = "\n\n";
|
|
12181
|
+
value += sep3 + indent.slice(trimIndent) + content;
|
|
12182
|
+
sep3 = "\n";
|
|
12183
12183
|
prevMoreIndented = true;
|
|
12184
12184
|
} else if (content === "") {
|
|
12185
|
-
if (
|
|
12185
|
+
if (sep3 === "\n")
|
|
12186
12186
|
value += "\n";
|
|
12187
12187
|
else
|
|
12188
|
-
|
|
12188
|
+
sep3 = "\n";
|
|
12189
12189
|
} else {
|
|
12190
|
-
value +=
|
|
12191
|
-
|
|
12190
|
+
value += sep3 + content;
|
|
12191
|
+
sep3 = " ";
|
|
12192
12192
|
prevMoreIndented = false;
|
|
12193
12193
|
}
|
|
12194
12194
|
}
|
|
@@ -12370,25 +12370,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
12370
12370
|
if (!match)
|
|
12371
12371
|
return source;
|
|
12372
12372
|
let res = match[1];
|
|
12373
|
-
let
|
|
12373
|
+
let sep3 = " ";
|
|
12374
12374
|
let pos = first.lastIndex;
|
|
12375
12375
|
line.lastIndex = pos;
|
|
12376
12376
|
while (match = line.exec(source)) {
|
|
12377
12377
|
if (match[1] === "") {
|
|
12378
|
-
if (
|
|
12379
|
-
res +=
|
|
12378
|
+
if (sep3 === "\n")
|
|
12379
|
+
res += sep3;
|
|
12380
12380
|
else
|
|
12381
|
-
|
|
12381
|
+
sep3 = "\n";
|
|
12382
12382
|
} else {
|
|
12383
|
-
res +=
|
|
12384
|
-
|
|
12383
|
+
res += sep3 + match[1];
|
|
12384
|
+
sep3 = " ";
|
|
12385
12385
|
}
|
|
12386
12386
|
pos = line.lastIndex;
|
|
12387
12387
|
}
|
|
12388
12388
|
const last = /[ \t]*(.*)/sy;
|
|
12389
12389
|
last.lastIndex = pos;
|
|
12390
12390
|
match = last.exec(source);
|
|
12391
|
-
return res +
|
|
12391
|
+
return res + sep3 + (match?.[1] ?? "");
|
|
12392
12392
|
}
|
|
12393
12393
|
function doubleQuotedValue(source, onError) {
|
|
12394
12394
|
let res = "";
|
|
@@ -13196,14 +13196,14 @@ var require_cst_stringify = __commonJS({
|
|
|
13196
13196
|
}
|
|
13197
13197
|
}
|
|
13198
13198
|
}
|
|
13199
|
-
function stringifyItem({ start, key: key2, sep:
|
|
13199
|
+
function stringifyItem({ start, key: key2, sep: sep3, value }) {
|
|
13200
13200
|
let res = "";
|
|
13201
13201
|
for (const st of start)
|
|
13202
13202
|
res += st.source;
|
|
13203
13203
|
if (key2)
|
|
13204
13204
|
res += stringifyToken(key2);
|
|
13205
|
-
if (
|
|
13206
|
-
for (const st of
|
|
13205
|
+
if (sep3)
|
|
13206
|
+
for (const st of sep3)
|
|
13207
13207
|
res += st.source;
|
|
13208
13208
|
if (value)
|
|
13209
13209
|
res += stringifyToken(value);
|
|
@@ -14353,18 +14353,18 @@ var require_parser = __commonJS({
|
|
|
14353
14353
|
if (this.type === "map-value-ind") {
|
|
14354
14354
|
const prev = getPrevProps(this.peek(2));
|
|
14355
14355
|
const start = getFirstKeyStartProps(prev);
|
|
14356
|
-
let
|
|
14356
|
+
let sep3;
|
|
14357
14357
|
if (scalar.end) {
|
|
14358
|
-
|
|
14359
|
-
|
|
14358
|
+
sep3 = scalar.end;
|
|
14359
|
+
sep3.push(this.sourceToken);
|
|
14360
14360
|
delete scalar.end;
|
|
14361
14361
|
} else
|
|
14362
|
-
|
|
14362
|
+
sep3 = [this.sourceToken];
|
|
14363
14363
|
const map = {
|
|
14364
14364
|
type: "block-map",
|
|
14365
14365
|
offset: scalar.offset,
|
|
14366
14366
|
indent: scalar.indent,
|
|
14367
|
-
items: [{ start, key: scalar, sep:
|
|
14367
|
+
items: [{ start, key: scalar, sep: sep3 }]
|
|
14368
14368
|
};
|
|
14369
14369
|
this.onKeyLine = true;
|
|
14370
14370
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -14517,15 +14517,15 @@ var require_parser = __commonJS({
|
|
|
14517
14517
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
14518
14518
|
const start2 = getFirstKeyStartProps(it.start);
|
|
14519
14519
|
const key2 = it.key;
|
|
14520
|
-
const
|
|
14521
|
-
|
|
14520
|
+
const sep3 = it.sep;
|
|
14521
|
+
sep3.push(this.sourceToken);
|
|
14522
14522
|
delete it.key;
|
|
14523
14523
|
delete it.sep;
|
|
14524
14524
|
this.stack.push({
|
|
14525
14525
|
type: "block-map",
|
|
14526
14526
|
offset: this.offset,
|
|
14527
14527
|
indent: this.indent,
|
|
14528
|
-
items: [{ start: start2, key: key2, sep:
|
|
14528
|
+
items: [{ start: start2, key: key2, sep: sep3 }]
|
|
14529
14529
|
});
|
|
14530
14530
|
} else if (start.length > 0) {
|
|
14531
14531
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -14719,13 +14719,13 @@ var require_parser = __commonJS({
|
|
|
14719
14719
|
const prev = getPrevProps(parent);
|
|
14720
14720
|
const start = getFirstKeyStartProps(prev);
|
|
14721
14721
|
fixFlowSeqItems(fc);
|
|
14722
|
-
const
|
|
14723
|
-
|
|
14722
|
+
const sep3 = fc.end.splice(1, fc.end.length);
|
|
14723
|
+
sep3.push(this.sourceToken);
|
|
14724
14724
|
const map = {
|
|
14725
14725
|
type: "block-map",
|
|
14726
14726
|
offset: fc.offset,
|
|
14727
14727
|
indent: fc.indent,
|
|
14728
|
-
items: [{ start, key: fc, sep:
|
|
14728
|
+
items: [{ start, key: fc, sep: sep3 }]
|
|
14729
14729
|
};
|
|
14730
14730
|
this.onKeyLine = true;
|
|
14731
14731
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -18932,7 +18932,7 @@ var require_filters = __commonJS({
|
|
|
18932
18932
|
return r.copySafeness(str, res);
|
|
18933
18933
|
}
|
|
18934
18934
|
_exports.indent = indent;
|
|
18935
|
-
function
|
|
18935
|
+
function join19(arr, del, attr) {
|
|
18936
18936
|
del = del || "";
|
|
18937
18937
|
if (attr) {
|
|
18938
18938
|
arr = lib.map(arr, function(v) {
|
|
@@ -18941,7 +18941,7 @@ var require_filters = __commonJS({
|
|
|
18941
18941
|
}
|
|
18942
18942
|
return arr.join(del);
|
|
18943
18943
|
}
|
|
18944
|
-
_exports.join =
|
|
18944
|
+
_exports.join = join19;
|
|
18945
18945
|
function last(arr) {
|
|
18946
18946
|
return arr[arr.length - 1];
|
|
18947
18947
|
}
|
|
@@ -20107,9 +20107,9 @@ var require_handler = __commonJS({
|
|
|
20107
20107
|
if (this.fsw.closed) {
|
|
20108
20108
|
return;
|
|
20109
20109
|
}
|
|
20110
|
-
const
|
|
20110
|
+
const dirname5 = sysPath.dirname(file);
|
|
20111
20111
|
const basename2 = sysPath.basename(file);
|
|
20112
|
-
const parent = this.fsw._getWatchedDir(
|
|
20112
|
+
const parent = this.fsw._getWatchedDir(dirname5);
|
|
20113
20113
|
let prevStats = stats;
|
|
20114
20114
|
if (parent.has(basename2))
|
|
20115
20115
|
return;
|
|
@@ -20136,7 +20136,7 @@ var require_handler = __commonJS({
|
|
|
20136
20136
|
prevStats = newStats2;
|
|
20137
20137
|
}
|
|
20138
20138
|
} catch (error2) {
|
|
20139
|
-
this.fsw._remove(
|
|
20139
|
+
this.fsw._remove(dirname5, basename2);
|
|
20140
20140
|
}
|
|
20141
20141
|
} else if (parent.has(basename2)) {
|
|
20142
20142
|
const at = newStats.atimeMs;
|
|
@@ -20400,11 +20400,11 @@ var require_chokidar = __commonJS({
|
|
|
20400
20400
|
if (matcher.path === string3)
|
|
20401
20401
|
return true;
|
|
20402
20402
|
if (matcher.recursive) {
|
|
20403
|
-
const
|
|
20404
|
-
if (!
|
|
20403
|
+
const relative2 = sysPath.relative(matcher.path, string3);
|
|
20404
|
+
if (!relative2) {
|
|
20405
20405
|
return false;
|
|
20406
20406
|
}
|
|
20407
|
-
return !
|
|
20407
|
+
return !relative2.startsWith("..") && !sysPath.isAbsolute(relative2);
|
|
20408
20408
|
}
|
|
20409
20409
|
return false;
|
|
20410
20410
|
};
|
|
@@ -21372,11 +21372,11 @@ var require_globals = __commonJS({
|
|
|
21372
21372
|
}
|
|
21373
21373
|
};
|
|
21374
21374
|
}
|
|
21375
|
-
function _joiner(
|
|
21376
|
-
|
|
21375
|
+
function _joiner(sep3) {
|
|
21376
|
+
sep3 = sep3 || ",";
|
|
21377
21377
|
var first = true;
|
|
21378
21378
|
return function() {
|
|
21379
|
-
var val = first ? "" :
|
|
21379
|
+
var val = first ? "" : sep3;
|
|
21380
21380
|
first = false;
|
|
21381
21381
|
return val;
|
|
21382
21382
|
};
|
|
@@ -21406,8 +21406,8 @@ var require_globals = __commonJS({
|
|
|
21406
21406
|
cycler: function cycler() {
|
|
21407
21407
|
return _cycler(Array.prototype.slice.call(arguments));
|
|
21408
21408
|
},
|
|
21409
|
-
joiner: function joiner(
|
|
21410
|
-
return _joiner(
|
|
21409
|
+
joiner: function joiner(sep3) {
|
|
21410
|
+
return _joiner(sep3);
|
|
21411
21411
|
}
|
|
21412
21412
|
};
|
|
21413
21413
|
}
|
|
@@ -30187,9 +30187,9 @@ import {
|
|
|
30187
30187
|
createWriteStream,
|
|
30188
30188
|
existsSync as existsSync9,
|
|
30189
30189
|
ftruncateSync,
|
|
30190
|
-
mkdirSync as
|
|
30190
|
+
mkdirSync as mkdirSync10,
|
|
30191
30191
|
openSync as openSync2,
|
|
30192
|
-
readFileSync as
|
|
30192
|
+
readFileSync as readFileSync15,
|
|
30193
30193
|
readdirSync as readdirSync6,
|
|
30194
30194
|
realpathSync,
|
|
30195
30195
|
renameSync as renameSync7,
|
|
@@ -30199,8 +30199,8 @@ import {
|
|
|
30199
30199
|
writeFileSync as writeFileSync11,
|
|
30200
30200
|
writeSync
|
|
30201
30201
|
} from "fs";
|
|
30202
|
-
import { homedir as
|
|
30203
|
-
import { basename, extname, join as
|
|
30202
|
+
import { homedir as homedir7 } from "os";
|
|
30203
|
+
import { basename, extname, join as join18, resolve as resolve2 } from "path";
|
|
30204
30204
|
|
|
30205
30205
|
// ../core/dist/channels/interim-promise.js
|
|
30206
30206
|
function decideMarkerEngagement(marker, kind, nowIso) {
|
|
@@ -33621,7 +33621,7 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
|
|
|
33621
33621
|
})();</script>`;
|
|
33622
33622
|
|
|
33623
33623
|
// ../core/dist/integrations/augmented-live/publisher.js
|
|
33624
|
-
var PRESENTER_CHROME_SELECTORS = "#al-download, .al-launcher, .al-stats-btn, .al-edit-btn";
|
|
33624
|
+
var PRESENTER_CHROME_SELECTORS = "#al-download, #al-vis, .al-launcher, .al-stats-btn, .al-edit-btn";
|
|
33625
33625
|
var presenterChromeCss = `
|
|
33626
33626
|
/* ENG-9516: presenter mode. */
|
|
33627
33627
|
${PRESENTER_CHROME_SELECTORS}{transition:opacity .25s ease,visibility .25s ease}
|
|
@@ -33652,6 +33652,8 @@ var DECK_ATTRIBUTION_BOTTOM_PX = DECK_HUD_TOP_PX + DECK_CHROME_GAP_PX;
|
|
|
33652
33652
|
var DOWNLOAD_BOTTOM_PX = 72;
|
|
33653
33653
|
var DOWNLOAD_MOBILE_MIN_HEIGHT_PX = 44;
|
|
33654
33654
|
var DECK_ATTRIBUTION_NARROW_BOTTOM_PX = DOWNLOAD_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
33655
|
+
var VISIBILITY_BOTTOM_PX = DOWNLOAD_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
33656
|
+
var DECK_ATTRIBUTION_NARROW_WITH_VISIBILITY_BOTTOM_PX = VISIBILITY_BOTTOM_PX + DOWNLOAD_MOBILE_MIN_HEIGHT_PX + DECK_CHROME_GAP_PX;
|
|
33655
33657
|
|
|
33656
33658
|
// ../core/dist/integrations/augmented-live/asset.js
|
|
33657
33659
|
var MB = 1024 * 1024;
|
|
@@ -40063,6 +40065,9 @@ function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX
|
|
|
40063
40065
|
sender_id: marker.sender_id,
|
|
40064
40066
|
...marker.sender_name ? { sender_name: marker.sender_name } : {},
|
|
40065
40067
|
...marker.channel_ref ? { channel_ref: marker.channel_ref } : {},
|
|
40068
|
+
...marker.chat_kind ? { chat_kind: marker.chat_kind } : {},
|
|
40069
|
+
...marker.chat_id ? { chat_id: marker.chat_id } : {},
|
|
40070
|
+
...marker.unattributed ? { unattributed: true } : {},
|
|
40066
40071
|
ts: marker.ts
|
|
40067
40072
|
});
|
|
40068
40073
|
kept.sort((a, b) => b.ts - a.ts);
|
|
@@ -40077,7 +40082,7 @@ function updateTurnInitiatorLedger(singleSlotFile, marker) {
|
|
|
40077
40082
|
} catch {
|
|
40078
40083
|
}
|
|
40079
40084
|
const next = foldTurnInitiatorLedger(existing, marker);
|
|
40080
|
-
const tmp = `${ledgerFile}.tmp`;
|
|
40085
|
+
const tmp = `${ledgerFile}.${process.pid}.${Date.now()}.tmp`;
|
|
40081
40086
|
writeFileSync4(tmp, JSON.stringify(next), "utf8");
|
|
40082
40087
|
renameSync3(tmp, ledgerFile);
|
|
40083
40088
|
}
|
|
@@ -40098,18 +40103,91 @@ function writeTurnInitiatorMarker(input) {
|
|
|
40098
40103
|
}
|
|
40099
40104
|
}
|
|
40100
40105
|
|
|
40106
|
+
// src/turn-context.ts
|
|
40107
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync7 } from "fs";
|
|
40108
|
+
import { homedir as homedir4 } from "os";
|
|
40109
|
+
import { dirname as dirname4, join as join7 } from "path";
|
|
40110
|
+
|
|
40111
|
+
// ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
|
|
40112
|
+
import { isAbsolute, join as join5, relative, sep as sep2 } from "path";
|
|
40113
|
+
var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
40114
|
+
var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
40115
|
+
var INITIATOR_BASENAME = ".current-turn-initiator.json";
|
|
40116
|
+
function isSafeAgentSegment(segment) {
|
|
40117
|
+
return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
|
|
40118
|
+
}
|
|
40119
|
+
function initiatorDirSegment(initiatorFile, homeDir) {
|
|
40120
|
+
const rel = relative(join5(homeDir, ".augmented"), initiatorFile);
|
|
40121
|
+
if (!rel || isAbsolute(rel))
|
|
40122
|
+
return null;
|
|
40123
|
+
const parts = rel.split(sep2);
|
|
40124
|
+
if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
|
|
40125
|
+
return null;
|
|
40126
|
+
const segment = parts[0];
|
|
40127
|
+
if (segment === void 0)
|
|
40128
|
+
return null;
|
|
40129
|
+
return isSafeAgentSegment(segment) ? segment : null;
|
|
40130
|
+
}
|
|
40131
|
+
function resolveAgentDirAlias(input) {
|
|
40132
|
+
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
40133
|
+
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
40134
|
+
if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
|
|
40135
|
+
return join5(homeDir, ".augmented", codeNameTrimmed);
|
|
40136
|
+
}
|
|
40137
|
+
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
40138
|
+
if (initiator) {
|
|
40139
|
+
const segment = initiatorDirSegment(initiator, homeDir);
|
|
40140
|
+
if (segment)
|
|
40141
|
+
return join5(homeDir, ".augmented", segment);
|
|
40142
|
+
}
|
|
40143
|
+
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
40144
|
+
if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
|
|
40145
|
+
return join5(homeDir, ".augmented", agentIdTrimmed);
|
|
40146
|
+
}
|
|
40147
|
+
return null;
|
|
40148
|
+
}
|
|
40149
|
+
|
|
40101
40150
|
// src/scheduled-turn-marker.ts
|
|
40102
40151
|
import { readFileSync as readFileSync6, unlinkSync as unlinkSync4 } from "fs";
|
|
40103
|
-
import { join as
|
|
40152
|
+
import { join as join6 } from "path";
|
|
40104
40153
|
var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
|
|
40105
40154
|
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
40106
40155
|
function clearScheduledTurnMarker(agentDir) {
|
|
40107
40156
|
if (!agentDir) return;
|
|
40108
40157
|
try {
|
|
40109
|
-
unlinkSync4(
|
|
40158
|
+
unlinkSync4(join6(agentDir, SCHEDULED_TURN_MARKER_FILENAME2));
|
|
40159
|
+
} catch {
|
|
40160
|
+
}
|
|
40161
|
+
}
|
|
40162
|
+
|
|
40163
|
+
// src/turn-context.ts
|
|
40164
|
+
var TURN_INITIATOR_MARKER_FILENAME = ".current-turn-initiator.json";
|
|
40165
|
+
function writeUnattributedTurnMarker(channel, opts = {}) {
|
|
40166
|
+
try {
|
|
40167
|
+
const file = resolveTurnInitiatorFile(opts.env ?? process.env, opts.home ?? homedir4());
|
|
40168
|
+
if (!file) return;
|
|
40169
|
+
mkdirSync5(dirname4(file), { recursive: true });
|
|
40170
|
+
updateTurnInitiatorLedger(file, {
|
|
40171
|
+
channel,
|
|
40172
|
+
sender_id: "",
|
|
40173
|
+
channel_ref: "unattributed",
|
|
40174
|
+
unattributed: true,
|
|
40175
|
+
ts: opts.now ?? Date.now()
|
|
40176
|
+
});
|
|
40110
40177
|
} catch {
|
|
40111
40178
|
}
|
|
40112
40179
|
}
|
|
40180
|
+
function resolveTurnInitiatorFile(env2 = process.env, home = homedir4()) {
|
|
40181
|
+
const injected = env2["AGT_TURN_INITIATOR_FILE"]?.trim();
|
|
40182
|
+
if (injected) return injected;
|
|
40183
|
+
const dir = resolveAgentDirAlias({
|
|
40184
|
+
codeName: env2["AGT_AGENT_CODE_NAME"],
|
|
40185
|
+
agentId: env2["AGT_AGENT_ID"],
|
|
40186
|
+
turnInitiatorFile: null,
|
|
40187
|
+
homeDir: home
|
|
40188
|
+
});
|
|
40189
|
+
return dir ? join7(dir, TURN_INITIATOR_MARKER_FILENAME) : null;
|
|
40190
|
+
}
|
|
40113
40191
|
|
|
40114
40192
|
// src/watch-command.ts
|
|
40115
40193
|
var WATCH_DEFAULT_DURATION_MS = 2 * 60 * 60 * 1e3;
|
|
@@ -40757,8 +40835,8 @@ function buildCommandRegistrations() {
|
|
|
40757
40835
|
// src/telegram-offset-store.ts
|
|
40758
40836
|
import {
|
|
40759
40837
|
existsSync as existsSync3,
|
|
40760
|
-
mkdirSync as
|
|
40761
|
-
readFileSync as
|
|
40838
|
+
mkdirSync as mkdirSync6,
|
|
40839
|
+
readFileSync as readFileSync8,
|
|
40762
40840
|
renameSync as renameSync4,
|
|
40763
40841
|
unlinkSync as unlinkSync5,
|
|
40764
40842
|
writeFileSync as writeFileSync5
|
|
@@ -40768,7 +40846,7 @@ function loadPersistedOffset(filePath) {
|
|
|
40768
40846
|
if (!filePath) return 0;
|
|
40769
40847
|
try {
|
|
40770
40848
|
const parsed = JSON.parse(
|
|
40771
|
-
|
|
40849
|
+
readFileSync8(filePath, "utf-8")
|
|
40772
40850
|
);
|
|
40773
40851
|
const offset = parsed?.offset;
|
|
40774
40852
|
if (typeof offset === "number" && Number.isFinite(offset) && offset > 0) {
|
|
@@ -40790,7 +40868,7 @@ function persistOffset(opts) {
|
|
|
40790
40868
|
};
|
|
40791
40869
|
const tmpPath = `${filePath}.${process.pid}.${randomUUID2()}.tmp`;
|
|
40792
40870
|
try {
|
|
40793
|
-
|
|
40871
|
+
mkdirSync6(dir, { recursive: true, mode: 448 });
|
|
40794
40872
|
writeFileSync5(tmpPath, JSON.stringify(marker), { mode: 384 });
|
|
40795
40873
|
renameSync4(tmpPath, filePath);
|
|
40796
40874
|
} catch (err) {
|
|
@@ -40812,8 +40890,8 @@ function conversationalLaneMeta(expectsReply = true) {
|
|
|
40812
40890
|
}
|
|
40813
40891
|
|
|
40814
40892
|
// src/inbound-lane-telemetry.ts
|
|
40815
|
-
import { readFileSync as
|
|
40816
|
-
import { join as
|
|
40893
|
+
import { readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
|
|
40894
|
+
import { join as join8 } from "path";
|
|
40817
40895
|
var LANE_CLASSIFICATION_COUNTER_SUFFIX = "-lane-classifications.json";
|
|
40818
40896
|
var SUSPECTED_MISCLASSIFICATION_KEY = "suspected_misclassification";
|
|
40819
40897
|
var HUMAN_CHANNEL_SOURCES = /* @__PURE__ */ new Set([
|
|
@@ -40830,10 +40908,10 @@ function isSuspectedMisclassification(lane, source) {
|
|
|
40830
40908
|
}
|
|
40831
40909
|
function recordLaneClassification(agentDir, channel, classification) {
|
|
40832
40910
|
if (!agentDir) return;
|
|
40833
|
-
const path =
|
|
40911
|
+
const path = join8(agentDir, `${channel}${LANE_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
40834
40912
|
let counts = {};
|
|
40835
40913
|
try {
|
|
40836
|
-
const parsed = JSON.parse(
|
|
40914
|
+
const parsed = JSON.parse(readFileSync9(path, "utf-8"));
|
|
40837
40915
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
40838
40916
|
} catch {
|
|
40839
40917
|
}
|
|
@@ -40849,15 +40927,15 @@ function recordLaneClassification(agentDir, channel, classification) {
|
|
|
40849
40927
|
}
|
|
40850
40928
|
|
|
40851
40929
|
// src/agent-config-state.ts
|
|
40852
|
-
import { existsSync as existsSync4, readFileSync as
|
|
40853
|
-
import { join as
|
|
40930
|
+
import { existsSync as existsSync4, readFileSync as readFileSync10 } from "fs";
|
|
40931
|
+
import { join as join9 } from "path";
|
|
40854
40932
|
var SESSION_STATE_FILENAME = "session-state.json";
|
|
40855
40933
|
function readAgentSessionState(stateDir) {
|
|
40856
40934
|
if (!stateDir) return null;
|
|
40857
|
-
const path =
|
|
40935
|
+
const path = join9(stateDir, SESSION_STATE_FILENAME);
|
|
40858
40936
|
if (!existsSync4(path)) return null;
|
|
40859
40937
|
try {
|
|
40860
|
-
const parsed = JSON.parse(
|
|
40938
|
+
const parsed = JSON.parse(readFileSync10(path, "utf-8"));
|
|
40861
40939
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
40862
40940
|
return parsed;
|
|
40863
40941
|
} catch {
|
|
@@ -41822,8 +41900,8 @@ function emitToolCallMarkupRedactionTelemetry(channel) {
|
|
|
41822
41900
|
|
|
41823
41901
|
// src/rate-limit-watch.ts
|
|
41824
41902
|
import { closeSync, fstatSync, openSync, readSync, readdirSync, statSync } from "fs";
|
|
41825
|
-
import { homedir as
|
|
41826
|
-
import { join as
|
|
41903
|
+
import { homedir as homedir5 } from "os";
|
|
41904
|
+
import { join as join10 } from "path";
|
|
41827
41905
|
var DEFAULT_WATCH_MS = 5e3;
|
|
41828
41906
|
var DEFAULT_POLL_MS = 400;
|
|
41829
41907
|
var INITIAL_TAIL_BYTES = 256 * 1024;
|
|
@@ -41894,8 +41972,8 @@ function oldestTimestampMs(text) {
|
|
|
41894
41972
|
}
|
|
41895
41973
|
function agentTranscriptDir(opts) {
|
|
41896
41974
|
const cwd = opts?.cwd ?? process.cwd();
|
|
41897
|
-
const home = opts?.home ??
|
|
41898
|
-
return
|
|
41975
|
+
const home = opts?.home ?? homedir5();
|
|
41976
|
+
return join10(home, ".claude", "projects", encodeClaudeProjectPath(cwd));
|
|
41899
41977
|
}
|
|
41900
41978
|
function classifyTranscriptSince(opts) {
|
|
41901
41979
|
const dir = opts.transcriptDir ?? agentTranscriptDir({ cwd: opts.cwd, home: opts.home });
|
|
@@ -41908,7 +41986,7 @@ function classifyTranscriptSince(opts) {
|
|
|
41908
41986
|
let newest = UNKNOWN_RATE_LIMIT;
|
|
41909
41987
|
for (const name of entries) {
|
|
41910
41988
|
if (!name.endsWith(".jsonl")) continue;
|
|
41911
|
-
const path =
|
|
41989
|
+
const path = join10(dir, name);
|
|
41912
41990
|
try {
|
|
41913
41991
|
const st = statSync(path);
|
|
41914
41992
|
if (!st.isFile() || st.mtimeMs < opts.sinceMs) continue;
|
|
@@ -41955,7 +42033,7 @@ async function watchForRateLimitRefusal(opts) {
|
|
|
41955
42033
|
|
|
41956
42034
|
// src/turn-failure-watch.ts
|
|
41957
42035
|
import { readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
41958
|
-
import { join as
|
|
42036
|
+
import { join as join11 } from "path";
|
|
41959
42037
|
function turnFailureNoticeEnabled(env2) {
|
|
41960
42038
|
return resolveHostBooleanFlag({
|
|
41961
42039
|
key: "wedge-transient-notice",
|
|
@@ -41985,7 +42063,7 @@ function classifyTurnFailureSince(opts) {
|
|
|
41985
42063
|
const unrecognised = /* @__PURE__ */ new Set();
|
|
41986
42064
|
for (const name of entries) {
|
|
41987
42065
|
if (!name.endsWith(".jsonl")) continue;
|
|
41988
|
-
const path =
|
|
42066
|
+
const path = join11(dir, name);
|
|
41989
42067
|
let fingerprint;
|
|
41990
42068
|
try {
|
|
41991
42069
|
const st = statSync2(path);
|
|
@@ -42127,9 +42205,9 @@ function describeUnparsedRefusal(text) {
|
|
|
42127
42205
|
|
|
42128
42206
|
// src/reply-intent-runtime.ts
|
|
42129
42207
|
import { execFile as execFile2 } from "child_process";
|
|
42130
|
-
import { existsSync as existsSync5, mkdirSync as
|
|
42131
|
-
import { homedir as
|
|
42132
|
-
import { join as
|
|
42208
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
42209
|
+
import { homedir as homedir6 } from "os";
|
|
42210
|
+
import { join as join12 } from "path";
|
|
42133
42211
|
var DEFAULT_CLAUDE_EVAL_MODEL = "claude-haiku-4-5-20251001";
|
|
42134
42212
|
var DEFAULT_ANTHROPIC_MESSAGES_URL = "https://api.anthropic.com/v1/messages";
|
|
42135
42213
|
var ANTHROPIC_API_VERSION = "2023-06-01";
|
|
@@ -42228,12 +42306,12 @@ async function runAnthropicMessages(prompt, opts) {
|
|
|
42228
42306
|
var emptyMcpConfigPath = null;
|
|
42229
42307
|
function ensureEmptyMcpConfig() {
|
|
42230
42308
|
if (emptyMcpConfigPath && existsSync5(emptyMcpConfigPath)) return emptyMcpConfigPath;
|
|
42231
|
-
const dir =
|
|
42309
|
+
const dir = join12(homedir6(), ".augmented");
|
|
42232
42310
|
try {
|
|
42233
|
-
|
|
42311
|
+
mkdirSync7(dir, { recursive: true });
|
|
42234
42312
|
} catch {
|
|
42235
42313
|
}
|
|
42236
|
-
const p2 =
|
|
42314
|
+
const p2 = join12(dir, ".reply-intent-empty-mcp.json");
|
|
42237
42315
|
writeFileSync7(p2, JSON.stringify({ mcpServers: {} }));
|
|
42238
42316
|
emptyMcpConfigPath = p2;
|
|
42239
42317
|
return p2;
|
|
@@ -42258,7 +42336,7 @@ function runClaudeP(prompt, model) {
|
|
|
42258
42336
|
execFile2(
|
|
42259
42337
|
"claude",
|
|
42260
42338
|
args,
|
|
42261
|
-
{ cwd:
|
|
42339
|
+
{ cwd: homedir6(), timeout: CLASSIFY_TIMEOUT_MS, maxBuffer: 1 << 20 },
|
|
42262
42340
|
(err, stdout) => {
|
|
42263
42341
|
if (err) {
|
|
42264
42342
|
reject(err);
|
|
@@ -42380,11 +42458,11 @@ function emitTransientApiErrorTelemetry(channel, match, original) {
|
|
|
42380
42458
|
}
|
|
42381
42459
|
|
|
42382
42460
|
// src/telegram-pending-inbound-cleanup.ts
|
|
42383
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
42384
|
-
import { join as
|
|
42461
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync11, statSync as statSync3 } from "fs";
|
|
42462
|
+
import { join as join13 } from "path";
|
|
42385
42463
|
function markerArrivalMs(fullPath) {
|
|
42386
42464
|
try {
|
|
42387
|
-
const received = JSON.parse(
|
|
42465
|
+
const received = JSON.parse(readFileSync11(fullPath, "utf-8")).received_at;
|
|
42388
42466
|
const parsed = received ? Date.parse(received) : Number.NaN;
|
|
42389
42467
|
if (Number.isFinite(parsed)) return parsed;
|
|
42390
42468
|
} catch {
|
|
@@ -42414,7 +42492,7 @@ function applyToChatMarkers(pendingDir, chatId, op, cutoffMs) {
|
|
|
42414
42492
|
for (const filename of filenames) {
|
|
42415
42493
|
if (!filename.startsWith(prefix)) continue;
|
|
42416
42494
|
if (!filename.endsWith(".json")) continue;
|
|
42417
|
-
const fullPath =
|
|
42495
|
+
const fullPath = join13(pendingDir, filename);
|
|
42418
42496
|
if (bounded && markerArrivalMs(fullPath) > cutoffMs) continue;
|
|
42419
42497
|
op(fullPath);
|
|
42420
42498
|
applied++;
|
|
@@ -42424,12 +42502,12 @@ function applyToChatMarkers(pendingDir, chatId, op, cutoffMs) {
|
|
|
42424
42502
|
|
|
42425
42503
|
// src/recovery-ledger.ts
|
|
42426
42504
|
import { existsSync as existsSync6, unlinkSync as unlinkSync6 } from "fs";
|
|
42427
|
-
import { join as
|
|
42505
|
+
import { join as join14 } from "path";
|
|
42428
42506
|
function recoveryLedgerEntryExists(ledgerDir, markerName, exists = (p2) => existsSync6(p2)) {
|
|
42429
42507
|
if (!ledgerDir || !markerName) return false;
|
|
42430
42508
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return false;
|
|
42431
42509
|
try {
|
|
42432
|
-
return exists(
|
|
42510
|
+
return exists(join14(ledgerDir, markerName));
|
|
42433
42511
|
} catch {
|
|
42434
42512
|
return false;
|
|
42435
42513
|
}
|
|
@@ -42440,23 +42518,23 @@ function removeRecoveryLedgerEntry(ledgerDir, markerName, unlink = (p2) => {
|
|
|
42440
42518
|
if (!ledgerDir || !markerName) return;
|
|
42441
42519
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
42442
42520
|
try {
|
|
42443
|
-
unlink(
|
|
42521
|
+
unlink(join14(ledgerDir, markerName));
|
|
42444
42522
|
} catch {
|
|
42445
42523
|
}
|
|
42446
42524
|
}
|
|
42447
42525
|
|
|
42448
42526
|
// src/inbound-delivery-ledger.ts
|
|
42449
|
-
import { existsSync as existsSync7, mkdirSync as
|
|
42450
|
-
import { join as
|
|
42527
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync12, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
42528
|
+
import { join as join15 } from "path";
|
|
42451
42529
|
function safeInboundId(inboundId) {
|
|
42452
42530
|
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
42453
42531
|
}
|
|
42454
42532
|
var defaultDeps = {
|
|
42455
|
-
mkdir: (dir) =>
|
|
42533
|
+
mkdir: (dir) => mkdirSync8(dir, { recursive: true }),
|
|
42456
42534
|
writeFile: (path, data) => writeFileSync8(path, data, "utf8"),
|
|
42457
42535
|
rename: (from, to) => renameSync5(from, to),
|
|
42458
42536
|
readdir: (dir) => readdirSync4(dir),
|
|
42459
|
-
readFile: (path) =>
|
|
42537
|
+
readFile: (path) => readFileSync12(path, "utf8"),
|
|
42460
42538
|
exists: (path) => existsSync7(path)
|
|
42461
42539
|
};
|
|
42462
42540
|
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
@@ -42465,7 +42543,7 @@ function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
|
42465
42543
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return;
|
|
42466
42544
|
try {
|
|
42467
42545
|
deps.mkdir(dir);
|
|
42468
|
-
const final =
|
|
42546
|
+
const final = join15(dir, `${safe}.json`);
|
|
42469
42547
|
const tmp = `${final}.tmp`;
|
|
42470
42548
|
deps.writeFile(tmp, JSON.stringify(record2));
|
|
42471
42549
|
deps.rename(tmp, final);
|
|
@@ -42697,15 +42775,15 @@ function createKanbanCardActiveClient(args) {
|
|
|
42697
42775
|
// src/mcp-spawn-lock.ts
|
|
42698
42776
|
import {
|
|
42699
42777
|
existsSync as existsSync8,
|
|
42700
|
-
mkdirSync as
|
|
42701
|
-
readFileSync as
|
|
42778
|
+
mkdirSync as mkdirSync9,
|
|
42779
|
+
readFileSync as readFileSync13,
|
|
42702
42780
|
renameSync as renameSync6,
|
|
42703
42781
|
statSync as statSync4,
|
|
42704
42782
|
unlinkSync as unlinkSync7,
|
|
42705
42783
|
utimesSync,
|
|
42706
42784
|
writeFileSync as writeFileSync9
|
|
42707
42785
|
} from "fs";
|
|
42708
|
-
import { join as
|
|
42786
|
+
import { join as join16 } from "path";
|
|
42709
42787
|
var STALE_LOCK_MS = 9e4;
|
|
42710
42788
|
var HEARTBEAT_INTERVAL_MS = 3e4;
|
|
42711
42789
|
function defaultIsPidAlive(pid) {
|
|
@@ -42728,7 +42806,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
42728
42806
|
const nowMs = options.nowMs ?? (() => Date.now());
|
|
42729
42807
|
const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
|
|
42730
42808
|
const staleMs = options.staleMs ?? STALE_LOCK_MS;
|
|
42731
|
-
const path =
|
|
42809
|
+
const path = join16(agentDir, basename2);
|
|
42732
42810
|
const existing = readLockHolder(path);
|
|
42733
42811
|
if (existing) {
|
|
42734
42812
|
if (existing.pid === selfPid) {
|
|
@@ -42742,7 +42820,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
42742
42820
|
}
|
|
42743
42821
|
}
|
|
42744
42822
|
}
|
|
42745
|
-
|
|
42823
|
+
mkdirSync9(agentDir, { recursive: true, mode: 448 });
|
|
42746
42824
|
const tmpPath = `${path}.${selfPid}.tmp`;
|
|
42747
42825
|
const payload = { pid: selfPid, started_at: now() };
|
|
42748
42826
|
writeFileSync9(tmpPath, JSON.stringify(payload), { mode: 384 });
|
|
@@ -42795,7 +42873,7 @@ function defaultLockMtimeMs(path) {
|
|
|
42795
42873
|
function readLockHolder(path) {
|
|
42796
42874
|
if (!existsSync8(path)) return null;
|
|
42797
42875
|
try {
|
|
42798
|
-
const raw =
|
|
42876
|
+
const raw = readFileSync13(path, "utf8");
|
|
42799
42877
|
const parsed = JSON.parse(raw);
|
|
42800
42878
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
42801
42879
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -42807,8 +42885,8 @@ function readLockHolder(path) {
|
|
|
42807
42885
|
}
|
|
42808
42886
|
|
|
42809
42887
|
// src/ack-reaction.ts
|
|
42810
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
42811
|
-
import { join as
|
|
42888
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync14, writeFileSync as writeFileSync10 } from "fs";
|
|
42889
|
+
import { join as join17 } from "path";
|
|
42812
42890
|
|
|
42813
42891
|
// ../core/dist/channels/deflection-causes.js
|
|
42814
42892
|
var DEFLECTION_CAUSES = [
|
|
@@ -43105,7 +43183,7 @@ var GIVE_UP_SIGNAL_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
|
43105
43183
|
function readGiveUpSignal(path, now = Date.now()) {
|
|
43106
43184
|
if (!path) return null;
|
|
43107
43185
|
try {
|
|
43108
|
-
const raw = JSON.parse(
|
|
43186
|
+
const raw = JSON.parse(readFileSync14(path, "utf8"));
|
|
43109
43187
|
if (typeof raw.gave_up_at !== "string") return null;
|
|
43110
43188
|
const t = Date.parse(raw.gave_up_at);
|
|
43111
43189
|
if (!Number.isFinite(t) || t > now) return null;
|
|
@@ -43119,12 +43197,12 @@ function readGiveUpSignal(path, now = Date.now()) {
|
|
|
43119
43197
|
var USAGE_LIMIT_LIVE_WINDOW_MS = 3 * 6e4;
|
|
43120
43198
|
function readUsageLimitForBusyAck(agentDir, now = Date.now()) {
|
|
43121
43199
|
if (!agentDir) return null;
|
|
43122
|
-
const path =
|
|
43200
|
+
const path = join17(agentDir, GIVE_UP_SIGNAL_FILENAME);
|
|
43123
43201
|
const sig = readGiveUpSignal(path, now);
|
|
43124
43202
|
if (sig?.reason !== "usage_limit") return null;
|
|
43125
43203
|
let lastSeenMs = null;
|
|
43126
43204
|
try {
|
|
43127
|
-
const raw = JSON.parse(
|
|
43205
|
+
const raw = JSON.parse(readFileSync14(path, "utf8"));
|
|
43128
43206
|
if (typeof raw.usage_limit_last_seen_at === "string") {
|
|
43129
43207
|
const t = Date.parse(raw.usage_limit_last_seen_at);
|
|
43130
43208
|
if (Number.isFinite(t) && t <= now) lastSeenMs = t;
|
|
@@ -43143,7 +43221,7 @@ function readBlockedPromptForBusyAck(agentDir, now = Date.now()) {
|
|
|
43143
43221
|
if (!agentDir) return null;
|
|
43144
43222
|
let raw;
|
|
43145
43223
|
try {
|
|
43146
|
-
raw = JSON.parse(
|
|
43224
|
+
raw = JSON.parse(readFileSync14(join17(agentDir, BLOCKED_PROMPT_SIGNAL_FILENAME), "utf8"));
|
|
43147
43225
|
} catch {
|
|
43148
43226
|
return null;
|
|
43149
43227
|
}
|
|
@@ -43206,7 +43284,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
43206
43284
|
if (!name.endsWith(".json")) continue;
|
|
43207
43285
|
let receivedAt;
|
|
43208
43286
|
try {
|
|
43209
|
-
const raw = JSON.parse(
|
|
43287
|
+
const raw = JSON.parse(readFileSync14(join17(dir, name), "utf-8"));
|
|
43210
43288
|
if (raw.discretionary === true) continue;
|
|
43211
43289
|
if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
|
|
43212
43290
|
receivedAt = raw.received_at;
|
|
@@ -43302,14 +43380,14 @@ function isMarkerGenuinelyAged(receivedAt, nowMs, thresholdMs) {
|
|
|
43302
43380
|
}
|
|
43303
43381
|
var DEFLECTION_COUNTER_SUFFIX = "-deflections.json";
|
|
43304
43382
|
function deflectionCounterPath(agentDir, channel) {
|
|
43305
|
-
return
|
|
43383
|
+
return join17(agentDir, `${channel}${DEFLECTION_COUNTER_SUFFIX}`);
|
|
43306
43384
|
}
|
|
43307
43385
|
function recordChannelDeflection(agentDir, channel, cause) {
|
|
43308
43386
|
if (!agentDir) return;
|
|
43309
43387
|
const path = deflectionCounterPath(agentDir, channel);
|
|
43310
43388
|
let counts = {};
|
|
43311
43389
|
try {
|
|
43312
|
-
const parsed = JSON.parse(
|
|
43390
|
+
const parsed = JSON.parse(readFileSync14(path, "utf-8"));
|
|
43313
43391
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
43314
43392
|
} catch {
|
|
43315
43393
|
}
|
|
@@ -43408,7 +43486,7 @@ function redactId(id) {
|
|
|
43408
43486
|
}
|
|
43409
43487
|
var BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
|
|
43410
43488
|
var AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
43411
|
-
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
43489
|
+
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join18(homedir7(), ".augmented", AGENT_CODE_NAME) : null;
|
|
43412
43490
|
var AGT_HOST = process.env.AGT_HOST ?? null;
|
|
43413
43491
|
var AGT_API_KEY = process.env.AGT_API_KEY ?? null;
|
|
43414
43492
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID ?? null;
|
|
@@ -43525,11 +43603,11 @@ var peerRateLimiter = peerRateApiClient && parsePeerAgentModeEnv(process.env.TEL
|
|
|
43525
43603
|
log: (line) => process.stderr.write(`telegram-channel(${AGENT_CODE_NAME}): ${line}
|
|
43526
43604
|
`)
|
|
43527
43605
|
}) : createPeerRateLimiter();
|
|
43528
|
-
var PEER_PRESENCE_STATE_FILE = TELEGRAM_AGENT_DIR ?
|
|
43606
|
+
var PEER_PRESENCE_STATE_FILE = TELEGRAM_AGENT_DIR ? join18(TELEGRAM_AGENT_DIR, "telegram-peer-presence.json") : null;
|
|
43529
43607
|
function readPeerPresenceState() {
|
|
43530
43608
|
if (!PEER_PRESENCE_STATE_FILE) return null;
|
|
43531
43609
|
try {
|
|
43532
|
-
const parsed = JSON.parse(
|
|
43610
|
+
const parsed = JSON.parse(readFileSync15(PEER_PRESENCE_STATE_FILE, "utf-8"));
|
|
43533
43611
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
43534
43612
|
return parsed;
|
|
43535
43613
|
} catch {
|
|
@@ -43540,7 +43618,7 @@ function writePeerPresenceState(snapshot) {
|
|
|
43540
43618
|
if (!PEER_PRESENCE_STATE_FILE || !TELEGRAM_AGENT_DIR) return;
|
|
43541
43619
|
const tmp = `${PEER_PRESENCE_STATE_FILE}.tmp`;
|
|
43542
43620
|
try {
|
|
43543
|
-
|
|
43621
|
+
mkdirSync10(TELEGRAM_AGENT_DIR, { recursive: true, mode: 448 });
|
|
43544
43622
|
writeFileSync11(tmp, JSON.stringify(snapshot), { mode: 384 });
|
|
43545
43623
|
renameSync7(tmp, PEER_PRESENCE_STATE_FILE);
|
|
43546
43624
|
} catch (err) {
|
|
@@ -43564,9 +43642,9 @@ if (!BOT_TOKEN) {
|
|
|
43564
43642
|
var stderrLogStream = null;
|
|
43565
43643
|
if (AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown") {
|
|
43566
43644
|
try {
|
|
43567
|
-
const logDir =
|
|
43568
|
-
|
|
43569
|
-
stderrLogStream = createWriteStream(
|
|
43645
|
+
const logDir = join18(homedir7(), ".augmented", AGENT_CODE_NAME);
|
|
43646
|
+
mkdirSync10(logDir, { recursive: true });
|
|
43647
|
+
stderrLogStream = createWriteStream(join18(logDir, "telegram-channel-stderr.log"), {
|
|
43570
43648
|
flags: "a",
|
|
43571
43649
|
mode: 384
|
|
43572
43650
|
});
|
|
@@ -43904,7 +43982,7 @@ function telegramMarkerReplayFacts(chatId, messageId) {
|
|
|
43904
43982
|
const path = pendingInboundPath(chatId, messageId);
|
|
43905
43983
|
if (!path || !existsSync9(path)) return null;
|
|
43906
43984
|
try {
|
|
43907
|
-
const marker = JSON.parse(
|
|
43985
|
+
const marker = JSON.parse(readFileSync15(path, "utf-8"));
|
|
43908
43986
|
const facts = combineMarkerReplayFacts([
|
|
43909
43987
|
{ hasPayload: Boolean(marker.payload), discretionary: marker.discretionary }
|
|
43910
43988
|
]);
|
|
@@ -44030,7 +44108,7 @@ function scheduleBusyAck(chatId, messageId, arrivedWhileBusy) {
|
|
|
44030
44108
|
let paneLogFreshAgeMs = null;
|
|
44031
44109
|
if (AGENT_DIR) {
|
|
44032
44110
|
try {
|
|
44033
|
-
const paneMtimeMs = statSync5(
|
|
44111
|
+
const paneMtimeMs = statSync5(join18(AGENT_DIR, "pane.log")).mtimeMs;
|
|
44034
44112
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
44035
44113
|
} catch {
|
|
44036
44114
|
}
|
|
@@ -44063,7 +44141,7 @@ function scheduleBusyAck(chatId, messageId, arrivedWhileBusy) {
|
|
|
44063
44141
|
function __resetBusyAckNoticeThrottle() {
|
|
44064
44142
|
lastBusyAckNoticeAt.clear();
|
|
44065
44143
|
}
|
|
44066
|
-
var RESTART_FLAGS_DIR =
|
|
44144
|
+
var RESTART_FLAGS_DIR = join18(homedir7(), ".augmented", "restart-flags");
|
|
44067
44145
|
function actuateHostRestartTelegram() {
|
|
44068
44146
|
return actuateHostRestart({
|
|
44069
44147
|
agtHost: AGT_HOST,
|
|
@@ -44454,9 +44532,9 @@ async function handleRestartCommand(opts) {
|
|
|
44454
44532
|
} else {
|
|
44455
44533
|
writeTelegramRestartConfirm({ chat_id: opts.chatId, message_id: opts.messageId }, opts.requesterName);
|
|
44456
44534
|
if (!existsSync9(RESTART_FLAGS_DIR)) {
|
|
44457
|
-
|
|
44535
|
+
mkdirSync10(RESTART_FLAGS_DIR, { recursive: true });
|
|
44458
44536
|
}
|
|
44459
|
-
const flagPath =
|
|
44537
|
+
const flagPath = join18(RESTART_FLAGS_DIR, `${AGENT_CODE_NAME}.flag`);
|
|
44460
44538
|
const flag = {
|
|
44461
44539
|
codeName: AGENT_CODE_NAME,
|
|
44462
44540
|
source: "telegram",
|
|
@@ -44868,16 +44946,16 @@ async function classifyRestartCommand(text) {
|
|
|
44868
44946
|
if (!ours) return "verification_failed";
|
|
44869
44947
|
return target === ours ? "act" : "ignore";
|
|
44870
44948
|
}
|
|
44871
|
-
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
44872
|
-
var PENDING_INBOUND_DIR = AGENT_DIR ?
|
|
44873
|
-
var RECOVERY_OUTBOX_DIR = AGENT_DIR ?
|
|
44874
|
-
var RECOVERY_LEDGER_DIR = AGENT_DIR ?
|
|
44875
|
-
var DELIVERY_LEDGER_DIR = AGENT_DIR ?
|
|
44876
|
-
var RESTART_CONFIRM_FILE = AGENT_DIR ?
|
|
44949
|
+
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join18(homedir7(), ".augmented", AGENT_CODE_NAME) : null;
|
|
44950
|
+
var PENDING_INBOUND_DIR = AGENT_DIR ? join18(AGENT_DIR, "telegram-pending-inbound") : null;
|
|
44951
|
+
var RECOVERY_OUTBOX_DIR = AGENT_DIR ? join18(AGENT_DIR, "telegram-recovery-outbox") : null;
|
|
44952
|
+
var RECOVERY_LEDGER_DIR = AGENT_DIR ? join18(AGENT_DIR, ".agt-telegram-recovery-ledger") : null;
|
|
44953
|
+
var DELIVERY_LEDGER_DIR = AGENT_DIR ? join18(AGENT_DIR, ".agt-inbound-delivery-ledger") : null;
|
|
44954
|
+
var RESTART_CONFIRM_FILE = AGENT_DIR ? join18(AGENT_DIR, "telegram-restart-confirm.json") : null;
|
|
44877
44955
|
var TELEGRAM_PROCESS_BOOT_MS = Date.now();
|
|
44878
|
-
var TELEGRAM_RECENT_DMS_FILE = AGENT_DIR ?
|
|
44879
|
-
var TELEGRAM_CHANNEL_ADD_RESTART_FILE = AGENT_DIR ?
|
|
44880
|
-
var TELEGRAM_OFFSET_FILE = AGENT_DIR ?
|
|
44956
|
+
var TELEGRAM_RECENT_DMS_FILE = AGENT_DIR ? join18(AGENT_DIR, "telegram-recent-dms.json") : null;
|
|
44957
|
+
var TELEGRAM_CHANNEL_ADD_RESTART_FILE = AGENT_DIR ? join18(AGENT_DIR, "telegram-channel-add-restart.json") : null;
|
|
44958
|
+
var TELEGRAM_OFFSET_FILE = AGENT_DIR ? join18(AGENT_DIR, "telegram-getupdates-offset.json") : null;
|
|
44881
44959
|
var recentDms = /* @__PURE__ */ new Map();
|
|
44882
44960
|
var recentDmPersister = TELEGRAM_RECENT_DMS_FILE ? createRecentDmPersister({
|
|
44883
44961
|
filePath: TELEGRAM_RECENT_DMS_FILE,
|
|
@@ -44932,7 +45010,7 @@ function safeMarkerName(chatId, messageId) {
|
|
|
44932
45010
|
}
|
|
44933
45011
|
function pendingInboundPath(chatId, messageId) {
|
|
44934
45012
|
if (!PENDING_INBOUND_DIR) return null;
|
|
44935
|
-
return
|
|
45013
|
+
return join18(PENDING_INBOUND_DIR, safeMarkerName(chatId, messageId));
|
|
44936
45014
|
}
|
|
44937
45015
|
function writePendingInboundMarker(chatId, messageId, chatType, undeliverable = false, payload) {
|
|
44938
45016
|
const path = pendingInboundPath(chatId, messageId);
|
|
@@ -44951,7 +45029,7 @@ function writePendingInboundMarker(chatId, messageId, chatType, undeliverable =
|
|
|
44951
45029
|
...payload ? { payload } : {}
|
|
44952
45030
|
};
|
|
44953
45031
|
try {
|
|
44954
|
-
|
|
45032
|
+
mkdirSync10(PENDING_INBOUND_DIR, { recursive: true, mode: 448 });
|
|
44955
45033
|
writeFileSync11(path, JSON.stringify(marker), { mode: 384 });
|
|
44956
45034
|
} catch (err) {
|
|
44957
45035
|
process.stderr.write(
|
|
@@ -44980,7 +45058,7 @@ function rewriteTelegramMarkerInPlace(path, marker) {
|
|
|
44980
45058
|
function clearTelegramMarkerFileWithHeal(fullPath) {
|
|
44981
45059
|
let marker = null;
|
|
44982
45060
|
try {
|
|
44983
|
-
marker = JSON.parse(
|
|
45061
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
44984
45062
|
} catch {
|
|
44985
45063
|
}
|
|
44986
45064
|
if (marker?.chat_id) {
|
|
@@ -45000,7 +45078,7 @@ function clearTelegramMarkerFileWithHeal(fullPath) {
|
|
|
45000
45078
|
function clearTelegramMarkerFileSilently(fullPath) {
|
|
45001
45079
|
let marker = null;
|
|
45002
45080
|
try {
|
|
45003
|
-
marker = JSON.parse(
|
|
45081
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45004
45082
|
} catch {
|
|
45005
45083
|
}
|
|
45006
45084
|
if (marker?.chat_id) {
|
|
@@ -45020,7 +45098,7 @@ function markTelegramMarkerPromisedInPlace(fullPath) {
|
|
|
45020
45098
|
function markTelegramMarkerEngagedInPlace(fullPath, opts) {
|
|
45021
45099
|
let marker;
|
|
45022
45100
|
try {
|
|
45023
|
-
marker = JSON.parse(
|
|
45101
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45024
45102
|
} catch {
|
|
45025
45103
|
return false;
|
|
45026
45104
|
}
|
|
@@ -45036,7 +45114,7 @@ function markTelegramMarkerEngagedInPlace(fullPath, opts) {
|
|
|
45036
45114
|
rewriteTelegramMarkerInPlace(fullPath, marker);
|
|
45037
45115
|
if (!opts.promise) return false;
|
|
45038
45116
|
try {
|
|
45039
|
-
const readBack = JSON.parse(
|
|
45117
|
+
const readBack = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45040
45118
|
return typeof readBack.promised_at === "string" && readBack.promised_at.length > 0;
|
|
45041
45119
|
} catch {
|
|
45042
45120
|
return false;
|
|
@@ -45045,7 +45123,7 @@ function markTelegramMarkerEngagedInPlace(fullPath, opts) {
|
|
|
45045
45123
|
function markTelegramMarkerSeenWithHeal(fullPath) {
|
|
45046
45124
|
let marker = null;
|
|
45047
45125
|
try {
|
|
45048
|
-
marker = JSON.parse(
|
|
45126
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45049
45127
|
} catch {
|
|
45050
45128
|
return;
|
|
45051
45129
|
}
|
|
@@ -45061,7 +45139,7 @@ function markTelegramMarkerSeenWithHeal(fullPath) {
|
|
|
45061
45139
|
function markTelegramMarkerPromisedWithHeal(fullPath) {
|
|
45062
45140
|
let marker = null;
|
|
45063
45141
|
try {
|
|
45064
|
-
marker = JSON.parse(
|
|
45142
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45065
45143
|
} catch {
|
|
45066
45144
|
return;
|
|
45067
45145
|
}
|
|
@@ -45079,7 +45157,7 @@ function readPendingInboundMarker(chatId, messageId) {
|
|
|
45079
45157
|
const path = pendingInboundPath(chatId, messageId);
|
|
45080
45158
|
if (!path || !existsSync9(path)) return null;
|
|
45081
45159
|
try {
|
|
45082
|
-
return JSON.parse(
|
|
45160
|
+
return JSON.parse(readFileSync15(path, "utf-8"));
|
|
45083
45161
|
} catch {
|
|
45084
45162
|
return null;
|
|
45085
45163
|
}
|
|
@@ -45099,10 +45177,10 @@ function nextRetryName(filename) {
|
|
|
45099
45177
|
async function processRecoveryOutboxFile(filename) {
|
|
45100
45178
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
45101
45179
|
if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
|
|
45102
|
-
const fullPath =
|
|
45180
|
+
const fullPath = join18(RECOVERY_OUTBOX_DIR, filename);
|
|
45103
45181
|
let payload;
|
|
45104
45182
|
try {
|
|
45105
|
-
const raw =
|
|
45183
|
+
const raw = readFileSync15(fullPath, "utf-8");
|
|
45106
45184
|
payload = JSON.parse(raw);
|
|
45107
45185
|
} catch (err) {
|
|
45108
45186
|
process.stderr.write(
|
|
@@ -45196,7 +45274,7 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
45196
45274
|
const next = nextRetryName(filename);
|
|
45197
45275
|
if (next) {
|
|
45198
45276
|
try {
|
|
45199
|
-
renameSync7(fullPath,
|
|
45277
|
+
renameSync7(fullPath, join18(RECOVERY_OUTBOX_DIR, next.next));
|
|
45200
45278
|
if (next.attempt >= MAX_RECOVERY_ATTEMPTS) {
|
|
45201
45279
|
process.stderr.write(
|
|
45202
45280
|
`telegram-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -45237,7 +45315,7 @@ function scanRecoveryRetries() {
|
|
|
45237
45315
|
if (!f.includes(".retry-") || f.endsWith(".poison.json")) continue;
|
|
45238
45316
|
let mtimeMs;
|
|
45239
45317
|
try {
|
|
45240
|
-
mtimeMs = statSync5(
|
|
45318
|
+
mtimeMs = statSync5(join18(RECOVERY_OUTBOX_DIR, f)).mtimeMs;
|
|
45241
45319
|
} catch {
|
|
45242
45320
|
continue;
|
|
45243
45321
|
}
|
|
@@ -45249,7 +45327,7 @@ function scanRecoveryRetries() {
|
|
|
45249
45327
|
function startRecoveryOutboxWatcher() {
|
|
45250
45328
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
45251
45329
|
try {
|
|
45252
|
-
|
|
45330
|
+
mkdirSync10(RECOVERY_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
45253
45331
|
} catch (err) {
|
|
45254
45332
|
process.stderr.write(
|
|
45255
45333
|
`telegram-channel(${AGENT_CODE_NAME}): recovery outbox mkdir failed: ${err.message}
|
|
@@ -45267,7 +45345,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
45267
45345
|
const watcher = watch(RECOVERY_OUTBOX_DIR, (event, filename) => {
|
|
45268
45346
|
if (event !== "rename" || !filename) return;
|
|
45269
45347
|
if (!isFirstAttemptOutboxFile(filename)) return;
|
|
45270
|
-
if (existsSync9(
|
|
45348
|
+
if (existsSync9(join18(RECOVERY_OUTBOX_DIR, filename))) {
|
|
45271
45349
|
void processRecoveryOutboxFile(filename);
|
|
45272
45350
|
}
|
|
45273
45351
|
});
|
|
@@ -45282,7 +45360,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
45282
45360
|
retryTimer.unref?.();
|
|
45283
45361
|
}
|
|
45284
45362
|
startRecoveryOutboxWatcher();
|
|
45285
|
-
var NOTICE_OUTBOX_DIR = AGENT_DIR ?
|
|
45363
|
+
var NOTICE_OUTBOX_DIR = AGENT_DIR ? join18(AGENT_DIR, "telegram-notice-outbox") : null;
|
|
45286
45364
|
var NOTICE_MAX_AGE_MS = 9e4;
|
|
45287
45365
|
var NOTICE_INFLIGHT = /* @__PURE__ */ new Set();
|
|
45288
45366
|
async function processNoticeOutboxFile(filename) {
|
|
@@ -45290,7 +45368,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
45290
45368
|
if (filename.startsWith(".") || filename.endsWith(".tmp") || !filename.endsWith(".json")) return;
|
|
45291
45369
|
if (NOTICE_INFLIGHT.has(filename)) return;
|
|
45292
45370
|
NOTICE_INFLIGHT.add(filename);
|
|
45293
|
-
const fullPath =
|
|
45371
|
+
const fullPath = join18(NOTICE_OUTBOX_DIR, filename);
|
|
45294
45372
|
try {
|
|
45295
45373
|
let mtimeMs;
|
|
45296
45374
|
try {
|
|
@@ -45307,7 +45385,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
45307
45385
|
}
|
|
45308
45386
|
let payload;
|
|
45309
45387
|
try {
|
|
45310
|
-
const parsed = JSON.parse(
|
|
45388
|
+
const parsed = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45311
45389
|
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
45312
45390
|
payload = parsed;
|
|
45313
45391
|
} catch {
|
|
@@ -45369,7 +45447,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
45369
45447
|
function startNoticeOutboxWatcher() {
|
|
45370
45448
|
if (!NOTICE_OUTBOX_DIR) return;
|
|
45371
45449
|
try {
|
|
45372
|
-
|
|
45450
|
+
mkdirSync10(NOTICE_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
45373
45451
|
} catch (err) {
|
|
45374
45452
|
process.stderr.write(
|
|
45375
45453
|
`telegram-channel(${AGENT_CODE_NAME}): notice outbox mkdir failed: ${err.message}
|
|
@@ -45384,7 +45462,7 @@ function startNoticeOutboxWatcher() {
|
|
|
45384
45462
|
try {
|
|
45385
45463
|
const watcher = watch(NOTICE_OUTBOX_DIR, (event, filename) => {
|
|
45386
45464
|
if (event !== "rename" || !filename) return;
|
|
45387
|
-
if (existsSync9(
|
|
45465
|
+
if (existsSync9(join18(NOTICE_OUTBOX_DIR, filename))) void processNoticeOutboxFile(filename);
|
|
45388
45466
|
});
|
|
45389
45467
|
watcher.unref?.();
|
|
45390
45468
|
} catch (err) {
|
|
@@ -45418,10 +45496,10 @@ function sweepTelegramStaleMarkers(thresholdMs) {
|
|
|
45418
45496
|
for (const filename of filenames) {
|
|
45419
45497
|
if (!filename.endsWith(".json")) continue;
|
|
45420
45498
|
if (filename.endsWith(".tmp")) continue;
|
|
45421
|
-
const fullPath =
|
|
45499
|
+
const fullPath = join18(PENDING_INBOUND_DIR, filename);
|
|
45422
45500
|
let marker;
|
|
45423
45501
|
try {
|
|
45424
|
-
marker = JSON.parse(
|
|
45502
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
45425
45503
|
} catch (err) {
|
|
45426
45504
|
process.stderr.write(
|
|
45427
45505
|
`telegram-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactId(filename)}: ${err.message}
|
|
@@ -45474,13 +45552,13 @@ var orphanSweepTimer = setInterval(() => {
|
|
|
45474
45552
|
checkWatchdogGiveUpNotice();
|
|
45475
45553
|
}, orphanSweepIntervalMs());
|
|
45476
45554
|
orphanSweepTimer.unref?.();
|
|
45477
|
-
var TELEGRAM_PROGRESS_HEARTBEAT_PATH = AGENT_DIR ?
|
|
45555
|
+
var TELEGRAM_PROGRESS_HEARTBEAT_PATH = AGENT_DIR ? join18(AGENT_DIR, "channel-progress-heartbeat.json") : null;
|
|
45478
45556
|
var telegramTrackedProgress = null;
|
|
45479
45557
|
var telegramProgressTickRunning = false;
|
|
45480
45558
|
function readTelegramProgressHeartbeat() {
|
|
45481
45559
|
if (!TELEGRAM_PROGRESS_HEARTBEAT_PATH || !existsSync9(TELEGRAM_PROGRESS_HEARTBEAT_PATH)) return null;
|
|
45482
45560
|
try {
|
|
45483
|
-
return parseProgressHeartbeat(
|
|
45561
|
+
return parseProgressHeartbeat(readFileSync15(TELEGRAM_PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
45484
45562
|
} catch {
|
|
45485
45563
|
return null;
|
|
45486
45564
|
}
|
|
@@ -45507,7 +45585,7 @@ function findTelegramProgressTarget() {
|
|
|
45507
45585
|
if (!name.endsWith(".json")) continue;
|
|
45508
45586
|
let m;
|
|
45509
45587
|
try {
|
|
45510
|
-
m = JSON.parse(
|
|
45588
|
+
m = JSON.parse(readFileSync15(join18(PENDING_INBOUND_DIR, name), "utf-8"));
|
|
45511
45589
|
} catch {
|
|
45512
45590
|
continue;
|
|
45513
45591
|
}
|
|
@@ -45638,7 +45716,7 @@ function listPendingInboundChatIds() {
|
|
|
45638
45716
|
if (!name.endsWith(".json")) continue;
|
|
45639
45717
|
try {
|
|
45640
45718
|
const marker = JSON.parse(
|
|
45641
|
-
|
|
45719
|
+
readFileSync15(join18(PENDING_INBOUND_DIR, name), "utf8")
|
|
45642
45720
|
);
|
|
45643
45721
|
if (typeof marker.seen_at === "string" && marker.seen_at) continue;
|
|
45644
45722
|
if (typeof marker.chat_id === "string" && marker.chat_id) chats.add(marker.chat_id);
|
|
@@ -45757,7 +45835,7 @@ async function notifyWatchdogGiveUp(chatId, reason, resetsHint = null) {
|
|
|
45757
45835
|
}
|
|
45758
45836
|
function checkWatchdogGiveUpNotice() {
|
|
45759
45837
|
if (!AGENT_DIR) return;
|
|
45760
|
-
const signal = readGiveUpSignal(
|
|
45838
|
+
const signal = readGiveUpSignal(join18(AGENT_DIR, GIVE_UP_SIGNAL_FILENAME));
|
|
45761
45839
|
const signalAtMs = signal?.atMs ?? null;
|
|
45762
45840
|
const act = decideGiveUpNotice({
|
|
45763
45841
|
signalAtMs,
|
|
@@ -46097,7 +46175,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
46097
46175
|
isError: true
|
|
46098
46176
|
};
|
|
46099
46177
|
}
|
|
46100
|
-
const allowedRoot = resolve2(
|
|
46178
|
+
const allowedRoot = resolve2(homedir7(), ".augmented", AGENT_CODE_NAME, "project") + "/";
|
|
46101
46179
|
const resolvedPath = resolve2(path);
|
|
46102
46180
|
if (!resolvedPath.startsWith(allowedRoot)) {
|
|
46103
46181
|
return {
|
|
@@ -46145,7 +46223,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
46145
46223
|
}
|
|
46146
46224
|
let realRoot = allowedRoot;
|
|
46147
46225
|
try {
|
|
46148
|
-
realRoot = realpathSync(resolve2(
|
|
46226
|
+
realRoot = realpathSync(resolve2(homedir7(), ".augmented", AGENT_CODE_NAME, "project")) + "/";
|
|
46149
46227
|
} catch {
|
|
46150
46228
|
}
|
|
46151
46229
|
if (!realPath.startsWith(realRoot)) {
|
|
@@ -46174,7 +46252,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
46174
46252
|
isError: true
|
|
46175
46253
|
};
|
|
46176
46254
|
}
|
|
46177
|
-
bytes =
|
|
46255
|
+
bytes = readFileSync15(realPath);
|
|
46178
46256
|
} catch (err) {
|
|
46179
46257
|
return { content: [{ type: "text", text: `Failed to read file: ${err.message}` }], isError: true };
|
|
46180
46258
|
}
|
|
@@ -46838,7 +46916,7 @@ async function replayPendingTelegramMarkers() {
|
|
|
46838
46916
|
let paneFreshAgeMs = null;
|
|
46839
46917
|
if (AGENT_DIR) {
|
|
46840
46918
|
try {
|
|
46841
|
-
paneFreshAgeMs = Math.max(0, now - statSync5(
|
|
46919
|
+
paneFreshAgeMs = Math.max(0, now - statSync5(join18(AGENT_DIR, "pane.log")).mtimeMs);
|
|
46842
46920
|
} catch {
|
|
46843
46921
|
}
|
|
46844
46922
|
}
|
|
@@ -46846,10 +46924,10 @@ async function replayPendingTelegramMarkers() {
|
|
|
46846
46924
|
const entries = [];
|
|
46847
46925
|
for (const name of filenames) {
|
|
46848
46926
|
if (!name.endsWith(".json") || name.endsWith(".tmp")) continue;
|
|
46849
|
-
const fullPath =
|
|
46927
|
+
const fullPath = join18(PENDING_INBOUND_DIR, name);
|
|
46850
46928
|
let marker;
|
|
46851
46929
|
try {
|
|
46852
|
-
marker = JSON.parse(
|
|
46930
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
46853
46931
|
} catch {
|
|
46854
46932
|
continue;
|
|
46855
46933
|
}
|
|
@@ -46878,6 +46956,7 @@ async function replayPendingTelegramMarkers() {
|
|
|
46878
46956
|
...replayPayload,
|
|
46879
46957
|
meta: { ...replayPayload.meta, replayed: "true" }
|
|
46880
46958
|
};
|
|
46959
|
+
writeUnattributedTurnMarker("telegram");
|
|
46881
46960
|
try {
|
|
46882
46961
|
await mcp.notification({
|
|
46883
46962
|
method: "notifications/claude/channel",
|
|
@@ -47487,7 +47566,7 @@ async function pollLoop() {
|
|
|
47487
47566
|
let paneLogFreshAgeMs = null;
|
|
47488
47567
|
if (AGENT_DIR) {
|
|
47489
47568
|
try {
|
|
47490
|
-
const paneMtimeMs = statSync5(
|
|
47569
|
+
const paneMtimeMs = statSync5(join18(AGENT_DIR, "pane.log")).mtimeMs;
|
|
47491
47570
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
47492
47571
|
} catch {
|
|
47493
47572
|
}
|
|
@@ -47626,8 +47705,12 @@ async function pollLoop() {
|
|
|
47626
47705
|
channel: "telegram",
|
|
47627
47706
|
sender_id: String(userId),
|
|
47628
47707
|
sender_name: userName,
|
|
47629
|
-
channel_ref: String(chatId)
|
|
47708
|
+
channel_ref: String(chatId),
|
|
47709
|
+
// ENG-11348: only a 'private' chat is one-to-one.
|
|
47710
|
+
chat_kind: isTelegramPrivateChat(msg.chat?.type) ? "direct" : "group"
|
|
47630
47711
|
});
|
|
47712
|
+
} else {
|
|
47713
|
+
writeUnattributedTurnMarker("telegram");
|
|
47631
47714
|
}
|
|
47632
47715
|
if (!isFromBot && !peerAgentMeta) {
|
|
47633
47716
|
inboundContextClient?.recordInbound({
|