@pushary/agent-hooks 0.95.5 → 0.95.6
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 +7 -0
- package/dist/bin/pushary-bell-hook.js +18 -18
- package/dist/bin/pushary-bell.js +7 -7
- package/dist/bin/pushary-claude.js +19 -19
- package/dist/bin/pushary-clean.js +18 -18
- package/dist/bin/pushary-codex-bridge.js +10 -10
- package/dist/bin/pushary-codex-hook.js +21 -21
- package/dist/bin/pushary-codex.js +7 -7
- package/dist/bin/pushary-connect.js +8 -8
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +24 -24
- package/dist/bin/pushary-disconnect.js +8 -8
- package/dist/bin/pushary-doctor.js +88 -34
- package/dist/bin/pushary-elicitation-hook.js +17 -17
- package/dist/bin/pushary-gemini-bridge.js +9 -9
- package/dist/bin/pushary-gemini-hook.js +20 -20
- package/dist/bin/pushary-hook.js +24 -24
- package/dist/bin/pushary-login.js +9 -9
- package/dist/bin/pushary-logout.js +6 -6
- package/dist/bin/pushary-mode.js +5 -5
- package/dist/bin/pushary-notification-hook.js +19 -19
- package/dist/bin/pushary-opencode-hook.js +20 -20
- package/dist/bin/pushary-permission-denied-hook.js +22 -22
- package/dist/bin/pushary-permission-hook.js +22 -22
- package/dist/bin/pushary-post-hook.js +19 -19
- package/dist/bin/pushary-prompt-hook.js +19 -19
- package/dist/bin/pushary-session-end-hook.js +19 -19
- package/dist/bin/pushary-session-start-hook.js +22 -22
- package/dist/bin/pushary-setup.js +45 -38
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +14 -10
- package/dist/bin/pushary-stop-hook.js +19 -19
- package/dist/bin/pushary-stopfailure-hook.js +19 -19
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +16 -16
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +1 -1
- package/dist/{chunk-UCS65VVR.js → chunk-32WFHA77.js} +1 -1
- package/dist/{chunk-IVQMNLSA.js → chunk-32WWVRXN.js} +1 -1
- package/dist/{chunk-HQIVR7MM.js → chunk-43TFQOAT.js} +1 -1
- package/dist/{chunk-2ZTL3PGN.js → chunk-4XFBO3GW.js} +1 -1
- package/dist/{chunk-I6GZX3FT.js → chunk-6II5RBAS.js} +1 -1
- package/dist/{chunk-S5CMLR35.js → chunk-6MRPTYYH.js} +1 -1
- package/dist/{chunk-XLOELLAS.js → chunk-7N3D4GN7.js} +4 -4
- package/dist/{chunk-HBHEX3JQ.js → chunk-A2M6FGUF.js} +3 -3
- package/dist/{chunk-WRDLHR2F.js → chunk-AXECWTTZ.js} +2 -2
- package/dist/{chunk-VOSGZ6PH.js → chunk-BS5XR4J7.js} +3 -3
- package/dist/{chunk-N4VNLISN.js → chunk-C7BFOC35.js} +2 -2
- package/dist/{chunk-2D7BAOMY.js → chunk-CDBTCEKE.js} +3 -3
- package/dist/{chunk-4PX4QK2Z.js → chunk-DH4INZW3.js} +1 -1
- package/dist/{chunk-QQGNFHIK.js → chunk-DSCGKZO5.js} +2 -2
- package/dist/{chunk-OW6AZDY2.js → chunk-FBO5WS3D.js} +1 -1
- package/dist/{chunk-67YNQ3QA.js → chunk-FHIVWF4B.js} +10 -6
- package/dist/{chunk-CUEZMPLJ.js → chunk-FVTFSYKB.js} +1 -1
- package/dist/{chunk-DLLAWCQB.js → chunk-GOQHN2UH.js} +1 -1
- package/dist/{chunk-BDI2MXTT.js → chunk-HBBQO77U.js} +1 -1
- package/dist/{chunk-HGUZOUB2.js → chunk-HHODMHTH.js} +3 -3
- package/dist/{chunk-IM2A5H33.js → chunk-HKQ6CD32.js} +1 -1
- package/dist/{chunk-OI3DJA7N.js → chunk-JZSWA3VT.js} +1 -1
- package/dist/{chunk-KAVDAZ7A.js → chunk-KAWLZTRJ.js} +1 -1
- package/dist/{chunk-QHWXUNMN.js → chunk-KNIVXEW4.js} +1 -1
- package/dist/{chunk-D6PRC3YQ.js → chunk-LZQVAEWP.js} +2 -1
- package/dist/{chunk-KI4PA7MQ.js → chunk-O5RQ7RYJ.js} +90 -18
- package/dist/{chunk-6AEM5RCS.js → chunk-OIZVYUED.js} +1 -1
- package/dist/{chunk-OEKFD5BC.js → chunk-R4MBUCPQ.js} +1 -1
- package/dist/{chunk-6VANQN5Q.js → chunk-RPHXG4HI.js} +2 -2
- package/dist/{chunk-VTO3TNIB.js → chunk-SLVXQOYU.js} +1 -1
- package/dist/{chunk-D62EONG3.js → chunk-SRFA5BOO.js} +1 -1
- package/dist/{chunk-WDKHZRAS.js → chunk-VZADMT7R.js} +41 -0
- package/dist/{chunk-32RMQO5Z.js → chunk-WRK6RAA5.js} +47 -4
- package/dist/{chunk-BMANRGJQ.js → chunk-WZ63WTAZ.js} +1 -1
- package/dist/{chunk-Z2UWFEJW.js → chunk-XJ6CXTSB.js} +7 -7
- package/dist/{chunk-4RF52LSU.js → chunk-XKIB2FQY.js} +8 -8
- package/dist/{chunk-HCMM3BOW.js → chunk-ZJ6QXXBC.js} +8 -5
- package/dist/{chunk-RLXVW4AM.js → chunk-ZQREURP6.js} +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +10 -10
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reapplyAllAgents
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-XJ6CXTSB.js";
|
|
5
|
+
import "../chunk-OIZVYUED.js";
|
|
6
6
|
import {
|
|
7
7
|
waitForMachineReadiness
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-WRK6RAA5.js";
|
|
9
|
+
import "../chunk-HHODMHTH.js";
|
|
10
10
|
import {
|
|
11
11
|
detectProviderLiveCapabilities,
|
|
12
12
|
hasSpawnProvider,
|
|
13
13
|
resolveControlPolicy
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-HKQ6CD32.js";
|
|
15
|
+
import "../chunk-A2M6FGUF.js";
|
|
16
16
|
import {
|
|
17
17
|
daemonHasRemoteProof,
|
|
18
18
|
daemonServiceManagerAvailable,
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
replaceDaemonService,
|
|
24
24
|
stopDaemonService,
|
|
25
25
|
waitForDaemonRemoteProof
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-7N3D4GN7.js";
|
|
27
|
+
import "../chunk-CDBTCEKE.js";
|
|
28
28
|
import "../chunk-3AJIK5AO.js";
|
|
29
29
|
import {
|
|
30
30
|
needsShell
|
|
@@ -34,31 +34,31 @@ import {
|
|
|
34
34
|
npmErrorMessage,
|
|
35
35
|
resolveGlobalBinary
|
|
36
36
|
} from "../chunk-L4ZCFMWW.js";
|
|
37
|
-
import "../chunk-
|
|
38
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-32WWVRXN.js";
|
|
38
|
+
import "../chunk-C7BFOC35.js";
|
|
39
39
|
import {
|
|
40
40
|
claudeJson,
|
|
41
41
|
codexConfigToml,
|
|
42
42
|
cursorPluginDir,
|
|
43
43
|
geminiSettings,
|
|
44
44
|
vscodePluginDir
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-FBO5WS3D.js";
|
|
46
46
|
import {
|
|
47
47
|
exitOnHelpFlag
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-
|
|
48
|
+
} from "../chunk-GOQHN2UH.js";
|
|
49
|
+
import "../chunk-LZQVAEWP.js";
|
|
50
50
|
import {
|
|
51
51
|
isNewerVersion
|
|
52
52
|
} from "../chunk-DINDL2CF.js";
|
|
53
53
|
import {
|
|
54
54
|
readControlMode
|
|
55
|
-
} from "../chunk-
|
|
55
|
+
} from "../chunk-6MRPTYYH.js";
|
|
56
56
|
import "../chunk-KZERVKTD.js";
|
|
57
|
-
import "../chunk-
|
|
57
|
+
import "../chunk-KAWLZTRJ.js";
|
|
58
58
|
import {
|
|
59
59
|
getApiKey
|
|
60
60
|
} from "../chunk-2UMNXADU.js";
|
|
61
|
-
import "../chunk-
|
|
61
|
+
import "../chunk-VZADMT7R.js";
|
|
62
62
|
|
|
63
63
|
// bin/pushary-upgrade.ts
|
|
64
64
|
import { existsSync } from "fs";
|
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "../chunk-IIENZE2J.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnFailedResponse
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-ZQREURP6.js";
|
|
8
|
+
import "../chunk-6II5RBAS.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-5RUIFDTP.js";
|
|
12
12
|
import {
|
|
13
13
|
exitOnHelpFlag
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-GOQHN2UH.js";
|
|
15
|
+
import "../chunk-LZQVAEWP.js";
|
|
16
16
|
import {
|
|
17
17
|
rejectUnknownFlags
|
|
18
18
|
} from "../chunk-GMXKITVA.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getApiKey,
|
|
29
29
|
getBaseUrl
|
|
30
30
|
} from "../chunk-2UMNXADU.js";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-VZADMT7R.js";
|
|
32
32
|
|
|
33
33
|
// bin/pushary-wait.ts
|
|
34
34
|
exitOnHelpFlag("wait");
|
package/dist/bin/pushary.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-7QLSKOSU.js";
|
|
7
7
|
import {
|
|
8
8
|
isValidApiKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VZADMT7R.js";
|
|
10
10
|
|
|
11
11
|
// src/setup/options.ts
|
|
12
12
|
var AGENT_CHOICES = ["claude_code", "codex", "gemini_cli", "hermes", "cursor", "vscode", "opencode", "custom"];
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey,
|
|
15
15
|
normalizeKeyScope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VZADMT7R.js";
|
|
17
17
|
|
|
18
18
|
// src/session.ts
|
|
19
19
|
var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
|
|
@@ -7,22 +7,22 @@ import {
|
|
|
7
7
|
} from "./chunk-L4ZCFMWW.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-C7BFOC35.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FBO5WS3D.js";
|
|
14
14
|
import {
|
|
15
15
|
getPackageVersion
|
|
16
16
|
} from "./chunk-DINDL2CF.js";
|
|
17
17
|
import {
|
|
18
18
|
readControlMode
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6MRPTYYH.js";
|
|
20
20
|
import {
|
|
21
21
|
readJsonSafe,
|
|
22
22
|
writeFileAtomic,
|
|
23
23
|
writeJsonAtomic,
|
|
24
24
|
writeJsonAtomicDurable
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KAWLZTRJ.js";
|
|
26
26
|
import {
|
|
27
27
|
getApiKey
|
|
28
28
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CDBTCEKE.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FBO5WS3D.js";
|
|
10
10
|
import {
|
|
11
11
|
CURSOR_GATE_EVENTS,
|
|
12
12
|
HOOK_LOCATOR_BINARY
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VZADMT7R.js";
|
|
14
14
|
|
|
15
15
|
// src/diagnostics/wiring.ts
|
|
16
16
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4XFBO3GW.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CLAUDE_CONNECTOR_URL,
|
|
15
15
|
COWORK_CONNECTOR_LIMIT,
|
|
16
16
|
COWORK_STANDING_INSTRUCTIONS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VZADMT7R.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/cowork.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_CHOICES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4XFBO3GW.js";
|
|
4
4
|
import {
|
|
5
5
|
isBridgeLocator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FVTFSYKB.js";
|
|
7
7
|
import {
|
|
8
8
|
pusharyHookExecutable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A2M6FGUF.js";
|
|
10
10
|
import {
|
|
11
11
|
BELL_HOOK_BINARY
|
|
12
12
|
} from "./chunk-GOPIMNVC.js";
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
NOTIFICATION_MATCHED_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRRORED_TOOLS,
|
|
4
4
|
PRETOOLUSE_PHONE_ANSWERED_TOOLS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-32WWVRXN.js";
|
|
6
6
|
import {
|
|
7
7
|
isProtectedByScope
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FBO5WS3D.js";
|
|
9
9
|
import {
|
|
10
10
|
HOOK_BUDGETS,
|
|
11
11
|
HOOK_LOCATOR_BINARY,
|
|
12
12
|
PRETOOLUSE_GATED_TOOLS
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VZADMT7R.js";
|
|
14
14
|
|
|
15
15
|
// src/gemini-config.ts
|
|
16
16
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defersToNativeMode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SRFA5BOO.js";
|
|
4
4
|
import {
|
|
5
5
|
isGatingMoment,
|
|
6
6
|
recordKeylessMoment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-32WFHA77.js";
|
|
8
8
|
import {
|
|
9
9
|
denyReasonFrom,
|
|
10
10
|
isDeferAnswer
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
reportEvent,
|
|
21
21
|
settleQuestionsForToolUse,
|
|
22
22
|
throttlePass
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZJ6QXXBC.js";
|
|
24
24
|
import {
|
|
25
25
|
DECISION_STOP_REASON,
|
|
26
26
|
askUser,
|
|
@@ -38,10 +38,10 @@ import {
|
|
|
38
38
|
describeToolCall,
|
|
39
39
|
permissionDeniedAction,
|
|
40
40
|
scopePathFor
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-HBBQO77U.js";
|
|
42
42
|
import {
|
|
43
43
|
getMachineId
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-C7BFOC35.js";
|
|
45
45
|
import {
|
|
46
46
|
getApiKey,
|
|
47
47
|
getBaseUrl
|
|
@@ -53,13 +53,14 @@ import {
|
|
|
53
53
|
effectiveWaitSeconds,
|
|
54
54
|
hookWaitClamped,
|
|
55
55
|
hookWaitDeadline,
|
|
56
|
+
hookWritePath,
|
|
56
57
|
isPermissionRequestOwnedByPreToolUse,
|
|
57
58
|
isPusharyOwnTool,
|
|
58
59
|
parseAgentQuestionAnswers,
|
|
59
60
|
parseAgentQuestions,
|
|
60
61
|
resolveGate,
|
|
61
62
|
stoppedOutput
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-VZADMT7R.js";
|
|
63
64
|
|
|
64
65
|
// src/decision-episode.ts
|
|
65
66
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -225,6 +226,7 @@ var dispatchModeHandler = async (apiKey, input, toolPolicy, machineId, trainingC
|
|
|
225
226
|
const toolTarget = deriveToolTarget(input.tool_name, input.tool_input);
|
|
226
227
|
const intent = readLastPrompt(sessionId ?? DEFAULT_SESSION) ?? (input.transcript_path ? readLastUserPrompt(input.transcript_path) : void 0);
|
|
227
228
|
const decision = {
|
|
229
|
+
toolPath: hookWritePath(input.tool_name, input.tool_input),
|
|
228
230
|
intent,
|
|
229
231
|
action: deriveAction(input.tool_name, input.tool_input),
|
|
230
232
|
blocker: scopeReason ?? deriveBlocker(toolPolicy.mode),
|
|
@@ -537,6 +539,8 @@ var automodeRetryEnabled = () => {
|
|
|
537
539
|
};
|
|
538
540
|
var reportPermissionDenied = (input) => reportEvent({
|
|
539
541
|
event: "permission_denied",
|
|
542
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
543
|
+
toolUseId: input.tool_use_id,
|
|
540
544
|
agentType: CLAUDE_CODE_AGENT.type,
|
|
541
545
|
agentName: `${CLAUDE_CODE_AGENT.label} - ${basename(input.cwd ?? process.cwd())}`,
|
|
542
546
|
action: permissionDeniedAction(input.tool_name),
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
supportedClaudeEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CDBTCEKE.js";
|
|
5
5
|
import {
|
|
6
6
|
guardBinary
|
|
7
7
|
} from "./chunk-3AJIK5AO.js";
|
|
8
8
|
import {
|
|
9
9
|
isProtectedByScope
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FBO5WS3D.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_LOCATOR_BINARY
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VZADMT7R.js";
|
|
14
14
|
|
|
15
15
|
// src/claude-config.ts
|
|
16
16
|
import { join } from "path";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-2UMNXADU.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeInstallSource
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VZADMT7R.js";
|
|
7
7
|
|
|
8
8
|
// src/cli/fsx.ts
|
|
9
9
|
import { copyFileSync, existsSync, fsyncSync, mkdirSync, openSync, closeSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
@@ -125,7 +125,8 @@ var COMMAND_OPTIONS = {
|
|
|
125
125
|
],
|
|
126
126
|
doctor: [
|
|
127
127
|
["--json", "Emit every check as one object instead of the screen"],
|
|
128
|
-
["--roundtrip", "
|
|
128
|
+
["--roundtrip", "Send a synthetic question and report the returned answer; does not test hooks"],
|
|
129
|
+
["--activation claude_code --activation-target <path>", "Read correlated evidence for one unique scratch file; sends no test question"],
|
|
129
130
|
["--no-push", "Run every check without waking a device"],
|
|
130
131
|
["--bundle", "Write a redacted diagnostics file you can attach to a support thread"]
|
|
131
132
|
],
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
} from "./chunk-EYRGBYZG.js";
|
|
16
16
|
import {
|
|
17
17
|
reportedInstallSource
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KAWLZTRJ.js";
|
|
19
|
+
import {
|
|
20
|
+
isAnswerSource
|
|
21
|
+
} from "./chunk-VZADMT7R.js";
|
|
19
22
|
|
|
20
23
|
// src/reach.ts
|
|
21
24
|
var reachVerdict = (channels) => {
|
|
@@ -119,7 +122,7 @@ var classifyDelivery = (channels, push) => {
|
|
|
119
122
|
var sendTestNotification = async (apiKey) => {
|
|
120
123
|
const result = await callMcpTool(apiKey, "send_notification", {
|
|
121
124
|
title: "Pushary is connected",
|
|
122
|
-
body: "
|
|
125
|
+
body: "This setup notification reached you. Agent hooks still need a real-agent check.",
|
|
123
126
|
agentName: "Pushary setup"
|
|
124
127
|
}, { timeoutMs: 2e4 });
|
|
125
128
|
const toCount = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
@@ -145,7 +148,7 @@ var describeVerifyOutcome = (outcome) => {
|
|
|
145
148
|
message: "Nothing to deliver to. Agents are configured; approvals will fall back to the terminal.",
|
|
146
149
|
next: [
|
|
147
150
|
"Run pushary connect to add your phone.",
|
|
148
|
-
"Then pushary doctor --roundtrip to test a
|
|
151
|
+
"Then pushary doctor --roundtrip to test a synthetic question and answer."
|
|
149
152
|
]
|
|
150
153
|
};
|
|
151
154
|
case "others-only":
|
|
@@ -174,7 +177,7 @@ var describeVerifyOutcome = (outcome) => {
|
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
};
|
|
177
|
-
var ROUND_TRIP_QUESTION = "
|
|
180
|
+
var ROUND_TRIP_QUESTION = "Pushary delivery test. Tap Yes or No to test returning an answer. This does not test your agent hooks.";
|
|
178
181
|
var ROUND_TRIP_TIMEOUT_MS = 55e3;
|
|
179
182
|
var defaultAsk = (apiKey, agentName) => (
|
|
180
183
|
// wait:false so the poll is ours: the blocking form returns on the SITE's
|
|
@@ -195,6 +198,18 @@ var defaultCancel = async (apiKey, correlationId) => {
|
|
|
195
198
|
await callMcpTool(apiKey, "cancel_question", { correlationId }, { timeoutMs: 1e4 }).catch(() => {
|
|
196
199
|
});
|
|
197
200
|
};
|
|
201
|
+
var answeredRoundTrip = (answer, correlationId, latencyMs) => {
|
|
202
|
+
if (answer.value !== "yes" && answer.value !== "no") {
|
|
203
|
+
return { kind: "error", detail: "the server reported an answer without a valid Yes or No value" };
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
kind: "answered",
|
|
207
|
+
value: answer.value,
|
|
208
|
+
latencyMs,
|
|
209
|
+
correlationId,
|
|
210
|
+
...isAnswerSource(answer.answerSource) ? { answerSource: answer.answerSource } : {}
|
|
211
|
+
};
|
|
212
|
+
};
|
|
198
213
|
var verifyRoundTrip = async (apiKey, agentName = "Pushary setup", deps = {}) => {
|
|
199
214
|
const ask = deps.ask ?? defaultAsk;
|
|
200
215
|
const wait = deps.wait ?? defaultWait;
|
|
@@ -207,31 +222,73 @@ var verifyRoundTrip = async (apiKey, agentName = "Pushary setup", deps = {}) =>
|
|
|
207
222
|
} catch (err) {
|
|
208
223
|
return { kind: "error", detail: err instanceof Error ? err.message : "ask failed" };
|
|
209
224
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
let shutdown;
|
|
226
|
+
const stop = (code) => {
|
|
227
|
+
if (shutdown) return;
|
|
228
|
+
shutdown = (async () => {
|
|
229
|
+
let timer;
|
|
230
|
+
try {
|
|
231
|
+
await Promise.race([
|
|
232
|
+
cancel(apiKey, asked.correlationId).catch(() => {
|
|
233
|
+
}),
|
|
234
|
+
new Promise((resolve) => {
|
|
235
|
+
timer = setTimeout(resolve, 4e3);
|
|
236
|
+
})
|
|
237
|
+
]);
|
|
238
|
+
} finally {
|
|
239
|
+
clearTimeout(timer);
|
|
240
|
+
process.stderr.write("Delivery test interrupted. Cleanup was attempted; an unresolved question expires automatically.\n");
|
|
241
|
+
process.exit(code);
|
|
242
|
+
}
|
|
243
|
+
})();
|
|
244
|
+
};
|
|
245
|
+
const onInterrupt = () => stop(130);
|
|
246
|
+
const onTerminate = () => stop(143);
|
|
247
|
+
if (asked.correlationId) {
|
|
248
|
+
process.on("SIGINT", onInterrupt);
|
|
249
|
+
process.on("SIGTERM", onTerminate);
|
|
215
250
|
}
|
|
216
|
-
let
|
|
251
|
+
let answerObserved = false;
|
|
217
252
|
try {
|
|
218
|
-
|
|
253
|
+
if (asked.noDevices || asked.warning) return { kind: "no-recipients" };
|
|
254
|
+
if (asked.mode === "notify_only" || asked.status === "notified") return { kind: "notify-only" };
|
|
255
|
+
if (!asked.correlationId) return { kind: "error", detail: "no correlationId returned" };
|
|
256
|
+
const answer = asked.answered === true ? asked : await wait(apiKey, asked.correlationId);
|
|
257
|
+
if (answer.answered === true) {
|
|
258
|
+
const outcome = answeredRoundTrip(answer, asked.correlationId, now() - started);
|
|
259
|
+
answerObserved = outcome.kind === "answered";
|
|
260
|
+
return outcome;
|
|
261
|
+
}
|
|
262
|
+
return { kind: "unanswered" };
|
|
219
263
|
} catch (err) {
|
|
220
|
-
await cancel(apiKey, asked.correlationId);
|
|
221
264
|
return { kind: "error", detail: err instanceof Error ? err.message : "wait failed" };
|
|
265
|
+
} finally {
|
|
266
|
+
if (shutdown) await shutdown;
|
|
267
|
+
process.off("SIGINT", onInterrupt);
|
|
268
|
+
process.off("SIGTERM", onTerminate);
|
|
269
|
+
if (!answerObserved && asked.correlationId) await cancel(apiKey, asked.correlationId).catch(() => {
|
|
270
|
+
});
|
|
222
271
|
}
|
|
223
|
-
|
|
224
|
-
|
|
272
|
+
};
|
|
273
|
+
var describeAnswerSource = (source) => {
|
|
274
|
+
switch (source) {
|
|
275
|
+
case "mobile_app":
|
|
276
|
+
case "mobile_background":
|
|
277
|
+
return "A phone answered this synthetic test.";
|
|
278
|
+
case "mac_app":
|
|
279
|
+
return "A Mac answered this synthetic test.";
|
|
280
|
+
case "sandbox":
|
|
281
|
+
return "This was a simulated sandbox answer.";
|
|
282
|
+
default:
|
|
283
|
+
return source ? `Answer source: ${source}. This was a synthetic test.` : "The answering surface was not reported. This was a synthetic test.";
|
|
225
284
|
}
|
|
226
|
-
await cancel(apiKey, asked.correlationId);
|
|
227
|
-
return { kind: "unanswered" };
|
|
228
285
|
};
|
|
229
|
-
var
|
|
286
|
+
var describeRoundTripOutcome = (outcome) => {
|
|
230
287
|
switch (outcome.kind) {
|
|
231
288
|
case "answered":
|
|
232
289
|
return {
|
|
233
290
|
ok: true,
|
|
234
|
-
message: `Answered "${outcome.value}" in ${(outcome.latencyMs / 1e3).toFixed(1)}s.
|
|
291
|
+
message: `Answered "${outcome.value}" in ${(outcome.latencyMs / 1e3).toFixed(1)}s. ${describeAnswerSource(outcome.answerSource)}`,
|
|
235
292
|
next: []
|
|
236
293
|
};
|
|
237
294
|
case "unanswered":
|
|
@@ -266,6 +323,20 @@ var describeRoundTrip = (outcome) => {
|
|
|
266
323
|
};
|
|
267
324
|
}
|
|
268
325
|
};
|
|
326
|
+
var describeRoundTrip = (outcome) => {
|
|
327
|
+
const report = describeRoundTripOutcome(outcome);
|
|
328
|
+
return { ...report, next: [...report.next, "Agent hook activation remains unverified. Restart your agent and check one real approval."] };
|
|
329
|
+
};
|
|
330
|
+
var roundTripEvidence = (outcome) => ({
|
|
331
|
+
kind: outcome?.kind ?? "skipped",
|
|
332
|
+
...outcome?.kind === "answered" ? {
|
|
333
|
+
correlationId: outcome.correlationId ?? null,
|
|
334
|
+
answerSource: outcome.answerSource ?? null,
|
|
335
|
+
value: outcome.value,
|
|
336
|
+
latencyMs: outcome.latencyMs
|
|
337
|
+
} : {},
|
|
338
|
+
hookActivation: "unverified"
|
|
339
|
+
});
|
|
269
340
|
|
|
270
341
|
// src/onboarding.ts
|
|
271
342
|
import qrcodeTerminal from "qrcode-terminal";
|
|
@@ -863,6 +934,7 @@ export {
|
|
|
863
934
|
describeReach,
|
|
864
935
|
verifyRoundTrip,
|
|
865
936
|
describeRoundTrip,
|
|
937
|
+
roundTripEvidence,
|
|
866
938
|
fetchChannels,
|
|
867
939
|
connectDevice,
|
|
868
940
|
confirmAppConnection,
|