Skip to content

Instantly share code, notes, and snippets.

@sqs
sqs / deepseek-v4.ts
Created May 29, 2026 05:30
HIGHLY EXPERIMENTAL! Put this in .amp/plugins/deepseek-v4.ts to try DeepSeek V4 Pro in Amp (running on Baseten on USA-based servers). Then ctrl-o `plugins: reload` and switch to the `deepseek v4 pro` mode.
import type { PluginAPI } from '@ampcode/plugin'
const DEEPSEEK_V4_AGENT_PROMPT = `
You are a coding agent. Your job is to modify the user's codebase to satisfy the
latest request, then verify the result.
<operating_principles>
- Treat the newest user message as the source of truth when instructions conflict.
- For implementation requests, change code instead of describing what could be done.
- Ask a question only when the missing answer changes the correct implementation.
@sqs
sqs / opus-4-8.ts
Last active May 29, 2026 14:54
Put this in .amp/plugins/opus-4-8.ts to try Opus 4.8 in Amp now, before it's officially added to `smart` mode. Then ctrl-o `plugins: reload` and switch to the `opus 4.8` mode.
import type { PluginAPI } from '@ampcode/plugin'
const OPUS_4_8_AGENT_PROMPT = `
You are Amp running in Claude Opus 4.8 mode. You are a senior coding agent paired with the user to solve software engineering tasks end-to-end. Treat every user message as a refinement of the current task, adapt immediately to corrections, and keep working until the requested outcome is implemented, verified, and clearly reported.
<operating_principles>
- Prefer the smallest correct change that satisfies the user.
- Read the relevant code before making claims or edits. Never guess about files you have not inspected.
- Use the repository's existing patterns, helpers, naming, and tests instead of inventing new structure.
- Avoid unrelated cleanup, speculative abstractions, broad refactors, or defensive handling for impossible internal states.
// .amp/plugins/ask-user-choice.ts
//
// See https://ampcode.com/manual#plugins for more information about Amp plugins.
import type { PluginAPI, ThreadID } from '@ampcode/plugin'
const threadURL = (ampURL: URL, threadID: ThreadID): URL => {
const url = new URL(ampURL.toString())
url.pathname = `/threads/${threadID}`
url.search = ''
// .amp/plugins/ask-user-choice.ts
//
// See https://ampcode.com/manual#plugins for more information about Amp plugins.
import type { PluginAPI } from '@ampcode/plugin'
export default function (amp: PluginAPI) {
amp.registerTool({
name: 'ask_user_choice',
description:
'Present the user with a multiple choice question when there are several possible approaches and you need them to pick one. Use when you have 2-5 concrete options to choose from.',
import { describe, expect, test } from 'vitest'
import { lastValueFromAsyncGenerator } from '../common/asyncGenerator'
import { parseMessageXMLLike } from './structuredMessageParser'
describe('parseXmlTags', () => {
test('parses XML tags correctly', async () => {
const input = '<tag1>content1</tag1><tag2>content2</tag2><tag1>content3</tag1>'
async function* generateChunks() {
yield input
}
diff --git a/doc/extensions/authoring/publishing.md b/doc/extensions/authoring/publishing.md
index ddd670600..147efece3 100644
--- a/doc/extensions/authoring/publishing.md
+++ b/doc/extensions/authoring/publishing.md
@@ -19,11 +19,26 @@ At this point, your extension has been built and sent to Sourcegraph. The output
Any user can publish to the Sourcegraph.com extension registry, all Sourcegraph instances can use extensions from Sourcegraph.com, and all Sourcegraph.com extensions are visible to everyone. If you need to publish an extension privately, use a private extension registry on your own self-hosted Sourcegraph instance.
-## Testing your extension
+## Using extensions in local development (sideloading)
@sqs
sqs / sourcegraph-user-config.json
Created January 11, 2018 08:39
Full-text/regexp search across the top 500 Rust crates on Sourcegraph
// Full-text/regexp search across the top 500 Rust crates:
//
// 1. Sign up for Sourcegraph.com at https://sourcegraph.com/sign-up (or sign in)
// 2. Click your username in the top right
// 3. Go to Configuration
// 4. Paste this entire JSON in and click Save
// 5. In the search box, type a search query of the form "repogroup:crates YOUR QUERY"
// and hit enter (regexps, exact matching, etc., are supported)
//
// Examples: "repogroup:crates remove_file"
@sqs
sqs / remoteFileService.ts
Created July 26, 2017 08:17
RemoteFileService with lazy-loaded extensions
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
import { IContent, IStreamContent, IFileStat, IResolveContentOptions, IResolveFileOptions, IResolveFileResult, IUpdateContentOptions, FileChangesEvent, FileChangeType, IImportResult } from 'vs/platform/files/common/files';
import { TPromise } from "vs/base/common/winjs.base";
@sqs
sqs / eventemitter.ts
Created June 21, 2017 12:25
typescript eventemitter
/**
* An EventEmitter that implements the NodeJS.EventEmitter interface.
*/
export class EventEmitter implements NodeJS.EventEmitter {
private _events: { [name: string]: Function[] } = Object.create(null);
private _maxListeners = 10;
private _onceListeners: Function[] = [];
@sqs
sqs / file.ts
Created May 24, 2017 11:32
resolves to equal uri typescript vscode.ts
/**
* Returns true iff url == uri-resolve(url, candidate) per
* https://tools.ietf.org/html/rfc3986#section-5.2.2. For example, if currentURL is
* http://example.com/foo and newURL is /foo, then it returns true.
*/
export function resolvesToEqual(url: URI | string, candidate: URI | string): boolean {
if (typeof url === 'string') { url = URI.parse(url); }
if (typeof candidate === 'string') { candidate = URI.parse(candidate); }
const change: {