dsg-one-sdk — DSG Spacetime developer client
Repository status: Spacetime-native implementation present in the canonical private production repo. Not published to npm yet. The currently published
dsg-one-sdk@0.1.1remains the legacy control-plane REST client until a separately authorized release migrates npm Trusted Publishing.
dsg-one-sdk is the JavaScript/TypeScript entrypoint for applications and AI agents that use DSG Spacetime governed execution.
AI Agent / Application
↓
DsgSpacetimeClient
↓
POST /mcp (JSON-RPC 2.0 / MCP 2025-06-18)
↓
discover → compose → execute → verify evidence
↓
identity / plan / Route / entitlement / approval-policy
↓
customer-owned adapter → real system
↓
tamper-evident evidenceThe SDK is a typed client. It does not bypass or replace the DSG Spacetime runtime.
Current pre-release implementation
The repository implementation exports:
DsgSpacetimeClientcreateClientFromEnv()health()initialize()listTools()discover()compose()execute()verifyEvidence()DsgSpacetimeErrorTypeScript request/response types
Transport behavior:
production default base URL is the recorded AWS DSG Spacetime endpoint;
non-loopback endpoints require HTTPS;
non-loopback endpoints require an API key;
Bearer authentication is attached by the SDK;
requests are timeout-bounded;
response size is bounded;
malformed JSON-RPC ids/results fail closed;
unsafe HTTP response bodies are not reflected into SDK error messages;
MCP tool
BLOCKoutcomes remain governed results rather than being converted into transport success/ALLOW.
Install for repository development
This package is intentionally marked private: true until the npm release migration is separately approved.
pack:check verifies that the candidate npm tarball contains only package.json, this README, and built dist/** files. Python runtime source, evidence, credentials, keys, and other private-repository material are not allowed into the package candidate.
Quick start
Invariant-first preflight and claim gate
The SDK also exports a deterministic invariant evaluator:
evaluateInvariantAction()evaluateInvariantBatch()summarizeInvariantBatch()
It enforces the client-side decision frame used by the 100-action regression matrix:
Input is validated before any decision and fails closed. evaluateInvariantAction() throws when:
an enum is not an exact literal (
riskmust below/high;postConditionmust bePASS/FAIL/UNKNOWN);a flag is not a real boolean;
a cost is not a finite non-negative number;
a field is inherited rather than an own property;
a field is an accessor (getter) rather than a plain data property.
Each field is read exactly once, so a getter or Proxy cannot answer differently between checks. approvalRequired can only add an approval requirement; false never waives the approval that policy requires for a high-risk action. A denied action that is nevertheless reported as executed is recorded as EXECUTED_DESPITE_DENY, not NOT_EXECUTED.
This helper is deliberately not an authorization bypass. An SDK result of ALLOW means only that the proposal passed local deterministic preflight. The DSG runtime remains authoritative for plan/Route/entitlement/approval checks and for the actual adapter execution.
The repository test suite contains a deterministic 100-action matrix. Its expected result is 70 preflight ALLOW, 30 preflight DENY, 65 verified success, 3 executed-but-claim-denied because evidence is absent, and 2 UNKNOWN because post-conditions are not verified.
Governed execution semantics
The important semantic difference from dsg-one-sdk@0.1.1 is that Spacetime does not merely return an ALLOW preflight result and leave the customer to execute the external action separately.
This stronger execution boundary is preserved by DsgSpacetimeClient.
Canonical runtime surface
Recorded production endpoint:
Runtime API:
MCP protocol:
Canonical tools:
Local runtime smoke
Private Runtime CI builds/tests the TypeScript package and then runs the compiled SDK against the real Python DSG Spacetime HTTP MCP implementation using an ephemeral loopback runtime.
The smoke covers:
health;
initialize;
tools/list;
discover;
compose →
BOUND+plan_hash;execute →
ALLOW+ adapter result + evidence;evidence verification;
wrong plan hash →
BLOCK;Route outside plan →
BLOCK;BLOCK cases do not append success evidence;
wrong-deployment entitlement startup fails closed;
invalid entitlement signature startup fails closed.
Unit tests also cover malformed MCP responses, mismatched JSON-RPC ids, bounded HTTP errors, response-size limits, and non-loopback TLS/auth configuration.
Release boundary
No npm release is created by the implementation PR.
Before publication ownership moves to this repository:
exact implementation CI must pass;
candidate tarball must pass the source/secret gate;
npm Trusted Publisher must be changed at npm provider state to this repository/workflow;
version must be explicitly approved;
exact published package must run against production
/mcpwith positive and negative governed cases.
0.2.0 remains the compatibility-oriented release candidate. A URL-only 0.1.2 migration remains rejected because legacy REST and Spacetime MCP are different contracts.
Canonical migration record
อัปเดตล่าสุด