@wirecat/drive-cli 0.52.0 → 0.53.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/README.md +2 -2
- package/dist/bin/drive.js +2 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/bundle/{chunk-ZWSG7OCA.js → all-profiles-WRN35CUF.js} +11 -6
- package/dist/bundle/{anthropic-KW6KU36Y.js → anthropic-DZASXWG3.js} +1 -1
- package/dist/bundle/{app-server-TCJZ333E.js → app-server-4VHT7QZN.js} +33 -41
- package/dist/bundle/{bun-sqlite-RI7DR6RZ.js → bun-sqlite-2GOM5PM3.js} +1 -1
- package/dist/bundle/{chunk-LONV6HIK.js → chunk-2HHOMN2G.js} +440 -25
- package/dist/bundle/{chunk-4A2PIGC6.js → chunk-2PVDFLJJ.js} +8 -3
- package/dist/bundle/{chunk-725OHXKR.js → chunk-3RYX7IB6.js} +2218 -30
- package/dist/bundle/{chunk-CB7SBYLO.js → chunk-54BYJQ77.js} +41 -21
- package/dist/bundle/{chunk-5FONRUG6.js → chunk-5D4AEUVA.js} +1 -23
- package/dist/bundle/{chunk-RNSP57TC.js → chunk-6BNALDGA.js} +1 -1
- package/dist/bundle/{chunk-H47W2J6S.js → chunk-6XYGTRMQ.js} +812 -381
- package/dist/bundle/{chunk-UR32UWTQ.js → chunk-7IUMHMTP.js} +11 -0
- package/dist/bundle/{chunk-W7IK7E4B.js → chunk-BEL4XZ3M.js} +5 -7
- package/dist/bundle/{chunk-43QVYW3K.js → chunk-CL4GVCXS.js} +230 -56
- package/dist/bundle/{chunk-PQYVPCJ2.js → chunk-CNKILAWA.js} +18 -24
- package/dist/bundle/chunk-DOZOLBXE.js +110 -0
- package/dist/bundle/{chunk-2AUXBJRX.js → chunk-DT2YCB2V.js} +84 -11
- package/dist/bundle/{chunk-HQVJK5E7.js → chunk-DZMK255Y.js} +210 -357
- package/dist/bundle/{chunk-G6QF5KWF.js → chunk-E6XDFMRZ.js} +22 -28
- package/dist/bundle/{chunk-DW46P2DY.js → chunk-EKFEY3KP.js} +1 -1
- package/dist/bundle/{chunk-54O62JWP.js → chunk-F3KHUJEE.js} +24 -5
- package/dist/bundle/{chunk-I7UH5CTA.js → chunk-FXWBUTR7.js} +7 -9
- package/dist/bundle/{chunk-ZNZUZGSV.js → chunk-GE4DP24O.js} +131 -4
- package/dist/bundle/{chunk-PEOCBV2Z.js → chunk-GPJEYW2J.js} +1 -1
- package/dist/bundle/{chunk-A4UNTWAX.js → chunk-HM352LJR.js} +84 -15
- package/dist/bundle/{chunk-KYVXMEBC.js → chunk-IAQ4L6SM.js} +1 -1
- package/dist/bundle/{chunk-PQJYM5ES.js → chunk-IJFZKQC4.js} +1 -1
- package/dist/bundle/{chunk-O6IOL6RX.js → chunk-KPBCGUJC.js} +1 -1
- package/dist/bundle/{chunk-XOLQSCMF.js → chunk-KXMJE3XC.js} +2 -2
- package/dist/bundle/{chunk-33NVQGUY.js → chunk-LSGAJYVN.js} +2 -2
- package/dist/bundle/{chunk-2UIMEMWU.js → chunk-MK3N7WX7.js} +1 -1
- package/dist/bundle/{chunk-IDUNJCFO.js → chunk-OQMK6WXQ.js} +1 -1
- package/dist/bundle/{chunk-CM7GAXGD.js → chunk-PC4UA6UN.js} +1 -1
- package/dist/bundle/{chunk-YNFELLNQ.js → chunk-PIMMF67N.js} +2 -2
- package/dist/bundle/{chunk-WBTVGFXI.js → chunk-PR3DA7KA.js} +9 -9
- package/dist/bundle/{chunk-VJZST5RD.js → chunk-QXYGK6G5.js} +1 -1
- package/dist/bundle/{chunk-WQJBAWQP.js → chunk-R4TE4ZSD.js} +549 -224
- package/dist/bundle/{chunk-BSSCTWWK.js → chunk-RNIHKIQP.js} +1 -1
- package/dist/bundle/{chunk-PAXKALHV.js → chunk-SIWBUGBU.js} +116 -5
- package/dist/bundle/{chunk-2623YE5I.js → chunk-SQHPJBNO.js} +6 -8
- package/dist/bundle/chunk-SVTYS36O.js +5305 -0
- package/dist/bundle/{chunk-WLFUBNFX.js → chunk-T334CFU4.js} +2 -2
- package/dist/bundle/{chunk-UC22Q5KU.js → chunk-TZLO3ZZF.js} +16 -16
- package/dist/bundle/{chunk-5PLJKSG4.js → chunk-UFWK3L5Z.js} +4 -6
- package/dist/bundle/{chunk-FCJAHD4R.js → chunk-VTWADVEQ.js} +2 -2
- package/dist/bundle/{chunk-HX7Y2ASG.js → chunk-WJRJBQIM.js} +26040 -15126
- package/dist/bundle/{chunk-VSOLLTYT.js → chunk-YLKQSVLI.js} +5 -0
- package/dist/bundle/{chunk-IWFBAWZK.js → chunk-YQOVVCIA.js} +282 -10
- package/dist/bundle/{chunk-7YMDL4JQ.js → chunk-ZG6X24ON.js} +4 -1
- package/dist/bundle/{command-contract-I2YB5IXI.js → command-contract-D4UG3D33.js} +12 -15
- package/dist/bundle/{decode-EDN2ARXZ.js → decode-WAPM2VBH.js} +1 -1
- package/dist/bundle/drive.js +10 -21
- package/dist/bundle/{embed-3GSQIQXE.js → embed-HW3N3KNP.js} +4 -4
- package/dist/bundle/{embedder-6ULWRG3R.js → embedder-7WNFXYYP.js} +4 -4
- package/dist/bundle/{entry-IPRJLFHO.js → entry-J7YIRDPD.js} +4 -4
- package/dist/bundle/{first-run-FGHGWHC2.js → first-run-53CL2IYH.js} +6 -6
- package/dist/bundle/{first-screen-M62KTPZG.js → first-screen-2KT7HM2K.js} +13 -16
- package/dist/bundle/{google-BD3ZNFVJ.js → google-5NNVARNR.js} +2 -2
- package/dist/bundle/{chunk-GR5GGZKH.js → google-api-EQQH53QD.js} +60 -4
- package/dist/bundle/grants-4NETZ4MR.js +98 -0
- package/dist/bundle/{identity-QLBSASO5.js → identity-LBTXDMTA.js} +4 -2
- package/dist/bundle/{login-VNZKRSAD.js → login-Y6ENYKC3.js} +50 -52
- package/dist/bundle/{node-sqlite-J3OODPYK.js → node-sqlite-FSQIKGED.js} +1 -1
- package/dist/bundle/{oauth-L4VTCBLF.js → oauth-HF5USWXY.js} +5 -5
- package/dist/bundle/{open-SGUN7ZVF.js → open-NHGJENCX.js} +2 -2
- package/dist/bundle/{openai-RLVISEDH.js → openai-3JCJYKNX.js} +6 -6
- package/dist/bundle/{program-6S5EH7BS.js → program-QAJ66K3Z.js} +715 -904
- package/dist/bundle/{prompt-AUWTBLO7.js → prompt-LQJBCCUF.js} +3 -3
- package/dist/bundle/{reasons-M5AKCNCU.js → reasons-J57GSRWN.js} +1 -1
- package/dist/bundle/{recognize-ORX2UBQW.js → recognize-QM3LN4ZF.js} +1 -1
- package/dist/bundle/{remote-AGIJY73X.js → remote-WREGEZJQ.js} +5 -5
- package/dist/bundle/{rerank-R6PE44M5.js → rerank-YFUB6J6M.js} +4 -4
- package/dist/bundle/{chunk-G7DCVJ4F.js → serve-7NFEZ564.js} +7 -4
- package/dist/bundle/{chunk-F7UUZATI.js → server-KBCFZ2AU.js} +38 -11
- package/dist/bundle/server-UYVL2CFI.js +63 -0
- package/dist/bundle/{services-HZFTTZSF.js → services-C3XWRA2W.js} +16 -21
- package/dist/bundle/{sqlite-runtime-DTGPR2T2.js → sqlite-runtime-H3TSAMIN.js} +3 -3
- package/dist/bundle/{state-WG3JKJM3.js → state-S2Q53L6L.js} +3 -3
- package/dist/bundle/{store-33VHIMEO.js → store-H345VQHP.js} +6 -8
- package/dist/bundle/{store-EV72MT5U.js → store-I27LAJPU.js} +7 -9
- package/dist/bundle/store-maintenance-command-3XA73XMC.js +52 -0
- package/dist/bundle/{chunk-GNI7INK6.js → terminal-DHJ4D3BC.js} +2 -3
- package/dist/bundle/tokens-7MUGKFEM.js +96 -0
- package/dist/commands/context.d.ts +14 -13
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +1 -4
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/mirrors.d.ts.map +1 -1
- package/dist/commands/mirrors.js +1 -2
- package/dist/commands/mirrors.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +2 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/upgrade.d.ts +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +4 -9
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/config.d.ts +182 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +38 -3
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +0 -3
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +0 -234
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.d.ts +3 -2
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +17 -22
- package/dist/first-screen.js.map +1 -1
- package/dist/grants.d.ts +9 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +30 -0
- package/dist/grants.js.map +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +2 -0
- package/dist/identity.js.map +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +7 -3
- package/dist/login.js.map +1 -1
- package/dist/policy-keys.d.ts +12 -0
- package/dist/policy-keys.d.ts.map +1 -0
- package/dist/policy-keys.js +107 -0
- package/dist/policy-keys.js.map +1 -0
- package/dist/policy.d.ts +1 -8
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +2 -105
- package/dist/policy.js.map +1 -1
- package/dist/program.d.ts +8 -4
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +251 -222
- package/dist/program.js.map +1 -1
- package/dist/reasons.js +1 -1
- package/dist/reasons.js.map +1 -1
- package/dist/testing/mcp.d.ts +28 -0
- package/dist/testing/mcp.d.ts.map +1 -0
- package/dist/testing/mcp.js +56 -0
- package/dist/testing/mcp.js.map +1 -0
- package/dist/tokens.d.ts +0 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -13
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/scenarios/agent-access.md +4 -2
- package/dist/bundle/all-profiles-CYW6XBBS.js +0 -26
- package/dist/bundle/chunk-234MHU76.js +0 -384
- package/dist/bundle/chunk-4CPLOMRK.js +0 -1714
- package/dist/bundle/chunk-4Z6TCU5T.js +0 -9
- package/dist/bundle/chunk-DO4PDQY5.js +0 -48
- package/dist/bundle/chunk-FDWYPONW.js +0 -1988
- package/dist/bundle/chunk-FQRJWVEB.js +0 -2
- package/dist/bundle/chunk-NPSZPUK6.js +0 -193
- package/dist/bundle/chunk-PDGECM5D.js +0 -138
- package/dist/bundle/chunk-Q765VPZY.js +0 -421
- package/dist/bundle/chunk-WQRGA75U.js +0 -256
- package/dist/bundle/chunk-X6ID5EAR.js +0 -522
- package/dist/bundle/chunk-YVPHJHIL.js +0 -15572
- package/dist/bundle/chunk-Z47LOJUS.js +0 -484
- package/dist/bundle/failure-4CVEVY45.js +0 -37
- package/dist/bundle/google-api-BDUWZMRV.js +0 -83
- package/dist/bundle/mcp-5SNSMI2M.js +0 -502
- package/dist/bundle/mcp-JZSYPQA4.js +0 -96
- package/dist/bundle/serve-VOBAQHAQ.js +0 -20
- package/dist/bundle/server-24PS4M7U.js +0 -70
- package/dist/bundle/server-G6HFZ2CK.js +0 -57
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +0 -58
- package/dist/bundle/terminal-TFCTWLOS.js +0 -11
- package/dist/bundle/tokens-XDQXUFDQ.js +0 -104
- package/dist/commands/doctor.d.ts +0 -56
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -75
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -6
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -156
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/skill.d.ts +0 -6
- package/dist/commands/skill.d.ts.map +0 -1
- package/dist/commands/skill.js +0 -34
- package/dist/commands/skill.js.map +0 -1
- package/dist/failure.d.ts +0 -88
- package/dist/failure.d.ts.map +0 -1
- package/dist/failure.js +0 -60
- package/dist/failure.js.map +0 -1
- package/dist/mcp.d.ts +0 -175
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -412
- package/dist/mcp.js.map +0 -1
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
stringWidth,
|
|
5
|
-
wrapAnsi
|
|
6
|
-
} from "./chunk-HTQTIKWP.js";
|
|
7
|
-
import {
|
|
8
|
-
singleLine,
|
|
9
|
-
visibleControls
|
|
10
|
-
} from "./chunk-HQVJK5E7.js";
|
|
11
|
-
import {
|
|
12
|
-
__name
|
|
13
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
-
|
|
15
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
16
|
-
import { styleText } from "node:util";
|
|
17
|
-
var TIME_WIDTH = 8;
|
|
18
|
-
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
19
|
-
var MIN_WIDTH = 40;
|
|
20
|
-
var SENDER_COLOURS = ["green", "yellow", "magenta", "blue", "red"];
|
|
21
|
-
var renderMessages = /* @__PURE__ */ __name((messages, options = {}) => {
|
|
22
|
-
if (messages.length === 0)
|
|
23
|
-
return "(nothing)";
|
|
24
|
-
const day = dayFormatter(options);
|
|
25
|
-
const paint = painter(options);
|
|
26
|
-
let previous;
|
|
27
|
-
const blocks = [];
|
|
28
|
-
for (const message of messages) {
|
|
29
|
-
const date = day(message.timestamp);
|
|
30
|
-
if (date !== previous)
|
|
31
|
-
blocks.push(paint("dim", `\u2500\u2500 ${date} \u2500\u2500`));
|
|
32
|
-
previous = date;
|
|
33
|
-
blocks.push(renderMessage(message, options));
|
|
34
|
-
}
|
|
35
|
-
return blocks.join("\n\n");
|
|
36
|
-
}, "renderMessages");
|
|
37
|
-
var renderMessage = /* @__PURE__ */ __name((message, options = {}) => {
|
|
38
|
-
const paint = painter(options);
|
|
39
|
-
const width = Math.max(MIN_WIDTH, options.width ?? 80);
|
|
40
|
-
const room = width - INDENT.length;
|
|
41
|
-
const time = timeFormatter(options);
|
|
42
|
-
const verbosity = options.verbosity ?? 0;
|
|
43
|
-
const chat = "chatTitle" in message ? paint("dim", ` \xB7 ${singleLine(message.chatTitle ?? message.chatId)}`) : "";
|
|
44
|
-
const mark = "anchor" in message && message.anchor ? paint("bold", " \u25C0") : "";
|
|
45
|
-
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message, options)}${chat}${mark}`];
|
|
46
|
-
const body = /* @__PURE__ */ __name((text) => wrapAnsi(visibleControls(text), room, { hard: true }).split("\n"), "body");
|
|
47
|
-
const email = message.email;
|
|
48
|
-
if (email)
|
|
49
|
-
lines.push(paint("dim", mailLine(email)));
|
|
50
|
-
if (message.replyTo)
|
|
51
|
-
lines.push(paint("dim", preview("\u21B3", message.replyTo, room, options)));
|
|
52
|
-
if (message.forwardedFrom) {
|
|
53
|
-
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom, options)}`));
|
|
54
|
-
if (message.forwardedFrom.text)
|
|
55
|
-
for (const line of body(message.forwardedFrom.text))
|
|
56
|
-
lines.push(line);
|
|
57
|
-
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint, options));
|
|
58
|
-
}
|
|
59
|
-
if (message.text)
|
|
60
|
-
for (const line of body(message.text))
|
|
61
|
-
lines.push(line);
|
|
62
|
-
lines.push(...attachmentLines(message.attachments, paint, options));
|
|
63
|
-
if (message.reactions && message.reactions.total > 0)
|
|
64
|
-
lines.push(paint("dim", reactionLine(message.reactions)));
|
|
65
|
-
if (message.editedAt)
|
|
66
|
-
lines.push(paint("dim", `edited ${editedAt(message, options)}`));
|
|
67
|
-
if (verbosity >= 1) {
|
|
68
|
-
const fields = [
|
|
69
|
-
["message", message.id],
|
|
70
|
-
["sender", message.senderId],
|
|
71
|
-
["chat", message.chatId],
|
|
72
|
-
["reply to", message.replyTo?.id ?? message.replyToId],
|
|
73
|
-
["thread", message.threadId],
|
|
74
|
-
["forward of", message.forwardedFrom?.id],
|
|
75
|
-
...message.attachments.map((a) => ["link", a.url])
|
|
76
|
-
];
|
|
77
|
-
if (verbosity >= 2) {
|
|
78
|
-
fields.push(["provider", options.provider], ["profile", options.profile], ["sent", message.timestamp], ["edited", message.editedAt], ["outgoing", message.outgoing === null ? "unknown" : String(message.outgoing)], ...message.attachments.map((a) => ["attachment", JSON.stringify(a)]), ["metadata", message.providerMetadata && JSON.stringify(message.providerMetadata)]);
|
|
79
|
-
}
|
|
80
|
-
const shown = fields.filter((field) => typeof field[1] === "string");
|
|
81
|
-
const label = Math.max(...shown.map(([key]) => key.length));
|
|
82
|
-
lines.push("", ...shown.map(([key, value]) => paint("dim", `${key.padEnd(label)} ${singleLine(value)}`)));
|
|
83
|
-
}
|
|
84
|
-
return lines.map((line, index) => index === 0 || line === "" ? line : `${INDENT}${line}`).join("\n");
|
|
85
|
-
}, "renderMessage");
|
|
86
|
-
var mailLine = /* @__PURE__ */ __name(({ to, cc, labels }) => {
|
|
87
|
-
const names = /* @__PURE__ */ __name((people) => people.map(({ name, address }) => singleLine(name ?? address)).join(", "), "names");
|
|
88
|
-
return [to.length ? `to ${names(to)}` : "", cc.length ? `cc ${names(cc)}` : "", labels.join(", ")].filter(Boolean).join(" \xB7 ");
|
|
89
|
-
}, "mailLine");
|
|
90
|
-
var painter = /* @__PURE__ */ __name(({ color = false }) => (style, text) => color ? styleText(style, text, { validateStream: false }) : text, "painter");
|
|
91
|
-
var senderOf = /* @__PURE__ */ __name((message, options) => {
|
|
92
|
-
const paint = painter(options);
|
|
93
|
-
if (message.outgoing === true)
|
|
94
|
-
return paint(["bold", "cyan"], you(options));
|
|
95
|
-
const name = nameOf(message, options);
|
|
96
|
-
if (!options.senderColors)
|
|
97
|
-
return paint("bold", name);
|
|
98
|
-
const colour = SENDER_COLOURS[hash(message.senderId ?? name) % SENDER_COLOURS.length] ?? "green";
|
|
99
|
-
return paint(["bold", colour], name);
|
|
100
|
-
}, "senderOf");
|
|
101
|
-
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing }, options) => outgoing === true ? you(options) : singleLine(senderName ?? senderId ?? "unknown"), "nameOf");
|
|
102
|
-
var DEFAULT_LOCALE = "ru-RU";
|
|
103
|
-
var you = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE }) => locale.startsWith("ru") ? "\u0432\u044B" : "you", "you");
|
|
104
|
-
var hash = /* @__PURE__ */ __name((value) => [...value].reduce((sum, char) => sum * 31 + char.charCodeAt(0) >>> 0, 7), "hash");
|
|
105
|
-
var preview = /* @__PURE__ */ __name((mark, quoted, room, options) => {
|
|
106
|
-
const text = singleLine(quoted.text.split("\n")[0] ?? "") || (quoted.attachments[0] ? `\u{1F4CE} ${quoted.attachments[0].kind}` : "");
|
|
107
|
-
const line = text ? `${mark} ${nameOf(quoted, options)}: ${text}` : `${mark} message ${quoted.id}`;
|
|
108
|
-
if (stringWidth(line) <= room)
|
|
109
|
-
return line;
|
|
110
|
-
return `${wrapAnsi(line, room - 1, { hard: true }).split("\n")[0]}\u2026`;
|
|
111
|
-
}, "preview");
|
|
112
|
-
var attachmentLines = /* @__PURE__ */ __name((attachments, paint, options) => {
|
|
113
|
-
const link = /* @__PURE__ */ __name((label, raw) => {
|
|
114
|
-
if (raw === void 0)
|
|
115
|
-
return label;
|
|
116
|
-
const url = singleLine(raw);
|
|
117
|
-
return options.color ? `\x1B]8;;${url}\x07${label}\x1B]8;;\x07` : `${label} ${url}`;
|
|
118
|
-
}, "link");
|
|
119
|
-
let number = 0;
|
|
120
|
-
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++number} ${singleLine(button.text)}]`, button.url)).join(" ")));
|
|
121
|
-
const polls = attachments.flatMap((attachment) => attachment.poll ? pollLines(attachment.poll) : []);
|
|
122
|
-
const cards = attachments.flatMap(({ contact }) => contact ? [
|
|
123
|
-
paint("dim", `\u{1F464} ${[contact.name, contact.phone].flatMap((part) => part ? [singleLine(part)] : []).join(" \xB7 ")}`)
|
|
124
|
-
] : []);
|
|
125
|
-
const groups = /* @__PURE__ */ new Map();
|
|
126
|
-
for (const attachment of attachments) {
|
|
127
|
-
if (attachment.buttons || attachment.poll || attachment.contact)
|
|
128
|
-
continue;
|
|
129
|
-
const key = singleLine(attachment.name ?? attachment.title ?? attachment.kind);
|
|
130
|
-
groups.set(key, [...groups.get(key) ?? [], attachment]);
|
|
131
|
-
}
|
|
132
|
-
const files = [...groups].map(([label, same]) => {
|
|
133
|
-
const first = same[0];
|
|
134
|
-
const size = first?.size === void 0 ? "" : ` \xB7 ${megabytes(first.size)}`;
|
|
135
|
-
if (same.length === 1)
|
|
136
|
-
return paint("dim", `\u{1F4CE} ${link(`${label}${size}`, first?.url)}`);
|
|
137
|
-
const each = same.map((attachment, index) => link(String(index + 1), attachment.url)).join(" ");
|
|
138
|
-
return paint("dim", `\u{1F4CE} ${label} \xD7${same.length} ${each}`);
|
|
139
|
-
});
|
|
140
|
-
return [...polls, ...cards, ...files, ...keyboard];
|
|
141
|
-
}, "attachmentLines");
|
|
142
|
-
var pollLines = /* @__PURE__ */ __name((poll) => {
|
|
143
|
-
const kind = [
|
|
144
|
-
poll.closed ? "closed" : "",
|
|
145
|
-
poll.multiple ? "several answers" : "",
|
|
146
|
-
poll.anonymous ? "anonymous" : "",
|
|
147
|
-
poll.quiz ? "quiz" : ""
|
|
148
|
-
].filter(Boolean);
|
|
149
|
-
const count = /* @__PURE__ */ __name((voters) => voters === null ? "?" : String(voters), "count");
|
|
150
|
-
return [
|
|
151
|
-
`\u{1F4CA} ${visibleControls(poll.question)}`,
|
|
152
|
-
...poll.answers.map((answer) => ` [${answer.id}] ${visibleControls(answer.text)} \u2014 ${count(answer.voters)}${answer.chosen ? " \u2713" : ""}`),
|
|
153
|
-
` ${[`${count(poll.voters)} voted`, ...kind].join(" \xB7 ")}`
|
|
154
|
-
];
|
|
155
|
-
}, "pollLines");
|
|
156
|
-
var megabytes = /* @__PURE__ */ __name((bytes) => bytes >= 1e6 ? `${Math.round(bytes / 1e6)} MB` : `${Math.max(1, Math.round(bytes / 1e3))} KB`, "megabytes");
|
|
157
|
-
var parts = /* @__PURE__ */ __name((format, iso) => Object.fromEntries(format.formatToParts(new Date(iso)).map(({ type, value }) => [type, value])), "parts");
|
|
158
|
-
var timeFormatter = /* @__PURE__ */ __name(({ timeZone }) => {
|
|
159
|
-
const format = new Intl.DateTimeFormat("en-GB", {
|
|
160
|
-
hour: "2-digit",
|
|
161
|
-
minute: "2-digit",
|
|
162
|
-
second: "2-digit",
|
|
163
|
-
hourCycle: "h23",
|
|
164
|
-
...timeZone ? { timeZone } : {}
|
|
165
|
-
});
|
|
166
|
-
return (iso) => {
|
|
167
|
-
const { hour, minute, second } = parts(format, iso);
|
|
168
|
-
return `${hour}:${minute}:${second}`;
|
|
169
|
-
};
|
|
170
|
-
}, "timeFormatter");
|
|
171
|
-
var dayFormatter = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE, timeZone }) => {
|
|
172
|
-
const format = new Intl.DateTimeFormat(locale, {
|
|
173
|
-
day: "numeric",
|
|
174
|
-
month: "long",
|
|
175
|
-
year: "numeric",
|
|
176
|
-
...timeZone ? { timeZone } : {}
|
|
177
|
-
});
|
|
178
|
-
return (iso) => format.format(new Date(iso)).replace(/\s*г\.$/, "");
|
|
179
|
-
}, "dayFormatter");
|
|
180
|
-
var reactionLine = /* @__PURE__ */ __name(({ counts, mine }) => {
|
|
181
|
-
const shown = counts.map(({ reaction, count }) => `${singleLine(reaction)} ${count}`).join(" ");
|
|
182
|
-
return mine ? `${shown} (you: ${singleLine(mine)})` : shown;
|
|
183
|
-
}, "reactionLine");
|
|
184
|
-
var editedAt = /* @__PURE__ */ __name((message, options) => {
|
|
185
|
-
const edited = message.editedAt ?? message.timestamp;
|
|
186
|
-
const time = timeFormatter(options)(edited);
|
|
187
|
-
const day = dayFormatter(options);
|
|
188
|
-
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
189
|
-
}, "editedAt");
|
|
190
|
-
|
|
191
|
-
export {
|
|
192
|
-
renderMessages
|
|
193
|
-
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
CliError
|
|
5
|
-
} from "./chunk-YKZ4IPLB.js";
|
|
6
|
-
import {
|
|
7
|
-
__name
|
|
8
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
-
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/tasks/model.js
|
|
11
|
-
var TASK_KINDS = ["question", "request", "mention", "promise"];
|
|
12
|
-
var TASK_STATES = ["open", "done", "dismissed"];
|
|
13
|
-
var TASK_ORIGINS = ["rule", "agent", "owner"];
|
|
14
|
-
var TASK_VERDICTS = ["useful", "not_useful"];
|
|
15
|
-
function closeTask(task, state, by, at, reason) {
|
|
16
|
-
if (task.state !== "open")
|
|
17
|
-
throw new CliError("validation_error", `task ${task.id} is already ${task.state}`, { reason: "task.closed" });
|
|
18
|
-
const { claimedBy: _by, claimedUntil: _until, ...unclaimed } = task;
|
|
19
|
-
return { ...unclaimed, state, closedAt: at, closedBy: by, ...reason === void 0 ? {} : { reason } };
|
|
20
|
-
}
|
|
21
|
-
__name(closeTask, "closeTask");
|
|
22
|
-
|
|
23
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/tasks/service.js
|
|
24
|
-
function createTaskService({ store, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now"), newId = /* @__PURE__ */ __name(() => crypto.randomUUID(), "newId") }) {
|
|
25
|
-
async function find(id) {
|
|
26
|
-
const task = await store.get(id);
|
|
27
|
-
if (!task)
|
|
28
|
-
throw new CliError("not_found", `no task ${id}`);
|
|
29
|
-
return task;
|
|
30
|
-
}
|
|
31
|
-
__name(find, "find");
|
|
32
|
-
return {
|
|
33
|
-
/**
|
|
34
|
-
* A rule never makes a second task from a source it has seen, whatever that task's state, so a
|
|
35
|
-
* dismissed one stays dismissed — nor from a message attached or merged into a task. A person or an agent may
|
|
36
|
-
* add a task of another kind to it. A task a rule opens goes through the host's duplicate check.
|
|
37
|
-
*/
|
|
38
|
-
async add(input) {
|
|
39
|
-
const rule = input.origin === "rule";
|
|
40
|
-
const existing = await store.findBySource(input.account, input.source, rule ? { linked: true } : void 0);
|
|
41
|
-
const same = rule ? existing[0] : existing.find((task2) => task2.kind === input.kind);
|
|
42
|
-
if (same)
|
|
43
|
-
return { task: same, created: false };
|
|
44
|
-
const task = { ...input, id: newId(), state: "open", createdAt: now() };
|
|
45
|
-
await store.insert(task);
|
|
46
|
-
if (!rule || !store.reviewDuplicates)
|
|
47
|
-
return { task, created: true };
|
|
48
|
-
return { task, created: true, review: await store.reviewDuplicates(task.id) };
|
|
49
|
-
},
|
|
50
|
-
async close(id, { as, by, reason }) {
|
|
51
|
-
const task = closeTask(await find(id), as, by, now(), reason);
|
|
52
|
-
await store.update(task);
|
|
53
|
-
return task;
|
|
54
|
-
},
|
|
55
|
-
list: /* @__PURE__ */ __name((filter = {}) => store.list(filter), "list"),
|
|
56
|
-
async stats(filter = {}) {
|
|
57
|
-
const byGroup = /* @__PURE__ */ new Map();
|
|
58
|
-
for (const task of await store.list(filter))
|
|
59
|
-
byGroup.set(task.group, [...byGroup.get(task.group) ?? [], task]);
|
|
60
|
-
return [...byGroup].map(([group, tasks]) => {
|
|
61
|
-
const open = tasks.filter((task) => task.state === "open");
|
|
62
|
-
const closeMs = tasks.flatMap((task) => task.closedAt ? [task.closedAt.getTime() - task.createdAt.getTime()] : []);
|
|
63
|
-
const oldestOpenAt = open.map((task) => task.createdAt).sort((a, b) => a.getTime() - b.getTime())[0];
|
|
64
|
-
return {
|
|
65
|
-
group,
|
|
66
|
-
open: open.length,
|
|
67
|
-
...oldestOpenAt ? { oldestOpenAt } : {},
|
|
68
|
-
...closeMs.length > 0 ? { medianCloseMs: median(closeMs) } : {}
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
__name(createTaskService, "createTaskService");
|
|
75
|
-
function median(values) {
|
|
76
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
77
|
-
const middle = Math.floor(sorted.length / 2);
|
|
78
|
-
const upper = sorted[middle] ?? 0;
|
|
79
|
-
return sorted.length % 2 === 1 ? upper : ((sorted[middle - 1] ?? 0) + upper) / 2;
|
|
80
|
-
}
|
|
81
|
-
__name(median, "median");
|
|
82
|
-
|
|
83
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/tasks/store.js
|
|
84
|
-
function matches(task, filter) {
|
|
85
|
-
return (filter.account === void 0 || task.account === filter.account) && (filter.state === void 0 || task.state === filter.state) && (filter.group === void 0 || task.group === filter.group) && (filter.kind === void 0 || task.kind === filter.kind) && (filter.createdBefore === void 0 || task.createdAt < filter.createdBefore);
|
|
86
|
-
}
|
|
87
|
-
__name(matches, "matches");
|
|
88
|
-
|
|
89
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/knowledge.js
|
|
90
|
-
var FACT_TYPES = ["fact", "statement", "question", "decision", "promise"];
|
|
91
|
-
var FACT_STATUSES = ["proposed", "accepted", "superseded", "reversed", "rejected"];
|
|
92
|
-
var MEMORY_KINDS = ["summary", "digest", "preference"];
|
|
93
|
-
var MEMORY_STATUSES = ["proposed", "confirmed", "stale", "superseded"];
|
|
94
|
-
var MEMORY_SCOPES = ["personal", "work"];
|
|
95
|
-
var WORK_TASK_TYPES = ["bug", "feature", "chore"];
|
|
96
|
-
var TASK_TYPES = [...WORK_TASK_TYPES, ...TASK_KINDS];
|
|
97
|
-
|
|
98
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/store/sqlite/link-kinds.js
|
|
99
|
-
var LINK_KINDS = [
|
|
100
|
-
"links-to",
|
|
101
|
-
"blocked-by",
|
|
102
|
-
"follow-up-of",
|
|
103
|
-
"about",
|
|
104
|
-
"member-of",
|
|
105
|
-
"labelled",
|
|
106
|
-
"answered-by",
|
|
107
|
-
"evidence",
|
|
108
|
-
"created-from",
|
|
109
|
-
"duplicate-of",
|
|
110
|
-
"related-to",
|
|
111
|
-
"assigned-to",
|
|
112
|
-
"attached"
|
|
113
|
-
];
|
|
114
|
-
var LINK_ORIGINS = ["file", "owner", "suggested", "message"];
|
|
115
|
-
var LINK_SOURCES = [...LINK_ORIGINS, "calendar"];
|
|
116
|
-
var RELATION_KINDS = ["member-of", "related-to"];
|
|
117
|
-
var linkKind = /* @__PURE__ */ __name((kind) => `'${kind}'`, "linkKind");
|
|
118
|
-
|
|
119
|
-
export {
|
|
120
|
-
LINK_KINDS,
|
|
121
|
-
LINK_ORIGINS,
|
|
122
|
-
LINK_SOURCES,
|
|
123
|
-
RELATION_KINDS,
|
|
124
|
-
linkKind,
|
|
125
|
-
TASK_KINDS,
|
|
126
|
-
TASK_STATES,
|
|
127
|
-
TASK_ORIGINS,
|
|
128
|
-
TASK_VERDICTS,
|
|
129
|
-
createTaskService,
|
|
130
|
-
matches,
|
|
131
|
-
FACT_TYPES,
|
|
132
|
-
FACT_STATUSES,
|
|
133
|
-
MEMORY_KINDS,
|
|
134
|
-
MEMORY_STATUSES,
|
|
135
|
-
MEMORY_SCOPES,
|
|
136
|
-
WORK_TASK_TYPES,
|
|
137
|
-
TASK_TYPES
|
|
138
|
-
};
|