@allternit/gizzi-code 1.0.0 → 1.0.1

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 (158) hide show
  1. package/bin/gizzi +4 -0
  2. package/bin/gizzi-ink +5 -0
  3. package/package.json +137 -31
  4. package/src/Tool.ts +26 -0
  5. package/src/bootstrap/state.ts +165 -322
  6. package/src/commands.ts +209 -0
  7. package/src/context/QueuedMessageContext.tsx +63 -0
  8. package/src/context/fpsMetrics.tsx +30 -0
  9. package/src/context/mailbox.tsx +38 -0
  10. package/src/context/modalContext.tsx +58 -0
  11. package/src/context/notifications.tsx +240 -0
  12. package/src/context/overlayContext.tsx +151 -0
  13. package/src/context/promptOverlayContext.tsx +125 -0
  14. package/src/context/stats.tsx +220 -0
  15. package/src/context/voice.tsx +88 -0
  16. package/src/hooks/useCanUseTool.ts +11 -0
  17. package/src/hooks/useExitOnCtrlCD.ts +40 -187
  18. package/src/hooks/useExitOnCtrlCDWithKeybindings.ts +68 -0
  19. package/src/hooks/useKeybinding.ts +68 -209
  20. package/src/hooks/useTerminalSize.ts +31 -99
  21. package/src/hooks.ts +37 -0
  22. package/src/ink.ts +204 -0
  23. package/src/main.ts +7 -0
  24. package/src/types/command.ts +216 -0
  25. package/src/types/connectorText.ts +39 -0
  26. package/src/types/fileSuggestion.ts +15 -0
  27. package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +865 -0
  28. package/src/types/generated/events_mono/common/v1/auth.ts +100 -0
  29. package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +223 -0
  30. package/src/types/generated/google/protobuf/timestamp.ts +187 -0
  31. package/src/types/hooks.ts +319 -0
  32. package/src/types/ids.ts +44 -0
  33. package/src/types/logs.ts +331 -0
  34. package/src/types/merged/index.ts +5 -0
  35. package/src/types/merged/message.ts +552 -0
  36. package/src/types/message.ts +927 -186
  37. package/src/types/messageQueueTypes.ts +21 -0
  38. package/src/types/notebook.ts +72 -0
  39. package/src/types/permissions.ts +447 -0
  40. package/src/types/plugin.ts +363 -0
  41. package/src/types/statusLine.ts +15 -0
  42. package/src/types/textInputTypes.ts +387 -0
  43. package/src/types/tools.ts +149 -0
  44. package/src/types/utils.ts +20 -0
  45. package/src/utils/advisor.ts +12 -0
  46. package/src/utils/api.ts +29 -0
  47. package/src/utils/array.ts +7 -0
  48. package/src/utils/attachments.ts +60 -0
  49. package/src/utils/auth.ts +3 -0
  50. package/src/utils/claudeInChrome/chromeNativeHost.ts +15 -0
  51. package/src/utils/claudeInChrome/common.ts +12 -0
  52. package/src/utils/claudeInChrome/mcpServer.ts +15 -0
  53. package/src/utils/computerUse/common.ts +19 -0
  54. package/src/utils/computerUse/mcpServer.ts +15 -0
  55. package/src/utils/config.ts +35 -0
  56. package/src/utils/context.ts +19 -0
  57. package/src/utils/cwd.ts +3 -0
  58. package/src/utils/debug.ts +3 -0
  59. package/src/utils/earlyInput.ts +7 -0
  60. package/src/utils/effort.ts +13 -0
  61. package/src/utils/embeddedTools.ts +12 -0
  62. package/src/utils/envUtils.ts +3 -0
  63. package/src/utils/errors.ts +3 -0
  64. package/src/utils/execFileNoThrow.ts +24 -0
  65. package/src/utils/feature-flags.ts +112 -0
  66. package/src/utils/file.ts +3 -0
  67. package/src/utils/fileHistory.ts +17 -0
  68. package/src/utils/fingerprint.ts +7 -0
  69. package/src/utils/format.ts +75 -305
  70. package/src/utils/frontmatterParser.ts +33 -0
  71. package/src/utils/fsOperations.ts +31 -0
  72. package/src/utils/fullscreen.ts +40 -350
  73. package/src/utils/git.ts +15 -0
  74. package/src/utils/imageResizer.ts +30 -0
  75. package/src/utils/lazySchema.ts +9 -0
  76. package/src/utils/log.ts +3 -0
  77. package/src/utils/markdownConfigLoader.ts +12 -0
  78. package/src/utils/messages.ts +13 -0
  79. package/src/utils/migration.ts +137 -0
  80. package/src/utils/model/providers.ts +15 -0
  81. package/src/utils/path.ts +3 -0
  82. package/src/utils/permissions/PermissionResult.ts +14 -0
  83. package/src/utils/permissions/autoModeState.ts +12 -0
  84. package/src/utils/permissions/filesystem.ts +12 -0
  85. package/src/utils/plugins/loadPluginOutputStyles.ts +12 -0
  86. package/src/utils/plugins/schemas.ts +25 -0
  87. package/src/utils/process.ts +16 -0
  88. package/src/utils/sandbox/sandbox-adapter.ts +19 -0
  89. package/src/utils/sessionStorage.ts +238 -472
  90. package/src/utils/settings/constants.ts +10 -0
  91. package/src/utils/settings/settings.ts +19 -0
  92. package/src/utils/settings/types.ts +18 -0
  93. package/src/utils/shell/shellToolUtils.ts +9 -0
  94. package/src/utils/sinks.ts +11 -0
  95. package/src/utils/sleep.ts +7 -0
  96. package/src/utils/sliceAnsi.ts +7 -0
  97. package/src/utils/slowOperations.ts +3 -0
  98. package/src/utils/startupProfiler.ts +11 -0
  99. package/src/utils/stringUtils.ts +106 -0
  100. package/src/utils/systemPromptType.ts +9 -0
  101. package/src/utils/teleport/api.ts +15 -0
  102. package/src/utils/textHighlighting.ts +16 -0
  103. package/src/utils/theme.ts +17 -0
  104. package/src/utils/thinking.ts +58 -0
  105. package/src/utils/tokens.ts +11 -0
  106. package/src/utils/toolResultStorage.ts +17 -0
  107. package/src/utils/worktreeModeEnabled.ts +7 -0
  108. package/WORKSPACE_INTEGRATION.md +0 -290
  109. package/chat-sessions/sessions-index.json +0 -98
  110. package/package.json.original +0 -31
  111. package/package.json.publish +0 -47
  112. package/src/bootstrap/state.d.ts +0 -169
  113. package/src/bootstrap/state.js +0 -261
  114. package/src/context/pack-builder.d.ts +0 -24
  115. package/src/context/pack-builder.js +0 -281
  116. package/src/hooks/useExitOnCtrlCD.d.ts +0 -86
  117. package/src/hooks/useExitOnCtrlCD.js +0 -130
  118. package/src/hooks/useKeybinding.d.ts +0 -89
  119. package/src/hooks/useKeybinding.js +0 -163
  120. package/src/hooks/useTerminalSize.d.ts +0 -41
  121. package/src/hooks/useTerminalSize.js +0 -90
  122. package/src/index.d.ts +0 -23
  123. package/src/index.js +0 -24
  124. package/src/runtime/brand/brand.d.ts +0 -488
  125. package/src/runtime/brand/brand.js +0 -464
  126. package/src/runtime/brand/brand.ts +0 -667
  127. package/src/runtime/services/tokenEstimation.d.ts +0 -187
  128. package/src/runtime/services/tokenEstimation.js +0 -423
  129. package/src/runtime/services/tokenEstimation.ts +0 -547
  130. package/src/runtime/tools/Tool.d.ts +0 -239
  131. package/src/runtime/tools/Tool.js +0 -285
  132. package/src/runtime/tools/Tool.ts +0 -524
  133. package/src/scheduler/TaskScheduler.d.ts +0 -98
  134. package/src/scheduler/TaskScheduler.js +0 -201
  135. package/src/scheduler/TaskScheduler.ts +0 -259
  136. package/src/state/AppStateStore.d.ts +0 -347
  137. package/src/state/AppStateStore.js +0 -439
  138. package/src/state/AppStateStore.ts +0 -658
  139. package/src/state/WorkspaceStateStore.d.ts +0 -43
  140. package/src/state/WorkspaceStateStore.js +0 -224
  141. package/src/state/WorkspaceStateStore.ts +0 -297
  142. package/src/types/message.d.ts +0 -190
  143. package/src/types/message.js +0 -77
  144. package/src/utils/format.d.ts +0 -126
  145. package/src/utils/format.js +0 -230
  146. package/src/utils/fullscreen.d.ts +0 -161
  147. package/src/utils/fullscreen.js +0 -277
  148. package/src/utils/sessionStorage.d.ts +0 -210
  149. package/src/utils/sessionStorage.js +0 -435
  150. package/src/watcher/WorkspaceWatcher.d.ts +0 -70
  151. package/src/watcher/WorkspaceWatcher.js +0 -191
  152. package/src/watcher/WorkspaceWatcher.ts +0 -251
  153. package/src/workspace/loader.d.ts +0 -30
  154. package/src/workspace/loader.js +0 -117
  155. package/src/workspace/types.d.ts +0 -91
  156. package/src/workspace/types.js +0 -7
  157. package/threads/thread_1775361175022.json +0 -9
  158. package/tsconfig.json +0 -14
