@hainiva/agent-sdk 0.0.0-stage → 0.2.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/LICENSE +21 -0
  3. package/README.md +201 -2
  4. package/SECURITY.md +33 -0
  5. package/dist/cjs/agent.cjs +316 -0
  6. package/dist/cjs/agent.d.cts +235 -0
  7. package/dist/cjs/calls.cjs +277 -0
  8. package/dist/cjs/calls.d.cts +232 -0
  9. package/dist/cjs/contract.cjs +14 -0
  10. package/dist/cjs/contract.d.cts +215 -0
  11. package/dist/cjs/embed.cjs +11 -0
  12. package/dist/cjs/embed.d.cts +13 -0
  13. package/dist/cjs/emitter.cjs +50 -0
  14. package/dist/cjs/emitter.d.cts +22 -0
  15. package/dist/cjs/errors.cjs +28 -0
  16. package/dist/cjs/errors.d.cts +15 -0
  17. package/dist/cjs/events.cjs +97 -0
  18. package/dist/cjs/events.d.cts +97 -0
  19. package/dist/cjs/index.cjs +72 -0
  20. package/dist/cjs/index.d.cts +28 -0
  21. package/dist/cjs/livekit.cjs +56 -0
  22. package/dist/cjs/livekit.d.cts +35 -0
  23. package/dist/cjs/log.cjs +15 -0
  24. package/dist/cjs/log.d.cts +5 -0
  25. package/dist/cjs/react-native.cjs +27 -0
  26. package/dist/cjs/react-native.d.cts +38 -0
  27. package/dist/cjs/redact.cjs +71 -0
  28. package/dist/cjs/redact.d.cts +21 -0
  29. package/dist/cjs/rest.cjs +280 -0
  30. package/dist/cjs/rest.d.cts +166 -0
  31. package/dist/cjs/session.cjs +159 -0
  32. package/dist/cjs/session.d.cts +101 -0
  33. package/dist/cjs/singleFlight.cjs +49 -0
  34. package/dist/cjs/singleFlight.d.cts +32 -0
  35. package/dist/cjs/url.cjs +39 -0
  36. package/dist/cjs/url.d.cts +13 -0
  37. package/dist/cjs/web.cjs +28 -0
  38. package/dist/cjs/web.d.cts +23 -0
  39. package/dist/cjs/ws.cjs +246 -0
  40. package/dist/cjs/ws.d.cts +134 -0
  41. package/dist/esm/agent.d.ts +236 -0
  42. package/dist/esm/agent.d.ts.map +1 -0
  43. package/dist/esm/agent.js +313 -0
  44. package/dist/esm/agent.js.map +1 -0
  45. package/dist/esm/calls.d.ts +233 -0
  46. package/dist/esm/calls.d.ts.map +1 -0
  47. package/dist/esm/calls.js +271 -0
  48. package/dist/esm/calls.js.map +1 -0
  49. package/dist/esm/contract.d.ts +216 -0
  50. package/dist/esm/contract.d.ts.map +1 -0
  51. package/dist/esm/contract.js +12 -0
  52. package/dist/esm/contract.js.map +1 -0
  53. package/dist/esm/embed.d.ts +14 -0
  54. package/dist/esm/embed.d.ts.map +1 -0
  55. package/dist/esm/embed.js +9 -0
  56. package/dist/esm/embed.js.map +1 -0
  57. package/dist/esm/emitter.d.ts +23 -0
  58. package/dist/esm/emitter.d.ts.map +1 -0
  59. package/dist/esm/emitter.js +47 -0
  60. package/dist/esm/emitter.js.map +1 -0
  61. package/dist/esm/errors.d.ts +16 -0
  62. package/dist/esm/errors.d.ts.map +1 -0
  63. package/dist/esm/errors.js +25 -0
  64. package/dist/esm/errors.js.map +1 -0
  65. package/dist/esm/events.d.ts +98 -0
  66. package/dist/esm/events.d.ts.map +1 -0
  67. package/dist/esm/events.js +90 -0
  68. package/dist/esm/events.js.map +1 -0
  69. package/dist/esm/index.d.ts +29 -0
  70. package/dist/esm/index.d.ts.map +1 -0
  71. package/dist/esm/index.js +29 -0
  72. package/dist/esm/index.js.map +1 -0
  73. package/dist/esm/livekit.d.ts +36 -0
  74. package/dist/esm/livekit.d.ts.map +1 -0
  75. package/dist/esm/livekit.js +54 -0
  76. package/dist/esm/livekit.js.map +1 -0
  77. package/dist/esm/log.d.ts +6 -0
  78. package/dist/esm/log.d.ts.map +1 -0
  79. package/dist/esm/log.js +13 -0
  80. package/dist/esm/log.js.map +1 -0
  81. package/dist/esm/react-native.d.ts +39 -0
  82. package/dist/esm/react-native.d.ts.map +1 -0
  83. package/dist/esm/react-native.js +23 -0
  84. package/dist/esm/react-native.js.map +1 -0
  85. package/dist/esm/redact.d.ts +22 -0
  86. package/dist/esm/redact.d.ts.map +1 -0
  87. package/dist/esm/redact.js +66 -0
  88. package/dist/esm/redact.js.map +1 -0
  89. package/dist/esm/rest.d.ts +167 -0
  90. package/dist/esm/rest.d.ts.map +1 -0
  91. package/dist/esm/rest.js +275 -0
  92. package/dist/esm/rest.js.map +1 -0
  93. package/dist/esm/session.d.ts +102 -0
  94. package/dist/esm/session.d.ts.map +1 -0
  95. package/dist/esm/session.js +155 -0
  96. package/dist/esm/session.js.map +1 -0
  97. package/dist/esm/singleFlight.d.ts +33 -0
  98. package/dist/esm/singleFlight.d.ts.map +1 -0
  99. package/dist/esm/singleFlight.js +46 -0
  100. package/dist/esm/singleFlight.js.map +1 -0
  101. package/dist/esm/url.d.ts +14 -0
  102. package/dist/esm/url.d.ts.map +1 -0
  103. package/dist/esm/url.js +37 -0
  104. package/dist/esm/url.js.map +1 -0
  105. package/dist/esm/web.d.ts +24 -0
  106. package/dist/esm/web.d.ts.map +1 -0
  107. package/dist/esm/web.js +23 -0
  108. package/dist/esm/web.js.map +1 -0
  109. package/dist/esm/ws.d.ts +135 -0
  110. package/dist/esm/ws.d.ts.map +1 -0
  111. package/dist/esm/ws.js +242 -0
  112. package/dist/esm/ws.js.map +1 -0
  113. package/package.json +80 -4
