@primusclaw/personal-agent-teams 0.4.0 → 0.5.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
@@ -1804,7 +1804,8 @@ var TeamsConversation = class {
1804
1804
  return envelope("send", reference(this.ref), this.prepare(activityOf(message2, this.parts.render)));
1805
1805
  }
1806
1806
  async deliver(stored) {
1807
- await this.publish(asEnvelope(stored));
1807
+ const delivered = await this.publish(asEnvelope(stored));
1808
+ return delivered?.activityId || void 0;
1808
1809
  }
1809
1810
  async send(message2) {
1810
1811
  await this.deliver(this.outgoing(message2));
@@ -2282,6 +2283,7 @@ function questionCard(model) {
2282
2283
  header(t.questionTitle, { tone: "accent", subtitle: model.note, emoji: "question" }),
2283
2284
  ...model.questions.flatMap((q, i) => questionInputs(q, i, t))
2284
2285
  ];
2286
+ if (model.typedReply === true) body.push(note(model.group ? t.questionReplyGroup : t.questionReply));
2285
2287
  if (model.group) body.push(note(t.questionOnly({ who: model.ownerName || t.questionAsker })));
2286
2288
  return message(body, [answerButton(model.sessionId, model.toolUseId, model.questions)]);
2287
2289
  }
@@ -2302,12 +2304,21 @@ function approvalExpired(model) {
2302
2304
  return message([header(t.expired, { tone: "attention", emoji: "expired" }), text(line2, { subtle: true })]);
2303
2305
  }
2304
2306
  function questionAnswered(model) {
2307
+ if (model.replied !== void 0) return questionReplied(model, model.replied);
2305
2308
  const said = proactiveText.in("en").answered({ at: clockText(model.when, model.zone) });
2306
2309
  return message([
2307
2310
  header(said, { tone: "good", emoji: "good" }),
2308
2311
  ...model.answers.map(([, answer]) => text(clip(answer, ANSWER_SHOWN_MAX)))
2309
2312
  ]);
2310
2313
  }
