@agimon-ai/doompi-hook 0.0.1-alpha.9 → 0.0.1-alpha.90
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/README.md +113 -48
- package/dist/apiContracts.cjs +17 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +13 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/authoring.cjs +10 -0
- package/dist/authoring.cjs.map +1 -0
- package/dist/authoring.d.mts +7 -0
- package/dist/authoring.d.mts.map +1 -0
- package/dist/authoring.mjs +9 -0
- package/dist/authoring.mjs.map +1 -0
- package/dist/extensions/mcp.cjs +26 -0
- package/dist/extensions/mcp.cjs.map +1 -0
- package/dist/extensions/mcp.d.mts +5 -0
- package/dist/extensions/mcp.d.mts.map +1 -0
- package/dist/extensions/mcp.mjs +21 -0
- package/dist/extensions/mcp.mjs.map +1 -0
- package/dist/extensions/pi.cjs +250 -1
- package/dist/extensions/pi.cjs.map +1 -0
- package/dist/extensions/pi.d.mts +6 -2
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +245 -1
- package/dist/extensions/pi.mjs.map +1 -0
- package/dist/extensions/server.cjs +202 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +197 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/hookModule-c2GtLnm1.d.mts +54 -0
- package/dist/hookModule-c2GtLnm1.d.mts.map +1 -0
- package/dist/hookModules-DAFDGPUC.mjs +737 -0
- package/dist/hookModules-DAFDGPUC.mjs.map +1 -0
- package/dist/hookModules-hfDQUKiA.cjs +887 -0
- package/dist/hookModules-hfDQUKiA.cjs.map +1 -0
- package/dist/hookRuntime-BLFf_6_E.cjs +435 -0
- package/dist/hookRuntime-BLFf_6_E.cjs.map +1 -0
- package/dist/hookRuntime-D27m9ndl.mjs +346 -0
- package/dist/hookRuntime-D27m9ndl.mjs.map +1 -0
- package/dist/index-Dhd9UC9g.d.mts +365 -0
- package/dist/index-Dhd9UC9g.d.mts.map +1 -0
- package/dist/index.cjs +23 -1
- package/dist/index.d.mts +3 -12
- package/dist/index.mjs +2 -1
- package/llms.txt +2 -2
- package/package.json +58 -14
- package/src/prompts/doompi-author-hook/SKILL.md +97 -20
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/adapters/hookDocuments.cjs +0 -2
- package/dist/adapters/hookDocuments.cjs.map +0 -1
- package/dist/adapters/hookDocuments.d.cts +0 -23
- package/dist/adapters/hookDocuments.d.cts.map +0 -1
- package/dist/adapters/hookDocuments.d.mts +0 -23
- package/dist/adapters/hookDocuments.d.mts.map +0 -1
- package/dist/adapters/hookDocuments.mjs +0 -2
- package/dist/adapters/hookDocuments.mjs.map +0 -1
- package/dist/adapters/hookRunner.cjs +0 -2
- package/dist/adapters/hookRunner.cjs.map +0 -1
- package/dist/adapters/hookRunner.d.cts +0 -22
- package/dist/adapters/hookRunner.d.cts.map +0 -1
- package/dist/adapters/hookRunner.d.mts +0 -22
- package/dist/adapters/hookRunner.d.mts.map +0 -1
- package/dist/adapters/hookRunner.mjs +0 -2
- package/dist/adapters/hookRunner.mjs.map +0 -1
- package/dist/adapters/pi/extension.cjs +0 -2
- package/dist/adapters/pi/extension.cjs.map +0 -1
- package/dist/adapters/pi/extension.d.cts +0 -14
- package/dist/adapters/pi/extension.d.cts.map +0 -1
- package/dist/adapters/pi/extension.d.mts +0 -14
- package/dist/adapters/pi/extension.d.mts.map +0 -1
- package/dist/adapters/pi/extension.mjs +0 -2
- package/dist/adapters/pi/extension.mjs.map +0 -1
- package/dist/adapters/pi/hookHandlers.cjs +0 -8
- package/dist/adapters/pi/hookHandlers.cjs.map +0 -1
- package/dist/adapters/pi/hookHandlers.mjs +0 -8
- package/dist/adapters/pi/hookHandlers.mjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.cjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.cjs.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +0 -14
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +0 -14
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +0 -1
- package/dist/adapters/telemetry/logSinkTelemetry.mjs +0 -2
- package/dist/adapters/telemetry/logSinkTelemetry.mjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -2
- package/dist/index.d.cts +0 -12
- package/dist/services/hookDecisions.cjs +0 -3
- package/dist/services/hookDecisions.cjs.map +0 -1
- package/dist/services/hookDecisions.d.cts +0 -19
- package/dist/services/hookDecisions.d.cts.map +0 -1
- package/dist/services/hookDecisions.d.mts +0 -19
- package/dist/services/hookDecisions.d.mts.map +0 -1
- package/dist/services/hookDecisions.mjs +0 -3
- package/dist/services/hookDecisions.mjs.map +0 -1
- package/dist/services/hookPayload.cjs +0 -2
- package/dist/services/hookPayload.cjs.map +0 -1
- package/dist/services/hookPayload.d.cts +0 -9
- package/dist/services/hookPayload.d.cts.map +0 -1
- package/dist/services/hookPayload.d.mts +0 -9
- package/dist/services/hookPayload.d.mts.map +0 -1
- package/dist/services/hookPayload.mjs +0 -2
- package/dist/services/hookPayload.mjs.map +0 -1
- package/dist/services/hookRegistry.cjs +0 -2
- package/dist/services/hookRegistry.cjs.map +0 -1
- package/dist/services/hookRegistry.d.cts +0 -37
- package/dist/services/hookRegistry.d.cts.map +0 -1
- package/dist/services/hookRegistry.d.mts +0 -37
- package/dist/services/hookRegistry.d.mts.map +0 -1
- package/dist/services/hookRegistry.mjs +0 -2
- package/dist/services/hookRegistry.mjs.map +0 -1
- package/dist/services/pluginHooks.cjs +0 -2
- package/dist/services/pluginHooks.cjs.map +0 -1
- package/dist/services/pluginHooks.d.cts +0 -13
- package/dist/services/pluginHooks.d.cts.map +0 -1
- package/dist/services/pluginHooks.d.mts +0 -13
- package/dist/services/pluginHooks.d.mts.map +0 -1
- package/dist/services/pluginHooks.mjs +0 -2
- package/dist/services/pluginHooks.mjs.map +0 -1
- package/dist/services/toolNames.cjs +0 -2
- package/dist/services/toolNames.cjs.map +0 -1
- package/dist/services/toolNames.d.cts +0 -8
- package/dist/services/toolNames.d.cts.map +0 -1
- package/dist/services/toolNames.d.mts +0 -8
- package/dist/services/toolNames.d.mts.map +0 -1
- package/dist/services/toolNames.mjs +0 -2
- package/dist/services/toolNames.mjs.map +0 -1
- package/dist/types/hooks.cjs +0 -2
- package/dist/types/hooks.cjs.map +0 -1
- package/dist/types/hooks.d.cts +0 -145
- package/dist/types/hooks.d.cts.map +0 -1
- package/dist/types/hooks.d.mts +0 -145
- package/dist/types/hooks.d.mts.map +0 -1
- package/dist/types/hooks.mjs +0 -2
- package/dist/types/hooks.mjs.map +0 -1
- package/dist/types/telemetry.cjs +0 -2
- package/dist/types/telemetry.cjs.map +0 -1
- package/dist/types/telemetry.d.cts +0 -20
- package/dist/types/telemetry.d.cts.map +0 -1
- package/dist/types/telemetry.d.mts +0 -20
- package/dist/types/telemetry.d.mts.map +0 -1
- package/dist/types/telemetry.mjs +0 -2
- package/dist/types/telemetry.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
# @agimon-ai/doompi-hook
|
|
2
2
|
|
|
3
|
-
Claude Code-compatible
|
|
4
|
-
[DoomPi](https://www.npmjs.com/package/@agimon-ai/doompi) sessions.
|
|
5
|
-
|
|
6
|
-
A **hook** is a shell command the repository runs at a point in the session: before a tool call,
|
|
7
|
-
after one, at session start, when the agent settles, and at session end. Commands are declared in
|
|
8
|
-
`.doom/hooks.yaml`, grouped so a mode can turn a whole family of them on or off.
|
|
3
|
+
Repository, personal, and Claude Code-compatible plugin hooks for
|
|
4
|
+
[DoomPi](https://www.npmjs.com/package/@agimon-ai/doompi) sessions. Registry rows can run shell commands or compiled TypeScript/JavaScript modules.
|
|
9
5
|
|
|
10
6
|
> **Alpha:** hook configuration and runtime contracts may change between releases.
|
|
11
7
|
|
|
12
8
|
## Requirements
|
|
13
9
|
|
|
14
10
|
- Node.js 22.19.0 or newer
|
|
15
|
-
- Pi 0.
|
|
16
|
-
- `/bin/bash`
|
|
11
|
+
- Pi 1.0.0
|
|
12
|
+
- `/bin/bash` for command hooks
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
## Registry and activation
|
|
19
15
|
|
|
20
16
|
```yaml
|
|
21
17
|
# .doom/hooks.yaml
|
|
@@ -26,7 +22,9 @@ groups:
|
|
|
26
22
|
- event: PreToolUse
|
|
27
23
|
pi:
|
|
28
24
|
matcher: Bash
|
|
29
|
-
|
|
25
|
+
module: .doom/hooks/guard.ts
|
|
26
|
+
timeout: 10
|
|
27
|
+
order: 0
|
|
30
28
|
workflow:
|
|
31
29
|
hooks:
|
|
32
30
|
- event: Stop
|
|
@@ -35,14 +33,9 @@ groups:
|
|
|
35
33
|
skipInSubagent: true
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
it. The same document is read from the global `.doom` directory and from the repository. A
|
|
40
|
-
repository group replaces the global group of the same ID outright.
|
|
41
|
-
|
|
42
|
-
## Activation
|
|
36
|
+
Each `pi` binding declares exactly one of `command` or `module`. Module paths resolve relative to the declaring repository root or personal `~/.pi/.doom` root, not the directory containing `hooks.yaml`. Personal configuration is `~/.pi/.doom/hooks.yaml`; repository configuration is `<repo>/.doom/hooks.yaml`. A repository group replaces the personal group of the same ID completely.
|
|
43
37
|
|
|
44
|
-
The
|
|
45
|
-
that should run in a major mode:
|
|
38
|
+
The distribution activates this package by default through the `default.packages` list written by `doompi init` or `dpi init`. Keep it there, or declare it in a selected layer. Layers only declare the `hookGroups` to select; they do not define hook implementations:
|
|
46
39
|
|
|
47
40
|
```yaml
|
|
48
41
|
# .doom/modes.yaml
|
|
@@ -51,53 +44,123 @@ layers:
|
|
|
51
44
|
hookGroups: [safety, workflow]
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
`core: true` always loads. Unset `hookGroups` means all groups; explicit `hookGroups: []` means core groups only. An explicit nonempty list selects those groups plus core. Lower `order` values run first, with declaration order breaking ties. Registry commands and modules interleave in that order, followed by plugin commands. An explicit denial ends the chain.
|
|
48
|
+
|
|
49
|
+
`matcher` is a regular expression over Claude tool names such as `Bash` and `Write`. Modules receive native Pi events and tool names such as `bash`, not translated command payloads. `skipInSubagent: true` excludes a registry row from child tool dispatch. Use it for parent-owned work; it does not enable child lifecycle dispatch.
|
|
50
|
+
|
|
51
|
+
## Compiled module authoring
|
|
52
|
+
|
|
53
|
+
Use the dependency-free public authoring subpath, not the extension/runtime entry:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { defineDoomHook } from '@agimon-ai/doompi-hook/authoring';
|
|
57
|
+
|
|
58
|
+
export default defineDoomHook({
|
|
59
|
+
setup(ctx) {
|
|
60
|
+
let calls = 0;
|
|
61
|
+
return {
|
|
62
|
+
tool_call(event, ctx) {
|
|
63
|
+
calls += 1;
|
|
64
|
+
if (event.toolName === 'bash' && String(event.input.command).includes('rm -rf')) {
|
|
65
|
+
return { block: true, reason: 'Use a non-destructive command.' };
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
async dispose() {
|
|
69
|
+
// Release resources owned by this session's setup.
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`defineDoomHook` checks the contract while preserving inference. The default export must have `setup(ctx)`, returning handlers synchronously or asynchronously. Only handlers selected by registry rows run:
|
|
77
|
+
|
|
78
|
+
| Registry event | Native module handler | Result |
|
|
79
|
+
| -------------- | --------------------------- | ------------------------------------------------ |
|
|
80
|
+
| `SessionStart` | `session_start(event, ctx)` | `void` |
|
|
81
|
+
| `PreToolUse` | `tool_call(event, ctx)` | `void` or `{ block?: boolean, reason?: string }` |
|
|
82
|
+
| `PostToolUse` | `tool_result(event, ctx)` | `void` or `{ content?, details?, isError? }` |
|
|
83
|
+
| `Stop` | `agent_settled(event, ctx)` | `void`, cannot send messages |
|
|
84
|
+
|
|
85
|
+
Optional `dispose()` returns void or a promise. There is no module `SessionEnd` handler. Tool-call handlers may mutate `event.input`, which must remain a JSON object. Accepted mutations flow to later rows and the tool. Tool-result patches accept text/image content, JSON-compatible details, and a boolean error flag. Failed, invalid, or late invocations cannot publish input mutations or result patches. Lifecycle handlers cannot return decisions.
|
|
86
|
+
|
|
87
|
+
### Full HookContext contract
|
|
88
|
+
|
|
89
|
+
The authoring subpath exports `HookContext`, `HookHandlers`, `HookModule`, `HookModuleDescriptor`, `AgentSettledEvent`, `Awaitable`, and `JsonValue` types.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
interface HookContext {
|
|
93
|
+
readonly sessionId: string;
|
|
94
|
+
readonly parentSessionId?: string;
|
|
95
|
+
readonly agent?: string;
|
|
96
|
+
readonly isSubagent: boolean;
|
|
97
|
+
readonly cwd: string;
|
|
98
|
+
readonly repoRoot: string;
|
|
99
|
+
readonly model?: { readonly provider: string; readonly id: string };
|
|
100
|
+
readonly signal: AbortSignal;
|
|
101
|
+
sendMessage(text: string, delivery: 'steer' | 'followUp'): Promise<void>;
|
|
102
|
+
appendCustomEntry(type: string, data: JsonValue): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`cwd` is the session working directory; `repoRoot` is its resolved repository root. Optional identity/model fields may be absent, including model in native children. Await context effects. Message delivery uses host prompt admission; admission failures propagate, they are not converted to advisory hook failures. `appendCustomEntry` records JSON-compatible data in session history.
|
|
107
|
+
|
|
108
|
+
Setup and row calls for the same module and session are serialized. A module referenced by multiple rows shares one setup instance in that session. Keep mutable state inside `setup`, not at module scope: imported modules may be shared across sessions, while setup closures are session-local. In-memory state is not durable across reloads. Explicitly record history entries when durability is needed.
|
|
109
|
+
|
|
110
|
+
Setup receives a lifetime context; handlers receive an invocation context whose signal also reflects cancellation. Invocation effects are revoked after completion. Setup failure, setup/handler timeout, or cancellation quarantines the instance and revokes its context effects. Cooperate with `signal`; revocation cannot stop arbitrary JavaScript or undo already completed external effects.
|
|
111
|
+
|
|
112
|
+
## Command payloads and decisions
|
|
113
|
+
|
|
114
|
+
Commands run through `/bin/bash -c` in the repository root with a Claude-compatible JSON payload on stdin. The environment includes `CLAUDE_PROJECT_DIR`, `CODEX_REPO_ROOT`, `ORIGINAL_REPO_PATH`, and `CLAUDE_PLUGIN_ROOT`. The last field names the root declaring the repository, personal, or plugin configuration. Native child tool payloads use the child's own `session_id` and include `parent_session_id` and `agent_type`.
|
|
115
|
+
|
|
116
|
+
The last stdout line beginning with `{` is parsed as the decision. Denial is `decision: "block"` or `hookSpecificOutput.permissionDecision: "deny"`; the reason is top-level `reason` or `hookSpecificOutput.reason`. Context is `hookSpecificOutput.additionalContext`.
|
|
117
|
+
|
|
118
|
+
| Event | Command decision behavior |
|
|
119
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
120
|
+
| `SessionStart` | Adds additional context to the conversation |
|
|
121
|
+
| `PreToolUse` | Denial blocks the call. Additional context also blocks the current call with that text as its reason, allowing the agent to reconsider; it does not silently steer an executing tool |
|
|
122
|
+
| `PostToolUse` | Appends additional context or reason to the result; denial marks it as an error |
|
|
123
|
+
| `Stop` | Denial with a reason requests a follow-up turn, capped at five consecutive refusals |
|
|
124
|
+
| `SessionEnd` | Plugin commands only, run for side effects |
|
|
56
125
|
|
|
57
|
-
|
|
126
|
+
Stop payloads include `stop_hook_active` when a prior refusal is active. After five consecutive refusals, a further refusal is reported without another follow-up turn. A stop without a refusal reason resets the count. This continuation contract belongs to commands, not module `agent_settled` handlers.
|
|
58
127
|
|
|
59
|
-
|
|
60
|
-
the event on stdin. The environment includes `CLAUDE_PROJECT_DIR`, `CODEX_REPO_ROOT`, and
|
|
61
|
-
`ORIGINAL_REPO_PATH`. Every resolved hook also receives `CLAUDE_PLUGIN_ROOT`, set to the root that
|
|
62
|
-
declared its repository, personal, or plugin configuration. Tool names in the payload and in
|
|
63
|
-
`matcher` are Claude names (`Bash`, `Write`), not Pi's.
|
|
128
|
+
## Event ownership and children
|
|
64
129
|
|
|
65
|
-
|
|
130
|
+
Terminal parents use Pi tool and lifecycle handlers. In headless parents, the Pi bridge owns lifecycle rows: `SessionStart`, `Stop`, and plugin-only `SessionEnd`. Server facets alone own headless tool dispatch. The bridge and server tool path share session-local module setup, so lifecycle and tool rows do not create separate instances. Session-start readiness precedes dependent turns/tools. Session-end runs once during shutdown before service disposal.
|
|
66
131
|
|
|
67
|
-
|
|
68
|
-
| ------------------------------- | ------------------------------------------------------------------ |
|
|
69
|
-
| `SessionStart` → session start | add `additionalContext` to the conversation |
|
|
70
|
-
| `PreToolUse` → tool call | block the call with a reason, or steer it with `additionalContext` |
|
|
71
|
-
| `PostToolUse` → tool result | append text to the result and mark it an error |
|
|
72
|
-
| `Stop` → agent settled | nothing; the hook runs for its side effects |
|
|
73
|
-
| `SessionEnd` → session shutdown | nothing; plugin hooks only |
|
|
132
|
+
Native children, through either the headless or terminal adapter, run only `PreToolUse` and `PostToolUse`. Registry and plugin tool hooks run, excluding registry rows marked `skipInSubagent`. Children do not run `SessionStart`, `Stop`, or `SessionEnd`. Each child has its own module setup/state and pins its launch selection and module generation, even after the parent reloads or disposes.
|
|
74
133
|
|
|
75
|
-
|
|
76
|
-
the turn. It is reported to the agent instead, because a guardrail that never ran is otherwise
|
|
77
|
-
indistinguishable from one that passed.
|
|
134
|
+
## Sync, reload, and failure handling
|
|
78
135
|
|
|
79
|
-
|
|
136
|
+
After changing a module or its imports, registry, or mode selection:
|
|
80
137
|
|
|
81
|
-
`
|
|
82
|
-
|
|
83
|
-
the
|
|
138
|
+
1. Run `doompi sync` (or `dpi sync`). Sync compiles core modules plus the union of mode-selected groups; if any mode leaves selection unset, it compiles all groups.
|
|
139
|
+
2. Run `doompi sync --check` to check drift.
|
|
140
|
+
3. Use `/reload` or restart the terminal session to adopt the published generation. Reopen headless sessions, then exercise the intended events.
|
|
84
141
|
|
|
85
|
-
|
|
142
|
+
Module imports use compiled artifacts from a synchronized descriptor, never a live source fallback. The runtime pins the descriptor at binding creation, including cold lazy imports after configuration replacement. A compilation failure preserves the previous published generation. Sync alone does not replace modules in a running session.
|
|
86
143
|
|
|
87
|
-
|
|
88
|
-
covers `.doom/hooks.yaml`, group activation, commands, payloads, decisions, and verification, and
|
|
89
|
-
is withdrawn when the package or Help provider unloads.
|
|
144
|
+
`timeout` is a positive finite number of seconds, defaulting to 10. For modules, the invocation budget includes first import/setup and the handler. Module execution/setup errors, invalid results, and timeouts are advisory, reported as missed checks rather than automatically denying tools. Host readiness, cancellation, and context effect/admission failures are not advisory execution failures. A quarantined module does not resume checking later rows in that session.
|
|
90
145
|
|
|
91
|
-
|
|
146
|
+
Command nonzero exits, spawn failures, invalid JSON, and timeouts are likewise advisory. Timed-out command process groups receive `SIGTERM`, then `SIGKILL` two seconds later.
|
|
92
147
|
|
|
93
|
-
|
|
148
|
+
## Trust and isolation limits
|
|
149
|
+
|
|
150
|
+
Hooks are executable trusted code. Compilation and generation pinning provide artifact consistency, not a sandbox or authorization boundary. Modules execute in the host Node.js process with its filesystem, network, and process privileges; commands inherit host privileges too. A synchronous infinite loop, `process.exit`, or out-of-memory failure cannot be contained in-process. Prefer `command:` when process isolation and hard termination matter. Session-local setup and serialized calls do not isolate module globals or external side effects. Context revocation only gates the exposed context effects. Do not load untrusted hooks or treat advisory checks as guaranteed enforcement.
|
|
151
|
+
|
|
152
|
+
## Verification scope
|
|
153
|
+
|
|
154
|
+
Functional proof covers real Pi bridge exactly-once dispatch, shared lifecycle/tool setup, prompt-admission marker propagation, in-flight cancellation, native command rows, cold descriptor pinning, and both native child adapters retaining modules after parent disposal. Direct/MCP command-row proof uses explicitly mocked tool bodies. This does not establish full intercom plugin integration.
|
|
155
|
+
|
|
156
|
+
## Help, install, and public API
|
|
157
|
+
|
|
158
|
+
Help minor mode contributes `doompi-author-hook` while this package and its Help provider are active.
|
|
94
159
|
|
|
95
160
|
```bash
|
|
96
161
|
pi install npm:@agimon-ai/doompi-hook
|
|
97
162
|
```
|
|
98
163
|
|
|
99
|
-
## Public API
|
|
100
|
-
|
|
101
164
|
```ts
|
|
102
165
|
import { createBashHookRunner, hookExtension } from '@agimon-ai/doompi-hook';
|
|
103
166
|
import type { HookDecision, HookEventName } from '@agimon-ai/doompi-hook';
|
|
@@ -112,6 +175,8 @@ pnpm test
|
|
|
112
175
|
pnpm lint
|
|
113
176
|
```
|
|
114
177
|
|
|
178
|
+
Routed roots and named handlers live under `src/extensions/workspaces/sessions/(backend)/`. `services/hookRuntime/` owns readiness and session lifetimes. The package build generates Pi/server entries; `src/exports/` publishes reusable capabilities.
|
|
179
|
+
|
|
115
180
|
Maintained by [Agimon](https://agimon.ai/about).
|
|
116
181
|
|
|
117
182
|
## License
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region src/schemas/apiContracts.ts
|
|
6
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
7
|
+
const apiContracts = (0, require("@agimon-ai/doompi-core/apiContracts").defineApiContract)({
|
|
8
|
+
version: 1,
|
|
9
|
+
http: [],
|
|
10
|
+
sockets: [],
|
|
11
|
+
dynamic: []
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.apiContracts = apiContracts;
|
|
15
|
+
exports.default = apiContracts;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,gDAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/schemas/apiContracts.d.ts
|
|
2
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
|
+
export declare const apiContracts: {
|
|
4
|
+
version: 1;
|
|
5
|
+
protocols?: Record<string, string> | undefined;
|
|
6
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
+
http: {
|
|
8
|
+
id: string;
|
|
9
|
+
scope: "global" | "session" | "workspace";
|
|
10
|
+
basePath?: string | undefined;
|
|
11
|
+
path: string;
|
|
12
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
+
description: string;
|
|
14
|
+
availability?: string | undefined;
|
|
15
|
+
authentication: "device" | "none" | "owner";
|
|
16
|
+
parameters?: {
|
|
17
|
+
name: string;
|
|
18
|
+
in: "header" | "path" | "query";
|
|
19
|
+
required: boolean;
|
|
20
|
+
schema: boolean | object;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
body?: {
|
|
23
|
+
contentType: string;
|
|
24
|
+
contentTypes?: string[] | undefined;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: boolean | object;
|
|
27
|
+
} | undefined;
|
|
28
|
+
responses: Record<string, {
|
|
29
|
+
description: string;
|
|
30
|
+
contentType?: string | undefined;
|
|
31
|
+
schema?: boolean | object | undefined;
|
|
32
|
+
events?: Record<string, boolean | object> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}[];
|
|
35
|
+
sockets: {
|
|
36
|
+
id: string;
|
|
37
|
+
scope: "global" | "session" | "workspace";
|
|
38
|
+
description: string;
|
|
39
|
+
availability?: string | undefined;
|
|
40
|
+
service: string;
|
|
41
|
+
member: string;
|
|
42
|
+
direction: "client-to-server" | "server-to-client";
|
|
43
|
+
kind: "channel" | "method" | "state";
|
|
44
|
+
input: boolean | object;
|
|
45
|
+
output?: boolean | object | undefined;
|
|
46
|
+
errors?: boolean | object | undefined;
|
|
47
|
+
}[];
|
|
48
|
+
dynamic: string[];
|
|
49
|
+
gaps?: string[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { apiContracts as default };
|
|
53
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineApiContract } from "@agimon-ai/doompi-core/apiContracts";
|
|
2
|
+
//#region src/schemas/apiContracts.ts
|
|
3
|
+
/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
|
+
const apiContracts = defineApiContract({
|
|
5
|
+
version: 1,
|
|
6
|
+
http: [],
|
|
7
|
+
sockets: [],
|
|
8
|
+
dynamic: []
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { apiContracts, apiContracts as default };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/doompi-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/services/hookAuthoring/index.ts
|
|
3
|
+
/** Preserve the author's inferred module type while checking the hook contract. */
|
|
4
|
+
function defineDoomHook(module) {
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.defineDoomHook = defineDoomHook;
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=authoring.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring.cjs","names":[],"sources":["../src/services/hookAuthoring/index.ts"],"sourcesContent":["import type { HookModule } from '../../types/hookModule';\n\n/** Preserve the author's inferred module type while checking the hook contract. */\nexport function defineDoomHook<T extends HookModule>(module: T): T {\n return module;\n}\n"],"mappings":";;;AAGA,SAAgB,eAAqC,QAAc;CACjE,OAAO;AACT"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as HookModule, i as HookHandlers, l as JsonValue, n as Awaitable, o as HookModuleDescriptor, r as HookContext, t as AgentSettledEvent } from "./hookModule-c2GtLnm1.mjs";
|
|
2
|
+
//#region src/services/hookAuthoring/index.d.ts
|
|
3
|
+
/** Preserve the author's inferred module type while checking the hook contract. */
|
|
4
|
+
export declare function defineDoomHook<T extends HookModule>(module: T): T;
|
|
5
|
+
//#endregion
|
|
6
|
+
export type { AgentSettledEvent, Awaitable, HookContext, HookHandlers, HookModule, HookModuleDescriptor, JsonValue };
|
|
7
|
+
//# sourceMappingURL=authoring.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring.d.mts","names":[],"sources":["../src/services/hookAuthoring/index.ts"],"mappings":";;;wBAGgB,eAAe,UAAU,YAAY,QAAQ,IAAI"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/services/hookAuthoring/index.ts
|
|
2
|
+
/** Preserve the author's inferred module type while checking the hook contract. */
|
|
3
|
+
function defineDoomHook(module) {
|
|
4
|
+
return module;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { defineDoomHook };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=authoring.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring.mjs","names":[],"sources":["../src/services/hookAuthoring/index.ts"],"sourcesContent":["import type { HookModule } from '../../types/hookModule';\n\n/** Preserve the author's inferred module type while checking the hook contract. */\nexport function defineDoomHook<T extends HookModule>(module: T): T {\n return module;\n}\n"],"mappings":";;AAGA,SAAgB,eAAqC,QAAc;CACjE,OAAO;AACT"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_doompi_core_mcpFacet = require("@agimon-ai/doompi-core/mcpFacet");
|
|
6
|
+
let _agimon_ai_doompi_core_serverFacet = require("@agimon-ai/doompi-core/serverFacet");
|
|
7
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp.ts
|
|
8
|
+
var doompi_author_hook_mcp_default = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpSkill)({
|
|
9
|
+
name: "doompi-author-hook",
|
|
10
|
+
description: "Author DoomPi repository or plugin hooks. Use when creating or changing .doom/hooks.yaml, selecting hook groups from modes.yaml, writing hook commands, or adapting Claude Code hook payloads and decisions to DoomPi.",
|
|
11
|
+
read: () => (0, _agimon_ai_doompi_core_serverFacet.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/doompi-author-hook/SKILL.md")
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region generated/mcp.ts
|
|
15
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
16
|
+
const mcp = (0, _agimon_ai_doompi_core_mcpFacet.defineMcpPlugin)({
|
|
17
|
+
name: "@agimon-ai/doompi-hook",
|
|
18
|
+
session: (context) => ({ get skills() {
|
|
19
|
+
return [at(doompi_author_hook_mcp_default, context)];
|
|
20
|
+
} })
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.default = mcp;
|
|
24
|
+
exports.mcp = mcp;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=mcp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["defineMcpSkill","readPackageResource","defineMcpPlugin","skillDoompiAuthorHook"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default defineMcpSkill({\n name: 'doompi-author-hook',\n description:\n 'Author DoomPi repository or plugin hooks. Use when creating or changing .doom/hooks.yaml, selecting hook groups from modes.yaml, writing hook commands, or adapting Claude Code hook payloads and decisions to DoomPi.',\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-author-hook/SKILL.md'),\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineMcpPlugin, type DoomMcpSessionPlugin } from '@agimon-ai/doompi-core/mcpFacet';\n\nimport skillDoompiAuthorHook from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/doompi-hook',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiAuthorHook, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;AAGA,IAAA,kCAAA,GAAeA,gCAAAA,eAAAA,CAAe;CAC5B,MAAM;CACN,aACE;CACF,aAAA,GAAYC,mCAAAA,oBAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,MAAqC,yCAAyC;AAC5F,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,OAAA,GAAMC,gCAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAyC;EAAE,OAAO,CAAC,GAAGC,gCAAuB,OAAO,CAAC;CAAG,EAC9F;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBASa,+CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineMcpPlugin, defineMcpSkill } from "@agimon-ai/doompi-core/mcpFacet";
|
|
2
|
+
import { readPackageResource } from "@agimon-ai/doompi-core/serverFacet";
|
|
3
|
+
//#region src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp.ts
|
|
4
|
+
var doompi_author_hook_mcp_default = defineMcpSkill({
|
|
5
|
+
name: "doompi-author-hook",
|
|
6
|
+
description: "Author DoomPi repository or plugin hooks. Use when creating or changing .doom/hooks.yaml, selecting hook groups from modes.yaml, writing hook commands, or adapting Claude Code hook payloads and decisions to DoomPi.",
|
|
7
|
+
read: () => readPackageResource(import.meta.url, "src/prompts/doompi-author-hook/SKILL.md")
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region generated/mcp.ts
|
|
11
|
+
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
12
|
+
const mcp = defineMcpPlugin({
|
|
13
|
+
name: "@agimon-ai/doompi-hook",
|
|
14
|
+
session: (context) => ({ get skills() {
|
|
15
|
+
return [at(doompi_author_hook_mcp_default, context)];
|
|
16
|
+
} })
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { mcp as default, mcp };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=mcp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["skillDoompiAuthorHook"],"sources":["../../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { defineMcpSkill } from '@agimon-ai/doompi-core/mcpFacet';\nimport { readPackageResource } from '@agimon-ai/doompi-core/serverFacet';\n\nexport default defineMcpSkill({\n name: 'doompi-author-hook',\n description:\n 'Author DoomPi repository or plugin hooks. Use when creating or changing .doom/hooks.yaml, selecting hook groups from modes.yaml, writing hook commands, or adapting Claude Code hook payloads and decisions to DoomPi.',\n read: () => readPackageResource(import.meta.url, 'src/prompts/doompi-author-hook/SKILL.md'),\n});\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineMcpPlugin, type DoomMcpSessionPlugin } from '@agimon-ai/doompi-core/mcpFacet';\n\nimport skillDoompiAuthorHook from '../src/extensions/workspaces/sessions/(backend)/skill/doompi-author-hook.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/doompi-hook',\n session: (context) => ({\n get skills(): DoomMcpSessionPlugin['skills'] { return [at(skillDoompiAuthorHook, context)]; },\n }) satisfies DoomMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;AAGA,IAAA,iCAAe,eAAe;CAC5B,MAAM;CACN,aACE;CACF,YAAY,oBAAoB,YAAY,KAAK,yCAAyC;AAC5F,CAAC;;;ACFD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,SAAyC;EAAE,OAAO,CAAC,GAAGA,gCAAuB,OAAO,CAAC;CAAG,EAC9F;AACF,CAAC"}
|