@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,188 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
stdinFieldOf
|
|
5
|
+
} from "./chunk-HQJ2TABD.js";
|
|
6
|
+
import {
|
|
7
|
+
commandPathOf
|
|
8
|
+
} from "./chunk-O6CVJGGL.js";
|
|
9
|
+
import {
|
|
10
|
+
commandServerRequest,
|
|
11
|
+
metaOf
|
|
12
|
+
} from "./chunk-WBEZZGZE.js";
|
|
13
|
+
import {
|
|
14
|
+
errorObjectOf,
|
|
15
|
+
renderError
|
|
16
|
+
} from "./chunk-MZNRIH3T.js";
|
|
17
|
+
import {
|
|
18
|
+
CliError
|
|
19
|
+
} from "./chunk-5DCRHSBI.js";
|
|
20
|
+
import {
|
|
21
|
+
__name
|
|
22
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
23
|
+
|
|
24
|
+
// 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/cli/command-server.js
|
|
25
|
+
import { createInterface } from "node:readline";
|
|
26
|
+
|
|
27
|
+
// 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/cli/command-server-argv.js
|
|
28
|
+
var COMMAND_SERVER_ARGV = ["commands", "--serve"];
|
|
29
|
+
var isCommandServer = /* @__PURE__ */ __name((args) => args.length === COMMAND_SERVER_ARGV.length && COMMAND_SERVER_ARGV.every((word, at) => args[at] === word), "isCommandServer");
|
|
30
|
+
|
|
31
|
+
// 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/cli/command-server.js
|
|
32
|
+
var COMMAND_SERVER_PROTOCOL = 1;
|
|
33
|
+
var COMMAND_SERVER_IDLE_MS = 10 * 6e4;
|
|
34
|
+
var COMMAND_SERVER_CONCURRENT = 8;
|
|
35
|
+
var runsAlone = /* @__PURE__ */ __name((command) => commandPathOf(command)[0] === "store", "runsAlone");
|
|
36
|
+
var enterCommandServer = /* @__PURE__ */ __name(async (command, cli) => {
|
|
37
|
+
const request = commandServerRequest();
|
|
38
|
+
if (!request)
|
|
39
|
+
return;
|
|
40
|
+
refuseInCommandServer(command, cli);
|
|
41
|
+
if (runsAlone(command))
|
|
42
|
+
await request.alone();
|
|
43
|
+
}, "enterCommandServer");
|
|
44
|
+
var refuseInCommandServer = /* @__PURE__ */ __name((command, cli) => {
|
|
45
|
+
if (!commandServerRequest())
|
|
46
|
+
return;
|
|
47
|
+
const typed = [cli, ...commandPathOf(command)].join(" ");
|
|
48
|
+
const { lifetime } = metaOf(command);
|
|
49
|
+
if (lifetime)
|
|
50
|
+
throw new CliError("validation_error", `\`${typed}\` ${lifetime === "persistent" ? "runs until it is stopped" : "waits on a person"}; the command server runs only commands that return \u2014 start it as a process of its own`);
|
|
51
|
+
if (stdinFieldOf(command))
|
|
52
|
+
throw new CliError("validation_error", `\`${typed}\` reads its input on stdin, which the command server does not pass on \u2014 start it as a process of its own`);
|
|
53
|
+
}, "refuseInCommandServer");
|
|
54
|
+
var refusal = /* @__PURE__ */ __name((cli, message) => `${renderError(errorObjectOf(new CliError("validation_error", message)), { cli, interactive: false })}
|
|
55
|
+
`, "refusal");
|
|
56
|
+
var requestOf = /* @__PURE__ */ __name((line, cli) => {
|
|
57
|
+
let parsed;
|
|
58
|
+
try {
|
|
59
|
+
parsed = JSON.parse(line);
|
|
60
|
+
} catch {
|
|
61
|
+
return { id: null, error: "a request is one JSON object per line" };
|
|
62
|
+
}
|
|
63
|
+
const { id, argv } = parsed ?? {};
|
|
64
|
+
const known = typeof id === "number" && Number.isFinite(id) ? id : null;
|
|
65
|
+
if (known === null)
|
|
66
|
+
return { id: null, error: 'a request needs a numeric "id"' };
|
|
67
|
+
if (!Array.isArray(argv) || !argv.every((word) => typeof word === "string"))
|
|
68
|
+
return { id: known, error: '"argv" is a list of strings' };
|
|
69
|
+
if (isCommandServer(argv))
|
|
70
|
+
return { id: known, error: `\`${cli} commands --serve\` cannot run inside itself` };
|
|
71
|
+
return { id: known, argv };
|
|
72
|
+
}, "requestOf");
|
|
73
|
+
var serveCommands = /* @__PURE__ */ __name(async ({ input, write, run, cli, version, idleMs = COMMAND_SERVER_IDLE_MS, concurrent = COMMAND_SERVER_CONCURRENT, signal }) => {
|
|
74
|
+
const send = /* @__PURE__ */ __name((value) => write(`${JSON.stringify(value)}
|
|
75
|
+
`), "send");
|
|
76
|
+
await send({ ready: true, protocol: COMMAND_SERVER_PROTOCOL, version, concurrent });
|
|
77
|
+
const lines = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY });
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
const waiting = [];
|
|
80
|
+
let active = 0;
|
|
81
|
+
let running = 0;
|
|
82
|
+
let gated = false;
|
|
83
|
+
let drained;
|
|
84
|
+
let turns = Promise.resolve();
|
|
85
|
+
let timer;
|
|
86
|
+
let ending = false;
|
|
87
|
+
let done = false;
|
|
88
|
+
const finish = /* @__PURE__ */ __name(() => {
|
|
89
|
+
if (done)
|
|
90
|
+
return;
|
|
91
|
+
done = true;
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
lines.close();
|
|
94
|
+
resolve(0);
|
|
95
|
+
}, "finish");
|
|
96
|
+
const settle = /* @__PURE__ */ __name(() => {
|
|
97
|
+
if (running === 0 && drained) {
|
|
98
|
+
const go = drained;
|
|
99
|
+
drained = void 0;
|
|
100
|
+
go();
|
|
101
|
+
}
|
|
102
|
+
pump();
|
|
103
|
+
if (active > 0 || waiting.length > 0 || done)
|
|
104
|
+
return;
|
|
105
|
+
if (ending)
|
|
106
|
+
finish();
|
|
107
|
+
else {
|
|
108
|
+
clearTimeout(timer);
|
|
109
|
+
timer = setTimeout(finish, idleMs);
|
|
110
|
+
}
|
|
111
|
+
}, "settle");
|
|
112
|
+
const start = /* @__PURE__ */ __name((line) => {
|
|
113
|
+
active += 1;
|
|
114
|
+
running += 1;
|
|
115
|
+
let holdsPlace = true;
|
|
116
|
+
let ended = false;
|
|
117
|
+
let turn;
|
|
118
|
+
let release;
|
|
119
|
+
const alone = /* @__PURE__ */ __name(() => {
|
|
120
|
+
if (turn)
|
|
121
|
+
return turn;
|
|
122
|
+
holdsPlace = false;
|
|
123
|
+
running -= 1;
|
|
124
|
+
turn = turns.then(() => new Promise((go) => {
|
|
125
|
+
if (ended)
|
|
126
|
+
return go();
|
|
127
|
+
gated = true;
|
|
128
|
+
drained = /* @__PURE__ */ __name(() => {
|
|
129
|
+
if (ended)
|
|
130
|
+
gated = false;
|
|
131
|
+
else {
|
|
132
|
+
holdsPlace = true;
|
|
133
|
+
running += 1;
|
|
134
|
+
}
|
|
135
|
+
go();
|
|
136
|
+
}, "drained");
|
|
137
|
+
settle();
|
|
138
|
+
}));
|
|
139
|
+
turns = turn.then(() => ended && !holdsPlace ? void 0 : new Promise((free) => release = free));
|
|
140
|
+
return turn;
|
|
141
|
+
}, "alone");
|
|
142
|
+
const answer = /* @__PURE__ */ __name(async () => {
|
|
143
|
+
const request = requestOf(line, cli);
|
|
144
|
+
if ("error" in request)
|
|
145
|
+
return send({ id: request.id, code: 2, stdout: "", stderr: refusal(cli, request.error) });
|
|
146
|
+
const answered = await run(request.argv, alone);
|
|
147
|
+
return send({ id: request.id, ...answered });
|
|
148
|
+
}, "answer");
|
|
149
|
+
answer().catch(finish).finally(() => {
|
|
150
|
+
ended = true;
|
|
151
|
+
active -= 1;
|
|
152
|
+
if (holdsPlace)
|
|
153
|
+
running -= 1;
|
|
154
|
+
if (release) {
|
|
155
|
+
gated = false;
|
|
156
|
+
release();
|
|
157
|
+
}
|
|
158
|
+
settle();
|
|
159
|
+
});
|
|
160
|
+
}, "start");
|
|
161
|
+
const pump = /* @__PURE__ */ __name(() => {
|
|
162
|
+
while (!done && !gated && running < concurrent && waiting.length > 0)
|
|
163
|
+
start(waiting.shift());
|
|
164
|
+
}, "pump");
|
|
165
|
+
lines.on("line", (line) => {
|
|
166
|
+
if (done || ending || line.trim() === "")
|
|
167
|
+
return;
|
|
168
|
+
clearTimeout(timer);
|
|
169
|
+
waiting.push(line);
|
|
170
|
+
pump();
|
|
171
|
+
});
|
|
172
|
+
const end = /* @__PURE__ */ __name(() => {
|
|
173
|
+
ending = true;
|
|
174
|
+
settle();
|
|
175
|
+
}, "end");
|
|
176
|
+
lines.on("close", end);
|
|
177
|
+
if (signal?.aborted)
|
|
178
|
+
end();
|
|
179
|
+
signal?.addEventListener("abort", end, { once: true });
|
|
180
|
+
settle();
|
|
181
|
+
});
|
|
182
|
+
}, "serveCommands");
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
COMMAND_SERVER_CONCURRENT,
|
|
186
|
+
enterCommandServer,
|
|
187
|
+
serveCommands
|
|
188
|
+
};
|