@primusclaw/personal-agent-teams 0.8.1 → 0.10.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 +118 -26
- package/dist/main.js +118 -26
- package/dist/types/activity/inbound/mentions.d.ts +3 -3
- package/dist/types/activity/inbound/to-event.d.ts +1 -1
- package/dist/types/assembly/worker.d.ts +1 -1
- package/dist/types/azure/keyvault-config.d.ts +5 -0
- package/dist/types/azure/keyvault.d.ts +3 -0
- package/dist/types/views/skills/index.d.ts +19 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3270,7 +3270,7 @@ import {
|
|
|
3270
3270
|
REVIEW_MODES,
|
|
3271
3271
|
githubConfirmButtons
|
|
3272
3272
|
} from "@primusclaw/personal-agent";
|
|
3273
|
-
import {
|
|
3273
|
+
import { own as own7 } from "@primusclaw/personal-agent";
|
|
3274
3274
|
var MARKDOWN = /([\\`*_[\]<])/gu;
|
|
3275
3275
|
function plain(value) {
|
|
3276
3276
|
return value.replace(MARKDOWN, "\\$1");
|
|
@@ -3281,13 +3281,13 @@ var MODE_WHAT = {
|
|
|
3281
3281
|
"Approved and merged when nothing needs fixing and every check passes; a change the reviewing model judges high risk (security, credentials, CI/release, permissions, data migrations, ...) or one the repository asks to confirm waits for your own click on a card."
|
|
3282
3282
|
],
|
|
3283
3283
|
fully_auto: [
|
|
3284
|
-
"\u5BA1\u5B8C\u6CA1\u6709\u95EE\u9898\u3001\u68C0\u67E5\u5168\u90E8\u901A\u8FC7\u65F6\u76F4\u63A5\u6279\u51C6\u5E76\u5408\u5165\uFF0C\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\uFF1B\u53EA\u6709\u4ED3\u5E93\u81EA\u5DF1\u8981\u6C42\u786E\u8BA4\u7684\u53D8\u66F4\uFF08.github/
|
|
3284
|
+
"\u5BA1\u5B8C\u6CA1\u6709\u95EE\u9898\u3001\u68C0\u67E5\u5168\u90E8\u901A\u8FC7\u65F6\u76F4\u63A5\u6279\u51C6\u5E76\u5408\u5165\uFF0C\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\uFF1B\u53EA\u6709\u4ED3\u5E93\u81EA\u5DF1\u8981\u6C42\u786E\u8BA4\u7684\u53D8\u66F4\uFF08.github/claw-review.yml \u7684 confirm_merge: always \u7B49\uFF09\u4ECD\u4F1A\u5148\u95EE\u4F60\u3002",
|
|
3285
3285
|
"Approved and merged when nothing needs fixing and every check passes, without asking you; only a change the repository itself requires a person for (confirm_merge: always in its review config, and the like) still waits for your click."
|
|
3286
3286
|
]
|
|
3287
3287
|
};
|
|
3288
3288
|
var MODE_BUTTON = { high_risk_confirm: "\u9AD8\u98CE\u9669\u518D\u95EE\u6211", fully_auto: "\u5168\u81EA\u52A8\u5408\u5165" };
|
|
3289
|
-
function addAppButton(installUrl) {
|
|
3290
|
-
return installUrl ? [openUrl(`\u6DFB\u52A0 ${
|
|
3289
|
+
function addAppButton(installUrl, bot) {
|
|
3290
|
+
return installUrl ? [openUrl(`\u6DFB\u52A0 ${bot}`, installUrl)] : [];
|
|
3291
3291
|
}
|
|
3292
3292
|
function reviewModeCard(model) {
|
|
3293
3293
|
const known = (mode) => Object.hasOwn(REVIEW_MODES, mode);
|
|
@@ -3313,12 +3313,12 @@ function reviewModeCard(model) {
|
|
|
3313
3313
|
}
|
|
3314
3314
|
body.push(
|
|
3315
3315
|
note(
|
|
3316
|
-
|
|
3316
|
+
`\u8FD9\u4E2A\u8BBE\u7F6E\u5BF9\u4F60\u81EA\u5DF1\u8BA9 ${model.bot} \u5BA1 PR\u3001\u4EE5\u53CA\u540C\u4E8B\u8BF7\u4F60\u4EE3\u5BA1\u90FD\u751F\u6548\u3002\u662F\u5426\u5141\u8BB8\u540C\u4E8B\u4EE5\u4F60\u7684\u540D\u4E49\u8BF7\u6211\u5BA1\u5E76\u5408\u5165\uFF0C\u662F\u53E6\u4E00\u4E2A\u5F00\u5173\uFF1A\`/github auto-merge on|off\`\u3002`
|
|
3317
3317
|
)
|
|
3318
3318
|
);
|
|
3319
3319
|
english.push(
|
|
3320
3320
|
text(
|
|
3321
|
-
|
|
3321
|
+
`This applies when you ask ${model.bot} to review a pull request and when a colleague asks ${model.bot} to review one as you. Whether colleagues may ask at all is the other switch, \`/github auto-merge on|off\`.`,
|
|
3322
3322
|
{ size: "Small" }
|
|
3323
3323
|
)
|
|
3324
3324
|
);
|
|
@@ -3327,7 +3327,7 @@ function reviewModeCard(model) {
|
|
|
3327
3327
|
const choices = order.map(
|
|
3328
3328
|
(m) => execute(own7(MODE_BUTTON, m) ?? m, "primusclaw.github_mode", { primusclaw: "github_mode", mode: m })
|
|
3329
3329
|
);
|
|
3330
|
-
return message(body, buttons([...choices, ...model.hint ? addAppButton(model.installUrl) : []]));
|
|
3330
|
+
return message(body, buttons([...choices, ...model.hint ? addAppButton(model.installUrl, model.bot) : []]));
|
|
3331
3331
|
}
|
|
3332
3332
|
function typedConfirmHint(number, lang) {
|
|
3333
3333
|
const n = clip(String(number), 10);
|
|
@@ -3443,7 +3443,7 @@ function githubConfirmCard(m) {
|
|
|
3443
3443
|
];
|
|
3444
3444
|
if (m.hint) body.push(note(typedConfirmHint(m.number, m.lang)));
|
|
3445
3445
|
const actions = buttons(githubConfirmButtons(m.confirmationId, m.review !== void 0, m.lang).map(action));
|
|
3446
|
-
return message(body, [...actions, ...m.hint ? addAppButton(m.installUrl) : []]);
|
|
3446
|
+
return message(body, [...actions, ...m.hint ? addAppButton(m.installUrl, m.bot) : []]);
|
|
3447
3447
|
}
|
|
3448
3448
|
function endedTone(ended) {
|
|
3449
3449
|
const low = ended.toLowerCase();
|
|
@@ -3581,6 +3581,72 @@ var REVIEW_RENDERERS = {
|
|
|
3581
3581
|
githubConnect: githubConnectCard
|
|
3582
3582
|
};
|
|
3583
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
|
+
|
|
3584
3650
|
// packages/teams/src/views/turn/index.ts
|
|
3585
3651
|
import { pyRstrip as pyRstrip2, turn as turn2 } from "@primusclaw/personal-agent";
|
|
3586
3652
|
|
|
@@ -3668,7 +3734,8 @@ var RENDERERS = {
|
|
|
3668
3734
|
...TURN_RENDERERS,
|
|
3669
3735
|
...REVIEW_RENDERERS,
|
|
3670
3736
|
...FEEDBACK_RENDERERS,
|
|
3671
|
-
...OBSERVE_RENDERERS
|
|
3737
|
+
...OBSERVE_RENDERERS,
|
|
3738
|
+
...skillRenderers
|
|
3672
3739
|
};
|
|
3673
3740
|
|
|
3674
3741
|
// packages/teams/src/assembly/worker.ts
|
|
@@ -4390,8 +4457,8 @@ function inboundLinksOf(activity) {
|
|
|
4390
4457
|
}
|
|
4391
4458
|
|
|
4392
4459
|
// packages/teams/src/activity/inbound/mentions.ts
|
|
4393
|
-
import { cpLength as cpLength7, pyLstrip as pyLstrip2, pyStr as pyStr10, pyStrip as pyStrip7 } from "@primusclaw/personal-agent";
|
|
4394
|
-
var DEFAULT_BOT_NAME =
|
|
4460
|
+
import { BOT_NAME, cpLength as cpLength7, pyLstrip as pyLstrip2, pyStr as pyStr10, pyStrip as pyStrip7 } from "@primusclaw/personal-agent";
|
|
4461
|
+
var DEFAULT_BOT_NAME = BOT_NAME;
|
|
4395
4462
|
function isMention(entity) {
|
|
4396
4463
|
return entity["type"] === "mention";
|
|
4397
4464
|
}
|
|
@@ -7227,6 +7294,11 @@ import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtim
|
|
|
7227
7294
|
var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
|
|
7228
7295
|
var KEYVAULT_API_VERSION = "7.4";
|
|
7229
7296
|
var VAULT_NAMES = {
|
|
7297
|
+
TEAMS_ENCRYPTION_KEYS: "personal-agent-encryption-keys",
|
|
7298
|
+
TEAMS_EXCHANGE_CLIENT_SECRET: "personal-agent-exchange-client-secret",
|
|
7299
|
+
FEEDBACK_GITHUB_APP_KEY: "personal-agent-feedback-github-app-key"
|
|
7300
|
+
};
|
|
7301
|
+
var LEGACY_VAULT_NAMES = {
|
|
7230
7302
|
TEAMS_ENCRYPTION_KEYS: "clawy-encryption-keys",
|
|
7231
7303
|
TEAMS_EXCHANGE_CLIENT_SECRET: "clawy-exchange-client-secret",
|
|
7232
7304
|
FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
|
|
@@ -7351,17 +7423,35 @@ var KeyVaultSecretSource = class {
|
|
|
7351
7423
|
} finally {
|
|
7352
7424
|
deadline.dispose();
|
|
7353
7425
|
}
|
|
7426
|
+
const legacy = names.filter((name) => values.get(name)?.from === LEGACY_VAULT_NAMES[name]);
|
|
7427
|
+
if (legacy.length) {
|
|
7428
|
+
this.logger.warn(
|
|
7429
|
+
`secrets: deprecated Key Vault secret names: ${legacy.map((n) => `${LEGACY_VAULT_NAMES[n]} (now ${VAULT_NAMES[n]})`).join(", ")}; they are still read when the new name is missing; store the secrets under the new names`
|
|
7430
|
+
);
|
|
7431
|
+
}
|
|
7354
7432
|
this.logger.info(
|
|
7355
|
-
`secrets: ${String(values.size)} read from Key Vault ${vaultHost(this.url)} as client ${this.credential.clientId} (${
|
|
7433
|
+
`secrets: ${String(values.size)} read from Key Vault ${vaultHost(this.url)} as client ${this.credential.clientId} (${[...values.values()].map((r) => r.from).join(", ")})`
|
|
7356
7434
|
);
|
|
7357
|
-
return values;
|
|
7435
|
+
return new Map([...values].map(([name, r]) => [name, r.value]));
|
|
7358
7436
|
}
|
|
7359
7437
|
async readAll(names, signal) {
|
|
7360
7438
|
const token = await this.token(signal);
|
|
7361
7439
|
const values = /* @__PURE__ */ new Map();
|
|
7362
|
-
for (const name of names) values.set(name, await this.
|
|
7440
|
+
for (const name of names) values.set(name, await this.readSecret(name, token, signal));
|
|
7363
7441
|
return values;
|
|
7364
7442
|
}
|
|
7443
|
+
/** A secret under its name, else (the vault has no such entry) under its deprecated name; never written under either. */
|
|
7444
|
+
async readSecret(name, token, signal) {
|
|
7445
|
+
const current = VAULT_NAMES[name];
|
|
7446
|
+
const legacy = LEGACY_VAULT_NAMES[name];
|
|
7447
|
+
const found = await this.read(current, token, signal);
|
|
7448
|
+
if (typeof found === "string") return { value: found, from: current };
|
|
7449
|
+
const old = await this.read(legacy, token, signal);
|
|
7450
|
+
if (typeof old === "string") return { value: old, from: legacy };
|
|
7451
|
+
throw new SecretsUnavailable2(
|
|
7452
|
+
`Key Vault secret ${current}: ${found.missing} (nor under its deprecated name ${legacy})`
|
|
7453
|
+
);
|
|
7454
|
+
}
|
|
7365
7455
|
async token(signal) {
|
|
7366
7456
|
for (let attempt2 = 1; ; attempt2++) {
|
|
7367
7457
|
try {
|
|
@@ -7380,11 +7470,13 @@ var KeyVaultSecretSource = class {
|
|
|
7380
7470
|
await this.sleep(BACKOFF_MS2 * 2 ** (attempt2 - 1), signal);
|
|
7381
7471
|
}
|
|
7382
7472
|
}
|
|
7473
|
+
/** `name`'s value, or why not when the vault has no such secret (it answered 404). */
|
|
7383
7474
|
async read(name, token, signal) {
|
|
7384
7475
|
const target = `${this.url}/secrets/${pyQuote(name, "")}?api-version=${KEYVAULT_API_VERSION}`;
|
|
7385
7476
|
for (let attempt2 = 1; ; attempt2++) {
|
|
7386
7477
|
const answer = await this.readOnce(target, name, token, signal);
|
|
7387
7478
|
if ("value" in answer) return answer.value;
|
|
7479
|
+
if (answer.missing) return { missing: answer.reason };
|
|
7388
7480
|
if (!answer.transient || attempt2 === ATTEMPTS) {
|
|
7389
7481
|
throw new SecretsUnavailable2(`Key Vault secret ${name}: ${answer.reason}`);
|
|
7390
7482
|
}
|
|
@@ -7407,14 +7499,15 @@ var KeyVaultSecretSource = class {
|
|
|
7407
7499
|
status = response.status;
|
|
7408
7500
|
text4 = await response.text();
|
|
7409
7501
|
} catch (error) {
|
|
7410
|
-
return { reason: `Key Vault unreachable (${errorName8(error)})`, transient: true };
|
|
7502
|
+
return { reason: `Key Vault unreachable (${errorName8(error)})`, transient: true, missing: false };
|
|
7411
7503
|
} finally {
|
|
7412
7504
|
timer.dispose();
|
|
7413
7505
|
}
|
|
7414
7506
|
if (status === 200) return { value: secretValue(name, text4) };
|
|
7415
7507
|
return {
|
|
7416
7508
|
reason: `Key Vault answered ${String(status)}${vaultErrorCode(text4)}`,
|
|
7417
|
-
transient: status === 429 || status >= 500
|
|
7509
|
+
transient: status === 429 || status >= 500,
|
|
7510
|
+
missing: status === 404
|
|
7418
7511
|
};
|
|
7419
7512
|
}
|
|
7420
7513
|
};
|
|
@@ -7451,7 +7544,6 @@ async function loadSecrets(env, deps) {
|
|
|
7451
7544
|
}
|
|
7452
7545
|
|
|
7453
7546
|
// packages/teams/src/assembly/worker.ts
|
|
7454
|
-
var BOT_NAME2 = "Clawy";
|
|
7455
7547
|
function conversationTypeOf(kind) {
|
|
7456
7548
|
if (kind === "personal") return "personal";
|
|
7457
7549
|
return kind === "group" ? "groupChat" : "channel";
|
|
@@ -7498,10 +7590,10 @@ function teamsShape(teams) {
|
|
|
7498
7590
|
version: teamsVersion()
|
|
7499
7591
|
};
|
|
7500
7592
|
}
|
|
7501
|
-
function teamsTypedEvent(logger) {
|
|
7593
|
+
function teamsTypedEvent(botName, logger) {
|
|
7502
7594
|
return (conversation, messageId, text4) => {
|
|
7503
7595
|
const activity = { ...activityOfReference(conversation.wire, messageId), text: text4 };
|
|
7504
|
-
const read = toInboundEvent(activity, { botName
|
|
7596
|
+
const read = toInboundEvent(activity, { botName, logger });
|
|
7505
7597
|
return read.ok ? read.value : void 0;
|
|
7506
7598
|
};
|
|
7507
7599
|
}
|
|
@@ -7535,11 +7627,11 @@ function surfaceOf(teams, outbound, gate, deps) {
|
|
|
7535
7627
|
return { acks, surface };
|
|
7536
7628
|
}
|
|
7537
7629
|
function connect(teams, parts, context) {
|
|
7538
|
-
const { acks, inbound: inbound2, gate } = parts;
|
|
7630
|
+
const { botName, acks, inbound: inbound2, gate } = parts;
|
|
7539
7631
|
const handle = inboundHandler({
|
|
7540
7632
|
acks,
|
|
7541
7633
|
route: context.route,
|
|
7542
|
-
botName
|
|
7634
|
+
botName,
|
|
7543
7635
|
logger: context.logger,
|
|
7544
7636
|
groupContext: context.groupContext
|
|
7545
7637
|
});
|
|
@@ -7569,13 +7661,13 @@ function connect(teams, parts, context) {
|
|
|
7569
7661
|
});
|
|
7570
7662
|
return { routes, source };
|
|
7571
7663
|
}
|
|
7572
|
-
function opened(teams, gate, deps) {
|
|
7664
|
+
function opened(teams, botName, gate, deps) {
|
|
7573
7665
|
const { outbound, inbound: inbound2 } = transport(teams, gate, deps);
|
|
7574
7666
|
const { acks, surface } = surfaceOf(teams, outbound, gate, deps);
|
|
7575
7667
|
return {
|
|
7576
7668
|
surface,
|
|
7577
|
-
typedEvent: teamsTypedEvent(deps.logger),
|
|
7578
|
-
connect: (context) => connect(teams, { acks, inbound: inbound2, gate }, context),
|
|
7669
|
+
typedEvent: teamsTypedEvent(botName, deps.logger),
|
|
7670
|
+
connect: (context) => connect(teams, { botName, acks, inbound: inbound2, gate }, context),
|
|
7579
7671
|
closes: [() => outbound.close(), () => inbound2?.close()]
|
|
7580
7672
|
};
|
|
7581
7673
|
}
|
|
@@ -7586,12 +7678,12 @@ function teamsSurface() {
|
|
|
7586
7678
|
const gate = gateEntryFromEnv(env);
|
|
7587
7679
|
return {
|
|
7588
7680
|
loadSecrets: (_names, deps) => loadSecrets(env, deps),
|
|
7589
|
-
configure() {
|
|
7681
|
+
configure(settings) {
|
|
7590
7682
|
const teams = teamsSettingsFromEnv(env, { queues: gate === void 0 });
|
|
7591
7683
|
return {
|
|
7592
7684
|
host: gate === void 0 ? "0.0.0.0" : LOOPBACK,
|
|
7593
7685
|
shape: teamsShape(teams),
|
|
7594
|
-
open: (deps) => opened(teams, gate, deps)
|
|
7686
|
+
open: (deps) => opened(teams, settings.botName, gate, deps)
|
|
7595
7687
|
};
|
|
7596
7688
|
}
|
|
7597
7689
|
};
|
package/dist/main.js
CHANGED
|
@@ -721,8 +721,8 @@ function inboundLinksOf(activity) {
|
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
// packages/teams/src/activity/inbound/mentions.ts
|
|
724
|
-
import { cpLength as cpLength2, pyLstrip, pyStr as pyStr7, pyStrip as pyStrip4 } from "@primusclaw/personal-agent";
|
|
725
|
-
var DEFAULT_BOT_NAME =
|
|
724
|
+
import { BOT_NAME, cpLength as cpLength2, pyLstrip, pyStr as pyStr7, pyStrip as pyStrip4 } from "@primusclaw/personal-agent";
|
|
725
|
+
var DEFAULT_BOT_NAME = BOT_NAME;
|
|
726
726
|
function isMention(entity) {
|
|
727
727
|
return entity["type"] === "mention";
|
|
728
728
|
}
|
|
@@ -5781,7 +5781,7 @@ import {
|
|
|
5781
5781
|
REVIEW_MODES,
|
|
5782
5782
|
githubConfirmButtons
|
|
5783
5783
|
} from "@primusclaw/personal-agent";
|
|
5784
|
-
import {
|
|
5784
|
+
import { own as own11 } from "@primusclaw/personal-agent";
|
|
5785
5785
|
var MARKDOWN = /([\\`*_[\]<])/gu;
|
|
5786
5786
|
function plain(value) {
|
|
5787
5787
|
return value.replace(MARKDOWN, "\\$1");
|
|
@@ -5792,13 +5792,13 @@ var MODE_WHAT = {
|
|
|
5792
5792
|
"Approved and merged when nothing needs fixing and every check passes; a change the reviewing model judges high risk (security, credentials, CI/release, permissions, data migrations, ...) or one the repository asks to confirm waits for your own click on a card."
|
|
5793
5793
|
],
|
|
5794
5794
|
fully_auto: [
|
|
5795
|
-
"\u5BA1\u5B8C\u6CA1\u6709\u95EE\u9898\u3001\u68C0\u67E5\u5168\u90E8\u901A\u8FC7\u65F6\u76F4\u63A5\u6279\u51C6\u5E76\u5408\u5165\uFF0C\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\uFF1B\u53EA\u6709\u4ED3\u5E93\u81EA\u5DF1\u8981\u6C42\u786E\u8BA4\u7684\u53D8\u66F4\uFF08.github/
|
|
5795
|
+
"\u5BA1\u5B8C\u6CA1\u6709\u95EE\u9898\u3001\u68C0\u67E5\u5168\u90E8\u901A\u8FC7\u65F6\u76F4\u63A5\u6279\u51C6\u5E76\u5408\u5165\uFF0C\u4E0D\u518D\u8BF7\u4F60\u786E\u8BA4\uFF1B\u53EA\u6709\u4ED3\u5E93\u81EA\u5DF1\u8981\u6C42\u786E\u8BA4\u7684\u53D8\u66F4\uFF08.github/claw-review.yml \u7684 confirm_merge: always \u7B49\uFF09\u4ECD\u4F1A\u5148\u95EE\u4F60\u3002",
|
|
5796
5796
|
"Approved and merged when nothing needs fixing and every check passes, without asking you; only a change the repository itself requires a person for (confirm_merge: always in its review config, and the like) still waits for your click."
|
|
5797
5797
|
]
|
|
5798
5798
|
};
|
|
5799
5799
|
var MODE_BUTTON = { high_risk_confirm: "\u9AD8\u98CE\u9669\u518D\u95EE\u6211", fully_auto: "\u5168\u81EA\u52A8\u5408\u5165" };
|
|
5800
|
-
function addAppButton(installUrl) {
|
|
5801
|
-
return installUrl ? [openUrl(`\u6DFB\u52A0 ${
|
|
5800
|
+
function addAppButton(installUrl, bot) {
|
|
5801
|
+
return installUrl ? [openUrl(`\u6DFB\u52A0 ${bot}`, installUrl)] : [];
|
|
5802
5802
|
}
|
|
5803
5803
|
function reviewModeCard(model) {
|
|
5804
5804
|
const known = (mode) => Object.hasOwn(REVIEW_MODES, mode);
|
|
@@ -5824,12 +5824,12 @@ function reviewModeCard(model) {
|
|
|
5824
5824
|
}
|
|
5825
5825
|
body.push(
|
|
5826
5826
|
note(
|
|
5827
|
-
|
|
5827
|
+
`\u8FD9\u4E2A\u8BBE\u7F6E\u5BF9\u4F60\u81EA\u5DF1\u8BA9 ${model.bot} \u5BA1 PR\u3001\u4EE5\u53CA\u540C\u4E8B\u8BF7\u4F60\u4EE3\u5BA1\u90FD\u751F\u6548\u3002\u662F\u5426\u5141\u8BB8\u540C\u4E8B\u4EE5\u4F60\u7684\u540D\u4E49\u8BF7\u6211\u5BA1\u5E76\u5408\u5165\uFF0C\u662F\u53E6\u4E00\u4E2A\u5F00\u5173\uFF1A\`/github auto-merge on|off\`\u3002`
|
|
5828
5828
|
)
|
|
5829
5829
|
);
|
|
5830
5830
|
english.push(
|
|
5831
5831
|
text2(
|
|
5832
|
-
|
|
5832
|
+
`This applies when you ask ${model.bot} to review a pull request and when a colleague asks ${model.bot} to review one as you. Whether colleagues may ask at all is the other switch, \`/github auto-merge on|off\`.`,
|
|
5833
5833
|
{ size: "Small" }
|
|
5834
5834
|
)
|
|
5835
5835
|
);
|
|
@@ -5838,7 +5838,7 @@ function reviewModeCard(model) {
|
|
|
5838
5838
|
const choices = order.map(
|
|
5839
5839
|
(m) => execute(own11(MODE_BUTTON, m) ?? m, "primusclaw.github_mode", { primusclaw: "github_mode", mode: m })
|
|
5840
5840
|
);
|
|
5841
|
-
return message(body, buttons([...choices, ...model.hint ? addAppButton(model.installUrl) : []]));
|
|
5841
|
+
return message(body, buttons([...choices, ...model.hint ? addAppButton(model.installUrl, model.bot) : []]));
|
|
5842
5842
|
}
|
|
5843
5843
|
function typedConfirmHint(number, lang) {
|
|
5844
5844
|
const n = clip(String(number), 10);
|
|
@@ -5954,7 +5954,7 @@ function githubConfirmCard(m) {
|
|
|
5954
5954
|
];
|
|
5955
5955
|
if (m.hint) body.push(note(typedConfirmHint(m.number, m.lang)));
|
|
5956
5956
|
const actions = buttons(githubConfirmButtons(m.confirmationId, m.review !== void 0, m.lang).map(action));
|
|
5957
|
-
return message(body, [...actions, ...m.hint ? addAppButton(m.installUrl) : []]);
|
|
5957
|
+
return message(body, [...actions, ...m.hint ? addAppButton(m.installUrl, m.bot) : []]);
|
|
5958
5958
|
}
|
|
5959
5959
|
function endedTone(ended) {
|
|
5960
5960
|
const low = ended.toLowerCase();
|
|
@@ -6092,6 +6092,72 @@ var REVIEW_RENDERERS = {
|
|
|
6092
6092
|
githubConnect: githubConnectCard
|
|
6093
6093
|
};
|
|
6094
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
|
+
|
|
6095
6161
|
// packages/teams/src/views/turn/index.ts
|
|
6096
6162
|
import { pyRstrip as pyRstrip5, turn as turn2 } from "@primusclaw/personal-agent";
|
|
6097
6163
|
|
|
@@ -6179,7 +6245,8 @@ var RENDERERS = {
|
|
|
6179
6245
|
...TURN_RENDERERS,
|
|
6180
6246
|
...REVIEW_RENDERERS,
|
|
6181
6247
|
...FEEDBACK_RENDERERS,
|
|
6182
|
-
...OBSERVE_RENDERERS
|
|
6248
|
+
...OBSERVE_RENDERERS,
|
|
6249
|
+
...skillRenderers
|
|
6183
6250
|
};
|
|
6184
6251
|
|
|
6185
6252
|
// packages/teams/src/assembly/inbound.ts
|
|
@@ -7196,6 +7263,11 @@ import { SETTING_ALIASES, settingValue } from "@primusclaw/personal-agent-runtim
|
|
|
7196
7263
|
var KEYVAULT_SCOPE = "https://vault.azure.net/.default";
|
|
7197
7264
|
var KEYVAULT_API_VERSION = "7.4";
|
|
7198
7265
|
var VAULT_NAMES = {
|
|
7266
|
+
TEAMS_ENCRYPTION_KEYS: "personal-agent-encryption-keys",
|
|
7267
|
+
TEAMS_EXCHANGE_CLIENT_SECRET: "personal-agent-exchange-client-secret",
|
|
7268
|
+
FEEDBACK_GITHUB_APP_KEY: "personal-agent-feedback-github-app-key"
|
|
7269
|
+
};
|
|
7270
|
+
var LEGACY_VAULT_NAMES = {
|
|
7199
7271
|
TEAMS_ENCRYPTION_KEYS: "clawy-encryption-keys",
|
|
7200
7272
|
TEAMS_EXCHANGE_CLIENT_SECRET: "clawy-exchange-client-secret",
|
|
7201
7273
|
FEEDBACK_GITHUB_APP_KEY: "clawy-feedback-github-app-key"
|
|
@@ -7320,17 +7392,35 @@ var KeyVaultSecretSource = class {
|
|
|
7320
7392
|
} finally {
|
|
7321
7393
|
deadline.dispose();
|
|
7322
7394
|
}
|
|
7395
|
+
const legacy = names.filter((name) => values.get(name)?.from === LEGACY_VAULT_NAMES[name]);
|
|
7396
|
+
if (legacy.length) {
|
|
7397
|
+
this.logger.warn(
|
|
7398
|
+
`secrets: deprecated Key Vault secret names: ${legacy.map((n) => `${LEGACY_VAULT_NAMES[n]} (now ${VAULT_NAMES[n]})`).join(", ")}; they are still read when the new name is missing; store the secrets under the new names`
|
|
7399
|
+
);
|
|
7400
|
+
}
|
|
7323
7401
|
this.logger.info(
|
|
7324
|
-
`secrets: ${String(values.size)} read from Key Vault ${vaultHost(this.url)} as client ${this.credential.clientId} (${
|
|
7402
|
+
`secrets: ${String(values.size)} read from Key Vault ${vaultHost(this.url)} as client ${this.credential.clientId} (${[...values.values()].map((r) => r.from).join(", ")})`
|
|
7325
7403
|
);
|
|
7326
|
-
return values;
|
|
7404
|
+
return new Map([...values].map(([name, r]) => [name, r.value]));
|
|
7327
7405
|
}
|
|
7328
7406
|
async readAll(names, signal) {
|
|
7329
7407
|
const token = await this.token(signal);
|
|
7330
7408
|
const values = /* @__PURE__ */ new Map();
|
|
7331
|
-
for (const name of names) values.set(name, await this.
|
|
7409
|
+
for (const name of names) values.set(name, await this.readSecret(name, token, signal));
|
|
7332
7410
|
return values;
|
|
7333
7411
|
}
|
|
7412
|
+
/** A secret under its name, else (the vault has no such entry) under its deprecated name; never written under either. */
|
|
7413
|
+
async readSecret(name, token, signal) {
|
|
7414
|
+
const current = VAULT_NAMES[name];
|
|
7415
|
+
const legacy = LEGACY_VAULT_NAMES[name];
|
|
7416
|
+
const found = await this.read(current, token, signal);
|
|
7417
|
+
if (typeof found === "string") return { value: found, from: current };
|
|
7418
|
+
const old = await this.read(legacy, token, signal);
|
|
7419
|
+
if (typeof old === "string") return { value: old, from: legacy };
|
|
7420
|
+
throw new SecretsUnavailable2(
|
|
7421
|
+
`Key Vault secret ${current}: ${found.missing} (nor under its deprecated name ${legacy})`
|
|
7422
|
+
);
|
|
7423
|
+
}
|
|
7334
7424
|
async token(signal) {
|
|
7335
7425
|
for (let attempt2 = 1; ; attempt2++) {
|
|
7336
7426
|
try {
|
|
@@ -7349,11 +7439,13 @@ var KeyVaultSecretSource = class {
|
|
|
7349
7439
|
await this.sleep(BACKOFF_MS2 * 2 ** (attempt2 - 1), signal);
|
|
7350
7440
|
}
|
|
7351
7441
|
}
|
|
7442
|
+
/** `name`'s value, or why not when the vault has no such secret (it answered 404). */
|
|
7352
7443
|
async read(name, token, signal) {
|
|
7353
7444
|
const target = `${this.url}/secrets/${pyQuote(name, "")}?api-version=${KEYVAULT_API_VERSION}`;
|
|
7354
7445
|
for (let attempt2 = 1; ; attempt2++) {
|
|
7355
7446
|
const answer = await this.readOnce(target, name, token, signal);
|
|
7356
7447
|
if ("value" in answer) return answer.value;
|
|
7448
|
+
if (answer.missing) return { missing: answer.reason };
|
|
7357
7449
|
if (!answer.transient || attempt2 === ATTEMPTS) {
|
|
7358
7450
|
throw new SecretsUnavailable2(`Key Vault secret ${name}: ${answer.reason}`);
|
|
7359
7451
|
}
|
|
@@ -7376,14 +7468,15 @@ var KeyVaultSecretSource = class {
|
|
|
7376
7468
|
status = response.status;
|
|
7377
7469
|
text4 = await response.text();
|
|
7378
7470
|
} catch (error) {
|
|
7379
|
-
return { reason: `Key Vault unreachable (${errorName8(error)})`, transient: true };
|
|
7471
|
+
return { reason: `Key Vault unreachable (${errorName8(error)})`, transient: true, missing: false };
|
|
7380
7472
|
} finally {
|
|
7381
7473
|
timer.dispose();
|
|
7382
7474
|
}
|
|
7383
7475
|
if (status === 200) return { value: secretValue(name, text4) };
|
|
7384
7476
|
return {
|
|
7385
7477
|
reason: `Key Vault answered ${String(status)}${vaultErrorCode(text4)}`,
|
|
7386
|
-
transient: status === 429 || status >= 500
|
|
7478
|
+
transient: status === 429 || status >= 500,
|
|
7479
|
+
missing: status === 404
|
|
7387
7480
|
};
|
|
7388
7481
|
}
|
|
7389
7482
|
};
|
|
@@ -7420,7 +7513,6 @@ async function loadSecrets(env, deps) {
|
|
|
7420
7513
|
}
|
|
7421
7514
|
|
|
7422
7515
|
// packages/teams/src/assembly/worker.ts
|
|
7423
|
-
var BOT_NAME2 = "Clawy";
|
|
7424
7516
|
function conversationTypeOf(kind) {
|
|
7425
7517
|
if (kind === "personal") return "personal";
|
|
7426
7518
|
return kind === "group" ? "groupChat" : "channel";
|
|
@@ -7467,10 +7559,10 @@ function teamsShape(teams) {
|
|
|
7467
7559
|
version: teamsVersion()
|
|
7468
7560
|
};
|
|
7469
7561
|
}
|
|
7470
|
-
function teamsTypedEvent(logger) {
|
|
7562
|
+
function teamsTypedEvent(botName, logger) {
|
|
7471
7563
|
return (conversation, messageId, text4) => {
|
|
7472
7564
|
const activity = { ...activityOfReference(conversation.wire, messageId), text: text4 };
|
|
7473
|
-
const read = toInboundEvent(activity, { botName
|
|
7565
|
+
const read = toInboundEvent(activity, { botName, logger });
|
|
7474
7566
|
return read.ok ? read.value : void 0;
|
|
7475
7567
|
};
|
|
7476
7568
|
}
|
|
@@ -7504,11 +7596,11 @@ function surfaceOf(teams, outbound, gate, deps) {
|
|
|
7504
7596
|
return { acks, surface };
|
|
7505
7597
|
}
|
|
7506
7598
|
function connect(teams, parts, context) {
|
|
7507
|
-
const { acks, inbound: inbound2, gate } = parts;
|
|
7599
|
+
const { botName, acks, inbound: inbound2, gate } = parts;
|
|
7508
7600
|
const handle = inboundHandler({
|
|
7509
7601
|
acks,
|
|
7510
7602
|
route: context.route,
|
|
7511
|
-
botName
|
|
7603
|
+
botName,
|
|
7512
7604
|
logger: context.logger,
|
|
7513
7605
|
groupContext: context.groupContext
|
|
7514
7606
|
});
|
|
@@ -7538,13 +7630,13 @@ function connect(teams, parts, context) {
|
|
|
7538
7630
|
});
|
|
7539
7631
|
return { routes, source };
|
|
7540
7632
|
}
|
|
7541
|
-
function opened(teams, gate, deps) {
|
|
7633
|
+
function opened(teams, botName, gate, deps) {
|
|
7542
7634
|
const { outbound, inbound: inbound2 } = transport(teams, gate, deps);
|
|
7543
7635
|
const { acks, surface } = surfaceOf(teams, outbound, gate, deps);
|
|
7544
7636
|
return {
|
|
7545
7637
|
surface,
|
|
7546
|
-
typedEvent: teamsTypedEvent(deps.logger),
|
|
7547
|
-
connect: (context) => connect(teams, { acks, inbound: inbound2, gate }, context),
|
|
7638
|
+
typedEvent: teamsTypedEvent(botName, deps.logger),
|
|
7639
|
+
connect: (context) => connect(teams, { botName, acks, inbound: inbound2, gate }, context),
|
|
7548
7640
|
closes: [() => outbound.close(), () => inbound2?.close()]
|
|
7549
7641
|
};
|
|
7550
7642
|
}
|
|
@@ -7555,12 +7647,12 @@ function teamsSurface() {
|
|
|
7555
7647
|
const gate = gateEntryFromEnv(env);
|
|
7556
7648
|
return {
|
|
7557
7649
|
loadSecrets: (_names, deps) => loadSecrets(env, deps),
|
|
7558
|
-
configure() {
|
|
7650
|
+
configure(settings) {
|
|
7559
7651
|
const teams = teamsSettingsFromEnv(env, { queues: gate === void 0 });
|
|
7560
7652
|
return {
|
|
7561
7653
|
host: gate === void 0 ? "0.0.0.0" : LOOPBACK,
|
|
7562
7654
|
shape: teamsShape(teams),
|
|
7563
|
-
open: (deps) => opened(teams, gate, deps)
|
|
7655
|
+
open: (deps) => opened(teams, settings.botName, gate, deps)
|
|
7564
7656
|
};
|
|
7565
7657
|
}
|
|
7566
7658
|
};
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { InboundMention } from "@primusclaw/personal-agent";
|
|
8
8
|
import { type Activity, type Fields } from "./schema.js";
|
|
9
|
-
/** The bot's display name where the caller gives none (
|
|
10
|
-
export declare const DEFAULT_BOT_NAME = "
|
|
9
|
+
/** The bot's display name where the caller gives none: core's default (a deployment's own is `Settings.botName`). */
|
|
10
|
+
export declare const DEFAULT_BOT_NAME = "PrimusClaw Assistant";
|
|
11
11
|
/** Whether `entity` is a mention of the bot (`botId` its id here; never when the id is unknown). */
|
|
12
12
|
export declare function mentionsBot(entity: Fields, botId: string): boolean;
|
|
13
13
|
/** True when the bot itself is @mentioned (a mention of another person does not count). */
|
|
@@ -18,7 +18,7 @@ export declare function isMentioned(activity: Activity): boolean;
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function isTargeted(activity: Activity): boolean;
|
|
20
20
|
/**
|
|
21
|
-
* True when the message starts by naming the bot ("
|
|
21
|
+
* True when the message starts by naming the bot ("@<name> ...", the deployment's name): in a 1:1 chat attached to a remote session, the way
|
|
22
22
|
* the person says these words are for the bot and not for the session.
|
|
23
23
|
*/
|
|
24
24
|
export declare function addressedToBot(activity: Activity, botName?: string): boolean;
|
|
@@ -7,7 +7,7 @@ export interface NoSender {
|
|
|
7
7
|
readonly kind: "no_sender";
|
|
8
8
|
}
|
|
9
9
|
export interface ToEventOptions {
|
|
10
|
-
/** The bot's display name, for "@<name> ..." (default
|
|
10
|
+
/** The bot's display name, for "@<name> ..." (the deployment's `Settings.botName`; default `BOT_NAME`). */
|
|
11
11
|
readonly botName?: string;
|
|
12
12
|
readonly logger?: Logger;
|
|
13
13
|
}
|
|
@@ -22,7 +22,7 @@ export declare function teamsShape(teams: Pick<TeamsSettings, "style" | "install
|
|
|
22
22
|
* `text` as the activity Teams would have sent for the person's own message `messageId` in a stored conversation, read as
|
|
23
23
|
* core's event (what a plugin's `handleAsTyped` hands the router); undefined when it cannot be read.
|
|
24
24
|
*/
|
|
25
|
-
export declare function teamsTypedEvent(logger: Logger): OpenedSurface["typedEvent"];
|
|
25
|
+
export declare function teamsTypedEvent(botName: string, logger: Logger): OpenedSurface["typedEvent"];
|
|
26
26
|
/**
|
|
27
27
|
* The Teams surface: the release gate's test entry is read first (TEAMS_GATE_ENTRY), the secrets come from where
|
|
28
28
|
* SECRETS_SOURCE says (the environment or Azure Key Vault), and the Teams settings are read after core's.
|
|
@@ -9,6 +9,11 @@ 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
|
+
/**
|
|
13
|
+
* The name each secret was stored under before the bot's default name changed. Deprecated: it is read only when the vault
|
|
14
|
+
* holds no secret under the `VAULT_NAMES` name (with a warning at start), and never written.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LEGACY_VAULT_NAMES: Readonly<Record<SecretName, string>>;
|
|
12
17
|
/**
|
|
13
18
|
* What the environment holds for each secret with SECRETS_SOURCE=env (the GitHub App key is a mounted file); the older
|
|
14
19
|
* `TEAMS_` name of a `PA_` one is read too.
|
|
@@ -37,7 +37,10 @@ export declare class KeyVaultSecretSource implements SecretSource {
|
|
|
37
37
|
constructor(url: string, credential: VaultCredential, options: KeyVaultOptions);
|
|
38
38
|
load(names: readonly SecretName[]): Promise<ReadonlyMap<SecretName, string>>;
|
|
39
39
|
private readAll;
|
|
40
|
+
/** A secret under its name, else (the vault has no such entry) under its deprecated name; never written under either. */
|
|
41
|
+
private readSecret;
|
|
40
42
|
private token;
|
|
43
|
+
/** `name`'s value, or why not when the vault has no such secret (it answered 404). */
|
|
41
44
|
private read;
|
|
42
45
|
private readOnce;
|
|
43
46
|
}
|
|
@@ -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.
|
|
3
|
+
"version": "0.10.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.
|
|
39
|
-
"@primusclaw/personal-agent-runtime": "0.
|
|
38
|
+
"@primusclaw/personal-agent": "0.10.0",
|
|
39
|
+
"@primusclaw/personal-agent-runtime": "0.10.0",
|
|
40
40
|
"zod": "^4.6.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|