pushary 1.9.77 → 1.9.78
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 +9 -0
- package/dist/{api-IGMCPM35.js → api-4WCUP47K.js} +10 -10
- package/dist/bin/pushary-bell-hook.js +25 -25
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +26 -26
- package/dist/bin/pushary-clean.js +34 -34
- package/dist/bin/pushary-codex-bridge.js +21 -21
- package/dist/bin/pushary-codex-hook.js +30 -30
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +13 -13
- package/dist/bin/pushary-connect.js +26 -26
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +38 -38
- package/dist/bin/pushary-disconnect.js +25 -25
- package/dist/bin/pushary-display-hook.js +16 -16
- package/dist/bin/pushary-doctor.js +42 -42
- package/dist/bin/pushary-elicitation-hook.js +25 -25
- package/dist/bin/pushary-gemini-bridge.js +15 -15
- package/dist/bin/pushary-gemini-hook.js +27 -27
- package/dist/bin/pushary-hook.js +29 -29
- package/dist/bin/pushary-login.js +20 -20
- package/dist/bin/pushary-logout.js +24 -24
- package/dist/bin/pushary-mcp.js +11 -11
- package/dist/bin/pushary-mode.js +15 -15
- package/dist/bin/pushary-notification-hook.js +24 -24
- package/dist/bin/pushary-opencode-hook.js +26 -26
- package/dist/bin/pushary-permission-denied-hook.js +29 -29
- package/dist/bin/pushary-permission-hook.js +29 -29
- package/dist/bin/pushary-post-hook.js +24 -24
- package/dist/bin/pushary-prompt-hook.js +24 -24
- package/dist/bin/pushary-session-end-hook.js +26 -26
- package/dist/bin/pushary-session-start-hook.js +34 -34
- package/dist/bin/pushary-setup.js +57 -54
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +31 -31
- package/dist/bin/pushary-stop-hook.js +24 -24
- package/dist/bin/pushary-stopfailure-hook.js +24 -24
- package/dist/bin/pushary-suggestions.js +15 -15
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +18 -18
- package/dist/bin/pushary-upgrade.js +40 -40
- package/dist/bin/pushary-wait.js +15 -15
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-BUBC4R5J.js → chunk-22FLBWJH.js} +2 -2
- package/dist/{chunk-TK3XMPG2.js → chunk-3XH4YLCN.js} +4 -4
- package/dist/{chunk-EFHCTIFT.js → chunk-42Y7IZSV.js} +1 -1
- package/dist/{chunk-PUF3BL6C.js → chunk-4DOJLAGR.js} +1 -1
- package/dist/{chunk-P4IFREOO.js → chunk-4FYY6YW3.js} +1 -1
- package/dist/{chunk-LD5LSJ2B.js → chunk-4ZSQPGAU.js} +2 -2
- package/dist/{chunk-GL34UITI.js → chunk-56POFDRB.js} +3 -3
- package/dist/{chunk-GV7FB5L3.js → chunk-5F3L3QOO.js} +4 -4
- package/dist/{chunk-UBQ3TG3B.js → chunk-5QOMMZFZ.js} +1 -1
- package/dist/{chunk-UU2CQFSJ.js → chunk-5WU6534E.js} +2 -2
- package/dist/{chunk-CS5PJXL7.js → chunk-5YHI2FN4.js} +6 -6
- package/dist/{chunk-XYNQA6YC.js → chunk-6HDYWRCP.js} +1 -1
- package/dist/{chunk-GI3PX2JU.js → chunk-74NZ3CJQ.js} +1 -1
- package/dist/{chunk-P7CGVHH5.js → chunk-74R4IZ7N.js} +5 -5
- package/dist/{chunk-OXA2P5NJ.js → chunk-7BMBXTN4.js} +14 -14
- package/dist/{chunk-JJPBWBAF.js → chunk-7KMI2G24.js} +6 -6
- package/dist/{chunk-LIEPMKTX.js → chunk-AOGM34LL.js} +1 -1
- package/dist/{chunk-2IOQHB3C.js → chunk-B4MQSH3R.js} +5 -5
- package/dist/{chunk-PGZFXNRJ.js → chunk-BE5BA3GF.js} +1 -1
- package/dist/{chunk-Y5YJLBML.js → chunk-BM3AT5AF.js} +4 -4
- package/dist/{chunk-PZWC3JXW.js → chunk-C5LCOXAC.js} +5 -5
- package/dist/{chunk-FXQCSU4L.js → chunk-CHBK47DU.js} +3 -3
- package/dist/{chunk-ZZFYV26G.js → chunk-DLOUKVLM.js} +2 -2
- package/dist/{chunk-SNHAXVCJ.js → chunk-DQCQQ2PY.js} +1 -1
- package/dist/{chunk-A3BF7SGM.js → chunk-EDHOHS3C.js} +3 -3
- package/dist/{chunk-MRTGCXG4.js → chunk-FMDP5KWV.js} +6 -6
- package/dist/{chunk-FBLVK2WR.js → chunk-IVBQ5ISS.js} +13 -13
- package/dist/{chunk-CIMFZIGP.js → chunk-IVY6LYTO.js} +1 -1
- package/dist/{chunk-PKHNZTHY.js → chunk-JLBLEFBK.js} +3 -3
- package/dist/{chunk-UUX6Q3CB.js → chunk-JM4WO3JT.js} +2 -2
- package/dist/{chunk-6XOEYBWJ.js → chunk-KJYZXX7X.js} +5 -3
- package/dist/{chunk-2YRNRYZW.js → chunk-L2S7KWMF.js} +1 -1
- package/dist/{chunk-S2UHLCF5.js → chunk-LXSGNGK5.js} +3 -3
- package/dist/{chunk-GOJO2OLP.js → chunk-MJXP5MFI.js} +4 -4
- package/dist/{chunk-EV47UGDK.js → chunk-MPZFQP6O.js} +1 -1
- package/dist/{chunk-CKUFXQUJ.js → chunk-NFK5ZCLK.js} +3 -3
- package/dist/{chunk-DYDA77FS.js → chunk-NH7C6QBI.js} +4 -4
- package/dist/{chunk-INBG473K.js → chunk-OFJUHEEG.js} +4 -3
- package/dist/{chunk-NHIEDRZR.js → chunk-OFQACQDL.js} +27 -7
- package/dist/{chunk-D5NLXF72.js → chunk-OOODSAHW.js} +3 -3
- package/dist/{chunk-ESHMWZXX.js → chunk-PYW7VWVZ.js} +5 -5
- package/dist/{chunk-IHT33GZN.js → chunk-Q53QJQLY.js} +1 -1
- package/dist/{chunk-2OWG667E.js → chunk-RCDZ2XZ6.js} +1 -1
- package/dist/{chunk-RYDT6Y32.js → chunk-RDU5HWKU.js} +4 -4
- package/dist/{chunk-SUOW4HJB.js → chunk-RIVCTSYV.js} +5 -5
- package/dist/{chunk-NNV2XS3Y.js → chunk-RJEG3TUZ.js} +6 -6
- package/dist/{chunk-J2NPFRDI.js → chunk-SV2C7PZV.js} +6 -6
- package/dist/{chunk-PAPUUZOP.js → chunk-T2MJ5H2V.js} +10 -10
- package/dist/{chunk-H4GOJIOK.js → chunk-TDLK3ZU2.js} +4 -4
- package/dist/{chunk-3UYMJZXV.js → chunk-TKQGDSO4.js} +2 -2
- package/dist/{chunk-QVP6F6BX.js → chunk-TNNB7P6Z.js} +7 -7
- package/dist/{chunk-PZXQUV3P.js → chunk-TQYSBYYZ.js} +2 -2
- package/dist/{chunk-QS2IKPQW.js → chunk-TRTAYW7Z.js} +4 -4
- package/dist/{chunk-QBCV27CM.js → chunk-VIIQLZJS.js} +3 -3
- package/dist/{chunk-HGVUTO67.js → chunk-VYELSTZK.js} +3 -3
- package/dist/{chunk-JLYVYHD2.js → chunk-VZHDSUXK.js} +1 -1
- package/dist/{chunk-7CU7OGWP.js → chunk-WHTWHHE3.js} +218 -159
- package/dist/{chunk-CU65AFT4.js → chunk-WJTUCQ47.js} +1 -1
- package/dist/{chunk-7AQEWD2J.js → chunk-XCBKGQ6N.js} +3 -3
- package/dist/{chunk-ABAWD6QM.js → chunk-Y4I5YX3L.js} +3 -3
- package/dist/{chunk-7HYNAA6B.js → chunk-YH3RAWMV.js} +1 -1
- package/dist/{chunk-OJ4EEE2B.js → chunk-YJK3LBAJ.js} +6 -6
- package/dist/{chunk-4ZXFOT44.js → chunk-YOPFR22Y.js} +2 -2
- package/dist/{chunk-K2MW33DG.js → chunk-YP35CA5L.js} +2 -2
- package/dist/{chunk-WFSE7NRM.js → chunk-Z5VZWDGL.js} +2 -2
- package/dist/{chunk-QGOY3HNV.js → chunk-Z6DZHUCO.js} +6 -6
- package/dist/{chunk-MQBQRXTN.js → chunk-ZFS2Y5GK.js} +5 -5
- package/dist/{chunk-KUI2KGRZ.js → chunk-ZM3ELQPE.js} +9 -9
- package/dist/{codex-app-cards-switch-LTZCEFYB.js → codex-app-cards-switch-GUZ7XMPB.js} +11 -11
- package/dist/{codex-desktop-launch-DBJBV66U.js → codex-desktop-launch-Q5UINXU6.js} +1 -1
- package/dist/{codex-session-launch-6RTU73OP.js → codex-session-launch-4G5AFXXU.js} +18 -18
- package/dist/{config-YREUMA6Z.js → config-725HOJFK.js} +3 -3
- package/dist/{global-upgrade-EYLSJXXN.js → global-upgrade-AXTMEH3I.js} +10 -10
- package/dist/{identity-WIM6NVLP.js → identity-HLIZDGEN.js} +4 -4
- package/dist/{live-capabilities-SU3BEP2Z.js → live-capabilities-A74OIHWN.js} +5 -5
- package/dist/{paths-XV3FXWOM.js → paths-ZHDLQD25.js} +3 -3
- package/dist/{reapply-Q7QC3MWL.js → reapply-RC2AMGCQ.js} +27 -27
- package/dist/src/index.js +28 -28
- package/dist/{upgrade-lock-A2ALHHUG.js → upgrade-lock-4B3D3OCT.js} +4 -4
- package/dist/{usage-UNEATRXG.js → usage-VVPEFYKS.js} +3 -3
- package/package.json +1 -1
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
hermesAppWiringRecord,
|
|
6
6
|
hermesConfigReceipt,
|
|
7
7
|
hermesSetupReceipt
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TQYSBYYZ.js";
|
|
9
9
|
import {
|
|
10
10
|
readJsonSafe,
|
|
11
11
|
resolvePathBinary,
|
|
12
12
|
writeJsonAtomic
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-Y4I5YX3L.js";
|
|
14
14
|
import {
|
|
15
15
|
isNewerVersion,
|
|
16
16
|
isReleaseVersion
|
|
17
17
|
} from "./chunk-QTOLNRET.js";
|
|
18
18
|
import {
|
|
19
19
|
isRecord
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OFJUHEEG.js";
|
|
21
21
|
|
|
22
22
|
// src/hermes/plugin-payload.ts
|
|
23
23
|
import { createHash } from "crypto";
|
|
@@ -1928,6 +1928,8 @@ var HERMES_INSTALL_MARKER_OWNER = "pushary";
|
|
|
1928
1928
|
var HERMES_LOAD_RECORDS_PATH = "plugin-data/pushary/loaded";
|
|
1929
1929
|
var HERMES_LEGACY_PIP_PACKAGE = "hermes-plugin-pushary";
|
|
1930
1930
|
var HERMES_QUESTION_TOOLSET = "clarify";
|
|
1931
|
+
var HERMES_PLUGINS_SECTION = "plugins";
|
|
1932
|
+
var HERMES_APPROVAL_SECTION = "security.approval";
|
|
1931
1933
|
var HERMES_APPROVAL_TRANSPORT_KEY = "security.approval.transport";
|
|
1932
1934
|
var HERMES_APPROVAL_FALLBACK_KEY = "security.approval.transport_fallback";
|
|
1933
1935
|
var HERMES_PLUGINS_ENABLED_KEY = "plugins.enabled";
|
|
@@ -1965,15 +1967,113 @@ var shippedHermesPlugin = (files = HERMES_PLUGIN_FILES) => {
|
|
|
1965
1967
|
};
|
|
1966
1968
|
|
|
1967
1969
|
// src/hermes/runtime.ts
|
|
1968
|
-
import {
|
|
1970
|
+
import { execFile } from "child_process";
|
|
1969
1971
|
import { accessSync, closeSync, constants, existsSync, mkdirSync, openSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
1970
1972
|
import { homedir } from "os";
|
|
1971
1973
|
import { basename, dirname, isAbsolute, join } from "path";
|
|
1974
|
+
import { promisify } from "util";
|
|
1975
|
+
|
|
1976
|
+
// src/hermes/setup-receipt.ts
|
|
1977
|
+
var HERMES_SETUP_RECEIPT_VERSION = 2;
|
|
1978
|
+
var settingSnapshot = (key, reading) => reading.kind === "set" ? { key, wasSet: true, before: reading.value } : { key, wasSet: false, before: null };
|
|
1979
|
+
var isSettingSnapshot = (value) => isRecord(value) && typeof value.key === "string" && typeof value.wasSet === "boolean" && Object.hasOwn(value, "before");
|
|
1980
|
+
var parseCurrentReceipt = (value) => {
|
|
1981
|
+
const { settings, pluginWasEnabled, questionRoutingAdded } = value;
|
|
1982
|
+
if (!Array.isArray(settings) || !settings.every(isSettingSnapshot)) return null;
|
|
1983
|
+
if (typeof pluginWasEnabled !== "boolean" || typeof questionRoutingAdded !== "boolean") return null;
|
|
1984
|
+
return { settings, pluginWasEnabled, questionRoutingAdded };
|
|
1985
|
+
};
|
|
1986
|
+
var LEGACY_SNAPSHOT_KEYS = ["security", "approval", "transport", "fallback", "plugins", "enabled", "agent", "disabled"];
|
|
1987
|
+
var isLegacySnapshot = (value) => isRecord(value) && typeof value.present === "boolean" && Object.hasOwn(value, "value");
|
|
1988
|
+
var legacySetting = (key, snapshot) => ({ key, wasSet: snapshot.present, before: snapshot.present ? snapshot.value : null });
|
|
1989
|
+
var parseLegacyReceipt = (value) => {
|
|
1990
|
+
if (!LEGACY_SNAPSHOT_KEYS.every((key) => isLegacySnapshot(value[key]))) return null;
|
|
1991
|
+
if (typeof value.pushary_enabled !== "boolean" || typeof value.clarify_disabled !== "boolean") return null;
|
|
1992
|
+
const transport = value.transport;
|
|
1993
|
+
const fallback = value.fallback;
|
|
1994
|
+
if (!isLegacySnapshot(transport) || !isLegacySnapshot(fallback)) return null;
|
|
1995
|
+
return {
|
|
1996
|
+
settings: [legacySetting(HERMES_APPROVAL_TRANSPORT_KEY, transport), legacySetting(HERMES_APPROVAL_FALLBACK_KEY, fallback)],
|
|
1997
|
+
pluginWasEnabled: value.pushary_enabled,
|
|
1998
|
+
questionRoutingAdded: !value.clarify_disabled
|
|
1999
|
+
};
|
|
2000
|
+
};
|
|
2001
|
+
var parseHermesSetupReceipt = (value) => {
|
|
2002
|
+
if (!isRecord(value)) return null;
|
|
2003
|
+
return value.version === HERMES_SETUP_RECEIPT_VERSION ? parseCurrentReceipt(value) : parseLegacyReceipt(value);
|
|
2004
|
+
};
|
|
2005
|
+
var serializeHermesSetupReceipt = (receipt) => ({ version: HERMES_SETUP_RECEIPT_VERSION, ...receipt });
|
|
2006
|
+
var receiptWithoutSnapshots = () => ({
|
|
2007
|
+
settings: [
|
|
2008
|
+
{ key: HERMES_APPROVAL_TRANSPORT_KEY, wasSet: false, before: null },
|
|
2009
|
+
{ key: HERMES_APPROVAL_FALLBACK_KEY, wasSet: false, before: null }
|
|
2010
|
+
],
|
|
2011
|
+
pluginWasEnabled: false,
|
|
2012
|
+
questionRoutingAdded: false
|
|
2013
|
+
});
|
|
2014
|
+
var receiptAfterQuestionRoutingReturned = (receipt) => ({ ...receipt, questionRoutingAdded: false });
|
|
2015
|
+
var PUSHARY_VALUES = {
|
|
2016
|
+
[HERMES_APPROVAL_TRANSPORT_KEY]: HERMES_PUSHARY_TRANSPORT,
|
|
2017
|
+
[HERMES_APPROVAL_FALLBACK_KEY]: HERMES_PUSHARY_FALLBACK
|
|
2018
|
+
};
|
|
2019
|
+
var hermesSettingRestore = (snapshot, current) => {
|
|
2020
|
+
const ours = PUSHARY_VALUES[snapshot.key];
|
|
2021
|
+
const stillOurs = current.kind === "set" && current.value === ours;
|
|
2022
|
+
const oursBeforeSetup = snapshot.wasSet && snapshot.before === ours;
|
|
2023
|
+
return stillOurs && !oursBeforeSetup ? { kind: "restore", key: snapshot.key, snapshot } : { kind: "leave", key: snapshot.key };
|
|
2024
|
+
};
|
|
2025
|
+
var sameSettingValue = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
2026
|
+
|
|
2027
|
+
// src/hermes/config-sections.ts
|
|
2028
|
+
var HERMES_CONFIG_SECTION_KEYS = [HERMES_PLUGINS_SECTION, HERMES_APPROVAL_SECTION, HERMES_DISABLED_TOOLSETS_KEY];
|
|
2029
|
+
var HERMES_SNAPSHOT_KEYS = [HERMES_APPROVAL_TRANSPORT_KEY, HERMES_APPROVAL_FALLBACK_KEY];
|
|
2030
|
+
var KEY_SEPARATOR = ".";
|
|
2031
|
+
var UNSET = { kind: "unset" };
|
|
2032
|
+
var childReading = (reading, name) => reading.kind === "set" && isRecord(reading.value) && Object.hasOwn(reading.value, name) ? { kind: "set", value: reading.value[name] } : UNSET;
|
|
2033
|
+
var sectionHolding = (key) => HERMES_CONFIG_SECTION_KEYS.find((section) => key === section || key.startsWith(`${section}${KEY_SEPARATOR}`)) ?? null;
|
|
2034
|
+
var readingFromSections = (sections, key) => {
|
|
2035
|
+
const section = sectionHolding(key);
|
|
2036
|
+
if (section === null) return null;
|
|
2037
|
+
const path = key === section ? [] : key.slice(section.length + KEY_SEPARATOR.length).split(KEY_SEPARATOR);
|
|
2038
|
+
return path.reduce(childReading, sections[section]);
|
|
2039
|
+
};
|
|
2040
|
+
var stringList = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
2041
|
+
var readingValue = (reading) => reading.kind === "set" ? reading.value : void 0;
|
|
2042
|
+
var stringOrNull = (value) => typeof value === "string" ? value : null;
|
|
2043
|
+
var hermesSettingsFrom = (sections) => {
|
|
2044
|
+
const plugins = readingValue(sections[HERMES_PLUGINS_SECTION]);
|
|
2045
|
+
const approval = readingValue(sections[HERMES_APPROVAL_SECTION]);
|
|
2046
|
+
const enabled = isRecord(plugins) ? stringList(plugins.enabled) : [];
|
|
2047
|
+
const disabled = isRecord(plugins) ? stringList(plugins.disabled) : [];
|
|
2048
|
+
return {
|
|
2049
|
+
pluginEnabled: enabled.includes(HERMES_PLUGIN_KEY),
|
|
2050
|
+
pluginDisabled: disabled.includes(HERMES_PLUGIN_KEY),
|
|
2051
|
+
approvalTransport: isRecord(approval) ? stringOrNull(approval.transport) : null,
|
|
2052
|
+
approvalFallback: isRecord(approval) ? stringOrNull(approval.transport_fallback) : null,
|
|
2053
|
+
disabledToolsets: stringList(readingValue(sections[HERMES_DISABLED_TOOLSETS_KEY]))
|
|
2054
|
+
};
|
|
2055
|
+
};
|
|
2056
|
+
var pluginNeedsEnabling = (settings) => !settings.pluginEnabled || settings.pluginDisabled;
|
|
2057
|
+
var snapshotFrom = (sections) => (key) => {
|
|
2058
|
+
const reading = readingFromSections(sections, key);
|
|
2059
|
+
return reading === null ? null : settingSnapshot(key, reading);
|
|
2060
|
+
};
|
|
2061
|
+
var isSnapshot = (snapshot) => snapshot !== null;
|
|
2062
|
+
var setupReceiptFrom = (sections) => {
|
|
2063
|
+
const snapshots = HERMES_SNAPSHOT_KEYS.map(snapshotFrom(sections));
|
|
2064
|
+
if (!snapshots.every(isSnapshot)) return null;
|
|
2065
|
+
return { settings: snapshots, pluginWasEnabled: hermesSettingsFrom(sections).pluginEnabled, questionRoutingAdded: false };
|
|
2066
|
+
};
|
|
2067
|
+
var holdsValue = (reading, value) => reading?.kind === "set" && reading.value === value;
|
|
2068
|
+
var pusharySettingsToWrite = (sections) => HERMES_PUSHARY_SETTINGS.filter((setting) => !holdsValue(sections === null ? null : readingFromSections(sections, setting.key), setting.value));
|
|
2069
|
+
|
|
2070
|
+
// src/hermes/runtime.ts
|
|
1972
2071
|
var HERMES_COMMAND_TIMEOUT_MS = 2e4;
|
|
2072
|
+
var HERMES_PLUGIN_COMMAND_TIMEOUT_MS = 18e4;
|
|
2073
|
+
var HERMES_OUTPUT_LIMIT_BYTES = 1024 * 1024;
|
|
1973
2074
|
var LEGACY_PIP_TIMEOUT_MS = 6e4;
|
|
2075
|
+
var PIP_UNINSTALLED = "Successfully uninstalled";
|
|
1974
2076
|
var HERMES_SETTING_NOT_SET = "Config key not set";
|
|
1975
|
-
var HERMES_PLUGINS_SECTION = "plugins";
|
|
1976
|
-
var HERMES_APPROVAL_SECTION = "security.approval";
|
|
1977
2077
|
var INSTALL_METADATA_FILE = ".install-metadata.json";
|
|
1978
2078
|
var GATEWAY_STATE_FILE = "gateway_state.json";
|
|
1979
2079
|
var GATEWAY_PID_FILE = "gateway.pid";
|
|
@@ -2001,22 +2101,26 @@ var commandOutput = (error) => {
|
|
|
2001
2101
|
if (!isRecord(error)) return String(error);
|
|
2002
2102
|
return [error.stdout, error.stderr].map((part) => part === void 0 || part === null ? "" : String(part)).join("\n");
|
|
2003
2103
|
};
|
|
2004
|
-
var
|
|
2104
|
+
var stoppedAtTimeout = (error) => isRecord(error) && error.killed === true;
|
|
2105
|
+
var runFileAsync = promisify(execFile);
|
|
2106
|
+
var runHermesCommand = async (launcher, args, timeoutMs = HERMES_COMMAND_TIMEOUT_MS) => {
|
|
2005
2107
|
const shell = needsShell(launcher.path);
|
|
2006
2108
|
try {
|
|
2007
|
-
const
|
|
2109
|
+
const running = runFileAsync(
|
|
2008
2110
|
shell ? quotedForWindowsShell(launcher.path) : launcher.path,
|
|
2009
2111
|
shell ? args.map(quotedForWindowsShell) : [...args],
|
|
2010
|
-
{ encoding: "utf-8",
|
|
2112
|
+
{ encoding: "utf-8", timeout: timeoutMs, maxBuffer: HERMES_OUTPUT_LIMIT_BYTES, shell, windowsHide: true }
|
|
2011
2113
|
);
|
|
2114
|
+
running.child.stdin?.end();
|
|
2115
|
+
const { stdout } = await running;
|
|
2012
2116
|
return { kind: "ok", stdout };
|
|
2013
2117
|
} catch (error) {
|
|
2014
|
-
return { kind: "failed", output: commandOutput(error) };
|
|
2118
|
+
return { kind: "failed", output: commandOutput(error), timedOut: stoppedAtTimeout(error) };
|
|
2015
2119
|
}
|
|
2016
2120
|
};
|
|
2017
2121
|
var lastLine = (output) => output.trim().split(/\r?\n/).filter((line) => line.trim().length > 0).at(-1)?.trim() ?? "";
|
|
2018
|
-
var readHermesHome = (launcher) => {
|
|
2019
|
-
const result = runHermesCommand(launcher, ["config", "path"]);
|
|
2122
|
+
var readHermesHome = async (launcher) => {
|
|
2123
|
+
const result = await runHermesCommand(launcher, ["config", "path"]);
|
|
2020
2124
|
if (result.kind !== "ok") return null;
|
|
2021
2125
|
const configPath = lastLine(result.stdout);
|
|
2022
2126
|
return isAbsolute(configPath) ? dirname(configPath) : null;
|
|
@@ -2028,42 +2132,35 @@ var parsedJson = (text) => {
|
|
|
2028
2132
|
return { ok: false };
|
|
2029
2133
|
}
|
|
2030
2134
|
};
|
|
2031
|
-
var readHermesSetting = (launcher, key) => {
|
|
2032
|
-
const result = runHermesCommand(launcher, ["config", "get", key, "--json"]);
|
|
2135
|
+
var readHermesSetting = async (launcher, key) => {
|
|
2136
|
+
const result = await runHermesCommand(launcher, ["config", "get", key, "--json"]);
|
|
2033
2137
|
if (result.kind === "failed") return result.output.includes(HERMES_SETTING_NOT_SET) ? { kind: "unset" } : null;
|
|
2034
2138
|
const parsed = parsedJson(lastLine(result.stdout));
|
|
2035
2139
|
return parsed.ok ? { kind: "set", value: parsed.value } : null;
|
|
2036
2140
|
};
|
|
2037
2141
|
var settingArgument = (value) => typeof value === "string" ? value : JSON.stringify(value);
|
|
2038
|
-
var writeHermesSetting = (launcher, key, value) => runHermesCommand(launcher, ["config", "set", key, settingArgument(value)]).kind === "ok";
|
|
2039
|
-
var unsetHermesSetting = (launcher, key) => {
|
|
2040
|
-
const result = runHermesCommand(launcher, ["config", "unset", key]);
|
|
2142
|
+
var writeHermesSetting = async (launcher, key, value) => (await runHermesCommand(launcher, ["config", "set", key, settingArgument(value)])).kind === "ok";
|
|
2143
|
+
var unsetHermesSetting = async (launcher, key) => {
|
|
2144
|
+
const result = await runHermesCommand(launcher, ["config", "unset", key]);
|
|
2041
2145
|
return result.kind === "ok" || result.output.includes(HERMES_SETTING_NOT_SET);
|
|
2042
2146
|
};
|
|
2043
|
-
var
|
|
2044
|
-
var
|
|
2045
|
-
var
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
var
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
return {
|
|
2059
|
-
pluginEnabled: enabled.includes(HERMES_PLUGIN_KEY),
|
|
2060
|
-
pluginDisabled: disabled.includes(HERMES_PLUGIN_KEY),
|
|
2061
|
-
approvalTransport: isRecord(approvalSection) ? stringOrNull(approvalSection.transport) : null,
|
|
2062
|
-
approvalFallback: isRecord(approvalSection) ? stringOrNull(approvalSection.transport_fallback) : null,
|
|
2063
|
-
disabledToolsets: stringList(readingValue(toolsets))
|
|
2064
|
-
};
|
|
2147
|
+
var runHermesPluginCommand = (launcher, verb) => runHermesCommand(launcher, ["plugins", verb, HERMES_PLUGIN_KEY], HERMES_PLUGIN_COMMAND_TIMEOUT_MS);
|
|
2148
|
+
var pluginCommandSucceeded = async (launcher, verb) => (await runHermesPluginCommand(launcher, verb)).kind === "ok";
|
|
2149
|
+
var pluginEnablingFrom = (result) => {
|
|
2150
|
+
if (result.kind === "ok") return "enabled";
|
|
2151
|
+
return result.timedOut ? "timed_out" : "refused";
|
|
2152
|
+
};
|
|
2153
|
+
var enableHermesPlugin = async (launcher) => pluginEnablingFrom(await runHermesPluginCommand(launcher, "enable"));
|
|
2154
|
+
var disableHermesPlugin = (launcher) => pluginCommandSucceeded(launcher, "disable");
|
|
2155
|
+
var removeHermesPlugin = (launcher) => pluginCommandSucceeded(launcher, "remove");
|
|
2156
|
+
var readHermesConfigSections = async (launcher) => {
|
|
2157
|
+
const [plugins, approval, disabledToolsets] = await Promise.all([
|
|
2158
|
+
readHermesSetting(launcher, HERMES_PLUGINS_SECTION),
|
|
2159
|
+
readHermesSetting(launcher, HERMES_APPROVAL_SECTION),
|
|
2160
|
+
readHermesSetting(launcher, HERMES_DISABLED_TOOLSETS_KEY)
|
|
2161
|
+
]);
|
|
2162
|
+
return plugins && approval && disabledToolsets ? { [HERMES_PLUGINS_SECTION]: plugins, [HERMES_APPROVAL_SECTION]: approval, [HERMES_DISABLED_TOOLSETS_KEY]: disabledToolsets } : null;
|
|
2065
2163
|
};
|
|
2066
|
-
var HERMES_SNAPSHOT_KEYS = [HERMES_APPROVAL_TRANSPORT_KEY, HERMES_APPROVAL_FALLBACK_KEY];
|
|
2067
2164
|
var hermesPluginDirectory = (home) => join(home, "plugins", HERMES_PLUGIN_KEY);
|
|
2068
2165
|
var HERMES_ROOT_DIRECTORY = ".hermes";
|
|
2069
2166
|
var HERMES_CONFIG_FILE = "config.yaml";
|
|
@@ -2203,10 +2300,16 @@ var legacyHermesPython = (launcher) => {
|
|
|
2203
2300
|
return null;
|
|
2204
2301
|
}
|
|
2205
2302
|
};
|
|
2206
|
-
var removeLegacyPipCopy = (python, distribution) => {
|
|
2303
|
+
var removeLegacyPipCopy = async (python, distribution) => {
|
|
2207
2304
|
try {
|
|
2208
|
-
|
|
2209
|
-
|
|
2305
|
+
const running = runFileAsync(
|
|
2306
|
+
python,
|
|
2307
|
+
["-m", "pip", "uninstall", "-y", distribution],
|
|
2308
|
+
{ encoding: "utf-8", timeout: LEGACY_PIP_TIMEOUT_MS, maxBuffer: HERMES_OUTPUT_LIMIT_BYTES, windowsHide: true }
|
|
2309
|
+
);
|
|
2310
|
+
running.child.stdin?.end();
|
|
2311
|
+
const { stdout } = await running;
|
|
2312
|
+
return stdout.includes(PIP_UNINSTALLED);
|
|
2210
2313
|
} catch {
|
|
2211
2314
|
return false;
|
|
2212
2315
|
}
|
|
@@ -2287,72 +2390,25 @@ var toolsetsWithoutPusharyQuestionRouting = (disabledToolsets, questionRoutingAd
|
|
|
2287
2390
|
|
|
2288
2391
|
// src/hermes/install.ts
|
|
2289
2392
|
import { existsSync as existsSync2, rmSync as rmSync2 } from "fs";
|
|
2290
|
-
|
|
2291
|
-
// src/hermes/setup-receipt.ts
|
|
2292
|
-
var HERMES_SETUP_RECEIPT_VERSION = 2;
|
|
2293
|
-
var settingSnapshot = (key, reading) => reading.kind === "set" ? { key, wasSet: true, before: reading.value } : { key, wasSet: false, before: null };
|
|
2294
|
-
var isSettingSnapshot = (value) => isRecord(value) && typeof value.key === "string" && typeof value.wasSet === "boolean" && Object.hasOwn(value, "before");
|
|
2295
|
-
var parseCurrentReceipt = (value) => {
|
|
2296
|
-
const { settings, pluginWasEnabled, questionRoutingAdded } = value;
|
|
2297
|
-
if (!Array.isArray(settings) || !settings.every(isSettingSnapshot)) return null;
|
|
2298
|
-
if (typeof pluginWasEnabled !== "boolean" || typeof questionRoutingAdded !== "boolean") return null;
|
|
2299
|
-
return { settings, pluginWasEnabled, questionRoutingAdded };
|
|
2300
|
-
};
|
|
2301
|
-
var LEGACY_SNAPSHOT_KEYS = ["security", "approval", "transport", "fallback", "plugins", "enabled", "agent", "disabled"];
|
|
2302
|
-
var isLegacySnapshot = (value) => isRecord(value) && typeof value.present === "boolean" && Object.hasOwn(value, "value");
|
|
2303
|
-
var legacySetting = (key, snapshot) => ({ key, wasSet: snapshot.present, before: snapshot.present ? snapshot.value : null });
|
|
2304
|
-
var parseLegacyReceipt = (value) => {
|
|
2305
|
-
if (!LEGACY_SNAPSHOT_KEYS.every((key) => isLegacySnapshot(value[key]))) return null;
|
|
2306
|
-
if (typeof value.pushary_enabled !== "boolean" || typeof value.clarify_disabled !== "boolean") return null;
|
|
2307
|
-
const transport = value.transport;
|
|
2308
|
-
const fallback = value.fallback;
|
|
2309
|
-
if (!isLegacySnapshot(transport) || !isLegacySnapshot(fallback)) return null;
|
|
2310
|
-
return {
|
|
2311
|
-
settings: [legacySetting(HERMES_APPROVAL_TRANSPORT_KEY, transport), legacySetting(HERMES_APPROVAL_FALLBACK_KEY, fallback)],
|
|
2312
|
-
pluginWasEnabled: value.pushary_enabled,
|
|
2313
|
-
questionRoutingAdded: !value.clarify_disabled
|
|
2314
|
-
};
|
|
2315
|
-
};
|
|
2316
|
-
var parseHermesSetupReceipt = (value) => {
|
|
2317
|
-
if (!isRecord(value)) return null;
|
|
2318
|
-
return value.version === HERMES_SETUP_RECEIPT_VERSION ? parseCurrentReceipt(value) : parseLegacyReceipt(value);
|
|
2319
|
-
};
|
|
2320
|
-
var serializeHermesSetupReceipt = (receipt) => ({ version: HERMES_SETUP_RECEIPT_VERSION, ...receipt });
|
|
2321
|
-
var receiptWithoutSnapshots = () => ({
|
|
2322
|
-
settings: [
|
|
2323
|
-
{ key: HERMES_APPROVAL_TRANSPORT_KEY, wasSet: false, before: null },
|
|
2324
|
-
{ key: HERMES_APPROVAL_FALLBACK_KEY, wasSet: false, before: null }
|
|
2325
|
-
],
|
|
2326
|
-
pluginWasEnabled: false,
|
|
2327
|
-
questionRoutingAdded: false
|
|
2328
|
-
});
|
|
2329
|
-
var receiptAfterQuestionRoutingReturned = (receipt) => ({ ...receipt, questionRoutingAdded: false });
|
|
2330
|
-
var PUSHARY_VALUES = {
|
|
2331
|
-
[HERMES_APPROVAL_TRANSPORT_KEY]: HERMES_PUSHARY_TRANSPORT,
|
|
2332
|
-
[HERMES_APPROVAL_FALLBACK_KEY]: HERMES_PUSHARY_FALLBACK
|
|
2333
|
-
};
|
|
2334
|
-
var hermesSettingRestore = (snapshot, current) => {
|
|
2335
|
-
const ours = PUSHARY_VALUES[snapshot.key];
|
|
2336
|
-
const stillOurs = current.kind === "set" && current.value === ours;
|
|
2337
|
-
const oursBeforeSetup = snapshot.wasSet && snapshot.before === ours;
|
|
2338
|
-
return stillOurs && !oursBeforeSetup ? { kind: "restore", key: snapshot.key, snapshot } : { kind: "leave", key: snapshot.key };
|
|
2339
|
-
};
|
|
2340
|
-
var sameSettingValue = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
2341
|
-
|
|
2342
|
-
// src/hermes/install.ts
|
|
2343
2393
|
var RECEIPT_MODE = 384;
|
|
2344
|
-
var
|
|
2345
|
-
const
|
|
2346
|
-
const settings = home ? readHermesSettings(launcher) : null;
|
|
2347
|
-
if (!home || !settings) return { kind: "unreadable", home };
|
|
2394
|
+
var inspectionFrom = (launcher, home, sections) => {
|
|
2395
|
+
const settings = hermesSettingsFrom(sections);
|
|
2348
2396
|
const folder = classifyHermesPluginFolder(readHermesPluginFolderFacts(home));
|
|
2349
2397
|
const gateway = readHermesGateway(home);
|
|
2350
2398
|
const gatewayLoad = gateway.kind === "running" ? readHermesLoadRecord(home, gateway.pid) : null;
|
|
2351
2399
|
const state = hermesWiringState({ folder, settings, gateway, gatewayLoad });
|
|
2352
2400
|
return { kind: "inspected", launcher, home, folder, settings, gateway, state };
|
|
2353
2401
|
};
|
|
2402
|
+
var inspectAt = async (launcher, home) => {
|
|
2403
|
+
const sections = await readHermesConfigSections(launcher);
|
|
2404
|
+
return sections ? inspectionFrom(launcher, home, sections) : { kind: "unreadable", home };
|
|
2405
|
+
};
|
|
2406
|
+
var inspectWithLauncher = async (launcher) => {
|
|
2407
|
+
const [home, sections] = await Promise.all([readHermesHome(launcher), readHermesConfigSections(launcher)]);
|
|
2408
|
+
return home && sections ? inspectionFrom(launcher, home, sections) : { kind: "unreadable", home };
|
|
2409
|
+
};
|
|
2354
2410
|
var findLauncherWhereHermesLives = () => existsSync2(defaultHermesHome()) ? findHermesLauncher() : null;
|
|
2355
|
-
var inspectHermesWiring = (launcher) => {
|
|
2411
|
+
var inspectHermesWiring = async (launcher) => {
|
|
2356
2412
|
const resolved = launcher === void 0 ? findLauncherWhereHermesLives() : launcher;
|
|
2357
2413
|
return resolved ? inspectWithLauncher(resolved) : { kind: "no_launcher" };
|
|
2358
2414
|
};
|
|
@@ -2382,67 +2438,62 @@ var removeSetupReceipts = (receipts) => {
|
|
|
2382
2438
|
rmSync2(receipts.receiptPath, { force: true });
|
|
2383
2439
|
rmSync2(receipts.legacyReceiptPath, { force: true });
|
|
2384
2440
|
};
|
|
2385
|
-
var
|
|
2386
|
-
const
|
|
2387
|
-
if (!settings) return null;
|
|
2388
|
-
const snapshots = [];
|
|
2389
|
-
for (const key of HERMES_SNAPSHOT_KEYS) {
|
|
2390
|
-
const reading = readHermesSetting(launcher, key);
|
|
2391
|
-
if (!reading) return null;
|
|
2392
|
-
snapshots.push(settingSnapshot(key, reading));
|
|
2393
|
-
}
|
|
2394
|
-
return {
|
|
2395
|
-
settings: snapshots,
|
|
2396
|
-
pluginWasEnabled: settings.pluginEnabled,
|
|
2397
|
-
questionRoutingAdded: false
|
|
2398
|
-
};
|
|
2399
|
-
};
|
|
2400
|
-
var ensureSetupReceipt = (launcher, receipts) => {
|
|
2401
|
-
const existing = readSetupReceipt(receipts);
|
|
2402
|
-
if (existing.kind === "invalid") return { kind: "failed", reason: "receipt_invalid" };
|
|
2403
|
-
const receipt = existing.kind === "ok" ? existing.receipt : snapshotSettings(launcher);
|
|
2441
|
+
var ensureSetupReceipt = (receipts, existing, sections) => {
|
|
2442
|
+
const receipt = existing.kind === "ok" ? existing.receipt : sections && setupReceiptFrom(sections);
|
|
2404
2443
|
if (!receipt) return { kind: "failed", reason: "settings_unreadable" };
|
|
2405
2444
|
if (!existsSync2(receipts.receiptPath)) writeSetupReceipt(receipts, receipt);
|
|
2406
2445
|
return { kind: "ok", receipt };
|
|
2407
2446
|
};
|
|
2408
|
-
var
|
|
2409
|
-
|
|
2410
|
-
|
|
2447
|
+
var ENABLING_FAILURES = {
|
|
2448
|
+
refused: "settings_failed",
|
|
2449
|
+
timed_out: "plugin_load_timed_out"
|
|
2411
2450
|
};
|
|
2412
|
-
var
|
|
2413
|
-
|
|
2414
|
-
|
|
2451
|
+
var writeSettingsInTurn = async (launcher, settings) => {
|
|
2452
|
+
for (const setting of settings) {
|
|
2453
|
+
if (!await writeHermesSetting(launcher, setting.key, setting.value)) return false;
|
|
2454
|
+
}
|
|
2455
|
+
return true;
|
|
2415
2456
|
};
|
|
2416
|
-
var
|
|
2457
|
+
var applyPusharySettings = async (launcher, sections) => {
|
|
2458
|
+
const enabling = await enableHermesPlugin(launcher);
|
|
2459
|
+
if (enabling !== "enabled") return { kind: "failed", reason: ENABLING_FAILURES[enabling] };
|
|
2460
|
+
const writes = pusharySettingsToWrite(sections);
|
|
2461
|
+
if (!await writeSettingsInTurn(launcher, writes)) return { kind: "failed", reason: "settings_failed" };
|
|
2462
|
+
const enableChangedConfig = sections === null || pluginNeedsEnabling(hermesSettingsFrom(sections));
|
|
2463
|
+
return { kind: "applied", changedHermes: enableChangedConfig || writes.length > 0 };
|
|
2464
|
+
};
|
|
2465
|
+
var writeListSetting = async (launcher, key, list) => {
|
|
2417
2466
|
if (list.length > 0) return writeHermesSetting(launcher, key, list);
|
|
2418
|
-
if (!unsetHermesSetting(launcher, key)) return false;
|
|
2419
|
-
const after = readHermesSetting(launcher, key);
|
|
2467
|
+
if (!await unsetHermesSetting(launcher, key)) return false;
|
|
2468
|
+
const after = await readHermesSetting(launcher, key);
|
|
2420
2469
|
return after?.kind !== "set" || sameSettingValue(after.value, []) || writeHermesSetting(launcher, key, []);
|
|
2421
2470
|
};
|
|
2422
|
-
var returnQuestionsToHermes = (launcher, receipt) => {
|
|
2423
|
-
const toolsets = readHermesSetting(launcher, HERMES_DISABLED_TOOLSETS_KEY);
|
|
2471
|
+
var returnQuestionsToHermes = async (launcher, receipt) => {
|
|
2472
|
+
const toolsets = await readHermesSetting(launcher, HERMES_DISABLED_TOOLSETS_KEY);
|
|
2424
2473
|
if (!toolsets) return false;
|
|
2425
2474
|
const current = toolsets.kind === "set" && Array.isArray(toolsets.value) ? toolsets.value.filter((item) => typeof item === "string") : [];
|
|
2426
2475
|
const next = toolsetsWithoutPusharyQuestionRouting(current, receipt.questionRoutingAdded);
|
|
2427
2476
|
return next === null || writeListSetting(launcher, HERMES_DISABLED_TOOLSETS_KEY, next);
|
|
2428
2477
|
};
|
|
2429
|
-
var removeLegacyCopy = (launcher) => {
|
|
2478
|
+
var removeLegacyCopy = async (launcher) => {
|
|
2430
2479
|
const python = legacyHermesPython(launcher);
|
|
2431
2480
|
return python !== null && removeLegacyPipCopy(python, HERMES_LEGACY_PIP_PACKAGE);
|
|
2432
2481
|
};
|
|
2433
|
-
var returnQuestionsIfThePluginRoutesThem = (launcher, home, receipts, receipt) => {
|
|
2482
|
+
var returnQuestionsIfThePluginRoutesThem = async (launcher, home, receipts, receipt) => {
|
|
2434
2483
|
const folder = classifyHermesPluginFolder(readHermesPluginFolderFacts(home));
|
|
2435
|
-
if (!receipt.questionRoutingAdded || !routesHermesQuestions(folder)) return
|
|
2436
|
-
if (!returnQuestionsToHermes(launcher, receipt)) return
|
|
2484
|
+
if (!receipt.questionRoutingAdded || !routesHermesQuestions(folder)) return "unchanged";
|
|
2485
|
+
if (!await returnQuestionsToHermes(launcher, receipt)) return "failed";
|
|
2437
2486
|
writeSetupReceipt(receipts, receiptAfterQuestionRoutingReturned(receipt));
|
|
2438
|
-
return
|
|
2487
|
+
return "returned";
|
|
2439
2488
|
};
|
|
2440
|
-
var installHermesPlugin = (request) => {
|
|
2489
|
+
var installHermesPlugin = async (request) => {
|
|
2441
2490
|
const launcher = request.launcher === void 0 ? findHermesLauncher() : request.launcher;
|
|
2442
2491
|
if (!launcher) return { kind: "no_launcher" };
|
|
2443
|
-
const
|
|
2492
|
+
const existingReceipt = readSetupReceipt(request.receipts);
|
|
2493
|
+
if (existingReceipt.kind === "invalid") return { kind: "failed", reason: "receipt_invalid" };
|
|
2494
|
+
const [home, sections] = await Promise.all([readHermesHome(launcher), readHermesConfigSections(launcher)]);
|
|
2444
2495
|
if (!home) return { kind: "failed", reason: "home_unknown" };
|
|
2445
|
-
const ensured = ensureSetupReceipt(
|
|
2496
|
+
const ensured = ensureSetupReceipt(request.receipts, existingReceipt, sections);
|
|
2446
2497
|
if (ensured.kind === "failed") return ensured;
|
|
2447
2498
|
const folder = classifyHermesPluginFolder(readHermesPluginFolderFacts(home));
|
|
2448
2499
|
if (folder.kind === "unknown") return { kind: "failed", reason: "plugin_folder_not_ours" };
|
|
@@ -2454,12 +2505,14 @@ var installHermesPlugin = (request) => {
|
|
|
2454
2505
|
return { kind: "failed", reason: "plugin_write_failed" };
|
|
2455
2506
|
}
|
|
2456
2507
|
}
|
|
2457
|
-
|
|
2458
|
-
if (
|
|
2459
|
-
|
|
2460
|
-
}
|
|
2461
|
-
const legacyCopyRemoved = removeLegacyCopy(launcher);
|
|
2462
|
-
|
|
2508
|
+
const applied = await applyPusharySettings(launcher, sections);
|
|
2509
|
+
if (applied.kind === "failed") return { kind: "failed", reason: applied.reason };
|
|
2510
|
+
const questions = await returnQuestionsIfThePluginRoutesThem(launcher, home, request.receipts, ensured.receipt);
|
|
2511
|
+
if (questions === "failed") return { kind: "failed", reason: "settings_failed" };
|
|
2512
|
+
const legacyCopyRemoved = await removeLegacyCopy(launcher);
|
|
2513
|
+
const configUnchanged = !applied.changedHermes && questions === "unchanged";
|
|
2514
|
+
const inspection = sections !== null && configUnchanged ? inspectionFrom(launcher, home, sections) : await inspectAt(launcher, home);
|
|
2515
|
+
return { kind: "installed", folderWritten, legacyCopyRemoved, inspection };
|
|
2463
2516
|
};
|
|
2464
2517
|
var refreshHermesPluginFiles = (installedBy, plugin, home = defaultHermesHome()) => {
|
|
2465
2518
|
const folder = classifyHermesPluginFolder(readHermesPluginFolderFacts(home));
|
|
@@ -2473,9 +2526,9 @@ var refreshHermesPluginFiles = (installedBy, plugin, home = defaultHermesHome())
|
|
|
2473
2526
|
}
|
|
2474
2527
|
};
|
|
2475
2528
|
var macAppOwnsHermes = (folder, request) => hermesWiringOwner(folder, existsSync2(request.macAppWiringRecord)) === "mac_app";
|
|
2476
|
-
var removePluginEntry = (launcher, settings) => {
|
|
2477
|
-
if (!settings.pluginEnabled || disableHermesPlugin(launcher)) return true;
|
|
2478
|
-
const enabled = readHermesSetting(launcher, HERMES_PLUGINS_ENABLED_KEY);
|
|
2529
|
+
var removePluginEntry = async (launcher, settings) => {
|
|
2530
|
+
if (!settings.pluginEnabled || await disableHermesPlugin(launcher)) return true;
|
|
2531
|
+
const enabled = await readHermesSetting(launcher, HERMES_PLUGINS_ENABLED_KEY);
|
|
2479
2532
|
const list = enabled?.kind === "set" && Array.isArray(enabled.value) ? enabled.value : [];
|
|
2480
2533
|
return writeListSetting(
|
|
2481
2534
|
launcher,
|
|
@@ -2483,32 +2536,38 @@ var removePluginEntry = (launcher, settings) => {
|
|
|
2483
2536
|
list.filter((item) => typeof item === "string" && item !== HERMES_PLUGIN_KEY)
|
|
2484
2537
|
);
|
|
2485
2538
|
};
|
|
2486
|
-
var removePushPlugin = (launcher, home, folder, settings, receipt) => {
|
|
2487
|
-
removeLegacyCopy(launcher);
|
|
2539
|
+
var removePushPlugin = async (launcher, home, folder, settings, receipt) => {
|
|
2540
|
+
await removeLegacyCopy(launcher);
|
|
2488
2541
|
if (folder.kind === "pushary") {
|
|
2489
|
-
if (removeHermesPlugin(launcher)) return true;
|
|
2542
|
+
if (await removeHermesPlugin(launcher)) return true;
|
|
2490
2543
|
rmSync2(hermesPluginDirectory(home), { recursive: true, force: true });
|
|
2491
2544
|
return removePluginEntry(launcher, settings);
|
|
2492
2545
|
}
|
|
2493
2546
|
return receipt.pluginWasEnabled || removePluginEntry(launcher, settings);
|
|
2494
2547
|
};
|
|
2495
|
-
var restoreSetting = (launcher, snapshot) => {
|
|
2496
|
-
const current = readHermesSetting(launcher, snapshot.key);
|
|
2548
|
+
var restoreSetting = async (launcher, snapshot) => {
|
|
2549
|
+
const current = await readHermesSetting(launcher, snapshot.key);
|
|
2497
2550
|
if (!current) return false;
|
|
2498
2551
|
if (hermesSettingRestore(snapshot, current).kind === "leave") return true;
|
|
2499
|
-
if (!unsetHermesSetting(launcher, snapshot.key)) return false;
|
|
2552
|
+
if (!await unsetHermesSetting(launcher, snapshot.key)) return false;
|
|
2500
2553
|
if (!snapshot.wasSet) return true;
|
|
2501
|
-
const after = readHermesSetting(launcher, snapshot.key);
|
|
2554
|
+
const after = await readHermesSetting(launcher, snapshot.key);
|
|
2502
2555
|
return after?.kind === "set" && sameSettingValue(after.value, snapshot.before) ? true : writeHermesSetting(launcher, snapshot.key, snapshot.before);
|
|
2503
2556
|
};
|
|
2504
2557
|
var macAppOwnsTheFolderOnDisk = (request) => macAppOwnsHermes(classifyHermesPluginFolder(readHermesPluginFolderFacts(request.home ?? defaultHermesHome())), request);
|
|
2505
|
-
var
|
|
2558
|
+
var restoreSettingsInTurn = async (launcher, snapshots) => {
|
|
2559
|
+
for (const snapshot of snapshots) {
|
|
2560
|
+
if (!await restoreSetting(launcher, snapshot)) return false;
|
|
2561
|
+
}
|
|
2562
|
+
return true;
|
|
2563
|
+
};
|
|
2564
|
+
var removeHermesWiring = async (request) => {
|
|
2506
2565
|
if (request.keepMacAppWiring && macAppOwnsTheFolderOnDisk(request)) return { kind: "kept_for_mac_app" };
|
|
2507
2566
|
const receiptRead = readSetupReceipt(request.receipts);
|
|
2508
2567
|
const launcher = request.launcher === void 0 ? receiptRead.kind === "missing" ? findLauncherWhereHermesLives() : findHermesLauncher() : request.launcher;
|
|
2509
2568
|
if (!launcher) return receiptRead.kind === "missing" ? { kind: "not_found" } : { kind: "runtime_missing" };
|
|
2510
2569
|
if (receiptRead.kind === "invalid") return { kind: "failed", step: "receipt_invalid" };
|
|
2511
|
-
const inspection = inspectWithLauncher(launcher);
|
|
2570
|
+
const inspection = await inspectWithLauncher(launcher);
|
|
2512
2571
|
if (inspection.kind !== "inspected") {
|
|
2513
2572
|
return receiptRead.kind === "missing" ? { kind: "not_found" } : { kind: "failed", step: "home_unknown" };
|
|
2514
2573
|
}
|
|
@@ -2517,8 +2576,8 @@ var removeHermesWiring = (request) => {
|
|
|
2517
2576
|
if (state.kind === "not_wired" && receiptRead.kind === "missing") return { kind: "not_found" };
|
|
2518
2577
|
const receipt = receiptRead.kind === "ok" ? receiptRead.receipt : receiptWithoutSnapshots();
|
|
2519
2578
|
if (request.dryRun) return { kind: "removed", pluginRemoved: folder.kind === "pushary", settingsRestored: true, dryRun: true };
|
|
2520
|
-
if (!removePushPlugin(launcher, home, folder, settings, receipt)) return { kind: "failed", step: "plugin" };
|
|
2521
|
-
const settingsRestored =
|
|
2579
|
+
if (!await removePushPlugin(launcher, home, folder, settings, receipt)) return { kind: "failed", step: "plugin" };
|
|
2580
|
+
const settingsRestored = await restoreSettingsInTurn(launcher, receipt.settings) && await returnQuestionsToHermes(launcher, receipt);
|
|
2522
2581
|
if (!settingsRestored) return { kind: "failed", step: "settings" };
|
|
2523
2582
|
removeSetupReceipts(request.receipts);
|
|
2524
2583
|
return { kind: "removed", pluginRemoved: folder.kind === "pushary", settingsRestored, dryRun: false };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readExistingMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4ZSQPGAU.js";
|
|
4
4
|
import {
|
|
5
5
|
getBaseUrl
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q53QJQLY.js";
|
|
7
7
|
import {
|
|
8
8
|
NetworkError
|
|
9
9
|
} from "./chunk-PPY5N2E6.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
clientContextHeaders,
|
|
15
15
|
redactSecretsFromContent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OFJUHEEG.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/net.ts
|
|
19
19
|
import { createRequire } from "module";
|
|
@@ -443,9 +443,9 @@ var installGlobally = (options) => {
|
|
|
443
443
|
}
|
|
444
444
|
const started = (async () => {
|
|
445
445
|
if (!npmIsOnPath()) throw new NpmMissingError();
|
|
446
|
-
const { withUpgradeLock } = await import("./global-upgrade-
|
|
447
|
-
const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-
|
|
448
|
-
const { autoUpdateLock } = await import("./paths-
|
|
446
|
+
const { withUpgradeLock } = await import("./global-upgrade-AXTMEH3I.js");
|
|
447
|
+
const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-4B3D3OCT.js");
|
|
448
|
+
const { autoUpdateLock } = await import("./paths-ZHDLQD25.js");
|
|
449
449
|
let result = "skipped";
|
|
450
450
|
const install = async () => {
|
|
451
451
|
const platform = process.platform;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
announceSubscriptionRequired,
|
|
3
3
|
isDeferAnswer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-74NZ3CJQ.js";
|
|
5
5
|
import {
|
|
6
6
|
AUTO_DECISION_WINDOW_MS,
|
|
7
7
|
DEFAULT_SESSION,
|
|
@@ -10,19 +10,19 @@ import {
|
|
|
10
10
|
permissionDeniedAction,
|
|
11
11
|
releaseThrottle,
|
|
12
12
|
reportEvent
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZM3ELQPE.js";
|
|
14
14
|
import {
|
|
15
15
|
askUser,
|
|
16
16
|
isDecisionStopped,
|
|
17
17
|
isQuestionLimitRefusal,
|
|
18
18
|
waitForQuestion
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PYW7VWVZ.js";
|
|
20
20
|
import {
|
|
21
21
|
SubscriptionRequiredError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5F3L3QOO.js";
|
|
23
23
|
import {
|
|
24
24
|
getMachineId
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-4ZSQPGAU.js";
|
|
26
26
|
import {
|
|
27
27
|
ASK_CONTEXT_MAX,
|
|
28
28
|
agentQuestionContext,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
questionsShownAsASet,
|
|
35
35
|
shouldDeferToNativeMode,
|
|
36
36
|
wireVerdictFor
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OFJUHEEG.js";
|
|
38
38
|
|
|
39
39
|
// src/machine-decision-audit.ts
|
|
40
40
|
import { basename } from "path";
|