@opencxh/domain 1.264.0 → 1.264.4
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/dist/entities/ai-account/capabilities.d.ts +60 -0
- package/dist/entities/ai-account/capabilities.test.d.ts +1 -0
- package/dist/entities/ai-account/index.d.ts +1 -0
- package/dist/entities/ai-account/vendors.d.ts +7 -16
- package/dist/entities/memory/ingest.d.ts +1 -2
- package/dist/entities/memory/item.d.ts +0 -12
- package/dist/index.cjs +19 -19
- package/dist/index.js +1429 -1397
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an AI account can be the default for — one list, and everything else is derived from it.
|
|
3
|
+
*
|
|
4
|
+
* There were three, and they had to agree without anything enforcing it: `AiCapability`
|
|
5
|
+
* (llm/stt/tts/embedding) for the account flags, `AiVendorCapability`
|
|
6
|
+
* (chat/transcription/embedding) for what a vendor claims, and `UsageCapability` (the same three
|
|
7
|
+
* again) for the usage row. `llm` and `chat` were the same thing under two names, and `tts`
|
|
8
|
+
* existed in exactly one of the three. Adding a capability meant editing a fan-out of five
|
|
9
|
+
* places plus a form and a table, which is the drift this catalog exists to stop.
|
|
10
|
+
*
|
|
11
|
+
* `id` is the name used everywhere: the adapter key in `providers/registry`, the value of the
|
|
12
|
+
* `ai.capability` analytics dimension, and what a vendor declares. It is therefore part of the
|
|
13
|
+
* stored format — the usage rollup holds these strings — and must not be renamed casually.
|
|
14
|
+
*
|
|
15
|
+
* `defaultFlag` is the metadata key on the managed-account record. It keeps the older `Llm`/`Stt`
|
|
16
|
+
* spelling on purpose: those are stored keys, and renaming them buys nothing a reader needs.
|
|
17
|
+
*/
|
|
18
|
+
export interface AiCapabilityDefinition {
|
|
19
|
+
id: string;
|
|
20
|
+
/** Metadata key on the account record that marks it as the default for this capability. */
|
|
21
|
+
defaultFlag: string;
|
|
22
|
+
/** Column and checkbox label in the accounts screen. */
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const AI_CAPABILITIES: readonly [{
|
|
26
|
+
readonly id: "chat";
|
|
27
|
+
readonly defaultFlag: "isDefaultLlm";
|
|
28
|
+
readonly label: "LLM";
|
|
29
|
+
}, {
|
|
30
|
+
readonly id: "transcription";
|
|
31
|
+
readonly defaultFlag: "isDefaultStt";
|
|
32
|
+
readonly label: "STT";
|
|
33
|
+
}, {
|
|
34
|
+
readonly id: "tts";
|
|
35
|
+
readonly defaultFlag: "isDefaultTts";
|
|
36
|
+
readonly label: "TTS";
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: "embedding";
|
|
39
|
+
readonly defaultFlag: "isDefaultEmbedding";
|
|
40
|
+
readonly label: "Embeddings";
|
|
41
|
+
}];
|
|
42
|
+
/** What an account can be the default for, and what a vendor can claim. One vocabulary. */
|
|
43
|
+
export type AiCapability = (typeof AI_CAPABILITIES)[number]["id"];
|
|
44
|
+
/** The metadata keys, as a union — so a flags object can be typed rather than indexed. */
|
|
45
|
+
export type AiDefaultFlag = (typeof AI_CAPABILITIES)[number]["defaultFlag"];
|
|
46
|
+
/** `{ isDefaultLlm: boolean, … }`, derived. Adding a capability adds its field here too. */
|
|
47
|
+
export type AiDefaultFlags = {
|
|
48
|
+
[K in AiDefaultFlag]: boolean;
|
|
49
|
+
};
|
|
50
|
+
export declare function capabilityDefaultFlag(capability: AiCapability): AiDefaultFlag;
|
|
51
|
+
/** Read the flags off a stored metadata bag, in one place instead of four literal lines. */
|
|
52
|
+
export declare function readDefaultFlags(meta: Record<string, unknown> | undefined): AiDefaultFlags;
|
|
53
|
+
/**
|
|
54
|
+
* `patch ?? current` per flag, for a partial update.
|
|
55
|
+
*
|
|
56
|
+
* A plain spread cannot do this: an absent key in the patch arrives as `undefined` and would
|
|
57
|
+
* overwrite the stored value with "not the default" — the difference between "leave it alone"
|
|
58
|
+
* and "turn it off".
|
|
59
|
+
*/
|
|
60
|
+
export declare function mergeDefaultFlags(patch: Partial<AiDefaultFlags> | undefined, current: Partial<AiDefaultFlags> | undefined): AiDefaultFlags;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
+
import { AiCapability } from './capabilities';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* One source for both the UI (account form, table labels) and the server (default model, API
|
|
5
|
-
* host). Those lists used to be separate and drifted apart — the UI named vendors no adapter
|
|
6
|
-
* existed for.
|
|
7
|
-
*
|
|
8
|
-
* This catalog describes *what* a vendor is. *How* you talk to it (which adapter class, which
|
|
9
|
-
* model filter) lives server-side in `providers/registry`, which answers to this list: a vendor
|
|
10
|
-
* claiming `"chat"` here without a chat adapter there is a test failure.
|
|
11
|
-
*
|
|
12
|
-
* `id` is what ends up in `AiAccount.vendor`, so that string is part of the storage format and
|
|
13
|
-
* must not be renamed casually.
|
|
3
|
+
* What a vendor can do. Was its own union of three; it is the same vocabulary the account
|
|
4
|
+
* defaults and the usage rows use, so it now names {@link AiCapability} instead of repeating it.
|
|
14
5
|
*/
|
|
15
|
-
export type AiVendorCapability =
|
|
6
|
+
export type AiVendorCapability = AiCapability;
|
|
16
7
|
export interface AiVendor {
|
|
17
8
|
id: string;
|
|
18
9
|
label: string;
|
|
@@ -28,9 +19,9 @@ export interface AiVendor {
|
|
|
28
19
|
/**
|
|
29
20
|
* Which attachment kinds this vendor accepts directly.
|
|
30
21
|
*
|
|
31
|
-
* Deliberately not a value in `capabilities`:
|
|
32
|
-
*
|
|
33
|
-
*
|
|
22
|
+
* Deliberately not a value in `capabilities`: that list is the capability catalog, and an
|
|
23
|
+
* adapter either exists for an entry or `findAdapterGaps()` says so. "Accepts images" is a
|
|
24
|
+
* property of a vendor, not something you build an adapter for.
|
|
34
25
|
*
|
|
35
26
|
* Absent or empty = text only. The right default for the Chat Completions vendors: they share one
|
|
36
27
|
* adapter but not one set of capabilities, and a guess yields a 400 mid-conversation.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MemoryKindId,
|
|
1
|
+
import { MemoryKindId, MemorySubjectKey } from './item';
|
|
2
2
|
/**
|
|
3
3
|
* Writing is a **CAS upsert**, not a snapshot replace like analytics.
|
|
4
4
|
*
|
|
@@ -28,7 +28,6 @@ export interface MemoryUpsertRequest {
|
|
|
28
28
|
/** Omit it: the hub extracts keywords from title + body itself (one tokenizer, write and read). */
|
|
29
29
|
keywords?: string[];
|
|
30
30
|
tags?: string[];
|
|
31
|
-
links?: MemoryLink[];
|
|
32
31
|
}
|
|
33
32
|
export type MemoryUpsertRejection = "stale-version" | "stale-watermark" | "unknown-kind" | "kind-disabled" | "subject-kind-mismatch" | "not-owner";
|
|
34
33
|
export interface MemoryUpsertResult {
|
|
@@ -9,17 +9,6 @@
|
|
|
9
9
|
export type MemorySubjectKey = string;
|
|
10
10
|
/** `comms.resolution` (app-declared) or `sales_besluitvormer` (org-owned). */
|
|
11
11
|
export type MemoryKindId = string;
|
|
12
|
-
/**
|
|
13
|
-
* A reference to something else — internal (`interaction:i_2`) or external (`hubspot:5591`,
|
|
14
|
-
* `clickup:86ab2`).
|
|
15
|
-
*
|
|
16
|
-
* A **list**, never an object keyed by the relation: **the same `rel` may occur twice** — two
|
|
17
|
-
* linked companies, three involved interactions — and a map would throw one away.
|
|
18
|
-
*/
|
|
19
|
-
export interface MemoryLink {
|
|
20
|
-
rel: string;
|
|
21
|
-
target: string;
|
|
22
|
-
}
|
|
23
12
|
/** Hard limit on the body. Memory is a summary; it is not a shadow copy of a mailbox. */
|
|
24
13
|
export declare const MAX_MEMORY_CHARS = 2000;
|
|
25
14
|
export interface MemoryItem {
|
|
@@ -91,7 +80,6 @@ export interface MemoryItem {
|
|
|
91
80
|
keywords?: string[];
|
|
92
81
|
/** Fast alternative keys, e.g. `tel:+31612345678` for the moment the phone rings. */
|
|
93
82
|
tags?: string[];
|
|
94
|
-
links?: MemoryLink[];
|
|
95
83
|
/** Model the vector was made with; retrieval only compares within the same model. */
|
|
96
84
|
embeddingModel?: string;
|
|
97
85
|
/** From a live pull (phase 3); never persisted. */
|