@nirmos/sdk 0.3.2 → 0.3.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/README.md +261 -16
- package/dist/cjs/core/transport.js +16 -3
- package/dist/cjs/core/transport.js.map +1 -1
- package/dist/cjs/core/version.js +6 -0
- package/dist/cjs/core/version.js.map +1 -0
- package/dist/cjs/gateway/chat-stream.js +10 -0
- package/dist/cjs/gateway/chat-stream.js.map +1 -1
- package/dist/cjs/gateway/chat.js +1 -0
- package/dist/cjs/gateway/chat.js.map +1 -1
- package/dist/cjs/gateway/embeddings.js +1 -0
- package/dist/cjs/gateway/embeddings.js.map +1 -1
- package/dist/cjs/gateway/mappers.js +39 -2
- package/dist/cjs/gateway/mappers.js.map +1 -1
- package/dist/esm/core/transport.js +15 -2
- package/dist/esm/core/transport.js.map +1 -1
- package/dist/esm/core/version.d.ts +2 -0
- package/dist/esm/core/version.d.ts.map +1 -0
- package/dist/esm/core/version.js +3 -0
- package/dist/esm/core/version.js.map +1 -0
- package/dist/esm/gateway/chat-stream.d.ts.map +1 -1
- package/dist/esm/gateway/chat-stream.js +11 -1
- package/dist/esm/gateway/chat-stream.js.map +1 -1
- package/dist/esm/gateway/chat.d.ts.map +1 -1
- package/dist/esm/gateway/chat.js +1 -0
- package/dist/esm/gateway/chat.js.map +1 -1
- package/dist/esm/gateway/embeddings.d.ts.map +1 -1
- package/dist/esm/gateway/embeddings.js +1 -0
- package/dist/esm/gateway/embeddings.js.map +1 -1
- package/dist/esm/gateway/mappers.d.ts +2 -0
- package/dist/esm/gateway/mappers.d.ts.map +1 -1
- package/dist/esm/gateway/mappers.js +38 -2
- package/dist/esm/gateway/mappers.js.map +1 -1
- package/dist/esm/gateway/types.d.ts +8 -0
- package/dist/esm/gateway/types.d.ts.map +1 -1
- package/dist/esm/management/contracts.d.ts +82 -0
- package/dist/esm/management/contracts.d.ts.map +1 -1
- package/dist/esm/memory/types.d.ts +14 -5
- package/dist/esm/memory/types.d.ts.map +1 -1
- package/examples/memory-quickstart.mjs +199 -0
- package/examples/memory-quickstart.ts +240 -0
- package/examples/tsconfig.json +5 -0
- package/package.json +5 -4
- package/src/core/transport.ts +14 -2
- package/src/core/version.ts +2 -0
- package/src/gateway/chat-stream.ts +12 -1
- package/src/gateway/chat.ts +1 -0
- package/src/gateway/embeddings.ts +1 -0
- package/src/gateway/mappers.ts +55 -2
- package/src/gateway/types.ts +8 -0
- package/src/management/contracts.ts +14 -14
- package/src/memory/types.ts +15 -4
package/src/gateway/mappers.ts
CHANGED
|
@@ -36,6 +36,12 @@ export function toWireMessage(message: ChatMessage): Record<string, unknown> {
|
|
|
36
36
|
audio: { data: part.data, format: part.format },
|
|
37
37
|
};
|
|
38
38
|
}),
|
|
39
|
+
...(message.reasoning !== undefined
|
|
40
|
+
? { reasoning: message.reasoning }
|
|
41
|
+
: {}),
|
|
42
|
+
...(message.reasoningDetails?.length
|
|
43
|
+
? { reasoning_details: message.reasoningDetails }
|
|
44
|
+
: {}),
|
|
39
45
|
...(message.name ? { name: message.name } : {}),
|
|
40
46
|
...(message.toolCallId ? { tool_call_id: message.toolCallId } : {}),
|
|
41
47
|
...(message.toolCalls && message.toolCalls.length > 0
|
|
@@ -68,8 +74,15 @@ export function normalizeUsage(value: unknown): Usage {
|
|
|
68
74
|
totalTokens:
|
|
69
75
|
readNumber(usage, "total_tokens", "totalTokens") ??
|
|
70
76
|
inputTokens + outputTokens,
|
|
71
|
-
cachedTokens:
|
|
72
|
-
|
|
77
|
+
cachedTokens:
|
|
78
|
+
readNumber(usage, "cached_tokens", "cachedTokens") ??
|
|
79
|
+
readNumber(asUnknownRecord(usage.prompt_tokens_details), "cached_tokens"),
|
|
80
|
+
reasoningTokens:
|
|
81
|
+
readNumber(usage, "reasoning_tokens", "reasoningTokens") ??
|
|
82
|
+
readNumber(
|
|
83
|
+
asUnknownRecord(usage.completion_tokens_details),
|
|
84
|
+
"reasoning_tokens",
|
|
85
|
+
),
|
|
73
86
|
};
|
|
74
87
|
}
|
|
75
88
|
|
|
@@ -183,6 +196,12 @@ export function normalizeMessage(value: unknown): ChatMessage {
|
|
|
183
196
|
? content
|
|
184
197
|
: "",
|
|
185
198
|
name: readString(message, "name"),
|
|
199
|
+
reasoning: readString(message, "reasoning"),
|
|
200
|
+
reasoningDetails: readArray(
|
|
201
|
+
message,
|
|
202
|
+
"reasoning_details",
|
|
203
|
+
"reasoningDetails",
|
|
204
|
+
) as ChatMessage["reasoningDetails"],
|
|
186
205
|
toolCallId: readString(message, "tool_call_id", "toolCallId"),
|
|
187
206
|
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
|
|
188
207
|
};
|
|
@@ -232,3 +251,37 @@ function normalizeFinishReason(
|
|
|
232
251
|
if (value === "content_filter") return "contentFilter";
|
|
233
252
|
return value;
|
|
234
253
|
}
|
|
254
|
+
|
|
255
|
+
/** Assemble indexed reasoning blocks without losing encrypted continuation data. */
|
|
256
|
+
export function mergeReasoningDetails(
|
|
257
|
+
current: NonNullable<ChatMessage["reasoningDetails"]>,
|
|
258
|
+
incoming: NonNullable<ChatMessage["reasoningDetails"]>,
|
|
259
|
+
): NonNullable<ChatMessage["reasoningDetails"]> {
|
|
260
|
+
const result = [...current];
|
|
261
|
+
for (const value of incoming) {
|
|
262
|
+
const detail = asUnknownRecord(value);
|
|
263
|
+
const position = result.findIndex((item) => {
|
|
264
|
+
const previous = asUnknownRecord(item);
|
|
265
|
+
return (
|
|
266
|
+
previous.type === detail.type &&
|
|
267
|
+
((detail.index !== undefined && previous.index === detail.index) ||
|
|
268
|
+
(typeof detail.id === "string" && previous.id === detail.id))
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
if (position < 0) {
|
|
272
|
+
result.push(value);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const previous = asUnknownRecord(result[position]);
|
|
276
|
+
const merged = { ...previous, ...detail };
|
|
277
|
+
for (const field of ["text", "summary", "data", "signature"]) {
|
|
278
|
+
if (
|
|
279
|
+
typeof previous[field] === "string" &&
|
|
280
|
+
typeof detail[field] === "string"
|
|
281
|
+
)
|
|
282
|
+
merged[field] = previous[field] + detail[field];
|
|
283
|
+
}
|
|
284
|
+
result[position] = merged as (typeof result)[number];
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
}
|
package/src/gateway/types.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface ChatMessage {
|
|
|
45
45
|
role: ChatRole;
|
|
46
46
|
content: string | readonly ChatContentPart[];
|
|
47
47
|
name?: string;
|
|
48
|
+
reasoning?: string;
|
|
49
|
+
reasoningDetails?: readonly JsonValue[];
|
|
48
50
|
toolCallId?: string;
|
|
49
51
|
toolCalls?: readonly FunctionToolCall[];
|
|
50
52
|
}
|
|
@@ -106,6 +108,8 @@ interface ChatCreateParamsBase {
|
|
|
106
108
|
user?: string;
|
|
107
109
|
/** Optional provider override. Omit to let the gateway select a provider. */
|
|
108
110
|
provider?: string;
|
|
111
|
+
/** Options scoped to an upstream provider slug; other targets never receive them. */
|
|
112
|
+
providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
109
113
|
fallbackModels?: readonly string[];
|
|
110
114
|
routingStrategy?: RoutingStrategy;
|
|
111
115
|
metadata?: Readonly<Record<string, JsonValue>>;
|
|
@@ -167,6 +171,8 @@ export interface EmbeddingCreateParams {
|
|
|
167
171
|
user?: string;
|
|
168
172
|
/** Optional provider override. Omit to use the model's configured default provider. */
|
|
169
173
|
provider?: string;
|
|
174
|
+
/** Options scoped to an upstream provider slug; other targets never receive them. */
|
|
175
|
+
providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
170
176
|
/** @deprecated Embeddings never fall back to another vector space. Requests with this option are rejected. */
|
|
171
177
|
fallbackModels?: readonly string[];
|
|
172
178
|
/** @deprecated Embeddings require direct model selection. */
|
|
@@ -204,6 +210,8 @@ export interface ImageGenerateParams {
|
|
|
204
210
|
user?: string;
|
|
205
211
|
/** Optional provider override. Omit to use the model's configured default provider. */
|
|
206
212
|
provider?: string;
|
|
213
|
+
/** Options scoped to an upstream provider slug; other targets never receive them. */
|
|
214
|
+
providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
207
215
|
metadata?: Readonly<Record<string, JsonValue>>;
|
|
208
216
|
}
|
|
209
217
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
export type ApiError = { "error": { "code": string; "message": string; "details"?: unknown; "requestId": string; }; };
|
|
3
3
|
export type listProvidersQuery = { "limit"?: number; "cursor"?: string; };
|
|
4
4
|
export type listProvidersResponse___schema0 = string | number | boolean | null | Array<listProvidersResponse___schema0> | { [key: string]: listProvidersResponse___schema0; };
|
|
5
|
-
export type listProvidersResponse = { "items": Array<{ "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "capabilities": listProvidersResponse___schema0 | null; "metadata": listProvidersResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; }>; "nextCursor": string | null; };
|
|
5
|
+
export type listProvidersResponse = { "items": Array<{ "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "authSchema"?: listProvidersResponse___schema0 | null; "capabilities": listProvidersResponse___schema0 | null; "metadata": listProvidersResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; }>; "nextCursor": string | null; };
|
|
6
6
|
export type getProviderResponse___schema0 = string | number | boolean | null | Array<getProviderResponse___schema0> | { [key: string]: getProviderResponse___schema0; };
|
|
7
|
-
export type getProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "capabilities": getProviderResponse___schema0 | null; "metadata": getProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
7
|
+
export type getProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "authSchema"?: getProviderResponse___schema0 | null; "capabilities": getProviderResponse___schema0 | null; "metadata": getProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
8
8
|
export type createProviderRequest = { "name": string; "slug"?: string; "description"?: string; "baseUrl": string; "kind": string; "adapterType": "native_sdk" | "openai_compatible" | "vercel_ai_sdk"; };
|
|
9
9
|
export type createProviderResponse___schema0 = string | number | boolean | null | Array<createProviderResponse___schema0> | { [key: string]: createProviderResponse___schema0; };
|
|
10
|
-
export type createProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "capabilities": createProviderResponse___schema0 | null; "metadata": createProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
10
|
+
export type createProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "authSchema"?: createProviderResponse___schema0 | null; "capabilities": createProviderResponse___schema0 | null; "metadata": createProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
11
11
|
export type updateProviderRequest = { "name"?: string; "slug"?: string; "description"?: string; "baseUrl"?: string; "kind"?: string; "adapterType"?: "native_sdk" | "openai_compatible" | "vercel_ai_sdk"; "status"?: "active" | "degraded" | "outage" | "maintenance"; };
|
|
12
12
|
export type updateProviderResponse___schema0 = string | number | boolean | null | Array<updateProviderResponse___schema0> | { [key: string]: updateProviderResponse___schema0; };
|
|
13
|
-
export type updateProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "capabilities": updateProviderResponse___schema0 | null; "metadata": updateProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
13
|
+
export type updateProviderResponse = { "id": string; "name": string; "slug": string; "kind": string; "scope": string; "status": string; "isCustom": boolean; "modelCount"?: number; "baseUrl": string | null; "adapterType": string | null; "authSchema"?: updateProviderResponse___schema0 | null; "capabilities": updateProviderResponse___schema0 | null; "metadata": updateProviderResponse___schema0 | null; "logoUrl"?: string | null; "createdAt": string; "updatedAt": string; };
|
|
14
14
|
export type deleteProviderResponse = { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
15
15
|
export type listModelsQuery = { "limit"?: number; "cursor"?: string; "capability"?: "embeddings" | "chat" | "vision" | "tools" | "json" | "streaming"; "providerId"?: string; "availability"?: "true" | "false"; };
|
|
16
16
|
export type listModelsResponse___schema0 = string | number | boolean | null | Array<listModelsResponse___schema0> | { [key: string]: listModelsResponse___schema0; };
|
|
@@ -25,14 +25,14 @@ export type updateModelResponse___schema0 = string | number | boolean | null | A
|
|
|
25
25
|
export type updateModelResponse = { "id": string; "name": string; "slug": string; "providerId": string; "availability": boolean; "scope": string; "externalId": string | null; "status": string; "lifecycleStatus": string; "runtimeHealth": string; "contextWindow": number | null; "maxOutputTokens": number | null; "capabilities": updateModelResponse___schema0 | null; "pricing": updateModelResponse___schema0 | null; "metadata": updateModelResponse___schema0 | null; "createdAt": string; "updatedAt": string; "knowledgeSupportedDimensions"?: Array<number>; "knowledgeRecommendedDimensions"?: number; };
|
|
26
26
|
export type deleteModelResponse = { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
27
27
|
export type listCredentialsQuery = { "limit"?: number; "cursor"?: string; "providerId"?: string; };
|
|
28
|
-
export type listCredentialsResponse = { "items": Array<{ "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; }>; "nextCursor": string | null; };
|
|
28
|
+
export type listCredentialsResponse = { "items": Array<{ "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "config"?: { "accountId"?: string; }; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; }>; "nextCursor": string | null; };
|
|
29
29
|
export type createCredentialRequest___schema0 = string | number | boolean | null | Array<createCredentialRequest___schema0> | { [key: string]: createCredentialRequest___schema0; };
|
|
30
30
|
export type createCredentialRequest = { "name": string; "providerId": string; "environmentId"?: string; "label"?: string; "credentialType": "api_key" | "oauth" | "azure" | "aws" | "custom"; "secretData"?: { [key: string]: string | number | boolean; }; "secret"?: string; "config"?: { [key: string]: createCredentialRequest___schema0; }; "isDefault"?: boolean; "expiresAt"?: string; };
|
|
31
|
-
export type createCredentialResponse = { "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; } | { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
31
|
+
export type createCredentialResponse = { "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "config"?: { "accountId"?: string; }; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; } | { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
32
32
|
export type updateCredentialRequest___schema0 = string | number | boolean | null | Array<updateCredentialRequest___schema0> | { [key: string]: updateCredentialRequest___schema0; };
|
|
33
33
|
export type updateCredentialRequest___schema1 = string | number | boolean | null | Array<updateCredentialRequest___schema1> | { [key: string]: updateCredentialRequest___schema1; };
|
|
34
34
|
export type updateCredentialRequest = { "name"?: string; "label"?: string; "secret"?: string; "secretData"?: { [key: string]: updateCredentialRequest___schema0; }; "config"?: { [key: string]: updateCredentialRequest___schema1; }; "isDefault"?: boolean; "expiresAt"?: string | null; };
|
|
35
|
-
export type updateCredentialResponse = { "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; } | { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
35
|
+
export type updateCredentialResponse = { "id": string; "name": string; "providerId"?: string; "provider"?: { "id": string; "name": string; "slug": string; }; "providerName"?: string; "providerSlug"?: string; "environmentId"?: string | null; "label"?: string | null; "config"?: { "accountId"?: string; }; "credentialType": string; "keyPreview"?: string | null; "isDefault"?: boolean; "status": string; "validationStatus"?: string; "validatedAt"?: string | null; "version"?: number; "lastRotatedAt"?: string | null; "lastUsedAt"?: string | null; "usageCount"?: number; "expiresAt"?: string | null; "createdAt": string; "updatedAt"?: string; } | { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
36
36
|
export type deleteCredentialResponse = { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
37
37
|
export type validateCredentialResponse = { "id"?: string; "promptId"?: string; "branchId"?: string; "branchSlug"?: string; "versionId"?: string; "mergedVersionId"?: string; "version"?: number; "count"?: number; "imported"?: number; "completed"?: boolean; "deleted"?: boolean; "status"?: string; "existing"?: boolean; "valid"?: boolean; "error"?: string; "scoreFinalized"?: boolean; "result"?: string | null; };
|
|
38
38
|
export type listPromptsQuery = { "limit"?: number; "cursor"?: string; "search"?: string; "status"?: "all" | "draft" | "published" | "archived"; "sort"?: "updated" | "newest" | "oldest" | "name"; };
|
|
@@ -488,14 +488,14 @@ export type workspaceSummaryResponse___schema0 = string | number | boolean | nul
|
|
|
488
488
|
export type workspaceSummaryResponse = { "user": { "id": string; "name": string; "email": string; "image"?: string | null; }; "activeOrganization": { "id": string; "memberCount"?: number; "pendingInvitationCount"?: number; "name": string; "slug": string; "createdAt": string; "logo"?: string | null; "metadata"?: workspaceSummaryResponse___schema0 | null; } | null; "role": string | null; "metrics": { "organizations": number; "members": number; "pendingInvitations": number; "managedTokens": number; }; };
|
|
489
489
|
export type listLogsQuery = { "limit"?: number; "cursor"?: string; "providerId"?: string; "modelId"?: string; "applicationId"?: string; "environmentId"?: string; "traceId"?: string; "success"?: "true" | "false"; "from"?: string; "to"?: string; };
|
|
490
490
|
export type listLogsResponse___schema0 = string | number | boolean | null | Array<listLogsResponse___schema0> | { [key: string]: listLogsResponse___schema0; };
|
|
491
|
-
export type listLogsResponse = { "items": Array<{ "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: listLogsResponse___schema0 | null; "responsePayload"?: listLogsResponse___schema0 | null; "errorCode"?: string | null; }>; "nextCursor": string | null; };
|
|
491
|
+
export type listLogsResponse = { "items": Array<{ "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: listLogsResponse___schema0 | null; "responsePayload"?: listLogsResponse___schema0 | null; "errorCode"?: string | null; "statusCode"?: number | null; "retryable"?: boolean; "retryAfterMs"?: number; "diagnostics"?: { "memoryRunId"?: string; "memoryOperation"?: string; "parentRequestId"?: string; "parentTraceId"?: string; }; }>; "nextCursor": string | null; };
|
|
492
492
|
export type listTracesQuery = { "limit"?: number; "cursor"?: string; "providerId"?: string; "modelId"?: string; "applicationId"?: string; "environmentId"?: string; "traceId"?: string; "success"?: "true" | "false"; "from"?: string; "to"?: string; };
|
|
493
493
|
export type listTracesResponse___schema0 = string | number | boolean | null | Array<listTracesResponse___schema0> | { [key: string]: listTracesResponse___schema0; };
|
|
494
|
-
export type listTracesResponse = { "items": Array<{ "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: listTracesResponse___schema0 | null; "responsePayload"?: listTracesResponse___schema0 | null; "errorCode"?: string | null; }>; "nextCursor": string | null; };
|
|
494
|
+
export type listTracesResponse = { "items": Array<{ "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: listTracesResponse___schema0 | null; "responsePayload"?: listTracesResponse___schema0 | null; "errorCode"?: string | null; "statusCode"?: number | null; "retryable"?: boolean; "retryAfterMs"?: number; "diagnostics"?: { "memoryRunId"?: string; "memoryOperation"?: string; "parentRequestId"?: string; "parentTraceId"?: string; }; }>; "nextCursor": string | null; };
|
|
495
495
|
export type getLogResponse___schema0 = string | number | boolean | null | Array<getLogResponse___schema0> | { [key: string]: getLogResponse___schema0; };
|
|
496
|
-
export type getLogResponse = { "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: getLogResponse___schema0 | null; "responsePayload"?: getLogResponse___schema0 | null; "errorCode"?: string | null; };
|
|
496
|
+
export type getLogResponse = { "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: getLogResponse___schema0 | null; "responsePayload"?: getLogResponse___schema0 | null; "errorCode"?: string | null; "statusCode"?: number | null; "retryable"?: boolean; "retryAfterMs"?: number; "diagnostics"?: { "memoryRunId"?: string; "memoryOperation"?: string; "parentRequestId"?: string; "parentTraceId"?: string; }; };
|
|
497
497
|
export type getTraceResponse___schema0 = string | number | boolean | null | Array<getTraceResponse___schema0> | { [key: string]: getTraceResponse___schema0; };
|
|
498
|
-
export type getTraceResponse = { "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: getTraceResponse___schema0 | null; "responsePayload"?: getTraceResponse___schema0 | null; "errorCode"?: string | null; };
|
|
498
|
+
export type getTraceResponse = { "id": string; "requestId": string; "traceId": string | null; "executionType"?: string; "createdAt": string; "providerId": string | null; "modelId": string | null; "providerName": string | null; "modelName": string | null; "applicationId": string | null; "environmentId": string | null; "apiKeyId": string | null; "success": boolean; "latencyMs": number | null; "promptTokens": number | null; "completionTokens": number | null; "totalTokens": number | null; "estimatedCost": number | null; "cacheHit": boolean; "retryCount": number; "fallbackCount": number; "requestPayload"?: getTraceResponse___schema0 | null; "responsePayload"?: getTraceResponse___schema0 | null; "errorCode"?: string | null; "statusCode"?: number | null; "retryable"?: boolean; "retryAfterMs"?: number; "diagnostics"?: { "memoryRunId"?: string; "memoryOperation"?: string; "parentRequestId"?: string; "parentTraceId"?: string; }; };
|
|
499
499
|
export type gatewayOverviewResponse = string | number | boolean | null | Array<gatewayOverviewResponse> | { [key: string]: gatewayOverviewResponse; };
|
|
500
500
|
export type providerHealthResponse = string | number | boolean | null | Array<providerHealthResponse> | { [key: string]: providerHealthResponse; };
|
|
501
501
|
export type observabilityOverviewQuery = { "from"?: string; "to"?: string; };
|
|
@@ -589,15 +589,15 @@ export type listMemoryItemEvidenceResponse = { "items": Array<{ "id": string; "m
|
|
|
589
589
|
export type listMemoryItemRelationsQuery = { "limit"?: number; "cursor"?: string; };
|
|
590
590
|
export type listMemoryItemRelationsResponse = { "items": Array<{ "id": string; "fromMemoryId": string; "toMemoryId": string; "relationType": string; "confidence": number | null; "createdAt": string; }>; "nextCursor": string | null; };
|
|
591
591
|
export type listMemoryItemEmbeddingsQuery = { "limit"?: number; "cursor"?: string; };
|
|
592
|
-
export type listMemoryItemEmbeddingsResponse = { "items": Array<{ "id": string; "createdAt": string; "updatedAt": string; "memoryId": string; "modelId": string; "embeddingModel": string; "embeddingProvider": string; "dimensions": number; "vectorStoreConnectionId": string; "collection": string; "namespace": string | null; "vectorId": string; "contentHash": string; "status": string; "indexedAt": string | null; "staleAt": string | null; "errorCode": string | null; }>; "nextCursor": string | null; };
|
|
592
|
+
export type listMemoryItemEmbeddingsResponse = { "items": Array<{ "id": string; "createdAt": string; "updatedAt": string; "memoryId": string; "modelId": string; "embeddingModel": string; "embeddingProvider": string; "dimensions": number; "vectorStoreConnectionId": string; "collection": string; "namespace": string | null; "vectorId": string; "contentHash": string; "status": string; "indexedAt": string | null; "staleAt": string | null; "errorCode": string | null; "diagnosticReference": string | null; "diagnostics": { "stage": string; "memoryRunId"?: string; "gatewayRequestId"?: string; "requestId"?: string; "traceId"?: string; "providerCode"?: string; "providerStatus"?: number; "retryAfterMs"?: number; } | null; }>; "nextCursor": string | null; };
|
|
593
593
|
export type listMemoryItemEntitiesQuery = { "limit"?: number; "cursor"?: string; };
|
|
594
594
|
export type listMemoryItemEntitiesResponse = { "items": Array<{ "id": string; "memoryId": string; "entityId": string; "role": string; "confidence": number | null; "entity": { "id": string; "canonicalName": string; "entityType": string; "aliases": Array<string>; "externalId": string | null; }; }>; "nextCursor": string | null; };
|
|
595
595
|
export type getMemorySpaceProfileQuery = { "subjectType"?: string; "subjectId"?: string; };
|
|
596
596
|
export type getMemorySpaceProfileResponse___schema0 = string | number | boolean | null | Array<getMemorySpaceProfileResponse___schema0> | { [key: string]: getMemorySpaceProfileResponse___schema0; };
|
|
597
597
|
export type getMemorySpaceProfileResponse = { "id": string; "createdAt": string; "updatedAt": string; "memorySpaceId": string; "subjectType": string; "subjectId": string; "summary": string | null; "attributes": getMemorySpaceProfileResponse___schema0; "version": number; "generatedAt": string | null; "sourceRunId": string | null; };
|
|
598
598
|
export type listMemoryRunsQuery = { "limit"?: number; "cursor"?: string; "memorySpaceId"?: string; "runType"?: "episode_extraction" | "conversation_extraction" | "reconciliation" | "observation_generation" | "profile_generation" | "reindex" | "deletion" | "custom"; "status"?: "pending" | "running" | "completed" | "partial" | "failed" | "cancelled"; "createdAfter"?: string; "createdBefore"?: string; };
|
|
599
|
-
export type listMemoryRunsResponse = { "items": Array<{ "id": string; "createdAt": string; "updatedAt": string; "memorySpaceId": string; "runType": string; "status": string; "policyId": string | null; "model": string | null; "provider": string | null; "startedAt": string | null; "completedAt": string | null; "inputEpisodeCount": number; "candidateCount": number; "acceptedCount": number; "rejectedCount": number; "insertedCount": number; "mergedCount": number; "reinforcedCount": number; "supersededCount": number; "ignoredCount": number; "errorCode": string | null; }>; "nextCursor": string | null; };
|
|
600
|
-
export type getMemoryRunResponse = { "id": string; "createdAt": string; "updatedAt": string; "memorySpaceId": string; "runType": string; "status": string; "policyId": string | null; "model": string | null; "provider": string | null; "startedAt": string | null; "completedAt": string | null; "inputEpisodeCount": number; "candidateCount": number; "acceptedCount": number; "rejectedCount": number; "insertedCount": number; "mergedCount": number; "reinforcedCount": number; "supersededCount": number; "ignoredCount": number; "errorCode": string | null; };
|
|
599
|
+
export type listMemoryRunsResponse = { "items": Array<{ "id": string; "createdAt": string; "updatedAt": string; "memorySpaceId": string; "runType": string; "status": string; "policyId": string | null; "model": string | null; "provider": string | null; "startedAt": string | null; "completedAt": string | null; "inputEpisodeCount": number; "candidateCount": number; "acceptedCount": number; "rejectedCount": number; "insertedCount": number; "mergedCount": number; "reinforcedCount": number; "supersededCount": number; "ignoredCount": number; "errorCode": string | null; "diagnosticReference": string | null; "diagnostics": { "stage": string; "memoryRunId"?: string; "gatewayRequestId"?: string; "requestId"?: string; "traceId"?: string; "providerCode"?: string; "providerStatus"?: number; "retryAfterMs"?: number; } | null; }>; "nextCursor": string | null; };
|
|
600
|
+
export type getMemoryRunResponse = { "id": string; "createdAt": string; "updatedAt": string; "memorySpaceId": string; "runType": string; "status": string; "policyId": string | null; "model": string | null; "provider": string | null; "startedAt": string | null; "completedAt": string | null; "inputEpisodeCount": number; "candidateCount": number; "acceptedCount": number; "rejectedCount": number; "insertedCount": number; "mergedCount": number; "reinforcedCount": number; "supersededCount": number; "ignoredCount": number; "errorCode": string | null; "diagnosticReference": string | null; "diagnostics": { "stage": string; "memoryRunId"?: string; "gatewayRequestId"?: string; "requestId"?: string; "traceId"?: string; "providerCode"?: string; "providerStatus"?: number; "retryAfterMs"?: number; } | null; };
|
|
601
601
|
export interface Requests { "listProviders": undefined;
|
|
602
602
|
"getProvider": undefined;
|
|
603
603
|
"createProvider": createProviderRequest;
|
package/src/memory/types.ts
CHANGED
|
@@ -79,6 +79,10 @@ export interface MemorySearchFilters {
|
|
|
79
79
|
export interface MemorySearchRequest {
|
|
80
80
|
memorySpaceId: string;
|
|
81
81
|
query: string;
|
|
82
|
+
/** Default relevant: one bounded model check. Raw returns nearest neighbors without validation. */
|
|
83
|
+
relevance?: "relevant" | "raw";
|
|
84
|
+
/** Minimum normalized vector similarity (0–1), before ranking. Calibrate per embedding model. */
|
|
85
|
+
minScore?: number;
|
|
82
86
|
limit?: number;
|
|
83
87
|
filters?: MemorySearchFilters;
|
|
84
88
|
}
|
|
@@ -100,12 +104,19 @@ export type MemoryResult = Pick<
|
|
|
100
104
|
| "confidence"
|
|
101
105
|
>;
|
|
102
106
|
export interface MemorySearchResponse {
|
|
103
|
-
memories: Array<MemoryResult & { score: number }>;
|
|
104
|
-
|
|
105
|
-
export interface MemoryContextResponse {
|
|
106
|
-
memories: Array<MemoryResult & { score?: number }>;
|
|
107
|
+
memories: Array<MemoryResult & { score: number; similarityScore: number }>;
|
|
108
|
+
relevance: "relevant" | "raw";
|
|
107
109
|
}
|
|
110
|
+
export type MemoryContextResponse = MemorySearchResponse;
|
|
111
|
+
|
|
108
112
|
export interface MemoryIndexingResult {
|
|
113
|
+
/** Safe stage/provider diagnostics for partial indexing failures. */
|
|
114
|
+
diagnostics?: Array<{
|
|
115
|
+
code: string;
|
|
116
|
+
status: number;
|
|
117
|
+
retryable: boolean;
|
|
118
|
+
details?: Record<string, unknown>;
|
|
119
|
+
}>;
|
|
109
120
|
indexed: number;
|
|
110
121
|
failed: number;
|
|
111
122
|
}
|