@lota-sdk/shared 0.1.14 → 0.1.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lota-sdk/shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"registry": "https://registry.npmjs.org/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"ai": "^6.0.
|
|
28
|
+
"ai": "^6.0.134",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
/** Open-ended metadata bag -- index signature required for AI SDK compatibility */
|
|
1
2
|
export interface MessageMetadataLike {
|
|
2
3
|
createdAt?: unknown
|
|
3
4
|
[key: string]: unknown
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
export function toTimestamp(value: unknown): number {
|
|
7
|
+
export function toTimestamp(value: unknown): number | undefined {
|
|
7
8
|
if (typeof value === 'number' && Number.isFinite(value)) return value
|
|
8
9
|
if (typeof value === 'string') {
|
|
9
10
|
const parsed = Date.parse(value)
|
|
10
11
|
if (Number.isFinite(parsed)) return parsed
|
|
11
12
|
}
|
|
12
13
|
if (value instanceof Date) return value.getTime()
|
|
13
|
-
return
|
|
14
|
+
return undefined
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function getMessageCreatedAt(
|
|
@@ -18,7 +19,7 @@ export function getMessageCreatedAt(
|
|
|
18
19
|
options?: { fallback?: number },
|
|
19
20
|
): number {
|
|
20
21
|
const createdAt = toTimestamp(message.metadata?.createdAt)
|
|
21
|
-
if (
|
|
22
|
+
if (createdAt !== undefined) return createdAt
|
|
22
23
|
return options?.fallback ?? Date.now()
|
|
23
24
|
}
|
|
24
25
|
|
package/src/schemas/common.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { z } from 'zod'
|
|
|
2
2
|
|
|
3
3
|
import { WORKSTREAM } from '../constants/workstream'
|
|
4
4
|
|
|
5
|
-
export const unixTimestampSchema = z.coerce.date()
|
|
6
|
-
|
|
7
5
|
const SURREALDB_RECORD_ID_CLASSES = new Set(['RecordId', 'StringRecordId'])
|
|
8
6
|
|
|
9
7
|
function coerceRecordIdToString(val: unknown): unknown {
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
-
import { recordIdSchema
|
|
3
|
+
import { recordIdSchema } from './common'
|
|
4
|
+
|
|
5
|
+
const unixTimestampSchema = z.coerce.date()
|
|
4
6
|
|
|
5
7
|
const planSchemaLiteralSchema = z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
6
8
|
|
|
9
|
+
/** JSON Schema enum literal type */
|
|
10
|
+
export type PlanSchemaLiteral = string | number | boolean | null
|
|
11
|
+
|
|
7
12
|
export type PlanDataSchemaDefinition = {
|
|
8
13
|
type: 'string' | 'number' | 'boolean' | 'object' | 'array'
|
|
9
14
|
description?: string
|
|
10
15
|
nullable?: boolean
|
|
11
16
|
required?: boolean
|
|
12
|
-
enum?: Array<
|
|
17
|
+
enum?: Array<PlanSchemaLiteral>
|
|
13
18
|
properties?: Record<string, PlanDataSchemaDefinition>
|
|
14
19
|
items?: PlanDataSchemaDefinition
|
|
15
20
|
minItems?: number
|
|
@@ -15,7 +15,7 @@ export const sdkWorkstreamSchema = z.object({
|
|
|
15
15
|
coreType: z.string().nullable().optional(),
|
|
16
16
|
title: z.string(),
|
|
17
17
|
status: sdkWorkstreamStatusSchema,
|
|
18
|
-
nameGenerated: z.boolean(),
|
|
18
|
+
nameGenerated: z.boolean(), // Ideally `isNameGenerated`, but maps directly to SurrealDB column `nameGenerated`
|
|
19
19
|
isRunning: z.boolean(),
|
|
20
20
|
isCompacting: z.boolean(),
|
|
21
21
|
memoryBlock: z.string().optional(),
|
|
@@ -38,7 +38,7 @@ export const sdkWorkstreamRecordSchema = z.object({
|
|
|
38
38
|
activeRunId: z.string().nullish(),
|
|
39
39
|
compactionSummary: z.string().nullish(),
|
|
40
40
|
lastCompactedMessageId: z.string().nullish(),
|
|
41
|
-
nameGenerated: z.boolean().optional(),
|
|
41
|
+
nameGenerated: z.boolean().optional(), // Ideally `isNameGenerated`, but maps directly to SurrealDB column `nameGenerated`
|
|
42
42
|
isCompacting: z.boolean().optional(),
|
|
43
43
|
state: z.unknown().optional(),
|
|
44
44
|
createdAt: z.coerce.date(),
|