@hivemagnus/hivemem-sdk 1.1.0 → 1.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.
- package/CHANGELOG.md +16 -0
- package/dist/client.d.ts +10 -1
- package/dist/client.js +17 -2
- package/dist/types.d.ts +28 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@hivemagnus/hivemem-sdk`.
|
|
4
4
|
|
|
5
|
+
## [1.2.0] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `exportAudit({ after, limit })` reads one page of `GET /v1/audit/export` and returns a
|
|
10
|
+
`HiveAuditPage` of `HiveAuditRecord` v1 records. New `HiveAuditRecord` and `HiveAuditPage`
|
|
11
|
+
types.
|
|
12
|
+
|
|
13
|
+
## [1.1.1] - 2026-11-12
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- An error response whose body is not JSON, such as a proxy's HTML 502, is reported with its
|
|
18
|
+
status and text. The body was read twice, and the second read failed with "Body is unusable".
|
|
19
|
+
An empty error body is reported as "HiveMem answered HTTP <status>".
|
|
20
|
+
|
|
5
21
|
## [1.1.0] - 2026-11-12
|
|
6
22
|
|
|
7
23
|
### Added
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContextPackage } from "./context.js";
|
|
2
|
-
import type { ConclusionPage, ConclusionRecord, HiveMemOptions, KnowledgeSourceSyncResponse, MemoryRecord, PeerCardResponse, QueueJobRecord, QueueStatusResponse, SearchResponse, SessionRecord, WebhookEndpoint, WorkspaceCreateOptions, WorkspaceRecord } from "./types.js";
|
|
2
|
+
import type { ConclusionPage, ConclusionRecord, HiveAuditPage, HiveMemOptions, KnowledgeSourceSyncResponse, MemoryRecord, PeerCardResponse, QueueJobRecord, QueueStatusResponse, SearchResponse, SessionRecord, WebhookEndpoint, WorkspaceCreateOptions, WorkspaceRecord } from "./types.js";
|
|
3
3
|
export declare class HiveMem {
|
|
4
4
|
readonly baseUrl: string;
|
|
5
5
|
token?: string;
|
|
@@ -23,6 +23,15 @@ export declare class HiveMem {
|
|
|
23
23
|
* it unchanged. An archived workspace ID is a 409.
|
|
24
24
|
*/
|
|
25
25
|
createWorkspace(workspaceId: string, options?: WorkspaceCreateOptions): Promise<WorkspaceRecord>;
|
|
26
|
+
/**
|
|
27
|
+
* One page of the suite audit export (`GET /v1/audit/export`), oldest first. Pass the last
|
|
28
|
+
* non-null `nextCursor` as `after`; `nextCursor` is null only on an empty page (caught up). Requires an administrator
|
|
29
|
+
* or an Oathweave service token with `hivemem:audit:read`.
|
|
30
|
+
*/
|
|
31
|
+
exportAudit(options?: {
|
|
32
|
+
after?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): Promise<HiveAuditPage>;
|
|
26
35
|
getMemory(memoryId: string, options?: {
|
|
27
36
|
includeHistory?: boolean;
|
|
28
37
|
}): Promise<MemoryRecord>;
|
package/dist/client.js
CHANGED
|
@@ -87,14 +87,21 @@ export class HiveMem {
|
|
|
87
87
|
if (!response.ok) {
|
|
88
88
|
let details;
|
|
89
89
|
let message = response.statusText;
|
|
90
|
+
// Read the body once: a proxy's HTML or plain-text error is not JSON, and a second
|
|
91
|
+
// read of the same body would fail and hide the status.
|
|
92
|
+
const text = await response.text().catch(() => "");
|
|
90
93
|
try {
|
|
91
|
-
details =
|
|
94
|
+
details = JSON.parse(text);
|
|
92
95
|
if (details && typeof details === "object" && "detail" in details)
|
|
93
96
|
message = String(details.detail);
|
|
94
97
|
}
|
|
95
98
|
catch {
|
|
96
|
-
|
|
99
|
+
details = undefined;
|
|
100
|
+
if (text.trim())
|
|
101
|
+
message = text;
|
|
97
102
|
}
|
|
103
|
+
if (!message)
|
|
104
|
+
message = `HiveMem answered HTTP ${response.status}`;
|
|
98
105
|
throw new HiveMemHTTPError(response.status, message, details);
|
|
99
106
|
}
|
|
100
107
|
if (response.status === 204)
|
|
@@ -118,6 +125,14 @@ export class HiveMem {
|
|
|
118
125
|
createWorkspace(workspaceId, options = {}) {
|
|
119
126
|
return this.request("POST", "/v1/workspaces", { body: JSON.stringify({ ...options, workspace_id: workspaceId }) });
|
|
120
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* One page of the suite audit export (`GET /v1/audit/export`), oldest first. Pass the last
|
|
130
|
+
* non-null `nextCursor` as `after`; `nextCursor` is null only on an empty page (caught up). Requires an administrator
|
|
131
|
+
* or an Oathweave service token with `hivemem:audit:read`.
|
|
132
|
+
*/
|
|
133
|
+
exportAudit(options = {}) {
|
|
134
|
+
return this.request("GET", "/v1/audit/export", {}, { after: options.after, limit: options.limit });
|
|
135
|
+
}
|
|
121
136
|
getMemory(memoryId, options = {}) {
|
|
122
137
|
const params = options.includeHistory ? { include_history: true } : {};
|
|
123
138
|
return this.request("GET", `/v1/memories/${encodeURIComponent(memoryId)}`, {}, params);
|
package/dist/types.d.ts
CHANGED
|
@@ -200,6 +200,34 @@ export interface ConclusionPage {
|
|
|
200
200
|
results: ConclusionRecord[];
|
|
201
201
|
next_cursor: string | null;
|
|
202
202
|
}
|
|
203
|
+
/** HiveAuditRecord v1, the suite audit export record. */
|
|
204
|
+
export interface HiveAuditRecord {
|
|
205
|
+
id: string;
|
|
206
|
+
product: "hivemem" | "hiveskills" | "ardentstudio" | "embermend";
|
|
207
|
+
occurredAt: string;
|
|
208
|
+
action: string;
|
|
209
|
+
outcome: "success" | "failure";
|
|
210
|
+
actor: {
|
|
211
|
+
type: "user" | "service" | "agent" | "system";
|
|
212
|
+
id: string;
|
|
213
|
+
issuer?: string;
|
|
214
|
+
displayName?: string;
|
|
215
|
+
};
|
|
216
|
+
target?: {
|
|
217
|
+
type?: string;
|
|
218
|
+
id?: string;
|
|
219
|
+
};
|
|
220
|
+
subject?: {
|
|
221
|
+
actorId?: string;
|
|
222
|
+
agentRef?: string;
|
|
223
|
+
nodeId?: string;
|
|
224
|
+
};
|
|
225
|
+
details: Record<string, string | number | boolean | null>;
|
|
226
|
+
}
|
|
227
|
+
export interface HiveAuditPage {
|
|
228
|
+
data: HiveAuditRecord[];
|
|
229
|
+
nextCursor: string | null;
|
|
230
|
+
}
|
|
203
231
|
export interface WebhookEndpoint {
|
|
204
232
|
id: string;
|
|
205
233
|
owner_agent_id: string;
|