feat(sdk): add MonitQuery and MonitAgent methods#13
Merged
Conversation
Adds MonitQueryDiagnoseInput/Output and MonitQueryRowsInput/Output along
with the Client methods that POST to /monit/query/diagnose and
/monit/query/rows. TimeStart/TimeEnd marshal into the nested
time_range:{start,end} object the server expects. Variable inner result
payloads (per-operation for diagnose, per-datasource for rows) stay as
json.RawMessage so callers can decode against their datasource shape
without paying for a fragile strongly-typed union.
Also ignores .worktrees/ and .claude/ so this feature-branch worktree
doesn't get committed back.
Adds MonitAgentCatalogInput/Output and MonitAgentInvokeInput/Output along with the Client methods that POST to /monit/tools/catalog and /monit/tools/invoke. Tool input_schema, per-tool params, and per-tool data payloads stay as json.RawMessage so the agent layer can pass schemas straight to an LLM and decode per-tool outputs on demand. MonitAgentInvokeOutput's doc comment spells out the three error layers real callers must distinguish (HTTP, request-level via dataEnvelope, per-tool via Results[i].Error) so partial-success isn't accidentally treated as total failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the SDK surface for Flashduty's monit endpoints so downstream consumers (
flashduty-cli,monit-query/monit-agentskills) can call them with strongly-typed inputs instead of raw JSON.MonitQueryDiagnose(ctx, in)→POST /monit/query/diagnose(pre-clustered RCA: log_patterns / metric_trends)MonitQueryRows(ctx, in)→POST /monit/query/rows(raw datasource passthrough)MonitAgentCatalog(ctx, in)→POST /monit/tools/catalog(per-target tool discovery)MonitAgentInvoke(ctx, in)→POST /monit/tools/invoke(batch tool invocation, up to 8 concurrent)Field-name conventions follow the Phase 2 plan (
fc-safari/docs/superpowers/plans/2026-05-27-flashduty-cli-phase2-auth.md) so cli + safari call-sites compile straight against these symbols.Design notes
time_rangemarshal shape: input has flatTimeStart int64+TimeEnd int64(unix sec); request body assembles{"time_range":{"start":...,"end":...}}inline atMonitQueryDiagnosetime. Mirrors howincidents.go:286builds nestedassigned_to. No publicMonitQueryTimeRangestruct — nothing else shares the shape.json.RawMessagefor: diagnoseResults(varies byoperation), rowsData(varies by datasource), monit-agent per-toolDataand per-toolParams. Strongly typing these would force a discriminated union the SDK doesn't need.MonitAgentInvokeOutputand exercised by tests.Why now
Unblocks Phase 2 of the flashduty-cli adoption — cli subcommands
monit-query diagnose|rowsandmonit-agent catalog|invokedepend on these methods.Test plan
go build ./... && go vet ./... && gofmt -l .clean