speckit-assistant 0.1.3 → 0.1.5

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 (177) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +56 -20
  3. package/.next/app-path-routes-manifest.json +6 -1
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/cache/next-devtools-config.json +1 -0
  6. package/.next/cache/webpack/client-development/0.pack.gz +0 -0
  7. package/.next/cache/webpack/client-development/index.pack.gz +0 -0
  8. package/.next/cache/webpack/client-production/0.pack +0 -0
  9. package/.next/cache/webpack/client-production/1.pack +0 -0
  10. package/.next/cache/webpack/client-production/11.pack +0 -0
  11. package/.next/cache/webpack/client-production/12.pack +0 -0
  12. package/.next/cache/webpack/client-production/13.pack +0 -0
  13. package/.next/cache/webpack/client-production/15.pack +0 -0
  14. package/.next/cache/webpack/client-production/16.pack +0 -0
  15. package/.next/cache/webpack/client-production/17.pack +0 -0
  16. package/.next/cache/webpack/client-production/18.pack +0 -0
  17. package/.next/cache/webpack/client-production/19.pack +0 -0
  18. package/.next/cache/webpack/client-production/2.pack +0 -0
  19. package/.next/cache/webpack/client-production/20.pack +0 -0
  20. package/.next/cache/webpack/client-production/21.pack +0 -0
  21. package/.next/cache/webpack/client-production/22.pack +0 -0
  22. package/.next/cache/webpack/client-production/23.pack +0 -0
  23. package/.next/cache/webpack/client-production/24.pack +0 -0
  24. package/.next/cache/webpack/client-production/25.pack +0 -0
  25. package/.next/cache/webpack/client-production/26.pack +0 -0
  26. package/.next/cache/webpack/client-production/27.pack +0 -0
  27. package/.next/cache/webpack/client-production/28.pack +0 -0
  28. package/.next/cache/webpack/client-production/29.pack +0 -0
  29. package/.next/cache/webpack/client-production/3.pack +0 -0
  30. package/.next/cache/webpack/client-production/30.pack +0 -0
  31. package/.next/cache/webpack/client-production/31.pack +0 -0
  32. package/.next/cache/webpack/client-production/32.pack +0 -0
  33. package/.next/cache/webpack/client-production/33.pack +0 -0
  34. package/.next/cache/webpack/client-production/34.pack +0 -0
  35. package/.next/cache/webpack/client-production/4.pack +0 -0
  36. package/.next/cache/webpack/client-production/6.pack +0 -0
  37. package/.next/cache/webpack/client-production/7.pack +0 -0
  38. package/.next/cache/webpack/client-production/8.pack +0 -0
  39. package/.next/cache/webpack/client-production/9.pack +0 -0
  40. package/.next/cache/webpack/client-production/index.pack +0 -0
  41. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  42. package/.next/cache/webpack/server-production/0.pack +0 -0
  43. package/.next/cache/webpack/server-production/1.pack +0 -0
  44. package/.next/cache/webpack/server-production/10.pack +0 -0
  45. package/.next/cache/webpack/server-production/11.pack +0 -0
  46. package/.next/cache/webpack/server-production/12.pack +0 -0
  47. package/.next/cache/webpack/server-production/13.pack +0 -0
  48. package/.next/cache/webpack/server-production/14.pack +0 -0
  49. package/.next/cache/webpack/server-production/16.pack +0 -0
  50. package/.next/cache/webpack/server-production/18.pack +0 -0
  51. package/.next/cache/webpack/server-production/19.pack +0 -0
  52. package/.next/cache/webpack/server-production/2.pack +0 -0
  53. package/.next/cache/webpack/server-production/20.pack +0 -0
  54. package/.next/cache/webpack/server-production/21.pack +0 -0
  55. package/.next/cache/webpack/server-production/23.pack +0 -0
  56. package/.next/cache/webpack/server-production/24.pack +0 -0
  57. package/.next/cache/webpack/server-production/25.pack +0 -0
  58. package/.next/cache/webpack/server-production/26.pack +0 -0
  59. package/.next/cache/webpack/server-production/27.pack +0 -0
  60. package/.next/cache/webpack/server-production/28.pack +0 -0
  61. package/.next/cache/webpack/server-production/29.pack +0 -0
  62. package/.next/cache/webpack/server-production/3.pack +0 -0
  63. package/.next/cache/webpack/server-production/30.pack +0 -0
  64. package/.next/cache/webpack/server-production/31.pack +0 -0
  65. package/.next/cache/webpack/server-production/32.pack +0 -0
  66. package/.next/cache/webpack/server-production/33.pack +0 -0
  67. package/.next/cache/webpack/server-production/4.pack +0 -0
  68. package/.next/cache/webpack/server-production/5.pack +0 -0
  69. package/.next/cache/webpack/server-production/6.pack +0 -0
  70. package/.next/cache/webpack/server-production/7.pack +0 -0
  71. package/.next/cache/webpack/server-production/9.pack +0 -0
  72. package/.next/cache/webpack/server-production/index.pack +0 -0
  73. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  74. package/.next/prerender-manifest.json +7 -7
  75. package/.next/react-loadable-manifest.json +8 -1
  76. package/.next/required-server-files.json +3 -0
  77. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app/_not-found.html +1 -1
  79. package/.next/server/app/_not-found.rsc +2 -2
  80. package/.next/server/app/api/feature/route.js +1 -1
  81. package/.next/server/app/api/feature/route.js.nft.json +1 -1
  82. package/.next/server/app/api/feature/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/file/route.js +1 -1
  84. package/.next/server/app/api/file/route.js.nft.json +1 -1
  85. package/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/git/route.js +1 -0
  87. package/.next/server/app/api/git/route.js.nft.json +1 -0
  88. package/.next/server/app/api/git/route_client-reference-manifest.js +1 -0
  89. package/.next/server/app/api/personas/route.js +1 -0
  90. package/.next/server/app/api/personas/route.js.nft.json +1 -0
  91. package/.next/server/app/api/personas/route_client-reference-manifest.js +1 -0
  92. package/.next/server/app/api/phase/route.js +3 -3
  93. package/.next/server/app/api/phase/route.js.nft.json +1 -1
  94. package/.next/server/app/api/phase/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/state/route.js +1 -1
  96. package/.next/server/app/api/state/route.js.nft.json +1 -1
  97. package/.next/server/app/api/state/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/state/watch/route.js +2 -2
  99. package/.next/server/app/api/state/watch/route.js.nft.json +1 -1
  100. package/.next/server/app/api/state/watch/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/task/route.js +1 -1
  102. package/.next/server/app/api/task/route.js.nft.json +1 -1
  103. package/.next/server/app/api/task/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/terminal/input/route.js +1 -0
  105. package/.next/server/app/api/terminal/input/route.js.nft.json +1 -0
  106. package/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -0
  107. package/.next/server/app/api/terminal/resize/route.js +1 -0
  108. package/.next/server/app/api/terminal/resize/route.js.nft.json +1 -0
  109. package/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -0
  110. package/.next/server/app/api/terminal/stream/route.js +3 -0
  111. package/.next/server/app/api/terminal/stream/route.js.nft.json +1 -0
  112. package/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -0
  113. package/.next/server/app/index.html +1 -1
  114. package/.next/server/app/index.rsc +4 -4
  115. package/.next/server/app/page.js +26 -7
  116. package/.next/server/app/page_client-reference-manifest.js +1 -1
  117. package/.next/server/app-paths-manifest.json +6 -1
  118. package/.next/server/chunks/607.js +2 -2
  119. package/.next/server/chunks/897.js +13 -7
  120. package/.next/server/middleware-build-manifest.js +1 -1
  121. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  122. package/.next/server/pages/404.html +1 -1
  123. package/.next/server/pages/500.html +1 -1
  124. package/.next/static/8CUCTC2XnkR-leKsH4TwE/_buildManifest.js +1 -0
  125. package/.next/static/chunks/111acf76-29d5e5905666f1e0.js +18 -0
  126. package/.next/static/chunks/343.91af0d46f6df0f05.js +1 -0
  127. package/.next/static/chunks/873-a995367ae371a5e4.js +1 -0
  128. package/.next/static/chunks/app/api/feature/route-b4fbc89d13fef983.js +1 -0
  129. package/.next/static/chunks/app/api/file/route-b4fbc89d13fef983.js +1 -0
  130. package/.next/static/chunks/app/api/git/route-b4fbc89d13fef983.js +1 -0
  131. package/.next/static/chunks/app/api/personas/route-b4fbc89d13fef983.js +1 -0
  132. package/.next/static/chunks/app/api/phase/route-b4fbc89d13fef983.js +1 -0
  133. package/.next/static/chunks/app/api/state/route-b4fbc89d13fef983.js +1 -0
  134. package/.next/static/chunks/app/api/state/watch/route-b4fbc89d13fef983.js +1 -0
  135. package/.next/static/chunks/app/api/task/route-b4fbc89d13fef983.js +1 -0
  136. package/.next/static/chunks/app/api/terminal/input/route-b4fbc89d13fef983.js +1 -0
  137. package/.next/static/chunks/app/api/terminal/resize/route-b4fbc89d13fef983.js +1 -0
  138. package/.next/static/chunks/app/api/terminal/stream/route-b4fbc89d13fef983.js +1 -0
  139. package/.next/static/chunks/app/page-b3dea12c644f2054.js +1 -0
  140. package/.next/static/chunks/webpack-c997c7bd3e8f7cdf.js +1 -0
  141. package/.next/static/css/0024e90648d29466.css +3 -0
  142. package/.next/static/css/{008a05b0ad6b854a.css → af3f40f14f702ff7.css} +1 -1
  143. package/.next/trace +3 -3
  144. package/.next/types/app/api/git/route.ts +347 -0
  145. package/.next/types/app/api/personas/route.ts +347 -0
  146. package/.next/types/app/api/terminal/input/route.ts +347 -0
  147. package/.next/types/app/api/terminal/resize/route.ts +347 -0
  148. package/.next/types/app/api/terminal/stream/route.ts +347 -0
  149. package/.next/types/routes.d.ts +6 -1
  150. package/.next/types/validator.ts +45 -0
  151. package/bin/adapters/primary/api/terminalManager.js +92 -0
  152. package/bin/adapters/secondary/agent/ProcessAgentRunner.js +170 -65
  153. package/bin/adapters/secondary/fs/FSWorkspaceRepository.js +40 -5
  154. package/bin/adapters/secondary/pty/ptyLoader.js +128 -0
  155. package/bin/app/api/git/route.js +156 -0
  156. package/bin/app/api/personas/route.js +76 -0
  157. package/bin/app/api/phase/route.js +18 -5
  158. package/bin/app/api/state/watch/route.js +7 -2
  159. package/bin/app/api/terminal/input/route.js +18 -0
  160. package/bin/app/api/terminal/resize/route.js +18 -0
  161. package/bin/app/api/terminal/stream/route.js +44 -0
  162. package/bin/domain/models/personas.js +65 -0
  163. package/bin/domain/services/WorkflowService.js +79 -5
  164. package/next.config.mjs +3 -0
  165. package/package.json +13 -1
  166. package/.next/static/Bxo1ckOxvQcndtSKD9Yna/_buildManifest.js +0 -1
  167. package/.next/static/chunks/590-a6568595ecd2a994.js +0 -1
  168. package/.next/static/chunks/app/api/feature/route-bb3c1a82e892ab58.js +0 -1
  169. package/.next/static/chunks/app/api/file/route-bb3c1a82e892ab58.js +0 -1
  170. package/.next/static/chunks/app/api/phase/route-bb3c1a82e892ab58.js +0 -1
  171. package/.next/static/chunks/app/api/state/route-bb3c1a82e892ab58.js +0 -1
  172. package/.next/static/chunks/app/api/state/watch/route-bb3c1a82e892ab58.js +0 -1
  173. package/.next/static/chunks/app/api/task/route-bb3c1a82e892ab58.js +0 -1
  174. package/.next/static/chunks/app/page-8a5248f7704cde29.js +0 -1
  175. package/.next/static/chunks/webpack-c460f8e58a9e9eff.js +0 -1
  176. package/.next/static/css/6fd2e11db3a59771.css +0 -3
  177. /package/.next/static/{Bxo1ckOxvQcndtSKD9Yna → 8CUCTC2XnkR-leKsH4TwE}/_ssgManifest.js +0 -0
