원클릭으로
architecture
Use when changing module structure, auth internals, conditional exports, or the HTTP and storage layers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when changing module structure, auth internals, conditional exports, or the HTTP and storage layers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when making Safeguard API calls, wiring auth strategies, or following SDK request and response patterns.
Use when wiring certificate-based A2A retrieval, brokering, or related Safeguard event listeners in Node.js.
Use when changing tsdown config, Azure Pipelines, publishing flow, or version derivation.
Use when working on Vitest configuration, appliance-backed tests, fixtures, or debugging test failures.
| name | architecture |
| description | Use when changing module structure, auth internals, conditional exports, or the HTTP and storage layers. |
| trigger | Working on internals, auth strategies, HTTP layer, module structure, platform-specific code |
safeguard.js serves Node.js AND Browser from a single codebase:
src/index.ts — exports everything including Node-only modulessrc/browser.ts — excludes CertificateAuth, PkceNonInteractive, NodeHttpClient, fs/tlsResolution is automatic via package.json conditional exports:
{
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"browser": "./dist/browser.js",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./browser": {
"types": "./dist/browser.d.ts",
"default": "./dist/browser.js"
},
"./events": {
"import": { "types": "./dist/events.d.ts", "default": "./dist/events.js" },
"require": { "types": "./dist/events.d.cts", "default": "./dist/events.cjs" }
}
}
}
The ./events subpath is opt-in — consumers who don't use SignalR never install @microsoft/signalr.
Layer 0 (no internal deps): types.ts, errors.ts, secret.ts, utils.ts
Layer 1 (depends on L0): storage/, http/
Layer 2 (depends on L0-1): auth/
Layer 3 (depends on all): client.ts, a2a/, events/
Layer 4 (barrel exports): index.ts, browser.ts
Build from leaves to root. Never introduce upward dependencies.
Auth interface, plug into clientconst agent = new Agent({
connect: {
ca: options.ca, // Custom CA cert
cert: options.cert, // Client certificate (mTLS)
key: options.key, // Client key
rejectUnauthorized: options.verify !== false,
},
});
Per-instance Agent — no global HTTPS agent mutation.
const response = await fetch(url, {
method, headers, body,
signal, // AbortController support
credentials: 'include', // For cookie-based auth if needed
});
withAutomaticReconnect() — built into SignalR 10accessTokenFactory: () => Promise<string> wired to auth tokenhttpClient option using undiciSafeguardError (base)
├── ApiError (HTTP errors from Safeguard API)
│ ├── AuthenticationError (401)
│ ├── AuthorizationError (403)
│ └── NotFoundError (404)
├── TransportError (network/connection failures)
└── ConfigurationError (invalid client options)
ApiError.fromResponse(status, body) factory parses Safeguard error JSON.