@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
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gizzi Workspace File Watcher
|
|
3
|
-
*
|
|
4
|
-
* Monitors agent workspace files for changes and triggers context refresh.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { FileSystem } from '../workspace/loader';
|
|
8
|
-
|
|
9
|
-
export interface FileChange {
|
|
10
|
-
path: string;
|
|
11
|
-
type: 'created' | 'modified' | 'deleted';
|
|
12
|
-
previousModTime?: Date;
|
|
13
|
-
currentModTime?: Date;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface WatchedFile {
|
|
17
|
-
path: string;
|
|
18
|
-
lastModified: Date;
|
|
19
|
-
size: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface WatcherOptions {
|
|
23
|
-
pollIntervalMs: number;
|
|
24
|
-
onChange: (changes: FileChange[]) => void;
|
|
25
|
-
onError?: (error: Error) => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Workspace File Watcher for Gizzi
|
|
30
|
-
*/
|
|
31
|
-
export class WorkspaceWatcher {
|
|
32
|
-
private agentId: string;
|
|
33
|
-
private basePath: string;
|
|
34
|
-
private fs: FileSystem;
|
|
35
|
-
private options: WatcherOptions;
|
|
36
|
-
private intervalId: NodeJS.Timeout | null = null;
|
|
37
|
-
private watchedFiles = new Map<string, WatchedFile>();
|
|
38
|
-
private isWatching = false;
|
|
39
|
-
|
|
40
|
-
constructor(
|
|
41
|
-
agentId: string,
|
|
42
|
-
basePath: string,
|
|
43
|
-
fs: FileSystem,
|
|
44
|
-
options: Partial<WatcherOptions> = {}
|
|
45
|
-
) {
|
|
46
|
-
this.agentId = agentId;
|
|
47
|
-
this.basePath = basePath;
|
|
48
|
-
this.fs = fs;
|
|
49
|
-
this.options = {
|
|
50
|
-
pollIntervalMs: 5000,
|
|
51
|
-
onChange: () => {},
|
|
52
|
-
...options,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Start watching for changes
|
|
58
|
-
*/
|
|
59
|
-
async start(): Promise<void> {
|
|
60
|
-
if (this.isWatching) {
|
|
61
|
-
console.log(`[WorkspaceWatcher] Already watching ${this.agentId}`);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Initial scan
|
|
66
|
-
try {
|
|
67
|
-
await this.scanWorkspace();
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error(`[WorkspaceWatcher] Initial scan failed:`, error);
|
|
70
|
-
this.options.onError?.(error as Error);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Start polling
|
|
75
|
-
this.isWatching = true;
|
|
76
|
-
this.intervalId = setInterval(() => {
|
|
77
|
-
this.checkForChanges().catch((error) => {
|
|
78
|
-
console.error(`[WorkspaceWatcher] Check failed:`, error);
|
|
79
|
-
this.options.onError?.(error);
|
|
80
|
-
});
|
|
81
|
-
}, this.options.pollIntervalMs);
|
|
82
|
-
|
|
83
|
-
console.log(`[WorkspaceWatcher] Started watching ${this.agentId} (${this.options.pollIntervalMs}ms interval)`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Stop watching
|
|
88
|
-
*/
|
|
89
|
-
stop(): void {
|
|
90
|
-
if (this.intervalId) {
|
|
91
|
-
clearInterval(this.intervalId);
|
|
92
|
-
this.intervalId = null;
|
|
93
|
-
}
|
|
94
|
-
this.isWatching = false;
|
|
95
|
-
console.log(`[WorkspaceWatcher] Stopped watching ${this.agentId}`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Get current watch status
|
|
100
|
-
*/
|
|
101
|
-
getStatus(): {
|
|
102
|
-
isWatching: boolean;
|
|
103
|
-
filesWatched: number;
|
|
104
|
-
} {
|
|
105
|
-
return {
|
|
106
|
-
isWatching: this.isWatching,
|
|
107
|
-
filesWatched: this.watchedFiles.size,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Force a manual refresh
|
|
113
|
-
*/
|
|
114
|
-
async refresh(): Promise<FileChange[]> {
|
|
115
|
-
return this.checkForChanges();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Scan workspace for files
|
|
120
|
-
*/
|
|
121
|
-
private async scanWorkspace(): Promise<void> {
|
|
122
|
-
this.watchedFiles.clear();
|
|
123
|
-
|
|
124
|
-
const entries = await this.fs.listDirectory(this.basePath);
|
|
125
|
-
|
|
126
|
-
for (const entry of entries) {
|
|
127
|
-
if (entry.type === 'file') {
|
|
128
|
-
const filePath = `${this.basePath}/${entry.name}`;
|
|
129
|
-
try {
|
|
130
|
-
const content = await this.fs.readFile(filePath);
|
|
131
|
-
this.watchedFiles.set(entry.name, {
|
|
132
|
-
path: entry.name,
|
|
133
|
-
lastModified: new Date(), // We don't have actual mtime from FileSystem interface
|
|
134
|
-
size: content.length,
|
|
135
|
-
});
|
|
136
|
-
} catch {
|
|
137
|
-
// Skip files we can't read
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Check for changes
|
|
145
|
-
*/
|
|
146
|
-
private async checkForChanges(): Promise<FileChange[]> {
|
|
147
|
-
const changes: FileChange[] = [];
|
|
148
|
-
const currentFiles = new Map<string, WatchedFile>();
|
|
149
|
-
|
|
150
|
-
try {
|
|
151
|
-
const entries = await this.fs.listDirectory(this.basePath);
|
|
152
|
-
|
|
153
|
-
for (const entry of entries) {
|
|
154
|
-
if (entry.type !== 'file') continue;
|
|
155
|
-
|
|
156
|
-
const filePath = `${this.basePath}/${entry.name}`;
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
const content = await this.fs.readFile(filePath);
|
|
160
|
-
const previousFile = this.watchedFiles.get(entry.name);
|
|
161
|
-
|
|
162
|
-
currentFiles.set(entry.name, {
|
|
163
|
-
path: entry.name,
|
|
164
|
-
lastModified: new Date(),
|
|
165
|
-
size: content.length,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
if (!previousFile) {
|
|
169
|
-
// New file
|
|
170
|
-
changes.push({
|
|
171
|
-
path: entry.name,
|
|
172
|
-
type: 'created',
|
|
173
|
-
currentModTime: new Date(),
|
|
174
|
-
});
|
|
175
|
-
} else if (content.length !== previousFile.size) {
|
|
176
|
-
// Modified file (using size as proxy for modification)
|
|
177
|
-
changes.push({
|
|
178
|
-
path: entry.name,
|
|
179
|
-
type: 'modified',
|
|
180
|
-
previousModTime: previousFile.lastModified,
|
|
181
|
-
currentModTime: new Date(),
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
} catch {
|
|
185
|
-
// Skip files we can't read
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Check for deleted files
|
|
190
|
-
for (const [name, file] of this.watchedFiles) {
|
|
191
|
-
if (!currentFiles.has(name)) {
|
|
192
|
-
changes.push({
|
|
193
|
-
path: name,
|
|
194
|
-
type: 'deleted',
|
|
195
|
-
previousModTime: file.lastModified,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Update state
|
|
201
|
-
this.watchedFiles = currentFiles;
|
|
202
|
-
|
|
203
|
-
// Notify if changes detected
|
|
204
|
-
if (changes.length > 0) {
|
|
205
|
-
console.log(`[WorkspaceWatcher] Detected ${changes.length} changes in ${this.agentId}:`,
|
|
206
|
-
changes.map(c => `${c.type}:${c.path}`).join(', '));
|
|
207
|
-
this.options.onChange(changes);
|
|
208
|
-
}
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.error(`[WorkspaceWatcher] Failed to check for changes:`, error);
|
|
211
|
-
this.options.onError?.(error as Error);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return changes;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Global watcher registry
|
|
219
|
-
const watchers = new Map<string, WorkspaceWatcher>();
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Get or create a watcher for an agent
|
|
223
|
-
*/
|
|
224
|
-
export function getWorkspaceWatcher(
|
|
225
|
-
agentId: string,
|
|
226
|
-
basePath: string,
|
|
227
|
-
fs: FileSystem,
|
|
228
|
-
options?: Partial<WatcherOptions>
|
|
229
|
-
): WorkspaceWatcher {
|
|
230
|
-
if (!watchers.has(agentId)) {
|
|
231
|
-
watchers.set(agentId, new WorkspaceWatcher(agentId, basePath, fs, options));
|
|
232
|
-
}
|
|
233
|
-
return watchers.get(agentId)!;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Stop all watchers
|
|
238
|
-
*/
|
|
239
|
-
export function stopAllWatchers(): void {
|
|
240
|
-
for (const [agentId, watcher] of watchers) {
|
|
241
|
-
watcher.stop();
|
|
242
|
-
}
|
|
243
|
-
watchers.clear();
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Export singleton for global access
|
|
247
|
-
export const workspaceWatcher = {
|
|
248
|
-
watchers,
|
|
249
|
-
getWatcher: getWorkspaceWatcher,
|
|
250
|
-
stopAll: stopAllWatchers,
|
|
251
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gizzi Workspace Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads agent workspace files and integrates with Gizzi state
|
|
5
|
-
*/
|
|
6
|
-
import type { WorkspaceSession, ContextPack } from './types';
|
|
7
|
-
import { getStartupTasks } from '../context/pack-builder';
|
|
8
|
-
export interface FileSystem {
|
|
9
|
-
readFile(path: string): Promise<string>;
|
|
10
|
-
listDirectory(path: string): Promise<{
|
|
11
|
-
name: string;
|
|
12
|
-
type: 'file' | 'directory';
|
|
13
|
-
}[]>;
|
|
14
|
-
exists(path: string): Promise<boolean>;
|
|
15
|
-
}
|
|
16
|
-
export interface LoadWorkspaceOptions {
|
|
17
|
-
agentId: string;
|
|
18
|
-
agentName: string;
|
|
19
|
-
sessionId: string;
|
|
20
|
-
fs: FileSystem;
|
|
21
|
-
basePath: string;
|
|
22
|
-
}
|
|
23
|
-
export interface LoadedWorkspace {
|
|
24
|
-
files: Map<string, string>;
|
|
25
|
-
contextPack: ContextPack;
|
|
26
|
-
startupTasks: ReturnType<typeof getStartupTasks>;
|
|
27
|
-
}
|
|
28
|
-
export declare function loadWorkspace(options: LoadWorkspaceOptions): Promise<LoadedWorkspace | null>;
|
|
29
|
-
export declare function executeStartupTasks(tasks: LoadedWorkspace['startupTasks'], sendMessage: (content: string) => void): Promise<void>;
|
|
30
|
-
export declare function enhanceSessionWithWorkspace(session: WorkspaceSession, workspace: LoadedWorkspace): WorkspaceSession;
|
package/src/workspace/loader.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gizzi Workspace Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads agent workspace files and integrates with Gizzi state
|
|
5
|
-
*/
|
|
6
|
-
import { buildContextPack, getStartupTasks } from '../context/pack-builder';
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Workspace File Patterns
|
|
9
|
-
// ============================================================================
|
|
10
|
-
const WORKSPACE_FILE_PATTERNS = [
|
|
11
|
-
'.allternit/manifest.json',
|
|
12
|
-
'.allternit/brain/BRAIN.md',
|
|
13
|
-
'.allternit/memory/MEMORY.md',
|
|
14
|
-
'.allternit/memory/active-tasks.md',
|
|
15
|
-
'.allternit/memory/daily.md',
|
|
16
|
-
'.allternit/memory/lessons.md',
|
|
17
|
-
'.allternit/memory/self-review.md',
|
|
18
|
-
'.allternit/identity/IDENTITY.md',
|
|
19
|
-
'.allternit/identity/SOUL.md',
|
|
20
|
-
'.allternit/identity/USER.md',
|
|
21
|
-
'.allternit/identity/VOICE.md',
|
|
22
|
-
'.allternit/identity/POLICY.md',
|
|
23
|
-
'.allternit/governance/PLAYBOOK.md',
|
|
24
|
-
'.allternit/governance/TOOLS.md',
|
|
25
|
-
'.allternit/governance/HEARTBEAT.md',
|
|
26
|
-
'.allternit/governance/SYSTEM.md',
|
|
27
|
-
'.allternit/governance/CHANNELS.md',
|
|
28
|
-
'.allternit/skills/**',
|
|
29
|
-
'.allternit/business/CLIENTS.md',
|
|
30
|
-
];
|
|
31
|
-
export async function loadWorkspace(options) {
|
|
32
|
-
const { agentId, agentName, sessionId, fs, basePath } = options;
|
|
33
|
-
console.log('[Gizzi Workspace] Loading workspace for agent:', agentId);
|
|
34
|
-
const files = new Map();
|
|
35
|
-
// Load core files
|
|
36
|
-
for (const pattern of WORKSPACE_FILE_PATTERNS) {
|
|
37
|
-
if (pattern.includes('**'))
|
|
38
|
-
continue;
|
|
39
|
-
const fullPath = `${basePath}/${pattern}`;
|
|
40
|
-
try {
|
|
41
|
-
if (await fs.exists(fullPath)) {
|
|
42
|
-
const content = await fs.readFile(fullPath);
|
|
43
|
-
files.set(pattern, content);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// File doesn't exist, skip
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Load skill files
|
|
51
|
-
try {
|
|
52
|
-
const skillsPath = `${basePath}/.allternit/skills`;
|
|
53
|
-
if (await fs.exists(skillsPath)) {
|
|
54
|
-
const entries = await fs.listDirectory(skillsPath);
|
|
55
|
-
for (const entry of entries) {
|
|
56
|
-
if (entry.type === 'file' && (entry.name.endsWith('.md') || entry.name.endsWith('.json'))) {
|
|
57
|
-
const content = await fs.readFile(`${skillsPath}/${entry.name}`);
|
|
58
|
-
files.set(`.allternit/skills/${entry.name}`, content);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
// Skills directory doesn't exist
|
|
65
|
-
}
|
|
66
|
-
if (files.size === 0) {
|
|
67
|
-
console.log('[Gizzi Workspace] No workspace files found');
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
console.log(`[Gizzi Workspace] Loaded ${files.size} files`);
|
|
71
|
-
// Build context pack
|
|
72
|
-
const contextPack = buildContextPack({
|
|
73
|
-
sessionId,
|
|
74
|
-
agentId,
|
|
75
|
-
agentName,
|
|
76
|
-
files,
|
|
77
|
-
});
|
|
78
|
-
// Get startup tasks
|
|
79
|
-
const startupTasks = getStartupTasks(contextPack);
|
|
80
|
-
console.log(`[Gizzi Workspace] ${startupTasks.length} startup tasks to execute`);
|
|
81
|
-
return { files, contextPack, startupTasks };
|
|
82
|
-
}
|
|
83
|
-
// ============================================================================
|
|
84
|
-
// Execute Startup Tasks
|
|
85
|
-
// ============================================================================
|
|
86
|
-
export async function executeStartupTasks(tasks, sendMessage) {
|
|
87
|
-
for (const task of tasks) {
|
|
88
|
-
console.log(`[Gizzi Workspace] Executing startup task: ${task.action}`);
|
|
89
|
-
// Execute the task
|
|
90
|
-
// For now, just log it - in production this would perform actual actions
|
|
91
|
-
try {
|
|
92
|
-
// Simulate task execution
|
|
93
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
94
|
-
// Optionally send a message about the task
|
|
95
|
-
if (task.action.toLowerCase().includes('greet') || task.action.toLowerCase().includes('introduce')) {
|
|
96
|
-
// Don't auto-send, let the agent handle it naturally
|
|
97
|
-
}
|
|
98
|
-
task.lastExecuted = new Date().toISOString();
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
console.error(`[Gizzi Workspace] Task failed:`, error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// ============================================================================
|
|
106
|
-
// Session Enhancement
|
|
107
|
-
// ============================================================================
|
|
108
|
-
export function enhanceSessionWithWorkspace(session, workspace) {
|
|
109
|
-
return {
|
|
110
|
-
...session,
|
|
111
|
-
mode: 'agent',
|
|
112
|
-
contextPack: workspace.contextPack,
|
|
113
|
-
contextHash: workspace.contextPack.hash,
|
|
114
|
-
contextRefreshedAt: new Date().toISOString(),
|
|
115
|
-
workspaceFiles: Array.from(workspace.files.keys()),
|
|
116
|
-
};
|
|
117
|
-
}
|
package/src/workspace/types.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gizzi Workspace Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for agent workspace system
|
|
5
|
-
* mirrors the Allternit platform implementation
|
|
6
|
-
*/
|
|
7
|
-
export type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
8
|
-
export interface WorkspaceFile {
|
|
9
|
-
path: string;
|
|
10
|
-
name: string;
|
|
11
|
-
content: string;
|
|
12
|
-
type: 'manifest' | 'brain' | 'memory' | 'identity' | 'soul' | 'user' | 'voice' | 'policy' | 'playbook' | 'tools' | 'heartbeat' | 'system' | 'channels' | 'skill' | 'business' | 'knowledge' | 'config';
|
|
13
|
-
size: number;
|
|
14
|
-
}
|
|
15
|
-
export interface TrustTier {
|
|
16
|
-
level: 1 | 2 | 3;
|
|
17
|
-
name: string;
|
|
18
|
-
rules: string[];
|
|
19
|
-
enforce: 'always' | 'contextual' | 'permission';
|
|
20
|
-
}
|
|
21
|
-
export interface ScheduledTask {
|
|
22
|
-
id: string;
|
|
23
|
-
frequency: 'on-session-start' | 'daily' | 'weekly' | 'monthly' | 'on-event';
|
|
24
|
-
action: string;
|
|
25
|
-
condition?: string;
|
|
26
|
-
lastExecuted?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ToolDefinition {
|
|
29
|
-
name: string;
|
|
30
|
-
description: string;
|
|
31
|
-
requiresPermission: boolean;
|
|
32
|
-
permissionLevel: 1 | 2 | 3;
|
|
33
|
-
}
|
|
34
|
-
export interface ContextPack {
|
|
35
|
-
version: '1.0.0';
|
|
36
|
-
agentId: string;
|
|
37
|
-
agentName: string;
|
|
38
|
-
sessionId: string;
|
|
39
|
-
identity: {
|
|
40
|
-
name: string;
|
|
41
|
-
purpose: string;
|
|
42
|
-
backstory: string;
|
|
43
|
-
personalityTraits: string[];
|
|
44
|
-
};
|
|
45
|
-
trustTiers: {
|
|
46
|
-
tier1: TrustTier;
|
|
47
|
-
tier2: TrustTier;
|
|
48
|
-
tier3: TrustTier;
|
|
49
|
-
};
|
|
50
|
-
governance: {
|
|
51
|
-
playbook: string;
|
|
52
|
-
availableTools: ToolDefinition[];
|
|
53
|
-
hardBans: string[];
|
|
54
|
-
escalation: string[];
|
|
55
|
-
};
|
|
56
|
-
heartbeat: {
|
|
57
|
-
tasks: ScheduledTask[];
|
|
58
|
-
lastCheck: string;
|
|
59
|
-
};
|
|
60
|
-
memory: {
|
|
61
|
-
brain: string;
|
|
62
|
-
activeTasks: string[];
|
|
63
|
-
lessons: string[];
|
|
64
|
-
userPreferences: Record<string, unknown>;
|
|
65
|
-
};
|
|
66
|
-
voice: {
|
|
67
|
-
style: string;
|
|
68
|
-
tone: {
|
|
69
|
-
formality: number;
|
|
70
|
-
enthusiasm: number;
|
|
71
|
-
empathy: number;
|
|
72
|
-
directness: number;
|
|
73
|
-
};
|
|
74
|
-
rules: string[];
|
|
75
|
-
};
|
|
76
|
-
systemPrompt: string;
|
|
77
|
-
hash: string;
|
|
78
|
-
createdAt: string;
|
|
79
|
-
expiresAt: string;
|
|
80
|
-
}
|
|
81
|
-
export interface WorkspaceSession {
|
|
82
|
-
id: string;
|
|
83
|
-
name: string;
|
|
84
|
-
mode: 'regular' | 'agent';
|
|
85
|
-
agentId?: string;
|
|
86
|
-
agentName?: string;
|
|
87
|
-
contextPack?: ContextPack;
|
|
88
|
-
contextHash?: string;
|
|
89
|
-
contextRefreshedAt?: string;
|
|
90
|
-
workspaceFiles?: string[];
|
|
91
|
-
}
|
package/src/workspace/types.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"jsx": "react-jsx"
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*"]
|
|
14
|
-
}
|