oneuptime/Copilot/README.md
Simon Larsen 46e6a37d71
Some checks are pending
Build / docker-build-docs (push) Waiting to run
Build / docker-build-accounts (push) Waiting to run
Build / docker-build-isolated-vm (push) Waiting to run
Build / docker-build-home (push) Waiting to run
Build / docker-build-worker (push) Waiting to run
Build / docker-build-workflow (push) Waiting to run
Build / docker-build-api-reference (push) Waiting to run
Build / docker-build-otel-collector (push) Waiting to run
Build / docker-build-app (push) Waiting to run
Build / docker-build-copilot (push) Waiting to run
Build / docker-build-e2e (push) Waiting to run
Build / docker-build-admin-dashboard (push) Waiting to run
Build / docker-build-dashboard (push) Waiting to run
Build / docker-build-probe (push) Waiting to run
Build / docker-build-probe-ingest (push) Waiting to run
Build / docker-build-server-monitor-ingest (push) Waiting to run
Build / docker-build-telemetry (push) Waiting to run
Build / docker-build-incoming-request-ingest (push) Waiting to run
Build / docker-build-status-page (push) Waiting to run
Build / docker-build-test-server (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Common Jobs / helm-lint (push) Waiting to run
Common Jobs / js-lint (push) Waiting to run
Compile / compile-accounts (push) Waiting to run
Compile / compile-isolated-vm (push) Waiting to run
Compile / compile-common (push) Waiting to run
Compile / compile-app (push) Waiting to run
Compile / compile-home (push) Waiting to run
Compile / compile-worker (push) Waiting to run
Compile / compile-workflow (push) Waiting to run
Compile / compile-api-reference (push) Waiting to run
Compile / compile-docs-reference (push) Waiting to run
Compile / compile-copilot (push) Waiting to run
Compile / compile-nginx (push) Waiting to run
Compile / compile-infrastructure-agent (push) Waiting to run
Compile / compile-admin-dashboard (push) Waiting to run
Compile / compile-dashboard (push) Waiting to run
Compile / compile-e2e (push) Waiting to run
Compile / compile-probe (push) Waiting to run
Compile / compile-probe-ingest (push) Waiting to run
Compile / compile-server-monitor-ingest (push) Waiting to run
Compile / compile-telemetry (push) Waiting to run
Compile / compile-incoming-request-ingest (push) Waiting to run
Compile / compile-status-page (push) Waiting to run
Compile / compile-test-server (push) Waiting to run
Compile / compile-mcp (push) Waiting to run
Terraform Provider Generation / generate-terraform-provider (push) Waiting to run
Push Test Images to Docker Hub and GitHub Container Registry / generate-build-number (push) Waiting to run
Push Test Images to Docker Hub and GitHub Container Registry / read-version (push) Waiting to run
Push Test Images to Docker Hub and GitHub Container Registry / publish-mcp-server (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / nginx-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / e2e-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / test-server-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / otel-collector-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / isolated-vm-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / home-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / status-page-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / test-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / probe-ingest-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / server-monitor-ingest-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / incoming-request-ingest-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / telemetry-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / probe-docker-image-deploy (push) Blocked by required conditions
OpenAPI Spec Generation / generate-openapi-spec (push) Waiting to run
Push Test Images to Docker Hub and GitHub Container Registry / dashboard-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / admin-dashboard-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / app-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / api-reference-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / accounts-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / worker-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / copilot-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / workflow-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / docs-docker-image-deploy (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / publish-terraform-provider (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / test-helm-chart (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / test-e2e-test-saas (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / test-e2e-test-self-hosted (push) Blocked by required conditions
Push Test Images to Docker Hub and GitHub Container Registry / infrastructure-agent-deploy (push) Blocked by required conditions
Common Test / test (push) Waiting to run
Incoming Request Ingest Test / test (push) Waiting to run
MCP Server Test / test (push) Waiting to run
ProbeIngest Test / test (push) Waiting to run
Probe Test / test (push) Waiting to run
Telemetry Test / test (push) Waiting to run
Tests / test-app (push) Waiting to run
Tests / test-home (push) Waiting to run
Tests / test-worker (push) Waiting to run
feat: rename CLI command from oneuptime-copilot-agent to oneuptime-copilot
2025-12-08 19:20:09 +00:00

5.5 KiB
Raw Blame History

OneUptime Copilot Agent

A standalone CLI coding agent that mirrors the autonomous workflows we use inside VS Code Copilot Chat. It connects to LM Studio, Ollama, OpenAI, or Anthropic chat-completion models, inspects a workspace, reasons about the task, and uses a toolbox (file/patch editing, search, terminal commands) to complete coding requests.

Prerequisites

  • Node.js 18+
  • At least one supported LLM provider:
    • LM Studio exposing a chat completions endpoint (for example http://localhost:1234/v1/chat/completions).
    • Ollama running locally with the OpenAI-compatible HTTP server (default http://localhost:11434/v1/chat/completions).
    • OpenAI API access and an API key with chat-completions enabled.
    • Anthropic API access and an API key with Messages API enabled.
  • The workspace you want the agent to modify must already exist locally.

Installation

cd Copilot
npm install
npm run build
npm link   # optional, provides the global oneuptime-copilot command

Usage

LM Studio (local HTTP endpoint)

oneuptime-copilot \
  --prompt "Refactor auth middleware and add unit tests" \
  --provider lmstudio \
  --model http://localhost:1234/v1/chat/completions \
  --model-name openai/gpt-oss-20b \
  --workspace-path ./

OpenAI (hosted)

oneuptime-copilot \
  --prompt "Refactor auth middleware and add unit tests" \
  --provider openai \
  --model-name gpt-4o-mini \
  --api-key "$OPENAI_API_KEY" \
  --workspace-path ./

Anthropic (hosted)

oneuptime-copilot \
  --prompt "Refactor auth middleware and add unit tests" \
  --provider anthropic \
  --model-name claude-3-5-sonnet-latest \
  --api-key "$ANTHROPIC_API_KEY" \
  --workspace-path ./

Ollama (local OpenAI-compatible endpoint)

oneuptime-copilot \
  --prompt "Refactor auth middleware and add unit tests" \
  --provider ollama \
  --model-name mistral:7b-instruct \
  --workspace-path ./

CLI options

Flag Description
--prompt Required. Natural language description of the task.
--provider Selects the LLM backend: lmstudio (default), ollama, openai, or anthropic.
--model Endpoint override. Required for lmstudio; optional for other providers (defaults to their hosted or local API).
--workspace-path Required. Absolute or relative path to the repo the agent should use.
--model-name Provider-specific model identifier (default lmstudio).
--temperature Sampling temperature (default 0.1).
--max-iterations Maximum agent/tool-call loops before stopping (default 100).
--timeout LLM HTTP timeout per request in milliseconds (default 120000).
--api-key Required for OpenAI/Anthropic; optional bearer token for secured LM Studio/Ollama endpoints.
--log-level debug, info, warn, or error (default info).
--log-file Optional file path. When provided, all logs are appended to this file in addition to stdout.

Provider cheatsheet:

  • lmstudio Always pass a full HTTP endpoint via --model. API keys are optional.
  • ollama Defaults to http://localhost:11434/v1/chat/completions; override with --model when remote tunneling. API keys are optional.
  • openai Provide --api-key and --model-name (for example gpt-4o-mini). --model is optional and defaults to https://api.openai.com/v1/chat/completions.
  • anthropic Provide --api-key and --model-name (for example claude-3-5-sonnet-latest). --model falls back to https://api.anthropic.com/v1/messages when omitted.

Debug logging

Pass --log-file when running the agent to persist verbose debugging output (including debug level messages) for later inspection:

oneuptime-copilot \
  --prompt "Track flaky jest tests" \
  --provider lmstudio \
  --model http://localhost:1234/v1/chat/completions \
  --workspace-path ./ \
  --log-file ./logs/copilot-agent-debug.log

The agent will create any missing parent directories and continuously append to the specified file while still streaming logs to stdout.

Architecture snapshot

  • src/agent Orchestrates the conversation loop, builds the system prompt (inspired by the VS Code Copilot agent), snapshots the workspace, and streams messages to the configured provider.
  • src/tools Implements the toolbelt (list_directory, read_file, search_workspace, apply_patch, write_file, run_command). These wrap Common utilities (Execute, LocalFile, Logger) to stay consistent with other OneUptime services.
  • src/llm Contains the LM Studio/Ollama/OpenAI-compatible clients plus the native Anthropic adapter, all using undici with timeout + error handling.
  • src/@types/Common Lightweight shim typings so TypeScript consumers get the pieces of Common they need without re-compiling that entire package.

Development scripts

npm run build   # Compile TypeScript -> build/dist
npm run dev     # Run with ts-node for quick experiments

For example:

npm run dev -- --prompt "Write tests for this project. These tests should be in Jest and TypeScript." \
  --provider lmstudio \
  --model http://localhost:1234/v1/chat/completions \
  --model-name deepseek/deepseek-r1-0528-qwen3-8b \
  --workspace-path ./ \
  --log-file ./copilot-agent-debug.log

The agent intentionally mirrors Copilots workflow: it iteratively plans, reads files, edits them through patches or full rewrites, and executes commands/tests via the terminal tool. Logs stream to stdout so you can follow each tool invocation in real time.