@wowyuarm/dsh-agent-team 0.2.0 → 0.2.1

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 (67) hide show
  1. package/README.md +5 -5
  2. package/README.zh.md +5 -5
  3. package/cordis.patch.yml +26 -12
  4. package/package.json +50 -47
  5. package/packages/agent-team/lib/attachments.js +63 -4
  6. package/packages/agent-team/lib/compaction-engine.js +18 -0
  7. package/packages/agent-team/lib/context-continuity-host.js +198 -4
  8. package/packages/agent-team/lib/context-judge.js +150 -0
  9. package/packages/agent-team/lib/index.js +482 -97
  10. package/packages/agent-team/lib/invariant.js +36 -12
  11. package/packages/agent-team/lib/ledger.js +2 -1
  12. package/packages/agent-team/lib/member-runtime.js +2 -1
  13. package/packages/agent-team/lib/recovery.js +53 -4
  14. package/packages/agent-team/lib/typert.host.js +138 -44
  15. package/packages/agent-team/lib/typert.remote-client.d.ts +3 -1
  16. package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
  17. package/packages/agent-team/lib/typert.remote-client.js +75 -35
  18. package/packages/agent-team/lib/types/attachments.d.ts +32 -2
  19. package/packages/agent-team/lib/types/attachments.d.ts.map +1 -1
  20. package/packages/agent-team/lib/types/compaction-engine.d.ts +19 -0
  21. package/packages/agent-team/lib/types/compaction-engine.d.ts.map +1 -0
  22. package/packages/agent-team/lib/types/context-continuity-host.d.ts +131 -4
  23. package/packages/agent-team/lib/types/context-continuity-host.d.ts.map +1 -1
  24. package/packages/agent-team/lib/types/context-judge.d.ts +82 -0
  25. package/packages/agent-team/lib/types/context-judge.d.ts.map +1 -0
  26. package/packages/agent-team/lib/types/index.d.ts +259 -17
  27. package/packages/agent-team/lib/types/index.d.ts.map +1 -1
  28. package/packages/agent-team/lib/types/invariant.d.ts +27 -5
  29. package/packages/agent-team/lib/types/invariant.d.ts.map +1 -1
  30. package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
  31. package/packages/agent-team/lib/types/member-runtime.d.ts +1 -1
  32. package/packages/agent-team/lib/types/member-runtime.d.ts.map +1 -1
  33. package/packages/agent-team/lib/types/recovery.d.ts +19 -6
  34. package/packages/agent-team/lib/types/recovery.d.ts.map +1 -1
  35. package/packages/agent-team/lib/types/types/requests-results.d.ts +28 -2
  36. package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
  37. package/packages/agent-team/lib/types/types.d.ts +9 -0
  38. package/packages/agent-team/lib/types/types.d.ts.map +1 -1
  39. package/packages/client-agent-team/lib/client.js +1006 -374
  40. package/packages/client-agent-team/lib/client.js.map +1 -1
  41. package/packages/client-agent-team/lib/types/client/{HumanSettingsSection.d.ts → TeamSettingsSection.d.ts} +12 -4
  42. package/packages/client-agent-team/lib/types/client/TeamSettingsSection.d.ts.map +1 -0
  43. package/packages/client-agent-team/lib/types/client/TeamSettingsSection.js +195 -0
  44. package/packages/client-agent-team/lib/types/client/attachment-preview.d.ts +7 -11
  45. package/packages/client-agent-team/lib/types/client/attachment-preview.d.ts.map +1 -1
  46. package/packages/client-agent-team/lib/types/client/attachment-preview.js +13 -3
  47. package/packages/client-agent-team/lib/types/client/context-judge.d.ts +64 -0
  48. package/packages/client-agent-team/lib/types/client/context-judge.d.ts.map +1 -0
  49. package/packages/client-agent-team/lib/types/client/context-judge.js +78 -0
  50. package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
  51. package/packages/client-agent-team/lib/types/client/index.js +75 -11
  52. package/packages/client-agent-team/lib/types/client/judge-form.d.ts +99 -0
  53. package/packages/client-agent-team/lib/types/client/judge-form.d.ts.map +1 -0
  54. package/packages/client-agent-team/lib/types/client/judge-form.js +208 -0
  55. package/packages/client-agent-team/lib/types/client/locales.d.ts +52 -6
  56. package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
  57. package/packages/client-agent-team/lib/types/client/locales.js +55 -6
  58. package/packages/tool-agent-team/README.md +6 -3
  59. package/packages/tool-agent-team/README.zh.md +6 -3
  60. package/packages/tool-agent-team/lib/context-tools.js +84 -112
  61. package/packages/tool-agent-team/lib/types/context-tools.d.ts +29 -13
  62. package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -1
  63. package/packages/agent-team/lib/pressure-policy.js +0 -235
  64. package/packages/agent-team/lib/types/pressure-policy.d.ts +0 -134
  65. package/packages/agent-team/lib/types/pressure-policy.d.ts.map +0 -1
  66. package/packages/client-agent-team/lib/types/client/HumanSettingsSection.d.ts.map +0 -1
  67. package/packages/client-agent-team/lib/types/client/HumanSettingsSection.js +0 -118
