@wirecat/drive-cli 0.57.0 → 0.59.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/bin/drive.js +6 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/bundle/{all-profiles-7LSZ3CC3.js → all-profiles-CVISDGMF.js} +14 -9
- package/dist/bundle/{anthropic-3QRM4QXB.js → anthropic-WLNQC23G.js} +11 -7
- package/dist/bundle/{app-server-WWNMUHID.js → app-server-P2VOONXF.js} +61 -53
- package/dist/bundle/{bun-NIIYUR5F.js → bun-CDFBNTKV.js} +2 -2
- package/dist/bundle/{bun-sqlite-GSLSN3OT.js → bun-sqlite-MNZICITP.js} +8 -4
- package/dist/bundle/chunk-2AXA5SKP.js +23 -0
- package/dist/bundle/{chunk-EFEI724Z.js → chunk-36B7AIGP.js} +1 -1
- package/dist/bundle/{chunk-Q3TMNETS.js → chunk-3KJTJDDT.js} +52 -39
- package/dist/bundle/{chunk-4F2VRJZE.js → chunk-3KNZADHJ.js} +5080 -626
- package/dist/bundle/{chunk-GIQFBXQN.js → chunk-3U22QTU6.js} +12 -125
- package/dist/bundle/chunk-3VSUT6BD.js +35 -0
- package/dist/bundle/{chunk-U2RSVKR5.js → chunk-5C7K6XIT.js} +1 -1
- package/dist/bundle/{chunk-6CFSDU56.js → chunk-6C6255U6.js} +16 -14
- package/dist/bundle/{chunk-EE7R457T.js → chunk-6CQO2FIN.js} +1569 -739
- package/dist/bundle/{chunk-KHNDZNQA.js → chunk-7QTVIZII.js} +5410 -3002
- package/dist/bundle/{chunk-HNUSPNUQ.js → chunk-A6EG7ZDS.js} +13 -13
- package/dist/bundle/{chunk-WBYCUBYM.js → chunk-A6SLYOP2.js} +49 -42
- package/dist/bundle/{chunk-TR5656OS.js → chunk-AD62XJKO.js} +162 -106
- package/dist/bundle/{chunk-TKVSJV5P.js → chunk-B5GBJ35N.js} +6 -4
- package/dist/bundle/{chunk-LSSIVBQI.js → chunk-BSGOM3BD.js} +1 -1
- package/dist/bundle/{chunk-XGNADVIA.js → chunk-CBM2XAEZ.js} +28 -229
- package/dist/bundle/{chunk-OYNSFQ7K.js → chunk-D72URWJE.js} +1 -39
- package/dist/bundle/{chunk-L4BBK7UX.js → chunk-DI5Z4SH5.js} +5 -3
- package/dist/bundle/chunk-EBLA7GXY.js +45 -0
- package/dist/bundle/{chunk-4UQLL6RJ.js → chunk-EHEZSV6I.js} +11 -88
- package/dist/bundle/{chunk-6ZA4NR5H.js → chunk-EORMZCVF.js} +3 -3
- package/dist/bundle/{chunk-W5FOPSJZ.js → chunk-EVETU3TF.js} +10 -8
- package/dist/bundle/{chunk-TZHCS5MG.js → chunk-F3FOL42A.js} +2 -2
- package/dist/bundle/{chunk-2QLLKDE5.js → chunk-FICVPYE4.js} +206 -73
- package/dist/bundle/{chunk-AKPFH3KC.js → chunk-FVQCM7IQ.js} +1 -1
- package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
- package/dist/bundle/{chunk-WAVJWGUC.js → chunk-GI5JBGXH.js} +4611 -1530
- package/dist/bundle/{chunk-SRNXTXJN.js → chunk-GJ4ZCIOP.js} +3 -3
- package/dist/bundle/{chunk-GKHUHRSL.js → chunk-GT5KTGCN.js} +4 -4
- package/dist/bundle/{chunk-WJOKTIOJ.js → chunk-H2BKXPBL.js} +2 -2
- package/dist/bundle/chunk-HIOJRPCT.js +93 -0
- package/dist/bundle/chunk-HIP43OGZ.js +34 -0
- package/dist/bundle/{chunk-2ULJW5BA.js → chunk-HMZAMHKN.js} +2 -2
- package/dist/bundle/{chunk-64E6QXXQ.js → chunk-HWLLVLAB.js} +10 -10
- package/dist/bundle/{chunk-373WJIHE.js → chunk-IADOBOKB.js} +2 -2
- package/dist/bundle/{chunk-B3TPS7BW.js → chunk-IBZ3IBO4.js} +9 -7
- package/dist/bundle/{chunk-QAT6UXZZ.js → chunk-IGF6EXBR.js} +53 -48
- package/dist/bundle/{chunk-KYNTSA6K.js → chunk-II7LST64.js} +5 -5
- package/dist/bundle/{chunk-JLKNUFL2.js → chunk-IIP43FQJ.js} +2 -2
- package/dist/bundle/{chunk-ELIYJXIY.js → chunk-JSDVK3JA.js} +2 -2
- package/dist/bundle/{chunk-UKMFPBAO.js → chunk-JW2CVCUH.js} +4 -4
- package/dist/bundle/{chunk-O5KDIVGE.js → chunk-K4LXGZTE.js} +23 -21
- package/dist/bundle/{chunk-RB674T6L.js → chunk-KFZUODXB.js} +76 -20
- package/dist/bundle/chunk-KPRGTTJH.js +34 -0
- package/dist/bundle/{chunk-XJVK7ETL.js → chunk-L5SE2XZP.js} +23 -15
- package/dist/bundle/{chunk-OOR6PEHV.js → chunk-LJ7E4HLQ.js} +1 -1
- package/dist/bundle/{chunk-VTJF2L5E.js → chunk-LPHMAQJQ.js} +16 -16
- package/dist/bundle/{chunk-566W4Q6L.js → chunk-M6I2SQN7.js} +4 -4
- package/dist/bundle/{chunk-NLLWLCUZ.js → chunk-MEAPA4EZ.js} +2 -2
- package/dist/bundle/{chunk-J2HGHSLX.js → chunk-MKCNUI72.js} +4 -4
- package/dist/bundle/{chunk-CD736BG3.js → chunk-MUUHUHWC.js} +2 -1
- package/dist/bundle/{chunk-AHBUTDS7.js → chunk-OKXSTWKW.js} +8 -8
- package/dist/bundle/{chunk-W6FYYQ2J.js → chunk-OMMEQJOB.js} +3 -3
- package/dist/bundle/{chunk-EFX6FIDM.js → chunk-OZH4ALTI.js} +1 -1
- package/dist/bundle/{chunk-KM4Y55ZE.js → chunk-P3ZTW2ZM.js} +7 -7
- package/dist/bundle/{chunk-5KNIVHP6.js → chunk-P7WPYKSB.js} +7 -20
- package/dist/bundle/{chunk-RAEKC6TV.js → chunk-PAEVBAM3.js} +9 -42
- package/dist/bundle/{chunk-LBFFI6FE.js → chunk-PGKIOSN3.js} +9 -7
- package/dist/bundle/{chunk-WJPVGXKA.js → chunk-QTM7USFA.js} +8 -13
- package/dist/bundle/{chunk-EN7OZ5JH.js → chunk-TFH5X46A.js} +37 -22
- package/dist/bundle/{chunk-OZJMZSFB.js → chunk-TI55J3BA.js} +6 -4
- package/dist/bundle/{chunk-R5GJZPRF.js → chunk-TJXPJ3A5.js} +572 -366
- package/dist/bundle/chunk-UQPKAY6I.js +106 -0
- package/dist/bundle/{chunk-JUKVJ7M2.js → chunk-UWVNRPT7.js} +56 -40
- package/dist/bundle/chunk-V36RIXFA.js +201 -0
- package/dist/bundle/{chunk-JIGMCW4C.js → chunk-V42KAPU3.js} +6 -6
- package/dist/bundle/{chunk-7SNS443B.js → chunk-VT6GZAF4.js} +35 -35
- package/dist/bundle/{chunk-ISK4K7UE.js → chunk-VVCZS42A.js} +1 -1
- package/dist/bundle/chunk-W62CON5K.js +166 -0
- package/dist/bundle/{chunk-YZ6SYLDC.js → chunk-XCOCPXCM.js} +2 -2
- package/dist/bundle/{chunk-G34Y5RAC.js → chunk-YADXWQHV.js} +29 -29
- package/dist/bundle/{chunk-AL7MY7MW.js → chunk-YU3PTU3D.js} +1 -1
- package/dist/bundle/{chunk-IJ2S53WJ.js → chunk-YV4ABH6J.js} +7 -7
- package/dist/bundle/{chunk-B64EY2SC.js → chunk-ZSMCJKGP.js} +42 -41
- package/dist/bundle/chunk-ZYCLPJ7U.js +46 -0
- package/dist/bundle/command-contract-LQDNHZJU.js +39 -0
- package/dist/bundle/{decode-5MHMPYKE.js → decode-XTOMXMGN.js} +10 -6
- package/dist/bundle/dispatch-T6TW2JJB.js +412 -0
- package/dist/bundle/drive.js +40 -22
- package/dist/bundle/{echarts-CLB22SZS.js → echarts-RKKIOYVV.js} +2 -2
- package/dist/bundle/{embed-TF66ODAR.js → embed-STHKKA6G.js} +9 -5
- package/dist/bundle/{embedder-EDWOIAC2.js → embedder-3XZEWHRO.js} +14 -10
- package/dist/bundle/entry-CNOYSSSD.js +22 -0
- package/dist/bundle/failure-DNQYXP2T.js +26 -0
- package/dist/bundle/first-run-F2SI24PK.js +30 -0
- package/dist/bundle/first-screen-TYYF6VXY.js +37 -0
- package/dist/bundle/{google-A4F2WFO4.js → google-BYNSAIQI.js} +13 -9
- package/dist/bundle/{google-api-ZXGQOJUI.js → google-api-4VTZH7OP.js} +59 -52
- package/dist/bundle/grants-EUQXSICG.js +105 -0
- package/dist/bundle/{identity-4IO7WGG4.js → identity-ARDPFYV5.js} +6 -4
- package/dist/bundle/{instructions-BXZZNAMS.js → instructions-N3OH5X2Y.js} +1 -1
- package/dist/bundle/{login-A4QHJ5DA.js → login-4VQEC7VI.js} +65 -58
- package/dist/bundle/{mcp-VVMPUDSL.js → mcp-WBHKX5E3.js} +5 -3
- package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
- package/dist/bundle/{node-R6ZNQ3NT.js → node-YU5JBNAA.js} +2 -2
- package/dist/bundle/{node-sqlite-AFQTE4XZ.js → node-sqlite-3C6PSBIW.js} +14 -4
- package/dist/bundle/oauth-D6NJFPYU.js +22 -0
- package/dist/bundle/{open-WJCRBIP7.js → open-M2V2VYXO.js} +8 -3
- package/dist/bundle/{openai-3TIBDWZA.js → openai-ST2IWNUX.js} +18 -14
- package/dist/bundle/{process-P36JP33R.js → process-PYNNBBTV.js} +1 -1
- package/dist/bundle/{program-AHZH65IT.js → program-Q4VWV2MR.js} +193 -147
- package/dist/bundle/prompt-MFIOJMAF.js +17 -0
- package/dist/bundle/{reasons-VHCVYH54.js → reasons-LOQ5J73F.js} +5 -3
- package/dist/bundle/{recognize-4EAKIMON.js → recognize-FBLMWXNE.js} +7 -3
- package/dist/bundle/{remote-HX3JP4EH.js → remote-XC3OXE4T.js} +10 -6
- package/dist/bundle/{rerank-BW3A4PUU.js → rerank-2XMKKF4S.js} +10 -6
- package/dist/bundle/{serve-YYOOLIBS.js → serve-Q2BQHNZB.js} +15 -10
- package/dist/bundle/{server-G6XTEEFI.js → server-42HPV3AH.js} +46 -39
- package/dist/bundle/server-EWZYN323.js +70 -0
- package/dist/bundle/{services-OAPILZOW.js → services-WU22S2MU.js} +100 -26
- package/dist/bundle/{sqlite-runtime-GTXDK4PE.js → sqlite-runtime-CSO6K6B2.js} +9 -4
- package/dist/bundle/start-TZWKM4AH.js +138 -0
- package/dist/bundle/{state-XG335LGZ.js → state-FLUT7U7R.js} +9 -5
- package/dist/bundle/{store-N53SJOPS.js → store-HDWMJ44E.js} +42 -17
- package/dist/bundle/{store-7KOXJNQP.js → store-TG6622NG.js} +20 -12
- package/dist/bundle/store-maintenance-command-RHWRUREJ.js +60 -0
- package/dist/bundle/tokens-TXYURU4S.js +103 -0
- package/dist/commands/documents.d.ts +1 -0
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +14 -1
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/knowledge.d.ts +4 -0
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +8 -7
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/contract-overrides.js +5 -5
- package/dist/contract-overrides.js.map +1 -1
- package/dist/knowledge-query.d.ts +2 -0
- package/dist/knowledge-query.d.ts.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +8 -3
- package/dist/program.js.map +1 -1
- package/dist/provider-json.d.ts +2 -0
- package/dist/provider-json.d.ts.map +1 -1
- package/dist/provider-json.js +13 -0
- package/dist/provider-json.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +1 -0
- package/dist/reasons.js.map +1 -1
- package/dist/store.d.ts +2 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +9 -0
- package/dist/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
- package/skills/drive-cli/SKILL.md +2 -1
- package/dist/bundle/chunk-3BXSLNWW.js +0 -3607
- package/dist/bundle/chunk-CGCQNYB3.js +0 -18
- package/dist/bundle/command-contract-XIACCAZL.js +0 -35
- package/dist/bundle/entry-CWYCQ53A.js +0 -17
- package/dist/bundle/first-run-YIH7EHJI.js +0 -24
- package/dist/bundle/first-screen-THH3XD5Y.js +0 -33
- package/dist/bundle/grants-3Z7DG3W3.js +0 -98
- package/dist/bundle/oauth-46XBJBML.js +0 -18
- package/dist/bundle/prompt-FFGBIT4A.js +0 -13
- package/dist/bundle/server-YKYEUIJT.js +0 -63
- package/dist/bundle/store-maintenance-command-W3TI52X2.js +0 -52
- package/dist/bundle/tokens-P7TEHKDD.js +0 -96
- /package/dist/bundle/{chunk-HPXYN7F3.js → chunk-LK2E2ELG.js} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
array,
|
|
5
|
+
dottedId,
|
|
6
|
+
duplicates,
|
|
7
|
+
isoTime,
|
|
8
|
+
optional,
|
|
9
|
+
parseRegistry,
|
|
10
|
+
picklist,
|
|
11
|
+
pipe,
|
|
12
|
+
record,
|
|
13
|
+
regex,
|
|
14
|
+
strictObject,
|
|
15
|
+
string,
|
|
16
|
+
text,
|
|
17
|
+
unknown
|
|
18
|
+
} from "./chunk-3U22QTU6.js";
|
|
19
|
+
import {
|
|
20
|
+
__name
|
|
21
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
22
|
+
|
|
23
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
|
|
24
|
+
var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
|
|
25
|
+
var logRecordSchema = strictObject({
|
|
26
|
+
time: isoTime,
|
|
27
|
+
severity: picklist(LOG_SEVERITIES),
|
|
28
|
+
/** The registered event id, `provider.request.failed`: never a sentence, so never content. */
|
|
29
|
+
body: string(),
|
|
30
|
+
run_id: text,
|
|
31
|
+
/** From an MCP caller's `_meta.traceparent`, when it sent one. */
|
|
32
|
+
trace_id: optional(pipe(string(), regex(/^[0-9a-f]{32}$/, "32 lower-case hex digits"))),
|
|
33
|
+
command: string(),
|
|
34
|
+
attributes: record(string(), unknown()),
|
|
35
|
+
resource: strictObject({ service: text, version: text })
|
|
36
|
+
});
|
|
37
|
+
var logEventSchema = strictObject({
|
|
38
|
+
id: dottedId,
|
|
39
|
+
meaning: text,
|
|
40
|
+
/** Attribute keys every record of this event carries. */
|
|
41
|
+
keys: array(string())
|
|
42
|
+
});
|
|
43
|
+
var defineLogEvents = /* @__PURE__ */ __name((input) => parseRegistry("log events", array(logEventSchema), input, (events) => [
|
|
44
|
+
...duplicates(events.map((event) => event.id)).map((id) => `"${id}" is listed twice`),
|
|
45
|
+
...events.flatMap((event) => duplicates(event.keys).map((key) => `${event.id}: key "${key}" is listed twice`))
|
|
46
|
+
]), "defineLogEvents");
|
|
47
|
+
var LOG_EVENTS = defineLogEvents([
|
|
48
|
+
{ id: "command.failed", meaning: "a command ended with an error", keys: ["code", "reason"] }
|
|
49
|
+
]);
|
|
50
|
+
var LOG_ATTRIBUTE_KEYS = [
|
|
51
|
+
"code",
|
|
52
|
+
"count",
|
|
53
|
+
"durationMs",
|
|
54
|
+
"errorClass",
|
|
55
|
+
"errorCode",
|
|
56
|
+
"event",
|
|
57
|
+
"frames",
|
|
58
|
+
"operation",
|
|
59
|
+
"outcome",
|
|
60
|
+
"reason",
|
|
61
|
+
"status"
|
|
62
|
+
];
|
|
63
|
+
var CONTENT_WORDS = /* @__PURE__ */ new Set([
|
|
64
|
+
"authorization",
|
|
65
|
+
"body",
|
|
66
|
+
"caption",
|
|
67
|
+
"content",
|
|
68
|
+
"cookie",
|
|
69
|
+
"credential",
|
|
70
|
+
"credentials",
|
|
71
|
+
"email",
|
|
72
|
+
"password",
|
|
73
|
+
"phone",
|
|
74
|
+
"query",
|
|
75
|
+
"secret",
|
|
76
|
+
"text",
|
|
77
|
+
"title",
|
|
78
|
+
"token"
|
|
79
|
+
]);
|
|
80
|
+
var CONTENT_LAST_WORDS = /* @__PURE__ */ new Set(["message", "name"]);
|
|
81
|
+
var wordsOf = /* @__PURE__ */ __name((key) => key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).filter(Boolean).map((word) => word.toLowerCase()), "wordsOf");
|
|
82
|
+
var isContentKey = /* @__PURE__ */ __name((key) => {
|
|
83
|
+
const words = wordsOf(key);
|
|
84
|
+
return words.some((word) => CONTENT_WORDS.has(word)) || CONTENT_LAST_WORDS.has(words.at(-1) ?? "");
|
|
85
|
+
}, "isContentKey");
|
|
86
|
+
var TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
|
|
87
|
+
var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
|
|
88
|
+
if (typeof traceparent !== "string")
|
|
89
|
+
return void 0;
|
|
90
|
+
const match = TRACEPARENT.exec(traceparent.trim());
|
|
91
|
+
if (!match)
|
|
92
|
+
return void 0;
|
|
93
|
+
const [, version, traceId = "", parentId = "", , rest] = match;
|
|
94
|
+
if (version === "ff" || version === "00" && rest !== void 0)
|
|
95
|
+
return void 0;
|
|
96
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentId))
|
|
97
|
+
return void 0;
|
|
98
|
+
return traceId;
|
|
99
|
+
}, "traceIdOf");
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
defineLogEvents,
|
|
103
|
+
LOG_ATTRIBUTE_KEYS,
|
|
104
|
+
isContentKey,
|
|
105
|
+
traceIdOf
|
|
106
|
+
};
|
|
@@ -2,14 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
walkQuery
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-L5SE2XZP.js";
|
|
6
6
|
import {
|
|
7
7
|
writeSecurely
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CBM2XAEZ.js";
|
|
9
9
|
import {
|
|
10
|
-
CliError,
|
|
11
10
|
array,
|
|
12
|
-
isCliError,
|
|
13
11
|
literal,
|
|
14
12
|
looseObject,
|
|
15
13
|
maxLength,
|
|
@@ -23,12 +21,16 @@ import {
|
|
|
23
21
|
safeParse,
|
|
24
22
|
string,
|
|
25
23
|
trim
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3U22QTU6.js";
|
|
25
|
+
import {
|
|
26
|
+
CliError,
|
|
27
|
+
isCliError
|
|
28
|
+
} from "./chunk-EBLA7GXY.js";
|
|
27
29
|
import {
|
|
28
30
|
__name
|
|
29
31
|
} from "./chunk-ZVVMGPBJ.js";
|
|
30
32
|
|
|
31
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/documents/blocks.js
|
|
32
34
|
var MARKS = ["bold", "italic", "strike", "code", "link"];
|
|
33
35
|
var sameMarks = /* @__PURE__ */ __name((a, b) => MARKS.every((mark) => a[mark] === b[mark]), "sameMarks");
|
|
34
36
|
var normalizeInlines = /* @__PURE__ */ __name((inlines) => {
|
|
@@ -76,7 +78,7 @@ var key = /* @__PURE__ */ __name((block, withChecked) => {
|
|
|
76
78
|
var blockKey = /* @__PURE__ */ __name((block) => JSON.stringify(key(block, true)), "blockKey");
|
|
77
79
|
var blockShape = /* @__PURE__ */ __name((block) => JSON.stringify(key(block, false)), "blockShape");
|
|
78
80
|
|
|
79
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
81
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/block-diff.js
|
|
80
82
|
var MAX_CELLS = 4e6;
|
|
81
83
|
var matches = /* @__PURE__ */ __name((a, b, keyOf) => {
|
|
82
84
|
const ka = a.map(keyOf);
|
|
@@ -222,7 +224,7 @@ var mergeBlocks = /* @__PURE__ */ __name((baseLocal, baseRemote, local, remote,
|
|
|
222
224
|
return { status: "clean", blocks, conflicts };
|
|
223
225
|
}, "mergeBlocks");
|
|
224
226
|
|
|
225
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/extraction.js
|
|
226
228
|
var Proposal = object({
|
|
227
229
|
kind: picklist(["summary", "digest", "fact", "preference"]),
|
|
228
230
|
body: pipe(string(), trim(), minLength(1), maxLength(15e3)),
|
|
@@ -257,7 +259,7 @@ var extractMemories = /* @__PURE__ */ __name(async (text, complete) => {
|
|
|
257
259
|
return { ...proposals, provider: answer.provider, model: answer.model, tokens: answer.tokens };
|
|
258
260
|
}, "extractMemories");
|
|
259
261
|
|
|
260
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/ingestion.js
|
|
261
263
|
var documentIngestion = /* @__PURE__ */ __name((store, options) => {
|
|
262
264
|
const folder = /* @__PURE__ */ __name(async (principal, create) => {
|
|
263
265
|
if (options.provider)
|
|
@@ -295,7 +297,7 @@ var documentIngestion = /* @__PURE__ */ __name((store, options) => {
|
|
|
295
297
|
for (let batch = 0; ; batch++) {
|
|
296
298
|
const memories = await store.memories.list({ subject: ref, status, limit: 500 });
|
|
297
299
|
for (const memory of memories)
|
|
298
|
-
await store.memories.markStale(memory.ref);
|
|
300
|
+
await store.memories.markStale(memory.ref, "owner");
|
|
299
301
|
if (memories.length < 500)
|
|
300
302
|
break;
|
|
301
303
|
if (batch >= 20)
|
|
@@ -384,7 +386,21 @@ var documentIngestion = /* @__PURE__ */ __name((store, options) => {
|
|
|
384
386
|
};
|
|
385
387
|
}, "documentIngestion");
|
|
386
388
|
|
|
387
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
389
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/knowledge.js
|
|
390
|
+
var writer = /* @__PURE__ */ __name((by) => {
|
|
391
|
+
if (by === void 0)
|
|
392
|
+
throw new CliError("validation_error", "name who writes it: the owner or an agent; there is no default", {
|
|
393
|
+
reason: "proposal.decider-required"
|
|
394
|
+
});
|
|
395
|
+
return by;
|
|
396
|
+
}, "writer");
|
|
397
|
+
var decider = /* @__PURE__ */ __name((by) => {
|
|
398
|
+
if (by === void 0)
|
|
399
|
+
throw new CliError("validation_error", "a confirm names who decides: the owner or an agent with a reason", {
|
|
400
|
+
reason: "proposal.decider-required"
|
|
401
|
+
});
|
|
402
|
+
return by;
|
|
403
|
+
}, "decider");
|
|
388
404
|
var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
|
|
389
405
|
const document = /* @__PURE__ */ __name(async (principal, ref) => {
|
|
390
406
|
const note = await store.notes.resolveNote(ref);
|
|
@@ -447,13 +463,13 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
|
|
|
447
463
|
}, "links"),
|
|
448
464
|
addLink: /* @__PURE__ */ __name(async (principal, ref, input) => {
|
|
449
465
|
await document(principal, ref);
|
|
450
|
-
return store.notes.addLink({ ...input, from: ref, origin: "owner" });
|
|
466
|
+
return store.notes.addLink({ ...input, from: ref, origin: input.by === "owner" ? "owner" : "suggested" });
|
|
451
467
|
}, "addLink"),
|
|
452
|
-
removeLink: /* @__PURE__ */ __name(async (principal, ref, id) => {
|
|
468
|
+
removeLink: /* @__PURE__ */ __name(async (principal, ref, id, by) => {
|
|
453
469
|
const links = await port.links(principal, ref);
|
|
454
470
|
if (!links.some((link) => link.id === id && link.origin === "owner"))
|
|
455
471
|
throw new CliError("not_found", "owner link is not attached to this document");
|
|
456
|
-
return store.notes.removeLink(id);
|
|
472
|
+
return store.notes.removeLink(id, by);
|
|
457
473
|
}, "removeLink"),
|
|
458
474
|
notes: /* @__PURE__ */ __name(async (principal, ref, options) => {
|
|
459
475
|
await document(principal, ref);
|
|
@@ -476,18 +492,18 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
|
|
|
476
492
|
await document(principal, ref);
|
|
477
493
|
if (input.supersedes)
|
|
478
494
|
await memoryFor(principal, ref, input.supersedes);
|
|
479
|
-
return store.memories.add({ ...input, subject: ref, evidence: [ref], author: input.author
|
|
495
|
+
return store.memories.add({ ...input, subject: ref, evidence: [ref], author: writer(input.author) });
|
|
480
496
|
}, "addMemory"),
|
|
481
497
|
memories: /* @__PURE__ */ __name(async (principal, ref, options) => {
|
|
482
498
|
await document(principal, ref);
|
|
483
499
|
return store.memories.list({ ...options, subject: ref });
|
|
484
500
|
}, "memories"),
|
|
485
|
-
memory: /* @__PURE__ */ __name(async (principal, ref, memoryRef, action = "show") => {
|
|
501
|
+
memory: /* @__PURE__ */ __name(async (principal, ref, memoryRef, action = "show", by) => {
|
|
486
502
|
const memory = await memoryFor(principal, ref, memoryRef);
|
|
487
503
|
if (action === "confirm")
|
|
488
|
-
return store.memories.confirm(memory.ref);
|
|
504
|
+
return store.memories.confirm(memory.ref, decider(by));
|
|
489
505
|
if (action === "stale")
|
|
490
|
-
return store.memories.markStale(memory.ref);
|
|
506
|
+
return store.memories.markStale(memory.ref, decider(by));
|
|
491
507
|
return memory;
|
|
492
508
|
}, "memory"),
|
|
493
509
|
searchMemories: /* @__PURE__ */ __name(async (principal, ref, query, scope) => {
|
|
@@ -502,7 +518,7 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
|
|
|
502
518
|
return store.facts.add({
|
|
503
519
|
type,
|
|
504
520
|
statement,
|
|
505
|
-
by: by
|
|
521
|
+
by: writer(by),
|
|
506
522
|
...supersedes === void 0 ? {} : { supersedes },
|
|
507
523
|
...occurredAt === void 0 ? {} : { occurredAt },
|
|
508
524
|
subject: ref,
|
|
@@ -514,19 +530,19 @@ var documentKnowledge = /* @__PURE__ */ __name((store, folder) => {
|
|
|
514
530
|
await document(principal, ref);
|
|
515
531
|
return store.facts.list({ ...options, subject: ref });
|
|
516
532
|
}, "facts"),
|
|
517
|
-
fact: /* @__PURE__ */ __name(async (principal, ref, factRef, action = "show") => {
|
|
533
|
+
fact: /* @__PURE__ */ __name(async (principal, ref, factRef, action = "show", by) => {
|
|
518
534
|
const fact = await factFor(principal, ref, factRef);
|
|
519
535
|
if (action === "confirm")
|
|
520
|
-
return store.facts.accept(fact.ref);
|
|
536
|
+
return store.facts.accept(fact.ref, decider(by));
|
|
521
537
|
if (action === "reverse")
|
|
522
|
-
return store.facts.reverse(fact.ref);
|
|
538
|
+
return store.facts.reverse(fact.ref, decider(by));
|
|
523
539
|
return fact;
|
|
524
540
|
}, "fact")
|
|
525
541
|
};
|
|
526
542
|
return port;
|
|
527
543
|
}, "documentKnowledge");
|
|
528
544
|
|
|
529
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
545
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/documents/markdown-blocks.js
|
|
530
546
|
var parser;
|
|
531
547
|
var loadParser = /* @__PURE__ */ __name(() => parser ??= Promise.all([
|
|
532
548
|
import("./mdast-util-from-markdown-FXEPSNER.js"),
|
|
@@ -651,7 +667,7 @@ var placedMarkdownBlocks = /* @__PURE__ */ __name(async (markdown) => {
|
|
|
651
667
|
return blocks(tree.children);
|
|
652
668
|
}, "placedMarkdownBlocks");
|
|
653
669
|
|
|
654
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
670
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/markdown-splice.js
|
|
655
671
|
var escapeText = /* @__PURE__ */ __name((text) => text.replace(/[\\`*_[\]<>~|]/g, "\\$&"), "escapeText");
|
|
656
672
|
var codeSpan = /* @__PURE__ */ __name((text) => {
|
|
657
673
|
const longest = (text.match(/`+/g) ?? []).reduce((most, run) => Math.max(most, run.length), 0);
|
|
@@ -837,15 +853,15 @@ var columnsBefore = /* @__PURE__ */ __name((placed, index) => {
|
|
|
837
853
|
return columns;
|
|
838
854
|
}, "columnsBefore");
|
|
839
855
|
|
|
840
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
856
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
|
|
841
857
|
import { watch } from "node:fs";
|
|
842
858
|
|
|
843
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
859
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
|
|
844
860
|
import { createHash as createHash2 } from "node:crypto";
|
|
845
861
|
import { mkdirSync, readFileSync } from "node:fs";
|
|
846
862
|
import { join as join2 } from "node:path";
|
|
847
863
|
|
|
848
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
864
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/push.js
|
|
849
865
|
import { createHash, randomUUID } from "node:crypto";
|
|
850
866
|
import { createReadStream } from "node:fs";
|
|
851
867
|
import { chmod, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -1097,7 +1113,7 @@ var pushDocuments = /* @__PURE__ */ __name(async (options) => {
|
|
|
1097
1113
|
return result;
|
|
1098
1114
|
}, "pushDocuments");
|
|
1099
1115
|
|
|
1100
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1116
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
|
|
1101
1117
|
var mirrorId = /* @__PURE__ */ __name((root, folder) => createHash2("sha256").update(JSON.stringify([root, folder])).digest("hex").slice(0, 8), "mirrorId");
|
|
1102
1118
|
var ID = pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/));
|
|
1103
1119
|
var stateSchema = /* @__PURE__ */ __name((kinds) => object({
|
|
@@ -1219,7 +1235,7 @@ var syncMirrors = /* @__PURE__ */ __name(async (options) => {
|
|
|
1219
1235
|
};
|
|
1220
1236
|
}, "syncMirrors");
|
|
1221
1237
|
|
|
1222
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/mirror-watch.js
|
|
1223
1239
|
var sleep = /* @__PURE__ */ __name((milliseconds, signal) => new Promise((resolve) => {
|
|
1224
1240
|
const finish = /* @__PURE__ */ __name(() => {
|
|
1225
1241
|
clearTimeout(timer);
|
|
@@ -1358,7 +1374,7 @@ async function* watchMirrors(sync, options) {
|
|
|
1358
1374
|
}
|
|
1359
1375
|
__name(watchMirrors, "watchMirrors");
|
|
1360
1376
|
|
|
1361
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/proposals.js
|
|
1362
1378
|
var extractDocumentMemories = /* @__PURE__ */ __name(async (options) => {
|
|
1363
1379
|
const source = options.read();
|
|
1364
1380
|
const text = options.tab ? source.snapshot.tabs.find((tab) => tab.id === options.tab)?.text : source.snapshot.text;
|
|
@@ -1408,10 +1424,10 @@ Snapshot: ${source.hash}`;
|
|
|
1408
1424
|
};
|
|
1409
1425
|
}, "extractDocumentMemories");
|
|
1410
1426
|
|
|
1411
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1427
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
|
|
1412
1428
|
import { createHash as createHash4 } from "node:crypto";
|
|
1413
1429
|
|
|
1414
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1430
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/documents/scope.js
|
|
1415
1431
|
var within = /* @__PURE__ */ __name((file, roots, folders, seen = /* @__PURE__ */ new Set()) => {
|
|
1416
1432
|
if (file.trashed)
|
|
1417
1433
|
return false;
|
|
@@ -1426,7 +1442,7 @@ var within = /* @__PURE__ */ __name((file, roots, folders, seen = /* @__PURE__ *
|
|
|
1426
1442
|
});
|
|
1427
1443
|
}, "within");
|
|
1428
1444
|
|
|
1429
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1445
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/documents/catalog.js
|
|
1430
1446
|
var catalogFiles = /* @__PURE__ */ __name((state, roots) => {
|
|
1431
1447
|
const folders = state.pending?.folders ?? state.folders;
|
|
1432
1448
|
const files = new Map(Object.values(state.documents).map((doc) => [doc.metadata.id, doc.metadata]));
|
|
@@ -1444,7 +1460,7 @@ var catalogFiles = /* @__PURE__ */ __name((state, roots) => {
|
|
|
1444
1460
|
return [...files.values()].filter((file) => within(file, roots, folders));
|
|
1445
1461
|
}, "catalogFiles");
|
|
1446
1462
|
|
|
1447
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1463
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/plan.js
|
|
1448
1464
|
import { createHash as createHash3 } from "node:crypto";
|
|
1449
1465
|
var scopeHash = /* @__PURE__ */ __name((roots) => createHash3("sha256").update(JSON.stringify([...roots].sort())).digest("hex"), "scopeHash");
|
|
1450
1466
|
var changedSince = /* @__PURE__ */ __name((previous, file) => previous.version !== file.version || previous.modifiedAt !== file.modifiedAt || previous.name !== file.name || previous.canDownload !== file.canDownload || JSON.stringify(previous.parents) !== JSON.stringify(file.parents), "changedSince");
|
|
@@ -1628,7 +1644,7 @@ var planDocuments = /* @__PURE__ */ __name(async (options, source, state, roots,
|
|
|
1628
1644
|
return { scope, cursor: finalCursor, folders: scopedFolders, jobs, skipped };
|
|
1629
1645
|
}, "planDocuments");
|
|
1630
1646
|
|
|
1631
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1647
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
|
|
1632
1648
|
var MAX_PICTURE_BYTES = 25 * 1024 * 1024;
|
|
1633
1649
|
var SAVE_EVERY_MS2 = 2e3;
|
|
1634
1650
|
var SAVE_EVERY_ITEMS = 25;
|
|
@@ -1654,7 +1670,7 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
|
|
|
1654
1670
|
coverage: "selected folders only; unsupported files are reported",
|
|
1655
1671
|
...profile.picture_search ? { pictures: 0 } : {}
|
|
1656
1672
|
};
|
|
1657
|
-
let
|
|
1673
|
+
let writer2;
|
|
1658
1674
|
let flush;
|
|
1659
1675
|
try {
|
|
1660
1676
|
if (profile.roots.length && (!source || await source.identity() !== profile.principal))
|
|
@@ -1711,9 +1727,9 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
|
|
|
1711
1727
|
}
|
|
1712
1728
|
if (!source)
|
|
1713
1729
|
throw new CliError("configuration_error", "a pending picture requires source sign-in");
|
|
1714
|
-
if (!
|
|
1730
|
+
if (!writer2) {
|
|
1715
1731
|
try {
|
|
1716
|
-
|
|
1732
|
+
writer2 = await index.openPictures();
|
|
1717
1733
|
} catch (error) {
|
|
1718
1734
|
if (!isCliError(error) || error.code !== "not_found")
|
|
1719
1735
|
throw error;
|
|
@@ -1728,7 +1744,7 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
|
|
|
1728
1744
|
result.pictures_too_large = (result.pictures_too_large ?? 0) + 1;
|
|
1729
1745
|
return;
|
|
1730
1746
|
}
|
|
1731
|
-
if (await
|
|
1747
|
+
if (await writer2.save(entry.reference, bytes) === "saved")
|
|
1732
1748
|
result.pictures = (result.pictures ?? 0) + 1;
|
|
1733
1749
|
entry.picture = "saved";
|
|
1734
1750
|
}, "savePictureOf");
|
|
@@ -1830,7 +1846,7 @@ var syncDocuments = /* @__PURE__ */ __name(async (options) => {
|
|
|
1830
1846
|
return result;
|
|
1831
1847
|
} finally {
|
|
1832
1848
|
flush?.();
|
|
1833
|
-
await
|
|
1849
|
+
await writer2?.close();
|
|
1834
1850
|
}
|
|
1835
1851
|
}, "syncDocuments");
|
|
1836
1852
|
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
visibleControls
|
|
5
|
+
} from "./chunk-HIP43OGZ.js";
|
|
6
|
+
import {
|
|
7
|
+
BASE_REASONS,
|
|
8
|
+
COMMON_DETAILS,
|
|
9
|
+
CRASH_CODE,
|
|
10
|
+
CRASH_REASON,
|
|
11
|
+
stepOf,
|
|
12
|
+
writes
|
|
13
|
+
} from "./chunk-3U22QTU6.js";
|
|
14
|
+
import {
|
|
15
|
+
errorCodes,
|
|
16
|
+
isCliError
|
|
17
|
+
} from "./chunk-EBLA7GXY.js";
|
|
18
|
+
import {
|
|
19
|
+
__name
|
|
20
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
21
|
+
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
|
|
23
|
+
var EXIT_CODES = {
|
|
24
|
+
validation_error: 2,
|
|
25
|
+
configuration_error: 3,
|
|
26
|
+
authentication_error: 4,
|
|
27
|
+
permission_error: 5,
|
|
28
|
+
not_found: 6,
|
|
29
|
+
confirmation_required: 7,
|
|
30
|
+
rate_limited: 8,
|
|
31
|
+
timeout: 9,
|
|
32
|
+
network_error: 10,
|
|
33
|
+
provider_error: 11,
|
|
34
|
+
provider_unavailable: 12,
|
|
35
|
+
invalid_response: 13,
|
|
36
|
+
outcome_unknown: 14,
|
|
37
|
+
cancelled: 130
|
|
38
|
+
};
|
|
39
|
+
var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
|
|
40
|
+
var GENERIC_FAILURE = 1;
|
|
41
|
+
|
|
42
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
|
|
43
|
+
var recognise = /* @__PURE__ */ __name((failure) => {
|
|
44
|
+
if (isCliError(failure))
|
|
45
|
+
return failure;
|
|
46
|
+
if (!(failure instanceof Error) || failure.name !== "CliError")
|
|
47
|
+
return void 0;
|
|
48
|
+
const { code, details } = failure;
|
|
49
|
+
if (!errorCodes.includes(code))
|
|
50
|
+
return void 0;
|
|
51
|
+
return {
|
|
52
|
+
code,
|
|
53
|
+
message: failure.message,
|
|
54
|
+
details: typeof details === "object" && details !== null ? details : {}
|
|
55
|
+
};
|
|
56
|
+
}, "recognise");
|
|
57
|
+
var reasonFor = /* @__PURE__ */ __name((code, named, reasons) => reasons.find((entry) => entry.reason === named && entry.code === code) ?? BASE_REASONS.find((entry) => entry.reason === named && entry.code === code) ?? // The first base reason for each code is its fallback.
|
|
58
|
+
BASE_REASONS.find((entry) => entry.code === code), "reasonFor");
|
|
59
|
+
var nextFor = /* @__PURE__ */ __name((reason, details, context) => {
|
|
60
|
+
const definition = reason.step ? context.steps?.find((step) => step.id === reason.step) : void 0;
|
|
61
|
+
if (!definition)
|
|
62
|
+
return [];
|
|
63
|
+
const known = new Set(definition.kind === "command" ? definition.args.map((arg) => arg.name) : []);
|
|
64
|
+
const args = Object.fromEntries(Object.entries(details).filter(([key, value]) => known.has(key) && value !== void 0));
|
|
65
|
+
try {
|
|
66
|
+
return [stepOf(definition, { args, ...context.targets ? { targets: context.targets } : {} })];
|
|
67
|
+
} catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}, "nextFor");
|
|
71
|
+
var TRANSIENT = [
|
|
72
|
+
"rate_limited",
|
|
73
|
+
"timeout",
|
|
74
|
+
"network_error",
|
|
75
|
+
"provider_unavailable"
|
|
76
|
+
];
|
|
77
|
+
var retryOf = /* @__PURE__ */ __name((code, details, effects) => {
|
|
78
|
+
const transient = details.retryable !== false && (TRANSIENT.includes(code) || code === "provider_error" && details.retryable === true);
|
|
79
|
+
const safe = code !== "outcome_unknown" && transient && (!writes(effects) || details.sent === false);
|
|
80
|
+
const after = details.retry_after_ms;
|
|
81
|
+
return safe && typeof after === "number" && Number.isInteger(after) && after >= 0 ? { safe, after_ms: after } : { safe };
|
|
82
|
+
}, "retryOf");
|
|
83
|
+
var errorObjectOf = /* @__PURE__ */ __name((failure, context = {}) => {
|
|
84
|
+
const reasons = context.reasons ?? [];
|
|
85
|
+
const recognised = recognise(failure);
|
|
86
|
+
if (!recognised) {
|
|
87
|
+
const reason2 = reasonFor(CRASH_CODE, CRASH_REASON, reasons);
|
|
88
|
+
return {
|
|
89
|
+
error: {
|
|
90
|
+
code: CRASH_CODE,
|
|
91
|
+
reason: reason2.reason,
|
|
92
|
+
message: reason2.message,
|
|
93
|
+
retry: { safe: false },
|
|
94
|
+
...context.runId ? { run_id: context.runId } : {}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const { code, message, details } = recognised;
|
|
99
|
+
const reason = reasonFor(code, details.reason, reasons);
|
|
100
|
+
const allowed = /* @__PURE__ */ new Set([...COMMON_DETAILS, ...context.details ?? [], ...reason.details]);
|
|
101
|
+
allowed.delete("cause");
|
|
102
|
+
const kept = Object.fromEntries(Object.entries(details).filter(([key, value]) => allowed.has(key) && value !== void 0));
|
|
103
|
+
const next = nextFor(reason, details, context);
|
|
104
|
+
const runId = context.runId ?? (typeof details.run_id === "string" ? details.run_id : void 0);
|
|
105
|
+
return {
|
|
106
|
+
error: {
|
|
107
|
+
code,
|
|
108
|
+
reason: reason.reason,
|
|
109
|
+
message,
|
|
110
|
+
...typeof details.param === "string" ? { param: details.param } : {},
|
|
111
|
+
...Object.keys(kept).length > 0 ? { details: kept } : {},
|
|
112
|
+
...next.length > 0 ? { next } : {},
|
|
113
|
+
retry: retryOf(code, details, context.effects),
|
|
114
|
+
...runId ? { run_id: runId } : {}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}, "errorObjectOf");
|
|
118
|
+
var exitCodeOfError = /* @__PURE__ */ __name(({ error }) => error.code === CRASH_CODE ? GENERIC_FAILURE : EXIT_CODES[error.code], "exitCodeOfError");
|
|
119
|
+
var exitCodeOfAnswer = /* @__PURE__ */ __name((meta, partial = false) => {
|
|
120
|
+
if (meta.complete || partial)
|
|
121
|
+
return 0;
|
|
122
|
+
const code = meta.issues?.[0]?.code;
|
|
123
|
+
return code === void 0 ? GENERIC_FAILURE : EXIT_CODES[code];
|
|
124
|
+
}, "exitCodeOfAnswer");
|
|
125
|
+
var kebab = /* @__PURE__ */ __name((name) => name.replaceAll("_", "-"), "kebab");
|
|
126
|
+
var commandLine = /* @__PURE__ */ __name((cli, step) => [
|
|
127
|
+
cli,
|
|
128
|
+
step.command,
|
|
129
|
+
...Object.entries(step.args).map(([name, value]) => value === true ? `--${kebab(name)}` : `--${kebab(name)} ${JSON.stringify(value)}`)
|
|
130
|
+
].join(" "), "commandLine");
|
|
131
|
+
var STACK_FRAMES = 10;
|
|
132
|
+
var errorRecordOf = /* @__PURE__ */ __name((failure, object, options) => {
|
|
133
|
+
const thrown = failure instanceof Error ? failure : void 0;
|
|
134
|
+
const { cause, ...details } = recognise(failure)?.details ?? {};
|
|
135
|
+
const stack = thrown?.stack?.split("\n").slice(1, STACK_FRAMES + 1).map((line) => visibleControls(line.trim()));
|
|
136
|
+
const reason = thrown?.cause ?? cause;
|
|
137
|
+
return {
|
|
138
|
+
time: (options.time ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
139
|
+
severity: "error",
|
|
140
|
+
body: "command.failed",
|
|
141
|
+
...object.error.run_id ? { run_id: object.error.run_id } : {},
|
|
142
|
+
command: options.command,
|
|
143
|
+
attributes: {
|
|
144
|
+
code: object.error.code,
|
|
145
|
+
reason: object.error.reason,
|
|
146
|
+
message: object.error.message,
|
|
147
|
+
...Object.keys(details).length > 0 ? { details } : {},
|
|
148
|
+
...thrown ? { name: thrown.name, thrown_message: visibleControls(thrown.message) } : { thrown: String(failure) },
|
|
149
|
+
...reason === void 0 ? {} : { cause: visibleControls(reason instanceof Error ? reason.message : String(reason)) },
|
|
150
|
+
...stack && stack.length > 0 ? { stack } : {}
|
|
151
|
+
},
|
|
152
|
+
resource: { service: options.service, version: options.version }
|
|
153
|
+
};
|
|
154
|
+
}, "errorRecordOf");
|
|
155
|
+
var renderError = /* @__PURE__ */ __name((object, options) => {
|
|
156
|
+
if (!options.interactive)
|
|
157
|
+
return [JSON.stringify(object), ...options.record ? [JSON.stringify(options.record)] : []].join("\n");
|
|
158
|
+
const { message, next, run_id: runId } = object.error;
|
|
159
|
+
const step = next?.[0];
|
|
160
|
+
return [
|
|
161
|
+
`\u2717 ${visibleControls(message)}`,
|
|
162
|
+
...step?.kind === "command" ? [`\u2192 ${visibleControls(step.why)}: ${visibleControls(step.line ?? commandLine(options.cli, step))}`] : step ? [`\u2192 ${visibleControls(step.why)}`] : [],
|
|
163
|
+
...options.record ? [JSON.stringify(options.record, null, 2)] : runId ? [`details: ${options.cli} runs show ${runId}`] : []
|
|
164
|
+
].join("\n");
|
|
165
|
+
}, "renderError");
|
|
166
|
+
var mcpErrorResult = /* @__PURE__ */ __name((object) => ({
|
|
167
|
+
content: [{ type: "text", text: JSON.stringify(object) }],
|
|
168
|
+
structuredContent: object,
|
|
169
|
+
isError: true
|
|
170
|
+
}), "mcpErrorResult");
|
|
171
|
+
var catchCrashes = /* @__PURE__ */ __name((options) => {
|
|
172
|
+
const target = options.target ?? process;
|
|
173
|
+
const write = options.write ?? ((text) => process.stderr.write(`${text}
|
|
174
|
+
`));
|
|
175
|
+
const exit = options.exit ?? ((code) => process.exit(code));
|
|
176
|
+
const crashed = /* @__PURE__ */ __name((failure) => {
|
|
177
|
+
const object = errorObjectOf(failure, options);
|
|
178
|
+
write(renderError(object, { cli: options.cli, interactive: options.interactive }));
|
|
179
|
+
exit(exitCodeOfError(object));
|
|
180
|
+
}, "crashed");
|
|
181
|
+
target.on("uncaughtException", crashed);
|
|
182
|
+
target.on("unhandledRejection", crashed);
|
|
183
|
+
return () => {
|
|
184
|
+
target.off("uncaughtException", crashed);
|
|
185
|
+
target.off("unhandledRejection", crashed);
|
|
186
|
+
};
|
|
187
|
+
}, "catchCrashes");
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
EXIT_CODES,
|
|
191
|
+
exitCodeFor,
|
|
192
|
+
GENERIC_FAILURE,
|
|
193
|
+
retryOf,
|
|
194
|
+
errorObjectOf,
|
|
195
|
+
exitCodeOfError,
|
|
196
|
+
exitCodeOfAnswer,
|
|
197
|
+
errorRecordOf,
|
|
198
|
+
renderError,
|
|
199
|
+
mcpErrorResult,
|
|
200
|
+
catchCrashes
|
|
201
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
CliError
|
|
5
|
-
} from "./chunk-GIQFBXQN.js";
|
|
6
3
|
import {
|
|
7
4
|
importFrom
|
|
8
5
|
} from "./chunk-Y5E2WNWB.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-EBLA7GXY.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
14
|
import { createRequire } from "node:module";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
17
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
18
|
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
19
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -70,7 +70,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
|
70
70
|
throw invalid();
|
|
71
71
|
}, "checkOggDuration");
|
|
72
72
|
|
|
73
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.561.0_@wirecat+cli-base@0.75.2_commander@15.0.0_esbuild@0.28.2_type_ef328e5cd047e3c19bb2231542618c08/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
74
|
var SAMPLE_RATE = 16e3;
|
|
75
75
|
var LEAD = SAMPLE_RATE / 2;
|
|
76
76
|
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|