@primusclaw/personal-agent 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 +490 -19
- package/dist/types/assistant/chat.d.ts +1 -1
- package/dist/types/assistant/confirm-outcome.d.ts +2 -0
- package/dist/types/assistant/events.d.ts +28 -1
- package/dist/types/assistant/say.d.ts +9 -2
- package/dist/types/commands/names.d.ts +1 -1
- package/dist/types/config/settings.d.ts +25 -25
- package/dist/types/direct-chat/direct-chat.d.ts +1 -1
- package/dist/types/group-context/buffer.d.ts +1 -1
- package/dist/types/guardrails/operations.d.ts +20 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/limits/user-limits.d.ts +3 -3
- package/dist/types/locales/index.d.ts +1 -0
- package/dist/types/locales/skills.d.ts +105 -0
- package/dist/types/locales/transparency.d.ts +1 -1
- package/dist/types/observe/observer.d.ts +1 -1
- package/dist/types/ports/claw/index.d.ts +4 -0
- package/dist/types/ports/claw/skills.d.ts +52 -0
- package/dist/types/ports/secret-source.d.ts +3 -2
- package/dist/types/ports/store/policy.d.ts +3 -3
- package/dist/types/protocol/claw-api/assistant-events.d.ts +47 -2
- package/dist/types/remote/context.d.ts +1 -1
- package/dist/types/remote/follow/control.d.ts +1 -1
- package/dist/types/remote/state.d.ts +1 -1
- package/dist/types/routing/credentials.d.ts +1 -1
- package/dist/types/routing/deps.d.ts +1 -1
- package/dist/types/skills/card.d.ts +4 -0
- package/dist/types/skills/clicks.d.ts +24 -0
- package/dist/types/skills/command.d.ts +22 -0
- package/dist/types/skills/index.d.ts +5 -0
- package/dist/types/skills/views.d.ts +43 -0
- package/dist/types/subscriptions/subscriptions.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -752,7 +752,8 @@ var PERSONAL_ONLY_COMMANDS = [
|
|
|
752
752
|
"agents",
|
|
753
753
|
"agent",
|
|
754
754
|
"lang",
|
|
755
|
-
"approvals"
|
|
755
|
+
"approvals",
|
|
756
|
+
"skills"
|
|
756
757
|
];
|
|
757
758
|
var ARGUMENT_COMMANDS = ["feedback"];
|
|
758
759
|
function within(list2, name) {
|
|
@@ -2328,6 +2329,7 @@ var DEFAULT_LIMITS = {
|
|
|
2328
2329
|
remote_agent: { count: 10, windowSeconds: 3600 }
|
|
2329
2330
|
};
|
|
2330
2331
|
var ENV_PREFIX = "TEAMS_LIMIT_";
|
|
2332
|
+
var LIMIT_ENV_PREFIX = "PA_LIMIT_";
|
|
2331
2333
|
var DIGITS = /^\d+$/;
|
|
2332
2334
|
function parseOne(name, raw, fallback) {
|
|
2333
2335
|
const [number = "", seconds, ...rest] = raw.split("/");
|
|
@@ -2340,15 +2342,17 @@ function parseOne(name, raw, fallback) {
|
|
|
2340
2342
|
`${name} must be COUNT/SECONDS with both positive (for example ${String(fallback.count)}/${String(fallback.windowSeconds)}), or 0 for no limit, not '${raw}'`
|
|
2341
2343
|
);
|
|
2342
2344
|
}
|
|
2343
|
-
function parseLimits(env) {
|
|
2345
|
+
function parseLimits(env, options = {}) {
|
|
2346
|
+
const prefix = options.prefix ?? ENV_PREFIX;
|
|
2347
|
+
const source = options.source ?? ((name) => name);
|
|
2344
2348
|
const limits = /* @__PURE__ */ new Map();
|
|
2345
2349
|
for (const operation of SENSITIVE_OPERATION_NAMES) {
|
|
2346
2350
|
const fallback = DEFAULT_LIMITS[operation];
|
|
2347
|
-
const name =
|
|
2351
|
+
const name = prefix + operation.toUpperCase();
|
|
2348
2352
|
const raw = pyStrip(env(name));
|
|
2349
2353
|
if (!raw) limits.set(operation, fallback);
|
|
2350
2354
|
else if (raw === "0") limits.set(operation, { count: 0, windowSeconds: fallback.windowSeconds });
|
|
2351
|
-
else limits.set(operation, parseOne(name, raw, fallback));
|
|
2355
|
+
else limits.set(operation, parseOne(source(name), raw, fallback));
|
|
2352
2356
|
}
|
|
2353
2357
|
return limits;
|
|
2354
2358
|
}
|
|
@@ -4267,6 +4271,112 @@ var receiptText = defineCatalog({
|
|
|
4267
4271
|
}
|
|
4268
4272
|
});
|
|
4269
4273
|
|
|
4274
|
+
// packages/core/src/locales/skills.ts
|
|
4275
|
+
var skillText = defineCatalog({
|
|
4276
|
+
en: {
|
|
4277
|
+
savedTitle: (p) => `Saved as your skill: ${p.name} v${String(p.version)}`,
|
|
4278
|
+
updatedTitle: (p) => `Skill updated: ${p.name} v${String(p.version)}`,
|
|
4279
|
+
deletedTitle: (p) => `Skill deleted: ${p.name}`,
|
|
4280
|
+
disabledTitle: (p) => `Skill turned off: ${p.name}`,
|
|
4281
|
+
enabledTitle: (p) => `Skill turned on: ${p.name}`,
|
|
4282
|
+
draftTitle: (p) => `Save this as a skill? ${p.name}`,
|
|
4283
|
+
whenToUse: "When to use",
|
|
4284
|
+
files: "Files",
|
|
4285
|
+
manual: "Used only when you name it.",
|
|
4286
|
+
autoNote: "Related requests will use it from now on.",
|
|
4287
|
+
draftNote: "Nothing is saved until you press Save.",
|
|
4288
|
+
undo: "Undo",
|
|
4289
|
+
edit: "Edit",
|
|
4290
|
+
save: "Save",
|
|
4291
|
+
discard: "Discard",
|
|
4292
|
+
editTitle: (p) => `Edit skill: ${p.name}`,
|
|
4293
|
+
editDescription: "When to use it",
|
|
4294
|
+
editContent: "SKILL.md",
|
|
4295
|
+
editSave: "Save changes",
|
|
4296
|
+
editTooLong: (p) => `${p.name} is too long to edit on a card. Tell me in the chat what to change.`,
|
|
4297
|
+
undoneDeleted: (p) => `Undone: ${p.name} is deleted again.`,
|
|
4298
|
+
undoneVersion: (p) => `Undone: ${p.name} is back to its earlier text (now v${String(p.version)}).`,
|
|
4299
|
+
undoneRestored: (p) => `Undone: ${p.name} is back.`,
|
|
4300
|
+
undoneEnabled: (p) => `Undone: ${p.name} is on again.`,
|
|
4301
|
+
undoneDisabled: (p) => `Undone: ${p.name} is off again.`,
|
|
4302
|
+
undoExpired: "This can no longer be undone: a change can be undone for a day.",
|
|
4303
|
+
undoChanged: (p) => `Not undone: ${p.name} has changed since. Use /skills to see it now.`,
|
|
4304
|
+
undoDone: "This was undone already.",
|
|
4305
|
+
undoFull: "Not undone: your skills are full. Delete one first, then press Undo again.",
|
|
4306
|
+
gone: "This card is no longer active.",
|
|
4307
|
+
failed: "That did not go through. Press it again in a moment.",
|
|
4308
|
+
refused: (p) => `Not saved: ${p.why}`,
|
|
4309
|
+
unavailable: "Personal skills are not available on this Claw.",
|
|
4310
|
+
noSkills: "You have no personal skills yet. Ask me to save a way of working as a skill, for example: save this as a skill.",
|
|
4311
|
+
listTitle: (p) => `Your skills (${String(p.n)})`,
|
|
4312
|
+
listLine: (p) => `- **${p.name}** v${String(p.version)}${p.state}: ${p.description}`,
|
|
4313
|
+
stateOff: " (off)",
|
|
4314
|
+
stateManual: " (only when named)",
|
|
4315
|
+
listHint: "/skills show <name>, /skills disable <name>, /skills enable <name>, /skills delete <name>",
|
|
4316
|
+
showHead: (p) => `**${p.name}** v${String(p.version)}${p.state}`,
|
|
4317
|
+
showFiles: (p) => `Files: ${p.files}`,
|
|
4318
|
+
notFound: (p) => `You have no skill named ${p.name}. /skills lists yours.`,
|
|
4319
|
+
already: (p) => `${p.name} is ${p.on} already.`,
|
|
4320
|
+
on: "on",
|
|
4321
|
+
off: "off",
|
|
4322
|
+
usage: "Use /skills, /skills show <name>, /skills disable <name>, /skills enable <name> or /skills delete <name>.",
|
|
4323
|
+
couldNotRead: "Your skills could not be read just now. Try again in a moment.",
|
|
4324
|
+
draftSaved: (p) => `Saved as your skill: ${p.name} v${String(p.version)}.`,
|
|
4325
|
+
draftDiscarded: "Discarded: nothing was saved."
|
|
4326
|
+
},
|
|
4327
|
+
zh: {
|
|
4328
|
+
savedTitle: (p) => `\u5DF2\u5B58\u4E3A\u4F60\u7684\u6280\u80FD\uFF1A${p.name} v${String(p.version)}`,
|
|
4329
|
+
updatedTitle: (p) => `\u6280\u80FD\u5DF2\u66F4\u65B0\uFF1A${p.name} v${String(p.version)}`,
|
|
4330
|
+
deletedTitle: (p) => `\u6280\u80FD\u5DF2\u5220\u9664\uFF1A${p.name}`,
|
|
4331
|
+
disabledTitle: (p) => `\u6280\u80FD\u5DF2\u505C\u7528\uFF1A${p.name}`,
|
|
4332
|
+
enabledTitle: (p) => `\u6280\u80FD\u5DF2\u542F\u7528\uFF1A${p.name}`,
|
|
4333
|
+
draftTitle: (p) => `\u8981\u5B58\u6210\u6280\u80FD\u5417\uFF1F${p.name}`,
|
|
4334
|
+
whenToUse: "\u4EC0\u4E48\u65F6\u5019\u7528",
|
|
4335
|
+
files: "\u9644\u5E26\u6587\u4EF6",
|
|
4336
|
+
manual: "\u53EA\u5728\u4F60\u70B9\u540D\u65F6\u4F7F\u7528\u3002",
|
|
4337
|
+
autoNote: "\u4EE5\u540E\u76F8\u5173\u7684\u8BF7\u6C42\u4F1A\u81EA\u52A8\u7528\u5230\u5B83\u3002",
|
|
4338
|
+
draftNote: "\u70B9\u300C\u4FDD\u5B58\u300D\u4E4B\u524D\u4EC0\u4E48\u90FD\u4E0D\u4F1A\u4FDD\u5B58\u3002",
|
|
4339
|
+
undo: "\u64A4\u9500",
|
|
4340
|
+
edit: "\u4FEE\u6539",
|
|
4341
|
+
save: "\u4FDD\u5B58",
|
|
4342
|
+
discard: "\u653E\u5F03",
|
|
4343
|
+
editTitle: (p) => `\u4FEE\u6539\u6280\u80FD\uFF1A${p.name}`,
|
|
4344
|
+
editDescription: "\u4EC0\u4E48\u65F6\u5019\u7528",
|
|
4345
|
+
editContent: "SKILL.md",
|
|
4346
|
+
editSave: "\u4FDD\u5B58\u4FEE\u6539",
|
|
4347
|
+
editTooLong: (p) => `${p.name} \u592A\u957F\uFF0C\u6CA1\u6CD5\u5728\u5361\u7247\u4E0A\u4FEE\u6539\u3002\u76F4\u63A5\u5728\u804A\u5929\u91CC\u544A\u8BC9\u6211\u8981\u6539\u4EC0\u4E48\u3002`,
|
|
4348
|
+
undoneDeleted: (p) => `\u5DF2\u64A4\u9500\uFF1A${p.name} \u5DF2\u5220\u9664\u3002`,
|
|
4349
|
+
undoneVersion: (p) => `\u5DF2\u64A4\u9500\uFF1A${p.name} \u56DE\u5230\u4E86\u4E4B\u524D\u7684\u5185\u5BB9\uFF08\u73B0\u5728\u662F v${String(p.version)}\uFF09\u3002`,
|
|
4350
|
+
undoneRestored: (p) => `\u5DF2\u64A4\u9500\uFF1A${p.name} \u5DF2\u6062\u590D\u3002`,
|
|
4351
|
+
undoneEnabled: (p) => `\u5DF2\u64A4\u9500\uFF1A${p.name} \u5DF2\u91CD\u65B0\u542F\u7528\u3002`,
|
|
4352
|
+
undoneDisabled: (p) => `\u5DF2\u64A4\u9500\uFF1A${p.name} \u5DF2\u91CD\u65B0\u505C\u7528\u3002`,
|
|
4353
|
+
undoExpired: "\u5DF2\u7ECF\u4E0D\u80FD\u64A4\u9500\u4E86\uFF1A\u6539\u52A8\u53EA\u80FD\u5728\u4E00\u5929\u5185\u64A4\u9500\u3002",
|
|
4354
|
+
undoChanged: (p) => `\u6CA1\u6709\u64A4\u9500\uFF1A${p.name} \u4E4B\u540E\u53C8\u6539\u8FC7\u4E86\u3002\u7528 /skills \u770B\u770B\u5B83\u73B0\u5728\u7684\u6837\u5B50\u3002`,
|
|
4355
|
+
undoDone: "\u8FD9\u4E2A\u6539\u52A8\u5DF2\u7ECF\u64A4\u9500\u8FC7\u4E86\u3002",
|
|
4356
|
+
undoFull: "\u6CA1\u6709\u64A4\u9500\uFF1A\u4F60\u7684\u6280\u80FD\u5DF2\u7ECF\u6EE1\u4E86\u3002\u5148\u5220\u6389\u4E00\u4E2A\uFF0C\u518D\u70B9\u300C\u64A4\u9500\u300D\u3002",
|
|
4357
|
+
gone: "\u8FD9\u5F20\u5361\u7247\u5DF2\u7ECF\u5931\u6548\u4E86\u3002",
|
|
4358
|
+
failed: "\u6CA1\u6709\u6210\u529F\uFF0C\u8FC7\u4E00\u4F1A\u513F\u518D\u70B9\u4E00\u6B21\u3002",
|
|
4359
|
+
refused: (p) => `\u6CA1\u6709\u4FDD\u5B58\uFF1A${p.why}`,
|
|
4360
|
+
unavailable: "\u8FD9\u4E2A Claw \u4E0A\u8FD8\u6CA1\u6709\u4E2A\u4EBA\u6280\u80FD\u3002",
|
|
4361
|
+
noSkills: "\u4F60\u8FD8\u6CA1\u6709\u4E2A\u4EBA\u6280\u80FD\u3002\u53EF\u4EE5\u8BA9\u6211\u628A\u4E00\u79CD\u505A\u6CD5\u5B58\u6210\u6280\u80FD\uFF0C\u6BD4\u5982\u8BF4\uFF1A\u628A\u8FD9\u4E2A\u5B58\u6210\u6280\u80FD\u3002",
|
|
4362
|
+
listTitle: (p) => `\u4F60\u7684\u6280\u80FD\uFF08${String(p.n)} \u4E2A\uFF09`,
|
|
4363
|
+
listLine: (p) => `- **${p.name}** v${String(p.version)}${p.state}\uFF1A${p.description}`,
|
|
4364
|
+
stateOff: "\uFF08\u5DF2\u505C\u7528\uFF09",
|
|
4365
|
+
stateManual: "\uFF08\u53EA\u5728\u70B9\u540D\u65F6\u7528\uFF09",
|
|
4366
|
+
listHint: "/skills show <\u540D\u5B57>\u3001/skills disable <\u540D\u5B57>\u3001/skills enable <\u540D\u5B57>\u3001/skills delete <\u540D\u5B57>",
|
|
4367
|
+
showHead: (p) => `**${p.name}** v${String(p.version)}${p.state}`,
|
|
4368
|
+
showFiles: (p) => `\u9644\u5E26\u6587\u4EF6\uFF1A${p.files}`,
|
|
4369
|
+
notFound: (p) => `\u4F60\u6CA1\u6709\u53EB ${p.name} \u7684\u6280\u80FD\u3002\u7528 /skills \u770B\u770B\u4F60\u6709\u54EA\u4E9B\u3002`,
|
|
4370
|
+
already: (p) => `${p.name} \u5DF2\u7ECF\u662F${p.on}\u7684\u4E86\u3002`,
|
|
4371
|
+
on: "\u542F\u7528",
|
|
4372
|
+
off: "\u505C\u7528",
|
|
4373
|
+
usage: "\u7528\u6CD5\uFF1A/skills\u3001/skills show <\u540D\u5B57>\u3001/skills disable <\u540D\u5B57>\u3001/skills enable <\u540D\u5B57>\u3001/skills delete <\u540D\u5B57>\u3002",
|
|
4374
|
+
couldNotRead: "\u6682\u65F6\u8BFB\u4E0D\u5230\u4F60\u7684\u6280\u80FD\uFF0C\u8FC7\u4E00\u4F1A\u513F\u518D\u8BD5\u3002",
|
|
4375
|
+
draftSaved: (p) => `\u5DF2\u5B58\u4E3A\u4F60\u7684\u6280\u80FD\uFF1A${p.name} v${String(p.version)}\u3002`,
|
|
4376
|
+
draftDiscarded: "\u5DF2\u653E\u5F03\uFF0C\u4EC0\u4E48\u90FD\u6CA1\u6709\u4FDD\u5B58\u3002"
|
|
4377
|
+
}
|
|
4378
|
+
});
|
|
4379
|
+
|
|
4270
4380
|
// packages/core/src/locales/proactive-lines.ts
|
|
4271
4381
|
var releaseLines = {
|
|
4272
4382
|
olderSaid: (p) => `${String(p.n)} earlier messages from your assistant are not shown here. Send /board to see where your tasks stand.`,
|
|
@@ -6793,7 +6903,7 @@ var LiveView = class {
|
|
|
6793
6903
|
const plan = planText(this.todos, this.lang);
|
|
6794
6904
|
const budget = LIVE_MAX_CHARS - (plan ? cpLength(plan) + 2 : 0);
|
|
6795
6905
|
let body = "";
|
|
6796
|
-
let
|
|
6906
|
+
let clipped2 = false;
|
|
6797
6907
|
for (const paragraph of this.paragraphs().reverse()) {
|
|
6798
6908
|
const joined = body ? `${paragraph}
|
|
6799
6909
|
|
|
@@ -6802,15 +6912,15 @@ ${body}` : paragraph;
|
|
|
6802
6912
|
body = joined;
|
|
6803
6913
|
continue;
|
|
6804
6914
|
}
|
|
6805
|
-
|
|
6915
|
+
clipped2 = true;
|
|
6806
6916
|
if (!body) body = pyLstrip(cpSlice(paragraph, -budget));
|
|
6807
6917
|
break;
|
|
6808
6918
|
}
|
|
6809
|
-
if (
|
|
6919
|
+
if (clipped2) body = `...
|
|
6810
6920
|
|
|
6811
6921
|
${body}`;
|
|
6812
6922
|
if (body.split("```").length % 2 === 0) {
|
|
6813
|
-
body =
|
|
6923
|
+
body = clipped2 ? `\`\`\`
|
|
6814
6924
|
${body}` : `${body}
|
|
6815
6925
|
\`\`\``;
|
|
6816
6926
|
}
|
|
@@ -10833,7 +10943,8 @@ var SETTINGS_ENTRIES = [
|
|
|
10833
10943
|
sayZh: "\u4F60\u8BB0\u5F97\u6211\u4EC0\u4E48",
|
|
10834
10944
|
sayEn: "what do you remember about me",
|
|
10835
10945
|
reaches: "memory",
|
|
10836
|
-
|
|
10946
|
+
// (`/skills`: the personal skills the person saved, the other thing Claw keeps of theirs; listed, turned off or on, deleted)
|
|
10947
|
+
covers: ["command:memory", "command:skills"],
|
|
10837
10948
|
action: true
|
|
10838
10949
|
}),
|
|
10839
10950
|
capability({
|
|
@@ -16403,12 +16514,26 @@ function triggerDone(create2, out, lang) {
|
|
|
16403
16514
|
const next = localTime(trigger["next_fire_at"], tz);
|
|
16404
16515
|
return t4.scheduled({ name: or(trigger["name"], ""), schedule: or(trigger["schedule"], ""), tz, next });
|
|
16405
16516
|
}
|
|
16517
|
+
function skillSaveOutcome(status, out, lang) {
|
|
16518
|
+
const t4 = assistantActionText.in(lang);
|
|
16519
|
+
const s = skillText.in(lang);
|
|
16520
|
+
const result = fields(out["result"]);
|
|
16521
|
+
if (status === "done" && truthy2(out["answered_now"])) {
|
|
16522
|
+
const version = typeof result["version"] === "number" ? result["version"] : 1;
|
|
16523
|
+
return s.draftSaved({ name: or(result["name"], ""), version });
|
|
16524
|
+
}
|
|
16525
|
+
if (status === "done") return t4.alreadyAnswered;
|
|
16526
|
+
if (status === "denied") return s.draftDiscarded;
|
|
16527
|
+
if (status === "expired") return t4.expired;
|
|
16528
|
+
return s.refused({ why: or(result["message"], or(result["error"], status)) });
|
|
16529
|
+
}
|
|
16406
16530
|
function confirmOutcome(kind, out, lang) {
|
|
16407
16531
|
const t4 = assistantActionText.in(lang);
|
|
16408
16532
|
const status = or(out["status"], "");
|
|
16409
16533
|
const create2 = kind === "trigger_create";
|
|
16410
16534
|
if (kind === "devenv_send") return devenvSendOutcome(status, out, lang);
|
|
16411
16535
|
if (kind === "devenv_hide") return devenvHideOutcome(status, out, lang);
|
|
16536
|
+
if (kind === "skill_save") return skillSaveOutcome(status, out, lang);
|
|
16412
16537
|
const comment = kind === "github_comment" ? commentOutcome(out, lang) : void 0;
|
|
16413
16538
|
if (comment !== void 0) return comment;
|
|
16414
16539
|
if (status === "done" && truthy2(out["answered_now"])) return triggerDone(create2, out, lang);
|
|
@@ -16430,6 +16555,13 @@ async function finish(click, edited, said2) {
|
|
|
16430
16555
|
await click.conversation.send(line2);
|
|
16431
16556
|
}
|
|
16432
16557
|
|
|
16558
|
+
// packages/core/src/skills/views.ts
|
|
16559
|
+
var SKILL_UNDO_KIND = "skill_undo";
|
|
16560
|
+
var SKILL_VERB = "assistant_skill";
|
|
16561
|
+
var SKILL_EDIT_DESCRIPTION = "skill_description";
|
|
16562
|
+
var SKILL_EDIT_CONTENT = "skill_content";
|
|
16563
|
+
var SKILL_EDIT_MAX = 6e3;
|
|
16564
|
+
|
|
16433
16565
|
// packages/core/src/assistant/actions.ts
|
|
16434
16566
|
var REVIEW_HANDOFF = "review_for_other";
|
|
16435
16567
|
function record(value) {
|
|
@@ -16517,7 +16649,7 @@ var AssistantActions = class {
|
|
|
16517
16649
|
const data = click.action.data;
|
|
16518
16650
|
const card = store.assistantButtons.getConfirmCard(pyStr(data["card"]));
|
|
16519
16651
|
const op = data["op"];
|
|
16520
|
-
if (op !== "allow" && op !== "deny" || card === null || card.userId !== click.sender.id) {
|
|
16652
|
+
if (op !== "allow" && op !== "deny" || card === null || card.userId !== click.sender.id || card.kind === SKILL_UNDO_KIND) {
|
|
16521
16653
|
await finish(click, t.confirmGone);
|
|
16522
16654
|
return;
|
|
16523
16655
|
}
|
|
@@ -17656,7 +17788,8 @@ var CONFIRM_KINDS = [
|
|
|
17656
17788
|
"trigger_cancel",
|
|
17657
17789
|
"devenv_send",
|
|
17658
17790
|
"github_comment",
|
|
17659
|
-
"devenv_hide"
|
|
17791
|
+
"devenv_hide",
|
|
17792
|
+
"skill_save"
|
|
17660
17793
|
];
|
|
17661
17794
|
var ASSISTANT_SUGGESTED_REPLIES = {
|
|
17662
17795
|
zh: [
|
|
@@ -17716,6 +17849,37 @@ function suggestedRepliesOf(event, text8, styleOn, lang, max = SUGGESTIONS_MAX)
|
|
|
17716
17849
|
if (replies.length) return replies.slice(0, max);
|
|
17717
17850
|
return [...ASSISTANT_SUGGESTED_REPLIES[lang ?? pickLang2(text8)]];
|
|
17718
17851
|
}
|
|
17852
|
+
var SKILL_CARD_KINDS = ["saved", "deleted", "disabled", "enabled", "draft"];
|
|
17853
|
+
var SKILL_DESCRIPTION_MAX = 300;
|
|
17854
|
+
var SKILL_PREVIEW_MAX = 1500;
|
|
17855
|
+
var SKILL_FILES_MAX = 20;
|
|
17856
|
+
var SKILL_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
|
|
17857
|
+
var CHANGE_ID = /^[A-Za-z0-9-]{1,64}$/;
|
|
17858
|
+
function clipped(value, max) {
|
|
17859
|
+
const all = Array.from(field2(value));
|
|
17860
|
+
return all.length > max ? `${all.slice(0, max - 1).join("")}\u2026` : all.join("");
|
|
17861
|
+
}
|
|
17862
|
+
function skillCardOf(event) {
|
|
17863
|
+
const card = record2(event["skill_card"]);
|
|
17864
|
+
if (event["type"] !== "assistant.say" || card === void 0) return void 0;
|
|
17865
|
+
const kind = SKILL_CARD_KINDS.find((k) => k === card["kind"]);
|
|
17866
|
+
const name = typeof card["name"] === "string" ? card["name"] : "";
|
|
17867
|
+
if (kind === void 0 || !SKILL_NAME.test(name)) return void 0;
|
|
17868
|
+
const version = typeof card["version"] === "number" && Number.isSafeInteger(card["version"]) ? card["version"] : null;
|
|
17869
|
+
const changeId = typeof card["change_id"] === "string" && CHANGE_ID.test(card["change_id"]) ? card["change_id"] : "";
|
|
17870
|
+
const files = (Array.isArray(card["files"]) ? card["files"] : []).map((f) => record2(f)?.["path"]).filter((p) => typeof p === "string" && p !== "" && cpLength(p) <= 200 && !p.includes("\n")).slice(0, SKILL_FILES_MAX);
|
|
17871
|
+
return {
|
|
17872
|
+
kind,
|
|
17873
|
+
name,
|
|
17874
|
+
version,
|
|
17875
|
+
created: card["created"] === true,
|
|
17876
|
+
description: pySplit(clipped(card["description"], SKILL_DESCRIPTION_MAX)).join(" "),
|
|
17877
|
+
manual: card["invocation"] === "manual",
|
|
17878
|
+
files,
|
|
17879
|
+
preview: clipped(card["preview"], SKILL_PREVIEW_MAX),
|
|
17880
|
+
changeId
|
|
17881
|
+
};
|
|
17882
|
+
}
|
|
17719
17883
|
var CHOICE_OPTIONS_MIN = 2;
|
|
17720
17884
|
var CHOICE_OPTIONS_MAX = 10;
|
|
17721
17885
|
var CHOICE_OPTION_MAX = 80;
|
|
@@ -17884,10 +18048,33 @@ ${text8}`;
|
|
|
17884
18048
|
const inCard = said2.inCard ? said2.text : "";
|
|
17885
18049
|
if (item?.canAccept)
|
|
17886
18050
|
return { message: this.workCard(userId, item, said2.text, inCard, said2.lang), holdsWords: said2.inCard };
|
|
18051
|
+
const skill = item === null ? this.skillCard(userId, event, said2.text, said2.lang) : void 0;
|
|
18052
|
+
if (skill !== void 0) return { message: skill, holdsWords: true };
|
|
17887
18053
|
const asked3 = item === null ? this.askCard(userId, event, inCard, said2.lang) : void 0;
|
|
17888
18054
|
if (asked3 !== void 0) return { message: asked3, holdsWords: said2.inCard };
|
|
17889
18055
|
return this.choiceCard(userId, event, inCard, said2.lang, said2.inCard);
|
|
17890
18056
|
}
|
|
18057
|
+
/**
|
|
18058
|
+
* A personal skill the message is about (`skill_card`), recorded first: a draft is its held write (Save and Discard answer it as
|
|
18059
|
+
* any held write is answered); anything done already records the change its Undo takes back. Undefined for none, and for a draft
|
|
18060
|
+
* without its held write (it is then the plain held write's card).
|
|
18061
|
+
*/
|
|
18062
|
+
skillCard(userId, event, text8, lang) {
|
|
18063
|
+
const skill = skillCardOf(event);
|
|
18064
|
+
if (skill === void 0) return void 0;
|
|
18065
|
+
const buttons2 = this.deps.store.assistantButtons;
|
|
18066
|
+
if (skill.kind === "draft") {
|
|
18067
|
+
const held = confirmWriteOf(event);
|
|
18068
|
+
if (held === void 0 || held.kind !== "skill_save") return void 0;
|
|
18069
|
+
const cardId2 = buttons2.addConfirmCard(userId, held.confirmationId, held.kind, held.allowLabel);
|
|
18070
|
+
return view3(
|
|
18071
|
+
{ name: "skillCard", model: { skill, cardId: cardId2, allowLabel: held.allowLabel, note: "", ended: false, lang } },
|
|
18072
|
+
text8
|
|
18073
|
+
);
|
|
18074
|
+
}
|
|
18075
|
+
const cardId = skill.changeId ? buttons2.addConfirmCard(userId, skill.changeId, SKILL_UNDO_KIND, skill.name) : "";
|
|
18076
|
+
return view3({ name: "skillCard", model: { skill, cardId, allowLabel: "", note: "", ended: false, lang } }, text8);
|
|
18077
|
+
}
|
|
17891
18078
|
/** A write Claw holds for the person (Allow, Deny) or a command put to them (Run, Cancel), recorded first; undefined for none. */
|
|
17892
18079
|
askCard(userId, event, inCard, lang) {
|
|
17893
18080
|
const held = confirmWriteOf(event);
|
|
@@ -18348,6 +18535,281 @@ var WorkCardClicks = class {
|
|
|
18348
18535
|
}
|
|
18349
18536
|
};
|
|
18350
18537
|
|
|
18538
|
+
// packages/core/src/skills/card.ts
|
|
18539
|
+
var PREVIEW_LINES = 30;
|
|
18540
|
+
var PREVIEW_CHARS = 1500;
|
|
18541
|
+
function preview(content) {
|
|
18542
|
+
const lines = content.split(/\r?\n/u).slice(0, PREVIEW_LINES).join("\n");
|
|
18543
|
+
const all = Array.from(lines);
|
|
18544
|
+
return all.length > PREVIEW_CHARS ? `${all.slice(0, PREVIEW_CHARS - 1).join("")}\u2026` : lines;
|
|
18545
|
+
}
|
|
18546
|
+
function skillCardOfSkill(skill, kind, changeId) {
|
|
18547
|
+
return {
|
|
18548
|
+
kind,
|
|
18549
|
+
name: skill.name,
|
|
18550
|
+
version: skill.version,
|
|
18551
|
+
created: false,
|
|
18552
|
+
description: skill.description,
|
|
18553
|
+
manual: skill.invocation === "manual",
|
|
18554
|
+
files: (skill.fileList ?? []).map((f) => f.path),
|
|
18555
|
+
preview: kind === "deleted" || skill.content === void 0 ? "" : preview(skill.content),
|
|
18556
|
+
changeId
|
|
18557
|
+
};
|
|
18558
|
+
}
|
|
18559
|
+
|
|
18560
|
+
// packages/core/src/skills/clicks.ts
|
|
18561
|
+
function refusalReason(error) {
|
|
18562
|
+
try {
|
|
18563
|
+
const body = JSON.parse(error.detail);
|
|
18564
|
+
if (typeof body === "object" && body !== null) {
|
|
18565
|
+
const reason = body["reason"];
|
|
18566
|
+
return typeof reason === "string" ? reason : "";
|
|
18567
|
+
}
|
|
18568
|
+
} catch {
|
|
18569
|
+
}
|
|
18570
|
+
return "";
|
|
18571
|
+
}
|
|
18572
|
+
function refusalWords(error) {
|
|
18573
|
+
try {
|
|
18574
|
+
const body = JSON.parse(error.detail);
|
|
18575
|
+
const said2 = typeof body === "object" && body !== null ? body["error"] : void 0;
|
|
18576
|
+
if (typeof said2 === "string" && said2) return said2;
|
|
18577
|
+
} catch {
|
|
18578
|
+
}
|
|
18579
|
+
return `HTTP ${String(error.status)}`;
|
|
18580
|
+
}
|
|
18581
|
+
var SkillCardClicks = class {
|
|
18582
|
+
constructor(deps) {
|
|
18583
|
+
this.deps = deps;
|
|
18584
|
+
}
|
|
18585
|
+
deps;
|
|
18586
|
+
verbs = [SKILL_VERB];
|
|
18587
|
+
async withCredential(click, credential2) {
|
|
18588
|
+
const data = click.action.data;
|
|
18589
|
+
const op = pyStr(data["op"]);
|
|
18590
|
+
const card = this.deps.store.assistantButtons.getConfirmCard(pyStr(data["card"]));
|
|
18591
|
+
const lang = click.lang();
|
|
18592
|
+
const t4 = skillText.in(lang);
|
|
18593
|
+
if (card === null || card.userId !== click.sender.id || card.kind !== SKILL_UNDO_KIND || op !== "undo" && op !== "edit" && op !== "save_edit") {
|
|
18594
|
+
await finish(click, t4.gone);
|
|
18595
|
+
return;
|
|
18596
|
+
}
|
|
18597
|
+
if (card.state !== "open") {
|
|
18598
|
+
await finish(click, op === "undo" ? t4.undoDone : t4.gone);
|
|
18599
|
+
return;
|
|
18600
|
+
}
|
|
18601
|
+
if (op === "undo") await this.undo(click, card, credential2, lang);
|
|
18602
|
+
else if (op === "edit") await this.edit(click, card, credential2, lang);
|
|
18603
|
+
else await this.saveEdit(click, card, credential2, lang);
|
|
18604
|
+
}
|
|
18605
|
+
async undo(click, card, credential2, lang) {
|
|
18606
|
+
const t4 = skillText.in(lang);
|
|
18607
|
+
const buttons2 = this.deps.store.assistantButtons;
|
|
18608
|
+
if (!buttons2.moveConfirmCard(card.cardId, "busy", { onlyFrom: "open" })) {
|
|
18609
|
+
await finish(click, t4.undoDone);
|
|
18610
|
+
return;
|
|
18611
|
+
}
|
|
18612
|
+
let undone;
|
|
18613
|
+
try {
|
|
18614
|
+
undone = await this.deps.skills.undo(credential2, card.confirmationId);
|
|
18615
|
+
} catch (error) {
|
|
18616
|
+
if (!clawFailure3(error)) throw error;
|
|
18617
|
+
this.deps.logger.warn("a skill's change could not be undone", { error: errorName(error) });
|
|
18618
|
+
if (error instanceof ClawError && error.status < 500) {
|
|
18619
|
+
buttons2.moveConfirmCard(card.cardId, "done");
|
|
18620
|
+
await finish(click, this.undoRefused(error, card.label, lang));
|
|
18621
|
+
return;
|
|
18622
|
+
}
|
|
18623
|
+
buttons2.moveConfirmCard(card.cardId, "open", { onlyFrom: "busy" });
|
|
18624
|
+
await click.settle(t4.failed, { announce: false });
|
|
18625
|
+
return;
|
|
18626
|
+
}
|
|
18627
|
+
buttons2.moveConfirmCard(card.cardId, "done");
|
|
18628
|
+
const name = undone.name || card.label;
|
|
18629
|
+
const said2 = undone.undone === "deleted" ? t4.undoneDeleted({ name }) : undone.undone === "restored_version" ? t4.undoneVersion({ name, version: undone.version ?? 0 }) : undone.undone === "enabled" ? t4.undoneEnabled({ name }) : undone.undone === "disabled" ? t4.undoneDisabled({ name }) : t4.undoneRestored({ name });
|
|
18630
|
+
await finish(click, said2);
|
|
18631
|
+
}
|
|
18632
|
+
undoRefused(error, name, lang) {
|
|
18633
|
+
const t4 = skillText.in(lang);
|
|
18634
|
+
const reason = refusalReason(error);
|
|
18635
|
+
if (error.status === 410 || reason === "expired") return t4.undoExpired;
|
|
18636
|
+
if (reason === "undone") return t4.undoDone;
|
|
18637
|
+
if (reason === "changed") return t4.undoChanged({ name });
|
|
18638
|
+
if (reason === "full") return t4.undoFull;
|
|
18639
|
+
return t4.gone;
|
|
18640
|
+
}
|
|
18641
|
+
async edit(click, card, credential2, lang) {
|
|
18642
|
+
const t4 = skillText.in(lang);
|
|
18643
|
+
let skill;
|
|
18644
|
+
try {
|
|
18645
|
+
skill = await this.deps.skills.show(credential2, card.label);
|
|
18646
|
+
} catch (error) {
|
|
18647
|
+
if (!clawFailure3(error)) throw error;
|
|
18648
|
+
await finish(
|
|
18649
|
+
click,
|
|
18650
|
+
error instanceof ClawError && error.status === 404 ? t4.notFound({ name: card.label }) : t4.couldNotRead
|
|
18651
|
+
);
|
|
18652
|
+
return;
|
|
18653
|
+
}
|
|
18654
|
+
if (cpLength(skill.content) > SKILL_EDIT_MAX) {
|
|
18655
|
+
await finish(click, t4.editTooLong({ name: skill.name }));
|
|
18656
|
+
return;
|
|
18657
|
+
}
|
|
18658
|
+
const model = {
|
|
18659
|
+
cardId: card.cardId,
|
|
18660
|
+
name: skill.name,
|
|
18661
|
+
description: skill.description,
|
|
18662
|
+
content: skill.content,
|
|
18663
|
+
note: "",
|
|
18664
|
+
lang
|
|
18665
|
+
};
|
|
18666
|
+
await click.settle(viewMessage2({ name: "skillEdit", model }), { announce: false });
|
|
18667
|
+
}
|
|
18668
|
+
async saveEdit(click, card, credential2, lang) {
|
|
18669
|
+
const t4 = skillText.in(lang);
|
|
18670
|
+
const buttons2 = this.deps.store.assistantButtons;
|
|
18671
|
+
const content = pyStr(click.action.data[SKILL_EDIT_CONTENT]);
|
|
18672
|
+
const description = pyStr(click.action.data[SKILL_EDIT_DESCRIPTION]).trim();
|
|
18673
|
+
const again = (note) => click.settle(
|
|
18674
|
+
viewMessage2({
|
|
18675
|
+
name: "skillEdit",
|
|
18676
|
+
model: { cardId: card.cardId, name: card.label, description, content, note, lang }
|
|
18677
|
+
}),
|
|
18678
|
+
{ announce: false }
|
|
18679
|
+
);
|
|
18680
|
+
if (!content.trim()) {
|
|
18681
|
+
await again(t4.refused({ why: "SKILL.md" }));
|
|
18682
|
+
return;
|
|
18683
|
+
}
|
|
18684
|
+
if (!buttons2.moveConfirmCard(card.cardId, "busy", { onlyFrom: "open" })) {
|
|
18685
|
+
await finish(click, t4.gone);
|
|
18686
|
+
return;
|
|
18687
|
+
}
|
|
18688
|
+
let change;
|
|
18689
|
+
try {
|
|
18690
|
+
change = await this.deps.skills.update(credential2, card.label, { content, description });
|
|
18691
|
+
} catch (error) {
|
|
18692
|
+
if (!clawFailure3(error)) throw error;
|
|
18693
|
+
buttons2.moveConfirmCard(card.cardId, "open", { onlyFrom: "busy" });
|
|
18694
|
+
this.deps.logger.warn("a skill could not be saved from its card", { error: errorName(error) });
|
|
18695
|
+
await again(
|
|
18696
|
+
error instanceof ClawError && error.status < 500 ? t4.refused({ why: refusalWords(error) }) : t4.failed
|
|
18697
|
+
);
|
|
18698
|
+
return;
|
|
18699
|
+
}
|
|
18700
|
+
buttons2.moveConfirmCard(card.cardId, "done");
|
|
18701
|
+
let shown3;
|
|
18702
|
+
try {
|
|
18703
|
+
shown3 = await this.deps.skills.show(credential2, card.label);
|
|
18704
|
+
} catch (error) {
|
|
18705
|
+
if (!clawFailure3(error)) throw error;
|
|
18706
|
+
await finish(click, t4.updatedTitle({ name: card.label, version: change.version ?? 0 }));
|
|
18707
|
+
return;
|
|
18708
|
+
}
|
|
18709
|
+
const next = change.changeId ? buttons2.addConfirmCard(click.sender.id, change.changeId, SKILL_UNDO_KIND, card.label) : "";
|
|
18710
|
+
const skill = skillCardOfSkill(shown3, "saved", change.changeId);
|
|
18711
|
+
const model = { skill, cardId: next, allowLabel: "", note: "", ended: false, lang };
|
|
18712
|
+
await click.settle(viewMessage2({ name: "skillCard", model }), {
|
|
18713
|
+
fallback: t4.updatedTitle({ name: shown3.name, version: shown3.version })
|
|
18714
|
+
});
|
|
18715
|
+
}
|
|
18716
|
+
};
|
|
18717
|
+
|
|
18718
|
+
// packages/core/src/skills/command.ts
|
|
18719
|
+
var SHOW_MAX = 3500;
|
|
18720
|
+
var SkillsCommand = class {
|
|
18721
|
+
constructor(deps) {
|
|
18722
|
+
this.deps = deps;
|
|
18723
|
+
}
|
|
18724
|
+
deps;
|
|
18725
|
+
name = "skills";
|
|
18726
|
+
async run(route, args) {
|
|
18727
|
+
const lang = route.lang();
|
|
18728
|
+
const t4 = skillText.in(lang);
|
|
18729
|
+
const words3 = pySplit(args);
|
|
18730
|
+
const verb = (words3[0] ?? "").toLowerCase();
|
|
18731
|
+
const name = words3[1] ?? "";
|
|
18732
|
+
const say3 = (text8) => route.conversation.send(textMessage(text8));
|
|
18733
|
+
try {
|
|
18734
|
+
await this.dispatch(route, verb, words3.length, name, lang);
|
|
18735
|
+
} catch (error) {
|
|
18736
|
+
if (!clawFailure3(error)) throw error;
|
|
18737
|
+
this.deps.logger.info("a /skills command could not be carried out", { error: errorName(error) });
|
|
18738
|
+
if (error instanceof ClawError && error.status === 404)
|
|
18739
|
+
await say3(verb === "" || verb === "list" ? t4.unavailable : t4.notFound({ name }));
|
|
18740
|
+
else await say3(t4.couldNotRead);
|
|
18741
|
+
}
|
|
18742
|
+
return true;
|
|
18743
|
+
}
|
|
18744
|
+
async dispatch(route, verb, count5, name, lang) {
|
|
18745
|
+
if (verb === "" || verb === "list" && count5 === 1) return this.list(route, lang);
|
|
18746
|
+
if (verb === "show" && count5 === 2) return this.show(route, name, lang);
|
|
18747
|
+
if ((verb === "disable" || verb === "enable" || verb === "delete") && count5 === 2)
|
|
18748
|
+
return this.act(route, verb, name, lang);
|
|
18749
|
+
await route.conversation.send(textMessage(skillText.in(lang).usage));
|
|
18750
|
+
}
|
|
18751
|
+
state(s, lang) {
|
|
18752
|
+
const t4 = skillText.in(lang);
|
|
18753
|
+
return `${s.enabled ? "" : t4.stateOff}${s.invocation === "manual" ? t4.stateManual : ""}`;
|
|
18754
|
+
}
|
|
18755
|
+
async list(route, lang) {
|
|
18756
|
+
const t4 = skillText.in(lang);
|
|
18757
|
+
const skills = await this.deps.skills.list(route.credential);
|
|
18758
|
+
if (!skills.length) {
|
|
18759
|
+
await route.conversation.send(textMessage(t4.noSkills));
|
|
18760
|
+
return;
|
|
18761
|
+
}
|
|
18762
|
+
const lines = skills.map(
|
|
18763
|
+
(s) => t4.listLine({
|
|
18764
|
+
name: s.name,
|
|
18765
|
+
version: s.version,
|
|
18766
|
+
description: s.description.replace(/\s+/gu, " "),
|
|
18767
|
+
state: this.state(s, lang)
|
|
18768
|
+
})
|
|
18769
|
+
);
|
|
18770
|
+
await route.conversation.send(
|
|
18771
|
+
richMessage([`**${t4.listTitle({ n: skills.length })}**`, ...lines, "", t4.listHint].join("\n"))
|
|
18772
|
+
);
|
|
18773
|
+
}
|
|
18774
|
+
async show(route, name, lang) {
|
|
18775
|
+
const t4 = skillText.in(lang);
|
|
18776
|
+
const s = await this.deps.skills.show(route.credential, name);
|
|
18777
|
+
const chars = Array.from(s.content);
|
|
18778
|
+
const body = chars.length > SHOW_MAX ? `${chars.slice(0, SHOW_MAX).join("")}
|
|
18779
|
+
\u2026` : s.content;
|
|
18780
|
+
const parts2 = [
|
|
18781
|
+
t4.showHead({ name: s.name, version: s.version, state: this.state(s, lang) }),
|
|
18782
|
+
s.description,
|
|
18783
|
+
"```",
|
|
18784
|
+
body,
|
|
18785
|
+
"```"
|
|
18786
|
+
];
|
|
18787
|
+
if (s.fileList.length) parts2.push(t4.showFiles({ files: s.fileList.map((f) => f.path).join(", ") }));
|
|
18788
|
+
await route.conversation.send(richMessage(parts2.join("\n")));
|
|
18789
|
+
}
|
|
18790
|
+
async act(route, act, name, lang) {
|
|
18791
|
+
const t4 = skillText.in(lang);
|
|
18792
|
+
const { skills, store } = this.deps;
|
|
18793
|
+
const before = (await skills.list(route.credential)).find((s) => s.name === name);
|
|
18794
|
+
if (before === void 0) {
|
|
18795
|
+
await route.conversation.send(textMessage(t4.notFound({ name })));
|
|
18796
|
+
return;
|
|
18797
|
+
}
|
|
18798
|
+
const change = act === "delete" ? await skills.remove(route.credential, name) : await skills.setEnabled(route.credential, name, act === "enable");
|
|
18799
|
+
if (!change.changed) {
|
|
18800
|
+
await route.conversation.send(textMessage(t4.already({ name, on: act === "enable" ? t4.on : t4.off })));
|
|
18801
|
+
return;
|
|
18802
|
+
}
|
|
18803
|
+
const kind = act === "delete" ? "deleted" : act === "enable" ? "enabled" : "disabled";
|
|
18804
|
+
const cardId = change.changeId ? store.assistantButtons.addConfirmCard(route.sender.id, change.changeId, SKILL_UNDO_KIND, name) : "";
|
|
18805
|
+
const skill = skillCardOfSkill(before, kind, change.changeId);
|
|
18806
|
+
const title = kind === "deleted" ? t4.deletedTitle({ name }) : kind === "enabled" ? t4.enabledTitle({ name }) : t4.disabledTitle({ name });
|
|
18807
|
+
await route.conversation.send(
|
|
18808
|
+
viewMessage2({ name: "skillCard", model: { skill, cardId, allowLabel: "", note: "", ended: false, lang } }, title)
|
|
18809
|
+
);
|
|
18810
|
+
}
|
|
18811
|
+
};
|
|
18812
|
+
|
|
18351
18813
|
// packages/core/src/text/neutral.ts
|
|
18352
18814
|
function isControl(ch) {
|
|
18353
18815
|
const code3 = ch.codePointAt(0) ?? 0;
|
|
@@ -27162,7 +27624,7 @@ var RUNNING_MARK2 = "\u23F3";
|
|
|
27162
27624
|
var STYLE_CHARS = /[*_`~]/g;
|
|
27163
27625
|
function boundedBody(paragraphs, budget) {
|
|
27164
27626
|
let body = "";
|
|
27165
|
-
let
|
|
27627
|
+
let clipped2 = false;
|
|
27166
27628
|
for (let i = paragraphs.length - 1; i >= 0; i -= 1) {
|
|
27167
27629
|
const paragraph = paragraphs[i] ?? "";
|
|
27168
27630
|
const joined = body ? `${paragraph}
|
|
@@ -27172,14 +27634,14 @@ ${body}` : paragraph;
|
|
|
27172
27634
|
body = joined;
|
|
27173
27635
|
continue;
|
|
27174
27636
|
}
|
|
27175
|
-
|
|
27637
|
+
clipped2 = true;
|
|
27176
27638
|
if (!body) body = pyLstrip(cpSlice(paragraph, -budget));
|
|
27177
27639
|
break;
|
|
27178
27640
|
}
|
|
27179
|
-
if (
|
|
27641
|
+
if (clipped2) body = `...
|
|
27180
27642
|
|
|
27181
27643
|
${body}`;
|
|
27182
|
-
if (body.split("```").length % 2 === 0) body =
|
|
27644
|
+
if (body.split("```").length % 2 === 0) body = clipped2 ? `\`\`\`
|
|
27183
27645
|
${body}` : `${body}
|
|
27184
27646
|
\`\`\``;
|
|
27185
27647
|
return body;
|
|
@@ -27278,8 +27740,8 @@ var RemoteLiveView = class {
|
|
|
27278
27740
|
return pyStrip(inertAnswer(splitErrorTail(masked2(block.text)).kept));
|
|
27279
27741
|
case "thought": {
|
|
27280
27742
|
const flat2 = inertAnswer(squashSpaces(masked2(block.text).replace(STYLE_CHARS, " ")));
|
|
27281
|
-
const
|
|
27282
|
-
return pyStrip(
|
|
27743
|
+
const clipped2 = cpLength(flat2) <= THOUGHT_MAX ? flat2 : "\u2026" + pyLstrip(cpSlice(flat2, -(THOUGHT_MAX - 1)));
|
|
27744
|
+
return pyStrip(clipped2) ? `_\u{1F4AD} ${pyStrip(clipped2)}_` : "";
|
|
27283
27745
|
}
|
|
27284
27746
|
case "failed":
|
|
27285
27747
|
return remoteText.in(this.lang).stepFailed({ title: neutral2(block.text, TOOL_TITLE_MAX) });
|
|
@@ -28957,7 +29419,7 @@ var ChatState = class {
|
|
|
28957
29419
|
return "en";
|
|
28958
29420
|
}
|
|
28959
29421
|
}
|
|
28960
|
-
/**
|
|
29422
|
+
/** PA_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
|
|
28961
29423
|
directOn(chatKey) {
|
|
28962
29424
|
return !isGroupKey(chatKey) && this.ctx.directChat.on(chatKey);
|
|
28963
29425
|
}
|
|
@@ -31736,7 +32198,7 @@ var FollowControl = class {
|
|
|
31736
32198
|
for (const chatKey of [...this.state.chats.followers.keys()]) this.drop(chatKey);
|
|
31737
32199
|
}
|
|
31738
32200
|
/**
|
|
31739
|
-
*
|
|
32201
|
+
* PA_DIRECT_CHAT is on for this person: an attachment that still has the session card as its window is moved to the chat,
|
|
31740
32202
|
* here and in the store, so nothing reads it as a card any more (the card itself is left where it is).
|
|
31741
32203
|
*/
|
|
31742
32204
|
chatIsWindow(chatKey) {
|
|
@@ -33521,6 +33983,7 @@ export {
|
|
|
33521
33983
|
LABEL_MAX,
|
|
33522
33984
|
LANGS,
|
|
33523
33985
|
LAST_TURNS,
|
|
33986
|
+
LIMIT_ENV_PREFIX,
|
|
33524
33987
|
LIMIT_REASONS,
|
|
33525
33988
|
LINK_CODE_TTL_SECONDS,
|
|
33526
33989
|
LOG_LINES,
|
|
@@ -33642,6 +34105,11 @@ export {
|
|
|
33642
34105
|
SENSITIVE_OPERATION_NAMES,
|
|
33643
34106
|
SESSION_HISTORY_KEEP,
|
|
33644
34107
|
SESSION_LIST,
|
|
34108
|
+
SKILL_EDIT_CONTENT,
|
|
34109
|
+
SKILL_EDIT_DESCRIPTION,
|
|
34110
|
+
SKILL_EDIT_MAX,
|
|
34111
|
+
SKILL_UNDO_KIND,
|
|
34112
|
+
SKILL_VERB,
|
|
33645
34113
|
STATS_INTERVAL_SECONDS,
|
|
33646
34114
|
SUMMARY_MAX2 as SUMMARY_MAX,
|
|
33647
34115
|
SURFACE_CHANNEL,
|
|
@@ -33649,6 +34117,8 @@ export {
|
|
|
33649
34117
|
SayPlanner,
|
|
33650
34118
|
SecretsUnavailable,
|
|
33651
34119
|
SecurityLog,
|
|
34120
|
+
SkillCardClicks,
|
|
34121
|
+
SkillsCommand,
|
|
33652
34122
|
SseFrames,
|
|
33653
34123
|
Subscriptions as SubscriptionKeeper,
|
|
33654
34124
|
TAG,
|
|
@@ -34000,6 +34470,7 @@ export {
|
|
|
34000
34470
|
showButton,
|
|
34001
34471
|
shown,
|
|
34002
34472
|
silentLogger,
|
|
34473
|
+
skillText,
|
|
34003
34474
|
slug,
|
|
34004
34475
|
sortedCp,
|
|
34005
34476
|
splitErrorTail,
|