@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
package/src/main.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/index.mjs'
|
|
2
|
+
type UUID = string
|
|
3
|
+
import type { CanUseToolFn } from '@/hooks/useCanUseTool.js'
|
|
4
|
+
import type { CompactionResult } from '@/services/compact/compact.js'
|
|
5
|
+
import type { ScopedMcpServerConfig } from '@/services/mcp/types.js'
|
|
6
|
+
import type { ToolUseContext } from '@/Tool.js'
|
|
7
|
+
import type { EffortValue } from '../utils/effort.js'
|
|
8
|
+
import type { IDEExtensionInstallationStatus, IdeType } from '../utils/ide.js'
|
|
9
|
+
import type { SettingSource } from '../utils/settings/constants.js'
|
|
10
|
+
import type { HooksSettings } from '../utils/settings/types.js'
|
|
11
|
+
import type { ThemeName } from '../utils/theme.js'
|
|
12
|
+
import type { LogOption } from './logs.js'
|
|
13
|
+
import type { Message } from './message.js'
|
|
14
|
+
import type { PluginManifest } from './plugin.js'
|
|
15
|
+
|
|
16
|
+
export type LocalCommandResult =
|
|
17
|
+
| { type: 'text'; value: string }
|
|
18
|
+
| {
|
|
19
|
+
type: 'compact'
|
|
20
|
+
compactionResult: CompactionResult
|
|
21
|
+
displayText?: string
|
|
22
|
+
}
|
|
23
|
+
| { type: 'skip' } // Skip messages
|
|
24
|
+
|
|
25
|
+
export type PromptCommand = {
|
|
26
|
+
type: 'prompt'
|
|
27
|
+
progressMessage: string
|
|
28
|
+
contentLength: number // Length of command content in characters (used for token estimation)
|
|
29
|
+
argNames?: string[]
|
|
30
|
+
allowedTools?: string[]
|
|
31
|
+
model?: string
|
|
32
|
+
source: SettingSource | 'builtin' | 'mcp' | 'plugin' | 'bundled'
|
|
33
|
+
pluginInfo?: {
|
|
34
|
+
pluginManifest: PluginManifest
|
|
35
|
+
repository: string
|
|
36
|
+
}
|
|
37
|
+
disableNonInteractive?: boolean
|
|
38
|
+
// Hooks to register when this skill is invoked
|
|
39
|
+
hooks?: HooksSettings
|
|
40
|
+
// Base directory for skill resources (used to set CLAUDE_PLUGIN_ROOT environment variable for skill hooks)
|
|
41
|
+
skillRoot?: string
|
|
42
|
+
// Execution context: 'inline' (default) or 'fork' (run as sub-agent)
|
|
43
|
+
// 'inline' = skill content expands into the current conversation
|
|
44
|
+
// 'fork' = skill runs in a sub-agent with separate context and token budget
|
|
45
|
+
context?: 'inline' | 'fork'
|
|
46
|
+
// Agent type to use when forked (e.g., 'Bash', 'general-purpose')
|
|
47
|
+
// Only applicable when context is 'fork'
|
|
48
|
+
agent?: string
|
|
49
|
+
effort?: EffortValue
|
|
50
|
+
// Glob patterns for file paths this skill applies to
|
|
51
|
+
// When set, the skill is only visible after the model touches matching files
|
|
52
|
+
paths?: string[]
|
|
53
|
+
getPromptForCommand(
|
|
54
|
+
args: string,
|
|
55
|
+
context: ToolUseContext,
|
|
56
|
+
): Promise<ContentBlockParam[]>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The call signature for a local command implementation.
|
|
61
|
+
*/
|
|
62
|
+
export type LocalCommandCall = (
|
|
63
|
+
args: string,
|
|
64
|
+
context: LocalJSXCommandContext,
|
|
65
|
+
) => Promise<LocalCommandResult>
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Module shape returned by load() for lazy-loaded local commands.
|
|
69
|
+
*/
|
|
70
|
+
export type LocalCommandModule = {
|
|
71
|
+
call: LocalCommandCall
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type LocalCommand = {
|
|
75
|
+
type: 'local'
|
|
76
|
+
supportsNonInteractive: boolean
|
|
77
|
+
load: () => Promise<LocalCommandModule>
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type LocalJSXCommandContext = ToolUseContext & {
|
|
81
|
+
canUseTool?: CanUseToolFn
|
|
82
|
+
setMessages: (updater: (prev: Message[]) => Message[]) => void
|
|
83
|
+
options: {
|
|
84
|
+
dynamicMcpConfig?: Record<string, ScopedMcpServerConfig>
|
|
85
|
+
ideInstallationStatus: IDEExtensionInstallationStatus | null
|
|
86
|
+
theme: ThemeName
|
|
87
|
+
}
|
|
88
|
+
onChangeAPIKey: () => void
|
|
89
|
+
onChangeDynamicMcpConfig?: (
|
|
90
|
+
config: Record<string, ScopedMcpServerConfig>,
|
|
91
|
+
) => void
|
|
92
|
+
onInstallIDEExtension?: (ide: IdeType) => void
|
|
93
|
+
resume?: (
|
|
94
|
+
sessionId: UUID,
|
|
95
|
+
log: LogOption,
|
|
96
|
+
entrypoint: ResumeEntrypoint,
|
|
97
|
+
) => Promise<void>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ResumeEntrypoint =
|
|
101
|
+
| 'cli_flag'
|
|
102
|
+
| 'slash_command_picker'
|
|
103
|
+
| 'slash_command_session_id'
|
|
104
|
+
| 'slash_command_title'
|
|
105
|
+
| 'fork'
|
|
106
|
+
|
|
107
|
+
export type CommandResultDisplay = 'skip' | 'system' | 'user'
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Callback when a command completes.
|
|
111
|
+
* @param result - Optional user-visible message to display
|
|
112
|
+
* @param options - Optional configuration for command completion
|
|
113
|
+
* @param options.display - How to display the result: 'skip' | 'system' | 'user' (default)
|
|
114
|
+
* @param options.shouldQuery - If true, send messages to the model after command completes
|
|
115
|
+
* @param options.metaMessages - Additional messages to insert as isMeta (model-visible but hidden)
|
|
116
|
+
*/
|
|
117
|
+
export type LocalJSXCommandOnDone = (
|
|
118
|
+
result?: string,
|
|
119
|
+
options?: {
|
|
120
|
+
display?: CommandResultDisplay
|
|
121
|
+
shouldQuery?: boolean
|
|
122
|
+
metaMessages?: string[]
|
|
123
|
+
nextInput?: string
|
|
124
|
+
submitNextInput?: boolean
|
|
125
|
+
},
|
|
126
|
+
) => void
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The call signature for a local JSX command implementation.
|
|
130
|
+
*/
|
|
131
|
+
export type LocalJSXCommandCall = (
|
|
132
|
+
onDone: LocalJSXCommandOnDone,
|
|
133
|
+
context: ToolUseContext & LocalJSXCommandContext,
|
|
134
|
+
args: string,
|
|
135
|
+
) => Promise<React.ReactNode>
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Module shape returned by load() for lazy-loaded commands.
|
|
139
|
+
*/
|
|
140
|
+
export type LocalJSXCommandModule = {
|
|
141
|
+
call: LocalJSXCommandCall
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
type LocalJSXCommand = {
|
|
145
|
+
type: 'local-jsx'
|
|
146
|
+
/**
|
|
147
|
+
* Lazy-load the command implementation.
|
|
148
|
+
* Returns a module with a call() function.
|
|
149
|
+
* This defers loading heavy dependencies until the command is invoked.
|
|
150
|
+
*/
|
|
151
|
+
load: () => Promise<LocalJSXCommandModule>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Declares which auth/provider environments a command is available in.
|
|
156
|
+
*
|
|
157
|
+
* This is separate from `isEnabled()`:
|
|
158
|
+
* - `availability` = who can use this (auth/provider requirement, static)
|
|
159
|
+
* - `isEnabled()` = is this turned on right now (GrowthBook, platform, env vars)
|
|
160
|
+
*
|
|
161
|
+
* Commands without `availability` are available everywhere.
|
|
162
|
+
* Commands with `availability` are only shown if the user matches at least one
|
|
163
|
+
* of the listed auth types. See meetsAvailabilityRequirement() in commands.ts.
|
|
164
|
+
*
|
|
165
|
+
* Example: `availability: ['claude-ai', 'console']` shows the command to
|
|
166
|
+
* claude.ai subscribers and direct Console API key users (api.allternit.com),
|
|
167
|
+
* but hides it from Bedrock/Vertex/Foundry users and custom base URL users.
|
|
168
|
+
*/
|
|
169
|
+
export type CommandAvailability =
|
|
170
|
+
// claude.ai OAuth subscriber (Pro/Max/Team/Enterprise via claude.ai)
|
|
171
|
+
| 'claude-ai'
|
|
172
|
+
// Console API key user (direct api.allternit.com, not via claude.ai OAuth)
|
|
173
|
+
| 'console'
|
|
174
|
+
|
|
175
|
+
export type CommandBase = {
|
|
176
|
+
availability?: CommandAvailability[]
|
|
177
|
+
description: string
|
|
178
|
+
hasUserSpecifiedDescription?: boolean
|
|
179
|
+
/** Defaults to true. Only set when the command has conditional enablement (feature flags, env checks, etc). */
|
|
180
|
+
isEnabled?: () => boolean
|
|
181
|
+
/** Defaults to false. Only set when the command should be hidden from typeahead/help. */
|
|
182
|
+
isHidden?: boolean
|
|
183
|
+
name: string
|
|
184
|
+
aliases?: string[]
|
|
185
|
+
isMcp?: boolean
|
|
186
|
+
argumentHint?: string // Hint text for command arguments (displayed in gray after command)
|
|
187
|
+
whenToUse?: string // From the "Skill" spec. Detailed usage scenarios for when to use this command
|
|
188
|
+
version?: string // Version of the command/skill
|
|
189
|
+
disableModelInvocation?: boolean // Whether to disable this command from being invoked by models
|
|
190
|
+
userInvocable?: boolean // Whether users can invoke this skill by typing /skill-name
|
|
191
|
+
loadedFrom?:
|
|
192
|
+
| 'commands_DEPRECATED'
|
|
193
|
+
| 'skills'
|
|
194
|
+
| 'plugin'
|
|
195
|
+
| 'managed'
|
|
196
|
+
| 'bundled'
|
|
197
|
+
| 'mcp' // Where the command was loaded from
|
|
198
|
+
kind?: 'workflow' // Distinguishes workflow-backed commands (badged in autocomplete)
|
|
199
|
+
immediate?: boolean // If true, command executes immediately without waiting for a stop point (bypasses queue)
|
|
200
|
+
isSensitive?: boolean // If true, args are redacted from the conversation history
|
|
201
|
+
/** Defaults to `name`. Only override when the displayed name differs (e.g. plugin prefix stripping). */
|
|
202
|
+
userFacingName?: () => string
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type Command = CommandBase &
|
|
206
|
+
(PromptCommand | LocalCommand | LocalJSXCommand)
|
|
207
|
+
|
|
208
|
+
/** Resolves the user-visible name, falling back to `cmd.name` when not overridden. */
|
|
209
|
+
export function getCommandName(cmd: CommandBase): string {
|
|
210
|
+
return cmd.userFacingName?.() ?? cmd.name
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Resolves whether the command is enabled, defaulting to true. */
|
|
214
|
+
export function isCommandEnabled(cmd: CommandBase): boolean {
|
|
215
|
+
return cmd.isEnabled?.() ?? true
|
|
216
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connector text types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface ConnectorText {
|
|
6
|
+
id: string
|
|
7
|
+
content: string
|
|
8
|
+
connector: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ConnectorTextBlock {
|
|
12
|
+
type: 'connector_text'
|
|
13
|
+
id: string
|
|
14
|
+
content: string
|
|
15
|
+
connector: string
|
|
16
|
+
connector_text?: string
|
|
17
|
+
signature?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ConnectorTextDelta {
|
|
21
|
+
type: 'connector_text_delta' | 'text_delta' | 'thinking_delta' | 'signature_delta' | 'input_json_delta'
|
|
22
|
+
id?: string
|
|
23
|
+
content?: string
|
|
24
|
+
connector?: string
|
|
25
|
+
text?: string
|
|
26
|
+
thinking?: string
|
|
27
|
+
signature?: string
|
|
28
|
+
partial_json?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Type guard for connector text blocks
|
|
32
|
+
export function isConnectorTextBlock(content: unknown): content is ConnectorTextBlock {
|
|
33
|
+
return (
|
|
34
|
+
typeof content === 'object' &&
|
|
35
|
+
content !== null &&
|
|
36
|
+
'type' in content &&
|
|
37
|
+
(content as { type: string }).type === 'connector_text'
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File suggestion types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface FileSuggestion {
|
|
6
|
+
path: string
|
|
7
|
+
relevance: number
|
|
8
|
+
reason?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface FileSuggestionCommandInput {
|
|
12
|
+
query: string
|
|
13
|
+
context?: Record<string, unknown>
|
|
14
|
+
maxResults?: number
|
|
15
|
+
}
|