@primusclaw/personal-agent-teams 0.5.0 → 0.6.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
|
@@ -2183,8 +2183,40 @@ function confirmWrite(model) {
|
|
|
2183
2183
|
buttons([button(model.allowLabel || t.confirm, "allow"), button(t.deny, "deny")])
|
|
2184
2184
|
);
|
|
2185
2185
|
}
|
|
2186
|
+
function choiceCard(model) {
|
|
2187
|
+
const lang = cardLang(model.lang, model.text, ...model.options);
|
|
2188
|
+
const t = assistantCardText.in(lang);
|
|
2189
|
+
const body = [
|
|
2190
|
+
header(model.multiple ? t.choiceTitleMany : t.choiceTitle, { tone: "accent", emoji: "question" })
|
|
2191
|
+
];
|
|
2192
|
+
if (model.text) body.push(text(model.text));
|
|
2193
|
+
body.push({
|
|
2194
|
+
type: "Input.ChoiceSet",
|
|
2195
|
+
id: "choice",
|
|
2196
|
+
style: "expanded",
|
|
2197
|
+
isMultiSelect: model.multiple,
|
|
2198
|
+
choices: model.options.map((option, i) => ({ title: clip(option, LABEL_MAX), value: String(i) }))
|
|
2199
|
+
});
|
|
2200
|
+
if (model.note) body.push(text(model.note, { weight: "Bolder" }));
|
|
2201
|
+
body.push(note(t.choiceTyped));
|
|
2202
|
+
const send = execute(t.choiceSend, "primusclaw.assistant_choice", {
|
|
2203
|
+
primusclaw: "assistant_choice",
|
|
2204
|
+
card: model.cardId
|
|
2205
|
+
});
|
|
2206
|
+
return message(body, buttons([send]));
|
|
2207
|
+
}
|
|
2208
|
+
function choiceChosen(model) {
|
|
2209
|
+
const lang = cardLang(model.lang, model.text, ...model.chosen);
|
|
2210
|
+
const t = assistantCardText.in(lang);
|
|
2211
|
+
const answer = model.chosen.join(t.choiceJoin);
|
|
2212
|
+
const body = [header(t.choiceSent({ answer: clip(answer, TITLE_MAX) }), { tone: "good", emoji: "good" })];
|
|
2213
|
+
if (model.text) body.push(text(model.text, { subtle: true }));
|
|
2214
|
+
return message(body);
|
|
2215
|
+
}
|
|
2186
2216
|
var assistantRenderers = {
|
|
2187
2217
|
actionCard,
|
|
2218
|
+
choiceCard,
|
|
2219
|
+
choiceChosen,
|
|
2188
2220
|
board,
|
|
2189
2221
|
confirmWrite,
|
|
2190
2222
|
workCard,
|
|
@@ -6022,6 +6054,7 @@ import {
|
|
|
6022
6054
|
clientLocaleOf,
|
|
6023
6055
|
agentActionAllowed,
|
|
6024
6056
|
AssistantActions,
|
|
6057
|
+
AssistantChoiceClicks,
|
|
6025
6058
|
AssistantChatService,
|
|
6026
6059
|
Board,
|
|
6027
6060
|
commandArgs,
|
|
@@ -6297,7 +6330,8 @@ function assistantParts(base2, inputs) {
|
|
|
6297
6330
|
});
|
|
6298
6331
|
const watch = new WatchClicks({ store, claw: claw.workItems, exchange, logger });
|
|
6299
6332
|
const linked = (userId) => store.links.getKey(userId) !== null;
|
|
6300
|
-
const
|
|
6333
|
+
const choices = new AssistantChoiceClicks({ store, deliver: (message2) => hooks.typed(message2), logger });
|
|
6334
|
+
const clicks = [new WorkCardClicks(work, watch, exchange, linked, logger), actionClicks(actions), choices];
|
|
6301
6335
|
return { subs, chat: assistant, board: board2, receipts, directChat, actions, clicks };
|
|
6302
6336
|
}
|
|
6303
6337
|
|
|
@@ -6964,7 +6998,8 @@ function lateHooks(get3) {
|
|
|
6964
6998
|
const router = get3();
|
|
6965
6999
|
return router.commands.run(text4, router.chat(sender, conversation), key);
|
|
6966
7000
|
},
|
|
6967
|
-
background: (userId) => get3().ctx.credentials.background(userId)
|
|
7001
|
+
background: (userId) => get3().ctx.credentials.background(userId),
|
|
7002
|
+
typed: (message2) => get3().handle(message2)
|
|
6968
7003
|
};
|
|
6969
7004
|
}
|
|
6970
7005
|
function routerDeps(base2, built, errors) {
|
|
@@ -7355,6 +7390,7 @@ var workAction = reader("work");
|
|
|
7355
7390
|
var observeAction = reader("observe");
|
|
7356
7391
|
var assistantActionClick = reader("assistant_action");
|
|
7357
7392
|
var assistantConfirmClick = reader("assistant_confirm");
|
|
7393
|
+
var assistantChoiceClick = reader("assistant_choice");
|
|
7358
7394
|
var githubConfirmAction = reader("github_confirm");
|
|
7359
7395
|
var githubModeAction = reader("github_mode");
|
|
7360
7396
|
var githubConnectAction = reader("github_connect");
|
package/dist/main.js
CHANGED
|
@@ -3652,8 +3652,40 @@ function confirmWrite(model) {
|
|
|
3652
3652
|
buttons([button(model.allowLabel || t.confirm, "allow"), button(t.deny, "deny")])
|
|
3653
3653
|
);
|
|
3654
3654
|
}
|
|
3655
|
+
function choiceCard(model) {
|
|
3656
|
+
const lang = cardLang(model.lang, model.text, ...model.options);
|
|
3657
|
+
const t = assistantCardText.in(lang);
|
|
3658
|
+
const body = [
|
|
3659
|
+
header(model.multiple ? t.choiceTitleMany : t.choiceTitle, { tone: "accent", emoji: "question" })
|
|
3660
|
+
];
|
|
3661
|
+
if (model.text) body.push(text2(model.text));
|
|
3662
|
+
body.push({
|
|
3663
|
+
type: "Input.ChoiceSet",
|
|
3664
|
+
id: "choice",
|
|
3665
|
+
style: "expanded",
|
|
3666
|
+
isMultiSelect: model.multiple,
|
|
3667
|
+
choices: model.options.map((option, i) => ({ title: clip(option, LABEL_MAX), value: String(i) }))
|
|
3668
|
+
});
|
|
3669
|
+
if (model.note) body.push(text2(model.note, { weight: "Bolder" }));
|
|
3670
|
+
body.push(note(t.choiceTyped));
|
|
3671
|
+
const send = execute(t.choiceSend, "primusclaw.assistant_choice", {
|
|
3672
|
+
primusclaw: "assistant_choice",
|
|
3673
|
+
card: model.cardId
|
|
3674
|
+
});
|
|
3675
|
+
return message(body, buttons([send]));
|
|
3676
|
+
}
|
|
3677
|
+
function choiceChosen(model) {
|
|
3678
|
+
const lang = cardLang(model.lang, model.text, ...model.chosen);
|
|
3679
|
+
const t = assistantCardText.in(lang);
|
|
3680
|
+
const answer = model.chosen.join(t.choiceJoin);
|
|
3681
|
+
const body = [header(t.choiceSent({ answer: clip(answer, TITLE_MAX) }), { tone: "good", emoji: "good" })];
|
|
3682
|
+
if (model.text) body.push(text2(model.text, { subtle: true }));
|
|
3683
|
+
return message(body);
|
|
3684
|
+
}
|
|
3655
3685
|
var assistantRenderers = {
|
|
3656
3686
|
actionCard,
|
|
3687
|
+
choiceCard,
|
|
3688
|
+
choiceChosen,
|
|
3657
3689
|
board,
|
|
3658
3690
|
confirmWrite,
|
|
3659
3691
|
workCard,
|
|
@@ -5962,6 +5994,7 @@ import {
|
|
|
5962
5994
|
clientLocaleOf,
|
|
5963
5995
|
agentActionAllowed,
|
|
5964
5996
|
AssistantActions,
|
|
5997
|
+
AssistantChoiceClicks,
|
|
5965
5998
|
AssistantChatService,
|
|
5966
5999
|
Board,
|
|
5967
6000
|
commandArgs,
|
|
@@ -6237,7 +6270,8 @@ function assistantParts(base2, inputs) {
|
|
|
6237
6270
|
});
|
|
6238
6271
|
const watch = new WatchClicks({ store, claw: claw.workItems, exchange, logger });
|
|
6239
6272
|
const linked = (userId) => store.links.getKey(userId) !== null;
|
|
6240
|
-
const
|
|
6273
|
+
const choices = new AssistantChoiceClicks({ store, deliver: (message2) => hooks.typed(message2), logger });
|
|
6274
|
+
const clicks = [new WorkCardClicks(work, watch, exchange, linked, logger), actionClicks(actions), choices];
|
|
6241
6275
|
return { subs, chat: assistant, board: board2, receipts, directChat, actions, clicks };
|
|
6242
6276
|
}
|
|
6243
6277
|
|
|
@@ -6932,7 +6966,8 @@ function lateHooks(get3) {
|
|
|
6932
6966
|
const router = get3();
|
|
6933
6967
|
return router.commands.run(text4, router.chat(sender, conversation), key);
|
|
6934
6968
|
},
|
|
6935
|
-
background: (userId) => get3().ctx.credentials.background(userId)
|
|
6969
|
+
background: (userId) => get3().ctx.credentials.background(userId),
|
|
6970
|
+
typed: (message2) => get3().handle(message2)
|
|
6936
6971
|
};
|
|
6937
6972
|
}
|
|
6938
6973
|
function routerDeps(base2, built, errors) {
|
|
@@ -7323,6 +7358,7 @@ var workAction = reader("work");
|
|
|
7323
7358
|
var observeAction = reader("observe");
|
|
7324
7359
|
var assistantActionClick = reader("assistant_action");
|
|
7325
7360
|
var assistantConfirmClick = reader("assistant_confirm");
|
|
7361
|
+
var assistantChoiceClick = reader("assistant_choice");
|
|
7326
7362
|
var githubConfirmAction = reader("github_confirm");
|
|
7327
7363
|
var githubModeAction = reader("github_mode");
|
|
7328
7364
|
var githubConnectAction = reader("github_connect");
|
|
@@ -40,6 +40,8 @@ export declare const observeAction: Reader;
|
|
|
40
40
|
export declare const assistantActionClick: Reader;
|
|
41
41
|
/** A held write's card (allow or deny). */
|
|
42
42
|
export declare const assistantConfirmClick: Reader;
|
|
43
|
+
/** Send on a choice the assistant put to the person, with the places of the options picked. */
|
|
44
|
+
export declare const assistantChoiceClick: Reader;
|
|
43
45
|
/** "Merge" / "Do not merge" on the card a high-risk merge sends to the reviewer. */
|
|
44
46
|
export declare const githubConfirmAction: Reader;
|
|
45
47
|
/** One of the two confirmation settings of the review mode card. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* What the features behind the router are built from (the process's ports and settings), and the hooks into the router a
|
|
3
3
|
* feature needs once the router exists: the router is built from the features, and some features call back into it.
|
|
4
4
|
*/
|
|
5
|
-
import type { ClawPort, Clock, Logger, MetricsPort, Plugins, Random, RequestScope, SecurityLog, Settings, Surface, TokenExchange } from "@primusclaw/personal-agent";
|
|
5
|
+
import type { ClawPort, InboundMessage, Clock, Logger, MetricsPort, Plugins, Random, RequestScope, SecurityLog, Settings, Surface, TokenExchange } from "@primusclaw/personal-agent";
|
|
6
6
|
import type { ChatLog, SqliteStore } from "@primusclaw/personal-agent-runtime";
|
|
7
7
|
import type { TeamsSettings } from "../config/env.js";
|
|
8
8
|
export interface AssemblyBase {
|
|
@@ -41,6 +41,8 @@ export interface RouterHooks {
|
|
|
41
41
|
runCommand(text: string, sender: SenderOf, conversation: ConversationOf, key: string): Promise<boolean>;
|
|
42
42
|
/** What reads Claw for a person with nobody to ask (`Agent._background_credential`); undefined: none. */
|
|
43
43
|
background(userId: string): Promise<string | undefined>;
|
|
44
|
+
/** `message` handled as one the person typed (`Router.handle`): what a choice card's Send sends. */
|
|
45
|
+
typed(message: InboundMessage): Promise<void>;
|
|
44
46
|
}
|
|
45
47
|
type SenderOf = Parameters<import("@primusclaw/personal-agent").Router["chat"]>[0];
|
|
46
48
|
type ConversationOf = Parameters<import("@primusclaw/personal-agent").Router["chat"]>[1];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The assistant's cards (teams_agent/render.py work_button, work_buttons, work_card, work_done_card, note_card, board_buttons,
|
|
3
|
-
* board_card, asked_section, action_buttons, action_card, confirm_write_card). What they say is core's
|
|
3
|
+
* board_card, asked_section, action_buttons, action_card, confirm_write_card), and a choice put to the person. What they say is core's
|
|
4
4
|
* (`assistantCardText`, the work item helpers); this draws it on the card kit. The buttons carry only the id of the card the
|
|
5
5
|
* worker recorded: what a press means is read from the record, never from the click.
|
|
6
6
|
*/
|
|
7
|
-
import { type ActionCardModel, type BoardModel, type BoardRetry, type ConfirmWriteModel, type Lang, type ReviewAskedOfOther, type WorkCardModel, type WorkDoneModel, type WorkNoteModel } from "@primusclaw/personal-agent";
|
|
7
|
+
import { type ActionCardModel, type BoardModel, type BoardRetry, type ChoiceCardModel, type ChoiceChosenModel, type ConfirmWriteModel, type Lang, type ReviewAskedOfOther, type WorkCardModel, type WorkDoneModel, type WorkNoteModel } from "@primusclaw/personal-agent";
|
|
8
8
|
import type { CardElement } from "../../cards/json.js";
|
|
9
9
|
import type { Tone } from "../../cards/kit.js";
|
|
10
10
|
import type { TeamsMessage } from "../registry.js";
|
|
@@ -29,8 +29,18 @@ declare function board(model: BoardModel): TeamsMessage;
|
|
|
29
29
|
export declare function actionButtons(cardId: string, lang: string): CardElement[];
|
|
30
30
|
declare function actionCard(model: ActionCardModel): TeamsMessage;
|
|
31
31
|
declare function confirmWrite(model: ConfirmWriteModel): TeamsMessage;
|
|
32
|
+
/**
|
|
33
|
+
* A choice put to the person: the words (when the card holds them), the options as radio buttons (check boxes when several may be
|
|
34
|
+
* picked), and Send. Send carries the card's id and, as its input, the places of the options picked: what it sends is read from
|
|
35
|
+
* the record. The person may also just reply in the chat.
|
|
36
|
+
*/
|
|
37
|
+
declare function choiceCard(model: ChoiceCardModel): TeamsMessage;
|
|
38
|
+
/** What replaces a choice card once sent: what was sent, under the words it answered. */
|
|
39
|
+
declare function choiceChosen(model: ChoiceChosenModel): TeamsMessage;
|
|
32
40
|
export declare const assistantRenderers: {
|
|
33
41
|
actionCard: typeof actionCard;
|
|
42
|
+
choiceCard: typeof choiceCard;
|
|
43
|
+
choiceChosen: typeof choiceChosen;
|
|
34
44
|
board: typeof board;
|
|
35
45
|
confirmWrite: typeof confirmWrite;
|
|
36
46
|
workCard: typeof workCard;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primusclaw/personal-agent-teams",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.
|
|
39
|
-
"@primusclaw/personal-agent-runtime": "0.
|
|
38
|
+
"@primusclaw/personal-agent": "0.6.0",
|
|
39
|
+
"@primusclaw/personal-agent-runtime": "0.6.0",
|
|
40
40
|
"zod": "^4.6.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|