Add 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386
Browse files- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-01a1adab-8b0b-403a-9b47-300d8b6e23ad1760465691461-2025_10_14-20.15.19.126/source.csv +3 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-1fba0cc5-412a-4d8d-8b2e-97648b12068f1763821685625-2025_11_22-15.28.36.895/source.csv +3 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-2dd870d0-308d-414c-a245-79471de03e251762338009811-2025_11_05-11.20.45.40/source.csv +3 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-4b6df811-3dcf-46d1-9359-df5308d034461762604019271-2025_11_08-13.14.06.137/source.csv +84 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-6048c8e1-2439-424f-8372-d4ccd17c2d5f1760522924995-2025_10_15-12.09.21.860/source.csv +0 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-75fcc8f0-691c-4551-9c8c-7a9bcc824a7e1760553685394-2025_10_15-20.41.46.66/source.csv +0 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-86d7c177-b996-482a-a65c-68d9f2d2be591760987967407-2025_10_20-21.19.55.809/source.csv +0 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-90eb3cd1-0436-48d8-a22e-b344f5f8ed3b1762278666203-2025_11_04-18.51.32.439/source.csv +15 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-9bdc6d3b-3820-4990-8f3f-cef4842cb4f61760990306149-2025_10_20-21.58.54.493/source.csv +3 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-b22af988-ea61-4eb2-8393-c9d41986ca8e1763822605955-2025_11_22-15.43.56.451/source.csv +95 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-c929082a-fbf7-4a6a-8122-e5f08c5e25921762270306238-2025_11_04-16.32.15.383/source.csv +137 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-d6aa1c03-027a-414e-9d2e-358a8ff8ee771765127660242-2025_12_07-18.14.46.516/source.csv +0 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-d72ea1bf-407e-4c83-bae5-566f9cf366901762523167296-2025_11_07-14.46.40.718/source.csv +0 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-de898702-d3d5-4c86-8010-37845aa1748c1762368627604-2025_11_05-19.50.55.448/source.csv +6 -0
- 7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-e14cbbc9-79dc-4854-93dc-1aff51d245bf1762524405138-2025_11_07-15.07.25.256/source.csv +25 -0
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-01a1adab-8b0b-403a-9b47-300d8b6e23ad1760465691461-2025_10_14-20.15.19.126/source.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
2,4551,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"8:15:18 PM [info] Activating crowd-code\n8:15:19 PM [info] Recording started\n8:15:19 PM [info] Initializing git provider using file system watchers...\n8:15:19 PM [info] No workspace folder found\n8:15:22 PM [info] Retrying git provider initialization...\n8:15:22 PM [info] No workspace folder found\n",Log,tab
|
| 3 |
+
3,50672634,"TERMINAL",0,0,"",,terminal_focus
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-1fba0cc5-412a-4d8d-8b2e-97648b12068f1763821685625-2025_11_22-15.28.36.895/source.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
2,2255,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"3:28:36 PM [info] Activating crowd-code\n3:28:36 PM [info] Recording started\n3:28:37 PM [info] Initializing git provider using file system watchers...\n3:28:37 PM [info] No workspace folder found\n",Log,tab
|
| 3 |
+
3,2303,"extension-output-pdoom-org.crowd-code-#1-crowd-code",194,0,"3:28:39 PM [info] Retrying git provider initialization...\n3:28:39 PM [info] No workspace folder found\n",Log,content
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-2dd870d0-308d-414c-a245-79471de03e251762338009811-2025_11_05-11.20.45.40/source.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
2,2490,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"11:20:44 AM [info] Activating crowd-code\n11:20:45 AM [info] Recording started\n11:20:45 AM [info] Initializing git provider using file system watchers...\n11:20:45 AM [info] No workspace folder found\n",Log,tab
|
| 3 |
+
3,3554,"extension-output-pdoom-org.crowd-code-#1-crowd-code",198,0,"11:20:47 AM [info] Retrying git provider initialization...\n11:20:47 AM [info] No workspace folder found\n",Log,content
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-4b6df811-3dcf-46d1-9359-df5308d034461762604019271-2025_11_08-13.14.06.137/source.csv
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
1,46,"src/extension.ts",0,0,"import * as vscode from 'vscode';\nimport * as http from 'http';\nimport { Buffer } from 'buffer';\n\nconst HOSTNAME = 'hai005';\nconst PORT = 30000;\n\nexport function activate(context: vscode.ExtensionContext) {\n\n\tconsole.log('[crowd-pilot] Extension activated');\n\n\t// Configure terminal to allow tab keybinding to work\n\t(async () => {\n\t\tconst config = vscode.workspace.getConfiguration('terminal.integrated');\n\t\tconst commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);\n\t\tlet updated = false;\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.modelRun')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.modelRun');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.hideUi')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.hideUi');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (updated) {\n\t\t\tawait config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);\n\t\t}\n\t\t// Prime terminal subsystem after intercept is enabled (NOTE: this is a workaround)\n\t\tawait primeTerminalSubsystem();\n\t})().catch((err) => console.error('[crowd-pilot] Startup initialization error:', err));\n\n\tconst hideUi = vscode.commands.registerCommand('crowd-pilot.hideUi', () => {\n\t\thidePreviewUI();\n\t});\n\n\tconst modelRun = vscode.commands.registerCommand('crowd-pilot.modelRun', async () => {\n\t\tconst editor = vscode.window.activeTextEditor;\n\t\tif (!editor) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst plan = await requestModelActions(editor);\n\n\t\t\tif (!previewVisible) {\n\t\t\t\tshowPreviewUI(plan);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst runPlan = currentPlan ?? plan;\n\t\t\thidePreviewUI();\n\t\t\tawait executePlan(runPlan);\n\t\t\tvscode.window.showInformationMessage('All actions emitted');\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`Model run failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tconst sglangTest = vscode.commands.registerCommand('crowd-pilot.sglangTest', async () => {\n\t\ttry {\n\t\t\tawait callSGLangChat();\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`SGLang test failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tcontext.subscriptions.push(hideUi, sglangTest, modelRun);\n}\n\nexport function deactivate() {}\n\nasync function primeTerminalSubsystem(): Promise<void> {\n\ttry {\n\t\tif (vscode.window.terminals.length > 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst opened = new Promise<void>((resolve) => {\n\t\t\tconst d = vscode.window.onDidOpenTerminal(() => {\n\t\t\t\ttry { d.dispose(); } catch {}\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t\tconst t = vscode.window.createTerminal('crowd-pilot prime');\n\t\tawait Promise.race([\n\t\t\topened,\n\t\t\tnew Promise<void>(r => setTimeout(r, 150))\n\t\t]);\n\t\ttry { t.dispose(); } catch {}\n\t\tawait new Promise<void>(r => setTimeout(r, 50));\n\t\tconsole.log('[crowd-pilot] Primed terminal subsystem');\n\t} catch (err) {\n\t\tconsole.error('[crowd-pilot] Failed to prime terminal subsystem:', err);\n\t}\n}\n\n// -------------------- Plan Types & Execution --------------------\ntype PlannedAction =\n| { kind: 'showTextDocument' }\n| { kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }\n| { kind: 'editInsert', position: [number, number], text: string }\n| { kind: 'terminalShow' }\n| { kind: 'terminalSendText', text: string };\n\nlet currentPlan: PlannedAction[] | undefined;\n\nfunction buildTestRunPlan(_editor: vscode.TextEditor, _doc: vscode.TextDocument, _term: vscode.Terminal): PlannedAction[] {\n\tconst plan: PlannedAction[] = [];\n\tplan.push({ kind: 'showTextDocument' });\n\tplan.push({ kind: 'setSelections', selections: [{ start: [0, 0], end: [0, 0] }] });\n\tplan.push({ kind: 'editInsert', position: [0, 0], text: 'hello world\n' });\n\tplan.push({ kind: 'terminalShow' });\n\tplan.push({ kind: 'terminalSendText', text: 'echo VSCode test' });\n\treturn plan;\n}\n\nasync function executePlan(plan: PlannedAction[]): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\tconst doc = editor.document;\n\tconst term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');\n\tfor (const action of plan) {\n\t\tif (action.kind === 'showTextDocument') {\n\t\t\tawait vscode.window.showTextDocument(doc);\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'setSelections') {\n\t\t\teditor.selections = action.selections.map(s => new vscode.Selection(\n\t\t\t\tnew vscode.Position(s.start[0], s.start[1]),\n\t\t\t\tnew vscode.Position(s.end[0], s.end[1])\n\t\t\t));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'editInsert') {\n\t\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.insert(new vscode.Position(action.position[0], action.position[1]), action.text));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalShow') {\n\t\t\tterm.show();\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalSendText') {\n\t\t\tterm.sendText(action.text);\n\t\t\tcontinue;\n\t\t}\n\t}\n}\n\n// -------------------- UI State & Helpers --------------------\nconst UI_CONTEXT_KEY = 'crowdPilot.uiVisible';\nlet previewVisible = false;\nlet previewQuickPick: vscode.QuickPick<(vscode.QuickPickItem & { index: number })> | undefined;\n\nfunction showPreviewUI(plan: PlannedAction[]): void {\n\tconst items: (vscode.QuickPickItem & { index: number })[] = plan.map((action, index) => {\n\t\tswitch (action.kind) {\n\t\t\tcase 'showTextDocument':\n\t\t\t\treturn { index, label: '$(file) Focus active text document' };\n\t\t\tcase 'setSelections':\n\t\t\t\t{\n\t\t\t\t\tconst cursors = action.selections.map(s => `(${s.start[0]}, ${s.start[1]})`).join(', ');\n\t\t\t\t\treturn { index, label: `$(cursor) Move cursor to ${cursors}` };\n\t\t\t\t}\n\t\t\tcase 'editInsert':\n\t\t\t\treturn { index, label: `$(pencil) Insert ""${action.text.replace(/\n/g, '\\n')}"" at (${action.position[0]}, ${action.position[1]})` };\n\t\t\tcase 'terminalShow':\n\t\t\t\treturn { index, label: '$(terminal) Focus terminal' };\n\t\t\tcase 'terminalSendText':\n\t\t\t\treturn { index, label: `$(terminal) Run ""${action.text}"" in terminal` };\n\t\t}\n\t});\n if (!previewQuickPick) {\n previewQuickPick = vscode.window.createQuickPick<(vscode.QuickPickItem & { index: number })>();\n\t\tpreviewQuickPick.title = 'crowd-pilot: preview';\n\t\tpreviewQuickPick.matchOnDetail = true;\n\t\tpreviewQuickPick.ignoreFocusOut = true;\n\t\tpreviewQuickPick.canSelectMany = false;\n previewQuickPick.onDidAccept(async () => {\n const qp = previewQuickPick!;\n const selected = qp.selectedItems?.[0];\n qp.hide();\n if (selected) {\n await executePlan([plan[selected.index]]);\n vscode.window.showInformationMessage('Action executed');\n }\n });\n\t\tpreviewQuickPick.onDidHide(() => {\n\t\t\tpreviewVisible = false;\n\t\t\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n\t\t\ttry { previewQuickPick?.dispose(); } catch {}\n\t\t\tpreviewQuickPick = undefined;\n\t\t});\n\t}\n\tpreviewQuickPick.items = items;\n\tpreviewQuickPick.placeholder = 'Press Tab to run all, Enter for selected, or Esc to hide';\n\tpreviewQuickPick.show();\n\tpreviewVisible = true;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, true);\n\tcurrentPlan = plan;\n}\n\nfunction hidePreviewUI(): void {\n\tif (previewQuickPick) {\n\t\ttry { previewQuickPick.hide(); } catch {}\n\t\treturn;\n\t}\n\tpreviewVisible = false;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n}\n\n// -------------------- SGLang Client (simple test) --------------------\nasync function callSGLangChat(): Promise<void> {\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tconst postData = JSON.stringify(requestBody);\n\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();\n\t\t});\n\n\t\tvscode.window.showInformationMessage(`SGLang response: ${JSON.stringify(json, null, 2)}`);\n\t} catch (err) {\n\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\tvscode.window.showErrorMessage(`SGLang request failed: ${errorMessage}`);\n\t}\n}\n\n// -------------------- Model-planned Actions --------------------\nasync function requestModelActions(editor: vscode.TextEditor): Promise<PlannedAction[]> {\n\tconst schemaDescription = [\n\t\t'Output ONLY a JSON array. No prose, no code fences.',\n\t\t'Allowed actions (TypeScript-like schema):',\n\t\t""{ kind: 'showTextDocument' }"",\n\t\t""{ kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }"",\n\t\t""{ kind: 'editInsert', position: [number, number], text: string }"",\n\t\t""{ kind: 'terminalShow' }"",\n\t\t""{ kind: 'terminalSendText', text: string }"",\n\t\t'Coordinates are zero-based [line, column].'\n\t].join('\n');\n\n\tconst demoGoal = [\n\t\t'Create a concise demo plan that:',\n\t\t'- focuses the active text document',\n\t\t'- moves the cursor to (0, 0)',\n\t\t""- inserts the line \""hello from model\\n\"" at (0, 0)"",\n\t\t'- focuses the terminal',\n\t\t'- runs the command ""echo model run""'\n\t].join('\n');\n\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'system', content: schemaDescription },\n\t\t\t{ role: 'user', content: demoGoal }\n\t\t]\n\t};\n\n\tconst postData = JSON.stringify(requestBody);\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\tconst json = await new Promise<any>((resolve, reject) => {\n\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\tlet data = '';\n\t\t\tres.on('data', (chunk: Buffer) => { data += chunk.toString(); });\n\t\t\tres.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treq.on('error', (err: Error) => reject(err));\n\t\treq.write(postData);\n\t\treq.end();\n\t});\n\n\tconst content = extractChatContent(json);\n\tif (typeof content !== 'string' || content.trim().length === 0) {\n\t\tthrow new Error('Empty model content');\n\t}\n\tconst actions = parsePlannedActions(content);\n\tif (actions.length === 0) {\n\t\tthrow new Error('No valid actions parsed from model output');\n\t}\n\treturn actions;\n}\n\nfunction extractChatContent(json: any): string | undefined {\n\ttry {\n\t\tif (json && Array.isArray(json.choices) && json.choices[0]) {\n\t\t\tconst choice = json.choices[0];\n\t\t\tif (choice.message && typeof choice.message.content === 'string') {\n\t\t\t\treturn choice.message.content;\n\t\t\t}\n\t\t\tif (typeof choice.text === 'string') {\n\t\t\t\treturn choice.text;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction parsePlannedActions(raw: string): PlannedAction[] {\n\tlet text = raw.trim();\n\ttext = text.replace(/^```(?:json)?\s*/i, '').replace(/```\s*$/i, '').trim();\n\tconst arrayMatch = text.match(/\[[\s\S]*\]/);\n\tconst jsonText = arrayMatch ? arrayMatch[0] : text;\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(jsonText);\n\t} catch (err) {\n\t\treturn [];\n\t}\n\tif (!Array.isArray(parsed)) { return []; }\n\tconst result: PlannedAction[] = [];\n\tfor (const item of parsed) {\n\t\tif (!item || typeof item !== 'object' || typeof (item as any).kind !== 'string') { continue; }\n\t\tswitch ((item as any).kind) {\n\t\t\tcase 'showTextDocument':\n\t\t\t\tresult.push({ kind: 'showTextDocument' });\n\t\t\t\tbreak;\n\t\t\tcase 'setSelections': {\n\t\t\t\tconst selections = Array.isArray((item as any).selections) ? (item as any).selections : [];\n\t\t\t\tconst norm = selections.map((s: any) => ({\n\t\t\t\t\tstart: Array.isArray(s?.start) && s.start.length === 2 ? [Number(s.start[0]) || 0, Number(s.start[1]) || 0] as [number, number] : [0, 0] as [number, number],\n\t\t\t\t\tend: Array.isArray(s?.end) && s.end.length === 2 ? [Number(s.end[0]) || 0, Number(s.end[1]) || 0] as [number, number] : [0, 0] as [number, number]\n\t\t\t\t}));\n\t\t\t\tresult.push({ kind: 'setSelections', selections: norm });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'editInsert': {\n\t\t\t\tconst pos = Array.isArray((item as any).position) && (item as any).position.length === 2 ? [Number((item as any).position[0]) || 0, Number((item as any).position[1]) || 0] as [number, number] : [0, 0] as [number, number];\n\t\t\t\tconst text = typeof (item as any).text === 'string' ? (item as any).text : '';\n\t\t\t\tresult.push({ kind: 'editInsert', position: pos, text });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'terminalShow':\n\t\t\t\tresult.push({ kind: 'terminalShow' });\n\t\t\t\tbreak;\n\t\t\tcase 'terminalSendText': {\n\t\t\t\tconst text = typeof (item as any).text === 'string' ? (item as any).text : '';\n\t\t\t\tresult.push({ kind: 'terminalSendText', text });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n",typescript,tab
|
| 3 |
+
2,4895,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"1:14:03 PM [info] Activating crowd-code\n1:14:06 PM [info] Recording started\n1:14:06 PM [info] Initializing git provider using file system watchers...\n1:14:09 PM [info] Git repository found\n1:14:09 PM [info] Git provider initialized successfully\n1:14:10 PM [info] Initial git state: [object Object]\n",Log,tab
|
| 4 |
+
3,7104,"src/extension.ts",0,0,"",typescript,tab
|
| 5 |
+
4,8841,"TERMINAL",0,0,"git checkout -b ""use-gpt5-for-tab""",,terminal_command
|
| 6 |
+
5,8849,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 7 |
+
6,8849,"TERMINAL",0,0,"Switched to a new branch 'use-gpt5-for-tab'\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 8 |
+
7,13793,"src/extension.ts",0,0,"Switched from branch 'use-model-for-tab' to 'use-gpt5-for-tab'",typescript,git_branch_checkout
|
| 9 |
+
8,532248,"TERMINAL",0,0,"pwd",,terminal_command
|
| 10 |
+
9,532254,"TERMINAL",0,0,"]633;C/Users/mihir/Projects/crowd-pilot-extension\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 11 |
+
10,659374,"package.json",0,0,"{\n ""name"": ""crowd-pilot"",\n ""displayName"": ""crowd-pilot-extension"",\n ""description"": ""Teaching language models to code like humans."",\n ""publisher"": ""p(doom)"",\n ""version"": ""0.0.1"",\n ""engines"": {\n ""vscode"": ""^1.99.3""\n },\n ""categories"": [\n ""Other""\n ],\n ""activationEvents"": [\n ""onStartupFinished""\n ],\n ""main"": ""./out/extension.js"",\n ""contributes"": {\n ""commands"": [\n {\n ""command"": ""crowd-pilot.testRun"",\n ""title"": ""Test Run""\n },\n {\n ""command"": ""crowd-pilot.hideUi"",\n ""title"": ""crowd-pilot: Hide Preview""\n },\n {\n ""command"": ""crowd-pilot.sglangTest"",\n ""title"": ""crowd-pilot: Test SGLang""\n },\n {\n ""command"": ""crowd-pilot.modelRun"",\n ""title"": ""crowd-pilot: Model Plan & Run""\n }\n ],\n ""keybindings"": [\n {\n ""command"": ""crowd-pilot.modelRun"",\n ""key"": ""tab"",\n ""mac"": ""tab"",\n ""when"": ""editorTextFocus || terminalFocus""\n },\n {\n ""command"": ""crowd-pilot.modelRun"",\n ""key"": ""tab"",\n ""mac"": ""tab"",\n ""when"": ""inQuickOpen && crowdPilot.uiVisible""\n },\n {\n ""command"": ""crowd-pilot.hideUi"",\n ""key"": ""escape"",\n ""mac"": ""escape"",\n ""when"": ""crowdPilot.uiVisible""\n }\n ]\n },\n ""scripts"": {\n ""vscode:prepublish"": ""npm run compile"",\n ""compile"": ""tsc -p ./"",\n ""watch"": ""tsc -watch -p ./"",\n ""pretest"": ""npm run compile && npm run lint"",\n ""lint"": ""eslint src"",\n ""test"": ""vscode-test""\n },\n ""devDependencies"": {\n ""@types/vscode"": ""^1.105.0"",\n ""@types/mocha"": ""^10.0.10"",\n ""@types/node"": ""22.x"",\n ""@typescript-eslint/eslint-plugin"": ""^8.45.0"",\n ""@typescript-eslint/parser"": ""^8.45.0"",\n ""eslint"": ""^9.36.0"",\n ""typescript"": ""^5.9.3"",\n ""@vscode/test-cli"": ""^0.0.11"",\n ""@vscode/test-electron"": ""^2.5.2""\n }\n}\n",json,tab
|
| 12 |
+
11,659410,"package.json",602,22,"crowd-pilot.sglangTest",json,selection_command
|
| 13 |
+
12,662779,"src/extension.ts",0,0,"import * as vscode from 'vscode';\nimport * as http from 'http';\nimport { Buffer } from 'buffer';\n\nconst HOSTNAME = 'hai005';\nconst PORT = 30000;\n\nexport function activate(context: vscode.ExtensionContext) {\n\n\tconsole.log('[crowd-pilot] Extension activated');\n\n\t// Configure terminal to allow tab keybinding to work\n\t(async () => {\n\t\tconst config = vscode.workspace.getConfiguration('terminal.integrated');\n\t\tconst commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);\n\t\tlet updated = false;\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.modelRun')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.modelRun');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.hideUi')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.hideUi');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (updated) {\n\t\t\tawait config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);\n\t\t}\n\t\t// Prime terminal subsystem after intercept is enabled (NOTE: this is a workaround)\n\t\tawait primeTerminalSubsystem();\n\t})().catch((err) => console.error('[crowd-pilot] Startup initialization error:', err));\n\n\tconst hideUi = vscode.commands.registerCommand('crowd-pilot.hideUi', () => {\n\t\thidePreviewUI();\n\t});\n\n\tconst modelRun = vscode.commands.registerCommand('crowd-pilot.modelRun', async () => {\n\t\tconst editor = vscode.window.activeTextEditor;\n\t\tif (!editor) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst plan = await requestModelActions(editor);\n\n\t\t\tif (!previewVisible) {\n\t\t\t\tshowPreviewUI(plan);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst runPlan = currentPlan ?? plan;\n\t\t\thidePreviewUI();\n\t\t\tawait executePlan(runPlan);\n\t\t\tvscode.window.showInformationMessage('All actions emitted');\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`Model run failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tconst sglangTest = vscode.commands.registerCommand('crowd-pilot.sglangTest', async () => {\n\t\ttry {\n\t\t\tawait callSGLangChat();\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`SGLang test failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tcontext.subscriptions.push(hideUi, sglangTest, modelRun);\n}\n\nexport function deactivate() {}\n\nasync function primeTerminalSubsystem(): Promise<void> {\n\ttry {\n\t\tif (vscode.window.terminals.length > 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst opened = new Promise<void>((resolve) => {\n\t\t\tconst d = vscode.window.onDidOpenTerminal(() => {\n\t\t\t\ttry { d.dispose(); } catch {}\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t\tconst t = vscode.window.createTerminal('crowd-pilot prime');\n\t\tawait Promise.race([\n\t\t\topened,\n\t\t\tnew Promise<void>(r => setTimeout(r, 150))\n\t\t]);\n\t\ttry { t.dispose(); } catch {}\n\t\tawait new Promise<void>(r => setTimeout(r, 50));\n\t\tconsole.log('[crowd-pilot] Primed terminal subsystem');\n\t} catch (err) {\n\t\tconsole.error('[crowd-pilot] Failed to prime terminal subsystem:', err);\n\t}\n}\n\n// -------------------- Plan Types & Execution --------------------\ntype PlannedAction =\n| { kind: 'showTextDocument' }\n| { kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }\n| { kind: 'editInsert', position: [number, number], text: string }\n| { kind: 'terminalShow' }\n| { kind: 'terminalSendText', text: string };\n\nlet currentPlan: PlannedAction[] | undefined;\n\nfunction buildTestRunPlan(_editor: vscode.TextEditor, _doc: vscode.TextDocument, _term: vscode.Terminal): PlannedAction[] {\n\tconst plan: PlannedAction[] = [];\n\tplan.push({ kind: 'showTextDocument' });\n\tplan.push({ kind: 'setSelections', selections: [{ start: [0, 0], end: [0, 0] }] });\n\tplan.push({ kind: 'editInsert', position: [0, 0], text: 'hello world\n' });\n\tplan.push({ kind: 'terminalShow' });\n\tplan.push({ kind: 'terminalSendText', text: 'echo VSCode test' });\n\treturn plan;\n}\n\nasync function executePlan(plan: PlannedAction[]): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\tconst doc = editor.document;\n\tconst term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');\n\tfor (const action of plan) {\n\t\tif (action.kind === 'showTextDocument') {\n\t\t\tawait vscode.window.showTextDocument(doc);\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'setSelections') {\n\t\t\teditor.selections = action.selections.map(s => new vscode.Selection(\n\t\t\t\tnew vscode.Position(s.start[0], s.start[1]),\n\t\t\t\tnew vscode.Position(s.end[0], s.end[1])\n\t\t\t));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'editInsert') {\n\t\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.insert(new vscode.Position(action.position[0], action.position[1]), action.text));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalShow') {\n\t\t\tterm.show();\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalSendText') {\n\t\t\tterm.sendText(action.text);\n\t\t\tcontinue;\n\t\t}\n\t}\n}\n\n// -------------------- UI State & Helpers --------------------\nconst UI_CONTEXT_KEY = 'crowdPilot.uiVisible';\nlet previewVisible = false;\nlet previewQuickPick: vscode.QuickPick<(vscode.QuickPickItem & { index: number })> | undefined;\n\nfunction showPreviewUI(plan: PlannedAction[]): void {\n\tconst items: (vscode.QuickPickItem & { index: number })[] = plan.map((action, index) => {\n\t\tswitch (action.kind) {\n\t\t\tcase 'showTextDocument':\n\t\t\t\treturn { index, label: '$(file) Focus active text document' };\n\t\t\tcase 'setSelections':\n\t\t\t\t{\n\t\t\t\t\tconst cursors = action.selections.map(s => `(${s.start[0]}, ${s.start[1]})`).join(', ');\n\t\t\t\t\treturn { index, label: `$(cursor) Move cursor to ${cursors}` };\n\t\t\t\t}\n\t\t\tcase 'editInsert':\n\t\t\t\treturn { index, label: `$(pencil) Insert ""${action.text.replace(/\n/g, '\\n')}"" at (${action.position[0]}, ${action.position[1]})` };\n\t\t\tcase 'terminalShow':\n\t\t\t\treturn { index, label: '$(terminal) Focus terminal' };\n\t\t\tcase 'terminalSendText':\n\t\t\t\treturn { index, label: `$(terminal) Run ""${action.text}"" in terminal` };\n\t\t}\n\t});\n if (!previewQuickPick) {\n previewQuickPick = vscode.window.createQuickPick<(vscode.QuickPickItem & { index: number })>();\n\t\tpreviewQuickPick.title = 'crowd-pilot: preview';\n\t\tpreviewQuickPick.matchOnDetail = true;\n\t\tpreviewQuickPick.ignoreFocusOut = true;\n\t\tpreviewQuickPick.canSelectMany = false;\n previewQuickPick.onDidAccept(async () => {\n const qp = previewQuickPick!;\n const selected = qp.selectedItems?.[0];\n qp.hide();\n if (selected) {\n await executePlan([plan[selected.index]]);\n vscode.window.showInformationMessage('Action executed');\n }\n });\n\t\tpreviewQuickPick.onDidHide(() => {\n\t\t\tpreviewVisible = false;\n\t\t\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n\t\t\ttry { previewQuickPick?.dispose(); } catch {}\n\t\t\tpreviewQuickPick = undefined;\n\t\t});\n\t}\n\tpreviewQuickPick.items = items;\n\tpreviewQuickPick.placeholder = 'Press Tab to run all, Enter for selected, or Esc to hide';\n\tpreviewQuickPick.show();\n\tpreviewVisible = true;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, true);\n\tcurrentPlan = plan;\n}\n\nfunction hidePreviewUI(): void {\n\tif (previewQuickPick) {\n\t\ttry { previewQuickPick.hide(); } catch {}\n\t\treturn;\n\t}\n\tpreviewVisible = false;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n}\n\n// -------------------- SGLang Client (simple test) --------------------\nasync function callSGLangChat(): Promise<void> {\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tconst postData = JSON.stringify(requestBody);\n\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();\n\t\t});\n\n\t\tvscode.window.showInformationMessage(`SGLang response: ${JSON.stringify(json, null, 2)}`);\n\t} catch (err) {\n\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\tvscode.window.showErrorMessage(`SGLang request failed: ${errorMessage}`);\n\t}\n}\n\n// -------------------- Model-planned Actions --------------------\nasync function requestModelActions(editor: vscode.TextEditor): Promise<PlannedAction[]> {\n\tconst schemaDescription = [\n\t\t'Output ONLY a JSON array. No prose, no code fences.',\n\t\t'Allowed actions (TypeScript-like schema):',\n\t\t""{ kind: 'showTextDocument' }"",\n\t\t""{ kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }"",\n\t\t""{ kind: 'editInsert', position: [number, number], text: string }"",\n\t\t""{ kind: 'terminalShow' }"",\n\t\t""{ kind: 'terminalSendText', text: string }"",\n\t\t'Coordinates are zero-based [line, column].'\n\t].join('\n');\n\n\tconst demoGoal = [\n\t\t'Create a concise demo plan that:',\n\t\t'- focuses the active text document',\n\t\t'- moves the cursor to (0, 0)',\n\t\t""- inserts the line \""hello from model\\n\"" at (0, 0)"",\n\t\t'- focuses the terminal',\n\t\t'- runs the command ""echo model run""'\n\t].join('\n');\n\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'system', content: schemaDescription },\n\t\t\t{ role: 'user', content: demoGoal }\n\t\t]\n\t};\n\n\tconst postData = JSON.stringify(requestBody);\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\tconst json = await new Promise<any>((resolve, reject) => {\n\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\tlet data = '';\n\t\t\tres.on('data', (chunk: Buffer) => { data += chunk.toString(); });\n\t\t\tres.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treq.on('error', (err: Error) => reject(err));\n\t\treq.write(postData);\n\t\treq.end();\n\t});\n\n\tconst content = extractChatContent(json);\n\tif (typeof content !== 'string' || content.trim().length === 0) {\n\t\tthrow new Error('Empty model content');\n\t}\n\tconst actions = parsePlannedActions(content);\n\tif (actions.length === 0) {\n\t\tthrow new Error('No valid actions parsed from model output');\n\t}\n\treturn actions;\n}\n\nfunction extractChatContent(json: any): string | undefined {\n\ttry {\n\t\tif (json && Array.isArray(json.choices) && json.choices[0]) {\n\t\t\tconst choice = json.choices[0];\n\t\t\tif (choice.message && typeof choice.message.content === 'string') {\n\t\t\t\treturn choice.message.content;\n\t\t\t}\n\t\t\tif (typeof choice.text === 'string') {\n\t\t\t\treturn choice.text;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction parsePlannedActions(raw: string): PlannedAction[] {\n\tlet text = raw.trim();\n\ttext = text.replace(/^```(?:json)?\s*/i, '').replace(/```\s*$/i, '').trim();\n\tconst arrayMatch = text.match(/\[[\s\S]*\]/);\n\tconst jsonText = arrayMatch ? arrayMatch[0] : text;\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(jsonText);\n\t} catch (err) {\n\t\treturn [];\n\t}\n\tif (!Array.isArray(parsed)) { return []; }\n\tconst result: PlannedAction[] = [];\n\tfor (const item of parsed) {\n\t\tif (!item || typeof item !== 'object' || typeof (item as any).kind !== 'string') { continue; }\n\t\tswitch ((item as any).kind) {\n\t\t\tcase 'showTextDocument':\n\t\t\t\tresult.push({ kind: 'showTextDocument' });\n\t\t\t\tbreak;\n\t\t\tcase 'setSelections': {\n\t\t\t\tconst selections = Array.isArray((item as any).selections) ? (item as any).selections : [];\n\t\t\t\tconst norm = selections.map((s: any) => ({\n\t\t\t\t\tstart: Array.isArray(s?.start) && s.start.length === 2 ? [Number(s.start[0]) || 0, Number(s.start[1]) || 0] as [number, number] : [0, 0] as [number, number],\n\t\t\t\t\tend: Array.isArray(s?.end) && s.end.length === 2 ? [Number(s.end[0]) || 0, Number(s.end[1]) || 0] as [number, number] : [0, 0] as [number, number]\n\t\t\t\t}));\n\t\t\t\tresult.push({ kind: 'setSelections', selections: norm });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'editInsert': {\n\t\t\t\tconst pos = Array.isArray((item as any).position) && (item as any).position.length === 2 ? [Number((item as any).position[0]) || 0, Number((item as any).position[1]) || 0] as [number, number] : [0, 0] as [number, number];\n\t\t\t\tconst text = typeof (item as any).text === 'string' ? (item as any).text : '';\n\t\t\t\tresult.push({ kind: 'editInsert', position: pos, text });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 'terminalShow':\n\t\t\t\tresult.push({ kind: 'terminalShow' });\n\t\t\t\tbreak;\n\t\t\tcase 'terminalSendText': {\n\t\t\t\tconst text = typeof (item as any).text === 'string' ? (item as any).text : '';\n\t\t\t\tresult.push({ kind: 'terminalSendText', text });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n",typescript,tab
|
| 14 |
+
13,662833,"src/extension.ts",1899,22,"crowd-pilot.sglangTest",typescript,selection_command
|
| 15 |
+
14,665114,"src/extension.ts",1962,0,"",typescript,selection_mouse
|
| 16 |
+
15,667391,"src/extension.ts",7312,0,"",typescript,selection_command
|
| 17 |
+
16,793990,"src/extension.ts",98,46,"const openai = new OpenAI();",typescript,content
|
| 18 |
+
17,793990,"src/extension.ts",34,62,"import OpenAI from 'openai';",typescript,content
|
| 19 |
+
18,799726,"src/extension.ts",64,28,"const HOSTNAME = 'hai005';\nconst PORT = 30000;",typescript,content
|
| 20 |
+
19,799727,"src/extension.ts",34,28,"import * as http from 'http';\nimport { Buffer } from 'buffer';",typescript,content
|
| 21 |
+
20,799859,"src/extension.ts",8502,75,"\t\tvscode.window.showErrorMessage(`OpenAI request failed: ${errorMessage}`);",typescript,content
|
| 22 |
+
21,799860,"src/extension.ts",8319,92,"\t\tvscode.window.showInformationMessage(`OpenAI response: ${JSON.stringify(response, null, 2)}`);",typescript,content
|
| 23 |
+
22,799860,"src/extension.ts",7346,965,"\ttry {\n\t\tconst response = await openai.chat.completions.create({\n\t\t\tmodel: 'gpt-5',\n\t\t\tmessages: [\n\t\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t\t]",typescript,content
|
| 24 |
+
23,799860,"src/extension.ts",7224,72,"// -------------------- OpenAI Client (simple test) --------------------",typescript,content
|
| 25 |
+
24,799860,"src/extension.ts",98,46,"const openai = new OpenAI();",typescript,content
|
| 26 |
+
25,799860,"src/extension.ts",34,62,"import OpenAI from 'openai';",typescript,content
|
| 27 |
+
26,819074,"src/extension.ts",7656,75,"\t\tvscode.window.showErrorMessage(`SGLang request failed: ${errorMessage}`);",typescript,content
|
| 28 |
+
27,819075,"src/extension.ts",7469,96,"\t\tvscode.window.showInformationMessage(`SGLang response: ${JSON.stringify(json, null, 2)}`);",typescript,content
|
| 29 |
+
28,819075,"src/extension.ts",7294,167,"\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tconst postData = JSON.stringify(requestBody);\n\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();",typescript,content
|
| 30 |
+
29,819075,"src/extension.ts",7172,72,"// -------------------- SGLang Client (simple test) --------------------",typescript,content
|
| 31 |
+
30,819075,"src/extension.ts",64,28,"const HOSTNAME = 'hai005';\nconst PORT = 30000;",typescript,content
|
| 32 |
+
31,819075,"src/extension.ts",34,28,"import * as http from 'http';\nimport { Buffer } from 'buffer';",typescript,content
|
| 33 |
+
32,819204,"src/extension.ts",10449,42,"\tconst content = extractChatContent(response);",typescript,content
|
| 34 |
+
33,819205,"src/extension.ts",9665,778,"",typescript,content
|
| 35 |
+
34,819205,"src/extension.ts",9495,61,"\tconst response = await openai.chat.completions.create({\n\t\tmodel: 'gpt-5',",typescript,content
|
| 36 |
+
35,819205,"src/extension.ts",8502,75,"\t\tvscode.window.showErrorMessage(`OpenAI request failed: ${errorMessage}`);",typescript,content
|
| 37 |
+
36,819205,"src/extension.ts",8212,199,"\t\tvscode.window.showInformationMessage(`OpenAI response: ${JSON.stringify(response, null, 2)}`);",typescript,content
|
| 38 |
+
37,819205,"src/extension.ts",7346,864,"\ttry {\n\t\tconst response = await openai.chat.completions.create({\n\t\t\tmodel: 'gpt-5',\n\t\t\tmessages: [\n\t\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t\t]\n\t\t});",typescript,content
|
| 39 |
+
38,819205,"src/extension.ts",7224,72,"// -------------------- OpenAI Client (simple test) --------------------",typescript,content
|
| 40 |
+
39,819205,"src/extension.ts",98,46,"const openai = new OpenAI();",typescript,content
|
| 41 |
+
40,819205,"src/extension.ts",34,62,"import OpenAI from 'openai';",typescript,content
|
| 42 |
+
41,823732,"src/extension.ts",8838,46,"\tconst content = extractChatContent(json);",typescript,content
|
| 43 |
+
42,823732,"src/extension.ts",8832,0,"\t};\n\n\tconst postData = JSON.stringify(requestBody);\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\tconst json = await new Promise<any>((resolve, reject) => {\n\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\tlet data = '';\n\t\t\tres.on('data', (chunk: Buffer) => { data += chunk.toString(); });\n\t\t\tres.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treq.on('error', (err: Error) => reject(err));\n\t\treq.write(postData);\n\t\treq.end();\n",typescript,content
|
| 44 |
+
43,823732,"src/extension.ts",8649,74,"\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',",typescript,content
|
| 45 |
+
44,823732,"src/extension.ts",7656,75,"\t\tvscode.window.showErrorMessage(`SGLang request failed: ${errorMessage}`);",typescript,content
|
| 46 |
+
45,823732,"src/extension.ts",7469,96,"\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();\n\t\t});\n\n\t\tvscode.window.showInformationMessage(`SGLang response: ${JSON.stringify(json, null, 2)}`);",typescript,content
|
| 47 |
+
46,823732,"src/extension.ts",7294,173,"\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tconst postData = JSON.stringify(requestBody);\n\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});",typescript,content
|
| 48 |
+
47,823732,"src/extension.ts",7172,72,"// -------------------- SGLang Client (simple test) --------------------",typescript,content
|
| 49 |
+
48,823732,"src/extension.ts",64,28,"const HOSTNAME = 'hai005';\nconst PORT = 30000;",typescript,content
|
| 50 |
+
49,823732,"src/extension.ts",34,28,"import * as http from 'http';\nimport { Buffer } from 'buffer';",typescript,content
|
| 51 |
+
50,823874,"src/extension.ts",10835,98,"\t\tif (response && Array.isArray(response.choices) && response.choices[0]) {\n\t\t\tconst choice = response.choices[0];",typescript,content
|
| 52 |
+
51,823875,"src/extension.ts",10767,60,"function extractChatContent(response: any): string | undefined {",typescript,content
|
| 53 |
+
52,823875,"src/extension.ts",10449,42,"\tconst content = extractChatContent(response);",typescript,content
|
| 54 |
+
53,823875,"src/extension.ts",9665,778,"",typescript,content
|
| 55 |
+
54,823875,"src/extension.ts",9495,61,"\tconst response = await openai.chat.completions.create({\n\t\tmodel: 'gpt-5',",typescript,content
|
| 56 |
+
55,823875,"src/extension.ts",8502,75,"\t\tvscode.window.showErrorMessage(`OpenAI request failed: ${errorMessage}`);",typescript,content
|
| 57 |
+
56,823875,"src/extension.ts",8212,199,"\t\tvscode.window.showInformationMessage(`OpenAI response: ${JSON.stringify(response, null, 2)}`);",typescript,content
|
| 58 |
+
57,823875,"src/extension.ts",7346,864,"\ttry {\n\t\tconst response = await openai.chat.completions.create({\n\t\t\tmodel: 'gpt-5',\n\t\t\tmessages: [\n\t\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t\t]\n\t\t});",typescript,content
|
| 59 |
+
58,823875,"src/extension.ts",7224,72,"// -------------------- OpenAI Client (simple test) --------------------",typescript,content
|
| 60 |
+
59,823875,"src/extension.ts",98,46,"const openai = new OpenAI();",typescript,content
|
| 61 |
+
60,823875,"src/extension.ts",34,62,"import OpenAI from 'openai';",typescript,content
|
| 62 |
+
61,1046145,"TERMINAL",0,0,"git status",,terminal_command
|
| 63 |
+
62,1046215,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 64 |
+
63,1046232,"TERMINAL",0,0,"On branch use-gpt5-for-tab\r\nChanges not staged for commit:\r\n (use ""git add <file>..."" to update what will be committed)\r\n (use ""git restore <file>..."" to discard changes in working directory)\r\n\t[31mmodified: package-lock.json[m\r\n\t[31mmodified: package.json[m\r\n\t[31mmodified: src/extension.ts[m\r\n\r\nUntracked files:\r\n (use ""git add <file>..."" to include in what will be committed)\r\n\t[31mout/[m\r\n\r\nno changes added to commit (use ""git add"" and/or ""git commit -a"")\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 65 |
+
64,1160211,"src/extension.ts",9799,0,"",typescript,selection_mouse
|
| 66 |
+
65,1160304,"src/extension.ts",9798,0,"",typescript,selection_command
|
| 67 |
+
66,1396126,"TERMINAL",0,0,"git status",,terminal_command
|
| 68 |
+
67,1396170,"TERMINAL",0,0,"]633;COn branch use-gpt5-for-tab\r\nChanges not staged for commit:\r\n (use ""git add <file>..."" to update what will be committed)\r\n (use ""git restore <file>..."" to discard changes in working directory)\r\n\t[31mmodified: package-lock.json[m\r\n\t[31mmodified: package.json[m\r\n\t[31mmodified: src/extension.ts[m\r\n\r\nUntracked files:\r\n (use ""git add <file>..."" to include in what will be committed)\r\n\t[31mout/[m\r\n\r\nno changes added to commit (use ""git add"" and/or ""git commit -a"")\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 69 |
+
68,1401597,"TERMINAL",0,0,"git add src/extension.ts",,terminal_command
|
| 70 |
+
69,1401626,"TERMINAL",0,0,"]633;C[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 71 |
+
70,1404456,"TERMINAL",0,0,"git add package.json",,terminal_command
|
| 72 |
+
71,1404495,"TERMINAL",0,0,"]633;C[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 73 |
+
72,1425512,"TERMINAL",0,0,"git commti -m ""switch sglang local model to oai gpt5""",,terminal_command
|
| 74 |
+
73,1425564,"TERMINAL",0,0,"]633;Cgit: 'commti' is not a git command. See 'git --help'.\r\n\r\nThe most similar command is\r\n\tcommit\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 75 |
+
74,1430326,"TERMINAL",0,0,"git commit -m ""switch sglang local model to oai gpt5""",,terminal_command
|
| 76 |
+
75,1430378,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 77 |
+
76,1430386,"TERMINAL",0,0,"[use-gpt5-for-tab 681a74d] switch sglang local model to oai gpt5\r\n 2 files changed, 23 insertions(+), 86 deletions(-)\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 78 |
+
77,1460448,"TERMINAL",0,0,"git branch",,terminal_command
|
| 79 |
+
78,1460500,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 80 |
+
79,1460510,"TERMINAL",0,0,"[?1h=\r main[m[m\r\n* [32muse-gpt5-for-tab[m[m\r\n use-model-for-tab[m[m\r\n webview-tabbing-preview[m[m\r\n\r[K[?1l>[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 81 |
+
80,1465351,"TERMINAL",0,0,"git checkout use-model-for-tab",,terminal_command
|
| 82 |
+
81,1465387,"TERMINAL",0,0,"]633;CM\tpackage-lock.json\r\nSwitched to branch 'use-model-for-tab'\r\nYour branch is up to date with 'origin/use-model-for-tab'.\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 83 |
+
82,1465563,"src/extension.ts",34,9313,"import * as http from 'http';\nimport { Buffer } from 'buffer';\n\nconst HOSTNAME = 'hai005';\nconst PORT = 30000;\n\nexport function activate(context: vscode.ExtensionContext) {\n\n\tconsole.log('[crowd-pilot] Extension activated');\n\n\t// Configure terminal to allow tab keybinding to work\n\t(async () => {\n\t\tconst config = vscode.workspace.getConfiguration('terminal.integrated');\n\t\tconst commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);\n\t\tlet updated = false;\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.modelRun')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.modelRun');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.hideUi')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.hideUi');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (updated) {\n\t\t\tawait config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);\n\t\t}\n\t\t// Prime terminal subsystem after intercept is enabled (NOTE: this is a workaround)\n\t\tawait primeTerminalSubsystem();\n\t})().catch((err) => console.error('[crowd-pilot] Startup initialization error:', err));\n\n\tconst hideUi = vscode.commands.registerCommand('crowd-pilot.hideUi', () => {\n\t\thidePreviewUI();\n\t});\n\n\tconst modelRun = vscode.commands.registerCommand('crowd-pilot.modelRun', async () => {\n\t\tconst editor = vscode.window.activeTextEditor;\n\t\tif (!editor) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst plan = await requestModelActions(editor);\n\n\t\t\tif (!previewVisible) {\n\t\t\t\tshowPreviewUI(plan);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst runPlan = currentPlan ?? plan;\n\t\t\thidePreviewUI();\n\t\t\tawait executePlan(runPlan);\n\t\t\tvscode.window.showInformationMessage('All actions emitted');\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`Model run failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tconst sglangTest = vscode.commands.registerCommand('crowd-pilot.sglangTest', async () => {\n\t\ttry {\n\t\t\tawait callSGLangChat();\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`SGLang test failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tcontext.subscriptions.push(hideUi, sglangTest, modelRun);\n}\n\nexport function deactivate() {}\n\nasync function primeTerminalSubsystem(): Promise<void> {\n\ttry {\n\t\tif (vscode.window.terminals.length > 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst opened = new Promise<void>((resolve) => {\n\t\t\tconst d = vscode.window.onDidOpenTerminal(() => {\n\t\t\t\ttry { d.dispose(); } catch {}\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t\tconst t = vscode.window.createTerminal('crowd-pilot prime');\n\t\tawait Promise.race([\n\t\t\topened,\n\t\t\tnew Promise<void>(r => setTimeout(r, 150))\n\t\t]);\n\t\ttry { t.dispose(); } catch {}\n\t\tawait new Promise<void>(r => setTimeout(r, 50));\n\t\tconsole.log('[crowd-pilot] Primed terminal subsystem');\n\t} catch (err) {\n\t\tconsole.error('[crowd-pilot] Failed to prime terminal subsystem:', err);\n\t}\n}\n\n// -------------------- Plan Types & Execution --------------------\ntype PlannedAction =\n| { kind: 'showTextDocument' }\n| { kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }\n| { kind: 'editInsert', position: [number, number], text: string }\n| { kind: 'terminalShow' }\n| { kind: 'terminalSendText', text: string };\n\nlet currentPlan: PlannedAction[] | undefined;\n\nfunction buildTestRunPlan(_editor: vscode.TextEditor, _doc: vscode.TextDocument, _term: vscode.Terminal): PlannedAction[] {\n\tconst plan: PlannedAction[] = [];\n\tplan.push({ kind: 'showTextDocument' });\n\tplan.push({ kind: 'setSelections', selections: [{ start: [0, 0], end: [0, 0] }] });\n\tplan.push({ kind: 'editInsert', position: [0, 0], text: 'hello world\n' });\n\tplan.push({ kind: 'terminalShow' });\n\tplan.push({ kind: 'terminalSendText', text: 'echo VSCode test' });\n\treturn plan;\n}\n\nasync function executePlan(plan: PlannedAction[]): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\tconst doc = editor.document;\n\tconst term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');\n\tfor (const action of plan) {\n\t\tif (action.kind === 'showTextDocument') {\n\t\t\tawait vscode.window.showTextDocument(doc);\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'setSelections') {\n\t\t\teditor.selections = action.selections.map(s => new vscode.Selection(\n\t\t\t\tnew vscode.Position(s.start[0], s.start[1]),\n\t\t\t\tnew vscode.Position(s.end[0], s.end[1])\n\t\t\t));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'editInsert') {\n\t\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.insert(new vscode.Position(action.position[0], action.position[1]), action.text));\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalShow') {\n\t\t\tterm.show();\n\t\t\tcontinue;\n\t\t}\n\t\tif (action.kind === 'terminalSendText') {\n\t\t\tterm.sendText(action.text);\n\t\t\tcontinue;\n\t\t}\n\t}\n}\n\n// -------------------- UI State & Helpers --------------------\nconst UI_CONTEXT_KEY = 'crowdPilot.uiVisible';\nlet previewVisible = false;\nlet previewQuickPick: vscode.QuickPick<(vscode.QuickPickItem & { index: number })> | undefined;\n\nfunction showPreviewUI(plan: PlannedAction[]): void {\n\tconst items: (vscode.QuickPickItem & { index: number })[] = plan.map((action, index) => {\n\t\tswitch (action.kind) {\n\t\t\tcase 'showTextDocument':\n\t\t\t\treturn { index, label: '$(file) Focus active text document' };\n\t\t\tcase 'setSelections':\n\t\t\t\t{\n\t\t\t\t\tconst cursors = action.selections.map(s => `(${s.start[0]}, ${s.start[1]})`).join(', ');\n\t\t\t\t\treturn { index, label: `$(cursor) Move cursor to ${cursors}` };\n\t\t\t\t}\n\t\t\tcase 'editInsert':\n\t\t\t\treturn { index, label: `$(pencil) Insert ""${action.text.replace(/\n/g, '\\n')}"" at (${action.position[0]}, ${action.position[1]})` };\n\t\t\tcase 'terminalShow':\n\t\t\t\treturn { index, label: '$(terminal) Focus terminal' };\n\t\t\tcase 'terminalSendText':\n\t\t\t\treturn { index, label: `$(terminal) Run ""${action.text}"" in terminal` };\n\t\t}\n\t});\n if (!previewQuickPick) {\n previewQuickPick = vscode.window.createQuickPick<(vscode.QuickPickItem & { index: number })>();\n\t\tpreviewQuickPick.title = 'crowd-pilot: preview';\n\t\tpreviewQuickPick.matchOnDetail = true;\n\t\tpreviewQuickPick.ignoreFocusOut = true;\n\t\tpreviewQuickPick.canSelectMany = false;\n previewQuickPick.onDidAccept(async () => {\n const qp = previewQuickPick!;\n const selected = qp.selectedItems?.[0];\n qp.hide();\n if (selected) {\n await executePlan([plan[selected.index]]);\n vscode.window.showInformationMessage('Action executed');\n }\n });\n\t\tpreviewQuickPick.onDidHide(() => {\n\t\t\tpreviewVisible = false;\n\t\t\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n\t\t\ttry { previewQuickPick?.dispose(); } catch {}\n\t\t\tpreviewQuickPick = undefined;\n\t\t});\n\t}\n\tpreviewQuickPick.items = items;\n\tpreviewQuickPick.placeholder = 'Press Tab to run all, Enter for selected, or Esc to hide';\n\tpreviewQuickPick.show();\n\tpreviewVisible = true;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, true);\n\tcurrentPlan = plan;\n}\n\nfunction hidePreviewUI(): void {\n\tif (previewQuickPick) {\n\t\ttry { previewQuickPick.hide(); } catch {}\n\t\treturn;\n\t}\n\tpreviewVisible = false;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n}\n\n// -------------------- SGLang Client (simple test) --------------------\nasync function callSGLangChat(): Promise<void> {\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tconst postData = JSON.stringify(requestBody);\n\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();\n\t\t});\n\n\t\tvscode.window.showInformationMessage(`SGLang response: ${JSON.stringify(json, null, 2)}`);\n\t} catch (err) {\n\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\tvscode.window.showErrorMessage(`SGLang request failed: ${errorMessage}`);\n\t}\n}\n\n// -------------------- Model-planned Actions --------------------\nasync function requestModelActions(editor: vscode.TextEditor): Promise<PlannedAction[]> {\n\tconst schemaDescription = [\n\t\t'Output ONLY a JSON array. No prose, no code fences.',\n\t\t'Allowed actions (TypeScript-like schema):',\n\t\t""{ kind: 'showTextDocument' }"",\n\t\t""{ kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }"",\n\t\t""{ kind: 'editInsert', position: [number, number], text: string }"",\n\t\t""{ kind: 'terminalShow' }"",\n\t\t""{ kind: 'terminalSendText', text: string }"",\n\t\t'Coordinates are zero-based [line, column].'\n\t].join('\n');\n\n\tconst demoGoal = [\n\t\t'Create a concise demo plan that:',\n\t\t'- focuses the active text document',\n\t\t'- moves the cursor to (0, 0)',\n\t\t""- inserts the line \""hello from model\\n\"" at (0, 0)"",\n\t\t'- focuses the terminal',\n\t\t'- runs the command ""echo model run""'\n\t].join('\n');\n\n\tconst requestBody = {\n\t\tmodel: 'qwen/qwen2.5-0.5b-instruct',\n\t\tmessages: [\n\t\t\t{ role: 'system', content: schemaDescription },\n\t\t\t{ role: 'user', content: demoGoal }\n\t\t]\n\t};\n\n\tconst postData = JSON.stringify(requestBody);\n\tconst options = {\n\t\thostname: HOSTNAME,\n\t\tport: PORT,\n\t\tpath: '/v1/chat/completions',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Content-Length': Buffer.byteLength(postData)\n\t\t}\n\t};\n\n\tconst json = await new Promise<any>((resolve, reject) => {\n\t\tconst req = http.request(options, (res: http.IncomingMessage) => {\n\t\t\tlet data = '';\n\t\t\tres.on('data', (chunk: Buffer) => { data += chunk.toString(); });\n\t\t\tres.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treq.on('error', (err: Error) => reject(err));\n\t\treq.write(postData);\n\t\treq.end();\n\t});\n\n\tconst content = extractChatContent(json);\n\tif (typeof content !== 'string' || content.trim().length === 0) {\n\t\tthrow new Error('Empty model content');\n\t}\n\tconst actions = parsePlannedActions(content);\n\tif (actions.length === 0) {\n\t\tthrow new Error('No valid actions parsed from model output');\n\t}\n\treturn actions;\n}\n\nfunction extractChatContent(json: any): string | undefined {\n\ttry {\n\t\tif (json && Array.isArray(json.choices) && json.choices[0]) {\n\t\t\tconst choice = json.choices[0];\n",typescript,content
|
| 84 |
+
83,1469610,"src/extension.ts",0,0,"Switched from branch 'use-gpt5-for-tab' to 'use-model-for-tab'",typescript,git_branch_checkout
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-6048c8e1-2439-424f-8372-d4ccd17c2d5f1760522924995-2025_10_15-12.09.21.860/source.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-75fcc8f0-691c-4551-9c8c-7a9bcc824a7e1760553685394-2025_10_15-20.41.46.66/source.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-86d7c177-b996-482a-a65c-68d9f2d2be591760987967407-2025_10_20-21.19.55.809/source.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-90eb3cd1-0436-48d8-a22e-b344f5f8ed3b1762278666203-2025_11_04-18.51.32.439/source.csv
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
1,102,"src/extension.ts",0,0,"import * as vscode from 'vscode'\nimport * as crypto from 'crypto'\nimport { getExportPath, logToOutput, outputChannel, addToGitignore } from './utilities'\nimport axios from 'axios'\nimport {\n\tupdateStatusBarItem,\n\tstartRecording,\n\tstopRecording,\n\tisCurrentFileExported,\n\tcommands,\n\trecording,\n\taddToFileQueue,\n\tbuildCsvRow,\n\tappendToFile,\n\tpanicButton,\n} from './recording'\nimport { ChangeType, CSVRowBuilder } from './types'\nimport { RecordFilesProvider, type RecordFile } from './recordFilesProvider'\nimport { ActionsProvider } from './actionsProvider'\nimport { initializeGitProvider, cleanupGitProvider } from './gitProvider'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { showConsentChangeDialog, ensureConsent, hasConsent } from './consent'\n\nexport let statusBarItem: vscode.StatusBarItem\nexport let extContext: vscode.ExtensionContext\nexport let actionsProvider: ActionsProvider\n\nfunction onConfigurationChange(event: vscode.ConfigurationChangeEvent) {\n\tif (event.affectsConfiguration('crowdCode')) {\n\t\tupdateStatusBarItem()\n\t\tgetExportPath()\n\t}\n}\n\n/**\n * Gets the full path for a file or folder\n * @param item - The tree item representing the file or folder\n * @param exportPath - The base export path\n * @returns The full path to the file or folder\n */\nfunction getFullPath(item: RecordFile, exportPath: string): string {\n\t// If the item has a parent path (file inside a folder), construct the full path\n\tif (item.parentPath) {\n\t\treturn path.join(exportPath, item.parentPath, item.label)\n\t}\n\t// Otherwise, it's a root item\n\treturn path.join(exportPath, item.label)\n}\n\n/**\n * Deletes a file or folder recursively\n * @param filePath - The path to the file or folder to delete\n */\nasync function deleteFileOrFolder(filePath: string): Promise<void> {\n\ttry {\n\t\tconst stat = fs.statSync(filePath)\n\t\tif (stat.isDirectory()) {\n\t\t\t// Delete directory and its contents recursively\n\t\t\tfs.rmSync(filePath, { recursive: true, force: true })\n\t\t} else {\n\t\t\t// Delete single file\n\t\t\tfs.unlinkSync(filePath)\n\t\t}\n\t} catch (err) {\n\t\tconsole.error('Error deleting file or folder:', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Gets surrounding code context around the cursor position\n */\nfunction getCodeContext(document: vscode.TextDocument, position: vscode.Position, contextLines: number = 20): string {\n\tconst startLine = Math.max(0, position.line - contextLines)\n\tconst endLine = Math.min(document.lineCount - 1, position.line + contextLines)\n\t\n\tconst lines: string[] = []\n\tfor (let i = startLine; i <= endLine; i++) {\n\t\tconst line = document.lineAt(i)\n\t\t// Mark the cursor position with a special marker\n\t\tif (i === position.line) {\n\t\t\tconst lineText = line.text\n\t\t\tconst cursorChar = Math.min(position.character, lineText.length)\n\t\t\tconst beforeCursor = lineText.substring(0, cursorChar)\n\t\t\tconst afterCursor = lineText.substring(cursorChar)\n\t\t\tlines.push(`${beforeCursor}<CURSOR>${afterCursor}`)\n\t\t} else {\n\t\t\tlines.push(line.text)\n\t\t}\n\t}\n\t\n\treturn lines.join('\n')\n}\n\n/**\n * Calls OpenAI API to get code suggestions\n */\nasync function getCodeSuggestion(\n\tcodeContext: string,\n\tlanguageId: string,\n\tfileName: string\n): Promise<string | null> {\n\tconst apiKey = process.env.OPENAI_API_KEY\n\tif (!apiKey) {\n\t\tlogToOutput('OPENAI_API_KEY environment variable not set', 'error')\n\t\treturn null\n\t}\n\n\ttry {\n\t\tconst prompt = `You are a code completion assistant. Analyze the following code and suggest the next logical code completion at the <CURSOR> position.\n\nFile: ${fileName}\nLanguage: ${languageId}\n\nCode context:\n\`\`\`${languageId}\n${codeContext}\n\`\`\`\n\nInstructions:\n1. Provide ONLY the code that should be inserted at the cursor position\n2. Do not include any explanation, comments, or markdown formatting\n3. Return just the raw code text that completes the current line or statement\n4. If the code is already complete, suggest the next logical line\n5. Keep suggestions concise and relevant to the context\n6. Maintain the same indentation level as the cursor line\n\nSuggested code:`\n\n\t\tconst response = await axios.post(\n\t\t\t'https://api.openai.com/v1/chat/completions',\n\t\t\t{\n\t\t\t\tmodel: 'gpt-5',\n\t\t\t\tmessages: [\n\t\t\t\t\t{\n\t\t\t\t\t\trole: 'system',\n\t\t\t\t\t\tcontent: 'You are a helpful code completion assistant. Provide only code suggestions without any explanations or markdown formatting.'\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\trole: 'user',\n\t\t\t\t\t\tcontent: prompt\n\t\t\t\t\t}\n\t\t\t\t],\n\t\t\t\tmax_tokens: 200,\n\t\t\t\ttemperature: 0.3,\n\t\t\t\tstop: ['\n\n', '```']\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t'Authorization': `Bearer ${apiKey}`,\n\t\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\ttimeout: 10000 // 10 second timeout\n\t\t\t}\n\t\t)\n\n\t\tconst suggestion = response.data.choices[0]?.message?.content?.trim()\n\t\tif (!suggestion) {\n\t\t\treturn null\n\t\t}\n\n\t\t// Clean up the suggestion - remove any markdown code blocks if present\n\t\tlet cleanedSuggestion = suggestion\n\t\t\t.replace(/^```[\w]*\n?/g, '')\n\t\t\t.replace(/\n?```$/g, '')\n\t\t\t.trim()\n\n\t\treturn cleanedSuggestion\n\t} catch (error) {\n\t\tif (axios.isAxiosError(error)) {\n\t\t\tlogToOutput(`OpenAI API error: ${error.response?.status} - ${error.response?.statusText}`, 'error')\n\t\t\tif (error.response?.status === 401) {\n\t\t\t\tlogToOutput('Invalid API key. Please check your OPENAI_API_KEY environment variable.', 'error')\n\t\t\t}\n\t\t} else {\n\t\t\tlogToOutput(`Error getting code suggestion: ${error}`, 'error')\n\t\t}\n\t\treturn null\n\t}\n}\n\n/**\n * Inline completion provider that uses GPT-5 for code suggestions\n */\nclass TabOutputInlineCompletionProvider implements vscode.InlineCompletionItemProvider {\n\tasync provideInlineCompletionItems(\n\t\tdocument: vscode.TextDocument,\n\t\tposition: vscode.Position,\n\t\tcontext: vscode.InlineCompletionContext,\n\t\ttoken: vscode.CancellationToken\n\t): Promise<vscode.ProviderResult<vscode.InlineCompletionItem[] | vscode.InlineCompletionList>> {\n\t\t// Don't suggest if cancelled\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn []\n\t\t}\n\n\t\t// Get surrounding code context\n\t\tconst codeContext = getCodeContext(document, position)\n\t\tconst languageId = document.languageId\n\t\tconst fileName = document.fileName.split('/').pop() || document.fileName\n\n\t\t// Get suggestion from OpenAI\n\t\tconst suggestion = await getCodeSuggestion(codeContext, languageId, fileName)\n\t\t\n\t\tif (!suggestion || token.isCancellationRequested) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst item = new vscode.InlineCompletionItem(suggestion)\n\t\treturn [item]\n\t}\n}\n\n/**\n * Command to insert the suggested code at the current cursor position\n * This will trigger the inline completion provider to get a suggestion\n */\nasync function insertTabOutput(): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor\n\tif (!editor) {\n\t\treturn\n\t}\n\n\t// Trigger inline completion which will use our provider to get GPT-5 suggestions\n\tawait vscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n}\n\nexport async function activate(context: vscode.ExtensionContext): Promise<void> {\n\textContext = context\n\toutputChannel.show()\n\tlogToOutput('Activating crowd-code', 'info')\n\n\t// Save anonUserId globally for user to copy\n\tconst userName = process.env.USER || process.env.USERNAME || ""coder"";\n\tconst machineId = vscode.env.machineId ?? null;\n\tconst rawId = `${machineId}:${userName}`;\n\tconst anonUserId = crypto.createHash('sha256').update(rawId).digest('hex') as string;\n\n\textContext.globalState.update('userId', anonUserId);\n\n\t// Register userID display\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.showUserId', () => {\n\t\t\tconst userId = extContext.globalState.get<string>('userId');\n\t\t\tif (!userId) {\n\t\t\t\tvscode.window.showWarningMessage(""User ID not registered yet. Please wait a few seconds until the extension is fully activated."");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvscode.window.showInformationMessage(`Your User ID is: ${userId}`);\n\t\t}))\n\n\n\t// Register Record Files Provider\n\tconst recordFilesProvider = new RecordFilesProvider()\n\tcontext.subscriptions.push(\n\t\tvscode.window.registerTreeDataProvider('recordFiles', recordFilesProvider)\n\t)\n\n\t// Register Actions Provider\n\tactionsProvider = new ActionsProvider()\n\tcontext.subscriptions.push(vscode.window.registerTreeDataProvider('actions', actionsProvider))\n\n\t// Register refresh command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.refreshRecordFiles', () => {\n\t\t\trecordFilesProvider.refresh()\n\t\t})\n\t)\n\n\t// Register delete command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(\n\t\t\t'crowd-code.deleteRecordFile',\n\t\t\tasync (item: RecordFile) => {\n\t\t\t\tconst exportPath = getExportPath()\n\t\t\t\tif (!exportPath) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst result = await vscode.window.showWarningMessage(\n\t\t\t\t\t`Are you sure you want to delete ${item.label}?`,\n\t\t\t\t\t'Yes',\n\t\t\t\t\t'No'\n\t\t\t\t)\n\n\t\t\t\tif (result === 'Yes') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst itemPath = getFullPath(item, exportPath)\n\t\t\t\t\t\tawait deleteFileOrFolder(itemPath)\n\t\t\t\t\t\trecordFilesProvider.refresh()\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tvscode.window.showErrorMessage(`Error deleting ${item.label}: ${err}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t)\n\n\t// Register reveal in explorer command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.revealInExplorer', (item: RecordFile) => {\n\t\t\tconst exportPath = getExportPath()\n\t\t\tif (!exportPath) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst itemPath = getFullPath(item, exportPath)\n\t\t\tvscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(itemPath))\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.startRecording, () => {\n\t\t\tstartRecording()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.stopRecording, () => {\n\t\t\tstopRecording()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.panicButton, () => {\n\t\t\tpanicButton()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.openSettings, () => {\n\t\t\tvscode.commands.executeCommand(\n\t\t\t\t'workbench.action.openSettings',\n\t\t\t\t'@ext:MattiaConsiglio.crowd-code'\n\t\t\t)\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.addToGitignore', async () => {\n\t\t\tawait addToGitignore()\n\t\t})\n\t)\n\n\t// Register consent management command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.consent', async () => {\n\t\t\tawait showConsentChangeDialog()\n\t\t})\n\t)\n\n\t// Register tab output inline completion provider\n\tconst tabOutputInlineCompletionProvider = new TabOutputInlineCompletionProvider()\n\tcontext.subscriptions.push(\n\t\tvscode.languages.registerInlineCompletionItemProvider('*', tabOutputInlineCompletionProvider)\n\t)\n\n\t// Register insert tab output command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.insertTabOutput', insertTabOutput)\n\t)\n\n\t// Trigger inline completions continuously when cursor position changes\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeTextEditorSelection(() => {\n\t\t\tconst editor = vscode.window.activeTextEditor\n\t\t\tif (editor) {\n\t\t\t\t// Trigger inline completion suggestions\n\t\t\t\tvscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n\t\t\t}\n\t\t})\n\t)\n\n\t// Also trigger on document changes to keep suggestions visible\n\tcontext.subscriptions.push(\n\t\tvscode.workspace.onDidChangeTextDocument(() => {\n\t\t\tconst editor = vscode.window.activeTextEditor\n\t\t\tif (editor) {\n\t\t\t\tvscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n\t\t\t}\n\t\t})\n\t)\n\n\n\tcontext.subscriptions.push(vscode.workspace.onDidChangeConfiguration(onConfigurationChange))\n\n\tvscode.window.onDidChangeActiveTextEditor(editor => {\n\t\tupdateStatusBarItem()\n\t\tif (editor && recording.isRecording) {\n\t\t\tif (isCurrentFileExported()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst currentFileUri = editor.document.uri.toString()\n\t\t\tlet tabEventText = ''\n\n\t\t\tif (recording.activatedFiles) {\n\t\t\t\tif (!recording.activatedFiles.has(currentFileUri)) {\n\t\t\t\t\ttabEventText = editor.document.getText()\n\t\t\t\t\trecording.activatedFiles.add(currentFileUri)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error(""Warning: recording.activatedFiles was not available during TAB event logging."")\n\t\t\t}\n\n\t\t\trecording.sequence++\n\t\t\taddToFileQueue(\n\t\t\t\tbuildCsvRow({\n\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\trangeLength: 0,\n\t\t\t\t\ttext: tabEventText,\n\t\t\t\t\ttype: ChangeType.TAB,\n\t\t\t\t})\n\t\t\t)\n\t\t\tappendToFile()\n\t\t\tactionsProvider.setCurrentFile(editor.document.fileName)\n\t\t}\n\t})\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeTextEditorSelection(event => {\n\t\t\tif (recording.isRecording && event.textEditor === vscode.window.activeTextEditor) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst editor = event.textEditor\n\t\t\t\t// For simplicity, we'll log the primary selection.\n\t\t\t\tconst selection = event.selections[0]\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst selectedText = editor.document.getText(selection)\n\t\t\t\tlet changeType: string\n\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Keyboard:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_KEYBOARD\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Mouse:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_MOUSE\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Command:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_COMMAND\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new TypeError(""Unknown selection change kind."")\n\t\t\t\t}\n\n\t\t\t\trecording.sequence++\n\t\t\t\tconst csvRowParams: CSVRowBuilder = {\n\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\trangeOffset: editor.document.offsetAt(selection.start),\n\t\t\t\t\trangeLength: editor.document.offsetAt(selection.end) - editor.document.offsetAt(selection.start),\n\t\t\t\t\ttext: selectedText,\n\t\t\t\t\ttype: changeType,\n\t\t\t\t}\n\t\t\t\taddToFileQueue(buildCsvRow(csvRowParams))\n\t\t\t\tappendToFile()\n\t\t\t\tactionsProvider.setCurrentFile(editor.document.fileName)\n\t\t\t}\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeActiveTerminal((terminal: vscode.Terminal | undefined) => {\n\t\t\tif (terminal && recording.isRecording) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trecording.sequence++\n\t\t\t\taddToFileQueue(\n\t\t\t\t\tbuildCsvRow({\n\t\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\t\trangeLength: 0,\n\t\t\t\t\t\ttext: terminal.name,\n\t\t\t\t\t\ttype: ChangeType.TERMINAL_FOCUS,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\tappendToFile()\n\t\t\t\tactionsProvider.setCurrentFile(`Terminal: ${terminal.name}`)\n\t\t\t}\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidStartTerminalShellExecution(async (event: vscode.TerminalShellExecutionStartEvent) => {\n\t\t\tif (recording.isRecording) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst commandLine = event.execution.commandLine.value\n\t\t\t\trecording.sequence++\n\t\t\t\taddToFileQueue(\n\t\t\t\t\tbuildCsvRow({\n\t\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\t\trangeLength: 0,\n\t\t\t\t\t\ttext: commandLine,\n\t\t\t\t\t\ttype: ChangeType.TERMINAL_COMMAND,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\tappendToFile()\n\n\t\t\t\tconst stream = event.execution.read()\n\t\t\t\tfor await (const data of stream) {\n\t\t\t\t\trecording.sequence++\n\t\t\t\t\taddToFileQueue(\n\t\t\t\t\t\tbuildCsvRow({ sequence: recording.sequence, rangeOffset: 0, rangeLength: 0, text: data, type: ChangeType.TERMINAL_OUTPUT })\n\t\t\t\t\t)\n\t\t\t\t\tappendToFile()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t)\n\n\tstatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 9000)\n\tupdateStatusBarItem()\n\tcontext.subscriptions.push(statusBarItem)\n\n\t// Ensure consent is obtained when the extension is first activated\n\tawait ensureConsent()\n\n\t// Autostart recording regardless of consent. The consent only gates data upload.\n\tstartRecording().catch(err => logToOutput(`Autostart recording failed unexpectedly: ${err}`, 'error'))\n\n\t// Initialize git provider for branch checkout detection\n\tinitializeGitProvider()\n}\n\nexport function deactivate(): void {\n\tlogToOutput('Deactivating crowd-code', 'info')\n\tif (recording.isRecording) {\n\t\tstopRecording()\n\t}\n\tcleanupGitProvider()\n\tstatusBarItem.dispose()\n}\n",typescript,tab
|
| 3 |
+
2,12259,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"6:51:30 PM [info] Activating crowd-code\n6:51:32 PM [info] Recording started\n6:51:32 PM [info] Initializing git provider using file system watchers...\n6:51:34 PM [info] Retrying git provider initialization...\n6:51:41 PM [info] Git repository found\n6:51:41 PM [info] Git provider initialized successfully\n6:51:41 PM [info] Initial git state: [object Object]\n6:51:42 PM [info] Git repository found\n6:51:42 PM [info] Git provider initialized successfully\n6:51:42 PM [info] Initial git state: [object Object]\n",Log,tab
|
| 4 |
+
3,27067,"src/extension.ts",0,0,"",typescript,tab
|
| 5 |
+
4,132852,"src/extension.ts",3200,0,"",typescript,selection_mouse
|
| 6 |
+
5,133948,"src/extension.ts",3160,0,"",typescript,selection_mouse
|
| 7 |
+
6,134082,"src/extension.ts",3156,6,"apiKey",typescript,selection_mouse
|
| 8 |
+
7,135387,"src/extension.ts",3158,0,"",typescript,selection_mouse
|
| 9 |
+
8,138048,"src/extension.ts",3167,0,"",typescript,selection_mouse
|
| 10 |
+
9,138749,"src/extension.ts",3173,0,"",typescript,selection_mouse
|
| 11 |
+
10,139260,"src/extension.ts",3184,0,"",typescript,selection_mouse
|
| 12 |
+
11,233184,"webpack.config.js",0,0,"const path = require('node:path')\nconst webpack = require('webpack')\n\n//@ts-check\n/** @typedef {import('webpack').Configuration} WebpackConfig **/\n\n/** @type WebpackConfig */\nconst extensionConfig = {\n\ttarget: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/\n\tmode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')\n\n\tentry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/\n\toutput: {\n\t\t// the bundle is stored in the 'out' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/\n\t\tpath: path.resolve(__dirname, 'out'),\n\t\tfilename: 'extension.js',\n\t\tlibraryTarget: 'commonjs2',\n\t},\n\texternals: {\n\t\tvscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/\n\t\t// modules added here also need to be added in the .vscodeignore file\n\t},\n\tresolve: {\n\t\t// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader\n\t\textensions: ['.ts', '.js'],\n\t},\n\tmodule: {\n\t\trules: [\n\t\t\t{\n\t\t\t\ttest: /\.ts$/,\n\t\t\t\texclude: /node_modules/,\n\t\t\t\tuse: [\n\t\t\t\t\t{\n\t\t\t\t\t\tloader: 'ts-loader',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tdevtool: 'nosources-source-map',\n\tinfrastructureLogging: {\n\t\tlevel: 'log', // enables logging required for problem matchers\n\t},\n\tplugins: [\n new webpack.DefinePlugin({\n 'process.env.CROWD_CODE_API_GATEWAY_URL': JSON.stringify(process.env.CROWD_CODE_API_GATEWAY_URL)\n })\n ]\n\n}\nmodule.exports = [extensionConfig]\n",javascript,tab
|
| 13 |
+
12,233202,"webpack.config.js",1581,5,"CROWD",javascript,selection_command
|
| 14 |
+
13,258054,"src/recording.ts",0,0,"import * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport * as vscode from 'vscode'\nimport * as readline from 'node:readline'\nimport axios from 'axios'\nimport { hasConsent, showConsentChangeDialog } from './consent'\nimport {\n getEditorFileName,\n escapeString,\n getEditorLanguage,\n notificationWithProgress,\n generateBaseFilePath,\n formatDisplayTime,\n getExportPath,\n logToOutput,\n formatSrtTime,\n getConfig,\n removeDoubleQuotes,\n unescapeString,\n addToGitignore,\n} from './utilities'\nimport { type File, ChangeType, type CSVRowBuilder, type Change, type Recording, type ConsentStatus } from './types'\nimport { extContext, statusBarItem, actionsProvider } from './extension'\n\nexport const commands = {\n openSettings: 'crowd-code.openSettings',\n startRecording: 'crowd-code.startRecording',\n stopRecording: 'crowd-code.stopRecording',\n panicButton: 'crowd-code.panicButton',\n}\n\nexport const recording: Recording = {\n isRecording: false,\n timer: 0,\n startDateTime: null,\n endDateTime: null,\n sequence: 0,\n customFolderName: '',\n activatedFiles: new Set<string>(),\n}\n\nlet intervalId: NodeJS.Timeout\nconst fileQueue: File[] = []\nlet isAppending = false\n\nlet uploadIntervalId: NodeJS.Timeout;\nconst sessionUuid = vscode.env.sessionId;\n\nlet panicStatusBarItem: vscode.StatusBarItem | undefined;\nlet panicButtonPressCount = 0;\nlet panicButtonTimeoutId: NodeJS.Timeout | undefined;\nlet accumulatedRemovedContent: Array<{content: string, sequence: number}> = []; // Store content with sequence numbers\n\nconst CROWD_CODE_API_GATEWAY_URL = process.env.CROWD_CODE_API_GATEWAY_URL;\n\nconst PANIC_BUTTON_TIMEOUT = 3000; // 3 seconds timeout for successive presses\n\n/**\n * Builds a CSV row with the given parameters.\n *\n * @param {CSVRowBuilder} sequence - The sequence number of the change.\n * @param {CSVRowBuilder} rangeOffset - The offset of the changed range.\n * @param {CSVRowBuilder} rangeLength - The length of the changed range.\n * @param {CSVRowBuilder} text - The text of the change.\n * @param {string} type - The type of the change (optional, defaults to 'content').\n * @return {string} A CSV row string with the provided information.\n */\nexport function buildCsvRow({\n sequence,\n rangeOffset,\n rangeLength,\n text,\n type = ChangeType.CONTENT,\n}: CSVRowBuilder): string | undefined {\n if (!recording.startDateTime) {\n return\n }\n\n const time = new Date().getTime() - recording.startDateTime.getTime()\n\n if (type === ChangeType.HEADING) {\n return 'Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type\n'\n }\n\n if (type === ChangeType.TERMINAL_FOCUS || type === ChangeType.TERMINAL_COMMAND || type === ChangeType.TERMINAL_OUTPUT) {\n return `${sequence},${time},""TERMINAL"",${rangeOffset},${rangeLength},""${escapeString(text)}"",,${type}\n`\n }\n\n const editorFileName = getEditorFileName()\n return `${sequence},${time},""${editorFileName}"",${rangeOffset},${rangeLength},""${escapeString(text)}"",${getEditorLanguage()},${type}\n`\n}\n\n/**\n * Checks if the current file being edited is within the configured export path.\n * This is used to determine if the current file should be recorded or not.\n *\n * @returns {boolean} `true` if the current file is within the export path, `false` otherwise.\n */\nexport function isCurrentFileExported(): boolean {\n const editor = vscode.window.activeTextEditor\n const filename = editor?.document.fileName.replaceAll('\\', '/')\n const exportPath = getExportPath()\n if (!editor || !filename || !exportPath) {\n return false\n }\n return filename.startsWith(exportPath)\n}\n\nconst onChangeSubscription = vscode.workspace.onDidChangeTextDocument(event => {\n if (!recording.isRecording) {\n return\n }\n\n if (isCurrentFileExported()) {\n return\n }\n const editor = vscode.window.activeTextEditor\n if (editor && event.document === editor.document) {\n for (const change of event.contentChanges) {\n recording.sequence++\n addToFileQueue(\n buildCsvRow({\n sequence: recording.sequence,\n rangeOffset: change.rangeOffset,\n rangeLength: change.rangeLength,\n text: change.text,\n })\n )\n appendToFile()\n }\n }\n})\n\n/**\n * Creates the recording folder if it doesn't exist.\n * @param folderPath - The path to the recording folder.\n */\nfunction createRecordingFolder(folderPath: string): void {\n if (!fs.existsSync(folderPath)) {\n fs.mkdirSync(folderPath, { recursive: true })\n }\n}\n\n/**\n * Starts the recording process and initializes necessary variables.\n */\nexport async function startRecording(): Promise<void> {\n if (recording.isRecording) {\n notificationWithProgress('Already recording')\n logToOutput('Already recording', 'info')\n return\n }\n const exportPath = getExportPath()\n if (!exportPath) {\n return\n }\n\n // If the setting is enabled and the path is inside the workspace, add it to .gitignore\n if (\n getConfig().get<boolean>('export.addToGitignore') &&\n getConfig().get<string>('export.exportPath')?.startsWith('${workspaceFolder}')\n ) {\n await addToGitignore()\n }\n\n recording.startDateTime = new Date()\n recording.activatedFiles = new Set<string>()\n\n // Ask for folder name if enabled in settings\n let customFolderName: string | undefined\n if (getConfig().get('recording.askFolderName')) {\n customFolderName = await vscode.window.showInputBox({\n prompt: 'Enter a name for the recording folder',\n placeHolder: 'Enter recording folder name',\n })\n if (!customFolderName) {\n stopRecording(true)\n return\n }\n recording.customFolderName = customFolderName\n }\n\n const baseFilePath = generateBaseFilePath(recording.startDateTime, false, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n stopRecording(true)\n return\n }\n\n // Create the recording folder\n const folderPath = path.dirname(path.join(exportPath, baseFilePath))\n createRecordingFolder(folderPath)\n\n recording.isRecording = true\n recording.timer = 0\n recording.endDateTime = null\n recording.sequence = 0\n panicButtonPressCount = 0 // Reset panic button counter for new recording\n accumulatedRemovedContent = [] // Clear accumulated content for new recording\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n panicButtonTimeoutId = undefined\n }\n intervalId = setInterval(() => {\n recording.timer++\n updateStatusBarItem()\n }, 1000)\n notificationWithProgress('Recording started')\n logToOutput('Recording started', 'info')\n\n // Only log initial editor content if there's an active text editor\n const editorText = vscode.window.activeTextEditor?.document.getText()\n const activeEditorUri = vscode.window.activeTextEditor?.document.uri.toString()\n\n if (editorText !== undefined && activeEditorUri) {\n recording.sequence++\n const csvRow = {\n sequence: recording.sequence,\n rangeOffset: 0,\n rangeLength: 0,\n text: editorText,\n type: ChangeType.TAB,\n }\n addToFileQueue(buildCsvRow({ ...csvRow, type: ChangeType.HEADING }))\n addToFileQueue(buildCsvRow(csvRow))\n appendToFile()\n recording.activatedFiles.add(activeEditorUri)\n actionsProvider.setCurrentFile(vscode.window.activeTextEditor?.document.fileName || '')\n } else {\n // If no active editor, just add the header row\n recording.sequence++\n addToFileQueue(buildCsvRow({ \n sequence: recording.sequence,\n rangeOffset: 0,\n rangeLength: 0,\n text: '',\n type: ChangeType.HEADING \n }))\n appendToFile()\n }\n\n extContext.subscriptions.push(onChangeSubscription)\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(true)\n\n // Set up a timer to send data to the Lambda endpoint periodically\n uploadIntervalId = setInterval(async () => {\n if (!exportPath) {\n return;\n }\n \n if (typeof CROWD_CODE_API_GATEWAY_URL !== 'string' || !CROWD_CODE_API_GATEWAY_URL.trim()) {\n logToOutput(""CROWD_CODE_API_GATEWAY_URL must be a non-empty string. Please check your build configuration."", 'error');\n return;\n }\n\n // Only upload data if user has given consent\n if (!hasConsent()) {\n return;\n }\n\n const filePath = path.join(exportPath, `${baseFilePath}.csv`);\n const extensionVersion = extContext.extension.packageJSON.version as string;\n const userId = extContext.globalState.get<string>('userId');\n\n try {\n const fileContent = await fs.promises.readFile(filePath, 'utf-8');\n\n if (fileContent) {\n const payload = {\n fileName: `${baseFilePath}.csv`,\n content: fileContent,\n version: extensionVersion,\n userId: userId\n };\n await axios.post(CROWD_CODE_API_GATEWAY_URL, payload);\n console.log(`Successfully sent ${payload.fileName} to Lambda endpoint.`);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n console.warn(`File not found at ${filePath}. It might be created on first write.`);\n } else {\n console.error(`Error sending data to Lambda: ${error.message}`);\n if (axios.isAxiosError(error) && error.response) {\n console.error(""Lambda response status:"", error.response.status);\n console.error(""Lambda response data:"", error.response.data);\n }\n }\n }\n }, 5 * 60 * 1000); // 5 minutes\n}\n\n/**\n * Stops the recording process and finalizes the recording data.\n * @param context - The extension context.\n */\nexport function stopRecording(force = false): Promise<void> | void {\n if (!recording.isRecording) {\n notificationWithProgress('Not recording')\n return\n }\n\n recording.isRecording = false\n clearInterval(intervalId)\n clearInterval(uploadIntervalId); // Clear the upload timer\n recording.timer = 0\n recording.activatedFiles?.clear()\n panicButtonPressCount = 0 // Reset panic button counter when recording stops\n accumulatedRemovedContent = [] // Clear accumulated content when recording stops\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n panicButtonTimeoutId = undefined\n }\n const index = extContext.subscriptions.indexOf(onChangeSubscription)\n if (index !== -1) {\n extContext.subscriptions.splice(index, 1)\n }\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(false)\n if (force) {\n notificationWithProgress('Recording cancelled')\n logToOutput('Recording cancelled', 'info')\n recording.customFolderName = undefined\n return\n }\n notificationWithProgress('Recording finished')\n logToOutput('Recording finished', 'info')\n recording.endDateTime = new Date()\n return processCsvFile().then(() => {\n // Reset customFolderName after processing is complete\n recording.customFolderName = undefined\n }).catch(err => {\n logToOutput(`Error processing CSV file during stop: ${String(err)}`, 'error')\n recording.customFolderName = undefined\n });\n}\n\n/**\n * Appends data from the file queue to the appropriate file in the workspace.\n */\nexport async function appendToFile(): Promise<void> {\n if (isAppending) {\n return\n }\n isAppending = true\n\n const exportPath = getExportPath()\n if (!exportPath) {\n logToOutput('Export path not available in appendToFile, stopping recording.', 'error')\n stopRecording(true)\n isAppending = false\n return\n }\n\n while (fileQueue.length > 0) {\n const itemToAppend = fileQueue.shift()\n if (!itemToAppend) {\n continue\n }\n\n const filePath = path.join(exportPath, itemToAppend.name)\n\n try {\n const directory = path.dirname(filePath)\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory, { recursive: true })\n }\n await fs.promises.appendFile(filePath, itemToAppend.content)\n } catch (err) {\n logToOutput(\n `Failed to append to file ${filePath}: ${err}. Item dropped. Content: ${itemToAppend.content.substring(0, 100)}...`,\n 'error'\n )\n }\n }\n isAppending = false\n}\n\n/**\n * Appends an SRT line to the file queue for the previous change.\n *\n * This function is responsible for generating the SRT format line for the previous change and adding it to the file queue.\n * It checks if the SRT export format is enabled, and if so, it generates the SRT line for the previous change and adds it to the file queue.\n *\n * @param processedChanges - An array of processed changes.\n * @param i - The index of the current change in the processedChanges array.\n * @param exportInSrt - A boolean indicating whether the SRT export format is enabled.\n */\nfunction addToSRTFile(processedChanges: Change[], i: number, exportInSrt: boolean) {\n if (!exportInSrt) {\n return\n }\n if (i === 0) {\n return\n }\n addToFileQueue(\n addSrtLine(\n processedChanges[i - 1].sequence,\n processedChanges[i - 1].startTime,\n processedChanges[i - 1].endTime,\n JSON.stringify({\n text: processedChanges[i - 1].text,\n file: processedChanges[i - 1].file,\n language: processedChanges[i - 1].language,\n })\n ),\n 'srt',\n true\n )\n}\n\n/**\n * Returns the new text content based on the change type and the previous change.\n * @param type - The type of the change.\n * @param text - The text of the change.\n * @param previousChange - The previous change.\n * @param rangeOffset - The offset of the range.\n * @param rangeLength - The length of the range.\n */\nfunction getNewTextContent(\n type: string,\n text: string,\n previousChange: Change | null,\n rangeOffset: number,\n rangeLength: number\n): string {\n if (type === ChangeType.TAB) {\n return text\n }\n if (!previousChange) {\n return ''\n }\n return getUpdatedText(previousChange.text, rangeOffset, rangeLength, text)\n}\n\n/**\n * Processes a single CSV line and returns the processed change\n */\nasync function processCSVLine(line: string, previousChange: Change | null): Promise<Change | null> {\n const lineArr = line.split(/,(?=(?:[^""]*""[^""]*"")*[^""]*$)/)\n\n if (Number.isNaN(Number.parseInt(lineArr[0]))) {\n return null\n }\n\n const time = Number.parseInt(lineArr[1])\n const file = removeDoubleQuotes(lineArr[2])\n const rangeOffset = Number.parseInt(lineArr[3])\n const rangeLength = Number.parseInt(lineArr[4])\n const text = unescapeString(removeDoubleQuotes(lineArr[5]))\n const language = lineArr[6]\n const type = lineArr[7]\n\n const newText = getNewTextContent(type, text, previousChange, rangeOffset, rangeLength)\n\n /**\n * Skip exporting changes with the same values to the previous change.\n */\n if (\n previousChange &&\n time === previousChange.startTime &&\n file === previousChange.file &&\n newText === previousChange.text &&\n language === previousChange.language\n ) {\n return null\n }\n\n return {\n sequence: previousChange ? previousChange.sequence + 1 : 1,\n file,\n startTime: time,\n endTime: 0,\n language,\n text: newText,\n }\n}\n\n/**\n * Returns the updated text content based on the previous text, range offset, range length, and new text.\n * @param previousText - The previous text.\n * @param rangeOffset - The offset of the range.\n * @param rangeLength - The length of the range.\n * @param newText - The new text.\n */\nfunction getUpdatedText(\n previousText: string,\n rangeOffset: number,\n rangeLength: number,\n newText: string\n): string {\n const textArray = previousText.split('')\n textArray.splice(rangeOffset, rangeLength, newText)\n return textArray.join('')\n}\n\n/**\n * Processes the CSV file and generates the necessary output files.\n */\nasync function processCsvFile(): Promise<void> {\n if (!validateRecordingState()) {\n return\n }\n\n const exportFormats = getConfig().get<string[]>('export.exportFormats', [])\n if (exportFormats.length === 0) {\n logToOutput('No export formats specified', 'info')\n vscode.window.showWarningMessage('No export formats specified')\n return\n }\n\n const exportPath = getExportPath()\n if (!exportPath) {\n return\n }\n\n if (!recording.startDateTime) {\n return\n }\n\n // Use the same custom folder name for reading the source file\n const baseFilePathSource = generateBaseFilePath(\n recording.startDateTime,\n false,\n recording.customFolderName,\n sessionUuid\n )\n if (!baseFilePathSource) {\n return\n }\n\n const filePath = path.join(exportPath, `${baseFilePathSource}.csv`)\n\n try {\n if (!fs.existsSync(filePath)) {\n throw new Error(`Source file not found: ${filePath}`)\n }\n\n const processedChanges: Change[] = []\n\n const rl = readline.createInterface({\n input: fs.createReadStream(filePath),\n crlfDelay: Number.POSITIVE_INFINITY,\n })\n\n for await (const line of rl) {\n const previousChange = processedChanges[processedChanges.length - 1]\n const change = await processCSVLine(line, previousChange)\n\n if (change) {\n if (previousChange) {\n previousChange.endTime = change.startTime\n if (exportFormats.includes('SRT')) {\n addToSRTFile(processedChanges, processedChanges.length, true)\n }\n }\n processedChanges.push(change)\n }\n }\n\n rl.close();\n\n return finalizeRecording(processedChanges, exportFormats);\n\n } catch (err) {\n vscode.window.showErrorMessage(`Error processing recording: ${err}`)\n logToOutput('Error processing CSV file: ' + String(err), 'error')\n return Promise.resolve(); // Resolve even on error after showing message\n }\n}\n\nfunction validateRecordingState(): boolean {\n if (!vscode.workspace.workspaceFolders) {\n logToOutput(\n 'No workspace folder found. To process the recording is needed a workspace folder',\n 'error'\n )\n return false\n }\n if (!recording.endDateTime || !recording.startDateTime) {\n logToOutput('Recording date time is not properly set', 'error')\n return false\n }\n return true\n}\n\nfunction finalizeRecording(processedChanges: Change[], exportFormats: string[]): Promise<void> {\n const lastChange = processedChanges[processedChanges.length - 1]\n if (lastChange && recording.endDateTime && recording.startDateTime) {\n lastChange.endTime = recording.endDateTime.getTime() - recording.startDateTime.getTime()\n if (exportFormats.includes('SRT')) {\n addToSRTFile(processedChanges, processedChanges.length, true)\n }\n }\n if (exportFormats.includes('JSON')) {\n addToFileQueue(JSON.stringify(processedChanges), 'json', true)\n }\n return appendToFile().then(() => {\n // Refresh the recordFiles view after export is complete\n vscode.commands.executeCommand('crowd-code.refreshRecordFiles')\n })\n}\n\n/**\n * Adds a line to the SRT file format.\n * @param sequence - The sequence number of the change.\n * @param start - The start time of the change.\n * @param end - The end time of the change.\n * @param text - The text of the change.\n * @returns A string representing a line in the SRT file format.\n */\nfunction addSrtLine(sequence: number, start: number, end: number, text: string): string {\n return `${sequence}\n${formatSrtTime(start)} --> ${formatSrtTime(end)}\n${text}\n\n`\n}\n\n/**\n * Adds content to the file queue.\n * @param content - The content to add.\n * @param fileExtension - The file extension (optional, defaults to 'csv').\n */\nexport function addToFileQueue(\n content: string | undefined,\n fileExtension = 'csv',\n isExport = false\n): void {\n if (!content) {\n return\n }\n if (!recording.startDateTime) {\n return\n }\n // Use the same custom name throughout the recording session\n const baseFilePath = generateBaseFilePath(recording.startDateTime, isExport, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n return\n }\n fileQueue.push({\n name: `${baseFilePath}.${fileExtension}`,\n content: content,\n })\n}\n\n/**\n * Updates the status bar item with the current recording status and time.\n */\nexport function updateStatusBarItem(): void {\n if (recording.isRecording) {\n if (getConfig().get('appearance.showTimer') === false) {\n statusBarItem.text = '$(debug-stop)'\n statusBarItem.tooltip = 'Current time: ' + formatDisplayTime(recording.timer)\n }\n if (getConfig().get('appearance.showTimer') === true) {\n statusBarItem.text = '$(debug-stop) ' + formatDisplayTime(recording.timer)\n statusBarItem.tooltip = 'Stop Recording'\n }\n statusBarItem.command = commands.stopRecording\n statusBarItem.show()\n } else {\n const editor = vscode.window.activeTextEditor\n if (!editor) {\n statusBarItem.hide()\n return\n }\n if (getConfig().get('appearance.minimalMode') === true) {\n statusBarItem.text = '$(circle-large-filled)'\n } else {\n statusBarItem.text = '$(circle-large-filled) Start Recording'\n }\n statusBarItem.tooltip = 'Start Recording'\n statusBarItem.command = commands.startRecording\n statusBarItem.show()\n }\n}\n\n/**\n * Creates and updates the panic button status bar item.\n */\nexport function updatePanicButton(): void {\n if (!recording.isRecording) {\n if (panicStatusBarItem) {\n panicStatusBarItem.hide()\n }\n return\n }\n\n // Create panic button if it doesn't exist\n if (!panicStatusBarItem) {\n panicStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 8999) // Position it to the left of the recording button\n extContext.subscriptions.push(panicStatusBarItem)\n }\n\n const secondsToRemove = (panicButtonPressCount + 1) * 10 // Show what the next press will remove\n panicStatusBarItem.text = '$(refresh)'\n panicStatusBarItem.tooltip = `Remove last ${secondsToRemove} seconds of recording (click again within 3 seconds to remove more)`\n panicStatusBarItem.command = commands.panicButton\n panicStatusBarItem.show()\n}\n\n/**\n * Deletes the last N seconds of recording data from the CSV file.\n * This is a ""panic button"" feature that allows users to quickly remove recent sensitive data.\n * Each successive press within 3 seconds removes more time: 10s, 20s, 30s, etc.\n * After 3 seconds of inactivity, the next press will be treated as a fresh press (10s).\n */\nexport async function panicButton(): Promise<void> {\n if (!recording.isRecording) {\n vscode.window.showWarningMessage('No active recording to remove data from')\n logToOutput('No active recording to remove data from', 'info')\n return\n }\n\n if (!recording.startDateTime) {\n vscode.window.showErrorMessage('Recording start time not available')\n logToOutput('Recording start time not available', 'error')\n return\n }\n\n const exportPath = getExportPath()\n if (!exportPath) {\n vscode.window.showErrorMessage('Export path not available')\n logToOutput('Export path not available', 'error')\n return\n }\n\n const baseFilePath = generateBaseFilePath(recording.startDateTime, false, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n vscode.window.showErrorMessage('Could not generate file path')\n logToOutput('Could not generate file path', 'error')\n return\n }\n\n const filePath = path.join(exportPath, `${baseFilePath}.csv`)\n\n try {\n // Check if file exists\n if (!fs.existsSync(filePath)) {\n vscode.window.showWarningMessage('No recording file found to remove data from')\n logToOutput('No recording file found to remove data from', 'info')\n return\n }\n\n // Read the file\n const content = fs.readFileSync(filePath, 'utf-8')\n const lines = content.split('\n')\n \n if (lines.length <= 1) {\n vscode.window.showWarningMessage('Recording file is empty, nothing to remove')\n logToOutput('Recording file is empty, nothing to remove', 'info')\n return\n }\n\n // Calculate how many lines to remove (10 seconds per press)\n const linesToRemove = Math.min((panicButtonPressCount + 1) * 10, lines.length - 1)\n const newLines = lines.slice(0, lines.length - linesToRemove)\n \n // Capture the lines that will be removed for display\n const removedLines = lines.slice(lines.length - linesToRemove)\n\n // Write back to file\n fs.writeFileSync(filePath, newLines.join('\n'))\n\n // Update panic button state\n panicButtonPressCount++\n \n // Set up timeout to reset the counter after 3 seconds of inactivity\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n }\n panicButtonTimeoutId = setTimeout(() => {\n panicButtonPressCount = 0\n accumulatedRemovedContent = [] // Clear accumulated content\n updatePanicButton()\n }, PANIC_BUTTON_TIMEOUT)\n \n updatePanicButton()\n\n const secondsToRemove = panicButtonPressCount * 10\n const actualLinesRemoved = lines.length - newLines.length\n \n // Accumulate removed content and show immediate popup\n if (removedLines.length > 0) {\n const nonEmptyLines = removedLines.filter(line => line.trim())\n if (nonEmptyLines.length > 0) {\n // Create a simple, readable summary of removed content\n const contentSummary = nonEmptyLines.map(line => {\n // Extract just the text content from CSV for cleaner display\n const parts = line.split(',')\n if (parts.length >= 6) {\n const textContent = parts[5].replace(/^""|""$/g, '') // Remove quotes\n // Clean up common escape sequences\n const cleanText = textContent\n .replace(/\\n/g, '\n')\n .replace(/\\t/g, '\t')\n .replace(/\\r/g, '\r')\n return { content: cleanText, sequence: Number.parseInt(parts[0]) }\n }\n return { content: line, sequence: Number.parseInt(line.split(',')[0]) }\n }).filter(item => item.content.trim().length > 0)\n \n // Add to accumulated content\n accumulatedRemovedContent.push(...contentSummary)\n \n // Sort by sequence number to show in original file order\n const sortedContent = accumulatedRemovedContent.sort((a, b) => a.sequence - b.sequence)\n \n // Show immediate popup with accumulated content\n const totalContent = sortedContent.map(item => item.content).join(' ')\n const summaryText = totalContent.length > 100 \n ? totalContent.substring(0, 100) + '...' \n : totalContent\n \n vscode.window.showInformationMessage(\n `Removed content: ""${summaryText}""`,\n 'Dismiss'\n )\n }\n }\n\n } catch (error) {\n const errorMessage = `Error during panic button operation: ${error}`\n vscode.window.showErrorMessage(errorMessage)\n logToOutput(errorMessage, 'error')\n }\n}",typescript,tab
|
| 15 |
+
14,258198,"src/recording.ts",1584,5,"CROWD",typescript,selection_command
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-9bdc6d3b-3820-4990-8f3f-cef4842cb4f61760990306149-2025_10_20-21.58.54.493/source.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
2,4614,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"9:58:53 PM [info] Activating crowd-code\n9:58:54 PM [info] Recording started\n9:58:54 PM [info] Initializing git provider using file system watchers...\n9:58:54 PM [info] No workspace folder found\n",Log,tab
|
| 3 |
+
3,4783,"extension-output-pdoom-org.crowd-code-#1-crowd-code",194,0,"9:58:56 PM [info] Retrying git provider initialization...\n9:58:56 PM [info] No workspace folder found\n",Log,content
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-b22af988-ea61-4eb2-8393-c9d41986ca8e1763822605955-2025_11_22-15.43.56.451/source.csv
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
1,104,"index.html",0,0,"<!DOCTYPE html PUBLIC ""-//W3C//DTD HTML 3.2//EN"">\n<html>\n<head>\n<title>Mihir Mahajan</title>\n\n<style>\n body {\n margin: 0;\n padding: 0;\n font-family: monospace;\n font-size: 15px; /* Increase the base font size */\n }\n .container {\n display: flex;\n padding-top: 5%;\n padding-left: 12%;\n padding-right: 12%;\n flex-direction: row; /* Explicitly set for desktop */\n }\n .content {\n flex: 1;\n }\n .image-container {\n width: 200px; /* Increase the width of the image container */\n margin-left: 20px;\n }\n img {\n max-width: 100%;\n height: auto;\n transition: opacity 0.3s ease;\n }\n a {\n color: rgb(8, 119, 166); /* Change the color of URLs to pink */\n }\n \n /* Mobile responsive styles */\n @media (max-width: 768px) {\n .container {\n flex-direction: column;\n padding-left: 5%;\n padding-right: 5%;\n padding-top: 3%;\n }\n .image-container {\n width: 150px;\n margin-left: 0;\n margin-top: 20px;\n align-self: center;\n }\n body {\n font-size: 14px;\n }\n }\n \n /* For very small screens */\n @media (max-width: 480px) {\n .container {\n padding-left: 3%;\n padding-right: 3%;\n }\n .image-container {\n width: 120px;\n }\n body {\n font-size: 13px;\n }\n }\n</style>\n\n\n</head>\n<body>\n<div class=""container"">\n <div class=""content"">\n <h1>Mihir Mahajan</h1>\n <p>\n hi i am mihir,\n <br/>\n co-founder and researcher at <a href=""https://pdoom.org"">p(doom)</a>. \n </p>\n <p>\n i have [\n <a href=""https://github.com/maharajamihir"">github</a>\n <a href=""https://www.linkedin.com/in/mahajanmihir"">linkedin</a>\n <a href=""https://twitter.com/maharajamihir"">twitter</a>\n <a href=""https://scholar.google.com/citations?user=2b0Nf4IAAAAJ"">scholar</a>\n <a href=""mailto:mihir.mahajan2002@gmail.com"">email</a>\n ]\n </p>\n <h2>highlights</h2>\n <p>\n [2025] built scalable world modeling codebase: <a href=""https://github.com/p-doom/jasmine"">code</a> \n <a href=""./coming_soon.html"">paper</a>\n <a href=""./coming_soon.html"">dataset</a> \n <a href=""https://x.com/prob_doom/status/1952878793107947781"">tweet</a> \n <a href=""https://pdoom.org/jasmine.html"">blog</a> \n <a href=""https://www.cit.tum.de/en/cit/news/article/codebase-video-action-model/"">article</a>\n </p>\n <p>\n [2025] released <a href=""https://pdoom.org/crowd_code.html"">crowd-code</a>, a vs-code/cursor extension to crowd-source a SWE dataset\n </p>\n <p>\n [2024] went through <a href=""https://www.joinef.com/posts/introducing-def-acc-at-ef/"">def/acc</a>\n </p>\n <p>\n [2024] published my bachelor thesis at ECCV 2024:\n <a href=""https://maharajamihir.github.io/MeshFeat"">project page</a> \n <a href=""https://arxiv.org/abs/2407.13592"">pdf</a> \n <a href=""https://github.com/maharajamihir/MeshFeat/"">code</a> \n <a href=""https://x.com/maharajamihir/status/1811530075784826910"">tldr</a>\n <a href=""https://www.cit.tum.de/en/cit/news/article/codebase-video-action-model/"">article</a>\n </p>\n <p>\n [2024] graduated from technical university of munich with a bachelors in cs\n </p>\n <p>\n [2023] released a public demo during my internship at aws:\n <a href=""https://github.com/aws-samples/amazon-sagemaker-generativeai/tree/main/6_use_cases/usecases/text_to_sql"">notebook</a>\n </p>\n <p>\n [2023] our thoughts on the adaptive compute transformer:\n <a href=""https://pdoom.org/act.html"">blog</a>\n </p>\n <p>\n [2023] co-created <a href=""https://pdoom.org/"">p(doom)</a>\n </p>\n <p>\n [2022] seminar paper on matching markets:\n <a href=""https://home.in.tum.de/~mahajanm/MatchingMarkets.pdf"">pdf</a>\n </p>\n </div>\n <div class=""image-container"">\n <img src=""image.jpg"" alt=""Mihir Mahajan"">\n </div>\n</div>\n</body>\n</html>",html,tab
|
| 3 |
+
2,3714,"index.html",301,0,"",html,selection_mouse
|
| 4 |
+
3,4997,"index.html",595,0,"",html,selection_mouse
|
| 5 |
+
4,6168,"tasks",0,0,"",Log,tab
|
| 6 |
+
5,6193,"index.html",0,0,"",html,tab
|
| 7 |
+
6,6748,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"3:43:52 PM [info] Activating crowd-code\n3:43:56 PM [info] Recording started\n3:43:56 PM [info] Initializing git provider using file system watchers...\n3:43:58 PM [info] Retrying git provider initialization...\n3:44:01 PM [info] Git repository found\n3:44:01 PM [info] Git provider initialized successfully\n3:44:01 PM [info] Initial git state: [object Object]\n3:44:01 PM [info] Git repository found\n3:44:01 PM [info] Git provider initialized successfully\n3:44:02 PM [info] Initial git state: [object Object]\n",Log,tab
|
| 8 |
+
7,9500,"index.html",0,0,"",html,tab
|
| 9 |
+
8,9787,"TERMINAL",0,0,"",,terminal_focus
|
| 10 |
+
9,17306,"index.html",658,0,"",html,selection_mouse
|
| 11 |
+
10,17410,"index.html",658,1,"/",html,selection_mouse
|
| 12 |
+
11,17473,"index.html",658,5,"/* Ch",html,selection_mouse
|
| 13 |
+
12,17591,"index.html",658,7,"/* Chan",html,selection_mouse
|
| 14 |
+
13,17845,"index.html",658,8,"/* Chang",html,selection_mouse
|
| 15 |
+
14,17850,"index.html",658,9,"/* Change",html,selection_mouse
|
| 16 |
+
15,17860,"index.html",658,10,"/* Change ",html,selection_mouse
|
| 17 |
+
16,17997,"index.html",658,11,"/* Change t",html,selection_mouse
|
| 18 |
+
17,18362,"index.html",658,12,"/* Change th",html,selection_mouse
|
| 19 |
+
18,18569,"index.html",658,13,"/* Change the",html,selection_mouse
|
| 20 |
+
19,18570,"index.html",658,15,"/* Change the c",html,selection_mouse
|
| 21 |
+
20,18570,"index.html",658,16,"/* Change the co",html,selection_mouse
|
| 22 |
+
21,18621,"index.html",658,17,"/* Change the col",html,selection_mouse
|
| 23 |
+
22,18622,"index.html",658,19,"/* Change the color",html,selection_mouse
|
| 24 |
+
23,18632,"index.html",658,23,"/* Change the color of ",html,selection_mouse
|
| 25 |
+
24,18633,"index.html",658,24,"/* Change the color of U",html,selection_mouse
|
| 26 |
+
25,18634,"index.html",658,30,"/* Change the color of URLs to",html,selection_mouse
|
| 27 |
+
26,18634,"index.html",658,32,"/* Change the color of URLs to p",html,selection_mouse
|
| 28 |
+
27,18634,"index.html",658,33,"/* Change the color of URLs to pi",html,selection_mouse
|
| 29 |
+
28,18636,"index.html",658,34,"/* Change the color of URLs to pin",html,selection_mouse
|
| 30 |
+
29,18639,"index.html",658,35,"/* Change the color of URLs to pink",html,selection_mouse
|
| 31 |
+
30,18766,"index.html",658,36,"/* Change the color of URLs to pink ",html,selection_mouse
|
| 32 |
+
31,18810,"index.html",658,37,"/* Change the color of URLs to pink *",html,selection_mouse
|
| 33 |
+
32,18859,"index.html",658,38,"/* Change the color of URLs to pink */",html,selection_mouse
|
| 34 |
+
33,19782,"index.html",658,38,"",html,content
|
| 35 |
+
34,19962,"index.html",657,0,"",html,selection_command
|
| 36 |
+
35,26804,"TERMINAL",0,0,"git status",,terminal_command
|
| 37 |
+
36,26856,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 38 |
+
37,26868,"TERMINAL",0,0,"On branch main\r\nYour branch is up to date with 'origin/main'.\r\n\r\nChanges not staged for commit:\r\n (use ""git add <file>..."" to update what will be committed)\r\n (use ""git restore <file>..."" to discard changes in working directory)\r\n\t[31mmodified: index.html[m\r\n\r\nUntracked files:\r\n (use ""git add <file>..."" to include in what will be committed)\r\n\t[31m_image.jpg[m\r\n\r\nno changes added to commit (use ""git add"" and/or ""git commit -a"")\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 39 |
+
38,74221,"index.html",2006,0,"",html,selection_mouse
|
| 40 |
+
39,75119,"index.html",2005,1,"",html,content
|
| 41 |
+
40,75210,"index.html",2004,1,"",html,content
|
| 42 |
+
41,75335,"index.html",2003,1,"",html,content
|
| 43 |
+
42,75643,"index.html",2002,1,"",html,content
|
| 44 |
+
43,75681,"index.html",2001,1,"",html,content
|
| 45 |
+
44,75765,"index.html",2000,1,"",html,content
|
| 46 |
+
45,75879,"index.html",1999,1,"",html,content
|
| 47 |
+
46,76032,"index.html",1998,1,"",html,content
|
| 48 |
+
47,76311,"index.html",1997,1,"",html,content
|
| 49 |
+
48,76518,"index.html",1996,1,"",html,content
|
| 50 |
+
49,76762,"index.html",1995,1,"",html,content
|
| 51 |
+
50,76781,"index.html",1994,1,"",html,content
|
| 52 |
+
51,76897,"index.html",1993,1,"",html,content
|
| 53 |
+
52,77051,"index.html",1992,1,"",html,content
|
| 54 |
+
53,77193,"index.html",1991,1,"",html,content
|
| 55 |
+
54,77342,"index.html",1990,1,"",html,content
|
| 56 |
+
55,77502,"index.html",1989,1,"",html,content
|
| 57 |
+
56,78053,"index.html",1988,1,"",html,content
|
| 58 |
+
57,78188,"index.html",1988,0,"https://arxiv.org/abs/2510.27002",html,content
|
| 59 |
+
58,78205,"index.html",2020,0,"",html,selection_keyboard
|
| 60 |
+
59,110985,"index.html",2048,0,"",html,selection_mouse
|
| 61 |
+
60,111148,"index.html",2048,11,"coming_soon",html,selection_mouse
|
| 62 |
+
61,111691,"index.html",2048,12,"coming_soon.",html,selection_mouse
|
| 63 |
+
62,111756,"index.html",2048,16,"coming_soon.html",html,selection_mouse
|
| 64 |
+
63,112847,"index.html",2048,16,"",html,content
|
| 65 |
+
64,113266,"index.html",2047,1,"",html,content
|
| 66 |
+
65,113420,"index.html",2046,1,"",html,content
|
| 67 |
+
66,113756,"index.html",2046,0,"https://huggingface.co/collections/p-doom/jasmine",html,content
|
| 68 |
+
67,113770,"index.html",2095,0,"",html,selection_keyboard
|
| 69 |
+
68,114608,"index.html",2358,0,"",html,selection_mouse
|
| 70 |
+
69,120790,"index.html",3077,0,"",html,selection_mouse
|
| 71 |
+
70,121450,"index.html",3069,0,"",html,selection_mouse
|
| 72 |
+
71,121880,"index.html",3077,0,"",html,selection_mouse
|
| 73 |
+
72,123253,"index.html",3167,0,"",html,selection_mouse
|
| 74 |
+
73,123827,"index.html",3175,0,"",html,selection_mouse
|
| 75 |
+
74,124284,"index.html",3157,0,"",html,selection_mouse
|
| 76 |
+
75,124949,"index.html",3167,0,"",html,selection_mouse
|
| 77 |
+
76,125554,"index.html",3175,0,"",html,selection_mouse
|
| 78 |
+
77,126196,"index.html",3167,0,"",html,selection_mouse
|
| 79 |
+
78,349016,"TERMINAL",0,0,"firefox index.html",,terminal_command
|
| 80 |
+
79,349026,"TERMINAL",0,0,"]633;Czsh: command not found: firefox\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 81 |
+
80,352453,"TERMINAL",0,0,"pwd",,terminal_command
|
| 82 |
+
81,352455,"TERMINAL",0,0,"]633;C/Users/mihir/Projects/maharajamihir.github.io\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 83 |
+
82,373814,"TERMINAL",0,0,"git status",,terminal_command
|
| 84 |
+
83,373868,"TERMINAL",0,0,"]633;COn branch main\r\nYour branch is up to date with 'origin/main'.\r\n\r\nChanges not staged for commit:\r\n (use ""git add <file>..."" to update what will be committed)\r\n (use ""git restore <file>..."" to discard changes in working directory)\r\n\t[31mmodified: index.html[m\r\n\r\nUntracked files:\r\n (use ""git add <file>..."" to include in what will be committed)\r\n\t[31m_image.jpg[m\r\n\r\nno changes added to commit (use ""git add"" and/or ""git commit -a"")\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 85 |
+
84,382864,"TERMINAL",0,0,"git commit -am ""added paper and dataset link""",,terminal_command
|
| 86 |
+
85,382916,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 87 |
+
86,382932,"TERMINAL",0,0,"[main 36b38c5] added paper and dataset link\r\n 1 file changed, 3 insertions(+), 3 deletions(-)\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 88 |
+
87,384267,"TERMINAL",0,0,"git push",,terminal_command
|
| 89 |
+
88,384319,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 90 |
+
89,385714,"TERMINAL",0,0,"Enumerating objects: 5, done.\r\nCounting objects: 20% (1/5)\rCounting objects: 40% (2/5)\rCounting objects: 60% (3/5)\rCounting objects: 80% (4/5)\rCounting objects: 100% (5/5)\rCounting objects: 100% (5/5), done.\r\nDelta compression using up to 8 threads\r\nCompressing objects: 33% (1/3)\rCompressing objects: 66% (2/3)\rCompressing objects: 100% (3/3)\rCompressing objects: 100% (3/3), done.\r\nWriting objects: 33% (1/3)\rWriting objects: 66% (2/3)\rWriting objects: 100% (3/3)\rWriting objects: 100% (3/3), 369 bytes | 369.00 KiB/s, done.\r\nTotal 3 (delta 2), reused 0 (delta 0), pack-reused 0\r\n",,terminal_output
|
| 91 |
+
90,385858,"TERMINAL",0,0,"remote: Resolving deltas: 0% (0/2)[K\rremote: Resolving deltas: 50% (1/2)[K\rremote: Resolving deltas: 100% (2/2)[K\rremote: Resolving deltas: 100% (2/2), completed with 2 local objects.[K\r\n",,terminal_output
|
| 92 |
+
91,386188,"TERMINAL",0,0,"To github.com:maharajamihir/maharajamihir.github.io.git\r\n 801ed93..36b38c5 main -> main\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 93 |
+
92,9218258,"index.html",3516,0,"",html,selection_mouse
|
| 94 |
+
93,9219124,"index.html",3508,0,"",html,selection_mouse
|
| 95 |
+
94,9219484,"index.html",3516,0,"",html,selection_mouse
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-c929082a-fbf7-4a6a-8122-e5f08c5e25921762270306238-2025_11_04-16.32.15.383/source.csv
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
2,3582,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"4:32:14 PM [info] Activating crowd-code\n4:32:15 PM [info] Recording started\n4:32:15 PM [info] Initializing git provider using file system watchers...\n4:32:16 PM [info] Git repository found\n4:32:16 PM [info] Git provider initialized successfully\n4:32:17 PM [info] Initial git state: [object Object]\n",Log,tab
|
| 3 |
+
3,5423,"TERMINAL",0,0,"",,terminal_focus
|
| 4 |
+
4,21337,"src/recording.ts",0,0,"import * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport * as vscode from 'vscode'\nimport * as readline from 'node:readline'\nimport axios from 'axios'\nimport { hasConsent, showConsentChangeDialog } from './consent'\nimport {\n getEditorFileName,\n escapeString,\n getEditorLanguage,\n notificationWithProgress,\n generateBaseFilePath,\n formatDisplayTime,\n getExportPath,\n logToOutput,\n formatSrtTime,\n getConfig,\n removeDoubleQuotes,\n unescapeString,\n addToGitignore,\n} from './utilities'\nimport { type File, ChangeType, type CSVRowBuilder, type Change, type Recording, type ConsentStatus } from './types'\nimport { extContext, statusBarItem, actionsProvider } from './extension'\n\nexport const commands = {\n openSettings: 'crowd-code.openSettings',\n startRecording: 'crowd-code.startRecording',\n stopRecording: 'crowd-code.stopRecording',\n panicButton: 'crowd-code.panicButton',\n}\n\nexport const recording: Recording = {\n isRecording: false,\n timer: 0,\n startDateTime: null,\n endDateTime: null,\n sequence: 0,\n customFolderName: '',\n activatedFiles: new Set<string>(),\n}\n\nlet intervalId: NodeJS.Timeout\nconst fileQueue: File[] = []\nlet isAppending = false\n\nlet uploadIntervalId: NodeJS.Timeout;\nconst sessionUuid = vscode.env.sessionId;\n\nlet panicStatusBarItem: vscode.StatusBarItem | undefined;\nlet panicButtonPressCount = 0;\nlet panicButtonTimeoutId: NodeJS.Timeout | undefined;\nlet accumulatedRemovedContent: Array<{content: string, sequence: number}> = []; // Store content with sequence numbers\n\nconst CROWD_CODE_API_GATEWAY_URL = process.env.CROWD_CODE_API_GATEWAY_URL;\n\nconst PANIC_BUTTON_TIMEOUT = 3000; // 3 seconds timeout for successive presses\n\n/**\n * Builds a CSV row with the given parameters.\n *\n * @param {CSVRowBuilder} sequence - The sequence number of the change.\n * @param {CSVRowBuilder} rangeOffset - The offset of the changed range.\n * @param {CSVRowBuilder} rangeLength - The length of the changed range.\n * @param {CSVRowBuilder} text - The text of the change.\n * @param {string} type - The type of the change (optional, defaults to 'content').\n * @return {string} A CSV row string with the provided information.\n */\nexport function buildCsvRow({\n sequence,\n rangeOffset,\n rangeLength,\n text,\n type = ChangeType.CONTENT,\n}: CSVRowBuilder): string | undefined {\n if (!recording.startDateTime) {\n return\n }\n\n const time = new Date().getTime() - recording.startDateTime.getTime()\n\n if (type === ChangeType.HEADING) {\n return 'Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type\n'\n }\n\n if (type === ChangeType.TERMINAL_FOCUS || type === ChangeType.TERMINAL_COMMAND || type === ChangeType.TERMINAL_OUTPUT) {\n return `${sequence},${time},""TERMINAL"",${rangeOffset},${rangeLength},""${escapeString(text)}"",,${type}\n`\n }\n\n const editorFileName = getEditorFileName()\n return `${sequence},${time},""${editorFileName}"",${rangeOffset},${rangeLength},""${escapeString(text)}"",${getEditorLanguage()},${type}\n`\n}\n\n/**\n * Checks if the current file being edited is within the configured export path.\n * This is used to determine if the current file should be recorded or not.\n *\n * @returns {boolean} `true` if the current file is within the export path, `false` otherwise.\n */\nexport function isCurrentFileExported(): boolean {\n const editor = vscode.window.activeTextEditor\n const filename = editor?.document.fileName.replaceAll('\\', '/')\n const exportPath = getExportPath()\n if (!editor || !filename || !exportPath) {\n return false\n }\n return filename.startsWith(exportPath)\n}\n\nconst onChangeSubscription = vscode.workspace.onDidChangeTextDocument(event => {\n if (!recording.isRecording) {\n return\n }\n\n if (isCurrentFileExported()) {\n return\n }\n const editor = vscode.window.activeTextEditor\n if (editor && event.document === editor.document) {\n for (const change of event.contentChanges) {\n recording.sequence++\n addToFileQueue(\n buildCsvRow({\n sequence: recording.sequence,\n rangeOffset: change.rangeOffset,\n rangeLength: change.rangeLength,\n text: change.text,\n })\n )\n appendToFile()\n }\n }\n})\n\n/**\n * Creates the recording folder if it doesn't exist.\n * @param folderPath - The path to the recording folder.\n */\nfunction createRecordingFolder(folderPath: string): void {\n if (!fs.existsSync(folderPath)) {\n fs.mkdirSync(folderPath, { recursive: true })\n }\n}\n\n/**\n * Starts the recording process and initializes necessary variables.\n */\nexport async function startRecording(): Promise<void> {\n if (recording.isRecording) {\n notificationWithProgress('Already recording')\n logToOutput('Already recording', 'info')\n return\n }\n const exportPath = getExportPath()\n if (!exportPath) {\n return\n }\n\n // If the setting is enabled and the path is inside the workspace, add it to .gitignore\n if (\n getConfig().get<boolean>('export.addToGitignore') &&\n getConfig().get<string>('export.exportPath')?.startsWith('${workspaceFolder}')\n ) {\n await addToGitignore()\n }\n\n recording.startDateTime = new Date()\n recording.activatedFiles = new Set<string>()\n\n // Ask for folder name if enabled in settings\n let customFolderName: string | undefined\n if (getConfig().get('recording.askFolderName')) {\n customFolderName = await vscode.window.showInputBox({\n prompt: 'Enter a name for the recording folder',\n placeHolder: 'Enter recording folder name',\n })\n if (!customFolderName) {\n stopRecording(true)\n return\n }\n recording.customFolderName = customFolderName\n }\n\n const baseFilePath = generateBaseFilePath(recording.startDateTime, false, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n stopRecording(true)\n return\n }\n\n // Create the recording folder\n const folderPath = path.dirname(path.join(exportPath, baseFilePath))\n createRecordingFolder(folderPath)\n\n recording.isRecording = true\n recording.timer = 0\n recording.endDateTime = null\n recording.sequence = 0\n panicButtonPressCount = 0 // Reset panic button counter for new recording\n accumulatedRemovedContent = [] // Clear accumulated content for new recording\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n panicButtonTimeoutId = undefined\n }\n intervalId = setInterval(() => {\n recording.timer++\n updateStatusBarItem()\n }, 1000)\n notificationWithProgress('Recording started')\n logToOutput('Recording started', 'info')\n\n // Only log initial editor content if there's an active text editor\n const editorText = vscode.window.activeTextEditor?.document.getText()\n const activeEditorUri = vscode.window.activeTextEditor?.document.uri.toString()\n\n if (editorText !== undefined && activeEditorUri) {\n recording.sequence++\n const csvRow = {\n sequence: recording.sequence,\n rangeOffset: 0,\n rangeLength: 0,\n text: editorText,\n type: ChangeType.TAB,\n }\n addToFileQueue(buildCsvRow({ ...csvRow, type: ChangeType.HEADING }))\n addToFileQueue(buildCsvRow(csvRow))\n appendToFile()\n recording.activatedFiles.add(activeEditorUri)\n actionsProvider.setCurrentFile(vscode.window.activeTextEditor?.document.fileName || '')\n } else {\n // If no active editor, just add the header row\n recording.sequence++\n addToFileQueue(buildCsvRow({ \n sequence: recording.sequence,\n rangeOffset: 0,\n rangeLength: 0,\n text: '',\n type: ChangeType.HEADING \n }))\n appendToFile()\n }\n\n extContext.subscriptions.push(onChangeSubscription)\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(true)\n\n // Set up a timer to send data to the Lambda endpoint periodically\n uploadIntervalId = setInterval(async () => {\n if (!exportPath) {\n return;\n }\n \n if (typeof CROWD_CODE_API_GATEWAY_URL !== 'string' || !CROWD_CODE_API_GATEWAY_URL.trim()) {\n logToOutput(""CROWD_CODE_API_GATEWAY_URL must be a non-empty string. Please check your build configuration."", 'error');\n return;\n }\n\n // Only upload data if user has given consent\n if (!hasConsent()) {\n return;\n }\n\n const filePath = path.join(exportPath, `${baseFilePath}.csv`);\n const extensionVersion = extContext.extension.packageJSON.version as string;\n const userId = extContext.globalState.get<string>('userId');\n\n try {\n const fileContent = await fs.promises.readFile(filePath, 'utf-8');\n\n if (fileContent) {\n const payload = {\n fileName: `${baseFilePath}.csv`,\n content: fileContent,\n version: extensionVersion,\n userId: userId\n };\n await axios.post(CROWD_CODE_API_GATEWAY_URL, payload);\n console.log(`Successfully sent ${payload.fileName} to Lambda endpoint.`);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n console.warn(`File not found at ${filePath}. It might be created on first write.`);\n } else {\n console.error(`Error sending data to Lambda: ${error.message}`);\n if (axios.isAxiosError(error) && error.response) {\n console.error(""Lambda response status:"", error.response.status);\n console.error(""Lambda response data:"", error.response.data);\n }\n }\n }\n }, 5 * 60 * 1000); // 5 minutes\n}\n\n/**\n * Stops the recording process and finalizes the recording data.\n * @param context - The extension context.\n */\nexport function stopRecording(force = false): Promise<void> | void {\n if (!recording.isRecording) {\n notificationWithProgress('Not recording')\n return\n }\n\n recording.isRecording = false\n clearInterval(intervalId)\n clearInterval(uploadIntervalId); // Clear the upload timer\n recording.timer = 0\n recording.activatedFiles?.clear()\n panicButtonPressCount = 0 // Reset panic button counter when recording stops\n accumulatedRemovedContent = [] // Clear accumulated content when recording stops\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n panicButtonTimeoutId = undefined\n }\n const index = extContext.subscriptions.indexOf(onChangeSubscription)\n if (index !== -1) {\n extContext.subscriptions.splice(index, 1)\n }\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(false)\n if (force) {\n notificationWithProgress('Recording cancelled')\n logToOutput('Recording cancelled', 'info')\n recording.customFolderName = undefined\n return\n }\n notificationWithProgress('Recording finished')\n logToOutput('Recording finished', 'info')\n recording.endDateTime = new Date()\n return processCsvFile().then(() => {\n // Reset customFolderName after processing is complete\n recording.customFolderName = undefined\n }).catch(err => {\n logToOutput(`Error processing CSV file during stop: ${String(err)}`, 'error')\n recording.customFolderName = undefined\n });\n}\n\n/**\n * Appends data from the file queue to the appropriate file in the workspace.\n */\nexport async function appendToFile(): Promise<void> {\n if (isAppending) {\n return\n }\n isAppending = true\n\n const exportPath = getExportPath()\n if (!exportPath) {\n logToOutput('Export path not available in appendToFile, stopping recording.', 'error')\n stopRecording(true)\n isAppending = false\n return\n }\n\n while (fileQueue.length > 0) {\n const itemToAppend = fileQueue.shift()\n if (!itemToAppend) {\n continue\n }\n\n const filePath = path.join(exportPath, itemToAppend.name)\n\n try {\n const directory = path.dirname(filePath)\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory, { recursive: true })\n }\n await fs.promises.appendFile(filePath, itemToAppend.content)\n } catch (err) {\n logToOutput(\n `Failed to append to file ${filePath}: ${err}. Item dropped. Content: ${itemToAppend.content.substring(0, 100)}...`,\n 'error'\n )\n }\n }\n isAppending = false\n}\n\n/**\n * Appends an SRT line to the file queue for the previous change.\n *\n * This function is responsible for generating the SRT format line for the previous change and adding it to the file queue.\n * It checks if the SRT export format is enabled, and if so, it generates the SRT line for the previous change and adds it to the file queue.\n *\n * @param processedChanges - An array of processed changes.\n * @param i - The index of the current change in the processedChanges array.\n * @param exportInSrt - A boolean indicating whether the SRT export format is enabled.\n */\nfunction addToSRTFile(processedChanges: Change[], i: number, exportInSrt: boolean) {\n if (!exportInSrt) {\n return\n }\n if (i === 0) {\n return\n }\n addToFileQueue(\n addSrtLine(\n processedChanges[i - 1].sequence,\n processedChanges[i - 1].startTime,\n processedChanges[i - 1].endTime,\n JSON.stringify({\n text: processedChanges[i - 1].text,\n file: processedChanges[i - 1].file,\n language: processedChanges[i - 1].language,\n })\n ),\n 'srt',\n true\n )\n}\n\n/**\n * Returns the new text content based on the change type and the previous change.\n * @param type - The type of the change.\n * @param text - The text of the change.\n * @param previousChange - The previous change.\n * @param rangeOffset - The offset of the range.\n * @param rangeLength - The length of the range.\n */\nfunction getNewTextContent(\n type: string,\n text: string,\n previousChange: Change | null,\n rangeOffset: number,\n rangeLength: number\n): string {\n if (type === ChangeType.TAB) {\n return text\n }\n if (!previousChange) {\n return ''\n }\n return getUpdatedText(previousChange.text, rangeOffset, rangeLength, text)\n}\n\n/**\n * Processes a single CSV line and returns the processed change\n */\nasync function processCSVLine(line: string, previousChange: Change | null): Promise<Change | null> {\n const lineArr = line.split(/,(?=(?:[^""]*""[^""]*"")*[^""]*$)/)\n\n if (Number.isNaN(Number.parseInt(lineArr[0]))) {\n return null\n }\n\n const time = Number.parseInt(lineArr[1])\n const file = removeDoubleQuotes(lineArr[2])\n const rangeOffset = Number.parseInt(lineArr[3])\n const rangeLength = Number.parseInt(lineArr[4])\n const text = unescapeString(removeDoubleQuotes(lineArr[5]))\n const language = lineArr[6]\n const type = lineArr[7]\n\n const newText = getNewTextContent(type, text, previousChange, rangeOffset, rangeLength)\n\n /**\n * Skip exporting changes with the same values to the previous change.\n */\n if (\n previousChange &&\n time === previousChange.startTime &&\n file === previousChange.file &&\n newText === previousChange.text &&\n language === previousChange.language\n ) {\n return null\n }\n\n return {\n sequence: previousChange ? previousChange.sequence + 1 : 1,\n file,\n startTime: time,\n endTime: 0,\n language,\n text: newText,\n }\n}\n\n/**\n * Returns the updated text content based on the previous text, range offset, range length, and new text.\n * @param previousText - The previous text.\n * @param rangeOffset - The offset of the range.\n * @param rangeLength - The length of the range.\n * @param newText - The new text.\n */\nfunction getUpdatedText(\n previousText: string,\n rangeOffset: number,\n rangeLength: number,\n newText: string\n): string {\n const textArray = previousText.split('')\n textArray.splice(rangeOffset, rangeLength, newText)\n return textArray.join('')\n}\n\n/**\n * Processes the CSV file and generates the necessary output files.\n */\nasync function processCsvFile(): Promise<void> {\n if (!validateRecordingState()) {\n return\n }\n\n const exportFormats = getConfig().get<string[]>('export.exportFormats', [])\n if (exportFormats.length === 0) {\n logToOutput('No export formats specified', 'info')\n vscode.window.showWarningMessage('No export formats specified')\n return\n }\n\n const exportPath = getExportPath()\n if (!exportPath) {\n return\n }\n\n if (!recording.startDateTime) {\n return\n }\n\n // Use the same custom folder name for reading the source file\n const baseFilePathSource = generateBaseFilePath(\n recording.startDateTime,\n false,\n recording.customFolderName,\n sessionUuid\n )\n if (!baseFilePathSource) {\n return\n }\n\n const filePath = path.join(exportPath, `${baseFilePathSource}.csv`)\n\n try {\n if (!fs.existsSync(filePath)) {\n throw new Error(`Source file not found: ${filePath}`)\n }\n\n const processedChanges: Change[] = []\n\n const rl = readline.createInterface({\n input: fs.createReadStream(filePath),\n crlfDelay: Number.POSITIVE_INFINITY,\n })\n\n for await (const line of rl) {\n const previousChange = processedChanges[processedChanges.length - 1]\n const change = await processCSVLine(line, previousChange)\n\n if (change) {\n if (previousChange) {\n previousChange.endTime = change.startTime\n if (exportFormats.includes('SRT')) {\n addToSRTFile(processedChanges, processedChanges.length, true)\n }\n }\n processedChanges.push(change)\n }\n }\n\n rl.close();\n\n return finalizeRecording(processedChanges, exportFormats);\n\n } catch (err) {\n vscode.window.showErrorMessage(`Error processing recording: ${err}`)\n logToOutput('Error processing CSV file: ' + String(err), 'error')\n return Promise.resolve(); // Resolve even on error after showing message\n }\n}\n\nfunction validateRecordingState(): boolean {\n if (!vscode.workspace.workspaceFolders) {\n logToOutput(\n 'No workspace folder found. To process the recording is needed a workspace folder',\n 'error'\n )\n return false\n }\n if (!recording.endDateTime || !recording.startDateTime) {\n logToOutput('Recording date time is not properly set', 'error')\n return false\n }\n return true\n}\n\nfunction finalizeRecording(processedChanges: Change[], exportFormats: string[]): Promise<void> {\n const lastChange = processedChanges[processedChanges.length - 1]\n if (lastChange && recording.endDateTime && recording.startDateTime) {\n lastChange.endTime = recording.endDateTime.getTime() - recording.startDateTime.getTime()\n if (exportFormats.includes('SRT')) {\n addToSRTFile(processedChanges, processedChanges.length, true)\n }\n }\n if (exportFormats.includes('JSON')) {\n addToFileQueue(JSON.stringify(processedChanges), 'json', true)\n }\n return appendToFile().then(() => {\n // Refresh the recordFiles view after export is complete\n vscode.commands.executeCommand('crowd-code.refreshRecordFiles')\n })\n}\n\n/**\n * Adds a line to the SRT file format.\n * @param sequence - The sequence number of the change.\n * @param start - The start time of the change.\n * @param end - The end time of the change.\n * @param text - The text of the change.\n * @returns A string representing a line in the SRT file format.\n */\nfunction addSrtLine(sequence: number, start: number, end: number, text: string): string {\n return `${sequence}\n${formatSrtTime(start)} --> ${formatSrtTime(end)}\n${text}\n\n`\n}\n\n/**\n * Adds content to the file queue.\n * @param content - The content to add.\n * @param fileExtension - The file extension (optional, defaults to 'csv').\n */\nexport function addToFileQueue(\n content: string | undefined,\n fileExtension = 'csv',\n isExport = false\n): void {\n if (!content) {\n return\n }\n if (!recording.startDateTime) {\n return\n }\n // Use the same custom name throughout the recording session\n const baseFilePath = generateBaseFilePath(recording.startDateTime, isExport, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n return\n }\n fileQueue.push({\n name: `${baseFilePath}.${fileExtension}`,\n content: content,\n })\n}\n\n/**\n * Updates the status bar item with the current recording status and time.\n */\nexport function updateStatusBarItem(): void {\n if (recording.isRecording) {\n if (getConfig().get('appearance.showTimer') === false) {\n statusBarItem.text = '$(debug-stop)'\n statusBarItem.tooltip = 'Current time: ' + formatDisplayTime(recording.timer)\n }\n if (getConfig().get('appearance.showTimer') === true) {\n statusBarItem.text = '$(debug-stop) ' + formatDisplayTime(recording.timer)\n statusBarItem.tooltip = 'Stop Recording'\n }\n statusBarItem.command = commands.stopRecording\n statusBarItem.show()\n } else {\n const editor = vscode.window.activeTextEditor\n if (!editor) {\n statusBarItem.hide()\n return\n }\n if (getConfig().get('appearance.minimalMode') === true) {\n statusBarItem.text = '$(circle-large-filled)'\n } else {\n statusBarItem.text = '$(circle-large-filled) Start Recording'\n }\n statusBarItem.tooltip = 'Start Recording'\n statusBarItem.command = commands.startRecording\n statusBarItem.show()\n }\n}\n\n/**\n * Creates and updates the panic button status bar item.\n */\nexport function updatePanicButton(): void {\n if (!recording.isRecording) {\n if (panicStatusBarItem) {\n panicStatusBarItem.hide()\n }\n return\n }\n\n // Create panic button if it doesn't exist\n if (!panicStatusBarItem) {\n panicStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 8999) // Position it to the left of the recording button\n extContext.subscriptions.push(panicStatusBarItem)\n }\n\n const secondsToRemove = (panicButtonPressCount + 1) * 10 // Show what the next press will remove\n panicStatusBarItem.text = '$(refresh)'\n panicStatusBarItem.tooltip = `Remove last ${secondsToRemove} seconds of recording (click again within 3 seconds to remove more)`\n panicStatusBarItem.command = commands.panicButton\n panicStatusBarItem.show()\n}\n\n/**\n * Deletes the last N seconds of recording data from the CSV file.\n * This is a ""panic button"" feature that allows users to quickly remove recent sensitive data.\n * Each successive press within 3 seconds removes more time: 10s, 20s, 30s, etc.\n * After 3 seconds of inactivity, the next press will be treated as a fresh press (10s).\n */\nexport async function panicButton(): Promise<void> {\n if (!recording.isRecording) {\n vscode.window.showWarningMessage('No active recording to remove data from')\n logToOutput('No active recording to remove data from', 'info')\n return\n }\n\n if (!recording.startDateTime) {\n vscode.window.showErrorMessage('Recording start time not available')\n logToOutput('Recording start time not available', 'error')\n return\n }\n\n const exportPath = getExportPath()\n if (!exportPath) {\n vscode.window.showErrorMessage('Export path not available')\n logToOutput('Export path not available', 'error')\n return\n }\n\n const baseFilePath = generateBaseFilePath(recording.startDateTime, false, recording.customFolderName, sessionUuid)\n if (!baseFilePath) {\n vscode.window.showErrorMessage('Could not generate file path')\n logToOutput('Could not generate file path', 'error')\n return\n }\n\n const filePath = path.join(exportPath, `${baseFilePath}.csv`)\n\n try {\n // Check if file exists\n if (!fs.existsSync(filePath)) {\n vscode.window.showWarningMessage('No recording file found to remove data from')\n logToOutput('No recording file found to remove data from', 'info')\n return\n }\n\n // Read the file\n const content = fs.readFileSync(filePath, 'utf-8')\n const lines = content.split('\n')\n \n if (lines.length <= 1) {\n vscode.window.showWarningMessage('Recording file is empty, nothing to remove')\n logToOutput('Recording file is empty, nothing to remove', 'info')\n return\n }\n\n // Calculate how many lines to remove (10 seconds per press)\n const linesToRemove = Math.min((panicButtonPressCount + 1) * 10, lines.length - 1)\n const newLines = lines.slice(0, lines.length - linesToRemove)\n \n // Capture the lines that will be removed for display\n const removedLines = lines.slice(lines.length - linesToRemove)\n\n // Write back to file\n fs.writeFileSync(filePath, newLines.join('\n'))\n\n // Update panic button state\n panicButtonPressCount++\n \n // Set up timeout to reset the counter after 3 seconds of inactivity\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n }\n panicButtonTimeoutId = setTimeout(() => {\n panicButtonPressCount = 0\n accumulatedRemovedContent = [] // Clear accumulated content\n updatePanicButton()\n }, PANIC_BUTTON_TIMEOUT)\n \n updatePanicButton()\n\n const secondsToRemove = panicButtonPressCount * 10\n const actualLinesRemoved = lines.length - newLines.length\n \n // Accumulate removed content and show immediate popup\n if (removedLines.length > 0) {\n const nonEmptyLines = removedLines.filter(line => line.trim())\n if (nonEmptyLines.length > 0) {\n // Create a simple, readable summary of removed content\n const contentSummary = nonEmptyLines.map(line => {\n // Extract just the text content from CSV for cleaner display\n const parts = line.split(',')\n if (parts.length >= 6) {\n const textContent = parts[5].replace(/^""|""$/g, '') // Remove quotes\n // Clean up common escape sequences\n const cleanText = textContent\n .replace(/\\n/g, '\n')\n .replace(/\\t/g, '\t')\n .replace(/\\r/g, '\r')\n return { content: cleanText, sequence: Number.parseInt(parts[0]) }\n }\n return { content: line, sequence: Number.parseInt(line.split(',')[0]) }\n }).filter(item => item.content.trim().length > 0)\n \n // Add to accumulated content\n accumulatedRemovedContent.push(...contentSummary)\n \n // Sort by sequence number to show in original file order\n const sortedContent = accumulatedRemovedContent.sort((a, b) => a.sequence - b.sequence)\n \n // Show immediate popup with accumulated content\n const totalContent = sortedContent.map(item => item.content).join(' ')\n const summaryText = totalContent.length > 100 \n ? totalContent.substring(0, 100) + '...' \n : totalContent\n \n vscode.window.showInformationMessage(\n `Removed content: ""${summaryText}""`,\n 'Dismiss'\n )\n }\n }\n\n } catch (error) {\n const errorMessage = `Error during panic button operation: ${error}`\n vscode.window.showErrorMessage(errorMessage)\n logToOutput(errorMessage, 'error')\n }\n}",typescript,tab
|
| 5 |
+
5,53868,"src/recording.ts",2581,0,"",typescript,selection_mouse
|
| 6 |
+
6,58378,"README.md",0,0,"# ⚫ crowd-code\n\nTo install the extension, simply follow the instructions at https://github.com/p-doom/crowd-code/releases.\n\nThis extension provides functionality to record IDE actions. Currently supported actions include text insertions, deletions, undo, redo, cursor movement (including VIM motions), file switches, git branch checkouts, terminal invocation and terminal command execution (both input and output). The changes are recorded and stored in CSV files. If you consent to participate in crowd-sourcing VS code actions, the CSV files are uploaded to an S3 bucket. We anonymize and clean the crowd-sourced dataset and periodically share it with the community. If you do not consent, no data will leave your machine, and the CSV files will solely be stored locally.\nThis extension provides functionality to record IDE actions. Currently supported actions include text insertions, deletions, undo, redo, cursor movement (including VIM motions), file switches, git branch checkouts, terminal invocation and terminal command execution (both input and output). The changes are recorded in a CSV file and uploaded to an S3 bucket, which we plan to thoroughly clean, process, and eventually share with the community. \n\nAll uncaptured data is lost data. We want to crowd-source a dense dataset of IDE actions to eventually finetune models on. This would (to the best of our knowledge) constitute the first crowd-sourced dataset of dense IDE actions.\n\nWe thank Mattia Consiglio for his awesome work on the upstream repository, which made our lives infinitely easier.\n\n## 📚 Table of Contents\n\n- [⚫ crowd-code](#-crowd-code)\n - [📚 Table of Contents](#-table-of-contents)\n - [📖 Usage](#-usage)\n - [🔒 Privacy](#-privacy)\n - [📄 Output](#-output)\n - [▶️ Play it back!](#️-play-it-back)\n - [🔧 Extension Settings](#-extension-settings)\n - [⚙️ Requirements](#️-requirements)\n - [🐛 Known Issues](#-known-issues)\n - [🤝 Contributing](#-contributing)\n - [💸 Support me](#-support-me)\n - [📝 Release Notes](#-release-notes)\n\n## 📖 Usage\n\n\n\nAs soon as the extension activates, recording commences automatically. Recording automatically stops upon IDE closure.\nAdditionally, you can control the recording in three ways:\n\n1. Using the status bar (on the right): Click on ""Start recording"" to begin and ""Stop recording"" to end.\n2. Using the VS Code Recorder sidebar: Click on the extension icon in the activity bar to open the sidebar, where you can:\n - Start/Stop the recording\n - View the recording timer\n - See the current file being recorded\n - Manage your recorded files\n - Add the export path to .gitignore\n - Enable/disable participation in crowd-sourcing the dataset\n3. Using the panic button: Click on ""Panic button"" to remove the last few actions from the captured dataset. This is useful to immediately remove sensitive data from the dataset.\n\nThe extension will automatically record changes in your text editor. When you stop the recording, it will finalize the data and save it to a CSV (source), JSON and SRT files.\n\nYou can customize the recording experience with these features:\n\n- Choose the export formats (SRT or JSON or both)\n- Set custom names for recording folders\n- Automatically add the export path to .gitignore\n\nYou can also use the command palette to access the extension's features.\nAvailable commands:\n\n- `crowd-code.startRecording`: Start the recording\n- `crowd-code.stopRecording`: Stop the recording\n- `crowd-code.panicButton`: Remove the last few actions from the dataset\n- `crowd-code.openSettings`: Open the extension settings\n- `crowd-code.consent`: Manage data collection consent\n\n## 🔒 Privacy\n\nWe ask for your consent in participating in crowd-sourcing upon installation of the extension. You can always revoke your participation, after which your recorded data will solely be stored on your device.\n\nYour trust means a lot to us, and we will take great care in anonymizing the dataset before sharing it to the research community. At the same time, we strive for ultimate transparency. If you have suggestions on how we can improve our crowd-sourcing setting, we are more than happy to hear your feedback.\n\n\n## 📄 Output\n\nThe recorded changes are saved in a CSV file in your workspace.\n\nThen, this file is processed to generate output files in SRT and JSON formats, providing a detailed and accessible log of your coding session.\n\n## ▶️ Play it back!\n\nPlayback is a feature by the upstream repository. We have not tested playback using our modified repository (e.g. cursor movement and terminal capture are not implemented upstream; chances are high that playback simply breaks using recordings captured by crowd-code). If you want to try this nonetheless:\n\n- The output files can be played back in the [VS Code Recorder Player web app](https://github.com/mattia-consiglio/vs-code-recorder-player).\n- 🚧 React component available soon...\n\n## 🔧 Extension Settings\n\n- `crowdCode.export.exportPath`: Set the export path. Use `${workspaceFolder}` to export to the workspace folder. In case the path does not exist in the workspace, it will be created.\n\n Default: `$TMPDIR/crowd-code/`\n\n- `crowdCode.export.createPathOutsideWorkspace`: Create the export path outside the workspace if it doesn't exist\n\n Default: `true`\n\n- `crowdCode.export.addToGitignore`: Add the export path to .gitignore when creating the folder\n\n Default: `false`\n\n- `crowdCode.export.exportFormats`: Enabled export formats (SRT or JSON or both)\n\n Default: `[""JSON"", ""SRT""]`\n\n- `crowdCode.recording.askFolderName`: Ask for a custom folder name before starting a recording\n\n Default: `false`\n\n- `crowdCode.appearance.minimalMode`: Enable or disable the minimal mode\n\n Default: `false`\n\n- `crowdCode.appearance.showTimer`: Enable or disable the display time\n\n Default: `true`\n\n## ⚙️ Requirements\n\nThis extension requires Visual Studio Code, or any other editor that supports the VS Code API (like Cursor, VSCodium, Windsurf, etc.), to run. No additional dependencies are needed.\n\n## 🐛 Known Issues\n\nThere are currently no known issues with this extension.\n\n## 🤝 Contributing\n\nIf you'd like to contribute to this extension, please feel free to fork the repository and submit a pull request.\n\n## 💸 Support the upstream author\n\nIf you like this extension, please consider [supporting the author of the upstream repository](https://www.paypal.com/donate/?hosted_button_id=D5EUDQ5VEJCSL)!\n\n## 📝 Release Notes\n\nSee [CHANGELOG.md](CHANGELOG.md)\n\n---\n\n**😊 Enjoy!**\n",markdown,tab
|
| 7 |
+
7,79013,"README.md",0,0,"",markdown,tab
|
| 8 |
+
8,81223,"README.md",1988,0,"",markdown,selection_mouse
|
| 9 |
+
9,81294,"README.md",1987,0,"",markdown,selection_command
|
| 10 |
+
10,146249,"TERMINAL",0,0,"npx install",,terminal_command
|
| 11 |
+
11,146301,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 12 |
+
12,150310,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 13 |
+
13,150556,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 14 |
+
14,150624,"TERMINAL",0,0,"[1G[0K⠸[1G[0K[1mnpm[22m [31merror[39m could not determine executable to run\r\n[1G[0K⠸[1G[0K[1mnpm[22m [31merror[39m A complete log of this run can be found in: /Users/mihir/.npm/_logs/2025-11-04T15_34_43_395Z-debug-0.log\r\n[1G[0K⠸[1G[0K",,terminal_output
|
| 15 |
+
15,150724,"TERMINAL",0,0,"[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 16 |
+
16,165387,"package.json",0,0,"{\n ""name"": ""crowd-code"",\n ""displayName"": ""crowd-code"",\n ""description"": ""Record your code editing activity in VS Code"",\n ""version"": ""1.1.3"",\n ""publisher"": ""pdoom-org"",\n ""icon"": ""icon.png"",\n ""engines"": {\n ""vscode"": ""^1.89.0""\n },\n ""main"": ""./out/extension.js"",\n ""categories"": [\n ""Other"",\n ""Education""\n ],\n ""activationEvents"": [\n ""onStartupFinished""\n ],\n ""contributes"": {\n ""commands"": [\n {\n ""command"": ""crowd-code.startRecording"",\n ""title"": ""Start Recording"",\n ""icon"": ""$(play)""\n },\n {\n ""command"": ""crowd-code.stopRecording"",\n ""title"": ""Stop Recording"",\n ""icon"": ""$(stop)""\n },\n {\n ""command"": ""crowd-code.panicButton"",\n ""title"": ""Panic Button"",\n ""icon"": ""$(refresh)""\n },\n {\n ""command"": ""crowd-code.openSettings"",\n ""title"": ""Open Settings"",\n ""icon"": ""$(settings)""\n },\n {\n ""command"": ""crowd-code.refreshRecordFiles"",\n ""title"": ""Refresh"",\n ""icon"": ""$(refresh)""\n },\n {\n ""command"": ""crowd-code.deleteRecordFile"",\n ""title"": ""Delete"",\n ""icon"": ""$(trash)""\n },\n {\n ""command"": ""crowd-code.revealInExplorer"",\n ""title"": ""Reveal in File Explorer"",\n ""icon"": ""$(folder-opened)""\n },\n {\n ""command"": ""crowd-code.addToGitignore"",\n ""title"": ""Add to .gitignore"",\n ""icon"": ""$(git-ignore)""\n },\n {\n ""command"": ""crowd-code.showUserId"",\n ""title"": ""Show User ID""\n },\n {\n ""command"": ""crowd-code.consent"",\n ""title"": ""crowd-code: Manage Data Collection Consent""\n }\n ],\n ""viewsContainers"": {\n ""activitybar"": [\n {\n ""id"": ""crowd-code"",\n ""title"": ""crowd-code"",\n ""icon"": ""icon.svg""\n }\n ]\n },\n ""views"": {\n ""crowd-code"": [\n {\n ""id"": ""actions"",\n ""name"": ""Actions"",\n ""icon"": ""icon.svg"",\n ""contextualTitle"": ""Actions""\n },\n {\n ""id"": ""recordFiles"",\n ""name"": ""Record Files"",\n ""icon"": ""icon.svg"",\n ""contextualTitle"": ""Record Files""\n }\n ]\n },\n ""menus"": {\n ""view/title"": [\n {\n ""command"": ""crowd-code.refreshRecordFiles"",\n ""when"": ""view == recordFiles"",\n ""group"": ""navigation""\n },\n {\n ""command"": ""crowd-code.addToGitignore"",\n ""when"": ""view == actions"",\n ""group"": ""navigation""\n },\n {\n ""command"": ""crowd-code.consent"",\n ""when"": ""view == actions"",\n ""group"": ""navigation""\n }\n ],\n ""view/item/context"": [\n {\n ""command"": ""crowd-code.deleteRecordFile"",\n ""when"": ""view == recordFiles"",\n ""group"": ""inline""\n },\n {\n ""command"": ""crowd-code.revealInExplorer"",\n ""when"": ""view == recordFiles"",\n ""group"": ""inline""\n },\n {\n ""command"": ""crowd-code.deleteRecordFile"",\n ""when"": ""view == recordFiles"",\n ""group"": ""1_modification""\n },\n {\n ""command"": ""crowd-code.revealInExplorer"",\n ""when"": ""view == recordFiles"",\n ""group"": ""2_workspace""\n }\n ]\n },\n ""configuration"": {\n ""title"": ""crowd-code Configuration"",\n ""properties"": {\n ""crowdCode.export.exportPath"": {\n ""type"": ""string"",\n ""default"": ""${TMPDIR}/crowd-code/"",\n ""markdownDescription"": ""Path where recordings will be exported. Use '${workspaceFolder}' to refer to the workspace folder."",\n ""order"": 0\n },\n ""crowdCode.export.createPathOutsideWorkspace"": {\n ""type"": ""boolean"",\n ""default"": true,\n ""description"": ""Whether to create the export path if it doesn't exist, even if it's outside the workspace folder."",\n ""order"": 1\n },\n ""crowdCode.export.addToGitignore"": {\n ""type"": ""boolean"",\n ""default"": false,\n ""description"": ""Whether to add the export path to .gitignore when creating it."",\n ""order"": 2\n },\n ""crowdCode.export.exportFormats"": {\n ""type"": ""array"",\n ""items"": {\n ""type"": ""string"",\n ""enum"": [\n ""JSON"",\n ""SRT""\n ]\n },\n ""uniqueItems"": true,\n ""default"": [\n ""JSON"",\n ""SRT""\n ],\n ""description"": ""Formats to export the recording in."",\n ""order"": 3\n },\n ""crowdCode.recording.askFolderName"": {\n ""type"": ""boolean"",\n ""default"": false,\n ""description"": ""Ask for a custom folder name before starting a recording"",\n ""order"": 4\n },\n ""crowdCode.appearance.minimalMode"": {\n ""type"": ""boolean"",\n ""default"": false,\n ""description"": ""Whether to show only the icon in the status bar when recording is stopped."",\n ""order"": 5\n },\n ""crowdCode.appearance.showTimer"": {\n ""type"": ""boolean"",\n ""default"": true,\n ""description"": ""Whether to show the timer in the status bar when recording."",\n ""order"": 6\n }\n }\n }\n },\n ""repository"": {\n ""type"": ""git"",\n ""url"": ""git://github.com/p-doom/crowd-code.git""\n },\n ""scripts"": {\n ""vscode:prepublish"": ""npm run package"",\n ""ovsx:publish"": ""ovsx publish"",\n ""vsce:package"": ""vsce package"",\n ""release"": ""npm run package && vsce package"",\n ""compile"": ""webpack"",\n ""watch"": ""webpack --watch"",\n ""package"": ""webpack --mode production --devtool hidden-source-map"",\n ""compile-tests"": ""tsc -p . --outDir out"",\n ""watch-tests"": ""tsc -p . -w --outDir out"",\n ""pretest"": ""npm run compile-tests && npm run compile && npm run lint"",\n ""lint"": ""eslint src --ext ts"",\n ""test"": ""vscode-test""\n },\n ""devDependencies"": {\n ""@types/mocha"": ""^10.0.6"",\n ""@types/node"": ""18.x"",\n ""@types/vscode"": ""^1.89.0"",\n ""@typescript-eslint/eslint-plugin"": ""^7.11.0"",\n ""@typescript-eslint/parser"": ""^7.11.0"",\n ""@vscode/l10n-dev"": ""^0.0.35"",\n ""@vscode/test-cli"": ""^0.0.9"",\n ""@vscode/test-electron"": ""^2.4.0"",\n ""@vscode/vsce"": ""^2.24.0"",\n ""eslint"": ""^8.57.0"",\n ""ts-loader"": ""^9.5.1"",\n ""typescript"": ""^5.4.5"",\n ""webpack"": ""^5.91.0"",\n ""webpack-cli"": ""^5.1.4""\n },\n ""dependencies"": {\n ""axios"": ""^1.7.2""\n }\n}\n",json,tab
|
| 17 |
+
17,168315,"README.md",0,0,"",markdown,tab
|
| 18 |
+
18,172469,"TERMINAL",0,0,"npm install",,terminal_command
|
| 19 |
+
19,172521,"TERMINAL",0,0,"]633;C",,terminal_output
|
| 20 |
+
20,175744,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 21 |
+
21,175841,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 22 |
+
22,175955,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 23 |
+
23,176121,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 24 |
+
24,176425,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 25 |
+
25,176425,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 26 |
+
26,176637,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 27 |
+
27,176644,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 28 |
+
28,176647,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 29 |
+
29,176659,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 30 |
+
30,176729,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 31 |
+
31,176812,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 32 |
+
32,177046,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 33 |
+
33,177046,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 34 |
+
34,177096,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 35 |
+
35,177133,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 36 |
+
36,177215,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 37 |
+
37,177304,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 38 |
+
38,177377,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 39 |
+
39,177453,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 40 |
+
40,177537,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 41 |
+
41,177617,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 42 |
+
42,177741,"TERMINAL",0,0,"[1G[0K⠸[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported\r\n[1G[0K⠸",,terminal_output
|
| 43 |
+
43,177817,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 44 |
+
44,177911,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 45 |
+
45,177977,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 46 |
+
46,178066,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 47 |
+
47,178154,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 48 |
+
48,178235,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 49 |
+
49,178299,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 50 |
+
50,178379,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 51 |
+
51,178459,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 52 |
+
52,178538,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 53 |
+
53,178620,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 54 |
+
54,178691,"TERMINAL",0,0,"[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.\r\n[1G[0K⠼",,terminal_output
|
| 55 |
+
55,178768,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 56 |
+
56,178851,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 57 |
+
57,178928,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 58 |
+
58,179008,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 59 |
+
59,179087,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 60 |
+
60,179168,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 61 |
+
61,179248,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 62 |
+
62,179327,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 63 |
+
63,179409,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 64 |
+
64,179487,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 65 |
+
65,179568,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 66 |
+
66,179649,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 67 |
+
67,179732,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 68 |
+
68,179811,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 69 |
+
69,179890,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 70 |
+
70,179970,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 71 |
+
71,180050,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 72 |
+
72,180119,"TERMINAL",0,0,"[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.\r\n[1G[0K⠙",,terminal_output
|
| 73 |
+
73,180197,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 74 |
+
74,180278,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 75 |
+
75,180393,"TERMINAL",0,0,"[1G[0K⠼[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead\r\n[1G[0K⠼[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead\r\n[1G[0K⠼",,terminal_output
|
| 76 |
+
76,180476,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 77 |
+
77,180555,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 78 |
+
78,180635,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 79 |
+
79,180714,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 80 |
+
80,180795,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 81 |
+
81,180874,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 82 |
+
82,180954,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 83 |
+
83,181034,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 84 |
+
84,181119,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 85 |
+
85,181200,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 86 |
+
86,181279,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 87 |
+
87,181360,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 88 |
+
88,181437,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 89 |
+
89,181519,"TERMINAL",0,0,"[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m glob@7.2.3: Glob versions prior to v9 are no longer supported\r\n[1G[0K⠧",,terminal_output
|
| 90 |
+
90,181592,"TERMINAL",0,0,"[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m glob@7.2.3: Glob versions prior to v9 are no longer supported\r\n[1G[0K⠇",,terminal_output
|
| 91 |
+
91,181673,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 92 |
+
92,181793,"TERMINAL",0,0,"[1G[0K⠋[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m glob@8.1.0: Glob versions prior to v9 are no longer supported\r\n[1G[0K⠋",,terminal_output
|
| 93 |
+
93,181872,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 94 |
+
94,181956,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 95 |
+
95,182036,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 96 |
+
96,182117,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 97 |
+
97,182196,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 98 |
+
98,182278,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 99 |
+
99,182360,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 100 |
+
100,182440,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 101 |
+
101,182521,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 102 |
+
102,182601,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 103 |
+
103,182695,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 104 |
+
104,182767,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 105 |
+
105,182842,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 106 |
+
106,182952,"TERMINAL",0,0,"[1G[0K⠼[1G[0K[1mnpm[22m [33mwarn[39m [94mdeprecated[39m glob@7.2.3: Glob versions prior to v9 are no longer supported\r\n[1G[0K⠼",,terminal_output
|
| 107 |
+
107,183030,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 108 |
+
108,183111,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 109 |
+
109,183189,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 110 |
+
110,183270,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 111 |
+
111,183350,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 112 |
+
112,183435,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 113 |
+
113,183509,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 114 |
+
114,183591,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 115 |
+
115,183671,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 116 |
+
116,183753,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 117 |
+
117,183832,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 118 |
+
118,183912,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 119 |
+
119,183992,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 120 |
+
120,184073,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 121 |
+
121,184155,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 122 |
+
122,184235,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 123 |
+
123,184316,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 124 |
+
124,184397,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 125 |
+
125,184479,"TERMINAL",0,0,"[1G[0K⠸",,terminal_output
|
| 126 |
+
126,184559,"TERMINAL",0,0,"[1G[0K⠼",,terminal_output
|
| 127 |
+
127,184640,"TERMINAL",0,0,"[1G[0K⠴",,terminal_output
|
| 128 |
+
128,184722,"TERMINAL",0,0,"[1G[0K⠦",,terminal_output
|
| 129 |
+
129,184800,"TERMINAL",0,0,"[1G[0K⠧",,terminal_output
|
| 130 |
+
130,184880,"TERMINAL",0,0,"[1G[0K⠇",,terminal_output
|
| 131 |
+
131,184961,"TERMINAL",0,0,"[1G[0K⠏",,terminal_output
|
| 132 |
+
132,185043,"TERMINAL",0,0,"[1G[0K⠋",,terminal_output
|
| 133 |
+
133,185125,"TERMINAL",0,0,"[1G[0K⠙",,terminal_output
|
| 134 |
+
134,185206,"TERMINAL",0,0,"[1G[0K⠹",,terminal_output
|
| 135 |
+
135,185387,"TERMINAL",0,0,"[1G[0K⠸[1G[0K\r\nadded 543 packages, and audited 544 packages in 12s\r\n[1G[0K⠸[1G[0K\r\n[1G[0K⠸[1G[0K131 packages are looking for funding\r\n[1G[0K⠸[1G[0K run `npm fund` for details\r\n[1G[0K⠸[1G[0K\r\n[31m[1m4[22m[39m vulnerabilities (1 [1mlow[22m, 2 [31m[1mhigh[22m[39m, 1 [35m[1mcritical[22m[39m)\r\n\r\nTo address all issues, run:\r\n npm audit fix\r\n\r\nRun `npm audit` for details.\r\n[1G[0K⠸[1G[0K",,terminal_output
|
| 136 |
+
136,185425,"TERMINAL",0,0,"[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 137 |
+
137,195201,"package.json",0,0,"",json,tab
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-d6aa1c03-027a-414e-9d2e-358a8ff8ee771765127660242-2025_12_07-18.14.46.516/source.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-d72ea1bf-407e-4c83-bae5-566f9cf366901762523167296-2025_11_07-14.46.40.718/source.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-de898702-d3d5-4c86-8010-37845aa1748c1762368627604-2025_11_05-19.50.55.448/source.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
1,159,"src/extension.ts",0,0,"import * as vscode from 'vscode'\nimport * as crypto from 'crypto'\nimport OpenAI from ""openai"";\n\nimport { getExportPath, logToOutput, outputChannel, addToGitignore } from './utilities'\nimport axios from 'axios'\nimport {\n\tupdateStatusBarItem,\n\tstartRecording,\n\tstopRecording,\n\tisCurrentFileExported,\n\tcommands,\n\trecording,\n\taddToFileQueue,\n\tbuildCsvRow,\n\tappendToFile,\n\tpanicButton,\n} from './recording'\nimport { ChangeType, CSVRowBuilder } from './types'\nimport { RecordFilesProvider, type RecordFile } from './recordFilesProvider'\nimport { ActionsProvider } from './actionsProvider'\nimport { initializeGitProvider, cleanupGitProvider } from './gitProvider'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { showConsentChangeDialog, ensureConsent, hasConsent } from './consent'\n\nexport let statusBarItem: vscode.StatusBarItem\nexport let extContext: vscode.ExtensionContext\nexport let actionsProvider: ActionsProvider\n\nfunction onConfigurationChange(event: vscode.ConfigurationChangeEvent) {\n\tif (event.affectsConfiguration('crowdCode')) {\n\t\tupdateStatusBarItem()\n\t\tgetExportPath()\n\t}\n}\n\n/**\n * Gets the full path for a file or folder\n * @param item - The tree item representing the file or folder\n * @param exportPath - The base export path\n * @returns The full path to the file or folder\n */\nfunction getFullPath(item: RecordFile, exportPath: string): string {\n\t// If the item has a parent path (file inside a folder), construct the full path\n\tif (item.parentPath) {\n\t\treturn path.join(exportPath, item.parentPath, item.label)\n\t}\n\t// Otherwise, it's a root item\n\treturn path.join(exportPath, item.label)\n}\n\n/**\n * Deletes a file or folder recursively\n * @param filePath - The path to the file or folder to delete\n */\nasync function deleteFileOrFolder(filePath: string): Promise<void> {\n\ttry {\n\t\tconst stat = fs.statSync(filePath)\n\t\tif (stat.isDirectory()) {\n\t\t\t// Delete directory and its contents recursively\n\t\t\tfs.rmSync(filePath, { recursive: true, force: true })\n\t\t} else {\n\t\t\t// Delete single file\n\t\t\tfs.unlinkSync(filePath)\n\t\t}\n\t} catch (err) {\n\t\tconsole.error('Error deleting file or folder:', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Gets surrounding code context around the cursor position\n */\nfunction getCodeContext(document: vscode.TextDocument, position: vscode.Position, contextLines: number = 20): string {\n\tconst startLine = Math.max(0, position.line - contextLines)\n\tconst endLine = Math.min(document.lineCount - 1, position.line + contextLines)\n\t\n\tconst lines: string[] = []\n\tfor (let i = startLine; i <= endLine; i++) {\n\t\tconst line = document.lineAt(i)\n\t\t// Mark the cursor position with a special marker\n\t\tif (i === position.line) {\n\t\t\tconst lineText = line.text\n\t\t\tconst cursorChar = Math.min(position.character, lineText.length)\n\t\t\tconst beforeCursor = lineText.substring(0, cursorChar)\n\t\t\tconst afterCursor = lineText.substring(cursorChar)\n\t\t\tlines.push(`${beforeCursor}<CURSOR>${afterCursor}`)\n\t\t} else {\n\t\t\tlines.push(line.text)\n\t\t}\n\t}\n\t\n\treturn lines.join('\n')\n}\n\n/**\n * Calls OpenAI API to get code suggestions\n */\nasync function getCodeSuggestion(\n\tcodeContext: string,\n\tlanguageId: string,\n\tfileName: string\n): Promise<string | null> {\n\tconst client = new OpenAI()\n\tlogToOutput('Sending openai a request...')\n\ttry {\n\t\tconst prompt = `You are a code completion assistant. Analyze the following code and suggest the next logical code completion at the <CURSOR> position.\n\nFile: ${fileName}\nLanguage: ${languageId}\n\nCode context:\n\`\`\`${languageId}\n${codeContext}\n\`\`\`\n\nInstructions:\n1. Provide ONLY the code that should be inserted at the cursor position\n2. Do not include any explanation, comments, or markdown formatting\n3. Return just the raw code text that completes the current line or statement\n4. If the code is already complete, suggest the next logical line\n5. Keep suggestions concise and relevant to the context\n6. Maintain the same indentation level as the cursor line\n\nSuggested code:`\n\t\tconst response = await client.responses.create({\n\t\t\tmodel: ""gpt-5"",\n\t\t\tinput: prompt\n\t\t})\n\t\tlogToOutput('received answer...')\n\t\tlogToOutput(`OpenAI response: ${response.output_text}`)\n\t\tconst suggestion = response.output_text?.trim()\n\t\tif (!suggestion) {\n\t\t\treturn null\n\t\t}\n\n\t\t// Clean up the suggestion - remove any markdown code blocks if present\n\t\tlet cleanedSuggestion = suggestion\n\t\t\t.replace(/^```[\w]*\n?/g, '')\n\t\t\t.replace(/\n?```$/g, '')\n\t\t\t.trim()\n\n\t\treturn cleanedSuggestion\n\t} catch (error) {\n\t\tif (axios.isAxiosError(error)) {\n\t\t\tlogToOutput(`OpenAI API error: ${error.response?.status} - ${error.response?.statusText}`, 'error')\n\t\t\tif (error.response?.status === 401) {\n\t\t\t\tlogToOutput('Invalid API key. Please check your OPENAI_API_KEY environment variable.', 'error')\n\t\t\t}\n\t\t} else {\n\t\t\tlogToOutput(`Error getting code suggestion: ${error}`, 'error')\n\t\t}\n\t\treturn null\n\t}\n}\n\n/**\n * Inline completion provider that uses GPT-5 for code suggestions\n */\nclass TabOutputInlineCompletionProvider implements vscode.InlineCompletionItemProvider {\n\tasync provideInlineCompletionItems(\n\t\tdocument: vscode.TextDocument,\n\t\tposition: vscode.Position,\n\t\tcontext: vscode.InlineCompletionContext,\n\t\ttoken: vscode.CancellationToken\n\t): Promise<vscode.ProviderResult<vscode.InlineCompletionItem[] | vscode.InlineCompletionList>> {\n\t\t// Don't suggest if cancelled\n\t\tif (token.isCancellationRequested) {\n\t\t\treturn []\n\t\t}\n\n\t\t// Get surrounding code context\n\t\tconst codeContext = getCodeContext(document, position)\n\t\tconst languageId = document.languageId\n\t\tconst fileName = document.fileName.split('/').pop() || document.fileName\n\n\t\t// Get suggestion from OpenAI\n\t\tconst suggestion = await getCodeSuggestion(codeContext, languageId, fileName)\n\t\t\n\t\tif (!suggestion || token.isCancellationRequested) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst item = new vscode.InlineCompletionItem(suggestion)\n\t\treturn [item]\n\t}\n}\n\n/**\n * Command to insert the suggested code at the current cursor position\n * This will trigger the inline completion provider to get a suggestion\n */\nasync function insertTabOutput(): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor\n\tif (!editor) {\n\t\treturn\n\t}\n\n\t// Trigger inline completion which will use our provider to get GPT-5 suggestions\n\tawait vscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n}\n\nexport async function activate(context: vscode.ExtensionContext): Promise<void> {\n\textContext = context\n\toutputChannel.show()\n\tlogToOutput('Activating crowd-code', 'info')\n\n\t// Save anonUserId globally for user to copy\n\tconst userName = process.env.USER || process.env.USERNAME || ""coder"";\n\tconst machineId = vscode.env.machineId ?? null;\n\tconst rawId = `${machineId}:${userName}`;\n\tconst anonUserId = crypto.createHash('sha256').update(rawId).digest('hex') as string;\n\n\textContext.globalState.update('userId', anonUserId);\n\n\t// Register userID display\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.showUserId', () => {\n\t\t\tconst userId = extContext.globalState.get<string>('userId');\n\t\t\tif (!userId) {\n\t\t\t\tvscode.window.showWarningMessage(""User ID not registered yet. Please wait a few seconds until the extension is fully activated."");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvscode.window.showInformationMessage(`Your User ID is: ${userId}`);\n\t\t}))\n\n\n\t// Register Record Files Provider\n\tconst recordFilesProvider = new RecordFilesProvider()\n\tcontext.subscriptions.push(\n\t\tvscode.window.registerTreeDataProvider('recordFiles', recordFilesProvider)\n\t)\n\n\t// Register Actions Provider\n\tactionsProvider = new ActionsProvider()\n\tcontext.subscriptions.push(vscode.window.registerTreeDataProvider('actions', actionsProvider))\n\n\t// Register refresh command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.refreshRecordFiles', () => {\n\t\t\trecordFilesProvider.refresh()\n\t\t})\n\t)\n\n\t// Register delete command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(\n\t\t\t'crowd-code.deleteRecordFile',\n\t\t\tasync (item: RecordFile) => {\n\t\t\t\tconst exportPath = getExportPath()\n\t\t\t\tif (!exportPath) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst result = await vscode.window.showWarningMessage(\n\t\t\t\t\t`Are you sure you want to delete ${item.label}?`,\n\t\t\t\t\t'Yes',\n\t\t\t\t\t'No'\n\t\t\t\t)\n\n\t\t\t\tif (result === 'Yes') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst itemPath = getFullPath(item, exportPath)\n\t\t\t\t\t\tawait deleteFileOrFolder(itemPath)\n\t\t\t\t\t\trecordFilesProvider.refresh()\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tvscode.window.showErrorMessage(`Error deleting ${item.label}: ${err}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t)\n\n\t// Register reveal in explorer command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.revealInExplorer', (item: RecordFile) => {\n\t\t\tconst exportPath = getExportPath()\n\t\t\tif (!exportPath) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst itemPath = getFullPath(item, exportPath)\n\t\t\tvscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(itemPath))\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.startRecording, () => {\n\t\t\tstartRecording()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.stopRecording, () => {\n\t\t\tstopRecording()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.panicButton, () => {\n\t\t\tpanicButton()\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand(commands.openSettings, () => {\n\t\t\tvscode.commands.executeCommand(\n\t\t\t\t'workbench.action.openSettings',\n\t\t\t\t'@ext:MattiaConsiglio.crowd-code'\n\t\t\t)\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.addToGitignore', async () => {\n\t\t\tawait addToGitignore()\n\t\t})\n\t)\n\n\t// Register consent management command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.consent', async () => {\n\t\t\tawait showConsentChangeDialog()\n\t\t})\n\t)\n\n\t// Register tab output inline completion provider\n\tconst tabOutputInlineCompletionProvider = new TabOutputInlineCompletionProvider()\n\tcontext.subscriptions.push(\n\t\tvscode.languages.registerInlineCompletionItemProvider('*', tabOutputInlineCompletionProvider)\n\t)\n\n\t// Register insert tab output command\n\tcontext.subscriptions.push(\n\t\tvscode.commands.registerCommand('crowd-code.insertTabOutput', insertTabOutput)\n\t)\n\n\t// Trigger inline completions continuously when cursor position changes\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeTextEditorSelection(() => {\n\t\t\tconst editor = vscode.window.activeTextEditor\n\t\t\tif (editor) {\n\t\t\t\t// Trigger inline completion suggestions\n\t\t\t\tvscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n\t\t\t}\n\t\t})\n\t)\n\n\t// Also trigger on document changes to keep suggestions visible\n\tcontext.subscriptions.push(\n\t\tvscode.workspace.onDidChangeTextDocument(() => {\n\t\t\tconst editor = vscode.window.activeTextEditor\n\t\t\tif (editor) {\n\t\t\t\tvscode.commands.executeCommand('editor.action.inlineSuggest.trigger')\n\t\t\t}\n\t\t})\n\t)\n\n\n\tcontext.subscriptions.push(vscode.workspace.onDidChangeConfiguration(onConfigurationChange))\n\n\tvscode.window.onDidChangeActiveTextEditor(editor => {\n\t\tupdateStatusBarItem()\n\t\tif (editor && recording.isRecording) {\n\t\t\tif (isCurrentFileExported()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst currentFileUri = editor.document.uri.toString()\n\t\t\tlet tabEventText = ''\n\n\t\t\tif (recording.activatedFiles) {\n\t\t\t\tif (!recording.activatedFiles.has(currentFileUri)) {\n\t\t\t\t\ttabEventText = editor.document.getText()\n\t\t\t\t\trecording.activatedFiles.add(currentFileUri)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error(""Warning: recording.activatedFiles was not available during TAB event logging."")\n\t\t\t}\n\n\t\t\trecording.sequence++\n\t\t\taddToFileQueue(\n\t\t\t\tbuildCsvRow({\n\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\trangeLength: 0,\n\t\t\t\t\ttext: tabEventText,\n\t\t\t\t\ttype: ChangeType.TAB,\n\t\t\t\t})\n\t\t\t)\n\t\t\tappendToFile()\n\t\t\tactionsProvider.setCurrentFile(editor.document.fileName)\n\t\t}\n\t})\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeTextEditorSelection(event => {\n\t\t\tif (recording.isRecording && event.textEditor === vscode.window.activeTextEditor) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst editor = event.textEditor\n\t\t\t\t// For simplicity, we'll log the primary selection.\n\t\t\t\tconst selection = event.selections[0]\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst selectedText = editor.document.getText(selection)\n\t\t\t\tlet changeType: string\n\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Keyboard:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_KEYBOARD\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Mouse:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_MOUSE\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase vscode.TextEditorSelectionChangeKind.Command:\n\t\t\t\t\t\tchangeType = ChangeType.SELECTION_COMMAND\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new TypeError(""Unknown selection change kind."")\n\t\t\t\t}\n\n\t\t\t\trecording.sequence++\n\t\t\t\tconst csvRowParams: CSVRowBuilder = {\n\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\trangeOffset: editor.document.offsetAt(selection.start),\n\t\t\t\t\trangeLength: editor.document.offsetAt(selection.end) - editor.document.offsetAt(selection.start),\n\t\t\t\t\ttext: selectedText,\n\t\t\t\t\ttype: changeType,\n\t\t\t\t}\n\t\t\t\taddToFileQueue(buildCsvRow(csvRowParams))\n\t\t\t\tappendToFile()\n\t\t\t\tactionsProvider.setCurrentFile(editor.document.fileName)\n\t\t\t}\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidChangeActiveTerminal((terminal: vscode.Terminal | undefined) => {\n\t\t\tif (terminal && recording.isRecording) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trecording.sequence++\n\t\t\t\taddToFileQueue(\n\t\t\t\t\tbuildCsvRow({\n\t\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\t\trangeLength: 0,\n\t\t\t\t\t\ttext: terminal.name,\n\t\t\t\t\t\ttype: ChangeType.TERMINAL_FOCUS,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\tappendToFile()\n\t\t\t\tactionsProvider.setCurrentFile(`Terminal: ${terminal.name}`)\n\t\t\t}\n\t\t})\n\t)\n\n\tcontext.subscriptions.push(\n\t\tvscode.window.onDidStartTerminalShellExecution(async (event: vscode.TerminalShellExecutionStartEvent) => {\n\t\t\tif (recording.isRecording) {\n\t\t\t\tif (isCurrentFileExported()) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst commandLine = event.execution.commandLine.value\n\t\t\t\trecording.sequence++\n\t\t\t\taddToFileQueue(\n\t\t\t\t\tbuildCsvRow({\n\t\t\t\t\t\tsequence: recording.sequence,\n\t\t\t\t\t\trangeOffset: 0,\n\t\t\t\t\t\trangeLength: 0,\n\t\t\t\t\t\ttext: commandLine,\n\t\t\t\t\t\ttype: ChangeType.TERMINAL_COMMAND,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\tappendToFile()\n\n\t\t\t\tconst stream = event.execution.read()\n\t\t\t\tfor await (const data of stream) {\n\t\t\t\t\trecording.sequence++\n\t\t\t\t\taddToFileQueue(\n\t\t\t\t\t\tbuildCsvRow({ sequence: recording.sequence, rangeOffset: 0, rangeLength: 0, text: data, type: ChangeType.TERMINAL_OUTPUT })\n\t\t\t\t\t)\n\t\t\t\t\tappendToFile()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t)\n\n\tstatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 9000)\n\tupdateStatusBarItem()\n\tcontext.subscriptions.push(statusBarItem)\n\n\t// Ensure consent is obtained when the extension is first activated\n\tawait ensureConsent()\n\n\t// Autostart recording regardless of consent. The consent only gates data upload.\n\tstartRecording().catch(err => logToOutput(`Autostart recording failed unexpectedly: ${err}`, 'error'))\n\n\t// Initialize git provider for branch checkout detection\n\tinitializeGitProvider()\n}\n\nexport function deactivate(): void {\n\tlogToOutput('Deactivating crowd-code', 'info')\n\tif (recording.isRecording) {\n\t\tstopRecording()\n\t}\n\tcleanupGitProvider()\n\tstatusBarItem.dispose()\n}\n",typescript,tab
|
| 3 |
+
2,4097,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
|
| 4 |
+
3,4831,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"7:50:54 PM [info] Activating crowd-code\n7:50:55 PM [info] Recording started\n7:50:55 PM [info] Initializing git provider using file system watchers...\n7:50:56 PM [info] Git repository found\n7:50:56 PM [info] Git provider initialized successfully\n7:50:57 PM [info] Initial git state: [object Object]\n",Log,content
|
| 5 |
+
4,7898,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,selection_mouse
|
| 6 |
+
5,8082,"src/extension.ts",0,0,"",typescript,tab
|
7001f8f8f84b6915b61e3bee4e7c2f89f30581369294cc85fac08cb778514386/crowd-code-e14cbbc9-79dc-4854-93dc-1aff51d245bf1762524405138-2025_11_07-15.07.25.256/source.csv
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
|
| 2 |
+
1,86,"src/PlayerProvider.tsx",0,0,"import CodePlayer from ""./CodePlayer"";\r\nimport FileSelector from ""./FileSelector"";\r\nimport Player from ""./Player"";\r\nimport { useAppSelector } from ""./redux/store"";\r\n\r\nfunction PlayerProvider() {\r\n\tconst content = useAppSelector((state) => state.player.content);\r\n\treturn (\r\n\t\t<div className=""space-y-6"">\r\n\t\t\t<div className=""bg-gray-700/30 rounded-lg p-4"">\r\n\t\t\t\t<FileSelector />\r\n\t\t\t</div>\r\n\r\n\t\t\t{!!content.length && (\r\n\t\t\t\t<div className=""space-y-4"">\r\n\t\t\t\t\t<div className=""bg-gray-700/30 rounded-lg p-4"">\r\n\t\t\t\t\t\t<CodePlayer />\r\n\r\n\t\t\t\t\t\t<Play\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t)}\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default PlayerProvider;\r\n",typescriptreact,tab
|
| 3 |
+
2,2252,"src/PlayerProvider.tsx",540,0,"",typescriptreact,selection_command
|
| 4 |
+
3,4837,"tasks",0,0,"",Log,tab
|
| 5 |
+
4,4845,"src/PlayerProvider.tsx",0,0,"",typescriptreact,tab
|
| 6 |
+
5,4901,"src/PlayerProvider.tsx",541,0,"",typescriptreact,selection_mouse
|
| 7 |
+
6,7479,"src/PlayerProvider.tsx",540,0,"",typescriptreact,selection_command
|
| 8 |
+
7,7500,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"3:07:23 PM [info] Activating crowd-code\n3:07:25 PM [info] Recording started\n3:07:25 PM [info] Initializing git provider using file system watchers...\n3:07:26 PM [info] Git repository found\n3:07:26 PM [info] Git provider initialized successfully\n3:07:27 PM [info] Initial git state: [object Object]\n",Log,tab
|
| 9 |
+
8,8750,"src/PlayerProvider.tsx",0,0,"",typescriptreact,tab
|
| 10 |
+
9,8860,"src/PlayerProvider.tsx",541,0,"",typescriptreact,selection_mouse
|
| 11 |
+
10,10006,"src/PlayerProvider.tsx",540,0,"",typescriptreact,selection_command
|
| 12 |
+
11,11490,"TERMINAL",0,0,"",,terminal_focus
|
| 13 |
+
12,12804,"src/PlayerProvider.tsx",541,0,"",typescriptreact,selection_mouse
|
| 14 |
+
13,14214,"src/PlayerProvider.tsx",540,0,"",typescriptreact,selection_command
|
| 15 |
+
14,24560,"src/PlayerProvider.tsx",541,0,"",typescriptreact,selection_command
|
| 16 |
+
15,38923,"src/PlayerProvider.tsx",0,0,"hello world\r\n",typescriptreact,content
|
| 17 |
+
16,43452,"TERMINAL",0,0,"echo VSCode test",,terminal_command
|
| 18 |
+
17,43460,"TERMINAL",0,0,"]633;CVSCode test\r\n[1m[7m%[27m[1m[0m \r \r",,terminal_output
|
| 19 |
+
18,46209,"TERMINAL",0,0,"Cursor",,terminal_focus
|
| 20 |
+
19,64888,"src/PlayerProvider.tsx",207,0,"",typescriptreact,selection_mouse
|
| 21 |
+
20,65864,"src/PlayerProvider.tsx",207,0,"i",typescriptreact,content
|
| 22 |
+
21,65870,"src/PlayerProvider.tsx",208,0,"",typescriptreact,selection_keyboard
|
| 23 |
+
22,66308,"src/PlayerProvider.tsx",207,1,"",typescriptreact,content
|
| 24 |
+
23,66627,"src/PlayerProvider.tsx",0,13,"",typescriptreact,content
|
| 25 |
+
24,77258,"src/PlayerProvider.tsx",0,0,"",typescriptreact,selection_command
|