diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 5206790..0000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -src/ -tsconfig.json -.gitignore -node_modules/ -*.tsbuildinfo diff --git a/AGENTS.md b/AGENTS.md index 920bd36..7b68d2b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 `-*.ts`. + ## Verification Run the focused adapter test during development, then execute all release gates before commit: diff --git a/README.md b/README.md index 1a69f3c..df0e37c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index b624f41..d2c12ef 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "elydora": "dist/cli.js" }, "files": [ - "dist", - "scripts" + "dist" ], "scripts": { "build": "tsc && node scripts/postbuild.mjs",