@wirecat/slack-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 +121 -0
- package/LICENSE +204 -0
- package/README.md +131 -2
- package/contracts/wirecat.json +5526 -0
- package/dist/bin/slack.d.ts +3 -0
- package/dist/bin/slack.d.ts.map +1 -0
- package/dist/bin/slack.js +40 -0
- package/dist/bin/slack.js.map +1 -0
- package/dist/bundle/agent-GOFXFUQP.js +37 -0
- package/dist/bundle/all-profiles-4C7VOT2D.js +320 -0
- package/dist/bundle/anthropic-ZD66TC5S.js +91 -0
- package/dist/bundle/app-server-QNCVEDMY.js +249 -0
- package/dist/bundle/bun-2FULBYXS.js +169 -0
- package/dist/bundle/bun-sqlite-PMS26ZUT.js +76 -0
- package/dist/bundle/chunk-2LB5BWC4.js +362 -0
- package/dist/bundle/chunk-2ZEYRHZV.js +18 -0
- package/dist/bundle/chunk-3IJ3THPV.js +7 -0
- package/dist/bundle/chunk-3IZF5ENR.js +61 -0
- package/dist/bundle/chunk-4HSVEQ3R.js +29 -0
- package/dist/bundle/chunk-4QPMHVM5.js +1007 -0
- package/dist/bundle/chunk-53LIHHXC.js +16 -0
- package/dist/bundle/chunk-5F36CXDM.js +794 -0
- package/dist/bundle/chunk-5LPREGD3.js +12636 -0
- package/dist/bundle/chunk-5R5YRYIP.js +1148 -0
- package/dist/bundle/chunk-5RSQTG7L.js +388 -0
- package/dist/bundle/chunk-5SXZETJF.js +170 -0
- package/dist/bundle/chunk-6PDQP5RM.js +50 -0
- package/dist/bundle/chunk-75BLNPN3.js +1197 -0
- package/dist/bundle/chunk-7BEO72EN.js +131 -0
- package/dist/bundle/chunk-7F6RNAIM.js +230 -0
- package/dist/bundle/chunk-AG7FP64Z.js +77 -0
- package/dist/bundle/chunk-BRXTN5LJ.js +338 -0
- package/dist/bundle/chunk-CABZAU37.js +319 -0
- package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
- package/dist/bundle/chunk-CDTZSFTN.js +58 -0
- package/dist/bundle/chunk-CMZBCWND.js +1246 -0
- package/dist/bundle/chunk-CRQEEJNF.js +185 -0
- package/dist/bundle/chunk-CWYU4R65.js +358 -0
- package/dist/bundle/chunk-CZFR6JQX.js +52 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVHX7R54.js +4072 -0
- package/dist/bundle/chunk-DYKOG7QR.js +9596 -0
- package/dist/bundle/chunk-ECDI42G6.js +100 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ELY2TLCY.js +259 -0
- package/dist/bundle/chunk-ERRVUVKR.js +156 -0
- package/dist/bundle/chunk-FBWR4E5D.js +353 -0
- package/dist/bundle/chunk-GKS6KL57.js +6848 -0
- package/dist/bundle/chunk-H2COZZ55.js +2787 -0
- package/dist/bundle/chunk-HGXTEK7R.js +82 -0
- package/dist/bundle/chunk-HXLXM7HV.js +726 -0
- package/dist/bundle/chunk-IPP4N6HD.js +24 -0
- package/dist/bundle/chunk-IWTVR7S7.js +53 -0
- package/dist/bundle/chunk-IYJH75D4.js +63 -0
- package/dist/bundle/chunk-JCZLRT4Z.js +39 -0
- package/dist/bundle/chunk-JGRWMR5H.js +123 -0
- package/dist/bundle/chunk-JYRYQJBN.js +633 -0
- package/dist/bundle/chunk-KIKLDI74.js +161 -0
- package/dist/bundle/chunk-L4WO3XH6.js +2020 -0
- package/dist/bundle/chunk-LQDNUAK3.js +274 -0
- package/dist/bundle/chunk-LV5ONLQH.js +38 -0
- package/dist/bundle/chunk-M27Z23OZ.js +23 -0
- package/dist/bundle/chunk-M5XTZHXM.js +142 -0
- package/dist/bundle/chunk-MJBEGUIZ.js +76 -0
- package/dist/bundle/chunk-N4WOLGIV.js +2333 -0
- package/dist/bundle/chunk-N5K4OHPT.js +206 -0
- package/dist/bundle/chunk-NYAPUET7.js +108 -0
- package/dist/bundle/chunk-P4IFLOIK.js +218 -0
- package/dist/bundle/chunk-P6G2QTCD.js +288 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PU7R6XNV.js +80 -0
- package/dist/bundle/chunk-QLLBACDR.js +72 -0
- package/dist/bundle/chunk-QP7XN5KX.js +407 -0
- package/dist/bundle/chunk-QY2F6A3D.js +557 -0
- package/dist/bundle/chunk-RLIT7VAZ.js +66 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-SKGAKI62.js +86 -0
- package/dist/bundle/chunk-SQMZP5MA.js +66653 -0
- package/dist/bundle/chunk-UB6NTICY.js +95 -0
- package/dist/bundle/chunk-UBHQO5HV.js +778 -0
- package/dist/bundle/chunk-UM4RKO24.js +106 -0
- package/dist/bundle/chunk-VAHFY732.js +1068 -0
- package/dist/bundle/chunk-VGDM4C3F.js +188 -0
- package/dist/bundle/chunk-VOUAKCPM.js +41181 -0
- package/dist/bundle/chunk-WCCFJ4Q6.js +3736 -0
- package/dist/bundle/chunk-WV6EXRDV.js +46 -0
- package/dist/bundle/chunk-WVAT5TGY.js +334 -0
- package/dist/bundle/chunk-WW76JMKE.js +1243 -0
- package/dist/bundle/chunk-XXOMUKC6.js +54 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YDO6RJ2P.js +1337 -0
- package/dist/bundle/chunk-ZBCFZCJW.js +388 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-BWGRUY6L.js +37 -0
- package/dist/bundle/command-server-entry-BATOWE3Y.js +166 -0
- package/dist/bundle/decode-MZQGYXJH.js +297 -0
- package/dist/bundle/definitions-3EONB23J.js +8600 -0
- package/dist/bundle/dispatch-NYC4ARWX.js +411 -0
- package/dist/bundle/dist-AMLBQVKM.js +7577 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/echarts-7OYGL2GW.js +42501 -0
- package/dist/bundle/embed-4I25DVKZ.js +38 -0
- package/dist/bundle/embedder-YXKQHAZO.js +111 -0
- package/dist/bundle/emoji-4LYX3GOS.js +4271 -0
- package/dist/bundle/failure-3YOVYZTX.js +25 -0
- package/dist/bundle/first-run-2VL2BOV7.js +29 -0
- package/dist/bundle/first-screen-C7FIWZL2.js +37 -0
- package/dist/bundle/instructions-UMNDHXG2.js +11 -0
- package/dist/bundle/mcp-V27RHILF.js +167 -0
- package/dist/bundle/meeting-combined-LS6XO4JH.js +24 -0
- package/dist/bundle/meeting-model-VIR465CY.js +25 -0
- package/dist/bundle/meeting-semantic-H5J3OOF2.js +22 -0
- package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
- package/dist/bundle/node-PYFPGL4E.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-LFWPGDVP.js +74 -0
- package/dist/bundle/oauth-42VCSIVL.js +20 -0
- package/dist/bundle/open-XJ5R5LHC.js +23 -0
- package/dist/bundle/openai-RZBLV4HG.js +238 -0
- package/dist/bundle/process-DD6H3K7L.js +91 -0
- package/dist/bundle/program-OIYIBNSA.js +35443 -0
- package/dist/bundle/prompt-NQRDM5LY.js +17 -0
- package/dist/bundle/recognize-EM7H2IZS.js +26 -0
- package/dist/bundle/remote-Z6NU6QQA.js +31 -0
- package/dist/bundle/rerank-PNPCSPNF.js +52 -0
- package/dist/bundle/schemas-JMKNP4U3.js +2765 -0
- package/dist/bundle/serve-SQVGX76J.js +199 -0
- package/dist/bundle/server-NPJH45FZ.js +212 -0
- package/dist/bundle/server-Z4ZMGRAH.js +79 -0
- package/dist/bundle/slack.js +184 -0
- package/dist/bundle/sqlite-runtime-F3AJGAPN.js +20 -0
- package/dist/bundle/state-JT7ZFSXN.js +36 -0
- package/dist/bundle/store-FXGMHRF3.js +181 -0
- package/dist/bundle/store-J5ZL2USR.js +295 -0
- package/dist/bundle/store-maintenance-command-TIHOIKLZ.js +66 -0
- package/dist/bundle/surface-NW6T5OR6.js +65 -0
- package/dist/commands/api.d.ts +7 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +49 -0
- package/dist/commands/api.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 +26 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +75 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +59 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +75 -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 +8596 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/emoji.d.ts +2 -0
- package/dist/generated/emoji.d.ts.map +1 -0
- package/dist/generated/emoji.js +4265 -0
- package/dist/generated/emoji.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 +6139 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +631 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +2426 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +3220 -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/identity.d.ts +29 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +32 -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/messenger.d.ts +12 -0
- package/dist/messenger.d.ts.map +1 -0
- package/dist/messenger.js +184 -0
- package/dist/messenger.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +116 -0
- package/dist/program.js.map +1 -0
- package/dist/reasons.d.ts +7 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +20 -0
- package/dist/reasons.js.map +1 -0
- package/dist/setup/flow.d.ts +2 -0
- package/dist/setup/flow.d.ts.map +1 -0
- package/dist/setup/flow.js +83 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/guide.d.ts +6 -0
- package/dist/setup/guide.d.ts.map +1 -0
- package/dist/setup/guide.js +13 -0
- package/dist/setup/guide.js.map +1 -0
- package/dist/setup/texts.d.ts +24 -0
- package/dist/setup/texts.d.ts.map +1 -0
- package/dist/setup/texts.js +24 -0
- package/dist/setup/texts.js.map +1 -0
- package/dist/slack/adapter.d.ts +36 -0
- package/dist/slack/adapter.d.ts.map +1 -0
- package/dist/slack/adapter.js +574 -0
- package/dist/slack/adapter.js.map +1 -0
- package/dist/slack/app-manifest.d.ts +25 -0
- package/dist/slack/app-manifest.d.ts.map +1 -0
- package/dist/slack/app-manifest.js +51 -0
- package/dist/slack/app-manifest.js.map +1 -0
- package/dist/slack/client.d.ts +45 -0
- package/dist/slack/client.d.ts.map +1 -0
- package/dist/slack/client.js +236 -0
- package/dist/slack/client.js.map +1 -0
- package/dist/slack/map.d.ts +437 -0
- package/dist/slack/map.d.ts.map +1 -0
- package/dist/slack/map.js +411 -0
- package/dist/slack/map.js.map +1 -0
- package/dist/slack/mrkdwn.d.ts +9 -0
- package/dist/slack/mrkdwn.d.ts.map +1 -0
- package/dist/slack/mrkdwn.js +56 -0
- package/dist/slack/mrkdwn.js.map +1 -0
- package/dist/slack/search.d.ts +24 -0
- package/dist/slack/search.d.ts.map +1 -0
- package/dist/slack/search.js +99 -0
- package/dist/slack/search.js.map +1 -0
- package/dist/slack/threads.d.ts +28 -0
- package/dist/slack/threads.d.ts.map +1 -0
- package/dist/slack/threads.js +56 -0
- package/dist/slack/threads.js.map +1 -0
- package/dist/slack/tokens.d.ts +17 -0
- package/dist/slack/tokens.d.ts.map +1 -0
- package/dist/slack/tokens.js +27 -0
- package/dist/slack/tokens.js.map +1 -0
- package/dist/slack/writes.d.ts +43 -0
- package/dist/slack/writes.d.ts.map +1 -0
- package/dist/slack/writes.js +277 -0
- package/dist/slack/writes.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 +89 -4
- package/skills/slack-cli/SKILL.md +117 -0
- package/skills/slack-cli/references/api/api-admin.md +541 -0
- package/skills/slack-cli/references/api/api-api.md +13 -0
- package/skills/slack-cli/references/api/api-apps.md +78 -0
- package/skills/slack-cli/references/api/api-auth.md +18 -0
- package/skills/slack-cli/references/api/api-bots.md +12 -0
- package/skills/slack-cli/references/api/api-calls.md +68 -0
- package/skills/slack-cli/references/api/api-chat.md +123 -0
- package/skills/slack-cli/references/api/api-conversations.md +230 -0
- package/skills/slack-cli/references/api/api-dialog.md +13 -0
- package/skills/slack-cli/references/api/api-dnd.md +31 -0
- package/skills/slack-cli/references/api/api-emoji.md +8 -0
- package/skills/slack-cli/references/api/api-files.md +120 -0
- package/skills/slack-cli/references/api/api-migration.md +14 -0
- package/skills/slack-cli/references/api/api-pins.md +37 -0
- package/skills/slack-cli/references/api/api-reactions.md +58 -0
- package/skills/slack-cli/references/api/api-reminders.md +51 -0
- package/skills/slack-cli/references/api/api-search.md +18 -0
- package/skills/slack-cli/references/api/api-stars.md +42 -0
- package/skills/slack-cli/references/api/api-team.md +55 -0
- package/skills/slack-cli/references/api/api-usergroups.md +80 -0
- package/skills/slack-cli/references/api/api-users.md +101 -0
- package/skills/slack-cli/references/api/api-views.md +46 -0
- package/skills/slack-cli/references/api/api-workflows.md +36 -0
- package/skills/slack-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-2ZEYRHZV.js";
|
|
6
|
+
import {
|
|
7
|
+
commandPathOf
|
|
8
|
+
} from "./chunk-7BEO72EN.js";
|
|
9
|
+
import {
|
|
10
|
+
commandServerRequest,
|
|
11
|
+
metaOf
|
|
12
|
+
} from "./chunk-5LPREGD3.js";
|
|
13
|
+
import {
|
|
14
|
+
errorObjectOf,
|
|
15
|
+
renderError
|
|
16
|
+
} from "./chunk-CMZBCWND.js";
|
|
17
|
+
import {
|
|
18
|
+
CliError
|
|
19
|
+
} from "./chunk-QLLBACDR.js";
|
|
20
|
+
import {
|
|
21
|
+
__name
|
|
22
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
23
|
+
|
|
24
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/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.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/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.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/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
|
+
};
|