@easbot/plugin 0.3.36 → 0.3.39

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.ts CHANGED
@@ -1,17 +1,27 @@
1
1
  import { Auth, Provider, createEasbotClient, Project, Event, Config } from '@easbot/sdk';
2
2
  import * as _easbot_types from '@easbot/types';
3
- import { ToolContext, AgentInfo, EasbotShell, CommandDefinition, ToolDefinition } from '@easbot/types';
4
- export { AgentInfo, AgentInfoSchema, AgentModel, AgentModelSchema, AgentPermission, AgentPermissionSchema, AskInput, CommandArguments, CommandArgumentsSchema, CommandConfigInfo, CommandConfigInfoSchema, CommandDefinition, CommandExecuteFn, CommandExecuteResult, CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, CommandExecutionContext, CommandExecutionContextSchema, CommandInfo, CommandInfoSchema, CommandInitContext, CommandInitContextSchema, CommandInitFn, CommandInitResult, CommandInitResultSchema, CommandIsEnabledFn, CommandMetadata, CommandMetadataSchema, CommandPromptPart, CommandPromptPartSchema, CommandSource, CommandSourceSchema, EasbotShell, EasbotShellError, EasbotShellOutput, EasbotShellPromise, PermissionActionSchema, PermissionRuleSchema, ShellExpression, ShellFunction, ToolContext, ToolDefinition, ToolFunction as ToolFn, ToolFunction, buildToolArgs, createTool, toolSchema as schema } from '@easbot/types';
3
+ import { ToolArgs, ToolArgsInput, ToolContext, ToolResult, ToolIsEnabled, ToolDefinition, SessionHandle, IdentityHandle, AgentInfo, EasbotShell, CommandDefinition } from '@easbot/types';
4
+ export { AgentInfo, AgentInfoSchema, AgentModel, AgentModelSchema, AgentPermission, AgentPermissionSchema, AskInput, CommandArguments, CommandArgumentsSchema, CommandConfigInfo, CommandConfigInfoSchema, CommandDefinition, CommandExecuteFn, CommandExecuteResult, CommandExecuteResultMetadata, CommandExecuteResultMetadataSchema, CommandExecuteResultSchema, CommandExecutionContext, CommandExecutionContextSchema, CommandInfo, CommandInfoSchema, CommandInitContext, CommandInitContextSchema, CommandInitFn, CommandInitResult, CommandInitResultSchema, CommandIsEnabledFn, CommandMetadata, CommandMetadataSchema, CommandPromptPart, CommandPromptPartSchema, CommandSource, CommandSourceSchema, EasbotShell, EasbotShellError, EasbotShellOutput, EasbotShellPromise, PermissionActionSchema, PermissionRuleSchema, ShellExpression, ShellFunction, ToolArgs, ToolArgsInput, ToolContext, ToolDefinition, ToolFunction as ToolFn, ToolFunction, ToolIsEnabled, ToolResult, buildToolArgs, toolSchema as schema } from '@easbot/types';
5
5
  import z, { z as z$1 } from 'zod';
6
6
 