@@ -0,0 +1,347 @@
1
+ // File: /Users/guru/work/dmux/speckit-assistant/src/app/api/terminal/stream/route.ts
2
+ import * as entry from '../../../../../../src/app/api/terminal/stream/route.js'
3
+ import type { NextRequest } from 'next/server.js'
4
+
5
+ type TEntry = typeof import('../../../../../../src/app/api/terminal/stream/route.js')
6
+
7
+ type SegmentParams<T extends Object = any> = T extends Record<string, any>
8
+ ? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }
9
+ : T
10
+
11
+ // Check that the entry is a valid entry
12
+ checkFields<Diff<{
13
+ GET?: Function
14
+ HEAD?: Function
15
+ OPTIONS?: Function
16
+ POST?: Function
17
+ PUT?: Function
18
+ DELETE?: Function
19
+ PATCH?: Function
20
+ config?: {}
21
+ generateStaticParams?: Function
22
+ revalidate?: RevalidateRange<TEntry> | false
23
+ dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
24
+ dynamicParams?: boolean
25
+ fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
26
+ preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
27
+ runtime?: 'nodejs' | 'experimental-edge' | 'edge'
28
+ maxDuration?: number
29
+
30
+ }, TEntry, ''>>()
31
+
32
+ type RouteContext = { params: Promise<SegmentParams> }
33
+ // Check the prop type of the entry function
34
+ if ('GET' in entry) {
35
+ checkFields<
36
+ Diff<
37
+ ParamCheck<Request | NextRequest>,
38
+ {
39
+ __tag__: 'GET'
40
+ __param_position__: 'first'
41
+ __param_type__: FirstArg<MaybeField<TEntry, 'GET'>>
42
+ },
43
+ 'GET'
44
+ >
45
+ >()
46
+ checkFields<
47
+ Diff<
48
+ ParamCheck<RouteContext>,
49
+ {
50
+ __tag__: 'GET'
51
+ __param_position__: 'second'
52
+ __param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
53
+ },
54
+ 'GET'
55
+ >
56
+ >()
57
+
58
+ checkFields<
59
+ Diff<
60
+ {
61
+ __tag__: 'GET',
62
+ __return_type__: Response | void | never | Promise<Response | void | never>
63
+ },
64
+ {
65
+ __tag__: 'GET',
66
+ __return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
67
+ },
68
+ 'GET'
69
+ >
70
+ >()
71
+ }
72
+ // Check the prop type of the entry function
73
+ if ('HEAD' in entry) {
74
+ checkFields<
75
+ Diff<
76
+ ParamCheck<Request | NextRequest>,
77
+ {
78
+ __tag__: 'HEAD'
79
+ __param_position__: 'first'
80
+ __param_type__: FirstArg<MaybeField<TEntry, 'HEAD'>>
81
+ },
82
+ 'HEAD'
83
+ >
84
+ >()
85
+ checkFields<
86
+ Diff<
87
+ ParamCheck<RouteContext>,
88
+ {
89
+ __tag__: 'HEAD'
90
+ __param_position__: 'second'
91
+ __param_type__: SecondArg<MaybeField<TEntry, 'HEAD'>>
92
+ },
93
+ 'HEAD'
94
+ >
95
+ >()
96
+
97
+ checkFields<
98
+ Diff<
99
+ {
100
+ __tag__: 'HEAD',
101
+ __return_type__: Response | void | never | Promise<Response | void | never>
102
+ },
103
+ {
104
+ __tag__: 'HEAD',
105
+ __return_type__: ReturnType<MaybeField<TEntry, 'HEAD'>>
106
+ },
107
+ 'HEAD'
108
+ >
109
+ >()
110
+ }
111
+ // Check the prop type of the entry function
112
+ if ('OPTIONS' in entry) {
113
+ checkFields<
114
+ Diff<
115
+ ParamCheck<Request | NextRequest>,
116
+ {
117
+ __tag__: 'OPTIONS'
118
+ __param_position__: 'first'
119
+ __param_type__: FirstArg<MaybeField<TEntry, 'OPTIONS'>>
120
+ },
121
+ 'OPTIONS'
122
+ >
123
+ >()
124
+ checkFields<
125
+ Diff<
126
+ ParamCheck<RouteContext>,
127
+ {
128
+ __tag__: 'OPTIONS'
129
+ __param_position__: 'second'
130
+ __param_type__: SecondArg<MaybeField<TEntry, 'OPTIONS'>>
131
+ },
132
+ 'OPTIONS'
133
+ >
134
+ >()
135
+
136
+ checkFields<
137
+ Diff<
138
+ {
139
+ __tag__: 'OPTIONS',
140
+ __return_type__: Response | void | never | Promise<Response | void | never>
141
+ },
142
+ {
143
+ __tag__: 'OPTIONS',
144
+ __return_type__: ReturnType<MaybeField<TEntry, 'OPTIONS'>>
145
+ },
146
+ 'OPTIONS'
147
+ >
148
+ >()
149
+ }
150
+ // Check the prop type of the entry function
151
+ if ('POST' in entry) {
152
+ checkFields<
153
+ Diff<
154
+ ParamCheck<Request | NextRequest>,
155
+ {
156
+ __tag__: 'POST'
157
+ __param_position__: 'first'
158
+ __param_type__: FirstArg<MaybeField<TEntry, 'POST'>>
159
+ },
160
+ 'POST'
161
+ >
162
+ >()
163
+ checkFields<
164
+ Diff<
165
+ ParamCheck<RouteContext>,
166
+ {
167
+ __tag__: 'POST'
168
+ __param_position__: 'second'
169
+ __param_type__: SecondArg<MaybeField<TEntry, 'POST'>>
170
+ },
171
+ 'POST'
172
+ >
173
+ >()
174
+
175
+ checkFields<
176
+ Diff<
177
+ {
178
+ __tag__: 'POST',
179
+ __return_type__: Response | void | never | Promise<Response | void | never>
180
+ },
181
+ {
182
+ __tag__: 'POST',
183
+ __return_type__: ReturnType<MaybeField<TEntry, 'POST'>>
184
+ },
185
+ 'POST'
186
+ >
187
+ >()
188
+ }
189
+ // Check the prop type of the entry function
190
+ if ('PUT' in entry) {
191
+ checkFields<
192
+ Diff<
193
+ ParamCheck<Request | NextRequest>,
194
+ {
195
+ __tag__: 'PUT'
196
+ __param_position__: 'first'
197
+ __param_type__: FirstArg<MaybeField<TEntry, 'PUT'>>
198
+ },
199
+ 'PUT'
200
+ >
201
+ >()
202
+ checkFields<
203
+ Diff<
204
+ ParamCheck<RouteContext>,
205
+ {
206
+ __tag__: 'PUT'
207
+ __param_position__: 'second'
208
+ __param_type__: SecondArg<MaybeField<TEntry, 'PUT'>>
209
+ },
210
+ 'PUT'
211
+ >
212
+ >()
213
+
214
+ checkFields<
215
+ Diff<
216
+ {
217
+ __tag__: 'PUT',
218
+ __return_type__: Response | void | never | Promise<Response | void | never>
219
+ },
220
+ {
221
+ __tag__: 'PUT',
222
+ __return_type__: ReturnType<MaybeField<TEntry, 'PUT'>>
223
+ },
224
+ 'PUT'
225
+ >
226
+ >()
227
+ }
228
+ // Check the prop type of the entry function
229
+ if ('DELETE' in entry) {
230
+ checkFields<
231
+ Diff<
232
+ ParamCheck<Request | NextRequest>,
233
+ {
234
+ __tag__: 'DELETE'
235
+ __param_position__: 'first'
236
+ __param_type__: FirstArg<MaybeField<TEntry, 'DELETE'>>
237
+ },
238
+ 'DELETE'
239
+ >
240
+ >()
241
+ checkFields<
242
+ Diff<
243
+ ParamCheck<RouteContext>,
244
+ {
245
+ __tag__: 'DELETE'
246
+ __param_position__: 'second'
247
+ __param_type__: SecondArg<MaybeField<TEntry, 'DELETE'>>
248
+ },
249
+ 'DELETE'
250
+ >
251
+ >()
252
+
253
+ checkFields<
254
+ Diff<
255
+ {
256
+ __tag__: 'DELETE',
257
+ __return_type__: Response | void | never | Promise<Response | void | never>
258
+ },
259
+ {
260
+ __tag__: 'DELETE',
261
+ __return_type__: ReturnType<MaybeField<TEntry, 'DELETE'>>
262
+ },
263
+ 'DELETE'
264
+ >
265
+ >()
266
+ }
267
+ // Check the prop type of the entry function
268
+ if ('PATCH' in entry) {
269
+ checkFields<
270
+ Diff<
271
+ ParamCheck<Request | NextRequest>,
272
+ {
273
+ __tag__: 'PATCH'
274
+ __param_position__: 'first'
275
+ __param_type__: FirstArg<MaybeField<TEntry, 'PATCH'>>
276
+ },
277
+ 'PATCH'
278
+ >
279
+ >()
280
+ checkFields<
281
+ Diff<
282
+ ParamCheck<RouteContext>,
283
+ {
284
+ __tag__: 'PATCH'
285
+ __param_position__: 'second'
286
+ __param_type__: SecondArg<MaybeField<TEntry, 'PATCH'>>
287
+ },
288
+ 'PATCH'
289
+ >
290
+ >()
291
+
292
+ checkFields<
293
+ Diff<
294
+ {
295
+ __tag__: 'PATCH',
296
+ __return_type__: Response | void | never | Promise<Response | void | never>
297
+ },
298
+ {
299
+ __tag__: 'PATCH',
300
+ __return_type__: ReturnType<MaybeField<TEntry, 'PATCH'>>
301
+ },
302
+ 'PATCH'
303
+ >
304
+ >()
305
+ }
306
+
307
+ // Check the arguments and return type of the generateStaticParams function
308
+ if ('generateStaticParams' in entry) {
309
+ checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
310
+ checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
311
+ }
312
+
313
+ export interface PageProps {
314
+ params?: Promise<SegmentParams>
315
+ searchParams?: Promise<any>
316
+ }
317
+ export interface LayoutProps {
318
+ children?: React.ReactNode
319
+
320
+ params?: Promise<SegmentParams>
321
+ }
322
+
323
+ // =============
324
+ // Utility types
325
+ type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
326
+
327
+ // If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
328
+ type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
329
+ type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
330
+
331
+ type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
332
+ type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
333
+ type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
334
+
335
+ type ParamCheck<T> = {
336
+ __tag__: string
337
+ __param_position__: string
338
+ __param_type__: T
339
+ }
340
+
341
+ function checkFields<_ extends { [k in keyof any]: never }>() {}
342
+
343
+ // https://github.com/sindresorhus/type-fest
344
+ type Numeric = number | bigint
345
+ type Zero = 0 | 0n
346
+ type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
347
+ type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
@@ -2,7 +2,7 @@
2
2
  // Do not edit this file manually
