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,10 @@
1
+ import z from "zod";
2
+ import type { ZodType } from "zod";
3
+ export declare namespace BusEvent {
4
+ type Definition = ReturnType<typeof define>;
5
+ function define<Type extends string, Properties extends ZodType>(type: Type, properties: Properties): {
6
+ type: Type;
7
+ properties: Properties;
8
+ };
9
+ function payloads(): z.ZodDiscriminatedUnion<"type", any>;
10
+ }
@@ -0,0 +1,7 @@
1
+ import { EventEmitter } from "events";
2
+ export declare const GlobalBus: EventEmitter<{
3
+ event: [{
4
+ directory?: string;
5
+ payload: any;
6
+ }];
7
+ }>;
@@ -0,0 +1,26 @@
1
+ import z from "zod";
2
+ import { BusEvent } from "./bus-event";
3
+ export declare namespace Bus {
4
+ const InstanceDisposed: {
5
+ type: "server.instance.disposed";
6
+ properties: z.ZodObject<{
7
+ directory: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ directory: string;
10
+ }, {
11
+ directory: string;
12
+ }>;
13
+ };
14
+ function publish<Definition extends BusEvent.Definition>(def: Definition, properties: z.output<Definition["properties"]>): Promise<void[]>;
15
+ function subscribe<Definition extends BusEvent.Definition>(def: Definition, callback: (event: {
16
+ type: Definition["type"];
17
+ properties: z.infer<Definition["properties"]>;
18
+ }) => void): () => void;
19
+ function once<Definition extends BusEvent.Definition>(def: Definition, callback: (event: {
20
+ type: Definition["type"];
21
+ properties: z.infer<Definition["properties"]>;
22
+ }) => "done" | undefined): void;
23
+ function subscribeAll(callback: (event: any) => void): () => void;
24
+ }
25
+ export { BusEvent } from "./bus-event";
26
+ export { GlobalBus } from "./global";
@@ -0,0 +1,23 @@
1
+ export declare function authLogin(options?: {
2
+ file?: string;
3
+ provider?: string;
4
+ }): Promise<void>;
5
+ export declare function authList(): Promise<void>;
6
+ export declare function authLogout(): Promise<void>;
7
+ /**
8
+ * Check if any LLM provider has credentials configured
9
+ * Note: This checks for actual LLM providers (like vertex-ai), not utility keys (like perplexity for websearch)
10
+ */
11
+ export declare function hasAnyCredentials(): Promise<boolean>;
12
+ /**
13
+ * Check if Perplexity API key is configured
14
+ */
15
+ export declare function hasPerplexityKey(): Promise<boolean>;
16
+ /**
17
+ * Set up Perplexity API key
18
+ */
19
+ export declare function setupPerplexityKey(): Promise<void>;
20
+ /**
21
+ * Run onboarding flow if no credentials configured
22
+ */
23
+ export declare function runOnboarding(): Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare function cli(): Promise<void>;
@@ -0,0 +1,26 @@
1
+ export declare namespace UI {
2
+ class CancelledError extends Error {
3
+ constructor();
4
+ }
5
+ const Style: {
6
+ TEXT_HIGHLIGHT: string;
7
+ TEXT_HIGHLIGHT_BOLD: string;
8
+ TEXT_DIM: string;
9
+ TEXT_DIM_BOLD: string;
10
+ TEXT_NORMAL: string;
11
+ TEXT_NORMAL_BOLD: string;
12
+ TEXT_WARNING: string;
13
+ TEXT_WARNING_BOLD: string;
14
+ TEXT_DANGER: string;
15
+ TEXT_DANGER_BOLD: string;
16
+ TEXT_SUCCESS: string;
17
+ TEXT_SUCCESS_BOLD: string;
18
+ TEXT_INFO: string;
19
+ TEXT_INFO_BOLD: string;
20
+ };
21
+ function println(...message: string[]): void;
22
+ function print(...message: string[]): void;
23
+ function empty(): void;
24
+ function logo(pad?: string): string;
25
+ function error(message: string): void;
26
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Command System
3
+ *
4
+ * Manages slash commands for the TUI.
5
+ * Commands can be triggered by typing / followed by the command name.
6
+ */
7
+ export type DialogType = "model" | "help" | "diagnostics" | "config" | "sessions" | null;
8
+ export interface Command {
9
+ name: string;
10
+ aliases?: string[];
11
+ description: string;
12
+ category: "session" | "display" | "system" | "help";
13
+ execute: (ctx: CommandContext) => void | Promise<void>;
14
+ }
15
+ export interface CommandContext {
16
+ sessionId?: string;
17
+ navigate: (route: any) => void;
18
+ exit: () => void;
19
+ showDialog: (type: DialogType) => void;
20
+ clearDialog: () => void;
21
+ showOutput: (text: string) => void;
22
+ optimize?: () => Promise<void>;
23
+ sessionTokens?: {
24
+ input: number;
25
+ output: number;
26
+ };
27
+ availableProviders?: string[];
28
+ currentModel?: string;
29
+ }
30
+ /**
31
+ * Register a command
32
+ */
33
+ export declare function register(command: Command): void;
34
+ /**
35
+ * Get all registered commands
36
+ */
37
+ export declare function all(): Command[];
38
+ /**
39
+ * Find a command by name or alias
40
+ */
41
+ export declare function find(name: string): Command | undefined;
42
+ /**
43
+ * Execute a command string (e.g., "/help" or "/session")
44
+ */
45
+ export declare function execute(input: string, ctx: CommandContext): Promise<boolean>;
46
+ export interface CommandSuggestion {
47
+ command: Command;
48
+ matchedName: string;
49
+ }
50
+ /**
51
+ * Get command suggestions for autocomplete
52
+ * Returns commands that start with the given prefix, along with which name/alias matched
53
+ */
54
+ export declare function suggestions(prefix: string): CommandSuggestion[];