portercode 0.1.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 (112) hide show
  1. package/LICENSE +123 -0
  2. package/NOTICE +45 -0
  3. package/README.md +178 -0
  4. package/dist/auth/index.d.ts +103 -0
  5. package/dist/bus/bus-event.d.ts +10 -0
  6. package/dist/bus/global.d.ts +7 -0
  7. package/dist/bus/index.d.ts +26 -0
  8. package/dist/cli/auth.d.ts +11 -0
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/ui.d.ts +26 -0
  11. package/dist/command/index.d.ts +54 -0
  12. package/dist/config/config.d.ts +6756 -0
  13. package/dist/config/index.d.ts +2 -0
  14. package/dist/config/markdown.d.ts +415 -0
  15. package/dist/constants/index.d.ts +9 -0
  16. package/dist/diff/engine.d.ts +15 -0
  17. package/dist/diff/index.d.ts +8 -0
  18. package/dist/diff/types.d.ts +66 -0
  19. package/dist/file/ignore.d.ts +7 -0
  20. package/dist/flag/index.d.ts +19 -0
  21. package/dist/gateway/bridge.d.ts +11 -0
  22. package/dist/gateway/handlers/llm.d.ts +7 -0
  23. package/dist/gateway/handlers/permission.d.ts +15 -0
  24. package/dist/gateway/handlers/session.d.ts +7 -0
  25. package/dist/gateway/handlers/system.d.ts +7 -0
  26. package/dist/gateway/handlers/tool.d.ts +7 -0
  27. package/dist/gateway/index.d.ts +17 -0
  28. package/dist/gateway/protocol.d.ts +159 -0
  29. package/dist/gateway/router.d.ts +7 -0
  30. package/dist/gateway/server.d.ts +24 -0
  31. package/dist/global/index.d.ts +11 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +2 -0
  34. package/dist/permission/index.d.ts +2 -0
  35. package/dist/permission/permission.d.ts +172 -0
  36. package/dist/permission/types.d.ts +109 -0
  37. package/dist/project/index.d.ts +3 -0
  38. package/dist/project/instance.d.ts +33 -0
  39. package/dist/project/project.d.ts +82 -0
  40. package/dist/project/state.d.ts +4 -0
  41. package/dist/prompt/index.d.ts +5 -0
  42. package/dist/prompt/system.d.ts +24 -0
  43. package/dist/provider/index.d.ts +3 -0
  44. package/dist/provider/models.d.ts +17 -0
  45. package/dist/provider/provider.d.ts +844 -0
  46. package/dist/provider/types.d.ts +328 -0
  47. package/dist/session/context-optimization.d.ts +160 -0
  48. package/dist/session/index.d.ts +4 -0
  49. package/dist/session/llm.d.ts +29 -0
  50. package/dist/session/session.d.ts +400 -0
  51. package/dist/session/types.d.ts +544 -0
  52. package/dist/snapshot/index.d.ts +40 -0
  53. package/dist/storage/index.d.ts +1 -0
  54. package/dist/storage/storage.d.ts +34 -0
  55. package/dist/tool/bash.d.ts +19 -0
  56. package/dist/tool/edit.d.ts +21 -0
  57. package/dist/tool/glob.d.ts +15 -0
  58. package/dist/tool/grep.d.ts +20 -0
  59. package/dist/tool/image.d.ts +23 -0
  60. package/dist/tool/index.d.ts +11 -0
  61. package/dist/tool/ls.d.ts +14 -0
  62. package/dist/tool/read.d.ts +17 -0
  63. package/dist/tool/registry.d.ts +30 -0
  64. package/dist/tool/todo.d.ts +76 -0
  65. package/dist/tool/tool.d.ts +65 -0
  66. package/dist/tool/write.d.ts +16 -0
  67. package/dist/tui/App.d.ts +10 -0
  68. package/dist/tui/components/Header.d.ts +12 -0
  69. package/dist/tui/components/Message/AssistantMessage.d.ts +10 -0
  70. package/dist/tui/components/Message/ReasoningMessage.d.ts +20 -0
  71. package/dist/tui/components/Message/ToolCallMessage.d.ts +25 -0
  72. package/dist/tui/components/Message/UserMessage.d.ts +11 -0
  73. package/dist/tui/components/Message/index.d.ts +13 -0
  74. package/dist/tui/components/PermissionPrompt.d.ts +6 -0
  75. package/dist/tui/components/PromptInput.d.ts +32 -0
  76. package/dist/tui/components/REPL.d.ts +17 -0
  77. package/dist/tui/components/Spinner.d.ts +13 -0
  78. package/dist/tui/components/StatusBar.d.ts +12 -0
  79. package/dist/tui/components/TodoList.d.ts +17 -0
  80. package/dist/tui/components/WelcomeBox.d.ts +13 -0
  81. package/dist/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
  82. package/dist/tui/components/dialogs/HelpPanel.d.ts +11 -0
  83. package/dist/tui/components/dialogs/ModelSelector.d.ts +14 -0
  84. package/dist/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
  85. package/dist/tui/components/dialogs/SessionPicker.d.ts +15 -0
  86. package/dist/tui/components/dialogs/index.d.ts +10 -0
  87. package/dist/tui/components/diff/DiffHunk.d.ts +12 -0
  88. package/dist/tui/components/diff/DiffLine.d.ts +14 -0
  89. package/dist/tui/components/diff/DiffStats.d.ts +12 -0
  90. package/dist/tui/components/diff/DiffView.d.ts +15 -0
  91. package/dist/tui/components/diff/index.d.ts +9 -0
  92. package/dist/tui/hooks/usePermission.d.ts +26 -0
  93. package/dist/tui/index.d.ts +15 -0
  94. package/dist/tui/theme.d.ts +27 -0
  95. package/dist/tui/utils/Cursor.d.ts +37 -0
  96. package/dist/tui/utils/clipboard.d.ts +3 -0
  97. package/dist/tui/utils/keypress.d.ts +39 -0
  98. package/dist/tui/utils/markdown.d.ts +13 -0
  99. package/dist/tui/utils/openContent.d.ts +22 -0
  100. package/dist/util/context.d.ts +10 -0
  101. package/dist/util/debug.d.ts +51 -0
  102. package/dist/util/error.d.ts +294 -0
  103. package/dist/util/example-commands.d.ts +18 -0
  104. package/dist/util/filesystem.d.ts +17 -0
  105. package/dist/util/id.d.ts +24 -0
  106. package/dist/util/iife.d.ts +1 -0
  107. package/dist/util/index.d.ts +7 -0
  108. package/dist/util/lazy.d.ts +1 -0
  109. package/dist/util/log.d.ts +26 -0
  110. package/dist/util/timeout.d.ts +1 -0
  111. package/dist/util/wildcard.d.ts +8 -0
  112. package/package.json +72 -0
