@omg-dev/protocol 0.6.79 → 0.6.80

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.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared, runtime-free display rules for hosted `omg/<provider>/<model>` ids.
3
+ *
4
+ * The router id is the wire format and stays the value everywhere. This file
5
+ * owns how a picker SHOWS it: the provider it belongs to (for the mark) and a
6
+ * short human name ("DeepSeek V4 Flash" for omg/deepseek/deepseek-v4-flash-0731).
7
+ * The web composer and the native app import it by path so both surfaces
8
+ * agree byte-for-byte without waiting for a package release.
9
+ */
10
+ export type OmgModelInfo = {
11
+ /** The router id, unchanged. */
12
+ id: string;
13
+ /** Provider slug from the id, lower case: deepseek, z-ai, qwen, minimax, anthropic, openai. */
14
+ provider: string;
15
+ providerLabel: string;
16
+ /** Short human name of the model, without the provider path. */
17
+ label: string;
18
+ };
19
+ /** "deepseek-v4-flash-0731" -> "DeepSeek V4 Flash". Exported for tests. */
20
+ export declare function humanizeOmgModelName(name: string): string;
21
+ export declare function omgProviderLabel(provider: string): string;
22
+ /** Null for anything that is not a hosted `omg/<provider>/<model>` id. */
23
+ export declare function parseOmgModel(id: string | null | undefined): OmgModelInfo | null;
24
+ /** The short name for a picker row or pill; other agents' ids pass through. */
25
+ export declare function omgModelLabel(id: string | null | undefined): string;
26
+ /** Lower-case text a filter box should match: the id and the short name. */
27
+ export declare function omgModelSearchText(id: string): string;
28
+ //# sourceMappingURL=omg-model-display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omg-model-display.d.ts","sourceRoot":"","sources":["../src/omg-model-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,+FAA+F;IAC/F,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsCF,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBzD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,CAWhF;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEnE;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGrD"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Shared, runtime-free display rules for hosted `omg/<provider>/<model>` ids.
3
+ *
4
+ * The router id is the wire format and stays the value everywhere. This file
5
+ * owns how a picker SHOWS it: the provider it belongs to (for the mark) and a
6
+ * short human name ("DeepSeek V4 Flash" for omg/deepseek/deepseek-v4-flash-0731).
7
+ * The web composer and the native app import it by path so both surfaces
8
+ * agree byte-for-byte without waiting for a package release.
9
+ */
10
+ const PROVIDER_LABELS = {
11
+ deepseek: "DeepSeek",
12
+ "z-ai": "Z.ai",
13
+ qwen: "Qwen",
14
+ minimax: "MiniMax",
15
+ anthropic: "Anthropic",
16
+ openai: "OpenAI",
17
+ google: "Google",
18
+ xai: "xAI",
19
+ meta: "Meta",
20
+ mistral: "Mistral",
21
+ moonshot: "Moonshot",
22
+ };
23
+ /** Tokens whose brand casing is not "first letter up". */
24
+ const TOKEN_CASE = {
25
+ gpt: "GPT",
26
+ glm: "GLM",
27
+ deepseek: "DeepSeek",
28
+ minimax: "MiniMax",
29
+ xai: "xAI",
30
+ llama: "Llama",
31
+ };
32
+ /** Tokens that glue to the following version with a hyphen: "GPT-5.6". */
33
+ const HYPHEN_BEFORE_VERSION = new Set(["gpt"]);
34
+ function caseToken(token) {
35
+ const lower = token.toLowerCase();
36
+ if (TOKEN_CASE[lower])
37
+ return TOKEN_CASE[lower];
38
+ // v4, m3, r2: a letter and digits reads as a version mark.
39
+ if (/^[a-z]\d+(\.\d+)*$/.test(lower))
40
+ return lower.toUpperCase();
41
+ if (/^\d/.test(lower))
42
+ return lower;
43
+ return lower.charAt(0).toUpperCase() + lower.slice(1);
44
+ }
45
+ /** "deepseek-v4-flash-0731" -> "DeepSeek V4 Flash". Exported for tests. */
46
+ export function humanizeOmgModelName(name) {
47
+ const tokens = name.split("-").filter(Boolean);
48
+ // A trailing date stamp (0731, 20260731) is a snapshot tag, not a name.
49
+ if (tokens.length > 1 && /^\d{4}(\d{4})?$/.test(tokens[tokens.length - 1]))
50
+ tokens.pop();
51
+ let out = "";
52
+ tokens.forEach((token, index) => {
53
+ const cased = caseToken(token);
54
+ if (index === 0) {
55
+ out = cased;
56
+ return;
57
+ }
58
+ const previous = tokens[index - 1].toLowerCase();
59
+ const glue = HYPHEN_BEFORE_VERSION.has(previous) && /^\d/.test(token) ? "-" : " ";
60
+ out += glue + cased;
61
+ });
62
+ return out || name;
63
+ }
64
+ export function omgProviderLabel(provider) {
65
+ const key = provider.toLowerCase();
66
+ return PROVIDER_LABELS[key] ?? caseToken(key);
67
+ }
68
+ /** Null for anything that is not a hosted `omg/<provider>/<model>` id. */
69
+ export function parseOmgModel(id) {
70
+ if (!id)
71
+ return null;
72
+ const match = /^omg\/([^/]+)\/(.+)$/.exec(id.trim());
73
+ if (!match)
74
+ return null;
75
+ const provider = match[1].toLowerCase();
76
+ return {
77
+ id: id.trim(),
78
+ provider,
79
+ providerLabel: omgProviderLabel(provider),
80
+ label: humanizeOmgModelName(match[2]),
81
+ };
82
+ }
83
+ /** The short name for a picker row or pill; other agents' ids pass through. */
84
+ export function omgModelLabel(id) {
85
+ return parseOmgModel(id)?.label ?? (id ?? "");
86
+ }
87
+ /** Lower-case text a filter box should match: the id and the short name. */
88
+ export function omgModelSearchText(id) {
89
+ const info = parseOmgModel(id);
90
+ return (info ? `${id} ${info.providerLabel} ${info.label}` : id).toLowerCase();
91
+ }
92
+ //# sourceMappingURL=omg-model-display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omg-model-display.js","sourceRoot":"","sources":["../src/omg-model-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,MAAM,eAAe,GAA2B;IAC9C,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,UAAU,GAA2B;IACzC,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,0EAA0E;AAC1E,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAE/C,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAChD,2DAA2D;IAC3D,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACjE,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE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B;IACzD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE;QACb,QAAQ;QACR,aAAa,EAAE,gBAAgB,CAAC,QAAQ,CAAC;QACzC,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;KACvC,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,aAAa,CAAC,EAA6B;IACzD,OAAO,aAAa,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC3C,MAAM,IAAI,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACjF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omg-dev/protocol",
3
- "version": "0.6.79",
3
+ "version": "0.6.80",
4
4
  "description": "Typed public protocol for OMG sessions and live streams.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://omg.dev",