@wirecat/attio-cli 0.0.0-stage → 0.1.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 +20 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2321 -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-KLBL3FYD.js +37 -0
- package/dist/bundle/all-profiles-C2NMRQPE.js +320 -0
- package/dist/bundle/anthropic-KOU2ILDK.js +91 -0
- package/dist/bundle/app-server-TINV4NNY.js +249 -0
- package/dist/bundle/attio.js +183 -0
- package/dist/bundle/bun-GVNM6IWY.js +169 -0
- package/dist/bundle/bun-sqlite-IF6B3EQI.js +76 -0
- package/dist/bundle/chunk-2343HKEW.js +362 -0
- package/dist/bundle/chunk-2H2MWGBD.js +988 -0
- package/dist/bundle/chunk-2P7ENEQ7.js +288 -0
- package/dist/bundle/chunk-4EYKJLWI.js +771 -0
- package/dist/bundle/chunk-4HQDT5PF.js +338 -0
- package/dist/bundle/chunk-4QE4L7UL.js +142 -0
- package/dist/bundle/chunk-4XHWGJXT.js +6848 -0
- package/dist/bundle/chunk-5DCRHSBI.js +72 -0
- package/dist/bundle/chunk-5ETXE5KF.js +372 -0
- package/dist/bundle/chunk-5WAGTWCS.js +156 -0
- package/dist/bundle/chunk-6B5PSQQ7.js +319 -0
- package/dist/bundle/chunk-6BVPS2YY.js +230 -0
- package/dist/bundle/chunk-6L5EUGLP.js +188 -0
- package/dist/bundle/chunk-7NFEMS4A.js +1028 -0
- package/dist/bundle/chunk-A7YQTQ5U.js +733 -0
- package/dist/bundle/chunk-AEPOHR4Z.js +82 -0
- package/dist/bundle/chunk-ARRQVUJ2.js +334 -0
- package/dist/bundle/chunk-BHNFRL3H.js +95 -0
- package/dist/bundle/chunk-CBPL3GID.js +23 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVN54VPI.js +16 -0
- package/dist/bundle/chunk-DW3V7GTY.js +388 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ETSOG6TZ.js +65288 -0
- package/dist/bundle/chunk-FJV3MO57.js +29 -0
- package/dist/bundle/chunk-HLLRNP2G.js +170 -0
- package/dist/bundle/chunk-HQJ2TABD.js +18 -0
- package/dist/bundle/chunk-ICUXAOEM.js +42063 -0
- package/dist/bundle/chunk-IGALQ74S.js +358 -0
- package/dist/bundle/chunk-IPHUAWFG.js +100 -0
- package/dist/bundle/chunk-IYMWUL6E.js +633 -0
- package/dist/bundle/chunk-JKCXDIGC.js +52 -0
- package/dist/bundle/chunk-JTOKDROB.js +95 -0
- package/dist/bundle/chunk-JZMGOVCZ.js +80 -0
- package/dist/bundle/chunk-KB3YJJPN.js +794 -0
- package/dist/bundle/chunk-KD4EUUER.js +37 -0
- package/dist/bundle/chunk-LB6D4QF2.js +2333 -0
- package/dist/bundle/chunk-LWUJZ2E3.js +108 -0
- package/dist/bundle/chunk-MCQOXTAL.js +53 -0
- package/dist/bundle/chunk-MMGCGPKM.js +3571 -0
- package/dist/bundle/chunk-MXDIXBIV.js +24 -0
- package/dist/bundle/chunk-MYVWV5L5.js +407 -0
- package/dist/bundle/chunk-MZNRIH3T.js +1233 -0
- package/dist/bundle/chunk-NEFILPPV.js +353 -0
- package/dist/bundle/chunk-O6CVJGGL.js +131 -0
- package/dist/bundle/chunk-OPXCRQTV.js +161 -0
- package/dist/bundle/chunk-PKNFA5TU.js +38 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PO6PLQYL.js +50 -0
- package/dist/bundle/chunk-PWUQC2GI.js +218 -0
- package/dist/bundle/chunk-QCEEPJNN.js +185 -0
- package/dist/bundle/chunk-QG4WCLGB.js +1332 -0
- package/dist/bundle/chunk-QNQ2OF24.js +9578 -0
- package/dist/bundle/chunk-RCKRXBJF.js +1392 -0
- package/dist/bundle/chunk-RK4GN2II.js +2000 -0
- package/dist/bundle/chunk-RRH7UK7L.js +106 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-S7WJXELM.js +58 -0
- package/dist/bundle/chunk-SBRFKB77.js +1197 -0
- package/dist/bundle/chunk-SP6DPFZ4.js +4072 -0
- package/dist/bundle/chunk-SWJDLFDM.js +557 -0
- package/dist/bundle/chunk-TWCVCW5T.js +66 -0
- package/dist/bundle/chunk-V2R2BJJU.js +63 -0
- package/dist/bundle/chunk-V5K3M7FE.js +78 -0
- package/dist/bundle/chunk-V6ALLFEE.js +1068 -0
- package/dist/bundle/chunk-V6EVJXLO.js +259 -0
- package/dist/bundle/chunk-VJ4CPL6F.js +54 -0
- package/dist/bundle/chunk-VL25A6V2.js +41 -0
- package/dist/bundle/chunk-WBEZZGZE.js +12645 -0
- package/dist/bundle/chunk-WIYAMDPP.js +73 -0
- package/dist/bundle/chunk-WRJGITBX.js +76 -0
- package/dist/bundle/chunk-XHIVZPQ2.js +7 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XTQIXZVM.js +2788 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YKN4Y35P.js +206 -0
- package/dist/bundle/chunk-ZMJZQGCN.js +46 -0
- package/dist/bundle/chunk-ZPSH27BB.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-3FR7BK72.js +37 -0
- package/dist/bundle/command-server-entry-4XR4GDS7.js +166 -0
- package/dist/bundle/decode-24EITKP4.js +297 -0
- package/dist/bundle/definitions-HU62PG4L.js +43364 -0
- package/dist/bundle/dispatch-VE6CXCJW.js +411 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/dist-ZSNEZYVF.js +7577 -0
- package/dist/bundle/echarts-LEVLEF7L.js +42501 -0
- package/dist/bundle/embed-G6FGY3VZ.js +38 -0
- package/dist/bundle/embedder-B6LNMXZZ.js +111 -0
- package/dist/bundle/failure-ASVFQXMF.js +25 -0
- package/dist/bundle/first-run-NVXVVALW.js +29 -0
- package/dist/bundle/first-screen-N3IPK5AT.js +37 -0
- package/dist/bundle/instructions-F3KPYMJK.js +11 -0
- package/dist/bundle/mcp-BUCB5ZPE.js +167 -0
- package/dist/bundle/meeting-combined-7FREWXMB.js +24 -0
- package/dist/bundle/meeting-model-GJPAIUQL.js +25 -0
- package/dist/bundle/meeting-semantic-YWY645AH.js +22 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-WVUZSDLD.js +176 -0
- package/dist/bundle/node-sqlite-V4NNKABG.js +74 -0
- package/dist/bundle/oauth-7CENTQIN.js +20 -0
- package/dist/bundle/open-OLTONZBG.js +23 -0
- package/dist/bundle/openai-M6ES74YN.js +238 -0
- package/dist/bundle/process-VFIFK5KO.js +91 -0
- package/dist/bundle/program-N72VUDXM.js +33418 -0
- package/dist/bundle/prompt-TNWPBEBB.js +17 -0
- package/dist/bundle/recognize-PV2WOUWS.js +26 -0
- package/dist/bundle/remote-3F6JACS5.js +31 -0
- package/dist/bundle/rerank-33C67PIV.js +52 -0
- package/dist/bundle/schemas-RLDEALIJ.js +21410 -0
- package/dist/bundle/serve-3DEMACSQ.js +199 -0
- package/dist/bundle/server-AAK2HWQM.js +79 -0
- package/dist/bundle/server-LIBRGMUZ.js +212 -0
- package/dist/bundle/sqlite-runtime-SMAREHYG.js +20 -0
- package/dist/bundle/state-WPHAVJIU.js +36 -0
- package/dist/bundle/store-A7V4FEXE.js +177 -0
- package/dist/bundle/store-PMAPJNXT.js +291 -0
- package/dist/bundle/store-maintenance-command-QHRHAEYN.js +66 -0
- package/dist/bundle/surface-MN4RTNYW.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/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.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 +43360 -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 +10156 -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 +328 -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/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.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,249 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PER_RUN,
|
|
5
|
+
envelope
|
|
6
|
+
} from "./chunk-KB3YJJPN.js";
|
|
7
|
+
import {
|
|
8
|
+
mcpUrlOf
|
|
9
|
+
} from "./chunk-QG4WCLGB.js";
|
|
10
|
+
import {
|
|
11
|
+
skillResources
|
|
12
|
+
} from "./chunk-DW3V7GTY.js";
|
|
13
|
+
import {
|
|
14
|
+
StdioServerTransport,
|
|
15
|
+
answeredWire,
|
|
16
|
+
serveStdio
|
|
17
|
+
} from "./chunk-IYMWUL6E.js";
|
|
18
|
+
import "./chunk-HQJ2TABD.js";
|
|
19
|
+
import "./chunk-RCKRXBJF.js";
|
|
20
|
+
import "./chunk-NEFILPPV.js";
|
|
21
|
+
import {
|
|
22
|
+
runCommandForAgent,
|
|
23
|
+
toolsFromCommands
|
|
24
|
+
} from "./chunk-MMGCGPKM.js";
|
|
25
|
+
import "./chunk-PO6PLQYL.js";
|
|
26
|
+
import "./chunk-4HQDT5PF.js";
|
|
27
|
+
import {
|
|
28
|
+
appInstructions
|
|
29
|
+
} from "./chunk-MCQOXTAL.js";
|
|
30
|
+
import {
|
|
31
|
+
answered,
|
|
32
|
+
failed,
|
|
33
|
+
registerCommands
|
|
34
|
+
} from "./chunk-SWJDLFDM.js";
|
|
35
|
+
import {
|
|
36
|
+
agentJson
|
|
37
|
+
} from "./chunk-2H2MWGBD.js";
|
|
38
|
+
import "./chunk-ICUXAOEM.js";
|
|
39
|
+
import "./chunk-MYVWV5L5.js";
|
|
40
|
+
import "./chunk-KD4EUUER.js";
|
|
41
|
+
import "./chunk-BHNFRL3H.js";
|
|
42
|
+
import "./chunk-4QE4L7UL.js";
|
|
43
|
+
import "./chunk-ZMJZQGCN.js";
|
|
44
|
+
import "./chunk-LWUJZ2E3.js";
|
|
45
|
+
import "./chunk-A7YQTQ5U.js";
|
|
46
|
+
import {
|
|
47
|
+
McpServer
|
|
48
|
+
} from "./chunk-PL5P7UKW.js";
|
|
49
|
+
import "./chunk-WRJGITBX.js";
|
|
50
|
+
import "./chunk-V6EVJXLO.js";
|
|
51
|
+
import "./chunk-IGALQ74S.js";
|
|
52
|
+
import "./chunk-HLLRNP2G.js";
|
|
53
|
+
import {
|
|
54
|
+
mcpHttpMarker
|
|
55
|
+
} from "./chunk-OPXCRQTV.js";
|
|
56
|
+
import "./chunk-WIYAMDPP.js";
|
|
57
|
+
import "./chunk-O6CVJGGL.js";
|
|
58
|
+
import {
|
|
59
|
+
DEFAULT_OUTPUT_BYTES,
|
|
60
|
+
changesAuthorityAt,
|
|
61
|
+
describeProgram,
|
|
62
|
+
environmentOf,
|
|
63
|
+
fetchesOnlyAt,
|
|
64
|
+
judgedTargets,
|
|
65
|
+
readOnlyLockOf,
|
|
66
|
+
readsOverMcpAt,
|
|
67
|
+
rootOf2 as rootOf
|
|
68
|
+
} from "./chunk-WBEZZGZE.js";
|
|
69
|
+
import "./chunk-2343HKEW.js";
|
|
70
|
+
import "./chunk-JKCXDIGC.js";
|
|
71
|
+
import "./chunk-ARRQVUJ2.js";
|
|
72
|
+
import "./chunk-V2R2BJJU.js";
|
|
73
|
+
import "./chunk-AEPOHR4Z.js";
|
|
74
|
+
import "./chunk-V6ALLFEE.js";
|
|
75
|
+
import "./chunk-TWCVCW5T.js";
|
|
76
|
+
import "./chunk-ETSOG6TZ.js";
|
|
77
|
+
import "./chunk-LB6D4QF2.js";
|
|
78
|
+
import "./chunk-JZMGOVCZ.js";
|
|
79
|
+
import "./chunk-4EYKJLWI.js";
|
|
80
|
+
import "./chunk-DVN54VPI.js";
|
|
81
|
+
import "./chunk-RK4GN2II.js";
|
|
82
|
+
import "./chunk-5WAGTWCS.js";
|
|
83
|
+
import "./chunk-FJV3MO57.js";
|
|
84
|
+
import "./chunk-SP6DPFZ4.js";
|
|
85
|
+
import "./chunk-XHIVZPQ2.js";
|
|
86
|
+
import "./chunk-QCEEPJNN.js";
|
|
87
|
+
import "./chunk-5ETXE5KF.js";
|
|
88
|
+
import "./chunk-SBRFKB77.js";
|
|
89
|
+
import "./chunk-7NFEMS4A.js";
|
|
90
|
+
import "./chunk-ZPSH27BB.js";
|
|
91
|
+
import "./chunk-CBPL3GID.js";
|
|
92
|
+
import "./chunk-D72URWJE.js";
|
|
93
|
+
import "./chunk-VJ4CPL6F.js";
|
|
94
|
+
import "./chunk-JTOKDROB.js";
|
|
95
|
+
import "./chunk-PKNFA5TU.js";
|
|
96
|
+
import "./chunk-XTQIXZVM.js";
|
|
97
|
+
import {
|
|
98
|
+
mcpErrorResult
|
|
99
|
+
} from "./chunk-MZNRIH3T.js";
|
|
100
|
+
import "./chunk-S4UUN6LD.js";
|
|
101
|
+
import "./chunk-Y5E2WNWB.js";
|
|
102
|
+
import {
|
|
103
|
+
CliError
|
|
104
|
+
} from "./chunk-5DCRHSBI.js";
|
|
105
|
+
import "./chunk-4XHWGJXT.js";
|
|
106
|
+
import {
|
|
107
|
+
__name
|
|
108
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
109
|
+
|
|
110
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/mcp/app-server.js
|
|
111
|
+
var EXCLUDED = [["mcp"]];
|
|
112
|
+
var aliasesOf = /* @__PURE__ */ __name((root, path) => {
|
|
113
|
+
let at = root;
|
|
114
|
+
for (const name of path)
|
|
115
|
+
at = at?.commands.find((child) => child.name() === name);
|
|
116
|
+
const aliases = at?.aliases() ?? [];
|
|
117
|
+
return aliases.length > 0 ? { aliases } : {};
|
|
118
|
+
}, "aliasesOf");
|
|
119
|
+
var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
|
|
120
|
+
const { app } = options;
|
|
121
|
+
const root = rootOf(command);
|
|
122
|
+
const environment = environmentOf(command);
|
|
123
|
+
if (!environment.runCommand)
|
|
124
|
+
throw new Error("the MCP server runs inside run(), which hands it the program");
|
|
125
|
+
const program = { run: environment.runCommand, commands: describeProgram(root) };
|
|
126
|
+
const flags = command.optsWithGlobals();
|
|
127
|
+
const overrides = flags.permission ?? [];
|
|
128
|
+
const { settings } = context;
|
|
129
|
+
const levels = /* @__PURE__ */ __name(() => options.resolveSettings(flags, { env: context.env }).permissions, "levels");
|
|
130
|
+
const readOnly = /* @__PURE__ */ __name(() => readOnlyLockOf(app, context.env) !== void 0, "readOnly");
|
|
131
|
+
const authority = changesAuthorityAt(root);
|
|
132
|
+
const fetches = fetchesOnlyAt(root);
|
|
133
|
+
const targets = judgedTargets(root);
|
|
134
|
+
const passed = Object.fromEntries(Object.entries(environment).filter(([key]) => !PER_RUN.has(key)));
|
|
135
|
+
const tools = toolsFromCommands(program.commands, {
|
|
136
|
+
includeUnavailable: true,
|
|
137
|
+
exclude: EXCLUDED,
|
|
138
|
+
levels: settings.permissions,
|
|
139
|
+
currentLevels: levels,
|
|
140
|
+
readOnly: readOnly(),
|
|
141
|
+
authority,
|
|
142
|
+
fetchOnly: readsOverMcpAt(root),
|
|
143
|
+
fetches,
|
|
144
|
+
permissions: options.permissions
|
|
145
|
+
});
|
|
146
|
+
const availability = /* @__PURE__ */ __name((one) => () => {
|
|
147
|
+
const permitted = one.availability?.() ?? { available: true };
|
|
148
|
+
if (!permitted.available)
|
|
149
|
+
return permitted;
|
|
150
|
+
return options.availability?.(one.path, settings.profile) ?? permitted;
|
|
151
|
+
}, "availability");
|
|
152
|
+
const commands = Object.fromEntries(tools.map((one) => [
|
|
153
|
+
one.command,
|
|
154
|
+
{
|
|
155
|
+
title: one.title,
|
|
156
|
+
description: one.description,
|
|
157
|
+
...one.keywords ? { keywords: one.keywords } : {},
|
|
158
|
+
...aliasesOf(root, one.path),
|
|
159
|
+
writes: one.writes,
|
|
160
|
+
availability: availability(one),
|
|
161
|
+
input: one.input,
|
|
162
|
+
run: /* @__PURE__ */ __name(async (input, ctx) => {
|
|
163
|
+
const own = options.availability?.(one.path, settings.profile);
|
|
164
|
+
if (own && !own.available)
|
|
165
|
+
return failed(new CliError("permission_error", `${one.command}: ${own.reason ?? "unavailable for this profile"}`, {
|
|
166
|
+
...own.permission ? { permission: own.permission } : {}
|
|
167
|
+
}), app.errors);
|
|
168
|
+
const traceparent = ctx?.mcpReq?._meta?.traceparent;
|
|
169
|
+
const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
|
|
170
|
+
const answer = await runCommandForAgent(program, one.path, input, {
|
|
171
|
+
profile: settings.profile,
|
|
172
|
+
readOnly: readOnly(),
|
|
173
|
+
env,
|
|
174
|
+
levels,
|
|
175
|
+
overrides,
|
|
176
|
+
authority,
|
|
177
|
+
fetches,
|
|
178
|
+
permissions: options.permissions,
|
|
179
|
+
environment: passed
|
|
180
|
+
});
|
|
181
|
+
if ("error" in answer)
|
|
182
|
+
return mcpErrorResult(JSON.parse(agentJson(answer.error)));
|
|
183
|
+
try {
|
|
184
|
+
return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
return failed(error, app.errors);
|
|
187
|
+
}
|
|
188
|
+
}, "run")
|
|
189
|
+
}
|
|
190
|
+
]));
|
|
191
|
+
const skills = options.skill ? skillResources(app, options.skill) : [];
|
|
192
|
+
const skill = skills[0];
|
|
193
|
+
const build = /* @__PURE__ */ __name(() => {
|
|
194
|
+
const server = new McpServer({ name: app.command, version: app.version }, {
|
|
195
|
+
instructions: appInstructions({
|
|
196
|
+
command: app.command,
|
|
197
|
+
name: options.name,
|
|
198
|
+
profile: settings.profile,
|
|
199
|
+
untrusted: options.untrusted,
|
|
200
|
+
...skill ? { skill: skill.instruction } : {}
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
registerCommands(server, app.command, commands, app.errors, void 0, app.messenger);
|
|
204
|
+
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
205
|
+
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
206
|
+
return server;
|
|
207
|
+
}, "build");
|
|
208
|
+
return { build, offered: Object.keys(commands) };
|
|
209
|
+
}, "createAppServer");
|
|
210
|
+
var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options) => {
|
|
211
|
+
const { build } = createAppServer(command, context, options);
|
|
212
|
+
const { stdin, stdout, signal } = environmentOf(command);
|
|
213
|
+
const own = stdin && stdout && stdin !== process.stdin;
|
|
214
|
+
const wire = answeredWire(own ? stdin : process.stdin, own ? stdout : process.stdout);
|
|
215
|
+
const handle = serveStdio(build, {
|
|
216
|
+
transport: new StdioServerTransport(wire.input, wire.output),
|
|
217
|
+
onerror: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onerror")
|
|
218
|
+
});
|
|
219
|
+
await wire.finished(own ? signal : void 0);
|
|
220
|
+
wire.release();
|
|
221
|
+
await handle.close();
|
|
222
|
+
}, "serveAppOverStdio");
|
|
223
|
+
var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
|
|
224
|
+
const { app } = options;
|
|
225
|
+
const { build } = createAppServer(command, context, options);
|
|
226
|
+
const { serveOverHttp } = await import("./serve-3DEMACSQ.js");
|
|
227
|
+
const listening = await serveOverHttp(build, {
|
|
228
|
+
...http,
|
|
229
|
+
appName: app.command,
|
|
230
|
+
reaches: `your ${options.name}`,
|
|
231
|
+
onCode: /* @__PURE__ */ __name((code, expires) => context.renderer.note(context.env[mcpHttpMarker(app.envPrefix)] === void 0 ? `login code for a new browser app: ${code} (until ${expires.toTimeString().slice(0, 5)}; a new one after each login)` : `a new login code for a browser app: \`${app.command} ${context.settings.profile} mcp server status\``), "onCode"),
|
|
232
|
+
onError: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onError")
|
|
233
|
+
}).catch((error) => {
|
|
234
|
+
if (error.code === "EADDRINUSE")
|
|
235
|
+
throw new CliError("configuration_error", `port ${http.port} is in use \u2014 pass another with --port`);
|
|
236
|
+
throw error;
|
|
237
|
+
});
|
|
238
|
+
context.renderer.note(`serving on ${listening.url.href} \u2014 point your tunnel at it; connectors use ${mcpUrlOf(http.publicUrl).href}`);
|
|
239
|
+
await new Promise((resolve) => {
|
|
240
|
+
process.once("SIGINT", resolve);
|
|
241
|
+
process.once("SIGTERM", resolve);
|
|
242
|
+
});
|
|
243
|
+
await listening.close();
|
|
244
|
+
}, "serveAppOverHttp");
|
|
245
|
+
export {
|
|
246
|
+
createAppServer,
|
|
247
|
+
serveAppOverHttp,
|
|
248
|
+
serveAppOverStdio
|
|
249
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
3
|
+
const require = __bundleRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
DESKTOP
|
|
6
|
+
} from "./chunk-VL25A6V2.js";
|
|
7
|
+
import {
|
|
8
|
+
installerOf
|
|
9
|
+
} from "./chunk-CBPL3GID.js";
|
|
10
|
+
import {
|
|
11
|
+
DESCRIBE_FLAG,
|
|
12
|
+
DISPATCH_FLAG,
|
|
13
|
+
PROGRAM_PREFIX,
|
|
14
|
+
SHIM_FORMAT,
|
|
15
|
+
describeAnswer,
|
|
16
|
+
exists,
|
|
17
|
+
fileState,
|
|
18
|
+
shimFiles,
|
|
19
|
+
writeShim
|
|
20
|
+
} from "./chunk-YKN4Y35P.js";
|
|
21
|
+
import "./chunk-XTQIXZVM.js";
|
|
22
|
+
import {
|
|
23
|
+
catchCrashes
|
|
24
|
+
} from "./chunk-MZNRIH3T.js";
|
|
25
|
+
import "./chunk-S4UUN6LD.js";
|
|
26
|
+
import "./chunk-Y5E2WNWB.js";
|
|
27
|
+
import "./chunk-5DCRHSBI.js";
|
|
28
|
+
import {
|
|
29
|
+
__name
|
|
30
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
31
|
+
|
|
32
|
+
// dist/bin/attio.js
|
|
33
|
+
import { enableCompileCache } from "node:module";
|
|
34
|
+
|
|
35
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
|
|
36
|
+
import { createHash } from "node:crypto";
|
|
37
|
+
import { existsSync, readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
38
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
39
|
+
import { fileURLToPath } from "node:url";
|
|
40
|
+
|
|
41
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/launcher.js
|
|
42
|
+
import { readFileSync } from "node:fs";
|
|
43
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
44
|
+
var posix = /* @__PURE__ */ __name((path) => path.replaceAll("\\", "/"), "posix");
|
|
45
|
+
var pnpmHome = /* @__PURE__ */ __name((path, env) => {
|
|
46
|
+
const home = env.PNPM_HOME;
|
|
47
|
+
return home && path.startsWith(`${posix(home).replace(/\/+$/, "")}/`) ? home : void 0;
|
|
48
|
+
}, "pnpmHome");
|
|
49
|
+
var layoutFolders = /* @__PURE__ */ __name((script, env) => {
|
|
50
|
+
const path = posix(script);
|
|
51
|
+
const home = pnpmHome(path, env);
|
|
52
|
+
if (home)
|
|
53
|
+
return [join(home, "bin"), home];
|
|
54
|
+
switch (installerOf(script)) {
|
|
55
|
+
case "bun":
|
|
56
|
+
return [`${path.slice(0, path.indexOf("/install/global/node_modules/"))}/bin`];
|
|
57
|
+
case "npm": {
|
|
58
|
+
const root = path.slice(0, path.indexOf("/node_modules/"));
|
|
59
|
+
return [basename(root) === "lib" ? join(dirname(root), "bin") : root];
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
}, "layoutFolders");
|
|
65
|
+
var binFolder = /* @__PURE__ */ __name(({ name, argv1, script, env, platform }) => {
|
|
66
|
+
if (!["npm", "pnpm", "bun"].includes(installerOf(script)) && !pnpmHome(posix(script), env))
|
|
67
|
+
return void 0;
|
|
68
|
+
const extensions = platform === "win32" ? [".cmd", ".exe"] : [""];
|
|
69
|
+
const candidates = [argv1 ? dirname(argv1) : void 0, ...layoutFolders(script, env)];
|
|
70
|
+
for (const dir of new Set(candidates)) {
|
|
71
|
+
if (dir === void 0 || basename(dir) === ".bin")
|
|
72
|
+
continue;
|
|
73
|
+
for (const extension of extensions) {
|
|
74
|
+
const program = `${PROGRAM_PREFIX}${name}${extension}`;
|
|
75
|
+
if (exists(join(dir, program)))
|
|
76
|
+
return { dir, program };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return void 0;
|
|
80
|
+
}, "binFolder");
|
|
81
|
+
var installed = /* @__PURE__ */ __name((dir, program) => {
|
|
82
|
+
if (!exists(join(dir, program)))
|
|
83
|
+
return false;
|
|
84
|
+
if (!program.toLowerCase().endsWith(".exe"))
|
|
85
|
+
return true;
|
|
86
|
+
let script;
|
|
87
|
+
try {
|
|
88
|
+
script = readFileSync(join(dir, `${program.slice(0, -4)}.bunx`)).toString("utf16le").split('"')[0] ?? "";
|
|
89
|
+
} catch {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
if (script === "" || exists(resolve(dir, script)))
|
|
93
|
+
return true;
|
|
94
|
+
const at = posix(script).lastIndexOf("/install/global/node_modules/");
|
|
95
|
+
return at < 0 || exists(join(dirname(dir), posix(script).slice(at + 1)));
|
|
96
|
+
}, "installed");
|
|
97
|
+
var NAME = "wcat";
|
|
98
|
+
var ensureLauncher = /* @__PURE__ */ __name(({ dir, program, platform }) => {
|
|
99
|
+
try {
|
|
100
|
+
if (!exists(join(dir, program)))
|
|
101
|
+
return "failed";
|
|
102
|
+
const mine = shimFiles("launcher", { dir, name: NAME, target: program, platform });
|
|
103
|
+
const states = mine.map((file) => fileState(file.path));
|
|
104
|
+
if (states.some((one) => one.state === "foreign"))
|
|
105
|
+
return "foreign";
|
|
106
|
+
const ours = states.flatMap((one) => one.state === "ours" ? [one] : []);
|
|
107
|
+
if (ours.some(({ mark }) => mark.format > SHIM_FORMAT))
|
|
108
|
+
return "newer";
|
|
109
|
+
if (ours.some(({ mark }) => mark.kind !== "launcher"))
|
|
110
|
+
return "foreign";
|
|
111
|
+
const current = ours.find(({ mark }) => installed(dir, mark.target))?.mark.target;
|
|
112
|
+
const wanted = shimFiles("launcher", { dir, name: NAME, target: current ?? program, platform });
|
|
113
|
+
const stale = wanted.filter((file, at) => {
|
|
114
|
+
const state = states[at];
|
|
115
|
+
return state?.state !== "ours" || state.text !== file.text;
|
|
116
|
+
});
|
|
117
|
+
if (stale.length === 0)
|
|
118
|
+
return "kept";
|
|
119
|
+
for (const file of stale)
|
|
120
|
+
writeShim(file);
|
|
121
|
+
return "written";
|
|
122
|
+
} catch {
|
|
123
|
+
return "failed";
|
|
124
|
+
}
|
|
125
|
+
}, "ensureLauncher");
|
|
126
|
+
|
|
127
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
|
|
128
|
+
var wcatStart = /* @__PURE__ */ __name(async (tool, io = {}) => {
|
|
129
|
+
const argv = io.argv ?? process.argv;
|
|
130
|
+
const env = io.env ?? process.env;
|
|
131
|
+
const platform = io.platform ?? process.platform;
|
|
132
|
+
const stdout = io.stdout ?? process.stdout;
|
|
133
|
+
const [first, ...rest] = argv.slice(2);
|
|
134
|
+
if (first === DESCRIBE_FLAG) {
|
|
135
|
+
stdout.write(`${JSON.stringify(describeAnswer(tool, shippedManifest(argv[1])))}
|
|
136
|
+
`);
|
|
137
|
+
return { code: 0 };
|
|
138
|
+
}
|
|
139
|
+
if (first === DISPATCH_FLAG) {
|
|
140
|
+
const { runWcat } = await import("./dispatch-VE6CXCJW.js");
|
|
141
|
+
const code = await runWcat(rest, { env, platform, stdout, stderr: io.stderr ?? process.stderr, self: tool });
|
|
142
|
+
return { code };
|
|
143
|
+
}
|
|
144
|
+
const folder = binFolder({
|
|
145
|
+
name: tool.command,
|
|
146
|
+
argv1: argv[1],
|
|
147
|
+
script: io.script ?? fileURLToPath(new URL("wcat/start.js", import.meta.resolve("@wirecat/cli-base")).href),
|
|
148
|
+
env,
|
|
149
|
+
platform
|
|
150
|
+
});
|
|
151
|
+
return folder ? { launcher: ensureLauncher({ ...folder, platform }) } : {};
|
|
152
|
+
}, "wcatStart");
|
|
153
|
+
var shippedManifest = /* @__PURE__ */ __name((bin) => {
|
|
154
|
+
if (!bin)
|
|
155
|
+
return void 0;
|
|
156
|
+
try {
|
|
157
|
+
for (let dir = dirname2(realpathSync(bin)); ; dir = dirname2(dir)) {
|
|
158
|
+
if (existsSync(join2(dir, "package.json"))) {
|
|
159
|
+
const bytes = readFileSync2(join2(dir, "contracts", "wirecat.json"));
|
|
160
|
+
const { wcat_manifest: format, desktop } = JSON.parse(bytes.toString("utf8"));
|
|
161
|
+
if (format !== 2 || typeof desktop !== "object" || desktop === null)
|
|
162
|
+
return void 0;
|
|
163
|
+
return { desktop, sha256: createHash("sha256").update(bytes).digest("hex") };
|
|
164
|
+
}
|
|
165
|
+
if (dirname2(dir) === dir)
|
|
166
|
+
return void 0;
|
|
167
|
+
}
|
|
168
|
+
} catch {
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
}, "shippedManifest");
|
|
172
|
+
|
|
173
|
+
// dist/bin/attio.js
|
|
174
|
+
enableCompileCache();
|
|
175
|
+
var stopCatching = catchCrashes({ cli: DESKTOP.command, interactive: process.stdout.isTTY === true });
|
|
176
|
+
var wcat = await wcatStart(DESKTOP);
|
|
177
|
+
if (wcat.code !== void 0) {
|
|
178
|
+
process.exitCode = wcat.code;
|
|
179
|
+
} else {
|
|
180
|
+
const { run } = await import("./program-N72VUDXM.js");
|
|
181
|
+
process.exitCode = await run(process.argv.slice(2));
|
|
182
|
+
}
|
|
183
|
+
stopCatching();
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DefaultLogger,
|
|
5
|
+
DrizzleQueryError,
|
|
6
|
+
NoopLogger,
|
|
7
|
+
SQLiteAsyncDatabase,
|
|
8
|
+
SQLiteAsyncPreparedQuery,
|
|
9
|
+
SQLiteAsyncSession,
|
|
10
|
+
SQLiteAsyncTransaction,
|
|
11
|
+
SQLiteDialect,
|
|
12
|
+
booleanFromInteger,
|
|
13
|
+
bufferFromBytes,
|
|
14
|
+
castToText,
|
|
15
|
+
dateFromStoredMilliseconds,
|
|
16
|
+
dateFromStoredSeconds,
|
|
17
|
+
entityKind,
|
|
18
|
+
jitCompatCheck,
|
|
19
|
+
refineSqliteCodecs,
|
|
20
|
+
sql
|
|
21
|
+
} from "./chunk-4XHWGJXT.js";
|
|
22
|
+
import {
|
|
23
|
+
__name
|
|
24
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
25
|
+
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/bun.js
|
|
27
|
+
import { Database } from "bun:sqlite";
|
|
28
|
+
var bunSQLiteCodecs = refineSqliteCodecs({
|
|
29
|
+
"integer:boolean": { normalize: booleanFromInteger },
|
|
30
|
+
"integer:timestamp": { normalize: dateFromStoredSeconds },
|
|
31
|
+
"integer:timestamp_ms": { normalize: dateFromStoredMilliseconds },
|
|
32
|
+
"text:json": { normalize: JSON.parse },
|
|
33
|
+
blob: { normalize: bufferFromBytes },
|
|
34
|
+
"blob:json": {
|
|
35
|
+
cast: castToText,
|
|
36
|
+
normalize: JSON.parse
|
|
37
|
+
},
|
|
38
|
+
"blob:bigint": {
|
|
39
|
+
cast: castToText,
|
|
40
|
+
normalize: BigInt
|
|
41
|
+
},
|
|
42
|
+
numeric: {
|
|
43
|
+
cast: castToText,
|
|
44
|
+
normalize: String
|
|
45
|
+
},
|
|
46
|
+
"numeric:number": { normalize: Number },
|
|
47
|
+
"numeric:bigint": {
|
|
48
|
+
cast: castToText,
|
|
49
|
+
normalize: BigInt
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var SQLiteBunSession = class extends SQLiteAsyncSession {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "SQLiteBunSession");
|
|
55
|
+
}
|
|
56
|
+
client;
|
|
57
|
+
relations;
|
|
58
|
+
options;
|
|
59
|
+
static [entityKind] = "SQLiteBunSession";
|
|
60
|
+
logger;
|
|
61
|
+
constructor(client, dialect, relations, options = {}) {
|
|
62
|
+
super(dialect, "sync");
|
|
63
|
+
this.client = client;
|
|
64
|
+
this.relations = relations;
|
|
65
|
+
this.options = options;
|
|
66
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
67
|
+
}
|
|
68
|
+
exec(query) {
|
|
69
|
+
this.client.exec(query);
|
|
70
|
+
}
|
|
71
|
+
prepareQuery(query, mode, _prepare, executeMethod, mapper, queryMetadata) {
|
|
72
|
+
let stmt;
|
|
73
|
+
try {
|
|
74
|
+
stmt = this.client.query(query.sql);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw new DrizzleQueryError(query.sql, this.options.paramsInErrors ? query.params : void 0, e);
|
|
77
|
+
}
|
|
78
|
+
return new SQLiteAsyncPreparedQuery("sync", executeMethod, {
|
|
79
|
+
all: /* @__PURE__ */ __name((params) => {
|
|
80
|
+
if (mode === "arrays") return stmt.values(...params);
|
|
81
|
+
return stmt.all(...params);
|
|
82
|
+
}, "all"),
|
|
83
|
+
get: /* @__PURE__ */ __name((params) => {
|
|
84
|
+
if (mode === "arrays") return stmt.values(...params)[0];
|
|
85
|
+
return stmt.get(...params);
|
|
86
|
+
}, "get"),
|
|
87
|
+
run: /* @__PURE__ */ __name((params) => {
|
|
88
|
+
return stmt.run(...params);
|
|
89
|
+
}, "run")
|
|
90
|
+
}, query, mapper, mode, this.logger, void 0, queryMetadata, void 0, this.options.paramsInErrors);
|
|
91
|
+
}
|
|
92
|
+
transaction(transaction, config = {}) {
|
|
93
|
+
const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.relations);
|
|
94
|
+
let result;
|
|
95
|
+
const nativeTx = this.client.transaction(() => {
|
|
96
|
+
result = transaction(tx);
|
|
97
|
+
});
|
|
98
|
+
if (config.behavior === "concurrent") throw new Error("Concurrent transactions are not supported by driver");
|
|
99
|
+
nativeTx[config.behavior ?? "deferred"]();
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var SQLiteBunTransaction = class SQLiteBunTransaction2 extends SQLiteAsyncTransaction {
|
|
104
|
+
static {
|
|
105
|
+
__name(this, "SQLiteBunTransaction2");
|
|
106
|
+
}
|
|
107
|
+
static [entityKind] = "SQLiteBunTransaction";
|
|
108
|
+
transaction(transaction) {
|
|
109
|
+
const savepointName = `sp${this.nestedIndex}`;
|
|
110
|
+
const tx = new SQLiteBunTransaction2("sync", this.dialect, this.session, this._.relations, this.nestedIndex + 1);
|
|
111
|
+
this.session.run(sql.raw(`savepoint ${savepointName}`));
|
|
112
|
+
try {
|
|
113
|
+
const result = transaction(tx);
|
|
114
|
+
this.session.run(sql.raw(`release savepoint ${savepointName}`));
|
|
115
|
+
return result;
|
|
116
|
+
} catch (err) {
|
|
117
|
+
try {
|
|
118
|
+
this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var SQLiteBunDatabase = class extends SQLiteAsyncDatabase {
|
|
126
|
+
static {
|
|
127
|
+
__name(this, "SQLiteBunDatabase");
|
|
128
|
+
}
|
|
129
|
+
static [entityKind] = "SQLiteBunDatabase";
|
|
130
|
+
};
|
|
131
|
+
function construct(client, config = {}) {
|
|
132
|
+
const dialect = new SQLiteDialect({
|
|
133
|
+
codecs: config.codecs ?? bunSQLiteCodecs,
|
|
134
|
+
useJitMappers: jitCompatCheck(config.jit)
|
|
135
|
+
});
|
|
136
|
+
let logger;
|
|
137
|
+
if (config.logger === true) logger = new DefaultLogger();
|
|
138
|
+
else if (config.logger !== false) logger = config.logger;
|
|
139
|
+
const relations = config.relations ?? {};
|
|
140
|
+
const db = new SQLiteBunDatabase("sync", dialect, new SQLiteBunSession(client, dialect, relations, {
|
|
141
|
+
logger,
|
|
142
|
+
paramsInErrors: config.paramsInErrors
|
|
143
|
+
}), relations);
|
|
144
|
+
db.$client = client;
|
|
145
|
+
return db;
|
|
146
|
+
}
|
|
147
|
+
__name(construct, "construct");
|
|
148
|
+
function drizzle(...params) {
|
|
149
|
+
if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new Database() : new Database(params[0]), params[1]);
|
|
150
|
+
const { connection, client, ...DrizzleSQLiteConfig } = params[0];
|
|
151
|
+
if (client) return construct(client, DrizzleSQLiteConfig);
|
|
152
|
+
if (typeof connection === "object") {
|
|
153
|
+
const { source, ...opts } = connection;
|
|
154
|
+
const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
|
|
155
|
+
return construct(new Database(source, options), DrizzleSQLiteConfig);
|
|
156
|
+
}
|
|
157
|
+
return construct(new Database(connection), DrizzleSQLiteConfig);
|
|
158
|
+
}
|
|
159
|
+
__name(drizzle, "drizzle");
|
|
160
|
+
(function(_drizzle) {
|
|
161
|
+
function mock(config) {
|
|
162
|
+
return construct({}, config);
|
|
163
|
+
}
|
|
164
|
+
__name(mock, "mock");
|
|
165
|
+
_drizzle.mock = mock;
|
|
166
|
+
})(drizzle || (drizzle = {}));
|
|
167
|
+
export {
|
|
168
|
+
drizzle
|
|
169
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
loadVectorExtension,
|
|
5
|
+
vectorExtension
|
|
6
|
+
} from "./chunk-S7WJXELM.js";
|
|
7
|
+
import {
|
|
8
|
+
refuseOwnerStoreInTests
|
|
9
|
+
} from "./chunk-VJ4CPL6F.js";
|
|
10
|
+
import "./chunk-XTQIXZVM.js";
|
|
11
|
+
import "./chunk-MZNRIH3T.js";
|
|
12
|
+
import "./chunk-S4UUN6LD.js";
|
|
13
|
+
import {
|
|
14
|
+
importFrom
|
|
15
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
16
|
+
import "./chunk-5DCRHSBI.js";
|
|
17
|
+
import {
|
|
18
|
+
__name
|
|
19
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
20
|
+
|
|
21
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/store/drivers/bun-sqlite.js
|
|
22
|
+
var customised = false;
|
|
23
|
+
var ownLibrary = /* @__PURE__ */ __name(async () => {
|
|
24
|
+
try {
|
|
25
|
+
const { libraryFor } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
26
|
+
return libraryFor();
|
|
27
|
+
} catch {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
}, "ownLibrary");
|
|
31
|
+
var bunDatabase = /* @__PURE__ */ __name(async () => {
|
|
32
|
+
const specifier = "bun:sqlite";
|
|
33
|
+
const { Database } = await importFrom(new URL("store/drivers/bun-sqlite.js", import.meta.resolve("@wirecat/cli-core")).href, specifier);
|
|
34
|
+
if (process.platform === "darwin" && !customised) {
|
|
35
|
+
customised = true;
|
|
36
|
+
const library = await ownLibrary();
|
|
37
|
+
if (library)
|
|
38
|
+
Database.setCustomSQLite(library);
|
|
39
|
+
}
|
|
40
|
+
return Database;
|
|
41
|
+
}, "bunDatabase");
|
|
42
|
+
var openWithBunSqlite = /* @__PURE__ */ __name(async (path) => cacheOverBunSqlite(await bunClient(path)), "openWithBunSqlite");
|
|
43
|
+
var bunClient = /* @__PURE__ */ __name(async (path, options) => {
|
|
44
|
+
refuseOwnerStoreInTests(path);
|
|
45
|
+
const Database = await bunDatabase();
|
|
46
|
+
const extension = await vectorExtension();
|
|
47
|
+
const client = options ? new Database(path, options) : new Database(path);
|
|
48
|
+
try {
|
|
49
|
+
loadVectorExtension(client, extension);
|
|
50
|
+
return client;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
client.close();
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}, "bunClient");
|
|
56
|
+
var cacheOverBunSqlite = /* @__PURE__ */ __name((database) => {
|
|
57
|
+
return {
|
|
58
|
+
exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
|
|
59
|
+
prepare: /* @__PURE__ */ __name((sql) => {
|
|
60
|
+
const statement = database.query(sql);
|
|
61
|
+
return {
|
|
62
|
+
run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
|
|
63
|
+
// Bun answers null for no row; the seam promises undefined, and `!== undefined` checks rely on it.
|
|
64
|
+
get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters) ?? void 0, "get"),
|
|
65
|
+
all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
|
|
66
|
+
};
|
|
67
|
+
}, "prepare"),
|
|
68
|
+
close: /* @__PURE__ */ __name(() => database.close(), "close")
|
|
69
|
+
};
|
|
70
|
+
}, "cacheOverBunSqlite");
|
|
71
|
+
export {
|
|
72
|
+
bunClient,
|
|
73
|
+
bunDatabase,
|
|
74
|
+
cacheOverBunSqlite,
|
|
75
|
+
openWithBunSqlite
|
|
76
|
+
};
|