@primusclaw/personal-agent-teams 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 FENCE = /^( {0,3})(`{3,}|~{3,})([^\n]*)/u;
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 QUOTE = /^ {0,3}>[ \t]?([^\n]*)/u;
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) || FENCE.test(line2) || BULLET.test(line2) || NUMBERED.test(line2) || headingText(line2) !== null || QUOTE.test(line2) || RULE.test(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 = FENCE.exec(line2);
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 = FENCE.exec(line2);
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 = QUOTE.exec(line2);
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":
@@ -3505,6 +3581,72 @@ var REVIEW_RENDERERS = {
3505
3581
  githubConnect: githubConnectCard
3506
3582
  };
3507
3583
 
3584
+ // packages/teams/src/views/skills/index.ts
3585
+ import {
3586
+ SKILL_EDIT_CONTENT,
3587
+ SKILL_EDIT_DESCRIPTION,
3588
+ SKILL_VERB,
3589
+ skillText
3590
+ } from "@primusclaw/personal-agent";
3591
+ function skillButton(title, op, cardId) {
3592
+ return execute(title, `primusclaw.${SKILL_VERB}_${op}`, { primusclaw: SKILL_VERB, op, card: cardId });
3593
+ }
3594
+ function heading2(model) {
3595
+ const t = skillText.in(model.lang);
3596
+ const { skill } = model;
3597
+ const version = skill.version ?? 1;
3598
+ switch (skill.kind) {
3599
+ case "saved":
3600
+ return skill.created ? { title: t.savedTitle({ name: skill.name, version }), tone: "good", emoji: "good" } : { title: t.updatedTitle({ name: skill.name, version }), tone: "good", emoji: "good" };
3601
+ case "deleted":
3602
+ return { title: t.deletedTitle({ name: skill.name }), tone: "default", emoji: "dropped" };
3603
+ case "disabled":
3604
+ return { title: t.disabledTitle({ name: skill.name }), tone: "default", emoji: "notice" };
3605
+ case "enabled":
3606
+ return { title: t.enabledTitle({ name: skill.name }), tone: "good", emoji: "good" };
3607
+ case "draft":
3608
+ return { title: t.draftTitle({ name: skill.name }), tone: "warning", emoji: "needs_you" };
3609
+ }
3610
+ }
3611
+ function skillCard(model) {
3612
+ const t = skillText.in(model.lang);
3613
+ const { skill } = model;
3614
+ const head = heading2(model);
3615
+ const body = [header(head.title, { tone: head.tone, emoji: head.emoji })];
3616
+ body.push(
3617
+ ...facts([
3618
+ [t.whenToUse, skill.description],
3619
+ [t.files, skill.files.join(", ")]
3620
+ ])
3621
+ );
3622
+ if (skill.kind === "saved" || skill.kind === "draft") {
3623
+ body.push(note(skill.kind === "draft" ? t.draftNote : skill.manual ? t.manual : t.autoNote));
3624
+ }
3625
+ if (skill.preview) body.push(...fold("skill-preview", [text(skill.preview, { subtle: true })], "SKILL.md"));
3626
+ if (model.note) body.push(text(model.note, { weight: "Bolder" }));
3627
+ if (model.ended || !model.cardId) return message(body);
3628
+ if (skill.kind === "draft") {
3629
+ const confirm = (title, op) => execute(title, `primusclaw.assistant_confirm_${op}`, { primusclaw: "assistant_confirm", op, card: model.cardId });
3630
+ return message(body, buttons([confirm(model.allowLabel || t.save, "allow"), confirm(t.discard, "deny")]));
3631
+ }
3632
+ const actions = [skillButton(t.undo, "undo", model.cardId)];
3633
+ if (skill.kind === "saved") actions.push(skillButton(t.edit, "edit", model.cardId));
3634
+ return message(body, buttons(actions, ""));
3635
+ }
3636
+ function skillEdit(model) {
3637
+ const t = skillText.in(model.lang);
3638
+ const body = [
3639
+ header(t.editTitle({ name: model.name }), { tone: "accent", emoji: "changes" }),
3640
+ text(t.editDescription, { weight: "Bolder" }),
3641
+ { type: "Input.Text", id: SKILL_EDIT_DESCRIPTION, value: model.description, maxLength: 300, isMultiline: true },
3642
+ text(t.editContent, { weight: "Bolder" }),
3643
+ { type: "Input.Text", id: SKILL_EDIT_CONTENT, value: model.content, isMultiline: true }
3644
+ ];
3645
+ if (model.note) body.push(text(model.note, { weight: "Bolder" }));
3646
+ return message(body, buttons([skillButton(t.editSave, "save_edit", model.cardId)]));
3647
+ }
3648
+ var skillRenderers = { skillCard, skillEdit };
3649
+
3508
3650
  // packages/teams/src/views/turn/index.ts
3509
3651
  import { pyRstrip as pyRstrip2, turn as turn2 } from "@primusclaw/personal-agent";
3510
3652
 
@@ -3592,7 +3734,8 @@ var RENDERERS = {
3592
3734
  ...TURN_RENDERERS,
3593
3735
  ...REVIEW_RENDERERS,
3594
3736
  ...FEEDBACK_RENDERERS,
3595
- ...OBSERVE_RENDERERS
3737
+ ...OBSERVE_RENDERERS,
3738
+ ...skillRenderers
3596
3739
  };
3597
3740
 
3598
3741
  // packages/teams/src/assembly/worker.ts
@@ -7147,6 +7290,7 @@ import {
7147
7290
 
7148
7291
  // packages/teams/src/azure/keyvault-config.ts
7149
7292
  import { pyRstrip as pyRstrip6, SecretsUnavailable, pyStrip as pyStrip16, own as own12 } from "@primusclaw/personal-agent";
7293
+ import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtime";
7150
7294
  var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
7151
7295
  var KEYVAULT_API_VERSION = "7.4";
7152
7296
  var VAULT_NAMES = {
@@ -7155,15 +7299,19 @@ var VAULT_NAMES = {
7155
7299
  FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
7156
7300
  };
7157
7301
  var ENV_NAMES = {
7158
- TEAMS_ENCRYPTION_KEYS: "TEAMS_ENCRYPTION_KEYS",
7159
- TEAMS_EXCHANGE_CLIENT_SECRET: "TEAMS_EXCHANGE_CLIENT_SECRET",
7302
+ TEAMS_ENCRYPTION_KEYS: "PA_ENCRYPTION_KEYS",
7303
+ TEAMS_EXCHANGE_CLIENT_SECRET: "PA_EXCHANGE_CLIENT_SECRET",
7160
7304
  FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
7161
7305
  };
7162
7306
  function get2(env, name) {
7163
7307
  return pyStrip16(own12(env, name) ?? "");
7164
7308
  }
7165
7309
  function shadowedSettings(env, names) {
7166
- return names.map((name) => ENV_NAMES[name]).filter((setting) => get2(env, setting));
7310
+ return names.flatMap((name) => {
7311
+ const setting = ENV_NAMES[name];
7312
+ const legacy = SETTING_ALIASES.get(setting);
7313
+ return legacy === void 0 ? [setting] : [setting, legacy];
7314
+ }).filter((setting) => get2(env, setting));
7167
7315
  }
7168
7316
  function splitUrl(url) {
7169
7317
  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 FENCE = /^( {0,3})(`{3,}|~{3,})([^\n]*)/u;
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 QUOTE = /^ {0,3}>[ \t]?([^\n]*)/u;
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) || FENCE.test(line2) || BULLET.test(line2) || NUMBERED.test(line2) || headingText(line2) !== null || QUOTE.test(line2) || RULE.test(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 = FENCE.exec(line2);
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 = FENCE.exec(line2);
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 = QUOTE.exec(line2);
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":
@@ -6016,6 +6092,72 @@ var REVIEW_RENDERERS = {
6016
6092
  githubConnect: githubConnectCard
6017
6093
  };
6018
6094
 
6095
+ // packages/teams/src/views/skills/index.ts
6096
+ import {
6097
+ SKILL_EDIT_CONTENT,
6098
+ SKILL_EDIT_DESCRIPTION,
6099
+ SKILL_VERB,
6100
+ skillText
6101
+ } from "@primusclaw/personal-agent";
6102
+ function skillButton(title, op, cardId) {
6103
+ return execute(title, `primusclaw.${SKILL_VERB}_${op}`, { primusclaw: SKILL_VERB, op, card: cardId });
6104
+ }
6105
+ function heading2(model) {
6106
+ const t = skillText.in(model.lang);
6107
+ const { skill } = model;
6108
+ const version = skill.version ?? 1;
6109
+ switch (skill.kind) {
6110
+ case "saved":
6111
+ return skill.created ? { title: t.savedTitle({ name: skill.name, version }), tone: "good", emoji: "good" } : { title: t.updatedTitle({ name: skill.name, version }), tone: "good", emoji: "good" };
6112
+ case "deleted":
6113
+ return { title: t.deletedTitle({ name: skill.name }), tone: "default", emoji: "dropped" };
6114
+ case "disabled":
6115
+ return { title: t.disabledTitle({ name: skill.name }), tone: "default", emoji: "notice" };
6116
+ case "enabled":
6117
+ return { title: t.enabledTitle({ name: skill.name }), tone: "good", emoji: "good" };
6118
+ case "draft":
6119
+ return { title: t.draftTitle({ name: skill.name }), tone: "warning", emoji: "needs_you" };
6120
+ }
6121
+ }
6122
+ function skillCard(model) {
6123
+ const t = skillText.in(model.lang);
6124
+ const { skill } = model;
6125
+ const head = heading2(model);
6126
+ const body = [header(head.title, { tone: head.tone, emoji: head.emoji })];
6127
+ body.push(
6128
+ ...facts([
6129
+ [t.whenToUse, skill.description],
6130
+ [t.files, skill.files.join(", ")]
6131
+ ])
6132
+ );
6133
+ if (skill.kind === "saved" || skill.kind === "draft") {
6134
+ body.push(note(skill.kind === "draft" ? t.draftNote : skill.manual ? t.manual : t.autoNote));
6135
+ }
6136
+ if (skill.preview) body.push(...fold("skill-preview", [text2(skill.preview, { subtle: true })], "SKILL.md"));
6137
+ if (model.note) body.push(text2(model.note, { weight: "Bolder" }));
6138
+ if (model.ended || !model.cardId) return message(body);
6139
+ if (skill.kind === "draft") {
6140
+ const confirm = (title, op) => execute(title, `primusclaw.assistant_confirm_${op}`, { primusclaw: "assistant_confirm", op, card: model.cardId });
6141
+ return message(body, buttons([confirm(model.allowLabel || t.save, "allow"), confirm(t.discard, "deny")]));
6142
+ }
6143
+ const actions = [skillButton(t.undo, "undo", model.cardId)];
6144
+ if (skill.kind === "saved") actions.push(skillButton(t.edit, "edit", model.cardId));
6145
+ return message(body, buttons(actions, ""));
6146
+ }
6147
+ function skillEdit(model) {
6148
+ const t = skillText.in(model.lang);
6149
+ const body = [
6150
+ header(t.editTitle({ name: model.name }), { tone: "accent", emoji: "changes" }),
6151
+ text2(t.editDescription, { weight: "Bolder" }),
6152
+ { type: "Input.Text", id: SKILL_EDIT_DESCRIPTION, value: model.description, maxLength: 300, isMultiline: true },
6153
+ text2(t.editContent, { weight: "Bolder" }),
6154
+ { type: "Input.Text", id: SKILL_EDIT_CONTENT, value: model.content, isMultiline: true }
6155
+ ];
6156
+ if (model.note) body.push(text2(model.note, { weight: "Bolder" }));
6157
+ return message(body, buttons([skillButton(t.editSave, "save_edit", model.cardId)]));
6158
+ }
6159
+ var skillRenderers = { skillCard, skillEdit };
6160
+
6019
6161
  // packages/teams/src/views/turn/index.ts
6020
6162
  import { pyRstrip as pyRstrip5, turn as turn2 } from "@primusclaw/personal-agent";
6021
6163
 
@@ -6103,7 +6245,8 @@ var RENDERERS = {
6103
6245
  ...TURN_RENDERERS,
6104
6246
  ...REVIEW_RENDERERS,
6105
6247
  ...FEEDBACK_RENDERERS,
6106
- ...OBSERVE_RENDERERS
6248
+ ...OBSERVE_RENDERERS,
6249
+ ...skillRenderers
6107
6250
  };
6108
6251
 
6109
6252
  // packages/teams/src/assembly/inbound.ts
@@ -7116,6 +7259,7 @@ import {
7116
7259
 
7117
7260
  // packages/teams/src/azure/keyvault-config.ts
7118
7261
  import { pyRstrip as pyRstrip6, SecretsUnavailable, pyStrip as pyStrip16, own as own12 } from "@primusclaw/personal-agent";
7262
+ import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtime";
7119
7263
  var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
7120
7264
  var KEYVAULT_API_VERSION = "7.4";
7121
7265
  var VAULT_NAMES = {
@@ -7124,15 +7268,19 @@ var VAULT_NAMES = {
7124
7268
  FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
7125
7269
  };
7126
7270
  var ENV_NAMES = {
7127
- TEAMS_ENCRYPTION_KEYS: "TEAMS_ENCRYPTION_KEYS",
7128
- TEAMS_EXCHANGE_CLIENT_SECRET: "TEAMS_EXCHANGE_CLIENT_SECRET",
7271
+ TEAMS_ENCRYPTION_KEYS: "PA_ENCRYPTION_KEYS",
7272
+ TEAMS_EXCHANGE_CLIENT_SECRET: "PA_EXCHANGE_CLIENT_SECRET",
7129
7273
  FEEDBACK_GITHUB_APP_KEY: "FEEDBACK_GITHUB_KEY_FILE"
7130
7274
  };
7131
7275
  function get2(env, name) {
7132
7276
  return pyStrip16(own12(env, name) ?? "");
7133
7277
  }
7134
7278
  function shadowedSettings(env, names) {
7135
- return names.map((name) => ENV_NAMES[name]).filter((setting) => get2(env, setting));
7279
+ return names.flatMap((name) => {
7280
+ const setting = ENV_NAMES[name];
7281
+ const legacy = SETTING_ALIASES.get(setting);
7282
+ return legacy === void 0 ? [setting] : [setting, legacy];
7283
+ }).filter((setting) => get2(env, setting));
7136
7284
  }
7137
7285
  function splitUrl(url) {
7138
7286
  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
- /** What the environment holds for each secret with SECRETS_SOURCE=env (the GitHub App key is a mounted file). */
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;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The cards of the person's personal skills: what was saved, changed, turned off or deleted (Undo; Edit for a saved one), a draft to
3
+ * save (Save and Discard, the held write's own buttons), and the form that edits one. What they say is core's (`skillText`); the
4
+ * buttons carry only the id of the card the worker recorded, never what the press means.
5
+ */
6
+ import { type SkillCardModel, type SkillEditModel } from "@primusclaw/personal-agent";
7
+ import type { TeamsMessage } from "../registry.js";
8
+ /**
9
+ * A skill's card: what it is for and its files, the start of SKILL.md folded away, then its buttons. A draft's are Save and Discard
10
+ * (the held write's own verb, answered as any held write is); anything done already has Undo, and a saved one Edit too.
11
+ */
12
+ declare function skillCard(model: SkillCardModel): TeamsMessage;
13
+ /** The form that edits a skill: its description and its whole SKILL.md, and Save changes. */
14
+ declare function skillEdit(model: SkillEditModel): TeamsMessage;
15
+ export declare const skillRenderers: {
16
+ skillCard: typeof skillCard;
17
+ skillEdit: typeof skillEdit;
18
+ };
19
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primusclaw/personal-agent-teams",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
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.0",
39
- "@primusclaw/personal-agent-runtime": "0.8.0",
38
+ "@primusclaw/personal-agent": "0.9.0",
39
+ "@primusclaw/personal-agent-runtime": "0.9.0",
40
40
  "zod": "^4.6.7"
41
41
  },
42
42
  "devDependencies": {