Documentation
¶
Overview ¶
Package systemnotices injects platform-level system notices into agent-bound messages at the Adapter seam (#944).
The disk-pressure nudge was originally implemented inside the proxy's raw-transport rewrite, which chat traffic abandoned twice (US-63.7 moved chat onto the Adapter, #755 moved Send off the V2 queue) — each migration silently orphaned the feature. A must-apply-to-every-message concern belongs at the ONE seam every entrypoint (HTTP chat, MCP, SDK, future triggers) shares: pkg/agent.Adapter. Wrap() decorates that seam at its single wiring point (app.go).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Notice ¶
Notice builds the system-notice text injected ahead of the user's message. The notice is addressed to the agent (it tells the model what to do) but reads naturally if it surfaces in the transcript.
- Warning (>=90%): nudge the user; no deletion authority.
- Critical (>=95%): stronger; may delete ONLY easily-replaceable files (build artifacts, caches); logs are the last resort because they cannot be reproduced; user approval required.
Wording is byte-for-byte the original proxy_disk_pressure text — this function is its new single source.
func Ratio ¶
Ratio computes the used fraction of the workspace disk. Returns 0 when total is unknown/non-positive so a not-yet-scraped workspace never trips the warning (fail-safe).
func Thresholds ¶
Thresholds returns the active (warning, critical) ratios.
func Wrap ¶
func Wrap(a agent.Adapter, usage WorkspaceDiskUsage) agent.Adapter
Wrap returns an agent.Adapter that prepends the disk-pressure system notice to every Send/SendAsync text at or above the warning threshold. All other methods delegate untouched. A nil usage source disables injection (the decorator becomes a pass-through).
Types ¶
type Level ¶
type Level string
Level is a disk-pressure tier.
func LevelForRatio ¶
LevelForRatio maps a usage ratio to a pressure level.
type WorkspaceDiskUsage ¶
type WorkspaceDiskUsage interface {
DiskUsage(ctx context.Context, workspaceID string) (usedBytes, totalBytes int64, err error)
}
WorkspaceDiskUsage sources a workspace's disk usage. Implemented at the wiring layer over the Workspace CRD status (the same data the controller mirrors from agentd /v1/statusz and the frontend renders) — no new telemetry.