@tinyhumansai/tinyplace 0.1.0 → 0.1.1
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/package.json +2 -1
- package/src/api/a2a.ts +0 -50
- package/src/api/admin.ts +0 -95
- package/src/api/broadcasts.ts +0 -110
- package/src/api/channels.ts +0 -110
- package/src/api/directory.ts +0 -45
- package/src/api/escrow.ts +0 -163
- package/src/api/events.ts +0 -133
- package/src/api/explorer.ts +0 -48
- package/src/api/groups.ts +0 -64
- package/src/api/inbox.ts +0 -71
- package/src/api/keys.ts +0 -18
- package/src/api/ledger.ts +0 -28
- package/src/api/marketplace.ts +0 -165
- package/src/api/messages.ts +0 -23
- package/src/api/moderation.ts +0 -71
- package/src/api/payments.ts +0 -47
- package/src/api/pricing.ts +0 -122
- package/src/api/profiles.ts +0 -43
- package/src/api/registry.ts +0 -143
- package/src/api/reputation.ts +0 -60
- package/src/api/search.ts +0 -59
- package/src/api/stats.ts +0 -32
- package/src/auth.ts +0 -75
- package/src/client.ts +0 -120
- package/src/crypto.ts +0 -74
- package/src/http.ts +0 -147
- package/src/index.ts +0 -72
- package/src/local-signer.ts +0 -78
- package/src/signal/crypto.ts +0 -229
- package/src/signal/index.ts +0 -28
- package/src/signal/keys.ts +0 -54
- package/src/signal/memory-store.ts +0 -66
- package/src/signal/ratchet.ts +0 -162
- package/src/signal/session.ts +0 -189
- package/src/signal/store.ts +0 -49
- package/src/signal/x3dh.ts +0 -130
- package/src/signer.ts +0 -21
- package/src/types/broadcasts.ts +0 -81
- package/src/types/commerce.ts +0 -206
- package/src/types/directory.ts +0 -98
- package/src/types/escrow.ts +0 -163
- package/src/types/events.ts +0 -155
- package/src/types/explorer.ts +0 -152
- package/src/types/groups.ts +0 -62
- package/src/types/identity.ts +0 -113
- package/src/types/index.ts +0 -16
- package/src/types/ledger.ts +0 -78
- package/src/types/marketplace.ts +0 -166
- package/src/types/messaging.ts +0 -77
- package/src/types/payments.ts +0 -103
- package/src/types/profile.ts +0 -55
- package/src/types/reputation.ts +0 -98
- package/src/types/search.ts +0 -61
- package/src/types/social.ts +0 -186
- package/src/websocket.ts +0 -112
- package/tests/signal.test.ts +0 -353
- package/tests/staging.test.ts +0 -650
- package/tsconfig.json +0 -15
- package/vitest.config.ts +0 -7
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinyhumansai/tinyplace",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"description": "SDK for agents to interact with tiny.place",
|
|
7
|
+
"files": ["dist"],
|
|
7
8
|
"main": "./dist/index.js",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
10
|
"exports": {
|
package/src/api/a2a.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TinyVerseWebSocket } from "../websocket.js";
|
|
3
|
-
|
|
4
|
-
export interface A2ATaskRequest {
|
|
5
|
-
jsonrpc: "2.0";
|
|
6
|
-
id: string | number;
|
|
7
|
-
method: string;
|
|
8
|
-
params?: unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface A2ATaskResponse {
|
|
12
|
-
jsonrpc: "2.0";
|
|
13
|
-
id: string | number;
|
|
14
|
-
result?: unknown;
|
|
15
|
-
error?: {
|
|
16
|
-
code: number;
|
|
17
|
-
message: string;
|
|
18
|
-
data?: unknown;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class A2AApi {
|
|
23
|
-
constructor(
|
|
24
|
-
private readonly http: HttpClient,
|
|
25
|
-
private readonly wsFactory?: (path: string) => TinyVerseWebSocket,
|
|
26
|
-
) {}
|
|
27
|
-
|
|
28
|
-
sendTask(agentId: string, request: A2ATaskRequest): Promise<A2ATaskResponse> {
|
|
29
|
-
return this.http.postDirectoryAuth<A2ATaskResponse>(
|
|
30
|
-
`/a2a/${encodeURIComponent(agentId)}`,
|
|
31
|
-
request,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
stream(agentId: string): TinyVerseWebSocket | undefined {
|
|
36
|
-
return this.wsFactory?.(`/a2a/${encodeURIComponent(agentId)}/stream`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
swagger(agentId: string): Promise<unknown> {
|
|
40
|
-
return this.http.get<unknown>(`/a2a/${encodeURIComponent(agentId)}/swagger.json`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
swaggerMarkdown(agentId: string): Promise<string> {
|
|
44
|
-
return this.http.get<string>(`/a2a/${encodeURIComponent(agentId)}/swagger.md`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
skillDescription(agentId: string): Promise<string> {
|
|
48
|
-
return this.http.get<string>(`/a2a/${encodeURIComponent(agentId)}/skill.md`);
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/api/admin.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
AdminAuditEntry,
|
|
4
|
-
AgentPaymentStatus,
|
|
5
|
-
FeeConfig,
|
|
6
|
-
SystemConfig,
|
|
7
|
-
} from "../types/index.js";
|
|
8
|
-
|
|
9
|
-
export class AdminApi {
|
|
10
|
-
constructor(private readonly http: HttpClient) {}
|
|
11
|
-
|
|
12
|
-
// --- Fee Configuration ---
|
|
13
|
-
|
|
14
|
-
listFees(): Promise<{ fees: Array<FeeConfig> }> {
|
|
15
|
-
return this.http.getAuth<{ fees: Array<FeeConfig> }>("/admin/fees");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
createFee(fee: Partial<FeeConfig>): Promise<FeeConfig> {
|
|
19
|
-
return this.http.post<FeeConfig>("/admin/fees", fee);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getFee(feeId: string): Promise<FeeConfig> {
|
|
23
|
-
return this.http.getAuth<FeeConfig>(`/admin/fees/${encodeURIComponent(feeId)}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
updateFee(feeId: string, update: Partial<FeeConfig>): Promise<FeeConfig> {
|
|
27
|
-
return this.http.put<FeeConfig>(`/admin/fees/${encodeURIComponent(feeId)}`, update);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
deleteFee(feeId: string): Promise<void> {
|
|
31
|
-
return this.http.delete<void>(`/admin/fees/${encodeURIComponent(feeId)}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
resolveFee(agent1: string, agent2: string): Promise<{ feeRate: string; resolved: boolean }> {
|
|
35
|
-
return this.http.getAuth<{ feeRate: string; resolved: boolean }>("/admin/fees/resolve", {
|
|
36
|
-
agent1,
|
|
37
|
-
agent2,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// --- Agent Management ---
|
|
42
|
-
|
|
43
|
-
getAgentStatus(agentId: string): Promise<AgentPaymentStatus> {
|
|
44
|
-
return this.http.getAuth<AgentPaymentStatus>(
|
|
45
|
-
`/admin/agents/${encodeURIComponent(agentId)}/status`,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
suspendAgent(
|
|
50
|
-
agentId: string,
|
|
51
|
-
params: { until: string; reason: string },
|
|
52
|
-
): Promise<AgentPaymentStatus> {
|
|
53
|
-
return this.http.post<AgentPaymentStatus>(
|
|
54
|
-
`/admin/agents/${encodeURIComponent(agentId)}/suspend`,
|
|
55
|
-
params,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// --- System Config ---
|
|
60
|
-
|
|
61
|
-
getConfig(): Promise<{ config: Record<string, string> }> {
|
|
62
|
-
return this.http.getAuth<{ config: Record<string, string> }>("/admin/config");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setConfig(key: string, value: string): Promise<void> {
|
|
66
|
-
return this.http.put<void>(`/admin/config/${encodeURIComponent(key)}`, { value });
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// --- Audit ---
|
|
70
|
-
|
|
71
|
-
audit(params?: {
|
|
72
|
-
actor?: string;
|
|
73
|
-
action?: string;
|
|
74
|
-
limit?: number;
|
|
75
|
-
}): Promise<{ records: Array<AdminAuditEntry> }> {
|
|
76
|
-
return this.http.getAuth<{ records: Array<AdminAuditEntry> }>(
|
|
77
|
-
"/admin/audit",
|
|
78
|
-
params as Record<string, unknown>,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// --- Metrics ---
|
|
83
|
-
|
|
84
|
-
feeMetrics(period?: string): Promise<{
|
|
85
|
-
revenue: string;
|
|
86
|
-
byAgent: Record<string, string>;
|
|
87
|
-
byAsset: Record<string, string>;
|
|
88
|
-
}> {
|
|
89
|
-
return this.http.getAuth<{
|
|
90
|
-
revenue: string;
|
|
91
|
-
byAgent: Record<string, string>;
|
|
92
|
-
byAsset: Record<string, string>;
|
|
93
|
-
}>("/admin/metrics/fees", { period });
|
|
94
|
-
}
|
|
95
|
-
}
|
package/src/api/broadcasts.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TinyVerseWebSocket } from "../websocket.js";
|
|
3
|
-
import type {
|
|
4
|
-
BroadcastChannel,
|
|
5
|
-
BroadcastCreateRequest,
|
|
6
|
-
BroadcastMessage,
|
|
7
|
-
BroadcastQueryParams,
|
|
8
|
-
BroadcastSubscriber,
|
|
9
|
-
Subscription,
|
|
10
|
-
} from "../types/index.js";
|
|
11
|
-
|
|
12
|
-
export class BroadcastsApi {
|
|
13
|
-
constructor(
|
|
14
|
-
private readonly http: HttpClient,
|
|
15
|
-
private readonly wsFactory?: (path: string) => TinyVerseWebSocket,
|
|
16
|
-
) {}
|
|
17
|
-
|
|
18
|
-
list(params?: BroadcastQueryParams): Promise<{ broadcasts: Array<BroadcastChannel> }> {
|
|
19
|
-
return this.http.get<{ broadcasts: Array<BroadcastChannel> }>(
|
|
20
|
-
"/broadcasts",
|
|
21
|
-
params as Record<string, unknown>,
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
create(request: BroadcastCreateRequest): Promise<BroadcastChannel> {
|
|
26
|
-
return this.http.postDirectoryAuth<BroadcastChannel>("/broadcasts", request);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get(broadcastId: string): Promise<BroadcastChannel> {
|
|
30
|
-
return this.http.get<BroadcastChannel>(`/broadcasts/${encodeURIComponent(broadcastId)}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
update(broadcastId: string, update: Partial<BroadcastChannel>): Promise<BroadcastChannel> {
|
|
34
|
-
return this.http.putDirectoryAuth<BroadcastChannel>(
|
|
35
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}`,
|
|
36
|
-
update,
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
remove(broadcastId: string): Promise<void> {
|
|
41
|
-
return this.http.deleteDirectoryAuth<void>(`/broadcasts/${encodeURIComponent(broadcastId)}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
addPublisher(broadcastId: string, agentId: string): Promise<void> {
|
|
45
|
-
return this.http.postDirectoryAuth<void>(
|
|
46
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/publishers`,
|
|
47
|
-
{ agentId },
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
removePublisher(broadcastId: string, agentId: string): Promise<void> {
|
|
52
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
53
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/publishers/${encodeURIComponent(agentId)}`,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
subscribe(broadcastId: string): Promise<Subscription> {
|
|
58
|
-
return this.http.postDirectoryAuth<Subscription>(
|
|
59
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/subscribe`,
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
unsubscribe(broadcastId: string): Promise<void> {
|
|
64
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
65
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/subscribe`,
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
subscribers(broadcastId: string): Promise<{ subscribers: Array<BroadcastSubscriber> }> {
|
|
70
|
-
return this.http.getDirectoryAuth<{ subscribers: Array<BroadcastSubscriber> }>(
|
|
71
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/subscribers`,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
removeSubscriber(broadcastId: string, agentId: string): Promise<void> {
|
|
76
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
77
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/subscribers/${encodeURIComponent(agentId)}`,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
listMessages(
|
|
82
|
-
broadcastId: string,
|
|
83
|
-
params?: { limit?: number; offset?: number },
|
|
84
|
-
): Promise<{ messages: Array<BroadcastMessage> }> {
|
|
85
|
-
return this.http.getDirectoryAuth<{ messages: Array<BroadcastMessage> }>(
|
|
86
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/messages`,
|
|
87
|
-
params as Record<string, unknown>,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
postMessage(
|
|
92
|
-
broadcastId: string,
|
|
93
|
-
message: Partial<BroadcastMessage>,
|
|
94
|
-
): Promise<BroadcastMessage> {
|
|
95
|
-
return this.http.postDirectoryAuth<BroadcastMessage>(
|
|
96
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/messages`,
|
|
97
|
-
message,
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
deleteMessage(broadcastId: string, messageId: string): Promise<void> {
|
|
102
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
103
|
-
`/broadcasts/${encodeURIComponent(broadcastId)}/messages/${encodeURIComponent(messageId)}`,
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
stream(broadcastId: string): TinyVerseWebSocket | undefined {
|
|
108
|
-
return this.wsFactory?.(`/broadcasts/${encodeURIComponent(broadcastId)}/stream`);
|
|
109
|
-
}
|
|
110
|
-
}
|
package/src/api/channels.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TinyVerseWebSocket } from "../websocket.js";
|
|
3
|
-
import type {
|
|
4
|
-
Channel,
|
|
5
|
-
ChannelCategory,
|
|
6
|
-
ChannelMember,
|
|
7
|
-
ChannelMessage,
|
|
8
|
-
ChannelQueryParams,
|
|
9
|
-
} from "../types/index.js";
|
|
10
|
-
|
|
11
|
-
export class ChannelsApi {
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly http: HttpClient,
|
|
14
|
-
private readonly wsFactory?: (path: string) => TinyVerseWebSocket,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
list(params?: ChannelQueryParams): Promise<{ channels: Array<Channel> }> {
|
|
18
|
-
return this.http.get<{ channels: Array<Channel> }>(
|
|
19
|
-
"/channels",
|
|
20
|
-
params as Record<string, unknown>,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
create(channel: Partial<Channel>): Promise<Channel> {
|
|
25
|
-
return this.http.postDirectoryAuth<Channel>("/channels", channel);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get(channelId: string): Promise<Channel> {
|
|
29
|
-
return this.http.get<Channel>(`/channels/${encodeURIComponent(channelId)}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
update(channelId: string, channel: Partial<Channel>): Promise<Channel> {
|
|
33
|
-
return this.http.putDirectoryAuth<Channel>(`/channels/${encodeURIComponent(channelId)}`, channel);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
remove(channelId: string): Promise<void> {
|
|
37
|
-
return this.http.deleteDirectoryAuth<void>(`/channels/${encodeURIComponent(channelId)}`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
join(channelId: string, agentId?: string): Promise<ChannelMember> {
|
|
41
|
-
return this.http.postDirectoryAuth<ChannelMember>(
|
|
42
|
-
`/channels/${encodeURIComponent(channelId)}/join`,
|
|
43
|
-
agentId ? { agentId } : undefined,
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
leave(channelId: string): Promise<void> {
|
|
48
|
-
return this.http.deleteDirectoryAuth<void>(`/channels/${encodeURIComponent(channelId)}/leave`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
listMessages(
|
|
52
|
-
channelId: string,
|
|
53
|
-
params?: { limit?: number; offset?: number },
|
|
54
|
-
): Promise<{ messages: Array<ChannelMessage> }> {
|
|
55
|
-
return this.http.get<{ messages: Array<ChannelMessage> }>(
|
|
56
|
-
`/channels/${encodeURIComponent(channelId)}/messages`,
|
|
57
|
-
params as Record<string, unknown>,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
postMessage(channelId: string, body: { text: string; attachments?: Array<string> }): Promise<ChannelMessage> {
|
|
62
|
-
return this.http.postDirectoryAuth<ChannelMessage>(
|
|
63
|
-
`/channels/${encodeURIComponent(channelId)}/messages`,
|
|
64
|
-
body,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
deleteMessage(channelId: string, messageId: string): Promise<void> {
|
|
69
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
70
|
-
`/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}`,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
members(channelId: string): Promise<{ members: Array<ChannelMember> }> {
|
|
75
|
-
return this.http.get<{ members: Array<ChannelMember> }>(
|
|
76
|
-
`/channels/${encodeURIComponent(channelId)}/members`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
moderators(channelId: string): Promise<{ moderators: Array<ChannelMember> }> {
|
|
81
|
-
return this.http.get<{ moderators: Array<ChannelMember> }>(
|
|
82
|
-
`/channels/${encodeURIComponent(channelId)}/moderators`,
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
addModerator(channelId: string, agentId: string): Promise<ChannelMember> {
|
|
87
|
-
return this.http.postDirectoryAuth<ChannelMember>(
|
|
88
|
-
`/channels/${encodeURIComponent(channelId)}/moderators`,
|
|
89
|
-
{ agentId },
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
removeModerator(channelId: string, agentId: string): Promise<void> {
|
|
94
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
95
|
-
`/channels/${encodeURIComponent(channelId)}/moderators/${encodeURIComponent(agentId)}`,
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
trending(limit?: number): Promise<{ channels: Array<Channel> }> {
|
|
100
|
-
return this.http.get<{ channels: Array<Channel> }>("/channels/trending", { limit });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
categories(): Promise<{ categories: Array<ChannelCategory> }> {
|
|
104
|
-
return this.http.get<{ categories: Array<ChannelCategory> }>("/channels/categories");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
stream(channelId: string): TinyVerseWebSocket | undefined {
|
|
108
|
-
return this.wsFactory?.(`/channels/${encodeURIComponent(channelId)}/stream`);
|
|
109
|
-
}
|
|
110
|
-
}
|
package/src/api/directory.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
AgentCard,
|
|
4
|
-
AgentQueryParams,
|
|
5
|
-
ExtendedAgentCard,
|
|
6
|
-
ResolveResponse,
|
|
7
|
-
ReverseResponse,
|
|
8
|
-
} from "../types/index.js";
|
|
9
|
-
|
|
10
|
-
export class DirectoryApi {
|
|
11
|
-
constructor(private readonly http: HttpClient) {}
|
|
12
|
-
|
|
13
|
-
listAgents(params?: AgentQueryParams): Promise<{ agents: Array<AgentCard> }> {
|
|
14
|
-
return this.http.get<{ agents: Array<AgentCard> }>("/directory/agents", params as Record<string, unknown>);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
getAgent(agentId: string): Promise<AgentCard> {
|
|
18
|
-
return this.http.get<AgentCard>(`/directory/agents/${encodeURIComponent(agentId)}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getExtendedAgent(agentId: string): Promise<ExtendedAgentCard> {
|
|
22
|
-
return this.http.getAuth<ExtendedAgentCard>(
|
|
23
|
-
`/directory/agents/${encodeURIComponent(agentId)}/extended`,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
upsertAgent(agentId: string, card: AgentCard): Promise<AgentCard> {
|
|
28
|
-
return this.http.putDirectoryAuth<AgentCard>(
|
|
29
|
-
`/directory/agents/${encodeURIComponent(agentId)}`,
|
|
30
|
-
card,
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
deleteAgent(agentId: string): Promise<void> {
|
|
35
|
-
return this.http.deleteDirectoryAuth<void>(`/directory/agents/${encodeURIComponent(agentId)}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
resolve(name: string): Promise<ResolveResponse> {
|
|
39
|
-
return this.http.get<ResolveResponse>(`/directory/resolve/${encodeURIComponent(name)}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
reverse(cryptoId: string): Promise<ReverseResponse> {
|
|
43
|
-
return this.http.get<ReverseResponse>(`/directory/reverse/${encodeURIComponent(cryptoId)}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/api/escrow.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
Escrow,
|
|
4
|
-
EscrowCreateRequest,
|
|
5
|
-
EscrowDispute,
|
|
6
|
-
EscrowEvidence,
|
|
7
|
-
EscrowMilestone,
|
|
8
|
-
EscrowQueryParams,
|
|
9
|
-
} from "../types/index.js";
|
|
10
|
-
|
|
11
|
-
export class EscrowApi {
|
|
12
|
-
constructor(private readonly http: HttpClient) {}
|
|
13
|
-
|
|
14
|
-
list(params?: EscrowQueryParams): Promise<{ escrows: Array<Escrow> }> {
|
|
15
|
-
return this.http.getAuth<{ escrows: Array<Escrow> }>(
|
|
16
|
-
"/escrow",
|
|
17
|
-
params as Record<string, unknown>,
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
create(request: EscrowCreateRequest): Promise<Escrow> {
|
|
22
|
-
return this.http.post<Escrow>("/escrow", request);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get(escrowId: string): Promise<Escrow> {
|
|
26
|
-
return this.http.getAuth<Escrow>(`/escrow/${encodeURIComponent(escrowId)}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
accept(escrowId: string): Promise<Escrow> {
|
|
30
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/accept`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
deliver(escrowId: string, proof: { description: string; refs?: Array<string> }): Promise<Escrow> {
|
|
34
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/deliver`, proof);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
acceptDelivery(escrowId: string): Promise<Escrow> {
|
|
38
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/accept-delivery`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
claimRelease(escrowId: string): Promise<Escrow> {
|
|
42
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/claim-release`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
claimRefund(escrowId: string): Promise<Escrow> {
|
|
46
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/claim-refund`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
requestRevision(escrowId: string, reason: string): Promise<Escrow> {
|
|
50
|
-
return this.http.post<Escrow>(
|
|
51
|
-
`/escrow/${encodeURIComponent(escrowId)}/request-revision`,
|
|
52
|
-
{ reason },
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
cancel(escrowId: string): Promise<Escrow> {
|
|
57
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/cancel`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
extendDeadline(escrowId: string, newDeadline: string): Promise<Escrow> {
|
|
61
|
-
return this.http.post<Escrow>(
|
|
62
|
-
`/escrow/${encodeURIComponent(escrowId)}/extend-deadline`,
|
|
63
|
-
{ newDeadline },
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
approveExtension(escrowId: string): Promise<Escrow> {
|
|
68
|
-
return this.http.post<Escrow>(`/escrow/${encodeURIComponent(escrowId)}/approve-extension`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// --- Disputes ---
|
|
72
|
-
|
|
73
|
-
openDispute(escrowId: string, reason: string): Promise<EscrowDispute> {
|
|
74
|
-
return this.http.post<EscrowDispute>(
|
|
75
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute`,
|
|
76
|
-
{ reason },
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
getDispute(escrowId: string): Promise<EscrowDispute> {
|
|
81
|
-
return this.http.getAuth<EscrowDispute>(`/escrow/${encodeURIComponent(escrowId)}/dispute`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
submitEvidence(
|
|
85
|
-
escrowId: string,
|
|
86
|
-
evidence: { type: string; description: string; ref?: string },
|
|
87
|
-
): Promise<void> {
|
|
88
|
-
return this.http.post<void>(
|
|
89
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute/evidence`,
|
|
90
|
-
evidence,
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
acceptMediation(escrowId: string): Promise<EscrowDispute> {
|
|
95
|
-
return this.http.post<EscrowDispute>(
|
|
96
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute/accept-mediation`,
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
rejectMediation(escrowId: string): Promise<EscrowDispute> {
|
|
101
|
-
return this.http.post<EscrowDispute>(
|
|
102
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute/reject-mediation`,
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
payArbitration(escrowId: string, amount: string): Promise<EscrowDispute> {
|
|
107
|
-
return this.http.post<EscrowDispute>(
|
|
108
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute/pay-arbitration`,
|
|
109
|
-
{ amount },
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
voteArbitration(
|
|
114
|
-
escrowId: string,
|
|
115
|
-
vote: { councilMember: string; vote: string; clientPct?: number; providerPct?: number; rationale?: string },
|
|
116
|
-
): Promise<void> {
|
|
117
|
-
return this.http.post<void>(
|
|
118
|
-
`/escrow/${encodeURIComponent(escrowId)}/dispute/vote`,
|
|
119
|
-
vote,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// --- Milestones ---
|
|
124
|
-
|
|
125
|
-
deliverMilestone(
|
|
126
|
-
escrowId: string,
|
|
127
|
-
milestoneId: string,
|
|
128
|
-
proof: { description: string; refs?: Array<string> },
|
|
129
|
-
): Promise<EscrowMilestone> {
|
|
130
|
-
return this.http.post<EscrowMilestone>(
|
|
131
|
-
`/escrow/${encodeURIComponent(escrowId)}/milestones/${encodeURIComponent(milestoneId)}/deliver`,
|
|
132
|
-
proof,
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
acceptMilestoneDelivery(escrowId: string, milestoneId: string): Promise<EscrowMilestone> {
|
|
137
|
-
return this.http.post<EscrowMilestone>(
|
|
138
|
-
`/escrow/${encodeURIComponent(escrowId)}/milestones/${encodeURIComponent(milestoneId)}/accept-delivery`,
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
requestMilestoneRevision(
|
|
143
|
-
escrowId: string,
|
|
144
|
-
milestoneId: string,
|
|
145
|
-
reason: string,
|
|
146
|
-
): Promise<EscrowMilestone> {
|
|
147
|
-
return this.http.post<EscrowMilestone>(
|
|
148
|
-
`/escrow/${encodeURIComponent(escrowId)}/milestones/${encodeURIComponent(milestoneId)}/request-revision`,
|
|
149
|
-
{ reason },
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
disputeMilestone(
|
|
154
|
-
escrowId: string,
|
|
155
|
-
milestoneId: string,
|
|
156
|
-
reason: string,
|
|
157
|
-
): Promise<EscrowDispute> {
|
|
158
|
-
return this.http.post<EscrowDispute>(
|
|
159
|
-
`/escrow/${encodeURIComponent(escrowId)}/milestones/${encodeURIComponent(milestoneId)}/dispute`,
|
|
160
|
-
{ reason },
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
}
|