@undefineds.co/models 0.2.0 → 0.2.2

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.
Files changed (241) hide show
  1. package/README.md +515 -125
  2. package/dist/agent.repository.d.ts +20 -40
  3. package/dist/agent.schema.d.ts +20 -1
  4. package/dist/agent.schema.js +25 -1
  5. package/dist/ai-config/index.d.ts +8 -6
  6. package/dist/ai-config/index.js +41 -23
  7. package/dist/ai-model.schema.d.ts +13 -1
  8. package/dist/ai-model.schema.js +17 -1
  9. package/dist/ai-provider.schema.d.ts +9 -1
  10. package/dist/ai-provider.schema.js +13 -1
  11. package/dist/approval.schema.d.ts +21 -1
  12. package/dist/approval.schema.js +33 -1
  13. package/dist/audit.schema.d.ts +17 -1
  14. package/dist/audit.schema.js +29 -1
  15. package/dist/chat.repository.d.ts +19 -15
  16. package/dist/chat.schema.d.ts +37 -1
  17. package/dist/chat.schema.js +47 -1
  18. package/dist/client/index.d.ts +121 -0
  19. package/dist/client/index.js +299 -0
  20. package/dist/contact.repository.d.ts +21 -21
  21. package/dist/contact.schema.d.ts +48 -1
  22. package/dist/contact.schema.js +60 -1
  23. package/dist/credential.schema.d.ts +15 -1
  24. package/dist/credential.schema.js +19 -1
  25. package/dist/discovery/index.d.ts +2 -2
  26. package/dist/discovery/index.js +2 -2
  27. package/dist/extension/extension.schema.d.ts +4 -1
  28. package/dist/extension/extension.schema.js +11 -1
  29. package/dist/extension/index.d.ts +1 -1
  30. package/dist/favorite/favorite.schema.d.ts +24 -1
  31. package/dist/favorite/favorite.schema.js +34 -1
  32. package/dist/favorite/index.d.ts +2 -2
  33. package/dist/file/file.schema.d.ts +39 -1
  34. package/dist/file/file.schema.js +51 -1
  35. package/dist/file/index.d.ts +1 -1
  36. package/dist/fixtures/contracts-chat-contact.d.ts +8 -8
  37. package/dist/fixtures/contracts-chat-contact.js +5 -9
  38. package/dist/grant.schema.d.ts +16 -1
  39. package/dist/grant.schema.js +29 -1
  40. package/dist/import/index.d.ts +1 -1
  41. package/dist/inbox-notification.schema.d.ts +9 -1
  42. package/dist/inbox-notification.schema.js +16 -1
  43. package/dist/index.d.ts +42 -43
  44. package/dist/index.js +27 -26
  45. package/dist/knowledge/index.d.ts +1 -1
  46. package/dist/knowledge/knowledge-folder.schema.d.ts +7 -1
  47. package/dist/knowledge/knowledge-folder.schema.js +6 -1
  48. package/dist/message.repository.d.ts +20 -20
  49. package/dist/message.schema.d.ts +32 -1
  50. package/dist/message.schema.js +47 -1
  51. package/dist/namespaces.d.ts +178 -1
  52. package/dist/namespaces.js +253 -1
  53. package/dist/profile.d.ts +22 -1
  54. package/dist/profile.js +88 -1
  55. package/dist/profile.repository.d.ts +105 -0
  56. package/dist/profile.repository.js +47 -0
  57. package/dist/profile.schema.d.ts +16 -0
  58. package/dist/{core/profile.js → profile.schema.js} +4 -4
  59. package/dist/repository.d.ts +49 -9
  60. package/dist/repository.js +49 -46
  61. package/dist/schema.d.ts +244 -1
  62. package/dist/schema.js +37 -1
  63. package/dist/session/index.d.ts +1 -1
  64. package/dist/session/index.js +1 -1
  65. package/dist/session/session.schema.d.ts +43 -1
  66. package/dist/session/session.schema.js +46 -1
  67. package/dist/session.repository.d.ts +61 -0
  68. package/dist/session.repository.js +8 -0
  69. package/dist/settings/index.d.ts +1 -1
  70. package/dist/settings/settings.schema.d.ts +49 -1
  71. package/dist/settings/settings.schema.js +63 -1
  72. package/dist/{governance/runtime-projections.d.ts → sidecar/persistence-mapping.d.ts} +7 -7
  73. package/dist/{governance/runtime-projections.js → sidecar/persistence-mapping.js} +7 -1
  74. package/dist/{protocols/runtime-events.d.ts → sidecar/sidecar-events.d.ts} +35 -35
  75. package/dist/{protocols/runtime-events.js → sidecar/sidecar-events.js} +21 -4
  76. package/dist/thread.repository.d.ts +15 -19
  77. package/dist/thread.schema.d.ts +30 -1
  78. package/dist/thread.schema.js +39 -1
  79. package/dist/{core/types/collaboration-rich-content.d.ts → types/collaboration-blocks.d.ts} +7 -7
  80. package/dist/types/collaboration-blocks.js +7 -0
  81. package/dist/types/message-block.d.ts +270 -0
  82. package/dist/types/message-block.js +125 -0
  83. package/dist/vocab/_namespaces.d.ts +1 -1
  84. package/dist/vocab/index.d.ts +5 -6
  85. package/dist/vocab/index.js +0 -1
  86. package/dist/vocab/message.vocab.js +1 -1
  87. package/dist/vocab/thread.vocab.d.ts +1 -2
  88. package/dist/vocab/thread.vocab.js +2 -3
  89. package/dist/watch/index.d.ts +226 -0
  90. package/dist/watch/index.js +1156 -0
  91. package/package.json +41 -39
  92. package/dist/_drizzle-solid/columns.d.ts +0 -37
  93. package/dist/_drizzle-solid/columns.js +0 -1
  94. package/dist/_drizzle-solid/pod-table.d.ts +0 -3
  95. package/dist/_drizzle-solid/pod-table.js +0 -1
  96. package/dist/_drizzle-solid/types.d.ts +0 -40
  97. package/dist/_drizzle-solid/types.js +0 -1
  98. package/dist/ai-config.d.ts +0 -1
  99. package/dist/ai-config.js +0 -1
  100. package/dist/chat.utils.d.ts +0 -3
  101. package/dist/chat.utils.js +0 -30
  102. package/dist/core/agent-provider.schema.d.ts +0 -1
  103. package/dist/core/agent-provider.schema.js +0 -1
  104. package/dist/core/agent-status.schema.d.ts +0 -12
  105. package/dist/core/agent-status.schema.js +0 -18
  106. package/dist/core/agent.schema.d.ts +0 -72
  107. package/dist/core/agent.schema.js +0 -38
  108. package/dist/core/ai-config.schema.d.ts +0 -11
  109. package/dist/core/ai-config.schema.js +0 -18
  110. package/dist/core/ai-model.schema.d.ts +0 -15
  111. package/dist/core/ai-model.schema.js +0 -21
  112. package/dist/core/ai-provider.schema.d.ts +0 -16
  113. package/dist/core/ai-provider.schema.js +0 -28
  114. package/dist/core/approval.schema.d.ts +0 -21
  115. package/dist/core/approval.schema.js +0 -33
  116. package/dist/core/audit.schema.d.ts +0 -17
  117. package/dist/core/audit.schema.js +0 -29
  118. package/dist/core/chat.schema.d.ts +0 -36
  119. package/dist/core/chat.schema.js +0 -45
  120. package/dist/core/contact.schema.d.ts +0 -47
  121. package/dist/core/contact.schema.js +0 -59
  122. package/dist/core/credential.schema.d.ts +0 -56
  123. package/dist/core/credential.schema.js +0 -40
  124. package/dist/core/extension/extension.schema.d.ts +0 -4
  125. package/dist/core/extension/extension.schema.js +0 -11
  126. package/dist/core/extension/index.d.ts +0 -1
  127. package/dist/core/extension/index.js +0 -1
  128. package/dist/core/extension.d.ts +0 -1
  129. package/dist/core/extension.js +0 -1
  130. package/dist/core/favorite/favorite.schema.d.ts +0 -24
  131. package/dist/core/favorite/favorite.schema.js +0 -34
  132. package/dist/core/favorite/index.d.ts +0 -1
  133. package/dist/core/favorite/index.js +0 -1
  134. package/dist/core/file/file.schema.d.ts +0 -39
  135. package/dist/core/file/file.schema.js +0 -51
  136. package/dist/core/file/index.d.ts +0 -1
  137. package/dist/core/file/index.js +0 -1
  138. package/dist/core/file.d.ts +0 -1
  139. package/dist/core/file.js +0 -1
  140. package/dist/core/grant.schema.d.ts +0 -16
  141. package/dist/core/grant.schema.js +0 -29
  142. package/dist/core/import/import-job.schema.d.ts +0 -5
  143. package/dist/core/import/import-job.schema.js +0 -5
  144. package/dist/core/import/index.d.ts +0 -1
  145. package/dist/core/import/index.js +0 -1
  146. package/dist/core/import.d.ts +0 -1
  147. package/dist/core/import.js +0 -1
  148. package/dist/core/inbox-notification.schema.d.ts +0 -9
  149. package/dist/core/inbox-notification.schema.js +0 -16
  150. package/dist/core/index.d.ts +0 -31
  151. package/dist/core/index.js +0 -32
  152. package/dist/core/knowledge/index.d.ts +0 -1
  153. package/dist/core/knowledge/index.js +0 -1
  154. package/dist/core/knowledge/knowledge-folder.schema.d.ts +0 -7
  155. package/dist/core/knowledge/knowledge-folder.schema.js +0 -6
  156. package/dist/core/knowledge.d.ts +0 -1
  157. package/dist/core/knowledge.js +0 -1
  158. package/dist/core/message.schema.d.ts +0 -33
  159. package/dist/core/message.schema.js +0 -49
  160. package/dist/core/namespaces.d.ts +0 -176
  161. package/dist/core/namespaces.js +0 -289
  162. package/dist/core/profile.d.ts +0 -16
  163. package/dist/core/schema.d.ts +0 -304
  164. package/dist/core/schema.js +0 -46
  165. package/dist/core/session/index.d.ts +0 -1
  166. package/dist/core/session/index.js +0 -1
  167. package/dist/core/session/session.schema.d.ts +0 -6
  168. package/dist/core/session/session.schema.js +0 -6
  169. package/dist/core/session.d.ts +0 -1
  170. package/dist/core/session.js +0 -1
  171. package/dist/core/settings/index.d.ts +0 -1
  172. package/dist/core/settings/index.js +0 -1
  173. package/dist/core/settings/settings.schema.d.ts +0 -49
  174. package/dist/core/settings/settings.schema.js +0 -63
  175. package/dist/core/settings.d.ts +0 -1
  176. package/dist/core/settings.js +0 -1
  177. package/dist/core/thread.schema.d.ts +0 -28
  178. package/dist/core/thread.schema.js +0 -36
  179. package/dist/core/types/collaboration-rich-content.js +0 -7
  180. package/dist/core/types/message-rich-content.d.ts +0 -121
  181. package/dist/core/types/message-rich-content.js +0 -85
  182. package/dist/core/vector-store.schema.d.ts +0 -25
  183. package/dist/core/vector-store.schema.js +0 -35
  184. package/dist/core/vocab/_namespaces.d.ts +0 -1
  185. package/dist/core/vocab/_namespaces.js +0 -3
  186. package/dist/core/vocab/chat.vocab.d.ts +0 -16
  187. package/dist/core/vocab/chat.vocab.js +0 -22
  188. package/dist/core/vocab/contact.vocab.d.ts +0 -21
  189. package/dist/core/vocab/contact.vocab.js +0 -22
  190. package/dist/core/vocab/index.d.ts +0 -6
  191. package/dist/core/vocab/index.js +0 -6
  192. package/dist/core/vocab/message.vocab.d.ts +0 -20
  193. package/dist/core/vocab/message.vocab.js +0 -24
  194. package/dist/core/vocab/thread.vocab.d.ts +0 -11
  195. package/dist/core/vocab/thread.vocab.js +0 -14
  196. package/dist/core/vocab/workspace.vocab.d.ts +0 -12
  197. package/dist/core/vocab/workspace.vocab.js +0 -13
  198. package/dist/core/vocab.d.ts +0 -1
  199. package/dist/core/vocab.js +0 -1
  200. package/dist/core/workspace.schema.d.ts +0 -35
  201. package/dist/core/workspace.schema.js +0 -106
  202. package/dist/core.d.ts +0 -1
  203. package/dist/core.js +0 -1
  204. package/dist/discovery/vercel.d.ts +0 -25
  205. package/dist/discovery/vercel.js +0 -95
  206. package/dist/discovery.d.ts +0 -1
  207. package/dist/discovery.js +0 -1
  208. package/dist/extension.d.ts +0 -1
  209. package/dist/extension.js +0 -1
  210. package/dist/favorite.d.ts +0 -1
  211. package/dist/favorite.js +0 -1
  212. package/dist/file.d.ts +0 -1
  213. package/dist/file.js +0 -1
  214. package/dist/governance/index.d.ts +0 -1
  215. package/dist/governance/index.js +0 -1
  216. package/dist/import.d.ts +0 -1
  217. package/dist/import.js +0 -1
  218. package/dist/knowledge.d.ts +0 -1
  219. package/dist/knowledge.js +0 -1
  220. package/dist/protocols/index.d.ts +0 -1
  221. package/dist/protocols/index.js +0 -1
  222. package/dist/session.d.ts +0 -1
  223. package/dist/session.js +0 -1
  224. package/dist/settings.d.ts +0 -1
  225. package/dist/settings.js +0 -1
  226. package/dist/types/collaboration-rich-content.d.ts +0 -52
  227. package/dist/types/collaboration-rich-content.js +0 -7
  228. package/dist/types/message-rich-content.d.ts +0 -121
  229. package/dist/types/message-rich-content.js +0 -85
  230. package/dist/vocab/governance.vocab.d.ts +0 -46
  231. package/dist/vocab/governance.vocab.js +0 -47
  232. package/dist/vocab/workspace.vocab.d.ts +0 -12
  233. package/dist/vocab/workspace.vocab.js +0 -13
  234. package/dist/vocab.d.ts +0 -1
  235. package/dist/vocab.js +0 -1
  236. package/dist/workspace.repository.d.ts +0 -45
  237. package/dist/workspace.repository.js +0 -8
  238. package/dist/workspace.schema.d.ts +0 -1
  239. package/dist/workspace.schema.js +0 -1
  240. /package/dist/{core/vocab/governance.vocab.d.ts → vocab/sidecar.vocab.d.ts} +0 -0
  241. /package/dist/{core/vocab/governance.vocab.js → vocab/sidecar.vocab.js} +0 -0
