cc-hooks-ts 2.1.145 → 2.1.152
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/index.d.mts +76 -2
- package/dist/index.mjs +8 -0
- package/package.json +16 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { AgentInput, AgentOutput, AskUserQuestionInput, AskUserQuestionOutput, BashInput, BashOutput, EnterWorktreeInput, EnterWorktreeOutput, ExitPlanModeInput, ExitPlanModeOutput, ExitWorktreeInput, ExitWorktreeOutput, FileEditInput, FileEditOutput, FileReadInput, FileReadOutput, FileWriteInput, FileWriteOutput, GlobInput, GlobOutput, GrepInput, GrepOutput, ListMcpResourcesInput, ListMcpResourcesOutput, McpInput, McpOutput, NotebookEditInput, NotebookEditOutput, ReadMcpResourceInput, ReadMcpResourceOutput, TaskOutputInput, TaskStopInput, TaskStopOutput, TodoWriteInput, TodoWriteOutput, WebFetchInput, WebFetchOutput, WebSearchInput, WebSearchOutput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
|
|
2
|
+
import { AgentInput, AgentOutput, AskUserQuestionInput, AskUserQuestionOutput, BashInput, BashOutput, CronCreateInput, CronCreateOutput, CronDeleteInput, CronDeleteOutput, CronListInput, CronListOutput, EnterPlanModeInput, EnterPlanModeOutput, EnterWorktreeInput, EnterWorktreeOutput, ExitPlanModeInput, ExitPlanModeOutput, ExitWorktreeInput, ExitWorktreeOutput, FileEditInput, FileEditOutput, FileReadInput, FileReadOutput, FileWriteInput, FileWriteOutput, GlobInput, GlobOutput, GrepInput, GrepOutput, ListMcpResourcesInput, ListMcpResourcesOutput, McpInput, McpOutput, MonitorInput, MonitorOutput, NotebookEditInput, NotebookEditOutput, PushNotificationInput, PushNotificationOutput, REPLInput, REPLOutput, ReadMcpResourceInput, ReadMcpResourceOutput, RemoteTriggerInput, RemoteTriggerOutput, ScheduleWakeupInput, ScheduleWakeupOutput, TaskOutputInput, TaskStopInput, TaskStopOutput, TodoWriteInput, TodoWriteOutput, WebFetchInput, WebFetchOutput, WebSearchInput, WebSearchOutput, WorkflowInput, WorkflowOutput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/types.d.ts
|
|
5
5
|
type Awaitable<T> = Promise<T> | T;
|
|
@@ -274,6 +274,7 @@ declare const HookInputSchemas: {
|
|
|
274
274
|
} & {
|
|
275
275
|
agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
276
276
|
model: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
277
|
+
session_title: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
277
278
|
source: v.PicklistSchema<["startup", "resume", "clear", "compact"], undefined>;
|
|
278
279
|
}, undefined>;
|
|
279
280
|
readonly SessionEnd: v.ObjectSchema<{
|
|
@@ -553,6 +554,24 @@ declare const HookInputSchemas: {
|
|
|
553
554
|
event: v.PicklistSchema<["change", "add", "unlink"], undefined>;
|
|
554
555
|
file_path: v.StringSchema<undefined>;
|
|
555
556
|
}, undefined>;
|
|
557
|
+
readonly MessageDisplay: v.ObjectSchema<{
|
|
558
|
+
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
559
|
+
readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
560
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
561
|
+
readonly effort: v.ExactOptionalSchema<v.ObjectSchema<{
|
|
562
|
+
readonly level: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.GuardAction<string, (s: string) => s is AutoComplete<"low" | "medium" | "high" | "xhigh" | "max">, undefined>]>;
|
|
563
|
+
}, undefined>, undefined>;
|
|
564
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
565
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
566
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
567
|
+
readonly hook_event_name: v.LiteralSchema<"MessageDisplay", undefined>;
|
|
568
|
+
} & {
|
|
569
|
+
delta: v.StringSchema<undefined>;
|
|
570
|
+
final: v.BooleanSchema<undefined>;
|
|
571
|
+
index: v.NumberSchema<undefined>;
|
|
572
|
+
message_id: v.StringSchema<undefined>;
|
|
573
|
+
turn_id: v.StringSchema<undefined>;
|
|
574
|
+
}, undefined>;
|
|
556
575
|
};
|
|
557
576
|
//#endregion
|
|
558
577
|
//#region src/hooks/event.d.ts
|
|
@@ -561,7 +580,7 @@ declare const HookInputSchemas: {
|
|
|
561
580
|
*
|
|
562
581
|
* @package
|
|
563
582
|
*/
|
|
564
|
-
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "PostToolBatch" | "Notification" | "UserPromptSubmit" | "UserPromptExpansion" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded" | "CwdChanged" | "FileChanged";
|
|
583
|
+
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "PostToolBatch" | "Notification" | "UserPromptSubmit" | "UserPromptExpansion" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "PermissionDenied" | "Setup" | "TeammateIdle" | "TaskCreated" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded" | "CwdChanged" | "FileChanged" | "MessageDisplay";
|
|
565
584
|
//#endregion
|
|
566
585
|
//#region src/hooks/input/types.d.ts
|
|
567
586
|
/**
|
|
@@ -732,6 +751,7 @@ type HookOutput = {
|
|
|
732
751
|
ElicitationResult: ElicitationResultHookOutput;
|
|
733
752
|
CwdChanged: CwdChangedHookOutput;
|
|
734
753
|
FileChanged: FileChangedHookOutput;
|
|
754
|
+
MessageDisplay: MessageDisplayHookOutput;
|
|
735
755
|
ConfigChange: CommonHookOutputs;
|
|
736
756
|
InstructionsLoaded: CommonHookOutputs;
|
|
737
757
|
PostCompact: CommonHookOutputs;
|
|
@@ -972,6 +992,11 @@ interface SessionStartHookOutput extends CommonHookOutputs {
|
|
|
972
992
|
*/
|
|
973
993
|
additionalContext?: string;
|
|
974
994
|
initialUserMessage?: string;
|
|
995
|
+
/**
|
|
996
|
+
* Re-scan skill and command directories after SessionStart hooks complete, so skills installed by the hook are available in the same session.
|
|
997
|
+
*/
|
|
998
|
+
reloadSkills?: boolean;
|
|
999
|
+
sessionTitle?: string;
|
|
975
1000
|
watchPaths?: string[];
|
|
976
1001
|
};
|
|
977
1002
|
}
|
|
@@ -1038,6 +1063,15 @@ interface FileChangedHookOutput extends CommonHookOutputs {
|
|
|
1038
1063
|
watchPaths?: string[];
|
|
1039
1064
|
};
|
|
1040
1065
|
}
|
|
1066
|
+
interface MessageDisplayHookOutput extends CommonHookOutputs {
|
|
1067
|
+
hookSpecificOutput?: {
|
|
1068
|
+
hookEventName: "MessageDisplay";
|
|
1069
|
+
/**
|
|
1070
|
+
* Text displayed in place of the delta. Omit (or return the delta unchanged) to display the original.
|
|
1071
|
+
*/
|
|
1072
|
+
displayContent?: string;
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1041
1075
|
//#endregion
|
|
1042
1076
|
//#region src/types.d.ts
|
|
1043
1077
|
type HookTrigger = Partial<{ [TEvent in SupportedHookEvent]: true | Partial<{ [SchemaKey in ExtractExtendedSpecificKeys<TEvent>]?: true }> }>;
|
|
@@ -1417,10 +1451,26 @@ interface ToolSchema {
|
|
|
1417
1451
|
input: BashInput;
|
|
1418
1452
|
response: BashOutput;
|
|
1419
1453
|
};
|
|
1454
|
+
CronCreate: {
|
|
1455
|
+
input: CronCreateInput;
|
|
1456
|
+
response: CronCreateOutput;
|
|
1457
|
+
};
|
|
1458
|
+
CronDelete: {
|
|
1459
|
+
input: CronDeleteInput;
|
|
1460
|
+
response: CronDeleteOutput;
|
|
1461
|
+
};
|
|
1462
|
+
CronList: {
|
|
1463
|
+
input: CronListInput;
|
|
1464
|
+
response: CronListOutput;
|
|
1465
|
+
};
|
|
1420
1466
|
Edit: {
|
|
1421
1467
|
input: FileEditInput;
|
|
1422
1468
|
response: FileEditOutput;
|
|
1423
1469
|
};
|
|
1470
|
+
EnterPlanMode: {
|
|
1471
|
+
input: EnterPlanModeInput;
|
|
1472
|
+
response: EnterPlanModeOutput;
|
|
1473
|
+
};
|
|
1424
1474
|
EnterWorktree: {
|
|
1425
1475
|
input: EnterWorktreeInput;
|
|
1426
1476
|
response: EnterWorktreeOutput;
|
|
@@ -1449,10 +1499,18 @@ interface ToolSchema {
|
|
|
1449
1499
|
input: McpInput;
|
|
1450
1500
|
response: McpOutput;
|
|
1451
1501
|
};
|
|
1502
|
+
Monitor: {
|
|
1503
|
+
input: MonitorInput;
|
|
1504
|
+
response: MonitorOutput;
|
|
1505
|
+
};
|
|
1452
1506
|
NotebookEdit: {
|
|
1453
1507
|
input: NotebookEditInput;
|
|
1454
1508
|
response: NotebookEditOutput;
|
|
1455
1509
|
};
|
|
1510
|
+
PushNotification: {
|
|
1511
|
+
input: PushNotificationInput;
|
|
1512
|
+
response: PushNotificationOutput;
|
|
1513
|
+
};
|
|
1456
1514
|
Read: {
|
|
1457
1515
|
input: FileReadInput;
|
|
1458
1516
|
response: FileReadOutput;
|
|
@@ -1461,6 +1519,18 @@ interface ToolSchema {
|
|
|
1461
1519
|
input: ReadMcpResourceInput;
|
|
1462
1520
|
response: ReadMcpResourceOutput;
|
|
1463
1521
|
};
|
|
1522
|
+
RemoteTrigger: {
|
|
1523
|
+
input: RemoteTriggerInput;
|
|
1524
|
+
response: RemoteTriggerOutput;
|
|
1525
|
+
};
|
|
1526
|
+
REPL: {
|
|
1527
|
+
input: REPLInput;
|
|
1528
|
+
response: REPLOutput;
|
|
1529
|
+
};
|
|
1530
|
+
ScheduleWakeup: {
|
|
1531
|
+
input: ScheduleWakeupInput;
|
|
1532
|
+
response: ScheduleWakeupOutput;
|
|
1533
|
+
};
|
|
1464
1534
|
Skill: {
|
|
1465
1535
|
input: {
|
|
1466
1536
|
args?: string;
|
|
@@ -1502,6 +1572,10 @@ interface ToolSchema {
|
|
|
1502
1572
|
input: WebSearchInput;
|
|
1503
1573
|
response: WebSearchOutput;
|
|
1504
1574
|
};
|
|
1575
|
+
Workflow: {
|
|
1576
|
+
input: WorkflowInput;
|
|
1577
|
+
response: WorkflowOutput;
|
|
1578
|
+
};
|
|
1505
1579
|
Write: {
|
|
1506
1580
|
input: FileWriteInput;
|
|
1507
1581
|
response: FileWriteOutput;
|
package/dist/index.mjs
CHANGED
|
@@ -279,6 +279,7 @@ const HookInputSchemas = {
|
|
|
279
279
|
SessionStart: buildHookInputSchema("SessionStart", {
|
|
280
280
|
agent_type: v.exactOptional(v.string()),
|
|
281
281
|
model: v.exactOptional(v.string()),
|
|
282
|
+
session_title: v.exactOptional(v.string()),
|
|
282
283
|
source: v.picklist([
|
|
283
284
|
"startup",
|
|
284
285
|
"resume",
|
|
@@ -385,6 +386,13 @@ const HookInputSchemas = {
|
|
|
385
386
|
"unlink"
|
|
386
387
|
]),
|
|
387
388
|
file_path: v.string()
|
|
389
|
+
}),
|
|
390
|
+
MessageDisplay: buildHookInputSchema("MessageDisplay", {
|
|
391
|
+
delta: v.string(),
|
|
392
|
+
final: v.boolean(),
|
|
393
|
+
index: v.number(),
|
|
394
|
+
message_id: v.string(),
|
|
395
|
+
turn_id: v.string()
|
|
388
396
|
})
|
|
389
397
|
};
|
|
390
398
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.152",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Write claude code hooks with type safety",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,26 +43,26 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@arethetypeswrong/core": "0.18.2",
|
|
46
|
-
"@types/node": "25.
|
|
47
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
48
|
-
"@virtual-live-lab/eslint-config": "2.
|
|
49
|
-
"@virtual-live-lab/tsconfig": "2.1.
|
|
50
|
-
"eslint": "
|
|
46
|
+
"@types/node": "25.9.1",
|
|
47
|
+
"@typescript/native-preview": "7.0.0-dev.20260523.1",
|
|
48
|
+
"@virtual-live-lab/eslint-config": "2.4.4",
|
|
49
|
+
"@virtual-live-lab/tsconfig": "2.1.23",
|
|
50
|
+
"eslint": "10.4.0",
|
|
51
51
|
"eslint-plugin-import-access": "3.1.0",
|
|
52
|
-
"oxfmt": "0.
|
|
53
|
-
"pkg-pr-new": "0.0.
|
|
54
|
-
"publint": "0.3.
|
|
55
|
-
"release-it": "
|
|
52
|
+
"oxfmt": "0.51.0",
|
|
53
|
+
"pkg-pr-new": "0.0.75",
|
|
54
|
+
"publint": "0.3.21",
|
|
55
|
+
"release-it": "20.0.1",
|
|
56
56
|
"release-it-pnpm": "4.6.6",
|
|
57
|
-
"tsdown": "0.
|
|
58
|
-
"type-fest": "5.
|
|
59
|
-
"typescript": "6.0.
|
|
60
|
-
"typescript-eslint": "8.
|
|
57
|
+
"tsdown": "0.22.0",
|
|
58
|
+
"type-fest": "5.6.0",
|
|
59
|
+
"typescript": "6.0.3",
|
|
60
|
+
"typescript-eslint": "8.59.4",
|
|
61
61
|
"unplugin-unused": "0.5.7",
|
|
62
|
-
"vitest": "4.1.
|
|
62
|
+
"vitest": "4.1.7"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.152",
|
|
66
66
|
"get-stdin": "10.0.0",
|
|
67
67
|
"valibot": "^1.3.0"
|
|
68
68
|
},
|