@herdctl/core 0.0.2 → 0.2.0

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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/dist/config/__tests__/agent.test.js +30 -0
  3. package/dist/config/__tests__/agent.test.js.map +1 -1
  4. package/dist/config/__tests__/merge.test.js +1 -1
  5. package/dist/config/__tests__/merge.test.js.map +1 -1
  6. package/dist/config/index.d.ts +1 -1
  7. package/dist/config/index.d.ts.map +1 -1
  8. package/dist/config/index.js +3 -1
  9. package/dist/config/index.js.map +1 -1
  10. package/dist/config/schema.d.ts +1005 -3
  11. package/dist/config/schema.d.ts.map +1 -1
  12. package/dist/config/schema.js +87 -4
  13. package/dist/config/schema.js.map +1 -1
  14. package/dist/fleet-manager/__tests__/coverage.test.js +6 -2
  15. package/dist/fleet-manager/__tests__/coverage.test.js.map +1 -1
  16. package/dist/fleet-manager/__tests__/integration.test.js +5 -0
  17. package/dist/fleet-manager/__tests__/integration.test.js.map +1 -1
  18. package/dist/fleet-manager/__tests__/job-control.test.js +13 -14
  19. package/dist/fleet-manager/__tests__/job-control.test.js.map +1 -1
  20. package/dist/fleet-manager/__tests__/reload.test.js +13 -3
  21. package/dist/fleet-manager/__tests__/reload.test.js.map +1 -1
  22. package/dist/fleet-manager/__tests__/status-queries.test.js +6 -0
  23. package/dist/fleet-manager/__tests__/status-queries.test.js.map +1 -1
  24. package/dist/fleet-manager/__tests__/trigger.test.js +10 -2
  25. package/dist/fleet-manager/__tests__/trigger.test.js.map +1 -1
  26. package/dist/fleet-manager/config-reload.d.ts +1 -1
  27. package/dist/fleet-manager/config-reload.js +1 -1
  28. package/dist/fleet-manager/fleet-manager.d.ts +1 -0
  29. package/dist/fleet-manager/fleet-manager.d.ts.map +1 -1
  30. package/dist/fleet-manager/fleet-manager.js +1 -0
  31. package/dist/fleet-manager/fleet-manager.js.map +1 -1
  32. package/dist/fleet-manager/job-control.d.ts +41 -0
  33. package/dist/fleet-manager/job-control.d.ts.map +1 -1
  34. package/dist/fleet-manager/job-control.js +243 -20
  35. package/dist/fleet-manager/job-control.js.map +1 -1
  36. package/dist/fleet-manager/schedule-executor.d.ts +20 -0
  37. package/dist/fleet-manager/schedule-executor.d.ts.map +1 -1
  38. package/dist/fleet-manager/schedule-executor.js +113 -3
  39. package/dist/fleet-manager/schedule-executor.js.map +1 -1
  40. package/dist/fleet-manager/types.d.ts +18 -0
  41. package/dist/fleet-manager/types.d.ts.map +1 -1
  42. package/dist/hooks/__tests__/discord-runner.test.d.ts +5 -0
  43. package/dist/hooks/__tests__/discord-runner.test.d.ts.map +1 -0
  44. package/dist/hooks/__tests__/discord-runner.test.js +606 -0
  45. package/dist/hooks/__tests__/discord-runner.test.js.map +1 -0
  46. package/dist/hooks/__tests__/hook-executor.test.d.ts +5 -0
  47. package/dist/hooks/__tests__/hook-executor.test.d.ts.map +1 -0
  48. package/dist/hooks/__tests__/hook-executor.test.js +443 -0
  49. package/dist/hooks/__tests__/hook-executor.test.js.map +1 -0
  50. package/dist/hooks/__tests__/shell-runner.test.d.ts +5 -0
  51. package/dist/hooks/__tests__/shell-runner.test.d.ts.map +1 -0
  52. package/dist/hooks/__tests__/shell-runner.test.js +201 -0
  53. package/dist/hooks/__tests__/shell-runner.test.js.map +1 -0
  54. package/dist/hooks/__tests__/webhook-runner.test.d.ts +5 -0
  55. package/dist/hooks/__tests__/webhook-runner.test.d.ts.map +1 -0
  56. package/dist/hooks/__tests__/webhook-runner.test.js +453 -0
  57. package/dist/hooks/__tests__/webhook-runner.test.js.map +1 -0
  58. package/dist/hooks/hook-executor.d.ts +129 -0
  59. package/dist/hooks/hook-executor.d.ts.map +1 -0
  60. package/dist/hooks/hook-executor.js +195 -0
  61. package/dist/hooks/hook-executor.js.map +1 -0
  62. package/dist/hooks/index.d.ts +15 -0
  63. package/dist/hooks/index.d.ts.map +1 -0
  64. package/dist/hooks/index.js +18 -0
  65. package/dist/hooks/index.js.map +1 -0
  66. package/dist/hooks/runners/discord.d.ts +66 -0
  67. package/dist/hooks/runners/discord.d.ts.map +1 -0
  68. package/dist/hooks/runners/discord.js +294 -0
  69. package/dist/hooks/runners/discord.js.map +1 -0
  70. package/dist/hooks/runners/shell.d.ts +71 -0
  71. package/dist/hooks/runners/shell.d.ts.map +1 -0
  72. package/dist/hooks/runners/shell.js +177 -0
  73. package/dist/hooks/runners/shell.js.map +1 -0
  74. package/dist/hooks/runners/webhook.d.ts +66 -0
  75. package/dist/hooks/runners/webhook.d.ts.map +1 -0
  76. package/dist/hooks/runners/webhook.js +163 -0
  77. package/dist/hooks/runners/webhook.js.map +1 -0
  78. package/dist/hooks/types.d.ts +196 -0
  79. package/dist/hooks/types.d.ts.map +1 -0
  80. package/dist/hooks/types.js +12 -0
  81. package/dist/hooks/types.js.map +1 -0
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +2 -0
  85. package/dist/index.js.map +1 -1
  86. package/dist/runner/__tests__/sdk-adapter.test.js +4 -3
  87. package/dist/runner/__tests__/sdk-adapter.test.js.map +1 -1
  88. package/dist/runner/message-processor.d.ts +5 -1
  89. package/dist/runner/message-processor.d.ts.map +1 -1
  90. package/dist/runner/message-processor.js +238 -18
  91. package/dist/runner/message-processor.js.map +1 -1
  92. package/dist/runner/sdk-adapter.d.ts.map +1 -1
  93. package/dist/runner/sdk-adapter.js +8 -1
  94. package/dist/runner/sdk-adapter.js.map +1 -1
  95. package/dist/runner/types.d.ts +23 -2
  96. package/dist/runner/types.d.ts.map +1 -1
  97. package/dist/scheduler/scheduler.d.ts.map +1 -1
  98. package/dist/scheduler/scheduler.js +9 -0
  99. package/dist/scheduler/scheduler.js.map +1 -1
  100. package/dist/state/schemas/job-metadata.d.ts +4 -4
  101. package/package.json +1 -1
