magus v0.4.2 is out. See what's new
¶ View generated markdown
2 min read

Daemon API

The daemon serves its API over Connect, which speaks three protocols on one endpoint: Connect's own browser-native HTTP, gRPC, and gRPC-Web. Anything that can send an HTTP request can call it, so a generated client is optional.

This reference is generated from the .proto contract, so it cannot drift from what the daemon serves. The Console is a reference frontend and has no privileged access to the API. A frontend you build can use the same published contract. Every service, method, message, and enum heading below links to the exact line in the .proto source that defines it.

Before you call anything

Start the daemon with magus server start. See the console reference for the endpoint and port, and the auth diagnostics for what a rejected token means. Requests carry a hashed, expiring mgs_ bearer token.

Services

Service Methods Package
ActivityService 2 magus.activity.v1alpha1
GraphService 7 magus.graph.v1alpha1
InsightService 1 magus.insight.v1alpha1
JobService 2 magus.job.v1alpha1
MemoryService 5 magus.memory.v1alpha1
MetricsService 2 magus.metrics.v1alpha1
NotesService 2 magus.notes.v1alpha1
StatusService 2 magus.status.v1alpha1
TokenService 3 magus.token.v1alpha1
ToolService 1 magus.tool.v1alpha1
ViewerService 7 magus.viewer.v1alpha1

Shared types

A package with no service of its own: its types are documented here instead of on a service page, and a service that uses one links to it.

Package File
magus.query.v1alpha1 proto/magus/query/v1alpha1/query.proto

Calling a method without a generated client

A unary Connect method is a plain POST with a JSON body, so curl is a complete client. protojson, not the .proto field name, decides the wire shape:

  • Field names are lowerCamelCase (page_size in the tables below is pageSize on the wire).
  • int64, uint64, fixed64, and sfixed64 values are JSON strings, not numbers (large values overflow a JSON number's safe integer range).
  • bytes is base64. A Timestamp is an RFC 3339 string; a Duration is a string like "1.5s".
  • An enum serializes as its value name ("TOKEN_SCOPE_CONNECTOR"), not its number.
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MAGUS_TOKEN" \
  -d '{"pageSize":0,"pageToken":""}' \
  http://127.0.0.1:7391/magus.activity.v1alpha1.ActivityService/ListActivityEvents

The path is always /<package>.<Service>/<Method>, which every page below states per method. A request body shown as {} takes no fields; a longer one is a shallow skeleton (top-level scalar and enum fields only) and does not attempt to satisfy every field's constraints - a string.pattern rule still needs a value matching that pattern.

Streaming methods

A server-streaming method returns a sequence of messages over one HTTP response rather than one body, so a single curl -d request cannot cleanly demux it. Use a generated Connect client, or a tool built for streaming RPCs such as grpcurl (grpcurl -plaintext ... /magus.metrics.v1alpha1.MetricsService/StreamMetrics). Streaming methods:

generatedproto/magus/**/*.protoapiprotoprotobufconnectgrpcdaemonreference
Last updated (4f8cc295)
Earlier changes on this page (7)

Full history ↗ · Blame source ↗

Glossary

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Service

A long-running or shared process magus manages across runs, distinct from a one-shot target. See services.

Daemon

The background magus host that owns shared state such as services and the warm knowledge graph. See daemon.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Insight

The reports magus derives over the graph and history (hotspots, affinity, ownership, trend, volatility, unreferenced). See insight.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.