3
3
 
4
4
  type AppRoutes = "/"
5
- type AppRouteHandlerRoutes = "/api/feature" | "/api/file" | "/api/phase" | "/api/state" | "/api/state/watch" | "/api/task"
5
+ type AppRouteHandlerRoutes = "/api/feature" | "/api/file" | "/api/git" | "/api/personas" | "/api/phase" | "/api/state" | "/api/state/watch" | "/api/task" | "/api/terminal/input" | "/api/terminal/resize" | "/api/terminal/stream"
6
6
  type PageRoutes = never
7
7
  type LayoutRoutes = "/"
8
8
  type RedirectRoutes = never
@@ -14,10 +14,15 @@ interface ParamMap {
14
14
  "/": {}
15
15
  "/api/feature": {}
16
16
  "/api/file": {}
17
+ "/api/git": {}
18
+ "/api/personas": {}
17
19
  "/api/phase": {}
18
20
  "/api/state": {}
19
21
  "/api/state/watch": {}
20
22
  "/api/task": {}
23
+ "/api/terminal/input": {}
24
+ "/api/terminal/resize": {}
25
+ "/api/terminal/stream": {}
21
26
  }
22
27
 
23
28
 
@@ -74,6 +74,24 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
74
74
  type __Unused = __Check
75
75
  }