@@ -681,8 +681,11 @@ export declare const ScheduleSchema: z.ZodObject<{
681
681
  }>]>>;
682
682
  /** When true, job output is also written to .herdctl/jobs/{jobId}/output.log (default: false) */
683
683
  outputToFile: z.ZodOptional<z.ZodBoolean>;
684
+ /** When false, schedule will not auto-trigger but can still be manually triggered (default: true) */
685
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
684
686
  }, "strip", z.ZodTypeAny, {
685
687
  type: "interval" | "cron" | "webhook" | "chat";
688
+ enabled: boolean;
686
689
  work_source?: {
687
690
  type: "github";
688
691
  repo: string;
@@ -710,6 +713,7 @@ export declare const ScheduleSchema: z.ZodObject<{
710
713
  outputToFile?: boolean | undefined;
711
714
  }, {
712
715
  type: "interval" | "cron" | "webhook" | "chat";
716
+ enabled?: boolean | undefined;
713
717
  work_source?: {
714
718
  type: "github";
715
719
  repo: string;
@@ -1311,6 +1315,549 @@ export declare const AgentChatSchema: z.ZodObject<{
1311
1315
  } | undefined;
1312
1316
  } | undefined;
1313
1317
  }>;
1318
+ /**
1319
+ * Hook events that can trigger hooks
1320
+ */
1321
+ export declare const HookEventSchema: z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>;
1322
+ /**
1323
+ * Shell hook configuration - executes a shell command with HookContext on stdin
1324
+ */
1325
+ export declare const ShellHookConfigSchema: z.ZodObject<{
1326
+ /** Human-readable name for this hook (used in logs) */
1327
+ name: z.ZodOptional<z.ZodString>;
1328
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1329
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1330
+ /** Filter which events trigger this hook (default: all events) */
1331
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1332
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1333
+ when: z.ZodOptional<z.ZodString>;
1334
+ } & {
1335
+ type: z.ZodLiteral<"shell">;
1336
+ /** Shell command to execute */
1337
+ command: z.ZodString;
1338
+ /** Timeout in milliseconds (default: 30000) */
1339
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1340
+ }, "strip", z.ZodTypeAny, {
1341
+ type: "shell";
1342
+ timeout: number;
1343
+ command: string;
1344
+ continue_on_error: boolean;
1345
+ name?: string | undefined;
1346
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1347
+ when?: string | undefined;
1348
+ }, {
1349
+ type: "shell";
1350
+ command: string;
1351
+ timeout?: number | undefined;
1352
+ name?: string | undefined;
1353
+ continue_on_error?: boolean | undefined;
1354
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1355
+ when?: string | undefined;
1356
+ }>;
1357
+ /**
1358
+ * Webhook hook configuration - POSTs HookContext JSON to a URL
1359
+ */
1360
+ export declare const WebhookHookConfigSchema: z.ZodObject<{
1361
+ /** Human-readable name for this hook (used in logs) */
1362
+ name: z.ZodOptional<z.ZodString>;
1363
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1364
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1365
+ /** Filter which events trigger this hook (default: all events) */
1366
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1367
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1368
+ when: z.ZodOptional<z.ZodString>;
1369
+ } & {
1370
+ type: z.ZodLiteral<"webhook">;
1371
+ /** URL to POST the HookContext to */
1372
+ url: z.ZodString;
1373
+ /** HTTP method (default: POST) */
1374
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
1375
+ /** Custom headers (supports ${ENV_VAR} substitution) */
1376
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1377
+ /** Timeout in milliseconds (default: 10000) */
1378
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1379
+ }, "strip", z.ZodTypeAny, {
1380
+ type: "webhook";
1381
+ timeout: number;
1382
+ url: string;
1383
+ continue_on_error: boolean;
1384
+ method: "POST" | "PUT";
1385
+ name?: string | undefined;
1386
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1387
+ when?: string | undefined;
1388
+ headers?: Record<string, string> | undefined;
1389
+ }, {
1390
+ type: "webhook";
1391
+ url: string;
1392
+ timeout?: number | undefined;
1393
+ name?: string | undefined;
1394
+ continue_on_error?: boolean | undefined;
1395
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1396
+ when?: string | undefined;
1397
+ method?: "POST" | "PUT" | undefined;
1398
+ headers?: Record<string, string> | undefined;
1399
+ }>;
1400
+ /**
1401
+ * Discord hook configuration - sends notification to Discord channel
1402
+ */
1403
+ export declare const DiscordHookConfigSchema: z.ZodObject<{
1404
+ /** Human-readable name for this hook (used in logs) */
1405
+ name: z.ZodOptional<z.ZodString>;
1406
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1407
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1408
+ /** Filter which events trigger this hook (default: all events) */
1409
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1410
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1411
+ when: z.ZodOptional<z.ZodString>;
1412
+ } & {
1413
+ type: z.ZodLiteral<"discord">;
1414
+ /** Discord channel ID */
1415
+ channel_id: z.ZodString;
1416
+ /** Environment variable name containing the bot token */
1417
+ bot_token_env: z.ZodString;
1418
+ }, "strip", z.ZodTypeAny, {
1419
+ type: "discord";
1420
+ bot_token_env: string;
1421
+ continue_on_error: boolean;
1422
+ channel_id: string;
1423
+ name?: string | undefined;
1424
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1425
+ when?: string | undefined;
1426
+ }, {
1427
+ type: "discord";
1428
+ bot_token_env: string;
1429
+ channel_id: string;
1430
+ name?: string | undefined;
1431
+ continue_on_error?: boolean | undefined;
1432
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1433
+ when?: string | undefined;
1434
+ }>;
1435
+ /**
1436
+ * Union of all hook configuration types
1437
+ */
1438
+ export declare const HookConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1439
+ /** Human-readable name for this hook (used in logs) */
1440
+ name: z.ZodOptional<z.ZodString>;
1441
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1442
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1443
+ /** Filter which events trigger this hook (default: all events) */
1444
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1445
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1446
+ when: z.ZodOptional<z.ZodString>;
1447
+ } & {
1448
+ type: z.ZodLiteral<"shell">;
1449
+ /** Shell command to execute */
1450
+ command: z.ZodString;
1451
+ /** Timeout in milliseconds (default: 30000) */
1452
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1453
+ }, "strip", z.ZodTypeAny, {
1454
+ type: "shell";
1455
+ timeout: number;
1456
+ command: string;
1457
+ continue_on_error: boolean;
1458
+ name?: string | undefined;
1459
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1460
+ when?: string | undefined;
1461
+ }, {
1462
+ type: "shell";
1463
+ command: string;
1464
+ timeout?: number | undefined;
1465
+ name?: string | undefined;
1466
+ continue_on_error?: boolean | undefined;
1467
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1468
+ when?: string | undefined;
1469
+ }>, z.ZodObject<{
1470
+ /** Human-readable name for this hook (used in logs) */
1471
+ name: z.ZodOptional<z.ZodString>;
1472
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1473
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1474
+ /** Filter which events trigger this hook (default: all events) */
1475
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1476
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1477
+ when: z.ZodOptional<z.ZodString>;
1478
+ } & {
1479
+ type: z.ZodLiteral<"webhook">;
1480
+ /** URL to POST the HookContext to */
1481
+ url: z.ZodString;
1482
+ /** HTTP method (default: POST) */
1483
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
1484
+ /** Custom headers (supports ${ENV_VAR} substitution) */
1485
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1486
+ /** Timeout in milliseconds (default: 10000) */
1487
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1488
+ }, "strip", z.ZodTypeAny, {
1489
+ type: "webhook";
1490
+ timeout: number;
1491
+ url: string;
1492
+ continue_on_error: boolean;
1493
+ method: "POST" | "PUT";
1494
+ name?: string | undefined;
1495
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1496
+ when?: string | undefined;
1497
+ headers?: Record<string, string> | undefined;
1498
+ }, {
1499
+ type: "webhook";
1500
+ url: string;
1501
+ timeout?: number | undefined;
1502
+ name?: string | undefined;
1503
+ continue_on_error?: boolean | undefined;
1504
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1505
+ when?: string | undefined;
1506
+ method?: "POST" | "PUT" | undefined;
1507
+ headers?: Record<string, string> | undefined;
1508
+ }>, z.ZodObject<{
1509
+ /** Human-readable name for this hook (used in logs) */
1510
+ name: z.ZodOptional<z.ZodString>;
1511
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1512
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1513
+ /** Filter which events trigger this hook (default: all events) */
1514
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1515
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1516
+ when: z.ZodOptional<z.ZodString>;
1517
+ } & {
1518
+ type: z.ZodLiteral<"discord">;
1519
+ /** Discord channel ID */
1520
+ channel_id: z.ZodString;
1521
+ /** Environment variable name containing the bot token */
1522
+ bot_token_env: z.ZodString;
1523
+ }, "strip", z.ZodTypeAny, {
1524
+ type: "discord";
1525
+ bot_token_env: string;
1526
+ continue_on_error: boolean;
1527
+ channel_id: string;
1528
+ name?: string | undefined;
1529
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1530
+ when?: string | undefined;
1531
+ }, {
1532
+ type: "discord";
1533
+ bot_token_env: string;
1534
+ channel_id: string;
1535
+ name?: string | undefined;
1536
+ continue_on_error?: boolean | undefined;
1537
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1538
+ when?: string | undefined;
1539
+ }>]>;
1540
+ /**
1541
+ * Agent hooks configuration
1542
+ */
1543
+ export declare const AgentHooksSchema: z.ZodObject<{
1544
+ /** Hooks to run after every job (success or failure) */
1545
+ after_run: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1546
+ /** Human-readable name for this hook (used in logs) */
1547
+ name: z.ZodOptional<z.ZodString>;
1548
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1549
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1550
+ /** Filter which events trigger this hook (default: all events) */
1551
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1552
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1553
+ when: z.ZodOptional<z.ZodString>;
1554
+ } & {
1555
+ type: z.ZodLiteral<"shell">;
1556
+ /** Shell command to execute */
1557
+ command: z.ZodString;
1558
+ /** Timeout in milliseconds (default: 30000) */
1559
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1560
+ }, "strip", z.ZodTypeAny, {
1561
+ type: "shell";
1562
+ timeout: number;
1563
+ command: string;
1564
+ continue_on_error: boolean;
1565
+ name?: string | undefined;
1566
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1567
+ when?: string | undefined;
1568
+ }, {
1569
+ type: "shell";
1570
+ command: string;
1571
+ timeout?: number | undefined;
1572
+ name?: string | undefined;
1573
+ continue_on_error?: boolean | undefined;
1574
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1575
+ when?: string | undefined;
1576
+ }>, z.ZodObject<{
1577
+ /** Human-readable name for this hook (used in logs) */
1578
+ name: z.ZodOptional<z.ZodString>;
1579
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1580
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1581
+ /** Filter which events trigger this hook (default: all events) */
1582
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1583
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1584
+ when: z.ZodOptional<z.ZodString>;
1585
+ } & {
1586
+ type: z.ZodLiteral<"webhook">;
1587
+ /** URL to POST the HookContext to */
1588
+ url: z.ZodString;
1589
+ /** HTTP method (default: POST) */
1590
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
1591
+ /** Custom headers (supports ${ENV_VAR} substitution) */
1592
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1593
+ /** Timeout in milliseconds (default: 10000) */
1594
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1595
+ }, "strip", z.ZodTypeAny, {
1596
+ type: "webhook";
1597
+ timeout: number;
1598
+ url: string;
1599
+ continue_on_error: boolean;
1600
+ method: "POST" | "PUT";
1601
+ name?: string | undefined;
1602
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1603
+ when?: string | undefined;
1604
+ headers?: Record<string, string> | undefined;
1605
+ }, {
1606
+ type: "webhook";
1607
+ url: string;
1608
+ timeout?: number | undefined;
1609
+ name?: string | undefined;
1610
+ continue_on_error?: boolean | undefined;
1611
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1612
+ when?: string | undefined;
1613
+ method?: "POST" | "PUT" | undefined;
1614
+ headers?: Record<string, string> | undefined;
1615
+ }>, z.ZodObject<{
1616
+ /** Human-readable name for this hook (used in logs) */
1617
+ name: z.ZodOptional<z.ZodString>;
1618
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1619
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1620
+ /** Filter which events trigger this hook (default: all events) */
1621
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1622
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1623
+ when: z.ZodOptional<z.ZodString>;
1624
+ } & {
1625
+ type: z.ZodLiteral<"discord">;
1626
+ /** Discord channel ID */
1627
+ channel_id: z.ZodString;
1628
+ /** Environment variable name containing the bot token */
1629
+ bot_token_env: z.ZodString;
1630
+ }, "strip", z.ZodTypeAny, {
1631
+ type: "discord";
1632
+ bot_token_env: string;
1633
+ continue_on_error: boolean;
1634
+ channel_id: string;
1635
+ name?: string | undefined;
1636
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1637
+ when?: string | undefined;
1638
+ }, {
1639
+ type: "discord";
1640
+ bot_token_env: string;
1641
+ channel_id: string;
1642
+ name?: string | undefined;
1643
+ continue_on_error?: boolean | undefined;
1644
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1645
+ when?: string | undefined;
1646
+ }>]>, "many">>;
1647
+ /** Hooks to run only when a job fails */
1648
+ on_error: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1649
+ /** Human-readable name for this hook (used in logs) */
1650
+ name: z.ZodOptional<z.ZodString>;
1651
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1652
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1653
+ /** Filter which events trigger this hook (default: all events) */
1654
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1655
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1656
+ when: z.ZodOptional<z.ZodString>;
1657
+ } & {
1658
+ type: z.ZodLiteral<"shell">;
1659
+ /** Shell command to execute */
1660
+ command: z.ZodString;
1661
+ /** Timeout in milliseconds (default: 30000) */
1662
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1663
+ }, "strip", z.ZodTypeAny, {
1664
+ type: "shell";
1665
+ timeout: number;
1666
+ command: string;
1667
+ continue_on_error: boolean;
1668
+ name?: string | undefined;
1669
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1670
+ when?: string | undefined;
1671
+ }, {
1672
+ type: "shell";
1673
+ command: string;
1674
+ timeout?: number | undefined;
1675
+ name?: string | undefined;
1676
+ continue_on_error?: boolean | undefined;
1677
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1678
+ when?: string | undefined;
1679
+ }>, z.ZodObject<{
1680
+ /** Human-readable name for this hook (used in logs) */
1681
+ name: z.ZodOptional<z.ZodString>;
1682
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1683
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1684
+ /** Filter which events trigger this hook (default: all events) */
1685
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1686
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1687
+ when: z.ZodOptional<z.ZodString>;
1688
+ } & {
1689
+ type: z.ZodLiteral<"webhook">;
1690
+ /** URL to POST the HookContext to */
1691
+ url: z.ZodString;
1692
+ /** HTTP method (default: POST) */
1693
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
1694
+ /** Custom headers (supports ${ENV_VAR} substitution) */
1695
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1696
+ /** Timeout in milliseconds (default: 10000) */
1697
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1698
+ }, "strip", z.ZodTypeAny, {
1699
+ type: "webhook";
1700
+ timeout: number;
1701
+ url: string;
1702
+ continue_on_error: boolean;
1703
+ method: "POST" | "PUT";
1704
+ name?: string | undefined;
1705
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1706
+ when?: string | undefined;
1707
+ headers?: Record<string, string> | undefined;
1708
+ }, {
1709
+ type: "webhook";
1710
+ url: string;
1711
+ timeout?: number | undefined;
1712
+ name?: string | undefined;
1713
+ continue_on_error?: boolean | undefined;
1714
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1715
+ when?: string | undefined;
1716
+ method?: "POST" | "PUT" | undefined;
1717
+ headers?: Record<string, string> | undefined;
1718
+ }>, z.ZodObject<{
1719
+ /** Human-readable name for this hook (used in logs) */
1720
+ name: z.ZodOptional<z.ZodString>;
1721
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
1722
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1723
+ /** Filter which events trigger this hook (default: all events) */
1724
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
1725
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
1726
+ when: z.ZodOptional<z.ZodString>;
1727
+ } & {
1728
+ type: z.ZodLiteral<"discord">;
1729
+ /** Discord channel ID */
1730
+ channel_id: z.ZodString;
1731
+ /** Environment variable name containing the bot token */
1732
+ bot_token_env: z.ZodString;
1733
+ }, "strip", z.ZodTypeAny, {
1734
+ type: "discord";
1735
+ bot_token_env: string;
1736
+ continue_on_error: boolean;
1737
+ channel_id: string;
1738
+ name?: string | undefined;
1739
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1740
+ when?: string | undefined;
1741
+ }, {
1742
+ type: "discord";
1743
+ bot_token_env: string;
1744
+ channel_id: string;
1745
+ name?: string | undefined;
1746
+ continue_on_error?: boolean | undefined;
1747
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1748
+ when?: string | undefined;
1749
+ }>]>, "many">>;
1750
+ }, "strip", z.ZodTypeAny, {
1751
+ after_run?: ({
1752
+ type: "shell";
1753
+ timeout: number;
1754
+ command: string;
1755
+ continue_on_error: boolean;
1756
+ name?: string | undefined;
1757
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1758
+ when?: string | undefined;
1759
+ } | {
1760
+ type: "webhook";
1761
+ timeout: number;
1762
+ url: string;
1763
+ continue_on_error: boolean;
1764
+ method: "POST" | "PUT";
1765
+ name?: string | undefined;
1766
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1767
+ when?: string | undefined;
1768
+ headers?: Record<string, string> | undefined;
1769
+ } | {
1770
+ type: "discord";
1771
+ bot_token_env: string;
1772
+ continue_on_error: boolean;
1773
+ channel_id: string;
1774
+ name?: string | undefined;
1775
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1776
+ when?: string | undefined;
1777
+ })[] | undefined;
1778
+ on_error?: ({
1779
+ type: "shell";
1780
+ timeout: number;
1781
+ command: string;
1782
+ continue_on_error: boolean;
1783
+ name?: string | undefined;
1784
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1785
+ when?: string | undefined;
1786
+ } | {
1787
+ type: "webhook";
1788
+ timeout: number;
1789
+ url: string;
1790
+ continue_on_error: boolean;
1791
+ method: "POST" | "PUT";
1792
+ name?: string | undefined;
1793
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1794
+ when?: string | undefined;
1795
+ headers?: Record<string, string> | undefined;
1796
+ } | {
1797
+ type: "discord";
1798
+ bot_token_env: string;
1799
+ continue_on_error: boolean;
1800
+ channel_id: string;
1801
+ name?: string | undefined;
1802
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1803
+ when?: string | undefined;
1804
+ })[] | undefined;
1805
+ }, {
1806
+ after_run?: ({
1807
+ type: "shell";
1808
+ command: string;
1809
+ timeout?: number | undefined;
1810
+ name?: string | undefined;
1811
+ continue_on_error?: boolean | undefined;
1812
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1813
+ when?: string | undefined;
1814
+ } | {
1815
+ type: "webhook";
1816
+ url: string;
1817
+ timeout?: number | undefined;
1818
+ name?: string | undefined;
1819
+ continue_on_error?: boolean | undefined;
1820
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1821
+ when?: string | undefined;
1822
+ method?: "POST" | "PUT" | undefined;
1823
+ headers?: Record<string, string> | undefined;
1824
+ } | {
1825
+ type: "discord";
1826
+ bot_token_env: string;
1827
+ channel_id: string;
1828
+ name?: string | undefined;
1829
+ continue_on_error?: boolean | undefined;
1830
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1831
+ when?: string | undefined;
1832
+ })[] | undefined;
1833
+ on_error?: ({
1834
+ type: "shell";
1835
+ command: string;
1836
+ timeout?: number | undefined;
1837
+ name?: string | undefined;
1838
+ continue_on_error?: boolean | undefined;
1839
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1840
+ when?: string | undefined;
1841
+ } | {
1842
+ type: "webhook";
1843
+ url: string;
1844
+ timeout?: number | undefined;
1845
+ name?: string | undefined;
1846
+ continue_on_error?: boolean | undefined;
1847
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1848
+ when?: string | undefined;
1849
+ method?: "POST" | "PUT" | undefined;
1850
+ headers?: Record<string, string> | undefined;
1851
+ } | {
1852
+ type: "discord";
1853
+ bot_token_env: string;
1854
+ channel_id: string;
1855
+ name?: string | undefined;
1856
+ continue_on_error?: boolean | undefined;
1857
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
1858
+ when?: string | undefined;
1859
+ })[] | undefined;
1860
+ }>;
1314
1861
  export declare const AgentWorkspaceSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
