@undefineds.co/models 0.2.2 → 0.2.11
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 +17 -1
- package/dist/chat.schema.d.ts +29 -8
- package/dist/chat.schema.js +15 -7
- package/dist/client/index.js +6 -0
- package/dist/comunica-patches.d.ts +3 -0
- package/dist/comunica-patches.js +49 -0
- package/dist/grant.schema.d.ts +1 -1
- package/dist/grant.schema.js +3 -3
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/dist/message.schema.d.ts +31 -5
- package/dist/message.schema.js +15 -7
- package/dist/profile.d.ts +9 -2
- package/dist/profile.js +128 -38
- package/dist/schema.d.ts +247 -3
- package/dist/schema.js +25 -4
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/session.schema.d.ts +30 -12
- package/dist/session/session.schema.js +16 -10
- package/dist/session.repository.d.ts +8 -8
- package/dist/session.repository.js +1 -1
- package/dist/sidecar/sidecar-events.d.ts +6 -6
- package/dist/thread.schema.d.ts +23 -8
- package/dist/thread.schema.js +17 -9
- package/dist/vocab/chat.vocab.js +1 -1
- package/package.json +6 -9
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
import { object, podTable, string, timestamp, uri, id, integer } from '@undefineds.co/drizzle-solid';
|
|
2
2
|
import { DCTerms, UDFS } from '../namespaces.js';
|
|
3
|
+
import { chatResource } from '../chat.schema.js';
|
|
4
|
+
import { threadResource } from '../thread.schema.js';
|
|
3
5
|
/**
|
|
4
|
-
* Runtime / collaboration session
|
|
6
|
+
* Runtime / collaboration session resource.
|
|
5
7
|
*
|
|
6
|
-
* This
|
|
8
|
+
* This preserves generic AI product runtime/session lifecycle state.
|
|
7
9
|
* It is intentionally separate from:
|
|
8
10
|
* - UI-only local state (focus, draft text, scroll position, expand/collapse)
|
|
9
11
|
* - transient transport/session-manager internals
|
|
12
|
+
* - the durable conversation timeline, which is Thread
|
|
10
13
|
*
|
|
11
14
|
* Storage structure:
|
|
12
15
|
* - Location: /.data/session/{id}.ttl
|
|
13
|
-
* - Primary use:
|
|
16
|
+
* - Primary use: runtime lifecycle projection for a concrete Thread
|
|
14
17
|
*
|
|
15
|
-
* Contract notes
|
|
18
|
+
* Contract notes:
|
|
19
|
+
* - Chat identifies the counterpart/conversation object.
|
|
20
|
+
* - Thread identifies the concrete conversation timeline/place/run. AI product
|
|
21
|
+
* runtime sessions map to Thread; this Session resource records lifecycle state
|
|
22
|
+
* and points to that Thread.
|
|
16
23
|
* - `archived` is a persistence-layer/session-lifecycle status; interactive runtime
|
|
17
24
|
* surfaces may continue to use the narrower active/paused/completed/error subset
|
|
18
25
|
* until they explicitly adopt archival semantics.
|
|
19
|
-
* - `chatId` and `threadId` are intentionally stored as opaque string references for
|
|
20
|
-
* now. This keeps the initial session baseline decoupled from any single runtime or
|
|
21
|
-
* RDF-linking strategy while the writer/reader contract is still being designed.
|
|
22
26
|
* - `tool` is intentionally open-string in this baseline so the durable table does not
|
|
23
27
|
* prematurely overfit to today's sidecar enum before all writers are aligned.
|
|
24
28
|
*/
|
|
25
|
-
export const
|
|
29
|
+
export const sessionResource = podTable('session', {
|
|
26
30
|
id: id('id'),
|
|
27
31
|
ownerWebId: uri('ownerWebId').predicate(UDFS.actor).notNull(),
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
chat: uri('chat').predicate(UDFS.conversation).link(chatResource),
|
|
33
|
+
thread: uri('thread').predicate(UDFS.inThread).link(threadResource),
|
|
30
34
|
sessionType: string('sessionType').predicate(UDFS.conversationType).notNull().default('direct'),
|
|
31
35
|
status: string('status').predicate(UDFS.sessionStatus).notNull().default('active'),
|
|
32
36
|
tool: string('tool').predicate(UDFS.sessionTool),
|
|
@@ -44,3 +48,5 @@ export const sessionTable = podTable('session', {
|
|
|
44
48
|
namespace: UDFS,
|
|
45
49
|
subjectTemplate: '{id}.ttl',
|
|
46
50
|
});
|
|
51
|
+
// Compatibility alias. New model code should prefer `sessionResource`.
|
|
52
|
+
export const sessionTable = sessionResource;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const sessionRepository: import("./repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
2
2
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
3
3
|
ownerWebId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
5
|
+
thread: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
6
6
|
sessionType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
7
7
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
8
8
|
tool: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
@@ -16,8 +16,8 @@ export declare const sessionRepository: import("./repository").PodRepositoryDesc
|
|
|
16
16
|
}>>, {
|
|
17
17
|
id: string;
|
|
18
18
|
ownerWebId: string;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
chat: string;
|
|
20
|
+
thread: string;
|
|
21
21
|
sessionType: string;
|
|
22
22
|
status: string;
|
|
23
23
|
tool: string;
|
|
@@ -31,8 +31,8 @@ export declare const sessionRepository: import("./repository").PodRepositoryDesc
|
|
|
31
31
|
}, {
|
|
32
32
|
ownerWebId: string;
|
|
33
33
|
id?: string | undefined;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
chat?: string | undefined;
|
|
35
|
+
thread?: string | undefined;
|
|
36
36
|
sessionType?: string | undefined;
|
|
37
37
|
status?: string | undefined;
|
|
38
38
|
tool?: string | undefined;
|
|
@@ -46,8 +46,8 @@ export declare const sessionRepository: import("./repository").PodRepositoryDesc
|
|
|
46
46
|
}, {
|
|
47
47
|
id?: string | null | undefined;
|
|
48
48
|
ownerWebId?: string | undefined;
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
chat?: string | null | undefined;
|
|
50
|
+
thread?: string | null | undefined;
|
|
51
51
|
sessionType?: string | undefined;
|
|
52
52
|
status?: string | undefined;
|
|
53
53
|
tool?: string | null | undefined;
|
|
@@ -3,6 +3,6 @@ import { sessionTable, } from './session/index.js';
|
|
|
3
3
|
export const sessionRepository = definePodRepository({
|
|
4
4
|
namespace: 'session',
|
|
5
5
|
table: sessionTable,
|
|
6
|
-
searchableFields: ['
|
|
6
|
+
searchableFields: ['chat', 'thread', 'status', 'tool'],
|
|
7
7
|
defaultSort: { field: 'updatedAt', direction: 'desc' },
|
|
8
8
|
});
|
|
@@ -151,9 +151,9 @@ export declare const SessionStateEventV1Schema: z.ZodObject<{
|
|
|
151
151
|
tokenUsage: number;
|
|
152
152
|
type: "session.state";
|
|
153
153
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
154
|
-
chatId: string;
|
|
155
154
|
sessionId: string;
|
|
156
155
|
timestamp: string;
|
|
156
|
+
chatId: string;
|
|
157
157
|
previousStatus: string;
|
|
158
158
|
policy?: string | undefined;
|
|
159
159
|
policyVersion?: string | undefined;
|
|
@@ -163,9 +163,9 @@ export declare const SessionStateEventV1Schema: z.ZodObject<{
|
|
|
163
163
|
tokenUsage: number;
|
|
164
164
|
type: "session.state";
|
|
165
165
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
166
|
-
chatId: string;
|
|
167
166
|
sessionId: string;
|
|
168
167
|
timestamp: string;
|
|
168
|
+
chatId: string;
|
|
169
169
|
previousStatus: string;
|
|
170
170
|
policy?: string | undefined;
|
|
171
171
|
policyVersion?: string | undefined;
|
|
@@ -188,9 +188,9 @@ export declare const SessionStateEventSchema: z.ZodObject<{
|
|
|
188
188
|
tokenUsage: number;
|
|
189
189
|
type: "session.state";
|
|
190
190
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
191
|
-
chatId: string;
|
|
192
191
|
sessionId: string;
|
|
193
192
|
timestamp: string;
|
|
193
|
+
chatId: string;
|
|
194
194
|
previousStatus: string;
|
|
195
195
|
policy?: string | undefined;
|
|
196
196
|
policyVersion?: string | undefined;
|
|
@@ -200,9 +200,9 @@ export declare const SessionStateEventSchema: z.ZodObject<{
|
|
|
200
200
|
tokenUsage: number;
|
|
201
201
|
type: "session.state";
|
|
202
202
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
203
|
-
chatId: string;
|
|
204
203
|
sessionId: string;
|
|
205
204
|
timestamp: string;
|
|
205
|
+
chatId: string;
|
|
206
206
|
previousStatus: string;
|
|
207
207
|
policy?: string | undefined;
|
|
208
208
|
policyVersion?: string | undefined;
|
|
@@ -504,9 +504,9 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
504
504
|
tokenUsage: number;
|
|
505
505
|
type: "session.state";
|
|
506
506
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
507
|
-
chatId: string;
|
|
508
507
|
sessionId: string;
|
|
509
508
|
timestamp: string;
|
|
509
|
+
chatId: string;
|
|
510
510
|
previousStatus: string;
|
|
511
511
|
policy?: string | undefined;
|
|
512
512
|
policyVersion?: string | undefined;
|
|
@@ -516,9 +516,9 @@ export declare const SidecarEventSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
516
516
|
tokenUsage: number;
|
|
517
517
|
type: "session.state";
|
|
518
518
|
tool: "claude-code" | "cursor" | "windsurf";
|
|
519
|
-
chatId: string;
|
|
520
519
|
sessionId: string;
|
|
521
520
|
timestamp: string;
|
|
521
|
+
chatId: string;
|
|
522
522
|
previousStatus: string;
|
|
523
523
|
policy?: string | undefined;
|
|
524
524
|
policyVersion?: string | undefined;
|
package/dist/thread.schema.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thread
|
|
2
|
+
* Thread resource.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* - Thread
|
|
4
|
+
* Product semantics:
|
|
5
|
+
* - Thread is the concrete conversation timeline/place under a Chat.
|
|
6
|
+
* - AI product runtime sessions map to Thread when they represent a concrete
|
|
7
|
+
* conversation timeline/place/run.
|
|
8
|
+
* - Thread carries workspace/runtime/place metadata. Chat only identifies the
|
|
9
|
+
* counterpart/conversation object.
|
|
10
|
+
* - Product/runtime-specific ids should stay in metadata as `runtimeSessionId`,
|
|
11
|
+
* `runtime`, `surface`, etc. Do not name the generic thread id `piSessionId`.
|
|
7
12
|
*
|
|
8
13
|
* Storage structure (aligned with xpod):
|
|
9
14
|
* - Thread stored as fragment in Chat's index.ttl
|
|
10
|
-
* - Location: /.data/chat/{chat}/index.ttl#{id}
|
|
15
|
+
* - Location: /.data/chat/{chat|id}/index.ttl#{id}
|
|
11
16
|
*
|
|
12
17
|
* NOTE:
|
|
13
18
|
* - `thread.workspace` is a storage-layer reference (URI) to a container/resource in CSS/Pod.
|
|
@@ -15,6 +20,16 @@
|
|
|
15
20
|
* - Runtime path/copy is an execution-time interface shape; persistence should keep the
|
|
16
21
|
* container URI here and store portable metadata with that container/resource.
|
|
17
22
|
*/
|
|
23
|
+
export declare const threadResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
24
|
+
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
25
|
+
chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
|
|
26
|
+
title: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
27
|
+
starred: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
|
|
28
|
+
workspace: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
29
|
+
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
30
|
+
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
31
|
+
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
32
|
+
}>>;
|
|
18
33
|
export declare const threadTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
19
34
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
20
35
|
chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
|
|
@@ -25,6 +40,6 @@ export declare const threadTable: import("@undefineds.co/drizzle-solid/dist/core
|
|
|
25
40
|
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
26
41
|
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
27
42
|
}>>;
|
|
28
|
-
export type ThreadRow = typeof
|
|
29
|
-
export type ThreadInsert = typeof
|
|
30
|
-
export type ThreadUpdate = typeof
|
|
43
|
+
export type ThreadRow = typeof threadResource.$inferSelect;
|
|
44
|
+
export type ThreadInsert = typeof threadResource.$inferInsert;
|
|
45
|
+
export type ThreadUpdate = typeof threadResource.$inferUpdate;
|
package/dist/thread.schema.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { uri, boolean, object, podTable, string, timestamp, id } from '@undefineds.co/drizzle-solid';
|
|
2
2
|
import { UDFS, DCTerms, SIOC, LINX_CHAT } from './namespaces.js';
|
|
3
|
+
import { chatResource } from './chat.schema.js';
|
|
3
4
|
/**
|
|
4
|
-
* Thread
|
|
5
|
+
* Thread resource.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* - Thread
|
|
7
|
+
* Product semantics:
|
|
8
|
+
* - Thread is the concrete conversation timeline/place under a Chat.
|
|
9
|
+
* - AI product runtime sessions map to Thread when they represent a concrete
|
|
10
|
+
* conversation timeline/place/run.
|
|
11
|
+
* - Thread carries workspace/runtime/place metadata. Chat only identifies the
|
|
12
|
+
* counterpart/conversation object.
|
|
13
|
+
* - Product/runtime-specific ids should stay in metadata as `runtimeSessionId`,
|
|
14
|
+
* `runtime`, `surface`, etc. Do not name the generic thread id `piSessionId`.
|
|
9
15
|
*
|
|
10
16
|
* Storage structure (aligned with xpod):
|
|
11
17
|
* - Thread stored as fragment in Chat's index.ttl
|
|
12
|
-
* - Location: /.data/chat/{chat}/index.ttl#{id}
|
|
18
|
+
* - Location: /.data/chat/{chat|id}/index.ttl#{id}
|
|
13
19
|
*
|
|
14
20
|
* NOTE:
|
|
15
21
|
* - `thread.workspace` is a storage-layer reference (URI) to a container/resource in CSS/Pod.
|
|
@@ -17,10 +23,10 @@ import { UDFS, DCTerms, SIOC, LINX_CHAT } from './namespaces.js';
|
|
|
17
23
|
* - Runtime path/copy is an execution-time interface shape; persistence should keep the
|
|
18
24
|
* container URI here and store portable metadata with that container/resource.
|
|
19
25
|
*/
|
|
20
|
-
export const
|
|
26
|
+
export const threadResource = podTable('thread', {
|
|
21
27
|
id: id('id'),
|
|
22
|
-
// Belongs to chat. Stored as an RDF URI; short ids are resolved via
|
|
23
|
-
chat: uri('chat').predicate(SIOC.has_parent).notNull().link(
|
|
28
|
+
// Belongs to chat/counterpart. Stored as an RDF URI; short ids are resolved via chatResource's URI template by the ORM.
|
|
29
|
+
chat: uri('chat').predicate(SIOC.has_parent).notNull().link(chatResource),
|
|
24
30
|
// Display / state
|
|
25
31
|
title: string('title').predicate(DCTerms.title),
|
|
26
32
|
starred: boolean('starred').predicate(UDFS.favorite).default(false),
|
|
@@ -35,5 +41,7 @@ export const threadTable = podTable('thread', {
|
|
|
35
41
|
sparqlEndpoint: '/.data/chat/-/sparql',
|
|
36
42
|
type: SIOC.Thread,
|
|
37
43
|
namespace: UDFS,
|
|
38
|
-
subjectTemplate: '{chat}/index.ttl#{id}',
|
|
44
|
+
subjectTemplate: '{chat|id}/index.ttl#{id}',
|
|
39
45
|
});
|
|
46
|
+
// Compatibility alias. New model code should prefer `threadResource`.
|
|
47
|
+
export const threadTable = threadResource;
|
package/dist/vocab/chat.vocab.js
CHANGED
|
@@ -14,7 +14,7 @@ export const ChatBaseVocab = {
|
|
|
14
14
|
unreadCount: UDFS.unreadCount,
|
|
15
15
|
// Activity
|
|
16
16
|
lastActiveAt: UDFS.lastActiveAt,
|
|
17
|
-
lastMessageId:
|
|
17
|
+
lastMessageId: UDFS.lastMessage,
|
|
18
18
|
lastMessagePreview: SCHEMA.text,
|
|
19
19
|
// Timestamps
|
|
20
20
|
createdAt: DCTerms.created,
|
package/package.json
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undefineds.co/models",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
6
|
"exports": {
|
|
9
7
|
".": {
|
|
10
8
|
"types": "./dist/index.d.ts",
|
|
@@ -53,7 +51,9 @@
|
|
|
53
51
|
},
|
|
54
52
|
"dependencies": {
|
|
55
53
|
"@comunica/query-sparql-solid": "^4.0.2",
|
|
56
|
-
"@
|
|
54
|
+
"@inrupt/vocab-common-rdf": "^1.0.5",
|
|
55
|
+
"@undefineds.co/drizzle-solid": "^0.3.8",
|
|
56
|
+
"n3": "^1.26.0",
|
|
57
57
|
"zod": "^3.22.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
@@ -61,16 +61,13 @@
|
|
|
61
61
|
"typescript": "^5.4.0",
|
|
62
62
|
"vitest": "^1.6.0"
|
|
63
63
|
},
|
|
64
|
+
"main": "./dist/index.js",
|
|
65
|
+
"types": "./dist/index.d.ts",
|
|
64
66
|
"files": [
|
|
65
67
|
"dist",
|
|
66
68
|
"README.md",
|
|
67
69
|
"package.json"
|
|
68
70
|
],
|
|
69
|
-
"repository": {
|
|
70
|
-
"type": "git",
|
|
71
|
-
"url": "git+https://github.com/undefinedsco/LinX.git",
|
|
72
|
-
"directory": "packages/models"
|
|
73
|
-
},
|
|
74
71
|
"publishConfig": {
|
|
75
72
|
"access": "public"
|
|
76
73
|
}
|