@undefineds.co/models 0.2.21 → 0.2.24
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 +178 -523
- package/dist/ai-config/index.d.ts +24 -0
- package/dist/ai-config/index.js +133 -23
- package/dist/ai-model.schema.js +1 -1
- package/dist/ai-provider.schema.js +2 -2
- package/dist/approval.schema.d.ts +1 -0
- package/dist/approval.schema.js +11 -0
- package/dist/audit.schema.d.ts +1 -0
- package/dist/audit.schema.js +11 -0
- package/dist/chat.schema.d.ts +1 -1
- package/dist/chat.schema.js +1 -1
- package/dist/credential.schema.d.ts +6 -0
- package/dist/credential.schema.js +2 -1
- package/dist/grant.schema.d.ts +1 -0
- package/dist/grant.schema.js +3 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +6 -11
- package/dist/message.schema.js +8 -8
- package/dist/namespaces.d.ts +0 -3
- package/dist/namespaces.js +2 -7
- package/dist/schema.d.ts +4 -0
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/session.schema.d.ts +6 -1
- package/dist/session/session.schema.js +31 -3
- package/dist/session.repository.d.ts +4 -0
- package/dist/thread.schema.js +2 -2
- package/dist/vocab/message.vocab.js +8 -8
- package/dist/vocab/thread.vocab.js +2 -2
- package/package.json +3 -7
- package/dist/watch/index.d.ts +0 -281
- package/dist/watch/index.js +0 -1493
package/dist/namespaces.js
CHANGED
|
@@ -110,6 +110,7 @@ export const UDFS = createNamespace('udfs', 'https://undefineds.co/ns#', {
|
|
|
110
110
|
inThread: 'inThread',
|
|
111
111
|
participants: 'participants',
|
|
112
112
|
messageContent: 'messageContent',
|
|
113
|
+
messageResource: 'messageResource',
|
|
113
114
|
messageType: 'messageType',
|
|
114
115
|
messageStatus: 'messageStatus',
|
|
115
116
|
readBy: 'readBy',
|
|
@@ -231,13 +232,6 @@ export const UDFS = createNamespace('udfs', 'https://undefineds.co/ns#', {
|
|
|
231
232
|
snapshotMeta: 'snapshotMeta',
|
|
232
233
|
});
|
|
233
234
|
export const UDFS_NAMESPACE = UDFS.NAMESPACE;
|
|
234
|
-
// Legacy alias: existing code may still import LINQ.
|
|
235
|
-
// Keep as alias to avoid churn.
|
|
236
|
-
export const LINQ = UDFS;
|
|
237
|
-
// Wave A contracts: unified under company namespace (UDFS).
|
|
238
|
-
// Keep legacy names as aliases to avoid downstream churn.
|
|
239
|
-
export const LINX_CHAT = UDFS;
|
|
240
|
-
export const LINX_MSG = UDFS;
|
|
241
235
|
export const XPOD_CREDENTIAL = createNamespace('cred', 'https://vocab.xpod.dev/credential#', {
|
|
242
236
|
Credential: 'Credential',
|
|
243
237
|
ApiKeyCredential: 'ApiKeyCredential',
|
|
@@ -249,6 +243,7 @@ export const XPOD_CREDENTIAL = createNamespace('cred', 'https://vocab.xpod.dev/c
|
|
|
249
243
|
baseUrl: 'baseUrl',
|
|
250
244
|
proxyUrl: 'proxyUrl',
|
|
251
245
|
label: 'label',
|
|
246
|
+
isDefault: 'isDefault',
|
|
252
247
|
lastUsedAt: 'lastUsedAt',
|
|
253
248
|
failCount: 'failCount',
|
|
254
249
|
rateLimitResetAt: 'rateLimitResetAt',
|
package/dist/schema.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export declare const solidResources: {
|
|
|
77
77
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
78
78
|
tool: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
79
79
|
tokenUsage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
80
|
+
messageResources: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
80
81
|
policy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
81
82
|
policyVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
82
83
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
@@ -124,6 +125,7 @@ export declare const solidResources: {
|
|
|
124
125
|
baseUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
125
126
|
proxyUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
126
127
|
label: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
128
|
+
isDefault: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
|
|
127
129
|
lastUsedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
128
130
|
failCount: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
129
131
|
rateLimitResetAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
@@ -384,6 +386,7 @@ export declare const solidSchema: {
|
|
|
384
386
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
385
387
|
tool: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
386
388
|
tokenUsage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
389
|
+
messageResources: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
387
390
|
policy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
388
391
|
policyVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
389
392
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
@@ -431,6 +434,7 @@ export declare const solidSchema: {
|
|
|
431
434
|
baseUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
432
435
|
proxyUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
433
436
|
label: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
437
|
+
isDefault: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
|
|
434
438
|
lastUsedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
435
439
|
failCount: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
436
440
|
rateLimitResetAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
package/dist/session/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { sessionResource, sessionTable, buildRuntimeSessionIri, extractRuntimeSessionId, type SessionType, type SessionStatus, type SessionRow, type SessionInsert, type SessionUpdate, } from './session.schema';
|
|
1
|
+
export { sessionResource, sessionTable, buildSessionResourceId, buildSessionSubjectPath, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, type SessionType, type SessionStatus, type SessionRow, type SessionInsert, type SessionUpdate, } from './session.schema';
|
package/dist/session/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { sessionResource, sessionTable, buildRuntimeSessionIri, extractRuntimeSessionId, } from './session.schema.js';
|
|
1
|
+
export { sessionResource, sessionTable, buildSessionResourceId, buildSessionSubjectPath, buildRuntimeSessionIri, extractSessionIdFromSessionRef, extractRuntimeSessionId, } from './session.schema.js';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export type SessionType = 'direct' | 'group' | 'imported-readonly';
|
|
2
2
|
export type SessionStatus = 'active' | 'paused' | 'completed' | 'error' | 'archived';
|
|
3
|
+
export declare function buildSessionResourceId(sessionId: string, createdAt?: Date | string | number): string;
|
|
4
|
+
export declare function buildSessionSubjectPath(sessionId: string, createdAt?: Date | string | number): string;
|
|
3
5
|
export declare function buildRuntimeSessionIri(sessionId: string): string;
|
|
4
6
|
export declare function extractRuntimeSessionId(sessionRef: string | null | undefined): string | null;
|
|
7
|
+
export declare function extractSessionIdFromSessionRef(sessionRef: string | null | undefined): string | null;
|
|
5
8
|
/**
|
|
6
9
|
* Runtime / collaboration session resource.
|
|
7
10
|
*
|
|
@@ -12,7 +15,7 @@ export declare function extractRuntimeSessionId(sessionRef: string | null | unde
|
|
|
12
15
|
* - the durable conversation timeline, which is Thread
|
|
13
16
|
*
|
|
14
17
|
* Storage structure:
|
|
15
|
-
* - Location: /.data/sessions/{yyyy}/{MM}
|
|
18
|
+
* - Location: /.data/sessions/{yyyy}/{MM}/{dd}/{id}.ttl
|
|
16
19
|
* - Primary use: runtime lifecycle projection for a concrete Thread
|
|
17
20
|
*
|
|
18
21
|
* Contract notes:
|
|
@@ -35,6 +38,7 @@ export declare const sessionResource: import("@undefineds.co/drizzle-solid/dist/
|
|
|
35
38
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
36
39
|
tool: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
37
40
|
tokenUsage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
41
|
+
messageResources: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
38
42
|
policy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
39
43
|
policyVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
40
44
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
@@ -51,6 +55,7 @@ export declare const sessionTable: import("@undefineds.co/drizzle-solid/dist/cor
|
|
|
51
55
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
52
56
|
tool: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
53
57
|
tokenUsage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
58
|
+
messageResources: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
54
59
|
policy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
55
60
|
policyVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
56
61
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
@@ -2,6 +2,17 @@ import { extractPodResourceTemplateValue, object, podTable, string, timestamp, u
|
|
|
2
2
|
import { DCTerms, UDFS } from '../namespaces.js';
|
|
3
3
|
import { chatResource } from '../chat.schema.js';
|
|
4
4
|
import { threadResource } from '../thread.schema.js';
|
|
5
|
+
export function buildSessionResourceId(sessionId, createdAt = new Date()) {
|
|
6
|
+
const date = createdAt instanceof Date ? createdAt : new Date(createdAt);
|
|
7
|
+
const safeDate = Number.isFinite(date.getTime()) ? date : new Date();
|
|
8
|
+
const yyyy = String(safeDate.getUTCFullYear());
|
|
9
|
+
const mm = String(safeDate.getUTCMonth() + 1).padStart(2, '0');
|
|
10
|
+
const dd = String(safeDate.getUTCDate()).padStart(2, '0');
|
|
11
|
+
return `${yyyy}/${mm}/${dd}/${encodeURIComponent(sessionId)}.ttl`;
|
|
12
|
+
}
|
|
13
|
+
export function buildSessionSubjectPath(sessionId, createdAt = new Date()) {
|
|
14
|
+
return `/.data/sessions/${buildSessionResourceId(sessionId, createdAt)}`;
|
|
15
|
+
}
|
|
5
16
|
export function buildRuntimeSessionIri(sessionId) {
|
|
6
17
|
return `urn:linx:runtime-session:${sessionId}`;
|
|
7
18
|
}
|
|
@@ -11,7 +22,23 @@ export function extractRuntimeSessionId(sessionRef) {
|
|
|
11
22
|
const runtimeMatch = sessionRef.match(/^urn:linx:runtime-session:(.+)$/);
|
|
12
23
|
if (runtimeMatch?.[1])
|
|
13
24
|
return runtimeMatch[1];
|
|
14
|
-
return
|
|
25
|
+
return extractSessionIdFromSessionRef(sessionRef);
|
|
26
|
+
}
|
|
27
|
+
export function extractSessionIdFromSessionRef(sessionRef) {
|
|
28
|
+
if (!sessionRef)
|
|
29
|
+
return null;
|
|
30
|
+
const templateId = extractPodResourceTemplateValue(sessionResource, sessionRef);
|
|
31
|
+
if (templateId)
|
|
32
|
+
return templateId;
|
|
33
|
+
const legacyFragmentMatch = sessionRef.match(/\.ttl#([^/?#]+)$/);
|
|
34
|
+
if (legacyFragmentMatch?.[1]) {
|
|
35
|
+
return decodeURIComponent(legacyFragmentMatch[1]);
|
|
36
|
+
}
|
|
37
|
+
const documentMatch = sessionRef.match(/\/([^/?#]+)\.ttl(?:$|[?#])/);
|
|
38
|
+
if (documentMatch?.[1]) {
|
|
39
|
+
return decodeURIComponent(documentMatch[1]);
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
15
42
|
}
|
|
16
43
|
/**
|
|
17
44
|
* Runtime / collaboration session resource.
|
|
@@ -23,7 +50,7 @@ export function extractRuntimeSessionId(sessionRef) {
|
|
|
23
50
|
* - the durable conversation timeline, which is Thread
|
|
24
51
|
*
|
|
25
52
|
* Storage structure:
|
|
26
|
-
* - Location: /.data/sessions/{yyyy}/{MM}
|
|
53
|
+
* - Location: /.data/sessions/{yyyy}/{MM}/{dd}/{id}.ttl
|
|
27
54
|
* - Primary use: runtime lifecycle projection for a concrete Thread
|
|
28
55
|
*
|
|
29
56
|
* Contract notes:
|
|
@@ -46,6 +73,7 @@ export const sessionResource = podTable('session', {
|
|
|
46
73
|
status: string('status').predicate(UDFS.sessionStatus).notNull().default('active'),
|
|
47
74
|
tool: string('tool').predicate(UDFS.sessionTool),
|
|
48
75
|
tokenUsage: integer('tokenUsage').predicate(UDFS.tokenUsage).default(0),
|
|
76
|
+
messageResources: uri('messageResources').predicate(UDFS.messageResource).array(),
|
|
49
77
|
policy: uri('policy').predicate(UDFS.policy),
|
|
50
78
|
policyVersion: string('policyVersion').predicate(UDFS.policyVersion),
|
|
51
79
|
metadata: object('metadata').predicate(UDFS.metadata),
|
|
@@ -57,7 +85,7 @@ export const sessionResource = podTable('session', {
|
|
|
57
85
|
sparqlEndpoint: '/.data/sessions/-/sparql',
|
|
58
86
|
type: UDFS.term('Session'),
|
|
59
87
|
namespace: UDFS,
|
|
60
|
-
subjectTemplate: '{yyyy}/{MM}
|
|
88
|
+
subjectTemplate: '{yyyy}/{MM}/{dd}/{id}.ttl',
|
|
61
89
|
});
|
|
62
90
|
// Compatibility alias. New model code should prefer `sessionResource`.
|
|
63
91
|
export const sessionTable = sessionResource;
|
|
@@ -7,6 +7,7 @@ export declare const sessionRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
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>;
|
|
9
9
|
tokenUsage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, false, true>;
|
|
10
|
+
messageResources: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
10
11
|
policy: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
11
12
|
policyVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
12
13
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
@@ -22,6 +23,7 @@ export declare const sessionRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
22
23
|
status: string;
|
|
23
24
|
tool: string;
|
|
24
25
|
tokenUsage: number;
|
|
26
|
+
messageResources: string[];
|
|
25
27
|
policy: string;
|
|
26
28
|
policyVersion: string;
|
|
27
29
|
metadata: Record<string, unknown>;
|
|
@@ -37,6 +39,7 @@ export declare const sessionRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
37
39
|
status?: string | undefined;
|
|
38
40
|
tool?: string | undefined;
|
|
39
41
|
tokenUsage?: number | undefined;
|
|
42
|
+
messageResources?: string[] | undefined;
|
|
40
43
|
policy?: string | undefined;
|
|
41
44
|
policyVersion?: string | undefined;
|
|
42
45
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -52,6 +55,7 @@ export declare const sessionRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
52
55
|
status?: string | undefined;
|
|
53
56
|
tool?: string | null | undefined;
|
|
54
57
|
tokenUsage?: number | null | undefined;
|
|
58
|
+
messageResources?: string[] | null | undefined;
|
|
55
59
|
policy?: string | null | undefined;
|
|
56
60
|
policyVersion?: string | null | undefined;
|
|
57
61
|
metadata?: Record<string, unknown> | null | undefined;
|
package/dist/thread.schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { uri, boolean, object, podTable, string, timestamp, id } from '@undefineds.co/drizzle-solid';
|
|
2
|
-
import { UDFS, DCTerms, SIOC
|
|
2
|
+
import { UDFS, DCTerms, SIOC } from './namespaces.js';
|
|
3
3
|
import { chatResource } from './chat.schema.js';
|
|
4
4
|
/**
|
|
5
5
|
* Thread resource.
|
|
@@ -31,7 +31,7 @@ export const threadResource = podTable('thread', {
|
|
|
31
31
|
title: string('title').predicate(DCTerms.title),
|
|
32
32
|
starred: boolean('starred').predicate(UDFS.favorite).default(false),
|
|
33
33
|
// Storage-layer execution context reference: container/resource URI
|
|
34
|
-
workspace: uri('workspace').predicate(
|
|
34
|
+
workspace: uri('workspace').predicate(UDFS.workspace),
|
|
35
35
|
// Generic execution metadata shared by CLI/App runtimes.
|
|
36
36
|
metadata: object('metadata').predicate(UDFS.metadata),
|
|
37
37
|
createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DCTerms, FOAF,
|
|
1
|
+
import { DCTerms, FOAF, SCHEMA, SIOC, UDFS, WF } from '../namespaces.js';
|
|
2
2
|
export const MessageVocab = {
|
|
3
3
|
// Existing
|
|
4
4
|
thread: SIOC.has_member,
|
|
@@ -13,12 +13,12 @@ export const MessageVocab = {
|
|
|
13
13
|
createdAt: DCTerms.created,
|
|
14
14
|
updatedAt: DCTerms.modified,
|
|
15
15
|
// Group message extensions
|
|
16
|
-
senderName:
|
|
17
|
-
senderAvatarUrl:
|
|
18
|
-
mentions:
|
|
19
|
-
replyTo:
|
|
16
|
+
senderName: UDFS.senderName,
|
|
17
|
+
senderAvatarUrl: UDFS.senderAvatarUrl,
|
|
18
|
+
mentions: UDFS.mentions,
|
|
19
|
+
replyTo: UDFS.replyTo,
|
|
20
20
|
// Multi-AI routing
|
|
21
|
-
routedBy:
|
|
22
|
-
routeTargetAgentId:
|
|
23
|
-
coordinationId:
|
|
21
|
+
routedBy: UDFS.routedBy,
|
|
22
|
+
routeTargetAgentId: UDFS.routeTargetAgentId,
|
|
23
|
+
coordinationId: UDFS.coordinationId,
|
|
24
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DCTerms,
|
|
1
|
+
import { DCTerms, SIOC, UDFS } from '../namespaces.js';
|
|
2
2
|
export const ThreadVocab = {
|
|
3
3
|
chat: SIOC.has_parent,
|
|
4
4
|
title: DCTerms.title,
|
|
@@ -7,7 +7,7 @@ export const ThreadVocab = {
|
|
|
7
7
|
createdAt: DCTerms.created,
|
|
8
8
|
updatedAt: DCTerms.modified,
|
|
9
9
|
// Execution context: workspace URI for the runnable root
|
|
10
|
-
workspace:
|
|
10
|
+
workspace: UDFS.workspace,
|
|
11
11
|
// Type marker (for SPARQL convenience)
|
|
12
12
|
type: SIOC.Thread,
|
|
13
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undefineds.co/models",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,10 +53,6 @@
|
|
|
53
53
|
"./vocab/sidecar": {
|
|
54
54
|
"types": "./dist/vocab/sidecar.vocab.d.ts",
|
|
55
55
|
"default": "./dist/vocab/sidecar.vocab.js"
|
|
56
|
-
},
|
|
57
|
-
"./watch": {
|
|
58
|
-
"types": "./dist/watch/index.d.ts",
|
|
59
|
-
"default": "./dist/watch/index.js"
|
|
60
56
|
}
|
|
61
57
|
},
|
|
62
58
|
"scripts": {
|
|
@@ -66,13 +62,13 @@
|
|
|
66
62
|
"pack:release": "node scripts/pack-release.mjs",
|
|
67
63
|
"sync:discovery:vercel": "node --experimental-strip-types scripts/sync-discovery-vercel.ts",
|
|
68
64
|
"test": "vitest run",
|
|
69
|
-
"test:ci": "vitest run tests/ai-config.test.ts tests/ai-runtime-schema.test.ts tests/client.test.ts tests/contracts-chat-contact.contract.test.ts tests/discovery-vercel.test.ts tests/discovery.test.ts tests/profile.test.ts tests/repository.test.ts tests/resource-utils.test.ts tests/session-schema.test.ts tests/sidecar-events.contract.test.ts tests/
|
|
65
|
+
"test:ci": "vitest run tests/ai-config.test.ts tests/ai-runtime-schema.test.ts tests/client.test.ts tests/contracts-chat-contact.contract.test.ts tests/discovery-vercel.test.ts tests/discovery.test.ts tests/profile.test.ts tests/repository.test.ts tests/resource-utils.test.ts tests/session-schema.test.ts tests/sidecar-events.contract.test.ts tests/resource-schema.test.ts",
|
|
70
66
|
"test:pod": "dotenv -e ../linx-models/.env -- vitest run tests/pod.integration.test.ts"
|
|
71
67
|
},
|
|
72
68
|
"dependencies": {
|
|
73
69
|
"@comunica/query-sparql-solid": "^4.0.2",
|
|
74
70
|
"@inrupt/vocab-common-rdf": "^1.0.5",
|
|
75
|
-
"@undefineds.co/drizzle-solid": "^0.3.
|
|
71
|
+
"@undefineds.co/drizzle-solid": "^0.3.12",
|
|
76
72
|
"n3": "^1.26.0",
|
|
77
73
|
"zod": "^3.22.4"
|
|
78
74
|
},
|
package/dist/watch/index.d.ts
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
export type WatchBackend = 'codex' | 'claude' | 'codebuddy';
|
|
2
|
-
export type WatchMode = 'manual' | 'smart' | 'auto';
|
|
3
|
-
export type WatchSessionStatus = 'running' | 'completed' | 'failed';
|
|
4
|
-
export type WatchOutputStream = 'stdout' | 'stderr' | 'system';
|
|
5
|
-
export type WatchCredentialSource = 'auto' | 'local' | 'cloud';
|
|
6
|
-
export type WatchResolvedCredentialSource = 'local' | 'cloud';
|
|
7
|
-
export type WatchApprovalSource = 'local' | 'remote' | 'hybrid';
|
|
8
|
-
export type WatchRuntime = 'local';
|
|
9
|
-
export type WatchTransport = 'native' | 'acp';
|
|
10
|
-
export type WatchAuthState = 'authenticated' | 'unauthenticated' | 'unknown';
|
|
11
|
-
export interface WatchAuthStatus {
|
|
12
|
-
state: WatchAuthState;
|
|
13
|
-
message?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface WatchAuthFailure {
|
|
16
|
-
message: string;
|
|
17
|
-
}
|
|
18
|
-
export type WatchCloudCredentialProbeStatus = 'available' | 'unavailable' | 'error';
|
|
19
|
-
export interface WatchCloudCredentialProbe {
|
|
20
|
-
status: WatchCloudCredentialProbeStatus;
|
|
21
|
-
message?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface WatchCredentialSourceResolution {
|
|
24
|
-
requestedSource: WatchCredentialSource;
|
|
25
|
-
resolvedSource?: WatchResolvedCredentialSource;
|
|
26
|
-
authStatus: WatchAuthStatus;
|
|
27
|
-
error?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface WatchSessionRecord {
|
|
30
|
-
id: string;
|
|
31
|
-
backend: WatchBackend;
|
|
32
|
-
runtime: WatchRuntime;
|
|
33
|
-
transport?: WatchTransport;
|
|
34
|
-
mode: WatchMode;
|
|
35
|
-
cwd: string;
|
|
36
|
-
model?: string;
|
|
37
|
-
prompt?: string;
|
|
38
|
-
passthroughArgs: string[];
|
|
39
|
-
credentialSource: WatchCredentialSource;
|
|
40
|
-
resolvedCredentialSource?: WatchResolvedCredentialSource;
|
|
41
|
-
approvalSource?: WatchApprovalSource;
|
|
42
|
-
command: string;
|
|
43
|
-
args: string[];
|
|
44
|
-
status: WatchSessionStatus;
|
|
45
|
-
startedAt: string;
|
|
46
|
-
endedAt?: string;
|
|
47
|
-
exitCode?: number | null;
|
|
48
|
-
signal?: string | null;
|
|
49
|
-
error?: string;
|
|
50
|
-
backendSessionId?: string;
|
|
51
|
-
archiveDir: string;
|
|
52
|
-
eventsFile: string;
|
|
53
|
-
}
|
|
54
|
-
export type WatchApprovalRequestKind = 'command-approval' | 'file-change-approval' | 'permissions-approval' | 'codex-approval';
|
|
55
|
-
export type WatchInteractionRequestKind = WatchApprovalRequestKind | 'user-input';
|
|
56
|
-
export type WatchApprovalDecision = 'accept' | 'accept_for_session' | 'decline' | 'cancel';
|
|
57
|
-
export type WatchSecretaryApprovalDecision = 'accept' | 'decline' | 'cancel';
|
|
58
|
-
export type WatchApprovalOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always' | (string & {});
|
|
59
|
-
export interface WatchApprovalOption {
|
|
60
|
-
optionId: string;
|
|
61
|
-
label: string;
|
|
62
|
-
kind?: WatchApprovalOptionKind;
|
|
63
|
-
description?: string;
|
|
64
|
-
}
|
|
65
|
-
interface WatchInteractionRequestBase {
|
|
66
|
-
kind: WatchInteractionRequestKind;
|
|
67
|
-
message: string;
|
|
68
|
-
approvalOptions?: WatchApprovalOption[];
|
|
69
|
-
timeoutMs?: number;
|
|
70
|
-
expiresAt?: string;
|
|
71
|
-
raw?: unknown;
|
|
72
|
-
}
|
|
73
|
-
export interface WatchCommandApprovalRequest extends WatchInteractionRequestBase {
|
|
74
|
-
kind: 'command-approval';
|
|
75
|
-
command?: string;
|
|
76
|
-
cwd?: string;
|
|
77
|
-
}
|
|
78
|
-
export interface WatchFileChangeApprovalRequest extends WatchInteractionRequestBase {
|
|
79
|
-
kind: 'file-change-approval';
|
|
80
|
-
reason?: string;
|
|
81
|
-
}
|
|
82
|
-
export interface WatchPermissionsApprovalRequest extends WatchInteractionRequestBase {
|
|
83
|
-
kind: 'permissions-approval';
|
|
84
|
-
permissions: Record<string, unknown>;
|
|
85
|
-
}
|
|
86
|
-
export interface WatchCodexApprovalRequest extends WatchInteractionRequestBase {
|
|
87
|
-
kind: 'codex-approval';
|
|
88
|
-
}
|
|
89
|
-
export interface WatchUserInputOption {
|
|
90
|
-
label: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
}
|
|
93
|
-
export interface WatchUserInputQuestion {
|
|
94
|
-
id: string;
|
|
95
|
-
header: string;
|
|
96
|
-
question: string;
|
|
97
|
-
options: WatchUserInputOption[];
|
|
98
|
-
}
|
|
99
|
-
export interface WatchUserInputRequest extends WatchInteractionRequestBase {
|
|
100
|
-
kind: 'user-input';
|
|
101
|
-
questions: WatchUserInputQuestion[];
|
|
102
|
-
}
|
|
103
|
-
export type WatchApprovalRequest = WatchCommandApprovalRequest | WatchFileChangeApprovalRequest | WatchPermissionsApprovalRequest | WatchCodexApprovalRequest;
|
|
104
|
-
export type WatchInteractionRequest = WatchApprovalRequest | WatchUserInputRequest;
|
|
105
|
-
export interface WatchUserInputAnswerRecord {
|
|
106
|
-
answers: string[];
|
|
107
|
-
}
|
|
108
|
-
export type WatchUserInputAnswers = Record<string, WatchUserInputAnswerRecord>;
|
|
109
|
-
export type WatchSecretaryRecommendationSource = 'model' | 'fallback';
|
|
110
|
-
export interface WatchSecretaryRecommendationBase {
|
|
111
|
-
kind: WatchInteractionRequestKind;
|
|
112
|
-
canAutoDecide: boolean;
|
|
113
|
-
confidence?: number;
|
|
114
|
-
reason?: string;
|
|
115
|
-
reactionWindowMs?: number;
|
|
116
|
-
source?: WatchSecretaryRecommendationSource;
|
|
117
|
-
}
|
|
118
|
-
export interface WatchSecretaryApprovalRecommendation extends WatchSecretaryRecommendationBase {
|
|
119
|
-
kind: WatchApprovalRequestKind;
|
|
120
|
-
decision?: WatchSecretaryApprovalDecision;
|
|
121
|
-
}
|
|
122
|
-
export interface WatchSecretaryUserInputRecommendation extends WatchSecretaryRecommendationBase {
|
|
123
|
-
kind: 'user-input';
|
|
124
|
-
answers?: WatchUserInputAnswers;
|
|
125
|
-
}
|
|
126
|
-
export type WatchSecretaryRecommendation = WatchSecretaryApprovalRecommendation | WatchSecretaryUserInputRecommendation;
|
|
127
|
-
export interface WatchGrantCoverageDecision {
|
|
128
|
-
covers: boolean;
|
|
129
|
-
confidence?: number;
|
|
130
|
-
reason?: string;
|
|
131
|
-
source?: WatchSecretaryRecommendationSource;
|
|
132
|
-
}
|
|
133
|
-
export interface ParseWatchSecretaryRecommendationOptions {
|
|
134
|
-
mode: WatchMode;
|
|
135
|
-
request: WatchInteractionRequest;
|
|
136
|
-
defaultReactionWindowMs?: number;
|
|
137
|
-
}
|
|
138
|
-
export declare const DEFAULT_WATCH_SECRETARY_REACTION_WINDOW_MS = 5000;
|
|
139
|
-
export declare const MIN_WATCH_SECRETARY_REACTION_WINDOW_MS = 5000;
|
|
140
|
-
export declare const MAX_WATCH_SECRETARY_REACTION_WINDOW_MS = 60000;
|
|
141
|
-
export interface WatchToolCallEvent {
|
|
142
|
-
type: 'tool.call';
|
|
143
|
-
name: string;
|
|
144
|
-
arguments?: Record<string, unknown>;
|
|
145
|
-
raw?: unknown;
|
|
146
|
-
}
|
|
147
|
-
export interface WatchApprovalRequiredEvent {
|
|
148
|
-
type: 'approval.required';
|
|
149
|
-
message: string;
|
|
150
|
-
request?: WatchApprovalRequest;
|
|
151
|
-
raw?: unknown;
|
|
152
|
-
}
|
|
153
|
-
export interface WatchInputRequiredEvent {
|
|
154
|
-
type: 'input.required';
|
|
155
|
-
message: string;
|
|
156
|
-
request: WatchUserInputRequest;
|
|
157
|
-
raw?: unknown;
|
|
158
|
-
}
|
|
159
|
-
export interface WatchAssistantDeltaEvent {
|
|
160
|
-
type: 'assistant.delta';
|
|
161
|
-
text: string;
|
|
162
|
-
raw?: unknown;
|
|
163
|
-
}
|
|
164
|
-
export interface WatchAssistantDoneEvent {
|
|
165
|
-
type: 'assistant.done';
|
|
166
|
-
text?: string;
|
|
167
|
-
raw?: unknown;
|
|
168
|
-
}
|
|
169
|
-
export interface WatchNoteEvent {
|
|
170
|
-
type: 'session.note';
|
|
171
|
-
message: string;
|
|
172
|
-
raw?: unknown;
|
|
173
|
-
}
|
|
174
|
-
export type WatchNormalizedEvent = WatchToolCallEvent | WatchApprovalRequiredEvent | WatchInputRequiredEvent | WatchAssistantDeltaEvent | WatchAssistantDoneEvent | WatchNoteEvent;
|
|
175
|
-
export interface WatchEventLogEntry {
|
|
176
|
-
timestamp: string;
|
|
177
|
-
stream: WatchOutputStream;
|
|
178
|
-
line: string;
|
|
179
|
-
events: WatchNormalizedEvent[];
|
|
180
|
-
}
|
|
181
|
-
export interface WatchThreadMetadata extends Record<string, unknown> {
|
|
182
|
-
kind: 'watch';
|
|
183
|
-
delegatedTo: 'secretary';
|
|
184
|
-
sessionId: string;
|
|
185
|
-
backend: WatchBackend;
|
|
186
|
-
runtime: WatchRuntime;
|
|
187
|
-
transport?: WatchTransport;
|
|
188
|
-
mode: WatchMode;
|
|
189
|
-
cwd: string;
|
|
190
|
-
model?: string;
|
|
191
|
-
credentialSource: WatchCredentialSource;
|
|
192
|
-
resolvedCredentialSource?: WatchResolvedCredentialSource;
|
|
193
|
-
approvalSource?: WatchApprovalSource;
|
|
194
|
-
status: WatchSessionStatus;
|
|
195
|
-
backendSessionId?: string;
|
|
196
|
-
}
|
|
197
|
-
export type WatchTranscriptMessageRole = 'user' | 'assistant' | 'system';
|
|
198
|
-
export type WatchTranscriptMessageSource = 'user' | 'primary-agent' | 'secretary' | 'tool' | 'system';
|
|
199
|
-
export interface WatchTranscriptMessage {
|
|
200
|
-
role: WatchTranscriptMessageRole;
|
|
201
|
-
source: WatchTranscriptMessageSource;
|
|
202
|
-
content: string;
|
|
203
|
-
createdAt: string;
|
|
204
|
-
}
|
|
205
|
-
export interface CreateWatchSessionIdOptions {
|
|
206
|
-
now?: Date;
|
|
207
|
-
randomId?: string;
|
|
208
|
-
}
|
|
209
|
-
export interface WatchArchiveRelativePaths {
|
|
210
|
-
sessionDir: string;
|
|
211
|
-
sessionFile: string;
|
|
212
|
-
eventsFile: string;
|
|
213
|
-
}
|
|
214
|
-
export declare const WATCH_HOME_DIRNAME = "watch";
|
|
215
|
-
export declare const WATCH_SESSIONS_DIRNAME = "sessions";
|
|
216
|
-
export declare const WATCH_SESSION_FILE_NAME = "session.json";
|
|
217
|
-
export declare const WATCH_EVENTS_FILE_NAME = "events.jsonl";
|
|
218
|
-
export declare function normalizeWatchUserInputQuestion(value: unknown, fallbackId?: string): WatchUserInputQuestion | null;
|
|
219
|
-
export declare function resolveWatchQuestionAnswer(question: WatchUserInputQuestion, answer: string): string[];
|
|
220
|
-
export declare function normalizeWatchApprovalOptions(value: unknown): WatchApprovalOption[];
|
|
221
|
-
export declare function createWatchSessionId(options?: CreateWatchSessionIdOptions): string;
|
|
222
|
-
export declare function normalizeWatchCredentialSource(source?: WatchCredentialSource | null): WatchCredentialSource;
|
|
223
|
-
export declare function shouldAttemptCloudCredentialProbe(requestedSource: WatchCredentialSource, localAuthStatus: WatchAuthStatus): boolean;
|
|
224
|
-
export declare function formatWatchAutoFallbackMessage(localMessage: string, detail: string): string;
|
|
225
|
-
export declare function resolveWatchCredentialSourceResolution(input: {
|
|
226
|
-
requestedSource?: WatchCredentialSource | null;
|
|
227
|
-
localAuthStatus: WatchAuthStatus;
|
|
228
|
-
cloudCredentialProbe?: WatchCloudCredentialProbe;
|
|
229
|
-
defaultLocalMessage?: string;
|
|
230
|
-
}): WatchCredentialSourceResolution;
|
|
231
|
-
export declare function resolveWatchAutoApprovalDecision(input: {
|
|
232
|
-
mode: WatchMode;
|
|
233
|
-
request: WatchApprovalRequest;
|
|
234
|
-
}): WatchApprovalDecision | null;
|
|
235
|
-
export declare function createFallbackWatchSecretaryRecommendation(input: {
|
|
236
|
-
mode: WatchMode;
|
|
237
|
-
request: WatchInteractionRequest;
|
|
238
|
-
}): WatchSecretaryRecommendation | null;
|
|
239
|
-
export declare function parseWatchSecretaryRecommendation(text: string, options: ParseWatchSecretaryRecommendationOptions): WatchSecretaryRecommendation | null;
|
|
240
|
-
export declare function watchApprovalDecisionLabel(decision: WatchApprovalDecision): string;
|
|
241
|
-
export declare function watchUserInputAnswersSummary(answers: WatchUserInputAnswers): string;
|
|
242
|
-
export declare function parseWatchGrantCoverageDecision(text: string): WatchGrantCoverageDecision | null;
|
|
243
|
-
export declare function computeWatchSecretaryReactionWindowMs(confidence: number | undefined, fallback?: number): number;
|
|
244
|
-
export declare function getWatchAuthLoginCommand(backend: WatchBackend): string | null;
|
|
245
|
-
export declare function formatWatchBackendAuthMessage(backend: WatchBackend, detail?: string): string;
|
|
246
|
-
export declare function looksLikeWatchAuthFailureText(text: string): boolean;
|
|
247
|
-
export declare function parseWatchClaudeAuthStatus(stdout: string): WatchAuthStatus;
|
|
248
|
-
export declare function detectWatchAuthFailure(backend: WatchBackend, line: string): WatchAuthFailure | null;
|
|
249
|
-
export declare function parseWatchJsonLine(line: string): Record<string, unknown> | null;
|
|
250
|
-
export declare function extractWatchSessionIdFromJsonLine(line: string): string | undefined;
|
|
251
|
-
export declare function isTrustedWatchCommand(command: string | null | undefined): boolean;
|
|
252
|
-
export declare function normalizeCodexAppServerInteractionRequest(message: Record<string, unknown>): WatchInteractionRequest | null;
|
|
253
|
-
export declare function resolveWatchInteractionAutoResponse(input: {
|
|
254
|
-
mode: WatchMode;
|
|
255
|
-
request: WatchInteractionRequest;
|
|
256
|
-
}): unknown | null;
|
|
257
|
-
export declare function buildCodexApprovalResponse(request: WatchApprovalRequest, decision: WatchApprovalDecision): unknown;
|
|
258
|
-
export declare function buildCodexUserInputResponse(answers: WatchUserInputAnswers): {
|
|
259
|
-
answers: WatchUserInputAnswers;
|
|
260
|
-
};
|
|
261
|
-
export declare function buildWatchUserInputResponse(answers: WatchUserInputAnswers): {
|
|
262
|
-
answers: WatchUserInputAnswers;
|
|
263
|
-
};
|
|
264
|
-
export declare function normalizeAcpInteractionRequest(message: Record<string, unknown>): WatchInteractionRequest | null;
|
|
265
|
-
export declare function normalizeAcpRequest(message: Record<string, unknown>): WatchNormalizedEvent[];
|
|
266
|
-
export declare function normalizeAcpSessionNotification(message: Record<string, unknown>): WatchNormalizedEvent[];
|
|
267
|
-
export declare function buildAcpPermissionResponse(request: WatchApprovalRequest, decision: WatchApprovalDecision): {
|
|
268
|
-
outcome: {
|
|
269
|
-
outcome: 'selected';
|
|
270
|
-
optionId: string;
|
|
271
|
-
} | {
|
|
272
|
-
outcome: 'cancelled';
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
export declare function parseWatchJsonProtocolLine(line: string): WatchNormalizedEvent[];
|
|
276
|
-
export declare function normalizeCodexAppServerNotification(message: Record<string, unknown>): WatchNormalizedEvent[];
|
|
277
|
-
export declare function normalizeCodexAppServerRequest(message: Record<string, unknown>): WatchNormalizedEvent[];
|
|
278
|
-
export declare function getWatchArchiveRelativePaths(sessionId: string): WatchArchiveRelativePaths;
|
|
279
|
-
export declare function buildWatchThreadMetadata(record: WatchSessionRecord): WatchThreadMetadata;
|
|
280
|
-
export declare function buildWatchTranscriptMessages(entries: WatchEventLogEntry[]): WatchTranscriptMessage[];
|
|
281
|
-
export {};
|