gsd-unsupervised 1.0.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 (83) hide show
  1. package/README.md +263 -0
  2. package/bin/gsd-unsupervised +3 -0
  3. package/bin/start-daemon.sh +12 -0
  4. package/bin/unsupervised-gsd +2 -0
  5. package/dist/agent-runner.d.ts +26 -0
  6. package/dist/agent-runner.js +111 -0
  7. package/dist/agent-runner.spawn.test.d.ts +1 -0
  8. package/dist/agent-runner.spawn.test.js +128 -0
  9. package/dist/agent-runner.test.d.ts +1 -0
  10. package/dist/agent-runner.test.js +26 -0
  11. package/dist/bootstrap/wsl-bootstrap.d.ts +11 -0
  12. package/dist/bootstrap/wsl-bootstrap.js +14 -0
  13. package/dist/cli.d.ts +1 -0
  14. package/dist/cli.js +172 -0
  15. package/dist/config/paths.d.ts +8 -0
  16. package/dist/config/paths.js +36 -0
  17. package/dist/config/wsl.d.ts +4 -0
  18. package/dist/config/wsl.js +43 -0
  19. package/dist/config.d.ts +79 -0
  20. package/dist/config.js +95 -0
  21. package/dist/config.test.d.ts +1 -0
  22. package/dist/config.test.js +27 -0
  23. package/dist/cursor-agent.d.ts +17 -0
  24. package/dist/cursor-agent.invoker.test.d.ts +1 -0
  25. package/dist/cursor-agent.invoker.test.js +150 -0
  26. package/dist/cursor-agent.js +156 -0
  27. package/dist/cursor-agent.test.d.ts +1 -0
  28. package/dist/cursor-agent.test.js +60 -0
  29. package/dist/daemon.d.ts +17 -0
  30. package/dist/daemon.js +374 -0
  31. package/dist/git.d.ts +23 -0
  32. package/dist/git.js +76 -0
  33. package/dist/goals.d.ts +34 -0
  34. package/dist/goals.js +148 -0
  35. package/dist/gsd-state.d.ts +49 -0
  36. package/dist/gsd-state.js +76 -0
  37. package/dist/init-wizard.d.ts +5 -0
  38. package/dist/init-wizard.js +96 -0
  39. package/dist/lifecycle.d.ts +41 -0
  40. package/dist/lifecycle.js +103 -0
  41. package/dist/lifecycle.test.d.ts +1 -0
  42. package/dist/lifecycle.test.js +116 -0
  43. package/dist/logger.d.ts +12 -0
  44. package/dist/logger.js +31 -0
  45. package/dist/notifier.d.ts +6 -0
  46. package/dist/notifier.js +37 -0
  47. package/dist/orchestrator.d.ts +35 -0
  48. package/dist/orchestrator.js +791 -0
  49. package/dist/resource-governor.d.ts +54 -0
  50. package/dist/resource-governor.js +57 -0
  51. package/dist/resource-governor.test.d.ts +1 -0
  52. package/dist/resource-governor.test.js +33 -0
  53. package/dist/resume-pointer.d.ts +36 -0
  54. package/dist/resume-pointer.js +116 -0
  55. package/dist/roadmap-parser.d.ts +24 -0
  56. package/dist/roadmap-parser.js +105 -0
  57. package/dist/roadmap-parser.test.d.ts +1 -0
  58. package/dist/roadmap-parser.test.js +57 -0
  59. package/dist/session-log.d.ts +53 -0
  60. package/dist/session-log.js +92 -0
  61. package/dist/session-log.test.d.ts +1 -0
  62. package/dist/session-log.test.js +146 -0
  63. package/dist/state-index.d.ts +5 -0
  64. package/dist/state-index.js +31 -0
  65. package/dist/state-parser.d.ts +13 -0
  66. package/dist/state-parser.js +82 -0
  67. package/dist/state-parser.test.d.ts +1 -0
  68. package/dist/state-parser.test.js +228 -0
  69. package/dist/state-types.d.ts +20 -0
  70. package/dist/state-types.js +1 -0
  71. package/dist/state-watcher.d.ts +49 -0
  72. package/dist/state-watcher.js +148 -0
  73. package/dist/status-server.d.ts +112 -0
  74. package/dist/status-server.js +379 -0
  75. package/dist/status-server.test.d.ts +1 -0
  76. package/dist/status-server.test.js +206 -0
  77. package/dist/stream-events.d.ts +423 -0
  78. package/dist/stream-events.js +87 -0
  79. package/dist/stream-events.test.d.ts +1 -0
  80. package/dist/stream-events.test.js +304 -0
  81. package/dist/todos-api.d.ts +5 -0
  82. package/dist/todos-api.js +35 -0
  83. package/package.json +54 -0
