@ai-devkit/agent-manager 0.25.0 → 0.26.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 +14 -0
  2. package/dist/__tests__/adapters/CodexAdapter.test.js +249 -0
  3. package/dist/__tests__/adapters/CodexAdapter.test.js.map +1 -1
  4. package/dist/__tests__/print/ClaudeCliProbe.test.js +53 -0
  5. package/dist/__tests__/print/ClaudeCliProbe.test.js.map +1 -0
  6. package/dist/__tests__/print/ClaudePrintAgent.integration.test.js +69 -0
  7. package/dist/__tests__/print/ClaudePrintAgent.integration.test.js.map +1 -0
  8. package/dist/__tests__/print/ClaudePrintAgentService.test.js +108 -0
  9. package/dist/__tests__/print/ClaudePrintAgentService.test.js.map +1 -0
  10. package/dist/__tests__/print/ClaudePrintRunner.test.js +187 -0
  11. package/dist/__tests__/print/ClaudePrintRunner.test.js.map +1 -0
  12. package/dist/__tests__/print/PrintAgent.test.js +17 -0
  13. package/dist/__tests__/print/PrintAgent.test.js.map +1 -0
  14. package/dist/__tests__/print/PrintAgentStore.test.js +307 -0
  15. package/dist/__tests__/print/PrintAgentStore.test.js.map +1 -0
  16. package/dist/__tests__/terminal/TmuxManager.test.js +9 -0
  17. package/dist/__tests__/terminal/TmuxManager.test.js.map +1 -1
  18. package/dist/adapters/CodexAdapter.d.ts +9 -1
  19. package/dist/adapters/CodexAdapter.d.ts.map +1 -1
  20. package/dist/adapters/CodexAdapter.js +106 -24
  21. package/dist/adapters/CodexAdapter.js.map +1 -1
  22. package/dist/index.d.ts +11 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +6 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/print/ClaudeCliProbe.d.ts +20 -0
  27. package/dist/print/ClaudeCliProbe.d.ts.map +1 -0
  28. package/dist/print/ClaudeCliProbe.js +57 -0
  29. package/dist/print/ClaudeCliProbe.js.map +1 -0
  30. package/dist/print/ClaudePrintAgentService.d.ts +44 -0
  31. package/dist/print/ClaudePrintAgentService.d.ts.map +1 -0
  32. package/dist/print/ClaudePrintAgentService.js +66 -0
  33. package/dist/print/ClaudePrintAgentService.js.map +1 -0
  34. package/dist/print/ClaudePrintRunner.d.ts +32 -0
  35. package/dist/print/ClaudePrintRunner.d.ts.map +1 -0
  36. package/dist/print/ClaudePrintRunner.js +128 -0
  37. package/dist/print/ClaudePrintRunner.js.map +1 -0
  38. package/dist/print/PrintAgent.d.ts +57 -0
  39. package/dist/print/PrintAgent.d.ts.map +1 -0
  40. package/dist/print/PrintAgent.js +42 -0
  41. package/dist/print/PrintAgent.js.map +1 -0
  42. package/dist/print/PrintAgentStore.d.ts +69 -0
  43. package/dist/print/PrintAgentStore.d.ts.map +1 -0
  44. package/dist/print/PrintAgentStore.js +484 -0
  45. package/dist/print/PrintAgentStore.js.map +1 -0
  46. package/dist/terminal/TmuxManager.d.ts +2 -2
  47. package/dist/terminal/TmuxManager.d.ts.map +1 -1
  48. package/dist/terminal/TmuxManager.js +5 -7
  49. package/dist/terminal/TmuxManager.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/__tests__/adapters/CodexAdapter.test.ts +155 -0
  52. package/src/__tests__/fixtures/fake-claude.cjs +24 -0
  53. package/src/__tests__/print/ClaudeCliProbe.test.ts +32 -0
  54. package/src/__tests__/print/ClaudePrintAgent.integration.test.ts +56 -0
  55. package/src/__tests__/print/ClaudePrintAgentService.test.ts +46 -0
  56. package/src/__tests__/print/ClaudePrintRunner.test.ts +105 -0
  57. package/src/__tests__/print/PrintAgent.test.ts +21 -0
  58. package/src/__tests__/print/PrintAgentStore.test.ts +192 -0
  59. package/src/__tests__/terminal/TmuxManager.test.ts +10 -0
  60. package/src/adapters/CodexAdapter.ts +147 -27
  61. package/src/index.ts +39 -0
  62. package/src/print/ClaudeCliProbe.ts +58 -0
  63. package/src/print/ClaudePrintAgentService.ts +94 -0
  64. package/src/print/ClaudePrintRunner.ts +139 -0
  65. package/src/print/PrintAgent.ts +86 -0
  66. package/src/print/PrintAgentStore.ts +503 -0
  67. package/src/terminal/TmuxManager.ts +5 -7
package/README.md CHANGED
@@ -24,6 +24,20 @@ ai-devkit agent send "run the tests and report back" --id <agent-name> --wait
24
24
  npm test 2>&1 | ai-devkit agent send --id <agent-name> --stdin