@@ -0,0 +1,216 @@
1
+ /**
2
+ * GENERATED from the HAINIVA monorepo (@aicc/types agentApi.ts and
3
+ * agentEvents.ts) — do not edit by hand. The Agent API's response shapes and
4
+ * event names: additive changes only within a major version.
5
+ */
6
+ export type AgentPresenceStatus = "online" | "busy" | "away" | "offline";
7
+ export type AgentRole = "agent" | "supervisor";
8
+ export interface AgentMeDto {
9
+ id: string;
10
+ externalId: string | null;
11
+ displayName: string | null;
12
+ role: AgentRole;
13
+ /** Team ids this member works in; null = the whole organisation. */
14
+ teams: string[] | null;
15
+ status: AgentPresenceStatus | null;
16
+ session: {
17
+ id: string;
18
+ agentAppId: string;
19
+ mode: "live" | "test";
20
+ expiresAt: string;
21
+ };
22
+ }
23
+ export interface AgentRingDto {
24
+ callId: string;
25
+ conversationId: string;
26
+ kind: "voice" | "video" | "chat";
27
+ channel: string;
28
+ contactName: string | null;
29
+ callerNumber: string | null;
30
+ /** direct = routed to you; queue = offered to your queue; escalation = a live call handed to you. */
31
+ path: "direct" | "queue" | "escalation";
32
+ startedAt: string;
33
+ }
34
+ export interface AgentCallDto {
35
+ callId: string;
36
+ conversationId: string;
37
+ kind: "voice" | "video" | "chat";
38
+ channel: string;
39
+ direction: "inbound" | "outbound" | "internal";
40
+ status: string;
41
+ assignedToMe: boolean;
42
+ startedAt: string;
43
+ endedAt: string | null;
44
+ contactName: string | null;
45
+ callerNumber: string | null;
46
+ }
47
+ export interface AgentMediaTokenDto {
48
+ token: string;
49
+ roomName: string;
50
+ livekitUrl: string;
51
+ expiresAt: string;
52
+ }
53
+ export interface AgentConversationDto {
54
+ id: string;
55
+ status: string;
56
+ subject: string | null;
57
+ channel: string | null;
58
+ chatType: string | null;
59
+ contact: {
60
+ id: string;
61
+ name: string | null;
62
+ phone: string | null;
63
+ };
64
+ assignedAgentId: string | null;
65
+ assignedToMe: boolean;
66
+ queueId: string | null;
67
+ /** The open interaction a message or file goes to (null when none is open). */
68
+ activeInteractionId: string | null;
69
+ lastMessageAt: string | null;
70
+ createdAt: string;
71
+ closedAt: string | null;
72
+ }
73
+ export interface AgentMessageDto {
74
+ id: string;
75
+ conversationId: string;
76
+ interactionId: string;
77
+ direction: string;
78
+ senderType: string;
79
+ /** agents.id of the sender when an agent wrote it. */
80
+ senderAgentId: string | null;
81
+ senderName: string | null;
82
+ type: string;
83
+ text: string | null;
84
+ attachment: {
85
+ name: string | null;
86
+ mimeType: string | null;
87
+ size: number | null;
88
+ } | null;
89
+ createdAt: string;
90
+ }
91
+ export interface AgentDispositionDto {
92
+ code: string;
93
+ label: string;
94
+ channel: string | null;
95
+ required: boolean;
96
+ }
97
+ export interface SupervisorLiveCallDto {
98
+ callId: string;
99
+ conversationId: string;
100
+ agentId: string | null;
101
+ agentName: string | null;
102
+ channel: string;
103
+ status: string;
104
+ startedAt: string;
105
+ contactName: string | null;
106
+ callerNumber: string | null;
107
+ queueId: string | null;
108
+ }
109
+ export interface SupervisorAgentDto {
110
+ id: string;
111
+ displayName: string;
112
+ externalId: string | null;
113
+ role: AgentRole;
114
+ teamId: string | null;
115
+ status: AgentPresenceStatus;
116
+ activeCalls: number;
117
+ openConversations: number;
118
+ }
119
+ export interface AgentPage<T> {
120
+ data: T[];
121
+ nextCursor: string | null;
122
+ }
123
+ /** POST /agent/v1/sessions (201) and POST /agent/v1/sessions/refresh (200). */
124
+ export interface AgentSessionDto {
125
+ accessToken: string;
126
+ accessExpiresAt: string;
127
+ /** hnv_rt_…, rotating: each refresh answers a new one and the old one stops working. */
128
+ refreshToken: string;
129
+ refreshExpiresAt: string;
130
+ sessionId: string;
131
+ member: {
132
+ id: string;
133
+ externalId: string | null;
134
+ displayName: string;
135
+ role: AgentRole;
136
+ };
137
+ app: {
138
+ id: string;
139
+ name: string;
140
+ mode: "live" | "test";
141
+ };
142
+ /** The event socket on the host the app reached; SDKs derive their own from their base URL. */
143
+ wsUrl: string;
144
+ }
145
+ /** POST /agent/v1/calls/:id/accept. `media` is null for a call without a room (chat). */
146
+ export interface AgentAcceptDto {
147
+ callId: string;
148
+ accepted: true;
149
+ media: AgentMediaTokenDto | null;
150
+ }
151
+ /** POST /agent/v1/supervisor/calls/:id/supervise. */
152
+ export interface SupervisorSuperviseDto {
153
+ callId: string;
154
+ mode: "monitor" | "whisper" | "barge";
155
+ media: AgentMediaTokenDto;
156
+ }
157
+ /** POST /agent/v1/push/subscriptions body. */
158
+ export interface AgentPushSubscriptionInput {
159
+ platform: "ios" | "android";
160
+ /** FCM registration token (Android) or APNs device token, hex (iPhone). */
161
+ token: string;
162
+ /** voip = rings (PushKit on iPhone, high-priority data on Android); alert = ordinary notices. */
163
+ kind: "voip" | "alert";
164
+ /** Must be one of the agent app's allowedBundleIds. */
165
+ bundleId: string;
166
+ /** A stable id for this install: a new token from the same install replaces the old one. */
167
+ deviceId?: string;
168
+ }
169
+ /** POST /agent/v1/push/subscriptions (201). The token is never echoed. */
170
+ export interface AgentPushSubscriptionDto {
171
+ id: string;
172
+ platform: "ios" | "android";
173
+ kind: "voip" | "alert";
174
+ bundleId: string;
175
+ /** Whether the agent app has working push credentials for this platform right now. */
176
+ deliverable: boolean;
177
+ createdAt: string;
178
+ }
179
+ /** Event data of the stream's call.ringing. */
180
+ export interface AgentCallRingingData {
181
+ callId: string;
182
+ conversationId: string;
183
+ path: "direct" | "queue" | "transfer";
184
+ channel?: string | null;
185
+ line?: string | null;
186
+ contactName: string | null;
187
+ callerNumber?: string | null;
188
+ fromAgentId?: string | null;
189
+ fromAgentName?: string | null;
190
+ transferMode?: "warm" | "blind";
191
+ /** ISO time the ring ends, when the server knows it. */
192
+ expiresAt: string | null;
193
+ }
194
+ /** Event data of the stream's call.ended. callId is null when only the conversation is known. */
195
+ export interface AgentCallEndedData {
196
+ callId: string | null;
197
+ conversationId: string | null;
198
+ reason: "ended" | "failed" | "answered_elsewhere" | "declined" | "expired" | "transfer_ended";
199
+ answeredBy?: string | null;
200
+ failure?: {
201
+ reason: string;
202
+ };
203
+ }
204
+ export declare const AGENT_EVENT_NAMES: readonly ["call.ringing", "call.ended", "conversation.assigned", "message.created", "wrapup.required", "presence.changed", "supervisor.alert"];
205
+ export type AgentEventName = (typeof AGENT_EVENT_NAMES)[number];
206
+ export interface AgentEvent {
207
+ event: AgentEventName;
208
+ data: Record<string, unknown>;
209
+ }
210
+ /** What the stream delivers: the event plus its position (resume from it). */
211
+ export interface AgentStreamFrame extends AgentEvent {
212
+ type: "event";
213
+ seq: number;
214
+ at: string;
215
+ }
216
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../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,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,WAAW,UAAU;IAAG,KAAK,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE;AAEpF,8EAA8E;AAC9E,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAAG,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * GENERATED from the HAINIVA monorepo (@aicc/types agentApi.ts and
3
+ * agentEvents.ts) — do not edit by hand. The Agent API's response shapes and
4
+ * event names: additive changes only within a major version.
5
+ */
6
+ /* eslint-disable */
7
+ // ── The event stream (/agent/v1/ws) ──────────────────────────────────────────
8
+ export const AGENT_EVENT_NAMES = [
9
+ "call.ringing", "call.ended", "conversation.assigned", "message.created",
10
+ "wrapup.required", "presence.changed", "supervisor.alert",
11
+ ];
12
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/contract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAoB;AA+KpB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,cAAc,EAAE,YAAY,EAAE,uBAAuB,EAAE,iBAAiB;IACxE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB;CACjD,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @hainiva/agent-sdk/embed — the embeddable HAINIVA desk (iframe / WebView with a
3
+ * postMessage bridge). Planned for milestone M3; not part of this release.
4
+ */
5
+ export interface MountDeskOptions {
6
+ container: unknown;
7
+ getAccessToken: () => Promise<string>;
8
+ }
9
+ export interface MountedDesk {
10
+ destroy(): void;
11
+ }
12
+ /** Not yet available: throws. */
13
+ export declare function mountDesk(_options?: MountDeskOptions): MountedDesk;
14
+ //# sourceMappingURL=embed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/embed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,iCAAiC;AACjC,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAElE"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @hainiva/agent-sdk/embed — the embeddable HAINIVA desk (iframe / WebView with a
3
+ * postMessage bridge). Planned for milestone M3; not part of this release.
4
+ */
5
+ /** Not yet available: throws. */
6
+ export function mountDesk(_options) {
7
+ throw new Error("@hainiva/agent-sdk/embed is not yet available");
8
+ }
9
+ //# sourceMappingURL=embed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.js","sourceRoot":"","sources":["../../src/embed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,iCAAiC;AACjC,MAAM,UAAU,SAAS,CAAC,QAA2B;IACnD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A small typed event emitter. `Events` maps each event name to its payload:
3
+ *
4
+ * const e = new TypedEmitter<{ state: ConnectionState; ready: undefined }>();
5
+ * const off = e.on("state", (s) => …); e.emit("state", "open"); e.emit("ready", undefined);
6
+ *
7
+ * A listener that throws does not stop the others; the error goes to `onError`.
8
+ */
9
+ export declare class TypedEmitter<Events extends {
10
+ [K in keyof Events]: unknown;
11
+ }> {
12
+ private readonly onError?;
13
+ private readonly listeners;
14
+ constructor(onError?: ((error: unknown, event: keyof Events) => void) | undefined);
15
+ on<K extends keyof Events>(event: K, fn: (payload: Events[K]) => void): () => void;
16
+ once<K extends keyof Events>(event: K, fn: (payload: Events[K]) => void): () => void;
17
+ /** Remove a listener added with on(). (A once() listener is removed by the function once() returned.) */
18
+ off<K extends keyof Events>(event: K, fn: (payload: Events[K]) => void): void;
19
+ emit<K extends keyof Events>(event: K, payload: Events[K]): void;
20
+ listenerCount(event: keyof Events): number;
21
+ removeAll(): void;
22
+ }
23
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,YAAY,CAAC,MAAM,SAAS;KAAG,CAAC,IAAI,MAAM,MAAM,GAAG,OAAO;CAAE;IAG3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAFrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;gBAEvC,OAAO,CAAC,GAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,KAAK,IAAI,aAAA;IAEpF,EAAE,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAOlF,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAKpF,yGAAyG;IACzG,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAI7E,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAShE,aAAa,CAAC,KAAK,EAAE,MAAM,MAAM,GAAG,MAAM;IAE1C,SAAS,IAAI,IAAI;CAClB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A small typed event emitter. `Events` maps each event name to its payload:
3
+ *
4
+ * const e = new TypedEmitter<{ state: ConnectionState; ready: undefined }>();
5
+ * const off = e.on("state", (s) => …); e.emit("state", "open"); e.emit("ready", undefined);
6
+ *
7
+ * A listener that throws does not stop the others; the error goes to `onError`.
8
+ */
9
+ export class TypedEmitter {
10
+ constructor(onError) {
11
+ this.onError = onError;
12
+ this.listeners = new Map();
13
+ }
14
+ on(event, fn) {
15
+ let set = this.listeners.get(event);
16
+ if (!set) {
17
+ set = new Set();
18
+ this.listeners.set(event, set);
19
+ }
20
+ set.add(fn);
21
+ return () => this.off(event, fn);
22
+ }
23
+ once(event, fn) {
24
+ const off = this.on(event, (p) => { off(); fn(p); });
25
+ return off;
26
+ }
27
+ /** Remove a listener added with on(). (A once() listener is removed by the function once() returned.) */
28
+ off(event, fn) {
29
+ this.listeners.get(event)?.delete(fn);
30
+ }
31
+ emit(event, payload) {
32
+ const set = this.listeners.get(event);
33
+ if (!set)
34
+ return;
35
+ for (const fn of [...set]) {
36
+ try {
37
+ fn(payload);
38
+ }
39
+ catch (e) {
40
+ this.onError?.(e, event);
41
+ }
42
+ }
43
+ }
44
+ listenerCount(event) { return this.listeners.get(event)?.size ?? 0; }
45
+ removeAll() { this.listeners.clear(); }
46
+ }
47
+ //# sourceMappingURL=emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IAGvB,YAA6B,OAAuD;QAAvD,YAAO,GAAP,OAAO,CAAgD;QAFnE,cAAS,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEmB,CAAC;IAExF,EAA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;IAED,aAAa,CAAC,KAAmB,IAAY,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3F,SAAS,KAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC9C"}
@@ -0,0 +1,16 @@
1
+ import { Redactor } from "./redact.js";
2
+ /**
3
+ * Every error the SDK raises. The message is only `status code`, and the body is
4
+ * redacted when the error is made: a partner who logs errors (or sends them to a
5
+ * crash reporter) never ships a token with them.
6
+ */
7
+ export declare class HainivaAgentError extends Error {
8
+ readonly status: number;
9
+ readonly code: string;
10
+ readonly body: Record<string, unknown>;
11
+ /** status 0 = raised by the SDK itself (configuration, network), not by HAINIVA. */
12
+ constructor(status: number, code: string, body?: Record<string, unknown>, redactor?: Redactor);
13
+ /** Wrap anything thrown below the SDK (fetch, WebSocket, LiveKit) without carrying its secrets along. */
14
+ static from(e: unknown, code?: string, redactor?: Redactor): HainivaAgentError;
15
+ }
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA6B,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,oFAAoF;gBACxE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IASjG,yGAAyG;IACzG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,SAAW,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,iBAAiB;CAKjF"}
@@ -0,0 +1,25 @@
1
+ import { redactString, redactValue } from "./redact.js";
2
+ /**
3
+ * Every error the SDK raises. The message is only `status code`, and the body is
4
+ * redacted when the error is made: a partner who logs errors (or sends them to a
5
+ * crash reporter) never ships a token with them.
6
+ */
7
+ export class HainivaAgentError extends Error {
8
+ /** status 0 = raised by the SDK itself (configuration, network), not by HAINIVA. */
9
+ constructor(status, code, body = {}, redactor) {
10
+ const c = redactor ? redactor.string(code) : redactString(code);
11
+ super(`${status} ${c}`);
12
+ this.name = "HainivaAgentError";
13
+ this.status = status;
14
+ this.code = c;
15
+ this.body = (redactor ? redactor.value(body) : redactValue(body));
16
+ }
17
+ /** Wrap anything thrown below the SDK (fetch, WebSocket, LiveKit) without carrying its secrets along. */
18
+ static from(e, code = "failed", redactor) {
19
+ if (e instanceof HainivaAgentError)
20
+ return e;
21
+ const message = e instanceof Error ? e.message : String(e);
22
+ return new HainivaAgentError(0, code, { cause: message }, redactor);
23
+ }
24
+ }
25
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAK1C,oFAAoF;IACpF,YAAY,MAAc,EAAE,IAAY,EAAE,OAAgC,EAAE,EAAE,QAAmB;QAC/F,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAChE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAA4B,CAAC;IAC/F,CAAC;IAED,yGAAyG;IACzG,MAAM,CAAC,IAAI,CAAC,CAAU,EAAE,IAAI,GAAG,QAAQ,EAAE,QAAmB;QAC1D,IAAI,CAAC,YAAY,iBAAiB;YAAE,OAAO,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,IAAI,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC;CACF"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * The `/agent/v1/ws` protocol (v1) as ReconnectingSocket options, and the
3
+ * mapping of its events to the SDK's typed events and to the call state machine.
4
+ *
5
+ * client → auth {token, lastSeq?} FIRST frame (the token never rides in the URL)
6
+ * → token.refresh {token, id} swap in a refreshed access token
7
+ * → ping
8
+ * server → ready {seq, expiresAt}
9
+ * → event {seq, event, data, at}
10
+ * → resync_required {fromSeq} events after your lastSeq are gone: refetch over REST
11
+ * → ack {id, ok, error?} · session.expiring {expiresAt} · pong · error {code}
12
+ * close 4001 token refused/expired (refresh, reconnect) · 4003 revoked (stop)
13
+ * 4008 auth timeout · 4029 rate limited (reconnect with backoff)
14
+ * 4009 too many sockets · 1003 binary frame (stop: retrying cannot fix them)
15
+ *
16
+ * The resume position travels in the auth frame, so the server replays from it
17
+ * atomically with authentication (no window in which a live event overtakes
18
+ * the replay).
19
+ */
20
+ import type { CallEvent, CallInfo, CallsState } from "./calls.js";
21
+ import type { AgentEventName } from "./contract.js";
22
+ import type { SocketOptions } from "./ws.js";
23
+ export type { AgentEventName } from "./contract.js";
24
+ /** One event frame from the server. */
25
+ export interface AgentEventFrame<D = Record<string, unknown>> {
26
+ v?: number;
27
+ type: "event";
28
+ event: AgentEventName;
29
+ seq: number;
30
+ at: string;
31
+ data: D;
32
+ }
33
+ /** Any frame from the server. */
34
+ export type AgentServerFrame = AgentEventFrame | {
35
+ v?: number;
36
+ type: "ready";
37
+ seq: number;
38
+ expiresAt?: string;
39
+ protocol?: number;
40
+ } | {
41
+ v?: number;
42
+ type: "resync_required";
43
+ fromSeq: number;
44
+ } | {
45
+ v?: number;
46
+ type: "ack";
47
+ id: string;
48
+ ok: boolean;
49
+ error?: string;
50
+ expiresAt?: string;
51
+ } | {
52
+ v?: number;
53
+ type: "session.expiring";
54
+ expiresAt: string;
55
+ } | {
56
+ v?: number;
57
+ type: "pong";
58
+ } | {
59
+ v?: number;
60
+ type: "error";
61
+ code?: string;
62
+ };
63
+ export type AgentClientFrame = {
64
+ type: "auth";
65
+ token: string;
66
+ lastSeq?: number;
67
+ } | {
68
+ type: "token.refresh";
69
+ token: string;
70
+ id: string;
71
+ } | {
72
+ type: "resume";
73
+ lastSeq: number;
74
+ id?: string;
75
+ } | {
76
+ type: "ping";
77
+ };
78
+ export declare const AGENT_CLOSE_CODES: {
79
+ readonly tokenExpired: 4001;
80
+ readonly revoked: 4003;
81
+ readonly authTimeout: 4008;
82
+ readonly tooManySockets: 4009;
83
+ readonly rateLimited: 4029;
84
+ };
85
+ /** The protocol as ReconnectingSocket options. `lastSeq()` is read when the auth frame is built. */
86
+ export declare function agentSocketBindings(lastSeq: () => number): Pick<SocketOptions<AgentServerFrame, AgentClientFrame>, "authFrame" | "isReady" | "resume" | "seqOf" | "tokenFrame" | "closeCodes" | "heartbeat">;
87
+ /** Is this a well-formed event frame with a name this SDK knows? Unknown names are passed on as `event.unknown`. */
88
+ export declare function isEventFrame(f: unknown): f is AgentEventFrame;
89
+ export declare const isKnownEvent: (name: string) => name is AgentEventName;
90
+ /** Pure: call.ringing data → the state machine's CallInfo (null when malformed). */
91
+ export declare function ringInfo(d: Record<string, unknown>, now: number, defaultRingMs: number): CallInfo | null;
92
+ /**
93
+ * Pure: an event → the state-machine events it causes (empty when it is not
94
+ * about calls this device knows). `state` resolves a call.ended that names only
95
+ * the conversation.
96
+ */
97
+ export declare function toCallEvents(frame: AgentEventFrame, state: CallsState, now: number, defaultRingMs?: number): CallEvent[];
98
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAA4C,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,uCAAuC;AACvC,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,cAAc,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC;CACT;AAED,iCAAiC;AACjC,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE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,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,CAAC,CAe1F;AAED,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAI7D;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,cAAyE,CAAC;AAI9H,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAmBxG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,SAAS,GAAG,SAAS,EAAE,CA2BxH"}
@@ -0,0 +1,90 @@
1
+ import { AGENT_EVENT_NAMES } from "./contract.js";
2
+ export const AGENT_CLOSE_CODES = { tokenExpired: 4001, revoked: 4003, authTimeout: 4008, tooManySockets: 4009, rateLimited: 4029 };
3
+ let tokenFrameSeq = 0;
4
+ /** The protocol as ReconnectingSocket options. `lastSeq()` is read when the auth frame is built. */
5
+ export function agentSocketBindings(lastSeq) {
6
+ return {
7
+ authFrame: (token) => {
8
+ const s = lastSeq();
9
+ return s > 0 ? { type: "auth", token, lastSeq: s } : { type: "auth", token };
10
+ },
11
+ isReady: (f) => f?.type === "ready",
12
+ // Resume rides in the auth frame (above): no separate frame after ready.
13
+ resume: () => null,
14
+ seqOf: (f) => (f?.type === "event" && typeof f.seq === "number" && Number.isInteger(f.seq) ? f.seq : undefined),
15
+ tokenFrame: (token) => ({ type: "token.refresh", token, id: `t${++tokenFrameSeq}` }),
16
+ closeCodes: { tokenExpired: AGENT_CLOSE_CODES.tokenExpired, revoked: AGENT_CLOSE_CODES.revoked, fatal: [AGENT_CLOSE_CODES.tooManySockets, 1003] },
17
+ // The server closes a socket that sends more than 120 frames a minute; 20 s is 3.
18
+ heartbeat: { intervalMs: 20000, timeoutMs: 60000, frame: () => ({ type: "ping" }) },
19
+ };
20
+ }
21
+ /** Is this a well-formed event frame with a name this SDK knows? Unknown names are passed on as `event.unknown`. */
22
+ export function isEventFrame(f) {
23
+ const x = f;
24
+ return !!x && x["type"] === "event" && typeof x["event"] === "string" && typeof x["seq"] === "number"
25
+ && !!x["data"] && typeof x["data"] === "object" && !Array.isArray(x["data"]);
26
+ }
27
+ export const isKnownEvent = (name) => AGENT_EVENT_NAMES.includes(name);
28
+ const str = (v) => (typeof v === "string" && v ? v : null);
29
+ /** Pure: call.ringing data → the state machine's CallInfo (null when malformed). */
30
+ export function ringInfo(d, now, defaultRingMs) {
31
+ const r = d;
32
+ const callId = str(r.callId);
33
+ if (!callId)
34
+ return null;
35
+ const path = r.path === "direct" || r.path === "queue" || r.path === "transfer" ? r.path : "queue";
36
+ const exp = str(r.expiresAt) ? Date.parse(r.expiresAt) : NaN;
37
+ const conversationId = str(r.conversationId);
38
+ const line = str(r.line);
39
+ return {
40
+ id: callId,
41
+ ...(conversationId ? { conversationId } : {}),
42
+ direction: "inbound",
43
+ path,
44
+ from: str(r.contactName) ?? str(r.callerNumber) ?? str(r.fromAgentName) ?? "",
45
+ ...(line ? { line } : {}),
46
+ // A ring without an end the server knows still ends: a lost cancel must not leave a ghost ring.
47
+ expiresAt: Number.isFinite(exp) ? exp : now + defaultRingMs,
48
+ ...(path === "transfer" ? { transfer: { mode: r.transferMode === "blind" ? "blind" : "warm" } } : {}),
49
+ };
50
+ }
51
+ /**
52
+ * Pure: an event → the state-machine events it causes (empty when it is not
53
+ * about calls this device knows). `state` resolves a call.ended that names only
54
+ * the conversation.
55
+ */
56
+ export function toCallEvents(frame, state, now, defaultRingMs = 60000) {
57
+ if (frame.event === "call.ringing") {
58
+ const call = ringInfo(frame.data, now, defaultRingMs);
59
+ return call ? [{ type: "ring", call, at: now }] : [];
60
+ }
61
+ if (frame.event !== "call.ended")
62
+ return [];
63
+ const d = frame.data;
64
+ const ids = [];
65
+ const callId = str(d.callId);
66
+ if (callId)
67
+ ids.push(callId);
68
+ else if (str(d.conversationId)) {
69
+ for (const c of Object.values(state.calls))
70
+ if (c.info.conversationId === d.conversationId && c.phase !== "ended")
71
+ ids.push(c.info.id);
72
+ }
73
+ const out = [];
74
+ for (const id of ids) {
75
+ const c = state.calls[id];
76
+ if (!c || c.phase === "ended")
77
+ continue;
78
+ if (c.phase === "ringing" || c.phase === "connecting") {
79
+ const reason = d.reason === "answered_elsewhere" ? "answered_elsewhere"
80
+ : d.reason === "ended" || d.reason === "failed" ? "remote_ended" : "cancelled";
81
+ out.push({ type: "ring_cancelled", id, reason, at: now });
82
+ }
83
+ else if (d.reason !== "answered_elsewhere") {
84
+ // On the call: the caller hung up, the server ended it, or a blind transfer handed it over.
85
+ out.push({ type: "remote_end", id, at: now });
86
+ }
87
+ }
88
+ return out;
89
+ }
90
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA+BlD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAW,CAAC;AAE5I,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,oGAAoG;AACpG,MAAM,UAAU,mBAAmB,CAAC,OAAqB;IAEvD,OAAO;QACL,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC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C,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @hainiva/agent-sdk — build your own agent app on HAINIVA AICC: staff sign-in
3
+ * with your backend's assertion, the live event stream, and calls.
4
+ *
5
+ * Entry points:
6
+ * "@hainiva/agent-sdk" transport-agnostic core (this file) — no LiveKit, no DOM, no React Native
7
+ * "@hainiva/agent-sdk/web" localStorage store (opt-in), LiveKit call media
8
+ * "@hainiva/agent-sdk/react-native" secure-store session, LiveKit call media
9
+ * "@hainiva/agent-sdk/embed" the embeddable desk (not yet available)
10
+ *
11
+ * Start with HainivaAgent (./agent): it wires the session, the REST client,
12
+ * the event socket and the call state machine together. The parts are exported
13
+ * too, for apps that want their own wiring.
14
+ */
15
+ export declare const SDK_VERSION = "0.2.0";
16
+ export { HainivaAgentError } from "./errors.js";
17
+ export { Redactor, redactString, redactValue } from "./redact.js";
18
+ export { safeLogger, type Logger } from "./log.js";
19
+ export { assertSafeUrl, type UrlRules } from "./url.js";
20
+ export { TypedEmitter } from "./emitter.js";
21
+ export { singleFlight, createTokenRefresher, type RefreshedToken, type TokenRefresher, type TokenRefresherOptions } from "./singleFlight.js";
22
+ export { SessionManager, memoryStore, type AgentSession, type GetAssertion, type SessionEvents, type SessionManagerOptions, type SessionStore, type SessionTransport, } from "./session.js";
23
+ export { ReconnectingSocket, backoffDelay, type ConnectionState, type SocketEvents, type SocketOptions, type WebSocketCtor, type WebSocketLike, } from "./ws.js";
24
+ export { CallStore, transition, activeCall, ringingCalls, initialCallsState, type Call, type CallDirection, type CallEffect, type CallEvent, type CallInfo, type CallPath, type CallPhase, type CallsState, type CallStoreEvents, type CallStoreOptions, type EndReason, type Transition, type TransferState, type TransferTarget, } from "./calls.js";
25
+ export { HainivaAgent, type HainivaAgentEvents, type HainivaAgentOptions, type JoinMedia, type MediaSession } from "./agent.js";
26
+ export { AgentRestClient, errorFromResponse, newIdempotencyKey, type AgentRestOptions, type AgentStatus, type CallTransferTarget, type ConversationListQuery, type MediaCredentials, type RequestOptions, type TokenSource, } from "./rest.js";
27
+ export { AGENT_CLOSE_CODES, agentSocketBindings, isEventFrame, ringInfo, toCallEvents, type AgentClientFrame, type AgentEventFrame, type AgentServerFrame, } from "./events.js";
28
+ export * from "./contract.js";
29
+ //# sourceMappingURL=index.d.ts.map