@@ -0,0 +1,400 @@
1
+ import z from "zod";
2
+ import type { SessionInfo, MessageInfo, MessagePart, MessageWithParts } from "./types";
3
+ export declare namespace Session {
4
+ /**
5
+ * Check if a title is the default auto-generated title
6
+ * Matches both "Session - <timestamp>" and "New Session"
7
+ */
8
+ function isDefaultTitle(title: string): boolean;
9
+ /**
10
+ * Session events
11
+ */
12
+ const Event: {
13
+ Created: {
14
+ type: "session.created";
15
+ properties: z.ZodObject<{
16
+ info: z.ZodType<{
17
+ id: string;
18
+ directory: string;
19
+ title: string;
20
+ projectId: string;
21
+ createdAt: number;
22
+ updatedAt: number;
23
+ parentId?: string | undefined;
24
+ }, z.ZodTypeDef, {
25
+ id: string;
26
+ directory: string;
27
+ title: string;
28
+ projectId: string;
29
+ createdAt: number;
30
+ updatedAt: number;
31
+ parentId?: string | undefined;
32
+ }>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ info: {
35
+ id: string;
36
+ directory: string;
37
+ title: string;
38
+ projectId: string;
39
+ createdAt: number;
40
+ updatedAt: number;
41
+ parentId?: string | undefined;
42
+ };
43
+ }, {
44
+ info: {
45
+ id: string;
46
+ directory: string;
47
+ title: string;
48
+ projectId: string;
49
+ createdAt: number;
50
+ updatedAt: number;
51
+ parentId?: string | undefined;
52
+ };
53
+ }>;
54
+ };
55
+ Updated: {
56
+ type: "session.updated";
57
+ properties: z.ZodObject<{
58
+ info: z.ZodType<{
59
+ id: string;
60
+ directory: string;
61
+ title: string;
62
+ projectId: string;
63
+ createdAt: number;
64
+ updatedAt: number;
65
+ parentId?: string | undefined;
66
+ }, z.ZodTypeDef, {
67
+ id: string;
68
+ directory: string;
69
+ title: string;
70
+ projectId: string;
71
+ createdAt: number;
72
+ updatedAt: number;
73
+ parentId?: string | undefined;
74
+ }>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ info: {
77
+ id: string;
78
+ directory: string;
79
+ title: string;
80
+ projectId: string;
81
+ createdAt: number;
82
+ updatedAt: number;
83
+ parentId?: string | undefined;
84
+ };
85
+ }, {
86
+ info: {
87
+ id: string;
88
+ directory: string;
89
+ title: string;
90
+ projectId: string;
91
+ createdAt: number;
92
+ updatedAt: number;
93
+ parentId?: string | undefined;
94
+ };
95
+ }>;
96
+ };
97
+ Deleted: {
98
+ type: "session.deleted";
99
+ properties: z.ZodObject<{
100
+ info: z.ZodType<{
101
+ id: string;
102
+ directory: string;
103
+ title: string;
104
+ projectId: string;
105
+ createdAt: number;
106
+ updatedAt: number;
107
+ parentId?: string | undefined;
108
+ }, z.ZodTypeDef, {
109
+ id: string;
110
+ directory: string;
111
+ title: string;
112
+ projectId: string;
113
+ createdAt: number;
114
+ updatedAt: number;
115
+ parentId?: string | undefined;
116
+ }>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ info: {
119
+ id: string;
120
+ directory: string;
121
+ title: string;
122
+ projectId: string;
123
+ createdAt: number;
124
+ updatedAt: number;
125
+ parentId?: string | undefined;
126
+ };
127
+ }, {
128
+ info: {
129
+ id: string;
130
+ directory: string;
131
+ title: string;
132
+ projectId: string;
133
+ createdAt: number;
134
+ updatedAt: number;
135
+ parentId?: string | undefined;
136
+ };
137
+ }>;
138
+ };
139
+ };
140
+ /**
141
+ * Message events
142
+ */
143
+ const MessageEvent: {
144
+ Updated: {
145
+ type: "message.updated";
146
+ properties: z.ZodObject<{
147
+ info: z.ZodType<{
148
+ id: string;
149
+ sessionId: string;
150
+ createdAt: number;
151
+ role: "system" | "user" | "assistant";
152
+ provider?: string | undefined;
153
+ model?: string | undefined;
154
+ }, z.ZodTypeDef, {
155
+ id: string;
156
+ sessionId: string;
157
+ createdAt: number;
158
+ role: "system" | "user" | "assistant";
159
+ provider?: string | undefined;
160
+ model?: string | undefined;
161
+ }>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ info: {
164
+ id: string;
165
+ sessionId: string;
166
+ createdAt: number;
167
+ role: "system" | "user" | "assistant";
168
+ provider?: string | undefined;
169
+ model?: string | undefined;
170
+ };
171
+ }, {
172
+ info: {
173
+ id: string;
174
+ sessionId: string;
175
+ createdAt: number;
176
+ role: "system" | "user" | "assistant";
177
+ provider?: string | undefined;
178
+ model?: string | undefined;
179
+ };
180
+ }>;
181
+ };
182
+ Removed: {
183
+ type: "message.removed";
184
+ properties: z.ZodObject<{
185
+ sessionId: z.ZodString;
186
+ messageId: z.ZodString;
187
+ }, "strip", z.ZodTypeAny, {
188
+ sessionId: string;
189
+ messageId: string;
190
+ }, {
191
+ sessionId: string;
192
+ messageId: string;
193
+ }>;
194
+ };
195
+ PartUpdated: {
196
+ type: "message.part.updated";
197
+ properties: z.ZodObject<{
198
+ part: z.ZodType<{
199
+ type: "text";
200
+ id: string;
201
+ sessionId: string;
202
+ content: string;
203
+ messageId: string;
204
+ } | {
205
+ type: "reasoning";
206
+ id: string;
207
+ sessionId: string;
208
+ content: string;
209
+ messageId: string;
210
+ } | {
211
+ type: "tool-call";
212
+ id: string;
213
+ state: "completed" | "pending" | "running" | "failed";
214
+ input: Record<string, any>;
215
+ sessionId: string;
216
+ toolId: string;
217
+ messageId: string;
218
+ toolName: string;
219
+ } | {
220
+ type: "tool-result";
221
+ id: string;
222
+ output: string;
223
+ sessionId: string;
224
+ messageId: string;
225
+ toolCallId: string;
226
+ input?: Record<string, any> | undefined;
227
+ toolName?: string | undefined;
228
+ metadata?: Record<string, any> | undefined;
229
+ }, z.ZodTypeDef, {
230
+ type: "text";
231
+ id: string;
232
+ sessionId: string;
233
+ content: string;
234
+ messageId: string;
235
+ } | {
236
+ type: "reasoning";
237
+ id: string;
238
+ sessionId: string;
239
+ content: string;
240
+ messageId: string;
241
+ } | {
242
+ type: "tool-call";
243
+ id: string;
244
+ state: "completed" | "pending" | "running" | "failed";
245
+ input: Record<string, any>;
246
+ sessionId: string;
247
+ toolId: string;
248
+ messageId: string;
249
+ toolName: string;
250
+ } | {
251
+ type: "tool-result";
252
+ id: string;
253
+ output: string;
254
+ sessionId: string;
255
+ messageId: string;
256
+ toolCallId: string;
257
+ input?: Record<string, any> | undefined;
258
+ toolName?: string | undefined;
259
+ metadata?: Record<string, any> | undefined;
260
+ }>;
261
+ delta: z.ZodOptional<z.ZodString>;
262
+ }, "strip", z.ZodTypeAny, {
263
+ part: {
264
+ type: "text";
265
+ id: string;
266
+ sessionId: string;
267
+ content: string;
268
+ messageId: string;
269
+ } | {
270
+ type: "reasoning";
271
+ id: string;
272
+ sessionId: string;
273
+ content: string;
274
+ messageId: string;
275
+ } | {
276
+ type: "tool-call";
277
+ id: string;
278
+ state: "completed" | "pending" | "running" | "failed";
279
+ input: Record<string, any>;
280
+ sessionId: string;
281
+ toolId: string;
282
+ messageId: string;
283
+ toolName: string;
284
+ } | {
285
+ type: "tool-result";
286
+ id: string;
287
+ output: string;
288
+ sessionId: string;
289
+ messageId: string;
290
+ toolCallId: string;
291
+ input?: Record<string, any> | undefined;
292
+ toolName?: string | undefined;
293
+ metadata?: Record<string, any> | undefined;
294
+ };
295
+ delta?: string | undefined;
296
+ }, {
297
+ part: {
298
+ type: "text";
299
+ id: string;
300
+ sessionId: string;
301
+ content: string;
302
+ messageId: string;
303
+ } | {
304
+ type: "reasoning";
305
+ id: string;
306
+ sessionId: string;
307
+ content: string;
308
+ messageId: string;
309
+ } | {
310
+ type: "tool-call";
311
+ id: string;
312
+ state: "completed" | "pending" | "running" | "failed";
313
+ input: Record<string, any>;
314
+ sessionId: string;
315
+ toolId: string;
316
+ messageId: string;
317
+ toolName: string;
318
+ } | {
319
+ type: "tool-result";
320
+ id: string;
321
+ output: string;
322
+ sessionId: string;
323
+ messageId: string;
324
+ toolCallId: string;
325
+ input?: Record<string, any> | undefined;
326
+ toolName?: string | undefined;
327
+ metadata?: Record<string, any> | undefined;
328
+ };
329
+ delta?: string | undefined;
330
+ }>;
331
+ };
332
+ PartRemoved: {
333
+ type: "message.part.removed";
334
+ properties: z.ZodObject<{
335
+ sessionId: z.ZodString;
336
+ messageId: z.ZodString;
337
+ partId: z.ZodString;
338
+ }, "strip", z.ZodTypeAny, {
339
+ sessionId: string;
340
+ messageId: string;
341
+ partId: string;
342
+ }, {
343
+ sessionId: string;
344
+ messageId: string;
345
+ partId: string;
346
+ }>;
347
+ };
348
+ };
349
+ /**
350
+ * Create a new session
351
+ */
352
+ function create(options?: {
353
+ title?: string;
354
+ parentId?: string;
355
+ }): Promise<SessionInfo>;
356
+ /**
357
+ * Get a session by ID
358
+ */
359
+ function get(sessionId: string): Promise<SessionInfo | undefined>;
360
+ /**
361
+ * Update a session
362
+ */
363
+ function update(sessionId: string, editor: (session: SessionInfo) => void): Promise<SessionInfo>;
364
+ /**
365
+ * Touch a session (update timestamp)
366
+ */
367
+ function touch(sessionId: string): Promise<void>;
368
+ /**
369
+ * List all sessions for current project
370
+ */
371
+ function list(): Promise<SessionInfo[]>;
372
+ /**
373
+ * Remove a session and all its messages
374
+ */
375
+ function remove(sessionId: string): Promise<void>;
376
+ /**
377
+ * Create or update a message
378
+ */
379
+ function updateMessage(message: MessageInfo): Promise<MessageInfo>;
380
+ /**
381
+ * Remove a message
382
+ */
383
+ function removeMessage(sessionId: string, messageId: string): Promise<void>;
384
+ /**
385
+ * Create or update a message part
386
+ */
387
+ function updatePart(part: MessagePart, delta?: string): Promise<MessagePart>;
388
+ /**
389
+ * Remove a message part
390
+ */
391
+ function removePart(sessionId: string, messageId: string, partId: string): Promise<void>;
392
+ /**
393
+ * Get all messages for a session
394
+ */
395
+ function messages(sessionId: string): Promise<MessageWithParts[]>;
396
+ /**
397
+ * Get the most recent session
398
+ */
399
+ function latest(): Promise<SessionInfo | undefined>;
400
+ }