@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.
- package/bin/gizzi +4 -0
- package/bin/gizzi-ink +5 -0
- package/package.json +137 -31
- package/src/Tool.ts +26 -0
- package/src/bootstrap/state.ts +165 -322
- package/src/commands.ts +209 -0
- package/src/context/QueuedMessageContext.tsx +63 -0
- package/src/context/fpsMetrics.tsx +30 -0
- package/src/context/mailbox.tsx +38 -0
- package/src/context/modalContext.tsx +58 -0
- package/src/context/notifications.tsx +240 -0
- package/src/context/overlayContext.tsx +151 -0
- package/src/context/promptOverlayContext.tsx +125 -0
- package/src/context/stats.tsx +220 -0
- package/src/context/voice.tsx +88 -0
- package/src/hooks/useCanUseTool.ts +11 -0
- package/src/hooks/useExitOnCtrlCD.ts +40 -187
- package/src/hooks/useExitOnCtrlCDWithKeybindings.ts +68 -0
- package/src/hooks/useKeybinding.ts +68 -209
- package/src/hooks/useTerminalSize.ts +31 -99
- package/src/hooks.ts +37 -0
- package/src/ink.ts +204 -0
- package/src/main.ts +7 -0
- package/src/types/command.ts +216 -0
- package/src/types/connectorText.ts +39 -0
- package/src/types/fileSuggestion.ts +15 -0
- package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +865 -0
- package/src/types/generated/events_mono/common/v1/auth.ts +100 -0
- package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +223 -0
- package/src/types/generated/google/protobuf/timestamp.ts +187 -0
- package/src/types/hooks.ts +319 -0
- package/src/types/ids.ts +44 -0
- package/src/types/logs.ts +331 -0
- package/src/types/merged/index.ts +5 -0
- package/src/types/merged/message.ts +552 -0
- package/src/types/message.ts +927 -186
- package/src/types/messageQueueTypes.ts +21 -0
- package/src/types/notebook.ts +72 -0
- package/src/types/permissions.ts +447 -0
- package/src/types/plugin.ts +363 -0
- package/src/types/statusLine.ts +15 -0
- package/src/types/textInputTypes.ts +387 -0
- package/src/types/tools.ts +149 -0
- package/src/types/utils.ts +20 -0
- package/src/utils/advisor.ts +12 -0
- package/src/utils/api.ts +29 -0
- package/src/utils/array.ts +7 -0
- package/src/utils/attachments.ts +60 -0
- package/src/utils/auth.ts +3 -0
- package/src/utils/claudeInChrome/chromeNativeHost.ts +15 -0
- package/src/utils/claudeInChrome/common.ts +12 -0
- package/src/utils/claudeInChrome/mcpServer.ts +15 -0
- package/src/utils/computerUse/common.ts +19 -0
- package/src/utils/computerUse/mcpServer.ts +15 -0
- package/src/utils/config.ts +35 -0
- package/src/utils/context.ts +19 -0
- package/src/utils/cwd.ts +3 -0
- package/src/utils/debug.ts +3 -0
- package/src/utils/earlyInput.ts +7 -0
- package/src/utils/effort.ts +13 -0
- package/src/utils/embeddedTools.ts +12 -0
- package/src/utils/envUtils.ts +3 -0
- package/src/utils/errors.ts +3 -0
- package/src/utils/execFileNoThrow.ts +24 -0
- package/src/utils/feature-flags.ts +112 -0
- package/src/utils/file.ts +3 -0
- package/src/utils/fileHistory.ts +17 -0
- package/src/utils/fingerprint.ts +7 -0
- package/src/utils/format.ts +75 -305
- package/src/utils/frontmatterParser.ts +33 -0
- package/src/utils/fsOperations.ts +31 -0
- package/src/utils/fullscreen.ts +40 -350
- package/src/utils/git.ts +15 -0
- package/src/utils/imageResizer.ts +30 -0
- package/src/utils/lazySchema.ts +9 -0
- package/src/utils/log.ts +3 -0
- package/src/utils/markdownConfigLoader.ts +12 -0
- package/src/utils/messages.ts +13 -0
- package/src/utils/migration.ts +137 -0
- package/src/utils/model/providers.ts +15 -0
- package/src/utils/path.ts +3 -0
- package/src/utils/permissions/PermissionResult.ts +14 -0
- package/src/utils/permissions/autoModeState.ts +12 -0
- package/src/utils/permissions/filesystem.ts +12 -0
- package/src/utils/plugins/loadPluginOutputStyles.ts +12 -0
- package/src/utils/plugins/schemas.ts +25 -0
- package/src/utils/process.ts +16 -0
- package/src/utils/sandbox/sandbox-adapter.ts +19 -0
- package/src/utils/sessionStorage.ts +238 -472
- package/src/utils/settings/constants.ts +10 -0
- package/src/utils/settings/settings.ts +19 -0
- package/src/utils/settings/types.ts +18 -0
- package/src/utils/shell/shellToolUtils.ts +9 -0
- package/src/utils/sinks.ts +11 -0
- package/src/utils/sleep.ts +7 -0
- package/src/utils/sliceAnsi.ts +7 -0
- package/src/utils/slowOperations.ts +3 -0
- package/src/utils/startupProfiler.ts +11 -0
- package/src/utils/stringUtils.ts +106 -0
- package/src/utils/systemPromptType.ts +9 -0
- package/src/utils/teleport/api.ts +15 -0
- package/src/utils/textHighlighting.ts +16 -0
- package/src/utils/theme.ts +17 -0
- package/src/utils/thinking.ts +58 -0
- package/src/utils/tokens.ts +11 -0
- package/src/utils/toolResultStorage.ts +17 -0
- package/src/utils/worktreeModeEnabled.ts +7 -0
- package/WORKSPACE_INTEGRATION.md +0 -290
- package/chat-sessions/sessions-index.json +0 -98
- package/package.json.original +0 -31
- package/package.json.publish +0 -47
- package/src/bootstrap/state.d.ts +0 -169
- package/src/bootstrap/state.js +0 -261
- package/src/context/pack-builder.d.ts +0 -24
- package/src/context/pack-builder.js +0 -281
- package/src/hooks/useExitOnCtrlCD.d.ts +0 -86
- package/src/hooks/useExitOnCtrlCD.js +0 -130
- package/src/hooks/useKeybinding.d.ts +0 -89
- package/src/hooks/useKeybinding.js +0 -163
- package/src/hooks/useTerminalSize.d.ts +0 -41
- package/src/hooks/useTerminalSize.js +0 -90
- package/src/index.d.ts +0 -23
- package/src/index.js +0 -24
- package/src/runtime/brand/brand.d.ts +0 -488
- package/src/runtime/brand/brand.js +0 -464
- package/src/runtime/brand/brand.ts +0 -667
- package/src/runtime/services/tokenEstimation.d.ts +0 -187
- package/src/runtime/services/tokenEstimation.js +0 -423
- package/src/runtime/services/tokenEstimation.ts +0 -547
- package/src/runtime/tools/Tool.d.ts +0 -239
- package/src/runtime/tools/Tool.js +0 -285
- package/src/runtime/tools/Tool.ts +0 -524
- package/src/scheduler/TaskScheduler.d.ts +0 -98
- package/src/scheduler/TaskScheduler.js +0 -201
- package/src/scheduler/TaskScheduler.ts +0 -259
- package/src/state/AppStateStore.d.ts +0 -347
- package/src/state/AppStateStore.js +0 -439
- package/src/state/AppStateStore.ts +0 -658
- package/src/state/WorkspaceStateStore.d.ts +0 -43
- package/src/state/WorkspaceStateStore.js +0 -224
- package/src/state/WorkspaceStateStore.ts +0 -297
- package/src/types/message.d.ts +0 -190
- package/src/types/message.js +0 -77
- package/src/utils/format.d.ts +0 -126
- package/src/utils/format.js +0 -230
- package/src/utils/fullscreen.d.ts +0 -161
- package/src/utils/fullscreen.js +0 -277
- package/src/utils/sessionStorage.d.ts +0 -210
- package/src/utils/sessionStorage.js +0 -435
- package/src/watcher/WorkspaceWatcher.d.ts +0 -70
- package/src/watcher/WorkspaceWatcher.js +0 -191
- package/src/watcher/WorkspaceWatcher.ts +0 -251
- package/src/workspace/loader.d.ts +0 -30
- package/src/workspace/loader.js +0 -117
- package/src/workspace/types.d.ts +0 -91
- package/src/workspace/types.js +0 -7
- package/threads/thread_1775361175022.json +0 -9
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude in Chrome MCP Server
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ChromeMcpServer {
|
|
6
|
+
start(): Promise<void>
|
|
7
|
+
stop(): Promise<void>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createChromeMcpServer(): ChromeMcpServer {
|
|
11
|
+
return {
|
|
12
|
+
start: async () => {},
|
|
13
|
+
stop: async () => {},
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computer Use Common Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ComputerUseConfig {
|
|
6
|
+
enabled: boolean
|
|
7
|
+
timeout?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getComputerUseConfig(): ComputerUseConfig {
|
|
11
|
+
return { enabled: false }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function executeComputerAction(
|
|
15
|
+
action: string,
|
|
16
|
+
config?: ComputerUseConfig
|
|
17
|
+
): Promise<string> {
|
|
18
|
+
return ''
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computer Use MCP Server
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ComputerUseMcpServer {
|
|
6
|
+
start(): Promise<void>
|
|
7
|
+
stop(): Promise<void>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createComputerUseMcpServer(): ComputerUseMcpServer {
|
|
11
|
+
return {
|
|
12
|
+
start: async () => {},
|
|
13
|
+
stop: async () => {},
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface Config {
|
|
6
|
+
[key: string]: unknown
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getConfig(): Config {
|
|
10
|
+
return {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function setConfig(key: string, value: unknown): void {
|
|
14
|
+
// Implementation
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Global config for buddy/companion
|
|
18
|
+
export interface GlobalConfig {
|
|
19
|
+
theme?: string
|
|
20
|
+
notifications?: boolean
|
|
21
|
+
autoUpdate?: boolean
|
|
22
|
+
telemetry?: boolean
|
|
23
|
+
debug?: boolean
|
|
24
|
+
[key: string]: unknown
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let globalConfig: GlobalConfig = {}
|
|
28
|
+
|
|
29
|
+
export function getGlobalConfig(): GlobalConfig {
|
|
30
|
+
return globalConfig
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function setGlobalConfig(config: GlobalConfig): void {
|
|
34
|
+
globalConfig = { ...globalConfig, ...config }
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface Context {
|
|
6
|
+
sessionId?: string
|
|
7
|
+
projectId?: string
|
|
8
|
+
cwd: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let currentContext: Context = { cwd: process.cwd() }
|
|
12
|
+
|
|
13
|
+
export function getContext(): Context {
|
|
14
|
+
return currentContext
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function setContext(ctx: Partial<Context>): void {
|
|
18
|
+
currentContext = { ...currentContext, ...ctx }
|
|
19
|
+
}
|
package/src/utils/cwd.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effort Level Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type EffortLevel = 'low' | 'medium' | 'high' | 'max'
|
|
6
|
+
|
|
7
|
+
export function getEffortLevel(): EffortLevel {
|
|
8
|
+
return 'medium'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function setEffortLevel(level: EffortLevel): void {
|
|
12
|
+
// Implementation
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exec File without throwing
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { execFile } from 'child_process'
|
|
6
|
+
import { promisify } from 'util'
|
|
7
|
+
|
|
8
|
+
const execFileAsync = promisify(execFile)
|
|
9
|
+
|
|
10
|
+
export async function execFileNoThrow(
|
|
11
|
+
command: string,
|
|
12
|
+
args?: string[]
|
|
13
|
+
): Promise<{ stdout: string; stderr: string; exitCode: number }> {
|
|
14
|
+
try {
|
|
15
|
+
const { stdout, stderr } = await execFileAsync(command, args)
|
|
16
|
+
return { stdout, stderr, exitCode: 0 }
|
|
17
|
+
} catch (error: any) {
|
|
18
|
+
return {
|
|
19
|
+
stdout: error.stdout || '',
|
|
20
|
+
stderr: error.stderr || '',
|
|
21
|
+
exitCode: error.code || 1,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature Flags
|
|
3
|
+
*
|
|
4
|
+
* Centralized feature flag management for Gizzi Code.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const FEATURE_FLAGS = {
|
|
8
|
+
/**
|
|
9
|
+
* Enable the Allternit Harness for AI interactions.
|
|
10
|
+
* When enabled, uses @allternit/sdk with system prompt injection.
|
|
11
|
+
* When disabled, uses legacy direct SDK calls.
|
|
12
|
+
*/
|
|
13
|
+
USE_HARNESS: process.env.GIZZI_USE_HARNESS === '1' || process.env.GIZZI_USE_HARNESS === 'true',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Harness operating mode.
|
|
17
|
+
* - 'byok': Bring Your Own Key (direct to providers)
|
|
18
|
+
* - 'cloud': Use Allternit cloud gateway
|
|
19
|
+
* - 'local': Local Ollama server
|
|
20
|
+
* - 'subprocess': CLI subprocess (e.g., kimi -p)
|
|
21
|
+
*/
|
|
22
|
+
HARNESS_MODE: (process.env.GIZZI_HARNESS_MODE || 'byok') as 'byok' | 'cloud' | 'local' | 'subprocess',
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Subprocess command for subprocess mode.
|
|
26
|
+
* Example: "kimi -p", "claude -p", "llm -m gpt-4"
|
|
27
|
+
*/
|
|
28
|
+
SUBPROCESS_CMD: process.env.GIZZI_SUBPROCESS_CMD || '',
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Base URL for local mode.
|
|
32
|
+
* Default: http://localhost:11434 (Ollama)
|
|
33
|
+
*/
|
|
34
|
+
LOCAL_BASE_URL: process.env.GIZZI_LOCAL_BASE_URL || 'http://localhost:11434',
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Cloud gateway URL.
|
|
38
|
+
* Default: https://api.allternit.com
|
|
39
|
+
*/
|
|
40
|
+
CLOUD_BASE_URL: process.env.GIZZI_CLOUD_BASE_URL || 'https://api.allternit.com',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if harness mode is enabled.
|
|
45
|
+
*/
|
|
46
|
+
export function shouldUseHarness(): boolean {
|
|
47
|
+
return FEATURE_FLAGS.USE_HARNESS;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get the configured harness mode.
|
|
52
|
+
*/
|
|
53
|
+
export function getHarnessMode(): 'byok' | 'cloud' | 'local' | 'subprocess' {
|
|
54
|
+
return FEATURE_FLAGS.HARNESS_MODE;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if a specific feature is enabled.
|
|
59
|
+
*/
|
|
60
|
+
export function isFeatureEnabled(feature: keyof typeof FEATURE_FLAGS): boolean {
|
|
61
|
+
const value = FEATURE_FLAGS[feature];
|
|
62
|
+
return typeof value === 'boolean' ? value : Boolean(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the harness configuration based on environment.
|
|
67
|
+
*/
|
|
68
|
+
export async function getHarnessConfig() {
|
|
69
|
+
const mode = FEATURE_FLAGS.HARNESS_MODE;
|
|
70
|
+
|
|
71
|
+
switch (mode) {
|
|
72
|
+
case 'byok':
|
|
73
|
+
return {
|
|
74
|
+
mode: 'byok' as const,
|
|
75
|
+
byok: {
|
|
76
|
+
keys: {
|
|
77
|
+
anthropic: process.env.ANTHROPIC_API_KEY || '',
|
|
78
|
+
openai: process.env.OPENAI_API_KEY || '',
|
|
79
|
+
google: process.env.GOOGLE_API_KEY || '',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
case 'cloud':
|
|
85
|
+
return {
|
|
86
|
+
mode: 'cloud' as const,
|
|
87
|
+
cloud: {
|
|
88
|
+
baseURL: FEATURE_FLAGS.CLOUD_BASE_URL,
|
|
89
|
+
accessToken: process.env.ALLTERNIT_ACCESS_TOKEN || '',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
case 'local':
|
|
94
|
+
return {
|
|
95
|
+
mode: 'local' as const,
|
|
96
|
+
local: {
|
|
97
|
+
baseURL: FEATURE_FLAGS.LOCAL_BASE_URL,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
case 'subprocess':
|
|
102
|
+
return {
|
|
103
|
+
mode: 'subprocess' as const,
|
|
104
|
+
subprocess: {
|
|
105
|
+
command: FEATURE_FLAGS.SUBPROCESS_CMD || 'kimi -p',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
default:
|
|
110
|
+
throw new Error(`Unknown harness mode: ${mode}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File History Tracking
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface FileHistoryEntry {
|
|
6
|
+
path: string
|
|
7
|
+
timestamp: number
|
|
8
|
+
content?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function getFileHistory(path: string): Promise<FileHistoryEntry[]> {
|
|
12
|
+
return []
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function addFileHistoryEntry(entry: FileHistoryEntry): Promise<void> {
|
|
16
|
+
// Implementation
|
|
17
|
+
}
|