@@ -328,6 +328,20 @@ const _wowyuarm_dsh_agent_team_agentTeam_clearMemberContext_result$schema = () =
328
328
  }))]).readonly().optional(),
329
329
  }).readonly(),
330
330
  }))
331
+ let _wowyuarm_dsh_agent_team_agentTeam_contextJudge_parameter_0$schema$value
332
+ const _wowyuarm_dsh_agent_team_agentTeam_contextJudge_parameter_0$schema = () => (_wowyuarm_dsh_agent_team_agentTeam_contextJudge_parameter_0$schema$value ??= z.object({}))
333
+ let _wowyuarm_dsh_agent_team_agentTeam_contextJudge_result$schema$value
334
+ const _wowyuarm_dsh_agent_team_agentTeam_contextJudge_result$schema = () => (_wowyuarm_dsh_agent_team_agentTeam_contextJudge_result$schema$value ??= z.object({
335
+ 'enabled': z.boolean().readonly(),
336
+ 'reason': z.union([z.undefined(), z.literal("unavailable"), z.literal("no-key")]).readonly().optional(),
337
+ 'detail': z.union([z.undefined(), z.string()]).readonly().optional(),
338
+ 'keyEnv': z.string().readonly(),
339
+ 'gate': z.object({
340
+ 'tokens': z.number().readonly(),
341
+ 'idleMs': z.number().readonly(),
342
+ 'judgeTimeoutMs': z.number().readonly(),
343
+ }).readonly(),
344
+ }))
331
345
  let _wowyuarm_dsh_agent_team_agentTeam_createChannel_parameter_0$schema$value
332
346
  const _wowyuarm_dsh_agent_team_agentTeam_createChannel_parameter_0$schema = () => (_wowyuarm_dsh_agent_team_agentTeam_createChannel_parameter_0$schema$value ??= z.object({
333
347
  'requestId': z.intersection(z.string(), z.unknown()).readonly(),
@@ -811,7 +825,7 @@ const _wowyuarm_dsh_agent_team_agentTeam_readThread_result$schema = () => (_wowy
811
825
  'taskBoundaryThreshold': z.union([z.undefined(), z.number()]).readonly().optional(),
812
826
  'handoffAt': z.union([z.undefined(), z.number()]).readonly().optional(),
813
827
  'hardLimit': z.union([z.undefined(), z.number()]).readonly().optional(),
814
- 'action': z.union([z.literal("unavailable"), z.literal("rollover"), z.literal("keep"), z.literal("handoff-now")]).readonly(),
828
+ 'action': z.union([z.literal("unavailable"), z.literal("rollover"), z.literal("keep"), z.literal("compact-now")]).readonly(),
815
829
  'guidance': z.string().readonly(),
816
830
  }).readonly().optional(),
817
831
  }))
@@ -1500,7 +1514,7 @@ export const TYPERT_REMOTE = {
1500
1514
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamAddMemberResult',
1501
1515
  create: _wowyuarm_dsh_agent_team_agentTeam_addMember_result$schema,
1502
1516
  },
1503
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":896,"column":9},
1517
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1079,"column":9},
1504
1518
  },
1505
1519
  {
1506
1520
  id: '@wowyuarm/dsh-agent-team#agentTeam/archiveChannel',
@@ -1525,7 +1539,7 @@ export const TYPERT_REMOTE = {
1525
1539
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamArchiveChannelResult',
1526
1540
  create: _wowyuarm_dsh_agent_team_agentTeam_archiveChannel_result$schema,
1527
1541
  },
1528
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":886,"column":9},
1542
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1069,"column":9},
1529
1543
  },
1530
1544
  {
1531
1545
  id: '@wowyuarm/dsh-agent-team#agentTeam/archiveMember',
@@ -1550,7 +1564,7 @@ export const TYPERT_REMOTE = {
1550
1564
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamArchiveMemberResult',
1551
1565
  create: _wowyuarm_dsh_agent_team_agentTeam_archiveMember_result$schema,
1552
1566
  },
1553
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1276,"column":9},
1567
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1586,"column":9},
1554
1568
  },
1555
1569
  {
1556
1570
  id: '@wowyuarm/dsh-agent-team#agentTeam/changeAttention',
@@ -1575,7 +1589,7 @@ export const TYPERT_REMOTE = {
1575
1589
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamThreadAttentionResult',
1576
1590
  create: _wowyuarm_dsh_agent_team_agentTeam_changeAttention_result$schema,
1577
1591
  },
1578
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1527,"column":9},
1592
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1876,"column":9},
1579
1593
  },
1580
1594
  {
1581
1595
  id: '@wowyuarm/dsh-agent-team#agentTeam/changes',
@@ -1602,7 +1616,7 @@ export const TYPERT_REMOTE = {
1602
1616
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamChangesResult',
1603
1617
  create: _wowyuarm_dsh_agent_team_agentTeam_changes_result$schema,
1604
1618
  },
1605
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":819,"column":11},
1619
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1002,"column":11},
1606
1620
  },