7
- declare function tool<Args extends Record<string, z.ZodTypeAny>>(input: {
7
+ declare function createTool<Args extends ToolArgs>(input: {
8
8
  description: string;
9
9
  args: Args;
10
- execute(args: Record<string, unknown>, context: ToolContext): Promise<string>;
10
+ execute(args: ToolArgsInput<Args>, context: ToolContext): Promise<string | ToolResult>;
11
+ isEnabled?: ToolIsEnabled;
12
+ }): ToolDefinition & {
13
+ args: Args;
14
+ };
15
+ declare function tool<Args extends ToolArgs>(input: {
16
+ description: string;
17
+ args: Args;
18
+ execute(args: ToolArgsInput<Args>, context: ToolContext): Promise<string | ToolResult>;
19
+ isEnabled?: ToolIsEnabled;
11
20
  }): {
12
21
  description: string;
13
22
  args: Args;
14
- execute: (args: Record<string, unknown>, context: ToolContext) => Promise<string>;
23
+ execute: (args: Record<string, unknown>, context: ToolContext) => Promise<string | ToolResult>;
24
+ isEnabled: ToolIsEnabled | undefined;
15
25
  };
16
26
  declare namespace tool {
17
27
  var schema: typeof z;
@@ -440,6 +450,22 @@ declare const MessageReceiveInputSchema: z$1.ZodObject<{
440
450
  }, z$1.core.$strip>;
441
451
  }, z$1.core.$strip>;
442
452
  type MessageReceiveInput = z$1.infer<typeof MessageReceiveInputSchema>;
453
+ declare const UserPromptSubmitInputSchema: z$1.ZodObject<{
454
+ sessionId: z$1.ZodString;
455
+ agent: z$1.ZodOptional<z$1.ZodString>;
456
+ model: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
457
+ userMessageId: z$1.ZodString;
458
+ prompt: z$1.ZodString;
459
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
460
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
461
+ }, z$1.core.$strip>;
462
+ type UserPromptSubmitInput = z$1.infer<typeof UserPromptSubmitInputSchema>;
463
+ declare const UserPromptSubmitOutputSchema: z$1.ZodObject<{
464
+ additionalContext: z$1.ZodOptional<z$1.ZodString>;
465
+ block: z$1.ZodOptional<z$1.ZodBoolean>;
466
+ reason: z$1.ZodOptional<z$1.ZodString>;
467
+ }, z$1.core.$strip>;
468
+ type UserPromptSubmitOutput = z$1.infer<typeof UserPromptSubmitOutputSchema>;
443
469
  declare const MessageTransformInputSchema: z$1.ZodObject<{
444
470
  sessionId: z$1.ZodString;
445
471
  messages: z$1.ZodArray<z$1.ZodObject<{
@@ -587,12 +613,6 @@ declare const PermissionAskInputSchema: z$1.ZodObject<{
587
613
  }, z$1.core.$strip>;
588
614
  }, z$1.core.$strip>;
589
615
  type PermissionAskInput = z$1.infer<typeof PermissionAskInputSchema>;
590
- declare const PermissionDeniedInputSchema: z$1.ZodObject<{
591
- sessionId: z$1.ZodString;
592
- tool: z$1.ZodString;
593
- reason: z$1.ZodOptional<z$1.ZodString>;
594
- }, z$1.core.$strip>;
595
- type PermissionDeniedInput = z$1.infer<typeof PermissionDeniedInputSchema>;
596
616
  declare const LlmProviderSchema: z$1.ZodEnum<{
597
617
  custom: "custom";
598
618
  openai: "openai";
@@ -671,11 +691,15 @@ declare const ShellEnvInputSchema: z$1.ZodObject<{
671
691
  type ShellEnvInput = z$1.infer<typeof ShellEnvInputSchema>;
672
692
  declare const ContextBuildBeforeInputSchema: z$1.ZodObject<{
673
693
  sessionId: z$1.ZodString;
674
- mode: z$1.ZodEnum<{
694
+ mode: z$1.ZodOptional<z$1.ZodEnum<{
695
+ general: "general";
696
+ coder: "coder";
697
+ }>>;
698
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
675
699
  agent: "agent";
676
700
  chat: "chat";
677
701
  query: "query";
678
- }>;
702
+ }>>;
679
703
  providerId: z$1.ZodOptional<z$1.ZodString>;
680
704
  }, z$1.core.$strip>;
681
705
  type ContextBuildBeforeInput = z$1.infer<typeof ContextBuildBeforeInputSchema>;
@@ -717,6 +741,55 @@ declare const ContextBuildAfterInputSchema: z$1.ZodObject<{
717
741
  }, z$1.core.$strip>;
718
742
  }, z$1.core.$strip>;
719
743
  type ContextBuildAfterInput = z$1.infer<typeof ContextBuildAfterInputSchema>;
744
+ declare const ContextFragmentSchema: z$1.ZodObject<{
745
+ id: z$1.ZodString;
746
+ title: z$1.ZodOptional<z$1.ZodString>;
747
+ content: z$1.ZodString;
748
+ source: z$1.ZodOptional<z$1.ZodString>;
749
+ tokens: z$1.ZodOptional<z$1.ZodNumber>;
750
+ order: z$1.ZodOptional<z$1.ZodNumber>;
751
+ markers: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString, z$1.ZodString], null>>;
752
+ }, z$1.core.$strip>;
753
+ type ContextFragment = z$1.infer<typeof ContextFragmentSchema>;
754
+ declare const ContextCollectOutputSchema: z$1.ZodObject<{
755
+ fragments: z$1.ZodArray<z$1.ZodObject<{
756
+ id: z$1.ZodString;
757
+ title: z$1.ZodOptional<z$1.ZodString>;
758
+ content: z$1.ZodString;
759
+ source: z$1.ZodOptional<z$1.ZodString>;
760
+ tokens: z$1.ZodOptional<z$1.ZodNumber>;
761
+ order: z$1.ZodOptional<z$1.ZodNumber>;
762
+ markers: z$1.ZodOptional<z$1.ZodTuple<[z$1.ZodString, z$1.ZodString], null>>;
763
+ }, z$1.core.$strip>>;
764
+ }, z$1.core.$strip>;
765
+ type ContextCollectOutput = z$1.infer<typeof ContextCollectOutputSchema>;
766
+ declare const ContextCollectInputSchema: z$1.ZodObject<{
767
+ sessionId: z$1.ZodString;
768
+ mode: z$1.ZodEnum<{
769
+ general: "general";
770
+ coder: "coder";
771
+ }>;
772
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
773
+ agent: "agent";
774
+ chat: "chat";
775
+ query: "query";
776
+ }>>;
777
+ providerId: z$1.ZodOptional<z$1.ZodString>;
778
+ agentId: z$1.ZodOptional<z$1.ZodString>;
779
+ agentName: z$1.ZodOptional<z$1.ZodString>;
780
+ modelId: z$1.ZodOptional<z$1.ZodString>;
781
+ query: z$1.ZodOptional<z$1.ZodString>;
782
+ maxTokens: z$1.ZodOptional<z$1.ZodNumber>;
783
+ trimOrder: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
784
+ coder: "coder";
785
+ memory: "memory";
786
+ knowledge: "knowledge";
787
+ skills: "skills";
788
+ todos: "todos";
789
+ plugins: "plugins";
790
+ }>>>;
791
+ }, z$1.core.$strip>;
792
+ type ContextCollectInput = z$1.infer<typeof ContextCollectInputSchema>;
720
793
  declare const GatewayMessageReceiveInputSchema: z$1.ZodObject<{
721
794
  gatewayID: z$1.ZodString;
722
795
  messageId: z$1.ZodString;
@@ -960,7 +1033,7 @@ type TaskCompleteInput = z$1.infer<typeof TaskCompleteInputSchema>;
960
1033
  declare const LoopStartInputSchema: z$1.ZodObject<{
961
1034
  sessionId: z$1.ZodString;
962
1035
  step: z$1.ZodNumber;
963
- lastUserId: z$1.ZodString;
1036
+ userMessageId: z$1.ZodString;
964
1037
  result: z$1.ZodOptional<z$1.ZodEnum<{
965
1038
  stop: "stop";
966
1039
  start: "start";
@@ -971,7 +1044,8 @@ type LoopStartInput = z$1.infer<typeof LoopStartInputSchema>;
971
1044
  declare const LoopEndInputSchema: z$1.ZodObject<{
972
1045
  sessionId: z$1.ZodString;
973
1046
  step: z$1.ZodNumber;
974
- lastUserId: z$1.ZodString;
1047
+ userMessageId: z$1.ZodString;
1048
+ messageId: z$1.ZodOptional<z$1.ZodString>;
975
1049
  result: z$1.ZodEnum<{
976
1050
  stop: "stop";
977
1051
  continue: "continue";
@@ -987,6 +1061,7 @@ declare const CreationRequestInputSchema: z$1.ZodObject<{
987
1061
  }>;
988
1062
  requirement: z$1.ZodString;
989
1063
  hints: z$1.ZodArray<z$1.ZodString>;
1064
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
990
1065
  origin: z$1.ZodObject<{
991
1066
  source: z$1.ZodOptional<z$1.ZodEnum<{
992
1067
  tool: "tool";
@@ -1005,25 +1080,11 @@ declare const CreationCompleteInputSchema: z$1.ZodObject<{
1005
1080
  failed: "failed";
1006
1081
  }>;
1007
1082
  specId: z$1.ZodOptional<z$1.ZodString>;
1083
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
1008
1084
  durationMs: z$1.ZodNumber;
1009
1085
  error: z$1.ZodOptional<z$1.ZodString>;
1010
1086
  }, z$1.core.$strip>;
1011
1087
  type CreationCompleteInput = z$1.infer<typeof CreationCompleteInputSchema>;
1012
- declare const EvolutionRequestInputSchema: z$1.ZodObject<{
1013
- dryRun: z$1.ZodBoolean;
1014
- }, z$1.core.$strip>;
1015
- type EvolutionRequestInput = z$1.infer<typeof EvolutionRequestInputSchema>;
1016
- declare const EvolutionCompleteInputSchema: z$1.ZodObject<{
1017
- status: z$1.ZodEnum<{
1018
- success: "success";
1019
- failed: "failed";
1020
- "awaiting-approval": "awaiting-approval";
1021
- }>;
1022
- applied: z$1.ZodOptional<z$1.ZodNumber>;
1023
- awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
1024
- error: z$1.ZodOptional<z$1.ZodString>;
1025
- }, z$1.core.$strip>;
1026
- type EvolutionCompleteInput = z$1.infer<typeof EvolutionCompleteInputSchema>;
1027
1088
  declare const ProcessorStartInputSchema: z$1.ZodObject<{
1028
1089
  streamId: z$1.ZodString;
1029
1090
  step: z$1.ZodNumber;
@@ -1237,6 +1298,60 @@ declare const ProcessorFinishInputSchema: z$1.ZodObject<{
1237
1298
  tokens: z$1.ZodOptional<z$1.ZodNumber>;
1238
1299
  }, z$1.core.$strip>;
1239
1300
  type ProcessorFinishInput = z$1.infer<typeof ProcessorFinishInputSchema>;
1301
+ declare const StopInputSchema: z$1.ZodObject<{
1302
+ sessionId: z$1.ZodString;
1303
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1304
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
1305
+ stopHookActive: z$1.ZodOptional<z$1.ZodBoolean>;
1306
+ result: z$1.ZodOptional<z$1.ZodEnum<{
1307
+ stop: "stop";
1308
+ continue: "continue";
1309
+ compact: "compact";
1310
+ }>>;
1311
+ }, z$1.core.$strip>;
1312
+ type StopInput = z$1.infer<typeof StopInputSchema>;
1313
+ declare const StopOutputSchema: z$1.ZodObject<{
1314
+ continue: z$1.ZodOptional<z$1.ZodBoolean>;
1315
+ reason: z$1.ZodOptional<z$1.ZodString>;
1316
+ }, z$1.core.$strip>;
1317
+ type StopOutput = z$1.infer<typeof StopOutputSchema>;
1318
+ declare const SessionInterruptInputSchema: z$1.ZodObject<{
1319
+ sessionId: z$1.ZodString;
1320
+ reason: z$1.ZodOptional<z$1.ZodString>;
1321
+ }, z$1.core.$strip>;
1322
+ type SessionInterruptInput = z$1.infer<typeof SessionInterruptInputSchema>;
1323
+ declare const SubagentStartInputSchema: z$1.ZodObject<{
1324
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1325
+ agentId: z$1.ZodString;
1326
+ agentName: z$1.ZodOptional<z$1.ZodString>;
1327
+ prompt: z$1.ZodOptional<z$1.ZodString>;
1328
+ }, z$1.core.$strip>;
1329
+ type SubagentStartInput = z$1.infer<typeof SubagentStartInputSchema>;
1330
+ declare const SubagentStopInputSchema: z$1.ZodObject<{
1331
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1332
+ agentId: z$1.ZodString;
1333
+ agentName: z$1.ZodOptional<z$1.ZodString>;
1334
+ success: z$1.ZodBoolean;
1335
+ durationMs: z$1.ZodOptional<z$1.ZodNumber>;
1336
+ error: z$1.ZodOptional<z$1.ZodString>;
1337
+ }, z$1.core.$strip>;
1338
+ type SubagentStopInput = z$1.infer<typeof SubagentStopInputSchema>;
1339
+ declare const NotificationInputSchema: z$1.ZodObject<{
1340
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1341
+ message: z$1.ZodString;
1342
+ level: z$1.ZodOptional<z$1.ZodEnum<{
1343
+ error: "error";
1344
+ info: "info";
1345
+ warn: "warn";
1346
+ }>>;
1347
+ source: z$1.ZodOptional<z$1.ZodString>;
1348
+ }, z$1.core.$strip>;
1349
+ type NotificationInput = z$1.infer<typeof NotificationInputSchema>;
1350
+ declare const ProjectTrustInputSchema: z$1.ZodObject<{
1351
+ cwd: z$1.ZodString;
1352
+ trusted: z$1.ZodBoolean;
1353
+ }, z$1.core.$strip>;
1354
+ type ProjectTrustInput = z$1.infer<typeof ProjectTrustInputSchema>;
1240
1355
  declare const EventInputSchemas: {
1241
1356
  readonly "session.start": z$1.ZodObject<{
1242
1357
  sessionId: z$1.ZodString;
@@ -1278,6 +1393,10 @@ declare const EventInputSchemas: {
1278
1393
  previousLength: z$1.ZodNumber;
1279
1394
  newLength: z$1.ZodNumber;
1280
1395
  }, z$1.core.$strip>;
1396
+ readonly "session.interrupt": z$1.ZodObject<{
1397
+ sessionId: z$1.ZodString;
1398
+ reason: z$1.ZodOptional<z$1.ZodString>;
1399
+ }, z$1.core.$strip>;
1281
1400
  readonly "message.receive": z$1.ZodObject<{
1282
1401
  sessionId: z$1.ZodString;
1283
1402
  agent: z$1.ZodOptional<z$1.ZodString>;
@@ -1307,6 +1426,15 @@ declare const EventInputSchemas: {
1307
1426
  }, z$1.core.$strip>], "type">>]>;
1308
1427
  }, z$1.core.$strip>;
1309
1428
  }, z$1.core.$strip>;
1429
+ readonly "user.prompt.submit": z$1.ZodObject<{
1430
+ sessionId: z$1.ZodString;
1431
+ agent: z$1.ZodOptional<z$1.ZodString>;
1432
+ model: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1433
+ userMessageId: z$1.ZodString;
1434
+ prompt: z$1.ZodString;
1435
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1436
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
1437
+ }, z$1.core.$strip>;
1310
1438
  readonly "message.transform": z$1.ZodObject<{
1311
1439
  sessionId: z$1.ZodString;
1312
1440
  messages: z$1.ZodArray<z$1.ZodObject<{
@@ -1421,11 +1549,6 @@ declare const EventInputSchemas: {
1421
1549
  reason: z$1.ZodOptional<z$1.ZodString>;
1422
1550
  }, z$1.core.$strip>;
1423
1551
  }, z$1.core.$strip>;
1424
- readonly "permission.denied": z$1.ZodObject<{
1425
- sessionId: z$1.ZodString;
1426
- tool: z$1.ZodString;
1427
- reason: z$1.ZodOptional<z$1.ZodString>;
1428
- }, z$1.core.$strip>;
1429
1552
  readonly "llm.params": z$1.ZodObject<{
1430
1553
  sessionId: z$1.ZodString;
1431
1554
  agent: z$1.ZodOptional<z$1.ZodString>;
@@ -1483,11 +1606,15 @@ declare const EventInputSchemas: {
1483
1606
  }, z$1.core.$strip>;
1484
1607
  readonly "context.build.before": z$1.ZodObject<{
1485
1608
  sessionId: z$1.ZodString;
1486
- mode: z$1.ZodEnum<{
1609
+ mode: z$1.ZodOptional<z$1.ZodEnum<{
1610
+ general: "general";
1611
+ coder: "coder";
1612
+ }>>;
1613
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
1487
1614
  agent: "agent";
1488
1615
  chat: "chat";
1489
1616
  query: "query";
1490
- }>;
1617
+ }>>;
1491
1618
  providerId: z$1.ZodOptional<z$1.ZodString>;
1492
1619
  }, z$1.core.$strip>;
1493
1620
  readonly "context.build.after": z$1.ZodObject<{
@@ -1527,6 +1654,43 @@ declare const EventInputSchemas: {
1527
1654
  metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
1528
1655
  }, z$1.core.$strip>;
1529
1656
  }, z$1.core.$strip>;
1657
+ readonly "context.collect": z$1.ZodObject<{
1658
+ sessionId: z$1.ZodString;
1659
+ mode: z$1.ZodEnum<{
1660
+ general: "general";
1661
+ coder: "coder";
1662
+ }>;
1663
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
1664
+ agent: "agent";
1665
+ chat: "chat";
1666
+ query: "query";
1667
+ }>>;
1668
+ providerId: z$1.ZodOptional<z$1.ZodString>;
1669
+ agentId: z$1.ZodOptional<z$1.ZodString>;
1670
+ agentName: z$1.ZodOptional<z$1.ZodString>;
1671
+ modelId: z$1.ZodOptional<z$1.ZodString>;
1672
+ query: z$1.ZodOptional<z$1.ZodString>;
1673
+ maxTokens: z$1.ZodOptional<z$1.ZodNumber>;
1674
+ trimOrder: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
1675
+ coder: "coder";
1676
+ memory: "memory";
1677
+ knowledge: "knowledge";
1678
+ skills: "skills";
1679
+ todos: "todos";
1680
+ plugins: "plugins";
1681
+ }>>>;
1682
+ }, z$1.core.$strip>;
1683
+ readonly "agent.stop": z$1.ZodObject<{
1684
+ sessionId: z$1.ZodString;
1685
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
1686
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
1687
+ stopHookActive: z$1.ZodOptional<z$1.ZodBoolean>;
1688
+ result: z$1.ZodOptional<z$1.ZodEnum<{
1689
+ stop: "stop";
1690
+ continue: "continue";
1691
+ compact: "compact";
1692
+ }>>;
1693
+ }, z$1.core.$strip>;
1530
1694
  readonly "gateway.message.receive": z$1.ZodObject<{
1531
1695
  gatewayID: z$1.ZodString;
1532
1696
  messageId: z$1.ZodString;
@@ -1705,7 +1869,7 @@ declare const EventInputSchemas: {
1705
1869
  readonly "loop.start": z$1.ZodObject<{
1706
1870
  sessionId: z$1.ZodString;
1707
1871
  step: z$1.ZodNumber;
1708
- lastUserId: z$1.ZodString;
1872
+ userMessageId: z$1.ZodString;
1709
1873
  result: z$1.ZodOptional<z$1.ZodEnum<{
1710
1874
  stop: "stop";
1711
1875
  start: "start";
@@ -1715,12 +1879,37 @@ declare const EventInputSchemas: {
1715
1879
  readonly "loop.end": z$1.ZodObject<{
1716
1880
  sessionId: z$1.ZodString;
1717
1881
  step: z$1.ZodNumber;
1718
- lastUserId: z$1.ZodString;
1882
+ userMessageId: z$1.ZodString;
1883
+ messageId: z$1.ZodOptional<z$1.ZodString>;
1719
1884
  result: z$1.ZodEnum<{
1720
1885
  stop: "stop";
1721
1886
  continue: "continue";
1722
1887
  }>;
1723
1888
  }, z$1.core.$strip>;
1889
+ readonly "subagent.start": z$1.ZodObject<{
1890
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1891
+ agentId: z$1.ZodString;
1892
+ agentName: z$1.ZodOptional<z$1.ZodString>;
1893
+ prompt: z$1.ZodOptional<z$1.ZodString>;
1894
+ }, z$1.core.$strip>;
1895
+ readonly "subagent.stop": z$1.ZodObject<{
1896
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1897
+ agentId: z$1.ZodString;
1898
+ agentName: z$1.ZodOptional<z$1.ZodString>;
1899
+ success: z$1.ZodBoolean;
1900
+ durationMs: z$1.ZodOptional<z$1.ZodNumber>;
1901
+ error: z$1.ZodOptional<z$1.ZodString>;
1902
+ }, z$1.core.$strip>;
1903
+ readonly notification: z$1.ZodObject<{
1904
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
1905
+ message: z$1.ZodString;
1906
+ level: z$1.ZodOptional<z$1.ZodEnum<{
1907
+ error: "error";
1908
+ info: "info";
1909
+ warn: "warn";
1910
+ }>>;
1911
+ source: z$1.ZodOptional<z$1.ZodString>;
1912
+ }, z$1.core.$strip>;
1724
1913
  readonly "processor.start": z$1.ZodObject<{
1725
1914
  streamId: z$1.ZodString;
1726
1915
  step: z$1.ZodNumber;
@@ -1919,6 +2108,10 @@ declare const EventInputSchemas: {
1919
2108
  cost: z$1.ZodOptional<z$1.ZodNumber>;
1920
2109
  tokens: z$1.ZodOptional<z$1.ZodNumber>;
1921
2110
  }, z$1.core.$strip>;
2111
+ readonly "project.trust": z$1.ZodObject<{
2112
+ cwd: z$1.ZodString;
2113
+ trusted: z$1.ZodBoolean;
2114
+ }, z$1.core.$strip>;
1922
2115
  readonly "creation.request": z$1.ZodObject<{
1923
2116
  requestId: z$1.ZodString;
1924
2117
  kind: z$1.ZodEnum<{
@@ -1928,6 +2121,7 @@ declare const EventInputSchemas: {
1928
2121
  }>;
1929
2122
  requirement: z$1.ZodString;
1930
2123
  hints: z$1.ZodArray<z$1.ZodString>;
2124
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
1931
2125
  origin: z$1.ZodObject<{
1932
2126
  source: z$1.ZodOptional<z$1.ZodEnum<{
1933
2127
  tool: "tool";
@@ -1945,22 +2139,10 @@ declare const EventInputSchemas: {
1945
2139
  failed: "failed";
1946
2140
  }>;
1947
2141
  specId: z$1.ZodOptional<z$1.ZodString>;
2142
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
1948
2143
  durationMs: z$1.ZodNumber;
1949
2144
  error: z$1.ZodOptional<z$1.ZodString>;
1950
2145
  }, z$1.core.$strip>;
1951
- readonly "evolution.request": z$1.ZodObject<{
1952
- dryRun: z$1.ZodBoolean;
1953
- }, z$1.core.$strip>;
1954
- readonly "evolution.complete": z$1.ZodObject<{
1955
- status: z$1.ZodEnum<{
1956
- success: "success";
1957
- failed: "failed";
1958
- "awaiting-approval": "awaiting-approval";
1959
- }>;
1960
- applied: z$1.ZodOptional<z$1.ZodNumber>;
1961
- awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
1962
- error: z$1.ZodOptional<z$1.ZodString>;
1963
- }, z$1.core.$strip>;
1964
2146
  };
1965
2147
  declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
1966
2148
  sessionId: z$1.ZodString;
@@ -2026,6 +2208,14 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2026
2208
  mime: z$1.ZodOptional<z$1.ZodString>;
2027
2209
  }, z$1.core.$strip>], "type">>]>;
2028
2210
  }, z$1.core.$strip>;
2211
+ }, z$1.core.$strip> | z$1.ZodObject<{
2212
+ sessionId: z$1.ZodString;
2213
+ agent: z$1.ZodOptional<z$1.ZodString>;
2214
+ model: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2215
+ userMessageId: z$1.ZodString;
2216
+ prompt: z$1.ZodString;
2217
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2218
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
2029
2219
  }, z$1.core.$strip> | z$1.ZodObject<{
2030
2220
  sessionId: z$1.ZodString;
2031
2221
  messages: z$1.ZodArray<z$1.ZodObject<{
@@ -2131,10 +2321,6 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2131
2321
  }>>;
2132
2322
  reason: z$1.ZodOptional<z$1.ZodString>;
2133
2323
  }, z$1.core.$strip>;
2134
- }, z$1.core.$strip> | z$1.ZodObject<{
2135
- sessionId: z$1.ZodString;
2136
- tool: z$1.ZodString;
2137
- reason: z$1.ZodOptional<z$1.ZodString>;
2138
2324
  }, z$1.core.$strip> | z$1.ZodObject<{
2139
2325
  sessionId: z$1.ZodString;
2140
2326
  agent: z$1.ZodOptional<z$1.ZodString>;
@@ -2189,11 +2375,15 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2189
2375
  callId: z$1.ZodOptional<z$1.ZodString>;
2190
2376
  }, z$1.core.$strip> | z$1.ZodObject<{
2191
2377
  sessionId: z$1.ZodString;
2192
- mode: z$1.ZodEnum<{
2378
+ mode: z$1.ZodOptional<z$1.ZodEnum<{
2379
+ general: "general";
2380
+ coder: "coder";
2381
+ }>>;
2382
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
2193
2383
  agent: "agent";
2194
2384
  chat: "chat";
2195
2385
  query: "query";
2196
- }>;
2386
+ }>>;
2197
2387
  providerId: z$1.ZodOptional<z$1.ZodString>;
2198
2388
  }, z$1.core.$strip> | z$1.ZodObject<{
2199
2389
  sessionId: z$1.ZodString;
@@ -2231,6 +2421,31 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2231
2421
  system: z$1.ZodArray<z$1.ZodString>;
2232
2422
  metadata: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
2233
2423
  }, z$1.core.$strip>;
2424
+ }, z$1.core.$strip> | z$1.ZodObject<{
2425
+ sessionId: z$1.ZodString;
2426
+ mode: z$1.ZodEnum<{
2427
+ general: "general";
2428
+ coder: "coder";
2429
+ }>;
2430
+ scene: z$1.ZodOptional<z$1.ZodEnum<{
2431
+ agent: "agent";
2432
+ chat: "chat";
2433
+ query: "query";
2434
+ }>>;
2435
+ providerId: z$1.ZodOptional<z$1.ZodString>;
2436
+ agentId: z$1.ZodOptional<z$1.ZodString>;
2437
+ agentName: z$1.ZodOptional<z$1.ZodString>;
2438
+ modelId: z$1.ZodOptional<z$1.ZodString>;
2439
+ query: z$1.ZodOptional<z$1.ZodString>;
2440
+ maxTokens: z$1.ZodOptional<z$1.ZodNumber>;
2441
+ trimOrder: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
2442
+ coder: "coder";
2443
+ memory: "memory";
2444
+ knowledge: "knowledge";
2445
+ skills: "skills";
2446
+ todos: "todos";
2447
+ plugins: "plugins";
2448
+ }>>>;
2234
2449
  }, z$1.core.$strip> | z$1.ZodObject<{
2235
2450
  gatewayID: z$1.ZodString;
2236
2451
  messageId: z$1.ZodString;
@@ -2393,7 +2608,7 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2393
2608
  }, z$1.core.$strip> | z$1.ZodObject<{
2394
2609
  sessionId: z$1.ZodString;
2395
2610
  step: z$1.ZodNumber;
2396
- lastUserId: z$1.ZodString;
2611
+ userMessageId: z$1.ZodString;
2397
2612
  result: z$1.ZodOptional<z$1.ZodEnum<{
2398
2613
  stop: "stop";
2399
2614
  start: "start";
@@ -2402,7 +2617,8 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2402
2617
  }, z$1.core.$strip> | z$1.ZodObject<{
2403
2618
  sessionId: z$1.ZodString;
2404
2619
  step: z$1.ZodNumber;
2405
- lastUserId: z$1.ZodString;
2620
+ userMessageId: z$1.ZodString;
2621
+ messageId: z$1.ZodOptional<z$1.ZodString>;
2406
2622
  result: z$1.ZodEnum<{
2407
2623
  stop: "stop";
2408
2624
  continue: "continue";
@@ -2416,6 +2632,7 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2416
2632
  }>;
2417
2633
  requirement: z$1.ZodString;
2418
2634
  hints: z$1.ZodArray<z$1.ZodString>;
2635
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
2419
2636
  origin: z$1.ZodObject<{
2420
2637
  source: z$1.ZodOptional<z$1.ZodEnum<{
2421
2638
  tool: "tool";
@@ -2432,19 +2649,9 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2432
2649
  failed: "failed";
2433
2650
  }>;
2434
2651
  specId: z$1.ZodOptional<z$1.ZodString>;
2652
+ subcommand: z$1.ZodOptional<z$1.ZodString>;
2435
2653
  durationMs: z$1.ZodNumber;
2436
2654
  error: z$1.ZodOptional<z$1.ZodString>;
2437
- }, z$1.core.$strip> | z$1.ZodObject<{
2438
- dryRun: z$1.ZodBoolean;
2439
- }, z$1.core.$strip> | z$1.ZodObject<{
2440
- status: z$1.ZodEnum<{
2441
- success: "success";
2442
- failed: "failed";
2443
- "awaiting-approval": "awaiting-approval";
2444
- }>;
2445
- applied: z$1.ZodOptional<z$1.ZodNumber>;
2446
- awaitingApproval: z$1.ZodOptional<z$1.ZodNumber>;
2447
- error: z$1.ZodOptional<z$1.ZodString>;
2448
2655
  }, z$1.core.$strip> | z$1.ZodObject<{
2449
2656
  streamId: z$1.ZodString;
2450
2657
  step: z$1.ZodNumber;
@@ -2628,6 +2835,43 @@ declare function getEventInputSchema(event: HookEvent): z$1.ZodObject<{
2628
2835
  }>;
2629
2836
  cost: z$1.ZodOptional<z$1.ZodNumber>;
2630
2837
  tokens: z$1.ZodOptional<z$1.ZodNumber>;
2838
+ }, z$1.core.$strip> | z$1.ZodObject<{
2839
+ sessionId: z$1.ZodString;
2840
+ cwd: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodString>>;
2841
+ transcriptPath: z$1.ZodOptional<z$1.ZodString>;
2842
+ stopHookActive: z$1.ZodOptional<z$1.ZodBoolean>;
2843
+ result: z$1.ZodOptional<z$1.ZodEnum<{
2844
+ stop: "stop";
2845
+ continue: "continue";
2846
+ compact: "compact";
2847
+ }>>;
2848
+ }, z$1.core.$strip> | z$1.ZodObject<{
2849
+ sessionId: z$1.ZodString;
2850
+ reason: z$1.ZodOptional<z$1.ZodString>;
2851
+ }, z$1.core.$strip> | z$1.ZodObject<{
2852
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
2853
+ agentId: z$1.ZodString;
2854
+ agentName: z$1.ZodOptional<z$1.ZodString>;
2855
+ prompt: z$1.ZodOptional<z$1.ZodString>;
2856
+ }, z$1.core.$strip> | z$1.ZodObject<{
2857
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
2858
+ agentId: z$1.ZodString;
2859
+ agentName: z$1.ZodOptional<z$1.ZodString>;
2860
+ success: z$1.ZodBoolean;
2861
+ durationMs: z$1.ZodOptional<z$1.ZodNumber>;
2862
+ error: z$1.ZodOptional<z$1.ZodString>;
2863
+ }, z$1.core.$strip> | z$1.ZodObject<{
2864
+ sessionId: z$1.ZodOptional<z$1.ZodString>;
2865
+ message: z$1.ZodString;
2866
+ level: z$1.ZodOptional<z$1.ZodEnum<{
2867
+ error: "error";
2868
+ info: "info";
2869
+ warn: "warn";
2870
+ }>>;
2871
+ source: z$1.ZodOptional<z$1.ZodString>;
2872
+ }, z$1.core.$strip> | z$1.ZodObject<{
2873
+ cwd: z$1.ZodString;
2874
+ trusted: z$1.ZodBoolean;
2631
2875
  }, z$1.core.$strip>;
2632
2876
  declare function validateHookInput<T extends HookEvent>(event: T, input: unknown): unknown;
2633
2877
  declare function safeValidateHookInput<T extends HookEvent>(event: T, input: unknown): {
@@ -2651,7 +2895,9 @@ declare const HookEvent: {
2651
2895
  readonly SessionEnd: "session.end";
2652
2896
  readonly SessionCompacting: "session.compacting";
2653
2897
  readonly SessionCompact: "session.compact";
2898
+ readonly SessionInterrupt: "session.interrupt";
2654
2899
  readonly MessageReceive: "message.receive";
2900
+ readonly UserPromptSubmit: "user.prompt.submit";
2655
2901
  readonly MessageTransform: "message.transform";
2656
2902
  readonly SystemTransform: "system.transform";
2657
2903
  readonly ToolBefore: "tool.before";
@@ -2661,7 +2907,6 @@ declare const HookEvent: {
2661
2907
  readonly CommandBefore: "command.before";
2662
2908
  readonly CommandAfter: "command.after";
2663
2909
  readonly PermissionAsk: "permission.ask";
2664
- readonly PermissionDenied: "permission.denied";
2665
2910
  readonly LlmParams: "llm.params";
2666
2911
  readonly LlmHeaders: "llm.headers";
2667
2912
  readonly ShellEnv: "shell.env";
@@ -2679,12 +2924,17 @@ declare const HookEvent: {
2679
2924
  readonly CommandComplete: "scheduler.command.complete";
2680
2925
  readonly ContextBuildBefore: "context.build.before";
2681
2926
  readonly ContextBuildAfter: "context.build.after";
2927
+ readonly ContextCollect: "context.collect";
2928
+ readonly Stop: "agent.stop";
2682
2929
  readonly TaskStart: "task.start";
2683
2930
  readonly TaskRunning: "task.running";
2684
2931
  readonly TaskProgress: "task.progress";
2685
2932
  readonly TaskComplete: "task.complete";
2686
2933
  readonly LoopStart: "loop.start";
2687
2934
  readonly LoopEnd: "loop.end";
2935
+ readonly SubagentStart: "subagent.start";
2936
+ readonly SubagentStop: "subagent.stop";
2937
+ readonly Notification: "notification";
2688
2938
  readonly ProcessorStart: "processor.start";
2689
2939
  readonly ProcessorStepStart: "processor.step.start";
2690
2940
  readonly ProcessorReasoningStart: "processor.reasoning.start";
@@ -2700,19 +2950,111 @@ declare const HookEvent: {
2700
2950
  readonly ProcessorTextEnd: "processor.text.end";
2701
2951
  readonly ProcessorError: "processor.error";
2702
2952
  readonly ProcessorFinish: "processor.finish";
2953
+ readonly ProjectTrust: "project.trust";
2703
2954
  readonly CreationRequest: "creation.request";
2704
2955
  readonly CreationComplete: "creation.complete";
2705
- readonly EvolutionRequest: "evolution.request";
2706
- readonly EvolutionComplete: "evolution.complete";
2707
2956
  };
2708
2957
  type HookEvent = (typeof HookEvent)[keyof typeof HookEvent];
2709
- declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "message.receive" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "permission.denied" | "llm.params" | "llm.headers" | "shell.env" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end" | "processor.start" | "processor.step.start" | "processor.reasoning.start" | "processor.reasoning.delta" | "processor.reasoning.end" | "processor.tool.input.start" | "processor.tool.call" | "processor.tool.result" | "processor.tool.error" | "processor.step.finish" | "processor.text.start" | "processor.text.delta" | "processor.text.end" | "processor.error" | "processor.finish" | "creation.request" | "creation.complete" | "evolution.request" | "evolution.complete")[];
2958
+ declare const HOOK_EVENT_ALIASES: {
2959
+ readonly UserPromptSubmit: "user.prompt.submit";
2960
+ readonly Stop: "agent.stop";
2961
+ readonly PreToolUse: "tool.before";
2962
+ readonly PostToolUse: "tool.after";
2963
+ readonly PostToolUseFailure: "tool.failure";
2964
+ readonly SessionStart: "session.start";
2965
+ readonly SessionEnd: "session.end";
2966
+ readonly PreCompact: "session.compacting";
2967
+ readonly PostCompact: "session.compact";
2968
+ readonly SubagentStart: "subagent.start";
2969
+ readonly SubagentStop: "subagent.stop";
2970
+ readonly Notification: "notification";
2971
+ readonly StopCancelled: "session.interrupt";
2972
+ };
2973
+ type HookEventAlias = keyof typeof HOOK_EVENT_ALIASES;
2974
+ declare function normalizeHookEvent(event: string): HookEvent | string;
2975
+ declare const HOOK_EVENTS: ("session.start" | "session.end" | "session.compacting" | "session.compact" | "session.interrupt" | "message.receive" | "user.prompt.submit" | "message.transform" | "system.transform" | "tool.before" | "tool.after" | "tool.failure" | "tool.definition" | "command.before" | "command.after" | "permission.ask" | "llm.params" | "llm.headers" | "shell.env" | "gateway.message.receive" | "gateway.message.process" | "gateway.message.complete" | "gateway.message.send" | "gateway.message.delivered" | "gateway.message.read" | "scheduler.heartbeat.trigger" | "scheduler.heartbeat.complete" | "scheduler.task.trigger" | "scheduler.task.complete" | "scheduler.command.trigger" | "scheduler.command.complete" | "context.build.before" | "context.build.after" | "context.collect" | "agent.stop" | "task.start" | "task.running" | "task.progress" | "task.complete" | "loop.start" | "loop.end" | "subagent.start" | "subagent.stop" | "notification" | "processor.start" | "processor.step.start" | "processor.reasoning.start" | "processor.reasoning.delta" | "processor.reasoning.end" | "processor.tool.input.start" | "processor.tool.call" | "processor.tool.result" | "processor.tool.error" | "processor.step.finish" | "processor.text.start" | "processor.text.delta" | "processor.text.end" | "processor.error" | "processor.finish" | "project.trust" | "creation.request" | "creation.complete")[];
2976
+ type HookEventSemantics = 'chain' | 'collect';
2977
+ declare const HOOK_EVENT_SEMANTICS: {
2978
+ readonly "session.start": "chain";
2979
+ readonly "session.end": "collect";
2980
+ readonly "session.compacting": "chain";
2981
+ readonly "session.compact": "chain";
2982
+ readonly "session.interrupt": "collect";
2983
+ readonly "message.receive": "collect";
2984
+ readonly "user.prompt.submit": "chain";
2985
+ readonly "message.transform": "chain";
2986
+ readonly "system.transform": "chain";
2987
+ readonly "tool.before": "chain";
2988
+ readonly "tool.after": "chain";
2989
+ readonly "tool.failure": "collect";
2990
+ readonly "tool.definition": "chain";
2991
+ readonly "command.before": "chain";
2992
+ readonly "command.after": "chain";
2993
+ readonly "permission.ask": "chain";
2994
+ readonly "llm.params": "chain";
2995
+ readonly "llm.headers": "chain";
2996
+ readonly "shell.env": "chain";
2997
+ readonly "gateway.message.receive": "collect";
2998
+ readonly "gateway.message.process": "chain";
2999
+ readonly "gateway.message.complete": "collect";
3000
+ readonly "gateway.message.send": "chain";
3001
+ readonly "gateway.message.delivered": "collect";
3002
+ readonly "gateway.message.read": "collect";
3003
+ readonly "scheduler.heartbeat.trigger": "chain";
3004
+ readonly "scheduler.heartbeat.complete": "chain";
3005
+ readonly "scheduler.task.trigger": "chain";
3006
+ readonly "scheduler.task.complete": "chain";
3007
+ readonly "scheduler.command.trigger": "chain";
3008
+ readonly "scheduler.command.complete": "chain";
3009
+ readonly "context.build.before": "chain";
3010
+ readonly "context.build.after": "chain";
3011
+ readonly "context.collect": "collect";
3012
+ readonly "agent.stop": "chain";
3013
+ readonly "task.start": "chain";
3014
+ readonly "task.running": "chain";
3015
+ readonly "task.progress": "chain";
3016
+ readonly "task.complete": "chain";
3017
+ readonly "loop.start": "chain";
3018
+ readonly "loop.end": "chain";
3019
+ readonly "subagent.start": "collect";
3020
+ readonly "subagent.stop": "collect";
3021
+ readonly notification: "collect";
3022
+ readonly "processor.start": "chain";
3023
+ readonly "processor.step.start": "chain";
3024
+ readonly "processor.reasoning.start": "collect";
3025
+ readonly "processor.reasoning.delta": "collect";
3026
+ readonly "processor.reasoning.end": "collect";
3027
+ readonly "processor.tool.input.start": "collect";
3028
+ readonly "processor.tool.call": "collect";
3029
+ readonly "processor.tool.result": "collect";
3030
+ readonly "processor.tool.error": "chain";
3031
+ readonly "processor.step.finish": "chain";
3032
+ readonly "processor.text.start": "collect";
3033
+ readonly "processor.text.delta": "collect";
3034
+ readonly "processor.text.end": "collect";
3035
+ readonly "processor.error": "chain";
3036
+ readonly "processor.finish": "chain";
3037
+ readonly "project.trust": "collect";
3038
+ readonly "creation.request": "chain";
3039
+ readonly "creation.complete": "chain";
3040
+ };
3041
+ type HookEventOfSemantics<S extends HookEventSemantics> = {
3042
+ [K in HookEvent]: (typeof HOOK_EVENT_SEMANTICS)[K] extends S ? K : never;
3043
+ }[HookEvent];
3044
+ type CollectHookEvent = HookEventOfSemantics<'collect'>;
3045
+ type ChainHookEvent = HookEventOfSemantics<'chain'>;
3046
+ type HookResultFor<E extends HookEvent, T = unknown> = E extends CollectHookEvent ? HookCollectResult<T> : HookChainResult<T>;
3047
+ declare function getEventSemantics(event: HookEvent): HookEventSemantics;
3048
+ declare function isCollectEvent(event: HookEvent): event is CollectHookEvent;
2710
3049
  interface HookContext {
2711
3050
  sessionId?: string;
2712
3051
  agent?: string;
3052
+ agentId?: string;
2713
3053
  model?: string;
2714
3054
  cwd?: string;
2715
3055
  abort?: AbortSignal;
3056
+ session?(sessionId: string): SessionHandle;
3057
+ identity?(): IdentityHandle;
2716
3058
  [key: string]: unknown;
2717
3059
  }
2718
3060
  interface HookOutputWrapper<T = unknown> {
@@ -2779,6 +3121,12 @@ interface HookChainResult<T = unknown> {
2779
3121
  errors: HookError[];
2780
3122
  duration: number;
2781
3123
  }
3124
+ interface HookCollectResult<T = unknown> {
3125
+ outputs: unknown[];
3126
+ details: HookExecutionDetail[];
3127
+ errors: HookError[];
3128
+ duration: number;
3129
+ }
2782
3130
  interface HookInfo {
2783
3131
  name: string;
2784
3132
  init(): Promise<HookInitResult>;
@@ -2882,9 +3230,13 @@ interface SkillDefinition extends SkillMetadata {
2882
3230
 
2883
3231
  declare const PLUGIN_ID_PATTERN: RegExp;
2884
3232
  declare const PLUGIN_VERSION_PATTERN: RegExp;
2885
- declare const PLUGIN_CAPABILITIES: readonly ["hooks", "commands", "tools", "agents", "skills", "auth", "event", "config"];
3233
+ declare const PLUGIN_API_VERSION = "1.0.0";
3234
+ declare function compareSemVer(a: string, b: string): number;
3235
+ declare function satisfiesApiVersion(required: string | undefined, hostVersion?: string): boolean;
3236
+ declare const PLUGIN_CAPABILITIES: readonly ["hooks", "commands", "tools", "agents", "skills", "auth", "event", "config", "mcpServers", "setup"];
2886
3237
  type PluginCapability = (typeof PLUGIN_CAPABILITIES)[number];
2887
- declare const PLUGIN_DEFINITION_KEYS: readonly ["hooks", "commands", "tools", "agents", "skills", "auth", "event", "config"];
3238
+ declare const PLUGIN_DEFINITION_KEYS: readonly ["hooks", "commands", "tools", "agents", "skills", "auth", "event", "config", "mcpServers", "setup", "extensions"];
3239
+ type PluginDefinitionKey = (typeof PLUGIN_DEFINITION_KEYS)[number];
2888
3240
  declare const PLUGIN_HOOK_FAILURE_POLICIES: readonly ["fail-open", "fail-closed"];
2889
3241
  type PluginHookFailurePolicy = (typeof PLUGIN_HOOK_FAILURE_POLICIES)[number];
2890
3242
  declare const PLUGIN_ENTRY_EXTENSIONS: readonly [".mjs", ".js", ".cjs"];
@@ -2897,15 +3249,18 @@ declare const PluginManifestSchema: z.ZodObject<{
2897
3249
  version: z.ZodOptional<z.ZodString>;
2898
3250
  description: z.ZodOptional<z.ZodString>;
2899
3251
  entry: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
3252
+ apiVersion: z.ZodOptional<z.ZodString>;
2900
3253
  capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2901
3254
  event: "event";
2902
3255
  hooks: "hooks";
3256
+ skills: "skills";
2903
3257
  config: "config";
2904
3258
  tools: "tools";
2905
3259
  commands: "commands";
2906
3260
  agents: "agents";
2907
- skills: "skills";
2908
3261
  auth: "auth";
3262
+ mcpServers: "mcpServers";
3263
+ setup: "setup";
2909
3264
  }>>>;
2910
3265
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
2911
3266
  }, z.core.$strip>;
@@ -2927,6 +3282,7 @@ type DefinitionValidationResult = {
2927
3282
  interface DefinitionValidationOptions {
2928
3283
  capabilities?: readonly PluginCapability[];
2929
3284
  }
3285
+ declare function isZodSchema(value: unknown): boolean;
2930
3286
  declare function validatePluginDefinition(def: unknown, options?: DefinitionValidationOptions): DefinitionValidationResult;
2931
3287
 
2932
3288
  type PluginInput = {
@@ -2938,6 +3294,10 @@ type PluginInput = {
2938
3294
  $: EasbotShell;
2939
3295
  };
2940
3296
  type Plugin = (input: PluginInput) => Promise<PluginDefinition>;
3297
+ interface PluginSetupContext {
3298
+ readonly id: string;
3299
+ dispose(cleanup: () => void): void;
3300
+ }
2941
3301
  interface TextPrompt {
2942
3302
  type: 'text';
2943
3303
  key: string;
@@ -3007,17 +3367,30 @@ type AuthHook = {
3007
3367
  loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, unknown>>;
3008
3368
  methods: AuthMethod[];
3009
3369
  };
3370
+ interface PluginMcpServerConfig {
3371
+ type?: 'local' | 'remote';
3372
+ command?: string[];
3373
+ cwd?: string;
3374
+ environment?: Record<string, string>;
3375
+ url?: string;
3376
+ headers?: Record<string, string>;
3377
+ timeout?: number;
3378
+ enabled?: boolean;
3379
+ }
3010
3380
  interface PluginDefinition {
3011
3381
  hooks?: HookMatcher[];
3012
3382
  commands?: Record<string, CommandDefinition>;
3013
3383
  agents?: Record<string, AgentDefinition>;
3014
3384
  skills?: Record<string, SkillDefinition>;
3015
3385
  tools?: Record<string, ToolDefinition>;
3386
+ mcpServers?: Record<string, PluginMcpServerConfig>;
3016
3387
  event?: (input: {
3017
3388
  event: Event;
3018
3389
  }) => Promise<void>;
3019
3390
  config?: (input: Readonly<Config>) => Promise<void>;
3391
+ setup?: (ctx: PluginSetupContext) => Promise<void> | void;
3020
3392
  auth?: AuthHook;
3393
+ extensions?: Record<string, unknown>;
3021
3394
  }
3022
3395
 
3023
- export { type AgentDefinition, AgentExecutorSchema, type AgentHookDefinition, type AgentMetadata, AgentMetadataSchema, type AgentMode, AgentModeSchema, AgentSchema, type AgentScope, AgentScopeSchema, type ApiAuthMethod, type AuthApiResult, type AuthCallbackResult, type AuthCredential, type AuthHook, type AuthMethod, type AuthOAuthResult, type AuthPrompt, CallIDSchema, type CommandAfterInput, CommandAfterInputSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, type CreationCompleteInput, CreationCompleteInputSchema, type CreationRequestInput, CreationRequestInputSchema, CwdSchema, type DefinitionValidationOptions, type DefinitionValidationResult, EndReasonSchema, EventInputSchemas, type EvolutionCompleteInput, EvolutionCompleteInputSchema, type EvolutionRequestInput, EvolutionRequestInputSchema, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookExecutionDetail, type HookExecutor, type HookExecutorOutput, type HookExecutorRegistry, HookExecutorSchema, type HookHandler, type HookInfo, type HookInitResult, type HookMatcher, HookMatcherSchema, type HookMessageCallback, type HookOutputWrapper, type HookResult, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, type ManifestValidationResult, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type OAuthAuthMethod, PLUGIN_CAPABILITIES, PLUGIN_DEFINITION_KEYS, PLUGIN_ENTRY_EXTENSIONS, PLUGIN_ENTRY_NAMES, PLUGIN_HOOK_EXECUTOR_TYPES, PLUGIN_HOOK_FAILURE_POLICIES, PLUGIN_ID_PATTERN, PLUGIN_VERSION_PATTERN, PartIDSchema, type PermissionAskInput, PermissionAskInputSchema, type PermissionDeniedInput, PermissionDeniedInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginCapability, type PluginDefinition, type PluginHookFailurePolicy, type PluginInput, type PluginManifest, PluginManifestSchema, type ProcessorErrorInput, ProcessorErrorInputSchema, type ProcessorFinishInput, ProcessorFinishInputSchema, type ProcessorReasoningDeltaInput, ProcessorReasoningDeltaInputSchema, type ProcessorReasoningEndInput, ProcessorReasoningEndInputSchema, type ProcessorReasoningStartInput, ProcessorReasoningStartInputSchema, type ProcessorStartInput, ProcessorStartInputSchema, type ProcessorStepFinishInput, ProcessorStepFinishInputSchema, type ProcessorStepStartInput, ProcessorStepStartInputSchema, type ProcessorTextDeltaInput, ProcessorTextDeltaInputSchema, type ProcessorTextEndInput, ProcessorTextEndInputSchema, type ProcessorTextStartInput, ProcessorTextStartInputSchema, type ProcessorToolCallInput, ProcessorToolCallInputSchema, type ProcessorToolErrorInput, ProcessorToolErrorInputSchema, type ProcessorToolInputStartInput, ProcessorToolInputStartInputSchema, type ProcessorToolResultInput, ProcessorToolResultInputSchema, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SelectPrompt, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type SkillDefinition, type SkillInitContext, SkillInitContextSchema, type SkillInitResult, SkillInitResultSchema, type SkillMetadata, SkillMetadataSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextPrompt, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, getEventInputSchema, isValidPluginEntry, isValidPluginId, safeValidateHookInput, tool, validateHookInput, validatePluginDefinition, validatePluginManifest };
3396
+ export { type AgentDefinition, AgentExecutorSchema, type AgentHookDefinition, type AgentMetadata, AgentMetadataSchema, type AgentMode, AgentModeSchema, AgentSchema, type AgentScope, AgentScopeSchema, type ApiAuthMethod, type AuthApiResult, type AuthCallbackResult, type AuthCredential, type AuthHook, type AuthMethod, type AuthOAuthResult, type AuthPrompt, CallIDSchema, type ChainHookEvent, type CollectHookEvent, type CommandAfterInput, CommandAfterInputSchema, type CommandBeforeInput, CommandBeforeInputSchema, type CommandCompleteInput, CommandCompleteInputSchema, CommandExecutorSchema, type CommandHookDefinition, type CommandTaskDefinition, CommandTaskDefinitionSchema, type CommandTriggerInput, CommandTriggerInputSchema, ContentPartSchema, type ContextBuildAfterInput, ContextBuildAfterInputSchema, type ContextBuildBeforeInput, ContextBuildBeforeInputSchema, type ContextCollectInput, ContextCollectInputSchema, type ContextCollectOutput, ContextCollectOutputSchema, type ContextFragment, ContextFragmentSchema, type CreationCompleteInput, CreationCompleteInputSchema, type CreationRequestInput, CreationRequestInputSchema, CwdSchema, type DefinitionValidationOptions, type DefinitionValidationResult, EndReasonSchema, EventInputSchemas, FinishReasonSchema, FunctionExecutorSchema, type FunctionHookDefinition, type GatewayMessageCompleteInput, GatewayMessageCompleteInputSchema, type GatewayMessageDeliveredInput, GatewayMessageDeliveredInputSchema, type GatewayMessageProcessInput, GatewayMessageProcessInputSchema, type GatewayMessageReadInput, GatewayMessageReadInputSchema, type GatewayMessageReceiveInput, GatewayMessageReceiveInputSchema, type GatewayMessageSendInput, GatewayMessageSendInputSchema, HOOK_EVENTS, HOOK_EVENT_ALIASES, HOOK_EVENT_SEMANTICS, type HeartbeatCompleteInput, HeartbeatCompleteInputSchema, type HeartbeatTaskDefinition, HeartbeatTaskDefinitionSchema, type HeartbeatTriggerInput, HeartbeatTriggerInputSchema, type HookChainResult, type HookCollectResult, type HookContext, type HookDefinition, type HookError, HookEvent, type HookEventAlias, type HookEventOfSemantics, type HookEventSemantics, type HookExecutionDetail, type HookExecutor, type HookExecutorOutput, type HookExecutorRegistry, HookExecutorSchema, type HookHandler, type HookInfo, type HookInitResult, type HookMatcher, HookMatcherSchema, type HookMessageCallback, type HookOutputWrapper, type HookResult, type HookResultFor, HookType, type HooksConfig, HooksConfigSchema, HttpExecutorSchema, type HttpHookDefinition, type LlmHeadersInput, LlmHeadersInputSchema, type LlmParamsInput, LlmParamsInputSchema, LlmParamsSchema, LlmProviderSchema, type LoopEndInput, LoopEndInputSchema, type LoopStartInput, LoopStartInputSchema, type ManifestValidationResult, MessageIDSchema, type MessageReceiveInput, MessageReceiveInputSchema, MessageRoleSchema, MessageSchema, type MessageTransformInput, MessageTransformInputSchema, ModelObjectSchema, ModelSchema, type NotificationInput, NotificationInputSchema, type OAuthAuthMethod, PLUGIN_API_VERSION, PLUGIN_CAPABILITIES, PLUGIN_DEFINITION_KEYS, PLUGIN_ENTRY_EXTENSIONS, PLUGIN_ENTRY_NAMES, PLUGIN_HOOK_EXECUTOR_TYPES, PLUGIN_HOOK_FAILURE_POLICIES, PLUGIN_ID_PATTERN, PLUGIN_VERSION_PATTERN, PartIDSchema, type PermissionAskInput, PermissionAskInputSchema, PermissionLevelSchema, PermissionRequestSchema, type Plugin, type PluginCapability, type PluginDefinition, type PluginDefinitionKey, type PluginHookFailurePolicy, type PluginInput, type PluginManifest, PluginManifestSchema, type PluginMcpServerConfig, type PluginSetupContext, type ProcessorErrorInput, ProcessorErrorInputSchema, type ProcessorFinishInput, ProcessorFinishInputSchema, type ProcessorReasoningDeltaInput, ProcessorReasoningDeltaInputSchema, type ProcessorReasoningEndInput, ProcessorReasoningEndInputSchema, type ProcessorReasoningStartInput, ProcessorReasoningStartInputSchema, type ProcessorStartInput, ProcessorStartInputSchema, type ProcessorStepFinishInput, ProcessorStepFinishInputSchema, type ProcessorStepStartInput, ProcessorStepStartInputSchema, type ProcessorTextDeltaInput, ProcessorTextDeltaInputSchema, type ProcessorTextEndInput, ProcessorTextEndInputSchema, type ProcessorTextStartInput, ProcessorTextStartInputSchema, type ProcessorToolCallInput, ProcessorToolCallInputSchema, type ProcessorToolErrorInput, ProcessorToolErrorInputSchema, type ProcessorToolInputStartInput, ProcessorToolInputStartInputSchema, type ProcessorToolResultInput, ProcessorToolResultInputSchema, type ProjectTrustInput, ProjectTrustInputSchema, PromptExecutorSchema, type PromptHookDefinition, type ScheduledTaskCompleteInput, ScheduledTaskCompleteInputSchema, type ScheduledTaskTriggerInput, ScheduledTaskTriggerInputSchema, type SchedulerTaskDefinition, SchedulerTaskDefinitionSchema, type SelectPrompt, type SessionCompactInput, SessionCompactInputSchema, type SessionCompactingInput, SessionCompactingInputSchema, type SessionEndInput, SessionEndInputSchema, SessionIDSchema, type SessionInterruptInput, SessionInterruptInputSchema, type SessionStartInput, SessionStartInputSchema, type ShellEnvInput, ShellEnvInputSchema, type SkillDefinition, type SkillInitContext, SkillInitContextSchema, type SkillInitResult, SkillInitResultSchema, type SkillMetadata, SkillMetadataSchema, type StopInput, StopInputSchema, type StopOutput, StopOutputSchema, type SubagentStartInput, SubagentStartInputSchema, type SubagentStopInput, SubagentStopInputSchema, type SystemTransformInput, SystemTransformInputSchema, type TaskCompleteInput, TaskCompleteInputSchema, type TaskDefinition, type TaskProgressInput, TaskProgressInputSchema, type TaskRunningInput, TaskRunningInputSchema, type TaskSource, TaskSourceSchema, type TaskStartInput, TaskStartInputSchema, type TextPrompt, type ToolAfterInput, ToolAfterInputSchema, ToolArgsSchema, type ToolBeforeInput, ToolBeforeInputSchema, type ToolDefinitionInput, ToolDefinitionInputSchema, type ToolFailureInput, ToolFailureInputSchema, ToolResultSchema, type UserPromptSubmitInput, UserPromptSubmitInputSchema, type UserPromptSubmitOutput, UserPromptSubmitOutputSchema, compareSemVer, createTool, getEventInputSchema, getEventSemantics, isCollectEvent, isValidPluginEntry, isValidPluginId, isZodSchema, normalizeHookEvent, safeValidateHookInput, satisfiesApiVersion, tool, validateHookInput, validatePluginDefinition, validatePluginManifest };