@wirecat/attio-cli 0.0.0-stage → 0.2.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/CHANGELOG.md +33 -0
- package/LICENSE +204 -0
- package/README.md +249 -2
- package/contracts/wirecat.json +2339 -0
- package/dist/bin/attio.d.ts +3 -0
- package/dist/bin/attio.d.ts.map +1 -0
- package/dist/bin/attio.js +40 -0
- package/dist/bin/attio.js.map +1 -0
- package/dist/bundle/agent-DYTWDBTT.js +37 -0
- package/dist/bundle/all-profiles-LZDKPHN2.js +320 -0
- package/dist/bundle/anthropic-BF72H77D.js +91 -0
- package/dist/bundle/app-server-H57FZJX5.js +249 -0
- package/dist/bundle/attio.js +183 -0
- package/dist/bundle/bun-WO77T4LG.js +169 -0
- package/dist/bundle/bun-sqlite-2BP7JDVO.js +76 -0
- package/dist/bundle/chunk-2E6JGBM5.js +1392 -0
- package/dist/bundle/chunk-34FJ26K2.js +54 -0
- package/dist/bundle/chunk-3I2FGNWO.js +23 -0
- package/dist/bundle/chunk-3NVOKVRY.js +42148 -0
- package/dist/bundle/chunk-3YFDZSM3.js +37 -0
- package/dist/bundle/chunk-4SMGM2Q6.js +274 -0
- package/dist/bundle/chunk-4STBJZR4.js +3571 -0
- package/dist/bundle/chunk-5K3FGXZH.js +46 -0
- package/dist/bundle/chunk-6ALPRBNV.js +100 -0
- package/dist/bundle/chunk-6NDJDDSQ.js +2000 -0
- package/dist/bundle/chunk-6SK3YB2B.js +218 -0
- package/dist/bundle/chunk-76RRELCU.js +65310 -0
- package/dist/bundle/chunk-7MXCUMHG.js +18 -0
- package/dist/bundle/chunk-7ZUOI3HY.js +73 -0
- package/dist/bundle/chunk-AMUONYQR.js +106 -0
- package/dist/bundle/chunk-ASCUOOLO.js +53 -0
- package/dist/bundle/chunk-BUGROVF3.js +72 -0
- package/dist/bundle/chunk-CHZ26CW5.js +9578 -0
- package/dist/bundle/chunk-CMO5ND3Y.js +794 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DF2IIO32.js +12645 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DQ6P3R4B.js +170 -0
- package/dist/bundle/chunk-DSRXCLPO.js +7 -0
- package/dist/bundle/chunk-EEPE3SOW.js +338 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EQGXEKSV.js +1197 -0
- package/dist/bundle/chunk-EQXT7KO4.js +388 -0
- package/dist/bundle/chunk-ERW2WOJT.js +24 -0
- package/dist/bundle/chunk-ESH2QGCA.js +372 -0
- package/dist/bundle/chunk-G3JTLVVL.js +771 -0
- package/dist/bundle/chunk-G6FQMVKW.js +52 -0
- package/dist/bundle/chunk-GBZ6JUXU.js +108 -0
- package/dist/bundle/chunk-GLHFJPYS.js +156 -0
- package/dist/bundle/chunk-GW4G5KLS.js +2333 -0
- package/dist/bundle/chunk-H7QDPW3D.js +78 -0
- package/dist/bundle/chunk-HG7FT3H3.js +319 -0
- package/dist/bundle/chunk-I3WS6V5H.js +188 -0
- package/dist/bundle/chunk-IDU4ESRZ.js +95 -0
- package/dist/bundle/chunk-IXCIQ7FZ.js +161 -0
- package/dist/bundle/chunk-J5P5VSRG.js +1233 -0
- package/dist/bundle/chunk-JA26HG7T.js +353 -0
- package/dist/bundle/chunk-JSTBW7F4.js +259 -0
- package/dist/bundle/chunk-KHDXRFJZ.js +185 -0
- package/dist/bundle/chunk-L5WS6CYZ.js +288 -0
- package/dist/bundle/chunk-LWJ4ZGUM.js +407 -0
- package/dist/bundle/chunk-MC2RQ2OB.js +38 -0
- package/dist/bundle/chunk-MNQACPXG.js +1332 -0
- package/dist/bundle/chunk-MOSH2KPD.js +358 -0
- package/dist/bundle/chunk-MRREDVPY.js +733 -0
- package/dist/bundle/chunk-MT2ZUZRA.js +1028 -0
- package/dist/bundle/chunk-O4A33Y54.js +29 -0
- package/dist/bundle/chunk-OBXDRUO4.js +63 -0
- package/dist/bundle/chunk-OFR3YYT6.js +6848 -0
- package/dist/bundle/chunk-P4U6AGWD.js +41 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PMP37KLR.js +142 -0
- package/dist/bundle/chunk-Q3JCUUOR.js +80 -0
- package/dist/bundle/chunk-Q7BSTQ3T.js +633 -0
- package/dist/bundle/chunk-QLHDUYGE.js +16 -0
- package/dist/bundle/chunk-RU5J7DWY.js +988 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-S7K2XFQB.js +95 -0
- package/dist/bundle/chunk-SQHDE3TC.js +230 -0
- package/dist/bundle/chunk-TF7ZGCOK.js +76 -0
- package/dist/bundle/chunk-V6BTAILB.js +4072 -0
- package/dist/bundle/chunk-VDMIJ3JW.js +50 -0
- package/dist/bundle/chunk-VW5F6FK3.js +206 -0
- package/dist/bundle/chunk-W6F2CQZ6.js +1068 -0
- package/dist/bundle/chunk-WARIIYSW.js +58 -0
- package/dist/bundle/chunk-WK7GLHHL.js +334 -0
- package/dist/bundle/chunk-X5S5KUSU.js +2788 -0
- package/dist/bundle/chunk-X6R74TWX.js +131 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XXLQNHKF.js +82 -0
- package/dist/bundle/chunk-XXOTX4M3.js +362 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZDBTYBFR.js +66 -0
- package/dist/bundle/chunk-ZGADZ4CH.js +557 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-7M6EPH3D.js +37 -0
- package/dist/bundle/command-server-entry-MNVPYQZ3.js +166 -0
- package/dist/bundle/decode-MQNKNXLK.js +297 -0
- package/dist/bundle/definitions-FODOIPM2.js +43379 -0
- package/dist/bundle/dispatch-TAQ7635E.js +411 -0
- package/dist/bundle/dist-EM7KLEG4.js +7577 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/echarts-6ZSUNO4L.js +42501 -0
- package/dist/bundle/embed-PHCCJJ5Z.js +38 -0
- package/dist/bundle/embedder-WLZZQTKZ.js +111 -0
- package/dist/bundle/failure-MR2XVHFP.js +25 -0
- package/dist/bundle/first-run-64LREHSV.js +29 -0
- package/dist/bundle/first-screen-YSCAZIYJ.js +37 -0
- package/dist/bundle/instructions-22GCKNR5.js +11 -0
- package/dist/bundle/mcp-CNV7F2XZ.js +167 -0
- package/dist/bundle/meeting-combined-YX3T5WJD.js +24 -0
- package/dist/bundle/meeting-model-JWDTCGLZ.js +25 -0
- package/dist/bundle/meeting-semantic-375GYPZQ.js +22 -0
- package/dist/bundle/node-ITDTNRRZ.js +176 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-IRAGRMEZ.js +74 -0
- package/dist/bundle/oauth-CACOQJEL.js +20 -0
- package/dist/bundle/open-HU4KHKDR.js +23 -0
- package/dist/bundle/openai-JQUPAVKX.js +238 -0
- package/dist/bundle/process-QS5OHEUK.js +91 -0
- package/dist/bundle/program-QLCUCR76.js +33428 -0
- package/dist/bundle/prompt-VA5MKXJU.js +17 -0
- package/dist/bundle/recognize-JGA5IVKC.js +26 -0
- package/dist/bundle/remote-NPY2KZQ4.js +31 -0
- package/dist/bundle/rerank-4H2QR4XU.js +52 -0
- package/dist/bundle/schemas-THAI3G5S.js +21410 -0
- package/dist/bundle/serve-UH46SZQG.js +199 -0
- package/dist/bundle/server-6H7JS6SU.js +212 -0
- package/dist/bundle/server-SR52KBL3.js +79 -0
- package/dist/bundle/sqlite-runtime-EJWEUTBR.js +20 -0
- package/dist/bundle/state-34B6AUQZ.js +36 -0
- package/dist/bundle/store-3R4ILTCJ.js +177 -0
- package/dist/bundle/store-XSE35P3U.js +291 -0
- package/dist/bundle/store-maintenance-command-ABJARLI4.js +66 -0
- package/dist/bundle/surface-NOTIEJB5.js +65 -0
- package/dist/commands/api.d.ts +12 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +27 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/crm.d.ts +4 -0
- package/dist/commands/crm.d.ts.map +1 -0
- package/dist/commands/crm.js +66 -0
- package/dist/commands/crm.js.map +1 -0
- package/dist/commands/session.d.ts +7 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +22 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +43375 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +5158 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +383 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +21196 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +10166 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/wirecat-config.d.ts +15 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +333 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +7 -0
- package/dist/hooks.js.map +1 -0
- package/dist/identity.d.ts +33 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +31 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +54 -0
- package/dist/program.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +87 -4
- package/skills/attio-cli/SKILL.md +58 -0
- package/skills/attio-cli/references/api/api-activities.md +62 -0
- package/skills/attio-cli/references/api/api-activity-records.md +96 -0
- package/skills/attio-cli/references/api/api-attributes.md +148 -0
- package/skills/attio-cli/references/api/api-call-recordings.md +53 -0
- package/skills/attio-cli/references/api/api-comments.md +36 -0
- package/skills/attio-cli/references/api/api-emails.md +23 -0
- package/skills/attio-cli/references/api/api-entries.md +127 -0
- package/skills/attio-cli/references/api/api-files.md +63 -0
- package/skills/attio-cli/references/api/api-lists.md +44 -0
- package/skills/attio-cli/references/api/api-meetings.md +82 -0
- package/skills/attio-cli/references/api/api-meta.md +8 -0
- package/skills/attio-cli/references/api/api-notes.md +64 -0
- package/skills/attio-cli/references/api/api-objects.md +55 -0
- package/skills/attio-cli/references/api/api-records.md +168 -0
- package/skills/attio-cli/references/api/api-sequences.md +15 -0
- package/skills/attio-cli/references/api/api-sql.md +15 -0
- package/skills/attio-cli/references/api/api-tasks.md +67 -0
- package/skills/attio-cli/references/api/api-threads.md +35 -0
- package/skills/attio-cli/references/api/api-transcripts.md +17 -0
- package/skills/attio-cli/references/api/api-views.md +133 -0
- package/skills/attio-cli/references/api/api-webhooks.md +62 -0
- package/skills/attio-cli/references/api/api-workspace-blocklist.md +39 -0
- package/skills/attio-cli/references/api/api-workspace-members.md +19 -0
- package/skills/attio-cli/references/api.md +35 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/@anthropic-ai+sdk@1.3.0_zod@4.6.7/node_modules/@anthropic-ai/sdk/internal/node.mjs
|
|
5
|
+
import * as child_process from "node:child_process";
|
|
6
|
+
import * as crypto from "node:crypto";
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as os from "node:os";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import * as stream from "node:stream";
|
|
11
|
+
import * as util from "node:util";
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
child_process,
|
|
15
|
+
crypto,
|
|
16
|
+
fs,
|
|
17
|
+
os,
|
|
18
|
+
path,
|
|
19
|
+
stream,
|
|
20
|
+
util
|
|
21
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
formatMeetingReference
|
|
5
|
+
} from "./chunk-V6BTAILB.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-BUGROVF3.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.703.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_5630bd43f49d4f78ecc9c491970e88a0/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
|
|
14
|
+
var positive = /* @__PURE__ */ __name((value, name, max) => {
|
|
15
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
16
|
+
throw new CliError("validation_error", `Invalid ${name}`);
|
|
17
|
+
return value;
|
|
18
|
+
}, "positive");
|
|
19
|
+
var cancel = /* @__PURE__ */ __name((signal) => {
|
|
20
|
+
if (signal?.aborted)
|
|
21
|
+
throw new CliError("cancelled", "Meeting semantic operation was cancelled");
|
|
22
|
+
}, "cancel");
|
|
23
|
+
var account = /* @__PURE__ */ __name((accountId) => positive(accountId, "authorized meeting account", Number.MAX_SAFE_INTEGER), "account");
|
|
24
|
+
var descriptor = /* @__PURE__ */ __name((model) => {
|
|
25
|
+
if (!model || typeof model.key !== "string" || !model.key.trim() || model.key.length > 1e3 || typeof model.model !== "string" || !model.model.trim() || !["local", "remote"].includes(model.kind))
|
|
26
|
+
throw new CliError("validation_error", "An explicit meeting embedding model is required");
|
|
27
|
+
return { key: model.key, model: model.model, kind: model.kind, dims: positive(model.dims, "model dimensions", 8192) };
|
|
28
|
+
}, "descriptor");
|
|
29
|
+
var textBudget = /* @__PURE__ */ __name((options) => ({
|
|
30
|
+
maxRows: positive(options.maxRows ?? 1e4, "transcript row budget", 1e5),
|
|
31
|
+
maxTextBytes: positive(options.maxTextBytes ?? 4 * 1024 * 1024, "transcript text byte budget", 64 * 1024 * 1024)
|
|
32
|
+
}), "textBudget");
|
|
33
|
+
var validateVector = /* @__PURE__ */ __name((vector, dims) => {
|
|
34
|
+
if (!(vector instanceof Float32Array) || vector.length !== dims || !vector.some((value) => value !== 0) || vector.some((value) => !Number.isFinite(value)))
|
|
35
|
+
throw new CliError("invalid_response", "Meeting model returned an invalid vector");
|
|
36
|
+
return vector;
|
|
37
|
+
}, "validateVector");
|
|
38
|
+
var readMeetingSemantic = /* @__PURE__ */ __name(async (store, accountId, query, embedder, options = {}) => {
|
|
39
|
+
const accountIdSnapshot = account(accountId);
|
|
40
|
+
const model = descriptor(embedder);
|
|
41
|
+
if (typeof query !== "string" || !query.trim() || Buffer.byteLength(query, "utf8") > 64 * 1024)
|
|
42
|
+
throw new CliError("validation_error", "Meeting semantic query requires 1\u201365536 UTF-8 bytes");
|
|
43
|
+
const limit = positive(options.limit ?? 20, "semantic result limit", 1e3);
|
|
44
|
+
const maxChunks = positive(options.maxChunks ?? 1e3, "semantic candidate budget", 1e4);
|
|
45
|
+
const afterChunkId = options.afterChunkId === void 0 ? void 0 : positive(options.afterChunkId, "semantic candidate cursor", Number.MAX_SAFE_INTEGER);
|
|
46
|
+
const budget = textBudget(options);
|
|
47
|
+
const signal = options.signal;
|
|
48
|
+
cancel(signal);
|
|
49
|
+
const vectors = await embedder.embed([query], "query");
|
|
50
|
+
cancel(signal);
|
|
51
|
+
if (vectors.length !== 1)
|
|
52
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
53
|
+
const vector = validateVector(vectors[0], model.dims);
|
|
54
|
+
const result = await store.nearest(model.key, vector, {
|
|
55
|
+
accountId: accountIdSnapshot,
|
|
56
|
+
limit,
|
|
57
|
+
maxChunks,
|
|
58
|
+
...budget,
|
|
59
|
+
...afterChunkId === void 0 ? {} : { afterChunkId },
|
|
60
|
+
...signal ? { signal } : {}
|
|
61
|
+
});
|
|
62
|
+
cancel(signal);
|
|
63
|
+
const items = result.items.map((hit) => {
|
|
64
|
+
positive(hit.meetingId, "semantic meeting ID", Number.MAX_SAFE_INTEGER);
|
|
65
|
+
positive(hit.transcriptId, "semantic transcript ID", Number.MAX_SAFE_INTEGER);
|
|
66
|
+
if (!Number.isSafeInteger(hit.firstPosition) || hit.firstPosition < 0 || !Number.isSafeInteger(hit.lastPosition) || hit.lastPosition < hit.firstPosition || !Number.isFinite(hit.score))
|
|
67
|
+
throw new CliError("invalid_response", "Meeting semantic hit contains invalid provenance");
|
|
68
|
+
const ref = {
|
|
69
|
+
type: "meeting",
|
|
70
|
+
accountId: accountIdSnapshot,
|
|
71
|
+
meetingId: hit.meetingId,
|
|
72
|
+
transcriptId: hit.transcriptId
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
...hit,
|
|
76
|
+
reference: formatMeetingReference(ref),
|
|
77
|
+
firstCueReference: formatMeetingReference({ ...ref, cuePosition: hit.firstPosition }),
|
|
78
|
+
lastCueReference: formatMeetingReference({ ...ref, cuePosition: hit.lastPosition })
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
...result,
|
|
83
|
+
accountId: accountIdSnapshot,
|
|
84
|
+
model,
|
|
85
|
+
items,
|
|
86
|
+
coverage: {
|
|
87
|
+
scope: "current-indexed-vectors",
|
|
88
|
+
candidateScanComplete: result.complete,
|
|
89
|
+
indexCompleteness: "unknown",
|
|
90
|
+
archiveCompleteness: "unknown"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, "readMeetingSemantic");
|
|
94
|
+
var proposeMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, selected, options = {}) => {
|
|
95
|
+
const accountIdSnapshot = account(accountId);
|
|
96
|
+
const model = descriptor(selected);
|
|
97
|
+
const signal = options.signal;
|
|
98
|
+
cancel(signal);
|
|
99
|
+
const status = await store.status({ accountId: accountIdSnapshot, model: model.key, ...signal ? { signal } : {} });
|
|
100
|
+
cancel(signal);
|
|
101
|
+
return {
|
|
102
|
+
accountId: accountIdSnapshot,
|
|
103
|
+
model,
|
|
104
|
+
status,
|
|
105
|
+
applied: false,
|
|
106
|
+
scope: "existing-current-chunks",
|
|
107
|
+
rebuildRequired: "explicit"
|
|
108
|
+
};
|
|
109
|
+
}, "proposeMeetingEmbedding");
|
|
110
|
+
var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embedder, options = {}) => {
|
|
111
|
+
const accountIdSnapshot = account(accountId);
|
|
112
|
+
const model = descriptor(embedder);
|
|
113
|
+
const maxChunks = positive(options.maxChunks ?? 100, "embedding chunk budget", 1e3);
|
|
114
|
+
const budget = textBudget(options);
|
|
115
|
+
const maxVectorBytes = positive(options.maxVectorBytes ?? 8 * 1024 * 1024, "vector payload byte budget", 64 * 1024 * 1024);
|
|
116
|
+
const afterHash = options.afterHash;
|
|
117
|
+
if (afterHash !== void 0 && !/^[0-9a-f]{64}$/.test(afterHash))
|
|
118
|
+
throw new CliError("validation_error", "Invalid embedding chunk cursor");
|
|
119
|
+
const signal = options.signal;
|
|
120
|
+
cancel(signal);
|
|
121
|
+
const page = await store.chunksToEmbed(model.key, {
|
|
122
|
+
accountId: accountIdSnapshot,
|
|
123
|
+
limit: maxChunks,
|
|
124
|
+
...budget,
|
|
125
|
+
...afterHash === void 0 ? {} : { afterHash },
|
|
126
|
+
...signal ? { signal } : {}
|
|
127
|
+
});
|
|
128
|
+
cancel(signal);
|
|
129
|
+
if (typeof page.hasMore !== "boolean" || page.nextHash !== void 0 && !/^[0-9a-f]{64}$/.test(page.nextHash) || page.hasMore && (page.items.length === 0 || page.nextHash === void 0))
|
|
130
|
+
throw new CliError("invalid_response", "Meeting chunk page cannot advance");
|
|
131
|
+
if (page.items.length > maxChunks || page.items.length * model.dims * 4 > maxVectorBytes)
|
|
132
|
+
throw new CliError("validation_error", "Embedding batch exceeds its chunk or vector payload budget");
|
|
133
|
+
const items = page.items.map(({ hash, text }) => ({ hash, text }));
|
|
134
|
+
if (items.some(({ hash, text }) => !/^[0-9a-f]{64}$/.test(hash) || typeof text !== "string") || new Set(items.map(({ hash }) => hash)).size !== items.length)
|
|
135
|
+
throw new CliError("invalid_response", "Meeting chunk page is invalid");
|
|
136
|
+
if (items.reduce((bytes, item) => bytes + Buffer.byteLength(item.text, "utf8"), 0) > budget.maxTextBytes)
|
|
137
|
+
throw new CliError("validation_error", "Embedding batch exceeds its text byte budget");
|
|
138
|
+
if (!items.length)
|
|
139
|
+
return {
|
|
140
|
+
accountId: accountIdSnapshot,
|
|
141
|
+
model,
|
|
142
|
+
saved: 0,
|
|
143
|
+
skipped: 0,
|
|
144
|
+
hasMore: page.hasMore,
|
|
145
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
146
|
+
};
|
|
147
|
+
const vectors = await embedder.embed(items.map(({ text }) => text), "passage");
|
|
148
|
+
cancel(signal);
|
|
149
|
+
if (vectors.length !== items.length)
|
|
150
|
+
throw new CliError("invalid_response", "Meeting model returned another vector count");
|
|
151
|
+
const rows = items.map(({ hash }, index) => ({ hash, vector: validateVector(vectors[index], model.dims) }));
|
|
152
|
+
const saved = await store.saveCurrent(model.key, model.dims, rows, {
|
|
153
|
+
accountId: accountIdSnapshot,
|
|
154
|
+
...signal ? { signal } : {}
|
|
155
|
+
});
|
|
156
|
+
return {
|
|
157
|
+
accountId: accountIdSnapshot,
|
|
158
|
+
model,
|
|
159
|
+
...saved,
|
|
160
|
+
hasMore: page.hasMore,
|
|
161
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
162
|
+
};
|
|
163
|
+
}, "applyMeetingEmbedding");
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
validateVector,
|
|
167
|
+
readMeetingSemantic,
|
|
168
|
+
proposeMeetingEmbedding,
|
|
169
|
+
applyMeetingEmbedding
|
|
170
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/monthly.js
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
var CI_PAGE = join(dirname(fileURLToPath(new URL("standards/monthly.js", import.meta.resolve("@wirecat/cli-base")).href)), "../../docs/standards/ci.md");
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
throughWrapper
|
|
5
|
+
} from "./chunk-MRREDVPY.js";
|
|
6
|
+
import {
|
|
7
|
+
environmentOf,
|
|
8
|
+
readOnlyLockOf
|
|
9
|
+
} from "./chunk-DF2IIO32.js";
|
|
10
|
+
import {
|
|
11
|
+
array,
|
|
12
|
+
boolean,
|
|
13
|
+
check,
|
|
14
|
+
pipe,
|
|
15
|
+
record,
|
|
16
|
+
safeParse,
|
|
17
|
+
strictObject,
|
|
18
|
+
string
|
|
19
|
+
} from "./chunk-S4UUN6LD.js";
|
|
20
|
+
import {
|
|
21
|
+
CliError
|
|
22
|
+
} from "./chunk-BUGROVF3.js";
|
|
23
|
+
import {
|
|
24
|
+
__name
|
|
25
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.703.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_5630bd43f49d4f78ecc9c491970e88a0/node_modules/@wirecat/cli-core/dist/background/relay.js
|
|
28
|
+
import { createHash } from "node:crypto";
|
|
29
|
+
import { chmodSync, lstatSync, mkdirSync, rmSync } from "node:fs";
|
|
30
|
+
import { createConnection, createServer } from "node:net";
|
|
31
|
+
import { tmpdir } from "node:os";
|
|
32
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
33
|
+
import { PassThrough, Writable } from "node:stream";
|
|
34
|
+
var RELAY_PROTOCOL = 1;
|
|
35
|
+
var requestSchema = strictObject({
|
|
36
|
+
argv: array(string()),
|
|
37
|
+
env: record(string(), string()),
|
|
38
|
+
cwd: pipe(string(), check((path) => isAbsolute(path))),
|
|
39
|
+
tty: boolean(),
|
|
40
|
+
stdinTty: boolean()
|
|
41
|
+
});
|
|
42
|
+
var MAX_CLIENT_LINE = 1024 * 1024;
|
|
43
|
+
var MAX_SERVE_LINE = 64 * 1024 * 1024;
|
|
44
|
+
var MAX_SOCKET_PATH = 100;
|
|
45
|
+
var relayPath = /* @__PURE__ */ __name((lockPath) => {
|
|
46
|
+
const beside = lockPath.replace(/\.lock$/, ".sock");
|
|
47
|
+
if (beside.length <= MAX_SOCKET_PATH)
|
|
48
|
+
return beside;
|
|
49
|
+
const hash = createHash("sha256").update(beside).digest("hex").slice(0, 16);
|
|
50
|
+
const name = join(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash}.sock`);
|
|
51
|
+
const temporary = join(tmpdir(), name);
|
|
52
|
+
if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
|
|
53
|
+
return temporary;
|
|
54
|
+
return join("/tmp", name);
|
|
55
|
+
}, "relayPath");
|
|
56
|
+
var privateDirectory = /* @__PURE__ */ __name((dir) => {
|
|
57
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
58
|
+
const stat = lstatSync(dir);
|
|
59
|
+
const mine = process.getuid === void 0 || stat.uid === process.getuid();
|
|
60
|
+
if (!stat.isDirectory() || !mine || (stat.mode & 63) !== 0) {
|
|
61
|
+
throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
|
|
62
|
+
}
|
|
63
|
+
}, "privateDirectory");
|
|
64
|
+
var lines = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
|
|
65
|
+
let buffered = "";
|
|
66
|
+
socket.setEncoding("utf8");
|
|
67
|
+
socket.on("data", (chunk) => {
|
|
68
|
+
buffered += chunk;
|
|
69
|
+
for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
|
|
70
|
+
const line = buffered.slice(0, end);
|
|
71
|
+
buffered = buffered.slice(end + 1);
|
|
72
|
+
if (line)
|
|
73
|
+
onLine(line);
|
|
74
|
+
}
|
|
75
|
+
if (buffered.length > max)
|
|
76
|
+
onTooLong();
|
|
77
|
+
});
|
|
78
|
+
}, "lines");
|
|
79
|
+
var frame = /* @__PURE__ */ __name((socket, value) => {
|
|
80
|
+
if (!socket.destroyed)
|
|
81
|
+
socket.write(`${JSON.stringify(value)}
|
|
82
|
+
`);
|
|
83
|
+
}, "frame");
|
|
84
|
+
var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
|
|
85
|
+
privateDirectory(dirname(path));
|
|
86
|
+
rmSync(path, { force: true });
|
|
87
|
+
const open = /* @__PURE__ */ new Set();
|
|
88
|
+
const running = /* @__PURE__ */ new Set();
|
|
89
|
+
const server = createServer((socket) => {
|
|
90
|
+
open.add(socket);
|
|
91
|
+
const stop = new AbortController();
|
|
92
|
+
const stdin = new PassThrough();
|
|
93
|
+
let started = false;
|
|
94
|
+
socket.on("error", () => {
|
|
95
|
+
});
|
|
96
|
+
socket.on("close", () => {
|
|
97
|
+
open.delete(socket);
|
|
98
|
+
stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
|
|
99
|
+
if (!stdin.writableEnded)
|
|
100
|
+
stdin.end();
|
|
101
|
+
});
|
|
102
|
+
lines(socket, MAX_CLIENT_LINE, (line) => {
|
|
103
|
+
let message;
|
|
104
|
+
try {
|
|
105
|
+
message = JSON.parse(line);
|
|
106
|
+
} catch {
|
|
107
|
+
socket.destroy();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!started) {
|
|
111
|
+
started = true;
|
|
112
|
+
if (message.v !== RELAY_PROTOCOL) {
|
|
113
|
+
frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
|
|
114
|
+
socket.end();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const parsed = safeParse(requestSchema, message.run);
|
|
118
|
+
if (!parsed.success) {
|
|
119
|
+
socket.destroy();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
stdin.isTTY = parsed.output.stdinTty;
|
|
123
|
+
if (parsed.output.stdinTty)
|
|
124
|
+
stdin.end();
|
|
125
|
+
const job = serve(socket, parsed.output, stdin, stop.signal, run);
|
|
126
|
+
running.add(job);
|
|
127
|
+
void job.then(() => running.delete(job), () => running.delete(job));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (typeof message.stdin === "string" && !stdin.writableEnded)
|
|
131
|
+
stdin.write(Buffer.from(message.stdin, "base64"));
|
|
132
|
+
if (message.stdinEnd === true && !stdin.writableEnded)
|
|
133
|
+
stdin.end();
|
|
134
|
+
}, () => socket.destroy());
|
|
135
|
+
});
|
|
136
|
+
await new Promise((resolve, reject) => {
|
|
137
|
+
server.once("error", reject);
|
|
138
|
+
server.listen(path, () => {
|
|
139
|
+
server.off("error", reject);
|
|
140
|
+
resolve();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
chmodSync(path, 384);
|
|
144
|
+
return {
|
|
145
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
146
|
+
for (const socket of open)
|
|
147
|
+
socket.destroy();
|
|
148
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
149
|
+
await Promise.allSettled(running);
|
|
150
|
+
rmSync(path, { force: true });
|
|
151
|
+
}, "close")
|
|
152
|
+
};
|
|
153
|
+
}, "listenRelay");
|
|
154
|
+
var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) => {
|
|
155
|
+
const streams = {
|
|
156
|
+
data: /* @__PURE__ */ __name((text) => frame(socket, { data: text }), "data"),
|
|
157
|
+
diagnostic: /* @__PURE__ */ __name((text) => frame(socket, { diagnostic: text }), "diagnostic"),
|
|
158
|
+
progress: /* @__PURE__ */ __name((text) => frame(socket, { progress: text }), "progress")
|
|
159
|
+
};
|
|
160
|
+
const stdout = new Writable({
|
|
161
|
+
write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
|
|
162
|
+
frame(socket, { raw: Buffer.from(chunk).toString("base64") });
|
|
163
|
+
done();
|
|
164
|
+
}, "write")
|
|
165
|
+
});
|
|
166
|
+
let code = 1;
|
|
167
|
+
try {
|
|
168
|
+
code = await run(request, { streams, stdin, stdout, signal });
|
|
169
|
+
} finally {
|
|
170
|
+
frame(socket, { exit: code });
|
|
171
|
+
socket.end();
|
|
172
|
+
}
|
|
173
|
+
}, "serve");
|
|
174
|
+
var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
|
|
175
|
+
const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
|
|
176
|
+
const socket = createConnection(path);
|
|
177
|
+
let connected = false;
|
|
178
|
+
let settled = false;
|
|
179
|
+
let timer;
|
|
180
|
+
const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
|
|
181
|
+
const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
|
|
182
|
+
const brokenPipe = /* @__PURE__ */ __name((error) => {
|
|
183
|
+
if (error.code === "EPIPE")
|
|
184
|
+
finish({ code: 0 });
|
|
185
|
+
}, "brokenPipe");
|
|
186
|
+
const finish = /* @__PURE__ */ __name((outcome) => {
|
|
187
|
+
if (settled)
|
|
188
|
+
return;
|
|
189
|
+
settled = true;
|
|
190
|
+
if (timer)
|
|
191
|
+
clearTimeout(timer);
|
|
192
|
+
stdout.off("error", brokenPipe);
|
|
193
|
+
signal.removeEventListener("abort", aborted);
|
|
194
|
+
stdin.off("data", forward).off("end", ended);
|
|
195
|
+
stdin.pause();
|
|
196
|
+
socket.destroy();
|
|
197
|
+
if ("code" in outcome)
|
|
198
|
+
resolve(outcome.code);
|
|
199
|
+
else
|
|
200
|
+
reject(outcome.error);
|
|
201
|
+
}, "finish");
|
|
202
|
+
const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
|
|
203
|
+
const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
|
|
204
|
+
if (signal.aborted)
|
|
205
|
+
return aborted();
|
|
206
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
207
|
+
stdout.on("error", brokenPipe);
|
|
208
|
+
if (deadlineMs !== void 0)
|
|
209
|
+
timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
|
|
210
|
+
socket.on("connect", () => {
|
|
211
|
+
connected = true;
|
|
212
|
+
frame(socket, { v: RELAY_PROTOCOL, run: request });
|
|
213
|
+
if (request.stdinTty)
|
|
214
|
+
ended();
|
|
215
|
+
else {
|
|
216
|
+
stdin.on("data", forward).once("end", ended);
|
|
217
|
+
stdin.resume();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
socket.on("error", (error) => {
|
|
221
|
+
if (connected)
|
|
222
|
+
return finish({ error: stopped() });
|
|
223
|
+
finish({
|
|
224
|
+
error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
socket.on("close", () => finish({ error: stopped() }));
|
|
228
|
+
lines(socket, MAX_SERVE_LINE, (line) => {
|
|
229
|
+
let message;
|
|
230
|
+
try {
|
|
231
|
+
message = JSON.parse(line);
|
|
232
|
+
} catch {
|
|
233
|
+
return finish({ error: stopped() });
|
|
234
|
+
}
|
|
235
|
+
if (typeof message.data === "string")
|
|
236
|
+
streams.data(message.data);
|
|
237
|
+
if (typeof message.diagnostic === "string")
|
|
238
|
+
streams.diagnostic(message.diagnostic);
|
|
239
|
+
if (typeof message.progress === "string")
|
|
240
|
+
streams.progress?.(message.progress);
|
|
241
|
+
if (typeof message.raw === "string")
|
|
242
|
+
stdout.write(Buffer.from(message.raw, "base64"));
|
|
243
|
+
if (typeof message.exit === "number")
|
|
244
|
+
finish({ code: message.exit });
|
|
245
|
+
}, () => finish({ error: stopped() }));
|
|
246
|
+
}), "relayCommand");
|
|
247
|
+
|
|
248
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.703.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_5630bd43f49d4f78ecc9c491970e88a0/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
249
|
+
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
250
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
251
|
+
}, "close"),
|
|
252
|
+
feed: void 0,
|
|
253
|
+
storedChats: void 0,
|
|
254
|
+
listen: void 0,
|
|
255
|
+
listenHistory: void 0,
|
|
256
|
+
...connection.watch && watchers ? {
|
|
257
|
+
// A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
|
|
258
|
+
watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
|
|
259
|
+
let watcher;
|
|
260
|
+
try {
|
|
261
|
+
await new Promise((resolve, reject) => {
|
|
262
|
+
watcher = /* @__PURE__ */ __name((event) => {
|
|
263
|
+
try {
|
|
264
|
+
onEvent(event);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
reject(error);
|
|
267
|
+
}
|
|
268
|
+
}, "watcher");
|
|
269
|
+
watchers.add(watcher);
|
|
270
|
+
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
271
|
+
onReady?.();
|
|
272
|
+
if (signal.aborted)
|
|
273
|
+
resolve();
|
|
274
|
+
});
|
|
275
|
+
} finally {
|
|
276
|
+
if (watcher)
|
|
277
|
+
watchers.delete(watcher);
|
|
278
|
+
}
|
|
279
|
+
}, "watch")
|
|
280
|
+
} : { watch: void 0 }
|
|
281
|
+
}), "lentConnection");
|
|
282
|
+
var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
|
|
283
|
+
let held;
|
|
284
|
+
let relay;
|
|
285
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
286
|
+
const borrowed = /* @__PURE__ */ __name(() => {
|
|
287
|
+
const connection = held;
|
|
288
|
+
if (!connection)
|
|
289
|
+
throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
|
|
290
|
+
return lentConnection(connection, watchers);
|
|
291
|
+
}, "borrowed");
|
|
292
|
+
return {
|
|
293
|
+
messenger: {
|
|
294
|
+
...messenger,
|
|
295
|
+
connect: /* @__PURE__ */ __name(async (...args) => {
|
|
296
|
+
held = await messenger.connect(...args);
|
|
297
|
+
return held;
|
|
298
|
+
}, "connect")
|
|
299
|
+
},
|
|
300
|
+
arrived: /* @__PURE__ */ __name((event) => {
|
|
301
|
+
for (const watcher of watchers)
|
|
302
|
+
watcher(event);
|
|
303
|
+
}, "arrived"),
|
|
304
|
+
/** Listens beside the lock; the address goes into it, which is how a client finds it. */
|
|
305
|
+
open: /* @__PURE__ */ __name(async (lockPath, profile) => {
|
|
306
|
+
const environment = environmentOf(command);
|
|
307
|
+
const runCommand = environment.runCommand;
|
|
308
|
+
if (!runCommand)
|
|
309
|
+
return void 0;
|
|
310
|
+
const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
|
|
311
|
+
const path = relayPath(lockPath);
|
|
312
|
+
relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
|
|
313
|
+
env: {
|
|
314
|
+
...request.env,
|
|
315
|
+
...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
|
|
316
|
+
},
|
|
317
|
+
streams: io.streams,
|
|
318
|
+
stdin: io.stdin,
|
|
319
|
+
stdout: io.stdout,
|
|
320
|
+
tty: request.tty,
|
|
321
|
+
signal: io.signal,
|
|
322
|
+
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
323
|
+
relayed: { profile, cwd: request.cwd, connection: borrowed }
|
|
324
|
+
}));
|
|
325
|
+
return { path, protocol: RELAY_PROTOCOL };
|
|
326
|
+
}, "open"),
|
|
327
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
328
|
+
await relay?.close();
|
|
329
|
+
}, "close")
|
|
330
|
+
};
|
|
331
|
+
}, "serveRelay");
|
|
332
|
+
|
|
333
|
+
export {
|
|
334
|
+
RELAY_PROTOCOL,
|
|
335
|
+
relayCommand,
|
|
336
|
+
lentConnection,
|
|
337
|
+
serveRelay
|
|
338
|
+
};
|