portercode 0.1.4 → 0.1.11

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 (188) hide show
  1. package/LICENSE +174 -21
  2. package/README.md +162 -68
  3. package/dist/auth/index.d.ts +99 -0
  4. package/dist/brand/index.d.ts +7 -0
  5. package/dist/brand/loader.d.ts +463 -0
  6. package/dist/brand/rules.d.ts +25 -0
  7. package/dist/brand/schema.d.ts +246 -0
  8. package/dist/cli/auth.d.ts +14 -2
  9. package/dist/cli/brand.d.ts +6 -0
  10. package/dist/config/config.d.ts +0 -720
  11. package/dist/constants/index.d.ts +6 -9
  12. package/dist/constants/version.d.ts +5 -0
  13. package/dist/gateway/index.d.ts +5 -4
  14. package/dist/global/index.d.ts +12 -0
  15. package/dist/index.js +39 -1
  16. package/dist/prompt/template.d.ts +24 -0
  17. package/dist/provider/models.d.ts +0 -3
  18. package/dist/provider/provider.d.ts +5 -1
  19. package/dist/server/services/agent.d.ts +11 -0
  20. package/dist/session/context-cache.d.ts +75 -0
  21. package/dist/session/context-optimization.d.ts +5 -0
  22. package/dist/session/llm.d.ts +38 -1
  23. package/dist/session/message-optimizer.d.ts +32 -0
  24. package/dist/session/session.d.ts +101 -9
  25. package/dist/session/types.d.ts +92 -16
  26. package/dist/src/auth/index.d.ts +202 -0
  27. package/dist/src/brand/index.d.ts +7 -0
  28. package/dist/src/bus/bus-event.d.ts +10 -0
  29. package/dist/src/bus/global.d.ts +7 -0
  30. package/dist/src/bus/index.d.ts +26 -0
  31. package/dist/src/cli/auth.d.ts +23 -0
  32. package/dist/src/cli/index.d.ts +1 -0
  33. package/dist/src/cli/ui.d.ts +26 -0
  34. package/dist/src/command/index.d.ts +54 -0
  35. package/dist/src/config/config.d.ts +6036 -0
  36. package/dist/src/config/index.d.ts +2 -0
  37. package/dist/src/config/markdown.d.ts +415 -0
  38. package/dist/src/constants/index.d.ts +6 -0
  39. package/dist/src/constants/version.d.ts +5 -0
  40. package/dist/src/diff/engine.d.ts +15 -0
  41. package/dist/src/diff/index.d.ts +8 -0
  42. package/dist/src/diff/types.d.ts +66 -0
  43. package/dist/src/file/ignore.d.ts +7 -0
  44. package/dist/src/flag/index.d.ts +19 -0
  45. package/dist/src/gateway/bridge.d.ts +11 -0
  46. package/dist/src/gateway/handlers/llm.d.ts +7 -0
  47. package/dist/src/gateway/handlers/permission.d.ts +15 -0
  48. package/dist/src/gateway/handlers/session.d.ts +7 -0
  49. package/dist/src/gateway/handlers/system.d.ts +7 -0
  50. package/dist/src/gateway/handlers/tool.d.ts +7 -0
  51. package/dist/src/gateway/index.d.ts +18 -0
  52. package/dist/src/gateway/protocol.d.ts +159 -0
  53. package/dist/src/gateway/router.d.ts +7 -0
  54. package/dist/src/gateway/server.d.ts +24 -0
  55. package/dist/src/global/index.d.ts +23 -0
  56. package/dist/src/index.d.ts +2 -0
  57. package/dist/src/permission/index.d.ts +2 -0
  58. package/dist/src/permission/permission.d.ts +172 -0
  59. package/dist/src/permission/types.d.ts +109 -0
  60. package/dist/src/project/index.d.ts +3 -0
  61. package/dist/src/project/instance.d.ts +33 -0
  62. package/dist/src/project/project.d.ts +82 -0
  63. package/dist/src/project/state.d.ts +4 -0
  64. package/dist/src/prompt/index.d.ts +5 -0
  65. package/dist/src/prompt/system.d.ts +29 -0
  66. package/dist/src/prompt/template.d.ts +24 -0
  67. package/dist/src/provider/index.d.ts +3 -0
  68. package/dist/src/provider/models.d.ts +14 -0
  69. package/dist/src/provider/provider.d.ts +848 -0
  70. package/dist/src/provider/types.d.ts +328 -0
  71. package/dist/src/server/index.d.ts +21 -0
  72. package/dist/src/server/routes/api.d.ts +2 -0
  73. package/dist/src/server/routes/auth.d.ts +2 -0
  74. package/dist/src/server/routes/events.d.ts +2 -0
  75. package/dist/src/server/routes/health.d.ts +2 -0
  76. package/dist/src/server/routes/sessions.d.ts +2 -0
  77. package/dist/src/server/services/agent.d.ts +40 -0
  78. package/dist/src/server/services/permission.d.ts +43 -0
  79. package/dist/src/server/sse/emitter.d.ts +57 -0
  80. package/dist/src/session/context-cache.d.ts +75 -0
  81. package/dist/src/session/context-optimization.d.ts +165 -0
  82. package/dist/src/session/index.d.ts +5 -0
  83. package/dist/src/session/llm.d.ts +68 -0
  84. package/dist/src/session/message-optimizer.d.ts +32 -0
  85. package/dist/src/session/session.d.ts +524 -0
  86. package/dist/src/session/title-generator.d.ts +11 -0
  87. package/dist/src/session/types.d.ts +713 -0
  88. package/dist/src/snapshot/index.d.ts +40 -0
  89. package/dist/src/storage/index.d.ts +1 -0
  90. package/dist/src/storage/storage.d.ts +34 -0
  91. package/dist/src/theme.d.ts +66 -0
  92. package/dist/src/tool/bash.d.ts +19 -0
  93. package/dist/src/tool/edit.d.ts +21 -0
  94. package/dist/src/tool/glob.d.ts +15 -0
  95. package/dist/src/tool/grep.d.ts +20 -0
  96. package/dist/src/tool/image.d.ts +22 -0
  97. package/dist/src/tool/index.d.ts +11 -0
  98. package/dist/src/tool/ls.d.ts +14 -0
  99. package/dist/src/tool/read.d.ts +17 -0
  100. package/dist/src/tool/registry.d.ts +30 -0
  101. package/dist/src/tool/think.d.ts +11 -0
  102. package/dist/src/tool/todo.d.ts +76 -0
  103. package/dist/src/tool/tool.d.ts +65 -0
  104. package/dist/src/tool/webfetch.d.ts +15 -0
  105. package/dist/src/tool/websearch.d.ts +18 -0
  106. package/dist/src/tool/write.d.ts +16 -0
  107. package/dist/src/tui/App.d.ts +10 -0
  108. package/dist/src/tui/components/Header.d.ts +13 -0
  109. package/dist/src/tui/components/LoadingIndicator.d.ts +26 -0
  110. package/dist/src/tui/components/Message/AssistantMessage.d.ts +11 -0
  111. package/dist/src/tui/components/Message/ReasoningMessage.d.ts +21 -0
  112. package/dist/src/tui/components/Message/ToolCallMessage.d.ts +26 -0
  113. package/dist/src/tui/components/Message/UserMessage.d.ts +12 -0
  114. package/dist/src/tui/components/Message/index.d.ts +16 -0
  115. package/dist/src/tui/components/PermissionPrompt.d.ts +6 -0
  116. package/dist/src/tui/components/PromptInput.d.ts +33 -0
  117. package/dist/src/tui/components/REPL.d.ts +22 -0
  118. package/dist/src/tui/components/Spinner.d.ts +13 -0
  119. package/dist/src/tui/components/StatusBar.d.ts +13 -0
  120. package/dist/src/tui/components/TodoList.d.ts +17 -0
  121. package/dist/src/tui/components/WelcomeBox.d.ts +13 -0
  122. package/dist/src/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
  123. package/dist/src/tui/components/dialogs/HelpPanel.d.ts +11 -0
  124. package/dist/src/tui/components/dialogs/ModelSelector.d.ts +14 -0
  125. package/dist/src/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
  126. package/dist/src/tui/components/dialogs/SessionPicker.d.ts +20 -0
  127. package/dist/src/tui/components/dialogs/index.d.ts +10 -0
  128. package/dist/src/tui/components/diff/DiffHunk.d.ts +12 -0
  129. package/dist/src/tui/components/diff/DiffLine.d.ts +14 -0
  130. package/dist/src/tui/components/diff/DiffStats.d.ts +12 -0
  131. package/dist/src/tui/components/diff/DiffView.d.ts +15 -0
  132. package/dist/src/tui/components/diff/index.d.ts +9 -0
  133. package/dist/src/tui/hooks/useAnimatedLabel.d.ts +12 -0
  134. package/dist/src/tui/hooks/usePermission.d.ts +34 -0
  135. package/dist/src/tui/hooks/useTermWidth.d.ts +13 -0
  136. package/dist/src/tui/index.d.ts +20 -0
  137. package/dist/src/tui/theme.d.ts +8 -0
  138. package/dist/src/tui/utils/Cursor.d.ts +37 -0
  139. package/dist/src/tui/utils/clipboard.d.ts +3 -0
  140. package/dist/src/tui/utils/keypress.d.ts +39 -0
  141. package/dist/src/tui/utils/markdown.d.ts +13 -0
  142. package/dist/src/tui/utils/openContent.d.ts +22 -0
  143. package/dist/src/util/ascii.d.ts +22 -0
  144. package/dist/src/util/bell.d.ts +14 -0
  145. package/dist/src/util/color.d.ts +28 -0
  146. package/dist/src/util/context.d.ts +10 -0
  147. package/dist/src/util/debug.d.ts +51 -0
  148. package/dist/src/util/error.d.ts +294 -0
  149. package/dist/src/util/example-commands.d.ts +18 -0
  150. package/dist/src/util/filesystem.d.ts +17 -0
  151. package/dist/src/util/id.d.ts +24 -0
  152. package/dist/src/util/iife.d.ts +1 -0
  153. package/dist/src/util/index.d.ts +7 -0
  154. package/dist/src/util/lazy.d.ts +1 -0
  155. package/dist/src/util/log.d.ts +26 -0
  156. package/dist/src/util/paths.d.ts +45 -0
  157. package/dist/src/util/shell.d.ts +36 -0
  158. package/dist/src/util/timeout.d.ts +1 -0
  159. package/dist/src/util/wildcard.d.ts +8 -0
  160. package/dist/theme.d.ts +64 -0
  161. package/dist/tool/image.d.ts +3 -4
  162. package/dist/tool/think.d.ts +11 -0
  163. package/dist/tool/webfetch.d.ts +15 -0
  164. package/dist/tool/websearch.d.ts +18 -0
  165. package/dist/tools/think.d.ts +2 -0
  166. package/dist/tui/App.d.ts +1 -1
  167. package/dist/tui/components/Header.d.ts +2 -1
  168. package/dist/tui/components/LoadingIndicator.d.ts +26 -0
  169. package/dist/tui/components/Message/AssistantMessage.d.ts +2 -1
  170. package/dist/tui/components/Message/ReasoningMessage.d.ts +2 -1
  171. package/dist/tui/components/Message/ToolCallMessage.d.ts +3 -2
  172. package/dist/tui/components/Message/UserMessage.d.ts +2 -1
  173. package/dist/tui/components/Message/index.d.ts +4 -1
  174. package/dist/tui/components/PromptInput.d.ts +2 -1
  175. package/dist/tui/components/REPL.d.ts +6 -1
  176. package/dist/tui/components/StatusBar.d.ts +2 -1
  177. package/dist/tui/components/dialogs/SessionPicker.d.ts +6 -1
  178. package/dist/tui/hooks/useAnimatedLabel.d.ts +12 -0
  179. package/dist/tui/hooks/usePermission.d.ts +9 -1
  180. package/dist/tui/hooks/useTermWidth.d.ts +13 -0
  181. package/dist/tui/index.d.ts +5 -0
  182. package/dist/tui/theme.d.ts +4 -23
  183. package/dist/util/ascii.d.ts +22 -0
  184. package/dist/util/bell.d.ts +14 -0
  185. package/dist/util/color.d.ts +28 -0
  186. package/dist/util/paths.d.ts +45 -0
  187. package/dist/util/shell.d.ts +36 -0
  188. package/package.json +21 -1
