pushary 1.9.287 → 1.9.289
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 +10 -0
- package/data/openclaw-plugin/README.md +10 -2
- package/data/openclaw-plugin/package.json +1 -1
- package/dist/{api-CT6IBO52.js → api-BUZPY4QR.js} +12 -12
- package/dist/bin/pushary-ask.js +14 -14
- package/dist/bin/pushary-audit.js +3 -3
- package/dist/bin/pushary-bell-hook.js +28 -28
- package/dist/bin/pushary-bell.js +11 -11
- package/dist/bin/pushary-calls.js +14 -14
- package/dist/bin/pushary-claude.js +25 -25
- package/dist/bin/pushary-clean.js +39 -39
- package/dist/bin/pushary-codex-bridge.js +22 -22
- package/dist/bin/pushary-codex-hook.js +38 -35
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +16 -16
- package/dist/bin/pushary-connect.js +35 -35
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +46 -46
- package/dist/bin/pushary-disconnect.js +30 -30
- package/dist/bin/pushary-display-hook.js +12 -4
- package/dist/bin/pushary-doctor.js +49 -49
- package/dist/bin/pushary-elicitation-hook.js +27 -27
- package/dist/bin/pushary-gemini-bridge.js +17 -17
- package/dist/bin/pushary-gemini-hook.js +58 -48
- package/dist/bin/pushary-hook.js +35 -35
- package/dist/bin/pushary-login.js +42 -42
- package/dist/bin/pushary-logout.js +31 -31
- package/dist/bin/pushary-mcp.js +12 -12
- package/dist/bin/pushary-mode.js +15 -15
- package/dist/bin/pushary-notification-hook.js +27 -27
- package/dist/bin/pushary-opencode-bridge.js +21 -21
- package/dist/bin/pushary-opencode-hook.js +36 -33
- package/dist/bin/pushary-permission-denied-hook.js +34 -34
- package/dist/bin/pushary-permission-hook.js +35 -35
- package/dist/bin/pushary-post-hook.js +28 -28
- package/dist/bin/pushary-prompt-hook.js +27 -27
- package/dist/bin/pushary-session-end-hook.js +27 -27
- package/dist/bin/pushary-session-start-hook.js +39 -39
- package/dist/bin/pushary-sessions.js +12 -12
- package/dist/bin/pushary-setup.js +59 -59
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +36 -36
- package/dist/bin/pushary-stop-hook.js +27 -27
- package/dist/bin/pushary-stopfailure-hook.js +27 -27
- package/dist/bin/pushary-suggestions.js +15 -15
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +25 -25
- package/dist/bin/pushary-upgrade.js +47 -47
- package/dist/bin/pushary-wait.js +24 -24
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-LUBSO2VM.js → chunk-2TTEEY2T.js} +3 -3
- package/dist/{chunk-JO7CKMEZ.js → chunk-32IXC5BW.js} +1 -1
- package/dist/{chunk-K7H7QOHB.js → chunk-3PQB4275.js} +4 -4
- package/dist/{chunk-Q5CSZPBJ.js → chunk-4LOEBKTN.js} +2 -2
- package/dist/{chunk-PK24TQTN.js → chunk-4WRE5OBU.js} +7 -7
- package/dist/{chunk-4JHW4D4N.js → chunk-5BQXSXPO.js} +5 -5
- package/dist/{chunk-63HYM3BN.js → chunk-5JIHDTRQ.js} +2 -2
- package/dist/{chunk-CFBJJS7L.js → chunk-5K5IDURC.js} +12 -12
- package/dist/{chunk-S4JZRP3T.js → chunk-5NHY3NF2.js} +1 -1
- package/dist/{chunk-FO2HOIYA.js → chunk-6GEMETKN.js} +4 -4
- package/dist/{chunk-IGABHU5O.js → chunk-6VS46VHK.js} +6 -6
- package/dist/{chunk-GRLZVTBE.js → chunk-7K4AAGFJ.js} +5 -5
- package/dist/{chunk-G3W7GSV6.js → chunk-7VWLOLS3.js} +2 -2
- package/dist/{chunk-SU6M73OQ.js → chunk-A6IQKZKH.js} +2 -2
- package/dist/{chunk-IGM6MUL3.js → chunk-AAFKFRSV.js} +1 -1
- package/dist/{chunk-NH5MKJDI.js → chunk-B5JNWVUC.js} +5 -5
- package/dist/{chunk-MG65IOEE.js → chunk-BI6UCLYP.js} +6 -6
- package/dist/{chunk-FH6HNJF2.js → chunk-BN6OKTFA.js} +5 -5
- package/dist/{chunk-4GMY6BP5.js → chunk-BQLJPD7O.js} +3 -3
- package/dist/{chunk-I3QPRZX3.js → chunk-BXTXBRWB.js} +4 -4
- package/dist/{chunk-LCOYQP5Q.js → chunk-C5PI2JYP.js} +2 -2
- package/dist/{chunk-FHTK7OCG.js → chunk-CDWBDQDK.js} +7 -7
- package/dist/{chunk-EXILQZWQ.js → chunk-CFZIO5F6.js} +3 -3
- package/dist/{chunk-M342TA6T.js → chunk-CS7PGMJS.js} +4 -4
- package/dist/{chunk-5GACFNWL.js → chunk-DBYBCSNP.js} +1 -1
- package/dist/{chunk-YCJN6LZ6.js → chunk-DYIEZRT7.js} +1 -1
- package/dist/{chunk-UIDLO74Z.js → chunk-EQPFDOS4.js} +1 -1
- package/dist/{chunk-XCHF5GNH.js → chunk-F7EXRZIN.js} +1 -1
- package/dist/{chunk-REENDIUN.js → chunk-FA6HRGIW.js} +1 -1
- package/dist/{chunk-SXDRZVS6.js → chunk-FDJ5QZCT.js} +6 -6
- package/dist/{chunk-WAIYYGY4.js → chunk-FE2LKX5K.js} +1 -1
- package/dist/{chunk-C2JFC6HZ.js → chunk-FNEG6ULH.js} +28 -5
- package/dist/{chunk-CRIIKSYA.js → chunk-FOS6WB26.js} +1 -1
- package/dist/{chunk-Y3ITUD3Q.js → chunk-FUXVJPZB.js} +3 -3
- package/dist/{chunk-RKPHCAJZ.js → chunk-FVDBRCTQ.js} +1 -1
- package/dist/{chunk-YLOW6PDN.js → chunk-GULSIIDL.js} +1 -1
- package/dist/{chunk-HSHZJ5Z5.js → chunk-GUQWMR7D.js} +3 -3
- package/dist/{chunk-RPLLLNH3.js → chunk-HBF32DIY.js} +21 -25
- package/dist/{chunk-5VLFANI5.js → chunk-HD4JOAHL.js} +2 -2
- package/dist/{chunk-YWAWRTRL.js → chunk-HECTDQ5F.js} +5 -5
- package/dist/{chunk-H2FNFOSC.js → chunk-HIUBFOET.js} +2 -2
- package/dist/{chunk-JLVTNLZX.js → chunk-HMYHLIXA.js} +8 -8
- package/dist/{chunk-SVJ2WDNJ.js → chunk-HOU37D6Z.js} +1 -1
- package/dist/{chunk-NFFVLIYJ.js → chunk-HPZZJKBS.js} +1 -1
- package/dist/{chunk-QCUAD2NL.js → chunk-HZDEWSUC.js} +2 -2
- package/dist/{chunk-NYUSDIQJ.js → chunk-IB5B47FH.js} +4 -4
- package/dist/{chunk-VCHZCTQB.js → chunk-INJL64PE.js} +1 -1
- package/dist/{chunk-SO4274QJ.js → chunk-J67MFNK4.js} +3 -3
- package/dist/{chunk-P7PXAD2O.js → chunk-JQRBEIL6.js} +3 -3
- package/dist/{chunk-2NDMTOIT.js → chunk-KAZDRIWI.js} +7 -7
- package/dist/{chunk-ZUD3ILJI.js → chunk-L2MGAFMF.js} +3 -3
- package/dist/{chunk-DG3B7GSK.js → chunk-LMGVUOHB.js} +1 -1
- package/dist/{chunk-CWLAYD2J.js → chunk-MNP2N4VS.js} +5 -5
- package/dist/{chunk-ELNLPO5R.js → chunk-MXDJMXLF.js} +1 -1
- package/dist/{chunk-J2EHHRY2.js → chunk-N7HUW3UM.js} +6 -6
- package/dist/{chunk-OSI26PGT.js → chunk-NVMHXGKS.js} +1 -1
- package/dist/{chunk-IAB2LINZ.js → chunk-OAKUURVX.js} +1 -1
- package/dist/{chunk-TX6YNKDS.js → chunk-OCYNCIFJ.js} +1 -1
- package/dist/{chunk-TJ5YE7SG.js → chunk-OZYX6IEK.js} +7 -7
- package/dist/{chunk-2KFYMPMJ.js → chunk-PGPRNNOL.js} +6 -6
- package/dist/{chunk-EK4DULO4.js → chunk-PX7ANZ3Q.js} +3 -3
- package/dist/{chunk-AT5BTTQS.js → chunk-QCCNXYQU.js} +2 -2
- package/dist/{chunk-IU4JSMWS.js → chunk-QXDNHUEK.js} +1 -1
- package/dist/{chunk-BFEH2J6N.js → chunk-R3KH7BGP.js} +10 -10
- package/dist/{chunk-OJ5O6VRE.js → chunk-RBNPKIBH.js} +12 -12
- package/dist/{chunk-PGVLDCAC.js → chunk-RBZZFAM4.js} +10 -10
- package/dist/{chunk-3D5RKTFN.js → chunk-RKFQGHQP.js} +2 -2
- package/dist/{chunk-QHI4OPBT.js → chunk-RRRVMTF2.js} +2 -2
- package/dist/{chunk-OGFITATL.js → chunk-S6VF67Q6.js} +5 -5
- package/dist/{chunk-UXZLFBSG.js → chunk-SFVZ5OWK.js} +1 -1
- package/dist/{chunk-Q3NFM2TB.js → chunk-SHGECMM4.js} +1 -1
- package/dist/{chunk-6W4MKKWS.js → chunk-SLH3QVKU.js} +4 -4
- package/dist/{chunk-JYXGWEIA.js → chunk-TMVVAYAU.js} +3 -3
- package/dist/{chunk-A3OU6RZ5.js → chunk-U57UHGTO.js} +1 -1
- package/dist/{chunk-3NIZLXDB.js → chunk-UP335GR4.js} +3 -3
- package/dist/{chunk-U4A5EEDI.js → chunk-UVCIC3LV.js} +6 -6
- package/dist/{chunk-KLIKQFV6.js → chunk-UYROAPQQ.js} +1 -1
- package/dist/{chunk-GJMN4CWA.js → chunk-UZ2CLFC5.js} +4 -4
- package/dist/{chunk-T4G54LCL.js → chunk-V2CIVXPF.js} +4 -4
- package/dist/{chunk-ARR5SMCD.js → chunk-VTQU4WWS.js} +5 -5
- package/dist/{chunk-W7P5GTFI.js → chunk-WZZ5VP3M.js} +10 -2
- package/dist/{chunk-RHHUEIN6.js → chunk-YODOOCSR.js} +5 -5
- package/dist/{chunk-MDBETUXJ.js → chunk-ZQEZMAP5.js} +2 -2
- package/dist/{codex-app-cards-switch-4LKL7RGN.js → codex-app-cards-switch-5SC5PHEP.js} +11 -11
- package/dist/{codex-card-routing-36DOF7SM.js → codex-card-routing-2EC2UV5T.js} +2 -2
- package/dist/{codex-desktop-launch-W3OAG7VT.js → codex-desktop-launch-VUFNDZNC.js} +3 -3
- package/dist/{codex-session-launch-BUJS2QIH.js → codex-session-launch-Y3OJNQDF.js} +21 -21
- package/dist/{config-VBRURSF7.js → config-NQ2ZXWNZ.js} +3 -3
- package/dist/{global-upgrade-I7EA6TPR.js → global-upgrade-5DFJWXLK.js} +9 -9
- package/dist/{identity-MIO6FDAF.js → identity-VL7BA3XD.js} +4 -4
- package/dist/{live-capabilities-MHABDVR6.js → live-capabilities-KVNCNF7D.js} +4 -4
- package/dist/{paths-SIINCXTF.js → paths-L4MGYJOS.js} +3 -3
- package/dist/{reapply-7HT5PW5T.js → reapply-GUX7GGIG.js} +34 -34
- package/dist/src/index.js +33 -33
- package/dist/{upgrade-lock-PIJW5W2P.js → upgrade-lock-7A35YFRD.js} +4 -4
- package/dist/{usage-A6QKFMIV.js → usage-KDNOCRRN.js} +3 -3
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
uninstallOpenClawPlugin,
|
|
17
17
|
unsetOpenClawEntry,
|
|
18
18
|
writeOpenClawEntry
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CFZIO5F6.js";
|
|
20
20
|
import {
|
|
21
21
|
needsShell
|
|
22
22
|
} from "./chunk-3PSNUHC5.js";
|
|
@@ -28,14 +28,14 @@ import {
|
|
|
28
28
|
openClawDirectoriesToLookIn,
|
|
29
29
|
openClawPluginFolder,
|
|
30
30
|
openClawSetupReceiptDirectory
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-A6IQKZKH.js";
|
|
32
32
|
import {
|
|
33
33
|
atLeast,
|
|
34
34
|
parseVersion
|
|
35
35
|
} from "./chunk-6ICPEJY5.js";
|
|
36
36
|
import {
|
|
37
37
|
resolvePathBinary
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-IB5B47FH.js";
|
|
39
39
|
import {
|
|
40
40
|
readJsonSafe,
|
|
41
41
|
writeJsonAtomic
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-CXQWDQCJ.js";
|
|
47
47
|
import {
|
|
48
48
|
isRecord
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
50
50
|
|
|
51
51
|
// src/hermes/plugin-payload.ts
|
|
52
52
|
import { createHash } from "crypto";
|
|
@@ -1050,7 +1050,7 @@ def get_end_user_decision(decision_id, wait_seconds=45):
|
|
|
1050
1050
|
{ path: "approval_ledger.py", contents: 'from __future__ import annotations\n\nimport json\nimport os\nimport re\nimport secrets\nfrom dataclasses import dataclass\nfrom pathlib import Path\nfrom typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Literal, Mapping, Optional, Set, Tuple, Union\n\nif TYPE_CHECKING:\n from typing_extensions import TypeGuard\n\nApprovalChoice = Literal["once", "session", "always", "deny"]\nRecordState = Literal["waiting", "settled"]\nClaimState = Literal["claiming", "won", "lost"]\nHandedBack = Literal["handed_to_hermes"]\nEnded = Literal["ended"]\nSettledOutcome = Union[ApprovalChoice, HandedBack]\nRecentOutcome = Union[SettledOutcome, Ended]\nDecider = Literal["hermes_desktop", "pushary_transport"]\nRefusedClaim = Literal["not_found", "not_waiting", "not_answerable_here", "not_offered", "already_claimed"]\nClaimResult = Union[Literal["claimed"], RefusedClaim]\nProcessIsRunning = Callable[[int], bool]\n\nAPPROVAL_CHOICES: Tuple[ApprovalChoice, ...] = ("once", "session", "always", "deny")\nWAITING: RecordState = "waiting"\nSETTLED: RecordState = "settled"\nCLAIMING: ClaimState = "claiming"\nWON: ClaimState = "won"\nLOST: ClaimState = "lost"\nCLAIM_STATES: Tuple[ClaimState, ...] = (CLAIMING, WON, LOST)\nHANDED_TO_HERMES: HandedBack = "handed_to_hermes"\nENDED: Ended = "ended"\nSETTLED_OUTCOMES: Tuple[SettledOutcome, ...] = (*APPROVAL_CHOICES, HANDED_TO_HERMES)\nRECENT_OUTCOMES: Tuple[RecentOutcome, ...] = (*SETTLED_OUTCOMES, ENDED)\nDECIDED_BY_DESKTOP: Decider = "hermes_desktop"\nDECIDED_BY_TRANSPORT: Decider = "pushary_transport"\n\nCLAIMED: Literal["claimed"] = "claimed"\nNOT_FOUND: RefusedClaim = "not_found"\nNOT_WAITING: RefusedClaim = "not_waiting"\nNOT_ANSWERABLE_HERE: RefusedClaim = "not_answerable_here"\nNOT_OFFERED: RefusedClaim = "not_offered"\nALREADY_CLAIMED: RefusedClaim = "already_claimed"\nREFUSED_CLAIMS: Tuple[RefusedClaim, ...] = (NOT_FOUND, NOT_WAITING, NOT_ANSWERABLE_HERE, NOT_OFFERED, ALREADY_CLAIMED)\n\nDESKTOP_ANSWER_SOURCE = "hermes_desktop"\nUNNAMED_ANSWER_SOURCE = "pushary"\n\nLEDGER_PATH = ("plugin-data", "pushary", "approvals")\nRECORD_SUFFIX = ".json"\nHOST_OUTCOME_PREFIX = "host-"\nTEMPORARY_PREFIX = "."\n\nCORRELATION_ID_PATTERN = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")\nREQUEST_ID_PATTERN = re.compile(r"^[A-Za-z0-9_-]{1,64}$")\nTOKEN_PATTERN = re.compile(r"^[a-z][a-z0-9_]{0,63}$")\n\nRETENTION_SECONDS = 24 * 60 * 60\nRECENT_LIMIT = 6\nSUBJECT_MAX = 200\nLABEL_MAX = 80\n\n\n@dataclass(frozen=True)\nclass OfferedChoice:\n choice: ApprovalChoice\n label: str\n\n\n@dataclass(frozen=True)\nclass OpenedApproval:\n correlation_id: str\n request_id: Optional[str]\n subject: str\n choices: Tuple[OfferedChoice, ...]\n pid: int\n opened_at_ms: int\n deadline_at_ms: int\n\n\n@dataclass(frozen=True)\nclass WaitingRecord:\n opened: OpenedApproval\n\n\n@dataclass(frozen=True)\nclass SettledRecord:\n opened: OpenedApproval\n outcome: SettledOutcome\n answer_source: Optional[str]\n settled_at_ms: int\n\n\nApprovalRecord = Union[WaitingRecord, SettledRecord]\n\n\n@dataclass(frozen=True)\nclass HostOutcome:\n request_id: str\n choice: str\n at_ms: int\n\n\n@dataclass(frozen=True)\nclass WaitingApproval:\n correlation_id: str\n subject: str\n choices: Tuple[OfferedChoice, ...]\n opened_at_ms: int\n deadline_at_ms: int\n answerable_here: bool\n routed_to: Optional[str]\n claim: Optional[ClaimState]\n\n\n@dataclass(frozen=True)\nclass RecentApproval:\n correlation_id: str\n subject: str\n opened_at_ms: int\n settled_at_ms: int\n outcome: RecentOutcome\n answer_source: Optional[str]\n host_outcome: Optional[str]\n\n\n@dataclass(frozen=True)\nclass ApprovalsView:\n waiting: Tuple[WaitingApproval, ...]\n recent: Tuple[RecentApproval, ...]\n\n\ndef is_correlation_id(value: object) -> TypeGuard[str]:\n return isinstance(value, str) and CORRELATION_ID_PATTERN.fullmatch(value) is not None\n\n\ndef is_request_id(value: object) -> TypeGuard[str]:\n return isinstance(value, str) and REQUEST_ID_PATTERN.fullmatch(value) is not None\n\n\ndef is_token(value: object) -> TypeGuard[str]:\n return isinstance(value, str) and TOKEN_PATTERN.fullmatch(value) is not None\n\n\ndef approval_choice(value: object) -> Optional[ApprovalChoice]:\n for choice in APPROVAL_CHOICES:\n if value == choice:\n return choice\n return None\n\n\ndef _record_state(value: object) -> Optional[RecordState]:\n for state in (WAITING, SETTLED):\n if value == state:\n return state\n return None\n\n\ndef _settled_outcome(value: object) -> Optional[SettledOutcome]:\n for outcome in SETTLED_OUTCOMES:\n if value == outcome:\n return outcome\n return None\n\n\ndef _instant(value: object) -> Optional[int]:\n return value if isinstance(value, int) and not isinstance(value, bool) and value >= 0 else None\n\n\ndef _bounded_text(value: object, limit: int) -> Optional[str]:\n return value if isinstance(value, str) and len(value) <= limit else None\n\n\ndef _fields(value: object) -> Optional[Mapping[object, object]]:\n return value if isinstance(value, dict) else None\n\n\ndef offered_choices(pairs: Iterable[Tuple[str, str]]) -> Tuple[OfferedChoice, ...]:\n offered = []\n for raw_choice, raw_label in pairs:\n choice = approval_choice(raw_choice)\n if choice is not None:\n offered.append(OfferedChoice(choice, str(raw_label)[:LABEL_MAX]))\n return tuple(offered)\n\n\ndef _parse_offered(value: object) -> Optional[OfferedChoice]:\n fields = _fields(value)\n if fields is None:\n return None\n choice = approval_choice(fields.get("choice"))\n label = _bounded_text(fields.get("label"), LABEL_MAX)\n return OfferedChoice(choice, label) if choice is not None and label is not None else None\n\n\ndef _parse_choices(value: object) -> Optional[Tuple[OfferedChoice, ...]]:\n if not isinstance(value, list):\n return None\n parsed: List[OfferedChoice] = []\n for item in value:\n offered = _parse_offered(item)\n if offered is None:\n return None\n parsed.append(offered)\n return tuple(parsed)\n\n\ndef _parse_opened(fields: Mapping[object, object]) -> Optional[OpenedApproval]:\n correlation_id = fields.get("correlationId")\n request_id = fields.get("requestId")\n subject = _bounded_text(fields.get("subject"), SUBJECT_MAX)\n choices = _parse_choices(fields.get("choices"))\n pid = fields.get("pid")\n opened_at_ms = _instant(fields.get("openedAtMs"))\n deadline_at_ms = _instant(fields.get("deadlineAtMs"))\n if not is_correlation_id(correlation_id):\n return None\n if request_id is not None and not is_request_id(request_id):\n return None\n if (\n subject is None\n or not choices\n or not isinstance(pid, int) or isinstance(pid, bool) or pid <= 0\n or opened_at_ms is None\n or deadline_at_ms is None\n ):\n return None\n return OpenedApproval(\n correlation_id=correlation_id,\n request_id=request_id,\n subject=subject,\n choices=choices,\n pid=pid,\n opened_at_ms=opened_at_ms,\n deadline_at_ms=deadline_at_ms,\n )\n\n\ndef parse_record(value: object) -> Optional[ApprovalRecord]:\n fields = _fields(value)\n if fields is None:\n return None\n opened = _parse_opened(fields)\n state = _record_state(fields.get("state"))\n if opened is None or state is None:\n return None\n if state == WAITING:\n return WaitingRecord(opened)\n outcome = _settled_outcome(fields.get("outcome"))\n settled_at_ms = _instant(fields.get("settledAtMs"))\n answer_source = fields.get("answerSource")\n if outcome is None or settled_at_ms is None:\n return None\n if answer_source is not None and not is_token(answer_source):\n return None\n return SettledRecord(opened, outcome, answer_source, settled_at_ms)\n\n\ndef parse_host_outcome(value: object) -> Optional[HostOutcome]:\n fields = _fields(value)\n if fields is None:\n return None\n request_id = fields.get("requestId")\n choice = fields.get("choice")\n at_ms = _instant(fields.get("atMs"))\n if not is_request_id(request_id) or not is_token(choice) or at_ms is None:\n return None\n return HostOutcome(request_id, choice, at_ms)\n\n\ndef _offered_json(choice: OfferedChoice) -> Dict[str, object]:\n return {"choice": choice.choice, "label": choice.label}\n\n\ndef _opened_json(opened: OpenedApproval) -> Dict[str, object]:\n return {\n "correlationId": opened.correlation_id,\n "requestId": opened.request_id,\n "subject": opened.subject,\n "choices": [_offered_json(choice) for choice in opened.choices],\n "pid": opened.pid,\n "openedAtMs": opened.opened_at_ms,\n "deadlineAtMs": opened.deadline_at_ms,\n }\n\n\ndef _record_json(record: ApprovalRecord) -> Dict[str, object]:\n stored = _opened_json(record.opened)\n if isinstance(record, WaitingRecord):\n stored["state"] = WAITING\n return stored\n stored.update(state=SETTLED, outcome=record.outcome, answerSource=record.answer_source,\n settledAtMs=record.settled_at_ms)\n return stored\n\n\ndef _host_outcome_json(outcome: HostOutcome) -> Dict[str, object]:\n return {"requestId": outcome.request_id, "choice": outcome.choice, "atMs": outcome.at_ms}\n\n\ndef ledger_directory(home: Path) -> Path:\n return Path(home).joinpath(*LEDGER_PATH)\n\n\ndef _record_path(home: Path, correlation_id: str) -> Path:\n return ledger_directory(home) / f"{correlation_id}{RECORD_SUFFIX}"\n\n\ndef _host_outcome_path(home: Path, request_id: str) -> Path:\n return ledger_directory(home) / f"{HOST_OUTCOME_PREFIX}{request_id}{RECORD_SUFFIX}"\n\n\ndef _ensure_parent(path: Path) -> None:\n path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)\n\n\ndef _staged_json(path: Path, value: Dict[str, object]) -> Path:\n _ensure_parent(path)\n staged = path.with_name(f"{TEMPORARY_PREFIX}{path.name}.{secrets.token_hex(8)}.tmp")\n try:\n with open(os.open(staged, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), "w", encoding="utf-8") as handle:\n json.dump(value, handle)\n except BaseException:\n staged.unlink(missing_ok=True)\n raise\n return staged\n\n\ndef _replace_json(path: Path, value: Dict[str, object]) -> None:\n staged = _staged_json(path, value)\n try:\n os.replace(staged, path)\n finally:\n staged.unlink(missing_ok=True)\n\n\ndef _read_json(path: Path) -> object:\n try:\n return json.loads(path.read_text(encoding="utf-8"))\n except (OSError, ValueError):\n return None\n\n\ndef read_record(home: Path, correlation_id: str) -> Optional[ApprovalRecord]:\n if not is_correlation_id(correlation_id):\n return None\n record = parse_record(_read_json(_record_path(home, correlation_id)))\n return record if record is not None and record.opened.correlation_id == correlation_id else None\n\n\ndef read_host_outcome(home: Path, request_id: Optional[str]) -> Optional[HostOutcome]:\n if not is_request_id(request_id):\n return None\n outcome = parse_host_outcome(_read_json(_host_outcome_path(home, request_id)))\n return outcome if outcome is not None and outcome.request_id == request_id else None\n\n\ndef open_approval(\n home: Path,\n *,\n correlation_id: str,\n request_id: Optional[str],\n subject: str,\n choices: Tuple[OfferedChoice, ...],\n pid: int,\n opened_at_ms: int,\n deadline_at_ms: int,\n) -> bool:\n if not is_correlation_id(correlation_id) or pid <= 0 or not choices:\n return False\n opened = OpenedApproval(\n correlation_id=correlation_id,\n request_id=request_id if is_request_id(request_id) else None,\n subject=subject[:SUBJECT_MAX],\n choices=choices,\n pid=pid,\n opened_at_ms=opened_at_ms,\n deadline_at_ms=deadline_at_ms,\n )\n _replace_json(_record_path(home, correlation_id), _record_json(WaitingRecord(opened)))\n return True\n\n\ndef settle_approval(\n home: Path,\n correlation_id: str,\n *,\n outcome: SettledOutcome,\n answer_source: Optional[str],\n settled_at_ms: int,\n) -> bool:\n record = read_record(home, correlation_id)\n if not isinstance(record, WaitingRecord):\n return False\n source = answer_source if is_token(answer_source) else None\n _replace_json(_record_path(home, correlation_id), _record_json(SettledRecord(record.opened, outcome, source,\n settled_at_ms)))\n return True\n\n\ndef record_host_outcome(home: Path, request_id: str, choice: str, at_ms: int) -> bool:\n if not is_request_id(request_id) or not is_token(choice):\n return False\n _replace_json(_host_outcome_path(home, request_id), _host_outcome_json(HostOutcome(request_id, choice, at_ms)))\n return True\n\n\ndef host_has_finished(home: Path, request_id: Optional[str]) -> bool:\n return read_host_outcome(home, request_id) is not None\n\n\ndef _owner_is_running(opened: OpenedApproval, process_is_running: ProcessIsRunning) -> bool:\n return opened.pid > 0 and process_is_running(opened.pid)\n\n\ndef _is_live(record: ApprovalRecord, host_outcome: Optional[HostOutcome], now_ms: int,\n process_is_running: ProcessIsRunning) -> bool:\n return (\n isinstance(record, WaitingRecord)\n and host_outcome is None\n and now_ms < record.opened.deadline_at_ms\n and _owner_is_running(record.opened, process_is_running)\n )\n\n\ndef _waiting_elsewhere(record: WaitingRecord) -> WaitingApproval:\n opened = record.opened\n return WaitingApproval(\n correlation_id=opened.correlation_id,\n subject=opened.subject,\n choices=opened.choices,\n opened_at_ms=opened.opened_at_ms,\n deadline_at_ms=opened.deadline_at_ms,\n answerable_here=False,\n routed_to=None,\n claim=None,\n )\n\n\ndef _recent(record: ApprovalRecord, host_outcome: Optional[HostOutcome]) -> RecentApproval:\n opened = record.opened\n if isinstance(record, SettledRecord):\n outcome: RecentOutcome = record.outcome\n settled_at_ms = record.settled_at_ms\n answer_source = record.answer_source\n else:\n outcome = ENDED\n settled_at_ms = host_outcome.at_ms if host_outcome else opened.deadline_at_ms\n answer_source = None\n return RecentApproval(\n correlation_id=opened.correlation_id,\n subject=opened.subject,\n opened_at_ms=opened.opened_at_ms,\n settled_at_ms=settled_at_ms,\n outcome=outcome,\n answer_source=answer_source,\n host_outcome=host_outcome.choice if host_outcome else None,\n )\n\n\ndef approvals_view(\n records: Iterable[ApprovalRecord],\n host_outcomes: Mapping[str, HostOutcome],\n now_ms: int,\n process_is_running: ProcessIsRunning,\n) -> ApprovalsView:\n waiting = []\n recent = []\n for record in records:\n request_id = record.opened.request_id\n host_outcome = host_outcomes.get(request_id) if request_id else None\n if isinstance(record, WaitingRecord) and _is_live(record, host_outcome, now_ms, process_is_running):\n waiting.append(_waiting_elsewhere(record))\n else:\n recent.append(_recent(record, host_outcome))\n waiting.sort(key=lambda item: item.opened_at_ms)\n recent.sort(key=lambda item: item.settled_at_ms, reverse=True)\n return ApprovalsView(waiting=tuple(waiting), recent=tuple(recent[:RECENT_LIMIT]))\n\n\ndef _ledger_files(home: Path) -> List[Path]:\n try:\n return [path for path in ledger_directory(home).iterdir() if path.is_file()]\n except OSError:\n return []\n\n\ndef _correlation_id_of(name: str) -> Optional[str]:\n candidate = name[: -len(RECORD_SUFFIX)] if name.endswith(RECORD_SUFFIX) else None\n return candidate if is_correlation_id(candidate) else None\n\n\ndef _ledger_entries(home: Path) -> List[Tuple[Path, object]]:\n return [(path, _read_json(path)) for path in _ledger_files(home) if not path.name.startswith(TEMPORARY_PREFIX)]\n\n\ndef read_approvals(home: Path, now_ms: int, process_is_running: ProcessIsRunning) -> ApprovalsView:\n records: List[ApprovalRecord] = []\n host_outcomes: Dict[str, HostOutcome] = {}\n for path, value in _ledger_entries(home):\n name = path.name\n if name.startswith(HOST_OUTCOME_PREFIX):\n host_outcome = parse_host_outcome(value)\n if host_outcome is not None:\n host_outcomes[host_outcome.request_id] = host_outcome\n else:\n record = parse_record(value)\n if record is not None and name == f"{record.opened.correlation_id}{RECORD_SUFFIX}":\n records.append(record)\n return approvals_view(records, host_outcomes, now_ms, process_is_running)\n\n\ndef _unexpired_waiting(home: Path, now_ms: int) -> Set[str]:\n kept: Set[str] = set()\n for path, value in _ledger_entries(home):\n if path.name.startswith(HOST_OUTCOME_PREFIX) or not path.name.endswith(RECORD_SUFFIX):\n continue\n record = parse_record(value)\n if isinstance(record, WaitingRecord) and record.opened.deadline_at_ms > now_ms:\n kept.add(record.opened.correlation_id)\n return kept\n\n\ndef prune(home: Path, now_seconds: float) -> None:\n kept = _unexpired_waiting(home, int(now_seconds * 1000))\n for path in _ledger_files(home):\n if _correlation_id_of(path.name) in kept:\n continue\n try:\n if now_seconds - path.stat().st_mtime > RETENTION_SECONDS:\n path.unlink(missing_ok=True)\n except OSError:\n continue\n' },
|
|
1051
1051
|
{ path: "approval.py", contents: 'import contextvars\nimport logging\nimport os\nimport sys\nimport threading\nimport time\nfrom typing import Dict, Literal, Optional, Tuple\n\nfrom . import api, approval_ledger, cancellation, desktop_answers, desktop_contract, identity, installation\nfrom .approval_coverage import HERMES_SHELL_TOOL\n\nlogger = logging.getLogger(__name__)\n\nDECISION_LINE_MAX = 500\nACTION_BODY_MAX = 4000\nACTION_BODY_TRUNCATION_MARKER = "\\n\u2026 [truncated]"\nUTF16_SINGLE_UNIT_MAX = 0xFFFF\n\nPOLL_CEILING_SECONDS = 50.0\nWITHDRAW_RESERVE_SECONDS = 10.0\nHOST_RETURN_MARGIN_SECONDS = 1.0\nLATE_ANSWER_POLL_MS = 1000\n\nREQUESTER_LIMIT = 64\n_requesters: Dict[str, contextvars.Context] = {}\n_requesters_lock = threading.Lock()\n\nTUI_GATEWAY_MODULE = "tui_gateway.server"\n\nRouteAnswerability = Literal["requester", "routed_elsewhere", "unknown"]\nANSWERABLE_BY_REQUESTER: RouteAnswerability = "requester"\nROUTED_ELSEWHERE: RouteAnswerability = "routed_elsewhere"\nANSWERABILITY_UNKNOWN: RouteAnswerability = "unknown"\n\nWithdrawal = Literal["withdrawn", "answered_late", "ended", "stopped"]\nWITHDRAWN: Withdrawal = "withdrawn"\nANSWERED_LATE: Withdrawal = "answered_late"\nENDED_UNANSWERED: Withdrawal = "ended"\nSTOPPED: Withdrawal = "stopped"\n\n\nCHOICE_LABELS = (\n ("once", "Allow once"),\n ("session", "Allow for this session"),\n ("always", "Always allow"),\n ("deny", "Deny"),\n)\n\n\nclass TransportUnavailable(Exception):\n pass\n\n\nQUESTION_COMMAND_MAX = 160\n\n\ndef _offered(allowed):\n return [pair for pair in CHOICE_LABELS if pair[0] in set(allowed or ())]\n\n\ndef _command_head(command):\n return " ".join(str(command or "").split()[:2])[:80]\n\n\ndef _utf16_units(character: str) -> int:\n return 2 if ord(character) > UTF16_SINGLE_UNIT_MAX else 1\n\n\ndef _utf16_length(text: str) -> int:\n return sum(_utf16_units(character) for character in text)\n\n\ndef _prefix_within_utf16_units(text: str, units: int) -> str:\n used = 0\n for index, character in enumerate(text):\n used += _utf16_units(character)\n if used > units:\n return text[:index]\n return text\n\n\ndef cut_action_body(text: str) -> str:\n if len(_prefix_within_utf16_units(text, ACTION_BODY_MAX)) == len(text):\n return text\n kept = _prefix_within_utf16_units(text, ACTION_BODY_MAX - _utf16_length(ACTION_BODY_TRUNCATION_MARKER))\n return kept + ACTION_BODY_TRUNCATION_MARKER\n\n\ndef _command_summary(command):\n collapsed = " ".join(str(command or "").split())\n if len(collapsed) <= QUESTION_COMMAND_MAX:\n return collapsed\n return collapsed[:QUESTION_COMMAND_MAX - 1] + "\u2026"\n\n\ndef _choice_from_answer(value, offered, uses_select):\n answer = str(value or "").strip()\n if uses_select:\n for choice, label in offered:\n if answer.lower() == label.lower():\n return choice\n return "deny"\n return "once" if api.is_affirmative(answer) else "deny"\n\n\ndef _subject(request):\n return _command_summary(str(request.command or ""))\n\n\ndef _open_question(request, offered, uses_select):\n command = str(request.command or "")\n return api.ask_user(\n question=f"Allow Hermes to run `{_subject(request)}`?",\n question_type="select" if uses_select else "confirm",\n options=[label for _, label in offered] if uses_select else None,\n context=str(request.description or "")[:500] or None,\n agent_name=identity.agent_name(),\n session_id=identity.session_id(),\n machine_id=identity.machine_id(),\n tool_name=HERMES_SHELL_TOOL,\n tool_target=_command_head(command),\n action=command[:DECISION_LINE_MAX] or None,\n action_body=cut_action_body(command) or None,\n blocker=(\n f"Hermes flagged this command as {request.pattern_key}"[:DECISION_LINE_MAX]\n if request.pattern_key\n else None\n ),\n wait=False,\n )\n\n\ndef _stopped(result):\n return result.get("handoffAction") == cancellation.STOP_HANDOFF or result.get("status") in (\n "cancelled", cancellation.UNAVAILABLE_STATUS, "stopped")\n\n\ndef _route_answerability(created) -> RouteAnswerability:\n requester_may_answer = created.get("requesterMayAnswer")\n if requester_may_answer is True:\n return ANSWERABLE_BY_REQUESTER\n if requester_may_answer is False:\n return ROUTED_ELSEWHERE\n return ANSWERABILITY_UNKNOWN\n\n\ndef _routed_to(created) -> Optional[str]:\n routed_to = created.get("routedTo")\n return routed_to if isinstance(routed_to, str) and routed_to.strip() else None\n\n\ndef _withdraw(correlation_id) -> Tuple[Withdrawal, dict]:\n try:\n result = cancellation.classify_cancellation(api.cancel_question(correlation_id))\n if result in (cancellation.WITHDRAWN_BY_THIS_CALL, cancellation.CANCELLED_UNPROVEN):\n return WITHDRAWN, {}\n if result == cancellation.NOT_PENDING:\n answer = api.wait_for_answer(correlation_id, LATE_ANSWER_POLL_MS)\n if answer.get("answered"):\n return ANSWERED_LATE, answer\n if answer.get("status") in ("expired", "missing"):\n return ENDED_UNANSWERED, answer\n except Exception:\n pass\n return STOPPED, {}\n\n\ndef _wall_clock_ms():\n return int(time.time() * 1000)\n\n\ndef announce_approvals_changed() -> None:\n if TUI_GATEWAY_MODULE not in sys.modules:\n return\n try:\n from hermes_cli.plugin_events import broadcast_plugin_event\n except Exception:\n return\n try:\n broadcast_plugin_event(desktop_contract.PLUGIN_ID, desktop_contract.APPROVALS_CHANGED_EVENT, {})\n except Exception:\n logger.debug("[pushary] could not tell Hermes Desktop about an approval", exc_info=True)\n\n\ndef _open_answer_slot(request, correlation_id: str, offered, answerability: RouteAnswerability,\n routed_to: Optional[str], opened_at_ms: int, deadline_at_ms: int) -> None:\n try:\n desktop_answers.shared_answers().open_slot(\n correlation_id,\n request_id=getattr(request, "request_id", None),\n subject=_subject(request),\n choices=approval_ledger.offered_choices(offered),\n opened_at_ms=opened_at_ms,\n deadline_at_ms=deadline_at_ms,\n answerable_here=answerability == ANSWERABLE_BY_REQUESTER,\n routed_to=routed_to,\n )\n except Exception:\n logger.debug("[pushary] could not offer an approval to Hermes Desktop", exc_info=True)\n\n\ndef _close_answer_slot(correlation_id: str) -> None:\n try:\n desktop_answers.shared_answers().close_slot(correlation_id)\n except Exception:\n logger.debug("[pushary] could not withdraw an approval from Hermes Desktop", exc_info=True)\n\n\ndef _record_opened(request, correlation_id: str, offered, answerability: RouteAnswerability,\n routed_to: Optional[str]) -> None:\n opened_at_ms = _wall_clock_ms()\n deadline_at_ms = opened_at_ms + int(float(request.timeout_seconds or 0) * 1000)\n _open_answer_slot(request, correlation_id, offered, answerability, routed_to, opened_at_ms, deadline_at_ms)\n try:\n home = installation.hermes_home()\n approval_ledger.prune(home, time.time())\n opened = approval_ledger.open_approval(\n home,\n correlation_id=correlation_id,\n request_id=getattr(request, "request_id", None),\n subject=_subject(request),\n choices=approval_ledger.offered_choices(offered),\n pid=os.getpid(),\n opened_at_ms=opened_at_ms,\n deadline_at_ms=deadline_at_ms,\n )\n except Exception:\n logger.debug("[pushary] could not record an open approval", exc_info=True)\n opened = False\n if opened:\n announce_approvals_changed()\n\n\ndef _record_settled(correlation_id: str, outcome, answer_source: Optional[str]) -> None:\n try:\n settled = approval_ledger.settle_approval(\n installation.hermes_home(),\n correlation_id,\n outcome=outcome,\n answer_source=answer_source,\n settled_at_ms=_wall_clock_ms(),\n )\n except Exception:\n logger.debug("[pushary] could not record a settled approval", exc_info=True)\n return\n if settled:\n announce_approvals_changed()\n\n\ndef record_host_outcome(request_id, choice) -> None:\n try:\n desktop_answers.shared_answers().end_for_request(request_id)\n except Exception:\n logger.debug("[pushary] could not end an approval in Hermes Desktop", exc_info=True)\n try:\n recorded = approval_ledger.record_host_outcome(installation.hermes_home(), request_id, choice, _wall_clock_ms())\n except Exception:\n logger.debug("[pushary] could not record Hermes\'s approval outcome", exc_info=True)\n return\n if recorded:\n announce_approvals_changed()\n\n\ndef _decided(request, correlation_id, choice, answer_source):\n _record_settled(correlation_id, choice, answer_source)\n return request.respond(choice)\n\n\ndef _answer_source(answer) -> str:\n source = answer.get("answerSource")\n return source if approval_ledger.is_token(source) else approval_ledger.UNNAMED_ANSWER_SOURCE\n\n\ndef _answered(request, correlation_id, answer, offered, uses_select):\n choice = _choice_from_answer(answer.get("value"), offered, uses_select)\n return _decided(request, correlation_id, choice, _answer_source(answer))\n\n\ndef _offered_choices(offered) -> Tuple[str, ...]:\n return tuple(choice for choice, _ in offered)\n\n\ndef _host_has_finished(request, correlation_id: str) -> bool:\n try:\n if desktop_answers.shared_answers().has_ended(correlation_id):\n return True\n return approval_ledger.host_has_finished(installation.hermes_home(), getattr(request, "request_id", None))\n except Exception:\n return False\n\n\ndef _desktop_decision(correlation_id: str, offered) -> Optional[str]:\n try:\n return desktop_answers.shared_answers().desktop_decision(correlation_id, _offered_choices(offered))\n except Exception:\n logger.debug("[pushary] could not read a Hermes Desktop answer", exc_info=True)\n return None\n\n\ndef _final_say(correlation_id: str, offered, host_deadline: float, claim_may_still_win: bool) -> Optional[str]:\n wait = min(desktop_answers.CLAIM_RESOLVE_SECONDS, host_deadline - time.monotonic()) if claim_may_still_win else 0.0\n try:\n return desktop_answers.shared_answers().take_final_say(correlation_id, _offered_choices(offered),\n claim_wait_seconds=wait)\n except Exception:\n logger.debug("[pushary] could not settle who answers this approval", exc_info=True)\n return None\n\n\ndef remember_requester(request_id: str, session_id: Optional[str]) -> None:\n requester = contextvars.copy_context()\n requester.run(identity.bind_session, session_id)\n with _requesters_lock:\n _requesters[request_id] = requester\n while len(_requesters) > REQUESTER_LIMIT:\n del _requesters[next(iter(_requesters))]\n\n\ndef forget_requester(request_id: str) -> None:\n with _requesters_lock:\n _requesters.pop(request_id, None)\n\n\ndef present(request):\n with _requesters_lock:\n requester = _requesters.pop(str(getattr(request, "request_id", "")), None)\n return requester.run(_present, request) if requester is not None else _present(request)\n\n\ndef _present(request):\n offered = _offered(request.allowed_choices)\n if not offered:\n return request.respond("deny")\n uses_select = [choice for choice, _ in offered] != ["once", "deny"]\n # Reserve time for withdrawal before the host discards a late decision.\n started_at = time.monotonic()\n timeout_seconds = float(request.timeout_seconds or 0)\n deadline = started_at + max(timeout_seconds - WITHDRAW_RESERVE_SECONDS, 0.0)\n host_deadline = started_at + max(timeout_seconds - HOST_RETURN_MARGIN_SECONDS, 0.0)\n created = _open_question(request, offered, uses_select)\n if created.get("answered"):\n return request.respond(_choice_from_answer(created.get("value"), offered, uses_select))\n if _stopped(created):\n return request.respond("deny")\n correlation_id = created.get("correlationId")\n if not correlation_id:\n raise TransportUnavailable("Pushary did not create an approval")\n answerability = _route_answerability(created)\n _record_opened(request, correlation_id, offered, answerability, _routed_to(created))\n try:\n return _await_decision(request, created, correlation_id, offered, uses_select, answerability,\n started_at, deadline, host_deadline)\n finally:\n _close_answer_slot(correlation_id)\n\n\ndef _await_decision(request, created, correlation_id: str, offered, uses_select: bool,\n answerability: RouteAnswerability, started_at: float, deadline: float, host_deadline: float):\n may_hand_back = answerability != ROUTED_ELSEWHERE\n nothing_was_delivered = bool(created.get("noDevices") or created.get("status") in ("terminal", "notified"))\n policy_deadline = None\n window_ms = created.get("policyTimeoutMs")\n if may_hand_back and created.get("deliveryMode") == "push_first" and isinstance(window_ms, (int, float)) and window_ms >= 0:\n policy_deadline = started_at + window_ms / 1000\n deadline = min(deadline, policy_deadline)\n handoff = may_hand_back and (nothing_was_delivered or bool(created.get("suppressed")))\n nobody_can_answer = not may_hand_back and nothing_was_delivered\n answer = created\n try:\n while not handoff and not nobody_can_answer and time.monotonic() < deadline:\n if _host_has_finished(request, correlation_id):\n answer = {"handoffAction": "stop"}\n break\n remaining = deadline - time.monotonic()\n answer = api.wait_for_answer(correlation_id, int(min(POLL_CEILING_SECONDS, max(1.0, remaining)) * 1000))\n if answer.get("answered"):\n return _answered(request, correlation_id, answer, offered, uses_select)\n if _stopped(answer) or answer.get("error") or answer.get("status") in ("expired", "missing"):\n break\n # Some hosts/proxies return pending immediately instead of long-polling.\n time.sleep(min(0.1, max(0, deadline - time.monotonic())))\n except Exception:\n answer = {"handoffAction": "stop"}\n\n desktop = _desktop_decision(correlation_id, offered)\n if desktop:\n return _decided(request, correlation_id, desktop, approval_ledger.DESKTOP_ANSWER_SOURCE)\n withdrawal, late = _withdraw(correlation_id)\n if withdrawal == ANSWERED_LATE:\n return _answered(request, correlation_id, late, offered, uses_select)\n desktop = _final_say(correlation_id, offered, host_deadline, claim_may_still_win=withdrawal == STOPPED)\n if desktop:\n return _decided(request, correlation_id, desktop, approval_ledger.DESKTOP_ANSWER_SOURCE)\n if _stopped(answer) or withdrawal == STOPPED:\n return _decided(request, correlation_id, "deny", None)\n if handoff or (policy_deadline is not None and time.monotonic() >= policy_deadline):\n # Only a fenced question may reach Hermes\'s configured builtin fallback.\n _record_settled(correlation_id, approval_ledger.HANDED_TO_HERMES, None)\n raise TransportUnavailable("Approval handed back to Hermes")\n return _decided(request, correlation_id, "deny", None)\n' },
|
|
1052
1052
|
{ path: "cancellation.py", contents: 'from __future__ import annotations\n\nfrom typing import Literal, Mapping, Tuple\n\nCancellation = Literal[\n "withdrawn_by_this_call",\n "cancelled_unproven",\n "already_cancelled",\n "not_pending",\n "unreachable",\n]\n\nWITHDRAWN_BY_THIS_CALL: Cancellation = "withdrawn_by_this_call"\nCANCELLED_UNPROVEN: Cancellation = "cancelled_unproven"\nALREADY_CANCELLED: Cancellation = "already_cancelled"\nNOT_PENDING: Cancellation = "not_pending"\nUNREACHABLE: Cancellation = "unreachable"\nCANCELLATIONS: Tuple[Cancellation, ...] = (\n WITHDRAWN_BY_THIS_CALL,\n CANCELLED_UNPROVEN,\n ALREADY_CANCELLED,\n NOT_PENDING,\n UNREACHABLE,\n)\n\nUNAVAILABLE_STATUS = "unavailable"\nSTOP_HANDOFF = "stop"\n\n\ndef classify_cancellation(response: object) -> Cancellation:\n if not isinstance(response, Mapping):\n return UNREACHABLE\n fields: Mapping[object, object] = response\n cancelled = fields.get("cancelled")\n by_this_call = fields.get("cancelledByThisCall")\n if (\n not isinstance(cancelled, bool)\n or fields.get("status") == UNAVAILABLE_STATUS\n or fields.get("handoffAction") == STOP_HANDOFF\n or (by_this_call is not None and not isinstance(by_this_call, bool))\n or (by_this_call is True and not cancelled)\n ):\n return UNREACHABLE\n if not cancelled:\n return NOT_PENDING\n if by_this_call is None:\n return CANCELLED_UNPROVEN\n return WITHDRAWN_BY_THIS_CALL if by_this_call else ALREADY_CANCELLED\n' },
|
|
1053
|
-
{ path: "dashboard/manifest.json", contents: '{\n "name": "pushary",\n "label": "Pushary",\n "description": "Approvals Pushary is carrying to your phone, answerable from Hermes Desktop",\n "version": "1.0.
|
|
1053
|
+
{ path: "dashboard/manifest.json", contents: '{\n "name": "pushary",\n "label": "Pushary",\n "description": "Approvals Pushary is carrying to your phone, answerable from Hermes Desktop",\n "version": "1.0.17",\n "tab": { "hidden": true },\n "entry": "web.js",\n "api": "plugin_api.py"\n}\n' },
|
|
1054
1054
|
{ path: "dashboard/plugin_api.py", contents: `import importlib
|
|
1055
1055
|
import sys
|
|
1056
1056
|
import time
|
|
@@ -2088,8 +2088,8 @@ def record_plugin_load(approval_transport_registered, home=None, pid=None, now=N
|
|
|
2088
2088
|
logger.debug("[pushary] could not record the plugin load: %s", exc)
|
|
2089
2089
|
return None
|
|
2090
2090
|
` },
|
|
2091
|
-
{ path: "plugin.yaml", contents: 'name: pushary\nversion: 1.0.
|
|
2092
|
-
{ path: "README.md", contents: "# Pushary for Hermes\n\nAsk a question in Hermes and answer it on your phone. Try it with your own device before routing command approvals there.\n\n## Connect your phone\n\n1. [Set up your Pushary Agent account](https://pushary.com/sign-up?from=ai-coding&utm_source=hermes-plugin&utm_medium=
|
|
2091
|
+
{ path: "plugin.yaml", contents: 'name: pushary\nversion: 1.0.17\ndescription: Push notifications and human-in-the-loop for Hermes Agent via Pushary\nauthor: RalphNex OU\nrequires_env:\n - name: PUSHARY_API_KEY\n description: Your Pushary API key\n url: https://pushary.com/sign-up?from=hermes&utm_source=hermes-plugin&utm_medium=plugin&utm_campaign=always-on-first-answer&utm_content=catalog-key\n secret: true\nconfig_schema:\n api_key:\n type: secret\n env: PUSHARY_API_KEY\n label: Pushary API key\n description: "Get one at pushary.com/sign-up?from=hermes"\n required: true\nprovides_tools:\n - pushary_remind\n - pushary_notify\n - pushary_ask\n - pushary_wait\n - pushary_cancel\n - pushary_propose_scope\n - pushary_enroll\n - pushary_ask_end_user\nprovides_hooks:\n - pre_llm_call\n - pre_tool_call\n - post_tool_call\n - on_session_start\n - on_session_end\n - on_session_finalize\n - pre_approval_request\n - post_approval_response\nprovides_approval_transports:\n - pushary\n' },
|
|
2092
|
+
{ path: "README.md", contents: "# Pushary for Hermes\n\nAsk a question in Hermes and answer it on your phone. Try it with your own device before routing command approvals there.\n\n## Connect your phone\n\n1. [Set up your Pushary Agent account](https://pushary.com/sign-up?from=ai-coding&utm_source=hermes-plugin&utm_medium=plugin&utm_campaign=always-on-first-answer&utm_content=catalog-setup). Pair your phone with that account and get its API key from Agent settings.\n2. In your terminal, install the catalog plugin:\n\n ```sh\n hermes plugins install pushary\n ```\n\n3. Enter `PUSHARY_API_KEY` when Hermes prompts for it. If you missed the prompt, save the key in the plugin\u2019s settings in Hermes Desktop. Keep it out of chat. Start a new Hermes session (for a running gateway, use `hermes gateway restart`).\n\n## Try one question\n\nTell Hermes: **Use `pushary_ask` to ask me \u201CDid this test reach your phone?\u201D Report my answer and do nothing else.** Open the question on your paired phone and tap **Yes** or **No**. Hermes should report the answer you tapped.\n\nIf nothing arrives, check the account and notification permissions on your phone. A pending question is still live: wait for the same question rather than sending another. If Pushary hands it back to Hermes, answer the local prompt instead. No answer is not approval.\n\n### Hear a missed question by phone\n\nWith a confirmed phone number, calls enabled, available call minutes and an open calling-hours window, paste this into a paired Hermes session:\n\n> Use `pushary_ask` to ask \u201CShould I keep this draft?\u201D as a yes/no question. Wait for my answer, then repeat it. Take no other action.\n\nLeave the push unanswered and keep the session running. When Pushary calls, say **no**. Hermes should report your answer in that same session. [Call settings and eligibility](https://pushary.com/docs/agents/phone-calls) determine when it rings.\n\n## Route command approvals\n\nCommand approvals are separate from this test. To route them to your phone, set `security.approval.transport` to `pushary`. Set `security.approval.transport_fallback` to `builtin` if you want Hermes\u2019s local prompt after a safe handoff; an unconfirmed withdrawal does not authorize the command. See the [plugin guide](https://github.com/Pushary/hermes-plugin-pushary#readme) for approval routing and what the plugin reads and sends.\n" },
|
|
2093
2093
|
{ path: "schemas.py", contents: `PUSHARY_REMIND = {
|
|
2094
2094
|
"name": "pushary_remind",
|
|
2095
2095
|
"description": "Schedule a one-time personal reminder on Pushary, even after Hermes exits. Use body plus in_minutes or at (ISO timestamp with explicit UTC offset, within 30 days). Never guess the user's timezone. Confirm the returned time. No arguments lists pending reminders; cancel_reminder_id cancels a scheduled one. Use Hermes cron for agent work; use this for reminding the operator.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
serviceNodeFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BI6UCLYP.js";
|
|
4
4
|
import {
|
|
5
5
|
OWNER_ONLY_FILE_MODE,
|
|
6
6
|
readOwnerOnlyJson
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
codexHome,
|
|
15
15
|
codexHooksJsonIn,
|
|
16
16
|
isPusharyCodexCommand
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-A6IQKZKH.js";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_WINDOWS_PATHEXT,
|
|
20
20
|
DIRECTLY_STARTABLE_EXTENSIONS,
|
|
21
21
|
plannedGlobalPackage,
|
|
22
22
|
readGlobalPrefix,
|
|
23
23
|
resolvePathBinary
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IB5B47FH.js";
|
|
25
25
|
import {
|
|
26
26
|
getPackageVersion,
|
|
27
27
|
globalTranscriptRegisterEntry
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
installedCodexApp,
|
|
10
10
|
readCodexAppRuntime,
|
|
11
11
|
shellQuoted
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CS7PGMJS.js";
|
|
13
13
|
import {
|
|
14
14
|
writeHuman
|
|
15
15
|
} from "./chunk-QCGNGEGE.js";
|
|
@@ -20,20 +20,20 @@ import {
|
|
|
20
20
|
} from "./chunk-U4P4NDVB.js";
|
|
21
21
|
import {
|
|
22
22
|
parseConfigDocument
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FVDBRCTQ.js";
|
|
24
24
|
import {
|
|
25
25
|
xml
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-BI6UCLYP.js";
|
|
27
27
|
import {
|
|
28
28
|
codexHomeFrom
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-A6IQKZKH.js";
|
|
30
30
|
import {
|
|
31
31
|
readRegularTextFile,
|
|
32
32
|
writeFileAtomic
|
|
33
33
|
} from "./chunk-PM2NRK6Y.js";
|
|
34
34
|
import {
|
|
35
35
|
isRecord
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
37
37
|
|
|
38
38
|
// src/codex-app-cards-switch.ts
|
|
39
39
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
forkFinishWithUpgradeLock,
|
|
4
4
|
installWithUpgradeLock,
|
|
5
5
|
releaseAutoUpdateLock
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C5PI2JYP.js";
|
|
7
7
|
import {
|
|
8
8
|
describeAutoUpdateCheck,
|
|
9
9
|
globalInstallLocation,
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
readAutoUpdateState,
|
|
16
16
|
updateAutoUpdateState,
|
|
17
17
|
upgradeEntryFor
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HIUBFOET.js";
|
|
19
19
|
import {
|
|
20
20
|
phoneStartIsRequired
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FUXVJPZB.js";
|
|
22
22
|
import {
|
|
23
23
|
autoUpdateLock,
|
|
24
24
|
autoUpdateLog,
|
|
25
25
|
autoUpdateState
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-A6IQKZKH.js";
|
|
27
27
|
import {
|
|
28
28
|
describeReleaseNpmHolds,
|
|
29
29
|
execNpm,
|
|
@@ -33,10 +33,10 @@ import {
|
|
|
33
33
|
npmExitedOnReleaseAge,
|
|
34
34
|
readGlobalCliInstallAt,
|
|
35
35
|
readGlobalPrefix
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-IB5B47FH.js";
|
|
37
37
|
import {
|
|
38
38
|
NPX_LATEST_COMMAND
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-AAFKFRSV.js";
|
|
40
40
|
import {
|
|
41
41
|
EXIT
|
|
42
42
|
} from "./chunk-BG4HHB7E.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
openCodePluginArgv,
|
|
4
4
|
openCodePluginModule,
|
|
5
5
|
renderOpenCodePlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DBYBCSNP.js";
|
|
7
7
|
import {
|
|
8
8
|
OPENCODE_FAILED_EVENT,
|
|
9
9
|
OPENCODE_IDLE_EVENT,
|
|
@@ -12,17 +12,17 @@ import {
|
|
|
12
12
|
OPENCODE_PLUGIN_SIBLING,
|
|
13
13
|
OPENCODE_PLUGIN_SIBLING_CONTENTS,
|
|
14
14
|
OPENCODE_SUBAGENT_IDLE_EVENT
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-32IXC5BW.js";
|
|
16
16
|
import {
|
|
17
17
|
compatibleConfigFile
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6VS46VHK.js";
|
|
19
19
|
import {
|
|
20
20
|
hookOwnerOf,
|
|
21
21
|
hookOwnerOfCommands
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6GEMETKN.js";
|
|
23
23
|
import {
|
|
24
24
|
AGENT_CHOICES
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-OAKUURVX.js";
|
|
26
26
|
import {
|
|
27
27
|
OPENCODE_INSTRUCTIONS_LABEL,
|
|
28
28
|
bridgeStub,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
resolveBridgeStub,
|
|
37
37
|
vscodePluginDir,
|
|
38
38
|
windowsNodeLauncherFor
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-A6IQKZKH.js";
|
|
40
40
|
import {
|
|
41
41
|
readJsonSafe
|
|
42
42
|
} from "./chunk-PM2NRK6Y.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
OPENCODE_APPROVAL_EVENT,
|
|
47
47
|
hookCompatibleProfile,
|
|
48
48
|
isRecord
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
50
50
|
|
|
51
51
|
// src/opencode-config.ts
|
|
52
52
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
APPROVAL_RULES_PATH,
|
|
3
3
|
canChangeApprovalSettings
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HZDEWSUC.js";
|
|
5
5
|
import {
|
|
6
6
|
callMcpTool
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UVCIC3LV.js";
|
|
8
8
|
import {
|
|
9
9
|
absoluteUrl
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TMVVAYAU.js";
|
|
11
11
|
import {
|
|
12
12
|
getBaseUrl
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RRRVMTF2.js";
|
|
14
14
|
import {
|
|
15
15
|
NPX_LATEST_COMMAND
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-AAFKFRSV.js";
|
|
17
17
|
import {
|
|
18
18
|
AGENT_STOP_DEFAULT_SECONDS,
|
|
19
19
|
APPROVAL_MODE_META,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
classifyConfirmResponse,
|
|
22
22
|
isAnswerSource,
|
|
23
23
|
roundTripAsk
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
25
25
|
|
|
26
26
|
// src/reach.ts
|
|
27
27
|
var PUSHARY_APP_DOWNLOAD_URL = "https://pushary.com/download";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyHookExecutable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6GEMETKN.js";
|
|
4
4
|
import {
|
|
5
5
|
bridgeResolvesToApp,
|
|
6
6
|
cursorUserHooks,
|
|
7
7
|
executableFileName,
|
|
8
8
|
isBridgeLocator,
|
|
9
9
|
liveBridgeProbe
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A6IQKZKH.js";
|
|
11
11
|
import {
|
|
12
12
|
atLeast,
|
|
13
13
|
parseVersion
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isCursorHookPayload,
|
|
22
22
|
isRecord,
|
|
23
23
|
toolsCoveredByGateEntry
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
25
25
|
|
|
26
26
|
// src/cursor-gate-registration.ts
|
|
27
27
|
import { dirname, isAbsolute, join, resolve } from "path";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
apiKeyInForce,
|
|
3
3
|
configFilePath,
|
|
4
4
|
keyPrefixToShow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RRRVMTF2.js";
|
|
6
6
|
import {
|
|
7
7
|
backupFile,
|
|
8
8
|
backupFileInto,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isRecord,
|
|
16
16
|
isValidApiKey,
|
|
17
17
|
normalizeInstallSource
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
19
19
|
|
|
20
20
|
// src/install-source.ts
|
|
21
21
|
import { readFileSync } from "fs";
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-WHB622LP.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureDaemonRunning
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BI6UCLYP.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6GEMETKN.js";
|
|
10
10
|
import {
|
|
11
11
|
hookMeaning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NVMHXGKS.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
changedRecipientsMessage,
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
uploadTranscriptRecords,
|
|
25
25
|
verifyAnchoredRecipients,
|
|
26
26
|
wrapSessionKey
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-JQRBEIL6.js";
|
|
28
28
|
import {
|
|
29
29
|
transcriptEnvironmentPreference,
|
|
30
30
|
transcriptsEnabled
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-F7EXRZIN.js";
|
|
32
32
|
import {
|
|
33
33
|
external_exports,
|
|
34
34
|
ownedOnlyByThisUser,
|
|
@@ -36,19 +36,19 @@ import {
|
|
|
36
36
|
} from "./chunk-P6DUWKAO.js";
|
|
37
37
|
import {
|
|
38
38
|
fetchAsCredential
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GULSIIDL.js";
|
|
40
40
|
import {
|
|
41
41
|
readTranscriptPreference
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-QCCNXYQU.js";
|
|
43
43
|
import {
|
|
44
44
|
claudeConfigDir,
|
|
45
45
|
codexHome,
|
|
46
46
|
pusharyDir
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-A6IQKZKH.js";
|
|
48
48
|
import {
|
|
49
49
|
getApiKey,
|
|
50
50
|
getBaseUrl
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-RRRVMTF2.js";
|
|
52
52
|
import {
|
|
53
53
|
writeJsonAtomic,
|
|
54
54
|
writeJsonAtomicDurable
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
isHookSource,
|
|
62
62
|
isRecord,
|
|
63
63
|
redactSecretsFromContent
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
65
65
|
|
|
66
66
|
// src/transcript-registration.ts
|
|
67
67
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
transcriptTokensIn,
|
|
33
33
|
transcriptUsageRequest,
|
|
34
34
|
usageLimitStopOf
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-NVMHXGKS.js";
|
|
36
36
|
import {
|
|
37
37
|
isDeferAnswer
|
|
38
38
|
} from "./chunk-Z25VDYAL.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
RETRY_ACK,
|
|
41
41
|
readCommandAck,
|
|
42
42
|
refusedReceiptMessage
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-LMGVUOHB.js";
|
|
44
44
|
import {
|
|
45
45
|
askUser,
|
|
46
46
|
cancelQuestionSettledAtComputer,
|
|
@@ -57,32 +57,32 @@ import {
|
|
|
57
57
|
waitForOpenQuestion,
|
|
58
58
|
waitForQuestion,
|
|
59
59
|
writeDegraded
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-4WRE5OBU.js";
|
|
61
61
|
import {
|
|
62
62
|
SubscriptionRequiredError,
|
|
63
63
|
isRetryable,
|
|
64
64
|
withRetry
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UVCIC3LV.js";
|
|
66
66
|
import {
|
|
67
67
|
fetchAsCredential
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-GULSIIDL.js";
|
|
69
69
|
import {
|
|
70
70
|
branchFor,
|
|
71
71
|
projectNameFor,
|
|
72
72
|
repoKeyFor
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-SHGECMM4.js";
|
|
74
74
|
import {
|
|
75
75
|
getMachineId
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-UYROAPQQ.js";
|
|
77
77
|
import {
|
|
78
78
|
reportedInstallSource
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-QCCNXYQU.js";
|
|
80
80
|
import {
|
|
81
81
|
IDLE_PROMPT_NOTIFICATION,
|
|
82
82
|
NOTIFICATION_PUSH_TYPES,
|
|
83
83
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS,
|
|
84
84
|
claudeConfigDir
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-A6IQKZKH.js";
|
|
86
86
|
import {
|
|
87
87
|
compareVersion,
|
|
88
88
|
parseVersion
|
|
@@ -91,14 +91,14 @@ import {
|
|
|
91
91
|
getApiKey,
|
|
92
92
|
getBaseUrl,
|
|
93
93
|
isMalformedApiKeyError
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-RRRVMTF2.js";
|
|
95
95
|
import {
|
|
96
96
|
writeFileAtomic,
|
|
97
97
|
writeJsonAtomicDurable
|
|
98
98
|
} from "./chunk-PM2NRK6Y.js";
|
|
99
99
|
import {
|
|
100
100
|
NPX_LATEST_COMMAND
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-AAFKFRSV.js";
|
|
102
102
|
import {
|
|
103
103
|
getPackageVersion,
|
|
104
104
|
isKnownReleaseVersion
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
responseRejectsCredential,
|
|
165
165
|
unansweredRefusalReason,
|
|
166
166
|
waitsForThePhone
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
168
168
|
|
|
169
169
|
// src/pending.ts
|
|
170
170
|
import { join } from "path";
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5JIHDTRQ.js";
|
|
4
4
|
import {
|
|
5
5
|
declinedAgentsFile,
|
|
6
6
|
readDeclinedAgents
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7VWLOLS3.js";
|
|
8
8
|
import {
|
|
9
9
|
liveCursorGateCoverage
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PX7ANZ3Q.js";
|
|
11
11
|
import {
|
|
12
12
|
OPENCODE_HOOK_BINARY,
|
|
13
13
|
openCodeConfigDir,
|
|
14
14
|
openCodePluginFile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OZYX6IEK.js";
|
|
16
16
|
import {
|
|
17
17
|
openCodePluginArgv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DBYBCSNP.js";
|
|
19
19
|
import {
|
|
20
20
|
compatibleConfigFile,
|
|
21
21
|
compatibleHookEvents,
|
|
22
22
|
grokHome
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6VS46VHK.js";
|
|
24
24
|
import {
|
|
25
25
|
parseConfigDocument
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FVDBRCTQ.js";
|
|
27
27
|
import {
|
|
28
28
|
DEFAULT_HOOKS_KEY_PATH,
|
|
29
29
|
GEMINI_HOOK_BINARY,
|
|
30
30
|
GEMINI_HOOK_EVENTS,
|
|
31
31
|
hooksAt
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-6GEMETKN.js";
|
|
33
33
|
import {
|
|
34
34
|
CODEX_EARLIER_APPROVAL_MATCHERS,
|
|
35
35
|
CODEX_HOOK_BINARY,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
parseHookArgv,
|
|
58
58
|
parseHookCommand,
|
|
59
59
|
supportedClaudeEvents
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-A6IQKZKH.js";
|
|
61
61
|
import {
|
|
62
62
|
readRegularJsonFile,
|
|
63
63
|
readRegularTextFile
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
OPENCODE_APPROVAL_EVENT,
|
|
72
72
|
isRecord,
|
|
73
73
|
matcherMatchesEveryCall
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-WZZ5VP3M.js";
|
|
75
75
|
|
|
76
76
|
// src/hook-wiring.ts
|
|
77
77
|
import { createHash } from "crypto";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QCCNXYQU.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AAFKFRSV.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|