Files
Dialectic.PlexumPlugin/internal/hfprecheck/precheck.go
hzhang c5593e3961 initial drop: Dialectic.PlexumPlugin v0.1
Port of Dialectic.OpenclawPlugin to the Plexum SDK. 8 dialectic_*
tools wired to Dialectic.Backend over HTTP:

  list_topics, topic_detail, list_arguments, propose_topic,
  signup, post_argument, submit_verdict, view_verdict

Differences from the OpenClaw port worth noting:

  - Per-agent API key storage: OpenClaw used secret-mgr (one entry
    per agent's keyspace). Plexum has no secret-mgr; v1 stores
    keys directly in plugin config (apiKey + agentKeys map).

  - Agent identity at tool dispatch: OpenClaw framework surfaces
    ctx.agentId; Plexum SDK doesn't yet plumb the calling agent
    through ToolPlugin.CallTool. v1 falls back to
    config.defaultAgentID — same stop-gap HarborForge.PlexumPlugin
    is on. Tracked as upstream SDK work.

  - HF on_call coverage pre-check on signup: stub that always
    returns "skipped", matching OpenClaw v1's behavior (HarborForge
    never shipped the cross-plugin coverage query). pre_validated
    is sent as false so the backend records audit honestly.
    DIALECTIC_PLUGIN_BYPASS_HF=1 env retains parity with OpenClaw.

  - Activation: lazy (no background services, unlike HarborForge's
    eager-spawn for the calendar scheduler + monitor bridge).

Backend client follows the bearer-auth contract OpenClaw's
backend-client.ts established; endpoint shapes are unchanged.
2026-06-03 11:57:24 +01:00

33 lines
1.3 KiB
Go

// Package hfprecheck implements the HF on_call coverage check used by
// dialectic_signup. The OpenClaw plugin relied on a cross-plugin global
// (`globalThis.__hfAgentStatus.hasOnCallCovering`) which HarborForge
// hadn't shipped yet — so v1 there always degraded to "skipped".
//
// Plexum has no cross-plugin globals at all. v1 here is unconditionally
// "skipped" (same audit-only outcome as OpenClaw v1). When HarborForge
// the backend grows a public coverage endpoint we'll wire it here.
package hfprecheck
import "os"
type Result struct {
OK bool // false ⇒ block signup
Reason string // populated when OK=false
Source string // "hf" | "skipped"
}
// Check is a no-op gate for v1. Returns OK=true, source="skipped"
// unconditionally; signups are sent to the backend with
// pre_validated=false so the audit trail records the gap honestly.
//
// DIALECTIC_PLUGIN_BYPASS_HF=1 forces "skipped" even after a future
// implementation lands — matches the OpenClaw plugin's escape hatch
// for sim environments without provisioned on_call schedules.
func Check(agentID, debateStartAt, debateEndAt string) Result {
if os.Getenv("DIALECTIC_PLUGIN_BYPASS_HF") == "1" {
return Result{OK: true, Source: "skipped"}
}
// No host-side coverage query yet; degrade to audit-only.
return Result{OK: true, Source: "skipped"}
}