1607
1621
  {
1608
1622
  id: '@wowyuarm/dsh-agent-team#agentTeam/changeTask',
@@ -1627,7 +1641,7 @@ export const TYPERT_REMOTE = {
1627
1641
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamTaskResult',
1628
1642
  create: _wowyuarm_dsh_agent_team_agentTeam_changeTask_result$schema,
1629
1643
  },
1630
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1288,"column":9},
1644
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1597,"column":9},
1631
1645
  },
1632
1646
  {
1633
1647
  id: '@wowyuarm/dsh-agent-team#agentTeam/clearMemberContext',
@@ -1652,7 +1666,33 @@ export const TYPERT_REMOTE = {
1652
1666
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamClearMemberContextResult',
1653
1667
  create: _wowyuarm_dsh_agent_team_agentTeam_clearMemberContext_result$schema,
1654
1668
  },
1655
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1002,"column":9},
1669
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1214,"column":9},
1670
+ },
1671
+ {
1672
+ id: '@wowyuarm/dsh-agent-team#agentTeam/contextJudge',
1673
+ service: 'agentTeam',
1674
+ namespace: 'agentTeam',
1675
+ method: 'contextJudge',
1676
+ implementation: 'contextJudgeForClient',
1677
+ invocation: { kind: 'direct' },
1678
+ parameters: [
1679
+ {
1680
+ name: '_request',
1681
+ wire: '_request',
1682
+ source: 'json',
1683
+ codec: {
1684
+ mode: 'strict',
1685
+ typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamContextJudgeRequest',
1686
+ create: _wowyuarm_dsh_agent_team_agentTeam_contextJudge_parameter_0$schema,
1687
+ },
1688
+ },
1689
+ ],
1690
+ result: {
1691
+ mode: 'strict',
1692
+ typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamContextJudgeResult',
1693
+ create: _wowyuarm_dsh_agent_team_agentTeam_contextJudge_result$schema,
1694
+ },
1695
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1742,"column":3},
1656
1696
  },
1657
1697
  {
1658
1698
  id: '@wowyuarm/dsh-agent-team#agentTeam/createChannel',
@@ -1677,7 +1717,7 @@ export const TYPERT_REMOTE = {
1677
1717
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamCreateChannelResult',
1678
1718
  create: _wowyuarm_dsh_agent_team_agentTeam_createChannel_result$schema,
1679
1719
  },
1680
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":859,"column":9},
1720
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1042,"column":9},
1681
1721
  },
1682
1722
  {
1683
1723
  id: '@wowyuarm/dsh-agent-team#agentTeam/environment',
@@ -1703,7 +1743,7 @@ export const TYPERT_REMOTE = {
1703
1743
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamEnvironmentResult',
1704
1744
  create: _wowyuarm_dsh_agent_team_agentTeam_environment_result$schema,
1705
1745
  },
1706
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1434,"column":3},
1746
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1783,"column":3},
1707
1747
  },
1708
1748
  {
1709
1749
  id: '@wowyuarm/dsh-agent-team#agentTeam/getAttachment',
@@ -1728,7 +1768,7 @@ export const TYPERT_REMOTE = {
1728
1768
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamGetAttachmentResult',
1729
1769
  create: _wowyuarm_dsh_agent_team_agentTeam_getAttachment_result$schema,
1730
1770
  },
1731
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1402,"column":9},
1771
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1724,"column":9},
1732
1772
  },
1733
1773
  {
1734
1774
  id: '@wowyuarm/dsh-agent-team#agentTeam/getHumanAvatar',
@@ -1753,7 +1793,7 @@ export const TYPERT_REMOTE = {
1753
1793
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamGetHumanAvatarResult',
1754
1794
  create: _wowyuarm_dsh_agent_team_agentTeam_getHumanAvatar_result$schema,
1755
1795
  },
1756
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1467,"column":9},
1796
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1816,"column":9},
1757
1797
  },
1758
1798
  {
1759
1799
  id: '@wowyuarm/dsh-agent-team#agentTeam/humanProfile',
@@ -1779,7 +1819,7 @@ export const TYPERT_REMOTE = {
1779
1819
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamHumanProfileResult',
1780
1820
  create: _wowyuarm_dsh_agent_team_agentTeam_humanProfile_result$schema,
1781
1821
  },
1782
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1439,"column":3},
1822
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1788,"column":3},
1783
1823
  },
1784
1824
  {
1785
1825
  id: '@wowyuarm/dsh-agent-team#agentTeam/inbox',
@@ -1804,7 +1844,7 @@ export const TYPERT_REMOTE = {
1804
1844
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamInbox',
1805
1845
  create: _wowyuarm_dsh_agent_team_agentTeam_inbox_result$schema,
1806
1846
  },
1807
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1536,"column":3},
1847
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1885,"column":3},
1808
1848
  },
1809
1849
  {
1810
1850
  id: '@wowyuarm/dsh-agent-team#agentTeam/joinChannel',
@@ -1829,7 +1869,7 @@ export const TYPERT_REMOTE = {
1829
1869
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamJoinChannelResult',
1830
1870
  create: _wowyuarm_dsh_agent_team_agentTeam_joinChannel_result$schema,
1831
1871
  },
1832
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1308,"column":9},
1872
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1617,"column":9},
1833
1873
  },