@@ -0,0 +1,294 @@
1
+ import z from "zod";
2
+ export declare abstract class NamedError extends Error {
3
+ abstract schema(): z.ZodType;
4
+ abstract toObject(): {
5
+ name: string;
6
+ data: any;
7
+ };
8
+ static create<Name extends string, Data extends z.ZodType>(name: Name, data: Data): {
9
+ new (data: z.input<Data>, options?: ErrorOptions): {
10
+ readonly name: Name;
11
+ readonly data: z.input<Data>;
12
+ schema(): z.ZodObject<{
13
+ name: z.ZodLiteral<Name>;
14
+ data: Data;
15
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
16
+ name: z.ZodLiteral<Name>;
17
+ data: Data;
18
+ }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
19
+ name: z.ZodLiteral<Name>;
20
+ data: Data;
21
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
22
+ toObject(): {
23
+ name: Name;
24
+ data: z.input<Data>;
25
+ };
26
+ message: string;
27
+ stack?: string;
28
+ cause?: unknown;
29
+ };
30
+ readonly Schema: z.ZodObject<{
31
+ name: z.ZodLiteral<Name>;
32
+ data: Data;
33
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
34
+ name: z.ZodLiteral<Name>;
35
+ data: Data;
36
+ }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
37
+ name: z.ZodLiteral<Name>;
38
+ data: Data;
39
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
40
+ isInstance(input: any): input is InstanceType</*elided*/ any>;
41
+ create<Name extends string, Data extends z.ZodType>(name: Name, data: Data): /*elided*/ any;
42
+ readonly Unknown: {
43
+ new (data: {
44
+ message: string;
45
+ }, options?: ErrorOptions): {
46
+ readonly name: "UnknownError";
47
+ readonly data: {
48
+ message: string;
49
+ };
50
+ schema(): z.ZodObject<{
51
+ name: z.ZodLiteral<"UnknownError">;
52
+ data: z.ZodObject<{
53
+ message: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ message: string;
56
+ }, {
57
+ message: string;
58
+ }>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ name: "UnknownError";
61
+ data: {
62
+ message: string;
63
+ };
64
+ }, {
65
+ name: "UnknownError";
66
+ data: {
67
+ message: string;
68
+ };
69
+ }>;
70
+ toObject(): {
71
+ name: "UnknownError";
72
+ data: {
73
+ message: string;
74
+ };
75
+ };
76
+ message: string;
77
+ stack?: string;
78
+ cause?: unknown;
79
+ };
80
+ readonly Schema: z.ZodObject<{
81
+ name: z.ZodLiteral<"UnknownError">;
82
+ data: z.ZodObject<{
83
+ message: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ message: string;
86
+ }, {
87
+ message: string;
88
+ }>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ name: "UnknownError";
91
+ data: {
92
+ message: string;
93
+ };
94
+ }, {
95
+ name: "UnknownError";
96
+ data: {
97
+ message: string;
98
+ };
99
+ }>;
100
+ isInstance(input: any): input is {
101
+ readonly name: "UnknownError";
102
+ readonly data: {
103
+ message: string;
104
+ };
105
+ schema(): z.ZodObject<{
106
+ name: z.ZodLiteral<"UnknownError">;
107
+ data: z.ZodObject<{
108
+ message: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ message: string;
111
+ }, {
112
+ message: string;
113
+ }>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ name: "UnknownError";
116
+ data: {
117
+ message: string;
118
+ };
119
+ }, {
120
+ name: "UnknownError";
121
+ data: {
122
+ message: string;
123
+ };
124
+ }>;
125
+ toObject(): {
126
+ name: "UnknownError";
127
+ data: {
128
+ message: string;
129
+ };
130
+ };
131
+ message: string;
132
+ stack?: string;
133
+ cause?: unknown;
134
+ };
135
+ create<Name extends string, Data extends z.ZodType>(name: Name, data: Data): /*elided*/ any;
136
+ readonly Unknown: /*elided*/ any;
137
+ isError(error: unknown): error is Error;
138
+ isError(value: unknown): value is Error;
139
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
140
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
141
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
142
+ stackTraceLimit: number;
143
+ };
144
+ isError(error: unknown): error is Error;
145
+ isError(value: unknown): value is Error;
146
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
147
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
148
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
149
+ stackTraceLimit: number;
150
+ };
151
+ static readonly Unknown: {
152
+ new (data: {
153
+ message: string;
154
+ }, options?: ErrorOptions): {
155
+ readonly name: "UnknownError";
156
+ readonly data: {
157
+ message: string;
158
+ };
159
+ schema(): z.ZodObject<{
160
+ name: z.ZodLiteral<"UnknownError">;
161
+ data: z.ZodObject<{
162
+ message: z.ZodString;
163
+ }, "strip", z.ZodTypeAny, {
164
+ message: string;
165
+ }, {
166
+ message: string;
167
+ }>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ name: "UnknownError";
170
+ data: {
171
+ message: string;
172
+ };
173
+ }, {
174
+ name: "UnknownError";
175
+ data: {
176
+ message: string;
177
+ };
178
+ }>;
179
+ toObject(): {
180
+ name: "UnknownError";
181
+ data: {
182
+ message: string;
183
+ };
184
+ };
185
+ message: string;
186
+ stack?: string;
187
+ cause?: unknown;
188
+ };
189
+ readonly Schema: z.ZodObject<{
190
+ name: z.ZodLiteral<"UnknownError">;
191
+ data: z.ZodObject<{
192
+ message: z.ZodString;
193
+ }, "strip", z.ZodTypeAny, {
194
+ message: string;
195
+ }, {
196
+ message: string;
197
+ }>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ name: "UnknownError";
200
+ data: {
201
+ message: string;
202
+ };
203
+ }, {
204
+ name: "UnknownError";
205
+ data: {
206
+ message: string;
207
+ };
208
+ }>;
209
+ isInstance(input: any): input is {
210
+ readonly name: "UnknownError";
211
+ readonly data: {
212
+ message: string;
213
+ };
214
+ schema(): z.ZodObject<{
215
+ name: z.ZodLiteral<"UnknownError">;
216
+ data: z.ZodObject<{
217
+ message: z.ZodString;
218
+ }, "strip", z.ZodTypeAny, {
219
+ message: string;
220
+ }, {
221
+ message: string;
222
+ }>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ name: "UnknownError";
225
+ data: {
226
+ message: string;
227
+ };
228
+ }, {
229
+ name: "UnknownError";
230
+ data: {
231
+ message: string;
232
+ };
233
+ }>;
234
+ toObject(): {
235
+ name: "UnknownError";
236
+ data: {
237
+ message: string;
238
+ };
239
+ };
240
+ message: string;
241
+ stack?: string;
242
+ cause?: unknown;
243
+ };
244
+ create<Name extends string, Data extends z.ZodType>(name: Name, data: Data): {
245
+ new (data: z.input<Data>, options?: ErrorOptions): {
246
+ readonly name: Name;
247
+ readonly data: z.input<Data>;
248
+ schema(): z.ZodObject<{
249
+ name: z.ZodLiteral<Name>;
250
+ data: Data;
251
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
252
+ name: z.ZodLiteral<Name>;
253
+ data: Data;
254
+ }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
255
+ name: z.ZodLiteral<Name>;
256
+ data: Data;
257
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
258
+ toObject(): {
259
+ name: Name;
260
+ data: z.input<Data>;
261
+ };
262
+ message: string;
263
+ stack?: string;
264
+ cause?: unknown;
265
+ };
266
+ readonly Schema: z.ZodObject<{
267
+ name: z.ZodLiteral<Name>;
268
+ data: Data;
269
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
270
+ name: z.ZodLiteral<Name>;
271
+ data: Data;
272
+ }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
273
+ name: z.ZodLiteral<Name>;
274
+ data: Data;
275
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
276
+ isInstance(input: any): input is InstanceType</*elided*/ any>;
277
+ create<Name extends string, Data extends z.ZodType>(name: Name, data: Data): /*elided*/ any;
278
+ readonly Unknown: /*elided*/ any;
279
+ isError(error: unknown): error is Error;
280
+ isError(value: unknown): value is Error;
281
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
282
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
283
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
284
+ stackTraceLimit: number;
285
+ };
286
+ readonly Unknown: /*elided*/ any;
287
+ isError(error: unknown): error is Error;
288
+ isError(value: unknown): value is Error;
289
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
290
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
291
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
292
+ stackTraceLimit: number;
293
+ };
294
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Example Commands
3
+ *
4
+ * Generates contextual example commands for the prompt placeholder.
5
+ * Similar to code-cli's example suggestions.
6
+ */
7
+ /**
8
+ * Generate a contextual example command
9
+ */
10
+ export declare function getExampleCommand(): string;
11
+ /**
12
+ * Get placeholder text with example command
13
+ */
14
+ export declare function getPlaceholder(): string;
15
+ /**
16
+ * Get multiple unique examples
17
+ */
18
+ export declare function getExamples(count?: number): string[];
@@ -0,0 +1,17 @@
1
+ export declare namespace Filesystem {
2
+ /**
3
+ * On Windows, normalize a path to its canonical casing using the filesystem.
4
+ * This is needed because Windows paths are case-insensitive but LSP servers
5
+ * may return paths with different casing than what we send them.
6
+ */
7
+ function normalizePath(p: string): string;
8
+ function overlaps(a: string, b: string): boolean;
9
+ function contains(parent: string, child: string): boolean;
10
+ function findUp(target: string, start: string, stop?: string): Promise<string[]>;
11
+ function up(options: {
12
+ targets: string[];
13
+ start: string;
14
+ stop?: string;
15
+ }): AsyncGenerator<string, void, unknown>;
16
+ function globUp(pattern: string, start: string, stop?: string): Promise<string[]>;
17
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * ID Generation Utilities
3
+ *
4
+ * Provides unique identifier generation for sessions, messages, and parts.
5
+ * Uses timestamp-based sorting with random suffixes for uniqueness.
6
+ */
7
+ /**
8
+ * Generate a timestamp-based ID (ascending order - newer IDs are larger)
9
+ */
10
+ export declare function ascending(prefix: string): string;
11
+ /**
12
+ * Generate a timestamp-based ID (descending order - newer IDs are smaller)
13
+ * Useful for listing sessions in reverse chronological order
14
+ */
15
+ export declare function descending(prefix: string): string;
16
+ /**
17
+ * Generate IDs with specific prefixes
18
+ */
19
+ export declare const Id: {
20
+ session: () => string;
21
+ message: () => string;
22
+ part: () => string;
23
+ random: (prefix?: string) => string;
24
+ };
@@ -0,0 +1 @@
1
+ export declare function iife<T>(fn: () => T): T;
@@ -0,0 +1,7 @@
1
+ export * from "./context";
2
+ export * from "./lazy";
3
+ export * from "./log";
4
+ export * from "./error";
5
+ export * from "./iife";
6
+ export * from "./filesystem";
7
+ export * from "./id";
@@ -0,0 +1 @@
1
+ export declare function lazy<T>(fn: () => T): () => T;
@@ -0,0 +1,26 @@
1
+ import z from "zod";
2
+ export declare namespace Log {
3
+ const Level: z.ZodEnum<["DEBUG", "INFO", "WARN", "ERROR"]>;
4
+ type Level = z.infer<typeof Level>;
5
+ type Logger = {
6
+ debug(message?: any, extra?: Record<string, any>): void;
7
+ info(message?: any, extra?: Record<string, any>): void;
8
+ error(message?: any, extra?: Record<string, any>): void;
9
+ warn(message?: any, extra?: Record<string, any>): void;
10
+ tag(key: string, value: string): Logger;
11
+ clone(): Logger;
12
+ time(message: string, extra?: Record<string, any>): {
13
+ stop(): void;
14
+ [Symbol.dispose](): void;
15
+ };
16
+ };
17
+ const Default: Logger;
18
+ interface Options {
19
+ print: boolean;
20
+ dev?: boolean;
21
+ level?: Level;
22
+ }
23
+ function file(): string;
24
+ function init(options: Options): Promise<void>;
25
+ function create(tags?: Record<string, any>): Logger;
26
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Cross-platform path utilities
3
+ * Helps handle file paths correctly across Windows, macOS, and Linux
4
+ */
5
+ /**
6
+ * Resolve home directory paths (~/...)
7
+ * Works cross-platform (Windows, macOS, Linux)
8
+ *
9
+ * @param filepath - Path that may start with ~/
10
+ * @returns Resolved absolute path
11
+ *
12
+ * @example
13
+ * resolveHomePath("~/Documents/file.txt")
14
+ * // Windows: C:\Users\username\Documents\file.txt
15
+ * // macOS: /Users/username/Documents/file.txt
16
+ * // Linux: /home/username/Documents/file.txt
17
+ */
18
+ export declare function resolveHomePath(filepath: string): string;
19
+ /**
20
+ * Get platform-specific config directory for an application
21
+ *
22
+ * @param commandName - Name of the command/application
23
+ * @returns Platform-appropriate config directory path
24
+ *
25
+ * @example
26
+ * getConfigDir("portercode")
27
+ * // Windows: C:\Users\username\AppData\Roaming\portercode
28
+ * // macOS: /Users/username/Library/Application Support/portercode
29
+ * // Linux: /home/username/.config/portercode
30
+ */
31
+ export declare function getConfigDir(commandName: string): string;
32
+ /**
33
+ * Get platform-specific data directory for an application
34
+ * This is where app data files are typically stored
35
+ *
36
+ * @param commandName - Name of the command/application
37
+ * @returns Platform-appropriate data directory path
38
+ *
39
+ * @example
40
+ * getDataDir("portercode")
41
+ * // Windows: C:\Users\username\AppData\Local\portercode
42
+ * // macOS: /Users/username/Library/Application Support/portercode
43
+ * // Linux: /home/username/.local/share/portercode
44
+ */
45
+ export declare function getDataDir(commandName: string): string;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Shell Utilities
3
+ *
4
+ * Manages shell aliases and RC files across different shells
5
+ */
6
+ export declare namespace ShellUtils {
7
+ type Shell = "bash" | "zsh" | "fish" | "powershell" | "unknown";
8
+ /**
9
+ * Detect current shell
10
+ */
11
+ function detectShell(): Shell;
12
+ /**
13
+ * Get shell RC file path
14
+ */
15
+ function getShellRc(shell?: Shell): string;
16
+ /**
17
+ * Create alias in shell RC file
18
+ */
19
+ function createAlias(aliasName: string, targetCommand: string, shell?: Shell): Promise<{
20
+ success: boolean;
21
+ rcFile: string;
22
+ message: string;
23
+ }>;
24
+ /**
25
+ * Remove alias from shell RC file
26
+ */
27
+ function removeAlias(aliasName: string, shell?: Shell): Promise<{
28
+ success: boolean;
29
+ rcFile: string;
30
+ message: string;
31
+ }>;
32
+ /**
33
+ * Check if alias exists in shell RC files
34
+ */
35
+ function hasAlias(aliasName: string, shell?: Shell): Promise<boolean>;
36
+ }
@@ -0,0 +1 @@
1
+ export declare function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T>;
@@ -0,0 +1,8 @@
1
+ export declare namespace Wildcard {
2
+ function match(str: string, pattern: string): boolean;
3
+ function all(input: string, patterns: Record<string, any>): any;
4
+ function allStructured(input: {
5
+ head: string;
6
+ tail: string[];
7
+ }, patterns: Record<string, any>): any;
8
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Theme & Brand Configuration
3
+ *
4
+ * This file contains all branding and theming configuration for the application.
5
+ * To customize the brand/theme, modify the values in this file directly.
6
+ *
7
+ * For a complete rebrand, you'll also need to update:
8
+ * - package.json: Change the "bin" field to match your command name
9
+ */
10
+ /** Product display name shown in UI and messages */
11
+ export declare const PRODUCT_NAME = "Porter";
12
+ /** CLI command name (lowercase, alphanumeric with hyphens) */
13
+ export declare const PRODUCT_COMMAND = "porter";
14
+ /** Configuration directory name (hidden folder in project/home) */
15
+ export declare const CONFIG_DIR = ".porter";
16
+ /** Configuration file name */
17
+ export declare const CONFIG_FILE = "porter.jsonc";
18
+ /** Rules/instructions file name */
19
+ export declare const RULES_FILE = "PORTER.md";
20
+ /** Environment variable prefix */
21
+ export declare const ENV_PREFIX = "PORTER_";
22
+ /** Simple logo for compact spaces (e.g., welcome screen) */
23
+ export declare const LOGO_SIMPLE: string[];
24
+ /** Extended logo for larger displays (e.g., CLI mode) */
25
+ export declare const LOGO_EXTENDED: string[];
26
+ /** ASCII-only logo (fallback for terminals without UTF-8 support) */
27
+ export declare const LOGO_ASCII: string[];
28
+ /** Local rule files searched in project directories */
29
+ export declare const LOCAL_RULE_FILES: readonly ["PORTER.md", "AGENTS.md", "CONTEXT.md"];
30
+ /** Global rule files searched in home directory */
31
+ export declare const GLOBAL_RULE_FILES: readonly ["PORTER.md"];
32
+ /** Default theme name */
33
+ export declare const DEFAULT_THEME = "porter";
34
+ /** Primary brand color (used for logo, highlights, etc.) */
35
+ export declare const PRIMARY_COLOR = "#7c3aed";
36
+ /** Theme interface definition */
37
+ export interface Theme {
38
+ name: string;
39
+ background: string;
40
+ foreground: string;
41
+ text: string;
42
+ primary: string;
43
+ secondary: string;
44
+ success: string;
45
+ warning: string;
46
+ error: string;
47
+ muted: string;
48
+ border: string;
49
+ selection: string;
50
+ diffAdd: string;
51
+ diffRemove: string;
52
+ diffContext: string;
53
+ diffHunkHeader: string;
54
+ }
55
+ /** Available themes */
56
+ export declare const themes: Record<string, Theme>;
57
+ /** Get the current active theme */
58
+ export declare function getTheme(): Theme;
59
+ /** Set the active theme by name */
60
+ export declare function setTheme(name: string): void;
61
+ /** Get all available theme names */
62
+ export declare function getThemeNames(): string[];
63
+ /** Initialize theme (can be called at startup) */
64
+ export declare function initTheme(themeName?: string): void;
@@ -4,20 +4,19 @@ export declare const ImageTool: Tool.Info<z.ZodObject<{
4
4
  prompt: z.ZodString;
5
5
  filename: z.ZodString;
6
6
  directory: z.ZodOptional<z.ZodString>;
7
- aspectRatio: z.ZodOptional<z.ZodEnum<["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5", "21:9"]>>;
7
+ aspectRatio: z.ZodOptional<z.ZodEnum<["1:1", "16:9", "9:16", "4:3", "3:4"]>>;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  filename: string;
10
10
  prompt: string;
11
11
  directory?: string | undefined;
12
- aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9" | undefined;
12
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | undefined;
13
13
  }, {
14
14
  filename: string;
15
15
  prompt: string;
16
16
  directory?: string | undefined;
17
- aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9" | undefined;
17
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | undefined;
18
18
  }>, {
19
19
  path: string;
20
20
  size: number;
21
21
  duration: string;
22
- aspectRatio: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "5:4" | "4:5" | "21:9";
23
22
  }>;
@@ -0,0 +1,11 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const ThinkTool: Tool.Info<z.ZodObject<{
4
+ thought: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ thought: string;
7
+ }, {
8
+ thought: string;
9
+ }>, {
10
+ thoughtLength: number;
11
+ }>;
@@ -0,0 +1,15 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const WebFetchTool: Tool.Info<z.ZodObject<{
4
+ url: z.ZodString;
5
+ selector: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ url: string;
8
+ selector?: string | undefined;
9
+ }, {
10
+ url: string;
11
+ selector?: string | undefined;
12
+ }>, {
13
+ url: string;
14
+ length: number;
15
+ }>;
@@ -0,0 +1,18 @@
1
+ import z from "zod";
2
+ import { Tool } from "./tool";
3
+ export declare const WebSearchTool: Tool.Info<z.ZodObject<{
4
+ query: z.ZodString;
5
+ deep: z.ZodOptional<z.ZodBoolean>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ query: string;
8
+ deep?: boolean | undefined;
9
+ }, {
10
+ query: string;
11
+ deep?: boolean | undefined;
12
+ }>, {
13
+ query: string;
14
+ numQueries: number;
15
+ numResults: number;
16
+ numCitations: number;
17
+ deepSearch: boolean;
18
+ }>;
@@ -0,0 +1,2 @@
1
+ import type { Tool } from "../types/tool";
2
+ export declare const thinkTool: Tool;
package/dist/tui/App.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  import type { TuiOptions } from "./index";
7
7
  interface AppProps extends TuiOptions {
8
8
  }
9
- export declare function App({ sessionId: initialSessionId, onExit }: AppProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function App({ sessionId: initialSessionId, onExit, instanceContext }: AppProps): import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -3,10 +3,11 @@
3
3
  *
4
4
  * Displays the app title, mode indicator, and session title.
5
5
  */
6
+ import React from "react";
6
7
  type Mode = "auto" | "plan" | "ask";
7
8
  interface HeaderProps {
8
9
  title?: string;
9
10
  mode: Mode;
10
11
  }
11
- export declare function Header({ title, mode }: HeaderProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare const Header: React.NamedExoticComponent<HeaderProps>;
12
13
  export {};