25
25
  ```
26
26
 
27
+ Claude Code can also be registered as a durable print-mode agent. Registration
28
+ does not launch Claude; each send starts one synchronous process and later sends
29
+ resume the same Claude session:
30
+
31
+ ```bash
32
+ ai-devkit agent start --type claude --mode print --name reviewer --cwd /path/to/project
33
+ ai-devkit agent send "review the current diff" --id reviewer
34
+ ```
35
+
36
+ Print mode inherits Claude Code's settings, permissions, hooks, MCP servers, and
37
+ tool side effects for that working directory. AI DevKit adds no permission bypass
38
+ or automatic retry, and prompts are delivered over stdin rather than command-line
39
+ arguments. `--timeout` is not supported for print agents in this first release.
40
+
27
41
  Use this package directly only when building custom tooling around AI DevKit's agent detection and control surface.
28
42
 
29
43
  ## Documentation
@@ -1369,6 +1369,72 @@ describe('CodexAdapter', ()=>{
1369
1369
  const session = parseSession(undefined, filePath);
1370
1370
  expect(session.summary).toBe('Last message');
1371
1371
  });
1372
+ it('should extract summary from current Codex response_item messages', ()=>{
1373
+ const parseSession = adapter.parseSession.bind(adapter);
1374
+ const filePath = path.join(tmpDir, 'response-item-summary.jsonl');
1375
+ fs.writeFileSync(filePath, [
1376
+ JSON.stringify({
1377
+ type: 'session_meta',
1378
+ payload: {
1379
+ id: 'sess-ri',
1380
+ timestamp: '2026-03-18T15:00:00Z',
1381
+ cwd: '/repo'
1382
+ }
1383
+ }),
1384
+ JSON.stringify({
1385
+ type: 'response_item',
1386
+ timestamp: '2026-03-18T15:01:00Z',
1387
+ payload: {
1388
+ type: 'message',
1389
+ role: 'assistant',
1390
+ content: [
1391
+ {
1392
+ type: 'output_text',
1393
+ text: 'Parsed from current schema'
1394
+ }
1395
+ ]
1396
+ }
1397
+ })
1398
+ ].join('\n'));
1399
+ const session = parseSession(undefined, filePath);
1400
+ expect(session.summary).toBe('Parsed from current schema');
1401
+ expect(session.lastPayloadType).toBe('agent_message');
1402
+ });
1403
+ it('should treat completed Codex AgentMessage events as waiting for list status', ()=>{
1404
+ const parseSession = adapter.parseSession.bind(adapter);
1405
+ const determineStatus = adapter.determineStatus.bind(adapter);
1406
+ const filePath = path.join(tmpDir, 'agent-message-status.jsonl');
1407
+ fs.writeFileSync(filePath, [
1408
+ JSON.stringify({
1409
+ type: 'session_meta',
1410
+ payload: {
1411
+ id: 'sess-am',
1412
+ timestamp: '2026-03-18T15:00:00Z',
1413
+ cwd: '/repo'
1414
+ }
1415
+ }),
1416
+ JSON.stringify({
1417
+ type: 'event_msg',
1418
+ timestamp: new Date().toISOString(),
1419
+ payload: {
1420
+ type: 'item_completed',
1421
+ item: {
1422
+ type: 'AgentMessage',
1423
+ content: [
1424
+ {
1425
+ type: 'Text',
1426
+ text: 'Waiting for the user now'
1427
+ }
1428
+ ]
1429
+ }
1430
+ }
1431
+ })
1432
+ ].join('\n'));
1433
+ const session = parseSession(undefined, filePath);
1434
+ expect(session.summary).toBe('Waiting for the user now');
1435
+ expect(session.lastPayloadType).toBe('agent_message');
1436
+ expect(determineStatus(session)).toBe(AgentStatus.WAITING);
1437
+ });
1372
1438
  it('should handle malformed JSON lines gracefully', ()=>{
1373
1439
  const parseSession = adapter.parseSession.bind(adapter);
1374
1440
  const filePath = path.join(tmpDir, 'malformed.jsonl');
@@ -1508,6 +1574,189 @@ describe('CodexAdapter', ()=>{
1508
1574
  timestamp: '2026-03-27T10:00:05Z'
1509
1575
  });
1510
1576
  });
1577
+ it('should parse Codex response_item message records', ()=>{
1578
+ const filePath = writeJsonl([
1579
+ {
1580
+ type: 'session_meta',
1581
+ payload: {
1582
+ id: 'sess-1',
1583
+ cwd: '/repo',
1584
+ timestamp: '2026-03-27T10:00:00Z'
1585
+ }
1586
+ },
1587
+ {
1588
+ type: 'response_item',
1589
+ timestamp: '2026-03-27T10:00:01Z',
1590
+ payload: {
1591
+ type: 'message',
1592
+ role: 'user',
1593
+ content: [
1594
+ {
1595
+ type: 'input_text',
1596
+ text: 'Fix the bug'
1597
+ }
1598
+ ]
1599
+ }
1600
+ },
1601
+ {
1602
+ type: 'response_item',
1603
+ timestamp: '2026-03-27T10:00:05Z',
1604
+ payload: {
1605
+ type: 'message',
1606
+ role: 'assistant',
1607
+ content: [
1608
+ {
1609
+ type: 'output_text',
1610
+ text: 'I found the issue'
1611
+ }
1612
+ ]
1613
+ }
1614
+ }
1615
+ ]);
1616
+ const messages = adapter.getConversation(filePath);
1617
+ expect(messages).toHaveLength(2);
1618
+ expect(messages[0]).toEqual({
1619
+ role: 'user',
1620
+ content: 'Fix the bug',
1621
+ timestamp: '2026-03-27T10:00:01Z'
1622
+ });
1623
+ expect(messages[1]).toEqual({
1624
+ role: 'assistant',
1625
+ content: 'I found the issue',
1626
+ timestamp: '2026-03-27T10:00:05Z'
1627
+ });
1628
+ });
1629
+ it('should parse completed Codex AgentMessage event records', ()=>{
1630
+ const filePath = writeJsonl([
1631
+ {
1632
+ type: 'session_meta',
1633
+ payload: {
1634
+ id: 'sess-1',
1635
+ cwd: '/repo',
1636
+ timestamp: '2026-03-27T10:00:00Z'
1637
+ }
1638
+ },
1639
+ {
1640
+ type: 'event_msg',
1641
+ timestamp: '2026-03-27T10:00:05Z',
1642
+ payload: {
1643
+ type: 'item_completed',
1644
+ item: {
1645
+ type: 'AgentMessage',
1646
+ content: [
1647
+ {
1648
+ type: 'Text',
1649
+ text: 'I found the issue'
1650
+ }
1651
+ ]
1652
+ }
1653
+ }
1654
+ }
1655
+ ]);
1656
+ const messages = adapter.getConversation(filePath);
1657
+ expect(messages).toEqual([
1658
+ {
1659
+ role: 'assistant',
1660
+ content: 'I found the issue',
1661
+ timestamp: '2026-03-27T10:00:05Z'
1662
+ }
1663
+ ]);
1664
+ });
1665
+ it('should not duplicate mirrored current Codex message records', ()=>{
1666
+ const filePath = writeJsonl([
1667
+ {
1668
+ type: 'session_meta',
1669
+ payload: {
1670
+ id: 'sess-1',
1671
+ cwd: '/repo',
1672
+ timestamp: '2026-03-27T10:00:00Z'
1673
+ }
1674
+ },
1675
+ {
1676
+ type: 'response_item',
1677
+ timestamp: '2026-03-27T10:00:01Z',
1678
+ payload: {
1679
+ type: 'message',
1680
+ role: 'user',
1681
+ content: [
1682
+ {
1683
+ type: 'input_text',
1684
+ text: 'Fix the bug'
1685
+ }
1686
+ ],
1687
+ internal_chat_message_metadata_passthrough: {
1688
+ turn_id: 'turn-1'
1689
+ }
1690
+ }
1691
+ },
1692
+ {
1693
+ type: 'event_msg',
1694
+ timestamp: '2026-03-27T10:00:01.001Z',
1695
+ payload: {
1696
+ type: 'item_completed',
1697
+ turn_id: 'turn-1',
1698
+ item: {
1699
+ type: 'UserMessage',
1700
+ content: [
1701
+ {
1702
+ type: 'text',
1703
+ text: 'Fix the bug'
1704
+ }
1705
+ ]
1706
+ }
1707
+ }
1708
+ },
1709
+ {
1710
+ type: 'event_msg',
1711
+ timestamp: '2026-03-27T10:00:05Z',
1712
+ payload: {
1713
+ type: 'item_completed',
1714
+ turn_id: 'turn-1',
1715
+ item: {
1716
+ type: 'AgentMessage',
1717
+ id: 'msg-1',
1718
+ content: [
1719
+ {
1720
+ type: 'Text',
1721
+ text: 'I found the issue'
1722
+ }
1723
+ ]
1724
+ }
1725
+ }
1726
+ },
1727
+ {
1728
+ type: 'response_item',
1729
+ timestamp: '2026-03-27T10:00:05.005Z',
1730
+ payload: {
1731
+ type: 'message',
1732
+ id: 'msg-1',
1733
+ role: 'assistant',
1734
+ content: [
1735
+ {
1736
+ type: 'output_text',
1737
+ text: 'I found the issue'
1738
+ }
1739
+ ],
1740
+ internal_chat_message_metadata_passthrough: {
1741
+ turn_id: 'turn-1'
1742
+ }
1743
+ }
1744
+ }
1745
+ ]);
1746
+ const messages = adapter.getConversation(filePath);
1747
+ expect(messages).toEqual([
1748
+ {
1749
+ role: 'user',
1750
+ content: 'Fix the bug',
1751
+ timestamp: '2026-03-27T10:00:01Z'
1752
+ },
1753
+ {
1754
+ role: 'assistant',
1755
+ content: 'I found the issue',
1756
+ timestamp: '2026-03-27T10:00:05.005Z'
1757
+ }
1758
+ ]);
1759
+ });
1511
1760
  it('should skip session_meta entry', ()=>{
1512
1761
  const filePath = writeJsonl([
1513
1762
  {