1834
1874
  {
1835
1875
  id: '@wowyuarm/dsh-agent-team#agentTeam/joinWorkspace',
@@ -1854,7 +1894,7 @@ export const TYPERT_REMOTE = {
1854
1894
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamJoinWorkspaceResult',
1855
1895
  create: _wowyuarm_dsh_agent_team_agentTeam_joinWorkspace_result$schema,
1856
1896
  },
1857
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1328,"column":9},
1897
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1637,"column":9},
1858
1898
  },
1859
1899
  {
1860
1900
  id: '@wowyuarm/dsh-agent-team#agentTeam/leaveWorkspace',
@@ -1879,7 +1919,7 @@ export const TYPERT_REMOTE = {
1879
1919
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamLeaveWorkspaceResult',
1880
1920
  create: _wowyuarm_dsh_agent_team_agentTeam_leaveWorkspace_result$schema,
1881
1921
  },
1882
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1337,"column":9},
1922
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1646,"column":9},
1883
1923
  },
1884
1924
  {
1885
1925
  id: '@wowyuarm/dsh-agent-team#agentTeam/members',
@@ -1905,7 +1945,7 @@ export const TYPERT_REMOTE = {
1905
1945
  typeSymbol: '@wowyuarm/dsh-agent-team#agentTeam/members:result',
1906
1946
  create: _wowyuarm_dsh_agent_team_agentTeam_members_result$schema,
1907
1947
  },
1908
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":809,"column":3},
1948
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":992,"column":3},
1909
1949
  },
1910
1950
  {
1911
1951
  id: '@wowyuarm/dsh-agent-team#agentTeam/promoteThread',
@@ -1930,7 +1970,7 @@ export const TYPERT_REMOTE = {
1930
1970
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamPromoteThreadResult',
1931
1971
  create: _wowyuarm_dsh_agent_team_agentTeam_promoteThread_result$schema,
1932
1972
  },
1933
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1298,"column":9},
1973
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1607,"column":9},
1934
1974
  },
1935
1975
  {
1936
1976
  id: '@wowyuarm/dsh-agent-team#agentTeam/putAttachment',
@@ -1955,7 +1995,7 @@ export const TYPERT_REMOTE = {
1955
1995
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamPutAttachmentResult',
1956
1996
  create: _wowyuarm_dsh_agent_team_agentTeam_putAttachment_result$schema,
1957
1997
  },
1958
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1389,"column":9},
1998
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1707,"column":9},
1959
1999
  },
1960
2000
  {
1961
2001
  id: '@wowyuarm/dsh-agent-team#agentTeam/putHumanAvatar',
@@ -1980,7 +2020,7 @@ export const TYPERT_REMOTE = {
1980
2020
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamPutHumanAvatarResult',
1981
2021
  create: _wowyuarm_dsh_agent_team_agentTeam_putHumanAvatar_result$schema,
1982
2022
  },
1983
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1459,"column":9},
2023
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1808,"column":9},
1984
2024
  },
1985
2025
  {
1986
2026
  id: '@wowyuarm/dsh-agent-team#agentTeam/readThread',
@@ -2005,7 +2045,7 @@ export const TYPERT_REMOTE = {
2005
2045
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamThreadReadResult',
2006
2046
  create: _wowyuarm_dsh_agent_team_agentTeam_readThread_result$schema,
2007
2047
  },
2008
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1543,"column":9},
2048
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1892,"column":9},
2009
2049
  },
2010
2050
  {
2011
2051
  id: '@wowyuarm/dsh-agent-team#agentTeam/recoverMember',
@@ -2030,7 +2070,7 @@ export const TYPERT_REMOTE = {
2030
2070
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamRecoverMemberResult',
2031
2071
  create: _wowyuarm_dsh_agent_team_agentTeam_recoverMember_result$schema,
2032
2072
  },
2033
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":959,"column":9},
2073
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1144,"column":9},
2034
2074
  },
2035
2075
  {
2036
2076
  id: '@wowyuarm/dsh-agent-team#agentTeam/removeChannelMember',
@@ -2055,7 +2095,7 @@ export const TYPERT_REMOTE = {
2055
2095
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamRemoveChannelMemberResult',
2056
2096
  create: _wowyuarm_dsh_agent_team_agentTeam_removeChannelMember_result$schema,
2057
2097
  },
2058
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1319,"column":9},
2098
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1628,"column":9},
2059
2099
  },
2060
2100
  {
2061
2101
  id: '@wowyuarm/dsh-agent-team#agentTeam/removeHumanAvatar',
@@ -2080,7 +2120,7 @@ export const TYPERT_REMOTE = {
2080
2120
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamRemoveHumanAvatarResult',
2081
2121
  create: _wowyuarm_dsh_agent_team_agentTeam_removeHumanAvatar_result$schema,
2082
2122
  },
2083
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1475,"column":9},
2123
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1824,"column":9},
2084
2124
  },