@@ -0,0 +1,206 @@
1
+ import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { describe, it, expect, afterEach } from 'vitest';
5
+ import { createStatusServer } from './status-server.js';
6
+ describe('status-server', () => {
7
+ const port = 0; // let OS pick
8
+ let close;
9
+ afterEach(async () => {
10
+ if (close)
11
+ await close();
12
+ });
13
+ async function listen(server) {
14
+ await new Promise((resolve, reject) => {
15
+ server.once('listening', resolve);
16
+ server.once('error', reject);
17
+ });
18
+ const address = server.address();
19
+ if (!address || typeof address === 'string')
20
+ throw new Error('Expected port binding');
21
+ return address.port;
22
+ }
23
+ it('serves GET /status with JSON', async () => {
24
+ const payload = { running: true, currentGoal: 'Test' };
25
+ const { server, close: c } = createStatusServer(port, () => payload);
26
+ close = c;
27
+ await new Promise((resolve, reject) => {
28
+ server.once('listening', resolve);
29
+ server.once('error', reject);
30
+ });
31
+ const address = server.address();
32
+ if (!address || typeof address === 'string')
33
+ throw new Error('Expected port binding');
34
+ const url = `http://127.0.0.1:${address.port}/status`;
35
+ const res = await fetch(url);
36
+ expect(res.status).toBe(200);
37
+ expect(res.headers.get('content-type')).toContain('application/json');
38
+ const body = await res.json();
39
+ expect(body).toEqual(payload);
40
+ });
41
+ it('serves GET / with same JSON', async () => {
42
+ const payload = { running: false };
43
+ const { server, close: c } = createStatusServer(port, () => payload);
44
+ close = c;
45
+ await new Promise((resolve, reject) => {
46
+ server.once('listening', resolve);
47
+ server.once('error', reject);
48
+ });
49
+ const address = server.address();
50
+ if (!address || typeof address === 'string')
51
+ throw new Error('Expected port binding');
52
+ const url = `http://127.0.0.1:${address.port}/`;
53
+ const res = await fetch(url);
54
+ expect(res.status).toBe(200);
55
+ const body = await res.json();
56
+ expect(body).toEqual(payload);
57
+ });
58
+ it('returns 404 for other paths', async () => {
59
+ const { server, close: c } = createStatusServer(port, () => ({ running: false }));
60
+ close = c;
61
+ await new Promise((resolve, reject) => {
62
+ server.once('listening', resolve);
63
+ server.once('error', reject);
64
+ });
65
+ const address = server.address();
66
+ if (!address || typeof address === 'string')
67
+ throw new Error('Expected port binding');
68
+ const res = await fetch(`http://127.0.0.1:${address.port}/other`);
69
+ expect(res.status).toBe(404);
70
+ });
71
+ it('serves GET / as dashboard HTML when options provided', async () => {
72
+ const payload = { running: true, currentGoal: 'Goal' };
73
+ const { server, close: c } = createStatusServer(port, () => payload, {
74
+ stateMdPath: '/nonexistent/STATE.md',
75
+ sessionLogPath: '/nonexistent/session-log.jsonl',
76
+ workspaceRoot: process.cwd(),
77
+ });
78
+ close = c;
79
+ await new Promise((resolve, reject) => {
80
+ server.once('listening', resolve);
81
+ server.once('error', reject);
82
+ });
83
+ const address = server.address();
84
+ if (!address || typeof address === 'string')
85
+ throw new Error('Expected port binding');
86
+ const res = await fetch(`http://127.0.0.1:${address.port}/`);
87
+ expect(res.status).toBe(200);
88
+ expect(res.headers.get('content-type')).toContain('text/html');
89
+ const html = await res.text();
90
+ expect(html).toContain('GSD Autopilot');
91
+ expect(html).toContain('/api/status');
92
+ expect(html).toContain('10000');
93
+ });
94
+ it('serves GET /status with JSON even when options provided', async () => {
95
+ const payload = { running: true, currentGoal: 'Goal' };
96
+ const { server, close: c } = createStatusServer(port, () => payload, {
97
+ stateMdPath: '/nonexistent/STATE.md',
98
+ sessionLogPath: '/nonexistent/session-log.jsonl',
99
+ workspaceRoot: process.cwd(),
100
+ });
101
+ close = c;
102
+ await new Promise((resolve, reject) => {
103
+ server.once('listening', resolve);
104
+ server.once('error', reject);
105
+ });
106
+ const address = server.address();
107
+ if (!address || typeof address === 'string')
108
+ throw new Error('Expected port binding');
109
+ const res = await fetch(`http://127.0.0.1:${address.port}/status`);
110
+ expect(res.status).toBe(200);
111
+ const body = await res.json();
112
+ expect(body).toEqual(payload);
113
+ });
114
+ it('serves GET /api/status with rich dashboard JSON when options provided', async () => {
115
+ const payload = { running: true, currentGoal: 'Goal', phaseNumber: 6, planNumber: 2 };
116
+ const { server, close: c } = createStatusServer(port, () => payload, {
117
+ stateMdPath: '/nonexistent/STATE.md',
118
+ sessionLogPath: '/nonexistent/session-log.jsonl',
119
+ workspaceRoot: process.cwd(),
120
+ });
121
+ close = c;
122
+ await new Promise((resolve, reject) => {
123
+ server.once('listening', resolve);
124
+ server.once('error', reject);
125
+ });
126
+ const address = server.address();
127
+ if (!address || typeof address === 'string')
128
+ throw new Error('Expected port binding');
129
+ const res = await fetch(`http://127.0.0.1:${address.port}/api/status`);
130
+ expect(res.status).toBe(200);
131
+ expect(res.headers.get('content-type')).toContain('application/json');
132
+ const body = await res.json();
133
+ expect(body.running).toBe(true);
134
+ expect(body.currentGoal).toBe('Goal');
135
+ expect(body.phaseNumber).toBe(6);
136
+ expect(body.planNumber).toBe(2);
137
+ expect(body).toHaveProperty('tokens');
138
+ expect(body).toHaveProperty('cost');
139
+ expect(Array.isArray(body.sessionLogEntries)).toBe(true);
140
+ expect(Array.isArray(body.gitFeed)).toBe(true);
141
+ });
142
+ it('serves GET /api/config when planningConfigPath provided', async () => {
143
+ const dir = mkdtempSync(join(tmpdir(), 'status-server-config-'));
144
+ const configPath = join(dir, 'config.json');
145
+ writeFileSync(configPath, JSON.stringify({ parallelization: { enabled: false } }), 'utf-8');
146
+ const { server, close: c } = createStatusServer(port, () => ({ running: false }), {
147
+ stateMdPath: '/n/s.md',
148
+ sessionLogPath: '/n/s.jsonl',
149
+ workspaceRoot: process.cwd(),
150
+ planningConfigPath: configPath,
151
+ });
152
+ close = c;
153
+ const p = await listen(server);
154
+ const res = await fetch(`http://127.0.0.1:${p}/api/config`);
155
+ expect(res.status).toBe(200);
156
+ const body = await res.json();
157
+ expect(body.parallelization).toBeDefined();
158
+ expect(body.parallelization.enabled).toBe(false);
159
+ rmSync(dir, { recursive: true });
160
+ });
161
+ it('POST /api/config updates and persists parallelization', async () => {
162
+ const dir = mkdtempSync(join(tmpdir(), 'status-server-config-'));
163
+ const configPath = join(dir, 'config.json');
164
+ writeFileSync(configPath, JSON.stringify({ parallelization: { enabled: false } }), 'utf-8');
165
+ const { server, close: c } = createStatusServer(port, () => ({ running: false }), {
166
+ stateMdPath: '/n/s.md',
167
+ sessionLogPath: '/n/s.jsonl',
168
+ workspaceRoot: process.cwd(),
169
+ planningConfigPath: configPath,
170
+ });
171
+ close = c;
172
+ const p = await listen(server);
173
+ const postRes = await fetch(`http://127.0.0.1:${p}/api/config`, {
174
+ method: 'POST',
175
+ headers: { 'Content-Type': 'application/json' },
176
+ body: JSON.stringify({ parallelization: { enabled: true } }),
177
+ });
178
+ expect(postRes.status).toBe(200);
179
+ const updated = await postRes.json();
180
+ expect(updated.parallelization.enabled).toBe(true);
181
+ const getRes = await fetch(`http://127.0.0.1:${p}/api/config`);
182
+ const getBody = await getRes.json();
183
+ expect(getBody.parallelization.enabled).toBe(true);
184
+ rmSync(dir, { recursive: true });
185
+ });
186
+ it('POST /api/config with invalid parallelization.enabled returns 400', async () => {
187
+ const dir = mkdtempSync(join(tmpdir(), 'status-server-config-'));
188
+ const configPath = join(dir, 'config.json');
189
+ writeFileSync(configPath, JSON.stringify({}), 'utf-8');
190
+ const { server, close: c } = createStatusServer(port, () => ({ running: false }), {
191
+ stateMdPath: '/n/s.md',
192
+ sessionLogPath: '/n/s.jsonl',
193
+ workspaceRoot: process.cwd(),
194
+ planningConfigPath: configPath,
195
+ });
196
+ close = c;
197
+ const p = await listen(server);
198
+ const res = await fetch(`http://127.0.0.1:${p}/api/config`, {
199
+ method: 'POST',
200
+ headers: { 'Content-Type': 'application/json' },
201
+ body: JSON.stringify({ parallelization: { enabled: 'yes' } }),
202
+ });
203
+ expect(res.status).toBe(400);
204
+ rmSync(dir, { recursive: true });
205
+ });
206
+ });
@@ -0,0 +1,423 @@
1
+ import { z } from 'zod';
2
+ declare const SystemInitEventSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"system">;
4
+ subtype: z.ZodLiteral<"init">;
5
+ session_id: z.ZodString;
6
+ model: z.ZodString;
7
+ cwd: z.ZodString;
8
+ apiKeySource: z.ZodString;
9
+ permissionMode: z.ZodString;
10
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
11
+ type: z.ZodLiteral<"system">;
12
+ subtype: z.ZodLiteral<"init">;
13
+ session_id: z.ZodString;
14
+ model: z.ZodString;
15
+ cwd: z.ZodString;
16
+ apiKeySource: z.ZodString;
17
+ permissionMode: z.ZodString;
18
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
19
+ type: z.ZodLiteral<"system">;
20
+ subtype: z.ZodLiteral<"init">;
21
+ session_id: z.ZodString;
22
+ model: z.ZodString;
23
+ cwd: z.ZodString;
24
+ apiKeySource: z.ZodString;
25
+ permissionMode: z.ZodString;
26
+ }, z.ZodTypeAny, "passthrough">>;
27
+ declare const AssistantEventSchema: z.ZodObject<{
28
+ type: z.ZodLiteral<"assistant">;
29
+ message: z.ZodObject<{
30
+ role: z.ZodString;
31
+ content: z.ZodArray<z.ZodObject<{
32
+ type: z.ZodString;
33
+ text: z.ZodString;
34
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
35
+ type: z.ZodString;
36
+ text: z.ZodString;
37
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
38
+ type: z.ZodString;
39
+ text: z.ZodString;
40
+ }, z.ZodTypeAny, "passthrough">>, "many">;
41
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
42
+ role: z.ZodString;
43
+ content: z.ZodArray<z.ZodObject<{
44
+ type: z.ZodString;
45
+ text: z.ZodString;
46
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
47
+ type: z.ZodString;
48
+ text: z.ZodString;
49
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
50
+ type: z.ZodString;
51
+ text: z.ZodString;
52
+ }, z.ZodTypeAny, "passthrough">>, "many">;
53
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
54
+ role: z.ZodString;
55
+ content: z.ZodArray<z.ZodObject<{
56
+ type: z.ZodString;
57
+ text: z.ZodString;
58
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
59
+ type: z.ZodString;
60
+ text: z.ZodString;
61
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
62
+ type: z.ZodString;
63
+ text: z.ZodString;
64
+ }, z.ZodTypeAny, "passthrough">>, "many">;
65
+ }, z.ZodTypeAny, "passthrough">>;
66
+ session_id: z.ZodString;
67
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
68
+ type: z.ZodLiteral<"assistant">;
69
+ message: z.ZodObject<{
70
+ role: z.ZodString;
71
+ content: z.ZodArray<z.ZodObject<{
72
+ type: z.ZodString;
73
+ text: z.ZodString;
74
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
75
+ type: z.ZodString;
76
+ text: z.ZodString;
77
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
78
+ type: z.ZodString;
79
+ text: z.ZodString;
80
+ }, z.ZodTypeAny, "passthrough">>, "many">;
81
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
82
+ role: z.ZodString;
83
+ content: z.ZodArray<z.ZodObject<{
84
+ type: z.ZodString;
85
+ text: z.ZodString;
86
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
87
+ type: z.ZodString;
88
+ text: z.ZodString;
89
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
90
+ type: z.ZodString;
91
+ text: z.ZodString;
92
+ }, z.ZodTypeAny, "passthrough">>, "many">;
93
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
94
+ role: z.ZodString;
95
+ content: z.ZodArray<z.ZodObject<{
96
+ type: z.ZodString;
97
+ text: z.ZodString;
98
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
99
+ type: z.ZodString;
100
+ text: z.ZodString;
101
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
102
+ type: z.ZodString;
103
+ text: z.ZodString;
104
+ }, z.ZodTypeAny, "passthrough">>, "many">;
105
+ }, z.ZodTypeAny, "passthrough">>;
106
+ session_id: z.ZodString;
107
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
108
+ type: z.ZodLiteral<"assistant">;
109
+ message: z.ZodObject<{
110
+ role: z.ZodString;
111
+ content: z.ZodArray<z.ZodObject<{
112
+ type: z.ZodString;
113
+ text: z.ZodString;
114
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
115
+ type: z.ZodString;
116
+ text: z.ZodString;
117
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
118
+ type: z.ZodString;
119
+ text: z.ZodString;
120
+ }, z.ZodTypeAny, "passthrough">>, "many">;
121
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
122
+ role: z.ZodString;
123
+ content: z.ZodArray<z.ZodObject<{
124
+ type: z.ZodString;
125
+ text: z.ZodString;
126
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
127
+ type: z.ZodString;
128
+ text: z.ZodString;
129
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
130
+ type: z.ZodString;
131
+ text: z.ZodString;
132
+ }, z.ZodTypeAny, "passthrough">>, "many">;
133
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
134
+ role: z.ZodString;
135
+ content: z.ZodArray<z.ZodObject<{
136
+ type: z.ZodString;
137
+ text: z.ZodString;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ type: z.ZodString;
140
+ text: z.ZodString;
141
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
142
+ type: z.ZodString;
143
+ text: z.ZodString;
144
+ }, z.ZodTypeAny, "passthrough">>, "many">;
145
+ }, z.ZodTypeAny, "passthrough">>;
146
+ session_id: z.ZodString;
147
+ }, z.ZodTypeAny, "passthrough">>;
148
+ declare const ToolCallEventSchema: z.ZodObject<{
149
+ type: z.ZodLiteral<"tool_call">;
150
+ subtype: z.ZodString;
151
+ call_id: z.ZodString;
152
+ tool_call: z.ZodObject<{
153
+ name: z.ZodString;
154
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
155
+ name: z.ZodString;
156
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
157
+ name: z.ZodString;
158
+ }, z.ZodTypeAny, "passthrough">>;
159
+ session_id: z.ZodString;
160
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
161
+ type: z.ZodLiteral<"tool_call">;
162
+ subtype: z.ZodString;
163
+ call_id: z.ZodString;
164
+ tool_call: z.ZodObject<{
165
+ name: z.ZodString;
166
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
167
+ name: z.ZodString;
168
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
169
+ name: z.ZodString;
170
+ }, z.ZodTypeAny, "passthrough">>;
171
+ session_id: z.ZodString;
172
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
173
+ type: z.ZodLiteral<"tool_call">;
174
+ subtype: z.ZodString;
175
+ call_id: z.ZodString;
176
+ tool_call: z.ZodObject<{
177
+ name: z.ZodString;
178
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
179
+ name: z.ZodString;
180
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
181
+ name: z.ZodString;
182
+ }, z.ZodTypeAny, "passthrough">>;
183
+ session_id: z.ZodString;
184
+ }, z.ZodTypeAny, "passthrough">>;
185
+ declare const ResultEventSchema: z.ZodObject<{
186
+ type: z.ZodLiteral<"result">;
187
+ subtype: z.ZodString;
188
+ duration_ms: z.ZodNumber;
189
+ duration_api_ms: z.ZodNumber;
190
+ is_error: z.ZodBoolean;
191
+ result: z.ZodString;
192
+ session_id: z.ZodString;
193
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
194
+ type: z.ZodLiteral<"result">;
195
+ subtype: z.ZodString;
196
+ duration_ms: z.ZodNumber;
197
+ duration_api_ms: z.ZodNumber;
198
+ is_error: z.ZodBoolean;
199
+ result: z.ZodString;
200
+ session_id: z.ZodString;
201
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
202
+ type: z.ZodLiteral<"result">;
203
+ subtype: z.ZodString;
204
+ duration_ms: z.ZodNumber;
205
+ duration_api_ms: z.ZodNumber;
206
+ is_error: z.ZodBoolean;
207
+ result: z.ZodString;
208
+ session_id: z.ZodString;
209
+ }, z.ZodTypeAny, "passthrough">>;
210
+ declare const CursorStreamEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
211
+ type: z.ZodLiteral<"system">;
212
+ subtype: z.ZodLiteral<"init">;
213
+ session_id: z.ZodString;
214
+ model: z.ZodString;
215
+ cwd: z.ZodString;
216
+ apiKeySource: z.ZodString;
217
+ permissionMode: z.ZodString;
218
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
219
+ type: z.ZodLiteral<"system">;
220
+ subtype: z.ZodLiteral<"init">;
221
+ session_id: z.ZodString;
222
+ model: z.ZodString;
223
+ cwd: z.ZodString;
224
+ apiKeySource: z.ZodString;
225
+ permissionMode: z.ZodString;
226
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
227
+ type: z.ZodLiteral<"system">;
228
+ subtype: z.ZodLiteral<"init">;
229
+ session_id: z.ZodString;
230
+ model: z.ZodString;
231
+ cwd: z.ZodString;
232
+ apiKeySource: z.ZodString;
233
+ permissionMode: z.ZodString;
234
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
235
+ type: z.ZodLiteral<"assistant">;
236
+ message: z.ZodObject<{
237
+ role: z.ZodString;
238
+ content: z.ZodArray<z.ZodObject<{
239
+ type: z.ZodString;
240
+ text: z.ZodString;
241
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
242
+ type: z.ZodString;
243
+ text: z.ZodString;
244
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
245
+ type: z.ZodString;
246
+ text: z.ZodString;
247
+ }, z.ZodTypeAny, "passthrough">>, "many">;
248
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
249
+ role: z.ZodString;
250
+ content: z.ZodArray<z.ZodObject<{
251
+ type: z.ZodString;
252
+ text: z.ZodString;
253
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
254
+ type: z.ZodString;
255
+ text: z.ZodString;
256
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
257
+ type: z.ZodString;
258
+ text: z.ZodString;
259
+ }, z.ZodTypeAny, "passthrough">>, "many">;
260
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
261
+ role: z.ZodString;
262
+ content: z.ZodArray<z.ZodObject<{
263
+ type: z.ZodString;
264
+ text: z.ZodString;
265
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
266
+ type: z.ZodString;
267
+ text: z.ZodString;
268
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
269
+ type: z.ZodString;
270
+ text: z.ZodString;
271
+ }, z.ZodTypeAny, "passthrough">>, "many">;
272
+ }, z.ZodTypeAny, "passthrough">>;
273
+ session_id: z.ZodString;
274
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
275
+ type: z.ZodLiteral<"assistant">;
276
+ message: z.ZodObject<{
277
+ role: z.ZodString;
278
+ content: z.ZodArray<z.ZodObject<{
279
+ type: z.ZodString;
280
+ text: z.ZodString;
281
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
282
+ type: z.ZodString;
283
+ text: z.ZodString;
284
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
285
+ type: z.ZodString;
286
+ text: z.ZodString;
287
+ }, z.ZodTypeAny, "passthrough">>, "many">;
288
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
289
+ role: z.ZodString;
290
+ content: z.ZodArray<z.ZodObject<{
291
+ type: z.ZodString;
292
+ text: z.ZodString;
293
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
294
+ type: z.ZodString;
295
+ text: z.ZodString;
296
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
297
+ type: z.ZodString;
298
+ text: z.ZodString;
299
+ }, z.ZodTypeAny, "passthrough">>, "many">;
300
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
301
+ role: z.ZodString;
302
+ content: z.ZodArray<z.ZodObject<{
303
+ type: z.ZodString;
304
+ text: z.ZodString;
305
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
306
+ type: z.ZodString;
307
+ text: z.ZodString;
308
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
309
+ type: z.ZodString;
310
+ text: z.ZodString;
311
+ }, z.ZodTypeAny, "passthrough">>, "many">;
312
+ }, z.ZodTypeAny, "passthrough">>;
313
+ session_id: z.ZodString;
314
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
315
+ type: z.ZodLiteral<"assistant">;
316
+ message: z.ZodObject<{
317
+ role: z.ZodString;
318
+ content: z.ZodArray<z.ZodObject<{
319
+ type: z.ZodString;
320
+ text: z.ZodString;
321
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
322
+ type: z.ZodString;
323
+ text: z.ZodString;
324
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
325
+ type: z.ZodString;
326
+ text: z.ZodString;
327
+ }, z.ZodTypeAny, "passthrough">>, "many">;
328
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
329
+ role: z.ZodString;
330
+ content: z.ZodArray<z.ZodObject<{
331
+ type: z.ZodString;
332
+ text: z.ZodString;
333
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
334
+ type: z.ZodString;
335
+ text: z.ZodString;
336
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
337
+ type: z.ZodString;
338
+ text: z.ZodString;
339
+ }, z.ZodTypeAny, "passthrough">>, "many">;
340
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
341
+ role: z.ZodString;
342
+ content: z.ZodArray<z.ZodObject<{
343
+ type: z.ZodString;
344
+ text: z.ZodString;
345
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
346
+ type: z.ZodString;
347
+ text: z.ZodString;
348
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
349
+ type: z.ZodString;
350
+ text: z.ZodString;
351
+ }, z.ZodTypeAny, "passthrough">>, "many">;
352
+ }, z.ZodTypeAny, "passthrough">>;
353
+ session_id: z.ZodString;
354
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
355
+ type: z.ZodLiteral<"tool_call">;
356
+ subtype: z.ZodString;
357
+ call_id: z.ZodString;
358
+ tool_call: z.ZodObject<{
359
+ name: z.ZodString;
360
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
361
+ name: z.ZodString;
362
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
363
+ name: z.ZodString;
364
+ }, z.ZodTypeAny, "passthrough">>;
365
+ session_id: z.ZodString;
366
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
367
+ type: z.ZodLiteral<"tool_call">;
368
+ subtype: z.ZodString;
369
+ call_id: z.ZodString;
370
+ tool_call: z.ZodObject<{
371
+ name: z.ZodString;
372
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
373
+ name: z.ZodString;
374
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
375
+ name: z.ZodString;
376
+ }, z.ZodTypeAny, "passthrough">>;
377
+ session_id: z.ZodString;
378
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
379
+ type: z.ZodLiteral<"tool_call">;
380
+ subtype: z.ZodString;
381
+ call_id: z.ZodString;
382
+ tool_call: z.ZodObject<{
383
+ name: z.ZodString;
384
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
385
+ name: z.ZodString;
386
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
387
+ name: z.ZodString;
388
+ }, z.ZodTypeAny, "passthrough">>;
389
+ session_id: z.ZodString;
390
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
391
+ type: z.ZodLiteral<"result">;
392
+ subtype: z.ZodString;
393
+ duration_ms: z.ZodNumber;
394
+ duration_api_ms: z.ZodNumber;
395
+ is_error: z.ZodBoolean;
396
+ result: z.ZodString;
397
+ session_id: z.ZodString;
398
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
399
+ type: z.ZodLiteral<"result">;
400
+ subtype: z.ZodString;
401
+ duration_ms: z.ZodNumber;
402
+ duration_api_ms: z.ZodNumber;
403
+ is_error: z.ZodBoolean;
404
+ result: z.ZodString;
405
+ session_id: z.ZodString;
406
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
407
+ type: z.ZodLiteral<"result">;
408
+ subtype: z.ZodString;
409
+ duration_ms: z.ZodNumber;
410
+ duration_api_ms: z.ZodNumber;
411
+ is_error: z.ZodBoolean;
412
+ result: z.ZodString;
413
+ session_id: z.ZodString;
414
+ }, z.ZodTypeAny, "passthrough">>]>;
415
+ export type SystemInitEvent = z.infer<typeof SystemInitEventSchema>;
416
+ export type AssistantEvent = z.infer<typeof AssistantEventSchema>;
417
+ export type ToolCallEvent = z.infer<typeof ToolCallEventSchema>;
418
+ export type ResultEvent = z.infer<typeof ResultEventSchema>;
419
+ export type CursorStreamEvent = z.infer<typeof CursorStreamEventSchema>;
420
+ export declare function parseEvent(line: string): CursorStreamEvent | null;
421
+ export declare function extractSessionId(events: CursorStreamEvent[]): string | null;
422
+ export declare function extractResult(events: CursorStreamEvent[]): ResultEvent | null;
423
+ export {};