76
76
 
77
+ // Validate ../../src/app/api/git/route.ts
78
+ {
79
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/git">> = Specific
80
+ const handler = {} as typeof import("../../src/app/api/git/route.js")
81
+ type __Check = __IsExpected<typeof handler>
82
+ // @ts-ignore
83
+ type __Unused = __Check
84
+ }
85
+
86
+ // Validate ../../src/app/api/personas/route.ts
87
+ {
88
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/personas">> = Specific
89
+ const handler = {} as typeof import("../../src/app/api/personas/route.js")
90
+ type __Check = __IsExpected<typeof handler>
91
+ // @ts-ignore
92
+ type __Unused = __Check
93
+ }
94
+
77
95
  // Validate ../../src/app/api/phase/route.ts
78
96
  {
79
97
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/phase">> = Specific
@@ -110,6 +128,33 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
110
128
  type __Unused = __Check
111
129
  }
112
130
 
131
+ // Validate ../../src/app/api/terminal/input/route.ts
132
+ {
133
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/terminal/input">> = Specific
134
+ const handler = {} as typeof import("../../src/app/api/terminal/input/route.js")
135
+ type __Check = __IsExpected<typeof handler>
136
+ // @ts-ignore
137
+ type __Unused = __Check
138
+ }
139
+
140
+ // Validate ../../src/app/api/terminal/resize/route.ts
141
+ {
142
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/terminal/resize">> = Specific
143
+ const handler = {} as typeof import("../../src/app/api/terminal/resize/route.js")
144
+ type __Check = __IsExpected<typeof handler>
145
+ // @ts-ignore
146
+ type __Unused = __Check
147
+ }
148
+
149
+ // Validate ../../src/app/api/terminal/stream/route.ts
150
+ {
151
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/terminal/stream">> = Specific
152
+ const handler = {} as typeof import("../../src/app/api/terminal/stream/route.js")
153
+ type __Check = __IsExpected<typeof handler>
154
+ // @ts-ignore
155
+ type __Unused = __Check
156
+ }
157
+
113
158
 
