upfynai-code 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 (65) hide show
  1. package/LICENSE +22 -0
  2. package/bin/cli.js +86 -0
  3. package/dist/assets/CanvasPanel-B48gAKVY.js +538 -0
  4. package/dist/assets/CanvasPanel-B48gAKVY.js.map +1 -0
  5. package/dist/assets/CanvasPanel-BsOG3EVs.css +1 -0
  6. package/dist/assets/index-CEhTwG68.css +1 -0
  7. package/dist/assets/index-GqAGWpJI.js +70 -0
  8. package/dist/assets/index-GqAGWpJI.js.map +1 -0
  9. package/dist/index.html +18 -0
  10. package/index.html +17 -0
  11. package/package.json +67 -0
  12. package/src/App.tsx +226 -0
  13. package/src/components/canvas/CanvasPanel.tsx +62 -0
  14. package/src/components/canvas/layout/graph-builder.ts +136 -0
  15. package/src/components/canvas/shapes/CompactionNodeShape.tsx +76 -0
  16. package/src/components/canvas/shapes/SessionNodeShape.tsx +93 -0
  17. package/src/components/canvas/shapes/StatuslineWidgetShape.tsx +125 -0
  18. package/src/components/canvas/shapes/TextResponseNodeShape.tsx +86 -0
  19. package/src/components/canvas/shapes/ToolCallNodeShape.tsx +107 -0
  20. package/src/components/canvas/shapes/ToolResultNodeShape.tsx +87 -0
  21. package/src/components/canvas/shapes/shared-styles.ts +35 -0
  22. package/src/components/chat/ChatPanel.tsx +96 -0
  23. package/src/components/chat/InputBar.tsx +81 -0
  24. package/src/components/chat/MessageList.tsx +130 -0
  25. package/src/components/chat/PermissionDialog.tsx +70 -0
  26. package/src/components/layout/FolderSelector.tsx +152 -0
  27. package/src/components/layout/ModelSelector.tsx +65 -0
  28. package/src/components/layout/SessionManager.tsx +115 -0
  29. package/src/components/statusline/StatuslineBar.tsx +114 -0
  30. package/src/main.tsx +10 -0
  31. package/src/server/claude-session.ts +156 -0
  32. package/src/server/index.ts +149 -0
  33. package/src/services/stream-consumer.ts +330 -0
  34. package/src/statusline-core/bin/statusline.sh +121 -0
  35. package/src/statusline-core/commands/sls-config.md +42 -0
  36. package/src/statusline-core/commands/sls-doctor.md +35 -0
  37. package/src/statusline-core/commands/sls-help.md +48 -0
  38. package/src/statusline-core/commands/sls-layout.md +38 -0
  39. package/src/statusline-core/commands/sls-preview.md +34 -0
  40. package/src/statusline-core/commands/sls-theme.md +40 -0
  41. package/src/statusline-core/installer.js +228 -0
  42. package/src/statusline-core/layouts/compact.sh +21 -0
  43. package/src/statusline-core/layouts/full.sh +62 -0
  44. package/src/statusline-core/layouts/standard.sh +39 -0
  45. package/src/statusline-core/lib/core.sh +389 -0
  46. package/src/statusline-core/lib/helpers.sh +81 -0
  47. package/src/statusline-core/lib/json-parser.sh +71 -0
  48. package/src/statusline-core/themes/catppuccin.sh +32 -0
  49. package/src/statusline-core/themes/default.sh +37 -0
  50. package/src/statusline-core/themes/gruvbox.sh +32 -0
  51. package/src/statusline-core/themes/nord.sh +32 -0
  52. package/src/statusline-core/themes/tokyo-night.sh +32 -0
  53. package/src/store/canvas-store.ts +50 -0
  54. package/src/store/chat-store.ts +60 -0
  55. package/src/store/permission-store.ts +29 -0
  56. package/src/store/session-store.ts +52 -0
  57. package/src/store/statusline-store.ts +160 -0
  58. package/src/styles/global.css +117 -0
  59. package/src/themes/index.ts +149 -0
  60. package/src/types/canvas-graph.ts +24 -0
  61. package/src/types/sdk-messages.ts +156 -0
  62. package/src/types/statusline-fields.ts +67 -0
  63. package/src/vite-env.d.ts +1 -0
  64. package/tsconfig.json +26 -0
  65. package/vite.config.ts +24 -0
