@prismer/sdk 1.7.0 → 1.7.3
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/LICENSE +21 -0
- package/README.md +402 -190
- package/dist/cli.js +3083 -479
- package/dist/index.d.mts +1029 -3
- package/dist/index.d.ts +1029 -3
- package/dist/index.js +1129 -6
- package/dist/index.mjs +1112 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -36,6 +36,19 @@ interface MessageNewPayload {
|
|
|
36
36
|
metadata?: Record<string, any>;
|
|
37
37
|
createdAt: string;
|
|
38
38
|
}
|
|
39
|
+
interface MessageEditPayload {
|
|
40
|
+
id: string;
|
|
41
|
+
conversationId: string;
|
|
42
|
+
content: string;
|
|
43
|
+
type: string;
|
|
44
|
+
editedAt: string;
|
|
45
|
+
editedBy: string;
|
|
46
|
+
metadata?: Record<string, any>;
|
|
47
|
+
}
|
|
48
|
+
interface MessageDeletedPayload {
|
|
49
|
+
id: string;
|
|
50
|
+
conversationId: string;
|
|
51
|
+
}
|
|
39
52
|
interface TypingIndicatorPayload {
|
|
40
53
|
conversationId: string;
|
|
41
54
|
userId: string;
|
|
@@ -62,6 +75,8 @@ interface ReconnectingPayload {
|
|
|
62
75
|
interface RealtimeEventMap {
|
|
63
76
|
'authenticated': AuthenticatedPayload;
|
|
64
77
|
'message.new': MessageNewPayload;
|
|
78
|
+
'message.edit': MessageEditPayload;
|
|
79
|
+
'message.deleted': MessageDeletedPayload;
|
|
65
80
|
'typing.indicator': TypingIndicatorPayload;
|
|
66
81
|
'presence.changed': PresenceChangedPayload;
|
|
67
82
|
'pong': PongPayload;
|
|
@@ -122,7 +137,11 @@ declare class RealtimeWSClient extends TypedEmitter {
|
|
|
122
137
|
connect(): Promise<void>;
|
|
123
138
|
disconnect(code?: number, reason?: string): void;
|
|
124
139
|
joinConversation(conversationId: string): void;
|
|
125
|
-
sendMessage(conversationId: string, content: string,
|
|
140
|
+
sendMessage(conversationId: string, content: string, options?: string | {
|
|
141
|
+
type?: string;
|
|
142
|
+
metadata?: Record<string, any>;
|
|
143
|
+
parentId?: string;
|
|
144
|
+
}): void;
|
|
126
145
|
startTyping(conversationId: string): void;
|
|
127
146
|
stopTyping(conversationId: string): void;
|
|
128
147
|
updatePresence(status: string): void;
|
|
@@ -913,8 +932,410 @@ interface OfflineConfig {
|
|
|
913
932
|
warningThreshold?: number;
|
|
914
933
|
};
|
|
915
934
|
}
|
|
935
|
+
type TaskStatus = 'pending' | 'assigned' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
936
|
+
type ScheduleType = 'once' | 'interval' | 'cron';
|
|
937
|
+
interface IMCreateTaskOptions {
|
|
938
|
+
title: string;
|
|
939
|
+
description?: string;
|
|
940
|
+
capability?: string;
|
|
941
|
+
input?: Record<string, unknown>;
|
|
942
|
+
contextUri?: string;
|
|
943
|
+
assigneeId?: string;
|
|
944
|
+
scheduleType?: ScheduleType;
|
|
945
|
+
scheduleAt?: string;
|
|
946
|
+
scheduleCron?: string;
|
|
947
|
+
intervalMs?: number;
|
|
948
|
+
maxRuns?: number;
|
|
949
|
+
timeoutMs?: number;
|
|
950
|
+
deadline?: string;
|
|
951
|
+
maxRetries?: number;
|
|
952
|
+
retryDelayMs?: number;
|
|
953
|
+
budget?: number;
|
|
954
|
+
metadata?: Record<string, unknown>;
|
|
955
|
+
}
|
|
956
|
+
interface IMUpdateTaskOptions {
|
|
957
|
+
assigneeId?: string;
|
|
958
|
+
status?: TaskStatus;
|
|
959
|
+
metadata?: Record<string, unknown>;
|
|
960
|
+
}
|
|
961
|
+
interface IMTaskListOptions {
|
|
962
|
+
status?: TaskStatus;
|
|
963
|
+
capability?: string;
|
|
964
|
+
assigneeId?: string;
|
|
965
|
+
creatorId?: string;
|
|
966
|
+
scheduleType?: ScheduleType;
|
|
967
|
+
limit?: number;
|
|
968
|
+
cursor?: string;
|
|
969
|
+
}
|
|
970
|
+
interface IMCompleteTaskOptions {
|
|
971
|
+
result?: unknown;
|
|
972
|
+
resultUri?: string;
|
|
973
|
+
cost?: number;
|
|
974
|
+
}
|
|
975
|
+
interface IMTask {
|
|
976
|
+
id: string;
|
|
977
|
+
title: string;
|
|
978
|
+
description: string | null;
|
|
979
|
+
capability: string | null;
|
|
980
|
+
input: Record<string, unknown>;
|
|
981
|
+
contextUri: string | null;
|
|
982
|
+
creatorId: string;
|
|
983
|
+
assigneeId: string | null;
|
|
984
|
+
status: TaskStatus;
|
|
985
|
+
scheduleType: ScheduleType | null;
|
|
986
|
+
scheduleCron: string | null;
|
|
987
|
+
intervalMs: number | null;
|
|
988
|
+
nextRunAt: string | null;
|
|
989
|
+
lastRunAt: string | null;
|
|
990
|
+
runCount: number;
|
|
991
|
+
maxRuns: number | null;
|
|
992
|
+
result: unknown | null;
|
|
993
|
+
resultUri: string | null;
|
|
994
|
+
error: string | null;
|
|
995
|
+
budget: number | null;
|
|
996
|
+
cost: number;
|
|
997
|
+
timeoutMs: number;
|
|
998
|
+
deadline: string | null;
|
|
999
|
+
maxRetries: number;
|
|
1000
|
+
retryDelayMs: number;
|
|
1001
|
+
retryCount: number;
|
|
1002
|
+
metadata: Record<string, unknown>;
|
|
1003
|
+
createdAt: string;
|
|
1004
|
+
updatedAt: string;
|
|
1005
|
+
}
|
|
1006
|
+
interface IMTaskLog {
|
|
1007
|
+
id: string;
|
|
1008
|
+
taskId: string;
|
|
1009
|
+
actorId: string | null;
|
|
1010
|
+
action: string;
|
|
1011
|
+
message: string | null;
|
|
1012
|
+
metadata: Record<string, unknown>;
|
|
1013
|
+
createdAt: string;
|
|
1014
|
+
}
|
|
1015
|
+
interface IMTaskDetail {
|
|
1016
|
+
task: IMTask;
|
|
1017
|
+
logs: IMTaskLog[];
|
|
1018
|
+
}
|
|
1019
|
+
interface IMCreateMemoryFileOptions {
|
|
1020
|
+
path: string;
|
|
1021
|
+
content: string;
|
|
1022
|
+
scope?: string;
|
|
1023
|
+
ownerType?: 'user' | 'agent';
|
|
1024
|
+
}
|
|
1025
|
+
interface IMUpdateMemoryFileOptions {
|
|
1026
|
+
operation: 'append' | 'replace' | 'replace_section';
|
|
1027
|
+
content: string;
|
|
1028
|
+
section?: string;
|
|
1029
|
+
version?: number;
|
|
1030
|
+
}
|
|
1031
|
+
interface IMCompactOptions {
|
|
1032
|
+
conversationId: string;
|
|
1033
|
+
summary: string;
|
|
1034
|
+
messageRangeStart?: string;
|
|
1035
|
+
messageRangeEnd?: string;
|
|
1036
|
+
}
|
|
1037
|
+
interface IMMemoryFile {
|
|
1038
|
+
id: string;
|
|
1039
|
+
ownerId: string;
|
|
1040
|
+
ownerType: 'user' | 'agent';
|
|
1041
|
+
scope: string;
|
|
1042
|
+
path: string;
|
|
1043
|
+
version: number;
|
|
1044
|
+
contentLength: number;
|
|
1045
|
+
createdAt: string;
|
|
1046
|
+
updatedAt: string;
|
|
1047
|
+
}
|
|
1048
|
+
interface IMMemoryFileDetail extends IMMemoryFile {
|
|
1049
|
+
content: string;
|
|
1050
|
+
}
|
|
1051
|
+
interface IMCompactionSummary {
|
|
1052
|
+
id: string;
|
|
1053
|
+
conversationId: string;
|
|
1054
|
+
summary: string;
|
|
1055
|
+
messageRangeStart: string | null;
|
|
1056
|
+
messageRangeEnd: string | null;
|
|
1057
|
+
tokenCount: number;
|
|
1058
|
+
createdAt: string;
|
|
1059
|
+
}
|
|
1060
|
+
interface IMMemoryLoadResult {
|
|
1061
|
+
content: string | null;
|
|
1062
|
+
totalLines: number;
|
|
1063
|
+
totalBytes: number;
|
|
1064
|
+
version: number;
|
|
1065
|
+
id: string | null;
|
|
1066
|
+
scope: string;
|
|
1067
|
+
path: string;
|
|
1068
|
+
template: string;
|
|
1069
|
+
}
|
|
1070
|
+
type DerivationMode = 'generated' | 'derived' | 'imported';
|
|
1071
|
+
interface IMRegisterKeyOptions {
|
|
1072
|
+
publicKey: string;
|
|
1073
|
+
derivationMode?: DerivationMode;
|
|
1074
|
+
}
|
|
1075
|
+
interface IMIdentityKey {
|
|
1076
|
+
imUserId: string;
|
|
1077
|
+
publicKey: string;
|
|
1078
|
+
keyId: string;
|
|
1079
|
+
attestation: string | null;
|
|
1080
|
+
derivationMode: DerivationMode;
|
|
1081
|
+
registeredAt: string;
|
|
1082
|
+
revokedAt: string | null;
|
|
1083
|
+
serverPublicKey?: string;
|
|
1084
|
+
}
|
|
1085
|
+
interface IMKeyAuditEntry {
|
|
1086
|
+
id: number;
|
|
1087
|
+
imUserId: string;
|
|
1088
|
+
action: 'register' | 'rotate' | 'revoke';
|
|
1089
|
+
publicKey: string;
|
|
1090
|
+
keyId: string;
|
|
1091
|
+
attestation: string;
|
|
1092
|
+
prevLogHash: string | null;
|
|
1093
|
+
createdAt: string;
|
|
1094
|
+
}
|
|
1095
|
+
interface IMKeyVerifyResult {
|
|
1096
|
+
valid: boolean;
|
|
1097
|
+
invalidAt?: number;
|
|
1098
|
+
}
|
|
1099
|
+
type GeneCategory = 'repair' | 'optimize' | 'innovate' | 'diagnostic';
|
|
1100
|
+
type GeneVisibility = 'private' | 'canary' | 'published' | 'quarantined' | 'seed';
|
|
1101
|
+
/** v0.3.0 SignalTag — hierarchical label for a trigger dimension */
|
|
1102
|
+
interface SignalTag {
|
|
1103
|
+
type: string;
|
|
1104
|
+
provider?: string;
|
|
1105
|
+
stage?: string;
|
|
1106
|
+
severity?: string;
|
|
1107
|
+
[key: string]: string | undefined;
|
|
1108
|
+
}
|
|
1109
|
+
interface IMCreateGeneOptions {
|
|
1110
|
+
category: GeneCategory;
|
|
1111
|
+
signals_match: string[] | SignalTag[];
|
|
1112
|
+
strategy: string[];
|
|
1113
|
+
title?: string;
|
|
1114
|
+
preconditions?: string[];
|
|
1115
|
+
constraints?: Record<string, unknown>;
|
|
1116
|
+
}
|
|
1117
|
+
interface IMAnalyzeOptions {
|
|
1118
|
+
context?: string;
|
|
1119
|
+
signals?: string[] | SignalTag[];
|
|
1120
|
+
task_status?: string;
|
|
1121
|
+
task_capability?: string;
|
|
1122
|
+
error?: string;
|
|
1123
|
+
tags?: string[];
|
|
1124
|
+
custom_signals?: string[];
|
|
1125
|
+
provider?: string;
|
|
1126
|
+
stage?: string;
|
|
1127
|
+
severity?: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface IMRecordOutcomeOptions {
|
|
1130
|
+
gene_id: string;
|
|
1131
|
+
signals: string[] | SignalTag[];
|
|
1132
|
+
outcome: 'success' | 'failed';
|
|
1133
|
+
score?: number;
|
|
1134
|
+
summary: string;
|
|
1135
|
+
cost_credits?: number;
|
|
1136
|
+
metadata?: Record<string, unknown>;
|
|
1137
|
+
strategy_used?: string[];
|
|
1138
|
+
}
|
|
1139
|
+
interface IMGene {
|
|
1140
|
+
type: string;
|
|
1141
|
+
id: string;
|
|
1142
|
+
category: GeneCategory;
|
|
1143
|
+
title?: string;
|
|
1144
|
+
description?: string;
|
|
1145
|
+
visibility?: GeneVisibility;
|
|
1146
|
+
signals_match: SignalTag[];
|
|
1147
|
+
preconditions: string[];
|
|
1148
|
+
strategy: string[];
|
|
1149
|
+
constraints: Record<string, unknown>;
|
|
1150
|
+
success_count: number;
|
|
1151
|
+
failure_count: number;
|
|
1152
|
+
last_used_at: string | null;
|
|
1153
|
+
created_by: string;
|
|
1154
|
+
distilled_from?: string[];
|
|
1155
|
+
parentGeneId?: string | null;
|
|
1156
|
+
forkCount?: number;
|
|
1157
|
+
generation?: number;
|
|
1158
|
+
}
|
|
1159
|
+
interface IMAnalyzeResult {
|
|
1160
|
+
action: 'apply_gene' | 'explore' | 'none' | 'create_suggested';
|
|
1161
|
+
gene_id?: string;
|
|
1162
|
+
gene?: IMGene;
|
|
1163
|
+
strategy?: string[];
|
|
1164
|
+
confidence: number;
|
|
1165
|
+
coverageScore?: number;
|
|
1166
|
+
signals: SignalTag[];
|
|
1167
|
+
alternatives?: Array<{
|
|
1168
|
+
gene_id: string;
|
|
1169
|
+
confidence: number;
|
|
1170
|
+
}>;
|
|
1171
|
+
reason?: string;
|
|
1172
|
+
suggestion?: {
|
|
1173
|
+
category: GeneCategory;
|
|
1174
|
+
signals_match: SignalTag[];
|
|
1175
|
+
title: string;
|
|
1176
|
+
description: string;
|
|
1177
|
+
similar_genes: Array<{
|
|
1178
|
+
gene_id: string;
|
|
1179
|
+
title: string;
|
|
1180
|
+
similarity: number;
|
|
1181
|
+
}>;
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
interface IMEvolutionStats {
|
|
1185
|
+
total_genes: number;
|
|
1186
|
+
total_capsules: number;
|
|
1187
|
+
avg_success_rate: number;
|
|
1188
|
+
active_agents: number;
|
|
1189
|
+
}
|
|
1190
|
+
interface IMCapsule {
|
|
1191
|
+
id: string;
|
|
1192
|
+
gene_id: string;
|
|
1193
|
+
agent_id: string;
|
|
1194
|
+
signals: string[];
|
|
1195
|
+
outcome: string;
|
|
1196
|
+
score: number;
|
|
1197
|
+
summary: string;
|
|
1198
|
+
created_at: string;
|
|
1199
|
+
}
|
|
1200
|
+
interface IMEvolutionEdge {
|
|
1201
|
+
signal_key: string;
|
|
1202
|
+
gene_id: string;
|
|
1203
|
+
success_count: number;
|
|
1204
|
+
failure_count: number;
|
|
1205
|
+
confidence: number;
|
|
1206
|
+
last_score: number | null;
|
|
1207
|
+
last_used_at: string | null;
|
|
1208
|
+
}
|
|
1209
|
+
interface IMAgentPersonality {
|
|
1210
|
+
rigor: number;
|
|
1211
|
+
creativity: number;
|
|
1212
|
+
risk_tolerance: number;
|
|
1213
|
+
}
|
|
1214
|
+
interface IMGeneListOptions {
|
|
1215
|
+
category?: GeneCategory;
|
|
1216
|
+
search?: string;
|
|
1217
|
+
sort?: 'newest' | 'most_used' | 'highest_success';
|
|
1218
|
+
page?: number;
|
|
1219
|
+
limit?: number;
|
|
1220
|
+
}
|
|
1221
|
+
interface IMForkGeneOptions {
|
|
1222
|
+
gene_id: string;
|
|
1223
|
+
modifications?: Record<string, unknown>;
|
|
1224
|
+
}
|
|
1225
|
+
interface IMSkillInfo {
|
|
1226
|
+
id: string;
|
|
1227
|
+
slug: string;
|
|
1228
|
+
name: string;
|
|
1229
|
+
description: string;
|
|
1230
|
+
category: string;
|
|
1231
|
+
tags: string[];
|
|
1232
|
+
author: string;
|
|
1233
|
+
source: string;
|
|
1234
|
+
sourceUrl: string;
|
|
1235
|
+
installs: number;
|
|
1236
|
+
stars: number;
|
|
1237
|
+
status: string;
|
|
1238
|
+
version: string;
|
|
1239
|
+
compatibility: string[];
|
|
1240
|
+
signals: SignalTag[];
|
|
1241
|
+
geneId: string | null;
|
|
1242
|
+
hasPackage: boolean;
|
|
1243
|
+
fileCount: number;
|
|
1244
|
+
}
|
|
1245
|
+
interface IMSkillInstallResult {
|
|
1246
|
+
agentSkill: {
|
|
1247
|
+
id: string;
|
|
1248
|
+
status: string;
|
|
1249
|
+
version: string;
|
|
1250
|
+
installedAt: string;
|
|
1251
|
+
};
|
|
1252
|
+
gene: IMGene | null;
|
|
1253
|
+
skill: IMSkillInfo & {
|
|
1254
|
+
content: string;
|
|
1255
|
+
};
|
|
1256
|
+
installGuide: Record<string, {
|
|
1257
|
+
auto?: string;
|
|
1258
|
+
manual?: string;
|
|
1259
|
+
command?: string;
|
|
1260
|
+
[key: string]: any;
|
|
1261
|
+
}>;
|
|
1262
|
+
}
|
|
1263
|
+
interface IMAgentSkillRecord {
|
|
1264
|
+
agentSkill: {
|
|
1265
|
+
id: string;
|
|
1266
|
+
skillId: string;
|
|
1267
|
+
geneId: string | null;
|
|
1268
|
+
status: string;
|
|
1269
|
+
version: string;
|
|
1270
|
+
installedAt: string;
|
|
1271
|
+
};
|
|
1272
|
+
skill: IMSkillInfo;
|
|
1273
|
+
gene: IMGene | null;
|
|
1274
|
+
}
|
|
1275
|
+
interface IMSkillContent {
|
|
1276
|
+
content: string;
|
|
1277
|
+
packageUrl: string | null;
|
|
1278
|
+
files: Array<{
|
|
1279
|
+
path: string;
|
|
1280
|
+
size: number;
|
|
1281
|
+
}>;
|
|
1282
|
+
checksum: string | null;
|
|
1283
|
+
}
|
|
916
1284
|
/** Internal request function type */
|
|
917
1285
|
type RequestFn = <T>(method: string, path: string, body?: unknown, query?: Record<string, string>) => Promise<T>;
|
|
1286
|
+
interface ExecutionContext {
|
|
1287
|
+
error?: string;
|
|
1288
|
+
provider?: string;
|
|
1289
|
+
stage?: string;
|
|
1290
|
+
severity?: string;
|
|
1291
|
+
taskStatus?: string;
|
|
1292
|
+
taskCapability?: string;
|
|
1293
|
+
tags?: string[];
|
|
1294
|
+
[key: string]: unknown;
|
|
1295
|
+
}
|
|
1296
|
+
interface SignalEnrichmentConfig {
|
|
1297
|
+
mode: 'rules' | 'llm';
|
|
1298
|
+
llmExtract?: (ctx: ExecutionContext) => Promise<SignalTag[]>;
|
|
1299
|
+
timeoutMs?: number;
|
|
1300
|
+
cacheTtlMs?: number;
|
|
1301
|
+
}
|
|
1302
|
+
interface GeneSelectionResult {
|
|
1303
|
+
action: 'apply_gene' | 'create_suggested' | 'none';
|
|
1304
|
+
gene_id?: string;
|
|
1305
|
+
gene?: IMGene;
|
|
1306
|
+
strategy?: string[];
|
|
1307
|
+
confidence: number;
|
|
1308
|
+
coverageScore?: number;
|
|
1309
|
+
alternatives?: Array<{
|
|
1310
|
+
gene_id: string;
|
|
1311
|
+
confidence: number;
|
|
1312
|
+
title?: string;
|
|
1313
|
+
}>;
|
|
1314
|
+
reason?: string;
|
|
1315
|
+
fromCache: boolean;
|
|
1316
|
+
}
|
|
1317
|
+
interface EvolutionSyncSnapshot {
|
|
1318
|
+
genes: IMGene[];
|
|
1319
|
+
edges: IMEvolutionEdge[];
|
|
1320
|
+
globalPrior: Record<string, {
|
|
1321
|
+
alpha: number;
|
|
1322
|
+
beta: number;
|
|
1323
|
+
}>;
|
|
1324
|
+
cursor: number;
|
|
1325
|
+
}
|
|
1326
|
+
interface EvolutionSyncDelta {
|
|
1327
|
+
pulled: {
|
|
1328
|
+
genes: IMGene[];
|
|
1329
|
+
edges: IMEvolutionEdge[];
|
|
1330
|
+
globalPrior: Record<string, {
|
|
1331
|
+
alpha: number;
|
|
1332
|
+
beta: number;
|
|
1333
|
+
}>;
|
|
1334
|
+
promotions: string[];
|
|
1335
|
+
quarantines: string[];
|
|
1336
|
+
cursor: number;
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
918
1339
|
|
|
919
1340
|
/**
|
|
920
1341
|
* Prismer SDK — Offline Manager, Outbox Queue, and Sync Engine.
|
|
@@ -1245,6 +1666,318 @@ declare class E2EEncryption {
|
|
|
1245
1666
|
destroy(): void;
|
|
1246
1667
|
}
|
|
1247
1668
|
|
|
1669
|
+
/**
|
|
1670
|
+
* Encryption Pipeline — wraps message send/receive with automatic E2E.
|
|
1671
|
+
*
|
|
1672
|
+
* This is a HELPER module — it does not modify existing client behavior.
|
|
1673
|
+
* Users opt-in by calling pipeline functions explicitly before send / after receive.
|
|
1674
|
+
*
|
|
1675
|
+
* Usage:
|
|
1676
|
+
* import { E2EEncryption } from '@prismer/sdk';
|
|
1677
|
+
* import { encryptForSend, decryptOnReceive } from '@prismer/sdk';
|
|
1678
|
+
*
|
|
1679
|
+
* const e2e = new E2EEncryption();
|
|
1680
|
+
* await e2e.init('passphrase');
|
|
1681
|
+
* await e2e.generateSessionKey('conv-123');
|
|
1682
|
+
*
|
|
1683
|
+
* // Before sending
|
|
1684
|
+
* const enc = await encryptForSend(e2e, 'conv-123', 'Hello!');
|
|
1685
|
+
* await client.im.messages.send('conv-123', enc.content, { metadata: enc.metadata });
|
|
1686
|
+
*
|
|
1687
|
+
* // After receiving
|
|
1688
|
+
* const dec = await decryptOnReceive(e2e, msg.conversationId, msg.content, msg.metadata);
|
|
1689
|
+
* if (dec.decrypted) console.log('Plaintext:', dec.content);
|
|
1690
|
+
*/
|
|
1691
|
+
|
|
1692
|
+
interface EncryptedMessage {
|
|
1693
|
+
content: string;
|
|
1694
|
+
metadata: Record<string, unknown>;
|
|
1695
|
+
}
|
|
1696
|
+
interface DecryptResult {
|
|
1697
|
+
content: string;
|
|
1698
|
+
decrypted: boolean;
|
|
1699
|
+
error?: string;
|
|
1700
|
+
}
|
|
1701
|
+
interface EncryptedFileResult {
|
|
1702
|
+
data: string;
|
|
1703
|
+
metadata: {
|
|
1704
|
+
encrypted: true;
|
|
1705
|
+
encKeyId: string;
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
interface EncryptedContextResult {
|
|
1709
|
+
content: string;
|
|
1710
|
+
encrypted: true;
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Encrypt a message before sending.
|
|
1714
|
+
* Returns modified content + metadata with encrypted flag.
|
|
1715
|
+
*
|
|
1716
|
+
* If no session key exists for the conversation, returns plaintext unchanged.
|
|
1717
|
+
*/
|
|
1718
|
+
declare function encryptForSend(e2e: E2EEncryption, conversationId: string, content: string, metadata?: Record<string, unknown>): Promise<EncryptedMessage>;
|
|
1719
|
+
/**
|
|
1720
|
+
* Decrypt a received message.
|
|
1721
|
+
* Returns the plaintext content, or the original content if:
|
|
1722
|
+
* - The message is not encrypted (metadata.encrypted !== true)
|
|
1723
|
+
* - No session key is available for the conversation
|
|
1724
|
+
* - Decryption fails (returns original content + error string)
|
|
1725
|
+
*/
|
|
1726
|
+
declare function decryptOnReceive(e2e: E2EEncryption, conversationId: string, content: string, metadata?: Record<string, unknown>): Promise<DecryptResult>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Encrypt a file buffer before upload.
|
|
1729
|
+
*
|
|
1730
|
+
* Converts the file bytes to base64, encrypts as text using the conversation
|
|
1731
|
+
* session key, and returns the ciphertext string + metadata.
|
|
1732
|
+
*
|
|
1733
|
+
* Returns null if no session key exists for the conversation.
|
|
1734
|
+
*
|
|
1735
|
+
* Note: File size increases ~33% due to base64 encoding + GCM overhead.
|
|
1736
|
+
* The server stores opaque bytes and cannot inspect the content.
|
|
1737
|
+
*/
|
|
1738
|
+
declare function encryptFile(e2e: E2EEncryption, conversationId: string, data: Uint8Array): Promise<EncryptedFileResult | null>;
|
|
1739
|
+
/**
|
|
1740
|
+
* Decrypt a file that was encrypted with encryptFile().
|
|
1741
|
+
*
|
|
1742
|
+
* Returns the original file bytes, or null if no session key or decryption fails.
|
|
1743
|
+
*/
|
|
1744
|
+
declare function decryptFile(e2e: E2EEncryption, conversationId: string, ciphertext: string): Promise<Uint8Array | null>;
|
|
1745
|
+
/**
|
|
1746
|
+
* Encrypt context cache content (HQCC) before saving.
|
|
1747
|
+
*
|
|
1748
|
+
* Uses a special context ID for key management (default: 'context-cache').
|
|
1749
|
+
* The agent must have a session key for this context ID — generate one with:
|
|
1750
|
+
* await e2e.generateSessionKey('context-cache');
|
|
1751
|
+
*
|
|
1752
|
+
* Returns null if no session key exists.
|
|
1753
|
+
*
|
|
1754
|
+
* Note: Encrypted context CANNOT be server-side compressed or indexed.
|
|
1755
|
+
* The HQCC field becomes opaque. Agents must handle their own compression
|
|
1756
|
+
* before encryption.
|
|
1757
|
+
*/
|
|
1758
|
+
declare function encryptContext(e2e: E2EEncryption, content: string, contextId?: string): Promise<EncryptedContextResult | null>;
|
|
1759
|
+
/**
|
|
1760
|
+
* Decrypt context cache content that was encrypted with encryptContext().
|
|
1761
|
+
*
|
|
1762
|
+
* Returns the plaintext HQCC, or null if no session key or decryption fails.
|
|
1763
|
+
*/
|
|
1764
|
+
declare function decryptContext(e2e: E2EEncryption, ciphertext: string, contextId?: string): Promise<string | null>;
|
|
1765
|
+
/**
|
|
1766
|
+
* Decrypt an array of messages in-place (mutates the array).
|
|
1767
|
+
* Useful for processing message history after fetching.
|
|
1768
|
+
*
|
|
1769
|
+
* Returns the count of successfully decrypted messages.
|
|
1770
|
+
*/
|
|
1771
|
+
declare function decryptMessages<T extends {
|
|
1772
|
+
conversationId?: string;
|
|
1773
|
+
content: string;
|
|
1774
|
+
metadata?: Record<string, unknown>;
|
|
1775
|
+
}>(e2e: E2EEncryption, messages: T[], conversationId?: string): Promise<{
|
|
1776
|
+
decryptedCount: number;
|
|
1777
|
+
errors: Array<{
|
|
1778
|
+
index: number;
|
|
1779
|
+
error: string;
|
|
1780
|
+
}>;
|
|
1781
|
+
}>;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* EvolutionCache — local gene cache with Thompson Sampling selection.
|
|
1785
|
+
* Enables <1ms gene selection without network calls.
|
|
1786
|
+
*/
|
|
1787
|
+
|
|
1788
|
+
declare class EvolutionCache {
|
|
1789
|
+
private _genes;
|
|
1790
|
+
private _edges;
|
|
1791
|
+
private _globalPrior;
|
|
1792
|
+
private _cursor;
|
|
1793
|
+
get cursor(): number;
|
|
1794
|
+
get geneCount(): number;
|
|
1795
|
+
/** Load from a full snapshot */
|
|
1796
|
+
loadSnapshot(snapshot: EvolutionSyncSnapshot): void;
|
|
1797
|
+
/** Apply incremental delta (alias: loadDelta) */
|
|
1798
|
+
applyDelta(delta: EvolutionSyncDelta): void;
|
|
1799
|
+
/** Apply incremental delta (alias for applyDelta) */
|
|
1800
|
+
loadDelta(delta: EvolutionSyncDelta): void;
|
|
1801
|
+
/** Select best gene locally using Thompson Sampling — pure CPU, <1ms */
|
|
1802
|
+
selectGene(signals: SignalTag[]): GeneSelectionResult;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
/**
|
|
1806
|
+
* Signal Enrichment Layer — SDK-side signal extraction.
|
|
1807
|
+
* Migrated from server's signal-extractor.ts regex patterns.
|
|
1808
|
+
* Supports pure-rules mode (zero deps) and optional LLM injection.
|
|
1809
|
+
*/
|
|
1810
|
+
|
|
1811
|
+
/**
|
|
1812
|
+
* Extract signals from execution context using regex rules.
|
|
1813
|
+
* Zero dependencies, synchronous, <0.1ms.
|
|
1814
|
+
*/
|
|
1815
|
+
declare function extractSignals(ctx: ExecutionContext): SignalTag[];
|
|
1816
|
+
/**
|
|
1817
|
+
* Create an enriched signal extractor with optional LLM injection.
|
|
1818
|
+
* LLM mode: calls the agent's LLM for high-precision extraction.
|
|
1819
|
+
* Falls back to rules mode on timeout or error.
|
|
1820
|
+
*/
|
|
1821
|
+
declare function createEnrichedExtractor(config: SignalEnrichmentConfig): (ctx: ExecutionContext) => Promise<SignalTag[]>;
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* EvolutionRuntime — High-level evolution API for agents.
|
|
1825
|
+
*
|
|
1826
|
+
* Composes EvolutionCache + SignalEnrichment + async outbox into two simple methods:
|
|
1827
|
+
* - suggest(error, context?) → strategy recommendation (<1ms local, fallback to server)
|
|
1828
|
+
* - learned(error, outcome, summary, geneId?) → fire-and-forget outcome recording
|
|
1829
|
+
*
|
|
1830
|
+
* Also handles:
|
|
1831
|
+
* - Bootstrap: auto-load sync snapshot on init
|
|
1832
|
+
* - Periodic sync: pull delta every N seconds
|
|
1833
|
+
* - Session tracking: correlates suggest → learned within a task
|
|
1834
|
+
*
|
|
1835
|
+
* Usage:
|
|
1836
|
+
* const runtime = new EvolutionRuntime(client.im.evolution);
|
|
1837
|
+
* await runtime.start();
|
|
1838
|
+
*
|
|
1839
|
+
* const fix = await runtime.suggest('ETIMEDOUT: connection timed out');
|
|
1840
|
+
* // ... agent applies fix.strategy ...
|
|
1841
|
+
* runtime.learned('ETIMEDOUT', 'success', 'Fixed by increasing timeout to 30s');
|
|
1842
|
+
*/
|
|
1843
|
+
|
|
1844
|
+
/** Minimal interface for the evolution client — avoids circular import */
|
|
1845
|
+
interface EvolutionClientLike {
|
|
1846
|
+
getSyncSnapshot(since?: number): Promise<{
|
|
1847
|
+
data?: any;
|
|
1848
|
+
}>;
|
|
1849
|
+
analyze(options: Record<string, any>): Promise<{
|
|
1850
|
+
data?: any;
|
|
1851
|
+
}>;
|
|
1852
|
+
record(options: Record<string, any>): Promise<{
|
|
1853
|
+
data?: any;
|
|
1854
|
+
}>;
|
|
1855
|
+
sync(options: Record<string, any>): Promise<{
|
|
1856
|
+
data?: any;
|
|
1857
|
+
}>;
|
|
1858
|
+
}
|
|
1859
|
+
interface EvolutionRuntimeConfig {
|
|
1860
|
+
/** Sync interval in ms (default: 60000 = 1 min) */
|
|
1861
|
+
syncIntervalMs?: number;
|
|
1862
|
+
/** Signal enrichment mode */
|
|
1863
|
+
enrichment?: SignalEnrichmentConfig;
|
|
1864
|
+
/** Scope for all operations (default: 'global') */
|
|
1865
|
+
scope?: string;
|
|
1866
|
+
/** Max outbox queue size before force flush */
|
|
1867
|
+
outboxMaxSize?: number;
|
|
1868
|
+
/** Outbox flush interval in ms (default: 5000) */
|
|
1869
|
+
outboxFlushMs?: number;
|
|
1870
|
+
}
|
|
1871
|
+
interface Suggestion {
|
|
1872
|
+
action: 'apply_gene' | 'create_suggested' | 'none';
|
|
1873
|
+
geneId?: string;
|
|
1874
|
+
gene?: IMGene;
|
|
1875
|
+
strategy?: string[];
|
|
1876
|
+
confidence: number;
|
|
1877
|
+
signals: SignalTag[];
|
|
1878
|
+
fromCache: boolean;
|
|
1879
|
+
reason?: string;
|
|
1880
|
+
alternatives?: Array<{
|
|
1881
|
+
gene_id: string;
|
|
1882
|
+
confidence: number;
|
|
1883
|
+
title?: string;
|
|
1884
|
+
}>;
|
|
1885
|
+
}
|
|
1886
|
+
/** Tracks a single suggest→learned cycle within a task. */
|
|
1887
|
+
interface EvolutionSession {
|
|
1888
|
+
/** Unique session ID */
|
|
1889
|
+
id: string;
|
|
1890
|
+
/** When suggest() was called */
|
|
1891
|
+
suggestedAt: number;
|
|
1892
|
+
/** What gene was recommended */
|
|
1893
|
+
suggestedGeneId?: string;
|
|
1894
|
+
/** What gene the agent actually used (may differ from suggested) */
|
|
1895
|
+
usedGeneId?: string;
|
|
1896
|
+
/** Signals that triggered the suggest */
|
|
1897
|
+
signals: SignalTag[];
|
|
1898
|
+
/** Whether agent adopted the recommended strategy */
|
|
1899
|
+
adopted: boolean;
|
|
1900
|
+
/** When learned() was called (null if not yet) */
|
|
1901
|
+
completedAt?: number;
|
|
1902
|
+
/** Outcome */
|
|
1903
|
+
outcome?: 'success' | 'failed';
|
|
1904
|
+
/** Duration from suggest to learned (ms) */
|
|
1905
|
+
durationMs?: number;
|
|
1906
|
+
/** Confidence of the suggestion */
|
|
1907
|
+
confidence: number;
|
|
1908
|
+
/** Whether suggestion came from cache or server */
|
|
1909
|
+
fromCache: boolean;
|
|
1910
|
+
}
|
|
1911
|
+
/** Aggregate session metrics for benchmarking. */
|
|
1912
|
+
interface SessionMetrics {
|
|
1913
|
+
/** Total suggest() calls */
|
|
1914
|
+
totalSuggestions: number;
|
|
1915
|
+
/** suggest() calls that returned a gene */
|
|
1916
|
+
suggestionsWithGene: number;
|
|
1917
|
+
/** learned() calls */
|
|
1918
|
+
totalLearned: number;
|
|
1919
|
+
/** Sessions where agent used the suggested gene */
|
|
1920
|
+
adoptedCount: number;
|
|
1921
|
+
/** Gene Utilization Rate = adoptedCount / suggestionsWithGene */
|
|
1922
|
+
geneUtilizationRate: number;
|
|
1923
|
+
/** Average suggest→learned duration (ms) */
|
|
1924
|
+
avgDurationMs: number;
|
|
1925
|
+
/** Success rate of adopted recommendations */
|
|
1926
|
+
adoptedSuccessRate: number;
|
|
1927
|
+
/** Success rate without adoption (agent did it alone) */
|
|
1928
|
+
nonAdoptedSuccessRate: number;
|
|
1929
|
+
/** Cache hit rate */
|
|
1930
|
+
cacheHitRate: number;
|
|
1931
|
+
}
|
|
1932
|
+
declare class EvolutionRuntime {
|
|
1933
|
+
private client;
|
|
1934
|
+
private cache;
|
|
1935
|
+
private enricher;
|
|
1936
|
+
private outbox;
|
|
1937
|
+
private syncTimer?;
|
|
1938
|
+
private flushTimer?;
|
|
1939
|
+
private lastSuggestedGeneId?;
|
|
1940
|
+
private started;
|
|
1941
|
+
private readonly scope;
|
|
1942
|
+
private readonly config;
|
|
1943
|
+
private _sessions;
|
|
1944
|
+
private _activeSession?;
|
|
1945
|
+
private _sessionCounter;
|
|
1946
|
+
constructor(client: EvolutionClientLike, config?: EvolutionRuntimeConfig);
|
|
1947
|
+
/** Initialize: load snapshot + start sync + start outbox flush */
|
|
1948
|
+
start(): Promise<void>;
|
|
1949
|
+
/** Stop: clear timers + flush remaining outbox */
|
|
1950
|
+
stop(): Promise<void>;
|
|
1951
|
+
/**
|
|
1952
|
+
* Get a strategy recommendation for an error/context.
|
|
1953
|
+
*
|
|
1954
|
+
* Flow: extract signals → try local cache (<1ms) → fallback to server (~30ms)
|
|
1955
|
+
*
|
|
1956
|
+
* @param error - Error message or Error object
|
|
1957
|
+
* @param context - Optional additional context (provider, stage, etc.)
|
|
1958
|
+
*/
|
|
1959
|
+
suggest(error: string | Error, context?: Partial<ExecutionContext>): Promise<Suggestion>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Record an outcome. Fire-and-forget — never blocks, never throws.
|
|
1962
|
+
*
|
|
1963
|
+
* @param error - The error that was encountered
|
|
1964
|
+
* @param outcome - 'success' or 'failed'
|
|
1965
|
+
* @param summary - One-line summary of what happened
|
|
1966
|
+
* @param geneId - Gene that was used (auto-detected from last suggest() if omitted)
|
|
1967
|
+
*/
|
|
1968
|
+
learned(error: string | Error, outcome: 'success' | 'failed', summary: string, geneId?: string, metadata?: Record<string, any>): void;
|
|
1969
|
+
/** Get all completed sessions. */
|
|
1970
|
+
get sessions(): readonly EvolutionSession[];
|
|
1971
|
+
/** Get aggregate metrics for benchmarking. */
|
|
1972
|
+
getMetrics(): SessionMetrics;
|
|
1973
|
+
/** Reset session history. */
|
|
1974
|
+
resetMetrics(): void;
|
|
1975
|
+
/** Sync cache with server */
|
|
1976
|
+
private sync;
|
|
1977
|
+
/** Flush outbox to server */
|
|
1978
|
+
private flush;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1248
1981
|
/**
|
|
1249
1982
|
* Prismer Cloud SDK for TypeScript/JavaScript
|
|
1250
1983
|
*
|
|
@@ -1329,7 +2062,9 @@ declare class MessagesClient {
|
|
|
1329
2062
|
/** Get message history for a conversation */
|
|
1330
2063
|
getHistory(conversationId: string, options?: IMPaginationOptions): Promise<IMResult<IMMessage[]>>;
|
|
1331
2064
|
/** Edit a message */
|
|
1332
|
-
edit(conversationId: string, messageId: string, content: string
|
|
2065
|
+
edit(conversationId: string, messageId: string, content: string, options?: {
|
|
2066
|
+
metadata?: Record<string, any>;
|
|
2067
|
+
}): Promise<IMResult<void>>;
|
|
1333
2068
|
/** Delete a message */
|
|
1334
2069
|
delete(conversationId: string, messageId: string): Promise<IMResult<void>>;
|
|
1335
2070
|
}
|
|
@@ -1379,6 +2114,292 @@ declare class WorkspaceClient {
|
|
|
1379
2114
|
/** @mention autocomplete */
|
|
1380
2115
|
mentionAutocomplete(conversationId: string, query?: string): Promise<IMResult<IMAutocompleteResult[]>>;
|
|
1381
2116
|
}
|
|
2117
|
+
/** Task management: create, list, claim, progress, complete, fail */
|
|
2118
|
+
declare class TasksClient {
|
|
2119
|
+
private _r;
|
|
2120
|
+
constructor(_r: RequestFn);
|
|
2121
|
+
/** Create a new task */
|
|
2122
|
+
create(options: IMCreateTaskOptions): Promise<IMResult<IMTask>>;
|
|
2123
|
+
/** List tasks with optional filters */
|
|
2124
|
+
list(options?: IMTaskListOptions): Promise<IMResult<IMTask[]>>;
|
|
2125
|
+
/** Get task details with logs */
|
|
2126
|
+
get(taskId: string): Promise<IMResult<IMTaskDetail>>;
|
|
2127
|
+
/** Update a task */
|
|
2128
|
+
update(taskId: string, options: IMUpdateTaskOptions): Promise<IMResult<IMTask>>;
|
|
2129
|
+
/** Claim a pending task */
|
|
2130
|
+
claim(taskId: string): Promise<IMResult<IMTask>>;
|
|
2131
|
+
/** Report progress on a task */
|
|
2132
|
+
progress(taskId: string, options?: {
|
|
2133
|
+
message?: string;
|
|
2134
|
+
metadata?: Record<string, unknown>;
|
|
2135
|
+
}): Promise<IMResult<void>>;
|
|
2136
|
+
/** Complete a task with result */
|
|
2137
|
+
complete(taskId: string, options?: IMCompleteTaskOptions): Promise<IMResult<IMTask>>;
|
|
2138
|
+
/** Fail a task with error */
|
|
2139
|
+
fail(taskId: string, error: string, metadata?: Record<string, unknown>): Promise<IMResult<IMTask>>;
|
|
2140
|
+
}
|
|
2141
|
+
/** Memory management: files, compaction, session load */
|
|
2142
|
+
declare class MemoryClient {
|
|
2143
|
+
private _r;
|
|
2144
|
+
constructor(_r: RequestFn);
|
|
2145
|
+
/** Create a memory file */
|
|
2146
|
+
createFile(options: IMCreateMemoryFileOptions): Promise<IMResult<IMMemoryFile>>;
|
|
2147
|
+
/** List memory files */
|
|
2148
|
+
listFiles(options?: {
|
|
2149
|
+
scope?: string;
|
|
2150
|
+
path?: string;
|
|
2151
|
+
}): Promise<IMResult<IMMemoryFile[]>>;
|
|
2152
|
+
/** Get a memory file by ID */
|
|
2153
|
+
getFile(fileId: string): Promise<IMResult<IMMemoryFileDetail>>;
|
|
2154
|
+
/** Update a memory file (append, replace, or replace_section) */
|
|
2155
|
+
updateFile(fileId: string, options: IMUpdateMemoryFileOptions): Promise<IMResult<IMMemoryFileDetail>>;
|
|
2156
|
+
/** Delete a memory file */
|
|
2157
|
+
deleteFile(fileId: string): Promise<IMResult<void>>;
|
|
2158
|
+
/** Compact conversation messages into a summary */
|
|
2159
|
+
compact(options: IMCompactOptions): Promise<IMResult<IMCompactionSummary>>;
|
|
2160
|
+
/** Get compaction summaries for a conversation */
|
|
2161
|
+
getCompaction(conversationId: string): Promise<IMResult<IMCompactionSummary[]>>;
|
|
2162
|
+
/** Load memory for session context */
|
|
2163
|
+
load(scope?: string): Promise<IMResult<IMMemoryLoadResult>>;
|
|
2164
|
+
}
|
|
2165
|
+
/** Identity key management: Ed25519 keys, attestation, audit */
|
|
2166
|
+
declare class IdentityClient {
|
|
2167
|
+
private _r;
|
|
2168
|
+
constructor(_r: RequestFn);
|
|
2169
|
+
/** Get server public key */
|
|
2170
|
+
getServerKey(): Promise<IMResult<{
|
|
2171
|
+
publicKey: string;
|
|
2172
|
+
}>>;
|
|
2173
|
+
/** Register or rotate an identity key */
|
|
2174
|
+
registerKey(options: IMRegisterKeyOptions): Promise<IMResult<IMIdentityKey>>;
|
|
2175
|
+
/** Get a user's identity key */
|
|
2176
|
+
getKey(userId: string): Promise<IMResult<IMIdentityKey>>;
|
|
2177
|
+
/** Revoke own identity key */
|
|
2178
|
+
revokeKey(): Promise<IMResult<void>>;
|
|
2179
|
+
/** Get key audit log for a user */
|
|
2180
|
+
getAuditLog(userId: string): Promise<IMResult<IMKeyAuditEntry[]>>;
|
|
2181
|
+
/** Verify key audit log integrity */
|
|
2182
|
+
verifyAuditLog(userId: string): Promise<IMResult<IMKeyVerifyResult>>;
|
|
2183
|
+
}
|
|
2184
|
+
/** Conversation security: E2E encryption settings and key management */
|
|
2185
|
+
declare class SecurityClient {
|
|
2186
|
+
private _r;
|
|
2187
|
+
constructor(_r: RequestFn);
|
|
2188
|
+
/** Get conversation security settings */
|
|
2189
|
+
getConversationSecurity(conversationId: string): Promise<IMResult<any>>;
|
|
2190
|
+
/** Update conversation security settings */
|
|
2191
|
+
setConversationSecurity(conversationId: string, options: {
|
|
2192
|
+
signingPolicy?: string;
|
|
2193
|
+
encryptionMode?: string;
|
|
2194
|
+
}): Promise<IMResult<any>>;
|
|
2195
|
+
/** Upload a public key for a conversation */
|
|
2196
|
+
uploadKey(conversationId: string, publicKey: string, algorithm?: string): Promise<IMResult<any>>;
|
|
2197
|
+
/** Get keys for a conversation */
|
|
2198
|
+
getKeys(conversationId: string): Promise<IMResult<any[]>>;
|
|
2199
|
+
/** Revoke a key for a specific user in a conversation */
|
|
2200
|
+
revokeKey(conversationId: string, keyUserId: string): Promise<IMResult<any>>;
|
|
2201
|
+
}
|
|
2202
|
+
/** Skill Evolution: gene management, analysis, recording, distillation */
|
|
2203
|
+
declare class EvolutionClient {
|
|
2204
|
+
private _r;
|
|
2205
|
+
constructor(_r: RequestFn);
|
|
2206
|
+
/** Get evolution stats */
|
|
2207
|
+
getStats(): Promise<IMResult<IMEvolutionStats>>;
|
|
2208
|
+
/** Get hot/trending genes */
|
|
2209
|
+
getHotGenes(limit?: number): Promise<IMResult<IMGene[]>>;
|
|
2210
|
+
/** Browse published genes */
|
|
2211
|
+
browseGenes(options?: IMGeneListOptions): Promise<IMResult<IMGene[]>>;
|
|
2212
|
+
/** Get a public gene by ID */
|
|
2213
|
+
getPublicGene(geneId: string): Promise<IMResult<IMGene>>;
|
|
2214
|
+
/** Get capsules for a public gene */
|
|
2215
|
+
getGeneCapsules(geneId: string, limit?: number): Promise<IMResult<IMCapsule[]>>;
|
|
2216
|
+
/** Get gene lineage (parent + children) */
|
|
2217
|
+
getGeneLineage(geneId: string): Promise<IMResult<{
|
|
2218
|
+
geneId: string;
|
|
2219
|
+
parent?: IMGene;
|
|
2220
|
+
children: IMGene[];
|
|
2221
|
+
generation: number;
|
|
2222
|
+
}>>;
|
|
2223
|
+
/** Get public evolution feed */
|
|
2224
|
+
getFeed(limit?: number): Promise<IMResult<any[]>>;
|
|
2225
|
+
/** Analyze signals and get gene recommendation */
|
|
2226
|
+
analyze(options: IMAnalyzeOptions & {
|
|
2227
|
+
scope?: string;
|
|
2228
|
+
}): Promise<IMResult<IMAnalyzeResult>>;
|
|
2229
|
+
/** Record an outcome (success/failure) for a gene */
|
|
2230
|
+
record(options: IMRecordOutcomeOptions & {
|
|
2231
|
+
scope?: string;
|
|
2232
|
+
}): Promise<IMResult<any>>;
|
|
2233
|
+
/**
|
|
2234
|
+
* One-step evolution: analyze context → get gene recommendation → auto-record outcome.
|
|
2235
|
+
* Combines analyze() + record() into a single call for the common case.
|
|
2236
|
+
*
|
|
2237
|
+
* Usage:
|
|
2238
|
+
* const result = await client.evolution.evolve({
|
|
2239
|
+
* error: 'Connection timeout after 10s',
|
|
2240
|
+
* outcome: 'success',
|
|
2241
|
+
* score: 0.85,
|
|
2242
|
+
* summary: 'Fixed with exponential backoff',
|
|
2243
|
+
* });
|
|
2244
|
+
*/
|
|
2245
|
+
evolve(options: {
|
|
2246
|
+
error?: string;
|
|
2247
|
+
task_status?: string;
|
|
2248
|
+
task_capability?: string;
|
|
2249
|
+
tags?: string[];
|
|
2250
|
+
signals?: Array<string | {
|
|
2251
|
+
type: string;
|
|
2252
|
+
provider?: string;
|
|
2253
|
+
stage?: string;
|
|
2254
|
+
severity?: string;
|
|
2255
|
+
}>;
|
|
2256
|
+
provider?: string;
|
|
2257
|
+
stage?: string;
|
|
2258
|
+
severity?: string;
|
|
2259
|
+
outcome: 'success' | 'failed';
|
|
2260
|
+
score?: number;
|
|
2261
|
+
summary?: string;
|
|
2262
|
+
strategy_used?: string[];
|
|
2263
|
+
scope?: string;
|
|
2264
|
+
}): Promise<IMResult<{
|
|
2265
|
+
analysis: IMAnalyzeResult;
|
|
2266
|
+
recorded: boolean;
|
|
2267
|
+
edge_updated?: boolean;
|
|
2268
|
+
}>>;
|
|
2269
|
+
/** Trigger gene distillation */
|
|
2270
|
+
distill(dryRun?: boolean): Promise<IMResult<any>>;
|
|
2271
|
+
/** List own genes */
|
|
2272
|
+
listGenes(signals?: string, scope?: string): Promise<IMResult<IMGene[]>>;
|
|
2273
|
+
/** Create a new gene */
|
|
2274
|
+
createGene(options: IMCreateGeneOptions & {
|
|
2275
|
+
scope?: string;
|
|
2276
|
+
}): Promise<IMResult<IMGene>>;
|
|
2277
|
+
/** Delete a gene */
|
|
2278
|
+
deleteGene(geneId: string): Promise<IMResult<void>>;
|
|
2279
|
+
/** Publish a gene. Pass skipCanary=true to bypass canary validation (MVP/admin). */
|
|
2280
|
+
publishGene(geneId: string, options?: {
|
|
2281
|
+
skipCanary?: boolean;
|
|
2282
|
+
}): Promise<IMResult<IMGene>>;
|
|
2283
|
+
/** Import a published gene */
|
|
2284
|
+
importGene(geneId: string): Promise<IMResult<IMGene>>;
|
|
2285
|
+
/** Fork a gene with modifications */
|
|
2286
|
+
forkGene(options: IMForkGeneOptions): Promise<IMResult<IMGene>>;
|
|
2287
|
+
/** Get signal-gene edges */
|
|
2288
|
+
getEdges(options?: {
|
|
2289
|
+
signalKey?: string;
|
|
2290
|
+
geneId?: string;
|
|
2291
|
+
limit?: number;
|
|
2292
|
+
scope?: string;
|
|
2293
|
+
}): Promise<IMResult<IMEvolutionEdge[]>>;
|
|
2294
|
+
/** Get agent personality profile */
|
|
2295
|
+
getPersonality(agentId: string): Promise<IMResult<{
|
|
2296
|
+
personality: IMAgentPersonality;
|
|
2297
|
+
stats: any;
|
|
2298
|
+
}>>;
|
|
2299
|
+
/** Get own capsule history */
|
|
2300
|
+
getCapsules(options?: {
|
|
2301
|
+
page?: number;
|
|
2302
|
+
limit?: number;
|
|
2303
|
+
scope?: string;
|
|
2304
|
+
}): Promise<IMResult<IMCapsule[]>>;
|
|
2305
|
+
/** Get evolution report */
|
|
2306
|
+
getReport(agentId?: string, scope?: string): Promise<IMResult<any>>;
|
|
2307
|
+
/** List available evolution scopes */
|
|
2308
|
+
listScopes(): Promise<IMResult<string[]>>;
|
|
2309
|
+
/** Get recent evolution stories (for L1 narrative embedding) */
|
|
2310
|
+
getStories(options?: {
|
|
2311
|
+
limit?: number;
|
|
2312
|
+
since?: number;
|
|
2313
|
+
}): Promise<IMResult<any[]>>;
|
|
2314
|
+
/** Get north-star metrics comparison (standard vs hypergraph) */
|
|
2315
|
+
getMetrics(): Promise<IMResult<{
|
|
2316
|
+
standard: any;
|
|
2317
|
+
hypergraph: any;
|
|
2318
|
+
verdict: string;
|
|
2319
|
+
}>>;
|
|
2320
|
+
/** Trigger metrics collection snapshot */
|
|
2321
|
+
collectMetrics(windowHours?: number): Promise<IMResult<{
|
|
2322
|
+
standard: any;
|
|
2323
|
+
hypergraph: any;
|
|
2324
|
+
}>>;
|
|
2325
|
+
/** Search skills catalog */
|
|
2326
|
+
searchSkills(options?: {
|
|
2327
|
+
query?: string;
|
|
2328
|
+
category?: string;
|
|
2329
|
+
limit?: number;
|
|
2330
|
+
}): Promise<IMResult<any[]>>;
|
|
2331
|
+
/** Get skill catalog stats */
|
|
2332
|
+
getSkillStats(): Promise<IMResult<any>>;
|
|
2333
|
+
/** Install a skill — creates Gene + returns content + install guide */
|
|
2334
|
+
installSkill(slugOrId: string): Promise<IMResult<IMSkillInstallResult>>;
|
|
2335
|
+
/** Uninstall a skill */
|
|
2336
|
+
uninstallSkill(slugOrId: string): Promise<IMResult<{
|
|
2337
|
+
uninstalled: boolean;
|
|
2338
|
+
}>>;
|
|
2339
|
+
/** List installed skills for this agent */
|
|
2340
|
+
installedSkills(): Promise<IMResult<IMAgentSkillRecord[]>>;
|
|
2341
|
+
/** Get full skill content (SKILL.md + package info) */
|
|
2342
|
+
getSkillContent(slugOrId: string): Promise<IMResult<IMSkillContent>>;
|
|
2343
|
+
/**
|
|
2344
|
+
* Install a skill and write SKILL.md to local filesystem.
|
|
2345
|
+
* Combines cloud install + local file sync for Claude Code / OpenClaw / OpenCode.
|
|
2346
|
+
* @param slugOrId - Skill slug or ID
|
|
2347
|
+
* @param options - Local install options
|
|
2348
|
+
*/
|
|
2349
|
+
installSkillLocal(slugOrId: string, options?: {
|
|
2350
|
+
/** Target platforms (default: all detected) */
|
|
2351
|
+
platforms?: Array<'claude-code' | 'openclaw' | 'opencode' | 'plugin'>;
|
|
2352
|
+
/** Write to project-level paths instead of global */
|
|
2353
|
+
project?: boolean;
|
|
2354
|
+
/** Project root directory (for project-level installs) */
|
|
2355
|
+
projectRoot?: string;
|
|
2356
|
+
}): Promise<IMResult<IMSkillInstallResult & {
|
|
2357
|
+
localPaths: string[];
|
|
2358
|
+
}>>;
|
|
2359
|
+
/**
|
|
2360
|
+
* Uninstall a skill and remove local SKILL.md files.
|
|
2361
|
+
*/
|
|
2362
|
+
uninstallSkillLocal(slugOrId: string): Promise<IMResult<{
|
|
2363
|
+
uninstalled: boolean;
|
|
2364
|
+
removedPaths: string[];
|
|
2365
|
+
}>>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Sync all installed skills to local filesystem.
|
|
2368
|
+
*/
|
|
2369
|
+
syncSkillsLocal(options?: {
|
|
2370
|
+
platforms?: Array<'claude-code' | 'openclaw' | 'opencode' | 'plugin'>;
|
|
2371
|
+
}): Promise<{
|
|
2372
|
+
synced: number;
|
|
2373
|
+
failed: number;
|
|
2374
|
+
paths: string[];
|
|
2375
|
+
}>;
|
|
2376
|
+
/** Export a Gene as a Skill */
|
|
2377
|
+
exportAsSkill(geneId: string, options?: {
|
|
2378
|
+
slug?: string;
|
|
2379
|
+
displayName?: string;
|
|
2380
|
+
changelog?: string;
|
|
2381
|
+
}): Promise<IMResult<any>>;
|
|
2382
|
+
/** Submit a raw-context evolution report (auto-creates signals + gene match) */
|
|
2383
|
+
submitReport(options: {
|
|
2384
|
+
rawContext: string;
|
|
2385
|
+
outcome: 'success' | 'failed';
|
|
2386
|
+
taskContext?: string;
|
|
2387
|
+
taskError?: string;
|
|
2388
|
+
taskId?: string;
|
|
2389
|
+
metadata?: Record<string, unknown>;
|
|
2390
|
+
}): Promise<IMResult<any>>;
|
|
2391
|
+
/** Get status of a submitted report by traceId */
|
|
2392
|
+
getReportStatus(traceId: string): Promise<IMResult<any>>;
|
|
2393
|
+
/** Get evolution achievements for the current agent */
|
|
2394
|
+
getAchievements(): Promise<IMResult<any[]>>;
|
|
2395
|
+
/** Get a sync snapshot (global gene/edge state since a sequence number) */
|
|
2396
|
+
getSyncSnapshot(since?: number): Promise<IMResult<any>>;
|
|
2397
|
+
/** Bidirectional sync: push local outcomes and pull remote updates */
|
|
2398
|
+
sync(options?: {
|
|
2399
|
+
pushOutcomes?: any[];
|
|
2400
|
+
pullSince?: number;
|
|
2401
|
+
}): Promise<IMResult<any>>;
|
|
2402
|
+
}
|
|
1382
2403
|
/** File upload management (presign → upload → confirm) */
|
|
1383
2404
|
declare class FilesClient {
|
|
1384
2405
|
private _r;
|
|
@@ -1451,6 +2472,11 @@ declare class IMClient {
|
|
|
1451
2472
|
readonly bindings: BindingsClient;
|
|
1452
2473
|
readonly credits: CreditsClient;
|
|
1453
2474
|
readonly workspace: WorkspaceClient;
|
|
2475
|
+
readonly tasks: TasksClient;
|
|
2476
|
+
readonly memory: MemoryClient;
|
|
2477
|
+
readonly identity: IdentityClient;
|
|
2478
|
+
readonly security: SecurityClient;
|
|
2479
|
+
readonly evolution: EvolutionClient;
|
|
1454
2480
|
readonly files: FilesClient;
|
|
1455
2481
|
readonly realtime: IMRealtimeClient;
|
|
1456
2482
|
/** Offline manager (null if offline mode not enabled) */
|
|
@@ -1504,4 +2530,4 @@ declare class PrismerClient {
|
|
|
1504
2530
|
|
|
1505
2531
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
1506
2532
|
|
|
1507
|
-
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type Environment, type ErrorPayload, type FileInput, FilesClient, GroupsClient, type IMAgentCard, type IMAutocompleteResult, type IMBinding, type IMBindingData, IMClient, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGroupOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMFileQuota, type IMGroupData, type IMGroupMember, type IMMeData, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRegisterData, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMTokenData, type IMTransaction, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryStorage, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type SendFileOptions, type SendFileResult, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type SyncEvent, type SyncResult, TabCoordinator, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, PrismerClient as default };
|
|
2533
|
+
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals };
|