114
159
 
115
160
 
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.terminalManager = void 0;
4
+ const ptyLoader_1 = require("../../secondary/pty/ptyLoader");
5
+ const utils_1 = require("./utils");
6
+ class TerminalManager {
7
+ activeProcess = null;
8
+ listeners = new Set();
9
+ workspacePath = "";
10
+ getOrSpawnProcess() {
11
+ const currentWorkspace = (0, utils_1.getWorkspacePath)();
12
+ // Spawn a new shell if none exists or if the workspace directory changed
13
+ if (!this.activeProcess || this.workspacePath !== currentWorkspace) {
14
+ if (this.activeProcess) {
15
+ this.cleanup();
16
+ }
17
+ this.workspacePath = currentWorkspace;
18
+ const isWin = process.platform === "win32";
19
+ const shell = isWin ? "cmd.exe" : process.env.SHELL || "/bin/bash";
20
+ // Login shell flag. The PTY itself provides the TTY that makes the shell
21
+ // behave interactively (prompt rendering, line editing, job control), so
22
+ // no explicit `-i` is needed.
23
+ const args = isWin ? [] : ["-l"];
24
+ const spawned = (0, ptyLoader_1.loadPty)().spawn(shell, args, {
25
+ name: "xterm-256color",
26
+ cols: 80,
27
+ rows: 24,
28
+ cwd: this.workspacePath,
29
+ env: {
30
+ ...process.env,
31
+ TERM: "xterm-256color",
32
+ },
33
+ });
34
+ this.activeProcess = spawned;
35
+ spawned.onData((data) => {
36
+ this.broadcast(data);
37
+ });
38
+ spawned.onExit(() => {
39
+ this.broadcast("\r\n[Shell process exited]\r\n");
40
+ this.activeProcess = null;
41
+ });
42
+ }
43
+ if (!this.activeProcess) {
44
+ throw new Error("Failed to initialize terminal process");
45
+ }
46
+ return this.activeProcess;
47
+ }
48
+ broadcast(data) {
49
+ this.listeners.forEach((listener) => {
50
+ try {
51
+ listener(data);
52
+ }
53
+ catch {
54
+ // ignore dead connections
55
+ }
56
+ });
57
+ }
58
+ addListener(listener) {
59
+ this.listeners.add(listener);
60
+ // Trigger terminal instantiation process
61
+ this.getOrSpawnProcess();
62
+ }
63
+ removeListener(listener) {
64
+ this.listeners.delete(listener);
65
+ // If no terminal pages are listening, we keep the process alive
66
+ // so command state is persisted (like a real terminal multiplexer)
67
+ }
68
+ writeInput(text) {
69
+ const proc = this.getOrSpawnProcess();
70
+ proc.write(text);
71
+ return true;
72
+ }
73
+ resize(cols, rows) {
74
+ if (!this.activeProcess)
75
+ return false;
76
+ try {
77
+ this.activeProcess.resize(cols, rows);
78
+ return true;
79
+ }
80
+ catch {
81
+ return false;
82
+ }
83
+ }
84
+ cleanup() {
85
+ if (this.activeProcess) {
86
+ this.activeProcess.kill();
87
+ this.activeProcess = null;
88
+ }
89
+ this.listeners.clear();
90
+ }
91
+ }
92
+ exports.terminalManager = new TerminalManager();