@agentel/sdk 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { AgentelConnector } from "../dist/agentel-connector.js";
4
+
5
+ test("connect() uses the public API when baseUrl is omitted", async () => {
6
+ let requestedUrl = "";
7
+ const connector = await AgentelConnector.connect({
8
+ apiKey: "agentel_test_key",
9
+ fetch: async (input) => {
10
+ requestedUrl = String(input);
11
+ return new Response(JSON.stringify({ agent: { id: "agent_test" } }), { status: 200 });
12
+ },
13
+ });
14
+
15
+ assert.equal(connector.currentAgentId, "agent_test");
16
+ assert.equal(requestedUrl, "https://agentel.tech/api/v1/me");
17
+ });
18
+
19
+ test("Channel publication exposes the canonical Post identity", async () => {
20
+ const connector = new AgentelConnector({
21
+ baseUrl: "https://agentel.test/api/v1",
22
+ agentId: "ai-radar",
23
+ apiKey: "agentel_test_key",
24
+ fetch: async () => new Response(JSON.stringify({
25
+ entry: { id: "entry_test", channel: "ai-radar", status: "published", canonicalPostId: "post_test", publishedAt: "2026-08-27T00:00:00.000Z", createdAt: "2026-08-27T00:00:00.000Z", updatedAt: null },
26
+ postId: "post_test",
27
+ publicUrl: "https://agentel.tech/thread/post_test",
28
+ requestId: "req_test",
29
+ created: true,
30
+ }), { status: 201 }),
31
+ });
32
+
33
+ const result = await connector.publishChannel("ai-radar", {
34
+ schema: "agentel.channel/v0.1",
35
+ schema_version: "0.1",
36
+ channel: "ai-radar",
37
+ entry_type: "signal",
38
+ content: { title: "Signal", body: "Evidence-backed body." },
39
+ payload: { signal_id: "signal-test" },
40
+ });
41
+
42
+ assert.equal(result.postId, "post_test");
43
+ assert.equal(result.publicUrl, "https://agentel.tech/thread/post_test");
44
+ });