1315
1862
  root: z.ZodString;
1316
1863
  auto_clone: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -1361,6 +1908,8 @@ export declare const AgentConfigSchema: z.ZodObject<{
1361
1908
  personality?: string | undefined;
1362
1909
  }>>;
1363
1910
  system_prompt: z.ZodOptional<z.ZodString>;
1911
+ /** Default prompt used when triggering without --prompt */
1912
+ default_prompt: z.ZodOptional<z.ZodString>;
1364
1913
  work_source: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1365
1914
  type: z.ZodLiteral<"github">;
1366
1915
  /** GitHub repository in owner/repo format (required) */
@@ -1540,8 +2089,11 @@ export declare const AgentConfigSchema: z.ZodObject<{
1540
2089
  }>]>>;
1541
2090
  /** When true, job output is also written to .herdctl/jobs/{jobId}/output.log (default: false) */
1542
2091
  outputToFile: z.ZodOptional<z.ZodBoolean>;
2092
+ /** When false, schedule will not auto-trigger but can still be manually triggered (default: true) */
2093
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1543
2094
  }, "strip", z.ZodTypeAny, {
1544
2095
  type: "interval" | "cron" | "webhook" | "chat";
2096
+ enabled: boolean;
1545
2097
  work_source?: {
1546
2098
  type: "github";
1547
2099
  repo: string;
@@ -1569,6 +2121,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
1569
2121
  outputToFile?: boolean | undefined;
1570
2122
  }, {
1571
2123
  type: "interval" | "cron" | "webhook" | "chat";
2124
+ enabled?: boolean | undefined;
1572
2125
  work_source?: {
1573
2126
  type: "github";
1574
2127
  repo: string;
@@ -1877,6 +2430,324 @@ export declare const AgentConfigSchema: z.ZodObject<{
1877
2430
  } | undefined;
1878
2431
  } | undefined;
1879
2432
  }>>;
2433
+ hooks: z.ZodOptional<z.ZodObject<{
2434
+ /** Hooks to run after every job (success or failure) */
2435
+ after_run: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2436
+ /** Human-readable name for this hook (used in logs) */
2437
+ name: z.ZodOptional<z.ZodString>;
2438
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2439
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2440
+ /** Filter which events trigger this hook (default: all events) */
2441
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2442
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2443
+ when: z.ZodOptional<z.ZodString>;
2444
+ } & {
2445
+ type: z.ZodLiteral<"shell">;
2446
+ /** Shell command to execute */
2447
+ command: z.ZodString;
2448
+ /** Timeout in milliseconds (default: 30000) */
2449
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
2450
+ }, "strip", z.ZodTypeAny, {
2451
+ type: "shell";
2452
+ timeout: number;
2453
+ command: string;
2454
+ continue_on_error: boolean;
2455
+ name?: string | undefined;
2456
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2457
+ when?: string | undefined;
2458
+ }, {
2459
+ type: "shell";
2460
+ command: string;
2461
+ timeout?: number | undefined;
2462
+ name?: string | undefined;
2463
+ continue_on_error?: boolean | undefined;
2464
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2465
+ when?: string | undefined;
2466
+ }>, z.ZodObject<{
2467
+ /** Human-readable name for this hook (used in logs) */
2468
+ name: z.ZodOptional<z.ZodString>;
2469
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2470
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2471
+ /** Filter which events trigger this hook (default: all events) */
2472
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2473
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2474
+ when: z.ZodOptional<z.ZodString>;
2475
+ } & {
2476
+ type: z.ZodLiteral<"webhook">;
2477
+ /** URL to POST the HookContext to */
2478
+ url: z.ZodString;
2479
+ /** HTTP method (default: POST) */
2480
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
2481
+ /** Custom headers (supports ${ENV_VAR} substitution) */
2482
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2483
+ /** Timeout in milliseconds (default: 10000) */
2484
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
2485
+ }, "strip", z.ZodTypeAny, {
2486
+ type: "webhook";
2487
+ timeout: number;
2488
+ url: string;
2489
+ continue_on_error: boolean;
2490
+ method: "POST" | "PUT";
2491
+ name?: string | undefined;
2492
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2493
+ when?: string | undefined;
2494
+ headers?: Record<string, string> | undefined;
2495
+ }, {
2496
+ type: "webhook";
2497
+ url: string;
2498
+ timeout?: number | undefined;
2499
+ name?: string | undefined;
2500
+ continue_on_error?: boolean | undefined;
2501
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2502
+ when?: string | undefined;
2503
+ method?: "POST" | "PUT" | undefined;
2504
+ headers?: Record<string, string> | undefined;
2505
+ }>, z.ZodObject<{
2506
+ /** Human-readable name for this hook (used in logs) */
2507
+ name: z.ZodOptional<z.ZodString>;
2508
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2509
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2510
+ /** Filter which events trigger this hook (default: all events) */
2511
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2512
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2513
+ when: z.ZodOptional<z.ZodString>;
2514
+ } & {
2515
+ type: z.ZodLiteral<"discord">;
2516
+ /** Discord channel ID */
2517
+ channel_id: z.ZodString;
2518
+ /** Environment variable name containing the bot token */
2519
+ bot_token_env: z.ZodString;
2520
+ }, "strip", z.ZodTypeAny, {
2521
+ type: "discord";
2522
+ bot_token_env: string;
2523
+ continue_on_error: boolean;
2524
+ channel_id: string;
2525
+ name?: string | undefined;
2526
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2527
+ when?: string | undefined;
2528
+ }, {
2529
+ type: "discord";
2530
+ bot_token_env: string;
2531
+ channel_id: string;
2532
+ name?: string | undefined;
2533
+ continue_on_error?: boolean | undefined;
2534
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2535
+ when?: string | undefined;
2536
+ }>]>, "many">>;
2537
+ /** Hooks to run only when a job fails */
2538
+ on_error: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2539
+ /** Human-readable name for this hook (used in logs) */
2540
+ name: z.ZodOptional<z.ZodString>;
2541
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2542
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2543
+ /** Filter which events trigger this hook (default: all events) */
2544
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2545
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2546
+ when: z.ZodOptional<z.ZodString>;
2547
+ } & {
2548
+ type: z.ZodLiteral<"shell">;
2549
+ /** Shell command to execute */
2550
+ command: z.ZodString;
2551
+ /** Timeout in milliseconds (default: 30000) */
2552
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
2553
+ }, "strip", z.ZodTypeAny, {
2554
+ type: "shell";
2555
+ timeout: number;
2556
+ command: string;
2557
+ continue_on_error: boolean;
2558
+ name?: string | undefined;
2559
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2560
+ when?: string | undefined;
2561
+ }, {
2562
+ type: "shell";
2563
+ command: string;
2564
+ timeout?: number | undefined;
2565
+ name?: string | undefined;
2566
+ continue_on_error?: boolean | undefined;
2567
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2568
+ when?: string | undefined;
2569
+ }>, z.ZodObject<{
2570
+ /** Human-readable name for this hook (used in logs) */
2571
+ name: z.ZodOptional<z.ZodString>;
2572
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2573
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2574
+ /** Filter which events trigger this hook (default: all events) */
2575
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2576
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2577
+ when: z.ZodOptional<z.ZodString>;
2578
+ } & {
2579
+ type: z.ZodLiteral<"webhook">;
2580
+ /** URL to POST the HookContext to */
2581
+ url: z.ZodString;
2582
+ /** HTTP method (default: POST) */
2583
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["POST", "PUT"]>>>;
2584
+ /** Custom headers (supports ${ENV_VAR} substitution) */
2585
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2586
+ /** Timeout in milliseconds (default: 10000) */
2587
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
2588
+ }, "strip", z.ZodTypeAny, {
2589
+ type: "webhook";
2590
+ timeout: number;
2591
+ url: string;
2592
+ continue_on_error: boolean;
2593
+ method: "POST" | "PUT";
2594
+ name?: string | undefined;
2595
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2596
+ when?: string | undefined;
2597
+ headers?: Record<string, string> | undefined;
2598
+ }, {
2599
+ type: "webhook";
2600
+ url: string;
2601
+ timeout?: number | undefined;
2602
+ name?: string | undefined;
2603
+ continue_on_error?: boolean | undefined;
2604
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2605
+ when?: string | undefined;
2606
+ method?: "POST" | "PUT" | undefined;
2607
+ headers?: Record<string, string> | undefined;
2608
+ }>, z.ZodObject<{
2609
+ /** Human-readable name for this hook (used in logs) */
2610
+ name: z.ZodOptional<z.ZodString>;
2611
+ /** Whether to continue with subsequent hooks if this hook fails (default: true) */
2612
+ continue_on_error: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2613
+ /** Filter which events trigger this hook (default: all events) */
2614
+ on_events: z.ZodOptional<z.ZodArray<z.ZodEnum<["completed", "failed", "timeout", "cancelled"]>, "many">>;
2615
+ /** Conditional execution: dot-notation path to a boolean field in the hook context (e.g., "metadata.shouldNotify") */
2616
+ when: z.ZodOptional<z.ZodString>;
2617
+ } & {
2618
+ type: z.ZodLiteral<"discord">;
2619
+ /** Discord channel ID */
2620
+ channel_id: z.ZodString;
2621
+ /** Environment variable name containing the bot token */
2622
+ bot_token_env: z.ZodString;
2623
+ }, "strip", z.ZodTypeAny, {
2624
+ type: "discord";
2625
+ bot_token_env: string;
2626
+ continue_on_error: boolean;
2627
+ channel_id: string;
2628
+ name?: string | undefined;
2629
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2630
+ when?: string | undefined;
2631
+ }, {
2632
+ type: "discord";
2633
+ bot_token_env: string;
2634
+ channel_id: string;
2635
+ name?: string | undefined;
2636
+ continue_on_error?: boolean | undefined;
2637
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2638
+ when?: string | undefined;
2639
+ }>]>, "many">>;
2640
+ }, "strip", z.ZodTypeAny, {
2641
+ after_run?: ({
2642
+ type: "shell";
2643
+ timeout: number;
2644
+ command: string;
2645
+ continue_on_error: boolean;
2646
+ name?: string | undefined;
2647
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2648
+ when?: string | undefined;
2649
+ } | {
2650
+ type: "webhook";
2651
+ timeout: number;
2652
+ url: string;
2653
+ continue_on_error: boolean;
2654
+ method: "POST" | "PUT";
2655
+ name?: string | undefined;
2656
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2657
+ when?: string | undefined;
2658
+ headers?: Record<string, string> | undefined;
2659
+ } | {
2660
+ type: "discord";
2661
+ bot_token_env: string;
2662
+ continue_on_error: boolean;
2663
+ channel_id: string;
2664
+ name?: string | undefined;
2665
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2666
+ when?: string | undefined;
2667
+ })[] | undefined;
2668
+ on_error?: ({
2669
+ type: "shell";
2670
+ timeout: number;
2671
+ command: string;
2672
+ continue_on_error: boolean;
2673
+ name?: string | undefined;
2674
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2675
+ when?: string | undefined;
2676
+ } | {
2677
+ type: "webhook";
2678
+ timeout: number;
2679
+ url: string;
2680
+ continue_on_error: boolean;
2681
+ method: "POST" | "PUT";
2682
+ name?: string | undefined;
2683
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2684
+ when?: string | undefined;
2685
+ headers?: Record<string, string> | undefined;
2686
+ } | {
2687
+ type: "discord";
2688
+ bot_token_env: string;
2689
+ continue_on_error: boolean;
2690
+ channel_id: string;
2691
+ name?: string | undefined;
2692
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2693
+ when?: string | undefined;
2694
+ })[] | undefined;
2695
+ }, {
2696
+ after_run?: ({
2697
+ type: "shell";
2698
+ command: string;
2699
+ timeout?: number | undefined;
2700
+ name?: string | undefined;
2701
+ continue_on_error?: boolean | undefined;
2702
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2703
+ when?: string | undefined;
2704
+ } | {
2705
+ type: "webhook";
2706
+ url: string;
2707
+ timeout?: number | undefined;
2708
+ name?: string | undefined;
2709
+ continue_on_error?: boolean | undefined;
2710
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2711
+ when?: string | undefined;
2712
+ method?: "POST" | "PUT" | undefined;
2713
+ headers?: Record<string, string> | undefined;
2714
+ } | {
2715
+ type: "discord";
2716
+ bot_token_env: string;
2717
+ channel_id: string;
2718
+ name?: string | undefined;
2719
+ continue_on_error?: boolean | undefined;
2720
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2721
+ when?: string | undefined;
2722
+ })[] | undefined;
2723
+ on_error?: ({
2724
+ type: "shell";
2725
+ command: string;
2726
+ timeout?: number | undefined;
2727
+ name?: string | undefined;
2728
+ continue_on_error?: boolean | undefined;
2729
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2730
+ when?: string | undefined;
2731
+ } | {
2732
+ type: "webhook";
2733
+ url: string;
2734
+ timeout?: number | undefined;
2735
+ name?: string | undefined;
2736
+ continue_on_error?: boolean | undefined;
2737
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2738
+ when?: string | undefined;
2739
+ method?: "POST" | "PUT" | undefined;
2740
+ headers?: Record<string, string> | undefined;
2741
+ } | {
2742
+ type: "discord";
2743
+ bot_token_env: string;
2744
+ channel_id: string;
2745
+ name?: string | undefined;
2746
+ continue_on_error?: boolean | undefined;
2747
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2748
+ when?: string | undefined;
2749
+ })[] | undefined;
2750
+ }>>;
1880
2751
  docker: z.ZodOptional<z.ZodObject<{
1881
2752
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1882
2753
  base_image: z.ZodOptional<z.ZodString>;
@@ -1897,7 +2768,9 @@ export declare const AgentConfigSchema: z.ZodObject<{
1897
2768
  model: z.ZodOptional<z.ZodString>;
1898
2769
  max_turns: z.ZodOptional<z.ZodNumber>;
1899
2770
  permission_mode: z.ZodOptional<z.ZodEnum<["default", "acceptEdits", "bypassPermissions", "plan"]>>;
1900
- }, "strip", z.ZodTypeAny, {
2771
+ /** Path to metadata JSON file written by agent (default: metadata.json in workspace) */
2772
+ metadata_file: z.ZodOptional<z.ZodString>;
2773
+ }, "strict", z.ZodTypeAny, {
1901
2774
  name: string;
1902
2775
  repo?: string | undefined;
1903
2776
  max_turns?: number | undefined;
@@ -1990,8 +2863,10 @@ export declare const AgentConfigSchema: z.ZodObject<{
1990
2863
  personality?: string | undefined;
1991
2864
  } | undefined;
1992
2865
  system_prompt?: string | undefined;
2866
+ default_prompt?: string | undefined;
1993
2867
  schedules?: Record<string, {
1994
2868
  type: "interval" | "cron" | "webhook" | "chat";
2869
+ enabled: boolean;
1995
2870
  work_source?: {
1996
2871
  type: "github";
1997
2872
  repo: string;
@@ -2024,6 +2899,63 @@ export declare const AgentConfigSchema: z.ZodObject<{
2024
2899
  url?: string | undefined;
2025
2900
  env?: Record<string, string> | undefined;
2026
2901
  }> | undefined;
2902
+ hooks?: {
2903
+ after_run?: ({
2904
+ type: "shell";
2905
+ timeout: number;
2906
+ command: string;
2907
+ continue_on_error: boolean;
2908
+ name?: string | undefined;
2909
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2910
+ when?: string | undefined;
2911
+ } | {
2912
+ type: "webhook";
2913
+ timeout: number;
2914
+ url: string;
2915
+ continue_on_error: boolean;
2916
+ method: "POST" | "PUT";
2917
+ name?: string | undefined;
2918
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2919
+ when?: string | undefined;
2920
+ headers?: Record<string, string> | undefined;
2921
+ } | {
2922
+ type: "discord";
2923
+ bot_token_env: string;
2924
+ continue_on_error: boolean;
2925
+ channel_id: string;
2926
+ name?: string | undefined;
2927
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2928
+ when?: string | undefined;
2929
+ })[] | undefined;
2930
+ on_error?: ({
2931
+ type: "shell";
2932
+ timeout: number;
2933
+ command: string;
2934
+ continue_on_error: boolean;
2935
+ name?: string | undefined;
2936
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2937
+ when?: string | undefined;
2938
+ } | {
2939
+ type: "webhook";
2940
+ timeout: number;
2941
+ url: string;
2942
+ continue_on_error: boolean;
2943
+ method: "POST" | "PUT";
2944
+ name?: string | undefined;
2945
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2946
+ when?: string | undefined;
2947
+ headers?: Record<string, string> | undefined;
2948
+ } | {
2949
+ type: "discord";
2950
+ bot_token_env: string;
2951
+ continue_on_error: boolean;
2952
+ channel_id: string;
2953
+ name?: string | undefined;
2954
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
2955
+ when?: string | undefined;
2956
+ })[] | undefined;
2957
+ } | undefined;
2958
+ metadata_file?: string | undefined;
2027
2959
  }, {
2028
2960
  name: string;
2029
2961
  repo?: string | undefined;
@@ -2117,8 +3049,10 @@ export declare const AgentConfigSchema: z.ZodObject<{
2117
3049
  personality?: string | undefined;
2118
3050
  } | undefined;
2119
3051
  system_prompt?: string | undefined;
3052
+ default_prompt?: string | undefined;
2120
3053
  schedules?: Record<string, {
2121
3054
  type: "interval" | "cron" | "webhook" | "chat";
3055
+ enabled?: boolean | undefined;
2122
3056
  work_source?: {
2123
3057
  type: "github";
2124
3058
  repo: string;
@@ -2151,6 +3085,63 @@ export declare const AgentConfigSchema: z.ZodObject<{
2151
3085
  url?: string | undefined;
2152
3086
  env?: Record<string, string> | undefined;
2153
3087
  }> | undefined;
3088
+ hooks?: {
3089
+ after_run?: ({
3090
+ type: "shell";
3091
+ command: string;
3092
+ timeout?: number | undefined;
3093
+ name?: string | undefined;
3094
+ continue_on_error?: boolean | undefined;
3095
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3096
+ when?: string | undefined;
3097
+ } | {
3098
+ type: "webhook";
3099
+ url: string;
3100
+ timeout?: number | undefined;
3101
+ name?: string | undefined;
3102
+ continue_on_error?: boolean | undefined;
3103
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3104
+ when?: string | undefined;
3105
+ method?: "POST" | "PUT" | undefined;
3106
+ headers?: Record<string, string> | undefined;
3107
+ } | {
3108
+ type: "discord";
3109
+ bot_token_env: string;
3110
+ channel_id: string;
3111
+ name?: string | undefined;
3112
+ continue_on_error?: boolean | undefined;
3113
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3114
+ when?: string | undefined;
3115
+ })[] | undefined;
3116
+ on_error?: ({
3117
+ type: "shell";
3118
+ command: string;
3119
+ timeout?: number | undefined;
3120
+ name?: string | undefined;
3121
+ continue_on_error?: boolean | undefined;
3122
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3123
+ when?: string | undefined;
3124
+ } | {
3125
+ type: "webhook";
3126
+ url: string;
3127
+ timeout?: number | undefined;
3128
+ name?: string | undefined;
3129
+ continue_on_error?: boolean | undefined;
3130
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3131
+ when?: string | undefined;
3132
+ method?: "POST" | "PUT" | undefined;
3133
+ headers?: Record<string, string> | undefined;
3134
+ } | {
3135
+ type: "discord";
3136
+ bot_token_env: string;
3137
+ channel_id: string;
3138
+ name?: string | undefined;
3139
+ continue_on_error?: boolean | undefined;
3140
+ on_events?: ("timeout" | "completed" | "failed" | "cancelled")[] | undefined;
3141
+ when?: string | undefined;
3142
+ })[] | undefined;
3143
+ } | undefined;
3144
+ metadata_file?: string | undefined;
2154
3145
  }>;
2155
3146
  export declare const DiscordChatSchema: z.ZodObject<{
2156
3147
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -2202,7 +3193,7 @@ export declare const FleetConfigSchema: z.ZodObject<{
2202
3193
  fleet: z.ZodOptional<z.ZodObject<{
2203
3194
  name: z.ZodOptional<z.ZodString>;
2204
3195
  description: z.ZodOptional<z.ZodString>;
2205
- }, "strip", z.ZodTypeAny, {
3196
+ }, "strict", z.ZodTypeAny, {
2206
3197
  name?: string | undefined;
2207
3198
  description?: string | undefined;
2208
3199
  }, {
@@ -2521,7 +3512,7 @@ export declare const FleetConfigSchema: z.ZodObject<{
2521
3512
  enabled?: boolean | undefined;
2522
3513
  base_image?: string | undefined;
2523
3514
  }>>;
2524
- }, "strip", z.ZodTypeAny, {
3515
+ }, "strict", z.ZodTypeAny, {
2525
3516
  version: number;
2526
3517
  agents: {
2527
3518
  path: string;
@@ -2707,4 +3698,15 @@ export type AgentChatDiscord = z.infer<typeof AgentChatDiscordSchema>;
2707
3698
  export type AgentChat = z.infer<typeof AgentChatSchema>;
2708
3699
  export type AgentWorkspace = z.infer<typeof AgentWorkspaceSchema>;
2709
3700
  export type AgentConfig = z.infer<typeof AgentConfigSchema>;
3701
+ export type HookEvent = z.infer<typeof HookEventSchema>;
3702
+ export type ShellHookConfig = z.infer<typeof ShellHookConfigSchema>;
3703
+ export type WebhookHookConfig = z.infer<typeof WebhookHookConfigSchema>;
3704
+ export type DiscordHookConfig = z.infer<typeof DiscordHookConfigSchema>;
3705
+ export type HookConfig = z.infer<typeof HookConfigSchema>;
3706
+ export type AgentHooks = z.infer<typeof AgentHooksSchema>;
3707
+ export type ShellHookConfigInput = z.input<typeof ShellHookConfigSchema>;
3708
+ export type WebhookHookConfigInput = z.input<typeof WebhookHookConfigSchema>;
3709
+ export type DiscordHookConfigInput = z.input<typeof DiscordHookConfigSchema>;
3710
+ export type HookConfigInput = z.input<typeof HookConfigSchema>;
3711
+ export type AgentHooksInput = z.input<typeof AgentHooksSchema>;
2710
3712
  //# sourceMappingURL=schema.d.ts.map