@cnrai/pave 0.3.35 → 0.3.51

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -218
  3. package/package.json +32 -35
  4. package/pave.js +3 -0
  5. package/sandbox/SandboxRunner.js +1 -0
  6. package/sandbox/pave-run.js +2 -0
  7. package/sandbox/permission.js +1 -0
  8. package/sandbox/utils/yaml.js +1 -0
  9. package/MARKETPLACE.md +0 -406
  10. package/build-binary.js +0 -591
  11. package/build-npm.js +0 -537
  12. package/build.js +0 -230
  13. package/check-binary.js +0 -26
  14. package/deploy.sh +0 -95
  15. package/index.js +0 -5776
  16. package/lib/agent-registry.js +0 -1037
  17. package/lib/args-parser.js +0 -837
  18. package/lib/blessed-widget-patched.js +0 -93
  19. package/lib/cli-markdown.js +0 -590
  20. package/lib/compaction.js +0 -153
  21. package/lib/duration.js +0 -94
  22. package/lib/hash.js +0 -22
  23. package/lib/marketplace.js +0 -866
  24. package/lib/memory-config.js +0 -166
  25. package/lib/skill-manager.js +0 -891
  26. package/lib/soul.js +0 -31
  27. package/lib/tool-output-formatter.js +0 -180
  28. package/start-pave.sh +0 -149
  29. package/status.js +0 -271
  30. package/test/abort-stream.test.js +0 -445
  31. package/test/agent-auto-compaction.test.js +0 -552
  32. package/test/agent-comm-abort.test.js +0 -95
  33. package/test/agent-comm.test.js +0 -598
  34. package/test/agent-inbox.test.js +0 -576
  35. package/test/agent-init.test.js +0 -264
  36. package/test/agent-interrupt.test.js +0 -314
  37. package/test/agent-lifecycle.test.js +0 -520
  38. package/test/agent-log-files.test.js +0 -349
  39. package/test/agent-mode.manual-test.js +0 -392
  40. package/test/agent-parsing.test.js +0 -228
  41. package/test/agent-post-stream-idle.test.js +0 -762
  42. package/test/agent-registry.test.js +0 -359
  43. package/test/agent-rm.test.js +0 -442
  44. package/test/agent-spawn.test.js +0 -933
  45. package/test/agent-status-api.test.js +0 -624
  46. package/test/agent-update.test.js +0 -435
  47. package/test/args-parser.test.js +0 -391
  48. package/test/auto-compaction-chat.manual-test.js +0 -227
  49. package/test/auto-compaction.test.js +0 -941
  50. package/test/build-config.test.js +0 -120
  51. package/test/build-npm.test.js +0 -388
  52. package/test/chat-command.test.js +0 -137
  53. package/test/chat-leading-lines.test.js +0 -159
  54. package/test/config-flag.test.js +0 -272
  55. package/test/cursor-drift.test.js +0 -135
  56. package/test/debug-require.js +0 -23
  57. package/test/dir-migration.test.js +0 -323
  58. package/test/duration.test.js +0 -229
  59. package/test/ghostty-term.test.js +0 -202
  60. package/test/http500-backoff.test.js +0 -854
  61. package/test/integration.test.js +0 -86
  62. package/test/memory-guard-env.test.js +0 -220
  63. package/test/pr233-fixes.test.js +0 -259
  64. package/test/run-agent-init.js +0 -297
  65. package/test/run-all.js +0 -64
  66. package/test/run-config-flag.js +0 -159
  67. package/test/run-cursor-drift.js +0 -82
  68. package/test/run-session-path.js +0 -154
  69. package/test/run-tests.js +0 -643
  70. package/test/sandbox-redirect.test.js +0 -202
  71. package/test/session-path.test.js +0 -132
  72. package/test/shebang-strip.test.js +0 -241
  73. package/test/soul-reinject.test.js +0 -1027
  74. package/test/soul-reread.test.js +0 -281
  75. package/test/tool-output-formatter.test.js +0 -486
  76. package/test/tool-output-gating.test.js +0 -143
  77. package/test/tool-states.test.js +0 -167
  78. package/test/tools-flag.test.js +0 -65
  79. package/test/tui-attach.test.js +0 -1255
  80. package/test/tui-compaction.test.js +0 -354
  81. package/test/tui-wrap.test.js +0 -568
  82. package/test-binary.js +0 -52
  83. package/test-binary2.js +0 -36
