Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

5.2 KB
Raw Blame

Batonly capability federation worker

Snapshot: 22 September 2026

MSO can act as Batonly's approved pull worker without giving Batonly an MSO bearer credential. This is the execution bridge for Batonly's Composio-like integration surface while Baton remains the project-management/evidence authority.

Runtime direction

The worker is opt-in by project configuration, not a host-global requirement.

  • It starts only when MSO can resolve the configured Batonly project and that exact project has an MCP server alias named baton.
  • MSO_BATONLY_FEDERATION_DISABLED=1 disables it explicitly.
  • Generic MSO installations with no Batonly project/MCP remain idle.
  • The worker uses the existing project MCP credential boundary. It never accepts a remote endpoint/token from a Batonly execution request.

Protocol

The Baton MCP side provides:

  • baton_federation_requests_list with pendingOnly=true
  • baton_federation_request_claim
  • baton_federation_request_complete
  • baton_federation_request_fail
  • baton_federation_worker_heartbeat

Polling is bounded (10 seconds base, exponential backoff up to 60 seconds). Baton owns atomic claim leases and retry attempts. MSO executes at most one claimed request per poll iteration.

MSO execution

For source=mso:

  1. Resolve the exact operation from canonical TOOLS_BY_NAME.
  2. Validate credential-free bounded arguments.
  3. Require Batonly's request scope to equal the tool's declared scope.
  4. Require explicit confirmation for every write/exec operation.
  5. Refuse recursive project_mcp_call back into the Baton MCP.
  6. Consume an exact, one-use local Owner approval; remote scope and confirmation are only request data.
  7. Execute through executeCapabilityCall with principal batonly-federation, preserving required args, rate limits, workflow correlation, activity and audit.
  8. Sanitize/bound the result before returning it to Baton.

Local Owner approval

Both sources deny execution by default. An Owner using the trusted local terminal must review the entire request and resolve its projectId to an exact local project. Approval is a private entry in ~/.mso/private/federation-approvals.json (directory 0700, file 0600, owned by the MSO Unix user), keyed by the request's exact id:

{
  "reviewed-request-id": {
    "principal": "batonly-federation",
    "requestDigest": "sha256-of-the-exact-reviewed-request",
    "expiresAt": 0
  }
}

Compute requestDigest with the exported federationRequestDigest(request) from lib/federation/local-approval.ts, using the reviewed id, projectId, source (mso or si-coder), operation, scope and arguments. Set expiresAt to a future Unix timestamp in milliseconds, at most 24 hours away; zero in the example intentionally grants nothing. Make updates atomically under withSecurityStoreLock using the same private path. Do not copy a remote digest without reviewing the corresponding arguments. Removing an unused entry revokes it; changing any reviewed field requires a new approval. MSO persists usedAt before dispatch, so retries and concurrent replays cannot reuse the entry.

MSO project arguments and execution directories must match the approved local project. Durable jobs and agent/workflow delegation are unavailable through federation until they can carry and revalidate the local grant. Local approval does not override the deployment capability ceiling or credential filters. Never keep this approval file in a project or accept it from Baton.

SI-Coder execution

The worker resolves the reviewed installed SI-Coder package through MSO's managed installation path. It does not execute command strings supplied by Batonly.

Current live runtime evidence is SI-Coder 0.9.8 with 55 machine functions, including sc.flow.list/show/validate/run. Arguments are validated against the discovered machine function JSON Schema before invocation. sc.flow.run, sc.update, and sc.doku.mcp.call are treated as exec scope; mutating user/provider/memory/recipe/data/mail functions are write scope; remaining functions are read scope.

Provider credentials continue to use SI-Coder/MSO named connections. Federation arguments and results reject/redact credential-shaped keys and secret-like values.

Operability

  • Node instrumentation starts the worker after MSO boot only when the Baton project MCP exists.
  • GET /api/v1/federation/status is owner-authenticated and no-store, exposing safe worker status only.
  • Heartbeats report worker/MSO/SI-Coder versions and capability counts, never credential values.
  • The Node executable for portable stdio MCP manifests is resolved to the trusted current process.execPath; this avoids scrubbed-service-PATH failures such as spawn node ENOENT.

Acceptance

Do not claim runtime parity until all are true against production Baton:

  1. worker heartbeat is fresh;
  2. one MSO read completes queue → claim → execute → complete;
  3. one SI-Coder read completes the same path;
  4. unconfirmed write/exec is rejected;
  5. credential-shaped input is rejected;
  6. duplicate/invalid claim fails closed;
  7. removing/revoking the Baton project MCP connection makes polling fail closed;
  8. Batonly reports the completed result and truthful worker availability.