@vertesia/client 1.5.0-dev.20260807.073259Z → 1.5.0-dev.20260901.005903Z
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/lib/AppsApi.d.ts +9 -8
- package/lib/AppsApi.d.ts.map +1 -1
- package/lib/AppsApi.js +11 -4
- package/lib/AppsApi.js.map +1 -1
- package/lib/GroupsApi.d.ts +4 -11
- package/lib/GroupsApi.d.ts.map +1 -1
- package/lib/GroupsApi.js.map +1 -1
- package/lib/InteractionBase.d.ts +114 -0
- package/lib/InteractionBase.d.ts.map +1 -1
- package/lib/InteractionCatalogApi.d.ts +3 -3
- package/lib/InteractionCatalogApi.d.ts.map +1 -1
- package/lib/InteractionCatalogApi.js +1 -1
- package/lib/InteractionOutput.d.ts +13 -3
- package/lib/InteractionOutput.d.ts.map +1 -1
- package/lib/InteractionOutput.js +33 -3
- package/lib/InteractionOutput.js.map +1 -1
- package/lib/OAuthServerApi.d.ts +1 -1
- package/lib/OAuthServerApi.d.ts.map +1 -1
- package/lib/OAuthServerApi.js +9 -2
- package/lib/OAuthServerApi.js.map +1 -1
- package/lib/ProjectsApi.d.ts +3 -3
- package/lib/ProjectsApi.d.ts.map +1 -1
- package/lib/ProjectsApi.js.map +1 -1
- package/lib/RunsApi.d.ts +6 -28
- package/lib/RunsApi.d.ts.map +1 -1
- package/lib/RunsApi.js +3 -3
- package/lib/RunsApi.js.map +1 -1
- package/lib/ToolsApi.d.ts +2 -1
- package/lib/ToolsApi.d.ts.map +1 -1
- package/lib/ToolsApi.js +9 -0
- package/lib/ToolsApi.js.map +1 -1
- package/lib/ViewsApi.d.ts +1 -1
- package/lib/ViewsApi.js +1 -1
- package/lib/client.d.ts +1 -0
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +3 -0
- package/lib/client.js.map +1 -1
- package/lib/execute.js +2 -2
- package/lib/execute.js.map +1 -1
- package/lib/store/AgentsApi.d.ts +4 -1
- package/lib/store/AgentsApi.d.ts.map +1 -1
- package/lib/store/AgentsApi.js +6 -4
- package/lib/store/AgentsApi.js.map +1 -1
- package/lib/store/CollectionsApi.d.ts +5 -2
- package/lib/store/CollectionsApi.d.ts.map +1 -1
- package/lib/store/CollectionsApi.js.map +1 -1
- package/lib/store/EmailApi.d.ts +9 -107
- package/lib/store/EmailApi.d.ts.map +1 -1
- package/lib/store/EmailApi.js.map +1 -1
- package/lib/store/FilesApi.d.ts +3 -1
- package/lib/store/FilesApi.d.ts.map +1 -1
- package/lib/store/FilesApi.js +7 -0
- package/lib/store/FilesApi.js.map +1 -1
- package/lib/store/ObjectsApi.d.ts +29 -4
- package/lib/store/ObjectsApi.d.ts.map +1 -1
- package/lib/store/ObjectsApi.js +0 -2
- package/lib/store/ObjectsApi.js.map +1 -1
- package/lib/store/PendingAsksApi.d.ts +2 -53
- package/lib/store/PendingAsksApi.d.ts.map +1 -1
- package/lib/store/PendingAsksApi.js.map +1 -1
- package/lib/store/ProcessApi.d.ts +15 -8
- package/lib/store/ProcessApi.d.ts.map +1 -1
- package/lib/store/ProcessApi.js +27 -1
- package/lib/store/ProcessApi.js.map +1 -1
- package/lib/store/ProcessTestRunApi.d.ts +26 -0
- package/lib/store/ProcessTestRunApi.d.ts.map +1 -0
- package/lib/store/ProcessTestRunApi.js +36 -0
- package/lib/store/ProcessTestRunApi.js.map +1 -0
- package/lib/store/QueryApi.d.ts +9 -51
- package/lib/store/QueryApi.d.ts.map +1 -1
- package/lib/store/QueryApi.js.map +1 -1
- package/lib/store/WorkflowsApi.d.ts +3 -3
- package/lib/store/WorkflowsApi.d.ts.map +1 -1
- package/lib/store/WorkflowsApi.js.map +1 -1
- package/lib/store/client.d.ts +2 -2
- package/lib/store/client.d.ts.map +1 -1
- package/lib/store/client.js +2 -2
- package/lib/store/client.js.map +1 -1
- package/lib/store/index.d.ts +1 -1
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/index.js.map +1 -1
- package/lib/store/stream-termination.d.ts +2 -2
- package/lib/store/stream-termination.d.ts.map +1 -1
- package/lib/store/stream-termination.js +6 -4
- package/lib/store/stream-termination.js.map +1 -1
- package/lib/vertesia-client.js +8 -9
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +7 -7
- package/src/AppsApi.ts +22 -8
- package/src/GroupsApi.ts +4 -10
- package/src/InteractionCatalogApi.ts +3 -3
- package/src/InteractionOutput.test.ts +41 -5
- package/src/InteractionOutput.ts +39 -3
- package/src/OAuthServerApi.test.ts +56 -0
- package/src/OAuthServerApi.ts +12 -2
- package/src/ProjectsApi.ts +4 -2
- package/src/RunsApi.ts +15 -14
- package/src/ToolsApi.ts +10 -0
- package/src/ViewsApi.test.ts +3 -1
- package/src/ViewsApi.ts +1 -1
- package/src/client.ts +4 -0
- package/src/execute.ts +2 -2
- package/src/store/AgentsApi.stream.test.ts +56 -0
- package/src/store/AgentsApi.ts +8 -4
- package/src/store/CollectionsApi.ts +8 -1
- package/src/store/EmailApi.ts +25 -107
- package/src/store/FilesApi.ts +12 -0
- package/src/store/ObjectsApi.ts +28 -4
- package/src/store/PendingAsksApi.ts +15 -57
- package/src/store/ProcessApi.test.ts +24 -0
- package/src/store/ProcessApi.ts +49 -8
- package/src/store/ProcessTestRunApi.ts +41 -0
- package/src/store/QueryApi.ts +9 -45
- package/src/store/WorkflowsApi.ts +4 -3
- package/src/store/client.ts +2 -2
- package/src/store/index.ts +1 -1
- package/src/store/stream-termination.test.ts +24 -0
- package/src/store/stream-termination.ts +10 -4
- package/lib/store/HiveMemoryApi.d.ts +0 -161
- package/lib/store/HiveMemoryApi.d.ts.map +0 -1
- package/lib/store/HiveMemoryApi.js +0 -170
- package/lib/store/HiveMemoryApi.js.map +0 -1
- package/src/store/HiveMemoryApi.ts +0 -220
package/src/store/QueryApi.ts
CHANGED
|
@@ -1,46 +1,10 @@
|
|
|
1
1
|
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { ContentQueryPayload, ContentQueryResult } from '@vertesia/common';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export
|
|
7
|
-
/** SQL query (uses ES SQL API) */
|
|
8
|
-
sql?: string;
|
|
9
|
-
/** ES|QL query (Elastic's piped query language) */
|
|
10
|
-
esql?: string;
|
|
11
|
-
/** Raw DSL query for full control */
|
|
12
|
-
dsl?: {
|
|
13
|
-
query?: Record<string, unknown>;
|
|
14
|
-
aggs?: Record<string, unknown>;
|
|
15
|
-
size?: number;
|
|
16
|
-
from?: number;
|
|
17
|
-
sort?: Array<Record<string, unknown>>;
|
|
18
|
-
};
|
|
19
|
-
/** Output format */
|
|
20
|
-
format?: 'json' | 'csv' | 'table';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Query result
|
|
25
|
-
*/
|
|
26
|
-
export interface QueryResult {
|
|
27
|
-
/** Result type */
|
|
28
|
-
type: 'sql' | 'esql' | 'dsl';
|
|
29
|
-
/** Column definitions */
|
|
30
|
-
columns?: Array<{ name: string; type: string }>;
|
|
31
|
-
/** Rows for SQL/ES|QL */
|
|
32
|
-
rows?: unknown[][];
|
|
33
|
-
/** Hits for DSL */
|
|
34
|
-
hits?: Array<{ id: string; score: number; source: unknown }>;
|
|
35
|
-
/** Total count */
|
|
36
|
-
total?: number;
|
|
37
|
-
/** Aggregations for DSL */
|
|
38
|
-
aggregations?: Record<string, unknown>;
|
|
39
|
-
/** Cursor for pagination (SQL) */
|
|
40
|
-
cursor?: string;
|
|
41
|
-
/** Query execution time in ms */
|
|
42
|
-
took?: number;
|
|
43
|
-
}
|
|
4
|
+
/** @deprecated Use ContentQueryPayload from @vertesia/common. */
|
|
5
|
+
export type QueryPayload = ContentQueryPayload;
|
|
6
|
+
/** @deprecated Use ContentQueryResult from @vertesia/common. */
|
|
7
|
+
export type QueryResult = ContentQueryResult;
|
|
44
8
|
|
|
45
9
|
/**
|
|
46
10
|
* API for querying documents using SQL, ES|QL, or raw Elasticsearch DSL.
|
|
@@ -82,28 +46,28 @@ export class QueryApi extends ApiTopic {
|
|
|
82
46
|
* });
|
|
83
47
|
* ```
|
|
84
48
|
*/
|
|
85
|
-
async execute(payload:
|
|
49
|
+
async execute(payload: ContentQueryPayload): Promise<ContentQueryResult> {
|
|
86
50
|
return this.post('/', { payload });
|
|
87
51
|
}
|
|
88
52
|
|
|
89
53
|
/**
|
|
90
54
|
* Execute a SQL query
|
|
91
55
|
*/
|
|
92
|
-
async sql(query: string): Promise<
|
|
56
|
+
async sql(query: string): Promise<ContentQueryResult> {
|
|
93
57
|
return this.execute({ sql: query });
|
|
94
58
|
}
|
|
95
59
|
|
|
96
60
|
/**
|
|
97
61
|
* Execute an ES|QL query
|
|
98
62
|
*/
|
|
99
|
-
async esql(query: string): Promise<
|
|
63
|
+
async esql(query: string): Promise<ContentQueryResult> {
|
|
100
64
|
return this.execute({ esql: query });
|
|
101
65
|
}
|
|
102
66
|
|
|
103
67
|
/**
|
|
104
68
|
* Execute a DSL query
|
|
105
69
|
*/
|
|
106
|
-
async dsl(query:
|
|
70
|
+
async dsl(query: ContentQueryPayload['dsl']): Promise<ContentQueryResult> {
|
|
107
71
|
return this.execute({ dsl: query });
|
|
108
72
|
}
|
|
109
73
|
}
|
|
@@ -26,7 +26,8 @@ import {
|
|
|
26
26
|
type ToolParameterAnalyticsResponse,
|
|
27
27
|
type TopPrincipalsAnalyticsResponse,
|
|
28
28
|
toAgentMessage,
|
|
29
|
-
type
|
|
29
|
+
type UpdateWorkflowDefinitionPayload,
|
|
30
|
+
type UpdateWorkflowRulePayload,
|
|
30
31
|
type WebSocketClientMessage,
|
|
31
32
|
type WebSocketServerMessage,
|
|
32
33
|
type WorkflowActionPayload,
|
|
@@ -741,7 +742,7 @@ export class WorkflowsRulesApi extends ApiTopic {
|
|
|
741
742
|
return this.get(`/${id}`);
|
|
742
743
|
}
|
|
743
744
|
|
|
744
|
-
update(id: string, payload:
|
|
745
|
+
update(id: string, payload: UpdateWorkflowRulePayload): Promise<WorkflowRule> {
|
|
745
746
|
return this.put(`/${id}`, {
|
|
746
747
|
payload,
|
|
747
748
|
});
|
|
@@ -785,7 +786,7 @@ export class WorkflowsDefinitionApi extends ApiTopic {
|
|
|
785
786
|
return this.get(`/${id}`);
|
|
786
787
|
}
|
|
787
788
|
|
|
788
|
-
update(id: string, payload:
|
|
789
|
+
update(id: string, payload: UpdateWorkflowDefinitionPayload): Promise<DSLWorkflowDefinition> {
|
|
789
790
|
return this.put(`/${id}`, {
|
|
790
791
|
payload,
|
|
791
792
|
});
|
package/src/store/client.ts
CHANGED
|
@@ -14,11 +14,11 @@ import { EmbeddingsApi } from './EmbeddingsApi.js';
|
|
|
14
14
|
import { EventsApi } from './EventsApi.js';
|
|
15
15
|
import { ZenoClientNotFoundError } from './errors.js';
|
|
16
16
|
import { FilesApi } from './FilesApi.js';
|
|
17
|
-
import { HiveMemoryApi } from './HiveMemoryApi.js';
|
|
18
17
|
import { IndexingApi } from './IndexingApi.js';
|
|
19
18
|
import { ObjectsApi } from './ObjectsApi.js';
|
|
20
19
|
import { PendingAsksApi } from './PendingAsksApi.js';
|
|
21
20
|
import { ProcessApi } from './ProcessApi.js';
|
|
21
|
+
import { ProcessTestRunApi } from './ProcessTestRunApi.js';
|
|
22
22
|
import { QueryApi } from './QueryApi.js';
|
|
23
23
|
import { RenderingApi } from './RenderingApi.js';
|
|
24
24
|
import { SchedulesApi } from './SchedulesApi.js';
|
|
@@ -112,6 +112,7 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
|
|
|
112
112
|
workflows = new WorkflowsApi(this);
|
|
113
113
|
schedules = new SchedulesApi(this);
|
|
114
114
|
processes = new ProcessApi(this);
|
|
115
|
+
processTestRuns = new ProcessTestRunApi(this);
|
|
115
116
|
tasks = new TaskApi(this);
|
|
116
117
|
files = new FilesApi(this);
|
|
117
118
|
collections = new CollectionsApi(this);
|
|
@@ -124,7 +125,6 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
|
|
|
124
125
|
data = new DataApi(this);
|
|
125
126
|
indexing = new IndexingApi(this);
|
|
126
127
|
query = new QueryApi(this);
|
|
127
|
-
hiveMemory = new HiveMemoryApi(this);
|
|
128
128
|
rendering = new RenderingApi(this);
|
|
129
129
|
views = new StoreViewsApi(this);
|
|
130
130
|
}
|
package/src/store/index.ts
CHANGED
|
@@ -8,11 +8,11 @@ export * from './EventSubscriptionsApi.js';
|
|
|
8
8
|
export * from './EventsApi.js';
|
|
9
9
|
export * from './errors.js';
|
|
10
10
|
export * from './FilesApi.js';
|
|
11
|
-
export * from './HiveMemoryApi.js';
|
|
12
11
|
export * from './IndexingApi.js';
|
|
13
12
|
export * from './ObjectsApi.js';
|
|
14
13
|
export * from './PendingAsksApi.js';
|
|
15
14
|
export * from './ProcessApi.js';
|
|
15
|
+
export * from './ProcessTestRunApi.js';
|
|
16
16
|
export * from './QueryApi.js';
|
|
17
17
|
export * from './RenderingApi.js';
|
|
18
18
|
export * from './SchedulesApi.js';
|
|
@@ -55,4 +55,28 @@ describe('stream termination', () => {
|
|
|
55
55
|
|
|
56
56
|
expect(shouldCloseCompactRunStream(message, rootRunId)).toBe(true);
|
|
57
57
|
});
|
|
58
|
+
|
|
59
|
+
it('keeps interactive root streams open when the conversation becomes idle', () => {
|
|
60
|
+
const message: AgentMessage = {
|
|
61
|
+
type: AgentMessageType.IDLE,
|
|
62
|
+
timestamp: Date.now(),
|
|
63
|
+
workflow_run_id: rootRunId,
|
|
64
|
+
message: 'Waiting for your command...',
|
|
65
|
+
workstream_id: 'main',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
expect(shouldCloseAgentRunStream(message, rootRunId)).toBe(false);
|
|
69
|
+
expect(shouldCloseAgentRunStream(message, rootRunId, true)).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('keeps compact streams open when a child workstream becomes idle', () => {
|
|
73
|
+
const message: CompactMessage = {
|
|
74
|
+
t: AgentMessageType.IDLE,
|
|
75
|
+
m: 'Child waiting',
|
|
76
|
+
w: 'implementation',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
expect(shouldCloseCompactRunStream(message, rootRunId)).toBe(false);
|
|
80
|
+
expect(shouldCloseCompactRunStream(message, rootRunId, true)).toBe(false);
|
|
81
|
+
});
|
|
58
82
|
});
|
|
@@ -15,24 +15,30 @@ function isRootProcessMessage(details: MessageDetails, rootRunId: string): boole
|
|
|
15
15
|
return !processRunId || processRunId === rootRunId;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export function shouldCloseAgentRunStream(message: AgentMessage, rootRunId: string): boolean {
|
|
18
|
+
export function shouldCloseAgentRunStream(message: AgentMessage, rootRunId: string, closeOnIdle = false): boolean {
|
|
19
19
|
if (message.type === AgentMessageType.TERMINATED) {
|
|
20
20
|
return isRootProcessMessage(message.details, rootRunId);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (
|
|
23
|
+
if (
|
|
24
|
+
(message.type === AgentMessageType.COMPLETE || (closeOnIdle && message.type === AgentMessageType.IDLE)) &&
|
|
25
|
+
(message.workstream_id ?? 'main') === 'main'
|
|
26
|
+
) {
|
|
24
27
|
return isRootProcessMessage(message.details, rootRunId);
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
return false;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
export function shouldCloseCompactRunStream(message: CompactMessage, rootRunId: string): boolean {
|
|
33
|
+
export function shouldCloseCompactRunStream(message: CompactMessage, rootRunId: string, closeOnIdle = false): boolean {
|
|
31
34
|
if (message.t === AgentMessageType.TERMINATED) {
|
|
32
35
|
return isRootProcessMessage(message.d, rootRunId);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
if (
|
|
38
|
+
if (
|
|
39
|
+
(message.t === AgentMessageType.COMPLETE || (closeOnIdle && message.t === AgentMessageType.IDLE)) &&
|
|
40
|
+
(message.w ?? 'main') === 'main'
|
|
41
|
+
) {
|
|
36
42
|
return isRootProcessMessage(message.d, rootRunId);
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
-
import type { CreateHiveMemoryPayload, FormattedMemoryForAgent, HiveMemory, HiveMemorySearchParams, HiveMemorySearchResult, UpdateHiveMemoryPayload } from '@vertesia/common';
|
|
3
|
-
/**
|
|
4
|
-
* Statistics about hive memories in the project
|
|
5
|
-
*/
|
|
6
|
-
export interface HiveMemoryStats {
|
|
7
|
-
total_memories: number;
|
|
8
|
-
by_category: Array<{
|
|
9
|
-
category: string;
|
|
10
|
-
count: number;
|
|
11
|
-
avg_confidence: number;
|
|
12
|
-
total_usage: number;
|
|
13
|
-
}>;
|
|
14
|
-
overall: {
|
|
15
|
-
avgConfidence: number;
|
|
16
|
-
avgUsage: number;
|
|
17
|
-
totalContributions: number;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Result from recall endpoint
|
|
22
|
-
*/
|
|
23
|
-
export interface RecallResult {
|
|
24
|
-
memories: FormattedMemoryForAgent[];
|
|
25
|
-
count: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Client API for managing hive memories.
|
|
29
|
-
*
|
|
30
|
-
* Hive memory is a system for storing and retrieving agent learnings,
|
|
31
|
-
* enabling agents to learn from past runs and share knowledge.
|
|
32
|
-
*/
|
|
33
|
-
export declare class HiveMemoryApi extends ApiTopic {
|
|
34
|
-
constructor(parent: ClientBase);
|
|
35
|
-
/**
|
|
36
|
-
* List memories in the project.
|
|
37
|
-
*
|
|
38
|
-
* @param options - Optional filters and pagination
|
|
39
|
-
*/
|
|
40
|
-
list(options?: {
|
|
41
|
-
category?: string;
|
|
42
|
-
scope?: string;
|
|
43
|
-
limit?: number;
|
|
44
|
-
offset?: number;
|
|
45
|
-
}): Promise<HiveMemory[]>;
|
|
46
|
-
/**
|
|
47
|
-
* Retrieve a memory by ID.
|
|
48
|
-
*/
|
|
49
|
-
retrieve(id: string): Promise<HiveMemory>;
|
|
50
|
-
/**
|
|
51
|
-
* Create a new hive memory.
|
|
52
|
-
*
|
|
53
|
-
* @param payload - Memory content including category, summary, and learnings
|
|
54
|
-
*/
|
|
55
|
-
create(payload: CreateHiveMemoryPayload): Promise<HiveMemory>;
|
|
56
|
-
/**
|
|
57
|
-
* Update an existing memory with new learnings.
|
|
58
|
-
*
|
|
59
|
-
* This merges new learnings with existing ones rather than replacing them.
|
|
60
|
-
*
|
|
61
|
-
* @param id - Memory ID
|
|
62
|
-
* @param payload - Fields to update/merge
|
|
63
|
-
*/
|
|
64
|
-
update(id: string, payload: UpdateHiveMemoryPayload): Promise<HiveMemory>;
|
|
65
|
-
/**
|
|
66
|
-
* Delete a memory.
|
|
67
|
-
*
|
|
68
|
-
* @param id - Memory ID
|
|
69
|
-
*/
|
|
70
|
-
delete(id: string): Promise<{
|
|
71
|
-
id: string;
|
|
72
|
-
deleted: boolean;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Search memories using semantic and keyword search.
|
|
76
|
-
*
|
|
77
|
-
* @param params - Search parameters including query, filters, and pagination
|
|
78
|
-
*/
|
|
79
|
-
search(params: HiveMemorySearchParams): Promise<HiveMemorySearchResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Recall memories for an agent.
|
|
82
|
-
*
|
|
83
|
-
* This is the primary method for agents to retrieve relevant learnings.
|
|
84
|
-
* It searches for memories matching the task description and returns
|
|
85
|
-
* them formatted for agent consumption.
|
|
86
|
-
*
|
|
87
|
-
* @param taskDescription - Description of the current task
|
|
88
|
-
* @param options - Optional filters
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* const result = await client.hiveMemory.recall(
|
|
93
|
-
* "Extract financial data from PDF documents",
|
|
94
|
-
* {
|
|
95
|
-
* tools: ["extract_text", "analyze_document"],
|
|
96
|
-
* maxResults: 5
|
|
97
|
-
* }
|
|
98
|
-
* );
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
recall(taskDescription: string, options?: {
|
|
102
|
-
tools?: string[];
|
|
103
|
-
category?: string;
|
|
104
|
-
maxResults?: number;
|
|
105
|
-
}): Promise<RecallResult>;
|
|
106
|
-
/**
|
|
107
|
-
* Get a memory formatted for agent consumption.
|
|
108
|
-
*
|
|
109
|
-
* @param id - Memory ID
|
|
110
|
-
*/
|
|
111
|
-
getFormatted(id: string): Promise<FormattedMemoryForAgent>;
|
|
112
|
-
/**
|
|
113
|
-
* Record that a memory was used.
|
|
114
|
-
*
|
|
115
|
-
* This increments the usage count and helps track memory effectiveness.
|
|
116
|
-
*
|
|
117
|
-
* @param id - Memory ID
|
|
118
|
-
*/
|
|
119
|
-
recordUsage(id: string): Promise<{
|
|
120
|
-
success: boolean;
|
|
121
|
-
}>;
|
|
122
|
-
/**
|
|
123
|
-
* Get memories by category.
|
|
124
|
-
*
|
|
125
|
-
* @param category - Task category (e.g., "document-analysis", "data-extraction")
|
|
126
|
-
* @param options - Pagination options
|
|
127
|
-
*/
|
|
128
|
-
getByCategory(category: string, options?: {
|
|
129
|
-
limit?: number;
|
|
130
|
-
offset?: number;
|
|
131
|
-
}): Promise<HiveMemory[]>;
|
|
132
|
-
/**
|
|
133
|
-
* Get memory statistics for the project.
|
|
134
|
-
*/
|
|
135
|
-
getStats(): Promise<HiveMemoryStats>;
|
|
136
|
-
/**
|
|
137
|
-
* Apply confidence decay to unused memories.
|
|
138
|
-
*
|
|
139
|
-
* Admin operation that reduces confidence scores for memories
|
|
140
|
-
* that haven't been used recently.
|
|
141
|
-
*
|
|
142
|
-
* @param options - Decay parameters
|
|
143
|
-
*/
|
|
144
|
-
applyDecay(options?: {
|
|
145
|
-
daysThreshold?: number;
|
|
146
|
-
decayRate?: number;
|
|
147
|
-
}): Promise<{
|
|
148
|
-
modified_count: number;
|
|
149
|
-
}>;
|
|
150
|
-
/**
|
|
151
|
-
* Archive memories with low confidence scores.
|
|
152
|
-
*
|
|
153
|
-
* Admin operation that removes memories below a confidence threshold.
|
|
154
|
-
*
|
|
155
|
-
* @param threshold - Confidence threshold (0-1), default 0.2
|
|
156
|
-
*/
|
|
157
|
-
archiveLowConfidence(threshold?: number): Promise<{
|
|
158
|
-
archived_count: number;
|
|
159
|
-
}>;
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=HiveMemoryApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HiveMemoryApi.d.ts","sourceRoot":"","sources":["../../src/store/HiveMemoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EACR,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC,CAAC;IACH,OAAO,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE,MAAM,CAAC;KAC9B,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACvC,YAAY,MAAM,EAAE,UAAU,EAE7B;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAA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AC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAOpG;IAED;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,eAAe,CAAC,CAEnC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAOxG;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAI5E;CACJ"}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { ApiTopic } from '@vertesia/api-fetch-client';
|
|
2
|
-
/**
|
|
3
|
-
* Client API for managing hive memories.
|
|
4
|
-
*
|
|
5
|
-
* Hive memory is a system for storing and retrieving agent learnings,
|
|
6
|
-
* enabling agents to learn from past runs and share knowledge.
|
|
7
|
-
*/
|
|
8
|
-
export class HiveMemoryApi extends ApiTopic {
|
|
9
|
-
constructor(parent) {
|
|
10
|
-
super(parent, '/api/v1/hive-memory');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* List memories in the project.
|
|
14
|
-
*
|
|
15
|
-
* @param options - Optional filters and pagination
|
|
16
|
-
*/
|
|
17
|
-
list(options) {
|
|
18
|
-
const params = new URLSearchParams();
|
|
19
|
-
if (options?.category)
|
|
20
|
-
params.set('category', options.category);
|
|
21
|
-
if (options?.scope)
|
|
22
|
-
params.set('scope', options.scope);
|
|
23
|
-
if (options?.limit)
|
|
24
|
-
params.set('limit', String(options.limit));
|
|
25
|
-
if (options?.offset)
|
|
26
|
-
params.set('offset', String(options.offset));
|
|
27
|
-
const queryString = params.toString();
|
|
28
|
-
return this.get(queryString ? `/?${queryString}` : '/');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Retrieve a memory by ID.
|
|
32
|
-
*/
|
|
33
|
-
retrieve(id) {
|
|
34
|
-
return this.get(`/${id}`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create a new hive memory.
|
|
38
|
-
*
|
|
39
|
-
* @param payload - Memory content including category, summary, and learnings
|
|
40
|
-
*/
|
|
41
|
-
create(payload) {
|
|
42
|
-
return this.post('/', { payload });
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Update an existing memory with new learnings.
|
|
46
|
-
*
|
|
47
|
-
* This merges new learnings with existing ones rather than replacing them.
|
|
48
|
-
*
|
|
49
|
-
* @param id - Memory ID
|
|
50
|
-
* @param payload - Fields to update/merge
|
|
51
|
-
*/
|
|
52
|
-
update(id, payload) {
|
|
53
|
-
return this.put(`/${id}`, { payload });
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Delete a memory.
|
|
57
|
-
*
|
|
58
|
-
* @param id - Memory ID
|
|
59
|
-
*/
|
|
60
|
-
delete(id) {
|
|
61
|
-
return this.del(`/${id}`);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Search memories using semantic and keyword search.
|
|
65
|
-
*
|
|
66
|
-
* @param params - Search parameters including query, filters, and pagination
|
|
67
|
-
*/
|
|
68
|
-
search(params) {
|
|
69
|
-
return this.post('/search', { payload: params });
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Recall memories for an agent.
|
|
73
|
-
*
|
|
74
|
-
* This is the primary method for agents to retrieve relevant learnings.
|
|
75
|
-
* It searches for memories matching the task description and returns
|
|
76
|
-
* them formatted for agent consumption.
|
|
77
|
-
*
|
|
78
|
-
* @param taskDescription - Description of the current task
|
|
79
|
-
* @param options - Optional filters
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* const result = await client.hiveMemory.recall(
|
|
84
|
-
* "Extract financial data from PDF documents",
|
|
85
|
-
* {
|
|
86
|
-
* tools: ["extract_text", "analyze_document"],
|
|
87
|
-
* maxResults: 5
|
|
88
|
-
* }
|
|
89
|
-
* );
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
recall(taskDescription, options) {
|
|
93
|
-
return this.post('/recall', {
|
|
94
|
-
payload: {
|
|
95
|
-
task_description: taskDescription,
|
|
96
|
-
tools: options?.tools,
|
|
97
|
-
category: options?.category,
|
|
98
|
-
max_results: options?.maxResults,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get a memory formatted for agent consumption.
|
|
104
|
-
*
|
|
105
|
-
* @param id - Memory ID
|
|
106
|
-
*/
|
|
107
|
-
getFormatted(id) {
|
|
108
|
-
return this.get(`/${id}/formatted`);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Record that a memory was used.
|
|
112
|
-
*
|
|
113
|
-
* This increments the usage count and helps track memory effectiveness.
|
|
114
|
-
*
|
|
115
|
-
* @param id - Memory ID
|
|
116
|
-
*/
|
|
117
|
-
recordUsage(id) {
|
|
118
|
-
return this.post(`/${id}/usage`, {});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Get memories by category.
|
|
122
|
-
*
|
|
123
|
-
* @param category - Task category (e.g., "document-analysis", "data-extraction")
|
|
124
|
-
* @param options - Pagination options
|
|
125
|
-
*/
|
|
126
|
-
getByCategory(category, options) {
|
|
127
|
-
const params = new URLSearchParams();
|
|
128
|
-
if (options?.limit)
|
|
129
|
-
params.set('limit', String(options.limit));
|
|
130
|
-
if (options?.offset)
|
|
131
|
-
params.set('offset', String(options.offset));
|
|
132
|
-
const queryString = params.toString();
|
|
133
|
-
return this.get(`/category/${category}${queryString ? `?${queryString}` : ''}`);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Get memory statistics for the project.
|
|
137
|
-
*/
|
|
138
|
-
getStats() {
|
|
139
|
-
return this.get('/stats');
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Apply confidence decay to unused memories.
|
|
143
|
-
*
|
|
144
|
-
* Admin operation that reduces confidence scores for memories
|
|
145
|
-
* that haven't been used recently.
|
|
146
|
-
*
|
|
147
|
-
* @param options - Decay parameters
|
|
148
|
-
*/
|
|
149
|
-
applyDecay(options) {
|
|
150
|
-
return this.post('/admin/decay', {
|
|
151
|
-
payload: {
|
|
152
|
-
days_threshold: options?.daysThreshold,
|
|
153
|
-
decay_rate: options?.decayRate,
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Archive memories with low confidence scores.
|
|
159
|
-
*
|
|
160
|
-
* Admin operation that removes memories below a confidence threshold.
|
|
161
|
-
*
|
|
162
|
-
* @param threshold - Confidence threshold (0-1), default 0.2
|
|
163
|
-
*/
|
|
164
|
-
archiveLowConfidence(threshold) {
|
|
165
|
-
return this.post('/admin/archive', {
|
|
166
|
-
payload: { threshold },
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=HiveMemoryApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HiveMemoryApi.js","sourceRoot":"","sources":["../../src/store/HiveMemoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,4BAA4B,CAAC;AAoCvE;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACvC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAAgF;QACjF,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,OAAO,EAAE,QAAQ;YAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC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