2085
2125
  {
2086
2126
  id: '@wowyuarm/dsh-agent-team#agentTeam/reply',
@@ -2105,7 +2145,7 @@ export const TYPERT_REMOTE = {
2105
2145
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamReplyResult',
2106
2146
  create: _wowyuarm_dsh_agent_team_agentTeam_reply_result$schema,
2107
2147
  },
2108
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1521,"column":9},
2148
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1870,"column":9},
2109
2149
  },
2110
2150
  {
2111
2151
  id: '@wowyuarm/dsh-agent-team#agentTeam/resolveTaskRefs',
@@ -2130,7 +2170,7 @@ export const TYPERT_REMOTE = {
2130
2170
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamResolveTaskRefsResult',
2131
2171
  create: _wowyuarm_dsh_agent_team_agentTeam_resolveTaskRefs_result$schema,
2132
2172
  },
2133
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":783,"column":3},
2173
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":966,"column":3},
2134
2174
  },
2135
2175
  {
2136
2176
  id: '@wowyuarm/dsh-agent-team#agentTeam/resolveThreadRefs',
@@ -2155,7 +2195,7 @@ export const TYPERT_REMOTE = {
2155
2195
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamResolveThreadRefsResult',
2156
2196
  create: _wowyuarm_dsh_agent_team_agentTeam_resolveThreadRefs_result$schema,
2157
2197
  },
2158
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":796,"column":3},
2198
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":979,"column":3},
2159
2199
  },
2160
2200
  {
2161
2201
  id: '@wowyuarm/dsh-agent-team#agentTeam/sendMessage',
@@ -2180,7 +2220,7 @@ export const TYPERT_REMOTE = {
2180
2220
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamSendMessageResult',
2181
2221
  create: _wowyuarm_dsh_agent_team_agentTeam_sendMessage_result$schema,
2182
2222
  },
2183
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1346,"column":9},
2223
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1655,"column":9},
2184
2224
  },
2185
2225
  {
2186
2226
  id: '@wowyuarm/dsh-agent-team#agentTeam/setHumanProfile',
@@ -2205,7 +2245,7 @@ export const TYPERT_REMOTE = {
2205
2245
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamSetHumanProfileResult',
2206
2246
  create: _wowyuarm_dsh_agent_team_agentTeam_setHumanProfile_result$schema,
2207
2247
  },
2208
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1497,"column":9},
2248
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1846,"column":9},
2209
2249
  },
2210
2250
  {
2211
2251
  id: '@wowyuarm/dsh-agent-team#agentTeam/threadHistory',
@@ -2230,7 +2270,7 @@ export const TYPERT_REMOTE = {
2230
2270
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamThreadHistory',
2231
2271
  create: _wowyuarm_dsh_agent_team_agentTeam_threadHistory_result$schema,
2232
2272
  },
2233
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1561,"column":3},
2273
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1910,"column":3},
2234
2274
  },
2235
2275
  {
2236
2276
  id: '@wowyuarm/dsh-agent-team#agentTeam/threadObservations',
@@ -2255,7 +2295,7 @@ export const TYPERT_REMOTE = {
2255
2295
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamThreadObservations',
2256
2296
  create: _wowyuarm_dsh_agent_team_agentTeam_threadObservations_result$schema,
2257
2297
  },
2258
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1554,"column":3},
2298
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1903,"column":3},
2259
2299
  },
2260
2300
  {
2261
2301
  id: '@wowyuarm/dsh-agent-team#agentTeam/updateChannel',
@@ -2280,7 +2320,7 @@ export const TYPERT_REMOTE = {
2280
2320
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamUpdateChannelResult',
2281
2321
  create: _wowyuarm_dsh_agent_team_agentTeam_updateChannel_result$schema,
2282
2322
  },
2283
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":871,"column":9},
2323
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1054,"column":9},
2284
2324
  },
2285
2325
  {
2286
2326
  id: '@wowyuarm/dsh-agent-team#agentTeam/updateMember',
@@ -2305,7 +2345,7 @@ export const TYPERT_REMOTE = {
2305
2345
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamMemberResult',
2306
2346
  create: _wowyuarm_dsh_agent_team_agentTeam_updateMember_result$schema,
2307
2347
  },
2308
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1216,"column":9},
2348
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1527,"column":9},
2309
2349
  },
2310
2350
  {
2311
2351
  id: '@wowyuarm/dsh-agent-team#agentTeam/view',
@@ -2330,7 +2370,7 @@ export const TYPERT_REMOTE = {
2330
2370
  typeSymbol: '@wowyuarm/dsh-agent-team/types#AgentTeamView',
2331
2371
  create: _wowyuarm_dsh_agent_team_agentTeam_view_result$schema,
2332
2372
  },
2333
- sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1568,"column":3},
2373
+ sourceLocation: {"file":"packages/agent-team/src/index.ts","line":1917,"column":3},
2334
2374
  },
2335
2375
  ],
2336
2376
  }
@@ -15,6 +15,18 @@ export declare function attachmentsRoot(): string;
15
15
  /** Absolute payload path of one stored attachment, as offered to Member agents. */
16
16
  export declare function attachmentPayloadPath(attachmentId: AgentTeamAttachmentId, name: string): string;