2314
+ function questionReplied(model, lang) {
2315
+ const t = approvalText.in(lang);
2316
+ const answer = [...new Set(model.answers.map(([, a]) => a))].join(" / ");
2317
+ return message([
2318
+ header(t.questionReplied({ answer: clip(answer, TITLE_MAX) }), { tone: "good", emoji: "good" }),
2319
+ note(t.questionRepliedAt({ at: clockText(model.when, model.zone) }))
2320
+ ]);
2321
+ }
2311
2322
  function approvalAgain(model) {
2312
2323
  return noteCard(
2313
2324
  model.text,
@@ -6340,7 +6351,9 @@ function proactiveParts(base2, style, assistant, errors, router) {
6340
6351
  const deps = {
6341
6352
  store,
6342
6353
  conversationFor: conversationFor(base2),
6343
- deliverStored: (envelope2) => surface.conversation(refOf(envelope2["reference"] ?? {})).deliver(envelope2),
6354
+ deliverStored: async (envelope2) => {
6355
+ await surface.conversation(refOf(envelope2["reference"] ?? {})).deliver(envelope2);
6356
+ },
6344
6357
  messageIds: surface.caps.messageIds,
6345
6358
  say: new SayPlanner({
6346
6359
  store,
@@ -6763,6 +6776,7 @@ function approvalClicks(base2, guard, hooks) {
6763
6776
  // packages/teams/src/assembly/features-w8.ts
6764
6777
  import { createHash as createHash3 } from "node:crypto";
6765
6778
  import {
6779
+ chatCredentialOf,
6766
6780
  DailyBrief,
6767
6781
  FeedbackFlow,
6768
6782
  FeedbackReporting,
@@ -6846,7 +6860,9 @@ function w8Parts(base2, options) {
6846
6860
  reporting,
6847
6861
  sessions: store.sessions,
6848
6862
  claw: { sessions: claw.sessions, assistant: claw.assistant },
6849
- credential,
6863
+ // A vote is cast as the person's chats run: someone bound but never linked has no key, and their turns run on the
6864
+ // exchanged token, so a key-only vote was never recorded for them.
6865
+ credential: chatCredentialOf(store.links, settings2.exchange.forChat ? base2.exchange : void 0),
6850
6866
  assistantOn: options.assistantOn,
6851
6867
  sha256Hex: (text4) => createHash3("sha256").update(text4, "utf8").digest("hex"),
6852
6868
  mask: mask2,
package/dist/main.js CHANGED
@@ -3033,7 +3033,8 @@ var TeamsConversation = class {
3033
3033
  return envelope("send", reference(this.ref), this.prepare(activityOf(message2, this.parts.render)));
3034
3034
  }
3035
3035
  async deliver(stored) {
3036
- await this.publish(asEnvelope(stored));
3036
+ const delivered = await this.publish(asEnvelope(stored));
3037
+ return delivered?.activityId || void 0;
3037
3038
  }
3038
3039
  async send(message2) {
3039
3040
  await this.deliver(this.outgoing(message2));
@@ -3751,6 +3752,7 @@ function questionCard(model) {
3751
3752
  header(t.questionTitle, { tone: "accent", subtitle: model.note, emoji: "question" }),
3752
3753
  ...model.questions.flatMap((q, i) => questionInputs(q, i, t))
3753
3754
  ];
3755
+ if (model.typedReply === true) body.push(note(model.group ? t.questionReplyGroup : t.questionReply));
3754
3756
  if (model.group) body.push(note(t.questionOnly({ who: model.ownerName || t.questionAsker })));
3755
3757
  return message(body, [answerButton(model.sessionId, model.toolUseId, model.questions)]);
3756
3758
  }
@@ -3771,12 +3773,21 @@ function approvalExpired(model) {
3771
3773
  return message([header(t.expired, { tone: "attention", emoji: "expired" }), text2(line2, { subtle: true })]);
3772
3774
  }
3773
3775
  function questionAnswered(model) {
3776
+ if (model.replied !== void 0) return questionReplied(model, model.replied);
3774
3777
  const said = proactiveText.in("en").answered({ at: clockText(model.when, model.zone) });
3775
3778
  return message([
3776
3779
  header(said, { tone: "good", emoji: "good" }),
3777
3780
  ...model.answers.map(([, answer]) => text2(clip(answer, ANSWER_SHOWN_MAX)))
3778
3781
  ]);
3779
3782
  }
3783
+ function questionReplied(model, lang) {
3784
+ const t = approvalText.in(lang);
3785
+ const answer = [...new Set(model.answers.map(([, a]) => a))].join(" / ");
3786
+ return message([
3787
+ header(t.questionReplied({ answer: clip(answer, TITLE_MAX) }), { tone: "good", emoji: "good" }),
3788
+ note(t.questionRepliedAt({ at: clockText(model.when, model.zone) }))
3789
+ ]);
3790
+ }
3780
3791
  function approvalAgain(model) {
3781
3792
  return noteCard(
3782
3793
  model.text,
@@ -6308,7 +6319,9 @@ function proactiveParts(base2, style, assistant, errors, router) {
6308
6319
  const deps = {
6309
6320
  store,
6310
6321
  conversationFor: conversationFor(base2),
6311
- deliverStored: (envelope2) => surface.conversation(refOf(envelope2["reference"] ?? {})).deliver(envelope2),
6322
+ deliverStored: async (envelope2) => {
6323
+ await surface.conversation(refOf(envelope2["reference"] ?? {})).deliver(envelope2);
6324
+ },
6312
6325
  messageIds: surface.caps.messageIds,
6313
6326
  say: new SayPlanner({
6314
6327
  store,
@@ -6731,6 +6744,7 @@ function approvalClicks(base2, guard, hooks) {
6731
6744
  // packages/teams/src/assembly/features-w8.ts
6732
6745
  import { createHash as createHash3 } from "node:crypto";
6733
6746
  import {
6747
+ chatCredentialOf,
6734
6748
  DailyBrief,
6735
6749
  FeedbackFlow,
6736
6750
  FeedbackReporting,
@@ -6814,7 +6828,9 @@ function w8Parts(base2, options) {
6814
6828
  reporting,
6815
6829
  sessions: store.sessions,
6816
6830
  claw: { sessions: claw.sessions, assistant: claw.assistant },
6817
- credential,
6831
+ // A vote is cast as the person's chats run: someone bound but never linked has no key, and their turns run on the
6832
+ // exchanged token, so a key-only vote was never recorded for them.
6833
+ credential: chatCredentialOf(store.links, settings2.exchange.forChat ? base2.exchange : void 0),
6818
6834
  assistantOn: options.assistantOn,
6819
6835
  sha256Hex: (text4) => createHash3("sha256").update(text4, "utf8").digest("hex"),
6820
6836
  mask: mask2,
@@ -42,7 +42,7 @@ export declare class TeamsConversation implements Conversation {
42
42
  private publish;
43
43
  typing(): Promise<void>;
44
44
  outgoing(message: OutMessage): Envelope;
45
- deliver(stored: Envelope): Promise<void>;
45
+ deliver(stored: Envelope): Promise<MessageId | undefined>;
46
46
  send(message: OutMessage): Promise<void>;
47
47
  /**
48
48
  * Send and return Teams' id of the new message; undefined if it never arrives. A direct send returns the id itself; a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primusclaw/personal-agent-teams",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "The personal agent on Microsoft Teams: activities, Adaptive Cards, streams, Bot Connector, inbound queue, process assembly.",
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.4.0",
39
- "@primusclaw/personal-agent-runtime": "0.4.0",
38
+ "@primusclaw/personal-agent": "0.5.0",
39
+ "@primusclaw/personal-agent-runtime": "0.5.0",
40
40
  "zod": "^4.6.7"
41
41
  },
42
42
  "devDependencies": {