@primusclaw/personal-agent-teams 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +93 -12
- package/dist/main.js +93 -12
- package/dist/types/activity/line-breaks.d.ts +7 -0
- package/dist/types/azure/keyvault-config.d.ts +5 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -551,6 +551,82 @@ function streamsIn(style, conversationType2) {
|
|
|
551
551
|
return style.streaming.has(conversationType2);
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
// packages/teams/src/activity/line-breaks.ts
|
|
555
|
+
var BLANK = /^\s*$/u;
|
|
556
|
+
var LIST_ITEM = /^[ \t]*(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/u;
|
|
557
|
+
var TABLE_ROW = /^[ \t]*\|/u;
|
|
558
|
+
var FENCE = /^ {0,3}(`{3,}|~{3,})(.*)$/u;
|
|
559
|
+
var HEADING = /^ {0,3}#{1,6}(?:[ \t]|$)/u;
|
|
560
|
+
var QUOTE = /^ {0,3}>/u;
|
|
561
|
+
var INDENTED = /^[ \t]/u;
|
|
562
|
+
var UNDECIDED = /^\s*(?:[-*+]|\d{1,9}[.)]?|`{1,2}|~{1,2}|#{1,6})?$/u;
|
|
563
|
+
var DELIMITER_SO_FAR = /^[\s\-:|]*$/u;
|
|
564
|
+
function delimiterRow(line2) {
|
|
565
|
+
return /^[-:| \t]+$/u.test(line2) && line2.includes("|") && line2.includes("-");
|
|
566
|
+
}
|
|
567
|
+
function startsOwnBlock(line2) {
|
|
568
|
+
return BLANK.test(line2) || LIST_ITEM.test(line2) || TABLE_ROW.test(line2) || delimiterRow(line2) || FENCE.test(line2) || HEADING.test(line2) || QUOTE.test(line2);
|
|
569
|
+
}
|
|
570
|
+
var Blocks = class {
|
|
571
|
+
fence;
|
|
572
|
+
list = false;
|
|
573
|
+
table = false;
|
|
574
|
+
/** Where `line`, the next line of the text, stands. */
|
|
575
|
+
read(line2) {
|
|
576
|
+
if (this.code(line2)) {
|
|
577
|
+
this.list = this.table = false;
|
|
578
|
+
return { code: true, blank: false, list: false, table: false };
|
|
579
|
+
}
|
|
580
|
+
const blank = BLANK.test(line2);
|
|
581
|
+
if (LIST_ITEM.test(line2)) this.list = true;
|
|
582
|
+
else if (!blank && !INDENTED.test(line2)) this.list = false;
|
|
583
|
+
this.table = !blank && (delimiterRow(line2) || TABLE_ROW.test(line2) || this.table && line2.includes("|"));
|
|
584
|
+
return { code: false, blank, list: this.list, table: this.table };
|
|
585
|
+
}
|
|
586
|
+
/** Whether `line` is a fence or a line inside a fenced code block. */
|
|
587
|
+
code(line2) {
|
|
588
|
+
const fence = FENCE.exec(line2);
|
|
589
|
+
const marks = fence?.[1] ?? "";
|
|
590
|
+
if (this.fence !== void 0) {
|
|
591
|
+
const closes2 = marks[0] === this.fence[0] && marks.length >= this.fence.length && BLANK.test(fence?.[2] ?? "x");
|
|
592
|
+
if (closes2) this.fence = void 0;
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
595
|
+
if (fence && !(marks.startsWith("`") && (fence[2] ?? "").includes("`"))) {
|
|
596
|
+
this.fence = marks;
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
function single(before, line2, whole) {
|
|
603
|
+
if (before.code || before.blank) return true;
|
|
604
|
+
if (!whole) {
|
|
605
|
+
if (UNDECIDED.test(line2) || DELIMITER_SO_FAR.test(line2)) return void 0;
|
|
606
|
+
if (before.table && !line2.includes("|")) return void 0;
|
|
607
|
+
}
|
|
608
|
+
return startsOwnBlock(line2) || before.list && INDENTED.test(line2) || before.table && line2.includes("|");
|
|
609
|
+
}
|
|
610
|
+
function breakLines(text4, complete) {
|
|
611
|
+
if (!text4.includes("\n")) return text4;
|
|
612
|
+
const lines = text4.split("\n");
|
|
613
|
+
const blocks = new Blocks();
|
|
614
|
+
let out = lines[0] ?? "";
|
|
615
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
616
|
+
const line2 = lines[i] ?? "";
|
|
617
|
+
const keep = single(blocks.read(lines[i - 1] ?? ""), line2, complete || i < lines.length - 1);
|
|
618
|
+
if (keep === void 0) return out;
|
|
619
|
+
out += (keep ? "\n" : "\n\n") + line2;
|
|
620
|
+
}
|
|
621
|
+
return out;
|
|
622
|
+
}
|
|
623
|
+
function withLineBreaks(text4) {
|
|
624
|
+
return breakLines(text4, true);
|
|
625
|
+
}
|
|
626
|
+
function streamedLineBreaks(text4) {
|
|
627
|
+
return breakLines(text4, false);
|
|
628
|
+
}
|
|
629
|
+
|
|
554
630
|
// packages/teams/src/stream/informative.ts
|
|
555
631
|
import { pyLstrip, squashSpaces as squashSpaces2 } from "@primusclaw/personal-agent";
|
|
556
632
|
var INFORMATIVE_MAX_CHARS = 1e3;
|
|
@@ -784,7 +860,7 @@ var TeamsLiveStream = class {
|
|
|
784
860
|
return attempt(() => this.stream.inform(informativeText([text4]), options?.signal));
|
|
785
861
|
}
|
|
786
862
|
emit(text4, options) {
|
|
787
|
-
return attempt(() => this.stream.emit(text4, options?.signal));
|
|
863
|
+
return attempt(() => this.stream.emit(streamedLineBreaks(text4), options?.signal));
|
|
788
864
|
}
|
|
789
865
|
finish(message2) {
|
|
790
866
|
return attempt(() => this.stream.final(this.render(message2)));
|
|
@@ -1441,14 +1517,14 @@ function inlineFrags(text4, depth = 0, links = true) {
|
|
|
1441
1517
|
}
|
|
1442
1518
|
|
|
1443
1519
|
// packages/teams/src/richtext/lines.ts
|
|
1444
|
-
var
|
|
1520
|
+
var FENCE2 = /^( {0,3})(`{3,}|~{3,})([^\n]*)/u;
|
|
1445
1521
|
var HEADING_OPEN = /^ {0,3}#{1,6}[ \t]/u;
|
|
1446
1522
|
var BOLD_STAR = new RegExp(`^${S}*\\*\\*(?=${NS})([^\\n]+?)(?<=${NS})\\*\\*([:\uFF1A]?)${S}*${END}`, "u");
|
|
1447
1523
|
var BOLD_UNDER = new RegExp(`^${S}*__(?=${NS})([^\\n]+?)(?<=${NS})__([:\uFF1A]?)${S}*${END}`, "u");
|
|
1448
1524
|
var RULE = new RegExp(`^ {0,3}([-*_])(?:[ \\t]*\\1){2,}[ \\t]*${END}`, "u");
|
|
1449
1525
|
var BULLET = /^([ \t]*)[-*+][ \t]+([^\n]*)/u;
|
|
1450
1526
|
var NUMBERED = new RegExp("^([ \\t]*)(\\p{Nd}{1,9}[.)])[ \\t]+([^\\n]*)", "u");
|
|
1451
|
-
var
|
|
1527
|
+
var QUOTE2 = /^ {0,3}>[ \t]?([^\n]*)/u;
|
|
1452
1528
|
var TABLE_SEP = new RegExp(
|
|
1453
1529
|
`^${S}*(?:\\|${S}*)?:?-+:?${S}*\\|(?:${S}*:?-+:?${S}*\\|)*(?:${S}*:?-+:?${S}*)?${END}`,
|
|
1454
1530
|
"u"
|
|
@@ -1483,7 +1559,7 @@ function cells(line2) {
|
|
|
1483
1559
|
return row3.split(CELL_SPLIT).map((c) => strip(c));
|
|
1484
1560
|
}
|
|
1485
1561
|
function startsBlock(line2) {
|
|
1486
|
-
return !strip(line2) ||
|
|
1562
|
+
return !strip(line2) || FENCE2.test(line2) || BULLET.test(line2) || NUMBERED.test(line2) || headingText(line2) !== null || QUOTE2.test(line2) || RULE.test(line2);
|
|
1487
1563
|
}
|
|
1488
1564
|
|
|
1489
1565
|
// packages/teams/src/richtext/status.ts
|
|
@@ -1599,13 +1675,13 @@ var Writer = class {
|
|
|
1599
1675
|
}
|
|
1600
1676
|
};
|
|
1601
1677
|
function closesFence(line2, marks) {
|
|
1602
|
-
const closing =
|
|
1678
|
+
const closing = FENCE2.exec(line2);
|
|
1603
1679
|
if (!closing) return false;
|
|
1604
1680
|
const closeMarks = closing[2] ?? "";
|
|
1605
1681
|
return closeMarks[0] === marks[0] && closeMarks.length >= marks.length && !strip(closing[3] ?? "");
|
|
1606
1682
|
}
|
|
1607
1683
|
function openingFence(line2) {
|
|
1608
|
-
const fence =
|
|
1684
|
+
const fence = FENCE2.exec(line2);
|
|
1609
1685
|
return fence && !((fence[2] ?? "").startsWith("`") && (fence[3] ?? "").includes("`")) ? fence : null;
|
|
1610
1686
|
}
|
|
1611
1687
|
function checkSize(result) {
|
|
@@ -1662,7 +1738,7 @@ function lineBlock(lines, i, line2, w) {
|
|
|
1662
1738
|
if (bullet) return listItem(lines, i, bullet[1] ?? "", null, bullet[2] ?? "", w);
|
|
1663
1739
|
const numbered = NUMBERED.exec(line2);
|
|
1664
1740
|
if (numbered) return listItem(lines, i, numbered[1] ?? "", numbered[2] ?? "", numbered[3] ?? "", w);
|
|
1665
|
-
const quote2 =
|
|
1741
|
+
const quote2 = QUOTE2.exec(line2);
|
|
1666
1742
|
if (quote2) {
|
|
1667
1743
|
w.add(`\u2502 <i>${inlineHtml(quote2[1] ?? "")}</i>`);
|
|
1668
1744
|
return i;
|
|
@@ -1734,13 +1810,13 @@ ${masker.note}` : masked.text;
|
|
|
1734
1810
|
const html = activity["text"];
|
|
1735
1811
|
if (activity["textFormat"] !== "xml" || typeof html !== "string" || !masker.text(html).hit) return activity;
|
|
1736
1812
|
}
|
|
1737
|
-
return textActivity(first ?? "");
|
|
1813
|
+
return textActivity(withLineBreaks(first ?? ""));
|
|
1738
1814
|
}
|
|
1739
1815
|
function bodyActivity(message2, context) {
|
|
1740
1816
|
const body = message2.body;
|
|
1741
1817
|
switch (body.type) {
|
|
1742
1818
|
case "text":
|
|
1743
|
-
return textActivity(body.text);
|
|
1819
|
+
return textActivity(withLineBreaks(body.text));
|
|
1744
1820
|
case "rich":
|
|
1745
1821
|
return richActivity(body.markdown, body.lead, context.masker);
|
|
1746
1822
|
case "view":
|
|
@@ -7147,6 +7223,7 @@ import {
|
|
|
7147
7223
|
|
|
7148
7224
|
// packages/teams/src/azure/keyvault-config.ts
|
|
7149
7225
|
import { pyRstrip as pyRstrip6, SecretsUnavailable, pyStrip as pyStrip16, own as own12 } from "@primusclaw/personal-agent";
|
|
7226
|
+
import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtime";
|
|
7150
7227
|
var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
|
|
7151
7228
|
var KEYVAULT_API_VERSION = "7.4";
|
|
7152
7229
|
var VAULT_NAMES = {
|
|
@@ -7155,15 +7232,19 @@ var VAULT_NAMES = {
|
|
|
7155
7232
|
FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
|
|
7156
7233
|
};
|
|
7157
7234
|
var ENV_NAMES = {
|
|
7158
|
-
TEAMS_ENCRYPTION_KEYS: "
|
|
7159
|
-
TEAMS_EXCHANGE_CLIENT_SECRET: "
|
|
7235
|
+
TEAMS_ENCRYPTION_KEYS: "PA_ENCRYPTION_KEYS",
|
|
7236
|
+
TEAMS_EXCHANGE_CLIENT_SECRET: "PA_EXCHANGE_CLIENT_SECRET",
|
|
7160
7237
|
FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
|
|
7161
7238
|
};
|
|
7162
7239
|
function get2(env, name) {
|
|
7163
7240
|
return pyStrip16(own12(env, name) ?? "");
|
|
7164
7241
|
}
|
|
7165
7242
|
function shadowedSettings(env, names) {
|
|
7166
|
-
return names.
|
|
7243
|
+
return names.flatMap((name) => {
|
|
7244
|
+
const setting = ENV_NAMES[name];
|
|
7245
|
+
const legacy = SETTING_ALIASES.get(setting);
|
|
7246
|
+
return legacy === void 0 ? [setting] : [setting, legacy];
|
|
7247
|
+
}).filter((setting) => get2(env, setting));
|
|
7167
7248
|
}
|
|
7168
7249
|
function splitUrl(url) {
|
|
7169
7250
|
const match = /^([A-Za-z][A-Za-z0-9+.-]*):(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?/.exec(url);
|
package/dist/main.js
CHANGED
|
@@ -2822,6 +2822,82 @@ function hasCard(activity) {
|
|
|
2822
2822
|
// packages/teams/src/stream/live-stream.ts
|
|
2823
2823
|
import { err as err3, ok as ok3 } from "@primusclaw/personal-agent";
|
|
2824
2824
|
|
|
2825
|
+
// packages/teams/src/activity/line-breaks.ts
|
|
2826
|
+
var BLANK = /^\s*$/u;
|
|
2827
|
+
var LIST_ITEM = /^[ \t]*(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/u;
|
|
2828
|
+
var TABLE_ROW = /^[ \t]*\|/u;
|
|
2829
|
+
var FENCE = /^ {0,3}(`{3,}|~{3,})(.*)$/u;
|
|
2830
|
+
var HEADING = /^ {0,3}#{1,6}(?:[ \t]|$)/u;
|
|
2831
|
+
var QUOTE = /^ {0,3}>/u;
|
|
2832
|
+
var INDENTED = /^[ \t]/u;
|
|
2833
|
+
var UNDECIDED = /^\s*(?:[-*+]|\d{1,9}[.)]?|`{1,2}|~{1,2}|#{1,6})?$/u;
|
|
2834
|
+
var DELIMITER_SO_FAR = /^[\s\-:|]*$/u;
|
|
2835
|
+
function delimiterRow(line2) {
|
|
2836
|
+
return /^[-:| \t]+$/u.test(line2) && line2.includes("|") && line2.includes("-");
|
|
2837
|
+
}
|
|
2838
|
+
function startsOwnBlock(line2) {
|
|
2839
|
+
return BLANK.test(line2) || LIST_ITEM.test(line2) || TABLE_ROW.test(line2) || delimiterRow(line2) || FENCE.test(line2) || HEADING.test(line2) || QUOTE.test(line2);
|
|
2840
|
+
}
|
|
2841
|
+
var Blocks = class {
|
|
2842
|
+
fence;
|
|
2843
|
+
list = false;
|
|
2844
|
+
table = false;
|
|
2845
|
+
/** Where `line`, the next line of the text, stands. */
|
|
2846
|
+
read(line2) {
|
|
2847
|
+
if (this.code(line2)) {
|
|
2848
|
+
this.list = this.table = false;
|
|
2849
|
+
return { code: true, blank: false, list: false, table: false };
|
|
2850
|
+
}
|
|
2851
|
+
const blank = BLANK.test(line2);
|
|
2852
|
+
if (LIST_ITEM.test(line2)) this.list = true;
|
|
2853
|
+
else if (!blank && !INDENTED.test(line2)) this.list = false;
|
|
2854
|
+
this.table = !blank && (delimiterRow(line2) || TABLE_ROW.test(line2) || this.table && line2.includes("|"));
|
|
2855
|
+
return { code: false, blank, list: this.list, table: this.table };
|
|
2856
|
+
}
|
|
2857
|
+
/** Whether `line` is a fence or a line inside a fenced code block. */
|
|
2858
|
+
code(line2) {
|
|
2859
|
+
const fence = FENCE.exec(line2);
|
|
2860
|
+
const marks = fence?.[1] ?? "";
|
|
2861
|
+
if (this.fence !== void 0) {
|
|
2862
|
+
const closes2 = marks[0] === this.fence[0] && marks.length >= this.fence.length && BLANK.test(fence?.[2] ?? "x");
|
|
2863
|
+
if (closes2) this.fence = void 0;
|
|
2864
|
+
return true;
|
|
2865
|
+
}
|
|
2866
|
+
if (fence && !(marks.startsWith("`") && (fence[2] ?? "").includes("`"))) {
|
|
2867
|
+
this.fence = marks;
|
|
2868
|
+
return true;
|
|
2869
|
+
}
|
|
2870
|
+
return false;
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
function single(before, line2, whole) {
|
|
2874
|
+
if (before.code || before.blank) return true;
|
|
2875
|
+
if (!whole) {
|
|
2876
|
+
if (UNDECIDED.test(line2) || DELIMITER_SO_FAR.test(line2)) return void 0;
|
|
2877
|
+
if (before.table && !line2.includes("|")) return void 0;
|
|
2878
|
+
}
|
|
2879
|
+
return startsOwnBlock(line2) || before.list && INDENTED.test(line2) || before.table && line2.includes("|");
|
|
2880
|
+
}
|
|
2881
|
+
function breakLines(text4, complete) {
|
|
2882
|
+
if (!text4.includes("\n")) return text4;
|
|
2883
|
+
const lines = text4.split("\n");
|
|
2884
|
+
const blocks = new Blocks();
|
|
2885
|
+
let out = lines[0] ?? "";
|
|
2886
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
2887
|
+
const line2 = lines[i] ?? "";
|
|
2888
|
+
const keep = single(blocks.read(lines[i - 1] ?? ""), line2, complete || i < lines.length - 1);
|
|
2889
|
+
if (keep === void 0) return out;
|
|
2890
|
+
out += (keep ? "\n" : "\n\n") + line2;
|
|
2891
|
+
}
|
|
2892
|
+
return out;
|
|
2893
|
+
}
|
|
2894
|
+
function withLineBreaks(text4) {
|
|
2895
|
+
return breakLines(text4, true);
|
|
2896
|
+
}
|
|
2897
|
+
function streamedLineBreaks(text4) {
|
|
2898
|
+
return breakLines(text4, false);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2825
2901
|
// packages/teams/src/stream/informative.ts
|
|
2826
2902
|
import { pyLstrip as pyLstrip2, squashSpaces as squashSpaces4 } from "@primusclaw/personal-agent";
|
|
2827
2903
|
var INFORMATIVE_MAX_CHARS = 1e3;
|
|
@@ -3055,7 +3131,7 @@ var TeamsLiveStream = class {
|
|
|
3055
3131
|
return attempt(() => this.stream.inform(informativeText([text4]), options?.signal));
|
|
3056
3132
|
}
|
|
3057
3133
|
emit(text4, options) {
|
|
3058
|
-
return attempt(() => this.stream.emit(text4, options?.signal));
|
|
3134
|
+
return attempt(() => this.stream.emit(streamedLineBreaks(text4), options?.signal));
|
|
3059
3135
|
}
|
|
3060
3136
|
finish(message2) {
|
|
3061
3137
|
return attempt(() => this.stream.final(this.render(message2)));
|
|
@@ -3712,14 +3788,14 @@ function inlineFrags(text4, depth = 0, links = true) {
|
|
|
3712
3788
|
}
|
|
3713
3789
|
|
|
3714
3790
|
// packages/teams/src/richtext/lines.ts
|
|
3715
|
-
var
|
|
3791
|
+
var FENCE2 = /^( {0,3})(`{3,}|~{3,})([^\n]*)/u;
|
|
3716
3792
|
var HEADING_OPEN = /^ {0,3}#{1,6}[ \t]/u;
|
|
3717
3793
|
var BOLD_STAR = new RegExp(`^${S}*\\*\\*(?=${NS})([^\\n]+?)(?<=${NS})\\*\\*([:\uFF1A]?)${S}*${END}`, "u");
|
|
3718
3794
|
var BOLD_UNDER = new RegExp(`^${S}*__(?=${NS})([^\\n]+?)(?<=${NS})__([:\uFF1A]?)${S}*${END}`, "u");
|
|
3719
3795
|
var RULE = new RegExp(`^ {0,3}([-*_])(?:[ \\t]*\\1){2,}[ \\t]*${END}`, "u");
|
|
3720
3796
|
var BULLET = /^([ \t]*)[-*+][ \t]+([^\n]*)/u;
|
|
3721
3797
|
var NUMBERED = new RegExp("^([ \\t]*)(\\p{Nd}{1,9}[.)])[ \\t]+([^\\n]*)", "u");
|
|
3722
|
-
var
|
|
3798
|
+
var QUOTE2 = /^ {0,3}>[ \t]?([^\n]*)/u;
|
|
3723
3799
|
var TABLE_SEP = new RegExp(
|
|
3724
3800
|
`^${S}*(?:\\|${S}*)?:?-+:?${S}*\\|(?:${S}*:?-+:?${S}*\\|)*(?:${S}*:?-+:?${S}*)?${END}`,
|
|
3725
3801
|
"u"
|
|
@@ -3754,7 +3830,7 @@ function cells(line2) {
|
|
|
3754
3830
|
return row3.split(CELL_SPLIT).map((c) => strip(c));
|
|
3755
3831
|
}
|
|
3756
3832
|
function startsBlock(line2) {
|
|
3757
|
-
return !strip(line2) ||
|
|
3833
|
+
return !strip(line2) || FENCE2.test(line2) || BULLET.test(line2) || NUMBERED.test(line2) || headingText(line2) !== null || QUOTE2.test(line2) || RULE.test(line2);
|
|
3758
3834
|
}
|
|
3759
3835
|
|
|
3760
3836
|
// packages/teams/src/richtext/status.ts
|
|
@@ -3870,13 +3946,13 @@ var Writer = class {
|
|
|
3870
3946
|
}
|
|
3871
3947
|
};
|
|
3872
3948
|
function closesFence(line2, marks) {
|
|
3873
|
-
const closing =
|
|
3949
|
+
const closing = FENCE2.exec(line2);
|
|
3874
3950
|
if (!closing) return false;
|
|
3875
3951
|
const closeMarks = closing[2] ?? "";
|
|
3876
3952
|
return closeMarks[0] === marks[0] && closeMarks.length >= marks.length && !strip(closing[3] ?? "");
|
|
3877
3953
|
}
|
|
3878
3954
|
function openingFence(line2) {
|
|
3879
|
-
const fence =
|
|
3955
|
+
const fence = FENCE2.exec(line2);
|
|
3880
3956
|
return fence && !((fence[2] ?? "").startsWith("`") && (fence[3] ?? "").includes("`")) ? fence : null;
|
|
3881
3957
|
}
|
|
3882
3958
|
function checkSize(result) {
|
|
@@ -3933,7 +4009,7 @@ function lineBlock(lines, i, line2, w) {
|
|
|
3933
4009
|
if (bullet) return listItem(lines, i, bullet[1] ?? "", null, bullet[2] ?? "", w);
|
|
3934
4010
|
const numbered = NUMBERED.exec(line2);
|
|
3935
4011
|
if (numbered) return listItem(lines, i, numbered[1] ?? "", numbered[2] ?? "", numbered[3] ?? "", w);
|
|
3936
|
-
const quote2 =
|
|
4012
|
+
const quote2 = QUOTE2.exec(line2);
|
|
3937
4013
|
if (quote2) {
|
|
3938
4014
|
w.add(`\u2502 <i>${inlineHtml(quote2[1] ?? "")}</i>`);
|
|
3939
4015
|
return i;
|
|
@@ -4005,13 +4081,13 @@ ${masker.note}` : masked.text;
|
|
|
4005
4081
|
const html = activity["text"];
|
|
4006
4082
|
if (activity["textFormat"] !== "xml" || typeof html !== "string" || !masker.text(html).hit) return activity;
|
|
4007
4083
|
}
|
|
4008
|
-
return textActivity(first ?? "");
|
|
4084
|
+
return textActivity(withLineBreaks(first ?? ""));
|
|
4009
4085
|
}
|
|
4010
4086
|
function bodyActivity(message2, context) {
|
|
4011
4087
|
const body = message2.body;
|
|
4012
4088
|
switch (body.type) {
|
|
4013
4089
|
case "text":
|
|
4014
|
-
return textActivity(body.text);
|
|
4090
|
+
return textActivity(withLineBreaks(body.text));
|
|
4015
4091
|
case "rich":
|
|
4016
4092
|
return richActivity(body.markdown, body.lead, context.masker);
|
|
4017
4093
|
case "view":
|
|
@@ -7116,6 +7192,7 @@ import {
|
|
|
7116
7192
|
|
|
7117
7193
|
// packages/teams/src/azure/keyvault-config.ts
|
|
7118
7194
|
import { pyRstrip as pyRstrip6, SecretsUnavailable, pyStrip as pyStrip16, own as own12 } from "@primusclaw/personal-agent";
|
|
7195
|
+
import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtime";
|
|
7119
7196
|
var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
|
|
7120
7197
|
var KEYVAULT_API_VERSION = "7.4";
|
|
7121
7198
|
var VAULT_NAMES = {
|
|
@@ -7124,15 +7201,19 @@ var VAULT_NAMES = {
|
|
|
7124
7201
|
FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
|
|
7125
7202
|
};
|
|
7126
7203
|
var ENV_NAMES = {
|
|
7127
|
-
TEAMS_ENCRYPTION_KEYS: "
|
|
7128
|
-
TEAMS_EXCHANGE_CLIENT_SECRET: "
|
|
7204
|
+
TEAMS_ENCRYPTION_KEYS: "PA_ENCRYPTION_KEYS",
|
|
7205
|
+
TEAMS_EXCHANGE_CLIENT_SECRET: "PA_EXCHANGE_CLIENT_SECRET",
|
|
7129
7206
|
FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
|
|
7130
7207
|
};
|
|
7131
7208
|
function get2(env, name) {
|
|
7132
7209
|
return pyStrip16(own12(env, name) ?? "");
|
|
7133
7210
|
}
|
|
7134
7211
|
function shadowedSettings(env, names) {
|
|
7135
|
-
return names.
|
|
7212
|
+
return names.flatMap((name) => {
|
|
7213
|
+
const setting = ENV_NAMES[name];
|
|
7214
|
+
const legacy = SETTING_ALIASES.get(setting);
|
|
7215
|
+
return legacy === void 0 ? [setting] : [setting, legacy];
|
|
7216
|
+
}).filter((setting) => get2(env, setting));
|
|
7136
7217
|
}
|
|
7137
7218
|
function splitUrl(url) {
|
|
7138
7219
|
const match = /^([A-Za-z][A-Za-z0-9+.-]*):(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?/.exec(url);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `text` (markdown) with every line that follows a line of text on a line of its own in Teams. */
|
|
2
|
+
export declare function withLineBreaks(text: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* The part of `text`, streamed so far, that can be shown with its line breaks already: `withLineBreaks` of it, less a last
|
|
5
|
+
* line that may still turn out to need its single "\n".
|
|
6
|
+
*/
|
|
7
|
+
export declare function streamedLineBreaks(text: string): string;
|
|
@@ -9,14 +9,17 @@ export declare const KEYVAULT_SCOPE = "https://vault.azure.net/.default";
|
|
|
9
9
|
export declare const KEYVAULT_API_VERSION = "7.4";
|
|
10
10
|
/** The setting a secret replaces -> the name of the secret in the vault. */
|
|
11
11
|
export declare const VAULT_NAMES: Readonly<Record<SecretName, string>>;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* What the environment holds for each secret with SECRETS_SOURCE=env (the GitHub App key is a mounted file); the older
|
|
14
|
+
* `TEAMS_` name of a `PA_` one is read too.
|
|
15
|
+
*/
|
|
13
16
|
export declare const ENV_NAMES: Readonly<Record<SecretName, string>>;
|
|
14
17
|
/**
|
|
15
18
|
* The secrets this configuration needs: the encryption keys always, the exchange's client secret when the exchange is
|
|
16
19
|
* on, the GitHub App key when the feedback App is configured (FEEDBACK_GITHUB_APP_ID and FEEDBACK_GITHUB_INSTALLATION_ID).
|
|
17
20
|
*/
|
|
18
21
|
export declare function wanted(env: Env): SecretName[];
|
|
19
|
-
/** The environment settings `names` replace that are set anyway: with keyvault they are ignored. */
|
|
22
|
+
/** The environment settings `names` replace that are set anyway (either name of a pair): with keyvault they are ignored. */
|
|
20
23
|
export declare function shadowedSettings(env: Env, names: readonly SecretName[]): string[];
|
|
21
24
|
/** The vault's host name, from a URL `vaultUrl` accepted. */
|
|
22
25
|
export declare function vaultHost(url: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primusclaw/personal-agent-teams",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "The personal agent on Microsoft Teams: activities, Adaptive Cards, streams, Bot Connector, inbound queue, and the worker's Teams surface.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@azure/core-auth": "^1.11.0",
|
|
37
37
|
"@azure/service-bus": "^7.10.0",
|
|
38
|
-
"@primusclaw/personal-agent": "0.8.
|
|
39
|
-
"@primusclaw/personal-agent-runtime": "0.8.
|
|
38
|
+
"@primusclaw/personal-agent": "0.8.1",
|
|
39
|
+
"@primusclaw/personal-agent-runtime": "0.8.1",
|
|
40
40
|
"zod": "^4.6.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|