17
17
  export declare function newAttachmentId(): AgentTeamAttachmentId;
18
+ /**
19
+ * Request-stable cache identity for one upload of an idempotent request: the
20
+ * same `requestId` always derives the same id, so a retried upload converges
21
+ * on the entry the first attempt wrote instead of minting a second one, while
22
+ * a different payload for that id is caught by the byte comparison at write
23
+ * time. Pure and namespaced, so it is restart-safe without a second durable
24
+ * store or an in-memory map. `scope` separates several attachments prepared
25
+ * by one request (path copies) from the request's upload itself.
26
+ */
27
+ export declare function requestScopedAttachmentId(requestId: string, scope?: string): AgentTeamAttachmentId;
28
+ /** The request-stable id of the `index`-th path copy one message or reply request prepares. */
29
+ export declare function pathAttachmentId(requestId: string, index: number): AgentTeamAttachmentId;
18
30
  /** Strip path separators, control characters, Windows-illegal characters, reserved device names, and leading dots from one client-supplied name. */
19
31
  export declare function sanitizeFileName(raw: string): string;
20
32
  /** Best-effort media type from one path's extension, so images render as thumbnails. */
@@ -24,9 +36,27 @@ export declare function mediaTypeForPath(raw: string): string;
24
36
  * so a rejection anywhere leaves the upload cache untouched.
25
37
  */
26
38
  export declare function validatePathAttachment(raw: string): Promise<void>;
