@sourcegraph/the-orb-is-awake
Version:
TypeScript SDK for Amp CLI - Build custom AI agents with Amp's capabilities
65 lines • 2.49 kB
JavaScript
/**
* TypeScript SDK types for Amp CLI
*
* These types are compatible with the Amp CLI --stream-json output.
*/
import { z } from 'zod';
// ============================================================================
// Validation Schemas (defined to derive interfaces from)
// ============================================================================
export const UserInputMessageSchema = z.object({
type: z.literal('user'),
message: z.object({
role: z.literal('user'),
content: z.array(z.object({
type: z.literal('text'),
text: z.string(),
})),
}),
});
export const MCPServerSchema = z.object({
command: z.string().describe('Command to run the MCP server'),
args: z.array(z.string()).describe('Arguments for the MCP server command').optional(),
env: z
.record(z.string(), z.string())
.describe('Environment variables for the server')
.optional(),
disabled: z.boolean().describe('Whether the server is disabled').optional(),
});
export const MCPConfigSchema = z
.record(z.string(), MCPServerSchema)
.describe('MCP server configurations keyed by server name');
export const AmpOptionsSchema = z
.object({
cwd: z.string().describe('Current working directory').optional(),
dangerouslyAllowAll: z
.boolean()
.describe('Allow all tool usage without asking for permission')
.optional(),
visibility: z
.enum(['private', 'public', 'workspace', 'group'])
.describe('Visibility level for new threads')
.default('workspace')
.optional(),
settingsFile: z.string().describe('Settings file path').optional(),
logLevel: z
.enum(['debug', 'info', 'warn', 'error', 'audit'])
.describe('Log level')
.optional(),
logFile: z.string().describe('Log file path').optional(),
mcpConfig: z
.union([z.string(), MCPConfigSchema])
.describe('MCP server configuration as JSON string, path to JSON file, or config object')
.optional(),
env: z
.record(z.string(), z.string())
.describe('Additional environment variables')
.optional(),
continue: z
.union([z.boolean(), z.string()])
.describe('Continue the most recent thread (true) or a specific thread by ID (string)')
.optional(),
toolbox: z.string().describe('Folder path with toolbox scripts').optional(),
})
.strict();
//# sourceMappingURL=types.js.map