hiloop-sdk 0.7.0 → 0.8.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/index.d.ts CHANGED
@@ -4,5 +4,5 @@ export { HiloopWsClient } from "./ws.js";
4
4
  export type { HiloopWsClientOptions, WsEventType, WsEventHandler } from "./ws.js";
5
5
  export { generateKeyPair, deriveKeyPairFromApiKey, computeFingerprint, encrypt, decrypt, encryptAes, decryptAes, deriveWrappingKey, CryptoContext } from "./crypto.js";
6
6
  export type { KeyPair, ContentWrappingResult } from "./crypto.js";
7
- export type { Interaction, InteractionType, InteractionStatus, Priority, Message, PaginatedResult, CreateInteractionOptions, ConvSession, ConvSessionType, ConvSessionStatus, ConvSessionRole, ConvSessionParticipant, ConvSessionMessage, GuestToken, CreateConvSessionOptions, Channel, ChannelStatus, ChannelMessage, ChannelParticipant, CreateChannelOptions, FileChangeStatus, CommandInvocationStatus, AgentCommand, CommandInvocation, } from "./types.js";
8
- export { parseInteraction, parseMessage, parseConvSession, parseConvSessionMessage, parseGuestToken, parseChannel, parseChannelMessage, parseChannelParticipant, } from "./types.js";
7
+ export type { Priority, PaginatedResult, ConvSession, ConvSessionType, ConvSessionStatus, ConvSessionRole, ConvSessionParticipant, ConvSessionMessage, GuestToken, CreateConvSessionOptions, Channel, ChannelStatus, ChannelMessage, ChannelParticipant, CreateChannelOptions, ComponentNode, SessionMessage, FileChangeStatus, CommandInvocationStatus, AgentCommand, CommandInvocation, } from "./types.js";
8
+ export { parseConvSession, parseConvSessionMessage, parseSessionMessage, parseGuestToken, parseChannel, parseChannelMessage, parseChannelParticipant, } from "./types.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { HiloopClient, HiloopError } from "./client.js";
2
2
  export { HiloopWsClient } from "./ws.js";
3
3
  export { generateKeyPair, deriveKeyPairFromApiKey, computeFingerprint, encrypt, decrypt, encryptAes, decryptAes, deriveWrappingKey, CryptoContext } from "./crypto.js";