27
- /** Copy one validated file into the cache as a fresh immutable entry. */
28
- export declare function copyPathAttachment(root: string, raw: string): Promise<{
39
+ /**
40
+ * Copy one validated file into the cache under the caller's request-stable id.
41
+ * A committed Message may already reference that id, so an existing entry is
42
+ * never overwritten: identical name and bytes replay it, and anything else is
43
+ * refused as the same request-id collision the ledger reports.
44
+ */
45
+ export declare function copyPathAttachment(root: string, raw: string, attachmentId: AgentTeamAttachmentId, requestId: string): Promise<{
46
+ attachmentId: AgentTeamAttachmentId;
47
+ name: string;
48
+ byteSize: number;
49
+ mediaType: string;
50
+ }>;
51
+ /**
52
+ * Store one upload under the id its `requestId` derives. The first attempt
53
+ * writes the entry; a later attempt with the same request replays it, and a
54
+ * different payload for that same request is refused instead of silently
55
+ * becoming a second upload of the same idempotency key.
56
+ */
57
+ export declare function writeRequestScopedAttachment(root: string, requestId: string, rawName: string, mediaType: string, bytes: Buffer): Promise<{
29
58
  attachmentId: AgentTeamAttachmentId;
59
+ path: string;
30
60
  name: string;
31
61
  byteSize: number;
32
62
  mediaType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/attachments.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AACpD,gFAAgF;AAChF,eAAO,MAAM,4BAA4B,QAAsB,CAAA;AAC/D,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,QAAsB,CAAA;AAE3D,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/F;AAED,wBAAgB,eAAe,IAAI,qBAAqB,CAEvD;AAED,oJAAoJ;AACpJ,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBpD;AAiBD,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,yEAAyE;AACzE,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE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,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,iFAAiF;AACjF,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAc7H;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,YAAY,EAAE,qBAAqB,CAAA;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,uEAAuE;AACvE,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAkB1F;AAED,iFAAiF;AACjF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvG;AAED,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAA;AAEtE;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CAWlJ;AAED,+GAA+G;AAC/G,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGlE"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The continuity compaction engine, mounted under this bundle's own name.
3
+ *
4
+ * The preset row that mounts the compaction engine is resolved by the Loader
5
+ * from the *profile*, not from this bundle's `node_modules`: a row name is a
6
+ * bare specifier imported against the profile's own base, so it sees the
7
+ * packages the profile links (this bundle among them) and the host closure —
8
+ * and never a package nested inside this bundle's dependency tree. Naming
9
+ * `@wowyuarm/dsh-context-continuity/compaction-engine` directly therefore
10
+ * resolves in a working tree and fails in a real profile, where the row is
11
+ * reported as `never started` and every Member is left unavailable.
12
+ *
13
+ * Re-exporting it here is what gives the row a name the profile can resolve.
14
+ * The module is a pure re-export: it adds no behavior, and the engine keeps
15
+ * owning its own selection, retention, and summarization.
16
+ * @module @wowyuarm/dsh-agent-team/compaction-engine
17
+ */
18
+ export { default } from '@wowyuarm/dsh-context-continuity/compaction-engine';
19
+ //# sourceMappingURL=compaction-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compaction-engine.d.ts","sourceRoot":"","sources":["../../src/compaction-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAA"}
@@ -6,9 +6,11 @@
6
6
  * Team notices, and how a rollover's durable identity is named).
7
7
  *
8
8
  * The engine owns every mechanic this module does not state: the idle-boundary
9
- * swap, carried input, checkpoint continuations, crash repair. Team owns the
10
- * Member vocabulary and the ledger-backed lifecycle behind
11
- * {@link TeamContextContinuityOptions.executeTransition}.
9
+ * swap, carried input, checkpoint continuations, crash repair, and the
10
+ * context-pressure policy itself. Team owns the Member vocabulary and the
11
+ * ledger-backed lifecycle behind
12
+ * {@link TeamContextContinuityOptions.executeTransition}, and the per-Member
13
+ * readings the pressure policy asks for.
12
14
  *
13
15
  * The projection state this host hands the coordinator is the engine's own
14
16
  * (`ContextProjectionState`), read from the unit `context-projection.ts`
@@ -18,7 +20,8 @@
18
20
  import type { Agent } from '@deepseek-ai/dsh-agent';
19
21
  import type { SessionId } from '@deepseek-ai/dsh-session';
20
22
  import type { UserMessage } from '@deepseek-ai/dsh-llm';
21
- import { ContextContinuityCoordinator, ContextMessageCodec, type ContextContinuityHost, type ContextProjectionState, type ContextSubject, type RolloverIdentity, type TransitionPlan } from '@wowyuarm/dsh-context-continuity';
23
+ import { ContextContinuityCoordinator, ContextMessageCodec, type ContextContinuityHost, type ContextProjectionState, type ContextSubject, type PressureCompaction, type PressureGate, type PressureInHand, type PressureJudgement, type PressureLimits, type PressureLogSpan, type PressurePolicyHost, type PressureRelatedness, type PressureStepDecision, type PressureSurface, type RolloverIdentity, type TransitionPlan } from '@wowyuarm/dsh-context-continuity';
24
+ import z from '@deepseek-ai/schemastery';
22
25
  import type { AgentTeamAgentMember, AgentTeamMemberId } from './types.ts';
23
26
  /**
24
27
  * The one writer of context-continuity messages for Team. Section names are
@@ -81,4 +84,128 @@ export declare class TeamContextContinuityHost implements ContextContinuityHost<
81
84
  }
82
85
  /** Build the engine coordinator over Team's Member lifecycle. */
83
86
  export declare function createTeamContextManagement(options: TeamContextContinuityOptions): ContextContinuityCoordinator<AgentTeamMemberId>;
87
+ /**
88
+ * The long-gap gate as row configuration: every field is optional, so a
89
+ * deployment states only the thresholds it disagrees with and the engine's own
90
+ * default answers the rest. The three answer different questions — how large a
91
+ * context the gate applies to, what counts as a long gap, and how long one
92
+ * judgement may take before the step proceeds without one — and the last is the
93
+ * one that decides whether a configured judge is ever heard, because a judge
94
+ * whose own budget is longer than this deadline never answers in time.
95
+ *
96
+ * All three are volatile, and the engine is what makes that safe: it reads
97
+ * every field at the step it applies to, never at construction, so a Host that
98
+ * keeps one gate object and refreshes its fields in place changes the policy a
99
+ * running generation is judged by. `judgeTimeoutMs` is the field that needs it
100
+ * most — the deadline a judge can answer within is a property of the endpoint,
101
+ * not of the bundle, and a deployment that discovers its endpoint is slow must
102
+ * be able to raise it without editing a patch layer and restarting.
103
+ */
104
+ export declare const TEAM_PRESSURE_GATE_SCHEMA: z<Schemastery.ObjectS<NoInfer<{
105
+ tokens: z<number, number, "volatile">;
106
+ idleMs: z<number, number, "volatile">;
107
+ judgeTimeoutMs: z<number, number, "volatile">;
108
+ }>>, Schemastery.ObjectT<NoInfer<{
109
+ tokens: z<number, number, "volatile">;
110
+ idleMs: z<number, number, "volatile">;
111
+ judgeTimeoutMs: z<number, number, "volatile">;
112
+ }>>, "plain">;
113
+ export interface TeamPressurePolicyOptions {
114
+ /** Resolve the live Agent of one Member; absent means nothing to read. */
115
+ readonly agentForMember: (memberId: AgentTeamMemberId) => Agent | undefined;
116
+ /** Effective budgets for one Member's current route; undefined means unknown. */
117
+ readonly limitsForAgent: (agent: Agent) => PressureLimits | undefined | Promise<PressureLimits | undefined>;
118
+ /** The reduction capability in one Member's preset scope, or absent when it mounts none. */
119
+ readonly compactionForAgent: (agent: Agent) => PressureCompaction | undefined;
120
+ /** The model-visible active-Claim labels for one Member's notice. */
121
+ readonly activeClaimLabels: (memberId: AgentTeamMemberId) => readonly string[];
122
+ /** The model-visible running-job labels for one Member's notice. */
123
+ readonly runningJobLabels: (memberId: AgentTeamMemberId) => readonly string[];
124
+ /** The long-gap gate's thresholds; an omitted field keeps the engine's default. */
125
+ readonly gate?: PressureGate | undefined;
126
+ /**
127
+ * The relatedness judge in one Member's scope, when the deployment installed
128
+ * one. Absent — the member itself, or the whole deployment — switches the
129
+ * long-gap gate off; a missing judge is a deployment choice, never a failure.
130
+ */
131
+ readonly judgeForAgent?: ((agent: Agent) => PressureJudgement | undefined) | undefined;
132
+ /** Report a blocked request with a recoverable diagnostic. */
133
+ readonly failed: (memberId: AgentTeamMemberId, diagnostic: string) => void;
134
+ /** Log one engine diagnostic, attributable to the Member it names. */
135
+ readonly log: (message: string, memberId: AgentTeamMemberId) => void;
136
+ }
137
+ /**
138
+ * Team's `PressurePolicyHost`. Every member is resolved per Member at call
139
+ * time, because one policy serves every Member this Host runs. The readings
140
+ * that need the step's own argument are fed for exactly one policy call —
141
+ * {@link beginStep} to {@link endStep} — so a judgement is never made from a
142
+ * neighbour Member's messages.
143
+ */
144
+ export declare class TeamPressurePolicyHost implements PressurePolicyHost<AgentTeamMemberId> {
145
+ private readonly options;
146
+ readonly pluginId = "@wowyuarm/dsh-agent-team";
147
+ private readonly admitting;
148
+ constructor(options: TeamPressurePolicyOptions);
149
+ /** Record the input one step is admitting: the host's own pre-step argument. */
150
+ beginStep(memberId: AgentTeamMemberId, messages: readonly UserMessage[]): void;
151
+ /** Forget that input again: the view lives only while its policy call runs. */
152
+ endStep(memberId: AgentTeamMemberId): void;
153
+ limitsFor(memberId: AgentTeamMemberId): PressureLimits | undefined | Promise<PressureLimits | undefined>;
154
+ /**
155
+ * The Member's durable surface, for proving a reduction. Without a live Agent
156
+ * there is nothing to measure; the policy reaches this only for a Member whose
157
+ * limits resolved, which already requires one.
158
+ */
159
+ surfaceFor(memberId: AgentTeamMemberId): PressureSurface;
160
+ compactionFor(memberId: AgentTeamMemberId): PressureCompaction | undefined;
161
+ /**
162
+ * The Member's durable log, as the notice latch and the idle gap read it. The
163
+ * engine's contract asks for the span's own events and the inherited count
164
+ * beside them; the `ownEvents()` reader is what states that boundary today.
165
+ */
166
+ logSpanFor(memberId: AgentTeamMemberId): PressureLogSpan;
167
+ inHandFor(memberId: AgentTeamMemberId): PressureInHand;
168
+ /**
169
+ * The input this step is admitting, and the generation's earlier user input
170
+ * beside it. Both sides exclude Team's own notices: what the gate judges is
171
+ * what a human sent, and a rederived Team notification is neither the request
172
+ * being held nor evidence of what the request continues.
173
+ */
174
+ relatednessFor(memberId: AgentTeamMemberId): PressureRelatedness | undefined;
175
+ /**
176
+ * The generation's earlier human input, oldest first, without the messages
177
+ * this step is admitting: the judge is asked what the arriving request
178
+ * continues, so the arriving request is not also part of its own evidence.
179
+ */
180
+ private recentInput;
181
+ judgeFor(memberId: AgentTeamMemberId): PressureJudgement | undefined;
182
+ /**
183
+ * Steer one notice into the Member's running turn. A Member with no live
184
+ * Agent throws rather than reporting success: the caller holds a step on the
185
+ * strength of this call, and a held step whose instruction never arrived
186
+ * would stall the Member behind a message that does not exist.
187
+ */
188
+ steer(memberId: AgentTeamMemberId, notice: UserMessage): void;
189
+ failedFor(memberId: AgentTeamMemberId, diagnostic: string): void;
190
+ log(message: string, memberId: AgentTeamMemberId): void;
191
+ }
192
+ /**
193
+ * The engine's context-pressure policy over Team's Member lifecycle: the one
194
+ * place the two sides meet. It owns no decision of its own — the ordering, the
195
+ * notice latch, the fail-closed reduction proof and the long-gap gate are all
196
+ * the engine's — and adds only the step-scoped input view that only the host
197
+ * can have.
198
+ */
199
+ export declare class TeamPressurePolicy {
200
+ private readonly host;
201
+ private readonly policy;
202
+ constructor(options: TeamPressurePolicyOptions);
203
+ /** The pre-step decision for one Member, with the input that step claims. */
204
+ onPreStep(memberId: AgentTeamMemberId, messages: readonly UserMessage[], signal: AbortSignal): Promise<PressureStepDecision>;
205
+ onRequestError(memberId: AgentTeamMemberId, failure: {
206
+ readonly code?: string | undefined;
207
+ }, signal: AbortSignal): Promise<boolean>;
208
+ onAssistantMessage(memberId: AgentTeamMemberId): void;
209
+ dispose(): void;
210
+ }
84
211
  //# sourceMappingURL=context-continuity-host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-continuity-host.d.ts","sourceRoot":"","sources":["../../src/context-continuity-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAmC,MAAM,YAAY,CAAA;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,qBAI7B,CAAA;AAEF,MAAM,WAAW,4BAA4B;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,KAAK,GAAG,SAAS,CAAA;IAC3E,oDAAoD;IACpD,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,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