@agimon-ai/doompi-hook 0.0.1-alpha.35 → 0.0.1-alpha.41
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/adapters/hookDocuments.d.cts +2 -3
- package/dist/adapters/hookDocuments.d.cts.map +1 -1
- package/dist/adapters/hookDocuments.d.mts +2 -3
- package/dist/adapters/hookDocuments.d.mts.map +1 -1
- package/dist/adapters/hookRunner.d.cts +2 -3
- package/dist/adapters/hookRunner.d.cts.map +1 -1
- package/dist/adapters/hookRunner.d.mts +2 -3
- package/dist/adapters/hookRunner.d.mts.map +1 -1
- package/dist/adapters/pi/extension.d.cts +3 -3
- package/dist/adapters/pi/extension.d.cts.map +1 -1
- package/dist/adapters/pi/extension.d.mts +3 -3
- package/dist/adapters/pi/extension.d.mts.map +1 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +2 -3
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +1 -1
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +2 -3
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +1 -1
- package/dist/services/hookDecisions.d.cts +7 -8
- package/dist/services/hookDecisions.d.cts.map +1 -1
- package/dist/services/hookDecisions.d.mts +7 -8
- package/dist/services/hookDecisions.d.mts.map +1 -1
- package/dist/services/hookPayload.d.cts +2 -3
- package/dist/services/hookPayload.d.cts.map +1 -1
- package/dist/services/hookPayload.d.mts +2 -3
- package/dist/services/hookPayload.d.mts.map +1 -1
- package/dist/services/hookRegistry.d.cts +4 -5
- package/dist/services/hookRegistry.d.cts.map +1 -1
- package/dist/services/hookRegistry.d.mts +4 -5
- package/dist/services/hookRegistry.d.mts.map +1 -1
- package/dist/services/pluginHooks.d.cts +1 -2
- package/dist/services/pluginHooks.d.cts.map +1 -1
- package/dist/services/pluginHooks.d.mts +1 -2
- package/dist/services/pluginHooks.d.mts.map +1 -1
- package/dist/services/toolNames.d.cts +2 -3
- package/dist/services/toolNames.d.cts.map +1 -1
- package/dist/services/toolNames.d.mts +2 -3
- package/dist/services/toolNames.d.mts.map +1 -1
- package/dist/types/hooks.d.cts +25 -26
- package/dist/types/hooks.d.cts.map +1 -1
- package/dist/types/hooks.d.mts +25 -26
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/telemetry.d.cts +4 -5
- package/dist/types/telemetry.d.cts.map +1 -1
- package/dist/types/telemetry.d.mts +4 -5
- package/dist/types/telemetry.d.mts.map +1 -1
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HookDocumentReader } from "../types/hooks.cjs";
|
|
2
2
|
import { HookTelemetry } from "../types/telemetry.cjs";
|
|
3
3
|
//#region src/adapters/hookDocuments.d.ts
|
|
4
|
-
interface HookDocumentReaderOptions {
|
|
4
|
+
export interface HookDocumentReaderOptions {
|
|
5
5
|
telemetry?: HookTelemetry;
|
|
6
6
|
/** Where the global `.doom` directory lives. Defaults to the user's home. */
|
|
7
7
|
homeDirectory?: string;
|
|
@@ -17,7 +17,6 @@ interface HookDocumentReaderOptions {
|
|
|
17
17
|
* inside the same filesystem timestamp granularity. Both caches are keyed on
|
|
18
18
|
* contents instead, so parsing — the expensive half — is what they skip.
|
|
19
19
|
*/
|
|
20
|
-
declare function createHookDocumentReader(options?: HookDocumentReaderOptions): HookDocumentReader;
|
|
20
|
+
export declare function createHookDocumentReader(options?: HookDocumentReaderOptions): HookDocumentReader;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { HookDocumentReaderOptions, createHookDocumentReader };
|
|
23
22
|
//# sourceMappingURL=hookDocuments.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookDocuments.d.cts","names":[],"sources":["../../src/adapters/hookDocuments.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookDocuments.d.cts","names":[],"sources":["../../src/adapters/hookDocuments.ts"],"mappings":";;;iBAsBiB;EACf,YAAY;;EAEZ;EACA,YAAY,qBAAqB;EACjC,QAAQ;;;;;;;;;;;wBAoBM,yBAAyB,UAAS,4BAAiC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HookDocumentReader } from "../types/hooks.mjs";
|
|
2
2
|
import { HookTelemetry } from "../types/telemetry.mjs";
|
|
3
3
|
//#region src/adapters/hookDocuments.d.ts
|
|
4
|
-
interface HookDocumentReaderOptions {
|
|
4
|
+
export interface HookDocumentReaderOptions {
|
|
5
5
|
telemetry?: HookTelemetry;
|
|
6
6
|
/** Where the global `.doom` directory lives. Defaults to the user's home. */
|
|
7
7
|
homeDirectory?: string;
|
|
@@ -17,7 +17,6 @@ interface HookDocumentReaderOptions {
|
|
|
17
17
|
* inside the same filesystem timestamp granularity. Both caches are keyed on
|
|
18
18
|
* contents instead, so parsing — the expensive half — is what they skip.
|
|
19
19
|
*/
|
|
20
|
-
declare function createHookDocumentReader(options?: HookDocumentReaderOptions): HookDocumentReader;
|
|
20
|
+
export declare function createHookDocumentReader(options?: HookDocumentReaderOptions): HookDocumentReader;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { HookDocumentReaderOptions, createHookDocumentReader };
|
|
23
22
|
//# sourceMappingURL=hookDocuments.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookDocuments.d.mts","names":[],"sources":["../../src/adapters/hookDocuments.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookDocuments.d.mts","names":[],"sources":["../../src/adapters/hookDocuments.ts"],"mappings":";;;iBAsBiB;EACf,YAAY;;EAEZ;EACA,YAAY,qBAAqB;EACjC,QAAQ;;;;;;;;;;;wBAoBM,yBAAyB,UAAS,4BAAiC"}
|
|
@@ -2,7 +2,7 @@ import { HookRunner } from "../types/hooks.cjs";
|
|
|
2
2
|
import { HookTelemetry } from "../types/telemetry.cjs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
//#region src/adapters/hookRunner.d.ts
|
|
5
|
-
interface BashHookRunnerOptions {
|
|
5
|
+
export interface BashHookRunnerOptions {
|
|
6
6
|
telemetry?: HookTelemetry;
|
|
7
7
|
env?: NodeJS.ProcessEnv;
|
|
8
8
|
platform?: NodeJS.Platform;
|
|
@@ -16,7 +16,6 @@ interface BashHookRunnerOptions {
|
|
|
16
16
|
* group and terminated as one: a hook that starts a server and stalls should
|
|
17
17
|
* not leave the server behind when the timeout fires.
|
|
18
18
|
*/
|
|
19
|
-
declare function createBashHookRunner(options?: BashHookRunnerOptions): HookRunner;
|
|
19
|
+
export declare function createBashHookRunner(options?: BashHookRunnerOptions): HookRunner;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { BashHookRunnerOptions, createBashHookRunner };
|
|
22
21
|
//# sourceMappingURL=hookRunner.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRunner.d.cts","names":[],"sources":["../../src/adapters/hookRunner.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"hookRunner.d.cts","names":[],"sources":["../../src/adapters/hookRunner.ts"],"mappings":";;;;iBAsBiB;EACf,YAAY;EACZ,MAAM,OAAO;EACb,WAAW,OAAO;EAClB,eAAe;EACf,QAAQ;;;;;;;;;wBAcM,qBAAqB,UAAS,wBAA6B"}
|
|
@@ -2,7 +2,7 @@ import { HookRunner } from "../types/hooks.mjs";
|
|
|
2
2
|
import { HookTelemetry } from "../types/telemetry.mjs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
//#region src/adapters/hookRunner.d.ts
|
|
5
|
-
interface BashHookRunnerOptions {
|
|
5
|
+
export interface BashHookRunnerOptions {
|
|
6
6
|
telemetry?: HookTelemetry;
|
|
7
7
|
env?: NodeJS.ProcessEnv;
|
|
8
8
|
platform?: NodeJS.Platform;
|
|
@@ -16,7 +16,6 @@ interface BashHookRunnerOptions {
|
|
|
16
16
|
* group and terminated as one: a hook that starts a server and stalls should
|
|
17
17
|
* not leave the server behind when the timeout fires.
|
|
18
18
|
*/
|
|
19
|
-
declare function createBashHookRunner(options?: BashHookRunnerOptions): HookRunner;
|
|
19
|
+
export declare function createBashHookRunner(options?: BashHookRunnerOptions): HookRunner;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { BashHookRunnerOptions, createBashHookRunner };
|
|
22
21
|
//# sourceMappingURL=hookRunner.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRunner.d.mts","names":[],"sources":["../../src/adapters/hookRunner.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"hookRunner.d.mts","names":[],"sources":["../../src/adapters/hookRunner.ts"],"mappings":";;;;iBAsBiB;EACf,YAAY;EACZ,MAAM,OAAO;EACb,WAAW,OAAO;EAClB,eAAe;EACf,QAAQ;;;;;;;;;wBAcM,qBAAqB,UAAS,wBAA6B"}
|
|
@@ -2,13 +2,13 @@ import { HookDocumentReader, HookRunner } from "../../types/hooks.cjs";
|
|
|
2
2
|
import { HookTelemetry } from "../../types/telemetry.cjs";
|
|
3
3
|
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
//#region src/adapters/pi/extension.d.ts
|
|
5
|
-
interface HookExtensionOptions {
|
|
5
|
+
export interface HookExtensionOptions {
|
|
6
6
|
telemetry?: HookTelemetry;
|
|
7
7
|
runner?: HookRunner;
|
|
8
8
|
documents?: HookDocumentReader;
|
|
9
9
|
}
|
|
10
10
|
/** The package's single standard Pi factory. */
|
|
11
|
-
declare function hookExtension(pi: ExtensionAPI, options?: HookExtensionOptions): Promise<void>;
|
|
11
|
+
export declare function hookExtension(pi: ExtensionAPI, options?: HookExtensionOptions): Promise<void>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export {
|
|
13
|
+
export { hookExtension as default };
|
|
14
14
|
//# sourceMappingURL=extension.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyBiB;EACf,YAAY;EACZ,SAAS;EACT,YAAY;;;wBAuIQ,cAAc,IAAI,cAAc,UAAS,uBAA4B"}
|
|
@@ -2,13 +2,13 @@ import { HookDocumentReader, HookRunner } from "../../types/hooks.mjs";
|
|
|
2
2
|
import { HookTelemetry } from "../../types/telemetry.mjs";
|
|
3
3
|
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
//#region src/adapters/pi/extension.d.ts
|
|
5
|
-
interface HookExtensionOptions {
|
|
5
|
+
export interface HookExtensionOptions {
|
|
6
6
|
telemetry?: HookTelemetry;
|
|
7
7
|
runner?: HookRunner;
|
|
8
8
|
documents?: HookDocumentReader;
|
|
9
9
|
}
|
|
10
10
|
/** The package's single standard Pi factory. */
|
|
11
|
-
declare function hookExtension(pi: ExtensionAPI, options?: HookExtensionOptions): Promise<void>;
|
|
11
|
+
export declare function hookExtension(pi: ExtensionAPI, options?: HookExtensionOptions): Promise<void>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export {
|
|
13
|
+
export { hookExtension as default };
|
|
14
14
|
//# sourceMappingURL=extension.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyBiB;EACf,YAAY;EACZ,SAAS;EACT,YAAY;;;wBAuIQ,cAAc,IAAI,cAAc,UAAS,uBAA4B"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { HookTelemetry } from "../../types/telemetry.cjs";
|
|
2
2
|
import { DoomTelemetryOptions } from "@agimon-ai/doompi-telemetry";
|
|
3
3
|
//#region src/adapters/telemetry/logSinkTelemetry.d.ts
|
|
4
|
-
interface HookTelemetryOptions {
|
|
4
|
+
export interface HookTelemetryOptions {
|
|
5
5
|
cwd?: string;
|
|
6
6
|
workspaceRoot?: string;
|
|
7
7
|
env?: NodeJS.ProcessEnv;
|
|
8
8
|
telemetryFactory?: NonNullable<DoomTelemetryOptions['telemetryFactory']>;
|
|
9
9
|
warn?: (message: string) => void;
|
|
10
10
|
}
|
|
11
|
-
declare function createHookTelemetry(options?: HookTelemetryOptions): HookTelemetry;
|
|
11
|
+
export declare function createHookTelemetry(options?: HookTelemetryOptions): HookTelemetry;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { HookTelemetryOptions, createHookTelemetry };
|
|
14
13
|
//# sourceMappingURL=logSinkTelemetry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logSinkTelemetry.d.cts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logSinkTelemetry.d.cts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;;iBAMiB;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;wBAGM,oBAAoB,UAAS,uBAA4B"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { HookTelemetry } from "../../types/telemetry.mjs";
|
|
2
2
|
import { DoomTelemetryOptions } from "@agimon-ai/doompi-telemetry";
|
|
3
3
|
//#region src/adapters/telemetry/logSinkTelemetry.d.ts
|
|
4
|
-
interface HookTelemetryOptions {
|
|
4
|
+
export interface HookTelemetryOptions {
|
|
5
5
|
cwd?: string;
|
|
6
6
|
workspaceRoot?: string;
|
|
7
7
|
env?: NodeJS.ProcessEnv;
|
|
8
8
|
telemetryFactory?: NonNullable<DoomTelemetryOptions['telemetryFactory']>;
|
|
9
9
|
warn?: (message: string) => void;
|
|
10
10
|
}
|
|
11
|
-
declare function createHookTelemetry(options?: HookTelemetryOptions): HookTelemetry;
|
|
11
|
+
export declare function createHookTelemetry(options?: HookTelemetryOptions): HookTelemetry;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { HookTelemetryOptions, createHookTelemetry };
|
|
14
13
|
//# sourceMappingURL=logSinkTelemetry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logSinkTelemetry.d.mts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logSinkTelemetry.d.mts","names":[],"sources":["../../../src/adapters/telemetry/logSinkTelemetry.ts"],"mappings":";;;iBAMiB;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;wBAGM,oBAAoB,UAAS,uBAA4B"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { HookDecision, HookFailure, HookOutcome } from "../types/hooks.cjs";
|
|
2
2
|
//#region src/services/hookDecisions.d.ts
|
|
3
|
-
declare function decisionsFrom(outcomes: ReadonlyArray<HookOutcome>): HookDecision[];
|
|
4
|
-
declare function failuresFrom(outcomes: ReadonlyArray<HookOutcome>): HookFailure[];
|
|
3
|
+
export declare function decisionsFrom(outcomes: ReadonlyArray<HookOutcome>): HookDecision[];
|
|
4
|
+
export declare function failuresFrom(outcomes: ReadonlyArray<HookOutcome>): HookFailure[];
|
|
5
5
|
/** Both spellings a hook may use to refuse the call it observed. */
|
|
6
|
-
declare function isDenied(decision: HookDecision | undefined): boolean;
|
|
7
|
-
declare function decisionReason(decision: HookDecision | undefined): string | undefined;
|
|
6
|
+
export declare function isDenied(decision: HookDecision | undefined): boolean;
|
|
7
|
+
export declare function decisionReason(decision: HookDecision | undefined): string | undefined;
|
|
8
8
|
/** Context a hook wants added to the conversation rather than used to block. */
|
|
9
|
-
declare function additionalContextsFrom(decisions: ReadonlyArray<HookDecision>): string[];
|
|
9
|
+
export declare function additionalContextsFrom(decisions: ReadonlyArray<HookDecision>): string[];
|
|
10
10
|
/** What a post-tool hook has to say, whichever field it said it in. */
|
|
11
|
-
declare function toolResultMessages(decisions: ReadonlyArray<HookDecision>): string[];
|
|
11
|
+
export declare function toolResultMessages(decisions: ReadonlyArray<HookDecision>): string[];
|
|
12
12
|
/**
|
|
13
13
|
* A guardrail that never ran looks exactly like one that passed, so the agent is
|
|
14
14
|
* told which checks were missed and what its options are.
|
|
15
15
|
*/
|
|
16
|
-
declare function hookFailureMessage(failures: ReadonlyArray<HookFailure>): string;
|
|
16
|
+
export declare function hookFailureMessage(failures: ReadonlyArray<HookFailure>): string;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { additionalContextsFrom, decisionReason, decisionsFrom, failuresFrom, hookFailureMessage, isDenied, toolResultMessages };
|
|
19
18
|
//# sourceMappingURL=hookDecisions.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookDecisions.d.cts","names":[],"sources":["../../src/services/hookDecisions.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"hookDecisions.d.cts","names":[],"sources":["../../src/services/hookDecisions.ts"],"mappings":";;wBAKgB,cAAc,UAAU,cAAc,eAAe;wBAIrD,aAAa,UAAU,cAAc,eAAe;;wBAKpD,SAAS,UAAU;wBAInB,eAAe,UAAU;;wBAKzB,uBAAuB,WAAW,cAAc;;wBAOhD,mBAAmB,WAAW,cAAc;;;;;wBAU5C,mBAAmB,UAAU,cAAc"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { HookDecision, HookFailure, HookOutcome } from "../types/hooks.mjs";
|
|
2
2
|
//#region src/services/hookDecisions.d.ts
|
|
3
|
-
declare function decisionsFrom(outcomes: ReadonlyArray<HookOutcome>): HookDecision[];
|
|
4
|
-
declare function failuresFrom(outcomes: ReadonlyArray<HookOutcome>): HookFailure[];
|
|
3
|
+
export declare function decisionsFrom(outcomes: ReadonlyArray<HookOutcome>): HookDecision[];
|
|
4
|
+
export declare function failuresFrom(outcomes: ReadonlyArray<HookOutcome>): HookFailure[];
|
|
5
5
|
/** Both spellings a hook may use to refuse the call it observed. */
|
|
6
|
-
declare function isDenied(decision: HookDecision | undefined): boolean;
|
|
7
|
-
declare function decisionReason(decision: HookDecision | undefined): string | undefined;
|
|
6
|
+
export declare function isDenied(decision: HookDecision | undefined): boolean;
|
|
7
|
+
export declare function decisionReason(decision: HookDecision | undefined): string | undefined;
|
|
8
8
|
/** Context a hook wants added to the conversation rather than used to block. */
|
|
9
|
-
declare function additionalContextsFrom(decisions: ReadonlyArray<HookDecision>): string[];
|
|
9
|
+
export declare function additionalContextsFrom(decisions: ReadonlyArray<HookDecision>): string[];
|
|
10
10
|
/** What a post-tool hook has to say, whichever field it said it in. */
|
|
11
|
-
declare function toolResultMessages(decisions: ReadonlyArray<HookDecision>): string[];
|
|
11
|
+
export declare function toolResultMessages(decisions: ReadonlyArray<HookDecision>): string[];
|
|
12
12
|
/**
|
|
13
13
|
* A guardrail that never ran looks exactly like one that passed, so the agent is
|
|
14
14
|
* told which checks were missed and what its options are.
|
|
15
15
|
*/
|
|
16
|
-
declare function hookFailureMessage(failures: ReadonlyArray<HookFailure>): string;
|
|
16
|
+
export declare function hookFailureMessage(failures: ReadonlyArray<HookFailure>): string;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { additionalContextsFrom, decisionReason, decisionsFrom, failuresFrom, hookFailureMessage, isDenied, toolResultMessages };
|
|
19
18
|
//# sourceMappingURL=hookDecisions.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookDecisions.d.mts","names":[],"sources":["../../src/services/hookDecisions.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"hookDecisions.d.mts","names":[],"sources":["../../src/services/hookDecisions.ts"],"mappings":";;wBAKgB,cAAc,UAAU,cAAc,eAAe;wBAIrD,aAAa,UAAU,cAAc,eAAe;;wBAKpD,SAAS,UAAU;wBAInB,eAAe,UAAU;;wBAKzB,uBAAuB,WAAW,cAAc;;wBAOhD,mBAAmB,WAAW,cAAc;;;;;wBAU5C,mBAAmB,UAAU,cAAc"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { HookPayload, HookToolEvent } from "../types/hooks.cjs";
|
|
2
2
|
//#region src/services/hookPayload.d.ts
|
|
3
3
|
/** The payload shape a Claude Code session hook is written against. */
|
|
4
|
-
declare function toolHookPayload(event: HookToolEvent, hookEventName: string, repoRoot: string, sessionId: string): HookPayload;
|
|
4
|
+
export declare function toolHookPayload(event: HookToolEvent, hookEventName: string, repoRoot: string, sessionId: string): HookPayload;
|
|
5
5
|
/** Session lifecycle hooks observe no tool, so they only need where and who. */
|
|
6
|
-
declare function sessionHookPayload(sessionId: string, repoRoot: string): HookPayload;
|
|
6
|
+
export declare function sessionHookPayload(sessionId: string, repoRoot: string): HookPayload;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { sessionHookPayload, toolHookPayload };
|
|
9
8
|
//# sourceMappingURL=hookPayload.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookPayload.d.cts","names":[],"sources":["../../src/services/hookPayload.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookPayload.d.cts","names":[],"sources":["../../src/services/hookPayload.ts"],"mappings":";;;wBAMgB,gBACd,OAAO,eACP,uBACA,kBACA,oBACC;;wBAaa,mBAAmB,mBAAmB,mBAAmB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { HookPayload, HookToolEvent } from "../types/hooks.mjs";
|
|
2
2
|
//#region src/services/hookPayload.d.ts
|
|
3
3
|
/** The payload shape a Claude Code session hook is written against. */
|
|
4
|
-
declare function toolHookPayload(event: HookToolEvent, hookEventName: string, repoRoot: string, sessionId: string): HookPayload;
|
|
4
|
+
export declare function toolHookPayload(event: HookToolEvent, hookEventName: string, repoRoot: string, sessionId: string): HookPayload;
|
|
5
5
|
/** Session lifecycle hooks observe no tool, so they only need where and who. */
|
|
6
|
-
declare function sessionHookPayload(sessionId: string, repoRoot: string): HookPayload;
|
|
6
|
+
export declare function sessionHookPayload(sessionId: string, repoRoot: string): HookPayload;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { sessionHookPayload, toolHookPayload };
|
|
9
8
|
//# sourceMappingURL=hookPayload.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookPayload.d.mts","names":[],"sources":["../../src/services/hookPayload.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookPayload.d.mts","names":[],"sources":["../../src/services/hookPayload.ts"],"mappings":";;;wBAMgB,gBACd,OAAO,eACP,uBACA,kBACA,oBACC;;wBAaa,mBAAmB,mBAAmB,mBAAmB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HookDocumentSource, ParsedRegistrySource, RegistryEntry, ResolvedHook } from "../types/hooks.cjs";
|
|
2
2
|
//#region src/services/hookRegistry.d.ts
|
|
3
3
|
/** Which rows a dispatch keeps, once the session's selection is known. */
|
|
4
|
-
interface RegistrySelection {
|
|
4
|
+
export interface RegistrySelection {
|
|
5
5
|
event: string;
|
|
6
6
|
toolName?: string;
|
|
7
7
|
/** Selected group ids, or undefined for "every group", the standalone default. */
|
|
@@ -15,7 +15,7 @@ interface RegistrySelection {
|
|
|
15
15
|
* rewrite and needs no invalidation hook. Reading both files is cheap; parsing
|
|
16
16
|
* is what a cache built on this skips.
|
|
17
17
|
*/
|
|
18
|
-
declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): string;
|
|
18
|
+
export declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): string;
|
|
19
19
|
/**
|
|
20
20
|
* Flattens parsed registry documents into sorted rows, keeping only bindings
|
|
21
21
|
* that declare a `pi` frontend.
|
|
@@ -23,7 +23,7 @@ declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): s
|
|
|
23
23
|
* A later source replaces the group of the same id outright rather than merging
|
|
24
24
|
* into it, so a repository that redefines a group owns it completely.
|
|
25
25
|
*/
|
|
26
|
-
declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>): RegistryEntry[];
|
|
26
|
+
export declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>): RegistryEntry[];
|
|
27
27
|
/**
|
|
28
28
|
* The rows one dispatch runs.
|
|
29
29
|
*
|
|
@@ -31,7 +31,6 @@ declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>):
|
|
|
31
31
|
* applied per call rather than being baked into a cached parse. Core groups
|
|
32
32
|
* always load; the rest are gated by the layers the harness resolved.
|
|
33
33
|
*/
|
|
34
|
-
declare function selectRegistryHooks(entries: ReadonlyArray<RegistryEntry>, selection: RegistrySelection): ResolvedHook[];
|
|
34
|
+
export declare function selectRegistryHooks(entries: ReadonlyArray<RegistryEntry>, selection: RegistrySelection): ResolvedHook[];
|
|
35
35
|
//#endregion
|
|
36
|
-
export { RegistrySelection, registryCacheKey, registryEntries, selectRegistryHooks };
|
|
37
36
|
//# sourceMappingURL=hookRegistry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRegistry.d.cts","names":[],"sources":["../../src/services/hookRegistry.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookRegistry.d.cts","names":[],"sources":["../../src/services/hookRegistry.ts"],"mappings":";;;iBAIiB;EACf;EACA;;EAEA;EACA;;;;;;;;;wBAUc,iBAAiB,SAAS,cAAc;;;;;;;;wBAWxC,gBAAgB,SAAS,cAAc,wBAAwB;;;;;;;;wBAqC/D,oBACd,SAAS,cAAc,gBACvB,WAAW,oBACV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HookDocumentSource, ParsedRegistrySource, RegistryEntry, ResolvedHook } from "../types/hooks.mjs";
|
|
2
2
|
//#region src/services/hookRegistry.d.ts
|
|
3
3
|
/** Which rows a dispatch keeps, once the session's selection is known. */
|
|
4
|
-
interface RegistrySelection {
|
|
4
|
+
export interface RegistrySelection {
|
|
5
5
|
event: string;
|
|
6
6
|
toolName?: string;
|
|
7
7
|
/** Selected group ids, or undefined for "every group", the standalone default. */
|
|
@@ -15,7 +15,7 @@ interface RegistrySelection {
|
|
|
15
15
|
* rewrite and needs no invalidation hook. Reading both files is cheap; parsing
|
|
16
16
|
* is what a cache built on this skips.
|
|
17
17
|
*/
|
|
18
|
-
declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): string;
|
|
18
|
+
export declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): string;
|
|
19
19
|
/**
|
|
20
20
|
* Flattens parsed registry documents into sorted rows, keeping only bindings
|
|
21
21
|
* that declare a `pi` frontend.
|
|
@@ -23,7 +23,7 @@ declare function registryCacheKey(sources: ReadonlyArray<HookDocumentSource>): s
|
|
|
23
23
|
* A later source replaces the group of the same id outright rather than merging
|
|
24
24
|
* into it, so a repository that redefines a group owns it completely.
|
|
25
25
|
*/
|
|
26
|
-
declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>): RegistryEntry[];
|
|
26
|
+
export declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>): RegistryEntry[];
|
|
27
27
|
/**
|
|
28
28
|
* The rows one dispatch runs.
|
|
29
29
|
*
|
|
@@ -31,7 +31,6 @@ declare function registryEntries(sources: ReadonlyArray<ParsedRegistrySource>):
|
|
|
31
31
|
* applied per call rather than being baked into a cached parse. Core groups
|
|
32
32
|
* always load; the rest are gated by the layers the harness resolved.
|
|
33
33
|
*/
|
|
34
|
-
declare function selectRegistryHooks(entries: ReadonlyArray<RegistryEntry>, selection: RegistrySelection): ResolvedHook[];
|
|
34
|
+
export declare function selectRegistryHooks(entries: ReadonlyArray<RegistryEntry>, selection: RegistrySelection): ResolvedHook[];
|
|
35
35
|
//#endregion
|
|
36
|
-
export { RegistrySelection, registryCacheKey, registryEntries, selectRegistryHooks };
|
|
37
36
|
//# sourceMappingURL=hookRegistry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRegistry.d.mts","names":[],"sources":["../../src/services/hookRegistry.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hookRegistry.d.mts","names":[],"sources":["../../src/services/hookRegistry.ts"],"mappings":";;;iBAIiB;EACf;EACA;;EAEA;EACA;;;;;;;;;wBAUc,iBAAiB,SAAS,cAAc;;;;;;;;wBAWxC,gBAAgB,SAAS,cAAc,wBAAwB;;;;;;;;wBAqC/D,oBACd,SAAS,cAAc,gBACvB,WAAW,oBACV"}
|
|
@@ -7,7 +7,6 @@ import { PluginHookDocument, ResolvedHook } from "../types/hooks.cjs";
|
|
|
7
7
|
* maps to groups, each with an optional matcher and a list of commands. Order
|
|
8
8
|
* follows the declaration order of the plugins the harness resolved.
|
|
9
9
|
*/
|
|
10
|
-
declare function selectPluginHooks(documents: ReadonlyArray<PluginHookDocument>, eventName: string, toolName?: string): ResolvedHook[];
|
|
10
|
+
export declare function selectPluginHooks(documents: ReadonlyArray<PluginHookDocument>, eventName: string, toolName?: string): ResolvedHook[];
|
|
11
11
|
//#endregion
|
|
12
|
-
export { selectPluginHooks };
|
|
13
12
|
//# sourceMappingURL=pluginHooks.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginHooks.d.cts","names":[],"sources":["../../src/services/pluginHooks.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pluginHooks.d.cts","names":[],"sources":["../../src/services/pluginHooks.ts"],"mappings":";;;;;;;;;wBAUgB,kBACd,WAAW,cAAc,qBACzB,mBACA,oBACC"}
|
|
@@ -7,7 +7,6 @@ import { PluginHookDocument, ResolvedHook } from "../types/hooks.mjs";
|
|
|
7
7
|
* maps to groups, each with an optional matcher and a list of commands. Order
|
|
8
8
|
* follows the declaration order of the plugins the harness resolved.
|
|
9
9
|
*/
|
|
10
|
-
declare function selectPluginHooks(documents: ReadonlyArray<PluginHookDocument>, eventName: string, toolName?: string): ResolvedHook[];
|
|
10
|
+
export declare function selectPluginHooks(documents: ReadonlyArray<PluginHookDocument>, eventName: string, toolName?: string): ResolvedHook[];
|
|
11
11
|
//#endregion
|
|
12
|
-
export { selectPluginHooks };
|
|
13
12
|
//# sourceMappingURL=pluginHooks.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginHooks.d.mts","names":[],"sources":["../../src/services/pluginHooks.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pluginHooks.d.mts","names":[],"sources":["../../src/services/pluginHooks.ts"],"mappings":";;;;;;;;;wBAUgB,kBACd,WAAW,cAAc,qBACzB,mBACA,oBACC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/services/toolNames.d.ts
|
|
2
2
|
/** The Claude name a hook matcher expects for a tool Pi just ran. */
|
|
3
|
-
declare function toClaudeToolName(tool: string): string;
|
|
3
|
+
export declare function toClaudeToolName(tool: string): string;
|
|
4
4
|
/** Whether a matcher, if the row declares one, accepts the tool that fired. */
|
|
5
|
-
declare function matchesTool(matcher: string | undefined, toolName: string | undefined): boolean;
|
|
5
|
+
export declare function matchesTool(matcher: string | undefined, toolName: string | undefined): boolean;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { matchesTool, toClaudeToolName };
|
|
8
7
|
//# sourceMappingURL=toolNames.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolNames.d.cts","names":[],"sources":["../../src/services/toolNames.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"toolNames.d.cts","names":[],"sources":["../../src/services/toolNames.ts"],"mappings":";;wBAmBgB,iBAAiB;;wBAKjB,YAAY,6BAA6B"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/services/toolNames.d.ts
|
|
2
2
|
/** The Claude name a hook matcher expects for a tool Pi just ran. */
|
|
3
|
-
declare function toClaudeToolName(tool: string): string;
|
|
3
|
+
export declare function toClaudeToolName(tool: string): string;
|
|
4
4
|
/** Whether a matcher, if the row declares one, accepts the tool that fired. */
|
|
5
|
-
declare function matchesTool(matcher: string | undefined, toolName: string | undefined): boolean;
|
|
5
|
+
export declare function matchesTool(matcher: string | undefined, toolName: string | undefined): boolean;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { matchesTool, toClaudeToolName };
|
|
8
7
|
//# sourceMappingURL=toolNames.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolNames.d.mts","names":[],"sources":["../../src/services/toolNames.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"toolNames.d.mts","names":[],"sources":["../../src/services/toolNames.ts"],"mappings":";;wBAmBgB,iBAAiB;;wBAKjB,YAAY,6BAA6B"}
|
package/dist/types/hooks.d.cts
CHANGED
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
* translation onto Pi's lifecycle happens at the adapter boundary.
|
|
8
8
|
*/
|
|
9
9
|
/** Registry event names. Each is used twice per dispatch, so drift would be silent. */
|
|
10
|
-
declare const HOOK_EVENT: {
|
|
10
|
+
export declare const HOOK_EVENT: {
|
|
11
11
|
readonly sessionStart: 'SessionStart';
|
|
12
12
|
readonly preToolUse: 'PreToolUse';
|
|
13
13
|
readonly postToolUse: 'PostToolUse';
|
|
14
14
|
readonly stop: 'Stop';
|
|
15
15
|
readonly sessionEnd: 'SessionEnd';
|
|
16
16
|
};
|
|
17
|
-
type HookEventName = (typeof HOOK_EVENT)[keyof typeof HOOK_EVENT];
|
|
18
|
-
interface HookCommand {
|
|
17
|
+
export type HookEventName = (typeof HOOK_EVENT)[keyof typeof HOOK_EVENT];
|
|
18
|
+
export interface HookCommand {
|
|
19
19
|
command: string;
|
|
20
20
|
/** Seconds before the hook is terminated. Defaults to DEFAULT_HOOK_TIMEOUT_SECONDS. */
|
|
21
21
|
timeout?: number;
|
|
22
22
|
}
|
|
23
23
|
/** What one registry row declares for the `pi` frontend. */
|
|
24
|
-
interface RegistryBinding {
|
|
24
|
+
export interface RegistryBinding {
|
|
25
25
|
matcher?: string;
|
|
26
26
|
command: string;
|
|
27
27
|
timeout?: number;
|
|
@@ -29,7 +29,7 @@ interface RegistryBinding {
|
|
|
29
29
|
order?: number;
|
|
30
30
|
}
|
|
31
31
|
/** A registry row plus the group membership used to include or drop it. */
|
|
32
|
-
interface RegistryEntry extends RegistryBinding {
|
|
32
|
+
export interface RegistryEntry extends RegistryBinding {
|
|
33
33
|
event: string;
|
|
34
34
|
order: number;
|
|
35
35
|
/** Declaration order across every source, used as the sort tiebreaker. */
|
|
@@ -39,45 +39,45 @@ interface RegistryEntry extends RegistryBinding {
|
|
|
39
39
|
/** Root of the config that declared the group, exported as CLAUDE_PLUGIN_ROOT. */
|
|
40
40
|
baseDirectory: string;
|
|
41
41
|
}
|
|
42
|
-
interface RegistryGroup {
|
|
42
|
+
export interface RegistryGroup {
|
|
43
43
|
core?: boolean;
|
|
44
44
|
hooks?: Array<{
|
|
45
45
|
event: string;
|
|
46
46
|
pi?: RegistryBinding;
|
|
47
47
|
}>;
|
|
48
48
|
}
|
|
49
|
-
interface RegistryDocument {
|
|
49
|
+
export interface RegistryDocument {
|
|
50
50
|
groups?: Record<string, RegistryGroup>;
|
|
51
51
|
}
|
|
52
52
|
/** One `.doom/hooks.yaml` as read from disk, before it is parsed. */
|
|
53
|
-
interface HookDocumentSource {
|
|
53
|
+
export interface HookDocumentSource {
|
|
54
54
|
baseDirectory: string;
|
|
55
55
|
text: string;
|
|
56
56
|
}
|
|
57
57
|
/** One `.doom/hooks.yaml` after parsing, tagged with the root that declared it. */
|
|
58
|
-
interface ParsedRegistrySource {
|
|
58
|
+
export interface ParsedRegistrySource {
|
|
59
59
|
baseDirectory: string;
|
|
60
60
|
document: RegistryDocument;
|
|
61
61
|
}
|
|
62
|
-
interface PluginHookGroup {
|
|
62
|
+
export interface PluginHookGroup {
|
|
63
63
|
matcher?: string;
|
|
64
64
|
hooks?: HookCommand[];
|
|
65
65
|
}
|
|
66
|
-
interface PluginHookConfig {
|
|
66
|
+
export interface PluginHookConfig {
|
|
67
67
|
hooks?: Record<string, PluginHookGroup[]>;
|
|
68
68
|
}
|
|
69
69
|
/** A parsed plugin config plus the root exported to its commands. */
|
|
70
|
-
interface PluginHookDocument {
|
|
70
|
+
export interface PluginHookDocument {
|
|
71
71
|
pluginRoot: string;
|
|
72
72
|
config: PluginHookConfig;
|
|
73
73
|
}
|
|
74
74
|
/** A hook command paired with the config root it runs against. */
|
|
75
|
-
interface ResolvedHook {
|
|
75
|
+
export interface ResolvedHook {
|
|
76
76
|
hook: HookCommand;
|
|
77
77
|
root: string;
|
|
78
78
|
}
|
|
79
79
|
/** The JSON a hook may write on stdout to steer or block the call it observed. */
|
|
80
|
-
interface HookDecision {
|
|
80
|
+
export interface HookDecision {
|
|
81
81
|
decision?: string;
|
|
82
82
|
reason?: string;
|
|
83
83
|
hookSpecificOutput?: {
|
|
@@ -86,13 +86,13 @@ interface HookDecision {
|
|
|
86
86
|
additionalContext?: string;
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
type HookFailureReason = 'spawn_failed' | 'non_zero_exit' | 'timeout' | 'invalid_json' | 'registry_read' | 'plugin_config';
|
|
90
|
-
interface HookFailure {
|
|
89
|
+
export type HookFailureReason = 'spawn_failed' | 'non_zero_exit' | 'timeout' | 'invalid_json' | 'registry_read' | 'plugin_config';
|
|
90
|
+
export interface HookFailure {
|
|
91
91
|
command: string;
|
|
92
92
|
message: string;
|
|
93
93
|
reason: HookFailureReason;
|
|
94
94
|
}
|
|
95
|
-
interface HookOutcome {
|
|
95
|
+
export interface HookOutcome {
|
|
96
96
|
decision?: HookDecision;
|
|
97
97
|
failure?: HookFailure;
|
|
98
98
|
}
|
|
@@ -102,7 +102,7 @@ interface HookOutcome {
|
|
|
102
102
|
* Pi's ToolCallEvent and ToolResultEvent both satisfy this structurally, so the
|
|
103
103
|
* adapter forwards them unchanged and the payload builder stays host-neutral.
|
|
104
104
|
*/
|
|
105
|
-
interface HookToolEvent {
|
|
105
|
+
export interface HookToolEvent {
|
|
106
106
|
readonly type: string;
|
|
107
107
|
readonly toolName: string;
|
|
108
108
|
readonly input: unknown;
|
|
@@ -110,36 +110,35 @@ interface HookToolEvent {
|
|
|
110
110
|
readonly isError?: boolean;
|
|
111
111
|
}
|
|
112
112
|
/** The JSON document handed to a hook on stdin. */
|
|
113
|
-
type HookPayload = Record<string, unknown>;
|
|
114
|
-
interface HookRunOptions {
|
|
113
|
+
export type HookPayload = Record<string, unknown>;
|
|
114
|
+
export interface HookRunOptions {
|
|
115
115
|
repoRoot: string;
|
|
116
116
|
/** Exported as CLAUDE_PLUGIN_ROOT so a hook can reach its own scripts. */
|
|
117
117
|
pluginRoot?: string;
|
|
118
118
|
}
|
|
119
119
|
/** Runs one hook command and reports what it decided or how it failed. */
|
|
120
|
-
interface HookRunner {
|
|
120
|
+
export interface HookRunner {
|
|
121
121
|
run(hook: HookCommand, payload: HookPayload, options: HookRunOptions): Promise<HookOutcome>;
|
|
122
122
|
}
|
|
123
123
|
/** Registry rows for this repository, or the failure that emptied them. */
|
|
124
|
-
interface RegistryRead {
|
|
124
|
+
export interface RegistryRead {
|
|
125
125
|
entries: RegistryEntry[];
|
|
126
126
|
failure?: HookFailure;
|
|
127
127
|
}
|
|
128
128
|
/** Plugin configs that could be read, and one failure per config that could not. */
|
|
129
|
-
interface PluginDocumentRead {
|
|
129
|
+
export interface PluginDocumentRead {
|
|
130
130
|
documents: PluginHookDocument[];
|
|
131
131
|
failures: HookFailure[];
|
|
132
132
|
}
|
|
133
133
|
/** Where a plugin declares its hooks. Mirrors the harness state entry. */
|
|
134
|
-
interface PluginHookSourceRef {
|
|
134
|
+
export interface PluginHookSourceRef {
|
|
135
135
|
readonly pluginRoot: string;
|
|
136
136
|
readonly configPath: string;
|
|
137
137
|
}
|
|
138
138
|
/** Reads the hook documents a session runs from. */
|
|
139
|
-
interface HookDocumentReader {
|
|
139
|
+
export interface HookDocumentReader {
|
|
140
140
|
registry(repoRoot: string): Promise<RegistryRead>;
|
|
141
141
|
plugins(sources: readonly PluginHookSourceRef[]): Promise<PluginDocumentRead>;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
|
-
export { HOOK_EVENT, HookCommand, HookDecision, HookDocumentReader, HookDocumentSource, HookEventName, HookFailure, HookFailureReason, HookOutcome, HookPayload, HookRunOptions, HookRunner, HookToolEvent, ParsedRegistrySource, PluginDocumentRead, PluginHookConfig, PluginHookDocument, PluginHookGroup, PluginHookSourceRef, RegistryBinding, RegistryDocument, RegistryEntry, RegistryGroup, RegistryRead, ResolvedHook };
|
|
145
144
|
//# sourceMappingURL=hooks.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.cts","names":[],"sources":["../../src/types/hooks.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hooks.d.cts","names":[],"sources":["../../src/types/hooks.ts"],"mappings":";;;;;;;;;qBASa;WACX;WACA;WACA;WACA;WACA;;YAGU,wBAAwB,yBAAyB;iBAE5C;EACf;;EAEA;;;iBAIe;EACf;EACA;EACA;EACA;EACA;;;iBAIe,sBAAsB;EACrC;EACA;;EAEA;EACA;EACA;;EAEA;;iBAGe;EACf;EACA,QAAQ;IAAQ;IAAe,KAAK;;;iBAGrB;EACf,SAAS,eAAe;;;iBAIT;EACf;EACA;;;iBAIe;EACf;EACA,UAAU;;iBAGK;EACf;EACA,QAAQ;;iBAGO;EACf,QAAQ,eAAe;;;iBAIR;EACf;EACA,QAAQ;;;iBAIO;EACf,MAAM;EACN;;;iBAIe;EACf;EACA;EACA;IACE;IACA;IACA;;;YAIQ;iBAQK;EACf;EACA;EACA,QAAQ;;iBAGO;EACf,WAAW;EACX,UAAU;;;;;;;;iBASK;WACN;WACA;WACA;WACA;WACA;;;YAIC,cAAc;iBAET;EACf;;EAEA;;;iBAIe;EACf,IAAI,MAAM,aAAa,SAAS,aAAa,SAAS,iBAAiB,QAAQ;;;iBAIhE;EACf,SAAS;EACT,UAAU;;;iBAIK;EACf,WAAW;EACX,UAAU;;;iBAIK;WACN;WACA;;;iBAIM;EACf,SAAS,mBAAmB,QAAQ;EACpC,QAAQ,kBAAkB,wBAAwB,QAAQ"}
|
package/dist/types/hooks.d.mts
CHANGED
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
* translation onto Pi's lifecycle happens at the adapter boundary.
|
|
8
8
|
*/
|
|
9
9
|
/** Registry event names. Each is used twice per dispatch, so drift would be silent. */
|
|
10
|
-
declare const HOOK_EVENT: {
|
|
10
|
+
export declare const HOOK_EVENT: {
|
|
11
11
|
readonly sessionStart: 'SessionStart';
|
|
12
12
|
readonly preToolUse: 'PreToolUse';
|
|
13
13
|
readonly postToolUse: 'PostToolUse';
|
|
14
14
|
readonly stop: 'Stop';
|
|
15
15
|
readonly sessionEnd: 'SessionEnd';
|
|
16
16
|
};
|
|
17
|
-
type HookEventName = (typeof HOOK_EVENT)[keyof typeof HOOK_EVENT];
|
|
18
|
-
interface HookCommand {
|
|
17
|
+
export type HookEventName = (typeof HOOK_EVENT)[keyof typeof HOOK_EVENT];
|
|
18
|
+
export interface HookCommand {
|
|
19
19
|
command: string;
|
|
20
20
|
/** Seconds before the hook is terminated. Defaults to DEFAULT_HOOK_TIMEOUT_SECONDS. */
|
|
21
21
|
timeout?: number;
|
|
22
22
|
}
|
|
23
23
|
/** What one registry row declares for the `pi` frontend. */
|
|
24
|
-
interface RegistryBinding {
|
|
24
|
+
export interface RegistryBinding {
|
|
25
25
|
matcher?: string;
|
|
26
26
|
command: string;
|
|
27
27
|
timeout?: number;
|
|
@@ -29,7 +29,7 @@ interface RegistryBinding {
|
|
|
29
29
|
order?: number;
|
|
30
30
|
}
|
|
31
31
|
/** A registry row plus the group membership used to include or drop it. */
|
|
32
|
-
interface RegistryEntry extends RegistryBinding {
|
|
32
|
+
export interface RegistryEntry extends RegistryBinding {
|
|
33
33
|
event: string;
|
|
34
34
|
order: number;
|
|
35
35
|
/** Declaration order across every source, used as the sort tiebreaker. */
|
|
@@ -39,45 +39,45 @@ interface RegistryEntry extends RegistryBinding {
|
|
|
39
39
|
/** Root of the config that declared the group, exported as CLAUDE_PLUGIN_ROOT. */
|
|
40
40
|
baseDirectory: string;
|
|
41
41
|
}
|
|
42
|
-
interface RegistryGroup {
|
|
42
|
+
export interface RegistryGroup {
|
|
43
43
|
core?: boolean;
|
|
44
44
|
hooks?: Array<{
|
|
45
45
|
event: string;
|
|
46
46
|
pi?: RegistryBinding;
|
|
47
47
|
}>;
|
|
48
48
|
}
|
|
49
|
-
interface RegistryDocument {
|
|
49
|
+
export interface RegistryDocument {
|
|
50
50
|
groups?: Record<string, RegistryGroup>;
|
|
51
51
|
}
|
|
52
52
|
/** One `.doom/hooks.yaml` as read from disk, before it is parsed. */
|
|
53
|
-
interface HookDocumentSource {
|
|
53
|
+
export interface HookDocumentSource {
|
|
54
54
|
baseDirectory: string;
|
|
55
55
|
text: string;
|
|
56
56
|
}
|
|
57
57
|
/** One `.doom/hooks.yaml` after parsing, tagged with the root that declared it. */
|
|
58
|
-
interface ParsedRegistrySource {
|
|
58
|
+
export interface ParsedRegistrySource {
|
|
59
59
|
baseDirectory: string;
|
|
60
60
|
document: RegistryDocument;
|
|
61
61
|
}
|
|
62
|
-
interface PluginHookGroup {
|
|
62
|
+
export interface PluginHookGroup {
|
|
63
63
|
matcher?: string;
|
|
64
64
|
hooks?: HookCommand[];
|
|
65
65
|
}
|
|
66
|
-
interface PluginHookConfig {
|
|
66
|
+
export interface PluginHookConfig {
|
|
67
67
|
hooks?: Record<string, PluginHookGroup[]>;
|
|
68
68
|
}
|
|
69
69
|
/** A parsed plugin config plus the root exported to its commands. */
|
|
70
|
-
interface PluginHookDocument {
|
|
70
|
+
export interface PluginHookDocument {
|
|
71
71
|
pluginRoot: string;
|
|
72
72
|
config: PluginHookConfig;
|
|
73
73
|
}
|
|
74
74
|
/** A hook command paired with the config root it runs against. */
|
|
75
|
-
interface ResolvedHook {
|
|
75
|
+
export interface ResolvedHook {
|
|
76
76
|
hook: HookCommand;
|
|
77
77
|
root: string;
|
|
78
78
|
}
|
|
79
79
|
/** The JSON a hook may write on stdout to steer or block the call it observed. */
|
|
80
|
-
interface HookDecision {
|
|
80
|
+
export interface HookDecision {
|
|
81
81
|
decision?: string;
|
|
82
82
|
reason?: string;
|
|
83
83
|
hookSpecificOutput?: {
|
|
@@ -86,13 +86,13 @@ interface HookDecision {
|
|
|
86
86
|
additionalContext?: string;
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
type HookFailureReason = 'spawn_failed' | 'non_zero_exit' | 'timeout' | 'invalid_json' | 'registry_read' | 'plugin_config';
|
|
90
|
-
interface HookFailure {
|
|
89
|
+
export type HookFailureReason = 'spawn_failed' | 'non_zero_exit' | 'timeout' | 'invalid_json' | 'registry_read' | 'plugin_config';
|
|
90
|
+
export interface HookFailure {
|
|
91
91
|
command: string;
|
|
92
92
|
message: string;
|
|
93
93
|
reason: HookFailureReason;
|
|
94
94
|
}
|
|
95
|
-
interface HookOutcome {
|
|
95
|
+
export interface HookOutcome {
|
|
96
96
|
decision?: HookDecision;
|
|
97
97
|
failure?: HookFailure;
|
|
98
98
|
}
|
|
@@ -102,7 +102,7 @@ interface HookOutcome {
|
|
|
102
102
|
* Pi's ToolCallEvent and ToolResultEvent both satisfy this structurally, so the
|
|
103
103
|
* adapter forwards them unchanged and the payload builder stays host-neutral.
|
|
104
104
|
*/
|
|
105
|
-
interface HookToolEvent {
|
|
105
|
+
export interface HookToolEvent {
|
|
106
106
|
readonly type: string;
|
|
107
107
|
readonly toolName: string;
|
|
108
108
|
readonly input: unknown;
|
|
@@ -110,36 +110,35 @@ interface HookToolEvent {
|
|
|
110
110
|
readonly isError?: boolean;
|
|
111
111
|
}
|
|
112
112
|
/** The JSON document handed to a hook on stdin. */
|
|
113
|
-
type HookPayload = Record<string, unknown>;
|
|
114
|
-
interface HookRunOptions {
|
|
113
|
+
export type HookPayload = Record<string, unknown>;
|
|
114
|
+
export interface HookRunOptions {
|
|
115
115
|
repoRoot: string;
|
|
116
116
|
/** Exported as CLAUDE_PLUGIN_ROOT so a hook can reach its own scripts. */
|
|
117
117
|
pluginRoot?: string;
|
|
118
118
|
}
|
|
119
119
|
/** Runs one hook command and reports what it decided or how it failed. */
|
|
120
|
-
interface HookRunner {
|
|
120
|
+
export interface HookRunner {
|
|
121
121
|
run(hook: HookCommand, payload: HookPayload, options: HookRunOptions): Promise<HookOutcome>;
|
|
122
122
|
}
|
|
123
123
|
/** Registry rows for this repository, or the failure that emptied them. */
|
|
124
|
-
interface RegistryRead {
|
|
124
|
+
export interface RegistryRead {
|
|
125
125
|
entries: RegistryEntry[];
|
|
126
126
|
failure?: HookFailure;
|
|
127
127
|
}
|
|
128
128
|
/** Plugin configs that could be read, and one failure per config that could not. */
|
|
129
|
-
interface PluginDocumentRead {
|
|
129
|
+
export interface PluginDocumentRead {
|
|
130
130
|
documents: PluginHookDocument[];
|
|
131
131
|
failures: HookFailure[];
|
|
132
132
|
}
|
|
133
133
|
/** Where a plugin declares its hooks. Mirrors the harness state entry. */
|
|
134
|
-
interface PluginHookSourceRef {
|
|
134
|
+
export interface PluginHookSourceRef {
|
|
135
135
|
readonly pluginRoot: string;
|
|
136
136
|
readonly configPath: string;
|
|
137
137
|
}
|
|
138
138
|
/** Reads the hook documents a session runs from. */
|
|
139
|
-
interface HookDocumentReader {
|
|
139
|
+
export interface HookDocumentReader {
|
|
140
140
|
registry(repoRoot: string): Promise<RegistryRead>;
|
|
141
141
|
plugins(sources: readonly PluginHookSourceRef[]): Promise<PluginDocumentRead>;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
|
-
export { HOOK_EVENT, HookCommand, HookDecision, HookDocumentReader, HookDocumentSource, HookEventName, HookFailure, HookFailureReason, HookOutcome, HookPayload, HookRunOptions, HookRunner, HookToolEvent, ParsedRegistrySource, PluginDocumentRead, PluginHookConfig, PluginHookDocument, PluginHookGroup, PluginHookSourceRef, RegistryBinding, RegistryDocument, RegistryEntry, RegistryGroup, RegistryRead, ResolvedHook };
|
|
145
144
|
//# sourceMappingURL=hooks.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.mts","names":[],"sources":["../../src/types/hooks.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hooks.d.mts","names":[],"sources":["../../src/types/hooks.ts"],"mappings":";;;;;;;;;qBASa;WACX;WACA;WACA;WACA;WACA;;YAGU,wBAAwB,yBAAyB;iBAE5C;EACf;;EAEA;;;iBAIe;EACf;EACA;EACA;EACA;EACA;;;iBAIe,sBAAsB;EACrC;EACA;;EAEA;EACA;EACA;;EAEA;;iBAGe;EACf;EACA,QAAQ;IAAQ;IAAe,KAAK;;;iBAGrB;EACf,SAAS,eAAe;;;iBAIT;EACf;EACA;;;iBAIe;EACf;EACA,UAAU;;iBAGK;EACf;EACA,QAAQ;;iBAGO;EACf,QAAQ,eAAe;;;iBAIR;EACf;EACA,QAAQ;;;iBAIO;EACf,MAAM;EACN;;;iBAIe;EACf;EACA;EACA;IACE;IACA;IACA;;;YAIQ;iBAQK;EACf;EACA;EACA,QAAQ;;iBAGO;EACf,WAAW;EACX,UAAU;;;;;;;;iBASK;WACN;WACA;WACA;WACA;WACA;;;YAIC,cAAc;iBAET;EACf;;EAEA;;;iBAIe;EACf,IAAI,MAAM,aAAa,SAAS,aAAa,SAAS,iBAAiB,QAAQ;;;iBAIhE;EACf,SAAS;EACT,UAAU;;;iBAIK;EACf,WAAW;EACX,UAAU;;;iBAIK;WACN;WACA;;;iBAIM;EACf,SAAS,mBAAmB,QAAQ;EACpC,QAAQ,kBAAkB,wBAAwB,QAAQ"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
//#region src/types/telemetry.d.ts
|
|
2
2
|
/** Telemetry events this package reports, and the port that records them. */
|
|
3
|
-
declare const HOOK_TELEMETRY_EVENT: {
|
|
3
|
+
export declare const HOOK_TELEMETRY_EVENT: {
|
|
4
4
|
readonly hookFailed: 'doom_pi_hook.failed';
|
|
5
5
|
readonly hookRegistryReadFailed: 'doom_pi_hook.registry_read_failed';
|
|
6
6
|
};
|
|
7
|
-
type HookTelemetryEventName = (typeof HOOK_TELEMETRY_EVENT)[keyof typeof HOOK_TELEMETRY_EVENT];
|
|
8
|
-
type HookTelemetryAttributes = Record<string, string | number | boolean>;
|
|
7
|
+
export type HookTelemetryEventName = (typeof HOOK_TELEMETRY_EVENT)[keyof typeof HOOK_TELEMETRY_EVENT];
|
|
8
|
+
export type HookTelemetryAttributes = Record<string, string | number | boolean>;
|
|
9
9
|
/**
|
|
10
10
|
* A hook that never ran is indistinguishable from one that passed, which is why
|
|
11
11
|
* both a failed run and an unreadable registry are worth reporting rather than
|
|
12
12
|
* swallowing.
|
|
13
13
|
*/
|
|
14
|
-
interface HookTelemetry {
|
|
14
|
+
export interface HookTelemetry {
|
|
15
15
|
recordError(event: HookTelemetryEventName, error: unknown, attributes?: HookTelemetryAttributes): Promise<void>;
|
|
16
16
|
recordWarning(event: HookTelemetryEventName, error: unknown, attributes?: HookTelemetryAttributes): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
export { HOOK_TELEMETRY_EVENT, HookTelemetry, HookTelemetryAttributes, HookTelemetryEventName };
|
|
20
19
|
//# sourceMappingURL=telemetry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.cts","names":[],"sources":["../../src/types/telemetry.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"telemetry.d.cts","names":[],"sources":["../../src/types/telemetry.ts"],"mappings":";;qBACa;WACX;WACA;;YAGU,iCAAiC,mCAAmC;YACpE,0BAA0B;;;;;;iBAOrB;EACf,YAAY,OAAO,wBAAwB,gBAAgB,aAAa,0BAA0B;EAClG,cAAc,OAAO,wBAAwB,gBAAgB,aAAa,0BAA0B"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
//#region src/types/telemetry.d.ts
|
|
2
2
|
/** Telemetry events this package reports, and the port that records them. */
|
|
3
|
-
declare const HOOK_TELEMETRY_EVENT: {
|
|
3
|
+
export declare const HOOK_TELEMETRY_EVENT: {
|
|
4
4
|
readonly hookFailed: 'doom_pi_hook.failed';
|
|
5
5
|
readonly hookRegistryReadFailed: 'doom_pi_hook.registry_read_failed';
|
|
6
6
|
};
|
|
7
|
-
type HookTelemetryEventName = (typeof HOOK_TELEMETRY_EVENT)[keyof typeof HOOK_TELEMETRY_EVENT];
|
|
8
|
-
type HookTelemetryAttributes = Record<string, string | number | boolean>;
|
|
7
|
+
export type HookTelemetryEventName = (typeof HOOK_TELEMETRY_EVENT)[keyof typeof HOOK_TELEMETRY_EVENT];
|
|
8
|
+
export type HookTelemetryAttributes = Record<string, string | number | boolean>;
|
|
9
9
|
/**
|
|
10
10
|
* A hook that never ran is indistinguishable from one that passed, which is why
|
|
11
11
|
* both a failed run and an unreadable registry are worth reporting rather than
|
|
12
12
|
* swallowing.
|
|
13
13
|
*/
|
|
14
|
-
interface HookTelemetry {
|
|
14
|
+
export interface HookTelemetry {
|
|
15
15
|
recordError(event: HookTelemetryEventName, error: unknown, attributes?: HookTelemetryAttributes): Promise<void>;
|
|
16
16
|
recordWarning(event: HookTelemetryEventName, error: unknown, attributes?: HookTelemetryAttributes): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
export { HOOK_TELEMETRY_EVENT, HookTelemetry, HookTelemetryAttributes, HookTelemetryEventName };
|
|
20
19
|
//# sourceMappingURL=telemetry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.mts","names":[],"sources":["../../src/types/telemetry.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"telemetry.d.mts","names":[],"sources":["../../src/types/telemetry.ts"],"mappings":";;qBACa;WACX;WACA;;YAGU,iCAAiC,mCAAmC;YACpE,0BAA0B;;;;;;iBAOrB;EACf,YAAY,OAAO,wBAAwB,gBAAgB,aAAa,0BAA0B;EAClG,cAAc,OAAO,wBAAwB,gBAAgB,aAAa,0BAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/doompi-hook",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.41",
|
|
4
4
|
"description": "Claude-Code-compatible repository and plugin hook runner for DoomPi sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -55,23 +55,23 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@deepseek-ai/cordis": "4.0.
|
|
58
|
+
"@deepseek-ai/cordis": "4.0.2",
|
|
59
59
|
"yaml": "2.9.0",
|
|
60
|
-
"@agimon-ai/doompi-
|
|
61
|
-
"@agimon-ai/doompi-
|
|
62
|
-
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.
|
|
60
|
+
"@agimon-ai/doompi-config": "0.0.1-alpha.63",
|
|
61
|
+
"@agimon-ai/doompi-telemetry": "0.0.1-alpha.62",
|
|
62
|
+
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.63"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@earendil-works/pi-coding-agent": "0.85.
|
|
66
|
-
"@types/node": "26.4.
|
|
67
|
-
"@vitest/coverage-v8": "
|
|
68
|
-
"tsdown": "0.
|
|
65
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
66
|
+
"@types/node": "26.4.1",
|
|
67
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
68
|
+
"tsdown": "0.23.0",
|
|
69
69
|
"typescript": "7.0.2",
|
|
70
|
-
"vitest": "
|
|
71
|
-
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.
|
|
70
|
+
"vitest": "5.0.0",
|
|
71
|
+
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.60"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@earendil-works/pi-coding-agent": "0.85.
|
|
74
|
+
"@earendil-works/pi-coding-agent": "0.85.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|
|
77
77
|
"@earendil-works/pi-coding-agent": {
|