@@ -1,167 +0,0 @@
1
- /**
2
- * Tests for comprehensive tool state handling
3
- * Addresses Copilot feedback on missing pending_confirmation state
4
- */
5
-
6
- describe('Tool State Handling', () => {
7
- let mockStdout;
8
-
9
- beforeEach(() => {
10
- mockStdout = jest.spyOn(process.stdout, 'write').mockImplementation();
11
- });
12
-
13
- afterEach(() => {
14
- mockStdout.mockRestore();
15
- });
16
-
17
- const TOOL_COLORS = {
18
- yellow: '\x1b[33m',
19
- cyan: '\x1b[36m',
20
- dim: '\x1b[2m',
21
- reset: '\x1b[0m',
22
- };
23
-
24
- test('should handle completed tool state', () => {
25
- const showTools = true;
26
- const json = false;
27
- const _noStream = false;
28
- const status = 'completed';
29
- const _toolName = 'bash';
30
-
31
- if (showTools && !json) {
32
- if (status === 'completed') {
33
- process.stdout.write(' Tool completed');
34
- }
35
- }
36
-
37
- expect(mockStdout).toHaveBeenCalledWith(' Tool completed');
38
- });
39
-
40
- test('should handle error tool state', () => {
41
- const showTools = true;
42
- const json = false;
43
- const _noStream = false;
44
- const status = 'error';
45
- const _toolName = 'bash';
46
-
47
- if (showTools && !json) {
48
- if (status === 'error') {
49
- process.stdout.write('L Tool error');
50
- }
51
- }
52
-
53
- expect(mockStdout).toHaveBeenCalledWith('L Tool error');
54
- });
55
-
56
- test('should handle pending_confirmation tool state', () => {
57
- const showTools = true;
58
- const json = false;
59
- const _noStream = false;
60
- const status = 'pending_confirmation';
61
- const toolName = 'bash';
62
-
63
- if (showTools && !json) {
64
- if (status === 'pending_confirmation') {
65
- const confirmationMsg = `\n${TOOL_COLORS.yellow}S${TOOL_COLORS.reset} ${TOOL_COLORS.cyan}${toolName}${TOOL_COLORS.reset} ${TOOL_COLORS.dim}pending confirmation...${TOOL_COLORS.reset}\n`;
66
- process.stdout.write(confirmationMsg);
67
- }
68
- }
69
-
70
- expect(mockStdout).toHaveBeenCalledWith(expect.stringContaining('S'));
71
- expect(mockStdout).toHaveBeenCalledWith(expect.stringContaining('pending confirmation'));
72
- });
73
-
74
- test('should handle running tool state only once per tool', () => {
75
- const showTools = true;
76
- const json = false;
77
- const _noStream = false;
78
- const status = 'running';
79
- const toolName = 'bash';
80
- const toolId = 'tool-123';
81
- const activeTools = {};
82
-
83
- if (showTools && !json) {
84
- if (status === 'running' && !activeTools[toolId]) {
85
- activeTools[toolId] = true;
86
- const runningMsg = `\n${TOOL_COLORS.yellow}�${TOOL_COLORS.reset} ${TOOL_COLORS.cyan}${toolName}${TOOL_COLORS.reset} ${TOOL_COLORS.dim}running...${TOOL_COLORS.reset}\n`;
87
- process.stdout.write(runningMsg);
88
- }
89
- }
90
-
91
- expect(mockStdout).toHaveBeenCalledTimes(1);
92
- expect(mockStdout).toHaveBeenCalledWith(expect.stringContaining('�'));
93
- expect(mockStdout).toHaveBeenCalledWith(expect.stringContaining('running...'));
94
-
95
- // Second call with same tool should not output again
96
- mockStdout.mockClear();
97
-
98
- if (showTools && !json) {
99
- if (status === 'running' && !activeTools[toolId]) {
100
- activeTools[toolId] = true;
101
- process.stdout.write('Should not be called');
102
- }
103
- }
104
-
105
- expect(mockStdout).not.toHaveBeenCalled();
106
- });
107
-
108
- test('should track tool states in JSON mode', () => {
109
- const showTools = true;
110
- const toolOutputs = [];
111
- const toolEntry = {
112
- id: 'tool-123',
113
- name: 'bash',
114
- status: 'pending_confirmation',
115
- input: '{"command": "rm -rf /"}',
116
- output: null,
117
- duration: undefined,
118
- };
119
-
120
- if (showTools) {
121
- toolOutputs.push(toolEntry);
122
- }
123
-
124
- expect(toolOutputs).toHaveLength(1);
125
- expect(toolOutputs[0].status).toBe('pending_confirmation');
126
- });
127
- });
128
-
129
- describe('Tool State Transitions', () => {
130
- test('should handle tool state progression', () => {
131
- const toolOutputs = [];
132
- const toolId = 'tool-123';
133
- const showTools = true;
134
-
135
- // Running state
136
- let toolEntry = {
137
- id: toolId,
138
- name: 'bash',
139
- status: 'running',
140
- input: '{"command": "sleep 5"}',
141
- output: null,
142
- };
143
-
144
- if (showTools) {
145
- toolOutputs.push(toolEntry);
146
- }
147
-
148
- expect(toolOutputs[0].status).toBe('running');
149
-
150
- // Update to completed
151
- toolEntry = {
152
- ...toolEntry,
153
- status: 'completed',
154
- output: 'Command completed',
155
- duration: 5000,
156
- };
157
-
158
- const existingIdx = toolOutputs.findIndex((t) => t.id === toolId);
159
- if (existingIdx >= 0) {
160
- toolOutputs[existingIdx] = toolEntry;
161
- }
162
-
163
- expect(toolOutputs[0].status).toBe('completed');
164
- expect(toolOutputs[0].output).toBe('Command completed');
165
- expect(toolOutputs[0].duration).toBe(5000);
166
- });
167
- });
@@ -1,65 +0,0 @@
1
- /**
2
- * Tests for --no-tools flag functionality
3
- * Tool output is shown by default, use --no-tools to disable
4
- */
5
-
6
- // Use mock parseArgs function from test runner
7
- const { parseArgs } = global.mockModules || { parseArgs(args) {
8
- // Default: showTools is true
9
- // --no-tools disables it
10
- return {
11
- command: args[0] || '',
12
- commandArgs: args.slice(1).filter((arg) => !arg.startsWith('--') && !arg.startsWith('-')),
13
- showTools: !args.includes('--no-tools'),
14
- json: args.includes('--json'),
15
- verbose: args.includes('--verbose') || args.includes('-v'),
16
- noStream: args.includes('--no-stream'),
17
- };
18
- } };
19
-
20
- describe('Tools Flag Parsing', () => {
21
- test('should default showTools to true', () => {
22
- const args = parseArgs(['chat', 'test', 'message']);
23
- expect(args.showTools).toBe(true);
24
- });
25
-
26
- test('should parse --no-tools flag to disable', () => {
27
- const args = parseArgs(['chat', '--no-tools', 'test', 'message']);
28
- expect(args.showTools).toBe(false);
29
- expect(args.command).toBe('chat');
30
- expect(args.commandArgs).toEqual(['test', 'message']);
31
- });
32
-
33
- test('should work with other flags', () => {
34
- const args = parseArgs(['chat', '--no-tools', '--json', '--verbose', 'test']);
35
- expect(args.showTools).toBe(false);
36
- expect(args.json).toBe(true);
37
- expect(args.verbose).toBe(true);
38
- });
39
-
40
- test('should filter flags from command args', () => {
41
- const args = parseArgs(['chat', '--no-tools', 'run', 'bash', 'command']);
42
- expect(args.commandArgs).toEqual(['run', 'bash', 'command']);
43
- expect(args.commandArgs).not.toContain('--no-tools');
44
- });
45
- });
46
-
47
- describe('Tools Flag in Help Text', () => {
48
- // Mock console.log to capture help output
49
- let consoleSpy;
50
- beforeEach(() => {
51
- consoleSpy = jest.spyOn(console, 'log').mockImplementation();
52
- });
53
-
54
- afterEach(() => {
55
- consoleSpy.mockRestore();
56
- });
57
-
58
- test('should include --no-tools in help text', () => {
59
- const { showHelp } = require('../lib/args-parser');
60
- showHelp();
61
-
62
- const helpOutput = consoleSpy.mock.calls.map((call) => call[0]).join('\\n');
63
- expect(helpOutput).toContain('--no-tools');
64
- });
65
- });