@@ -1,106 +0,0 @@
1
- import { id, podTable, string, timestamp, uri } from '@undefineds.co/drizzle-solid';
2
- import { UDFS, DCTerms } from './namespaces.js';
3
- export const WORKSPACE_TYPES = ['pod', 'local'];
4
- export const WORKSPACE_KINDS = ['folder', 'git', 'worktree'];
5
- const URI_WITH_SLASHES = /^[a-zA-Z][a-zA-Z\d+.-]*:\/\//;
6
- const WINDOWS_PATH_PREFIX = /^[a-zA-Z]:[\\/]/;
7
- /**
8
- * Workspace schema.
9
- *
10
- * Only Pod-backed workspace metadata is persisted here.
11
- * Local workspaces are addressed directly via `linx://{node-id}/path/to/root`.
12
- */
13
- export const workspaceTable = podTable('workspace', {
14
- id: id('id'),
15
- title: string('title').predicate(DCTerms.title),
16
- workspaceType: string('workspaceType').predicate(UDFS.workspaceType).notNull().default('pod'),
17
- kind: string('kind').predicate(UDFS.workspaceKind).notNull().default('folder'),
18
- rootUri: uri('rootUri').predicate(UDFS.rootUri),
19
- repoRootUri: uri('repoRootUri').predicate(UDFS.repoRootUri),
20
- baseRef: string('baseRef').predicate(UDFS.baseRef),
21
- branch: string('branch').predicate(UDFS.branch),
22
- createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
23
- updatedAt: timestamp('updatedAt').predicate(DCTerms.modified).notNull().defaultNow(),
24
- }, {
25
- base: '/.data/workspaces/',
26
- sparqlEndpoint: '/.data/workspaces/-/sparql',
27
- type: UDFS.Workspace,
28
- namespace: UDFS,
29
- subjectTemplate: '{id}/index.ttl#this',
30
- });
31
- export function getWorkspaceContainerPath(workspaceId) {
32
- return `/.data/workspaces/${workspaceId}/`;
33
- }
34
- export function resolveWorkspaceContainerUri(podBaseUrl, workspaceId) {
35
- return `${podBaseUrl.replace(/\/$/, '')}${getWorkspaceContainerPath(workspaceId)}`;
36
- }
37
- export function parseWorkspaceIdFromContainerUri(workspaceUri) {
38
- if (!workspaceUri)
39
- return null;
40
- const match = workspaceUri.match(/\/\.data\/workspaces\/([^/]+)\/?$/);
41
- return match?.[1] ?? null;
42
- }
43
- export function normalizeLocalWorkspacePath(value) {
44
- const trimmed = value?.trim();
45
- if (!trimmed)
46
- return undefined;
47
- if (trimmed.startsWith('file://')) {
48
- try {
49
- const url = new URL(trimmed);
50
- const normalized = decodeURIComponent(url.pathname || '').replace(/\/{2,}/g, '/');
51
- return normalized.length > 1 ? normalized.replace(/\/$/, '') : normalized;
52
- }
53
- catch {
54
- return trimmed;
55
- }
56
- }
57
- if (trimmed.startsWith('linx://')) {
58
- return parseLocalWorkspaceUri(trimmed)?.path;
59
- }
60
- if (URI_WITH_SLASHES.test(trimmed)) {
61
- return trimmed;
62
- }
63
- if (WINDOWS_PATH_PREFIX.test(trimmed)) {
64
- return `/${trimmed.replace(/\\/g, '/')}`.replace(/\/{2,}/g, '/');
65
- }
66
- const normalized = trimmed.replace(/\\/g, '/').replace(/\/{2,}/g, '/');
67
- if (normalized.startsWith('/')) {
68
- return normalized.length > 1 ? normalized.replace(/\/$/, '') : normalized;
69
- }
70
- return `/${normalized.replace(/^\/+/, '')}`.replace(/\/$/, '');
71
- }
72
- export function buildLocalWorkspaceUri(nodeId, rootPath) {
73
- const normalizedNodeId = nodeId.trim();
74
- const normalizedPath = normalizeLocalWorkspacePath(rootPath);
75
- if (!normalizedNodeId) {
76
- throw new Error('nodeId is required for local workspace URIs.');
77
- }
78
- if (!normalizedPath) {
79
- throw new Error('rootPath is required for local workspace URIs.');
80
- }
81
- const encodedPath = normalizedPath
82
- .split('/')
83
- .filter(Boolean)
84
- .map((segment) => encodeURIComponent(segment))
85
- .join('/');
86
- return `linx://${encodeURIComponent(normalizedNodeId)}/${encodedPath}`;
87
- }
88
- export function isLocalWorkspaceUri(workspaceUri) {
89
- return typeof workspaceUri === 'string' && workspaceUri.startsWith('linx://');
90
- }
91
- export function parseLocalWorkspaceUri(workspaceUri) {
92
- if (!workspaceUri || !isLocalWorkspaceUri(workspaceUri))
93
- return null;
94
- try {
95
- const url = new URL(workspaceUri);
96
- const nodeId = decodeURIComponent(url.host);
97
- const path = decodeURIComponent(url.pathname || '').replace(/\/{2,}/g, '/');
98
- return {
99
- nodeId,
100
- path: path.length > 1 ? path.replace(/\/$/, '') : path,
101
- };
102
- }
103
- catch {
104
- return null;
105
- }
106
- }
package/dist/core.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './core/index.js';
package/dist/core.js DELETED
@@ -1 +0,0 @@
1
- export * from './core/index.js';
@@ -1,25 +0,0 @@
1
- import type { DiscoveryRegistry, ModelMetadata } from './types.js';
2
- export interface VercelModelPricing {
3
- input?: string;
4
- output?: string;
5
- }
6
- export interface VercelModelEntry {
7
- id: string;
8
- name?: string;
9
- description?: string;
10
- owned_by?: string;
11
- context_window?: number;
12
- max_tokens?: number;
13
- type?: string;
14
- tags?: string[];
15
- pricing?: VercelModelPricing;
16
- }
17
- export interface VercelModelCatalogResponse {
18
- object?: string;
19
- data?: VercelModelEntry[];
20
- }
21
- export declare const VERCEL_OWNER_PROVIDER_MAP: Record<string, string>;
22
- export declare function mapVercelOwnerToProviderId(owner?: string | null): string;
23
- export declare function normalizeVercelModelEntry(entry: VercelModelEntry, defaultModelIds?: Readonly<Record<string, string>>): ModelMetadata | null;
24
- export declare function mergeVercelModelsIntoDiscovery(currentModels: readonly ModelMetadata[], upstreamModels: readonly VercelModelEntry[], defaultModelIds?: Readonly<Record<string, string>>): ModelMetadata[];
25
- export declare function updateDiscoveryModelRegistry(currentRegistry: DiscoveryRegistry, upstreamCatalog: VercelModelCatalogResponse, updatedAt: string, defaultModelIds?: Readonly<Record<string, string>>): DiscoveryRegistry;
@@ -1,95 +0,0 @@
1
- export const VERCEL_OWNER_PROVIDER_MAP = {
2
- alibaba: 'qwen',
3
- anthropic: 'anthropic',
4
- deepseek: 'deepseek',
5
- google: 'google',
6
- minimax: 'minimax',
7
- mistral: 'mistral',
8
- moonshotai: 'moonshot',
9
- openai: 'openai',
10
- togetherai: 'together',
11
- xai: 'x-ai',
12
- zai: 'zhipu',
13
- };
14
- const DEFAULT_SYNCED_MODEL_TYPES = new Set(['language']);
15
- function toNumber(value) {
16
- if (typeof value !== 'string')
17
- return undefined;
18
- const parsed = Number(value);
19
- return Number.isFinite(parsed) ? parsed : undefined;
20
- }
21
- function normalizeCapabilities(entry) {
22
- const capabilities = new Set();
23
- const tags = new Set(entry.tags ?? []);
24
- if (entry.type === 'language') {
25
- capabilities.add('chat');
26
- }
27
- if (tags.has('vision') || tags.has('file-input')) {
28
- capabilities.add('vision');
29
- }
30
- if (tags.has('tool-use')) {
31
- capabilities.add('function-calling');
32
- }
33
- if (entry.type === 'language') {
34
- capabilities.add('streaming');
35
- }
36
- return Array.from(capabilities);
37
- }
38
- function compareModels(left, right) {
39
- if (left.provider !== right.provider) {
40
- return left.provider.localeCompare(right.provider);
41
- }
42
- if (Boolean(left.isDefault) !== Boolean(right.isDefault)) {
43
- return left.isDefault ? -1 : 1;
44
- }
45
- return left.id.localeCompare(right.id);
46
- }
47
- export function mapVercelOwnerToProviderId(owner) {
48
- if (!owner)
49
- return '';
50
- return VERCEL_OWNER_PROVIDER_MAP[owner] ?? '';
51
- }
52
- export function normalizeVercelModelEntry(entry, defaultModelIds = {}) {
53
- const provider = mapVercelOwnerToProviderId(entry.owned_by);
54
- if (!provider)
55
- return null;
56
- if (!entry.id || !DEFAULT_SYNCED_MODEL_TYPES.has(String(entry.type ?? 'language'))) {
57
- return null;
58
- }
59
- return {
60
- id: entry.id,
61
- provider,
62
- displayName: entry.name || entry.id,
63
- description: entry.description,
64
- contextLength: typeof entry.context_window === 'number' ? entry.context_window : undefined,
65
- maxOutputTokens: typeof entry.max_tokens === 'number' ? entry.max_tokens : undefined,
66
- capabilities: normalizeCapabilities(entry),
67
- pricing: {
68
- input: toNumber(entry.pricing?.input) ?? 0,
69
- output: toNumber(entry.pricing?.output) ?? 0,
70
- },
71
- isDefault: defaultModelIds[provider] === entry.id || undefined,
72
- };
73
- }
74
- export function mergeVercelModelsIntoDiscovery(currentModels, upstreamModels, defaultModelIds = {}) {
75
- const syncedProviderIds = new Set(upstreamModels
76
- .map((entry) => mapVercelOwnerToProviderId(entry.owned_by))
77
- .filter(Boolean));
78
- const preservedModels = currentModels.filter((model) => !syncedProviderIds.has(model.provider));
79
- const normalizedModels = upstreamModels
80
- .map((entry) => normalizeVercelModelEntry(entry, defaultModelIds))
81
- .filter((model) => Boolean(model));
82
- const deduped = new Map();
83
- for (const model of [...preservedModels, ...normalizedModels]) {
84
- deduped.set(`${model.provider}:${model.id}`, model);
85
- }
86
- return Array.from(deduped.values()).sort(compareModels);
87
- }
88
- export function updateDiscoveryModelRegistry(currentRegistry, upstreamCatalog, updatedAt, defaultModelIds = {}) {
89
- const upstreamModels = Array.isArray(upstreamCatalog.data) ? upstreamCatalog.data : [];
90
- return {
91
- ...currentRegistry,
92
- updatedAt,
93
- models: mergeVercelModelsIntoDiscovery(currentRegistry.models ?? [], upstreamModels, defaultModelIds),
94
- };
95
- }
@@ -1 +0,0 @@
1
- export * from './discovery/index.js';
package/dist/discovery.js DELETED
@@ -1 +0,0 @@
1
- export * from './discovery/index.js';
@@ -1 +0,0 @@
1
- export * from './extension/index.js';
package/dist/extension.js DELETED
@@ -1 +0,0 @@
1
- export * from './extension/index.js';
@@ -1 +0,0 @@
1
- export * from './favorite/index.js';
package/dist/favorite.js DELETED
@@ -1 +0,0 @@
1
- export * from './favorite/index.js';
package/dist/file.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './file/index.js';
package/dist/file.js DELETED
@@ -1 +0,0 @@
1
- export * from './file/index.js';
@@ -1 +0,0 @@
1
- export * from './runtime-projections.js';
@@ -1 +0,0 @@
1
- export * from './runtime-projections.js';
package/dist/import.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './import/index.js';
package/dist/import.js DELETED
@@ -1 +0,0 @@
1
- export * from './import/index.js';
@@ -1 +0,0 @@
1
- export * from './knowledge/index.js';
package/dist/knowledge.js DELETED
@@ -1 +0,0 @@
1
- export * from './knowledge/index.js';
@@ -1 +0,0 @@
1
- export * from './runtime-events.js';
@@ -1 +0,0 @@
1
- export * from './runtime-events.js';
package/dist/session.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './session/index.js';
package/dist/session.js DELETED
@@ -1 +0,0 @@
1
- export * from './session/index.js';
@@ -1 +0,0 @@
1
- export * from './settings/index.js';
package/dist/settings.js DELETED
@@ -1 +0,0 @@
1
- export * from './settings/index.js';
@@ -1,52 +0,0 @@
1
- /**
2
- * Wave A CP0: collaboration-related rich content items.
3
- *
4
- * These are data contracts stored in `MessageRow.richContent.items`.
5
- * They intentionally omit presentation/runtime wrapper fields.
6
- */
7
- export type ToolRisk = 'low' | 'medium' | 'high';
8
- export type ToolApprovalStatus = 'pending' | 'approved' | 'rejected' | 'auto_approved';
9
- export interface ToolApprovalRichContentItem {
10
- type: 'tool_approval';
11
- toolCallId: string;
12
- toolName: string;
13
- toolDescription: string;
14
- arguments: Record<string, unknown>;
15
- risk: ToolRisk;
16
- status: ToolApprovalStatus;
17
- approvedBy?: string;
18
- approvedAt?: string;
19
- decisionBy?: string;
20
- decisionRole?: 'human' | 'secretary' | 'system';
21
- onBehalfOf?: string;
22
- reason?: string;
23
- policyVersion?: string;
24
- inboxItemId?: string;
25
- }
26
- export type TaskProgressStepStatus = 'pending' | 'running' | 'done' | 'error' | 'skipped';
27
- export interface TaskProgressRichContentItem {
28
- type: 'task_progress';
29
- taskId: string;
30
- title: string;
31
- steps: Array<{
32
- id: string;
33
- label: string;
34
- status: TaskProgressStepStatus;
35
- detail?: string;
36
- duration?: number;
37
- }>;
38
- currentStep: number;
39
- totalSteps: number;
40
- }
41
- export type ToolCallStatus = 'calling' | 'waiting_approval' | 'running' | 'done' | 'error';
42
- export interface ToolCallRichContentItem {
43
- type: 'tool';
44
- toolCallId: string;
45
- toolName: string;
46
- arguments: Record<string, unknown>;
47
- status: ToolCallStatus;
48
- result?: unknown;
49
- error?: string;
50
- duration?: number;
51
- }
52
- export type CollaborationRichContentItem = ToolApprovalRichContentItem | TaskProgressRichContentItem | ToolCallRichContentItem;
@@ -1,7 +0,0 @@
1
- /**
2
- * Wave A CP0: collaboration-related rich content items.
3
- *
4
- * These are data contracts stored in `MessageRow.richContent.items`.
5
- * They intentionally omit presentation/runtime wrapper fields.
6
- */
7
- export {};
@@ -1,121 +0,0 @@
1
- import type { ToolApprovalRichContentItem, ToolCallRichContentItem, TaskProgressRichContentItem } from './collaboration-rich-content.js';
2
- /**
3
- * Message rich content item kinds stored in `MessageRow.richContent`.
4
- */
5
- export declare enum RichContentItemType {
6
- MAIN_TEXT = "main_text",
7
- THINKING = "thinking",
8
- IMAGE = "image",
9
- CODE = "code",
10
- TOOL = "tool",
11
- TOOL_APPROVAL = "tool_approval",
12
- TASK_PROGRESS = "task_progress",
13
- FILE = "file",
14
- ERROR = "error",
15
- CITATION = "citation"
16
- }
17
- export interface RichContentModelRef {
18
- id: string;
19
- name: string;
20
- provider: string;
21
- }
22
- export interface BaseRichContentItem {
23
- type: RichContentItemType;
24
- model?: RichContentModelRef;
25
- metadata?: Record<string, unknown>;
26
- }
27
- export interface MainTextRichContentItem extends BaseRichContentItem {
28
- type: RichContentItemType.MAIN_TEXT;
29
- content: string;
30
- knowledgeBaseIds?: string[];
31
- citationReferences?: Array<{
32
- citationItemId?: string;
33
- url?: string;
34
- title?: string;
35
- }>;
36
- }
37
- export interface ThinkingRichContentItem extends BaseRichContentItem {
38
- type: RichContentItemType.THINKING;
39
- content: string;
40
- thinkingDuration?: number;
41
- }
42
- export interface CodeRichContentItem extends BaseRichContentItem {
43
- type: RichContentItemType.CODE;
44
- content: string;
45
- language: string;
46
- executable?: boolean;
47
- executionResult?: {
48
- output?: string;
49
- error?: string;
50
- exitCode?: number;
51
- };
52
- }
53
- export interface ImageRichContentItem extends BaseRichContentItem {
54
- type: RichContentItemType.IMAGE;
55
- url?: string;
56
- filePath?: string;
57
- metadata?: BaseRichContentItem['metadata'] & {
58
- prompt?: string;
59
- negativePrompt?: string;
60
- fileName?: string;
61
- fileSize?: number;
62
- width?: number;
63
- height?: number;
64
- };
65
- }
66
- export interface CitationRichContentItem extends BaseRichContentItem {
67
- type: RichContentItemType.CITATION;
68
- webSearch?: {
69
- query: string;
70
- results: Array<{
71
- title: string;
72
- url: string;
73
- snippet?: string;
74
- favicon?: string;
75
- }>;
76
- };
77
- knowledge?: Array<{
78
- id: string;
79
- title: string;
80
- content: string;
81
- source?: string;
82
- }>;
83
- }
84
- export interface FileRichContentItem extends BaseRichContentItem {
85
- type: RichContentItemType.FILE;
86
- fileName: string;
87
- fileUrl: string;
88
- fileSize?: number;
89
- mimeType?: string;
90
- }
91
- export interface ErrorRichContentItem extends BaseRichContentItem {
92
- type: RichContentItemType.ERROR;
93
- message: string;
94
- retryable?: boolean;
95
- code?: string;
96
- details?: unknown;
97
- }
98
- export type MessageRichContentItem = MainTextRichContentItem | ThinkingRichContentItem | CodeRichContentItem | ImageRichContentItem | ToolCallRichContentItem | ToolApprovalRichContentItem | TaskProgressRichContentItem | FileRichContentItem | ErrorRichContentItem | CitationRichContentItem;
99
- export interface LegacyToolInvocation {
100
- id: string;
101
- toolName: string;
102
- input: unknown;
103
- output?: unknown;
104
- error?: string;
105
- }
106
- /**
107
- * Message.richContent payload.
108
- */
109
- export interface MessageRichContent {
110
- thought?: string;
111
- toolInvocations?: LegacyToolInvocation[];
112
- items?: MessageRichContentItem[];
113
- }
114
- export declare function createRichContentItem<T extends MessageRichContentItem>(type: T['type'], partial: Omit<T, 'type'>): T;
115
- export declare function isRichContentItemType<TType extends MessageRichContentItem['type']>(item: MessageRichContentItem, type: TType): item is Extract<MessageRichContentItem, {
116
- type: TType;
117
- }>;
118
- export declare function parseMessageRichContent(richContent: string | null | undefined): MessageRichContent;
119
- export declare function parseMessageRichContentItems(richContent: string | null | undefined): MessageRichContentItem[];
120
- export declare function serializeMessageRichContent(content: MessageRichContent): string;
121
- export declare function serializeMessageRichContentItems(items: MessageRichContentItem[]): string;
@@ -1,85 +0,0 @@
1
- /**
2
- * Message rich content item kinds stored in `MessageRow.richContent`.
3
- */
4
- export var RichContentItemType;
5
- (function (RichContentItemType) {
6
- RichContentItemType["MAIN_TEXT"] = "main_text";
7
- RichContentItemType["THINKING"] = "thinking";
8
- RichContentItemType["IMAGE"] = "image";
9
- RichContentItemType["CODE"] = "code";
10
- RichContentItemType["TOOL"] = "tool";
11
- RichContentItemType["TOOL_APPROVAL"] = "tool_approval";
12
- RichContentItemType["TASK_PROGRESS"] = "task_progress";
13
- RichContentItemType["FILE"] = "file";
14
- RichContentItemType["ERROR"] = "error";
15
- RichContentItemType["CITATION"] = "citation";
16
- })(RichContentItemType || (RichContentItemType = {}));
17
- function toToolArguments(input) {
18
- if (input !== null && typeof input === 'object' && !Array.isArray(input)) {
19
- return input;
20
- }
21
- return { value: input };
22
- }
23
- function normalizeLegacyItems(payload) {
24
- const items = [];
25
- if (payload.thought) {
26
- items.push({
27
- type: RichContentItemType.THINKING,
28
- content: payload.thought,
29
- });
30
- }
31
- if (payload.toolInvocations) {
32
- payload.toolInvocations.forEach((toolInvocation) => {
33
- items.push({
34
- type: RichContentItemType.TOOL,
35
- toolCallId: toolInvocation.id,
36
- toolName: toolInvocation.toolName,
37
- arguments: toToolArguments(toolInvocation.input),
38
- status: toolInvocation.error ? 'error' : 'done',
39
- result: toolInvocation.output,
40
- error: toolInvocation.error,
41
- });
42
- });
43
- }
44
- return items;
45
- }
46
- export function createRichContentItem(type, partial) {
47
- return {
48
- type,
49
- ...partial,
50
- };
51
- }
52
- export function isRichContentItemType(item, type) {
53
- return item.type === type;
54
- }
55
- export function parseMessageRichContent(richContent) {
56
- if (!richContent) {
57
- return { items: [] };
58
- }
59
- try {
60
- const parsed = JSON.parse(richContent);
61
- const { blocks, items, ...rest } = parsed;
62
- if (Array.isArray(items)) {
63
- return { ...rest, items };
64
- }
65
- if (Array.isArray(blocks)) {
66
- return { ...rest, items: blocks };
67
- }
68
- return {
69
- ...rest,
70
- items: normalizeLegacyItems(parsed),
71
- };
72
- }
73
- catch {
74
- return { items: [] };
75
- }
76
- }
77
- export function parseMessageRichContentItems(richContent) {
78
- return parseMessageRichContent(richContent).items ?? [];
79
- }
80
- export function serializeMessageRichContent(content) {
81
- return JSON.stringify(content);
82
- }
83
- export function serializeMessageRichContentItems(items) {
84
- return serializeMessageRichContent({ items });
85
- }
@@ -1,46 +0,0 @@
1
- export declare const ApprovalVocab: {
2
- readonly session: string;
3
- readonly toolCallId: string;
4
- readonly toolName: string;
5
- readonly target: string;
6
- readonly action: string;
7
- readonly risk: string;
8
- readonly status: string;
9
- readonly assignedTo: string;
10
- readonly decisionBy: string;
11
- readonly decisionRole: string;
12
- readonly onBehalfOf: string;
13
- readonly reason: string;
14
- readonly policyVersion: string;
15
- readonly createdAt: string;
16
- readonly resolvedAt: string;
17
- };
18
- export declare const AuditVocab: {
19
- readonly action: string;
20
- readonly actor: string;
21
- readonly actorRole: string;
22
- readonly onBehalfOf: string;
23
- readonly session: string;
24
- readonly toolCallId: string;
25
- readonly approval: string;
26
- readonly context: string;
27
- readonly policy: string;
28
- readonly policyVersion: string;
29
- readonly createdAt: string;
30
- };
31
- export declare const GrantVocab: {
32
- readonly target: string;
33
- readonly action: string;
34
- readonly effect: string;
35
- readonly riskCeiling: string;
36
- readonly decisionBy: string;
37
- readonly decisionRole: string;
38
- readonly onBehalfOf: string;
39
- readonly createdAt: string;
40
- readonly revokedAt: string;
41
- };
42
- export declare const InboxNotificationVocab: {
43
- readonly actor: string;
44
- readonly object: string;
45
- readonly createdAt: string;
46
- };
@@ -1,47 +0,0 @@
1
- import { AS, DCTerms, ODRL, UDFS } from '../namespaces.js';
2
- export const ApprovalVocab = {
3
- session: UDFS.session,
4
- toolCallId: UDFS.toolCallId,
5
- toolName: UDFS.toolName,
6
- target: ODRL.target,
7
- action: ODRL.action,
8
- risk: UDFS.risk,
9
- status: UDFS.status,
10
- assignedTo: UDFS.assignedTo,
11
- decisionBy: UDFS.decisionBy,
12
- decisionRole: UDFS.decisionRole,
13
- onBehalfOf: UDFS.onBehalfOf,
14
- reason: UDFS.reason,
15
- policyVersion: UDFS.policyVersion,
16
- createdAt: DCTerms.created,
17
- resolvedAt: UDFS.resolvedAt,
18
- };
19
- export const AuditVocab = {
20
- action: UDFS.action,
21
- actor: UDFS.actor,
22
- actorRole: UDFS.actorRole,
23
- onBehalfOf: UDFS.onBehalfOf,
24
- session: UDFS.session,
25
- toolCallId: UDFS.toolCallId,
26
- approval: UDFS.approval,
27
- context: UDFS.context,
28
- policy: UDFS.policy,
29
- policyVersion: UDFS.policyVersion,
30
- createdAt: DCTerms.created,
31
- };
32
- export const GrantVocab = {
33
- target: ODRL.target,
34
- action: ODRL.action,
35
- effect: UDFS.effect,
36
- riskCeiling: UDFS.riskCeiling,
37
- decisionBy: UDFS.decisionBy,
38
- decisionRole: UDFS.decisionRole,
39
- onBehalfOf: UDFS.onBehalfOf,
40
- createdAt: DCTerms.created,
41
- revokedAt: UDFS.revokedAt,
42
- };
43
- export const InboxNotificationVocab = {
44
- actor: AS.actor,
45
- object: AS.object,
46
- createdAt: DCTerms.created,
47
- };