@@ -1,163 +0,0 @@
1
- /**
2
- * @fileoverview Keybinding hook for gizzi-code integration
3
- * @module hooks/useKeybinding
4
- *
5
- * Provides a React hook for registering keyboard shortcuts and key combinations.
6
- * Supports modifier keys (Ctrl, Alt, Shift, Meta) and automatic cleanup on unmount.
7
- */
8
- import { useEffect, useCallback, useRef } from 'react';
9
- /**
10
- * Normalized key combination string for comparison
11
- * @param {KeybindingConfig} config - Keybinding configuration
12
- * @returns {string} Normalized key combination string
13
- */
14
- function normalizeKeyCombo(config) {
15
- const parts = [];
16
- if (config.ctrl)
17
- parts.push('ctrl');
18
- if (config.alt)
19
- parts.push('alt');
20
- if (config.shift)
21
- parts.push('shift');
22
- if (config.meta)
23
- parts.push('meta');
24
- parts.push(config.key.toLowerCase());
25
- return parts.join('+');
26
- }
27
- /**
28
- * Parses a keybinding string into a config object
29
- *
30
- * @param {string} keybinding - Keybinding string (e.g., "Ctrl+C", "Escape", "Ctrl+Shift+A")
31
- * @returns {KeybindingConfig} Parsed keybinding configuration
32
- * @example
33
- * ```typescript
34
- * parseKeybinding("Ctrl+C"); // { key: 'c', ctrl: true }
35
- * parseKeybinding("Escape"); // { key: 'escape' }
36
- * parseKeybinding("Ctrl+Shift+A"); // { key: 'a', ctrl: true, shift: true }
37
- * ```
38
- */
39
- export function parseKeybinding(keybinding) {
40
- const parts = keybinding.split('+').map((p) => p.trim().toLowerCase());
41
- const config = {
42
- key: '',
43
- ctrl: false,
44
- alt: false,
45
- shift: false,
46
- meta: false,
47
- };
48
- for (const part of parts) {
49
- switch (part) {
50
- case 'ctrl':
51
- case 'control':
52
- config.ctrl = true;
53
- break;
54
- case 'alt':
55
- case 'option':
56
- config.alt = true;
57
- break;
58
- case 'shift':
59
- config.shift = true;
60
- break;
61
- case 'meta':
62
- case 'cmd':
63
- case 'command':
64
- case 'win':
65
- case 'windows':
66
- config.meta = true;
67
- break;
68
- default:
69
- config.key = part;
70
- break;
71
- }
72
- }
73
- return config;
74
- }
75
- /**
76
- * React hook for registering keyboard shortcuts
77
- *
78
- * Registers a keyboard shortcut that triggers the provided handler when pressed.
79
- * Automatically cleans up the event listener when the component unmounts or
80
- * when the keybinding changes.
81
- *
82
- * @param {string | KeybindingConfig} key - Key combination (e.g., "Ctrl+C") or config object
83
- * @param {KeyHandler} handler - Function to call when keybinding is triggered
84
- * @param {boolean} [enabled=true] - Whether the keybinding is active
85
- * @example
86
- * ```typescript
87
- * // Using string keybinding
88
- * useKeybinding('Ctrl+C', () => {
89
- * console.log('Copy!');
90
- * });
91
- *
92
- * // Using config object
93
- * useKeybinding({ key: 'k', ctrl: true }, (e) => {
94
- * e.preventDefault();
95
- * console.log('Ctrl+K pressed');
96
- * });
97
- *
98
- * // With conditional enabling
99
- * useKeybinding('Escape', handleClose, isModalOpen);
100
- * ```
101
- */
102
- export function useKeybinding(key, handler, enabled = true) {
103
- const config = typeof key === 'string' ? parseKeybinding(key) : key;
104
- const expectedCombo = normalizeKeyCombo(config);
105
- const handlerRef = useRef(handler);
106
- // Keep handler reference up to date without re-registering
107
- useEffect(() => {
108
- handlerRef.current = handler;
109
- }, [handler]);
110
- const handleKeyDown = useCallback((event) => {
111
- // Check if this key event matches our expected combination
112
- const actualCombo = normalizeKeyCombo({
113
- key: event.key,
114
- ctrl: event.ctrlKey,
115
- alt: event.altKey,
116
- shift: event.shiftKey,
117
- meta: event.metaKey,
118
- });
119
- if (actualCombo === expectedCombo) {
120
- if (config.preventDefault) {
121
- event.preventDefault();
122
- }
123
- if (config.stopPropagation) {
124
- event.stopPropagation();
125
- }
126
- const result = handlerRef.current(event);
127
- // Allow handler to prevent default by returning false
128
- if (result === false) {
129
- event.preventDefault();
130
- }
131
- }
132
- }, [config, expectedCombo]);
133
- useEffect(() => {
134
- if (!enabled || typeof window === 'undefined') {
135
- return;
136
- }
137
- window.addEventListener('keydown', handleKeyDown);
138
- return () => {
139
- window.removeEventListener('keydown', handleKeyDown);
140
- };
141
- }, [enabled, handleKeyDown]);
142
- }
143
- /**
144
- * Hook for registering multiple keybindings at once
145
- *
146
- * @param {Array<[string | KeybindingConfig, KeyHandler]>} bindings - Array of [keybinding, handler] tuples
147
- * @param {boolean} [enabled=true] - Whether all keybindings are active
148
- * @example
149
- * ```typescript
150
- * useKeybindings([
151
- * ['Ctrl+C', handleCopy],
152
- * ['Ctrl+V', handlePaste],
153
- * ['Escape', handleClose],
154
- * ]);
155
- * ```
156
- */
157
- export function useKeybindings(bindings, enabled = true) {
158
- bindings.forEach(([key, handler]) => {
159
- useKeybinding(key, handler, enabled);
160
- });
161
- }
162
- // Default export
163
- export default useKeybinding;
@@ -1,41 +0,0 @@
1
- /**
2
- * @fileoverview Terminal size hook for gizzi-code integration
3
- * @module hooks/useTerminalSize
4
- *
5
- * Provides a React hook to track terminal dimensions with resize event handling.
6
- * Returns the current terminal width and height, defaulting to standard terminal
7
- * dimensions when not in a browser environment.
8
- */
9
- /**
10
- * Terminal size state interface
11
- * @interface TerminalSize
12
- */
13
- export interface TerminalSize {
14
- /** Current terminal width in columns */
15
- readonly width: number;
16
- /** Current terminal height in rows */
17
- readonly height: number;
18
- }
19
- /**
20
- * React hook for tracking terminal size
21
- *
22
- * Returns the current terminal dimensions and automatically updates
23
- * when the window is resized. Uses debouncing to prevent excessive
24
- * re-renders during resize operations.
25
- *
26
- * @returns {TerminalSize} Current terminal width and height
27
- * @example
28
- * ```typescript
29
- * function MyComponent() {
30
- * const { width, height } = useTerminalSize();
31
- *
32
- * return (
33
- * <div>
34
- * Terminal: {width}×{height}
35
- * </div>
36
- * );
37
- * }
38
- * ```
39
- */
40
- export declare function useTerminalSize(): TerminalSize;
41
- export default useTerminalSize;
@@ -1,90 +0,0 @@
1
- /**
2
- * @fileoverview Terminal size hook for gizzi-code integration
3
- * @module hooks/useTerminalSize
4
- *
5
- * Provides a React hook to track terminal dimensions with resize event handling.
6
- * Returns the current terminal width and height, defaulting to standard terminal
7
- * dimensions when not in a browser environment.
8
- */
9
- import { useState, useEffect, useCallback } from 'react';
10
- /**
11
- * Default terminal dimensions (80x24 is standard terminal size)
12
- * @constant {TerminalSize}
13
- */
14
- const DEFAULT_TERMINAL_SIZE = {
15
- width: 80,
16
- height: 24,
17
- };
18
- /**
19
- * Gets the current terminal size from the window object
20
- * Falls back to default dimensions if window is not available
21
- *
22
- * @returns {TerminalSize} Current terminal dimensions
23
- */
24
- function getTerminalSize() {
25
- if (typeof window === 'undefined') {
26
- return DEFAULT_TERMINAL_SIZE;
27
- }
28
- // Estimate columns/rows based on window size and average character dimensions
29
- // This is an approximation - actual terminal emulators may vary
30
- const avgCharWidth = 8; // pixels per character (approximate)
31
- const avgLineHeight = 16; // pixels per line (approximate)
32
- const width = Math.max(20, Math.floor(window.innerWidth / avgCharWidth));
33
- const height = Math.max(5, Math.floor(window.innerHeight / avgLineHeight));
34
- return { width, height };
35
- }
36
- /**
37
- * React hook for tracking terminal size
38
- *
39
- * Returns the current terminal dimensions and automatically updates
40
- * when the window is resized. Uses debouncing to prevent excessive
41
- * re-renders during resize operations.
42
- *
43
- * @returns {TerminalSize} Current terminal width and height
44
- * @example
45
- * ```typescript
46
- * function MyComponent() {
47
- * const { width, height } = useTerminalSize();
48
- *
49
- * return (
50
- * <div>
51
- * Terminal: {width}×{height}
52
- * </div>
53
- * );
54
- * }
55
- * ```
56
- */
57
- export function useTerminalSize() {
58
- const [size, setSize] = useState(getTerminalSize);
59
- const handleResize = useCallback(() => {
60
- setSize(getTerminalSize());
61
- }, []);
62
- useEffect(() => {
63
- // Check if window is available (SSR safety)
64
- if (typeof window === 'undefined') {
65
- return;
66
- }
67
- // Debounced resize handler
68
- let resizeTimeout = null;
69
- const debouncedHandleResize = () => {
70
- if (resizeTimeout) {
71
- clearTimeout(resizeTimeout);
72
- }
73
- resizeTimeout = setTimeout(handleResize, 100);
74
- };
75
- // Set initial size
76
- handleResize();
77
- // Add resize listener
78
- window.addEventListener('resize', debouncedHandleResize);
79
- // Cleanup
80
- return () => {
81
- window.removeEventListener('resize', debouncedHandleResize);
82
- if (resizeTimeout) {
83
- clearTimeout(resizeTimeout);
84
- }
85
- };
86
- }, [handleResize]);
87
- return size;
88
- }
89
- // Default export for convenient importing
90
- export default useTerminalSize;
package/src/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * Gizzi Code - Main Entry Point
3
- *
4
- * Workspace-aware AI assistant framework
5
- */
6
- export { AppStateStore, getGlobalStore, setGlobalStore, useAppStateStore, useAppStateSelector, useAppStateActions, } from './state/AppStateStore';
7
- export type { UserPreferences, UserSession, ConnectionStatus, AppState, AppError, } from './state/AppStateStore';
8
- export { WorkspaceStateStore, getWorkspaceStore, setWorkspaceStore, } from './state/WorkspaceStateStore';
9
- export type { WorkspaceFile, TrustTier, ScheduledTask, ToolDefinition, ContextPack, WorkspaceSession, MessageRole, } from './workspace/types';
10
- export { loadWorkspace, executeStartupTasks, enhanceSessionWithWorkspace, } from './workspace/loader';
11
- export type { FileSystem, LoadWorkspaceOptions, LoadedWorkspace, } from './workspace/loader';
12
- export { buildContextPack, buildSystemPrompt, parseSoulMd, parseHeartbeatMd, classifyFile, getStartupTasks, requiresPermission, shouldRefreshContext, } from './context/pack-builder';
13
- export type { BuildContextPackOptions } from './context/pack-builder';
14
- export type { Message, MessageRole, UserMessage, AssistantMessage, SystemMessage, TypedMessage, MessageThread, Attachment, AttachmentMimeType, MessageStatus, } from './types/message';
15
- export { MESSAGE_ROLES, isUserMessage, isAssistantMessage, isSystemMessage, isMessageRole, createMessage, } from './types/message';
16
- export { useTerminalSize, } from './hooks/useTerminalSize';
17
- export { useExitOnCtrlCD, } from './hooks/useExitOnCtrlCD';
18
- export { useKeybinding, } from './hooks/useKeybinding';
19
- export { TaskScheduler, taskScheduler, } from './scheduler/TaskScheduler';
20
- export type { TaskFrequency, ScheduledTask, SchedulerJob, } from './scheduler/TaskScheduler';
21
- export { WorkspaceWatcher, getWorkspaceWatcher, stopAllWatchers, workspaceWatcher, } from './watcher/WorkspaceWatcher';
22
- export type { FileChange, WatcherOptions, } from './watcher/WorkspaceWatcher';
23
- export declare const VERSION = "1.0.1";
package/src/index.js DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * Gizzi Code - Main Entry Point
3
- *
4
- * Workspace-aware AI assistant framework
5
- */
6
- // Core State Management
7
- export { AppStateStore, getGlobalStore, setGlobalStore, useAppStateStore, useAppStateSelector, useAppStateActions, } from './state/AppStateStore';
8
- // Workspace State (NEW)
9
- export { WorkspaceStateStore, getWorkspaceStore, setWorkspaceStore, } from './state/WorkspaceStateStore';
10
- // Workspace Loader (NEW)
11
- export { loadWorkspace, executeStartupTasks, enhanceSessionWithWorkspace, } from './workspace/loader';
12
- // Context Pack Builder (NEW)
13
- export { buildContextPack, buildSystemPrompt, parseSoulMd, parseHeartbeatMd, classifyFile, getStartupTasks, requiresPermission, shouldRefreshContext, } from './context/pack-builder';
14
- export { MESSAGE_ROLES, isUserMessage, isAssistantMessage, isSystemMessage, isMessageRole, createMessage, } from './types/message';
15
- // React Hooks
16
- export { useTerminalSize, } from './hooks/useTerminalSize';
17
- export { useExitOnCtrlCD, } from './hooks/useExitOnCtrlCD';
18
- export { useKeybinding, } from './hooks/useKeybinding';
19
- // Task Scheduler (NEW)
20
- export { TaskScheduler, taskScheduler, } from './scheduler/TaskScheduler';
21
- // Workspace Watcher (NEW)
22
- export { WorkspaceWatcher, getWorkspaceWatcher, stopAllWatchers, workspaceWatcher, } from './watcher/WorkspaceWatcher';
23
- // Version
24
- export const VERSION = '1.0.1';