sequential-hooks 0.1.0__tar.gz
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.
- sequential_hooks-0.1.0/.gitignore +46 -0
- sequential_hooks-0.1.0/LICENSE +21 -0
- sequential_hooks-0.1.0/PKG-INFO +90 -0
- sequential_hooks-0.1.0/README.md +71 -0
- sequential_hooks-0.1.0/_build.py +30 -0
- sequential_hooks-0.1.0/plugins/agy/README.md +145 -0
- sequential_hooks-0.1.0/plugins/agy/_sequential_hooks/__init__.py +1 -0
- sequential_hooks-0.1.0/plugins/agy/_sequential_hooks/_adapter.py +566 -0
- sequential_hooks-0.1.0/plugins/agy/_sequential_hooks/_doctor.py +413 -0
- sequential_hooks-0.1.0/plugins/agy/adapter.toml +2 -0
- sequential_hooks-0.1.0/plugins/agy/tests/fixtures/agy_post.json +9 -0
- sequential_hooks-0.1.0/plugins/agy/tests/fixtures/agy_pre.json +15 -0
- sequential_hooks-0.1.0/plugins/agy/tests/test_agy_adapter.py +1236 -0
- sequential_hooks-0.1.0/plugins/agy/tests/test_agy_doctor.py +875 -0
- sequential_hooks-0.1.0/plugins/claude/README.md +160 -0
- sequential_hooks-0.1.0/plugins/claude/_sequential_hooks/__init__.py +1 -0
- sequential_hooks-0.1.0/plugins/claude/_sequential_hooks/_adapter.py +560 -0
- sequential_hooks-0.1.0/plugins/claude/_sequential_hooks/_doctor.py +455 -0
- sequential_hooks-0.1.0/plugins/claude/adapter.toml +2 -0
- sequential_hooks-0.1.0/plugins/claude/tests/fixtures/claude_post.json +27 -0
- sequential_hooks-0.1.0/plugins/claude/tests/fixtures/claude_pre.json +21 -0
- sequential_hooks-0.1.0/plugins/claude/tests/test_claude_adapter.py +2282 -0
- sequential_hooks-0.1.0/plugins/claude/tests/test_claude_doctor.py +879 -0
- sequential_hooks-0.1.0/plugins/codex/README.md +119 -0
- sequential_hooks-0.1.0/plugins/codex/_sequential_hooks/__init__.py +1 -0
- sequential_hooks-0.1.0/plugins/codex/_sequential_hooks/_adapter.py +466 -0
- sequential_hooks-0.1.0/plugins/codex/_sequential_hooks/_doctor.py +563 -0
- sequential_hooks-0.1.0/plugins/codex/adapter.toml +2 -0
- sequential_hooks-0.1.0/plugins/codex/tests/fixtures/codex_post.json +25 -0
- sequential_hooks-0.1.0/plugins/codex/tests/fixtures/codex_pre.json +19 -0
- sequential_hooks-0.1.0/plugins/codex/tests/test_codex_adapter.py +1946 -0
- sequential_hooks-0.1.0/plugins/codex/tests/test_codex_doctor.py +869 -0
- sequential_hooks-0.1.0/pyproject.toml +144 -0
- sequential_hooks-0.1.0/src/sequential_hooks/__init__.py +3 -0
- sequential_hooks-0.1.0/src/sequential_hooks/__main__.py +5 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_arguments.py +222 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_cleanup.py +88 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_cli.py +440 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/__init__.py +410 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/_posix.py +236 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/_uncontained.py +239 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/_windows.py +853 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/_windows_api.py +570 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_containment/_windows_launcher.py +189 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_diagnostics.py +265 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_doctor/__init__.py +342 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_doctor/_command.py +469 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_doctor/_common.py +448 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_doctor/_types.py +94 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_downstream.py +181 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_executable.py +187 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_executor.py +825 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_registry.py +103 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_runner.py +48 -0
- sequential_hooks-0.1.0/src/sequential_hooks/_types.py +125 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/__init__.py +130 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/_contract.py +434 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/_inspection.py +78 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/_json.py +150 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/_records.py +273 -0
- sequential_hooks-0.1.0/src/sequential_hooks/hosts/_skeleton.py +1326 -0
- sequential_hooks-0.1.0/src/sequential_hooks/py.typed +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
dist/
|
|
13
|
+
.eggs/
|
|
14
|
+
*.egg-info/
|
|
15
|
+
*.egg
|
|
16
|
+
|
|
17
|
+
# Virtual environments
|
|
18
|
+
.venv/
|
|
19
|
+
venv/
|
|
20
|
+
ENV/
|
|
21
|
+
|
|
22
|
+
# PyInstaller
|
|
23
|
+
*.manifest
|
|
24
|
+
*.spec
|
|
25
|
+
|
|
26
|
+
# Unit test / coverage reports
|
|
27
|
+
htmlcov/
|
|
28
|
+
.tox/
|
|
29
|
+
.nox/
|
|
30
|
+
.coverage*
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.cache/
|
|
33
|
+
|
|
34
|
+
# Type checker / linter caches
|
|
35
|
+
.pyright/
|
|
36
|
+
.mypy_cache/
|
|
37
|
+
.ruff_cache/
|
|
38
|
+
pyrightconfig.json
|
|
39
|
+
|
|
40
|
+
# Editors
|
|
41
|
+
.vscode/
|
|
42
|
+
.idea/
|
|
43
|
+
|
|
44
|
+
# OS
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 the sequential-hooks authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sequential-hooks
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Run coding-agent hooks in order with agent-specific response handling
|
|
5
|
+
Project-URL: Documentation, https://github.com/dactylo/sequential-hooks/tree/main/docs
|
|
6
|
+
Project-URL: Homepage, https://github.com/dactylo/sequential-hooks
|
|
7
|
+
Project-URL: Issues, https://github.com/dactylo/sequential-hooks/issues
|
|
8
|
+
Project-URL: Repository, https://github.com/dactylo/sequential-hooks
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: coding-agents,hooks,orchestration,sequential
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.13
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# sequential-hooks
|
|
21
|
+
|
|
22
|
+
`sequential-hooks` runs coding-agent hooks in a strict order. Without a wrapper, a host may start
|
|
23
|
+
several hooks concurrently or in an undocumented order. A validator can then inspect an old tool
|
|
24
|
+
input while another hook is still replacing it. Register one wrapper hook and place the former hook
|
|
25
|
+
commands inside it as ordered steps.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
`sequential-hooks` requires native CPython 3.13 or newer and `uv`. The project is not published to
|
|
30
|
+
a package index. Install the current checkout from the repository root:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
uv tool install .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To update an existing installation after pulling changes:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
uv tool install --reinstall .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
sequential-hooks has no configuration file. Choose the coding agent that will run the wrapper, then
|
|
43
|
+
add the registration from its setup guide:
|
|
44
|
+
|
|
45
|
+
- [Claude Code](plugins/claude/README.md)
|
|
46
|
+
- [Codex](plugins/codex/README.md)
|
|
47
|
+
- [Antigravity](plugins/agy/README.md)
|
|
48
|
+
|
|
49
|
+
Check [compatibility](docs/compatibility.md) for the recorded host versions and known host limits,
|
|
50
|
+
and [platforms](docs/platforms.md) for process handling. The guides use `first-hook`,
|
|
51
|
+
`second-hook`, and `audit-hook` as sample child commands. Replace them with hooks you have
|
|
52
|
+
installed and want to run in order. Move those child hooks into the wrapper and remove their
|
|
53
|
+
separate registrations, or the host may still start duplicate copies concurrently.
|
|
54
|
+
|
|
55
|
+
The wrapper command expects a native host payload on stdin. Configure it as a host hook rather than
|
|
56
|
+
running the hook command interactively. After saving the registration, inspect it with the matching
|
|
57
|
+
read-only report:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
sequential-hooks doctor --agent claude
|
|
61
|
+
sequential-hooks doctor --agent codex
|
|
62
|
+
sequential-hooks doctor --agent agy
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Exit 0 means the findings are informational. Exit 1 means at least one warning or error needs
|
|
66
|
+
action. The [troubleshooting guide](docs/troubleshooting.md) explains common findings.
|
|
67
|
+
|
|
68
|
+
Antigravity requires an explicit event in each hook command. An all-neutral Antigravity pre-tool
|
|
69
|
+
chain emits the host's real automatic `allow` decision; it does not preserve the ordinary
|
|
70
|
+
permission prompt. Review the [Antigravity setup guide](plugins/agy/README.md) before enabling it.
|
|
71
|
+
|
|
72
|
+
## How commands compose
|
|
73
|
+
|
|
74
|
+
`-a, --agent` selects the installed host adapter for a coding agent. The built-in names are
|
|
75
|
+
`claude`, `codex`, and `agy`; a third-party adapter installed with
|
|
76
|
+
`uv tool install . --with PACKAGE` is selected by its own name. Nothing is inferred from the
|
|
77
|
+
payload. See [adding a host](docs/adding-a-host.md).
|
|
78
|
+
|
|
79
|
+
`-h, --help` prints help for wrapper mode; `doctor -h` and `doctor --help` print doctor help.
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
sequential-hooks --agent codex --step-timeout 30 defsort hook --agent codex -- docwrap hook --agent codex
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The exact `--` token separates steps and cannot be passed to a step. Each child receives its own
|
|
86
|
+
literal arguments, including its own `--agent`; wrapper options are not inherited by child
|
|
87
|
+
commands.
|
|
88
|
+
|
|
89
|
+
Continue with the [documentation map](docs/README.md), [concepts](docs/concepts.md),
|
|
90
|
+
[security](docs/security.md), or the [CLI reference](docs/reference/cli.md).
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# sequential-hooks
|
|
2
|
+
|
|
3
|
+
`sequential-hooks` runs coding-agent hooks in a strict order. Without a wrapper, a host may start
|
|
4
|
+
several hooks concurrently or in an undocumented order. A validator can then inspect an old tool
|
|
5
|
+
input while another hook is still replacing it. Register one wrapper hook and place the former hook
|
|
6
|
+
commands inside it as ordered steps.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
`sequential-hooks` requires native CPython 3.13 or newer and `uv`. The project is not published to
|
|
11
|
+
a package index. Install the current checkout from the repository root:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
uv tool install .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
To update an existing installation after pulling changes:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
uv tool install --reinstall .
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
sequential-hooks has no configuration file. Choose the coding agent that will run the wrapper, then
|
|
24
|
+
add the registration from its setup guide:
|
|
25
|
+
|
|
26
|
+
- [Claude Code](plugins/claude/README.md)
|
|
27
|
+
- [Codex](plugins/codex/README.md)
|
|
28
|
+
- [Antigravity](plugins/agy/README.md)
|
|
29
|
+
|
|
30
|
+
Check [compatibility](docs/compatibility.md) for the recorded host versions and known host limits,
|
|
31
|
+
and [platforms](docs/platforms.md) for process handling. The guides use `first-hook`,
|
|
32
|
+
`second-hook`, and `audit-hook` as sample child commands. Replace them with hooks you have
|
|
33
|
+
installed and want to run in order. Move those child hooks into the wrapper and remove their
|
|
34
|
+
separate registrations, or the host may still start duplicate copies concurrently.
|
|
35
|
+
|
|
36
|
+
The wrapper command expects a native host payload on stdin. Configure it as a host hook rather than
|
|
37
|
+
running the hook command interactively. After saving the registration, inspect it with the matching
|
|
38
|
+
read-only report:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
sequential-hooks doctor --agent claude
|
|
42
|
+
sequential-hooks doctor --agent codex
|
|
43
|
+
sequential-hooks doctor --agent agy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Exit 0 means the findings are informational. Exit 1 means at least one warning or error needs
|
|
47
|
+
action. The [troubleshooting guide](docs/troubleshooting.md) explains common findings.
|
|
48
|
+
|
|
49
|
+
Antigravity requires an explicit event in each hook command. An all-neutral Antigravity pre-tool
|
|
50
|
+
chain emits the host's real automatic `allow` decision; it does not preserve the ordinary
|
|
51
|
+
permission prompt. Review the [Antigravity setup guide](plugins/agy/README.md) before enabling it.
|
|
52
|
+
|
|
53
|
+
## How commands compose
|
|
54
|
+
|
|
55
|
+
`-a, --agent` selects the installed host adapter for a coding agent. The built-in names are
|
|
56
|
+
`claude`, `codex`, and `agy`; a third-party adapter installed with
|
|
57
|
+
`uv tool install . --with PACKAGE` is selected by its own name. Nothing is inferred from the
|
|
58
|
+
payload. See [adding a host](docs/adding-a-host.md).
|
|
59
|
+
|
|
60
|
+
`-h, --help` prints help for wrapper mode; `doctor -h` and `doctor --help` print doctor help.
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
sequential-hooks --agent codex --step-timeout 30 defsort hook --agent codex -- docwrap hook --agent codex
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The exact `--` token separates steps and cannot be passed to a step. Each child receives its own
|
|
67
|
+
literal arguments, including its own `--agent`; wrapper options are not inherited by child
|
|
68
|
+
commands.
|
|
69
|
+
|
|
70
|
+
Continue with the [documentation map](docs/README.md), [concepts](docs/concepts.md),
|
|
71
|
+
[security](docs/security.md), or the [CLI reference](docs/reference/cli.md).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Collect bundled agent entry points for distribution metadata."""
|
|
2
|
+
|
|
3
|
+
import tomllib
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import override
|
|
6
|
+
|
|
7
|
+
from hatchling.metadata.plugin.interface import MetadataHookInterface
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PluginMetadataHook(MetadataHookInterface):
|
|
11
|
+
"""Include each bundled plugin's registration in the containing distribution."""
|
|
12
|
+
|
|
13
|
+
@override
|
|
14
|
+
def update(self, metadata: dict[str, object]) -> None:
|
|
15
|
+
metadata['entry-points'] = _plugin_entry_points(Path(self.root))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _plugin_entry_points(root: Path) -> dict[str, dict[str, str]]:
|
|
19
|
+
"""Read entry points declared by the root's agent plugin directories."""
|
|
20
|
+
groups: dict[str, dict[str, str]] = {}
|
|
21
|
+
for manifest in sorted((root / 'plugins').glob('*/adapter.toml')):
|
|
22
|
+
with manifest.open('rb') as stream:
|
|
23
|
+
entries = tomllib.load(stream)['entry-points']
|
|
24
|
+
for group, targets in entries.items():
|
|
25
|
+
registered = groups.setdefault(group, {})
|
|
26
|
+
for name, target in targets.items():
|
|
27
|
+
if name in registered:
|
|
28
|
+
raise ValueError(f'Duplicate entry point {group}:{name} in {manifest}')
|
|
29
|
+
registered[name] = target
|
|
30
|
+
return groups
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Antigravity
|
|
2
|
+
|
|
3
|
+
The Antigravity adapter chains `PreToolUse` and `PostToolUse` hooks. Antigravity may invoke an
|
|
4
|
+
exact post-tool matcher for extra callbacks whose `toolCall` is explicitly null. `sequential-hooks`
|
|
5
|
+
treats that exact shape as inapplicable, starts no child step, and returns the native empty
|
|
6
|
+
response.
|
|
7
|
+
|
|
8
|
+
Antigravity CLI 1.1.13 documents five native hook events: `PreToolUse`, `PostToolUse`,
|
|
9
|
+
`PreInvocation`, `PostInvocation`, and `Stop`. The wrapper chains only `PreToolUse` and
|
|
10
|
+
`PostToolUse`.
|
|
11
|
+
|
|
12
|
+
Antigravity configuration may appear in `~/.gemini/config/hooks.json` or project
|
|
13
|
+
`.agents/hooks.json`. `sequential-hooks` has no configuration file.
|
|
14
|
+
|
|
15
|
+
Official reference: [Antigravity hooks](https://antigravity.google/docs/hooks).
|
|
16
|
+
|
|
17
|
+
## Registration
|
|
18
|
+
|
|
19
|
+
Antigravity uses a top-level map from hook names to event configurations. A top-level hook named
|
|
20
|
+
`hooks` follows the same schema as any other name; it is not a second wrapper shape.
|
|
21
|
+
|
|
22
|
+
The child commands are examples. Replace `first-hook` and `second-hook` with installed hooks that
|
|
23
|
+
accept the corresponding Antigravity event payload.
|
|
24
|
+
|
|
25
|
+
Antigravity configuration:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"sequential-hooks": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
"PreToolUse": [
|
|
32
|
+
{
|
|
33
|
+
"matcher": "run_command",
|
|
34
|
+
"hooks": [
|
|
35
|
+
{
|
|
36
|
+
"type": "command",
|
|
37
|
+
"command": "sequential-hooks --agent agy --event PreToolUse --step-timeout 5 first-hook hook -- second-hook hook",
|
|
38
|
+
"timeout": 30
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"PostToolUse": [
|
|
44
|
+
{
|
|
45
|
+
"matcher": "run_command",
|
|
46
|
+
"hooks": [
|
|
47
|
+
{
|
|
48
|
+
"type": "command",
|
|
49
|
+
"command": "sequential-hooks --agent agy --event PostToolUse --step-timeout 5 first-hook hook -- second-hook hook",
|
|
50
|
+
"timeout": 30
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Each event registration must carry its exact event because Antigravity's payload does not identify
|
|
60
|
+
it. The wrapper commands are:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
sequential-hooks --agent agy --event PreToolUse --step-timeout 5 first-hook hook -- second-hook hook
|
|
64
|
+
sequential-hooks --agent agy --event PostToolUse --step-timeout 5 first-hook hook -- second-hook hook
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
An all-neutral pre-tool chain emits `allow`. That is Antigravity's real automatic permission, not a
|
|
68
|
+
neutral response. If the tool call must prompt, include a step that returns `ask` or `force_ask`,
|
|
69
|
+
or do not register this chain.
|
|
70
|
+
|
|
71
|
+
Use a matcher that covers only tools handled by every step. Remove separate registrations of those
|
|
72
|
+
steps. Antigravity otherwise remains free to start the duplicate copies concurrently.
|
|
73
|
+
|
|
74
|
+
Antigravity currently documents a 30-second command-handler default. Set an explicit outer timeout
|
|
75
|
+
above the chain budget; three steps at five seconds need more than 15 seconds for startup and
|
|
76
|
+
cleanup. Antigravity 1.1.8 starts the outer command with `sh -c` on macOS and Linux and `cmd /c` on
|
|
77
|
+
Windows. It expands `~` and uses the directory containing `hooks.json` as the working directory.
|
|
78
|
+
The wrapper starts each inner step as a literal argument vector without a shell.
|
|
79
|
+
|
|
80
|
+
## Decisions and output
|
|
81
|
+
|
|
82
|
+
Current Antigravity host documentation lists five native pre-tool decision values: `allow`, `ask`,
|
|
83
|
+
`deny`, `force_ask`, and `deny_unless_prior_grant`. The wrapper accepts child `allow`, `ask`,
|
|
84
|
+
`deny`, `force_ask`, and `neutral` decisions; `neutral` carries no permission decision and an
|
|
85
|
+
all-neutral chain normalizes to final `allow`. If a native hook emits `deny_unless_prior_grant`,
|
|
86
|
+
the wrapper receives that output and classifies it as malformed. The existing PreToolUse failure
|
|
87
|
+
policy converts the malformed output to an unconditional fail-closed denial.
|
|
88
|
+
|
|
89
|
+
The wrapper's pre-tool precedence is `deny > force_ask > ask > allow > neutral`; Antigravity
|
|
90
|
+
documents the meanings but no ordering for disagreeing hooks. A deny is terminal. Equal winning
|
|
91
|
+
`permissionOverrides` survive; conflicting winning arrays fail closed.
|
|
92
|
+
|
|
93
|
+
The wrapper accepts silence, ASCII-whitespace-only stdout, or `{}` from a post-tool step and emits
|
|
94
|
+
`{}`. Unparsable nonempty output is malformed; a nonempty JSON object is unsupported. A post-tool
|
|
95
|
+
failure is reported to developer diagnostics and later steps continue because Antigravity has no
|
|
96
|
+
independent feedback field.
|
|
97
|
+
|
|
98
|
+
Antigravity CLI 1.1.8 on macOS may emit two extra `PostToolUse` callbacks with explicit
|
|
99
|
+
`toolCall: null` around the attributable object-shaped callback. The wrapper still requires an
|
|
100
|
+
integer `stepIdx`, but it starts no child for the explicit-null shape. It emits exact `{}` plus one
|
|
101
|
+
line feed, writes no diagnostic, and exits `0`. A missing `toolCall` or any non-null value still
|
|
102
|
+
runs the configured chain. The wrapper does not deduplicate by callback order, `stepIdx`, or
|
|
103
|
+
conversation state.
|
|
104
|
+
|
|
105
|
+
Controlled Antigravity CLI 1.1.8 probes confirmed project registration loading and a pre-tool
|
|
106
|
+
handler on macOS. They did not establish live Linux or Windows event behavior. A separate macOS
|
|
107
|
+
post-tool probe found a matcher dispatch divergence, so required post-tool chaining still needs a
|
|
108
|
+
provider fix and a fresh live probe. The wrapper's post-tool response contract above applies when
|
|
109
|
+
the host invokes it.
|
|
110
|
+
|
|
111
|
+
## Trust and verify
|
|
112
|
+
|
|
113
|
+
Treat the wrapper and every inner step as trusted code with your user authority.
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
sequential-hooks doctor --agent agy
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`doctor` parses the named-hook map without executing commands. Static inspection can tokenize safe
|
|
120
|
+
POSIX shell text. Windows shell commands remain uninspectable because `doctor` does not evaluate
|
|
121
|
+
`cmd /c` syntax. The report's enabled state follows each named hook's `enabled` value; absent
|
|
122
|
+
`enabled` defaults to true, and a non-Boolean value is reported as malformed.
|
|
123
|
+
|
|
124
|
+
Common corrections:
|
|
125
|
+
|
|
126
|
+
- `event_missing`: add the registered event, `--event PreToolUse` or `--event PostToolUse`, to the
|
|
127
|
+
active command.
|
|
128
|
+
- `wrong_event`: change the explicit event to the registered event.
|
|
129
|
+
- `wrong_host`: change the wrapper to `--agent agy`.
|
|
130
|
+
- `agy_chain_budget_uncontained`: set the outer timeout above the configured chain budget.
|
|
131
|
+
- `duplicate_wrapper`: keep one wrapper for each event and matcher.
|
|
132
|
+
- `duplicate_child_registration`: remove the separately registered child.
|
|
133
|
+
|
|
134
|
+
## Configuration failures
|
|
135
|
+
|
|
136
|
+
When `--agent agy` and a served `--event` precede the first syntax error, a configuration error,
|
|
137
|
+
including invalid wrapper syntax or invalid native input, is answered with a generic `spawn`
|
|
138
|
+
report: top-level `deny` on `PreToolUse`, or `{}` plus a developer diagnostic on `PostToolUse`. The
|
|
139
|
+
latter does not block. Without a valid `--event`, or when the adapter itself cannot be loaded, the
|
|
140
|
+
wrapper exits 2 with one diagnostic line and no response. Antigravity has no exit-code tier, so
|
|
141
|
+
that last resort does not block; it runs no step and grants nothing. Run `doctor` to catch a
|
|
142
|
+
missing or unsupported event and an unavailable adapter before a hook fires.
|
|
143
|
+
|
|
144
|
+
See the [protocol reference](../../docs/reference/host-protocols.md#antigravity) and
|
|
145
|
+
[security guide](../../docs/security.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Provide the private Antigravity adapter implementation."""
|