agentix-cli 0.9.0 → 0.13.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 (51) hide show
  1. package/README.md +51 -1
  2. package/dist/agent-5KIMJI3F.js +2 -0
  3. package/dist/{chunk-SBUX74OU.js → chunk-D6EDMQRV.js} +5 -5
  4. package/dist/chunk-HI24KAEY.js +54 -0
  5. package/dist/chunk-HI24KAEY.js.map +1 -0
  6. package/dist/chunk-MCJUAE6V.js +6 -0
  7. package/dist/chunk-MCJUAE6V.js.map +1 -0
  8. package/dist/chunk-QOYAX2FT.js +2 -0
  9. package/dist/chunk-QOYAX2FT.js.map +1 -0
  10. package/dist/chunk-QZP65I2H.js +45 -0
  11. package/dist/chunk-QZP65I2H.js.map +1 -0
  12. package/dist/chunk-T25UEXVK.js +126 -0
  13. package/dist/chunk-T25UEXVK.js.map +1 -0
  14. package/dist/chunk-VH23CDHL.js +157 -0
  15. package/dist/chunk-VH23CDHL.js.map +1 -0
  16. package/dist/chunk-WJ6ZF6EZ.js +6 -0
  17. package/dist/chunk-WJ6ZF6EZ.js.map +1 -0
  18. package/dist/cli.js +26 -29
  19. package/dist/cli.js.map +1 -1
  20. package/dist/compaction-7I3E5QUO.js +28 -0
  21. package/dist/compaction-7I3E5QUO.js.map +1 -0
  22. package/dist/config-HAD5E4YX.js +2 -0
  23. package/dist/index.d.ts +1084 -76
  24. package/dist/index.js +39 -35
  25. package/dist/index.js.map +1 -1
  26. package/dist/loader-YQE6XJBT.js +2 -0
  27. package/dist/registry-CDWY7CLL.js +2 -0
  28. package/dist/workspace-setup-QQTCJY4B.js +2 -0
  29. package/dist/workspace-setup-QQTCJY4B.js.map +1 -0
  30. package/package.json +1 -1
  31. package/dist/agent-QYQVGKLM.js +0 -2
  32. package/dist/chunk-BAIQJHQF.js +0 -64
  33. package/dist/chunk-BAIQJHQF.js.map +0 -1
  34. package/dist/chunk-BHDLKX3G.js +0 -6
  35. package/dist/chunk-BHDLKX3G.js.map +0 -1
  36. package/dist/chunk-FRFR27IN.js +0 -3
  37. package/dist/chunk-FRFR27IN.js.map +0 -1
  38. package/dist/chunk-IVVVYXPH.js +0 -136
  39. package/dist/chunk-IVVVYXPH.js.map +0 -1
  40. package/dist/chunk-X32247GM.js +0 -2
  41. package/dist/chunk-X32247GM.js.map +0 -1
  42. package/dist/compaction-E3MQRLTL.js +0 -28
  43. package/dist/compaction-E3MQRLTL.js.map +0 -1
  44. package/dist/config-MSWKC466.js +0 -2
  45. package/dist/loader-6VSM6FSY.js +0 -2
  46. package/dist/registry-FP6FUOXF.js +0 -2
  47. /package/dist/{agent-QYQVGKLM.js.map → agent-5KIMJI3F.js.map} +0 -0
  48. /package/dist/{chunk-SBUX74OU.js.map → chunk-D6EDMQRV.js.map} +0 -0
  49. /package/dist/{config-MSWKC466.js.map → config-HAD5E4YX.js.map} +0 -0
  50. /package/dist/{loader-6VSM6FSY.js.map → loader-YQE6XJBT.js.map} +0 -0
  51. /package/dist/{registry-FP6FUOXF.js.map → registry-CDWY7CLL.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { IncomingMessage as IncomingMessage$1, ServerResponse } from 'http';
2
3
  import { PackageJson } from 'type-fest';
3
4
 
4
5
  interface GenerationMessage {
@@ -410,6 +411,8 @@ declare const skillFrontmatterSchema: z.ZodObject<{
410
411
  pattern: string;
411
412
  description?: string | undefined;
412
413
  }>, "many">>;
414
+ /** If true, skill is auto-injected into context when triggers match (per-turn) */
415
+ autoInject: z.ZodOptional<z.ZodBoolean>;
413
416
  }, "strip", z.ZodTypeAny, {
414
417
  name: string;
415
418
  description: string;
@@ -421,6 +424,7 @@ declare const skillFrontmatterSchema: z.ZodObject<{
421
424
  pattern: string;
422
425
  description?: string | undefined;
423
426
  }[] | undefined;
427
+ autoInject?: boolean | undefined;
424
428
  }, {
425
429
  name: string;
426
430
  description: string;
@@ -432,6 +436,7 @@ declare const skillFrontmatterSchema: z.ZodObject<{
432
436
  pattern: string;
433
437
  description?: string | undefined;
434
438
  }[] | undefined;
439
+ autoInject?: boolean | undefined;
435
440
  }>;
436
441
  type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>;
437
442
  interface Skill {
@@ -1345,7 +1350,7 @@ declare const cronJobSchema: z.ZodObject<{
1345
1350
  prompt: z.ZodString;
1346
1351
  timeout: z.ZodDefault<z.ZodNumber>;
1347
1352
  model: z.ZodOptional<z.ZodString>;
1348
- onError: z.ZodDefault<z.ZodEnum<["log", "notify", "disable"]>>;
1353
+ onError: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["log", "notify", "disable"]>, z.ZodArray<z.ZodEnum<["log", "notify", "disable"]>, "many">]>>, ("log" | "notify" | "disable")[], "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined>;
1349
1354
  notify: z.ZodOptional<z.ZodObject<{
1350
1355
  channel: z.ZodString;
1351
1356
  chatId: z.ZodString;
@@ -1366,7 +1371,7 @@ declare const cronJobSchema: z.ZodObject<{
1366
1371
  timeout: number;
1367
1372
  schedule: string;
1368
1373
  timezone: string;
1369
- onError: "log" | "notify" | "disable";
1374
+ onError: ("log" | "notify" | "disable")[];
1370
1375
  model?: string | undefined;
1371
1376
  notify?: {
1372
1377
  channel: string;
@@ -1386,7 +1391,7 @@ declare const cronJobSchema: z.ZodObject<{
1386
1391
  chatId: string;
1387
1392
  accountId?: string | undefined;
1388
1393
  } | undefined;
1389
- onError?: "log" | "notify" | "disable" | undefined;
1394
+ onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
1390
1395
  }>;
1391
1396
  declare const meshPeerSchema: z.ZodObject<{
1392
1397
  url: z.ZodString;
@@ -1406,13 +1411,17 @@ declare const daemonConfigSchema: z.ZodObject<{
1406
1411
  id: z.ZodString;
1407
1412
  name: z.ZodString;
1408
1413
  bind: z.ZodDefault<z.ZodString>;
1414
+ /** Default agent for voice/API calls that don't specify one (e.g. Siri) */
1415
+ defaultAgent: z.ZodOptional<z.ZodString>;
1409
1416
  }, "strip", z.ZodTypeAny, {
1410
1417
  id: string;
1411
1418
  name: string;
1412
1419
  bind: string;
1420
+ defaultAgent?: string | undefined;
1413
1421
  }, {
1414
1422
  id: string;
1415
1423
  name: string;
1424
+ defaultAgent?: string | undefined;
1416
1425
  bind?: string | undefined;
1417
1426
  }>;
1418
1427
  providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1652,6 +1661,23 @@ declare const daemonConfigSchema: z.ZodObject<{
1652
1661
  }[] | undefined;
1653
1662
  }>>;
1654
1663
  }, "strip", z.ZodTypeAny, {
1664
+ gitlab: {
1665
+ enabled: boolean;
1666
+ routes: {
1667
+ agent: string;
1668
+ project: string;
1669
+ }[];
1670
+ webhookPort: number;
1671
+ host: string;
1672
+ agentMappings: {
1673
+ agentId: string;
1674
+ gitlabUsernames: string[];
1675
+ keywords: string[];
1676
+ token?: string | undefined;
1677
+ }[];
1678
+ token?: string | undefined;
1679
+ webhookSecret?: string | undefined;
1680
+ };
1655
1681
  telegram: {
1656
1682
  enabled: boolean;
1657
1683
  accounts: Record<string, {
@@ -1679,24 +1705,24 @@ declare const daemonConfigSchema: z.ZodObject<{
1679
1705
  token?: string | undefined;
1680
1706
  agentBinding?: string | undefined;
1681
1707
  };
1682
- gitlab: {
1683
- enabled: boolean;
1684
- routes: {
1708
+ }, {
1709
+ gitlab?: {
1710
+ enabled?: boolean | undefined;
1711
+ token?: string | undefined;
1712
+ routes?: {
1685
1713
  agent: string;
1686
1714
  project: string;
1687
- }[];
1688
- webhookPort: number;
1689
- host: string;
1690
- agentMappings: {
1715
+ }[] | undefined;
1716
+ webhookPort?: number | undefined;
1717
+ webhookSecret?: string | undefined;
1718
+ host?: string | undefined;
1719
+ agentMappings?: {
1691
1720
  agentId: string;
1692
- gitlabUsernames: string[];
1693
- keywords: string[];
1694
1721
  token?: string | undefined;
1695
- }[];
1696
- token?: string | undefined;
1697
- webhookSecret?: string | undefined;
1698
- };
1699
- }, {
1722
+ gitlabUsernames?: string[] | undefined;
1723
+ keywords?: string[] | undefined;
1724
+ }[] | undefined;
1725
+ } | undefined;
1700
1726
  telegram?: {
1701
1727
  enabled?: boolean | undefined;
1702
1728
  accounts?: Record<string, {
@@ -1724,23 +1750,6 @@ declare const daemonConfigSchema: z.ZodObject<{
1724
1750
  token?: string | undefined;
1725
1751
  agentBinding?: string | undefined;
1726
1752
  } | undefined;
1727
- gitlab?: {
1728
- enabled?: boolean | undefined;
1729
- token?: string | undefined;
1730
- routes?: {
1731
- agent: string;
1732
- project: string;
1733
- }[] | undefined;
1734
- webhookPort?: number | undefined;
1735
- webhookSecret?: string | undefined;
1736
- host?: string | undefined;
1737
- agentMappings?: {
1738
- agentId: string;
1739
- token?: string | undefined;
1740
- gitlabUsernames?: string[] | undefined;
1741
- keywords?: string[] | undefined;
1742
- }[] | undefined;
1743
- } | undefined;
1744
1753
  }>>;
1745
1754
  crons: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1746
1755
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1750,7 +1759,7 @@ declare const daemonConfigSchema: z.ZodObject<{
1750
1759
  prompt: z.ZodString;
1751
1760
  timeout: z.ZodDefault<z.ZodNumber>;
1752
1761
  model: z.ZodOptional<z.ZodString>;
1753
- onError: z.ZodDefault<z.ZodEnum<["log", "notify", "disable"]>>;
1762
+ onError: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["log", "notify", "disable"]>, z.ZodArray<z.ZodEnum<["log", "notify", "disable"]>, "many">]>>, ("log" | "notify" | "disable")[], "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined>;
1754
1763
  notify: z.ZodOptional<z.ZodObject<{
1755
1764
  channel: z.ZodString;
1756
1765
  chatId: z.ZodString;
@@ -1771,7 +1780,7 @@ declare const daemonConfigSchema: z.ZodObject<{
1771
1780
  timeout: number;
1772
1781
  schedule: string;
1773
1782
  timezone: string;
1774
- onError: "log" | "notify" | "disable";
1783
+ onError: ("log" | "notify" | "disable")[];
1775
1784
  model?: string | undefined;
1776
1785
  notify?: {
1777
1786
  channel: string;
@@ -1791,8 +1800,127 @@ declare const daemonConfigSchema: z.ZodObject<{
1791
1800
  chatId: string;
1792
1801
  accountId?: string | undefined;
1793
1802
  } | undefined;
1794
- onError?: "log" | "notify" | "disable" | undefined;
1803
+ onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
1804
+ }>>>;
1805
+ services: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1806
+ name: z.ZodString;
1807
+ triggers: z.ZodArray<z.ZodObject<{
1808
+ pattern: z.ZodString;
1809
+ channel: z.ZodOptional<z.ZodString>;
1810
+ }, "strip", z.ZodTypeAny, {
1811
+ pattern: string;
1812
+ channel?: string | undefined;
1813
+ }, {
1814
+ pattern: string;
1815
+ channel?: string | undefined;
1816
+ }>, "many">;
1817
+ allowedContacts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1818
+ agent: z.ZodString;
1819
+ prompt: z.ZodString;
1820
+ schedule: z.ZodOptional<z.ZodString>;
1821
+ timezone: z.ZodDefault<z.ZodString>;
1822
+ notify: z.ZodOptional<z.ZodObject<{
1823
+ channel: z.ZodString;
1824
+ chatId: z.ZodString;
1825
+ accountId: z.ZodOptional<z.ZodString>;
1826
+ }, "strip", z.ZodTypeAny, {
1827
+ channel: string;
1828
+ chatId: string;
1829
+ accountId?: string | undefined;
1830
+ }, {
1831
+ channel: string;
1832
+ chatId: string;
1833
+ accountId?: string | undefined;
1834
+ }>>;
1835
+ }, "strip", z.ZodTypeAny, {
1836
+ agent: string;
1837
+ name: string;
1838
+ prompt: string;
1839
+ triggers: {
1840
+ pattern: string;
1841
+ channel?: string | undefined;
1842
+ }[];
1843
+ timezone: string;
1844
+ schedule?: string | undefined;
1845
+ notify?: {
1846
+ channel: string;
1847
+ chatId: string;
1848
+ accountId?: string | undefined;
1849
+ } | undefined;
1850
+ allowedContacts?: string[] | undefined;
1851
+ }, {
1852
+ agent: string;
1853
+ name: string;
1854
+ prompt: string;
1855
+ triggers: {
1856
+ pattern: string;
1857
+ channel?: string | undefined;
1858
+ }[];
1859
+ schedule?: string | undefined;
1860
+ timezone?: string | undefined;
1861
+ notify?: {
1862
+ channel: string;
1863
+ chatId: string;
1864
+ accountId?: string | undefined;
1865
+ } | undefined;
1866
+ allowedContacts?: string[] | undefined;
1795
1867
  }>>>;
1868
+ notifications: z.ZodDefault<z.ZodObject<{
1869
+ /** Send notification when task takes longer than this (seconds). 0 = disabled. */
1870
+ longTaskThreshold: z.ZodDefault<z.ZodNumber>;
1871
+ /** Where to send notifications */
1872
+ destination: z.ZodOptional<z.ZodObject<{
1873
+ channel: z.ZodString;
1874
+ chatId: z.ZodString;
1875
+ accountId: z.ZodOptional<z.ZodString>;
1876
+ }, "strip", z.ZodTypeAny, {
1877
+ channel: string;
1878
+ chatId: string;
1879
+ accountId?: string | undefined;
1880
+ }, {
1881
+ channel: string;
1882
+ chatId: string;
1883
+ accountId?: string | undefined;
1884
+ }>>;
1885
+ /** Notify on these events */
1886
+ on: z.ZodDefault<z.ZodObject<{
1887
+ taskComplete: z.ZodDefault<z.ZodBoolean>;
1888
+ taskError: z.ZodDefault<z.ZodBoolean>;
1889
+ taskQueued: z.ZodDefault<z.ZodBoolean>;
1890
+ }, "strip", z.ZodTypeAny, {
1891
+ taskComplete: boolean;
1892
+ taskError: boolean;
1893
+ taskQueued: boolean;
1894
+ }, {
1895
+ taskComplete?: boolean | undefined;
1896
+ taskError?: boolean | undefined;
1897
+ taskQueued?: boolean | undefined;
1898
+ }>>;
1899
+ }, "strip", z.ZodTypeAny, {
1900
+ on: {
1901
+ taskComplete: boolean;
1902
+ taskError: boolean;
1903
+ taskQueued: boolean;
1904
+ };
1905
+ longTaskThreshold: number;
1906
+ destination?: {
1907
+ channel: string;
1908
+ chatId: string;
1909
+ accountId?: string | undefined;
1910
+ } | undefined;
1911
+ }, {
1912
+ on?: {
1913
+ taskComplete?: boolean | undefined;
1914
+ taskError?: boolean | undefined;
1915
+ taskQueued?: boolean | undefined;
1916
+ } | undefined;
1917
+ longTaskThreshold?: number | undefined;
1918
+ destination?: {
1919
+ channel: string;
1920
+ chatId: string;
1921
+ accountId?: string | undefined;
1922
+ } | undefined;
1923
+ }>>;
1796
1924
  mesh: z.ZodDefault<z.ZodObject<{
1797
1925
  enabled: z.ZodDefault<z.ZodBoolean>;
1798
1926
  peers: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1844,6 +1972,216 @@ declare const daemonConfigSchema: z.ZodObject<{
1844
1972
  interval?: number | undefined;
1845
1973
  } | undefined;
1846
1974
  }>>;
1975
+ business: z.ZodOptional<z.ZodObject<{
1976
+ enabled: z.ZodDefault<z.ZodBoolean>;
1977
+ timezone: z.ZodDefault<z.ZodString>;
1978
+ mainChannel: z.ZodObject<{
1979
+ channel: z.ZodString;
1980
+ chatId: z.ZodString;
1981
+ accountId: z.ZodOptional<z.ZodString>;
1982
+ }, "strip", z.ZodTypeAny, {
1983
+ channel: string;
1984
+ chatId: string;
1985
+ accountId?: string | undefined;
1986
+ }, {
1987
+ channel: string;
1988
+ chatId: string;
1989
+ accountId?: string | undefined;
1990
+ }>;
1991
+ workSource: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1992
+ type: z.ZodLiteral<"backlog">;
1993
+ path: z.ZodDefault<z.ZodString>;
1994
+ }, "strip", z.ZodTypeAny, {
1995
+ path: string;
1996
+ type: "backlog";
1997
+ }, {
1998
+ type: "backlog";
1999
+ path?: string | undefined;
2000
+ }>, z.ZodObject<{
2001
+ type: z.ZodLiteral<"gitlab">;
2002
+ projects: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2003
+ }, "strip", z.ZodTypeAny, {
2004
+ type: "gitlab";
2005
+ projects: string[];
2006
+ }, {
2007
+ type: "gitlab";
2008
+ projects?: string[] | undefined;
2009
+ }>, z.ZodObject<{
2010
+ type: z.ZodLiteral<"wiki">;
2011
+ path: z.ZodString;
2012
+ glob: z.ZodDefault<z.ZodString>;
2013
+ }, "strip", z.ZodTypeAny, {
2014
+ path: string;
2015
+ type: "wiki";
2016
+ glob: string;
2017
+ }, {
2018
+ path: string;
2019
+ type: "wiki";
2020
+ glob?: string | undefined;
2021
+ }>]>;
2022
+ roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
2023
+ title: z.ZodString;
2024
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2025
+ sopPath: z.ZodOptional<z.ZodString>;
2026
+ kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2027
+ }, "strip", z.ZodTypeAny, {
2028
+ title: string;
2029
+ responsibilities: string[];
2030
+ kpis: string[];
2031
+ sopPath?: string | undefined;
2032
+ }, {
2033
+ title: string;
2034
+ responsibilities?: string[] | undefined;
2035
+ sopPath?: string | undefined;
2036
+ kpis?: string[] | undefined;
2037
+ }>>>;
2038
+ orgChart: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
2039
+ role: z.ZodString;
2040
+ reportsTo: z.ZodOptional<z.ZodString>;
2041
+ schedule: z.ZodObject<{
2042
+ days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
2043
+ start: z.ZodString;
2044
+ end: z.ZodString;
2045
+ lunch: z.ZodOptional<z.ZodObject<{
2046
+ start: z.ZodString;
2047
+ end: z.ZodString;
2048
+ }, "strip", z.ZodTypeAny, {
2049
+ start: string;
2050
+ end: string;
2051
+ }, {
2052
+ start: string;
2053
+ end: string;
2054
+ }>>;
2055
+ }, "strip", z.ZodTypeAny, {
2056
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
2057
+ start: string;
2058
+ end: string;
2059
+ lunch?: {
2060
+ start: string;
2061
+ end: string;
2062
+ } | undefined;
2063
+ }, {
2064
+ start: string;
2065
+ end: string;
2066
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2067
+ lunch?: {
2068
+ start: string;
2069
+ end: string;
2070
+ } | undefined;
2071
+ }>;
2072
+ utilizationTarget: z.ZodDefault<z.ZodNumber>;
2073
+ }, "strip", z.ZodTypeAny, {
2074
+ role: string;
2075
+ schedule: {
2076
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
2077
+ start: string;
2078
+ end: string;
2079
+ lunch?: {
2080
+ start: string;
2081
+ end: string;
2082
+ } | undefined;
2083
+ };
2084
+ utilizationTarget: number;
2085
+ reportsTo?: string | undefined;
2086
+ }, {
2087
+ role: string;
2088
+ schedule: {
2089
+ start: string;
2090
+ end: string;
2091
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2092
+ lunch?: {
2093
+ start: string;
2094
+ end: string;
2095
+ } | undefined;
2096
+ };
2097
+ reportsTo?: string | undefined;
2098
+ utilizationTarget?: number | undefined;
2099
+ }>>>;
2100
+ workTickMinutes: z.ZodDefault<z.ZodNumber>;
2101
+ idleQueueThreshold: z.ZodDefault<z.ZodNumber>;
2102
+ }, "strip", z.ZodTypeAny, {
2103
+ enabled: boolean;
2104
+ timezone: string;
2105
+ mainChannel: {
2106
+ channel: string;
2107
+ chatId: string;
2108
+ accountId?: string | undefined;
2109
+ };
2110
+ workSource: {
2111
+ path: string;
2112
+ type: "backlog";
2113
+ } | {
2114
+ type: "gitlab";
2115
+ projects: string[];
2116
+ } | {
2117
+ path: string;
2118
+ type: "wiki";
2119
+ glob: string;
2120
+ };
2121
+ roles: Record<string, {
2122
+ title: string;
2123
+ responsibilities: string[];
2124
+ kpis: string[];
2125
+ sopPath?: string | undefined;
2126
+ }>;
2127
+ orgChart: Record<string, {
2128
+ role: string;
2129
+ schedule: {
2130
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
2131
+ start: string;
2132
+ end: string;
2133
+ lunch?: {
2134
+ start: string;
2135
+ end: string;
2136
+ } | undefined;
2137
+ };
2138
+ utilizationTarget: number;
2139
+ reportsTo?: string | undefined;
2140
+ }>;
2141
+ workTickMinutes: number;
2142
+ idleQueueThreshold: number;
2143
+ }, {
2144
+ mainChannel: {
2145
+ channel: string;
2146
+ chatId: string;
2147
+ accountId?: string | undefined;
2148
+ };
2149
+ workSource: {
2150
+ type: "backlog";
2151
+ path?: string | undefined;
2152
+ } | {
2153
+ type: "gitlab";
2154
+ projects?: string[] | undefined;
2155
+ } | {
2156
+ path: string;
2157
+ type: "wiki";
2158
+ glob?: string | undefined;
2159
+ };
2160
+ enabled?: boolean | undefined;
2161
+ timezone?: string | undefined;
2162
+ roles?: Record<string, {
2163
+ title: string;
2164
+ responsibilities?: string[] | undefined;
2165
+ sopPath?: string | undefined;
2166
+ kpis?: string[] | undefined;
2167
+ }> | undefined;
2168
+ orgChart?: Record<string, {
2169
+ role: string;
2170
+ schedule: {
2171
+ start: string;
2172
+ end: string;
2173
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2174
+ lunch?: {
2175
+ start: string;
2176
+ end: string;
2177
+ } | undefined;
2178
+ };
2179
+ reportsTo?: string | undefined;
2180
+ utilizationTarget?: number | undefined;
2181
+ }> | undefined;
2182
+ workTickMinutes?: number | undefined;
2183
+ idleQueueThreshold?: number | undefined;
2184
+ }>>;
1847
2185
  }, "strip", z.ZodTypeAny, {
1848
2186
  agents: Record<string, {
1849
2187
  name: string;
@@ -1880,6 +2218,7 @@ declare const daemonConfigSchema: z.ZodObject<{
1880
2218
  id: string;
1881
2219
  name: string;
1882
2220
  bind: string;
2221
+ defaultAgent?: string | undefined;
1883
2222
  };
1884
2223
  providers: Record<string, {
1885
2224
  apiKey?: string | undefined;
@@ -1887,6 +2226,23 @@ declare const daemonConfigSchema: z.ZodObject<{
1887
2226
  baseUrl?: string | undefined;
1888
2227
  }>;
1889
2228
  channels: {
2229
+ gitlab: {
2230
+ enabled: boolean;
2231
+ routes: {
2232
+ agent: string;
2233
+ project: string;
2234
+ }[];
2235
+ webhookPort: number;
2236
+ host: string;
2237
+ agentMappings: {
2238
+ agentId: string;
2239
+ gitlabUsernames: string[];
2240
+ keywords: string[];
2241
+ token?: string | undefined;
2242
+ }[];
2243
+ token?: string | undefined;
2244
+ webhookSecret?: string | undefined;
2245
+ };
1890
2246
  telegram: {
1891
2247
  enabled: boolean;
1892
2248
  accounts: Record<string, {
@@ -1914,23 +2270,6 @@ declare const daemonConfigSchema: z.ZodObject<{
1914
2270
  token?: string | undefined;
1915
2271
  agentBinding?: string | undefined;
1916
2272
  };
1917
- gitlab: {
1918
- enabled: boolean;
1919
- routes: {
1920
- agent: string;
1921
- project: string;
1922
- }[];
1923
- webhookPort: number;
1924
- host: string;
1925
- agentMappings: {
1926
- agentId: string;
1927
- gitlabUsernames: string[];
1928
- keywords: string[];
1929
- token?: string | undefined;
1930
- }[];
1931
- token?: string | undefined;
1932
- webhookSecret?: string | undefined;
1933
- };
1934
2273
  };
1935
2274
  crons: Record<string, {
1936
2275
  enabled: boolean;
@@ -1939,7 +2278,7 @@ declare const daemonConfigSchema: z.ZodObject<{
1939
2278
  timeout: number;
1940
2279
  schedule: string;
1941
2280
  timezone: string;
1942
- onError: "log" | "notify" | "disable";
2281
+ onError: ("log" | "notify" | "disable")[];
1943
2282
  model?: string | undefined;
1944
2283
  notify?: {
1945
2284
  channel: string;
@@ -1947,10 +2286,83 @@ declare const daemonConfigSchema: z.ZodObject<{
1947
2286
  accountId?: string | undefined;
1948
2287
  } | undefined;
1949
2288
  }>;
2289
+ services: Record<string, {
2290
+ agent: string;
2291
+ name: string;
2292
+ prompt: string;
2293
+ triggers: {
2294
+ pattern: string;
2295
+ channel?: string | undefined;
2296
+ }[];
2297
+ timezone: string;
2298
+ schedule?: string | undefined;
2299
+ notify?: {
2300
+ channel: string;
2301
+ chatId: string;
2302
+ accountId?: string | undefined;
2303
+ } | undefined;
2304
+ allowedContacts?: string[] | undefined;
2305
+ }>;
2306
+ notifications: {
2307
+ on: {
2308
+ taskComplete: boolean;
2309
+ taskError: boolean;
2310
+ taskQueued: boolean;
2311
+ };
2312
+ longTaskThreshold: number;
2313
+ destination?: {
2314
+ channel: string;
2315
+ chatId: string;
2316
+ accountId?: string | undefined;
2317
+ } | undefined;
2318
+ };
2319
+ business?: {
2320
+ enabled: boolean;
2321
+ timezone: string;
2322
+ mainChannel: {
2323
+ channel: string;
2324
+ chatId: string;
2325
+ accountId?: string | undefined;
2326
+ };
2327
+ workSource: {
2328
+ path: string;
2329
+ type: "backlog";
2330
+ } | {
2331
+ type: "gitlab";
2332
+ projects: string[];
2333
+ } | {
2334
+ path: string;
2335
+ type: "wiki";
2336
+ glob: string;
2337
+ };
2338
+ roles: Record<string, {
2339
+ title: string;
2340
+ responsibilities: string[];
2341
+ kpis: string[];
2342
+ sopPath?: string | undefined;
2343
+ }>;
2344
+ orgChart: Record<string, {
2345
+ role: string;
2346
+ schedule: {
2347
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
2348
+ start: string;
2349
+ end: string;
2350
+ lunch?: {
2351
+ start: string;
2352
+ end: string;
2353
+ } | undefined;
2354
+ };
2355
+ utilizationTarget: number;
2356
+ reportsTo?: string | undefined;
2357
+ }>;
2358
+ workTickMinutes: number;
2359
+ idleQueueThreshold: number;
2360
+ } | undefined;
1950
2361
  }, {
1951
2362
  node: {
1952
2363
  id: string;
1953
2364
  name: string;
2365
+ defaultAgent?: string | undefined;
1954
2366
  bind?: string | undefined;
1955
2367
  };
1956
2368
  agents?: Record<string, {
@@ -1990,6 +2402,23 @@ declare const daemonConfigSchema: z.ZodObject<{
1990
2402
  baseUrl?: string | undefined;
1991
2403
  }> | undefined;
1992
2404
  channels?: {
2405
+ gitlab?: {
2406
+ enabled?: boolean | undefined;
2407
+ token?: string | undefined;
2408
+ routes?: {
2409
+ agent: string;
2410
+ project: string;
2411
+ }[] | undefined;
2412
+ webhookPort?: number | undefined;
2413
+ webhookSecret?: string | undefined;
2414
+ host?: string | undefined;
2415
+ agentMappings?: {
2416
+ agentId: string;
2417
+ token?: string | undefined;
2418
+ gitlabUsernames?: string[] | undefined;
2419
+ keywords?: string[] | undefined;
2420
+ }[] | undefined;
2421
+ } | undefined;
1993
2422
  telegram?: {
1994
2423
  enabled?: boolean | undefined;
1995
2424
  accounts?: Record<string, {
@@ -2017,23 +2446,6 @@ declare const daemonConfigSchema: z.ZodObject<{
2017
2446
  token?: string | undefined;
2018
2447
  agentBinding?: string | undefined;
2019
2448
  } | undefined;
2020
- gitlab?: {
2021
- enabled?: boolean | undefined;
2022
- token?: string | undefined;
2023
- routes?: {
2024
- agent: string;
2025
- project: string;
2026
- }[] | undefined;
2027
- webhookPort?: number | undefined;
2028
- webhookSecret?: string | undefined;
2029
- host?: string | undefined;
2030
- agentMappings?: {
2031
- agentId: string;
2032
- token?: string | undefined;
2033
- gitlabUsernames?: string[] | undefined;
2034
- keywords?: string[] | undefined;
2035
- }[] | undefined;
2036
- } | undefined;
2037
2449
  } | undefined;
2038
2450
  crons?: Record<string, {
2039
2451
  agent: string;
@@ -2048,8 +2460,80 @@ declare const daemonConfigSchema: z.ZodObject<{
2048
2460
  chatId: string;
2049
2461
  accountId?: string | undefined;
2050
2462
  } | undefined;
2051
- onError?: "log" | "notify" | "disable" | undefined;
2463
+ onError?: "log" | "notify" | "disable" | ("log" | "notify" | "disable")[] | undefined;
2052
2464
  }> | undefined;
2465
+ services?: Record<string, {
2466
+ agent: string;
2467
+ name: string;
2468
+ prompt: string;
2469
+ triggers: {
2470
+ pattern: string;
2471
+ channel?: string | undefined;
2472
+ }[];
2473
+ schedule?: string | undefined;
2474
+ timezone?: string | undefined;
2475
+ notify?: {
2476
+ channel: string;
2477
+ chatId: string;
2478
+ accountId?: string | undefined;
2479
+ } | undefined;
2480
+ allowedContacts?: string[] | undefined;
2481
+ }> | undefined;
2482
+ notifications?: {
2483
+ on?: {
2484
+ taskComplete?: boolean | undefined;
2485
+ taskError?: boolean | undefined;
2486
+ taskQueued?: boolean | undefined;
2487
+ } | undefined;
2488
+ longTaskThreshold?: number | undefined;
2489
+ destination?: {
2490
+ channel: string;
2491
+ chatId: string;
2492
+ accountId?: string | undefined;
2493
+ } | undefined;
2494
+ } | undefined;
2495
+ business?: {
2496
+ mainChannel: {
2497
+ channel: string;
2498
+ chatId: string;
2499
+ accountId?: string | undefined;
2500
+ };
2501
+ workSource: {
2502
+ type: "backlog";
2503
+ path?: string | undefined;
2504
+ } | {
2505
+ type: "gitlab";
2506
+ projects?: string[] | undefined;
2507
+ } | {
2508
+ path: string;
2509
+ type: "wiki";
2510
+ glob?: string | undefined;
2511
+ };
2512
+ enabled?: boolean | undefined;
2513
+ timezone?: string | undefined;
2514
+ roles?: Record<string, {
2515
+ title: string;
2516
+ responsibilities?: string[] | undefined;
2517
+ sopPath?: string | undefined;
2518
+ kpis?: string[] | undefined;
2519
+ }> | undefined;
2520
+ orgChart?: Record<string, {
2521
+ role: string;
2522
+ schedule: {
2523
+ start: string;
2524
+ end: string;
2525
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2526
+ lunch?: {
2527
+ start: string;
2528
+ end: string;
2529
+ } | undefined;
2530
+ };
2531
+ reportsTo?: string | undefined;
2532
+ utilizationTarget?: number | undefined;
2533
+ }> | undefined;
2534
+ workTickMinutes?: number | undefined;
2535
+ idleQueueThreshold?: number | undefined;
2536
+ } | undefined;
2053
2537
  }>;
2054
2538
  type DaemonConfig = z.infer<typeof daemonConfigSchema>;
2055
2539
  type AgentDef = z.infer<typeof agentConfigSchema>;
@@ -2119,6 +2603,7 @@ declare class AgentXDaemon {
2119
2603
  private hooks;
2120
2604
  private landscape;
2121
2605
  private heartbeat;
2606
+ private business?;
2122
2607
  private httpServer?;
2123
2608
  private webhooks;
2124
2609
  private log;
@@ -2320,11 +2805,11 @@ declare function executeClaudeCode(agent: AgentDef, task: AgentTask, historyCont
2320
2805
  /**
2321
2806
  * Execute a task using the Claude Agent SDK (tier: "sdk").
2322
2807
  */
2323
- declare function executeSdk(agent: AgentDef, task: AgentTask, apiKey: string): Promise<AgentResponse>;
2808
+ declare function executeSdk(agent: AgentDef, task: AgentTask, apiKey: string, historyContext?: string): Promise<AgentResponse>;
2324
2809
  /**
2325
2810
  * Execute a task using agentx's own orchestrator (tier: "orchestrator").
2326
2811
  */
2327
- declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string): Promise<AgentResponse>;
2812
+ declare function executeOrchestrator(agent: AgentDef, task: AgentTask, apiKey?: string, historyContext?: string): Promise<AgentResponse>;
2328
2813
  /**
2329
2814
  * Route a task to the correct execution tier.
2330
2815
  */
@@ -2406,6 +2891,22 @@ declare class WikiStore {
2406
2891
  * Write or update a wiki article.
2407
2892
  */
2408
2893
  writeArticle(path: string, meta: WikiArticleMeta, content: string, agentId: string): boolean;
2894
+ /**
2895
+ * Save current article content as an immutable version before overwriting.
2896
+ * Versions stored in _versions/{article-path}/{timestamp}.md
2897
+ */
2898
+ private saveVersion;
2899
+ /**
2900
+ * List all versions of an article (newest first).
2901
+ */
2902
+ getVersions(articlePath: string): Array<{
2903
+ timestamp: string;
2904
+ path: string;
2905
+ }>;
2906
+ /**
2907
+ * Restore a specific version of an article.
2908
+ */
2909
+ restoreVersion(articlePath: string, versionTimestamp: string): boolean;
2409
2910
  /**
2410
2911
  * Read an article. Returns null if not found.
2411
2912
  */
@@ -2607,10 +3108,13 @@ declare class AgentRegistry {
2607
3108
  private sessions;
2608
3109
  private wikiHub;
2609
3110
  private memoryStore;
3111
+ private patternStore;
2610
3112
  private rateLimiter;
2611
3113
  private tokenTracker;
2612
3114
  private landscape?;
2613
3115
  private messageQueue;
3116
+ /** Active soul profile per agent+chat session: "agentId:channel:chatId" → profile name */
3117
+ private activeSouls;
2614
3118
  private log;
2615
3119
  constructor(config: DaemonConfig, log?: (...args: unknown[]) => void);
2616
3120
  /**
@@ -2769,16 +3273,520 @@ interface ChannelAdapter {
2769
3273
  getChannelMeta?(chatId: string): Promise<ChannelMeta | undefined>;
2770
3274
  }
2771
3275
 
3276
+ interface ServiceTrigger {
3277
+ pattern: string;
3278
+ channel?: string;
3279
+ }
3280
+ interface ServiceNotify {
3281
+ channel: string;
3282
+ chatId: string;
3283
+ accountId?: string;
3284
+ }
3285
+ interface ServiceDef {
3286
+ id: string;
3287
+ name: string;
3288
+ triggers: ServiceTrigger[];
3289
+ allowedContacts?: string[];
3290
+ agent: string;
3291
+ prompt: string;
3292
+ schedule?: string;
3293
+ timezone?: string;
3294
+ notify?: ServiceNotify;
3295
+ }
3296
+ interface ServiceMatch {
3297
+ service: ServiceDef;
3298
+ trigger: string;
3299
+ captured: string;
3300
+ }
3301
+ declare class ServiceMatcher {
3302
+ private services;
3303
+ private log;
3304
+ constructor(serviceDefs: Record<string, Omit<ServiceDef, "id">>, log?: (...args: unknown[]) => void);
3305
+ /**
3306
+ * Match an incoming message against all service triggers.
3307
+ * Returns the first matching service or null.
3308
+ */
3309
+ match(text: string, senderId: string, channel: string): ServiceMatch | null;
3310
+ /**
3311
+ * Execute a matched service.
3312
+ * Sends the service's predefined prompt to the agent, returns the response.
3313
+ */
3314
+ execute(service: ServiceDef, registry: AgentRegistry, context: {
3315
+ channel: string;
3316
+ sender: string;
3317
+ chatId: string;
3318
+ }, replyFn: (text: string) => Promise<void>): Promise<void>;
3319
+ /**
3320
+ * Get all services that have a schedule (for cron registration).
3321
+ */
3322
+ getScheduledServices(): ServiceDef[];
3323
+ /**
3324
+ * List all registered services.
3325
+ */
3326
+ list(): Array<{
3327
+ id: string;
3328
+ name: string;
3329
+ triggers: number;
3330
+ agent: string;
3331
+ scheduled: boolean;
3332
+ }>;
3333
+ }
3334
+
3335
+ declare const roleSchema: z.ZodObject<{
3336
+ title: z.ZodString;
3337
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
3338
+ sopPath: z.ZodOptional<z.ZodString>;
3339
+ kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
3340
+ }, "strip", z.ZodTypeAny, {
3341
+ title: string;
3342
+ responsibilities: string[];
3343
+ kpis: string[];
3344
+ sopPath?: string | undefined;
3345
+ }, {
3346
+ title: string;
3347
+ responsibilities?: string[] | undefined;
3348
+ sopPath?: string | undefined;
3349
+ kpis?: string[] | undefined;
3350
+ }>;
3351
+ declare const orgEntrySchema: z.ZodObject<{
3352
+ role: z.ZodString;
3353
+ reportsTo: z.ZodOptional<z.ZodString>;
3354
+ schedule: z.ZodObject<{
3355
+ days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
3356
+ start: z.ZodString;
3357
+ end: z.ZodString;
3358
+ lunch: z.ZodOptional<z.ZodObject<{
3359
+ start: z.ZodString;
3360
+ end: z.ZodString;
3361
+ }, "strip", z.ZodTypeAny, {
3362
+ start: string;
3363
+ end: string;
3364
+ }, {
3365
+ start: string;
3366
+ end: string;
3367
+ }>>;
3368
+ }, "strip", z.ZodTypeAny, {
3369
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
3370
+ start: string;
3371
+ end: string;
3372
+ lunch?: {
3373
+ start: string;
3374
+ end: string;
3375
+ } | undefined;
3376
+ }, {
3377
+ start: string;
3378
+ end: string;
3379
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
3380
+ lunch?: {
3381
+ start: string;
3382
+ end: string;
3383
+ } | undefined;
3384
+ }>;
3385
+ utilizationTarget: z.ZodDefault<z.ZodNumber>;
3386
+ }, "strip", z.ZodTypeAny, {
3387
+ role: string;
3388
+ schedule: {
3389
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
3390
+ start: string;
3391
+ end: string;
3392
+ lunch?: {
3393
+ start: string;
3394
+ end: string;
3395
+ } | undefined;
3396
+ };
3397
+ utilizationTarget: number;
3398
+ reportsTo?: string | undefined;
3399
+ }, {
3400
+ role: string;
3401
+ schedule: {
3402
+ start: string;
3403
+ end: string;
3404
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
3405
+ lunch?: {
3406
+ start: string;
3407
+ end: string;
3408
+ } | undefined;
3409
+ };
3410
+ reportsTo?: string | undefined;
3411
+ utilizationTarget?: number | undefined;
3412
+ }>;
3413
+ declare const businessConfigSchema: z.ZodObject<{
3414
+ enabled: z.ZodDefault<z.ZodBoolean>;
3415
+ timezone: z.ZodDefault<z.ZodString>;
3416
+ mainChannel: z.ZodObject<{
3417
+ channel: z.ZodString;
3418
+ chatId: z.ZodString;
3419
+ accountId: z.ZodOptional<z.ZodString>;
3420
+ }, "strip", z.ZodTypeAny, {
3421
+ channel: string;
3422
+ chatId: string;
3423
+ accountId?: string | undefined;
3424
+ }, {
3425
+ channel: string;
3426
+ chatId: string;
3427
+ accountId?: string | undefined;
3428
+ }>;
3429
+ workSource: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3430
+ type: z.ZodLiteral<"backlog">;
3431
+ path: z.ZodDefault<z.ZodString>;
3432
+ }, "strip", z.ZodTypeAny, {
3433
+ path: string;
3434
+ type: "backlog";
3435
+ }, {
3436
+ type: "backlog";
3437
+ path?: string | undefined;
3438
+ }>, z.ZodObject<{
3439
+ type: z.ZodLiteral<"gitlab">;
3440
+ projects: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
3441
+ }, "strip", z.ZodTypeAny, {
3442
+ type: "gitlab";
3443
+ projects: string[];
3444
+ }, {
3445
+ type: "gitlab";
3446
+ projects?: string[] | undefined;
3447
+ }>, z.ZodObject<{
3448
+ type: z.ZodLiteral<"wiki">;
3449
+ path: z.ZodString;
3450
+ glob: z.ZodDefault<z.ZodString>;
3451
+ }, "strip", z.ZodTypeAny, {
3452
+ path: string;
3453
+ type: "wiki";
3454
+ glob: string;
3455
+ }, {
3456
+ path: string;
3457
+ type: "wiki";
3458
+ glob?: string | undefined;
3459
+ }>]>;
3460
+ roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3461
+ title: z.ZodString;
3462
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
3463
+ sopPath: z.ZodOptional<z.ZodString>;
3464
+ kpis: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
3465
+ }, "strip", z.ZodTypeAny, {
3466
+ title: string;
3467
+ responsibilities: string[];
3468
+ kpis: string[];
3469
+ sopPath?: string | undefined;
3470
+ }, {
3471
+ title: string;
3472
+ responsibilities?: string[] | undefined;
3473
+ sopPath?: string | undefined;
3474
+ kpis?: string[] | undefined;
3475
+ }>>>;
3476
+ orgChart: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3477
+ role: z.ZodString;
3478
+ reportsTo: z.ZodOptional<z.ZodString>;
3479
+ schedule: z.ZodObject<{
3480
+ days: z.ZodDefault<z.ZodArray<z.ZodEnum<["mon", "tue", "wed", "thu", "fri", "sat", "sun"]>, "many">>;
3481
+ start: z.ZodString;
3482
+ end: z.ZodString;
3483
+ lunch: z.ZodOptional<z.ZodObject<{
3484
+ start: z.ZodString;
3485
+ end: z.ZodString;
3486
+ }, "strip", z.ZodTypeAny, {
3487
+ start: string;
3488
+ end: string;
3489
+ }, {
3490
+ start: string;
3491
+ end: string;
3492
+ }>>;
3493
+ }, "strip", z.ZodTypeAny, {
3494
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
3495
+ start: string;
3496
+ end: string;
3497
+ lunch?: {
3498
+ start: string;
3499
+ end: string;
3500
+ } | undefined;
3501
+ }, {
3502
+ start: string;
3503
+ end: string;
3504
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
3505
+ lunch?: {
3506
+ start: string;
3507
+ end: string;
3508
+ } | undefined;
3509
+ }>;
3510
+ utilizationTarget: z.ZodDefault<z.ZodNumber>;
3511
+ }, "strip", z.ZodTypeAny, {
3512
+ role: string;
3513
+ schedule: {
3514
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
3515
+ start: string;
3516
+ end: string;
3517
+ lunch?: {
3518
+ start: string;
3519
+ end: string;
3520
+ } | undefined;
3521
+ };
3522
+ utilizationTarget: number;
3523
+ reportsTo?: string | undefined;
3524
+ }, {
3525
+ role: string;
3526
+ schedule: {
3527
+ start: string;
3528
+ end: string;
3529
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
3530
+ lunch?: {
3531
+ start: string;
3532
+ end: string;
3533
+ } | undefined;
3534
+ };
3535
+ reportsTo?: string | undefined;
3536
+ utilizationTarget?: number | undefined;
3537
+ }>>>;
3538
+ /** Work-tick cadence in minutes during business hours. Default 15. */
3539
+ workTickMinutes: z.ZodDefault<z.ZodNumber>;
3540
+ /** Max queue depth for an idle agent before skipping the work tick (avoids piling up). */
3541
+ idleQueueThreshold: z.ZodDefault<z.ZodNumber>;
3542
+ }, "strip", z.ZodTypeAny, {
3543
+ enabled: boolean;
3544
+ timezone: string;
3545
+ mainChannel: {
3546
+ channel: string;
3547
+ chatId: string;
3548
+ accountId?: string | undefined;
3549
+ };
3550
+ workSource: {
3551
+ path: string;
3552
+ type: "backlog";
3553
+ } | {
3554
+ type: "gitlab";
3555
+ projects: string[];
3556
+ } | {
3557
+ path: string;
3558
+ type: "wiki";
3559
+ glob: string;
3560
+ };
3561
+ roles: Record<string, {
3562
+ title: string;
3563
+ responsibilities: string[];
3564
+ kpis: string[];
3565
+ sopPath?: string | undefined;
3566
+ }>;
3567
+ orgChart: Record<string, {
3568
+ role: string;
3569
+ schedule: {
3570
+ days: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[];
3571
+ start: string;
3572
+ end: string;
3573
+ lunch?: {
3574
+ start: string;
3575
+ end: string;
3576
+ } | undefined;
3577
+ };
3578
+ utilizationTarget: number;
3579
+ reportsTo?: string | undefined;
3580
+ }>;
3581
+ workTickMinutes: number;
3582
+ idleQueueThreshold: number;
3583
+ }, {
3584
+ mainChannel: {
3585
+ channel: string;
3586
+ chatId: string;
3587
+ accountId?: string | undefined;
3588
+ };
3589
+ workSource: {
3590
+ type: "backlog";
3591
+ path?: string | undefined;
3592
+ } | {
3593
+ type: "gitlab";
3594
+ projects?: string[] | undefined;
3595
+ } | {
3596
+ path: string;
3597
+ type: "wiki";
3598
+ glob?: string | undefined;
3599
+ };
3600
+ enabled?: boolean | undefined;
3601
+ timezone?: string | undefined;
3602
+ roles?: Record<string, {
3603
+ title: string;
3604
+ responsibilities?: string[] | undefined;
3605
+ sopPath?: string | undefined;
3606
+ kpis?: string[] | undefined;
3607
+ }> | undefined;
3608
+ orgChart?: Record<string, {
3609
+ role: string;
3610
+ schedule: {
3611
+ start: string;
3612
+ end: string;
3613
+ days?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
3614
+ lunch?: {
3615
+ start: string;
3616
+ end: string;
3617
+ } | undefined;
3618
+ };
3619
+ reportsTo?: string | undefined;
3620
+ utilizationTarget?: number | undefined;
3621
+ }> | undefined;
3622
+ workTickMinutes?: number | undefined;
3623
+ idleQueueThreshold?: number | undefined;
3624
+ }>;
3625
+ type BusinessConfig = z.infer<typeof businessConfigSchema>;
3626
+ type BusinessRole = z.infer<typeof roleSchema>;
3627
+ type BusinessOrgEntry = z.infer<typeof orgEntrySchema>;
3628
+
3629
+ interface EmployeeProfile {
3630
+ agentId: string;
3631
+ role: BusinessRole;
3632
+ roleKey: string;
3633
+ reportsTo?: string;
3634
+ schedule: BusinessOrgEntry["schedule"];
3635
+ utilizationTarget: number;
3636
+ }
3637
+ declare class Organization {
3638
+ private employees;
3639
+ constructor(config: BusinessConfig);
3640
+ get(agentId: string): EmployeeProfile | undefined;
3641
+ all(): EmployeeProfile[];
3642
+ reportsTo(agentId: string): string | undefined;
3643
+ directReports(agentId: string): string[];
3644
+ /** Walk up the org tree to the root. First element is `agentId` itself. */
3645
+ chainOfCommand(agentId: string): string[];
3646
+ }
3647
+
3648
+ declare class Schedule {
3649
+ private org;
3650
+ private config;
3651
+ constructor(org: Organization, config: BusinessConfig);
3652
+ isOnClock(agentId: string, when?: Date): boolean;
3653
+ /** Is `when` exactly (to the minute) the scheduled day-start for this agent? */
3654
+ isDayStart(agentId: string, when?: Date): boolean;
3655
+ /** Is `when` exactly the scheduled day-end for this agent? */
3656
+ isDayEnd(agentId: string, when?: Date): boolean;
3657
+ clockedInAgents(when?: Date): string[];
3658
+ }
3659
+
3660
+ interface WorkItem {
3661
+ id: string;
3662
+ title: string;
3663
+ description?: string;
3664
+ assignee?: string;
3665
+ estimatedSeconds?: number;
3666
+ url?: string;
3667
+ priority?: number;
3668
+ }
3669
+ interface WorkReport {
3670
+ status: "in-progress" | "done" | "blocked";
3671
+ note?: string;
3672
+ timeSeconds?: number;
3673
+ blocker?: string;
3674
+ }
3675
+ interface WorkSource {
3676
+ type: string;
3677
+ listOpen(agentId: string): Promise<WorkItem[]>;
3678
+ claim(agentId: string, itemId: string): Promise<void>;
3679
+ report(itemId: string, update: WorkReport): Promise<void>;
3680
+ }
3681
+
3682
+ declare class Reporter {
3683
+ private router;
3684
+ private org;
3685
+ private config;
3686
+ private log;
3687
+ constructor(router: MessageRouter, org: Organization, config: BusinessConfig, log: (...args: unknown[]) => void);
3688
+ postToMain(text: string, agentId?: string): Promise<void>;
3689
+ /** Post an escalation message up the chain of command. */
3690
+ escalate(fromAgent: string, subject: string, detail: string): Promise<void>;
3691
+ }
3692
+
3693
+ interface DailyStats {
3694
+ date: string;
3695
+ perAgent: Record<string, {
3696
+ tasksCompleted: number;
3697
+ timeLoggedSeconds: number;
3698
+ onClockSeconds: number;
3699
+ blockers: number;
3700
+ utilization: number;
3701
+ }>;
3702
+ }
3703
+ interface TaskCompletion {
3704
+ agentId: string;
3705
+ durationSeconds: number;
3706
+ success: boolean;
3707
+ channel?: string;
3708
+ }
3709
+ declare class KPI {
3710
+ private org;
3711
+ private schedule;
3712
+ private log;
3713
+ private stats;
3714
+ private dir;
3715
+ private onClockTick;
3716
+ constructor(org: Organization, schedule: Schedule, log: (...args: unknown[]) => void);
3717
+ private loadOrInit;
3718
+ /** Called by the day-cycle minute tick to accumulate on-clock time. */
3719
+ tick(): void;
3720
+ recordTaskCompletion(t: TaskCompletion): void;
3721
+ recordBlocker(agentId: string): void;
3722
+ private recomputeUtil;
3723
+ private persist;
3724
+ flush(): void;
3725
+ snapshot(): DailyStats;
3726
+ /** Markdown summary for end-of-day main-channel post. */
3727
+ dailySummaryText(): string;
3728
+ }
3729
+
3730
+ declare class DayCycle {
3731
+ private config;
3732
+ private org;
3733
+ private schedule;
3734
+ private registry;
3735
+ private reporter;
3736
+ private kpi;
3737
+ private workSource;
3738
+ private daemonBase;
3739
+ private log;
3740
+ private timer?;
3741
+ private day;
3742
+ private currentDate;
3743
+ private runningTask;
3744
+ constructor(config: BusinessConfig, org: Organization, schedule: Schedule, registry: AgentRegistry, reporter: Reporter, kpi: KPI, workSource: WorkSource, daemonBase: string, log: (...args: unknown[]) => void);
3745
+ start(): void;
3746
+ stop(): void;
3747
+ private tick;
3748
+ private roleContext;
3749
+ private runLifecycle;
3750
+ private fireStandup;
3751
+ private fireWorkTick;
3752
+ private fireWrap;
3753
+ }
3754
+
3755
+ /**
3756
+ * Business layer facade — constructed once by the daemon when
3757
+ * config.business?.enabled is true.
3758
+ */
3759
+ declare class BusinessLayer {
3760
+ readonly org: Organization;
3761
+ readonly schedule: Schedule;
3762
+ readonly workSource: WorkSource;
3763
+ readonly reporter: Reporter;
3764
+ readonly kpi: KPI;
3765
+ readonly dayCycle: DayCycle;
3766
+ constructor(business: BusinessConfig, daemon: DaemonConfig, registry: AgentRegistry, router: MessageRouter, log: (...args: unknown[]) => void);
3767
+ start(): void;
3768
+ stop(): void;
3769
+ /** Record a task completion (called by router when an agent finishes a task). */
3770
+ recordTaskCompletion(agentId: string, durationSeconds: number, success: boolean, channel?: string): void;
3771
+ handleHttp(route: string, req: IncomingMessage$1, res: ServerResponse): Promise<boolean>;
3772
+ /** Short startup banner line. */
3773
+ summary(): string;
3774
+ }
3775
+
2772
3776
  declare class MessageRouter {
2773
3777
  private registry;
2774
3778
  private config;
2775
3779
  private channels;
2776
3780
  private hooks?;
2777
3781
  private mesh?;
3782
+ private serviceMatcher?;
3783
+ private business?;
2778
3784
  private groupLog;
2779
3785
  private log;
2780
3786
  constructor(registry: AgentRegistry, config: DaemonConfig, hooks?: HookRegistry, log?: (...args: unknown[]) => void);
2781
3787
  setMesh(mesh: A2AMesh): void;
3788
+ setServiceMatcher(matcher: ServiceMatcher): void;
3789
+ setBusiness(business: BusinessLayer): void;
2782
3790
  addChannel(adapter: ChannelAdapter): void;
2783
3791
  /**
2784
3792
  * Send an outbound message to any registered channel.
@@ -2926,7 +3934,7 @@ interface CronJobState {
2926
3934
  prompt: string;
2927
3935
  timeout: number;
2928
3936
  model?: string;
2929
- onError: "log" | "notify" | "disable";
3937
+ onError: Array<"log" | "notify" | "disable">;
2930
3938
  lastRun?: Date;
2931
3939
  nextRun?: Date;
2932
3940
  lastSuccess?: Date;