4
- export { parseInteraction, parseMessage, parseConvSession, parseConvSessionMessage, parseGuestToken, parseChannel, parseChannelMessage, parseChannelParticipant, } from "./types.js";
4
+ export { parseConvSession, parseConvSessionMessage, parseSessionMessage, parseGuestToken, parseChannel, parseChannelMessage, parseChannelParticipant, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -1,58 +1,11 @@
1
1
  /** Core types for the Hiloop SDK. */
2
- export type InteractionType = "approval" | "review" | "payment" | "form" | "notification" | "report" | "question" | "activity";
3
- export type InteractionStatus = "created" | "pending" | "viewed" | "responded" | "completed" | "expired" | "escalated" | "cancelled";
4
2
  export type Priority = "critical" | "high" | "normal" | "low";
5
- export interface Interaction {
6
- id: string;
7
- type: InteractionType;
8
- status: InteractionStatus;
9
- priority: Priority;
10
- title: string;
11
- description?: string;
12
- options?: string;
13
- context?: string;
14
- formSchema?: string;
15
- response?: string;
16
- comment?: string;
17
- routeToUser?: string;
18
- routeToTeam?: string;
19
- deadlineAt?: string;
20
- createdAt: string;
21
- updatedAt: string;
22
- assignedAt?: string;
23
- viewedAt?: string;
24
- respondedAt?: string;
25
- completedAt?: string;
26
- raw: Record<string, unknown>;
27
- }
28
- export interface Message {
29
- id: string;
30
- senderType: string;
31
- content: string;
32
- createdAt: string;
33
- raw: Record<string, unknown>;
34
- }
35
3
  export interface PaginatedResult<T> {
36
4
  items: T[];
37
5
  total: number;
38
6
  page: number;
39
7
  pageSize: number;
40
8
  }
41
- export interface CreateInteractionOptions {
42
- type: string;
43
- title: string;
44
- description?: string;
45
- options?: string;
46
- context?: string;
47
- formSchema?: string;
48
- priority?: string;
49
- presentation?: string;
50
- routeToUser?: string;
51
- routeToTeam?: string;
52
- deadlineMinutes?: number;
53
- callbackUrl?: string;
54
- convSessionId?: string;
55
- }
56
9
  export type ConvSessionType = "direct" | "group" | "public";
57
10
  export type ConvSessionStatus = "open" | "closed" | "archived";
58
11
  export type ConvSessionRole = "owner" | "admin" | "member" | "viewer" | "guest";
@@ -165,9 +118,36 @@ export interface CreateChannelOptions {
165
118
  export declare function parseChannel(data: Record<string, unknown>): Channel;
166
119
  export declare function parseChannelMessage(data: Record<string, unknown>): ChannelMessage;
167
120
  export declare function parseChannelParticipant(data: Record<string, unknown>): ChannelParticipant;
168
- type DecryptFn = (text: string) => string;
169
- export declare function parseInteraction(data: Record<string, unknown>, decrypt?: DecryptFn): Interaction;
170
- export declare function parseMessage(data: Record<string, unknown>, decrypt?: DecryptFn): Message;
121
+ /** A component node for rich message content (buttons, forms, etc.). */
122
+ export interface ComponentNode {
123
+ type: string;
124
+ data?: Record<string, unknown>;
125
+ children?: ComponentNode[];
126
+ }
127
+ /** A session message in the unified message system. */
128
+ export interface SessionMessage {
129
+ id: string;
130
+ sessionId: string;
131
+ senderType: string;
132
+ senderUserId?: string | null;
133
+ senderAgentId?: string | null;
134
+ guestTokenId?: string | null;
135
+ encryptedContent: string;
136
+ encryptedComponents?: string | null;
137
+ responseRequired: boolean;
138
+ category?: string | null;
139
+ priority?: string | null;
140
+ status?: string | null;
141
+ deadlineAt?: string | null;
142
+ replyToMessageId?: string | null;
143
+ respondedAt?: string | null;
144
+ viewedAt?: string | null;
145
+ assignedUserId?: string | null;
146
+ editedAt?: string | null;
147
+ deletedAt?: string | null;
148
+ createdAt: string;
149
+ }
150
+ export declare function parseSessionMessage(data: Record<string, unknown>): SessionMessage;
171
151
  export type FileChangeStatus = "modified" | "added" | "deleted" | "renamed";
172
152
  export type CommandInvocationStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
173
153
  export interface AgentCommand {
@@ -201,4 +181,3 @@ export interface CommandInvocation {
201
181
  completedAt: string | null;
202
182
  updatedAt: string;
203
183
  }
204
- export {};
package/dist/types.js CHANGED
@@ -84,39 +84,28 @@ export function parseChannelParticipant(data) {
84
84
  raw: p,
85
85
  };
86
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);
87
+ export function parseSessionMessage(data) {
88
+ const m = (data.message ?? data);
115
89
  return {
116
- id: data.id,
117
- senderType: data.senderType ?? "",
118
- content: d(data.encryptedContent ?? ""),
119
- createdAt: data.createdAt ?? "",
120
- raw: data,
90
+ id: m.id,
91
+ sessionId: m.sessionId ?? "",
92
+ senderType: m.senderType ?? "",
93
+ senderUserId: m.senderUserId ?? null,
94
+ senderAgentId: m.senderAgentId ?? null,
95
+ guestTokenId: m.guestTokenId ?? null,
96
+ encryptedContent: m.encryptedContent ?? "",
97
+ encryptedComponents: m.encryptedComponents ?? null,
98
+ responseRequired: m.responseRequired ?? false,
99
+ category: m.category ?? null,
100
+ priority: m.priority ?? null,
101
+ status: m.status ?? null,
102
+ deadlineAt: m.deadlineAt ?? null,
103
+ replyToMessageId: m.replyToMessageId ?? null,
104
+ respondedAt: m.respondedAt ?? null,
105
+ viewedAt: m.viewedAt ?? null,
106
+ assignedUserId: m.assignedUserId ?? null,
107
+ editedAt: m.editedAt ?? null,
108
+ deletedAt: m.deletedAt ?? null,
109
+ createdAt: m.createdAt ?? "",
121
110
  };
122
111
  }
package/dist/ws.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface HiloopWsClientOptions {
21
21
  /** Max reconnect delay in ms (default: 30000). */
22
22
  maxReconnectDelay?: number;
23
23
  }
24
- export type WsEventType = "connected" | "session.message.new" | "session.message.sent" | "interaction.created" | "interaction.sent" | "interaction.updated" | "interaction.message.new" | "typing.start" | "typing.stop" | "session.closed" | "session.member.joined" | "session.member.left" | "subscribed" | "unsubscribed" | "error" | "pong";
24
+ export type WsEventType = "connected" | "session.message.new" | "session.message.sent" | "typing.start" | "typing.stop" | "session.closed" | "session.member.joined" | "session.member.left" | "subscribed" | "unsubscribed" | "error" | "pong";
25
25
  export type WsEventHandler = (data: any) => void;
26
26
  export declare class HiloopWsClient {
27
27
  private ws;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiloop-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "TypeScript SDK for Hiloop — zero-trust human-AI agent interaction platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",