@ascenda-one/gemini-hooks 0.1.28 → 0.1.33
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/dist/cli.js +1252 -20
- package/dist/cli.js.map +1 -1
- package/dist/liveSignal.js +6 -0
- package/dist/liveSignal.js.map +1 -1
- package/dist/setup.js +18 -5
- package/dist/setup.js.map +1 -1
- package/examples/settings.json +18 -7
- package/package.json +1 -1
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,2BAA2B,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9N,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAwC,MAAM,YAAY,CAAC;AAElG;;;;;;;;;GASG;AACH,KAAK,UAAU,IAAI;IACjB,IAAI,2BAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,kBAAkB,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1E,OAAO;IACT,CAAC;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C;IACpB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QAC9E,OAAO,MAAyB,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,IAAI,EAAE;KACH,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC;KACD,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/liveSignal.js
CHANGED
|
@@ -22,6 +22,11 @@ import { bucketPromptSize, getString, inferOutcome } from "@ascenda-one/tool-kit
|
|
|
22
22
|
* no separate failure hook, so the outcome is read off the payload the
|
|
23
23
|
* same way the telemetry mapper reads it.
|
|
24
24
|
* - `PreCompress` is Gemini's compaction.
|
|
25
|
+
* - `Notification` is `awaiting`, and only for `ToolPermission` — Gemini's
|
|
26
|
+
* confirmation dialog, where the agent has stopped and cannot go on
|
|
27
|
+
* without the person. It is the only notification type Gemini documents;
|
|
28
|
+
* an unknown one stays silent rather than being guessed into a wait,
|
|
29
|
+
* because a false `awaiting` tells Away Mode the work is parked.
|
|
25
30
|
* - `BeforeModel`/`AfterModel`/`BeforeToolSelection` fire per LLM round trip
|
|
26
31
|
* and are silent here for the same reason they are silent in the
|
|
27
32
|
* telemetry mapper: the tool hooks already carry that cadence, and these
|
|
@@ -45,6 +50,7 @@ export function liveSignalFor(hookName, input) {
|
|
|
45
50
|
case "AfterTool": return inferOutcome(input) === "failure" ? { event: "tool_failure" } : undefined;
|
|
46
51
|
case "PreCompress": return { event: "compaction" };
|
|
47
52
|
case "AfterAgent": return { event: "stop" };
|
|
53
|
+
case "Notification": return getString(input, ["notification_type"]) === "ToolPermission" ? { event: "awaiting" } : undefined;
|
|
48
54
|
default: return undefined;
|
|
49
55
|
}
|
|
50
56
|
}
|
package/dist/liveSignal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveSignal.js","sourceRoot":"","sources":["../src/liveSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAOlF
|
|
1
|
+
{"version":3,"file":"liveSignal.js","sourceRoot":"","sources":["../src/liveSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAOlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,aAAa,CAAC,QAA6B,EAAE,KAAsB;IACjF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5C,qEAAqE;YACrE,mEAAmE;YACnE,uEAAuE;YACvE,uCAAuC;YACvC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QACpI,CAAC;QACD,KAAK,YAAY,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QACjD,KAAK,WAAW,CAAC,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACnG,KAAK,aAAa,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QACnD,KAAK,YAAY,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC5C,KAAK,cAAc,CAAC,CAAC,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC,mBAAmB,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7H,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;;;;GAMG"}
|
package/dist/setup.js
CHANGED
|
@@ -2,12 +2,24 @@ import * as os from "os";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { ASCENDA_TOOL_TYPE, GEMINI_HOST } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* and `BeforeToolSelection` fire per LLM round trip and would
|
|
7
|
-
* volume for signal the tool hooks already carry
|
|
8
|
-
*
|
|
5
|
+
* The hooks that map to a catalog event, plus `Notification`. `BeforeModel`,
|
|
6
|
+
* `AfterModel` and `BeforeToolSelection` fire per LLM round trip and would
|
|
7
|
+
* multiply volume for signal the tool hooks already carry.
|
|
8
|
+
*
|
|
9
|
+
* `Notification` has no catalog counterpart and sends nothing to the cloud.
|
|
10
|
+
* It is registered for the local live bus alone: a `ToolPermission`
|
|
11
|
+
* notification is the only way Gemini says it has stopped to wait on the
|
|
12
|
+
* person, and without it the desktop app reads a confirmation dialog as work
|
|
13
|
+
* (`liveSignalFor`). One process per confirmation is bounded by how often a
|
|
14
|
+
* person is asked, not by how fast the agent runs.
|
|
9
15
|
*/
|
|
10
|
-
export const HOOK_EVENTS = ["SessionStart", "SessionEnd", "BeforeAgent", "AfterAgent", "BeforeTool", "AfterTool", "PreCompress"];
|
|
16
|
+
export const HOOK_EVENTS = ["SessionStart", "SessionEnd", "BeforeAgent", "AfterAgent", "BeforeTool", "AfterTool", "PreCompress", "Notification"];
|
|
17
|
+
/**
|
|
18
|
+
* The version of {@link HOOK_EVENTS}, registered as `--hook-set <n>`. Set 1
|
|
19
|
+
* is every unflagged registration, from before `Notification`. Bump it with
|
|
20
|
+
* the list, and `kCurrentHookSets` in the app with it.
|
|
21
|
+
*/
|
|
22
|
+
export const HOOK_SET = 2;
|
|
11
23
|
/**
|
|
12
24
|
* Gemini's default hook timeout is generous. Telemetry that cannot complete
|
|
13
25
|
* in a few seconds is not worth waiting for, and a hung request would
|
|
@@ -21,6 +33,7 @@ export const SETUP = {
|
|
|
21
33
|
packageName: "@ascenda-one/gemini-hooks",
|
|
22
34
|
binaryName: "ascenda-gemini-hook",
|
|
23
35
|
hookEvents: HOOK_EVENTS,
|
|
36
|
+
hookSet: HOOK_SET,
|
|
24
37
|
restartHint: "Restart Gemini CLI to load the hooks.",
|
|
25
38
|
// Nothing beyond the shared set: Gemini's hooks expose no posture, no
|
|
26
39
|
// model, no git action and no context figure.
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE5D;;;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O,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,EAAE,OAAO,CAAC;YACzF,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,CAAC;KACF;CACF,CAAC"}
|
package/examples/settings.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"hooks": [
|
|
6
6
|
{
|
|
7
7
|
"type": "command",
|
|
8
|
-
"command": "ascenda-gemini-hook",
|
|
8
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
9
9
|
"timeout": 5
|
|
10
10
|
}
|
|
11
11
|
]
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"hooks": [
|
|
17
17
|
{
|
|
18
18
|
"type": "command",
|
|
19
|
-
"command": "ascenda-gemini-hook",
|
|
19
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
20
20
|
"timeout": 5
|
|
21
21
|
}
|
|
22
22
|
]
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"hooks": [
|
|
28
28
|
{
|
|
29
29
|
"type": "command",
|
|
30
|
-
"command": "ascenda-gemini-hook",
|
|
30
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
31
31
|
"timeout": 5
|
|
32
32
|
}
|
|
33
33
|
]
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"hooks": [
|
|
39
39
|
{
|
|
40
40
|
"type": "command",
|
|
41
|
-
"command": "ascenda-gemini-hook",
|
|
41
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
42
42
|
"timeout": 5
|
|
43
43
|
}
|
|
44
44
|
]
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"hooks": [
|
|
50
50
|
{
|
|
51
51
|
"type": "command",
|
|
52
|
-
"command": "ascenda-gemini-hook",
|
|
52
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
53
53
|
"timeout": 5
|
|
54
54
|
}
|
|
55
55
|
]
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"hooks": [
|
|
61
61
|
{
|
|
62
62
|
"type": "command",
|
|
63
|
-
"command": "ascenda-gemini-hook",
|
|
63
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
64
64
|
"timeout": 5
|
|
65
65
|
}
|
|
66
66
|
]
|
|
@@ -71,7 +71,18 @@
|
|
|
71
71
|
"hooks": [
|
|
72
72
|
{
|
|
73
73
|
"type": "command",
|
|
74
|
-
"command": "ascenda-gemini-hook",
|
|
74
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
75
|
+
"timeout": 5
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"Notification": [
|
|
81
|
+
{
|
|
82
|
+
"hooks": [
|
|
83
|
+
{
|
|
84
|
+
"type": "command",
|
|
85
|
+
"command": "ascenda-gemini-hook --hook-set 2",
|
|
75
86
|
"timeout": 5
|
|
76
87
|
}
|
|
77
88
|
]
|
package/package.json
CHANGED