docs(node-sdk): audit package metadata, README, AGENTS

Drop the redundant .npmignore and publish dist only; README lists every client method and the real default key id; AGENTS.md records the shared plugin and test modules.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
雷电芽衣 committed 2026-09-02 22:34:30 -04:00
1 parent 90bea63eea
commit 9e1c0d9eb0
4 files changed
+36 -10

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
src/
tsconfig.json
.gitignore
node_modules/
*.tsbuildinfo
+10
View File
@@ -51,6 +51,16 @@ This repository owns the published `@elydora/sdk` package, its `elydora` CLI, lo
- Read runtime config, private keys, status cache, chain state, and error logs through physical-file descriptors with identity checks. Write cache and validated chain state atomically, and append error logs through no-follow owner-only descriptors. Preserve rollback artifacts when recovery cannot safely restore an original file and include the recovery path in the surfaced error.
- Resolve every agent runtime directory as one physical child of `~/.elydora`; reject separators, traversal segments, cross-platform reserved names, symbolic-link directories, and linked identity configs before writes or recursive removal. Validate stored directory identity before changing host CLI configuration, and require an explicit agent ID when discovery is ambiguous.
## Shared Modules
- `src/plugins/common.ts`: path and agent-id comparison, error helpers, size limits, `managedScriptReference`.
- `src/plugins/shell-command.ts`: POSIX and PowerShell quoting, encoded Windows commands, command parsers, `isNodeExecutable`.
- `src/plugins/managed-installation.ts` and `managed-transaction.ts`: preflight, prepare, and rollback-capable commit.
- `src/plugins/managed-runtime-status.ts`: runtime config and key validation; `managedRuntimeFilesExist` and `managedRuntimePresent`.
- `src/plugins/strict-json.ts` and `jsonc-edit.ts`: strict parsing and formatting-preserving JSONC edits.
- `test-support/harness.mjs`: process runner, fake API server, fixture root, plugin runner; provider helper files wrap it.
- Put logic used by two providers in a shared module; keep provider-specific rules in `<provider>-*.ts`.
## Verification
Run the focused adapter test during development, then execute all release gates before commit:
+25 -3
View File
@@ -124,7 +124,7 @@ const client = new ElydoraClient({
baseUrl?: string, // API base URL (default: https://api.elydora.com)
ttlMs?: number, // Operation TTL in ms (default: 30000)
maxRetries?: number, // Max retries on transient failures (default: 3)
kid?: string, // Key ID (default: {agentId}-key-v1)
kid?: string, // Key ID (default: {agentId}-key-1)
});
```
@@ -143,8 +143,13 @@ client.setToken(auth.token);
// Get current authenticated user profile
const { user } = await client.getMe();
// Issue a new API token (with optional TTL in seconds)
// Issue an API token (optional TTL in seconds) and use it for later calls
const { token, expires_at } = await client.issueApiToken(3600);
client.setToken(token);
// Rotate the API token the client currently holds
const rotated = await client.rotateApiToken();
client.setToken(rotated.token);
```
### Operations
@@ -183,6 +188,9 @@ const agent = await client.registerAgent({
// Get agent details
const details = await client.getAgent(agentId);
// Change the integration type
await client.updateAgent(agentId, 'cursor');
// Freeze an agent
await client.freezeAgent(agentId, 'security review');
@@ -245,7 +253,21 @@ const { keys } = await client.getJWKS();
```typescript
// Check API health (no authentication required)
const health = await client.health();
// health.status, health.version, health.protocol_version, health.timestamp
// health.status, health.version, health.protocol_version, health.capabilities, health.timestamp
// Check dependency health (D1, auth storage, R2, KV)
const deep = await client.deepHealth();
```
### Webhooks, Members, Admin Events
```typescript
const { webhooks } = await client.listWebhooks();
const { webhook } = await client.registerWebhook(url, ['agent.status_changed'], secret);
await client.deleteWebhook(webhook.webhook_id);
const { members } = await client.listMembers();
const { events } = await client.listAdminEvents(50);
```
### Client State
+1 -2
View File
@@ -8,8 +8,7 @@
"elydora": "dist/cli.js"
},
"files": [
"dist",
"scripts"
"dist"
],
"scripts": {
"build": "tsc && node scripts/postbuild.mjs",