@@ -0,0 +1,156 @@
1
+ // SDK message types matching Claude Code's stream-json output
2
+
3
+ export interface SystemInitMessage {
4
+ type: 'system';
5
+ subtype: 'init';
6
+ uuid: string;
7
+ session_id: string;
8
+ model: string;
9
+ cwd: string;
10
+ tools: string[];
11
+ mcp_servers: Array<{ name: string; status: string }>;
12
+ permissionMode: string;
13
+ slash_commands: string[];
14
+ }
15
+
16
+ export interface CompactBoundaryMessage {
17
+ type: 'system';
18
+ subtype: 'compact_boundary';
19
+ uuid: string;
20
+ session_id: string;
21
+ compact_metadata: {
22
+ trigger: string;
23
+ pre_tokens: number;
24
+ };
25
+ }
26
+
27
+ export type SystemMessage = SystemInitMessage | CompactBoundaryMessage;
28
+
29
+ export interface TokenUsage {
30
+ input_tokens: number;
31
+ output_tokens: number;
32
+ cache_creation_input_tokens?: number;
33
+ cache_read_input_tokens?: number;
34
+ }
35
+
36
+ export interface ContentBlockText {
37
+ type: 'text';
38
+ text: string;
39
+ }
40
+
41
+ export interface ContentBlockToolUse {
42
+ type: 'tool_use';
43
+ id: string;
44
+ name: string;
45
+ input: Record<string, unknown>;
46
+ }
47
+
48
+ export type ContentBlock = ContentBlockText | ContentBlockToolUse;
49
+
50
+ export interface AssistantMessageData {
51
+ role: 'assistant';
52
+ content: ContentBlock[];
53
+ model: string;
54
+ usage: TokenUsage;
55
+ stop_reason: 'end_turn' | 'tool_use' | 'max_tokens';
56
+ }
57
+
58
+ export interface AssistantMessage {
59
+ type: 'assistant';
60
+ uuid: string;
61
+ session_id: string;
62
+ message: AssistantMessageData;
63
+ parent_tool_use_id: string | null;
64
+ }
65
+
66
+ export interface ToolResultContent {
67
+ type: 'tool_result';
68
+ tool_use_id: string;
69
+ content: string;
70
+ is_error?: boolean;
71
+ }
72
+
73
+ export interface UserMessage {
74
+ type: 'user';
75
+ uuid: string;
76
+ session_id: string;
77
+ message: {
78
+ role: 'user';
79
+ content: ToolResultContent[] | string;
80
+ };
81
+ parent_tool_use_id: string | null;
82
+ }
83
+
84
+ export interface StreamEvent {
85
+ type: 'stream_event';
86
+ uuid: string;
87
+ session_id: string;
88
+ parent_tool_use_id: string | null;
89
+ event: {
90
+ type: string;
91
+ index?: number;
92
+ message?: { id: string; model: string; usage: TokenUsage };
93
+ content_block?: { type: string; text?: string; id?: string; name?: string };
94
+ delta?: {
95
+ type: string;
96
+ text?: string;
97
+ partial_json?: string;
98
+ stop_reason?: string;
99
+ };
100
+ usage?: { output_tokens: number };
101
+ };
102
+ }
103
+
104
+ export interface ModelUsageEntry {
105
+ inputTokens: number;
106
+ outputTokens: number;
107
+ cacheReadInputTokens: number;
108
+ cacheCreationInputTokens: number;
109
+ costUSD: number;
110
+ contextWindow: number;
111
+ }
112
+
113
+ export interface ResultMessage {
114
+ type: 'result';
115
+ subtype: 'success' | 'error_max_turns' | 'error_during_execution' | 'error_max_budget_usd';
116
+ uuid: string;
117
+ session_id: string;
118
+ duration_ms: number;
119
+ duration_api_ms: number;
120
+ is_error: boolean;
121
+ num_turns: number;
122
+ result?: string;
123
+ errors?: string[];
124
+ total_cost_usd: number;
125
+ usage: TokenUsage;
126
+ modelUsage: Record<string, ModelUsageEntry>;
127
+ }
128
+
129
+ export interface PermissionRequestMessage {
130
+ type: 'permission_request';
131
+ requestId: string;
132
+ toolName: string;
133
+ toolInput: Record<string, unknown>;
134
+ }
135
+
136
+ export type SDKMessage =
137
+ | SystemMessage
138
+ | AssistantMessage
139
+ | UserMessage
140
+ | StreamEvent
141
+ | ResultMessage
142
+ | PermissionRequestMessage;
143
+
144
+ // Chat UI message types
145
+ export interface ChatMessage {
146
+ id: string;
147
+ role: 'user' | 'assistant' | 'tool_call' | 'tool_result' | 'system';
148
+ content: string;
149
+ toolName?: string;
150
+ toolInput?: string;
151
+ toolUseId?: string;
152
+ isError?: boolean;
153
+ isStreaming?: boolean;
154
+ timestamp: number;
155
+ usage?: TokenUsage;
156
+ }
@@ -0,0 +1,67 @@
1
+ // TypeScript port of skill-statusline field definitions
2
+
3
+ export interface StatuslineData {
4
+ model: string;
5
+ modelId: string;
6
+ cwd: string;
7
+ dirShort: string;
8
+ branch: string;
9
+ gitDirty: { staged: boolean; unstaged: boolean };
10
+ github: string;
11
+ contextPct: number;
12
+ contextRemaining: number;
13
+ contextSize: number;
14
+ contextUsed: number;
15
+ tokensWinIn: number;
16
+ tokensWinOut: number;
17
+ tokensCumIn: number;
18
+ tokensCumOut: number;
19
+ cost: number;
20
+ costFormatted: string;
21
+ cacheCreate: number;
22
+ cacheRead: number;
23
+ skill: string;
24
+ duration: number;
25
+ durationFormatted: string;
26
+ linesAdded: number;
27
+ linesRemoved: number;
28
+ burnRate: string;
29
+ compactionWarning: string;
30
+ isCompacting: boolean;
31
+ numTurns: number;
32
+ sessionId: string;
33
+ permissionMode: string;
34
+ }
35
+
36
+ export const DEFAULT_STATUSLINE: StatuslineData = {
37
+ model: 'unknown',
38
+ modelId: '',
39
+ cwd: '',
40
+ dirShort: '~',
41
+ branch: 'no-git',
42
+ gitDirty: { staged: false, unstaged: false },
43
+ github: 'no-git',
44
+ contextPct: 0,
45
+ contextRemaining: 100,
46
+ contextSize: 200000,
47
+ contextUsed: 0,
48
+ tokensWinIn: 0,
49
+ tokensWinOut: 0,
50
+ tokensCumIn: 0,
51
+ tokensCumOut: 0,
52
+ cost: 0,
53
+ costFormatted: '$0.00',
54
+ cacheCreate: 0,
55
+ cacheRead: 0,
56
+ skill: 'Idle',
57
+ duration: 0,
58
+ durationFormatted: '0s',
59
+ linesAdded: 0,
60
+ linesRemoved: 0,
61
+ burnRate: '',
62
+ compactionWarning: '',
63
+ isCompacting: false,
64
+ numTurns: 0,
65
+ sessionId: '',
66
+ permissionMode: 'default',
67
+ };
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+ "moduleResolution": "bundler",
8
+ "allowImportingTsExtensions": true,
9
+ "isolatedModules": true,
10
+ "moduleDetection": "force",
11
+ "noEmit": true,
12
+ "jsx": "react-jsx",
13
+ "strict": true,
14
+ "noUnusedLocals": false,
15
+ "noUnusedParameters": false,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "forceConsistentCasingInFileNames": true,
18
+ "resolveJsonModule": true,
19
+ "paths": {
20
+ "@/*": ["./src/*"]
21
+ },
22
+ "baseUrl": "."
23
+ },
24
+ "include": ["src"],
25
+ "exclude": ["node_modules", "dist"]
26
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import path from 'path';
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ '@': path.resolve(__dirname, './src'),
10
+ },
11
+ },
12
+ server: {
13
+ proxy: {
14
+ '/api': {
15
+ target: 'http://localhost:3210',
16
+ changeOrigin: true,
17
+ },
18
+ },
19
+ },
20
+ build: {
21
+ outDir: 'dist',
22
+ sourcemap: true,
23
+ },
24
+ });