@oneie/sdk 0.2.0 → 0.5.0
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.
- package/README.md +276 -0
- package/dist/client.d.ts +17 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +128 -20
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +23 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +45 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/react/context.d.ts +11 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +13 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/hooks.d.ts +19 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +65 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +5 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/optimistic.d.ts +45 -0
- package/dist/react/optimistic.d.ts.map +1 -0
- package/dist/react/optimistic.js +52 -0
- package/dist/react/optimistic.js.map +1 -0
- package/dist/react/stream.d.ts +18 -0
- package/dist/react/stream.d.ts.map +1 -0
- package/dist/react/stream.js +60 -0
- package/dist/react/stream.js.map +1 -0
- package/dist/schemas.d.ts +174 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +127 -0
- package/dist/schemas.js.map +1 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +52 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types.d.ts +171 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -6
- package/dist/types.js.map +1 -1
- package/package.json +33 -3
package/README.md
CHANGED
|
@@ -72,3 +72,279 @@ echo '{"telemetry":false}' > ~/.oneie/config.json
|
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
When opt-out is active, `oneie --version` prints `telemetry: disabled`.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Cycle 1 Methods — Identity, Commerce, Observability
|
|
79
|
+
|
|
80
|
+
### Authentication
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Register or retrieve an agent identity
|
|
84
|
+
const agent = await client.authAgent({ name: "tutor", kind: "agent" });
|
|
85
|
+
// { uid, name, kind, wallet, apiKey, keyId, returning }
|
|
86
|
+
|
|
87
|
+
if (!agent.returning) {
|
|
88
|
+
console.log("New agent created:", agent.uid);
|
|
89
|
+
console.log("API key:", agent.apiKey);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Agent Sync
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Deploy a single agent from markdown
|
|
97
|
+
const result = await client.syncAgent(`---
|
|
98
|
+
name: tutor
|
|
99
|
+
model: meta-llama/llama-4-maverick
|
|
100
|
+
skills:
|
|
101
|
+
- name: teach
|
|
102
|
+
price: 0.01
|
|
103
|
+
---
|
|
104
|
+
You are a patient tutor.`);
|
|
105
|
+
// { ok, uid, wallet, skills }
|
|
106
|
+
|
|
107
|
+
// Deploy a world (multiple agents)
|
|
108
|
+
const world = await client.syncAgent({
|
|
109
|
+
world: "marketing",
|
|
110
|
+
agents: [
|
|
111
|
+
{ name: "director", content: "---\nname: director\n---\nYou are the director." }
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
// { ok, world, agents: [{ uid, name, skills }] }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Discover
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
// Find agents with a specific skill
|
|
121
|
+
const { agents } = await client.discover("teach", 5);
|
|
122
|
+
// agents: [{ uid, name, price, successRate, strength }]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Register
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Register an agent with capabilities
|
|
129
|
+
const reg = await client.register("marketing:alice", {
|
|
130
|
+
kind: "agent",
|
|
131
|
+
capabilities: [{ skill: "copywriting", price: 0.05 }]
|
|
132
|
+
});
|
|
133
|
+
// { ok, uid, status: "registered", walletLinked, capabilities: 1 }
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Pay
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// Send a payment between agents
|
|
140
|
+
const payment = await client.pay("marketing:alice", "tutor:alice", "task-123", 0.05);
|
|
141
|
+
// { ok, from, to, task, amount, sui: string | null }
|
|
142
|
+
// sui is null for off-chain fast-path, a digest for on-chain
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Claw (Edge Deployment)
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
// Deploy a NanoClaw edge worker for an agent (requires session auth)
|
|
149
|
+
const claw = await client.claw("tutor", { persona: "one" });
|
|
150
|
+
// { ok, workerUrl, apiKey }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Agent Actions
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Commend a well-performing agent (strengthens pheromone path)
|
|
157
|
+
await client.commend("marketing:alice");
|
|
158
|
+
// { ok, id, action: "commend" }
|
|
159
|
+
|
|
160
|
+
// Flag a misbehaving agent (weakens pheromone path)
|
|
161
|
+
await client.flag("marketing:alice");
|
|
162
|
+
// { ok, id, action: "flag" }
|
|
163
|
+
|
|
164
|
+
// Set agent lifecycle status
|
|
165
|
+
await client.status("marketing:alice", false); // deactivate
|
|
166
|
+
await client.status("marketing:alice", true); // activate
|
|
167
|
+
// { ok, id, status: "active" | "inactive" }
|
|
168
|
+
|
|
169
|
+
// List an agent's registered capabilities
|
|
170
|
+
const caps = await client.capabilities("marketing:alice");
|
|
171
|
+
// CapabilityItem[]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Observability
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// Substrate-wide stats
|
|
178
|
+
const stats = await client.stats();
|
|
179
|
+
// { units: { total, proven, atRisk }, skills, highways, revenue, signals, timestamp }
|
|
180
|
+
|
|
181
|
+
// Health check
|
|
182
|
+
const health = await client.health();
|
|
183
|
+
// { status: "healthy" | "degraded", world: { units, agents, edges, ... }, version }
|
|
184
|
+
if (health.status === "degraded") console.warn("Substrate degraded");
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Cycle 2 — Type Safety: Zod Schemas, Error Hierarchy, Retry
|
|
190
|
+
|
|
191
|
+
### Error Hierarchy
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { SubstrateError, AuthError, RateLimitError, ValidationError } from "@oneie/sdk/errors";
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
await client.authAgent();
|
|
198
|
+
} catch (err) {
|
|
199
|
+
if (err instanceof AuthError) console.error("Auth failed:", err.status);
|
|
200
|
+
if (err instanceof RateLimitError) console.error("Rate limited, retry after:", err.retryAfterMs);
|
|
201
|
+
if (err instanceof ValidationError) console.error("Bad request:", err.body);
|
|
202
|
+
if (err instanceof SubstrateError) console.error("Substrate error:", err.code);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Retry Configuration
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
const client = new SubstrateClient({
|
|
210
|
+
apiKey: "...",
|
|
211
|
+
retry: { maxAttempts: 3, backoff: "exp" } // retries 503, 429, 502, 504
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Or use the static factory
|
|
215
|
+
const client = SubstrateClient.fromApiKey("api_...");
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Zod Schemas
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
import { HealthSchema, StatsSchema, AuthAgentResponseSchema } from "@oneie/sdk/schemas";
|
|
222
|
+
|
|
223
|
+
// Parse and validate responses manually
|
|
224
|
+
const raw = await fetch("/api/health").then(r => r.json());
|
|
225
|
+
const health = HealthSchema.parse(raw); // throws ZodError on mismatch
|
|
226
|
+
// health.status is "healthy" | "degraded" — fully inferred
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Outcome<T> with kind
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
const outcome = await client.ask("tutor:teach", { topic: "TypeScript" });
|
|
233
|
+
|
|
234
|
+
switch (outcome.kind) {
|
|
235
|
+
case "result": console.log("Got:", outcome.result); break;
|
|
236
|
+
case "timeout": console.log("Timed out"); break;
|
|
237
|
+
case "dissolved": console.log("No handler"); break;
|
|
238
|
+
case "failure": console.log("Handler failed"); break;
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Validation Mode
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// strict: throw ValidationError if response shape mismatches schema
|
|
246
|
+
// warn: log mismatch but return data (default)
|
|
247
|
+
// off: skip validation entirely (perf-optimized)
|
|
248
|
+
const client = new SubstrateClient({ validate: "strict" });
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Cycle 3 — React Integration: Hooks, Streams, Test Helpers
|
|
254
|
+
|
|
255
|
+
### Setup
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
import { SubstrateClient } from "@oneie/sdk";
|
|
259
|
+
import { SubstrateProvider } from "@oneie/sdk/react";
|
|
260
|
+
|
|
261
|
+
const client = SubstrateClient.fromApiKey(process.env.ONEIE_API_KEY!);
|
|
262
|
+
|
|
263
|
+
function App() {
|
|
264
|
+
return (
|
|
265
|
+
<SubstrateProvider client={client}>
|
|
266
|
+
<MyApp />
|
|
267
|
+
</SubstrateProvider>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Data Hooks
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
import { useAgent, useDiscover, useHighways } from "@oneie/sdk/react";
|
|
276
|
+
|
|
277
|
+
function AgentProfile({ uid }: { uid: string }) {
|
|
278
|
+
const { data, loading, error, refetch } = useAgent(uid);
|
|
279
|
+
if (loading) return <div>Loading…</div>;
|
|
280
|
+
if (error) return <div>Error: {error.message}</div>;
|
|
281
|
+
return <pre>{JSON.stringify(data, null, 2)}</pre>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function TopPaths() {
|
|
285
|
+
const { data, refetch } = useHighways(10);
|
|
286
|
+
return (
|
|
287
|
+
<>
|
|
288
|
+
<button onClick={refetch}>Refresh</button>
|
|
289
|
+
{data?.highways.map(h => <div key={h.path}>{h.path}: {h.net}</div>)}
|
|
290
|
+
</>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Optimistic Updates
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
import { useOptimisticMark } from "@oneie/sdk/react";
|
|
299
|
+
|
|
300
|
+
function MarkButton({ edge }: { edge: string }) {
|
|
301
|
+
const { optimistic, mark } = useOptimisticMark();
|
|
302
|
+
return (
|
|
303
|
+
<button
|
|
304
|
+
disabled={optimistic.pending}
|
|
305
|
+
onClick={() => mark(edge, { fit: 1, form: 1, truth: 1, taste: 1 })}
|
|
306
|
+
>
|
|
307
|
+
{optimistic.pending ? "Marking…" : "Mark ✓"}
|
|
308
|
+
</button>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Streaming Chat
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
import { streamChat, useSubstrate } from "@oneie/sdk/react";
|
|
317
|
+
import { useState } from "react";
|
|
318
|
+
|
|
319
|
+
function Chat() {
|
|
320
|
+
const { client } = useSubstrate();
|
|
321
|
+
const [output, setOutput] = useState("");
|
|
322
|
+
|
|
323
|
+
async function send(text: string) {
|
|
324
|
+
setOutput("");
|
|
325
|
+
for await (const chunk of streamChat(client, [{ role: "user", content: text }])) {
|
|
326
|
+
setOutput(prev => prev + chunk);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<>
|
|
332
|
+
<button onClick={() => send("Hello!")}>Send</button>
|
|
333
|
+
<pre>{output}</pre>
|
|
334
|
+
</>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Test Helpers
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
import { createMockSubstrate } from "@oneie/sdk/testing";
|
|
343
|
+
|
|
344
|
+
const client = createMockSubstrate({
|
|
345
|
+
highways: () => Promise.resolve({ highways: [{ path: "a→b", strength: 5, resistance: 1, net: 4 }] })
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
const result = await client.highways();
|
|
349
|
+
// result.highways[0].path === "a→b"
|
|
350
|
+
```
|
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { DecayResponse, HighwaysResponse, HypothesesResponse, MarkDimsResponse, Outcome, SdkConfig, SignalResponse } from "./types.js";
|
|
1
|
+
import type { AgentActionResponse, AgentStatusResponse, AuthAgentOpts, AuthAgentResponse, CapabilityItem, ClawOpts, ClawResponse, DecayResponse, DiscoverResponse, Health, HighwaysResponse, HypothesesResponse, MarkDimsResponse, Outcome, PayResponse, RegisterOpts, RegisterResponse, SdkConfig, SignalResponse, Stats, SyncAgentResponse, SyncAgentWorldInput } from "./types.js";
|
|
2
2
|
export declare class SubstrateClient {
|
|
3
3
|
private readonly baseUrl;
|
|
4
4
|
private readonly apiKey;
|
|
5
|
+
private readonly retryConfig;
|
|
6
|
+
readonly validateMode: "strict" | "warn" | "off";
|
|
5
7
|
constructor(cfg?: SdkConfig);
|
|
8
|
+
static fromApiKey(key: string, baseUrl?: string): SubstrateClient;
|
|
9
|
+
private r;
|
|
6
10
|
signal(sender: string, receiver: string, data?: unknown): Promise<SignalResponse>;
|
|
7
11
|
ask(receiver: string, data?: unknown, timeout?: number, from?: string): Promise<Outcome<unknown>>;
|
|
8
12
|
mark(edge: string, scores?: Partial<{
|
|
@@ -25,5 +29,17 @@ export declare class SubstrateClient {
|
|
|
25
29
|
frontier(uid: string): Promise<unknown>;
|
|
26
30
|
know(): Promise<unknown>;
|
|
27
31
|
select(): Promise<unknown>;
|
|
32
|
+
authAgent(opts?: AuthAgentOpts): Promise<AuthAgentResponse>;
|
|
33
|
+
syncAgent(input: string | SyncAgentWorldInput): Promise<SyncAgentResponse>;
|
|
34
|
+
discover(skill: string, limit?: number): Promise<DiscoverResponse>;
|
|
35
|
+
register(uid: string, opts?: RegisterOpts): Promise<RegisterResponse>;
|
|
36
|
+
pay(from: string, to: string, task: string, amount: number): Promise<PayResponse>;
|
|
37
|
+
claw(name: string, opts?: ClawOpts): Promise<ClawResponse>;
|
|
38
|
+
commend(uid: string): Promise<AgentActionResponse>;
|
|
39
|
+
flag(uid: string): Promise<AgentActionResponse>;
|
|
40
|
+
status(uid: string, active: boolean): Promise<AgentStatusResponse>;
|
|
41
|
+
capabilities(uid: string): Promise<CapabilityItem[]>;
|
|
42
|
+
stats(): Promise<Stats>;
|
|
43
|
+
health(): Promise<Health>;
|
|
28
44
|
}
|
|
29
45
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EA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AG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAS/C,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IASlE,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAQpD,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAMvB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAKhC"}
|
package/dist/client.js
CHANGED
|
@@ -1,88 +1,196 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthError, RateLimitError, SubstrateError, TimeoutError, ValidationError } from "./errors.js";
|
|
2
2
|
import { resolveApiKey, resolveBaseUrl } from "./urls.js";
|
|
3
3
|
import { emit } from "./telemetry.js";
|
|
4
|
+
function throwForStatus(status, method, path) {
|
|
5
|
+
const msg = `${method} ${path} → ${status}`;
|
|
6
|
+
if (status === 401 || status === 403)
|
|
7
|
+
throw new AuthError(msg, status);
|
|
8
|
+
if (status === 400 || status === 422)
|
|
9
|
+
throw new ValidationError(msg, status);
|
|
10
|
+
if (status === 429)
|
|
11
|
+
throw new RateLimitError(msg);
|
|
12
|
+
if (status === 408 || status === 504)
|
|
13
|
+
throw new TimeoutError(msg, status);
|
|
14
|
+
throw new SubstrateError(msg, status);
|
|
15
|
+
}
|
|
16
|
+
function isRetryable(status) {
|
|
17
|
+
if (status === undefined)
|
|
18
|
+
return true;
|
|
19
|
+
return [429, 502, 503, 504].includes(status);
|
|
20
|
+
}
|
|
21
|
+
async function withRetry(fn, config) {
|
|
22
|
+
const maxAttempts = config?.maxAttempts ?? 1;
|
|
23
|
+
const backoff = config?.backoff ?? "exp";
|
|
24
|
+
let attempt = 0;
|
|
25
|
+
while (true) {
|
|
26
|
+
try {
|
|
27
|
+
return await fn();
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
attempt++;
|
|
31
|
+
const status = err instanceof SubstrateError ? err.status : undefined;
|
|
32
|
+
if (attempt >= maxAttempts || !isRetryable(status))
|
|
33
|
+
throw err;
|
|
34
|
+
const delayMs = backoff === "exp" ? Math.min(300 * 2 ** attempt, 30_000) :
|
|
35
|
+
backoff === "linear" ? 300 * attempt :
|
|
36
|
+
300;
|
|
37
|
+
await new Promise(r => setTimeout(r, delayMs));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
4
41
|
async function req(baseUrl, path, init = {}, apiKey) {
|
|
5
42
|
const headers = { "Content-Type": "application/json" };
|
|
6
43
|
if (apiKey)
|
|
7
44
|
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
8
45
|
const res = await fetch(`${baseUrl}${path}`, { ...init, headers });
|
|
9
|
-
if (!res.ok)
|
|
10
|
-
|
|
11
|
-
}
|
|
46
|
+
if (!res.ok)
|
|
47
|
+
throwForStatus(res.status, init.method ?? "GET", path);
|
|
12
48
|
return res.json();
|
|
13
49
|
}
|
|
14
50
|
export class SubstrateClient {
|
|
15
51
|
baseUrl;
|
|
16
52
|
apiKey;
|
|
53
|
+
retryConfig;
|
|
54
|
+
validateMode;
|
|
17
55
|
constructor(cfg = {}) {
|
|
18
56
|
this.baseUrl = resolveBaseUrl(cfg.baseUrl);
|
|
19
57
|
this.apiKey = resolveApiKey(cfg.apiKey);
|
|
58
|
+
this.retryConfig = cfg.retry;
|
|
59
|
+
this.validateMode = cfg.validate ?? "warn";
|
|
60
|
+
}
|
|
61
|
+
static fromApiKey(key, baseUrl) {
|
|
62
|
+
return new SubstrateClient({ apiKey: key, baseUrl });
|
|
63
|
+
}
|
|
64
|
+
r(path, init = {}) {
|
|
65
|
+
return withRetry(() => req(this.baseUrl, path, init, this.apiKey), this.retryConfig);
|
|
20
66
|
}
|
|
21
67
|
async signal(sender, receiver, data) {
|
|
22
|
-
const result = await
|
|
68
|
+
const result = await this.r("/api/signal", { method: "POST", body: JSON.stringify({ sender, receiver, data }) });
|
|
23
69
|
emit("toolkit:sdk:signal", ["sdk", "method-signal", result.success ? "200" : "error"]);
|
|
24
70
|
return result;
|
|
25
71
|
}
|
|
26
72
|
async ask(receiver, data, timeout, from) {
|
|
27
73
|
const t = Date.now();
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
: "timeout" in
|
|
31
|
-
: "dissolved" in
|
|
74
|
+
const raw = await this.r("/api/ask", { method: "POST", body: JSON.stringify({ receiver, data, timeout, from }) });
|
|
75
|
+
const kind = "result" in raw ? "result"
|
|
76
|
+
: "timeout" in raw ? "timeout"
|
|
77
|
+
: "dissolved" in raw ? "dissolved"
|
|
32
78
|
: "failure";
|
|
33
|
-
|
|
79
|
+
const result = { ...raw, kind };
|
|
80
|
+
emit("toolkit:sdk:ask", ["sdk", "method-ask", `outcome-${kind}`], { latencyMs: Date.now() - t });
|
|
34
81
|
return result;
|
|
35
82
|
}
|
|
36
83
|
async mark(edge, scores) {
|
|
37
|
-
const result = await
|
|
84
|
+
const result = await this.r("/api/loop/mark-dims", { method: "POST", body: JSON.stringify({ edge, ...(scores ?? { fit: 1, form: 1, truth: 1, taste: 1 }) }) });
|
|
38
85
|
emit("toolkit:sdk:mark", ["sdk", "method-mark"]);
|
|
39
86
|
return result;
|
|
40
87
|
}
|
|
41
88
|
async warn(edge, scores) {
|
|
42
|
-
const result = await
|
|
89
|
+
const result = await this.r("/api/loop/mark-dims", { method: "POST", body: JSON.stringify({ edge, ...(scores ?? { fit: 0, form: 0, truth: 0, taste: 0 }) }) });
|
|
43
90
|
emit("toolkit:sdk:warn", ["sdk", "method-warn"]);
|
|
44
91
|
return result;
|
|
45
92
|
}
|
|
46
93
|
async fade(trailRate, resistanceRate) {
|
|
47
|
-
const result = await
|
|
94
|
+
const result = await this.r("/api/decay-cycle", { method: "POST", body: JSON.stringify({ trailRate, resistanceRate }) });
|
|
48
95
|
emit("toolkit:sdk:fade", ["sdk", "method-fade"]);
|
|
49
96
|
return result;
|
|
50
97
|
}
|
|
51
98
|
async highways(limit = 10) {
|
|
52
|
-
const result = await
|
|
99
|
+
const result = await this.r(`/api/loop/highways?limit=${limit}`);
|
|
53
100
|
emit("toolkit:sdk:highways", ["sdk", "method-highways"]);
|
|
54
101
|
return result;
|
|
55
102
|
}
|
|
56
103
|
async recall(status) {
|
|
57
104
|
const qs = status ? `?status=${encodeURIComponent(status)}` : "";
|
|
58
|
-
const result = await
|
|
105
|
+
const result = await this.r(`/api/hypotheses${qs}`);
|
|
59
106
|
emit("toolkit:sdk:recall", ["sdk", "method-recall"]);
|
|
60
107
|
return result;
|
|
61
108
|
}
|
|
62
109
|
async reveal(uid) {
|
|
63
|
-
const result = await
|
|
110
|
+
const result = await this.r(`/api/memory/reveal/${encodeURIComponent(uid)}`);
|
|
64
111
|
emit("toolkit:sdk:reveal", ["sdk", "method-reveal"]);
|
|
65
112
|
return result;
|
|
66
113
|
}
|
|
67
114
|
async forget(uid) {
|
|
68
|
-
const result = await
|
|
115
|
+
const result = await this.r(`/api/memory/forget/${encodeURIComponent(uid)}`, { method: "DELETE" });
|
|
69
116
|
emit("toolkit:sdk:forget", ["sdk", "method-forget"]);
|
|
70
117
|
return result;
|
|
71
118
|
}
|
|
72
119
|
async frontier(uid) {
|
|
73
|
-
const result = await
|
|
120
|
+
const result = await this.r(`/api/memory/frontier/${encodeURIComponent(uid)}`);
|
|
74
121
|
emit("toolkit:sdk:frontier", ["sdk", "method-frontier"]);
|
|
75
122
|
return result;
|
|
76
123
|
}
|
|
77
124
|
async know() {
|
|
78
|
-
const result = await
|
|
125
|
+
const result = await this.r("/api/tick");
|
|
79
126
|
emit("toolkit:sdk:know", ["sdk", "method-know"]);
|
|
80
127
|
return result;
|
|
81
128
|
}
|
|
82
129
|
async select() {
|
|
83
|
-
const result = await
|
|
130
|
+
const result = await this.r("/api/loop/stage", { method: "POST", body: JSON.stringify({}) });
|
|
84
131
|
emit("toolkit:sdk:select", ["sdk", "method-select"]);
|
|
85
132
|
return result;
|
|
86
133
|
}
|
|
134
|
+
async authAgent(opts = {}) {
|
|
135
|
+
const result = await this.r("/api/auth/agent", { method: "POST", body: JSON.stringify(opts) });
|
|
136
|
+
emit("toolkit:sdk:authAgent", ["sdk", "method-authAgent", result.returning ? "returning" : "new"]);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
async syncAgent(input) {
|
|
140
|
+
const body = typeof input === "string" ? { markdown: input } : input;
|
|
141
|
+
const result = await this.r("/api/agents/sync", { method: "POST", body: JSON.stringify(body) });
|
|
142
|
+
emit("toolkit:sdk:syncAgent", ["sdk", "method-syncAgent"]);
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
async discover(skill, limit = 10) {
|
|
146
|
+
const result = await this.r(`/api/agents/discover?skill=${encodeURIComponent(skill)}&limit=${limit}`);
|
|
147
|
+
emit("toolkit:sdk:discover", ["sdk", "method-discover"]);
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
async register(uid, opts = {}) {
|
|
151
|
+
const result = await this.r("/api/agents/register", { method: "POST", body: JSON.stringify({ uid, ...opts }) });
|
|
152
|
+
emit("toolkit:sdk:register", ["sdk", "method-register"]);
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
async pay(from, to, task, amount) {
|
|
156
|
+
const result = await this.r("/api/pay", { method: "POST", body: JSON.stringify({ from, to, task, amount }) });
|
|
157
|
+
emit("toolkit:sdk:pay", ["sdk", "method-pay"]);
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
async claw(name, opts = {}) {
|
|
161
|
+
const result = await this.r("/api/claw", { method: "POST", body: JSON.stringify({ name, ...opts }) });
|
|
162
|
+
emit("toolkit:sdk:claw", ["sdk", "method-claw"]);
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
async commend(uid) {
|
|
166
|
+
const result = await this.r(`/api/agents/${encodeURIComponent(uid)}/commend`, { method: "POST", body: JSON.stringify({}) });
|
|
167
|
+
emit("toolkit:sdk:commend", ["sdk", "method-commend"]);
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
async flag(uid) {
|
|
171
|
+
const result = await this.r(`/api/agents/${encodeURIComponent(uid)}/flag`, { method: "POST", body: JSON.stringify({}) });
|
|
172
|
+
emit("toolkit:sdk:flag", ["sdk", "method-flag"]);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
async status(uid, active) {
|
|
176
|
+
const result = await this.r(`/api/agents/${encodeURIComponent(uid)}/status`, { method: "POST", body: JSON.stringify({ status: active ? "active" : "inactive" }) });
|
|
177
|
+
emit("toolkit:sdk:status", ["sdk", "method-status"]);
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
async capabilities(uid) {
|
|
181
|
+
const result = await this.r(`/api/agents/${encodeURIComponent(uid)}/capabilities`);
|
|
182
|
+
emit("toolkit:sdk:capabilities", ["sdk", "method-capabilities"]);
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
async stats() {
|
|
186
|
+
const result = await this.r("/api/stats");
|
|
187
|
+
emit("toolkit:sdk:stats", ["sdk", "method-stats"]);
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
async health() {
|
|
191
|
+
const result = await this.r("/api/health");
|
|
192
|
+
emit("toolkit:sdk:health", ["sdk", "method-health"]);
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
87
195
|
}
|
|
88
196
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUzC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,KAAK,UAAU,GAAG,CAChB,OAAe,EACf,IAAY,EACZ,OAAoB,EAAE,EACtB,MAAe;IAEf,MAAM,OAAO,GAA2B,E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CAAC;IAChB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC,CAAS,aAAa,CAAC,CAAC;QACnD,IAAI,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class SubstrateError extends Error {
|
|
2
|
+
readonly status?: number | undefined;
|
|
3
|
+
readonly code?: string | undefined;
|
|
4
|
+
readonly body?: unknown | undefined;
|
|
5
|
+
constructor(message: string, status?: number | undefined, code?: string | undefined, body?: unknown | undefined);
|
|
6
|
+
}
|
|
7
|
+
export declare class AuthError extends SubstrateError {
|
|
8
|
+
constructor(message: string, status?: number);
|
|
9
|
+
}
|
|
10
|
+
export declare class ValidationError extends SubstrateError {
|
|
11
|
+
constructor(message: string, status?: number, body?: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare class RateLimitError extends SubstrateError {
|
|
14
|
+
readonly retryAfterMs?: number | undefined;
|
|
15
|
+
constructor(message: string, retryAfterMs?: number | undefined);
|
|
16
|
+
}
|
|
17
|
+
export declare class TimeoutError extends SubstrateError {
|
|
18
|
+
constructor(message: string, status?: number);
|
|
19
|
+
}
|
|
20
|
+
export declare class DissolvedError extends SubstrateError {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IAGrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO;gBAHvB,OAAO,EAAE,MAAM,EACN,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,IAAI,CAAC,EAAE,OAAO,YAAA;CAK1B;AAED,qBAAa,SAAU,SAAQ,cAAc;gBAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAI7C;AAED,qBAAa,eAAgB,SAAQ,cAAc;gBACrC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAI7D;AAED,qBAAa,cAAe,SAAQ,cAAc;IACnB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAW,YAAY,CAAC,EAAE,MAAM,YAAA;CAI5D;AAED,qBAAa,YAAa,SAAQ,cAAc;gBAClC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAI7C;AAED,qBAAa,cAAe,SAAQ,cAAc;gBACpC,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export class SubstrateError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
code;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, code, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.body = body;
|
|
10
|
+
this.name = "SubstrateError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class AuthError extends SubstrateError {
|
|
14
|
+
constructor(message, status) {
|
|
15
|
+
super(message, status, "auth_error");
|
|
16
|
+
this.name = "AuthError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class ValidationError extends SubstrateError {
|
|
20
|
+
constructor(message, status, body) {
|
|
21
|
+
super(message, status, "validation_error", body);
|
|
22
|
+
this.name = "ValidationError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class RateLimitError extends SubstrateError {
|
|
26
|
+
retryAfterMs;
|
|
27
|
+
constructor(message, retryAfterMs) {
|
|
28
|
+
super(message, 429, "rate_limit_error");
|
|
29
|
+
this.retryAfterMs = retryAfterMs;
|
|
30
|
+
this.name = "RateLimitError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class TimeoutError extends SubstrateError {
|
|
34
|
+
constructor(message, status) {
|
|
35
|
+
super(message, status ?? 408, "timeout_error");
|
|
36
|
+
this.name = "TimeoutError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class DissolvedError extends SubstrateError {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(message, undefined, "dissolved_error");
|
|
42
|
+
this.name = "DissolvedError";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAG5B;IACA;IACA;IAJX,YACE,OAAe,EACN,MAAe,EACf,IAAa,EACb,IAAc;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QACb,SAAI,GAAJ,IAAI,CAAU;QAGvB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,cAAc;IAC3C,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,YAAY,OAAe,EAAE,MAAe,EAAE,IAAc;QAC1D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,cAAc;IACV;IAAtC,YAAY,OAAe,EAAW,YAAqB;QACzD,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAC;QADJ,iBAAY,GAAZ,YAAY,CAAS;QAEzD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,cAAc;IAC9C,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,EAAE,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,cAAc;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,7 @@ export { launchToken } from "./launch.js";
|
|
|
6
6
|
export type { LaunchOpts, LaunchResult } from "./launch.js";
|
|
7
7
|
export { SubstrateClient } from "./client.js";
|
|
8
8
|
export { emit as telemetryEmit, isDisabled as isTelemetryDisabled, sessionId } from "./telemetry.js";
|
|
9
|
+
export * from "./errors.js";
|
|
10
|
+
export * from "./schemas.js";
|
|
9
11
|
export declare const SDK_VERSION = "0.2.0";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|