hiloop-sdk 0.1.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/dist/client.d.ts +823 -0
- package/dist/client.js +1181 -0
- package/dist/crypto.d.ts +113 -0
- package/dist/crypto.js +278 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +204 -0
- package/dist/types.js +122 -0
- package/package.json +23 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** Core types for the Hiloop SDK. */
|
|
2
|
+
export function parseConvSession(data) {
|
|
3
|
+
const s = (data.session ?? data);
|
|
4
|
+
return {
|
|
5
|
+
id: s.id,
|
|
6
|
+
sessionType: s.sessionType,
|
|
7
|
+
status: s.status,
|
|
8
|
+
isPublic: s.isPublic ?? false,
|
|
9
|
+
encryptedTitle: s.encryptedTitle ?? null,
|
|
10
|
+
agentId: s.agentId ?? null,
|
|
11
|
+
createdByUserId: s.createdByUserId ?? "",
|
|
12
|
+
participantCount: s.participantCount,
|
|
13
|
+
createdAt: s.createdAt ?? "",
|
|
14
|
+
updatedAt: s.updatedAt ?? "",
|
|
15
|
+
raw: s,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function parseConvSessionMessage(data) {
|
|
19
|
+
const m = (data.message ?? data);
|
|
20
|
+
return {
|
|
21
|
+
id: m.id,
|
|
22
|
+
sessionId: m.sessionId,
|
|
23
|
+
senderType: m.senderType,
|
|
24
|
+
senderAgentId: m.senderAgentId ?? null,
|
|
25
|
+
senderUserId: m.senderUserId ?? null,
|
|
26
|
+
encryptedContent: m.encryptedContent ?? "",
|
|
27
|
+
editedAt: m.editedAt ?? null,
|
|
28
|
+
deletedAt: m.deletedAt ?? null,
|
|
29
|
+
createdAt: m.createdAt ?? "",
|
|
30
|
+
raw: m,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function parseGuestToken(data) {
|
|
34
|
+
// Only unwrap data.token if it's an object envelope, not the token string itself
|
|
35
|
+
const inner = (typeof data.token === "object" && data.token !== null)
|
|
36
|
+
? data.token
|
|
37
|
+
: (data.guestToken ?? data);
|
|
38
|
+
const t = inner;
|
|
39
|
+
return {
|
|
40
|
+
id: t.id,
|
|
41
|
+
sessionId: t.sessionId,
|
|
42
|
+
token: t.token,
|
|
43
|
+
displayName: t.displayName ?? null,
|
|
44
|
+
expiresAt: t.expiresAt ?? null,
|
|
45
|
+
createdAt: t.createdAt ?? "",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function parseChannel(data) {
|
|
49
|
+
const c = (data.channel ?? data);
|
|
50
|
+
return {
|
|
51
|
+
id: c.id,
|
|
52
|
+
spaceId: c.spaceId ?? "",
|
|
53
|
+
externalId: c.externalId ?? null,
|
|
54
|
+
encryptedName: c.encryptedName ?? null,
|
|
55
|
+
encryptedDescription: c.encryptedDescription ?? null,
|
|
56
|
+
status: c.status ?? "open",
|
|
57
|
+
createdByAgentId: c.createdByAgentId ?? "",
|
|
58
|
+
lastMessageAt: c.lastMessageAt ?? null,
|
|
59
|
+
closedAt: c.closedAt ?? null,
|
|
60
|
+
createdAt: c.createdAt ?? "",
|
|
61
|
+
updatedAt: c.updatedAt ?? "",
|
|
62
|
+
raw: c,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function parseChannelMessage(data) {
|
|
66
|
+
const m = (data.message ?? data);
|
|
67
|
+
return {
|
|
68
|
+
id: m.id,
|
|
69
|
+
channelId: m.channelId ?? "",
|
|
70
|
+
senderAgentId: m.senderAgentId ?? "",
|
|
71
|
+
encryptedContent: m.encryptedContent ?? "",
|
|
72
|
+
createdAt: m.createdAt ?? "",
|
|
73
|
+
raw: m,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function parseChannelParticipant(data) {
|
|
77
|
+
const p = (data.participant ?? data);
|
|
78
|
+
return {
|
|
79
|
+
id: p.id,
|
|
80
|
+
channelId: p.channelId ?? "",
|
|
81
|
+
agentId: p.agentId ?? "",
|
|
82
|
+
joinedAt: p.joinedAt ?? "",
|
|
83
|
+
leftAt: p.leftAt ?? null,
|
|
84
|
+
raw: p,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function parseInteraction(data, decrypt) {
|
|
88
|
+
const d = decrypt ?? ((t) => t);
|
|
89
|
+
return {
|
|
90
|
+
id: data.id,
|
|
91
|
+
type: data.type,
|
|
92
|
+
status: data.status,
|
|
93
|
+
priority: data.priority,
|
|
94
|
+
title: d(data.encryptedTitle ?? ""),
|
|
95
|
+
description: data.encryptedDescription ? d(data.encryptedDescription) : undefined,
|
|
96
|
+
options: data.encryptedOptions ? d(data.encryptedOptions) : undefined,
|
|
97
|
+
context: data.encryptedContext ? d(data.encryptedContext) : undefined,
|
|
98
|
+
formSchema: data.encryptedFormSchema ? d(data.encryptedFormSchema) : undefined,
|
|
99
|
+
response: data.encryptedResponse ? d(data.encryptedResponse) : undefined,
|
|
100
|
+
comment: data.encryptedComment ? d(data.encryptedComment) : undefined,
|
|
101
|
+
routeToUser: data.routeToUser,
|
|
102
|
+
routeToTeam: data.routeToTeam,
|
|
103
|
+
deadlineAt: data.deadlineAt,
|
|
104
|
+
createdAt: data.createdAt ?? "",
|
|
105
|
+
updatedAt: data.updatedAt ?? "",
|
|
106
|
+
assignedAt: data.assignedAt,
|
|
107
|
+
viewedAt: data.viewedAt,
|
|
108
|
+
respondedAt: data.respondedAt,
|
|
109
|
+
completedAt: data.completedAt,
|
|
110
|
+
raw: data,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function parseMessage(data, decrypt) {
|
|
114
|
+
const d = decrypt ?? ((t) => t);
|
|
115
|
+
return {
|
|
116
|
+
id: data.id,
|
|
117
|
+
senderType: data.senderType ?? "",
|
|
118
|
+
content: d(data.encryptedContent ?? ""),
|
|
119
|
+
createdAt: data.createdAt ?? "",
|
|
120
|
+
raw: data,
|
|
121
|
+
};
|
|
122
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hiloop-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for Hiloop — zero-trust human-AI agent interaction platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": ["dist"],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"tweetnacl": "^1.0.3",
|
|
16
|
+
"tweetnacl-util": "^0.15.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.7",
|
|
20
|
+
"vitest": "^3.2"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|